agent

package
v0.120.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 19 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 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.

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 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 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 ValidateEngine

func ValidateEngine(engine string) error

ValidateEngine checks if an engine string is valid.

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)) *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 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)) *Manager

NewManager creates a new agent manager.

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) 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) 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 Process

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

Process represents a running Copilot CLI process.

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 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