stable

package
v0.30.4 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ControlSocket          string
	TombstoneFile          string
	HTTPDebug              string
	MaxRuntimes            int
	IdleTimeout            time.Duration
	ShutdownTimeout        time.Duration
	PermissionClaimTimeout time.Duration
	ChildQuestionTimeout   time.Duration

	// MaxTreeBudget is the inherited descendant budget capacity for a root
	// supervisor tree. It bounds the total concurrent runtimes across the
	// whole tree, including nested supervisors. Zero uses
	// admission.DefaultTreeBudget. Ignored when TreeBudgetFile is set (a
	// nested supervisor joins an existing tree rather than creating one).
	MaxTreeBudget int

	// TreeBudgetFile is the path of an existing tree budget to join. When
	// empty, the supervisor is a root and creates a new budget file in
	// Avenor-owned runtime state. When set, the supervisor opens the existing
	// file as a nested participant sharing the root's capacity.
	TreeBudgetFile string
}

type SpawnParams

type SpawnParams struct {
	Prompt            string `json:"prompt,omitempty"`
	PromptFile        string `json:"prompt_file,omitempty"`
	Dir               string `json:"dir"`
	Agent             string `json:"agent,omitempty"`
	AgentProfile      string `json:"agent_profile,omitempty"`
	Label             string `json:"label,omitempty"`
	Model             string `json:"model,omitempty"`
	Thinking          string `json:"thinking,omitempty"`
	ServerURL         string `json:"server_url,omitempty"`
	Backend           string `json:"backend,omitempty"`
	OnEvent           string `json:"on_event,omitempty"`
	SentinelFile      string `json:"sentinel_file,omitempty"`
	PermissionHandler string `json:"permission_handler,omitempty"`
	AutoApprove       bool   `json:"auto_approve,omitempty"`
	Timeout           int    `json:"timeout,omitempty"`
	MaxRetries        int    `json:"max_retries,omitempty"`
	LoopFile          string `json:"loop_file,omitempty"`
	TeamFile          string `json:"team_file,omitempty"`
	RosterFile        string `json:"roster_file,omitempty"`
	RosterEntry       string `json:"roster_entry,omitempty"`
	SessionID         string `json:"session_id,omitempty"`
	ParentID          string `json:"parent_id,omitempty"`     // runtime ID of the parent agent
	ParentRunID       string `json:"parent_run_id,omitempty"` // broker run ID of the parent, for channel messaging
}

type SpawnResult

type SpawnResult struct {
	RuntimeID        string `json:"runtime_id"`
	SessionID        string `json:"session_id"`
	OnEvent          string `json:"on_event"`
	SentinelFile     string `json:"sentinel_file"`
	BrokerURL        string `json:"broker_url,omitempty"`
	ParentToken      string `json:"parent_token,omitempty"`
	Agent            string `json:"agent,omitempty"`
	AgentProfile     string `json:"agent_profile,omitempty"`
	Model            string `json:"model,omitempty"`
	Backend          string `json:"backend,omitempty"`
	RosterFile       string `json:"roster_file,omitempty"`
	RosterEntry      string `json:"roster_entry,omitempty"`
	EffectiveAgent   string `json:"effective_agent,omitempty"`
	EffectiveModel   string `json:"effective_model,omitempty"`
	EffectiveBackend string `json:"effective_backend,omitempty"`
}

type Supervisor

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

func NewSupervisor

func NewSupervisor(cfg Config) *Supervisor

func (*Supervisor) HTTPCancelRuntime

func (s *Supervisor) HTTPCancelRuntime(runtimeID string) error

HTTPCancelRuntime implements control.StableAdapter. Returns control.ErrRuntimeNotFound when the ID does not exist.

func (*Supervisor) HTTPRuntimeStatus

func (s *Supervisor) HTTPRuntimeStatus(runtimeID string) (any, error)

HTTPRuntimeStatus implements control.StableAdapter. Returns the runtime snapshot when runtimeID is known. Returns control.ErrRuntimeNotFound when the ID does not exist.

func (*Supervisor) List

func (s *Supervisor) List() any

func (*Supervisor) Run

func (s *Supervisor) Run() int

func (*Supervisor) RuntimeAnswerPermission

func (s *Supervisor) RuntimeAnswerPermission(rtID, requestID, optionID, message string) error

func (*Supervisor) RuntimeCancel

func (s *Supervisor) RuntimeCancel(rtID string) error

func (*Supervisor) RuntimeInterruptAndPrompt

func (s *Supervisor) RuntimeInterruptAndPrompt(rtID, text string, keepQueue bool) error

func (*Supervisor) RuntimePrompt

func (s *Supervisor) RuntimePrompt(rtID, text, requestID string) error

func (*Supervisor) RuntimeResult

func (s *Supervisor) RuntimeResult(rtID string) (any, error)

RuntimeResult exposes the complete terminal reply without widening the bounded RuntimeStatus presentation surface.

func (*Supervisor) RuntimeSendToParent

func (s *Supervisor) RuntimeSendToParent(rtID, message string) error

func (*Supervisor) RuntimeStatus

func (s *Supervisor) RuntimeStatus(rtID string) (any, error)

func (*Supervisor) Shutdown

func (s *Supervisor) Shutdown(mode string) error

func (*Supervisor) Spawn

func (s *Supervisor) Spawn(raw json.RawMessage) (any, error)

func (*Supervisor) TreeBudgetPath

func (s *Supervisor) TreeBudgetPath() string

TreeBudgetPath returns the path of the tree budget file, or empty when no budget is active. The root command entry point sets AVENOR_TREE_BUDGET to this value so descendant processes inherit the tree identity.

func (*Supervisor) TreeBudgetStatus

func (s *Supervisor) TreeBudgetStatus() any

TreeBudgetStatus implements control.StableHandler and returns a diagnostic snapshot of the optional tree-scoped admission budget.

func (*Supervisor) WaitForCapacity

func (s *Supervisor) WaitForCapacity(ctx context.Context) error

WaitForCapacity blocks until a tree budget slot may be available, ctx is canceled, or the supervisor shuts down. It does not reserve capacity; the caller must retry Acquire/spawn after waking. This primitive lets callers that can wait avoid busy-polling without requiring the admission layer to schedule or prioritize their work.

func (*Supervisor) WaitForCapacityMS

func (s *Supervisor) WaitForCapacityMS(timeoutMS int) error

WaitForCapacityMS implements control.StableHandler. It waits for up to timeoutMS milliseconds for a capacity change notification, then returns so the caller can retry spawn. It does not reserve capacity. A bounded wait keeps the control connection responsive; callers that need longer waits poll.

Jump to

Keyboard shortcuts

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