@sharpee/stdlib 0.9.113 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/actions/enhanced-context.d.ts.map +1 -1
  2. package/actions/enhanced-context.js +16 -0
  3. package/actions/enhanced-context.js.map +1 -1
  4. package/actions/enhanced-types.d.ts +35 -0
  5. package/actions/enhanced-types.d.ts.map +1 -1
  6. package/actions/enhanced-types.js.map +1 -1
  7. package/actions/index.d.ts +0 -1
  8. package/actions/index.d.ts.map +1 -1
  9. package/actions/index.js +0 -1
  10. package/actions/index.js.map +1 -1
  11. package/actions/standard/about/about-events.d.ts +2 -0
  12. package/actions/standard/about/about-events.d.ts.map +1 -1
  13. package/actions/standard/about/about.d.ts.map +1 -1
  14. package/actions/standard/about/about.js +4 -1
  15. package/actions/standard/about/about.js.map +1 -1
  16. package/actions/standard/examining/examining-data.d.ts.map +1 -1
  17. package/actions/standard/examining/examining-data.js +34 -0
  18. package/actions/standard/examining/examining-data.js.map +1 -1
  19. package/actions/standard/examining/examining-messages.d.ts +1 -0
  20. package/actions/standard/examining/examining-messages.d.ts.map +1 -1
  21. package/actions/standard/examining/examining-messages.js +1 -0
  22. package/actions/standard/examining/examining-messages.js.map +1 -1
  23. package/actions/standard/examining/examining.d.ts.map +1 -1
  24. package/actions/standard/examining/examining.js +1 -0
  25. package/actions/standard/examining/examining.js.map +1 -1
  26. package/channels/index.d.ts +40 -0
  27. package/channels/index.d.ts.map +1 -0
  28. package/channels/index.js +86 -0
  29. package/channels/index.js.map +1 -0
  30. package/channels/keys.d.ts +23 -0
  31. package/channels/keys.d.ts.map +1 -0
  32. package/channels/keys.js +36 -0
  33. package/channels/keys.js.map +1 -0
  34. package/channels/media.d.ts +135 -0
  35. package/channels/media.d.ts.map +1 -0
  36. package/channels/media.js +397 -0
  37. package/channels/media.js.map +1 -0
  38. package/channels/registry.d.ts +58 -0
  39. package/channels/registry.d.ts.map +1 -0
  40. package/channels/registry.js +84 -0
  41. package/channels/registry.js.map +1 -0
  42. package/channels/sound-events.d.ts +72 -0
  43. package/channels/sound-events.d.ts.map +1 -0
  44. package/channels/sound-events.js +88 -0
  45. package/channels/sound-events.js.map +1 -0
  46. package/channels/standard.d.ts +209 -0
  47. package/channels/standard.d.ts.map +1 -0
  48. package/channels/standard.js +403 -0
  49. package/channels/standard.js.map +1 -0
  50. package/channels/world-helpers.d.ts +43 -0
  51. package/channels/world-helpers.d.ts.map +1 -0
  52. package/channels/world-helpers.js +72 -0
  53. package/channels/world-helpers.js.map +1 -0
  54. package/index.d.ts +1 -0
  55. package/index.d.ts.map +1 -1
  56. package/index.js +1 -0
  57. package/index.js.map +1 -1
  58. package/package.json +7 -6
  59. package/validation/command-validator.d.ts +11 -1
  60. package/validation/command-validator.d.ts.map +1 -1
  61. package/validation/command-validator.js +31 -1
  62. package/validation/command-validator.js.map +1 -1
