Documentation
¶
Overview ¶
Package agentcat answers "which coding agents can start here, on which models, and what is missing for the rest" — the New agent sheet's and Quick chat's picker (GET /v1/agents/catalog, ADR-046).
The owner's report that started it (2026-10-10, translated): "there's a model choice, and OpenCode there is empty — either give buttons to connect it or remove it". An agent offered with nothing to pick is a dead end; an agent hidden because it is not installed is a feature nobody finds. So each agent says whether it is installed, whether it looks set up, the models its own files list, and — when something is missing — the command that fixes it, which the page offers to type into a shell tab without running it.
Everything here reads files the agents already wrote and the login shell's environment. Nothing is run and nothing goes over the network: `opencode models` and `grok models` would fetch catalogs, and rule 4 says the daemon makes no call the user did not switch on.
Index ¶
- Constants
- func Argv(args []string, prompt, model string) []string
- func FindCustom(list []config.CustomAgent, agent string) (config.CustomAgent, bool)
- func HasAnyPlaceholder(s string) bool
- func HasPlaceholder(args []string, name string) bool
- func ValidateCustom(in []config.CustomAgent) ([]config.CustomAgent, error)
- type Entry
- type Env
- type Model
- type Setup
Constants ¶
const CustomPrefix = "custom:"
CustomPrefix is how a custom agent is named in a spawn request and on its sessions: "custom:aider".
Variables ¶
This section is empty.
Functions ¶
func Argv ¶
Argv fills a custom agent's argument template. `{prompt}` and `{model}` are replaced (the agent starts in the session's folder, so it needs no placeholder for it); an argument whose placeholder has no value is left out, and so is the flag right before it when the argument was the placeholder alone ("-m", "{model}"). Each argument stays one argument — nothing is split or passed through a shell.
func FindCustom ¶
func FindCustom(list []config.CustomAgent, agent string) (config.CustomAgent, bool)
FindCustom returns the custom agent a spawn request names ("custom:<id>").
func HasAnyPlaceholder ¶
HasAnyPlaceholder reports whether s holds {prompt} or {model}.
func HasPlaceholder ¶
HasPlaceholder reports whether an argument template uses {name}.
func ValidateCustom ¶
func ValidateCustom(in []config.CustomAgent) ([]config.CustomAgent, error)
ValidateCustom checks and normalises a list for storing: names and commands present, ids made from names when absent and unique, fields single-line and bounded.
Types ¶
type Entry ¶
type Entry struct {
// ID is what a spawn request names: "claude", "grok", "custom:<id>".
ID string `json:"id"`
Label string `json:"label"`
// Installed is true when its binary was found.
Installed bool `json:"installed"`
// Ready is Installed and nothing Caprock can see is missing.
Ready bool `json:"ready"`
// Default is the model its own config names, "" for none known.
Default string `json:"default,omitempty"`
// Models are the choices its own files list. Claude Code's and Gemini
// CLI's are the page's own checked lists (SpawnDialog.tsx) and are empty
// here.
Models []Model `json:"models"`
// TypedModel is true when a model may be typed rather than picked
// (OpenCode's provider/model).
TypedModel bool `json:"typed_model,omitempty"`
// Observed is true when Caprock reads the sessions' turns and cost.
Observed bool `json:"observed"`
// Custom marks an agent the user added (ADR-046); Locked one that the
// licence no longer covers, listed so its owner can see why it is gone.
Custom bool `json:"custom,omitempty"`
Locked bool `json:"locked,omitempty"`
// Prompt is false for a custom agent whose args have no {prompt}: a
// first message would be dropped, so the page says so.
Prompt bool `json:"prompt"`
Setup *Setup `json:"setup,omitempty"`
}
Entry is one agent in the picker.
func Builtins ¶
Builtins lists the agents Caprock knows, in the picker's order. installed says whether each one's binary was found.
func CustomEntries ¶
CustomEntries lists the custom agents for the picker. resolve finds a command's binary ("" when absent); licensed says whether the licence covers them.
type Env ¶
Env is what the catalog reads besides files: the login shell's environment, the home directory and the platform.
type Setup ¶
type Setup struct {
// Reason is "not_installed", "no_provider" (OpenCode with nothing
// connected, Hermes with no model chosen) or "signin" (an agent whose
// credentials Caprock found none of).
Reason string `json:"reason"`
// Text says it in one sentence, for the picker.
Text string `json:"text"`
// Command fixes it: an install, a sign-in. Typed into a shell tab for the
// user to read and run, never run by Caprock.
Command string `json:"command,omitempty"`
// Docs is the agent's own page on it.
Docs string `json:"docs,omitempty"`
}
Setup is what stands between an agent and a working session.