@sharpee/stdlib 2.2.0 → 3.1.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/actions/base/snapshot-utils.js +2 -2
- package/actions/base/snapshot-utils.js.map +1 -1
- package/actions/constants.d.ts +2 -0
- package/actions/constants.d.ts.map +1 -1
- package/actions/constants.js +3 -0
- package/actions/constants.js.map +1 -1
- package/actions/index.d.ts +2 -0
- package/actions/index.d.ts.map +1 -1
- package/actions/index.js +6 -0
- package/actions/index.js.map +1 -1
- package/actions/lifecycle/descriptor.d.ts +111 -0
- package/actions/lifecycle/descriptor.d.ts.map +1 -0
- package/actions/lifecycle/descriptor.js +22 -0
- package/actions/lifecycle/descriptor.js.map +1 -0
- package/actions/lifecycle/index.d.ts +14 -0
- package/actions/lifecycle/index.d.ts.map +1 -0
- package/actions/lifecycle/index.js +27 -0
- package/actions/lifecycle/index.js.map +1 -0
- package/actions/lifecycle/lifecycle-engine.d.ts +173 -0
- package/actions/lifecycle/lifecycle-engine.d.ts.map +1 -0
- package/actions/lifecycle/lifecycle-engine.js +247 -0
- package/actions/lifecycle/lifecycle-engine.js.map +1 -0
- package/actions/lifecycle/multi-object-lifecycle.d.ts +105 -0
- package/actions/lifecycle/multi-object-lifecycle.d.ts.map +1 -0
- package/actions/lifecycle/multi-object-lifecycle.js +136 -0
- package/actions/lifecycle/multi-object-lifecycle.js.map +1 -0
- package/actions/lifecycle/registry.d.ts +39 -0
- package/actions/lifecycle/registry.d.ts.map +1 -0
- package/actions/lifecycle/registry.js +128 -0
- package/actions/lifecycle/registry.js.map +1 -0
- package/actions/standard/asking/asking.d.ts +25 -0
- package/actions/standard/asking/asking.d.ts.map +1 -0
- package/actions/standard/asking/asking.js +114 -0
- package/actions/standard/asking/asking.js.map +1 -0
- package/actions/standard/asking/index.d.ts +5 -0
- package/actions/standard/asking/index.d.ts.map +1 -0
- package/actions/standard/asking/index.js +10 -0
- package/actions/standard/asking/index.js.map +1 -0
- package/actions/standard/attacking/attacking.d.ts +14 -0
- package/actions/standard/attacking/attacking.d.ts.map +1 -1
- package/actions/standard/attacking/attacking.js +138 -94
- package/actions/standard/attacking/attacking.js.map +1 -1
- package/actions/standard/attacking/index.d.ts +1 -1
- package/actions/standard/attacking/index.d.ts.map +1 -1
- package/actions/standard/attacking/index.js +2 -1
- package/actions/standard/attacking/index.js.map +1 -1
- package/actions/standard/climbing/climbing.d.ts +10 -0
- package/actions/standard/climbing/climbing.d.ts.map +1 -1
- package/actions/standard/climbing/climbing.js +51 -11
- package/actions/standard/climbing/climbing.js.map +1 -1
- package/actions/standard/closing/closing.d.ts +6 -0
- package/actions/standard/closing/closing.d.ts.map +1 -1
- package/actions/standard/closing/closing.js +37 -31
- package/actions/standard/closing/closing.js.map +1 -1
- package/actions/standard/cutting/cutting-messages.d.ts +17 -0
- package/actions/standard/cutting/cutting-messages.d.ts.map +1 -0
- package/actions/standard/cutting/cutting-messages.js +22 -0
- package/actions/standard/cutting/cutting-messages.js.map +1 -0
- package/actions/standard/cutting/cutting.d.ts +35 -0
- package/actions/standard/cutting/cutting.d.ts.map +1 -0
- package/actions/standard/cutting/cutting.js +228 -0
- package/actions/standard/cutting/cutting.js.map +1 -0
- package/actions/standard/cutting/index.d.ts +7 -0
- package/actions/standard/cutting/index.d.ts.map +1 -0
- package/actions/standard/cutting/index.js +12 -0
- package/actions/standard/cutting/index.js.map +1 -0
- package/actions/standard/deadly-room-death/deadly-room-death.d.ts +16 -0
- package/actions/standard/deadly-room-death/deadly-room-death.d.ts.map +1 -0
- package/actions/standard/deadly-room-death/deadly-room-death.js +44 -0
- package/actions/standard/deadly-room-death/deadly-room-death.js.map +1 -0
- package/actions/standard/deadly-room-death/index.d.ts +2 -0
- package/actions/standard/deadly-room-death/index.d.ts.map +1 -0
- package/actions/standard/deadly-room-death/index.js +6 -0
- package/actions/standard/deadly-room-death/index.js.map +1 -0
- package/actions/standard/digging/digging-messages.d.ts +17 -0
- package/actions/standard/digging/digging-messages.d.ts.map +1 -0
- package/actions/standard/digging/digging-messages.js +22 -0
- package/actions/standard/digging/digging-messages.js.map +1 -0
- package/actions/standard/digging/digging.d.ts +35 -0
- package/actions/standard/digging/digging.d.ts.map +1 -0
- package/actions/standard/digging/digging.js +228 -0
- package/actions/standard/digging/digging.js.map +1 -0
- package/actions/standard/digging/index.d.ts +7 -0
- package/actions/standard/digging/index.d.ts.map +1 -0
- package/actions/standard/digging/index.js +12 -0
- package/actions/standard/digging/index.js.map +1 -0
- package/actions/standard/drinking/drinking.d.ts +9 -0
- package/actions/standard/drinking/drinking.d.ts.map +1 -1
- package/actions/standard/drinking/drinking.js +40 -2
- package/actions/standard/drinking/drinking.js.map +1 -1
- package/actions/standard/dropping/dropping-types.d.ts +10 -18
- package/actions/standard/dropping/dropping-types.d.ts.map +1 -1
- package/actions/standard/dropping/dropping-types.js.map +1 -1
- package/actions/standard/dropping/dropping.d.ts +6 -0
- package/actions/standard/dropping/dropping.d.ts.map +1 -1
- package/actions/standard/dropping/dropping.js +86 -108
- package/actions/standard/dropping/dropping.js.map +1 -1
- package/actions/standard/eating/eating.d.ts +9 -0
- package/actions/standard/eating/eating.d.ts.map +1 -1
- package/actions/standard/eating/eating.js +40 -2
- package/actions/standard/eating/eating.js.map +1 -1
- package/actions/standard/entering/entering.d.ts +14 -5
- package/actions/standard/entering/entering.d.ts.map +1 -1
- package/actions/standard/entering/entering.js +45 -67
- package/actions/standard/entering/entering.js.map +1 -1
- package/actions/standard/examining/examining.d.ts +6 -0
- package/actions/standard/examining/examining.d.ts.map +1 -1
- package/actions/standard/examining/examining.js +39 -3
- package/actions/standard/examining/examining.js.map +1 -1
- package/actions/standard/exiting/exiting.d.ts +6 -0
- package/actions/standard/exiting/exiting.d.ts.map +1 -1
- package/actions/standard/exiting/exiting.js +54 -3
- package/actions/standard/exiting/exiting.js.map +1 -1
- package/actions/standard/giving/giving.d.ts +21 -0
- package/actions/standard/giving/giving.d.ts.map +1 -1
- package/actions/standard/giving/giving.js +78 -2
- package/actions/standard/giving/giving.js.map +1 -1
- package/actions/standard/going/going.d.ts +10 -16
- package/actions/standard/going/going.d.ts.map +1 -1
- package/actions/standard/going/going.js +134 -140
- package/actions/standard/going/going.js.map +1 -1
- package/actions/standard/hiding/hiding.d.ts +10 -1
- package/actions/standard/hiding/hiding.d.ts.map +1 -1
- package/actions/standard/hiding/hiding.js +43 -4
- package/actions/standard/hiding/hiding.js.map +1 -1
- package/actions/standard/index.d.ts +5 -0
- package/actions/standard/index.d.ts.map +1 -1
- package/actions/standard/index.js +19 -4
- package/actions/standard/index.js.map +1 -1
- package/actions/standard/inserting/inserting.d.ts +12 -0
- package/actions/standard/inserting/inserting.d.ts.map +1 -1
- package/actions/standard/inserting/inserting.js +70 -5
- package/actions/standard/inserting/inserting.js.map +1 -1
- package/actions/standard/listening/listening.d.ts +12 -1
- package/actions/standard/listening/listening.d.ts.map +1 -1
- package/actions/standard/listening/listening.js +45 -4
- package/actions/standard/listening/listening.js.map +1 -1
- package/actions/standard/locking/locking.d.ts +9 -0
- package/actions/standard/locking/locking.d.ts.map +1 -1
- package/actions/standard/locking/locking.js +62 -3
- package/actions/standard/locking/locking.js.map +1 -1
- package/actions/standard/looking/index.d.ts +1 -0
- package/actions/standard/looking/index.d.ts.map +1 -1
- package/actions/standard/looking/index.js +5 -1
- package/actions/standard/looking/index.js.map +1 -1
- package/actions/standard/looking/snippet-gate-registry.d.ts +55 -0
- package/actions/standard/looking/snippet-gate-registry.d.ts.map +1 -0
- package/actions/standard/looking/snippet-gate-registry.js +63 -0
- package/actions/standard/looking/snippet-gate-registry.js.map +1 -0
- package/actions/standard/looking/snippet-resolver.d.ts +9 -3
- package/actions/standard/looking/snippet-resolver.d.ts.map +1 -1
- package/actions/standard/looking/snippet-resolver.js +75 -4
- package/actions/standard/looking/snippet-resolver.js.map +1 -1
- package/actions/standard/opening/opening-messages.d.ts +3 -0
- package/actions/standard/opening/opening-messages.d.ts.map +1 -1
- package/actions/standard/opening/opening-messages.js +4 -0
- package/actions/standard/opening/opening-messages.js.map +1 -1
- package/actions/standard/opening/opening.d.ts +8 -0
- package/actions/standard/opening/opening.d.ts.map +1 -1
- package/actions/standard/opening/opening.js +73 -39
- package/actions/standard/opening/opening.js.map +1 -1
- package/actions/standard/pulling/pulling.d.ts +9 -0
- package/actions/standard/pulling/pulling.d.ts.map +1 -1
- package/actions/standard/pulling/pulling.js +40 -2
- package/actions/standard/pulling/pulling.js.map +1 -1
- package/actions/standard/pushing/pushing-types.d.ts +3 -6
- package/actions/standard/pushing/pushing-types.d.ts.map +1 -1
- package/actions/standard/pushing/pushing-types.js +3 -1
- package/actions/standard/pushing/pushing-types.js.map +1 -1
- package/actions/standard/pushing/pushing.d.ts +14 -5
- package/actions/standard/pushing/pushing.d.ts.map +1 -1
- package/actions/standard/pushing/pushing.js +51 -71
- package/actions/standard/pushing/pushing.js.map +1 -1
- package/actions/standard/putting/putting-types.d.ts +10 -21
- package/actions/standard/putting/putting-types.d.ts.map +1 -1
- package/actions/standard/putting/putting-types.js +0 -1
- package/actions/standard/putting/putting-types.js.map +1 -1
- package/actions/standard/putting/putting.d.ts +10 -0
- package/actions/standard/putting/putting.d.ts.map +1 -1
- package/actions/standard/putting/putting.js +133 -151
- package/actions/standard/putting/putting.js.map +1 -1
- package/actions/standard/reading/reading.d.ts +6 -0
- package/actions/standard/reading/reading.d.ts.map +1 -1
- package/actions/standard/reading/reading.js +39 -3
- package/actions/standard/reading/reading.js.map +1 -1
- package/actions/standard/removing/removing-types.d.ts +10 -16
- package/actions/standard/removing/removing-types.d.ts.map +1 -1
- package/actions/standard/removing/removing-types.js.map +1 -1
- package/actions/standard/removing/removing.d.ts +13 -0
- package/actions/standard/removing/removing.d.ts.map +1 -1
- package/actions/standard/removing/removing.js +147 -88
- package/actions/standard/removing/removing.js.map +1 -1
- package/actions/standard/searching/searching.d.ts +10 -0
- package/actions/standard/searching/searching.d.ts.map +1 -1
- package/actions/standard/searching/searching.js +44 -8
- package/actions/standard/searching/searching.js.map +1 -1
- package/actions/standard/showing/showing.d.ts +14 -0
- package/actions/standard/showing/showing.d.ts.map +1 -1
- package/actions/standard/showing/showing.js +62 -2
- package/actions/standard/showing/showing.js.map +1 -1
- package/actions/standard/smelling/smelling.d.ts +10 -0
- package/actions/standard/smelling/smelling.d.ts.map +1 -1
- package/actions/standard/smelling/smelling.js +41 -2
- package/actions/standard/smelling/smelling.js.map +1 -1
- package/actions/standard/switching_off/switching_off.d.ts +11 -1
- package/actions/standard/switching_off/switching_off.d.ts.map +1 -1
- package/actions/standard/switching_off/switching_off.js +44 -4
- package/actions/standard/switching_off/switching_off.js.map +1 -1
- package/actions/standard/switching_on/switching_on.d.ts +14 -5
- package/actions/standard/switching_on/switching_on.d.ts.map +1 -1
- package/actions/standard/switching_on/switching_on.js +45 -57
- package/actions/standard/switching_on/switching_on.js.map +1 -1
- package/actions/standard/taking/taking-types.d.ts +14 -32
- package/actions/standard/taking/taking-types.d.ts.map +1 -1
- package/actions/standard/taking/taking-types.js.map +1 -1
- package/actions/standard/taking/taking.d.ts +11 -0
- package/actions/standard/taking/taking.d.ts.map +1 -1
- package/actions/standard/taking/taking.js +107 -111
- package/actions/standard/taking/taking.js.map +1 -1
- package/actions/standard/taking_off/taking-off.d.ts +6 -0
- package/actions/standard/taking_off/taking-off.d.ts.map +1 -1
- package/actions/standard/taking_off/taking-off.js +57 -21
- package/actions/standard/taking_off/taking-off.js.map +1 -1
- package/actions/standard/talking/talking.d.ts +15 -0
- package/actions/standard/talking/talking.d.ts.map +1 -1
- package/actions/standard/talking/talking.js +52 -3
- package/actions/standard/talking/talking.js.map +1 -1
- package/actions/standard/telling/index.d.ts +5 -0
- package/actions/standard/telling/index.d.ts.map +1 -0
- package/actions/standard/telling/index.js +10 -0
- package/actions/standard/telling/index.js.map +1 -0
- package/actions/standard/telling/telling.d.ts +25 -0
- package/actions/standard/telling/telling.d.ts.map +1 -0
- package/actions/standard/telling/telling.js +114 -0
- package/actions/standard/telling/telling.js.map +1 -0
- package/actions/standard/throwing/throwing.d.ts +11 -0
- package/actions/standard/throwing/throwing.d.ts.map +1 -1
- package/actions/standard/throwing/throwing.js +69 -70
- package/actions/standard/throwing/throwing.js.map +1 -1
- package/actions/standard/tool-shared.d.ts +38 -0
- package/actions/standard/tool-shared.d.ts.map +1 -0
- package/actions/standard/tool-shared.js +74 -0
- package/actions/standard/tool-shared.js.map +1 -0
- package/actions/standard/touching/touching.d.ts +9 -0
- package/actions/standard/touching/touching.d.ts.map +1 -1
- package/actions/standard/touching/touching.js +40 -4
- package/actions/standard/touching/touching.js.map +1 -1
- package/actions/standard/turning/index.d.ts +5 -0
- package/actions/standard/turning/index.d.ts.map +1 -0
- package/actions/standard/turning/index.js +9 -0
- package/actions/standard/turning/index.js.map +1 -0
- package/actions/standard/turning/turning.d.ts +17 -0
- package/actions/standard/turning/turning.d.ts.map +1 -0
- package/actions/standard/turning/turning.js +25 -0
- package/actions/standard/turning/turning.js.map +1 -0
- package/actions/standard/unlocking/unlocking.d.ts +9 -0
- package/actions/standard/unlocking/unlocking.d.ts.map +1 -1
- package/actions/standard/unlocking/unlocking.js +62 -3
- package/actions/standard/unlocking/unlocking.js.map +1 -1
- package/actions/standard/wearing/wearing.d.ts +11 -1
- package/actions/standard/wearing/wearing.d.ts.map +1 -1
- package/actions/standard/wearing/wearing.js +57 -12
- package/actions/standard/wearing/wearing.js.map +1 -1
- package/channels/standard.d.ts +13 -10
- package/channels/standard.d.ts.map +1 -1
- package/channels/standard.js +14 -10
- package/channels/standard.js.map +1 -1
- package/death/deadly-room-transformer.d.ts +37 -0
- package/death/deadly-room-transformer.d.ts.map +1 -0
- package/death/deadly-room-transformer.js +79 -0
- package/death/deadly-room-transformer.js.map +1 -0
- package/death/index.d.ts +18 -0
- package/death/index.d.ts.map +1 -0
- package/death/index.js +28 -0
- package/death/index.js.map +1 -0
- package/death/kill-player.d.ts +49 -0
- package/death/kill-player.d.ts.map +1 -0
- package/death/kill-player.js +55 -0
- package/death/kill-player.js.map +1 -0
- package/death/player-death-events.d.ts +40 -0
- package/death/player-death-events.d.ts.map +1 -0
- package/death/player-death-events.js +27 -0
- package/death/player-death-events.js.map +1 -0
- package/death/probabilistic-death.d.ts +23 -0
- package/death/probabilistic-death.d.ts.map +1 -0
- package/death/probabilistic-death.js +27 -0
- package/death/probabilistic-death.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.d.ts.map +1 -1
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/npc/behaviors.d.ts.map +1 -1
- package/npc/behaviors.js +9 -8
- package/npc/behaviors.js.map +1 -1
- package/npc/npc-service.d.ts +8 -0
- package/npc/npc-service.d.ts.map +1 -1
- package/npc/npc-service.js +19 -18
- package/npc/npc-service.js.map +1 -1
- package/package.json +7 -7
|
@@ -10,13 +10,60 @@
|
|
|
10
10
|
* 2. execute: Transfer item, store result in sharedData
|
|
11
11
|
* 3. blocked: Generate events when validation fails
|
|
12
12
|
* 4. report: Generate success events from sharedData
|
|
13
|
+
*
|
|
14
|
+
* Interceptor consultation (ADR-118) runs through the shared lifecycle
|
|
15
|
+
* engine (ADR-228) via `givingLifecycle` — no hand-rolled hook plumbing.
|
|
13
16
|
*/
|
|
14
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.givingAction = void 0;
|
|
18
|
+
exports.givingAction = exports.givingLifecycle = void 0;
|
|
16
19
|
const types_1 = require("../../../scope/types");
|
|
17
20
|
const world_model_1 = require("@sharpee/world-model");
|
|
18
21
|
const constants_1 = require("../../constants");
|
|
19
22
|
const utils_1 = require("../../../utils");
|
|
23
|
+
const lifecycle_1 = require("../../lifecycle");
|
|
24
|
+
/**
|
|
25
|
+
* Interceptor surface (ADR-228): BOTH the given item and the recipient
|
|
26
|
+
* are consulted (D3-B published order: direct object first), each side's
|
|
27
|
+
* sharedData seeded with the other entity's identity (D3 sub-ruling —
|
|
28
|
+
* symmetric context, same shape as putting's descriptor).
|
|
29
|
+
*
|
|
30
|
+
* Item-side limitation (ADR-118 hook audit): before this wiring the item
|
|
31
|
+
* side was fully dead — no validate-phase block was possible; giving's
|
|
32
|
+
* only story seam was the recipient's execute-phase-only ADR-090
|
|
33
|
+
* capability behavior (see execute() below). The item slot is declared
|
|
34
|
+
* anyway per the Phase-5 ruling — documenting the limitation beats
|
|
35
|
+
* silently omitting the slot. Note also: when an ADR-090 capability
|
|
36
|
+
* behavior handles the give, report() is delegated to it and no
|
|
37
|
+
* `if.event.given` primary event exists for a postReport override to
|
|
38
|
+
* target (the engine's defensive warn fires instead; `emit` still works).
|
|
39
|
+
*/
|
|
40
|
+
exports.givingLifecycle = {
|
|
41
|
+
actionId: constants_1.IFActions.GIVING,
|
|
42
|
+
slots: [
|
|
43
|
+
{
|
|
44
|
+
id: 'item',
|
|
45
|
+
actionIds: [constants_1.IFActions.GIVING],
|
|
46
|
+
resolve: (ctx) => ctx.command.directObject?.entity,
|
|
47
|
+
seedData: (ctx, entity) => ({
|
|
48
|
+
itemId: entity.id,
|
|
49
|
+
itemName: entity.name,
|
|
50
|
+
recipientId: ctx.command.indirectObject?.entity?.id,
|
|
51
|
+
recipientName: ctx.command.indirectObject?.entity?.name
|
|
52
|
+
})
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'recipient',
|
|
56
|
+
actionIds: [constants_1.IFActions.GIVING],
|
|
57
|
+
resolve: (ctx) => ctx.command.indirectObject?.entity,
|
|
58
|
+
seedData: (ctx, entity) => ({
|
|
59
|
+
itemId: ctx.command.directObject?.entity?.id,
|
|
60
|
+
itemName: ctx.command.directObject?.entity?.name,
|
|
61
|
+
recipientId: entity.id,
|
|
62
|
+
recipientName: entity.name
|
|
63
|
+
})
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
};
|
|
20
67
|
function getGivingSharedData(context) {
|
|
21
68
|
return context.sharedData;
|
|
22
69
|
}
|
|
@@ -72,6 +119,10 @@ exports.givingAction = {
|
|
|
72
119
|
params: {}
|
|
73
120
|
};
|
|
74
121
|
}
|
|
122
|
+
const state = (0, lifecycle_1.resolveLifecycle)(context, exports.givingLifecycle);
|
|
123
|
+
const preVeto = (0, lifecycle_1.runPreValidate)(context, state);
|
|
124
|
+
if (preVeto)
|
|
125
|
+
return preVeto;
|
|
75
126
|
// Item must be carried (or implicitly takeable)
|
|
76
127
|
// This enables "give apple to bob" when apple is on the ground
|
|
77
128
|
const carryCheck = context.requireCarriedOrImplicitTake(item);
|
|
@@ -140,6 +191,10 @@ exports.givingAction = {
|
|
|
140
191
|
}
|
|
141
192
|
}
|
|
142
193
|
}
|
|
194
|
+
// Canonical placement (ADR-228): postValidate runs after ALL standard validation
|
|
195
|
+
const postVeto = (0, lifecycle_1.runPostValidate)(context, state);
|
|
196
|
+
if (postVeto)
|
|
197
|
+
return postVeto;
|
|
143
198
|
return { valid: true };
|
|
144
199
|
},
|
|
145
200
|
execute(context) {
|
|
@@ -159,6 +214,10 @@ exports.givingAction = {
|
|
|
159
214
|
sharedData.capabilityBehavior = behavior;
|
|
160
215
|
sharedData.capabilityTrait = capTrait;
|
|
161
216
|
behavior.execute(recipient, context.world, context.player.id, context.sharedData);
|
|
217
|
+
// Interceptor hooks still run after a capability-handled give (ADR-228 D3)
|
|
218
|
+
const capState = (0, lifecycle_1.getLifecycleState)(context);
|
|
219
|
+
if (capState)
|
|
220
|
+
(0, lifecycle_1.runPostExecute)(context, capState);
|
|
162
221
|
return;
|
|
163
222
|
}
|
|
164
223
|
}
|
|
@@ -204,11 +263,14 @@ exports.givingAction = {
|
|
|
204
263
|
item: (0, utils_1.nounPhraseFor)(item),
|
|
205
264
|
recipient: (0, utils_1.nounPhraseFor)(recipient)
|
|
206
265
|
};
|
|
266
|
+
const state = (0, lifecycle_1.getLifecycleState)(context);
|
|
267
|
+
if (state)
|
|
268
|
+
(0, lifecycle_1.runPostExecute)(context, state);
|
|
207
269
|
},
|
|
208
270
|
blocked(context, result) {
|
|
209
271
|
const item = context.command.directObject?.entity;
|
|
210
272
|
const recipient = context.command.indirectObject?.entity;
|
|
211
|
-
|
|
273
|
+
const events = [context.event('if.event.give_blocked', {
|
|
212
274
|
blocked: true,
|
|
213
275
|
messageId: `${context.action.id}.${result.error}`,
|
|
214
276
|
// params carry EntityInfo for the formatter chain (ADR-158)
|
|
@@ -223,6 +285,12 @@ exports.givingAction = {
|
|
|
223
285
|
recipientId: recipient?.id,
|
|
224
286
|
recipientName: recipient?.name
|
|
225
287
|
})];
|
|
288
|
+
if (result.error) {
|
|
289
|
+
const state = (0, lifecycle_1.getLifecycleState)(context);
|
|
290
|
+
if (state)
|
|
291
|
+
(0, lifecycle_1.runOnBlocked)(context, state, events, 'if.event.give_blocked', result.error);
|
|
292
|
+
}
|
|
293
|
+
return events;
|
|
226
294
|
},
|
|
227
295
|
report(context) {
|
|
228
296
|
const sharedData = getGivingSharedData(context);
|
|
@@ -238,6 +306,11 @@ exports.givingAction = {
|
|
|
238
306
|
const effects = sharedData.capabilityBehavior.report(recipient, context.world, context.player.id, context.sharedData);
|
|
239
307
|
events.push(...effectsToEvents(effects, context));
|
|
240
308
|
}
|
|
309
|
+
// Interceptor hooks still run (ADR-228 D3); note there is no
|
|
310
|
+
// `if.event.given` on this path for an override to target.
|
|
311
|
+
const capState = (0, lifecycle_1.getLifecycleState)(context);
|
|
312
|
+
if (capState)
|
|
313
|
+
(0, lifecycle_1.runPostReport)(context, capState, events, 'if.event.given');
|
|
241
314
|
return events;
|
|
242
315
|
}
|
|
243
316
|
// Standard: emit given event with messageId for text rendering
|
|
@@ -250,6 +323,9 @@ exports.givingAction = {
|
|
|
250
323
|
recipientName: sharedData.recipientName,
|
|
251
324
|
accepted: true
|
|
252
325
|
}));
|
|
326
|
+
const state = (0, lifecycle_1.getLifecycleState)(context);
|
|
327
|
+
if (state)
|
|
328
|
+
(0, lifecycle_1.runPostReport)(context, state, events, 'if.event.given');
|
|
253
329
|
return events;
|
|
254
330
|
},
|
|
255
331
|
group: "social"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"giving.js","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/giving/giving.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"giving.js","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/giving/giving.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH,gDAAkD;AAElD,sDAQ8B;AAC9B,+CAA4C;AAE5C,0CAA+C;AAC/C,+CASyB;AAEzB;;;;;;;;;;;;;;;GAeG;AACU,QAAA,eAAe,GAA8B;IACxD,QAAQ,EAAE,qBAAS,CAAC,MAAM;IAC1B,KAAK,EAAE;QACL;YACE,EAAE,EAAE,MAAM;YACV,SAAS,EAAE,CAAC,qBAAS,CAAC,MAAM,CAAC;YAC7B,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM;YAClD,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;gBAC1B,MAAM,EAAE,MAAM,CAAC,EAAE;gBACjB,QAAQ,EAAE,MAAM,CAAC,IAAI;gBACrB,WAAW,EAAE,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,EAAE;gBACnD,aAAa,EAAE,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI;aACxD,CAAC;SACH;QACD;YACE,EAAE,EAAE,WAAW;YACf,SAAS,EAAE,CAAC,qBAAS,CAAC,MAAM,CAAC;YAC7B,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM;YACpD,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;gBAC1B,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM,EAAE,EAAE;gBAC5C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EAAE,UAAU,CAAC,QAAQ;YAC7B,SAAS,EAAE,UAAU,CAAC,WAAW;YACjC,aAAa,EAAE,UAAU,CAAC,aAAa;YACvC,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC,CAAC;QAEJ,MAAM,KAAK,GAAG,IAAA,6BAAiB,EAAC,OAAO,CAAC,CAAC;QACzC,IAAI,KAAK;YAAE,IAAA,yBAAa,EAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,gBAAgB,CAAC,CAAC;QAEnE,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,EAAE,QAAQ;CAChB,CAAC"}
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
* 4. report: standard events → postReport hook (additional effects)
|
|
12
12
|
*/
|
|
13
13
|
import { Action, ActionContext } from '../../enhanced-types';
|
|
14
|
-
import {
|
|
14
|
+
import { DirectionType, RegionCrossings } from '@sharpee/world-model';
|
|
15
15
|
import { ActionMetadata } from '../../../validation';
|
|
16
|
+
import { ActionLifecycleDescriptor } from '../../lifecycle';
|
|
16
17
|
/**
|
|
17
18
|
* Shared data passed between execute and report phases.
|
|
18
|
-
* Now includes interceptor data for ADR-118 support.
|
|
19
19
|
*/
|
|
20
20
|
export interface GoingSharedData {
|
|
21
21
|
isFirstVisit?: boolean;
|
|
@@ -23,24 +23,18 @@ export interface GoingSharedData {
|
|
|
23
23
|
currentLocation?: string;
|
|
24
24
|
direction?: DirectionType;
|
|
25
25
|
vehicleId?: string;
|
|
26
|
-
/** Source room interceptor found during validate (ADR-118) */
|
|
27
|
-
interceptor?: ActionInterceptor;
|
|
28
|
-
/** Shared data for source interceptor phases */
|
|
29
|
-
interceptorData?: InterceptorSharedData;
|
|
30
|
-
/** Source room entity for interceptor lookups */
|
|
31
|
-
sourceRoom?: IFEntity;
|
|
32
|
-
/** Destination room interceptor found during validate (ADR-126) */
|
|
33
|
-
destinationInterceptor?: ActionInterceptor;
|
|
34
|
-
/** Shared data for destination interceptor phases */
|
|
35
|
-
destinationInterceptorData?: InterceptorSharedData;
|
|
36
|
-
/** Destination room entity for interceptor lookups */
|
|
37
|
-
destinationRoom?: IFEntity;
|
|
38
|
-
/** Which interceptor blocked the action, if any */
|
|
39
|
-
blockedBy?: 'source' | 'destination';
|
|
40
26
|
/** Region boundary crossings computed during execute (ADR-149) */
|
|
41
27
|
regionCrossings?: RegionCrossings;
|
|
42
28
|
}
|
|
43
29
|
export declare function getGoingSharedData(context: ActionContext): GoingSharedData;
|
|
30
|
+
/**
|
|
31
|
+
* Interceptor surface (ADR-228): all three implicit entities of a GO
|
|
32
|
+
* command are consulted, in this published order — source room
|
|
33
|
+
* (if.action.going), destination room (if.action.entering_room, ADR-126),
|
|
34
|
+
* door (if.action.going; the previously-dead surface the audit found).
|
|
35
|
+
* First veto wins across the chain.
|
|
36
|
+
*/
|
|
37
|
+
export declare const goingLifecycle: ActionLifecycleDescriptor;
|
|
44
38
|
export declare const goingAction: Action & {
|
|
45
39
|
metadata: ActionMetadata;
|
|
46
40
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"going.d.ts","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/going/going.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,MAAM,EAAE,aAAa,EAAoB,MAAM,sBAAsB,CAAC;AAE/E,OAAO,
|
|
1
|
+
{"version":3,"file":"going.d.ts","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/going/going.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,MAAM,EAAE,aAAa,EAAoB,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAUL,aAAa,EAEb,eAAe,EAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAMrD,OAAO,EACL,yBAAyB,EAQ1B,MAAM,iBAAiB,CAAC;AAWzB;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,kEAAkE;IAClE,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,aAAa,GAAG,eAAe,CAE1E;AAiDD;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,EAAE,yBA8B5B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,cAAc,CAAA;CA0Y5D,CAAC"}
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* 4. report: standard events → postReport hook (additional effects)
|
|
13
13
|
*/
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.goingAction = void 0;
|
|
15
|
+
exports.goingAction = exports.goingLifecycle = void 0;
|
|
16
16
|
exports.getGoingSharedData = getGoingSharedData;
|
|
17
17
|
const world_model_1 = require("@sharpee/world-model");
|
|
18
18
|
const constants_1 = require("../../constants");
|
|
@@ -21,11 +21,96 @@ const snapshot_utils_1 = require("../../base/snapshot-utils");
|
|
|
21
21
|
const data_builder_types_1 = require("../../data-builder-types");
|
|
22
22
|
const going_messages_1 = require("./going-messages");
|
|
23
23
|
const utils_1 = require("../../../utils");
|
|
24
|
+
const lifecycle_1 = require("../../lifecycle");
|
|
24
25
|
// Import our data builders
|
|
25
26
|
const going_data_1 = require("./going-data");
|
|
26
27
|
function getGoingSharedData(context) {
|
|
27
28
|
return context.sharedData;
|
|
28
29
|
}
|
|
30
|
+
// ============================================================================
|
|
31
|
+
// Implicit-entity resolvers (ADR-228 D3) — going has no parsed object
|
|
32
|
+
// slots; its consultable entities are derived from the command + world.
|
|
33
|
+
// Resolution is read-only and returns undefined when the entity does not
|
|
34
|
+
// apply (no exit, blocked-only direction, not in a room).
|
|
35
|
+
// ============================================================================
|
|
36
|
+
/** The direction of travel, from extras or a direction-named direct object. */
|
|
37
|
+
function resolveDirection(context) {
|
|
38
|
+
let direction = context.command.parsed.extras?.direction;
|
|
39
|
+
if (!direction && context.command.directObject?.entity) {
|
|
40
|
+
const entityName = context.command.directObject.entity.name ||
|
|
41
|
+
context.command.directObject.entity.attributes?.name;
|
|
42
|
+
if (entityName) {
|
|
43
|
+
direction = entityName;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return direction || undefined;
|
|
47
|
+
}
|
|
48
|
+
/** The room movement starts from (the containing room when in a walkable vehicle). */
|
|
49
|
+
function resolveSourceRoom(context) {
|
|
50
|
+
const walkCheck = (0, world_model_1.canActorWalkInVehicle)(context.world, context.player.id);
|
|
51
|
+
let currentRoom = context.currentLocation;
|
|
52
|
+
if (walkCheck.vehicle && walkCheck.canWalk) {
|
|
53
|
+
const containingRoom = context.world.getContainingRoom(context.player.id);
|
|
54
|
+
if (containingRoom) {
|
|
55
|
+
currentRoom = containingRoom;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return currentRoom?.has(world_model_1.TraitType.ROOM) ? currentRoom : undefined;
|
|
59
|
+
}
|
|
60
|
+
/** The exit's door (via) and destination room, when the exit exists. */
|
|
61
|
+
function resolveExitEntities(context) {
|
|
62
|
+
const sourceRoom = resolveSourceRoom(context);
|
|
63
|
+
const direction = resolveDirection(context);
|
|
64
|
+
if (!sourceRoom || !direction)
|
|
65
|
+
return {};
|
|
66
|
+
// A blocked-only direction has no traversable exit (Chord `north is blocked:`)
|
|
67
|
+
if (world_model_1.RoomBehavior.isExitBlocked(sourceRoom, direction))
|
|
68
|
+
return {};
|
|
69
|
+
const exitConfig = world_model_1.RoomBehavior.getExit(sourceRoom, direction);
|
|
70
|
+
if (!exitConfig)
|
|
71
|
+
return {};
|
|
72
|
+
const door = exitConfig.via ? (context.world.getEntity(exitConfig.via) ?? undefined) : undefined;
|
|
73
|
+
const destination = context.world.getEntity(exitConfig.destination) ?? undefined;
|
|
74
|
+
return { door, destination };
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Interceptor surface (ADR-228): all three implicit entities of a GO
|
|
78
|
+
* command are consulted, in this published order — source room
|
|
79
|
+
* (if.action.going), destination room (if.action.entering_room, ADR-126),
|
|
80
|
+
* door (if.action.going; the previously-dead surface the audit found).
|
|
81
|
+
* First veto wins across the chain.
|
|
82
|
+
*/
|
|
83
|
+
exports.goingLifecycle = {
|
|
84
|
+
actionId: constants_1.IFActions.GOING,
|
|
85
|
+
slots: [
|
|
86
|
+
{
|
|
87
|
+
id: 'source',
|
|
88
|
+
actionIds: [constants_1.IFActions.GOING],
|
|
89
|
+
resolve: resolveSourceRoom,
|
|
90
|
+
seedData: (ctx) => ({ direction: resolveDirection(ctx) })
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
id: 'destination',
|
|
94
|
+
actionIds: [constants_1.IFActions.ENTERING_ROOM],
|
|
95
|
+
resolve: (ctx) => resolveExitEntities(ctx).destination,
|
|
96
|
+
seedData: (ctx, entity) => ({
|
|
97
|
+
direction: resolveDirection(ctx),
|
|
98
|
+
sourceRoomId: resolveSourceRoom(ctx)?.id,
|
|
99
|
+
destinationRoomId: entity.id
|
|
100
|
+
})
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: 'door',
|
|
104
|
+
actionIds: [constants_1.IFActions.GOING],
|
|
105
|
+
resolve: (ctx) => resolveExitEntities(ctx).door,
|
|
106
|
+
seedData: (ctx) => ({
|
|
107
|
+
direction: resolveDirection(ctx),
|
|
108
|
+
sourceRoomId: resolveSourceRoom(ctx)?.id,
|
|
109
|
+
destinationRoomId: resolveExitEntities(ctx).destination?.id
|
|
110
|
+
})
|
|
111
|
+
}
|
|
112
|
+
]
|
|
113
|
+
};
|
|
29
114
|
exports.goingAction = {
|
|
30
115
|
id: constants_1.IFActions.GOING,
|
|
31
116
|
requiredMessages: [
|
|
@@ -91,30 +176,24 @@ exports.goingAction = {
|
|
|
91
176
|
error: going_messages_1.GoingMessages.NOT_IN_ROOM
|
|
92
177
|
};
|
|
93
178
|
}
|
|
94
|
-
//
|
|
95
|
-
//
|
|
96
|
-
const
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
//
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return {
|
|
113
|
-
valid: result.valid,
|
|
114
|
-
error: result.error,
|
|
115
|
-
params: result.params
|
|
116
|
-
};
|
|
117
|
-
}
|
|
179
|
+
// Resolve the interceptor surface (ADR-228): source room, destination
|
|
180
|
+
// room, and door — the engine owns hook order and veto semantics.
|
|
181
|
+
const state = (0, lifecycle_1.resolveLifecycle)(context, exports.goingLifecycle);
|
|
182
|
+
const preVeto = (0, lifecycle_1.runPreValidate)(context, state);
|
|
183
|
+
if (preVeto)
|
|
184
|
+
return preVeto;
|
|
185
|
+
// Check if the direction is blocked BEFORE requiring an exit config:
|
|
186
|
+
// a blockedExits entry means "this direction is deliberately refused
|
|
187
|
+
// with this message" whether or not an exit exists (a blocked-only
|
|
188
|
+
// direction has no destination — e.g. Chord's `north is blocked:`,
|
|
189
|
+
// ADR-210).
|
|
190
|
+
if (world_model_1.RoomBehavior.isExitBlocked(currentRoom, direction)) {
|
|
191
|
+
const blockedMessage = world_model_1.RoomBehavior.getBlockedMessage(currentRoom, direction) || "You can't go that way.";
|
|
192
|
+
return {
|
|
193
|
+
valid: false,
|
|
194
|
+
error: going_messages_1.GoingMessages.MOVEMENT_BLOCKED,
|
|
195
|
+
params: { direction: direction, message: blockedMessage }
|
|
196
|
+
};
|
|
118
197
|
}
|
|
119
198
|
// Use RoomBehavior to get exit information
|
|
120
199
|
const exitConfig = world_model_1.RoomBehavior.getExit(currentRoom, direction);
|
|
@@ -133,15 +212,6 @@ exports.goingAction = {
|
|
|
133
212
|
params: { direction: direction }
|
|
134
213
|
};
|
|
135
214
|
}
|
|
136
|
-
// Check if exit is blocked
|
|
137
|
-
if (world_model_1.RoomBehavior.isExitBlocked(currentRoom, direction)) {
|
|
138
|
-
const blockedMessage = world_model_1.RoomBehavior.getBlockedMessage(currentRoom, direction) || "You can't go that way.";
|
|
139
|
-
return {
|
|
140
|
-
valid: false,
|
|
141
|
-
error: going_messages_1.GoingMessages.MOVEMENT_BLOCKED,
|
|
142
|
-
params: { direction: direction, message: blockedMessage }
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
215
|
// Check if there's a door/portal
|
|
146
216
|
if (exitConfig.via) {
|
|
147
217
|
const door = context.world.getEntity(exitConfig.via);
|
|
@@ -184,57 +254,12 @@ exports.goingAction = {
|
|
|
184
254
|
// Note: We allow entry to dark rooms - you just can't see.
|
|
185
255
|
// Darkness affects visibility (looking), not movement.
|
|
186
256
|
// This matches traditional IF behavior (e.g., Cloak of Darkness).
|
|
187
|
-
//
|
|
188
|
-
//
|
|
189
|
-
|
|
190
|
-
const
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
sourceRoomId: currentRoom.id,
|
|
194
|
-
destinationRoomId: destination.id
|
|
195
|
-
};
|
|
196
|
-
// Store for later phases
|
|
197
|
-
sharedData.destinationInterceptor = destInterceptor;
|
|
198
|
-
sharedData.destinationInterceptorData = destInterceptorData;
|
|
199
|
-
sharedData.destinationRoom = destination;
|
|
200
|
-
// === DESTINATION PRE-VALIDATE HOOK (ADR-126) ===
|
|
201
|
-
// Called after destination is resolved but before player moves - can block entry
|
|
202
|
-
if (destInterceptor?.preValidate) {
|
|
203
|
-
const result = destInterceptor.preValidate(destination, context.world, actor.id, destInterceptorData);
|
|
204
|
-
if (result !== null && !result.valid) {
|
|
205
|
-
sharedData.blockedBy = 'destination';
|
|
206
|
-
return {
|
|
207
|
-
valid: result.valid,
|
|
208
|
-
error: result.error,
|
|
209
|
-
params: result.params
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
// === SOURCE POST-VALIDATE HOOK ===
|
|
214
|
-
// Called after standard validation passes - can add entity-specific conditions
|
|
215
|
-
if (interceptor?.postValidate) {
|
|
216
|
-
const result = interceptor.postValidate(currentRoom, context.world, actor.id, interceptorData);
|
|
217
|
-
if (result !== null) {
|
|
218
|
-
sharedData.blockedBy = 'source';
|
|
219
|
-
return {
|
|
220
|
-
valid: result.valid,
|
|
221
|
-
error: result.error,
|
|
222
|
-
params: result.params
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
// === DESTINATION POST-VALIDATE HOOK (ADR-126) ===
|
|
227
|
-
if (destInterceptor?.postValidate) {
|
|
228
|
-
const result = destInterceptor.postValidate(destination, context.world, actor.id, destInterceptorData);
|
|
229
|
-
if (result !== null) {
|
|
230
|
-
sharedData.blockedBy = 'destination';
|
|
231
|
-
return {
|
|
232
|
-
valid: result.valid,
|
|
233
|
-
error: result.error,
|
|
234
|
-
params: result.params
|
|
235
|
-
};
|
|
236
|
-
}
|
|
237
|
-
}
|
|
257
|
+
// Canonical placement (ADR-228): postValidate runs after ALL standard
|
|
258
|
+
// validation, for every consultation (source → destination → door),
|
|
259
|
+
// first veto wins.
|
|
260
|
+
const postVeto = (0, lifecycle_1.runPostValidate)(context, state);
|
|
261
|
+
if (postVeto)
|
|
262
|
+
return postVeto;
|
|
238
263
|
return { valid: true };
|
|
239
264
|
},
|
|
240
265
|
execute(context) {
|
|
@@ -283,19 +308,9 @@ exports.goingAction = {
|
|
|
283
308
|
}
|
|
284
309
|
// Compute region boundary crossings (ADR-149)
|
|
285
310
|
sharedData.regionCrossings = context.world.getRegionCrossings(sourceRoom.id, destination.id);
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
const interceptorData = sharedData.interceptorData || {};
|
|
290
|
-
if (interceptor?.postExecute && sharedData.sourceRoom) {
|
|
291
|
-
interceptor.postExecute(sharedData.sourceRoom, context.world, actor.id, interceptorData);
|
|
292
|
-
}
|
|
293
|
-
// === DESTINATION POST-EXECUTE HOOK (ADR-126) ===
|
|
294
|
-
const destInterceptor = sharedData.destinationInterceptor;
|
|
295
|
-
const destInterceptorData = sharedData.destinationInterceptorData || {};
|
|
296
|
-
if (destInterceptor?.postExecute && sharedData.destinationRoom) {
|
|
297
|
-
destInterceptor.postExecute(sharedData.destinationRoom, context.world, actor.id, destInterceptorData);
|
|
298
|
-
}
|
|
311
|
+
const state = (0, lifecycle_1.getLifecycleState)(context);
|
|
312
|
+
if (state)
|
|
313
|
+
(0, lifecycle_1.runPostExecute)(context, state);
|
|
299
314
|
},
|
|
300
315
|
/**
|
|
301
316
|
* Report events after successful movement
|
|
@@ -338,7 +353,10 @@ exports.goingAction = {
|
|
|
338
353
|
// Check if destination is dark (no usable light source)
|
|
339
354
|
const isDark = world_model_1.VisibilityBehavior.isDark(destinationRoom, context.world);
|
|
340
355
|
if (isDark) {
|
|
341
|
-
// Dark room with no light - emit went event with darkness messageId
|
|
356
|
+
// Dark room with no light - emit went event with darkness messageId.
|
|
357
|
+
// No early return: postReport hooks still run below (ADR-228 D7.1 —
|
|
358
|
+
// the old early return skipped hooks on exactly the path that emits
|
|
359
|
+
// if.event.went).
|
|
342
360
|
events.push(context.event('if.event.went', {
|
|
343
361
|
messageId: `${context.action.id}.too_dark`,
|
|
344
362
|
params: {},
|
|
@@ -346,6 +364,9 @@ exports.goingAction = {
|
|
|
346
364
|
destinationId: destinationRoom.id,
|
|
347
365
|
isDark: true
|
|
348
366
|
}));
|
|
367
|
+
const state = (0, lifecycle_1.getLifecycleState)(context);
|
|
368
|
+
if (state)
|
|
369
|
+
(0, lifecycle_1.runPostReport)(context, state, events, 'if.event.went');
|
|
349
370
|
return events;
|
|
350
371
|
}
|
|
351
372
|
// Room has light - build and emit room description
|
|
@@ -404,24 +425,11 @@ exports.goingAction = {
|
|
|
404
425
|
itemNames: listableContents.map(e => e.name)
|
|
405
426
|
}));
|
|
406
427
|
}
|
|
407
|
-
// === SOURCE POST-REPORT HOOK ===
|
|
408
|
-
// Apply interceptor's override (replaces if.event.went.messageId, when emitted)
|
|
409
|
-
// and/or emit (additional events). See ISSUE-074.
|
|
410
428
|
// Note: if.event.went is only emitted on dark/blocked; override is a no-op
|
|
411
429
|
// on success non-dark transitions. Use emit for narration after success.
|
|
412
|
-
const
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
const result = interceptor.postReport(sharedData.sourceRoom, context.world, context.player.id, interceptorData);
|
|
416
|
-
(0, world_model_1.applyInterceptorReportResult)(events, 'if.event.went', result, context);
|
|
417
|
-
}
|
|
418
|
-
// === DESTINATION POST-REPORT HOOK (ADR-126) ===
|
|
419
|
-
const destInterceptor = sharedData.destinationInterceptor;
|
|
420
|
-
const destInterceptorData = sharedData.destinationInterceptorData || {};
|
|
421
|
-
if (destInterceptor?.postReport && sharedData.destinationRoom) {
|
|
422
|
-
const result = destInterceptor.postReport(sharedData.destinationRoom, context.world, context.player.id, destInterceptorData);
|
|
423
|
-
(0, world_model_1.applyInterceptorReportResult)(events, 'if.event.went', result, context);
|
|
424
|
-
}
|
|
430
|
+
const state = (0, lifecycle_1.getLifecycleState)(context);
|
|
431
|
+
if (state)
|
|
432
|
+
(0, lifecycle_1.runPostReport)(context, state, events, 'if.event.went');
|
|
425
433
|
return events;
|
|
426
434
|
},
|
|
427
435
|
/**
|
|
@@ -429,37 +437,23 @@ exports.goingAction = {
|
|
|
429
437
|
* Called instead of execute/report when validate returns invalid
|
|
430
438
|
*/
|
|
431
439
|
blocked(context, result) {
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
// If the destination interceptor blocked entry, let it handle the blocked phase first
|
|
435
|
-
if (sharedData.blockedBy === 'destination') {
|
|
436
|
-
const destInterceptor = sharedData.destinationInterceptor;
|
|
437
|
-
const destInterceptorData = sharedData.destinationInterceptorData || {};
|
|
438
|
-
if (destInterceptor?.onBlocked && sharedData.destinationRoom && result.error) {
|
|
439
|
-
const customEffects = destInterceptor.onBlocked(sharedData.destinationRoom, context.world, context.player.id, result.error, destInterceptorData);
|
|
440
|
-
if (customEffects !== null) {
|
|
441
|
-
return customEffects.map(effect => context.event(effect.type, effect.payload));
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
// === SOURCE ON-BLOCKED HOOK ===
|
|
446
|
-
// Called when action is blocked by source room or standard checks
|
|
447
|
-
const interceptor = sharedData.interceptor;
|
|
448
|
-
const interceptorData = sharedData.interceptorData || {};
|
|
449
|
-
if (interceptor?.onBlocked && sharedData.sourceRoom && result.error) {
|
|
450
|
-
const customEffects = interceptor.onBlocked(sharedData.sourceRoom, context.world, context.player.id, result.error, interceptorData);
|
|
451
|
-
if (customEffects !== null) {
|
|
452
|
-
return customEffects.map(effect => context.event(effect.type, effect.payload));
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
// Standard blocked handling
|
|
456
|
-
return [context.event('if.event.went', {
|
|
440
|
+
// Standard blocked event — always emitted (ADR-228 D2)
|
|
441
|
+
const events = [context.event('if.event.went', {
|
|
457
442
|
blocked: true,
|
|
458
443
|
reason: result.error,
|
|
459
444
|
messageId: `${context.action.id}.${result.error}`,
|
|
460
445
|
params: result.params || {},
|
|
461
446
|
actorId: context.player.id
|
|
462
447
|
})];
|
|
448
|
+
// All resolved consultations (source, destination, door) are notified;
|
|
449
|
+
// single-override arbitration replaces the old blockedBy precedence
|
|
450
|
+
// split (ADR-228 D2/D3).
|
|
451
|
+
if (result.error) {
|
|
452
|
+
const state = (0, lifecycle_1.getLifecycleState)(context);
|
|
453
|
+
if (state)
|
|
454
|
+
(0, lifecycle_1.runOnBlocked)(context, state, events, 'if.event.went', result.error);
|
|
455
|
+
}
|
|
456
|
+
return events;
|
|
463
457
|
},
|
|
464
458
|
group: "movement",
|
|
465
459
|
metadata: {
|