acpremote

package
v0.4.39 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg Config, deps Deps) (agentkit.Agent, error)

Types

type Config

type Config struct {
	// ID is the agent id referenced by loop.defaultAgent.
	ID agentkit.AgentID `json:"id"`
	// Command is the subprocess to spawn, e.g. ["agent", "acp"] (Cursor CLI) or
	// ["npx", "-y", "@zed-industries/claude-code-acp@latest"].
	Command []string `json:"command"`
	// Env adds environment variables for the subprocess.
	Env map[string]string `json:"env,omitempty"`
	// Cwd is the working directory for the ACP subprocess (cmd.Dir) and session/new.
	// Empty uses workspace work/ (same default as tool/shell-bash). Any value the
	// workspace resolves is accepted — absolute paths and ~/ pass through
	// unchecked — and a missing directory is created (like tool/shell-bash).
	Cwd string `json:"cwd,omitempty"`
	// ReleaseSubprocessAfterTurn kills the ACP process group after each RunTurn so
	// Cursor child processes (language servers, worker-server) do not accumulate.
	ReleaseSubprocessAfterTurn bool `json:"releaseSubprocessAfterTurn,omitempty"`
	// AutoApprove automatically grants tool permission requests without prompting.
	AutoApprove bool `json:"autoApprove"`
	// AuthMethod is passed to authenticate when non-empty (e.g. "cursor_login").
	AuthMethod string `json:"authMethod,omitempty"`
	// ClientName is sent in initialize; defaults to "agentkit".
	ClientName string `json:"clientName,omitempty"`
	// ClientVersion is sent in initialize; defaults to "0.1.0".
	ClientVersion string `json:"clientVersion,omitempty"`
	// AuthHint overrides the user-facing guidance when ACP requires authentication,
	// during connection, session creation, or a prompt. Secret values are never included.
	AuthHint string `json:"authHint,omitempty"`
	// Pool chooses the connection-lifetime policy. Defaults to ttl: connections
	// stay warm (a cold CLI start costs seconds) but idle ones are reclaimed and
	// the cache is capped. Hosts that mint a new session id per turn - a
	// stateless scheduler - should set strategy none so nothing is cached at all.
	Pool PoolConfig `json:"pool,omitempty"`
}

Config configures a remote ACP agent subprocess (Claude Code, Cursor CLI, etc.).

func (*Config) SetDefaults added in v0.3.48

func (c *Config) SetDefaults()

New registers agent/acp-remote: run turns via an external ACP agent subprocess. SetDefaults implements pluginkit.Defaulter.

func (*Config) Validate added in v0.3.48

func (c *Config) Validate() error

Validate implements pluginkit.Validator.

type Deps

type Deps struct {
	Workspace workspace.Service `json:"workspace"`
	// FS stores session resume binds (tenant-relative acp/) and global ACP defaults.
	FS            filesystem.Service      `json:"fs"`
	SessionStore  agentkit.SessionStore   `json:"sessionStore,omitempty"`
	SessionEvents capsession.Conversation `json:"sessionEvents,omitempty"`
	// SessionMCP supplies harness MCP servers for session/new (not project mcp.json).
	SessionMCP capacp.SessionMCPProvider `json:"sessionMcp,omitempty"`
	// SessionRestore customizes session/resume vs session/load before session/new fallback.
	SessionRestore capacp.SessionRestorer `json:"sessionRestore,omitempty"`
	Telemetry      captelemetry.Toolkit   `json:"telemetry"`
	// Sandbox wraps the ACP subprocess command with the tenant sandbox view
	// (e.g. sandbox/bwrap) at spawn time. Nil defaults to
	// capsandbox.Disabled() (passthrough).
	Sandbox capsandbox.Service `json:"sandbox,omitempty"`
}

Deps holds injected capabilities for the ACP client side.

type PoolConfig added in v0.4.38

type PoolConfig struct {
	// Strategy is ttl (default) or none.
	Strategy string
	// IdleTTL is how long a cached connection may sit unused before it is
	// reclaimed. Only used by ttl. Defaults to 30 minutes.
	IdleTTL time.Duration
	// MaxIdle caps cached connections for the ttl strategy.
	// Defaults to 16.
	MaxIdle int
}

PoolConfig is the connection-lifetime policy, configured per agent instance.

type Runtime

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

Runtime proxies turns to an external ACP agent over stdio.

func (*Runtime) AgentCatalogEntry

func (a *Runtime) AgentCatalogEntry() string

func (*Runtime) Commands added in v0.4.31

func (a *Runtime) Commands() []agentkit.Command

func (*Runtime) ID

func (a *Runtime) ID() agentkit.AgentID

func (*Runtime) PoolStats added in v0.4.38

func (a *Runtime) PoolStats() poolStats

PoolStats reports connection-pool state for diagnostics.

func (*Runtime) RunTurn

func (a *Runtime) RunTurn(ctx context.Context, input agentkit.TurnInput) (turnErr error)

func (*Runtime) ShutdownHooks added in v0.4.31

func (a *Runtime) ShutdownHooks() []func()

Slash-owned subprocesses outlive HTTP requests and are cancelled on shutdown. Cleanup waits in separate goroutines because shutdown contributions must not block.

Jump to

Keyboard shortcuts

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