agent

package
v0.416.6 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package agent handles spawning and managing CLI agent processes.

Package agent handles spawning and managing CLI agent processes.

Package agent handles spawning and managing CLI agent processes.

Package agent handles spawning and managing Copilot CLI processes.

Package agent handles spawning and managing ACP agent processes.

Package agent handles spawning and managing CLI agent processes.

Package agent handles spawning and managing CLI agent processes.

Package agent handles spawning and managing CLI agent processes.

Package agent handles spawning and managing CLI agent processes.

Package agent handles spawning and managing CLI agent processes.

Package agent handles spawning and managing CLI agent processes.

Package agent handles spawning and managing CLI agent processes.

Package agent handles spawning and managing CLI agent processes.

Package agent handles spawning and managing CLI agent processes.

Package agent handles spawning and managing CLI agent processes.

Package agent handles spawning and managing CLI agent processes.

Index

Constants

View Source
const (
	MCPFormatMesnada = mcpconv.FormatMesnada
	MCPFormatVSCode  = mcpconv.FormatVSCode
)
View Source
const AntigravityProjectMCPConfigPath = mcpconv.AntigravityProjectMCPConfigPath

AntigravityProjectMCPConfigPath is the project-local target path used by --all mode.

Variables

This section is empty.

Functions

func BuildSubagentMCPConfig added in v0.260.0

func BuildSubagentMCPConfig(pandoBin string, pandoMCPServers []PandoMCPServerEntry, gatewayExposeEnabled bool) mcpconv.CanonicalConfig

BuildSubagentMCPConfig builds the canonical MCP config to inject into subagents.

It always adds pando itself as a stdio MCP server, which exposes: remembrances, mesnada orchestration, fetch, web search (Google/Brave/Perplexity/Exa), and browser/Chrome DevTools tools.

On top of that every MCP server configured in pando is forwarded to the subagent UNLESS gatewayExposeEnabled is true, meaning those servers are already proxied through pando's own MCP-gateway (so the subagent already has access to them via the "pando" entry).

func CleanupCopilotMCPConfig added in v0.290.1

func CleanupCopilotMCPConfig(taskID, baseDir string) error

CleanupCopilotMCPConfig removes the temporary Copilot MCP config for a task.

func CleanupGeminiSettingsFile

func CleanupGeminiSettingsFile(settingsPath string) error

CleanupGeminiSettingsFile removes the temporary settings file created for a task.

func CleanupMCPConfig

func CleanupMCPConfig(taskID, baseDir string) error

CleanupMCPConfig removes the temporary MCP config file for a task.

func ConvertMCPConfig

func ConvertMCPConfig(mcpConfigPath, tempDir, workDir string) (string, error)

ConvertMCPConfig converts a Mesnada MCP config file to Claude CLI format.

func ConvertMCPConfigForAntigravity

func ConvertMCPConfigForAntigravity(mcpConfigPath, tempDir, workDir string) (string, error)

ConvertMCPConfigForAntigravity converts canonical MCP config to Antigravity mcp_config.json format.

func ConvertMCPConfigForCopilot added in v0.290.1

func ConvertMCPConfigForCopilot(mcpConfigPath, taskID, baseDir, workDir string) (string, error)

ConvertMCPConfigForCopilot converts Mesnada MCP config to GitHub Copilot CLI format. Copilot uses the canonical mcpServers schema (compatible with VS Code mcp.json entries).

func ConvertMCPConfigForOpenCode

func ConvertMCPConfigForOpenCode(mcpConfigPath, taskID, baseDir, workDir string) (string, error)

ConvertMCPConfigForOpenCode converts Mesnada MCP config to OpenCode.ai format.

func ConvertMCPConfigForTask

func ConvertMCPConfigForTask(mcpConfigPath, taskID, baseDir, workDir string) (string, error)

ConvertMCPConfigForTask converts MCP config for a specific task.

func ConvertMCPConfigFormats

func ConvertMCPConfigFormats(inputPath, outputPath, workDir, fromFormat, toFormat string) error

ConvertMCPConfigFormats converts input MCP config between supported formats (e.g. --from/--to).

func CreateGeminiSettingsFile

