@sharpee/engine 0.9.113 → 1.0.8

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 (183) hide show
  1. package/action-context-factory.d.ts +12 -4
  2. package/action-context-factory.d.ts.map +1 -1
  3. package/action-context-factory.js +32 -8
  4. package/action-context-factory.js.map +1 -1
  5. package/capability-dispatch-helper.d.ts +3 -3
  6. package/capability-dispatch-helper.d.ts.map +1 -1
  7. package/capability-dispatch-helper.js +1 -1
  8. package/command-executor.d.ts +7 -6
  9. package/command-executor.d.ts.map +1 -1
  10. package/command-executor.js +5 -5
  11. package/command-executor.js.map +1 -1
  12. package/events/event-emitter.d.ts +2 -2
  13. package/events/event-emitter.d.ts.map +1 -1
  14. package/game-engine.d.ts +93 -10
  15. package/game-engine.d.ts.map +1 -1
  16. package/game-engine.js +245 -14
  17. package/game-engine.js.map +1 -1
  18. package/index.d.ts +2 -1
  19. package/index.d.ts.map +1 -1
  20. package/index.js +3 -1
  21. package/index.js.map +1 -1
  22. package/language-provider-interface.d.ts +1 -1
  23. package/language-provider-interface.d.ts.map +1 -1
  24. package/narrative/index.d.ts.map +1 -1
  25. package/narrative/narrative-settings.d.ts +1 -1
  26. package/narrative/narrative-settings.d.ts.map +1 -1
  27. package/package.json +12 -12
  28. package/parser-interface.d.ts +2 -2
  29. package/parser-interface.d.ts.map +1 -1
  30. package/platform-operations.d.ts +2 -2
  31. package/platform-operations.d.ts.map +1 -1
  32. package/platform-operations.js +1 -1
  33. package/prose-pipeline/assemble.d.ts +77 -0
  34. package/prose-pipeline/assemble.d.ts.map +1 -0
  35. package/prose-pipeline/assemble.js +96 -0
  36. package/prose-pipeline/assemble.js.map +1 -0
  37. package/prose-pipeline/decorations/index.d.ts +18 -0
  38. package/prose-pipeline/decorations/index.d.ts.map +1 -0
  39. package/prose-pipeline/decorations/index.js +24 -0
  40. package/prose-pipeline/decorations/index.js.map +1 -0
  41. package/prose-pipeline/decorations/parser.d.ts +34 -0
  42. package/prose-pipeline/decorations/parser.d.ts.map +1 -0
  43. package/prose-pipeline/decorations/parser.js +195 -0
  44. package/prose-pipeline/decorations/parser.js.map +1 -0
  45. package/prose-pipeline/decorations/platform-vocabulary.d.ts +35 -0
  46. package/prose-pipeline/decorations/platform-vocabulary.d.ts.map +1 -0
  47. package/prose-pipeline/decorations/platform-vocabulary.js +81 -0
  48. package/prose-pipeline/decorations/platform-vocabulary.js.map +1 -0
  49. package/prose-pipeline/decorations/resolver.d.ts +28 -0
  50. package/prose-pipeline/decorations/resolver.d.ts.map +1 -0
  51. package/prose-pipeline/decorations/resolver.js +39 -0
  52. package/prose-pipeline/decorations/resolver.js.map +1 -0
  53. package/prose-pipeline/decorations/types.d.ts +16 -0
  54. package/prose-pipeline/decorations/types.d.ts.map +1 -0
  55. package/prose-pipeline/decorations/types.js +17 -0
  56. package/prose-pipeline/decorations/types.js.map +1 -0
  57. package/prose-pipeline/handlers/about.d.ts +31 -0
  58. package/prose-pipeline/handlers/about.d.ts.map +1 -0
  59. package/prose-pipeline/handlers/about.js +50 -0
  60. package/prose-pipeline/handlers/about.js.map +1 -0
  61. package/prose-pipeline/handlers/audibility.d.ts +46 -0
  62. package/prose-pipeline/handlers/audibility.d.ts.map +1 -0
  63. package/prose-pipeline/handlers/audibility.js +79 -0
  64. package/prose-pipeline/handlers/audibility.js.map +1 -0
  65. package/prose-pipeline/handlers/banner.d.ts +44 -0
  66. package/prose-pipeline/handlers/banner.d.ts.map +1 -0
  67. package/prose-pipeline/handlers/banner.js +88 -0
  68. package/prose-pipeline/handlers/banner.js.map +1 -0
  69. package/prose-pipeline/handlers/client-query.d.ts +22 -0
  70. package/prose-pipeline/handlers/client-query.d.ts.map +1 -0
  71. package/prose-pipeline/handlers/client-query.js +55 -0
  72. package/prose-pipeline/handlers/client-query.js.map +1 -0
  73. package/prose-pipeline/handlers/command-failed.d.ts +24 -0
  74. package/prose-pipeline/handlers/command-failed.d.ts.map +1 -0
  75. package/prose-pipeline/handlers/command-failed.js +46 -0
  76. package/prose-pipeline/handlers/command-failed.js.map +1 -0
  77. package/prose-pipeline/handlers/domain-message.d.ts +31 -0
  78. package/prose-pipeline/handlers/domain-message.d.ts.map +1 -0
  79. package/prose-pipeline/handlers/domain-message.js +66 -0
  80. package/prose-pipeline/handlers/domain-message.js.map +1 -0
  81. package/prose-pipeline/handlers/game.d.ts +31 -0
  82. package/prose-pipeline/handlers/game.d.ts.map +1 -0
  83. package/prose-pipeline/handlers/game.js +35 -0
  84. package/prose-pipeline/handlers/game.js.map +1 -0
  85. package/prose-pipeline/handlers/generic.d.ts +27 -0
  86. package/prose-pipeline/handlers/generic.d.ts.map +1 -0
  87. package/prose-pipeline/handlers/generic.js +67 -0
  88. package/prose-pipeline/handlers/generic.js.map +1 -0
  89. package/prose-pipeline/handlers/help.d.ts +21 -0
  90. package/prose-pipeline/handlers/help.d.ts.map +1 -0
  91. package/prose-pipeline/handlers/help.js +68 -0
  92. package/prose-pipeline/handlers/help.js.map +1 -0
  93. package/prose-pipeline/handlers/implicit-take.d.ts +20 -0
  94. package/prose-pipeline/handlers/implicit-take.d.ts.map +1 -0
  95. package/prose-pipeline/handlers/implicit-take.js +26 -0
  96. package/prose-pipeline/handlers/implicit-take.js.map +1 -0
  97. package/prose-pipeline/handlers/index.d.ts +24 -0
  98. package/prose-pipeline/handlers/index.d.ts.map +1 -0
  99. package/prose-pipeline/handlers/index.js +40 -0
  100. package/prose-pipeline/handlers/index.js.map +1 -0
  101. package/prose-pipeline/handlers/revealed.d.ts +24 -0
  102. package/prose-pipeline/handlers/revealed.d.ts.map +1 -0
  103. package/prose-pipeline/handlers/revealed.js +54 -0
  104. package/prose-pipeline/handlers/revealed.js.map +1 -0
  105. package/prose-pipeline/handlers/room.d.ts +25 -0
  106. package/prose-pipeline/handlers/room.d.ts.map +1 -0
  107. package/prose-pipeline/handlers/room.js +78 -0
  108. package/prose-pipeline/handlers/room.js.map +1 -0
  109. package/prose-pipeline/handlers/types.d.ts +47 -0
  110. package/prose-pipeline/handlers/types.d.ts.map +1 -0
  111. package/prose-pipeline/handlers/types.js +15 -0
  112. package/prose-pipeline/handlers/types.js.map +1 -0
  113. package/prose-pipeline/index.d.ts +20 -0
  114. package/prose-pipeline/index.d.ts.map +1 -0
  115. package/prose-pipeline/index.js +50 -0
  116. package/prose-pipeline/index.js.map +1 -0
  117. package/prose-pipeline/pipeline.d.ts +58 -0
  118. package/prose-pipeline/pipeline.d.ts.map +1 -0
  119. package/prose-pipeline/pipeline.js +120 -0
  120. package/prose-pipeline/pipeline.js.map +1 -0
  121. package/prose-pipeline/stages/filter.d.ts +26 -0
  122. package/prose-pipeline/stages/filter.d.ts.map +1 -0
  123. package/prose-pipeline/stages/filter.js +38 -0
  124. package/prose-pipeline/stages/filter.js.map +1 -0
  125. package/prose-pipeline/stages/index.d.ts +13 -0
  126. package/prose-pipeline/stages/index.d.ts.map +1 -0
  127. package/prose-pipeline/stages/index.js +19 -0
  128. package/prose-pipeline/stages/index.js.map +1 -0
  129. package/prose-pipeline/stages/sort.d.ts +38 -0
  130. package/prose-pipeline/stages/sort.d.ts.map +1 -0
  131. package/prose-pipeline/stages/sort.js +94 -0
  132. package/prose-pipeline/stages/sort.js.map +1 -0
  133. package/prose-pipeline/types.d.ts +45 -0
  134. package/prose-pipeline/types.d.ts.map +1 -0
  135. package/prose-pipeline/types.js +23 -0
  136. package/prose-pipeline/types.js.map +1 -0
  137. package/save-restore-service.d.ts +3 -3
  138. package/save-restore-service.d.ts.map +1 -1
  139. package/save-restore-service.js +1 -1
  140. package/scene-evaluation-plugin.d.ts +2 -2
  141. package/scene-evaluation-plugin.d.ts.map +1 -1
  142. package/scene-evaluation-plugin.js +1 -1
  143. package/shared-data-keys.d.ts +3 -3
  144. package/shared-data-keys.d.ts.map +1 -1
  145. package/sound/dispatcher.d.ts +75 -0
  146. package/sound/dispatcher.d.ts.map +1 -0
  147. package/sound/dispatcher.js +122 -0
  148. package/sound/dispatcher.js.map +1 -0
  149. package/sound/index.d.ts +26 -0
  150. package/sound/index.d.ts.map +1 -0
  151. package/sound/index.js +34 -0
  152. package/sound/index.js.map +1 -0
  153. package/sound/propagation.d.ts +69 -0
  154. package/sound/propagation.d.ts.map +1 -0
  155. package/sound/propagation.js +219 -0
  156. package/sound/propagation.js.map +1 -0
  157. package/story.d.ts +31 -4
  158. package/story.d.ts.map +1 -1
  159. package/story.js.map +1 -1
  160. package/test-helpers/mock-prose-pipeline.d.ts +22 -0
  161. package/test-helpers/mock-prose-pipeline.d.ts.map +1 -0
  162. package/test-helpers/mock-prose-pipeline.js +56 -0
  163. package/test-helpers/mock-prose-pipeline.js.map +1 -0
  164. package/turn-event-processor.d.ts +3 -3
  165. package/turn-event-processor.d.ts.map +1 -1
  166. package/turn-event-processor.js +1 -1
  167. package/types.d.ts +4 -4
  168. package/types.d.ts.map +1 -1
  169. package/vocabulary-manager.d.ts +1 -1
  170. package/vocabulary-manager.d.ts.map +1 -1
  171. package/vocabulary-manager.js +1 -1
  172. package/event-adapter.d.ts +0 -44
  173. package/event-adapter.d.ts.map +0 -1
  174. package/event-adapter.js +0 -127
  175. package/event-adapter.js.map +0 -1
  176. package/event-sequencer.d.ts +0 -73
  177. package/event-sequencer.d.ts.map +0 -1
  178. package/event-sequencer.js +0 -134
  179. package/event-sequencer.js.map +0 -1
  180. package/test-helpers/mock-text-service.d.ts +0 -11
  181. package/test-helpers/mock-text-service.d.ts.map +0 -1
  182. package/test-helpers/mock-text-service.js +0 -47
  183. package/test-helpers/mock-text-service.js.map +0 -1
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ /**
3
+ * Audibility event handler — ADR-172 Phase 7a, ported to engine prose
4
+ * pipeline per ADR-174.
5
+ *
6
+ * Handles `sound.audibility.heard`. Converts each `IAudibilityEvent`
7
+ * (per-listener perception of a propagated sound, produced by the
8
+ * engine's sound dispatcher in Phase 6) into a single text block via
9
+ * the `sound.heard.<kind>.<tier>` template family registered in the
10
+ * active language pack (lang-en-us ships defaults; stories override
11
+ * per kind).
12
+ *
13
+ * Naming discipline:
14
+ * - `audio` — Web Audio playback (ADR-169 `AudioManager`).
15
+ * - `sound` — the media-cue channel id (`media.sound.play`,
16
+ * ADR-163).
17
+ * - `audibility` — ADR-172 perception of propagated sound, this
18
+ * handler.
19
+ *
20
+ * Public interface: `handleAudibilityHeard`.
21
+ *
22
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
23
+ *
24
+ * Listener filtering: in single-user scope today the player is the
25
+ * only entity carrying `ListenerTrait` automatically, so every
26
+ * audibility event delivered here is for the player. The dispatcher
27
+ * already writes the listener id into `event.entities.target`; when
28
+ * L2's NPC-listener work lands, this handler will need to filter
29
+ * `event.entities.target === playerId` before rendering.
30
+ *
31
+ * @see ADR-172 — Spatial Sound Propagation §Channel routing
32
+ * @see ADR-174 §Engine-internal prose pipeline (port from text-service)
33
+ */
34
+ Object.defineProperty(exports, "__esModule", { value: true });
35
+ exports.handleAudibilityHeard = handleAudibilityHeard;
36
+ const text_blocks_1 = require("@sharpee/text-blocks");
37
+ const assemble_1 = require("../assemble");
38
+ const AUDIBILITY_TEMPLATE_PREFIX = 'sound.heard';
39
+ /**
40
+ * Handle a `sound.audibility.heard` event.
41
+ *
42
+ * Resolves `sound.heard.<kind>.<tier>` from the language provider,
43
+ * falling back to `sound.heard.default.<tier>` when the kind-specific
44
+ * template is not registered. Returns one `ITextBlock` per event, or
45
+ * `[]` when the event is malformed, the tier is `silent`, or no
46
+ * template resolves.
47
+ */
48
+ function handleAudibilityHeard(event, context) {
49
+ const provider = context.languageProvider;
50
+ if (!provider)
51
+ return [];
52
+ const data = event.data;
53
+ if (!data || typeof data !== 'object')
54
+ return [];
55
+ if (!data.kind || !data.audibilityTier)
56
+ return [];
57
+ // Defense-in-depth: the dispatcher already filters `silent`, but
58
+ // never render it if one slips through.
59
+ if (data.audibilityTier === 'silent')
60
+ return [];
61
+ const params = {
62
+ kind: data.kind,
63
+ };
64
+ if (data.content?.messageId) {
65
+ const innerParams = data.content.params;
66
+ params.content = provider.getMessage(data.content.messageId, innerParams);
67
+ }
68
+ const kindId = `${AUDIBILITY_TEMPLATE_PREFIX}.${data.kind}.${data.audibilityTier}`;
69
+ let message = provider.getMessage(kindId, params);
70
+ if (!message || message === kindId) {
71
+ const fallbackId = `${AUDIBILITY_TEMPLATE_PREFIX}.default.${data.audibilityTier}`;
72
+ message = provider.getMessage(fallbackId, params);
73
+ if (!message || message === fallbackId) {
74
+ return [];
75
+ }
76
+ }
77
+ return (0, assemble_1.createBlocks)(text_blocks_1.BLOCK_KEYS.ACTION_RESULT, message);
78
+ }
79
+ //# sourceMappingURL=audibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audibility.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/audibility.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;;AAoBH,sDAoCC;AArDD,sDAAkD;AAIlD,0CAA2C;AAE3C,MAAM,0BAA0B,GAAG,aAAa,CAAC;AAEjD;;;;;;;;GAQG;AACH,SAAgB,qBAAqB,CACnC,KAAqB,EACrB,OAAuB;IAEvB,MAAM,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAC1C,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IAEzB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAoC,CAAC;IACxD,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IACjD,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,cAAc;QAAE,OAAO,EAAE,CAAC;IAElD,iEAAiE;IACjE,wCAAwC;IACxC,IAAK,IAAI,CAAC,cAAyB,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IAE5D,MAAM,MAAM,GAA4B;QACtC,IAAI,EAAE,IAAI,CAAC,IAAI;KAChB,CAAC;IACF,IAAI,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC;QAC5B,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,MAEpB,CAAC;QACd,MAAM,CAAC,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;IAC5E,CAAC;IAED,MAAM,MAAM,GAAG,GAAG,0BAA0B,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;IACnF,IAAI,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClD,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,MAAM,EAAE,CAAC;QACnC,MAAM,UAAU,GAAG,GAAG,0BAA0B,YAAY,IAAI,CAAC,cAAc,EAAE,CAAC;QAClF,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAClD,IAAI,CAAC,OAAO,IAAI,OAAO,KAAK,UAAU,EAAE,CAAC;YACvC,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED,OAAO,IAAA,uBAAY,EAAC,wBAAU,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AACzD,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Shared banner-block builder.
3
+ *
4
+ * Emits the opening banner as a sequence of semantically-classed
5
+ * blocks. Used by both `handleGameStarted` and `handleAboutDisplayed`
6
+ * so the banner shown at game-start and via the ABOUT command are
7
+ * structurally identical.
8
+ *
9
+ * Pieces (in order):
10
+ *
11
+ * 1. `game-title` — title
12
+ * 2. `story-version` — `Story v{version}` + optional build date
13
+ * 3. `platform-version` — `Sharpee v{engineVersion}` (if provided)
14
+ * 4. `sub-title` — description (if provided)
15
+ * 5. `author-list[]` — `credits` if provided, else single
16
+ * `By {author}` line if `author` is set
17
+ * 6. `banner-spacer` — empty `<p>` for visual separation
18
+ * 7. story-tail — appended via `createBlocks` from
19
+ * `game.banner.story-tail` if the language
20
+ * provider has that template
21
+ *
22
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
23
+ */
24
+ import type { ITextBlock } from '@sharpee/text-blocks';
25
+ import type { HandlerContext } from './types';
26
+ /**
27
+ * Subset of story metadata used by the banner builder.
28
+ * Both `handleGameStarted` (`event.data.story`) and
29
+ * `handleAboutDisplayed` (`event.data.params`) project into this shape.
30
+ */
31
+ export interface BannerStoryInfo {
32
+ title?: string;
33
+ version?: string;
34
+ buildDate?: string;
35
+ description?: string;
36
+ author?: string;
37
+ credits?: string[];
38
+ }
39
+ /**
40
+ * Build the structured banner blocks for a `key` (typically
41
+ * `'game.banner'` from `game.started` or `'about.text'` from ABOUT).
42
+ */
43
+ export declare function buildBannerBlocks(key: string, story: BannerStoryInfo | undefined, engineVersion: string | undefined, context: HandlerContext): ITextBlock[];
44
+ //# sourceMappingURL=banner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"banner.d.ts","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/banner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAI9C;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,eAAe,GAAG,SAAS,EAClC,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,OAAO,EAAE,cAAc,GACtB,UAAU,EAAE,CAmDd"}
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ /**
3
+ * Shared banner-block builder.
4
+ *
5
+ * Emits the opening banner as a sequence of semantically-classed
6
+ * blocks. Used by both `handleGameStarted` and `handleAboutDisplayed`
7
+ * so the banner shown at game-start and via the ABOUT command are
8
+ * structurally identical.
9
+ *
10
+ * Pieces (in order):
11
+ *
12
+ * 1. `game-title` — title
13
+ * 2. `story-version` — `Story v{version}` + optional build date
14
+ * 3. `platform-version` — `Sharpee v{engineVersion}` (if provided)
15
+ * 4. `sub-title` — description (if provided)
16
+ * 5. `author-list[]` — `credits` if provided, else single
17
+ * `By {author}` line if `author` is set
18
+ * 6. `banner-spacer` — empty `<p>` for visual separation
19
+ * 7. story-tail — appended via `createBlocks` from
20
+ * `game.banner.story-tail` if the language
21
+ * provider has that template
22
+ *
23
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
24
+ */
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.buildBannerBlocks = buildBannerBlocks;
27
+ const assemble_1 = require("../assemble");
28
+ const STORY_TAIL_MESSAGE_ID = 'game.banner.story-tail';
29
+ /**
30
+ * Build the structured banner blocks for a `key` (typically
31
+ * `'game.banner'` from `game.started` or `'about.text'` from ABOUT).
32
+ */
33
+ function buildBannerBlocks(key, story, engineVersion, context) {
34
+ if (!story)
35
+ return [];
36
+ const blocks = [];
37
+ if (story.title) {
38
+ blocks.push((0, assemble_1.createBlock)(key, story.title, { className: 'game-title' }));
39
+ }
40
+ if (story.version) {
41
+ const buildDate = formatBuildDate(story.buildDate);
42
+ const versionText = buildDate
43
+ ? `Story v${story.version} (built ${buildDate})`
44
+ : `Story v${story.version}`;
45
+ blocks.push((0, assemble_1.createBlock)(key, versionText, { className: 'story-version' }));
46
+ }
47
+ if (engineVersion) {
48
+ blocks.push((0, assemble_1.createBlock)(key, `Sharpee v${engineVersion}`, {
49
+ className: 'platform-version',
50
+ }));
51
+ }
52
+ if (story.description) {
53
+ blocks.push((0, assemble_1.createBlock)(key, story.description, { className: 'sub-title' }));
54
+ }
55
+ const creditLines = story.credits && story.credits.length > 0
56
+ ? story.credits
57
+ : story.author
58
+ ? [`By ${story.author}`]
59
+ : [];
60
+ for (const line of creditLines) {
61
+ blocks.push((0, assemble_1.createBlock)(key, line, { className: 'author-list' }));
62
+ }
63
+ if (blocks.length > 0) {
64
+ blocks.push((0, assemble_1.createBlock)(key, '', { className: 'banner-spacer' }));
65
+ }
66
+ const tail = context.languageProvider?.getMessage(STORY_TAIL_MESSAGE_ID, {});
67
+ if (tail && tail !== STORY_TAIL_MESSAGE_ID) {
68
+ blocks.push(...(0, assemble_1.createBlocks)(key, tail));
69
+ }
70
+ return blocks;
71
+ }
72
+ /**
73
+ * Format an ISO build date as `YYYY-MM-DD` for the version line.
74
+ * Returns the original string if it doesn't parse cleanly, or empty
75
+ * when missing.
76
+ */
77
+ function formatBuildDate(buildDate) {
78
+ if (!buildDate)
79
+ return '';
80
+ try {
81
+ const iso = new Date(buildDate).toISOString();
82
+ return iso.split('T')[0];
83
+ }
84
+ catch {
85
+ return buildDate;
86
+ }
87
+ }
88
+ //# sourceMappingURL=banner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"banner.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/banner.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Client-query handler — `client.query`.
3
+ *
4
+ * Today only the `disambiguation` source is rendered. The handler
5
+ * formats a candidate list as natural English ("the X or the Y" /
6
+ * "the X, the Y, or the Z") and resolves the
7
+ * `core.disambiguation_prompt` template with the resulting `options`
8
+ * string.
9
+ *
10
+ * Public interface: `handleClientQuery`. Used by the pipeline's
11
+ * event-type dispatch.
12
+ *
13
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
14
+ *
15
+ * @see ADR-174 §Engine-internal prose pipeline (extracted from
16
+ * text-service.ts inline)
17
+ */
18
+ import type { ITextBlock } from '@sharpee/text-blocks';
19
+ import type { ISemanticEvent } from '@sharpee/core';
20
+ import type { HandlerContext } from './types';
21
+ export declare function handleClientQuery(event: ISemanticEvent, context: HandlerContext): ITextBlock[];
22
+ //# sourceMappingURL=client-query.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-query.d.ts","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/client-query.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAU9C,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,cAAc,GACtB,UAAU,EAAE,CAgBd"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+ /**
3
+ * Client-query handler — `client.query`.
4
+ *
5
+ * Today only the `disambiguation` source is rendered. The handler
6
+ * formats a candidate list as natural English ("the X or the Y" /
7
+ * "the X, the Y, or the Z") and resolves the
8
+ * `core.disambiguation_prompt` template with the resulting `options`
9
+ * string.
10
+ *
11
+ * Public interface: `handleClientQuery`. Used by the pipeline's
12
+ * event-type dispatch.
13
+ *
14
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
15
+ *
16
+ * @see ADR-174 §Engine-internal prose pipeline (extracted from
17
+ * text-service.ts inline)
18
+ */
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.handleClientQuery = handleClientQuery;
21
+ const text_blocks_1 = require("@sharpee/text-blocks");
22
+ const assemble_1 = require("../assemble");
23
+ function handleClientQuery(event, context) {
24
+ const data = event.data;
25
+ if (data?.source !== 'disambiguation') {
26
+ return [];
27
+ }
28
+ const candidateNames = (data.candidates || []).map((c) => c.name);
29
+ const options = formatCandidateList(candidateNames);
30
+ const message = context.languageProvider?.getMessage('core.disambiguation_prompt', {
31
+ options,
32
+ }) ?? `Which do you mean: ${options}?`;
33
+ return (0, assemble_1.createBlocks)(text_blocks_1.BLOCK_KEYS.ERROR, message);
34
+ }
35
+ /**
36
+ * Format a list of candidate names as natural English.
37
+ *
38
+ * Examples:
39
+ * ["red ball", "blue ball"] → "the red ball or the blue ball"
40
+ * ["sword", "axe", "knife"] → "the sword, the axe, or the knife"
41
+ */
42
+ function formatCandidateList(names) {
43
+ if (names.length === 0)
44
+ return '';
45
+ if (names.length === 1)
46
+ return `the ${names[0]}`;
47
+ const withArticles = names.map((n) => `the ${n}`);
48
+ if (withArticles.length === 2) {
49
+ return `${withArticles[0]} or ${withArticles[1]}`;
50
+ }
51
+ // Oxford-comma style: "the X, the Y, or the Z"
52
+ const last = withArticles.pop();
53
+ return `${withArticles.join(', ')}, or ${last}`;
54
+ }
55
+ //# sourceMappingURL=client-query.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-query.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/client-query.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;AAeH,8CAmBC;AA/BD,sDAAkD;AAGlD,0CAA2C;AAS3C,SAAgB,iBAAiB,CAC/B,KAAqB,EACrB,OAAuB;IAEvB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAuB,CAAC;IAE3C,IAAI,IAAI,EAAE,MAAM,KAAK,gBAAgB,EAAE,CAAC;QACtC,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,cAAc,GAAG,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAClE,MAAM,OAAO,GAAG,mBAAmB,CAAC,cAAc,CAAC,CAAC;IAEpD,MAAM,OAAO,GACX,OAAO,CAAC,gBAAgB,EAAE,UAAU,CAAC,4BAA4B,EAAE;QACjE,OAAO;KACR,CAAC,IAAI,sBAAsB,OAAO,GAAG,CAAC;IAEzC,OAAO,IAAA,uBAAY,EAAC,wBAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACjD,CAAC;AAED;;;;;;GAMG;AACH,SAAS,mBAAmB,CAAC,KAAe;IAC1C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAClC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAEjD,MAAM,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAElD,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,GAAG,YAAY,CAAC,CAAC,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;IACpD,CAAC;IAED,+CAA+C;IAC/C,MAAM,IAAI,GAAG,YAAY,CAAC,GAAG,EAAE,CAAC;IAChC,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,EAAE,CAAC;AAClD,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Command-failed handler — `command.failed`.
3
+ *
4
+ * Maps parser / entity-resolution failure reasons to user-facing
5
+ * error prose. Recognized reason fragments:
6
+ * - `ENTITY_NOT_FOUND` / `modifiers_not_matched` →
7
+ * `core.entity_not_found` (default: "I don't see that here.")
8
+ * - `NO_MATCH` / `parse` →
9
+ * `core.command_not_understood` (default: "I don't understand that.")
10
+ * Anything else → `core.command_failed` (same default).
11
+ *
12
+ * Public interface: `handleCommandFailed`. Used by the pipeline's
13
+ * event-type dispatch.
14
+ *
15
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
16
+ *
17
+ * @see ADR-174 §Engine-internal prose pipeline (extracted from
18
+ * text-service.ts inline)
19
+ */
20
+ import type { ITextBlock } from '@sharpee/text-blocks';
21
+ import type { ISemanticEvent } from '@sharpee/core';
22
+ import type { HandlerContext } from './types';
23
+ export declare function handleCommandFailed(event: ISemanticEvent, context: HandlerContext): ITextBlock[];
24
+ //# sourceMappingURL=command-failed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-failed.d.ts","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/command-failed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAQ9C,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,cAAc,GACtB,UAAU,EAAE,CA6Bd"}
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ /**
3
+ * Command-failed handler — `command.failed`.
4
+ *
5
+ * Maps parser / entity-resolution failure reasons to user-facing
6
+ * error prose. Recognized reason fragments:
7
+ * - `ENTITY_NOT_FOUND` / `modifiers_not_matched` →
8
+ * `core.entity_not_found` (default: "I don't see that here.")
9
+ * - `NO_MATCH` / `parse` →
10
+ * `core.command_not_understood` (default: "I don't understand that.")
11
+ * Anything else → `core.command_failed` (same default).
12
+ *
13
+ * Public interface: `handleCommandFailed`. Used by the pipeline's
14
+ * event-type dispatch.
15
+ *
16
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
17
+ *
18
+ * @see ADR-174 §Engine-internal prose pipeline (extracted from
19
+ * text-service.ts inline)
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.handleCommandFailed = handleCommandFailed;
23
+ const text_blocks_1 = require("@sharpee/text-blocks");
24
+ const assemble_1 = require("../assemble");
25
+ function handleCommandFailed(event, context) {
26
+ const data = event.data;
27
+ const provider = context.languageProvider;
28
+ if (data?.reason) {
29
+ if (data.reason.includes('ENTITY_NOT_FOUND') ||
30
+ data.reason.includes('modifiers_not_matched')) {
31
+ const message = provider?.getMessage('core.entity_not_found') ??
32
+ "I don't see that here.";
33
+ return (0, assemble_1.createBlocks)(text_blocks_1.BLOCK_KEYS.ERROR, message);
34
+ }
35
+ // AMBIGUOUS_ENTITY now uses client.query event, not command.failed.
36
+ if (data.reason.includes('NO_MATCH') || data.reason.includes('parse')) {
37
+ const message = provider?.getMessage('core.command_not_understood') ??
38
+ "I don't understand that.";
39
+ return (0, assemble_1.createBlocks)(text_blocks_1.BLOCK_KEYS.ERROR, message);
40
+ }
41
+ }
42
+ const message = provider?.getMessage('core.command_failed') ??
43
+ "I don't understand that.";
44
+ return (0, assemble_1.createBlocks)(text_blocks_1.BLOCK_KEYS.ERROR, message);
45
+ }
46
+ //# sourceMappingURL=command-failed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-failed.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/command-failed.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;AAaH,kDAgCC;AA1CD,sDAAkD;AAGlD,0CAA2C;AAO3C,SAAgB,mBAAmB,CACjC,KAAqB,EACrB,OAAuB;IAEvB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAyB,CAAC;IAC7C,MAAM,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAE1C,IAAI,IAAI,EAAE,MAAM,EAAE,CAAC;QACjB,IACE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,CAAC;YACxC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EAC7C,CAAC;YACD,MAAM,OAAO,GACX,QAAQ,EAAE,UAAU,CAAC,uBAAuB,CAAC;gBAC7C,wBAAwB,CAAC;YAC3B,OAAO,IAAA,uBAAY,EAAC,wBAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACjD,CAAC;QAED,oEAAoE;QAEpE,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACtE,MAAM,OAAO,GACX,QAAQ,EAAE,UAAU,CAAC,6BAA6B,CAAC;gBACnD,0BAA0B,CAAC;YAC7B,OAAO,IAAA,uBAAY,EAAC,wBAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACjD,CAAC;IACH,CAAC;IAED,MAAM,OAAO,GACX,QAAQ,EAAE,UAAU,CAAC,qBAAqB,CAAC;QAC3C,0BAA0B,CAAC;IAC7B,OAAO,IAAA,uBAAY,EAAC,wBAAU,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;AACjD,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Domain message handler — `event.data.messageId` resolution path.
3
+ *
4
+ * Handles any event whose data carries a `messageId`, regardless of
5
+ * event type (per ADR-097). All stdlib actions use this pattern;
6
+ * story actions emitting `action.success` / `action.blocked` events
7
+ * also flow through here.
8
+ *
9
+ * Public interface: `tryProcessDomainEventMessage`. The pipeline
10
+ * consults this first; on null, it falls through to the type-keyed
11
+ * handlers (room, revealed, generic, etc.).
12
+ *
13
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
14
+ *
15
+ * @see ADR-097 Domain Events with messageId
16
+ * @see ADR-174 §Engine-internal prose pipeline (extracted from
17
+ * text-service.ts inline)
18
+ */
19
+ import type { ITextBlock } from '@sharpee/text-blocks';
20
+ import type { ISemanticEvent } from '@sharpee/core';
21
+ import type { HandlerContext } from './types';
22
+ /**
23
+ * Process domain events that carry messageId directly (ADR-097).
24
+ *
25
+ * @returns Text blocks if event has messageId. Returns null when the
26
+ * event has no messageId (caller falls through to type-keyed
27
+ * handlers). Falls back to inline `data.message` / `data.text`
28
+ * when the messageId fails to resolve.
29
+ */
30
+ export declare function tryProcessDomainEventMessage(event: ISemanticEvent, context: HandlerContext): ITextBlock[] | null;
31
+ //# sourceMappingURL=domain-message.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-message.d.ts","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/domain-message.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAU9C;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,cAAc,GACtB,UAAU,EAAE,GAAG,IAAI,CA4CrB"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ /**
3
+ * Domain message handler — `event.data.messageId` resolution path.
4
+ *
5
+ * Handles any event whose data carries a `messageId`, regardless of
6
+ * event type (per ADR-097). All stdlib actions use this pattern;
7
+ * story actions emitting `action.success` / `action.blocked` events
8
+ * also flow through here.
9
+ *
10
+ * Public interface: `tryProcessDomainEventMessage`. The pipeline
11
+ * consults this first; on null, it falls through to the type-keyed
12
+ * handlers (room, revealed, generic, etc.).
13
+ *
14
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
15
+ *
16
+ * @see ADR-097 Domain Events with messageId
17
+ * @see ADR-174 §Engine-internal prose pipeline (extracted from
18
+ * text-service.ts inline)
19
+ */
20
+ Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.tryProcessDomainEventMessage = tryProcessDomainEventMessage;
22
+ const text_blocks_1 = require("@sharpee/text-blocks");
23
+ const assemble_1 = require("../assemble");
24
+ /**
25
+ * Process domain events that carry messageId directly (ADR-097).
26
+ *
27
+ * @returns Text blocks if event has messageId. Returns null when the
28
+ * event has no messageId (caller falls through to type-keyed
29
+ * handlers). Falls back to inline `data.message` / `data.text`
30
+ * when the messageId fails to resolve.
31
+ */
32
+ function tryProcessDomainEventMessage(event, context) {
33
+ const data = event.data;
34
+ if (!data?.messageId) {
35
+ return null;
36
+ }
37
+ // Skip client.query — it needs specialized handling (disambiguation
38
+ // builds options from candidates).
39
+ if (event.type === 'client.query') {
40
+ return null;
41
+ }
42
+ if (!context.languageProvider) {
43
+ return null;
44
+ }
45
+ const message = context.languageProvider.getMessage(data.messageId, data.params);
46
+ // If the messageId echoes (not registered) or resolves to empty,
47
+ // fall back to inline text. Many events carry both a messageId and
48
+ // pre-rendered text (melee combat, GDT, etc.).
49
+ if (message === data.messageId || !message) {
50
+ const fallback = data.message ?? data.text;
51
+ if (typeof fallback === 'string' && fallback) {
52
+ return (0, assemble_1.createBlocks)(text_blocks_1.BLOCK_KEYS.ACTION_RESULT, fallback);
53
+ }
54
+ // No inline text — skip silently rather than showing an error.
55
+ // Domain events (if.event.*) carry messageId for semantic
56
+ // association, not for text rendering. Actual prose comes from
57
+ // game.message events.
58
+ return null;
59
+ }
60
+ // Block key chosen by event-type semantics.
61
+ const blockKey = event.type.includes('blocked') || event.type.includes('failure')
62
+ ? text_blocks_1.BLOCK_KEYS.ACTION_BLOCKED
63
+ : text_blocks_1.BLOCK_KEYS.ACTION_RESULT;
64
+ return (0, assemble_1.createBlocks)(blockKey, message);
65
+ }
66
+ //# sourceMappingURL=domain-message.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-message.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/domain-message.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;AAuBH,oEA+CC;AAnED,sDAAkD;AAGlD,0CAA2C;AAS3C;;;;;;;GAOG;AACH,SAAgB,4BAA4B,CAC1C,KAAqB,EACrB,OAAuB;IAEvB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAqC,CAAC;IAEzD,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,oEAAoE;IACpE,mCAAmC;IACnC,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAC9B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,UAAU,CACjD,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,MAAM,CACZ,CAAC;IAEF,iEAAiE;IACjE,mEAAmE;IACnE,+CAA+C;IAC/C,IAAI,OAAO,KAAK,IAAI,CAAC,SAAS,IAAI,CAAC,OAAO,EAAE,CAAC;QAC3C,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC;QAC3C,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,EAAE,CAAC;YAC7C,OAAO,IAAA,uBAAY,EAAC,wBAAU,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;QAC1D,CAAC;QACD,+DAA+D;QAC/D,0DAA0D;QAC1D,+DAA+D;QAC/D,uBAAuB;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,4CAA4C;IAC5C,MAAM,QAAQ,GACZ,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;QAC9D,CAAC,CAAC,wBAAU,CAAC,cAAc;QAC3B,CAAC,CAAC,wBAAU,CAAC,aAAa,CAAC;IAE/B,OAAO,IAAA,uBAAY,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Game lifecycle event handler — `game.started`.
3
+ *
4
+ * Emits the opening banner via the shared `buildBannerBlocks` helper:
5
+ * one semantically-classed block per piece (`game-title`,
6
+ * `story-version`, `platform-version`, `sub-title`, `author-list[]`,
7
+ * `banner-spacer`), then any story-defined `game.banner.story-tail`
8
+ * template appended through `createBlocks`.
9
+ *
10
+ * Public interface: `handleGameStarted`. Used by the pipeline's
11
+ * event-type dispatch.
12
+ *
13
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
14
+ *
15
+ * @see ADR-097 IGameEvent Deprecation
16
+ * @see ADR-174 §Engine-internal prose pipeline (port from text-service)
17
+ */
18
+ import type { ITextBlock } from '@sharpee/text-blocks';
19
+ import type { ISemanticEvent } from '@sharpee/core';
20
+ import type { HandlerContext } from './types';
21
+ /**
22
+ * Handle the `game.started` event to produce the opening banner.
23
+ *
24
+ * Stories customize by:
25
+ * - Setting `StoryConfig.credits` for distinct author-list lines.
26
+ * - Setting `StoryConfig.description` for the sub-title.
27
+ * - Registering a `game.banner.story-tail` language template for any
28
+ * trailing content (instructions, taglines, etc.).
29
+ */
30
+ export declare function handleGameStarted(event: ISemanticEvent, context: HandlerContext): ITextBlock[];
31
+ //# sourceMappingURL=game.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"game.d.ts","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/game.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAA4B,MAAM,eAAe,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAG9C;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,cAAc,GACtB,UAAU,EAAE,CAQd"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ /**
3
+ * Game lifecycle event handler — `game.started`.
4
+ *
5
+ * Emits the opening banner via the shared `buildBannerBlocks` helper:
6
+ * one semantically-classed block per piece (`game-title`,
7
+ * `story-version`, `platform-version`, `sub-title`, `author-list[]`,
8
+ * `banner-spacer`), then any story-defined `game.banner.story-tail`
9
+ * template appended through `createBlocks`.
10
+ *
11
+ * Public interface: `handleGameStarted`. Used by the pipeline's
12
+ * event-type dispatch.
13
+ *
14
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
15
+ *
16
+ * @see ADR-097 IGameEvent Deprecation
17
+ * @see ADR-174 §Engine-internal prose pipeline (port from text-service)
18
+ */
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.handleGameStarted = handleGameStarted;
21
+ const banner_1 = require("./banner");
22
+ /**
23
+ * Handle the `game.started` event to produce the opening banner.
24
+ *
25
+ * Stories customize by:
26
+ * - Setting `StoryConfig.credits` for distinct author-list lines.
27
+ * - Setting `StoryConfig.description` for the sub-title.
28
+ * - Registering a `game.banner.story-tail` language template for any
29
+ * trailing content (instructions, taglines, etc.).
30
+ */
31
+ function handleGameStarted(event, context) {
32
+ const data = event.data;
33
+ return (0, banner_1.buildBannerBlocks)('game.banner', data?.story, data?.engineVersion, context);
34
+ }
35
+ //# sourceMappingURL=game.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"game.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/game.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;AAgBH,8CAWC;AAtBD,qCAA6C;AAE7C;;;;;;;;GAQG;AACH,SAAgB,iBAAiB,CAC/B,KAAqB,EACrB,OAAuB;IAEvB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAgC,CAAC;IACpD,OAAO,IAAA,0BAAiB,EACtB,aAAa,EACb,IAAI,EAAE,KAAK,EACX,IAAI,EAAE,aAAa,EACnB,OAAO,CACR,CAAC;AACJ,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Generic event handlers — game.message and the catch-all generic
3
+ * fallback for unknown event types.
4
+ *
5
+ * Public interface: `handleGameMessage`, `handleGenericEvent`. Used
6
+ * by the pipeline's event-type dispatch.
7
+ *
8
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
9
+ *
10
+ * @see ADR-174 §Engine-internal prose pipeline (port from text-service)
11
+ */
12
+ import type { ITextBlock } from '@sharpee/text-blocks';
13
+ import type { ISemanticEvent } from '@sharpee/core';
14
+ import type { HandlerContext } from './types';
15
+ /**
16
+ * Handle `game.message` events.
17
+ */
18
+ export declare function handleGameMessage(event: ISemanticEvent, context: HandlerContext): ITextBlock[];
19
+ /**
20
+ * Handle generic / unknown events using `event.type` as the template key.
21
+ *
22
+ * Story-defined events follow the simple pattern:
23
+ * - event.type is the template key
24
+ * - event.data is the template params
25
+ */
26
+ export declare function handleGenericEvent(event: ISemanticEvent, context: HandlerContext): ITextBlock[];
27
+ //# sourceMappingURL=generic.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generic.d.ts","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/generic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,SAAS,CAAC;AAUhE;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,cAAc,GACtB,UAAU,EAAE,CAmBd;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,cAAc,GACtB,UAAU,EAAE,CAiCd"}