@listen-fire/engine 0.15.1 → 0.15.3
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/dist/services/movement_engine/call_depth.d.ts +14 -6
- package/dist/services/movement_engine/call_depth.js +25 -9
- package/dist/services/movement_engine/rust_engine.js +16 -4
- package/dist/services/plugins/registry.js +15 -1
- package/dist/services/translation_graph/movement/schema_projection.js +5 -2
- package/package.json +4 -4
|
@@ -9,15 +9,23 @@ export declare function parseMaxCallDepth(raw: string | undefined): number;
|
|
|
9
9
|
export declare function assertMaxCallDepthConfigured(env?: NodeJS.ProcessEnv): void;
|
|
10
10
|
/** Read per call so ops (and tests) can move the limit without a restart. */
|
|
11
11
|
export declare function maxCallDepth(): number;
|
|
12
|
-
/** Thrown at the call that would have gone one deeper than the limit
|
|
13
|
-
*
|
|
14
|
-
* the limit and
|
|
12
|
+
/** Thrown at the call that would have gone one deeper than the limit, or where
|
|
13
|
+
* the engine's stack ran out short of it. Its message is the whole failure
|
|
14
|
+
* surface an author sees, so it says the chain, the limit and what to do. */
|
|
15
15
|
export declare class CallDepthExceeded extends MovementEngineError {
|
|
16
16
|
readonly limit: number;
|
|
17
|
-
/** The run's movement, then each call it is inside, then the refused one.
|
|
17
|
+
/** The run's movement, then each call it is inside, then the refused one.
|
|
18
|
+
* Where the stack ran out: the calls the run was inside, or empty when the
|
|
19
|
+
* engine could not say. */
|
|
18
20
|
readonly chain: readonly string[];
|
|
21
|
+
/** The WASM engine's stack is fixed, so it can run out short of the limit. */
|
|
22
|
+
readonly stackRanOut: boolean;
|
|
19
23
|
constructor(limit: number,
|
|
20
|
-
/** The run's movement, then each call it is inside, then the refused one.
|
|
21
|
-
|
|
24
|
+
/** The run's movement, then each call it is inside, then the refused one.
|
|
25
|
+
* Where the stack ran out: the calls the run was inside, or empty when the
|
|
26
|
+
* engine could not say. */
|
|
27
|
+
chain: readonly string[],
|
|
28
|
+
/** The WASM engine's stack is fixed, so it can run out short of the limit. */
|
|
29
|
+
stackRanOut?: boolean);
|
|
22
30
|
}
|
|
23
31
|
export declare function isCallDepthExceeded(err: unknown): err is CallDepthExceeded;
|
|
@@ -63,25 +63,41 @@ function describeChain(chain) {
|
|
|
63
63
|
const omitted = chain.length - 10;
|
|
64
64
|
return [...chain.slice(0, 4), `… ${omitted} more …`, ...chain.slice(-6)].join(' → ');
|
|
65
65
|
}
|
|
66
|
-
/** Thrown at the call that would have gone one deeper than the limit
|
|
67
|
-
*
|
|
68
|
-
* the limit and
|
|
66
|
+
/** Thrown at the call that would have gone one deeper than the limit, or where
|
|
67
|
+
* the engine's stack ran out short of it. Its message is the whole failure
|
|
68
|
+
* surface an author sees, so it says the chain, the limit and what to do. */
|
|
69
69
|
class CallDepthExceeded extends errors_1.MovementEngineError {
|
|
70
70
|
limit;
|
|
71
71
|
chain;
|
|
72
|
+
stackRanOut;
|
|
72
73
|
constructor(limit,
|
|
73
|
-
/** The run's movement, then each call it is inside, then the refused one.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
/** The run's movement, then each call it is inside, then the refused one.
|
|
75
|
+
* Where the stack ran out: the calls the run was inside, or empty when the
|
|
76
|
+
* engine could not say. */
|
|
77
|
+
chain,
|
|
78
|
+
/** The WASM engine's stack is fixed, so it can run out short of the limit. */
|
|
79
|
+
stackRanOut = false) {
|
|
80
|
+
super('MOVENG_CALL_DEPTH', stackRanOut ? stackRanOutMessage(limit, chain) : limitReachedMessage(limit, chain));
|
|
79
81
|
this.limit = limit;
|
|
80
82
|
this.chain = chain;
|
|
83
|
+
this.stackRanOut = stackRanOut;
|
|
81
84
|
this.name = 'CallDepthExceeded';
|
|
82
85
|
}
|
|
83
86
|
}
|
|
84
87
|
exports.CallDepthExceeded = CallDepthExceeded;
|
|
88
|
+
function limitReachedMessage(limit, chain) {
|
|
89
|
+
return (`call depth limit reached: '${describeChain(chain)}' would nest ${chain.length - 1} calls deep, ` +
|
|
90
|
+
`and the limit set by ${exports.CALL_DEPTH_ENV_VAR} is ${limit}. The run was stopped in case a recursion never ` +
|
|
91
|
+
'reaches the case that ends it. If this run legitimately needs to go deeper, raise ' +
|
|
92
|
+
`${exports.CALL_DEPTH_ENV_VAR} in the server's environment.`);
|
|
93
|
+
}
|
|
94
|
+
function stackRanOutMessage(limit, chain) {
|
|
95
|
+
const where = chain.length === 0 ? '' : ` at '${describeChain(chain)}', ${chain.length - 1} calls deep`;
|
|
96
|
+
return (`the engine's stack ran out${where}, short of the call depth limit of ${limit} set by ${exports.CALL_DEPTH_ENV_VAR}. ` +
|
|
97
|
+
'How much a call takes depends on what it does, and this engine cannot add to its stack, so raising the limit ' +
|
|
98
|
+
'will not take this run deeper. The run was stopped in case a recursion never reaches the case that ends it. ' +
|
|
99
|
+
'If it legitimately goes this deep, make it go less deep: fewer calls, or a list worked through with a loop.');
|
|
100
|
+
}
|
|
85
101
|
function isCallDepthExceeded(err) {
|
|
86
102
|
return err instanceof CallDepthExceeded;
|
|
87
103
|
}
|
|
@@ -557,11 +557,23 @@ function failureOf(value, hostErrors) {
|
|
|
557
557
|
function openWasmEngine() {
|
|
558
558
|
const segment = (0, movement_lang_1.openEngineSegment)();
|
|
559
559
|
return {
|
|
560
|
-
start: (input) => readStep(segment.start(JSON.stringify(input)), 'start'),
|
|
561
|
-
answer: (id, answer) => readStep(segment.answer(id, JSON.stringify(answer)), `answer ${id}`),
|
|
560
|
+
start: (input) => endingInItsCodedError(() => readStep(segment.start(JSON.stringify(input)), 'start')),
|
|
561
|
+
answer: (id, answer) => endingInItsCodedError(() => readStep(segment.answer(id, JSON.stringify(answer)), `answer ${id}`)),
|
|
562
562
|
finish: () => segment.finish(),
|
|
563
563
|
};
|
|
564
564
|
}
|
|
565
|
+
/** V8's stack can run out before the engine's own check sees its own run low:
|
|
566
|
+
* the same end, with no chain to name, since the instance went with it. */
|
|
567
|
+
function endingInItsCodedError(step) {
|
|
568
|
+
try {
|
|
569
|
+
return step();
|
|
570
|
+
}
|
|
571
|
+
catch (error) {
|
|
572
|
+
if (error instanceof movement_lang_1.EngineStackRanOut)
|
|
573
|
+
throw new call_depth_1.CallDepthExceeded((0, call_depth_1.maxCallDepth)(), [], true);
|
|
574
|
+
throw error;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
565
577
|
function readStep(reply, call) {
|
|
566
578
|
const json = (0, rust_wire_1.record)(reply.json, `the Rust engine's ${call}`);
|
|
567
579
|
if (!reply.ok) {
|
|
@@ -601,11 +613,11 @@ function thrownBy(error) {
|
|
|
601
613
|
// A call past the depth limit: rebuilt from its limit and chain, message
|
|
602
614
|
// and all, as call_depth.ts builds it.
|
|
603
615
|
if (error.class === 'CallDepthExceeded') {
|
|
604
|
-
const { limit, chain } = error;
|
|
616
|
+
const { limit, chain, stackRanOut } = error;
|
|
605
617
|
if (typeof limit !== 'number' || !Array.isArray(chain) || !chain.every((name) => typeof name === 'string')) {
|
|
606
618
|
throw new rust_wire_1.RustShimError('a CallDepthExceeded carries its limit and its chain of names');
|
|
607
619
|
}
|
|
608
|
-
return new call_depth_1.CallDepthExceeded(limit, chain);
|
|
620
|
+
return new call_depth_1.CallDepthExceeded(limit, chain, stackRanOut === true);
|
|
609
621
|
}
|
|
610
622
|
const message = (0, rust_wire_1.string)(error.message, 'the Rust evaluator error message');
|
|
611
623
|
switch (error.class) {
|
|
@@ -215,7 +215,8 @@ const LINKEDIN_ENRICHMENT_SIGNATURE = {
|
|
|
215
215
|
};
|
|
216
216
|
const LINKEDIN_RESEARCH_SIGNATURE = {
|
|
217
217
|
name: 'linkedin-research',
|
|
218
|
-
description: "From a LinkedIn profile address, research what that person is currently doing — their role, their organisation, and their recent public activity — and attach a summary, a confidence,
|
|
218
|
+
description: "From a LinkedIn profile address, research what that person is currently doing — their role, their organisation, and their recent public activity — and attach a summary, a confidence, the sources it rests on, and the passages found about them. " +
|
|
219
|
+
'Passages with no summary mean the research could not confirm anything beyond that text.',
|
|
219
220
|
params: [
|
|
220
221
|
{
|
|
221
222
|
name: 'url',
|
|
@@ -224,6 +225,12 @@ const LINKEDIN_RESEARCH_SIGNATURE = {
|
|
|
224
225
|
description: 'The LinkedIn profile address of the person to research. Normally a field an earlier ' +
|
|
225
226
|
'stage extracted, so each person is researched from their own address.',
|
|
226
227
|
},
|
|
228
|
+
{
|
|
229
|
+
name: 'context',
|
|
230
|
+
type: { kind: 'string' },
|
|
231
|
+
description: 'Text the caller already has about this person, such as the message that mentioned them. ' +
|
|
232
|
+
'It guides the search and is never evidence alone.',
|
|
233
|
+
},
|
|
227
234
|
],
|
|
228
235
|
// The address comes from the fields the enclosing extract has produced, and
|
|
229
236
|
// the record's other fields are the extra search terms, so this only makes
|
|
@@ -239,6 +246,7 @@ const LINKEDIN_RESEARCH_SIGNATURE = {
|
|
|
239
246
|
current_role: { kind: 'string' },
|
|
240
247
|
current_organisation: { kind: 'string' },
|
|
241
248
|
activity_sources: { kind: 'string' },
|
|
249
|
+
activity_text: { kind: 'string' },
|
|
242
250
|
},
|
|
243
251
|
},
|
|
244
252
|
// What the person is currently doing, read by name. Every field is optional:
|
|
@@ -272,6 +280,12 @@ const LINKEDIN_RESEARCH_SIGNATURE = {
|
|
|
272
280
|
optional: true,
|
|
273
281
|
description: 'The addresses the reading rests on, one per line.',
|
|
274
282
|
},
|
|
283
|
+
activity_text: {
|
|
284
|
+
type: { kind: 'string' },
|
|
285
|
+
optional: true,
|
|
286
|
+
description: 'Passages that name this person and something tying them to this identity, each under its source ' +
|
|
287
|
+
'address. Can arrive alone, with no summary and no confidence: research could not confirm anything beyond that text.',
|
|
288
|
+
},
|
|
275
289
|
},
|
|
276
290
|
},
|
|
277
291
|
};
|
|
@@ -387,6 +387,8 @@ function instanceSchemaFromDescriptors(input) {
|
|
|
387
387
|
continue;
|
|
388
388
|
}
|
|
389
389
|
typeIdByName.set(name, entry.typeId);
|
|
390
|
+
const descriptor = input.descriptors.get(entry.typeId);
|
|
391
|
+
const typeDescription = (descriptor !== undefined ? describedBy(descriptor) : undefined) ?? describedBy(entry);
|
|
390
392
|
// Every entry point IS a meta edge off the adapter's meta position — the
|
|
391
393
|
// node the cursor starts at. A READABLE entry's edge is a traversable
|
|
392
394
|
// collection (`root-[c:Companies]-> …`); a WRITABLE entry's edge is how you
|
|
@@ -410,16 +412,18 @@ function instanceSchemaFromDescriptors(input) {
|
|
|
410
412
|
// The root descriptor's word on the collection, else the entry's
|
|
411
413
|
// own: a host that asks no root descriptor (listen-fire) reads it there.
|
|
412
414
|
const capability = rootCapabilities.get(collectionName) ?? entry.capability;
|
|
415
|
+
const positioned = entry.readable || entry.listenable === true || edgeTargetNames.has(name);
|
|
413
416
|
collections[collectionName] = {
|
|
414
417
|
target: name,
|
|
415
418
|
...(capability !== undefined ? { capability } : {}),
|
|
416
419
|
...(entry.readable ? {} : { readable: false }),
|
|
417
420
|
...(entry.listenable === true ? { listenable: true } : {}),
|
|
418
421
|
...listeningOf(entry),
|
|
422
|
+
// A type with no position has nowhere else to say what it is.
|
|
423
|
+
...(!positioned && typeDescription !== undefined ? { description: typeDescription } : {}),
|
|
419
424
|
};
|
|
420
425
|
}
|
|
421
426
|
}
|
|
422
|
-
const descriptor = input.descriptors.get(entry.typeId);
|
|
423
427
|
if (!descriptor) {
|
|
424
428
|
// No descriptor came back for this entry — describe() answered null, or a
|
|
425
429
|
// demand-scoped introspection never asked. The position exists; NOBODY HAS
|
|
@@ -664,7 +668,6 @@ function instanceSchemaFromDescriptors(input) {
|
|
|
664
668
|
//
|
|
665
669
|
// `listenable` is not gated on `readable`, and that is the point: nobody
|
|
666
670
|
// can enumerate an inbox, so its entry says `readable: false` honestly.
|
|
667
|
-
const typeDescription = describedBy(descriptor) ?? describedBy(entry);
|
|
668
671
|
positions[name] = {
|
|
669
672
|
properties,
|
|
670
673
|
edges,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@listen-fire/engine",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "0.15.
|
|
4
|
+
"version": "0.15.3",
|
|
5
5
|
"description": "The movement engine for this release's language and its host contract: the Rust engine's shim, the EngineHost families, the run host, the embed kit, and the adapter and model types they reach. Every shell (the hosted product, the `listen-fire` command line, an embedder) runs the same engine. A run pinned to a release this one does not read is refused by name. Embedders reach it only through public/* (the exports map); the internals resolve only under the `movement-engine-internals` condition, which only test runners set",
|
|
6
6
|
"engines": {
|
|
7
7
|
"node": ">=22.23.4 <23"
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"safe-stable-stringify": "2.5.0",
|
|
19
19
|
"zod": "4.1.12",
|
|
20
|
-
"@listen-fire/
|
|
21
|
-
"@listen-fire/
|
|
22
|
-
"@listen-fire/
|
|
20
|
+
"@listen-fire/module-runtime": "^0.12.8",
|
|
21
|
+
"@listen-fire/engine-contracts": "^0.15.3",
|
|
22
|
+
"@listen-fire/movement-lang": "^0.15.3"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/jest": "29.5.14",
|