func CreateGeminiSettingsFile(mcpConfigPath, taskID, baseDir, workDir string) (string, error)

CreateGeminiSettingsFile creates a temporary settings.json file with MCP configuration.

func EnsureEnginesDirExists added in v0.416.4

func EnsureEnginesDirExists(enginesDir string) error

EnsureEnginesDirExists creates the engines directory and drops a README when it does not yet exist.

func ValidateEngine

func ValidateEngine(engine string, mgr ...*Manager) error

ValidateEngine checks if an engine string is valid. Pass an optional manager to also accept loaded custom template engines.

func WriteCanonicalConfigToFile added in v0.260.0

func WriteCanonicalConfigToFile(cfg mcpconv.CanonicalConfig, tempDir, filename string) (string, error)

WriteCanonicalConfigToFile serialises cfg directly to a JSON file at tempDir/filename without reading any input file from disk. This is used by the orchestrator when the MCP config is built dynamically at spawn time.

Types

type ACPProcess

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

ACPProcess represents a running ACP agent process.

type ACPSpawner

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

ACPSpawner manages ACP agent process spawning.

func NewACPSpawner

func NewACPSpawner(acpConfig *mesnadaconfig.ACPConfig, logDir string, onComplete func(task *models.Task), onProgress func(taskID string, percentage int, description string) error) *ACPSpawner

NewACPSpawner creates a new spawner for ACP agents.

func (*ACPSpawner) Cancel

func (s *ACPSpawner) Cancel(taskID string) error

Cancel stops a running agent and sends a session/cancel notification if possible.

func (*ACPSpawner) IsRunning

func (s *ACPSpawner) IsRunning(taskID string) bool

IsRunning checks if a task is currently running.

func (*ACPSpawner) Pause

func (s *ACPSpawner) Pause(taskID string) error

Pause stops a running agent without marking it as cancelled. Note: ACP doesn't have a native "pause" concept, so we treat it like cancel.

func (*ACPSpawner) RunningCount

func (s *ACPSpawner) RunningCount() int

RunningCount returns the number of currently running processes.

func (*ACPSpawner) SessionControl

func (s *ACPSpawner) SessionControl(taskID, action, message, mode string) (interface{}, error)

SessionControl sends a control command to an active ACP session. Supported actions: "follow_up", "set_mode", "cancel", "status" This is part of Phase 5 API extension. Full implementation will be completed in Phase 6.

func (*ACPSpawner) Shutdown

func (s *ACPSpawner) Shutdown()

Shutdown cancels all running processes.

func (*ACPSpawner) Spawn

func (s *ACPSpawner) Spawn(ctx context.Context, task *models.Task) error

Spawn implements the Spawner interface for ACP agents. It creates a process, connects via ACP, and runs the agent session.

func (*ACPSpawner) Wait

func (s *ACPSpawner) Wait(ctx context.Context, taskID string) error

Wait blocks until a task completes or context is cancelled.

type AntigravityMCPConfig

type AntigravityMCPConfig = mcpconv.AntigravityConfig

AntigravityMCPConfig represents Antigravity mcp_config.json format.

type AntigravityMCPServer

type AntigravityMCPServer = mcpconv.AntigravityServer

AntigravityMCPServer represents a server entry in Antigravity format.

type ClaudeMCPConfig

type ClaudeMCPConfig = mcpconv.ClaudeConfig

ClaudeMCPConfig represents the Claude CLI MCP configuration format.

type ClaudeMCPServer

type ClaudeMCPServer = mcpconv.ClaudeServer

ClaudeMCPServer represents a server entry in Claude CLI format.

type ClaudeProcess

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

ClaudeProcess represents a running Claude CLI process.

type ClaudeSpawner

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

ClaudeSpawner manages Claude CLI process spawning.

func NewClaudeSpawner

func NewClaudeSpawner(logDir string, onComplete func(task *models.Task)) *ClaudeSpawner

NewClaudeSpawner creates a new Claude CLI agent spawner.

func (*ClaudeSpawner) Cancel

func (s *ClaudeSpawner) Cancel(taskID string) error

Cancel stops a running agent.

func (*ClaudeSpawner) IsRunning

