@tracecode/harness 0.16.1 → 0.16.3

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.
Files changed (45) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/{browser-runtime-provider-NQNCL6HE.js → browser-runtime-provider-C53ZJH3D.js} +4 -4
  3. package/dist/{chunk-MMQLUTPP.js → chunk-53ROKKGU.js} +2 -2
  4. package/dist/{chunk-KYTMGAFA.js → chunk-6SWX35P2.js} +2 -2
  5. package/dist/{chunk-4W6MUXZE.js → chunk-BXUGUGWL.js} +9 -9
  6. package/dist/{chunk-AWHLLSEH.js → chunk-DI7WIHES.js} +3 -3
  7. package/dist/chunk-EJE2EJDI.js +193 -0
  8. package/dist/{chunk-DQMPICNS.js → chunk-TXDHVV6B.js} +193 -345
  9. package/dist/{chunk-57WKRSIB.js → chunk-YID2AAYD.js} +2 -2
  10. package/dist/cli.cjs +5 -0
  11. package/dist/cli.js +5 -0
  12. package/dist/core.cjs +8 -8
  13. package/dist/core.d.cts +2 -2
  14. package/dist/core.d.ts +2 -2
  15. package/dist/core.js +1 -1
  16. package/dist/{cpp-worker-client-A2ULEW5T.js → cpp-worker-client-FLJ2YLSW.js} +3 -3
  17. package/dist/{csharp-worker-client-RA47P77F.js → csharp-worker-client-S4U6MCVF.js} +3 -3
  18. package/dist/internal/tracekernel-workspace.cjs +171 -31
  19. package/dist/internal/tracekernel-workspace.d.cts +8 -2
  20. package/dist/internal/tracekernel-workspace.d.ts +8 -2
  21. package/dist/internal/tracekernel-workspace.js +164 -24
  22. package/dist/{java-project-BTAANBJH.js → java-project-GK6MHT3I.js} +2 -2
  23. package/dist/{java-project-client-R7CKC72F.js → java-project-client-PEQKFTH6.js} +11 -2
  24. package/dist/judge.cjs +420 -214
  25. package/dist/judge.d.cts +1 -1
  26. package/dist/judge.d.ts +1 -1
  27. package/dist/judge.js +9 -7
  28. package/dist/{project-browser-GBSPIYEW.js → project-browser-3I5FVB5N.js} +2 -2
  29. package/dist/{project-browser-U3YK43H4.js → project-browser-ADXGG5RZ.js} +2 -2
  30. package/dist/{project-browser-J6LVPVDC.js → project-browser-B5T7WJWP.js} +2 -2
  31. package/dist/{project-browser-QMZCUVJA.js → project-browser-JXJ74RDZ.js} +2 -2
  32. package/dist/{project-browser-PC7TRROQ.js → project-browser-TDL4LMJJ.js} +2 -2
  33. package/dist/{python-worker-client-NEBS6V63.js → python-worker-client-2RF6IYIN.js} +3 -3
  34. package/dist/{runtime-environment-D7mZm8SA.d.cts → runtime-environment-BO5I1fAC.d.cts} +5 -0
  35. package/dist/{runtime-environment-Q60S0pUa.d.ts → runtime-environment-Dfg6ZoCj.d.ts} +5 -0
  36. package/dist/{runtime-open-source-info-BQtIRJ9F.d.cts → runtime-open-source-info-CaBpNicy.d.cts} +4 -2
  37. package/dist/{runtime-open-source-info-FkIxlAcm.d.ts → runtime-open-source-info-D0OJc4zH.d.ts} +4 -2
  38. package/dist/tracecc-runtime-assets-G3BFH7LY.js +19 -0
  39. package/dist/tracekernel.cjs +585 -235
  40. package/dist/tracekernel.d.cts +14 -5
  41. package/dist/tracekernel.d.ts +14 -5
  42. package/dist/tracekernel.js +175 -31
  43. package/package.json +44 -32
  44. package/runtime-assets.lock.json +7 -7
  45. package/workers/javascript/javascript-project-worker.js +7 -7
package/dist/judge.cjs CHANGED
@@ -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.1"
13077
+ "version": "0.16.3"
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.1"
13104
+ "version": "0.16.3"
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.1"
13196
+ "version": "0.16.3"
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.1"
13296
+ "version": "0.16.3"
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.1"
13333
+ "version": "0.16.3"
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.1"
13362
+ "version": "0.16.3"
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.1/workers/python/pyodide-0.29.3"
13527
+ "url": "https://github.com/tracecodeapp/harness/tree/v0.16.3/workers/python/pyodide-0.29.3"
13528
13528
  }
13529
13529
  ]
13530
13530
  }
