Minimize D&D NPC extraction contracts
This commit is contained in:
@@ -109,8 +109,8 @@ The NPC identity package owns Unicode comparison keys, deterministic
|
||||
`npc:sha256:` IDs, display normalization, and whole-registry collision issues.
|
||||
The registry package resolves one optional normalized artifact through the
|
||||
strict codec, validates whole-registry identity, canonicalizes its JSON, and
|
||||
provides immutable records, prompt input, semantic digest, count, and exact
|
||||
canonical-name/alias lookup. External files cross this boundary during
|
||||
provides immutable records, a names-only prompt projection, distinct durable
|
||||
and projection digests, count, and exact canonical-name lookup. External files cross this boundary during
|
||||
preparation; generated artifacts cross it at the ordered step handoff. It owns
|
||||
the `npcs` slot and its bounded, content-safe validation failures. NPC source
|
||||
references are durable provenance and are not treated as evidence for a
|
||||
@@ -239,7 +239,8 @@ validated and supplied at operation time. External bindings may add only
|
||||
`npc_registry_digest` and `npc_count` to module metadata and an
|
||||
`npc_registry` checkpoint fingerprint. Generated bindings are represented by
|
||||
framework handoff provenance and dependency fingerprints. The unbound prompt
|
||||
input is exactly `{"npcs":[]}` and has no registry provenance or fingerprint.
|
||||
input is exactly `{"npcs":[]}`, has a projection fingerprint, and has no
|
||||
registry provenance.
|
||||
The shared NPC grounding fragment is placed immediately after the common
|
||||
campaign reference message and is included in the spell prompt fingerprint.
|
||||
|
||||
@@ -253,6 +254,9 @@ assigns source identity and deterministic NPC IDs, and preserves source
|
||||
references for deterministic validation. It uses the shared campaign
|
||||
references only for disambiguation and does not consume the optional NPC
|
||||
registry slot. Its prompt and private response schema are package-owned. The
|
||||
private response contains only a name and model-facing evidence ranges for each
|
||||
record; anonymous groups, generic roles, invented labels, descriptions,
|
||||
aliases, and relationships are outside its contract. The
|
||||
prompt follows the shared D&D extraction ordering and cache policy documented
|
||||
in [LLM Runtime](llm.md#dd-extraction-prompt-ordering-and-cache-boundaries).
|
||||
|
||||
@@ -286,11 +290,10 @@ for deterministic normalization.
|
||||
### `internal/modules/dnd/normalize/npcs`
|
||||
|
||||
The NPC normalizer performs deterministic identity-aware consolidation in
|
||||
merged input order. It unions only canonical identity or canonical/alias
|
||||
matches, retains the first display record, unions exact relationships and
|
||||
source references, rewrites unambiguous relationship targets, and leaves
|
||||
ambiguous collisions for identity validation. It exposes the identity policy
|
||||
as its local checkpoint fingerprint and emits bounded normalization warnings.
|
||||
merged input order. It consolidates only equal canonical-name comparison keys,
|
||||
retains the first display record, and unions exact source references. It exposes
|
||||
the identity policy as its local checkpoint fingerprint and emits bounded
|
||||
normalization warnings.
|
||||
|
||||
## Merger And Normalizer
|
||||
|
||||
@@ -400,15 +403,15 @@ payload rules are defined in the
|
||||
|
||||
## D&D NPC Validators
|
||||
|
||||
NPC shape validation checks required strings, arrays, and source-reference
|
||||
NPC shape validation checks the required ID and name strings, list presence, and source-reference
|
||||
shape. The source-reference validator defers malformed shapes, checks
|
||||
current-document identity, unit existence, and range ordering, and reports all
|
||||
defects through bounded aggregates. Source relatedness uses the shared
|
||||
document-order traversal and normalized consecutive-token matching, emitting at
|
||||
most one bounded warning per record when neither the canonical name nor an
|
||||
alias occurs near its cited text. Invalid shape or cited ranges produce no
|
||||
relatedness warnings. Normalize identity validation checks deterministic IDs,
|
||||
canonical names, aliases, and cross-record ownership or canonical collisions.
|
||||
most one bounded warning per record when the canonical name does not occur near
|
||||
its cited text. Invalid shape or cited ranges produce no relatedness warnings.
|
||||
Normalize identity validation checks deterministic IDs, canonical names, and
|
||||
duplicate canonical-name or ID ownership.
|
||||
All are deterministic and expose the policy fingerprints used by the
|
||||
production chains.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user