func (s *ClaudeSpawner) IsRunning(taskID string) bool

IsRunning checks if a task is currently running.

func (*ClaudeSpawner) Pause

func (s *ClaudeSpawner) Pause(taskID string) error

Pause stops a running agent without marking it as cancelled.

func (*ClaudeSpawner) RunningCount

func (s *ClaudeSpawner) RunningCount() int

RunningCount returns the number of currently running processes.

func (*ClaudeSpawner) Shutdown

func (s *ClaudeSpawner) Shutdown()

Shutdown cancels all running processes.

func (*ClaudeSpawner) Spawn

func (s *ClaudeSpawner) Spawn(ctx context.Context, task *models.Task) error

Spawn starts a new Claude CLI agent.

func (*ClaudeSpawner) Wait

func (s *ClaudeSpawner) Wait(ctx context.Context, taskID string) error

Wait blocks until a task completes or context is cancelled.

type CopilotSpawner

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

CopilotSpawner manages Copilot CLI process spawning.

func NewCopilotSpawner

func NewCopilotSpawner(logDir string, onComplete func(task *models.Task)) *CopilotSpawner

NewCopilotSpawner creates a new Copilot CLI agent spawner.

func (*CopilotSpawner) Cancel

func (s *CopilotSpawner) Cancel(taskID string) error

Cancel stops a running agent.

func (*CopilotSpawner) GetProcess

func (s *CopilotSpawner) GetProcess(taskID string) (*Process, bool)

GetProcess returns information about a running process.

func (*CopilotSpawner) IsRunning

func (s *CopilotSpawner) IsRunning(taskID string) bool

IsRunning checks if a task is currently running.

func (*CopilotSpawner) Pause

func (s *CopilotSpawner) Pause(taskID string) error

Pause stops a running agent without marking it as cancelled.

func (*CopilotSpawner) RunningCount

func (s *CopilotSpawner) RunningCount() int

RunningCount returns the number of currently running processes.

func (*CopilotSpawner) Shutdown

func (s *CopilotSpawner) Shutdown()

Shutdown cancels all running processes.

func (*CopilotSpawner) Spawn

func (s *CopilotSpawner) Spawn(ctx context.Context, task *models.Task) error

Spawn starts a new Copilot CLI agent.

func (*CopilotSpawner) Wait

func (s *CopilotSpawner) Wait(ctx context.Context, taskID string) error

Wait blocks until a task completes or context is cancelled.

type EngineTemplate added in v0.416.4

type EngineTemplate struct {
	// Name is the engine identifier used in spawn calls (no spaces).
	// Defaults to the filename stem when omitted.
	Name string `yaml:"name"`

	// Description is a human-readable summary shown in tool descriptions.
	Description string `yaml:"description"`

	// Command is the binary to execute (resolved via PATH or absolute path).
	Command string `yaml:"command"`

	// Args are fixed CLI arguments always prepended before any dynamic args.
	// Values may include Go template expressions: {{.Model}}, {{.WorkDir}},
	// {{.TaskID}}, {{.LogFile}}.
	Args []string `yaml:"args"`

	// PromptMode controls how the prompt is delivered: "arg" (default) or "stdin".
	PromptMode PromptMode `yaml:"prompt_mode"`

	// PromptArg is the CLI flag used to pass the prompt when PromptMode is "arg".
	// Defaults to "-p".
	PromptArg string `yaml:"prompt_arg"`

	// ModelArg is the CLI flag used to pass the model ID (e.g. "--model").
	// When empty the model is not passed as an argument.
	ModelArg string `yaml:"model_arg"`

	// DefaultModel is the model used when none is specified in the spawn request.
	DefaultModel string `yaml:"default_model"`

	// Models lists the models available for this engine.
	Models []EngineTemplateModel `yaml:"models"`

	// OutputFormat is "text" (default) or "jsonl".
	OutputFormat OutputFormat `yaml:"output_format"`

	// JSONLOutputField is a dot-delimited path to the string field that contains
	// the human-readable output within each JSONL line (e.g. "delta.text").
	// Only used when OutputFormat is "jsonl".
	JSONLOutputField string `yaml:"jsonl_output_field"`

	// JSONLFilterField is an optional field name used to filter JSONL lines.
	// Only lines where JSONLFilterField == JSONLFilterValue are processed.
	JSONLFilterField string `yaml:"jsonl_filter_field"`

	// JSONLFilterValue is the required value for JSONLFilterField.
	JSONLFilterValue string `yaml:"jsonl_filter_value"`

	// Env holds additional environment variables set for the spawned process.
	// Values support Go template expressions: {{.Model}}, {{.WorkDir}}, {{.TaskID}}, {{.LogFile}}.
	//
	//   env:
	//     MY_KEY: "static-value"
	//     MODEL_ID: "{{.Model}}"
	Env map[string]string `yaml:"env"`

	// EnvVars is an alternative list-style notation for environment variables.
	// Useful when the explicit name/value structure is preferred over the map form.
	// Both Env and EnvVars may be used simultaneously; EnvVars is applied last.
	// Values support the same Go template expressions as Env.
	//
	//   env_vars:
	//     - name: MY_KEY
	//       value: "static-value"
	//     - name: MODEL_ID
	//       value: "{{.Model}}"
	EnvVars []EnvVar `yaml:"env_vars"`
}

