Documentation
¶
Overview ¶
Package installer installs agents with npm into actp's own prefix, so the dashboard can add an agent without a terminal (and without root in Docker).
Index ¶
- Constants
- Variables
- type Installer
- func (in *Installer) Installed(ctx context.Context) map[string]string
- func (in *Installer) Job(offset int) *JobView
- func (in *Installer) NPM() (string, error)
- func (in *Installer) Run(ctx context.Context, preset, action string, out io.Writer) error
- func (in *Installer) Start(preset, action string) (JobView, error)
- type JobView
- type Recipe
Constants ¶
const ( ActionInstall = "install" // also updates: npm installs the latest version ActionRemove = "remove" )
Actions an installer job can run.
Variables ¶
var Recipes = []Recipe{ {Preset: "claude-code", Name: "Claude Code", Packages: []string{"@agentclientprotocol/claude-agent-acp", "@anthropic-ai/claude-code"}, Login: "claude /login, or set ANTHROPIC_API_KEY"}, {Preset: "codex", Name: "Codex", Packages: []string{"@agentclientprotocol/codex-acp", "@openai/codex"}, Login: "codex login, or set OPENAI_API_KEY"}, {Preset: "droid", Name: "Droid", Packages: []string{"@factory/cli"}, Login: "droid, then /login, or set FACTORY_API_KEY"}, {Preset: "gemini", Name: "Gemini CLI", Packages: []string{"@google/gemini-cli"}, Login: "gemini, or set GEMINI_API_KEY"}, {Preset: "opencode", Name: "OpenCode", Packages: []string{"opencode-ai"}, Login: "opencode auth login"}, {Preset: "pi", Name: "Pi", Packages: []string{"pi-acp", "@earendil-works/pi-coding-agent"}, Login: "pi, then /login"}, }
Recipes lists the presets actp can install, in display order.
Functions ¶
This section is empty.
Types ¶
type Installer ¶
type Installer struct {
// Prefix is the npm prefix (config.AgentsPrefix() by default).
Prefix string
// Env returns the environment npm runs in; nil means the login shell's.
Env func() []string
// OnDone runs after a job that succeeded.
OnDone func(preset, action string)
// contains filtered or unexported fields
}
Installer runs one npm job at a time.
type JobView ¶
type JobView struct {
ID int `json:"id"`
Preset string `json:"preset"`
Action string `json:"action"`
Started string `json:"started"`
Done bool `json:"done"`
Error string `json:"error,omitempty"`
Output string `json:"output"`
// Next is the offset to ask for next time.
Next int `json:"next"`
}
JobView is a job's state with its output from a given offset.
type Recipe ¶
type Recipe struct {
Preset string `json:"preset"`
Name string `json:"name"`
// Packages are npm packages; the first one provides the preset's command.
// The others are the agent's own CLI, which some agents need to log in.
Packages []string `json:"packages"`
// Login says how to log in after installing, if the agent needs it.
Login string `json:"login,omitempty"`
}
Recipe is how to install one preset.