Documentation
¶
Overview ¶
Package run implements the buyer-side "Execute" step of the konareef demo flow: `konareef pod run <handle>/<pod>@<version>`.
It spawns a previously installed pod directly from its local install cache — the pod.toml + every content file under `<home>/.konareef/installed/<handle>/<pod>/<version>/content/`, plus the cached publisher attestation when one exists (Task B3, `internal/install`) — polls reef-core until the run finishes, and downloads every deliverable it produced into a local directory.
This is the Mode-A counterpart to internal/smoke's Mode-B spawn (free-form task string): Run POSTs to /api/pods/spawn with the pod's own manifest and inputs rather than a canned task.
Index ¶
Constants ¶
const DefaultPollInterval = 2 * time.Second
DefaultPollInterval is how often Run polls reef-core for the completion signal (a custody proof) when Config.PollInterval is left at zero. Pod runs in the demo are short-lived, one-shot executions, so a short interval favors CLI responsiveness over server load.
const DefaultTimeout = 10 * time.Minute
DefaultTimeout is the poll timeout applied when Config.Timeout is left at zero.
Variables ¶
This section is empty.
Functions ¶
func LoadContentFiles ¶
LoadContentFiles reads a pod's install-cache content/ directory: pod.toml (returned separately, since the spawn wire carries it as its own top-level field) plus every file in the tree — including pod.toml itself — keyed by its "./"-prefixed relative path, matching the Mode-A spawn body's `files` map convention (e.g. "./prompts/system.md"; see the PRD's pinned interface contracts).
Returns an error if contentDir doesn't exist or contains no pod.toml.
func ParseInputs ¶
ParseInputs converts "key=value" strings (as collected by repeated --input flags) into the inputs map the spawn wire expects. Returns an error naming the offending entry if any lack an "=" separator. A repeated key keeps its last value.
func Run ¶
Run executes `konareef pod run`:
- Load the pod's cached content/ dir (error naming `konareef install` if it's missing) and its cached attestation, when one exists.
- POST /api/pods/spawn (Mode A) with the manifest, files, inputs, and attestation.
- Poll for completion — a custody proof appearing for the spawned agent, the same terminal signal internal/smoke's Run polls for after spawn. (Its custody-lookup helper, findCustodyIndex, is unexported, so the poll loop is mirrored here rather than imported — see the task report for the reuse discussion.)
- List and download every deliverable into Config.OutDir.
Prints the demo's Execute-step UX to stdout as it proceeds. Returns a descriptive error on any failure.
Types ¶
type Config ¶
type Config struct {
BaseURL string
SessionToken string
// Home is the install-cache root (normally $HOME). Empty means
// os.UserHomeDir(). Overridable so tests don't touch the real
// user's ~/.konareef.
Home string
Handle string
PodName string
Version string
// Inputs are the buyer-supplied pod inputs (--input k=v flags,
// already parsed via ParseInputs).
Inputs map[string]string
// OutDir is the directory deliverables are downloaded into.
OutDir string
Timeout time.Duration
PollInterval time.Duration
}
Config configures a `konareef pod run` invocation.
type InputFlags ¶
type InputFlags []string
InputFlags collects repeated `--input key=value` flag occurrences into a slice — flag.Value doesn't natively support repeatable string flags, so main.go wires `fs.Var(&inputs, "input", ...)` against this type, and each --input on the command line appends here. ParseInputs then converts the accumulated slice into the wire-shape inputs map.
func (*InputFlags) Set ¶
func (f *InputFlags) Set(value string) error
Set appends one more `key=value` occurrence. Always succeeds — "key=value" validation happens later, in ParseInputs, so a single malformed entry can be reported alongside all the others instead of aborting flag parsing on the first bad one.
func (*InputFlags) String ¶
func (f *InputFlags) String() string
String renders the accumulated flags for flag.Value's diagnostic output (e.g. `-help`); it is not used to reconstruct the flags.