@@ -0,0 +1,403 @@
1
+ "use strict";
2
+ /**
3
+ * @sharpee/stdlib/channels — standard `IOChannel` definitions.
4
+ *
5
+ * Owner context: stdlib language layer. The ten platform-vocabulary
6
+ * channels from ADR-163 §4 — co-located with stdlib because their
7
+ * closures read stdlib data sources (capabilities, blocks the
8
+ * text-service produces, world projections).
9
+ *
10
+ * Per ADR-163 §6, channels are self-contained: each `IOChannel`
11
+ * carries its identity, configuration, and a closure that computes
12
+ * the channel's value for the current turn from the
13
+ * `ChannelProduceContext`. There is no separate rule schema or
14
+ * routing layer; closures are the routing.
15
+ *
16
+ * **Standard channels are NOT capability-gated** (per §6 — they exist
17
+ * on every surface). Media channels gate; standards do not.
18
+ *
19
+ * @see ADR-163 — Channel-Service Platform — §4, §5, §6
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.STANDARD_CHANNEL_IDS = exports.STANDARD_CHANNELS = exports.lifecycleChannel = exports.scoreNotifyChannel = exports.endgameChannel = exports.deathChannel = exports.ifidChannel = exports.infoChannel = exports.turnChannel = exports.scoreChannel = exports.locationChannel = exports.promptChannel = exports.mainChannel = exports.STANDARD_CHANNEL_EVENTS = void 0;
23
+ const text_blocks_1 = require("../../text-blocks/index.js");
24
+ const keys_1 = require("./keys");
25
+ const world_helpers_1 = require("./world-helpers");
26
+ /**
27
+ * Local copy of the `flattenContent` helper. stdlib intentionally does
28
+ * not depend on `@sharpee/channel-service` (the engine composes that
29
+ * with stdlib's registry; making stdlib reach back into the runtime
30
+ * package would invert the dependency direction). The function is
31
+ * small enough to inline.
32
+ */
33
+ function flattenContent(content) {
34
+ let out = '';
35
+ for (const node of content) {
36
+ if (typeof node === 'string')
37
+ out += node;
38
+ else
39
+ out += flattenContent(node.content);
40
+ }
41
+ return out;
42
+ }
43
+ /**
44
+ * Event types the standard channels listen for. Stories or extensions
45
+ * that want to populate `death`, `endgame`, or `score_notify` emit
46
+ * events of these types; stdlib does not emit them itself.
47
+ *
48
+ * The values align with what the engine and stdlib extensions actually
49
+ * emit today:
50
+ *
51
+ * - `game.won` / `game.lost` — engine emits these from `engine.stop()`
52
+ * via `createGameWonEvent` / `createGameLostEvent` (core/events).
53
+ * - `combat.player_died` — emitted by the `@sharpee/ext-basic-combat`
54
+ * extension. Stories not using basic-combat that want a death
55
+ * channel emission must either fire `combat.player_died` themselves
56
+ * or override `deathChannel` with their own closure.
57
+ * - `game.score_changed` — no production emitter today. The channel
58
+ * listens for it, but it stays silent until a story or extension
59
+ * adopts the convention. Listed for forward-compatibility.
60
+ *
61
+ * Each event carries its message in `event.data.message` (string).
62
+ */
63
+ exports.STANDARD_CHANNEL_EVENTS = {
64
+ PLAYER_DIED: 'combat.player_died',
65
+ GAME_WON: 'game.won',
66
+ GAME_LOST: 'game.lost',
67
+ SCORE_CHANGED: 'game.score_changed',
68
+ };
69
+ /**
70
+ * Project an event's `data.message` field as a string, or `undefined`
71
+ * if the event has no string message. Used by death / endgame /
72
+ * score_notify channels to extract their payload.
73
+ */
74
+ function eventMessage(event) {
75
+ const data = event.data;
76
+ if (!data)
77
+ return undefined;
78
+ if (typeof data.message !== 'string')
79
+ return undefined;
80
+ return data.message;
81
+ }
82
+ /**
83
+ * `main` — append-mode prose transcript. Carries `MainEntry` objects
84
+ * (`{ content, tight? }`) so renderers can preserve decorations *and*
85
+ * the per-entry visual-continuation hint introduced by the pre-line
86
+ * removal (session 2026-05-12). Closure projects every block whose key
87
+ * is in `MAIN_KEYS` into the channel's append stream.
88
+ */
89
+ exports.mainChannel = {
90
+ id: 'main',
91
+ contentType: 'json',
92
+ mode: 'append',
93
+ emit: 'always',
94
+ produce: (ctx) => {
95
+ const entries = [];
96
+ for (const block of ctx.blocks) {
97
+ if (keys_1.MAIN_KEYS.has(block.key)) {
98
+ entries.push({
99
+ content: [...block.content],
100
+ ...(block.tight ? { tight: true } : {}),
101
+ ...(block.className ? { className: block.className } : {}),
102
+ });
103
+ }
104
+ }
105
+ return entries;
106
+ },
107
+ };
108
+ /**
109
+ * `prompt` — replace-mode input prompt. Defaults to `'> '` when no
110
+ * prompt block is emitted, so the renderer always has a sensible
111
+ * placeholder. Closure flattens the prompt block's content to plain
112
+ * string (decorations stripped).
113
+ */
114
+ exports.promptChannel = {
115
+ id: 'prompt',
116
+ contentType: 'text',
117
+ mode: 'replace',
118
+ emit: 'always',
119
+ produce: (ctx) => {
120
+ for (const block of ctx.blocks) {
121
+ if (block.key === text_blocks_1.CORE_BLOCK_KEYS.PROMPT) {
122
+ return flattenContent(block.content);
123
+ }
124
+ }
125
+ return '> ';
126
+ },
127
+ };
128
+ /**
129
+ * `location` — replace-mode status-line location name. Closure reads
130
+ * the player's containing room from the world and returns its display
131
+ * name. Returns `undefined` (the channel re-emits its prevValue) if
132
+ * the world has no player or the room cannot be resolved.
133
+ */
134
+ exports.locationChannel = {
135
+ id: 'location',
136
+ contentType: 'text',
137
+ mode: 'replace',
138
+ emit: 'always',
139
+ produce: (ctx) => (0, world_helpers_1.playerLocationName)(ctx),
140
+ };
141
+ /**
142
+ * `score` — replace-mode `{current, max}` payload.
143
+ *
144
+ * Reads the canonical ADR-129 score ledger first (`world.getScore()`
145
+ * and `world.getMaxScore()`); falls back to the legacy `scoring`
146
+ * capability's `scoreValue`/`maxScore` for older worlds that haven't
147
+ * adopted the ledger. The fallback path also serves stories that
148
+ * track score outside the ledger (rare; ADR-129 is the recommended
149
+ * pattern).
150
+ *
151
+ * `max: null` (not `0`) signals an unbounded score per ADR-163 §4
152
+ * commentary; `maxScore: 0` is treated as null since a 0-cap scoring
153
+ * system has no usable progress fraction.
154
+ *
155
+ * Returns `undefined` only when the world is missing entirely (test
156
+ * harness with a stub) — `always`-mode then re-emits prev.
157
+ */
158
+ exports.scoreChannel = {
159
+ id: 'score',
160
+ contentType: 'json',
161
+ mode: 'replace',
162
+ emit: 'always',
163
+ produce: (ctx) => {
164
+ // Try the ADR-129 ledger first.
165
+ const world = ctx.world;
166
+ if (world && typeof world.getScore === 'function') {
167
+ const current = world.getScore();
168
+ const maxRaw = typeof world.getMaxScore === 'function' ? world.getMaxScore() : 0;
169
+ const max = typeof maxRaw === 'number' && maxRaw > 0 ? maxRaw : null;
170
+ return { current, max };
171
+ }
172
+ // Fall back to the legacy `scoring` capability.
173
+ const cap = (0, world_helpers_1.readCapability)(ctx, 'scoring');
174
+ if (!cap)
175
+ return undefined;
176
+ const current = typeof cap.scoreValue === 'number' ? cap.scoreValue : 0;
177
+ const max = typeof cap.maxScore === 'number' && cap.maxScore > 0 ? cap.maxScore : null;
178
+ return { current, max };
179
+ },
180
+ };
181
+ /**
182
+ * `turn` — replace-mode turn count. Closure returns `ctx.turn`
183
+ * directly. Always emits because the turn counter changes every turn.
184
+ */
185
+ exports.turnChannel = {
186
+ id: 'turn',
187
+ contentType: 'number',
188
+ mode: 'replace',
189
+ emit: 'always',
190
+ produce: (ctx) => ctx.turn,
191
+ };
192
+ /**
193
+ * `info` — replace-mode story metadata. Closure projects every
194
+ * non-empty field from the `storyInfo` capability into a single
195
+ * payload object. The same payload is consumed by the browser
196
+ * `info` renderer (sets `document.title` + `data-*` attributes) and
197
+ * by any author-supplied dashboards.
198
+ */
199
+ exports.infoChannel = {
200
+ id: 'info',
201
+ contentType: 'json',
202
+ mode: 'replace',
203
+ emit: 'always',
204
+ produce: (ctx) => {
205
+ const cap = (0, world_helpers_1.readCapability)(ctx, 'storyInfo');
206
+ if (!cap)
207
+ return undefined;
208
+ const payload = {};
209
+ if (cap.title)
210
+ payload.title = cap.title;
211
+ if (cap.author)
212
+ payload.author = cap.author;
213
+ if (cap.version)
214
+ payload.version = cap.version;
215
+ if (cap.description)
216
+ payload.description = cap.description;
217
+ if (cap.buildDate)
218
+ payload.buildDate = cap.buildDate;
219
+ if (cap.engineVersion)
220
+ payload.engineVersion = cap.engineVersion;
221
+ if (cap.clientVersion)
222
+ payload.clientVersion = cap.clientVersion;
223
+ return payload;
224
+ },
225
+ };
226
+ /**
227
+ * `ifid` — replace-mode IFID string. Closure reads `storyInfo.ifid`
228
+ * and skips emission when the value is empty (sparse-suppress style),
229
+ * so stories without an IFID don't emit empty strings into the
230
+ * channel state.
231
+ */
232
+ exports.ifidChannel = {
233
+ id: 'ifid',
234
+ contentType: 'text',
235
+ mode: 'replace',
236
+ emit: 'always',
237
+ produce: (ctx) => {
238
+ const cap = (0, world_helpers_1.readCapability)(ctx, 'storyInfo');
239
+ if (!cap || typeof cap.ifid !== 'string' || cap.ifid.length === 0) {
240
+ return undefined;
241
+ }
242
+ return cap.ifid;
243
+ },
244
+ };
245
+ /**
246
+ * `death` — event-mode death notification. Closure looks for an
247
+ * `if.event.player_died` event in this turn's events and projects its
248
+ * `data.message` field. Stories that want different death handling
249
+ * register a replacement `IOChannel` with id `'death'` (last-write-wins
250
+ * per ADR-163 §6).
251
+ */
252
+ exports.deathChannel = {
253
+ id: 'death',
254
+ contentType: 'text',
255
+ mode: 'event',
256
+ emit: 'sparse',
257
+ produce: (ctx) => {
258
+ for (const event of ctx.events) {
259
+ if (event.type === exports.STANDARD_CHANNEL_EVENTS.PLAYER_DIED) {
260
+ return eventMessage(event);
261
+ }
262
+ }
263
+ return undefined;
264
+ },
265
+ };
266
+ /**
267
+ * `endgame` — event-mode endgame notification (game won OR game lost
268
+ * — the closure folds both into one channel since renderers typically
269
+ * present them similarly). Closure scans for either event type and
270
+ * returns the message of the first match.
271
+ */
272
+ exports.endgameChannel = {
273
+ id: 'endgame',
274
+ contentType: 'text',
275
+ mode: 'event',
276
+ emit: 'sparse',
277
+ produce: (ctx) => {
278
+ for (const event of ctx.events) {
279
+ if (event.type === exports.STANDARD_CHANNEL_EVENTS.GAME_WON ||
280
+ event.type === exports.STANDARD_CHANNEL_EVENTS.GAME_LOST) {
281
+ return eventMessage(event);
282
+ }
283
+ }
284
+ return undefined;
285
+ },
286
+ };
287
+ /**
288
+ * `score_notify` — event-mode transient score-change announcement.
289
+ * Closure scans for `if.event.score_changed` and emits its message.
290
+ */
291
+ exports.scoreNotifyChannel = {
292
+ id: 'score_notify',
293
+ contentType: 'text',
294
+ mode: 'event',
295
+ emit: 'sparse',
296
+ produce: (ctx) => {
297
+ for (const event of ctx.events) {
298
+ if (event.type === exports.STANDARD_CHANNEL_EVENTS.SCORE_CHANGED) {
299
+ return eventMessage(event);
300
+ }
301
+ }
302
+ return undefined;
303
+ },
304
+ };
305
+ /**
306
+ * Map a platform event's type to the lifecycle channel's discriminator.
307
+ * Returns `undefined` for non-lifecycle events so the channel closure
308
+ * can ignore them.
309
+ */
310
+ function lifecycleKind(eventType) {
311
+ if (eventType === 'platform.save_failed')
312
+ return 'save_failed';
313
+ if (eventType === 'platform.restore_failed')
314
+ return 'restore_failed';
315
+ if (eventType === 'platform.restore_completed')
316
+ return 'restore_completed';
317
+ return undefined;
318
+ }
319
+ /**
320
+ * Read `payload.error` from a platform-event-shaped object. Platform
321
+ * events store completion data on `payload`, not on the
322
+ * `ISemanticEvent.data` field that stdlib's other channels use, so
323
+ * lifecycle has its own reader. Returns `undefined` for non-string or
324
+ * absent values.
325
+ */
326
+ function platformEventError(event) {
327
+ const payload = event.payload;
328
+ if (!payload)
329
+ return undefined;
330
+ if (typeof payload.error !== 'string')
331
+ return undefined;
332
+ return payload.error;
333
+ }
334
+ /**
335
+ * `lifecycle` — event-mode save/restore signals. Projects the trio of
336
+ * platform completion events (`platform.save_failed`,
337
+ * `platform.restore_failed`, `platform.restore_completed`) into a
338
+ * single sparse channel.
339
+ *
340
+ * Renderers branch on `payload.kind`: failures display `payload.message`
341
+ * (or a fallback string), `restore_completed` triggers UI refresh
342
+ * without text. Sparse-emit semantics mean turns without a lifecycle
343
+ * event suppress emission entirely — the channel value retains its
344
+ * prior state on quiet turns.
345
+ *
346
+ * If multiple lifecycle events appear in one turn, the **last** one
347
+ * wins. In practice this is unobservable since each save/restore
348
+ * operation produces exactly one completion event, but the rule is
349
+ * documented so test authors don't expect first-wins semantics.
350
+ */
351
+ exports.lifecycleChannel = {
352
+ id: 'lifecycle',
353
+ contentType: 'json',
354
+ mode: 'event',
355
+ emit: 'sparse',
356
+ produce: (ctx) => {
357
+ let result;
358
+ for (const event of ctx.events) {
359
+ const kind = lifecycleKind(event.type);
360
+ if (!kind)
361
+ continue;
362
+ const message = platformEventError(event);
363
+ result = message !== undefined ? { kind, message } : { kind };
364
+ }
365
+ return result;
366
+ },
367
+ };
368
+ /**
369
+ * The ten platform-standard channels in iteration order. Order is
370
+ * preserved for stable diffing in tests and manifests; the
371
+ * `ChannelService` itself does not depend on ordering.
372
+ */
373
+ exports.STANDARD_CHANNELS = [
374
+ exports.mainChannel,
375
+ exports.promptChannel,
376
+ exports.locationChannel,
377
+ exports.scoreChannel,
378
+ exports.turnChannel,
379
+ exports.infoChannel,
380
+ exports.ifidChannel,
381
+ exports.deathChannel,
382
+ exports.endgameChannel,
383
+ exports.scoreNotifyChannel,
384
+ exports.lifecycleChannel,
385
+ ];
386
+ /**
387
+ * Channel id literals for the platform-standard set. Used by tests
388
+ * and consumers that need string-literal types.
389
+ */
390
+ exports.STANDARD_CHANNEL_IDS = {
391
+ MAIN: 'main',
392
+ PROMPT: 'prompt',
393
+ LOCATION: 'location',
394
+ SCORE: 'score',
395
+ TURN: 'turn',
396
+ INFO: 'info',
397
+ IFID: 'ifid',
398
+ DEATH: 'death',
399
+ ENDGAME: 'endgame',
400
+ SCORE_NOTIFY: 'score_notify',
401
+ LIFECYCLE: 'lifecycle',
402
+ };
403
+ //# sourceMappingURL=standard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standard.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/stdlib/src/channels/standard.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;AAIH,sDAAuD;AAEvD,iCAAmC;AACnC,mDAAqE;AAErE;;;;;;GAMG;AACH,SAAS,cAAc,CAAC,OAAmC;IACzD,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC3B,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,GAAG,IAAI,IAAI,CAAC;;YACrC,GAAG,IAAI,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACU,QAAA,uBAAuB,GAAG;IACrC,WAAW,EAAE,oBAAoB;IACjC,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,aAAa,EAAE,oBAAoB;CAC3B,CAAC;AA4BX;;;;GAIG;AACH,SAAS,YAAY,CAAC,KAAyB;IAC7C,MAAM,IAAI,GAAG,KAAK,CAAC,IAAyC,CAAC;IAC7D,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5B,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IACvD,OAAO,IAAI,CAAC,OAAO,CAAC;AACtB,CAAC;AAED;;;;;;GAMG;AACU,QAAA,WAAW,GAAyB;IAC/C,EAAE,EAAE,MAAM;IACV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WAAW,EAAE,MAAM;IACnB,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;QACf,IAAI,MAAoC,CAAC;QACzC,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;YAC/B,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACvC,IAAI,CAAC,IAAI;gBAAE,SAAS;YACpB,MAAM,OAAO,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAC1C,MAAM,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;QAChE,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC;AAEF;;;;GAIG;AACU,QAAA,iBAAiB,GAA6B;IACzD,mBAAW;IACX,qBAAa;IACb,uBAAe;IACf,oBAAY;IACZ,mBAAW;IACX,mBAAW;IACX,mBAAW;IACX,oBAAY;IACZ,sBAAc;IACd,0BAAkB;IAClB,wBAAgB;CACjB,CAAC;AAEF;;;GAGG;AACU,QAAA,oBAAoB,GAAG;IAClC,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,YAAY,EAAE,cAAc;IAC5B,SAAS,EAAE,WAAW;CACd,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * @sharpee/stdlib/channels — world-narrowing helpers for closures.
3
+ *
4
+ * Owner context: stdlib channel module. Centralizes the cast from
5
+ * `ChannelProduceContext.world` (typed `unknown` in if-domain to avoid
6
+ * a world-model dependency cycle — see ADR-163 §6 commentary) into the
7
+ * concrete `IWorldModel` shape that stdlib closures use.
8
+ *
9
+ * Each helper is null-safe: if the world is missing the expected
10
+ * accessor (e.g., a stub world used in tests, or a partial mock), the
11
+ * helper returns `undefined` rather than throwing. Closures using
12
+ * these helpers thus degrade gracefully — they emit `undefined`,
13
+ * which the `ChannelService` interprets as "no value this turn."
14
+ *
15
+ * Public interface (internal to stdlib):
16
+ * - `asWorld(ctx)` — narrow `ctx.world` to `IWorldModel` or
17
+ * `undefined`.
18
+ * - `readCapability<T>(ctx, name)` — typed capability lookup.
19
+ * - `playerLocationName(ctx)` — current room display name.
20
+ */
21
+ import type { ChannelProduceContext } from "../../if-domain/index";
22
+ import type { IWorldModel, ICapabilityData } from "../../world-model/index";
23
+ /**
24
+ * Return the context's world cast as an `IWorldModel`, or `undefined`
25
+ * if the context's world value is null/undefined or lacks the expected
26
+ * shape (no `getCapability` method).
27
+ */
28
+ export declare function asWorld(ctx: ChannelProduceContext): IWorldModel | undefined;
29
+ /**
30
+ * Read a named capability from the world, narrowed to a caller-typed
31
+ * shape. Returns `undefined` if the world is missing or the capability
32
+ * is not registered. The caller is responsible for asserting the
33
+ * returned shape — capability data is loosely typed in the world model.
34
+ */
35
+ export declare function readCapability<T extends ICapabilityData = ICapabilityData>(ctx: ChannelProduceContext, name: string): T | undefined;
36
+ /**
37
+ * Resolve the player's current room display name, or `undefined` if
38
+ * the world has no player, no containing room, or the room lacks a
39
+ * display name. Used by `locationChannel` to populate the status-line
40
+ * location field.
41
+ */
42
+ export declare function playerLocationName(ctx: ChannelProduceContext): string | undefined;
43
+ //# sourceMappingURL=world-helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"world-helpers.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/stdlib/src/channels/world-helpers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEzE;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,qBAAqB,GAAG,WAAW,GAAG,SAAS,CAK3E;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,eAAe,GAAG,eAAe,EACxE,GAAG,EAAE,qBAAqB,EAC1B,IAAI,EAAE,MAAM,GACX,CAAC,GAAG,SAAS,CAIf;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,qBAAqB,GAAG,MAAM,GAAG,SAAS,CAUjF"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ /**
3
+ * @sharpee/stdlib/channels — world-narrowing helpers for closures.
4
+ *
5
+ * Owner context: stdlib channel module. Centralizes the cast from
6
+ * `ChannelProduceContext.world` (typed `unknown` in if-domain to avoid
7
+ * a world-model dependency cycle — see ADR-163 §6 commentary) into the
8
+ * concrete `IWorldModel` shape that stdlib closures use.
9
+ *
10
+ * Each helper is null-safe: if the world is missing the expected
11
+ * accessor (e.g., a stub world used in tests, or a partial mock), the
12
+ * helper returns `undefined` rather than throwing. Closures using
13
+ * these helpers thus degrade gracefully — they emit `undefined`,
14
+ * which the `ChannelService` interprets as "no value this turn."
15
+ *
16
+ * Public interface (internal to stdlib):
17
+ * - `asWorld(ctx)` — narrow `ctx.world` to `IWorldModel` or
18
+ * `undefined`.
19
+ * - `readCapability<T>(ctx, name)` — typed capability lookup.
20
+ * - `playerLocationName(ctx)` — current room display name.
21
+ */
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ exports.asWorld = asWorld;
24
+ exports.readCapability = readCapability;
25
+ exports.playerLocationName = playerLocationName;
26
+ /**
27
+ * Return the context's world cast as an `IWorldModel`, or `undefined`
28
+ * if the context's world value is null/undefined or lacks the expected
29
+ * shape (no `getCapability` method).
30
+ */
31
+ function asWorld(ctx) {
32
+ const candidate = ctx.world;
33
+ if (!candidate)
34
+ return undefined;
35
+ if (typeof candidate.getCapability !== 'function')
36
+ return undefined;
37
+ return candidate;
38
+ }
39
+ /**
40
+ * Read a named capability from the world, narrowed to a caller-typed
41
+ * shape. Returns `undefined` if the world is missing or the capability
42
+ * is not registered. The caller is responsible for asserting the
43
+ * returned shape — capability data is loosely typed in the world model.
44
+ */
45
+ function readCapability(ctx, name) {
46
+ const world = asWorld(ctx);
47
+ if (!world)
48
+ return undefined;
49
+ return world.getCapability(name);
50
+ }
51
+ /**
52
+ * Resolve the player's current room display name, or `undefined` if
53
+ * the world has no player, no containing room, or the room lacks a
54
+ * display name. Used by `locationChannel` to populate the status-line
55
+ * location field.
56
+ */
57
+ function playerLocationName(ctx) {
58
+ const world = asWorld(ctx);
59
+ if (!world)
60
+ return undefined;
61
+ const player = world.getPlayer?.();
62
+ if (!player)
63
+ return undefined;
64
+ const room = world.getContainingRoom?.(player.id);
65
+ if (!room)
66
+ return undefined;
67
+ const name = room.name;
68
+ if (typeof name !== 'string' || name.length === 0)
69
+ return undefined;
70
+ return name;
71
+ }
72
+ //# sourceMappingURL=world-helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"world-helpers.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/stdlib/src/channels/world-helpers.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;AAUH,0BAKC;AAQD,wCAOC;AAQD,gDAUC;AA3CD;;;;GAIG;AACH,SAAgB,OAAO,CAAC,GAA0B;IAChD,MAAM,SAAS,GAAG,GAAG,CAAC,KAAgD,CAAC;IACvE,IAAI,CAAC,SAAS;QAAE,OAAO,SAAS,CAAC;IACjC,IAAI,OAAO,SAAS,CAAC,aAAa,KAAK,UAAU;QAAE,OAAO,SAAS,CAAC;IACpE,OAAO,SAAwB,CAAC;AAClC,CAAC;AAED;;;;;GAKG;AACH,SAAgB,cAAc,CAC5B,GAA0B,EAC1B,IAAY;IAEZ,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3B,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,OAAO,KAAK,CAAC,aAAa,CAAC,IAAI,CAAkB,CAAC;AACpD,CAAC;AAED;;;;;GAKG;AACH,SAAgB,kBAAkB,CAAC,GAA0B;IAC3D,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAC3B,IAAI,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IAC7B,MAAM,MAAM,GAAG,KAAK,CAAC,SAAS,EAAE,EAAE,CAAC;IACnC,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,MAAM,IAAI,GAAG,KAAK,CAAC,iBAAiB,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;IAClD,IAAI,CAAC,IAAI;QAAE,OAAO,SAAS,CAAC;IAC5B,MAAM,IAAI,GAAI,IAA0B,CAAC,IAAI,CAAC;IAC9C,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IACpE,OAAO,IAAI,CAAC;AACd,CAAC"}
package/index.d.ts CHANGED
@@ -25,4 +25,5 @@ export * from './combat';
25
25
  export * from './chains';
