acp

package
v1.5.18 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClaudeArgs

func ClaudeArgs() []string

ClaudeArgs returns the Claude Code flags used for every ACP session.

func DefaultSessionStorePath

func DefaultSessionStorePath() (string, error)

DefaultSessionStorePath returns the per-user directory used for ACP session mappings that must survive an agent process restart.

func RunPermissionMCP

func RunPermissionMCP(in io.Reader, out io.Writer) error

RunPermissionMCP speaks MCP stdio for Claude Code's --permission-prompt-tool. It is reached from cmd.Execute before any config load.

func Serve

func Serve(ctx context.Context, in io.Reader, out io.Writer, cfg Config) error

Serve reads ACP JSON-RPC from in and writes responses and notifications to out.

Types

type Config

type Config struct {
	ClaudePath   string
	SettingsPath string
	Env          []string
	AgentName    string
	AgentTitle   string
	AgentVersion string
	Stderr       io.Writer
	// NewCommand, if set, replaces the default Claude Code exec. Tests use this
	// to inject a fake process. extra holds ClaudeArgs plus mcp/permission/resume.
	NewCommand func(cwd string, extra []string) *exec.Cmd
	// AcquireLaunch enables provider refresh at prompt boundaries. Each returned
	// lease is owned by one ACP session until it is replaced or the session closes.
	// Static NewCommand behavior is retained when this callback is nil.
	AcquireLaunch func(context.Context) (LaunchLease, error)
	// SessionStorePath is a directory for ACP-to-Claude session mappings. An
	// empty path disables cross-process session/load persistence.
	SessionStorePath string
}

Config is the ACP server's Claude Code launch spec.

type LaunchLease

type LaunchLease interface {
	Generation() uint64
	Command(cwd string, extra []string) *exec.Cmd
	Release()
}

LaunchLease owns one reference to a prepared Claude Code launch generation. Generation is stable for equivalent provider configuration. Release must be idempotent because session shutdown and prompt cancellation can overlap.

Jump to

Keyboard shortcuts

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