Documentation
¶
Overview ¶
Package setupwizard is the P6 application service for setup-notifications wizard. Run does not prompt. FillInteractive is a thin TTY adapter that only fills Request.
Index ¶
- Variables
- func BootstrapAutoTargets(ctx context.Context, req Request, before Result) (selected, skipped []string, err error)
- func LiveNotifyClients(controlRoot string, agents []string) []string
- func LiveSetupClients(req Request, agents []string) []string
- func RetryCommand(req Request) []string
- type Action
- type AgentCapability
- type ClientUnits
- type LinePrompt
- func (p *LinePrompt) Confirm(ctx context.Context, summary string) (bool, error)
- func (p *LinePrompt) SelectAgents(ctx context.Context, clients []AgentCapability) ([]string, error)
- func (p *LinePrompt) SelectExistingAction(ctx context.Context) (Action, error)
- func (p *LinePrompt) SelectLiveUnits(ctx context.Context, live []ClientUnits) (bool, bool, bool, error)
- func (p *LinePrompt) SelectUnits(ctx context.Context) (bool, bool, error)
- type MigrationBinding
- type NextAction
- type Prompter
- type PublicPrompt
- func (p *PublicPrompt) Confirm(ctx context.Context, summary string) (bool, error)
- func (p *PublicPrompt) SelectAgents(ctx context.Context, clients []AgentCapability) ([]string, error)
- func (p *PublicPrompt) SelectExistingAction(ctx context.Context) (Action, error)
- func (p *PublicPrompt) SelectLiveUnits(ctx context.Context, live []ClientUnits) (bool, bool, bool, error)
- func (p *PublicPrompt) SelectUnits(ctx context.Context) (bool, bool, error)
- type ReadinessFact
- type RemovalBinding
- type Request
- type Result
- type SetupPlan
- type TargetResult
Constants ¶
This section is empty.
Variables ¶
var ( ErrPromptCanceled = errors.New("prompt canceled") ErrPromptInputClosed = errors.New("prompt input closed before a complete answer") )
var ErrAmbiguousBinding = errors.New("ambiguous_binding")
var ErrAmbiguousInstallation = errors.New("ambiguous_installation")
var ErrLiveProfileConflict = errors.New("live_profile_conflict")
var ErrRefused = errors.New("setup wizard refused")
Functions ¶
func BootstrapAutoTargets ¶ added in v1.46.1
func BootstrapAutoTargets(ctx context.Context, req Request, before Result) (selected, skipped []string, err error)
BootstrapAutoTargets preserves absent MCP units when an installation or owned direct registration already exists. Historical state has no durable per-client opt-out bit, so an absent sibling requires an explicit Add. A read error or ambiguous state must never be interpreted as a fresh install.
func LiveNotifyClients ¶
LiveNotifyClients returns selected agents that already have a non-absent portable binding. Missing state is "none"; the TTY adapter does not invent an installation from the running master's version.
func LiveSetupClients ¶
LiveSetupClients returns selected agents that already have a portable binding or managed Codex hooks. Missing state is "none".
func RetryCommand ¶
RetryCommand is the structured argv that repeats this wizard request.
Types ¶
type AgentCapability ¶
AgentCapability is the Claude/Codex surface shown by the TTY picker. Presence and bindings come from Engine.Discover; the renderer does not search PATH.
func DiscoverAgents ¶
func DiscoverAgents(req Request) []AgentCapability
DiscoverAgents reports Claude/Codex user-scope metadata and executable presence without creating UAP state or executing found files.
type ClientUnits ¶
ClientUnits is the live hooks/notify fact for one selected client. The TTY shows these when Claude and Codex differ so omission is not one bool.
func LiveClientUnits ¶
func LiveClientUnits(req Request, agents []string) []ClientUnits
LiveClientUnits reports currently managed hooks/notify for each selected client. A missing binding is off, not a collapsed global default.
type LinePrompt ¶
LinePrompt is a local adapter until UAP publishes the reusable P5 terminal UI.
func (*LinePrompt) SelectAgents ¶
func (p *LinePrompt) SelectAgents(ctx context.Context, clients []AgentCapability) ([]string, error)
func (*LinePrompt) SelectExistingAction ¶
func (p *LinePrompt) SelectExistingAction(ctx context.Context) (Action, error)
func (*LinePrompt) SelectLiveUnits ¶
func (p *LinePrompt) SelectLiveUnits(ctx context.Context, live []ClientUnits) (bool, bool, bool, error)
func (*LinePrompt) SelectUnits ¶
type MigrationBinding ¶ added in v1.45.3
MigrationBinding is the exact, versioned intent payload for replacing one historical portable consumer. A retry uses these bindings even if the UAP target or the process environment changed after confirmation.
type NextAction ¶
type Prompter ¶
type Prompter interface {
SelectAgents(context.Context, []AgentCapability) ([]string, error)
SelectExistingAction(context.Context) (Action, error)
SelectUnits(context.Context) (hooks, notify bool, err error)
SelectLiveUnits(context.Context, []ClientUnits) (keep, hooks, notify bool, err error)
Confirm(context.Context, string) (bool, error)
}
Prompter is the thin TTY port. It only fills Request fields; Run owns rules.
type PublicPrompt ¶
type PublicPrompt struct {
// contains filtered or unexported fields
}
PublicPrompt is the Notifications adapter for the neutral UAP terminal UI. It maps product choices to opaque IDs and keeps all wizard policy in this package; installerui never knows about hooks, MCP, or agent-notify.
func NewPublicPrompt ¶
func (*PublicPrompt) SelectAgents ¶
func (p *PublicPrompt) SelectAgents(ctx context.Context, clients []AgentCapability) ([]string, error)
func (*PublicPrompt) SelectExistingAction ¶
func (p *PublicPrompt) SelectExistingAction(ctx context.Context) (Action, error)
func (*PublicPrompt) SelectLiveUnits ¶
func (p *PublicPrompt) SelectLiveUnits(ctx context.Context, live []ClientUnits) (bool, bool, bool, error)
func (*PublicPrompt) SelectUnits ¶
type ReadinessFact ¶
type ReadinessFact struct {
Client string `json:"client"`
Runtime string `json:"runtime"`
Hooks string `json:"hooks"`
MCP string `json:"mcp"`
Permission string `json:"permission"`
Restart string `json:"restart"`
Delivery string `json:"delivery"`
}
ReadinessFact is independent of binary download. Inspect and mutation both report these fields; not_checked/not_verified are not installation failure.
type RemovalBinding ¶ added in v1.45.3
type Request ¶
type Request struct {
Action Action
Agents []string
Hooks, AgentNotify *bool
Yes bool
PackageRoot, PluginRoot, ControlRoot, RuntimeRoot string
// PackageRoots are per-agent local packages for mixed-revision Repair.
// Run fills them from the offered root and still-usable recorded sources;
// they are not CLI flags.
PackageRoots map[string]string
// CodexHome and ClaudeConfig are explicit UAP client profile roots.
// EnvCodexHome and EnvClaudeConfig are a one-shot CLI snapshot of
// CODEX_HOME / CLAUDE_CONFIG_DIR, not flags. Resume restores intent
// profiles first; remaining empty roots take this snapshot. Run and
// Plan do not reread the process environment.
GlobalConfig, CodexHome, ClaudeConfig string
EnvCodexHome, EnvClaudeConfig string
ClientExecutable, ScopeRoot, Helper string
ClientExecutables map[string]string
PackageSHA256 string
// TreeDigest is the canonical package-tree digest from Prepare. It is
// distinct from PackageSHA256 (archive bytes).
TreeDigest, HelperDigest, HelperVersion string
InstallationID, Primary string
// BindingIDs are reserved per client during Plan/identity without
// staging. Run and the durable intent reuse them.
BindingIDs map[string]string
// MigrationBindings freezes the exact historical and replacement consumer
// identities before the confirmed intent is published. It is restored from
// that intent on retry, never reconstructed from a changed host environment.
MigrationBindings map[string]MigrationBinding
// RemovalBindings freezes the exact portable consumer that uninstall will
// revoke. A retry restores it from the confirmed intent after kernel revoke.
RemovalBindings map[string]RemovalBinding
// DataReceiptIDs are known UAP PLUGIN_DATA receipts. Uninstall/publish
// copies live receipts onto the durable intent; resume rejects a different ID.
DataReceiptIDs map[string]string
MCPConfig map[string]string
ClaudeHooks, CodexHooks *bool
ClaudeAgentNotify, CodexAgentNotify *bool
// ExternalUninstalled is host attestation that Codex already removed the
// native plugin, or never activated it. --yes does not set this.
ExternalUninstalled bool
// BootstrapExpectedGeneration fences an automatic client selection made
// before release acquisition. It is internal to the bootstrap orchestrator:
// an intervening opt-out must not become an implicit Add.
BootstrapExpectedGeneration *uint64
// ClaudeRunner overrides Claude activation probing. Production leaves it
// nil so the OS process runner is used. Isolated tests inject a listing
// fixture; the field is never parsed from CLI flags.
ClaudeRunner ports.CommandRunner
// ReleaseVersion is the accepted master revision without a leading v.
// DefaultReleaseVersion is a one-shot CLI snapshot of this binary's
// compiled consumer version, not an explicit flag. Resume restores
// intent.SourceRevision first; remaining empty values take this snapshot.
ReleaseVersion, DefaultReleaseVersion string
// ReleaseDownloadRoot is the directory that contains v{version}/ assets.
// Empty disables host fetch so tests that omit --package stay offline.
ReleaseDownloadRoot string
// PackageFetcher downloads one URL. Production uses HTTPS; tests inject
// a local server. Never parsed from CLI flags.
PackageFetcher func(context.Context, string) ([]byte, error)
// Progress reports large confirmed phases to the host. JSON stdout stays
// one result; the CLI writes these lines to stderr. Nil is silent.
Progress func(string)
// DiscoverAgents supplies Claude/Codex executable presence for the TTY
// picker. Production sets this from Engine.Discover. Nil skips presence
// labels. The function must not execute found files.
DiscoverAgents func() []AgentCapability
// LiveUnits reports managed hooks/notify for the TTY mixed-opt-out
// display. Nil uses LiveClientUnits from control-root state.
LiveUnits func([]string) []ClientUnits
}
Request is copied by Run. Omitted unit flags are nil; install defaults both units on, uninstall omitted units selects every managed unit of the agents.
func ApplyEnvDefaults ¶
ApplyEnvDefaults fills omitted Codex/Claude profile roots from the process environment once. Explicit Request fields win. HOME is not a fallback. The CLI snapshots these values onto EnvCodexHome/EnvClaudeConfig; Run and Plan apply that snapshot after resume instead of rereading the environment.
func FillInteractive ¶
func FillInteractive(ctx context.Context, req Request, p Prompter, existing func([]string) []string) (Request, error)
FillInteractive copies req and asks only for omitted mutation choices. existing reports live portable bindings for the selected agents; nil means treat the machine as new. Detection stays outside this adapter.
func PinCurrentReleasePackage ¶ added in v1.46.1
PinCurrentReleasePackage is used by the public bootstrap mode when its caller did not provide a verified ZIP. It deliberately ignores the old recorded package, so updating the runtime also updates the portable skill. Pending intents are checked before this function is called and keep their recorded source revision for resume.
type Result ¶
type Result struct {
Action string `json:"action"`
Outcome string `json:"outcome"`
Reason string `json:"reason,omitempty"`
InstallationID string `json:"installationID,omitempty"`
Generation uint64 `json:"generation,omitempty"`
Command []string `json:"command,omitempty"`
Targets []TargetResult `json:"targets,omitempty"`
Readiness []ReadinessFact `json:"readiness,omitempty"`
NextActions []NextAction `json:"nextActions,omitempty"`
// DataRetained is true after the last live binding is removed while
// PLUGIN_DATA remains. Absent inspect rows are not a license to run.
DataRetained bool `json:"dataRetained,omitempty"`
// contains filtered or unexported fields
}
type SetupPlan ¶
SetupPlan is the read-only preflight shown before TTY confirmation. Ready means the application service can mutate after --yes; it is not a committed installation result.
type TargetResult ¶
type TargetResult struct {
Client string `json:"client"`
Unit string `json:"unit"`
Outcome string `json:"outcome"`
Reason string `json:"reason,omitempty"`
Profile string `json:"profile,omitempty"`
TreeDigest string `json:"treeDigest,omitempty"`
// ConfigPath is the owned MCP file inspect used for a direct-mcp
// target. Empty on hooks/notify rows so JSON omits it.
ConfigPath string `json:"configPath,omitempty"`
}