Documentation
¶
Overview ¶
Package acpserver implements a Kit-backed ACP (Agent Client Protocol) agent.
It bridges Kit's LLM execution, tool system, and session management to the ACP protocol over stdio, allowing ACP clients (such as OpenCode) to drive Kit as a remote coding agent.
Index ¶
- Variables
- type Agent
- func (a *Agent) Authenticate(_ context.Context, _ acp.AuthenticateRequest) (acp.AuthenticateResponse, error)
- func (a *Agent) Cancel(_ context.Context, params acp.CancelNotification) error
- func (a *Agent) Close()
- func (a *Agent) CloseSession(_ context.Context, params acp.CloseSessionRequest) (acp.CloseSessionResponse, error)
- func (a *Agent) Initialize(_ context.Context, params acp.InitializeRequest) (acp.InitializeResponse, error)
- func (a *Agent) ListSessions(_ context.Context, params acp.ListSessionsRequest) (acp.ListSessionsResponse, error)
- func (a *Agent) LoadSession(ctx context.Context, params acp.LoadSessionRequest) (acp.LoadSessionResponse, error)
- func (a *Agent) Logout(_ context.Context, _ acp.LogoutRequest) (acp.LogoutResponse, error)
- func (a *Agent) NewSession(ctx context.Context, params acp.NewSessionRequest) (acp.NewSessionResponse, error)
- func (a *Agent) Prompt(ctx context.Context, params acp.PromptRequest) (acp.PromptResponse, error)
- func (a *Agent) ResumeSession(ctx context.Context, params acp.ResumeSessionRequest) (acp.ResumeSessionResponse, error)
- func (a *Agent) SetAgentConnection(conn *acp.AgentSideConnection)
- func (a *Agent) SetDefaultApproval(mode string) error
- func (a *Agent) SetSessionConfigOption(ctx context.Context, params acp.SetSessionConfigOptionRequest) (acp.SetSessionConfigOptionResponse, error)
- func (a *Agent) SetSessionMode(_ context.Context, params acp.SetSessionModeRequest) (acp.SetSessionModeResponse, error)
Constants ¶
This section is empty.
Variables ¶
var ApprovalModes = []string{approvalAsk, approvalAutoEdit, approvalAuto}
ApprovalModes lists the valid approval modes, in the order clients show them.
var Version = "dev"
Version is injected at build time; fallback to "dev".
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent implements the ACP agent interface on top of Kit's LLM execution, tool calls, and session management.
func (*Agent) Authenticate ¶
func (a *Agent) Authenticate(_ context.Context, _ acp.AuthenticateRequest) (acp.AuthenticateResponse, error)
Authenticate handles authentication requests. Kit advertises no auth methods (provider credentials come from Kit's own config), so this is a no-op.
func (*Agent) CloseSession ¶ added in v0.64.0
func (a *Agent) CloseSession(_ context.Context, params acp.CloseSessionRequest) (acp.CloseSessionResponse, error)
CloseSession cancels any ongoing work for the session and frees its resources.
func (*Agent) Initialize ¶
func (a *Agent) Initialize(_ context.Context, params acp.InitializeRequest) (acp.InitializeResponse, error)
Initialize negotiates the protocol version and capabilities. Kit supports only protocol version 1, so it answers with version 1 for every request: the spec requires the agent to reply with the requested version when it supports it, and with its latest version otherwise.
func (*Agent) ListSessions ¶ added in v0.58.2
func (a *Agent) ListSessions(_ context.Context, params acp.ListSessionsRequest) (acp.ListSessionsResponse, error)
ListSessions lists the persisted Kit sessions, newest first. When the client sends a cwd, only sessions of that directory are listed. Subagent sessions are internal and are not listed.
func (*Agent) LoadSession ¶ added in v0.116.0
func (a *Agent) LoadSession(ctx context.Context, params acp.LoadSessionRequest) (acp.LoadSessionResponse, error)
LoadSession opens a persisted session, replays its conversation to the client as session/update notifications, and then responds.
func (*Agent) Logout ¶ added in v0.72.0
func (a *Agent) Logout(_ context.Context, _ acp.LogoutRequest) (acp.LogoutResponse, error)
Logout handles logout requests. Kit does not advertise the logout capability, so this is a no-op.
func (*Agent) NewSession ¶
func (a *Agent) NewSession(ctx context.Context, params acp.NewSessionRequest) (acp.NewSessionResponse, error)
NewSession creates a new Kit session for the given working directory.
func (*Agent) Prompt ¶
func (a *Agent) Prompt(ctx context.Context, params acp.PromptRequest) (acp.PromptResponse, error)
Prompt handles the main agent execution. It subscribes to Kit's event bus, converts events to ACP session updates, and runs the prompt through Kit's full turn lifecycle (hooks, LLM, tool calls, persistence).
func (*Agent) ResumeSession ¶ added in v0.64.0
func (a *Agent) ResumeSession(ctx context.Context, params acp.ResumeSessionRequest) (acp.ResumeSessionResponse, error)
ResumeSession opens a persisted session without replaying its history.
func (*Agent) SetAgentConnection ¶
func (a *Agent) SetAgentConnection(conn *acp.AgentSideConnection)
SetAgentConnection stores the connection so the agent can send session updates (streaming, tool calls, etc.) back to the ACP client. This follows the AgentConnAware duck-typing pattern from the SDK.
func (*Agent) SetDefaultApproval ¶ added in v0.116.0
SetDefaultApproval sets the tool approval mode of new sessions: "ask", "auto_edit" or "auto". Clients can change it per session through the "approval" config option.
func (*Agent) SetSessionConfigOption ¶ added in v0.58.2
func (a *Agent) SetSessionConfigOption(ctx context.Context, params acp.SetSessionConfigOptionRequest) (acp.SetSessionConfigOptionResponse, error)
SetSessionConfigOption changes a session config option ("approval", "model" or "thinking_level") and responds with the full, updated option list.
func (*Agent) SetSessionMode ¶
func (a *Agent) SetSessionMode(_ context.Context, params acp.SetSessionModeRequest) (acp.SetSessionModeResponse, error)
SetSessionMode rejects every request: Kit advertises no session modes (it uses session config options instead), so no mode ID is valid.