26
26
  export * from './inference';
27
27
  export * from './utils';
28
+ export * from './channels';
28
29
  //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../repos/sharpee/packages/stdlib/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,cAAc,WAAW,CAAC;AAI1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../repos/sharpee/packages/stdlib/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,cAAc,WAAW,CAAC;AAI1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC"}
package/index.js CHANGED
@@ -44,4 +44,5 @@ __exportStar(require("./combat"), exports);
44
44
  __exportStar(require("./chains"), exports);
45
45
  __exportStar(require("./inference"), exports);
46
46
  __exportStar(require("./utils"), exports);
47
+ __exportStar(require("./channels"), exports);
47
48
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/stdlib/src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;;;;;;;;;;;;AAEH,4CAA0B;AAC1B,0EAA0E;AAC1E,oFAAoF;AACpF,6CAA6C;AAC7C,2CAAyB;AACzB,2CAAyB;AACzB,+CAA6B;AAC7B,+CAA6B;AAC7B,iDAA+B;AAC/B,mDAAiC;AACjC,0CAAwB;AACxB,6CAA2B;AAC3B,wCAAsB;AACtB,2CAAyB;AACzB,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/stdlib/src/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;;;;;;;;;;;;;;AAEH,4CAA0B;AAC1B,0EAA0E;AAC1E,oFAAoF;AACpF,6CAA6C;AAC7C,2CAAyB;AACzB,2CAAyB;AACzB,+CAA6B;AAC7B,+CAA6B;AAC7B,iDAA+B;AAC/B,mDAAiC;AACjC,0CAAwB;AACxB,6CAA2B;AAC3B,wCAAsB;AACtB,2CAAyB;AACzB,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB;AACxB,6CAA2B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sharpee/stdlib",
3
- "version": "0.9.113",
3
+ "version": "1.0.0",
4
4
  "description": "Standard library for Sharpee IF Platform - actions, commands, and game mechanics",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -12,11 +12,12 @@
