Documentation
¶
Overview ¶
Package setup runs an agent's install toolchain inside the sandbox. The daemon owns this — the app just asks it to ensure/update the agent. Adapter changes ship with the daemon; compatible CLI releases can also be approved through its catalog.
Toolchain steps form a small dependency graph. A shared catalog holds reusable, cross-stack tools (git, node, …) that any agent references by name via Step.Requires; `Plan` expands an agent's steps against that catalog into a topologically-ordered, deduplicated install plan (dependencies first), so "who installs before who" is declarative and tools are never installed twice.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OK ¶
func OK(results []StepResult) bool
OK reports whether every step ended satisfied or installed.
Types ¶
type Status ¶
type Status struct {
Running bool `json:"running"`
OK bool `json:"ok"`
Started bool `json:"started"`
Current string `json:"current"`
Steps []StepResult `json:"steps"`
Operation string `json:"operation,omitempty"` // "setup" or "update"; shared by all clients
Stage string `json:"stage,omitempty"` // live check, download, configuration or verification
Plan []string `json:"plan,omitempty"` // ordered tool names; Steps contains their results
StartedAt *time.Time `json:"startedAt,omitempty"` // retained when clients reconnect; never a completion estimate
}
Status is the wire-shaped snapshot of an agent's toolchain install job: whether an install is in flight, its outcome so far, the step currently running (for a live "Installing X…" label), and the per-step results appended as the install progresses. JSON tags match the shape the HTTP layer emits so callers marshal it unchanged; the Go SDK returns it directly.
type StepResult ¶
type StepResult struct {
Name string `json:"name"`
Status string `json:"status"` // "satisfied" | "installed" | "failed"
Output string `json:"output,omitempty"`
}
StepResult reports the outcome of one toolchain step.
func Run ¶
func Run(ctx context.Context, steps []agent.Step, force bool, onStart func(name string), onStep func(StepResult)) []StepResult
Run executes the steps. Unless force is set, a passing Check short-circuits the install (idempotent "ensure"); force=true re-installs installable steps (update). `onStep` (optional) is called as each step finishes, so a caller can report live progress while the run is in flight (the API serves it over GET /setup while the install runs in the background).
type Tracker ¶
type Tracker struct {
// contains filtered or unexported fields
}
Tracker runs per-agent toolchain installs in the BACKGROUND (an `npm i -g` can take minutes) so a caller's request never hangs while it installs; the caller polls Status for progress + completion. Only one install runs at a time per agent — a concurrent Start re-attaches to the in-flight job (idempotent, atomic) rather than starting a second run. The supervisor owns this Tracker for both the HTTP surface and the in-process Go SDK, and gates turns against it.
func (*Tracker) MissingDependencies ¶
MissingDependencies is a read-only probe of shared tools in the declared setup plan. An installed CLI can still need setup after an upgrade adds a dependency. Personas share these short-lived results; manual refresh and a completed setup invalidate them.
func (*Tracker) Start ¶
func (t *Tracker) Start(agentID string, steps []agent.Step, force bool, timeout time.Duration) Status
Start plans have already been resolved by the caller (via Plan). It launches the install for agentID in the background and returns immediately with a snapshot: a fresh {running:true,…} for a new run, or the live progress of the job already in flight (idempotent re-attach). The install runs on a DETACHED context — a caller/client disconnect can't abort it mid-write — bounded by timeout.