EngineTemplate defines a user-supplied custom agent engine loaded from a <name>.template.yaml file in the engines directory.

func LoadEngineTemplate added in v0.416.4

func LoadEngineTemplate(path string) (*EngineTemplate, error)

LoadEngineTemplate reads a single template YAML file. If the Name field is empty the filename stem is used as the engine name.

func ScanEnginesDir added in v0.416.4

func ScanEnginesDir(dir string) ([]*EngineTemplate, []error)

ScanEnginesDir scans dir for files matching the pattern *.template.yaml and returns one EngineTemplate per valid file. Errors from individual files are logged and skipped; the caller receives only successfully loaded templates.

func (*EngineTemplate) Validate added in v0.416.4

func (t *EngineTemplate) Validate() error

Validate checks that all required fields are present and values are valid.

type EngineTemplateInfo added in v0.416.4

type EngineTemplateInfo struct {
	Name         string
	Description  string
	DefaultModel string
	Models       []string
}

EngineTemplateInfo holds metadata about a loaded custom engine used for building tool descriptions.

type EngineTemplateModel added in v0.416.4

type EngineTemplateModel struct {
	ID          string `yaml:"id"`
	Description string `yaml:"description"`
}

EngineTemplateModel defines a model available for a custom engine.

type EnvVar added in v0.416.4

type EnvVar struct {
	Name  string `yaml:"name"`
	Value string `yaml:"value"`
}

EnvVar defines a single environment variable with an explicit name and value.

type GeminiMCPServer

type GeminiMCPServer = mcpconv.GeminiServer

GeminiMCPServer represents a server entry in Gemini CLI format.

type GeminiProcess

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

GeminiProcess represents a running Gemini CLI process.

type GeminiSettings

type GeminiSettings = mcpconv.GeminiSettings

GeminiSettings represents the Gemini CLI settings format.

type GeminiSpawner

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

GeminiSpawner manages Gemini CLI process spawning.

func NewGeminiSpawner

func NewGeminiSpawner(logDir string, onComplete func(task *models.Task)) *GeminiSpawner

NewGeminiSpawner creates a new Gemini CLI agent spawner.

func (*GeminiSpawner) Cancel

func (s *GeminiSpawner) Cancel(taskID string) error

Cancel stops a running agent.

func (*GeminiSpawner) IsRunning

func (s *GeminiSpawner) IsRunning(taskID string) bool

IsRunning checks if a task is currently running.

func (*GeminiSpawner) Pause

func (s *GeminiSpawner) Pause(taskID string) error

Pause stops a running agent without marking it as cancelled.

func (*GeminiSpawner) RunningCount

func (s *GeminiSpawner) RunningCount() int

RunningCount returns the number of currently running processes.

func (*GeminiSpawner) Shutdown

func (s *GeminiSpawner) Shutdown()

Shutdown cancels all running processes.

func (*GeminiSpawner) Spawn

