@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,50 @@
1
+ "use strict";
2
+ /**
3
+ * Prose pipeline — internal barrel for the engine package.
4
+ *
5
+ * Public interface: `ProsePipeline`, `createProsePipeline`,
6
+ * `ITextService`. Plus the decoration primitives and stage utilities
7
+ * the pipeline class composes.
8
+ *
9
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
10
+ *
11
+ * @see ADR-174 §Engine-internal prose pipeline
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.handleClientQuery = exports.handleCommandFailed = exports.handleImplicitTake = exports.tryProcessDomainEventMessage = exports.handleAudibilityHeard = exports.handleAboutDisplayed = exports.handleHelpDisplayed = exports.handleGameStarted = exports.handleGenericEvent = exports.handleGameMessage = exports.handleRevealed = exports.handleRoomDescription = exports.extractValue = exports.createBlocks = exports.createBlock = exports.getChainMetadata = exports.sortEventsForProse = exports.filterEvents = exports.PLATFORM_VOCABULARY_NAMES = exports.PLATFORM_VOCABULARY = exports.resolveClassName = exports.parseDecorations = exports.createProsePipeline = exports.ProsePipeline = void 0;
15
+ // Pipeline class and factory.
16
+ var pipeline_1 = require("./pipeline");
17
+ Object.defineProperty(exports, "ProsePipeline", { enumerable: true, get: function () { return pipeline_1.ProsePipeline; } });
18
+ Object.defineProperty(exports, "createProsePipeline", { enumerable: true, get: function () { return pipeline_1.createProsePipeline; } });
19
+ // Decoration primitives (re-exported for convenience to engine code
20
+ // outside the prose-pipeline subdirectory; the canonical types live
21
+ // in `@sharpee/text-blocks`).
22
+ var decorations_1 = require("./decorations");
23
+ Object.defineProperty(exports, "parseDecorations", { enumerable: true, get: function () { return decorations_1.parseDecorations; } });
24
+ Object.defineProperty(exports, "resolveClassName", { enumerable: true, get: function () { return decorations_1.resolveClassName; } });
25
+ Object.defineProperty(exports, "PLATFORM_VOCABULARY", { enumerable: true, get: function () { return decorations_1.PLATFORM_VOCABULARY; } });
26
+ Object.defineProperty(exports, "PLATFORM_VOCABULARY_NAMES", { enumerable: true, get: function () { return decorations_1.PLATFORM_VOCABULARY_NAMES; } });
27
+ // Stage utilities (handy in tests).
28
+ var filter_1 = require("./stages/filter");
29
+ Object.defineProperty(exports, "filterEvents", { enumerable: true, get: function () { return filter_1.filterEvents; } });
30
+ var sort_1 = require("./stages/sort");
31
+ Object.defineProperty(exports, "sortEventsForProse", { enumerable: true, get: function () { return sort_1.sortEventsForProse; } });
32
+ Object.defineProperty(exports, "getChainMetadata", { enumerable: true, get: function () { return sort_1.getChainMetadata; } });
33
+ var assemble_1 = require("./assemble");
34
+ Object.defineProperty(exports, "createBlock", { enumerable: true, get: function () { return assemble_1.createBlock; } });
35
+ Object.defineProperty(exports, "createBlocks", { enumerable: true, get: function () { return assemble_1.createBlocks; } });
36
+ Object.defineProperty(exports, "extractValue", { enumerable: true, get: function () { return assemble_1.extractValue; } });
37
+ var handlers_1 = require("./handlers");
38
+ Object.defineProperty(exports, "handleRoomDescription", { enumerable: true, get: function () { return handlers_1.handleRoomDescription; } });
39
+ Object.defineProperty(exports, "handleRevealed", { enumerable: true, get: function () { return handlers_1.handleRevealed; } });
40
+ Object.defineProperty(exports, "handleGameMessage", { enumerable: true, get: function () { return handlers_1.handleGameMessage; } });
41
+ Object.defineProperty(exports, "handleGenericEvent", { enumerable: true, get: function () { return handlers_1.handleGenericEvent; } });
42
+ Object.defineProperty(exports, "handleGameStarted", { enumerable: true, get: function () { return handlers_1.handleGameStarted; } });
43
+ Object.defineProperty(exports, "handleHelpDisplayed", { enumerable: true, get: function () { return handlers_1.handleHelpDisplayed; } });
44
+ Object.defineProperty(exports, "handleAboutDisplayed", { enumerable: true, get: function () { return handlers_1.handleAboutDisplayed; } });
45
+ Object.defineProperty(exports, "handleAudibilityHeard", { enumerable: true, get: function () { return handlers_1.handleAudibilityHeard; } });
46
+ Object.defineProperty(exports, "tryProcessDomainEventMessage", { enumerable: true, get: function () { return handlers_1.tryProcessDomainEventMessage; } });
47
+ Object.defineProperty(exports, "handleImplicitTake", { enumerable: true, get: function () { return handlers_1.handleImplicitTake; } });
48
+ Object.defineProperty(exports, "handleCommandFailed", { enumerable: true, get: function () { return handlers_1.handleCommandFailed; } });
49
+ Object.defineProperty(exports, "handleClientQuery", { enumerable: true, get: function () { return handlers_1.handleClientQuery; } });
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,8BAA8B;AAC9B,uCAAgE;AAAvD,yGAAA,aAAa,OAAA;AAAE,+GAAA,mBAAmB,OAAA;AAK3C,oEAAoE;AACpE,oEAAoE;AACpE,8BAA8B;AAC9B,6CAQuB;AAPrB,+GAAA,gBAAgB,OAAA;AAChB,+GAAA,gBAAgB,OAAA;AAChB,kHAAA,mBAAmB,OAAA;AACnB,wHAAA,yBAAyB,OAAA;AAM3B,oCAAoC;AACpC,0CAA+C;AAAtC,sGAAA,YAAY,OAAA;AACrB,sCAGuB;AAFrB,0GAAA,kBAAkB,OAAA;AAClB,wGAAA,gBAAgB,OAAA;AAElB,uCAAqE;AAA5D,uGAAA,WAAW,OAAA;AAAE,wGAAA,YAAY,OAAA;AAAE,wGAAA,YAAY,OAAA;AAShD,uCAaoB;AAZlB,iHAAA,qBAAqB,OAAA;AACrB,0GAAA,cAAc,OAAA;AACd,6GAAA,iBAAiB,OAAA;AACjB,8GAAA,kBAAkB,OAAA;AAClB,6GAAA,iBAAiB,OAAA;AACjB,+GAAA,mBAAmB,OAAA;AACnB,gHAAA,oBAAoB,OAAA;AACpB,iHAAA,qBAAqB,OAAA;AACrB,wHAAA,4BAA4B,OAAA;AAC5B,8GAAA,kBAAkB,OAAA;AAClB,+GAAA,mBAAmB,OAAA;AACnB,6GAAA,iBAAiB,OAAA"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Prose pipeline — orchestrates the per-turn event → block translation.
3
+ *
4
+ * Pipeline stages (from `processTurn`):
5
+ * 1. Filter — drop `system.*` and `platform.*` events.
6
+ * 2. Sort — apply ADR-094 chain-metadata ordering.
7
+ * 3. Route — try the messageId path first (ADR-097), then dispatch
8
+ * by event type to a handler family.
9
+ * 4. Assemble — handlers themselves call `createBlock`, so by the
10
+ * time blocks return here they already carry parsed
11
+ * bracket decorations and final `className`s.
12
+ *
13
+ * Public interface: `class ProsePipeline implements ITextService`.
14
+ * Engine constructs one instance during `setStory()` and calls
15
+ * `processTurn` per turn (same three call sites as the retiring
16
+ * `TextService`).
17
+ *
18
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
19
+ *
20
+ * @see ADR-174 §Internal interfaces
21
+ * @see ADR-094 Event Chaining (sort stage)
22
+ * @see ADR-097 Domain Events with messageId (domain-message handler)
23
+ */
24
+ import type { ITextBlock } from '@sharpee/text-blocks';
25
+ import type { LanguageProvider } from '@sharpee/if-domain';
26
+ import type { ISemanticEvent } from '@sharpee/core';
27
+ import type { ITextService } from './types';
28
+ /**
29
+ * Engine-internal prose pipeline.
30
+ *
31
+ * Stateless transformer: events in, blocks out. Constructed once per
32
+ * `setStory()` call with the active language provider; called per
33
+ * turn by `GameEngine.executeTurn`, `GameEngine.restartGame`, and
34
+ * the meta-command path (same three sites the retired
35
+ * `TextService.processTurn` had).
36
+ */
37
+ export declare class ProsePipeline implements ITextService {
38
+ private readonly languageProvider;
39
+ constructor(languageProvider: LanguageProvider);
40
+ processTurn(events: ISemanticEvent[]): ITextBlock[];
41
+ /**
42
+ * Route an event to its handler family.
43
+ *
44
+ * Order: try the ADR-097 messageId path first (catches every stdlib
45
+ * domain event); then fall through to type-keyed handlers; finally
46
+ * the catch-all generic handler.
47
+ */
48
+ private routeToHandler;
49
+ }
50
+ /**
51
+ * Construct a `ProsePipeline` for the given language provider.
52
+ *
53
+ * Mirrors the `createTextService` factory the retired text-service
54
+ * package exposed; callers can swap one for the other without
55
+ * changing call shapes.
56
+ */
57
+ export declare function createProsePipeline(languageProvider: LanguageProvider): ITextService;
58
+ //# sourceMappingURL=pipeline.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAqBpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;;;;;GAQG;AACH,qBAAa,aAAc,YAAW,YAAY;IAChD,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAmB;gBAExC,gBAAgB,EAAE,gBAAgB;IAS9C,WAAW,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,UAAU,EAAE;IAgBnD;;;;;;OAMG;IACH,OAAO,CAAC,cAAc;CA6CvB;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,gBAAgB,GACjC,YAAY,CAEd"}
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ /**
3
+ * Prose pipeline — orchestrates the per-turn event → block translation.
4
+ *
5
+ * Pipeline stages (from `processTurn`):
6
+ * 1. Filter — drop `system.*` and `platform.*` events.
7
+ * 2. Sort — apply ADR-094 chain-metadata ordering.
8
+ * 3. Route — try the messageId path first (ADR-097), then dispatch
9
+ * by event type to a handler family.
10
+ * 4. Assemble — handlers themselves call `createBlock`, so by the
11
+ * time blocks return here they already carry parsed
12
+ * bracket decorations and final `className`s.
13
+ *
14
+ * Public interface: `class ProsePipeline implements ITextService`.
15
+ * Engine constructs one instance during `setStory()` and calls
16
+ * `processTurn` per turn (same three call sites as the retiring
17
+ * `TextService`).
18
+ *
19
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
20
+ *
21
+ * @see ADR-174 §Internal interfaces
22
+ * @see ADR-094 Event Chaining (sort stage)
23
+ * @see ADR-097 Domain Events with messageId (domain-message handler)
24
+ */
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.ProsePipeline = void 0;
27
+ exports.createProsePipeline = createProsePipeline;
28
+ const filter_1 = require("./stages/filter");
29
+ const sort_1 = require("./stages/sort");
30
+ const room_1 = require("./handlers/room");
31
+ const revealed_1 = require("./handlers/revealed");
32
+ const generic_1 = require("./handlers/generic");
33
+ const game_1 = require("./handlers/game");
34
+ const help_1 = require("./handlers/help");
35
+ const about_1 = require("./handlers/about");
36
+ const audibility_1 = require("./handlers/audibility");
37
+ const domain_message_1 = require("./handlers/domain-message");
38
+ const implicit_take_1 = require("./handlers/implicit-take");
39
+ const command_failed_1 = require("./handlers/command-failed");
40
+ const client_query_1 = require("./handlers/client-query");
41
+ /**
42
+ * Engine-internal prose pipeline.
43
+ *
44
+ * Stateless transformer: events in, blocks out. Constructed once per
45
+ * `setStory()` call with the active language provider; called per
46
+ * turn by `GameEngine.executeTurn`, `GameEngine.restartGame`, and
47
+ * the meta-command path (same three sites the retired
48
+ * `TextService.processTurn` had).
49
+ */
50
+ class ProsePipeline {
51
+ languageProvider;
52
+ constructor(languageProvider) {
53
+ if (!languageProvider) {
54
+ throw new Error('ProsePipeline requires a LanguageProvider; got null/undefined.');
55
+ }
56
+ this.languageProvider = languageProvider;
57
+ }
58
+ processTurn(events) {
59
+ const filtered = (0, filter_1.filterEvents)(events);
60
+ const sorted = (0, sort_1.sortEventsForProse)(filtered);
61
+ const context = {
62
+ languageProvider: this.languageProvider,
63
+ };
64
+ const blocks = [];
65
+ for (const event of sorted) {
66
+ blocks.push(...this.routeToHandler(event, context));
67
+ }
68
+ return blocks;
69
+ }
70
+ /**
71
+ * Route an event to its handler family.
72
+ *
73
+ * Order: try the ADR-097 messageId path first (catches every stdlib
74
+ * domain event); then fall through to type-keyed handlers; finally
75
+ * the catch-all generic handler.
76
+ */
77
+ routeToHandler(event, context) {
78
+ const messageIdResult = (0, domain_message_1.tryProcessDomainEventMessage)(event, context);
79
+ if (messageIdResult) {
80
+ return messageIdResult;
81
+ }
82
+ switch (event.type) {
83
+ case 'game.started':
84
+ return (0, game_1.handleGameStarted)(event, context);
85
+ case 'if.event.room_description':
86
+ case 'if.event.room.description':
87
+ return (0, room_1.handleRoomDescription)(event, context);
88
+ case 'game.message':
89
+ return (0, generic_1.handleGameMessage)(event, context);
90
+ case 'if.event.revealed':
91
+ return (0, revealed_1.handleRevealed)(event, context);
92
+ case 'if.event.help_displayed':
93
+ return (0, help_1.handleHelpDisplayed)(event, context);
94
+ case 'if.event.about_displayed':
95
+ return (0, about_1.handleAboutDisplayed)(event, context);
96
+ case 'sound.audibility.heard':
97
+ return (0, audibility_1.handleAudibilityHeard)(event, context);
98
+ case 'if.event.implicit_take':
99
+ return (0, implicit_take_1.handleImplicitTake)(event, context);
100
+ case 'command.failed':
101
+ return (0, command_failed_1.handleCommandFailed)(event, context);
102
+ case 'client.query':
103
+ return (0, client_query_1.handleClientQuery)(event, context);
104
+ default:
105
+ return (0, generic_1.handleGenericEvent)(event, context);
106
+ }
107
+ }
108
+ }
109
+ exports.ProsePipeline = ProsePipeline;
110
+ /**
111
+ * Construct a `ProsePipeline` for the given language provider.
112
+ *
113
+ * Mirrors the `createTextService` factory the retired text-service
114
+ * package exposed; callers can swap one for the other without
115
+ * changing call shapes.
116
+ */
117
+ function createProsePipeline(languageProvider) {
118
+ return new ProsePipeline(languageProvider);
119
+ }
120
+ //# sourceMappingURL=pipeline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/pipeline.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;;;AA6HH,kDAIC;AA3HD,4CAA+C;AAC/C,wCAAmD;AAGnD,0CAAwD;AACxD,kDAAqD;AACrD,gDAG4B;AAC5B,0CAAoD;AACpD,0CAAsD;AACtD,4CAAwD;AACxD,sDAA8D;AAC9D,8DAAyE;AACzE,4DAA8D;AAC9D,8DAAgE;AAChE,0DAA4D;AAI5D;;;;;;;;GAQG;AACH,MAAa,aAAa;IACP,gBAAgB,CAAmB;IAEpD,YAAY,gBAAkC;QAC5C,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CACb,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CAAC;YAE7C,KAAK,0BAA0B;gBAC7B,OAAO,IAAA,4BAAoB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAE9C,KAAK,wBAAwB;gBAC3B,OAAO,IAAA,kCAAqB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAE/C,KAAK,wBAAwB;gBAC3B,OAAO,IAAA,kCAAkB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAE5C,KAAK,gBAAgB;gBACnB,OAAO,IAAA,oCAAmB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAE7C,KAAK,cAAc;gBACjB,OAAO,IAAA,gCAAiB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAE3C;gBACE,OAAO,IAAA,4BAAkB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC;CACF;AAhFD,sCAgFC;AAED;;;;;;GAMG;AACH,SAAgB,mBAAmB,CACjC,gBAAkC;IAElC,OAAO,IAAI,aAAa,CAAC,gBAAgB,CAAC,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Event filtering stage — drops events that should not produce
3
+ * text output (system.* and platform.*).
4
+ *
5
+ * Public interface: `filterEvents`. Used internally by the prose
6
+ * pipeline as the first per-turn stage.
7
+ *
8
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
9
+ *
10
+ * @see ADR-174 §Engine-internal prose pipeline
11
+ * @see ADR-096 (preserved): the filter responsibility ports unchanged
12
+ * from `@sharpee/text-service`.
13
+ */
14
+ import type { ISemanticEvent } from '@sharpee/core';
15
+ /**
16
+ * Filter events that should produce text output.
17
+ *
18
+ * Drops:
19
+ * - `system.*` — internal turn-cycle bookkeeping the player never sees.
20
+ * - `platform.*` — save/restore/quit/restart requests and completions.
21
+ *
22
+ * Pass-through for everything else (domain events, action results,
23
+ * lifecycle events, sound, etc.) — they reach the handlers stage.
24
+ */
25
+ export declare function filterEvents(events: ISemanticEvent[]): ISemanticEvent[];
26
+ //# sourceMappingURL=filter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/stages/filter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,cAAc,EAAE,CAUvE"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ /**
3
+ * Event filtering stage — drops events that should not produce
4
+ * text output (system.* and platform.*).
5
+ *
6
+ * Public interface: `filterEvents`. Used internally by the prose
7
+ * pipeline as the first per-turn stage.
8
+ *
9
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
10
+ *
11
+ * @see ADR-174 §Engine-internal prose pipeline
12
+ * @see ADR-096 (preserved): the filter responsibility ports unchanged
13
+ * from `@sharpee/text-service`.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.filterEvents = filterEvents;
17
+ /**
18
+ * Filter events that should produce text output.
19
+ *
20
+ * Drops:
21
+ * - `system.*` — internal turn-cycle bookkeeping the player never sees.
22
+ * - `platform.*` — save/restore/quit/restart requests and completions.
23
+ *
24
+ * Pass-through for everything else (domain events, action results,
25
+ * lifecycle events, sound, etc.) — they reach the handlers stage.
26
+ */
27
+ function filterEvents(events) {
28
+ return events.filter((event) => {
29
+ if (event.type.startsWith('system.')) {
30
+ return false;
31
+ }
32
+ if (event.type.startsWith('platform.')) {
33
+ return false;
34
+ }
35
+ return true;
36
+ });
37
+ }
38
+ //# sourceMappingURL=filter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/stages/filter.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;AAcH,oCAUC;AApBD;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAAC,MAAwB;IACnD,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;QAC7B,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YACrC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;YACvC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Prose pipeline stages — internal barrel.
3
+ *
4
+ * Public interface: re-exports `filterEvents`, `sortEventsForProse`,
5
+ * and `getChainMetadata`. Used by the pipeline class (sub-phase 1.5).
6
+ *
7
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
8
+ *
9
+ * @see ADR-174 §Engine-internal prose pipeline
10
+ */
11
+ export { filterEvents } from './filter';
12
+ export { sortEventsForProse, getChainMetadata } from './sort';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/stages/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ /**
3
+ * Prose pipeline stages — internal barrel.
4
+ *
5
+ * Public interface: re-exports `filterEvents`, `sortEventsForProse`,
6
+ * and `getChainMetadata`. Used by the pipeline class (sub-phase 1.5).
7
+ *
8
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
9
+ *
10
+ * @see ADR-174 §Engine-internal prose pipeline
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.getChainMetadata = exports.sortEventsForProse = exports.filterEvents = void 0;
14
+ var filter_1 = require("./filter");
15
+ Object.defineProperty(exports, "filterEvents", { enumerable: true, get: function () { return filter_1.filterEvents; } });
16
+ var sort_1 = require("./sort");
17
+ Object.defineProperty(exports, "sortEventsForProse", { enumerable: true, get: function () { return sort_1.sortEventsForProse; } });
18
+ Object.defineProperty(exports, "getChainMetadata", { enumerable: true, get: function () { return sort_1.getChainMetadata; } });
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/stages/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,mCAAwC;AAA/B,sGAAA,YAAY,OAAA;AACrB,+BAA8D;AAArD,0GAAA,kBAAkB,OAAA;AAAE,wGAAA,gBAAgB,OAAA"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Event sorting stage — orders events within a turn for correct prose
3
+ * sequence: lifecycle first, then per-transaction implicit-take →
4
+ * room-description → action.* → others, finally by chain depth.
5
+ *
6
+ * Public interface: `sortEventsForProse`, `getChainMetadata`. Used
7
+ * internally by the prose pipeline as the second per-turn stage,
8
+ * after filtering.
9
+ *
10
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
11
+ *
12
+ * @see ADR-094 Event Chaining (preserved; the sort responsibility
13
+ * ports from `@sharpee/text-service`)
14
+ * @see ADR-174 §Engine-internal prose pipeline
15
+ */
16
+ import type { ISemanticEvent } from '@sharpee/core';
17
+ /**
18
+ * Event data with chain metadata (ADR-094).
19
+ */
20
+ interface ChainMetadata {
21
+ _transactionId?: string;
22
+ _chainDepth?: number;
23
+ _chainedFrom?: string;
24
+ _chainSourceId?: string;
25
+ }
26
+ /**
27
+ * Sort events for correct prose order within transactions.
28
+ *
29
+ * Stable sort — preserves cross-transaction order while applying
30
+ * within-transaction rules.
31
+ */
32
+ export declare function sortEventsForProse(events: ISemanticEvent[]): ISemanticEvent[];
33
+ /**
34
+ * Extract chain metadata from event data.
35
+ */
36
+ export declare function getChainMetadata(event: ISemanticEvent): ChainMetadata;
37
+ export {};
38
+ //# sourceMappingURL=sort.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/stages/sort.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD;;GAEG;AACH,UAAU,aAAa;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAUD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,cAAc,EAAE,CAgD7E;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,GAAG,aAAa,CAQrE"}
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ /**
3
+ * Event sorting stage — orders events within a turn for correct prose
4
+ * sequence: lifecycle first, then per-transaction implicit-take →
5
+ * room-description → action.* → others, finally by chain depth.
6
+ *
7
+ * Public interface: `sortEventsForProse`, `getChainMetadata`. Used
8
+ * internally by the prose pipeline as the second per-turn stage,
9
+ * after filtering.
10
+ *
11
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
12
+ *
13
+ * @see ADR-094 Event Chaining (preserved; the sort responsibility
14
+ * ports from `@sharpee/text-service`)
15
+ * @see ADR-174 §Engine-internal prose pipeline
16
+ */
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.sortEventsForProse = sortEventsForProse;
19
+ exports.getChainMetadata = getChainMetadata;
20
+ const LIFECYCLE_EVENTS = new Set([
21
+ 'game.started',
22
+ 'game.starting',
23
+ 'game.loading',
24
+ 'game.loaded',
25
+ 'game.initialized',
26
+ ]);
27
+ /**
28
+ * Sort events for correct prose order within transactions.
29
+ *
30
+ * Stable sort — preserves cross-transaction order while applying
31
+ * within-transaction rules.
32
+ */
33
+ function sortEventsForProse(events) {
34
+ return [...events].sort((a, b) => {
35
+ const aData = a.data;
36
+ const bData = b.data;
37
+ const aTxnId = aData?._transactionId;
38
+ const bTxnId = bData?._transactionId;
39
+ // Game lifecycle events come first, before everything.
40
+ // Ensures the banner displays before the first room description.
41
+ // Note: matches specific lifecycle events only, NOT game.message.
42
+ const aIsGameLifecycle = LIFECYCLE_EVENTS.has(a.type);
43
+ const bIsGameLifecycle = LIFECYCLE_EVENTS.has(b.type);
44
+ if (aIsGameLifecycle && !bIsGameLifecycle)
45
+ return -1;
46
+ if (!aIsGameLifecycle && bIsGameLifecycle)
47
+ return 1;
48
+ // Different transactions or no transaction: maintain original order.
49
+ if (aTxnId !== bTxnId)
50
+ return 0;
51
+ // Implicit take events come first, before the main action result:
52
+ // "first taking the X" before "X reads:..."
53
+ const aIsImplicitTake = a.type === 'if.event.implicit_take';
54
+ const bIsImplicitTake = b.type === 'if.event.implicit_take';
55
+ if (aIsImplicitTake && !bIsImplicitTake)
56
+ return -1;
57
+ if (!aIsImplicitTake && bIsImplicitTake)
58
+ return 1;
59
+ // Room description before action.success (for contents list):
60
+ // "Room Name\nDescription" before "You see X here."
61
+ const aIsRoomDesc = a.type === 'if.event.room.description' ||
62
+ a.type === 'if.event.room_description';
63
+ const bIsRoomDesc = b.type === 'if.event.room.description' ||
64
+ b.type === 'if.event.room_description';
65
+ if (aIsRoomDesc && !bIsRoomDesc)
66
+ return -1;
67
+ if (!aIsRoomDesc && bIsRoomDesc)
68
+ return 1;
69
+ // Within transaction: action.* first (after room description).
70
+ const aIsAction = a.type.startsWith('action.');
71
+ const bIsAction = b.type.startsWith('action.');
72
+ if (aIsAction && !bIsAction)
73
+ return -1;
74
+ if (!aIsAction && bIsAction)
75
+ return 1;
76
+ // Then by chain depth (lower depth first).
77
+ const aDepth = aData?._chainDepth ?? 0;
78
+ const bDepth = bData?._chainDepth ?? 0;
79
+ return aDepth - bDepth;
80
+ });
81
+ }
82
+ /**
83
+ * Extract chain metadata from event data.
84
+ */
85
+ function getChainMetadata(event) {
86
+ const data = event.data;
87
+ return {
88
+ _transactionId: data?._transactionId,
89
+ _chainDepth: data?._chainDepth,
90
+ _chainedFrom: data?._chainedFrom,
91
+ _chainSourceId: data?._chainSourceId,
92
+ };
93
+ }
94
+ //# sourceMappingURL=sort.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sort.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/stages/sort.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AA4BH,gDAgDC;AAKD,4CAQC;AA3ED,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC;IAC/B,cAAc;IACd,eAAe;IACf,cAAc;IACd,aAAa;IACb,kBAAkB;CACnB,CAAC,CAAC;AAEH;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,MAAwB;IACzD,OAAO,CAAC,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QAC/B,MAAM,KAAK,GAAG,CAAC,CAAC,IAAiC,CAAC;QAClD,MAAM,KAAK,GAAG,CAAC,CAAC,IAAiC,CAAC;QAElD,MAAM,MAAM,GAAG,KAAK,EAAE,cAAc,CAAC;QACrC,MAAM,MAAM,GAAG,KAAK,EAAE,cAAc,CAAC;QAErC,uDAAuD;QACvD,iEAAiE;QACjE,kEAAkE;QAClE,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACtD,MAAM,gBAAgB,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACt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AM,MAAM,GAAG,KAAK,EAAE,WAAW,IAAI,CAAC,CAAC;QACvC,OAAO,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,SAAgB,gBAAgB,CAAC,KAAqB;IACpD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAiC,CAAC;IACrD,OAAO;QACL,cAAc,EAAE,IAAI,EAAE,cAAc;QACpC,WAAW,EAAE,IAAI,EAAE,WAAW;QAC9B,YAAY,EAAE,IAAI,EAAE,YAAY;QAChC,cAAc,EAAE,IAAI,EAAE,cAAc;KACrC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Prose pipeline service interface — engine-internal home for the
3
+ * `ITextService` contract.
4
+ *
5
+ * Per ADR-174, the responsibility for translating events into blocks
6
+ * moves into `@sharpee/engine`. The transitional `ITextService` name
7
+ * is preserved here so engine code already typed against it (the
8
+ * three `processTurn` call sites in `game-engine.ts` and the
9
+ * `getTextService` / `setTextService` accessors) can keep compiling
10
+ * during sub-phase 1.6's import swap. A follow-up cleanup may rename
11
+ * this to `IProsePipeline` once the legacy alias is no longer
12
+ * imported anywhere.
13
+ *
14
+ * Public interface: `ITextService`. Implemented by `ProsePipeline`
15
+ * (and by `MockProsePipeline` in tests).
16
+ *
17
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
18
+ *
19
+ * @see ADR-174 §Internal interfaces
20
+ */
21
+ import type { ISemanticEvent } from '@sharpee/core';
22
+ import type { ITextBlock } from '@sharpee/text-blocks';
23
+ /**
24
+ * Per-turn prose translator.
25
+ *
26
+ * Stateless transformer: takes the events emitted during a turn,
27
+ * returns the structured `ITextBlock[]` the channel layer hands off
28
+ * to renderers. Engine constructs an implementation once during
29
+ * `setStory()` and calls `processTurn` per turn (and per
30
+ * meta-command / restart).
31
+ */
32
+ export interface ITextService {
33
+ /**
34
+ * Process turn events and produce TextBlocks.
35
+ *
36
+ * Called by Engine after each turn completes — and again on the
37
+ * meta-command path (restart, restore) where the same per-turn
38
+ * shape applies.
39
+ *
40
+ * @param events All events from this turn, including chained ones.
41
+ * @returns Blocks in render order.
42
+ */
43
+ processTurn(events: ISemanticEvent[]): ITextBlock[];
44
+ }
45
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;;;;OASG;IACH,WAAW,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,UAAU,EAAE,CAAC;CACrD"}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ /**
3
+ * Prose pipeline service interface — engine-internal home for the
4
+ * `ITextService` contract.
5
+ *
6
+ * Per ADR-174, the responsibility for translating events into blocks
7
+ * moves into `@sharpee/engine`. The transitional `ITextService` name
8
+ * is preserved here so engine code already typed against it (the
9
+ * three `processTurn` call sites in `game-engine.ts` and the
10
+ * `getTextService` / `setTextService` accessors) can keep compiling
11
+ * during sub-phase 1.6's import swap. A follow-up cleanup may rename
12
+ * this to `IProsePipeline` once the legacy alias is no longer
13
+ * imported anywhere.
14
+ *
15
+ * Public interface: `ITextService`. Implemented by `ProsePipeline`
16
+ * (and by `MockProsePipeline` in tests).
17
+ *
18
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
19
+ *
20
+ * @see ADR-174 §Internal interfaces
21
+ */
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG"}
@@ -18,9 +18,9 @@
18
18
  * the ScoreLedger, capabilities, world state values, relationships,
