@gridlock/orchestrator 0.1.0 → 0.2.0

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.
Files changed (39) hide show
  1. package/dist/InteractionEvaluator.d.ts.map +1 -1
  2. package/dist/InteractionEvaluator.js +26 -0
  3. package/dist/InteractionEvaluator.js.map +1 -1
  4. package/dist/InteractionSeed.d.ts +43 -0
  5. package/dist/InteractionSeed.d.ts.map +1 -0
  6. package/dist/InteractionSeed.js +57 -0
  7. package/dist/InteractionSeed.js.map +1 -0
  8. package/dist/InventoryLedger.d.ts +58 -0
  9. package/dist/InventoryLedger.d.ts.map +1 -0
  10. package/dist/InventoryLedger.js +64 -0
  11. package/dist/InventoryLedger.js.map +1 -0
  12. package/dist/PlayerTurnLog.d.ts +78 -0
  13. package/dist/PlayerTurnLog.d.ts.map +1 -0
  14. package/dist/PlayerTurnLog.js +58 -0
  15. package/dist/PlayerTurnLog.js.map +1 -0
  16. package/dist/ReleaseConditions.d.ts +41 -0
  17. package/dist/ReleaseConditions.d.ts.map +1 -0
  18. package/dist/ReleaseConditions.js +86 -0
  19. package/dist/ReleaseConditions.js.map +1 -0
  20. package/dist/evaluation/Deadlines.d.ts +96 -0
  21. package/dist/evaluation/Deadlines.d.ts.map +1 -0
  22. package/dist/evaluation/Deadlines.js +94 -0
  23. package/dist/evaluation/Deadlines.js.map +1 -0
  24. package/dist/evaluation/index.d.ts +2 -0
  25. package/dist/evaluation/index.d.ts.map +1 -1
  26. package/dist/evaluation/index.js +1 -0
  27. package/dist/evaluation/index.js.map +1 -1
  28. package/dist/handlers/IntentInterpreter.d.ts +140 -0
  29. package/dist/handlers/IntentInterpreter.d.ts.map +1 -0
  30. package/dist/handlers/IntentInterpreter.js +90 -0
  31. package/dist/handlers/IntentInterpreter.js.map +1 -0
  32. package/dist/index.d.ts +10 -0
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +11 -0
  35. package/dist/index.js.map +1 -1
  36. package/dist/types.d.ts +80 -1
  37. package/dist/types.d.ts.map +1 -1
  38. package/dist/types.js.map +1 -1
  39. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"InteractionEvaluator.d.ts","sourceRoot":"","sources":["../src/InteractionEvaluator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAErF;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,sBAAsB,CAAC;IAC9B,+CAA+C;IAC/C,aAAa,EAAE,MAAM,YAAY,GAAG,IAAI,CAAC;IACzC,uGAAuG;IACvG,aAAa,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,kBAAkB,GAAG,MAAM,CAAC;CAC5F;AAOD,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAMlE;AAcD,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAClC,eAAO,MAAM,mBAAmB,IAAI,CAAC;AAErC;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAKlD,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,iBAAiB,EACzB,KAAK,EAAE,sBAAsB,EAC7B,WAAW,CAAC,EAAE,oBAAoB,GACjC,iBAAiB,CAiHnB;AA2CD,yDAAyD;AACzD,wBAAgB,gBAAgB,CAC9B,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IA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AAQ,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,EAC9E,KAAK,CAAC,EAAE;IAAE,aAAa,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,GACxD,oBAAoB,CAWtB"}
@@ -153,6 +153,32 @@ export function evaluateInteraction(signal, state, riceProfile) {
153
153
  newState.rapport = Math.min(10, newState.rapport + 1);
154
154
  }
155
155
  }
