installer

package
v0.1.1 Latest Latest
Warning

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

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

View Source
const (
	ActionInstall = "install" // also updates: npm installs the latest version
	ActionRemove  = "remove"
)

Actions an installer job can run.

Variables

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

func (*Installer) Installed

func (in *Installer) Installed(ctx context.Context) map[string]string

Installed returns the version of each package in the prefix.

func (*Installer) Job

func (in *Installer) Job(offset int) *JobView

Job returns the current or last job with output from offset on, or nil.

func (*Installer) NPM

func (in *Installer) NPM() (string, error)

NPM finds npm, or says why there is none.

func (*Installer) Run

func (in *Installer) Run(ctx context.Context, preset, action string, out io.Writer) error

Run installs or removes a preset's packages and waits, writing npm's output to out. It does not call OnDone.

func (*Installer) Start

func (in *Installer) Start(preset, action string) (JobView, error)

Start begins installing (or updating) or removing a preset's packages in the background.

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.

func Find

func Find(preset string) *Recipe

Find returns the recipe for a preset, or nil.

Jump to

Keyboard shortcuts

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