@plasius/ai-game 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,27 @@
1
+ # ADR-0002: Canonical world event envelope and classification
2
+
3
+ ## Status
4
+
5
+ - Accepted
6
+ - Date: 2026-05-14
7
+ - Version: 1.0
8
+
9
+ ## Context
10
+
11
+ Downstream systems (ingestion, gossip, analytics, and gameplay systems) require a stable event envelope shared across producers and consumers.
12
+
13
+ ## Decision
14
+
15
+ - Define a canonical `GameWorldEventCandidate` / `GameWorldEventCanonical` envelope split.
16
+ - Explicitly include identity, causation, timestamps, location, visibility, participants, and schema version metadata.
17
+ - Keep event payloads typed by event family (`monster.*`, `dungeon.*`, `war.*`, `famine.*`, `surplus.*`) with a required severity/tone summary pattern.
18
+
19
+ ## Alternatives Considered
20
+
21
+ - Unstructured JSON payload contracts: rejected because of weak typing and weak replay semantics.
22
+ - Reusing generic graph envelopes: rejected because gameplay semantics require richer visibility and actor metadata.
23
+
24
+ ## Consequences
25
+
26
+ - Consumers can filter by event family, actor role, and visibility class.
27
+ - Canonical storage and downstream projections stay deterministic and testable.
@@ -0,0 +1,29 @@
1
+ # ADR-0002: Game AI Task Contracts and Speech Cache Safety
2
+
3
+ - Date: 2026-05-14
4
+ - Status: Accepted
5
+
6
+ ## Context
7
+
8
+ The `@plasius/ai-game` package began as a package boundary scaffold while `#266` and `#273` were still open. The implementation needed concrete, testable contracts for:
9
+
10
+ - player-action validation intents
11
+ - NPC action/dialogue/gossip/governance task types
12
+ - gameplay authority boundaries for high-impact outcomes
13
+ - player-address text handling before speech render to control cache reuse
14
+
15
+ ## Decision
16
+
17
+ The package now exports stable contracts for:
18
+
19
+ - deterministic task classification from free text (`classifyAiGameTask`)
20
+ - batched task resolution for actor-role-aware workflow gating (`resolveAiGameTaskBatch`)
21
+ - player-address redaction + TTS cache decisioning (`resolveAiGamePlayerAddressText`)
22
+
23
+ `ai.game-agentic-workloads.enabled` is the primary feature gate for all task resolution decisions. Existing speech-feature flags are surfaced for cache behavior alignment but do not change the package boundary contract.
24
+
25
+ ## Consequences
26
+
27
+ - Consumers receive a single point of contract for gameplay task risk classes and fallback paths.
28
+ - High-impact gameplay decisions are represented as deterministic/operator-review/blocked outcomes, enabling explicit human fallback.
29
+ - Default speech payloads remove player/account identifiers before cache reuse decisions.
@@ -0,0 +1,28 @@
1
+ # ADR-0003: Authoritative ingestion, append-only ledger, and projector interfaces
2
+
3
+ ## Status
4
+
5
+ - Accepted
6
+ - Date: 2026-05-14
7
+ - Version: 1.0
8
+
9
+ ## Context
10
+
11
+ Candidate submissions and canonical events must remain authoritative and replay-safe for downstream consumers.
12
+
13
+ ## Decision
14
+
15
+ - Split contract into candidate and canonical forms.
16
+ - Add validation receipt and commit interfaces for candidate flow.
17
+ - Add projector-facing checkpoint interfaces to represent deterministic replay progress independent of domain-specific storage.
18
+ - Require downstream consumers to use explicit checkpoint stores instead of implicit idempotency assumptions.
19
+
20
+ ## Alternatives Considered
21
+
22
+ - Immediate-upsert-only persistence: rejected because it cannot support strict replay/validation guarantees.
23
+ - No explicit checkpoint contracts: rejected due auditability and restart safety needs.
24
+
25
+ ## Consequences
26
+
27
+ - Ingestion paths can clearly distinguish accepted vs pending candidate events.
28
+ - Replay behavior is explicit and can be shared via generic graph primitives.
@@ -0,0 +1,27 @@
1
+ # ADR-0004: Incident lifecycle, resolution, and world impact vectors
2
+
3
+ ## Status
4
+
5
+ - Accepted
6
+ - Date: 2026-05-14
7
+ - Version: 1.0
8
+
9
+ ## Context
10
+
11
+ Long-lived world effects (war, famine, supply disruptions) need stable lifecycle and impact modeling.
12
+
13
+ ## Decision
14
+
15
+ - Represent incidents with explicit lifecycle states and resolution metadata.
16
+ - Define a bounded numeric impact vector with clamped values and scope.
17
+ - Include source event references and optional superseding links to preserve causality.
18
+
19
+ ## Alternatives Considered
20
+
21
+ - Event-only logging without explicit incidents: rejected because downstream analytics and gameplay effects need stateful summaries.
22
+ - Ad-hoc numeric metadata maps: rejected in favor of constrained impact vectors.
23
+
24
+ ## Consequences
25
+
26
+ - Incident queries can identify active/resolved/superseded/expired state consistently.
27
+ - Impact ordering and deterministic ranking can be implemented from a shared contract.
@@ -0,0 +1,26 @@
1
+ # ADR-0005: Structured gossip topics as output boundary
2
+
3
+ ## Status
4
+
5
+ - Accepted
6
+ - Date: 2026-05-14
7
+ - Version: 1.0
8
+
9
+ ## Context
10
+
11
+ NPC dialogue must be driven from structured content, not pre-rendered prose.
12
+
13
+ ## Decision
14
+
15
+ - Define gossip topics with source references, certainty, salience, certainty and speech hints.
16
+ - Model source lineage and expiry explicitly so downstream generators can choose rendering shape.
17
+
18
+ ## Alternatives Considered
19
+
20
+ - Pre-generated dialogue strings as contract: rejected to avoid localization and moderation lock-in.
21
+ - Domain-agnostic freeform payload: rejected because moderation and projection rules become inconsistent.
22
+
23
+ ## Consequences
24
+
25
+ - Dialogue/NPC rendering can generate language locally and safely from structured facts.
26
+ - Source/event linkage remains stable across systems.
@@ -0,0 +1,27 @@
1
+ # ADR-0006: Perspective-gated relative knowledge projection
2
+
3
+ ## Status
4
+
5
+ - Accepted
6
+ - Date: 2026-05-14
7
+ - Version: 1.0
8
+
9
+ ## Context
10
+
11
+ Gossip needs to be constrained by locality, faction, and witness confidence.
12
+
13
+ ## Decision
14
+
15
+ - Add projection envelopes for segment and NPC modes.
16
+ - Require witness channels, locality, faction, and relationship context as first-class fields.
17
+ - Require confidence and audience segment controls before topic becomes visible in an NPC projection.
18
+
19
+ ## Alternatives Considered
20
+
21
+ - Global visibility model: rejected to prevent omniscience and data leakage.
22
+ - Ad-hoc projection filtering in consumers: rejected because this logic belongs in a shared contract boundary.
23
+
24
+ ## Consequences
25
+
26
+ - Projection rules are testable and centrally documented.
27
+ - Consumers can enforce “secret/non-public” states without duplicating domain-specific checks.
@@ -0,0 +1,27 @@
1
+ # ADR-0007: Gossip spread, decay, correction, and resolution
2
+
3
+ ## Status
4
+
5
+ - Accepted
6
+ - Date: 2026-05-14
7
+ - Version: 1.0
8
+
9
+ ## Context
10
+
11
+ Rumors should decay, be corrected, and resolve with preserved lineage.
12
+
13
+ ## Decision
14
+
15
+ - Add explicit topic statuses for active, corrected, resolved, and stale topics.
16
+ - Preserve lineage through replacement/supersession references.
17
+ - Expose expiration windows and projection status to allow deterministic age-based behavior.
18
+
19
+ ## Alternatives Considered
20
+
21
+ - Blind overwrite of prior topics: rejected because it loses correction/audit trace.
22
+ - Hard delete on correction: rejected because consumers need traceability and rollbacks.
23
+
24
+ ## Consequences
25
+
26
+ - Gossip pipelines can model correction and resolution without ambiguity.
27
+ - Consumers can report or render rumor lineage and freshness metadata.
@@ -0,0 +1,36 @@
1
+ # ADR-0008: Quiet Measure public contracts and hidden runtime boundary
2
+
3
+ ## Status
4
+
5
+ - Accepted
6
+ - Date: 2026-05-14
7
+ - Version: 1.0
8
+
9
+ ## Context
10
+
11
+ The Isekai Player System needs a hidden character-inference layer that can shape missions, social reactions, and explicit Judgment rituals.
12
+
13
+ That layer must be discoverable through the public `@plasius/ai-*` package family for developers, evaluators, and deep players, but runtime hosts must not be forced into exposing raw hidden metrics as an ordinary UI feature.
14
+
15
+ ## Decision
16
+
17
+ - Reserve `@plasius/ai-game` as the public contract boundary for Quiet Measure concepts, including hidden axes, evidence summaries, mission-probe archetypes, Judgment request/response models, and caste-title descriptors.
18
+ - Keep raw per-player scores, private inference weights, evidence retention strategy, and host-specific disclosure policy outside the public contract package.
19
+ - Model the difference between System-scoped truth and NPC/faction-scoped observed reputation explicitly so hosts do not collapse omniscient judgment into every consumer.
20
+ - Prefer structured verdicts and reason codes over freeform alignment prose in public contracts.
21
+ - Keep evaluation fixtures and regression datasets for hero-villain-mask classification in `@plasius/ai-evals` rather than embedding them into `@plasius/ai-game`.
22
+
23
+ ## Alternatives Considered
24
+
25
+ - Keep Quiet Measure entirely private with no public contracts:
26
+ - rejected because cross-package integration, public discoverability, and downstream tooling become inconsistent.
27
+ - Publish raw runtime score storage models:
28
+ - rejected because hosts need freedom to keep player-specific hidden data private and nondisplayed.
29
+ - Put the feature primarily in `@plasius/ai` instead of `@plasius/ai-game`:
30
+ - rejected because the domain concepts are game-specific rather than generic capability contracts.
31
+
32
+ ## Consequences
33
+
34
+ - Deep technical consumers can discover that the hidden system exists without receiving a turnkey visible morality meter.
35
+ - Host applications can implement different storage, privacy, and disclosure policies while sharing one canonical contract vocabulary.
36
+ - `@plasius/ai-evals` becomes the natural home for regression fixtures that test fake heroes, fake villains, tyrants, protectors, and redemption arcs.
@@ -1,3 +1,10 @@
1
1
  # Architecture Decision Records