156
+ else if (signal.subtype === 'item_gift') {
157
+ // #1872 MS-27b — RICE-dimension-aware item gift sourced from a
158
+ // shopItem entry. The handler synthesises a signal with
159
+ // `riceDimensionOverride` set to the engine-side mapping of the
160
+ // item's authored dimension (TIC's `reward → incentive`,
161
+ // `ideology → rapport`, `coercion → coercion`, `ego → ego`) and
162
+ // `intensity` set to the item's `riceIntensity` (0–1). The base
163
+ // gain of 2.5 mirrors `gift_high` so a riceIntensity=1.0 item
164
+ // matches the legacy abstract path; lower values scale down.
165
+ const targetDim = signal.riceDimensionOverride ?? 'incentive';
166
+ riceDimension = targetDim;
167
+ const profileVal = profile[targetDim];
168
+ const itemMultiplier = getSensitivityMultiplier(profileVal);
169
+ effectiveness = getEffectivenessLabel(profileVal);
170
+ if (itemMultiplier === 0.0) {
171
+ // Backfire: dimension is immune — perceived as bribe.
172
+ newState.trust = Math.max(1, newState.trust - 1);
173
+ }
174
+ else {
175
+ const intensityScale = Math.max(0, Math.min(1, signal.intensity ?? 1));
176
+ const baseGain = 2.5 * intensityScale;
177
+ const gain = Math.min(MAX_PER_ACTION_GAIN, Math.max(1, Math.round(baseGain * itemMultiplier)));
178
+ newState.riceProgress[targetDim] = Math.min(10, newState.riceProgress[targetDim] + gain);
179
+ newState.rapport = Math.min(10, newState.rapport + 1);
180
+ }
181
+ }
156
182
  }
157
183
  // Derive unblockScore from baseline + best RICE progress
