@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.d.cts
CHANGED
|
@@ -873,6 +873,8 @@ interface BrowserJudgePythonOptions {
|
|
|
873
873
|
interface BrowserJudgeJavaOptions {
|
|
874
874
|
readonly workerIdleTimeoutMs?: number;
|
|
875
875
|
readonly compileCacheLimit?: number;
|
|
876
|
+
/** Same-origin trusted Java compiler endpoint. */
|
|
877
|
+
readonly externalCompilerUrl?: string;
|
|
876
878
|
/** Immutable TraceJVM asset tree used by the Java worker. */
|
|
877
879
|
readonly runtimeAssetBaseUrl?: string;
|
|
878
880
|
}
|
|
@@ -945,6 +947,10 @@ interface BrowserJudgeHost {
|
|
|
945
947
|
isLanguageSupported(language: Language): boolean;
|
|
946
948
|
preflightLanguage(language: Language): Promise<BrowserRuntimeReadiness>;
|
|
947
949
|
preflight(): Promise<BrowserRuntimeEnvironmentReport>;
|
|
950
|
+
prewarmLanguage(language: Language): Promise<{
|
|
951
|
+
success: boolean;
|
|
952
|
+
loadTimeMs: number;
|
|
953
|
+
}>;
|
|
948
954
|
warmLanguage(language: Language): Promise<{
|
|
949
955
|
success: boolean;
|
|
950
956
|
loadTimeMs: number;
|
package/dist/judge.d.ts
CHANGED
|
@@ -873,6 +873,8 @@ interface BrowserJudgePythonOptions {
|
|
|
873
873
|
interface BrowserJudgeJavaOptions {
|
|
874
874
|
readonly workerIdleTimeoutMs?: number;
|
|
875
875
|
readonly compileCacheLimit?: number;
|
|
876
|
+
/** Same-origin trusted Java compiler endpoint. */
|
|
877
|
+
readonly externalCompilerUrl?: string;
|
|
876
878
|
/** Immutable TraceJVM asset tree used by the Java worker. */
|
|
877
879
|
readonly runtimeAssetBaseUrl?: string;
|
|
878
880
|
}
|
|
@@ -945,6 +947,10 @@ interface BrowserJudgeHost {
|
|
|
945
947
|
isLanguageSupported(language: Language): boolean;
|
|
946
948
|
preflightLanguage(language: Language): Promise<BrowserRuntimeReadiness>;
|
|
947
949
|
preflight(): Promise<BrowserRuntimeEnvironmentReport>;
|
|
950
|
+
prewarmLanguage(language: Language): Promise<{
|
|
951
|
+
success: boolean;
|
|
952
|
+
loadTimeMs: number;
|
|
953
|
+
}>;
|
|
948
954
|
warmLanguage(language: Language): Promise<{
|
|
949
955
|
success: boolean;
|
|
950
956
|
loadTimeMs: number;
|
package/dist/judge.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var define = undefined;
|
|
2
2
|
import {
|
|
3
3
|
createCppBrowserRuntimeProvider
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-J2KGF5PU.js";
|
|
5
|
+
import "./chunk-46XZQOHV.js";
|
|
6
6
|
import {
|
|
7
7
|
normalizeTraceJVMRuntimeAssetBaseUrl,
|
|
8
8
|
preflightBuiltInTraceJVMRuntimeAssets,
|
|
@@ -10,20 +10,20 @@ import {
|
|
|
10
10
|
} from "./chunk-FYDQ4ZKL.js";
|
|
11
11
|
import {
|
|
12
12
|
CSharpWorkerClient
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-4PN5YD6J.js";
|
|
14
14
|
import {
|
|
15
15
|
PYTHON_RUNTIME_IMAGE_PROTOCOL_VERSION,
|
|
16
16
|
createBrowserProjectWorkspace,
|
|
17
17
|
createBrowserRuntimeAssetPreflight,
|
|
18
18
|
createBrowserRuntimeEnvironment,
|
|
19
19
|
makeTraceKernelHost
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-B2EM2SZ2.js";
|
|
21
21
|
import {
|
|
22
22
|
resolveBuiltInTraceCCRuntimeManifest
|
|
23
23
|
} from "./chunk-EJE2EJDI.js";
|
|
24
24
|
import {
|
|
25
25
|
PythonWorkerClient
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-EPBHRROK.js";
|
|
27
27
|
import {
|
|
28
28
|
RUNTIME_TRACE_SCHEMA_VERSION,
|
|
29
29
|
createEmptyRuntimeTrace,
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
liftCodeOutcome,
|
|
33
33
|
liftTraceOutcome,
|
|
34
34
|
runtimeWorkspaceActorPreset
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-GXTDL2ML.js";
|
|
36
36
|
import {
|
|
37
37
|
TraceKernelControlledRuntime,
|
|
38
38
|
TraceKernelSharedSyscallServer,
|
|
@@ -55,6 +55,8 @@ import {
|
|
|
55
55
|
batchCodeResultToExecuteResult,
|
|
56
56
|
closeKernelHttpSyncServers,
|
|
57
57
|
createBrowserExecutionWorkerHost,
|
|
58
|
+
createPromotableBrowserBackgroundTask,
|
|
59
|
+
createWorkerProtocolToken,
|
|
58
60
|
executeRuntimeRequest,
|
|
59
61
|
getLanguageRuntimeProfile,
|
|
60
62
|
handleHostArtifactCacheRequest,
|
|
@@ -67,7 +69,7 @@ import {
|
|
|
67
69
|
logRuntimeDiagnostic,
|
|
68
70
|
restoreTransferredTraceEvents,
|
|
69
71
|
traceEventTransferRequest
|
|
70
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-5KH5ABPQ.js";
|
|
71
73
|
import {
|
|
72
74
|
TaggedError,
|
|
73
75
|
_void,
|
|
@@ -795,6 +797,8 @@ var BrowserRuntimeHostImplementation = class {
|
|
|
795
797
|
environment;
|
|
796
798
|
supportedLanguages;
|
|
797
799
|
#preparedProviders = /* @__PURE__ */ new Map();
|
|
800
|
+
#providerInitializers = /* @__PURE__ */ new Map();
|
|
801
|
+
#warmEntries = /* @__PURE__ */ new Map();
|
|
798
802
|
#leases = [];
|
|
799
803
|
#leaseByLanguage = /* @__PURE__ */ new Map();
|
|
800
804
|
#readinessByLanguage = /* @__PURE__ */ new Map();
|
|
@@ -836,16 +840,25 @@ var BrowserRuntimeHostImplementation = class {
|
|
|
836
840
|
language,
|
|
837
841
|
preparedProvider
|
|
838
842
|
);
|
|
843
|
+
const safeProvider = safePreparedProvider(
|
|
844
|
+
language,
|
|
845
|
+
preparedProvider,
|
|
846
|
+
() => this.#assertActive(),
|
|
847
|
+
() => this.#ensureLanguageReady(language)
|
|
848
|
+
);
|
|
849
|
+
this.#providerInitializers.set(
|
|
850
|
+
language,
|
|
851
|
+
() => safeProvider.init()
|
|
852
|
+
);
|
|
839
853
|
this.#preparedProviders.set(
|
|
840
854
|
language,
|
|
841
|
-
withPreparedProgramReuse(
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
)
|
|
855
|
+
withPreparedProgramReuse({
|
|
856
|
+
init: () => this.#promoteLanguageWarm(language),
|
|
857
|
+
prepareProgram: async (call) => {
|
|
858
|
+
await this.#promoteLanguageWarm(language);
|
|
859
|
+
return safeProvider.prepareProgram(call);
|
|
860
|
+
}
|
|
861
|
+
})
|
|
849
862
|
);
|
|
850
863
|
this.#leaseByLanguage.set(language, lease);
|
|
851
864
|
}
|
|
@@ -892,6 +905,41 @@ var BrowserRuntimeHostImplementation = class {
|
|
|
892
905
|
throw new Error("Browser runtime host has been disposed.");
|
|
893
906
|
}
|
|
894
907
|
}
|
|
908
|
+
#warmEntry(language) {
|
|
909
|
+
const existing = this.#warmEntries.get(language);
|
|
910
|
+
if (existing) return existing;
|
|
911
|
+
const initialize = this.#providerInitializers.get(language);
|
|
912
|
+
if (!initialize) {
|
|
913
|
+
throw new Error(
|
|
914
|
+
`Prepared runtime for language "${language}" is not registered.`
|
|
915
|
+
);
|
|
916
|
+
}
|
|
917
|
+
let warmResult;
|
|
918
|
+
const task = createPromotableBrowserBackgroundTask(async () => {
|
|
919
|
+
warmResult = await initialize();
|
|
920
|
+
});
|
|
921
|
+
const result = task.wait().then(() => {
|
|
922
|
+
if (!warmResult) {
|
|
923
|
+
throw new Error(
|
|
924
|
+
`Browser runtime for ${JSON.stringify(language)} completed warmup without a result.`
|
|
925
|
+
);
|
|
926
|
+
}
|
|
927
|
+
return warmResult;
|
|
928
|
+
});
|
|
929
|
+
const entry = { task, result };
|
|
930
|
+
this.#warmEntries.set(language, entry);
|
|
931
|
+
void result.catch(() => {
|
|
932
|
+
if (this.#warmEntries.get(language) === entry) {
|
|
933
|
+
this.#warmEntries.delete(language);
|
|
934
|
+
}
|
|
935
|
+
});
|
|
936
|
+
return entry;
|
|
937
|
+
}
|
|
938
|
+
async #promoteLanguageWarm(language) {
|
|
939
|
+
const entry = this.#warmEntry(language);
|
|
940
|
+
await entry.task.promote();
|
|
941
|
+
return entry.result;
|
|
942
|
+
}
|
|
895
943
|
isLanguageSupported(language) {
|
|
896
944
|
return this.supportedLanguages.includes(language);
|
|
897
945
|
}
|
|
@@ -959,6 +1007,17 @@ var BrowserRuntimeHostImplementation = class {
|
|
|
959
1007
|
runtimes: Object.freeze(runtimes)
|
|
960
1008
|
});
|
|
961
1009
|
}
|
|
1010
|
+
prewarmLanguage(language) {
|
|
1011
|
+
this.#assertActive();
|
|
1012
|
+
if (!this.supportedLanguages.includes(language)) {
|
|
1013
|
+
return Promise.reject(
|
|
1014
|
+
new Error(
|
|
1015
|
+
`Runtime for language "${language}" is not selected in this browser environment.`
|
|
1016
|
+
)
|
|
1017
|
+
);
|
|
1018
|
+
}
|
|
1019
|
+
return this.#warmEntry(language).result;
|
|
1020
|
+
}
|
|
962
1021
|
warmLanguage(language) {
|
|
963
1022
|
this.#assertActive();
|
|
964
1023
|
if (!this.supportedLanguages.includes(language)) {
|
|
@@ -968,16 +1027,20 @@ var BrowserRuntimeHostImplementation = class {
|
|
|
968
1027
|
)
|
|
969
1028
|
);
|
|
970
1029
|
}
|
|
971
|
-
return this.#
|
|
1030
|
+
return this.#promoteLanguageWarm(language);
|
|
972
1031
|
}
|
|
973
1032
|
disposeLanguage(language) {
|
|
974
1033
|
if (this.#disposed || !this.supportedLanguages.includes(language)) return;
|
|
1034
|
+
this.#warmEntries.get(language)?.task.cancel();
|
|
1035
|
+
this.#warmEntries.delete(language);
|
|
975
1036
|
this.#preparedProviders.get(language)?.flushPreparedProgramCache();
|
|
976
1037
|
this.#leaseByLanguage.get(language)?.disposeLanguage(language);
|
|
977
1038
|
}
|
|
978
1039
|
dispose() {
|
|
979
1040
|
if (this.#disposed) return;
|
|
980
1041
|
this.#disposed = true;
|
|
1042
|
+
for (const entry of this.#warmEntries.values()) entry.task.cancel();
|
|
1043
|
+
this.#warmEntries.clear();
|
|
981
1044
|
this.#readinessByLanguage.clear();
|
|
982
1045
|
for (const provider of this.#preparedProviders.values()) {
|
|
983
1046
|
provider.flushPreparedProgramCache();
|
|
@@ -1844,8 +1907,114 @@ function createPythonRuntimeImageFactory(options) {
|
|
|
1844
1907
|
let disposed = false;
|
|
1845
1908
|
let imagePromise = null;
|
|
1846
1909
|
let activeBuildController = null;
|
|
1910
|
+
let activeBootstrapWorker = null;
|
|
1911
|
+
let activeBootstrapCancellation = null;
|
|
1912
|
+
const buildInWorker = () => new Promise((resolve, reject) => {
|
|
1913
|
+
if (!options.workerUrl) {
|
|
1914
|
+
reject(new Error("Python runtime-image bootstrap requires a worker URL."));
|
|
1915
|
+
return;
|
|
1916
|
+
}
|
|
1917
|
+
const workerFormat = options.workerFormat ?? "classic";
|
|
1918
|
+
let workerUrl = appendWorkerUrlQueryParameter(
|
|
1919
|
+
options.workerUrl,
|
|
1920
|
+
"tracecodePythonRole",
|
|
1921
|
+
"runtime-image"
|
|
1922
|
+
);
|
|
1923
|
+
if (workerFormat === "module") {
|
|
1924
|
+
workerUrl = appendWorkerUrlQueryParameter(
|
|
1925
|
+
workerUrl,
|
|
1926
|
+
"tracecodePythonWorkerFormat",
|
|
1927
|
+
"module"
|
|
1928
|
+
);
|
|
1929
|
+
}
|
|
1930
|
+
const worker = options.workerFactory ? options.workerFactory(
|
|
1931
|
+
workerUrl,
|
|
1932
|
+
workerFormat === "module" ? { type: "module" } : void 0
|
|
1933
|
+
) : new Worker(
|
|
1934
|
+
workerUrl,
|
|
1935
|
+
workerFormat === "module" ? { type: "module" } : void 0
|
|
1936
|
+
);
|
|
1937
|
+
activeBootstrapWorker = worker;
|
|
1938
|
+
const id = "python-runtime-image";
|
|
1939
|
+
const protocolToken = createWorkerProtocolToken();
|
|
1940
|
+
let requested = false;
|
|
1941
|
+
let settled = false;
|
|
1942
|
+
const finish = (operation) => {
|
|
1943
|
+
if (settled) return;
|
|
1944
|
+
settled = true;
|
|
1945
|
+
globalThis.clearTimeout(timeoutId);
|
|
1946
|
+
worker.terminate();
|
|
1947
|
+
if (activeBootstrapWorker === worker) activeBootstrapWorker = null;
|
|
1948
|
+
activeBootstrapCancellation = null;
|
|
1949
|
+
operation();
|
|
1950
|
+
};
|
|
1951
|
+
const timeoutId = globalThis.setTimeout(() => {
|
|
1952
|
+
finish(() => reject(
|
|
1953
|
+
new Error(
|
|
1954
|
+
`Python runtime image acquisition timed out after ${timeoutMs}ms.`
|
|
1955
|
+
)
|
|
1956
|
+
));
|
|
1957
|
+
}, timeoutMs);
|
|
1958
|
+
activeBootstrapCancellation = () => {
|
|
1959
|
+
finish(() => reject(
|
|
1960
|
+
new Error("Python runtime image factory was disposed while loading.")
|
|
1961
|
+
));
|
|
1962
|
+
};
|
|
1963
|
+
worker.onerror = (event) => {
|
|
1964
|
+
finish(() => reject(
|
|
1965
|
+
new Error(
|
|
1966
|
+
event.message || "Python runtime-image bootstrap Worker crashed."
|
|
1967
|
+
)
|
|
1968
|
+
));
|
|
1969
|
+
};
|
|
1970
|
+
worker.onmessage = (event) => {
|
|
1971
|
+
const message = event.data;
|
|
1972
|
+
if (message?.type === "worker-ready" && !requested) {
|
|
1973
|
+
requested = true;
|
|
1974
|
+
worker.postMessage({
|
|
1975
|
+
id,
|
|
1976
|
+
type: "build-runtime-image",
|
|
1977
|
+
protocolToken,
|
|
1978
|
+
payload: {
|
|
1979
|
+
source: "tracecode-python-runtime-image-v1",
|
|
1980
|
+
descriptor: options.descriptor
|
|
1981
|
+
}
|
|
1982
|
+
});
|
|
1983
|
+
return;
|
|
1984
|
+
}
|
|
1985
|
+
if (message?.id !== id || message.protocolToken !== protocolToken) {
|
|
1986
|
+
return;
|
|
1987
|
+
}
|
|
1988
|
+
if (message.type === "error") {
|
|
1989
|
+
finish(() => reject(
|
|
1990
|
+
new Error(
|
|
1991
|
+
message.payload?.error || "Python runtime-image bootstrap failed."
|
|
1992
|
+
)
|
|
1993
|
+
));
|
|
1994
|
+
return;
|
|
1995
|
+
}
|
|
1996
|
+
if (message.type !== "runtime-image-result") return;
|
|
1997
|
+
const image = message.payload?.runtimeImage;
|
|
1998
|
+
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) {
|
|
1999
|
+
finish(() => reject(
|
|
2000
|
+
new Error("Python runtime-image bootstrap returned an invalid image.")
|
|
2001
|
+
));
|
|
2002
|
+
return;
|
|
2003
|
+
}
|
|
2004
|
+
finish(() => resolve(Object.freeze(image)));
|
|
2005
|
+
};
|
|
2006
|
+
});
|
|
1847
2007
|
const build = async () => {
|
|
1848
2008
|
if (disposed) throw new Error("Python runtime image factory is disposed.");
|
|
2009
|
+
if (options.workerUrl) {
|
|
2010
|
+
const image = await buildInWorker();
|
|
2011
|
+
if (disposed) {
|
|
2012
|
+
throw new Error(
|
|
2013
|
+
"Python runtime image factory was disposed while loading."
|
|
2014
|
+
);
|
|
2015
|
+
}
|
|
2016
|
+
return image;
|
|
2017
|
+
}
|
|
1849
2018
|
const controller = new AbortController();
|
|
1850
2019
|
activeBuildController = controller;
|
|
1851
2020
|
let timeoutId;
|
|
@@ -1963,6 +2132,10 @@ function createPythonRuntimeImageFactory(options) {
|
|
|
1963
2132
|
disposed = true;
|
|
1964
2133
|
activeBuildController?.abort();
|
|
1965
2134
|
activeBuildController = null;
|
|
2135
|
+
activeBootstrapCancellation?.();
|
|
2136
|
+
activeBootstrapCancellation = null;
|
|
2137
|
+
activeBootstrapWorker?.terminate();
|
|
2138
|
+
activeBootstrapWorker = null;
|
|
1966
2139
|
imagePromise = null;
|
|
1967
2140
|
}
|
|
1968
2141
|
});
|
|
@@ -2089,9 +2262,15 @@ function createPythonBrowserRuntimeProvider(options = {}) {
|
|
|
2089
2262
|
);
|
|
2090
2263
|
}
|
|
2091
2264
|
const createRuntimeImageFactory = () => createPythonRuntimeImageFactory({
|
|
2092
|
-
descriptor: runtimeImageDescriptor
|
|
2265
|
+
descriptor: runtimeImageDescriptor,
|
|
2266
|
+
workerUrl: context.assets.pythonWorker,
|
|
2267
|
+
...workerFactory ? { workerFactory } : {},
|
|
2268
|
+
...pythonManifest?.workerFormat ? { workerFormat: pythonManifest.workerFormat } : {}
|
|
2093
2269
|
});
|
|
2094
2270
|
let runtimeImageFactory = createRuntimeImageFactory();
|
|
2271
|
+
const runtimeImageWorkerPreflight = context.preflight("python", [
|
|
2272
|
+
"worker"
|
|
2273
|
+
]);
|
|
2095
2274
|
const workerOptions = () => ({
|
|
2096
2275
|
workerUrl: context.assets.pythonWorker,
|
|
2097
2276
|
...workerFactory ? { workerFactory } : {},
|
|
@@ -2132,6 +2311,7 @@ function createPythonBrowserRuntimeProvider(options = {}) {
|
|
|
2132
2311
|
const lease = {
|
|
2133
2312
|
preparedProviders,
|
|
2134
2313
|
preflightLanguage: async () => {
|
|
2314
|
+
await runtimeImageWorkerPreflight();
|
|
2135
2315
|
await runtimeImageFactory.acquire();
|
|
2136
2316
|
},
|
|
2137
2317
|
disposeLanguage: () => {
|
|
@@ -4414,6 +4594,7 @@ function createJavaBrowserRuntimeProvider(options = {}) {
|
|
|
4414
4594
|
debug: context.debug,
|
|
4415
4595
|
workerIdleTimeoutMs: options.workerIdleTimeoutMs,
|
|
4416
4596
|
compileCacheLimit: options.compileCacheLimit,
|
|
4597
|
+
externalCompilerUrl: options.externalCompilerUrl,
|
|
4417
4598
|
assetPreflight: context.preflight("java", ["worker"])
|
|
4418
4599
|
};
|
|
4419
4600
|
const preparedProvider = createJavaBrowserPreparedExecutionProvider(workerOptions);
|
|
@@ -4437,9 +4618,9 @@ var CSharpRuntimeClient = class {
|
|
|
4437
4618
|
get preparedCompiler() {
|
|
4438
4619
|
return this.preparedAuthority?.compiler ?? this.workerClient;
|
|
4439
4620
|
}
|
|
4440
|
-
async withPreparedRunner(execute) {
|
|
4621
|
+
async withPreparedRunner(tier, execute) {
|
|
4441
4622
|
if (!this.preparedAuthority) return execute(this.workerClient);
|
|
4442
|
-
const runner = this.preparedAuthority.createRunner();
|
|
4623
|
+
const runner = this.preparedAuthority.createRunner(tier);
|
|
4443
4624
|
try {
|
|
4444
4625
|
return await execute(runner);
|
|
4445
4626
|
} finally {
|
|
@@ -4447,7 +4628,7 @@ var CSharpRuntimeClient = class {
|
|
|
4447
4628
|
this.preparedAuthority.releaseRunner(runner);
|
|
4448
4629
|
}
|
|
4449
4630
|
}
|
|
4450
|
-
async withFreshPreparedRunners(inputBatch, execute, signal) {
|
|
4631
|
+
async withFreshPreparedRunners(tier, inputBatch, execute, signal) {
|
|
4451
4632
|
const concurrency = Math.min(
|
|
4452
4633
|
inputBatch.length,
|
|
4453
4634
|
this.preparedAuthority?.batchConcurrency ?? 1
|
|
@@ -4469,6 +4650,7 @@ var CSharpRuntimeClient = class {
|
|
|
4469
4650
|
const inputs = inputBatch[index];
|
|
4470
4651
|
try {
|
|
4471
4652
|
results[index] = await this.withPreparedRunner(
|
|
4653
|
+
tier,
|
|
4472
4654
|
(runner) => execute(runner, inputs, index)
|
|
4473
4655
|
);
|
|
4474
4656
|
} catch (reason) {
|
|
@@ -4572,6 +4754,17 @@ var CSharpRuntimeClient = class {
|
|
|
4572
4754
|
timings: result.timings
|
|
4573
4755
|
};
|
|
4574
4756
|
}
|
|
4757
|
+
const preparedRunnerTier = result.preparedRunnerTier;
|
|
4758
|
+
const preparedRunnerReason = result.preparedRunnerReason;
|
|
4759
|
+
if (preparedRunnerTier !== "algorithm-fast" && preparedRunnerTier !== "compatibility" || typeof preparedRunnerReason !== "string" || !preparedRunnerReason || preparedRunnerTier === "algorithm-fast" && !result.traceClrWireContract) {
|
|
4760
|
+
return {
|
|
4761
|
+
kind: "failed",
|
|
4762
|
+
error: "C# preparation completed without a valid runner-tier descriptor.",
|
|
4763
|
+
diagnosticStage: "compile",
|
|
4764
|
+
consoleOutput: result.consoleOutput ?? [],
|
|
4765
|
+
timings: result.timings
|
|
4766
|
+
};
|
|
4767
|
+
}
|
|
4575
4768
|
let artifact = Object.freeze({
|
|
4576
4769
|
mode: call.mode,
|
|
4577
4770
|
code: call.code,
|
|
@@ -4580,7 +4773,24 @@ var CSharpRuntimeClient = class {
|
|
|
4580
4773
|
...call.traceOptions ? { traceOptions: Object.freeze({ ...call.traceOptions }) } : {},
|
|
4581
4774
|
compiledArtifactKey: result.compiledArtifactKey,
|
|
4582
4775
|
compiledArtifactBase64: result.compiledArtifactBase64,
|
|
4583
|
-
compiledArtifactSha256: result.compiledArtifactSha256
|
|
4776
|
+
compiledArtifactSha256: result.compiledArtifactSha256,
|
|
4777
|
+
preparedRunnerTier,
|
|
4778
|
+
preparedRunnerReason,
|
|
4779
|
+
...result.traceClrWireContract ? {
|
|
4780
|
+
traceClrWireContract: Object.freeze({
|
|
4781
|
+
parameters: Object.freeze(
|
|
4782
|
+
result.traceClrWireContract.parameters.map(
|
|
4783
|
+
(parameter) => Object.freeze({
|
|
4784
|
+
name: parameter.name,
|
|
4785
|
+
type: Object.freeze({ ...parameter.type })
|
|
4786
|
+
})
|
|
4787
|
+
)
|
|
4788
|
+
),
|
|
4789
|
+
returnType: Object.freeze({
|
|
4790
|
+
...result.traceClrWireContract.returnType
|
|
4791
|
+
})
|
|
4792
|
+
})
|
|
4793
|
+
} : {}
|
|
4584
4794
|
});
|
|
4585
4795
|
let disposed = false;
|
|
4586
4796
|
let disposePromise;
|
|
@@ -4650,6 +4860,7 @@ var CSharpRuntimeClient = class {
|
|
|
4650
4860
|
executeIsolated: (preparedCall) => executeOwned(
|
|
4651
4861
|
preparedCall,
|
|
4652
4862
|
(preparedArtifact, forwardedCall) => this.withPreparedRunner(
|
|
4863
|
+
preparedArtifact.preparedRunnerTier,
|
|
4653
4864
|
(runner) => runner.executePreparedTrace(
|
|
4654
4865
|
preparedArtifact,
|
|
4655
4866
|
forwardedCall
|
|
@@ -4667,6 +4878,7 @@ var CSharpRuntimeClient = class {
|
|
|
4667
4878
|
return executeOwned(
|
|
4668
4879
|
preparedCall,
|
|
4669
4880
|
(preparedArtifact, forwardedCall) => this.withFreshPreparedRunners(
|
|
4881
|
+
preparedArtifact.preparedRunnerTier,
|
|
4670
4882
|
forwardedCall.inputBatch,
|
|
4671
4883
|
(runner, inputs, index) => runner.executePreparedTrace(
|
|
4672
4884
|
preparedArtifact,
|
|
@@ -4690,12 +4902,14 @@ var CSharpRuntimeClient = class {
|
|
|
4690
4902
|
executeIsolated: (preparedCall) => executeOwned(
|
|
4691
4903
|
preparedCall,
|
|
4692
4904
|
(preparedArtifact, forwardedCall) => this.withPreparedRunner(
|
|
4905
|
+
preparedArtifact.preparedRunnerTier,
|
|
4693
4906
|
(runner) => runner.executePreparedCode(preparedArtifact, forwardedCall)
|
|
4694
4907
|
)
|
|
4695
4908
|
),
|
|
4696
4909
|
executeBatchIsolated: (preparedCall) => executeOwned(
|
|
4697
4910
|
preparedCall,
|
|
4698
4911
|
(preparedArtifact, forwardedCall) => this.withFreshPreparedRunners(
|
|
4912
|
+
preparedArtifact.preparedRunnerTier,
|
|
4699
4913
|
forwardedCall.inputBatch,
|
|
4700
4914
|
(runner, inputs) => runner.executePreparedCode(preparedArtifact, {
|
|
4701
4915
|
inputs,
|
|
@@ -4934,7 +5148,6 @@ function createCSharpBrowserRuntimeProvider(options = {}) {
|
|
|
4934
5148
|
standbyWarmup = warmup;
|
|
4935
5149
|
return warmup;
|
|
4936
5150
|
};
|
|
4937
|
-
void ensureStandbyRunner().catch(() => void 0);
|
|
4938
5151
|
const preparedAuthority = preparedAuthorityEnabled ? {
|
|
4939
5152
|
compiler,
|
|
4940
5153
|
batchConcurrency: preparedBatchConcurrency,
|
|
@@ -4949,7 +5162,7 @@ function createCSharpBrowserRuntimeProvider(options = {}) {
|
|
|
4949
5162
|
loadTimeMs: performance.now() - startedAt
|
|
4950
5163
|
};
|
|
4951
5164
|
},
|
|
4952
|
-
createRunner() {
|
|
5165
|
+
createRunner(_tier) {
|
|
4953
5166
|
if (disposed) {
|
|
4954
5167
|
throw new Error("C# browser runtime provider has been disposed.");
|
|
4955
5168
|
}
|
|
@@ -9644,6 +9857,7 @@ function createBrowserJudgeHostFromRuntimeHost(host, options = {}) {
|
|
|
9644
9857
|
isLanguageSupported: host.isLanguageSupported.bind(host),
|
|
9645
9858
|
preflightLanguage: host.preflightLanguage.bind(host),
|
|
9646
9859
|
preflight: host.preflight.bind(host),
|
|
9860
|
+
prewarmLanguage: host.prewarmLanguage.bind(host),
|
|
9647
9861
|
warmLanguage: host.warmLanguage.bind(host),
|
|
9648
9862
|
disposeLanguage: host.disposeLanguage.bind(host),
|
|
9649
9863
|
createJudge: (judgeOptions) => createBrowserRuntimeJudge({
|
|
@@ -2,7 +2,7 @@ var define = undefined;
|
|
|
2
2
|
import {
|
|
3
3
|
runRuntimeProjectWorkerBridge,
|
|
4
4
|
withRuntimeProjectCommandRunnerCapabilities
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GXTDL2ML.js";
|
|
6
6
|
import "./chunk-756Z7C6D.js";
|
|
7
7
|
|
|
8
8
|
// packages/runtime-cpp/src/project-browser.ts
|
|
@@ -32,4 +32,4 @@ function createBrowserCppProjectRunner(workerClient, options = {}) {
|
|
|
32
32
|
export {
|
|
33
33
|
createBrowserCppProjectRunner
|
|
34
34
|
};
|
|
35
|
-
//# sourceMappingURL=project-browser-
|
|
35
|
+
//# sourceMappingURL=project-browser-HFNQEALT.js.map
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
runtimeKernelWriteFsErrorMessage,
|
|
54
54
|
runtimeKernelWriteTarget,
|
|
55
55
|
runtimeProjectInfrastructureFailure
|
|
56
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-GXTDL2ML.js";
|
|
57
57
|
import {
|
|
58
58
|
decodeTraceKernelWatchEvent
|
|
59
59
|
} from "./chunk-LTRAP6OY.js";
|
|
@@ -10865,4 +10865,4 @@ export {
|
|
|
10865
10865
|
createBrowserTypeScriptProjectRunner,
|
|
10866
10866
|
runBrowserJavaScriptProjectRequest
|
|
10867
10867
|
};
|
|
10868
|
-
//# sourceMappingURL=project-browser-
|
|
10868
|
+
//# sourceMappingURL=project-browser-L3A2G2MA.js.map
|
|
@@ -2,7 +2,7 @@ var define = undefined;
|
|
|
2
2
|
import {
|
|
3
3
|
runRuntimeProjectWorkerBridge,
|
|
4
4
|
withRuntimeProjectCommandRunnerCapabilities
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GXTDL2ML.js";
|
|
6
6
|
import "./chunk-756Z7C6D.js";
|
|
7
7
|
|
|
8
8
|
// packages/runtime-python/src/project-browser.ts
|
|
@@ -35,4 +35,4 @@ function createBrowserPythonProjectRunner(workerClient, options = {}) {
|
|
|
35
35
|
export {
|
|
36
36
|
createBrowserPythonProjectRunner
|
|
37
37
|
};
|
|
38
|
-
//# sourceMappingURL=project-browser-
|
|
38
|
+
//# sourceMappingURL=project-browser-OVE7V464.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
createRuntimeProjectIoBridge,
|
|
4
4
|
runRuntimeProjectWorkerBridge,
|
|
5
5
|
withRuntimeProjectCommandRunnerCapabilities
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GXTDL2ML.js";
|
|
7
7
|
import "./chunk-756Z7C6D.js";
|
|
8
8
|
|
|
9
9
|
// packages/runtime-java/src/project-browser.ts
|
|
@@ -77,4 +77,4 @@ function createBrowserJavaProjectRunner(workerClient, options = {}) {
|
|
|
77
77
|
export {
|
|
78
78
|
createBrowserJavaProjectRunner
|
|
79
79
|
};
|
|
80
|
-
//# sourceMappingURL=project-browser-
|
|
80
|
+
//# sourceMappingURL=project-browser-P2H222D7.js.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
createRuntimeProjectIoBridge,
|
|
4
4
|
runRuntimeProjectWorkerBridge,
|
|
5
5
|
withRuntimeProjectCommandRunnerCapabilities
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GXTDL2ML.js";
|
|
7
7
|
import "./chunk-756Z7C6D.js";
|
|
8
8
|
|
|
9
9
|
// packages/runtime-csharp/src/project-browser.ts
|
|
@@ -79,4 +79,4 @@ function createBrowserCSharpProjectRunner(workerClient, options = {}) {
|
|
|
79
79
|
export {
|
|
80
80
|
createBrowserCSharpProjectRunner
|
|
81
81
|
};
|
|
82
|
-
//# sourceMappingURL=project-browser-
|
|
82
|
+
//# sourceMappingURL=project-browser-WCSIJY6I.js.map
|
|
@@ -2,13 +2,13 @@ var define = undefined;
|
|
|
2
2
|
import {
|
|
3
3
|
PythonWorkerClient,
|
|
4
4
|
isWorkerSupported
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-EPBHRROK.js";
|
|
6
|
+
import "./chunk-GXTDL2ML.js";
|
|
7
|
+
import "./chunk-5KH5ABPQ.js";
|
|
8
8
|
import "./chunk-C2RUZCIL.js";
|
|
9
9
|
import "./chunk-756Z7C6D.js";
|
|
10
10
|
export {
|
|
11
11
|
PythonWorkerClient,
|
|
12
12
|
isWorkerSupported
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=python-worker-client-
|
|
14
|
+
//# sourceMappingURL=python-worker-client-UCOMTSMU.js.map
|