19
19
  * ID counters, and sub-container containment.
20
20
  */
21
- import { WorldModel } from "../world-model/index";
22
- import { ISaveData, ISerializedTurn, ISemanticEventSource } from "../core/index";
23
- import { PluginRegistry } from "../plugins/index";
21
+ import { WorldModel } from '@sharpee/world-model';
22
+ import { ISaveData, ISerializedTurn, ISemanticEventSource } from '@sharpee/core';
23
+ import { PluginRegistry } from '@sharpee/plugins';
24
24
  import { TurnResult, GameContext } from './types';
25
25
  import { Story } from './story';
26
26
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"save-restore-service.d.ts","sourceRoot":"","sources":["../../../../../repos/sharpee/packages/engine/src/save-restore-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EACL,SAAS,EAIT,eAAe,EAEf,oBAAoB,EAErB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AA0DhC;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,IAAI,UAAU,CAAC;IACvB,UAAU,IAAI,WAAW,CAAC;IAC1B,QAAQ,IAAI,KAAK,GAAG,SAAS,CAAC;IAC9B,cAAc,IAAI,oBAAoB,CAAC;IACvC,iBAAiB,IAAI,cAAc,CAAC;IACpC,SAAS,IAAI,OAAO,GAAG,SAAS,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,kBAAkB;IAE7B,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,iBAAiB,CAAgB;IACzC,OAAO,CAAC,gBAAgB,CAAS;gBAErB,MAAM,CAAC,EAAE,UAAU;IAI/B;;OAEG;IACH,kBAAkB,CAAC,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;IAiBhE;;;OAGG;IACH,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAehD;;OAEG;IACH,OAAO,IAAI,OAAO;IAIlB;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,kBAAkB,IAAI,IAAI;IAK1B;;OAEG;IACH,cAAc,CAAC,QAAQ,EAAE,yBAAyB,GAAG,SAAS;IAwC9D;;;OAGG;IACH,YAAY,CACV,QAAQ,EAAE,SAAS,EACnB,QAAQ,EAAE,yBAAyB,GAClC;QACD,WAAW,EAAE,oBAAoB,CAAC;QAClC,WAAW,EAAE,MAAM,CAAC;KACrB;IA4CD;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAe5B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA6B1B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAgB9B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAwB5B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAe5B;;OAEG;IACH,sBAAsB,CACpB,KAAK,EAAE,eAAe,EAAE,EACxB,WAAW,EAAE,oBAAoB,GAChC,UAAU,EAAE;IAoBf;;OAEG;IACH,OAAO,CAAC,oBAAoB;CAU7B;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,kBAAkB,CAEhF"}
1
+ {"version":3,"file":"save-restore-service.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/engine/src/save-restore-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,EAAE,UAAU,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oB,CAAC;QAClC,WAAW,EAAE,MAAM,CAAC;KACrB;IA4CD;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAe5B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA6B1B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAgB9B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAwB5B;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAe5B;;OAEG;IACH,sBAAsB,CACpB,KAAK,EAAE,eAAe,EAAE,EACxB,WAAW,EAAE,oBAAoB,GAChC,UAAU,EAAE;IAoBf;;OAEG;IACH,OAAO,CAAC,oBAAoB;CAU7B;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,kBAAkB,CAEhF"}
@@ -23,7 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
23
23
  exports.SaveRestoreService = void 0;