158
184
  newState.unblockScore = _deriveUnblockScore(newState.ri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A8E,EAC9E,KAAyD;IAEzD,MAAM,gBAAgB,GAAG,CAAC,KAAK,EAAE,aAAa,IAAI,IAAI,IAAI,KAAK,EAAE,YAAY,IAAI,IAAI,CAAC;QACpF,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC,CAAC;IAEN,OAAO;QACL,OAAO,EAAE,gBAAgB;QACzB,SAAS,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;QAC5B,QAAQ,EAAE,IAAI,EAAE,QAAQ,IAAI,CAAC;QAC7B,GAAG,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC;KACpB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * InteractionSeed — engine-generic seed deltas for `DomainInteractionState`
3
+ * at case start (Gridlock MS-26 Pillar 2 seam, TIC issue #1289).
4
+ *
5
+ * Engine-generic: knows nothing about bonds, RICE tactics, or case vocabulary.
6
+ * Hosts produce an `InteractionSeed` from whatever inter-case relationship
7
+ * state they track (TIC uses a `BondRecord`; other games can use anything
8
+ * else) and call `applyInteractionSeed(state, seed)` when a fresh
9
+ * `DomainInteractionState` is created for a (player, character) pair at
10
+ * case start.
11
+ *
12
+ * Core-Configure: the engine defines the seed shape and the pure apply
13
+ * function. Hosts supply the mapping from their own relationship state.
14
+ */
15
+ import type { DomainInteractionState } from './types.js';
16
+ /**
17
+ * Per-dimension deltas applied on top of the zero/baseline
18
+ * `DomainInteractionState`. All fields are optional — omitted
19
+ * dimensions stay at baseline.
20
+ *
21
+ * Deltas are in the engine's native units (same scale as the fields
22
+ * on `DomainInteractionState`). Callers are responsible for producing
23
+ * deltas that make sense at the engine scale; `applyInteractionSeed`
24
+ * clamps the resulting absolute values into engine-valid ranges.
25
+ */
26
+ export interface InteractionSeed {
27
+ /** Shifts `unblockScore` baseline up (cooperative) or down (closed off). */
28
+ unblockScoreDelta?: number;
29
+ /** Shifts `trust` baseline. */
30
+ trustDelta?: number;
31
+ /** Shifts `hostility` baseline. */
32
+ hostilityDelta?: number;
33
+ /** Shifts `rapport` baseline. */
34
+ rapportDelta?: number;
35
+ }
36
+ /**
37
+ * Pure function. Returns a new `DomainInteractionState` with seed deltas
38
+ * applied on top of the input state. Input is not mutated.
39
+ *
40
+ * Zero-seed (no fields set) is a no-op: returns a shallow clone.
41
+ */
42
+ export declare function applyInteractionSeed(state: DomainInteractionState, seed: InteractionSeed): DomainInteractionState;
43
+ //# sourceMappingURL=InteractionSeed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InteractionSeed.d.ts","sourceRoot":"","sources":["../src/InteractionSeed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzD;;;;;;;;;GASG;AACH,MAAM,WAAW,eAAe;IAC9B,4EAA4E;IAC5E,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,+BAA+B;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mCAAmC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iCAAiC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAyBD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,sBAAsB,EAC7B,IAAI,EAAE,eAAe,GACpB,sBAAsB,CAiBxB"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * InteractionSeed — engine-generic seed deltas for `DomainInteractionState`
3
+ * at case start (Gridlock MS-26 Pillar 2 seam, TIC issue #1289).
4
+ *
5
+ * Engine-generic: knows nothing about bonds, RICE tactics, or case vocabulary.
6
+ * Hosts produce an `InteractionSeed` from whatever inter-case relationship
7
+ * state they track (TIC uses a `BondRecord`; other games can use anything
8
+ * else) and call `applyInteractionSeed(state, seed)` when a fresh
9
+ * `DomainInteractionState` is created for a (player, character) pair at
10
+ * case start.
11
+ *
12
+ * Core-Configure: the engine defines the seed shape and the pure apply
13
+ * function. Hosts supply the mapping from their own relationship state.
14
+ */
15
+ /**
16
+ * Clamp ranges match the rest of `InteractionEvaluator`:
17
+ * trust / hostility / rapport ∈ [0, 10]
18
+ * unblockScore — free-float, but clamped to [-10, 10] here to avoid
19
+ * runaway seeds.
20
+ */
21
+ const RANGES = {
22
+ unblockScoreDelta: { min: -10, max: 10, field: 'unblockScore' },
23
+ trustDelta: { min: 0, max: 10, field: 'trust' },
24
+ hostilityDelta: { min: 0, max: 10, field: 'hostility' },
25
+ rapportDelta: { min: 0, max: 10, field: 'rapport' },
26
+ };
27
+ function clamp(value, min, max) {
28
+ if (Number.isNaN(value))
29
+ return 0;
30
+ if (value < min)
31
+ return min;
32
+ if (value > max)
33
+ return max;
34
+ return value;
35
+ }
36
+ /**
37
+ * Pure function. Returns a new `DomainInteractionState` with seed deltas
38
+ * applied on top of the input state. Input is not mutated.
39
+ *
40
+ * Zero-seed (no fields set) is a no-op: returns a shallow clone.
41
+ */
42
+ export function applyInteractionSeed(state, seed) {
43
+ const next = {
44
+ ...state,
45
+ riceProgress: { ...state.riceProgress },
46
+ recentSignals: [...state.recentSignals],
47
+ };
48
+ for (const key of Object.keys(RANGES)) {
49
+ const delta = seed[key];
50
+ if (typeof delta !== 'number' || delta === 0 || Number.isNaN(delta))
51
+ continue;
52
+ const { min, max, field } = RANGES[key];
53
+ next[field] = clamp(state[field] + delta, min, max);
54
+ }
55
+ return next;
56
+ }
57
+ //# sourceMappingURL=InteractionSeed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InteractionSeed.js","sourceRoot":"","sources":["../src/InteractionSeed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAyBH;;;;;GAKG;AACH,MAAM,MAAM,GAGR;IACF,iBAAiB,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,K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K,CAAY,GAAG,KAAK,EAChC,GAAG,EACH,GAAG,CACK,CAAC;IACb,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * InventoryLedger — engine-generic per-player item inventory.
3
+ *
4
+ * Pure data structure: `playerId → itemId → count`. The engine itself
5
+ * never reads this ledger; it exists to give product layers (TIC's
6
+ * `/gift` is the first consumer) a place to grant items at case-load,
7
+ * deduct them on gift-consumption, and read back the current balance
8
+ * for UI/help surfaces.
9
+ *
10
+ * Wiring: the orchestrator accepts an optional `inventoryLedger` via
11
+ * `OrchestratorOptions`. When absent, no inventory bookkeeping happens
12
+ * and there is zero overhead. When present, engine handlers call
13
+ * `grant(...)` / `consume(...)` / `getInventory(...)` directly. Hosts
14
+ * that want persistence wrap an `InMemoryInventoryLedger` with a
15
+ * write-through implementation that mirrors to durable storage.
16
+ *
17
+ * Engine-generic on purpose: the `InventoryStore` contract in
18
+ * `@gridlock/economy` (#1874) reuses the same shape so the OfferEngine
19
+ * can deduct tokens and grant items as a single transactional pair —
20
+ * TIC composes by passing this implementation as the OfferEngine's
21
+ * inventory backing.
22
+ *
23
+ * MS-27b #1872 (TIC #1498 child b).
24
+ */
25
+ export interface InventoryLedger {
26
+ /**
27
+ * Add `count` of `itemId` to `playerId`'s inventory. `count` defaults
28
+ * to 1 to match the gift-acquisition idiom. Negative counts throw —
29
+ * this is grant-only; deductions go through `consume`.
30
+ */
31
+ grant(playerId: string, itemId: string, count?: number): void;
32
+ /**
33
+ * Remove one `itemId` from `playerId`'s inventory. Throws when the
34
+ * balance is zero — callers must check `getInventory(...)` first if
35
+ * they want a soft-fail. The throw is intentional: an unchecked
36
+ * consume is a logic bug at the call site.
37
+ */
38
+ consume(playerId: string, itemId: string): void;
39
+ /**
40
+ * Snapshot of `playerId`'s current inventory as a plain
41
+ * `itemId → count` map. Returns an empty object for unknown players.
42
+ * Callers MUST treat the result as read-only.
43
+ */
44
+ getInventory(playerId: string): Record<string, number>;
45
+ }
46
+ /**
47
+ * Default in-memory implementation. Loses all entries on process
48
+ * restart — apps/api production wraps this with a SQLite write-through
49
+ * (or a per-session pool, since inventory is intentionally case-scoped
50
+ * for the MVP).
51
+ */
52
+ export declare class InMemoryInventoryLedger implements InventoryLedger {
53
+ private readonly entries;
54
+ grant(playerId: string, itemId: string, count?: number): void;
55
+ consume(playerId: string, itemId: string): void;
56
+ getInventory(playerId: string): Record<string, number>;
57
+ }
58
+ //# sourceMappingURL=InventoryLedger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InventoryLedger.d.ts","sourceRoot":"","sources":["../src/InventoryLedger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE9D;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhD;;;;OAIG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxD;AAED;;;;;GAKG;AACH,qBAAa,uBAAwB,YAAW,eAAe;IAC7D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0C;IAElE,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,GAAE,MAAU,GAAG,IAAI;IAchE,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAe/C,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAKvD"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * InventoryLedger — engine-generic per-player item inventory.
3
+ *
4
+ * Pure data structure: `playerId → itemId → count`. The engine itself
5
+ * never reads this ledger; it exists to give product layers (TIC's
6
+ * `/gift` is the first consumer) a place to grant items at case-load,
7
+ * deduct them on gift-consumption, and read back the current balance
8
+ * for UI/help surfaces.
9
+ *
10
+ * Wiring: the orchestrator accepts an optional `inventoryLedger` via
11
+ * `OrchestratorOptions`. When absent, no inventory bookkeeping happens
12
+ * and there is zero overhead. When present, engine handlers call
13
+ * `grant(...)` / `consume(...)` / `getInventory(...)` directly. Hosts
14
+ * that want persistence wrap an `InMemoryInventoryLedger` with a
15
+ * write-through implementation that mirrors to durable storage.
16
+ *
17
+ * Engine-generic on purpose: the `InventoryStore` contract in
18
+ * `@gridlock/economy` (#1874) reuses the same shape so the OfferEngine
19
+ * can deduct tokens and grant items as a single transactional pair —
20
+ * TIC composes by passing this implementation as the OfferEngine's
21
+ * inventory backing.
22
+ *
23
+ * MS-27b #1872 (TIC #1498 child b).
24
+ */
25
+ /**
26
+ * Default in-memory implementation. Loses all entries on process
27
+ * restart — apps/api production wraps this with a SQLite write-through
28
+ * (or a per-session pool, since inventory is intentionally case-scoped
29
+ * for the MVP).
30
+ */
31
+ export class InMemoryInventoryLedger {
32
+ entries = new Map();
33
+ grant(playerId, itemId, count = 1) {
34
+ if (!Number.isFinite(count) || count <= 0) {
35
+ throw new Error(`InventoryLedger.grant: count must be a positive number; received ${count}`);
36
+ }
37
+ let bag = this.entries.get(playerId);
38
+ if (!bag) {
39
+ bag = new Map();
40
+ this.entries.set(playerId, bag);
41
+ }
42
+ bag.set(itemId, (bag.get(itemId) ?? 0) + count);
43
+ }
44
+ consume(playerId, itemId) {
45
+ const bag = this.entries.get(playerId);
46
+ const current = bag?.get(itemId) ?? 0;
47
+ if (current <= 0) {
48
+ throw new Error(`InventoryLedger.consume: ${playerId} has no '${itemId}' to consume`);
49
+ }
50
+ if (current === 1) {
51
+ bag.delete(itemId);
52
+ }
53
+ else {
54
+ bag.set(itemId, current - 1);
55
+ }
56
+ }
57
+ getInventory(playerId) {
58
+ const bag = this.entries.get(playerId);
59
+ if (!bag)
60
+ return {};
61
+ return Object.fromEntries(bag);
62
+ }
63
+ }
64
+ //# sourceMappingURL=InventoryLedger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InventoryLedger.js","sourceRoot":"","sources":["../src/InventoryLedger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AA0BH;;;;;GAKG;AACH,MAAM,OAAO,uBAAuB;IACjB,OAAO,GAAG,IAAI,GAAG,EAA+B,CAAC;IAElE,KAAK,CAAC,QAAgB,EAAE,MAAc,EAAE,QAAgB,CAAC;QACvD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;YAC1C,MAAM,IAAI,KAAK,CACb,oEAAoE,KAAK,EAAE,CAC5E,CAAC;QACJ,CAAC;QACD,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACrC,IAAI,CAAC,GAAG,EAAE,CAAC;YACT,GAAG,GAAG,IAAI,GAAG,EAAkB,CAAC;YAChC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAClC,CAAC;QACD,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC;IAClD,CAAC;IAED,OAAO,CAAC,QAAgB,EAAE,MAAc;QACtC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACvC,MAAM,OAAO,GAAG,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,OAAO,IAAI,CAAC,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CACb,4BAA4B,QAAQ,YAAY,MAAM,cAAc,CACrE,CAAC;QACJ,CAAC;QACD,IAAI,OAAO,KAAK,CAAC,EAAE,CAAC;YAClB,GAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACtB,CAAC;aAAM,CAAC;YACN,GAAI,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC;QAChC,CAAC;IACH,CAAC;IAED,YAAY,CAAC,QAAgB;QAC3B,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAI,CAAC,GAAG;YAAE,OAAO,EAAE,CAAC;QACpB,OAAO,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;CACF"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * PlayerTurnLog — engine-generic per-session record of player turns.
3
+ *
4
+ * The engine itself never reads this log. It exists to give product layers
5
+ * (TIC's Tradecraft scorer is the first consumer) a structured, replayable
6
+ * view of what the player said and what the engine said back, so post-case
7
+ * analysis can score conversational quality, cadence, mirroring, and other
8
+ * craft signals that aren't expressible as `Fact` / `Finding` entries.
9
+ *
10
+ * Shape:
11
+ *
12
+ * - Append-only. Entries are timestamped and assigned an ascending
13
+ * `turnNumber` by the implementation — callers don't pick the number.
14
+ * - `kind` is a free-form string. The engine doesn't enforce a vocabulary
15
+ * because doing so would leak product-layer verb names into engine
16
+ * code (CLAUDE.md boundary rule 8). Hosts choose their own kinds
17
+ * (TIC uses `'talk'` / `'rice'` / `'examine'` / `'accuse'` / `'sage'`).
18
+ * - `subjectId` is generic — the entity the turn addresses, if any.
19
+ * For a TIC `talk to <npc>` turn this is the npcId; for `examine`
20
+ * it's the artifactId.
21
+ * - `responseText` is optional — set when the engine produces a reply
22
+ * in the same turn (e.g. LLM dialogue). Verbs that don't reply leave
23
+ * it undefined.
24
+ *
25
+ * Wiring: the orchestrator accepts an optional `playerTurnLog` via
26
+ * `OrchestratorOptions`. When absent, no logging happens and there is
27
+ * zero overhead. When present, engine handlers call `append(...)` at the
28
+ * end of each player-driven turn. Hosts that want persistence wrap an
29
+ * `InMemoryPlayerTurnLog` with a write-through implementation that
30
+ * mirrors to durable storage.
31
+ *
32
+ * MS-26 Tradecraft Trainer Phase 1 (TIC #2030).
33
+ */
34
+ export interface PlayerTurnEntry {
35
+ /** Monotonic 1-based turn index, assigned by the implementation. */
36
+ readonly turnNumber: number;
37
+ /** Wall-clock timestamp (ms since epoch) at the moment the turn was logged. */
38
+ readonly ts: number;
39
+ /**
40
+ * Free-form kind tag. The engine does not enforce a vocabulary —
41
+ * hosts choose strings that match their verb namespace.
42
+ */
43
+ readonly kind: string;
44
+ /** The entity the turn addressed, if any (npcId, artifactId, etc.). */
45
+ readonly subjectId?: string;
46
+ /** The verbatim text the player produced. */
47
+ readonly playerText: string;
48
+ /** The verbatim text the engine produced in reply, if any. */
49
+ readonly responseText?: string;
50
+ }
51
+ /** Input to `append()` — implementation assigns `turnNumber`. */
52
+ export type PlayerTurnEntryInput = Omit<PlayerTurnEntry, 'turnNumber'>;
53
+ export interface PlayerTurnLog {
54
+ /**
55
+ * Append a new entry. Returns the full entry including the assigned
56
+ * `turnNumber`. Implementations are responsible for monotonic
57
+ * numbering — concurrent appends within a single session are not
58
+ * supported (the orchestrator processes turns serially).
59
+ */
60
+ append(entry: PlayerTurnEntryInput): PlayerTurnEntry;
61
+ /**
62
+ * Read every entry in insertion order. Used by post-case scorers.
63
+ * Implementations should return a snapshot — callers must not mutate
64
+ * the returned array.
65
+ */
66
+ list(): readonly PlayerTurnEntry[];
67
+ }
68
+ /**
69
+ * Default in-memory implementation. Loses all entries on process
70
+ * restart — apps/api production wires a write-through wrapper that
71
+ * mirrors to SQLite.
72
+ */
73
+ export declare class InMemoryPlayerTurnLog implements PlayerTurnLog {
74
+ private readonly entries;
75
+ append(entry: PlayerTurnEntryInput): PlayerTurnEntry;
76
+ list(): readonly PlayerTurnEntry[];
77
+ }
78
+ //# sourceMappingURL=PlayerTurnLog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlayerTurnLog.d.ts","sourceRoot":"","sources":["../src/PlayerTurnLog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,MAAM,WAAW,eAAe;IAC9B,oEAAoE;IACpE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,uEAAuE;IACvE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,6CAA6C;IAC7C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,8DAA8D;IAC9D,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,iEAAiE;AACjE,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,CAAC;AAEvE,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,MAAM,CAAC,KAAK,EAAE,oBAAoB,GAAG,eAAe,CAAC;IACrD;;;;OAIG;IACH,IAAI,IAAI,SAAS,eAAe,EAAE,CAAC;CACpC;AAED;;;;GAIG;AACH,qBAAa,qBAAsB,YAAW,aAAa;IACzD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;IAEjD,MAAM,CAAC,KAAK,EAAE,oBAAoB,GAAG,eAAe;IAcpD,IAAI,IAAI,SAAS,eAAe,EAAE;CAGnC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * PlayerTurnLog — engine-generic per-session record of player turns.
3
+ *
4
+ * The engine itself never reads this log. It exists to give product layers
5
+ * (TIC's Tradecraft scorer is the first consumer) a structured, replayable
6
+ * view of what the player said and what the engine said back, so post-case
7
+ * analysis can score conversational quality, cadence, mirroring, and other
8
+ * craft signals that aren't expressible as `Fact` / `Finding` entries.
9
+ *
10
+ * Shape:
11
+ *
12
+ * - Append-only. Entries are timestamped and assigned an ascending
13
+ * `turnNumber` by the implementation — callers don't pick the number.
14
+ * - `kind` is a free-form string. The engine doesn't enforce a vocabulary
15
+ * because doing so would leak product-layer verb names into engine
16
+ * code (CLAUDE.md boundary rule 8). Hosts choose their own kinds
17
+ * (TIC uses `'talk'` / `'rice'` / `'examine'` / `'accuse'` / `'sage'`).
18
+ * - `subjectId` is generic — the entity the turn addresses, if any.
19
+ * For a TIC `talk to <npc>` turn this is the npcId; for `examine`
20
+ * it's the artifactId.
21
+ * - `responseText` is optional — set when the engine produces a reply
22
+ * in the same turn (e.g. LLM dialogue). Verbs that don't reply leave
23
+ * it undefined.
24
+ *
25
+ * Wiring: the orchestrator accepts an optional `playerTurnLog` via
26
+ * `OrchestratorOptions`. When absent, no logging happens and there is
27
+ * zero overhead. When present, engine handlers call `append(...)` at the
28
+ * end of each player-driven turn. Hosts that want persistence wrap an
29
+ * `InMemoryPlayerTurnLog` with a write-through implementation that
30
+ * mirrors to durable storage.
31
+ *
32
+ * MS-26 Tradecraft Trainer Phase 1 (TIC #2030).
33
+ */
34
+ /**
35
+ * Default in-memory implementation. Loses all entries on process
36
+ * restart — apps/api production wires a write-through wrapper that
37
+ * mirrors to SQLite.
38
+ */
39
+ export class InMemoryPlayerTurnLog {
40
+ entries = [];
41
+ append(entry) {
42
+ const turnNumber = this.entries.length + 1;
43
+ const full = {
44
+ turnNumber,
45
+ ts: entry.ts,
46
+ kind: entry.kind,
47
+ playerText: entry.playerText,
48
+ ...(entry.subjectId !== undefined ? { subjectId: entry.subjectId } : {}),
49
+ ...(entry.responseText !== undefined ? { responseText: entry.responseText } : {}),
50
+ };
51
+ this.entries.push(full);
52
+ return full;
53
+ }
54
+ list() {
55
+ return this.entries.slice();
56
+ }
57
+ }
58
+ //# sourceMappingURL=PlayerTurnLog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PlayerTurnLog.js","sourceRoot":"","sources":["../src/PlayerTurnLog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAuCH;;;;GAIG;AACH,MAAM,OAAO,qBAAqB;IACf,OAAO,GAAsB,EAAE,CAAC;IAEjD,MAAM,CAAC,KAA2B;QAChC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC;QAC3C,MAAM,IAAI,GAAoB;YAC5B,UAAU;YACV,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,GAAG,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACxE,GAAG,CAAC,KAAK,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SAClF,CAAC;QACF,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IAC9B,CAAC;CACF"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Release-condition evaluation — the engine-pure half of the progress
3
+ * unlock graph (TIC EPIC #2394; moved from the product layer in the
4
+ * consolidation pass).
5
+ *
6
+ * A release condition (authored on an `unlocks` graph edge — see
7
+ * `UnlockConditionSchema` in @gridlock/schema) declares HOW gameplay
8
+ * earns the edge's target. This module evaluates conditions and matches
9
+ * topics; it holds no game state and no product vocabulary. Products
10
+ * supply the inputs (a live cooperation score, the set of topics the
11
+ * player has raised) through {@link ReleaseContext}.
12
+ */
13
+ import type { UnlockCondition } from '@gridlock/schema';
14
+ /** Per-evaluation inputs a condition can consume. */
15
+ export interface ReleaseContext {
16
+ /** The source entity's live cooperation score. */
17
+ unblockScore: number;
18
+ /** Topics the player has raised with this entity. */
19
+ topicsRaised?: ReadonlySet<string>;
20
+ }
21
+ export declare function isReleaseConditionMet(condition: UnlockCondition | undefined, ctx: ReleaseContext): boolean;
22
+ /**
23
+ * Deterministic topic matching. Topics on `asked` conditions ARE the
24
+ * matchable phrases — no separate registry. A topic matches when its
25
+ * words appear in order, on word boundaries, in the normalized message
26
+ * ("where were you that afternoon" matches topic "afternoon";
27
+ * "dialogue" does NOT match topic "log"). Fully deterministic so
28
+ * solvability stays provable — typing the topic phrase always works.
29
+ */
30
+ export declare function matchTopics(message: string, topics: readonly string[]): string[];
31
+ /**
32
+ * Derive `asked` topics from an entity's display label (#2394 default
33
+ * flip): topic 1 is the full normalized label phrase — matching it is
34
+ * always possible by naming the thing, which keeps solvability provable
35
+ * — and topics 2..n are the label's distinctive tokens (≥4 chars, not a
36
+ * stopword). Returns an empty array for labels with no usable words;
37
+ * callers MUST fall back to an always-met condition rather than emit an
38
+ * unsatisfiable `asked` edge.
39
+ */
40
+ export declare function deriveTopicsFromLabel(label: string): string[];
41
+ //# sourceMappingURL=ReleaseConditions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReleaseConditions.d.ts","sourceRoot":"","sources":["../src/ReleaseConditions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAuB,MAAM,kBAAkB,CAAC;AAE7E,qDAAqD;AACrD,MAAM,WAAW,cAAc;IAC7B,kDAAkD;IAClD,YAAY,EAAE,MAAM,CAAC;IACrB,qDAAqD;IACrD,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACpC;AAeD,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,eAAe,GAAG,SAAS,EACtC,GAAG,EAAE,cAAc,GAClB,OAAO,CAIT;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,EAAE,CAShF;AAaD;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAY7D"}
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Release-condition evaluation — the engine-pure half of the progress
3
+ * unlock graph (TIC EPIC #2394; moved from the product layer in the
4
+ * consolidation pass).
5
+ *
6
+ * A release condition (authored on an `unlocks` graph edge — see
7
+ * `UnlockConditionSchema` in @gridlock/schema) declares HOW gameplay
8
+ * earns the edge's target. This module evaluates conditions and matches
9
+ * topics; it holds no game state and no product vocabulary. Products
10
+ * supply the inputs (a live cooperation score, the set of topics the
11
+ * player has raised) through {@link ReleaseContext}.
12
+ */
13
+ function leafMet(leaf, ctx) {
14
+ switch (leaf.kind) {
15
+ case 'volunteer':
16
+ return true;
17
+ case 'cooperation':
18
+ return ctx.unblockScore >= leaf.threshold;
19
+ case 'asked':
20
+ return leaf.topics.some((t) => ctx.topicsRaised?.has(t.toLowerCase()) ?? false);
21
+ case 'finding':
22
+ return false; // validator-path condition — not satisfiable via dialogue
23
+ }
24
+ }
25
+ export function isReleaseConditionMet(condition, ctx) {
26
+ if (!condition)
27
+ return true; // unconditioned edge = volunteer semantics
28
+ if (condition.kind === 'all')
29
+ return condition.of.every((leaf) => leafMet(leaf, ctx));
30
+ return leafMet(condition, ctx);
31
+ }
32
+ /**
33
+ * Deterministic topic matching. Topics on `asked` conditions ARE the
34
+ * matchable phrases — no separate registry. A topic matches when its
35
+ * words appear in order, on word boundaries, in the normalized message
36
+ * ("where were you that afternoon" matches topic "afternoon";
37
+ * "dialogue" does NOT match topic "log"). Fully deterministic so
38
+ * solvability stays provable — typing the topic phrase always works.
39
+ */
40
+ export function matchTopics(message, topics) {
41
+ const normalized = ` ${message.toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim()} `;
42
+ return topics
43
+ .filter((topic) => {
44
+ const phrase = topic.toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();
45
+ if (phrase.length === 0)
46
+ return false;
47
+ return normalized.includes(` ${phrase} `);
48
+ })
49
+ .map((t) => t.toLowerCase());
50
+ }
51
+ /**
52
+ * Common label words that make terrible standalone topics — asking about
53
+ * "the" or "file" should not release anything. The full label phrase is
54
+ * always included, so nothing becomes unreachable through this list.
55
+ */
56
+ const TOPIC_STOPWORDS = new Set([
57
+ 'the', 'a', 'an', 'of', 'and', 'for', 'from', 'with',
58
+ 'note', 'notes', 'file', 'files', 'log', 'logs', 'record', 'records',
59
+ 'report', 'copy', 'document',
60
+ ]);
61
+ /**
62
+ * Derive `asked` topics from an entity's display label (#2394 default
63
+ * flip): topic 1 is the full normalized label phrase — matching it is
64
+ * always possible by naming the thing, which keeps solvability provable
65
+ * — and topics 2..n are the label's distinctive tokens (≥4 chars, not a
66
+ * stopword). Returns an empty array for labels with no usable words;
67
+ * callers MUST fall back to an always-met condition rather than emit an
68
+ * unsatisfiable `asked` edge.
69
+ */
70
+ export function deriveTopicsFromLabel(label) {
71
+ const phrase = label.toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();
72
+ if (phrase.length === 0)
73
+ return [];
74
+ const tokens = phrase.split(' ');
75
+ // A label made ONLY of stopwords ("Log", "the of a") yields no usable
76
+ // topics — every token would be a false-positive match magnet.
77
+ if (!tokens.some((t) => !TOPIC_STOPWORDS.has(t)))
78
+ return [];
79
+ const topics = new Set([phrase]);
80
+ for (const t of tokens) {
81
+ if (t.length >= 4 && !TOPIC_STOPWORDS.has(t))
82
+ topics.add(t);
83
+ }
84
+ return [...topics];
85
+ }
86
+ //# sourceMappingURL=ReleaseConditions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReleaseConditions.js","sourceRoot":"","sources":["../src/ReleaseConditions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GA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