@listen-fire/engine 0.16.0 → 0.16.1
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/public/log.d.ts +1 -1
- package/dist/public/log.js +2 -2
- package/dist/public/movement-engine.d.ts +2 -1
- package/dist/public/movement-engine.js +2 -1
- package/dist/services/logger.d.ts +2 -1
- package/dist/services/logger.js +7 -5
- package/dist/services/movement_engine/program_check.d.ts +13 -3
- package/dist/services/movement_engine/program_check.js +20 -5
- package/dist/services/movement_engine/rust_engine.d.ts +2 -1
- package/dist/services/movement_engine/rust_engine.js +3 -2
- package/dist/services/translation_graph/triggers/listen_plans.d.ts +16 -6
- package/dist/services/translation_graph/triggers/listen_plans.js +28 -10
- package/package.json +3 -3
package/dist/public/log.d.ts
CHANGED
|
@@ -3,6 +3,6 @@ export { consoleLogHook, formatEngineLogLine, jsonLogsEnabled, logger, type Engi
|
|
|
3
3
|
export * from '../services/context/current_id';
|
|
4
4
|
/** What `routeEngineLogsTo` hands each line to. */
|
|
5
5
|
export type EngineLogSink = EngineLogHook;
|
|
6
|
-
/** Send every engine log line to `sink` instead of
|
|
6
|
+
/** Send every engine log line to `sink` instead of stderr. Returns a
|
|
7
7
|
* function that puts the previous hook back. */
|
|
8
8
|
export declare function routeEngineLogsTo(sink: EngineLogHook): () => void;
|
package/dist/public/log.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// The engine's logger, and the way an embedder takes its lines. By default
|
|
3
|
-
// they go to
|
|
3
|
+
// they go to stderr; `routeEngineLogsTo` replaces that with the
|
|
4
4
|
// embedder's own sink (the CLI's output, a test's capture, the hosted
|
|
5
5
|
// product's logging library) without touching the code that logs.
|
|
6
6
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
@@ -28,7 +28,7 @@ Object.defineProperty(exports, "jsonLogsEnabled", { enumerable: true, get: funct
|
|
|
28
28
|
Object.defineProperty(exports, "logger", { enumerable: true, get: function () { return logger_2.logger; } });
|
|
29
29
|
// The request context id each line carries, read from the shell's own context.
|
|
30
30
|
__exportStar(require("../services/context/current_id"), exports);
|
|
31
|
-
/** Send every engine log line to `sink` instead of
|
|
31
|
+
/** Send every engine log line to `sink` instead of stderr. Returns a
|
|
32
32
|
* function that puts the previous hook back. */
|
|
33
33
|
function routeEngineLogsTo(sink) {
|
|
34
34
|
return (0, logger_1.setEngineLogHook)(sink);
|
|
@@ -4,8 +4,9 @@ export type { CancelGate, MovementRunResult, MovementWriteRecord, ParkSink, Resu
|
|
|
4
4
|
export { assertEngineConfigured } from '../services/movement_engine/rust_engine';
|
|
5
5
|
export * from '../services/movement_engine/rust_stats';
|
|
6
6
|
export * as programCheck from '../services/movement_engine/program_check';
|
|
7
|
-
export { checkAnswerInRust, checkPinnedInRust, parsePinned, throwIfBlocking, type CheckAnswer, type CheckInput, type LinkData, type LinkedImportData, type Stamp, } from '../services/movement_engine/program_check';
|
|
7
|
+
export { checkAnswerInRust, checkPinnedInRust, functionWalksOf, parsePinned, throwIfBlocking, type CheckAnswer, type CheckInput, type LinkData, type LinkedImportData, type Stamp, } from '../services/movement_engine/program_check';
|
|
8
8
|
export { checkInputOf } from '../services/movement_engine/rust_run';
|
|
9
|
+
export type { FunctionWalk, WalkHop } from '@listen-fire/engine-contracts';
|
|
9
10
|
/** This release of the engine, which is the language it reads
|
|
10
11
|
* (`LANGUAGE_VERSION`): a run pinned to a release of another compatibility
|
|
11
12
|
* key is refused by name. */
|
|
@@ -29,7 +29,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
29
29
|
return result;
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.ENGINE_VERSION = exports.checkInputOf = exports.throwIfBlocking = exports.parsePinned = exports.checkPinnedInRust = exports.checkAnswerInRust = exports.programCheck = exports.assertEngineConfigured = exports.runFailureCause = exports.RunCancelledSignal = exports.MovementRunFailed = exports.settleRaceFrame = exports.runMovement = exports.resumeMovement = void 0;
|
|
32
|
+
exports.ENGINE_VERSION = exports.checkInputOf = exports.throwIfBlocking = exports.parsePinned = exports.functionWalksOf = exports.checkPinnedInRust = exports.checkAnswerInRust = exports.programCheck = exports.assertEngineConfigured = exports.runFailureCause = exports.RunCancelledSignal = exports.MovementRunFailed = exports.settleRaceFrame = exports.runMovement = exports.resumeMovement = void 0;
|
|
33
33
|
const movement_lang_1 = require("@listen-fire/movement-lang");
|
|
34
34
|
var rust_run_1 = require("../services/movement_engine/rust_run");
|
|
35
35
|
Object.defineProperty(exports, "resumeMovement", { enumerable: true, get: function () { return rust_run_1.resumeMovement; } });
|
|
@@ -48,6 +48,7 @@ exports.programCheck = __importStar(require("../services/movement_engine/program
|
|
|
48
48
|
var program_check_1 = require("../services/movement_engine/program_check");
|
|
49
49
|
Object.defineProperty(exports, "checkAnswerInRust", { enumerable: true, get: function () { return program_check_1.checkAnswerInRust; } });
|
|
50
50
|
Object.defineProperty(exports, "checkPinnedInRust", { enumerable: true, get: function () { return program_check_1.checkPinnedInRust; } });
|
|
51
|
+
Object.defineProperty(exports, "functionWalksOf", { enumerable: true, get: function () { return program_check_1.functionWalksOf; } });
|
|
51
52
|
Object.defineProperty(exports, "parsePinned", { enumerable: true, get: function () { return program_check_1.parsePinned; } });
|
|
52
53
|
Object.defineProperty(exports, "throwIfBlocking", { enumerable: true, get: function () { return program_check_1.throwIfBlocking; } });
|
|
53
54
|
var rust_run_2 = require("../services/movement_engine/rust_run");
|
|
@@ -12,7 +12,8 @@ declare const jsonLogsEnabled: boolean;
|
|
|
12
12
|
export declare function formatEngineLogLine({ level, message, meta }: EngineLogLine, { colour }?: {
|
|
13
13
|
colour?: boolean;
|
|
14
14
|
}): string;
|
|
15
|
-
/** Prints to
|
|
15
|
+
/** Prints to stderr, every level: what the engine logs never mixes into the
|
|
16
|
+
* output of the program that embeds it. */
|
|
16
17
|
export declare const consoleLogHook: EngineLogHook;
|
|
17
18
|
/** Send every engine log line to `next` instead. Returns a function that puts
|
|
18
19
|
* the previous hook back. */
|
package/dist/services/logger.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// The engine's logger: four levels, each line handed to ONE hook. The default
|
|
3
|
-
// hook prints to
|
|
4
|
-
//
|
|
5
|
-
// LOG_FORMAT=json)
|
|
3
|
+
// hook prints to stderr in the format the platform has always printed (text,
|
|
4
|
+
// coloured in development, or one JSON object per line under
|
|
5
|
+
// LOG_FORMAT=json): stdout is the embedding program's own. A shell replaces
|
|
6
|
+
// the hook to take the lines itself — the
|
|
6
7
|
// hosted product hands them to its own winston logger, the CLI to its output,
|
|
7
8
|
// a test to a capture — so the engine carries no logging library.
|
|
8
9
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
@@ -46,9 +47,10 @@ function formatEngineLogLine({ level, message, meta }, { colour = isDev && !json
|
|
|
46
47
|
? `${shownLevel}: ${prefix}${message} ${rest}`
|
|
47
48
|
: `${shownLevel}: ${prefix}${message}`;
|
|
48
49
|
}
|
|
49
|
-
/** Prints to
|
|
50
|
+
/** Prints to stderr, every level: what the engine logs never mixes into the
|
|
51
|
+
* output of the program that embeds it. */
|
|
50
52
|
const consoleLogHook = (line) => {
|
|
51
|
-
process.
|
|
53
|
+
process.stderr.write(`${formatEngineLogLine(line)}\n`);
|
|
52
54
|
};
|
|
53
55
|
exports.consoleLogHook = consoleLogHook;
|
|
54
56
|
let hook = exports.consoleLogHook;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FunctionWalk } from '@listen-fire/engine-contracts';
|
|
1
2
|
import type { CatalogSnapshot, CheckAnswer, Diagnostic, LanguageVersion, Program } from '@listen-fire/movement-lang';
|
|
2
3
|
export interface CheckInput {
|
|
3
4
|
source: string;
|
|
@@ -6,7 +7,8 @@ export interface CheckInput {
|
|
|
6
7
|
/** Checking for a move up from this version (`upgradingFrom`). */
|
|
7
8
|
upgradingFrom?: LanguageVersion;
|
|
8
9
|
}
|
|
9
|
-
/** The pin, the parse: MOVENG_LANGUAGE_VERSION or MOVENG_PARSE
|
|
10
|
+
/** The pin, the parse: MOVENG_LANGUAGE_VERSION, or MOVENG_PARSE with where
|
|
11
|
+
* the parser stopped as its details (`{ loc }`, 1-based). */
|
|
10
12
|
export declare function parsePinned(input: Pick<CheckInput, 'source' | 'languageVersion'>): Program;
|
|
11
13
|
/** The pin, the parse and the Rust checker, the check a run on the Rust
|
|
12
14
|
* engine is held to, before anything of the run reaches its host. Error
|
|
@@ -16,9 +18,17 @@ export declare function parsePinned(input: Pick<CheckInput, 'source' | 'language
|
|
|
16
18
|
* stamps and link the run reads; this one answers only whether the run may
|
|
17
19
|
* open a segment at all. */
|
|
18
20
|
export declare function checkPinnedInRust(input: CheckInput): Diagnostic[];
|
|
19
|
-
/** `checkPinnedInRust`, answered as data (the `check.program` host call):
|
|
20
|
-
*
|
|
21
|
+
/** `checkPinnedInRust`, answered as data (the `check.program` host call): the
|
|
22
|
+
* import link, the checker's stamps and the diagnostics of a clean or
|
|
23
|
+
* warning-only check. A check with an error throws MOVENG_CHECK, its error
|
|
24
|
+
* diagnostics (each with its span) in `details`. */
|
|
21
25
|
export declare function checkAnswerInRust(input: CheckInput): CheckAnswer;
|
|
26
|
+
/** Each walk a function of the checked program makes from a connection, as
|
|
27
|
+
* its check answers them (`walks`), in the order the check typed them: a
|
|
28
|
+
* host reads which lookups its modules will be asked, and with
|
|
29
|
+
* `isPurePredicate` whether a hop's WHERE is handed to the module. None
|
|
30
|
+
* when it makes none. */
|
|
31
|
+
export declare function functionWalksOf(answer: CheckAnswer): FunctionWalk[];
|
|
22
32
|
/** MOVENG_CHECK for any blocking diagnostic: error severity, except the
|
|
23
33
|
* retirements a saved program may still run. */
|
|
24
34
|
export declare function throwIfBlocking(diagnostics: Diagnostic[]): void;
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
// native check). The `check.program` host call (rust_host.ts), which only a
|
|
8
8
|
// segment started without the native check makes, is answered by the same
|
|
9
9
|
// checker as data (`checkAnswerInRust`): its diagnostics, the import link and
|
|
10
|
-
// the checker's stamps.
|
|
10
|
+
// the checker's stamps. A clean or warning-only check answers; a check with an
|
|
11
|
+
// error throws MOVENG_CHECK, its error diagnostics (each with its span) in the
|
|
12
|
+
// error's `details`.
|
|
11
13
|
//
|
|
12
14
|
// The stamps are what the checker settles on nodes that the engine reads: on
|
|
13
15
|
// a write's spread the fields it stands for, on a graph's spread what it
|
|
@@ -29,7 +31,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
31
|
exports.parsePinned = parsePinned;
|
|
30
32
|
exports.checkPinnedInRust = checkPinnedInRust;
|
|
31
33
|
exports.checkAnswerInRust = checkAnswerInRust;
|
|
34
|
+
exports.functionWalksOf = functionWalksOf;
|
|
32
35
|
exports.throwIfBlocking = throwIfBlocking;
|
|
36
|
+
const engine_contracts_1 = require("@listen-fire/engine-contracts");
|
|
33
37
|
const movement_lang_1 = require("@listen-fire/movement-lang");
|
|
34
38
|
const rust_parser_1 = require("@listen-fire/movement-lang/parser/rust_parser");
|
|
35
39
|
const errors_1 = require("./errors");
|
|
@@ -40,7 +44,8 @@ const errors_1 = require("./errors");
|
|
|
40
44
|
* run gate lets exactly these through and the engine still executes them.
|
|
41
45
|
*/
|
|
42
46
|
const RETIRED_BUT_STILL_RUNNABLE = new Set(['MOV_WRITE_SHAPE_RETIRED']);
|
|
43
|
-
/** The pin, the parse: MOVENG_LANGUAGE_VERSION or MOVENG_PARSE
|
|
47
|
+
/** The pin, the parse: MOVENG_LANGUAGE_VERSION, or MOVENG_PARSE with where
|
|
48
|
+
* the parser stopped as its details (`{ loc }`, 1-based). */
|
|
44
49
|
function parsePinned(input) {
|
|
45
50
|
const languageVersion = input.languageVersion ?? movement_lang_1.LANGUAGE_VERSION;
|
|
46
51
|
// The pin is answered before the source is read: a version this release
|
|
@@ -55,7 +60,7 @@ function parsePinned(input) {
|
|
|
55
60
|
const parsed = (0, rust_parser_1.rustParseProgram)(input.source, languageVersion);
|
|
56
61
|
if (!parsed.ok) {
|
|
57
62
|
const { message, loc } = parsed.refusal;
|
|
58
|
-
throw new errors_1.MovementEngineError('MOVENG_PARSE', `${message} (line ${loc.line}, col ${loc.col})
|
|
63
|
+
throw new errors_1.MovementEngineError('MOVENG_PARSE', `${message} (line ${loc.line}, col ${loc.col})`, { loc });
|
|
59
64
|
}
|
|
60
65
|
return parsed.value;
|
|
61
66
|
}
|
|
@@ -76,8 +81,10 @@ function checkPinnedInRust(input) {
|
|
|
76
81
|
throwIfBlocking(diagnostics);
|
|
77
82
|
return diagnostics;
|
|
78
83
|
}
|
|
79
|
-
/** `checkPinnedInRust`, answered as data (the `check.program` host call):
|
|
80
|
-
*
|
|
84
|
+
/** `checkPinnedInRust`, answered as data (the `check.program` host call): the
|
|
85
|
+
* import link, the checker's stamps and the diagnostics of a clean or
|
|
86
|
+
* warning-only check. A check with an error throws MOVENG_CHECK, its error
|
|
87
|
+
* diagnostics (each with its span) in `details`. */
|
|
81
88
|
function checkAnswerInRust(input) {
|
|
82
89
|
const languageVersion = input.languageVersion ?? movement_lang_1.LANGUAGE_VERSION;
|
|
83
90
|
parsePinned(input);
|
|
@@ -88,6 +95,14 @@ function checkAnswerInRust(input) {
|
|
|
88
95
|
throwIfBlocking(answer.diagnostics);
|
|
89
96
|
return answer;
|
|
90
97
|
}
|
|
98
|
+
/** Each walk a function of the checked program makes from a connection, as
|
|
99
|
+
* its check answers them (`walks`), in the order the check typed them: a
|
|
100
|
+
* host reads which lookups its modules will be asked, and with
|
|
101
|
+
* `isPurePredicate` whether a hop's WHERE is handed to the module. None
|
|
102
|
+
* when it makes none. */
|
|
103
|
+
function functionWalksOf(answer) {
|
|
104
|
+
return answer.walks === undefined ? [] : engine_contracts_1.functionWalkSchema.array().parse(answer.walks);
|
|
105
|
+
}
|
|
91
106
|
/** MOVENG_CHECK for any blocking diagnostic: error severity, except the
|
|
92
107
|
* retirements a saved program may still run. */
|
|
93
108
|
function throwIfBlocking(diagnostics) {
|
|
@@ -81,7 +81,8 @@ export declare const FAILED_CHECK_MID_RUN = "failed_check_mid_run";
|
|
|
81
81
|
export declare function checkBeforeRustSegment<T>(input: Pick<RunMovementInput, 'runId' | 'dryRun'>, check: () => T): T;
|
|
82
82
|
/**
|
|
83
83
|
* The one log line per segment that says how it ended on the Rust engine
|
|
84
|
-
* (`ran`, or why it did not),
|
|
84
|
+
* (`ran`, or why it did not), at debug: one line per run is noise to an
|
|
85
|
+
* embedder. And the engine recorded on the run's row.
|
|
85
86
|
*/
|
|
86
87
|
export declare function noteEngine(input: Pick<RunMovementInput, 'runId' | 'dryRun'>, outcome: string): void;
|
|
87
88
|
/**
|
|
@@ -208,10 +208,11 @@ function failedCheckMidRun(input) {
|
|
|
208
208
|
}
|
|
209
209
|
/**
|
|
210
210
|
* The one log line per segment that says how it ended on the Rust engine
|
|
211
|
-
* (`ran`, or why it did not),
|
|
211
|
+
* (`ran`, or why it did not), at debug: one line per run is noise to an
|
|
212
|
+
* embedder. And the engine recorded on the run's row.
|
|
212
213
|
*/
|
|
213
214
|
function noteEngine(input, outcome) {
|
|
214
|
-
logger_1.logger.
|
|
215
|
+
logger_1.logger.debug(`movement engine: engine=rust run=${input.runId ?? '-'} outcome=${outcome}`);
|
|
215
216
|
// A rehearsal has no run row.
|
|
216
217
|
if (input.runId !== undefined && input.dryRun !== true)
|
|
217
218
|
(0, rust_stats_1.recordRunEngine)({ runId: input.runId, engine: 'rust' });
|
|
@@ -109,10 +109,17 @@ export declare function plannedListensOf(input: {
|
|
|
109
109
|
* verdict runs nothing, and the host says why. A listen whose filter calls a
|
|
110
110
|
* host function asks it (`{asks}`) until `answers` answer what it reached;
|
|
111
111
|
* one that calls none never asks.
|
|
112
|
+
*
|
|
113
|
+
* A hop its plan marks `resolved` whose record the arrival does not carry
|
|
114
|
+
* is the host's to judge, not this call's: the host lists that hop's members,
|
|
115
|
+
* keeps those that match, and passes `delivery.scoped` only for an arrival
|
|
116
|
+
* under one of them (its `key`), as listen-fire does. Without `scoped`, such
|
|
117
|
+
* a listen's verdict is undecided, never a fire under every member.
|
|
112
118
|
*/
|
|
113
119
|
export declare function listenFires(listen: PlannedListen, arrival: Arrival, delivery: {
|
|
114
120
|
adapterType: string;
|
|
115
121
|
credentialName?: string;
|
|
122
|
+
scoped?: boolean;
|
|
116
123
|
}, nowMs: number, answers?: PluginAnswers): Judgement | null;
|
|
117
124
|
/**
|
|
118
125
|
* A record's `fields` as a program reads them, by name: each field the
|
|
@@ -154,15 +161,18 @@ export interface TriggerAwaits {
|
|
|
154
161
|
own: string[];
|
|
155
162
|
carried: Readonly<Record<string, readonly string[]>>;
|
|
156
163
|
}
|
|
157
|
-
/** The edges the check stamps on the parameter of the function `plan` fires
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* (
|
|
161
|
-
*
|
|
162
|
-
*
|
|
164
|
+
/** The edges the check stamps on the parameter of the function `plan` fires:
|
|
165
|
+
* where a run of it enters its trigger, and so the waits a delivery opens
|
|
166
|
+
* for the run as it is kept (crates/lf/src/routing.rs `trigger_awaits_of`).
|
|
167
|
+
* Those awaited off the trigger (`opensWaits`), and off each record type the
|
|
168
|
+
* arrival carries (`carriedAwaits`), by that type. `stamps` and `link` are
|
|
169
|
+
* the check's of `program`. The function is one `program` declares, or one
|
|
170
|
+
* it imports (`import { frog } from "lib/frog"`), found through `link`, whose
|
|
171
|
+
* stamps are its library's. */
|
|
163
172
|
export declare function triggerAwaitsOf(input: {
|
|
164
173
|
program: Program;
|
|
165
174
|
stamps: CheckAnswer['stamps'];
|
|
175
|
+
link?: CheckAnswer['link'];
|
|
166
176
|
plan: ListenPlan;
|
|
167
177
|
}): TriggerAwaits;
|
|
168
178
|
/** The receipt a listen takes of `arrival` as it runs it, so a redelivery
|
|
@@ -181,6 +181,12 @@ function plannedListensOf(input) {
|
|
|
181
181
|
* verdict runs nothing, and the host says why. A listen whose filter calls a
|
|
182
182
|
* host function asks it (`{asks}`) until `answers` answer what it reached;
|
|
183
183
|
* one that calls none never asks.
|
|
184
|
+
*
|
|
185
|
+
* A hop its plan marks `resolved` whose record the arrival does not carry
|
|
186
|
+
* is the host's to judge, not this call's: the host lists that hop's members,
|
|
187
|
+
* keeps those that match, and passes `delivery.scoped` only for an arrival
|
|
188
|
+
* under one of them (its `key`), as listen-fire does. Without `scoped`, such
|
|
189
|
+
* a listen's verdict is undecided, never a fire under every member.
|
|
184
190
|
*/
|
|
185
191
|
function listenFires(listen, arrival, delivery, nowMs, answers) {
|
|
186
192
|
const { plan } = listen;
|
|
@@ -194,6 +200,7 @@ function listenFires(listen, arrival, delivery, nowMs, answers) {
|
|
|
194
200
|
landing: arrivedRecord(arrival.landing),
|
|
195
201
|
...(arrival.parents !== undefined ? { parents: arrival.parents.map((parent) => (parent === null ? null : arrivedRecord(parent))) } : {}),
|
|
196
202
|
...(arrival.takenApplied === true ? { takenApplied: true } : {}),
|
|
203
|
+
...(delivery.scoped === true ? { scoped: true } : {}),
|
|
197
204
|
}, { nowMs, ...(answers !== undefined ? { answers } : {}) });
|
|
198
205
|
}
|
|
199
206
|
/**
|
|
@@ -251,24 +258,35 @@ function arrivedRecord(landing) {
|
|
|
251
258
|
...(landing.unknown !== undefined && landing.unknown.length > 0 ? { unknown: landing.unknown } : {}),
|
|
252
259
|
};
|
|
253
260
|
}
|
|
254
|
-
/** The edges the check stamps on the parameter of the function `plan` fires
|
|
255
|
-
*
|
|
256
|
-
*
|
|
257
|
-
* (
|
|
258
|
-
*
|
|
259
|
-
*
|
|
261
|
+
/** The edges the check stamps on the parameter of the function `plan` fires:
|
|
262
|
+
* where a run of it enters its trigger, and so the waits a delivery opens
|
|
263
|
+
* for the run as it is kept (crates/lf/src/routing.rs `trigger_awaits_of`).
|
|
264
|
+
* Those awaited off the trigger (`opensWaits`), and off each record type the
|
|
265
|
+
* arrival carries (`carriedAwaits`), by that type. `stamps` and `link` are
|
|
266
|
+
* the check's of `program`. The function is one `program` declares, or one
|
|
267
|
+
* it imports (`import { frog } from "lib/frog"`), found through `link`, whose
|
|
268
|
+
* stamps are its library's. */
|
|
260
269
|
function triggerAwaitsOf(input) {
|
|
261
270
|
const { plan } = input;
|
|
262
|
-
const
|
|
263
|
-
if (
|
|
271
|
+
const declared = declarationOf(input.program, input.link, plan.movement);
|
|
272
|
+
if (declared === undefined)
|
|
264
273
|
return { own: [], carried: {} };
|
|
265
|
-
const path =
|
|
266
|
-
const onParam = input.stamps.filter((stamp) => stamp.file ===
|
|
274
|
+
const path = `${declared.declaration}/params/0`;
|
|
275
|
+
const onParam = input.stamps.filter((stamp) => stamp.file === declared.file && stamp.path === path);
|
|
267
276
|
// The parameter's one stamp of each, as listen-fire reads them (`trigger_awaits_of`).
|
|
268
277
|
const own = onParam.flatMap((stamp) => ('opensWaits' in stamp ? [[...stamp.opensWaits]] : []))[0] ?? [];
|
|
269
278
|
const carried = onParam.flatMap((stamp) => ('carriedAwaits' in stamp ? [stamp.carriedAwaits] : []))[0] ?? {};
|
|
270
279
|
return { own, carried };
|
|
271
280
|
}
|
|
281
|
+
/** Where the function `name` is declared: in `program` (no file), else in
|
|
282
|
+
* the library `link` resolves `program`'s import of `name` to. */
|
|
283
|
+
function declarationOf(program, link, name) {
|
|
284
|
+
const index = program.statements.findIndex((statement) => statement.kind === 'movement' && statement.name === name);
|
|
285
|
+
if (index !== -1)
|
|
286
|
+
return { declaration: `/statements/${index}` };
|
|
287
|
+
const imported = link?.imports.find((linked) => linked.local === name && linked.kind === 'movement');
|
|
288
|
+
return imported === undefined ? undefined : { file: imported.file, declaration: imported.declaration };
|
|
289
|
+
}
|
|
272
290
|
/** The receipt a listen takes of `arrival` as it runs it, so a redelivery
|
|
273
291
|
* of the same arrival runs it once: its edge, the record it landed on, its
|
|
274
292
|
* identity and its version (crates/lf/src/arrivals.rs `arrival_receipt_key`). */
|
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.16.
|
|
4
|
+
"version": "0.16.1",
|
|
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"
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"safe-stable-stringify": "2.5.0",
|
|
19
19
|
"zod": "4.1.12",
|
|
20
20
|
"@listen-fire/module-runtime": "^0.12.8",
|
|
21
|
-
"@listen-fire/
|
|
22
|
-
"@listen-fire/
|
|
21
|
+
"@listen-fire/movement-lang": "^0.16.1",
|
|
22
|
+
"@listen-fire/engine-contracts": "^0.16.1"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/jest": "29.5.14",
|