Documentation
¶
Overview ¶
Package engines is the single catalogue of Mesnada subagent engines and the live policy that governs them: which engines the user disabled in the Mesnada settings, and how deep delegations may nest (mesnada.delegation.maxDepth).
Every surface that can start a subagent (the native spawn/swarm tools, the mesnada MCP server, the orchestrator) and every surface that shows engines (WebUI API, TUI settings) goes through this package, so they agree on the catalogue and always read the current configuration: a settings change applies on the next call, without a restart.
Index ¶
- Constants
- func CanDelegate(ownLevel int) bool
- func CheckEnabled(name string) error
- func CheckSpawnDepth(taskLevel int) error
- func Disabled() []string
- func FilterEnabled(names []string) []string
- func IsDisabled(name string) bool
- func IsNative(name string) bool
- func MaxDepth() int
- func NestedAllowed() bool
- func Normalize(name string) string
- func NormalizeDisabledList(list []string) []string
- type CustomEngine
- type DepthError
- type DisabledError
- type Engine
- type Kind
- type Status
Constants ¶
const DefaultMaxDepth = 3
DefaultMaxDepth mirrors the config default for mesnada.delegation.maxDepth.
Variables ¶
This section is empty.
Functions ¶
func CanDelegate ¶
CanDelegate reports whether an agent running at ownLevel may still spawn subagents. It drives hiding the spawn/swarm/await tools.
func CheckEnabled ¶
CheckEnabled returns a *DisabledError when name is disabled.
func CheckSpawnDepth ¶
CheckSpawnDepth refuses a task that would run at taskLevel when that exceeds the live cap. With MaxDepth=1 (or allowNestedSubagents=false) the main session (level 0) may spawn level-1 subagents, but those cannot spawn level-2 grandchildren.
func Disabled ¶
func Disabled() []string
Disabled returns the engines disabled in the live configuration.
func FilterEnabled ¶
FilterEnabled returns names without the disabled engines, preserving order.
func IsDisabled ¶
IsDisabled reports whether name is disabled in the live configuration. Native engines are never disabled.
func IsNative ¶
IsNative reports whether name is one of Pando's own engines (including the empty/default engine). Native engines are never disableable.
func MaxDepth ¶
func MaxDepth() int
MaxDepth returns the live delegation nesting cap (>= 1). It already folds in mesnada.delegation.allowNestedSubagents: when that is false the cap is 1.
func NestedAllowed ¶
func NestedAllowed() bool
NestedAllowed reports the live mesnada.delegation.allowNestedSubagents value.
func NormalizeDisabledList ¶
NormalizeDisabledList canonicalises a disabled-engines list (aliases resolved, blanks/duplicates/native engines dropped, sorted). It is the same normalisation the config applies on load and save.
Types ¶
type CustomEngine ¶
CustomEngine describes a template engine for detection.
type DepthError ¶
type DepthError struct {
Level int
Max int
// NestedDisabled is true when the cap comes from allowNestedSubagents=false
// rather than from maxDepth.
NestedDisabled bool
}
DepthError is returned when a spawn would exceed the nesting cap.
func (*DepthError) Error ¶
func (e *DepthError) Error() string
type DisabledError ¶
type DisabledError struct {
Engine string
}
DisabledError is returned when a task asks for a disabled engine. The message tells the model how to recover.
func (*DisabledError) Error ¶
func (e *DisabledError) Error() string
type Engine ¶
type Engine struct {
Name string
Label string
Kind Kind
Binary string // executable looked up on PATH; empty when not applicable
}
Engine is one entry of the built-in catalogue.
type Kind ¶
type Kind string
Kind classifies an engine for display.
const ( // KindNative engines run Pando itself; they can never be disabled. KindNative Kind = "native" // KindCLI engines run a third-party CLI agent as a subprocess. KindCLI Kind = "cli" // KindACP engines talk to a third-party agent over ACP. KindACP Kind = "acp" // KindCustom engines come from *.template.yaml files in the engines dir. KindCustom Kind = "custom" )
type Status ¶
type Status struct {
Name string `json:"name"`
Label string `json:"label"`
Kind Kind `json:"kind"`
Binary string `json:"binary"`
Installed bool `json:"installed"`
Path string `json:"path"`
Enabled bool `json:"enabled"`
Locked bool `json:"locked"`
}
Status is one engine as reported to the settings UIs.
func Detect ¶
func Detect(custom []CustomEngine, disabled []string) []Status
Detect lists every built-in engine plus the given custom engines with their installed state (binary on PATH) and whether disabled lists them. A custom template that shadows a built-in name replaces that entry.