supervisor

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProviderProxy

type ProviderProxy struct {
	// contains filtered or unexported fields
}

ProviderProxy implements provider.Provider but forwards requests to the Supervisor.

func NewProviderProxy

func NewProviderProxy(sv *Supervisor, providerID, defaultModel string, opts ...ProxyOption) *ProviderProxy

NewProviderProxy creates a new proxy for a specific provider.

func (*ProviderProxy) Generate

Generate forwards the request to the Supervisor.

func (*ProviderProxy) ID

func (p *ProviderProxy) ID() string

ID returns the provider ID.

func (*ProviderProxy) ListModels

func (p *ProviderProxy) ListModels(ctx context.Context) ([]provider.ModelInfo, error)

ListModels is not proxied yet; returns empty list. Implement when model listing via proxy is needed.

type ProxyOption

type ProxyOption interface {
	// contains filtered or unexported methods
}

ProxyOption configures optional parameters for ProviderProxy.

func WithFallback

func WithFallback(providerID, model string) ProxyOption

WithFallback configures a fallback provider and model used when the primary fails.

func WithMaxTokens

func WithMaxTokens(n int) ProxyOption

WithMaxTokens sets the default max tokens for generation requests.

func WithTemperature

func WithTemperature(t float64) ProxyOption

WithTemperature sets the default temperature for generation requests.

type Supervisor

type Supervisor struct {
	Config *config.Config
	// contains filtered or unexported fields
}

Supervisor is the root component that manages secrets and lifecycle.

func New

func New(cfg *config.Config) (*Supervisor, error)

New creates a new Supervisor.

func (*Supervisor) ExecuteTool

func (s *Supervisor) ExecuteTool(ctx context.Context, cmd string) (string, error)

ExecuteTool forwards a command execution request to the internal exec tool. Importantly, the exec tool is configured with an environment whitelist in New(), ensuring that sensitive secrets (like API keys) are NOT passed to the command.

func (*Supervisor) Generate

func (s *Supervisor) Generate(ctx context.Context, providerID, model string, params provider.GenerateParams) (iter.Seq2[provider.StreamEvent, error], error)

Generate forwards a generation request to the appropriate provider. This is called by the Runtime via the Proxy.

func (*Supervisor) GetBackgroundStatus

func (s *Supervisor) GetBackgroundStatus(id string) (map[string]interface{}, error)

GetBackgroundStatus returns the status of a background process.

func (*Supervisor) StartBackground

func (s *Supervisor) StartBackground(cmd string) (string, error)

StartBackground starts a command in the background.

func (*Supervisor) StopBackground

func (s *Supervisor) StopBackground(id string) error

StopBackground stops a background process.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL