@sharpee/engine 0.9.111 → 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.
- package/action-context-factory.d.ts +10 -2
- package/action-context-factory.d.ts.map +1 -1
- package/action-context-factory.js +29 -5
- package/action-context-factory.js.map +1 -1
- package/command-executor.d.ts +2 -1
- package/command-executor.d.ts.map +1 -1
- package/command-executor.js +3 -3
- package/command-executor.js.map +1 -1
- package/game-engine.d.ts +87 -4
- package/game-engine.d.ts.map +1 -1
- package/game-engine.js +250 -9
- package/game-engine.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +2 -0
- package/index.js.map +1 -1
- package/package.json +13 -12
- package/prose-pipeline/assemble.d.ts +77 -0
- package/prose-pipeline/assemble.d.ts.map +1 -0
- package/prose-pipeline/assemble.js +96 -0
- package/prose-pipeline/assemble.js.map +1 -0
- package/prose-pipeline/decorations/index.d.ts +18 -0
- package/prose-pipeline/decorations/index.d.ts.map +1 -0
- package/prose-pipeline/decorations/index.js +24 -0
- package/prose-pipeline/decorations/index.js.map +1 -0
- package/prose-pipeline/decorations/parser.d.ts +34 -0
- package/prose-pipeline/decorations/parser.d.ts.map +1 -0
- package/prose-pipeline/decorations/parser.js +177 -0
- package/prose-pipeline/decorations/parser.js.map +1 -0
- package/prose-pipeline/decorations/platform-vocabulary.d.ts +27 -0
- package/prose-pipeline/decorations/platform-vocabulary.d.ts.map +1 -0
- package/prose-pipeline/decorations/platform-vocabulary.js +65 -0
- package/prose-pipeline/decorations/platform-vocabulary.js.map +1 -0
- package/prose-pipeline/decorations/resolver.d.ts +28 -0
- package/prose-pipeline/decorations/resolver.d.ts.map +1 -0
- package/prose-pipeline/decorations/resolver.js +39 -0
- package/prose-pipeline/decorations/resolver.js.map +1 -0
- package/prose-pipeline/decorations/types.d.ts +16 -0
- package/prose-pipeline/decorations/types.d.ts.map +1 -0
- package/prose-pipeline/decorations/types.js +17 -0
- package/prose-pipeline/decorations/types.js.map +1 -0
- package/prose-pipeline/handlers/about.d.ts +31 -0
- package/prose-pipeline/handlers/about.d.ts.map +1 -0
- package/prose-pipeline/handlers/about.js +50 -0
- package/prose-pipeline/handlers/about.js.map +1 -0
- package/prose-pipeline/handlers/audibility.d.ts +46 -0
- package/prose-pipeline/handlers/audibility.d.ts.map +1 -0
- package/prose-pipeline/handlers/audibility.js +79 -0
- package/prose-pipeline/handlers/audibility.js.map +1 -0
- package/prose-pipeline/handlers/banner.d.ts +44 -0
- package/prose-pipeline/handlers/banner.d.ts.map +1 -0
- package/prose-pipeline/handlers/banner.js +88 -0
- package/prose-pipeline/handlers/banner.js.map +1 -0
- package/prose-pipeline/handlers/client-query.d.ts +22 -0
- package/prose-pipeline/handlers/client-query.d.ts.map +1 -0
- package/prose-pipeline/handlers/client-query.js +55 -0
- package/prose-pipeline/handlers/client-query.js.map +1 -0
- package/prose-pipeline/handlers/command-failed.d.ts +24 -0
- package/prose-pipeline/handlers/command-failed.d.ts.map +1 -0
- package/prose-pipeline/handlers/command-failed.js +46 -0
- package/prose-pipeline/handlers/command-failed.js.map +1 -0
- package/prose-pipeline/handlers/domain-message.d.ts +31 -0
- package/prose-pipeline/handlers/domain-message.d.ts.map +1 -0
- package/prose-pipeline/handlers/domain-message.js +66 -0
- package/prose-pipeline/handlers/domain-message.js.map +1 -0
- package/prose-pipeline/handlers/game.d.ts +31 -0
- package/prose-pipeline/handlers/game.d.ts.map +1 -0
- package/prose-pipeline/handlers/game.js +35 -0
- package/prose-pipeline/handlers/game.js.map +1 -0
- package/prose-pipeline/handlers/generic.d.ts +27 -0
- package/prose-pipeline/handlers/generic.d.ts.map +1 -0
- package/prose-pipeline/handlers/generic.js +67 -0
- package/prose-pipeline/handlers/generic.js.map +1 -0
- package/prose-pipeline/handlers/help.d.ts +21 -0
- package/prose-pipeline/handlers/help.d.ts.map +1 -0
- package/prose-pipeline/handlers/help.js +68 -0
- package/prose-pipeline/handlers/help.js.map +1 -0
- package/prose-pipeline/handlers/implicit-take.d.ts +20 -0
- package/prose-pipeline/handlers/implicit-take.d.ts.map +1 -0
- package/prose-pipeline/handlers/implicit-take.js +26 -0
- package/prose-pipeline/handlers/implicit-take.js.map +1 -0
- package/prose-pipeline/handlers/index.d.ts +24 -0
- package/prose-pipeline/handlers/index.d.ts.map +1 -0
- package/prose-pipeline/handlers/index.js +40 -0
- package/prose-pipeline/handlers/index.js.map +1 -0
- package/prose-pipeline/handlers/revealed.d.ts +24 -0
- package/prose-pipeline/handlers/revealed.d.ts.map +1 -0
- package/prose-pipeline/handlers/revealed.js +54 -0
- package/prose-pipeline/handlers/revealed.js.map +1 -0
- package/prose-pipeline/handlers/room.d.ts +25 -0
- package/prose-pipeline/handlers/room.d.ts.map +1 -0
- package/prose-pipeline/handlers/room.js +78 -0
- package/prose-pipeline/handlers/room.js.map +1 -0
- package/prose-pipeline/handlers/types.d.ts +47 -0
- package/prose-pipeline/handlers/types.d.ts.map +1 -0
- package/prose-pipeline/handlers/types.js +15 -0
- package/prose-pipeline/handlers/types.js.map +1 -0
- package/prose-pipeline/index.d.ts +20 -0
- package/prose-pipeline/index.d.ts.map +1 -0
- package/prose-pipeline/index.js +50 -0
- package/prose-pipeline/index.js.map +1 -0
- package/prose-pipeline/pipeline.d.ts +58 -0
- package/prose-pipeline/pipeline.d.ts.map +1 -0
- package/prose-pipeline/pipeline.js +120 -0
- package/prose-pipeline/pipeline.js.map +1 -0
- package/prose-pipeline/stages/filter.d.ts +26 -0
- package/prose-pipeline/stages/filter.d.ts.map +1 -0
- package/prose-pipeline/stages/filter.js +38 -0
- package/prose-pipeline/stages/filter.js.map +1 -0
- package/prose-pipeline/stages/index.d.ts +13 -0
- package/prose-pipeline/stages/index.d.ts.map +1 -0
- package/prose-pipeline/stages/index.js +19 -0
- package/prose-pipeline/stages/index.js.map +1 -0
- package/prose-pipeline/stages/sort.d.ts +38 -0
- package/prose-pipeline/stages/sort.d.ts.map +1 -0
- package/prose-pipeline/stages/sort.js +94 -0
- package/prose-pipeline/stages/sort.js.map +1 -0
- package/prose-pipeline/types.d.ts +45 -0
- package/prose-pipeline/types.d.ts.map +1 -0
- package/prose-pipeline/types.js +23 -0
- package/prose-pipeline/types.js.map +1 -0
- package/save-restore-service.d.ts +17 -23
- package/save-restore-service.d.ts.map +1 -1
- package/save-restore-service.js +79 -138
- package/save-restore-service.js.map +1 -1
- package/sound/dispatcher.d.ts +75 -0
- package/sound/dispatcher.d.ts.map +1 -0
- package/sound/dispatcher.js +122 -0
- package/sound/dispatcher.js.map +1 -0
- package/sound/index.d.ts +26 -0
- package/sound/index.d.ts.map +1 -0
- package/sound/index.js +34 -0
- package/sound/index.js.map +1 -0
- package/sound/propagation.d.ts +69 -0
- package/sound/propagation.d.ts.map +1 -0
- package/sound/propagation.js +219 -0
- package/sound/propagation.js.map +1 -0
- package/story.d.ts +28 -1
- package/story.d.ts.map +1 -1
- package/story.js.map +1 -1
- package/test-helpers/mock-prose-pipeline.d.ts +22 -0
- package/test-helpers/mock-prose-pipeline.d.ts.map +1 -0
- package/test-helpers/mock-prose-pipeline.js +56 -0
- package/test-helpers/mock-prose-pipeline.js.map +1 -0
- package/types.d.ts +14 -0
- package/types.d.ts.map +1 -1
|
@@ -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("../../../text-blocks/index.js");
|
|
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 "../../../text-blocks/index";
|
|
20
|
+
import type { ISemanticEvent } from "../../../core/index";
|
|
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("../../../text-blocks/index.js");
|
|
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 "../../../text-blocks/index";
|
|
19
|
+
import type { ISemanticEvent } from "../../../core/index";
|
|
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 "../../../text-blocks/index";
|
|
13
|
+
import type { ISemanticEvent } from "../../../core/index";
|
|
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"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Generic event handlers — game.message and the catch-all generic
|
|
4
|
+
* fallback for unknown event types.
|
|
5
|
+
*
|
|
6
|
+
* Public interface: `handleGameMessage`, `handleGenericEvent`. Used
|
|
7
|
+
* by the pipeline's event-type dispatch.
|
|
8
|
+
*
|
|
9
|
+
* Owner context: `@sharpee/engine` — internal prose pipeline.
|
|
10
|
+
*
|
|
11
|
+
* @see ADR-174 §Engine-internal prose pipeline (port from text-service)
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.handleGameMessage = handleGameMessage;
|
|
15
|
+
exports.handleGenericEvent = handleGenericEvent;
|
|
16
|
+
const text_blocks_1 = require("../../../text-blocks/index.js");
|
|
17
|
+
const assemble_1 = require("../assemble");
|
|
18
|
+
/**
|
|
19
|
+
* Handle `game.message` events.
|
|
20
|
+
*/
|
|
21
|
+
function handleGameMessage(event, context) {
|
|
22
|
+
const data = event.data;
|
|
23
|
+
if (data.messageId && context.languageProvider) {
|
|
24
|
+
const message = context.languageProvider.getMessage(data.messageId, data.params);
|
|
25
|
+
if (message && message !== data.messageId) {
|
|
26
|
+
return (0, assemble_1.createBlocks)(text_blocks_1.BLOCK_KEYS.GAME_MESSAGE, message);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const text = data.text ?? data.message;
|
|
30
|
+
if (text) {
|
|
31
|
+
return (0, assemble_1.createBlocks)(text_blocks_1.BLOCK_KEYS.GAME_MESSAGE, text);
|
|
32
|
+
}
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Handle generic / unknown events using `event.type` as the template key.
|
|
37
|
+
*
|
|
38
|
+
* Story-defined events follow the simple pattern:
|
|
39
|
+
* - event.type is the template key
|
|
40
|
+
* - event.data is the template params
|
|
41
|
+
*/
|
|
42
|
+
function handleGenericEvent(event, context) {
|
|
43
|
+
const data = event.data;
|
|
44
|
+
if (!data) {
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
if (data.message || data.text) {
|
|
48
|
+
const text = data.message ?? data.text ?? '';
|
|
49
|
+
if (text) {
|
|
50
|
+
return (0, assemble_1.createBlocks)(text_blocks_1.BLOCK_KEYS.ACTION_RESULT, text);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (context.languageProvider) {
|
|
54
|
+
const message = context.languageProvider.getMessage(event.type, data);
|
|
55
|
+
if (message && message !== event.type) {
|
|
56
|
+
return (0, assemble_1.createBlocks)(text_blocks_1.BLOCK_KEYS.ACTION_RESULT, message);
|
|
57
|
+
}
|
|
58
|
+
if (data.messageId) {
|
|
59
|
+
const msgFromId = context.languageProvider.getMessage(data.messageId, data);
|
|
60
|
+
if (msgFromId && msgFromId !== data.messageId) {
|
|
61
|
+
return (0, assemble_1.createBlocks)(text_blocks_1.BLOCK_KEYS.ACTION_RESULT, msgFromId);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=generic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generic.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/generic.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;AAkBH,8CAsBC;AASD,gDAoCC;AAlFD,sDAAkD;AAGlD,0CAA2C;AAS3C;;GAEG;AACH,SAAgB,iBAAiB,CAC/B,KAAqB,EACrB,OAAuB;IAEvB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAuB,CAAC;IAE3C,IAAI,IAAI,CAAC,SAAS,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAC/C,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,UAAU,CACjD,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,MAAM,CACZ,CAAC;QACF,IAAI,OAAO,IAAI,OAAO,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC;YAC1C,OAAO,IAAA,uBAAY,EAAC,wBAAU,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC;IACH,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC;IACvC,IAAI,IAAI,EAAE,CAAC;QACT,OAAO,IAAA,uBAAY,EAAC,wBAAU,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,kBAAkB,CAChC,KAAqB,EACrB,OAAuB;IAEvB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAwB,CAAC;IAE5C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QAC9B,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;QAC7C,IAAI,IAAI,EAAE,CAAC;YACT,OAAO,IAAA,uBAAY,EAAC,wBAAU,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;IAED,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;QAC7B,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAEtE,IAAI,OAAO,IAAI,OAAO,KAAK,KAAK,CAAC,IAAI,EAAE,CAAC;YACtC,OAAO,IAAA,uBAAY,EAAC,wBAAU,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QACzD,CAAC;QAED,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACnB,MAAM,SAAS,GAAG,OAAO,CAAC,gBAAgB,CAAC,UAAU,CACnD,IAAI,CAAC,SAAS,EACd,IAAI,CACL,CAAC;YACF,IAAI,SAAS,IAAI,SAAS,KAAK,IAAI,CAAC,SAAS,EAAE,CAAC;gBAC9C,OAAO,IAAA,uBAAY,EAAC,wBAAU,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Help event handler — `if.event.help_displayed`.
|
|
3
|
+
*
|
|
4
|
+
* Produces the canonical "HOW TO PLAY INTERACTIVE FICTION" block.
|
|
5
|
+
* Content based on the PR-IF "How to Play" reference card.
|
|
6
|
+
*
|
|
7
|
+
* Public interface: `handleHelpDisplayed`. Used by the pipeline's
|
|
8
|
+
* event-type dispatch.
|
|
9
|
+
*
|
|
10
|
+
* Owner context: `@sharpee/engine` — internal prose pipeline.
|
|
11
|
+
*
|
|
12
|
+
* @see ADR-174 §Engine-internal prose pipeline (port from text-service)
|
|
13
|
+
*/
|
|
14
|
+
import type { ITextBlock } from "../../../text-blocks/index";
|
|
15
|
+
import type { ISemanticEvent } from "../../../core/index";
|
|
16
|
+
import type { HandlerContext } from './types';
|
|
17
|
+
/**
|
|
18
|
+
* Handle `if.event.help_displayed` to produce the help text block.
|
|
19
|
+
*/
|
|
20
|
+
export declare function handleHelpDisplayed(_event: ISemanticEvent, _context: HandlerContext): ITextBlock[];
|
|
21
|
+
//# sourceMappingURL=help.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/help.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAgD9C;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,cAAc,GACvB,UAAU,EAAE,CAEd"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Help event handler — `if.event.help_displayed`.
|
|
4
|
+
*
|
|
5
|
+
* Produces the canonical "HOW TO PLAY INTERACTIVE FICTION" block.
|
|
6
|
+
* Content based on the PR-IF "How to Play" reference card.
|
|
7
|
+
*
|
|
8
|
+
* Public interface: `handleHelpDisplayed`. Used by the pipeline's
|
|
9
|
+
* event-type dispatch.
|
|
10
|
+
*
|
|
11
|
+
* Owner context: `@sharpee/engine` — internal prose pipeline.
|
|
12
|
+
*
|
|
13
|
+
* @see ADR-174 §Engine-internal prose pipeline (port from text-service)
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.handleHelpDisplayed = handleHelpDisplayed;
|
|
17
|
+
const assemble_1 = require("../assemble");
|
|
18
|
+
const HELP_TEXT = `HOW TO PLAY INTERACTIVE FICTION
|
|
19
|
+
|
|
20
|
+
Interactive fiction is a conversation between you and the game. You type commands; the game describes what happens.
|
|
21
|
+
|
|
22
|
+
MOVING AROUND
|
|
23
|
+
Type a direction to move: NORTH (N), SOUTH (S), EAST (E), WEST (W),
|
|
24
|
+
NORTHEAST (NE), NORTHWEST (NW), SOUTHEAST (SE), SOUTHWEST (SW),
|
|
25
|
+
UP (U), DOWN (D), IN, OUT, ENTER, EXIT.
|
|
26
|
+
|
|
27
|
+
LOOKING AND EXAMINING
|
|
28
|
+
LOOK (L) - Describe your surroundings.
|
|
29
|
+
EXAMINE (X) something - Look closely at an object.
|
|
30
|
+
|
|
31
|
+
INTERACTING WITH OBJECTS
|
|
32
|
+
TAKE (GET) something - Pick it up.
|
|
33
|
+
DROP something - Put it down.
|
|
34
|
+
OPEN / CLOSE something - Open or close a door, container, etc.
|
|
35
|
+
PUT something IN / ON something - Place an object in a container or on a surface.
|
|
36
|
+
LOCK / UNLOCK something WITH something - Lock or unlock with a key.
|
|
37
|
+
TURN ON / TURN OFF something - Operate a switch or device.
|
|
38
|
+
WEAR / TAKE OFF something - Put on or remove clothing.
|
|
39
|
+
EAT / DRINK something - Consume food or drink.
|
|
40
|
+
READ something - Read text on an object.
|
|
41
|
+
SEARCH something - Search a container or area.
|
|
42
|
+
LOOK UNDER / LOOK BEHIND something - Check hidden spots.
|
|
43
|
+
|
|
44
|
+
TALKING TO CHARACTERS
|
|
45
|
+
TALK TO someone - Start a conversation.
|
|
46
|
+
ASK someone ABOUT something - Ask about a topic.
|
|
47
|
+
TELL someone ABOUT something - Tell them something.
|
|
48
|
+
GIVE something TO someone - Hand over an item.
|
|
49
|
+
SHOW something TO someone - Display an item.
|
|
50
|
+
|
|
51
|
+
OTHER COMMANDS
|
|
52
|
+
INVENTORY (I) - List what you're carrying.
|
|
53
|
+
WAIT (Z) - Let time pass.
|
|
54
|
+
AGAIN (G) - Repeat your last command.
|
|
55
|
+
SCORE - Check your progress.
|
|
56
|
+
SAVE / RESTORE - Save or load your game.
|
|
57
|
+
UNDO - Take back your last move.
|
|
58
|
+
QUIT - End the game.
|
|
59
|
+
ABOUT - Information about this game.
|
|
60
|
+
|
|
61
|
+
When in doubt, EXAMINE everything.`;
|
|
62
|
+
/**
|
|
63
|
+
* Handle `if.event.help_displayed` to produce the help text block.
|
|
64
|
+
*/
|
|
65
|
+
function handleHelpDisplayed(_event, _context) {
|
|
66
|
+
return (0, assemble_1.createBlocks)('help.text', HELP_TEXT);
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=help.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/help.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;AAuDH,kDAKC;AAvDD,0CAA2C;AAE3C,MAAM,SAAS,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mCA2CiB,CAAC;AAEpC;;GAEG;AACH,SAAgB,mBAAmB,CACjC,MAAsB,EACtB,QAAwB;IAExB,OAAO,IAAA,uBAAY,EAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implicit-take handler — `if.event.implicit_take`.
|
|
3
|
+
*
|
|
4
|
+
* Produces the "(first taking the X)" line that prefaces an action
|
|
5
|
+
* the parser auto-promoted (e.g. "READ BOOK" when the player isn't
|
|
6
|
+
* holding the book yet).
|
|
7
|
+
*
|
|
8
|
+
* Public interface: `handleImplicitTake`. Used by the pipeline's
|
|
9
|
+
* event-type dispatch.
|
|
10
|
+
*
|
|
11
|
+
* Owner context: `@sharpee/engine` — internal prose pipeline.
|
|
12
|
+
*
|
|
13
|
+
* @see ADR-174 §Engine-internal prose pipeline (extracted from
|
|
14
|
+
* text-service.ts inline)
|
|
15
|
+
*/
|
|
16
|
+
import type { ITextBlock } from "../../../text-blocks/index";
|
|
17
|
+
import type { ISemanticEvent } from "../../../core/index";
|
|
18
|
+
import type { HandlerContext } from './types';
|
|
19
|
+
export declare function handleImplicitTake(event: ISemanticEvent, _context: HandlerContext): ITextBlock[];
|
|
20
|
+
//# sourceMappingURL=implicit-take.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"implicit-take.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/implicit-take.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;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;AAO9C,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,cAAc,EACrB,QAAQ,EAAE,cAAc,GACvB,UAAU,EAAE,CAId"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Implicit-take handler — `if.event.implicit_take`.
|
|
4
|
+
*
|
|
5
|
+
* Produces the "(first taking the X)" line that prefaces an action
|
|
6
|
+
* the parser auto-promoted (e.g. "READ BOOK" when the player isn't
|
|
7
|
+
* holding the book yet).
|
|
8
|
+
*
|
|
9
|
+
* Public interface: `handleImplicitTake`. Used by the pipeline's
|
|
10
|
+
* event-type dispatch.
|
|
11
|
+
*
|
|
12
|
+
* Owner context: `@sharpee/engine` — internal prose pipeline.
|
|
13
|
+
*
|
|
14
|
+
* @see ADR-174 §Engine-internal prose pipeline (extracted from
|
|
15
|
+
* text-service.ts inline)
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.handleImplicitTake = handleImplicitTake;
|
|
19
|
+
const text_blocks_1 = require("../../../text-blocks/index.js");
|
|
20
|
+
const assemble_1 = require("../assemble");
|
|
21
|
+
function handleImplicitTake(event, _context) {
|
|
22
|
+
const data = event.data;
|
|
23
|
+
const itemName = data?.itemName || 'something';
|
|
24
|
+
return [(0, assemble_1.createBlock)(text_blocks_1.BLOCK_KEYS.ACTION_RESULT, `(first taking the ${itemName})`)];
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=implicit-take.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"implicit-take.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/implicit-take.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;AAYH,gDAOC;AAhBD,sDAAkD;AAGlD,0CAA0C;AAM1C,SAAgB,kBAAkB,CAChC,KAAqB,EACrB,QAAwB;IAExB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAwB,CAAC;IAC5C,MAAM,QAAQ,GAAG,IAAI,EAAE,QAAQ,IAAI,WAAW,CAAC;IAC/C,OAAO,CAAC,IAAA,sBAAW,EAAC,wBAAU,CAAC,aAAa,EAAE,qBAAqB,QAAQ,GAAG,CAAC,CAAC,CAAC;AACnF,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prose pipeline handlers — internal barrel.
|
|
3
|
+
*
|
|
4
|
+
* Public interface: re-exports every handler family the pipeline
|
|
5
|
+
* dispatches to, plus the shared `HandlerContext` / `EventHandler`
|
|
6
|
+
* types. 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
|
+
export type { EventHandler, HandlerContext, ChainableEventData, GenericEventData, } from './types';
|
|
13
|
+
export { handleRoomDescription } from './room';
|
|
14
|
+
export { handleRevealed } from './revealed';
|
|
15
|
+
export { handleGameMessage, handleGenericEvent } from './generic';
|
|
16
|
+
export { handleGameStarted } from './game';
|
|
17
|
+
export { handleHelpDisplayed } from './help';
|
|
18
|
+
export { handleAboutDisplayed } from './about';
|
|
19
|
+
export { handleAudibilityHeard } from './audibility';
|
|
20
|
+
export { tryProcessDomainEventMessage } from './domain-message';
|
|
21
|
+
export { handleImplicitTake } from './implicit-take';
|
|
22
|
+
export { handleCommandFailed } from './command-failed';
|
|
23
|
+
export { handleClientQuery } from './client-query';
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,YAAY,EACV,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,qBAAqB,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAGrD,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Prose pipeline handlers — internal barrel.
|
|
4
|
+
*
|
|
5
|
+
* Public interface: re-exports every handler family the pipeline
|
|
6
|
+
* dispatches to, plus the shared `HandlerContext` / `EventHandler`
|
|
7
|
+
* types. Used by the pipeline class (sub-phase 1.5).
|
|
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 = void 0;
|
|
15
|
+
// Type-keyed handlers (former text-service handlers/*.ts).
|
|
16
|
+
var room_1 = require("./room");
|
|
17
|
+
Object.defineProperty(exports, "handleRoomDescription", { enumerable: true, get: function () { return room_1.handleRoomDescription; } });
|
|
18
|
+
var revealed_1 = require("./revealed");
|
|
19
|
+
Object.defineProperty(exports, "handleRevealed", { enumerable: true, get: function () { return revealed_1.handleRevealed; } });
|
|
20
|
+
var generic_1 = require("./generic");
|
|
21
|
+
Object.defineProperty(exports, "handleGameMessage", { enumerable: true, get: function () { return generic_1.handleGameMessage; } });
|
|
22
|
+
Object.defineProperty(exports, "handleGenericEvent", { enumerable: true, get: function () { return generic_1.handleGenericEvent; } });
|
|
23
|
+
var game_1 = require("./game");
|
|
24
|
+
Object.defineProperty(exports, "handleGameStarted", { enumerable: true, get: function () { return game_1.handleGameStarted; } });
|
|
25
|
+
var help_1 = require("./help");
|
|
26
|
+
Object.defineProperty(exports, "handleHelpDisplayed", { enumerable: true, get: function () { return help_1.handleHelpDisplayed; } });
|
|
27
|
+
var about_1 = require("./about");
|
|
28
|
+
Object.defineProperty(exports, "handleAboutDisplayed", { enumerable: true, get: function () { return about_1.handleAboutDisplayed; } });
|
|
29
|
+
var audibility_1 = require("./audibility");
|
|
30
|
+
Object.defineProperty(exports, "handleAudibilityHeard", { enumerable: true, get: function () { return audibility_1.handleAudibilityHeard; } });
|
|
31
|
+
// Inline handlers extracted from text-service.ts in this sub-phase.
|
|
32
|
+
var domain_message_1 = require("./domain-message");
|
|
33
|
+
Object.defineProperty(exports, "tryProcessDomainEventMessage", { enumerable: true, get: function () { return domain_message_1.tryProcessDomainEventMessage; } });
|
|
34
|
+
var implicit_take_1 = require("./implicit-take");
|
|
35
|
+
Object.defineProperty(exports, "handleImplicitTake", { enumerable: true, get: function () { return implicit_take_1.handleImplicitTake; } });
|
|
36
|
+
var command_failed_1 = require("./command-failed");
|
|
37
|
+
Object.defineProperty(exports, "handleCommandFailed", { enumerable: true, get: function () { return command_failed_1.handleCommandFailed; } });
|
|
38
|
+
var client_query_1 = require("./client-query");
|
|
39
|
+
Object.defineProperty(exports, "handleClientQuery", { enumerable: true, get: function () { return client_query_1.handleClientQuery; } });
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AASH,2DAA2D;AAC3D,+BAA+C;AAAtC,6GAAA,qBAAqB,OAAA;AAC9B,uCAA4C;AAAnC,0GAAA,cAAc,OAAA;AACvB,qCAAkE;AAAzD,4GAAA,iBAAiB,OAAA;AAAE,6GAAA,kBAAkB,OAAA;AAC9C,+BAA2C;AAAlC,yGAAA,iBAAiB,OAAA;AAC1B,+BAA6C;AAApC,2GAAA,mBAAmB,OAAA;AAC5B,iCAA+C;AAAtC,6GAAA,oBAAoB,OAAA;AAC7B,2CAAqD;AAA5C,mHAAA,qBAAqB,OAAA;AAE9B,oEAAoE;AACpE,mDAAgE;AAAvD,8HAAA,4BAA4B,OAAA;AACrC,iDAAqD;AAA5C,mHAAA,kBAAkB,OAAA;AAC3B,mDAAuD;AAA9C,qHAAA,mBAAmB,OAAA;AAC5B,+CAAmD;AAA1C,iHAAA,iBAAiB,OAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Revealed event handler.
|
|
3
|
+
*
|
|
4
|
+
* Handles `if.event.revealed` — fired when items become visible inside
|
|
5
|
+
* a container. Pulls a direct message/text payload first, then tries
|
|
6
|
+
* the language provider keyed on event type, then falls back to a
|
|
7
|
+
* built-in "Inside the {container} you see {items}." formatter.
|
|
8
|
+
*
|
|
9
|
+
* Public interface: `handleRevealed`. Used by the pipeline's
|
|
10
|
+
* event-type dispatch.
|
|
11
|
+
*
|
|
12
|
+
* Owner context: `@sharpee/engine` — internal prose pipeline.
|
|
13
|
+
*
|
|
14
|
+
* @see ADR-094 Event Chaining
|
|
15
|
+
* @see ADR-174 §Engine-internal prose pipeline (port from text-service)
|
|
16
|
+
*/
|
|
17
|
+
import type { ITextBlock } from "../../../text-blocks/index";
|
|
18
|
+
import type { ISemanticEvent } from "../../../core/index";
|
|
19
|
+
import type { HandlerContext } from './types';
|
|
20
|
+
/**
|
|
21
|
+
* Handle `if.event.revealed` events.
|
|
22
|
+
*/
|
|
23
|
+
export declare function handleRevealed(event: ISemanticEvent, context: HandlerContext): ITextBlock[];
|
|
24
|
+
//# sourceMappingURL=revealed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revealed.d.ts","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/revealed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAsB,MAAM,SAAS,CAAC;AAelE;;GAEG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,cAAc,GACtB,UAAU,EAAE,CAkCd"}
|