func (s *GeminiSpawner) Spawn(ctx context.Context, task *models.Task) error

Spawn starts a new Gemini CLI agent.

func (*GeminiSpawner) Wait

func (s *GeminiSpawner) Wait(ctx context.Context, taskID string) error

Wait blocks until a task completes or context is cancelled.

type Manager

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

Manager coordinates multiple engine spawners.

func NewManager

func NewManager(cfg *mesnadaconfig.Config, logDir string, onComplete func(task *models.Task), onProgress func(taskID string, percentage int, description string) error, modelResolver ...func(string) string) *Manager

NewManager creates a new agent manager. modelResolver is an optional function that converts a model ID (possibly empty or shorthand) into the full "provider.model" string expected by pando's -m flag. When nil, model IDs are forwarded as-is to the pando CLI spawner.

func (*Manager) ACPSessionControl

func (m *Manager) ACPSessionControl(taskID, action, message, mode string) (interface{}, error)

ACPSessionControl sends a control command to an active ACP session. This method is part of Phase 5 API but the actual implementation will be completed in Phase 6 (ACP Client Enhancement).

func (*Manager) Cancel

func (m *Manager) Cancel(taskID string) error

Cancel stops a running agent.

func (*Manager) CleanupTask

func (m *Manager) CleanupTask(taskID string)

CleanupTask removes the engine tracking for a completed task.

func (*Manager) CustomEngineNames added in v0.416.4

func (m *Manager) CustomEngineNames() []string

CustomEngineNames returns the names of all loaded custom engine templates.

func (*Manager) GetProcess

func (m *Manager) GetProcess(taskID string) (*Process, bool)

GetProcess returns information about a running process (legacy support).

func (*Manager) IsRunning

func (m *Manager) IsRunning(taskID string) bool

IsRunning checks if a task is currently running.

func (*Manager) Pause

func (m *Manager) Pause(taskID string) error

Pause stops a running agent without marking it as cancelled.

func (*Manager) RunningCount

func (m *Manager) RunningCount() int

RunningCount returns the total number of currently running processes.

func (*Manager) Shutdown

func (m *Manager) Shutdown()

Shutdown cancels all running processes.

func (*Manager) Spawn

func (m *Manager) Spawn(ctx context.Context, task *models.Task) error

Spawn starts a new agent using the appropriate engine.

func (*Manager) TemplateRegistryInfo added in v0.416.4

func (m *Manager) TemplateRegistryInfo() []EngineTemplateInfo

TemplateRegistry returns the loaded custom engine template registry. Used by tool description builders to enumerate available custom engines.

func (*Manager) Wait

func (m *Manager) Wait(ctx context.Context, taskID string) error

Wait blocks until a task completes or context is cancelled.

type MesnadaMCPConfig

type MesnadaMCPConfig = mcpconv.CanonicalConfig

MesnadaMCPConfig represents the Mesnada MCP configuration format.

type MesnadaMCPServer

type MesnadaMCPServer = mcpconv.CanonicalServer

MesnadaMCPServer represents a server entry in Mesnada format.

type MistralProcess

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

MistralProcess represents a running Mistral Vibe CLI process.

type MistralSpawner

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

MistralSpawner manages Mistral Vibe CLI process spawning.

func NewMistralSpawner

func NewMistralSpawner(logDir string, onComplete func(task *models.Task)) *MistralSpawner

NewMistralSpawner creates a new Mistral Vibe CLI agent spawner.

func (*MistralSpawner) Cancel

func (s *MistralSpawner) Cancel(taskID string) error

Cancel stops a running agent.

func (*MistralSpawner) IsRunning

func (s *MistralSpawner) IsRunning(taskID string) bool

IsRunning checks if a task is currently running.

func (*MistralSpawner) Pause

func (s *MistralSpawner) Pause(taskID string) error

Pause stops a running agent without marking it as cancelled.

func (*MistralSpawner) RunningCount

func (s *MistralSpawner) RunningCount() int

RunningCount returns the number of currently running processes.

func (*MistralSpawner) Shutdown

func (s *MistralSpawner) Shutdown()

Shutdown cancels all running processes.

func (*MistralSpawner) Spawn

