@elaraai/east-node-cli 1.0.79 → 1.0.81
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/README.md +35 -105
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +37 -135
- package/dist/cli.js.map +1 -1
- package/dist/exec.d.ts +36 -0
- package/dist/exec.d.ts.map +1 -0
- package/dist/exec.js +348 -0
- package/dist/exec.js.map +1 -0
- package/dist/exec.spec.d.ts +6 -0
- package/dist/exec.spec.d.ts.map +1 -0
- package/dist/exec.spec.js +91 -0
- package/dist/exec.spec.js.map +1 -0
- package/dist/loader.d.ts +23 -3
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +190 -36
- package/dist/loader.js.map +1 -1
- package/dist/loader.spec.js +188 -4
- package/dist/loader.spec.js.map +1 -1
- package/dist/merge.d.ts +8 -8
- package/dist/merge.d.ts.map +1 -1
- package/dist/merge.js +167 -221
- package/dist/merge.js.map +1 -1
- package/dist/runner.d.ts +25 -49
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +76 -214
- package/dist/runner.js.map +1 -1
- package/dist/runner.spec.js +191 -336
- package/dist/runner.spec.js.map +1 -1
- package/package.json +4 -6
- package/dist/emit-writer.d.ts +0 -74
- package/dist/emit-writer.d.ts.map +0 -1
- package/dist/emit-writer.js +0 -159
- package/dist/emit-writer.js.map +0 -1
- package/dist/snapshot.d.ts +0 -19
- package/dist/snapshot.d.ts.map +0 -1
- package/dist/snapshot.js +0 -116
- package/dist/snapshot.js.map +0 -1
package/dist/exec.js
ADDED
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* `east-node exec <unit.beast2>`: the runner protocol.
|
|
7
|
+
*
|
|
8
|
+
* A unit (`UnitType` in `@elaraai/east`) runs a program on its inputs, merges
|
|
9
|
+
* the parts of one output that earlier units wrote, or takes a delivered
|
|
10
|
+
* collection in, and names where its output and its result go. A program's
|
|
11
|
+
* output is written by its kind:
|
|
12
|
+
* - a value as one blob, or as a manifest directory when it is a collection;
|
|
13
|
+
* - an array through the Writer;
|
|
14
|
+
* - a set or a dict through the RunSorter, as sorted runs;
|
|
15
|
+
* - a fold by folding every emitted value into an accumulator.
|
|
16
|
+
*
|
|
17
|
+
* A delivery taken in is read a segment at a time from its file, and written
|
|
18
|
+
* through the Writer as a manifest directory (`intakeBeast2For`).
|
|
19
|
+
*
|
|
20
|
+
* Collections are written as manifest directories, which a store takes in by
|
|
21
|
+
* linking their files. The result (`UnitResultType`) records the outcome — `ok`,
|
|
22
|
+
* or the failure's message and source locations — with the process's peak
|
|
23
|
+
* memory and where the time went. east-c and east-py implement the same
|
|
24
|
+
* protocol, and the conformance corpus holds the three to the same output
|
|
25
|
+
* bytes and outcomes.
|
|
26
|
+
*/
|
|
27
|
+
import { closeSync, fstatSync, mkdirSync, openSync, readdirSync, readFileSync, readSync, writeFileSync } from 'node:fs';
|
|
28
|
+
import { dirname, isAbsolute, join, resolve } from 'node:path';
|
|
29
|
+
import { Beast2ManifestWriter, Beast2RunSorter, EastError, EastIR, EastTypeValueType, SortedMap, SortedSet, UnitType, compareFor, configureFramePool, decodeBeast2For, encodeBeast2For, intakeBeast2For, isTypeValueEqual, variant, } from '@elaraai/east';
|
|
30
|
+
import { printTypeValue } from '@elaraai/east/internal';
|
|
31
|
+
import { inputBytes, loadEastIR, loadInput, loadInputLazy, loadPlatforms, segmentDirFor } from './loader.js';
|
|
32
|
+
import { mergeBlobs } from './merge.js';
|
|
33
|
+
import { lazyThreshold, loadMergeFunction, peakBytes } from './runner.js';
|
|
34
|
+
/**
|
|
35
|
+
* Reads a unit file.
|
|
36
|
+
*
|
|
37
|
+
* @param unitPath - the unit file
|
|
38
|
+
* @returns the unit, and how to resolve the paths it names
|
|
39
|
+
* @throws {Error} When the file cannot be read or does not hold a unit.
|
|
40
|
+
*/
|
|
41
|
+
export function readUnit(unitPath) {
|
|
42
|
+
const unit = decodeBeast2For(UnitType)(readFileSync(unitPath));
|
|
43
|
+
const base = dirname(resolve(unitPath));
|
|
44
|
+
return { unit, at: (path) => (isAbsolute(path) ? path : resolve(base, path)) };
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Executes a unit: does its work, writes its output, and reports how it went.
|
|
48
|
+
*
|
|
49
|
+
* @param read - the unit, and how to resolve the paths it names
|
|
50
|
+
* @returns the result — a failure is its outcome, never a throw
|
|
51
|
+
*
|
|
52
|
+
* @remarks
|
|
53
|
+
* The unit's thread grant caps the frame pool for the rest of the process: a
|
|
54
|
+
* grant of one frames every output inline.
|
|
55
|
+
*/
|
|
56
|
+
export async function executeUnit({ unit, at }) {
|
|
57
|
+
configureFramePool({ workers: Number(unit.threads) });
|
|
58
|
+
const timings = { load: 0, compile: 0, execute: 0, output: 0 };
|
|
59
|
+
let mark = performance.now();
|
|
60
|
+
const lap = (phase) => {
|
|
61
|
+
const now = performance.now();
|
|
62
|
+
timings[phase] += now - mark;
|
|
63
|
+
mark = now;
|
|
64
|
+
};
|
|
65
|
+
let outcome;
|
|
66
|
+
try {
|
|
67
|
+
const platformFns = await loadPlatforms(unit.platforms);
|
|
68
|
+
if (unit.work.type === 'run') {
|
|
69
|
+
await runWork(unit.work.value, platformFns, at, lap);
|
|
70
|
+
}
|
|
71
|
+
else if (unit.work.type === 'merge') {
|
|
72
|
+
mergeWork(unit.work.value, platformFns, at, lap);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
intakeWork(unit.work.value, at, lap);
|
|
76
|
+
}
|
|
77
|
+
outcome = variant('ok', null);
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
outcome = err instanceof EastError
|
|
81
|
+
? variant('failed', { message: err.eastMessage, locations: err.location })
|
|
82
|
+
: variant('failed', { message: err?.message ?? String(err), locations: [] });
|
|
83
|
+
}
|
|
84
|
+
return { outcome, peakBytes: peakBytes(), timings };
|
|
85
|
+
}
|
|
86
|
+
/** Runs a program on its inputs and writes what it produces. */
|
|
87
|
+
async function runWork(work, platformFns, at, lap) {
|
|
88
|
+
const program = loadEastIR(at(work.program));
|
|
89
|
+
const signature = program.ir.value.type.value;
|
|
90
|
+
// Every kind but a value is emitted, through the trailing parameter.
|
|
91
|
+
const emitted = work.output.type !== 'value';
|
|
92
|
+
if (emitted && signature.inputs.length === 0) {
|
|
93
|
+
throw new Error(`exec: a ${work.output.type} output is emitted: the program's trailing parameter must be emit, a function`);
|
|
94
|
+
}
|
|
95
|
+
const params = emitted ? signature.inputs.slice(0, -1) : signature.inputs;
|
|
96
|
+
if (work.inputs.length !== params.length) {
|
|
97
|
+
const printed = `(${signature.inputs.map((type) => printTypeValue(type)).join(', ')}) -> ${printTypeValue(signature.output)}`;
|
|
98
|
+
throw new Error(`Function expects ${params.length} inputs, got ${work.inputs.length}\nSignature: ${printed}`);
|
|
99
|
+
}
|
|
100
|
+
// Inputs are frozen. One at or above the lazy threshold opens as a paged
|
|
101
|
+
// value, weighed by the value it holds: a manifest is a small file naming
|
|
102
|
+
// large ones.
|
|
103
|
+
const threshold = lazyThreshold();
|
|
104
|
+
const inputs = work.inputs.map((input, i) => {
|
|
105
|
+
const path = at(input);
|
|
106
|
+
const lazy = threshold > 0 && inputBytes(path) >= threshold ? loadInputLazy(path) : undefined;
|
|
107
|
+
return lazy !== undefined ? lazy : loadInput(path, params[i]);
|
|
108
|
+
});
|
|
109
|
+
lap('load');
|
|
110
|
+
const compiled = program.compile(platformFns);
|
|
111
|
+
const output = openOutput(work.output, emitted ? signature.inputs.at(-1) : signature.output, platformFns, at);
|
|
112
|
+
lap('compile');
|
|
113
|
+
const result = await compiled(...inputs, ...(output.emit !== undefined ? [output.emit] : []));
|
|
114
|
+
lap('execute');
|
|
115
|
+
output.finish(result);
|
|
116
|
+
lap('output');
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Opens a running program's output.
|
|
120
|
+
*
|
|
121
|
+
* @param output - the output
|
|
122
|
+
* @param type - the program's result type, for a value; its emit parameter's
|
|
123
|
+
* type otherwise
|
|
124
|
+
* @param platformFns - the platforms a fold's functions compile with
|
|
125
|
+
* @param at - resolves the paths the output names
|
|
126
|
+
* @returns the sink
|
|
127
|
+
* @throws {Error} When the emit parameter does not fit the kind, a fold's
|
|
128
|
+
* function does not fit the emitted type, or an output directory holds
|
|
129
|
+
* anything already.
|
|
130
|
+
*/
|
|
131
|
+
function openOutput(output, type, platformFns, at) {
|
|
132
|
+
if (output.type === 'value') {
|
|
133
|
+
const path = at(output.value);
|
|
134
|
+
return { finish: (result) => writeValue(path, type, result) };
|
|
135
|
+
}
|
|
136
|
+
const arity = output.type === 'dict' ? 2 : 1;
|
|
137
|
+
const emitInputs = type.type === 'Function' ? type.value.inputs : null;
|
|
138
|
+
if (emitInputs === null || emitInputs.length !== arity) {
|
|
139
|
+
throw new Error(`exec: a ${output.type} output is emitted: the program's trailing parameter must be emit, a function of ${arity} argument${arity === 1 ? '' : 's'}, got ${printTypeValue(type)}`);
|
|
140
|
+
}
|
|
141
|
+
const element = emitInputs[0];
|
|
142
|
+
switch (output.type) {
|
|
143
|
+
case 'array': {
|
|
144
|
+
const writer = new Beast2ManifestWriter(variant('Array', element), manifestDirectory(join(outputDirectory(at(output.value)), '0.beast2')), { parallel: true });
|
|
145
|
+
return {
|
|
146
|
+
emit: (value) => { writer.add(value); return null; },
|
|
147
|
+
finish: () => writer.finish(),
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
case 'set': {
|
|
151
|
+
const dir = outputDirectory(at(output.value));
|
|
152
|
+
const sorter = new Beast2RunSorter(variant('Set', element), (run) => manifestDirectory(join(dir, `${run}.beast2`)), { union: true, parallel: true });
|
|
153
|
+
return {
|
|
154
|
+
emit: (value) => { sorter.add(value); return null; },
|
|
155
|
+
finish: () => sorter.finish(),
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
case 'dict': {
|
|
159
|
+
const value = emitInputs[1];
|
|
160
|
+
const merge = output.value.merge.type === 'some'
|
|
161
|
+
? loadMergeFunction(at(output.value.merge.value), element, value, platformFns, 'the emit parameter')
|
|
162
|
+
: undefined;
|
|
163
|
+
const dir = outputDirectory(at(output.value.dir));
|
|
164
|
+
const sorter = new Beast2RunSorter(variant('Dict', { key: element, value }), (run) => manifestDirectory(join(dir, `${run}.beast2`)), { ...(merge !== undefined && { merge }), parallel: true });
|
|
165
|
+
return {
|
|
166
|
+
emit: (key, entry) => { sorter.add([key, entry]); return null; },
|
|
167
|
+
finish: () => sorter.finish(),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
case 'fold': {
|
|
171
|
+
const { combine } = loadCombineFunction(at(output.value.combine), element, platformFns);
|
|
172
|
+
const path = at(output.value.path);
|
|
173
|
+
let acc = loadInput(at(output.value.zero), element);
|
|
174
|
+
return {
|
|
175
|
+
emit: (value) => { acc = combine(acc, value); return null; },
|
|
176
|
+
finish: () => writeValue(path, element, acc),
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
/** Assembles the parts of one output into one. */
|
|
182
|
+
function mergeWork(work, platformFns, at, lap) {
|
|
183
|
+
const output = work.output;
|
|
184
|
+
const parts = work.parts.map((part) => at(part));
|
|
185
|
+
switch (output.type) {
|
|
186
|
+
case 'set':
|
|
187
|
+
case 'dict': {
|
|
188
|
+
const dir = outputDirectory(at(output.type === 'set' ? output.value : output.value.dir));
|
|
189
|
+
lap('load');
|
|
190
|
+
mergeBlobs(parts, manifestDirectory(join(dir, '0.beast2')), {
|
|
191
|
+
union: output.type === 'set',
|
|
192
|
+
...(output.type === 'dict' && output.value.merge.type === 'some' && { mergePath: at(output.value.merge.value) }),
|
|
193
|
+
...(work.range.type === 'some' && { rangePath: at(work.range.value) }),
|
|
194
|
+
platformFns,
|
|
195
|
+
});
|
|
196
|
+
lap('execute');
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
case 'fold': {
|
|
200
|
+
const { combine, type } = loadCombineFunction(at(output.value.combine), null, platformFns);
|
|
201
|
+
let acc = loadInput(at(output.value.zero), type);
|
|
202
|
+
lap('compile');
|
|
203
|
+
for (const part of parts)
|
|
204
|
+
acc = combine(acc, loadInput(part, type));
|
|
205
|
+
lap('execute');
|
|
206
|
+
writeValue(at(output.value.path), type, acc);
|
|
207
|
+
lap('output');
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
case 'array':
|
|
211
|
+
throw new Error("exec: an array's parts are concatenated, never merged: a merge unit takes set, dict or fold parts");
|
|
212
|
+
case 'value':
|
|
213
|
+
throw new Error('exec: a value has no parts: a merge unit takes set, dict or fold parts');
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Takes a delivered collection in: the file read a segment at a time, through
|
|
218
|
+
* positioned reads, and written through the Writer as the manifest directory
|
|
219
|
+
* the unit names.
|
|
220
|
+
*
|
|
221
|
+
* @throws {Error} When the type file does not hold a type, the delivery cannot
|
|
222
|
+
* be read, or the intake refuses it — every refusal in the words each runner
|
|
223
|
+
* uses.
|
|
224
|
+
*/
|
|
225
|
+
function intakeWork(work, at, lap) {
|
|
226
|
+
let type;
|
|
227
|
+
try {
|
|
228
|
+
type = decodeBeast2For(EastTypeValueType)(readFileSync(at(work.type)));
|
|
229
|
+
}
|
|
230
|
+
catch {
|
|
231
|
+
throw new Error('exec: intake: its type file does not hold a type');
|
|
232
|
+
}
|
|
233
|
+
const intake = intakeBeast2For(type);
|
|
234
|
+
const fd = openSync(at(work.input), 'r');
|
|
235
|
+
try {
|
|
236
|
+
const delivery = {
|
|
237
|
+
size: fstatSync(fd).size,
|
|
238
|
+
read: (offset, length) => {
|
|
239
|
+
const out = new Uint8Array(length);
|
|
240
|
+
let done = 0;
|
|
241
|
+
while (done < length) {
|
|
242
|
+
const got = readSync(fd, out, done, length - done, offset + done);
|
|
243
|
+
if (got === 0)
|
|
244
|
+
break;
|
|
245
|
+
done += got;
|
|
246
|
+
}
|
|
247
|
+
return done === length ? out : out.subarray(0, done);
|
|
248
|
+
},
|
|
249
|
+
};
|
|
250
|
+
lap('load');
|
|
251
|
+
const segments = work.segments.type === 'some'
|
|
252
|
+
? { segments: { from: Number(work.segments.value.from), to: Number(work.segments.value.to) } }
|
|
253
|
+
: {};
|
|
254
|
+
intake(delivery, manifestDirectory(at(work.output)), { ...segments, parallel: true });
|
|
255
|
+
lap('execute');
|
|
256
|
+
}
|
|
257
|
+
finally {
|
|
258
|
+
closeSync(fd);
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Loads a fold's `combine`: an IR file holding a `(T, T) -> T` East function,
|
|
263
|
+
* compiled with the unit's platforms.
|
|
264
|
+
*
|
|
265
|
+
* @param path - the IR file
|
|
266
|
+
* @param type - the emitted type, or `null` to take `T` from the function —
|
|
267
|
+
* a merge of fold partials has no program to say what was emitted
|
|
268
|
+
* @param platformFns - the unit's platforms
|
|
269
|
+
* @returns the compiled function, and `T`
|
|
270
|
+
* @throws {Error} When the IR is not a function of that shape.
|
|
271
|
+
*/
|
|
272
|
+
function loadCombineFunction(path, type, platformFns) {
|
|
273
|
+
const bundle = loadEastIR(path);
|
|
274
|
+
const fnType = bundle.ir.value.type;
|
|
275
|
+
const shape = fnType.type === 'Function' ? fnType.value : null;
|
|
276
|
+
const t = type ?? shape?.output;
|
|
277
|
+
if (shape === null || t === undefined || shape.inputs.length !== 2 ||
|
|
278
|
+
!isTypeValueEqual(shape.inputs[0], t) ||
|
|
279
|
+
!isTypeValueEqual(shape.inputs[1], t) ||
|
|
280
|
+
!isTypeValueEqual(shape.output, t)) {
|
|
281
|
+
const expected = t !== undefined ? ` (T = ${printTypeValue(t)})` : '';
|
|
282
|
+
throw new Error(`exec: combine: expected a function (T, T) -> T${expected}, got ${printTypeValue(fnType)}`);
|
|
283
|
+
}
|
|
284
|
+
return { combine: bundle.compile(platformFns), type: t };
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Writes a value output: a collection as a manifest directory at `path`,
|
|
288
|
+
* anything else as one blob there.
|
|
289
|
+
*
|
|
290
|
+
* @param path - the output file
|
|
291
|
+
* @param type - the value's type
|
|
292
|
+
* @param value - the value
|
|
293
|
+
*/
|
|
294
|
+
function writeValue(path, type, value) {
|
|
295
|
+
if (type.type !== 'Array' && type.type !== 'Set' && type.type !== 'Dict') {
|
|
296
|
+
writeFileSync(path, encodeBeast2For(type)(value));
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
// A collection goes in canonical order: a Set or Dict an East program
|
|
300
|
+
// built is sorted already, and a plain one is sorted first.
|
|
301
|
+
const key = (type.type === 'Dict' ? type.value.key : type.value);
|
|
302
|
+
const cmp = compareFor(key);
|
|
303
|
+
const elements = type.type === 'Array' ? value
|
|
304
|
+
: type.type === 'Set' ? (value instanceof SortedSet ? value : [...value].sort(cmp))
|
|
305
|
+
: value instanceof SortedMap ? value.entries() : [...value.entries()].sort((a, b) => cmp(a[0], b[0]));
|
|
306
|
+
const writer = new Beast2ManifestWriter(type, manifestDirectory(path), { parallel: true });
|
|
307
|
+
for (const element of elements)
|
|
308
|
+
writer.add(element);
|
|
309
|
+
writer.finish();
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* The sink a manifest directory is written through: the manifest at `path`,
|
|
313
|
+
* written last, and every object it names in `<path>.segments/` under its
|
|
314
|
+
* SHA-256 — the layout a store takes in by linking, and every runner's opener
|
|
315
|
+
* reads.
|
|
316
|
+
*
|
|
317
|
+
* @param path - the manifest's file
|
|
318
|
+
* @returns the sink
|
|
319
|
+
*/
|
|
320
|
+
function manifestDirectory(path) {
|
|
321
|
+
const segments = segmentDirFor(path);
|
|
322
|
+
let made = false;
|
|
323
|
+
return {
|
|
324
|
+
object: (hash, bytes) => {
|
|
325
|
+
if (!made) {
|
|
326
|
+
mkdirSync(segments, { recursive: true });
|
|
327
|
+
made = true;
|
|
328
|
+
}
|
|
329
|
+
writeFileSync(join(segments, `${hash}.beast2`), bytes);
|
|
330
|
+
},
|
|
331
|
+
manifest: (bytes) => writeFileSync(path, bytes),
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Creates an output directory of runs, which must hold nothing yet: every
|
|
336
|
+
* manifest in it is one of the unit's runs.
|
|
337
|
+
*
|
|
338
|
+
* @param dir - the directory
|
|
339
|
+
* @returns the directory
|
|
340
|
+
* @throws {Error} When it holds anything already.
|
|
341
|
+
*/
|
|
342
|
+
function outputDirectory(dir) {
|
|
343
|
+
mkdirSync(dir, { recursive: true });
|
|
344
|
+
if (readdirSync(dir).length > 0)
|
|
345
|
+
throw new Error(`exec: the output directory ${dir} is not empty`);
|
|
346
|
+
return dir;
|
|
347
|
+
}
|
|
348
|
+
//# sourceMappingURL=exec.js.map
|
package/dist/exec.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.js","sourceRoot":"","sources":["../src/exec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxH,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,EACH,oBAAoB,EACpB,eAAe,EACf,SAAS,EACT,MAAM,EACN,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,QAAQ,EACR,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,OAAO,GASV,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,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,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YACpB,IAAI,CAAC,IAAI,EAAE,CAAC;gBACR,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;gBACzC,IAAI,GAAG,IAAI,CAAC;YAChB,CAAC;YACD,aAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,IAAI,SAAS,CAAC,EAAE,KAAK,CAAC,CAAC;QAC3D,CAAC;QACD,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,EAAE,KAAK,CAAC;KAClD,CAAC;AACN,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,eAAe,CAAC,GAAW;IAChC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACpC,IAAI,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,GAAG,eAAe,CAAC,CAAC;IACnG,OAAO,GAAG,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.spec.d.ts","sourceRoot":"","sources":["../src/exec.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* `exec`, held to the runner protocol's conformance corpus: every case, run
|
|
7
|
+
* through this runner, writes the corpus's bytes and comes to its outcome, as
|
|
8
|
+
* east-c's and east-py's runners must. The corpus is `east`'s
|
|
9
|
+
* (`test/runner_corpus.spec.ts`): read from `EAST_RUNNER_CORPUS` when that
|
|
10
|
+
* names one, and written afresh for this run otherwise.
|
|
11
|
+
*/
|
|
12
|
+
import { describe, it, before, after } from 'node:test';
|
|
13
|
+
import assert from 'node:assert/strict';
|
|
14
|
+
import { spawnSync } from 'node:child_process';
|
|
15
|
+
import { cpSync, existsSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
|
|
16
|
+
import { tmpdir } from 'node:os';
|
|
17
|
+
import { dirname, join } from 'node:path';
|
|
18
|
+
import { fileURLToPath } from 'node:url';
|
|
19
|
+
import { ArrayType, StringType, UnitOutcomeType, UnitResultType, decodeBeast2, decodeBeast2For, equalFor, } from '@elaraai/east';
|
|
20
|
+
const bin = fileURLToPath(new URL('../bin/east-node.mjs', import.meta.url));
|
|
21
|
+
describe('exec: the runner protocol corpus', () => {
|
|
22
|
+
let corpus;
|
|
23
|
+
let generated;
|
|
24
|
+
let scratch;
|
|
25
|
+
before(() => {
|
|
26
|
+
scratch = mkdtempSync(join(tmpdir(), 'east-node-exec-'));
|
|
27
|
+
if (process.env.EAST_RUNNER_CORPUS) {
|
|
28
|
+
corpus = process.env.EAST_RUNNER_CORPUS;
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
generated = mkdtempSync(join(tmpdir(), 'east-runner-corpus-'));
|
|
32
|
+
const spec = join(dirname(fileURLToPath(import.meta.resolve('@elaraai/east'))), '..', 'test', 'runner_corpus.spec.js');
|
|
33
|
+
// Without this run's test context, which would make the child report
|
|
34
|
+
// to it instead of running its own tests.
|
|
35
|
+
const { NODE_TEST_CONTEXT: _context, ...env } = process.env;
|
|
36
|
+
const written = spawnSync(process.execPath, ['--enable-source-maps', '--test', spec], {
|
|
37
|
+
env: { ...env, EXPORT_TEST_IR: generated },
|
|
38
|
+
encoding: 'utf8',
|
|
39
|
+
});
|
|
40
|
+
assert.equal(written.status, 0, `writing the corpus failed:\n${written.stdout.slice(-4_000)}${written.stderr.slice(-4_000)}`);
|
|
41
|
+
corpus = join(generated, 'runner_corpus');
|
|
42
|
+
});
|
|
43
|
+
after(() => {
|
|
44
|
+
rmSync(scratch, { recursive: true, force: true });
|
|
45
|
+
if (generated !== undefined)
|
|
46
|
+
rmSync(generated, { recursive: true, force: true });
|
|
47
|
+
});
|
|
48
|
+
it('executes every case to its outputs and its outcome', () => {
|
|
49
|
+
const names = decodeBeast2For(ArrayType(StringType))(readFileSync(join(corpus, 'index.beast2')));
|
|
50
|
+
assert.ok(names.length > 0, 'the corpus holds cases');
|
|
51
|
+
const equalOutcome = equalFor(UnitOutcomeType);
|
|
52
|
+
for (const name of names) {
|
|
53
|
+
const expected = decodeBeast2(readFileSync(join(corpus, name, 'case.beast2'))).value;
|
|
54
|
+
// A copy per case: a unit writes beside itself.
|
|
55
|
+
const dir = join(scratch, name);
|
|
56
|
+
cpSync(join(corpus, name), dir, { recursive: true });
|
|
57
|
+
const run = spawnSync(process.execPath, [bin, 'exec', join(dir, 'unit.beast2')], {
|
|
58
|
+
env: { ...process.env, ...(expected.lazy && { EAST_LAZY_INPUT_BYTES: '1' }) },
|
|
59
|
+
encoding: 'utf8',
|
|
60
|
+
});
|
|
61
|
+
const ok = expected.outcome.type === 'ok';
|
|
62
|
+
assert.equal(run.status, ok ? 0 : 1, `${name}: exit ${run.status}\n${run.stderr.slice(-2_000)}`);
|
|
63
|
+
const result = decodeBeast2For(UnitResultType)(readFileSync(join(dir, 'result.beast2')));
|
|
64
|
+
assert.ok(equalOutcome(result.outcome, expected.outcome), `${name}: the outcome ${JSON.stringify(result.outcome, (_k, v) => typeof v === 'bigint' ? `${v}` : v)}`);
|
|
65
|
+
assert.ok(result.peakBytes > 0n, `${name}: the peak is measured`);
|
|
66
|
+
for (const output of expected.outputs) {
|
|
67
|
+
const path = join(dir, output.path);
|
|
68
|
+
assert.ok(existsSync(path), `${name}: ${output.path} is written`);
|
|
69
|
+
assert.deepEqual(new Uint8Array(readFileSync(path)), new Uint8Array(output.bytes), `${name}: ${output.path}`);
|
|
70
|
+
}
|
|
71
|
+
for (const path of expected.absent)
|
|
72
|
+
assert.ok(!existsSync(join(dir, path)), `${name}: ${path} is not written`);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
});
|
|
76
|
+
describe('exec: a unit it cannot read', () => {
|
|
77
|
+
let dir;
|
|
78
|
+
before(() => {
|
|
79
|
+
dir = mkdtempSync(join(tmpdir(), 'east-node-exec-unread-'));
|
|
80
|
+
});
|
|
81
|
+
after(() => {
|
|
82
|
+
rmSync(dir, { recursive: true, force: true });
|
|
83
|
+
});
|
|
84
|
+
it('leaves no result, and exits 2', () => {
|
|
85
|
+
writeFileSync(join(dir, 'garbage.beast2'), 'not a unit');
|
|
86
|
+
const run = spawnSync(process.execPath, [bin, 'exec', join(dir, 'garbage.beast2')], { encoding: 'utf8' });
|
|
87
|
+
assert.equal(run.status, 2);
|
|
88
|
+
assert.match(run.stderr, /^Error: exec /);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
//# sourceMappingURL=exec.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.spec.js","sourceRoot":"","sources":["../src/exec.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC/F,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EACH,SAAS,EACT,UAAU,EACV,eAAe,EACf,cAAc,EACd,YAAY,EACZ,eAAe,EACf,QAAQ,GAEX,MAAM,eAAe,CAAC;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AAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;QAC5B,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
package/dist/loader.d.ts
CHANGED
|
@@ -80,9 +80,10 @@ export declare function loadEastIR(filePath: string): EastIR<any, any> | AsyncEa
|
|
|
80
80
|
*/
|
|
81
81
|
export declare function loadInput(filePath: string, type: EastTypeValue): unknown;
|
|
82
82
|
/**
|
|
83
|
-
* Bytes a value from {@link loadInputLazy} has read
|
|
84
|
-
*
|
|
85
|
-
*
|
|
83
|
+
* Bytes a value from {@link loadInputLazy} has read so far: the geometry
|
|
84
|
+
* (tail and head), every fence probe, and each segment frame decoded, across
|
|
85
|
+
* the input file and every segment file a manifest-rooted input opened.
|
|
86
|
+
* `undefined` for any other value.
|
|
86
87
|
*
|
|
87
88
|
* @param value - a task input value
|
|
88
89
|
* @returns the byte count, or `undefined` when the value was not opened lazily
|
|
@@ -118,4 +119,23 @@ export declare function lazyInputBytesRead(value: unknown): number | undefined;
|
|
|
118
119
|
* @returns The lazy collection value, or `undefined` to fall back
|
|
119
120
|
*/
|
|
120
121
|
export declare function loadInputLazy(filePath: string): unknown | undefined;
|
|
122
|
+
/** The directory a manifest-rooted input's segment files sit in, beside the
|
|
123
|
+
* file itself: `<input>.segments/<hash>.beast2`. The convention is shared
|
|
124
|
+
* with e3-core's staging and with the other runtimes. */
|
|
125
|
+
export declare function segmentDirFor(filePath: string): string;
|
|
126
|
+
/**
|
|
127
|
+
* The bytes an input stands for: the collection a manifest-rooted file names
|
|
128
|
+
* — the manifest and every segment file — or any other file's own size.
|
|
129
|
+
*
|
|
130
|
+
* @remarks
|
|
131
|
+
* What the lazy-open threshold and the verbose account measure. A manifest is
|
|
132
|
+
* a few dozen bytes per segment whatever the collection weighs, so its file's
|
|
133
|
+
* size would put a multi-gigabyte input under any threshold and decode it
|
|
134
|
+
* whole. The manifest is recognised through a positioned reader, so a large
|
|
135
|
+
* blob is never read to learn that it is not one.
|
|
136
|
+
*
|
|
137
|
+
* @param filePath - Path to the input file
|
|
138
|
+
* @returns the byte count
|
|
139
|
+
*/
|
|
140
|
+
export declare function inputBytes(filePath: string): number;
|
|
121
141
|
//# sourceMappingURL=loader.d.ts.map
|
package/dist/loader.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../src/loader.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAgBH,MAAM,EACN,WAAW,EACX,KAAK,aAAa,EAErB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,gBAAgB,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAWhF;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,sBAAsB;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,iDAAiD;IACjD,GAAG,EAAE,gBAAgB,EAAE,CAAC;CAC3B;AAsDD;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAyCnF;AAED;;;;;GAKG;AACH,wBAAsB,wBAAwB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAsB7F;AAED;;;;;GAKG;AACH,wBAAsB,aAAa,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CASvF;AAmDD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,WAAW,CAAC,EAAE,CAAC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