@listen-fire/engine 0.12.0-rc.5 → 0.12.0-rc.7
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/movement-engine.d.ts +4 -3
- package/dist/public/movement-engine.js +7 -5
- package/dist/services/browser/contract.js +1 -1
- package/dist/services/movement_engine/binding.d.ts +2 -2
- package/dist/services/movement_engine/binding.js +1 -1
- package/dist/services/movement_engine/call_depth.js +2 -2
- package/dist/services/movement_engine/program_check.js +4 -4
- package/dist/services/movement_engine/rust_engine.d.ts +4 -7
- package/dist/services/movement_engine/rust_engine.js +10 -22
- package/dist/services/movement_engine/rust_host.d.ts +3 -3
- package/dist/services/movement_engine/rust_host.js +8 -33
- package/dist/services/movement_engine/rust_run.js +12 -23
- package/dist/services/movement_engine/rust_stats.d.ts +1 -1
- package/dist/services/movement_engine/segment_context.d.ts +0 -4
- package/dist/services/movement_engine/segment_context.js +2 -10
- package/dist/services/movement_engine/test_host.d.ts +1 -1
- package/dist/services/movement_engine/test_host.js +1 -1
- package/dist/services/plugins/registry.js +2 -15
- package/dist/services/run_host/contract.js +1 -1
- package/dist/services/translation_graph/movement/file_listeners.d.ts +2 -2
- package/dist/services/translation_graph/movement/file_listeners.js +1 -1
- package/dist/services/translation_graph/movement/schema_projection.js +4 -4
- package/dist/services/translation_graph/segment_scope.js +2 -2
- package/package.json +5 -5
|
@@ -6,6 +6,7 @@ export * from '../services/movement_engine/rust_stats';
|
|
|
6
6
|
export * as programCheck from '../services/movement_engine/program_check';
|
|
7
7
|
export { checkAnswerInRust, checkPinnedInRust, 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
|
-
/** This release of the engine
|
|
10
|
-
*
|
|
11
|
-
|
|
9
|
+
/** This release of the engine, which is the language it reads
|
|
10
|
+
* (`LANGUAGE_VERSION`): a run pinned to a release of another compatibility
|
|
11
|
+
* key is refused by name. */
|
|
12
|
+
export declare const ENGINE_VERSION: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// The engine's front door: run a movement, resume a parked one, check a
|
|
3
|
-
// program. The engine runs
|
|
4
|
-
//
|
|
3
|
+
// program. The engine runs a pin that shares this release's compatibility
|
|
4
|
+
// key; any other is refused by name, with the remedy.
|
|
5
5
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
6
|
if (k2 === undefined) k2 = k;
|
|
7
7
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -30,6 +30,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
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 = exports.fireCallbackBody = void 0;
|
|
33
|
+
const movement_lang_1 = require("@listen-fire/movement-lang");
|
|
33
34
|
var rust_run_1 = require("../services/movement_engine/rust_run");
|
|
34
35
|
Object.defineProperty(exports, "fireCallbackBody", { enumerable: true, get: function () { return rust_run_1.fireCallbackBody; } });
|
|
35
36
|
Object.defineProperty(exports, "resumeMovement", { enumerable: true, get: function () { return rust_run_1.resumeMovement; } });
|
|
@@ -52,6 +53,7 @@ Object.defineProperty(exports, "parsePinned", { enumerable: true, get: function
|
|
|
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");
|
|
54
55
|
Object.defineProperty(exports, "checkInputOf", { enumerable: true, get: function () { return rust_run_2.checkInputOf; } });
|
|
55
|
-
/** This release of the engine
|
|
56
|
-
*
|
|
57
|
-
|
|
56
|
+
/** This release of the engine, which is the language it reads
|
|
57
|
+
* (`LANGUAGE_VERSION`): a run pinned to a release of another compatibility
|
|
58
|
+
* key is refused by name. */
|
|
59
|
+
exports.ENGINE_VERSION = movement_lang_1.LANGUAGE_VERSION;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// The browser slot's contract suite: the cases every module filling the slot
|
|
3
3
|
// is held to — the built-in `@lf/chromium` against a page served on loopback
|
|
4
|
-
// (apps/api), and the scripted fake page the gated-document tests drive
|
|
4
|
+
// (lf-platform's apps/api), and the scripted fake page the gated-document tests drive
|
|
5
5
|
// (fake_browser.ts). Runner-agnostic, as the other slots' suites are: each
|
|
6
6
|
// case is a name and an async body that throws on failure (node:assert).
|
|
7
7
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
@@ -262,7 +262,7 @@ export type BindingShape =
|
|
|
262
262
|
kind: 'closure';
|
|
263
263
|
closure: ClosureExpression;
|
|
264
264
|
captured: Map<string, Binding>;
|
|
265
|
-
/** The name it was bound to (`f = (n) =>
|
|
265
|
+
/** The name it was bound to (`f = (n) => …`), by
|
|
266
266
|
* which its own body may call it: the capture is a snapshot taken
|
|
267
267
|
* before the name was bound, so the name is handed to each call
|
|
268
268
|
* instead (`invokeClosure`). */
|
|
@@ -437,7 +437,7 @@ export declare class Environment {
|
|
|
437
437
|
/**
|
|
438
438
|
* The declared name of a FUNCTION in scope (a movement, a plugin, an
|
|
439
439
|
* import, a name bound to a closure) written `name` in another letter case
|
|
440
|
-
* — function names are case-insensitive
|
|
440
|
+
* — function names are case-insensitive. The
|
|
441
441
|
* checker refuses two functions whose names differ only by case, so at most
|
|
442
442
|
* one answers.
|
|
443
443
|
*/
|
|
@@ -78,7 +78,7 @@ class Environment {
|
|
|
78
78
|
/**
|
|
79
79
|
* The declared name of a FUNCTION in scope (a movement, a plugin, an
|
|
80
80
|
* import, a name bound to a closure) written `name` in another letter case
|
|
81
|
-
* — function names are case-insensitive
|
|
81
|
+
* — function names are case-insensitive. The
|
|
82
82
|
* checker refuses two functions whose names differ only by case, so at most
|
|
83
83
|
* one answers.
|
|
84
84
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// The maximum CALL DEPTH of a movement run
|
|
2
|
+
// The maximum CALL DEPTH of a movement run.
|
|
3
3
|
//
|
|
4
|
-
//
|
|
4
|
+
// A function may call itself, directly or through others. A
|
|
5
5
|
// recursion that never reaches its base case would otherwise run until the
|
|
6
6
|
// process ran out of stack — or, where every level makes a priced call, until
|
|
7
7
|
// the cost cap stopped it, having spent the cap. The depth limit stops it
|
|
@@ -42,12 +42,12 @@ const errors_1 = require("./errors");
|
|
|
42
42
|
const RETIRED_BUT_STILL_RUNNABLE = new Set(['MOV_WRITE_SHAPE_RETIRED']);
|
|
43
43
|
/** The pin, the parse: MOVENG_LANGUAGE_VERSION or MOVENG_PARSE. */
|
|
44
44
|
function parsePinned(input) {
|
|
45
|
-
const languageVersion = input.languageVersion ?? movement_lang_1.
|
|
45
|
+
const languageVersion = input.languageVersion ?? movement_lang_1.LANGUAGE_VERSION;
|
|
46
46
|
// The pin is answered before the source is read: a version this release
|
|
47
47
|
// cannot honour must fail as exactly that, not as whatever the current
|
|
48
48
|
// grammar makes of the text.
|
|
49
49
|
const versionDiagnostic = (0, movement_lang_1.languageVersionDiagnostic)(languageVersion);
|
|
50
|
-
if (versionDiagnostic !== undefined
|
|
50
|
+
if (versionDiagnostic !== undefined) {
|
|
51
51
|
throw new errors_1.MovementEngineError('MOVENG_LANGUAGE_VERSION', versionDiagnostic.message, [
|
|
52
52
|
versionDiagnostic,
|
|
53
53
|
]);
|
|
@@ -67,7 +67,7 @@ function parsePinned(input) {
|
|
|
67
67
|
* stamps and link the run reads; this one answers only whether the run may
|
|
68
68
|
* open a segment at all. */
|
|
69
69
|
function checkPinnedInRust(input) {
|
|
70
|
-
const languageVersion = input.languageVersion ?? movement_lang_1.
|
|
70
|
+
const languageVersion = input.languageVersion ?? movement_lang_1.LANGUAGE_VERSION;
|
|
71
71
|
parsePinned(input);
|
|
72
72
|
const diagnostics = (0, movement_lang_1.checkSourceInRust)(input.source, input.catalog, {
|
|
73
73
|
languageVersion,
|
|
@@ -79,7 +79,7 @@ function checkPinnedInRust(input) {
|
|
|
79
79
|
/** `checkPinnedInRust`, answered as data (the `check.program` host call):
|
|
80
80
|
* every diagnostic, the import link and the checker's stamps. */
|
|
81
81
|
function checkAnswerInRust(input) {
|
|
82
|
-
const languageVersion = input.languageVersion ?? movement_lang_1.
|
|
82
|
+
const languageVersion = input.languageVersion ?? movement_lang_1.LANGUAGE_VERSION;
|
|
83
83
|
parsePinned(input);
|
|
84
84
|
const answer = (0, movement_lang_1.checkAnswerInRust)(input.source, input.catalog, {
|
|
85
85
|
languageVersion,
|
|
@@ -38,7 +38,7 @@ export interface EngineProtocol {
|
|
|
38
38
|
finish(): void;
|
|
39
39
|
}
|
|
40
40
|
/** For a process's boot: a retired engine setting fails startup. Ignoring
|
|
41
|
-
* it would silently drop what an operator asked for (a
|
|
41
|
+
* it would silently drop what an operator asked for (a current run on the
|
|
42
42
|
* TypeScript engine, say). */
|
|
43
43
|
export declare function assertEngineConfigured(env?: Record<string, string | undefined>): void;
|
|
44
44
|
export { PARKED_ON_TYPESCRIPT } from './errors';
|
|
@@ -108,13 +108,10 @@ export declare function driveEngine(engine: EngineProtocol, start: unknown, { wa
|
|
|
108
108
|
/** Absent: no wall clock (a test's double). */
|
|
109
109
|
wallClockSeconds?: number;
|
|
110
110
|
}): Promise<unknown>;
|
|
111
|
-
/** What a segment ended in: its result, a
|
|
112
|
-
*
|
|
113
|
-
* happened). */
|
|
111
|
+
/** What a segment ended in: its result, or a decline after its check
|
|
112
|
+
* (nothing the host can see happened). */
|
|
114
113
|
type RunOutcome = {
|
|
115
114
|
ran: MovementRunResult;
|
|
116
|
-
} | {
|
|
117
|
-
refused: string;
|
|
118
115
|
} | {
|
|
119
116
|
declined: string;
|
|
120
117
|
};
|
|
@@ -122,7 +119,7 @@ type RunOutcome = {
|
|
|
122
119
|
* The segment's `done` (crates/movement-engine/src/run.rs says its shapes):
|
|
123
120
|
* the run's result, the error it failed with (a body's failure wrapped in
|
|
124
121
|
* `MovementRunFailed`, carrying what the run did, as the interpreter wraps
|
|
125
|
-
* it), or that it
|
|
122
|
+
* it), or that it declined.
|
|
126
123
|
*/
|
|
127
124
|
export declare function readRunResult(done: unknown, run: {
|
|
128
125
|
context: Pick<RunContext, 'trace' | 'ledger'>;
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
// it, in the shapes docs/contracts/host-families.md freezes, and the shim forwards each one
|
|
9
9
|
// to the run's `EngineHost` (rust_host.ts).
|
|
10
10
|
//
|
|
11
|
-
// This engine runs
|
|
11
|
+
// This engine runs the current language (rust_run.ts refuses an
|
|
12
12
|
// earlier pin at the entry). There is no fallback: whatever the Rust engine
|
|
13
13
|
// refuses or declines fails the run (MOVENG_UNSUPPORTED). The checker is the one gate that keeps a
|
|
14
|
-
// saved program from reaching such a refusal, and a test holds every
|
|
14
|
+
// saved program from reaching such a refusal, and a test holds every current
|
|
15
15
|
// program in the repository to that (rust_reachability.unit.test.ts). Each
|
|
16
16
|
// segment is logged once (`noteEngine`) and counted (`rustRunStats`).
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -44,13 +44,13 @@ Object.defineProperty(exports, "plainJson", { enumerable: true, get: function ()
|
|
|
44
44
|
* emergency switch. Each named a choice that no longer exists. */
|
|
45
45
|
const RETIRED_ENGINE_SETTINGS = ['MOVEMENT_ENGINE', 'MOVEMENT_ENGINE_FALLBACK', 'MOVEMENT_ENGINE_DRY_RUN_EVERY', 'MOVEMENT_ENGINE_V5_ON_TS'];
|
|
46
46
|
/** For a process's boot: a retired engine setting fails startup. Ignoring
|
|
47
|
-
* it would silently drop what an operator asked for (a
|
|
47
|
+
* it would silently drop what an operator asked for (a current run on the
|
|
48
48
|
* TypeScript engine, say). */
|
|
49
49
|
function assertEngineConfigured(env = process.env) {
|
|
50
50
|
const set = RETIRED_ENGINE_SETTINGS.filter((name) => env[name] !== undefined && env[name] !== '');
|
|
51
51
|
if (set.length === 0)
|
|
52
52
|
return;
|
|
53
|
-
throw new Error(`${set.join(', ')} ${set.length === 1 ? 'is' : 'are'} retired: a run's engine follows its pinned language version (
|
|
53
|
+
throw new Error(`${set.join(', ')} ${set.length === 1 ? 'is' : 'are'} retired: a run's engine follows its pinned language version (this release's language on the Rust engine, the platform's earlier integer-pinned languages on its TypeScript engine), with no fallback between them. Remove ${set.length === 1 ? 'it' : 'them'} from the environment.`);
|
|
54
54
|
}
|
|
55
55
|
var errors_2 = require("./errors");
|
|
56
56
|
Object.defineProperty(exports, "PARKED_ON_TYPESCRIPT", { enumerable: true, get: function () { return errors_2.PARKED_ON_TYPESCRIPT; } });
|
|
@@ -137,15 +137,13 @@ async function segmentInRust({ input, context, checkedBefore = false }, resume,
|
|
|
137
137
|
throw error;
|
|
138
138
|
}
|
|
139
139
|
rust_stats_1.rustRunStats.segments += 1;
|
|
140
|
-
if ('refused' in outcome)
|
|
141
|
-
throw unsupportedInRust(input, outcome.refused);
|
|
142
140
|
if ('declined' in outcome)
|
|
143
141
|
throw unsupportedInRust(input, outcome.declined);
|
|
144
142
|
noteEngine(input, RAN);
|
|
145
143
|
return outcome.ran;
|
|
146
144
|
}
|
|
147
145
|
/** A segment the Rust engine (or this shim, on its behalf) would not run:
|
|
148
|
-
* counted by reason, and the run fails. No other engine runs a
|
|
146
|
+
* counted by reason, and the run fails. No other engine runs a current
|
|
149
147
|
* program, so this is never a slow path: a checked program that reaches it
|
|
150
148
|
* is a checker or engine bug. */
|
|
151
149
|
function unsupportedInRust(input, reason) {
|
|
@@ -420,14 +418,11 @@ function segmentInput(input, context, { resume }, wire) {
|
|
|
420
418
|
// The engine checks the program itself (the Rust checker): a run on
|
|
421
419
|
// this engine is held to it, and the host is never asked.
|
|
422
420
|
// It checks against the snapshot's own `models`, as the host's checker
|
|
423
|
-
// does, not the run's list sent on the catalog below.
|
|
424
|
-
// pin's warning is the release's, which is this host's, as the host's
|
|
425
|
-
// check answer's is (rust_host.ts `check.program`).
|
|
421
|
+
// does, not the run's list sent on the catalog below.
|
|
426
422
|
nativeCheck: true,
|
|
427
423
|
snapshotModels: input.catalog.models ?? null,
|
|
428
|
-
|
|
429
|
-
//
|
|
430
|
-
// release's current version.
|
|
424
|
+
// The pin the run is under, written out (absent on the input, this
|
|
425
|
+
// release's): the engine holds it to the rule again at its entry.
|
|
431
426
|
languageVersion: context.languageVersion,
|
|
432
427
|
...(input.movementName !== undefined ? { movementName: input.movementName } : {}),
|
|
433
428
|
event,
|
|
@@ -457,7 +452,7 @@ function segmentInput(input, context, { resume }, wire) {
|
|
|
457
452
|
// deployment's, read here so the engine reads no environment; the
|
|
458
453
|
// number as written, a fraction included, which the marker prints.
|
|
459
454
|
extractionFileChars: (0, segment_limits_1.maxFileChars)(),
|
|
460
|
-
// How many named calls deep the run may nest
|
|
455
|
+
// How many named calls deep the run may nest: the
|
|
461
456
|
// deployment's, read here for the same reason.
|
|
462
457
|
maxCallDepth: (0, call_depth_1.maxCallDepth)(),
|
|
463
458
|
// What one segment may consume (docs/contracts/run-limits.md): the
|
|
@@ -469,21 +464,14 @@ function segmentInput(input, context, { resume }, wire) {
|
|
|
469
464
|
extractionTiers: (0, ai_tiers_1.extractionTierAssignments)(),
|
|
470
465
|
}, 'the segment input');
|
|
471
466
|
}
|
|
472
|
-
/** The pin's standing warning as this release words it (`languageVersionDiagnostic`). */
|
|
473
|
-
function versionWarningOf(languageVersion) {
|
|
474
|
-
const warning = (0, movement_lang_1.languageVersionDiagnostic)(languageVersion);
|
|
475
|
-
return warning !== undefined ? { versionWarning: { code: warning.code, message: warning.message } } : {};
|
|
476
|
-
}
|
|
477
467
|
/**
|
|
478
468
|
* The segment's `done` (crates/movement-engine/src/run.rs says its shapes):
|
|
479
469
|
* the run's result, the error it failed with (a body's failure wrapped in
|
|
480
470
|
* `MovementRunFailed`, carrying what the run did, as the interpreter wraps
|
|
481
|
-
* it), or that it
|
|
471
|
+
* it), or that it declined.
|
|
482
472
|
*/
|
|
483
473
|
function readRunResult(done, run) {
|
|
484
474
|
const outcome = (0, rust_wire_1.record)(done, 'the Rust engine result');
|
|
485
|
-
if ('refused' in outcome)
|
|
486
|
-
return { refused: (0, rust_wire_1.string)(outcome.refused, 'the Rust engine refused') };
|
|
487
475
|
if ('declined' in outcome)
|
|
488
476
|
return { declined: (0, rust_wire_1.string)(outcome.declined, 'the Rust engine declined') };
|
|
489
477
|
// What the segment's priced calls spent was charged to the run's account
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type CatalogSnapshot, type Program } from '@listen-fire/movement-lang';
|
|
1
|
+
import { type LanguageVersion, type CatalogSnapshot, type Program } from '@listen-fire/movement-lang';
|
|
2
2
|
import { type EngineHost } from './host';
|
|
3
3
|
import { type RunContext } from './segment_context';
|
|
4
4
|
import type { HostAnswer, HostRequest } from './rust_engine';
|
|
@@ -31,8 +31,8 @@ export declare function shimRoutePaths(): string[];
|
|
|
31
31
|
/** The segment a forwarded request names (`serve` has held it to the one
|
|
32
32
|
* the run host opened). */
|
|
33
33
|
/** A program's key in `RouteContext.checked`: its source under its pin. */
|
|
34
|
-
export declare function checkedKey(source: string, languageVersion:
|
|
34
|
+
export declare function checkedKey(source: string, languageVersion: LanguageVersion): string;
|
|
35
35
|
/** The program `check.compatible` asks about, checked once per segment
|
|
36
36
|
* against the segment's own catalog (`RouteContext.checked`). */
|
|
37
|
-
export declare function checkedProgram(context: Pick<RouteContext, 'catalog' | 'checked'>, source: string, languageVersion:
|
|
37
|
+
export declare function checkedProgram(context: Pick<RouteContext, 'catalog' | 'checked'>, source: string, languageVersion: LanguageVersion): Program;
|
|
38
38
|
export declare function serve(request: HostRequest, context: RouteContext): Promise<HostAnswer>;
|
|
@@ -53,38 +53,17 @@ exports.ENGINE_OWN_ROUTES = {
|
|
|
53
53
|
const ROUTES = {
|
|
54
54
|
/** The Rust checker over the pinned source (program_check.ts
|
|
55
55
|
* `checkAnswerInRust`): every diagnostic, the import link and the
|
|
56
|
-
* checker's AST stamps as data
|
|
57
|
-
*
|
|
58
|
-
* check's error, as the run's own check throws it. */
|
|
56
|
+
* checker's AST stamps as data. The request names no pin: the run's own
|
|
57
|
+
* was held to the rule at its entry. A program that fails its check ends
|
|
58
|
+
* the run with the check's error, as the run's own check throws it. */
|
|
59
59
|
async 'check.program'(request, context) {
|
|
60
|
-
const languageVersion = request.languageVersion;
|
|
61
|
-
if (typeof languageVersion !== 'number')
|
|
62
|
-
throw new rust_wire_1.RustShimError('check.program languageVersion must be a number');
|
|
63
|
-
const upgradingFrom = request.upgradingFrom;
|
|
64
|
-
if (upgradingFrom !== undefined && typeof upgradingFrom !== 'number') {
|
|
65
|
-
throw new rust_wire_1.RustShimError('check.program upgradingFrom must be a number');
|
|
66
|
-
}
|
|
67
60
|
const source = (0, rust_wire_1.string)(request.source, 'check.program source');
|
|
68
|
-
let answer;
|
|
69
61
|
try {
|
|
70
|
-
|
|
71
|
-
source,
|
|
72
|
-
catalog: context.catalog,
|
|
73
|
-
languageVersion,
|
|
74
|
-
...(upgradingFrom !== undefined ? { upgradingFrom } : {}),
|
|
75
|
-
});
|
|
62
|
+
return (0, program_check_1.checkAnswerInRust)({ source, catalog: context.catalog, languageVersion: context.context.languageVersion });
|
|
76
63
|
}
|
|
77
64
|
catch (error) {
|
|
78
65
|
throw new rust_wire_1.RunAborted(error);
|
|
79
66
|
}
|
|
80
|
-
// The run's own version warning, read as the TypeScript engine reads it
|
|
81
|
-
// (run.ts, before the body): the release the engine runs under, not the
|
|
82
|
-
// checker's own view of it, which a host may hold apart.
|
|
83
|
-
const versionWarning = (0, movement_lang_1.languageVersionDiagnostic)(languageVersion);
|
|
84
|
-
return {
|
|
85
|
-
...answer,
|
|
86
|
-
...(versionWarning !== undefined ? { versionWarning: { code: versionWarning.code, message: versionWarning.message } } : {}),
|
|
87
|
-
};
|
|
88
67
|
},
|
|
89
68
|
/** `x IS <Decl>` of a record a system describes (the event, a handle, a
|
|
90
69
|
* landed record): does the schema's `recordType` carry everything the
|
|
@@ -96,9 +75,7 @@ const ROUTES = {
|
|
|
96
75
|
* there as `surfaceMisfit` compares a landing across an edge. With
|
|
97
76
|
* `file`, the declaration is a library's, checked as its own file. */
|
|
98
77
|
async 'check.compatible'(request, context) {
|
|
99
|
-
const languageVersion =
|
|
100
|
-
if (typeof languageVersion !== 'number')
|
|
101
|
-
throw new rust_wire_1.RustShimError('check.compatible languageVersion must be a number');
|
|
78
|
+
const languageVersion = context.context.languageVersion;
|
|
102
79
|
// The declaration's own file: a library's, by its path in the snapshot.
|
|
103
80
|
const file = (0, rust_wire_1.optionalString)(request.file, 'check.compatible file');
|
|
104
81
|
const source = file === undefined ? (0, rust_wire_1.string)(request.source, 'check.compatible source') : context.catalog.files?.[file]?.source;
|
|
@@ -112,7 +89,7 @@ const ROUTES = {
|
|
|
112
89
|
throw new rust_wire_1.RustShimError('check.compatible schema is an instance schema');
|
|
113
90
|
const path = (0, rust_wire_1.optionalStringList)(request.path, 'check.compatible path');
|
|
114
91
|
try {
|
|
115
|
-
return (0, movement_lang_1.compatibleInRust)({ source,
|
|
92
|
+
return (0, movement_lang_1.compatibleInRust)({ source, declaration, schema, recordType, ...(path !== undefined ? { path } : {}) });
|
|
116
93
|
}
|
|
117
94
|
catch (error) {
|
|
118
95
|
if (error instanceof movement_lang_1.RustCheckRefused)
|
|
@@ -198,9 +175,7 @@ const ROUTES = {
|
|
|
198
175
|
const constraints = wire.read(request.constraints);
|
|
199
176
|
if (!isUniquenessConstraints(constraints))
|
|
200
177
|
throw new rust_wire_1.RustShimError('llm.arbitrateEntities constraints are {any: [{all}]}');
|
|
201
|
-
const languageVersion = request.languageVersion;
|
|
202
|
-
if (typeof languageVersion !== 'number')
|
|
203
|
-
throw new rust_wire_1.RustShimError('llm.arbitrateEntities languageVersion is a number');
|
|
178
|
+
const languageVersion = (0, rust_wire_1.string)(request.languageVersion, 'llm.arbitrateEntities languageVersion');
|
|
204
179
|
const answer = await host.llm.arbitrateEntities({
|
|
205
180
|
asserted,
|
|
206
181
|
candidates,
|
|
@@ -298,7 +273,7 @@ const ROUTES = {
|
|
|
298
273
|
// The files the plugin's output declares, made here (as the TypeScript
|
|
299
274
|
// engine's priced invoker makes them): the engine is handed handles.
|
|
300
275
|
const spec = (0, segment_context_1.pluginSpecNamed)(catalog.plugins, (0, rust_wire_1.string)(request.plugin, 'llm.transforms.invoke plugin'));
|
|
301
|
-
const output = spec
|
|
276
|
+
const output = spec?.output;
|
|
302
277
|
const typed = 'error' in answer ? answer : (0, segment_context_1.withDeclaredFiles)(answer, output);
|
|
303
278
|
return new Plain(wired(wire, typed, 'llm.transforms.invoke'));
|
|
304
279
|
},
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// The engine's run entry: run a movement, resume a parked one, settle a race
|
|
3
3
|
// frame, fire a callback's body. Each opens one segment (`inRunContext`) and
|
|
4
|
-
// runs it on the Rust engine (rust_engine.ts). The engine runs
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
// keeps an engine for them.
|
|
4
|
+
// runs it on the Rust engine (rust_engine.ts). The engine runs a pin that
|
|
5
|
+
// shares this release's compatibility key; any other is refused at the
|
|
6
|
+
// entry, by name, with the remedy. Saved movements of an older language run
|
|
7
|
+
// where they were saved, on a platform that keeps an engine for them.
|
|
9
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
9
|
exports.runMovement = runMovement;
|
|
11
10
|
exports.resumeMovement = resumeMovement;
|
|
@@ -19,14 +18,6 @@ const host_adapter_1 = require("./host_adapter");
|
|
|
19
18
|
const program_check_1 = require("./program_check");
|
|
20
19
|
const rust_engine_1 = require("./rust_engine");
|
|
21
20
|
const segment_context_1 = require("./segment_context");
|
|
22
|
-
/** The first language version this engine runs. */
|
|
23
|
-
const FIRST_ENGINE_LANGUAGE_VERSION = 5;
|
|
24
|
-
/** This release as the engine answers for it: the versions it supports, from
|
|
25
|
-
* the first one the engine runs. */
|
|
26
|
-
const ENGINE_RELEASE = {
|
|
27
|
-
...movement_lang_1.THIS_RELEASE,
|
|
28
|
-
supported: new Set([...movement_lang_1.THIS_RELEASE.supported].filter((version) => version >= FIRST_ENGINE_LANGUAGE_VERSION)),
|
|
29
|
-
};
|
|
30
21
|
async function runMovement(given) {
|
|
31
22
|
const input = (0, host_adapter_1.withIsoEvent)(given);
|
|
32
23
|
refuseEarlierPin(input);
|
|
@@ -73,19 +64,17 @@ async function fireCallbackBody(given) {
|
|
|
73
64
|
return (0, segment_context_1.inRunContext)(input, (context) => (0, rust_engine_1.fireSegmentInRust)({ input, context, checkedBefore: true }));
|
|
74
65
|
}
|
|
75
66
|
/**
|
|
76
|
-
* A run pinned
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
* retired MOVEMENT_ENGINE_V5_ON_TS switch) has no engine to resume on.
|
|
67
|
+
* A run pinned to a language this release does not read is refused, by the
|
|
68
|
+
* pin's standing. A run the TypeScript engine parked (under the retired
|
|
69
|
+
* MOVEMENT_ENGINE_V5_ON_TS switch) has no engine to resume on.
|
|
80
70
|
*/
|
|
81
71
|
function refuseEarlierPin(input) {
|
|
82
|
-
const languageVersion = input.languageVersion ?? movement_lang_1.
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
throw new errors_1.MovementEngineError('MOVENG_LANGUAGE_VERSION', refusal
|
|
86
|
-
}
|
|
72
|
+
const languageVersion = input.languageVersion ?? movement_lang_1.LANGUAGE_VERSION;
|
|
73
|
+
const refusal = (0, movement_lang_1.languageVersionDiagnostic)(languageVersion);
|
|
74
|
+
if (refusal !== undefined)
|
|
75
|
+
throw new errors_1.MovementEngineError('MOVENG_LANGUAGE_VERSION', refusal.message);
|
|
87
76
|
if (input.parkedOnEngine === 'ts') {
|
|
88
|
-
throw new errors_1.MovementEngineError('MOVENG_UNSUPPORTED', `this run is pinned to language
|
|
77
|
+
throw new errors_1.MovementEngineError('MOVENG_UNSUPPORTED', `this run is pinned to language ${languageVersion}, which runs only on the Rust engine, but the TypeScript engine parked it: it cannot resume`, { reason: errors_1.PARKED_ON_TYPESCRIPT });
|
|
89
78
|
}
|
|
90
79
|
}
|
|
91
80
|
/** What the check reads of a run's input. */
|
|
@@ -25,7 +25,7 @@ export declare const rustRunStats: {
|
|
|
25
25
|
};
|
|
26
26
|
export declare function resetRustRunStats(): void;
|
|
27
27
|
/** The engine that ran one segment of a run. A resume reads it back
|
|
28
|
-
* (`parkedOnEngine`) to refuse a
|
|
28
|
+
* (`parkedOnEngine`) to refuse a current park the TypeScript engine
|
|
29
29
|
* wrote. */
|
|
30
30
|
export interface RunEngineRecord {
|
|
31
31
|
runId: string;
|
|
@@ -6,10 +6,6 @@ import type { AwaitWakeRequest, AdapterResolution, CallbackSink, EngineHost, Rec
|
|
|
6
6
|
import { RunCostCapExceeded, type Budget, type CostLine, type RunSpend } from '../../lib/run_cost';
|
|
7
7
|
/** The plugins a run's catalog snapshot describes, by name. */
|
|
8
8
|
export type PluginSpecs = Readonly<Record<string, PluginSpec>>;
|
|
9
|
-
/** What a plain call to `spec`'s plugin hands back to a program pinned to
|
|
10
|
-
* `languageVersion`: its current output, or an older shape it kept for
|
|
11
|
-
* programs pinned before the change (`PluginSpec.earlierOutputs`). */
|
|
12
|
-
export declare function pluginOutputUnder(spec: PluginSpec, languageVersion: LanguageVersion): PluginOutput | undefined;
|
|
13
9
|
/** A plugin by either spelling: movement identifiers can't carry dashes, so a
|
|
14
10
|
* program writes `vc_url_retrieval` for a plugin registered as
|
|
15
11
|
* `vc-url-retrieval`; the snapshot keys the underscore spelling. */
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
// read by the run host, never by the engine.
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
exports.RunLedger = void 0;
|
|
30
|
-
exports.pluginOutputUnder = pluginOutputUnder;
|
|
31
30
|
exports.pluginSpecNamed = pluginSpecNamed;
|
|
32
31
|
exports.hostless = hostless;
|
|
33
32
|
exports.stopwatch = stopwatch;
|
|
@@ -47,13 +46,6 @@ const types_1 = require("../../lib/utils/types");
|
|
|
47
46
|
const logger_1 = require("../logger");
|
|
48
47
|
const errors_1 = require("./errors");
|
|
49
48
|
const run_cost_1 = require("../../lib/run_cost");
|
|
50
|
-
/** What a plain call to `spec`'s plugin hands back to a program pinned to
|
|
51
|
-
* `languageVersion`: its current output, or an older shape it kept for
|
|
52
|
-
* programs pinned before the change (`PluginSpec.earlierOutputs`). */
|
|
53
|
-
function pluginOutputUnder(spec, languageVersion) {
|
|
54
|
-
const earlier = spec.earlierOutputs?.find((entry) => languageVersion < entry.before);
|
|
55
|
-
return earlier !== undefined ? earlier.output : spec.output;
|
|
56
|
-
}
|
|
57
49
|
/** A plugin by either spelling: movement identifiers can't carry dashes, so a
|
|
58
50
|
* program writes `vc_url_retrieval` for a plugin registered as
|
|
59
51
|
* `vc-url-retrieval`; the snapshot keys the underscore spelling. */
|
|
@@ -83,7 +75,7 @@ async function stopwatch(clock) {
|
|
|
83
75
|
/** The pin a callee honours: its run's, or — outside a run (a script, a test
|
|
84
76
|
* calling the extraction directly) — the current version. */
|
|
85
77
|
function languageVersionOf(run) {
|
|
86
|
-
return run?.languageVersion ?? movement_lang_1.
|
|
78
|
+
return run?.languageVersion ?? movement_lang_1.LANGUAGE_VERSION;
|
|
87
79
|
}
|
|
88
80
|
/**
|
|
89
81
|
* The cancel check every boundary INSIDE a statement makes (runs-and-cancel
|
|
@@ -399,7 +391,7 @@ async function inRunContext(input, run) {
|
|
|
399
391
|
host: input.host,
|
|
400
392
|
teamId: input.teamId,
|
|
401
393
|
...(input.runId !== undefined ? { runId: input.runId } : {}),
|
|
402
|
-
languageVersion: input.languageVersion ?? movement_lang_1.
|
|
394
|
+
languageVersion: input.languageVersion ?? movement_lang_1.LANGUAGE_VERSION,
|
|
403
395
|
...(input.firedAt !== undefined ? { firedAt: input.firedAt } : {}),
|
|
404
396
|
spend: {
|
|
405
397
|
priorMicrodollars: input.priorSpentMicrodollars ?? 0,
|
|
@@ -95,7 +95,7 @@ export declare function makeMemoryParkSources(): {
|
|
|
95
95
|
texts: Map<string, string>;
|
|
96
96
|
};
|
|
97
97
|
/**
|
|
98
|
-
* What the Rust run's counts (`rustRunStats`) say of how one
|
|
98
|
+
* What the Rust run's counts (`rustRunStats`) say of how one current run
|
|
99
99
|
* that threw `error` (none for a run that returned) ended: at its check
|
|
100
100
|
* (`isCheckFailure`) with no segment opened; or in one segment, run to its
|
|
101
101
|
* end (its own failure included), with no engine refusal and no shim fault.
|
|
@@ -168,7 +168,7 @@ function makeMemoryParkSources() {
|
|
|
168
168
|
}
|
|
169
169
|
// ── How a Rust run ended ──────────────────────────────────────────────────────
|
|
170
170
|
/**
|
|
171
|
-
* What the Rust run's counts (`rustRunStats`) say of how one
|
|
171
|
+
* What the Rust run's counts (`rustRunStats`) say of how one current run
|
|
172
172
|
* that threw `error` (none for a run that returned) ended: at its check
|
|
173
173
|
* (`isCheckFailure`) with no segment opened; or in one segment, run to its
|
|
174
174
|
* end (its own failure included), with no engine refusal and no shim fault.
|
|
@@ -98,19 +98,6 @@ const VC_URL_RETRIEVAL_SIGNATURE = {
|
|
|
98
98
|
},
|
|
99
99
|
},
|
|
100
100
|
description: 'Every link it fetched, one record each. Empty when there was no link worth following.',
|
|
101
|
-
// Language version 1: every page it fetched as one text.
|
|
102
|
-
previously: [
|
|
103
|
-
{
|
|
104
|
-
before: 2,
|
|
105
|
-
output: {
|
|
106
|
-
kind: 'value',
|
|
107
|
-
type: { kind: 'string' },
|
|
108
|
-
optional: true,
|
|
109
|
-
description: 'The text of every page it fetched, run together. Nothing when there was no link '
|
|
110
|
-
+ 'worth following.',
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
101
|
},
|
|
115
102
|
};
|
|
116
103
|
/**
|
|
@@ -207,9 +194,9 @@ const LINKEDIN_ENRICHMENT_SIGNATURE = {
|
|
|
207
194
|
linkedin_profile: { kind: 'string' },
|
|
208
195
|
},
|
|
209
196
|
},
|
|
210
|
-
// What a call hands back
|
|
197
|
+
// What a call hands back where the record a stage
|
|
211
198
|
// fed it is the call's argument. Before 5 nothing can call it — it is fed
|
|
212
|
-
// only by an extraction — so this is read by
|
|
199
|
+
// only by an extraction — so this is read by the current language alone.
|
|
213
200
|
output: {
|
|
214
201
|
kind: 'record',
|
|
215
202
|
fields: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// The run host's contract suite: one set of cases, written against the backend
|
|
3
3
|
// families (store.ts) and the core's rules over them, run against every
|
|
4
|
-
// backend (the hosted Postgres one in apps/api
|
|
4
|
+
// backend (the hosted Postgres one in lf-platform's apps/api integration set, `lf`'s
|
|
5
5
|
// SQLite one in apps/cli's tests). Ported from the hosted integration tests
|
|
6
6
|
// (work store, join_pending, park sink, run lease, await correlation, the
|
|
7
7
|
// resume drivers) and lf's state tests, keeping the cases about what the
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Program } from '@listen-fire/movement-lang';
|
|
1
|
+
import type { LanguageVersion, Program } from '@listen-fire/movement-lang';
|
|
2
2
|
/** One `listen` statement, with its instance's construction resolved. */
|
|
3
3
|
export interface FileListener {
|
|
4
4
|
instanceName: string;
|
|
@@ -23,5 +23,5 @@ export interface FileListener {
|
|
|
23
23
|
* anything still unresolvable here is skipped defensively.
|
|
24
24
|
*/
|
|
25
25
|
export declare function collectFileListeners(program: Program, options?: {
|
|
26
|
-
languageVersion?:
|
|
26
|
+
languageVersion?: LanguageVersion;
|
|
27
27
|
}): FileListener[];
|
|
@@ -54,7 +54,7 @@ function collectFileListeners(program, options = {}) {
|
|
|
54
54
|
};
|
|
55
55
|
// A run host unit (`listen to manual fire …`) the file does not bind itself
|
|
56
56
|
// is the host's own, credential-free and argument-free.
|
|
57
|
-
const units =
|
|
57
|
+
const units = movement_lang_1.RUN_HOST_UNITS;
|
|
58
58
|
const unitConstruction = (name) => (units.includes(name) && !imported.has(name) ? { adapter: name } : undefined);
|
|
59
59
|
const original = (local) => importOriginals.get(local) ?? local;
|
|
60
60
|
for (const statement of program.statements) {
|
|
@@ -508,8 +508,8 @@ function instanceSchemaFromDescriptors(input) {
|
|
|
508
508
|
// A system's own edge and its reserved resources reference may share a
|
|
509
509
|
// name (a team's ontology edge called `Resources`): the system's own
|
|
510
510
|
// edge is the one the name walks, whichever the describe listed first.
|
|
511
|
-
// The reserved reference stays reachable by its address (
|
|
512
|
-
//
|
|
511
|
+
// The reserved reference stays reachable by its address (the older
|
|
512
|
+
// language's `_resources`).
|
|
513
513
|
const existing = edges[edge];
|
|
514
514
|
if (existing === undefined ||
|
|
515
515
|
(existing.resources === true && ref.fieldId !== adapter_1.RESOURCES_REFERENCE_FIELD_ID)) {
|
|
@@ -565,7 +565,7 @@ function instanceSchemaFromDescriptors(input) {
|
|
|
565
565
|
// The system's resources edge (the reserved `_resources` reference,
|
|
566
566
|
// walked by its own name — the knowledge graph's `Resources`). The
|
|
567
567
|
// read wrapper sends a walk of it by its reserved fieldId (its
|
|
568
|
-
// address, not its name), and
|
|
568
|
+
// address, not its name), and the checker's
|
|
569
569
|
// refusal of `x-[f:_resources]->` off a record names it.
|
|
570
570
|
...(ref.fieldId === adapter_1.RESOURCES_REFERENCE_FIELD_ID ? { resources: true } : {}),
|
|
571
571
|
...(edgeDescription !== undefined ? { description: edgeDescription } : {}),
|
|
@@ -607,7 +607,7 @@ function instanceSchemaFromDescriptors(input) {
|
|
|
607
607
|
...(writeOnlyProperties.length > 0 ? { writeOnlyProperties } : {}),
|
|
608
608
|
...(ambiguousProperties.length > 0 ? { ambiguousProperties } : {}),
|
|
609
609
|
// The system removes a record of this type (its `deleteRecord`) — the
|
|
610
|
-
// promise `delete x` is checked against
|
|
610
|
+
// promise `delete x` is checked against.
|
|
611
611
|
...(descriptor.deletable === true ? { deletable: true } : {}),
|
|
612
612
|
// The adapter's own words for the type and its fields, which the
|
|
613
613
|
// language service's hover leads with.
|
|
@@ -226,7 +226,7 @@ function inSegment(segmentId, fn) {
|
|
|
226
226
|
async function withSegment(input, fn) {
|
|
227
227
|
const { segmentId } = await openSegment({
|
|
228
228
|
teamId: (0, engine_contracts_1.tenantIdOf)(input.teamId),
|
|
229
|
-
languageVersion: input.languageVersion ?? movement_lang_1.
|
|
229
|
+
languageVersion: input.languageVersion ?? movement_lang_1.LANGUAGE_VERSION,
|
|
230
230
|
...(input.runId !== undefined ? { runId: input.runId } : {}),
|
|
231
231
|
});
|
|
232
232
|
try {
|
|
@@ -268,7 +268,7 @@ exports.segmentScopedCalls = {
|
|
|
268
268
|
* describe, tests) there is no pin and this is the current version.
|
|
269
269
|
*/
|
|
270
270
|
function currentLanguageVersion() {
|
|
271
|
-
return asyncLocalStorage.getStore()?.languageVersion ?? movement_lang_1.
|
|
271
|
+
return asyncLocalStorage.getStore()?.languageVersion ?? movement_lang_1.LANGUAGE_VERSION;
|
|
272
272
|
}
|
|
273
273
|
/**
|
|
274
274
|
* Serve `key` from what this segment has already read, or read it and
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@listen-fire/engine",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "0.12.0-rc.
|
|
5
|
-
"description": "The movement engine for
|
|
4
|
+
"version": "0.12.0-rc.7",
|
|
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 `lf` 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.20.0"
|
|
8
8
|
},
|
|
@@ -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/movement-lang": "^0.12.0-rc.7",
|
|
21
|
+
"@listen-fire/engine-contracts": "^0.12.0-rc.7",
|
|
22
|
+
"@listen-fire/module-runtime": "^0.12.0-rc.7"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/jest": "29.5.14",
|