launch

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Overview

Package launch is the one-command porcelain entry point for AgentProvenance.

agentprov launch -- claude          # or codex, or any agent command

It orchestrates the existing plumbing into a single zero-friction run: create a run scope, start the read-only dashboard, inject a per-run hooks overlay into the agent (Claude Code today) without touching the user's settings, start the kernel sensor when the host can (else degrade honestly), exec the agent in a dedicated cgroup, and on exit fold every source into one verifiable evidence graph (signed when --sign-key is set) and print a one-line verdict.

Startup names configured capture paths, not proven coverage. The application (transcript/hooks) and runtime capture reports describe actual evidence after execution, including missing sources, failed probes and unknown loss.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintPreflight

func PrintPreflight(w io.Writer, r PreflightReport)

PrintPreflight renders the same readiness checks used by `agentprov doctor`. Warn/skip states are not fatal: launch is intentionally degradation-friendly.

func PrintPreflightLocale added in v0.8.2

func PrintPreflightLocale(w io.Writer, r PreflightReport, lang i18n.Locale)

PrintPreflightLocale translates presentation without changing the report.

Types

type Check

type Check struct {
	Name   string      `json:"name"`
	Status CheckStatus `json:"status"`
	Detail string      `json:"detail"`
	Fix    string      `json:"fix,omitempty"`
	// contains filtered or unexported fields
}

Check is one launch prerequisite or degradation check.

type CheckStatus

type CheckStatus string

CheckStatus is the operator-facing state of one launch preflight check.

const (
	CheckPass CheckStatus = "pass"
	CheckWarn CheckStatus = "warn"
	CheckFail CheckStatus = "fail"
	CheckSkip CheckStatus = "skip"
)

type Options

type Options struct {
	Language           i18n.Locale // terminal presentation; empty uses English
	ExplicitLanguage   bool        // preserve browser negotiation unless the caller selected a language
	DataDir            string      // AgentProvenance data dir (root --data-dir)
	Command            []string    // the agent argv, e.g. ["claude", "-p", "..."]
	Workdir            string      // agent working directory; "" = current dir
	Dashboard          bool        // serve the read-only dashboard and keep it live after exit
	DashboardAddr      string      // dashboard listen address (host:port); falls back to ephemeral if busy
	Sensor             string      // "auto" (Linux + capable) or "off"
	SignKeyPath        string      // optional hex ed25519 private key; when set, the sealed bundle is signed
	FileDiff           bool        // capture the working-tree file diff (off by default; expensive in big repos)
	SelfExe            string      // absolute path to this agentprov binary (for the sensor subprocess + hook commands)
	JSON               bool        // caller will emit the machine report on Stdout: keep Stdout pure JSON and don't block on the dashboard
	ContextDir         string
	ContextFile        string
	ContextSession     string
	ContextHarness     string
	NoContext          bool
	CapturePreset      string // additional context retention: detailed (default) or basic
	CaptureToolResults *bool  // optional preset override; nil keeps the preset value

	Stdout io.Writer
	Stderr io.Writer
}

Options configures a launch run.

type PreflightReport

type PreflightReport struct {
	Command       []string `json:"command,omitempty"`
	SelfExe       string   `json:"self_exe,omitempty"`
	DashboardAddr string   `json:"dashboard_addr,omitempty"`
	SensorMode    string   `json:"sensor_mode,omitempty"`
	Checks        []Check  `json:"checks"`
}

PreflightReport is the structured launch readiness report.

func Preflight

func Preflight(opts Options) PreflightReport

Preflight inspects whether launch can observe the requested command before it starts long-lived children. It is intentionally side-effect-light: the only filesystem probe creates and removes a temporary cgroup leaf when Linux cgroup v2 appears writable, matching the operation record will need later.

func (PreflightReport) HasFailures

func (r PreflightReport) HasFailures() bool

type Report

type Report struct {
	RunID              string                              `json:"run_id"`
	ExitCode           int                                 `json:"exit_code"`
	Status             string                              `json:"status"`
	AppTier            string                              `json:"app_tier"`
	AppDetail          string                              `json:"app_detail,omitempty"`
	SysTier            string                              `json:"sys_tier"`
	SysDegradeReason   string                              `json:"sys_degrade_reason,omitempty"`
	Events             int                                 `json:"events"`
	HighRisk           int                                 `json:"high_risk"`
	Signals            int                                 `json:"signals"`
	Verdict            string                              `json:"verdict"`
	BundlePath         string                              `json:"bundle_path,omitempty"`
	Signed             bool                                `json:"signed"`
	AttestationPath    string                              `json:"attestation_path,omitempty"`
	DashboardURL       string                              `json:"dashboard_url,omitempty"`
	HooksIngested      int                                 `json:"hooks_ingested"`
	IntentMismatches   int                                 `json:"intent_mismatches"`
	IntentCoverageGaps int                                 `json:"intent_coverage_gaps"`
	TranscriptTurns    int                                 `json:"transcript_turns"`
	AgentContext       *agentcontext.Overview              `json:"agent_context,omitempty"`
	CapturePolicy      *agentcontext.CapturePolicy         `json:"capture_policy,omitempty"`
	ContextIssues      []string                            `json:"context_issues,omitempty"`
	ArtifactCapture    *record.ArtifactCaptureReport       `json:"artifact_capture,omitempty"`
	RuntimeCorrelation *hooksbridge.CorrelationReport      `json:"runtime_correlation,omitempty"`
	RuntimeCapture     *observability.RuntimeCaptureReport `json:"runtime_capture,omitempty"`
	// contains filtered or unexported fields
}

Report is the machine-readable outcome of a launch run.

func Run

func Run(opts Options) (Report, error)

Run executes the full launch lifecycle and returns its Report. The returned error is a launch-infrastructure error only; a nonzero agent exit is reported via Report.ExitCode, not as an error, so the caller can propagate it.

Jump to

Keyboard shortcuts

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