24
24
  exports.createSaveRestoreService = createSaveRestoreService;
25
25
  const fflate_1 = require("fflate");
26
- const core_1 = require("../core/index.js");
26
+ const core_1 = require("@sharpee/core");
27
27
  /**
28
28
  * Save format version. Bumped from `1.0.0` → `2.0.0` when the partial
29
29
  * `spatialIndex` serializer was replaced with the full `worldSnapshot`
@@ -12,8 +12,8 @@
12
12
  * Public interface: SceneEvaluationPlugin (TurnPlugin implementation).
13
13
  * Owner context: @sharpee/engine — turn cycle
14
14
  */
15
- import { ISemanticEvent } from "../core/index";
16
- import type { TurnPlugin, TurnPluginContext } from "../plugins/index";
15
+ import { ISemanticEvent } from '@sharpee/core';
16
+ import type { TurnPlugin, TurnPluginContext } from '@sharpee/plugins';
17
17
  export declare class SceneEvaluationPlugin implements TurnPlugin {
18
18
  id: string;
19
19
  priority: number;
@@ -1 +1 @@
1
- {"version":3,"file":"scene-evaluation-plugin.d.ts","sourceRoot":"","sources":["../../../../../repos/sharpee/packages/engine/src/scene-evaluation-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAiBtE,qBAAa,qBAAsB,YAAW,UAAU;IACtD,EAAE,SAA8B;IAChC,QAAQ,SAAM;IAEd;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,iBAAiB,GAAG,cAAc,EAAE;CAmE5D"}
1
+ {"version":3,"file":"scene-evaluation-plugin.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/engine/src/scene-evaluation-plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAiBtE,qBAAa,qBAAsB,YAAW,UAAU;IACtD,EAAE,SAA8B;IAChC,QAAQ,SAAM;IAEd;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,iBAAiB,GAAG,cAAc,EAAE;CAmE5D"}