@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
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* 4. report: Generate success events with closed data
|
|
13
13
|
*/
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.closingAction = void 0;
|
|
15
|
+
exports.closingAction = exports.closingLifecycle = void 0;
|
|
16
16
|
const world_model_1 = require("@sharpee/world-model");
|
|
17
17
|
const data_builder_types_1 = require("../../data-builder-types");
|
|
18
18
|
const constants_1 = require("../../constants");
|
|
@@ -20,6 +20,21 @@ const closing_data_1 = require("./closing-data");
|
|
|
20
20
|
const closing_messages_1 = require("./closing-messages");
|
|
21
21
|
const types_1 = require("../../../scope/types");
|
|
22
22
|
const utils_1 = require("../../../utils");
|
|
23
|
+
const lifecycle_1 = require("../../lifecycle");
|
|
24
|
+
/**
|
|
25
|
+
* Interceptor surface (ADR-228): the closed target is the only
|
|
26
|
+
* consultable entity of a CLOSE command.
|
|
27
|
+
*/
|
|
28
|
+
exports.closingLifecycle = {
|
|
29
|
+
actionId: constants_1.IFActions.CLOSING,
|
|
30
|
+
slots: [
|
|
31
|
+
{
|
|
32
|
+
id: 'target',
|
|
33
|
+
actionIds: [constants_1.IFActions.CLOSING],
|
|
34
|
+
resolve: (ctx) => ctx.command.directObject?.entity
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
};
|
|
23
38
|
function getClosingSharedData(context) {
|
|
24
39
|
return context.sharedData;
|
|
25
40
|
}
|
|
@@ -64,25 +79,10 @@ exports.closingAction = {
|
|
|
64
79
|
error: closing_messages_1.ClosingMessages.NO_TARGET
|
|
65
80
|
};
|
|
66
81
|
}
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
// Store for later phases (blocked needs access to onBlocked)
|
|
72
|
-
const sharedData = getClosingSharedData(context);
|
|
73
|
-
sharedData.interceptor = interceptor;
|
|
74
|
-
sharedData.interceptorData = interceptorData;
|
|
75
|
-
// === PRE-VALIDATE HOOK ===
|
|
76
|
-
if (interceptor?.preValidate) {
|
|
77
|
-
const result = interceptor.preValidate(noun, context.world, context.player.id, interceptorData);
|
|
78
|
-
if (result !== null && !result.valid) {
|
|
79
|
-
return {
|
|
80
|
-
valid: false,
|
|
81
|
-
error: result.error,
|
|
82
|
-
params: result.params
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
}
|
|
82
|
+
const state = (0, lifecycle_1.resolveLifecycle)(context, exports.closingLifecycle);
|
|
83
|
+
const preVeto = (0, lifecycle_1.runPreValidate)(context, state);
|
|
84
|
+
if (preVeto)
|
|
85
|
+
return preVeto;
|
|
86
86
|
// Check scope - must be able to reach the target
|
|
87
87
|
const scopeCheck = context.requireScope(noun, types_1.ScopeLevel.REACHABLE);
|
|
88
88
|
if (!scopeCheck.ok) {
|
|
@@ -129,13 +129,10 @@ exports.closingAction = {
|
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
//
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
return { valid: false, error: result.error, params: result.params };
|
|
137
|
-
}
|
|
138
|
-
}
|
|
132
|
+
// Canonical placement (ADR-228): postValidate runs after ALL standard validation
|
|
133
|
+
const postVeto = (0, lifecycle_1.runPostValidate)(context, state);
|
|
134
|
+
if (postVeto)
|
|
135
|
+
return postVeto;
|
|
139
136
|
return { valid: true };
|
|
140
137
|
},
|
|
141
138
|
/**
|
|
@@ -150,10 +147,9 @@ exports.closingAction = {
|
|
|
150
147
|
// Store result for report phase using sharedData
|
|
151
148
|
const sharedData = getClosingSharedData(context);
|
|
152
149
|
sharedData.closeResult = result;
|
|
153
|
-
|
|
154
|
-
if (
|
|
155
|
-
|
|
156
|
-
}
|
|
150
|
+
const state = (0, lifecycle_1.getLifecycleState)(context);
|
|
151
|
+
if (state)
|
|
152
|
+
(0, lifecycle_1.runPostExecute)(context, state);
|
|
157
153
|
},
|
|
158
154
|
/**
|
|
159
155
|
* Report events after successful closing
|
|
@@ -208,16 +204,9 @@ exports.closingAction = {
|
|
|
208
204
|
contentsIds,
|
|
209
205
|
item: noun.name
|
|
210
206
|
}));
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
// silently dropped.
|
|
215
|
-
if (sharedData.interceptor?.postReport) {
|
|
216
|
-
const reportResult = sharedData.interceptor.postReport(noun, context.world, context.player.id, sharedData.interceptorData ?? {});
|
|
217
|
-
if (reportResult) {
|
|
218
|
-
(0, world_model_1.applyInterceptorReportResult)(events, 'if.event.closed', reportResult, context);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
207
|
+
const state = (0, lifecycle_1.getLifecycleState)(context);
|
|
208
|
+
if (state)
|
|
209
|
+
(0, lifecycle_1.runPostReport)(context, state, events, 'if.event.closed');
|
|
221
210
|
return events;
|
|
222
211
|
},
|
|
223
212
|
/**
|
|
@@ -227,20 +216,10 @@ exports.closingAction = {
|
|
|
227
216
|
*/
|
|
228
217
|
blocked(context, result) {
|
|
229
218
|
const noun = context.command.directObject?.entity;
|
|
230
|
-
// === ON-BLOCKED HOOK ===
|
|
231
|
-
const sharedData = getClosingSharedData(context);
|
|
232
|
-
const interceptor = sharedData.interceptor;
|
|
233
|
-
const interceptorData = sharedData.interceptorData || {};
|
|
234
|
-
if (interceptor?.onBlocked && noun && result.error) {
|
|
235
|
-
const customEffects = interceptor.onBlocked(noun, context.world, context.player.id, result.error, interceptorData);
|
|
236
|
-
if (customEffects !== null) {
|
|
237
|
-
return customEffects.map(effect => context.event(effect.type, effect.payload));
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
219
|
const error = result.error || '';
|
|
241
220
|
// If error already contains dots (e.g., story interceptor ID), use as-is; otherwise prefix with action ID
|
|
242
221
|
const messageId = error.includes('.') ? error : `${context.action.id}.${error}`;
|
|
243
|
-
|
|
222
|
+
const events = [context.event('if.event.close_blocked', {
|
|
244
223
|
// Rendering data — EntityInfo for the formatter chain (ADR-158)
|
|
245
224
|
messageId,
|
|
246
225
|
params: {
|
|
@@ -252,6 +231,12 @@ exports.closingAction = {
|
|
|
252
231
|
targetName: noun?.name,
|
|
253
232
|
reason: result.error
|
|
254
233
|
})];
|
|
234
|
+
if (result.error) {
|
|
235
|
+
const state = (0, lifecycle_1.getLifecycleState)(context);
|
|
236
|
+
if (state)
|
|
237
|
+
(0, lifecycle_1.runOnBlocked)(context, state, events, 'if.event.close_blocked', result.error);
|
|
238
|
+
}
|
|
239
|
+
return events;
|
|
255
240
|
}
|
|
256
241
|
};
|
|
257
242
|
//# sourceMappingURL=closing.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"closing.js","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/closing/closing.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAIH,
|
|
1
|
+
{"version":3,"file":"closing.js","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/closing/closing.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAIH,sDAAgG;AAChG,iEAA0D;AAC1D,+CAA4C;AAC5C,iDAAkD;AAClD,yDAAqD;AAKrD,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;AASF,SAAS,oBAAoB,CAAC,OAAsB;IAClD,OAAO,OAAO,CAAC,UAA+B,CAAC;AACjD,CAAC;AAEY,QAAA,aAAa,GAA0C;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,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,wBAAwB,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1F,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Message constants for the cutting action (ADR-230 D3c)
|
|
3
|
+
*
|
|
4
|
+
* These constants provide type safety for message IDs within stdlib.
|
|
5
|
+
* The lang-en-us package uses matching string literals (stable, injected at runtime).
|
|
6
|
+
*/
|
|
7
|
+
export declare const CuttingMessages: {
|
|
8
|
+
readonly NO_TARGET: "no_target";
|
|
9
|
+
readonly NOT_CUTTABLE: "not_cuttable";
|
|
10
|
+
readonly CANT_CUT: "cant_cut";
|
|
11
|
+
readonly NO_TOOL: "no_tool";
|
|
12
|
+
readonly TOOL_NOT_HELD: "tool_not_held";
|
|
13
|
+
readonly WRONG_TOOL: "wrong_tool";
|
|
14
|
+
readonly CUT: "cut";
|
|
15
|
+
};
|
|
16
|
+
export type CuttingMessageId = typeof CuttingMessages[keyof typeof CuttingMessages];
|
|
17
|
+
//# sourceMappingURL=cutting-messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cutting-messages.d.ts","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/cutting/cutting-messages.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,eAAe;;;;;;;;CAYlB,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,OAAO,eAAe,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CuttingMessages = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Message constants for the cutting action (ADR-230 D3c)
|
|
6
|
+
*
|
|
7
|
+
* These constants provide type safety for message IDs within stdlib.
|
|
8
|
+
* The lang-en-us package uses matching string literals (stable, injected at runtime).
|
|
9
|
+
*/
|
|
10
|
+
exports.CuttingMessages = {
|
|
11
|
+
// Error messages
|
|
12
|
+
NO_TARGET: 'no_target',
|
|
13
|
+
NOT_CUTTABLE: 'not_cuttable',
|
|
14
|
+
CANT_CUT: 'cant_cut',
|
|
15
|
+
// Tool requirement (shared ids from tool-shared.ts)
|
|
16
|
+
NO_TOOL: 'no_tool',
|
|
17
|
+
TOOL_NOT_HELD: 'tool_not_held',
|
|
18
|
+
WRONG_TOOL: 'wrong_tool',
|
|
19
|
+
// Success message (typically overridden by the entity's implementation)
|
|
20
|
+
CUT: 'cut',
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=cutting-messages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cutting-messages.js","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/cutting/cutting-messages.ts"],"names":[],"mappings":";;;AAAA;;;;;GAKG;AACU,QAAA,eAAe,GAAG;IAC7B,iBAAiB;IACjB,SAAS,EAAE,WAAW;IACtB,YAAY,EAAE,cAAc;IAC5B,QAAQ,EAAE,UAAU;IACpB,oDAAoD;IACpD,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,eAAe;IAC9B,UAAU,EAAE,YAAY;IAExB,wEAAwE;IACxE,GAAG,EAAE,KAAK;CACF,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cutting action (ADR-230 D3c) — trait-gated, implementation-dispatching.
|
|
3
|
+
*
|
|
4
|
+
* The action itself performs NO mutation. CuttableTrait gates eligibility
|
|
5
|
+
* and carries the author-configured tool requirement; the cut OUTCOME is
|
|
6
|
+
* the target entity's own registered implementation, on either surface
|
|
7
|
+
* (dual-surface re-pin, 2026-07-17):
|
|
8
|
+
* - an ADR-090 capability behavior registered for if.action.cutting
|
|
9
|
+
* (TS authors), invoked from execute/report/blocked; or
|
|
10
|
+
* - an ADR-228 interceptor (Chord `on cutting it`) whose postExecute
|
|
11
|
+
* owns the mutation and whose postReport owns the narration.
|
|
12
|
+
*
|
|
13
|
+
* A cuttable entity with NEITHER surface refuses with cant_cut — the
|
|
14
|
+
* runtime safety net behind the Chord loader's load-time check.
|
|
15
|
+
*
|
|
16
|
+
* Four-phase pattern (ADR-051):
|
|
17
|
+
* 1. validate: cuttable gate, tool requirement, implementation presence
|
|
18
|
+
* 2. execute: delegate to the capability behavior, if that's the surface
|
|
19
|
+
* 3. report: behavior effects, or the standard cut event for interceptors
|
|
20
|
+
* 4. blocked: standard blocked event through the lifecycle engine
|
|
21
|
+
*/
|
|
22
|
+
import { Action } from '../../enhanced-types';
|
|
23
|
+
import { ActionMetadata } from '../../../validation';
|
|
24
|
+
import { ActionLifecycleDescriptor } from '../../lifecycle';
|
|
25
|
+
/**
|
|
26
|
+
* Interceptor surface (ADR-228, ADR-230 D3c): the cut target and any
|
|
27
|
+
* explicit tool are the consultable entities of a CUT command, published
|
|
28
|
+
* order target → tool (D3-B). Explicit tools only — mirrors locking's key
|
|
29
|
+
* slot (ADR-229 R2).
|
|
30
|
+
*/
|
|
31
|
+
export declare const cuttingLifecycle: ActionLifecycleDescriptor;
|
|
32
|
+
export declare const cuttingAction: Action & {
|
|
33
|
+
metadata: ActionMetadata;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=cutting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cutting.d.ts","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/cutting/cutting.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,MAAM,EAAmC,MAAM,sBAAsB,CAAC;AAU/E,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAKrD,OAAO,EACL,yBAAyB,EAQ1B,MAAM,iBAAiB,CAAC;AAEzB;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,EAAE,yBA6B9B,CAAC;AAqBF,eAAO,MAAM,aAAa,EAAE,MAAM,GAAG;IAAE,QAAQ,EAAE,cAAc,CAAA;CAqL9D,CAAC"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Cutting action (ADR-230 D3c) — trait-gated, implementation-dispatching.
|
|
4
|
+
*
|
|
5
|
+
* The action itself performs NO mutation. CuttableTrait gates eligibility
|
|
6
|
+
* and carries the author-configured tool requirement; the cut OUTCOME is
|
|
7
|
+
* the target entity's own registered implementation, on either surface
|
|
8
|
+
* (dual-surface re-pin, 2026-07-17):
|
|
9
|
+
* - an ADR-090 capability behavior registered for if.action.cutting
|
|
10
|
+
* (TS authors), invoked from execute/report/blocked; or
|
|
11
|
+
* - an ADR-228 interceptor (Chord `on cutting it`) whose postExecute
|
|
12
|
+
* owns the mutation and whose postReport owns the narration.
|
|
13
|
+
*
|
|
14
|
+
* A cuttable entity with NEITHER surface refuses with cant_cut — the
|
|
15
|
+
* runtime safety net behind the Chord loader's load-time check.
|
|
16
|
+
*
|
|
17
|
+
* Four-phase pattern (ADR-051):
|
|
18
|
+
* 1. validate: cuttable gate, tool requirement, implementation presence
|
|
19
|
+
* 2. execute: delegate to the capability behavior, if that's the surface
|
|
20
|
+
* 3. report: behavior effects, or the standard cut event for interceptors
|
|
21
|
+
* 4. blocked: standard blocked event through the lifecycle engine
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.cuttingAction = exports.cuttingLifecycle = void 0;
|
|
25
|
+
const world_model_1 = require("@sharpee/world-model");
|
|
26
|
+
const constants_1 = require("../../constants");
|
|
27
|
+
const types_1 = require("../../../scope/types");
|
|
28
|
+
const cutting_messages_1 = require("./cutting-messages");
|
|
29
|
+
const tool_shared_1 = require("../tool-shared");
|
|
30
|
+
const utils_1 = require("../../../utils");
|
|
31
|
+
const lifecycle_1 = require("../../lifecycle");
|
|
32
|
+
/**
|
|
33
|
+
* Interceptor surface (ADR-228, ADR-230 D3c): the cut target and any
|
|
34
|
+
* explicit tool are the consultable entities of a CUT command, published
|
|
35
|
+
* order target → tool (D3-B). Explicit tools only — mirrors locking's key
|
|
36
|
+
* slot (ADR-229 R2).
|
|
37
|
+
*/
|
|
38
|
+
exports.cuttingLifecycle = {
|
|
39
|
+
actionId: constants_1.IFActions.CUTTING,
|
|
40
|
+
slots: [
|
|
41
|
+
{
|
|
42
|
+
id: 'target',
|
|
43
|
+
actionIds: [constants_1.IFActions.CUTTING],
|
|
44
|
+
resolve: (ctx) => ctx.command.directObject?.entity,
|
|
45
|
+
seedData: (ctx, entity) => {
|
|
46
|
+
const tool = ctx.command.instrument?.entity ?? ctx.command.indirectObject?.entity;
|
|
47
|
+
return {
|
|
48
|
+
targetId: entity.id,
|
|
49
|
+
targetName: entity.name,
|
|
50
|
+
toolId: tool?.id,
|
|
51
|
+
toolName: tool?.name
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: 'tool',
|
|
57
|
+
actionIds: [constants_1.IFActions.CUTTING],
|
|
58
|
+
resolve: (ctx) => ctx.command.instrument?.entity ?? ctx.command.indirectObject?.entity,
|
|
59
|
+
seedData: (ctx, entity) => ({
|
|
60
|
+
toolId: entity.id,
|
|
61
|
+
toolName: entity.name,
|
|
62
|
+
targetId: ctx.command.directObject?.entity?.id,
|
|
63
|
+
targetName: ctx.command.directObject?.entity?.name
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Convert capability effects to semantic events. Effect messageIds are
|
|
70
|
+
* forwarded unchanged — implementations MUST emit fully-qualified ids
|
|
71
|
+
* (stdlib CLAUDE.md capability-effect rule; short keys render blank on
|
|
72
|
+
* the universal dispatch path).
|
|
73
|
+
*/
|
|
74
|
+
function effectsToEvents(effects, context) {
|
|
75
|
+
return effects.map((effect) => context.event(effect.type, { ...effect.payload }));
|
|
76
|
+
}
|
|
77
|
+
exports.cuttingAction = {
|
|
78
|
+
id: constants_1.IFActions.CUTTING,
|
|
79
|
+
defaultScope: {
|
|
80
|
+
target: types_1.ScopeLevel.REACHABLE
|
|
81
|
+
},
|
|
82
|
+
requiresHolding: false,
|
|
83
|
+
requiredMessages: [
|
|
84
|
+
'no_target',
|
|
85
|
+
'not_cuttable',
|
|
86
|
+
'cant_cut',
|
|
87
|
+
'no_tool',
|
|
88
|
+
'tool_not_held',
|
|
89
|
+
'wrong_tool',
|
|
90
|
+
'cut'
|
|
91
|
+
],
|
|
92
|
+
metadata: {
|
|
93
|
+
requiresDirectObject: true,
|
|
94
|
+
requiresIndirectObject: false,
|
|
95
|
+
directObjectScope: types_1.ScopeLevel.REACHABLE
|
|
96
|
+
},
|
|
97
|
+
group: 'manipulation',
|
|
98
|
+
validate(context) {
|
|
99
|
+
const noun = context.command.directObject?.entity;
|
|
100
|
+
if (!noun) {
|
|
101
|
+
return { valid: false, error: cutting_messages_1.CuttingMessages.NO_TARGET };
|
|
102
|
+
}
|
|
103
|
+
const state = (0, lifecycle_1.resolveLifecycle)(context, exports.cuttingLifecycle);
|
|
104
|
+
const preVeto = (0, lifecycle_1.runPreValidate)(context, state);
|
|
105
|
+
if (preVeto)
|
|
106
|
+
return preVeto;
|
|
107
|
+
const scopeCheck = context.requireScope(noun, types_1.ScopeLevel.REACHABLE);
|
|
108
|
+
if (!scopeCheck.ok) {
|
|
109
|
+
return scopeCheck.error;
|
|
110
|
+
}
|
|
111
|
+
// Eligibility gate: only a cuttable entity can be cut.
|
|
112
|
+
if (!noun.has(world_model_1.TraitType.CUTTABLE)) {
|
|
113
|
+
return {
|
|
114
|
+
valid: false,
|
|
115
|
+
error: cutting_messages_1.CuttingMessages.NOT_CUTTABLE,
|
|
116
|
+
params: { item: (0, utils_1.nounPhraseFor)(noun) }
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
// Author-configured tool requirement (shared helper, PIN 2).
|
|
120
|
+
const tool = context.command.instrument?.entity ?? context.command.indirectObject?.entity;
|
|
121
|
+
const toolValidation = (0, tool_shared_1.validateToolRequirements)(context, noun, tool, world_model_1.CuttableBehavior.requiresTool(noun), (toolId) => world_model_1.CuttableBehavior.canCutWith(noun, toolId));
|
|
122
|
+
if (toolValidation) {
|
|
123
|
+
return toolValidation;
|
|
124
|
+
}
|
|
125
|
+
// Implementation presence (dual-surface): a capability behavior on one
|
|
126
|
+
// of the target's traits, or an interceptor consulting this action.
|
|
127
|
+
const capabilityTrait = (0, world_model_1.findTraitWithCapability)(noun, constants_1.IFActions.CUTTING);
|
|
128
|
+
const behavior = capabilityTrait
|
|
129
|
+
? context.world.getBehaviorForCapability(capabilityTrait, constants_1.IFActions.CUTTING)
|
|
130
|
+
: undefined;
|
|
131
|
+
const hasInterceptor = !!context.world.getInterceptorForAction(noun, constants_1.IFActions.CUTTING);
|
|
132
|
+
if (!behavior && !hasInterceptor) {
|
|
133
|
+
// Runtime safety net — the Chord loader's post-load check is the
|
|
134
|
+
// primary catch for unimplemented cuttables.
|
|
135
|
+
return {
|
|
136
|
+
valid: false,
|
|
137
|
+
error: cutting_messages_1.CuttingMessages.CANT_CUT,
|
|
138
|
+
params: { item: (0, utils_1.nounPhraseFor)(noun) }
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
let data;
|
|
142
|
+
if (behavior) {
|
|
143
|
+
const sharedData = {};
|
|
144
|
+
const behaviorResult = behavior.validate(noun, context.world, context.player.id, sharedData);
|
|
145
|
+
if (!behaviorResult.valid) {
|
|
146
|
+
return {
|
|
147
|
+
valid: false,
|
|
148
|
+
error: behaviorResult.error,
|
|
149
|
+
params: behaviorResult.params
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
data = { behavior, sharedData };
|
|
153
|
+
}
|
|
154
|
+
const postVeto = (0, lifecycle_1.runPostValidate)(context, state);
|
|
155
|
+
if (postVeto)
|
|
156
|
+
return postVeto;
|
|
157
|
+
return { valid: true, data };
|
|
158
|
+
},
|
|
159
|
+
/**
|
|
160
|
+
* Execute — the action mutates NOTHING itself. A capability-behavior
|
|
161
|
+
* implementation runs here; an interceptor implementation runs in its
|
|
162
|
+
* own postExecute hook via the lifecycle engine.
|
|
163
|
+
*/
|
|
164
|
+
execute(context) {
|
|
165
|
+
const noun = context.command.directObject.entity;
|
|
166
|
+
const data = context.validationResult?.data;
|
|
167
|
+
if (data?.behavior) {
|
|
168
|
+
data.behavior.execute(noun, context.world, context.player.id, data.sharedData);
|
|
169
|
+
context.sharedData.cuttingDispatch = data;
|
|
170
|
+
}
|
|
171
|
+
const state = (0, lifecycle_1.getLifecycleState)(context);
|
|
172
|
+
if (state)
|
|
173
|
+
(0, lifecycle_1.runPostExecute)(context, state);
|
|
174
|
+
},
|
|
175
|
+
report(context) {
|
|
176
|
+
const noun = context.command.directObject.entity;
|
|
177
|
+
const tool = context.command.instrument?.entity ?? context.command.indirectObject?.entity;
|
|
178
|
+
const data = (context.sharedData.cuttingDispatch ?? context.validationResult?.data);
|
|
179
|
+
let events;
|
|
180
|
+
if (data?.behavior) {
|
|
181
|
+
// Capability surface: the implementation owns the narration.
|
|
182
|
+
events = effectsToEvents(data.behavior.report(noun, context.world, context.player.id, data.sharedData), context);
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
// Interceptor surface: standard cut event; the implementation's
|
|
186
|
+
// postReport override typically replaces the generic message.
|
|
187
|
+
events = [
|
|
188
|
+
context.event('if.event.cut', {
|
|
189
|
+
messageId: `${context.action.id}.${cutting_messages_1.CuttingMessages.CUT}`,
|
|
190
|
+
params: { item: (0, utils_1.nounPhraseFor)(noun), tool: tool ? (0, utils_1.nounPhraseFor)(tool) : undefined },
|
|
191
|
+
targetId: noun.id,
|
|
192
|
+
targetName: noun.name,
|
|
193
|
+
toolId: tool?.id,
|
|
194
|
+
toolName: tool?.name,
|
|
195
|
+
actorId: context.player.id
|
|
196
|
+
})
|
|
197
|
+
];
|
|
198
|
+
}
|
|
199
|
+
const state = (0, lifecycle_1.getLifecycleState)(context);
|
|
200
|
+
if (state)
|
|
201
|
+
(0, lifecycle_1.runPostReport)(context, state, events, 'if.event.cut');
|
|
202
|
+
return events;
|
|
203
|
+
},
|
|
204
|
+
blocked(context, result) {
|
|
205
|
+
const noun = context.command.directObject?.entity;
|
|
206
|
+
const error = result.error || '';
|
|
207
|
+
const messageId = error.includes('.') ? error : `${context.action.id}.${error}`;
|
|
208
|
+
const events = [
|
|
209
|
+
context.event('if.event.cut_blocked', {
|
|
210
|
+
messageId,
|
|
211
|
+
params: {
|
|
212
|
+
...result.params,
|
|
213
|
+
item: noun ? (0, utils_1.nounPhraseFor)(noun) : undefined
|
|
214
|
+
},
|
|
215
|
+
targetId: noun?.id,
|
|
216
|
+
targetName: noun?.name,
|
|
217
|
+
reason: result.error
|
|
218
|
+
})
|
|
219
|
+
];
|
|
220
|
+
if (result.error) {
|
|
221
|
+
const state = (0, lifecycle_1.getLifecycleState)(context);
|
|
222
|
+
if (state)
|
|
223
|
+
(0, lifecycle_1.runOnBlocked)(context, state, events, 'if.event.cut_blocked', result.error);
|
|
224
|
+
}
|
|
225
|
+
return events;
|
|
226
|
+
}
|
|
227
|
+
};
|
|
228
|
+
//# sourceMappingURL=cutting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cutting.js","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/cutting/cutting.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;AAIH,sDAM8B;AAC9B,+CAA4C;AAE5C,gDAAkD;AAClD,yDAAqD;AACrD,gDAA0D;AAC1D,0CAA+C;AAC/C,+CASyB;AAEzB;;;;;GAKG;AACU,QAAA,gBAAgB,GAA8B;IACzD,QAAQ,EAAE,qBAAS,CAAC,OAAO;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
|
1
|
+
/**
|
|
2
|
+
* Cutting action (ADR-230 D3c) — public exports.
|
|
3
|
+
*/
|
|
4
|
+
export { cuttingAction, cuttingLifecycle } from './cutting';
|
|
5
|
+
export { CuttingMessages } from './cutting-messages';
|
|
6
|
+
export type { CuttingMessageId } from './cutting-messages';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/cutting/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CuttingMessages = exports.cuttingLifecycle = exports.cuttingAction = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Cutting action (ADR-230 D3c) — public exports.
|
|
6
|
+
*/
|
|
7
|
+
var cutting_1 = require("./cutting");
|
|
8
|
+
Object.defineProperty(exports, "cuttingAction", { enumerable: true, get: function () { return cutting_1.cuttingAction; } });
|
|
9
|
+
Object.defineProperty(exports, "cuttingLifecycle", { enumerable: true, get: function () { return cutting_1.cuttingLifecycle; } });
|
|
10
|
+
var cutting_messages_1 = require("./cutting-messages");
|
|
11
|
+
Object.defineProperty(exports, "CuttingMessages", { enumerable: true, get: function () { return cutting_messages_1.CuttingMessages; } });
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/cutting/index.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,qCAA4D;AAAnD,wGAAA,aAAa,OAAA;AAAE,2GAAA,gBAAgB,OAAA;AACxC,uDAAqD;AAA5C,mHAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deadly-room death action (ADR-224) — the generic redirect target.
|
|
3
|
+
*
|
|
4
|
+
* Not parseable: it has no grammar. The deadly-room command transformer redirects a
|
|
5
|
+
* lethal verb here, threading the death `cause`/`messageId` through the parsed
|
|
6
|
+
* command's `extras`. `execute` applies the lethal transition via `killPlayer`
|
|
7
|
+
* (mutation belongs in execute, ADR-051) and `report` emits the canonical death
|
|
8
|
+
* event it produced. Folds MDL's story-specific falls-death action into one platform
|
|
9
|
+
* primitive shared by every deadly room.
|
|
10
|
+
*
|
|
11
|
+
* Public interface: `deadlyRoomDeathAction`.
|
|
12
|
+
* Owner context: `@sharpee/stdlib` — the player-death primitive (ADR-224).
|
|
13
|
+
*/
|
|
14
|
+
import { Action } from '../../enhanced-types';
|
|
15
|
+
export declare const deadlyRoomDeathAction: Action;
|
|
16
|
+
//# sourceMappingURL=deadly-room-death.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deadly-room-death.d.ts","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/deadly-room-death/deadly-room-death.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,MAAM,EAAmC,MAAM,sBAAsB,CAAC;AAa/E,eAAO,MAAM,qBAAqB,EAAE,MA8BnC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Deadly-room death action (ADR-224) — the generic redirect target.
|
|
4
|
+
*
|
|
5
|
+
* Not parseable: it has no grammar. The deadly-room command transformer redirects a
|
|
6
|
+
* lethal verb here, threading the death `cause`/`messageId` through the parsed
|
|
7
|
+
* command's `extras`. `execute` applies the lethal transition via `killPlayer`
|
|
8
|
+
* (mutation belongs in execute, ADR-051) and `report` emits the canonical death
|
|
9
|
+
* event it produced. Folds MDL's story-specific falls-death action into one platform
|
|
10
|
+
* primitive shared by every deadly room.
|
|
11
|
+
*
|
|
12
|
+
* Public interface: `deadlyRoomDeathAction`.
|
|
13
|
+
* Owner context: `@sharpee/stdlib` — the player-death primitive (ADR-224).
|
|
14
|
+
*/
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
exports.deadlyRoomDeathAction = void 0;
|
|
17
|
+
const death_1 = require("../../../death");
|
|
18
|
+
exports.deadlyRoomDeathAction = {
|
|
19
|
+
id: death_1.DEADLY_ROOM_DEATH_ACTION_ID,
|
|
20
|
+
group: 'special',
|
|
21
|
+
validate(_context) {
|
|
22
|
+
// Death is inevitable once redirected here — the transformer already decided.
|
|
23
|
+
return { valid: true };
|
|
24
|
+
},
|
|
25
|
+
execute(context) {
|
|
26
|
+
const extras = context.command.parsed?.extras ?? {};
|
|
27
|
+
const cause = extras[death_1.DEADLY_ROOM_CAUSE_KEY] ?? 'hazard';
|
|
28
|
+
const messageId = extras[death_1.DEADLY_ROOM_MESSAGE_KEY];
|
|
29
|
+
const event = (0, death_1.killPlayer)(context.world, context.player, {
|
|
30
|
+
cause,
|
|
31
|
+
messageId,
|
|
32
|
+
terminal: true,
|
|
33
|
+
});
|
|
34
|
+
context.sharedData.deadlyRoomDeathEvent = event;
|
|
35
|
+
},
|
|
36
|
+
blocked(_context, _result) {
|
|
37
|
+
return [];
|
|
38
|
+
},
|
|
39
|
+
report(context) {
|
|
40
|
+
const event = context.sharedData.deadlyRoomDeathEvent;
|
|
41
|
+
return event ? [event] : [];
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=deadly-room-death.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deadly-room-death.js","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/deadly-room-death/deadly-room-death.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAIH,0CAKwB;AAOX,QAAA,qBAAqB,GAAW;IAC3C,EAAE,EAAE,mCAA2B;IAC/B,KAAK,EAAE,SAAS;IAEhB,QAAQ,CAAC,QAAuB;QAC9B,8EAA8E;QAC9E,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IACzB,CAAC;IAED,OAAO,CAAC,OAAsB;QAC5B,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,IAAI,EAAE,CAAC;QACpD,MAAM,KAAK,GAAI,MAAM,CAAC,6BAAqB,CAAwB,IAAI,QAAQ,CAAC;QAChF,MAAM,SAAS,GAAG,MAAM,CAAC,+BAAuB,CAAuB,CAAC;QAExE,MAAM,KAAK,GAAG,IAAA,kBAAU,EAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,EAAE;YACtD,KAAK;YACL,SAAS;YACT,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;QACF,OAAO,CAAC,UAAwC,CAAC,oBAAoB,GAAG,KAAK,CAAC;IACjF,CAAC;IAED,OAAO,CAAC,QAAuB,EAAE,OAAyB;QACxD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,CAAC,OAAsB;QAC3B,MAAM,KAAK,GAAI,OAAO,CAAC,UAAwC,CAAC,oBAAoB,CAAC;QACrF,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9B,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/deadly-room-death/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deadlyRoomDeathAction = void 0;
|
|
4
|
+
var deadly_room_death_1 = require("./deadly-room-death");
|
|
5
|
+
Object.defineProperty(exports, "deadlyRoomDeathAction", { enumerable: true, get: function () { return deadly_room_death_1.deadlyRoomDeathAction; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../../repos/sharpee_v2/packages/stdlib/src/actions/standard/deadly-room-death/index.ts"],"names":[],"mappings":";;;AAAA,yDAA4D;AAAnD,0HAAA,qBAAqB,OAAA"}
|