@sharpee/stdlib 3.0.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 -52
- 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 +35 -48
- 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 +122 -132
- 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/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 -59
- 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 +36 -52
- 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 -36
- 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 +102 -148
- 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
|
@@ -9,9 +9,24 @@
|
|
|
9
9
|
* 2. execute: Analyze conversation state (no world mutations)
|
|
10
10
|
* 3. blocked: Handle validation failures
|
|
11
11
|
* 4. report: Emit talked event and success message
|
|
12
|
+
*
|
|
13
|
+
* Interceptor consultation (ADR-118) runs through the shared lifecycle
|
|
14
|
+
* engine (ADR-228) via `talkingLifecycle` — no hand-rolled hook plumbing.
|
|
12
15
|
*/
|
|
13
16
|
import { Action } from '../../enhanced-types';
|
|
14
17
|
import { ActionMetadata } from '../../../validation';
|
|
18
|
+
import { ActionLifecycleDescriptor } from '../../lifecycle';
|
|
19
|
+
/**
|
|
20
|
+
* Interceptor surface (ADR-228): the person talked to is the only
|
|
21
|
+
* consultable entity of a TALK command.
|
|
22
|
+
*
|
|
23
|
+
* Wiring this closed a live Dungeo dead-registration bug (ADR-118 hook
|
|
24
|
+
* audit): `TrollTalkingInterceptor` — a preValidate veto implementing the
|
|
25
|
+
* MDL-canon "Unfortunately, the troll can't hear you" when the troll is
|
|
26
|
+
* incapacitated — was registered under `if.action.talking` but never
|
|
27
|
+
* consulted, because talking was unwired.
|
|
28
|
+
*/
|
|
29
|
+
export declare const talkingLifecycle: ActionLifecycleDescriptor;
|
|
15
30
|
export declare const talkingAction: Action & {
|
|
16
31
|
metadata: ActionMetadata;
|
|
17
32
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"talking.d.ts","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/talking/talking.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"talking.d.ts","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/talking/talking.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,MAAM,EAAmC,MAAM,sBAAsB,CAAC;AAK/E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EACL,yBAAyB,EAQ1B,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,EAAE,yBAS9B,CAAC;AAeF,eAAO,MAAM,aAAa,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,cAAc,CAAA;CAgO9D,CAAC"}
|
|
@@ -10,13 +10,37 @@
|
|
|
10
10
|
* 2. execute: Analyze conversation state (no world mutations)
|
|
11
11
|
* 3. blocked: Handle validation failures
|
|
12
12
|
* 4. report: Emit talked event and success message
|
|
13
|
+
*
|
|
14
|
+
* Interceptor consultation (ADR-118) runs through the shared lifecycle
|
|
15
|
+
* engine (ADR-228) via `talkingLifecycle` — no hand-rolled hook plumbing.
|
|
13
16
|
*/
|
|
14
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.talkingAction = void 0;
|
|
18
|
+
exports.talkingAction = exports.talkingLifecycle = void 0;
|
|
16
19
|
const world_model_1 = require("@sharpee/world-model");
|
|
17
20
|
const constants_1 = require("../../constants");
|
|
18
21
|
const types_1 = require("../../../scope/types");
|
|
19
22
|
const utils_1 = require("../../../utils");
|
|
23
|
+
const lifecycle_1 = require("../../lifecycle");
|
|
24
|
+
/**
|
|
25
|
+
* Interceptor surface (ADR-228): the person talked to is the only
|
|
26
|
+
* consultable entity of a TALK command.
|
|
27
|
+
*
|
|
28
|
+
* Wiring this closed a live Dungeo dead-registration bug (ADR-118 hook
|
|
29
|
+
* audit): `TrollTalkingInterceptor` — a preValidate veto implementing the
|
|
30
|
+
* MDL-canon "Unfortunately, the troll can't hear you" when the troll is
|
|
31
|
+
* incapacitated — was registered under `if.action.talking` but never
|
|
32
|
+
* consulted, because talking was unwired.
|
|
33
|
+
*/
|
|
34
|
+
exports.talkingLifecycle = {
|
|
35
|
+
actionId: constants_1.IFActions.TALKING,
|
|
36
|
+
slots: [
|
|
37
|
+
{
|
|
38
|
+
id: 'target',
|
|
39
|
+
actionIds: [constants_1.IFActions.TALKING],
|
|
40
|
+
resolve: (ctx) => ctx.command.directObject?.entity
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
};
|
|
20
44
|
function getTalkingSharedData(context) {
|
|
21
45
|
return context.sharedData;
|
|
22
46
|
}
|
|
@@ -52,6 +76,10 @@ exports.talkingAction = {
|
|
|
52
76
|
error: 'no_target'
|
|
53
77
|
};
|
|
54
78
|
}
|
|
79
|
+
const state = (0, lifecycle_1.resolveLifecycle)(context, exports.talkingLifecycle);
|
|
80
|
+
const preVeto = (0, lifecycle_1.runPreValidate)(context, state);
|
|
81
|
+
if (preVeto)
|
|
82
|
+
return preVeto;
|
|
55
83
|
// Check if target is visible
|
|
56
84
|
if (!context.canSee(target)) {
|
|
57
85
|
return {
|
|
@@ -94,6 +122,10 @@ exports.talkingAction = {
|
|
|
94
122
|
params: { target: (0, utils_1.nounPhraseFor)(target) }
|
|
95
123
|
};
|
|
96
124
|
}
|
|
125
|
+
// Canonical placement (ADR-228): postValidate runs after ALL standard validation
|
|
126
|
+
const postVeto = (0, lifecycle_1.runPostValidate)(context, state);
|
|
127
|
+
if (postVeto)
|
|
128
|
+
return postVeto;
|
|
97
129
|
return { valid: true };
|
|
98
130
|
},
|
|
99
131
|
execute(context) {
|
|
@@ -164,12 +196,20 @@ exports.talkingAction = {
|
|
|
164
196
|
sharedData.targetName = target.name;
|
|
165
197
|
sharedData.messageId = messageId;
|
|
166
198
|
sharedData.eventData = eventData;
|
|
199
|
+
const state = (0, lifecycle_1.getLifecycleState)(context);
|
|
200
|
+
if (state)
|
|
201
|
+
(0, lifecycle_1.runPostExecute)(context, state);
|
|
167
202
|
},
|
|
168
203
|
blocked(context, result) {
|
|
169
204
|
const target = context.command.directObject?.entity;
|
|
170
|
-
|
|
205
|
+
// Fully-qualified message IDs (containing dots) are used as-is —
|
|
206
|
+
// e.g. an interceptor veto like 'dungeo.troll.cant_hear_you';
|
|
207
|
+
// short keys (e.g. 'not_visible') get the action ID prefix
|
|
208
|
+
const error = result.error || '';
|
|
209
|
+
const messageId = error.includes('.') ? error : `${context.action.id}.${error}`;
|
|
210
|
+
const events = [context.event('if.event.talk_blocked', {
|
|
171
211
|
blocked: true,
|
|
172
|
-
messageId
|
|
212
|
+
messageId,
|
|
173
213
|
// params carry EntityInfo for the formatter chain (ADR-158)
|
|
174
214
|
params: {
|
|
175
215
|
...result.params,
|
|
@@ -179,6 +219,12 @@ exports.talkingAction = {
|
|
|
179
219
|
targetId: target?.id,
|
|
180
220
|
targetName: target?.name
|
|
181
221
|
})];
|
|
222
|
+
if (result.error) {
|
|
223
|
+
const state = (0, lifecycle_1.getLifecycleState)(context);
|
|
224
|
+
if (state)
|
|
225
|
+
(0, lifecycle_1.runOnBlocked)(context, state, events, 'if.event.talk_blocked', result.error);
|
|
226
|
+
}
|
|
227
|
+
return events;
|
|
182
228
|
},
|
|
183
229
|
report(context) {
|
|
184
230
|
const events = [];
|
|
@@ -191,6 +237,9 @@ exports.talkingAction = {
|
|
|
191
237
|
params: { target: target ? (0, utils_1.nounPhraseFor)(target) : { name: sharedData.targetName } },
|
|
192
238
|
...sharedData.eventData
|
|
193
239
|
}));
|
|
240
|
+
const state = (0, lifecycle_1.getLifecycleState)(context);
|
|
241
|
+
if (state)
|
|
242
|
+
(0, lifecycle_1.runPostReport)(context, state, events, 'if.event.talked');
|
|
194
243
|
return events;
|
|
195
244
|
},
|
|
196
245
|
group: "social",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"talking.js","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/talking/talking.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"talking.js","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/talking/talking.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;AAIH,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ourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/telling/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.tellingLifecycle = exports.tellingAction = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Telling action (ADR-230 Phase 6) — public exports.
|
|
6
|
+
*/
|
|
7
|
+
var telling_1 = require("./telling");
|
|
8
|
+
Object.defineProperty(exports, "tellingAction", { enumerable: true, get: function () { return telling_1.tellingAction; } });
|
|
9
|
+
Object.defineProperty(exports, "tellingLifecycle", { enumerable: true, get: function () { return telling_1.tellingLifecycle; } });
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/telling/index.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,qCAA4D;AAAnD,wGAAA,aAAa,OAAA;AAAE,2GAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Telling action (ADR-230 Phase 6, sketch ruling 4) — minimal interceptable
|
|
3
|
+
* TELL :recipient ABOUT :topic.
|
|
4
|
+
*
|
|
5
|
+
* TELL is a core IF verb players constantly try, but there is no platform
|
|
6
|
+
* conversation system yet: this action validates the social preconditions
|
|
7
|
+
* and reports a helpful default ("X doesn't seem interested") that
|
|
8
|
+
* per-entity interceptors (or a future conversation extension) override.
|
|
9
|
+
* No world mutation, ever.
|
|
10
|
+
*
|
|
11
|
+
* Four-phase pattern; interceptor consultation through the shared
|
|
12
|
+
* lifecycle engine (ADR-228) via `tellingLifecycle`.
|
|
13
|
+
*/
|
|
14
|
+
import { Action } from '../../enhanced-types';
|
|
15
|
+
import { ActionMetadata } from '../../../validation';
|
|
16
|
+
import { ActionLifecycleDescriptor } from '../../lifecycle';
|
|
17
|
+
/**
|
|
18
|
+
* Interceptor surface (ADR-228): the person told is the only consultable
|
|
19
|
+
* entity of a TELL command.
|
|
20
|
+
*/
|
|
21
|
+
export declare const tellingLifecycle: ActionLifecycleDescriptor;
|
|
22
|
+
export declare const tellingAction: Action & {
|
|
23
|
+
metadata: ActionMetadata;
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=telling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telling.d.ts","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/telling/telling.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,MAAM,EAAmC,MAAM,sBAAsB,CAAC;AAI/E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,EACL,yBAAyB,EAQ1B,MAAM,iBAAiB,CAAC;AAEzB;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,yBAS9B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,cAAc,CAAA;CAoF9D,CAAC"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Telling action (ADR-230 Phase 6, sketch ruling 4) — minimal interceptable
|
|
4
|
+
* TELL :recipient ABOUT :topic.
|
|
5
|
+
*
|
|
6
|
+
* TELL is a core IF verb players constantly try, but there is no platform
|
|
7
|
+
* conversation system yet: this action validates the social preconditions
|
|
8
|
+
* and reports a helpful default ("X doesn't seem interested") that
|
|
9
|
+
* per-entity interceptors (or a future conversation extension) override.
|
|
10
|
+
* No world mutation, ever.
|
|
11
|
+
*
|
|
12
|
+
* Four-phase pattern; interceptor consultation through the shared
|
|
13
|
+
* lifecycle engine (ADR-228) via `tellingLifecycle`.
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.tellingAction = exports.tellingLifecycle = void 0;
|
|
17
|
+
const world_model_1 = require("@sharpee/world-model");
|
|
18
|
+
const constants_1 = require("../../constants");
|
|
19
|
+
const types_1 = require("../../../scope/types");
|
|
20
|
+
const utils_1 = require("../../../utils");
|
|
21
|
+
const lifecycle_1 = require("../../lifecycle");
|
|
22
|
+
/**
|
|
23
|
+
* Interceptor surface (ADR-228): the person told is the only consultable
|
|
24
|
+
* entity of a TELL command.
|
|
25
|
+
*/
|
|
26
|
+
exports.tellingLifecycle = {
|
|
27
|
+
actionId: constants_1.IFActions.TELLING,
|
|
28
|
+
slots: [
|
|
29
|
+
{
|
|
30
|
+
id: 'target',
|
|
31
|
+
actionIds: [constants_1.IFActions.TELLING],
|
|
32
|
+
resolve: (ctx) => ctx.command.directObject?.entity
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
};
|
|
36
|
+
exports.tellingAction = {
|
|
37
|
+
id: constants_1.IFActions.TELLING,
|
|
38
|
+
requiredMessages: ['no_target', 'not_visible', 'too_far', 'not_actor', 'not_interested'],
|
|
39
|
+
group: 'social',
|
|
40
|
+
metadata: {
|
|
41
|
+
requiresDirectObject: true,
|
|
42
|
+
requiresIndirectObject: false,
|
|
43
|
+
directObjectScope: types_1.ScopeLevel.AWARE
|
|
44
|
+
},
|
|
45
|
+
validate(context) {
|
|
46
|
+
const target = context.command.directObject?.entity;
|
|
47
|
+
if (!target) {
|
|
48
|
+
return { valid: false, error: 'no_target' };
|
|
49
|
+
}
|
|
50
|
+
const state = (0, lifecycle_1.resolveLifecycle)(context, exports.tellingLifecycle);
|
|
51
|
+
const preVeto = (0, lifecycle_1.runPreValidate)(context, state);
|
|
52
|
+
if (preVeto)
|
|
53
|
+
return preVeto;
|
|
54
|
+
if (!context.canSee(target)) {
|
|
55
|
+
return { valid: false, error: 'not_visible' };
|
|
56
|
+
}
|
|
57
|
+
if (context.world.getLocation(target.id) !== context.world.getLocation(context.player.id)) {
|
|
58
|
+
return { valid: false, error: 'too_far' };
|
|
59
|
+
}
|
|
60
|
+
if (!target.has(world_model_1.TraitType.ACTOR)) {
|
|
61
|
+
return { valid: false, error: 'not_actor', params: { target: (0, utils_1.nounPhraseFor)(target) } };
|
|
62
|
+
}
|
|
63
|
+
const postVeto = (0, lifecycle_1.runPostValidate)(context, state);
|
|
64
|
+
if (postVeto)
|
|
65
|
+
return postVeto;
|
|
66
|
+
return { valid: true };
|
|
67
|
+
},
|
|
68
|
+
execute(context) {
|
|
69
|
+
// No world mutation — asking is pure conversation surface.
|
|
70
|
+
const state = (0, lifecycle_1.getLifecycleState)(context);
|
|
71
|
+
if (state)
|
|
72
|
+
(0, lifecycle_1.runPostExecute)(context, state);
|
|
73
|
+
},
|
|
74
|
+
blocked(context, result) {
|
|
75
|
+
const target = context.command.directObject?.entity;
|
|
76
|
+
const error = result.error || '';
|
|
77
|
+
const messageId = error.includes('.') ? error : `${context.action.id}.${error}`;
|
|
78
|
+
const events = [
|
|
79
|
+
context.event('if.event.tell_blocked', {
|
|
80
|
+
blocked: true,
|
|
81
|
+
messageId,
|
|
82
|
+
params: { ...result.params, target: target ? (0, utils_1.nounPhraseFor)(target) : undefined },
|
|
83
|
+
reason: result.error,
|
|
84
|
+
targetId: target?.id,
|
|
85
|
+
targetName: target?.name
|
|
86
|
+
})
|
|
87
|
+
];
|
|
88
|
+
if (result.error) {
|
|
89
|
+
const state = (0, lifecycle_1.getLifecycleState)(context);
|
|
90
|
+
if (state)
|
|
91
|
+
(0, lifecycle_1.runOnBlocked)(context, state, events, 'if.event.tell_blocked', result.error);
|
|
92
|
+
}
|
|
93
|
+
return events;
|
|
94
|
+
},
|
|
95
|
+
report(context) {
|
|
96
|
+
const target = context.command.directObject.entity;
|
|
97
|
+
const topic = context.command.indirectObject?.parsed?.text ??
|
|
98
|
+
context.command.parsed?.structure?.extras?.topic;
|
|
99
|
+
const events = [
|
|
100
|
+
context.event('if.event.told', {
|
|
101
|
+
messageId: `${context.action.id}.not_interested`,
|
|
102
|
+
params: { target: (0, utils_1.nounPhraseFor)(target), topic },
|
|
103
|
+
targetId: target.id,
|
|
104
|
+
targetName: target.name,
|
|
105
|
+
topic
|
|
106
|
+
})
|
|
107
|
+
];
|
|
108
|
+
const state = (0, lifecycle_1.getLifecycleState)(context);
|
|
109
|
+
if (state)
|
|
110
|
+
(0, lifecycle_1.runPostReport)(context, state, events, 'if.event.told');
|
|
111
|
+
return events;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
//# sourceMappingURL=telling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telling.js","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/telling/telling.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAIH,sDAAiD;AACjD,+CAA4C;AAE5C,gDAAkD;AAClD,0CAA+C;AAC/C,+CASyB;AAEzB;;;GAGG;AACU,QAAA,gBAAgB,GAA8B;IACzD,QAAQ,EAAE,qBAAS,CAAC,OAAO;IAC3B,KAAK,EAAE;QACL;YACE,EAAE,EAAE,QAAQ;YACZ,SAAS,EAAE,CAAC,qBAAS,CAAC,OAAO,CAAC;YAC9B,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,YAAY,EAAE,MAAM;SACnD;KACF;CACF,CAAC;AAEW,QAAA,aAAa,GAA0C;IAClE,EAAE,EAAE,qBAAS,CAAC,OAAO;IACrB,gBAAgB,EAAE,CAAC,WAAW,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,gBAAgB,CAAC;IACxF,KAAK,EAAE,QAAQ;IACf,QAAQ,EAAE;QACR,oBAAoB,EAAE,IAAI;QAC1B,sBAAsB,EAAE,KAAK;QAC7B,iBAAiB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MAAM,CAAC,OAAsB;QAC3B,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,YAAa,CAAC,MAAO,CAAC;QACrD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,IAAI;YACvD,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,SAAyD,EAAE,MAAM,EAAE,KAAK,CAAC;QAEpG,MAAM,MAAM,GAAqB;YAC/B,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE;gBAC7B,SAAS,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,iBAAiB;gBAChD,MAAM,EAAE,EAAE,MAAM,EAAE,IAAA,qBAAa,EAAC,MAAM,CAAC,EAAE,KAAK,EAAE;gBAChD,QAAQ,EAAE,MAAM,CAAC,EAAE;gBACnB,UAAU,EAAE,MAAM,CAAC,IAAI;gBACvB,KAAK;aACN,CAAC;SACH,CAAC;QAEF,MAAM,KAAK,GAAG,IAAA,6BAAiB,EAAC,OAAO,CAAC,CAAC;QACzC,IAAI,KAAK;YAAE,IAAA,yBAAa,EAAC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;QAClE,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC"}
|
|
@@ -14,6 +14,17 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import { Action } from '../../enhanced-types';
|
|
16
16
|
import { ActionMetadata } from '../../../validation';
|
|
17
|
+
import { ActionLifecycleDescriptor } from '../../lifecycle';
|
|
18
|
+
/**
|
|
19
|
+
* Interceptor surface (ADR-228): BOTH the thrown item and the target are
|
|
20
|
+
* consulted, in the published D3-B order (direct object first). This
|
|
21
|
+
* retires the audit's single-winner rule (target-else-item) — a glacier
|
|
22
|
+
* can react to being hit AND an explosive can react to being thrown in
|
|
23
|
+
* the same command. Both consultations are seeded with the full
|
|
24
|
+
* item/target context (the receiving entity's hooks read `itemId` to
|
|
25
|
+
* know what hit them).
|
|
26
|
+
*/
|
|
27
|
+
export declare const throwingLifecycle: ActionLifecycleDescriptor;
|
|
17
28
|
export declare const throwingAction: Action & {
|
|
18
29
|
metadata: ActionMetadata;
|
|
19
30
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"throwing.d.ts","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/throwing/throwing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,MAAM,EAAmC,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"throwing.d.ts","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/throwing/throwing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,MAAM,EAAmC,MAAM,sBAAsB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAoBrD,OAAO,EACL,yBAAyB,EAQ1B,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,EAAE,yBA0B/B,CAAC;AA0EF,eAAO,MAAM,cAAc,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,cAAc,CAAA;CA6Y/D,CAAC"}
|
|
@@ -14,11 +14,48 @@
|
|
|
14
14
|
* 4. report: standard events → postReport hook (additional effects)
|
|
15
15
|
*/
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.throwingAction = void 0;
|
|
17
|
+
exports.throwingAction = exports.throwingLifecycle = void 0;
|
|
18
18
|
const world_model_1 = require("@sharpee/world-model");
|
|
19
19
|
const constants_1 = require("../../constants");
|
|
20
20
|
const types_1 = require("../../../scope/types");
|
|
21
21
|
const utils_1 = require("../../../utils");
|
|
22
|
+
const lifecycle_1 = require("../../lifecycle");
|
|
23
|
+
/**
|
|
24
|
+
* Interceptor surface (ADR-228): BOTH the thrown item and the target are
|
|
25
|
+
* consulted, in the published D3-B order (direct object first). This
|
|
26
|
+
* retires the audit's single-winner rule (target-else-item) — a glacier
|
|
27
|
+
* can react to being hit AND an explosive can react to being thrown in
|
|
28
|
+
* the same command. Both consultations are seeded with the full
|
|
29
|
+
* item/target context (the receiving entity's hooks read `itemId` to
|
|
30
|
+
* know what hit them).
|
|
31
|
+
*/
|
|
32
|
+
exports.throwingLifecycle = {
|
|
33
|
+
actionId: constants_1.IFActions.THROWING,
|
|
34
|
+
slots: [
|
|
35
|
+
{
|
|
36
|
+
id: 'item',
|
|
37
|
+
actionIds: [constants_1.IFActions.THROWING],
|
|
38
|
+
resolve: (ctx) => ctx.command.directObject?.entity,
|
|
39
|
+
seedData: (ctx, entity) => ({
|
|
40
|
+
itemId: entity.id,
|
|
41
|
+
itemName: entity.name,
|
|
42
|
+
targetId: ctx.command.indirectObject?.entity?.id,
|
|
43
|
+
targetName: ctx.command.indirectObject?.entity?.name
|
|
44
|
+
})
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: 'target',
|
|
48
|
+
actionIds: [constants_1.IFActions.THROWING],
|
|
49
|
+
resolve: (ctx) => ctx.command.indirectObject?.entity,
|
|
50
|
+
seedData: (ctx, entity) => ({
|
|
51
|
+
itemId: ctx.command.directObject?.entity?.id,
|
|
52
|
+
itemName: ctx.command.directObject?.entity?.name,
|
|
53
|
+
targetId: entity.id,
|
|
54
|
+
targetName: entity.name
|
|
55
|
+
})
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
};
|
|
22
59
|
/**
|
|
23
60
|
* Helper to convert a string direction to Direction constant
|
|
24
61
|
*/
|
|
@@ -101,34 +138,13 @@ exports.throwingAction = {
|
|
|
101
138
|
const item = context.command.directObject?.entity;
|
|
102
139
|
const target = context.command.indirectObject?.entity;
|
|
103
140
|
const direction = context.command.parsed.extras?.direction;
|
|
104
|
-
const sharedData = getThrowingSharedData(context);
|
|
105
141
|
if (!item) {
|
|
106
142
|
return { valid: false, error: 'no_item' };
|
|
107
143
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const interceptorData = {
|
|
113
|
-
// Pass item info to interceptor so it knows what's being thrown
|
|
114
|
-
itemId: item.id,
|
|
115
|
-
itemName: item.name
|
|
116
|
-
};
|
|
117
|
-
// Store for later phases
|
|
118
|
-
sharedData.interceptor = interceptor;
|
|
119
|
-
sharedData.interceptorData = interceptorData;
|
|
120
|
-
// === PRE-VALIDATE HOOK ===
|
|
121
|
-
// Called before standard validation - can block early
|
|
122
|
-
if (interceptor?.preValidate && target) {
|
|
123
|
-
const result = interceptor.preValidate(target, context.world, actor.id, interceptorData);
|
|
124
|
-
if (result !== null) {
|
|
125
|
-
return {
|
|
126
|
-
valid: result.valid,
|
|
127
|
-
error: result.error,
|
|
128
|
-
params: result.params
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
}
|
|
144
|
+
const state = (0, lifecycle_1.resolveLifecycle)(context, exports.throwingLifecycle);
|
|
145
|
+
const preVeto = (0, lifecycle_1.runPreValidate)(context, state);
|
|
146
|
+
if (preVeto)
|
|
147
|
+
return preVeto;
|
|
132
148
|
// Item must be carried (or implicitly takeable)
|
|
133
149
|
// This enables "throw apple at bob" when apple is on the ground
|
|
134
150
|
const carryCheck = context.requireCarriedOrImplicitTake(item);
|
|
@@ -178,18 +194,10 @@ exports.throwingAction = {
|
|
|
178
194
|
};
|
|
179
195
|
}
|
|
180
196
|
}
|
|
181
|
-
//
|
|
182
|
-
|
|
183
|
-
if (
|
|
184
|
-
|
|
185
|
-
if (result !== null) {
|
|
186
|
-
return {
|
|
187
|
-
valid: result.valid,
|
|
188
|
-
error: result.error,
|
|
189
|
-
params: result.params
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
}
|
|
197
|
+
// Canonical placement (ADR-228): postValidate runs after ALL standard validation
|
|
198
|
+
const postVeto = (0, lifecycle_1.runPostValidate)(context, state);
|
|
199
|
+
if (postVeto)
|
|
200
|
+
return postVeto;
|
|
193
201
|
return { valid: true };
|
|
194
202
|
},
|
|
195
203
|
execute(context) {
|
|
@@ -239,6 +247,11 @@ exports.throwingAction = {
|
|
|
239
247
|
sharedData.capabilityBehavior = behavior;
|
|
240
248
|
sharedData.capabilityTrait = capTrait;
|
|
241
249
|
behavior.execute(target, context.world, context.player.id, context.sharedData);
|
|
250
|
+
// ADR-228 D7.2: capability behavior first, then interceptor
|
|
251
|
+
// hooks — this path previously returned before postExecute.
|
|
252
|
+
const capState = (0, lifecycle_1.getLifecycleState)(context);
|
|
253
|
+
if (capState)
|
|
254
|
+
(0, lifecycle_1.runPostExecute)(context, capState);
|
|
242
255
|
return;
|
|
243
256
|
}
|
|
244
257
|
}
|
|
@@ -346,31 +359,15 @@ exports.throwingAction = {
|
|
|
346
359
|
// The event system will handle actual removal if needed
|
|
347
360
|
context.world.moveEntity(item.id, ''); // Empty string = nowhere
|
|
348
361
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
const interceptorData = sharedData.interceptorData || {};
|
|
353
|
-
if (interceptor?.postExecute && target) {
|
|
354
|
-
interceptor.postExecute(target, context.world, actor.id, interceptorData);
|
|
355
|
-
}
|
|
362
|
+
const state = (0, lifecycle_1.getLifecycleState)(context);
|
|
363
|
+
if (state)
|
|
364
|
+
(0, lifecycle_1.runPostExecute)(context, state);
|
|
356
365
|
},
|
|
357
366
|
blocked(context, result) {
|
|
358
367
|
const item = context.command.directObject?.entity;
|
|
359
368
|
const target = context.command.indirectObject?.entity;
|
|
360
|
-
const sharedData = getThrowingSharedData(context);
|
|
361
|
-
// === ON-BLOCKED HOOK ===
|
|
362
|
-
// Called when action is blocked - can provide custom blocked handling
|
|
363
|
-
const interceptor = sharedData.interceptor;
|
|
364
|
-
const interceptorData = sharedData.interceptorData || {};
|
|
365
|
-
if (interceptor?.onBlocked && target && result.error) {
|
|
366
|
-
const customEffects = interceptor.onBlocked(target, context.world, context.player.id, result.error, interceptorData);
|
|
367
|
-
if (customEffects !== null) {
|
|
368
|
-
// Interceptor provided custom blocked effects
|
|
369
|
-
return customEffects.map(effect => context.event(effect.type, effect.payload));
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
369
|
// Standard blocked handling — params carry EntityInfo (ADR-158)
|
|
373
|
-
|
|
370
|
+
const events = [context.event('if.event.throw_blocked', {
|
|
374
371
|
blocked: true,
|
|
375
372
|
messageId: `${context.action.id}.${result.error}`,
|
|
376
373
|
params: {
|
|
@@ -384,6 +381,12 @@ exports.throwingAction = {
|
|
|
384
381
|
targetId: target?.id,
|
|
385
382
|
targetName: target?.name
|
|
386
383
|
})];
|
|
384
|
+
if (result.error) {
|
|
385
|
+
const state = (0, lifecycle_1.getLifecycleState)(context);
|
|
386
|
+
if (state)
|
|
387
|
+
(0, lifecycle_1.runOnBlocked)(context, state, events, 'if.event.throw_blocked', result.error);
|
|
388
|
+
}
|
|
389
|
+
return events;
|
|
387
390
|
},
|
|
388
391
|
report(context) {
|
|
389
392
|
const sharedData = getThrowingSharedData(context);
|
|
@@ -399,6 +402,11 @@ exports.throwingAction = {
|
|
|
399
402
|
const effects = sharedData.capabilityBehavior.report(target, context.world, context.player.id, context.sharedData);
|
|
400
403
|
events.push(...effectsToEvents(effects, context));
|
|
401
404
|
}
|
|
405
|
+
// ADR-228 D7.2: capability behavior first, then interceptor hooks —
|
|
406
|
+
// this path previously returned before postReport.
|
|
407
|
+
const capState = (0, lifecycle_1.getLifecycleState)(context);
|
|
408
|
+
if (capState)
|
|
409
|
+
(0, lifecycle_1.runPostReport)(context, capState, events, 'if.event.thrown');
|
|
402
410
|
return events;
|
|
403
411
|
}
|
|
404
412
|
// Build event data with messageId for text rendering
|
|
@@ -443,18 +451,9 @@ exports.throwingAction = {
|
|
|
443
451
|
targetName: sharedData.targetName
|
|
444
452
|
}));
|
|
445
453
|
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
const interceptor = sharedData.interceptor;
|
|
450
|
-
const interceptorData = sharedData.interceptorData || {};
|
|
451
|
-
if (interceptor?.postReport) {
|
|
452
|
-
const target = context.command.indirectObject?.entity;
|
|
453
|
-
if (target) {
|
|
454
|
-
const result = interceptor.postReport(target, context.world, context.player.id, interceptorData);
|
|
455
|
-
(0, world_model_1.applyInterceptorReportResult)(events, 'if.event.thrown', result, context);
|
|
456
|
-
}
|
|
457
|
-
}
|
|
454
|
+
const state = (0, lifecycle_1.getLifecycleState)(context);
|
|
455
|
+
if (state)
|
|
456
|
+
(0, lifecycle_1.runPostReport)(context, state, events, 'if.event.thrown');
|
|
458
457
|
return events;
|
|
459
458
|
},
|
|
460
459
|
group: "interaction"
|