Files
narratio/docs/internal/preflight.md

2.4 KiB

Internal: Prompt Requirements Preflight

The application selects intended Scriptorium requests after acquiring final domain configuration. For execution, it projects the bounded plan against a clone of the locked manifest using the same stage decisions and analysis work planner as session plan. Enabled trim is inspected when projected to run; analysis targets come from the projected execution order, including scheduled disabled prerequisites and excluding reusable work. The projection is not an execution commitment: earlier outputs can change later decisions.

For session validate, the application selects enabled definitions and their configured prerequisite closure independently of output reuse. Both entry points construct effective contexts through stage-owned helpers and call internal/preflight. Input-map keys remain prompt binding names, distinct from Narratio source IDs. No artifact is materialized or fetched for this check.

The checker invokes the adapter sequentially and assesses native structured findings. Definite missing required bindings and unsupplied required variables are errors. An optional source for a required prompt input, conditional requirements, incomplete discovery, and discovery issues produce warnings. It retains earlier findings and underlying inspection errors, and stops on cancellation. The application formats findings for its invocation reporter or validation report; the checker does not mutate manifests or acquire config.

The run hook executes before stage attempts or live pre-execution invalidation. It reuses an injected Scriptorium runner or creates the invocation-owned runner that generation later uses. Empty target sets invoke no inspector. Validation uses its own invocation-owned factory and creates no execution workspace, run directory, lock, report file, or manifest update. Discovery can read Scriptorium configuration and resources, but does not call a model or establish future input contents. Actual execution and input resolution remain authoritative.

See the Scriptorium contract, CLI, and operations. Implementation and focused tests are in internal/preflight, internal/app/preflight_targets.go, internal/app/runner_preflight.go, internal/app/session_inspection_command.go, and internal/stage/scriptorium_vars.go.