@sharpee/if-domain 5.3.2 → 5.4.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.
package/endings.d.ts CHANGED
@@ -7,7 +7,7 @@
7
7
  * emitters build the events with existing primitives.
8
8
  *
9
9
  * Public interface: `StoryEndingEvents`, `STORY_ENDING_FLAG`,
10
- * `StoryEndingKind`, `IStoryEndingData`.
10
+ * `StoryEndingKind`, `IStoryEndingData`, `IStoryEnding`.
11
11
  *
12
12
  * Owner context: `@sharpee/if-domain` — shared by the story-loader (emits on
13
13
  * `win`/`lose`), the engine/clients (react to endings), and transcript tests
@@ -25,9 +25,14 @@ export declare const StoryEndingEvents: {
25
25
  /** How a story ended. */
26
26
  export type StoryEndingKind = 'victory' | 'defeat';
27
27
  /**
28
- * World-state key holding the ending once one is reached (a
29
- * `StoryEndingKind`), or unset while play continues. The generic
30
- * `isComplete()` reads this key; stories never implement completion logic.
28
+ * World-state key that once held the ending.
29
+ *
30
+ * **Superseded by {@link IStoryEnding}** (ADR-347 D2a), which is a real
31
+ * `WorldModel` member rather than a key in an untyped state bag. Nothing
32
+ * reads or writes this key any more — the constant survives only because
33
+ * this file's values are frozen contract. Do not reach for it: an ending
34
+ * recorded here is invisible to the engine, the scheduler and every
35
+ * client.
31
36
  */
32
37
  export declare const STORY_ENDING_FLAG = "story.ending";
33
38
  /** Payload carried by a `StoryEndingEvents` event. */
@@ -36,4 +41,35 @@ export interface IStoryEndingData {
36
41
  /** Message ID of the ending phrase, when the author supplied one. */
37
42
  messageId?: string;
38
43
  }
44
+ /**
45
+ * The ending a story reached, or absent while play continues (ADR-347 D1, D2d).
46
+ *
47
+ * A story that has not ended carries no Ending — which is a different
48
+ * statement from "carries an Ending that says nothing". Once written it is
49
+ * final: the first ending wins (`endStory`'s rejection rule), so a reader
50
+ * may treat `turn` as the turn the conclusion actually happened on.
51
+ */
52
+ export interface IStoryEnding {
53
+ /** Victory or defeat. */
54
+ readonly kind: StoryEndingKind;
55
+ /**
56
+ * The turn the story ended on.
57
+ *
58
+ * Required, so a client can always say *when* and a save can always say
59
+ * whether the ending it carries is the one it was written at. The world
60
+ * holds no turn counter, so the declaring site supplies it — Chord's
61
+ * runtime has `turnNow`, the engine's stages have `context.turn`. A
62
+ * headless Chord run with no engine turn provider wired records `0`,
63
+ * which is `turnNow`'s existing fallback and the same answer timers get.
64
+ */
65
+ readonly turn: number;
66
+ /**
67
+ * Message ID of the ending phrase, when the author supplied one. It
68
+ * identifies the phrase; it does not render it (GH #274) — same rule as
69
+ * {@link IStoryEndingData.messageId}.
70
+ */
71
+ readonly messageId?: string;
72
+ /** Free-form cause, e.g. the `cause` a player death carried. */
73
+ readonly cause?: string;
74
+ }
39
75
  //# sourceMappingURL=endings.d.ts.map
package/endings.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"endings.d.ts","sourceRoot":"","sources":["../../../../../../work/sharpee/sharpee/packages/if-domain/src/endings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,sDAAsD;AACtD,eAAO,MAAM,iBAAiB;IAC5B,0EAA0E;;IAE1E,2EAA2E;;CAEnE,CAAC;AAEX,yBAAyB;AACzB,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEnD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,sDAAsD;AACtD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,eAAe,CAAC;IACxB,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"}
1
+ {"version":3,"file":"endings.d.ts","sourceRoot":"","sources":["../../../../../../work/sharpee/sharpee/packages/if-domain/src/endings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,sDAAsD;AACtD,eAAO,MAAM,iBAAiB;IAC5B,0EAA0E;;IAE1E,2EAA2E;;CAEnE,CAAC;AAEX,yBAAyB;AACzB,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEnD;;;;;;;;;GASG;AACH,eAAO,MAAM,iBAAiB,iBAAiB,CAAC;AAEhD,sDAAsD;AACtD,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,eAAe,CAAC;IACxB,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,yBAAyB;IACzB,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAE/B;;;;;;;;;OASG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAE5B,gEAAgE;IAChE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB"}
package/endings.js CHANGED
@@ -8,7 +8,7 @@
8
8
  * emitters build the events with existing primitives.
9
9
  *
10
10
  * Public interface: `StoryEndingEvents`, `STORY_ENDING_FLAG`,
11
- * `StoryEndingKind`, `IStoryEndingData`.
11
+ * `StoryEndingKind`, `IStoryEndingData`, `IStoryEnding`.
12
12
  *
13
13
  * Owner context: `@sharpee/if-domain` — shared by the story-loader (emits on
14
14
  * `win`/`lose`), the engine/clients (react to endings), and transcript tests
@@ -26,9 +26,14 @@ exports.StoryEndingEvents = {
26
26
  DEFEAT: 'story.defeat',
27
27
  };
28
28
  /**
29
- * World-state key holding the ending once one is reached (a
30
- * `StoryEndingKind`), or unset while play continues. The generic
31
- * `isComplete()` reads this key; stories never implement completion logic.
29
+ * World-state key that once held the ending.
30
+ *
31
+ * **Superseded by {@link IStoryEnding}** (ADR-347 D2a), which is a real
32
+ * `WorldModel` member rather than a key in an untyped state bag. Nothing
33
+ * reads or writes this key any more — the constant survives only because
34
+ * this file's values are frozen contract. Do not reach for it: an ending
35
+ * recorded here is invisible to the engine, the scheduler and every
36
+ * client.
32
37
  */
33
38
  exports.STORY_ENDING_FLAG = 'story.ending';
34
39
  //# sourceMappingURL=endings.js.map
package/endings.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"endings.js","sourceRoot":"","sources":["../../../../../../work/sharpee/sharpee/packages/if-domain/src/endings.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,sDAAsD;AACzC,QAAA,iBAAiB,GAAG;IAC/B,0EAA0E;IAC1E,OAAO,EAAE,eAAe;IACxB,2EAA2E;IAC3E,MAAM,EAAE,cAAc;CACd,CAAC;AAKX;;;;GAIG;AACU,QAAA,iBAAiB,GAAG,cAAc,CAAC"}
1
+ {"version":3,"file":"endings.js","sourceRoot":"","sources":["../../../../../../work/sharpee/sharpee/packages/if-domain/src/endings.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;;AAEH,sDAAsD;AACzC,QAAA,iBAAiB,GAAG;IAC/B,0EAA0E;IAC1E,OAAO,EAAE,eAAe;IACxB,2EAA2E;IAC3E,MAAM,EAAE,cAAc;CACd,CAAC;AAKX;;;;;;;;;GASG;AACU,QAAA,iBAAiB,GAAG,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sharpee/if-domain",
3
- "version": "5.3.2",
3
+ "version": "5.4.0",
4
4
  "description": "Core domain model and contracts for Sharpee Interactive Fiction Platform",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -12,8 +12,8 @@
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "@sharpee/core": "^5.3.2",
16
- "@sharpee/text-blocks": "^5.3.2"
15
+ "@sharpee/core": "^5.4.0",
16
+ "@sharpee/text-blocks": "^5.4.0"
17
17
  },
18
18
  "keywords": [
19
19
  "interactive-fiction",
package/prompt.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  * The prompt is a channel primitive (FyreVM heritage). Each prompt is a named
5
5
  * constant with a messageId resolved through the language provider.
6
6
  *
7
- * @public GamePrompt, DefaultPrompt, PROMPT_STATE_KEY
7
+ * @public GamePrompt, DefaultPrompt, EndGamePrompt, PROMPT_STATE_KEY
8
8
  * @context if-domain (platform-level type)
9
9
  */
10
10
  /**
@@ -26,6 +26,15 @@ export interface GamePrompt {
26
26
  * Resolves to '> ' via lang-en-us registration of 'if.platform.prompt'.
27
27
  */
28
28
  export declare const DefaultPrompt: GamePrompt;
29
+ /**
30
+ * The prompt shown once the story has ended (ADR-347 D3a).
31
+ *
32
+ * Derived from the world's Ending rather than stored, so it overrides
33
+ * whatever prompt the story last set: at an end-game prompt the story's
34
+ * own prompt is the wrong one. Resolves to the end-game prompt text via
35
+ * lang-en-us's registration of `if.platform.prompt.ended`.
36
+ */
37
+ export declare const EndGamePrompt: GamePrompt;
29
38
  /**
30
39
  * World state key for storing the active prompt.
31
40
  */
package/prompt.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../../../work/sharpee/sharpee/packages/if-domain/src/prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB,mDAAmD;IACnD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,oDAAoD;IACpD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,UAAgD,CAAC;AAE7E;;GAEG;AACH,eAAO,MAAM,gBAAgB,cAAc,CAAC"}
1
+ {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../../../../../work/sharpee/sharpee/packages/if-domain/src/prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB,mDAAmD;IACnD,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,oDAAoD;IACpD,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC3C;AAED;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,UAAgD,CAAC;AAE7E;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,EAAE,UAAsD,CAAC;AAEnF;;GAEG;AACH,eAAO,MAAM,gBAAgB,cAAc,CAAC"}
package/prompt.js CHANGED
@@ -5,16 +5,25 @@
5
5
  * The prompt is a channel primitive (FyreVM heritage). Each prompt is a named
6
6
  * constant with a messageId resolved through the language provider.
7
7
  *
8
- * @public GamePrompt, DefaultPrompt, PROMPT_STATE_KEY
8
+ * @public GamePrompt, DefaultPrompt, EndGamePrompt, PROMPT_STATE_KEY
9
9
  * @context if-domain (platform-level type)
10
10
  */
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.PROMPT_STATE_KEY = exports.DefaultPrompt = void 0;
12
+ exports.PROMPT_STATE_KEY = exports.EndGamePrompt = exports.DefaultPrompt = void 0;
13
13
  /**
14
14
  * Platform default prompt.
15
15
  * Resolves to '> ' via lang-en-us registration of 'if.platform.prompt'.
16
16
  */
17
17
  exports.DefaultPrompt = { messageId: 'if.platform.prompt' };
18
+ /**
19
+ * The prompt shown once the story has ended (ADR-347 D3a).
20
+ *
21
+ * Derived from the world's Ending rather than stored, so it overrides
22
+ * whatever prompt the story last set: at an end-game prompt the story's
23
+ * own prompt is the wrong one. Resolves to the end-game prompt text via
24
+ * lang-en-us's registration of `if.platform.prompt.ended`.
25
+ */
26
+ exports.EndGamePrompt = { messageId: 'if.platform.prompt.ended' };
18
27
  /**
19
28
  * World state key for storing the active prompt.
20
29
  */
package/prompt.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../../work/sharpee/sharpee/packages/if-domain/src/prompt.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAiBH;;;GAGG;AACU,QAAA,aAAa,GAAe,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC;AAE7E;;GAEG;AACU,QAAA,gBAAgB,GAAG,WAAW,CAAC"}
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../../../../../work/sharpee/sharpee/packages/if-domain/src/prompt.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAiBH;;;GAGG;AACU,QAAA,aAAa,GAAe,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAAC;AAE7E;;;;;;;GAOG;AACU,QAAA,aAAa,GAAe,EAAE,SAAS,EAAE,0BAA0B,EAAE,CAAC;AAEnF;;GAEG;AACU,QAAA,gBAAgB,GAAG,WAAW,CAAC"}