Documentation
¶
Overview ¶
Package agentcatalog is the single description of the agent families Sidecar knows: their order in a creation picker, what to call them, the command each one launches, and how each one resumes.
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. Being a leaf is also why it cannot resolve the Sidecar config directory itself: LoadOverlay takes the path from whoever starts the process.
The families themselves are data, not code. They live one to a file under families/, embedded in the binary, and a user can override one or add another by dropping a file in the overlay directory beside their config. families/README.md is the schema and the reasoning; read it before adding a family.
Index ¶
- func BuildLaunch(id string, extra []string, skipPermissions bool) ([]string, error)
- func BuildResume(id, kind, value string, extra []string) ([]string, error)
- func DetectionOnly(id string) bool
- func DisplayCommand(argv []string) string
- func Installed(id string) bool
- func InstalledKnown() bool
- func Known(id string) bool
- func Label(id string) string
- func LoadOverlay(dir string) []error
- func OpaqueLaunchArgv(command string) ([]string, error)
- func PrimeInstalled()
- func ResolvePicker(allowlist []string, shellMode bool) []string
- func ShellCommand(argv []string) string
- func ShortLabel(id string) string
- type Family
- func DetectionFamilies() []Family
- func Families() []Family
- func Find(id string) (Family, bool)
- func FindDetection(id string) (Family, bool)
- func FindLaunch(id string) (Family, bool)
- func LegacyFamilies() []Family
- func Lookup(id string) (Family, bool)
- func Resolve(allowlist []string) []Family
- func ResolveInstalled(allowlist []string) []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 DetectionOnly ¶ added in v1.12.0
DetectionOnly reports whether an ID names a family Sidecar can recognise but not start. It is false for every launchable family, so the two lists answer exactly one question each.
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 Installed ¶ added in v1.14.0
Installed reports whether a family's command resolves on PATH. It is false for a family with no command and for every family before PrimeInstalled runs; use InstalledKnown to tell those apart from a genuine absence.
func InstalledKnown ¶ added in v1.14.0
func InstalledKnown() bool
InstalledKnown reports whether the PATH probe has run in this process.
A caller that filters by installation must ask this first, because "not installed" and "not asked" are the same zero value and must not be the same decision.
func Label ¶ added in v1.2.1
Label is the display name for an agent id.
"" is "None (attach only)". "shell" is "Project Shell". Every family in either list uses Family.Name. Unknown IDs pass through.
It answers for detection-only families too, even though no picker offers one, because this is the single id-to-name mapping in the codebase and a caller that has an id from a *pane* rather than from a picker has the same question. Without them `qodercli` was its own display name, and the Name and Short on all ten entries were data nothing read.
func LoadOverlay ¶ added in v1.14.0
LoadOverlay reads <dir>/*.toml and folds those families into the catalog, returning one error per file it had to skip.
A file whose id names a bundled family overrides that family: the file is decoded on top of the bundled record, so writing only `command = "claude-next"` keeps the name, aliases and resume arguments Sidecar ships, and keeps the family where it already sits in the picker. A file with a new id adds a family, at the end of the picker unless it states an `order`. Either way the catalog is rebuilt from the bundled set, so calling this twice is the same as calling it once, and a file removed from the directory is gone on the next load.
It never fails. A directory that is not there is an empty overlay, and a file that does not parse is reported and dropped: a malformed personal config file must not stop Sidecar from starting, and the families it did not name are unaffected.
agentcatalog is a leaf package and cannot resolve the Sidecar config directory itself, so the caller passes the path. config.AgentCatalogDir is the one place that path is computed.
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 PrimeInstalled ¶ added in v1.14.0
func PrimeInstalled()
PrimeInstalled resolves every family's command on PATH and caches the result.
It is I/O -- one PATH walk per family, which on a machine running an endpoint security agent is a measurable number of file opens -- so it belongs on a startup seam or in a tea.Cmd, never in View or Init. Calling it again recomputes, which is what a catalog reloaded from an overlay needs.
func ResolvePicker ¶ added in v1.2.1
ResolvePicker is the creation-picker list: ResolveInstalled's allowlist, then None (empty string) placed first for shells and last for worktrees.
Empty and unrecognized allowlists follow Resolve: every catalog family, minus the ones whose command is not installed.
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.
func ShortLabel ¶ added in v1.12.0
ShortLabel is the compact display name for an agent id: Family.Short from either list, and the id itself for anything this catalog does not name.
It is what a width-constrained surface wants where Label is what a settings row wants. The agent chip is the case that forced it to exist: chips render a lowercased token, so "Claude Code" is too long and too proper for one, while the raw id is wrong for the one family whose id is not a name — Qoder's id is `qodercli` because that is Herdr's label, and a chip reading `qodercli` names a manifest file rather than a program.
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
// LaunchArgs are the argv entries between Command and everything else: the
// subcommand that starts an interactive session, for the providers whose
// bare command is not one.
//
// It exists because `kiro-cli` on its own prints help and its agent is
// `kiro-cli chat`, and because every flag such a provider takes is scoped to
// that subcommand. It is empty for every provider whose command is already
// the agent, which is all but one of them.
LaunchArgs []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 DetectionFamilies ¶ added in v1.12.0
func DetectionFamilies() []Family
DetectionFamilies returns every family Sidecar can recognise in a pane but never offers to start, in id order.
A family is here when its file states no command, which is the whole of the definition: there is no flag, and no second list. Herdr publishes a screen-detection manifest for such an agent, Sidecar vendors it, and the engine executes it, so an id, the process spellings that name the program and something to call it are all a state badge needs.
It is deliberately not folded into Families: a caller that wants "what can be started" must not be handed a family with no command, and a caller that wants "what can appear in a pane" wants both lists. Families() is read as "everything Sidecar can launch" by the creation pickers, both configuration pages, workspaceops, and TestAgentPickersFollowCatalog in another package, so a family that cannot be launched must not be able to reach it.
This list is empty as Sidecar ships today, because every agent Herdr publishes a manifest for now has a launch command of its own. That is the point of the split rather than a reason to remove it: the next agent Herdr adds is detection-only from the moment its manifest is vendored until somebody establishes its command, and the bucket is what lets that land without a picker offering a program nobody can start.
func FindDetection ¶ added in v1.12.0
FindDetection returns the detection-only family with an ID.
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 LegacyFamilies ¶ added in v1.14.0
func LegacyFamilies() []Family
LegacyFamilies returns the compatibility launch families, in id order.
A family is here when its file says `legacy = true`. They remain launchable for a persisted or configured creation setting and are deliberately absent from Families and from every picker; unknown ids never fall back to one, or to Claude. Aider is the sole case.
It is the third bucket, and it is separate from the other two for the same reason they are separate from each other: nothing that offers a user a choice may reach it, and nothing that lists what Sidecar can recognise wants it. Only an execution boundary honouring an older persisted setting does.
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 ResolveInstalled ¶ added in v1.14.0
ResolveInstalled is Resolve with the picker's installation rule applied.
A family is offered when the user has named it in plugins.workspace.agents, or -- when they have named nothing -- when its command resolves on PATH. Naming a family is the stronger signal and is honoured whether or not the command is there: a user who wrote the setting is telling Sidecar what they want offered, and a machine they have not installed it on yet is their business.
Filtering only happens once PrimeInstalled has run and only when it found something. Before that, and on a machine where no catalog command resolves at all, every family is offered: an empty picker is a dead end, and offering an agent the user does not have costs them a "command not found" while hiding one they do have costs them the feature.
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.