/** * autoplan/DRIVER.md resolvers (field wave item 13): the compact entry a parent * agent on any host reads to drive an unattended /autoplan run through * `gstack-autoplan`, instead of autoplan/SKILL.md. Every list comes from code: * the phase order (PHASES), the scope flags (SCOPE_FLAG_TOKENS), the run * directory files (FILES), the reviewer RESULT FORMAT, the result codes * (RESULT_CODES). The command lines and the gate reply forms are stated once * here; test/autoplan-driver.test.ts checks them against `gstack-autoplan * --help` and the gate parser. */ import { FILES } from '../../lib/autoplan-state'; import { PHASES, RESULT_FORMAT } from '../../lib/autoplan-prompts'; import { SCOPE_FLAG_TOKENS } from '../../lib/autoplan-scope'; import { RESULT_CODES } from '../../lib/result-codes'; import { DEFAULT_HOST_ESTIMATE_USD, DEFAULT_MAX_ROUNDS } from '../../lib/autoplan-budget'; import type { ResolverFn } from './types'; /** One entry per command line the loop runs, as the field-wave plan specifies them. */ export const AUTOPLAN_DRIVER_COMMANDS: Array<{ cmd: string; does: string }> = [ { cmd: 'gstack-autoplan next --out --plan [scope flags] [--light] [--spend-cap ] [--max-rounds ] [--scaffold]', does: `first call: init the run, print PHASE:, SCOPE:, DRIVER: and one ATTEMPT: per voice; --max-rounds caps review rounds per phase (default ${DEFAULT_MAX_ROUNDS} unattended), and an unattended Capy run reserves ${DEFAULT_HOST_ESTIMATE_USD.toFixed(2)} per host attempt unless --estimate-usd says otherwise, so --spend-cap binds` }, { cmd: 'gstack-autoplan next --out [--redispatch ]', does: 'later calls: open the next phase or reprint open attempts; never redispatches on its own' }, { cmd: 'gstack-autoplan submit --out --phase

--voice native|outside --record --model [--attempt ]', does: 'bind a free-form review record (canonical fence, one findings table or list, or `No findings.`)' }, { cmd: 'gstack-autoplan submit ... --record --attest "" --attempt ', does: 'bind a record with no INPUT: line as receipt: attested (a wrong INPUT: always refuses)' }, { cmd: 'gstack-autoplan submit --out

--phase

--voice native|outside --result --model --attempt ', does: 'bind a canonical result (the RESULT FORMAT below)' }, { cmd: 'gstack-autoplan submit --out

--phase

--voice outside --unavailable|--failed ""', does: 'close the phase native-only when no outside voice can run' }, { cmd: 'gstack-autoplan answer --out

--gate-rev --reply "" --by human|agent: [--owner-reply |-] [--rec-hash ]', does: 'answer the gate with the reply grammar below; an agent answer stores the owner\'s words verbatim' }, { cmd: 'gstack-autoplan recommend --out --gate-rev --item --option --basis ""', does: 'change one recommendation before relay; then render and relay again (a `rec` needs the new `--rec-hash`)' }, { cmd: 'gstack-autoplan revise --out --plan --incorporates ', does: 'bind the amended plan; reopens every phase whose reviewed plan changed, Eng last' }, { cmd: 'gstack-autoplan revise --out --settle ', does: 'discharge a packaging or ordering change with no plan edit; reopens nothing' }, { cmd: 'gstack-autoplan revise --out --withdraw ', does: 'drop a pending amendment instead of applying it' }, { cmd: 'gstack-autoplan close --out --phase

--deferred "" --by human|agent:', does: 'close a phase accepted-with-findings: its open findings go to tasks.jsonl, and Critical, urgent or user-challenge findings become gate items; also the recovery from `STOP: reason=budget_exhausted`' }, { cmd: 'gstack-autoplan budget --out

[--spend-cap ] [--max-rounds ] --by human|agent:', does: 'the owner\'s journaled cap raise; after a budget stop, `resume` continues the run' }, { cmd: 'gstack-autoplan export --out ', does: 'write the artifact set; then `gstack-artifact validate /run.json`' }, { cmd: 'gstack-autoplan export --out --public ', does: 'a machine-path-free copy to commit or share (recorded roots rewritten, plan.md code kept, provenance digests); the private run is not touched; then `gstack-artifact validate --public --private /run.json` on this machine' }, { cmd: 'gstack-autoplan status|resume --out ', does: 'read the manifest (PENDING: lines name open attempts); take ownership after a crash (EXECUTION_UNKNOWN lists unfinished attempts)' }, { cmd: 'gstack-autoplan resume --out --from ', does: 'restore the newest valid checkpoint generation (GSTACK_AUTOPLAN_CHECKPOINT_DIR) into an empty directory and take ownership; `checkpoints --from ` lists them' }, ]; /** The reply grammar `gstack-gate` parses, one form per line. */ export const GATE_REPLY_FORMS: Array<{ reply: string; means: string }> = [ { reply: 'rec', means: 'every item takes its recommendation, plan changes included (each prints APPLY:); `all` and `do it` are aliases' }, { reply: 'as-is', means: 'keep every direction; no plan change' }, { reply: 'd3b uc1a', means: 'one