Files
narratio/docs/integrations/scriptorium.md

54 lines
3.2 KiB
Markdown

# Integration: Scriptorium
## Boundary
Narratio uses the independently installed Scriptorium v0.16.0 native CLI for
trim bounds and configured analysis artifacts. It invokes `run PROMPT_ID` for
generation, `promptkit show prepared PROMPT_ID` for optional preview, and
`promptkit requirements show PROMPT_ID` for early discovery. Scriptorium owns
prompt, profile, backend, and private configuration resolution. The
[upstream CLI migration guide](https://forge.maximumdirect.net/eric/scriptorium/src/tag/v0.16.0/docs/consumers/upgrading-cli.md)
and [subprocess contract](https://forge.maximumdirect.net/eric/scriptorium/src/tag/v0.16.0/docs/integrations/subprocess.md)
own the native interface and deployment migration.
Generation selects artifact-only text output. Preview and requirements use
native JSON. Narratio forwards selected configuration and profile identifiers,
sorted repeated `--input-file NAME=PATH` bindings where files are needed, and
repeated `--var KEY=VALUE` assignments. Commas and later equals signs remain
literal. Discovery supplies no input paths and makes no model call. Narratio's
supervisor deadline covers each invocation; generation also forwards the same
duration as `--run-timeout`, separate from Scriptorium's per-attempt timeout.
## Streams And Outcomes
Narratio captures stdout directly into the run-local artifact or preview, or
into memory for discovery. Result bytes are preserved and limited to 64 MiB;
they are not diagnostic logs and are not redacted. Treat generated artifacts
and prepared previews as potentially sensitive. Stderr remains separately
bounded and redacted. A capture failure aborts the supervised subprocess.
A successful generation or preview must produce a nonempty result; preview must
also be valid JSON. Narratio validates the result before stage-owned canonical
promotion. A nonzero outcome or delivery failure remains an error even if
stdout contains bytes. Native exit status 4 identifies completed generated
content validation failure; status 2 is a usage or configuration failure.
Invocation records describe the actual arguments and stdout destination.
Requirements discovery returns the native inventories, identities,
completeness, and structured issues. A successful partial report is distinct
from a process or decoding failure. Narratio compares the reported requirements
with its intended bindings; discovery does not establish future file availability
or guarantee a later model call. See [preflight internals](../internal/preflight.md)
and the [upstream requirements contract](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/docs/cli.md#promptkit-requirements).
## Credentials And Configuration
Selected ConfigKit secret references are forwarded by exact environment name
for discovery, preview, and generation. Their captured values are registered
for stderr diagnostic redaction, while invocation records retain names only.
Narratio does not choose the provider or pass a direct API-key override. This
does not scrub arbitrary result content or files written by Scriptorium. See
[Scriptorium credentials](../config.md#scriptorium-credentials) and
[artifact entries](../config.md#scriptorium-artifact-entries) for Narratio's
configuration and binding semantics.