Help us shape the future of Go! Take the 2026 Go Developer Survey

engines

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 8 Imported by: 0

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

View Source
const DefaultMaxDepth = 3

DefaultMaxDepth mirrors the config default for mesnada.delegation.maxDepth.

Variables

This section is empty.

Functions

func CanDelegate

func CanDelegate(ownLevel int) bool

CanDelegate reports whether an agent running at ownLevel may still spawn subagents. It drives hiding the spawn/swarm/await tools.

func CheckEnabled

func CheckEnabled(name string) error

CheckEnabled returns a *DisabledError when name is disabled.

func CheckSpawnDepth

func CheckSpawnDepth(taskLevel int) error

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

func FilterEnabled(names []string) []string

FilterEnabled returns names without the disabled engines, preserving order.

func IsDisabled

func IsDisabled(name string) bool

IsDisabled reports whether name is disabled in the live configuration. Native engines are never disabled.

func IsNative

func IsNative(name string) bool

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 Normalize

func Normalize(name string) string

Normalize maps engine aliases to their canonical name and trims whitespace.

func NormalizeDisabledList

func NormalizeDisabledList(list []string) []string

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

type CustomEngine struct {
	Name    string
	Command string
}

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.

func Builtin

func Builtin() []Engine

Builtin returns a copy 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.

Jump to

Keyboard shortcuts

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