cadrumo.application.flows.scripted module¶
The scripted intent driver: canonical answers in flow order, no frontend.
Non-interactive callers (--quiet / accept-defaults CLI modes, the
headless test harness) drive the engine with a pre-supplied ordered
queue of canonical tokens. Each visible page consumes the leftmost
token; the driver walks the engine’s own visible sequence, so branching
and validation are identical to every interactive frontend by
construction.
Drift detection carries the one-shot wizard’s discipline forward: an exhausted queue raises the underflow error naming the starved page, and finishing with unconsumed tokens raises the overflow error carrying counts only — canonical tokens can contain secrets and never ride in diagnostics.
- run_scripted_flow(definition, tokens, *, mode, defaults=None)[source]¶
Walk the whole flow against an ordered canonical-token queue.
The driver visits the visible sequence from the top; visibility is re-evaluated after every commit, so a token that reveals later pages (a gate, a repeating-group count) extends the walk exactly as an interactive run would.
defaultssupplies per-page fallbacks consumed when the queue would otherwise starve an optional page — the accept-defaults mode; a required page always consumes a real token.Returns the final state plus the passing review projection: a scripted run that cannot submit is a caller/runtime drift and raises rather than returning a half-answered state.
- Raises:
FlowAnswerError – On queue underflow (naming the starved page and counts only) or on unconsumed tokens at flow end.
- Return type:
- Parameters: