Document Scriptorium preflight and native integration

This commit is contained in:
2026-11-26 04:40:25 +00:00
parent e9d57fb7aa
commit f930ebf337
14 changed files with 186 additions and 90 deletions

View File

@@ -61,6 +61,12 @@ state without constructing or invoking stage-execution adapters. The shared
command configuration loader may still use object storage to retrieve a missing
remote session file before planning begins.
Before a run starts stage attempts, the application projects selected work and
uses the invocation's Scriptorium runner for any needed requirements checks.
The same runner is then available to generation. Explicit session validation
uses an invocation-owned factory and the shared checker. See
[preflight internals](preflight.md).
Notarius is composed only when extraction is enabled; the extract stage owns
prepared reference resolution, receipt, bundle, and configured-lane policy.
The adapter validates the ordered selector/absolute-path pairs and is the sole
@@ -98,8 +104,10 @@ in-memory backend without changing package state.
original result classification. Child environments contain only the execution
baseline and adapter-specified values; configured credentials are resolved
once by ConfigKit and passed explicitly as sensitive values. Adapters do not
re-read their named environment references. Stdout and stderr are redacted while streaming into separate
8 MiB diagnostic captures; a bounded wait closes a stream retained by a
re-read their named environment references. Diagnostic-only stdout and stderr
are redacted while streaming into separate 8 MiB captures. Scriptorium result
mode directs stdout to a caller-owned, byte-preserving bounded writer instead;
capture failures use the same abort path. A bounded wait closes a stream retained by a
departed leader's descendant. Unsupported platforms reject owned command
execution.

View File

@@ -28,7 +28,8 @@ progress and artifact services resolve durable inputs and outputs.
The pipeline runner follows one explicit invocation lifecycle: inspect bounded
prerequisites without mutation, prepare the workspace layout, acquire one
session lock, load or create the authoritative session manifest, compose only
session lock, load or create the authoritative session manifest, check projected
Scriptorium work, compose only
the collaborators needed by the selected range, execute each selected stage in
order, finalize terminal state, release resources, and return a possibly partial
summary with preserved failure causes. Narrow terminal local persistence detaches
@@ -45,6 +46,7 @@ failed stage or required manifest save prevents later stages from starting.
| Application orchestration | `internal/app` | Native CommandKit declarations/reporting, lazy configuration selection, secret-file environment loading, production composition, session locking, planning, execution, restore, and user-facing reporting. |
| Configuration | [`internal/config`](configuration.md) | Typed ConfigKit results and lifecycle defaults, imports/overlays, canonical party loading, separate catalog/player/publication derivation, session templating, and validation. |
| Pipeline stages | `internal/stage` | Canonical stage registry, shared stage contract, execution dependencies, and implemented stage behavior. |
| Prompt preflight | [`internal/preflight`](preflight.md) | Assess native prompt requirements against intended bindings for execution and validation. |
| External boundaries | `internal/adapters`, `internal/audio` | WhisperX HTTP, downstream subprocesses, notification, object storage, and S3 audio materialization behind Narratio contracts. |
| Manifests | `internal/manifest` | Durable session progress, stage transitions, validation, and atomic persistence. |
| Artifacts and paths | `internal/artifacts`, `internal/pathsafe` | Artifact identities and resolution, local and remote path/key models, current-state discovery, and confined relative destinations. |
@@ -116,6 +118,8 @@ so any earlier replacement can stale a prior cleanup result.
field ownership, decoding, and source-relative resource semantics.
- [Adapter Internals](adapters.md): external adapter boundaries, composition,
failure behavior, and test surfaces.
- [Preflight Internals](preflight.md): projected target selection and shared
requirements assessment.
- [Artifact Internals](artifacts.md): source identities, runtime catalog,
resolution, previous requirements, and current-state helpers.
- [Manifest Internals](manifest.md): session records, persistence, and execution

View File

@@ -0,0 +1,37 @@
# 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](../integrations/scriptorium.md),
[CLI](../cli.md#session-validate), and [operations](../operations.md#prompt-requirements-preflight).
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`.

View File

@@ -141,6 +141,10 @@ Supported source families:
- resolves previous-session sources from local `previous/` cache only.
- runs optional render-debug, then artifact execution.
- validates non-empty output files and materializes canonical outputs.
- shares effective prompt context and variables with requirements inspection;
preview and generation capture their own results separately from stderr logs.
Application preflight selects projected work through the same planner; see
[preflight internals](preflight.md).
## Failure Semantics

View File

@@ -17,6 +17,7 @@ applies a bounds-driven trim.
## Key Behavior
When `trim.enabled=true`:
- shares the effective prompt context with early requirements inspection;
- runs Scriptorium bounds artifact generation;
- optionally runs render-debug output generation;
- validates bounds payload against transcript;
@@ -32,6 +33,12 @@ When `trim.enabled=false`:
- normalized transcript is required input.
- bounds output exists only in enabled trim path.
- render-debug output is diagnostic and not a declared stage output.
- prepared preview and generated bounds use separate result destinations;
Scriptorium stderr and invocation records are the diagnostic references.
The application checks projected bounds requirements before attempting any
stage. See [preflight internals](preflight.md); actual transcript resolution and
bounds validation remain responsibilities of this stage.
## Resume Semantics