12
12
  }
13
13
  },
14
14
  "dependencies": {
15
- "@sharpee/core": "^0.9.113",
16
- "@sharpee/if-domain": "^0.9.113",
17
- "@sharpee/if-services": "^0.9.113",
18
- "@sharpee/lang-en-us": "^0.9.113",
19
- "@sharpee/world-model": "^0.9.113"
15
+ "@sharpee/core": "^1.0.0",
16
+ "@sharpee/if-domain": "^1.0.0",
17
+ "@sharpee/if-services": "^1.0.0",
18
+ "@sharpee/lang-en-us": "^1.0.0",
19
+ "@sharpee/text-blocks": "^1.0.0",
20
+ "@sharpee/world-model": "^1.0.0"
20
21
  },
21
22
  "keywords": [
22
23
  "interactive-fiction",
@@ -144,7 +144,17 @@ export declare class CommandValidator implements CommandValidator {
144
144
  */
145
145
  private getEntityDescription;
146
146
  /**
147
- * Get entity adjectives
147
+ * Get entity adjectives.
148
+ *
149
+ * For walls (ADR-173), adjectives are per-side: the wall entity carries
150
+ * an adjective for each of its two connecting rooms, and the parser
151
+ * resolves against the side facing the player's current room. The same
152
+ * wall entity therefore matches different adjectives from each side
153
+ * (e.g. 'oak' from the parlor, 'brick' from the library). When the
154
+ * player is not in either connecting room, the wall contributes no
155
+ * adjectives.
156
+ *
157
+ * For all other entities, adjectives come from `IdentityTrait.adjectives`.
148
158
  */
149
159
  private getEntityAdjectives;
150
160
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"command-validator.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/stdlib/src/validation/command-validator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,MAAM,EACP,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EAEX,yBAAyB,EACzB,gBAAgB,EAChB,UAAU,EAEX,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,gBAAgB,EAAa,MAAM,SAAS,CAAC;AAG3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG3D;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,sBAAsB,EAAE,OAAO,CAAC;IAChC,iBAAiB,CAAC,EAAE,UAAU,CAAC;IAC/B,mBAAmB,CAAC,EAAE,UAAU,CAAC;IACjC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AAcD;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,gBAAgB,GAAG,YAAY,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC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IACH,OAAO,CAAC,kBAAkB;IA2B1B;;OAEG;IACH,OAAO,CAAC,aAAa;IAUrB;;OAEG;IACH,OAAO,CAAC,oBAAoB;IAK5B;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAY3B;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAoBzB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAiBzB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAehC;;OAEG;IACH,OAAO,CAAC,cAAc;CAkBvB"}
1
+ {"version":3,"file":"command-validator.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/stdlib/src/validation/command-validator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,mBAAmB,EACnB,MAAM,EACP,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EAEX,yBAAyB,EACzB,gBAAgB,EAChB,UAAU,EAEX,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,gBAAgB,EAAa,MAAM,SAAS,CAAC;AAG3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG3D;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,sBAAsB,EAAE,OAAO,CAAC;IAChC,iBAAiB,CAAC,EAAE,UAAU,CAAC;IAC/B,mBAAmB,CAAC,EAAE,UAAU,CAAC;IACjC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC9B;AAcD;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,cAAc,GAAG,gBAAgB,GAAG,YAAY,CAAC;AAE1E;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAEnE;;GAEG;AACH,MAA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