func (s *MistralSpawner) Spawn(ctx context.Context, task *models.Task) error

Spawn starts a new Mistral Vibe CLI agent.

func (*MistralSpawner) Wait

func (s *MistralSpawner) Wait(ctx context.Context, taskID string) error

Wait blocks until a task completes or context is cancelled.

type OllamaClaudeProcess

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

OllamaClaudeProcess represents a running Ollama Claude CLI process.

type OllamaClaudeSpawner

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

OllamaClaudeSpawner manages Ollama Claude CLI process spawning.

func NewOllamaClaudeSpawner

func NewOllamaClaudeSpawner(logDir string, onComplete func(task *models.Task)) *OllamaClaudeSpawner

NewOllamaClaudeSpawner creates a new Ollama Claude CLI agent spawner.

func (*OllamaClaudeSpawner) Cancel

func (s *OllamaClaudeSpawner) Cancel(taskID string) error

Cancel stops a running process.

func (*OllamaClaudeSpawner) Cleanup

func (s *OllamaClaudeSpawner) Cleanup() error

Cleanup performs cleanup operations for the spawner.

func (*OllamaClaudeSpawner) GetOutput

func (s *OllamaClaudeSpawner) GetOutput(taskID string) (string, error)

GetOutput returns the current output of a running task.

func (*OllamaClaudeSpawner) IsRunning

func (s *OllamaClaudeSpawner) IsRunning(taskID string) bool

IsRunning checks if a task is currently running.

func (*OllamaClaudeSpawner) Spawn

func (s *OllamaClaudeSpawner) Spawn(ctx context.Context, task *models.Task) error

Spawn starts a new Ollama Claude CLI agent.

type OllamaOpenCodeProcess

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

OllamaOpenCodeProcess represents a running Ollama OpenCode CLI process.

type OllamaOpenCodeSpawner

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

OllamaOpenCodeSpawner manages Ollama OpenCode CLI process spawning.

func NewOllamaOpenCodeSpawner

func NewOllamaOpenCodeSpawner(logDir string, onComplete func(task *models.Task)) *OllamaOpenCodeSpawner

NewOllamaOpenCodeSpawner creates a new Ollama OpenCode CLI agent spawner.

func (*OllamaOpenCodeSpawner) Cancel

func (s *OllamaOpenCodeSpawner) Cancel(taskID string) error

Cancel stops a running process.

func (*OllamaOpenCodeSpawner) Cleanup

func (s *OllamaOpenCodeSpawner) Cleanup() error

Cleanup performs cleanup operations for the spawner.

func (*OllamaOpenCodeSpawner) GetOutput

func (s *OllamaOpenCodeSpawner) GetOutput(taskID string) (string, error)

GetOutput returns the current output of a running task.

func (*OllamaOpenCodeSpawner) IsRunning

func (s *OllamaOpenCodeSpawner) IsRunning(taskID string) bool

IsRunning checks if a task is currently running.

func (*OllamaOpenCodeSpawner) Spawn

func (s *OllamaOpenCodeSpawner) Spawn(ctx context.Context, task *models.Task) error

Spawn starts a new Ollama OpenCode CLI agent.

type OpenCodeMCPConfig

type OpenCodeMCPConfig = mcpconv.OpenCodeConfig

OpenCodeMCPConfig represents the OpenCode.ai MCP configuration format.

type OpenCodeMCPServer

type OpenCodeMCPServer = mcpconv.OpenCodeServer

OpenCodeMCPServer represents a server entry in OpenCode.ai format.

type OpenCodeProcess

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

OpenCodeProcess represents a running OpenCode CLI process.

type OpenCodeSpawner

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

OpenCodeSpawner manages OpenCode.ai CLI process spawning.

func NewOpenCodeSpawner

func NewOpenCodeSpawner(logDir string, onComplete func(task *models.Task)) *OpenCodeSpawner

NewOpenCodeSpawner creates a new OpenCode.ai CLI agent spawner.

func (*OpenCodeSpawner) Cancel

func (s *OpenCodeSpawner) Cancel(taskID string) error

Cancel stops a running agent.

func (*OpenCodeSpawner) IsRunning

