space-data-module-sdk 0.9.7 → 0.9.9
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/docs/events-abi.html +1 -1
- package/docs/events-abi.md +1 -1
- package/docs/tri-runtime-parity.html +5 -0
- package/docs/tri-runtime-parity.md +16 -0
- package/package.json +1 -1
- package/schemas/orbpro/Propagator.fbs +4 -4
- package/schemas/orbpro/reference-frame-crosswalk.json +4 -4
- package/src/compiler/compileModule.js +51 -2
- package/src/flow/flowCompiler.js +1 -1
- package/src/host/browserModuleHarness.js +10 -4
- package/src/host/isomorphicLoader.js +24 -5
- package/src/index.d.ts +23 -0
- package/src/invoke/commandOutcome.js +38 -0
- package/src/invoke/index.js +1 -0
- package/src/testing/headlessShell.js +80 -0
- package/src/testing/index.d.ts +5 -0
- package/src/testing/parityBrowserRunner.js +21 -3
- package/src/testing/parityGate.js +3 -19
- package/src/testing/parityHarness.js +4 -0
- package/src/testing/parityLanes.js +32 -56
- package/src/testing/wasmedgeOutput.js +1 -0
package/docs/events-abi.html
CHANGED
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
<p>A GMAT-style <code>Propagate ... {Sat.Altitude = 400}</code> is this ABI with one component whose <code>isStopCondition</code> is true and whose <code>g = parameter - goalValue</code>. Nothing is added to the propagator ABI, and that is an engineering decision, not a scoping convenience:</p>
|
|
179
179
|
<ol>
|
|
180
180
|
<li><strong>It is the same algorithm.</strong> A stop condition is <code>(event function, root refinement)</code>. Putting a second copy of Brent behind <code>plugin_propagate</code> would be two implementations of one algorithm that must agree — exactly the drift the generated-ABI lane exists to end.</li>
|
|
181
|
-
<li><strong>It would break every shipped propagator.</strong> The propagator export set is a per-epoch state evaluation. Adding stop conditions to it makes root refinement a family-wide obligation on <code>sgp4</code>, <code>
|
|
181
|
+
<li><strong>It would break every shipped propagator.</strong> The propagator export set is a per-epoch state evaluation. Adding stop conditions to it makes root refinement a family-wide obligation on <code>sgp4</code>, <code>ffm</code> and <code>keplerian-reference</code>, all in the field. That is a breaking ABI change and an owner decision.</li>
|
|
182
182
|
<li><strong>A propagator is a state SOURCE.</strong> It has no opinion about what is interesting, and giving it one couples every propagator to the parameter catalog.</li>
|
|
183
183
|
</ol>
|
|
184
184
|
<p><strong>Backward propagation is not a mode.</strong> It is <code>stop</code> earlier than <code>start</code>. The runner steps negatively, the consumer's propagator is asked for earlier epochs, and every hit carries <code>BACKWARD</code>. There is no second code path to keep in agreement with the first.</p>
|
package/docs/events-abi.md
CHANGED
|
@@ -344,7 +344,7 @@ not a scoping convenience:
|
|
|
344
344
|
agree — exactly the drift the generated-ABI lane exists to end.
|
|
345
345
|
2. **It would break every shipped propagator.** The propagator export set is a
|
|
346
346
|
per-epoch state evaluation. Adding stop conditions to it makes root
|
|
347
|
-
refinement a family-wide obligation on `sgp4`, `
|
|
347
|
+
refinement a family-wide obligation on `sgp4`, `ffm` and
|
|
348
348
|
`keplerian-reference`, all in the field. That is a breaking ABI change and
|
|
349
349
|
an owner decision.
|
|
350
350
|
3. **A propagator is a state SOURCE.** It has no opinion about what is
|
|
@@ -136,6 +136,10 @@
|
|
|
136
136
|
<li>thread counts are swept via the fixture's <code>threadEnvVar</code> (default <code>SDM_PARITY_THREADS</code>) — runs at 1/2/4/8 (fixture-configurable) must be byte-identical within a lane AND across lanes. Browser sequential <em>throughput</em> divergence is sanctioned until <code>browser-worker-topology</code> lands; results must still match byte-for-byte;</li>
|
|
137
137
|
<li>signed/published artifacts are stripped to the canonical module payload once (<code>toLoadableWasmBytes</code>) so every lane executes identical wasm bytes.</li>
|
|
138
138
|
</ul>
|
|
139
|
+
<h2 id="command-surface-errors"><a class="anchor" href="#command-surface-errors" aria-hidden="true">#</a>Command-surface errors</h2>
|
|
140
|
+
<p>A non-zero command exit with a well-formed <code>$PIV</code> response on stdout throws <code>PluginInvokeError</code> in both the browser and WasmEdge harnesses. It preserves <code>statusCode</code>, <code>errorCode</code>, <code>errorMessage</code>, <code>exitCode</code>, and the decoded <code>response</code>. All three parity lanes record the same error summary in <code>commandError</code>.</p>
|
|
141
|
+
<p>A non-zero guest exit without a response frame throws <code>WasiExitError</code>, with <code>code</code> and guest <code>stderr</code>. Runtime traps remain runtime failures. Exit <code>0</code> is unchanged: the response is returned, including a handler-level non-zero <code>statusCode</code>.</p>
|
|
142
|
+
<p>Every lane run and report summary carries <code>exitCode</code> (a number, or <code>null</code> when no exit code is available) and <code>commandError</code> (<code>PluginInvokeError.toJSON()</code>, or <code>null</code>). Successful runs have <code>exitCode: 0</code> and <code>commandError: null</code>.</p>
|
|
139
143
|
<h2 id="fixtures"><a class="anchor" href="#fixtures" aria-hidden="true">#</a>Fixtures</h2>
|
|
140
144
|
<div class="codeblock"><div class="codeblock-head">json</div><pre><code>{
|
|
141
145
|
"name": "sgp4-command-parity",
|
|
@@ -177,6 +181,7 @@
|
|
|
177
181
|
<nav class="rail" aria-label="On this page"><h2>On this page</h2><ul><li><a class="depth-2" href="#running">Running</a></li>
|
|
178
182
|
<li><a class="depth-2" href="#the-wasmedge-pin-one-place">The WasmEdge pin: ONE place</a></li>
|
|
179
183
|
<li><a class="depth-2" href="#determinism-contract">Determinism contract</a></li>
|
|
184
|
+
<li><a class="depth-2" href="#command-surface-errors">Command-surface errors</a></li>
|
|
180
185
|
<li><a class="depth-2" href="#fixtures">Fixtures</a></li>
|
|
181
186
|
<li><a class="depth-2" href="#scope-and-current-limits-v1">Scope and current limits (v1)</a></li></ul></nav>
|
|
182
187
|
</div>
|
|
@@ -82,6 +82,22 @@ Every lane receives EXACTLY the same guest-observable inputs:
|
|
|
82
82
|
- signed/published artifacts are stripped to the canonical module payload once
|
|
83
83
|
(`toLoadableWasmBytes`) so every lane executes identical wasm bytes.
|
|
84
84
|
|
|
85
|
+
## Command-surface errors
|
|
86
|
+
|
|
87
|
+
A non-zero command exit with a well-formed `$PIV` response on stdout throws
|
|
88
|
+
`PluginInvokeError` in both the browser and WasmEdge harnesses. It preserves
|
|
89
|
+
`statusCode`, `errorCode`, `errorMessage`, `exitCode`, and the decoded `response`.
|
|
90
|
+
All three parity lanes record the same error summary in `commandError`.
|
|
91
|
+
|
|
92
|
+
A non-zero guest exit without a response frame throws `WasiExitError`, with
|
|
93
|
+
`code` and guest `stderr`. Runtime traps remain runtime failures. Exit `0` is
|
|
94
|
+
unchanged: the response is returned, including a handler-level non-zero
|
|
95
|
+
`statusCode`.
|
|
96
|
+
|
|
97
|
+
Every lane run and report summary carries `exitCode` (a number, or `null` when
|
|
98
|
+
no exit code is available) and `commandError` (`PluginInvokeError.toJSON()`, or
|
|
99
|
+
`null`). Successful runs have `exitCode: 0` and `commandError: null`.
|
|
100
|
+
|
|
85
101
|
## Fixtures
|
|
86
102
|
|
|
87
103
|
```json
|
package/package.json
CHANGED
|
@@ -50,7 +50,7 @@ attribute "abi_c_helper_prefix";
|
|
|
50
50
|
// (A) orbpro.propagator (THIS) TEME=0 J2000=1 ICRF=2 ECEF=3 MCI=4 MCMF=5,
|
|
51
51
|
// then the appended axis roster at 6+
|
|
52
52
|
// (B) orbpro.plugins ECI=0 ECEF=1 TEME=2 ICRF=3
|
|
53
|
-
// (PropagatorState.fbs / "PRST" — the wire the compiled sgp4,
|
|
53
|
+
// (PropagatorState.fbs / "PRST" — the wire the compiled sgp4, ffm,
|
|
54
54
|
// conjunction-assessment and sensor-shader modules already emit)
|
|
55
55
|
// (C) OrbPro engine ReferenceFrame.js — NINE members, not two:
|
|
56
56
|
// FIXED=0 INERTIAL=1 TEME=2 VVLH=3 ENU=4 NED=5 NEU=6 RIC=7 LVLH=8
|
|
@@ -69,7 +69,7 @@ attribute "abi_c_helper_prefix";
|
|
|
69
69
|
// collapsing (A) and (B) is a wire break, not a Wave-0 edit — see
|
|
70
70
|
// graph/tasks/sdk-reference-frame-enum-unification.md, which also owns the
|
|
71
71
|
// (A)-vs-(C) inversion at 0/1. The reference pattern for a correct seam is
|
|
72
|
-
// propagator.
|
|
72
|
+
// propagator.ffm/index.js createSourceFromState.
|
|
73
73
|
//
|
|
74
74
|
// The crosswalk between all of these is DATA, in
|
|
75
75
|
// schemas/orbpro/reference-frame-crosswalk.json, and
|
|
@@ -146,8 +146,8 @@ enum StateFlags : uint (abi, abi_c_name: "OrbProStateFlags", abi_c_prefix: "ORBP
|
|
|
146
146
|
|
|
147
147
|
// Synced to the ratified SDS VCM.propagatorFamily vocabulary (schema/VCM/main.fbs)
|
|
148
148
|
// so any provider self-identifying in PropagatorDescribeSourcesBatchResult uses
|
|
149
|
-
// the SAME family codes SDS already carries —
|
|
150
|
-
// integrators map to COWELL (no
|
|
149
|
+
// the SAME family codes SDS already carries — FFM/Cowell-class numerical
|
|
150
|
+
// integrators map to COWELL (no FFM-specific code needed); new codes go
|
|
151
151
|
// through Themis's SDS auto-ratification law, never invented here first.
|
|
152
152
|
enum PropagatorSourceKind : ubyte {
|
|
153
153
|
NONE = 0,
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"vocabularies": [
|
|
5
5
|
{
|
|
6
6
|
"id": "orbpro.plugins",
|
|
7
|
-
"description": "PropagatorState.fbs / \"PRST\" \u2014 the wire the compiled sgp4,
|
|
7
|
+
"description": "PropagatorState.fbs / \"PRST\" \u2014 the wire the compiled sgp4, ffm, conjunction-assessment and sensor-shader modules already emit. Its values are FROZEN by artifacts in the field; collapsing it into the ABI enum is a wire break, tracked as sdk-reference-frame-enum-unification.",
|
|
8
8
|
"repo": "space-data-network-modules",
|
|
9
9
|
"source": "propagator/sgp4/schemas/PropagatorState.fbs",
|
|
10
10
|
"members": {
|
|
@@ -75,10 +75,10 @@
|
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
77
|
{
|
|
78
|
-
"id": "modules.
|
|
79
|
-
"description": "The
|
|
78
|
+
"id": "modules.ffm.coords",
|
|
79
|
+
"description": "The FFM (Full Force Model) propagator's internal chain vocabulary.",
|
|
80
80
|
"repo": "space-data-network-modules",
|
|
81
|
-
"source": "propagator/
|
|
81
|
+
"source": "propagator/ffm/lib/coords_types.h",
|
|
82
82
|
"members": {
|
|
83
83
|
"TEME": "TEME",
|
|
84
84
|
"GCRF": "ICRF",
|
|
@@ -170,6 +170,54 @@ const MAX_STACK_SIZE_BYTES = 1024 * 1024 * 1024;
|
|
|
170
170
|
const SEQUENTIAL_INITIAL_MEMORY_BYTES = 16 * 1024 * 1024;
|
|
171
171
|
const SEQUENTIAL_MAX_MEMORY_BYTES = 2147483648;
|
|
172
172
|
|
|
173
|
+
// Those are DEFAULTS, not a contract. On wasm32-wasip1-threads the memory a
|
|
174
|
+
// sequential guest defines is SHARED (the triple implies atomics; see
|
|
175
|
+
// assertSequentialArtifact), and a browser reserves a shared memory's whole
|
|
176
|
+
// maximum up front because it can never move: three 2 GiB guests on one page
|
|
177
|
+
// are 6 GiB of address space, which a phone refuses. `initialMemoryBytes` /
|
|
178
|
+
// `maximumMemoryBytes` (declared in index.d.ts) size a guest to its measured
|
|
179
|
+
// need. Whole 64 KiB pages, initial <= maximum <= 4 GiB (wasm32).
|
|
180
|
+
const WASM_PAGE_BYTES = 64 * 1024;
|
|
181
|
+
const WASM32_MAX_MEMORY_BYTES = 4 * 1024 * 1024 * 1024;
|
|
182
|
+
|
|
183
|
+
function resolveMemoryBytes(name, value, fallback) {
|
|
184
|
+
if (value === undefined || value === null) {
|
|
185
|
+
return fallback;
|
|
186
|
+
}
|
|
187
|
+
if (
|
|
188
|
+
typeof value !== "number" ||
|
|
189
|
+
!Number.isInteger(value) ||
|
|
190
|
+
value < WASM_PAGE_BYTES ||
|
|
191
|
+
value > WASM32_MAX_MEMORY_BYTES ||
|
|
192
|
+
value % WASM_PAGE_BYTES !== 0
|
|
193
|
+
) {
|
|
194
|
+
throw new Error(
|
|
195
|
+
`${name} must be a whole number of 64 KiB pages between ${WASM_PAGE_BYTES} and ` +
|
|
196
|
+
`${WASM32_MAX_MEMORY_BYTES} bytes, got ${JSON.stringify(value)}.`,
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
return value;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
function resolveSequentialMemory(options) {
|
|
203
|
+
const maximum = resolveMemoryBytes(
|
|
204
|
+
"maximumMemoryBytes",
|
|
205
|
+
options.maximumMemoryBytes,
|
|
206
|
+
SEQUENTIAL_MAX_MEMORY_BYTES,
|
|
207
|
+
);
|
|
208
|
+
const initial = resolveMemoryBytes(
|
|
209
|
+
"initialMemoryBytes",
|
|
210
|
+
options.initialMemoryBytes,
|
|
211
|
+
Math.min(SEQUENTIAL_INITIAL_MEMORY_BYTES, maximum),
|
|
212
|
+
);
|
|
213
|
+
if (initial > maximum) {
|
|
214
|
+
throw new Error(
|
|
215
|
+
`initialMemoryBytes ${initial} exceeds maximumMemoryBytes ${maximum}.`,
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
return { initial, maximum };
|
|
219
|
+
}
|
|
220
|
+
|
|
173
221
|
function resolveStackSize(stackSize) {
|
|
174
222
|
if (stackSize === undefined || stackSize === null) {
|
|
175
223
|
return null;
|
|
@@ -212,11 +260,12 @@ function buildCompilerArgs(exportedSymbols, options = {}) {
|
|
|
212
260
|
// that cannot allocate is not "sequential", it is broken. Same ceiling as
|
|
213
261
|
// PTHREAD_FINAL_LINK_FLAGS' --max-memory, unshared and unimported so the
|
|
214
262
|
// browser needs no cross-origin isolation to load it.
|
|
263
|
+
const sequentialMemory = resolveSequentialMemory(options);
|
|
215
264
|
const sequentialArgs = [
|
|
216
265
|
"-O3",
|
|
217
266
|
"-mbulk-memory",
|
|
218
|
-
`-Wl,--initial-memory=${
|
|
219
|
-
`-Wl,--max-memory=${
|
|
267
|
+
`-Wl,--initial-memory=${sequentialMemory.initial}`,
|
|
268
|
+
`-Wl,--max-memory=${sequentialMemory.maximum}`,
|
|
220
269
|
];
|
|
221
270
|
if (options.noEntry === true) {
|
|
222
271
|
sequentialArgs.push("-mexec-model=reactor");
|
package/src/flow/flowCompiler.js
CHANGED
|
@@ -1395,7 +1395,7 @@ export function validateFlowAPIDeclaration(flow, issues) {
|
|
|
1395
1395
|
// Ruling C (provider method vocabulary): providers in one family are NOT
|
|
1396
1396
|
// required to share a uniform method vocabulary beyond whatever the
|
|
1397
1397
|
// binding's own declared `methodId` demands — sgp4 exposes
|
|
1398
|
-
// ingest_omm/upsert_cat/propagate_state/propagate_path/catalog_query,
|
|
1398
|
+
// ingest_omm/upsert_cat/propagate_state/propagate_path/catalog_query, ffm
|
|
1399
1399
|
// exposes invoke/ingest_state/propagate_state/prepare_trajectory_segments/
|
|
1400
1400
|
// describe_trajectory_segments; a node that asks for "propagator satisfying
|
|
1401
1401
|
// propagate_state" resolves against either, a node that asks for
|
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
decodePluginInvokeResponse,
|
|
44
44
|
writePluginInvokeRequestToArena,
|
|
45
45
|
} from "../invoke/codec.js";
|
|
46
|
+
import { invokeErrorFromCommandRun } from "../invoke/commandOutcome.js";
|
|
46
47
|
import { toUint8Array } from "../runtime/bufferLike.js";
|
|
47
48
|
import {
|
|
48
49
|
ModuleSignatureError,
|
|
@@ -857,6 +858,7 @@ export async function createBrowserModuleHarness(options = {}) {
|
|
|
857
858
|
wasiThreadPoolSize: options.wasiThreadPoolSize,
|
|
858
859
|
});
|
|
859
860
|
lastCommandContext = commandContext;
|
|
861
|
+
let exitError = null;
|
|
860
862
|
try {
|
|
861
863
|
const commandExport = commandContext.instance.exports[DefaultInvokeExports.commandSymbol];
|
|
862
864
|
if (typeof commandExport !== "function") {
|
|
@@ -866,13 +868,17 @@ export async function createBrowserModuleHarness(options = {}) {
|
|
|
866
868
|
}
|
|
867
869
|
commandExport();
|
|
868
870
|
} catch (error) {
|
|
869
|
-
if (!(error instanceof WasiExitError)
|
|
870
|
-
|
|
871
|
-
}
|
|
871
|
+
if (!(error instanceof WasiExitError)) throw error;
|
|
872
|
+
if (error.code !== 0) exitError = error;
|
|
872
873
|
} finally {
|
|
873
874
|
await commandContext.threadHost?.terminateAll();
|
|
874
875
|
}
|
|
875
|
-
|
|
876
|
+
const stdout = commandContext.wasi.stdout;
|
|
877
|
+
if (exitError) {
|
|
878
|
+
exitError.stderr = new TextDecoder().decode(commandContext.wasi.stderr);
|
|
879
|
+
throw invokeErrorFromCommandRun(exitError.code, stdout) ?? exitError;
|
|
880
|
+
}
|
|
881
|
+
return stdout;
|
|
876
882
|
}
|
|
877
883
|
|
|
878
884
|
// --- Public API ---
|
|
@@ -30,6 +30,9 @@ import {
|
|
|
30
30
|
import { attachHostDispatch, inspectModule } from "./isomorphicLoaderCore.js";
|
|
31
31
|
import { assertArtifactRuntimeTarget } from "./runtimeTargetGate.js";
|
|
32
32
|
import { DEFAULT_HOSTCALL_IMPORT_MODULE } from "./abi.js";
|
|
33
|
+
import { WasiExitError } from "./wasiShim.js";
|
|
34
|
+
import { invokeErrorFromCommandRun } from "../invoke/commandOutcome.js";
|
|
35
|
+
import { normalizeWasmEdgeOutcome } from "../testing/wasmedgeOutput.js";
|
|
33
36
|
|
|
34
37
|
/** The typed failure the WasmEdge command harness's runner answers for any operation but plugin.getConfig. */
|
|
35
38
|
export const WASMEDGE_UNSUPPORTED_MESSAGE = "the WasmEdge command harness serves only plugin.getConfig";
|
|
@@ -189,17 +192,33 @@ async function createWasmEdgeCommandHarness(options = {}) {
|
|
|
189
192
|
);
|
|
190
193
|
});
|
|
191
194
|
child.on("close", (code, signal) => {
|
|
192
|
-
if (
|
|
195
|
+
if (signal !== null) {
|
|
193
196
|
reject(
|
|
194
197
|
formatFailure(
|
|
195
|
-
`WasmEdge command harness exited with ${
|
|
196
|
-
signal ? `signal ${signal}` : `code ${code}`
|
|
197
|
-
}.`,
|
|
198
|
+
`WasmEdge command harness exited with signal ${signal}.`,
|
|
198
199
|
),
|
|
199
200
|
);
|
|
200
201
|
return;
|
|
201
202
|
}
|
|
202
|
-
|
|
203
|
+
const stdout = new Uint8Array(Buffer.concat(stdoutChunks));
|
|
204
|
+
if (code === 0) {
|
|
205
|
+
resolve(stdout);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const stderr = Buffer.concat(stderrChunks);
|
|
209
|
+
const normalized = normalizeWasmEdgeOutcome({ stdout, stderr });
|
|
210
|
+
const invokeError = invokeErrorFromCommandRun(code, normalized.stdout);
|
|
211
|
+
if (invokeError) {
|
|
212
|
+
reject(invokeError);
|
|
213
|
+
} else if (normalized.diagnostics) {
|
|
214
|
+
reject(new Error(
|
|
215
|
+
`WasmEdge command harness exited with code ${code}.\n${normalized.diagnosticText.trim()}`,
|
|
216
|
+
));
|
|
217
|
+
} else {
|
|
218
|
+
const error = new WasiExitError(code);
|
|
219
|
+
error.stderr = stderr.toString("utf8");
|
|
220
|
+
reject(error);
|
|
221
|
+
}
|
|
203
222
|
});
|
|
204
223
|
child.stdin.end(Buffer.from(normalizedRequest));
|
|
205
224
|
});
|
package/src/index.d.ts
CHANGED
|
@@ -1951,7 +1951,30 @@ export function createNodeHostSyncHostcallBridge(options: {
|
|
|
1951
1951
|
}): HostcallBridge;
|
|
1952
1952
|
export class WasiExitError extends Error {
|
|
1953
1953
|
code: number;
|
|
1954
|
+
stderr?: string;
|
|
1954
1955
|
}
|
|
1956
|
+
export interface CommandErrorSummary {
|
|
1957
|
+
name: "PluginInvokeError";
|
|
1958
|
+
message: string;
|
|
1959
|
+
exitCode: number;
|
|
1960
|
+
statusCode: number;
|
|
1961
|
+
errorCode: string | null;
|
|
1962
|
+
errorMessage: string | null;
|
|
1963
|
+
}
|
|
1964
|
+
export class PluginInvokeError extends Error {
|
|
1965
|
+
constructor(options: { exitCode: number; response: DecodedPluginInvokeResponseEnvelope });
|
|
1966
|
+
name: "PluginInvokeError";
|
|
1967
|
+
exitCode: number;
|
|
1968
|
+
statusCode: number;
|
|
1969
|
+
errorCode: string | null;
|
|
1970
|
+
errorMessage: string | null;
|
|
1971
|
+
response: DecodedPluginInvokeResponseEnvelope;
|
|
1972
|
+
toJSON(): CommandErrorSummary;
|
|
1973
|
+
}
|
|
1974
|
+
export function invokeErrorFromCommandRun(
|
|
1975
|
+
exitCode: number | null,
|
|
1976
|
+
stdout: Uint8Array | ArrayBufferView | ArrayBuffer,
|
|
1977
|
+
): PluginInvokeError | null;
|
|
1955
1978
|
export interface BrowserWasiShim {
|
|
1956
1979
|
imports: Record<string, Record<string, (...args: number[]) => number>>;
|
|
1957
1980
|
setMemory(mem: { buffer: ArrayBuffer | SharedArrayBuffer }): void;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a non-zero command exit means. A command-surface guest writes its PIV
|
|
3
|
+
* response to stdout whether or not the request succeeded and exits non-zero
|
|
4
|
+
* when validation or dispatch failed (compiler/invokeGlue.js `main`), so a
|
|
5
|
+
* well-formed response on a non-zero exit is the guest's own explanation.
|
|
6
|
+
* The browser and WasmEdge harnesses and every parity lane read it here.
|
|
7
|
+
*/
|
|
8
|
+
import { decodePluginInvokeResponse } from "./codec.js";
|
|
9
|
+
import { toUint8Array } from "../runtime/bufferLike.js";
|
|
10
|
+
|
|
11
|
+
export class PluginInvokeError extends Error {
|
|
12
|
+
constructor({ exitCode, response }) {
|
|
13
|
+
const detail = [response.errorCode, response.errorMessage].filter(Boolean).join(": ");
|
|
14
|
+
super(`${detail || "module returned an error response"} (status ${response.statusCode})`);
|
|
15
|
+
this.name = "PluginInvokeError";
|
|
16
|
+
this.exitCode = exitCode;
|
|
17
|
+
this.statusCode = response.statusCode;
|
|
18
|
+
this.errorCode = response.errorCode ?? null;
|
|
19
|
+
this.errorMessage = response.errorMessage ?? null;
|
|
20
|
+
this.response = response;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
toJSON() {
|
|
24
|
+
const { name, message, exitCode, statusCode, errorCode, errorMessage } = this;
|
|
25
|
+
return { name, message, exitCode, statusCode, errorCode, errorMessage };
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function invokeErrorFromCommandRun(exitCode, stdout) {
|
|
30
|
+
if (!Number.isInteger(exitCode) || exitCode === 0) return null;
|
|
31
|
+
try {
|
|
32
|
+
const bytes = toUint8Array(stdout);
|
|
33
|
+
if (!bytes || bytes.byteLength < 8) return null;
|
|
34
|
+
return new PluginInvokeError({ exitCode, response: decodePluginInvokeResponse(bytes) });
|
|
35
|
+
} catch {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}
|
package/src/invoke/index.js
CHANGED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// The only browser the parity lanes launch: Chromium's headless shell from
|
|
2
|
+
// the Playwright cache (owner rule 2026-10-16). Never Google Chrome.app, Chrome
|
|
3
|
+
// for Testing, Chromium.app or a `channel` browser: a full browser started
|
|
4
|
+
// from a background process registers with the window server, aborts in
|
|
5
|
+
// HIServices on macOS and throws crash dialogs on the operator's screen. The
|
|
6
|
+
// headless shell has no window-server registration and runs with an isolated
|
|
7
|
+
// user-data-dir, which is what a parity lane needs.
|
|
8
|
+
//
|
|
9
|
+
// Resolution order: `context.chromeBinary`, SDM_CHROME_BINARY, CHROME_BINARY
|
|
10
|
+
// (each must itself be a headless shell), then the newest installed shell
|
|
11
|
+
// under PLAYWRIGHT_BROWSERS_PATH (default ~/Library/Caches/ms-playwright, or
|
|
12
|
+
// ~/.cache/ms-playwright on Linux).
|
|
13
|
+
import { constants as fsConstants, existsSync, readdirSync } from "node:fs";
|
|
14
|
+
import { access } from "node:fs/promises";
|
|
15
|
+
import os from "node:os";
|
|
16
|
+
import path from "node:path";
|
|
17
|
+
import process from "node:process";
|
|
18
|
+
|
|
19
|
+
const FORBIDDEN = /Google Chrome|Chrome for Testing|Chromium\.app|google-chrome|chromium-browser/;
|
|
20
|
+
const SHELL = /chrome-headless-shell|headless_shell/;
|
|
21
|
+
|
|
22
|
+
function cacheRoots() {
|
|
23
|
+
if (process.env.PLAYWRIGHT_BROWSERS_PATH) return [process.env.PLAYWRIGHT_BROWSERS_PATH];
|
|
24
|
+
return [
|
|
25
|
+
path.join(os.homedir(), "Library", "Caches", "ms-playwright"),
|
|
26
|
+
path.join(os.homedir(), ".cache", "ms-playwright"),
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Installed headless shells, newest first. */
|
|
31
|
+
export function installedHeadlessShells() {
|
|
32
|
+
const found = [];
|
|
33
|
+
for (const cache of cacheRoots()) {
|
|
34
|
+
if (!existsSync(cache)) continue;
|
|
35
|
+
const dirs = readdirSync(cache).filter((d) => /^chromium_headless_shell-\d+$/.test(d));
|
|
36
|
+
dirs.sort((a, b) => Number(b.split("-")[1]) - Number(a.split("-")[1]));
|
|
37
|
+
for (const dir of dirs) {
|
|
38
|
+
for (const sub of readdirSync(path.join(cache, dir))) {
|
|
39
|
+
if (!sub.startsWith("chrome-headless-shell")) continue;
|
|
40
|
+
for (const name of ["chrome-headless-shell", "chrome-headless-shell.exe"]) {
|
|
41
|
+
const bin = path.join(cache, dir, sub, name);
|
|
42
|
+
if (existsSync(bin)) found.push(bin);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return found;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The headless-shell binary the browser lanes spawn. An explicit choice is
|
|
52
|
+
* honoured only when it is a headless shell; a full browser is refused.
|
|
53
|
+
*/
|
|
54
|
+
export async function resolveHeadlessShell(context = {}) {
|
|
55
|
+
const explicit =
|
|
56
|
+
context.chromeBinary ?? process.env.SDM_CHROME_BINARY ?? process.env.CHROME_BINARY;
|
|
57
|
+
if (explicit) {
|
|
58
|
+
const candidate = String(explicit);
|
|
59
|
+
if (FORBIDDEN.test(candidate) || !SHELL.test(candidate)) {
|
|
60
|
+
throw new Error(
|
|
61
|
+
`browser lane: ${candidate} is not a Chromium headless shell. Only the Playwright ` +
|
|
62
|
+
"chromium_headless_shell may be launched (never Google Chrome.app, Chrome for Testing or Chromium.app).",
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
return candidate;
|
|
66
|
+
}
|
|
67
|
+
for (const candidate of installedHeadlessShells()) {
|
|
68
|
+
try {
|
|
69
|
+
await access(candidate, fsConstants.X_OK);
|
|
70
|
+
return candidate;
|
|
71
|
+
} catch {
|
|
72
|
+
// not executable here; try the next install
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
throw new Error(
|
|
76
|
+
"browser lane: no Chromium headless shell found under the Playwright cache " +
|
|
77
|
+
"(npx playwright install chromium-headless-shell), and SDM_CHROME_BINARY is unset. " +
|
|
78
|
+
"The browser lane requires a REAL browser context — jsdom masks SAB/threading realities.",
|
|
79
|
+
);
|
|
80
|
+
}
|
package/src/testing/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
|
+
CommandErrorSummary,
|
|
2
3
|
InvokeSurface,
|
|
3
4
|
PayloadTypeRef,
|
|
4
5
|
PayloadWireFormat,
|
|
@@ -535,6 +536,8 @@ export interface ParityRunResult {
|
|
|
535
536
|
threadCount: number;
|
|
536
537
|
exitClass: string;
|
|
537
538
|
exitDetail?: string | null;
|
|
539
|
+
exitCode: number | null;
|
|
540
|
+
commandError: CommandErrorSummary | null;
|
|
538
541
|
stdout: Uint8Array;
|
|
539
542
|
stderr?: Uint8Array;
|
|
540
543
|
stateFiles?: Record<string, string> | null;
|
|
@@ -563,6 +566,8 @@ export interface ParityReport {
|
|
|
563
566
|
threadCount: number;
|
|
564
567
|
exitClass: string;
|
|
565
568
|
exitDetail: string | null;
|
|
569
|
+
exitCode: number | null;
|
|
570
|
+
commandError: CommandErrorSummary | null;
|
|
566
571
|
stdoutSha256: string;
|
|
567
572
|
stdoutLength: number;
|
|
568
573
|
}>;
|
|
@@ -13,6 +13,8 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { createBrowserModuleHarness } from "../host/browserModuleHarness.js";
|
|
16
|
+
import { WasiExitError } from "../host/wasiShim.js";
|
|
17
|
+
import { PluginInvokeError } from "../invoke/commandOutcome.js";
|
|
16
18
|
import { parityHostcallDispatch } from "./parityHostcalls.js";
|
|
17
19
|
|
|
18
20
|
const OK = "ok";
|
|
@@ -39,10 +41,18 @@ function bytesToBase64(bytes) {
|
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
function classifyBrowserError(error) {
|
|
44
|
+
if (error instanceof PluginInvokeError) {
|
|
45
|
+
return {
|
|
46
|
+
exitClass: GUEST_ERROR,
|
|
47
|
+
exitDetail: `exit=${error.exitCode}`,
|
|
48
|
+
exitCode: error.exitCode,
|
|
49
|
+
commandError: error.toJSON(),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
42
52
|
// WasiExitError with code 0 is swallowed inside the harness; reaching here
|
|
43
53
|
// with one means a real nonzero guest exit.
|
|
44
|
-
if (error
|
|
45
|
-
return { exitClass: GUEST_ERROR, exitDetail: `exit=${error.code}
|
|
54
|
+
if (error instanceof WasiExitError) {
|
|
55
|
+
return { exitClass: GUEST_ERROR, exitDetail: `exit=${error.code}`, exitCode: error.code, commandError: null };
|
|
46
56
|
}
|
|
47
57
|
// The harness refused the artifact because the ARTIFACT declares it does not
|
|
48
58
|
// run here. That is the contract working. Classing it TRAP would score a
|
|
@@ -52,11 +62,15 @@ function classifyBrowserError(error) {
|
|
|
52
62
|
return {
|
|
53
63
|
exitClass: OUT_OF_SCOPE,
|
|
54
64
|
exitDetail: `declared runtimeTargets [${(error.declaredTargets ?? []).join(", ")}]`,
|
|
65
|
+
exitCode: null,
|
|
66
|
+
commandError: null,
|
|
55
67
|
};
|
|
56
68
|
}
|
|
57
69
|
return {
|
|
58
70
|
exitClass: TRAP,
|
|
59
71
|
exitDetail: `${error?.name ?? "Error"}: ${error?.message ?? String(error)}`,
|
|
72
|
+
exitCode: null,
|
|
73
|
+
commandError: null,
|
|
60
74
|
};
|
|
61
75
|
}
|
|
62
76
|
|
|
@@ -89,6 +103,8 @@ export async function runParityPlanInBrowser({ baseUrl = "" } = {}) {
|
|
|
89
103
|
setStatus(`case ${planCase.id} @ ${threadCount} thread(s)`);
|
|
90
104
|
let exitClass = OK;
|
|
91
105
|
let exitDetail = null;
|
|
106
|
+
let exitCode = 0;
|
|
107
|
+
let commandError = null;
|
|
92
108
|
let stdout = new Uint8Array(0);
|
|
93
109
|
let stderr = new Uint8Array(0);
|
|
94
110
|
let harness = null;
|
|
@@ -119,7 +135,7 @@ export async function runParityPlanInBrowser({ baseUrl = "" } = {}) {
|
|
|
119
135
|
stdout = await harness.invokeRaw(stdinBytes);
|
|
120
136
|
stderr = harness.wasi?.stderr ?? new Uint8Array(0);
|
|
121
137
|
} catch (error) {
|
|
122
|
-
({ exitClass, exitDetail } = classifyBrowserError(error));
|
|
138
|
+
({ exitClass, exitDetail, exitCode, commandError } = classifyBrowserError(error));
|
|
123
139
|
} finally {
|
|
124
140
|
stderr = harness?.wasi?.stderr ?? stderr;
|
|
125
141
|
if (exitClass !== OK) stdout = harness?.wasi?.stdout ?? stdout;
|
|
@@ -135,6 +151,8 @@ export async function runParityPlanInBrowser({ baseUrl = "" } = {}) {
|
|
|
135
151
|
threadCount,
|
|
136
152
|
exitClass,
|
|
137
153
|
exitDetail,
|
|
154
|
+
exitCode,
|
|
155
|
+
commandError,
|
|
138
156
|
spawnCount,
|
|
139
157
|
stdoutBase64: bytesToBase64(stdout),
|
|
140
158
|
stderrBase64: bytesToBase64(stderr),
|
|
@@ -55,6 +55,7 @@ import path from "node:path";
|
|
|
55
55
|
import process from "node:process";
|
|
56
56
|
import { createRequire } from "node:module";
|
|
57
57
|
import { fileURLToPath } from "node:url";
|
|
58
|
+
import { resolveHeadlessShell } from "./headlessShell.js";
|
|
58
59
|
import { promisify } from "node:util";
|
|
59
60
|
|
|
60
61
|
import { toLoadableWasmBytes } from "../bundle/artifactBytes.js";
|
|
@@ -529,26 +530,9 @@ async function ensureDockerLane(context) {
|
|
|
529
530
|
|
|
530
531
|
// --- Browser probe lane ---------------------------------------------------------
|
|
531
532
|
|
|
532
|
-
|
|
533
|
-
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
|
|
534
|
-
"/Applications/Chromium.app/Contents/MacOS/Chromium",
|
|
535
|
-
"/usr/bin/google-chrome-stable",
|
|
536
|
-
"/usr/bin/google-chrome",
|
|
537
|
-
"/usr/bin/chromium",
|
|
538
|
-
"/usr/bin/chromium-browser",
|
|
539
|
-
];
|
|
540
|
-
|
|
533
|
+
// Only the Playwright chromium headless shell is launched (headlessShell.js).
|
|
541
534
|
export async function resolveChromeBinary(context = {}) {
|
|
542
|
-
|
|
543
|
-
context.chromeBinary ?? process.env.SDM_CHROME_BINARY ?? process.env.CHROME_BINARY;
|
|
544
|
-
if (explicit) return String(explicit);
|
|
545
|
-
for (const candidate of CHROME_CANDIDATES) {
|
|
546
|
-
if (await binaryExists(candidate)) return candidate;
|
|
547
|
-
}
|
|
548
|
-
throw new Error(
|
|
549
|
-
"browser lane: no Chrome/Chromium binary found (set SDM_CHROME_BINARY). " +
|
|
550
|
-
"The browser lane requires a REAL browser context — jsdom masks SAB/threading realities.",
|
|
551
|
-
);
|
|
535
|
+
return resolveHeadlessShell(context);
|
|
552
536
|
}
|
|
553
537
|
|
|
554
538
|
const PROBE_HTML = `<!doctype html>
|
|
@@ -612,6 +612,8 @@ export async function runParityHarness(options = {}) {
|
|
|
612
612
|
threadCount,
|
|
613
613
|
exitClass: ExitClass.HarnessFailure,
|
|
614
614
|
exitDetail: error?.message ?? String(error),
|
|
615
|
+
exitCode: null,
|
|
616
|
+
commandError: null,
|
|
615
617
|
stdout: new Uint8Array(0),
|
|
616
618
|
})),
|
|
617
619
|
);
|
|
@@ -644,6 +646,8 @@ export async function runParityHarness(options = {}) {
|
|
|
644
646
|
threadCount: run.threadCount,
|
|
645
647
|
exitClass: run.exitClass,
|
|
646
648
|
exitDetail: run.exitDetail ?? null,
|
|
649
|
+
exitCode: run.exitCode,
|
|
650
|
+
commandError: run.commandError,
|
|
647
651
|
spawnCount: run.spawnCount ?? null,
|
|
648
652
|
stdoutSha256: sha256Hex(toUint8Array(run.stdout) ?? new Uint8Array(0)),
|
|
649
653
|
stdoutLength: (toUint8Array(run.stdout) ?? new Uint8Array(0)).length,
|
|
@@ -27,9 +27,11 @@ import path from "node:path";
|
|
|
27
27
|
import process from "node:process";
|
|
28
28
|
import { fileURLToPath } from "node:url";
|
|
29
29
|
import { promisify } from "node:util";
|
|
30
|
+
import { resolveHeadlessShell } from "./headlessShell.js";
|
|
30
31
|
|
|
31
32
|
import { ExitClass, assertWasmEdgeVersionMatchesPin } from "./parityHarness.js";
|
|
32
33
|
import { normalizeWasmEdgeOutcome } from "./wasmedgeOutput.js";
|
|
34
|
+
import { invokeErrorFromCommandRun } from "../invoke/commandOutcome.js";
|
|
33
35
|
import { isWasiThreadsModule } from "../host/wasiThreadHost.js";
|
|
34
36
|
import { resolveWasmEdgeWasiThreadsRunner } from "./buildWasmEdgeRunner.js";
|
|
35
37
|
import { PARITY_HOSTCALL_FILES, encodeParityHostcallAnswers, importsHostcallBridge } from "./parityHostcalls.js";
|
|
@@ -70,6 +72,29 @@ function classifyProcessOutcome({ code, signal, stderrText }) {
|
|
|
70
72
|
return { exitClass: ExitClass.GuestError, exitDetail: `exit=${code}` };
|
|
71
73
|
}
|
|
72
74
|
|
|
75
|
+
function wasmEdgeRun(outcome, caseId, threadCount, threaded) {
|
|
76
|
+
// WasmEdge logs diagnostics to stdout; separate them before classification.
|
|
77
|
+
const normalized = normalizeWasmEdgeOutcome(outcome);
|
|
78
|
+
const { exitClass, exitDetail } = classifyProcessOutcome({
|
|
79
|
+
code: outcome.code,
|
|
80
|
+
signal: outcome.signal,
|
|
81
|
+
stderrText: normalized.diagnosticText,
|
|
82
|
+
});
|
|
83
|
+
const exitCode = !outcome.signal && Number.isInteger(outcome.code) ? outcome.code : null;
|
|
84
|
+
return {
|
|
85
|
+
caseId,
|
|
86
|
+
threadCount,
|
|
87
|
+
exitClass,
|
|
88
|
+
exitDetail,
|
|
89
|
+
exitCode,
|
|
90
|
+
commandError: invokeErrorFromCommandRun(exitCode, normalized.stdout)?.toJSON() ?? null,
|
|
91
|
+
stdout: normalized.stdout,
|
|
92
|
+
stderr: normalized.stderr,
|
|
93
|
+
spawnCount: threaded ? Number(/sdm-wasi-threads: spawned=(\d+)/.exec(normalized.diagnosticText)?.[1] ?? NaN) : null,
|
|
94
|
+
stateFiles: null,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
|
|
73
98
|
function spawnWithStdin(command, args, { cwd, env, stdinBytes, timeoutMs }) {
|
|
74
99
|
return new Promise((resolve, reject) => {
|
|
75
100
|
const child = spawn(command, args, {
|
|
@@ -237,24 +262,7 @@ export async function runNativeWasmEdgeLane(context) {
|
|
|
237
262
|
timeoutMs: context.timeoutMs,
|
|
238
263
|
},
|
|
239
264
|
);
|
|
240
|
-
|
|
241
|
-
// anything compares guest bytes or classifies an exit.
|
|
242
|
-
const normalized = normalizeWasmEdgeOutcome(outcome);
|
|
243
|
-
const { exitClass, exitDetail } = classifyProcessOutcome({
|
|
244
|
-
code: outcome.code,
|
|
245
|
-
signal: outcome.signal,
|
|
246
|
-
stderrText: normalized.diagnosticText,
|
|
247
|
-
});
|
|
248
|
-
runs.push({
|
|
249
|
-
caseId: planCase.id,
|
|
250
|
-
threadCount,
|
|
251
|
-
exitClass,
|
|
252
|
-
exitDetail,
|
|
253
|
-
stdout: normalized.stdout,
|
|
254
|
-
stderr: normalized.stderr,
|
|
255
|
-
spawnCount: threaded ? Number(/sdm-wasi-threads: spawned=(\d+)/.exec(normalized.diagnosticText)?.[1] ?? NaN) : null,
|
|
256
|
-
stateFiles: null,
|
|
257
|
-
});
|
|
265
|
+
runs.push(wasmEdgeRun(outcome, planCase.id, threadCount, threaded));
|
|
258
266
|
}
|
|
259
267
|
}
|
|
260
268
|
} finally {
|
|
@@ -363,22 +371,7 @@ export async function runDockerWasmEdgeLane(context) {
|
|
|
363
371
|
stdinBytes: planCase.stdinBytes,
|
|
364
372
|
timeoutMs: context.timeoutMs,
|
|
365
373
|
});
|
|
366
|
-
|
|
367
|
-
const { exitClass, exitDetail } = classifyProcessOutcome({
|
|
368
|
-
code: outcome.code,
|
|
369
|
-
signal: outcome.signal,
|
|
370
|
-
stderrText: normalized.diagnosticText,
|
|
371
|
-
});
|
|
372
|
-
runs.push({
|
|
373
|
-
caseId: planCase.id,
|
|
374
|
-
threadCount,
|
|
375
|
-
exitClass,
|
|
376
|
-
exitDetail,
|
|
377
|
-
stdout: normalized.stdout,
|
|
378
|
-
stderr: normalized.stderr,
|
|
379
|
-
spawnCount: threaded ? Number(/sdm-wasi-threads: spawned=(\d+)/.exec(normalized.diagnosticText)?.[1] ?? NaN) : null,
|
|
380
|
-
stateFiles: null,
|
|
381
|
-
});
|
|
374
|
+
runs.push(wasmEdgeRun(outcome, planCase.id, threadCount, threaded));
|
|
382
375
|
}
|
|
383
376
|
}
|
|
384
377
|
} finally {
|
|
@@ -387,30 +380,11 @@ export async function runDockerWasmEdgeLane(context) {
|
|
|
387
380
|
return runs;
|
|
388
381
|
}
|
|
389
382
|
|
|
390
|
-
// --- Browser lane (
|
|
391
|
-
|
|
392
|
-
const CHROME_CANDIDATES = [
|
|
393
|
-
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
|
|
394
|
-
"/Applications/Chromium.app/Contents/MacOS/Chromium",
|
|
395
|
-
"/usr/bin/google-chrome-stable",
|
|
396
|
-
"/usr/bin/google-chrome",
|
|
397
|
-
"/usr/bin/chromium",
|
|
398
|
-
"/usr/bin/chromium-browser",
|
|
399
|
-
];
|
|
383
|
+
// --- Browser lane (Chromium headless shell; never jsdom, never Chrome.app) ----
|
|
400
384
|
|
|
385
|
+
// Only the Playwright chromium headless shell is launched (headlessShell.js).
|
|
401
386
|
export async function resolveChromeBinary(context = {}) {
|
|
402
|
-
|
|
403
|
-
context.chromeBinary ??
|
|
404
|
-
process.env.SDM_CHROME_BINARY ??
|
|
405
|
-
process.env.CHROME_BINARY;
|
|
406
|
-
if (explicit) return String(explicit);
|
|
407
|
-
for (const candidate of CHROME_CANDIDATES) {
|
|
408
|
-
if (await binaryExists(candidate)) return candidate;
|
|
409
|
-
}
|
|
410
|
-
throw new Error(
|
|
411
|
-
"browser lane: no Chrome/Chromium binary found. Set SDM_CHROME_BINARY. " +
|
|
412
|
-
"(The browser lane requires a REAL browser context — jsdom masks SAB/threading realities.)",
|
|
413
|
-
);
|
|
387
|
+
return resolveHeadlessShell(context);
|
|
414
388
|
}
|
|
415
389
|
|
|
416
390
|
async function buildBrowserRunnerBundle() {
|
|
@@ -588,6 +562,8 @@ export async function runBrowserLane(context) {
|
|
|
588
562
|
threadCount: Number(run.threadCount),
|
|
589
563
|
exitClass: String(run.exitClass),
|
|
590
564
|
exitDetail: run.exitDetail ?? null,
|
|
565
|
+
exitCode: run.exitCode,
|
|
566
|
+
commandError: run.commandError,
|
|
591
567
|
spawnCount: run.spawnCount ?? null,
|
|
592
568
|
stdout: new Uint8Array(Buffer.from(String(run.stdoutBase64 ?? ""), "base64")),
|
|
593
569
|
stderr: new Uint8Array(Buffer.from(String(run.stderrBase64 ?? ""), "base64")),
|