@sharpee/world-model 0.9.110 → 0.9.113
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/capabilities/action-interceptor.d.ts +122 -6
- package/capabilities/action-interceptor.d.ts.map +1 -1
- package/capabilities/action-interceptor.js +59 -0
- package/capabilities/action-interceptor.js.map +1 -1
- package/capabilities/index.d.ts +1 -1
- package/capabilities/index.d.ts.map +1 -1
- package/capabilities/index.js +11 -1
- package/capabilities/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* - CapabilityBehavior: Full delegation, trait owns ALL logic (LOWER, RAISE)
|
|
11
11
|
* - ActionInterceptor: Hooks into phases, action owns core logic (ENTER, PUT)
|
|
12
12
|
*/
|
|
13
|
+
import { ISemanticEvent } from "../../core/index";
|
|
13
14
|
import { IFEntity } from '../entities';
|
|
14
15
|
import { WorldModel } from '../world';
|
|
15
16
|
import { CapabilityEffect } from './types';
|
|
@@ -34,6 +35,98 @@ export interface InterceptorResult {
|
|
|
34
35
|
/** Additional context for error messages */
|
|
35
36
|
params?: Record<string, unknown>;
|
|
36
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Result returned by `ActionInterceptor.postReport` (ISSUE-074).
|
|
40
|
+
*
|
|
41
|
+
* Distinguishes two semantically different intents that the old
|
|
42
|
+
* entity-`on` system collapsed onto a single `Effect[]` shape:
|
|
43
|
+
*
|
|
44
|
+
* 1. `override` — replace the primary domain event's `messageId`
|
|
45
|
+
* (and optional params). Use when the interceptor's narration
|
|
46
|
+
* *substitutes* for the action's standard message. Example: rug push
|
|
47
|
+
* reveals the trap door — the rug-reveal text replaces the generic
|
|
48
|
+
* "you give the rug a push" line.
|
|
49
|
+
*
|
|
50
|
+
* 2. `emit` — additional events to render alongside the action's
|
|
51
|
+
* standard ones. Use for side-channel narration (multi-line
|
|
52
|
+
* consequences) or events that are not message overrides.
|
|
53
|
+
*
|
|
54
|
+
* Both fields are optional and independent. Return `{}` (or simply
|
|
55
|
+
* an empty object literal) when the interceptor has nothing to do.
|
|
56
|
+
*
|
|
57
|
+
* Mirrors the override semantic that `event-processor.invokeEntityHandlers()`
|
|
58
|
+
* applies to single `game.message` reactions from story-level handlers
|
|
59
|
+
* (ADR-106), making the same intent explicit at the interceptor contract.
|
|
60
|
+
*
|
|
61
|
+
* @see applyInterceptorReportResult
|
|
62
|
+
*/
|
|
63
|
+
export interface InterceptorReportResult {
|
|
64
|
+
/** Override the primary domain event's messageId (and optional params/text).
|
|
65
|
+
*
|
|
66
|
+
* - `messageId`: replaces the primary event's `data.messageId`.
|
|
67
|
+
* - `params` (optional): replaces the primary event's `data.params`.
|
|
68
|
+
* - `text` (optional): replaces the primary event's `data.text`. Used
|
|
69
|
+
* when the interceptor has a pre-rendered string and wants the
|
|
70
|
+
* text-service to fall back to it if `messageId` doesn't resolve
|
|
71
|
+
* to a language template (mirrors the inline-text fallback in
|
|
72
|
+
* `event-processor.ts`'s entity-handler override path).
|
|
73
|
+
*
|
|
74
|
+
* Multiple interceptors returning `override` for the same action is a
|
|
75
|
+
* hard error mirroring ADR-106's "multiple game.message reactions" rule. */
|
|
76
|
+
override?: {
|
|
77
|
+
messageId: string;
|
|
78
|
+
params?: Record<string, unknown>;
|
|
79
|
+
text?: string;
|
|
80
|
+
};
|
|
81
|
+
/** Emit additional events alongside the action's standard events. */
|
|
82
|
+
emit?: CapabilityEffect[];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Minimal context shape required by `applyInterceptorReportResult`.
|
|
86
|
+
*
|
|
87
|
+
* Real action contexts (both the engine's closure-based factory and the
|
|
88
|
+
* stdlib's class-based `EnhancedActionContext`) satisfy this structurally
|
|
89
|
+
* by exposing `event(type, data)`. Passing the *context object* — rather
|
|
90
|
+
* than an unbound `context.event` callback — preserves `this` for the
|
|
91
|
+
* class-based implementation, which would otherwise crash inside
|
|
92
|
+
* `createEventInternal`. Callers cannot forget to bind because there is
|
|
93
|
+
* nothing to bind.
|
|
94
|
+
*/
|
|
95
|
+
export interface InterceptorEventContext {
|
|
96
|
+
event(type: string, data: Record<string, any>): ISemanticEvent;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Apply an interceptor's `postReport` result to an action's emitted events.
|
|
100
|
+
*
|
|
101
|
+
* - If `result.override` is set, copies `messageId` (and optional `params`/`text`)
|
|
102
|
+
* onto the data of the event whose type matches `primaryEventType`.
|
|
103
|
+
* - If `result.emit` is set, converts each effect to an `ISemanticEvent`
|
|
104
|
+
* via `context.event(...)` and appends to `events`.
|
|
105
|
+
*
|
|
106
|
+
* The action's `report()` phase is responsible for calling this helper
|
|
107
|
+
* with the events array it has built so far, the event type that
|
|
108
|
+
* carries the standard message (e.g. `'if.event.pushed'`), and the
|
|
109
|
+
* action context whose `event(...)` method produces events with proper
|
|
110
|
+
* entity bindings.
|
|
111
|
+
*
|
|
112
|
+
* @param events - The action's events array; mutated in place.
|
|
113
|
+
* @param primaryEventType - The event type whose `messageId` an `override`
|
|
114
|
+
* should replace (e.g. `'if.event.pushed'`).
|
|
115
|
+
* @param result - The value returned from `interceptor.postReport`.
|
|
116
|
+
* @param context - The action context (any object exposing
|
|
117
|
+
* `event(type, data)`).
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* // In the pushing action's report() phase, after pushing the standard
|
|
122
|
+
* // if.event.pushed onto events:
|
|
123
|
+
* if (interceptor?.postReport) {
|
|
124
|
+
* const result = interceptor.postReport(target, world, actorId, interceptorData);
|
|
125
|
+
* applyInterceptorReportResult(events, 'if.event.pushed', result, context);
|
|
126
|
+
* }
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
export declare function applyInterceptorReportResult(events: ISemanticEvent[], primaryEventType: string, result: InterceptorReportResult, context: InterceptorEventContext): void;
|
|
37
130
|
/**
|
|
38
131
|
* Action interceptor interface.
|
|
39
132
|
*
|
|
@@ -138,17 +231,40 @@ export interface ActionInterceptor {
|
|
|
138
231
|
/**
|
|
139
232
|
* Called AFTER standard report.
|
|
140
233
|
*
|
|
141
|
-
* Return
|
|
142
|
-
*
|
|
234
|
+
* Return an `InterceptorReportResult` that declares either:
|
|
235
|
+
* - `override`: replace the primary domain event's `messageId` (so the
|
|
236
|
+
* interceptor's narration *substitutes* for the standard message), or
|
|
237
|
+
* - `emit`: additional events to render alongside the standard ones, or
|
|
238
|
+
* - both, or neither (return `{}` for no-op).
|
|
239
|
+
*
|
|
240
|
+
* Use `override` when the interceptor's message should *replace* the
|
|
241
|
+
* action's default text. Use `emit` for side-channel narration or
|
|
242
|
+
* non-message events.
|
|
243
|
+
*
|
|
244
|
+
* The action's `report()` phase applies the result via
|
|
245
|
+
* `applyInterceptorReportResult` (see helper below).
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* // Override: rug push reveals trap door — the rug-reveal text
|
|
249
|
+
* // replaces the generic "you give the rug a push" message.
|
|
250
|
+
* postReport(entity, world, actorId, sharedData) {
|
|
251
|
+
* if (!sharedData.rugRevealed) return {};
|
|
252
|
+
* return { override: { messageId: 'dungeo.rug.moved.reveal_trapdoor' } };
|
|
253
|
+
* }
|
|
143
254
|
*
|
|
144
255
|
* @example
|
|
145
|
-
* //
|
|
256
|
+
* // Emit: ghost ritual narrates two consecutive lines.
|
|
146
257
|
* postReport(entity, world, actorId, sharedData) {
|
|
147
|
-
* if (!sharedData.
|
|
148
|
-
* return
|
|
258
|
+
* if (!sharedData.ritualCompleted) return {};
|
|
259
|
+
* return {
|
|
260
|
+
* emit: [
|
|
261
|
+
* createEffect('game.message', { messageId: 'dungeo.ghost.appears' }),
|
|
262
|
+
* createEffect('game.message', { messageId: 'dungeo.ghost.canvas_spawns' })
|
|
263
|
+
* ]
|
|
264
|
+
* };
|
|
149
265
|
* }
|
|
150
266
|
*/
|
|
151
|
-
postReport?(entity: IFEntity, world: WorldModel, actorId: string, sharedData: InterceptorSharedData):
|
|
267
|
+
postReport?(entity: IFEntity, world: WorldModel, actorId: string, sharedData: InterceptorSharedData): InterceptorReportResult;
|
|
152
268
|
/**
|
|
153
269
|
* Called when action is blocked (validation failed).
|
|
154
270
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-interceptor.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/capabilities/action-interceptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5D;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,qCAAqC;IACrC,KAAK,EAAE,OAAO,CAAC;IACf,2DAA2D;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;;;;;;;OAeG;IACH,WAAW,CAAC,CACV,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,qBAAqB,GAChC,iBAAiB,GAAG,IAAI,CAAC;IAE5B;;;;;;;;;;;;;;;;;;OAkBG;IACH,YAAY,CAAC,CACX,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,qBAAqB,GAChC,iBAAiB,GAAG,IAAI,CAAC;IAE5B;;;;;;;;;;;;;;OAcG;IACH,WAAW,CAAC,CACV,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,qBAAqB,GAChC,IAAI,CAAC;IAER
|
|
1
|
+
{"version":3,"file":"action-interceptor.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/capabilities/action-interceptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE5D;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,qCAAqC;IACrC,KAAK,EAAE,OAAO,CAAC;IACf,2DAA2D;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;;;;;;;;iFAW6E;IAC7E,QAAQ,CAAC,EAAE;QACT,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACjC,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IAEF,qEAAqE;IACrE,IAAI,CAAC,EAAE,gBAAgB,EAAE,CAAC;CAC3B;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,uBAAuB;IACtC,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,cAAc,CAAC;CAChE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,4BAA4B,CAC1C,MAAM,EAAE,cAAc,EAAE,EACxB,gBAAgB,EAAE,MAAM,EACxB,MAAM,EAAE,uBAAuB,EAC/B,OAAO,EAAE,uBAAuB,GAC/B,IAAI,CA4BN;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;;;;;;;OAeG;IACH,WAAW,CAAC,CACV,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,qBAAqB,GAChC,iBAAiB,GAAG,IAAI,CAAC;IAE5B;;;;;;;;;;;;;;;;;;OAkBG;IACH,YAAY,CAAC,CACX,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,qBAAqB,GAChC,iBAAiB,GAAG,IAAI,CAAC;IAE5B;;;;;;;;;;;;;;OAcG;IACH,WAAW,CAAC,CACV,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,qBAAqB,GAChC,IAAI,CAAC;IAER;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,UAAU,CAAC,CACT,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,qBAAqB,GAChC,uBAAuB,CAAC;IAE3B;;;;;;;;;;;;;;OAcG;IACH,SAAS,CAAC,CACR,MAAM,EAAE,QAAQ,EAChB,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,qBAAqB,GAChC,gBAAgB,EAAE,GAAG,IAAI,CAAC;CAC9B"}
|
|
@@ -12,4 +12,63 @@
|
|
|
12
12
|
* - ActionInterceptor: Hooks into phases, action owns core logic (ENTER, PUT)
|
|
13
13
|
*/
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.applyInterceptorReportResult = applyInterceptorReportResult;
|
|
16
|
+
/**
|
|
17
|
+
* Apply an interceptor's `postReport` result to an action's emitted events.
|
|
18
|
+
*
|
|
19
|
+
* - If `result.override` is set, copies `messageId` (and optional `params`/`text`)
|
|
20
|
+
* onto the data of the event whose type matches `primaryEventType`.
|
|
21
|
+
* - If `result.emit` is set, converts each effect to an `ISemanticEvent`
|
|
22
|
+
* via `context.event(...)` and appends to `events`.
|
|
23
|
+
*
|
|
24
|
+
* The action's `report()` phase is responsible for calling this helper
|
|
25
|
+
* with the events array it has built so far, the event type that
|
|
26
|
+
* carries the standard message (e.g. `'if.event.pushed'`), and the
|
|
27
|
+
* action context whose `event(...)` method produces events with proper
|
|
28
|
+
* entity bindings.
|
|
29
|
+
*
|
|
30
|
+
* @param events - The action's events array; mutated in place.
|
|
31
|
+
* @param primaryEventType - The event type whose `messageId` an `override`
|
|
32
|
+
* should replace (e.g. `'if.event.pushed'`).
|
|
33
|
+
* @param result - The value returned from `interceptor.postReport`.
|
|
34
|
+
* @param context - The action context (any object exposing
|
|
35
|
+
* `event(type, data)`).
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* // In the pushing action's report() phase, after pushing the standard
|
|
40
|
+
* // if.event.pushed onto events:
|
|
41
|
+
* if (interceptor?.postReport) {
|
|
42
|
+
* const result = interceptor.postReport(target, world, actorId, interceptorData);
|
|
43
|
+
* applyInterceptorReportResult(events, 'if.event.pushed', result, context);
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
function applyInterceptorReportResult(events, primaryEventType, result, context) {
|
|
48
|
+
if (result.override) {
|
|
49
|
+
const primary = events.find((e) => e.type === primaryEventType);
|
|
50
|
+
if (primary) {
|
|
51
|
+
const data = primary.data;
|
|
52
|
+
data.messageId = result.override.messageId;
|
|
53
|
+
if (result.override.params) {
|
|
54
|
+
data.params = result.override.params;
|
|
55
|
+
}
|
|
56
|
+
if (result.override.text) {
|
|
57
|
+
data.text = result.override.text;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
// Defensive: an interceptor asked for an override but the action
|
|
62
|
+
// didn't emit a primary event of that type. Either the action's
|
|
63
|
+
// contract changed or the interceptor is misconfigured.
|
|
64
|
+
console.warn(`applyInterceptorReportResult: override requested for primary event type ` +
|
|
65
|
+
`"${primaryEventType}" but no event of that type was found in the events array.`);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (result.emit) {
|
|
69
|
+
for (const effect of result.emit) {
|
|
70
|
+
events.push(context.event(effect.type, effect.payload));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
15
74
|
//# sourceMappingURL=action-interceptor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-interceptor.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/capabilities/action-interceptor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG"}
|
|
1
|
+
{"version":3,"file":"action-interceptor.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/capabilities/action-interceptor.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;AA4HH,oEAiCC;AAhED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,SAAgB,4BAA4B,CAC1C,MAAwB,EACxB,gBAAwB,EACxB,MAA+B,EAC/B,OAAgC;IAEhC,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,gBAAgB,CAAC,CAAC;QAChE,IAAI,OAAO,EAAE,CAAC;YACZ,MAAM,IAAI,GAAG,OAAO,CAAC,IAA+B,CAAC;YACrD,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;YAC3C,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;gBAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;YACvC,CAAC;YACD,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACzB,IAAI,CAAC,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;YACnC,CAAC;QACH,CAAC;aAAM,CAAC;YACN,iEAAiE;YACjE,gEAAgE;YAChE,wDAAwD;YACxD,OAAO,CAAC,IAAI,CACV,0EAA0E;gBAC1E,IAAI,gBAAgB,4DAA4D,CACjF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QAChB,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YACjC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/capabilities/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export { TraitBehaviorBinding, BehaviorRegistrationOptions, registerCapabilityBe
|
|
|
10
10
|
export { CapabilityResolution, CapabilityMode, CapabilityConfig, defineCapabilityDefaults, getCapabilityConfig, hasCapabilityDefaults, clearCapabilityDefaults, getAllCapabilityDefaults } from './capability-defaults';
|
|
11
11
|
export { findTraitWithCapability, hasCapability, getEntityCapabilities, traitHasCapability, getCapableTraits } from './capability-helpers';
|
|
12
12
|
export { EntityBuilder, buildEntity } from './entity-builder';
|
|
13
|
-
export { ActionInterceptor, InterceptorSharedData, InterceptorResult } from './action-interceptor';
|
|
13
|
+
export { ActionInterceptor, InterceptorSharedData, InterceptorResult, InterceptorReportResult, InterceptorEventContext, applyInterceptorReportResult } from './action-interceptor';
|
|
14
14
|
export { TraitInterceptorBinding, InterceptorRegistrationOptions, InterceptorLookupResult, registerActionInterceptor, getInterceptorForAction, getInterceptorBinding, hasActionInterceptor, unregisterActionInterceptor, clearInterceptorRegistry, getAllInterceptorBindings } from './interceptor-registry';
|
|
15
15
|
export { findTraitWithInterceptor, hasInterceptor, getEntityInterceptors, traitHasInterceptor, getInterceptorTraits } from './interceptor-helpers';
|
|
16
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/capabilities/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,YAAY,EACb,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAGjF,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,0BAA0B,EAC1B,wBAAwB,EACxB,kBAAkB,EAClB,qBAAqB,EACrB,4BAA4B,EAC5B,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAChB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,aAAa,EACb,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAW1B,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../repos/sharpee/packages/world-model/src/capabilities/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,YAAY,EACb,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAGjF,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,0BAA0B,EAC1B,wBAAwB,EACxB,kBAAkB,EAClB,qBAAqB,EACrB,4BAA4B,EAC5B,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAChB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,uBAAuB,EACvB,aAAa,EACb,qBAAqB,EACrB,kBAAkB,EAClB,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,aAAa,EACb,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAW1B,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,iBAAiB,EACjB,uBAAuB,EACvB,uBAAuB,EACvB,4BAA4B,EAC7B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,uBAAuB,EACvB,8BAA8B,EAC9B,uBAAuB,EACvB,yBAAyB,EACzB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,2BAA2B,EAC3B,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,wBAAwB,EACxB,cAAc,EACd,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,uBAAuB,CAAC"}
|
package/capabilities/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* (action IDs they respond to) and behaviors implement the logic.
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.getInterceptorTraits = exports.traitHasInterceptor = exports.getEntityInterceptors = exports.hasInterceptor = exports.findTraitWithInterceptor = exports.getAllInterceptorBindings = exports.clearInterceptorRegistry = exports.unregisterActionInterceptor = exports.hasActionInterceptor = exports.getInterceptorBinding = exports.getInterceptorForAction = exports.registerActionInterceptor = exports.buildEntity = exports.EntityBuilder = exports.getCapableTraits = exports.traitHasCapability = exports.getEntityCapabilities = exports.hasCapability = exports.findTraitWithCapability = exports.getAllCapabilityDefaults = exports.clearCapabilityDefaults = exports.hasCapabilityDefaults = exports.getCapabilityConfig = exports.defineCapabilityDefaults = exports.getAllCapabilityBindings = exports.clearCapabilityRegistry = exports.unregisterCapabilityBehavior = exports.hasCapabilityBehavior = exports.getBehaviorBinding = exports.getBehaviorForCapability = exports.registerCapabilityBehavior = exports.createEffect = void 0;
|
|
9
|
+
exports.getInterceptorTraits = exports.traitHasInterceptor = exports.getEntityInterceptors = exports.hasInterceptor = exports.findTraitWithInterceptor = exports.getAllInterceptorBindings = exports.clearInterceptorRegistry = exports.unregisterActionInterceptor = exports.hasActionInterceptor = exports.getInterceptorBinding = exports.getInterceptorForAction = exports.registerActionInterceptor = exports.applyInterceptorReportResult = exports.buildEntity = exports.EntityBuilder = exports.getCapableTraits = exports.traitHasCapability = exports.getEntityCapabilities = exports.hasCapability = exports.findTraitWithCapability = exports.getAllCapabilityDefaults = exports.clearCapabilityDefaults = exports.hasCapabilityDefaults = exports.getCapabilityConfig = exports.defineCapabilityDefaults = exports.getAllCapabilityBindings = exports.clearCapabilityRegistry = exports.unregisterCapabilityBehavior = exports.hasCapabilityBehavior = exports.getBehaviorBinding = exports.getBehaviorForCapability = exports.registerCapabilityBehavior = exports.createEffect = void 0;
|
|
10
10
|
// Types
|
|
11
11
|
var types_1 = require("./types");
|
|
12
12
|
Object.defineProperty(exports, "createEffect", { enumerable: true, get: function () { return types_1.createEffect; } });
|
|
@@ -37,6 +37,16 @@ Object.defineProperty(exports, "getCapableTraits", { enumerable: true, get: func
|
|
|
37
37
|
var entity_builder_1 = require("./entity-builder");
|
|
38
38
|
Object.defineProperty(exports, "EntityBuilder", { enumerable: true, get: function () { return entity_builder_1.EntityBuilder; } });
|
|
39
39
|
Object.defineProperty(exports, "buildEntity", { enumerable: true, get: function () { return entity_builder_1.buildEntity; } });
|
|
40
|
+
// ============================================================================
|
|
41
|
+
// Action Interceptors (ADR-118)
|
|
42
|
+
//
|
|
43
|
+
// Interceptors allow traits to hook into stdlib action phases without
|
|
44
|
+
// replacing standard logic. This complements capability behaviors which
|
|
45
|
+
// provide full delegation.
|
|
46
|
+
// ============================================================================
|
|
47
|
+
// Interceptor interface
|
|
48
|
+
var action_interceptor_1 = require("./action-interceptor");
|
|
49
|
+
Object.defineProperty(exports, "applyInterceptorReportResult", { enumerable: true, get: function () { return action_interceptor_1.applyInterceptorReportResult; } });
|
|
40
50
|
// Interceptor registry
|
|
41
51
|
var interceptor_registry_1 = require("./interceptor-registry");
|
|
42
52
|
Object.defineProperty(exports, "registerActionInterceptor", { enumerable: true, get: function () { return interceptor_registry_1.registerActionInterceptor; } });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/capabilities/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,QAAQ;AACR,iCAIiB;AADf,qGAAA,YAAY,OAAA;AAMd,WAAW;AACX,6DAU+B;AAP7B,iIAAA,0BAA0B,OAAA;AAC1B,+HAAA,wBAAwB,OAAA;AACxB,yHAAA,kBAAkB,OAAA;AAClB,4HAAA,qBAAqB,OAAA;AACrB,mIAAA,4BAA4B,OAAA;AAC5B,8HAAA,uBAAuB,OAAA;AACvB,+HAAA,wBAAwB,OAAA;AAG1B,6BAA6B;AAC7B,6DAS+B;AAL7B,+HAAA,wBAAwB,OAAA;AACxB,0HAAA,mBAAmB,OAAA;AACnB,4HAAA,qBAAqB,OAAA;AACrB,8HAAA,uBAAuB,OAAA;AACvB,+HAAA,wBAAwB,OAAA;AAG1B,UAAU;AACV,2DAM8B;AAL5B,6HAAA,uBAAuB,OAAA;AACvB,mHAAA,aAAa,OAAA;AACb,2HAAA,qBAAqB,OAAA;AACrB,wHAAA,kBAAkB,OAAA;AAClB,sHAAA,gBAAgB,OAAA;AAGlB,iBAAiB;AACjB,mDAG0B;AAFxB,+GAAA,aAAa,OAAA;AACb,6GAAA,WAAW,OAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../repos/sharpee/packages/world-model/src/capabilities/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,QAAQ;AACR,iCAIiB;AADf,qGAAA,YAAY,OAAA;AAMd,WAAW;AACX,6DAU+B;AAP7B,iIAAA,0BAA0B,OAAA;AAC1B,+HAAA,wBAAwB,OAAA;AACxB,yHAAA,kBAAkB,OAAA;AAClB,4HAAA,qBAAqB,OAAA;AACrB,mIAAA,4BAA4B,OAAA;AAC5B,8HAAA,uBAAuB,OAAA;AACvB,+HAAA,wBAAwB,OAAA;AAG1B,6BAA6B;AAC7B,6DAS+B;AAL7B,+HAAA,wBAAwB,OAAA;AACxB,0HAAA,mBAAmB,OAAA;AACnB,4HAAA,qBAAqB,OAAA;AACrB,8HAAA,uBAAuB,OAAA;AACvB,+HAAA,wBAAwB,OAAA;AAG1B,UAAU;AACV,2DAM8B;AAL5B,6HAAA,uBAAuB,OAAA;AACvB,mHAAA,aAAa,OAAA;AACb,2HAAA,qBAAqB,OAAA;AACrB,wHAAA,kBAAkB,OAAA;AAClB,sHAAA,gBAAgB,OAAA;AAGlB,iBAAiB;AACjB,mDAG0B;AAFxB,+GAAA,aAAa,OAAA;AACb,6GAAA,WAAW,OAAA;AAGb,+EAA+E;AAC/E,gCAAgC;AAChC,EAAE;AACF,sEAAsE;AACtE,wEAAwE;AACxE,2BAA2B;AAC3B,+EAA+E;AAE/E,wBAAwB;AACxB,2DAO8B;AAD5B,kIAAA,4BAA4B,OAAA;AAG9B,uBAAuB;AACvB,+DAWgC;AAP9B,iIAAA,yBAAyB,OAAA;AACzB,+HAAA,uBAAuB,OAAA;AACvB,6HAAA,qBAAqB,OAAA;AACrB,4HAAA,oBAAoB,OAAA;AACpB,mIAAA,2BAA2B,OAAA;AAC3B,gIAAA,wBAAwB,OAAA;AACxB,iIAAA,yBAAyB,OAAA;AAG3B,sBAAsB;AACtB,6DAM+B;AAL7B,+HAAA,wBAAwB,OAAA;AACxB,qHAAA,cAAc,OAAA;AACd,4HAAA,qBAAqB,OAAA;AACrB,0HAAA,mBAAmB,OAAA;AACnB,2HAAA,oBAAoB,OAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sharpee/world-model",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.113",
|
|
4
4
|
"description": "World model for Sharpee IF platform - entities, traits, and behaviors",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@sharpee/core": "^0.9.
|
|
16
|
-
"@sharpee/if-domain": "^0.9.
|
|
15
|
+
"@sharpee/core": "^0.9.113",
|
|
16
|
+
"@sharpee/if-domain": "^0.9.113"
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
19
19
|
"interactive-fiction",
|