func (s *OpenCodeSpawner) IsRunning(taskID string) bool

IsRunning checks if a task is currently running.

func (*OpenCodeSpawner) Pause

func (s *OpenCodeSpawner) Pause(taskID string) error

Pause stops a running agent without marking it as cancelled.

func (*OpenCodeSpawner) RunningCount

func (s *OpenCodeSpawner) RunningCount() int

RunningCount returns the number of currently running processes.

func (*OpenCodeSpawner) Shutdown

func (s *OpenCodeSpawner) Shutdown()

Shutdown cancels all running processes.

func (*OpenCodeSpawner) Spawn

func (s *OpenCodeSpawner) Spawn(ctx context.Context, task *models.Task) error

Spawn starts a new OpenCode.ai CLI agent.

func (*OpenCodeSpawner) Wait

func (s *OpenCodeSpawner) Wait(ctx context.Context, taskID string) error

Wait blocks until a task completes or context is cancelled.

type OutputFormat added in v0.416.4

type OutputFormat string

OutputFormat describes the expected output format from the CLI process.

const (
	// OutputFormatText treats output as plain text (default).
	OutputFormatText OutputFormat = "text"
	// OutputFormatJSONL parses output as newline-delimited JSON.
	OutputFormatJSONL OutputFormat = "jsonl"
)

type PandoCLISpawner added in v0.245.0

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

PandoCLISpawner manages pando CLI process spawning. It runs the pando binary itself as a subprocess with --yolo --output-format text, making it the default engine when no specific engine is requested.

func NewPandoCLISpawner added in v0.245.0

func NewPandoCLISpawner(logDir string, onComplete func(task *models.Task), resolveModel func(string) string) *PandoCLISpawner

NewPandoCLISpawner creates a new pando CLI spawner. resolveModel converts a model ID (possibly empty or shorthand) into the full "provider.model" string expected by pando's -m flag. If nil, model IDs are passed through as-is.

func (*PandoCLISpawner) Cancel added in v0.245.0

func (s *PandoCLISpawner) Cancel(taskID string) error

Cancel stops a running pando CLI process.

func (*PandoCLISpawner) IsRunning added in v0.245.0

func (s *PandoCLISpawner) IsRunning(taskID string) bool

IsRunning reports whether the task is currently running.

func (*PandoCLISpawner) Pause added in v0.245.0

func (s *PandoCLISpawner) Pause(taskID string) error

Pause stops a running process without marking it as cancelled.

func (*PandoCLISpawner) RunningCount added in v0.245.0

func (s *PandoCLISpawner) RunningCount() int

RunningCount returns the number of currently running processes.

func (*PandoCLISpawner) Shutdown added in v0.245.0

func (s *PandoCLISpawner) Shutdown()

Shutdown cancels all running processes.

func (*PandoCLISpawner) Spawn added in v0.245.0

func (s *PandoCLISpawner) Spawn(ctx context.Context, task *models.Task) error

Spawn starts a new pando CLI subprocess with the task prompt.

func (*PandoCLISpawner) Wait added in v0.245.0

func (s *PandoCLISpawner) Wait(ctx context.Context, taskID string) error

Wait blocks until the task completes or the context is cancelled.

type PandoMCPServerEntry added in v0.260.0

type PandoMCPServerEntry struct {
	Name    string
	Command string
	Args    []string
	Env     []string // KEY=VALUE pairs (same format as pando config)
	Type    string   // "stdio", "sse", "streamable-http"
	URL     string
	Headers map[string]string
}

PandoMCPServerEntry represents an MCP server configured in pando that can be forwarded to subagents.

type Process

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

Process represents a running Copilot CLI process.

type PromptMode added in v0.416.4

type PromptMode string

PromptMode controls how the prompt is passed to the CLI process.

const (
	// PromptModeArg passes the prompt as a CLI argument (default).
	PromptModeArg PromptMode = "arg"
	// PromptModeStdin pipes the prompt to the process stdin.
	PromptModeStdin PromptMode = "stdin"
)

type Spawner

