acpserver

package
v0.127.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 25 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
var ApprovalModes = []string{approvalAsk, approvalAutoEdit, approvalAuto}

ApprovalModes lists the valid approval modes, in the order clients show them.

View Source
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 NewAgent

func NewAgent() *Agent

NewAgent creates a new ACP agent backed by Kit.

func (*Agent) Authenticate

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

func (a *Agent) Cancel(_ context.Context, params acp.CancelNotification) error

Cancel cancels the ongoing prompt for a session.

func (*Agent) Close

func (a *Agent) Close()

Close shuts down all active sessions.

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

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

func (a *Agent) SetDefaultApproval(mode string) error

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

SetSessionConfigOption changes a session config option ("approval", "model" or "thinking_level") and responds with the full, updated option list.

func (*Agent) SetSessionMode

SetSessionMode rejects every request: Kit advertises no session modes (it uses session config options instead), so no mode ID is valid.

Jump to

Keyboard shortcuts

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