@tracecode/harness 0.16.4 → 0.16.6
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/CHANGELOG.md +36 -0
- package/README.md +6 -4
- package/dist/{browser-runtime-provider-OGJQLGXU.js → browser-runtime-provider-KPQBQ4EG.js} +5 -5
- package/dist/{chunk-AAKNIYV6.js → chunk-46XZQOHV.js} +3 -3
- package/dist/{chunk-6LE4KEMZ.js → chunk-4PN5YD6J.js} +489 -3
- package/dist/{chunk-DTLDQQHA.js → chunk-5KH5ABPQ.js} +72 -1
- package/dist/{chunk-5RT5IT4I.js → chunk-B2EM2SZ2.js} +15 -31
- package/dist/{chunk-M7SNEZDR.js → chunk-EPBHRROK.js} +3 -3
- package/dist/{chunk-Y72C46GE.js → chunk-GXTDL2ML.js} +20 -11
- package/dist/{chunk-RCOPAMVR.js → chunk-J2KGF5PU.js} +56 -36
- package/dist/core.cjs +19 -10
- package/dist/core.js +1 -1
- package/dist/cpp-worker-client-UWGDH6HR.js +12 -0
- package/dist/{csharp-worker-client-ARGMOB3M.js → csharp-worker-client-4QP2ZBSA.js} +4 -4
- package/dist/internal/browser.cjs +72 -0
- package/dist/internal/browser.d.cts +19 -1
- package/dist/internal/browser.d.ts +19 -1
- package/dist/internal/browser.js +3 -1
- package/dist/internal/tracekernel-workspace.cjs +19 -10
- package/dist/internal/tracekernel-workspace.js +1 -1
- package/dist/{java-project-JB5TUIFU.js → java-project-AEQEVBDA.js} +2 -2
- package/dist/judge.cjs +885 -89
- package/dist/judge.d.cts +6 -0
- package/dist/judge.d.ts +6 -0
- package/dist/judge.js +237 -23
- package/dist/{project-browser-3S2FWEAP.js → project-browser-HFNQEALT.js} +2 -2
- package/dist/{project-browser-QN7YOJQQ.js → project-browser-L3A2G2MA.js} +2 -2
- package/dist/{project-browser-S4KLCZV7.js → project-browser-OVE7V464.js} +2 -2
- package/dist/{project-browser-WDUWUGLZ.js → project-browser-P2H222D7.js} +2 -2
- package/dist/{project-browser-HCQCXAYC.js → project-browser-WCSIJY6I.js} +2 -2
- package/dist/{python-worker-client-EX6Q2W4L.js → python-worker-client-UCOMTSMU.js} +4 -4
- package/dist/tracekernel.cjs +650 -68
- package/dist/tracekernel.js +4 -4
- package/package.json +14 -5
- package/runtime-assets.lock.json +77 -70
- package/workers/cpp/cpp-worker.js +53 -43
- package/workers/csharp/csharp-worker.js +150 -1
- package/workers/javascript/javascript-project-worker.js +18 -9
- package/workers/python/python-worker.js +121 -1
- package/workers/vendor/csharp/_framework/TraceCode.CSharpHost.wasm +0 -0
- package/workers/vendor/csharp/_framework/TraceCode.CSharpJudgeRuntime.wasm +0 -0
- package/workers/vendor/csharp/_framework/TraceCode.TraceClrWire.wasm +0 -0
- package/workers/vendor/csharp/_framework/dotnet.boot.js +11 -6
- package/workers/vendor/csharp/_framework/dotnet.native.wasm +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/TraceCode.CSharpHost.dll +0 -0
- package/workers/vendor/csharp/_framework/supportFiles/TraceCode.CSharpJudgeRuntime.dll +0 -0
- package/workers/vendor/csharp-runner/_framework/assemblies-02.pack +0 -0
- package/workers/vendor/csharp-runner/_framework/assemblies-03.pack +0 -0
- package/workers/vendor/csharp-runner/_framework/dotnet.boot.js +65 -65
- package/dist/cpp-worker-client-HV7RO2P5.js +0 -12
package/dist/judge.cjs
CHANGED
|
@@ -1132,7 +1132,7 @@ var init_Array = __esm({
|
|
|
1132
1132
|
}
|
|
1133
1133
|
return out;
|
|
1134
1134
|
});
|
|
1135
|
-
fromIterable = (
|
|
1135
|
+
fromIterable = (collection2) => Array.isArray(collection2) ? collection2 : Array.from(collection2);
|
|
1136
1136
|
ensure = (self2) => Array.isArray(self2) ? self2 : [self2];
|
|
1137
1137
|
prepend = /* @__PURE__ */ dual(2, (self2, head4) => [head4, ...self2]);
|
|
1138
1138
|
append = /* @__PURE__ */ dual(2, (self2, last3) => [...self2, last3]);
|
|
@@ -9877,17 +9877,17 @@ var init_redBlackTree = __esm({
|
|
|
9877
9877
|
});
|
|
9878
9878
|
keysForward = (self2) => keys3(self2, Direction.Forward);
|
|
9879
9879
|
keys3 = (self2, direction) => {
|
|
9880
|
-
const
|
|
9880
|
+
const begin2 = self2[Symbol.iterator]();
|
|
9881
9881
|
let count = 0;
|
|
9882
9882
|
return {
|
|
9883
9883
|
[Symbol.iterator]: () => keys3(self2, direction),
|
|
9884
9884
|
next: () => {
|
|
9885
9885
|
count++;
|
|
9886
|
-
const entry =
|
|
9886
|
+
const entry = begin2.key;
|
|
9887
9887
|
if (direction === Direction.Forward) {
|
|
9888
|
-
|
|
9888
|
+
begin2.moveNext();
|
|
9889
9889
|
} else {
|
|
9890
|
-
|
|
9890
|
+
begin2.movePrev();
|
|
9891
9891
|
}
|
|
9892
9892
|
switch (entry._tag) {
|
|
9893
9893
|
case "None": {
|
|
@@ -13074,7 +13074,7 @@ var init_runtime_language_info_data = __esm({
|
|
|
13074
13074
|
"versionLabel": "Python 3.13.2",
|
|
13075
13075
|
"executionPlatform": {
|
|
13076
13076
|
"name": "TraceKernel",
|
|
13077
|
-
"version": "0.16.
|
|
13077
|
+
"version": "0.16.6"
|
|
13078
13078
|
},
|
|
13079
13079
|
"description": "Python 3.13.2 runs in TraceKernel's isolated Python runtime.\n\nCommon algorithm helpers are imported automatically, including array, bisect, collections, functools, heapq, itertools. Other standard-library modules can be imported normally.\n\nOptional third-party packages are consumer-owned runtime assets and are available only when declared by the TraceKernel runtime manifest.",
|
|
13080
13080
|
"runtime": {
|
|
@@ -13101,7 +13101,7 @@ var init_runtime_language_info_data = __esm({
|
|
|
13101
13101
|
"versionLabel": "JavaScript (ECMAScript 2023)",
|
|
13102
13102
|
"executionPlatform": {
|
|
13103
13103
|
"name": "TraceKernel",
|
|
13104
|
-
"version": "0.16.
|
|
13104
|
+
"version": "0.16.6"
|
|
13105
13105
|
},
|
|
13106
13106
|
"runtime": {
|
|
13107
13107
|
"name": "TraceKernel JavaScript runtime",
|
|
@@ -13193,7 +13193,7 @@ Binary Search Tree, Trie, and Graph are bundled too, but are not exposed globall
|
|
|
13193
13193
|
"versionLabel": "TypeScript 5.9.3",
|
|
13194
13194
|
"executionPlatform": {
|
|
13195
13195
|
"name": "TraceKernel",
|
|
13196
|
-
"version": "0.16.
|
|
13196
|
+
"version": "0.16.6"
|
|
13197
13197
|
},
|
|
13198
13198
|
"description": `TypeScript 5.9.3 is compiled with the TypeScript compiler and executed by TraceKernel's JavaScript runtime.
|
|
13199
13199
|
|
|
@@ -13293,7 +13293,7 @@ The compiled output runs on the same TraceKernel execution lane as JavaScript su
|
|
|
13293
13293
|
"versionLabel": "Java 23",
|
|
13294
13294
|
"executionPlatform": {
|
|
13295
13295
|
"name": "TraceKernel",
|
|
13296
|
-
"version": "0.16.
|
|
13296
|
+
"version": "0.16.6"
|
|
13297
13297
|
},
|
|
13298
13298
|
"description": "Java 23 is compiled with javac 23 and executed by the Java runtime on TraceKernel.\n\nCommon imports are added automatically: java.util.*, java.io.*, java.math.*, java.util.stream.*, javafx.util.Pair.",
|
|
13299
13299
|
"runtime": {
|
|
@@ -13330,7 +13330,7 @@ The compiled output runs on the same TraceKernel execution lane as JavaScript su
|
|
|
13330
13330
|
"versionLabel": "C# 14",
|
|
13331
13331
|
"executionPlatform": {
|
|
13332
13332
|
"name": "TraceKernel",
|
|
13333
|
-
"version": "0.16.
|
|
13333
|
+
"version": "0.16.6"
|
|
13334
13334
|
},
|
|
13335
13335
|
"description": "C# 14 source is compiled and executed by TraceKernel's isolated C# runtime.\n\nCommon namespaces are imported automatically: System, System.Collections, System.Collections.Generic, System.IO, System.Linq, System.Numerics, System.Text, System.Text.RegularExpressions.",
|
|
13336
13336
|
"runtime": {
|
|
@@ -13359,7 +13359,7 @@ The compiled output runs on the same TraceKernel execution lane as JavaScript su
|
|
|
13359
13359
|
"versionLabel": "C++23",
|
|
13360
13360
|
"executionPlatform": {
|
|
13361
13361
|
"name": "TraceKernel",
|
|
13362
|
-
"version": "0.16.
|
|
13362
|
+
"version": "0.16.6"
|
|
13363
13363
|
},
|
|
13364
13364
|
"description": "C++ source is compiled using the C++23 standard.\n\nSubmissions compile to WebAssembly and run in TraceKernel's WASI execution lane. The compiler currently uses -O0 and -fno-exceptions, with a fixed program stack size.\n\nCommon standard library headers are included automatically, including <algorithm>, <array>, <bitset>, <climits>, <cmath>, <cstdint>, <functional>, <limits>, <numeric>, <sstream>, <tuple>, <vector>, <unordered_map>, <unordered_set> and more.",
|
|
13365
13365
|
"runtime": {
|
|
@@ -13524,7 +13524,7 @@ var init_runtime_open_source_info_data = __esm({
|
|
|
13524
13524
|
{
|
|
13525
13525
|
"kind": "modifications",
|
|
13526
13526
|
"label": "Runtime modifications",
|
|
13527
|
-
"url": "https://github.com/tracecodeapp/harness/tree/v0.16.
|
|
13527
|
+
"url": "https://github.com/tracecodeapp/harness/tree/v0.16.6/workers/python/pyodide-0.29.3"
|
|
13528
13528
|
}
|
|
13529
13529
|
]
|
|
13530
13530
|
}
|
|
@@ -15043,6 +15043,81 @@ var init_runtime_profiles = __esm({
|
|
|
15043
15043
|
}
|
|
15044
15044
|
});
|
|
15045
15045
|
|
|
15046
|
+
// packages/runtime-browser/src/background-work-scheduler.ts
|
|
15047
|
+
function createPromotableBrowserBackgroundTask(work) {
|
|
15048
|
+
let permanentlyCancelled = false;
|
|
15049
|
+
let task = null;
|
|
15050
|
+
let idleHandle = null;
|
|
15051
|
+
let backgroundController = null;
|
|
15052
|
+
let resolveCompletion;
|
|
15053
|
+
let rejectCompletion;
|
|
15054
|
+
const completion = new Promise((resolve, reject) => {
|
|
15055
|
+
resolveCompletion = resolve;
|
|
15056
|
+
rejectCompletion = reject;
|
|
15057
|
+
});
|
|
15058
|
+
void completion.catch(() => void 0);
|
|
15059
|
+
const start = () => {
|
|
15060
|
+
if (permanentlyCancelled) return Promise.resolve();
|
|
15061
|
+
if (!task) {
|
|
15062
|
+
task = Promise.resolve().then(work);
|
|
15063
|
+
task.then(resolveCompletion, rejectCompletion);
|
|
15064
|
+
void task.catch(() => void 0);
|
|
15065
|
+
}
|
|
15066
|
+
return task;
|
|
15067
|
+
};
|
|
15068
|
+
const cancelPendingCallback = () => {
|
|
15069
|
+
if (idleHandle !== null && typeof globalThis.cancelIdleCallback === "function") {
|
|
15070
|
+
globalThis.cancelIdleCallback(idleHandle);
|
|
15071
|
+
idleHandle = null;
|
|
15072
|
+
}
|
|
15073
|
+
backgroundController?.abort();
|
|
15074
|
+
backgroundController = null;
|
|
15075
|
+
};
|
|
15076
|
+
if (typeof globalThis.requestIdleCallback === "function") {
|
|
15077
|
+
idleHandle = globalThis.requestIdleCallback(() => {
|
|
15078
|
+
idleHandle = null;
|
|
15079
|
+
void start();
|
|
15080
|
+
});
|
|
15081
|
+
} else {
|
|
15082
|
+
const scheduler = globalThis.scheduler;
|
|
15083
|
+
if (scheduler?.postTask) {
|
|
15084
|
+
backgroundController = new AbortController();
|
|
15085
|
+
void scheduler.postTask(
|
|
15086
|
+
() => {
|
|
15087
|
+
backgroundController = null;
|
|
15088
|
+
return start();
|
|
15089
|
+
},
|
|
15090
|
+
{
|
|
15091
|
+
priority: "background",
|
|
15092
|
+
signal: backgroundController.signal
|
|
15093
|
+
}
|
|
15094
|
+
).catch(() => void 0);
|
|
15095
|
+
}
|
|
15096
|
+
}
|
|
15097
|
+
return {
|
|
15098
|
+
promote: () => {
|
|
15099
|
+
cancelPendingCallback();
|
|
15100
|
+
return start();
|
|
15101
|
+
},
|
|
15102
|
+
wait: () => completion,
|
|
15103
|
+
cancel: () => {
|
|
15104
|
+
if (permanentlyCancelled) return;
|
|
15105
|
+
permanentlyCancelled = true;
|
|
15106
|
+
cancelPendingCallback();
|
|
15107
|
+
if (!task) {
|
|
15108
|
+
rejectCompletion(
|
|
15109
|
+
new DOMException("Browser background work was cancelled.", "AbortError")
|
|
15110
|
+
);
|
|
15111
|
+
}
|
|
15112
|
+
}
|
|
15113
|
+
};
|
|
15114
|
+
}
|
|
15115
|
+
var init_background_work_scheduler = __esm({
|
|
15116
|
+
"packages/runtime-browser/src/background-work-scheduler.ts"() {
|
|
15117
|
+
"use strict";
|
|
15118
|
+
}
|
|
15119
|
+
});
|
|
15120
|
+
|
|
15046
15121
|
// packages/runtime-browser/src/runtime-capability-guards.ts
|
|
15047
15122
|
function isScriptRequest(functionName) {
|
|
15048
15123
|
if (functionName == null) return true;
|
|
@@ -15138,7 +15213,7 @@ var init_package = __esm({
|
|
|
15138
15213
|
"package.json"() {
|
|
15139
15214
|
package_default = {
|
|
15140
15215
|
name: "@tracecode/harness",
|
|
15141
|
-
version: "0.16.
|
|
15216
|
+
version: "0.16.6",
|
|
15142
15217
|
license: "AGPL-3.0-only",
|
|
15143
15218
|
homepage: "https://tracecode.app",
|
|
15144
15219
|
repository: {
|
|
@@ -15206,6 +15281,15 @@ var init_package = __esm({
|
|
|
15206
15281
|
"build:browser-host": "pnpm exec tsup --config tsup.browser-host.config.ts",
|
|
15207
15282
|
"build:tracekernel": "pnpm exec tsup --config tsup.tracekernel.config.ts",
|
|
15208
15283
|
"generate:runtime-info": "pnpm exec tsx --tsconfig tsconfig.base.json scripts/generate-runtime-language-info.ts",
|
|
15284
|
+
"generate:traceclr-profile": "node scripts/generate-traceclr-algorithm-profile.mjs",
|
|
15285
|
+
"audit:traceclr-corpus": "node scripts/audit-traceclr-corpus.mjs",
|
|
15286
|
+
"build:traceclr-product-corpus": "node scripts/create-traceclr-product-corpus.mjs",
|
|
15287
|
+
"check:traceclr-profile": "node --test tests/test-traceclr-algorithm-profile.mjs tests/test-traceclr-profile-policy.mjs && node --import tsx tests/test-traceclr-wire-codec.ts",
|
|
15288
|
+
"check:traceclr-product-profile": "node scripts/generate-traceclr-algorithm-profile.mjs --check && pnpm check:traceclr-profile",
|
|
15289
|
+
"build:traceclr-wire-probe": "dotnet build tools/TraceCode.TraceClrWireProbe/TraceCode.TraceClrWireProbe.csproj -c Release && dotnet build tools/TraceCode.TraceClrHostileProbe/TraceCode.TraceClrHostileProbe.csproj -c Release && dotnet publish packages/runtime-csharp/dotnet/TraceCode.CSharpAlgorithmRunner/TraceCode.CSharpAlgorithmRunner.csproj -c Release",
|
|
15290
|
+
"test:traceclr-wire-browser": "pnpm build:traceclr-wire-probe && TRACECODE_TRACECLR_BROWSER_ENGINE=chromium node --import tsx tests/test-traceclr-wire-runner-browser.ts && TRACECODE_TRACECLR_BROWSER_ENGINE=firefox node --import tsx tests/test-traceclr-wire-runner-browser.ts && TRACECODE_TRACECLR_BROWSER_ENGINE=webkit node --import tsx tests/test-traceclr-wire-runner-browser.ts",
|
|
15291
|
+
"bench:traceclr-tiers": "pnpm build:traceclr-wire-probe && pnpm materialize:csharp-role-assets && node --import tsx scripts/benchmark-traceclr-runtime-tiers.ts",
|
|
15292
|
+
"bench:traceclr-tiers:matrix": "pnpm build:traceclr-wire-probe && pnpm materialize:csharp-role-assets && for engine in chromium firefox webkit; do TRACECODE_TRACECLR_BROWSER_ENGINE=$engine node --import tsx scripts/benchmark-traceclr-runtime-tiers.ts || exit; done",
|
|
15209
15293
|
"generate:runtime-open-source-info": "pnpm exec tsx --tsconfig tsconfig.base.json scripts/generate-runtime-open-source-info.ts",
|
|
15210
15294
|
"generate:python-harness": "pnpm exec tsx --tsconfig tsconfig.base.json scripts/generate-python-harness-artifacts.ts",
|
|
15211
15295
|
"generate:runtime-assets-lock": "node --import tsx scripts/generate-runtime-assets-lock.mjs",
|
|
@@ -15269,10 +15353,10 @@ var init_package = __esm({
|
|
|
15269
15353
|
"test:java-runtime": "pnpm exec tsx --tsconfig tsconfig.base.json tests/test-java-runtime.ts && pnpm exec tsx --tsconfig tsconfig.base.json tests/test-java-project-filesystem.ts && node --import tsx --test tests/test-java-jar-manifest.ts && pnpm exec tsx --tsconfig tsconfig.base.json tests/test-java-project-provider.ts && TSX_TSCONFIG_PATH=tsconfig.base.json node --import tsx --test tests/test-java-prepared-provider.ts",
|
|
15270
15354
|
"test:java-prepared-provider": "TSX_TSCONFIG_PATH=tsconfig.base.json node --import tsx --test tests/test-java-prepared-provider.ts && pnpm exec tsx --tsconfig tsconfig.base.json tests/test-java-prepared-provider-browser.ts",
|
|
15271
15355
|
"test:tracejvm-semantic-trace": "node --import tsx tests/test-tracejvm-semantic-trace-matrix.ts",
|
|
15272
|
-
"test:csharp-runtime": "pnpm exec tsx --tsconfig tsconfig.base.json scripts/validate-csharp-runtime-role-assets.ts && TSX_TSCONFIG_PATH=tsconfig.base.json node --import tsx --test tests/test-csharp-role-artifacts.ts tests/test-csharp-managed-assembly-packs.ts && pnpm exec tsx --tsconfig tsconfig.base.json tests/test-csharp-runtime.ts && TSX_TSCONFIG_PATH=tsconfig.base.json node --import tsx --test tests/test-csharp-prepared-provider.ts && pnpm exec tsx --tsconfig tsconfig.base.json tests/test-csharp-project-fs-parity.ts",
|
|
15356
|
+
"test:csharp-runtime": "pnpm check:traceclr-profile && pnpm exec tsx --tsconfig tsconfig.base.json scripts/validate-csharp-runtime-role-assets.ts && TSX_TSCONFIG_PATH=tsconfig.base.json node --import tsx --test tests/test-csharp-role-artifacts.ts tests/test-csharp-managed-assembly-packs.ts && pnpm exec tsx --tsconfig tsconfig.base.json tests/test-csharp-runtime.ts && TSX_TSCONFIG_PATH=tsconfig.base.json node --import tsx --test tests/test-csharp-prepared-provider.ts && pnpm exec tsx --tsconfig tsconfig.base.json tests/test-csharp-project-fs-parity.ts",
|
|
15273
15357
|
"test:csharp-role-assets": "pnpm materialize:csharp-role-assets && TSX_TSCONFIG_PATH=tsconfig.base.json node --import tsx --test tests/test-csharp-role-artifacts.ts tests/test-csharp-managed-assembly-packs.ts && pnpm exec tsx --tsconfig tsconfig.base.json scripts/validate-csharp-runtime-role-assets.ts",
|
|
15274
15358
|
"test:csharp-worker-browser": "pnpm materialize:csharp-role-assets && pnpm exec tsx --tsconfig tsconfig.base.json tests/test-csharp-worker-client-http.ts && pnpm exec tsx --tsconfig tsconfig.base.json tests/test-csharp-worker-browser.ts && pnpm exec tsx --tsconfig tsconfig.base.json tests/test-csharp-worker-lifecycle-browser.ts && pnpm exec tsx --tsconfig tsconfig.base.json tests/test-csharp-prepared-boundary-browser.ts",
|
|
15275
|
-
"test:csharp-worker-browser-matrix": "pnpm materialize:csharp-role-assets &&
|
|
15359
|
+
"test:csharp-worker-browser-matrix": "pnpm materialize:csharp-role-assets && for engine in chromium firefox webkit; do TSX_TSCONFIG_PATH=tsconfig.base.json TRACECODE_CSHARP_BROWSER_SMOKE=1 TRACECODE_CSHARP_BROWSER_ENGINE=$engine node --import tsx tests/test-csharp-worker-browser.ts && TSX_TSCONFIG_PATH=tsconfig.base.json TRACECODE_CSHARP_BROWSER_ENGINE=$engine node --import tsx tests/test-csharp-prepared-boundary-browser.ts || exit; done",
|
|
15276
15360
|
"test:cpp-runtime": "pnpm exec tsx --tsconfig tsconfig.base.json tests/test-cpp-runtime.ts",
|
|
15277
15361
|
"test:cpp-conformance": "pnpm exec tsx --tsconfig tsconfig.base.json tests/test-cpp-conformance.ts",
|
|
15278
15362
|
"test:cpp-script-lambda-trace": "pnpm exec tsx --tsconfig tsconfig.base.json tests/test-cpp-script-lambda-trace.ts",
|
|
@@ -19839,6 +19923,7 @@ var init_internal = __esm({
|
|
|
19839
19923
|
"packages/runtime-browser/src/internal.ts"() {
|
|
19840
19924
|
"use strict";
|
|
19841
19925
|
init_browser_client_env();
|
|
19926
|
+
init_background_work_scheduler();
|
|
19842
19927
|
init_execution_host();
|
|
19843
19928
|
init_host_artifact_cache();
|
|
19844
19929
|
init_kernel_http_async();
|
|
@@ -29277,6 +29362,466 @@ var init_tracejvm_runtime_assets = __esm({
|
|
|
29277
29362
|
}
|
|
29278
29363
|
});
|
|
29279
29364
|
|
|
29365
|
+
// packages/runtime-csharp/src/traceclr-wire.ts
|
|
29366
|
+
function parseWireType(text, depth = 0) {
|
|
29367
|
+
if (depth > TRACECLR_WIRE_LIMITS.maxDepth) throw new RangeError("TraceCLR wire type is too deeply nested.");
|
|
29368
|
+
if (text === "list-node<int32>") return { kind: "list-node" };
|
|
29369
|
+
if (text === "tree-node<int32>") return { kind: "tree-node" };
|
|
29370
|
+
for (const name of ["array", "list", "set"]) {
|
|
29371
|
+
const prefix = `${name}<`;
|
|
29372
|
+
if (text.startsWith(prefix) && text.endsWith(">")) {
|
|
29373
|
+
return { kind: "container", name, element: parseWireType(text.slice(prefix.length, -1), depth + 1) };
|
|
29374
|
+
}
|
|
29375
|
+
}
|
|
29376
|
+
const scalars = /* @__PURE__ */ new Set([
|
|
29377
|
+
"void",
|
|
29378
|
+
"null",
|
|
29379
|
+
"bool",
|
|
29380
|
+
"char",
|
|
29381
|
+
"uint8",
|
|
29382
|
+
"int8",
|
|
29383
|
+
"int16",
|
|
29384
|
+
"uint16",
|
|
29385
|
+
"int32",
|
|
29386
|
+
"uint32",
|
|
29387
|
+
"int64",
|
|
29388
|
+
"uint64",
|
|
29389
|
+
"float32",
|
|
29390
|
+
"float64",
|
|
29391
|
+
"string"
|
|
29392
|
+
]);
|
|
29393
|
+
if (!scalars.has(text)) throw new TypeError(`Unsupported TraceCLR wire type: ${text}`);
|
|
29394
|
+
return { kind: "scalar", name: text };
|
|
29395
|
+
}
|
|
29396
|
+
function integer(value, minimum, maximum, label) {
|
|
29397
|
+
if (typeof value !== "number" || !Number.isInteger(value) || value < minimum || value > maximum) {
|
|
29398
|
+
throw new TypeError(`${label} must be an integer between ${minimum} and ${maximum}.`);
|
|
29399
|
+
}
|
|
29400
|
+
return value;
|
|
29401
|
+
}
|
|
29402
|
+
function integer64(value, signed) {
|
|
29403
|
+
let converted = null;
|
|
29404
|
+
if (typeof value === "bigint") {
|
|
29405
|
+
converted = value;
|
|
29406
|
+
} else if (typeof value === "number" && Number.isInteger(value)) {
|
|
29407
|
+
const jsonDecimal = JSON.stringify(value);
|
|
29408
|
+
if (jsonDecimal !== void 0) converted = BigInt(jsonDecimal);
|
|
29409
|
+
}
|
|
29410
|
+
const minimum = signed ? -(1n << 63n) : 0n;
|
|
29411
|
+
const maximum = signed ? (1n << 63n) - 1n : (1n << 64n) - 1n;
|
|
29412
|
+
if (converted === null || converted < minimum || converted > maximum) {
|
|
29413
|
+
throw new TypeError(`${signed ? "int64" : "uint64"} must be a bigint or integer number in range.`);
|
|
29414
|
+
}
|
|
29415
|
+
return converted;
|
|
29416
|
+
}
|
|
29417
|
+
function floatingPoint(value, label) {
|
|
29418
|
+
if (typeof value === "number") return Object.is(value, -0) ? 0 : value;
|
|
29419
|
+
if (value === "NaN") return Number.NaN;
|
|
29420
|
+
if (value === "Infinity") return Number.POSITIVE_INFINITY;
|
|
29421
|
+
if (value === "-Infinity") return Number.NEGATIVE_INFINITY;
|
|
29422
|
+
throw new TypeError(`${label} must be numeric or a named floating-point literal.`);
|
|
29423
|
+
}
|
|
29424
|
+
function collection(value, set6) {
|
|
29425
|
+
const items = set6 && value instanceof Set ? [...value] : value;
|
|
29426
|
+
if (!Array.isArray(items)) throw new TypeError("TraceCLR collection values must be arrays or Sets.");
|
|
29427
|
+
if (items.length > TRACECLR_WIRE_LIMITS.maxCollectionItems) {
|
|
29428
|
+
throw new RangeError(`TraceCLR collection exceeds ${TRACECLR_WIRE_LIMITS.maxCollectionItems} items.`);
|
|
29429
|
+
}
|
|
29430
|
+
return items;
|
|
29431
|
+
}
|
|
29432
|
+
function writeValue(writer, type, value, depth) {
|
|
29433
|
+
if (depth > TRACECLR_WIRE_LIMITS.maxDepth) throw new RangeError("TraceCLR value is too deeply nested.");
|
|
29434
|
+
if (type.kind === "container") {
|
|
29435
|
+
if (value === null) {
|
|
29436
|
+
writer.int32(-1);
|
|
29437
|
+
return;
|
|
29438
|
+
}
|
|
29439
|
+
const values3 = collection(value, type.name === "set");
|
|
29440
|
+
writer.int32(values3.length);
|
|
29441
|
+
for (const item of values3) writeValue(writer, type.element, item, depth + 1);
|
|
29442
|
+
return;
|
|
29443
|
+
}
|
|
29444
|
+
if (type.kind === "list-node") {
|
|
29445
|
+
if (value === null) {
|
|
29446
|
+
writer.int32(-1);
|
|
29447
|
+
return;
|
|
29448
|
+
}
|
|
29449
|
+
const values3 = Array.isArray(value) ? value : [];
|
|
29450
|
+
if (!Array.isArray(value)) {
|
|
29451
|
+
const seen = /* @__PURE__ */ new Set();
|
|
29452
|
+
let node = value;
|
|
29453
|
+
while (node !== null) {
|
|
29454
|
+
if (typeof node !== "object" || seen.has(node)) throw new TypeError("TraceCLR ListNode must be acyclic.");
|
|
29455
|
+
seen.add(node);
|
|
29456
|
+
values3.push(node.val ?? node.value);
|
|
29457
|
+
node = node.next ?? null;
|
|
29458
|
+
if (values3.length > TRACECLR_WIRE_LIMITS.maxCollectionItems) throw new RangeError("TraceCLR ListNode is too long.");
|
|
29459
|
+
}
|
|
29460
|
+
}
|
|
29461
|
+
writer.int32(values3.length);
|
|
29462
|
+
for (const item of values3) writer.int32(integer(item, -2147483648, 2147483647, "ListNode value"));
|
|
29463
|
+
return;
|
|
29464
|
+
}
|
|
29465
|
+
if (type.kind === "tree-node") {
|
|
29466
|
+
if (value === null) {
|
|
29467
|
+
writer.int32(-1);
|
|
29468
|
+
return;
|
|
29469
|
+
}
|
|
29470
|
+
let rawValues;
|
|
29471
|
+
if (Array.isArray(value)) {
|
|
29472
|
+
rawValues = value;
|
|
29473
|
+
} else if (typeof value === "object") {
|
|
29474
|
+
const values4 = [];
|
|
29475
|
+
const nodes = [value];
|
|
29476
|
+
for (let index = 0; index < nodes.length; index++) {
|
|
29477
|
+
const node = nodes[index];
|
|
29478
|
+
if (node === null) {
|
|
29479
|
+
values4.push(null);
|
|
29480
|
+
continue;
|
|
29481
|
+
}
|
|
29482
|
+
if (typeof node !== "object") throw new TypeError("TraceCLR TreeNode nodes must be objects or null.");
|
|
29483
|
+
const typed = node;
|
|
29484
|
+
values4.push(typed.val ?? typed.value);
|
|
29485
|
+
nodes.push(typed.left ?? null, typed.right ?? null);
|
|
29486
|
+
if (nodes.length > TRACECLR_WIRE_LIMITS.maxCollectionItems) throw new RangeError("TraceCLR TreeNode is too large.");
|
|
29487
|
+
}
|
|
29488
|
+
while (values4.at(-1) === null) values4.pop();
|
|
29489
|
+
rawValues = values4;
|
|
29490
|
+
} else {
|
|
29491
|
+
throw new TypeError("TraceCLR TreeNode inputs must be level-order arrays or node objects.");
|
|
29492
|
+
}
|
|
29493
|
+
const values3 = collection(rawValues, false);
|
|
29494
|
+
writer.int32(values3.length);
|
|
29495
|
+
for (const item of values3) {
|
|
29496
|
+
writer.uint8(item === null ? 0 : 1);
|
|
29497
|
+
if (item !== null) writer.int32(integer(item, -2147483648, 2147483647, "TreeNode value"));
|
|
29498
|
+
}
|
|
29499
|
+
return;
|
|
29500
|
+
}
|
|
29501
|
+
switch (type.name) {
|
|
29502
|
+
case "void":
|
|
29503
|
+
return;
|
|
29504
|
+
case "null":
|
|
29505
|
+
if (value !== null) throw new TypeError("TraceCLR null result must be null.");
|
|
29506
|
+
writer.uint8(0);
|
|
29507
|
+
return;
|
|
29508
|
+
case "bool":
|
|
29509
|
+
if (typeof value !== "boolean") throw new TypeError("bool must be boolean.");
|
|
29510
|
+
writer.uint8(value ? 1 : 0);
|
|
29511
|
+
return;
|
|
29512
|
+
case "char": {
|
|
29513
|
+
if (typeof value !== "string" || value.length !== 1) throw new TypeError("char must be one UTF-16 code unit.");
|
|
29514
|
+
writer.uint16(value.charCodeAt(0));
|
|
29515
|
+
return;
|
|
29516
|
+
}
|
|
29517
|
+
case "uint8":
|
|
29518
|
+
writer.uint8(integer(value, 0, 255, "uint8"));
|
|
29519
|
+
return;
|
|
29520
|
+
case "int8":
|
|
29521
|
+
writer.int8(integer(value, -128, 127, "int8"));
|
|
29522
|
+
return;
|
|
29523
|
+
case "int16":
|
|
29524
|
+
writer.int16(integer(value, -32768, 32767, "int16"));
|
|
29525
|
+
return;
|
|
29526
|
+
case "uint16":
|
|
29527
|
+
writer.uint16(integer(value, 0, 65535, "uint16"));
|
|
29528
|
+
return;
|
|
29529
|
+
case "int32":
|
|
29530
|
+
writer.int32(integer(value, -2147483648, 2147483647, "int32"));
|
|
29531
|
+
return;
|
|
29532
|
+
case "uint32":
|
|
29533
|
+
writer.uint32(integer(value, 0, 4294967295, "uint32"));
|
|
29534
|
+
return;
|
|
29535
|
+
case "int64":
|
|
29536
|
+
writer.int64(integer64(value, true));
|
|
29537
|
+
return;
|
|
29538
|
+
case "uint64":
|
|
29539
|
+
writer.uint64(integer64(value, false));
|
|
29540
|
+
return;
|
|
29541
|
+
case "float32":
|
|
29542
|
+
writer.float32(floatingPoint(value, "float32"));
|
|
29543
|
+
return;
|
|
29544
|
+
case "float64":
|
|
29545
|
+
writer.float64(floatingPoint(value, "float64"));
|
|
29546
|
+
return;
|
|
29547
|
+
case "string": {
|
|
29548
|
+
if (value === null) {
|
|
29549
|
+
writer.int32(-1);
|
|
29550
|
+
return;
|
|
29551
|
+
}
|
|
29552
|
+
if (typeof value !== "string") throw new TypeError("string must be a string or null.");
|
|
29553
|
+
const bytes2 = new TextEncoder().encode(value);
|
|
29554
|
+
writer.int32(bytes2.byteLength);
|
|
29555
|
+
writer.bytes(bytes2);
|
|
29556
|
+
return;
|
|
29557
|
+
}
|
|
29558
|
+
}
|
|
29559
|
+
}
|
|
29560
|
+
function normalizePortableResult(type, value) {
|
|
29561
|
+
if (value === null || value === void 0) return value;
|
|
29562
|
+
if (type.kind === "container") {
|
|
29563
|
+
const values3 = type.name === "set" && value instanceof Set ? [...value] : value;
|
|
29564
|
+
if (!Array.isArray(values3)) {
|
|
29565
|
+
throw new TypeError(`TraceCLR ${type.name} result did not decode to a collection.`);
|
|
29566
|
+
}
|
|
29567
|
+
return values3.map((item) => normalizePortableResult(type.element, item));
|
|
29568
|
+
}
|
|
29569
|
+
if (type.kind === "scalar" && (type.name === "int64" || type.name === "uint64")) {
|
|
29570
|
+
if (typeof value !== "bigint") {
|
|
29571
|
+
throw new TypeError(`TraceCLR ${type.name} result did not decode to a bigint.`);
|
|
29572
|
+
}
|
|
29573
|
+
return Number(value);
|
|
29574
|
+
}
|
|
29575
|
+
if (type.kind === "scalar" && (type.name === "float32" || type.name === "float64")) {
|
|
29576
|
+
if (typeof value !== "number") {
|
|
29577
|
+
throw new TypeError(`TraceCLR ${type.name} result did not decode to a number.`);
|
|
29578
|
+
}
|
|
29579
|
+
if (Number.isNaN(value)) return "NaN";
|
|
29580
|
+
if (value === Number.POSITIVE_INFINITY) return "Infinity";
|
|
29581
|
+
if (value === Number.NEGATIVE_INFINITY) return "-Infinity";
|
|
29582
|
+
}
|
|
29583
|
+
return value;
|
|
29584
|
+
}
|
|
29585
|
+
function readLength(reader) {
|
|
29586
|
+
const length3 = reader.int32();
|
|
29587
|
+
if (length3 === -1) return null;
|
|
29588
|
+
if (length3 < 0 || length3 > TRACECLR_WIRE_LIMITS.maxCollectionItems) {
|
|
29589
|
+
throw new RangeError(`Invalid TraceCLR collection length: ${length3}.`);
|
|
29590
|
+
}
|
|
29591
|
+
return length3;
|
|
29592
|
+
}
|
|
29593
|
+
function readByteLength(reader) {
|
|
29594
|
+
const length3 = reader.int32();
|
|
29595
|
+
if (length3 === -1) return null;
|
|
29596
|
+
if (length3 < 0 || length3 > TRACECLR_WIRE_LIMITS.maxBytes) {
|
|
29597
|
+
throw new RangeError(`Invalid TraceCLR byte length: ${length3}.`);
|
|
29598
|
+
}
|
|
29599
|
+
return length3;
|
|
29600
|
+
}
|
|
29601
|
+
function readValue(reader, type, depth) {
|
|
29602
|
+
if (depth > TRACECLR_WIRE_LIMITS.maxDepth) throw new RangeError("TraceCLR value is too deeply nested.");
|
|
29603
|
+
if (type.kind === "container") {
|
|
29604
|
+
const length3 = readLength(reader);
|
|
29605
|
+
if (length3 === null) return null;
|
|
29606
|
+
const values3 = Array.from({ length: length3 }, () => readValue(reader, type.element, depth + 1));
|
|
29607
|
+
return type.name === "set" ? new Set(values3) : values3;
|
|
29608
|
+
}
|
|
29609
|
+
if (type.kind === "list-node") {
|
|
29610
|
+
const length3 = readLength(reader);
|
|
29611
|
+
return length3 === null ? null : Array.from({ length: length3 }, () => reader.int32());
|
|
29612
|
+
}
|
|
29613
|
+
if (type.kind === "tree-node") {
|
|
29614
|
+
const length3 = readLength(reader);
|
|
29615
|
+
if (length3 === null) return null;
|
|
29616
|
+
const values3 = Array.from({ length: length3 }, () => reader.uint8() === 0 ? null : reader.int32());
|
|
29617
|
+
while (values3.at(-1) === null) values3.pop();
|
|
29618
|
+
return values3;
|
|
29619
|
+
}
|
|
29620
|
+
switch (type.name) {
|
|
29621
|
+
case "void":
|
|
29622
|
+
return void 0;
|
|
29623
|
+
case "null":
|
|
29624
|
+
if (reader.uint8() !== 0) throw new RangeError("Invalid TraceCLR null marker.");
|
|
29625
|
+
return null;
|
|
29626
|
+
case "bool": {
|
|
29627
|
+
const value = reader.uint8();
|
|
29628
|
+
if (value > 1) throw new RangeError("Invalid TraceCLR bool.");
|
|
29629
|
+
return value === 1;
|
|
29630
|
+
}
|
|
29631
|
+
case "char":
|
|
29632
|
+
return String.fromCharCode(reader.uint16());
|
|
29633
|
+
case "uint8":
|
|
29634
|
+
return reader.uint8();
|
|
29635
|
+
case "int8":
|
|
29636
|
+
return reader.int8();
|
|
29637
|
+
case "int16":
|
|
29638
|
+
return reader.int16();
|
|
29639
|
+
case "uint16":
|
|
29640
|
+
return reader.uint16();
|
|
29641
|
+
case "int32":
|
|
29642
|
+
return reader.int32();
|
|
29643
|
+
case "uint32":
|
|
29644
|
+
return reader.uint32();
|
|
29645
|
+
case "int64":
|
|
29646
|
+
return reader.int64();
|
|
29647
|
+
case "uint64":
|
|
29648
|
+
return reader.uint64();
|
|
29649
|
+
case "float32":
|
|
29650
|
+
return reader.float32();
|
|
29651
|
+
case "float64":
|
|
29652
|
+
return reader.float64();
|
|
29653
|
+
case "string": {
|
|
29654
|
+
const length3 = readByteLength(reader);
|
|
29655
|
+
return length3 === null ? null : new TextDecoder("utf-8", { fatal: true }).decode(reader.bytes(length3));
|
|
29656
|
+
}
|
|
29657
|
+
}
|
|
29658
|
+
}
|
|
29659
|
+
function begin(writer) {
|
|
29660
|
+
writer.uint32(WIRE_MAGIC);
|
|
29661
|
+
}
|
|
29662
|
+
function verify(reader) {
|
|
29663
|
+
if (reader.uint32() !== WIRE_MAGIC) throw new RangeError("TraceCLR wire magic/version mismatch.");
|
|
29664
|
+
}
|
|
29665
|
+
function encodeTraceClrWireInputs(contract, inputs) {
|
|
29666
|
+
const writer = new WireWriter();
|
|
29667
|
+
begin(writer);
|
|
29668
|
+
writer.uint16(contract.parameters.length);
|
|
29669
|
+
const positionalInputs = Object.values(inputs);
|
|
29670
|
+
for (const [index, parameter] of contract.parameters.entries()) {
|
|
29671
|
+
const value = Object.prototype.hasOwnProperty.call(inputs, parameter.name) ? inputs[parameter.name] : positionalInputs[index];
|
|
29672
|
+
if (value === void 0 && !Object.prototype.hasOwnProperty.call(inputs, parameter.name) && index >= positionalInputs.length) {
|
|
29673
|
+
throw new TypeError(`Missing TraceCLR input: ${parameter.name}`);
|
|
29674
|
+
}
|
|
29675
|
+
writeValue(writer, parseWireType(parameter.type.wireType), value, 0);
|
|
29676
|
+
}
|
|
29677
|
+
return writer.finish();
|
|
29678
|
+
}
|
|
29679
|
+
function decodeTraceClrWireResult(contract, bytes2) {
|
|
29680
|
+
const reader = new WireReader(bytes2);
|
|
29681
|
+
verify(reader);
|
|
29682
|
+
const type = parseWireType(contract.returnType.wireType);
|
|
29683
|
+
const value = readValue(reader, type, 0);
|
|
29684
|
+
reader.done();
|
|
29685
|
+
return normalizePortableResult(type, value);
|
|
29686
|
+
}
|
|
29687
|
+
var WIRE_MAGIC, TRACECLR_WIRE_LIMITS, WireWriter, WireReader;
|
|
29688
|
+
var init_traceclr_wire = __esm({
|
|
29689
|
+
"packages/runtime-csharp/src/traceclr-wire.ts"() {
|
|
29690
|
+
"use strict";
|
|
29691
|
+
WIRE_MAGIC = 827802452;
|
|
29692
|
+
TRACECLR_WIRE_LIMITS = Object.freeze({
|
|
29693
|
+
maxBytes: 16 * 1024 * 1024,
|
|
29694
|
+
maxCollectionItems: 1e6,
|
|
29695
|
+
maxDepth: 128
|
|
29696
|
+
});
|
|
29697
|
+
WireWriter = class {
|
|
29698
|
+
buffer = new ArrayBuffer(256);
|
|
29699
|
+
view = new DataView(this.buffer);
|
|
29700
|
+
length = 0;
|
|
29701
|
+
reserve(bytes2) {
|
|
29702
|
+
const next2 = this.length + bytes2;
|
|
29703
|
+
if (!Number.isSafeInteger(bytes2) || bytes2 < 0 || next2 > TRACECLR_WIRE_LIMITS.maxBytes) {
|
|
29704
|
+
throw new RangeError(`TraceCLR wire payload exceeds ${TRACECLR_WIRE_LIMITS.maxBytes} bytes.`);
|
|
29705
|
+
}
|
|
29706
|
+
if (next2 > this.buffer.byteLength) {
|
|
29707
|
+
let capacity3 = this.buffer.byteLength;
|
|
29708
|
+
while (capacity3 < next2) capacity3 = Math.min(TRACECLR_WIRE_LIMITS.maxBytes, capacity3 * 2);
|
|
29709
|
+
const replacement = new ArrayBuffer(capacity3);
|
|
29710
|
+
new Uint8Array(replacement).set(new Uint8Array(this.buffer, 0, this.length));
|
|
29711
|
+
this.buffer = replacement;
|
|
29712
|
+
this.view = new DataView(replacement);
|
|
29713
|
+
}
|
|
29714
|
+
const offset = this.length;
|
|
29715
|
+
this.length = next2;
|
|
29716
|
+
return offset;
|
|
29717
|
+
}
|
|
29718
|
+
uint8(value) {
|
|
29719
|
+
const offset = this.reserve(1);
|
|
29720
|
+
this.view.setUint8(offset, value);
|
|
29721
|
+
}
|
|
29722
|
+
int8(value) {
|
|
29723
|
+
const offset = this.reserve(1);
|
|
29724
|
+
this.view.setInt8(offset, value);
|
|
29725
|
+
}
|
|
29726
|
+
int16(value) {
|
|
29727
|
+
const offset = this.reserve(2);
|
|
29728
|
+
this.view.setInt16(offset, value, true);
|
|
29729
|
+
}
|
|
29730
|
+
uint16(value) {
|
|
29731
|
+
const offset = this.reserve(2);
|
|
29732
|
+
this.view.setUint16(offset, value, true);
|
|
29733
|
+
}
|
|
29734
|
+
int32(value) {
|
|
29735
|
+
const offset = this.reserve(4);
|
|
29736
|
+
this.view.setInt32(offset, value, true);
|
|
29737
|
+
}
|
|
29738
|
+
uint32(value) {
|
|
29739
|
+
const offset = this.reserve(4);
|
|
29740
|
+
this.view.setUint32(offset, value, true);
|
|
29741
|
+
}
|
|
29742
|
+
int64(value) {
|
|
29743
|
+
const offset = this.reserve(8);
|
|
29744
|
+
this.view.setBigInt64(offset, value, true);
|
|
29745
|
+
}
|
|
29746
|
+
uint64(value) {
|
|
29747
|
+
const offset = this.reserve(8);
|
|
29748
|
+
this.view.setBigUint64(offset, value, true);
|
|
29749
|
+
}
|
|
29750
|
+
float32(value) {
|
|
29751
|
+
const offset = this.reserve(4);
|
|
29752
|
+
this.view.setFloat32(offset, value, true);
|
|
29753
|
+
}
|
|
29754
|
+
float64(value) {
|
|
29755
|
+
const offset = this.reserve(8);
|
|
29756
|
+
this.view.setFloat64(offset, value, true);
|
|
29757
|
+
}
|
|
29758
|
+
bytes(value) {
|
|
29759
|
+
const offset = this.reserve(value.byteLength);
|
|
29760
|
+
new Uint8Array(this.buffer, offset, value.byteLength).set(value);
|
|
29761
|
+
}
|
|
29762
|
+
finish() {
|
|
29763
|
+
return new Uint8Array(this.buffer.slice(0, this.length));
|
|
29764
|
+
}
|
|
29765
|
+
};
|
|
29766
|
+
WireReader = class {
|
|
29767
|
+
view;
|
|
29768
|
+
offset = 0;
|
|
29769
|
+
constructor(bytes2) {
|
|
29770
|
+
if (bytes2.byteLength > TRACECLR_WIRE_LIMITS.maxBytes) {
|
|
29771
|
+
throw new RangeError(`TraceCLR wire payload exceeds ${TRACECLR_WIRE_LIMITS.maxBytes} bytes.`);
|
|
29772
|
+
}
|
|
29773
|
+
this.view = new DataView(bytes2.buffer, bytes2.byteOffset, bytes2.byteLength);
|
|
29774
|
+
}
|
|
29775
|
+
take(bytes2) {
|
|
29776
|
+
if (this.offset + bytes2 > this.view.byteLength) {
|
|
29777
|
+
throw new RangeError("TraceCLR wire payload ended unexpectedly.");
|
|
29778
|
+
}
|
|
29779
|
+
const offset = this.offset;
|
|
29780
|
+
this.offset += bytes2;
|
|
29781
|
+
return offset;
|
|
29782
|
+
}
|
|
29783
|
+
uint8() {
|
|
29784
|
+
return this.view.getUint8(this.take(1));
|
|
29785
|
+
}
|
|
29786
|
+
int8() {
|
|
29787
|
+
return this.view.getInt8(this.take(1));
|
|
29788
|
+
}
|
|
29789
|
+
int16() {
|
|
29790
|
+
return this.view.getInt16(this.take(2), true);
|
|
29791
|
+
}
|
|
29792
|
+
uint16() {
|
|
29793
|
+
return this.view.getUint16(this.take(2), true);
|
|
29794
|
+
}
|
|
29795
|
+
int32() {
|
|
29796
|
+
return this.view.getInt32(this.take(4), true);
|
|
29797
|
+
}
|
|
29798
|
+
uint32() {
|
|
29799
|
+
return this.view.getUint32(this.take(4), true);
|
|
29800
|
+
}
|
|
29801
|
+
int64() {
|
|
29802
|
+
return this.view.getBigInt64(this.take(8), true);
|
|
29803
|
+
}
|
|
29804
|
+
uint64() {
|
|
29805
|
+
return this.view.getBigUint64(this.take(8), true);
|
|
29806
|
+
}
|
|
29807
|
+
float32() {
|
|
29808
|
+
return this.view.getFloat32(this.take(4), true);
|
|
29809
|
+
}
|
|
29810
|
+
float64() {
|
|
29811
|
+
return this.view.getFloat64(this.take(8), true);
|
|
29812
|
+
}
|
|
29813
|
+
bytes(length3) {
|
|
29814
|
+
return new Uint8Array(this.view.buffer, this.view.byteOffset + this.take(length3), length3);
|
|
29815
|
+
}
|
|
29816
|
+
done() {
|
|
29817
|
+
if (this.offset !== this.view.byteLength) {
|
|
29818
|
+
throw new RangeError(`TraceCLR wire payload has ${this.view.byteLength - this.offset} trailing bytes.`);
|
|
29819
|
+
}
|
|
29820
|
+
}
|
|
29821
|
+
};
|
|
29822
|
+
}
|
|
29823
|
+
});
|
|
29824
|
+
|
|
29280
29825
|
// packages/runtime-csharp/src/csharp-worker-client.ts
|
|
29281
29826
|
var csharp_worker_client_exports = {};
|
|
29282
29827
|
__export(csharp_worker_client_exports, {
|
|
@@ -29305,6 +29850,7 @@ var init_csharp_worker_client = __esm({
|
|
|
29305
29850
|
init_internal();
|
|
29306
29851
|
init_internal();
|
|
29307
29852
|
init_internal();
|
|
29853
|
+
init_traceclr_wire();
|
|
29308
29854
|
EXECUTION_TIMEOUT_MS4 = 2e4;
|
|
29309
29855
|
TRACING_TIMEOUT_MS4 = 2e4;
|
|
29310
29856
|
INIT_TIMEOUT_MS4 = 45e3;
|
|
@@ -29671,12 +30217,17 @@ var init_csharp_worker_client = __esm({
|
|
|
29671
30217
|
async executePreparedCode(prepared, call) {
|
|
29672
30218
|
return this.runPreparedExecutionGeneration(call.signal, async () => {
|
|
29673
30219
|
const wallClockMs = call.limits?.wallClockMs ?? this.executionTimeoutMs;
|
|
30220
|
+
const inputBytes = prepared.preparedRunnerTier === "algorithm-fast" ? encodeTraceClrWireInputs(
|
|
30221
|
+
prepared.traceClrWireContract,
|
|
30222
|
+
call.inputs
|
|
30223
|
+
) : void 0;
|
|
29674
30224
|
const program = this.preparedReadyEffect().pipe(
|
|
29675
30225
|
andThen4(
|
|
29676
30226
|
this.core.withExecutionDeadline(
|
|
29677
30227
|
this.sendCommandEffect("execute-prepared-code", {
|
|
29678
30228
|
prepared,
|
|
29679
30229
|
inputs: call.inputs,
|
|
30230
|
+
...inputBytes ? { inputBytes } : {},
|
|
29680
30231
|
assetBaseUrl: this.options.assetBaseUrl,
|
|
29681
30232
|
timeoutMs: Math.max(100, wallClockMs - 1e3),
|
|
29682
30233
|
...this.workerOptionsPayload()
|
|
@@ -29686,6 +30237,17 @@ var init_csharp_worker_client = __esm({
|
|
|
29686
30237
|
)
|
|
29687
30238
|
);
|
|
29688
30239
|
const result = await this.core.runClientEffect(program, call.signal);
|
|
30240
|
+
if (prepared.preparedRunnerTier === "algorithm-fast" && result.success) {
|
|
30241
|
+
if (!(result.outputBytes instanceof Uint8Array)) {
|
|
30242
|
+
throw new TypeError(
|
|
30243
|
+
"The algorithm-fast C# runner returned no binary output payload."
|
|
30244
|
+
);
|
|
30245
|
+
}
|
|
30246
|
+
result.output = decodeTraceClrWireResult(
|
|
30247
|
+
prepared.traceClrWireContract,
|
|
30248
|
+
result.outputBytes
|
|
30249
|
+
);
|
|
30250
|
+
}
|
|
29689
30251
|
return this.toCodeExecutionResult(result);
|
|
29690
30252
|
});
|
|
29691
30253
|
}
|
|
@@ -29697,6 +30259,10 @@ var init_csharp_worker_client = __esm({
|
|
|
29697
30259
|
}
|
|
29698
30260
|
return this.runPreparedExecutionGeneration(call.signal, async () => {
|
|
29699
30261
|
const wallClockMs = call.limits?.wallClockMs ?? this.resolveTracingTimeoutMs(prepared.functionName, prepared.executionStyle);
|
|
30262
|
+
const inputBytes = prepared.preparedRunnerTier === "algorithm-fast" ? encodeTraceClrWireInputs(
|
|
30263
|
+
prepared.traceClrWireContract,
|
|
30264
|
+
call.inputs
|
|
30265
|
+
) : void 0;
|
|
29700
30266
|
let result;
|
|
29701
30267
|
const program = this.preparedReadyEffect().pipe(
|
|
29702
30268
|
andThen4(
|
|
@@ -29704,6 +30270,7 @@ var init_csharp_worker_client = __esm({
|
|
|
29704
30270
|
this.sendCommandEffect("execute-prepared-trace", {
|
|
29705
30271
|
prepared,
|
|
29706
30272
|
inputs: call.inputs,
|
|
30273
|
+
...inputBytes ? { inputBytes } : {},
|
|
29707
30274
|
...call.recordTrace === void 0 ? {} : { tracingEnabled: call.recordTrace },
|
|
29708
30275
|
assetBaseUrl: this.options.assetBaseUrl,
|
|
29709
30276
|
timeoutMs: Math.max(100, wallClockMs - 1e3),
|
|
@@ -29719,6 +30286,17 @@ var init_csharp_worker_client = __esm({
|
|
|
29719
30286
|
} catch (error) {
|
|
29720
30287
|
return this.traceClientFailure(error, wallClockMs);
|
|
29721
30288
|
}
|
|
30289
|
+
if (prepared.preparedRunnerTier === "algorithm-fast" && result.success) {
|
|
30290
|
+
if (!(result.outputBytes instanceof Uint8Array)) {
|
|
30291
|
+
throw new TypeError(
|
|
30292
|
+
"The algorithm-fast C# trace runner returned no binary output payload."
|
|
30293
|
+
);
|
|
30294
|
+
}
|
|
30295
|
+
result.output = decodeTraceClrWireResult(
|
|
30296
|
+
prepared.traceClrWireContract,
|
|
30297
|
+
result.outputBytes
|
|
30298
|
+
);
|
|
30299
|
+
}
|
|
29722
30300
|
return this.toTraceExecutionResult(
|
|
29723
30301
|
result,
|
|
29724
30302
|
prepared.traceOptions,
|
|
@@ -29908,6 +30486,7 @@ function createCppPreparedExecutionProvider(options) {
|
|
|
29908
30486
|
let terminated = false;
|
|
29909
30487
|
const ownedClients = /* @__PURE__ */ new Set();
|
|
29910
30488
|
const activePrograms = /* @__PURE__ */ new Set();
|
|
30489
|
+
let scheduledCompilerPrewarm = null;
|
|
29911
30490
|
const createClient = () => {
|
|
29912
30491
|
const client = options.createWorkerClient();
|
|
29913
30492
|
ownedClients.add(client);
|
|
@@ -29935,6 +30514,21 @@ function createCppPreparedExecutionProvider(options) {
|
|
|
29935
30514
|
standbyClient = null;
|
|
29936
30515
|
return client;
|
|
29937
30516
|
};
|
|
30517
|
+
const cancelScheduledCompilerPrewarm = () => {
|
|
30518
|
+
scheduledCompilerPrewarm?.cancel();
|
|
30519
|
+
scheduledCompilerPrewarm = null;
|
|
30520
|
+
};
|
|
30521
|
+
const scheduleCompilerPrewarm = () => {
|
|
30522
|
+
if (terminated || scheduledCompilerPrewarm || !options.prewarmCompiler || !options.scheduleCompilerPrewarm) {
|
|
30523
|
+
return;
|
|
30524
|
+
}
|
|
30525
|
+
const expectedGeneration = generation;
|
|
30526
|
+
scheduledCompilerPrewarm = options.scheduleCompilerPrewarm(async () => {
|
|
30527
|
+
assertGeneration(expectedGeneration);
|
|
30528
|
+
await options.prewarmCompiler?.();
|
|
30529
|
+
assertGeneration(expectedGeneration);
|
|
30530
|
+
});
|
|
30531
|
+
};
|
|
29938
30532
|
return {
|
|
29939
30533
|
async init() {
|
|
29940
30534
|
assertActive();
|
|
@@ -29953,6 +30547,7 @@ function createCppPreparedExecutionProvider(options) {
|
|
|
29953
30547
|
const result = await client.init();
|
|
29954
30548
|
assertGeneration(expectedGeneration);
|
|
29955
30549
|
standbyClient = client;
|
|
30550
|
+
scheduleCompilerPrewarm();
|
|
29956
30551
|
return {
|
|
29957
30552
|
success: result.success,
|
|
29958
30553
|
loadTimeMs: result.loadTimeMs
|
|
@@ -29964,6 +30559,12 @@ function createCppPreparedExecutionProvider(options) {
|
|
|
29964
30559
|
},
|
|
29965
30560
|
async prepareProgram(call) {
|
|
29966
30561
|
const expectedGeneration = generation;
|
|
30562
|
+
const compilerPrewarm = scheduledCompilerPrewarm;
|
|
30563
|
+
scheduledCompilerPrewarm = null;
|
|
30564
|
+
if (compilerPrewarm) {
|
|
30565
|
+
await compilerPrewarm.promote().catch(() => void 0);
|
|
30566
|
+
assertGeneration(expectedGeneration);
|
|
30567
|
+
}
|
|
29967
30568
|
const client = acquireClient();
|
|
29968
30569
|
try {
|
|
29969
30570
|
await client.init();
|
|
@@ -30094,6 +30695,7 @@ function createCppPreparedExecutionProvider(options) {
|
|
|
30094
30695
|
},
|
|
30095
30696
|
reset() {
|
|
30096
30697
|
assertActive();
|
|
30698
|
+
cancelScheduledCompilerPrewarm();
|
|
30097
30699
|
generation += 1;
|
|
30098
30700
|
for (const forceDispose of [...activePrograms]) forceDispose();
|
|
30099
30701
|
for (const client of [...ownedClients]) retireClient(client);
|
|
@@ -30101,6 +30703,7 @@ function createCppPreparedExecutionProvider(options) {
|
|
|
30101
30703
|
},
|
|
30102
30704
|
terminate() {
|
|
30103
30705
|
if (terminated) return;
|
|
30706
|
+
cancelScheduledCompilerPrewarm();
|
|
30104
30707
|
generation += 1;
|
|
30105
30708
|
terminated = true;
|
|
30106
30709
|
for (const forceDispose of [...activePrograms]) forceDispose();
|
|
@@ -31553,8 +32156,30 @@ var init_tracecc_compiler_service = __esm({
|
|
|
31553
32156
|
requestTimeoutMs;
|
|
31554
32157
|
artifactCache = /* @__PURE__ */ new Map();
|
|
31555
32158
|
artifactCacheBytes = 0;
|
|
32159
|
+
/**
|
|
32160
|
+
* Fetch and verify the immutable compiler inputs inside the trusted compiler
|
|
32161
|
+
* Worker without compiling or instantiating TraceCC. A foreground compile
|
|
32162
|
+
* joins the Worker's immutable byte cache.
|
|
32163
|
+
*/
|
|
32164
|
+
async prewarmAssets(shard = "narrow") {
|
|
32165
|
+
await this.ensureWorker();
|
|
32166
|
+
const selected = this.options.shards[shard];
|
|
32167
|
+
const result = await this.send("prewarm-trusted-tracecc-assets", {
|
|
32168
|
+
...this.traceccAssets(
|
|
32169
|
+
selected,
|
|
32170
|
+
`/tracecc-assets/${shard}.pch`,
|
|
32171
|
+
`/tracecc-assets/${shard}.o`
|
|
32172
|
+
),
|
|
32173
|
+
source: "tracecc-prewarm-assets-v1"
|
|
32174
|
+
});
|
|
32175
|
+
if (result.success !== true) {
|
|
32176
|
+
throw new Error(
|
|
32177
|
+
typeof result.error === "string" ? result.error : "TraceCC compiler asset prewarm failed."
|
|
32178
|
+
);
|
|
32179
|
+
}
|
|
32180
|
+
}
|
|
31556
32181
|
async warmup(shard = "narrow") {
|
|
31557
|
-
await this.
|
|
32182
|
+
await this.prewarmAssets(shard);
|
|
31558
32183
|
await this.ensureWorker();
|
|
31559
32184
|
const selected = this.options.shards[shard];
|
|
31560
32185
|
const pchPath = `/tracecc-assets/${shard}.pch`;
|
|
@@ -31621,7 +32246,6 @@ var init_tracecc_compiler_service = __esm({
|
|
|
31621
32246
|
""
|
|
31622
32247
|
);
|
|
31623
32248
|
const shard = traceccShardForDriver(strippedSource);
|
|
31624
|
-
await this.options.assetPreflight?.(shard);
|
|
31625
32249
|
if (signal?.aborted || generation !== this.generation) {
|
|
31626
32250
|
throw Object.assign(
|
|
31627
32251
|
new Error("TraceCC compilation was cancelled."),
|
|
@@ -31799,7 +32423,6 @@ var init_tracecc_compiler_service = __esm({
|
|
|
31799
32423
|
error: "TraceCC trusted Project compilation only accepts compile requests."
|
|
31800
32424
|
};
|
|
31801
32425
|
}
|
|
31802
|
-
await this.options.commonAssetPreflight?.();
|
|
31803
32426
|
if (signal?.aborted || generation !== this.generation) {
|
|
31804
32427
|
throw Object.assign(
|
|
31805
32428
|
new Error("TraceCC Project compilation was cancelled."),
|
|
@@ -32005,36 +32628,18 @@ function createTraceCCBrowserCompilerService(compiler, context2) {
|
|
|
32005
32628
|
...DEFAULT_TRACECC_RESOURCE_NAMES,
|
|
32006
32629
|
...compiler.resourceNames ?? {}
|
|
32007
32630
|
};
|
|
32008
|
-
const commonCompilerAssetNames = [
|
|
32009
|
-
"runtimeHeader",
|
|
32010
|
-
"compilerWasm",
|
|
32011
|
-
"linkerWasm",
|
|
32012
|
-
"sysroot"
|
|
32013
|
-
];
|
|
32014
|
-
const commonAssetPreflight = () => context2.preflight(commonCompilerAssetNames);
|
|
32015
32631
|
const compilerIntegrity = context2.assets.cppCompilerIntegrity;
|
|
32016
32632
|
if (!compilerIntegrity) {
|
|
32017
32633
|
throw new Error(
|
|
32018
32634
|
"TraceCC requires exact compiler integrity entries from a C++ runtime manifest."
|
|
32019
32635
|
);
|
|
32020
32636
|
}
|
|
32021
|
-
const shardAssetPreflight = (shard) => {
|
|
32022
|
-
const prefix = shard === "map" ? "map" : shard;
|
|
32023
|
-
return context2.preflight([
|
|
32024
|
-
...commonCompilerAssetNames,
|
|
32025
|
-
`compilerResources.${resourceNames[`${prefix}Pch`]}`,
|
|
32026
|
-
`compilerResources.${resourceNames[`${prefix}PchSource`]}`,
|
|
32027
|
-
`compilerResources.${resourceNames[`${prefix}RuntimeObject`]}`
|
|
32028
|
-
]);
|
|
32029
|
-
};
|
|
32030
32637
|
return new TraceCCCompilerService({
|
|
32031
32638
|
workerUrl: context2.assets.cppWorker,
|
|
32032
32639
|
compilerUrl: context2.assets.cppCompilerWasm,
|
|
32033
32640
|
resourcesUrl: context2.assets.cppSysroot,
|
|
32034
32641
|
runtimeHeaderUrl: context2.assets.cppRuntimeHeader,
|
|
32035
32642
|
compilerIntegrity,
|
|
32036
|
-
commonAssetPreflight,
|
|
32037
|
-
assetPreflight: shardAssetPreflight,
|
|
32038
32643
|
shards: {
|
|
32039
32644
|
narrow: traceccShardAssets(
|
|
32040
32645
|
traceccResources,
|
|
@@ -32063,18 +32668,9 @@ function createCppBrowserRuntimeProvider(options = {}) {
|
|
|
32063
32668
|
create(context2) {
|
|
32064
32669
|
const workerFactory = context2.workerFactoryFor("cpp");
|
|
32065
32670
|
const compiler = options.compiler ?? {};
|
|
32066
|
-
const commonCompilerAssetNames = [
|
|
32067
|
-
"runtimeHeader",
|
|
32068
|
-
"compilerWasm",
|
|
32069
|
-
"linkerWasm",
|
|
32070
|
-
"sysroot"
|
|
32071
|
-
];
|
|
32072
|
-
const runtimeAssetPreflight = context2.preflight("cpp", commonCompilerAssetNames);
|
|
32073
32671
|
const workerOptions = {
|
|
32074
32672
|
workerUrl: context2.assets.cppWorker,
|
|
32075
32673
|
...workerFactory ? { workerFactory } : {},
|
|
32076
|
-
assetPreflight: context2.preflight("cpp", ["worker"]),
|
|
32077
|
-
runtimeAssetPreflight,
|
|
32078
32674
|
compilerWasmUrl: context2.assets.cppCompilerWasm,
|
|
32079
32675
|
linkerWasmUrl: context2.assets.cppLinkerWasm,
|
|
32080
32676
|
sysrootUrl: context2.assets.cppSysroot,
|
|
@@ -32090,8 +32686,7 @@ function createCppBrowserRuntimeProvider(options = {}) {
|
|
|
32090
32686
|
};
|
|
32091
32687
|
const compilerService = createTraceCCBrowserCompilerService(compiler, {
|
|
32092
32688
|
assets: context2.assets,
|
|
32093
|
-
...workerFactory ? { workerFactory } : {}
|
|
32094
|
-
preflight: (assetNames) => context2.preflight("cpp", assetNames)()
|
|
32689
|
+
...workerFactory ? { workerFactory } : {}
|
|
32095
32690
|
});
|
|
32096
32691
|
const createWorkerClient = () => new CppWorkerClient({
|
|
32097
32692
|
...workerOptions,
|
|
@@ -32099,7 +32694,9 @@ function createCppBrowserRuntimeProvider(options = {}) {
|
|
|
32099
32694
|
});
|
|
32100
32695
|
const preparedProvider = createCppPreparedExecutionProvider({
|
|
32101
32696
|
createWorkerClient,
|
|
32102
|
-
warmCompilerOnInit:
|
|
32697
|
+
warmCompilerOnInit: false,
|
|
32698
|
+
prewarmCompiler: () => compilerService.prewarmAssets(),
|
|
32699
|
+
scheduleCompilerPrewarm: createPromotableBrowserBackgroundTask
|
|
32103
32700
|
});
|
|
32104
32701
|
const preparedProviders = /* @__PURE__ */ new Map([["cpp", preparedProvider]]);
|
|
32105
32702
|
const terminateCompiler = () => {
|
|
@@ -32123,6 +32720,7 @@ var DEFAULT_TRACECC_RESOURCE_NAMES;
|
|
|
32123
32720
|
var init_browser_runtime_provider = __esm({
|
|
32124
32721
|
"packages/runtime-cpp/src/browser-runtime-provider.ts"() {
|
|
32125
32722
|
"use strict";
|
|
32723
|
+
init_internal();
|
|
32126
32724
|
init_cpp_prepared_provider();
|
|
32127
32725
|
init_cpp_worker_client();
|
|
32128
32726
|
init_tracecc_compiler_service();
|
|
@@ -117863,9 +118461,9 @@ function createBrowserFsPromisesApi(requestState, filesystemState, fsApi) {
|
|
|
117863
118461
|
const options = typeof bufferOrOptions === "object" && bufferOrOptions !== null && !ArrayBuffer.isView(bufferOrOptions) ? bufferOrOptions : void 0;
|
|
117864
118462
|
const buffer = options?.buffer ?? (ArrayBuffer.isView(bufferOrOptions) ? bufferOrOptions : BrowserBuffer.alloc(16 * 1024));
|
|
117865
118463
|
const readOffset = options?.offset ?? offset;
|
|
117866
|
-
const
|
|
118464
|
+
const readLength2 = options?.length ?? length3 ?? buffer.byteLength - readOffset;
|
|
117867
118465
|
const readPosition = options !== void 0 ? options.position : position;
|
|
117868
|
-
const bytesRead = fsApi.readSync(fd3, buffer, readOffset,
|
|
118466
|
+
const bytesRead = fsApi.readSync(fd3, buffer, readOffset, readLength2, readPosition);
|
|
117869
118467
|
return { bytesRead, buffer };
|
|
117870
118468
|
},
|
|
117871
118469
|
readFile: async (encoding) => readFileFromHandle(encoding),
|
|
@@ -125123,14 +125721,7 @@ function preflightAssets(language, surface, csharpPreparedAuthority) {
|
|
|
125123
125721
|
"runnerDependencies"
|
|
125124
125722
|
];
|
|
125125
125723
|
case "cpp":
|
|
125126
|
-
return [
|
|
125127
|
-
"worker",
|
|
125128
|
-
"runtimeHeader",
|
|
125129
|
-
"compilerWasm",
|
|
125130
|
-
"linkerWasm",
|
|
125131
|
-
"sysroot",
|
|
125132
|
-
"compilerResources"
|
|
125133
|
-
];
|
|
125724
|
+
return [];
|
|
125134
125725
|
}
|
|
125135
125726
|
}
|
|
125136
125727
|
function detectEngine(userAgent = globalThis.navigator?.userAgent ?? "") {
|
|
@@ -125798,6 +126389,7 @@ function withPreparedProgramReuse(delegate, options = {}) {
|
|
|
125798
126389
|
}
|
|
125799
126390
|
|
|
125800
126391
|
// packages/runtime-browser/src/browser-runtime-host.ts
|
|
126392
|
+
init_background_work_scheduler();
|
|
125801
126393
|
function resolveHostContext(options) {
|
|
125802
126394
|
return resolveBrowserRuntimeLifecycleContext(options, {
|
|
125803
126395
|
optionsName: "CreateBrowserRuntimeHostOptions",
|
|
@@ -125889,6 +126481,8 @@ var BrowserRuntimeHostImplementation = class {
|
|
|
125889
126481
|
environment;
|
|
125890
126482
|
supportedLanguages;
|
|
125891
126483
|
#preparedProviders = /* @__PURE__ */ new Map();
|
|
126484
|
+
#providerInitializers = /* @__PURE__ */ new Map();
|
|
126485
|
+
#warmEntries = /* @__PURE__ */ new Map();
|
|
125892
126486
|
#leases = [];
|
|
125893
126487
|
#leaseByLanguage = /* @__PURE__ */ new Map();
|
|
125894
126488
|
#readinessByLanguage = /* @__PURE__ */ new Map();
|
|
@@ -125930,16 +126524,25 @@ var BrowserRuntimeHostImplementation = class {
|
|
|
125930
126524
|
language,
|
|
125931
126525
|
preparedProvider
|
|
125932
126526
|
);
|
|
126527
|
+
const safeProvider = safePreparedProvider(
|
|
126528
|
+
language,
|
|
126529
|
+
preparedProvider,
|
|
126530
|
+
() => this.#assertActive(),
|
|
126531
|
+
() => this.#ensureLanguageReady(language)
|
|
126532
|
+
);
|
|
126533
|
+
this.#providerInitializers.set(
|
|
126534
|
+
language,
|
|
126535
|
+
() => safeProvider.init()
|
|
126536
|
+
);
|
|
125933
126537
|
this.#preparedProviders.set(
|
|
125934
126538
|
language,
|
|
125935
|
-
withPreparedProgramReuse(
|
|
125936
|
-
|
|
125937
|
-
|
|
125938
|
-
|
|
125939
|
-
|
|
125940
|
-
|
|
125941
|
-
|
|
125942
|
-
)
|
|
126539
|
+
withPreparedProgramReuse({
|
|
126540
|
+
init: () => this.#promoteLanguageWarm(language),
|
|
126541
|
+
prepareProgram: async (call) => {
|
|
126542
|
+
await this.#promoteLanguageWarm(language);
|
|
126543
|
+
return safeProvider.prepareProgram(call);
|
|
126544
|
+
}
|
|
126545
|
+
})
|
|
125943
126546
|
);
|
|
125944
126547
|
this.#leaseByLanguage.set(language, lease);
|
|
125945
126548
|
}
|
|
@@ -125986,6 +126589,41 @@ var BrowserRuntimeHostImplementation = class {
|
|
|
125986
126589
|
throw new Error("Browser runtime host has been disposed.");
|
|
125987
126590
|
}
|
|
125988
126591
|
}
|
|
126592
|
+
#warmEntry(language) {
|
|
126593
|
+
const existing = this.#warmEntries.get(language);
|
|
126594
|
+
if (existing) return existing;
|
|
126595
|
+
const initialize = this.#providerInitializers.get(language);
|
|
126596
|
+
if (!initialize) {
|
|
126597
|
+
throw new Error(
|
|
126598
|
+
`Prepared runtime for language "${language}" is not registered.`
|
|
126599
|
+
);
|
|
126600
|
+
}
|
|
126601
|
+
let warmResult;
|
|
126602
|
+
const task = createPromotableBrowserBackgroundTask(async () => {
|
|
126603
|
+
warmResult = await initialize();
|
|
126604
|
+
});
|
|
126605
|
+
const result = task.wait().then(() => {
|
|
126606
|
+
if (!warmResult) {
|
|
126607
|
+
throw new Error(
|
|
126608
|
+
`Browser runtime for ${JSON.stringify(language)} completed warmup without a result.`
|
|
126609
|
+
);
|
|
126610
|
+
}
|
|
126611
|
+
return warmResult;
|
|
126612
|
+
});
|
|
126613
|
+
const entry = { task, result };
|
|
126614
|
+
this.#warmEntries.set(language, entry);
|
|
126615
|
+
void result.catch(() => {
|
|
126616
|
+
if (this.#warmEntries.get(language) === entry) {
|
|
126617
|
+
this.#warmEntries.delete(language);
|
|
126618
|
+
}
|
|
126619
|
+
});
|
|
126620
|
+
return entry;
|
|
126621
|
+
}
|
|
126622
|
+
async #promoteLanguageWarm(language) {
|
|
126623
|
+
const entry = this.#warmEntry(language);
|
|
126624
|
+
await entry.task.promote();
|
|
126625
|
+
return entry.result;
|
|
126626
|
+
}
|
|
125989
126627
|
isLanguageSupported(language) {
|
|
125990
126628
|
return this.supportedLanguages.includes(language);
|
|
125991
126629
|
}
|
|
@@ -126053,6 +126691,17 @@ var BrowserRuntimeHostImplementation = class {
|
|
|
126053
126691
|
runtimes: Object.freeze(runtimes)
|
|
126054
126692
|
});
|
|
126055
126693
|
}
|
|
126694
|
+
prewarmLanguage(language) {
|
|
126695
|
+
this.#assertActive();
|
|
126696
|
+
if (!this.supportedLanguages.includes(language)) {
|
|
126697
|
+
return Promise.reject(
|
|
126698
|
+
new Error(
|
|
126699
|
+
`Runtime for language "${language}" is not selected in this browser environment.`
|
|
126700
|
+
)
|
|
126701
|
+
);
|
|
126702
|
+
}
|
|
126703
|
+
return this.#warmEntry(language).result;
|
|
126704
|
+
}
|
|
126056
126705
|
warmLanguage(language) {
|
|
126057
126706
|
this.#assertActive();
|
|
126058
126707
|
if (!this.supportedLanguages.includes(language)) {
|
|
@@ -126062,16 +126711,20 @@ var BrowserRuntimeHostImplementation = class {
|
|
|
126062
126711
|
)
|
|
126063
126712
|
);
|
|
126064
126713
|
}
|
|
126065
|
-
return this.#
|
|
126714
|
+
return this.#promoteLanguageWarm(language);
|
|
126066
126715
|
}
|
|
126067
126716
|
disposeLanguage(language) {
|
|
126068
126717
|
if (this.#disposed || !this.supportedLanguages.includes(language)) return;
|
|
126718
|
+
this.#warmEntries.get(language)?.task.cancel();
|
|
126719
|
+
this.#warmEntries.delete(language);
|
|
126069
126720
|
this.#preparedProviders.get(language)?.flushPreparedProgramCache();
|
|
126070
126721
|
this.#leaseByLanguage.get(language)?.disposeLanguage(language);
|
|
126071
126722
|
}
|
|
126072
126723
|
dispose() {
|
|
126073
126724
|
if (this.#disposed) return;
|
|
126074
126725
|
this.#disposed = true;
|
|
126726
|
+
for (const entry of this.#warmEntries.values()) entry.task.cancel();
|
|
126727
|
+
this.#warmEntries.clear();
|
|
126075
126728
|
this.#readinessByLanguage.clear();
|
|
126076
126729
|
for (const provider of this.#preparedProviders.values()) {
|
|
126077
126730
|
provider.flushPreparedProgramCache();
|
|
@@ -126911,6 +127564,7 @@ init_execution_host();
|
|
|
126911
127564
|
init_runtime_language_info();
|
|
126912
127565
|
|
|
126913
127566
|
// packages/runtime-python/src/python-runtime-image.ts
|
|
127567
|
+
init_internal();
|
|
126914
127568
|
function fetchOptions(descriptor3, signal) {
|
|
126915
127569
|
return {
|
|
126916
127570
|
cache: "force-cache",
|
|
@@ -126951,8 +127605,114 @@ function createPythonRuntimeImageFactory(options) {
|
|
|
126951
127605
|
let disposed = false;
|
|
126952
127606
|
let imagePromise = null;
|
|
126953
127607
|
let activeBuildController = null;
|
|
127608
|
+
let activeBootstrapWorker = null;
|
|
127609
|
+
let activeBootstrapCancellation = null;
|
|
127610
|
+
const buildInWorker = () => new Promise((resolve, reject) => {
|
|
127611
|
+
if (!options.workerUrl) {
|
|
127612
|
+
reject(new Error("Python runtime-image bootstrap requires a worker URL."));
|
|
127613
|
+
return;
|
|
127614
|
+
}
|
|
127615
|
+
const workerFormat = options.workerFormat ?? "classic";
|
|
127616
|
+
let workerUrl = appendWorkerUrlQueryParameter(
|
|
127617
|
+
options.workerUrl,
|
|
127618
|
+
"tracecodePythonRole",
|
|
127619
|
+
"runtime-image"
|
|
127620
|
+
);
|
|
127621
|
+
if (workerFormat === "module") {
|
|
127622
|
+
workerUrl = appendWorkerUrlQueryParameter(
|
|
127623
|
+
workerUrl,
|
|
127624
|
+
"tracecodePythonWorkerFormat",
|
|
127625
|
+
"module"
|
|
127626
|
+
);
|
|
127627
|
+
}
|
|
127628
|
+
const worker = options.workerFactory ? options.workerFactory(
|
|
127629
|
+
workerUrl,
|
|
127630
|
+
workerFormat === "module" ? { type: "module" } : void 0
|
|
127631
|
+
) : new Worker(
|
|
127632
|
+
workerUrl,
|
|
127633
|
+
workerFormat === "module" ? { type: "module" } : void 0
|
|
127634
|
+
);
|
|
127635
|
+
activeBootstrapWorker = worker;
|
|
127636
|
+
const id3 = "python-runtime-image";
|
|
127637
|
+
const protocolToken = createWorkerProtocolToken();
|
|
127638
|
+
let requested = false;
|
|
127639
|
+
let settled = false;
|
|
127640
|
+
const finish = (operation) => {
|
|
127641
|
+
if (settled) return;
|
|
127642
|
+
settled = true;
|
|
127643
|
+
globalThis.clearTimeout(timeoutId);
|
|
127644
|
+
worker.terminate();
|
|
127645
|
+
if (activeBootstrapWorker === worker) activeBootstrapWorker = null;
|
|
127646
|
+
activeBootstrapCancellation = null;
|
|
127647
|
+
operation();
|
|
127648
|
+
};
|
|
127649
|
+
const timeoutId = globalThis.setTimeout(() => {
|
|
127650
|
+
finish(() => reject(
|
|
127651
|
+
new Error(
|
|
127652
|
+
`Python runtime image acquisition timed out after ${timeoutMs}ms.`
|
|
127653
|
+
)
|
|
127654
|
+
));
|
|
127655
|
+
}, timeoutMs);
|
|
127656
|
+
activeBootstrapCancellation = () => {
|
|
127657
|
+
finish(() => reject(
|
|
127658
|
+
new Error("Python runtime image factory was disposed while loading.")
|
|
127659
|
+
));
|
|
127660
|
+
};
|
|
127661
|
+
worker.onerror = (event) => {
|
|
127662
|
+
finish(() => reject(
|
|
127663
|
+
new Error(
|
|
127664
|
+
event.message || "Python runtime-image bootstrap Worker crashed."
|
|
127665
|
+
)
|
|
127666
|
+
));
|
|
127667
|
+
};
|
|
127668
|
+
worker.onmessage = (event) => {
|
|
127669
|
+
const message = event.data;
|
|
127670
|
+
if (message?.type === "worker-ready" && !requested) {
|
|
127671
|
+
requested = true;
|
|
127672
|
+
worker.postMessage({
|
|
127673
|
+
id: id3,
|
|
127674
|
+
type: "build-runtime-image",
|
|
127675
|
+
protocolToken,
|
|
127676
|
+
payload: {
|
|
127677
|
+
source: "tracecode-python-runtime-image-v1",
|
|
127678
|
+
descriptor: options.descriptor
|
|
127679
|
+
}
|
|
127680
|
+
});
|
|
127681
|
+
return;
|
|
127682
|
+
}
|
|
127683
|
+
if (message?.id !== id3 || message.protocolToken !== protocolToken) {
|
|
127684
|
+
return;
|
|
127685
|
+
}
|
|
127686
|
+
if (message.type === "error") {
|
|
127687
|
+
finish(() => reject(
|
|
127688
|
+
new Error(
|
|
127689
|
+
message.payload?.error || "Python runtime-image bootstrap failed."
|
|
127690
|
+
)
|
|
127691
|
+
));
|
|
127692
|
+
return;
|
|
127693
|
+
}
|
|
127694
|
+
if (message.type !== "runtime-image-result") return;
|
|
127695
|
+
const image = message.payload?.runtimeImage;
|
|
127696
|
+
if (image?.protocolVersion !== PYTHON_RUNTIME_IMAGE_PROTOCOL_VERSION || !(image.compiledModule instanceof WebAssembly.Module) || !(image.snapshot instanceof Uint8Array) || image.snapshot.byteLength === 0 || typeof image.pythonHashSeed !== "string" || image.pythonHashSeed.length === 0) {
|
|
127697
|
+
finish(() => reject(
|
|
127698
|
+
new Error("Python runtime-image bootstrap returned an invalid image.")
|
|
127699
|
+
));
|
|
127700
|
+
return;
|
|
127701
|
+
}
|
|
127702
|
+
finish(() => resolve(Object.freeze(image)));
|
|
127703
|
+
};
|
|
127704
|
+
});
|
|
126954
127705
|
const build = async () => {
|
|
126955
127706
|
if (disposed) throw new Error("Python runtime image factory is disposed.");
|
|
127707
|
+
if (options.workerUrl) {
|
|
127708
|
+
const image = await buildInWorker();
|
|
127709
|
+
if (disposed) {
|
|
127710
|
+
throw new Error(
|
|
127711
|
+
"Python runtime image factory was disposed while loading."
|
|
127712
|
+
);
|
|
127713
|
+
}
|
|
127714
|
+
return image;
|
|
127715
|
+
}
|
|
126956
127716
|
const controller = new AbortController();
|
|
126957
127717
|
activeBuildController = controller;
|
|
126958
127718
|
let timeoutId;
|
|
@@ -127070,6 +127830,10 @@ function createPythonRuntimeImageFactory(options) {
|
|
|
127070
127830
|
disposed = true;
|
|
127071
127831
|
activeBuildController?.abort();
|
|
127072
127832
|
activeBuildController = null;
|
|
127833
|
+
activeBootstrapCancellation?.();
|
|
127834
|
+
activeBootstrapCancellation = null;
|
|
127835
|
+
activeBootstrapWorker?.terminate();
|
|
127836
|
+
activeBootstrapWorker = null;
|
|
127073
127837
|
imagePromise = null;
|
|
127074
127838
|
}
|
|
127075
127839
|
});
|
|
@@ -127196,9 +127960,15 @@ function createPythonBrowserRuntimeProvider(options = {}) {
|
|
|
127196
127960
|
);
|
|
127197
127961
|
}
|
|
127198
127962
|
const createRuntimeImageFactory = () => createPythonRuntimeImageFactory({
|
|
127199
|
-
descriptor: runtimeImageDescriptor
|
|
127963
|
+
descriptor: runtimeImageDescriptor,
|
|
127964
|
+
workerUrl: context2.assets.pythonWorker,
|
|
127965
|
+
...workerFactory ? { workerFactory } : {},
|
|
127966
|
+
...pythonManifest?.workerFormat ? { workerFormat: pythonManifest.workerFormat } : {}
|
|
127200
127967
|
});
|
|
127201
127968
|
let runtimeImageFactory = createRuntimeImageFactory();
|
|
127969
|
+
const runtimeImageWorkerPreflight = context2.preflight("python", [
|
|
127970
|
+
"worker"
|
|
127971
|
+
]);
|
|
127202
127972
|
const workerOptions = () => ({
|
|
127203
127973
|
workerUrl: context2.assets.pythonWorker,
|
|
127204
127974
|
...workerFactory ? { workerFactory } : {},
|
|
@@ -127239,6 +128009,7 @@ function createPythonBrowserRuntimeProvider(options = {}) {
|
|
|
127239
128009
|
const lease = {
|
|
127240
128010
|
preparedProviders,
|
|
127241
128011
|
preflightLanguage: async () => {
|
|
128012
|
+
await runtimeImageWorkerPreflight();
|
|
127242
128013
|
await runtimeImageFactory.acquire();
|
|
127243
128014
|
},
|
|
127244
128015
|
disposeLanguage: () => {
|
|
@@ -129555,6 +130326,7 @@ function createJavaBrowserRuntimeProvider(options = {}) {
|
|
|
129555
130326
|
debug: context2.debug,
|
|
129556
130327
|
workerIdleTimeoutMs: options.workerIdleTimeoutMs,
|
|
129557
130328
|
compileCacheLimit: options.compileCacheLimit,
|
|
130329
|
+
externalCompilerUrl: options.externalCompilerUrl,
|
|
129558
130330
|
assetPreflight: context2.preflight("java", ["worker"])
|
|
129559
130331
|
};
|
|
129560
130332
|
const preparedProvider = createJavaBrowserPreparedExecutionProvider(workerOptions);
|
|
@@ -129584,9 +130356,9 @@ var CSharpRuntimeClient = class {
|
|
|
129584
130356
|
get preparedCompiler() {
|
|
129585
130357
|
return this.preparedAuthority?.compiler ?? this.workerClient;
|
|
129586
130358
|
}
|
|
129587
|
-
async withPreparedRunner(execute) {
|
|
130359
|
+
async withPreparedRunner(tier, execute) {
|
|
129588
130360
|
if (!this.preparedAuthority) return execute(this.workerClient);
|
|
129589
|
-
const runner = this.preparedAuthority.createRunner();
|
|
130361
|
+
const runner = this.preparedAuthority.createRunner(tier);
|
|
129590
130362
|
try {
|
|
129591
130363
|
return await execute(runner);
|
|
129592
130364
|
} finally {
|
|
@@ -129594,7 +130366,7 @@ var CSharpRuntimeClient = class {
|
|
|
129594
130366
|
this.preparedAuthority.releaseRunner(runner);
|
|
129595
130367
|
}
|
|
129596
130368
|
}
|
|
129597
|
-
async withFreshPreparedRunners(inputBatch, execute, signal) {
|
|
130369
|
+
async withFreshPreparedRunners(tier, inputBatch, execute, signal) {
|
|
129598
130370
|
const concurrency = Math.min(
|
|
129599
130371
|
inputBatch.length,
|
|
129600
130372
|
this.preparedAuthority?.batchConcurrency ?? 1
|
|
@@ -129616,6 +130388,7 @@ var CSharpRuntimeClient = class {
|
|
|
129616
130388
|
const inputs = inputBatch[index];
|
|
129617
130389
|
try {
|
|
129618
130390
|
results[index] = await this.withPreparedRunner(
|
|
130391
|
+
tier,
|
|
129619
130392
|
(runner) => execute(runner, inputs, index)
|
|
129620
130393
|
);
|
|
129621
130394
|
} catch (reason) {
|
|
@@ -129719,6 +130492,17 @@ var CSharpRuntimeClient = class {
|
|
|
129719
130492
|
timings: result.timings
|
|
129720
130493
|
};
|
|
129721
130494
|
}
|
|
130495
|
+
const preparedRunnerTier = result.preparedRunnerTier;
|
|
130496
|
+
const preparedRunnerReason = result.preparedRunnerReason;
|
|
130497
|
+
if (preparedRunnerTier !== "algorithm-fast" && preparedRunnerTier !== "compatibility" || typeof preparedRunnerReason !== "string" || !preparedRunnerReason || preparedRunnerTier === "algorithm-fast" && !result.traceClrWireContract) {
|
|
130498
|
+
return {
|
|
130499
|
+
kind: "failed",
|
|
130500
|
+
error: "C# preparation completed without a valid runner-tier descriptor.",
|
|
130501
|
+
diagnosticStage: "compile",
|
|
130502
|
+
consoleOutput: result.consoleOutput ?? [],
|
|
130503
|
+
timings: result.timings
|
|
130504
|
+
};
|
|
130505
|
+
}
|
|
129722
130506
|
let artifact = Object.freeze({
|
|
129723
130507
|
mode: call.mode,
|
|
129724
130508
|
code: call.code,
|
|
@@ -129727,7 +130511,24 @@ var CSharpRuntimeClient = class {
|
|
|
129727
130511
|
...call.traceOptions ? { traceOptions: Object.freeze({ ...call.traceOptions }) } : {},
|
|
129728
130512
|
compiledArtifactKey: result.compiledArtifactKey,
|
|
129729
130513
|
compiledArtifactBase64: result.compiledArtifactBase64,
|
|
129730
|
-
compiledArtifactSha256: result.compiledArtifactSha256
|
|
130514
|
+
compiledArtifactSha256: result.compiledArtifactSha256,
|
|
130515
|
+
preparedRunnerTier,
|
|
130516
|
+
preparedRunnerReason,
|
|
130517
|
+
...result.traceClrWireContract ? {
|
|
130518
|
+
traceClrWireContract: Object.freeze({
|
|
130519
|
+
parameters: Object.freeze(
|
|
130520
|
+
result.traceClrWireContract.parameters.map(
|
|
130521
|
+
(parameter) => Object.freeze({
|
|
130522
|
+
name: parameter.name,
|
|
130523
|
+
type: Object.freeze({ ...parameter.type })
|
|
130524
|
+
})
|
|
130525
|
+
)
|
|
130526
|
+
),
|
|
130527
|
+
returnType: Object.freeze({
|
|
130528
|
+
...result.traceClrWireContract.returnType
|
|
130529
|
+
})
|
|
130530
|
+
})
|
|
130531
|
+
} : {}
|
|
129731
130532
|
});
|
|
129732
130533
|
let disposed = false;
|
|
129733
130534
|
let disposePromise;
|
|
@@ -129797,6 +130598,7 @@ var CSharpRuntimeClient = class {
|
|
|
129797
130598
|
executeIsolated: (preparedCall) => executeOwned(
|
|
129798
130599
|
preparedCall,
|
|
129799
130600
|
(preparedArtifact, forwardedCall) => this.withPreparedRunner(
|
|
130601
|
+
preparedArtifact.preparedRunnerTier,
|
|
129800
130602
|
(runner) => runner.executePreparedTrace(
|
|
129801
130603
|
preparedArtifact,
|
|
129802
130604
|
forwardedCall
|
|
@@ -129814,6 +130616,7 @@ var CSharpRuntimeClient = class {
|
|
|
129814
130616
|
return executeOwned(
|
|
129815
130617
|
preparedCall,
|
|
129816
130618
|
(preparedArtifact, forwardedCall) => this.withFreshPreparedRunners(
|
|
130619
|
+
preparedArtifact.preparedRunnerTier,
|
|
129817
130620
|
forwardedCall.inputBatch,
|
|
129818
130621
|
(runner, inputs, index) => runner.executePreparedTrace(
|
|
129819
130622
|
preparedArtifact,
|
|
@@ -129837,12 +130640,14 @@ var CSharpRuntimeClient = class {
|
|
|
129837
130640
|
executeIsolated: (preparedCall) => executeOwned(
|
|
129838
130641
|
preparedCall,
|
|
129839
130642
|
(preparedArtifact, forwardedCall) => this.withPreparedRunner(
|
|
130643
|
+
preparedArtifact.preparedRunnerTier,
|
|
129840
130644
|
(runner) => runner.executePreparedCode(preparedArtifact, forwardedCall)
|
|
129841
130645
|
)
|
|
129842
130646
|
),
|
|
129843
130647
|
executeBatchIsolated: (preparedCall) => executeOwned(
|
|
129844
130648
|
preparedCall,
|
|
129845
130649
|
(preparedArtifact, forwardedCall) => this.withFreshPreparedRunners(
|
|
130650
|
+
preparedArtifact.preparedRunnerTier,
|
|
129846
130651
|
forwardedCall.inputBatch,
|
|
129847
130652
|
(runner, inputs) => runner.executePreparedCode(preparedArtifact, {
|
|
129848
130653
|
inputs,
|
|
@@ -129919,8 +130724,8 @@ function createCSharpBrowserRuntimeProvider(options = {}) {
|
|
|
129919
130724
|
const firefoxPreparedIdleTimeoutMs = isFirefoxBrowser() ? FIREFOX_PREPARED_WORKER_IDLE_TIMEOUT_MS : void 0;
|
|
129920
130725
|
const compilerIdleTimeoutMs = options.compilerIdleTimeoutMs ?? firefoxPreparedIdleTimeoutMs;
|
|
129921
130726
|
const runnerIdleTimeoutMs = options.runnerIdleTimeoutMs ?? options.workerIdleTimeoutMs ?? firefoxPreparedIdleTimeoutMs;
|
|
129922
|
-
const dependencyUrls = (
|
|
129923
|
-
const descriptors = context2.manifestAssetCollection("csharp",
|
|
130727
|
+
const dependencyUrls = (collection2) => {
|
|
130728
|
+
const descriptors = context2.manifestAssetCollection("csharp", collection2);
|
|
129924
130729
|
return descriptors ? Object.fromEntries(
|
|
129925
130730
|
Object.entries(descriptors).map(([name, descriptor3]) => [
|
|
129926
130731
|
name,
|
|
@@ -130082,7 +130887,6 @@ function createCSharpBrowserRuntimeProvider(options = {}) {
|
|
|
130082
130887
|
standbyWarmup = warmup;
|
|
130083
130888
|
return warmup;
|
|
130084
130889
|
};
|
|
130085
|
-
void ensureStandbyRunner().catch(() => void 0);
|
|
130086
130890
|
const preparedAuthority = preparedAuthorityEnabled ? {
|
|
130087
130891
|
compiler,
|
|
130088
130892
|
batchConcurrency: preparedBatchConcurrency,
|
|
@@ -130097,7 +130901,7 @@ function createCSharpBrowserRuntimeProvider(options = {}) {
|
|
|
130097
130901
|
loadTimeMs: performance.now() - startedAt
|
|
130098
130902
|
};
|
|
130099
130903
|
},
|
|
130100
|
-
createRunner() {
|
|
130904
|
+
createRunner(_tier) {
|
|
130101
130905
|
if (disposed) {
|
|
130102
130906
|
throw new Error("C# browser runtime provider has been disposed.");
|
|
130103
130907
|
}
|
|
@@ -137687,15 +138491,15 @@ function evaluateExpression(expression, context2, scope2) {
|
|
|
137687
138491
|
}
|
|
137688
138492
|
case "every":
|
|
137689
138493
|
case "some": {
|
|
137690
|
-
const
|
|
137691
|
-
if (!Array.isArray(
|
|
138494
|
+
const collection2 = resolveValue(expression.collection, context2, scope2);
|
|
138495
|
+
if (!Array.isArray(collection2)) {
|
|
137692
138496
|
return Object.freeze({
|
|
137693
138497
|
expression,
|
|
137694
138498
|
result: "unknown",
|
|
137695
138499
|
reason: "The quantified collection is missing or is not an array."
|
|
137696
138500
|
});
|
|
137697
138501
|
}
|
|
137698
|
-
const children2 =
|
|
138502
|
+
const children2 = collection2.map(
|
|
137699
138503
|
(item) => evaluateExpression(
|
|
137700
138504
|
expression.condition,
|
|
137701
138505
|
context2,
|
|
@@ -141127,22 +141931,13 @@ async function createBrowserProjectWorkspace(options = {}) {
|
|
|
141127
141931
|
} : {}
|
|
141128
141932
|
};
|
|
141129
141933
|
const cppCompilerWorkerFactory = executionHost && isExecutionHosted("cpp") ? executionHost.workerFactory : void 0;
|
|
141130
|
-
const cppRuntimeAssetPreflight = () => runtimeAssetPreflight.preflight("cpp", [
|
|
141131
|
-
"runtimeHeader",
|
|
141132
|
-
"compilerWasm",
|
|
141133
|
-
"linkerWasm",
|
|
141134
|
-
"sysroot"
|
|
141135
|
-
]);
|
|
141136
141934
|
const traceccCompilerService = cppProvider && !injectedCppProvider ? cppProvider[2].createTraceCCBrowserCompilerService({}, {
|
|
141137
141935
|
assets,
|
|
141138
|
-
...cppCompilerWorkerFactory ? { workerFactory: cppCompilerWorkerFactory } : {}
|
|
141139
|
-
preflight: (assetNames) => runtimeAssetPreflight.preflight("cpp", assetNames)
|
|
141936
|
+
...cppCompilerWorkerFactory ? { workerFactory: cppCompilerWorkerFactory } : {}
|
|
141140
141937
|
}) : void 0;
|
|
141141
141938
|
const cppWorkerOptions = {
|
|
141142
141939
|
workerUrl: assets.cppWorker,
|
|
141143
141940
|
...cppCompilerWorkerFactory ? { workerFactory: cppCompilerWorkerFactory } : {},
|
|
141144
|
-
assetPreflight: () => runtimeAssetPreflight.preflight("cpp", ["worker"]),
|
|
141145
|
-
runtimeAssetPreflight: cppRuntimeAssetPreflight,
|
|
141146
141941
|
compilerWasmUrl: assets.cppCompilerWasm,
|
|
141147
141942
|
linkerWasmUrl: assets.cppLinkerWasm,
|
|
141148
141943
|
sysrootUrl: assets.cppSysroot,
|
|
@@ -142557,6 +143352,7 @@ function createBrowserJudgeHostFromRuntimeHost(host, options = {}) {
|
|
|
142557
143352
|
isLanguageSupported: host.isLanguageSupported.bind(host),
|
|
142558
143353
|
preflightLanguage: host.preflightLanguage.bind(host),
|
|
142559
143354
|
preflight: host.preflight.bind(host),
|
|
143355
|
+
prewarmLanguage: host.prewarmLanguage.bind(host),
|
|
142560
143356
|
warmLanguage: host.warmLanguage.bind(host),
|
|
142561
143357
|
disposeLanguage: host.disposeLanguage.bind(host),
|
|
142562
143358
|
createJudge: (judgeOptions) => createBrowserRuntimeJudge({
|