@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.
- package/action-context-factory.d.ts +12 -4
- package/action-context-factory.d.ts.map +1 -1
- package/action-context-factory.js +32 -8
- package/action-context-factory.js.map +1 -1
- package/capability-dispatch-helper.d.ts +3 -3
- package/capability-dispatch-helper.d.ts.map +1 -1
- package/capability-dispatch-helper.js +1 -1
- package/command-executor.d.ts +7 -6
- package/command-executor.d.ts.map +1 -1
- package/command-executor.js +5 -5
- package/command-executor.js.map +1 -1
- package/events/event-emitter.d.ts +2 -2
- package/events/event-emitter.d.ts.map +1 -1
- package/game-engine.d.ts +93 -10
- package/game-engine.d.ts.map +1 -1
- package/game-engine.js +245 -14
- package/game-engine.js.map +1 -1
- package/index.d.ts +2 -1
- package/index.d.ts.map +1 -1
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/language-provider-interface.d.ts +1 -1
- package/language-provider-interface.d.ts.map +1 -1
- package/narrative/index.d.ts.map +1 -1
- package/narrative/narrative-settings.d.ts +1 -1
- package/narrative/narrative-settings.d.ts.map +1 -1
- package/package.json +12 -12
- package/parser-interface.d.ts +2 -2
- package/parser-interface.d.ts.map +1 -1
- package/platform-operations.d.ts +2 -2
- package/platform-operations.d.ts.map +1 -1
- package/platform-operations.js +1 -1
- 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 +195 -0
- package/prose-pipeline/decorations/parser.js.map +1 -0
- package/prose-pipeline/decorations/platform-vocabulary.d.ts +35 -0
- package/prose-pipeline/decorations/platform-vocabulary.d.ts.map +1 -0
- package/prose-pipeline/decorations/platform-vocabulary.js +81 -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 +3 -3
- package/save-restore-service.d.ts.map +1 -1
- package/save-restore-service.js +1 -1
- package/scene-evaluation-plugin.d.ts +2 -2
- package/scene-evaluation-plugin.d.ts.map +1 -1
- package/scene-evaluation-plugin.js +1 -1
- package/shared-data-keys.d.ts +3 -3
- package/shared-data-keys.d.ts.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 +31 -4
- 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/turn-event-processor.d.ts +3 -3
- package/turn-event-processor.d.ts.map +1 -1
- package/turn-event-processor.js +1 -1
- package/types.d.ts +4 -4
- package/types.d.ts.map +1 -1
- package/vocabulary-manager.d.ts +1 -1
- package/vocabulary-manager.d.ts.map +1 -1
- package/vocabulary-manager.js +1 -1
- package/event-adapter.d.ts +0 -44
- package/event-adapter.d.ts.map +0 -1
- package/event-adapter.js +0 -127
- package/event-adapter.js.map +0 -1
- package/event-sequencer.d.ts +0 -73
- package/event-sequencer.d.ts.map +0 -1
- package/event-sequencer.js +0 -134
- package/event-sequencer.js.map +0 -1
- package/test-helpers/mock-text-service.d.ts +0 -11
- package/test-helpers/mock-text-service.d.ts.map +0 -1
- package/test-helpers/mock-text-service.js +0 -47
- package/test-helpers/mock-text-service.js.map +0 -1
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Bracket parser — markup string → structured `TextContent[]` tree.
|
|
4
|
+
*
|
|
5
|
+
* Public interface: `parseDecorations(template) → TextContent[]`.
|
|
6
|
+
* Pure function; same input always yields same output.
|
|
7
|
+
*
|
|
8
|
+
* Owner context: `@sharpee/engine` — internal prose pipeline.
|
|
9
|
+
*
|
|
10
|
+
* @see ADR-174 §Markup syntax
|
|
11
|
+
* @see ADR-174 §Internal interfaces
|
|
12
|
+
* @see ADR-174 acceptance criteria AC-1..AC-5, AC-10..AC-12
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.parseDecorations = parseDecorations;
|
|
16
|
+
const resolver_1 = require("./resolver");
|
|
17
|
+
const platform_vocabulary_1 = require("./platform-vocabulary");
|
|
18
|
+
/**
|
|
19
|
+
* Parse a template string into a `TextContent[]` tree.
|
|
20
|
+
*
|
|
21
|
+
* Bracket markup `[name:content]` becomes an `IDecoration` whose
|
|
22
|
+
* `className` is the result of `resolveClassName(name)`. Plain runs
|
|
23
|
+
* stay as strings. Nesting recurses. Escape sequences `\[`, `\]`,
|
|
24
|
+
* `\\` produce literal characters.
|
|
25
|
+
*
|
|
26
|
+
* Forgiving rules (ADR-174 AC-10..AC-12):
|
|
27
|
+
* - An unclosed `[` is treated as a literal character; the tail of
|
|
28
|
+
* the string remains unparsed text.
|
|
29
|
+
* - A bracket without `:` (e.g., `[em world]`) is emitted as literal
|
|
30
|
+
* `[em world]` — no decoration created.
|
|
31
|
+
* - A bracket with empty class name (e.g., `[:world]`) yields the
|
|
32
|
+
* parsed inner content directly, with no decoration wrapper.
|
|
33
|
+
*
|
|
34
|
+
* @param template Raw template string, post message-id resolution.
|
|
35
|
+
* @returns Flat array of strings and decorations.
|
|
36
|
+
*/
|
|
37
|
+
function parseDecorations(template) {
|
|
38
|
+
if (!template)
|
|
39
|
+
return [];
|
|
40
|
+
const result = [];
|
|
41
|
+
let current = '';
|
|
42
|
+
let i = 0;
|
|
43
|
+
const flush = () => {
|
|
44
|
+
if (current.length > 0) {
|
|
45
|
+
result.push(current);
|
|
46
|
+
current = '';
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
while (i < template.length) {
|
|
50
|
+
const char = template[i];
|
|
51
|
+
const escapeChar = consumeEscape(template, i);
|
|
52
|
+
if (escapeChar !== null) {
|
|
53
|
+
current += escapeChar;
|
|
54
|
+
i += 2;
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
if (char === '[') {
|
|
58
|
+
const bracket = parseBracketAt(template, i);
|
|
59
|
+
if (bracket.kind === 'literal') {
|
|
60
|
+
current += bracket.text;
|
|
61
|
+
i = bracket.nextIndex;
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
flush();
|
|
65
|
+
if (bracket.kind === 'children') {
|
|
66
|
+
result.push(...bracket.children);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
result.push(bracket.decoration);
|
|
70
|
+
}
|
|
71
|
+
i = bracket.nextIndex;
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
current += char;
|
|
75
|
+
i++;
|
|
76
|
+
}
|
|
77
|
+
flush();
|
|
78
|
+
return result;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Inspect `template[i..i+1]` for an escape sequence (`\[`, `\]`,
|
|
82
|
+
* `\\`). Returns the literal character to emit, or null if no escape
|
|
83
|
+
* applies.
|
|
84
|
+
*/
|
|
85
|
+
function consumeEscape(template, i) {
|
|
86
|
+
if (template[i] !== '\\' || i + 1 >= template.length)
|
|
87
|
+
return null;
|
|
88
|
+
const next = template[i + 1];
|
|
89
|
+
if (next !== '[' && next !== ']' && next !== '\\')
|
|
90
|
+
return null;
|
|
91
|
+
return next;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Parse the `[...]` segment starting at `openIndex`. Caller has
|
|
95
|
+
* already verified `template[openIndex] === '['`.
|
|
96
|
+
*
|
|
97
|
+
* Outcomes (per ADR-174 AC-10..AC-12):
|
|
98
|
+
* - `literal` — unclosed bracket or bracket without `:` (the whole
|
|
99
|
+
* segment is treated as plain text).
|
|
100
|
+
* - `children` — empty class name (`[:content]`); inner content is
|
|
101
|
+
* parsed and inlined without a wrapping decoration.
|
|
102
|
+
* - `decoration` — well-formed `[name:content]`; produces a
|
|
103
|
+
* structured `IDecoration`.
|
|
104
|
+
*/
|
|
105
|
+
function parseBracketAt(template, openIndex) {
|
|
106
|
+
const closeIndex = findMatchingBracket(template, openIndex);
|
|
107
|
+
if (closeIndex === -1) {
|
|
108
|
+
// AC-10: unclosed bracket → emit the `[` literal, advance one char.
|
|
109
|
+
return { kind: 'literal', text: template[openIndex], nextIndex: openIndex + 1 };
|
|
110
|
+
}
|
|
111
|
+
const inner = template.slice(openIndex + 1, closeIndex);
|
|
112
|
+
const colonIndex = indexOfUnescapedColon(inner);
|
|
113
|
+
const nextIndex = closeIndex + 1;
|
|
114
|
+
if (colonIndex === -1) {
|
|
115
|
+
// ADR-183: a colon-less `[name]` is a void macro (e.g. `[br]`, `[p]`) iff the
|
|
116
|
+
// name is registered; otherwise AC-11 applies and the whole segment is literal.
|
|
117
|
+
if (platform_vocabulary_1.VOID_MACROS.has(inner)) {
|
|
118
|
+
return {
|
|
119
|
+
kind: 'decoration',
|
|
120
|
+
decoration: { className: (0, resolver_1.resolveClassName)(inner), content: [] },
|
|
121
|
+
nextIndex,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
return { kind: 'literal', text: template.slice(openIndex, nextIndex), nextIndex };
|
|
125
|
+
}
|
|
126
|
+
const namePart = inner.slice(0, colonIndex);
|
|
127
|
+
const innerContent = inner.slice(colonIndex + 1);
|
|
128
|
+
// ADR-183: an optional `=value` in the name segment carries a parameter
|
|
129
|
+
// (e.g. `[center=50:…]`). Split on the first `=`; the value may itself contain
|
|
130
|
+
// `=`. Content (after the colon) is unaffected.
|
|
131
|
+
let rawName = namePart;
|
|
132
|
+
let value;
|
|
133
|
+
const eqIndex = namePart.indexOf('=');
|
|
134
|
+
if (eqIndex !== -1) {
|
|
135
|
+
rawName = namePart.slice(0, eqIndex);
|
|
136
|
+
value = namePart.slice(eqIndex + 1);
|
|
137
|
+
}
|
|
138
|
+
if (rawName === '') {
|
|
139
|
+
// AC-12: empty class name → emit inner content as plain entries (value ignored).
|
|
140
|
+
return { kind: 'children', children: parseDecorations(innerContent), nextIndex };
|
|
141
|
+
}
|
|
142
|
+
const decoration = value !== undefined
|
|
143
|
+
? { className: (0, resolver_1.resolveClassName)(rawName), content: parseDecorations(innerContent), value }
|
|
144
|
+
: { className: (0, resolver_1.resolveClassName)(rawName), content: parseDecorations(innerContent) };
|
|
145
|
+
return { kind: 'decoration', decoration, nextIndex };
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Find the matching `]` for the `[` at `openIndex`, respecting
|
|
149
|
+
* nested brackets and `\\[` / `\\]` escapes. Returns -1 if no match
|
|
150
|
+
* exists (string ends mid-bracket).
|
|
151
|
+
*/
|
|
152
|
+
function findMatchingBracket(text, openIndex) {
|
|
153
|
+
let depth = 1;
|
|
154
|
+
let i = openIndex + 1;
|
|
155
|
+
while (i < text.length) {
|
|
156
|
+
const char = text[i];
|
|
157
|
+
if (char === '\\' && i + 1 < text.length) {
|
|
158
|
+
i += 2;
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
if (char === '[') {
|
|
162
|
+
depth++;
|
|
163
|
+
}
|
|
164
|
+
else if (char === ']') {
|
|
165
|
+
depth--;
|
|
166
|
+
if (depth === 0)
|
|
167
|
+
return i;
|
|
168
|
+
}
|
|
169
|
+
i++;
|
|
170
|
+
}
|
|
171
|
+
return -1;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Find the first unescaped `:` in `inner`. Returns -1 if none.
|
|
175
|
+
*
|
|
176
|
+
* Inside the `name:content` payload of a bracket, `\\:` is treated as
|
|
177
|
+
* a literal colon — although there's no current need to escape colons
|
|
178
|
+
* (they're not part of the platform vocabulary), the safer parse rule
|
|
179
|
+
* is to treat backslash as a one-character escape uniformly.
|
|
180
|
+
*/
|
|
181
|
+
function indexOfUnescapedColon(inner) {
|
|
182
|
+
let i = 0;
|
|
183
|
+
while (i < inner.length) {
|
|
184
|
+
const char = inner[i];
|
|
185
|
+
if (char === '\\' && i + 1 < inner.length) {
|
|
186
|
+
i += 2;
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
if (char === ':')
|
|
190
|
+
return i;
|
|
191
|
+
i++;
|
|
192
|
+
}
|
|
193
|
+
return -1;
|
|
194
|
+
}
|
|
195
|
+
//# sourceMappingURL=parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/decorations/parser.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;AAyBH,4CAgDC;AAvED,yCAA8C;AAC9C,+DAAoD;AAGpD;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,gB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3B,CAAC,EAAE,CAAC;IACN,CAAC;IACD,OAAO,CAAC,CAAC,CAAC;AACZ,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform decoration vocabulary — closed enumeration of names the
|
|
3
|
+
* platform recognises and prefixes with `sharpee-` when emitting class
|
|
4
|
+
* names on the wire.
|
|
5
|
+
*
|
|
6
|
+
* Public interface: `PLATFORM_VOCABULARY` (frozen Set), consumed by
|
|
7
|
+
* the resolver in this directory. No external package imports this.
|
|
8
|
+
*
|
|
9
|
+
* Owner context: `@sharpee/engine` — internal prose pipeline.
|
|
10
|
+
*
|
|
11
|
+
* @see ADR-174 §Closed platform vocabulary
|
|
12
|
+
*/
|
|
13
|
+
declare const VOCABULARY_NAMES: readonly ["em", "strong", "u", "st", "code", "super", "sub", "item", "npc", "room", "direction", "command", "quote", "color-red", "color-blue", "color-green", "color-yellow", "color-magenta", "color-cyan", "color-white", "color-grey", "color-black", "bgcolor-red", "bgcolor-blue", "bgcolor-green", "bgcolor-yellow", "bgcolor-magenta", "bgcolor-cyan", "bgcolor-white", "bgcolor-grey", "bgcolor-black", "size-small", "size-large", "font-mono", "br", "p", "indent", "center", "right"];
|
|
14
|
+
/**
|
|
15
|
+
* Names that take **no content** — written `[br]` / `[p]` (no colon). The
|
|
16
|
+
* parser treats a colon-less `[name]` as a void decoration iff `name` is
|
|
17
|
+
* listed here; any other colon-less bracket stays literal (ADR-174 AC-11).
|
|
18
|
+
*
|
|
19
|
+
* @see ADR-183 §1 — Vocabulary, §2 — Syntax
|
|
20
|
+
*/
|
|
21
|
+
export declare const VOID_MACROS: ReadonlySet<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Frozen set of every name the platform reserves under the `sharpee-`
|
|
24
|
+
* namespace. Adding a new entry requires both updating this list and
|
|
25
|
+
* shipping a corresponding `.sharpee-{name}` rule in the platform CSS.
|
|
26
|
+
*/
|
|
27
|
+
export declare const PLATFORM_VOCABULARY: ReadonlySet<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Type-level export of every recognised name; useful for tests that
|
|
30
|
+
* iterate the closed enumeration.
|
|
31
|
+
*/
|
|
32
|
+
export type PlatformVocabularyName = (typeof VOCABULARY_NAMES)[number];
|
|
33
|
+
export declare const PLATFORM_VOCABULARY_NAMES: ReadonlyArray<PlatformVocabularyName>;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=platform-vocabulary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-vocabulary.d.ts","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/decorations/platform-vocabulary.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,QAAA,MAAM,gBAAgB,meAuDZ,CAAC;AAEX;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,MAAM,CAE3C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,MAAM,CAEnD,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvE,eAAO,MAAM,yBAAyB,EAAE,aAAa,CAAC,sBAAsB,CACtC,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Platform decoration vocabulary — closed enumeration of names the
|
|
4
|
+
* platform recognises and prefixes with `sharpee-` when emitting class
|
|
5
|
+
* names on the wire.
|
|
6
|
+
*
|
|
7
|
+
* Public interface: `PLATFORM_VOCABULARY` (frozen Set), consumed by
|
|
8
|
+
* the resolver in this directory. No external package imports this.
|
|
9
|
+
*
|
|
10
|
+
* Owner context: `@sharpee/engine` — internal prose pipeline.
|
|
11
|
+
*
|
|
12
|
+
* @see ADR-174 §Closed platform vocabulary
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.PLATFORM_VOCABULARY_NAMES = exports.PLATFORM_VOCABULARY = exports.VOID_MACROS = void 0;
|
|
16
|
+
const VOCABULARY_NAMES = [
|
|
17
|
+
// Switches — apply on/off, no parameter.
|
|
18
|
+
'em',
|
|
19
|
+
'strong',
|
|
20
|
+
'u',
|
|
21
|
+
'st',
|
|
22
|
+
'code',
|
|
23
|
+
'super',
|
|
24
|
+
'sub',
|
|
25
|
+
// IF-semantic — entity classifiers retained from ADR-091.
|
|
26
|
+
'item',
|
|
27
|
+
'npc',
|
|
28
|
+
'room',
|
|
29
|
+
'direction',
|
|
30
|
+
'command',
|
|
31
|
+
'quote',
|
|
32
|
+
// Class vocabulary — color-* starter palette.
|
|
33
|
+
'color-red',
|
|
34
|
+
'color-blue',
|
|
35
|
+
'color-green',
|
|
36
|
+
'color-yellow',
|
|
37
|
+
'color-magenta',
|
|
38
|
+
'color-cyan',
|
|
39
|
+
'color-white',
|
|
40
|
+
'color-grey',
|
|
41
|
+
'color-black',
|
|
42
|
+
// Class vocabulary — bgcolor-* matching set.
|
|
43
|
+
'bgcolor-red',
|
|
44
|
+
'bgcolor-blue',
|
|
45
|
+
'bgcolor-green',
|
|
46
|
+
'bgcolor-yellow',
|
|
47
|
+
'bgcolor-magenta',
|
|
48
|
+
'bgcolor-cyan',
|
|
49
|
+
'bgcolor-white',
|
|
50
|
+
'bgcolor-grey',
|
|
51
|
+
'bgcolor-black',
|
|
52
|
+
// Class vocabulary — size-*.
|
|
53
|
+
'size-small',
|
|
54
|
+
'size-large',
|
|
55
|
+
// Class vocabulary — font-*.
|
|
56
|
+
'font-mono',
|
|
57
|
+
// Layout macros (ADR-183). `br`/`p` are void (no content); `indent`/`center`
|
|
58
|
+
// accept an optional `=value` (level / width %); `right` is plain. All
|
|
59
|
+
// presentation lives in the platform stylesheet, author-overridable en masse.
|
|
60
|
+
'br',
|
|
61
|
+
'p',
|
|
62
|
+
'indent',
|
|
63
|
+
'center',
|
|
64
|
+
'right',
|
|
65
|
+
];
|
|
66
|
+
/**
|
|
67
|
+
* Names that take **no content** — written `[br]` / `[p]` (no colon). The
|
|
68
|
+
* parser treats a colon-less `[name]` as a void decoration iff `name` is
|
|
69
|
+
* listed here; any other colon-less bracket stays literal (ADR-174 AC-11).
|
|
70
|
+
*
|
|
71
|
+
* @see ADR-183 §1 — Vocabulary, §2 — Syntax
|
|
72
|
+
*/
|
|
73
|
+
exports.VOID_MACROS = Object.freeze(new Set(['br', 'p']));
|
|
74
|
+
/**
|
|
75
|
+
* Frozen set of every name the platform reserves under the `sharpee-`
|
|
76
|
+
* namespace. Adding a new entry requires both updating this list and
|
|
77
|
+
* shipping a corresponding `.sharpee-{name}` rule in the platform CSS.
|
|
78
|
+
*/
|
|
79
|
+
exports.PLATFORM_VOCABULARY = Object.freeze(new Set(VOCABULARY_NAMES));
|
|
80
|
+
exports.PLATFORM_VOCABULARY_NAMES = Object.freeze([...VOCABULARY_NAMES]);
|
|
81
|
+
//# sourceMappingURL=platform-vocabulary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-vocabulary.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/decorations/platform-vocabulary.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH,MAAM,gBAAgB,GAAG;IACvB,yCAAyC;IACzC,IAAI;IACJ,QAAQ;IACR,GAAG;IACH,IAAI;IACJ,MAAM;IACN,OAAO;IACP,KAAK;IAEL,0DAA0D;IAC1D,MAAM;IACN,KAAK;IACL,MAAM;IACN,WAAW;IACX,SAAS;IACT,OAAO;IAEP,8CAA8C;IAC9C,WAAW;IACX,YAAY;IACZ,aAAa;IACb,cAAc;IACd,eAAe;IACf,YAAY;IACZ,aAAa;IACb,YAAY;IACZ,aAAa;IAEb,6CAA6C;IAC7C,aAAa;IACb,cAAc;IACd,eAAe;IACf,gBAAgB;IAChB,iBAAiB;IACjB,cAAc;IACd,eAAe;IACf,cAAc;IACd,eAAe;IAEf,6BAA6B;IAC7B,YAAY;IACZ,YAAY;IAEZ,6BAA6B;IAC7B,WAAW;IAEX,6EAA6E;IAC7E,uEAAuE;IACvE,8EAA8E;IAC9E,IAAI;IACJ,GAAG;IACH,QAAQ;IACR,QAAQ;IACR,OAAO;CACC,CAAC;AAEX;;;;;;GAMG;AACU,QAAA,WAAW,GAAwB,MAAM,CAAC,MAAM,CAC3D,IAAI,GAAG,CAAS,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAC7B,CAAC;AAEF;;;;GAIG;AACU,QAAA,mBAAmB,GAAwB,MAAM,CAAC,MAAM,CACnE,IAAI,GAAG,CAAS,gBAAgB,CAAC,CAClC,CAAC;AAQW,QAAA,yBAAyB,GACpC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Class-name resolver — bare bracket name → final CSS class name.
|
|
3
|
+
*
|
|
4
|
+
* Public interface: `resolveClassName`. Used by the parser to settle
|
|
5
|
+
* the platform-vs-author distinction at parse time so the wire shape
|
|
6
|
+
* carries renderer-ready strings.
|
|
7
|
+
*
|
|
8
|
+
* Owner context: `@sharpee/engine` — internal prose pipeline.
|
|
9
|
+
*
|
|
10
|
+
* @see ADR-174 §Platform vs author classes
|
|
11
|
+
* @see ADR-174 §Internal interfaces
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Resolve a bracketed name to its final CSS class name.
|
|
15
|
+
*
|
|
16
|
+
* Platform names (those listed in `PLATFORM_VOCABULARY`) receive the
|
|
17
|
+
* `sharpee-` prefix. Author names — anything else — pass through
|
|
18
|
+
* verbatim. Empty input returns the empty string; the caller is
|
|
19
|
+
* responsible for the AC-12 no-op-wrapper behavior, since the
|
|
20
|
+
* resolver is a pure mapping.
|
|
21
|
+
*
|
|
22
|
+
* @param rawName Bare name as written between `[` and `:` in the
|
|
23
|
+
* template, e.g., `em`, `thief-taunt`.
|
|
24
|
+
* @returns Final class name to place on the wire as
|
|
25
|
+
* `IDecoration.className`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function resolveClassName(rawName: string): string;
|
|
28
|
+
//# sourceMappingURL=resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/decorations/resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMxD"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Class-name resolver — bare bracket name → final CSS class name.
|
|
4
|
+
*
|
|
5
|
+
* Public interface: `resolveClassName`. Used by the parser to settle
|
|
6
|
+
* the platform-vs-author distinction at parse time so the wire shape
|
|
7
|
+
* carries renderer-ready strings.
|
|
8
|
+
*
|
|
9
|
+
* Owner context: `@sharpee/engine` — internal prose pipeline.
|
|
10
|
+
*
|
|
11
|
+
* @see ADR-174 §Platform vs author classes
|
|
12
|
+
* @see ADR-174 §Internal interfaces
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.resolveClassName = resolveClassName;
|
|
16
|
+
const platform_vocabulary_1 = require("./platform-vocabulary");
|
|
17
|
+
/**
|
|
18
|
+
* Resolve a bracketed name to its final CSS class name.
|
|
19
|
+
*
|
|
20
|
+
* Platform names (those listed in `PLATFORM_VOCABULARY`) receive the
|
|
21
|
+
* `sharpee-` prefix. Author names — anything else — pass through
|
|
22
|
+
* verbatim. Empty input returns the empty string; the caller is
|
|
23
|
+
* responsible for the AC-12 no-op-wrapper behavior, since the
|
|
24
|
+
* resolver is a pure mapping.
|
|
25
|
+
*
|
|
26
|
+
* @param rawName Bare name as written between `[` and `:` in the
|
|
27
|
+
* template, e.g., `em`, `thief-taunt`.
|
|
28
|
+
* @returns Final class name to place on the wire as
|
|
29
|
+
* `IDecoration.className`.
|
|
30
|
+
*/
|
|
31
|
+
function resolveClassName(rawName) {
|
|
32
|
+
if (rawName === '')
|
|
33
|
+
return '';
|
|
34
|
+
if (platform_vocabulary_1.PLATFORM_VOCABULARY.has(rawName)) {
|
|
35
|
+
return `sharpee-${rawName}`;
|
|
36
|
+
}
|
|
37
|
+
return rawName;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/decorations/resolver.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;AAkBH,4CAMC;AAtBD,+DAA4D;AAE5D;;;;;;;;;;;;;GAaG;AACH,SAAgB,gBAAgB,CAAC,OAAe;IAC9C,IAAI,OAAO,KAAK,EAAE;QAAE,OAAO,EAAE,CAAC;IAC9B,IAAI,yCAAmB,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC;QACrC,OAAO,WAAW,OAAO,EAAE,CAAC;IAC9B,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type re-exports for the engine-internal prose pipeline's decoration
|
|
3
|
+
* primitives. Sub-phase 1.1 declared these locally; sub-phase 1.2
|
|
4
|
+
* lifted the shape change into `@sharpee/text-blocks`, so the
|
|
5
|
+
* engine-side module now re-exports the canonical types from there.
|
|
6
|
+
*
|
|
7
|
+
* Public interface: `IDecoration`, `TextContent`. Used internally by
|
|
8
|
+
* the parser, resolver, and (after sub-phase 1.5) by the pipeline
|
|
9
|
+
* class.
|
|
10
|
+
*
|
|
11
|
+
* Owner context: `@sharpee/engine` — internal prose pipeline.
|
|
12
|
+
*
|
|
13
|
+
* @see ADR-174 §Wire shape
|
|
14
|
+
*/
|
|
15
|
+
export type { IDecoration, TextContent } from '@sharpee/text-blocks';
|
|
16
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/decorations/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Type re-exports for the engine-internal prose pipeline's decoration
|
|
4
|
+
* primitives. Sub-phase 1.1 declared these locally; sub-phase 1.2
|
|
5
|
+
* lifted the shape change into `@sharpee/text-blocks`, so the
|
|
6
|
+
* engine-side module now re-exports the canonical types from there.
|
|
7
|
+
*
|
|
8
|
+
* Public interface: `IDecoration`, `TextContent`. Used internally by
|
|
9
|
+
* the parser, resolver, and (after sub-phase 1.5) by the pipeline
|
|
10
|
+
* class.
|
|
11
|
+
*
|
|
12
|
+
* Owner context: `@sharpee/engine` — internal prose pipeline.
|
|
13
|
+
*
|
|
14
|
+
* @see ADR-174 §Wire shape
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/decorations/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* About event handler — `if.event.about_displayed`.
|
|
3
|
+
*
|
|
4
|
+
* Produces the same structured banner as `handleGameStarted`, via the
|
|
5
|
+
* shared `buildBannerBlocks` helper. The ABOUT action gives us a
|
|
6
|
+
* flat `params: Record<string, string>` that mirrors `event.data.story`
|
|
7
|
+
* — we project it into the `BannerStoryInfo` shape and reuse the
|
|
8
|
+
* builder.
|
|
9
|
+
*
|
|
10
|
+
* Public interface: `handleAboutDisplayed`. Used by the pipeline's
|
|
11
|
+
* event-type dispatch.
|
|
12
|
+
*
|
|
13
|
+
* Owner context: `@sharpee/engine` — internal prose pipeline.
|
|
14
|
+
*
|
|
15
|
+
* @see ADR-174 §Engine-internal prose pipeline (port from text-service)
|
|
16
|
+
*/
|
|
17
|
+
import type { ITextBlock } from '@sharpee/text-blocks';
|
|
18
|
+
import type { ISemanticEvent } from '@sharpee/core';
|
|
19
|
+
import type { HandlerContext } from './types';
|
|
20
|
+
/**
|
|
21
|
+
* Handle `if.event.about_displayed` by showing the structured banner.
|
|
22
|
+
*
|
|
23
|
+
* Reads the about action's `params` payload (title, author, version,
|
|
24
|
+
* description, engineVersion, buildDate, portedBy). The ABOUT action
|
|
25
|
+
* does not currently pass `credits` directly; when present, the
|
|
26
|
+
* builder falls back to `By {author}` for a single author-list line.
|
|
27
|
+
* Stories that want richer ABOUT credit blocks should propagate
|
|
28
|
+
* `credits` through the about action's params.
|
|
29
|
+
*/
|
|
30
|
+
export declare function handleAboutDisplayed(event: ISemanticEvent, context: HandlerContext): ITextBlock[];
|
|
31
|
+
//# sourceMappingURL=about.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"about.d.ts","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/about.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;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;AAG9C;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,cAAc,GACtB,UAAU,EAAE,CAoBd"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* About event handler — `if.event.about_displayed`.
|
|
4
|
+
*
|
|
5
|
+
* Produces the same structured banner as `handleGameStarted`, via the
|
|
6
|
+
* shared `buildBannerBlocks` helper. The ABOUT action gives us a
|
|
7
|
+
* flat `params: Record<string, string>` that mirrors `event.data.story`
|
|
8
|
+
* — we project it into the `BannerStoryInfo` shape and reuse the
|
|
9
|
+
* builder.
|
|
10
|
+
*
|
|
11
|
+
* Public interface: `handleAboutDisplayed`. Used by the pipeline's
|
|
12
|
+
* event-type dispatch.
|
|
13
|
+
*
|
|
14
|
+
* Owner context: `@sharpee/engine` — internal prose pipeline.
|
|
15
|
+
*
|
|
16
|
+
* @see ADR-174 §Engine-internal prose pipeline (port from text-service)
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.handleAboutDisplayed = handleAboutDisplayed;
|
|
20
|
+
const banner_1 = require("./banner");
|
|
21
|
+
/**
|
|
22
|
+
* Handle `if.event.about_displayed` by showing the structured banner.
|
|
23
|
+
*
|
|
24
|
+
* Reads the about action's `params` payload (title, author, version,
|
|
25
|
+
* description, engineVersion, buildDate, portedBy). The ABOUT action
|
|
26
|
+
* does not currently pass `credits` directly; when present, the
|
|
27
|
+
* builder falls back to `By {author}` for a single author-list line.
|
|
28
|
+
* Stories that want richer ABOUT credit blocks should propagate
|
|
29
|
+
* `credits` through the about action's params.
|
|
30
|
+
*/
|
|
31
|
+
function handleAboutDisplayed(event, context) {
|
|
32
|
+
const data = event.data;
|
|
33
|
+
const params = (data?.params ?? {});
|
|
34
|
+
const story = {
|
|
35
|
+
title: stringOrUndef(params.title),
|
|
36
|
+
version: stringOrUndef(params.version),
|
|
37
|
+
buildDate: stringOrUndef(params.buildDate),
|
|
38
|
+
description: stringOrUndef(params.description),
|
|
39
|
+
author: stringOrUndef(params.author),
|
|
40
|
+
credits: Array.isArray(params.credits)
|
|
41
|
+
? params.credits.filter((s) => typeof s === 'string' && s.length > 0)
|
|
42
|
+
: undefined,
|
|
43
|
+
};
|
|
44
|
+
const engineVersion = stringOrUndef(params.engineVersion);
|
|
45
|
+
return (0, banner_1.buildBannerBlocks)('about.text', story, engineVersion, context);
|
|
46
|
+
}
|
|
47
|
+
function stringOrUndef(value) {
|
|
48
|
+
return typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=about.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"about.js","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/about.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAiBH,oDAuBC;AAnCD,qCAAmE;AAEnE;;;;;;;;;GASG;AACH,SAAgB,oBAAoB,CAClC,KAAqB,EACrB,OAAuB;IAEvB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAwD,CAAC;IAC5E,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,MAAM,IAAI,EAAE,CAA4B,CAAC;IAE/D,MAAM,KAAK,GAAoB;QAC7B,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC;QAClC,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC;QACtC,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC;QAC1C,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC;QAC9C,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC;QACpC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC;YACpC,CAAC,CAAE,MAAM,CAAC,OAAqB,CAAC,MAAM,CAClC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAC1D;YACH,CAAC,CAAC,SAAS;KACd,CAAC;IAEF,MAAM,aAAa,GAAG,aAAa,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAE1D,OAAO,IAAA,0BAAiB,EAAC,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3E,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Audibility event handler — ADR-172 Phase 7a, ported to engine prose
|
|
3
|
+
* pipeline per ADR-174.
|
|
4
|
+
*
|
|
5
|
+
* Handles `sound.audibility.heard`. Converts each `IAudibilityEvent`
|
|
6
|
+
* (per-listener perception of a propagated sound, produced by the
|
|
7
|
+
* engine's sound dispatcher in Phase 6) into a single text block via
|
|
8
|
+
* the `sound.heard.<kind>.<tier>` template family registered in the
|
|
9
|
+
* active language pack (lang-en-us ships defaults; stories override
|
|
10
|
+
* per kind).
|
|
11
|
+
*
|
|
12
|
+
* Naming discipline:
|
|
13
|
+
* - `audio` — Web Audio playback (ADR-169 `AudioManager`).
|
|
14
|
+
* - `sound` — the media-cue channel id (`media.sound.play`,
|
|
15
|
+
* ADR-163).
|
|
16
|
+
* - `audibility` — ADR-172 perception of propagated sound, this
|
|
17
|
+
* handler.
|
|
18
|
+
*
|
|
19
|
+
* Public interface: `handleAudibilityHeard`.
|
|
20
|
+
*
|
|
21
|
+
* Owner context: `@sharpee/engine` — internal prose pipeline.
|
|
22
|
+
*
|
|
23
|
+
* Listener filtering: in single-user scope today the player is the
|
|
24
|
+
* only entity carrying `ListenerTrait` automatically, so every
|
|
25
|
+
* audibility event delivered here is for the player. The dispatcher
|
|
26
|
+
* already writes the listener id into `event.entities.target`; when
|
|
27
|
+
* L2's NPC-listener work lands, this handler will need to filter
|
|
28
|
+
* `event.entities.target === playerId` before rendering.
|
|
29
|
+
*
|
|
30
|
+
* @see ADR-172 — Spatial Sound Propagation §Channel routing
|
|
31
|
+
* @see ADR-174 §Engine-internal prose pipeline (port from text-service)
|
|
32
|
+
*/
|
|
33
|
+
import type { ITextBlock } from '@sharpee/text-blocks';
|
|
34
|
+
import type { ISemanticEvent } from '@sharpee/core';
|
|
35
|
+
import type { HandlerContext } from './types';
|
|
36
|
+
/**
|
|
37
|
+
* Handle a `sound.audibility.heard` event.
|
|
38
|
+
*
|
|
39
|
+
* Resolves `sound.heard.<kind>.<tier>` from the language provider,
|
|
40
|
+
* falling back to `sound.heard.default.<tier>` when the kind-specific
|
|
41
|
+
* template is not registered. Returns one `ITextBlock` per event, or
|
|
42
|
+
* `[]` when the event is malformed, the tier is `silent`, or no
|
|
43
|
+
* template resolves.
|
|
44
|
+
*/
|
|
45
|
+
export declare function handleAudibilityHeard(event: ISemanticEvent, context: HandlerContext): ITextBlock[];
|
|
46
|
+
//# sourceMappingURL=audibility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audibility.d.ts","sourceRoot":"","sources":["../../../../../../../../repos/sharpee/packages/engine/src/prose-pipeline/handlers/audibility.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAK9C;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,cAAc,EACrB,OAAO,EAAE,cAAc,GACtB,UAAU,EAAE,CAiCd"}
|