@@ -15138,7 +15138,7 @@ var init_package = __esm({
15138
15138
  "package.json"() {
15139
15139
  package_default = {
15140
15140
  name: "@tracecode/harness",
15141
- version: "0.16.1",
15141
+ version: "0.16.3",
15142
15142
  license: "AGPL-3.0-only",
15143
15143
  homepage: "https://tracecode.app",
15144
15144
  repository: {
@@ -31356,7 +31356,6 @@ var init_cpp_worker_client = __esm({
31356
31356
  });
31357
31357
  }
31358
31358
  async executeProjectCpp(request, timeoutMs = this.executionTimeoutMs, onEvent, signal = request.signal, engineLease) {
31359
- engineLease?.attach({ release: () => void 0 });
31360
31359
  if (request.source === "compile" && this.options.trustedCompilerService) {
31361
31360
  const {
31362
31361
  signal: _signal,
@@ -31425,6 +31424,7 @@ var init_cpp_worker_client = __esm({
31425
31424
  }]
31426
31425
  };
31427
31426
  }
31427
+ engineLease?.attach({ release: () => void 0 });
31428
31428
  return this.runInDisposableExecutionWorker(async (lifecycleGeneration) => {
31429
31429
  const {
31430
31430
  signal: _signal,
@@ -32132,6 +32132,211 @@ var init_browser_runtime_provider = __esm({
32132
32132
  }
32133
32133
  });
32134
32134
 
32135
+ // packages/runtime-cpp/src/tracecc-runtime-assets.generated.ts
32136
+ var TRACECC_RUNTIME_CONTENT_HASH, TRACECC_RUNTIME_ASSETS;
32137
+ var init_tracecc_runtime_assets_generated = __esm({
32138
+ "packages/runtime-cpp/src/tracecc-runtime-assets.generated.ts"() {
32139
+ "use strict";
32140
+ TRACECC_RUNTIME_CONTENT_HASH = "fb4b6f41f9e9b7db89b6c8425bb2c6218979219a4150f96619b6461b4b78d294";
32141
+ TRACECC_RUNTIME_ASSETS = Object.freeze({
32142
+ "runtimeHeader": {
32143
+ "fileName": "tracecode_runtime.hpp",
32144
+ "integrity": "sha256-WEbB8mLN8cwKIWPf25UL7yoTSM9nCqWs8MkE0B14EtE=",
32145
+ "mediaType": "text/plain",
32146
+ "size": 263083
32147
+ },
32148
+ "compilerWasm": {
32149
+ "fileName": "tracecc-reactor.wasm",
32150
+ "integrity": "sha256-At40hCU4Rmvynp1s8UzQ1eX/UZybo5BWHMsVgQXUTUE=",
32151
+ "mediaType": "application/wasm",
32152
+ "size": 33478188
32153
+ },
32154
+ "sysroot": {
32155
+ "fileName": "llvm-resources.tar",
32156
+ "integrity": "sha256-2V0qK8hAihbAdEmWrEfJG7PGO7cblDFcl5YIm23ahVU=",
32157
+ "mediaType": "application/x-tar",
32158
+ "size": 29112320
32159
+ },
32160
+ "narrowPch": {
32161
+ "fileName": "narrow.pch",
32162
+ "integrity": "sha256-rbuVm7YeO+HwDpSJPAqGGNrrPKeJveazS/juUWXs5/A=",
32163
+ "mediaType": "application/octet-stream",
32164
+ "size": 21322216
32165
+ },
32166
+ "narrowPchSource": {
32167
+ "fileName": "narrow.source.hpp",
32168
+ "integrity": "sha256-SMqxQfcMBSUHUcAz+7Cp4vkWyOtgv7mNB09JE1cOEAU=",
32169
+ "mediaType": "text/plain",
32170
+ "size": 815
32171
+ },
32172
+ "narrowRuntimeObject": {
32173
+ "fileName": "narrow.o",
32174
+ "integrity": "sha256-il/wX66FvAU9SJSiDepMuEZ00CipED4EEEfqcdxEg8c=",
32175
+ "mediaType": "application/wasm",
32176
+ "size": 1042570
32177
+ },
32178
+ "broadPch": {
32179
+ "fileName": "broad.pch",
32180
+ "integrity": "sha256-ktKxBSglo50GPM9GJJwBpqyYDcFHkKGjoyEtsUmLMrI=",
32181
+ "mediaType": "application/octet-stream",
32182
+ "size": 24543552
32183
+ },
32184
+ "broadPchSource": {
32185
+ "fileName": "broad.source.hpp",
32186
+ "integrity": "sha256-MOayycWl5KYaLS8vP2MoJh4kazsDhg0kH9Bi6dvsy0s=",
32187
+ "mediaType": "text/plain",
32188
+ "size": 7095
32189
+ },
32190
+ "broadRuntimeObject": {
32191
+ "fileName": "broad.o",
32192
+ "integrity": "sha256-f69Oe7kRn9JEIUEPgM1cuYbf50oph4IxEnVP7VIZGp4=",
32193
+ "mediaType": "application/wasm",
32194
+ "size": 1892879
32195
+ },
32196
+ "mapPch": {
32197
+ "fileName": "map.pch",
32198
+ "integrity": "sha256-fX7zTmJXnRJ2acbDiJ4Wu7/xf1G510SB2fLzkTgr2Uc=",
32199
+ "mediaType": "application/octet-stream",
32200
+ "size": 29951380
32201
+ },
32202
+ "mapPchSource": {
32203
+ "fileName": "map.source.hpp",
32204
+ "integrity": "sha256-WHaMpx3nG/h1ro6CppBseoDIkgqahbYnFxShHLGT9/c=",
32205
+ "mediaType": "text/plain",
32206
+ "size": 10708
32207
+ },
32208
+ "mapRuntimeObject": {
32209
+ "fileName": "map.o",
32210
+ "integrity": "sha256-02ktvX6uqV05it5kdBEm/ncOszBeO43wX93Yk079E4U=",
32211
+ "mediaType": "application/wasm",
32212
+ "size": 3372458
32213
+ }
32214
+ });
32215
+ }
32216
+ });
32217
+
32218
+ // packages/runtime-cpp/src/tracecc-runtime-assets.ts
32219
+ var tracecc_runtime_assets_exports = {};
32220
+ __export(tracecc_runtime_assets_exports, {
32221
+ TRACECC_RUNTIME_ASSET_RELATIVE_PATH: () => TRACECC_RUNTIME_ASSET_RELATIVE_PATH,
32222
+ TRACECC_RUNTIME_CONTENT_HASH: () => TRACECC_RUNTIME_CONTENT_HASH,
32223
+ TRACECC_RUNTIME_MANIFEST: () => TRACECC_RUNTIME_MANIFEST,
32224
+ createTraceCCRuntimeManifest: () => createTraceCCRuntimeManifest,
32225
+ resolveBuiltInTraceCCProjectRuntimeManifest: () => resolveBuiltInTraceCCProjectRuntimeManifest,
32226
+ resolveBuiltInTraceCCRuntimeManifest: () => resolveBuiltInTraceCCRuntimeManifest
32227
+ });
32228
+ function stripTrailingSlash3(value) {
32229
+ return value.replace(/\/+$/, "");
32230
+ }
32231
+ function normalizeAssetBaseUrl(value) {
32232
+ const normalized = stripTrailingSlash3(value.trim());
32233
+ if (!normalized) {
32234
+ throw new TypeError("TraceCC requires a non-empty asset base URL.");
32235
+ }
32236
+ if (/[?#]/u.test(normalized)) {
32237
+ throw new TypeError(
32238
+ "TraceCC asset base URL must be a directory without a query or fragment."
32239
+ );
32240
+ }
32241
+ return normalized;
32242
+ }
32243
+ function normalizeWorkerUrl(value) {
32244
+ const normalized = value.trim();
32245
+ if (!normalized) {
32246
+ throw new TypeError("TraceCC worker URL must not be empty.");
32247
+ }
32248
+ return normalized;
32249
+ }
32250
+ function descriptor2(asset) {
32251
+ return {
32252
+ url: asset.fileName,
32253
+ integrity: asset.integrity,
32254
+ mediaType: asset.mediaType,
32255
+ size: asset.size,
32256
+ delivery: {
32257
+ mutability: "immutable",
32258
+ address: "content"
32259
+ }
32260
+ };
32261
+ }
32262
+ function createTraceCCRuntimeManifest(assetBaseUrl, options = {}) {
32263
+ const normalizedAssetBaseUrl = normalizeAssetBaseUrl(assetBaseUrl);
32264
+ const workerUrl = normalizeWorkerUrl(
32265
+ options.workerUrl ?? "/workers/cpp-worker.js"
32266
+ );
32267
+ const compilerWasm = descriptor2(
32268
+ typedTraceCCRuntimeAssets.compilerWasm
32269
+ );
32270
+ return {
32271
+ runtime: "cpp",
32272
+ runtimeVersion: `tracecc-${TRACECC_RUNTIME_CONTENT_HASH.slice(0, 12)}`,
32273
+ protocolVersion: "browser-runtime-assets-v1",
32274
+ assetBaseUrl: `${normalizedAssetBaseUrl}/`,
32275
+ workerFormat: "module",
32276
+ assets: {
32277
+ worker: { url: workerUrl },
32278
+ runtimeHeader: descriptor2(typedTraceCCRuntimeAssets.runtimeHeader),
32279
+ compilerWasm,
32280
+ linkerWasm: compilerWasm,
32281
+ sysroot: descriptor2(typedTraceCCRuntimeAssets.sysroot),
32282
+ compilerResources: {
32283
+ "tracecc-narrow-pch": descriptor2(
32284
+ typedTraceCCRuntimeAssets.narrowPch
32285
+ ),
32286
+ "tracecc-narrow-pch-source": descriptor2(
32287
+ typedTraceCCRuntimeAssets.narrowPchSource
32288
+ ),
32289
+ "tracecc-narrow-runtime-object": descriptor2(
32290
+ typedTraceCCRuntimeAssets.narrowRuntimeObject
32291
+ ),
32292
+ "tracecc-broad-pch": descriptor2(
32293
+ typedTraceCCRuntimeAssets.broadPch
32294
+ ),
32295
+ "tracecc-broad-pch-source": descriptor2(
32296
+ typedTraceCCRuntimeAssets.broadPchSource
32297
+ ),
32298
+ "tracecc-broad-runtime-object": descriptor2(
32299
+ typedTraceCCRuntimeAssets.broadRuntimeObject
32300
+ ),
32301
+ "tracecc-map-pch": descriptor2(
32302
+ typedTraceCCRuntimeAssets.mapPch
32303
+ ),
32304
+ "tracecc-map-pch-source": descriptor2(
32305
+ typedTraceCCRuntimeAssets.mapPchSource
32306
+ ),
32307
+ "tracecc-map-runtime-object": descriptor2(
32308
+ typedTraceCCRuntimeAssets.mapRuntimeObject
32309
+ )
32310
+ }
32311
+ }
32312
+ };
32313
+ }
32314
+ function resolveBuiltInTraceCCRuntimeManifest(assetBaseUrl = "/workers") {
32315
+ const normalizedAssetBaseUrl = normalizeAssetBaseUrl(assetBaseUrl);
32316
+ return createTraceCCRuntimeManifest(
32317
+ `${normalizedAssetBaseUrl}/${TRACECC_RUNTIME_ASSET_RELATIVE_PATH}`,
32318
+ { workerUrl: `${normalizedAssetBaseUrl}/cpp-worker.js` }
32319
+ );
32320
+ }
32321
+ function resolveBuiltInTraceCCProjectRuntimeManifest(assetBaseUrl = "/workers") {
32322
+ const normalizedAssetBaseUrl = normalizeAssetBaseUrl(assetBaseUrl);
32323
+ return createTraceCCRuntimeManifest(
32324
+ `${normalizedAssetBaseUrl}/${TRACECC_RUNTIME_ASSET_RELATIVE_PATH}`,
32325
+ { workerUrl: `${normalizedAssetBaseUrl}/project-cpp-worker.js` }
32326
+ );
32327
+ }
32328
+ var TRACECC_RUNTIME_ASSET_RELATIVE_PATH, typedTraceCCRuntimeAssets, TRACECC_RUNTIME_MANIFEST;
32329
+ var init_tracecc_runtime_assets = __esm({
32330
+ "packages/runtime-cpp/src/tracecc-runtime-assets.ts"() {
32331
+ "use strict";
32332
+ init_tracecc_runtime_assets_generated();
32333
+ init_tracecc_runtime_assets_generated();
32334
+ TRACECC_RUNTIME_ASSET_RELATIVE_PATH = `cpp/tracecc/${TRACECC_RUNTIME_CONTENT_HASH}`;
32335
+ typedTraceCCRuntimeAssets = TRACECC_RUNTIME_ASSETS;
32336
+ TRACECC_RUNTIME_MANIFEST = resolveBuiltInTraceCCRuntimeManifest();
32337
+ }
32338
+ });
32339
+
32135
32340
  // node_modules/.pnpm/sprintf-js@1.1.3/node_modules/sprintf-js/src/sprintf.js
32136
32341
  var require_sprintf = __commonJS({
32137
32342
  "node_modules/.pnpm/sprintf-js@1.1.3/node_modules/sprintf-js/src/sprintf.js"(exports2) {
@@ -95066,20 +95271,27 @@ var init_terminal_session = __esm({
95066
95271
  signalCharacter === "" ? "SIGINT" : "SIGQUIT"
95067
95272
  );
95068
95273
  }
95069
- const route = this.options.terminalInputRouter?.write(data) ?? (this.activeStdinPipe !== null ? "legacy" : "rejected");
95274
+ const routed = this.options.terminalInputRouter?.write(data);
95275
+ const route = routed === "rejected" && this.activeStdinPipe !== null ? "legacy" : routed ?? (this.activeStdinPipe !== null ? "legacy" : "rejected");
95070
95276
  if (route === "legacy") {
95071
- this.activeStdinPipe?.write(data);
95277
+ if (!this.activeStdinPipe) return false;
95278
+ try {
95279
+ this.activeStdinPipe.write(data);
95280
+ } catch {
95281
+ return false;
95282
+ }
95072
95283
  }
95073
95284
  const accepted = route !== "rejected";
95074
95285
  if (accepted && this.currentInputState.mode === "stdin") {
95075
95286
  this.activeStdinPrompt = "";
95076
- this.setInputState("busy", "stdin-submit");
95287
+ this.setInputState("stdin", "stdin-submit", "");
95077
95288
  }
95078
95289
  return accepted;
95079
95290
  }
95080
95291
  endStdin() {
95081
95292
  if (!this.activeRun || this.activeStdinEnded) return false;
95082
- const route = this.options.terminalInputRouter?.end() ?? (this.activeStdinPipe !== null ? "legacy" : "rejected");
95293
+ const routed = this.options.terminalInputRouter?.end();
95294
+ const route = routed === "rejected" && this.activeStdinPipe !== null ? "legacy" : routed ?? (this.activeStdinPipe !== null ? "legacy" : "rejected");
95083
95295
  if (route === "rejected") return false;
95084
95296
  this.activeStdinEnded = true;
95085
95297
  if (route === "legacy") {
@@ -95118,6 +95330,14 @@ var init_terminal_session = __esm({
95118
95330
  this.emitTerminalEvent(reason);
95119
95331
  return this.currentInputState;
95120
95332
  }
95333
+ showForegroundInputLine() {
95334
+ const acceptsInput = this.activeStdinPipe !== null || this.options.terminalInputRouter !== void 0;
95335
+ return this.setInputState(
95336
+ acceptsInput ? "stdin" : "busy",
95337
+ "command-start",
95338
+ acceptsInput ? "" : this.prompt.text
95339
+ );
95340
+ }
95121
95341
  async run(command, options = {}) {
95122
95342
  const trimmed = command.trim();
95123
95343
  if (!trimmed) return { stdout: "", stderr: "", exitCode: 0 };
@@ -95172,7 +95392,7 @@ var init_terminal_session = __esm({
95172
95392
  this.activeTerminalEventHandler = options.onTerminalEvent;
95173
95393
  this.activeStdinPrompt = "";
95174
95394
  this.activeCommand = submittedCommand;
95175
- this.setInputState("busy", "command-start");
95395
+ this.showForegroundInputLine();
95176
95396
  try {
95177
95397
  let stdout = "";
95178
95398
  let stderr = "";
@@ -95201,6 +95421,7 @@ var init_terminal_session = __esm({
95201
95421
  ...error ? { error } : {}
95202
95422
  };
95203
95423
  } finally {
95424
+ this.options.terminalInputRouter?.reset();
95204
95425
  ownedStdinPipe?.close();
95205
95426
  this.activeStdinPipe = previousStdinPipe;
95206
95427
  this.activeStdinEnded = previousStdinEnded;
@@ -95239,7 +95460,7 @@ var init_terminal_session = __esm({
95239
95460
  this.activeStdinPrompt = "";
95240
95461
  this.activeCommand = trimmed;
95241
95462
  this.activeCommandAbortController = commandAbortController;
95242
- this.setInputState("busy", "command-start");
95463
+ this.showForegroundInputLine();
95243
95464
  try {
95244
95465
  const result = await this.runForegroundTerminalCommand(
95245
95466
  trimmed,
@@ -95250,6 +95471,7 @@ var init_terminal_session = __esm({
95250
95471
  return result;
95251
95472
  } finally {
95252
95473
  options.signal?.removeEventListener("abort", forwardExternalAbort);
95474
+ this.options.terminalInputRouter?.reset();
95253
95475
  ownedStdinPipe?.close();
95254
95476
  this.activeStdinPipe = previousStdinPipe;
95255
95477
  this.activeStdinEnded = previousStdinEnded;
@@ -101084,21 +101306,26 @@ function createWorkspaceRuntimeRunnerBridge(bridge) {
101084
101306
  ...requestWithoutLegacyStdin
101085
101307
  } = request;
101086
101308
  const activeStdinPipe = request.source !== "compile" && request.source !== "stdin" ? commandContext?.stdinPipe : void 0;
101309
+ const consumesLiveStdin = request.source !== "compile" && request.source !== "stdin";
101087
101310
  const stdinPipe = request.stdinPipe ?? activeStdinPipe;
101088
- const processBinding = commandContext ? bridge.bindProcess(commandContext, descriptorStdio) : {};
101311
+ const processBinding = commandContext ? bridge.bindProcess(
101312
+ commandContext,
101313
+ descriptorStdio,
101314
+ consumesLiveStdin
101315
+ ) : {};
101089
101316
  const signal = processBinding.signal ?? request.signal;
101090
101317
  const runtimeIo = commandContext?.runtimeIo;
101091
101318
  let acceptingRunnerEvents = true;
101092
101319
  let result;
101093
101320
  const kernelSyscalls = options.kernelSyscalls ? bridge.createKernelSyscallBridge(commandContext) : void 0;
101094
- if (descriptorStdio && commandContext) {
101321
+ if (descriptorStdio && commandContext && consumesLiveStdin) {
101095
101322
  bridge.startHostStandardInputPump(commandContext);
101096
101323
  }
101097
101324
  try {
101098
- result = await runner({
101099
- ...descriptorStdio ? requestWithoutLegacyStdin : request,
101325
+ const execution = runner({
101326
+ ...descriptorStdio || !consumesLiveStdin ? requestWithoutLegacyStdin : request,
101100
101327
  ...processBinding.process ? { process: processBinding.process } : {},
101101
- ...stdinPipe && !descriptorStdio ? { stdinPipe: { buffer: stdinPipe.buffer } } : {},
101328
+ ...stdinPipe && !descriptorStdio && consumesLiveStdin ? { stdinPipe: { buffer: stdinPipe.buffer } } : {},
101102
101329
  ...commandContext?.terminal ? { terminal: commandContext.terminal } : {},
101103
101330
  ...commandContext?.engineLease ? { engineLease: commandContext.engineLease } : {},
101104
101331
  ...signal ? { signal } : {},
@@ -101110,6 +101337,8 @@ function createWorkspaceRuntimeRunnerBridge(bridge) {
101110
101337
  bridge.handleRuntimeCommandEvent(event, commandContext);
101111
101338
  }
101112
101339
  });
101340
+ await processBinding.replayStartupInput?.();
101341
+ result = await execution;
101113
101342
  } finally {
101114
101343
  acceptingRunnerEvents = false;
101115
101344
  kernelSyscalls?.close();
@@ -102153,7 +102382,7 @@ async function createRuntimeWorkspace(options = {}) {
102153
102382
  }
102154
102383
  return workspace;
102155
102384
  }
102156
- var PRINCIPAL_ACTOR2, RUNTIME_ACTOR, SYSTEM_ACTOR2, TRACEKERNEL_SYSCALL_ERROR_CODES, TRACEKERNEL_ZOMBIE_RETENTION_MS, RuntimeProjectWorkspace;
102385
+ var PRINCIPAL_ACTOR2, RUNTIME_ACTOR, SYSTEM_ACTOR2, TERMINAL_STARTUP_INPUT_MAX_BYTES, TRACEKERNEL_SYSCALL_ERROR_CODES, TRACEKERNEL_ZOMBIE_RETENTION_MS, RuntimeProjectWorkspace;
102157
102386
  var init_runtime_project_workspace = __esm({
102158
102387
  "packages/tracekernel/src/workspace/runtime-project-workspace.ts"() {
102159
102388
  "use strict";
@@ -102203,6 +102432,7 @@ var init_runtime_project_workspace = __esm({
102203
102432
  PRINCIPAL_ACTOR2 = runtimeWorkspaceActorPreset("principal");
102204
102433
  RUNTIME_ACTOR = runtimeWorkspaceActorPreset("runtime");
102205
102434
  SYSTEM_ACTOR2 = runtimeWorkspaceActorPreset("system");
102435
+ TERMINAL_STARTUP_INPUT_MAX_BYTES = 64 * 1024 - 1;
102206
102436
  TRACEKERNEL_SYSCALL_ERROR_CODES = /* @__PURE__ */ new Set([
102207
102437
  "E2BIG",
102208
102438
  "EAGAIN",
@@ -102277,6 +102507,7 @@ var init_runtime_project_workspace = __esm({
102277
102507
  processState = new WorkspaceProcessState();
102278
102508
  terminalShells = /* @__PURE__ */ new Map();
102279
102509
  terminalResourceIds = /* @__PURE__ */ new Map();
102510
+ pendingTerminalStartupInput = /* @__PURE__ */ new Map();
102280
102511
  processProjection;
102281
102512
  // Temporary 0.13 introspection aliases. The process state module remains
102282
102513
  // authoritative; these preserve existing hardening probes while 0.14 moves
@@ -102458,17 +102689,24 @@ var init_runtime_project_workspace = __esm({
102458
102689
  });
102459
102690
  const withEvents = createWorkspaceRuntimeRunnerBridge({
102460
102691
  resolveCommandContext: (context2) => this.resolveCommandContext(context2),
102461
- bindProcess: (context2, descriptorStdio) => {
102692
+ bindProcess: (context2, descriptorStdio, consumesLiveStdin) => {
102462
102693
  const executionHandle = this.processProjection.executionHandle(
102463
102694
  context2.process
102464
102695
  );
102465
102696
  if (executionHandle) {
102466
102697
  executionHandle.descriptorStdio = descriptorStdio;
102698
+ executionHandle.consumesLiveStdin = consumesLiveStdin;
102467
102699
  }
102468
102700
  const processSnapshot = this.processProjection.authoritativeSnapshot(
102469
102701
  context2.process
102470
102702
  );
102471
102703
  return {
102704
+ replayStartupInput: () => this.resolvePendingTerminalStartupInput(
102705
+ context2.process.pid,
102706
+ descriptorStdio,
102707
+ context2.stdinPipe,
102708
+ consumesLiveStdin
102709
+ ),
102472
102710
  ...executionHandle?.abortController?.signal ? { signal: executionHandle.abortController.signal } : {},
102473
102711
  ...executionHandle?.signalChannel ? { kernelSignals: executionHandle.signalChannel } : {},
102474
102712
  ...processSnapshot ? {
@@ -105016,24 +105254,106 @@ var init_runtime_project_workspace = __esm({
105016
105254
  )
105017
105255
  );
105018
105256
  }
105019
- kernelTerminalInputRoute(terminal) {
105257
+ kernelTerminalInputRoute(terminalSessionId, terminal) {
105020
105258
  const hasDescriptorConsumer = this.traceKernelAuthority?.session.processSnapshots().some(
105021
- (process3) => process3.sid === terminal.sessionId && process3.pgid === terminal.foregroundProcessGroupId && this.processState.executionHandles.get(process3.pid)?.descriptorStdio === true
105259
+ (process3) => process3.sid === terminal.sessionId && process3.pgid === terminal.foregroundProcessGroupId && this.processState.executionHandles.get(process3.pid)?.descriptorStdio === true && this.processState.executionHandles.get(process3.pid)?.consumesLiveStdin === true
105022
105260
  ) === true;
105023
- return hasDescriptorConsumer ? "kernel" : "legacy";
105261
+ if (hasDescriptorConsumer) return "kernel";
105262
+ const foregroundPid = this.processState.terminalForeground.get(
105263
+ terminalSessionId
105264
+ );
105265
+ if (foregroundPid === void 0) return "pending";
105266
+ const executionHandle = this.processState.executionHandles.get(foregroundPid);
105267
+ if (executionHandle?.consumesLiveStdin !== true) return "pending";
105268
+ const descriptorStdio = executionHandle.descriptorStdio;
105269
+ return descriptorStdio === void 0 ? "pending" : descriptorStdio ? "kernel" : "legacy";
105270
+ }
105271
+ queueTerminalStartupInput(terminalSessionId, input = {}) {
105272
+ const pending2 = this.pendingTerminalStartupInput.get(terminalSessionId) ?? {
105273
+ chunks: [],
105274
+ byteLength: 0,
105275
+ eof: false
105276
+ };
105277
+ if (input.data) {
105278
+ const byteLength = new TextEncoder().encode(input.data).byteLength;
105279
+ if (pending2.byteLength + byteLength > TERMINAL_STARTUP_INPUT_MAX_BYTES) {
105280
+ return false;
105281
+ }
105282
+ pending2.chunks.push(input.data);
105283
+ pending2.byteLength += byteLength;
105284
+ }
105285
+ if (input.eof) pending2.eof = true;
105286
+ this.pendingTerminalStartupInput.set(terminalSessionId, pending2);
105287
+ return true;
105024
105288
  }
105025
- writeKernelTerminalInput(terminalSessionId, data) {
105289
+ async resolvePendingTerminalStartupInput(foregroundPid, descriptorStdio, stdinPipe, consumesLiveStdin = true) {
105290
+ const boundProcess = this.processProjection.find(foregroundPid);
105291
+ const boundSnapshot = boundProcess ? this.processProjection.authoritativeSnapshot(boundProcess) : void 0;
105292
+ const terminalSessionId = [...this.processState.terminalForeground].find(([, pid]) => {
105293
+ if (pid === foregroundPid) return true;
105294
+ const terminalProcess = this.processProjection.find(pid);
105295
+ const terminalSnapshot = terminalProcess ? this.processProjection.authoritativeSnapshot(terminalProcess) : void 0;
105296
+ return Boolean(
105297
+ boundSnapshot && terminalSnapshot && boundSnapshot.pgid === terminalSnapshot.pgid
105298
+ );
105299
+ })?.[0];
105300
+ if (!terminalSessionId) return;
105301
+ const pending2 = this.pendingTerminalStartupInput.get(terminalSessionId);
105302
+ if (!pending2) return;
105303
+ if (!consumesLiveStdin) return;
105304
+ this.pendingTerminalStartupInput.delete(terminalSessionId);
105305
+ if (!descriptorStdio) {
105306
+ if (!stdinPipe) return;
105307
+ try {
105308
+ for (const chunk2 of pending2.chunks) stdinPipe.write(chunk2);
105309
+ if (pending2.eof) stdinPipe.close();
105310
+ } catch {
105311
+ stdinPipe.close();
105312
+ }
105313
+ return;
105314
+ }
105026
105315
  const authority = this.traceKernelAuthority;
105027
105316
  const terminalId = this.terminalResourceIds.get(terminalSessionId);
105028
105317
  const terminal = terminalId === void 0 ? void 0 : authority?.session.terminalSnapshots().find(
105029
105318
  (candidate) => candidate.id === terminalId
105030
105319
  );
105031
- if (!authority || !terminal || terminal.closed) return "rejected";
105320
+ if (!authority || !terminal || terminal.closed) return;
105321
+ const bytes2 = new TextEncoder().encode(pending2.chunks.join(""));
105322
+ await runPromise(
105323
+ gen2(function* () {
105324
+ if (bytes2.byteLength > 0) {
105325
+ yield* authority.session.writeTerminalInput(terminal.id, bytes2);
105326
+ }
105327
+ if (pending2.eof) {
105328
+ yield* authority.session.sendTerminalInputEof(terminal.id);
105329
+ }
105330
+ }).pipe(catchAll2(() => _void))
105331
+ );
105332
+ }
105333
+ discardPendingTerminalStartupInput(terminalSessionId, foregroundPid) {
105334
+ if (terminalSessionId && (foregroundPid === void 0 || this.processState.terminalForeground.get(terminalSessionId) === foregroundPid)) {
105335
+ this.pendingTerminalStartupInput.delete(terminalSessionId);
105336
+ }
105337
+ }
105338
+ writeKernelTerminalInput(terminalSessionId, data) {
105032
105339
  const signalByte = new TextEncoder().encode(data).find(
105033
105340
  (byte) => byte === 3 || byte === 28
105034
105341
  );
105035
- if (signalByte === void 0 && this.kernelTerminalInputRoute(terminal) === "legacy") {
105036
- return "legacy";
105342
+ const authority = this.traceKernelAuthority;
105343
+ const terminalId = this.terminalResourceIds.get(terminalSessionId);
105344
+ const terminal = terminalId === void 0 ? void 0 : authority?.session.terminalSnapshots().find(
105345
+ (candidate) => candidate.id === terminalId
105346
+ );
105347
+ if (!authority || !terminal || terminal.closed) {
105348
+ if (signalByte !== void 0) return "rejected";
105349
+ return this.queueTerminalStartupInput(terminalSessionId, { data }) ? "pending" : "rejected";
105350
+ }
105351
+ if (signalByte === void 0) {
105352
+ const route = this.kernelTerminalInputRoute(terminalSessionId, terminal);
105353
+ if (route === "pending") {
105354
+ return this.queueTerminalStartupInput(terminalSessionId, { data }) ? "pending" : "rejected";
105355
+ }
105356
+ if (route === "legacy") return "legacy";
105037
105357
  }
105038
105358
  if (signalByte !== void 0) {
105039
105359
  const signal = signalByte === 3 ? "SIGINT" : "SIGQUIT";
@@ -105063,8 +105383,16 @@ var init_runtime_project_workspace = __esm({
105063
105383
  const terminal = terminalId === void 0 ? void 0 : authority?.session.terminalSnapshots().find(
105064
105384
  (candidate) => candidate.id === terminalId
105065
105385
  );
105066
- if (!authority || !terminal || terminal.closed) return "rejected";
105067
- if (this.kernelTerminalInputRoute(terminal) === "legacy") return "legacy";
105386
+ if (!authority || !terminal || terminal.closed) {
105387
+ this.queueTerminalStartupInput(terminalSessionId, { eof: true });
105388
+ return "pending";
105389
+ }
105390
+ const route = this.kernelTerminalInputRoute(terminalSessionId, terminal);
105391
+ if (route === "pending") {
105392
+ this.queueTerminalStartupInput(terminalSessionId, { eof: true });
105393
+ return "pending";
105394
+ }
105395
+ if (route === "legacy") return "legacy";
105068
105396
  runFork2(
105069
105397
  authority.session.sendTerminalInputEof(terminal.id).pipe(
105070
105398
  catchAll2(() => _void)
@@ -106218,6 +106546,10 @@ usage: tracekernelctl {status|reset|verbose [on|off|status]|kill <pid> [signal]|
106218
106546
  executionHandle.signalChannel?.close();
106219
106547
  this.processState.executionHandles.delete(process3.pid);
106220
106548
  if (options.terminalSessionId && this.processState.terminalForeground.get(options.terminalSessionId) === process3.pid) {
106549
+ this.discardPendingTerminalStartupInput(
106550
+ options.terminalSessionId,
106551
+ process3.pid
106552
+ );
106221
106553
  this.processState.terminalForeground.delete(options.terminalSessionId);
106222
106554
  }
106223
106555
  clearKernelSignalHandler();
@@ -106472,6 +106804,10 @@ usage: tracekernelctl {status|reset|verbose [on|off|status]|kill <pid> [signal]|
106472
106804
  executionHandle.signalChannel?.close();
106473
106805
  this.processState.executionHandles.delete(process3.pid);
106474
106806
  if (options.terminalSessionId && this.processState.terminalForeground.get(options.terminalSessionId) === process3.pid) {
106807
+ this.discardPendingTerminalStartupInput(
106808
+ options.terminalSessionId,
106809
+ process3.pid
106810
+ );
106475
106811
  this.processState.terminalForeground.delete(options.terminalSessionId);
106476
106812
  }
106477
106813
  this.observeKernelReparentedChildren(process3.pid);
@@ -106778,6 +107114,7 @@ usage: tracekernelctl {status|reset|verbose [on|off|status]|kill <pid> [signal]|
106778
107114
  const shellPromise = this.terminalShells.get(terminalSessionId);
106779
107115
  this.terminalShells.delete(terminalSessionId);
106780
107116
  this.terminalResourceIds.delete(terminalSessionId);
107117
+ this.pendingTerminalStartupInput.delete(terminalSessionId);
106781
107118
  if (!shellPromise) return;
106782
107119
  const disposal = shellPromise.then(async (shell) => {
106783
107120
  const authority = this.traceKernelAuthority;
@@ -106832,7 +107169,8 @@ usage: tracekernelctl {status|reset|verbose [on|off|status]|kill <pid> [signal]|
106832
107169
  signalForeground: (signal) => this.signalTerminalForeground(terminalSessionId, signal),
106833
107170
  terminalInputRouter: {
106834
107171
  write: (data) => this.writeKernelTerminalInput(terminalSessionId, data),
106835
- end: () => this.endKernelTerminalInput(terminalSessionId)
107172
+ end: () => this.endKernelTerminalInput(terminalSessionId),
107173
+ reset: () => this.discardPendingTerminalStartupInput(terminalSessionId)
106836
107174
  },
106837
107175
  resizeTerminal: (columns, rows) => this.resizeKernelTerminal(terminalSessionId, columns, rows),
106838
107176
  closeTerminal: () => this.closeTerminalShell(terminalSessionId),
@@ -106946,13 +107284,14 @@ usage: tracekernelctl {status|reset|verbose [on|off|status]|kill <pid> [signal]|
106946
107284
  const descriptorStdio = this.cppRunner.capabilities?.descriptorStdio === true;
106947
107285
  if (executionHandle) {
106948
107286
  executionHandle.descriptorStdio = descriptorStdio;
107287
+ executionHandle.consumesLiveStdin = true;
106949
107288
  }
106950
107289
  if (descriptorStdio) {
106951
107290
  this.startHostStandardInputPump(request.commandContext);
106952
107291
  }
106953
107292
  let result;
106954
107293
  try {
106955
- result = await this.cppRunner({
107294
+ const execution = this.cppRunner({
106956
107295
  code: "",
106957
107296
  source: "run",
106958
107297
  scriptPath,
@@ -106977,6 +107316,12 @@ usage: tracekernelctl {status|reset|verbose [on|off|status]|kill <pid> [signal]|
106977
107316
  this.handleRuntimeCommandEvent(event, request.commandContext);
106978
107317
  }
106979
107318
  });
107319
+ await this.resolvePendingTerminalStartupInput(
107320
+ request.commandContext.process.pid,
107321
+ descriptorStdio,
107322
+ request.stdinPipe
107323
+ );
107324
+ result = await execution;
106980
107325
  } finally {
106981
107326
  kernelSyscalls?.close();
106982
107327
  }
@@ -123338,6 +123683,13 @@ function normalizeBaseUrl(value) {
123338
123683
  const baseUrl = value ?? resolveBuiltInTraceJVMRuntimeAssetBaseUrl();
123339
123684
  return normalizeTraceJVMRuntimeAssetBaseUrl(baseUrl);
123340
123685
  }
123686
+ function normalizeWorkerUrl2(value) {
123687
+ const workerUrl = value.trim();
123688
+ if (!workerUrl) {
123689
+ throw new TypeError("TraceJVM project Worker URL cannot be empty");
123690
+ }
123691
+ return workerUrl;
123692
+ }
123341
123693
  function createWorker(workerUrl, role) {
123342
123694
  return new Worker(workerUrl, {
123343
123695
  type: "module",
@@ -123346,7 +123698,9 @@ function createWorker(workerUrl, role) {
123346
123698
  }
123347
123699
  function createJavaProjectClientFactory(options = {}) {
123348
123700
  const runtimeAssetBaseUrl = normalizeBaseUrl(options.runtimeAssetBaseUrl);
123349
- const workerUrl = `${runtimeAssetBaseUrl}/browser-worker.js`;
123701
+ const workerUrl = normalizeWorkerUrl2(
123702
+ options.workerUrl ?? `${runtimeAssetBaseUrl}/browser-worker.js`
123703
+ );
123350
123704
  const workerFor = (role) => options.createWorker?.(workerUrl, role) ?? createWorker(workerUrl, role);
123351
123705
  const runtimeProfile = options.runtimeProfile ?? "spring-server";
123352
123706
  const runtimeProfileBaseUrls = {
@@ -129787,183 +130141,7 @@ function createCSharpBrowserRuntimeProvider(options = {}) {
129787
130141
 
129788
130142
  // src/browser.ts
129789
130143
  init_browser_runtime_provider();
129790
-
129791
- // packages/runtime-cpp/src/tracecc-runtime-assets.generated.ts
129792
- var TRACECC_RUNTIME_CONTENT_HASH = "fb4b6f41f9e9b7db89b6c8425bb2c6218979219a4150f96619b6461b4b78d294";
129793
- var TRACECC_RUNTIME_ASSETS = Object.freeze({
129794
- "runtimeHeader": {
129795
- "fileName": "tracecode_runtime.hpp",
129796
- "integrity": "sha256-WEbB8mLN8cwKIWPf25UL7yoTSM9nCqWs8MkE0B14EtE=",
129797
- "mediaType": "text/plain",
129798
- "size": 263083
129799
- },
129800
- "compilerWasm": {
129801
- "fileName": "tracecc-reactor.wasm",
129802
- "integrity": "sha256-At40hCU4Rmvynp1s8UzQ1eX/UZybo5BWHMsVgQXUTUE=",
129803
- "mediaType": "application/wasm",
129804
- "size": 33478188
129805
- },
129806
- "sysroot": {
129807
- "fileName": "llvm-resources.tar",
129808
- "integrity": "sha256-2V0qK8hAihbAdEmWrEfJG7PGO7cblDFcl5YIm23ahVU=",
129809
- "mediaType": "application/x-tar",
129810
- "size": 29112320
129811
- },
129812
- "narrowPch": {
129813
- "fileName": "narrow.pch",
129814
- "integrity": "sha256-rbuVm7YeO+HwDpSJPAqGGNrrPKeJveazS/juUWXs5/A=",
129815
- "mediaType": "application/octet-stream",
129816
- "size": 21322216
129817
- },
129818
- "narrowPchSource": {
129819
- "fileName": "narrow.source.hpp",
129820
- "integrity": "sha256-SMqxQfcMBSUHUcAz+7Cp4vkWyOtgv7mNB09JE1cOEAU=",
129821
- "mediaType": "text/plain",
129822
- "size": 815
129823
- },
129824
- "narrowRuntimeObject": {
129825
- "fileName": "narrow.o",
129826
- "integrity": "sha256-il/wX66FvAU9SJSiDepMuEZ00CipED4EEEfqcdxEg8c=",
129827
- "mediaType": "application/wasm",
129828
- "size": 1042570
129829
- },
129830
- "broadPch": {
129831
- "fileName": "broad.pch",
129832
- "integrity": "sha256-ktKxBSglo50GPM9GJJwBpqyYDcFHkKGjoyEtsUmLMrI=",
129833
- "mediaType": "application/octet-stream",
129834
- "size": 24543552
129835
- },
129836
- "broadPchSource": {
129837
- "fileName": "broad.source.hpp",
129838
- "integrity": "sha256-MOayycWl5KYaLS8vP2MoJh4kazsDhg0kH9Bi6dvsy0s=",
129839
- "mediaType": "text/plain",
129840
- "size": 7095
129841
- },
129842
- "broadRuntimeObject": {
129843
- "fileName": "broad.o",
129844
- "integrity": "sha256-f69Oe7kRn9JEIUEPgM1cuYbf50oph4IxEnVP7VIZGp4=",
129845
- "mediaType": "application/wasm",
129846
- "size": 1892879
129847
- },
129848
- "mapPch": {
129849
- "fileName": "map.pch",
129850
- "integrity": "sha256-fX7zTmJXnRJ2acbDiJ4Wu7/xf1G510SB2fLzkTgr2Uc=",
129851
- "mediaType": "application/octet-stream",
129852
- "size": 29951380
129853
- },
129854
- "mapPchSource": {
129855
- "fileName": "map.source.hpp",
129856
- "integrity": "sha256-WHaMpx3nG/h1ro6CppBseoDIkgqahbYnFxShHLGT9/c=",
129857
- "mediaType": "text/plain",
129858
- "size": 10708
129859
- },
129860
- "mapRuntimeObject": {
129861
- "fileName": "map.o",
129862
- "integrity": "sha256-02ktvX6uqV05it5kdBEm/ncOszBeO43wX93Yk079E4U=",
129863
- "mediaType": "application/wasm",
129864
- "size": 3372458
129865
- }
129866
- });
129867
-
129868
- // packages/runtime-cpp/src/tracecc-runtime-assets.ts
129869
- var TRACECC_RUNTIME_ASSET_RELATIVE_PATH = `cpp/tracecc/${TRACECC_RUNTIME_CONTENT_HASH}`;
129870
- var typedTraceCCRuntimeAssets = TRACECC_RUNTIME_ASSETS;
129871
- function stripTrailingSlash3(value) {
129872
- return value.replace(/\/+$/, "");
129873
- }
129874
- function normalizeAssetBaseUrl(value) {
129875
- const normalized = stripTrailingSlash3(value.trim());
129876
- if (!normalized) {
129877
- throw new TypeError("TraceCC requires a non-empty asset base URL.");
129878
- }
129879
- if (/[?#]/u.test(normalized)) {
129880
- throw new TypeError(
129881
- "TraceCC asset base URL must be a directory without a query or fragment."
129882
- );
129883
- }
129884
- return normalized;
129885
- }
129886
- function normalizeWorkerUrl(value) {
129887
- const normalized = value.trim();
129888
- if (!normalized) {
129889
- throw new TypeError("TraceCC worker URL must not be empty.");
129890
- }
129891
- return normalized;
129892
- }
129893
- function descriptor2(asset) {
129894
- return {
129895
- url: asset.fileName,
129896
- integrity: asset.integrity,
129897
- mediaType: asset.mediaType,
129898
- size: asset.size,
129899
- delivery: {
129900
- mutability: "immutable",
129901
- address: "content"
129902
- }
129903
- };
129904
- }
129905
- function createTraceCCRuntimeManifest(assetBaseUrl, options = {}) {
129906
- const normalizedAssetBaseUrl = normalizeAssetBaseUrl(assetBaseUrl);
129907
- const workerUrl = normalizeWorkerUrl(
129908
- options.workerUrl ?? "/workers/cpp-worker.js"
129909
- );
129910
- const compilerWasm = descriptor2(
129911
- typedTraceCCRuntimeAssets.compilerWasm
129912
- );
129913
- return {
129914
- runtime: "cpp",
129915
- runtimeVersion: `tracecc-${TRACECC_RUNTIME_CONTENT_HASH.slice(0, 12)}`,
129916
- protocolVersion: "browser-runtime-assets-v1",
129917
- assetBaseUrl: `${normalizedAssetBaseUrl}/`,
129918
- workerFormat: "module",
129919
- assets: {
129920
- worker: { url: workerUrl },
129921
- runtimeHeader: descriptor2(typedTraceCCRuntimeAssets.runtimeHeader),
129922
- compilerWasm,
129923
- linkerWasm: compilerWasm,
129924
- sysroot: descriptor2(typedTraceCCRuntimeAssets.sysroot),
129925
- compilerResources: {
129926
- "tracecc-narrow-pch": descriptor2(
129927
- typedTraceCCRuntimeAssets.narrowPch
129928
- ),
129929
- "tracecc-narrow-pch-source": descriptor2(
129930
- typedTraceCCRuntimeAssets.narrowPchSource
129931
- ),
129932
- "tracecc-narrow-runtime-object": descriptor2(
129933
- typedTraceCCRuntimeAssets.narrowRuntimeObject
129934
- ),
129935
- "tracecc-broad-pch": descriptor2(
129936
- typedTraceCCRuntimeAssets.broadPch
129937
- ),
129938
- "tracecc-broad-pch-source": descriptor2(
129939
- typedTraceCCRuntimeAssets.broadPchSource
129940
- ),
129941
- "tracecc-broad-runtime-object": descriptor2(
129942
- typedTraceCCRuntimeAssets.broadRuntimeObject
129943
- ),
129944
- "tracecc-map-pch": descriptor2(
129945
- typedTraceCCRuntimeAssets.mapPch
129946
- ),
129947
- "tracecc-map-pch-source": descriptor2(
129948
- typedTraceCCRuntimeAssets.mapPchSource
129949
- ),
129950
- "tracecc-map-runtime-object": descriptor2(
129951
- typedTraceCCRuntimeAssets.mapRuntimeObject
129952
- )
129953
- }
129954
- }
129955
- };
129956
- }
129957
- function resolveBuiltInTraceCCRuntimeManifest(assetBaseUrl = "/workers") {
129958
- const normalizedAssetBaseUrl = normalizeAssetBaseUrl(assetBaseUrl);
129959
- return createTraceCCRuntimeManifest(
129960
- `${normalizedAssetBaseUrl}/${TRACECC_RUNTIME_ASSET_RELATIVE_PATH}`,
129961
- { workerUrl: `${normalizedAssetBaseUrl}/cpp-worker.js` }
129962
- );
129963
- }
129964
- var TRACECC_RUNTIME_MANIFEST = resolveBuiltInTraceCCRuntimeManifest();
129965
-
129966
- // src/browser.ts
130144
+ init_tracecc_runtime_assets();
129967
130145
  function createDefaultBrowserRuntimeProviderRegistry(options) {
129968
130146
  return createBrowserRuntimeProviderRegistry([
129969
130147
  createPythonBrowserRuntimeProvider(options.python),
@@ -140188,6 +140366,18 @@ var BROWSER_PROJECT_PREWARM_PROVIDERS = Object.freeze([
140188
140366
  "cpp"
140189
140367
  ]);
140190
140368
  var BROWSER_PROJECT_INJECTED_PROVIDERS = Object.freeze(["python", "java", "csharp", "cpp"]);
140369
+ var CPP_LEGACY_ASSET_KEYS2 = Object.freeze([
140370
+ "cppWorker",
140371
+ "cppCompilerWasm",
140372
+ "cppLinkerWasm",
140373
+ "cppSysroot",
140374
+ "cppRuntimeHeader",
140375
+ "cppCompilerIntegrity"
140376
+ ]);
140377
+ function hasConfiguredCppRuntimeAssets(assets) {
140378
+ if (assets?.runtimeManifests?.cpp) return true;
140379
+ return CPP_LEGACY_ASSET_KEYS2.some((key) => assets?.[key] !== void 0);
140380
+ }
140191
140381
  function normalizeBrowserProjectProviders(providers) {
140192
140382
  const normalized = [];
140193
140383
  for (const provider of providers ?? DEFAULT_BROWSER_PROJECT_PROVIDERS) {
@@ -140664,11 +140854,25 @@ async function createBrowserProjectWorkspace(options = {}) {
140664
140854
  hasProvider("cpp") ? Promise.all([
140665
140855
  Promise.resolve().then(() => (init_project_browser5(), project_browser_exports5)),
140666
140856
  Promise.resolve().then(() => (init_cpp_worker_client(), cpp_worker_client_exports)),
140667
- Promise.resolve().then(() => (init_browser_runtime_provider(), browser_runtime_provider_exports))
140857
+ Promise.resolve().then(() => (init_browser_runtime_provider(), browser_runtime_provider_exports)),
140858
+ Promise.resolve().then(() => (init_tracecc_runtime_assets(), tracecc_runtime_assets_exports))
140668
140859
  ]) : void 0
140669
140860
  ]);
140670
140861
  const { createRuntimeWorkspace: createRuntimeWorkspace2 } = await projectRuntimePromise;
140671
- const assets = resolveBrowserRuntimeAssets(options);
140862
+ const configuredAssets = options.assets;
140863
+ const assets = resolveBrowserRuntimeAssets({
140864
+ ...options,
140865
+ ...cppProvider && runtimeProviders.cpp === void 0 && !hasConfiguredCppRuntimeAssets(configuredAssets) ? {
140866
+ assets: {
140867
+ ...configuredAssets,
140868
+ runtimeAssetProvider(runtime3) {
140869
+ return configuredAssets?.runtimeAssetProvider?.(runtime3) ?? (runtime3 === "cpp" ? cppProvider[3].resolveBuiltInTraceCCProjectRuntimeManifest(
140870
+ options.assetBaseUrl ?? "/workers"
140871
+ ) : void 0);
140872
+ }
140873
+ }
140874
+ } : {}
140875
+ });
140672
140876
  const runtimeAssetPreflight = createBrowserRuntimeAssetPreflight(assets.runtimeManifests);
140673
140877
  const pythonManifest = assets.runtimeManifests?.python;
140674
140878
  const pythonAsset = (name) => {
@@ -140693,6 +140897,7 @@ async function createBrowserProjectWorkspace(options = {}) {
140693
140897
  runtimeProviders: _runtimeProviders,
140694
140898
  java,
140695
140899
  javaRuntimeAssetBaseUrl,
140900
+ javaProjectWorkerUrl,
140696
140901
  executionHost: executionHostOptions,
140697
140902
  nodeProject,
140698
140903
  typescriptProject,
@@ -140860,7 +141065,8 @@ async function createBrowserProjectWorkspace(options = {}) {
140860
141065
  const builtInJavaFactory = hasProvider("java") && !java && !injectedJavaProvider && builtInJavaAvailable && javaProvider ? javaProvider[2].createJavaProjectClientFactory({
140861
141066
  runtimeAssetBaseUrl: javaRuntimeAssetBaseUrl ?? javaProvider[2].resolveBuiltInTraceJVMRuntimeAssetBaseUrl(
140862
141067
  options.assetBaseUrl ?? "/workers"
140863
- )
141068
+ ),
141069
+ workerUrl: javaProjectWorkerUrl ?? `${javaProvider[2].resolveBuiltInTraceJVMRuntimeAssetBaseUrl()}/browser-worker.js`
140864
141070
  }) : void 0;
140865
141071
  if (builtInJavaFactory) ownedWorkers.push(builtInJavaFactory);
140866
141072
  const builtInJava = builtInJavaFactory ? {