type Spawner interface {
	// Spawn starts a new agent process.
	Spawn(ctx context.Context, task *models.Task) error

	// Cancel stops a running agent.
	Cancel(taskID string) error

	// Pause stops a running agent without marking it as cancelled.
	Pause(taskID string) error

	// Wait blocks until a task completes or context is cancelled.
	Wait(ctx context.Context, taskID string) error

	// IsRunning checks if a task is currently running.
	IsRunning(taskID string) bool

	// RunningCount returns the number of currently running processes.
	RunningCount() int

	// Shutdown cancels all running processes.
	Shutdown()
}

Spawner defines the interface for spawning and managing CLI agent processes.

type TemplateProcess added in v0.416.4

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

TemplateProcess represents a running custom-engine process.

type TemplateRegistry added in v0.416.4

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

TemplateRegistry loads and stores custom engine templates from a directory.

func NewTemplateRegistry added in v0.416.4

func NewTemplateRegistry(enginesDir, logDir string, onComplete func(*models.Task)) *TemplateRegistry

NewTemplateRegistry creates a registry and scans enginesDir for *.template.yaml files. Errors from individual files are logged and skipped; the registry remains usable for all successfully loaded templates. Returns a non-nil registry even when enginesDir does not exist.

func (*TemplateRegistry) Get added in v0.416.4

func (r *TemplateRegistry) Get(engineName string) (*TemplateSpawner, bool)

Get returns the spawner for the named engine, if loaded.

func (*TemplateRegistry) Has added in v0.416.4

func (r *TemplateRegistry) Has(engineName string) bool

Has reports whether the named engine is registered.

func (*TemplateRegistry) Infos added in v0.416.4

func (r *TemplateRegistry) Infos() []EngineTemplateInfo

Infos returns metadata for all loaded engines, sorted by name.

func (*TemplateRegistry) ListEngines added in v0.416.4

func (r *TemplateRegistry) ListEngines() []string

ListEngines returns the names of all loaded custom engines, sorted.

func (*TemplateRegistry) RunningCount added in v0.416.4

func (r *TemplateRegistry) RunningCount() int

RunningCount returns the total number of active processes across all template spawners.

func (*TemplateRegistry) Shutdown added in v0.416.4

func (r *TemplateRegistry) Shutdown()

Shutdown cancels all running processes across every template spawner.

type TemplateSpawner added in v0.416.4

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

TemplateSpawner is a generic spawner driven by an EngineTemplate config.

func NewTemplateSpawner added in v0.416.4

func NewTemplateSpawner(tpl *EngineTemplate, logDir string, onComplete func(task *models.Task)) *TemplateSpawner

NewTemplateSpawner creates a spawner for the given engine template.

func (*TemplateSpawner) Cancel added in v0.416.4

func (s *TemplateSpawner) Cancel(taskID string) error

Cancel stops a running custom-engine process.

func (*TemplateSpawner) IsRunning added in v0.416.4

func (s *TemplateSpawner) IsRunning(taskID string) bool

IsRunning reports whether a task is currently running.

func (*TemplateSpawner) Pause added in v0.416.4

func (s *TemplateSpawner) Pause(taskID string) error

Pause stops a running process without marking it as cancelled.

func (*TemplateSpawner) RunningCount added in v0.416.4

func (s *TemplateSpawner) RunningCount() int

RunningCount returns the number of active processes.

func (*TemplateSpawner) Shutdown added in v0.416.4

func (s *TemplateSpawner) Shutdown()

Shutdown cancels all running processes.

func (*TemplateSpawner) Spawn added in v0.416.4

func (s *TemplateSpawner) Spawn(ctx context.Context, task *models.Task) error

Spawn starts a new process for the custom engine.

func (*TemplateSpawner) Wait added in v0.416.4

func (s *TemplateSpawner) Wait(ctx context.Context, taskID string) error

Wait blocks until the task completes or ctx is cancelled.

type VSCodeMCPConfig

type VSCodeMCPConfig = mcpconv.VSCodeConfig

VSCodeMCPConfig represents VS Code .vscode/mcp.json format.

type VSCodeMCPServer

type VSCodeMCPServer = mcpconv.VSCodeServer

VSCodeMCPServer represents a server entry in VS Code format.

Jump to

Keyboard shortcuts

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