Documentation
¶
Overview ¶
Package acp provides types and utilities for working with the Agent Client Protocol.
Index ¶
- func NewPlanService(logger *log.Logger) *planServiceImpl
- type ACPAgent
- type ACPAgentConfig
- type ACPCapabilities
- type ACPClientCallbacks
- type ACPClientConnection
- func (c *ACPClientConnection) CreateTerminal(ctx context.Context, command string, args []string, cwd string) (string, error)
- func (c *ACPClientConnection) GetSessionID() acpsdk.SessionId
- func (c *ACPClientConnection) GetWorkDir() string
- func (c *ACPClientConnection) KillTerminal(ctx context.Context, terminalID string) error
- func (c *ACPClientConnection) ReadTextFile(ctx context.Context, path string) (string, error)
- func (c *ACPClientConnection) ReleaseTerminal(ctx context.Context, terminalID string) error
- func (c *ACPClientConnection) TerminalOutput(ctx context.Context, terminalID string) (string, error)
- func (c *ACPClientConnection) WaitForTerminalExit(ctx context.Context, terminalID string) (*int, error)
- func (c *ACPClientConnection) WriteTextFile(ctx context.Context, path string, content string) error
- type ACPModelInfo
- type ACPPermissionBridge
- type ACPServerSession
- func (s *ACPServerSession) AskPermission() bool
- func (s *ACPServerSession) Cancel()
- func (s *ACPServerSession) CancelGoalExecution()
- func (s *ACPServerSession) CleanMode() bool
- func (s *ACPServerSession) ClearGoalCancel()
- func (s *ACPServerSession) Context() context.Context
- func (s *ACPServerSession) Goal() *GoalStateUpdate
- func (s *ACPServerSession) HasAgentConnection() bool
- func (s *ACPServerSession) Mode() string
- func (s *ACPServerSession) Model() string
- func (s *ACPServerSession) PandoSessionID() string
- func (s *ACPServerSession) PermissionConfigured() bool
- func (s *ACPServerSession) Persona() string
- func (s *ACPServerSession) ReasoningEffort() string
- func (s *ACPServerSession) SendUpdate(update acpsdk.SessionUpdate) (err error)
- func (s *ACPServerSession) SetAgentConnection(conn *acpsdk.AgentSideConnection)
- func (s *ACPServerSession) SetAskPermission(enabled bool)
- func (s *ACPServerSession) SetCleanMode(enabled bool)
- func (s *ACPServerSession) SetGoal(goal *GoalStateUpdate)
- func (s *ACPServerSession) SetGoalCancel(cancel context.CancelFunc)
- func (s *ACPServerSession) SetMode(mode string)
- func (s *ACPServerSession) SetModel(model string)
- func (s *ACPServerSession) SetPermissionConfigured(configured bool)
- func (s *ACPServerSession) SetPersona(persona string)
- func (s *ACPServerSession) SetReasoningEffort(value string)
- func (s *ACPServerSession) SetThinkingMode(value string)
- func (s *ACPServerSession) SetThinkingStreamMode(mode string)
- func (s *ACPServerSession) SetVariant(variant string)
- func (s *ACPServerSession) SetWorkDir(workDir string)
- func (s *ACPServerSession) ThinkingMode() string
- func (s *ACPServerSession) ThinkingStreamMode() string
- func (s *ACPServerSession) Variant() string
- type ACPSession
- type ACPSessionInfo
- type AgentEvent
- type AgentEventType
- type AgentService
- type DecodeTodosResult
- type GoalStateUpdate
- type HTTPTransport
- func (t *HTTPTransport) ActiveSessions() int
- func (t *HTTPTransport) Cleanup(ctx context.Context)
- func (t *HTTPTransport) CloseSession(sessionID string) error
- func (t *HTTPTransport) GetSessionInfo(sessionID string) (*SessionInfo, error)
- func (t *HTTPTransport) GetStats() TransportStats
- func (t *HTTPTransport) HandleHealth(w http.ResponseWriter, r *http.Request)
- func (t *HTTPTransport) HandleRequest(w http.ResponseWriter, r *http.Request)
- func (t *HTTPTransport) HandleSSE(w http.ResponseWriter, r *http.Request)
- func (t *HTTPTransport) ListSessions() []SessionInfo
- type HTTPTransportConfig
- type McpServerConfig
- type MesnadaACPClient
- func (c *MesnadaACPClient) CreateTerminal(ctx context.Context, params acpsdk.CreateTerminalRequest) (acpsdk.CreateTerminalResponse, error)
- func (c *MesnadaACPClient) ExtractDiffsFromContent(content []acpsdk.ToolCallContent) map[string]string
- func (c *MesnadaACPClient) GetOutput() string
- func (c *MesnadaACPClient) GetPermissionQueue() *PermissionQueue
- func (c *MesnadaACPClient) GetProgress() (int, string)
- func (c *MesnadaACPClient) GetToolCallCount() int
- func (c *MesnadaACPClient) HandleExtensionMethod(ctx context.Context, method string, params json.RawMessage) (any, error)
- func (c *MesnadaACPClient) KillTerminal(ctx context.Context, params acpsdk.KillTerminalRequest) (acpsdk.KillTerminalResponse, error)
- func (c *MesnadaACPClient) ReadTextFile(ctx context.Context, params acpsdk.ReadTextFileRequest) (acpsdk.ReadTextFileResponse, error)
- func (c *MesnadaACPClient) ReleaseTerminal(ctx context.Context, params acpsdk.ReleaseTerminalRequest) (acpsdk.ReleaseTerminalResponse, error)
- func (c *MesnadaACPClient) RequestPermission(ctx context.Context, params acpsdk.RequestPermissionRequest) (acpsdk.RequestPermissionResponse, error)
- func (c *MesnadaACPClient) SessionUpdate(ctx context.Context, params acpsdk.SessionNotification) error
- func (c *MesnadaACPClient) SetAutoPermission(auto bool)
- func (c *MesnadaACPClient) SetCapabilities(caps ACPCapabilities)
- func (c *MesnadaACPClient) TerminalOutput(ctx context.Context, params acpsdk.TerminalOutputRequest) (acpsdk.TerminalOutputResponse, error)
- func (c *MesnadaACPClient) WaitForTerminalExit(ctx context.Context, params acpsdk.WaitForTerminalExitRequest) (acpsdk.WaitForTerminalExitResponse, error)
- func (c *MesnadaACPClient) WriteTextFile(ctx context.Context, params acpsdk.WriteTextFileRequest) (acpsdk.WriteTextFileResponse, error)
- type PandoACPAgent
- func (a *PandoACPAgent) Authenticate(ctx context.Context, req acpsdk.AuthenticateRequest) (acpsdk.AuthenticateResponse, error)
- func (a *PandoACPAgent) Cancel(ctx context.Context, params acpsdk.CancelNotification) error
- func (a *PandoACPAgent) CloseSession(ctx context.Context, req acpsdk.CloseSessionRequest) (acpsdk.CloseSessionResponse, error)
- func (a *PandoACPAgent) GetCapabilities() acpsdk.AgentCapabilities
- func (a *PandoACPAgent) GetVersion() string
- func (a *PandoACPAgent) HandleExtensionMethod(ctx context.Context, method string, params json.RawMessage) (any, error)
- func (a *PandoACPAgent) Initialize(ctx context.Context, req acpsdk.InitializeRequest) (acpsdk.InitializeResponse, error)
- func (a *PandoACPAgent) ListSessions(ctx context.Context, _ acpsdk.ListSessionsRequest) (acpsdk.ListSessionsResponse, error)
- func (a *PandoACPAgent) LoadSession(ctx context.Context, req acpsdk.LoadSessionRequest) (acpsdk.LoadSessionResponse, error)
- func (a *PandoACPAgent) NewSession(ctx context.Context, req acpsdk.NewSessionRequest) (acpsdk.NewSessionResponse, error)
- func (a *PandoACPAgent) Prompt(ctx context.Context, req acpsdk.PromptRequest) (acpsdk.PromptResponse, error)
- func (a *PandoACPAgent) ResumeSession(ctx context.Context, req acpsdk.ResumeSessionRequest) (acpsdk.ResumeSessionResponse, error)
- func (a *PandoACPAgent) SetConnection(conn *acpsdk.AgentSideConnection)
- func (a *PandoACPAgent) SetSessionConfigOption(ctx context.Context, req acpsdk.SetSessionConfigOptionRequest) (acpsdk.SetSessionConfigOptionResponse, error)
- func (a *PandoACPAgent) SetSessionMode(ctx context.Context, req acpsdk.SetSessionModeRequest) (acpsdk.SetSessionModeResponse, error)
- func (a *PandoACPAgent) SetSessionModel(ctx context.Context, req acpsdk.SetSessionModelRequest) (acpsdk.SetSessionModelResponse, error)
- func (a *PandoACPAgent) SetSessionPersona(ctx context.Context, sessionID acpsdk.SessionId, personaName string) error
- func (a *PandoACPAgent) StartNotificationBroadcast(ctx context.Context)
- func (a *PandoACPAgent) UnstableSetSessionModel(ctx context.Context, req acpsdk.UnstableSetSessionModelRequest) (acpsdk.UnstableSetSessionModelResponse, error)
- type PendingPermission
- type PermissionQueue
- func (q *PermissionQueue) CleanupResolved(maxAge time.Duration) int
- func (q *PermissionQueue) GetAllPending() []*PendingPermission
- func (q *PermissionQueue) GetPending(taskID string) []*PendingPermission
- func (q *PermissionQueue) GetPermission(requestID string) (*PendingPermission, bool)
- func (q *PermissionQueue) QueuePermission(taskID string, sessionID acpsdk.SessionId, req acpsdk.RequestPermissionRequest) string
- func (q *PermissionQueue) ResolvePermission(requestID string, outcome acpsdk.RequestPermissionOutcome) error
- func (q *PermissionQueue) WaitForResolution(ctx context.Context, requestID string) (acpsdk.RequestPermissionOutcome, error)
- type PermissionRequestData
- type PermissionService
- type PersonaInfo
- type PlanEntry
- type PlanService
- type SessionInfo
- type SessionLLMOverrides
- type SessionPersonaState
- type SessionPlan
- type SessionService
- type SessionUpdate
- type SessionUpdateInfo
- type SessionUpdateType
- type SimpleACPAgent
- func (a *SimpleACPAgent) Authenticate(ctx context.Context, req acpsdk.AuthenticateRequest) (acpsdk.AuthenticateResponse, error)
- func (a *SimpleACPAgent) Cancel(ctx context.Context, params acpsdk.CancelNotification) error
- func (a *SimpleACPAgent) CloseSession(ctx context.Context, req acpsdk.CloseSessionRequest) (acpsdk.CloseSessionResponse, error)
- func (a *SimpleACPAgent) GetCapabilities() acpsdk.AgentCapabilities
- func (a *SimpleACPAgent) GetVersion() string
- func (a *SimpleACPAgent) Initialize(ctx context.Context, req acpsdk.InitializeRequest) (acpsdk.InitializeResponse, error)
- func (a *SimpleACPAgent) ListSessions(_ context.Context, _ acpsdk.ListSessionsRequest) (acpsdk.ListSessionsResponse, error)
- func (a *SimpleACPAgent) LoadSession(ctx context.Context, req acpsdk.LoadSessionRequest) (acpsdk.LoadSessionResponse, error)
- func (a *SimpleACPAgent) NewSession(ctx context.Context, req acpsdk.NewSessionRequest) (acpsdk.NewSessionResponse, error)
- func (a *SimpleACPAgent) Prompt(ctx context.Context, req acpsdk.PromptRequest) (acpsdk.PromptResponse, error)
- func (a *SimpleACPAgent) ResumeSession(ctx context.Context, req acpsdk.ResumeSessionRequest) (acpsdk.ResumeSessionResponse, error)
- func (a *SimpleACPAgent) SetSessionConfigOption(_ context.Context, _ acpsdk.SetSessionConfigOptionRequest) (acpsdk.SetSessionConfigOptionResponse, error)
- func (a *SimpleACPAgent) SetSessionMode(ctx context.Context, req acpsdk.SetSessionModeRequest) (acpsdk.SetSessionModeResponse, error)
- func (a *SimpleACPAgent) SetSessionModel(ctx context.Context, req acpsdk.SetSessionModelRequest) (acpsdk.SetSessionModelResponse, error)
- func (a *SimpleACPAgent) UnstableSetSessionModel(ctx context.Context, req acpsdk.UnstableSetSessionModelRequest) (acpsdk.UnstableSetSessionModelResponse, error)
- type StdioTransport
- type TodoInfo
- type ToolCallInfo
- type ToolHandlerFunc
- type TransportStats
- type UsageInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPlanService ¶ added in v0.402.0
NewPlanService creates a new plan service instance.
Types ¶
type ACPAgent ¶ added in v0.7.0
type ACPAgent interface {
acpsdk.Agent // Embeds the core SDK Agent interface
acpsdk.AgentLoader // Embeds the optional LoadSession capability
// GetVersion returns the agent version
GetVersion() string
// GetCapabilities returns the agent capabilities
GetCapabilities() acpsdk.AgentCapabilities
}
ACPAgent is the interface that ACP agents must implement. This allows the HTTP transport to work with different agent implementations. AgentExperimental is intentionally not embedded — the SDK dispatches its methods via type assertions, so agents only implement what they support.
type ACPAgentConfig ¶
type ACPAgentConfig struct {
// Name is the unique identifier for this agent configuration
Name string `json:"name" yaml:"name"`
// Title is a human-readable name for the agent
Title string `json:"title" yaml:"title"`
// Command is the binary to execute (e.g., "claude-code", "zed-acp")
Command string `json:"command" yaml:"command"`
// Args are the command-line arguments to pass to the agent
Args []string `json:"args" yaml:"args"`
// Env is a map of environment variables to set for the agent
Env map[string]string `json:"env" yaml:"env"`
// WorkDir is the default working directory for spawned tasks
WorkDir string `json:"work_dir" yaml:"work_dir"`
// Mode is the default operation mode: "code", "ask", or "architect"
Mode string `json:"mode" yaml:"mode"`
// McpServers is a list of MCP servers to pass to the agent
McpServers []McpServerConfig `json:"mcp_servers" yaml:"mcp_servers"`
}
ACPAgentConfig represents the configuration of an ACP agent in config.yaml.
type ACPCapabilities ¶
ACPCapabilities defines what an ACP agent is allowed to do.
type ACPClientCallbacks ¶ added in v0.7.0
type ACPClientCallbacks interface {
ReadTextFile(ctx context.Context, req acpsdk.ReadTextFileRequest) (acpsdk.ReadTextFileResponse, error)
WriteTextFile(ctx context.Context, req acpsdk.WriteTextFileRequest) (acpsdk.WriteTextFileResponse, error)
CreateTerminal(ctx context.Context, req acpsdk.CreateTerminalRequest) (acpsdk.CreateTerminalResponse, error)
TerminalOutput(ctx context.Context, req acpsdk.TerminalOutputRequest) (acpsdk.TerminalOutputResponse, error)
WaitForTerminalExit(ctx context.Context, req acpsdk.WaitForTerminalExitRequest) (acpsdk.WaitForTerminalExitResponse, error)
KillTerminal(ctx context.Context, req acpsdk.KillTerminalRequest) (acpsdk.KillTerminalResponse, error)
ReleaseTerminal(ctx context.Context, req acpsdk.ReleaseTerminalRequest) (acpsdk.ReleaseTerminalResponse, error)
}
ACPClientCallbacks defines the interface for calling back to the client.
type ACPClientConnection ¶ added in v0.7.0
type ACPClientConnection struct {
// contains filtered or unexported fields
}
ACPClientConnection wraps a client connection and provides methods to call back to the client for file operations and terminal execution. This is the INVERSE of MesnadaACPClient - it's used by Pando when acting as an ACP server to call methods on the connected client.
func NewACPClientConnection ¶ added in v0.7.0
func NewACPClientConnection(sessionID acpsdk.SessionId, conn ACPClientCallbacks, workDir string, logFile *os.File) *ACPClientConnection
NewACPClientConnection creates a new client connection wrapper.
func (*ACPClientConnection) CreateTerminal ¶ added in v0.7.0
func (c *ACPClientConnection) CreateTerminal(ctx context.Context, command string, args []string, cwd string) (string, error)
CreateTerminal calls the client to create a terminal and execute a command.
func (*ACPClientConnection) GetSessionID ¶ added in v0.7.0
func (c *ACPClientConnection) GetSessionID() acpsdk.SessionId
GetSessionID returns the session ID for this connection.
func (*ACPClientConnection) GetWorkDir ¶ added in v0.7.0
func (c *ACPClientConnection) GetWorkDir() string
GetWorkDir returns the working directory for this connection.
func (*ACPClientConnection) KillTerminal ¶ added in v0.7.0
func (c *ACPClientConnection) KillTerminal(ctx context.Context, terminalID string) error
KillTerminal calls the client to kill a running terminal.
func (*ACPClientConnection) ReadTextFile ¶ added in v0.7.0
ReadTextFile calls the client to read a file from their filesystem.
func (*ACPClientConnection) ReleaseTerminal ¶ added in v0.7.0
func (c *ACPClientConnection) ReleaseTerminal(ctx context.Context, terminalID string) error
ReleaseTerminal calls the client to release a terminal without waiting for it to exit.
func (*ACPClientConnection) TerminalOutput ¶ added in v0.7.0
func (c *ACPClientConnection) TerminalOutput(ctx context.Context, terminalID string) (string, error)
TerminalOutput calls the client to get the current output from a terminal.
func (*ACPClientConnection) WaitForTerminalExit ¶ added in v0.7.0
func (c *ACPClientConnection) WaitForTerminalExit(ctx context.Context, terminalID string) (*int, error)
WaitForTerminalExit calls the client to wait for a terminal to exit.
func (*ACPClientConnection) WriteTextFile ¶ added in v0.7.0
WriteTextFile calls the client to write a file to their filesystem.
type ACPModelInfo ¶ added in v0.100.0
ACPModelInfo holds minimal model metadata for ACP responses. Defined here to avoid importing internal/llm/models from this package.
type ACPPermissionBridge ¶ added in v0.120.0
type ACPPermissionBridge struct {
// contains filtered or unexported fields
}
ACPPermissionBridge translates Pando tool permission requests into ACP requestPermission calls to the connected editor. It is installed as a session handler when the session mode is "ask".
func NewACPPermissionBridge ¶ added in v0.120.0
func NewACPPermissionBridge(conn *acpsdk.AgentSideConnection, sessionID acpsdk.SessionId, logger *log.Logger) *ACPPermissionBridge
NewACPPermissionBridge creates a new bridge for the given session.
func (*ACPPermissionBridge) Handle ¶ added in v0.120.0
func (b *ACPPermissionBridge) Handle(req PermissionRequestData) bool
Handle processes a permission request by asking the connected editor via ACP. Returns true if approved, false if rejected. Signature matches what RegisterSessionHandler expects: func(req PermissionRequestData) bool
type ACPServerSession ¶ added in v0.100.0
type ACPServerSession struct {
// ID is the unique session identifier
ID acpsdk.SessionId
// WorkDir is the working directory for this session
WorkDir string
// CreatedAt is when the session was created
CreatedAt time.Time
// contains filtered or unexported fields
}
ACPServerSession represents an active ACP session on the server side. Each session manages a conversation between a client and the Pando LLM agent.
func NewACPServerSession ¶ added in v0.100.0
func NewACPServerSession( sessionID acpsdk.SessionId, workDir string, agentConn *acpsdk.AgentSideConnection, pandoSessionID string, ) *ACPServerSession
NewACPServerSession creates a new ACP server session.
func (*ACPServerSession) AskPermission ¶ added in v0.320.0
func (s *ACPServerSession) AskPermission() bool
AskPermission returns whether tool calls require explicit approval.
func (*ACPServerSession) Cancel ¶ added in v0.100.0
func (s *ACPServerSession) Cancel()
Cancel cancels in-flight session work while keeping ACP transport available for any final updates or future prompts on the same session.
func (*ACPServerSession) CancelGoalExecution ¶ added in v0.324.0
func (s *ACPServerSession) CancelGoalExecution()
CancelGoalExecution cancels the running goal iteration if one exists.
func (*ACPServerSession) CleanMode ¶ added in v0.407.0
func (s *ACPServerSession) CleanMode() bool
CleanMode reports whether the session should run in clean mode.
func (*ACPServerSession) ClearGoalCancel ¶ added in v0.324.0
func (s *ACPServerSession) ClearGoalCancel()
ClearGoalCancel removes the stored goal cancel function without cancelling it.
func (*ACPServerSession) Context ¶ added in v0.100.0
func (s *ACPServerSession) Context() context.Context
Context returns the session's execution context.
func (*ACPServerSession) Goal ¶ added in v0.324.0
func (s *ACPServerSession) Goal() *GoalStateUpdate
Goal returns the latest goal state snapshot.
func (*ACPServerSession) HasAgentConnection ¶ added in v0.110.0
func (s *ACPServerSession) HasAgentConnection() bool
HasAgentConnection reports whether the session has an attached agent connection.
func (*ACPServerSession) Mode ¶ added in v0.100.0
func (s *ACPServerSession) Mode() string
Mode returns the current session mode.
func (*ACPServerSession) Model ¶ added in v0.100.0
func (s *ACPServerSession) Model() string
Model returns the current model ID.
func (*ACPServerSession) PandoSessionID ¶ added in v0.100.0
func (s *ACPServerSession) PandoSessionID() string
PandoSessionID returns the internal Pando session ID.
func (*ACPServerSession) PermissionConfigured ¶ added in v0.320.0
func (s *ACPServerSession) PermissionConfigured() bool
PermissionConfigured reports whether askPermission was explicitly selected.
func (*ACPServerSession) Persona ¶ added in v0.204.0
func (s *ACPServerSession) Persona() string
Persona returns the current persona name.
func (*ACPServerSession) ReasoningEffort ¶ added in v0.407.0
func (s *ACPServerSession) ReasoningEffort() string
ReasoningEffort returns the stored ACP reasoning_effort override, if any.
func (*ACPServerSession) SendUpdate ¶ added in v0.100.0
func (s *ACPServerSession) SendUpdate(update acpsdk.SessionUpdate) (err error)
SendUpdate sends a SessionUpdate notification to the client via the AgentSideConnection.
func (*ACPServerSession) SetAgentConnection ¶ added in v0.110.0
func (s *ACPServerSession) SetAgentConnection(conn *acpsdk.AgentSideConnection)
SetAgentConnection updates the agent-side connection used to stream updates.
func (*ACPServerSession) SetAskPermission ¶ added in v0.320.0
func (s *ACPServerSession) SetAskPermission(enabled bool)
SetAskPermission stores whether tool calls require explicit approval.
func (*ACPServerSession) SetCleanMode ¶ added in v0.407.0
func (s *ACPServerSession) SetCleanMode(enabled bool)
SetCleanMode stores whether the session should run in clean mode.
func (*ACPServerSession) SetGoal ¶ added in v0.324.0
func (s *ACPServerSession) SetGoal(goal *GoalStateUpdate)
SetGoal stores the latest goal state snapshot.
func (*ACPServerSession) SetGoalCancel ¶ added in v0.324.0
func (s *ACPServerSession) SetGoalCancel(cancel context.CancelFunc)
SetGoalCancel stores the cancel function for the running goal iteration.
func (*ACPServerSession) SetMode ¶ added in v0.100.0
func (s *ACPServerSession) SetMode(mode string)
SetMode stores the session mode.
func (*ACPServerSession) SetModel ¶ added in v0.100.0
func (s *ACPServerSession) SetModel(model string)
SetModel stores the requested model ID.
func (*ACPServerSession) SetPermissionConfigured ¶ added in v0.320.0
func (s *ACPServerSession) SetPermissionConfigured(configured bool)
SetPermissionConfigured records whether askPermission was explicitly selected.
func (*ACPServerSession) SetPersona ¶ added in v0.204.0
func (s *ACPServerSession) SetPersona(persona string)
SetPersona stores the requested persona name.
func (*ACPServerSession) SetReasoningEffort ¶ added in v0.407.0
func (s *ACPServerSession) SetReasoningEffort(value string)
SetReasoningEffort stores the session-scoped ACP reasoning_effort override.
func (*ACPServerSession) SetThinkingMode ¶ added in v0.407.0
func (s *ACPServerSession) SetThinkingMode(value string)
SetThinkingMode stores the session-scoped ACP thinking_mode override.
func (*ACPServerSession) SetThinkingStreamMode ¶ added in v0.407.0
func (s *ACPServerSession) SetThinkingStreamMode(mode string)
SetThinkingStreamMode stores how reasoning/thinking should be streamed to ACP clients.
func (*ACPServerSession) SetVariant ¶ added in v0.100.0
func (s *ACPServerSession) SetVariant(variant string)
SetVariant stores the session variant.
func (*ACPServerSession) SetWorkDir ¶ added in v0.110.0
func (s *ACPServerSession) SetWorkDir(workDir string)
SetWorkDir updates the working directory associated with this session.
func (*ACPServerSession) ThinkingMode ¶ added in v0.407.0
func (s *ACPServerSession) ThinkingMode() string
ThinkingMode returns the stored ACP thinking_mode override, if any.
func (*ACPServerSession) ThinkingStreamMode ¶ added in v0.407.0
func (s *ACPServerSession) ThinkingStreamMode() string
ThinkingStreamMode returns the configured ACP thinking visibility mode.
func (*ACPServerSession) Variant ¶ added in v0.100.0
func (s *ACPServerSession) Variant() string
Variant returns the session variant.
type ACPSession ¶
type ACPSession struct {
// TaskID is the mesnada task identifier
TaskID string
// SessionID is the ACP session identifier returned by the agent
SessionID acpsdk.SessionId
// Conn is the client-side connection to the ACP agent
Conn *acpsdk.ClientSideConnection
// Cmd is the os/exec.Cmd for the running agent process
Cmd *exec.Cmd
// Cancel is the context cancellation function for this session
Cancel context.CancelFunc
}
ACPSession represents an active session with an ACP agent.
type ACPSessionInfo ¶ added in v0.100.0
type ACPSessionInfo struct {
ID string
Title string
UpdatedAt int64
// PromptTokens are the tokens consumed by the prompt (input + cache writes).
PromptTokens int64
// CompletionTokens are the tokens produced by the model (output + cache reads).
CompletionTokens int64
// ContextWindow is the total context window size for the current model (0 = unknown).
ContextWindow int64
}
ACPSessionInfo is a minimal session descriptor used by the ACP layer. Using a local struct avoids importing the session package and breaking the session→llm/tools→acp import cycle.
type AgentEvent ¶ added in v0.100.0
type AgentEvent struct {
Type AgentEventType
Message message.Message
Error error
Delta string
ToolCall *message.ToolCall
ToolResult *message.ToolResult
// Progress is populated for AgentEventTypeSummarize events.
Progress string
// SystemMessage is populated for AgentEventTypeSystemMessage events.
// It carries a human-readable status string (compaction, retry, etc.).
SystemMessage string
}
AgentEvent represents an event from the agent service
type AgentEventType ¶ added in v0.100.0
type AgentEventType string
AgentEventType represents the type of agent event
const ( AgentEventTypeError AgentEventType = "error" AgentEventTypeResponse AgentEventType = "response" AgentEventTypeSummarize AgentEventType = "summarize" AgentEventTypeContentDelta AgentEventType = "content_delta" AgentEventTypeThinkingDelta AgentEventType = "thinking_delta" AgentEventTypeToolCall AgentEventType = "tool_call" AgentEventTypeToolResult AgentEventType = "tool_result" // AgentEventTypeSystemMessage carries internal status messages (context compaction, // retries, etc.) that must be shown to the user but are not part of the LLM response. AgentEventTypeSystemMessage AgentEventType = "system_message" )
type AgentService ¶ added in v0.100.0
type AgentService interface {
Run(ctx context.Context, sessionID string, content string, attachments ...message.Attachment) (<-chan AgentEvent, error)
RunGoal(ctx context.Context, sessionID string, objective string) (<-chan AgentEvent, error)
Cancel(sessionID string)
// LastRunSystemMessages returns internal status/progress messages emitted while
// preparing or running the most recent prompt for the session (persona selection,
// self-improvement prompt tuning, retries, compaction, etc.).
LastRunSystemMessages(sessionID string) []string
// CurrentModelID returns the ID of the currently active model.
CurrentModelID() string
// AvailableModels returns the list of available models with name metadata.
AvailableModels() []ACPModelInfo
// SetModelOverride temporarily changes the active model (in-memory only).
// Pass empty string to clear any previous override.
SetModelOverride(modelID string) error
// SetSessionLLMOverrides applies request-scoped inference overrides for the session.
SetSessionLLMOverrides(sessionID string, overrides SessionLLMOverrides)
// ListPersonas returns the names of all available personas.
ListPersonas() []string
// GetActivePersona returns the currently active persona name (empty = none).
GetActivePersona() string
// SetActivePersona sets the active persona by name. Pass empty string to clear.
SetActivePersona(name string) error
// Summarize performs a manual conversation summary/compaction for the session.
Summarize(ctx context.Context, sessionID string) error
// OpenCopilotUsage opens the Copilot usage/features page when Copilot auth is available.
OpenCopilotUsage() error
// OpenClaudeUsage opens the Claude usage page when Claude OAuth auth is available.
OpenClaudeUsage() error
}
AgentService defines the interface for interacting with Pando's LLM agent. This is intentionally minimal to avoid import cycles.
type DecodeTodosResult ¶ added in v0.402.0
type DecodeTodosResult struct {
// Success indicates if the decoding was successful
Success bool `json:"success"`
// Todos contains the decoded todos if successful
Todos []TodoInfo `json:"todos,omitempty"`
// Error contains any error message if decoding failed
Error string `json:"error,omitempty"`
}
DecodeTodosResult represents the result of decoding todo output.
type GoalStateUpdate ¶ added in v0.324.0
type GoalStateUpdate struct {
Objective string `json:"objective"`
Status string `json:"status"`
Iteration int `json:"iteration"`
MaxIterations int `json:"max_iterations"`
Progress string `json:"progress,omitempty"`
NextStep string `json:"next_step,omitempty"`
ElapsedTime string `json:"elapsed_time,omitempty"`
}
GoalStateUpdate is the ACP-friendly projection of a persisted goal state.
type HTTPTransport ¶ added in v0.7.0
type HTTPTransport struct {
// contains filtered or unexported fields
}
HTTPTransport implements HTTP/SSE transport for ACP. It manages multiple client sessions and routes requests to the ACP agent.
func NewHTTPTransport ¶ added in v0.7.0
func NewHTTPTransport(agent ACPAgent, logger *log.Logger, config HTTPTransportConfig) *HTTPTransport
NewHTTPTransport creates a new HTTP transport for the ACP agent.
func (*HTTPTransport) ActiveSessions ¶ added in v0.7.0
func (t *HTTPTransport) ActiveSessions() int
ActiveSessions returns the number of active sessions.
func (*HTTPTransport) Cleanup ¶ added in v0.7.0
func (t *HTTPTransport) Cleanup(ctx context.Context)
Cleanup removes idle sessions.
func (*HTTPTransport) CloseSession ¶ added in v0.7.0
func (t *HTTPTransport) CloseSession(sessionID string) error
CloseSession closes a session and cleans up resources.
func (*HTTPTransport) GetSessionInfo ¶ added in v0.7.0
func (t *HTTPTransport) GetSessionInfo(sessionID string) (*SessionInfo, error)
GetSessionInfo returns information about a specific session.
func (*HTTPTransport) GetStats ¶ added in v0.7.0
func (t *HTTPTransport) GetStats() TransportStats
GetStats returns current transport statistics.
func (*HTTPTransport) HandleHealth ¶ added in v0.7.0
func (t *HTTPTransport) HandleHealth(w http.ResponseWriter, r *http.Request)
HandleHealth handles health check requests.
func (*HTTPTransport) HandleRequest ¶ added in v0.7.0
func (t *HTTPTransport) HandleRequest(w http.ResponseWriter, r *http.Request)
HandleRequest handles HTTP POST requests for ACP JSON-RPC.
func (*HTTPTransport) HandleSSE ¶ added in v0.7.0
func (t *HTTPTransport) HandleSSE(w http.ResponseWriter, r *http.Request)
HandleSSE handles Server-Sent Events for notifications.
func (*HTTPTransport) ListSessions ¶ added in v0.7.0
func (t *HTTPTransport) ListSessions() []SessionInfo
ListSessions returns information about all active sessions.
type HTTPTransportConfig ¶ added in v0.7.0
HTTPTransportConfig holds configuration for the HTTP transport.
func DefaultHTTPTransportConfig ¶ added in v0.7.0
func DefaultHTTPTransportConfig() HTTPTransportConfig
DefaultHTTPTransportConfig returns default configuration.
type McpServerConfig ¶
type McpServerConfig struct {
// Name is the unique identifier for this MCP server
Name string `json:"name" yaml:"name"`
// Command is the binary to execute for stdio-based MCP servers
Command string `json:"command" yaml:"command"`
// Args are the command-line arguments for the MCP server
Args []string `json:"args" yaml:"args"`
// Env is a map of environment variables for the MCP server
Env map[string]string `json:"env" yaml:"env"`
// Type is the transport type: "stdio", "http", or "sse"
Type string `json:"type,omitempty" yaml:"type,omitempty"`
// URL is the endpoint URL for http or sse transports
URL string `json:"url,omitempty" yaml:"url,omitempty"`
// Headers are additional HTTP headers for http/sse transports
Headers map[string]string `json:"headers,omitempty" yaml:"headers,omitempty"`
}
McpServerConfig represents the configuration of an MCP server to pass to an ACP agent.
type MesnadaACPClient ¶
type MesnadaACPClient struct {
// contains filtered or unexported fields
}
MesnadaACPClient implements the ACP client interface required by the SDK. It handles callbacks from ACP agents, managing file operations, terminal sessions, and session state updates for mesnada tasks.
func NewMesnadaACPClient ¶
func NewMesnadaACPClient(taskID string, workDir string, logFile *os.File, onUpdate func(SessionUpdateInfo)) *MesnadaACPClient
NewMesnadaACPClient creates a new MesnadaACPClient.
func (*MesnadaACPClient) CreateTerminal ¶
func (c *MesnadaACPClient) CreateTerminal(ctx context.Context, params acpsdk.CreateTerminalRequest) (acpsdk.CreateTerminalResponse, error)
CreateTerminal creates a new terminal session for executing commands.
func (*MesnadaACPClient) ExtractDiffsFromContent ¶ added in v0.210.0
func (c *MesnadaACPClient) ExtractDiffsFromContent(content []acpsdk.ToolCallContent) map[string]string
ExtractDiffsFromContent extracts file modification diffs from a slice of ToolCallContent.
func (*MesnadaACPClient) GetOutput ¶
func (c *MesnadaACPClient) GetOutput() string
GetOutput returns the accumulated output from the agent session.
func (*MesnadaACPClient) GetPermissionQueue ¶
func (c *MesnadaACPClient) GetPermissionQueue() *PermissionQueue
GetPermissionQueue returns the permission queue for manual approval.
func (*MesnadaACPClient) GetProgress ¶
func (c *MesnadaACPClient) GetProgress() (int, string)
GetProgress returns the current progress percentage and description.
func (*MesnadaACPClient) GetToolCallCount ¶
func (c *MesnadaACPClient) GetToolCallCount() int
GetToolCallCount returns the number of tool calls made during the session.
func (*MesnadaACPClient) HandleExtensionMethod ¶ added in v0.305.1
func (c *MesnadaACPClient) HandleExtensionMethod(ctx context.Context, method string, params json.RawMessage) (any, error)
func (*MesnadaACPClient) KillTerminal ¶ added in v0.244.0
func (c *MesnadaACPClient) KillTerminal(ctx context.Context, params acpsdk.KillTerminalRequest) (acpsdk.KillTerminalResponse, error)
KillTerminal kills a running terminal command.
func (*MesnadaACPClient) ReadTextFile ¶
func (c *MesnadaACPClient) ReadTextFile(ctx context.Context, params acpsdk.ReadTextFileRequest) (acpsdk.ReadTextFileResponse, error)
ReadTextFile reads a file from the task's workspace. This implements strict security: the file must be within the task's workDir.
func (*MesnadaACPClient) ReleaseTerminal ¶
func (c *MesnadaACPClient) ReleaseTerminal(ctx context.Context, params acpsdk.ReleaseTerminalRequest) (acpsdk.ReleaseTerminalResponse, error)
ReleaseTerminal releases a terminal session without waiting for it to complete. The terminal continues running but we stop tracking it.
func (*MesnadaACPClient) RequestPermission ¶
func (c *MesnadaACPClient) RequestPermission(ctx context.Context, params acpsdk.RequestPermissionRequest) (acpsdk.RequestPermissionResponse, error)
RequestPermission handles permission requests from the ACP agent. In auto-permission mode (CI/batch), this auto-approves all requests. In manual mode, this queues the request for approval via API endpoints.
func (*MesnadaACPClient) SessionUpdate ¶
func (c *MesnadaACPClient) SessionUpdate(ctx context.Context, params acpsdk.SessionNotification) error
SessionUpdate handles session updates from the ACP agent. This is called when the agent sends new messages, tool calls, or state changes.
func (*MesnadaACPClient) SetAutoPermission ¶
func (c *MesnadaACPClient) SetAutoPermission(auto bool)
SetAutoPermission sets whether to auto-approve all permission requests.
func (*MesnadaACPClient) SetCapabilities ¶
func (c *MesnadaACPClient) SetCapabilities(caps ACPCapabilities)
SetCapabilities sets the capabilities for this client.
func (*MesnadaACPClient) TerminalOutput ¶
func (c *MesnadaACPClient) TerminalOutput(ctx context.Context, params acpsdk.TerminalOutputRequest) (acpsdk.TerminalOutputResponse, error)
TerminalOutput retrieves the current output from a terminal session.
func (*MesnadaACPClient) WaitForTerminalExit ¶
func (c *MesnadaACPClient) WaitForTerminalExit(ctx context.Context, params acpsdk.WaitForTerminalExitRequest) (acpsdk.WaitForTerminalExitResponse, error)
WaitForTerminalExit waits for a terminal session to complete and returns its exit code.
func (*MesnadaACPClient) WriteTextFile ¶
func (c *MesnadaACPClient) WriteTextFile(ctx context.Context, params acpsdk.WriteTextFileRequest) (acpsdk.WriteTextFileResponse, error)
WriteTextFile writes a file to the task's workspace. This implements strict security: the file must be within the task's workDir.
type PandoACPAgent ¶ added in v0.100.0
type PandoACPAgent struct {
// contains filtered or unexported fields
}
PandoACPAgent implements the ACP Agent interface. It allows external ACP clients to connect to Pando and use its capabilities.
func NewPandoACPAgent ¶ added in v0.100.0
func NewPandoACPAgent( version string, workDir string, logger *log.Logger, agentService AgentService, sessionService SessionService, permSvc PermissionService, ) *PandoACPAgent
NewPandoACPAgent creates a new ACP agent instance.
func (*PandoACPAgent) Authenticate ¶ added in v0.100.0
func (a *PandoACPAgent) Authenticate(ctx context.Context, req acpsdk.AuthenticateRequest) (acpsdk.AuthenticateResponse, error)
Authenticate handles authentication requests (not implemented yet).
func (*PandoACPAgent) Cancel ¶ added in v0.100.0
func (a *PandoACPAgent) Cancel(ctx context.Context, params acpsdk.CancelNotification) error
Cancel handles cancellation notifications.
func (*PandoACPAgent) CloseSession ¶ added in v0.305.1
func (a *PandoACPAgent) CloseSession(ctx context.Context, req acpsdk.CloseSessionRequest) (acpsdk.CloseSessionResponse, error)
CloseSession implements Agent. It cancels ongoing work, removes the session mapping, and cleans up permission handlers and auto-approve state associated with this session.
func (*PandoACPAgent) GetCapabilities ¶ added in v0.100.0
func (a *PandoACPAgent) GetCapabilities() acpsdk.AgentCapabilities
GetCapabilities returns the agent capabilities.
func (*PandoACPAgent) GetVersion ¶ added in v0.100.0
func (a *PandoACPAgent) GetVersion() string
GetVersion returns the agent version.
func (*PandoACPAgent) HandleExtensionMethod ¶ added in v0.305.1
func (a *PandoACPAgent) HandleExtensionMethod(ctx context.Context, method string, params json.RawMessage) (any, error)
func (*PandoACPAgent) Initialize ¶ added in v0.100.0
func (a *PandoACPAgent) Initialize(ctx context.Context, req acpsdk.InitializeRequest) (acpsdk.InitializeResponse, error)
Initialize handles the initialization handshake from an ACP client. This is the first method called when a client connects.
func (*PandoACPAgent) ListSessions ¶ added in v0.140.0
func (a *PandoACPAgent) ListSessions(ctx context.Context, _ acpsdk.ListSessionsRequest) (acpsdk.ListSessionsResponse, error)
ListSessions returns the historical sessions known by Pando. Implements the acpsdk.Agent interface (session/list method).
func (*PandoACPAgent) LoadSession ¶ added in v0.100.0
func (a *PandoACPAgent) LoadSession(ctx context.Context, req acpsdk.LoadSessionRequest) (acpsdk.LoadSessionResponse, error)
LoadSession implements AgentLoader. It validates the requested session exists in Pando and registers an ACP session mapping so subsequent Prompt calls can find it.
func (*PandoACPAgent) NewSession ¶ added in v0.100.0
func (a *PandoACPAgent) NewSession(ctx context.Context, req acpsdk.NewSessionRequest) (acpsdk.NewSessionResponse, error)
NewSession handles new session creation requests.
func (*PandoACPAgent) Prompt ¶ added in v0.100.0
func (a *PandoACPAgent) Prompt(ctx context.Context, req acpsdk.PromptRequest) (acpsdk.PromptResponse, error)
Prompt handles prompt requests from the client.
func (*PandoACPAgent) ResumeSession ¶ added in v0.305.1
func (a *PandoACPAgent) ResumeSession(ctx context.Context, req acpsdk.ResumeSessionRequest) (acpsdk.ResumeSessionResponse, error)
ResumeSession implements Agent. It registers an existing session for use without replaying history.
func (*PandoACPAgent) SetConnection ¶ added in v0.100.0
func (a *PandoACPAgent) SetConnection(conn *acpsdk.AgentSideConnection)
SetConnection stores a reference to the AgentSideConnection so the agent can stream session updates back to the client. Called by transport_stdio.go immediately after NewAgentSideConnection() returns.
Re-send available commands for known sessions after a transport reconnect so clients that restore thread state can repopulate their slash-command UI. Unknown or released sessions are tolerated by sendAvailableCommandsUpdate, which keeps this best-effort replay from reintroducing hard reconnect errors.
func (*PandoACPAgent) SetSessionConfigOption ¶ added in v0.244.0
func (a *PandoACPAgent) SetSessionConfigOption(ctx context.Context, req acpsdk.SetSessionConfigOptionRequest) (acpsdk.SetSessionConfigOptionResponse, error)
SetSessionConfigOption handles runtime configuration changes from the client.
func (*PandoACPAgent) SetSessionMode ¶ added in v0.100.0
func (a *PandoACPAgent) SetSessionMode(ctx context.Context, req acpsdk.SetSessionModeRequest) (acpsdk.SetSessionModeResponse, error)
SetSessionMode handles session mode changes. The updated mode is applied when the next Prompt call begins.
func (*PandoACPAgent) SetSessionModel ¶ added in v0.100.0
func (a *PandoACPAgent) SetSessionModel(ctx context.Context, req acpsdk.SetSessionModelRequest) (acpsdk.SetSessionModelResponse, error)
SetSessionModel implements Agent. It stores the requested model on the ACP session for use in future prompts.
func (*PandoACPAgent) SetSessionPersona ¶ added in v0.204.0
func (a *PandoACPAgent) SetSessionPersona(ctx context.Context, sessionID acpsdk.SessionId, personaName string) error
SetSessionPersona stores the requested persona on the ACP session for use in future prompts. This is a Pando-specific extension, not part of the standard ACP protocol.
func (*PandoACPAgent) StartNotificationBroadcast ¶ added in v0.263.0
func (a *PandoACPAgent) StartNotificationBroadcast(ctx context.Context)
StartNotificationBroadcast subscribes to the global notify bus and fans out each Notification to all currently active ACP sessions via a SessionSessionInfoUpdate with _meta["pando:notification"] carrying the payload. This allows ACP clients to receive LLM retry info, tool errors, LSP diagnostics, etc. in real time alongside the normal session stream.
Call this in a goroutine after creating the agent; it blocks until ctx is done.
func (*PandoACPAgent) UnstableSetSessionModel ¶ added in v0.244.0
func (a *PandoACPAgent) UnstableSetSessionModel(ctx context.Context, req acpsdk.UnstableSetSessionModelRequest) (acpsdk.UnstableSetSessionModelResponse, error)
UnstableSetSessionModel implements AgentExperimental. It stores the requested model on the ACP session for use in future prompts.
type PendingPermission ¶
type PendingPermission struct {
TaskID string `json:"task_id"`
SessionID acpsdk.SessionId `json:"session_id"`
RequestID string `json:"request_id"`
ToolCall acpsdk.ToolCallUpdate `json:"tool_call"`
Options []acpsdk.PermissionOption `json:"options"`
Outcome *acpsdk.RequestPermissionOutcome `json:"outcome,omitempty"` // nil = pending, non-nil = resolved
CreatedAt time.Time `json:"created_at"`
ResolvedAt *time.Time `json:"resolved_at,omitempty"`
// contains filtered or unexported fields
}
PendingPermission represents a permission request awaiting resolution.
type PermissionQueue ¶
type PermissionQueue struct {
// contains filtered or unexported fields
}
PermissionQueue manages permission requests from ACP agents. It queues requests that need manual approval and allows resolution via API endpoints or automatic policies.
func NewPermissionQueue ¶
func NewPermissionQueue() *PermissionQueue
NewPermissionQueue creates a new permission queue.
func (*PermissionQueue) CleanupResolved ¶
func (q *PermissionQueue) CleanupResolved(maxAge time.Duration) int
CleanupResolved removes resolved permission requests older than the specified duration.
func (*PermissionQueue) GetAllPending ¶
func (q *PermissionQueue) GetAllPending() []*PendingPermission
GetAllPending returns all pending permission requests across all tasks.
func (*PermissionQueue) GetPending ¶
func (q *PermissionQueue) GetPending(taskID string) []*PendingPermission
GetPending returns all pending permission requests for a task.
func (*PermissionQueue) GetPermission ¶
func (q *PermissionQueue) GetPermission(requestID string) (*PendingPermission, bool)
GetPermission returns a specific permission request by ID.
func (*PermissionQueue) QueuePermission ¶
func (q *PermissionQueue) QueuePermission(taskID string, sessionID acpsdk.SessionId, req acpsdk.RequestPermissionRequest) string
QueuePermission adds a permission request to the queue for manual approval. Returns the request ID that can be used to resolve it later.
func (*PermissionQueue) ResolvePermission ¶
func (q *PermissionQueue) ResolvePermission(requestID string, outcome acpsdk.RequestPermissionOutcome) error
ResolvePermission resolves a pending permission request. outcome contains the selected option or denial.
func (*PermissionQueue) WaitForResolution ¶
func (q *PermissionQueue) WaitForResolution(ctx context.Context, requestID string) (acpsdk.RequestPermissionOutcome, error)
WaitForResolution waits for a permission request to be resolved. Returns the outcome or an error if the context is cancelled. Uses a per-request channel (closed on resolution) instead of polling, so it wakes up instantly with zero CPU overhead while waiting.
type PermissionRequestData ¶ added in v0.200.0
type PermissionRequestData struct {
SessionID string
ToolName string
Description string
Action string
Path string
Params any
}
PermissionRequestData carries the full details of a tool permission request. This mirrors permission.CreatePermissionRequest but is defined here to avoid importing the permission package and breaking the tool→acp import graph.
type PermissionService ¶ added in v0.120.0
type PermissionService interface {
AutoApproveSession(sessionID string)
RemoveAutoApproveSession(sessionID string)
RegisterSessionHandler(sessionID string, handler func(req PermissionRequestData) bool)
UnregisterSessionHandler(sessionID string)
}
PermissionService is a minimal interface for configuring tool permissions per session. This avoids import cycles with the permission package.
type PersonaInfo ¶ added in v0.204.0
type PersonaInfo struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
}
PersonaInfo describes a single available persona for ACP responses.
type PlanEntry ¶ added in v0.402.0
type PlanEntry struct {
// Priority is the priority level of the task: "high", "medium", "low"
Priority string `json:"priority"`
// Status is the current status of the task: "pending", "in_progress", "completed"
Status string `json:"status"`
// Content is the description or title of the task
Content string `json:"content"`
}
PlanEntry represents a single entry in a plan sent via ACP session update. This matches the OpenCode standard for plan communication.
type PlanService ¶ added in v0.402.0
type PlanService interface {
// DecodeTodos parses the output of a todowrite tool into TodoInfo structures
DecodeTodos(output string) DecodeTodosResult
// CreatePlanEntry converts TodoInfo to PlanEntry with proper state mapping
CreatePlanEntry(todo TodoInfo) PlanEntry
// CreateSessionPlan converts a list of TodoInfo to a SessionPlan
CreateSessionPlan(todos []TodoInfo) *SessionPlan
// ValidateSessionPlan validates a complete session plan
ValidateSessionPlan(plan *SessionPlan) error
// SendPlanUpdate sends a plan update to the ACP client
SendPlanUpdate(ctx context.Context, conn *acpsdk.AgentSideConnection, sessionID acpsdk.SessionId, plan *SessionPlan) error
}
PlanService defines the interface for plan-related operations.
type SessionInfo ¶ added in v0.7.0
type SessionInfo struct {
ID string `json:"id"`
CreatedAt time.Time `json:"created_at"`
LastUsed time.Time `json:"last_used"`
IdleTime time.Duration `json:"idle_time"`
}
SessionInfo contains information about a specific session.
type SessionLLMOverrides ¶ added in v0.407.0
type SessionPersonaState ¶ added in v0.204.0
type SessionPersonaState struct {
AvailablePersonas []PersonaInfo `json:"availablePersonas"`
CurrentPersonaId string `json:"currentPersonaId"`
}
SessionPersonaState represents the persona selection state for a session, analogous to SessionModelState. It is carried via the _meta extension field in ACP responses since the ACP spec does not yet define a native persona type.
type SessionPlan ¶ added in v0.402.0
type SessionPlan struct {
// Entries is the list of plan entries
Entries []PlanEntry `json:"entries"`
}
SessionPlan represents a complete plan sent to ACP clients.
type SessionService ¶ added in v0.100.0
type SessionService interface {
CreateSession(ctx context.Context, title string) (string, error)
GetSession(ctx context.Context, id string) (ACPSessionInfo, error)
ListSessions(ctx context.Context) ([]ACPSessionInfo, error)
GetACPSessionState(ctx context.Context, sessionID string) (string, error)
SaveACPSessionState(ctx context.Context, sessionID string, state string) error
GetActiveGoal(ctx context.Context, sessionID string) (db.SessionGoal, error)
GetGoalBySession(ctx context.Context, sessionID string) (db.SessionGoal, error)
CancelGoal(ctx context.Context, sessionID string) (db.SessionGoal, error)
// GetMessages returns the messages for a session in chronological order.
// Used by LoadSession to replay conversation history to connecting clients.
GetMessages(ctx context.Context, sessionID string) ([]message.Message, error)
}
SessionService defines the minimal interface needed by the ACP agent. Using a narrow interface avoids the session→llm/tools→acp import cycle.
type SessionUpdate ¶ added in v0.402.0
type SessionUpdate struct {
// Type is the type of update
Type SessionUpdateType `json:"type"`
// SessionID is the ACP session ID
SessionID string `json:"sessionId"`
// MessageText is the text content (for message updates)
MessageText string `json:"messageText,omitempty"`
// ThinkingText is the model's reasoning content (for thought updates)
ThinkingText string `json:"thinkingText,omitempty"`
// ToolCall contains tool information (for tool updates)
ToolCall *ToolCallInfo `json:"toolCall,omitempty"`
// Plan contains planning information (for plan updates)
Plan *SessionPlan `json:"plan,omitempty"`
// Usage contains usage information (for usage updates)
Usage *UsageInfo `json:"usage,omitempty"`
// StopReason indicates why the agent stopped (if applicable)
StopReason string `json:"stopReason,omitempty"`
// Error contains any error message
Error string `json:"error,omitempty"`
}
SessionUpdate represents a structured session update message. This extends the current SessionUpdateInfo to support the OpenCode standard.
type SessionUpdateInfo ¶
type SessionUpdateInfo struct {
// TaskID is the mesnada task identifier
TaskID string
// MessageText is the text content from the agent (for text blocks)
MessageText string
// ThinkingText is the model's reasoning/thinking content (agent_thought_chunk).
// This is distinct from MessageText and represents extended thinking output.
ThinkingText string
// ToolCall contains information about tool calls made by the agent
ToolCall *ToolCallInfo
// Plan contains planning information from the agent
Plan string
// StopReason indicates why the agent stopped (if applicable)
StopReason string
// Error contains any error message
Error string
}
SessionUpdateInfo represents information about a session update from the ACP agent. This is used to communicate agent state changes to the mesnada orchestrator.
type SessionUpdateType ¶ added in v0.402.0
type SessionUpdateType string
SessionUpdateType represents the different types of session updates.
const ( // SessionUpdateUsage is for usage/cost updates SessionUpdateUsage SessionUpdateType = "usage_update" // SessionUpdateToolCall is for tool call status updates SessionUpdateToolCall SessionUpdateType = "tool_call_update" // SessionUpdatePlan is for plan information (new feature) SessionUpdatePlan SessionUpdateType = "plan" // SessionUpdateAgentMessage is for streaming agent messages SessionUpdateAgentMessage SessionUpdateType = "agent_message_chunk" // SessionUpdateUserMessage is for streaming user messages SessionUpdateUserMessage SessionUpdateType = "user_message_chunk" // SessionUpdateAgentThought is for streaming agent thoughts/reasoning SessionUpdateAgentThought SessionUpdateType = "agent_thought_chunk" )
type SimpleACPAgent ¶ added in v0.7.0
type SimpleACPAgent struct {
// contains filtered or unexported fields
}
SimpleACPAgent is a minimal ACP agent for testing HTTP transport. This is used when the full PandoACPAgent is not available due to import cycles.
func NewSimpleACPAgent ¶ added in v0.7.0
func NewSimpleACPAgent(version string, logger *log.Logger) *SimpleACPAgent
NewSimpleACPAgent creates a simple ACP agent for testing.
func (*SimpleACPAgent) Authenticate ¶ added in v0.7.0
func (a *SimpleACPAgent) Authenticate(ctx context.Context, req acpsdk.AuthenticateRequest) (acpsdk.AuthenticateResponse, error)
Authenticate is not implemented.
func (*SimpleACPAgent) Cancel ¶ added in v0.7.0
func (a *SimpleACPAgent) Cancel(ctx context.Context, params acpsdk.CancelNotification) error
Cancel handles cancellation.
func (*SimpleACPAgent) CloseSession ¶ added in v0.305.1
func (a *SimpleACPAgent) CloseSession(ctx context.Context, req acpsdk.CloseSessionRequest) (acpsdk.CloseSessionResponse, error)
CloseSession implements Agent (stub).
func (*SimpleACPAgent) GetCapabilities ¶ added in v0.7.0
func (a *SimpleACPAgent) GetCapabilities() acpsdk.AgentCapabilities
GetCapabilities returns the agent capabilities.
func (*SimpleACPAgent) GetVersion ¶ added in v0.7.0
func (a *SimpleACPAgent) GetVersion() string
GetVersion returns the agent version.
func (*SimpleACPAgent) Initialize ¶ added in v0.7.0
func (a *SimpleACPAgent) Initialize(ctx context.Context, req acpsdk.InitializeRequest) (acpsdk.InitializeResponse, error)
Initialize handles the initialization handshake.
func (*SimpleACPAgent) ListSessions ¶ added in v0.244.0
func (a *SimpleACPAgent) ListSessions(_ context.Context, _ acpsdk.ListSessionsRequest) (acpsdk.ListSessionsResponse, error)
ListSessions implements Agent — returns an empty list.
func (*SimpleACPAgent) LoadSession ¶ added in v0.100.0
func (a *SimpleACPAgent) LoadSession(ctx context.Context, req acpsdk.LoadSessionRequest) (acpsdk.LoadSessionResponse, error)
LoadSession implements AgentLoader (stub).
func (*SimpleACPAgent) NewSession ¶ added in v0.7.0
func (a *SimpleACPAgent) NewSession(ctx context.Context, req acpsdk.NewSessionRequest) (acpsdk.NewSessionResponse, error)
NewSession is not implemented.
func (*SimpleACPAgent) Prompt ¶ added in v0.7.0
func (a *SimpleACPAgent) Prompt(ctx context.Context, req acpsdk.PromptRequest) (acpsdk.PromptResponse, error)
Prompt is not implemented.
func (*SimpleACPAgent) ResumeSession ¶ added in v0.305.1
func (a *SimpleACPAgent) ResumeSession(ctx context.Context, req acpsdk.ResumeSessionRequest) (acpsdk.ResumeSessionResponse, error)
ResumeSession implements Agent (stub).
func (*SimpleACPAgent) SetSessionConfigOption ¶ added in v0.244.0
func (a *SimpleACPAgent) SetSessionConfigOption(_ context.Context, _ acpsdk.SetSessionConfigOptionRequest) (acpsdk.SetSessionConfigOptionResponse, error)
SetSessionConfigOption implements Agent (stub).
func (*SimpleACPAgent) SetSessionMode ¶ added in v0.7.0
func (a *SimpleACPAgent) SetSessionMode(ctx context.Context, req acpsdk.SetSessionModeRequest) (acpsdk.SetSessionModeResponse, error)
SetSessionMode is not implemented.
func (*SimpleACPAgent) SetSessionModel ¶ added in v0.100.0
func (a *SimpleACPAgent) SetSessionModel(ctx context.Context, req acpsdk.SetSessionModelRequest) (acpsdk.SetSessionModelResponse, error)
SetSessionModel implements Agent (stub).
func (*SimpleACPAgent) UnstableSetSessionModel ¶ added in v0.244.0
func (a *SimpleACPAgent) UnstableSetSessionModel(ctx context.Context, req acpsdk.UnstableSetSessionModelRequest) (acpsdk.UnstableSetSessionModelResponse, error)
UnstableSetSessionModel implements AgentExperimental (stub).
type StdioTransport ¶ added in v0.100.0
type StdioTransport struct {
// contains filtered or unexported fields
}
StdioTransport wraps the SDK's AgentSideConnection for stdio transport.
func NewStdioTransport ¶ added in v0.100.0
func NewStdioTransport(agent *PandoACPAgent, logger *log.Logger) *StdioTransport
NewStdioTransport creates a new stdio transport for the ACP agent. A thin interceptor layer sits between raw stdin and the SDK connection to handle protocol methods that the Go SDK v0.6.3 does not yet implement (e.g. "session/list", which the TypeScript SDK v0.14+ clients send).
type TodoInfo ¶ added in v0.402.0
type TodoInfo struct {
// Content is the description of the todo/task
Content string `json:"content"`
// Status is the current status: "pending", "in_progress", "completed", "cancelled"
Status string `json:"status"`
// Priority is the priority level: "high", "medium", "low"
Priority string `json:"priority"`
}
TodoInfo represents a single todo/task in a plan. This matches the structure used by the todowrite tool in OpenCode.
type ToolCallInfo ¶
type ToolCallInfo struct {
// ID is the unique identifier for this tool call
ID string
// Name is the name of the tool being called
Name string
// Kind is the ACP tool kind used by clients for rendering
Kind string
// Arguments are the arguments passed to the tool
Arguments map[string]interface{}
// Locations references files or paths associated with the tool call
Locations []string
// Status is the status of the tool call: "started", "progress", "completed", "failed"
Status string
// Result is the result of the tool call (if completed)
Result string
// Title is the rendered title shown by ACP clients
Title string
// Content contains rich content blocks for the tool call (e.g. diffs, text)
Content []acpsdk.ToolCallContent
// Diffs contains extracted file modification diffs for quick access
Diffs map[string]string
// RawInput is the original input to the tool
RawInput interface{}
// RawOutput is the original output from the tool
RawOutput interface{}
// Meta carries ACP-specific metadata associated with the tool update.
Meta map[string]interface{}
}
ToolCallInfo represents information about a tool call from the ACP agent.
type ToolHandlerFunc ¶ added in v0.402.0
ToolHandlerFunc is a function type for handling tool completion events.
type TransportStats ¶ added in v0.7.0
type TransportStats struct {
ActiveSessions int `json:"active_sessions"`
TotalSessions int `json:"total_sessions"`
RequestsProcessed int `json:"requests_processed"`
MaxSessions int `json:"max_sessions"`
Uptime time.Duration `json:"uptime"`
IdleTimeout time.Duration `json:"idle_timeout"`
}
TransportStats holds statistics about the HTTP transport.
type UsageInfo ¶ added in v0.402.0
type UsageInfo struct {
// InputTokens is the number of input tokens used
InputTokens int64 `json:"inputTokens"`
// OutputTokens is the number of output tokens used
OutputTokens int64 `json:"outputTokens"`
// TotalTokens is the total tokens used
TotalTokens int64 `json:"totalTokens"`
// Cost is the estimated cost in USD
Cost float64 `json:"cost"`
}
UsageInfo represents token usage and cost information.
Source Files
¶
- agent.go
- agent_interface.go
- agent_simple.go
- client.go
- client_connection.go
- goal_commands.go
- goal_updates.go
- permission_bridge.go
- permissions.go
- plan_service.go
- prompt_handler.go
- session.go
- session_persistence.go
- session_state.go
- slash_commands.go
- thinking_options.go
- tool_render.go
- transport_http.go
- transport_stdio.go
- types.go
- types_interfaces.go