agentcat

package
v0.111.2 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 14 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

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

View Source
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

func Argv(args []string, prompt, model string) []string

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

func HasAnyPlaceholder(s string) bool

HasAnyPlaceholder reports whether s holds {prompt} or {model}.

func HasPlaceholder

func HasPlaceholder(args []string, name string) bool

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

func Builtins(env Env, installed func(agent string) bool) []Entry

Builtins lists the agents Caprock knows, in the picker's order. installed says whether each one's binary was found.

func CustomEntries

func CustomEntries(list []config.CustomAgent, resolve func(string) string, licensed bool) []Entry

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

type Env struct {
	Vars []string
	Home string
	GOOS string
}

Env is what the catalog reads besides files: the login shell's environment, the home directory and the platform.

func DefaultEnv

func DefaultEnv(vars []string) Env

DefaultEnv is the running machine's.

type Model

type Model struct {
	ID    string `json:"id"`
	Label string `json:"label"`
}

Model is one choice in a model picker.

type Setup

type Setup struct {
	// Reason is "not_installed", "no_provider" (OpenCode with nothing
	// connected) 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.

Jump to

Keyboard shortcuts

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