Files
notarius/docs/integrations/dnd-item-occurrence-artifacts.md

73 lines
2.9 KiB
Markdown
Raw Normal View History

2026-08-05 19:55:34 +00:00
# D&D Item-Occurrence Artifact
2026-07-25 22:16:29 +00:00
`dnd/item-occurrences` currently produces this source-grounded item and currency
2026-08-05 19:55:34 +00:00
occurrence list. It records discoveries and possession changes, not an
inventory, balance, or ledger.
2026-07-25 22:16:29 +00:00
2026-07-26 13:43:45 +00:00
## Identity and compatibility
2026-07-25 22:16:29 +00:00
| Property | Value |
| --- | --- |
2026-08-05 19:55:34 +00:00
| Artifact kind | `dnd/item-occurrence-list` |
| Schema ID | `notarius.dnd.item_occurrences` |
| Schema name | `notarius_dnd_item_occurrences_v1` |
2026-07-25 22:16:29 +00:00
| Schema version | `v1` |
| Media type | `application/json` |
2026-08-05 20:12:16 +00:00
`v1` accepts one strict JSON object with required `occurrences`; the array may
be empty. Each occurrence has required `item_id`, `name`, `kind`, and
`source_refs`, and occurrence and source-reference objects reject unknown
fields. `quantity`, `from`, and `to` appear only when their kind permits them.
An incompatible shape change requires a new schema version.
2026-07-25 22:16:29 +00:00
2026-08-05 19:55:34 +00:00
## Registry grounding
2026-07-25 22:16:29 +00:00
2026-08-05 19:55:34 +00:00
Both extraction and normalization require an `item_registry` reference bound to
an earlier normalized `dnd/item-registry` artifact. The registry is immutable
for an operation and contributes names-only grounding after the shared evidence
message. Notarius resolves the model's selected name into the unchanged exact
durable ID/name pair. It is never occurrence evidence.
2026-07-25 22:16:29 +00:00
2026-08-06 13:37:21 +00:00
Each occurrence must use one exact registry ID/name pair. An extraction response
with an unknown or ambiguous selected name is rejected as invalid model output;
the configured pipeline may retry it and never accepts a partial artifact.
2026-08-06 13:37:21 +00:00
Normalization and validation remain defense in depth for artifacts entering
through other boundaries: normalization canonicalizes a recognized name by ID,
preserves unknown values for the registry validator, and the registry validator
rejects unknown or mismatched pairs.
2026-07-25 22:16:29 +00:00
2026-08-05 19:55:34 +00:00
## Wire shape
2026-07-25 22:16:29 +00:00
2026-08-05 20:12:16 +00:00
Each source reference has exactly `source_id`, `start_unit_id`, and
`end_unit_id`. It identifies an inclusive range in the current transcript;
unit IDs are positive and the start may not follow the end.
2026-07-25 22:16:29 +00:00
```json
{
2026-08-05 19:55:34 +00:00
"occurrences": [
2026-07-25 22:16:29 +00:00
{
2026-08-05 19:55:34 +00:00
"item_id": "item:sha256:…",
2026-07-25 22:16:29 +00:00
"name": "Silver Pieces",
"kind": "acquired",
"quantity": 20,
"to": "party",
2026-07-26 13:43:45 +00:00
"source_refs": [
{"source_id": "session-7", "start_unit_id": 2, "end_unit_id": 2}
]
2026-07-25 22:16:29 +00:00
}
]
}
```
2026-08-05 19:55:34 +00:00
The five kinds remain `discovered`, `acquired`, `lost`, `consumed`, and
`transferred`. Holder, quantity, currency, ordering, and exact-duplicate rules
are unchanged: discovered has no holder; acquired requires `to`; lost and
consumed require `from`; transferred requires distinct non-`party` holders.
2026-08-05 20:12:16 +00:00
The only current downstream compatibility requirement is its registry handoff;
the normalized occurrence list is otherwise published for callers. See
[Configuration](../config.md#d-d-reference-slots) for the binding and
[JSON output](json-output.md) for publication.
2026-07-26 13:43:45 +00:00
2026-08-05 19:55:34 +00:00
See [item registry](dnd-item-registry-artifacts.md) for the grounding artifact
and [D&D module internals](../internal/dnd.md) for implementation details.