@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.
- 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 +239 -8
- 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 +12 -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/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
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// packages/engine/src/sound/propagation.ts
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.propagate = propagate;
|
|
5
|
+
exports.clarityToTier = clarityToTier;
|
|
6
|
+
const if_domain_1 = require("../../if-domain/index.js");
|
|
7
|
+
const world_model_1 = require("../../world-model/index.js");
|
|
8
|
+
// =============================================================================
|
|
9
|
+
// Public API
|
|
10
|
+
// =============================================================================
|
|
11
|
+
/**
|
|
12
|
+
* Propagate a sound emission to a single listener.
|
|
13
|
+
*
|
|
14
|
+
* Returns an `AudibilityEvent` for the listener if the sound reaches
|
|
15
|
+
* them at any tier above `silent`; returns `null` if the sound is
|
|
16
|
+
* silent at the listener's location (no reachable path, cost too high
|
|
17
|
+
* for the volume budget, or the listener has no resolvable room).
|
|
18
|
+
*
|
|
19
|
+
* Same-room emissions short-circuit to `full` audibility regardless of
|
|
20
|
+
* intervening boundaries (degenerate case from ADR-172 §Propagation
|
|
21
|
+
* function step 5).
|
|
22
|
+
*
|
|
23
|
+
* @param sound The emission shape.
|
|
24
|
+
* @param listenerId The entity id of the listener.
|
|
25
|
+
* @param world The world-model carrying rooms, walls, doors,
|
|
26
|
+
* and obstructors.
|
|
27
|
+
* @param timestamp Engine-provided turn-sequence integer for event
|
|
28
|
+
* ordering. Phase 6's dispatcher threads this from
|
|
29
|
+
* the turn manager.
|
|
30
|
+
*/
|
|
31
|
+
function propagate(sound, listenerId, world, timestamp) {
|
|
32
|
+
const listenerRoom = locateRoom(world, listenerId);
|
|
33
|
+
if (!listenerRoom)
|
|
34
|
+
return null;
|
|
35
|
+
// Same-room: full audibility, no wall, no path search.
|
|
36
|
+
if (sound.sourceLocation === listenerRoom) {
|
|
37
|
+
return buildAudibilityEvent(sound, listenerRoom, undefined, 'full', timestamp);
|
|
38
|
+
}
|
|
39
|
+
const path = findShortestAcousticPath(sound.sourceLocation, listenerRoom, world);
|
|
40
|
+
if (!path)
|
|
41
|
+
return null;
|
|
42
|
+
const budget = if_domain_1.VOLUME_TIER_BUDGETS[sound.volumeTier];
|
|
43
|
+
const clarity = budget - path.cost;
|
|
44
|
+
const tier = clarityToTier(clarity);
|
|
45
|
+
if (tier === 'silent')
|
|
46
|
+
return null;
|
|
47
|
+
// Per ADR-172 AudibilityEvent shape: `wallId` is set when the path
|
|
48
|
+
// crosses exactly one wall. Multi-wall and zero-wall (door-only)
|
|
49
|
+
// paths leave it undefined.
|
|
50
|
+
const wallId = path.wallEdges.length === 1 ? path.wallEdges[0] : undefined;
|
|
51
|
+
return buildAudibilityEvent(sound, listenerRoom, wallId, tier, timestamp);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Map a clarity value (volume budget − accumulated path cost) to the
|
|
55
|
+
* ADR-172 audibility tier table.
|
|
56
|
+
*
|
|
57
|
+
* Exposed for testability and so that future composition layers can
|
|
58
|
+
* reuse the mapping (e.g., a conversation-choreography layer that
|
|
59
|
+
* wants to show a "what would the audibility be at this volume from
|
|
60
|
+
* here?" debug overlay).
|
|
61
|
+
*/
|
|
62
|
+
function clarityToTier(clarity) {
|
|
63
|
+
if (clarity >= 4)
|
|
64
|
+
return 'full';
|
|
65
|
+
if (clarity === 3)
|
|
66
|
+
return 'muffled';
|
|
67
|
+
if (clarity === 2)
|
|
68
|
+
return 'fragments';
|
|
69
|
+
if (clarity === 1)
|
|
70
|
+
return 'presence-only';
|
|
71
|
+
return 'silent';
|
|
72
|
+
}
|
|
73
|
+
// =============================================================================
|
|
74
|
+
// Internal: room resolution
|
|
75
|
+
// =============================================================================
|
|
76
|
+
function locateRoom(world, entityId) {
|
|
77
|
+
const entity = world.getEntity(entityId);
|
|
78
|
+
if (!entity)
|
|
79
|
+
return undefined;
|
|
80
|
+
if (entity.has(world_model_1.TraitType.ROOM))
|
|
81
|
+
return entityId;
|
|
82
|
+
return world.getContainingRoom(entityId)?.id;
|
|
83
|
+
}
|
|
84
|
+
function getAcousticEdges(roomId, world) {
|
|
85
|
+
const room = world.getEntity(roomId);
|
|
86
|
+
if (!room)
|
|
87
|
+
return [];
|
|
88
|
+
const roomTrait = room.get(world_model_1.TraitType.ROOM);
|
|
89
|
+
if (!roomTrait)
|
|
90
|
+
return [];
|
|
91
|
+
const edges = [];
|
|
92
|
+
// Exits — each direction may carry a door whose state determines cost.
|
|
93
|
+
if (roomTrait.exits) {
|
|
94
|
+
for (const exit of Object.values(roomTrait.exits)) {
|
|
95
|
+
if (!exit)
|
|
96
|
+
continue;
|
|
97
|
+
const cost = exitAcousticCost(exit, world);
|
|
98
|
+
edges.push({ to: exit.destination, cost });
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
// Walls — effective cost combines AcousticTrait base + obstructor
|
|
102
|
+
// dampener contributions per ADR-173's generalized obstructor protocol.
|
|
103
|
+
if (roomTrait.walls) {
|
|
104
|
+
for (const wallId of roomTrait.walls) {
|
|
105
|
+
const wall = world.getEntity(wallId);
|
|
106
|
+
if (!(wall instanceof world_model_1.WallEntity))
|
|
107
|
+
continue;
|
|
108
|
+
const otherRoom = wall.otherRoom(roomId);
|
|
109
|
+
if (!otherRoom)
|
|
110
|
+
continue;
|
|
111
|
+
const cost = wallEffectiveAcousticCost(wall, world);
|
|
112
|
+
// Soundproof walls (cost = ∞) contribute no usable edge — drop
|
|
113
|
+
// them rather than feeding Infinity into Dijkstra.
|
|
114
|
+
if (!Number.isFinite(cost))
|
|
115
|
+
continue;
|
|
116
|
+
edges.push({ to: otherRoom, cost, wallId });
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// Future: acoustic conduits (separate ADR) plug in here.
|
|
120
|
+
return edges;
|
|
121
|
+
}
|
|
122
|
+
function exitAcousticCost(exit, world) {
|
|
123
|
+
if (!exit.via)
|
|
124
|
+
return 1; // open passage, no door
|
|
125
|
+
const door = world.getEntity(exit.via);
|
|
126
|
+
if (!door)
|
|
127
|
+
return 1;
|
|
128
|
+
if (!door.has(world_model_1.TraitType.OPENABLE))
|
|
129
|
+
return 1; // door without state = always open
|
|
130
|
+
const openable = door.get(world_model_1.TraitType.OPENABLE);
|
|
131
|
+
return openable?.isOpen ? 1 : 4;
|
|
132
|
+
}
|
|
133
|
+
function wallEffectiveAcousticCost(wall, world) {
|
|
134
|
+
const acoustic = wall.get(world_model_1.TraitType.ACOUSTIC);
|
|
135
|
+
const baseTier = acoustic?.tier ?? 'default';
|
|
136
|
+
const baseCost = world_model_1.ACOUSTIC_TIER_COSTS[baseTier];
|
|
137
|
+
if (!Number.isFinite(baseCost))
|
|
138
|
+
return Number.POSITIVE_INFINITY;
|
|
139
|
+
// Cross-side aggregation per ADR-172 effective_cost formula:
|
|
140
|
+
// base + Σ AcousticDampenerTrait.contribution for each side's
|
|
141
|
+
// currently-located obstructor.
|
|
142
|
+
const dampeners = (0, world_model_1.findTraitsOnObstructors)(wall, world_model_1.TraitType.ACOUSTIC_DAMPENER, world);
|
|
143
|
+
const contribution = dampeners.reduce((sum, m) => sum + m.trait.contribution, 0);
|
|
144
|
+
// Negative effective cost (a hole / amplifier / extreme conduit)
|
|
145
|
+
// clamps to 0 — sound passes the wall as if it weren't there, but
|
|
146
|
+
// we don't amplify beyond the volume budget.
|
|
147
|
+
return Math.max(0, baseCost + contribution);
|
|
148
|
+
}
|
|
149
|
+
function findShortestAcousticPath(source, target, world) {
|
|
150
|
+
if (source === target)
|
|
151
|
+
return { cost: 0, wallEdges: [] };
|
|
152
|
+
const dist = new Map();
|
|
153
|
+
const prev = new Map();
|
|
154
|
+
const visited = new Set();
|
|
155
|
+
dist.set(source, 0);
|
|
156
|
+
while (true) {
|
|
157
|
+
// Pick unvisited node with minimum tentative distance.
|
|
158
|
+
let current;
|
|
159
|
+
let currentDist = Number.POSITIVE_INFINITY;
|
|
160
|
+
for (const [node, d] of dist) {
|
|
161
|
+
if (!visited.has(node) && d < currentDist) {
|
|
162
|
+
current = node;
|
|
163
|
+
currentDist = d;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (!current || !Number.isFinite(currentDist))
|
|
167
|
+
break;
|
|
168
|
+
if (current === target)
|
|
169
|
+
break;
|
|
170
|
+
visited.add(current);
|
|
171
|
+
const edges = getAcousticEdges(current, world);
|
|
172
|
+
for (const edge of edges) {
|
|
173
|
+
if (visited.has(edge.to))
|
|
174
|
+
continue;
|
|
175
|
+
// Room-traversal cost: 1 per *intermediate* room. The source
|
|
176
|
+
// room contributes 0; every subsequent leg adds 1 to account
|
|
177
|
+
// for traversing the room we're leaving from.
|
|
178
|
+
const traversalCost = current === source ? 0 : 1;
|
|
179
|
+
const tentative = currentDist + traversalCost + edge.cost;
|
|
180
|
+
const known = dist.get(edge.to) ?? Number.POSITIVE_INFINITY;
|
|
181
|
+
if (tentative < known) {
|
|
182
|
+
dist.set(edge.to, tentative);
|
|
183
|
+
prev.set(edge.to, { from: current, wallId: edge.wallId });
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
const finalCost = dist.get(target);
|
|
188
|
+
if (finalCost === undefined || !Number.isFinite(finalCost))
|
|
189
|
+
return null;
|
|
190
|
+
// Reconstruct wall edges along the chosen path.
|
|
191
|
+
const wallEdges = [];
|
|
192
|
+
let cur = target;
|
|
193
|
+
while (cur && cur !== source) {
|
|
194
|
+
const p = prev.get(cur);
|
|
195
|
+
if (!p)
|
|
196
|
+
return null;
|
|
197
|
+
if (p.wallId)
|
|
198
|
+
wallEdges.push(p.wallId);
|
|
199
|
+
cur = p.from;
|
|
200
|
+
}
|
|
201
|
+
return { cost: finalCost, wallEdges };
|
|
202
|
+
}
|
|
203
|
+
// =============================================================================
|
|
204
|
+
// Internal: AudibilityEvent construction
|
|
205
|
+
// =============================================================================
|
|
206
|
+
function buildAudibilityEvent(sound, listenerRoom, wallId, tier, timestamp) {
|
|
207
|
+
return {
|
|
208
|
+
sourceRoomId: sound.sourceLocation,
|
|
209
|
+
targetRoomId: listenerRoom,
|
|
210
|
+
wallId,
|
|
211
|
+
sourceEntityId: sound.sourceEntity,
|
|
212
|
+
kind: sound.kind,
|
|
213
|
+
volumeTier: sound.volumeTier,
|
|
214
|
+
audibilityTier: tier,
|
|
215
|
+
content: sound.content,
|
|
216
|
+
timestamp,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=propagation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propagation.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/engine/src/sound/propagation.ts"],"names":[],"mappings":";AAAA,2CAA2C;;AAiF3C,8BA4BC;AAWD,sCAMC;AAxFD,kDAK4B;AAC5B,sDAW8B;AAE9B,gFAAgF;AAChF,aAAa;AACb,gFAAgF;AAEhF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,SAAS,CACvB,KAAa,EACb,UAAoB,EACpB,KAAiB,EACjB,SAAiB;IAEjB,MAAM,YAAY,GAAG,UAAU,CAAC,KAAK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AS,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;QAAE,OAAO,IAAI,CAAC;IAExE,gDAAgD;IAChD,MAAM,SAAS,GAAe,EAAE,CAAC;IACjC,IAAI,GAAG,GAAyB,MAAM,CAAC;IACvC,OAAO,GAAG,IAAI,GAAG,KAAK,MAAM,EAAE,CAAC;QAC7B,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACxB,IAAI,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;QACpB,IAAI,CAAC,CAAC,MAAM;YAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;QACvC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC;IACf,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AACxC,CAAC;AAED,gFAAgF;AAChF,yCAAyC;AACzC,gFAAgF;AAEhF,SAAS,oBAAoB,CAC3B,KAAa,EACb,YAAsB,EACtB,MAA4B,EAC5B,IAAuC,EACvC,SAAiB;IAEjB,OAAO;QACL,YAAY,EAAE,KAAK,CAAC,cAAc;QAClC,YAAY,EAAE,YAAY;QAC1B,MAAM;QACN,cAAc,EAAE,KAAK,CAAC,YAAY;QAClC,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,cAAc,EAAE,IAAI;QACpB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,SAAS;KACV,CAAC;AACJ,CAAC"}
|
package/story.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Story configuration and interfaces
|
|
3
3
|
*/
|
|
4
4
|
import { WorldModel, IFEntity, IGameEvent, SimpleEventHandler } from "../world-model/index";
|
|
5
|
-
import { LanguageProvider } from "../if-domain/index";
|
|
5
|
+
import { LanguageProvider, IChannelRegistry } from "../if-domain/index";
|
|
6
6
|
import { Parser } from "../stdlib/index";
|
|
7
7
|
import { ISemanticEvent } from "../core/index";
|
|
8
8
|
import type { GameEngine } from './game-engine';
|
|
@@ -23,6 +23,16 @@ export interface StoryConfig {
|
|
|
23
23
|
* Story author(s)
|
|
24
24
|
*/
|
|
25
25
|
author: string | string[];
|
|
26
|
+
/**
|
|
27
|
+
* Credit lines for the opening banner's `author-list` section. Each
|
|
28
|
+
* string becomes one `author-list`-classed paragraph. Use this when
|
|
29
|
+
* the banner needs distinct credit lines (e.g., a primary author
|
|
30
|
+
* line plus a "Ported by …" line, or multiple separate roles).
|
|
31
|
+
*
|
|
32
|
+
* When omitted, the engine falls back to a single `author-list`
|
|
33
|
+
* entry built from `author` (joined with ", " if it's an array).
|
|
34
|
+
*/
|
|
35
|
+
credits?: string[];
|
|
26
36
|
/**
|
|
27
37
|
* Story version (semantic version, e.g., "1.0.0" or "1.0.0-beta")
|
|
28
38
|
*/
|
|
@@ -185,6 +195,23 @@ export interface Story {
|
|
|
185
195
|
* @param engine - The fully initialized game engine
|
|
186
196
|
*/
|
|
187
197
|
onEngineReady?(engine: GameEngine): void;
|
|
198
|
+
/**
|
|
199
|
+
* Register or override channels on the platform's channel registry
|
|
200
|
+
* (ADR-163 §6, §7, §14). Invoked by `engine.start()` before the
|
|
201
|
+
* `ChannelService` is constructed.
|
|
202
|
+
*
|
|
203
|
+
* Stories use this hook to:
|
|
204
|
+
* - Add story-specific channels (e.g., a `debug-stats` JSON channel
|
|
205
|
+
* for renderer overlays).
|
|
206
|
+
* - Override a standard channel by re-registering an `IOChannel`
|
|
207
|
+
* with the same id (last-write-wins per ADR-163 §6).
|
|
208
|
+
* - Register dynamic image / ambient channels via stdlib's
|
|
209
|
+
* `createImageChannel` / `createAmbientChannel` builders.
|
|
210
|
+
*
|
|
211
|
+
* The registry passed in is the same instance for the lifetime of
|
|
212
|
+
* the engine. Re-registrations persist across the session.
|
|
213
|
+
*/
|
|
214
|
+
registerChannels?(registry: IChannelRegistry): void;
|
|
188
215
|
}
|
|
189
216
|
/**
|
|
190
217
|
* Extended story class with event handling capabilities
|
package/story.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"story.d.ts","sourceRoot":"","sources":["../../../../../repos/sharpee/packages/engine/src/story.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"story.d.ts","sourceRoot":"","sources":["../../../../../repos/sharpee/packages/engine/src/story.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE1B;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM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 -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"story.js","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/engine/src/story.ts"],"names":[],"mappings":";AAAA;;GAEG;;;
|
|
1
|
+
{"version":3,"file":"story.js","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/engine/src/story.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAsSH,kDAUC;AA3SD,0DAAsD;AAkPtD;;GAEG;AACH,MAAa,eAAe;IAC1B,MAAM,CAAc;IACZ,YAAY,CAAe;IAEnC,YAAY,MAAmB;QAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,IAAI,4BAAY,EAAE,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,EAAE,CAAC,SAAiB,EAAE,OAA2B;QAC/C,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,GAAG,CAAC,SAAiB,EAAE,OAA2B;QAChD,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED;;;OAGG;IACH,IAAI,CAAC,KAAiB;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,0DAA0D;IAC1D,eAAe,CAAC,KAAiB;QAC/B,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IAED,YAAY,CAAC,KAAiB;QAC5B,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;IACtD,CAAC;CACF;AAvCD,0CAuCC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,MAAmB;IACrD,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACrE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;IACjE,CAAC;IAED,gFAAgF;IAChF,MAAM,YAAY,GAAG,mCAAmC,CAAC;IACzD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,8EAA8E,CAAC,CAAC;IAClG,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mock `ITextService` implementation for engine tests — sub-phase 1.5.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the behavior of the legacy `MockTextService` so existing
|
|
5
|
+
* tests can swap to this without surprise. In sub-phase 1.6 the
|
|
6
|
+
* legacy `mock-text-service.ts` is deleted and engine test code
|
|
7
|
+
* imports from this module instead.
|
|
8
|
+
*
|
|
9
|
+
* Public interface: `MockProsePipeline`, `createMockProsePipeline`.
|
|
10
|
+
*
|
|
11
|
+
* Owner context: `@sharpee/engine` — test helpers.
|
|
12
|
+
*
|
|
13
|
+
* @see ADR-174 §Internal interfaces
|
|
14
|
+
*/
|
|
15
|
+
import type { ITextService } from '../prose-pipeline/types';
|
|
16
|
+
import type { ITextBlock } from "../../text-blocks/index";
|
|
17
|
+
import type { ISemanticEvent } from "../../core/index";
|
|
18
|
+
export declare class MockProsePipeline implements ITextService {
|
|
19
|
+
processTurn(events: ISemanticEvent[]): ITextBlock[];
|
|
20
|
+
}
|
|
21
|
+
export declare function createMockProsePipeline(): ITextService;
|
|
22
|
+
//# sourceMappingURL=mock-prose-pipeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-prose-pipeline.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/engine/src/test-helpers/mock-prose-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,qBAAa,iBAAkB,YAAW,YAAY;IACpD,WAAW,CAAC,MAAM,EAAE,cAAc,EAAE,GAAG,UAAU,EAAE;CAgCpD;AAED,wBAAgB,uBAAuB,IAAI,YAAY,CAEtD"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Mock `ITextService` implementation for engine tests — sub-phase 1.5.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors the behavior of the legacy `MockTextService` so existing
|
|
6
|
+
* tests can swap to this without surprise. In sub-phase 1.6 the
|
|
7
|
+
* legacy `mock-text-service.ts` is deleted and engine test code
|
|
8
|
+
* imports from this module instead.
|
|
9
|
+
*
|
|
10
|
+
* Public interface: `MockProsePipeline`, `createMockProsePipeline`.
|
|
11
|
+
*
|
|
12
|
+
* Owner context: `@sharpee/engine` — test helpers.
|
|
13
|
+
*
|
|
14
|
+
* @see ADR-174 §Internal interfaces
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.MockProsePipeline = void 0;
|
|
18
|
+
exports.createMockProsePipeline = createMockProsePipeline;
|
|
19
|
+
class MockProsePipeline {
|
|
20
|
+
processTurn(events) {
|
|
21
|
+
const blocks = [];
|
|
22
|
+
for (const event of events) {
|
|
23
|
+
const data = event.data;
|
|
24
|
+
if (event.type === 'action.error') {
|
|
25
|
+
blocks.push({
|
|
26
|
+
key: 'error',
|
|
27
|
+
content: [typeof data?.message === 'string' ? data.message : 'Error occurred'],
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
else if (data && typeof data.messageId === 'string') {
|
|
31
|
+
blocks.push({
|
|
32
|
+
key: 'action.result',
|
|
33
|
+
content: [data.messageId],
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
else if (event.type === 'room.described') {
|
|
37
|
+
blocks.push({
|
|
38
|
+
key: 'room.description',
|
|
39
|
+
content: [typeof data?.description === 'string' ? data.description : 'You are in a room.'],
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (blocks.length === 0) {
|
|
44
|
+
blocks.push({
|
|
45
|
+
key: 'game.message',
|
|
46
|
+
content: ['Nothing happened.'],
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
return blocks;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.MockProsePipeline = MockProsePipeline;
|
|
53
|
+
function createMockProsePipeline() {
|
|
54
|
+
return new MockProsePipeline();
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=mock-prose-pipeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-prose-pipeline.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/engine/src/test-helpers/mock-prose-pipeline.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAyCH,0DAEC;AArCD,MAAa,iBAAiB;IAC5B,WAAW,CAAC,MAAwB;QAClC,MAAM,MAAM,GAAiB,EAAE,CAAC;QAEhC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,MAAM,IAAI,GAAG,KAAK,CAAC,IAA2C,CAAC;YAC/D,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;gBAClC,MAAM,CAAC,IAAI,CAAC;oBACV,GAAG,EAAE,OAAO;oBACZ,OAAO,EAAE,CAAC,OAAO,IAAI,EAAE,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC;iBAC/E,CAAC,CAAC;YACL,CAAC;iBAAM,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,SAAS,KAAK,QAAQ,EAAE,CAAC;gBACtD,MAAM,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