Documentation
¶
Overview ¶
Package adapter knows how to launch each supported agent with conch's integration wired in.
Index ¶
- Constants
- Variables
- func ACPInstallFor(command string) string
- func AntigravityKeyEnv(dir string) string
- func CheckACP(ctx context.Context, shell, dir string, m ACPManifest) proto.AgentACPCheck
- func CleanTitle(title string) string
- func CodexTaskSandbox(home string, env func(string) string) string
- func DirArgs(agent string, dirs []string) string
- func ManifestDir(configDir string) string
- func ProbeTimeout() time.Duration
- func Protocol(ad Adapter) string
- func RemoveACPManifest(dir, name string) error
- func SanitizeEnv(env []string) []string
- func SessionIDOK(id string) bool
- func SetProbeTimeout(d time.Duration) func()
- func ShellQuote(s string) string
- func TaskDirArgs(agent string, dirs []string, codexSandbox string) string
- func WriteACPManifest(dir string, m ACPManifest, replace bool, supported func(string) bool) (string, error)
- type ACPAgent
- type ACPManifest
- type Adapter
- type Availability
- type Preparer
- type Registry
Constants ¶
const ( TierSupported = proto.TierSupported TierRunsHere = proto.TierRunsHere )
Two tiers of agent, said plainly rather than implied.
Supported is the contract AGENTS.md sets: an adapter written here, detection rules read off the real agent, sessions that list, resume and delete, a setup inspector, labels and docs. Five agents meet it, and writing fifteen more to that bar stalls on session formats nobody documents.
Runs here is a manifest anybody can drop in: conch starts the agent, detects it in a pane and gives it a first message. What it does not claim, it says — sessions and the setup view answer "not read for this agent" rather than pretending to read a format nobody has written down. A few of them conch has since learnt to read off the real agent's files (sessions.Reads: Pi, Grok, Cursor, Kilo Code), and their sessions are listed like a supported agent's. That honesty is the point of having a tier at all: the wider catalogs *detect* an agent, and conch is not going to say it supports one it cannot resume. The tiers themselves live in the protocol, which is where a client reads them from; these are the names this package uses for them.
const ProtocolACP = proto.ProtocolACP
ProtocolACP is what Protocol says of an agent run over ACP.
Variables ¶
var ClaudeHookEvents = []string{
"SessionStart", "SessionEnd",
"UserPromptSubmit", "PreToolUse", "PostToolUse", "PostToolUseFailure",
"PermissionRequest", "PermissionDenied", "Notification",
"SubagentStart", "SubagentStop", "PreCompact",
"Stop", "StopFailure",
}
ClaudeHookEvents are the Claude Code hook events conch listens to.
var CodexHookEvents = []string{
"SessionStart", "SessionEnd", "UserPromptSubmit",
"PreToolUse", "PostToolUse", "PermissionRequest",
"Stop", "Interrupt",
}
CodexHookEvents are the Codex hook events conch listens to: the ones that say whether it is working, waiting on the person or done. Model requests, compaction and subagents are left out, as they are for Claude: they fire inside a turn that tool events already report.
var ErrManifestExists = errors.New("a manifest of that name is there already")
ErrManifestExists is a manifest of that name already there.
var GeminiHookEvents = []string{
"SessionStart", "SessionEnd", "BeforeAgent", "AfterAgent",
"BeforeTool", "AfterTool", "Notification", "PreCompress",
}
GeminiHookEvents are the Gemini CLI hook events conch listens to.
var KnownACP = []struct{ Command, Install string }{
{"gemini --acp", "npm install -g @google/gemini-cli"},
{"goose acp", ""},
{"claude-agent-acp", "npm install -g @agentclientprotocol/claude-agent-acp"},
{"codex-acp", "npm install -g @agentclientprotocol/codex-acp"},
}
KnownACP are the commands Settings offers as picks, and how to install each one's program where that is one command. Checked against the agents' own --help and npm on 2026-11-26: Gemini CLI 0.71.1 (whose --experimental-acp is deprecated for --acp), Goose 1.41.0, and the ACP adapters for Claude Code and Codex, which moved from @zed-industries to @agentclientprotocol (Claude's binary renamed claude-agent-acp then). Goose installs with a script of its own: Settings' Installed agents has it.
var ManifestProblem = func(err error) {}
ManifestProblem is told about a manifest that could not be read, so the server can log it where somebody will see it. A problem with one agent's file is not a reason to fail the others, or the server.
Functions ¶
func ACPInstallFor ¶ added in v0.2.3
ACPInstallFor is how to install the program command starts, if it is one of KnownACP's; "" otherwise.
func AntigravityKeyEnv ¶ added in v0.2.3
AntigravityKeyEnv is the variable [agents] antigravity_api_key_env in dir's config.toml names, when it is one a launch line can use; "" when it is unset, unreadable or not a variable's name.
func CheckACP ¶ added in v0.2.3
func CheckACP(ctx context.Context, shell, dir string, m ACPManifest) proto.AgentACPCheck
CheckACP starts the command in m once, in dir, and says what it offers — or what stopped it — for Settings to show before anything is written.
func CleanTitle ¶
CleanTitle turns a terminal title into a task label: activity prefixes, status symbols (spinners, ✳) and OpenCode's "OC | " are dropped, and titles that only name the agent become "".
func CodexTaskSandbox ¶ added in v0.2.1
CodexTaskSandbox is the sandbox a task's Codex is started in so it can write in every worktree it is given: workspace-write, or danger-full-access when the person's config.toml ($CODEX_HOME, else ~/.codex) already chose that — a task asks for what it needs and never takes away what was given. A profile's setting applies when that profile is picked (`profile = "NAME"` at the top), over the top-level one, as in Codex; a profile nobody picked changes nothing.
func DirArgs ¶ added in v0.2.0
DirArgs are the words that give an agent more folders than the one it starts in — a task across several repos gives it every repo's worktree — for the agents that take them: Claude Code's and Codex's --add-dir, Gemini CLI's --include-directories. Any other gets nothing and works from where it starts, which holds the worktrees anyway.
Codex takes them only where its sandbox may write — in read-only, its default in a folder it has not been told to trust, it refuses them and exits (#190) — so it is asked for workspace-write with them; TaskDirArgs keeps a mode the person's own config gives instead.
func ManifestDir ¶ added in v0.1.7
ManifestDir is where agents of the "runs here" tier are described. It is detect's directory: one file an agent, holding how to run it and how to recognise it.
func ProbeTimeout ¶ added in v0.2.3
ProbeTimeout is how long an agent is given to answer initialize when conch asks what it offers.
func Protocol ¶ added in v0.2.3
Protocol says how an agent is spoken to: ProtocolACP, or "" for its own terminal interface.
func RemoveACPManifest ¶ added in v0.2.3
RemoveACPManifest removes dir/NAME.toml, if it is an ACP manifest.
func SanitizeEnv ¶
SanitizeEnv drops agent session variables from env.
func SessionIDOK ¶ added in v0.2.0
SessionIDOK says whether id can name a saved session to resume: it is passed to the agent after its resume option, where one beginning with "-" would be read as an option of its own ("resume --yolo"). No agent's session ids begin with one.
func SetProbeTimeout ¶ added in v0.2.3
SetProbeTimeout is for tests: how long a probe waits for initialize.
func TaskDirArgs ¶ added in v0.2.1
TaskDirArgs is DirArgs with the sandbox Codex is started in (CodexTaskSandbox); other agents ignore it.
func WriteACPManifest ¶ added in v0.2.3
func WriteACPManifest(dir string, m ACPManifest, replace bool, supported func(string) bool) (string, error)
WriteACPManifest writes m to dir/NAME.toml and returns the path. An existing file is replaced only with replace, and only when it is an ACP manifest itself: a [run] agent of the same name is somebody's own.
Types ¶
type ACPAgent ¶ added in v0.2.3
type ACPAgent interface {
Adapter
Probe(ctx context.Context, shell, dir string, list bool) (acp.InitializeResult, []acp.SessionInfo, error)
Spec() ACPManifest
Own() bool
}
ACPAgent is an agent run over the Agent Client Protocol, for the server to ask about its sessions and for Settings to show and change.
func NewACP ¶ added in v0.2.3
func NewACP(m ACPManifest) (ACPAgent, error)
NewACP is an ACP agent from a spec that is not in any file yet, for checking a command before it is added.
type ACPManifest ¶ added in v0.2.3
ACPManifest is an ACP agent as its manifest says it.
type Adapter ¶
type Adapter interface {
// Name is the agent name used in manifests and the protocol.
Name() string
// Label is the name people know it by, e.g. "Claude Code".
Label() string
// Command returns the argv that starts the agent through shell, with
// args (shell words typed by the user) appended.
Command(shell, args string) []string
// PromptArgs are the shell words that give the agent a first message
// in its interactive session.
PromptArgs(prompt string) string
// ResumeArgs are the shell words that reopen a saved session; with id
// "" the most recent one in the working directory.
ResumeArgs(id string) string
// Env is extra environment for the agent: conch's integration.
Env() []string
// Detect reports whether the agent is installed, as the user's login
// shell would find it.
Detect(ctx context.Context, shell string) Availability
// InstallScript is a shell script that installs the agent for the
// current user, run visibly in a pane.
InstallScript() string
// Tier is how far conch's support for this agent goes: TierSupported
// for the ones with an adapter, detection taken from the real agent
// and sessions that list and resume; TierRunsHere for one described by
// a manifest, which conch starts and detects and no more. Said rather
// than implied, so nothing has to pretend it can read a session format
// nobody has written down.
Tier() string
}
Adapter launches one kind of agent.
type Availability ¶
Availability is whether an agent is installed on this machine.
type Preparer ¶ added in v0.1.5
type Preparer interface {
Ensure() error
}
Preparer is an adapter that writes files an agent is launched with, and can write them again. The server asks before every launch: the folder they live in can disappear between one and the next.