Help us shape the future of Go! Take the 2026 Go Developer Survey

acp

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package acp is the ACP-subprocess code.Agent implementation. One Agent spawns and owns a single ACP server subprocess; that connection hosts every wingman session for the chosen backend (codex / claude / ...). The session ids the interface deals in are the ACP server's own session ids — no wingman-side translation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

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

func New

func New(ws *code.Workspace, def code.AgentDef) (*Agent, error)

New spawns the configured subprocess and runs the ACP handshake.

func NewInProcess

func NewInProcess(
	ws *code.Workspace,
	name string,
	serverAgent acpsdk.Agent,
	setupServer func(*acpsdk.AgentSideConnection),
	cleanup func() error,
) (*Agent, error)

NewInProcess wires an in-memory ACP-server agent (e.g. *claude.Agent, *codex.Agent) into a code.Agent backend using io.Pipe pairs — no subprocess for the protocol itself. setupServer is invoked with the server-side AgentSideConnection so libraries that need it (claude, codex) can call SetAgentConnection before the initialize handshake. cleanup runs during Close after the connection is torn down; pass nil for libraries with no resources to release (codex.Spawn returns a closer via *codex.Agent.Close — pass that here).

func (*Agent) Cancel

func (a *Agent) Cancel(id string)

func (*Agent) Close

func (a *Agent) Close() error

func (*Agent) DeleteSession

func (a *Agent) DeleteSession(_ context.Context, _ string) error

func (*Agent) Effort

func (a *Agent) Effort() (string, []string)

func (*Agent) ListSessions

func (a *Agent) ListSessions(ctx context.Context) ([]code.SessionInfo, error)

func (*Agent) LoadSession

func (a *Agent) LoadSession(ctx context.Context, id string) error

LoadSession drains replay synchronously: Messages(id) reflects the loaded transcript by the time it returns nil.

func (*Agent) Messages

func (a *Agent) Messages(id string) []agent.Message

func (*Agent) Models

func (a *Agent) Models() ([]code.Model, string)

func (*Agent) Modes added in v0.8.0

func (a *Agent) Modes(string) ([]code.Mode, string)

func (*Agent) Name

func (a *Agent) Name() string

func (*Agent) NewSession

func (a *Agent) NewSession(ctx context.Context) (string, error)

func (*Agent) Send

func (a *Agent) Send(ctx context.Context, id string, input []agent.Content) iter.Seq2[agent.Message, error]

func (*Agent) SessionUpdate

func (a *Agent) SessionUpdate(_ context.Context, n acpsdk.SessionNotification) error

func (*Agent) SetEffort

func (a *Agent) SetEffort(ctx context.Context, value string) error

func (*Agent) SetMode added in v0.8.0

func (a *Agent) SetMode(ctx context.Context, sessionID, modeID string) error

func (*Agent) SetModel

func (a *Agent) SetModel(ctx context.Context, id string) error

func (*Agent) SetUI added in v0.8.0

func (a *Agent) SetUI(ui code.UI)

SetUI installs the UI used to approve permission requests. Set before turns.

func (*Agent) Usage

func (a *Agent) Usage(id string) agent.Usage

func (*Agent) Workspace

func (a *Agent) Workspace() *code.Workspace

Jump to

Keyboard shortcuts

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