@sharpee/engine 0.9.113 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/action-context-factory.d.ts +10 -2
  2. package/action-context-factory.d.ts.map +1 -1
  3. package/action-context-factory.js +29 -5
  4. package/action-context-factory.js.map +1 -1
  5. package/command-executor.d.ts +2 -1
  6. package/command-executor.d.ts.map +1 -1
  7. package/command-executor.js +3 -3
  8. package/command-executor.js.map +1 -1
  9. package/game-engine.d.ts +87 -4
  10. package/game-engine.d.ts.map +1 -1
  11. package/game-engine.js +239 -8
  12. package/game-engine.js.map +1 -1
  13. package/index.d.ts +1 -0
  14. package/index.d.ts.map +1 -1
  15. package/index.js +2 -0
  16. package/index.js.map +1 -1
  17. package/package.json +12 -12
  18. package/prose-pipeline/assemble.d.ts +77 -0
  19. package/prose-pipeline/assemble.d.ts.map +1 -0
  20. package/prose-pipeline/assemble.js +96 -0
  21. package/prose-pipeline/assemble.js.map +1 -0
  22. package/prose-pipeline/decorations/index.d.ts +18 -0
  23. package/prose-pipeline/decorations/index.d.ts.map +1 -0
  24. package/prose-pipeline/decorations/index.js +24 -0
  25. package/prose-pipeline/decorations/index.js.map +1 -0
  26. package/prose-pipeline/decorations/parser.d.ts +34 -0
  27. package/prose-pipeline/decorations/parser.d.ts.map +1 -0
  28. package/prose-pipeline/decorations/parser.js +177 -0
  29. package/prose-pipeline/decorations/parser.js.map +1 -0
  30. package/prose-pipeline/decorations/platform-vocabulary.d.ts +27 -0
  31. package/prose-pipeline/decorations/platform-vocabulary.d.ts.map +1 -0
  32. package/prose-pipeline/decorations/platform-vocabulary.js +65 -0
  33. package/prose-pipeline/decorations/platform-vocabulary.js.map +1 -0
  34. package/prose-pipeline/decorations/resolver.d.ts +28 -0
  35. package/prose-pipeline/decorations/resolver.d.ts.map +1 -0
  36. package/prose-pipeline/decorations/resolver.js +39 -0
  37. package/prose-pipeline/decorations/resolver.js.map +1 -0
  38. package/prose-pipeline/decorations/types.d.ts +16 -0
  39. package/prose-pipeline/decorations/types.d.ts.map +1 -0
  40. package/prose-pipeline/decorations/types.js +17 -0
  41. package/prose-pipeline/decorations/types.js.map +1 -0
  42. package/prose-pipeline/handlers/about.d.ts +31 -0
  43. package/prose-pipeline/handlers/about.d.ts.map +1 -0
  44. package/prose-pipeline/handlers/about.js +50 -0
  45. package/prose-pipeline/handlers/about.js.map +1 -0
  46. package/prose-pipeline/handlers/audibility.d.ts +46 -0
  47. package/prose-pipeline/handlers/audibility.d.ts.map +1 -0
  48. package/prose-pipeline/handlers/audibility.js +79 -0
  49. package/prose-pipeline/handlers/audibility.js.map +1 -0
  50. package/prose-pipeline/handlers/banner.d.ts +44 -0
  51. package/prose-pipeline/handlers/banner.d.ts.map +1 -0
  52. package/prose-pipeline/handlers/banner.js +88 -0
  53. package/prose-pipeline/handlers/banner.js.map +1 -0
  54. package/prose-pipeline/handlers/client-query.d.ts +22 -0
  55. package/prose-pipeline/handlers/client-query.d.ts.map +1 -0
  56. package/prose-pipeline/handlers/client-query.js +55 -0
  57. package/prose-pipeline/handlers/client-query.js.map +1 -0
  58. package/prose-pipeline/handlers/command-failed.d.ts +24 -0
  59. package/prose-pipeline/handlers/command-failed.d.ts.map +1 -0
  60. package/prose-pipeline/handlers/command-failed.js +46 -0
  61. package/prose-pipeline/handlers/command-failed.js.map +1 -0
  62. package/prose-pipeline/handlers/domain-message.d.ts +31 -0
  63. package/prose-pipeline/handlers/domain-message.d.ts.map +1 -0
  64. package/prose-pipeline/handlers/domain-message.js +66 -0
  65. package/prose-pipeline/handlers/domain-message.js.map +1 -0
  66. package/prose-pipeline/handlers/game.d.ts +31 -0
  67. package/prose-pipeline/handlers/game.d.ts.map +1 -0
  68. package/prose-pipeline/handlers/game.js +35 -0
  69. package/prose-pipeline/handlers/game.js.map +1 -0
  70. package/prose-pipeline/handlers/generic.d.ts +27 -0
  71. package/prose-pipeline/handlers/generic.d.ts.map +1 -0
  72. package/prose-pipeline/handlers/generic.js +67 -0
  73. package/prose-pipeline/handlers/generic.js.map +1 -0
  74. package/prose-pipeline/handlers/help.d.ts +21 -0
  75. package/prose-pipeline/handlers/help.d.ts.map +1 -0
  76. package/prose-pipeline/handlers/help.js +68 -0
  77. package/prose-pipeline/handlers/help.js.map +1 -0
  78. package/prose-pipeline/handlers/implicit-take.d.ts +20 -0
  79. package/prose-pipeline/handlers/implicit-take.d.ts.map +1 -0
  80. package/prose-pipeline/handlers/implicit-take.js +26 -0
  81. package/prose-pipeline/handlers/implicit-take.js.map +1 -0
  82. package/prose-pipeline/handlers/index.d.ts +24 -0
  83. package/prose-pipeline/handlers/index.d.ts.map +1 -0
  84. package/prose-pipeline/handlers/index.js +40 -0
  85. package/prose-pipeline/handlers/index.js.map +1 -0
  86. package/prose-pipeline/handlers/revealed.d.ts +24 -0
  87. package/prose-pipeline/handlers/revealed.d.ts.map +1 -0
  88. package/prose-pipeline/handlers/revealed.js +54 -0
  89. package/prose-pipeline/handlers/revealed.js.map +1 -0
  90. package/prose-pipeline/handlers/room.d.ts +25 -0
  91. package/prose-pipeline/handlers/room.d.ts.map +1 -0
  92. package/prose-pipeline/handlers/room.js +78 -0
  93. package/prose-pipeline/handlers/room.js.map +1 -0
  94. package/prose-pipeline/handlers/types.d.ts +47 -0
  95. package/prose-pipeline/handlers/types.d.ts.map +1 -0
  96. package/prose-pipeline/handlers/types.js +15 -0
  97. package/prose-pipeline/handlers/types.js.map +1 -0
  98. package/prose-pipeline/index.d.ts +20 -0
  99. package/prose-pipeline/index.d.ts.map +1 -0
  100. package/prose-pipeline/index.js +50 -0
  101. package/prose-pipeline/index.js.map +1 -0
  102. package/prose-pipeline/pipeline.d.ts +58 -0
  103. package/prose-pipeline/pipeline.d.ts.map +1 -0
  104. package/prose-pipeline/pipeline.js +120 -0
  105. package/prose-pipeline/pipeline.js.map +1 -0
  106. package/prose-pipeline/stages/filter.d.ts +26 -0
  107. package/prose-pipeline/stages/filter.d.ts.map +1 -0
  108. package/prose-pipeline/stages/filter.js +38 -0
  109. package/prose-pipeline/stages/filter.js.map +1 -0
  110. package/prose-pipeline/stages/index.d.ts +13 -0
  111. package/prose-pipeline/stages/index.d.ts.map +1 -0
  112. package/prose-pipeline/stages/index.js +19 -0
  113. package/prose-pipeline/stages/index.js.map +1 -0
  114. package/prose-pipeline/stages/sort.d.ts +38 -0
  115. package/prose-pipeline/stages/sort.d.ts.map +1 -0
  116. package/prose-pipeline/stages/sort.js +94 -0
  117. package/prose-pipeline/stages/sort.js.map +1 -0
  118. package/prose-pipeline/types.d.ts +45 -0
  119. package/prose-pipeline/types.d.ts.map +1 -0
  120. package/prose-pipeline/types.js +23 -0
  121. package/prose-pipeline/types.js.map +1 -0
  122. package/sound/dispatcher.d.ts +75 -0
  123. package/sound/dispatcher.d.ts.map +1 -0
  124. package/sound/dispatcher.js +122 -0
  125. package/sound/dispatcher.js.map +1 -0
  126. package/sound/index.d.ts +26 -0
  127. package/sound/index.d.ts.map +1 -0
  128. package/sound/index.js +34 -0
  129. package/sound/index.js.map +1 -0
  130. package/sound/propagation.d.ts +69 -0
  131. package/sound/propagation.d.ts.map +1 -0
  132. package/sound/propagation.js +219 -0
  133. package/sound/propagation.js.map +1 -0
  134. package/story.d.ts +28 -1
  135. package/story.d.ts.map +1 -1
  136. package/story.js.map +1 -1
  137. package/test-helpers/mock-prose-pipeline.d.ts +22 -0
  138. package/test-helpers/mock-prose-pipeline.d.ts.map +1 -0
  139. package/test-helpers/mock-prose-pipeline.js +56 -0
  140. package/test-helpers/mock-prose-pipeline.js.map +1 -0
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ /**
3
+ * Room description event handler.
4
+ *
5
+ * Handles `if.event.room.description` (canonical form) and
6
+ * `if.event.room_description` (legacy alternate). Resolves the
7
+ * room name and description through the language provider when a
8
+ * message id is present (ADR-107 dual-mode), falling back to literal
9
+ * text otherwise.
10
+ *
11
+ * Public interface: `handleRoomDescription`. Used by the pipeline's
12
+ * event-type dispatch.
13
+ *
14
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
15
+ *
16
+ * @see ADR-107 — Dual-mode literal/messageId handling
17
+ * @see ADR-174 §Engine-internal prose pipeline (port from text-service)
18
+ */
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.handleRoomDescription = handleRoomDescription;
21
+ const text_blocks_1 = require("../../../text-blocks/index.js");
22
+ const assemble_1 = require("../assemble");
23
+ /**
24
+ * Handle room description events.
25
+ */
26
+ function handleRoomDescription(event, context) {
27
+ const data = event.data;
28
+ const blocks = [];
29
+ // Room name (if verbose).
30
+ if (data.verbose) {
31
+ let name;
32
+ // ADR-107: message ID takes precedence.
33
+ const nameId = data.roomNameId ?? data.room?.nameId;
34
+ if (nameId && context.languageProvider) {
35
+ const resolved = context.languageProvider.getMessage(nameId, {});
36
+ if (resolved && resolved !== nameId) {
37
+ name = resolved;
38
+ }
39
+ }
40
+ if (!name) {
41
+ name = data.room?.name ?? data.roomName;
42
+ }
43
+ if (name) {
44
+ const resolvedName = (0, assemble_1.extractValue)(name);
45
+ if (resolvedName) {
46
+ blocks.push((0, assemble_1.createBlock)(text_blocks_1.BLOCK_KEYS.ROOM_NAME, `[room:${resolvedName}]`));
47
+ }
48
+ }
49
+ }
50
+ // Room description.
51
+ let description;
52
+ const descriptionId = data.roomDescriptionId ?? data.room?.descriptionId;
53
+ if (descriptionId && context.languageProvider) {
54
+ const resolved = context.languageProvider.getMessage(descriptionId, {});
55
+ if (resolved && resolved !== descriptionId) {
56
+ description = resolved;
57
+ }
58
+ }
59
+ if (!description) {
60
+ description = data.room?.description ?? data.roomDescription;
61
+ }
62
+ if (description) {
63
+ const resolvedDesc = (0, assemble_1.extractValue)(description);
64
+ if (resolvedDesc) {
65
+ const descBlocks = (0, assemble_1.createBlocks)(text_blocks_1.BLOCK_KEYS.ROOM_DESCRIPTION, resolvedDesc);
66
+ // When the room name was emitted in this packet, the description's
67
+ // first block continues the room "heading" visually — mark it tight
68
+ // so the renderer collapses the inter-paragraph margin and the
69
+ // description sits flush under the bold room name.
70
+ if (descBlocks.length > 0 && blocks.length > 0) {
71
+ descBlocks[0] = { ...descBlocks[0], tight: true };
72
+ }
73
+ blocks.push(...descBlocks);
74
+ }
75
+ }
76
+ return blocks;
77
+ }
78
+ //# sourceMappingURL=room.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"room.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/room.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;AAkCH,sDAiEC;AAhGD,sDAAkD;AAGlD,0CAAsE;AAyBtE;;GAEG;AACH,SAAgB,qBAAqB,CACnC,KAAqB,EACrB,OAAuB;IAEvB,MAAM,IAAI,GAAG,KAAK,CAAC,IAA2B,CAAC;IAC/C,MAAM,MAAM,GAAiB,EAAE,CAAC;IAEhC,0BAA0B;IAC1B,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACjB,IAAI,IAAwB,CAAC;QAE7B,wCAAwC;QACxC,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC;QACpD,IAAI,MAAM,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;YACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACjE,IAAI,QAAQ,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;gBACpC,IAAI,GAAG,QAAQ,CAAC;YAClB,CAAC;QACH,CAAC;QAED,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC;QAC1C,CAAC;QAED,IAAI,IAAI,EAAE,CAAC;YACT,MAAM,YAAY,GAAG,IAAA,uBAAY,EAAC,IAAI,CAAC,CAAC;YACxC,IAAI,YAAY,EAAE,CAAC;gBACjB,MAAM,CAAC,IAAI,CACT,IAAA,sBAAW,EAAC,wBAAU,CAAC,SAAS,EAAE,SAAS,YAAY,GAAG,CAAC,CAC5D,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,oBAAoB;IACpB,IAAI,WAA+B,CAAC;IAEpC,MAAM,aAAa,GAAG,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC;IACzE,IAAI,aAAa,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAC9C,MAAM,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;QACxE,IAAI,QAAQ,IAAI,QAAQ,KAAK,aAAa,EAAE,CAAC;YAC3C,WAAW,GAAG,QAAQ,CAAC;QACzB,CAAC;IACH,CAAC;IAED,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,WAAW,GAAG,IAAI,CAAC,IAAI,EAAE,WAAW,IAAI,IAAI,CAAC,eAAe,CAAC;IAC/D,CAAC;IAED,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,YAAY,GAAG,IAAA,uBAAY,EAAC,WAAW,CAAC,CAAC;QAC/C,IAAI,YAAY,EAAE,CAAC;YACjB,MAAM,UAAU,GAAG,IAAA,uBAAY,EAAC,wBAAU,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;YAC3E,mEAAmE;YACnE,oEAAoE;YACpE,+DAA+D;YAC/D,mDAAmD;YACnD,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC/C,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;YACpD,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Handler types for the engine prose pipeline.
3
+ *
4
+ * Public interface: `HandlerContext`, `EventHandler`,
5
+ * `ChainableEventData`, `GenericEventData`. Used by handler families
6
+ * and the pipeline class.
7
+ *
8
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
9
+ *
10
+ * @see ADR-174 §Engine-internal prose pipeline
11
+ * @see ADR-094 (chain metadata semantics, preserved)
12
+ */
13
+ import type { ITextBlock } from "../../../text-blocks/index";
14
+ import type { LanguageProvider } from "../../../if-domain/index";
15
+ import type { ISemanticEvent } from "../../../core/index";
16
+ /**
17
+ * Context passed to event handlers.
18
+ */
19
+ export interface HandlerContext {
20
+ /** Language provider for template resolution. */
21
+ languageProvider?: LanguageProvider;
22
+ }
23
+ /**
24
+ * Event handler function signature.
25
+ *
26
+ * Handlers receive an event and context, return zero or more TextBlocks.
27
+ */
28
+ export type EventHandler = (event: ISemanticEvent, context: HandlerContext) => ITextBlock[];
29
+ /**
30
+ * Common event data with chain metadata (ADR-094).
31
+ */
32
+ export interface ChainableEventData {
33
+ _transactionId?: string;
34
+ _chainDepth?: number;
35
+ _chainedFrom?: string;
36
+ _chainSourceId?: string;
37
+ }
38
+ /**
39
+ * Generic event data with message fields.
40
+ */
41
+ export interface GenericEventData extends ChainableEventData {
42
+ message?: string;
43
+ messageId?: string;
44
+ text?: string;
45
+ [key: string]: unknown;
46
+ }
47
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;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;AAEpD;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,iDAAiD;IACjD,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAED;;;;GAIG;AACH,MAAM,MAAM,YAAY,GAAG,CACzB,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,cAAc,KACpB,UAAU,EAAE,CAAC;AAElB;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,kBAAkB;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ /**
3
+ * Handler types for the engine prose pipeline.
4
+ *
5
+ * Public interface: `HandlerContext`, `EventHandler`,
6
+ * `ChainableEventData`, `GenericEventData`. Used by handler families
7
+ * and the pipeline class.
8
+ *
9
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
10
+ *
11
+ * @see ADR-174 §Engine-internal prose pipeline
12
+ * @see ADR-094 (chain metadata semantics, preserved)
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Prose pipeline — internal barrel for the engine package.
3
+ *
4
+ * Public interface: `ProsePipeline`, `createProsePipeline`,
5
+ * `ITextService`. Plus the decoration primitives and stage utilities
6
+ * the pipeline class composes.
7
+ *
8
+ * Owner context: `@sharpee/engine` — internal prose pipeline.
9
+ *
10
+ * @see ADR-174 §Engine-internal prose pipeline
11
+ */
12
+ export { ProsePipeline, createProsePipeline } from './pipeline';
13
+ export type { ITextService } from './types';
14
+ export { parseDecorations, resolveClassName, PLATFORM_VOCABULARY, PLATFORM_VOCABULARY_NAMES, type PlatformVocabularyName, type IDecoration, type TextContent, } from './decorations';
15
+ export { filterEvents } from './stages/filter';
16
+ export { sortEventsForProse, getChainMetadata, } from './stages/sort';
17
+ export { createBlock, createBlocks, extractValue } from './assemble';
18
+ export type { EventHandler, HandlerContext, ChainableEventData, GenericEventData, } from './handlers/types';
19
+ export { handleRoomDescription, handleRevealed, handleGameMessage, handleGenericEvent, handleGameStarted, handleHelpDisplayed, handleAboutDisplayed, handleAudibilityHeard, tryProcessDomainEventMessage, handleImplicitTake, handleCommandFailed, handleClientQuery, } from './handlers';
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAGhE,YAAY,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAK5C,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,WAAW,EAChB,KAAK,WAAW,GACjB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACL,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGrE,YAAY,EACV,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,4BAA4B,EAC5B,kBAAkB,EAClB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,YAAY,CAAC"}
@@ -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 "../../text-blocks/index";
25
+ import type { LanguageProvider } from "../../if-domain/index";
26
+ import type { ISemanticEvent } from "../../core/index";
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,gEAAgE,CACjE,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC3C,CAAC;IAED,WAAW,CAAC,MAAwB;QAClC,MAAM,QAAQ,GAAG,IAAA,qBAAY,EAAC,MAAM,CAAC,CAAC;QACtC,MAAM,MAAM,GAAG,IAAA,yBAAkB,EAAC,QAAQ,CAAC,CAAC;QAE5C,MAAM,OAAO,GAAmB;YAC9B,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;SACxC,CAAC;QAEF,MAAM,MAAM,GAAiB,EAAE,CAAC;QAChC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;QACtD,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;;;OAMG;IACK,cAAc,CACpB,KAAqB,EACrB,OAAuB;QAEvB,MAAM,eAAe,GAAG,IAAA,6CAA4B,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;QACrE,IAAI,eAAe,EAAE,CAAC;YACpB,OAAO,eAAe,CAAC;QACzB,CAAC;QAED,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;YACnB,KAAK,cAAc;gBACjB,OAAO,IAAA,wBAAiB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAE3C,KAAK,2BAA2B,CAAC;YACjC,KAAK,2BAA2B;gBAC9B,OAAO,IAAA,4BAAqB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAE/C,KAAK,cAAc;gBACjB,OAAO,IAAA,2BAAiB,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAE3C,KAAK,mBAAmB;gBACtB,OAAO,IAAA,yBAAc,EAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAExC,KAAK,yBAAyB;gBAC5B,OAAO,IAAA,0BAAmB,EAAC,KAAK,EAAE,OAAO,CAAC,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 "../../../core/index";
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 "../../../core/index";
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"}