From 9dc976afaf78c7866e63799182c82762e24ed461 Mon Sep 17 00:00:00 2001 From: Eric Rakestraw Date: Sun, 29 Nov 2026 18:22:32 +0000 Subject: [PATCH] Migrate examples and guidance to shared domain inputs --- docs/cli.md | 8 +- docs/config.md | 17 +++- docs/consumers/dnd-pipeline.md | 11 ++- docs/consumers/subprocess.md | 4 +- docs/development.md | 2 +- docs/integrations/dnd-spell-artifacts.md | 2 +- .../dnd-spell-catalog-overlays.md | 78 ------------------- docs/integrations/shared-domain-inputs.md | 68 ++++++++++++++++ docs/internal/dnd.md | 10 ++- docs/roadmap/implementation.md | 7 +- ...narratio-shared-schemas-feature-request.md | 2 +- docs/roadmap/shared-domain-schemas.md | 2 +- examples/dnd-complete/glossary.txt | 8 -- examples/dnd-complete/glossary.yml | 34 ++++++++ examples/dnd-complete/party.txt | 2 - examples/dnd-complete/party.yml | 18 +++++ .../dnd-complete/pipelines/dnd-session.yml | 8 +- examples/dnd-complete/spell-catalog.json | 21 ----- .../cli/dnd_enemy_events_contract_test.go | 6 +- internal/cli/dnd_npc_contract_test.go | 4 +- internal/cli/example_contract_test.go | 26 ++++++- internal/cli/production_contract_test.go | 2 +- internal/cli/recovery_contract_test.go | 2 +- .../spell_catalog_identity_contract_test.go | 2 +- 24 files changed, 199 insertions(+), 145 deletions(-) delete mode 100644 docs/integrations/dnd-spell-catalog-overlays.md create mode 100644 docs/integrations/shared-domain-inputs.md delete mode 100644 examples/dnd-complete/glossary.txt create mode 100644 examples/dnd-complete/glossary.yml delete mode 100644 examples/dnd-complete/party.txt create mode 100644 examples/dnd-complete/party.yml delete mode 100644 examples/dnd-complete/spell-catalog.json diff --git a/docs/cli.md b/docs/cli.md index cac89177..bbb55230 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -258,7 +258,8 @@ Bind declared slots using `--reference SELECTOR=PATH`: Pipeline/lane selectors may match several targets and fail if they match none. A binding-specific selector requires its selected target to declare the slot. There is no stage-wide merger shorthand. CLI paths override configured external -paths; narrower selectors beat broader ones, with last occurrence winning at +paths while retaining each target's configured collection selection; CLI-only +bindings use slot defaults. Narrower selectors beat broader ones, with last occurrence winning at equal scope. Binding and unbinding the same concrete target at equal scope fails; narrower actions can make intentional exceptions to broader actions. @@ -273,8 +274,9 @@ For a complete D&D workflow, pipeline-level references are first-class inputs: ~~~sh notarius run dnd-session --config examples/dnd-complete/config.yml \ --input-file examples/dnd-complete/transcript.json \ - --reference party=/data/references/party.txt \ - --reference glossary=/data/references/glossary.txt \ + --reference party=/data/references/party.yml \ + --reference glossary=/data/references/glossary.yml \ + --reference spell_catalog=/data/references/glossary.yml \ --output-dir /data/results --format json ~~~ diff --git a/docs/config.md b/docs/config.md index c51b7e70..afd3b382 100644 --- a/docs/config.md +++ b/docs/config.md @@ -376,7 +376,7 @@ Logical formats belong to [chunk-map](integrations/chunk-map.md) and ## References And Ordered Handoffs Reference maps bind named slots that the selected target declares. An external -reference is an object with `path`. Pipeline-level maps accept only external +reference is an object with `path` and optional `collections`. Pipeline-level maps accept only external paths; step-local and binding-local maps may also select a normalized artifact from an earlier step: @@ -409,6 +409,12 @@ slot. A generated binding supplies one normalized artifact in memory, including supported qualified fallback; it does not name a file. A configured generated dependency remains required even when that consumer slot is otherwise optional. +`collections` is an external-file selection, not an artifact selector. Omitted +or null uses the consuming slot's defaults; `[]` selects none. Names compare +exactly, empty names are invalid, and repeated names have no additional effect. +Explicit names must exist. See [shared domain inputs](integrations/shared-domain-inputs.md) +for the D&D collection roles and defaults. + Pipeline references are configuration defaults. A matching step-local or binding-local external path overrides a pipeline default. CLI reference bindings are then operational overrides of configured external paths; their @@ -419,6 +425,9 @@ after configuration and CLI reference actions are applied. A YAML reference path resolves from the file that supplies its surviving declaration, including an imported fragment or selected overlay. CLI reference paths resolve relative to the process working directory. +Replacing an external reference object in a more local configuration scope +replaces its selection too. A CLI path override retains the surviving configured +selection for each target; a CLI-only binding uses slot defaults. ### D&D Reference Slots @@ -427,11 +436,11 @@ selected target declares them: | Slot | Source and use | | --- | --- | -| **party** | Optional text campaign context. This is the canonical party-roster spelling. | +| **party** | Optional shared party document; canonical party-roster spelling. | | **roster** | Accepted compatibility alias for **party**. | | **players** | Optional text player context. | -| **glossary** | Optional text campaign glossary. | -| **spell_catalog** | Optional JSON spell-catalog overlay for spell extraction and normalization. See [spell-catalog overlays](integrations/dnd-spell-catalog-overlays.md). | +| **glossary** | Optional shared glossary document for general campaign vocabulary. | +| **spell_catalog** | Optional shared glossary document for spell recognition and normalization. | | **location_registry** | Required normalized location registry for location-occurrence extraction and normalization. | | **item_registry** | Required normalized item registry for item-occurrence extraction and normalization. | | **npc_registry** | Normalized NPC registry. Optional for spells and combat turns; required for NPC occurrences and enemy-event extraction and normalization. | diff --git a/docs/consumers/dnd-pipeline.md b/docs/consumers/dnd-pipeline.md index 05df5409..d89197e1 100644 --- a/docs/consumers/dnd-pipeline.md +++ b/docs/consumers/dnd-pipeline.md @@ -41,10 +41,9 @@ notarius run dnd-session \ --config /absolute/path/to/notarius.yml \ --input-file /absolute/path/to/transcripts/final.trimmed.json \ --output-dir /absolute/path/to/notarius-output \ - --reference party=/absolute/path/to/references/party.txt \ - --reference players=/absolute/path/to/references/players.txt \ - --reference glossary=/absolute/path/to/references/glossary.txt \ - --reference spell_catalog=/absolute/path/to/references/spells.json \ + --reference party=/absolute/path/to/references/party.yml \ + --reference glossary=/absolute/path/to/references/glossary.yml \ + --reference spell_catalog=/absolute/path/to/references/glossary.yml \ --format json ~~~ @@ -53,6 +52,10 @@ reach every selected target declaring the slot; narrower overrides follow the [selector contract](../cli.md#reference-selectors). Generated registry, scene, combat, and NPC-occurrence handoffs stay in pipeline configuration, not CLI file bindings. +The [shared input contract](../integrations/shared-domain-inputs.md) explains +the party and glossary envelopes, selection defaults, and migration. Roster +player relationships do not require a separate player file; supplemental +`players` text remains optional. For an optional online readiness check, use `notarius preflight dnd-session` with the same configuration, transcript, output root, and reference arguments as diff --git a/docs/consumers/subprocess.md b/docs/consumers/subprocess.md index 034d4b8f..34fdf64d 100644 --- a/docs/consumers/subprocess.md +++ b/docs/consumers/subprocess.md @@ -34,7 +34,7 @@ that will be used for execution: notarius preflight pipeline-id \ --config /absolute/path/to/notarius.yml --overlay production \ --input-file /absolute/path/to/source.json \ - --reference party=/absolute/path/to/party.txt \ + --reference party=/absolute/path/to/party.yml \ --output-dir /absolute/path/to/output-root --format json ~~~ @@ -52,7 +52,7 @@ Then run with the same selection and reference: notarius run pipeline-id \ --config /absolute/path/to/notarius.yml --overlay production \ --input-file /absolute/path/to/source.json \ - --reference party=/absolute/path/to/party.txt \ + --reference party=/absolute/path/to/party.yml \ --output-dir /absolute/path/to/output-root --format json ~~~ diff --git a/docs/development.md b/docs/development.md index 74b38baa..f6284f12 100644 --- a/docs/development.md +++ b/docs/development.md @@ -43,7 +43,7 @@ implementing changes. It owns implementation discipline and local commit rules. | Building a subprocess caller or changing its result protocol | [Subprocess Consumer Guide](consumers/subprocess.md), [Complete D&D Consumer Guide](consumers/dnd-pipeline.md), [Native Completion Report](cli.md#completion-report), and [CLI Internals](internal/cli.md) | These separate generic caller workflow, the complete D&D workflow, the native completion report, and CLI implementation behavior. | | Configuration loading, resolution, or user-visible configuration behavior | [Configuration Internals](internal/configuration.md) and [Configuration](config.md) | The internal guide owns loading and resolution mechanics; the reference owns the configuration contract. | | Pipeline resolution or execution | [Pipeline Internals](internal/pipeline.md) | It documents typed preparation, complete assessment, native continuation, workers, and handoff eligibility. | -| Production modules or validators | [Module Internals](internal/modules.md), [D&D Module Internals](internal/dnd.md), and [D&D integration contracts](integrations/) | The generic guide owns extension mechanics, the D&D guide owns shared family conventions, and the contracts own durable output shapes. | +| Production modules or validators | [Module Internals](internal/modules.md), [D&D Module Internals](internal/dnd.md), [shared domain inputs](integrations/shared-domain-inputs.md), and [D&D integration contracts](integrations/) | The generic guide owns extension mechanics, the D&D guide owns shared family conventions, and the contracts own input and durable output shapes. | | Native execution, prompts, schemas, profiles, or admission | [LLM Integration](internal/llm.md) | It locates shared engine construction, native request/continuation calls, and evidence hooks. | | Kit API, source handoff, or standard-suite integration | [ConfigKit](integrations/pkg-configkit.md), [PromptKit](integrations/pkg-promptkit.md), and [CommandKit](integrations/pkg-commandkit.md) | These define the selected upstream integration boundaries and link pinned native contracts. | | Output, accepted-result reuse, or debug artifacts | [Run State Internals](internal/state.md), [Operations](operations.md), and [Configuration](config.md) | These separate implementation details, operator behavior, and configuration contracts. | diff --git a/docs/integrations/dnd-spell-artifacts.md b/docs/integrations/dnd-spell-artifacts.md index 2d7d063a..3c71cb58 100644 --- a/docs/integrations/dnd-spell-artifacts.md +++ b/docs/integrations/dnd-spell-artifacts.md @@ -67,7 +67,7 @@ into `source_refs`. ## Related contracts -The [spell-catalog overlay contract](dnd-spell-catalog-overlays.md) defines +The [shared domain input contract](shared-domain-inputs.md) defines the configured catalog additions. The [JSON output contract](json-output.md) defines where this logical artifact is published; [D&D module internals](../internal/dnd.md) describes extraction and validation mechanics. diff --git a/docs/integrations/dnd-spell-catalog-overlays.md b/docs/integrations/dnd-spell-catalog-overlays.md deleted file mode 100644 index 1dc5e108..00000000 --- a/docs/integrations/dnd-spell-catalog-overlays.md +++ /dev/null @@ -1,78 +0,0 @@ -# D&D Spell-Catalog Overlays - -This document defines the optional JSON overlay consumed by the D&D spell -extractor. An overlay contributes campaign spell names and aliases for -recognition. It does not define spell rules, effects, levels, classes, or -transcript evidence. Bind the optional `spell_catalog` reference as described -in [Configuration](../config.md#references-and-ordered-handoffs). - -## Contract Identity - -| Property | Value | -| --- | --- | -| Consumer | D&D spell extraction and normalization | -| Reference slot | `spell_catalog` | -| Media type | `application/json` | -| Required schema version | `notarius.dnd.spell-catalog-overlay.v1` | -| Base catalog | Embedded D&D 5e 2014 SRD catalog | - -At most one overlay document may be bound. The maintained example is -[spell-catalog.json](../../examples/dnd-complete/spell-catalog.json). - -## Wire Shape - -This is a minimal valid overlay: - -```json -{ - "schema_version": "notarius.dnd.spell-catalog-overlay.v1", - "catalogs": [ - { - "id": "campaign.example", - "ruleset": "dnd-5e-2014", - "source": {"title": "Example campaign spells"}, - "spells": [{"name": "Aegis of Emberfall"}] - } - ] -} -``` - -| Field | Required | Meaning and constraints | -| --- | --- | --- | -| `schema_version` | Yes | Exactly `notarius.dnd.spell-catalog-overlay.v1`. | -| `catalogs` | Yes | Non-empty array of catalog objects with unique IDs. | -| `catalogs[].id` | Yes | Non-empty trimmed string. | -| `catalogs[].ruleset` | Yes | Exactly `dnd-5e-2014`. | -| `catalogs[].source.title` | Yes | Non-empty trimmed string. | -| `catalogs[].source.version` | No | String when present. | -| `catalogs[].source.url` | No | String when present. | -| `catalogs[].source.license` | No | String when present. | -| `catalogs[].spells` | Yes | Non-empty array of spell objects. | -| `catalogs[].spells[].name` | Yes | Non-empty trimmed string. | -| `catalogs[].spells[].aliases` | No | Array of non-empty trimmed strings when present. | - -Unknown fields are rejected at every object level. The document must contain -one JSON value; `null` is not accepted for optional strings or aliases. - -## Composition And Compatibility - -Notarius starts with the embedded base catalog, then applies overlay catalogs -in ascending catalog-ID order. A new canonical spell name adds a recognition -entry. If an overlay names an existing canonical spell, it augments that spell -with aliases while retaining the established display spelling. - -Repeated aliases for the same spell are accepted. A canonical-name, canonical- -to-alias, or alias-to-alias collision between different spells is rejected, -including a collision with the embedded catalog. Matching uses the catalog’s -case, whitespace, and apostrophe normalization, so authors should avoid names -or aliases that normalize to another spell. - -Spell extraction receives the effective catalog as deterministic canonical-name -and alias pairs. An alias in the transcript selects its associated canonical -name; the extractor is instructed to return that canonical spelling. The -projection contains no catalog source metadata or provenance, and aliases -remain recognition context rather than transcript evidence. - -The overlay is a recognition aid only. The durable spell-artifact schema and -source-evidence rules are defined by the -[D&D spell artifact contract](dnd-spell-artifacts.md). diff --git a/docs/integrations/shared-domain-inputs.md b/docs/integrations/shared-domain-inputs.md new file mode 100644 index 00000000..503ecc35 --- /dev/null +++ b/docs/integrations/shared-domain-inputs.md @@ -0,0 +1,68 @@ +# Shared Domain Reference Inputs + +Notarius accepts shared party and glossary documents as optional D&D reference +inputs. The complete example provides a [party](../../examples/dnd-complete/party.yml) +and one [multi-collection glossary](../../examples/dnd-complete/glossary.yml). +The reference binding interface and defaults belong to +[Configuration](../config.md#references-and-ordered-handoffs). + +## Supported Contracts + +Notarius bundles the following contracts from shared schemas distribution +`2026.11.1`, commit `f7e3cedeca11ed903311cdf29ca4d81fb1f216b7`, for offline +validation. The document marker is not a schema-version selector. + +| Role | Version and marker | Upstream semantics | +| --- | --- | --- | +| `party` and accepted `roster` aliases | RPG party `0.2.0`, `maximumdirect.rpg.party.v1` | [Party semantics](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7/rpg/party/v0.2.0/semantics.md) | +| `glossary` and `spell_catalog` | Glossary `0.2.0`, `maximumdirect.glossary.v1` | [Glossary semantics](https://forge.maximumdirect.net/eric/schemas/src/commit/f7e3cedeca11ed903311cdf29ca4d81fb1f216b7/glossary/v0.2.0/semantics.md) | + +Inputs are YAML or JSON, with media types `application/yaml`, +`application/x-yaml`, or `application/json`. JSON must use JSON syntax. +Both serializations pass through ConfigKit's native mapping load and are +validated as complete documents, including unselected collections. See the +pinned [ConfigKit native contract](https://forge.maximumdirect.net/base-layer/configkit/src/commit/4a7ae664a6287d71cba20f59c7c5b37b6f05b0a3/docs/config.md) +for loading, dynamic numeric binding, limits, and reserved controls such as +`extends` and source-root `config`. Notarius adds exact per-collection entry-ID +uniqueness and task-specific suitability checks; ordinary extensions remain +data, not instructions. + +## Task Views + +Each binding selects collections independently. General glossary context defaults +to the available `campaign` and `setting` collections; a bound +`spell_catalog` defaults to `spells`, which must exist. Explicit selections +must exist, may be empty, and compare names exactly. Empty valid selections or +collections contribute no added vocabulary. No binding is required merely +because another is present. The same file can serve both roles. + +Party context includes names, aliases, optional player relationships and +classes/levels, without exposing roster IDs to the model. Distinct roster +entries remain distinct even when names match. `party` takes presentation +precedence over `roster`; both supplied documents are validated. +`players` remains optional supplemental text. No duplicate player list is +needed for relationships already in the roster. + +General glossary context projects names, aliases, categories, descriptions, +and plural forms. Spell recognition projects names and aliases only and starts +with the embedded D&D 5e 2014 SRD vocabulary. Existing canonical display +names take precedence; selected entries may augment their aliases. Conflicting +recognition keys for different spells are task errors. Collection names and +entry IDs determine deterministic traversal; IDs, provenance, and irrelevant +extensions are not promoted to model instructions or transcript evidence. + +## Migration + +Replace plain-text `party` or `roster` files with the shared party envelope +and move character/player relationships into roster entries. Replace text +`glossary` files and the private `notarius.dnd.spell-catalog-overlay.v1` +envelope with shared glossary entries under named collections. Map old spell +names and aliases directly to entries; old ruleset metadata is not required, +and source information may be optional collection provenance. Aliases may be +omitted, null, or empty. Add `collections` on an external binding only when +the slot defaults are not appropriate. Existing slot names and CLI selectors +remain unchanged. There is no legacy reader or automatic conversion. + +Run and explicit preflight validate supplied documents during preparation, +before domain inference; offline pipeline validation does not read reference +files. See [CLI preflight](../cli.md#preflight) for its readiness scope. diff --git a/docs/internal/dnd.md b/docs/internal/dnd.md index 4c3f7d41..554b6cc7 100644 --- a/docs/internal/dnd.md +++ b/docs/internal/dnd.md @@ -42,6 +42,14 @@ separate from execution integration. ## Prompt Construction +The [shared context preparer](../../internal/modules/dnd/shared/context.go) +loads and validates selected party and glossary references at construction, +then retains narrow immutable prompt projections. Each operation combines them +with its own transcript; generated registry and scene handoffs remain dynamic. +The spell catalog builds recognition views from the same shared glossary +integration. The [shared input contract](../integrations/shared-domain-inputs.md) +owns supported formats and selection semantics. + Content lives beneath [assets/dnd](../../assets/dnd/), with ordinary native declarations imported by [assets/notarius.yml](../../assets/notarius.yml). The root assets package stays a content-only leaf. Declaration-relative content @@ -275,7 +283,7 @@ not accepted-result cache identity. | Lane | Intentional behavior | | --- | --- | -| Spells | May use a spell-catalog overlay and optional NPC grounding; the catalog validator supplies domain-specific semantic checks. | +| Spells | May use a shared glossary for recognition and optional NPC grounding; the catalog validator supplies domain-specific semantic checks. | | NPC registry | Establishes transcript-grounded NPC identities, including factual third-party mentions, without assigning occurrence categories. It does not consume an NPC registry, and its normalizer is the LLM-assisted reconciliation exception described above. | | Combat turns | Requires a scene-description artifact. It calls the LLM only for an exact `combat` classification; non-combat paths directly assess an empty result, while missing or mismatched classifications also retain a bounded warning. Optional NPC grounding never becomes evidence. | | Item occurrences | Requires the normalized item registry for exact deterministic grounding at extraction and normalization. Campaign context may disambiguate, but the registry never becomes occurrence evidence. | diff --git a/docs/roadmap/implementation.md b/docs/roadmap/implementation.md index 0e7eeda3..02490f57 100644 --- a/docs/roadmap/implementation.md +++ b/docs/roadmap/implementation.md @@ -383,9 +383,8 @@ validation simply because no chunks execute or accepted artifacts are cached. ## Stage 9 — Verify Assembled Run And Preflight Behavior -**Status:** Complete. Focused assembled checks pass; the broader CLI suite still -has failures in tests using the old maintained example files, whose migration is -assigned below. The preflight and framework pipeline suites pass. +**Status:** Complete. Focused assembled checks, the preflight and framework +pipeline suites, and the broader CLI suite pass after the example migration. **Goal:** Prove the public workflow through real internal collaborators and fake provider boundaries. @@ -419,6 +418,8 @@ the final ordinary pipeline remains usable with optional references omitted. ## Stage 10 — Migrate Maintained Examples And Canonical Documentation +**Status:** Complete. + **Goal:** Make the supported workflow discoverable without duplicating upstream schema manuals. diff --git a/docs/roadmap/narratio-shared-schemas-feature-request.md b/docs/roadmap/narratio-shared-schemas-feature-request.md index e12436f6..3a97b004 100644 --- a/docs/roadmap/narratio-shared-schemas-feature-request.md +++ b/docs/roadmap/narratio-shared-schemas-feature-request.md @@ -79,7 +79,7 @@ aliases and descriptions, and extensible domain information. The authoritative contract defines omission, null, and empty values. Notarius should honor those shapes rather than require the current spell overlay's different representation. -The existing [spell-catalog overlay](../integrations/dnd-spell-catalog-overlays.md) +The former [spell-catalog overlay](https://forge.maximumdirect.net/eric/notarius/src/commit/bff0fb44e86e024f1cb5f0987b2ba583c225a53b/docs/integrations/dnd-spell-catalog-overlays.md) requires a separate schema marker and catalog structure, rejects unknown fields, and couples input to catalog/ruleset requirements. Replace that operator-facing format with shared glossary consumption. The operator should be able to supply diff --git a/docs/roadmap/shared-domain-schemas.md b/docs/roadmap/shared-domain-schemas.md index 4891d100..6c89f950 100644 --- a/docs/roadmap/shared-domain-schemas.md +++ b/docs/roadmap/shared-domain-schemas.md @@ -26,7 +26,7 @@ Reviewed against Notarius commit - D&D shared prompt inputs treat `party`, `players`, and `glossary` as text. Some modules also accept the existing `roster` alias. These inputs do not currently establish conformance to the proposed shared contracts. -- [Spell-catalog overlays](../integrations/dnd-spell-catalog-overlays.md) use the +- The former [spell-catalog overlay contract](https://forge.maximumdirect.net/eric/notarius/src/commit/bff0fb44e86e024f1cb5f0987b2ba583c225a53b/docs/integrations/dnd-spell-catalog-overlays.md) used the private `notarius.dnd.spell-catalog-overlay.v1` JSON format. The reader rejects unknown fields, requires catalog/ruleset/source information, and rejects null aliases. That reader cannot consume a shared glossary unchanged. diff --git a/examples/dnd-complete/glossary.txt b/examples/dnd-complete/glossary.txt deleted file mode 100644 index 5b8314fe..00000000 --- a/examples/dnd-complete/glossary.txt +++ /dev/null @@ -1,8 +0,0 @@ -Ravenfall watchtower: a ruined watchtower near the party's current route. -Mira Thorn: the watchtower's keeper. -Elder Rowan: a missing local scholar. -Kesh: a goblin captain leading raiders. -Moonblade: a blade found in the watchtower's hidden cache. -Cure Wounds: a healing spell. -Shield: a defensive reaction spell. -Aegis of Emberfall: a campaign spell recorded in the supplied catalog overlay. diff --git a/examples/dnd-complete/glossary.yml b/examples/dnd-complete/glossary.yml new file mode 100644 index 00000000..91e87cc4 --- /dev/null +++ b/examples/dnd-complete/glossary.yml @@ -0,0 +1,34 @@ +schema_version: maximumdirect.glossary.v1 +collections: + campaign: + entries: + - id: mira + name: Mira Thorn + category: person + description: The watchtower's keeper. + - id: rowan + name: Elder Rowan + category: person + description: A missing local scholar. + - id: kesh + name: Kesh + category: person + description: A goblin captain leading raiders. + - id: moonblade + name: Moonblade + category: item + description: A blade found in the watchtower's hidden cache. + setting: + entries: + - id: ravenfall + name: Ravenfall watchtower + category: place + description: A ruined watchtower near the party's current route. + spells: + provenance: + title: Notarius example campaign spell names + entries: + - id: aegis + name: Aegis of Emberfall + category: spell + aliases: [Emberfall Aegis] diff --git a/examples/dnd-complete/party.txt b/examples/dnd-complete/party.txt deleted file mode 100644 index be26e152..00000000 --- a/examples/dnd-complete/party.txt +++ /dev/null @@ -1,2 +0,0 @@ -Aria: party cleric and recurring healer. -Borin: fighter ally. diff --git a/examples/dnd-complete/party.yml b/examples/dnd-complete/party.yml new file mode 100644 index 00000000..67bf4fd3 --- /dev/null +++ b/examples/dnd-complete/party.yml @@ -0,0 +1,18 @@ +schema_version: maximumdirect.rpg.party.v1 +characters: + aria: + character: + name: Aria + aliases: [Brightmantle] + classes: + - name: Cleric + level: 3 + player: + name: Alice + borin: + character: + name: Borin + classes: + - name: Fighter + player: + name: Ben diff --git a/examples/dnd-complete/pipelines/dnd-session.yml b/examples/dnd-complete/pipelines/dnd-session.yml index 08879b15..c1e641d6 100644 --- a/examples/dnd-complete/pipelines/dnd-session.yml +++ b/examples/dnd-complete/pipelines/dnd-session.yml @@ -15,9 +15,9 @@ pipelines: # Stable campaign context is shared by every module that accepts these slots. references: party: - path: ../party.txt + path: ../party.yml glossary: - path: ../glossary.txt + path: ../glossary.yml chunk: module: dnd/scenes output: @@ -71,7 +71,7 @@ pipelines: module: dnd/spells references: spell_catalog: - path: ../spell-catalog.json + path: ../glossary.yml merge: module: appendorder # Stage-local file references are intentionally bound at each stage. @@ -79,7 +79,7 @@ pipelines: module: dnd/spells references: spell_catalog: - path: ../spell-catalog.json + path: ../glossary.yml combat-turns: extract: module: dnd/combat-turns diff --git a/examples/dnd-complete/spell-catalog.json b/examples/dnd-complete/spell-catalog.json deleted file mode 100644 index a623d3fe..00000000 --- a/examples/dnd-complete/spell-catalog.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "schema_version": "notarius.dnd.spell-catalog-overlay.v1", - "catalogs": [ - { - "id": "notarius.example-campaign", - "ruleset": "dnd-5e-2014", - "source": { - "title": "Notarius example campaign spell names", - "version": "1", - "url": "", - "license": "" - }, - "spells": [ - { - "name": "Aegis of Emberfall", - "aliases": ["Emberfall Aegis"] - } - ] - } - ] -} diff --git a/internal/cli/dnd_enemy_events_contract_test.go b/internal/cli/dnd_enemy_events_contract_test.go index b0015c0c..c0de365d 100644 --- a/internal/cli/dnd_enemy_events_contract_test.go +++ b/internal/cli/dnd_enemy_events_contract_test.go @@ -93,9 +93,9 @@ func TestMaintainedCompleteInvocationPublishesRegistryBackedEntityOccurrences(t code := RunWithOptions([]string{ "run", "dnd-session", "--config", configPath, "--input-file", repositoryPath("examples", "dnd-complete", "transcript.json"), - "--reference", "party=" + repositoryPath("examples", "dnd-complete", "party.txt"), - "--reference", "glossary=" + repositoryPath("examples", "dnd-complete", "glossary.txt"), - "--reference", "spell_catalog=" + repositoryPath("examples", "dnd-complete", "spell-catalog.json"), + "--reference", "party=" + repositoryPath("examples", "dnd-complete", "party.yml"), + "--reference", "glossary=" + repositoryPath("examples", "dnd-complete", "glossary.yml"), + "--reference", "spell_catalog=" + repositoryPath("examples", "dnd-complete", "glossary.yml"), "--cache", "bypass", "--output-dir", outputRoot, "--llm-session-id", "enemy-event-session", "--format", "json", }, &stdout, &stderr, options) diff --git a/internal/cli/dnd_npc_contract_test.go b/internal/cli/dnd_npc_contract_test.go index e34cfc26..c8c8a004 100644 --- a/internal/cli/dnd_npc_contract_test.go +++ b/internal/cli/dnd_npc_contract_test.go @@ -106,8 +106,8 @@ func TestProductionNPCConfigurationValidatesOptionsReferencesAndPlacement(t *tes if err := resolve(func(profile *pipeline.PipelineProfile) { profile.References = pipeline.ExternalReferenceMap(map[string]string{ "players": "players.txt", - "party": "party.txt", - "glossary": "glossary.txt", + "party": "party.yml", + "glossary": "glossary.yml", }) }); err != nil { t.Fatalf("optional NPC references error = %v, want resolution success", err) diff --git a/internal/cli/example_contract_test.go b/internal/cli/example_contract_test.go index 92634d81..9575efb8 100644 --- a/internal/cli/example_contract_test.go +++ b/internal/cli/example_contract_test.go @@ -15,6 +15,7 @@ import ( "gitea.maximumdirect.net/eric/notarius/internal/core/config" "gitea.maximumdirect.net/eric/notarius/internal/framework/contracts" "gitea.maximumdirect.net/eric/notarius/internal/framework/pipeline" + "gitea.maximumdirect.net/eric/notarius/internal/integrations/domainrefs" "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd" locationoccurrenceextract "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/extract/locationoccurrences" locationextract "gitea.maximumdirect.net/eric/notarius/internal/modules/dnd/extract/locationregistry" @@ -123,6 +124,25 @@ func TestMaintainedExamplesResolveComposition(t *testing.T) { } } +func TestMaintainedSharedReferencesConform(t *testing.T) { + for _, item := range []struct { + name string + validate func(map[string]any) error + }{ + {"party.yml", domainrefs.ValidateParty}, + {"glossary.yml", domainrefs.ValidateGlossary}, + } { + content := readRepositoryFile(t, "examples", "dnd-complete", item.name) + doc, err := domainrefs.Load(item.name, "application/yaml", content) + if err == nil { + err = item.validate(doc) + } + if err != nil { + t.Fatalf("%s: %v", item.name, err) + } + } +} + func TestMaintainedExampleDevelopmentInheritsComposition(t *testing.T) { path := repositoryPath("examples", "dnd-complete", "config.yml") cfg := loadMaintainedExample(t, path) @@ -427,10 +447,10 @@ func TestCompleteDNDSharedCLIReferencesExpandAcrossCompatibleTargets(t *testing. cfg := loadMaintainedExample(t, repositoryPath("examples", "dnd-complete", "config.yml")) catalog := catalogFromRegistries(productionTestComponents(t).registries) sources := map[string]string{ - "party": "/references/party.txt", + "party": "/references/party.yml", "players": "/references/players.txt", - "glossary": "/references/glossary.txt", - "spell_catalog": "/references/spells.json", + "glossary": "/references/glossary.yml", + "spell_catalog": "/references/glossary.yml", } requests := make([]cliReferenceRequest, 0, len(sources)) for _, slot := range []string{"party", "players", "glossary", "spell_catalog"} { diff --git a/internal/cli/production_contract_test.go b/internal/cli/production_contract_test.go index 2753fb9e..db072400 100644 --- a/internal/cli/production_contract_test.go +++ b/internal/cli/production_contract_test.go @@ -624,7 +624,7 @@ func productionSpellCatalogContractConfig(t *testing.T) string { t.Helper() partyPath := writeSharedReference(t, "party.yml", validPartyYAML) glossaryPath := writeSharedReference(t, "glossary.json", validSharedGlossary) - catalogPath := filepath.Join(t.TempDir(), "spell-catalog.json") + catalogPath := filepath.Join(t.TempDir(), "spell-glossary.json") if err := os.WriteFile(catalogPath, []byte(`{"schema_version":"maximumdirect.glossary.v1","collections":{"spells":{"entries":[{"id":"aegis","name":"Aegis of Emberfall","category":"spell","aliases":["Emberfall Aegis"]}]}}}`), 0o600); err != nil { t.Fatal(err) } diff --git a/internal/cli/recovery_contract_test.go b/internal/cli/recovery_contract_test.go index 7adf4120..1b9b349a 100644 --- a/internal/cli/recovery_contract_test.go +++ b/internal/cli/recovery_contract_test.go @@ -114,7 +114,7 @@ type recoveryFixture struct { func newRecoveryFixture(t *testing.T) *recoveryFixture { t.Helper() root := t.TempDir() - for _, name := range []string{"prompts.yml", "transcript.json", "party.txt", "glossary.txt", "spell-catalog.json", "pipelines/dnd-session.yml", "pipelines/dnd-session.describe-session.yml"} { + for _, name := range []string{"prompts.yml", "transcript.json", "party.yml", "glossary.yml", "pipelines/dnd-session.yml", "pipelines/dnd-session.describe-session.yml"} { content, err := os.ReadFile(repositoryPath("examples", "dnd-complete", name)) if err != nil { t.Fatal(err) diff --git a/internal/cli/spell_catalog_identity_contract_test.go b/internal/cli/spell_catalog_identity_contract_test.go index c997f57d..cbb6cd86 100644 --- a/internal/cli/spell_catalog_identity_contract_test.go +++ b/internal/cli/spell_catalog_identity_contract_test.go @@ -77,7 +77,7 @@ func TestMaterializedSpellCatalogOrderingPreservesSemanticContents(t *testing.T) func TestConfiguredSpellCatalogBindingChangesResolvedPipelineIdentity(t *testing.T) { base := productionSpellCatalogContractConfig(t) source := loadMaintainedExample(t, writeProductionContractConfig(t, base)).Pipelines["dnd-session"].Artifacts["spells"].Extract.References["spell_catalog"].Path - changed := strings.Replace(base, source, filepath.Join(t.TempDir(), "alternate-spell-catalog.json"), 1) + changed := strings.Replace(base, source, filepath.Join(t.TempDir(), "alternate-glossary.json"), 1) if changed == base { t.Fatal("production configuration did not contain the maintained catalog binding") }