Documentation
¶
Overview ¶
Package agentcatalog is the single description of the agent families Sidecar can start: their order in a creation picker, what to call them, and the command each one launches by default.
It is a leaf package on purpose. The workspace plugin builds its creation pickers from it, and Configuration lists the same families without importing the plugin (the plugin imports the app, and the app imports Configuration). One table, two readers, no drift.
Index ¶
- func BuildLaunch(id string, extra []string, skipPermissions bool) ([]string, error)
- func BuildResume(id, kind, value string, extra []string) ([]string, error)
- func DisplayCommand(argv []string) string
- func Known(id string) bool
- func Label(id string) string
- func OpaqueLaunchArgv(command string) ([]string, error)
- func ResolvePicker(allowlist []string, shellMode bool) []string
- func ShellCommand(argv []string) string
- type Family
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildLaunch ¶ added in v1.11.0
BuildLaunch resolves a catalog id and builds its structured launch argv.
func BuildResume ¶ added in v1.11.0
BuildResume resolves a catalog id — canonical, alias, or legacy — and builds its structured resume argv.
func DisplayCommand ¶ added in v1.11.0
DisplayCommand renders an argument vector as a shell command line, quoting only the entries a shell would otherwise read as more than one plain word.
It is a conservative quoter, not a cosmetic one: every entry either survives bare because no character in it means anything to the shell, or goes through ShellCommand. That makes it safe on the execution path while keeping the line a human reads — and the line typed at a shell prompt — the unadorned `claude --resume <id>` Sidecar has always shown.
Use ShellCommand when nothing will ever read the result but a shell. Use this when a human sees it too.
func Label ¶ added in v1.2.1
Label is the picker display name for an agent id.
"" is "None (attach only)". Catalog IDs use Family.Name. "shell" is "Project Shell". Unknown IDs pass through.
func OpaqueLaunchArgv ¶ added in v1.11.0
OpaqueLaunchArgv wraps a legacy .sidecar-agent-start/config command without parsing or reclassifying it as catalog argv. The returned wrapper is for this launch only; callers must not persist it as replayable structured metadata.
func ResolvePicker ¶ added in v1.2.1
ResolvePicker is the creation-picker list: Resolve's allowlist, then None (empty string) placed first for shells and last for worktrees.
Empty and unrecognized allowlists follow Resolve: every catalog family.
func ShellCommand ¶ added in v1.11.0
ShellCommand renders an argument vector as a single shell command line.
This is the one place structured argv becomes a string, and it exists so there is exactly one such place. Every entry is single-quoted with embedded quotes escaped, so a session identifier, path, or provider argument cannot end an argument and start a command however it is spelled. Callers that have argv should keep argv; this is for the two boundaries that genuinely need a command line — typing into an interactive shell, and showing a human a line they can paste.
Types ¶
type Family ¶
type Family struct {
// ID is the stored identity — the value written to plugins.workspace.agents,
// agentStart, and defaultAgentType.
ID string
// Name is the full display name.
Name string
// Short is the compact label a settings row or a selector uses.
Short string
// Command is the executable Sidecar launches when no override is configured.
Command string
// SkipPermissionsArg is appended as one argv entry when the caller
// explicitly requests the provider's unsafe/auto-approve mode.
SkipPermissionsArg string
// Aliases are other identifiers that name this same family — chiefly the
// conversation adapter ids, which do not all match the catalog id
// ("claude-code", "cursor-cli", "pi-agent"). They exist so the adapter
// vocabulary resolves here instead of in a switch statement per consumer.
Aliases []string
// ResumeArgs are the argv entries between Command and the session value.
// Empty means the family has no native resume.
//
// Every provider Sidecar knows takes the session value last, so this plus a
// trailing value expresses all three real shapes: a subcommand
// ("codex resume"), a chain of them ("amp threads continue"), and a flag
// pair ("opencode --continue -s").
ResumeArgs []string
// ResumeKinds are the session reference kinds this family can resume from,
// as the bare kind names "id" and "path". They are plain strings so this
// package stays a leaf.
ResumeKinds []string
// AdapterID is the id this family's conversation-history adapter registers
// under, when it differs from ID. Empty means the two are the same.
//
// It is stated rather than inferred from Aliases because "which adapter
// reads this provider's transcripts" is a specific fact, and deriving it
// from "what else is this provider called" would be right by coincidence.
AdapterID string
}
Family is one agent family Sidecar offers when work is created.
func FindLaunch ¶ added in v1.11.0
FindLaunch resolves selectable and explicitly supported legacy launch families. Use Find for UI selection; use FindLaunch only at an execution boundary that must honor persisted older configuration.
func Lookup ¶ added in v1.11.0
Lookup resolves any identifier that names a family: its canonical id, one of its aliases (the conversation adapter ids), or a legacy launch id.
Find stays exact on purpose — it answers "is this the stored setting?" for pickers and configuration. Lookup answers "which family is this?" for code translating another vocabulary into ours.
func Resolve ¶
Resolve is the allowlist rule creation uses, stated once.
An empty allowlist means every family: a user who has never touched the setting is offered everything, and so is a user whose allowlist names nothing Sidecar recognizes. Otherwise the allowlist is honoured in its own order, with unknown and duplicate entries dropped.
func (Family) CanResume ¶ added in v1.11.0
CanResume reports whether this family has a native resume command.
func (Family) ConversationAdapterID ¶ added in v1.11.0
ConversationAdapterID is the id of the conversation-history adapter that can read this family's transcripts.
func (Family) LaunchArgv ¶ added in v1.11.0
LaunchArgv builds the provider launch as structured arguments. Shell quoting belongs to the terminal adapter, at the one boundary where argv becomes a command line; callers must not concatenate these values themselves.
func (Family) ResumeArgv ¶ added in v1.11.0
ResumeArgv builds the provider resume as structured arguments.
It deliberately does not take a skip-permissions flag. Resuming reproduces exactly the command shape Sidecar has shipped and verified, and the safe position for a global flag differs per provider once a subcommand is involved ("codex resume", "amp threads continue"): guessing one would emit a command line no test has ever run. A caller that wants an auto-approving resume launches the provider and resumes from inside it.
func (Family) ResumesKind ¶ added in v1.11.0
ResumesKind reports whether this family can resume from a reference of kind.