2
2
 
3
3
  - [ADR-0001: @plasius/ai-game Package Boundary](./adr-0001-package-boundary.md)
4
+ - [ADR-0002: Canonical world event envelope and classification](./adr-0002-canonical-world-event-envelope-and-classification.md)
5
+ - [ADR-0003: Authoritative ingestion, append-only ledger, and projector interfaces](./adr-0003-authoritative-ingestion-append-only-ledger-and-projections.md)
6
+ - [ADR-0004: Incident lifecycle, resolution, and world impact vectors](./adr-0004-incident-lifecycle-resolution-and-world-impact.md)
7
+ - [ADR-0005: Structured gossip topics as the output boundary](./adr-0005-structured-gossip-topics-as-the-output-boundary.md)
8
+ - [ADR-0006: Perspective-gated relative knowledge projection](./adr-0006-perspective-gated-relative-knowledge-projection.md)
9
+ - [ADR-0007: Gossip spread, decay, correction, and resolution](./adr-0007-gossip-spread-decay-correction-and-resolution.md)
10
+ - [ADR-0008: Quiet Measure public contracts and hidden runtime boundary](./adr-0008-quiet-measure-public-contracts-and-hidden-runtime-boundary.md)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasius/ai-game",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Game-domain AI contracts for player action validation, NPC actions, gossip, and feedback.",
5
5
  "type": "module",
6
6
  "sideEffects": false,