243 Commits

Author SHA1 Message Date
55a4c49a31 Remove completed planning documents
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-11-27 23:51:37 +00:00
89f5a6a0ad Validate Audita report bounds with constant memory 2026-11-27 21:21:22 +00:00
aa0c1f1c03 Match prepared inputs with a linear record index 2026-11-27 21:19:12 +00:00
eb5e912fa3 Preserve native null aliases in prepared glossaries 2026-11-27 21:18:00 +00:00
447888e062 Reject selected catalog entries without source paths 2026-11-27 21:16:27 +00:00
d4036eea47 Record algorithmic review findings 2026-11-27 18:17:25 +00:00
54ba768a28 Record shared glossary adoption review findings 2026-11-27 18:02:48 +00:00
4f27331636 Verify shared glossary workflows and recovery 2026-11-27 17:14:44 +00:00
0de73ba25f Document shared glossaries and downstream preflight 2026-11-27 17:09:21 +00:00
8b9c0e664b Verify catalog and Audita compatibility offline 2026-11-27 17:04:49 +00:00
cfcb55e28c Update examples and tests for shared glossaries 2026-11-27 17:00:16 +00:00
410a4109ad Validate sessions with prepared downstream inputs 2026-11-27 16:48:38 +00:00
d178e2c437 Run downstream preflight after preparation 2026-11-27 16:45:46 +00:00
b9b154e59e Select and check downstream preflight targets 2026-11-27 16:41:09 +00:00
2db2554d1e Add native Audita preflight 2026-11-27 16:39:43 +00:00
5bafae048e Use prepared glossaries for transcript polishing 2026-11-27 16:38:10 +00:00
16e28b25a2 Adopt Audita native processing arguments 2026-11-27 16:34:15 +00:00
5da7db2b27 Publish and restore prepared glossary documents 2026-11-27 16:31:20 +00:00
0ce7568103 Make preparation reuse aware of glossary contents 2026-11-27 16:28:39 +00:00
28d149f7ed Prepare shared glossary documents 2026-11-27 16:26:22 +00:00
1bb1daa1f2 Register prepared glossary input identities 2026-11-27 16:24:08 +00:00
caddd668ca Resolve and project shared glossary collections 2026-11-27 16:22:10 +00:00
1cc37ef980 Add campaign and session glossary selections 2026-11-27 16:19:11 +00:00
5d44b41e74 Add reference catalog selection to pipeline configuration 2026-11-27 16:12:16 +00:00
66b7674e43 Add shared glossary validation 2026-11-27 16:10:23 +00:00
a6c1bceb26 Record the reference catalog foundation 2026-11-27 16:08:10 +00:00
6e6d64c289 Record CC0 license decision for reference catalog 2026-11-27 16:05:53 +00:00
bf86acd0a4 Plan Audita and shared glossary adoption 2026-11-27 16:04:05 +00:00
4f68fb27d9 Clarify empty glossaries and validation after composition 2026-11-27 15:14:05 +00:00
9400eb20da Specify glossary authoring precedence and shared input cutover 2026-11-27 15:08:38 +00:00
6fe5afcca4 Run downstream preflight after input preparation 2026-11-27 15:04:58 +00:00
95aac6367f Define shared glossary inputs and canonical schema ownership 2026-11-27 14:58:02 +00:00
f2cc45ea26 Define reference catalog distribution and development workflow 2026-11-27 14:26:25 +00:00
fa22c89622 Record Audita glossary preparation and full preflight decisions 2026-11-27 14:09:11 +00:00
9029dc4d7d Update Audita adoption roadmap for version 4.2 2026-11-27 04:48:10 +00:00
3b1718c44f Retarget Audita adoption roadmap to version 4.1 2026-11-26 14:25:43 +00:00
c9828b220e Remove completed Scriptorium roadmaps and audit record 2026-11-26 13:53:28 +00:00
0a43b67847 Avoid unnecessary reads when validating Scriptorium outputs 2026-11-26 13:51:06 +00:00
72eb597a72 Record Scriptorium result validation efficiency opportunity 2026-11-26 05:05:42 +00:00
f930ebf337 Document Scriptorium preflight and native integration 2026-11-26 04:40:25 +00:00
e9d57fb7aa Verify native Scriptorium workflows and retry behavior 2026-11-26 04:34:47 +00:00
d48215678a Include prompt requirements in session validation 2026-11-26 04:29:18 +00:00
150a59a928 Check prompt requirements before stage attempts 2026-11-26 04:25:47 +00:00
0cee77887d Assess prompt requirements against intended bindings 2026-11-26 04:22:45 +00:00
2c9668683a Build shared prompt inspection targets 2026-11-26 04:21:24 +00:00
3e7200ef28 Share read-only planning and analysis closure 2026-11-26 04:19:33 +00:00
f1fb77baa0 Share effective Scriptorium request context 2026-11-26 04:17:03 +00:00
de325006de Add Scriptorium prompt requirements inspection 2026-11-26 04:13:51 +00:00
b790cc73ca Use native prepared previews and correct diagnostic references 2026-11-26 04:08:40 +00:00
fcd7cffd18 Use native Scriptorium generation and capture its output 2026-11-26 04:05:35 +00:00
a9705a6b56 Capture subprocess results separately from diagnostics 2026-11-26 04:02:51 +00:00
bb84094385 Plan Scriptorium adoption and shared preflight checks 2026-11-26 03:20:19 +00:00
b9d56b8923 Plan shared preflight checks and retain inspection failures 2026-11-26 02:40:53 +00:00
e586e8c733 Clarify Scriptorium preflight policies and request context 2026-11-26 02:31:57 +00:00
1d1dfdf1ed Document Scriptorium adoption and prompt preflight roadmap 2026-11-26 01:56:54 +00:00
9fa179736b Remove completed roadmap documents
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-11-23 19:13:10 +00:00
e7b266f908 Allow literal environment values in workflow tests 2026-11-23 19:00:34 +00:00
b266031d56 Record ReleaseKit workflow test remediation 2026-11-23 18:38:14 +00:00
c893e1086a Complete ReleaseKit integration verification 2026-11-23 18:22:35 +00:00
3185795b4b Format imports with the release toolchain 2026-11-23 18:18:38 +00:00
c2c3232d8f Document the native ReleaseKit workflow 2026-11-23 18:16:15 +00:00
b031d35af7 Remove superseded release scripts and tests 2026-11-23 18:15:10 +00:00
ef4335cda3 Test ReleaseKit integration selections 2026-11-23 18:14:46 +00:00
8e5511b112 Use ReleaseKit for tag delivery 2026-11-23 18:13:42 +00:00
7ab594bc8b Add ReleaseKit profile and launcher 2026-11-23 18:13:25 +00:00
5776733ebd Adopt ReleaseKit runtime version and tool 2026-11-23 18:12:57 +00:00
aef88a9602 Plan native ReleaseKit adoption 2026-11-23 17:56:28 +00:00
0d0596b204 Document native ReleaseKit adoption 2026-11-23 17:48:29 +00:00
abaa3c78df Make the pure loader regression test detect bootstrap
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-11-23 17:24:16 +00:00
7f7033779c Simplify configuration acquisition and comparison guidance 2026-11-23 16:33:51 +00:00
bb15edc057 Record configured startup review finding 2026-11-23 16:33:48 +00:00
f04b6097b8 Complete configured startup integration review 2026-11-23 14:34:27 +00:00
c5970ff834 Align operator guidance with configured secrets startup 2026-11-23 14:31:49 +00:00
6026933b24 Update configuration and CLI startup documentation 2026-11-23 14:30:39 +00:00
43a7d398b6 Verify independent comparison startup 2026-11-23 14:29:39 +00:00
716869d553 Verify configured pipeline secrets startup 2026-11-23 14:28:02 +00:00
457b5a3976 Report configured bootstrap evidence at invocation completion 2026-11-23 14:25:50 +00:00
6175945230 Remove the secrets directory flag and update fixtures 2026-11-23 14:23:53 +00:00
a4491a8517 Prepare pipeline sources during acquisition 2026-11-23 14:19:21 +00:00
af3f49b644 Share native pipeline source selection and loading 2026-11-23 14:17:49 +00:00
14f33dde04 Update coordinated configuration dependencies 2026-11-23 14:16:51 +00:00
9fb0c6a994 Plan native configuration acquisition migration 2026-11-23 02:35:17 +00:00
b63bef2d43 Simplify configuration comparison acquisition 2026-11-23 02:29:19 +00:00
1d5dc370e8 Simplify the configuration adoption roadmap 2026-11-23 02:19:14 +00:00
c6214f6259 Adopt upstream dependency documentation guidance 2026-11-23 02:05:17 +00:00
04483a68e8 Plan upstream documentation deduplication 2026-11-23 01:03:24 +00:00
b1ef8e20b6 Include coordinated CommandKit upgrades in the ConfigKit roadmap 2026-11-23 01:02:15 +00:00
1701f0461f Document native ConfigKit startup adoption 2026-11-23 00:49:14 +00:00
b47cb35966 Remove completed CommandKit roadmap documents
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-11-20 15:29:55 +00:00
39b4bddbc9 Use native configuration validation and diagnostics 2026-11-20 15:22:57 +00:00
7e45ffca43 Classify invalid artifact relations as input errors 2026-11-20 13:48:55 +00:00
672b7f0ebd Use canonical source identities in publication reports 2026-11-20 13:45:17 +00:00
f44078724a Build publication report indexes once 2026-11-20 13:44:09 +00:00
af6cf8b6f1 Look up family identities without copying catalogs 2026-11-20 13:43:18 +00:00
7e65c29a61 Share provenance snapshots during catalog derivation 2026-11-20 13:42:11 +00:00
846f8470dc Keep source provenance out of prepare reuse decisions 2026-11-20 13:40:55 +00:00
32ff928786 Clarify optional spell catalog clearing 2026-11-20 13:39:20 +00:00
25c59ff62f Preserve campaign defaults in materialized sessions 2026-11-20 13:38:21 +00:00
38866110a7 Record CommandKit algorithm audit findings 2026-11-20 13:12:32 +00:00
65d24fb88f Record the party selection resume integration gap 2026-11-20 13:02:23 +00:00
8be65fd3a1 Record CommandKit migration review findings 2026-11-20 12:54:56 +00:00
0117f3f35d Verify native workflows and explain identity mismatches 2026-11-20 06:50:56 +00:00
0e9cbc9c2a Document the native CLI and migration workflows 2026-11-20 06:41:59 +00:00
faa8cb5822 Finish native completion and retire legacy command machinery 2026-11-20 06:32:47 +00:00
7db626781e Report audio, speaker, and artifact work progress 2026-11-20 06:04:34 +00:00
c523def852 Route console diagnostics and stage progress through native reporting 2026-11-20 05:59:09 +00:00
c7a5ff316d Propagate cancellation and preserve resumable state 2026-11-20 05:53:49 +00:00
a6c6f1e4ab Preserve partial run results and terminal failure causes 2026-11-20 05:47:41 +00:00
85df36a770 Add native restore and session cleanup commands 2026-11-20 05:41:16 +00:00
6b7a0847d4 Add native session initialization and remote lock commands 2026-11-20 05:29:27 +00:00
e44247b5b1 Report structured session validation and inspection results 2026-11-20 05:23:32 +00:00
97cced5d88 Expose native session planning and artifact catalogs 2026-11-20 05:15:43 +00:00
0238f82847 Install native run and artifact regeneration commands 2026-11-20 05:10:04 +00:00
ed29bdc473 Support independent native configuration comparisons and overrides 2026-11-20 05:06:26 +00:00
c3c6849bed Expose native configuration inspection scopes 2026-11-20 05:02:46 +00:00
1e67c429b7 Share lazy configuration and session acquisition 2026-11-20 04:54:12 +00:00
b537cb38ae Preserve derived publication and preparation evidence 2026-11-20 04:49:29 +00:00
065a615e5f Use derived artifact catalogs throughout planning and execution 2026-11-20 04:42:23 +00:00
6900cad104 Derive artifact catalogs from the selected party without changing configuration 2026-11-20 04:33:02 +00:00
c3e6245416 Complete session defaults within the ConfigKit lifecycle 2026-11-20 04:24:20 +00:00
16a4f7ee12 Retain authoritative pipeline and campaign load results 2026-11-20 04:17:29 +00:00
a3c58141a0 Adopt the native CommandKit application boundary 2026-11-20 04:13:05 +00:00
86692d58f9 Plan the CommandKit adoption sprint 2026-11-20 04:05:11 +00:00
bcbfc0fa4a Clarify progress and verbose reporting in the CommandKit roadmap 2026-11-20 03:46:30 +00:00
e476c08ea4 Consolidate the CommandKit adoption roadmap 2026-11-20 02:17:59 +00:00
8824ce330f Defer execution overrides to a reusable CommandKit binding 2026-11-20 01:17:56 +00:00
87142508e3 Record artifacts command family and pending override binding 2026-11-20 01:09:33 +00:00
7cc877ea7f Align configuration ownership policy with ADR 0003
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-11-20 00:46:06 +00:00
7ee362f1c3 Clarify configuration ownership and native inspection boundaries 2026-11-20 00:16:42 +00:00
084e6d178b Simplify CommandKit overrides and add party file selection 2026-11-19 18:53:26 +00:00
86ec48d2e4 Record delivery decisions and end-to-end sprint guidance 2026-11-19 18:16:43 +00:00
3868822277 Record diagnostics and invocation lifecycle decisions 2026-11-19 18:09:17 +00:00
d83c5f0062 Record agreed CommandKit reporting decisions 2026-11-19 17:50:25 +00:00
981eb6be8f Record native configuration override decisions 2026-11-19 16:24:52 +00:00
6b027873a5 Record session acquisition and selector decisions 2026-11-19 16:15:25 +00:00
d00cc8037d Record agreed configuration scopes and inspection views 2026-11-19 16:12:21 +00:00
b4b618a913 Record agreed CommandKit command organization 2026-11-19 16:01:02 +00:00
8ba001750e Record CommandKit migration direction and open decisions 2026-11-19 15:54:26 +00:00
fa9ed78a6d Remove completed ConfigKit planning documents
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-11-18 14:33:12 +00:00
4dae8e0d36 Stream verified prepared inputs into publication archives 2026-11-18 04:17:37 +00:00
35eaefd05d Read selected remote sessions directly without listing run history 2026-11-18 04:12:56 +00:00
f85f93bdfb Reuse party provenance within each inspection 2026-11-18 04:10:29 +00:00
0e34ea1d48 Reuse native source records and catalog source indexes 2026-11-18 04:09:24 +00:00
97a93d3393 Honor remote session authoring updates after publication 2026-11-18 04:08:43 +00:00
435ec79185 Initialize standalone sessions from native local authoring context 2026-11-18 04:06:29 +00:00
33d2ebf44c Pin Go attribution to the released source commit 2026-11-18 04:03:40 +00:00
e93fb8d5ab Record publish defaults and destinations at field level 2026-11-18 04:03:33 +00:00
69dc5cc8ec Make restore lock contention coverage independent of startup timing 2026-11-18 04:02:30 +00:00
5d62f9a88b Report effective resource contributors without superseded definitions 2026-11-18 03:59:09 +00:00
ba9079ee74 Record algorithmic refactoring opportunities 2026-11-18 01:10:44 +00:00
583c5bdf1b Record configuration integration audit findings 2026-11-18 00:30:09 +00:00
bccf03a99f Record ConfigKit migration review findings 2026-11-17 23:57:45 +00:00
39a958675d Verify native configuration workflows end to end 2026-11-17 22:49:22 +00:00
413b0d7134 Align configuration documentation with native loading 2026-11-17 22:42:53 +00:00
ff4bdaa483 Demonstrate native configuration authoring 2026-11-17 22:38:51 +00:00
ebcc5b32a0 Use native configuration diff and source evidence 2026-11-17 22:35:56 +00:00
ce661252d0 Render final configuration through native snapshots 2026-11-17 22:31:03 +00:00
ed7e722077 Publish and restore prepared session documents 2026-11-17 22:27:24 +00:00
bcfca7a044 Materialize effective campaign and session inputs 2026-11-17 22:21:55 +00:00
05f5607968 Render imported party rosters as canonical inputs 2026-11-17 22:18:57 +00:00
1657c9f65d Load campaign and session imports from their sources 2026-11-17 22:15:05 +00:00
c3023cb609 Resolve pipeline resources from their source locations 2026-11-17 22:09:58 +00:00
6593ccbeaf Use native pipeline discovery and independent secrets bootstrap 2026-11-17 22:06:29 +00:00
341fe93e3b Adopt ConfigKit and Go toolchain baseline 2026-11-17 21:59:19 +00:00
65d0e518e5 Plan the native ConfigKit migration 2026-11-17 20:41:34 +00:00
4a0e3c83db Record the agreed ConfigKit adoption decisions 2026-11-17 20:27:47 +00:00
f5451a0cf5 Outline native ConfigKit adoption and configuration ergonomics 2026-11-17 20:23:22 +00:00
381668568f Adopt the updated standard repository policies 2026-11-17 19:56:32 +00:00
8afb49c018 Record the ConfigKit configuration ownership boundary 2026-10-05 14:03:51 +00:00
535f47ef20 Cover inherited Notarius path resolution 2026-10-04 15:35:45 +00:00
dcb9bae215 Verify inherited configuration inspection commands 2026-10-04 15:33:16 +00:00
f1f71d8cdf Document native configuration inheritance 2026-10-04 15:25:48 +00:00
39af6ef941 Verify inherited credential safety 2026-10-04 14:41:34 +00:00
e1c934a492 Assert credential-safe projections survive rotation 2026-10-04 14:02:43 +00:00
dd760d84e0 Compare inherited effective pipeline values 2026-10-04 14:00:55 +00:00
6db49b3949 Verify inherited configuration semantics 2026-10-04 13:49:42 +00:00
f1672f6f95 Preserve composite ConfigKit provenance 2026-10-04 13:34:27 +00:00
428f435734 Accept composed ConfigKit artifact definitions 2026-10-04 13:10:53 +00:00
c4abdc19df Upgrade ConfigKit to v0.5.0 2026-10-04 12:53:29 +00:00
08327c2e63 Add documentation style guidance to the plan 2026-10-04 12:49:08 +00:00
2850498043 Simplify the ConfigKit adoption plan 2026-10-04 12:42:58 +00:00
fe9817f354 Plan the ConfigKit upgrade and workspace development 2026-10-04 12:28:09 +00:00
40cbf42438 Document Narratio v3.1.0 release
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
ci/woodpecker/tag/release Pipeline was successful
2026-09-29 18:02:18 +00:00
44a318694b Forward Scriptorium credentials through the shared adapter path 2026-09-29 17:50:30 +00:00
9389f69eb0 Report missing Scriptorium credential forwarding 2026-09-29 17:40:35 +00:00
d53a64650b Document Narratio v3.0.0 migration and release
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
ci/woodpecker/tag/release Pipeline was successful
2026-09-28 03:21:06 +00:00
e349bf03ca Document shared downstream development overlay workflow 2026-09-28 03:18:14 +00:00
23c4686b84 Retire completed roadmaps and retain deferred Audita work 2026-09-28 03:12:58 +00:00
4c114b6319 Adopt Notarius configuration overlays 2026-09-28 03:09:55 +00:00
3de5f9378d Update ConfigKit to v0.4.2 2026-09-28 02:42:39 +00:00
ee9a786677 Restore the verbatim BSD license reference 2026-09-28 02:27:41 +00:00
debef98536 Preserve upstream policy wording in link examples 2026-09-28 02:27:30 +00:00
e08f083ec8 Check release validation counts without requiring order 2026-09-28 02:26:45 +00:00
9bbec2fe79 Complete policy alignment roadmap audit 2026-09-28 01:54:44 +00:00
77201baddf Remove redundant CI documentation and example checks 2026-09-28 01:51:50 +00:00
ce91f04974 Align release publication policy and runbook 2026-09-28 01:50:26 +00:00
65502ce5b4 Simplify release candidate validation 2026-09-28 01:47:20 +00:00
3695303100 Complete AWS attribution and licensing navigation 2026-09-28 01:43:11 +00:00
95e865495c Attribute core modules and release Go runtime material 2026-09-28 01:38:54 +00:00
6547a8abd3 Adopt standard policy guidance and document provenance 2026-09-28 01:33:03 +00:00
b24c9a8fdf Plan policy alignment and release workflow updates 2026-09-28 01:16:40 +00:00
a5a252ab30 Expand roadmap to align the full policy set 2026-09-28 01:13:10 +00:00
2237a902b6 Adopt ConfigKit licensing update and clarify policy sources 2026-09-26 22:01:37 +00:00
f060d7eb1f Document licensing policy alignment roadmap 2026-09-26 20:45:59 +00:00
2e92f2f200 Fix license name typos in COPYRIGHT 2026-09-26 20:38:50 +00:00
7f90c70c30 Update COPYRIGHT and LICENSE contents to align with the house standard
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-09-26 15:05:03 -05:00
b750c42ad6 Remove legacy manifest provenance decoding
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
2026-09-25 19:45:19 +00:00
73c4986f3d Preserve Audita module selections in YAML output 2026-09-25 19:42:22 +00:00
e5c06019b3 Record migration review findings 2026-09-25 18:28:38 +00:00
fae18bf4a7 Verify shared provider credentials across both adapters 2026-09-25 16:06:02 +00:00
e5c1029165 Document Audita v2 operator migration and examples 2026-09-25 16:00:27 +00:00
2d167d0d67 Track Audita v2 selections in polish resume evidence 2026-09-25 15:55:38 +00:00
569f467393 Archive Audita reports as polish diagnostics 2026-09-25 15:51:18 +00:00
77d9d57937 Adopt Audita v2 configuration and subprocess contract 2026-09-25 15:45:02 +00:00
7e0151ef93 Migrate Notarius to credential lists 2026-09-25 15:33:46 +00:00
49948852d6 Add shared resolved credential forwarding 2026-09-25 15:26:51 +00:00
83eaa960ec Adopt ConfigKit overlays for pipeline selection 2026-09-25 15:24:03 +00:00
e27c49e946 Track repository agent instructions 2026-09-25 15:11:56 +00:00
625e6edfd7 Align repository policies with shared standards 2026-09-25 15:11:08 +00:00
17cef0700a Add ConfigKit overlay migration to the plan 2026-09-25 15:04:55 +00:00
55c102c9ed Plan the Audita v2 migration 2026-09-25 14:50:25 +00:00
70f1dbfb59 Prepare the v2.2.1 release
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
ci/woodpecker/tag/release Pipeline was successful
2026-09-22 18:18:45 +00:00
f1575effc2 Document shared checkpoint persistence 2026-09-22 15:13:46 +00:00
7e39a1d51f Delegate transcription checkpoints to shared persistence 2026-09-22 15:12:11 +00:00
3722e572df Delegate analyze checkpoints to shared persistence 2026-09-22 15:09:29 +00:00
7147e95252 Add shared stage checkpoint persistence 2026-09-22 15:05:25 +00:00
9f2cfddce6 Plan shared stage checkpoint mechanics 2026-09-22 14:54:34 +00:00
792cbd0677 Prepare the v2.2.0 release
All checks were successful
ci/woodpecker/push/verify Pipeline was successful
ci/woodpecker/tag/release Pipeline was successful
2026-09-22 01:50:49 +00:00
5dca34e0e0 Allow checkpoints for empty audio accepted by WhisperX 2026-09-22 00:53:28 +00:00
54d335c820 Repair stale transcription outputs when resuming 2026-09-22 00:50:51 +00:00
96b4e73f53 Document resumable transcription and replay 2026-09-22 00:31:32 +00:00
6e6054f744 Verify WhisperX transport replay 2026-09-22 00:22:48 +00:00
dc3288d15a Make WhisperX uploads replayable 2026-09-22 00:15:48 +00:00
d872edca94 Integrate transcription checkpoints across lifecycle 2026-09-22 00:00:51 +00:00
2ae63dbc2b Checkpoint speaker transcriptions incrementally 2026-09-21 16:20:53 +00:00
26aa0cce29 Reconcile reusable speaker transcriptions 2026-09-21 16:09:45 +00:00
7b0bf99ed1 Add durable speaker transcription state 2026-09-21 16:01:19 +00:00
89ada1b269 Plan resumable transcription and replayable uploads 2026-09-21 15:50:48 +00:00
3438fe82c9 Document Notarius configuration profiles 2026-09-21 15:16:11 +00:00
a51a513804 Verify Notarius profile lifecycle behavior 2026-09-21 15:11:19 +00:00
995354f1a5 Track Notarius profiles in extraction reuse 2026-09-21 15:07:36 +00:00
931c9591cd Add Notarius configuration profile support 2026-09-21 15:03:29 +00:00
46096fc4ba Plan Notarius configuration profile support 2026-09-21 14:54:47 +00:00
416 changed files with 28377 additions and 13634 deletions

3
.gitignore vendored
View File

@@ -1,6 +1,5 @@
# ---> Codex # ---> Codex
.codex .codex
AGENTS.md
.DS_Store .DS_Store
@@ -26,6 +25,7 @@ AGENTS.md
# Go cache # Go cache
.gocache .gocache
/dist/
# Go workspace file # Go workspace file
go.work go.work
@@ -52,4 +52,3 @@ pipeline.yml
# Built Visual Studio Code Extensions # Built Visual Studio Code Extensions
*.vsix *.vsix

View File

@@ -1,39 +1,56 @@
# Adapted from ReleaseKit v0.10.0 tag-delivery.yml.
matrix:
include:
- GO_IMAGE: golang:1.27.4-bookworm
when: when:
- event: tag - event: tag
ref: refs/tags/v*
steps: steps:
validate-release: - name: deliver
image: golang:1.26.7 image: ${GO_IMAGE}
commands: environment:
- ./scripts/check-release-candidate.sh "$CI_COMMIT_TAG" RELEASEKIT_GITEA_TOKEN:
from_secret: GITEA_RELEASE_TOKEN
build-release-assets:
image: golang:1.26.7
depends_on:
- validate-release
commands: commands:
- | - |
set -eu set -eu
case "$PWD" in test -n "$${CI_COMMIT_TAG}"
/*) ;; test -n "$${CI_COMMIT_SHA}"
*) echo "release workspace must have an absolute path" >&2; exit 1 ;; git check-ref-format "refs/tags/$${CI_COMMIT_TAG}"
esac git fetch origin "refs/tags/$${CI_COMMIT_TAG}:refs/tags/$${CI_COMMIT_TAG}"
./scripts/build-release-assets.sh "$CI_COMMIT_TAG" "$PWD/dist" tag_commit=$(git rev-parse --verify "refs/tags/$${CI_COMMIT_TAG}^{commit}")
expected_commit=$(git rev-parse --verify "$${CI_COMMIT_SHA}^{commit}")
if [ "$${tag_commit}" != "$${expected_commit}" ]; then
printf 'Tag %s resolves to commit %s; event %s resolves to commit %s\n' \
"$${CI_COMMIT_TAG}" "$${tag_commit}" "$${CI_COMMIT_SHA}" "$${expected_commit}" >&2
exit 1
fi
git checkout --detach "$${tag_commit}"
test "$(git rev-parse HEAD | tr '[:upper:]' '[:lower:]')" = "$${expected_commit}"
test -z "$(git status --porcelain --untracked-files=all)"
publish-release: bootstrap_dir=$(mktemp -d "$${CI_WORKSPACE%/*}/.releasekit-bootstrap.XXXXXX")
image: woodpeckerci/plugin-release:0.3.1 trap 'rm -rf "$${bootstrap_dir}"' EXIT
depends_on: cp go.mod "$${bootstrap_dir}/releasekit.mod"
- build-release-assets if [ -f go.sum ]; then
settings: cp go.sum "$${bootstrap_dir}/releasekit.sum"
api_key: else
from_secret: GITEA_RELEASE_TOKEN : > "$${bootstrap_dir}/releasekit.sum"
files: fi
- dist/narratio-*
title: Narratio ${CI_COMMIT_TAG} export GOWORK=off
note: docs/releases/${CI_COMMIT_TAG}.md export GOTOOLCHAIN=local
checksum: sha256 releasekit_host_os=$(go env GOHOSTOS) || exit $?
checksum-file: SHA256SUMS releasekit_host_arch=$(go env GOHOSTARCH) || exit $?
checksum-flatten: true export GOOS="$${releasekit_host_os}" GOARCH="$${releasekit_host_arch}"
file-exists: skip releasekit_module=go.maximumdirect.net/releasekit
overwrite: false go list -mod=mod -modfile="$${bootstrap_dir}/releasekit.mod" -m "$${releasekit_module}"
prerelease: false go mod edit -modfile="$${bootstrap_dir}/releasekit.mod" -tool="$${releasekit_module}/cmd/releasekit"
go list -mod=mod -modfile="$${bootstrap_dir}/releasekit.mod" -deps "$${releasekit_module}/cmd/releasekit" > /dev/null
go tool -modfile="$${bootstrap_dir}/releasekit.mod" "$${releasekit_module}/cmd/releasekit" ci-deliver \
--repo "$${CI_WORKSPACE}" \
--prepared \
--commit "$${expected_commit}" \
"$${CI_COMMIT_TAG}"

View File

@@ -3,6 +3,6 @@ when:
steps: steps:
shuffled-race-tests: shuffled-race-tests:
image: golang:1.26 image: golang:1.27.4
commands: commands:
- go test -race -shuffle=on -count=3 ./... - go test -race -shuffle=on -count=3 ./...

View File

@@ -3,38 +3,31 @@ when:
steps: steps:
tests: tests:
image: golang:1.26 image: golang:1.27.4
commands: commands:
- go test ./... - go test ./...
race-tests: race-tests:
image: golang:1.26 image: golang:1.27.4
depends_on: tests depends_on: tests
commands: commands:
- go test -race ./... - go test -race ./...
static-analysis: static-analysis:
image: golang:1.26 image: golang:1.27.4
depends_on: tests depends_on: tests
commands: commands:
- go vet ./... - go vet ./...
build: build:
image: golang:1.26 image: golang:1.27.4
depends_on: tests depends_on: tests
commands: commands:
- go build ./... - go build ./...
documentation-and-examples:
image: golang:1.26
depends_on: tests
commands:
- go test ./internal/doccheck
- go test ./internal/config -run '^TestExamplesLoadAndValidate$'
cross-build: cross-build:
image: golang:1.26 image: golang:1.27.4
depends_on: [race-tests, static-analysis, build, documentation-and-examples] depends_on: [race-tests, static-analysis, build]
commands: commands:
- | - |
set -eu set -eu

30
AGENTS.md Normal file
View File

@@ -0,0 +1,30 @@
Start with `docs/development.md` for orientation and use its policy reading guide
to select the policies applicable to the task. Do not read the entire suite by
default.
Read and follow `docs/policy/agents.md` before recommending, planning, or
implementing repository changes.
<!-- codebase-memory-mcp:start -->
# Codebase Knowledge Graph (codebase-memory-mcp)
This project uses codebase-memory-mcp to maintain a knowledge graph of the codebase.
ALWAYS prefer MCP graph tools over grep/glob/file-search for code discovery.
## Priority Order
1. `search_graph` — find functions, classes, routes, variables by pattern
2. `trace_path` — trace who calls a function or what it calls
3. `get_code_snippet` — read specific function/class source code
4. `query_graph` — run Cypher queries for complex patterns
5. `get_architecture` — high-level project summary
## When to fall back to grep/glob
- Searching for string literals, error messages, config values
- Searching non-code files (Dockerfiles, shell scripts, configs)
- When MCP tools return insufficient results
## Examples
- Find a handler: `search_graph(name_pattern=".*OrderHandler.*")`
- Who calls it: `trace_path(function_name="OrderHandler", direction="inbound")`
- Read source: `get_code_snippet(qualified_name="pkg/orders.OrderHandler")`
<!-- codebase-memory-mcp:end -->

23
COPYRIGHT Normal file
View File

@@ -0,0 +1,23 @@
Narratio
Copyright (C) 2026 Eric Rakestraw
SPDX-License-Identifier: GPL-3.0-or-later
Narratio is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
The GNU General Public License version 3 is provided in LICENSE.
Narratio is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
Third-party code and assets are subject to their respective license terms.
Policy documents adapted from Standard Repository Policies remain licensed
under CC-BY-SA-4.0. See docs/oss/attribution.md for the affected material,
upstream credit, and license links.

892
LICENSE
View File

@@ -1,232 +1,674 @@
GNU GENERAL PUBLIC LICENSE GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007 Version 3, 29 June 2007
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/> Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.
Preamble Preamble
The GNU General Public License is a free, copyleft license for software and other kinds of works. The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
The licenses for most software and other practical works are designed
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. your programs, too.
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
The precise terms and conditions for copying, distribution and modification follow.
To protect your rights, we need to prevent others from denying you
TERMS AND CONDITIONS these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
0. Definitions. you modify it: responsibilities to respect the freedom of others.
“This License” refers to version 3 of the GNU General Public License. For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations. know their rights.
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work. Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
A “covered work” means either the unmodified Program or a work based on the Program. giving you legal permission to copy, distribute and/or modify it.
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. authors of previous versions.
1. Source Code. Some devices are designed to deny users access to install or run
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work. modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. of the GPL, as needed to protect the freedom of users.
The Corresponding Source for a work in source code form is that same work. Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
2. Basic Permissions. software on general-purpose computers, but in those that do, we wish to
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. patents cannot be used to render the program non-free.
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. The precise terms and conditions for copying, distribution and
modification follow.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. TERMS AND CONDITIONS
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 0. Definitions.
4. Conveying Verbatim Copies. "This License" refers to version 3 of the GNU General Public License.
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
"Copyright" also means copyright-like laws that apply to other kinds of
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. works, such as semiconductor masks.
5. Conveying Modified Source Versions. "The Program" refers to any copyrightable work licensed under this
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
To "modify" a work means to copy from or adapt all or part of the work
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”. in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. earlier work or a work "based on" the earlier work.
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A "covered work" means either the unmodified Program or a work based
on the Program.
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
To "propagate" a work means to do anything with it that, without
6. Conveying Non-Source Forms. permission, would make you directly or secondarily liable for
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. distribution (with or without modification), making available to the
public, and in some countries other activities as well.
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
To "convey" a work means any kind of propagation that enables other
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
An interactive user interface displays "Appropriate Legal Notices"
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. menu, a prominent item in the list meets this criterion.
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). 1. Source Code.
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. form of a work.
7. Additional Terms. A "Standard Interface" means an interface that either is an official
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. is widely used among developers working in that language.
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or "Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or (if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
The "Corresponding Source" for a work in object code form means all
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
8. Termination. linked subprograms that the work is specifically designed to require,
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). such as by intimate data communication or control flow between those
subprograms and other parts of the work.
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
The Corresponding Source need not include anything that users
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. can regenerate automatically from other parts of the Corresponding
Source.
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
The Corresponding Source for a work in source code form is that
9. Acceptance Not Required for Having Copies. same work.
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
2. Basic Permissions.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
11. Patents. rights of fair use or other equivalent, as provided by copyright law.
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
You may make, run and propagate covered works that you do not
A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. your copyrighted material outside their relationship with you.
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. makes it unnecessary.
12. No Surrender of Others' Freedom. 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
No covered work shall be deemed part of an effective technological
13. Use with the GNU Affero General Public License. measure under any applicable law fulfilling obligations under article
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
14. Revised Versions of this License. measures.
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
When you convey a covered work, you waive any legal power to forbid
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. users, your or third parties' legal rights to forbid circumvention of
technological measures.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 4. Conveying Verbatim Copies.
16. Limitation of Liability. You may convey verbatim copies of the Program's source code as you
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
17. Interpretation of Sections 15 and 16. keep intact all notices stating that this License and any
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
END OF TERMS AND CONDITIONS recipients a copy of this License along with the Program.
How to Apply These Terms to Your New Programs You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
5. Conveying Modified Source Versions.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
You may convey a work based on the Program, or the modifications to
narratio produce it from the Program, in the form of source code under the
Copyright (C) 2026 eric terms of section 4, provided that you also meet all of these conditions:
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
b) The work must carry prominent notices stating that it is
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>. released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail. Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
narratio Copyright (C) 2026 eric <program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”. The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>. You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/philosophy/why-not-lgpl.html>. The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@@ -5,7 +5,8 @@ polished transcripts, validated Notarius extraction lanes, and generated
artifacts. artifacts.
It runs a deterministic workflow with manifest-driven continuation, remote It runs a deterministic workflow with manifest-driven continuation, remote
publish, and restore support. publish, and restore support. Its CommandKit CLI provides native configuration
inspection, structured operation reports, progress, and shell completion.
```sh ```sh
narratio run 2026-04-04 narratio run 2026-04-04
@@ -40,3 +41,7 @@ This requires resolvable `pipeline.yml`, `campaign.yml`, and concrete
and maintenance rules. and maintenance rules.
- [Testing policy](docs/policy/testing.md) — test value, boundaries, and - [Testing policy](docs/policy/testing.md) — test value, boundaries, and
sufficiency. sufficiency.
Narratio is licensed under the [GPL v3.0 or later](COPYRIGHT).
[Open Source attribution notices](docs/oss/attribution.md) are available.

View File

@@ -1,11 +1,22 @@
package main package main
import ( import (
"context"
"os" "os"
"os/signal"
"syscall"
"go.maximumdirect.net/commandkit"
"gitea.maximumdirect.net/eric/narratio/internal/app" "gitea.maximumdirect.net/eric/narratio/internal/app"
) )
func main() { func main() {
os.Exit(app.Execute(os.Args[1:], os.Stdout, os.Stderr)) os.Exit(runProcess(os.Args[1:], commandkit.Streams{Out: os.Stdout, Err: os.Stderr}, app.Execute))
}
func runProcess(args []string, streams commandkit.Streams, execute func(context.Context, []string, commandkit.Streams) commandkit.Outcome) int {
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
return execute(ctx, args, streams).Status
} }

56
cmd/narratio/main_test.go Normal file
View File

@@ -0,0 +1,56 @@
package main
import (
"bufio"
"context"
"fmt"
"os"
"os/exec"
"syscall"
"testing"
"time"
"go.maximumdirect.net/commandkit"
)
func TestProcessSignalsCancelInvocation(t *testing.T) {
if os.Getenv("NARRATIO_TEST_SIGNAL_CHILD") == "1" {
os.Exit(runProcess(nil, commandkit.Streams{Out: os.Stdout, Err: os.Stderr}, func(ctx context.Context, _ []string, streams commandkit.Streams) commandkit.Outcome {
fmt.Fprintln(streams.Out, "ready")
<-ctx.Done()
return commandkit.Failure("interrupted").WithCause(ctx.Err())
}))
}
for _, sig := range []os.Signal{os.Interrupt, syscall.SIGTERM} {
t.Run(sig.String(), func(t *testing.T) {
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
child := exec.CommandContext(ctx, os.Args[0], "-test.run=^TestProcessSignalsCancelInvocation$")
child.Env = append(os.Environ(), "NARRATIO_TEST_SIGNAL_CHILD=1")
out, err := child.StdoutPipe()
if err != nil {
t.Fatal(err)
}
child.Stderr = os.Stderr
if err := child.Start(); err != nil {
t.Fatal(err)
}
scanner := bufio.NewScanner(out)
if !scanner.Scan() || scanner.Text() != "ready" {
_ = child.Process.Kill()
_ = child.Wait()
t.Fatal("child failed to register its signal context")
}
if err := child.Process.Signal(sig); err != nil {
_ = child.Process.Kill()
_ = child.Wait()
t.Fatal(err)
}
err = child.Wait()
exit, ok := err.(*exec.ExitError)
if !ok || exit.ExitCode() != 1 {
t.Fatalf("child result=%v, want operational exit 1", err)
}
})
}
}

View File

@@ -0,0 +1,84 @@
# 0001. Classify session content by purpose and lifecycle
## Status
Proposed
## Date
2026-10-01
## Context
Narratio coordinates applications that produce transcripts, artifacts,
diagnostics, and working files. The current session layout mixes some of these
roles, including complete Notarius bundles under `artifacts/`. Operators use
transcripts and artifacts to evaluate results during development and need
predictable locations for diagnostics.
A shared classification model will guide the workspace design and subsequent
adapter changes. The [operator guide](../operations.md#local-state-layout)
describes the implemented layout.
## Decision
Classify content by its primary purpose and lifecycle:
| Category | Purpose |
| --- | --- |
| Inputs | Material consumed by an application, including audio, configuration, and reference documents. |
| Outputs | Completed substantive products, including intermediate artifacts exposed for further use. |
| Logs | Records of execution, including process logs, execution reports, warnings, and diagnostic summaries. |
| Cache | Reusable information whose absence permits ordinary recomputation or retrieval. |
| State | Application condition, progress, recovery records, and unfinished work. |
Classification is relative to the consuming application. An output of one stage
can serve as an input to another while retaining its output location. Completed
outputs reused to skip work remain Outputs. Narratio's manifest is State and
records whether those outputs are reusable.
Classify checkpoints according to their recovery behavior. A checkpoint needed
to continue a particular interrupted operation is State. A saved work result
that can be reused or recomputed is Cache. Recomputation cost informs retention
policy. File-specific classification remains necessary for stores serving both
purposes.
Treat Debug as a capture and retention mode that can include detailed Logs,
snapshots of State, and other diagnostic evidence. Retained debug snapshots have
a diagnostic role; live recovery records retain their State role.
Apply these directory principles to Narratio:
- Store completed artifacts, including intermediate artifacts like
`session_bounds.json`, directly in a flat `artifacts/` directory.
- Store combined transcripts directly in `transcripts/`, with a subdirectory
for the initial per-speaker transcripts.
- Store prepared external audio in `audio/` and other prepared external inputs
in `inputs/`.
- Organize Logs under `logs/` by stage. Execution reports belong to this category.
- Organize Cache under a cache root by the application that owns its format and
reuse behavior.
- Treat scratch files and unfinished outputs as State until completion permits
promotion to Outputs.
## Alternatives Considered
- Group outputs by producer. This exposes subprocess packaging to operators;
flat artifact and transcript locations better support comparison and review.
- Group Logs by application. Stage names match the operator's workflow and
collect diagnostics from stages that invoke multiple applications.
- Classify all checkpoints as State. Recovery behavior provides a more useful
distinction for eviction and reuse decisions.
- Treat all Debug material as Logs. A separate debug location can accommodate
retained state snapshots and larger diagnostic bundles when needed.
## Consequences
Each managed file family needs an identified role, owner, scope, and retention
rule. Subprocess bundles require classification before their contents are
placed in Narratio's output and diagnostic directories.
Physical roots, retention rules, the mechanism for presenting latest logs,
debug placement, and ambiguous checkpoint classifications remain open. The file
inventory and subsequent roadmap will resolve these choices and define the
migration. Current versus historical views are separate from content categories.

View File

@@ -0,0 +1,76 @@
# 0002. Assign subprocess content ownership
## Status
Proposed
## Date
2026-10-03
## Context
[ADR 0001](0001-classify-session-content.md) defines content categories and
operator-facing directory principles. Narratio also needs an ownership boundary
for the applications it invokes. That boundary determines who selects locations,
manages retained files, and controls cleanup.
The current subprocess workflows can execute with fresh working state. Notarius
can reuse persistent chunk-plan and checkpoint caches. Narratio maintains its own
session progress and recovery records.
## Decision
Assign responsibility by content category:
| Category | Responsibility |
| --- | --- |
| Inputs | Narratio supplies paths to prepared inputs, transcripts, and artifacts. |
| Outputs | Narratio selects destinations and promotes completed products into the output locations defined by ADR 0001. |
| Logs | Narratio selects stage-based destinations and captures subprocess output streams. |
| Debug | Narratio selects the destination when capture is enabled; the subprocess defines the diagnostic contents. |
| Subprocess State | Each application manages its working directory, temporary files, and execution lifecycle through its own configuration and defaults. |
| Subprocess Cache | Each application manages its configured persistent cache, including its format, identity, and reuse behavior. |
Narratio retains ownership of its own State, including the session manifest,
recovery bookkeeping, and staging files it manages.
Recommend a dedicated cache root for each cache-aware application, configurable
through that application's supported controls. For system-wide deployments,
`/var/cache/<application>` is a suggested location; `/var/cache/notarius` is an
example for Notarius. Each application defines its cache configuration, defaults,
and internal layout. Operators select locations and retention settings through
those controls. Narratio's session cleanup leaves subprocess caches under their
separate lifecycle policies.
Subprocesses retain ownership of their file formats and bundle structures.
Narratio can receive a complete result bundle at a selected staging destination
and promote the selected products into its canonical output directories.
Diagnostic snapshots of subprocess State follow the Debug destination selected
by Narratio.
Narratio's `runs/` directory can hold staging outputs and retained execution
evidence. Subprocess working directories follow the application's configuration
and may reside elsewhere. Narratio cleanup manages Narratio-owned material;
subprocess State and Cache follow their separate lifecycle policies.
## Alternatives Considered
- Place all subprocess working files and caches inside each Narratio session.
This makes sessions easier to collect as a unit, but couples application
internals and cache retention to Narratio's session lifecycle.
- Allow subprocesses to choose output, log, and debug destinations independently.
This simplifies invocation but scatters the material operators inspect.
- Give Narratio control of downstream bundle formats. This simplifies some
destination mappings but increases integration coupling. Selecting and
promoting products preserves application ownership of those formats.
## Consequences
Adapters need supported controls for Narratio-selected output, log, and debug
locations. Upstream changes may be needed where those destinations are coupled
to application working directories or to one another.
Workspace layout and file classification can proceed independently of subprocess
working-directory conventions. Exact debug placement, retained diagnostic views,
and migration steps remain for the workspace design and roadmap.

View File

@@ -0,0 +1,38 @@
# 0003. Assign configuration ownership
## Status
Accepted
## Date
2026-11-19
## Context
Configuration loading, inspection, and domain execution need explicit ownership
so that effective configuration has one authority.
## Decision
- **ConfigKit owns configuration policy and resolution through the final
handoff.** Narratio supplies its schema, defaults, and configuration rules
through ConfigKit's supported extension points. The completed ConfigKit
result is authoritative.
- **Narratio owns domain interpretation and execution.** It consumes the
completed configuration without mutation and produces separate domain
objects. It must not construct a replacement effective configuration.
- **CommandKit owns CLI mechanics and presentation; `ckconfig` exposes
ConfigKit's inspection features.** Narratio supplies selection and acquisition
wiring and exposes those features through native adapters, without altering
their semantics or substituting its own inspection views.
## Alternatives Considered
Post-handoff configuration resolution and custom inspection projections are
rejected because they create competing configuration authorities.
## Consequences
Domain catalogs and plans remain separate from native configuration inspection.
Missing configuration or inspection capabilities are addressed upstream.

View File

@@ -1,485 +1,429 @@
# CLI Reference # CLI Reference
## Shortest Useful Command ## Command tree
```bash
narratio run 2026-04-04
```
This runs the canonical full pipeline for session `2026-04-04`.
## Command Overview
Top-level commands:
- `version`: print the Narratio build version.
- `run <session_id>`: run all or one contiguous range of the canonical stage order.
- `regenerate-artifacts <session_id>`: force-run extraction through analysis.
- `run-stage <stage> <session_id>`: run one stage.
- `analyze <session_id>`: force-run analyze.
- `publish <session_id>`: force-run publish.
- `clean <session_id>` or `clean --all`: remove local work/spool state.
- `session <subcommand>`: session helper commands.
- `config <subcommand>`: validate, display, source-trace, catalog, or compare resolved pipeline configuration.
Session subcommands:
- `session init <session_id>`
- `session plan <session_id>`
- `session validate <session_id>`
- `session status <session_id>`
- `session restore <session_id>`
- `session artifacts <session_id>`
- `session locks <session_id>`
- `session locks add <session_id> <source>`
- `session locks remove <session_id> <source>`
## Common Config Flags
Most session-aware commands accept:
- `--config <pipeline.yml>`
- `--campaign <id>`
- `--campaign-file <campaign.yml>`
- `--session <session.yml>`
- `--session-id <session_id>`
- `--previous-session-id <session_id>`
- `--profile <name>`
- `--secrets-dir <directory>`
Rules:
- `--campaign` and `--campaign-file` are mutually exclusive.
- `--session` is not used by `session init`.
- if both positional `<session_id>` and `--session-id` are provided, values must match.
- `--previous-session-id` is a strict expectation: the selected session file
must contain the same `previous_session_id`.
- `--profile` selects `profiles/<name>.yml` relative to the pipeline root. It
may be supplied once; omitted, empty, and the exact name `default` select the
base configuration, while an unknown named profile fails. The same selection
applies to all common-flag commands, including `regenerate-artifacts`.
- `--secrets-dir` selects ConfigKit credential-file bootstrap explicitly. A
relative value uses caller CWD. Without the flag, a present `secrets/`
directory beside the resolved root pipeline is used; an absent one is skipped.
- `clean --all` cannot be combined with campaign/session selectors.
- notification delivery is currently limited to the configured `noop` mode; see
the [configuration reference](./config.md#notifications).
## Session ID Input Rules
Session-aware commands accept one of these forms:
- positional session ID: `... <session_id>`
- compatibility flag: `... --session-id <session_id>`
When both are present, command parsing requires an exact match.
Commands with additional positionals keep their command-specific order:
- `run-stage <stage> <session_id>` or `run-stage <stage> --session-id <session_id>`
- `session locks add <session_id> <source>` or `session locks add --session-id <session_id> <source>`
- `session locks remove <session_id> <source>` or `session locks remove --session-id <session_id> <source>`
## Command Reference
### `config validate`, `config show`, `config sources`, `config artifacts`, and `config diff`
```bash
narratio config validate [--config <pipeline.yml>] [--campaign <id> | --campaign-file <campaign.yml>] [--profile <name>] [--secrets-dir <directory>]
narratio config show [--config <pipeline.yml>] [--campaign <id> | --campaign-file <campaign.yml>] [--profile <name>] [--secrets-dir <directory>]
narratio config sources [--config <pipeline.yml>] [--campaign <id> | --campaign-file <campaign.yml>] [--profile <name>] [--secrets-dir <directory>]
narratio config artifacts [--config <pipeline.yml>] [--campaign <id> | --campaign-file <campaign.yml>] [--profile <name>] [--secrets-dir <directory>]
narratio config diff <left-profile> <right-profile> [--config <pipeline.yml>] [--campaign <id> | --campaign-file <campaign.yml>] [--secrets-dir <directory>]
```
These commands resolve the selected profile, defaults, ordinary paths, and—if
a campaign is selected—the campaign-owned party. They neither discover or load
a session nor create a workspace, manifest, run, lock, adapter, or remote
connection. Like every pipeline-loading command, they bootstrap the selected or
conventional secrets directory before resolving configuration; `config show`
never includes bootstrap reports or secret values in its YAML output.
Typed credential references, including `notarius.llm_api_key`, must therefore
resolve even though these inspection commands never construct an adapter.
Campaign selection is optional for a pipeline without party-driven artifact
families. A pipeline with `scriptorium.artifact_families` needs a selected or
configured default campaign so Narratio can expand its concrete artifacts and
publish rules. `--campaign` and `--campaign-file` remain mutually exclusive.
Session, range, force, and artifact-execution flags are not accepted.
`config validate` writes a concise root-path, selected-profile (or `none`), and
effective-digest summary after successful complete validation. `config show`
writes one deterministic, secret-free YAML document containing defaulted and
expanded concrete configuration. It omits ConfigKit directives, artifact
family declarations, and runtime provenance.
`config sources` reports the same fully validated resolution without printing
effective values. Its header identifies the root, ordered imports, selected
profile and overlay, selected campaign, party source, and digest. The
remaining tab-separated records are sorted as `path`, `role`, and `source`.
Roles distinguish root, import, profile, centralized default, campaign, party,
and generated family ownership. A generated party member has
one family record and one party record at the same logical path. The output
never reads or prints secret values.
`config artifacts` prints the concrete catalog used by analysis, ordered by
artifact key. Its tab-separated header is `key`, `source`, `definitions`,
`enabled`, `output`, `dependencies`, `family`, `character`, `family_source`, and
`party_source`. Definitions and effective dependencies are sorted comma-separated
lists, and control characters in fields are escaped. Family-member rows identify
their family, character, defining family file, and party file. An empty catalog
prints only the header. Ordinary artifacts can be inspected without a campaign;
party-driven families retain the campaign requirement. See
[Scriptorium Artifact Entries](./config.md#scriptorium-artifact-entries) for the
configuration layout.
`config diff` resolves both supplied profile names independently and compares
their fully resolved, secret-free effective mappings. It does
not accept `--profile`; the two positional names must be distinct, declared
profiles. When party-driven families are present, both profiles must resolve to
the same selected campaign and party. Use `--campaign-file` if profile-specific
campaign configuration would otherwise select different files.
Equal profiles print `no differences`. Otherwise, sorted tab-separated records
use one of these forms, with compact JSON values:
```text ```text
added <path> <right-value> narratio
removed <path> <left-value> ├── run SESSION
changed <path> <left-value> <right-value> ├── artifacts
│ ├── list
│ └── regenerate SESSION
├── session
│ ├── init SESSION
│ ├── plan SESSION
│ ├── validate SESSION
│ ├── status SESSION
│ ├── restore SESSION
│ ├── clean [SESSION | --all]
│ ├── artifacts SESSION
│ └── locks
│ ├── list SESSION
│ ├── add SESSION SOURCE
│ └── remove SESSION SOURCE
├── config
│ ├── scopes
│ ├── validate
│ ├── show
│ ├── sources
│ ├── explain
│ └── diff
├── version
├── completion bash|zsh|fish
└── help [COMMAND...]
``` ```
Mappings are flattened to their logical field paths; lists remain one atomic Bare root and command groups display help. Use `narratio help session plan`
value. The command compares defaulted concrete artifacts and publish rules, not or `narratio session plan --help` for command-local flags and operands. Help,
profile names, source-file layout, or formatting. It succeeds when differences version, completion, and `config scopes` do not bootstrap credentials, load
are found, making it suitable for review and migration checks. configuration, contact storage, or initialize adapters.
### `version` ## Invocation syntax
```bash Place flags after the complete command path; they may be interspersed with
narratio version operands. Use command help for installed flags. The [CommandKit CLI contract](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/docs/cli.md#registered-command-syntax)
describes parsing, repetition, and boolean values. Narratio additionally
normalizes repeatable `--artifacts` selections as described below.
## Configuration selectors
| Selector | Meaning |
| --- | --- |
| `--config PATH` | Exact pipeline root, regardless of configuration scope; omission uses discovery. |
| `--overlay NAME` | Pipeline overlay; omitted, empty, or `default` selects the base. |
| `--campaign ID` | Select and assert the effective campaign identity. |
| `--campaign-file PATH` | Exact campaign source; may accompany its identity assertion. |
| `--session ID` | Session identity for native configuration inspection only. |
| `--session-file PATH` | Exact session source; domain commands use positional `SESSION` as the identity assertion. |
| `--party-file PATH` | Select the canonical roster instead of the campaign's default file. |
| `--previous-session-id ID` | Assert the configured previous-session identity on applicable domain commands. |
Explicit relative file/directory paths use the invocation directory. Explicit
file errors and identity mismatches fail without fallback. A file selects the
source; an identity asserts its effective ID after resolution. File-only
configuration inspection may obtain identity from the file. Selecting a party
file does not rewrite the campaign's party setting; the selected roster feeds
players, family expansion, planning, and execution consistently.
Selectors are installed only where applicable; command help lists them.
`session init` creates new input and therefore has no existing-session-file
or party-file selection. `session clean --all` accepts pipeline/overlay
selection and rejects campaign, session, party, and previous-session selectors.
When no explicit session file is selected, local discovery precedes remote
acquisition. Only local absence permits remote fallback, with a known identity.
Remote loading prefers authored session-root YAML, then the current commit's
prepared snapshot only when the authored object is absent. Read-only commands
may perform these reads without initializing runtime state. See
[discovery](config.md#discovery-and-selection) and
[credential bootstrap](config.md#secrets-handling) for configuration details.
## Run
```sh
narratio run SESSION
narratio run SESSION --from extract --through analyze
narratio run SESSION --stage analyze --force --artifacts session_recap
``` ```
Official release binaries report their exact Git tag. Binaries built directly The default is the full canonical pipeline:
from source without release linker metadata report `dev`. `prepare`, `transcribe`, `merge`, `polish`, `normalize`, `trim`, `render`,
`extract`, `analyze`, `publish`, `notify`, `cleanup`.
`--from` and `--through` select inclusive contiguous bounds. `--stage` selects
one stage and cannot accompany explicitly supplied range flags. `--force`
reruns selected work; dependent invalidation can extend beyond that range.
Bounded starts require valid preceding manifest state. Ordinary execution uses
semantic resume checks rather than rerunning all selected work.
### `run` After preparation, `run` checks projected Audita and Scriptorium work before
processing continues. Failed checks stop the invocation; prompt warnings alone
do not. `artifacts regenerate` uses the same check.
See [operations](operations.md#prompt-requirements-preflight) for recovery.
```bash Analysis-only rebuilding uses `run SESSION --stage analyze --force`; it does
narratio run <session_id> [--from <stage>] [--through <stage>] [--force] [--artifacts <name[,name...]>] [...common config flags] not refresh extraction. Publishing alone uses `run SESSION --stage publish`,
adding `--force` when a rerun is intended. It does not schedule cleanup. See
[operations](operations.md#artifact-development-workflows) for regeneration workflows.
## Artifacts regenerate
```sh
narratio artifacts regenerate SESSION
narratio artifacts regenerate SESSION --artifacts session_recap,player_handout
``` ```
Behavior: Forces the fixed inclusive `extract` through `analyze` range. It refreshes the
whole configured Notarius extraction bundle and chunk work, then selected
analysis targets and required prerequisites. `--artifacts` narrows analysis,
not extraction lanes. Publication, notification, and cleanup are outside this
range. Independent `--from`, `--through`, `--stage`, and `--force` flags are
not installed on this command. It accepts applicable context selectors and
returns the same run report as `run`.
- evaluates one inclusive contiguous range of the canonical stage order; ## Artifacts list
- defaults an omitted `--from` to `prepare` and an omitted `--through` to
`cleanup`, so omitting both retains full-pipeline behavior;
- rejects unknown endpoints and a `--from` endpoint after `--through`;
- runs `render` before `extract`; an omitted or disabled Notarius
configuration records an explicit `notarius_disabled` self-skip;
- resolves every selected typed credential during the initial configuration
load, including a Notarius credential when extract is disabled, outside the
selected range, or later skipped as resumable;
- skips already-succeeded stages unless `--force` is set or a stage-specific
resume check finds its durable result obsolete;
- applies `--force` only to stages in the selected range;
- rejects repeated `--from`, `--through`, or `--force` options, including
`--name=value` spellings;
- continues interrupted or partially completed sessions by running non-succeeded stages;
- writes the session manifest as the sole durable progress ledger. Each
invocation also creates its run-local directory and returns an immediate
command summary; neither creates another durable progress record.
- reports the resolved profile (or `none`) and effective configuration digest.
When `--artifacts` is present, the selected range must contain `analyze` or ```sh
`publish`. Either consumer is sufficient, including a one-stage range. narratio artifacts list --config pipeline.yml --campaign-file campaign.yml
### `regenerate-artifacts`
```bash
narratio regenerate-artifacts <session_id> [--artifacts <name[,name...]>] [...common config flags]
``` ```
Exactly equivalent to: Lists domain definitions: source identities, producers, outputs, dependencies,
and selected-party family/member provenance. It acquires the context needed to
derive that catalog, without requiring a session solely for listing definitions.
It does not add generated members to native `config show` output.
```bash ## Session plan
narratio run <session_id> --force --from extract --through analyze [caller options]
```sh
narratio session plan SESSION --stage analyze --force --format json
``` ```
The command always reruns extraction. Analysis rebuilds the selected configured Accepts the same stage/range, force, artifact, and context selections as `run`.
artifacts and any prerequisites required by those targets; without Reports execution/reuse actions and reasons, analysis targets, prerequisite work,
`--artifacts`, it uses the normal default analysis selection. Publish and notify and publication mappings through shared planners. Planning reads existing state
never run. Common session/configuration options and repeatable artifact values without creating a workspace, changing manifests, acquiring execution locks, or
pass through unchanged. initializing stage adapters or invoking requirements inspection. It does not
predict unknown output identities.
The forced extraction rebuilds the complete configured Notarius bundle, ## Session validate
disables Notarius checkpoint loading, and requests chunk-plan refresh.
`--artifacts` narrows only the analysis work; it never selects Notarius lanes.
Because the expansion owns `--force`, `--from`, and `--through`, callers cannot ```sh
supply those options. The shared `run` parser reports them as duplicate narratio session validate SESSION --session-file ./session.yml
singleton flags. The alias has no private execution options or behavior, and
runtime diagnostics may identify the operation as `run`.
### `run-stage`
```bash
narratio run-stage <stage> <session_id> [--force] [--artifacts <name[,name...]>] [...common config flags]
``` ```
Valid stage names: Validation checks configuration and required input, audio, previous-session,
publication, and lock readiness. Audita preflight uses existing prepared inputs,
probes temporary destinations under `runs/.validation`, and may contact configured
providers. It also inspects enabled trim
and analysis definitions and their configured prerequisites, regardless of
output reuse. Missing prompt requirements or unsuccessful inspection invalidate
the report; incomplete or conditional discovery alone is a warning. Material
findings remain in the report regardless of diagnostic visibility. Invalid
configuration uses the native input classification; readiness failures are
operational failures.
- `prepare` ## Session status
- `transcribe`
- `merge`
- `polish`
- `normalize`
- `trim`
- `render`
- `extract`
- `analyze`
- `publish`
- `notify`
- `cleanup`
Rules: ```sh
narratio session status SESSION --format json
- `--artifacts` is accepted only for `analyze` and `publish` stage targets.
### `analyze`
```bash
narratio analyze <session_id> [--artifacts <name[,name...]>] [...common config flags]
``` ```
Equivalent to: Reports local manifest stages and artifacts, configuration provenance, readiness,
and remote current state when storage is available. Remote output entries retain
exact committed declarations and carried-output origins separately from current
configured destinations. An absent remote current pointer is a reported missing
state, rather than an error by itself. Genuine inspection failures can return a
partial report with a failed outcome.
```bash ## Session artifacts
narratio run-stage analyze <session_id> --force [...common config flags]
```sh
narratio session artifacts SESSION --remote
``` ```
This selects only `analyze`: it does not invoke Notarius, replace extraction, Reports definitions, dependencies, local availability/evidence, and optional
or remove existing extract outputs. `--artifacts` narrows the forced analysis remote publication state without reading artifact payload bodies. Without
targets and their required analysis prerequisites. `--remote`, this command avoids remote artifact inspection. Current publication
outcomes include `published`, `carried_locked`, `locked_unpublished`,
`optional_missing`, and `unselected`.
### `publish` ## Session init
```bash ```sh
narratio publish <session_id> [--artifacts <name[,name...]>] [...common config flags] narratio session init SESSION --output ./session.yml --audio-dir ./audio
narratio session init SESSION --remote --audio-s3-prefix audio/session/
``` ```
Equivalent to: Choose exactly one destination: `--output PATH` or `--remote`. Options include
`--date YYYY-MM-DD`, `--title TEXT`, `--previous-session-id ID`, `--force`,
configuration/overlay/campaign selectors, and exactly one audio override
if needed: `--audio-dir PATH` or `--audio-s3-prefix PREFIX`.
```bash A configured session template retains its import/resource authoring context;
narratio run-stage publish <session_id> --force [...common config flags] relative CLI audio paths use the invocation directory. Generated YAML is
standalone and concrete. `--format` changes only the confirmation report,
never the generated YAML file. See [initialization](operations.md#session-initialization).
## Session restore
```sh
narratio session restore SESSION --dry-run
narratio session restore SESSION --force --include-audio
``` ```
This command selects only `publish`; it does not invoke cleanup. Use a normal Uses pointer-selected committed state and returns actions/conflicts. Dry runs
full run to include configured cleanup, or `run-stage cleanup` to retry cleanup make no local directory or mode changes. Actual restore preserves confined
from valid publication evidence. replacement, transition locking, incomplete-restore recovery markers, and
manifest-last installation. `--force` permits replacement only of eligible
regular files. The public report is separate from the persisted restore
execution report. See [restore operations](operations.md#restore-workflow).
### `clean` ## Session clean
```bash ```sh
narratio clean <session_id> [--dry-run] [--clear-cache] [...common config flags] narratio session clean SESSION --dry-run
narratio clean --all [--dry-run] [--clear-cache] [--config <pipeline.yml>] narratio session clean --all --dry-run --clear-cache
``` ```
Behavior: Choose positional `SESSION` or `--all`. Removes the selected local workspace
and spool state; cache deletion requires `--clear-cache`. Dry runs return planned
actions without deletion. Partial failures retain completed actions. This manual
operation is separate from the pipeline cleanup stage. Exact scope and recovery
implications belong in [cleanup operations](operations.md#cleanup).
- session mode removes the selected session's local work and spool state; ## Session locks
- `--all` removes all local session work and spool state;
- cache remains unless `--clear-cache` is provided.
See [Operations: Cleanup](./operations.md#cleanup) for manual and pipeline-stage ```sh
deletion scope. narratio session locks list SESSION
narratio session locks add SESSION narratio.artifact.session_recap --reason 'manual review'
### `session plan` narratio session locks remove SESSION narratio.artifact.session_recap
```bash
narratio session plan <session_id> [--from <stage>] [--through <stage>] [--force] [--artifacts <name[,name...]>] [...common config flags]
``` ```
Uses the same inclusive bounds, endpoint validation, force scope, and artifact A bare locks group displays help. List reports independent remote locks sorted
selection contract as `run`. It validates config and prints run/skip decisions by source. Add reports an existing lock unless `--force` requests one
for selected stages only without creating the local workdir or changing the conditional, generation-matched replacement; concurrent change requires retry.
manifest. Resume-capable selected stages are checked against durable evidence. Remove is idempotent. `--reason TEXT` is available on add. See
The output includes the resolved profile (or `none`) and effective configuration [publish locks](operations.md#publish-locks) for their publication effect.
digest without writing provenance or any manifest state.
For `analyze`, the preview also lists explicit targets, prerequisite-only work,
execution order, and reusable current artifacts with concise reasons. These
artifact decisions come from the same reconciliation and work planner used by
execution; the preview does not predict output identities.
### `session validate` ## `--artifacts` selection rules
```bash `run`, `session plan`, and `artifacts regenerate` accept repeatable
narratio session validate <session_id> [...common config flags] `--artifacts NAME[,NAME...]`. Values are trimmed, deduplicated, and sorted.
Family keys select all concrete members; concrete keys select one member.
Analysis includes required prerequisite closure. Publication selects applicable
configured artifact outputs. The option requires a selected analysis or publish
consumer and does not select built-in output sources or individual extraction
lanes. See [artifact configuration](config.md#scriptorium-artifact-families).
## Configuration inspection
`config scopes` lists operations and features without loading. The four scopes
are `app` (default), `campaign`, `session`, and `party`. They expose their actual
typed ConfigKit results, with native provenance, resolution history, and safe
secret views. App inspection needs no campaign/party expansion. Domain catalogs
and execution plans are separate views.
```sh
narratio config show --scope app --format json
narratio config show --scope session --session SESSION --session-file ./session.yml
narratio config show --scope party --party-file ./party.yml
narratio config show --path /scriptorium --format yaml
narratio config sources --scope campaign --campaign-file ./campaign.yml
narratio config explain --path /scriptorium --format json
narratio config explain --list --under /scriptorium --historical
narratio config validate --details --severity error
``` ```
Read-only preflight checks for config validity, required inputs, audio mode, Use native show, sources, explain, and validation operations; their options,
previous-session requirements, publish outputs, and independent remote locks. path syntax, findings, and report shapes are described in the
[CommandKit configuration contract](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/docs/cli.md#configuration-scopes).
`--scope all` is supported for show and validate and requires applicable context
for every reached scope. Domain catalog and plan views remain separate.
### `session status` ### Independent comparisons and overrides
```bash ```sh
narratio session status <session_id> [...common config flags] narratio config diff --config pipeline.yml --against-config pipeline.yml --against-overlay testing --details --check
narratio config diff --scope party --party-file before.yml --against-party-file after.yml
narratio config show --scope app --set '/whisperx/concurrency=2'
``` ```
Prints local manifest state and, when storage is available, status for the Diff loads each side independently. In addition to native `--against-config`
pointer-selected remote commit and its declared published outputs. Current and `--against-overlay`, applicable scopes accept `--against-campaign`,
publish metadata reports `published`, `carried_locked`, `locked_unpublished`, `--against-campaign-file`, `--against-session`, `--against-session-file`, and
`optional_missing`, and `unselected`; carried output lines include the run `--against-party-file`. Omitted right-side selectors use their own normal
derived from their exact declared key, the key itself, and its declared defaults; they never inherit left-side selections. Each party default follows
destination. A separately displayed `dest` is the destination requested by the that side's campaign.
current configuration and may differ while an older declaration is locked.
### `session init` Each reached pipeline side performs its own configured startup; both sides use
the process environment. See the [native comparison contract](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/docs/cli.md#compare-configuration-selections)
for report and comparison semantics.
```bash Only app inspection supports ordered, repeatable `--set POINTER=JSON`, plus
narratio session init <session_id> --output ./session.yml [options] `--against-set POINTER=JSON` for the comparison side. ConfigKit applies these
narratio session init <session_id> --remote [options] during that load. They affect only that invocation. Other scopes and aggregate
inspection reject overrides. Execution/planning use files and overlays;
they have no field-override flags.
## Reporting and visibility
Reports go to stdout; diagnostics and progress go to stderr. Domain commands
return one final public report where useful, including meaningful partial work
on failure. `--format text|yaml|json` selects presentation. Automatic structured
reports use YAML; text uses the same data. Version and native inspection commands
may have native text renderers. Report format does not change artifact formats.
There is no public report schema-version field.
[CommandKit reporting](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/docs/cli.md#reporting) defines formats and visibility controls.
Bootstrap evidence is presented as final diagnostics on stderr, independently
of the substantive command report and its `--format` selection.
Progress covers stage transitions/reuse, audio transfers/cache reuse, and
individual durable speaker/artifact checkpoints and validated reuse. Info adds
selected sources, destinations, and decision context. Concurrent completion
order is not fixed. Workers settle before the final report.
Console debug does not enable downstream debug captures or change retention.
Downstream streams stay in captured logs and are not replayed automatically.
Quiet changes visibility, not execution, persistence, or logging. A report or
diagnostic delivery failure can fail the invocation after durable work has
completed; it does not roll back that work.
### Public domain report fields
Optional fields appear when meaningful; these reports do not expose raw
manifests, resolved credentials, or internal dependency containers.
| Report | Fields |
| --- | --- |
| Run/regenerate | `campaign`, `session_id`, `run_id`, `stages`, `executed`, `skipped`, `stage_results`, `available_artifacts`, `artifact_targets`, `complete` |
| Plan | `campaign`, `session_id`, `stages` with `name`, `action`, `reason`, optional `analysis`; `publication_actions` |
| Catalog | `artifacts` with source, producer, output, enabled state, dependencies, optional concrete key and family/member/source provenance |
| Validation | `campaign`, `session_id`, `session_source`, `valid`, `findings` with severity, category, message |
| Status/artifacts | Identities/source, `local_manifest`, `stages`, `artifacts`, optional `remote`, configuration provenance, audio/previous-artifact readiness, `findings` |
| Init | `campaign`, `session_id`, `destination`, `remote`, `written` |
| Locks | Identities, `operation`, `result`, `complete`, optional `source`, `locks` |
| Restore | Identities/run, `dry_run`, `complete`, `status`, `downloaded`, `conflicts`, `actions` |
| Clean | Optional identities, `all`, `dry_run`, `complete`, `cache`, `actions`, optional `error` |
Run `stages` is the complete selection. `executed` includes attempted work,
including failures and self-skips. `skipped` includes reuse and self-skips.
Each `stage_results` entry has `name`, `attempted`, `outcome`
(`completed`, `failed`, `reused`, `skipped`, `not_attempted`), and optional
`reason`. Available artifacts carry `stage`, optional `source`, `kind`, `path`,
optional `producer_run_id`, and durable `evidence` (`stage_result`,
`speaker_checkpoint`, `artifact_checkpoint`). Failed or unpersisted work is not
reported as completed.
Plan analysis contains `targets`, `prerequisites`, `execute`, and `reuse`;
artifact entries identify key, optional family/character, role, reason, and
force. Publication actions identify source, destination, required, and selected.
Remote status outputs retain source, destination, required, state, lock state,
optional outcome, declared destination/key, origin run, and error. Restore
actions carry kind, relative local path, remote key, status, optional reason/error.
Clean actions carry path, status (`would_delete`, `deleted`, `missing`, `empty`,
`failed`), and optional error; cache records whether it was preserved, requested,
processed, or not applicable. Lock rows include source, reason, creation time,
and whether publication is configured for that source.
## Cancellation and exit status
Ctrl-C and termination cancel acquisition and active operations. Narratio stops
scheduling work, waits for started workers, attempts terminal local manifest
persistence, and releases acquired resources. Successful checkpoints remain
resumable. Cancellation does not schedule cleanup. Abrupt process death has no
added finalization guarantee.
| Status | Meaning |
| --- | --- |
| `0` | Success, including ordinary diff with differences. |
| `1` | Operational/readiness failure, cancellation, or output failure. |
| `2` | Invalid invocation or identifiable invalid configuration input. |
| `3` | `config diff --check` found differences. |
Missing/unreadable sources and ambiguous or callback loading failures are
operational; malformed or explicitly rejected configuration input uses native
input classification. Mixed failures preserve underlying causes and operational
precedence. Terminal failure is presented once, including in quiet mode.
## Version and completion
```sh
narratio version --format text
narratio version --scope commandkit --format json
source <(narratio completion bash)
source <(narratio completion zsh)
narratio completion fish | source
``` ```
Required target selection: Version text is `NAME VERSION` with an optional revision; structured identity
contains `name`, `version`, and `revision`. ReleaseKit supplies the version:
it uses an injected release identifier, then the main-module version when
available, and otherwise reports `dev`. Bash requires bash-completion
initialized; Zsh requires its completion system initialized. Native completion offers command/flag names,
static stage/scope values, and applicable file/directory hints. Dynamic campaign
and artifact completion is deferred.
- exactly one of: ## Migration from the previous CLI
- `--output <path>`
- `--remote`
Options: Removed command paths have no compatibility aliases.
- `--config <pipeline.yml>` | Previous invocation | Current invocation |
- `--campaign <id>` or `--campaign-file <campaign.yml>` | --- | --- |
- `--secrets-dir <directory>` | `run-stage STAGE SESSION` | `run SESSION --stage STAGE` |
- `--previous-session-id <id>` | `analyze SESSION` | `run SESSION --stage analyze --force` |
- `--date <YYYY-MM-DD>` | `publish SESSION` | `run SESSION --stage publish --force` |
- `--title <text>` | `regenerate-artifacts SESSION` | `artifacts regenerate SESSION` |
- `--audio-dir <path>` | `clean SESSION` / `clean --all` | `session clean SESSION` / `session clean --all` |
- `--audio-s3-prefix <prefix>` | `config artifacts` | `artifacts list` |
- `--force` | `session locks SESSION` | `session locks list SESSION` |
| `--session FILE` | `--session-file FILE`; inspection `--session` now asserts identity |
| `--session-id ID` | Positional `SESSION` on domain commands; `--session ID` on config inspection |
| `--secrets-dir PATH` | Configure the main pipeline file or supply environment values; see [Secrets Handling](config.md#secrets-handling). |
| `config diff LEFT_OVERLAY RIGHT_OVERLAY` | `config diff --overlay LEFT_OVERLAY --against-overlay RIGHT_OVERLAY` |
Rules: Campaign identity and file selectors may now accompany each other. Party-file
selection consistently overrides the roster without editing campaign settings.
- `--audio-dir` and `--audio-s3-prefix` are mutually exclusive. Native configuration inspection retains declarations and their actual evidence;
- if campaign `session_template_file` is configured, `session init` renders it. use catalog/plan/session views for generated domain products. Comparison defaults
- generated session YAML must be concrete (no unresolved `{{ ... }}` placeholders). are independent. Field overrides are inspection-only. Update scripts to consume
structured reports and exit classifications, place flags after the complete
### `session restore` command path, and account for native repetition and cancellation behavior.
```bash
narratio session restore <session_id> [--dry-run] [--force] [--include-audio] [...common config flags]
```
Behavior:
- discovers committed remote current state;
- plans local restores;
- writes an execution report;
- blocks unresolved conflicts. `--force` permits replacement only of eligible
regular files.
See [Operations: Restore Workflow](./operations.md#restore-workflow) for the
default restore scope, report location, and conflict-handling workflow.
### `session artifacts`
```bash
narratio session artifacts <session_id> [--remote] [...common config flags]
```
Lists effective built-in, configured Scriptorium, and configured extraction
sources; reports planned, available, unavailable, and published state without
reading payload bodies; and includes publish rules, lock state, and optional
remote published-state availability. Remote inspection uses exact commit
declarations and displays the five current publish outcomes when recorded.
### `session locks`
```bash
narratio session locks <session_id> [...common config flags]
narratio session locks add <session_id> <source> [--reason <text>] [--force] [...common config flags]
narratio session locks remove <session_id> <source> [...common config flags]
```
Behavior:
- list mode validates and reports independent remote locks sorted by source;
- add creates one lock and reports an existing lock unless `--force` is used;
- `--force` performs one generation-matched replacement and reports a
concurrent change for operator retry; and
- remove is idempotent and reports when the source was not locked.
See [Operations: Publish Locks](./operations.md#publish-locks) for lock storage
and publication behavior.
## `--artifacts` Selection Rules
An artifact-family key selects all of its concrete character members. A
concrete generated key selects only that member; mixed family and concrete
selection is deduplicated and executed as concrete keys. The resulting plan
and command output identify both the concrete key and, where applicable, its
family and character ID.
- accepted on `run`, `session plan`, `run-stage`, `analyze`, and `publish`;
- repeatable and comma-separated values are combined, surrounding whitespace
is removed, and duplicate names are collapsed;
- names must exist in `pipeline.scriptorium.artifacts`;
- empty entries are invalid;
- on `run-stage`, only `analyze` and `publish` accept the option.
Effects:
- selects explicit analyze targets; required configured prerequisites may be
reused or rebuilt before them;
- filters publish rules that source `narratio.artifact.<name>`;
- does not filter built-in transcript/bounds or explicitly configured
`narratio.extraction.<name>` publish sources; and
- does not select or filter Notarius lanes.
## Common Workflows
Run full pipeline:
```bash
narratio run 2026-04-04
```
Dry-run restore plan:
```bash
narratio session restore 2026-04-04 --dry-run
```
Generate a concrete session file from template/default structure:
```bash
narratio session init 2026-04-04 --output ./session.yml --date 2026-04-04 --title "Session 12"
```
Force publish only:
```bash
narratio publish 2026-04-04
```
Regenerate post-transcript artifacts without publishing:
```bash
narratio regenerate-artifacts 2026-04-04 --artifacts session_recap,player_handout
```
## Output And Exit Behavior
- Successful commands write their result or summary to standard output and
exit with status `0`.
- Command failures and invalid invocations write an error to standard error and
exit with status `1`.
- An unknown top-level command also prints the top-level usage summary to
standard error.
- `session restore --help` prints its command-specific usage and exits with
status `0`.
Output is intended for operator inspection. Narratio does not currently offer
a machine-readable CLI output mode; durable machine-readable state is recorded
in manifests and reports described in [Operations](./operations.md).

View File

@@ -2,7 +2,8 @@
## Purpose ## Purpose
Narratio resolves three YAML documents: Narratio loads pipeline, campaign, and session YAML, with a canonical party
roster selected explicitly or through the campaign:
- `pipeline.yml`: pipeline/runtime settings - `pipeline.yml`: pipeline/runtime settings
- `campaign.yml`: campaign identity and stable input defaults - `campaign.yml`: campaign identity and stable input defaults
@@ -12,10 +13,20 @@ Narratio resolves three YAML documents:
### `pipeline.yml` ### `pipeline.yml`
When `--config` is omitted, search order is: An explicit `--config` selects exactly that file, including a custom filename.
Otherwise ConfigKit searches these locations in order:
1. `/usr/local/etc/narratio/pipeline.yml` 1. The working directory, for `narratio.yml` then `narratio.yaml`.
2. `/etc/narratio/pipeline.yml` 2. The Go user-config directory's `narratio/` subdirectory, for those named
files followed by `config.yml`, `config.yaml`, `main.yml`, and `main.yaml`.
3. The Go user-config directory itself, for the named files.
4. `/usr/local/etc/narratio/` and then `/etc/narratio/`, each for named files
followed by the generic filenames above.
5. `/etc/`, for the named files.
On Linux, the user-config directory normally follows `XDG_CONFIG_HOME`, or
`~/.config` when it is unset. A selected invalid file fails loading; discovery
does not continue to another candidate.
### `campaign.yml` ### `campaign.yml`
@@ -27,67 +38,64 @@ Selection rules:
### `session.yml` ### `session.yml`
When `--session` is omitted, local search order is: An explicit `--session-file` selects exactly that file. Otherwise local search
order is:
1. `/usr/local/etc/narratio/session.yml` 1. `/usr/local/etc/narratio/session.yml`
2. `/etc/narratio/session.yml` 2. `/etc/narratio/session.yml`
If local session discovery fails and a `session_id` is known, Narratio attempts remote session loading from: If no local session exists and a `session_id` is known, Narratio loads the
session from configured object storage. Downloaded session bytes are contextless
snapshots, with remote object
provenance retained independently of locally materialized checksums.
- `{root_prefix}/campaigns/{campaign}/sessions/{session_id}/session.yml` Remote loading prefers an authored session-root `session.yml`, including updates
from `session init --remote --force`. When that object is absent, loading falls
back to the current commit's standalone prepared session. Published snapshots
remain immutable; restore validates the pointer-selected committed state.
using configured object storage. ### Native inspection and domain derivation
The downloaded remote session file is command-scoped: Narratio removes it after Native configuration inspection exposes four actual typed ConfigKit results:
the command finishes and records only the remote object provenance alongside app (the default pipeline scope), campaign, session, and party. Defaults,
the durable copied session input. normalization, and configuration-owned validation finish within their supported
load lifecycle. Session configuration includes applicable campaign defaults
before handoff. Completed values remain unchanged by planning or execution.
### Read-only effective pipeline inspection App inspection retains artifact-family declarations and needs no campaign or
party solely for expansion. Narratio derives concrete artifact catalogs, players,
resolved dependencies, and publication actions separately using the selected
canonical roster. `artifacts list` inspects those domain definitions;
`session plan` and `session artifacts` expose decisions and availability.
`narratio config validate`, `narratio config show`, `narratio config sources`, Native sources/explanations retain actual imports, origins, history, and recorded
and `narratio config artifacts` use the same `--config`, `--campaign`, resolution evidence. Comparisons load each side independently using its own
`--campaign-file`, and normal defaults. App-only inspection overrides apply during that invocation's
`--profile` selection rules as pipeline commands, but do not select, discover, load. Safe views hide resolved credentials. Persisted preparation projections
or load a session. They resolve configured typed credential references as part retain reference names and do not replace the native inspection result.
of the ordinary ConfigKit load but expose only their environment-variable names; See the [CLI reference](cli.md#configuration-inspection) for scopes, selectors,
they do not create runtime state. path operations, overrides, comparison modes, and report shapes.
`narratio config diff <left-profile> <right-profile>` uses the same pipeline and
campaign selectors, resolves each named profile with an independent ConfigKit
load, and does not accept a separate `--profile` flag.
Campaign selection is optional only when the resolved pipeline has no ### Party selection
`scriptorium.artifact_families`. When families are declared, Narratio selects a
campaign through an explicit flag or `pipeline.campaigns.default_campaign_id`,
then parses the campaign-owned party and expands concrete artifacts and any
family publish rules before validation. `config validate` prints the resulting
root, profile, and effective digest. `config show` emits the normalized
effective pipeline YAML, with defaults and concrete expansion included but
ConfigKit directives and family declarations omitted. This review projection is
not promised to be a reloadable authoring document. `config sources` prints a stable
source projection instead of effective values: root/import/profile/default
ownership plus campaign/party and generated-family records. Canonical derived
players trace to the party. `config artifacts` lists the concrete artifact map,
effective dependencies, and defining sources. The [CLI reference](cli.md#config-validate-config-show-config-sources-config-artifacts-and-config-diff)
owns command syntax and output conventions.
`config diff` compares normalized field values rather than YAML text or source `--party-file` selects an exact canonical roster instead of the campaign-default
ownership. It emits sorted `added`, `removed`, and `changed` records, uses file. Explicit relative paths use the invocation directory; invalid or missing
compact deterministic JSON values, treats lists atomically, and reports `no explicit input fails without fallback. The campaign's configured party field
differences` when the complete effective configurations are equal. Concrete remains unchanged. Inspection, players, family derivation, planning, and execution
family members and generated publish rules participate after expansion; moving use the same selected roster. Format and validation belong in the
an equal value between eligible root/import sources does not create a [party integration contract](integrations/party.md).
difference.
### Migrating to the maintained bundle ### Migrating to the maintained bundle
Use the [production/testing bundle](../examples/production-testing/pipeline.yml) Use the [production/testing bundle](../examples/production-testing/pipeline.yml)
as the complete copyable migration reference. Keep production settings in the as the complete copyable migration reference. Keep production settings in the
base, split them into explicit additive imports, and place testing differences base, split them into explicit additive imports, and place testing differences
in the fixed `profiles/testing.yml` overlay. Put ordinary artifacts and families in the fixed `overlays/testing.yml` overlay. Put ordinary artifacts and families
in the recommended one-definition files shown by that bundle. Convert campaign in the recommended one-definition files shown by that bundle. Convert campaign
rosters to [canonical party input](integrations/party.md), then express character rosters to [canonical party input](integrations/party.md), then express character
work as families. Inspect the result with `config validate`, `config show`, work as families. Inspect the result with `config validate`, `config show`,
`config sources`, and `config artifacts`; use `config diff default testing` to `config sources`, and `artifacts list`; use
`config diff --against-overlay testing` to
review the overlay before running a session. Unversioned party documents are review the overlay before running a session. Unversioned party documents are
rejected. rejected.
@@ -102,22 +110,13 @@ remote state with an unsafe legacy identity must be migrated before use.
## Validation and Merge Rules ## Validation and Merge Rules
- ConfigKit performs strict typed YAML decoding and accepts exactly one document; - Local pipeline, campaign, session, and party documents may declare native
unknown fields, duplicate keys, and trailing documents fail load. imports and sibling inheritance. Only the pipeline selects an overlay.
- A pipeline file may explicitly import additive YAML fragments through the - An omitted overlay, empty overlay option, and exact `default` select the base;
root-only `configkit.imports` list. Imported files contribute fields to one another name selects `overlays/<name>.yml` relative to the pipeline root.
logical pipeline document; they do not override fields supplied by the root
or another import.
- An omitted profile, an empty profile option, and the exact name `default`
select the base configuration. Any other name selects
`profiles/<name>.yml` relative to the pipeline root.
- Campaign, session, and canonical-party documents are strict single-source
ConfigKit schemas. They do not enable imports, profiles, or `configkit`
directives.
- Configured timeout and retry-delay durations must be positive. An omitted - Configured timeout and retry-delay durations must be positive. An omitted
artifact timeout continues to inherit its configured Scriptorium timeout. artifact timeout continues to inherit its configured Scriptorium timeout.
- Session files must be concrete; unresolved `{{ ... }}` placeholders fail load. - Session files must be concrete; unresolved `{{ ... }}` placeholders fail load.
- Session and party inputs inspected before typed loading are limited to 8 MiB.
- Pipeline defaults are applied before validation. - Pipeline defaults are applied before validation.
- Defaults apply only to absent fields. Explicit empty strings, zero values, - Defaults apply only to absent fields. Explicit empty strings, zero values,
`false`, and `null` retain ConfigKit's typed meaning and are then checked by `false`, and `null` retain ConfigKit's typed meaning and are then checked by
@@ -125,71 +124,60 @@ remote state with an unsafe legacy identity must be migrated before use.
Explicit null optional stage sections stay absent, while required sections Explicit null optional stage sections stay absent, while required sections
fail validation. fail validation.
- Campaign and session identities must agree. - Campaign and session identities must agree.
- Required stable files (`speakers_file`, `autocorrect_file`, `glossary_file`, - The campaign supplies required speakers, autocorrect, and canonical party
`party_file`) are campaign-owned; the first three may be overridden by the files. Sessions may independently override speakers and autocorrect.
session. The optional `spell_catalog_file` also inherits a campaign value Optional glossary selections and the separate spell overlay inherit as
when omitted by the session. described under [glossary inputs](#glossary-inputs).
- `party_file` is parsed when pipeline and campaign configuration are combined. - The selected party is parsed when domain context or party inspection needs
It must be a versioned [canonical party](integrations/party.md), is it. It must be a versioned [canonical party](integrations/party.md). The
campaign-owned and derives the players input internally. `players_file` and campaign supplies its default file; an explicit CLI selection replaces it
for the invocation and supplies the derived players input. `players_file` and
session `party_file` are unsupported configuration keys. session `party_file` are unsupported configuration keys.
- Exactly one audio mode must be configured in session input: - Exactly one audio mode must be configured in session input:
- local (`audio_dir` or `audio_files`), or - local (`audio_dir` or `audio_files`), or
- S3 (`audio_s3.prefix`). - S3 (`audio_s3.prefix`).
### Pipeline imports and profiles ### Pipeline imports and overlays
Large pipeline configurations may be split into explicitly named fragments and Narratio uses ConfigKit v1.4.0 for imports, composition, inheritance, and
may use fixed-path profile overlays: pipeline overlays. The [ConfigKit configuration contract](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md)
owns their syntax and semantics; the [maintained bundle](../examples/production-testing/pipeline.yml)
shows a complete Narratio configuration. Only the pipeline selects an overlay;
Narratio validates the resulting effective domain entries.
```yaml Relative host-resource paths, including integration configuration files,
configkit: workspace/campaign/spool/cache roots, campaign template and stable inputs, and
imports: session stable inputs and local audio references, resolve from the effective
- path: config/storage.yml value's defining source. Inherited values follow their origin. When no distinct
- path: config/integrations.yaml usable source context exists, the main source is the fallback; if it too is
contextless, the invocation directory is used. Explicit CLI-relative file paths
use the invocation directory. Artifact outputs, publish destinations, logical
IDs, and binary names retain their domain meanings.
campaigns: The effective digest excludes source layout, overlay identity, and secret values;
root: /usr/local/share/narratio/campaigns credential reference names and resolved resource paths participate. Prepared
``` campaign, session, and party documents contain effective standalone values rather
than authored import directives. Session fields omitted by the author remain
eligible to inherit the receiving campaign's values.
The maintained [production/testing bundle](../examples/production-testing/pipeline.yml) ### Upgrade from earlier configuration
is a complete copyable example of this structure, including canonical-party
artifact families.
Imports are resolved relative to the directory containing the root pipeline - Rename source-root `configkit:` controls to `config:`. Nested `config` data
file and are loaded in declaration order. Narratio does not scan directories or and the Go `configkit` package and secret tags have different meanings.
infer fragments. Each import must be a confined regular `.yml` or `.yaml` file: - Rename or move pipeline files to the discovery names above, or retain a custom
absolute paths, traversal, symlinks, directories, duplicate files, and an filename such as `pipeline.yml` and pass it with `--config`.
import of the root pipeline itself are rejected. Imported files cannot declare - Remove `--secrets-dir` from invocations and configure the pipeline main file
another `configkit` control section. as described in [Secrets Handling](#secrets-handling), or provision environment values.
- Review relative resource references moved into fragments: their defining
source now supplies the base. Mark necessary imports `required: true`.
- Review lists and use `config.sequences` where append or whole-record upsert is
intended. Verify the effective result with the inspection commands.
- Prepared documents contain effective values; retain authored roots and their
companions separately for editing. Separately installed downstream tools own
their own configuration migrations.
Base merging is additive. A map may be extended by multiple files when every These control-key changes require a major version for the eventual Narratio
leaf is distinct, but a scalar, list, or map/list/scalar kind cannot be claimed release. This migration does not itself publish a release.
more than once, even when the repeated values are identical. Conflict errors
name the full field path and every source that claimed it. Narratio additionally
rejects an artifact or artifact-family key declared by more than one base file,
even when those files contribute disjoint children.
Profile names are case-sensitive and use ConfigKit's safe fixed-path naming
rules. Only the selected overlay is opened; a malformed unselected overlay does
not affect a base or different-profile load. Maps merge recursively, overlay
scalars replace base scalars, and overlay lists replace base lists completely.
Explicit `false`, zero, empty strings, empty containers, and null values remain
explicit inputs and are not refilled by defaults. Profiles cannot inherit,
stack, import files, or declare another ConfigKit control section.
During ConfigKit loading, Narratio applies fresh typed defaults, recorded
entry-level defaults and normalization, read-only file-local validation, and
ordinary path resolution before computing a deterministic effective
configuration digest. The digest represents the normalized, secret-free
runtime pipeline mapping; it excludes ConfigKit directives, source
provenance, profile identity, and raw environment secret values. Equivalent
effective mappings therefore have the same digest regardless of how fields are
split among the root and imports.
An imported field has the same meaning it would have in a monolithic root
pipeline. In particular, ordinary relative pipeline paths continue to resolve
from the root pipeline directory, not from the importing fragment's directory.
## Minimal Working Configuration ## Minimal Working Configuration
@@ -224,32 +212,31 @@ inputs:
## Secrets Handling ## Secrets Handling
- Do not place raw secrets in YAML. Credential fields contain environment-variable names as ConfigKit typed secret
- Credential fields contain environment-variable names, represented internally references. Each surviving reference must resolve to a nonempty value when the
as ConfigKit typed secret references (for example pipeline loads, including for disabled integrations or stages outside the run.
`pipeline.notarius.llm_api_key: NOTARIUS_LLM_API_KEY`). A configured reference Do not put raw secret values in YAML.
must resolve to a nonempty environment value during load.
- Every surviving reference is resolved during ordinary pipeline loading, A pipeline main file can select configured bootstrap before its typed load:
regardless of whether its integration is disabled, outside the selected
stage range, or eligible for resume. Omit the field or set it to `null` when ```yaml
that deployment should not require the credential. config:
- Every command that loads a pipeline accepts `--secrets-dir <path>`. When the secrets_dir: secrets
flag is omitted, Narratio uses a present `secrets/` directory beside the ```
resolved root `pipeline.yml`; an absent conventional directory is ignored.
Explicit relative paths are resolved from the caller's working directory, Narratio passes the selected pipeline source to ConfigKit's configured bootstrap,
and a missing or empty explicit selection is an error. then loads the returned prepared source. Without a directory declaration,
- Each immediate regular file whose name is a valid environment-variable name credentials may be supplied in the process environment. Narratio no longer
supplies one value. ConfigKit removes trailing CR/LF, permits a symlink as the accepts `--secrets-dir` or probes a conventional directory automatically. See
selected directory, rejects non-hidden symlink entries, and limits input to [ConfigKit's configured-startup contract](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md#explicit-secrets-directory-bootstrap)
1 MiB per file, 8 MiB total, and 1024 entries. Dot-prefixed entries (including for path rules, environment precedence and overwrite controls.
files, directories, and symlinks) are ignored and omitted from bootstrap
reports, but still count toward the directory entry limit. Each pipeline acquisition prepares its own source; an already acquired result is
- An existing process environment value takes precedence over a credential file. reused. Comparisons use ordinary acquisition on each reached side and share the
- On POSIX, operators must provision the directory with no group/other access process environment. Direct local campaign, session, and party inspection does
(normally `0700`) and files with no group/other access (normally `0600`); not load a pipeline solely for bootstrap. Bootstrap reports and diagnostics are
ConfigKit validates type and bounds but does not enforce permission modes. safe, final stderr output, separate from command reports. Protect provisioned
- Bootstrap happens once per command, before any configuration load or adapter secret directories and files from access by other users.
construction. Safe reports contain filenames, paths, and statuses, never values.
## Publish Configuration Summary ## Publish Configuration Summary
@@ -291,7 +278,9 @@ Rules:
| Field | Type | Required | Default / Rule | | Field | Type | Required | Default / Rule |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| `configkit.imports[].path` | string | No | explicit additive pipeline fragment relative to the root pipeline directory; `.yml` or `.yaml` regular files only | | `config.imports` | list | No | native source-root import selections; see [imports and overlays](#pipeline-imports-and-overlays) |
| `pipeline.reference_catalog.settings` | map[string]string | No | setting IDs to source-relative vocabulary files |
| `pipeline.reference_catalog.systems` | map[string]string | No | system IDs to source-relative vocabulary files |
| `pipeline.workspace.root` | string | No | `/var/lib/narratio` | | `pipeline.workspace.root` | string | No | `/var/lib/narratio` |
| `pipeline.workspace.cleanup_after_publish` | bool | No | `false`; selects the published run's workspace target for final cleanup and requires effective `pipeline.publish.enabled=true` and `pipeline.publish.upload_run=true` | | `pipeline.workspace.cleanup_after_publish` | bool | No | `false`; selects the published run's workspace target for final cleanup and requires effective `pipeline.publish.enabled=true` and `pipeline.publish.upload_run=true` |
| `pipeline.campaigns.root` | string | No | `/usr/local/share/narratio/campaigns` | | `pipeline.campaigns.root` | string | No | `/usr/local/share/narratio/campaigns` |
@@ -331,19 +320,14 @@ Rules:
| `pipeline.seriatim.env.filler_max_duration` | float | No | unset | | `pipeline.seriatim.env.filler_max_duration` | float | No | unset |
| `pipeline.audita.binary` | string | No | `audita` | | `pipeline.audita.binary` | string | No | `audita` |
| `pipeline.audita.timeout` | duration | No | `3h` | | `pipeline.audita.timeout` | duration | No | `3h` |
| `pipeline.audita.llm_api_key` | secret reference | No | unset | | `pipeline.audita.credentials[]` | list[secret reference] | No | empty; exact environment-variable names forwarded to Audita |
| `pipeline.audita.modules[]` | list[string] | No | empty | | `pipeline.audita.debug` | bool | No | `false`; true requests Audita debug capture |
| `pipeline.audita.base_url` | string | No | empty | | `pipeline.audita.overlay` | string | No | empty; no downstream overlay override |
| `pipeline.audita.model` | string | No | empty | | `pipeline.audita.proposal_profile` | string | No | empty; no downstream proposal-profile override |
| `pipeline.audita.total_llm_concurrency` | int | No | unset | | `pipeline.audita.validation_profile` | string | No | empty; no downstream validation-profile override |
| `pipeline.audita.proposal_llm_concurrency` | int | No | unset |
| `pipeline.audita.validation_model` | string | No | empty |
| `pipeline.audita.validation_llm_concurrency` | int | No | unset |
| `pipeline.audita.transcript_description` | string | No | empty | | `pipeline.audita.transcript_description` | string | No | empty |
| `pipeline.audita.config_path` | string | No | empty | | `pipeline.audita.config_path` | string | No | empty |
| `pipeline.audita.output_schema` | string | No | empty | | `pipeline.audita.output_schema` | string | No | empty |
| `pipeline.audita.work_dir_retention` | string | No | empty |
| `pipeline.audita.report` | bool | No | `true` |
| `pipeline.normalize.output_path` | string | No | `transcripts/final.json` | | `pipeline.normalize.output_path` | string | No | `transcripts/final.json` |
| `pipeline.normalize.output_schema` | string | No | `seriatim-intermediate` | | `pipeline.normalize.output_schema` | string | No | `seriatim-intermediate` |
| `pipeline.normalize.report` | bool | No | `true` | | `pipeline.normalize.report` | bool | No | `true` |
@@ -359,11 +343,12 @@ Rules:
| `pipeline.trim.seriatim.report` | bool | No | `false` | | `pipeline.trim.seriatim.report` | bool | No | `false` |
| `pipeline.notarius.enabled` | bool | No | `false` | | `pipeline.notarius.enabled` | bool | No | `false` |
| `pipeline.notarius.binary` | string | No | `notarius` | | `pipeline.notarius.binary` | string | No | `notarius` |
| `pipeline.notarius.llm_api_key` | secret reference | No | unset; exact environment-variable name forwarded to Notarius | | `pipeline.notarius.credentials[]` | list[secret reference] | No | empty; exact environment-variable names forwarded to Notarius |
| `pipeline.notarius.config_path` | string | Conditional | required when enabled; relative paths resolve from the pipeline file directory | | `pipeline.notarius.config_overlay` | string | No | unset; exact Notarius ConfigKit overlay selector |
| `pipeline.notarius.config_path` | string | Conditional | required when enabled; relative paths resolve from their defining source |
| `pipeline.notarius.pipeline_id` | string | Conditional | required when enabled | | `pipeline.notarius.pipeline_id` | string | Conditional | required when enabled |
| `pipeline.notarius.timeout` | duration | No | `3h`; must be positive | | `pipeline.notarius.timeout` | duration | No | `3h`; must be positive |
| `pipeline.notarius.working_directory` | string | No | directory containing resolved `config_path`; relative paths resolve from the pipeline file directory | | `pipeline.notarius.working_directory` | string | No | directory containing resolved `config_path`; relative paths resolve from their defining source |
| `pipeline.notarius.resume` | bool | No | `false`; request compatible Notarius checkpoint reuse during ordinary executed extraction | | `pipeline.notarius.resume` | bool | No | `false`; request compatible Notarius checkpoint reuse during ordinary executed extraction |
| `pipeline.notarius.chunk_cache` | string | No | empty; when set, exactly `auto`, `bypass`, or `refresh` | | `pipeline.notarius.chunk_cache` | string | No | empty; when set, exactly `auto`, `bypass`, or `refresh` |
| `pipeline.notarius.references` | map[string]string | No | empty; maps normalized Notarius selectors to supported prepared Narratio source IDs; maximum 256 entries | | `pipeline.notarius.references` | map[string]string | No | empty; maps normalized Notarius selectors to supported prepared Narratio source IDs; maximum 256 entries |
@@ -375,6 +360,7 @@ Rules:
| `pipeline.render.include_segment_ids` | bool | No | `true` | | `pipeline.render.include_segment_ids` | bool | No | `true` |
| `pipeline.render.include_metadata` | bool | No | `false` | | `pipeline.render.include_metadata` | bool | No | `false` |
| `pipeline.scriptorium.binary` | string | No | `scriptorium` | | `pipeline.scriptorium.binary` | string | No | `scriptorium` |
| `pipeline.scriptorium.credentials[]` | list[secret reference] | No | empty; exact environment-variable names forwarded to Scriptorium |
| `pipeline.scriptorium.config_path` | string | No | empty | | `pipeline.scriptorium.config_path` | string | No | empty |
| `pipeline.scriptorium.timeout` | duration | No | `10m` | | `pipeline.scriptorium.timeout` | duration | No | `10m` |
| `pipeline.scriptorium.render_debug` | bool | No | `false` | | `pipeline.scriptorium.render_debug` | bool | No | `false` |
@@ -382,30 +368,86 @@ Rules:
| `pipeline.scriptorium.artifact_families` | map | No | empty; expands one ordinary artifact per canonical party character | | `pipeline.scriptorium.artifact_families` | map | No | empty; expands one ordinary artifact per canonical party character |
| `pipeline.notification.mode` | string | No | `noop`; the only supported notification mode until a provider is implemented | | `pipeline.notification.mode` | string | No | `noop`; the only supported notification mode until a provider is implemented |
### Notarius Credential ### Audita Selection and Credentials
`pipeline.notarius.llm_api_key` optionally names the one environment variable `pipeline.audita.config_path` optionally selects an Audita v4.2 configuration;
otherwise Audita uses native discovery. `overlay`, `proposal_profile`, and
`validation_profile` independently select downstream settings. Empty values
add no override. Narratio does not create Audita configuration or infer its
selectors from a Narratio overlay. Configure the ordered Audita pipeline in
Audita itself; the retired `pipeline.audita.modules` field is rejected. See
[Audita's configuration guide](https://forge.maximumdirect.net/eric/audita/src/tag/v4.2.0/docs/config.md)
and the [integration contract](integrations/audita.md). `debug: true` requests
Audita debug capture; false or omission adds no debug override. Debug alone does
not invalidate a completed polish result.
`pipeline.audita.credentials` contains exact environment-variable references,
not values. Narratio resolves each name at pipeline load and forwards its value
under the same name. Supply every credential required by the selected Audita
configuration. Omission, `null`, or `[]` forwards nothing; a Narratio overlay
replaces the list. Captured diagnostics redact those values.
<a id="notarius-configuration-profile"></a>
### Notarius Configuration Overlay
Migration: rename `pipeline.notarius.config_profile` to `config_overlay`.
The old field is rejected; there is no compatibility alias. For Notarius v0.8+
move selected downstream files from `profiles/` to `overlays/` beside its root
configuration. This does not rename PromptKit LLM profiles.
The renamed selector also changes extraction resume evidence for named
selections: their existing extraction is regenerated on the next applicable
run, with normal dependent invalidation. Omitted/base selections do not acquire
a new invalidation solely from this rename.
`pipeline.notarius.config_overlay` optionally selects a Notarius ConfigKit
configuration overlay when extraction executes:
```yaml
notarius:
config_overlay: downstream-economy
```
When the field is omitted or `null`, Narratio supplies no downstream overlay
selector and preserves Notarius's existing configuration-selection behavior.
When present, Narratio forwards the exact string to Notarius, including an
empty string or `default`, which explicitly select Notarius's composed base
configuration. Notarius owns selector interpretation and validation; Narratio
does not restrict overlay names, resolve overlay files, or rewrite the value.
This selection is independent of Narratio's own `--overlay` selection. A
Narratio overlay may explicitly select a differently named Notarius overlay,
but Narratio never forwards its own overlay name automatically. It is also
independent of `pipeline.notarius.credentials`: an overlay may change either or
both fields according to the deployed Notarius configuration. See the
[Notarius integration contract](./integrations/notarius.md) for invocation and
failure behavior.
### Notarius Credentials
`pipeline.notarius.credentials` optionally lists environment-variable names
to forward to the Notarius child process: to forward to the Notarius child process:
```yaml ```yaml
notarius: notarius:
llm_api_key: OPENROUTER_API_KEY credentials: [OPENROUTER_API_KEY, ANTHROPIC_API_KEY]
``` ```
The field contains the variable name, not a credential value. That name must The list contains variable names, not credential values. Those names must
match `api_key_env` in the Notarius/PromptKit profile selected by the deployed match the references used by the Notarius/PromptKit profiles that Notarius
Notarius pipeline; Narratio does not infer or remap provider names. Omission or loads. Notarius owns profile lookup; Narratio neither infers those names nor
`null` forwards nothing. A non-null selected reference must resolve at pipeline remaps them. Omission, `null`, or `[]` forwards nothing. Each selected reference
load time through the process environment or existing secrets-directory must resolve at pipeline load time through the process environment or existing
bootstrap, even when Notarius is disabled, extract is outside the requested secrets-directory bootstrap, even when Notarius is disabled, extract is outside
range, or a completed extraction can be reused. the requested range, or a completed extraction can be reused.
The Notarius child receives only Narratio's minimal execution environment plus The Notarius child receives only Narratio's minimal execution environment plus
this exact selected name and loaded value. Other credentials are not forwarded. these exact selected names and loaded values. Other credentials are not forwarded.
Changing the value, name, presence, or absence does not invalidate extract's Changing a value, name, presence, or absence does not invalidate extract's
semantic resume evidence. The public name remains part of safe effective semantic resume evidence. The public names remain part of safe effective
inspection, so renaming it may appear in `config diff` and change the effective inspection, so renaming them may appear in `config diff` and change the effective
configuration digest; rotating only its value does neither. configuration digest; rotating only their values does neither. An overlay
replaces the whole list, including with `[]` to clear it.
See the [Notarius integration contract](./integrations/notarius.md) for the See the [Notarius integration contract](./integrations/notarius.md) for the
delivery and redaction boundary. delivery and redaction boundary.
@@ -432,14 +474,17 @@ Narratio source, not to a filesystem path:
```yaml ```yaml
notarius: notarius:
references: references:
glossary: narratio.input.glossary glossary: narratio.input.glossary.campaign
party: narratio.input.party party: narratio.input.party
players: narratio.input.players players: narratio.input.players
spell_catalog: narratio.input.spell_catalog spell_catalog: narratio.input.spell_catalog
``` ```
Supported sources are `narratio.input.party`, `narratio.input.players`, Supported sources are `narratio.input.party`, `narratio.input.players`,
`narratio.input.glossary`, and `narratio.input.spell_catalog`. Each map entry is `narratio.input.glossary.party`, `narratio.input.glossary.campaign`,
`narratio.input.glossary.setting`, `narratio.input.glossary.spells`, and
`narratio.input.spell_catalog`. The retired `narratio.input.glossary` is not an
alias; update each binding explicitly. Each map entry is
required by its presence: omit a binding when the selected Notarius pipeline required by its presence: omit a binding when the selected Notarius pipeline
does not need it. A spell-catalog binding additionally requires an effective does not need it. A spell-catalog binding additionally requires an effective
campaign or session `spell_catalog_file`. campaign or session `spell_catalog_file`.
@@ -482,6 +527,26 @@ contract-incompatible lane fails extraction. See the
current ten-lane D&D mapping and the [Notarius contract](./integrations/notarius.md) current ten-lane D&D mapping and the [Notarius contract](./integrations/notarius.md)
for compatibility ownership. for compatibility ownership.
### Scriptorium Credentials
Set `scriptorium.credentials: [OPENROUTER_API_KEY]` in the pipeline file to
forward that provider key to Scriptorium. List additional provider names only
when the selected downstream configuration needs them. The same list applies
to requirements inspection, trim bounds generation, analysis (including
character families), and their render-debug calls. Scriptorium retains
provider/profile selection; Narratio does not pass a model-request
`--api-key-env` override.
As with Audita and Notarius, names are ConfigKit secret references resolved at
pipeline load time using the configured bootstrap and environment,
even when no Scriptorium stage executes. Omitted, null, or empty lists forward
nothing. An overlay replaces the entire list; `[]` clears it. Captured values
are forwarded under their exact names and registered for diagnostic redaction.
Inspection and generated metadata contain names only. Credential changes do
not invalidate completed trim or analysis work; rotating values also leaves
the effective configuration digest unchanged. Other environment variables
retain the shared minimal subprocess inheritance rules.
### Scriptorium Artifact Entries ### Scriptorium Artifact Entries
For each `pipeline.scriptorium.artifacts.<name>`: For each `pipeline.scriptorium.artifacts.<name>`:
@@ -499,6 +564,9 @@ For each `pipeline.scriptorium.artifacts.<name>`:
| `vars` | map | No | values must be string or bool; `session_id` is reserved and overwritten by Narratio | | `vars` | map | No | values must be string or bool; `session_id` is reserved and overwritten by Narratio |
Narratio adds `session_id=narratio-session-<session_id>` to every Scriptorium request for sticky upstream LLM routing. If an artifact config sets `vars.session_id`, Narratio replaces that value before invoking Scriptorium. Use a different variable name if a prompt needs the raw Narratio session ID as content. Narratio adds `session_id=narratio-session-<session_id>` to every Scriptorium request for sticky upstream LLM routing. If an artifact config sets `vars.session_id`, Narratio replaces that value before invoking Scriptorium. Use a different variable name if a prompt needs the raw Narratio session ID as content.
Discovery, preview, and generation receive the same effective variables,
including family member values and explicitly empty strings. Narratio forwards
the sticky value as a template variable, not as a direct session override.
Without `--artifacts`, analyze executes enabled configured artifacts. With an Without `--artifacts`, analyze executes enabled configured artifacts. With an
explicit `--artifacts` list, the exact named configured artifacts are the explicit `--artifacts` list, the exact named configured artifacts are the
@@ -517,6 +585,13 @@ For each artifact input `pipeline.scriptorium.artifacts.<name>.inputs.<input_nam
| `source` | string | Yes | built-in runtime source, prepared input source, `narratio.extraction.<name>`, `narratio.artifact.<name>`, or `narratio.previous_session.artifact.<name>` | | `source` | string | Yes | built-in runtime source, prepared input source, `narratio.extraction.<name>`, `narratio.artifact.<name>`, or `narratio.previous_session.artifact.<name>` |
| `required` | bool | No | optional input requirement | | `required` | bool | No | optional input requirement |
The input map key is the prompt input name; `source` identifies the Narratio
artifact that supplies it. Requirements discovery compares exact input names
with these keys before generated files exist. A required prompt input bound to
an optional source produces a warning when availability is unknown; runtime
resolution may still omit the source. See
[prompt preflight](operations.md#prompt-requirements-preflight).
`artifact` and `path` are obsolete and rejected by strict configuration `artifact` and `path` are obsolete and rejected by strict configuration
loading. Use the canonical `source` identifier to select the input; Narratio loading. Use the canonical `source` identifier to select the input; Narratio
does not provide adapter-specific input passthrough fields. does not provide adapter-specific input passthrough fields.
@@ -524,19 +599,19 @@ does not provide adapter-specific input passthrough fields.
Each `narratio.artifact.<name>` input source automatically contributes an Each `narratio.artifact.<name>` input source automatically contributes an
effective dependency on that configured artifact. Narratio unions these inferred effective dependency on that configured artifact. Narratio unions these inferred
edges with explicit `depends_on` entries, then trims, deduplicates, and sorts the edges with explicit `depends_on` entries, then trims, deduplicates, and sorts the
result during final configuration resolution. Authors use `depends_on` only for result during domain catalog derivation. Authors use `depends_on` only for
ordering constraints that are not already expressed by an artifact input. ordering constraints that are not already expressed by an artifact input.
Use [`narratio config artifacts`](./cli.md#config-validate-config-show-config-sources-config-artifacts-and-config-diff) Use [`narratio artifacts list`](./cli.md#artifacts-list)
to inspect keys, definition sources, outputs, and effective dependencies without to inspect keys, definition sources, outputs, and effective dependencies without
loading a session or creating runtime state. loading a session or creating runtime state.
### Scriptorium Artifact Families ### Scriptorium Artifact Families
`pipeline.scriptorium.artifact_families` declares a shared artifact template `pipeline.scriptorium.artifact_families` declares a shared artifact template
for every canonical campaign character. Configuration resolution expands each for every canonical campaign character. Domain catalog derivation expands each
family into ordinary `pipeline.scriptorium.artifacts` entries before analyze family into separate concrete artifact entries before analyze planning or
planning or Scriptorium invocation. Party parsing rejects unsupported document Scriptorium invocation, retaining the authored declarations in configuration.
schemas before family expansion. Party parsing rejects unsupported document schemas before family expansion.
For each `pipeline.scriptorium.artifact_families.<name>`: For each `pipeline.scriptorium.artifact_families.<name>`:
@@ -547,7 +622,11 @@ For each `pipeline.scriptorium.artifact_families.<name>`:
| `output_path_pattern` | string | Yes | safe path beneath `artifacts/` with exactly one `{character_id}` token and no other brace syntax | | `output_path_pattern` | string | Yes | safe path beneath `artifacts/` with exactly one `{character_id}` token and no other brace syntax |
| `member_vars` | map | No | maps an ordinary Scriptorium variable name to a supported canonical character selector | | `member_vars` | map | No | maps an ordinary Scriptorium variable name to a supported canonical character selector |
| `member_dependencies` | list | No | unique family keys; each generated member depends on the corresponding generated member of each listed family | | `member_dependencies` | list | No | unique family keys; each generated member depends on the corresponding generated member of each listed family |
| `publish` | map | No | typed family publish policy (`enabled`, `required`, `dest_pattern`) expanded into concrete publish outputs when enabled | | `publish` | map | No | typed family publish policy (`enabled`, `required`, `dest_pattern`) validated against effective `pipeline.publish` settings and expanded into concrete publish outputs when enabled |
An enabled family publish declaration is validated against the effective
`pipeline.publish` configuration, including its defaults; it does not require
an explicit `publish.enabled` declaration in the same source file.
Generated keys are `<family>_<character_id>` and generated output paths must Generated keys are `<family>_<character_id>` and generated output paths must
not collide with explicit artifacts or another generated artifact. Families not collide with explicit artifacts or another generated artifact. Families
@@ -584,10 +663,42 @@ integration.
| `session_template_file` | string | No | used by `session init` when set | | `session_template_file` | string | No | used by `session init` when set |
| `inputs.speakers_file` | string | Yes | stable input default | | `inputs.speakers_file` | string | Yes | stable input default |
| `inputs.autocorrect_file` | string | Yes | stable input default | | `inputs.autocorrect_file` | string | Yes | stable input default |
| `inputs.glossary_file` | string | Yes | stable input default | | `inputs.setting` | string | No | selected setting ID in `reference_catalog.settings` |
| `inputs.party_file` | string | Yes | stable campaign party source; relative paths resolve from `campaign.yml` | | `inputs.system` | string | No | selected system ID in `reference_catalog.systems` |
| `inputs.glossary_file` | string | No | campaign vocabulary file |
| `inputs.glossary` | mapping | No | inline campaign collection contribution |
| `inputs.party_file` | string | Yes | stable campaign party source; relative paths resolve from their defining source |
| `inputs.spell_catalog_file` | string | No | optional spell-catalog overlay default; required when a Notarius reference selects `narratio.input.spell_catalog` | | `inputs.spell_catalog_file` | string | No | optional spell-catalog overlay default; required when a Notarius reference selects `narratio.input.spell_catalog` |
### Glossary Inputs
Install an independently selected catalog locally and import its `catalog.yml`
into the pipeline; [the example](../examples/pipeline.catalog.yml) uses a small
synthetic bundle. Catalog IDs map to file paths relative to their defining
configuration sources. Only selected files are read; an unknown selected ID is
an error. Catalog files and their native imports are resolved with ConfigKit.
Campaigns can select `setting`, `system`, `glossary_file`, and inline `glossary`
independently. Session omissions inherit each campaign value independently;
null or empty optional selectors clear that selection. Session inline data
replaces the campaign inline contribution as a whole, and explicit null removes
it. The selected campaign file is composed below the effective inline
contribution using native ConfigKit entry identity and list controls.
Files contain named collections: campaign files provide `campaign`, selected
setting files provide `setting`, and system files provide `spells`. Preparation
derives `party` from the canonical roster and writes all four collections, even
when empty. The [catalog format](https://forge.maximumdirect.net/eric/narratio-reference-catalog/src/branch/main/FORMAT.md)
owns the shared schema; [examples](../examples/README.md#campaign-and-session-configuration)
show file-only, inline-only, and combined authoring. The former standalone
glossary format is not converted automatically.
All four prepared entry lists are supplied to Audita and replace the matching
Audita-configured lists, including when empty. Other collections and omitted
instruction fields follow Audita's native composition. The canonical roster,
players projection, and optional Notarius spell-catalog overlay remain separate
inputs. Configuration inspection preserves authored selections and inline data.
### Session ### Session
| Field | Type | Required in session file | Notes | | Field | Type | Required in session file | Notes |
@@ -599,8 +710,11 @@ integration.
| `title` | string | No | metadata | | `title` | string | No | metadata |
| `inputs.speakers_file` | string | No | overrides campaign stable input | | `inputs.speakers_file` | string | No | overrides campaign stable input |
| `inputs.autocorrect_file` | string | No | overrides campaign stable input | | `inputs.autocorrect_file` | string | No | overrides campaign stable input |
| `inputs.glossary_file` | string | No | overrides campaign stable input | | `inputs.setting` | string | No | independently overrides the campaign setting selection |
| `inputs.spell_catalog_file` | string | No | overrides the optional campaign spell catalog; empty or omitted inherits the campaign value | | `inputs.system` | string | No | independently overrides the campaign system selection |
| `inputs.glossary_file` | string | No | independently overrides the campaign vocabulary file |
| `inputs.glossary` | mapping | No | replaces the campaign's inline contribution |
| `inputs.spell_catalog_file` | string | No | omission inherits the campaign spell catalog; an explicit empty string clears this optional input |
| `inputs.audio_dir` | string | Conditional | local audio mode | | `inputs.audio_dir` | string | Conditional | local audio mode |
| `inputs.audio_files[]` | list[string] | Conditional | local audio mode | | `inputs.audio_files[]` | list[string] | Conditional | local audio mode |
| `inputs.audio_s3.prefix` | string | Conditional | S3 audio mode | | `inputs.audio_s3.prefix` | string | Conditional | S3 audio mode |

View File

@@ -10,10 +10,40 @@ polished transcripts and generated artifacts. Start with the
[Architecture](policy/architecture.md) for normative system boundaries, and the [Architecture](policy/architecture.md) for normative system boundaries, and the
[Internal Overview](internal/overview.md) for implemented component ownership. [Internal Overview](internal/overview.md) for implemented component ownership.
Agents must read [Agent Policy](policy/agents.md) before recommending, planning,
or implementing changes. It owns implementation discipline and the default
commit-after-completed-work rule; it does not authorize pushing or releasing.
Narratio integrates [ConfigKit v1.4.0](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/consumers/README.md), [CommandKit v0.8.0](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/docs/consumers/guide.md), and [ReleaseKit v0.10.0](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/consumers/adoption.md); their guides own upstream APIs and behavior.
## Go Prerequisite ## Go Prerequisite
Maintained development and verification require Go 1.26. Use the official Go The Go consumer minimum is 1.27.0, declared in `go.mod`. Maintained development
1.26 toolchain before running repository commands. and verification use the official Go 1.27.4 toolchain. Release validation and
builds use the selected patch version and setup instructions in the
[release procedure](release.md#release-toolchain).
## Policy Reading Guide
| Policy | Read before… |
| --- | --- |
| [Policy set provenance](policy/meta.md) | Adopting policies, checking upstream revisions, or updating the adopted policy set. |
| [Agents](policy/agents.md) | Recommending, planning, or implementing repository changes. |
| [Architecture](policy/architecture.md) | Planning or changing application code or its structure. |
| [Testing](policy/testing.md) | Selecting validation for code changes, or adding, changing, removing, or evaluating tests. |
| [Documentation](policy/documentation.md) | Writing, revising, or reorganizing documentation. |
| [OSS](policy/oss.md) | Adding or updating dependencies or incorporated third-party material, or changing licensing or attribution. |
| [Release](policy/release.md) | Preparing or publishing a release, changing release procedures, or making versioning and compatibility decisions. |
- Read applicable policies before making decisions they govern; multiple policies
may apply.
- Select policies using the task triggers above. Follow cross-references to
relevant sections when needed to resolve a concrete question.
- Reuse policies already available in context; reread when changed or no longer
available.
- Expand reading when the task's scope expands.
- When revising a policy itself, read that policy and any provisions elsewhere
affected by the revision.
## What To Read ## What To Read
@@ -30,7 +60,7 @@ Maintained development and verification require Go 1.26. Use the official Go
| Adapters or external tool contracts | [Adapter Internals](internal/adapters.md) and [Integration Contracts](integrations/README.md) | The internal guide owns adapter composition and mechanics; integration documents own external formats and protocols. | | Adapters or external tool contracts | [Adapter Internals](internal/adapters.md) and [Integration Contracts](integrations/README.md) | The internal guide owns adapter composition and mechanics; integration documents own external formats and protocols. |
| Manifests, artifacts, workspace paths, or publish behavior | [Manifest Internals](internal/manifest.md), [Artifact Internals](internal/artifacts.md), [Workspace Internals](internal/workspace.md), [Publish Internals](internal/stage-publish.md), and [Operations](operations.md) | These separate implementation state and resolution from operator-visible layout and lifecycle. | | Manifests, artifacts, workspace paths, or publish behavior | [Manifest Internals](internal/manifest.md), [Artifact Internals](internal/artifacts.md), [Workspace Internals](internal/workspace.md), [Publish Internals](internal/stage-publish.md), and [Operations](operations.md) | These separate implementation state and resolution from operator-visible layout and lifecycle. |
| Maintained configuration or input examples | [Configuration](config.md) and [Examples](../examples/README.md) | The reference owns field meanings; the examples directory owns complete copyable files. | | Maintained configuration or input examples | [Configuration](config.md) and [Examples](../examples/README.md) | The reference owns field meanings; the examples directory owns complete copyable files. |
| Preparing, validating, or publishing a release | [Release Procedure](release.md) | The maintainer procedure owns version selection, candidate validation, guarded tag publication, and optional later CI inspection. | | Preparing, validating, or publishing a release | [Release Policy](policy/release.md) and [Release Procedure](release.md) | Policy owns requirements; the procedure owns concrete validation, guarded publication, and optional later inspection. |
| Proposed or unimplemented behavior | `docs/roadmap/` | Future work belongs only in roadmap documentation until implemented. | | Proposed or unimplemented behavior | `docs/roadmap/` | Future work belongs only in roadmap documentation until implemented. |
For an existing subsystem, also inspect its focused tests and package-level For an existing subsystem, also inspect its focused tests and package-level
@@ -38,23 +68,24 @@ contracts before changing behavior.
## Validation ## Validation
Use focused package tests while iterating. Every pull request and push runs the Use focused package tests while iterating. Push and pull-request CI runs these
following repository-wide checks before it can be accepted: repository-wide checks and cross-builds the declared targets:
```sh ```sh
go test ./... go test ./...
go test -race ./... go test -race ./...
go vet ./... go vet ./...
go build ./... go build ./...
go test ./internal/doccheck
go test ./internal/config -run '^TestExamplesLoadAndValidate$'
``` ```
The documentation check verifies local Markdown links and the dependency graph The full suite includes documentation-link and Woodpecker dependency checks
of the Woodpecker workflows. The configuration check loads every maintained and loads maintained pipeline and session examples. For focused diagnosis,
pipeline and session example. Tag CI reuses this validation path before its run `go test ./internal/doccheck` or
asynchronous asset publication; the maintainer release boundary is documented `go test ./internal/config -run '^TestExamplesLoadAndValidate$'` directly;
in the [Release Procedure](release.md). these are available developer tools, not additional CI steps. Tag CI delivers assets asynchronously from the tagged source; it does not
repeat candidate validation. The normal maintainer
entry point is the single publication command in the
[Release Procedure](release.md).
Woodpecker also runs `go test -race -shuffle=on -count=3 ./...` on its scheduled Woodpecker also runs `go test -race -shuffle=on -count=3 ./...` on its scheduled
job to expose ordering and repeatability defects. Current runners cross-compile job to expose ordering and repeatability defects. Current runners cross-compile

View File

@@ -23,8 +23,8 @@ focused stage documents.
discovery (`notarius run`). discovery (`notarius run`).
- [Party](./party.md): canonical campaign roster input. - [Party](./party.md): canonical campaign roster input.
- [Seriatim](./seriatim.md): merge, normalize, trim, and render operations. - [Seriatim](./seriatim.md): merge, normalize, trim, and render operations.
- [Scriptorium](./scriptorium.md): artifact generation and debug rendering - [Scriptorium](./scriptorium.md): artifact generation, prepared previews, and
(`scriptorium run|render`). prompt requirements discovery.
- [WhisperX](./whisperx.md): speaker-audio transcription over HTTP. - [WhisperX](./whisperx.md): speaker-audio transcription over HTTP.
## Related Canonical Docs ## Related Canonical Docs

View File

@@ -1,69 +1,44 @@
# Integration: Audita # Integration: Audita
## Purpose Narratio invokes Audita v4.2 for polishing. Its adapter supplies the prepared
Define the Audita adapter contract used by the `polish` stage. party, campaign, setting, and spells documents as repeated `--glossary-file`
arguments, the merged transcript and requested output, and run-local report and
work destinations. Optional config, overlay, profile, transcript-description,
and output-schema selectors are forwarded only when set. `audita.debug: true`
forwards `--debug`; false adds no debug override. Audita owns its
configuration, ordered pipeline, profiles, and native discovery. Narratio does
not generate a downstream configuration. See [Audita configuration](https://forge.maximumdirect.net/eric/audita/src/tag/v4.2.0/docs/config.md)
and its [runtime glossary input contract](https://forge.maximumdirect.net/eric/audita/src/tag/v4.2.0/docs/integrations/transcript-glossary-files.md).
## External Boundary All four entry lists are supplied, including empty ones, and replace same-named
Audita-configured lists. Other collections and omitted instruction fields retain
native downstream composition. The [configuration reference](../config.md#glossary-inputs)
explains selection and migration of the prepared inputs.
Narratio invokes `audita process` as a subprocess for each polish operation. After preparation, Narratio runs native Audita preflight when projected polish
The configured timeout and parent cancellation bound the invocation. Internal work needs execution. The adapter supplies the same selections and prepared
runner composition is documented in files with a synthetic transcript. Audita's provider smoke checks remain enabled;
[the adapter implementation guide](../internal/adapters.md). they can contact providers and destination probes can create directories.
`session validate` uses existing prepared records and a validation probe
namespace. A successful check is not a guarantee about later real-transcript
processing or editorial quality. See [operations](../operations.md#prompt-requirements-preflight)
and [Audita preflight](https://forge.maximumdirect.net/eric/audita/src/tag/v4.2.0/docs/cli.md#preflight).
## Request Contract Each `pipeline.audita.credentials` value is an exact ConfigKit secret reference.
`PolishRequest` carries: Narratio forwards selected names and captured values in the child environment
- required transcript/glossary/output/work-dir paths; and registers them for captured-stream redaction. It does not discover backend
- optional report path (required when report mode is enabled); credentials or scrub files created by Audita. The configured timeout and parent
- generated config and stdout/stderr log paths; cancellation bound subprocess execution.
- optional per-invocation module override.
The constructed runner owns static Audita settings: binary, timeout, The corrected transcript is the only canonical polish output. It must be valid
credentials, default modules, model and endpoint settings, validation and output JSON with a top-level `segments` array within Narratio's 64 MiB limit. Exit zero
settings, report mode, and concurrency. The `polish` stage supplies only is accepted even when ordinary reports describe recoverable errors or no
invocation-specific paths and may override modules for that invocation. corrections. Narratio records available `errors.yml`, `recoveries.yml`, and
`report.md` from the requested report directory as diagnostics, each subject
to a 16 MiB bound. Reports may be absent when disabled. See Audita's
[output contract](https://forge.maximumdirect.net/eric/audita/src/tag/v4.2.0/docs/integrations/output-files.md).
## Result Contract On nonzero exit, Narratio preserves the subprocess error and available run-local
`PolishResult` returns: evidence and does not promote an incidental transcript. The generated invocation
- processed transcript path; record contains arguments, paths, and credential names, never values; it is a
- optional report path; diagnostic record, not an Audita configuration file.
- work dir and generated-config/log paths;
- exit code, duration, binary provenance;
- adapter metadata map.
## Validation and Failure Semantics
Construction fails for invalid static config values, including:
- empty binary;
- non-positive timeout;
- invalid base URL;
- invalid output schema;
- invalid work-dir retention value;
- invalid concurrency values.
Run fails for:
- missing required request paths;
- subprocess execution failure;
- invalid processed transcript JSON (`segments` array required);
- invalid report JSON when reporting is enabled.
Processed transcript JSON is limited to 64 MiB and optional report JSON to 16
MiB. Both must be regular files without symlinked path components.
Failure results still include output/log/config/exit metadata for diagnostics.
## Deterministic Behavior
- CLI args are built from runner config + request in a fixed order.
- A configured typed `llm_api_key` reference is resolved during pipeline load;
the captured value is supplied only as the child's `AUDITA_LLM_API_KEY`
override and is never re-read from the parent environment.
- Generated invocation YAML (`audita.generated.v1`) is emitted when requested.
- Manifest writes are stage-owned; adapter itself is stateless.
## Configuration
Operator-selected values are defined under `pipeline.audita.*` in the
[configuration reference](../config.md#pipeline).
Maintained example with Audita config:
- [Full annotated pipeline](../../examples/pipeline.full.annotated.yml)
- [Production-shaped pipeline](../../examples/pipeline.production.yml)

View File

@@ -7,14 +7,14 @@ lanes from the final trimmed Seriatim transcript. Narratio owns invocation,
safe bundle discovery, lane selection, and its own artifact metadata. Notarius safe bundle discovery, lane selection, and its own artifact metadata. Notarius
owns pipeline definitions, lane schemas, the receipt, and bundle formats. owns pipeline definitions, lane schemas, the receipt, and bundle formats.
Canonical Notarius v0.7.0 references: Canonical Notarius v0.8.1 references:
- [CLI reference](https://gitea.maximumdirect.net/eric/notarius/src/tag/v0.7.0/docs/cli.md) - [CLI reference](https://gitea.maximumdirect.net/eric/notarius/src/tag/v0.8.1/docs/cli.md)
- [Subprocess consumer contract](https://gitea.maximumdirect.net/eric/notarius/src/tag/v0.7.0/docs/consumers/subprocess.md) - [Subprocess consumer contract](https://gitea.maximumdirect.net/eric/notarius/src/tag/v0.8.1/docs/consumers/subprocess.md)
- [D&D pipeline and lane contracts](https://gitea.maximumdirect.net/eric/notarius/src/tag/v0.7.0/docs/consumers/dnd-pipeline.md) - [D&D pipeline and lane contracts](https://gitea.maximumdirect.net/eric/notarius/src/tag/v0.8.1/docs/consumers/dnd-pipeline.md)
- [Run-result receipt](https://gitea.maximumdirect.net/eric/notarius/src/tag/v0.7.0/docs/integrations/run-result.md) - [Run-result receipt](https://gitea.maximumdirect.net/eric/notarius/src/tag/v0.8.1/docs/integrations/run-result.md)
- [JSON output bundle](https://gitea.maximumdirect.net/eric/notarius/src/tag/v0.7.0/docs/integrations/json-output.md) - [JSON output bundle](https://gitea.maximumdirect.net/eric/notarius/src/tag/v0.8.1/docs/integrations/json-output.md)
- [D&D spell-catalog overlay](https://gitea.maximumdirect.net/eric/notarius/src/tag/v0.7.0/docs/integrations/dnd-spell-catalog-overlays.md) - [D&D spell-catalog overlay](https://gitea.maximumdirect.net/eric/notarius/src/tag/v0.8.1/docs/integrations/dnd-spell-catalog-overlays.md)
The [complete Narratio example](../../examples/pipeline.full.annotated.yml) The [complete Narratio example](../../examples/pipeline.full.annotated.yml)
records the exact current constraints for all ten D&D lanes. Treat the linked records the exact current constraints for all ten D&D lanes. Treat the linked
@@ -27,15 +27,27 @@ When `pipeline.notarius.enabled` is true, Narratio resolves the executable,
configuration path, input path, output directory, and working directory to configuration path, input path, output directory, and working directory to
absolute paths. Configured references require support for the `--reference` absolute paths. Configured references require support for the `--reference`
contract introduced in Notarius v0.6.0. Cache controls require support for the contract introduced in Notarius v0.6.0. Cache controls require support for the
selected `--resume` and `--chunk_cache` flags. Notarius v0.7.0 is the tested selected `--resume` and `--chunk_cache` flags. Notarius v0.8.1 is the tested
cache integration baseline, not an unconditional minimum version; Narratio cache integration baseline, not an unconditional minimum version; Narratio
does not impose a runtime version gate. Each reference binding is a separate does not impose a runtime version gate. Each reference binding is a separate
argument before `--json`: argument before `--json`. When `pipeline.notarius.config_overlay` is present,
its exact value is another argument pair before `--json`:
```text ```text
notarius run <pipeline_id> --config <config_path> --input <trimmed_json> --output-dir <staging_dir> [--resume] [--chunk_cache <mode>] [--reference <selector>=<verified_snapshot_path>]... --json notarius run <pipeline_id> --config <config_path> --input <trimmed_json> --output-dir <staging_dir> [--resume] [--chunk_cache <mode>] [--reference <selector>=<verified_snapshot_path>]... [--config-overlay <name>] --json
``` ```
Notarius v0.8.1 is a known supporting version for `--config-overlay`; using the
option requires a compatible Notarius executable, but deployments that omit the
field acquire no additional version requirement. Omitted or null configuration
adds no flag. Supplied empty, `default`, and named selectors are forwarded
without normalization so Notarius can apply its own ConfigKit semantics. This
option selects a Notarius configuration overlay, not a PromptKit profile through
`--llm-profile`, and Narratio never substitutes its own selected overlay name.
A missing or invalid downstream overlay is an ordinary Notarius subprocess
failure: Narratio does not retry without the selector or fall back to another
overlay.
Reference paths are absolute stable snapshots streamed from manifest-verified Reference paths are absolute stable snapshots streamed from manifest-verified
canonical files prepared inside the current Narratio session workspace. They canonical files prepared inside the current Narratio session workspace. They
live at `cache/notarius/references/<sha256>/<prepared-basename>` and retain the live at `cache/notarius/references/<sha256>/<prepared-basename>` and retain the
@@ -54,6 +66,10 @@ projection. Both retain their established `narratio.input.party` and
`narratio.input.players` source IDs, and both are resolved from the prepared `narratio.input.players` source IDs, and both are resolved from the prepared
manifest rather than from campaign configuration at extraction time. manifest rather than from campaign configuration at extraction time.
The `glossary` slot may bind `narratio.input.glossary.campaign`; the four
prepared glossary sources are explicit and the retired monolithic source is
not an alias. The separate Notarius spell-catalog overlay remains unchanged.
The maintained D&D boundary binds only the four campaign-owned external slots: The maintained D&D boundary binds only the four campaign-owned external slots:
```text ```text
@@ -93,15 +109,16 @@ causes a cold miss. Chunk refresh bypasses lookup and publishes the accepted
replacement for the active source; it does not delete unrelated plans or replacement for the active source; it does not delete unrelated plans or
checkpoint state. checkpoint state.
When `pipeline.notarius.llm_api_key` is absent or null, Narratio adds no When `pipeline.notarius.credentials` is absent, null, or empty, Narratio adds no
credential to that environment. When configured, the field names an environment credentials to that environment. When configured, each list entry names an
variable whose already-loaded nonempty value is forwarded under that exact environment variable whose already-loaded nonempty value is forwarded under
name. Operators must use the same name as the `api_key_env` in the selected that exact name. Operators must use the names referenced by the selected
Notarius/PromptKit profile. Narratio does not inspect the Notarius configuration Notarius/PromptKit providers. Narratio does not inspect the Notarius configuration
to infer a provider or destination name, and it does not forward unrelated to infer providers or destination names, and it does not forward unrelated
credentials from its parent environment or secrets directory. credentials from its parent environment or secrets directory. A Narratio
overlay replaces the whole credential list; `[]` clears it.
The selected name is registered with Narratio's shared streaming redactor. Every selected name is registered with Narratio's shared streaming redactor.
Credential bytes written by the child to captured stdout, captured stderr, or Credential bytes written by the child to captured stdout, captured stderr, or
stderr-derived failure diagnostics are replaced with `<redacted>`, including stderr-derived failure diagnostics are replaced with `<redacted>`, including
custom names not known to the built-in sensitive-name list. Narratio does not custom names not known to the built-in sensitive-name list. Narratio does not
@@ -116,7 +133,7 @@ encoded credentials.
## Accepted Result ## Accepted Result
Narratio's tested invocation baseline is Notarius v0.7.0. The accepted Narratio's tested invocation baseline is Notarius v0.8.1. The accepted
receipt remains `notarius.run-result.v2`; reference flags do not change the receipt remains `notarius.run-result.v2`; reference flags do not change the
receipt or ten-lane output contract. The receipt receipt or ten-lane output contract. The receipt
must identify the configured pipeline, and its `index_file` must be exactly must identify the configured pipeline, and its `index_file` must be exactly
@@ -175,7 +192,7 @@ for failure recovery.
## Opt-in Integration Test ## Opt-in Integration Test
The production-boundary cache test requires an absolute path to a locally The production-boundary cache test requires an absolute path to a locally
built Notarius v0.7.0-compatible executable. It uses only a local built Notarius v0.8.1-compatible executable. It uses only a local
OpenAI-compatible `httptest` provider and temporary cache/config/output roots: OpenAI-compatible `httptest` provider and temporary cache/config/output roots:
```sh ```sh

View File

@@ -1,8 +1,8 @@
# Canonical Party Input # Canonical Party Input
`party.yml` is a campaign-owned roster input. It must be a single, versioned `party.yml` is a campaign-owned roster input. Its main document must declare
`narratio.party.v1` document when Narratio resolves a pipeline, campaign, and `narratio.party.v1` when Narratio resolves the roster. Local party files may
session together. import fragments; fragments need no version header.
```yaml ```yaml
schema_version: narratio.party.v1 schema_version: narratio.party.v1
@@ -48,8 +48,8 @@ The configuration rules and source-relative path behavior are defined in the
## Derived players document ## Derived players document
During `prepare`, Narratio copies the canonical party source bytes unchanged During `prepare`, Narratio renders the effective roster as standalone canonical
to `inputs/party.yml` and writes this deterministic players-only projection to `inputs/party.yml` and writes this deterministic players-only projection to
`inputs/players.yml`: `inputs/players.yml`:
```yaml ```yaml

View File

@@ -1,71 +1,57 @@
# Integration: Scriptorium # Integration: Scriptorium
## Purpose ## Boundary
Define the Scriptorium adapter contract used by `analyze` and trim-bounds generation in `trim`.
## External 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.
Narratio invokes Scriptorium as a subprocess in these modes: Configured glossary inputs use explicit prepared `narratio.input.glossary.*`
source IDs while prompt input names remain independently configured bindings.
See [glossary inputs](../config.md#glossary-inputs).
- `scriptorium run` Generation selects artifact-only text output. Preview and requirements use
- `scriptorium render` 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.
The request timeout and parent cancellation bound each invocation. Internal ## Streams And Outcomes
runner composition is documented in
[the adapter implementation guide](../internal/adapters.md).
## Request Contract Narratio captures stdout directly into the run-local artifact or preview, or
Both request types carry: into memory for discovery. Result bytes are preserved and limited to 64 MiB;
- binary/config/prompt/profile IDs; they are not diagnostic logs and are not redacted. Treat generated artifacts
- input map and vars map; and prepared previews as potentially sensitive. Stderr remains separately
- output path; bounded and redacted. A capture failure aborts the supervised subprocess.
- timeout;
- generated config + stdout/stderr log paths;
- optional API-key env var name;
- optional working directory.
## Result Contract A successful generation or preview must produce a nonempty result; preview must
`ArtifactResult` returns: also be valid JSON. Narratio validates the result before stage-owned canonical
- output/log/generated-config paths; promotion. A nonzero outcome or delivery failure remains an error even if
- exit code and duration; stdout contains bytes. Native exit status 4 identifies completed generated
- command mode (`run` or `render`); content validation failure; status 2 is a usage or configuration failure.
- prompt/profile provenance; Invocation records describe the actual arguments and stdout destination.
- `ValidationFailed` marker;
- metadata map.
## Validation and Failure Semantics Requirements discovery returns the native inventories, identities,
Request validation fails for: completeness, and structured issues. A successful partial report is distinct
- missing binary, prompt id, or output path; from a process or decoding failure. Narratio compares the reported requirements
- non-positive timeout; with its intended bindings; discovery does not establish future file availability
- empty input/var names; or guarantee a later model call. See [preflight internals](../internal/preflight.md)
- empty input path values; and the [upstream requirements contract](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/docs/cli.md#promptkit-requirements).
- missing required credential env var when `APIKeyEnv` is set.
Run behavior: ## Credentials And Configuration
- subprocess errors propagate with context;
- `run` exit code `2` is mapped to `ValidationFailed=true`;
- successful subprocess still fails if output file is missing or empty.
Each artifact result is limited to 64 MiB and must be a regular file without Selected ConfigKit secret references are forwarded by exact environment name
symlinked path components. for discovery, preview, and generation. Their captured values are registered
for stderr diagnostic redaction, while invocation records retain names only.
Render behavior: Narratio does not choose the provider or pass a direct API-key override. This
- subprocess errors propagate; does not scrub arbitrary result content or files written by Scriptorium. See
- output file must exist and be non-empty. [Scriptorium credentials](../config.md#scriptorium-credentials) and
[artifact entries](../config.md#scriptorium-artifact-entries) for Narratio's
## Deterministic Behavior configuration and binding semantics.
- input and var maps are sorted into deterministic `--input` and `--var` CLI args.
- stage wiring adds `session_id=narratio-session-<session_id>` to every Scriptorium request for sticky upstream routing, overriding any configured `vars.session_id`.
- generated invocation YAML (`scriptorium.generated.v1`) is emitted when requested.
- adapter is stateless and does not own artifact-selection policy.
## Configuration
Operator-selected values are defined under `pipeline.scriptorium.*`, including
per-artifact settings under `pipeline.scriptorium.artifacts.*`, in the
[configuration reference](../config.md#pipeline).
Maintained examples with Scriptorium config:
- [Full annotated pipeline](../../examples/pipeline.full.annotated.yml)
- [Production-shaped pipeline](../../examples/pipeline.production.yml)

View File

@@ -17,11 +17,20 @@ Narratio sends an HTTP `POST` to the configured transcription URL using
The server must return a `2xx` response whose body is valid JSON. Narratio does The server must return a `2xx` response whose body is valid JSON. Narratio does
not currently require a more specific response schema at this boundary. not currently require a more specific response schema at this boundary.
The transcription URL must be an absolute `http` or `https` URL. The audio body The transcription URL must be an absolute `http` or `https` URL. Each
is streamed through a fresh multipart writer for every attempt, so its memory application attempt creates one bounded multipart framing and streams the audio
use is bounded by the transport buffer rather than by the complete audio file. from an open file between that framing; it does not buffer the complete audio
or spool a multipart copy. The file field precedes the language field.
WhisperX response acquisition is capped at 10 MiB. WhisperX response acquisition is capped at 10 MiB.
The initial request body and any transport-requested replay use the same
multipart boundary and framing. Every body opens an independent audio handle
and replay starts at the beginning. Narratio closes all bodies created for the
attempt on response, failure, timeout, or cancellation, including when a
transport abandons an earlier body. Genuine source read/close failures remain
request failures; deliberate early closure of an abandoned original does not
poison a valid replay.
## Request And Result Contract ## Request And Result Contract
Each adapter request identifies a speaker, a readable audio file, and the Each adapter request identifies a speaker, a readable audio file, and the
@@ -43,6 +52,11 @@ transcript output.
- Narratio waits the configured retry delay between attempts and aborts that - Narratio waits the configured retry delay between attempts and aborts that
wait when the parent context is canceled. wait when the parent context is canceled.
Transport replay occurs inside one application attempt and does not consume an
entry from the configured retry budget or increment the reported attempt
count. The standard HTTP redirect policy remains in effect; body replay can
also support body-preserving redirects.
## Validation And Failure Semantics ## Validation And Failure Semantics
Client construction rejects a missing or non-HTTP(S) absolute transcription URL, Client construction rejects a missing or non-HTTP(S) absolute transcription URL,
@@ -55,12 +69,19 @@ failure to install the output causes the transcription to fail. Errors include
attempt context, and the result retains attempts, final status when available, attempt context, and the result retains attempts, final status when available,
and elapsed duration for diagnostics. and elapsed duration for diagnostics.
Replay makes a fresh request body available to the HTTP transport; it does not
provide an exactly-once server guarantee and does not prove recovery from every
proxy or protocol-level failure. A server may have received work before the
client learns that a request failed. WhisperX operations should therefore be
safe to retry for the same input when practical.
## Determinism And Concurrency ## Determinism And Concurrency
Each audio request has stable multipart field names, and successful bytes are Each audio request has stable multipart field names, and successful bytes are
installed atomically. The transcribe stage may process speaker files in installed atomically. The transcribe stage may process speaker files in
parallel, bounded by the configured concurrency. It records results in stable parallel, bounded by the configured concurrency. Each validated speaker is
speaker order after all work completes; any speaker failure fails the stage. checkpointed independently; any speaker failure still fails the aggregate
stage, while committed earlier speakers remain reusable on an ordinary retry.
## Related Canonical Docs ## Related Canonical Docs

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 command configuration loader may still use object storage to retrieve a missing
remote session file before planning begins. remote session file before planning begins.
After preparation, the application projects remaining selected work and uses
invocation-owned Audita and Scriptorium runners for applicable readiness checks.
The same runners are available to processing. Explicit session validation uses
existing prepared inputs and invocation-owned factories. See
[preflight internals](preflight.md).
Notarius is composed only when extraction is enabled; the extract stage owns Notarius is composed only when extraction is enabled; the extract stage owns
prepared reference resolution, receipt, bundle, and configured-lane policy. prepared reference resolution, receipt, bundle, and configured-lane policy.
The adapter validates the ordered selector/absolute-path pairs and is the sole The adapter validates the ordered selector/absolute-path pairs and is the sole
@@ -68,11 +74,15 @@ owner of serializing them as repeated `--reference` arguments before `--json`.
It also serializes an effective resume request as `--resume` and a nonempty It also serializes an effective resume request as `--resume` and a nonempty
validated chunk mode as `--chunk_cache <mode>`. The extract stage, not the validated chunk mode as `--chunk_cache <mode>`. The extract stage, not the
adapter, resolves force precedence before constructing the request. adapter, resolves force precedence before constructing the request.
Its request may also carry one already-resolved opaque ConfigKit secret Its request may also carry already-resolved ConfigKit secret references.
reference. Only the Notarius adapter reads that value, rejects an unresolved or Audita and Scriptorium requests carry the same kind of list. All three adapters use the shared
empty programmatic reference, and maps the exact configured name/value into the subprocess helper to convert their selected references into exact-name child
shared subprocess override and sensitive-name fields. It never rereads the environment overrides and sensitive-name registration. That helper rejects
parent environment. A nil reference preserves the previous invocation. unresolved or empty programmatic references, but no adapter rereads the
parent environment or inspects downstream configuration to discover names.
Empty lists add no credential overrides. See the public [Audita](../integrations/audita.md)
[Notarius](../integrations/notarius.md), and [Scriptorium](../integrations/scriptorium.md) contracts for selection and
downstream-file boundaries.
Application-owned object-store construction loads configured filesystem Application-owned object-store construction loads configured filesystem
secrets before invoking the invocation's storage factory. Production commands secrets before invoking the invocation's storage factory. Production commands
@@ -94,8 +104,10 @@ in-memory backend without changing package state.
original result classification. Child environments contain only the execution original result classification. Child environments contain only the execution
baseline and adapter-specified values; configured credentials are resolved baseline and adapter-specified values; configured credentials are resolved
once by ConfigKit and passed explicitly as sensitive values. Adapters do not 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 re-read their named environment references. Diagnostic-only stdout and stderr
8 MiB diagnostic captures; a bounded wait closes a stream retained by a 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 departed leader's descendant. Unsupported platforms reject owned command
execution. execution.

View File

@@ -37,8 +37,9 @@ from `pipeline.notarius.outputs`; the Notarius index has no selectable source
ID. ID.
Prepared stable source IDs are `narratio.input.players`, Prepared stable source IDs are `narratio.input.players`,
`narratio.input.party`, `narratio.input.glossary`, and `narratio.input.party`, `narratio.input.glossary.party`,
`narratio.input.spell_catalog`. Artifact policy owns their canonical manifest `narratio.input.glossary.campaign`, `narratio.input.glossary.setting`,
`narratio.input.glossary.spells`, and `narratio.input.spell_catalog`. Artifact policy owns their canonical manifest
kind and prepared filename vocabulary. Canonical party mode preserves the kind and prepared filename vocabulary. Canonical party mode preserves the
party source bytes in the party record and supplies the players record from the party source bytes in the party record and supplies the players record from the
deterministic `derived_from_party` projection; both remain ordinary prepared deterministic `derived_from_party` projection; both remain ordinary prepared
@@ -58,16 +59,16 @@ Configured definitions are always registered. Without an explicit selection,
the effective analyze set contains enabled definitions. With `--artifacts`, the the effective analyze set contains enabled definitions. With `--artifacts`, the
exact named configured definitions become the effective set for that invocation, exact named configured definitions become the effective set for that invocation,
regardless of their `enabled` value. The effective-set resolver itself does not regardless of their `enabled` value. The effective-set resolver itself does not
expand dependencies. Configuration has already materialized the sorted union of expand dependencies. Shared domain catalog derivation has materialized the sorted
explicit ordering edges and configured-artifact input edges, and the analyze union of explicit ordering edges and configured-artifact input edges, and the analyze
work planner closes targets over that one concrete prerequisite graph. work planner closes targets over that one concrete prerequisite graph.
Availability is separate from executability. Configuration may normalize a Availability is separate from executability. Invocation selection normalizes a
family selection into its concrete generated members before this resolver runs. family selection into its concrete generated members before this resolver runs.
The effective set retains optional family The effective set retains optional family
and character origin metadata, but its keys, catalog sources, and runtime and character origin metadata, but its keys, catalog sources, and runtime
lookups remain concrete configured-artifact identities. lookups remain concrete configured-artifact identities.
Family publish policies are likewise expanded into ordinary configured-source Family publish policies are likewise expanded into ordinary configured-source
publish rules during configuration resolution. publish actions during domain catalog derivation.
Configured outputs, including non-executable prerequisites, become available Configured outputs, including non-executable prerequisites, become available
only when the versioned analyze state identifies a current result whose source, only when the versioned analyze state identifies a current result whose source,
contract, canonical configured path, size, and checksum match a confined contract, canonical configured path, size, and checksum match a confined

View File

@@ -37,6 +37,8 @@ Restore planner action kinds:
Planner behavior: Planner behavior:
- prepared campaign, session, party, and all four glossary inputs are restored
from declared immutable run objects to their canonical local input paths;
- a new-protocol restore uses only the selected commit's declared artifact set; - a new-protocol restore uses only the selected commit's declared artifact set;
each action carries that artifact's immutable key, checksum, size, and each action carries that artifact's immutable key, checksum, size, and
generation; generation;

View File

@@ -1,215 +1,112 @@
# Configuration Internals # Configuration Internals
User-visible fields, defaults, and selection behavior belong in the User-visible fields, defaults, discovery, and selection belong in the
[Configuration Reference](../config.md). This document describes the internal [Configuration Reference](../config.md). This document describes the
pipeline-loading boundary implemented by `internal/config`. `internal/config` loading and derivation boundary established by
[ADR 0003](../adr/0003-assign-configuration-ownership.md).
## Pipeline Loading ## Typed Configuration Handoff
`LoadPipeline` assembles and validates a pipeline in this order: Pipeline, campaign, session, and party loaders retain their actual typed
ConfigKit results. ConfigKit owns imports, overlay composition, inheritance,
presence, typed secrets, and native source/history evidence. Narratio's
supported definition callbacks complete configuration-owned defaults,
normalization, resource resolution, and validation before handoff. Consumers
read completed values without mutation.
1. Give ConfigKit a fresh typed `PipelineConfig` default value, the root file, Session definitions receive selected-campaign defaults before loading finishes.
enabled imports, and the caller's profile selection. Omitted, empty, and Recorded resolution preserves explicit empty/null/false/zero behavior and
exact `default` selections use the base; named profiles use the fixed truthful dependencies. Campaign, session, and previous-session assertions run
`profiles/<name>.yml` convention. against resolved values in native validation callbacks. Standalone document
2. ConfigKit parses the root and declared imports, additively merges base renderers preserve materialization semantics without providing a second
sources, applies only the selected overlay, and strictly decodes the result. inspection authority.
3. The definition resolver applies recorded entry-level and inherited defaults,
runs deterministic domain normalization, records derived publish destinations,
and resolves ordinary paths relative to the root pipeline file.
4. The definition validator performs read-only checks that require only the
pipeline file. Checks requiring canonical-party family expansion remain at
the existing explicit pipeline/campaign resolution boundary.
5. Narratio inspects public ConfigKit metadata to reject artifact and family keys
declared by multiple base files, adapts source ownership records, attaches
runtime-only state, and computes the normalized effective digest.
This ordering preserves monolithic configuration behavior. Moving a field to Resource resolution consults native entry origins and source contexts. A usable
an imported fragment changes its source ownership, not its path base, default, effective source supplies the base, otherwise the main source and then captured
or schema semantics. invocation directory provide the fallback. Explicit CLI paths use the invocation
directory. Reference-catalog entries are resolved individually from their native
field origins; selection does not read unused vocabulary files. See [resource rules](../config.md#pipeline-imports-and-overlays).
## Loaded Context Resolution ## Invocation Acquisition
`LoadedPipelineCampaign` carries one already composed pipeline and its selected `internal/app/configuration_acquisition.go` owns lazy invocation selections and
campaign into session resolution. `LoadSessionWithPipelineCampaignOptions` acquired context. Exact sources and effective-identity assertions are
loads a local session against that context, while complementary. App acquisition needs no campaign or party for expansion;
`ResolveLoadedPipelineCampaign` also accepts an already loaded remote session campaign acquisition needs no session. Session acquisition loads campaign
or no session while a caller retrieves one. Compatibility loaders route through context when required for defaults. Explicit party acquisition does not require
these functions after their initial pipeline and campaign reads. a session. Each reached pipeline acquisition prepares its native source and applies
configured bootstrap after static input checks; completed acquisitions are reused.
Application commands own pipeline and campaign discovery, campaign-file versus `LoadedPipelineCampaign` retains one selected pipeline/campaign while local or
registry selection, and the corresponding mutual-exclusion rules. Once they remote session resolution proceeds. Only absence permits remote fallback;
have a `LoadedPipelineCampaign`, local session discovery and remote-session access, decoding, and identity failures retain their causes. Remote acquisition
download retain that exact pipeline object and its private provenance. Removing prefers authored session-root input and uses the committed prepared snapshot
a temporary downloaded session file therefore cannot invalidate the resolved only when authored input is absent. Temporary materialization retains object
pipeline or campaign context. provenance and releases resources on success or failure. Read-only acquisition
creates no runtime workspace, execution lock, restore state, or stage adapter.
Campaign and session files use independent ConfigKit definitions with imports ## Native Inspection
and profiles disabled. Campaign files normally load directly from their source;
session files are first read through the 8 MiB bounded-read boundary because the
application must reject unresolved template placeholders before passing an exact
byte snapshot to ConfigKit. Local and remotely downloaded session bytes then use
the same typed loader and retain the existing post-load identity expectations,
stable-input precedence, and source-relative path semantics.
The application also has a separate read-only inspection resolver for `config `configuration_commands.go` adapts actual results with `ckconfig.FromConfigKit`.
validate`, `config show`, `config sources`, and `config artifacts`. It uses the same production root/profile and Native show, sources, explain/history, validation, and comparisons consume that
campaign selection functions, but never routes through session discovery, result's values and evidence. There is no flattened replacement snapshot,
remote-session download, adapter composition, workspace synthetic source reconciliation, or generated family catalog in app inspection.
initialization, manifest access, or cleanup. A pipeline with retained artifact
family declarations must resolve its selected campaign before ordinary pipeline
validation, which expands its canonical-party members and generated publish
rules. A pipeline without those declarations may be validated by itself.
Secret-directory bootstrap remains invocation-scoped and happens before the
ordinary ConfigKit load because explicit typed references must resolve even for
inspection.
`MarshalEffectivePipeline` is the configuration-owned projection for `config Comparison sides load independently using each side's normal defaults and
show`. It serializes one explicit typed safe projection with the existing YAML selectors. App-only overrides pass through native selection into ConfigKit;
encoder. The projection has no slots for resolution-only artifact family they remain invocation-local. Field overrides are unavailable to domain
declarations or private provenance. The result has one trailing newline; execution/planning and other scopes. Comparison sides acquire separately and share the process environment while
commands do not marshal runtime objects directly. retaining separate completed results. Public inspection and error paths preserve typed-secret
redaction and credential reference metadata. Load failures retain native errors
and source evidence; domain commands use `ckconfig.AdaptDiagnostics` for their
presentation without rewriting diagnostic records.
`EffectivePipelineSources` and `EffectiveCampaignSources` provide the separate ## Glossary Derivation
safe provenance projection for `config sources`. Pipeline ownership begins with
the complete logical field paths projected from the schema and classifies
each contributor as root, import, profile, or centralized default. The
projection replaces generated concrete member paths with paired family and
canonical-party records, and does the same for generated publish rules.
Campaign records identify campaign-owned fields and party inputs; canonical
derived players point to the party source. The application command only joins these sorted
records with selection metadata and never reparses configuration files.
`EffectiveArtifactCatalog` projects the same finalized concrete artifact map for `internal/config` adapts resolved selections and canonical party context to
`config artifacts`. It derives source identity from each map key, carries sorted `internal/glossary`. That owner loads native vocabulary, validates the pinned
effective dependencies, aggregates ConfigKit definition contributors, and adds schema, projects the roster, and serializes four deterministic documents.
family/character/party provenance for generated members. It does not inspect Preparation and resume comparison share this resolver. Derived vocabulary does
files named after artifacts or infer another runtime graph. not replace the authored ConfigKit results used by native inspection. Catalog
entry imports use the source file's native relative context.
`config diff` uses a thin paired loader that performs two independent ConfigKit ## Canonical Party And Derived Catalog
loads. When campaign
resolution is needed, the command loads one selected campaign and party and
expands both effective pipelines from that same party value. The configuration
owner projects each normalized effective mapping directly from that same typed
projection into sorted logical paths using JSON number preservation;
mapping leaves are compared individually while sequence values remain atomic.
Values are compact deterministic JSON representations for command output, not
raw YAML fragments, ownership records, or secret material. A differing digest
with no projected difference is treated as an internal consistency error.
Campaign context construction reads the campaign-owned party source through File-backed party loading supports imports; contextless `ParseParty` accepts
`ParseParty`. The required canonical party retains its raw bytes and normalized bytes. The definition checks the main version and effective roster. Native
roster in runtime-only `ResolvedParty` provenance. Canonical resolution creates source coordinates establish roster order, favoring each child's declaration.
a deterministic `derived_from_party` players projection. The party is the only A deterministic renderer materializes canonical party YAML. The selected roster
configured roster authority; player and session-party fields are unsupported. supplies both the players projection and concrete family members, including when
an explicit party file replaces the campaign default.
## Canonical Party Domain `ArtifactCatalog` carries derived artifacts, family/member origins, resolved
dependencies, and expanded publication outputs separately from pipeline values.
Family declarations remain in the typed pipeline result. Derivation sorts
family keys and character IDs, substitutes `{character_id}` in outputs,
resolves closed member variables, and checks key/output collisions and domain
dependencies. Member-artifact inputs become ordinary concrete artifact sources;
family publish declarations become ordinary publication actions. No family
wildcard matcher is added to runtime publication.
`ParseParty` is the package-owned boundary for parsing a party source. Its Catalog listing, planning, stage execution, artifact inspection, fingerprinting,
single-source ConfigKit definition disables imports and profiles, requires and previous-session requirements consume the same derived products. Validation
`schema_version` through `VersionRule`, and strictly decodes the of these products belongs to domain derivation rather than app inspection.
character-keyed typed schema before applying Narratio's party-domain checks. External roster shape belongs in the [party contract](../integrations/party.md).
Successful metadata coordinates recover authored character-map order without a
second YAML parse; class and alias slice order comes directly from typed decode.
The canonical value retains a separate exact byte copy of its source so
consumers can materialize the authored party document without reserializing it.
Its `PlayersYAML` method deterministically derives the ID-sorted, versioned
players-only projection.
An unversioned source is rejected before resolution, family expansion, or ## Safe Persistence And Semantic Resume
prepare-stage materialization.
## Validation Ownership Preparation materializes standalone campaign/session/party/players and four glossary inputs and
a secret-safe pipeline projection. The projection preserves credential names,
family declarations, numeric values, and null/empty distinctions. It is a
persistence service, not a fabricated native result. An effective digest is
informational; resume compares result-affecting semantic evidence from the same
concrete products used by execution. Source arrangement, provenance, and overlay
labels alone do not invalidate work.
Configuration validation remains within `internal/config`, with the public Focused configuration/application fixtures cover imports, defaults, selected
entry points and pipeline-domain sequencing separated from the private owners rosters, independent comparisons, override isolation, secret-safe persistence,
for core pipeline/session rules, external adapters, publish/storage, Notarius, and unchanged completed configuration across domain derivation and execution.
Scriptorium, and shared scalar/path checks. These are package-local ownership
boundaries rather than extension points or a general validation framework.
Validation is read-only, fails fast, and does not define which of several ConfigKit's [consumer guide](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/consumers/README.md)
independent invalid fields is reported first. Map-backed declarations are and [CommandKit consumer guide](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/docs/consumers/guide.md)
nevertheless traversed deterministically. Reusable domain normalization is an own the upstream APIs and feature behavior.
explicit preceding operation for both loaded and programmatically constructed
pipelines. Notarius normalization commits canonical scalar, reference, and output
values only after the complete normalization succeeds; its validator then checks
that candidate without changing it. Scriptorium validates artifact declarations
and outputs, dependencies and inputs, variables, referenced outputs, and the final
dependency graph in deterministic artifact order.
Diagnostics identify the relevant semantic field. Merge conflicts also
retain every claiming source needed to correct an additive ownership conflict.
Complete prose, punctuation, formatting, and private validation choreography are
not compatibility contracts.
## Diagnostics And Runtime Metadata
Syntax, duplicate-key, merge, profile, and schema failures include the
relevant source name and full field path. Additive conflicts report every
claiming source so operators can repair the split without repeatedly
rediscovering additional conflicts.
The loaded pipeline retains private runtime metadata for the absolute root
path, ordered imports, selected profile name and selection source, selected
overlay, original ConfigKit metadata and source snapshots, effective digest,
and leaf ownership. Base
leaves retain their root/import owners, replaced leaves belong to the selected
overlay, and centrally supplied values use the synthetic `default` owner. This
metadata does not participate in YAML decoding or alter the public
configuration model.
The effective digest is SHA-256 over a versioned deterministic JSON encoding of
the same typed safe projection used by show and diff. Runtime Notarius paths remain absolute for
execution, but the digest substitutes their normalized logical values captured
before root-relative resolution, so relocating an equivalent configuration
bundle does not change provenance. Because ConfigKit and resolution metadata
are private, the digest excludes source layout, profile name, and ownership.
Configuration stores credentials as ConfigKit typed references. A successful
load resolves their values inside the opaque typed boundary, while this safe
projection serializes only `EnvName()` identities. Credential-value changes are
therefore never hashed; reference-name changes remain ordinary provenance.
The optional Notarius credential follows the same path even for disabled or
resumable extraction; normalization copies the opaque reference without reading
or resolving it again. Direct YAML serialization has a configuration-owned safe
projection so only the reference name can leave this boundary.
`recomputePipelineEffectiveDigest` is the single package-owned refresh point
for later runtime expansion.
## Test Surfaces
`pipeline_configkit_test.go` exercises real imports and fixed-path profiles,
base selection, unselected-overlay isolation, source attribution, and Narratio's
unique artifact/family base-declaration rule. Existing focused configuration
tests protect defaults, explicit-value semantics, strict decoding, validation,
metadata, and root-relative path behavior. Application configuration-loader tests protect the
single-read boundary by changing the pipeline file after its initial load and
confirming local session resolution retains the original pipeline. Other
configuration tests continue to protect defaults and validation after assembly.
`party_test.go` protects the versioned typed party schema, domain invariants,
authored character order, retained bytes, and deterministic players projection
without involving campaign or runtime wiring.
`party_resolution_test.go` protects campaign-owned party loading, canonical
input restrictions, source provenance, and virtual players input selection.
## Artifact Family Resolution
Pipeline loading retains `scriptorium.artifact_families` as a resolution-only
declaration. Once campaign party resolution establishes a canonical roster,
configuration expands families in sorted family-key and character-ID order
into ordinary `ScriptoriumArtifactConfig` values. The expansion owns the narrow
`{character_id}` output substitution, closed member-variable selectors, key and
output collision checks, and the runtime-only family-origin catalog. It then
removes family declarations from `ScriptoriumConfig`, runs ordinary Scriptorium
validation, and refreshes the effective pipeline digest. Stages and adapters
therefore receive only concrete artifact maps.
The catalog retains sorted family member keys plus family/character/source
origins and the typed dependency/publish declarations for their later owners.
`member_dependencies` add corresponding ordinary concrete dependencies, while
the family-only `narratio.member_artifact.<family>` input form is rewritten to
the matching ordinary configured-artifact source. The catalog records those
resolved dependency and input identities with their declaring family and party
member. No member-artifact source is registered as a runtime policy source.
An enabled family publish declaration expands to ordinary configured-artifact
publish rules before the existing publish and lock validators run. Runtime
publication consequently receives no family wildcard or special matcher.

View File

@@ -23,9 +23,11 @@ portable opaque segments. Unsafe legacy identities are rejected with migration
guidance rather than being normalized into a different workspace or remote guidance rather than being normalized into a different workspace or remote
namespace. namespace.
Decoding is strict at every typed manifest field. Unknown fields are rejected; Decoding rejects unknown typed fields, including informational fields inside
the schema version remains `narratio.session-manifest.v1` and there is no `effective_config` and its nested selection. The schema version remains
compatibility reader that silently drops retired state. Cleanup progress uses `narratio.session-manifest.v1`; there is no compatibility reader that silently
drops retired fields. See [overlay migration](../operations.md#migrating-manifest-overlay-provenance)
for deliberate migration of retired selection provenance. Cleanup progress uses
only the cleanup entry in `stages`. only the cleanup entry in `stages`.
Every persisted session manifest has a non-nil `stages` map. Each entry is Every persisted session manifest has a non-nil `stages` map. Each entry is
@@ -50,6 +52,45 @@ The model admits these stage states:
- `stale` - `stale`
- `interrupted` - `interrupted`
### Transcribe-owned speaker state
A `transcribe` stage record may carry `transcribe_state_version: 1` and a
`transcribe_speakers` map keyed by the existing derived speaker ID. The version
is the authority marker: a versioned empty map means that no earlier speaker
completion is reusable. Absence of both fields is accepted as legacy
aggregate-only state so current Narratio can read older manifests.
Each map entry represents one completed speaker only. It binds a versioned
fingerprint to the session-relative audio path, audio SHA-256 and size, one
canonical `transcript_raw` output with its path, SHA-256 and size, and the
producer run ID. Paths must be canonical and session-relative, checksums must
be lowercase SHA-256 values, and the record and output producer identities
must agree. Other stages cannot carry this transcribe-owned state.
Audio size is nonnegative; WhisperX determines whether that audio can be
transcribed. Output size remains positive and the transcript must be valid JSON.
Transcribe reconciles this collection against the current prepared audio set
and observable WhisperX semantics. Missing or corrupt regular outputs become
work; unsafe or non-regular evidence is rejected. It saves the reconciled
collection before HTTP dispatch and saves a detached candidate after each
validated completion. Only after a save succeeds is the candidate installed as
live authority. Canonical bytes produced before an unsuccessful save are not a
completion record.
Aggregate transcribe status still describes the whole invocation. A failed,
running, stale, or interrupted aggregate may therefore retain reusable speaker
records, while aggregate outputs are declared only after the current
collection is complete. Ordinary retry reconciles and reuses those records.
Force first checkpoints an empty current collection, preventing later retries
from reviving pre-force results.
Older aggregate-only transcribe success is conservatively regenerated once
when transcribe is selected because it does not bind individual outputs to the
audio bytes used. The session-manifest schema identifier remains
`narratio.session-manifest.v1`; this additive state is accepted by current
Narratio, but older strict-decoding binaries may reject manifests after these
fields have been written.
### Analyze-owned artifact state ### Analyze-owned artifact state
Every `analyze` stage record carries `analyze_state_version: 1` and an Every `analyze` stage record carries `analyze_state_version: 1` and an
@@ -154,12 +195,31 @@ establish a current immutable snapshot.
- writes through a sibling temporary file and atomic replacement visibility; - writes through a sibling temporary file and atomic replacement visibility;
- updates `updated_at` on save. - updates `updated_at` on save.
### Checkpoint persistence boundary
Analyze and transcribe share one private checkpoint operation in
`internal/stage`. Their typed callers still decide when to checkpoint, validate
their collections, populate stage-owned fields, and serialize access. The
shared operation copies the manifest and its checkpoint-relevant mutable
collections, applies the typed update to the copied target record, and calls
the existing `manifest.Store` exactly once. Only after that save succeeds does
it promote the saved target record and manifest `updated_at` into live state;
it preserves an existing target record's identity and leaves unrelated live
stage records in place.
The copy boundary includes stage records, input and artifact slices, aggregate
output/log/configuration slices, and the typed analyze and transcribe
collections that callbacks or `LocalStore.Save` may modify. Metadata and other
pointer fields remain shared read-only because neither checkpoint callback nor
the store mutates them. This is a bounded execution helper, not a general
manifest clone or a transaction across transcript/artifact files.
Manifest replacement provides atomic visibility, not a crash- or power-loss Manifest replacement provides atomic visibility, not a crash- or power-loss
durability guarantee. Callers reload after a returned save error before retrying. durability guarantee. Callers reload after a returned save error before retrying.
An analyze checkpoint error leaves the prior manifest as per-artifact authority. A transcribe or analyze checkpoint error leaves the prior manifest collection
The runner then attempts to persist the bounded failed/stale retry collection; as authority. The runner then attempts to persist the aggregate failure; if
if that terminal save also fails, its error is joined with the originating that terminal save also fails, its error is joined with the originating failure
failure and the next invocation must reconcile from the last readable manifest. and the next invocation must reconcile from the last readable manifest.
## Execution Semantics ## Execution Semantics
@@ -193,11 +253,11 @@ only fields returned by the new result. Marking a record stale does not clear
those details because resume validation and diagnosis may still require them those details because resume validation and diagnosis may still require them
before execution begins. before execution begins.
Aggregate lifecycle clearing deliberately preserves the analyze-owned Aggregate lifecycle clearing deliberately preserves both the transcribe-owned
per-artifact collection. This lets later reconciliation replace only evaluated speaker collection and the analyze-owned per-artifact collection. This lets
entries without erasing unrelated current results. Other stages retain their later reconciliation replace only non-current entries without erasing durable
existing aggregate-only lifecycle behavior and are forbidden from carrying the completions. Other stages retain aggregate-only lifecycle behavior and are
analyze-specific fields. forbidden from carrying either collection.
A stage may explicitly return a skipped disposition and stable reason. The A stage may explicitly return a skipped disposition and stable reason. The
runner persists that outcome in the session manifest, clears older outputs, runner persists that outcome in the session manifest, clears older outputs,
@@ -228,7 +288,7 @@ evidence and focused durable validators:
| Work | Reuse authority | Focused owners | | Work | Reuse authority | Focused owners |
| --- | --- | --- | | --- | --- | --- |
| prepare | aggregate semantic fingerprint | [prepare](stage-prepare.md) | | prepare | aggregate semantic fingerprint | [prepare](stage-prepare.md) |
| transcribe | aggregate semantic fingerprint | [transcribe](stage-transcribe.md), [WhisperX](../integrations/whisperx.md) | | transcribe speakers | aggregate semantic fingerprint plus per-speaker input/output reconciliation | [transcribe](stage-transcribe.md), [WhisperX](../integrations/whisperx.md) |
| merge | aggregate semantic fingerprint | [merge](stage-merge.md), [Seriatim](../integrations/seriatim.md) | | merge | aggregate semantic fingerprint | [merge](stage-merge.md), [Seriatim](../integrations/seriatim.md) |
| polish | aggregate semantic fingerprint | [polish](stage-polish.md), [Audita](../integrations/audita.md) | | polish | aggregate semantic fingerprint | [polish](stage-polish.md), [Audita](../integrations/audita.md) |
| normalize | aggregate semantic fingerprint | [normalize](stage-normalize.md), [Seriatim](../integrations/seriatim.md) | | normalize | aggregate semantic fingerprint | [normalize](stage-normalize.md), [Seriatim](../integrations/seriatim.md) |
@@ -248,10 +308,10 @@ after such a private content change.
The session manifest is the authoritative stage-progress ledger across The session manifest is the authoritative stage-progress ledger across
invocations. It retains the most recently resolved invocation's bounded invocations. It retains the most recently resolved invocation's bounded
configuration provenance. It identifies the selected profile name and source configuration provenance. It identifies the selected overlay name and source
(`default` or `cli`) plus the effective configuration digest, but never a raw (`explicit` when selected) plus the effective configuration digest, but never a raw
secret or profile content. This provenance is informational: it does not secret or overlay content. This provenance is informational: it does not
participate in stage resume or cache decisions. A profile change therefore participate in stage resume or cache decisions. An overlay change therefore
invalidates only stages whose semantic configuration changed. When a private invalidates only stages whose semantic configuration changed. When a private
external-tool model, module, prompt, or profile changes behind an unchanged external-tool model, module, prompt, or profile changes behind an unchanged
configured identifier, use `--force` for the affected work. configured identifier, use `--force` for the affected work.
@@ -310,6 +370,16 @@ where the last session transition can require operator interpretation.
- Remote commit model and readers: `internal/artifacts/remote_commit.go`, - Remote commit model and readers: `internal/artifacts/remote_commit.go`,
`internal/artifacts/current_state_commit.go`, `internal/artifacts/current_state_commit.go`,
- Persistence and validation: `internal/manifest/store.go` - Persistence and validation: `internal/manifest/store.go`
- Transcribe speaker state: `internal/manifest/transcribe_state.go`
- Package tests: `internal/manifest/*_test.go` - Package tests: `internal/manifest/*_test.go`
- Assembled execution behavior: `internal/app/runner_test.go`, - Assembled execution behavior: `internal/app/runner_test.go`,
`internal/app/run_stage_test.go` `internal/app/run_selection_test.go`
## Prepared Glossary Evidence
Preparation records four distinct glossary input kinds with canonical paths,
checksums, sizes, and provenance. Polish records the resolved glossary identity
evidence used for its result; preflight itself records no stage success. Publish
and restore carry the prepared inputs using their declared manifest identities.
See [prepare](stage-prepare.md), [polish](stage-polish.md), and
[artifact internals](artifacts.md).

View File

@@ -8,6 +8,9 @@ in the [CLI](../cli.md), [Configuration](../config.md),
Externally observable tool and format contracts belong under Externally observable tool and format contracts belong under
[Integrations](../integrations/). [Integrations](../integrations/).
Configuration and CLI integration use [ConfigKit v1.4.0](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/consumers/README.md) and [CommandKit v0.8.0](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/docs/consumers/guide.md); the upstream guides
own their APIs.
## Execution Path ## Execution Path
```text ```text
@@ -16,7 +19,8 @@ cmd/narratio -> internal/app -> configuration and production composition
-> manifests and artifact resolution -> durable local/remote output -> manifests and artifact resolution -> durable local/remote output
``` ```
The executable delegates process behavior to the application boundary. The The executable supplies signal-aware context and caller-owned streams to the
native CommandKit application boundary. The
application resolves configuration, composes concrete collaborators, acquires application resolves configuration, composes concrete collaborators, acquires
session safety controls, and runs commands. Pipeline commands execute the session safety controls, and runs commands. Pipeline commands execute the
canonical stage sequence through adapter interfaces, while manifests record canonical stage sequence through adapter interfaces, while manifests record
@@ -24,10 +28,12 @@ progress and artifact services resolve durable inputs and outputs.
The pipeline runner follows one explicit invocation lifecycle: inspect bounded The pipeline runner follows one explicit invocation lifecycle: inspect bounded
prerequisites without mutation, prepare the workspace layout, acquire one 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, complete or
the collaborators needed by the selected range, execute each selected stage in reuse selected preparation, check projected downstream work, compose only the
order, and then return the summary. Cleanup, when selected, is the ordinary collaborators needed by selected work, execute each selected stage in order, finalize terminal state, release resources, and return a possibly partial
final stage rather than runner finalization work. summary with preserved failure causes. Narrow terminal local persistence detaches
cancellation; active work retains the canceled operation context. Cleanup, when
selected, is the ordinary final stage rather than runner finalization work.
The lock remains held from manifest initialization through finalization, and a The lock remains held from manifest initialization through finalization, and a
failed stage or required manifest save prevents later stages from starting. failed stage or required manifest save prevents later stages from starting.
@@ -36,16 +42,18 @@ failed stage or required manifest save prevents later stages from starting.
| Area | Implemented owners | Responsibility | | Area | Implemented owners | Responsibility |
| --- | --- | --- | | --- | --- | --- |
| Executable | `cmd/narratio` | Process entry, standard stream wiring, argument handoff, and exit status. | | Executable | `cmd/narratio` | Process entry, standard stream wiring, argument handoff, and exit status. |
| Application orchestration | `internal/app` | Command dispatch, configuration selection, secret-file environment loading, production composition, session locking, planning, execution, restore, and user-facing reporting. | | 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) | ConfigKit-backed pipeline imports and profiles, canonical party and family expansion, strict YAML loading, defaults, normalization, session templating, and validation. | | 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. | | Pipeline stages | `internal/stage` | Canonical stage registry, shared stage contract, execution dependencies, and implemented stage behavior. |
| Glossaries | `internal/glossary` | Native vocabulary resolution, schema validation, party projection, and deterministic documents. |
| Downstream preflight | [`internal/preflight`](preflight.md) | Assess Audita readiness and native prompt requirements for execution and validation. |
| External boundaries | `internal/adapters`, `internal/audio` | WhisperX HTTP, downstream subprocesses, notification, object storage, and S3 audio materialization behind Narratio contracts. | | 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. | | 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. | | Artifacts and paths | `internal/artifacts`, `internal/pathsafe` | Artifact identities and resolution, local and remote path/key models, current-state discovery, and confined relative destinations. |
| Previous-session cache | `internal/previouscache` | Deterministic planning and materialization requirements for configured previous-session inputs. | | Previous-session cache | `internal/previouscache` | Deterministic planning and materialization requirements for configured previous-session inputs. |
| Artifact policy | `internal/artifactpolicy` | Source and destination policy, configured artifact identity validation, and publish destination safety. | | Artifact policy | `internal/artifactpolicy` | Source and destination policy, configured artifact identity validation, and publish destination safety. |
| Shared models and file operations | `internal/artifactmodel`, `internal/contracts`, [`internal/fileops`](fileops.md) | Transcript and artifact data contracts plus atomic single-file replacement, bounded reads, workspace modes, and root-scoped cleanup helpers. | | Shared models and file operations | `internal/artifactmodel`, `internal/contracts`, [`internal/fileops`](fileops.md) | Transcript and artifact data contracts plus atomic single-file replacement, bounded reads, workspace modes, and root-scoped cleanup helpers. |
| Logging | `internal/logging` | Application logger construction and shared structured logging behavior. | | Logging | `internal/logging` | Small Narratio-owned diagnostic/progress interface adapted to the invocation reporter. |
The application boundary composes concrete implementations. Stages depend on The application boundary composes concrete implementations. Stages depend on
Narratio-level contracts; external transport and SDK details remain in Narratio-level contracts; external transport and SDK details remain in
@@ -106,10 +114,12 @@ so any earlier replacement can stale a prior cleanup result.
## Focused Documentation ## Focused Documentation
- [Configuration Internals](configuration.md): pipeline imports and profiles, - [Configuration Internals](configuration.md): pipeline imports and overlays,
field ownership, decoding, and root-relative path semantics. field ownership, decoding, and source-relative resource semantics.
- [Adapter Internals](adapters.md): external adapter boundaries, composition, - [Adapter Internals](adapters.md): external adapter boundaries, composition,
failure behavior, and test surfaces. failure behavior, and test surfaces.
- [Preflight Internals](preflight.md): projected target selection and shared
requirements assessment.
- [Artifact Internals](artifacts.md): source identities, runtime catalog, - [Artifact Internals](artifacts.md): source identities, runtime catalog,
resolution, previous requirements, and current-state helpers. resolution, previous requirements, and current-state helpers.
- [Manifest Internals](manifest.md): session records, persistence, and execution - [Manifest Internals](manifest.md): session records, persistence, and execution
@@ -137,4 +147,4 @@ before changing behavior.
The stage registry is implemented in `internal/stage/placeholders.go` and its The stage registry is implemented in `internal/stage/placeholders.go` and its
ordering is protected by `internal/app/planner_test.go`. Cross-invocation skip, ordering is protected by `internal/app/planner_test.go`. Cross-invocation skip,
force, failure, and invalidation behavior is exercised in force, failure, and invalidation behavior is exercised in
`internal/app/runner_test.go` and `internal/app/run_stage_test.go`. `internal/app/runner_test.go` and `internal/app/run_selection_test.go`.

View File

@@ -0,0 +1,33 @@
# Internal: Downstream Preflight
The application performs downstream checks after selected preparation completes
or is reused and before remaining selected processing. It projects remaining
work against a clone of the locked manifest using the same stage decisions and
analysis planner as `session plan`. Projected polish selects Audita; projected
enabled trim and analysis select Scriptorium requirements. A projection is not
an execution commitment. Empty target sets invoke no checker.
Audita receives the verified four prepared glossary files and the same
processing selectors and destinations, with an embedded synthetic transcript.
The adapter runs native preflight with provider smoke enabled, captures its
transient diagnostics, and preserves exit classification. No preflight result
is cached as a stage. A failure stops later processing without presenting it as
complete.
For `session validate`, the application selects enabled downstream definitions
independently of reuse and checks the existing prepared manifest. It does not
resolve live files into candidate glossary projections or run prepare. The
Audita probe under `runs/.validation` can create or probe directories and contact
providers; it does not update the session manifest. Discovery and provider
checks do not establish real-transcript feasibility or editorial quality.
Scriptorium input-map keys remain binding names distinct from Narratio source
IDs. Missing required bindings or variables and inspection failures are errors;
optional sources for required inputs, conditional requirements, incomplete
discovery, and discovery issues produce warnings. The checker preserves earlier
findings and stops on cancellation. Actual input resolution remains authoritative.
See [Audita](../integrations/audita.md), [Scriptorium](../integrations/scriptorium.md),
[CLI](../cli.md#session-validate), and [operations](../operations.md#prompt-requirements-preflight).
Implementation and tests are in `internal/preflight`, `internal/app/runner_preflight.go`,
`internal/app/session_inspection_command.go`, and `internal/adapters/audita/preflight.go`.

View File

@@ -20,7 +20,7 @@ dependency order, and safely materialize validated outputs.
Supported source families: Supported source families:
- built-ins: `narratio.transcript.*`, `narratio.bounds.session` - built-ins: `narratio.transcript.*`, `narratio.bounds.session`
- prepared stable inputs: `narratio.input.players`, `narratio.input.party`, - prepared stable inputs: `narratio.input.players`, `narratio.input.party`,
`narratio.input.glossary`, `narratio.input.spell_catalog` `narratio.input.glossary.{party,campaign,setting,spells}`, `narratio.input.spell_catalog`
- configured artifacts: `narratio.artifact.<key>` - configured artifacts: `narratio.artifact.<key>`
- extraction lanes: `narratio.extraction.<key>` - extraction lanes: `narratio.extraction.<key>`
- previous-session cache: `narratio.previous_session.artifact.<key>` - previous-session cache: `narratio.previous_session.artifact.<key>`
@@ -53,7 +53,7 @@ Supported source families:
manifest record and durable output pass the configured-artifact evidence manifest record and durable output pass the configured-artifact evidence
contract; an incidental or stale canonical file is unavailable. contract; an incidental or stale canonical file is unavailable.
- validates selected artifact dependency order (cycle-safe topo ordering). - validates selected artifact dependency order (cycle-safe topo ordering).
- consumes only the concrete dependency graph finalized by configuration; - consumes only the concrete dependency graph derived in the shared domain catalog;
planning, prerequisite closure, execution, reuse, invalidation, and semantic planning, prerequisite closure, execution, reuse, invalidation, and semantic
evidence do not infer a second graph from inputs. evidence do not infer a second graph from inputs.
- resolves required/optional inputs per artifact source definition into an - resolves required/optional inputs per artifact source definition into an
@@ -115,7 +115,11 @@ Supported source families:
- before the first adapter call, checkpoints the reconciled starting collection - before the first adapter call, checkpoints the reconciled starting collection
when it removed configuration records or cleared obsolete authority. After when it removed configuration records or cleared obsolete authority. After
each successful artifact, checkpoints the complete collection before making each successful artifact, checkpoints the complete collection before making
that artifact available to the next scheduled dependent. that artifact available to the next scheduled dependent. Analyze supplies
its typed update to the shared
[checkpoint persistence boundary](manifest.md#checkpoint-persistence-boundary)
and refreshes its working and committed collections only after the save
succeeds.
- keeps adapter output in the invocation's run-local analyze directory until - keeps adapter output in the invocation's run-local analyze directory until
it is a safe, non-empty, bounded regular file with a calculated checksum and it is a safe, non-empty, bounded regular file with a calculated checksum and
complete output contract. Canonical replacement uses the shared atomic file complete output contract. Canonical replacement uses the shared atomic file
@@ -137,6 +141,10 @@ Supported source families:
- resolves previous-session sources from local `previous/` cache only. - resolves previous-session sources from local `previous/` cache only.
- runs optional render-debug, then artifact execution. - runs optional render-debug, then artifact execution.
- validates non-empty output files and materializes canonical outputs. - 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 ## Failure Semantics

View File

@@ -39,9 +39,9 @@ stage non-resumable. A failure is recorded against cleanup; publish remains
succeeded and remote current state is unchanged. On a later normal full run, succeeded and remote current state is unchanged. On a later normal full run,
valid upstream stages are skipped and cleanup is retried without republishing. valid upstream stages are skipped and cleanup is retried without republishing.
`narratio publish` selects publish only and never invokes cleanup. A bounded run `narratio run SESSION --stage publish` selects publish only and never invokes cleanup. A bounded run
through `notify` or any earlier endpoint also excludes it. Operators may run through `notify` or any earlier endpoint also excludes it. Operators may run
`narratio run-stage cleanup <session_id>` directly; missing, failed, malformed, `narratio run <session_id> --stage cleanup` directly; missing, failed, malformed,
or identity-mismatched publication evidence fails before deletion. or identity-mismatched publication evidence fails before deletion.
## Implementation And Tests ## Implementation And Tests

View File

@@ -23,11 +23,13 @@ procedures belong in [Operations](../operations.md).
reusing verified bytes or reconstructing a missing/corrupt regular entry, reusing verified bytes or reconstructing a missing/corrupt regular entry,
and rejects any source change observed while copying; and rejects any source change observed while copying;
4. fingerprints the byte- and provenance-bearing Notarius invocation evidence, 4. fingerprints the byte- and provenance-bearing Notarius invocation evidence,
including sorted reference identities; including sorted reference identities and the explicit downstream
configuration-overlay selection;
5. creates a run-local staging directory and invokes the injected 5. creates a run-local staging directory and invokes the injected
`notarius.Runner`, carrying the optional already-resolved credential `notarius.Runner`, carrying the optional already-resolved credential
reference without exposing its value, plus effective resume and chunk-cache reference without exposing its value, the optional exact configuration
controls after force precedence; overlay, plus effective resume and chunk-cache controls after force
precedence;
6. revalidates the reference snapshots, then validates the v2 successful 6. revalidates the reference snapshots, then validates the v2 successful
receipt, confined index, management documents, configured required lane receipt, confined index, management documents, configured required lane
descriptors, validation summaries, and regular payload files; descriptors, validation summaries, and regular payload files;
@@ -70,7 +72,9 @@ outputs is stable and does not repeatedly invalidate dependent stages.
Before the focused validator runs, the application compares extract's versioned Before the focused validator runs, the application compares extract's versioned
semantic fingerprint. It covers enablement, Notarius pipeline identity, sorted semantic fingerprint. It covers enablement, Notarius pipeline identity, sorted
reference selector/source mappings, sorted declared output contracts, and each reference selector/source mappings, sorted declared output contracts, and each
canonical `narratio.extraction.<key>` output identity. It excludes executable, canonical `narratio.extraction.<key>` output identity. It also covers the
explicit Notarius configuration-overlay selection; omitted, empty, and exact
`default` selectors share the base-selection identity. It excludes executable,
timeout, working directory, config path, and private Notarius config contents. timeout, working directory, config path, and private Notarius config contents.
Credential presence, reference name, and resolved value are likewise Credential presence, reference name, and resolved value are likewise
operational-only and excluded. Ordinary command loading still resolves a operational-only and excluded. Ordinary command loading still resolves a
@@ -81,13 +85,15 @@ not rerun a valid completed extraction or stale its dependents.
stage record still matches the current byte- and provenance-bearing invocation stage record still matches the current byte- and provenance-bearing invocation
evidence. That evidence covers the current direct trimmed-transcript identity, evidence. That evidence covers the current direct trimmed-transcript identity,
sorted prepared-reference identities, pipeline identity, and configured output sorted prepared-reference identities, pipeline identity, and configured output
contracts. The same reference helper and transcript identity are resolved again contracts, plus the same downstream overlay-selection identity. The same
for artifact evidence, so changing current transcript bytes, reference bytes, reference helper and transcript identity are resolved again for artifact
or producer identity makes the prior extraction obsolete. Operational runner evidence, so changing current transcript bytes, reference bytes, producer
settings do not invalidate otherwise current durable evidence. This includes identity, or a named downstream selection makes the prior extraction obsolete.
`resume` and `chunk_cache`; changing them alone cannot make a complete Operational runner settings do not invalidate otherwise current durable
extraction non-resumable. If extraction executes, ordinary runs forward the evidence. This includes `resume` and `chunk_cache`; changing them alone cannot
configured values, while force disables resume and selects `refresh`. make a complete extraction non-resumable. If extraction executes, ordinary
runs forward the configured values, while force disables resume and selects
`refresh`.
A valid prepared-reference change makes extraction non-resumable. Missing, A valid prepared-reference change makes extraction non-resumable. Missing,
unsafe, or checksum-inconsistent prepared evidence is a hard validation error unsafe, or checksum-inconsistent prepared evidence is a hard validation error
@@ -100,10 +106,12 @@ contracts and provenance, regular-file status, and stored checksums. Missing or
obsolete results are non-resumable and run again; unsafe filesystem conditions obsolete results are non-resumable and run again; unsafe filesystem conditions
return an error rather than silently accepting or replacing data. return an error rather than silently accepting or replacing data.
Neither contract can observe files imported by Notarius configuration, profile This sensitivity is limited to the explicit downstream selector. Narratio's
contents, prompt/module definitions, or other transitive inputs. Operators must own overlay label and whole effective-configuration digest are not blanket
force extraction after changing any such private input behind a stable extraction invalidators. Neither contract can observe files imported by
identifier. Notarius configuration, profile contents, prompt/module definitions, or other
transitive inputs. Operators must force extraction after changing any such
private input behind a stable identifier.
## Failure Behavior ## Failure Behavior
@@ -136,5 +144,5 @@ recovery.
`internal/artifacts/extraction_catalog_test.go` `internal/artifacts/extraction_catalog_test.go`
- Composition and downstream behavior: `internal/app/runner_test.go`, - Composition and downstream behavior: `internal/app/runner_test.go`,
`internal/stage/analyze_test.go`, `internal/stage/publish_test.go` `internal/stage/analyze_test.go`, `internal/stage/publish_test.go`
- Opt-in Notarius v0.7.0 production-boundary coverage: - Opt-in Notarius v0.8.1 production-boundary coverage:
`internal/stage/notarius_cache_integration_test.go` `internal/stage/notarius_cache_integration_test.go`

View File

@@ -17,7 +17,11 @@ Normalize raw transcript inputs and merge into base transcript via Seriatim.
## Key Behavior ## Key Behavior
- discovers and validates raw transcript inputs. - discovers and validates raw transcript inputs. For versioned transcribe
state, discovery requires aggregate transcribe success and consumes only the
aggregate outputs that exactly match the current per-speaker collection.
Partial checkpoints and orphaned files are not merge inputs. Legacy/manual
workflows without versioned speaker state retain directory discovery.
- normalizes each raw transcript (`seriatim.Normalize`) into run-local scratch output. - normalizes each raw transcript (`seriatim.Normalize`) into run-local scratch output.
- merges normalized inputs (`seriatim.Run`) into base transcript. - merges normalized inputs (`seriatim.Run`) into base transcript.
- validates merged transcript and optional report JSON. - validates merged transcript and optional report JSON.
@@ -26,6 +30,8 @@ Normalize raw transcript inputs and merge into base transcript via Seriatim.
## Invariants ## Invariants
- merge always consumes normalized forms of raw inputs. - merge always consumes normalized forms of raw inputs.
- a versioned transcribe collection is usable only through its complete,
successful aggregate output declaration.
- base transcript must validate before stage success. - base transcript must validate before stage success.
- report output is config-gated. - report output is config-gated.

View File

@@ -1,54 +1,23 @@
# Stage: polish # Stage: polish
## Purpose Polish resolves the base transcript from verified merge evidence and all four
prepared glossary documents from manifest-backed input records. It invokes the
Audita adapter with those paths and configured downstream selectors, then
validates the returned transcript before promoting `transcripts/polished.json`.
The transcript is the only canonical output. Available ordinary reports,
stdout/stderr, and the generated invocation record are run-local diagnostics;
Audita's work directory is separately selected. The [Audita contract](../integrations/audita.md)
owns invocation and diagnostic behavior.
Run Audita polishing on base transcript and produce polished transcript. Polish records the prepared glossary identities as resume evidence alongside
semantic configuration. Changes to effective glossary content require new
polish work through ordinary prepare invalidation. Credentials, executable,
timeout, and diagnostics are operational. Narratio does not fingerprint the
contents of Audita-owned configuration or profiles: force polish after changing
those files behind unchanged selectors. Older evidence is reconsidered when
polish is selected; a downstream-only invocation does not eagerly run it.
## Inputs A failed invocation does not promote an incidental output. Preflight is an
invocation check after preparation, not a successful polish record. See
- `transcripts/base.json` [preflight internals](preflight.md), `internal/stage/polish.go`,
- `inputs/glossary.yml` `internal/stage/polish_resume.go`, and their focused tests.
## Outputs
- `transcripts/polished.json`
- optional `artifacts/audita.report.json`
## Key Behavior
- resolves base transcript only from verified merge manifest output evidence.
- invokes an Audita runner configured with static model/runtime options; the
invocation supplies paths and modules.
- validates processed transcript structure (`segments` array required).
- validates optional report JSON.
- materializes canonical outputs; records logs/generated config and adapter metadata.
## Invariants
- polished transcript schema validation is mandatory.
- report output is config-gated.
## Resume Semantics
The versioned semantic fingerprint covers the Audita service endpoint, model,
validation model, module set, transcript description, output schema, selected
external configuration path, and canonical polished-transcript identity. Module
ordering is normalized because the configured modules form a set. Audita's
executable, timeouts, concurrency, report and debug behavior, work retention,
and resolved credential value are operational and do not invalidate a
successful result. The public credential reference name may participate in
configuration provenance but never exposes its resolved value.
Narratio can fingerprint a selected model, module, or configuration identifier,
but it cannot inspect content that Audita privately resolves behind that stable
identifier. Force `polish` after changing such private content without changing
its identifier.
## Related Contracts And Tests
- [Audita](../integrations/audita.md) owns subprocess, validation, and failure
semantics.
- [Configuration](../config.md#pipeline) owns operator-selected Audita values.
- Implementation and tests: `internal/stage/polish.go`,
`internal/stage/polish_test.go`,
`internal/stage/semantic_contracts_refinement.go`

View File

@@ -7,7 +7,7 @@ Materialize canonical current-session inputs before processing stages.
## Inputs ## Inputs
- resolved campaign, session, and pipeline configuration - resolved campaign, session, and pipeline configuration
- stable input files (`speakers`, `autocorrect`, `glossary`, `players`, `party`) - stable speakers and autocorrect inputs, the canonical party, and optional glossary selections
- optional spell-catalog overlay - optional spell-catalog overlay
- one resolved local or S3 audio source - one resolved local or S3 audio source
- enabled configured artifact input requirements for previous-session sources - enabled configured artifact input requirements for previous-session sources
@@ -19,7 +19,7 @@ Materialize canonical current-session inputs before processing stages.
- `inputs/pipeline.resolved.yml` - `inputs/pipeline.resolved.yml`
- `inputs/speakers.yml` - `inputs/speakers.yml`
- `inputs/autocorrect.yml` - `inputs/autocorrect.yml`
- `inputs/glossary.yml` - `inputs/glossaries/{party,campaign,setting,spells}.yml`
- `inputs/players.yml` - `inputs/players.yml`
- `inputs/party.yml` - `inputs/party.yml`
- optional `inputs/spell_catalog.json` - optional `inputs/spell_catalog.json`
@@ -30,7 +30,9 @@ Materialize canonical current-session inputs before processing stages.
## Key Behavior ## Key Behavior
- validates required config/store state. - validates required config/store state and resolves selected vocabulary before audio work.
- derives the party glossary and resolves the remaining named collections through
`internal/glossary`; writes all four with checksum, size, and provenance.
- enforces local audio vs S3 audio mutual exclusivity. - enforces local audio vs S3 audio mutual exclusivity.
- rejects duplicate explicit local audio sources after resolution. - rejects duplicate explicit local audio sources after resolution.
- gives distinct local source paths with the same basename deterministic unique - gives distinct local source paths with the same basename deterministic unique
@@ -39,8 +41,8 @@ Materialize canonical current-session inputs before processing stages.
- materializes a configured spell catalog with checksum and provenance, or - materializes a configured spell catalog with checksum and provenance, or
safely removes an obsolete canonical spell catalog and its manifest record safely removes an obsolete canonical spell catalog and its manifest record
when the effective input is omitted. when the effective input is omitted.
- copies the validated canonical party bytes unchanged and deterministically - renders standalone effective campaign, session, and canonical party documents,
generates the prepared players projection. and deterministically generates the prepared players projection.
- scans enabled configured artifact inputs for `narratio.previous_session.artifact.*` requirements. - scans enabled configured artifact inputs for `narratio.previous_session.artifact.*` requirements.
- clears managed `previous/` state on every invocation, then, when requirements exist: - clears managed `previous/` state on every invocation, then, when requirements exist:
- resolves the pointer-selected previous source through the shared resolver; - resolves the pointer-selected previous source through the shared resolver;
@@ -71,15 +73,15 @@ previous-artifact requirement set. A change reruns prepare and
stales its fixed descendants. Existing successful records without this stales its fixed descendants. Existing successful records without this
evidence rerun once when selected. evidence rerun once when selected.
Workspace, spool, and cache placement and absolute source relocation are not Workspace, spool, and cache placement are not semantic when logical selection,
semantic when logical selection, canonical names, and bytes are equivalent. canonical names, and effective bytes are equivalent.
The fingerprint deliberately does not read or rehash large audio. Prepared The fingerprint deliberately does not read or rehash large audio. Prepared
input checksums remain the content provenance. Before reusing success, prepare input checksums remain the content provenance. Before reusing success, prepare
validates every durable prepared copy and compares current stable-input bytes, validates every durable prepared copy and compares current stable-input bytes,
canonical party and derived-player bytes, local audio membership/checksums, or effective campaign/session, canonical party, derived-player and resolved glossary
S3 key/size/entity-tag identity with that provenance. Source relocation with bytes, local audio membership/checksums, or S3 key/size/entity-tag identity with that provenance.
equivalent names and bytes remains reusable; changed or unavailable evidence Source relocation with equivalent effective documents, names, and bytes remains
causes a normal prepare rerun. reusable; changed or unavailable evidence causes a normal prepare rerun.
## Related Contracts And Tests ## Related Contracts And Tests

View File

@@ -15,8 +15,8 @@ Upload run/session outputs to object storage and atomically advance remote curre
## Outputs ## Outputs
- uploaded session manifest, declared run-local diagnostics, and selected - uploaded session manifest, prepared campaign/session/party inputs, declared
publish outputs; run-local diagnostics, and selected publish outputs;
- uploaded durable previous-session cache files when present; - uploaded durable previous-session cache files when present;
- immutable run-scoped commit manifest; and - immutable run-scoped commit manifest; and
- current commit pointer, written last. - current commit pointer, written last.
@@ -34,7 +34,10 @@ and optional rules, destination resolution, and collision inputs live in
remote verification live in `publish_transfer.go`; committed-manifest, remote verification live in `publish_transfer.go`; committed-manifest,
immutable-commit, and current-pointer encoding and writes live in immutable-commit, and current-pointer encoding and writes live in
`publish_commit.go`. `publish_output_plan.go` owns the deterministic, I/O-free `publish_commit.go`. `publish_output_plan.go` owns the deterministic, I/O-free
five-outcome model and its secret-free metadata projection. five-outcome model and its secret-free metadata projection. Prepared input
objects are committed under the immutable run; the committed standalone session
supports remote loading when no authored session override is available. The
[configuration reference](../config.md#sessionyml) owns input selection.
- when publishing or run upload is disabled, completes successfully with no - when publishing or run upload is disabled, completes successfully with no
outputs and records explanatory metadata. This is not an explicit self-skip: outputs and records explanatory metadata. This is not an explicit self-skip:
@@ -58,6 +61,8 @@ five-outcome model and its secret-free metadata projection.
canonical file, aggregate output, stale/failed/unselected record, or canonical file, aggregate output, stale/failed/unselected record, or
mismatched path, size, or checksum remains unavailable. Built-in and mismatched path, size, or checksum remains unavailable. Built-in and
extraction sources likewise require their own current manifest evidence. extraction sources likewise require their own current manifest evidence.
- includes the four manifest-backed prepared glossary documents with their
declared input identities for restore;
- publishes extraction lanes only through explicit configured output rules; - publishes extraction lanes only through explicit configured output rules;
neither run-local nor durable Notarius bundles are scanned or uploaded wholesale. neither run-local nor durable Notarius bundles are scanned or uploaded wholesale.
- selected artifact filter applies to configured artifact sources only. - selected artifact filter applies to configured artifact sources only.
@@ -126,7 +131,7 @@ evidence does not replace those safety checks.
The commit boundary and cleanup authorization are normative architecture invariants; see The commit boundary and cleanup authorization are normative architecture invariants; see
[Architecture](../policy/architecture.md#publish-commit-boundary). [Architecture](../policy/architecture.md#publish-commit-boundary).
Publish never deletes local state. The standalone `publish` command selects Publish never deletes local state. `run SESSION --stage publish` selects
only this stage; a full run selects notify and cleanup afterward. only this stage; a full run selects notify and cleanup afterward.
## Related Contracts And Tests ## Related Contracts And Tests

View File

@@ -14,12 +14,19 @@ Generate raw per-speaker transcripts from prepared audio using WhisperX.
## Key Behavior ## Key Behavior
- discovers prepared audio from manifest inputs or canonical audio directory. - discovers prepared audio from manifest inputs or the canonical audio
- derives the transcript identity from the prepared `.flac` filename. directory and derives each speaker identity from its `.flac` filename.
- dispatches one WhisperX request per prepared file through a bounded errgroup. - hashes the current audio and reconciles it with the versioned per-speaker
- validates each output as JSON. completion collection before starting HTTP work.
- writes run-local outputs then materializes canonical transcript outputs only - reuses only records whose audio identity, observable WhisperX semantics,
after every planned request succeeds. canonical output location, JSON, checksum, and size remain current.
- durably checkpoints the reconciled collection before dispatch, then sends
only missing or obsolete speakers through the bounded worker group.
- validates each successful run-local response, rechecks the audio bytes,
materializes the canonical raw transcript, and checkpoints that speaker
before accepting another completion.
- rebuilds aggregate stage outputs in stable speaker order from the complete
current collection, including records produced by earlier invocations.
## Invariants ## Invariants
@@ -28,21 +35,49 @@ Generate raw per-speaker transcripts from prepared audio using WhisperX.
- output path returned by adapter must match requested output path. - output path returned by adapter must match requested output path.
- an empty adapter result path means the requested path; adapters cannot select - an empty adapter result path means the requested path; adapters cannot select
an alternate destination. an alternate destination.
- each successful output is validated before stage success, and cancellation or - candidate collection construction, the shared
incomplete dispatch cannot be reported as a successful result. [checkpoint persistence boundary](manifest.md#checkpoint-persistence-boundary),
and installation into live state are serialized by transcribe's mutex.
Expensive hashing and HTTP work remain outside that critical section.
- a canonical file has no completion authority until its manifest checkpoint
succeeds. A save failure preserves the last successfully committed
collection for ordinary retry.
- each successful output is validated before its checkpoint, and cancellation,
incomplete dispatch, or a failed aggregate save cannot be reported as
aggregate stage success.
- removed audio inputs are omitted from the current collection and aggregate
output list; reconciliation does not delete arbitrary transcript files.
- merge cannot consume a partial versioned collection: it requires transcribe
aggregate success and an exact match between current speaker records and
declared aggregate outputs.
## Resume Evidence ## Resume Evidence
Transcribe records a versioned semantic-configuration fingerprint containing Each completed speaker record binds the speaker ID, session-relative audio
the Narratio-visible WhisperX service URL and recognition language. Changes to path, streamed audio checksum and size, the Narratio-visible WhisperX service
either rerun transcription and stale its fixed descendants while leaving URL and recognition language, and the canonical transcript path, checksum,
prepare reusable. Retry count/delay, concurrency, timeout, credentials, and size, and producer run. Changed audio bytes select that speaker for replacement;
diagnostic locations are operational and do not change this evidence. a changed URL or language selects every speaker. Either case stales fixed
descendants through the normal runner decision. Retry count/delay, concurrency,
timeout, credentials, and diagnostic locations are operational and do not
change this evidence.
An ordinary retry reuses every valid speaker checkpoint even when aggregate
transcribe status is failed, running, or stale. A succeeded stage is skipped only
when its stored speaker set and aggregate output evidence also match the current
collection. Otherwise, execution repairs those records without retranscribing
reusable speakers and stales dependents through the normal runner path.
`--force` first durably replaces
the collection with an empty versioned collection, so a later ordinary retry
cannot resurrect pre-force results; speakers checkpointed by that forced
attempt remain reusable.
WhisperX models or private service configuration not exposed by Narratio's WhisperX models or private service configuration not exposed by Narratio's
adapter contract cannot be fingerprinted; use `--force` after changing them. adapter contract cannot be fingerprinted; use `--force` after changing them.
An existing successful transcribe record without evidence reruns once when An older aggregate-only transcribe record has no trustworthy audio-to-output
selected. binding. When transcribe is next selected, every current speaker is therefore
generated once and recorded in the versioned collection; later invocations can
reuse it normally.
## Related Contracts And Tests ## Related Contracts And Tests
@@ -51,6 +86,9 @@ selected.
- [Configuration](../config.md#pipeline) owns concurrency and other - [Configuration](../config.md#pipeline) owns concurrency and other
operator-selected values. operator-selected values.
- Implementation and tests: `internal/stage/transcribe.go`, - Implementation and tests: `internal/stage/transcribe.go`,
`internal/stage/transcribe_reconciliation.go`,
`internal/stage/transcribe_execution_state.go`,
`internal/stage/transcribe_resume.go`,
`internal/stage/transcribe_test.go`, `internal/stage/transcribe_test.go`,
`internal/stage/semantic_contracts_initial.go`, and `internal/stage/transcribe_reconciliation_test.go`, and
`internal/stage/semantic_contracts_initial_test.go` `internal/stage/transcribe_checkpoint_test.go`

View File

@@ -17,6 +17,7 @@ applies a bounds-driven trim.
## Key Behavior ## Key Behavior
When `trim.enabled=true`: When `trim.enabled=true`:
- shares the effective prompt context with early requirements inspection;
- runs Scriptorium bounds artifact generation; - runs Scriptorium bounds artifact generation;
- optionally runs render-debug output generation; - optionally runs render-debug output generation;
- validates bounds payload against transcript; - validates bounds payload against transcript;
@@ -32,6 +33,12 @@ When `trim.enabled=false`:
- normalized transcript is required input. - normalized transcript is required input.
- bounds output exists only in enabled trim path. - bounds output exists only in enabled trim path.
- render-debug output is diagnostic and not a declared stage output. - 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 ## Resume Semantics

View File

@@ -32,6 +32,9 @@ materialized into canonical session paths before stage success. Managed
previous-session cache paths remain session-durable and are never redirected previous-session cache paths remain session-durable and are never redirected
into run-local output space. into run-local output space.
Polish uses run-local transcript, report/log, and debug destinations; validation
probes use `runs/.validation`. These are not latest-attempt views.
Extraction uses run-local receipt, stderr, and output-root helpers, then Extraction uses run-local receipt, stderr, and output-root helpers, then
validates and renames the external bundle to the unique immutable Notarius validates and renames the external bundle to the unique immutable Notarius
bundle path supplied by `internal/artifacts`. Exact physical paths belong in bundle path supplied by `internal/artifacts`. Exact physical paths belong in
@@ -72,7 +75,7 @@ The canonical cleanup stage:
republishing. republishing.
Manual cleanup uses the same root-confined deletion mechanism. Invocation Manual cleanup uses the same root-confined deletion mechanism. Invocation
syntax and exact deletion scope belong in [CLI](../cli.md#clean) and syntax and exact deletion scope belong in [CLI](../cli.md#session-clean) and
[Operations](../operations.md#cleanup). [Operations](../operations.md#cleanup).
## Invariants ## Invariants

View File

@@ -6,17 +6,13 @@ For command syntax, see [docs/cli.md](./cli.md). For field-level config, see [do
## Campaign and Session Selection ## Campaign and Session Selection
Campaign selection priority: Identity and exact-file selection are complementary: a selected file supplies
configuration and an explicit ID asserts its effective identity. Session domain
- `--campaign-file` commands take positional identity; `--session-file` selects its source. An
- `--campaign` explicit `--party-file` supplies the roster consistently across consumers.
- `pipeline.campaigns.default_campaign_id` See [CLI selectors](cli.md#configuration-selectors) and
[configuration discovery](config.md#discovery-and-selection) for selection rules.
Session source priority: Existing scripts should follow the [CLI migration table](cli.md#migration-from-the-previous-cli).
- `--session`
- local default search paths
- remote session object (S3) when local session file is not found and storage is configured
## Session Initialization ## Session Initialization
@@ -36,19 +32,19 @@ narratio session init 2026-04-04 --remote --force
If `campaign.yml` sets `session_template_file`, `session init` renders it. Template variables must resolve to concrete values. If `campaign.yml` sets `session_template_file`, `session init` renders it. Template variables must resolve to concrete values.
Campaigns must provide stable input files for speakers, autocorrect, glossary, Campaigns provide speakers, autocorrect, and a canonical party; players are
players, and party, and may provide an optional spell-catalog overlay. Session derived from that roster. Glossary selections and the separate spell-catalog
files may override those paths for one session. The `prepare` stage overlay are optional. Preparation writes the shared glossary documents and
materializes them under `inputs/`; configured consumers use the prepared files, other stable inputs under `inputs/`; consumers use verified prepared files.
never the original campaign or session source paths. Field definitions and See [glossary inputs](config.md#glossary-inputs) for selections and sources.
source IDs are in [Configuration](./config.md#notarius-reference-bindings).
## Standard Session Workflow ## Standard Session Workflow
1. Select pipeline/campaign/session config. 1. Select pipeline/campaign/session config.
2. Validate session readiness: 2. Prepare inputs, then validate session readiness:
```bash ```bash
narratio run 2026-04-04 --stage prepare
narratio session validate 2026-04-04 narratio session validate 2026-04-04
``` ```
@@ -70,21 +66,37 @@ narratio run 2026-04-04
narratio session status 2026-04-04 narratio session status 2026-04-04
``` ```
Run, plan, and status output identify the resolved pipeline profile (or `none`) Status distinguishes currently resolved configuration provenance from the last
and effective configuration digest. Status distinguishes the current resolved persisted configuration, helping diagnose overlay switches without changing
value from the last value persisted in the session manifest, which helps semantic resume authority. Run and plan reports describe execution and decisions;
diagnose profile switches without changing resume authority. see the [report fields](cli.md#public-domain-report-fields).
Before switching an operational profile, compare its effective meaning with the Before switching an operational overlay, compare its effective configuration
production base through `narratio config diff default <profile>`. with the base through `narratio config diff --against-overlay NAME`. When using an
The command is read-only and succeeds whether it finds differences or not. Its explicit root, supply it with both `--config` and `--against-config`. Each side
sorted records describe defaulted, expanded concrete configuration—not source loads independently using its own defaults. Native inspection retains authored
file layout—so it can be used to review model, artifact, and publish changes family declarations; use `narratio artifacts list` to review concrete identities,
without creating a session or run. Use `narratio config artifacts` to review the outputs, dependencies, and selected-party members. See
concrete artifact identities, definitions, outputs, and dependencies. Select the [configuration inspection](cli.md#configuration-inspection) for selection and
same campaign explicitly when profiles could resolve different campaign paths; comparison details.
see the [CLI reference](cli.md#config-validate-config-show-config-sources-config-artifacts-and-config-diff)
for syntax and record format. ### Prompt requirements preflight
After selected preparation completes or is reused, Narratio checks downstream
work projected to run before processing continues. Audita preflight uses the
prepared glossary files, a synthetic transcript, and the selected Audita
configuration; its native provider smoke checks are enabled. Scriptorium
requirements discovery checks projected trim and analysis bindings. A missing
required binding or failed check stops the invocation; incomplete or conditional
prompt discovery can produce warnings. Already completed work remains recorded.
`session plan` does not invoke these downstream checks.
`session validate` checks enabled downstream definitions against existing
prepared glossary records. It does not prepare inputs. Its Audita probe uses a
`runs/.validation` destination namespace, may create or probe directories and
may contact configured providers. The synthetic check establishes readiness for
that probe, not feasibility for a real transcript or editorial quality. See
[Audita](integrations/audita.md) and [Scriptorium](integrations/scriptorium.md).
## Stage Execution and Continuation Behavior ## Stage Execution and Continuation Behavior
@@ -116,18 +128,19 @@ Execution rules:
perpetually rerun dependent work. perpetually rerun dependent work.
Every aggregate stage except analyze currently provides semantic-configuration Every aggregate stage except analyze currently provides semantic-configuration
evidence; analyze retains its more precise per-artifact fingerprints and evidence; transcribe additionally reconciles per-speaker completion evidence,
validator. while analyze retains its more precise per-artifact fingerprints and validator.
Prepare additionally validates current stable/local/S3 source identity and the Prepare additionally validates current stable/local/S3 source identity and the
checksums of its durable prepared copies before reuse. Changed bytes, audio checksums of its durable prepared copies before reuse. Changed bytes, audio
membership, S3 object identity, or missing/tampered copies rerun prepare and membership, S3 object identity, or missing/tampered copies rerun prepare and
its fixed descendants without requiring `--force`. Changing prepare selection its fixed descendants without requiring `--force`. Changing prepare selection
semantics likewise reruns all fixed descendants; changing semantics likewise reruns all fixed descendants; changing
WhisperX language/service identity reuses prepare; changing a Seriatim merge WhisperX language/service identity reuses prepare; changing a Seriatim merge
transformation reuses prepare and transcribe; and changing an Audita model transformation reuses prepare and transcribe; and changing a selected Audita
reuses prepare, transcribe, and merge while rebuilding transcript refinement. overlay or profile reuses prepare, transcribe, and merge while rebuilding
A trim change invalidates both render and extract through the fixed dependency transcript refinement. A trim change invalidates both render and
relation, while a render-only change preserves the extract sibling. extract through the fixed dependency relation, while a render-only change
preserves the extract sibling.
Operational timeouts, retry/concurrency tuning, executable paths, Operational timeouts, retry/concurrency tuning, executable paths,
workspace/cache/spool placement, reports, diagnostics, and secret values are workspace/cache/spool placement, reports, diagnostics, and secret values are
@@ -147,7 +160,7 @@ the stage self-skip.
Single-stage execution: Single-stage execution:
```bash ```bash
narratio run-stage normalize 2026-04-04 --force narratio run 2026-04-04 --stage normalize --force
``` ```
Contiguous bounded execution uses inclusive canonical endpoints: Contiguous bounded execution uses inclusive canonical endpoints:
@@ -187,27 +200,75 @@ shared session lifecycle. In particular, render does not require Notarius or
Scriptorium, extract does not require Scriptorium, and analyze does not require Scriptorium, extract does not require Scriptorium, and analyze does not require
the transcription, Seriatim, Audita, or Notarius adapters. the transcription, Seriatim, Audita, or Notarius adapters.
### Transcription continuation and replacement
Transcribe checkpoints each validated speaker independently. If a later
speaker exhausts HTTP retries, the process is canceled, or the aggregate stage
save fails, the aggregate stage is not successful and downstream merge cannot
consume the partial set. The last successfully saved speaker records and their
canonical `transcripts/raw/<speaker>.json` files remain durable, however.
After correcting the underlying problem, retry normally:
```bash
narratio run 2026-04-04 --stage transcribe
```
Narratio hashes the current prepared audio, validates recorded transcript JSON,
checksum, size, and location, and calls WhisperX only for missing or obsolete
speakers. A changed audio file replaces only its speaker; a changed WhisperX
URL or language makes every current speaker non-reusable. Retry, timeout, and
concurrency tuning do not invalidate completed speakers.
Use force only when every current transcript must be replaced, including after
a WhisperX model or private server-side configuration changes behind the same
URL and language:
```bash
narratio run 2026-04-04 --stage transcribe --force
```
Force durably clears the reusable collection before sending requests. If that
forced attempt fails, a later ordinary retry reuses only replacement speakers
checkpointed after the reset; it does not revive pre-force results. Do not edit
speaker checksums or copy older JSON into the canonical directory to influence
reuse.
The first current Narratio invocation that selects transcribe for an older
aggregate-only manifest retranscribes every current speaker once because the
old record cannot prove which audio bytes produced each file. Subsequent runs
reuse the new versioned evidence normally. The overall session-manifest schema
identifier is unchanged, but older strict-decoding Narratio binaries may reject
a manifest after current Narratio writes the additive speaker fields; retain a
backup or complete the upgrade before relying on downgrade.
Restoring a manifest does not implicitly publish or restore every raw speaker
file. If a recorded canonical transcript is absent locally, ordinary
reconciliation schedules that speaker again. Removing run directories does not
remove canonical checkpointed transcripts and does not by itself invalidate
them.
## Artifact Development Workflows ## Artifact Development Workflows
Choose the narrowest workflow that matches the intended replacement: Choose the narrowest workflow that matches the intended replacement:
| Intent | Command | Preserved and rebuilt state | | Intent | Command | Preserved and rebuilt state |
| --- | --- | --- | | --- | --- | --- |
| Rebuild analysis only | [`narratio analyze 2026-04-04`](./cli.md#analyze) | Preserves transcripts and the current extraction bundle; force-runs selected analysis artifacts and their required analysis prerequisites. | | Rebuild analysis only | [`narratio run 2026-04-04 --stage analyze --force`](./cli.md#run) | Preserves transcripts and the current extraction bundle; force-runs selected analysis artifacts and their required analysis prerequisites. |
| Rebuild extraction and analysis | [`narratio regenerate-artifacts 2026-04-04`](./cli.md#regenerate-artifacts) | Preserves transcripts; force-runs the complete configured extraction bundle, then selected analysis. `--artifacts` narrows analysis only. | | Rebuild extraction and analysis | [`narratio artifacts regenerate 2026-04-04`](./cli.md#artifacts-regenerate) | Preserves transcripts; force-runs the complete configured extraction bundle, then selected analysis. `--artifacts` narrows analysis only. |
| Continue bounded work normally | [`narratio run 2026-04-04 --from extract --through analyze`](./cli.md#run) | Uses ordinary resume decisions: current extraction and analysis can be skipped, while incomplete or obsolete work runs. | | Continue bounded work normally | [`narratio run 2026-04-04 --from extract --through analyze`](./cli.md#run) | Uses ordinary resume decisions: current extraction and analysis can be skipped, while incomplete or obsolete work runs. |
All three stop before publication. Inspect the results and run All three stop before publication. Inspect the results and run
[`narratio publish`](./cli.md#publish) separately when delivery is intended. [`narratio run SESSION --stage publish --force`](./cli.md#run) separately when delivery is intended.
For the extraction-plus-analysis development loop, use: For the extraction-plus-analysis development loop, use:
```bash ```bash
narratio regenerate-artifacts 2026-04-04 narratio artifacts regenerate 2026-04-04
narratio regenerate-artifacts 2026-04-04 --artifacts session_recap,player_handout narratio artifacts regenerate 2026-04-04 --artifacts session_recap,player_handout
``` ```
This command is a transparent expansion to a forced bounded `run` from This command shares the forced bounded execution operation from
`extract` through `analyze`. Extraction always rebuilds its complete configured `extract` through `analyze`. Extraction always rebuilds its complete configured
bundle. Analysis rebuilds the selected targets and their required analysis bundle. Analysis rebuilds the selected targets and their required analysis
prerequisites, or uses the normal default selection when no artifact names are prerequisites, or uses the normal default selection when no artifact names are
@@ -219,7 +280,7 @@ set is ready:
```bash ```bash
narratio session artifacts 2026-04-04 narratio session artifacts 2026-04-04
narratio publish 2026-04-04 narratio run 2026-04-04 --stage publish --force
``` ```
If planning or execution reports stale, missing, failed, or tampered If planning or execution reports stale, missing, failed, or tampered
@@ -233,6 +294,71 @@ earlier checkpoints are reused and execution resumes with failed, stale, or
missing work in dependency order. `--force` is unnecessary unless the operator missing work in dependency order. `--force` is unnecessary unless the operator
intends to replace otherwise-current artifacts. intends to replace otherwise-current artifacts.
### Developing With Audita And Notarius Overlays
All three applications use ConfigKit, but each owns its root configuration and
its own `overlays/` directory beside that file. A Narratio testing overlay can
explicitly select downstream testing overlays without requiring their names to
match. For example, Narratio's `overlays/testing.yml` may contain:
```yaml
audita:
overlay: testing
notarius:
config_overlay: downstream-economy
```
Place Audita's settings in `overlays/testing.yml` beside its configuration, and
Notarius's settings in `overlays/downstream-economy.yml` beside its configuration.
Use each tool's own schema for model/profile selection and other settings;
Narratio neither copies those settings nor implicitly forwards its overlay name.
Select the Narratio file with `--overlay testing` on the desired command. Each
downstream selector is used only when its stage actually executes: `polish` for
Audita and `extract` for Notarius. Production can omit both selectors.
Set `audita.debug: true` in Narratio to request Audita debug capture. Omission
or false adds no debug override. Narratio supplies the run-local `polish/debug` work destination and
the separate `polish/logs` report destination. Notarius's debug directory does
not enable capture; its `--debug` flag is not currently forwarded by Narratio.
See the upstream [Audita configuration](https://forge.maximumdirect.net/eric/audita/src/tag/v4.2.0/docs/config.md)
and [Notarius CLI](https://gitea.maximumdirect.net/eric/notarius/src/tag/v0.8.1/docs/cli.md).
Edits inside downstream configuration behind an unchanged selector are not
automatically detected by Narratio. To inspect a fresh Audita debug run, explicitly
rerun polish, for example:
```sh
narratio run SESSION --overlay testing --force --from polish --through polish
```
This replaces polish output and invalidates dependent results; it is not a
diagnostics-only operation. Selecting testing does not create an isolated
workspace or retain a separate current result.
Notarius v0.8+ defaults to two additional eligible transient provider attempts
per generation. Review downstream retry settings and Narratio's extraction
timeout together; retries can increase elapsed time and provider charges.
Notarius v0.8.1 refreshes its built-in profile checkpoint identity, so older
checkpoints may not be reused. Source-keyed chunk plans and already published
outputs are unaffected; no manual cache deletion is required.
Selecting Narratio's `testing` overlay then supplies `downstream-economy` only
when extraction executes. Switching that explicit selector makes a recorded
extraction non-current and reruns it when `extract` is in the selected stage
range; the usual dependent invalidation then applies. Selecting an overlay does
not create a separate workspace or retain a separate current extraction result.
Narratio cannot observe edits inside Notarius configuration behind an unchanged
selector. Force extraction after such an edit when a replacement is intended.
Use `artifacts regenerate` when both extraction and analysis must be rebuilt;
use `run SESSION --stage analyze --force` when the existing extraction bundle
should be preserved. Field
semantics belong in [Configuration](./config.md#notarius-configuration-overlay),
with Audita selectors covered under
[Audita selection and credentials](./config.md#audita-selection-and-credentials).
Exact downstream invocations belong in the [Audita](./integrations/audita.md)
and [Notarius](./integrations/notarius.md#invocation) integration contracts.
## Artifact Selection ## Artifact Selection
For a configured artifact family, selecting its family key expands to every For a configured artifact family, selecting its family key expands to every
@@ -240,13 +366,13 @@ concrete character artifact. Select a concrete generated key to operate on one
member only. Manifests and plan output retain the concrete key as the durable member only. Manifests and plan output retain the concrete key as the durable
identity and include the family and character ID as optional provenance. identity and include the family and character ID as optional provenance.
`--artifacts` can be used on `run`, `session plan`, `run-stage`, `analyze`, and `--artifacts` can be used on `run`, `session plan`, and
`publish`. For a bounded run or plan, the selected range must contain `analyze` `artifacts regenerate`. For a bounded run or plan, the selected range must contain `analyze`
or `publish`. or `publish`.
Selection behavior: Selection behavior:
- validates names against `pipeline.scriptorium.artifacts`; - validates names against the derived concrete catalog and family selections;
- selects explicit analyze targets and permits their required configured - selects explicit analyze targets and permits their required configured
prerequisites to be reused or rebuilt first; prerequisites to be reused or rebuilt first;
- filters publish rules for `narratio.artifact.<name>` sources only; - filters publish rules for `narratio.artifact.<name>` sources only;
@@ -272,8 +398,8 @@ are not selectable or published implicitly.
Configured Notarius references resolve only from the current manifest-backed Configured Notarius references resolve only from the current manifest-backed
prepared inputs. Their canonical locations are `inputs/party.yml`, prepared inputs. Their canonical locations are `inputs/party.yml`,
`inputs/players.yml`, `inputs/glossary.yml`, and, when configured, `inputs/players.yml`, the four `inputs/glossaries/{party,campaign,setting,spells}.yml`
`inputs/spell_catalog.json`. Extraction supplies Notarius with verified, files, and, when configured, `inputs/spell_catalog.json`. Extraction supplies Notarius with verified,
content-addressed copies under content-addressed copies under
`cache/notarius/references/<sha256>/<prepared-basename>`. The full lowercase `cache/notarius/references/<sha256>/<prepared-basename>`. The full lowercase
SHA-256 digest identifies the reference bytes, so retries and later invocations SHA-256 digest identifies the reference bytes, so retries and later invocations
@@ -302,7 +428,7 @@ prepared file is missing or inconsistent with its manifest checksum, repair
the source configuration and refresh prepared state first: the source configuration and refresh prepared state first:
```bash ```bash
narratio run-stage prepare 2026-04-04 --force narratio run 2026-04-04 --stage prepare --force
``` ```
Starting a replacement clears the previous extraction payload from the current Starting a replacement clears the previous extraction payload from the current
@@ -337,6 +463,57 @@ execute. Deleting Narratio's local reference snapshots does not invalidate a
complete durable extraction; missing snapshots are reconstructed only when a complete durable extraction; missing snapshots are reconstructed only when a
later extraction actually runs. later extraction actually runs.
## Migrating Manifest Overlay Provenance
The pipeline-selection rename is a clean cutover. Manifests containing
`effective_config.selected_profile` are rejected by strict decoding; Narratio
does not silently discard or translate that retired field.
Before using an affected local session with the new version:
1. Stop Narratio activity for the session and back up its manifest.
2. Rename only `effective_config.selected_profile` to `selected_overlay`, keeping
its `name` and `source`, or remove the retired informational member. If a
current `selected_overlay` member already exists, retain it and remove the
retired member rather than creating duplicate keys.
3. Preserve the schema version, digest, stage records, checkpoint evidence,
output references, and other session state. Retry the intended command.
This metadata is informational, not resume authority. Do not delete session
progress or force all stages merely to perform this migration. Other unknown
fields still require investigation rather than blanket removal.
Do not edit immutable remote committed snapshots. Restoring an older snapshot
with retired provenance requires a compatible previous Narratio version, followed
by migration of the restored local manifest before using the new version.
## Migrating Audita and Provider Credentials
Install Audita v4.2 and its own configuration and selected pipeline before
running polish. Move ordered processing configuration into Audita; remove the
retired Narratio `pipeline.audita.modules` field. Update every old
`narratio.input.glossary` binding to the intended explicit glossary source and
rewrite legacy glossary files into the named-collection format. Narratio does
not translate these settings or files. Install a catalog separately when using
setting or system selections; see [glossary inputs](config.md#glossary-inputs).
List each downstream provider's exact environment-variable name in
`audita.credentials`; Narratio passes resolved values to Audita and does not
infer names or generate the downstream configuration. `audita.config_path`
and `audita.overlay` select Audita's configuration independently of Narratio's
overlay. Consult [Audita's configuration guide](https://forge.maximumdirect.net/eric/audita/src/tag/v4.2.0/docs/config.md).
Operators can install the independently maintained [D&D recipes](https://forge.maximumdirect.net/eric/audita-pipelines-dnd/src/commit/6d5e66dcfca4bb5971a8423332a19ce884b846c0/README.md)
and select their production or testing overlays explicitly; Narratio does not
bundle those recipes or infer a downstream selection.
Preparation compares effective vocabulary and prepared evidence when deciding
reuse. If it changes, normal preparation invalidation applies; use
`narratio run <session-id> --stage prepare --force` when regeneration is needed.
Polish tracks its selected configuration and prepared glossary evidence, but
does not inspect the contents of Audita-owned files. Force polish after changing
those files behind unchanged selectors. Reports and debug destinations are
run-local; see the [Audita integration contract](integrations/audita.md).
## External Command Lifecycle ## External Command Lifecycle
When an external command is cancelled or times out, Narratio terminates its When an external command is cancelled or times out, Narratio terminates its
@@ -347,13 +524,16 @@ reaped, and descendants that keep standard output or error open cannot keep
the invocation blocked. Other operating systems fail closed rather than launch the invocation blocked. Other operating systems fail closed rather than launch
a command without tree ownership. a command without tree ownership.
Subprocess stdout and stderr diagnostics are separately redacted and capped at Subprocess diagnostic streams are separately redacted and capped at 8 MiB per
8 MiB per invocation. Narratio does not retain configured credential values in invocation. Narratio does not retain configured credential values in these logs
these logs or their error tails; reaching a capture limit terminates the command or their error tails; reaching a capture limit terminates the command tree and
tree and reports which stream exceeded the limit. reports which stream exceeded the limit. Scriptorium result stdout is captured
separately without redaction; see its [integration contract](integrations/scriptorium.md).
Run-local diagnostics are: Run-local diagnostics are:
- `runs/{run_id}/polish/logs/{errors.yml,recoveries.yml,report.md}` when
Audita reporting is enabled, alongside captured streams and invocation records
- `runs/{run_id}/extract/notarius.receipt.json` - `runs/{run_id}/extract/notarius.receipt.json`
- `runs/{run_id}/extract/notarius.stderr.log` - `runs/{run_id}/extract/notarius.stderr.log`
- `runs/{run_id}/extract/notarius-output/` before durable promotion - `runs/{run_id}/extract/notarius-output/` before durable promotion
@@ -367,23 +547,27 @@ Unlisted files and unsafe entries are never uploaded; a run with no declared
current-run diagnostics uploads no run-local files. No distinguished diagnostic current-run diagnostics uploads no run-local files. No distinguished diagnostic
file is uploaded. The durable bundle is never scanned for implicit publication; file is uploaded. The durable bundle is never scanned for implicit publication;
only lanes named by explicit `pipeline.publish.outputs` rules are uploaded. only lanes named by explicit `pipeline.publish.outputs` rules are uploaded.
To inspect a published polish report remotely, read its declared object under
the run archive's `polish/logs/` prefix. Session restore does
not restore run-archive diagnostics as canonical session files; it restores only
the committed manifest and declared transcript/artifact objects.
To intentionally replace the current extraction result, run: To intentionally replace the current extraction result, run:
```bash ```bash
narratio run-stage extract 2026-04-04 --force narratio run 2026-04-04 --stage extract --force
``` ```
Narratio automatically reruns extraction when its recorded invocation contract, Narratio automatically reruns extraction when its recorded invocation contract,
prepared Narratio reference identities, or durable output validation changes. prepared Narratio reference identities, or durable output validation changes.
The semantic portion covers Notarius enablement, pipeline identity, declared The semantic portion covers Notarius enablement, pipeline identity, declared
reference mapping, and output contracts. Executable, timeout, working directory, reference mapping, output contracts, and the explicit Notarius configuration
and private config-file paths are operational and do not invalidate a current profile selector. Executable, timeout, working directory, and private
result. config-file paths are operational and do not invalidate a current result.
It cannot fingerprint configuration files, profiles, prompts, modules, or It cannot fingerprint configuration or profile contents, prompts, modules, or
other references loaded transitively by Notarius itself. Force extraction after other references loaded transitively by Notarius itself. Force extraction after
changing any of those inputs, even when the top-level Narratio and Notarius changing any of those inputs behind an unchanged selector, even when the
config paths remain the same. A forced extract top-level Narratio and Notarius config paths remain the same. A forced extract
marks successful downstream stages stale. Ordinary extraction failures or marks successful downstream stages stale. Ordinary extraction failures or
outcome changes also stale affected downstream stages, while an identical outcome changes also stale affected downstream stages, while an identical
repeated `notarius_disabled` self-skip does not repeatedly invalidate them. repeated `notarius_disabled` self-skip does not repeatedly invalidate them.
@@ -400,22 +584,18 @@ before commit selection.
Run publish only: Run publish only:
```bash ```bash
narratio publish 2026-04-04 narratio run 2026-04-04 --stage publish --force
``` ```
Equivalent: This selection stops after publish and does not invoke cleanup. A
```bash
narratio run-stage publish 2026-04-04 --force
```
This standalone command stops after publish and does not invoke cleanup. A
default full `run` continues through notify and cleanup. default full `run` continues through notify and cleanup.
Publish commit model: Publish commit model:
- uploads eligible run files under `{session_prefix}/runs/{run_id}/`, excluding - uploads eligible run files under `{session_prefix}/runs/{run_id}/`, excluding
audio and the run-local Notarius staging bundle; audio and the run-local Notarius staging bundle;
- uploads prepared campaign, session, and party documents under the run's
`prepare/inputs/` prefix, when recorded by the manifest;
- uploads configured published outputs and `previous/**` cache files into the - uploads configured published outputs and `previous/**` cache files into the
same immutable run scope, including only explicitly configured extraction same immutable run scope, including only explicitly configured extraction
lanes; lanes;
@@ -477,7 +657,7 @@ Operational rules:
Examples: Examples:
```bash ```bash
narratio session locks 2026-04-04 narratio session locks list 2026-04-04
narratio session locks add 2026-04-04 narratio.artifact.session_recap --reason "manual edits" --force narratio session locks add 2026-04-04 narratio.artifact.session_recap --reason "manual edits" --force
narratio session locks remove 2026-04-04 narratio.artifact.session_recap narratio session locks remove 2026-04-04 narratio.artifact.session_recap
``` ```
@@ -504,8 +684,8 @@ plan, so it is not a network-free operation.
Default restore scope: Default restore scope:
- the committed session manifest and the committed transcript/artifact objects - the committed session manifest, prepared campaign/session/party documents,
declared by the selected remote commit and transcript/artifact objects declared by the selected remote commit
- `previous/**` when needed by configured previous-session artifact inputs; - `previous/**` when needed by configured previous-session artifact inputs;
each is selected from its exact committed `published_output` declaration each is selected from its exact committed `published_output` declaration
@@ -575,6 +755,8 @@ Run-local layout:
- `runs/{run_id}/{stage}/reports` - `runs/{run_id}/{stage}/reports`
- `runs/{run_id}/{stage}/config` - `runs/{run_id}/{stage}/config`
- `runs/{run_id}/{stage}/scratch` - `runs/{run_id}/{stage}/scratch`
- `runs/{run_id}/polish/debug` for Audita's selected work destination
- `runs/.validation/polish` for validation probes
Spool layout (runtime/transient): Spool layout (runtime/transient):
@@ -608,21 +790,20 @@ Provision a credential directory as `0700` and credential files as `0600`;
these permission modes are an operator requirement and are not enforced by these permission modes are an operator requirement and are not enforced by
ConfigKit. ConfigKit.
Every pipeline-loading command bootstraps credentials once, before the first Pipeline acquisition uses the directory declared in the main pipeline file,
configuration load and before any adapter is constructed. `--secrets-dir` when present, before resolving typed credentials. Remove `--secrets-dir` from
selects an explicit directory (relative paths use caller CWD). Otherwise a old invocations and declare `config.secrets_dir`, or provision environment values.
present `secrets/` beside the resolved root pipeline is used, while an absent A pipeline beside the former system-wide directory can select `secrets`; other
conventional directory is skipped. Explicit missing/empty selections and layouts follow [ConfigKit's path rules](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md#explicit-secrets-directory-bootstrap).
invalid existing directories fail the command. ConfigKit follows a symlink used See [Secrets Handling](config.md#secrets-handling) for Narratio's integration.
as the selected directory, but immediate entries must be regular non-symlink
files. Existing environment variables—including empty values—always win.
S3 `access_key_id` and `secret_access_key` are an optional pair of typed S3 `access_key_id` and `secret_access_key` are an optional pair of typed
environment references. When both are absent, the AWS SDK retains its default environment references. When both are absent, the AWS SDK retains its default
credential provider chain. When both are configured, Narratio supplies their credential provider chain. When both are configured, Narratio supplies their
load-time resolved values through an explicit static provider. Audita's optional load-time resolved values through an explicit static provider. Audita and
`llm_api_key` is likewise captured at pipeline load and supplied only through Notarius credential lists likewise resolve at pipeline load. Each adapter
the child process's `AUDITA_LLM_API_KEY` override. receives only its listed names and captured values, with no alias mapping or
ambient environment inheritance. See [configuration](./config.md#audita-selection-and-credentials).
External adapter results are individually bounded before Narratio validates or External adapter results are individually bounded before Narratio validates or
materializes them. These per-file limits do not reserve disk space: prevent hard materializes them. These per-file limits do not reserve disk space: prevent hard
@@ -634,20 +815,20 @@ the session workload.
Session-scoped cleanup: Session-scoped cleanup:
```bash ```bash
narratio clean 2026-04-04 narratio session clean 2026-04-04
``` ```
Global cleanup: Global cleanup:
```bash ```bash
narratio clean --all narratio session clean --all
``` ```
Dry-run and cache variants: Dry-run and cache variants:
```bash ```bash
narratio clean 2026-04-04 --dry-run --clear-cache narratio session clean 2026-04-04 --dry-run --clear-cache
narratio clean --all --dry-run --clear-cache narratio session clean --all --dry-run --clear-cache
``` ```
Rules: Rules:
@@ -666,9 +847,9 @@ Cleanup derives only the configured run-scoped spool and workspace targets,
uses root-confined deletion, and does not read or mutate object storage. A uses root-confined deletion, and does not read or mutate object storage. A
failure leaves publish succeeded and the remote committed snapshot current. failure leaves publish succeeded and the remote committed snapshot current.
Retry with a normal full run: valid upstream work, including publish and notify, Retry with a normal full run: valid upstream work, including publish and notify,
is skipped while the failed cleanup stage runs again. `run-stage cleanup` is is skipped while the failed cleanup stage runs again. `run SESSION --stage cleanup` is
also available when the manifest has valid publish evidence. A range ending at also available when the manifest has valid publish evidence. A range ending at
`notify` or earlier and the standalone `publish` command never delete local `notify` or earlier and `run SESSION --stage publish` never delete local
state. state.
Older local manifests that contain the retired cleanup-obligation field are Older local manifests that contain the retired cleanup-obligation field are
@@ -685,5 +866,11 @@ normal migration path.
- Publish requires prerequisite stages through `render` and `analyze` to be succeeded. - Publish requires prerequisite stages through `render` and `analyze` to be succeeded.
- Markdown publish defaults require render outputs (`transcripts/final.md` and `transcripts/final.trimmed.md`). - Markdown publish defaults require render outputs (`transcripts/final.md` and `transcripts/final.trimmed.md`).
- Restore requires configured object storage and committed remote current state. - Restore requires configured object storage and committed remote current state.
- Pipeline-loading commands bootstrap filesystem secrets once before configuration - Each reached pipeline acquisition applies its configured startup before typed
resolution and object-store initialization. credential resolution and object-store initialization.
Console progress and informational diagnostics use native invocation visibility.
`--progress` shows work without requiring verbose mode; `--verbose` adds source
and decision context. Console `--debug` does not enable downstream debug capture
or change retention. Downstream streams stay in captured logs. See
[CLI reporting](cli.md#reporting-and-visibility) for mode combinations and formats.

327
docs/oss/attribution.md Normal file
View File

@@ -0,0 +1,327 @@
# Open Source Attribution Notices
## Standard Repository Policies
Material: `docs/policy/documentation.md`, adapted from revision
`5b9088601290564647a9e20c13f95c0da9f4cb15`; `docs/policy/agents.md`,
`architecture.md`, `testing.md`, `release.md`, `meta.md`, and `oss.md`; root
`AGENTS.md` and the policy reading guide in `docs/development.md`, adapted from
revision `593c9b52273c5c879785ae9e995d21026df467b4` for this repository.
Copyright (C) 2026 Eric Rakestraw
SPDX-License-Identifier: CC-BY-SA-4.0
License and notices: [CC BY-SA 4.0](licenses/CC-BY-SA-4.0.txt) |
[COPYRIGHT](https://gitea.maximumdirect.net/eric/policy/src/commit/593c9b52273c5c879785ae9e995d21026df467b4/COPYRIGHT) |
[LICENSE](https://gitea.maximumdirect.net/eric/policy/src/commit/593c9b52273c5c879785ae9e995d21026df467b4/LICENSE) |
[COPYRIGHT](https://gitea.maximumdirect.net/eric/policy/src/commit/5b9088601290564647a9e20c13f95c0da9f4cb15/COPYRIGHT) |
[LICENSE](https://gitea.maximumdirect.net/eric/policy/src/commit/5b9088601290564647a9e20c13f95c0da9f4cb15/LICENSE).
[Source](https://gitea.maximumdirect.net/eric/policy/src/commit/593c9b52273c5c879785ae9e995d21026df467b4).
[Source](https://gitea.maximumdirect.net/eric/policy/src/commit/5b9088601290564647a9e20c13f95c0da9f4cb15).
## ConfigKit
Selected module: `go.maximumdirect.net/configkit` at `v1.4.0`.
Copyright (C) 2026 Eric Rakestraw
SPDX-License-Identifier: LGPL-3.0-or-later
License and notices: [LGPL 3.0](licenses/LGPL-3.0.txt) |
[GPL 3.0](licenses/GPL-3.0.txt) |
[COPYRIGHT](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/COPYRIGHT) |
[LICENSE](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/LICENSE).
[Source](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3).
## CommandKit
Selected module: `go.maximumdirect.net/commandkit` at `v0.8.0`.
Copyright (C) 2026 Eric Rakestraw
SPDX-License-Identifier: LGPL-3.0-or-later
License and notices: [LGPL 3.0](licenses/LGPL-3.0.txt) |
[GPL 3.0](licenses/GPL-3.0.txt) |
[COPYRIGHT](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/COPYRIGHT) |
[LICENSE](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae/LICENSE).
[Source](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/0b53a63648c536afe50c46f948159116f776adae).
## CommandKit ckconfig
Selected module: `go.maximumdirect.net/ckconfig` at `v0.11.0`.
Copyright (C) 2026 Eric Rakestraw
SPDX-License-Identifier: LGPL-3.0-or-later
License and notices: [LGPL 3.0](licenses/LGPL-3.0.txt) |
[GPL 3.0](licenses/GPL-3.0.txt) |
[COPYRIGHT](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/cd5cf483a46caeff7ca0a91fb4747d57188a3888/integrations/ckconfig/COPYRIGHT) |
[LICENSE](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/cd5cf483a46caeff7ca0a91fb4747d57188a3888/integrations/ckconfig/LICENSE).
[Source](https://forge.maximumdirect.net/base-layer/commandkit/src/commit/cd5cf483a46caeff7ca0a91fb4747d57188a3888).
## ReleaseKit
Selected module: `go.maximumdirect.net/releasekit` at `v0.10.0`; adapted launcher and Woodpecker delivery workflow.
Copyright (C) 2026 Eric Rakestraw
SPDX-License-Identifier: LGPL-3.0-or-later
License and notices: [LGPL 3.0](licenses/LGPL-3.0.txt) |
[GPL 3.0](licenses/GPL-3.0.txt) |
[COPYRIGHT](https://forge.maximumdirect.net/base-layer/releasekit/src/commit/82bac1a3ab935beddd4b8789d1e07f52135d4243/COPYRIGHT) |
[LICENSE](https://forge.maximumdirect.net/base-layer/releasekit/src/commit/82bac1a3ab935beddd4b8789d1e07f52135d4243/LICENSE).
[Source](https://forge.maximumdirect.net/base-layer/releasekit/src/commit/82bac1a3ab935beddd4b8789d1e07f52135d4243).
## Cobra
Selected module: `github.com/spf13/cobra` at `v1.10.2` (transitive dependency).
Copyright 2013-2023 The Cobra Authors
SPDX-License-Identifier: Apache-2.0
License and notices: [Apache 2.0](licenses/Apache-2.0.txt) |
[LICENSE.txt](https://github.com/spf13/cobra/blob/88b30ab89da2d0d0abb153818746c5a2d30eccec/LICENSE.txt).
[Source](https://github.com/spf13/cobra/commit/88b30ab89da2d0d0abb153818746c5a2d30eccec).
## pflag
Selected module: `github.com/spf13/pflag` at `v1.1.0` (transitive dependency).
Copyright (c) 2012 Alex Ogier. All rights reserved.
Copyright (c) 2012 The Go Authors. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
License and notices: [BSD 3-Clause](licenses/BSD-3-Clause.txt) |
[LICENSE](https://github.com/spf13/pflag/blob/f8a990678a6d44385313e9b19e40737f889f9b14/LICENSE).
[Source](https://github.com/spf13/pflag/commit/f8a990678a6d44385313e9b19e40737f889f9b14).
## YAML v3
Selected module: `gopkg.in/yaml.v3` at `v3.0.1`.
Copyright (c) 2006-2010 Kirill Simonov
Copyright (c) 2006-2011 Kirill Simonov
Copyright (c) 2011-2019 Canonical Ltd
Copyright 2011-2016 Canonical Ltd.
SPDX-License-Identifier: MIT AND Apache-2.0
License and notices: [MIT](licenses/MIT.txt) |
[Apache 2.0](licenses/Apache-2.0.txt) |
[LICENSE](https://github.com/go-yaml/yaml/blob/f6f7691b1fdeb513f56608cd2c32c51f8194bf51/LICENSE) |
[NOTICE](https://github.com/go-yaml/yaml/blob/f6f7691b1fdeb513f56608cd2c32c51f8194bf51/NOTICE).
[Source](https://github.com/go-yaml/yaml/commit/f6f7691b1fdeb513f56608cd2c32c51f8194bf51).
## YAML v4
Selected module: `go.yaml.in/yaml/v4` at `v4.0.0`.
Copyright 2006-2010 Kirill Simonov
Copyright 2011-2019 Canonical Ltd
Copyright 2025 The go-yaml Project Contributors
SPDX-License-Identifier: MIT AND Apache-2.0
License and notices: [MIT](licenses/MIT.txt) |
[Apache 2.0](licenses/Apache-2.0.txt) |
[LICENSE](https://github.com/yaml/go-yaml/blob/f2f9563503f11b7a60da0c532175dcc693ce8d5a/LICENSE) |
[NOTICE](https://github.com/yaml/go-yaml/blob/f2f9563503f11b7a60da0c532175dcc693ce8d5a/NOTICE).
[Source](https://github.com/yaml/go-yaml/commit/f2f9563503f11b7a60da0c532175dcc693ce8d5a).
## go-cmp
Selected module: `github.com/google/go-cmp` at `v0.7.0` (test-only).
Copyright (c) 2017 The Go Authors. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
License and notices: [BSD 3-Clause](licenses/BSD-3-Clause.txt) |
[LICENSE](https://github.com/google/go-cmp/blob/9b12f366a942ebc7254abc7f32ca05068b455fb7/LICENSE).
[Source](https://github.com/google/go-cmp/commit/9b12f366a942ebc7254abc7f32ca05068b455fb7).
## Go sync extension
Selected module: `golang.org/x/sync` at `v0.22.0`.
Copyright 2009 The Go Authors.
SPDX-License-Identifier: BSD-3-Clause
License and notices: [BSD 3-Clause](licenses/BSD-3-Clause.txt) |
[LICENSE](https://github.com/golang/sync/blob/1eb64d4bc0cde6da1bb8ebc7f178bb577508e5d0/LICENSE) |
[PATENTS](https://github.com/golang/sync/blob/1eb64d4bc0cde6da1bb8ebc7f178bb577508e5d0/PATENTS).
[Source](https://github.com/golang/sync/commit/1eb64d4bc0cde6da1bb8ebc7f178bb577508e5d0).
## Go system extension
Selected module: `golang.org/x/sys` at `v0.47.0`.
Copyright 2009 The Go Authors.
SPDX-License-Identifier: BSD-3-Clause
License and notices: [BSD 3-Clause](licenses/BSD-3-Clause.txt) |
[LICENSE](https://github.com/golang/sys/blob/9e7e939dcafac07e8ab4cffa6e5fc74908413f00/LICENSE) |
[PATENTS](https://github.com/golang/sys/blob/9e7e939dcafac07e8ab4cffa6e5fc74908413f00/PATENTS).
[Source](https://github.com/golang/sys/commit/9e7e939dcafac07e8ab4cffa6e5fc74908413f00).
## Go runtime and standard library
Material: Go `1.27.4` runtime and standard library material incorporated in
release binaries built with the declared `golang:1.27.4` CI toolchain.
Copyright 2009 The Go Authors.
SPDX-License-Identifier: BSD-3-Clause
License and notices: [BSD 3-Clause](licenses/BSD-3-Clause.txt) |
[LICENSE](https://github.com/golang/go/blob/7b2881024c95a11ddb86663a616340aa3a88b67f/LICENSE) |
[PATENTS](https://github.com/golang/go/blob/7b2881024c95a11ddb86663a616340aa3a88b67f/PATENTS).
[Source](https://github.com/golang/go/commit/7b2881024c95a11ddb86663a616340aa3a88b67f).
## AWS SDK for Go v2
Selected modules under `github.com/aws/aws-sdk-go-v2` at source revision
`2223642aeafb3b46ae924667ee47d31a1cf5a9d5`: root `v1.41.7`,
`aws/protocol/eventstream` `v1.7.10`, `config` `v1.32.17`, `credentials`
`v1.19.16`, `feature/ec2/imds` `v1.18.23`, `internal/configsources`
`v1.4.23`, `internal/endpoints/v2` `v2.7.23`, `internal/v4a` `v1.4.24`,
`service/internal/accept-encoding` `v1.13.9`, `service/internal/checksum`
`v1.9.15`, `service/internal/presigned-url` `v1.13.23`,
`service/internal/s3shared` `v1.19.23`, `service/signin` `v1.0.11`,
`service/sso` `v1.30.17`, `service/ssooidc` `v1.35.21`, and `service/sts`
`v1.42.1`.
Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copyright 2014-2015 Stripe, Inc.
SPDX-License-Identifier: Apache-2.0
License and notices: [Apache 2.0](licenses/Apache-2.0.txt) |
[LICENSE.txt](https://github.com/aws/aws-sdk-go-v2/blob/2223642aeafb3b46ae924667ee47d31a1cf5a9d5/LICENSE.txt) |
[NOTICE.txt](https://github.com/aws/aws-sdk-go-v2/blob/2223642aeafb3b46ae924667ee47d31a1cf5a9d5/NOTICE.txt).
[Source](https://github.com/aws/aws-sdk-go-v2/commit/2223642aeafb3b46ae924667ee47d31a1cf5a9d5).
## AWS SDK for Go v2 S3
Selected module: `github.com/aws/aws-sdk-go-v2/service/s3` at `v1.101.0`.
Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Copyright 2014-2015 Stripe, Inc.
SPDX-License-Identifier: Apache-2.0
License and notices: [Apache 2.0](licenses/Apache-2.0.txt) |
[LICENSE.txt](https://github.com/aws/aws-sdk-go-v2/blob/84ddd08980744ac0f3bacfe7d2796c861671accc/service/s3/LICENSE.txt) |
[NOTICE.txt](https://github.com/aws/aws-sdk-go-v2/blob/84ddd08980744ac0f3bacfe7d2796c861671accc/NOTICE.txt).
[Source](https://github.com/aws/aws-sdk-go-v2/commit/84ddd08980744ac0f3bacfe7d2796c861671accc).
## AWS Smithy Go
Selected module: `github.com/aws/smithy-go` at `v1.25.1`.
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
License and notices: [Apache 2.0](licenses/Apache-2.0.txt) |
[LICENSE](https://github.com/aws/smithy-go/blob/e094f45e716e33a1b950cf8bbe804790bf87f965/LICENSE) |
[NOTICE](https://github.com/aws/smithy-go/blob/e094f45e716e33a1b950cf8bbe804790bf87f965/NOTICE).
[Source](https://github.com/aws/smithy-go/commit/e094f45e716e33a1b950cf8bbe804790bf87f965).
## Go singleflight in AWS SDK for Go v2
Material: `internal/sync/singleflight` in the selected AWS SDK root module.
Copyright (c) 2009 The Go Authors. All rights reserved.
Copyright 2013 The Go Authors. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
License and notices: [BSD 3-Clause](licenses/BSD-3-Clause.txt) |
[LICENSE](https://github.com/aws/aws-sdk-go-v2/blob/2223642aeafb3b46ae924667ee47d31a1cf5a9d5/internal/sync/singleflight/LICENSE).
[Source](https://github.com/aws/aws-sdk-go-v2/commit/2223642aeafb3b46ae924667ee47d31a1cf5a9d5).
## Go singleflight in AWS Smithy Go
Material: `internal/sync/singleflight` in the selected smithy-go module.
Copyright (c) 2009 The Go Authors. All rights reserved.
Copyright 2013 The Go Authors. All rights reserved.
SPDX-License-Identifier: BSD-3-Clause
License and notices: [BSD 3-Clause](licenses/BSD-3-Clause.txt) |
[LICENSE](https://github.com/aws/smithy-go/blob/e094f45e716e33a1b950cf8bbe804790bf87f965/internal/sync/singleflight/LICENSE).
[Source](https://github.com/aws/smithy-go/commit/e094f45e716e33a1b950cf8bbe804790bf87f965).
## JSON Schema
Selected module: `github.com/santhosh-tekuri/jsonschema/v6` at `v6.0.3`.
SPDX-License-Identifier: Apache-2.0
License and notices: [Apache 2.0](licenses/Apache-2.0.txt) |
[LICENSE](https://github.com/santhosh-tekuri/jsonschema/blob/b0fc661f4939578bc429f408c18202573dbafcc4/LICENSE).
[Source](https://github.com/santhosh-tekuri/jsonschema/commit/b0fc661f4939578bc429f408c18202573dbafcc4).
## Go text extension
Selected module: `golang.org/x/text` at `v0.14.0`.
Copyright 2009 The Go Authors.
SPDX-License-Identifier: BSD-3-Clause
License and notices: [BSD 3-Clause](licenses/BSD-3-Clause.txt) |
[LICENSE](https://github.com/golang/text/blob/6c97a165dd661335ff7bce6104a008558123c353/LICENSE) |
[PATENTS](https://github.com/golang/text/blob/6c97a165dd661335ff7bce6104a008558123c353/PATENTS).
[Source](https://github.com/golang/text/commit/6c97a165dd661335ff7bce6104a008558123c353).
## Narratio reference catalog
Material: `internal/glossary/glossary-v1.schema.json`.
SPDX-License-Identifier: CC0-1.0
License and notices: [CC0 1.0](licenses/CC0-1.0.txt) |
[LICENSE](https://forge.maximumdirect.net/eric/narratio-reference-catalog/src/commit/a1a87edafd59a1de545a1c0b4efe5feeb80348e0/LICENSE).
[Source](https://forge.maximumdirect.net/eric/narratio-reference-catalog/src/commit/a1a87edafd59a1de545a1c0b4efe5feeb80348e0).

View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,11 @@
Copyright (c) <year> <owner>.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -0,0 +1,170 @@
Creative Commons Attribution-ShareAlike 4.0 International
Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. More considerations for licensors.
Considerations for the public: By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensor’s permission is not necessary for any reason–for example, because of any applicable exception or limitation to copyright–then that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to respect those requests where reasonable. More considerations for the public.
Creative Commons Attribution-ShareAlike 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
Section 1 – Definitions.
a. Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
c. BY-SA Compatible License means a license listed at creativecommons.org/compatiblelicenses, approved by Creative Commons as essentially the equivalent of this Public License.
d. Copyright and Similar Rights means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
e. Effective Technological Measures means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
f. Exceptions and Limitations means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
g. License Elements means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution and ShareAlike.
h. Licensed Material means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
i. Licensed Rights means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
j. Licensor means the individual(s) or entity(ies) granting rights under this Public License.
k. Share means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
l. Sui Generis Database Rights means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
m. You means the individual or entity exercising the Licensed Rights under this Public License. Your has a corresponding meaning.
Section 2 – Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
A. reproduce and Share the Licensed Material, in whole or in part; and
B. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
3. Term. The term of this Public License is specified in Section 6(a).
4. Media and formats; technical modifications allowed. The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
5. Downstream recipients.
A. Offer from the Licensor – Licensed Material. Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
B. Additional offer from the Licensor – Adapted Material. Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapter’s License You apply.
C. No downstream restrictions. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
6. No endorsement. Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this Public License.
3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties.
Section 3 – License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified form), You must:
A. retain the following if it is supplied by the Licensor with the Licensed Material:
i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of warranties;
v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
b. ShareAlike.In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
1. The Adapter’s License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-SA Compatible License.
2. You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
3. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
Section 4 – Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database;
b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
Section 5 – Disclaimer of Warranties and Limitation of Liability.
a. Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.
b. To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.
c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
Section 6 – Term and Termination.
a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
2. upon express reinstatement by the Licensor.
c. For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
d. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
e. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
Section 7 – Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
Section 8 – Interpretation.
a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at creativecommons.org/policies, Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
Creative Commons may be contacted at creativecommons.org.

View File

@@ -0,0 +1,121 @@
Creative Commons Legal Code
CC0 1.0 Universal
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
HEREUNDER.
Statement of Purpose
The laws of most jurisdictions throughout the world automatically confer
exclusive Copyright and Related Rights (defined below) upon the creator
and subsequent owner(s) (each and all, an "owner") of an original work of
authorship and/or a database (each, a "Work").
Certain owners wish to permanently relinquish those rights to a Work for
the purpose of contributing to a commons of creative, cultural and
scientific works ("Commons") that the public can reliably and without fear
of later claims of infringement build upon, modify, incorporate in other
works, reuse and redistribute as freely as possible in any form whatsoever
and for any purposes, including without limitation commercial purposes.
These owners may contribute to the Commons to promote the ideal of a free
culture and the further production of creative, cultural and scientific
works, or to gain reputation or greater distribution for their Work in
part through the use and efforts of others.
For these and/or other purposes and motivations, and without any
expectation of additional consideration or compensation, the person
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
is an owner of Copyright and Related Rights in the Work, voluntarily
elects to apply CC0 to the Work and publicly distribute the Work under its
terms, with knowledge of his or her Copyright and Related Rights in the
Work and the meaning and intended legal effect of CC0 on those rights.
1. Copyright and Related Rights. A Work made available under CC0 may be
protected by copyright and related or neighboring rights ("Copyright and
Related Rights"). Copyright and Related Rights include, but are not
limited to, the following:
i. the right to reproduce, adapt, distribute, perform, display,
communicate, and translate a Work;
ii. moral rights retained by the original author(s) and/or performer(s);
iii. publicity and privacy rights pertaining to a person's image or
likeness depicted in a Work;
iv. rights protecting against unfair competition in regards to a Work,
subject to the limitations in paragraph 4(a), below;
v. rights protecting the extraction, dissemination, use and reuse of data
in a Work;
vi. database rights (such as those arising under Directive 96/9/EC of the
European Parliament and of the Council of 11 March 1996 on the legal
protection of databases, and under any national implementation
thereof, including any amended or successor version of such
directive); and
vii. other similar, equivalent or corresponding rights throughout the
world based on applicable law or treaty, and any national
implementations thereof.
2. Waiver. To the greatest extent permitted by, but not in contravention
of, applicable law, Affirmer hereby overtly, fully, permanently,
irrevocably and unconditionally waives, abandons, and surrenders all of
Affirmer's Copyright and Related Rights and associated claims and causes
of action, whether now known or unknown (including existing as well as
future claims and causes of action), in the Work (i) in all territories
worldwide, (ii) for the maximum duration provided by applicable law or
treaty (including future time extensions), (iii) in any current or future
medium and for any number of copies, and (iv) for any purpose whatsoever,
including without limitation commercial, advertising or promotional
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
member of the public at large and to the detriment of Affirmer's heirs and
successors, fully intending that such Waiver shall not be subject to
revocation, rescission, cancellation, termination, or any other legal or
equitable action to disrupt the quiet enjoyment of the Work by the public
as contemplated by Affirmer's express Statement of Purpose.
3. Public License Fallback. Should any part of the Waiver for any reason
be judged legally invalid or ineffective under applicable law, then the
Waiver shall be preserved to the maximum extent permitted taking into
account Affirmer's express Statement of Purpose. In addition, to the
extent the Waiver is so judged Affirmer hereby grants to each affected
person a royalty-free, non transferable, non sublicensable, non exclusive,
irrevocable and unconditional license to exercise Affirmer's Copyright and
Related Rights in the Work (i) in all territories worldwide, (ii) for the
maximum duration provided by applicable law or treaty (including future
time extensions), (iii) in any current or future medium and for any number
of copies, and (iv) for any purpose whatsoever, including without
limitation commercial, advertising or promotional purposes (the
"License"). The License shall be deemed effective as of the date CC0 was
applied by Affirmer to the Work. Should any part of the License for any
reason be judged legally invalid or ineffective under applicable law, such
partial invalidity or ineffectiveness shall not invalidate the remainder
of the License, and in such case Affirmer hereby affirms that he or she
will not (i) exercise any of his or her remaining Copyright and Related
Rights in the Work or (ii) assert any associated claims and causes of
action with respect to the Work, in either case contrary to Affirmer's
express Statement of Purpose.
4. Limitations and Disclaimers.
a. No trademark or patent rights held by Affirmer are waived, abandoned,
surrendered, licensed or otherwise affected by this document.
b. Affirmer offers the Work as-is and makes no representations or
warranties of any kind concerning the Work, express, implied,
statutory or otherwise, including without limitation warranties of
title, merchantability, fitness for a particular purpose, non
infringement, or the absence of latent or other defects, accuracy, or
the present or absence of errors, whether or not discoverable, all to
the greatest extent permissible under applicable law.
c. Affirmer disclaims responsibility for clearing rights of other persons
that may apply to the Work or any use thereof, including without
limitation any person's Copyright and Related Rights in the Work.
Further, Affirmer disclaims responsibility for obtaining any necessary
consents, permissions or other rights required for any use of the
Work.
d. Affirmer understands and acknowledges that Creative Commons is not a
party to this document and has no duty or obligation with respect to
this CC0 or use of the Work.

View File

@@ -0,0 +1,674 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

View File

@@ -0,0 +1,165 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

18
docs/oss/licenses/MIT.txt Normal file
View File

@@ -0,0 +1,18 @@
MIT License
Copyright (c) <year> <copyright holders>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.

79
docs/policy/agents.md Normal file
View File

@@ -0,0 +1,79 @@
# Agent Policy
**Base Policy Version:** 1.3
**Last Updated**: 2026-11-17
**Upstream Source**: https://gitea.maximumdirect.net/eric/policy/src/commit/593c9b52273c5c879785ae9e995d21026df467b4/docs/policy/agents.md
## Purpose
Agents must read and follow these rules.
## Implementation Discipline
**KEY PRINCIPLES:** Write the simplest idiomatic code that satisfies the user's
request. Do not implicitly strengthen requirements, restrictions, or guarantees
beyond what the user actually requested.
**Keep implementation machinery proportionate.** Use straightforward,
idiomatic code and introduce only the machinery needed to support the requested
behavior and flexibility. Optimize for conceptual simplicity and
maintainability, not for the fewest lines, fewest options, or narrowest product
surface.
**Do not invent restrictions.** Do not reject, prohibit, constrain, cap,
harden, or otherwise narrow behavior unless required by the user, an explicit
repository contract, or an unavoidable correctness constraint. Preserve
operator and caller choice where policy has not been established. If an
additional restriction appears advisable, present it as a decision rather than
silently implementing it.
**Do not invent guarantees.** Do not strengthen public contracts, guarantees,
or invariants beyond those expressly requested by the user.
**Use the standard library.** For example: in almost every case, the best
approach to copying files is to use the standard library. Writing custom code to
implement power-loss protection at the application level, or to guard against
bad actors with privileged and concurrent access to the host's filesystem,
is wasteful, unnecessary, and not idiomatic. Stick to the simple, standard, and
idiomatic approach unless another path is expressly requested by the user.
**An implementation detail is not repository policy.** Tests and documentation
must not elevate incidental behavior into a durable guarantee or restriction
unless that behavior was expressly selected as part of the contract.
## Git Commit Policy
By default, commit each completed, nonempty unit of work using a
concise, plain-English message describing what changed. This policy is standing
authorization to create those local commits; a separate user request is not
required. An explicit user instruction to leave work uncommitted takes precedence.
A unit of work is a focused, reviewable outcome, including its relevant tests and
documentation.
Complete the appropriate validation before committing. If work is incomplete or
validation is blocked, report that state accurately.
Before committing:
1. Run `git status --short` and review the relevant diff, including any staged
changes. Identify changes that predate the current unit of work.
2. Exclude secrets, local environment files, generated junk, and unrelated changes.
3. Stage only the files or hunks belonging to the completed unit. Use `git add .`
only when every included change belongs to that unit. Preserve unrelated
staged and unstaged work.
4. Review `git diff --staged` and run appropriate checks for the change. Reuse
successful checks for unchanged content.
5. Review `git log --oneline -n 10` and use
`git commit -m "<concise plain-English commit message>"`.
6. Report the commit identifier and any remaining uncommitted work.
If the unit cannot be safely separated from pre-existing work, leave it uncommitted
and explain the overlap rather than silently including that work. If a commit
fails, preserve the changes and report the failure; do not bypass hooks.
Default commit authorization does not authorize pushing, publishing, amending,
resetting, reverting, or rewriting history. Those actions require a separate user
instruction. Do not use `git commit -a` or `git commit --no-verify` to bypass the
staging and validation discipline above.

View File

@@ -1,10 +1,41 @@
# Architecture # Architecture Policy
This document defines Narratio's intended high-level architecture and the **Base Policy Version:** 1.3
invariants that changes must preserve. Implemented component details belong in
the [Internal Overview](../internal/overview.md) and its linked documents. **Last Updated**: 2026-11-22
Significant architectural decision history belongs under `docs/adr/` when such
records exist. **Upstream Source**: https://gitea.maximumdirect.net/eric/policy/src/commit/593c9b52273c5c879785ae9e995d21026df467b4/docs/policy/architecture.md
## Purpose And Ownership
The adopted policy defines the application's purpose and the architectural
constraints contributors must follow. It owns system boundaries, responsibility
and dependency rules, established invariants, and explicit non-goals.
Describe the concrete package inventory and implementation mechanics in internal
documentation. Link to canonical public contracts for their exact behavior and
to ADRs for decision rationale.
## Architectural Approach
Hexagonal architecture is strongly recommended, including encapsulating external
integrations and APIs within internal adapters. Keep domain and application
logic independent of external integration details, and make dependency direction
clear in the adopted policy.
Implement that separation with proportionate, idiomatic code. Choose interfaces
and package layout to serve the application's actual boundaries. Use adapters
for collaborators with external integration responsibilities.
## Adopted Constraints And Implemented Structure
Architectural constraints govern current and future development. Record
implemented structure accurately, proposals and implementation status in the
roadmap, and significant decisions and rationale in ADRs. Describe a target
structure as implemented when its changes land.
Constraints must reflect deliberately selected requirements and decisions.
Do not promote incidental implementation choices into architectural invariants.
## System Shape ## System Shape
@@ -21,7 +52,7 @@ their domains:
- Notarius extracts validated structured artifact bundles; and - Notarius extracts validated structured artifact bundles; and
- Scriptorium executes prompts and produces configured artifacts. - Scriptorium executes prompts and produces configured artifacts.
Narratio owns orchestration, configuration resolution, session and run state, Narratio owns orchestration, configuration interpretation, session and run state,
artifact and path modeling, manifest persistence, stage sequencing, resume, artifact and path modeling, manifest persistence, stage sequencing, resume,
restore, cleanup gates, and publish semantics. External contracts are defined restore, cleanup gates, and publish semantics. External contracts are defined
in the [integration documentation](../integrations/). in the [integration documentation](../integrations/).
@@ -42,7 +73,7 @@ itself an architectural goal.
## Ownership And Dependency Direction ## Ownership And Dependency Direction
The application boundary owns command dispatch, configuration selection, The application boundary owns command composition, configuration selection,
production composition, session locking, and top-level lifecycle. It may depend production composition, session locking, and top-level lifecycle. It may depend
on concrete implementations to assemble a run. on concrete implementations to assemble a run.
@@ -96,6 +127,11 @@ according to a fixed application-owned relation that is separate from canonical
execution order. The relation is validated against the stage inventory and is execution order. The relation is validated against the stage inventory and is
not configurable. not configurable.
Downstream readiness is an invocation check after selected preparation and
before the selected processing work. It does not create a stage success.
Session validation uses existing prepared inputs; its downstream checks may
probe destinations and contact configured providers.
A stage may explicitly self-skip with a stable reason and no outputs. That A stage may explicitly self-skip with a stable reason and no outputs. That
outcome is persisted, clears older outputs owned by the stage, and is outcome is persisted, clears older outputs owned by the stage, and is
reconsidered on a later invocation. A stage may also validate whether an reconsidered on a later invocation. A stage may also validate whether an
@@ -141,20 +177,32 @@ or other non-regular conflict into a successful restore.
## Configuration ## Configuration
Configuration is strict, explicit, centralized, and operator-oriented. Configuration ownership follows
[ADR 0003](../adr/0003-assign-configuration-ownership.md):
- ConfigKit owns configuration policy and resolution through the final handoff.
Narratio supplies its schema, defaults, and configuration rules through
supported extension points. The completed ConfigKit result is authoritative.
- Narratio consumes that result without mutation and derives separate domain
objects. It must not construct a replacement effective configuration.
- CommandKit owns CLI mechanics and presentation; `ckconfig` exposes ConfigKit
inspection. Narratio supplies selection and acquisition wiring through native
adapters without changing upstream semantics or substituting inspection views.
Missing configuration or inspection capabilities are addressed upstream.
- YAML decoding rejects unknown fields. - YAML decoding rejects unknown fields.
- Defaults are centralized and testable. - Defaults are centralized and testable.
- Empty configured values do not silently replace meaningful defaults. - Defaults apply only to absent fields. Explicit false, zero, empty, and null
values remain present and are evaluated by Narratio's domain rules.
- Validation rejects invalid configuration before stage execution where - Validation rejects invalid configuration before stage execution where
practical. practical.
- Root-owned imports and one selected profile resolve deterministically through - ConfigKit resolves local imports and the selected pipeline overlay.
the configuration owner; commands do not implement their own merge rules. - Canonical party rosters are campaign-owned inputs. Narratio derives players
- Canonical party rosters are campaign-owned. Their derived players projection projections and concrete character-family artifacts as separate domain
and concrete character-family artifacts are resolved before runtime stages objects before execution, without modifying configuration.
or adapters receive configuration.
- Resume uses stage- or artifact-owned semantic evidence for observable - Resume uses stage- or artifact-owned semantic evidence for observable
result-affecting configuration; profile identity and an effective digest are result-affecting configuration; overlay identity and an effective digest are
provenance, never blanket cache keys. provenance, never blanket cache keys.
- Session templating remains narrow and deterministic rather than becoming a - Session templating remains narrow and deterministic rather than becoming a
general configuration language. general configuration language.
@@ -222,7 +270,7 @@ rereads remote storage. A cleanup failure makes the invocation incomplete while
leaving publish succeeded and the committed remote snapshot authoritative. A leaving publish succeeded and the committed remote snapshot authoritative. A
normal later full run reuses valid upstream stages and retries cleanup. normal later full run reuses valid upstream stages and retries cleanup.
The standalone `publish` command selects only publish and therefore never `run SESSION --stage publish` selects only publish and therefore never
invokes cleanup. Operators may select cleanup directly only when the manifest invokes cleanup. Operators may select cleanup directly only when the manifest
contains valid successful publication evidence. contains valid successful publication evidence.
@@ -247,12 +295,12 @@ uses a separate restrictive contract.
Raw secrets must not be stored in pipeline, campaign, or session YAML or written Raw secrets must not be stored in pipeline, campaign, or session YAML or written
to manifests, logs, generated configuration, reports, publish metadata, to manifests, logs, generated configuration, reports, publish metadata,
documentation, or examples. Pipeline configuration names environment variables; documentation, or examples. Pipeline configuration names environment variables. Command-owned pipeline
command-owned startup may populate previously unset variables from ConfigKit's acquisition explicitly prepares the selected source through ConfigKit's
explicit or conventional secrets directory. This bootstrap occurs once per configured bootstrap before typed credential resolution and adapter construction.
invocation before any typed configuration load or adapter construction and is Completed acquisitions are reused normally; ConfigKit's selected environment
not hidden inside library loaders. Safe bootstrap diagnostics may identify policy governs each preparation. Library loading does not write the environment.
files and statuses but never values. Diagnostics should avoid transcript and Safe bootstrap diagnostics may identify files and statuses but never values. Diagnostics should avoid transcript and
prompt content unless a deliberate, bounded inspection mechanism requires it. prompt content unless a deliberate, bounded inspection mechanism requires it.
Logs, reports, generated invocation files, generated configuration, and render Logs, reports, generated invocation files, generated configuration, and render

View File

@@ -1,9 +1,15 @@
# Documentation Policy # Documentation Policy
**Base Policy Version:** 1.13
**Last Updated**: 2026-11-22
**Upstream Source**: https://gitea.maximumdirect.net/eric/policy/src/commit/5b9088601290564647a9e20c13f95c0da9f4cb15/docs/policy/documentation.md
## Purpose ## Purpose
This policy assigns each documentation topic to one canonical owner. Its goal is This policy assigns each documentation topic to one canonical owner. Its goal is
to keep Narratio documentation accurate, concise, discoverable, and resistant to keep this application's documentation accurate, concise, discoverable, and resistant
to drift for users, operators, developers, integrators, and LLM coding agents. to drift for users, operators, developers, integrators, and LLM coding agents.
## Core Rules ## Core Rules
@@ -12,36 +18,38 @@ to drift for users, operators, developers, integrators, and LLM coding agents.
Each authoritative fact belongs in one document. A non-owning document may give Each authoritative fact belongs in one document. A non-owning document may give
a short, stable summary for orientation, but it must link to the canonical owner a short, stable summary for orientation, but it must link to the canonical owner
instead of repeating volatile details. for volatile details.
Volatile details include commands, flags, configuration fields and defaults, Volatile details include commands, flags, configuration fields and defaults,
stage or integration keys, schemas, file names, paths, status codes, retry module keys, schemas, file names, paths, status codes, retry behavior, and
behavior, and runtime guarantees. If readers could reasonably treat a statement runtime guarantees. If readers could reasonably treat a statement as a
as a contract, maintain it only in the owning document. contract, maintain it only in the owning document.
### Current And Future Behavior ### Current And Future Behavior
Outside `docs/roadmap/`, documentation describes implemented behavior only. Outside `docs/roadmap/`, documentation describes implemented behavior only.
Partial features may be described only to their implemented boundary. Partial features may be described only to their implemented boundary.
ADRs are the narrow exception: an ADR may record an accepted architectural Architectural constraints may govern future changes. Describe current structure
decision before implementation, but acceptance must not be presented as proof from implemented behavior.
that the behavior exists. The roadmap owns implementation status and sequencing
until the decision is implemented. Current architecture, user, operator, ADRs may record an accepted architectural decision before implementation. The
integration, and internal documentation are updated when the behavior lands. roadmap owns implementation status and sequencing until the decision is
implemented. Current architecture, user, operator, integration, and internal
documentation are updated when the behavior lands.
### Audience And Detail ### Audience And Detail
Write for the document's stated audience and include only the detail needed for Write for the document's stated audience and include only the detail needed for
its owned topic. User and operator docs should not expose implementation detail. its owned topic. Keep user and operator docs focused on using and operating the
Developer docs should link to user-facing and external contracts rather than application. Developer docs should link to user-facing and external contracts
restate them. for their definitions.
### Examples ### Examples
Complete copyable files belong in `examples/`. Documentation may use the Complete copyable files belong in `examples/`. Documentation may use the
smallest illustrative snippet needed to explain its owned topic, but should link smallest illustrative snippet needed to explain its owned topic, but should link
to maintained examples instead of embedding a second complete copy. to maintained examples for complete copyable files.
Examples must be valid, secret-free, and tested where practical. Commands and Examples must be valid, secret-free, and tested where practical. Commands and
configuration used in documentation should match the application. configuration used in documentation should match the application.
@@ -57,63 +65,87 @@ secret values.
| Topic | Canonical owner | Owned content | Content owned elsewhere | | Topic | Canonical owner | Owned content | Content owned elsewhere |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| Product orientation and minimal end-to-end quickstart | `README.md` | What Narratio is, why it is useful, one shortest successful invocation, and links onward. | Complete command reference, configuration reference, operational procedures, implementation detail. | | Product orientation and minimal end-to-end quickstart | `README.md` | Purpose, value, shortest successful invocation, and navigation, including licensing and attribution. | Complete command reference, configuration reference, operational procedures, implementation detail. |
| Contributor entry point | `docs/development.md` | Task-oriented reading guide, minimal contributor orientation, baseline validation commands, and links to canonical docs. | Package inventory, architecture rules, subsystem behavior, detailed change recipes. | | Contributor entry point | `docs/development.md` | Task-oriented reading guide, contributor orientation, baseline validation commands, and canonical links. | Package inventory, architecture rules, subsystem behavior, detailed change recipes. |
| Maintainer release procedure | `docs/release.md` | Version selection, candidate preparation and validation, guarded tag publication, release completion boundary, failure recovery, and optional asynchronous inspection. | Script implementation mechanics, current application contracts, and historical release summaries. | | Application architecture policy | `docs/policy/architecture.md` | System shape, normative ownership, dependency direction, boundaries, invariants, safety properties, and non-goals. | Concrete package inventory, implementation mechanics, contributor procedures, decision history, future work. |
| Historical release summary | `docs/releases/<tag>.md` | Immutable summary, compatibility, upgrade, and changes for one released version. | Current maintainer procedure and current application contract details. | | Policy-set provenance and upstream navigation | `docs/policy/meta.md` | Policy-set origin, local authority, adoption baselines, and upstream adoption and update links. | Task-specific reading triggers, detailed adoption procedures, and formal attribution notices. |
| Current application architecture | `docs/policy/architecture.md` | System shape, normative ownership, dependency direction, architectural boundaries, invariants, safety properties, and non-goals. | Concrete package inventory, implementation mechanics, contributor procedures, decision history, future work. | | Agent policy | `docs/policy/agents.md` | Proportionate, idiomatic implementation; rules against inventing requirements, restrictions, guarantees, or policy. | Application contracts, architecture, testing policy, and contributor procedures. |
| Documentation organization | `docs/policy/documentation.md` | Documentation ownership, audience boundaries, maintenance rules, and ADR/document lifecycle. | Application architecture or product behavior. | | Documentation policy | `docs/policy/documentation.md` | Documentation ownership, audience boundaries, maintenance rules, and ADR/document lifecycle. | Application architecture or product behavior. |
| Testing policy | `docs/policy/testing.md` | Test philosophy, risk-based sufficiency, test boundaries, doubles, coverage guidance, regression-test policy, and criteria for adding, rewriting, or deleting tests. | Subsystem behavior, application contracts, subsystem-specific test inventories, and implementation plans. | | Testing policy | `docs/policy/testing.md` | Test philosophy, risk sufficiency, boundaries, doubles, coverage, regressions, and test maintenance. | Subsystem behavior, application contracts, subsystem-specific test inventories, and implementation plans. |
| CLI contract | `docs/cli.md` | Commands, arguments, flags, invocation semantics, output conventions, and exit behavior. | End-to-end operating procedures, configuration field definitions, runtime filesystem layout, stage implementation details. | | Release policy | `docs/policy/release.md` | Versioning, compatibility, release integrity and immutability, release documentation, proportionate gates, publication controls, completion, and required versus optional checks. | Repository-specific commands, product installation guidance, CLI version semantics, historical release summaries, and CI implementation detail. |
| Configuration contract | `docs/config.md` | Discovery and precedence, file schemas, fields, defaults, environment overrides, validation rules, and user-selectable stage or integration settings. | Complete example files, CLI syntax, runtime state lifecycle, implementation details. | | Open source licensing and attribution policy | `docs/policy/oss.md` | License defaults and author choices, COPYRIGHT and attribution formats, license/notice links, discoverability, maintenance, and concrete exceptions. | Component entries, license texts, release commands, and dependency security review. |
| Operations | `docs/operations.md` | Runtime workflows, physical filesystem and remote-state layout, output and diagnostic handling, resume, cleanup, permissions, recovery, and operational limits. | CLI flag syntax, configuration field definitions, logical artifact schemas, implementation mechanics. | | Project copyright and license grant | `COPYRIGHT` | Project identity, copyright holders and years, SPDX expression, grant, warranty disclaimer, and third-party statement. | Complete license texts and upstream component attribution. |
| Troubleshooting | `docs/troubleshooting.md` | Symptom-driven diagnosis, likely causes, safe inspection steps and remedies, and links to relevant contracts. | CLI syntax, configuration definitions, operational procedures, integration contracts, implementation mechanics. | | Project license texts | `LICENSE` | Complete project and incorporated companion license texts, with required project-specific fields. | General licensing policy and upstream component attribution. |
| Public HTTP contract, if introduced | `docs/api.md` | Routes, authentication, media types, request and response schemas, status codes, pagination, caching, idempotency, rate limits, and HTTP retry semantics. | Client walkthroughs, upstream or downstream integration internals, implementation detail. | | Upstream component attribution | `docs/oss/attribution.md` | House Format component entries: identity, material scope and modifications where applicable, copyright, license, required notices, and license, notice, and source links. | General attribution policy, exception reasoning, research narratives, compliance commentary, and complete standard license texts. |
| Consumer guidance, if a public package or API is introduced | `docs/consumers/` | Task-oriented use of the public interface, minimal client examples, and consumer responsibilities. | HTTP wire semantics, external protocol contracts, internal implementation detail. | | Standard dependency license texts | `docs/oss/licenses/` | Complete, verbatim standard license texts shared by applicable entries. | Project-specific upstream notices, attribution prose, and policy interpretation. |
| External and durable integration contracts | `docs/integrations/` | External file formats and protocols, upstream and downstream contracts, logical artifact paths and schemas, media types, and compatibility behavior. | Physical runtime placement and lifecycle, internal transformations, CLI syntax, configuration defaults. | | Repository-specific release procedure | `docs/release.md` | Maintainer prerequisites, candidate preparation, validation and publication commands and automated guards, asynchronous deliverables, delivery status, optional consumer verification, and recovery. | General release requirements, product installation guidance, historical release summaries, and current compatibility contracts. |
| Implemented component inventory | `docs/internal/overview.md` | Current packages and components, their implemented responsibilities, and links to focused internal docs. | Normative architecture, contributor reading policy, external contracts. | | CLI contract (if applicable) | `docs/cli.md` | Commands, arguments, flags, invocation semantics, and exit codes. | End-to-end operating procedures, configuration field definitions, runtime filesystem layout, module implementation details. |
| Internal component behavior | Other files under `docs/internal/` | Implementation flow, internal collaborators and state transitions, package-local guarantees and failures, and relevant tests. | Global architecture invariants, configuration definitions and defaults, external schemas, operator procedures. | | Configuration contract (if applicable) | `docs/config.md` | Discovery, precedence, schema, fields, defaults, environment overrides, validation, and selectable module and validator keys. | Complete example files, CLI syntax, runtime state lifecycle, module implementation details. |
| Architectural decision history | `docs/adr/` | Significant decisions, context, alternatives, rationale, consequences, and supersession history. | Current behavior reference, implementation status, task sequencing. | | Operations (if applicable) | `docs/operations.md` | Runtime workflows, physical filesystem and state layout, output, cache and debug handling, resume, cleanup, permissions, recovery, and limits. | CLI flag syntax, configuration field definitions, logical output schemas, implementation mechanics. |
| Future work and implementation status | `docs/roadmap/` | Proposed, accepted, deferred, or rejected work; implementation status; sequencing; and task breakdowns. | Implemented behavior reference and architectural decision rationale. | | Troubleshooting | `docs/troubleshooting.md` | Symptom-driven diagnosis, likely causes, safe inspection, and remedies. | Canonical commands, configuration definitions, operational procedures, and integration contracts. |
| Complete copyable artifacts | `examples/` | Maintained configuration, inputs, and other files intended to be copied or run. | Field-by-field reference, command reference, prose explanation. | | Integration contracts for external components (if applicable) | `docs/integrations/` | External formats and protocols, upstream and downstream contracts, logical output paths and schemas, media types, and compatibility. | Physical runtime placement and lifecycle, internal transformations, CLI syntax, configuration defaults. |
| Inventory of implemented internal packages | `docs/internal/overview.md` | Implemented packages and components, responsibilities, and links to focused internal docs. | Normative architecture, contributor reading policy, external contracts. |
| Behavior and architecture of internal packages | Other files under `docs/internal/` | Implementation flow, collaborators, state transitions, package-local guarantees and failures, and relevant tests. | Global architecture invariants, configuration definitions and defaults, external schemas, operator procedures. |
| Architectural decision records | `docs/adr/` | Records of significant architectural decisions and supporting rationale. | Ordinary design choices, current behavior reference, implementation status, task sequencing. |
| Future work and implementation status | `docs/roadmap/` | Proposed, accepted, or future work; implementation status, sequencing, and task breakdowns. | Implemented behavior reference and architectural decision rationale. |
| Release-note history | `docs/releases/` | One checked-in summary per source release under the procedure; the note at its immutable tag is the release record. | Current commands, behavior, contracts, and compatibility definitions. |
| Complete copyable artifacts | `examples/` | Maintained configuration, inputs, and other copyable or runnable files. | Field-by-field reference, command reference, prose explanation. |
Documents that do not exist are required only when the corresponding interface Create supporting documents for existing interfaces and responsibilities when
or responsibility exists. Do not create placeholder API, consumer, integration, substantive content is available.
or operations documents for behavior the application does not have.
## Boundary Rules ## Boundary Rules
### Orientation ### Orientation
The README owns product orientation. The developer guide routes contributors. Link among orientation, architecture, and internal documents; maintain each
Architecture owns normative structure. Internal overview owns the current package or behavior description in its canonical owner.
concrete component map. These documents may link to one another but should not
maintain parallel package or behavior descriptions.
### Commands, Configuration, Operations, And Troubleshooting ### Commands, Configuration, Operations, And Troubleshooting
CLI documentation answers how to invoke the application. Configuration CLI documentation answers how to invoke the application. Configuration
documentation answers what settings mean. Operations answers what happens to documentation answers what settings mean. Operations answers what happens to
runtime state and how to operate or recover the application. Troubleshooting runtime state and how to operate or recover the application. When a workflow
starts from observable symptoms and links readers to the owning command, crosses these topics, choose the document that owns the task and link to the
configuration, operational, or integration contract. When a workflow crosses other contracts. Troubleshooting begins with observable symptoms and links to the owning contract.
these topics, choose the document that owns the task and link to the other
contracts. ### Releases
The release policy defines requirements and invariants that every release must
satisfy. The repository-specific release procedure defines the commands and
workflow maintainers use to satisfy that policy. Release notes record history
at immutable tags. Maintain current behavior in its canonical documentation,
update it with the corresponding behavior changes, and keep release procedures
consistent with adopted policy.
### Project Licensing And Upstream Attribution
README and release documents link to the canonical licensing and attribution
materials under the [OSS policy](oss.md). The release procedure owns URL
construction and publication mechanics.
### Contracts And Implementation ### Contracts And Implementation
Integration and API documents define externally observable shapes and Integration and API documents define externally observable shapes and
semantics. Internal documents explain how Narratio implements or consumes those semantics. Internal documents explain how this application implements or consumes those
contracts. Internal docs may name a field, file, or protocol to identify a contracts. Internal docs may name a field, file, or protocol to identify a
dependency, but must link to its canonical contract for the definition. dependency, but must link to its canonical contract for the definition.
### Upstream Dependencies
When documenting an upstream dependency, identify the library and link to its
canonical documentation for its features and behavior. Maintain local
documentation for application-specific integration, configuration, and
adaptations. Brief summaries may orient readers; upstream documentation remains
the canonical reference for upstream behavior. Where behavior differs by
version, link to documentation applicable to the imported version.
### Security Topics ### Security Topics
This policy owns what documentation and examples may contain. Architecture owns This policy owns what documentation and examples may contain. Architecture owns
application security invariants. Configuration owns credential-supply application security invariants. Configuration owns credential-supply
mechanisms. Operations owns permissions and handling of sensitive runtime mechanisms. Operations owns permissions and handling of sensitive runtime
artifacts. Troubleshooting owns safe diagnostic and remediation guidance. artifacts. Internal docs own implementation mechanisms only.
Internal docs own implementation mechanisms only.
## Architecture Decision Records ## Architecture Decision Records
@@ -130,8 +162,15 @@ Use sequentially numbered ADR filenames such as
Treat the decision content of an accepted ADR as immutable. When a decision Treat the decision content of an accepted ADR as immutable. When a decision
changes, create a new ADR and update the earlier ADR's status to superseded. changes, create a new ADR and update the earlier ADR's status to superseded.
Rejected architectural alternatives belong in the ADR; rejected product ideas
belong in the roadmap. ADRs should be reserved for major architectural decisions, such as ownership
boundaries, large-scale architectural features, or invariants that rise to
the level of architectural significance. Routine choices, implementation
decisions, and rejected suggestions do not warrant an ADR unless they
otherwise represent a significant architectural decision.
Roadmaps should preserve plausible future work, not rejected product
ideas.
## Maintenance ## Maintenance

27
docs/policy/meta.md Normal file
View File

@@ -0,0 +1,27 @@
# Policy Set Provenance
**Base Policy Version:** 1.0
**Last Updated**: 2026-11-17
**Upstream Source**: https://gitea.maximumdirect.net/eric/policy/src/commit/593c9b52273c5c879785ae9e995d21026df467b4/docs/policy/meta.md
## Origin And Local Authority
This repository's policy set is adapted from
[Standard Repository Policies](https://gitea.maximumdirect.net/eric/policy).
The adopted local policies govern work in this repository. Upstream revisions
become local policy through deliberate adoption, preserving local decisions.
Each policy's `Upstream Source` identifies its adopted baseline.
## Adoption And Updates
For policy adoption, upstream revision reviews, and updates, consult the
[upstream adoption and update guide](https://gitea.maximumdirect.net/eric/policy/src/branch/main/docs/adoption.md).
That guide and the reference example collection are maintained upstream and
accessed through links. Keep discovery links pointed at the current upstream
project and guide; keep adopted-source and example links pinned to commits.
The local [developer guide](../development.md) routes tasks to applicable
policies. Formal credit and licensing notices for the copied policy material
belong in the local [attribution document](../oss/attribution.md).

225
docs/policy/oss.md Normal file
View File

@@ -0,0 +1,225 @@
# Open Source Licensing And Attribution Policy
**Base Policy Version:** 1.9
**Last Updated**: 2026-11-17
**Upstream Source**: https://gitea.maximumdirect.net/eric/policy/src/commit/593c9b52273c5c879785ae9e995d21026df467b4/docs/policy/oss.md
## Purpose And Scope
This policy defines project licensing conventions and a repeatable House Format
for upstream attribution and license notices. It covers the project's own code
and upstream components incorporated into or distributed with the application
or library, including relevant transitive dependencies and copied code,
documentation, or assets.
Determine treatment from the component's terms and actual use.
Consulting development guidance or using tooling alone does not require an
attribution entry. Copying or adapting documentation for inclusion in the
repository is different: preserve its applicable attribution and license terms.
A material's role as development guidance does not exempt copied documents.
Apply any express permissions for attribution-free reuse of example formatting.
The baseline is a publicly available source repository with releases published
alongside it. The format is independent of language, forge, and build system.
It does not require attribution for every development tool, establish license
compatibility, or resolve every obligation arising from use or distribution.
## Canonical Locations
The [documentation policy](documentation.md) assigns ownership:
- `COPYRIGHT`: project name, copyright statements, SPDX expression, grant,
warranty disclaimer, and third-party statement.
- `LICENSE` contains the complete, unmodified project license text, including
incorporated companion text. Dependency attribution does not relicense the project.
- `docs/oss/attribution.md`: canonical component entries.
- `docs/oss/licenses/`: complete, verbatim standard and applicable companion texts.
Use recognizable license filenames, such as `Apache-2.0.txt` or `LGPL-3.0.txt`.
A shared standard text may serve multiple entries. Keep explanations outside
license texts and preserve distinct versions and exceptions.
## Narratio Licensing Scope
Narratio application code remains GPL-3.0-or-later under its existing
[COPYRIGHT](../../COPYRIGHT) and [LICENSE](../../LICENSE). Its source and release
artifacts are hosted on Gitea; separately installed subprocess applications are
not incorporated merely because Narratio invokes them. The
[release procedure](../release.md) owns publication mechanics. Policy documents
adapted from Standard Repository Policies retain CC-BY-SA-4.0 under the distinct
scope recorded in COPYRIGHT and [attribution](../oss/attribution.md).
## Upstream Reference Examples
Use the commit-pinned upstream examples to create actual project notices.
Retain their links and keep the example collection upstream; keep applicable
license texts locally as specified above.
## Project Licensing
Unless the author specifies otherwise, use **GPL version 3 or later**
(`GPL-3.0-or-later`) for applications and **LGPL version 3 or later**
(`LGPL-3.0-or-later`) for libraries. An author's explicit choice takes precedence:
for example, a one-off script may use MIT. Such a choice requires no exception
rationale, additional approval, or compensating controls under this policy.
These defaults guide new license selection. Adopting this policy does not
relicense existing code or override third-party terms. Preserve an existing
license unless the author deliberately changes it. For mixed-purpose projects,
follow the author's selected scope rather than inferring different licenses for
individual packages.
Use the upstream [application COPYRIGHT example](https://gitea.maximumdirect.net/eric/policy/src/commit/a469273adda336625f96b9d769ea27b33999f146/examples/licensing/application/COPYRIGHT)
or [library COPYRIGHT example](https://gitea.maximumdirect.net/eric/policy/src/commit/a469273adda336625f96b9d769ea27b33999f146/examples/licensing/library/COPYRIGHT)
to create the project’s root `COPYRIGHT` file.
Use the COPYRIGHT examples exactly as provided, except for placeholder
substitutions and changes expressly required or authorized by this policy or
the author.
Use verified project names, contribution years, and copyright holders.
For another selected license, adapt the grant, SPDX expression, disclaimer, and
text references together to reflect the author's selected grant.
For GPLv3 projects, copy the complete GPLv3 text into `LICENSE`. For LGPLv3
projects, place the complete LGPLv3 text followed by the complete GPLv3 text in
`LICENSE`; the LGPL incorporates the GPL terms. Keep the texts unmodified and
place project-specific statements in `COPYRIGHT`. For the default grants, the
grant and SPDX expression in `COPYRIGHT` must expressly identify `or-later`;
follow the author’s choice if a different grant is selected.
For other licenses, provide their complete text and any required project-specific
fields; the standard reference collection remains unchanged. Keep `COPYRIGHT`,
`LICENSE`, SPDX expressions, and README descriptions consistent with the actual
grant. This convention introduces no blanket requirement for per-file headers;
preserve notices or add them where the applicable terms require them.
Identify separately licensed documentation or assets in the project grant, with
links to their attribution and license information. An application's default
code license does not override the terms of incorporated documentation.
## Upstream Attribution House Format
Begin `docs/oss/attribution.md` with `# Open Source Attribution Notices`,
followed directly by component entries. These comprise the complete document.
Each entry presents these five fields in order, with blank lines between them:
1. **Project name** as a level-two heading. An optional identification paragraph
may follow, such as `Selected module: MODULE at VERSION.` with the module and
version in backticks. For copied documentation, a concise `Material:` sentence
may identify the affected files and whether they were adapted or copied
without modification. A factual qualifier such as `(transitive dependency)`
is permitted. Limit optional identification prose to factual component and
material scope.
2. **Upstream copyright statement or statements**, preserving their wording.
Put multiple statements in separate paragraphs. Include this field when the
selected upstream source supplies an applicable statement; otherwise, omit it.
3. **SPDX license identifier or expression**, when applicable, using
`SPDX-License-Identifier: EXPRESSION`.
4. **License and notice links**, beginning `License and notices:`, separated
by ` | `, and ending with a period. Label local standard texts by license
name, such as `MIT` or `Apache 2.0`. Label upstream files by their actual
filenames, such as `COPYRIGHT`, `LICENSE`, `NOTICE`, or `PATENTS`.
5. **Source repository link**, rendered exactly as `[Source](COMMIT_URL).`.
Use the upstream [attribution example](https://gitea.maximumdirect.net/eric/policy/src/commit/a469273adda336625f96b9d769ea27b33999f146/examples/licensing/attribution.md)
to create the project’s `docs/oss/attribution.md`.
The example illustrates omitted fields and multiple copyrights and licenses.
Replace the uppercase placeholders and illustrative URLs with actual component
information. Local license links are relative to the destination
`docs/oss/attribution.md`; copy the applicable texts into its `licenses/`
directory. Do not copy example entries for components the project does not use.
These are five fields, not a line limit. Omit the SPDX field when no applicable
identifier exists; identify nonstandard terms through the linked text. Preserve
licensing alternatives and exceptions, and record a selected option when
relevant through the factual license identification. Do not invent an identifier
or silently resolve an unsettled licensing choice.
Keep entries factual. Do not add agent-authored explanations of license
expressions, file-level license scope, research performed, retained source
notices, or compliance conclusions. Avoid filler such as "none is invented
here" and embellished link labels such as "upstream LICENSE", "additional
patent grant", or "at the imported commit". Preserve actual required upstream
content; this rule excludes editorial additions, not required notices. Policy
interpretation and exception reasoning belong in the adopted OSS policy or an
appropriate decision record, not the attribution document.
## License Texts And Upstream Links
Link standard license texts to their local copies. Link project-specific
notices to their upstream copies. Every upstream repository or notice link must
identify the exact commit corresponding to the
imported version, including the selected source revision for copied material.
Classify material according to its contents. An upstream `LICENSE`,
`COPYING`, or similar file may contain project-specific notices or exceptions
in addition to standard wording. Link both the local standard text and the
commit-specific upstream file when needed. Make companion license texts directly
reachable from the entry.
For project-specific license and attribution material, this policy accepts
direct links to the applicable upstream texts as satisfying reproduction,
inclusion, or copy requirements. This is the adopted house interpretation.
Agents must apply it without adding local-copy requirements or seeking repeated
approval solely because a license uses those terms.
This interpretation concerns notice reproduction. Concrete obligations such as
marking modified files or supplying corresponding source receive their own
applicable treatment. Preserve required notices already present in incorporated
source files; the central attribution entry does not authorize stripping them.
## Discoverability
End the project's README with two friendly statements linking to its actual
grant in `COPYRIGHT` and the attribution document. For example, for a project
with the stated license:
```markdown
PROJECT_NAME is licensed under the [LGPL v3.0 or later](COPYRIGHT).
[Open Source attribution notices](docs/oss/attribution.md) are available.
```
Each new checked-in release document and its hosted download page must end
with links whose visible text is `COPYRIGHT | LICENSE | ATTRIBUTION`. Use absolute
URLs to those files at the release's immutable tag or corresponding immutable source
revision so the links work in both locations. This release navigation is distinct
from upstream component links, which must use the imported commit.
Reuse the checked-in release document as the hosted release body where supported.
The release procedure owns concrete URLs and publication mechanics for delivering
the links through the selected channel. Do not maintain duplicate notice lists.
These conventions do not by themselves require separate downloadable license
assets, source bundles, or a different binary package format.
## Maintenance And Exceptions
Update project licensing statements together when the author changes the grant
or its scope. Update upstream notices in the change that adds, removes, upgrades,
copies, or changes the distribution of a relevant component. Check the selected source's license
and notices rather than assuming they are unchanged. Update affected entries,
commit links, and texts; retain historical versions through Git.
Check affected statements, faithful standard-text copies, and link destinations
as part of ordinary change review. For a future release tag, check intended file
paths against the candidate source; the tag need not resolve remotely before
publication. Do not add publication-time network checks, CI polling, recurring
legal sign-offs, mandatory scanners, or a full software bill of materials merely
to implement this policy.
Use the House Format routinely. Raise an exception only for a concrete obligation
or unresolved rights question it does not address, including any arising from a
particular distribution channel. Record the issue and selected treatment in the
adopted OSS policy or an appropriate decision record. Attribution entries
contain the resulting factual identification and required material, without
repeating that reasoning. Resolve the issue before the affected use or
distribution without reopening settled choices.
Common ownership of projects is neither required nor a blanket exception.
Apply the formatting convention prospectively. Do not rewrite published tags,
notes, binaries, or checksums to retrofit it. Address actual omissions deliberately
under the applicable terms and the [release correction policy](release.md#immutability-and-failure-recovery).
Ordinary attribution maintenance and release links are preparation work, not new
release approval gates.

248
docs/policy/release.md Normal file
View File

@@ -0,0 +1,248 @@
# Release Policy
**Base Policy Version:** 1.7
**Last Updated**: 2026-11-23
**Upstream Source**: https://gitea.maximumdirect.net/eric/policy/src/commit/593c9b52273c5c879785ae9e995d21026df467b4/docs/policy/release.md
## Purpose
This policy defines a proportionate workflow for validating and publishing an
intended source revision under a fresh version. Releases should require little
routine intervention, avoid repeated work, and preserve published contents.
Adopt stronger verification or reproducibility requirements through an explicit
project-specific decision justified by the intended audience and support needs.
The repository-specific commands belong in `docs/release.md`. Historical release
summaries belong in `docs/releases/`. The procedure must agree with the adopted
policy and link to it rather than introduce additional release requirements.
## Release Model And Completion
A source release identifies one exact committed source revision through an
immutable version tag and a version-matched, checked-in release note. The
primary release branch is `main` unless the adopted policy specifies otherwise.
The procedure must name the authoritative publication remote.
A successful push of the intended tag, with its source commit available on the
authoritative primary branch, completes the release. The source commit may be
pushed before the tag or published together with it through an atomic push.
The procedure must choose and document the supported approach.
Release commands must finish at successful publication. They must not wait for
or poll CI, require successful CI status, inspect downloadable artifacts, or
check consumer installation or Go module availability as completion gates.
A failed or ambiguous push requires resolving the authoritative remote state
before declaring success or retrying; successful pushes do not require a
separate remote read-back gate.
Repositories may publish source only. Additional binaries, images, packages,
checksums, or other declared deliverables may be published asynchronously from
the tagged source. The procedure must identify those deliverables and the
responsibility of their automation. Published deliverables must be traceable
to that source and identify the same version.
Track source-release completion and artifact delivery separately. Report delivery
failures and optional investigations under artifact-delivery status.
## Versioning And Compatibility
Stable releases use Semantic Versioning in the form `vMAJOR.MINOR.PATCH`, with
no leading zeroes. Prereleases require an explicit adopted policy defining
their format and use.
The selected version must be unused locally and on the authoritative remote.
Do not require queries to every configured remote or publication service.
A version known to have already been published must not be reused, even if the
normal guards do not inspect that channel. Adding a distribution channel
requires a deliberate update to the policy and procedure where needed.
For releases at or after `v1.0.0`:
- a major release may make intentional incompatible changes;
- a minor release may add backward-compatible behavior or raise the Go consumer
minimum as described below; and
- a patch release may make backward-compatible fixes.
In this context, "backward-compatible" means only that pre-existing, valid
configurations will continue to work following the release. Behavior need not
remain strictly identical.
Before `v1.0.0`, a minor release may change a documented public, operational,
configuration, data, integration, or compatibility contract when the release
note explains the impact and required consumer action. A patch release must
not intentionally break those contracts within its minor line.
Additional compatibility promises and deliberate exceptions belong in the
adopted policy or canonical contract documentation. Release notes explain
changes; they do not redefine current compatibility contracts.
## Consumer Minimum And Release Toolchain
Distinguish the minimum toolchain supported for consumers from the toolchain
maintainers use to build and validate a release. Record the consumer minimum in
the language's standard metadata and explain its support meaning in canonical
documentation. Define the selected release toolchain and its setup commands in
`docs/release.md`. Toolchain selection and upgrade cadence are repository-specific
choices.
For Go repositories, normally declare the initial stable release of the selected
series as the consumer minimum, such as `go 1.26.0`. Use a higher patch minimum
when a dependency or an identified correctness fix requires it, and document
the reason.
For release-policy purposes, successful build and release validation on the
selected Go patch release are sufficient to presume support across that Go
series, subject to the declared consumer minimum and concrete evidence of
incompatibility. Investigate specific compatibility concerns as they arise.
Use the selected release toolchain for candidate validation and release builds,
including CI jobs performing those tasks. A newer validation patch version alone
leaves the consumer minimum unchanged.
A minor release may raise the Go consumer minimum, including from one Go series
to the next, both before and after `v1.0.0`. This is an explicit exception to the
backward-compatibility requirement for minor releases. Patch releases preserve
the consumer minimum. Explain an increase's impact and required consumer action
in the release note. Other incompatible changes remain subject to the versioning
rules above.
## Release Documentation And Preparation
Every new release must include `docs/releases/<version>.md` in the tagged
source tree. Use the complete version tag as the filename and begin with a
title containing the product name and that exact version.
Include a short summary and any relevant compatibility impact or upgrade
instructions. Choose sections suited to the release and keep the note
proportionate to the change.
Keep exact current contracts in their canonical documents and update affected
documentation with the behavior change. Link to those documents from the note
where useful. If annotated tags are used, derive their summary from the
checked-in note.
Include the release footer defined by the [OSS policy](oss.md#discoverability)
in each new release document and preserve it on the hosted download page. The
release procedure defines the concrete URLs and publication mechanics. Prepare
these links with the release note; they do not add a network check or approval
gate.
Handle version selection, release-note content, and retirement of completed
roadmaps during preparation. Preserve planned and deferred work and repair
affected links when retiring roadmaps. Reuse ordinary change review for
unintended files, credentials, and private data. Scope release-content review
to the tagged source.
## Candidate Validation
Provide one publication command that validates the final committed candidate,
checks publication state, and publishes the intended refs. A validation-only
mode or command may be provided for diagnosis, but must not be a required step
before publication repeats the same checks.
Run the complete deterministic, offline default test suite once for the final
candidate, following the [testing policy](testing.md). For repositories that
publish builds, verify the required build targets. Select those targets for
the application's actual support commitments; native testing on each platform
and access to particular hardware are not default release prerequisites.
Additional gates must address a concrete risk that the existing checks do not
adequately cover. Do not automatically require linting, race testing, module
hygiene audits, documentation audits, credential scans, example validation, or
expanded platform matrices solely because they are possible. Retain such
checks when their distinct protection justifies their cost. A one-time migration
check must not silently become a permanent release requirement.
Release tests must not require real credentials, mutable application services,
paid APIs, provider probes, or inference calls. The procedure may describe dependency
preparation separately from offline validation.
Avoid duplicate validation across release phases. Successful checks for the
same final candidate need not be repeated solely to satisfy another phase;
any reuse must clearly apply to that exact candidate. Persistent validation
caches are not required. If the candidate changes, validate the new candidate.
Cheap publication-state checks may be repeated immediately before pushing
because local or remote state may have changed during validation.
Automate mechanical guards. Human review gates are strongly disfavored: add one
only through an explicit project-specific policy decision explaining the
concrete risk and why ordinary change review or automation is insufficient.
Do not add routine confirmations for checks the command can perform itself.
## Narratio Candidate Checks
Narratio selects one race-enabled offline suite, full `go vet`, Go formatting,
and local module-replacement checks through ReleaseKit. The selected builds
verify Linux amd64, Linux arm64, and best-effort macOS arm64 binaries and the
embedded version on a host executable. Versioned module replacements remain
allowed; filesystem replacements are not release inputs. Workspace and vendor
files are not prohibited solely by their presence.
## Publication Guards
Automate the checks needed to publish the intended source under a fresh version:
- the version has the adopted format and is unused locally and on the
authoritative remote;
- the worktree and index are clean on the primary release branch;
- the source being published is the exact candidate that passed validation,
including its matching release note;
- the remote primary branch already identifies that candidate, or an atomic
source/tag push will advance it to that candidate without discarding remote
history; and
- the tag identifies the validated candidate and only the intended refs are
published.
Fetch the authoritative branch and tag state as needed for these checks.
Do not force branch or tag updates to bypass a failed guard. Publish explicit
refs rather than all local tags. Do not require CI success, publication-service
availability checks, or a separate manual confirmation for each guard.
## Immutability And Failure Recovery
Published version tags and published contents are immutable. Do not move,
overwrite, recreate, or delete a published tag, or replace a published artifact,
checksum, signature, provenance statement, or release note under that version.
The checked-in note at the immutable tag is that release's historical record.
If validation fails before publication, correct and commit the candidate and
rerun the publication command. If a push fails or its outcome is ambiguous,
inspect the authoritative remote before retrying. Remove an unpublished local
tag only after confirming it was never published or used by a release channel.
An unavailable remote leaves publication status unknown; do not overwrite a tag
to resolve uncertainty.
Transient network, authentication, CI, or consumer-availability failures do not
by themselves require a new version. Asynchronous delivery may be retried from
the same immutable tag. Missing artifacts may be published later, provided
existing published contents are not replaced and the additions remain consistent
with the tagged source and any already-published checksum manifest. If that
cannot be achieved, publish a new version.
A defect requiring changes to published source or contents requires a corrected
commit, a new semantically appropriate version, a matching release note, and
the release procedure again. Leave the original release intact. A channel's
yank, deprecation, or advisory mechanism may warn consumers away from a defective
release without replacing its contents or reusing its version.
## Repository Release Procedure
Maintain `docs/release.md` as a short, executable maintainer runbook. It must
identify:
1. prerequisites, selected release toolchain, primary branch, and authoritative
remote;
2. version and release-note preparation;
3. one publication command with its selected local checks and automated guards;
4. declared deliverables, required build targets, and automation responsibilities;
5. the successful-push completion point and separately reported delivery status;
and
6. failure handling, ambiguous-push recovery, and asynchronous delivery retries.
Use copyable commands where practical. Keep optional diagnostics and consumer
verification clearly optional. The procedure must not turn preparation work,
ordinary change review, or post-publication investigation into additional
release gates.

View File

@@ -1,39 +1,32 @@
# Testing Policy # Testing Policy
**Base Policy Version:** 1.3
**Last Updated**: 2026-11-17
**Upstream Source**: https://gitea.maximumdirect.net/eric/policy/src/commit/593c9b52273c5c879785ae9e995d21026df467b4/docs/policy/testing.md
## Purpose ## Purpose
Our tests exist to make **incorrect changes expensive and correct changes cheap**. Our tests exist to make **incorrect changes expensive and correct changes cheap**.
We do not optimize for test count, line coverage, exhaustive isolation, or the fewest possible tests. We optimize for sufficient confidence in important behavior while imposing as little unnecessary friction as possible on future development. We optimize for sufficient confidence in important behavior while minimizing friction on future development.
## Every test has a cost ## Every test has a cost
Testing is not an unqualified good. Every test imposes both an immediate cost and a continuing lifetime cost. Every test has an immediate and continuing cost: writing, review, execution,
diagnosis, fixture maintenance, and updates when legitimate behavior changes.
A test must be: Tests can also constrain refactoring, duplicate policy, and add failure noise.
- written and reviewed;
- understood by future maintainers and coding agents;
- executed in local and CI workflows;
- diagnosed when it fails;
- updated when legitimate behavior changes;
- maintained as fixtures, APIs, and dependencies evolve; and
- removed or rewritten when it becomes redundant, brittle, misleading, or obsolete.
Tests also create cognitive and architectural friction. They can constrain refactoring, duplicate policy, slow feedback loops, add noise to failures, and cause harmless implementation changes to require unrelated edits across the suite.
A test is warranted only when the confidence it provides justifies these costs. A test is warranted only when the confidence it provides justifies these costs.
Evaluate that tradeoff at two levels:
Apply this cost-benefit analysis at two levels:
1. **Per test:** What realistic defect does this test detect, how consequential would that defect be, and is that protection worth the test's lifetime cost? 1. **Per test:** What realistic defect does this test detect, how consequential would that defect be, and is that protection worth the test's lifetime cost?
2. **Across the suite:** Does this collection provide materially more confidence than a smaller, simpler suite would? 2. **Across the suite:** Does this collection provide materially more confidence than a smaller, simpler suite would?
The preferred test suite is a **lean suite that provides sufficient confidence in the risks that matter, without redundant or low-value tests**. We seek sufficient confidence with the least unnecessary testing friction, not the fewest possible tests. Some friction is intentional. Tests should make dangerous changes—such as breaking compatibility, corrupting data, violating security boundaries, or reintroducing subtle bugs—require deliberate review. Keep ordinary internal changes inexpensive.
Some friction is intentional. Tests should make dangerous changes—such as breaking compatibility, corrupting data, violating security boundaries, or reintroducing subtle bugs—require deliberate review. They should not make ordinary internal changes needlessly expensive. Evaluate maintenance cost against the specific failure being protected. When omitting a plausible test, be able to state why the protected failure is low-risk, already covered, obvious, reversible, or cheaper to detect elsewhere. For consequential, subtle, or difficult-to-observe behavior, the presumption should favor testing.
The cost of a test is not a reason to omit testing by default. Do not cite maintenance cost abstractly. When omitting a plausible test, be able to state why the protected failure is low-risk, already covered, obvious, reversible, or cheaper to detect elsewhere. For consequential, subtle, or difficult-to-observe behavior, the presumption should favor testing.
## Default testing style ## Default testing style
@@ -55,7 +48,7 @@ Control clocks, randomness, environment variables, and other process-global or m
## What deserves tests ## What deserves tests
Prioritize tests for: To the extent the following features are present in the application, prioritize tests for:
1. Public and package-level contracts. 1. Public and package-level contracts.
2. Domain rules and important invariants. 2. Domain rules and important invariants.
@@ -65,15 +58,27 @@ Prioritize tests for:
6. Previously observed or plausible regressions. 6. Previously observed or plausible regressions.
7. Representative integration and end-to-end workflows. 7. Representative integration and end-to-end workflows.
A package-level contract is behavior relied upon by another package or major collaborator, not every observable detail of a package implementation. A package-level contract comprises behavior relied upon by another package or major collaborator.
For behavior involving **data integrity, destructive operations, compatibility, security, concurrency, idempotency, or recovery**, presume that durable tests are required unless the behavior is already credibly protected at another layer. Choose tests for requested behavior and established contracts. Tests must not
introduce new restrictions, guarantees, or threat scenarios merely because they
could be asserted. Follow the [agent policy](agents.md) when deciding whether a
behavior belongs to the contract; current implementation behavior alone is not
sufficient authority.
For established behavior involving **data integrity, destructive operations,
compatibility, security, concurrency, idempotency, or recovery**, favor durable
tests for realistic failures whose consequences warrant protection. Identify
the failure and the existing contract it would violate. These categories call
for attention, not an automatic test inventory or permission to strengthen the
application's guarantees. Account for protection already provided at other layers.
Do not add tests merely because a function, branch, or line exists. Do not add a test when the same meaningful risk is already adequately protected elsewhere. Do not add tests merely because a function, branch, or line exists. Do not add a test when the same meaningful risk is already adequately protected elsewhere.
## Choose the right test boundary ## Choose the right test boundary
Test through the narrowest stable boundary that expresses the behavior clearly. Choose the narrowest stable boundary that expresses the behavior clearly and
provides durable confidence with minimal incidental coupling.
This is often the package API, but it may instead be: This is often the package API, but it may instead be:
@@ -81,28 +86,15 @@ This is often the package API, but it may instead be:
- a package-level operation when several internal collaborators jointly produce the behavior; or - a package-level operation when several internal collaborators jointly produce the behavior; or
- a larger integration boundary when correctness emerges from interaction with a real dependency. - a larger integration boundary when correctness emerges from interaction with a real dependency.
Do not force all behavior through oversized end-to-end tests. Do not test every private helper merely because it exists. Choose the boundary that gives durable confidence with the least incidental coupling.
## Test behavior, not implementation ## Test behavior, not implementation
A test should protect a decision, contract, or invariant—not memorialize the current implementation. A test should protect a selected decision, contract, or invariant.
Before adding or retaining a test, ask: A test is suspect when it primarily detects changes to private constants or
helpers, equivalent operation ordering, incidental formatting, equivalent
algorithms, or internal structure that preserves behavior.
> What realistic defect would this test catch? Behavioral tests should normally remain stable through internal refactoring that preserves the contract.
A test is suspect when its main purpose is to detect that someone:
- changed an internal constant;
- renamed or split a private helper;
- reordered equivalent internal operations;
- changed incidental formatting;
- replaced one correct algorithm with another; or
- refactored internal object structure without changing behavior.
Refactoring should normally require no test edits unless the refactored structure is itself part of the contract.
A test can be factually correct and still have negative value. Accurately describing current behavior is not enough; the protected behavior must be important enough to justify the future friction.
## Expected effects of different changes ## Expected effects of different changes
@@ -119,12 +111,13 @@ A test failing is not the same as a test needing to be edited. Many tests may co
## Separate mechanism from policy ## Separate mechanism from policy
Configurable thresholds and defaults must not be duplicated throughout the test suite. Derive expectations from test-controlled configuration and relationships.
For example, do not encode an internal concurrency limit indirectly: For this example, assume the selected contract rejects a request to start more
processes than a configured limit. Do not encode its production default indirectly:
```go ```go
// Production policy: // Production default:
const maxConcurrency = 4 const maxConcurrency = 4
// Brittle test: // Brittle test:
@@ -142,25 +135,30 @@ require.NoError(t, runner.Start(limit))
require.ErrorIs(t, runner.Start(limit+1), ErrTooMuchConcurrency) require.ErrorIs(t, runner.Start(limit+1), ErrTooMuchConcurrency)
``` ```
The test should prove: For this selected contract, the test should prove:
- the configured limit is accepted; and - the configured limit is accepted; and
- one beyond the configured limit is rejected. - one beyond the configured limit is rejected.
Rejection is not a general requirement for concurrency control. If the selected
contract queues excess work or limits active workers while accepting larger
batches, test that behavior instead. Do not add rejection or a configurable
limit solely to reproduce this example.
The production default should be tested exactly only when its literal value is itself a public, operational, safety, protocol, or compatibility requirement. The production default should be tested exactly only when its literal value is itself a public, operational, safety, protocol, or compatibility requirement.
Apply the same rule to limits, timeouts, capacities, retry counts, and ranges: test relationships and behavior, not duplicated literals. Apply the same rule to limits, timeouts, capacities, retry counts, and ranges: test relationships and behavior.
For concurrency limits, test both kinds of behavior when relevant: For established concurrency limits, distinguish these behaviors where the contract requires them:
1. **Configuration enforcement:** invalid or excessive requested values are handled correctly. 1. **Configuration handling:** values are accepted or rejected according to the selected contract.
2. **Runtime enforcement:** observed peak concurrency never exceeds the configured limit. 2. **Runtime enforcement:** observed peak concurrency never exceeds the configured limit.
Use a test-controlled limit and measure the behavior relative to that limit. Do not merely assert today's default value. Use a test-controlled limit and measure the behavior relative to that limit.
## Avoid semantic duplication across layers ## Assign each behavior a test owner
Each behavior should have a clear test owner. Where these layers exist, assign ownership as follows:
- Parser tests own parsing cases. - Parser tests own parsing cases.
- Validator tests own validation rules. - Validator tests own validation rules.
@@ -170,9 +168,7 @@ Each behavior should have a clear test owner.
- CLI tests own argument and configuration mapping. - CLI tests own argument and configuration mapping.
- End-to-end tests prove that representative assembled workflows work. - End-to-end tests prove that representative assembled workflows work.
Higher-level tests should not repeat every lower-level case. A single intentional policy change should not require unrelated edits across many test files. Give each layer its distinct responsibility and keep expectation updates localized to the contract being changed.
Tests that are individually reasonable may still be collectively redundant. Evaluate the marginal value of each additional test in light of the protection already provided by the rest of the suite.
## Use test doubles deliberately ## Use test doubles deliberately
@@ -193,104 +189,76 @@ Mocks are appropriate when the contract includes facts such as:
- an expensive API is called no more than once; or - an expensive API is called no more than once; or
- a security audit event is emitted. - a security audit event is emitted.
Do not use mocks merely to isolate every object or reproduce the implementation's call graph.
## Go-specific guidance ## Go-specific guidance
Use: Select techniques by behavior and risk:
- table-driven tests for meaningful behavioral categories and boundaries; - table-driven tests for meaningful behavioral categories and boundaries;
- `t.TempDir()` for real filesystem behavior; - `t.TempDir()` for real filesystem behavior;
- `httptest.Server` for realistic HTTP interactions; - `httptest.Server` for realistic HTTP interactions;
- fuzz tests for parsers, normalization, path handling, and broad input spaces; - fuzz tests when exploring broad input spaces, such as parsers or path handling, adds useful protection beyond representative cases;
- golden files only when the complete output is intentionally stable; - golden files only when the complete output is intentionally stable;
- integration tests where correctness depends on component interaction; and - integration tests where correctness depends on component interaction; and
- a small number of representative end-to-end tests. - a small number of representative end-to-end tests when assembled workflows expose meaningful risks not adequately covered at narrower boundaries.
Avoid exact error-string assertions unless the wording is itself contractual. Prefer `errors.Is`, `errors.As`, typed errors, or structured error fields. Prefer `errors.Is`, `errors.As`, typed errors, or structured error fields. Use exact error-wording assertions only when the wording is contractual.
At CLI boundaries, prefer exit classifications, structured output, and the smallest stable semantic fragment needed to identify the error. Do not snapshot complete diagnostic wording unless it is contractual. At CLI boundaries, prefer exit classifications, structured output, and the smallest stable semantic fragment needed to identify the error. Use complete diagnostic snapshots only when the wording is contractual.
Golden-file updates must require an explicit local flag. CI must not update golden files automatically, and reviewers must inspect the semantic diff before accepting an update. Golden-file updates must require an explicit local flag. CI must not update golden files automatically, and reviewers must inspect the semantic diff before accepting an update.
Keep tests readable and direct. Test helpers and fixture frameworks must earn their own maintenance cost; do not build elaborate test infrastructure for small or isolated needs. Keep tests readable and direct. Size test helpers and fixture frameworks to the maintenance benefit they provide.
## Coverage ## Coverage
Coverage is a diagnostic, not a target. Use coverage to locate untested critical branches and unexpectedly weak packages. Evaluate test quality through meaningful behavioral protection and choose coverage according to risk.
Use it to find untested critical branches and unexpectedly weak packages. Do not write low-value tests solely to increase a percentage, and do not infer test quality from coverage alone.
Pure domain logic will often warrant higher coverage than CLI wiring or external adapters. Uneven coverage is acceptable when it reflects risk. Pure domain logic will often warrant higher coverage than CLI wiring or external adapters. Uneven coverage is acceptable when it reflects risk.
Increasing coverage is valuable only when the newly covered behavior protects a meaningful risk at an acceptable cost.
## Regression tests ## Regression tests
A bug fix should normally include a regression test that fails before the fix and passes afterward. A bug fix should normally include a regression test that fails before the fix and passes afterward.
Retain the test when the defect could realistically recur and its consequences justify the ongoing cost. Prefer the narrowest durable test of the violated contract or invariant; do not preserve accidental implementation details from the original bug. Retain the test when the defect could realistically recur and its consequences justify the ongoing cost. Prefer the narrowest durable test of the violated contract or invariant.
Not every historical bug requires a permanent test. If the underlying design has made recurrence impossible, the test has become redundant, or a stronger invariant test now subsumes it, remove or consolidate it. Remove or consolidate a test when the underlying design has made recurrence impossible, its protection is redundant, or a stronger invariant test subsumes it.
## Deleting or rewriting tests ## Deleting or rewriting tests
Tests are maintained code, not permanent historical artifacts. Delete or rewrite tests when maintenance cost exceeds their continuing
protective value.
Delete or rewrite a test when its maintenance cost exceeds the confidence it provides.
Strong candidates include tests that: Strong candidates include tests that:
- require updates after harmless internal changes; - require updates after harmless internal changes;
- directly assert private constants without protecting a real contract; - assert incidental private constants or snapshot large amounts of incidental output;
- duplicate the same policy across several layers;
- verify mock choreography rather than outcomes; - verify mock choreography rather than outcomes;
- snapshot large amounts of incidental output; - duplicate policy across layers, retest trivial helpers covered by package
- test trivial private helpers already exercised through stable package behavior; behavior, or protect risks covered more effectively elsewhere;
- protect risks already covered more effectively elsewhere;
- are flaky, misleading, obsolete, or disproportionately expensive to diagnose; or - are flaky, misleading, obsolete, or disproportionately expensive to diagnose; or
- no longer correspond to a plausible failure mode. - no longer correspond to a plausible failure mode.
Several brittle tests may encode one genuine requirement. Replace them with one durable behavior-level or invariant test rather than preserving all of them. Several brittle tests may encode one genuine requirement. Consolidate them into one durable behavior-level or invariant test.
Deleting a low-value test can improve the quality of the suite by reducing noise, maintenance burden, and friction around legitimate change.
## Reviewing a proposed test ## Reviewing a proposed test
Use the following questions when the value, boundary, or durability of a proposed test is not self-evident. Significant test additions should be reviewable against them, but written answers are not required for every routine test. Use the following questions when a proposed test needs closer evaluation. Significant test additions should be reviewable against them; written answers are optional for routine tests.
1. What realistic defect would it catch? 1. Which requested behavior or established contract does it protect, and what realistic defect would violate it?
2. How likely is that defect? 2. How likely and consequential is that defect, and is it already protected elsewhere?
3. How consequential would it be? 3. What is the narrowest stable boundary that can test it clearly?
4. Is the behavior already protected elsewhere? 4. Would a correct internal refactor or a change to an incidental default require test edits?
5. At which layer should this behavior be owned? 5. Does its confidence justify its maintenance, execution, and diagnostic cost, or would a smaller test suffice?
6. Does the test assert a durable contract or an incidental implementation detail?
7. Could the implementation be refactored without changing the behavior and without editing this test?
8. What should cause this test to fail?
9. What legitimate changes should not cause this test to fail?
10. What ongoing maintenance, execution, and diagnostic cost will the test impose?
11. Is there a smaller or more direct test that protects the same risk?
Do not add the test when its expected lifetime cost exceeds its expected protective value.
When deciding not to test plausible behavior, record or be able to explain why the risk is low, already protected, obvious, reversible, or cheaper to detect elsewhere.
## Definition of sufficient ## Definition of sufficient
A test suite is sufficient when: A test suite is sufficient when:
- important contracts and invariants are protected; - important requested behavior and established contracts are protected against realistic, consequential failures;
- meaningful boundaries and failure modes are exercised; - boundaries and component interactions have coverage where they introduce meaningful risks not protected elsewhere;
- realistic and consequential regressions are credibly protected against silent recurrence; - failures provide useful, distinct signals;
- behavior involving data integrity, destructive operations, compatibility, security, concurrency, idempotency, and recovery is credibly protected; - tests usually remain stable through legitimate internal changes; and
- important external boundaries have realistic integration coverage;
- representative complete workflows are tested;
- failures provide useful signal rather than redundant noise;
- legitimate internal changes usually do not require test edits; and
- additional tests would mostly repeat existing protection or preserve inconsequential implementation details. - additional tests would mostly repeat existing protection or preserve inconsequential implementation details.
Sufficiency is a risk judgment, not a coverage percentage or test count. Reassess it as the application, its users, and the consequences of failure evolve. Reassess sufficiency as the application, its users, and the consequences of
failure evolve.
The governing rule is:
> Test heavily where failure is consequential, subtle, or difficult to detect after the fact. Test lightly where failure is obvious, reversible, and inexpensive—and retain no test whose lifetime cost exceeds the confidence it provides.

View File

@@ -1,104 +1,82 @@
# Releasing Narratio # Releasing Narratio
This document is the maintainer procedure for creating a Narratio source and This is the maintainer runbook for the [release policy](policy/release.md).
binary release. The synchronous release boundary is a successful push of one The authoritative source destination is `origin` at
new tag to `origin`; Woodpecker and Gitea publication happen later and do not `ssh://git@forge.maximumdirect.net:22222/eric/narratio.git`; use `main`.
change that result. The hosted destination is [Narratio on Gitea](https://forge.maximumdirect.net/eric/narratio).
Install Git, a POSIX shell, and the native compiler and tools needed for Go race
builds. Git access must permit fetching and pushing tags.
## Go prerequisite ## Release toolchain
Release preparation requires the maintained Go 1.26 baseline. Tag CI currently Use the official Go 1.27.4 toolchain for validation and builds. The consumer
uses the explicitly pinned `golang:1.26.7` image for candidate validation and minimum remains Go 1.27.0. Prepare the selected toolchain, application modules,
asset construction; that asynchronous work does not change the tag-push and the module-selected ReleaseKit tool before offline validation:
completion boundary.
## Choose a version and write its note ```sh
export GOTOOLCHAIN=go1.27.4
go version
go mod download
./releasekit version
```
Narratio is past `v1.0.0`. Use an unused stable tag in the exact form The launcher runs the ReleaseKit version selected in `go.mod`. The CI image
`vMAJOR.MINOR.PATCH`: uses the same Go patch. See [upstream adoption guidance](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/consumers/adoption.md).
- increment `MINOR` for backward-compatible features; ## Prepare and publish
- increment `PATCH` for backward-compatible fixes; and
- reserve a new `MAJOR` for an intentional breaking documented contract.
Before preparing the candidate, create Choose an unused stable version under the [versioning and compatibility
`docs/releases/vMAJOR.MINOR.PATCH.md` with this structure: rules](policy/release.md#versioning-and-compatibility). Update affected current
documentation and prepare `docs/releases/vMAJOR.MINOR.PATCH.md` with a title
containing Narratio and the version, a summary, and any compatibility impact
or upgrade instructions. End the note with this footer, replacing the version
in each URL with the intended tag:
```markdown ```markdown
# Narratio vMAJOR.MINOR.PATCH [COPYRIGHT](https://forge.maximumdirect.net/eric/narratio/src/tag/vMAJOR.MINOR.PATCH/COPYRIGHT) | [LICENSE](https://forge.maximumdirect.net/eric/narratio/src/tag/vMAJOR.MINOR.PATCH/LICENSE) | [ATTRIBUTION](https://forge.maximumdirect.net/eric/narratio/src/tag/vMAJOR.MINOR.PATCH/docs/oss/attribution.md)
This release ...
## Summary
## Compatibility
## Upgrade
## Changes
``` ```
The compatibility section identifies relevant CLI, configuration, artifact, Retire completed roadmaps as appropriate, preserve pending work, and review the
integration, or operating-contract changes. The upgrade section states the candidate through the ordinary development workflow. Commit the candidate and
required operator action, or explicitly says that no special action is push it to `origin/main`, then publish from the clean `main` checkout:
required. Release notes are immutable historical summaries; link to the
current canonical documentation for detailed behavior.
Commit the note and all candidate changes, then use the ordinary development
workflow to push that commit to `main`. Do not create a release tag before the
candidate is committed and `origin/main` contains the exact same commit.
## Validate the candidate
Run the shared checker from any directory:
```sh ```sh
scripts/check-release-candidate.sh vMAJOR.MINOR.PATCH git add <candidate-files>
git commit -m "Prepare Narratio release"
git push origin main
./releasekit publish vMAJOR.MINOR.PATCH
``` ```
It validates the version and matching note, module hygiene, formatting, ReleaseKit validates the committed candidate with the selected race-enabled
whitespace, uncached tests, race tests, static checks, documentation, examples, suite, full vet, Go formatting and local-replacement checks, and builds the
and three official cross-build assets. It uses `GOWORK=off`, does not contact three selected binaries with an injected-version smoke check. It creates an
application services, CI, or Gitea, and does not create tags or modify tracked annotated tag and pushes it. Confirmed source-tag publication completes the
source. Fix any failure on `main`, commit it, push it normally, and rerun the release; CI and hosted delivery are separate observations. For optional
checker. diagnosis, use `./releasekit check vMAJOR.MINOR.PATCH`; publication runs its
own validation, so this is not a prerequisite. See the upstream
[check](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/consumers/check.md)
and [publish](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/consumers/publish.md)
guides for native behavior and diagnostics.
The checker builds Linux assets for `amd64` and `arm64` and a macOS asset for ## Delivery and recovery
`arm64`. The macOS cross-build proves compilation; it is not native macOS
runtime evidence.
## Publish the tag Tag-triggered Woodpecker CI uses the tagged module's ReleaseKit selection to
build and deliver the checked-in note and these assets asynchronously:
From a clean checkout on `main` whose `HEAD` equals `origin/main`, run: - `narratio-vMAJOR.MINOR.PATCH-linux-amd64`
- `narratio-vMAJOR.MINOR.PATCH-linux-arm64`
- `narratio-vMAJOR.MINOR.PATCH-darwin-arm64` (best effort)
- `SHA256SUMS`
```sh A cross-build establishes compilation, not native macOS runtime coverage.
scripts/release.sh vMAJOR.MINOR.PATCH CI maps its existing `GITEA_RELEASE_TOKEN` secret to
``` `RELEASEKIT_GITEA_TOKEN`. Delivery does not determine source-release completion.
The command fetches and checks `origin/main`, re-runs candidate validation, If publication is uncertain, use the recovery entry point printed by ReleaseKit
then fetches and checks again before creating an explicitly unsigned lightweight and its saved private publication record to reconcile the outcome before
tag for the originally recorded commit. It refuses dirty, divergent, changed, retrying. Follow the [publication recovery guide](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/consumers/publish.md#retain-and-reconcile-publication-evidence).
or already-tagged candidates. It pushes only: For failed or partial delivery, retry from the same immutable tag using the
[delivery guide](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/consumers/delivery.md).
```text Investigate conflicts or uncertain outcomes according to that guide; do not
refs/tags/vMAJOR.MINOR.PATCH:refs/tags/vMAJOR.MINOR.PATCH replace published content. For older tags, use the tooling and workflow selected
``` by those tags.
It never commits changes, pushes `main`, force-pushes, moves a tag, or pushes
all tags. A successful push of that exact ref completes the release command;
the command prints the tag and commit, then returns without waiting for CI,
querying Gitea, downloading assets, or checking checksums.
If a failure occurs before the tag is created, correct the candidate on `main`
and repeat validation. If the push fails after local tag creation, the local tag
is intentionally retained for inspection and the command must not be retried
blindly. Once the upstream tag has been pushed, it is immutable. Correct any
defect or failed asynchronous publication with a new patch version, a new
release note, and the complete procedure again.
## Optional asynchronous inspection
After a successful tag push, a human may later inspect the tag-triggered
Woodpecker run and the corresponding Gitea release for binaries and checksums.
This is optional follow-up only. Automated releasers must not wait for, poll,
or treat CI/Gitea completion as a condition of the successful tag push.

View File

@@ -1,27 +1,23 @@
# Release Notes # Release Notes
This directory contains immutable historical release notes for Narratio. This directory contains immutable historical release notes for Narratio.
Future notes are created with the matching stable version and use this minimum Future notes use the matching stable version and begin with
structure: `# Narratio vMAJOR.MINOR.PATCH`. Include a short summary and relevant
compatibility or upgrade guidance; choose sections suited to the release.
```markdown End each new note with the three immutable-tag notice links specified in the
# Narratio vMAJOR.MINOR.PATCH [release procedure](../release.md).
This release ...
## Summary
## Compatibility
## Upgrade
## Changes
```
See the [release procedure](../release.md) for creating a candidate and tag. See the [release procedure](../release.md) for creating a candidate and tag.
When asynchronous publication succeeds, the corresponding Gitea release is the When asynchronous publication succeeds, the corresponding Gitea release is the
canonical source for downloadable binaries and checksums. canonical source for downloadable binaries and checksums.
- [v3.1.0](v3.1.0.md)
- [v3.0.0](v3.0.0.md)
- [v2.2.1](v2.2.1.md)
- [v2.2.0](v2.2.0.md)
- [v2.1.2](v2.1.2.md)
- [v2.1.1](v2.1.1.md)
- [v2.1.0](v2.1.0.md)
- [v2.0.0](v2.0.0.md) - [v2.0.0](v2.0.0.md)
- [v1.7.0](v1.7.0.md) - [v1.7.0](v1.7.0.md)
- [v1.6.0](v1.6.0.md) - [v1.6.0](v1.6.0.md)

53
docs/releases/v2.2.0.md Normal file
View File

@@ -0,0 +1,53 @@
# Narratio v2.2.0
This release adds resumable per-speaker transcription, replayable WhisperX
uploads, and explicit Notarius configuration profile selection.
## Summary
Successfully checkpointed speaker transcripts survive later transcription
failures. Ordinary retry reuses valid completed speakers and processes only the
remaining work. WhisperX uploads can now be replayed by the HTTP transport
without buffering whole audio files.
## Compatibility
Existing CLI commands, speaker identities, transcript formats, and pipeline
ordering are unchanged. Session manifests gain optional per-speaker completion
evidence. Older manifests remain readable, but older Narratio binaries may
reject manifests containing the new fields; downgrading after transcription
is not transparent.
The optional `pipeline.notarius.config_profile` field selects a downstream
Notarius configuration profile independently of Narratio's own profile. Using
it requires a Notarius version supporting `--config-profile`; v0.7.0 is a known
supporting version. Omitting the field retains downstream default selection.
## Upgrade
No configuration migration is required. When transcribe is next selected for
an older aggregate-only manifest, all current speakers are transcribed once
to establish reusable evidence. Previously unrecorded results from failed runs
are not automatically imported.
Use ordinary run/resume to retain valid checkpoints. Forcing transcribe resets
reuse of prior results; an ordinary retry after a failed forced invocation can
retain replacements already checkpointed by that attempt. See the
[operations guide](../operations.md) and
[Notarius profile configuration](../config.md#notarius-configuration-profile).
## Changes
- Persist validated speaker completions independently of aggregate stage status,
with serialized saves for concurrent work and input/output integrity checks.
- Rebuild aggregate transcript references when speakers are removed or those
references need repair, without retranscribing otherwise-current speakers.
- Keep removed and incomplete speaker results out of versioned merge inputs.
- Permit checkpoint evidence for zero-byte audio when WhisperX accepts it;
service rejection still fails normally.
- Provide fresh streaming multipart bodies for HTTP transport replay while
preserving application retries, cancellation, and resource cleanup. This
addresses the missing-body-replay limitation, not persistent upstream
protocol failures or exactly-once service execution.
- Pass explicit Notarius configuration profiles through the CLI and include
their selection in extraction reuse decisions.

35
docs/releases/v2.2.1.md Normal file
View File

@@ -0,0 +1,35 @@
# Narratio v2.2.1
This maintenance release consolidates checkpoint persistence for transcription
and analysis without changing their operator-facing behavior.
## Summary
Transcribe and analyze now share one internal operation for preparing isolated
checkpoint candidates, saving them, and promoting successfully saved progress
into live state. Each stage retains its own progress model and recovery policy.
## Compatibility
CLI commands, configuration, manifest schemas, artifact formats, and external
integration contracts are unchanged. Speaker concurrency, artifact selection,
force behavior, and ordinary resume semantics are preserved. No dependency
upgrade or new external-tool version requirement is introduced.
## Upgrade
No special upgrade action or configuration migration is required when upgrading
from v2.2.0. See the [v2.2.0 release notes](v2.2.0.md) when upgrading from an
earlier version for the original speaker-checkpoint upgrade considerations.
## Changes
- Replace duplicate analyze/transcribe save-and-promote sequences with a
shared, private checkpoint helper.
- Isolate checkpoint collections from live state, including analyze records
normalized during a transcription checkpoint save.
- Preserve transcription's caller-owned locking and failure handling, and
analysis's working/committed collections and rollback behavior.
- Add focused checkpoint integrity tests while retaining stage and application
recovery coverage.
- Document the shared [checkpoint persistence boundary](../internal/manifest.md#checkpoint-persistence-boundary).

57
docs/releases/v3.0.0.md Normal file
View File

@@ -0,0 +1,57 @@
# Narratio v3.0.0
This major release moves Narratio pipeline selection to ConfigKit overlays and
updates its Audita and Notarius integration contracts. Existing deployments
must migrate configuration before running affected sessions.
## Compatibility and upgrade
- Replace Narratio's `--profile <name>` with `--overlay <name>` and move selected
`profiles/<name>.yml` files to `overlays/<name>.yml` beside the pipeline root.
The old flag and selected directory are no longer supported; explicit imports
from a directory named `profiles` remain valid. Update `config diff` positional
selections accordingly. See [configuration](../config.md#pipeline-imports-and-overlays)
and the [CLI reference](../cli.md).
- Before opening a session manifest containing
`effective_config.selected_profile`, back it up and follow the
[manifest migration procedure](../operations.md#migrating-manifest-overlay-provenance).
Strict decoding rejects the retired field. Preserve the manifest's stage and
checkpoint state; this informational rename does not itself require rerunning
every stage. Immutable remote snapshots are not edited in place.
- Deploy an Audita v2 executable and migrate its configuration before running
`polish`. Narratio no longer generates an Audita config or accepts the old
endpoint, model, concurrency, singular API-key, report, and retention fields.
Audita now owns backends, PromptKit profiles, reporting, and debug settings;
Narratio accepts optional downstream selectors and forwards only names listed
in `pipeline.audita.credentials`. Follow the
[Audita migration table](../operations.md#migrating-audita-and-provider-credentials)
and [integration contract](../integrations/audita.md).
- Replace `pipeline.notarius.llm_api_key` with the
`pipeline.notarius.credentials` list. Rename
`pipeline.notarius.config_profile` to `config_overlay` and move selected
downstream Notarius files to its `overlays/` directory. The old fields have
no compatibility aliases. A named downstream overlay requires a compatible
Notarius executable; v0.8.1 is the tested baseline, while deployments that
omit the selector gain no new version requirement. See the
[Notarius configuration reference](../config.md#notarius-configuration-overlay)
and [integration contract](../integrations/notarius.md).
## Changes
- Narratio and downstream overlay names are independent. Operators can select
separate Audita and Notarius overlays from one Narratio overlay without
implicit name forwarding. ConfigKit is updated to v0.4.2.
- Audita's corrected transcript remains the canonical polish output. Available
`errors.yml`, `recoveries.yml`, and `report.md` files are retained as bounded
diagnostics; missing reports are allowed, and an exit-zero valid transcript
succeeds even when reports describe recoverable errors or no corrections.
- Audita and Notarius credential lists resolve at pipeline load and forward
captured values under their exact names, with captured subprocess output and
failure diagnostics redacted. Narratio does not discover backend credentials
from downstream configuration; operators must list the names those tools need.
- Repository policy, license/attribution notices, release validation, and the
asynchronous artifact-delivery procedure are aligned with the current
[release runbook](../release.md). Completed implementation roadmaps have been
retired from the candidate source.
[COPYRIGHT](https://gitea.maximumdirect.net/eric/narratio/src/tag/v3.0.0/COPYRIGHT) | [LICENSE](https://gitea.maximumdirect.net/eric/narratio/src/tag/v3.0.0/LICENSE) | [ATTRIBUTION](https://gitea.maximumdirect.net/eric/narratio/src/tag/v3.0.0/docs/oss/attribution.md)

40
docs/releases/v3.1.0.md Normal file
View File

@@ -0,0 +1,40 @@
# Narratio v3.1.0
This minor release adds explicit provider-credential forwarding to Scriptorium
for trim bounds generation and artifact analysis.
## Compatibility and upgrade
Existing pipelines remain valid. An omitted, null, or empty
`pipeline.scriptorium.credentials` list continues to forward no provider keys.
When Scriptorium needs a credential, provision its environment variable through
Narratio's existing environment or secrets-directory mechanism and list the
exact name in the pipeline, for example:
```yaml
scriptorium:
credentials: [OPENROUTER_API_KEY]
```
Selected references must resolve to nonempty values when Narratio loads the
pipeline, even if the current command will not run Scriptorium. A Narratio
overlay replaces the complete list, and `[]` clears it. After correcting a
failed trim or analysis invocation, retry normally; successful work need not be
forced solely because a credential was added or rotated. See
[Scriptorium credentials](../config.md#scriptorium-credentials) and the
[401 troubleshooting guide](../troubleshooting.md#scriptorium-returns-http-401-during-trim-or-analyze).
## Changes
- Forward selected, already-resolved credential names and values to Scriptorium
for trim, analysis, character-family generation, and render-debug calls.
Scriptorium still owns provider and profile selection; Narratio does not add
a model-request `--api-key-env` override.
- Register selected values for captured subprocess-output and failure-diagnostic
redaction. Inspection and invocation metadata contain credential names, never
their values. This protection does not scan files Scriptorium writes directly.
- Reuse the credential-forwarding boundary shared with Audita and Notarius.
Retire the completed Scriptorium credential-forwarding bug report from the
source roadmap; its history remains in Git.
[COPYRIGHT](https://gitea.maximumdirect.net/eric/narratio/src/tag/v3.1.0/COPYRIGHT) | [LICENSE](https://gitea.maximumdirect.net/eric/narratio/src/tag/v3.1.0/LICENSE) | [ATTRIBUTION](https://gitea.maximumdirect.net/eric/narratio/src/tag/v3.1.0/docs/oss/attribution.md)

View File

@@ -1,171 +0,0 @@
# Bugfix Request: Preserve Publish Destination Derivation with Explicit Rules
Status: Implemented; release target v2.1.1
## Summary
Narratio should successfully derive a publish destination when a valid
`publish.outputs` rule omits `dest`, regardless of whether that rule explicitly
sets `required`. Narratio v2.1.0 currently rejects this valid configuration in
some cases with a ConfigKit `resolve.unrecorded_change` diagnostic.
This is a configuration-resolution bookkeeping defect, not a YAML formatting
restriction. The fix should preserve the existing public configuration
contract: operators may omit a derivable destination and may independently set
`required` to either `true` or `false`.
## Observed Behavior
A pipeline containing a rule equivalent to the following fails during native
configuration loading:
```yaml
publish:
outputs: [{"source": "narratio.transcript.final", "required": true}]
```
Narratio reports:
```text
error [resolve.unrecorded_change] /publish/outputs: application resolution changed a value without a covering record
```
The same failure is possible with ordinary block-style YAML when `required` is
explicit and `dest` is omitted. Flow-style YAML is valid input and is not the
cause of the defect.
The existing destination-derivation tests do not expose this case because
their rules also omit `required`. Narratio then supplies the default value for
`required` and records a change covering the complete `publish.outputs`
sequence. That broader record happens to cover the destination mutation as
well, masking the missing resolution record that occurs when `required` is
already explicit.
## Expected Contract
The current configuration contract remains unchanged:
- `publish.outputs[].source` is required;
- `publish.outputs[].dest` may be omitted when Narratio can derive it from the
selected built-in or configured artifact source;
- `publish.outputs[].required` defaults to `true`, but an operator may set it
explicitly to either `true` or `false`; and
- equivalent valid YAML representations have equivalent configuration
semantics.
For example, both rules below should load and validate, retain their explicit
requiredness, and receive the canonical derived destination:
```yaml
publish:
outputs:
- source: narratio.transcript.final
required: true
- source: narratio.transcript.final_markdown
required: false
```
## Root Cause
ConfigKit intentionally treats sequences as atomic when comparing values
before and after application resolution. Changing a field within one
`publish.outputs` entry is therefore observed as a change to the
`/publish/outputs` sequence.
Narratio currently derives each missing destination by recording a
normalization at the individual `publish.outputs[index].dest` path. That child
record does not cover the atomic parent-sequence change. A separate
container-level record is currently created only when Narratio also defaults
an omitted `required` value, so configurations with explicit `required` values
lose that incidental coverage.
## Recommended Fix
Make Narratio's publish-output resolution bookkeeping conform to ConfigKit's
atomic-sequence contract. Whenever resolution derives one or more destinations
inside `publish.outputs`, the recorded resolution changes must cover the
`/publish/outputs` container. Destination derivation must not depend on an
unrelated `required` default being applied in the same list.
The implementation may retain more specific provenance where useful, but it
must provide valid container-level coverage for the sequence mutation. Do not
change ConfigKit's sequence comparison semantics merely to accommodate this
call site.
## Scope
- Correct destination derivation for publish rules that explicitly set
`required` and omit a derivable `dest`.
- Preserve explicit `required: true` and `required: false` values.
- Preserve canonical destination derivation for built-in transcript sources
and configured artifact sources.
- Add focused regression coverage through Narratio's real configuration load
and validation boundary.
- Prepare a backward-compatible patch release after the fix passes the normal
repository validation.
## Non-goals
- Changing the `publish.outputs` schema, defaults, source vocabulary, or
destination derivation rules.
- Requiring operators or configuration generators to supply `dest` when it is
derivable.
- Requiring operators to omit explicit `required: true` values.
- Treating flow-style YAML or JSON-compatible YAML values as unsupported.
- Changing ConfigKit's documented atomic treatment of sequences.
- Adding storage, publication, or network integration behavior.
## Regression Coverage
Add one focused package-level behavioral test that loads and validates a
pipeline with omitted destinations and explicit requiredness. A representative
list should include both `required: true` and `required: false`, then assert
that:
- loading and validation succeed;
- each destination is derived from its source; and
- each explicit `required` value is preserved.
Using the compact flow-style representation that exposed the integration
failure is reasonable, while the existing block-style cases continue to cover
omitted `required`. The test should exercise the public configuration behavior,
not ConfigKit call choreography or Narratio's private recording mechanism.
No network service, object store, credential, or test double is required.
## Target End State
All valid publish rules with derivable sources behave consistently across
these cases:
| `dest` | `required` | Result |
| --- | --- | --- |
| omitted | omitted | destination derived; required defaults to `true` |
| omitted | `true` | destination derived; explicit `true` retained |
| omitted | `false` | destination derived; explicit `false` retained |
| explicit | either value | explicit destination and requiredness retained |
`narratio config validate`, `narratio config show`, and ordinary pipeline
loading accept the corrected cases without an unrecorded-change diagnostic.
No operator configuration migration or workaround is required.
## Release
This is a backward-compatible correction to documented configuration behavior
and should be released as Narratio `v2.1.1`. The release note should identify
the corrected explicit-required/derived-destination interaction and state that
no special upgrade action is required.
## Acceptance Criteria
- The focused regression test fails against v2.1.0 behavior and passes after
the fix.
- Publish rules with explicit `required: true` or `required: false` and omitted
derivable destinations load and validate successfully.
- Derived destinations and explicit requiredness appear correctly in the safe
effective configuration.
- Existing destination derivation, publish validation, imports, profiles, and
configuration inspection tests remain green.
- The complete repository validation and release-candidate checks pass.
- The correction is published as the immutable `v2.1.1` tag with the required
release note.

279
docs/roadmap/workspace.md Normal file
View File

@@ -0,0 +1,279 @@
# Session workspace organization
## Purpose
Give operators predictable locations for session inputs, completed outputs,
logs, and debug evidence. Apply the taxonomy in
[ADR 0001](../adr/0001-classify-session-content.md) and the ownership boundary in
[ADR 0002](../adr/0002-assign-subprocess-content-ownership.md).
This roadmap defines the target behavior and required changes. Implementation
sequencing belongs in a subsequent implementation plan. The ADRs remain
Proposed pending their acceptance.
## Confirmed Requirements
- Completed artifacts occupy a flat `artifacts/` directory. Intermediate
products such as `session_bounds.json` belong here.
- Combined transcripts occupy `transcripts/` directly. Initial per-speaker
transcripts occupy a subdirectory beneath it.
- Prepared external audio occupies `audio/`; other prepared external inputs
occupy `inputs/`. Outputs consumed by later stages retain their output paths.
- Logs and Debug use matching latest-attempt views: `logs/<stage>` and
`debug/<stage>` are symlinks to the producing run's directories. Both views
advance when a stage starts an actual attempt, including attempts that fail.
A skipped stage leaves its previous views intact.
- Execution reports and invocation records are Logs. Historical Logs and Debug
remain under their producing runs, subject to cleanup.
- Narratio can selectively request supported subprocess debug capture through
configuration. Omission preserves application configuration and defaults;
Narratio needs no explicit downstream debug-disable override.
- Prepared session audio is the single retained Narratio-managed audio copy.
Remove Narratio's separate persistent audio cache and spool duplicates.
- Configurations that produce colliding artifact names or destinations fail
validation before execution. Validation covers the effective pipeline,
including expanded character families and built-in artifact destinations.
- Narratio selects input, output, log, and debug paths. Subprocess applications
own their working State and Cache through their supported configuration.
- A dedicated cache root such as `/var/cache/notarius` is a deployment
recommendation. The application owns its cache defaults, internal layout,
identity, and reuse semantics. Narratio session cleanup respects that boundary.
- Narratio retains its own manifest, recovery records, and managed staging State.
- This is a clean cutover for newly prepared sessions. Existing-session migration
and backward compatibility shims are outside the feature.
- Treatment of older completed files after invalidation or failed replacement
remains unchanged, including their availability through manifest-backed
resolution. Directory reorganization does not authorize new stale-file
deletion, automatic fallback, or rollback behavior.
## Current Baseline
The [operator guide](../operations.md#local-state-layout) owns the current
physical layout. Relevant differences from the target are:
- Extraction moves the complete Notarius bundle to
`artifacts/notarius/<run_id>/`. Resume evidence and artifact resolution depend
on that bundle and its index.
- Merge and normalize promote Seriatim execution reports into `artifacts/`.
- Analysis output paths and character-family patterns can introduce nested
artifact directories. Output-path configuration also permits locations that
need reconciliation with the selected directory categories.
- Standard combined transcript paths already match the target. Layout creation
also creates an unused `transcripts/trimmed/` directory.
- Most subprocess diagnostics live under individual run directories. Root-level
log paths lack a consistent latest-attempt view. Audita reports use the
run-local polish log directory, and restore writes a separate top-level report.
- Prepared previous-session inputs occupy `previous/`. Narratio-owned reference
snapshots supplied to Notarius occupy session `cache/notarius/references/`.
These snapshots are distinct from Notarius's own execution caches.
- Audita's work destination is run-local, and Narratio can request its debug
capture. Narratio does not expose Notarius debug capture, and Scriptorium
render-debug placement varies.
- Narratio maintains separate S3 audio cache and spool paths in addition to the
prepared session audio copy.
## Target Layout And Ownership
Retain the configurable workspace root and its current system-wide default,
`/var/lib/narratio`. Sessions remain under
`/var/lib/narratio/work/<campaign>/<session>` by default. The following paths
express the selected categories:
| Path | Contents and role |
| --- | --- |
| `manifest.json` | Narratio's durable progress and output references. |
| `artifacts/<filename>` | Completed artifact payloads, including session bounds. |
| `transcripts/<filename>` | Completed combined transcripts and rendered transcripts. |
| `transcripts/raw/<speaker>.json` | Completed initial per-speaker transcripts. |
| `audio/` | Prepared external audio. |
| `inputs/` | Prepared configuration, references, and previous-session inputs. |
| `logs/<stage>` | Symlink to the latest attempt's run-local logs and execution reports. |
| `debug/<stage>` | Symlink to the latest attempt's run-local debug directory, empty when no capture is produced. |
| `runs/<run_id>/<stage>/logs/` | Actual logs and execution reports for that attempt. |
| `runs/<run_id>/<stage>/debug/` | Actual debug captures for that attempt, including retained state snapshots. |
| `runs/<run_id>/` | Narratio staging, original tool bundles, and retained execution evidence. |
For example, the latest views use relative links within the session:
```text
logs/polish -> ../runs/<run_id>/polish/logs/
debug/polish -> ../runs/<run_id>/polish/debug/
```
Each stage's latest attempt can belong to a different run. Producers write to
the actual run paths; the symlinks provide operator navigation without duplicate
diagnostic storage.
Narratio's lock and restore marker remain its own State. Their current placement
can remain; introducing another root-level State directory is unnecessary for
this feature. Generated records that describe an invocation belong with Logs;
configuration actually supplied as an input follows its input or staging role.
Subprocesses may create internal working directories wherever their configuration
directs. Narratio-selected staging destinations for result bundles remain valid
under ADR 0002. Cache locations are documented as operator recommendations using
each application's existing configuration surface.
## Required Changes
### Output paths and configuration
Centralize the revised paths in the existing path owner. Apply the flat artifact
rule to explicit artifacts, expanded families, extraction outputs, and session
bounds. Preserve logical source identities used by dependencies and publication.
Keep explicit analysis filenames and require flat destinations. Derive extraction
filenames from configured extraction keys with a `.json` extension, with an
explicit extraction filename override for naming preferences or collisions.
Retain `session_bounds.json` as the default bounds filename. Do not silently
rename conflicting files. Report conflicting producers and the shared destination
in configuration errors. Validate the effective configuration after composition
and family expansion.
Keep combined transcript destinations directly beneath `transcripts/`. Remove
obsolete directory scaffolding and reconcile configurable output paths with
their category. Local path changes do not require flattening explicitly
configured remote publish destinations.
### Notarius result handling and reuse
Receive and validate the complete Notarius bundle in Narratio staging. Promote
selected accepted payloads to their flat artifact destinations. Classify the
receipt, warnings, rejection summaries, and diagnostics as Logs. Keep bundle
indexes and other management metadata with the bundle or Narratio State according
to their use.
Revise extraction evidence, catalog hydration, and resume checks to resolve
promoted products independently of the old `artifacts/notarius/` layout. Retain
the identity, provenance, contract, and checksum evidence needed for current
reuse behavior. Historical bundles may remain available for inspection under
their existing retention semantics; relocating them beneath `runs/` must not
silently shorten their lifetime through run cleanup.
Preserve ordinary resume and forced-extraction behavior. Subprocess caches remain
under Notarius's control.
### Inputs
Place prepared previous-session material beneath `inputs/previous/`. Place the
stable reference snapshots Narratio supplies to Notarius beneath
`inputs/references/`, retaining their content identities where needed for reuse.
Update preparation, input resolution, manifest references, and restore mappings.
Keep source configuration ownership and prepared-file validation unchanged.
### Audio acquisition
Simplify acquisition to one prepared session copy under `audio/`. Remove the
separate Narratio S3 audio cache and routine retained spool copies, together with
their obsolete configuration, manifest bookkeeping, and cleanup controls.
Preparation may use temporary download files before installing validated audio.
Preserve reuse of valid prepared audio and update restore to use the same layout.
Recreating a session after its prepared audio is removed requires fetching the
source again. Original recordings remain outside this cleanup change. Removing
spool/cache handling does not authorize new deletion of prepared session audio.
Subprocess caches remain independently configured and managed.
### Logs and execution reports
Provide one consistent latest-attempt view per stage. Include failed attempts;
a skipped stage leaves its previous view intact. Distinguish multiple applications
or artifact invocations within a stage through their filenames. Route Seriatim
reports, Audita reports, Notarius diagnostic records, and Narratio invocation
records through this model. Treat restore execution as its own diagnostic group
under `logs/restore/`, using run-local evidence and a latest-attempt view.
Prevent a new attempt from presenting old diagnostic files as newly generated
ones. At the start of each actual stage attempt, create its run-local log and
debug directories and refresh both latest symlinks. An attempt without debug
output exposes an empty debug directory rather than an older capture. Preserve
subprocess errors and available evidence on failure. Retain existing
captured-stream redaction and limits.
Keep historical files at their run paths; rotating the links does not move files.
Run cleanup must preserve directories targeted by current latest links. Do not
introduce an automatic history age or count limit. Publication and manifest
diagnostic references use actual run paths. Adjust path handling for these
Narratio-managed navigation links without relying on arbitrary symlink traversal.
### Debug controls and placement
Retain Narratio's Audita debug selector and add Notarius debug capture using
their supported enabling CLI flags. An enabled Narratio selector requests
capture; an omitted or false selector passes no debug override and preserves the
application's configured/default behavior. Do not add a downstream disable flag.
Supply the actual run-local debug directories, exposed through `debug/polish`
and `debug/extract`. Control destinations when a downstream tool can enable
capture through its own configuration, using supported destination controls
without changing capture enablement. Audita's debug
work-directory option selects diagnostic storage and belongs to this placement
responsibility.
Route Scriptorium's existing analysis and bounds render-debug products to the
run-local directories exposed through `debug/analyze` and `debug/trim`. Preserve
its existing per-artifact selection capability. Seriatim requires no invented
debug mode; its ordinary reports are
Logs. Subprocess-defined bundle contents and nested run directories are allowed
beneath the selected run-local debug root. Logs and Debug share the same
latest-attempt semantics and cleanup protection.
Keep new full Audita and Notarius debug bundles local in this feature. Preserve
publication of currently declared diagnostics, including existing render-debug
products. Enabling capture does not implicitly add full debug bundles to remote
archives.
Debug controls govern capture when a stage executes. They do not independently
require regeneration of valid substantive outputs. Document the existing force
workflow for obtaining fresh diagnostic evidence when a stage would be reused.
Preserve downstream failure semantics for diagnostic writes and the existing
boundary of Narratio's captured-stream redaction.
### Audita destination support
Audita v4.2 supports independent transcript, report, and work destinations, and
Narratio already selects run-local paths. Narratio captures subprocess stdout
and stderr itself. This roadmap still owns latest-attempt views and retention.
Direct ordinary reports, including failure reports, to the actual polish log
directory, the transcript to its staged product destination, and retained debug
material to the actual polish debug directory. This feature uses the supported
upstream controls in a clean cutover without version-based compatibility branches.
### Manifest, publication, restore, and cleanup
Update all consumers of changed paths and file categories together. Preserve
per-speaker and per-artifact completed-work reuse. Keep publication driven by
declared products and diagnostics, with new full debug bundles remaining local.
Restore new-format products and inputs to their new locations.
Define an explicit way to identify supported session state for the clean
cutover. Document regeneration with the new version and manual configuration
updates. Avoid accepting old state through path fallbacks or silently rewriting
old local sessions or remote snapshots.
Preserve existing invalidation and failed-replacement behavior. Review retention
by content role before changing cleanup targets, especially when durable products
or historical bundles move. Run cleanup preserves the current log and debug
link targets; explicit removal of an entire session removes its local views
with it. Subprocess working State and Cache remain outside Narratio's cleanup
responsibility.
### Documentation and verification
Update configuration examples, the operator guide, adapter contracts, workspace
internals, and the architecture policy when implementation lands. Replace the
current architectural assumption that extraction requires a complete immutable
bundle beneath `artifacts/` with the selected product-promotion model. Retire
policy and documentation for Narratio's removed audio cache/spool lifecycle and
document the managed latest-attempt symlinks. Keep per-application cache locations
as deployment recommendations owned by each application's configuration.
Use focused behavioral coverage for flat output placement, collision rejection,
latest-attempt diagnostics on success and failure, debug selection and routing,
unchanged completed-work reuse, failed replacement, and new-format publish/restore.
Cover empty debug views after attempts without capture, preserved views for
skipped stages, cleanup protection of latest targets, and audio acquisition,
reuse, and restore without persistent spool/cache duplicates. Exercise cleanup
against products and separately owned caches. Use temporary filesystems and
subprocess doubles; default tests remain offline and independent
of sibling checkouts or paid providers.

View File

@@ -39,7 +39,7 @@ Likely cause:
Diagnostics: Diagnostics:
```bash ```bash
narratio session validate 2026-04-04 --session /path/session.yml narratio session validate 2026-04-04 --session-file /path/session.yml
``` ```
Safe fix: Safe fix:
@@ -62,7 +62,7 @@ Likely cause:
Diagnostics: Diagnostics:
```bash ```bash
narratio session plan 2026-04-04 --config /path/pipeline.yml --campaign-file /path/campaign.yml --session /path/session.yml narratio session plan 2026-04-04 --config /path/pipeline.yml --campaign-file /path/campaign.yml --session-file /path/session.yml
``` ```
Safe fix: Safe fix:
@@ -90,19 +90,19 @@ Symptom:
Likely cause: Likely cause:
- the campaign `party.yml` is an unversioned legacy document, or names a - the campaign party main document is unversioned, or names a
schema other than `narratio.party.v1`. schema other than `narratio.party.v1`.
Safe fix: Safe fix:
- replace the file with one exact, single-document - replace the main file with a versioned
[`narratio.party.v1` party](./integrations/party.md); do not add a version [`narratio.party.v1` party](./integrations/party.md); do not add a version
marker to an otherwise incompatible legacy structure. The versioned party is marker to an otherwise incompatible legacy structure. The versioned party is
the only configured roster authority. the only configured roster authority.
Relevant reference: [Canonical Party Input](./integrations/party.md). Relevant reference: [Canonical Party Input](./integrations/party.md).
## Unexpected imported or profile value ## Unexpected imported or overlay value
Symptom: Symptom:
@@ -112,25 +112,30 @@ Symptom:
Diagnostics: Diagnostics:
```bash ```bash
narratio config sources --config /path/pipeline.yml --profile testing narratio config sources --config /path/pipeline.yml --overlay testing
``` ```
Add `--campaign` or `--campaign-file` when the pipeline has party-driven Native sources list the actual files and import evidence for the selected
artifact families. The output identifies each effective logical field's root, scope. To trace a value, use `config explain --path POINTER`, or discover paths
import, profile, default, campaign, party, or family source without printing with `config explain --list`. App inspection keeps family declarations;
the field value or credential contents. `artifacts list` derives concrete members from the selected campaign/party.
Safe fix: Safe fix:
- move a duplicated base field so it has one owner; - inspect the field's effective origin and history;
- correct the selected profile or its overlay; or - correct the selected source or overlay; or
- correct the campaign party/family declaration that owns generated values. - select the intended roster when reviewing family members.
To review what would actually change before switching profiles, run `config To compare an explicit pipeline root with its testing overlay, select the root
diff` with the same pipeline and campaign selectors. It compares normalized on both sides:
effective values rather than YAML formatting or source-file layout.
Relevant reference: [Configuration inspection](./config.md#read-only-effective-pipeline-inspection). ```sh
narratio config diff --config /path/pipeline.yml --against-config /path/pipeline.yml --against-overlay testing --details
```
The sides use independent defaults. Comparison concerns effective native values,
including declarations, rather than generated domain objects or YAML layout.
See [configuration inspection](./cli.md#configuration-inspection).
## Audio mode conflict ## Audio mode conflict
@@ -164,7 +169,7 @@ Likely causes:
- key not defined in `pipeline.scriptorium.artifacts`; - key not defined in `pipeline.scriptorium.artifacts`;
- empty list entry (for example trailing comma); - empty list entry (for example trailing comma);
- `run-stage` used with non-`analyze`/`publish` target. - selected run/plan range contains neither `analyze` nor `publish`.
Diagnostics: Diagnostics:
@@ -201,7 +206,7 @@ narratio session plan 2026-04-04 --from render --through analyze
Safe fix: Safe fix:
- widen the bounded range to include the first reported stage, or recover that - widen the bounded range to include the first reported stage, or recover that
stage explicitly with `run-stage` before retrying. The failed check does not stage explicitly with `run --stage` before retrying. The failed check does not
create a run-local directory or modify the manifest. Narratio does not create a run-local directory or modify the manifest. Narratio does not
resume-validate excluded prefix stages, and stages after `--through` are not resume-validate excluded prefix stages, and stages after `--through` are not
prerequisites. prerequisites.
@@ -213,28 +218,122 @@ input validation.
Relevant reference: [Operations: Stage Execution and Continuation Behavior](./operations.md#stage-execution-and-continuation-behavior). Relevant reference: [Operations: Stage Execution and Continuation Behavior](./operations.md#stage-execution-and-continuation-behavior).
## Transcription retries speakers that previously finished
Symptom:
- an ordinary transcribe retry calls WhisperX for a speaker that appeared to
finish earlier; or
- an older successful session retranscribes all speakers once after upgrade.
Likely causes:
- the earlier response or canonical file was not followed by a successful
speaker manifest checkpoint;
- the prepared audio bytes/path, WhisperX URL, or language changed;
- the canonical transcript is missing, unsafe, non-regular, invalid JSON, or
no longer matches its recorded size/checksum;
- the previous invocation used `--force`, which durably cleared pre-force
speaker authority; or
- the manifest has only legacy aggregate transcribe state and cannot bind old
outputs to their source audio.
Safe fix:
- inspect the reported speaker and filesystem error, repair the prepared input
or canonical-output path when needed, then retry transcribe normally;
- allow a legacy aggregate-only record to regenerate once; and
- do not edit the manifest or copy an old JSON file into place as a substitute
for a successful checkpoint.
```bash
narratio run 2026-04-04 --stage transcribe
```
Valid earlier speaker checkpoints remain reusable even while aggregate
transcribe status is failed or interrupted. Merge remains gated until
transcribe reaches aggregate success with the complete current set.
Relevant reference: [Operations: Transcription continuation and replacement](./operations.md#transcription-continuation-and-replacement).
## WhisperX model changed but transcription was reused
Symptom:
- WhisperX model weights, prompts, or private server configuration changed at
the same configured URL, but Narratio still considers speaker transcripts
current.
Likely cause:
- Narratio can fingerprint its configured URL and language, not private state
loaded behind the service boundary.
Safe fix:
- explicitly force transcribe to establish a durable reset, then use ordinary
retry if the replacement attempt is interrupted.
```bash
narratio run 2026-04-04 --stage transcribe --force
```
Transport replay and application retries do not provide an exactly-once remote
execution guarantee. Investigate server-side failures or duplicate work using
WhisperX diagnostics; do not infer completion from a server log without the
local speaker checkpoint.
Relevant references: [WhisperX integration](./integrations/whisperx.md) and
[Transcribe internals](./internal/stage-transcribe.md).
## Transcription manifest checkpoint failed
Symptom:
- transcribe reports that a speaker completed but the session manifest could
not be saved.
Likely causes:
- the workspace is unwritable or out of space;
- the manifest path or parent directory is unsafe or the wrong type; or
- a transient filesystem error interrupted atomic replacement.
Safe fix:
- correct the reported filesystem or permission problem and retry transcribe
normally. Narratio reconciles from the last readable collection and reuses
only successfully checkpointed speakers.
A canonical raw transcript left by the failed checkpoint is incidental and
does not become reusable authority. Preserve the manifest and diagnostics if
the failure repeats; do not advertise the file by editing manifest evidence.
Relevant references: [Manifest persistence](./internal/manifest.md#persistence-semantics)
and [Transcribe internals](./internal/stage-transcribe.md).
## Notarius credential reference unavailable ## Notarius credential reference unavailable
Symptom: Symptom:
- configuration loading reports `secret.unset`, `secret.empty`, or an invalid - configuration loading reports `secret.unset`, `secret.empty`, or an invalid
name for `pipeline.notarius.llm_api_key`, including during inspection or a name in `pipeline.notarius.credentials`, including during inspection or a
run that would not execute extraction. run that would not execute extraction.
Likely causes: Likely causes:
- the named environment variable is absent or empty; - the named environment variable is absent or empty;
- the selected secrets directory lacks a file with that exact name; - the selected secrets directory lacks a file with that exact name;
- a process environment variable exists but is empty, so bootstrap correctly - a process environment variable is empty and the selected bootstrap policy
leaves it in place; or preserves it; or
- the Narratio reference name does not match `api_key_env` in the selected - the Narratio reference name does not match `api_key_env` in the selected
Notarius/PromptKit profile. Notarius/PromptKit profile.
Safe fix: Safe fix:
- set the exact nonempty environment variable or provide an equivalently named - set the exact nonempty environment variable or provide an equivalently named
file through the conventional or explicit secrets directory; file through the pipeline-configured secrets directory;
- remove or set the field to `null` when that deployment needs no credential; - remove, set to `null`, or set to `[]` when that deployment needs no credential;
and and
- use `config show`, `config sources`, and `config diff` to inspect the public - use `config show`, `config sources`, and `config diff` to inspect the public
reference name and ownership without exposing its value. reference name and ownership without exposing its value.
@@ -245,7 +344,52 @@ invalidate a completed extraction, but the current reference must still resolve
for the command to proceed. for the command to proceed.
Relevant references: [Secrets](./config.md#secrets-handling) and Relevant references: [Secrets](./config.md#secrets-handling) and
[Notarius credential](./config.md#notarius-credential). [Notarius credentials](./config.md#notarius-credentials).
## Prepared glossary is unavailable or invalid
If validation or downstream work reports missing, changed, or invalid prepared
glossary evidence, check the selected catalog IDs, source-relative files, and
campaign inline contribution. Re-run `prepare` after correcting the source;
use `--force` when an explicit refresh is needed. Update old monolithic source
bindings and glossary files using the [glossary input guidance](config.md#glossary-inputs).
Validation uses existing prepared inputs and does not regenerate them.
## Audita configuration or credential failure
Symptom:
- Narratio rejects a retired `pipeline.audita` field during loading, reports
`secret.unset` or `secret.empty` for a listed credential, or Audita rejects
its external configuration or selected profile when polish runs.
Likely causes:
- the Narratio pipeline still uses v1 endpoint, model, capacity, singular key,
report, or retention settings;
- the named key is missing or empty, including a present but empty process
environment variable preserved by the selected bootstrap policy;
- Audita's external configuration references a backend credential name not forwarded
by `pipeline.audita.credentials`, including a backend not selected by the
current profile; or
- an Audita overlay or profile selector names a missing downstream definition.
Safe fix:
- follow the [migration guidance](./operations.md#migrating-audita-and-provider-credentials)
and use an Audita v4.2 executable and configuration;
- provide each needed provider-named variable through the environment or
secrets directory, and list that same name in `pipeline.audita.credentials`;
- validate the external file offline with
`audita config validate --config <file>` before switching executables; and
- inspect Audita's effective profile selection separately from Narratio's
`config show`. Narratio does not infer downstream selectors.
An exit-zero polish with a valid transcript succeeds even when Audita reports
recoverable errors or no corrections. Missing reports are allowed when Audita
reporting is disabled externally. Edits to Audita-owned files behind unchanged
selectors require `narratio run <session-id> --stage polish --force` to replace a
previously successful result. See the [Audita integration contract](./integrations/audita.md).
## Notarius executable missing ## Notarius executable missing
@@ -316,7 +460,7 @@ Safe fix:
evidence before extraction: evidence before extraction:
```bash ```bash
narratio run-stage prepare 2026-04-04 --force narratio run 2026-04-04 --stage prepare --force
``` ```
Do not point Notarius directly at the original source path or edit the manifest Do not point Notarius directly at the original source path or edit the manifest
@@ -476,7 +620,7 @@ Symptom:
Safe fix: Safe fix:
```bash ```bash
narratio run-stage extract 2026-04-04 --force narratio run 2026-04-04 --stage extract --force
``` ```
Narratio fingerprints its invocation contract and prepared Narratio reference Narratio fingerprints its invocation contract and prepared Narratio reference
@@ -519,7 +663,7 @@ Safe fix:
the canonical path as a substitute for current evidence. the canonical path as a substitute for current evidence.
```bash ```bash
narratio analyze 2026-04-04 --artifacts session_recap narratio run 2026-04-04 --stage analyze --force --artifacts session_recap
``` ```
Relevant references: [Operations: Artifact Selection](./operations.md#artifact-selection) Relevant references: [Operations: Artifact Selection](./operations.md#artifact-selection)
@@ -580,22 +724,26 @@ Symptom:
or unsupported; or or unsupported; or
- restore rejects a committed remote session manifest for the same reason. - restore rejects a committed remote session manifest for the same reason.
Likely cause: Likely causes:
- the manifest predates the supported canonical state contract. Narratio - the manifest predates the supported canonical state contract. Narratio
rejects it at the schema boundary rather than interpreting aggregate output rejects it at the schema boundary rather than interpreting aggregate output
lists or incidental files as current authority. lists or incidental files as current authority; or
- an older strict-decoding Narratio binary is reading a current manifest that
contains additive transcribe speaker state it does not recognize.
Safe fix: Safe fix:
- for unsupported local state, move the old manifest aside and regenerate, or - for unsupported local state, move the old manifest aside and regenerate, or
restore a verified current committed snapshot when one is authoritative; restore a verified current committed snapshot when one is authoritative;
- for unsupported committed remote state, regenerate healthy local state as - for unsupported committed remote state, regenerate healthy local state as
needed and republish the session. needed and republish the session; and
- for a downgrade rejection, return to the current binary or restore a verified
pre-upgrade backup. Do not delete only the speaker fields by hand.
```bash ```bash
narratio run 2026-04-04 narratio run 2026-04-04
narratio publish 2026-04-04 narratio run 2026-04-04 --stage publish --force
``` ```
After current records exist, inspect them and publish explicitly. Do not copy After current records exist, inspect them and publish explicitly. Do not copy
@@ -603,7 +751,37 @@ old files into canonical paths merely to influence selection; availability is
manifest-owned. manifest-owned.
Relevant references: [Operations: Stage Execution and Continuation Behavior](./operations.md#stage-execution-and-continuation-behavior) Relevant references: [Operations: Stage Execution and Continuation Behavior](./operations.md#stage-execution-and-continuation-behavior)
and [Manifest Internals](./internal/manifest.md#analyze-owned-artifact-state). and [Manifest Internals](./internal/manifest.md#transcribe-owned-speaker-state).
## Prompt requirements fail during preflight
If a run or `session validate` reports a missing prompt input, compare the exact
input name in the finding with the configured binding key, not just the source
ID. Supply a missing required variable, or correct the selected prompt and
profile. An optional source warning means the source may be omitted later; make
it required only if that is the intended configuration. Incomplete discovery
and conditional requirements warn without failing by themselves.
If inspection cannot start or decode a report, check the selected executable,
its native configuration and prompt resources, and the diagnostic context.
The [Scriptorium migration guide](https://forge.maximumdirect.net/eric/scriptorium/src/tag/v0.16.0/docs/consumers/upgrading-cli.md)
explains the v0.16.0 interface and configuration changes. Retry after correcting
the issue; a preflight failure preserves completed output authority. See
[prompt preflight](operations.md#prompt-requirements-preflight).
## Scriptorium returns HTTP 401 during trim or analyze
Check that Narratio's pipeline selects the credential names required by
Scriptorium, for example `scriptorium.credentials: [OPENROUTER_API_KEY]`.
Provision the values through the existing environment or secrets directory;
exporting a key without selecting it does not forward it to the child process.
See [Scriptorium credentials](config.md#scriptorium-credentials).
Once corrected, retry the failed run normally; forcing previously successful
transcription or analysis is unnecessary. If authentication still fails, check
the selected Scriptorium backend, credential validity, and provider access
without printing keys. A 401 can indicate an invalid key as well as a missing
one.
## Scriptorium private input changed without a rerun ## Scriptorium private input changed without a rerun
@@ -626,7 +804,7 @@ Safe fix:
reusable unless selected themselves. reusable unless selected themselves.
```bash ```bash
narratio analyze 2026-04-04 --artifacts session_recap narratio run 2026-04-04 --stage analyze --force --artifacts session_recap
``` ```
Relevant reference: [Analyze Internals](./internal/stage-analyze.md#invariants). Relevant reference: [Analyze Internals](./internal/stage-analyze.md#invariants).
@@ -660,7 +838,7 @@ narratio session restore 2026-04-04
or rerun prepare after correcting session config: or rerun prepare after correcting session config:
```bash ```bash
narratio run-stage prepare 2026-04-04 --force narratio run 2026-04-04 --stage prepare --force
``` ```
Relevant reference: [Operations: Restore Workflow](./operations.md#restore-workflow). Relevant reference: [Operations: Restore Workflow](./operations.md#restore-workflow).
@@ -762,7 +940,7 @@ Diagnostics:
```bash ```bash
narratio session artifacts 2026-04-04 --remote narratio session artifacts 2026-04-04 --remote
narratio session status 2026-04-04 narratio session status 2026-04-04
narratio run-stage publish 2026-04-04 --force narratio run 2026-04-04 --stage publish --force
``` ```
Safe fix: Safe fix:
@@ -795,8 +973,8 @@ Safe fix:
- rerun render and then retry downstream stage(s): - rerun render and then retry downstream stage(s):
```bash ```bash
narratio run-stage render 2026-04-04 --force narratio run 2026-04-04 --stage render --force
narratio run-stage analyze 2026-04-04 --force narratio run 2026-04-04 --stage analyze --force
``` ```
Relevant reference: [Operations: Stage Execution](./operations.md#stage-execution-and-continuation-behavior). Relevant reference: [Operations: Stage Execution](./operations.md#stage-execution-and-continuation-behavior).
@@ -809,8 +987,8 @@ Symptom:
Likely causes: Likely causes:
- missing, unreadable, or invalid explicit `--secrets-dir`; - a missing, unreadable, or invalid pipeline-configured secrets directory;
- invalid entries in the conventional `secrets/` directory beside the root pipeline; - invalid secret-directory entries;
- missing credential environment variables; - missing credential environment variables;
- invalid S3 endpoint/bucket settings. - invalid S3 endpoint/bucket settings.
@@ -823,7 +1001,7 @@ env | sed 's/=.*//' | grep -E 'OBJECT_STORAGE|AWS|AUDITA|NOTARIUS|SCRIPTORIUM'
Safe fix: Safe fix:
- correct `--secrets-dir`, secret-file type/name, and operator-managed permissions; - correct the main pipeline secrets selection, file type/name, and operator-managed permissions;
- provide required env vars; - provide required env vars;
- keep secret values out of YAML. - keep secret values out of YAML.

View File

@@ -9,28 +9,41 @@ in the [configuration reference](../docs/config.md).
- [Minimal pipeline](pipeline.minimal.yml): campaign discovery plus the required - [Minimal pipeline](pipeline.minimal.yml): campaign discovery plus the required
WhisperX URL. WhisperX URL.
- [Synthetic catalog pipeline](pipeline.catalog.yml): imports the small
[example catalog](reference-catalog/catalog.yml), whose setting imports a
relative fragment. Install an operator-selected catalog separately for a
production deployment.
- [Production-shaped pipeline](pipeline.production.yml): S3 storage, publish, - [Production-shaped pipeline](pipeline.production.yml): S3 storage, publish,
external tools, and configured Scriptorium artifacts. external tools, and configured Scriptorium artifacts.
- [Production-base/testing-overlay bundle](production-testing/pipeline.yml): - [Production-base/testing-overlay bundle](production-testing/pipeline.yml):
explicit `conf.d` imports, one ordinary artifact per `artifacts/<key>.yml`, explicit required `conf.d` imports, an optional local import, destination-mounted
one family per `artifact-families/<key>.yml`, and the fixed artifact files, a YAML-filtered directory of keyed families, and the fixed
`profiles/testing.yml` overlay. Production values live in the base. The `overlays/testing.yml` overlay. Production values live in the base. The
bundle demonstrates an input-only artifact dependency, two character families bundle demonstrates an input-only artifact dependency, two character families
sharing the campaign party, and a testing-only disabled artifact. Inspect it sharing the campaign party, and a testing-only disabled artifact. The testing
offline with: overlay's `testing_notes` artifact inherits the recap prompt, inputs, and
testing profile while retaining its disabled status and separate output path.
The testing overlay upserts the transcript publish rule by `source`. A
destination key defines each artifact ID; filenames do not. Full-root and
disjoint definitions are also valid. Upsert replaces a matching list record
as a whole; empty append or upsert contributions leave existing entries intact.
Inspect it offline with:
```sh ```sh
narratio config validate --config examples/production-testing/pipeline.yml --campaign-file examples/campaigns/sample-campaign/campaign.yml narratio config validate --config examples/production-testing/pipeline.yml
narratio config show --config examples/production-testing/pipeline.yml --campaign-file examples/campaigns/sample-campaign/campaign.yml --profile testing narratio config show --config examples/production-testing/pipeline.yml --overlay testing
narratio config sources --config examples/production-testing/pipeline.yml --campaign-file examples/campaigns/sample-campaign/campaign.yml --profile testing narratio config sources --config examples/production-testing/pipeline.yml --overlay testing
narratio config artifacts --config examples/production-testing/pipeline.yml --campaign-file examples/campaigns/sample-campaign/campaign.yml --profile testing narratio artifacts list --config examples/production-testing/pipeline.yml --campaign-file examples/campaigns/sample-campaign/campaign.yml --overlay testing
narratio config diff default testing --config examples/production-testing/pipeline.yml --campaign-file examples/campaigns/sample-campaign/campaign.yml narratio config diff --against-config examples/production-testing/pipeline.yml --against-overlay testing --config examples/production-testing/pipeline.yml
``` ```
These inspection commands load configuration and resolve explicit credential These inspection commands load configuration and resolve explicit credential
references, but do not load a session or create runtime state. This bundle is references, but do not load a session or create runtime state. This bundle is
intentionally local-storage and credential-reference free so the walkthrough intentionally local-storage and credential-reference free so the walkthrough
needs no tools or cloud services. needs no tools or cloud services. Native app inspection retains family
declarations; `artifacts list` derives their concrete members using the selected
campaign. Diff selects the example root on both sides because omitted
right-side selectors use their own discovery defaults.
- [Full annotated pipeline](pipeline.full.annotated.yml): every implemented - [Full annotated pipeline](pipeline.full.annotated.yml): every implemented
pipeline section with explanatory comments. pipeline section with explanatory comments.
- [Extraction subset pipeline](pipeline.extraction-subset.yml): a focused - [Extraction subset pipeline](pipeline.extraction-subset.yml): a focused
@@ -43,13 +56,21 @@ with the sample campaign and a compatible local- or S3-audio session.
- [Sample campaign](campaigns/sample-campaign/campaign.yml), its - [Sample campaign](campaigns/sample-campaign/campaign.yml), its
[session template](campaigns/sample-campaign/session.template.yml), and its [session template](campaigns/sample-campaign/session.template.yml), and its
adjacent stable inputs provide a complete campaign directory shape. adjacent stable inputs provide a complete campaign directory shape. Its
imported settings and split party demonstrate local secondary imports;
relative resources follow the file that supplies each value.
- [Local-audio session](session.local-audio.yml) and - [Local-audio session](session.local-audio.yml) and
[S3-audio session](session.s3-audio.yml) are concrete session files. [S3-audio session](session.s3-audio.yml) are concrete session files.
- [Session template](session.template.yml) and the campaign-local equivalent - [Session template](session.template.yml) and the campaign-local equivalent
demonstrate the narrow placeholder syntax consumed by `session init`; they demonstrate the narrow placeholder syntax consumed by `session init`; they
are templates, not runtime session files. are templates, not runtime session files.
The [inline-only](glossary-authoring/inline-only.yml),
[file-only](glossary-authoring/file-only.yml), and
[combined](glossary-authoring/combined.yml) inputs fragments illustrate campaign
vocabulary selection. They omit optional setting and system selections; add
those IDs only when the pipeline imports a matching catalog.
## Input Fixtures ## Input Fixtures
- [Speakers](speakers.yml), [autocorrect](autocorrect.yml), and - [Speakers](speakers.yml), [autocorrect](autocorrect.yml), and
@@ -70,10 +91,14 @@ The examples contain environment-variable names but no credential values. Set
`OBJECT_STORAGE_KEY_ID`, `OBJECT_STORAGE_KEY`, `AUDITA_LLM_API_KEY`, and `OBJECT_STORAGE_KEY_ID`, `OBJECT_STORAGE_KEY`, `AUDITA_LLM_API_KEY`, and
`NOTARIUS_LLM_API_KEY` to nonempty synthetic or real values before loading the `NOTARIUS_LLM_API_KEY` to nonempty synthetic or real values before loading the
examples that reference them. They use fictional campaign content and reserved examples that reference them. They use fictional campaign content and reserved
example domains. example domains. The Audita and Notarius names are example references, not
implicit aliases: external backend/profile configurations must use those exact
names, or the Narratio credential lists must be changed to match. See the
[Audita v4.2 configuration guide](https://forge.maximumdirect.net/eric/audita/src/tag/v4.2.0/docs/config.md)
for maintained downstream configuration examples.
For a deployed bundle, keep credential files out of source control in a For a deployed bundle, keep credential files out of source control. Select a
`secrets/` directory beside the root `pipeline.yml`, one file per referenced directory in the main pipeline or provide environment values; see
environment-variable name, or select another directory with `--secrets-dir`. [Secrets Handling](../docs/config.md#secrets-handling).
Static S3 credentials are optional: omit both S3 credential references to use Static S3 credentials are optional: omit both S3 credential references to use
the AWS SDK discovery chain. the AWS SDK discovery chain.

View File

@@ -1,8 +1,5 @@
config:
imports:
- path: fragments/inputs.yml
required: true
campaign_id: sample-campaign campaign_id: sample-campaign
session_template_file: ./session.template.yml
inputs:
speakers_file: ./speakers.yml
autocorrect_file: ./autocorrect.yml
glossary_file: ./glossary.yml
party_file: ./party.yml
spell_catalog_file: ./spell_catalog.json

View File

@@ -0,0 +1,12 @@
brenna:
player:
name: Rowan Hale
character:
name: Brenna
alias:
- Shield of Dawn
classes:
- name: paladin
level: 6
- name: warlock
level: 2

View File

@@ -0,0 +1,7 @@
session_template_file: ../session.template.yml
inputs:
speakers_file: ../speakers.yml
autocorrect_file: ../autocorrect.yml
glossary_file: ../glossary.yml
party_file: ../party.yml
spell_catalog_file: ../spell_catalog.json

View File

@@ -1 +1,3 @@
[] campaign:
entries:
- {id: lantern_watch, name: Lantern Watch, category: organization}

View File

@@ -1,4 +1,9 @@
schema_version: narratio.party.v1 schema_version: narratio.party.v1
config:
imports:
- path: fragments/brenna.yml
destination: [characters]
required: true
characters: characters:
arannis: arannis:
@@ -12,15 +17,3 @@ characters:
classes: classes:
- name: wizard - name: wizard
level: 8 level: 8
brenna:
player:
name: Rowan Hale
character:
name: Brenna
alias:
- Shield of Dawn
classes:
- name: paladin
level: 6
- name: warlock
level: 2

View File

@@ -0,0 +1,7 @@
# Inline records compose above the file using ConfigKit entry identities.
inputs:
glossary_file: ../glossary.yml
glossary:
instruction: Use established campaign terminology.
entries:
- {id: lantern_watch, name: Silver Watch, category: organization}

View File

@@ -0,0 +1,3 @@
# Campaign inputs fragment; select the adjacent sample file when importing this fragment.
inputs:
glossary_file: ../glossary.yml

View File

@@ -0,0 +1,5 @@
# Campaign inputs fragment; include the required roster and other inputs separately.
inputs:
glossary:
entries:
- {id: watch, name: Silver Watch, category: organization}

View File

@@ -1,2 +1,3 @@
[] campaign:
entries:
- {id: lantern_watch, name: Lantern Watch, category: organization}

View File

@@ -0,0 +1,10 @@
# Synthetic catalog example; production installations select their own local catalog.
config:
imports:
- path: reference-catalog/catalog.yml
required: true
campaigns:
root: /usr/local/share/narratio/campaigns
default_campaign_id: sample-campaign
whisperx:
transcribe_url: https://transcription.example.com/transcribe

View File

@@ -15,7 +15,7 @@ notarius:
pipeline_id: dnd-session pipeline_id: dnd-session
timeout: 3h timeout: 3h
references: references:
glossary: narratio.input.glossary glossary: narratio.input.glossary.campaign
party: narratio.input.party party: narratio.input.party
players: narratio.input.players players: narratio.input.players
spell_catalog: narratio.input.spell_catalog spell_catalog: narratio.input.spell_catalog

View File

@@ -7,8 +7,10 @@ workspace:
# Optional: remove run-scoped workdir after successful publish commit. # Optional: remove run-scoped workdir after successful publish commit.
cleanup_after_publish: false cleanup_after_publish: false
# Credential files, when used, belong in a sibling secrets/ directory or in the # Optional configured bootstrap; see the ConfigKit configured-startup contract:
# directory selected with --secrets-dir; they are not pipeline configuration. # https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md#explicit-secrets-directory-bootstrap
# config:
# secrets_dir: secrets
storage: storage:
# Defaults to "local". Use "s3" explicitly for publish + S3 audio workflows. # Defaults to "local". Use "s3" explicitly for publish + S3 audio workflows.
@@ -90,22 +92,19 @@ seriatim:
filler_max_duration: 1.25 filler_max_duration: 1.25
audita: audita:
# Optional overrides; defaults shown explicitly where applicable. # Optional overrides. Audita owns its own configuration and profiles.
binary: audita binary: audita
timeout: 3h timeout: 3h
llm_api_key: AUDITA_LLM_API_KEY # Names must match credentials on the configured Audita backends.
modules: [glossary, homophones, spoken_word, grammar] credentials: [AUDITA_LLM_API_KEY]
base_url: "" debug: false # true requests a run-local Audita debug capture
model: "" # Configure processing order in Audita configuration.
total_llm_concurrency: 2 overlay: ""
proposal_llm_concurrency: 1 proposal_profile: ""
validation_model: "" validation_profile: ""
validation_llm_concurrency: 1
transcript_description: "" transcript_description: ""
config_path: /usr/local/etc/audita/config.yml config_path: /usr/local/etc/audita/config.yml
output_schema: audita-v1 output_schema: audita-v1
work_dir_retention: auto
report: true
normalize: normalize:
# Optional; defaults shown explicitly. # Optional; defaults shown explicitly.
@@ -131,9 +130,13 @@ notarius:
# Optional structured extraction after render and before analyze. # Optional structured extraction after render and before analyze.
enabled: true enabled: true
binary: notarius binary: notarius
# Optional environment-variable reference. Match this name to api_key_env in # Optional environment-variable references. Match these names to the
# the selected Notarius/PromptKit profile; never put the credential here. # selected Notarius/PromptKit providers; never put credential values here.
llm_api_key: NOTARIUS_LLM_API_KEY credentials: [NOTARIUS_LLM_API_KEY]
# Optionally select a Notarius ConfigKit overlay when extraction runs. This
# is independent of Narratio's selected overlay and may use a different name.
# See docs/config.md and docs/integrations/notarius.md for the contracts.
# config_overlay: downstream-economy
config_path: /usr/local/etc/notarius/config.yml config_path: /usr/local/etc/notarius/config.yml
pipeline_id: dnd-session pipeline_id: dnd-session
timeout: 3h timeout: 3h
@@ -147,7 +150,7 @@ notarius:
# External campaign references use prepared Narratio source IDs. Omit an # External campaign references use prepared Narratio source IDs. Omit an
# optional binding when the selected Notarius pipeline does not need it. # optional binding when the selected Notarius pipeline does not need it.
references: references:
glossary: narratio.input.glossary glossary: narratio.input.glossary.campaign
party: narratio.input.party party: narratio.input.party
players: narratio.input.players players: narratio.input.players
spell_catalog: narratio.input.spell_catalog spell_catalog: narratio.input.spell_catalog
@@ -217,6 +220,9 @@ notarius:
scriptorium: scriptorium:
binary: scriptorium binary: scriptorium
# Select provider names provisioned through Narratio's environment/secrets.
# Used for requirements inspection, trim, analysis, and render-debug calls.
# credentials: [OPENROUTER_API_KEY, RAKESTRAWHOME_API_KEY]
config_path: /usr/local/etc/scriptorium/config.yml config_path: /usr/local/etc/scriptorium/config.yml
timeout: 10m timeout: 10m
render_debug: false render_debug: false
@@ -242,7 +248,7 @@ scriptorium:
source: narratio.input.party source: narratio.input.party
required: true required: true
glossary: glossary:
source: narratio.input.glossary source: narratio.input.glossary.campaign
required: false required: false
vars: vars:
session_id: true session_id: true

View File

@@ -1,3 +1,10 @@
# If this file is installed under /etc/narratio, install the selected catalog
# at /etc/narratio/reference-catalog and enable its root-relative import:
# config:
# imports:
# - path: reference-catalog/catalog.yml
# required: true
workspace: workspace:
root: /var/lib/narratio/workspace root: /var/lib/narratio/workspace
cleanup_after_publish: true cleanup_after_publish: true
@@ -57,14 +64,9 @@ seriatim:
audita: audita:
binary: audita binary: audita
timeout: 3h timeout: 3h
llm_api_key: AUDITA_LLM_API_KEY credentials: [AUDITA_LLM_API_KEY]
modules: [glossary, homophones, spoken_word, grammar] # Configure processing order in Audita configuration.
output_schema: audita-v1 output_schema: audita-v1
work_dir_retention: auto
total_llm_concurrency: 2
proposal_llm_concurrency: 1
validation_llm_concurrency: 1
report: true
normalize: normalize:
output_path: transcripts/final.json output_path: transcripts/final.json
@@ -73,6 +75,7 @@ normalize:
scriptorium: scriptorium:
binary: scriptorium binary: scriptorium
# credentials: [OPENROUTER_API_KEY] # Enable when this provider is configured.
config_path: /usr/local/etc/scriptorium/config.yml config_path: /usr/local/etc/scriptorium/config.yml
timeout: 10m timeout: 10m
render_debug: false render_debug: false
@@ -97,7 +100,7 @@ scriptorium:
source: narratio.input.party source: narratio.input.party
required: true required: true
glossary: glossary:
source: narratio.input.glossary source: narratio.input.glossary.campaign
required: false required: false
vars: vars:
session_id: true session_id: true

View File

@@ -1,20 +1,18 @@
scriptorium: character_items:
artifact_families: enabled: true
character_items: for_each: party.characters
enabled: true prompt_id: dnd.character_items
for_each: party.characters profile_id: production-placeholder
prompt_id: dnd.character_items output_path_pattern: artifacts/characters/{character_id}/items.md
profile_id: production-placeholder inputs:
output_path_pattern: artifacts/characters/{character_id}/items.md character_meta:
inputs: source: narratio.member_artifact.character_meta
character_meta: required: true
source: narratio.member_artifact.character_meta member_vars:
required: true character_id: character_id
member_vars: character_name: character.name
character_id: character_id aliases: character.alias_summary
character_name: character.name publish:
aliases: character.alias_summary enabled: true
publish: required: false
enabled: true dest_pattern: artifacts/characters/{character_id}/items.md
required: false
dest_pattern: artifacts/characters/{character_id}/items.md

View File

@@ -1,13 +1,11 @@
scriptorium: character_meta:
artifact_families: enabled: true
character_meta: for_each: party.characters
enabled: true prompt_id: dnd.character_meta
for_each: party.characters profile_id: production-placeholder
prompt_id: dnd.character_meta output_path_pattern: artifacts/characters/{character_id}/meta.md
profile_id: production-placeholder member_vars:
output_path_pattern: artifacts/characters/{character_id}/meta.md character_id: character_id
member_vars: character_name: character.name
character_id: character_id player_name: player.name
character_name: character.name class_summary: character.class_summary
player_name: player.name
class_summary: character.class_summary

View File

@@ -1,11 +1,8 @@
scriptorium: enabled: true
artifacts: prompt_id: dnd.player_handout
player_handout: profile_id: production-placeholder
enabled: true output_path: artifacts/player-handout.md
prompt_id: dnd.player_handout inputs:
profile_id: production-placeholder recap:
output_path: artifacts/player-handout.md source: narratio.artifact.session_recap
inputs: required: true
recap:
source: narratio.artifact.session_recap
required: true

View File

@@ -1,11 +1,8 @@
scriptorium: enabled: true
artifacts: prompt_id: dnd.session_recap
session_recap: profile_id: production-placeholder
enabled: true output_path: artifacts/session-recap.md
prompt_id: dnd.session_recap inputs:
profile_id: production-placeholder transcript:
output_path: artifacts/session-recap.md source: narratio.transcript.final_trimmed
inputs: required: true
transcript:
source: narratio.transcript.final_trimmed
required: true

View File

@@ -8,10 +8,9 @@ seriatim:
audita: audita:
binary: audita binary: audita
modules: [glossary, grammar]
output_schema: audita-v1 output_schema: audita-v1
model: narratio-production-model-placeholder proposal_profile: narratio-production-model-placeholder
validation_model: narratio-production-validator-placeholder validation_profile: narratio-production-validator-placeholder
normalize: normalize:
output_path: transcripts/final.json output_path: transcripts/final.json

View File

@@ -1,6 +1,18 @@
config:
sequences:
- destination: [publish, outputs]
key: source
mode: upsert
publish:
outputs:
- source: narratio.transcript.final_markdown
dest: transcripts/final.md
required: false
audita: audita:
model: narratio-testing-model-placeholder proposal_profile: narratio-testing-model-placeholder
validation_model: narratio-testing-validator-placeholder validation_profile: narratio-testing-validator-placeholder
scriptorium: scriptorium:
artifacts: artifacts:
@@ -9,6 +21,7 @@ scriptorium:
player_handout: player_handout:
profile_id: testing-placeholder profile_id: testing-placeholder
testing_notes: testing_notes:
extends: session_recap
enabled: false enabled: false
output_path: artifacts/testing-notes.md output_path: artifacts/testing-notes.md
artifact_families: artifact_families:

View File

@@ -1,13 +1,25 @@
# Copyable production-base/testing-overlay entry point. ConfigKit expands only # ConfigKit assembles these declared sources; destinations define artifact IDs.
# these explicit path and glob imports; Narratio never scans directories itself. config:
configkit:
imports: imports:
- path: conf.d/platform.yml - path: conf.d/platform.yml
required: true
- path: conf.d/storage.yml - path: conf.d/storage.yml
required: true
- path: conf.d/transcript.yml - path: conf.d/transcript.yml
required: true
- path: conf.d/publish.yml - path: conf.d/publish.yml
- glob: artifacts/*.yml required: true
- glob: artifact-families/*.yml - path: conf.d/local.yml
- path: artifacts/session_recap.yml
destination: [scriptorium, artifacts, session_recap]
required: true
- path: artifacts/player_handout.yml
destination: [scriptorium, artifacts, player_handout]
required: true
- dir: artifact-families
pattern: "*.yml"
destination: [scriptorium, artifact_families]
required: true
scriptorium: scriptorium:
binary: scriptorium binary: scriptorium

View File

@@ -0,0 +1,5 @@
reference_catalog:
settings:
lantern_coast: ./setting.yml
systems:
sample_magic: ./spells.yml

View File

@@ -0,0 +1,3 @@
setting:
entries:
- {id: harbor, name: North Harbor, category: place}

View File

@@ -0,0 +1,8 @@
config:
imports:
- path: fragments/places.yml
required: true
setting:
instruction: Use the established place names.
entries:
- {id: coast, name: Lantern Coast, category: place}

View File

@@ -0,0 +1,3 @@
spells:
entries:
- {id: glow, name: Lantern Glow, category: spell}

View File

@@ -0,0 +1,2 @@
inputs:
audio_dir: ../audio

View File

@@ -1,5 +1,7 @@
config:
imports:
- path: session-inputs/local-audio.yml
required: true
session_id: 2026-05-03 session_id: 2026-05-03
date: 2026-05-03 date: 2026-05-03
title: Sample Session title: Sample Session
inputs:
audio_dir: ./audio

18
go.mod
View File

@@ -1,14 +1,18 @@
module gitea.maximumdirect.net/eric/narratio module gitea.maximumdirect.net/eric/narratio
go 1.26.0 go 1.27.0
require ( require (
gitea.maximumdirect.net/eric/ConfigKit v0.3.1
github.com/aws/aws-sdk-go-v2/config v1.32.17 github.com/aws/aws-sdk-go-v2/config v1.32.17
github.com/aws/aws-sdk-go-v2/credentials v1.19.16 github.com/aws/aws-sdk-go-v2/credentials v1.19.16
github.com/aws/aws-sdk-go-v2/service/s3 v1.101.0 github.com/aws/aws-sdk-go-v2/service/s3 v1.101.0
github.com/aws/smithy-go v1.25.1 github.com/aws/smithy-go v1.25.1
github.com/google/go-cmp v0.7.0 github.com/google/go-cmp v0.7.0
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3
go.maximumdirect.net/ckconfig v0.11.0
go.maximumdirect.net/commandkit v0.8.0
go.maximumdirect.net/configkit v1.4.0
go.maximumdirect.net/releasekit v0.10.0
golang.org/x/sync v0.22.0 golang.org/x/sync v0.22.0
golang.org/x/sys v0.47.0 golang.org/x/sys v0.47.0
gopkg.in/yaml.v3 v3.0.1 gopkg.in/yaml.v3 v3.0.1
@@ -29,5 +33,13 @@ require (
github.com/aws/aws-sdk-go-v2/service/sso v1.30.17 // indirect github.com/aws/aws-sdk-go-v2/service/sso v1.30.17 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.21 // indirect github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.21 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.42.1 // indirect github.com/aws/aws-sdk-go-v2/service/sts v1.42.1 // indirect
go.yaml.in/yaml/v4 v4.0.0-rc.6 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/spf13/cobra v1.10.2 // indirect
github.com/spf13/pflag v1.1.0 // indirect
github.com/yuin/goldmark/v2 v2.1.16 // indirect
go.yaml.in/yaml/v4 v4.0.0 // indirect
golang.org/x/mod v0.43.0 // indirect
golang.org/x/text v0.14.0 // indirect
) )
tool go.maximumdirect.net/releasekit/cmd/releasekit

34
go.sum
View File

@@ -1,5 +1,3 @@
gitea.maximumdirect.net/eric/ConfigKit v0.3.1 h1:etfTI/dxO3NnS18La0V6IeUh/Iv+3PjVfEyaN8hTuOM=
gitea.maximumdirect.net/eric/ConfigKit v0.3.1/go.mod h1:tYWpsrbLyu05r8+1MapWp5fN6ZrX9I8hU2xEPedYmYk=
github.com/aws/aws-sdk-go-v2 v1.41.7 h1:DWpAJt66FmnnaRIOT/8ASTucrvuDPZASqhhLey6tLY8= github.com/aws/aws-sdk-go-v2 v1.41.7 h1:DWpAJt66FmnnaRIOT/8ASTucrvuDPZASqhhLey6tLY8=
github.com/aws/aws-sdk-go-v2 v1.41.7/go.mod h1:4LAfZOPHNVNQEckOACQx60Y8pSRjIkNZQz1w92xpMJc= github.com/aws/aws-sdk-go-v2 v1.41.7/go.mod h1:4LAfZOPHNVNQEckOACQx60Y8pSRjIkNZQz1w92xpMJc=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.10 h1:gx1AwW1Iyk9Z9dD9F4akX5gnN3QZwUB20GGKH/I+Rho= github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.10 h1:gx1AwW1Iyk9Z9dD9F4akX5gnN3QZwUB20GGKH/I+Rho=
@@ -36,14 +34,42 @@ github.com/aws/aws-sdk-go-v2/service/sts v1.42.1 h1:F/M5Y9I3nwr2IEpshZgh1GeHpOIt
github.com/aws/aws-sdk-go-v2/service/sts v1.42.1/go.mod h1:mTNxImtovCOEEuD65mKW7DCsL+2gjEH+RPEAexAzAio= github.com/aws/aws-sdk-go-v2/service/sts v1.42.1/go.mod h1:mTNxImtovCOEEuD65mKW7DCsL+2gjEH+RPEAexAzAio=
github.com/aws/smithy-go v1.25.1 h1:J8ERsGSU7d+aCmdQur5Txg6bVoYelvQJgtZehD12GkI= github.com/aws/smithy-go v1.25.1 h1:J8ERsGSU7d+aCmdQur5Txg6bVoYelvQJgtZehD12GkI=
github.com/aws/smithy-go v1.25.1/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= github.com/aws/smithy-go v1.25.1/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc=
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI=
github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
go.yaml.in/yaml/v4 v4.0.0-rc.6 h1:1h7H1ohdUh93/FyE4YaDa1Zh64K6VVbjF4K6WUxMtH4= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
go.yaml.in/yaml/v4 v4.0.0-rc.6/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 h1:1EYB5IzjZawrrnELUi78f9fPu57HuXjmddZPjrls/28=
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU=
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/pflag v1.1.0 h1:6W6MbVUrnMb8PEhjkqwsVLY7ryuzRfFHF4mQd7L94ag=
github.com/spf13/pflag v1.1.0/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/yuin/goldmark/v2 v2.1.16 h1:MXvCVo+Cb2SVJ5cwJUzXetDjI7HECRJCkcqylEQtcJo=
github.com/yuin/goldmark/v2 v2.1.16/go.mod h1:G6M4/qOFtfn01/o14BU1UR2Lo5N3S9Qo7xCuz/sHjGQ=
go.maximumdirect.net/ckconfig v0.11.0 h1:oTPW5R4vW5TNs97rqgABC/dir723rbGBz0FUyZ9QiNk=
go.maximumdirect.net/ckconfig v0.11.0/go.mod h1:9phvXeLAgQSBKpJWqPyIQASKVJr0nRhiPMIQkfNhaRo=
go.maximumdirect.net/commandkit v0.8.0 h1:EBDjr7SvfgvVDsA2S95hkOhgZe7oGZdDvURDJxHyX48=
go.maximumdirect.net/commandkit v0.8.0/go.mod h1:sVp3JXKpm2YrP4Ie8Q3nWmQgwBdPN8uO+wQU72erDns=
go.maximumdirect.net/configkit v1.4.0 h1:TfOupZbQ23/ZMs+xt5lmyukCF11ekqKep8KbmFQD63o=
go.maximumdirect.net/configkit v1.4.0/go.mod h1:ewu6blSokUDCMovy8JBXAdXRikGmlHXAQpFghnPWRfs=
go.maximumdirect.net/releasekit v0.10.0 h1:3GOgaIigXTkvYaRkntWZASE//2NTR1+IhkoKmt64aJo=
go.maximumdirect.net/releasekit v0.10.0/go.mod h1:cT5NZNEcf7SKDx4MPG40YNK9V4bNyIxcLLFuNlbGQ90=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
go.yaml.in/yaml/v4 v4.0.0 h1:/LG1pNO84Z4l603j/xMn69CcS5OYhMQ/f7l2LoQUGuw=
go.yaml.in/yaml/v4 v4.0.0/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0=
golang.org/x/mod v0.43.0 h1:MFuq5J6s35W9D3IjkwyWc9vHh0nENOrt5K8Iof4ofmg=
golang.org/x/mod v0.43.0/go.mod h1:4ec1JnuyBz5+FIVhg86UsA39YG8BpnrZdJYSNHmGzHY=
golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek= golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek=
golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0= golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs= golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

View File

@@ -12,18 +12,21 @@ import (
// NoopRunner is a deterministic no-op audita adapter. // NoopRunner is a deterministic no-op audita adapter.
type NoopRunner struct{} type NoopRunner struct{}
// Preflight accepts the synthetic request in no-op environments.
func (*NoopRunner) Preflight(ctx context.Context, _ PolishRequest) (PreflightResult, error) {
return PreflightResult{}, ctx.Err()
}
// Run returns requested output path with placeholder metadata. // Run returns requested output path with placeholder metadata.
func (n *NoopRunner) Run(ctx context.Context, req PolishRequest) (PolishResult, error) { func (n *NoopRunner) Run(ctx context.Context, req PolishRequest) (PolishResult, error) {
if err := ctx.Err(); err != nil { if err := ctx.Err(); err != nil {
return PolishResult{}, err return PolishResult{}, err
} }
if err := materializePlaceholders(req); err != nil { if err := materializePlaceholders(req, false); err != nil {
return PolishResult{}, err return PolishResult{}, err
} }
return PolishResult{ return PolishResult{
ProcessedTranscriptPath: req.OutputProcessedPath, ProcessedTranscriptPath: req.OutputProcessedPath,
ReportPath: req.ReportPath,
WorkDir: req.WorkDir,
StdoutLogPath: req.StdoutLogPath, StdoutLogPath: req.StdoutLogPath,
StderrLogPath: req.StderrLogPath, StderrLogPath: req.StderrLogPath,
GeneratedConfigPath: req.GeneratedConfigPath, GeneratedConfigPath: req.GeneratedConfigPath,
@@ -33,9 +36,20 @@ func (n *NoopRunner) Run(ctx context.Context, req PolishRequest) (PolishResult,
// FakeRunner captures polish requests and returns deterministic responses. // FakeRunner captures polish requests and returns deterministic responses.
type FakeRunner struct { type FakeRunner struct {
Requests []PolishRequest Requests []PolishRequest
Err error Err error
Result PolishResult Result PolishResult
PreflightRequests []PolishRequest
PreflightErr error
}
// Preflight records a readiness request in deterministic tests.
func (f *FakeRunner) Preflight(ctx context.Context, req PolishRequest) (PreflightResult, error) {
if err := ctx.Err(); err != nil {
return PreflightResult{}, err
}
f.PreflightRequests = append(f.PreflightRequests, req)
return PreflightResult{}, f.PreflightErr
} }
// Run records request and returns configured response. // Run records request and returns configured response.
@@ -47,18 +61,20 @@ func (f *FakeRunner) Run(ctx context.Context, req PolishRequest) (PolishResult,
if f.Err != nil { if f.Err != nil {
return PolishResult{}, f.Err return PolishResult{}, f.Err
} }
if err := materializePlaceholders(req); err != nil { if err := materializePlaceholders(req, true); err != nil {
return PolishResult{}, err return PolishResult{}, err
} }
res := f.Result res := f.Result
if res.ProcessedTranscriptPath == "" { if res.ProcessedTranscriptPath == "" {
res.ProcessedTranscriptPath = req.OutputProcessedPath res.ProcessedTranscriptPath = req.OutputProcessedPath
} }
if res.ReportPath == "" { if res.Reports == (ReportBundle{}) {
res.ReportPath = req.ReportPath dir := reportDirectory(req)
} res.Reports = ReportBundle{
if res.WorkDir == "" { ErrorsPath: filepath.Join(dir, "errors.yml"),
res.WorkDir = req.WorkDir RecoveriesPath: filepath.Join(dir, "recoveries.yml"),
OverviewPath: filepath.Join(dir, "report.md"),
}
} }
if res.StdoutLogPath == "" { if res.StdoutLogPath == "" {
res.StdoutLogPath = req.StdoutLogPath res.StdoutLogPath = req.StdoutLogPath
@@ -75,10 +91,10 @@ func (f *FakeRunner) Run(ctx context.Context, req PolishRequest) (PolishResult,
return res, nil return res, nil
} }
func materializePlaceholders(req PolishRequest) error { func materializePlaceholders(req PolishRequest, reports bool) error {
if req.GeneratedConfigPath != "" { if req.GeneratedConfigPath != "" {
payload := map[string]any{ payload := map[string]any{
"schema": "audita.generated.v1", "schema": "audita.generated.v3",
"placeholder": true, "placeholder": true,
"merged_transcript_path": req.MergedTranscriptPath, "merged_transcript_path": req.MergedTranscriptPath,
"output_path": req.OutputProcessedPath, "output_path": req.OutputProcessedPath,
@@ -103,11 +119,18 @@ func materializePlaceholders(req PolishRequest) error {
}); err != nil { }); err != nil {
return err return err
} }
if err := writeJSONIfRequested(req.ReportPath, map[string]any{ if !reports {
"schema": "audita.report.v1", return nil
"steps": []any{}, }
}); err != nil { for _, report := range []struct{ name, contents string }{
return err {"errors.yml", "schema: audita-errors\nversion: 1\nstatus: completed\nerrors: []\n"},
{"recoveries.yml", "schema: audita-recoveries\nversion: 1\nstatus: completed\nrecoveries: []\n"},
{"report.md", "# Audita report\n"},
} {
path := filepath.Join(reportDirectory(req), report.name)
if err := fileops.WriteFileAtomic(path, []byte(report.contents), fileops.WorkspaceFileMode); err != nil {
return fmt.Errorf("write report %q: %w", path, err)
}
} }
return nil return nil
} }

View File

@@ -0,0 +1,70 @@
package audita
import (
"context"
_ "embed"
"fmt"
"os"
"path/filepath"
"strings"
"time"
"gitea.maximumdirect.net/eric/narratio/internal/adapters/subprocess"
)
//go:embed synthetic-transcript.json
var syntheticTranscript []byte
// PreflightResult records the native invocation outcome.
type PreflightResult struct {
ExitCode int
Duration time.Duration
}
// Preflight checks actual processing settings with a synthetic transcript and native smoke checks.
func (r *SubprocessRunner) Preflight(ctx context.Context, req PolishRequest) (PreflightResult, error) {
if r == nil {
return PreflightResult{}, fmt.Errorf("audita subprocess runner is nil")
}
if strings.TrimSpace(req.OutputProcessedPath) == "" {
return PreflightResult{}, fmt.Errorf("audita output processed path is required")
}
for i, path := range req.GlossaryFiles {
if strings.TrimSpace(path) == "" {
return PreflightResult{}, fmt.Errorf("audita glossary file at index %d is empty", i)
}
}
dir, err := os.MkdirTemp("", "narratio-audita-preflight-")
if err != nil {
return PreflightResult{}, fmt.Errorf("create audita preflight directory: %w", err)
}
defer os.RemoveAll(dir)
req.MergedTranscriptPath = filepath.Join(dir, "transcript.json")
req.StdoutLogPath = filepath.Join(dir, "stdout.log")
req.StderrLogPath = filepath.Join(dir, "stderr.log")
req.GeneratedConfigPath = filepath.Join(dir, "invocation.yml")
if err := os.WriteFile(req.MergedTranscriptPath, syntheticTranscript, 0600); err != nil {
return PreflightResult{}, fmt.Errorf("write synthetic transcript: %w", err)
}
args := r.buildArgs("preflight", req)
env, names, err := subprocess.CredentialEnvironment(r.cfg.Credentials)
if err != nil {
return PreflightResult{}, fmt.Errorf("audita credentials: %w", err)
}
if err := r.writeInvocationConfig(req, args, names); err != nil {
return PreflightResult{}, fmt.Errorf("write preflight invocation: %w", err)
}
run := r.run
if run == nil {
run = subprocess.Run
}
out, err := run(ctx, subprocess.RunRequest{Executable: r.cfg.Binary, Args: args, Timeout: r.cfg.Timeout, EnvOverrides: env, SensitiveEnvNames: names, DiagnosticOwner: "audita preflight", StdoutLogPath: req.StdoutLogPath, StderrLogPath: req.StderrLogPath})
result := PreflightResult{ExitCode: out.ExitCode, Duration: out.Duration}
if err != nil {
return result, fmt.Errorf("audita preflight failed: %w", err)
}
if out.ExitCode != 0 {
return result, fmt.Errorf("audita preflight failed with exit code %d", out.ExitCode)
}
return result, nil
}

View File

@@ -0,0 +1,113 @@
package audita
import (
"context"
"encoding/json"
"errors"
"os"
"path/filepath"
"reflect"
"strings"
"testing"
"gitea.maximumdirect.net/eric/narratio/internal/adapters/subprocess"
configkit "go.maximumdirect.net/configkit"
)
func TestPreflightUsesNativeProcessingSettingsAndCleansTemporaryInputs(t *testing.T) {
key := auditaTestSecret(t, "NARRATIO_PREFLIGHT_TEST_KEY", "synthetic-secret")
runner := auditaTestRunner(t, SubprocessRunnerConfig{Credentials: []configkit.Secret{key}, Debug: true, ConfigPath: "config.yml", Overlay: "testing", ProposalProfile: "proposal", ValidationProfile: "validation", OutputSchema: "audita-v1"})
req := auditaTestRequest(t)
req.ReportDir = filepath.Join(t.TempDir(), "reports")
req.WorkDir = filepath.Join(t.TempDir(), "debug")
originalStdout := req.StdoutLogPath
if err := os.WriteFile(originalStdout, []byte("prior"), 0600); err != nil {
t.Fatal(err)
}
var captured subprocess.RunRequest
var tempDir string
runner.run = func(_ context.Context, r subprocess.RunRequest) (subprocess.RunResult, error) {
captured = r
tempDir = filepath.Dir(r.StdoutLogPath)
data, err := os.ReadFile(filepath.Join(tempDir, "transcript.json"))
if err != nil {
t.Fatal(err)
}
var transcript struct {
Segments []map[string]any `json:"segments"`
}
if err := json.Unmarshal(data, &transcript); err != nil || len(transcript.Segments) < 2 {
t.Fatalf("fixture: %s %v", data, err)
}
if r.StdoutLogPath == originalStdout || r.StderrLogPath == req.StderrLogPath {
t.Fatal("overwrote processing diagnostics")
}
if r.EnvOverrides["NARRATIO_PREFLIGHT_TEST_KEY"] != "synthetic-secret" || !reflect.DeepEqual(r.SensitiveEnvNames, []string{"NARRATIO_PREFLIGHT_TEST_KEY"}) {
t.Fatal("credential forwarding lost")
}
return subprocess.RunResult{}, nil
}
result, err := runner.Preflight(context.Background(), req)
if err != nil || result.ExitCode != 0 {
t.Fatalf("preflight: %+v %v", result, err)
}
args := runner.buildArgs("process", req)
if captured.Args[0] != "preflight" || !reflect.DeepEqual(captured.Args[2:], args[2:]) {
t.Fatalf("settings differ: %v vs %v", captured.Args, args)
}
if strings.Contains(strings.Join(captured.Args, " "), "--smoke=false") {
t.Fatal("smoke disabled")
}
if _, err := os.Stat(tempDir); !os.IsNotExist(err) {
t.Fatalf("temporary directory remains: %v", err)
}
prior, err := os.ReadFile(originalStdout)
if err != nil || string(prior) != "prior" {
t.Fatalf("prior diagnostics changed: %q %v", prior, err)
}
}
func TestPreflightPreservesFailureAndRedactsDiagnostics(t *testing.T) {
const name = "NARRATIO_PREFLIGHT_SECRET"
secret := auditaTestSecret(t, name, "synthetic-private-value")
binary := filepath.Join(t.TempDir(), "helper")
writeAuditaTestFile(t, binary, "#!/bin/sh\nprintf 'provider rejected %s\\n' \"$"+name+"\" >&2\nexit 2\n")
if err := os.Chmod(binary, 0700); err != nil {
t.Fatal(err)
}
runner := auditaTestRunner(t, SubprocessRunnerConfig{Binary: binary, Credentials: []configkit.Secret{secret}})
result, err := runner.Preflight(context.Background(), auditaTestRequest(t))
if err == nil || result.ExitCode != 2 || !strings.Contains(err.Error(), "provider rejected") || strings.Contains(err.Error(), "synthetic-private-value") {
t.Fatalf("failure: %+v %v", result, err)
}
}
func TestPreflightCancellationPreservesCause(t *testing.T) {
runner := auditaTestRunner(t, SubprocessRunnerConfig{})
runner.run = func(ctx context.Context, _ subprocess.RunRequest) (subprocess.RunResult, error) {
return subprocess.RunResult{Canceled: true}, ctx.Err()
}
ctx, cancel := context.WithCancel(context.Background())
cancel()
_, err := runner.Preflight(ctx, auditaTestRequest(t))
if !errors.Is(err, context.Canceled) {
t.Fatalf("cancellation: %v", err)
}
}
func TestPreflightCleansTemporaryFilesOnFailure(t *testing.T) {
runner := auditaTestRunner(t, SubprocessRunnerConfig{})
failure := errors.New("synthetic provider failure")
var tempDir string
runner.run = func(_ context.Context, r subprocess.RunRequest) (subprocess.RunResult, error) {
tempDir = filepath.Dir(r.StderrLogPath)
return subprocess.RunResult{ExitCode: 1}, failure
}
_, err := runner.Preflight(context.Background(), auditaTestRequest(t))
if !errors.Is(err, failure) {
t.Fatalf("cause lost: %v", err)
}
if _, err := os.Stat(tempDir); !os.IsNotExist(err) {
t.Fatalf("temporary directory remains: %v", err)
}
}

View File

@@ -11,24 +11,29 @@ type Runner interface {
Run(ctx context.Context, req PolishRequest) (PolishResult, error) Run(ctx context.Context, req PolishRequest) (PolishResult, error)
} }
// PolishRequest describes an audita invocation. // PolishRequest describes an Audita invocation.
type PolishRequest struct { type PolishRequest struct {
GeneratedConfigPath string GeneratedConfigPath string
MergedTranscriptPath string MergedTranscriptPath string
OutputProcessedPath string OutputProcessedPath string
GlossaryPath string GlossaryFiles []string
ReportPath string ReportDir string
WorkDir string WorkDir string
Modules []string
StdoutLogPath string StdoutLogPath string
StderrLogPath string StderrLogPath string
} }
// PolishResult describes a polish output. // ReportBundle contains optional reports in the requested report directory.
type ReportBundle struct {
ErrorsPath string
RecoveriesPath string
OverviewPath string
}
// PolishResult describes a polish output and available diagnostics.
type PolishResult struct { type PolishResult struct {
ProcessedTranscriptPath string ProcessedTranscriptPath string
ReportPath string Reports ReportBundle
WorkDir string
StdoutLogPath string StdoutLogPath string
StderrLogPath string StderrLogPath string
GeneratedConfigPath string GeneratedConfigPath string

View File

@@ -3,106 +3,42 @@ package audita
import ( import (
"context" "context"
"encoding/json" "encoding/json"
"errors"
"fmt" "fmt"
"net/url" "os"
"strconv" "path/filepath"
"strings" "strings"
"time" "time"
"gitea.maximumdirect.net/eric/narratio/internal/adapters/subprocess" "gitea.maximumdirect.net/eric/narratio/internal/adapters/subprocess"
"gitea.maximumdirect.net/eric/narratio/internal/fileops" "gitea.maximumdirect.net/eric/narratio/internal/fileops"
configkit "go.maximumdirect.net/configkit"
) )
// MaxProcessedOutputBytes bounds Audita's processed-transcript JSON result. // MaxProcessedOutputBytes bounds Audita's processed-transcript JSON result.
const MaxProcessedOutputBytes int64 = 64 * 1024 * 1024 const MaxProcessedOutputBytes int64 = 64 * 1024 * 1024
// MaxReportOutputBytes bounds Audita's optional report JSON result. // MaxReportOutputBytes bounds each optional Audita report.
const MaxReportOutputBytes int64 = 16 * 1024 * 1024 const MaxReportOutputBytes int64 = 16 * 1024 * 1024
// SubprocessRunnerConfig defines deterministic settings for Audita CLI execution. // SubprocessRunnerConfig defines deterministic settings for Audita CLI execution.
type SubprocessRunnerConfig struct { type SubprocessRunnerConfig struct {
Binary string Binary string
Timeout time.Duration Timeout time.Duration
LLMAPIKey string Credentials []configkit.Secret
LLMAPIKeyReference string Debug bool
Modules []string Overlay string
BaseURL string ProposalProfile string
Model string ValidationProfile string
TranscriptDescription string TranscriptDescription string
ConfigPath string ConfigPath string
OutputSchema string OutputSchema string
WorkDirRetention string
TotalLLMConcurrency *int
ProposalLLMConcurrency *int
ValidationModel string
ValidationLLMConcurrency *int
Report bool
} }
// SubprocessRunner invokes Audita via subprocess. // SubprocessRunner invokes Audita via subprocess.
type SubprocessRunner struct { type SubprocessRunner struct {
binary string cfg SubprocessRunnerConfig
timeout time.Duration run func(context.Context, subprocess.RunRequest) (subprocess.RunResult, error)
llmAPIKey string
llmAPIKeyReference string
modules []string
baseURL string
model string
transcriptDescription string
configPath string
outputSchema string
workDirRetention string
totalLLMConcurrency *int
proposalLLMConcurrency *int
validationModel string
validationLLMConcurrency *int
report bool
}
// NewSubprocessRunnerFromConfigValues parses config-derived values once.
func NewSubprocessRunnerFromConfigValues(
binary string,
timeout string,
llmAPIKey string,
llmAPIKeyReference string,
modules []string,
baseURL string,
model string,
transcriptDescription string,
configPath string,
outputSchema string,
workDirRetention string,
totalLLMConcurrency *int,
proposalLLMConcurrency *int,
validationModel string,
validationLLMConcurrency *int,
report bool,
) (*SubprocessRunner, error) {
if strings.TrimSpace(timeout) == "" {
return nil, fmt.Errorf("audita timeout is required")
}
parsedTimeout, err := time.ParseDuration(timeout)
if err != nil {
return nil, fmt.Errorf("parse audita timeout %q: %w", timeout, err)
}
return NewSubprocessRunner(SubprocessRunnerConfig{
Binary: binary,
Timeout: parsedTimeout,
LLMAPIKey: llmAPIKey,
LLMAPIKeyReference: llmAPIKeyReference,
Modules: modules,
BaseURL: baseURL,
Model: model,
TranscriptDescription: transcriptDescription,
ConfigPath: configPath,
OutputSchema: outputSchema,
WorkDirRetention: workDirRetention,
TotalLLMConcurrency: totalLLMConcurrency,
ProposalLLMConcurrency: proposalLLMConcurrency,
ValidationModel: validationModel,
ValidationLLMConcurrency: validationLLMConcurrency,
Report: report,
})
} }
// NewSubprocessRunner constructs a validated Audita subprocess runner. // NewSubprocessRunner constructs a validated Audita subprocess runner.
@@ -113,281 +49,160 @@ func NewSubprocessRunner(cfg SubprocessRunnerConfig) (*SubprocessRunner, error)
if cfg.Timeout <= 0 { if cfg.Timeout <= 0 {
return nil, fmt.Errorf("audita timeout must be > 0") return nil, fmt.Errorf("audita timeout must be > 0")
} }
if (cfg.LLMAPIKey == "") != (strings.TrimSpace(cfg.LLMAPIKeyReference) == "") {
return nil, fmt.Errorf("audita credential value and reference must be provided together")
}
for i, module := range cfg.Modules {
if strings.TrimSpace(module) == "" {
return nil, fmt.Errorf("audita module at index %d is empty", i)
}
}
if strings.TrimSpace(cfg.BaseURL) != "" {
u, err := url.Parse(cfg.BaseURL)
if err != nil || u.Scheme == "" || u.Host == "" {
if err != nil {
return nil, fmt.Errorf("audita base url %q is invalid: %w", cfg.BaseURL, err)
}
return nil, fmt.Errorf("audita base url %q is invalid", cfg.BaseURL)
}
}
if cfg.TotalLLMConcurrency != nil && *cfg.TotalLLMConcurrency <= 0 {
return nil, fmt.Errorf("audita total llm concurrency must be > 0 when provided")
}
if cfg.ProposalLLMConcurrency != nil && *cfg.ProposalLLMConcurrency <= 0 {
return nil, fmt.Errorf("audita proposal llm concurrency must be > 0 when provided")
}
if cfg.ValidationLLMConcurrency != nil && *cfg.ValidationLLMConcurrency <= 0 {
return nil, fmt.Errorf("audita validation llm concurrency must be > 0 when provided")
}
switch strings.TrimSpace(cfg.OutputSchema) { switch strings.TrimSpace(cfg.OutputSchema) {
case "", "bare-segments", "audita-v1": case "", "bare-segments", "audita-v1":
default: default:
return nil, fmt.Errorf("audita output schema must be one of: bare-segments, audita-v1") return nil, fmt.Errorf("audita output schema must be one of: bare-segments, audita-v1")
} }
switch strings.TrimSpace(cfg.WorkDirRetention) { cfg.Binary = strings.TrimSpace(cfg.Binary)
case "", "always", "auto", "never": cfg.Credentials = append([]configkit.Secret(nil), cfg.Credentials...)
default: return &SubprocessRunner{cfg: cfg, run: subprocess.Run}, nil
return nil, fmt.Errorf("audita work dir retention must be one of: always, auto, never")
}
modules := make([]string, len(cfg.Modules))
for i, m := range cfg.Modules {
modules[i] = strings.TrimSpace(m)
}
return &SubprocessRunner{
binary: strings.TrimSpace(cfg.Binary),
timeout: cfg.Timeout,
llmAPIKey: cfg.LLMAPIKey,
llmAPIKeyReference: strings.TrimSpace(cfg.LLMAPIKeyReference),
modules: modules,
baseURL: strings.TrimSpace(cfg.BaseURL),
model: strings.TrimSpace(cfg.Model),
transcriptDescription: strings.TrimSpace(cfg.TranscriptDescription),
configPath: strings.TrimSpace(cfg.ConfigPath),
outputSchema: strings.TrimSpace(cfg.OutputSchema),
workDirRetention: strings.TrimSpace(cfg.WorkDirRetention),
totalLLMConcurrency: cfg.TotalLLMConcurrency,
proposalLLMConcurrency: cfg.ProposalLLMConcurrency,
validationModel: strings.TrimSpace(cfg.ValidationModel),
validationLLMConcurrency: cfg.ValidationLLMConcurrency,
report: cfg.Report,
}, nil
} }
// Run executes Audita process with deterministic flags and validates output artifacts. // Run executes Audita process and validates its corrected transcript.
func (r *SubprocessRunner) Run(ctx context.Context, req PolishRequest) (PolishResult, error) { func (r *SubprocessRunner) Run(ctx context.Context, req PolishRequest) (PolishResult, error) {
if r == nil { if r == nil {
return PolishResult{}, fmt.Errorf("audita subprocess runner is nil") return PolishResult{}, fmt.Errorf("audita subprocess runner is nil")
} }
if strings.TrimSpace(req.MergedTranscriptPath) == "" { for _, field := range []struct{ name, value string }{
return PolishResult{}, fmt.Errorf("audita merged transcript path is required") {"merged transcript path", req.MergedTranscriptPath},
{"output processed path", req.OutputProcessedPath},
} {
if strings.TrimSpace(field.value) == "" {
return PolishResult{}, fmt.Errorf("audita %s is required", field.name)
}
} }
if strings.TrimSpace(req.GlossaryPath) == "" { for i, path := range req.GlossaryFiles {
return PolishResult{}, fmt.Errorf("audita glossary path is required") if strings.TrimSpace(path) == "" {
return PolishResult{}, fmt.Errorf("audita glossary file at index %d is empty", i)
}
} }
if strings.TrimSpace(req.OutputProcessedPath) == "" { args := r.buildArgs("process", req)
return PolishResult{}, fmt.Errorf("audita output processed path is required") env, names, err := subprocess.CredentialEnvironment(r.cfg.Credentials)
if err != nil {
return PolishResult{}, fmt.Errorf("audita credentials: %w", err)
} }
if strings.TrimSpace(req.WorkDir) == "" {
return PolishResult{}, fmt.Errorf("audita work dir is required")
}
if r.report && strings.TrimSpace(req.ReportPath) == "" {
return PolishResult{}, fmt.Errorf("audita report is enabled but report path is missing")
}
reqModules := req.Modules
if reqModules == nil {
reqModules = append([]string(nil), r.modules...)
}
args := r.buildArgs(req, reqModules)
credentialPresent := r.llmAPIKeyReference != ""
env := map[string]string{}
if credentialPresent {
env["AUDITA_LLM_API_KEY"] = r.llmAPIKey
}
if req.GeneratedConfigPath != "" { if req.GeneratedConfigPath != "" {
if err := r.writeInvocationConfig(req, args, reqModules, credentialPresent); err != nil { if err := r.writeInvocationConfig(req, args, names); err != nil {
return PolishResult{}, fmt.Errorf("write audita invocation config %q: %w", req.GeneratedConfigPath, err) return PolishResult{}, fmt.Errorf("write audita invocation config %q: %w", req.GeneratedConfigPath, err)
} }
} }
run := r.run
runRes, err := subprocess.Run(ctx, subprocess.RunRequest{ if run == nil {
Executable: r.binary, run = subprocess.Run
Args: args, }
Timeout: r.timeout, runRes, runErr := run(ctx, subprocess.RunRequest{
EnvOverrides: env, Executable: r.cfg.Binary, Args: args, Timeout: r.cfg.Timeout,
DiagnosticOwner: "audita", EnvOverrides: env, SensitiveEnvNames: names, DiagnosticOwner: "audita",
StdoutLogPath: req.StdoutLogPath, StdoutLogPath: req.StdoutLogPath, StderrLogPath: req.StderrLogPath,
StderrLogPath: req.StderrLogPath,
}) })
if err != nil { result := r.result(req, names, runRes)
wrappedMessage := fmt.Sprintf( if runErr != nil {
"run audita process (binary=%q, stdout_log=%q, stderr_log=%q)", result.Reports, _ = discoverReports(reportDirectory(req))
r.binary, return result, fmt.Errorf("run audita process (binary=%q, output_dir=%q, stdout_log=%q, stderr_log=%q): %w",
req.StdoutLogPath, r.cfg.Binary, filepath.Dir(req.OutputProcessedPath), req.StdoutLogPath, req.StderrLogPath, runErr)
req.StderrLogPath,
)
wrappedMessage = addSubprocessStreamHint(wrappedMessage, err)
return r.failureResult(req, reqModules, runRes, credentialPresent), fmt.Errorf(
"%s: %w",
wrappedMessage,
err,
)
} }
if err := validateProcessedOutput(req.OutputProcessedPath); err != nil { if err := validateProcessedOutput(req.OutputProcessedPath); err != nil {
return r.failureResult(req, reqModules, runRes, credentialPresent), fmt.Errorf("validate audita processed output %q: %w", req.OutputProcessedPath, err) result.Reports, _ = discoverReports(reportDirectory(req))
return result, fmt.Errorf("validate audita processed output %q: %w", req.OutputProcessedPath, err)
} }
if r.report { reports, err := discoverReports(reportDirectory(req))
if err := validateJSONFile(req.ReportPath); err != nil { if err != nil {
return r.failureResult(req, reqModules, runRes, credentialPresent), fmt.Errorf("validate audita report output %q: %w", req.ReportPath, err) return result, err
}
result.Reports = reports
return result, nil
}
func (r *SubprocessRunner) result(req PolishRequest, names []string, runRes subprocess.RunResult) PolishResult {
return PolishResult{
ProcessedTranscriptPath: req.OutputProcessedPath,
StdoutLogPath: req.StdoutLogPath, StderrLogPath: req.StderrLogPath,
GeneratedConfigPath: req.GeneratedConfigPath, ExitCode: runRes.ExitCode,
Duration: runRes.Duration, InvokedBinary: r.cfg.Binary,
Metadata: map[string]any{
"adapter": "audita_subprocess", "glossary_files": req.GlossaryFiles, "report_dir": req.ReportDir, "work_dir": req.WorkDir, "debug": r.cfg.Debug,
"overlay": r.cfg.Overlay, "proposal_profile": r.cfg.ProposalProfile,
"validation_profile": r.cfg.ValidationProfile,
"transcript_description": r.cfg.TranscriptDescription,
"config_path": r.cfg.ConfigPath, "output_schema": r.cfg.OutputSchema,
"credential_names": names,
},
}
}
func (r *SubprocessRunner) buildArgs(command string, req PolishRequest) []string {
args := []string{command, req.MergedTranscriptPath, "--output", req.OutputProcessedPath}
for _, path := range req.GlossaryFiles {
args = append(args, "--glossary-file", path)
}
for _, setting := range []struct{ flag, value string }{
{"--config", r.cfg.ConfigPath}, {"--overlay", r.cfg.Overlay},
{"--proposal-profile", r.cfg.ProposalProfile}, {"--validation-profile", r.cfg.ValidationProfile},
{"--transcript-description", r.cfg.TranscriptDescription}, {"--output-schema", r.cfg.OutputSchema},
{"--report-dir", req.ReportDir}, {"--work-dir", req.WorkDir},
} {
if setting.value != "" {
args = append(args, setting.flag, setting.value)
} }
} }
if r.cfg.Debug {
return PolishResult{ args = append(args, "--debug")
ProcessedTranscriptPath: req.OutputProcessedPath,
ReportPath: req.ReportPath,
WorkDir: req.WorkDir,
StdoutLogPath: req.StdoutLogPath,
StderrLogPath: req.StderrLogPath,
GeneratedConfigPath: req.GeneratedConfigPath,
ExitCode: runRes.ExitCode,
Duration: runRes.Duration,
InvokedBinary: r.binary,
Metadata: map[string]any{
"adapter": "audita_subprocess",
"modules": reqModules,
"base_url": r.baseURL,
"model": r.model,
"transcript_description": r.transcriptDescription,
"config_path": r.configPath,
"output_schema": r.outputSchema,
"work_dir_retention": r.workDirRetention,
"validation_model": r.validationModel,
"total_llm_concurrency": r.totalLLMConcurrency,
"proposal_llm_concurrency": r.proposalLLMConcurrency,
"validation_llm_concurrency": r.validationLLMConcurrency,
"credential_env_var": r.llmAPIKeyReference,
"credential_present": credentialPresent,
},
}, nil
}
func (r *SubprocessRunner) failureResult(req PolishRequest, modules []string, runRes subprocess.RunResult, credentialPresent bool) PolishResult {
return PolishResult{
ProcessedTranscriptPath: req.OutputProcessedPath,
ReportPath: req.ReportPath,
WorkDir: req.WorkDir,
StdoutLogPath: req.StdoutLogPath,
StderrLogPath: req.StderrLogPath,
GeneratedConfigPath: req.GeneratedConfigPath,
ExitCode: runRes.ExitCode,
Duration: runRes.Duration,
InvokedBinary: r.binary,
Metadata: map[string]any{
"adapter": "audita_subprocess",
"modules": modules,
"base_url": r.baseURL,
"model": r.model,
"transcript_description": r.transcriptDescription,
"config_path": r.configPath,
"output_schema": r.outputSchema,
"work_dir_retention": r.workDirRetention,
"validation_model": r.validationModel,
"total_llm_concurrency": r.totalLLMConcurrency,
"proposal_llm_concurrency": r.proposalLLMConcurrency,
"validation_llm_concurrency": r.validationLLMConcurrency,
"credential_env_var": r.llmAPIKeyReference,
"credential_present": credentialPresent,
},
}
}
func (r *SubprocessRunner) buildArgs(req PolishRequest, modules []string) []string {
args := []string{
"process",
req.MergedTranscriptPath,
"--glossary", req.GlossaryPath,
"--output", req.OutputProcessedPath,
"--work-dir", req.WorkDir,
}
if r.baseURL != "" {
args = append(args, "--base-url", r.baseURL)
}
if r.model != "" {
args = append(args, "--model", r.model)
}
if len(modules) > 0 {
args = append(args, "--modules", strings.Join(modules, ","))
}
if r.report {
args = append(args, "--report-json", req.ReportPath)
}
if r.transcriptDescription != "" {
args = append(args, "--transcript-description", r.transcriptDescription)
}
if r.configPath != "" {
args = append(args, "--config", r.configPath)
}
if r.outputSchema != "" {
args = append(args, "--output-schema", r.outputSchema)
}
if r.workDirRetention != "" {
args = append(args, "--work-dir-retention", r.workDirRetention)
}
if r.totalLLMConcurrency != nil {
args = append(args, "--total-llm-concurrency", strconv.Itoa(*r.totalLLMConcurrency))
}
if r.proposalLLMConcurrency != nil {
args = append(args, "--proposal-llm-concurrency", strconv.Itoa(*r.proposalLLMConcurrency))
}
if r.validationModel != "" {
args = append(args, "--validation-model", r.validationModel)
}
if r.validationLLMConcurrency != nil {
args = append(args, "--validation-llm-concurrency", strconv.Itoa(*r.validationLLMConcurrency))
} }
return args return args
} }
func (r *SubprocessRunner) writeInvocationConfig(req PolishRequest, args []string, modules []string, credentialPresent bool) error { func (r *SubprocessRunner) writeInvocationConfig(req PolishRequest, args, names []string) error {
payload := map[string]any{ return writeGeneratedYAML(req.GeneratedConfigPath, map[string]any{
"schema": "audita.generated.v1", "schema": "audita.generated.v3", "binary": r.cfg.Binary, "args": args, "timeout": r.cfg.Timeout.String(),
"binary": r.binary, "glossary_files": req.GlossaryFiles, "report_dir": req.ReportDir, "work_dir": req.WorkDir, "debug": r.cfg.Debug,
"args": args, "overlay": r.cfg.Overlay, "proposal_profile": r.cfg.ProposalProfile, "validation_profile": r.cfg.ValidationProfile,
"timeout": r.timeout.String(), "transcript_description": r.cfg.TranscriptDescription, "config_path": r.cfg.ConfigPath, "output_schema": r.cfg.OutputSchema,
"modules": modules, "merged_transcript_path": req.MergedTranscriptPath, "output_path": req.OutputProcessedPath, "credential_names": names,
"base_url": r.baseURL, })
"model": r.model, }
"transcript_description": r.transcriptDescription,
"config_path": r.configPath, func reportDirectory(req PolishRequest) string {
"output_schema": r.outputSchema, if req.ReportDir != "" {
"work_dir_retention": r.workDirRetention, return req.ReportDir
"validation_model": r.validationModel,
"total_llm_concurrency": r.totalLLMConcurrency,
"proposal_llm_concurrency": r.proposalLLMConcurrency,
"validation_llm_concurrency": r.validationLLMConcurrency,
"report_enabled": r.report,
"merged_transcript_path": req.MergedTranscriptPath,
"glossary_path": req.GlossaryPath,
"output_path": req.OutputProcessedPath,
"report_path": req.ReportPath,
"work_dir": req.WorkDir,
"credential_env_var": r.llmAPIKeyReference,
"credential_present": credentialPresent,
} }
return writeGeneratedYAML(req.GeneratedConfigPath, payload) return filepath.Dir(req.OutputProcessedPath)
}
func discoverReports(reportDir string) (ReportBundle, error) {
var reports ReportBundle
for _, report := range []struct {
name string
dest *string
}{
{"errors.yml", &reports.ErrorsPath},
{"recoveries.yml", &reports.RecoveriesPath},
{"report.md", &reports.OverviewPath},
} {
path := filepath.Join(reportDir, report.name)
info, err := os.Lstat(path)
if errors.Is(err, os.ErrNotExist) {
continue
}
if err != nil {
return reports, fmt.Errorf("inspect audita report %q: %w", path, err)
}
if !info.Mode().IsRegular() {
return reports, fmt.Errorf("audita report %q is not a regular file", path)
}
if err := fileops.CheckFileBounded(path, MaxReportOutputBytes); err != nil {
return reports, fmt.Errorf("audita report %q exceeds or cannot be read within %d-byte limit: %w", path, MaxReportOutputBytes, err)
}
*report.dest = path
}
return reports, nil
} }
func validateProcessedOutput(path string) error { func validateProcessedOutput(path string) error {
data, err := readAuditaResult(path, MaxProcessedOutputBytes, "processed transcript") data, err := fileops.ReadFileBounded(path, MaxProcessedOutputBytes)
if err != nil { if err != nil {
return err return fmt.Errorf("audita processed transcript result exceeds or cannot be read within %d-byte limit: %w", MaxProcessedOutputBytes, err)
} }
var payload map[string]any var payload map[string]any
if err := json.Unmarshal(data, &payload); err != nil { if err := json.Unmarshal(data, &payload); err != nil {
return fmt.Errorf("parse json: %w", err) return fmt.Errorf("parse json: %w", err)
@@ -401,34 +216,3 @@ func validateProcessedOutput(path string) error {
} }
return nil return nil
} }
func addSubprocessStreamHint(message string, runErr error) string {
if runErr == nil {
return message
}
lower := strings.ToLower(runErr.Error())
if strings.Contains(lower, "bad file descriptor") || strings.Contains(lower, "exit code 120") {
return message + "; hint=audita child process may have started with invalid stderr/stdout descriptors"
}
return message
}
func validateJSONFile(path string) error {
data, err := readAuditaResult(path, MaxReportOutputBytes, "report")
if err != nil {
return err
}
var v any
if err := json.Unmarshal(data, &v); err != nil {
return fmt.Errorf("parse json: %w", err)
}
return nil
}
func readAuditaResult(path string, limit int64, category string) ([]byte, error) {
data, err := fileops.ReadFileBounded(path, limit)
if err != nil {
return nil, fmt.Errorf("audita %s result exceeds or cannot be read within %d-byte limit: %w", category, limit, err)
}
return data, nil
}

View File

@@ -2,630 +2,257 @@ package audita
import ( import (
"context" "context"
"encoding/json" "errors"
"fmt"
"os" "os"
"path/filepath" "path/filepath"
"reflect"
"strings" "strings"
"testing" "testing"
"time" "time"
"gitea.maximumdirect.net/eric/narratio/internal/adapters/subprocess"
configkit "go.maximumdirect.net/configkit"
) )
func TestSubprocessRunnerSuccessArgsEnvAndValidation(t *testing.T) { func auditaTestRequest(t *testing.T) PolishRequest {
t.Setenv("GO_WANT_AUDITA_HELPER", "1")
t.Setenv("AUDITA_HELPER_MODE", "success")
t.Setenv("OPENAI_KEY_SOURCE", "super-secret")
recordPath := filepath.Join(t.TempDir(), "record.json")
t.Setenv("AUDITA_HELPER_RECORD_PATH", recordPath)
wrapper := writeAuditaHelperWrapper(t)
totalLLMConcurrency := 3
proposalLLMConcurrency := 2
validationLLMConcurrency := 2
runner, err := NewSubprocessRunner(SubprocessRunnerConfig{
Binary: wrapper,
Timeout: mustParseAuditaDuration(t, "2s"),
LLMAPIKey: "super-secret",
LLMAPIKeyReference: "OPENAI_KEY_SOURCE",
Modules: []string{"glossary", "homophones", "glossary"},
BaseURL: "https://openrouter.ai/api/v1",
Model: "openrouter/google/gemma-4-31b-it",
TranscriptDescription: "Campaign Session 42",
ConfigPath: "/etc/audita/config.yml",
OutputSchema: "audita-v1",
WorkDirRetention: "auto",
TotalLLMConcurrency: &totalLLMConcurrency,
ProposalLLMConcurrency: &proposalLLMConcurrency,
ValidationModel: "openrouter/google/gemma-4-31b-it",
ValidationLLMConcurrency: &validationLLMConcurrency,
Report: true,
})
if err != nil {
t.Fatalf("NewSubprocessRunner() error = %v", err)
}
t.Setenv("OPENAI_KEY_SOURCE", "changed-after-resolution")
dir := t.TempDir()
req := PolishRequest{
GeneratedConfigPath: filepath.Join(dir, "audita.generated.yml"),
MergedTranscriptPath: filepath.Join(dir, "base.json"),
GlossaryPath: filepath.Join(dir, "glossary.yml"),
OutputProcessedPath: filepath.Join(dir, "polished.json"),
ReportPath: filepath.Join(dir, "audita.report.json"),
WorkDir: filepath.Join(dir, "artifacts", "audita-work"),
StdoutLogPath: filepath.Join(dir, "audita.stdout.log"),
StderrLogPath: filepath.Join(dir, "audita.stderr.log"),
}
writeAuditaTestFile(t, req.MergedTranscriptPath, `{"segments":[]}`)
writeAuditaTestFile(t, req.GlossaryPath, "terms: []\n")
res, err := runner.Run(context.Background(), req)
if err != nil {
t.Fatalf("Run() error = %v", err)
}
if res.ProcessedTranscriptPath != req.OutputProcessedPath {
t.Fatalf("ProcessedTranscriptPath = %q, want %q", res.ProcessedTranscriptPath, req.OutputProcessedPath)
}
if res.ReportPath != req.ReportPath {
t.Fatalf("ReportPath = %q, want %q", res.ReportPath, req.ReportPath)
}
if res.WorkDir != req.WorkDir {
t.Fatalf("WorkDir = %q, want %q", res.WorkDir, req.WorkDir)
}
if res.InvokedBinary != wrapper {
t.Fatalf("InvokedBinary = %q, want %q", res.InvokedBinary, wrapper)
}
if res.ExitCode != 0 {
t.Fatalf("ExitCode = %d, want 0", res.ExitCode)
}
if res.Duration <= 0 {
t.Fatalf("Duration = %s, want > 0", res.Duration)
}
assertJSONFileAudita(t, req.OutputProcessedPath)
assertJSONFileAudita(t, req.ReportPath)
if _, err := os.Stat(req.StdoutLogPath); err != nil {
t.Fatalf("stdout log missing: %v", err)
}
if _, err := os.Stat(req.StderrLogPath); err != nil {
t.Fatalf("stderr log missing: %v", err)
}
rec := readAuditaHelperRecord(t, recordPath)
wantArgs := []string{
"process", req.MergedTranscriptPath,
"--glossary", req.GlossaryPath,
"--output", req.OutputProcessedPath,
"--work-dir", req.WorkDir,
"--base-url", "https://openrouter.ai/api/v1",
"--model", "openrouter/google/gemma-4-31b-it",
"--modules", "glossary,homophones,glossary",
"--report-json", req.ReportPath,
"--transcript-description", "Campaign Session 42",
"--config", "/etc/audita/config.yml",
"--output-schema", "audita-v1",
"--work-dir-retention", "auto",
"--total-llm-concurrency", "3",
"--proposal-llm-concurrency", "2",
"--validation-model", "openrouter/google/gemma-4-31b-it",
"--validation-llm-concurrency", "2",
}
if strings.Join(rec.Args, "\n") != strings.Join(wantArgs, "\n") {
t.Fatalf("args = %#v, want %#v", rec.Args, wantArgs)
}
if rec.Env["AUDITA_LLM_API_KEY"] != "super-secret" {
t.Fatalf("AUDITA_LLM_API_KEY = %q, want propagated secret", rec.Env["AUDITA_LLM_API_KEY"])
}
if rec.Env["AUDITA_LLM_CONCURRENCY"] != "" {
t.Fatalf("AUDITA_LLM_CONCURRENCY = %q, want empty/omitted", rec.Env["AUDITA_LLM_CONCURRENCY"])
}
cfgData, err := os.ReadFile(req.GeneratedConfigPath)
if err != nil {
t.Fatalf("read generated config: %v", err)
}
if strings.Contains(string(cfgData), "super-secret") {
t.Fatalf("generated config must not contain credential value")
}
}
func TestSubprocessRunnerRejectsIncompleteResolvedCredential(t *testing.T) {
_, err := NewSubprocessRunner(SubprocessRunnerConfig{
Binary: writeAuditaHelperWrapper(t),
Timeout: mustParseAuditaDuration(t, "2s"),
LLMAPIKeyReference: "MISSING_AUDITA_KEY",
})
if err == nil || !strings.Contains(err.Error(), "credential value and reference must be provided together") {
t.Fatalf("NewSubprocessRunner() error = %v, want credential pair error", err)
}
}
func TestSubprocessRunnerUnconfiguredCredentialEnvOmitsCredential(t *testing.T) {
t.Setenv("GO_WANT_AUDITA_HELPER", "1")
t.Setenv("AUDITA_HELPER_MODE", "success")
recordPath := filepath.Join(t.TempDir(), "record.json")
t.Setenv("AUDITA_HELPER_RECORD_PATH", recordPath)
runner := mustAuditaRunner(t, SubprocessRunnerConfig{
Binary: writeAuditaHelperWrapper(t),
Timeout: mustParseAuditaDuration(t, "2s"),
LLMAPIKey: "",
Modules: []string{"glossary"},
BaseURL: "https://openrouter.ai/api/v1",
Model: "openrouter/google/gemma-4-31b-it",
Report: false,
})
req := auditaReqForTest(t, false)
res, err := runner.Run(context.Background(), req)
if err != nil {
t.Fatalf("Run() error = %v", err)
}
if res.Metadata["credential_present"] != false {
t.Fatalf("credential_present = %#v, want false", res.Metadata["credential_present"])
}
rec := readAuditaHelperRecord(t, recordPath)
if rec.Env["AUDITA_LLM_API_KEY"] != "" {
t.Fatalf("AUDITA_LLM_API_KEY = %q, want omitted/empty", rec.Env["AUDITA_LLM_API_KEY"])
}
}
func TestSubprocessRunnerOmitsUnspecifiedParentEnvironment(t *testing.T) {
t.Setenv("GO_WANT_AUDITA_HELPER", "1")
t.Setenv("AUDITA_HELPER_MODE", "success")
t.Setenv("AUDITA_INHERITED_MARKER", "inherited-from-parent")
recordPath := filepath.Join(t.TempDir(), "record.json")
t.Setenv("AUDITA_HELPER_RECORD_PATH", recordPath)
runner := mustAuditaRunner(t, SubprocessRunnerConfig{
Binary: writeAuditaHelperWrapper(t),
Timeout: mustParseAuditaDuration(t, "2s"),
Modules: []string{"glossary"},
BaseURL: "https://openrouter.ai/api/v1",
Model: "openrouter/google/gemma-4-31b-it",
Report: false,
LLMAPIKey: "",
})
req := auditaReqForTest(t, false)
if _, err := runner.Run(context.Background(), req); err != nil {
t.Fatalf("Run() error = %v", err)
}
rec := readAuditaHelperRecord(t, recordPath)
if rec.Env["AUDITA_INHERITED_MARKER"] != "" {
t.Fatalf("AUDITA_INHERITED_MARKER = %q, want omitted from the child environment", rec.Env["AUDITA_INHERITED_MARKER"])
}
}
func TestSubprocessRunnerOmitsModulesFlagWhenNotConfigured(t *testing.T) {
t.Setenv("GO_WANT_AUDITA_HELPER", "1")
t.Setenv("AUDITA_HELPER_MODE", "success")
recordPath := filepath.Join(t.TempDir(), "record.json")
t.Setenv("AUDITA_HELPER_RECORD_PATH", recordPath)
runner := mustAuditaRunner(t, SubprocessRunnerConfig{
Binary: writeAuditaHelperWrapper(t),
Timeout: mustParseAuditaDuration(t, "2s"),
LLMAPIKey: "",
BaseURL: "https://openrouter.ai/api/v1",
Model: "openrouter/google/gemma-4-31b-it",
Report: false,
})
req := auditaReqForTest(t, false)
if _, err := runner.Run(context.Background(), req); err != nil {
t.Fatalf("Run() error = %v", err)
}
rec := readAuditaHelperRecord(t, recordPath)
for i := 0; i < len(rec.Args); i++ {
if rec.Args[i] == "--modules" {
t.Fatalf("args contained --modules unexpectedly: %#v", rec.Args)
}
}
}
func TestSubprocessRunnerOmitsBaseURLAndModelFlagsWhenNotConfigured(t *testing.T) {
t.Setenv("GO_WANT_AUDITA_HELPER", "1")
t.Setenv("AUDITA_HELPER_MODE", "success")
recordPath := filepath.Join(t.TempDir(), "record.json")
t.Setenv("AUDITA_HELPER_RECORD_PATH", recordPath)
runner := mustAuditaRunner(t, SubprocessRunnerConfig{
Binary: writeAuditaHelperWrapper(t),
Timeout: mustParseAuditaDuration(t, "2s"),
LLMAPIKey: "",
Report: false,
})
req := auditaReqForTest(t, false)
if _, err := runner.Run(context.Background(), req); err != nil {
t.Fatalf("Run() error = %v", err)
}
rec := readAuditaHelperRecord(t, recordPath)
for i := 0; i < len(rec.Args); i++ {
if rec.Args[i] == "--base-url" {
t.Fatalf("args contained --base-url unexpectedly: %#v", rec.Args)
}
if rec.Args[i] == "--model" {
t.Fatalf("args contained --model unexpectedly: %#v", rec.Args)
}
}
}
func TestSubprocessRunnerSubprocessFailure(t *testing.T) {
t.Setenv("GO_WANT_AUDITA_HELPER", "1")
t.Setenv("AUDITA_HELPER_MODE", "fail")
t.Setenv("OPENAI_KEY_SOURCE", "super-secret")
t.Setenv("AUDITA_HELPER_RECORD_PATH", filepath.Join(t.TempDir(), "record.json"))
runner := mustAuditaRunner(t, SubprocessRunnerConfig{
Binary: writeAuditaHelperWrapper(t),
Timeout: mustParseAuditaDuration(t, "2s"),
LLMAPIKey: "super-secret",
LLMAPIKeyReference: "OPENAI_KEY_SOURCE",
Modules: []string{"glossary"},
BaseURL: "https://openrouter.ai/api/v1",
Model: "openrouter/google/gemma-4-31b-it",
Report: true,
})
req := auditaReqForTest(t, true)
_, err := runner.Run(context.Background(), req)
if err == nil {
t.Fatal("expected error, got nil")
}
if !strings.Contains(err.Error(), "run audita process") {
t.Fatalf("error = %q, want subprocess context", err.Error())
}
if !strings.Contains(err.Error(), "exit code") {
t.Fatalf("error = %q, want exit code context", err.Error())
}
if !strings.Contains(err.Error(), req.StdoutLogPath) || !strings.Contains(err.Error(), req.StderrLogPath) {
t.Fatalf("error = %q, want stdout/stderr log paths", err.Error())
}
if strings.Contains(err.Error(), "super-secret") {
t.Fatalf("failure diagnostic exposed credential value: %q", err.Error())
}
}
func TestSubprocessRunnerSubprocessFailureAddsStderrDescriptorHint(t *testing.T) {
t.Setenv("GO_WANT_AUDITA_HELPER", "1")
t.Setenv("AUDITA_HELPER_MODE", "fail_bad_fd")
t.Setenv("OPENAI_KEY_SOURCE", "super-secret")
t.Setenv("AUDITA_HELPER_RECORD_PATH", filepath.Join(t.TempDir(), "record.json"))
runner := mustAuditaRunner(t, SubprocessRunnerConfig{
Binary: writeAuditaHelperWrapper(t),
Timeout: mustParseAuditaDuration(t, "2s"),
LLMAPIKey: "super-secret",
LLMAPIKeyReference: "OPENAI_KEY_SOURCE",
Modules: []string{"glossary"},
BaseURL: "https://openrouter.ai/api/v1",
Model: "openrouter/google/gemma-4-31b-it",
Report: true,
})
req := auditaReqForTest(t, true)
_, err := runner.Run(context.Background(), req)
if err == nil {
t.Fatal("expected error, got nil")
}
if !strings.Contains(err.Error(), "hint=audita child process may have started with invalid stderr/stdout descriptors") {
t.Fatalf("error = %q, want stderr descriptor hint", err.Error())
}
}
func TestSubprocessRunnerMissingOutputFails(t *testing.T) {
t.Setenv("GO_WANT_AUDITA_HELPER", "1")
t.Setenv("AUDITA_HELPER_MODE", "missing_output")
t.Setenv("OPENAI_KEY_SOURCE", "super-secret")
t.Setenv("AUDITA_HELPER_RECORD_PATH", filepath.Join(t.TempDir(), "record.json"))
runner := mustAuditaRunner(t, SubprocessRunnerConfig{
Binary: writeAuditaHelperWrapper(t),
Timeout: mustParseAuditaDuration(t, "2s"),
LLMAPIKey: "super-secret",
LLMAPIKeyReference: "OPENAI_KEY_SOURCE",
Modules: []string{"glossary"},
BaseURL: "https://openrouter.ai/api/v1",
Model: "openrouter/google/gemma-4-31b-it",
Report: false,
})
req := auditaReqForTest(t, false)
_, err := runner.Run(context.Background(), req)
if err == nil {
t.Fatal("expected error, got nil")
}
if !strings.Contains(err.Error(), "validate audita processed output") {
t.Fatalf("error = %q, want output validation context", err.Error())
}
}
func TestSubprocessRunnerInvalidOutputJSONFails(t *testing.T) {
t.Setenv("GO_WANT_AUDITA_HELPER", "1")
t.Setenv("AUDITA_HELPER_MODE", "invalid_output")
t.Setenv("OPENAI_KEY_SOURCE", "super-secret")
t.Setenv("AUDITA_HELPER_RECORD_PATH", filepath.Join(t.TempDir(), "record.json"))
runner := mustAuditaRunner(t, SubprocessRunnerConfig{
Binary: writeAuditaHelperWrapper(t),
Timeout: mustParseAuditaDuration(t, "2s"),
LLMAPIKey: "super-secret",
LLMAPIKeyReference: "OPENAI_KEY_SOURCE",
Modules: []string{"glossary"},
BaseURL: "https://openrouter.ai/api/v1",
Model: "openrouter/google/gemma-4-31b-it",
Report: false,
})
req := auditaReqForTest(t, false)
_, err := runner.Run(context.Background(), req)
if err == nil {
t.Fatal("expected error, got nil")
}
if !strings.Contains(err.Error(), "parse json") {
t.Fatalf("error = %q, want parse json context", err.Error())
}
}
func TestSubprocessRunnerSegmentsMissingFails(t *testing.T) {
t.Setenv("GO_WANT_AUDITA_HELPER", "1")
t.Setenv("AUDITA_HELPER_MODE", "segments_missing")
t.Setenv("OPENAI_KEY_SOURCE", "super-secret")
t.Setenv("AUDITA_HELPER_RECORD_PATH", filepath.Join(t.TempDir(), "record.json"))
runner := mustAuditaRunner(t, SubprocessRunnerConfig{
Binary: writeAuditaHelperWrapper(t),
Timeout: mustParseAuditaDuration(t, "2s"),
LLMAPIKey: "super-secret",
LLMAPIKeyReference: "OPENAI_KEY_SOURCE",
Modules: []string{"glossary"},
BaseURL: "https://openrouter.ai/api/v1",
Model: "openrouter/google/gemma-4-31b-it",
Report: false,
})
req := auditaReqForTest(t, false)
_, err := runner.Run(context.Background(), req)
if err == nil {
t.Fatal("expected error, got nil")
}
if !strings.Contains(err.Error(), "segments") {
t.Fatalf("error = %q, want segments validation context", err.Error())
}
}
func TestSubprocessRunnerInvalidReportJSONFails(t *testing.T) {
t.Setenv("GO_WANT_AUDITA_HELPER", "1")
t.Setenv("AUDITA_HELPER_MODE", "invalid_report")
t.Setenv("OPENAI_KEY_SOURCE", "super-secret")
t.Setenv("AUDITA_HELPER_RECORD_PATH", filepath.Join(t.TempDir(), "record.json"))
runner := mustAuditaRunner(t, SubprocessRunnerConfig{
Binary: writeAuditaHelperWrapper(t),
Timeout: mustParseAuditaDuration(t, "2s"),
LLMAPIKey: "super-secret",
LLMAPIKeyReference: "OPENAI_KEY_SOURCE",
Modules: []string{"glossary"},
BaseURL: "https://openrouter.ai/api/v1",
Model: "openrouter/google/gemma-4-31b-it",
Report: true,
})
req := auditaReqForTest(t, true)
_, err := runner.Run(context.Background(), req)
if err == nil {
t.Fatal("expected error, got nil")
}
if !strings.Contains(err.Error(), "validate audita report output") {
t.Fatalf("error = %q, want report validation context", err.Error())
}
}
func TestSubprocessRunnerConstructorValidation(t *testing.T) {
_, err := NewSubprocessRunnerFromConfigValues("", "3h", "synthetic-secret", "AUDITA_LLM_API_KEY", []string{"glossary"}, "https://openrouter.ai/api/v1", "openrouter/google/gemma-4-31b-it", "", "", "", "", nil, nil, "", nil, true)
if err == nil {
t.Fatal("expected binary validation error")
}
_, err = NewSubprocessRunnerFromConfigValues("audita", "bad", "synthetic-secret", "AUDITA_LLM_API_KEY", []string{"glossary"}, "https://openrouter.ai/api/v1", "openrouter/google/gemma-4-31b-it", "", "", "", "", nil, nil, "", nil, true)
if err == nil {
t.Fatal("expected timeout parse error")
}
_, err = NewSubprocessRunner(SubprocessRunnerConfig{
Binary: "audita",
Timeout: mustParseAuditaDuration(t, "1s"),
LLMAPIKey: "synthetic-secret",
LLMAPIKeyReference: "AUDITA_LLM_API_KEY",
Modules: []string{"glossary"},
BaseURL: "://",
Model: "openrouter/google/gemma-4-31b-it",
})
if err == nil {
t.Fatal("expected base url validation error")
}
}
type auditaHelperRecord struct {
Args []string `json:"args"`
Env map[string]string `json:"env"`
}
func TestAuditaSubprocessHelper(t *testing.T) {
if os.Getenv("GO_WANT_AUDITA_HELPER") != "1" {
return
}
args := os.Args
start := -1
for i := range args {
if args[i] == "--" {
start = i + 1
break
}
}
if start < 0 || start >= len(args) {
_, _ = os.Stderr.WriteString("missing -- args separator\n")
os.Exit(2)
}
procArgs := args[start:]
outPath := auditaFlagValue(procArgs, "--output")
reportPath := auditaFlagValue(procArgs, "--report-json")
recordPath := os.Getenv("AUDITA_HELPER_RECORD_PATH")
if strings.TrimSpace(recordPath) != "" {
rec := auditaHelperRecord{
Args: procArgs,
Env: map[string]string{
"AUDITA_LLM_API_KEY": os.Getenv("AUDITA_LLM_API_KEY"),
"AUDITA_LLM_CONCURRENCY": os.Getenv("AUDITA_LLM_CONCURRENCY"),
"AUDITA_INHERITED_MARKER": os.Getenv("AUDITA_INHERITED_MARKER"),
},
}
data, _ := json.Marshal(rec)
_ = os.MkdirAll(filepath.Dir(recordPath), 0o755)
_ = os.WriteFile(recordPath, data, 0o644)
}
mode := os.Getenv("AUDITA_HELPER_MODE")
switch mode {
case "success":
writeAuditaHelperFile(outPath, `{"schema":"audita.processed.v1","segments":[]}`)
if reportPath != "" {
writeAuditaHelperFile(reportPath, `{"schema":"audita.report.v1","steps":[]}`)
}
_, _ = os.Stdout.WriteString("audita helper success stdout\n")
_, _ = os.Stderr.WriteString("audita helper success stderr\n")
os.Exit(0)
case "fail":
_, _ = os.Stderr.WriteString("audita helper failure\n")
os.Exit(8)
case "fail_bad_fd":
_, _ = os.Stderr.WriteString("OSError: [Errno 9] Bad file descriptor\n")
os.Exit(120)
case "missing_output":
if reportPath != "" {
writeAuditaHelperFile(reportPath, `{"schema":"audita.report.v1","steps":[]}`)
}
os.Exit(0)
case "invalid_output":
writeAuditaHelperFile(outPath, `not-json`)
if reportPath != "" {
writeAuditaHelperFile(reportPath, `{"schema":"audita.report.v1","steps":[]}`)
}
os.Exit(0)
case "segments_missing":
writeAuditaHelperFile(outPath, `{"schema":"audita.processed.v1"}`)
if reportPath != "" {
writeAuditaHelperFile(reportPath, `{"schema":"audita.report.v1","steps":[]}`)
}
os.Exit(0)
case "invalid_report":
writeAuditaHelperFile(outPath, `{"schema":"audita.processed.v1","segments":[]}`)
if reportPath != "" {
writeAuditaHelperFile(reportPath, `not-json`)
}
os.Exit(0)
default:
_, _ = os.Stderr.WriteString(fmt.Sprintf("unknown helper mode %q\n", mode))
os.Exit(2)
}
}
func mustAuditaRunner(t *testing.T, cfg SubprocessRunnerConfig) *SubprocessRunner {
t.Helper()
r, err := NewSubprocessRunner(cfg)
if err != nil {
t.Fatalf("NewSubprocessRunner() error = %v", err)
}
return r
}
func auditaReqForTest(t *testing.T, withReport bool) PolishRequest {
t.Helper() t.Helper()
dir := t.TempDir() dir := t.TempDir()
merged := filepath.Join(dir, "base.json") return PolishRequest{
glossary := filepath.Join(dir, "glossary.yml") MergedTranscriptPath: filepath.Join(dir, "merged.json"),
writeAuditaTestFile(t, merged, `{"segments":[]}`) GlossaryFiles: []string{filepath.Join(dir, "party.yml"), filepath.Join(dir, "campaign terms.yml")},
writeAuditaTestFile(t, glossary, "terms: []\n")
req := PolishRequest{
GeneratedConfigPath: filepath.Join(dir, "audita.generated.yml"),
MergedTranscriptPath: merged,
GlossaryPath: glossary,
OutputProcessedPath: filepath.Join(dir, "polished.json"), OutputProcessedPath: filepath.Join(dir, "polished.json"),
WorkDir: filepath.Join(dir, "artifacts", "audita-work"), GeneratedConfigPath: filepath.Join(dir, "audita.generated.yml"),
StdoutLogPath: filepath.Join(dir, "audita.stdout.log"), StdoutLogPath: filepath.Join(dir, "stdout.log"),
StderrLogPath: filepath.Join(dir, "audita.stderr.log"), StderrLogPath: filepath.Join(dir, "stderr.log"),
} }
if withReport {
req.ReportPath = filepath.Join(dir, "audita.report.json")
}
return req
} }
func writeAuditaHelperWrapper(t *testing.T) string { func auditaTestRunner(t *testing.T, cfg SubprocessRunnerConfig) *SubprocessRunner {
t.Helper() t.Helper()
exe, err := os.Executable() if cfg.Binary == "" {
cfg.Binary = "audita"
}
if cfg.Timeout == 0 {
cfg.Timeout = time.Second
}
runner, err := NewSubprocessRunner(cfg)
if err != nil { if err != nil {
t.Fatalf("os.Executable() error = %v", err) t.Fatal(err)
} }
path := filepath.Join(t.TempDir(), "audita-helper-wrapper.sh") return runner
content := "#!/bin/sh\nexec \"" + exe + "\" -test.run=TestAuditaSubprocessHelper -- \"$@\"\n"
if err := os.WriteFile(path, []byte(content), 0o755); err != nil {
t.Fatalf("WriteFile(%q) error = %v", path, err)
}
return path
} }
func writeAuditaTestFile(t *testing.T, path, contents string) { func auditaTestSecret(t *testing.T, name, value string) configkit.Secret {
t.Helper() t.Helper()
if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil { t.Setenv(name, value)
t.Fatalf("MkdirAll(%q): %v", path, err) type loaded struct {
Credential configkit.Secret `yaml:"credential"`
} }
if err := os.WriteFile(path, []byte(contents), 0o644); err != nil { result, err := configkit.Load(configkit.Bytes("credential.yml", []byte("credential: "+name+"\n")), configkit.Options[loaded]{})
t.Fatalf("WriteFile(%q): %v", path, err) if err != nil {
t.Fatal(err)
}
return result.Config.Credential
}
func writeAuditaTestFile(t *testing.T, path, value string) {
t.Helper()
if err := os.WriteFile(path, []byte(value), 0o600); err != nil {
t.Fatal(err)
} }
} }
func writeAuditaHelperFile(path, contents string) { func TestSubprocessRunnerUsesNativeInvocationAndCapturedCredentials(t *testing.T) {
if strings.TrimSpace(path) == "" { const first = "NARRATIO_AUDITA_CUSTOM_ONE"
return const second = "NARRATIO_AUDITA_CUSTOM_TWO"
firstSecret := auditaTestSecret(t, first, "loaded-one")
secondSecret := auditaTestSecret(t, second, "loaded-two")
t.Setenv(first, "parent-changed")
t.Setenv(second, "parent-changed-too")
t.Setenv("NARRATIO_AUDITA_UNSELECTED", "not-forwarded")
runner := auditaTestRunner(t, SubprocessRunnerConfig{
Credentials: []configkit.Secret{firstSecret, secondSecret},
Overlay: "testing", ProposalProfile: "proposal", ValidationProfile: "validation",
TranscriptDescription: "campaign", ConfigPath: "/etc/audita/config.yml", OutputSchema: "audita-v1",
})
req := auditaTestRequest(t)
var captured subprocess.RunRequest
runner.run = func(_ context.Context, processReq subprocess.RunRequest) (subprocess.RunResult, error) {
captured = processReq
writeAuditaTestFile(t, req.OutputProcessedPath, `{"segments":[]}`)
for _, name := range []string{"errors.yml", "recoveries.yml", "report.md"} {
writeAuditaTestFile(t, filepath.Join(filepath.Dir(req.OutputProcessedPath), name), "recoverable diagnostic\n")
}
return subprocess.RunResult{}, nil
}
result, err := runner.Run(context.Background(), req)
if err != nil {
t.Fatal(err)
}
want := []string{"process", req.MergedTranscriptPath, "--output", req.OutputProcessedPath,
"--glossary-file", req.GlossaryFiles[0], "--glossary-file", req.GlossaryFiles[1], "--config", "/etc/audita/config.yml", "--overlay", "testing",
"--proposal-profile", "proposal", "--validation-profile", "validation", "--transcript-description", "campaign", "--output-schema", "audita-v1"}
if !reflect.DeepEqual(captured.Args, want) {
t.Fatalf("args = %#v, want %#v", captured.Args, want)
}
if len(captured.EnvOverrides) != 2 || captured.EnvOverrides[first] != "loaded-one" || captured.EnvOverrides[second] != "loaded-two" || captured.EnvOverrides["NARRATIO_AUDITA_UNSELECTED"] != "" {
t.Fatalf("credential forwarding = %#v", captured.EnvOverrides)
}
if !reflect.DeepEqual(captured.SensitiveEnvNames, []string{first, second}) {
t.Fatalf("sensitive names = %#v", captured.SensitiveEnvNames)
}
if result.Reports.ErrorsPath == "" || result.Reports.RecoveriesPath == "" || result.Reports.OverviewPath == "" {
t.Fatalf("reports = %#v", result.Reports)
}
generated, err := os.ReadFile(req.GeneratedConfigPath)
if err != nil {
t.Fatal(err)
}
if !strings.Contains(string(generated), "audita.generated.v3") || !strings.Contains(string(generated), first) || strings.Contains(string(generated), "loaded-one") {
t.Fatalf("unsafe or incomplete generated invocation: %s", generated)
} }
_ = os.MkdirAll(filepath.Dir(path), 0o755)
_ = os.WriteFile(path, []byte(contents), 0o644)
} }
func auditaFlagValue(args []string, name string) string { func TestSubprocessRunnerRejectsMissingOrMalformedTranscript(t *testing.T) {
for i := 0; i < len(args)-1; i++ { for _, output := range []string{"", `{"segments":"wrong"}`} {
if args[i] == name { t.Run(output, func(t *testing.T) {
return args[i+1] runner := auditaTestRunner(t, SubprocessRunnerConfig{})
req := auditaTestRequest(t)
runner.run = func(context.Context, subprocess.RunRequest) (subprocess.RunResult, error) {
if output != "" {
writeAuditaTestFile(t, req.OutputProcessedPath, output)
}
return subprocess.RunResult{}, nil
}
if _, err := runner.Run(context.Background(), req); err == nil {
t.Fatal("missing or malformed transcript was accepted")
}
})
}
}
func TestSubprocessRunnerPreservesFailureAndAvailableReports(t *testing.T) {
runner := auditaTestRunner(t, SubprocessRunnerConfig{})
req := auditaTestRequest(t)
processFailure := errors.New("audita exited after writing output")
runner.run = func(context.Context, subprocess.RunRequest) (subprocess.RunResult, error) {
writeAuditaTestFile(t, req.OutputProcessedPath, `{"segments":[]}`)
writeAuditaTestFile(t, filepath.Join(filepath.Dir(req.OutputProcessedPath), "errors.yml"), "status: failed\n")
return subprocess.RunResult{ExitCode: 7}, processFailure
}
result, err := runner.Run(context.Background(), req)
if !errors.Is(err, processFailure) || !strings.Contains(err.Error(), filepath.Dir(req.OutputProcessedPath)) {
t.Fatalf("error = %v", err)
}
if result.Reports.ErrorsPath == "" || result.Reports.RecoveriesPath != "" || result.Reports.OverviewPath != "" {
t.Fatalf("reports = %#v", result.Reports)
}
}
func TestSubprocessRunnerDoesNotMaskProcessFailureWithReportError(t *testing.T) {
runner := auditaTestRunner(t, SubprocessRunnerConfig{})
req := auditaTestRequest(t)
processFailure := errors.New("audita process failed")
runner.run = func(context.Context, subprocess.RunRequest) (subprocess.RunResult, error) {
path := filepath.Join(filepath.Dir(req.OutputProcessedPath), "errors.yml")
if err := os.WriteFile(path, make([]byte, MaxReportOutputBytes+1), 0o600); err != nil {
t.Fatal(err)
}
return subprocess.RunResult{ExitCode: 7}, processFailure
}
if _, err := runner.Run(context.Background(), req); !errors.Is(err, processFailure) {
t.Fatalf("error = %v, want original process error", err)
}
}
func TestSubprocessRunnerBoundsAdjacentReports(t *testing.T) {
runner := auditaTestRunner(t, SubprocessRunnerConfig{})
req := auditaTestRequest(t)
runner.run = func(context.Context, subprocess.RunRequest) (subprocess.RunResult, error) {
writeAuditaTestFile(t, req.OutputProcessedPath, `{"segments":[]}`)
path := filepath.Join(filepath.Dir(req.OutputProcessedPath), "errors.yml")
if err := os.WriteFile(path, make([]byte, MaxReportOutputBytes+1), 0o600); err != nil {
t.Fatal(err)
}
return subprocess.RunResult{}, nil
}
if _, err := runner.Run(context.Background(), req); err == nil || !strings.Contains(err.Error(), "errors.yml") || !strings.Contains(err.Error(), "16777216") {
t.Fatalf("error = %v, want named report limit", err)
}
}
func TestSubprocessRunnerRedactsCustomCredentialStreams(t *testing.T) {
const first = "NARRATIO_AUDITA_STREAM_ONE"
const second = "NARRATIO_AUDITA_STREAM_TWO"
for _, fail := range []bool{false, true} {
t.Run(map[bool]string{false: "success", true: "failure"}[fail], func(t *testing.T) {
firstSecret := auditaTestSecret(t, first, "audita-first-secret")
secondSecret := auditaTestSecret(t, second, "audita-second-secret")
req := auditaTestRequest(t)
body := "#!/bin/sh\nprintf '%s\\n' \"$" + first + "\"\nprintf '%s\\n' \"$" + second + "\" >&2\n"
if fail {
body += "exit 7\n"
} else {
body += "printf '{\"segments\":[]}' > \"" + req.OutputProcessedPath + "\"\n"
}
binary := filepath.Join(t.TempDir(), "audita-helper")
writeAuditaTestFile(t, binary, body)
if err := os.Chmod(binary, 0o700); err != nil {
t.Fatal(err)
}
runner := auditaTestRunner(t, SubprocessRunnerConfig{Binary: binary, Credentials: []configkit.Secret{firstSecret, secondSecret}})
_, err := runner.Run(context.Background(), req)
if (err != nil) != fail {
t.Fatalf("error = %v, fail = %v", err, fail)
}
for _, path := range []string{req.StdoutLogPath, req.StderrLogPath} {
data, readErr := os.ReadFile(path)
if readErr != nil {
t.Fatal(readErr)
}
if strings.Contains(string(data), "audita-first-secret") || strings.Contains(string(data), "audita-second-secret") || !strings.Contains(string(data), "<redacted>") {
t.Fatalf("unredacted stream %q: %s", path, data)
}
}
if fail && (strings.Contains(err.Error(), "audita-first-secret") || strings.Contains(err.Error(), "audita-second-secret")) {
t.Fatalf("unredacted failure: %v", err)
}
})
}
}
func TestSubprocessRunnerDestinationsAndDebug(t *testing.T) {
for _, debug := range []bool{false, true} {
runner := auditaTestRunner(t, SubprocessRunnerConfig{Debug: debug})
req := auditaTestRequest(t)
req.ReportDir = filepath.Join(t.TempDir(), "reports")
req.WorkDir = filepath.Join(t.TempDir(), "work")
if err := os.MkdirAll(req.ReportDir, 0755); err != nil {
t.Fatal(err)
}
runner.run = func(_ context.Context, processReq subprocess.RunRequest) (subprocess.RunResult, error) {
flags := strings.Join(processReq.Args, "|")
if !strings.Contains(flags, "--report-dir|"+req.ReportDir) || !strings.Contains(flags, "--work-dir|"+req.WorkDir) || strings.Contains(flags, "--reporting=false") || strings.Contains(flags, "--modules") || strings.Contains(flags, "--debug") != debug {
t.Fatalf("args: %v", processReq.Args)
}
writeAuditaTestFile(t, req.OutputProcessedPath, `{"segments":[]}`)
writeAuditaTestFile(t, filepath.Join(req.ReportDir, "errors.yml"), "status: completed\n")
return subprocess.RunResult{}, nil
}
result, err := runner.Run(context.Background(), req)
if err != nil || result.Reports.ErrorsPath != filepath.Join(req.ReportDir, "errors.yml") {
t.Fatalf("result: %+v %v", result, err)
} }
} }
return ""
} }
func readAuditaHelperRecord(t *testing.T, path string) auditaHelperRecord { func TestWorkDirectoryAloneDoesNotEnableCapture(t *testing.T) {
t.Helper() runner := auditaTestRunner(t, SubprocessRunnerConfig{})
data, err := os.ReadFile(path) req := auditaTestRequest(t)
if err != nil { req.WorkDir = filepath.Join(t.TempDir(), "work")
t.Fatalf("ReadFile(%q): %v", path, err) args := runner.buildArgs("process", req)
} joined := strings.Join(args, "|")
var rec auditaHelperRecord if !strings.Contains(joined, "--work-dir|"+req.WorkDir) || strings.Contains(joined, "--debug") || strings.Contains(joined, "--report-dir") || strings.Contains(joined, "--reporting") {
if err := json.Unmarshal(data, &rec); err != nil { t.Fatalf("args: %v", args)
t.Fatalf("json unmarshal helper record: %v", err)
}
return rec
}
func assertJSONFileAudita(t *testing.T, path string) {
t.Helper()
data, err := os.ReadFile(path)
if err != nil {
t.Fatalf("ReadFile(%q): %v", path, err)
}
var v any
if err := json.Unmarshal(data, &v); err != nil {
t.Fatalf("json unmarshal %q: %v", path, err)
} }
} }
func mustParseAuditaDuration(t *testing.T, value string) time.Duration {
t.Helper()
d, err := time.ParseDuration(value)
if err != nil {
t.Fatalf("time.ParseDuration(%q) error = %v", value, err)
}
return d
}

View File

@@ -0,0 +1 @@
{"segments":[{"id":1,"speaker":"Speaker A","start":0,"end":2.1,"text":"We meet by the old harbor before dawn."},{"id":2,"speaker":"Speaker B","start":2.4,"end":4.6,"text":"I will keep watch while the others arrive."},{"id":3,"speaker":"Speaker A","start":4.9,"end":7.2,"text":"Then we can follow the road together."}]}

Some files were not shown because too many files have changed in this diff Show More