intake

package
v0.7.17-dev.1 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package intake collects a QuickAgent's up-front questions (manifest v2 `intake`): asked before the sandbox starts, in either run mode, through the same prompter that collects MCP profile secrets, or answered non-interactively with --intake id=value. The answers are staged read-only for the agent at /inputs/intake.json; non-secret answers are receipts. A secret answer never reaches the agent or a receipt: it becomes the value of the declared capability secret of the same (upper-cased) name and is injected the way declared secrets are.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoTerminal = errors.New("no terminal to ask intake questions on")

ErrNoTerminal explains why a required question could not be asked.

Functions

func ParsePreset

func ParsePreset(flags []string) (map[string]string, error)

ParsePreset reads --intake id=value flags.

func SecretName

func SecretName(id string) string

SecretName is the declared capability secret a secret intake answer becomes: the question id, upper-cased ("api_token" → API_TOKEN).

func SourceHosts

func SourceHosts(qs []manifest.IntakeQuestion, answers map[string]string) ([]string, error)

SourceHosts is the host of each input source the answers name for qs: what a scheduled run will fetch, so the keys saved for those hosts can be sealed beside a schedule that runs while its person is signed out. A type this CLI cannot fetch, or an answer it cannot read, is an error, as it is to a run.

Types

type Answers

type Answers struct {
	// Values are text and choice answers.
	Values map[string]string
	// Files are file answers: id → absolute host path (staged into /inputs).
	Files map[string]string
	// Secrets are secret answers: id → value. Never written anywhere but
	// the run's secrets file, under SecretName(id).
	Secrets map[string]string
	// FromSource are secret questions the run's secret source answers: their
	// value never passes through here, since the engine resolves the declared
	// capability secret SecretName(id) from that source itself; only the name
	// is recorded.
	FromSource map[string]bool
	// Sources are input-source answers: id → the source, fetched before the run
	// into /inputs/<id>/. Its token, when it has one, is filled in after
	// Collect (sources.ResolveTokens) and never written anywhere but the fetch
	// step's stdin.
	Sources map[string]*sources.Source
	// Fetched is each source's fetch, set by the engine before it writes
	// intake.json, so the document names the commit and the files.
	Fetched map[string]sources.Fetched
	// Hosts are target-host answers: id → the host, its answer read here; its
	// address, key and sign-in are filled in after Collect
	// (targethost.Prepare), and its sign-in is never written anywhere but the
	// host link's files.
	Hosts map[string]*targethost.Host
}

Answers is what the user said, by question id.

func Collect

func Collect(p setup.Prompter, qs []manifest.IntakeQuestion, preset map[string]string, declaredSecrets []string) (*Answers, error)

Collect answers every question: from preset first, then by asking p (nil when no terminal is available — a required question without a preset answer is then an error naming the flag). declaredSecrets are the manifest's capability secrets; a secret question whose upper-cased id is not among them has nowhere safe to go and is refused.

func CollectRun

func CollectRun(p setup.Prompter, m *manifest.Manifest, preset map[string]string, fromSource func(name string) bool) (*Answers, error)

CollectRun is CollectWithSource for a release's run, with its manifest in view: a url question its browser names as a site (capabilities.browser. sites) is the browser's, not an input source. Its answer is an http or https address (browser.ParseSite), kept in Values, so intake.json gives it to the agent, and never downloaded.

func CollectWithSource

func CollectWithSource(p setup.Prompter, qs []manifest.IntakeQuestion, preset map[string]string, declaredSecrets []string, fromSource func(name string) bool) (*Answers, error)

CollectWithSource is Collect with the run's secret source in view. fromSource (nil: none) reports whether that source holds a declared secret. With no preset and no terminal, a secret question it holds is answered from the source rather than refused as unanswerable: a hosted run's envFile, filled from the account's vault, carries the key an intake question asks for. A terminal still asks, so a person can mean another value than the source holds.

func (*Answers) Document

func (a *Answers) Document(inputsMount string) map[string]any

Document is the agent-side /inputs/intake.json: values as given, files as their agent-side paths, secrets as the name of the secret only.

func (*Answers) Empty

func (a *Answers) Empty() bool

Empty reports whether nothing was answered.

func (*Answers) FilePaths

func (a *Answers) FilePaths() []string

FilePaths returns the host paths of file answers, sorted.

func (*Answers) Receipt

func (a *Answers) Receipt(inputsMount string) map[string]any

Receipt is the receipts/intake.json content: the same as Document (it carries no secret values).

func (*Answers) SourceList

func (a *Answers) SourceList() []*sources.Source

SourceList answers the input sources by id, sorted.

Jump to

Keyboard shortcuts

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