@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
@@ -13521,7 +13521,7 @@ var init_package = __esm({
13521
13521
  "package.json"() {
13522
13522
  package_default = {
13523
13523
  name: "@tracecode/harness",
13524
- version: "0.16.1",
13524
+ version: "0.16.3",
13525
13525
  license: "AGPL-3.0-only",
13526
13526
  homepage: "https://tracecode.app",
13527
13527
  repository: {
@@ -13791,7 +13791,7 @@ var init_runtime_language_info_data = __esm({
13791
13791
  "versionLabel": "Python 3.13.2",
13792
13792
  "executionPlatform": {
13793
13793
  "name": "TraceKernel",
13794
- "version": "0.16.1"
13794
+ "version": "0.16.3"
13795
13795
  },
13796
13796
  "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.",
13797
13797
  "runtime": {
@@ -13818,7 +13818,7 @@ var init_runtime_language_info_data = __esm({
13818
13818
  "versionLabel": "JavaScript (ECMAScript 2023)",
13819
13819
  "executionPlatform": {
13820
13820
  "name": "TraceKernel",
13821
- "version": "0.16.1"
13821
+ "version": "0.16.3"
13822
13822
  },
13823
13823
  "runtime": {
13824
13824
  "name": "TraceKernel JavaScript runtime",
@@ -13910,7 +13910,7 @@ Binary Search Tree, Trie, and Graph are bundled too, but are not exposed globall
13910
13910
  "versionLabel": "TypeScript 5.9.3",
13911
13911
  "executionPlatform": {
13912
13912
  "name": "TraceKernel",
13913
- "version": "0.16.1"
13913
+ "version": "0.16.3"
13914
13914
  },
13915
13915
  "description": `TypeScript 5.9.3 is compiled with the TypeScript compiler and executed by TraceKernel's JavaScript runtime.
13916
13916
 
@@ -14010,7 +14010,7 @@ The compiled output runs on the same TraceKernel execution lane as JavaScript su
14010
14010
  "versionLabel": "Java 23",
14011
14011
  "executionPlatform": {
14012
14012
  "name": "TraceKernel",
14013
- "version": "0.16.1"
14013
+ "version": "0.16.3"
14014
14014
  },
14015
14015
  "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.",
14016
14016
  "runtime": {
@@ -14047,7 +14047,7 @@ The compiled output runs on the same TraceKernel execution lane as JavaScript su
14047
14047
  "versionLabel": "C# 14",
14048
14048
  "executionPlatform": {
14049
14049
  "name": "TraceKernel",
14050
- "version": "0.16.1"
14050
+ "version": "0.16.3"
14051
14051
  },
14052
14052
  "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.",
14053
14053
  "runtime": {
@@ -14076,7 +14076,7 @@ The compiled output runs on the same TraceKernel execution lane as JavaScript su
14076
14076
  "versionLabel": "C++23",
14077
14077
  "executionPlatform": {
14078
14078
  "name": "TraceKernel",
14079
- "version": "0.16.1"
14079
+ "version": "0.16.3"
14080
14080
  },
14081
14081
  "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.",
14082
14082
  "runtime": {
@@ -14241,7 +14241,7 @@ var init_runtime_open_source_info_data = __esm({
14241
14241
  {
14242
14242
  "kind": "modifications",
14243
14243
  "label": "Runtime modifications",
14244
- "url": "https://github.com/tracecodeapp/harness/tree/v0.16.1/workers/python/pyodide-0.29.3"
14244
+ "url": "https://github.com/tracecodeapp/harness/tree/v0.16.3/workers/python/pyodide-0.29.3"
14245
14245
  }
14246
14246
  ]
14247
14247
  }
@@ -89584,20 +89584,27 @@ var init_terminal_session = __esm({
89584
89584
  signalCharacter === "" ? "SIGINT" : "SIGQUIT"
89585
89585
  );
89586
89586
  }
89587
- const route = this.options.terminalInputRouter?.write(data) ?? (this.activeStdinPipe !== null ? "legacy" : "rejected");
89587
+ const routed = this.options.terminalInputRouter?.write(data);
89588
+ const route = routed === "rejected" && this.activeStdinPipe !== null ? "legacy" : routed ?? (this.activeStdinPipe !== null ? "legacy" : "rejected");
89588
89589
  if (route === "legacy") {
89589
- this.activeStdinPipe?.write(data);
89590
+ if (!this.activeStdinPipe) return false;
89591
+ try {
89592
+ this.activeStdinPipe.write(data);
89593
+ } catch {
89594
+ return false;
89595
+ }
89590
89596
  }
89591
89597
  const accepted = route !== "rejected";
89592
89598
  if (accepted && this.currentInputState.mode === "stdin") {
89593
89599
  this.activeStdinPrompt = "";
89594
- this.setInputState("busy", "stdin-submit");
89600
+ this.setInputState("stdin", "stdin-submit", "");
89595
89601
  }
89596
89602
  return accepted;
89597
89603
  }
89598
89604
  endStdin() {
89599
89605
  if (!this.activeRun || this.activeStdinEnded) return false;
89600
- const route = this.options.terminalInputRouter?.end() ?? (this.activeStdinPipe !== null ? "legacy" : "rejected");
89606
+ const routed = this.options.terminalInputRouter?.end();
89607
+ const route = routed === "rejected" && this.activeStdinPipe !== null ? "legacy" : routed ?? (this.activeStdinPipe !== null ? "legacy" : "rejected");
89601
89608
  if (route === "rejected") return false;
89602
89609
  this.activeStdinEnded = true;
89603
89610
  if (route === "legacy") {
@@ -89636,6 +89643,14 @@ var init_terminal_session = __esm({
89636
89643
  this.emitTerminalEvent(reason);
89637
89644
  return this.currentInputState;
89638
89645
  }
89646
+ showForegroundInputLine() {
89647
+ const acceptsInput = this.activeStdinPipe !== null || this.options.terminalInputRouter !== void 0;
89648
+ return this.setInputState(
89649
+ acceptsInput ? "stdin" : "busy",
89650
+ "command-start",
89651
+ acceptsInput ? "" : this.prompt.text
89652
+ );
89653
+ }
89639
89654
  async run(command, options = {}) {
89640
89655
  const trimmed = command.trim();
89641
89656
  if (!trimmed) return { stdout: "", stderr: "", exitCode: 0 };
@@ -89690,7 +89705,7 @@ var init_terminal_session = __esm({
89690
89705
  this.activeTerminalEventHandler = options.onTerminalEvent;
89691
89706
  this.activeStdinPrompt = "";
89692
89707
  this.activeCommand = submittedCommand;
89693
- this.setInputState("busy", "command-start");
89708
+ this.showForegroundInputLine();
89694
89709
  try {
89695
89710
  let stdout = "";
89696
89711
  let stderr = "";
@@ -89719,6 +89734,7 @@ var init_terminal_session = __esm({
89719
89734
  ...error ? { error } : {}
89720
89735
  };
89721
89736
  } finally {
89737
+ this.options.terminalInputRouter?.reset();
89722
89738
  ownedStdinPipe?.close();
89723
89739
  this.activeStdinPipe = previousStdinPipe;
89724
89740
  this.activeStdinEnded = previousStdinEnded;
@@ -89757,7 +89773,7 @@ var init_terminal_session = __esm({
89757
89773
  this.activeStdinPrompt = "";
89758
89774
  this.activeCommand = trimmed;
89759
89775
  this.activeCommandAbortController = commandAbortController;
89760
- this.setInputState("busy", "command-start");
89776
+ this.showForegroundInputLine();
89761
89777
  try {
89762
89778
  const result = await this.runForegroundTerminalCommand(
89763
89779
  trimmed,
@@ -89768,6 +89784,7 @@ var init_terminal_session = __esm({
89768
89784
  return result;
89769
89785
  } finally {
89770
89786
  options.signal?.removeEventListener("abort", forwardExternalAbort);
89787
+ this.options.terminalInputRouter?.reset();
89771
89788
  ownedStdinPipe?.close();
89772
89789
  this.activeStdinPipe = previousStdinPipe;
89773
89790
  this.activeStdinEnded = previousStdinEnded;
@@ -95602,21 +95619,26 @@ function createWorkspaceRuntimeRunnerBridge2(bridge) {
95602
95619
  ...requestWithoutLegacyStdin
95603
95620
  } = request;
95604
95621
  const activeStdinPipe = request.source !== "compile" && request.source !== "stdin" ? commandContext?.stdinPipe : void 0;
95622
+ const consumesLiveStdin = request.source !== "compile" && request.source !== "stdin";
95605
95623
  const stdinPipe = request.stdinPipe ?? activeStdinPipe;
95606
- const processBinding = commandContext ? bridge.bindProcess(commandContext, descriptorStdio) : {};
95624
+ const processBinding = commandContext ? bridge.bindProcess(
95625
+ commandContext,
95626
+ descriptorStdio,
95627
+ consumesLiveStdin
95628
+ ) : {};
95607
95629
  const signal = processBinding.signal ?? request.signal;
95608
95630
  const runtimeIo = commandContext?.runtimeIo;
95609
95631
  let acceptingRunnerEvents = true;
95610
95632
  let result;
95611
95633
  const kernelSyscalls = options.kernelSyscalls ? bridge.createKernelSyscallBridge(commandContext) : void 0;
95612
- if (descriptorStdio && commandContext) {
95634
+ if (descriptorStdio && commandContext && consumesLiveStdin) {
95613
95635
  bridge.startHostStandardInputPump(commandContext);
95614
95636
  }
95615
95637
  try {
95616
- result = await runner({
95617
- ...descriptorStdio ? requestWithoutLegacyStdin : request,
95638
+ const execution = runner({
95639
+ ...descriptorStdio || !consumesLiveStdin ? requestWithoutLegacyStdin : request,
95618
95640
  ...processBinding.process ? { process: processBinding.process } : {},
95619
- ...stdinPipe && !descriptorStdio ? { stdinPipe: { buffer: stdinPipe.buffer } } : {},
95641
+ ...stdinPipe && !descriptorStdio && consumesLiveStdin ? { stdinPipe: { buffer: stdinPipe.buffer } } : {},
95620
95642
  ...commandContext?.terminal ? { terminal: commandContext.terminal } : {},
95621
95643
  ...commandContext?.engineLease ? { engineLease: commandContext.engineLease } : {},
95622
95644
  ...signal ? { signal } : {},
@@ -95628,6 +95650,8 @@ function createWorkspaceRuntimeRunnerBridge2(bridge) {
95628
95650
  bridge.handleRuntimeCommandEvent(event, commandContext);
95629
95651
  }
95630
95652
  });
95653
+ await processBinding.replayStartupInput?.();
95654
+ result = await execution;
95631
95655
  } finally {
95632
95656
  acceptingRunnerEvents = false;
95633
95657
  kernelSyscalls?.close();
@@ -96671,7 +96695,7 @@ async function createRuntimeWorkspace2(options = {}) {
96671
96695
  }
96672
96696
  return workspace;
96673
96697
  }
96674
- var PRINCIPAL_ACTOR4, RUNTIME_ACTOR2, SYSTEM_ACTOR4, TRACEKERNEL_SYSCALL_ERROR_CODES2, TRACEKERNEL_ZOMBIE_RETENTION_MS2, RuntimeProjectWorkspace2;
96698
+ var PRINCIPAL_ACTOR4, RUNTIME_ACTOR2, SYSTEM_ACTOR4, TERMINAL_STARTUP_INPUT_MAX_BYTES2, TRACEKERNEL_SYSCALL_ERROR_CODES2, TRACEKERNEL_ZOMBIE_RETENTION_MS2, RuntimeProjectWorkspace2;
96675
96699
  var init_runtime_project_workspace = __esm({
96676
96700
  "packages/tracekernel/src/workspace/runtime-project-workspace.ts"() {
96677
96701
  "use strict";
@@ -96721,6 +96745,7 @@ var init_runtime_project_workspace = __esm({
96721
96745
  PRINCIPAL_ACTOR4 = runtimeWorkspaceActorPreset("principal");
96722
96746
  RUNTIME_ACTOR2 = runtimeWorkspaceActorPreset("runtime");
96723
96747
  SYSTEM_ACTOR4 = runtimeWorkspaceActorPreset("system");
96748
+ TERMINAL_STARTUP_INPUT_MAX_BYTES2 = 64 * 1024 - 1;
96724
96749
  TRACEKERNEL_SYSCALL_ERROR_CODES2 = /* @__PURE__ */ new Set([
96725
96750
  "E2BIG",
96726
96751
  "EAGAIN",
@@ -96795,6 +96820,7 @@ var init_runtime_project_workspace = __esm({
96795
96820
  processState = new WorkspaceProcessState2();
96796
96821
  terminalShells = /* @__PURE__ */ new Map();
96797
96822
  terminalResourceIds = /* @__PURE__ */ new Map();
96823
+ pendingTerminalStartupInput = /* @__PURE__ */ new Map();
96798
96824
  processProjection;
96799
96825
  // Temporary 0.13 introspection aliases. The process state module remains
96800
96826
  // authoritative; these preserve existing hardening probes while 0.14 moves
@@ -96976,17 +97002,24 @@ var init_runtime_project_workspace = __esm({
96976
97002
  });
96977
97003
  const withEvents = createWorkspaceRuntimeRunnerBridge2({
96978
97004
  resolveCommandContext: (context2) => this.resolveCommandContext(context2),
96979
- bindProcess: (context2, descriptorStdio) => {
97005
+ bindProcess: (context2, descriptorStdio, consumesLiveStdin) => {
96980
97006
  const executionHandle = this.processProjection.executionHandle(
96981
97007
  context2.process
96982
97008
  );
96983
97009
  if (executionHandle) {
96984
97010
  executionHandle.descriptorStdio = descriptorStdio;
97011
+ executionHandle.consumesLiveStdin = consumesLiveStdin;
96985
97012
  }
96986
97013
  const processSnapshot = this.processProjection.authoritativeSnapshot(
96987
97014
  context2.process
96988
97015
  );
96989
97016
  return {
97017
+ replayStartupInput: () => this.resolvePendingTerminalStartupInput(
97018
+ context2.process.pid,
97019
+ descriptorStdio,
97020
+ context2.stdinPipe,
97021
+ consumesLiveStdin
97022
+ ),
96990
97023
  ...executionHandle?.abortController?.signal ? { signal: executionHandle.abortController.signal } : {},
96991
97024
  ...executionHandle?.signalChannel ? { kernelSignals: executionHandle.signalChannel } : {},
96992
97025
  ...processSnapshot ? {
@@ -99534,24 +99567,106 @@ var init_runtime_project_workspace = __esm({
99534
99567
  )
99535
99568
  );
99536
99569
  }
99537
- kernelTerminalInputRoute(terminal) {
99570
+ kernelTerminalInputRoute(terminalSessionId, terminal) {
99538
99571
  const hasDescriptorConsumer = this.traceKernelAuthority?.session.processSnapshots().some(
99539
- (process4) => process4.sid === terminal.sessionId && process4.pgid === terminal.foregroundProcessGroupId && this.processState.executionHandles.get(process4.pid)?.descriptorStdio === true
99572
+ (process4) => process4.sid === terminal.sessionId && process4.pgid === terminal.foregroundProcessGroupId && this.processState.executionHandles.get(process4.pid)?.descriptorStdio === true && this.processState.executionHandles.get(process4.pid)?.consumesLiveStdin === true
99540
99573
  ) === true;
99541
- return hasDescriptorConsumer ? "kernel" : "legacy";
99574
+ if (hasDescriptorConsumer) return "kernel";
99575
+ const foregroundPid = this.processState.terminalForeground.get(
99576
+ terminalSessionId
99577
+ );
99578
+ if (foregroundPid === void 0) return "pending";
99579
+ const executionHandle = this.processState.executionHandles.get(foregroundPid);
99580
+ if (executionHandle?.consumesLiveStdin !== true) return "pending";
99581
+ const descriptorStdio = executionHandle.descriptorStdio;
99582
+ return descriptorStdio === void 0 ? "pending" : descriptorStdio ? "kernel" : "legacy";
99583
+ }
99584
+ queueTerminalStartupInput(terminalSessionId, input = {}) {
99585
+ const pending2 = this.pendingTerminalStartupInput.get(terminalSessionId) ?? {
99586
+ chunks: [],
99587
+ byteLength: 0,
99588
+ eof: false
99589
+ };
99590
+ if (input.data) {
99591
+ const byteLength = new TextEncoder().encode(input.data).byteLength;
99592
+ if (pending2.byteLength + byteLength > TERMINAL_STARTUP_INPUT_MAX_BYTES2) {
99593
+ return false;
99594
+ }
99595
+ pending2.chunks.push(input.data);
99596
+ pending2.byteLength += byteLength;
99597
+ }
99598
+ if (input.eof) pending2.eof = true;
99599
+ this.pendingTerminalStartupInput.set(terminalSessionId, pending2);
99600
+ return true;
99542
99601
  }
99543
- writeKernelTerminalInput(terminalSessionId, data) {
99602
+ async resolvePendingTerminalStartupInput(foregroundPid, descriptorStdio, stdinPipe, consumesLiveStdin = true) {
99603
+ const boundProcess = this.processProjection.find(foregroundPid);
99604
+ const boundSnapshot = boundProcess ? this.processProjection.authoritativeSnapshot(boundProcess) : void 0;
99605
+ const terminalSessionId = [...this.processState.terminalForeground].find(([, pid]) => {
99606
+ if (pid === foregroundPid) return true;
99607
+ const terminalProcess = this.processProjection.find(pid);
99608
+ const terminalSnapshot = terminalProcess ? this.processProjection.authoritativeSnapshot(terminalProcess) : void 0;
99609
+ return Boolean(
99610
+ boundSnapshot && terminalSnapshot && boundSnapshot.pgid === terminalSnapshot.pgid
99611
+ );
99612
+ })?.[0];
99613
+ if (!terminalSessionId) return;
99614
+ const pending2 = this.pendingTerminalStartupInput.get(terminalSessionId);
99615
+ if (!pending2) return;
99616
+ if (!consumesLiveStdin) return;
99617
+ this.pendingTerminalStartupInput.delete(terminalSessionId);
99618
+ if (!descriptorStdio) {
99619
+ if (!stdinPipe) return;
99620
+ try {
99621
+ for (const chunk2 of pending2.chunks) stdinPipe.write(chunk2);
99622
+ if (pending2.eof) stdinPipe.close();
99623
+ } catch {
99624
+ stdinPipe.close();
99625
+ }
99626
+ return;
99627
+ }
99544
99628
  const authority = this.traceKernelAuthority;
99545
99629
  const terminalId = this.terminalResourceIds.get(terminalSessionId);
99546
99630
  const terminal = terminalId === void 0 ? void 0 : authority?.session.terminalSnapshots().find(
99547
99631
  (candidate) => candidate.id === terminalId
99548
99632
  );
99549
- if (!authority || !terminal || terminal.closed) return "rejected";
99633
+ if (!authority || !terminal || terminal.closed) return;
99634
+ const bytes = new TextEncoder().encode(pending2.chunks.join(""));
99635
+ await runPromise(
99636
+ gen2(function* () {
99637
+ if (bytes.byteLength > 0) {
99638
+ yield* authority.session.writeTerminalInput(terminal.id, bytes);
99639
+ }
99640
+ if (pending2.eof) {
99641
+ yield* authority.session.sendTerminalInputEof(terminal.id);
99642
+ }
99643
+ }).pipe(catchAll2(() => _void))
99644
+ );
99645
+ }
99646
+ discardPendingTerminalStartupInput(terminalSessionId, foregroundPid) {
99647
+ if (terminalSessionId && (foregroundPid === void 0 || this.processState.terminalForeground.get(terminalSessionId) === foregroundPid)) {
99648
+ this.pendingTerminalStartupInput.delete(terminalSessionId);
99649
+ }
99650
+ }
99651
+ writeKernelTerminalInput(terminalSessionId, data) {
99550
99652
  const signalByte = new TextEncoder().encode(data).find(
99551
99653
  (byte) => byte === 3 || byte === 28
99552
99654
  );
99553
- if (signalByte === void 0 && this.kernelTerminalInputRoute(terminal) === "legacy") {
99554
- return "legacy";
99655
+ const authority = this.traceKernelAuthority;
99656
+ const terminalId = this.terminalResourceIds.get(terminalSessionId);
99657
+ const terminal = terminalId === void 0 ? void 0 : authority?.session.terminalSnapshots().find(
99658
+ (candidate) => candidate.id === terminalId
99659
+ );
99660
+ if (!authority || !terminal || terminal.closed) {
99661
+ if (signalByte !== void 0) return "rejected";
99662
+ return this.queueTerminalStartupInput(terminalSessionId, { data }) ? "pending" : "rejected";
99663
+ }
99664
+ if (signalByte === void 0) {
99665
+ const route = this.kernelTerminalInputRoute(terminalSessionId, terminal);
99666
+ if (route === "pending") {
99667
+ return this.queueTerminalStartupInput(terminalSessionId, { data }) ? "pending" : "rejected";
99668
+ }
99669
+ if (route === "legacy") return "legacy";
99555
99670
  }
99556
99671
  if (signalByte !== void 0) {
99557
99672
  const signal = signalByte === 3 ? "SIGINT" : "SIGQUIT";
@@ -99581,8 +99696,16 @@ var init_runtime_project_workspace = __esm({
99581
99696
  const terminal = terminalId === void 0 ? void 0 : authority?.session.terminalSnapshots().find(
99582
99697
  (candidate) => candidate.id === terminalId
99583
99698
  );
99584
- if (!authority || !terminal || terminal.closed) return "rejected";
99585
- if (this.kernelTerminalInputRoute(terminal) === "legacy") return "legacy";
99699
+ if (!authority || !terminal || terminal.closed) {
99700
+ this.queueTerminalStartupInput(terminalSessionId, { eof: true });
99701
+ return "pending";
99702
+ }
99703
+ const route = this.kernelTerminalInputRoute(terminalSessionId, terminal);
99704
+ if (route === "pending") {
99705
+ this.queueTerminalStartupInput(terminalSessionId, { eof: true });
99706
+ return "pending";
99707
+ }
99708
+ if (route === "legacy") return "legacy";
99586
99709
  runFork2(
99587
99710
  authority.session.sendTerminalInputEof(terminal.id).pipe(
99588
99711
  catchAll2(() => _void)
@@ -100736,6 +100859,10 @@ usage: tracekernelctl {status|reset|verbose [on|off|status]|kill <pid> [signal]|
100736
100859
  executionHandle.signalChannel?.close();
100737
100860
  this.processState.executionHandles.delete(process4.pid);
100738
100861
  if (options.terminalSessionId && this.processState.terminalForeground.get(options.terminalSessionId) === process4.pid) {
100862
+ this.discardPendingTerminalStartupInput(
100863
+ options.terminalSessionId,
100864
+ process4.pid
100865
+ );
100739
100866
  this.processState.terminalForeground.delete(options.terminalSessionId);
100740
100867
  }
100741
100868
  clearKernelSignalHandler();
@@ -100990,6 +101117,10 @@ usage: tracekernelctl {status|reset|verbose [on|off|status]|kill <pid> [signal]|
100990
101117
  executionHandle.signalChannel?.close();
100991
101118
  this.processState.executionHandles.delete(process4.pid);
100992
101119
  if (options.terminalSessionId && this.processState.terminalForeground.get(options.terminalSessionId) === process4.pid) {
101120
+ this.discardPendingTerminalStartupInput(
101121
+ options.terminalSessionId,
101122
+ process4.pid
101123
+ );
100993
101124
  this.processState.terminalForeground.delete(options.terminalSessionId);
100994
101125
  }
100995
101126
  this.observeKernelReparentedChildren(process4.pid);
@@ -101296,6 +101427,7 @@ usage: tracekernelctl {status|reset|verbose [on|off|status]|kill <pid> [signal]|
101296
101427
  const shellPromise = this.terminalShells.get(terminalSessionId);
101297
101428
  this.terminalShells.delete(terminalSessionId);
101298
101429
  this.terminalResourceIds.delete(terminalSessionId);
101430
+ this.pendingTerminalStartupInput.delete(terminalSessionId);
101299
101431
  if (!shellPromise) return;
101300
101432
  const disposal = shellPromise.then(async (shell) => {
101301
101433
  const authority = this.traceKernelAuthority;
@@ -101350,7 +101482,8 @@ usage: tracekernelctl {status|reset|verbose [on|off|status]|kill <pid> [signal]|
101350
101482
  signalForeground: (signal) => this.signalTerminalForeground(terminalSessionId, signal),
101351
101483
  terminalInputRouter: {
101352
101484
  write: (data) => this.writeKernelTerminalInput(terminalSessionId, data),
101353
- end: () => this.endKernelTerminalInput(terminalSessionId)
101485
+ end: () => this.endKernelTerminalInput(terminalSessionId),
101486
+ reset: () => this.discardPendingTerminalStartupInput(terminalSessionId)
101354
101487
  },
101355
101488
  resizeTerminal: (columns, rows) => this.resizeKernelTerminal(terminalSessionId, columns, rows),
101356
101489
  closeTerminal: () => this.closeTerminalShell(terminalSessionId),
@@ -101464,13 +101597,14 @@ usage: tracekernelctl {status|reset|verbose [on|off|status]|kill <pid> [signal]|
101464
101597
  const descriptorStdio = this.cppRunner.capabilities?.descriptorStdio === true;
101465
101598
  if (executionHandle) {
101466
101599
  executionHandle.descriptorStdio = descriptorStdio;
101600
+ executionHandle.consumesLiveStdin = true;
101467
101601
  }
101468
101602
  if (descriptorStdio) {
101469
101603
  this.startHostStandardInputPump(request.commandContext);
101470
101604
  }
101471
101605
  let result;
101472
101606
  try {
101473
- result = await this.cppRunner({
101607
+ const execution = this.cppRunner({
101474
101608
  code: "",
101475
101609
  source: "run",
101476
101610
  scriptPath,
@@ -101495,6 +101629,12 @@ usage: tracekernelctl {status|reset|verbose [on|off|status]|kill <pid> [signal]|
101495
101629
  this.handleRuntimeCommandEvent(event, request.commandContext);
101496
101630
  }
101497
101631
  });
101632
+ await this.resolvePendingTerminalStartupInput(
101633
+ request.commandContext.process.pid,
101634
+ descriptorStdio,
101635
+ request.stdinPipe
101636
+ );
101637
+ result = await execution;
101498
101638
  } finally {
101499
101639
  kernelSyscalls?.close();
101500
101640
  }
@@ -120539,6 +120679,13 @@ function normalizeBaseUrl(value) {
120539
120679
  const baseUrl = value ?? resolveBuiltInTraceJVMRuntimeAssetBaseUrl();
120540
120680
  return normalizeTraceJVMRuntimeAssetBaseUrl(baseUrl);
120541
120681
  }
120682
+ function normalizeWorkerUrl(value) {
120683
+ const workerUrl = value.trim();
120684
+ if (!workerUrl) {
120685
+ throw new TypeError("TraceJVM project Worker URL cannot be empty");
120686
+ }
120687
+ return workerUrl;
120688
+ }
120542
120689
  function createWorker(workerUrl, role) {
120543
120690
  return new Worker(workerUrl, {
120544
120691
  type: "module",
@@ -120547,7 +120694,9 @@ function createWorker(workerUrl, role) {
120547
120694
  }
120548
120695
  function createJavaProjectClientFactory(options = {}) {
120549
120696
  const runtimeAssetBaseUrl = normalizeBaseUrl(options.runtimeAssetBaseUrl);
120550
- const workerUrl = `${runtimeAssetBaseUrl}/browser-worker.js`;
120697
+ const workerUrl = normalizeWorkerUrl(
120698
+ options.workerUrl ?? `${runtimeAssetBaseUrl}/browser-worker.js`
120699
+ );
120551
120700
  const workerFor = (role) => options.createWorker?.(workerUrl, role) ?? createWorker(workerUrl, role);
120552
120701
  const runtimeProfile = options.runtimeProfile ?? "spring-server";
120553
120702
  const runtimeProfileBaseUrls = {
@@ -122642,7 +122791,6 @@ var init_cpp_worker_client = __esm({
122642
122791
  });
122643
122792
  }
122644
122793
  async executeProjectCpp(request, timeoutMs = this.executionTimeoutMs, onEvent, signal = request.signal, engineLease) {
122645
- engineLease?.attach({ release: () => void 0 });
122646
122794
  if (request.source === "compile" && this.options.trustedCompilerService) {
122647
122795
  const {
122648
122796
  signal: _signal,
@@ -122711,6 +122859,7 @@ var init_cpp_worker_client = __esm({
122711
122859
  }]
122712
122860
  };
122713
122861
  }
122862
+ engineLease?.attach({ release: () => void 0 });
122714
122863
  return this.runInDisposableExecutionWorker(async (lifecycleGeneration) => {
122715
122864
  const {
122716
122865
  signal: _signal,
@@ -123632,6 +123781,211 @@ var init_browser_runtime_provider = __esm({
123632
123781
  }
123633
123782
  });
123634
123783
 
123784
+ // packages/runtime-cpp/src/tracecc-runtime-assets.generated.ts
123785
+ var TRACECC_RUNTIME_CONTENT_HASH, TRACECC_RUNTIME_ASSETS;
123786
+ var init_tracecc_runtime_assets_generated = __esm({
123787
+ "packages/runtime-cpp/src/tracecc-runtime-assets.generated.ts"() {
123788
+ "use strict";
123789
+ TRACECC_RUNTIME_CONTENT_HASH = "fb4b6f41f9e9b7db89b6c8425bb2c6218979219a4150f96619b6461b4b78d294";
123790
+ TRACECC_RUNTIME_ASSETS = Object.freeze({
123791
+ "runtimeHeader": {
123792
+ "fileName": "tracecode_runtime.hpp",
123793
+ "integrity": "sha256-WEbB8mLN8cwKIWPf25UL7yoTSM9nCqWs8MkE0B14EtE=",
123794
+ "mediaType": "text/plain",
123795
+ "size": 263083
123796
+ },
123797
+ "compilerWasm": {
123798
+ "fileName": "tracecc-reactor.wasm",
123799
+ "integrity": "sha256-At40hCU4Rmvynp1s8UzQ1eX/UZybo5BWHMsVgQXUTUE=",
123800
+ "mediaType": "application/wasm",
123801
+ "size": 33478188
123802
+ },
123803
+ "sysroot": {
123804
+ "fileName": "llvm-resources.tar",
123805
+ "integrity": "sha256-2V0qK8hAihbAdEmWrEfJG7PGO7cblDFcl5YIm23ahVU=",
123806
+ "mediaType": "application/x-tar",
123807
+ "size": 29112320
123808
+ },
123809
+ "narrowPch": {
123810
+ "fileName": "narrow.pch",
123811
+ "integrity": "sha256-rbuVm7YeO+HwDpSJPAqGGNrrPKeJveazS/juUWXs5/A=",
123812
+ "mediaType": "application/octet-stream",
123813
+ "size": 21322216
123814
+ },
123815
+ "narrowPchSource": {
123816
+ "fileName": "narrow.source.hpp",
123817
+ "integrity": "sha256-SMqxQfcMBSUHUcAz+7Cp4vkWyOtgv7mNB09JE1cOEAU=",
123818
+ "mediaType": "text/plain",
123819
+ "size": 815
123820
+ },
123821
+ "narrowRuntimeObject": {
123822
+ "fileName": "narrow.o",
123823
+ "integrity": "sha256-il/wX66FvAU9SJSiDepMuEZ00CipED4EEEfqcdxEg8c=",
123824
+ "mediaType": "application/wasm",
123825
+ "size": 1042570
123826
+ },
123827
+ "broadPch": {
123828
+ "fileName": "broad.pch",
123829
+ "integrity": "sha256-ktKxBSglo50GPM9GJJwBpqyYDcFHkKGjoyEtsUmLMrI=",
123830
+ "mediaType": "application/octet-stream",
123831
+ "size": 24543552
123832
+ },
123833
+ "broadPchSource": {
123834
+ "fileName": "broad.source.hpp",
123835
+ "integrity": "sha256-MOayycWl5KYaLS8vP2MoJh4kazsDhg0kH9Bi6dvsy0s=",
123836
+ "mediaType": "text/plain",
123837
+ "size": 7095
123838
+ },
123839
+ "broadRuntimeObject": {
123840
+ "fileName": "broad.o",
123841
+ "integrity": "sha256-f69Oe7kRn9JEIUEPgM1cuYbf50oph4IxEnVP7VIZGp4=",
123842
+ "mediaType": "application/wasm",
123843
+ "size": 1892879
123844
+ },
123845
+ "mapPch": {
123846
+ "fileName": "map.pch",
123847
+ "integrity": "sha256-fX7zTmJXnRJ2acbDiJ4Wu7/xf1G510SB2fLzkTgr2Uc=",
123848
+ "mediaType": "application/octet-stream",
123849
+ "size": 29951380
123850
+ },
123851
+ "mapPchSource": {
123852
+ "fileName": "map.source.hpp",
123853
+ "integrity": "sha256-WHaMpx3nG/h1ro6CppBseoDIkgqahbYnFxShHLGT9/c=",
123854
+ "mediaType": "text/plain",
123855
+ "size": 10708
123856
+ },
123857
+ "mapRuntimeObject": {
123858
+ "fileName": "map.o",
123859
+ "integrity": "sha256-02ktvX6uqV05it5kdBEm/ncOszBeO43wX93Yk079E4U=",
123860
+ "mediaType": "application/wasm",
123861
+ "size": 3372458
123862
+ }
123863
+ });
123864
+ }
123865
+ });
123866
+
123867
+ // packages/runtime-cpp/src/tracecc-runtime-assets.ts
123868
+ var tracecc_runtime_assets_exports = {};
123869
+ __export(tracecc_runtime_assets_exports, {
123870
+ TRACECC_RUNTIME_ASSET_RELATIVE_PATH: () => TRACECC_RUNTIME_ASSET_RELATIVE_PATH,
123871
+ TRACECC_RUNTIME_CONTENT_HASH: () => TRACECC_RUNTIME_CONTENT_HASH,
123872
+ TRACECC_RUNTIME_MANIFEST: () => TRACECC_RUNTIME_MANIFEST,
123873
+ createTraceCCRuntimeManifest: () => createTraceCCRuntimeManifest,
123874
+ resolveBuiltInTraceCCProjectRuntimeManifest: () => resolveBuiltInTraceCCProjectRuntimeManifest,
123875
+ resolveBuiltInTraceCCRuntimeManifest: () => resolveBuiltInTraceCCRuntimeManifest
123876
+ });
123877
+ function stripTrailingSlash3(value) {
123878
+ return value.replace(/\/+$/, "");
123879
+ }
123880
+ function normalizeAssetBaseUrl(value) {
123881
+ const normalized = stripTrailingSlash3(value.trim());
123882
+ if (!normalized) {
123883
+ throw new TypeError("TraceCC requires a non-empty asset base URL.");
123884
+ }
123885
+ if (/[?#]/u.test(normalized)) {
123886
+ throw new TypeError(
123887
+ "TraceCC asset base URL must be a directory without a query or fragment."
123888
+ );
123889
+ }
123890
+ return normalized;
123891
+ }
123892
+ function normalizeWorkerUrl2(value) {
123893
+ const normalized = value.trim();
123894
+ if (!normalized) {
123895
+ throw new TypeError("TraceCC worker URL must not be empty.");
123896
+ }
123897
+ return normalized;
123898
+ }
123899
+ function descriptor2(asset) {
123900
+ return {
123901
+ url: asset.fileName,
123902
+ integrity: asset.integrity,
123903
+ mediaType: asset.mediaType,
123904
+ size: asset.size,
123905
+ delivery: {
123906
+ mutability: "immutable",
123907
+ address: "content"
123908
+ }
123909
+ };
123910
+ }
123911
+ function createTraceCCRuntimeManifest(assetBaseUrl, options = {}) {
123912
+ const normalizedAssetBaseUrl = normalizeAssetBaseUrl(assetBaseUrl);
123913
+ const workerUrl = normalizeWorkerUrl2(
123914
+ options.workerUrl ?? "/workers/cpp-worker.js"
123915
+ );
123916
+ const compilerWasm = descriptor2(
123917
+ typedTraceCCRuntimeAssets.compilerWasm
123918
+ );
123919
+ return {
123920
+ runtime: "cpp",
123921
+ runtimeVersion: `tracecc-${TRACECC_RUNTIME_CONTENT_HASH.slice(0, 12)}`,
123922
+ protocolVersion: "browser-runtime-assets-v1",
123923
+ assetBaseUrl: `${normalizedAssetBaseUrl}/`,
123924
+ workerFormat: "module",
123925
+ assets: {
123926
+ worker: { url: workerUrl },
123927
+ runtimeHeader: descriptor2(typedTraceCCRuntimeAssets.runtimeHeader),
123928
+ compilerWasm,
123929
+ linkerWasm: compilerWasm,
123930
+ sysroot: descriptor2(typedTraceCCRuntimeAssets.sysroot),
123931
+ compilerResources: {
123932
+ "tracecc-narrow-pch": descriptor2(
123933
+ typedTraceCCRuntimeAssets.narrowPch
123934
+ ),
123935
+ "tracecc-narrow-pch-source": descriptor2(
123936
+ typedTraceCCRuntimeAssets.narrowPchSource
123937
+ ),
123938
+ "tracecc-narrow-runtime-object": descriptor2(
123939
+ typedTraceCCRuntimeAssets.narrowRuntimeObject
123940
+ ),
123941
+ "tracecc-broad-pch": descriptor2(
123942
+ typedTraceCCRuntimeAssets.broadPch
123943
+ ),
123944
+ "tracecc-broad-pch-source": descriptor2(
123945
+ typedTraceCCRuntimeAssets.broadPchSource
123946
+ ),
123947
+ "tracecc-broad-runtime-object": descriptor2(
123948
+ typedTraceCCRuntimeAssets.broadRuntimeObject
123949
+ ),
123950
+ "tracecc-map-pch": descriptor2(
123951
+ typedTraceCCRuntimeAssets.mapPch
123952
+ ),
123953
+ "tracecc-map-pch-source": descriptor2(
123954
+ typedTraceCCRuntimeAssets.mapPchSource
123955
+ ),
123956
+ "tracecc-map-runtime-object": descriptor2(
123957
+ typedTraceCCRuntimeAssets.mapRuntimeObject
123958
+ )
123959
+ }
123960
+ }
123961
+ };
123962
+ }
123963
+ function resolveBuiltInTraceCCRuntimeManifest(assetBaseUrl = "/workers") {
123964
+ const normalizedAssetBaseUrl = normalizeAssetBaseUrl(assetBaseUrl);
123965
+ return createTraceCCRuntimeManifest(
123966
+ `${normalizedAssetBaseUrl}/${TRACECC_RUNTIME_ASSET_RELATIVE_PATH}`,
123967
+ { workerUrl: `${normalizedAssetBaseUrl}/cpp-worker.js` }
123968
+ );
123969
+ }
123970
+ function resolveBuiltInTraceCCProjectRuntimeManifest(assetBaseUrl = "/workers") {
123971
+ const normalizedAssetBaseUrl = normalizeAssetBaseUrl(assetBaseUrl);
123972
+ return createTraceCCRuntimeManifest(
123973
+ `${normalizedAssetBaseUrl}/${TRACECC_RUNTIME_ASSET_RELATIVE_PATH}`,
123974
+ { workerUrl: `${normalizedAssetBaseUrl}/project-cpp-worker.js` }
123975
+ );
123976
+ }
123977
+ var TRACECC_RUNTIME_ASSET_RELATIVE_PATH, typedTraceCCRuntimeAssets, TRACECC_RUNTIME_MANIFEST;
123978
+ var init_tracecc_runtime_assets = __esm({
123979
+ "packages/runtime-cpp/src/tracecc-runtime-assets.ts"() {
123980
+ "use strict";
123981
+ init_tracecc_runtime_assets_generated();
123982
+ init_tracecc_runtime_assets_generated();
123983
+ TRACECC_RUNTIME_ASSET_RELATIVE_PATH = `cpp/tracecc/${TRACECC_RUNTIME_CONTENT_HASH}`;
123984
+ typedTraceCCRuntimeAssets = TRACECC_RUNTIME_ASSETS;
123985
+ TRACECC_RUNTIME_MANIFEST = resolveBuiltInTraceCCRuntimeManifest();
123986
+ }
123987
+ });
123988
+
123635
123989
  // src/tracekernel.ts
123636
123990
  var tracekernel_exports = {};
123637
123991
  __export(tracekernel_exports, {
@@ -123793,6 +124147,7 @@ __export(tracekernel_exports, {
123793
124147
  readRuntimeProcFile: () => readRuntimeProcFile,
123794
124148
  resolveBrowserRuntimeAssetManifests: () => resolveBrowserRuntimeAssetManifests,
123795
124149
  resolveBrowserRuntimeAssets: () => resolveBrowserRuntimeAssets,
124150
+ resolveBuiltInTraceCCProjectRuntimeManifest: () => resolveBuiltInTraceCCProjectRuntimeManifest,
123796
124151
  resolveBuiltInTraceCCRuntimeManifest: () => resolveBuiltInTraceCCRuntimeManifest,
123797
124152
  resolveRuntimeOpenSourceResourceHref: () => resolveRuntimeOpenSourceResourceHref,
123798
124153
  runRuntimeProjectWorkerBridge: () => runRuntimeProjectWorkerBridge,
@@ -204390,20 +204745,27 @@ var RuntimeProjectWorkspaceTerminalSession = class {
204390
204745
  signalCharacter === "" ? "SIGINT" : "SIGQUIT"
204391
204746
  );
204392
204747
  }
204393
- const route = this.options.terminalInputRouter?.write(data) ?? (this.activeStdinPipe !== null ? "legacy" : "rejected");
204748
+ const routed = this.options.terminalInputRouter?.write(data);
204749
+ const route = routed === "rejected" && this.activeStdinPipe !== null ? "legacy" : routed ?? (this.activeStdinPipe !== null ? "legacy" : "rejected");
204394
204750
  if (route === "legacy") {
204395
- this.activeStdinPipe?.write(data);
204751
+ if (!this.activeStdinPipe) return false;
204752
+ try {
204753
+ this.activeStdinPipe.write(data);
204754
+ } catch {
204755
+ return false;
204756
+ }
204396
204757
  }
204397
204758
  const accepted = route !== "rejected";
204398
204759
  if (accepted && this.currentInputState.mode === "stdin") {
204399
204760
  this.activeStdinPrompt = "";
204400
- this.setInputState("busy", "stdin-submit");
204761
+ this.setInputState("stdin", "stdin-submit", "");
204401
204762
  }
204402
204763
  return accepted;
204403
204764
  }
204404
204765
  endStdin() {
204405
204766
  if (!this.activeRun || this.activeStdinEnded) return false;
204406
- const route = this.options.terminalInputRouter?.end() ?? (this.activeStdinPipe !== null ? "legacy" : "rejected");
204767
+ const routed = this.options.terminalInputRouter?.end();
204768
+ const route = routed === "rejected" && this.activeStdinPipe !== null ? "legacy" : routed ?? (this.activeStdinPipe !== null ? "legacy" : "rejected");
204407
204769
  if (route === "rejected") return false;
204408
204770
  this.activeStdinEnded = true;
204409
204771
  if (route === "legacy") {
@@ -204442,6 +204804,14 @@ var RuntimeProjectWorkspaceTerminalSession = class {
204442
204804
  this.emitTerminalEvent(reason);
204443
204805
  return this.currentInputState;
204444
204806
  }
204807
+ showForegroundInputLine() {
204808
+ const acceptsInput = this.activeStdinPipe !== null || this.options.terminalInputRouter !== void 0;
204809
+ return this.setInputState(
204810
+ acceptsInput ? "stdin" : "busy",
204811
+ "command-start",
204812
+ acceptsInput ? "" : this.prompt.text
204813
+ );
204814
+ }
204445
204815
  async run(command, options = {}) {
204446
204816
  const trimmed = command.trim();
204447
204817
  if (!trimmed) return { stdout: "", stderr: "", exitCode: 0 };
@@ -204496,7 +204866,7 @@ var RuntimeProjectWorkspaceTerminalSession = class {
204496
204866
  this.activeTerminalEventHandler = options.onTerminalEvent;
204497
204867
  this.activeStdinPrompt = "";
204498
204868
  this.activeCommand = submittedCommand;
204499
- this.setInputState("busy", "command-start");
204869
+ this.showForegroundInputLine();
204500
204870
  try {
204501
204871
  let stdout = "";
204502
204872
  let stderr = "";
@@ -204525,6 +204895,7 @@ var RuntimeProjectWorkspaceTerminalSession = class {
204525
204895
  ...error ? { error } : {}
204526
204896
  };
204527
204897
  } finally {
204898
+ this.options.terminalInputRouter?.reset();
204528
204899
  ownedStdinPipe?.close();
204529
204900
  this.activeStdinPipe = previousStdinPipe;
204530
204901
  this.activeStdinEnded = previousStdinEnded;
@@ -204563,7 +204934,7 @@ var RuntimeProjectWorkspaceTerminalSession = class {
204563
204934
  this.activeStdinPrompt = "";
204564
204935
  this.activeCommand = trimmed;
204565
204936
  this.activeCommandAbortController = commandAbortController;
204566
- this.setInputState("busy", "command-start");
204937
+ this.showForegroundInputLine();
204567
204938
  try {
204568
204939
  const result = await this.runForegroundTerminalCommand(
204569
204940
  trimmed,
@@ -204574,6 +204945,7 @@ var RuntimeProjectWorkspaceTerminalSession = class {
204574
204945
  return result;
204575
204946
  } finally {
204576
204947
  options.signal?.removeEventListener("abort", forwardExternalAbort);
204948
+ this.options.terminalInputRouter?.reset();
204577
204949
  ownedStdinPipe?.close();
204578
204950
  this.activeStdinPipe = previousStdinPipe;
204579
204951
  this.activeStdinEnded = previousStdinEnded;
@@ -210201,21 +210573,26 @@ function createWorkspaceRuntimeRunnerBridge(bridge) {
210201
210573
  ...requestWithoutLegacyStdin
210202
210574
  } = request;
210203
210575
  const activeStdinPipe = request.source !== "compile" && request.source !== "stdin" ? commandContext?.stdinPipe : void 0;
210576
+ const consumesLiveStdin = request.source !== "compile" && request.source !== "stdin";
210204
210577
  const stdinPipe = request.stdinPipe ?? activeStdinPipe;
210205
- const processBinding = commandContext ? bridge.bindProcess(commandContext, descriptorStdio) : {};
210578
+ const processBinding = commandContext ? bridge.bindProcess(
210579
+ commandContext,
210580
+ descriptorStdio,
210581
+ consumesLiveStdin
210582
+ ) : {};
210206
210583
  const signal = processBinding.signal ?? request.signal;
210207
210584
  const runtimeIo = commandContext?.runtimeIo;
210208
210585
  let acceptingRunnerEvents = true;
210209
210586
  let result;
210210
210587
  const kernelSyscalls = options.kernelSyscalls ? bridge.createKernelSyscallBridge(commandContext) : void 0;
210211
- if (descriptorStdio && commandContext) {
210588
+ if (descriptorStdio && commandContext && consumesLiveStdin) {
210212
210589
  bridge.startHostStandardInputPump(commandContext);
210213
210590
  }
210214
210591
  try {
210215
- result = await runner({
210216
- ...descriptorStdio ? requestWithoutLegacyStdin : request,
210592
+ const execution = runner({
210593
+ ...descriptorStdio || !consumesLiveStdin ? requestWithoutLegacyStdin : request,
210217
210594
  ...processBinding.process ? { process: processBinding.process } : {},
210218
- ...stdinPipe && !descriptorStdio ? { stdinPipe: { buffer: stdinPipe.buffer } } : {},
210595
+ ...stdinPipe && !descriptorStdio && consumesLiveStdin ? { stdinPipe: { buffer: stdinPipe.buffer } } : {},
210219
210596
  ...commandContext?.terminal ? { terminal: commandContext.terminal } : {},
210220
210597
  ...commandContext?.engineLease ? { engineLease: commandContext.engineLease } : {},
210221
210598
  ...signal ? { signal } : {},
@@ -210227,6 +210604,8 @@ function createWorkspaceRuntimeRunnerBridge(bridge) {
210227
210604
  bridge.handleRuntimeCommandEvent(event, commandContext);
210228
210605
  }
210229
210606
  });
210607
+ await processBinding.replayStartupInput?.();
210608
+ result = await execution;
210230
210609
  } finally {
210231
210610
  acceptingRunnerEvents = false;
210232
210611
  kernelSyscalls?.close();
@@ -211104,6 +211483,7 @@ function createRuntimeWorkspaceShellCommands(options) {
211104
211483
  var PRINCIPAL_ACTOR2 = runtimeWorkspaceActorPreset("principal");
211105
211484
  var RUNTIME_ACTOR = runtimeWorkspaceActorPreset("runtime");
211106
211485
  var SYSTEM_ACTOR2 = runtimeWorkspaceActorPreset("system");
211486
+ var TERMINAL_STARTUP_INPUT_MAX_BYTES = 64 * 1024 - 1;
211107
211487
  var TRACEKERNEL_SYSCALL_ERROR_CODES = /* @__PURE__ */ new Set([
211108
211488
  "E2BIG",
211109
211489
  "EAGAIN",
@@ -211237,6 +211617,7 @@ var RuntimeProjectWorkspace = class {
211237
211617
  processState = new WorkspaceProcessState();
211238
211618
  terminalShells = /* @__PURE__ */ new Map();
211239
211619
  terminalResourceIds = /* @__PURE__ */ new Map();
211620
+ pendingTerminalStartupInput = /* @__PURE__ */ new Map();
211240
211621
  processProjection;
211241
211622
  // Temporary 0.13 introspection aliases. The process state module remains
211242
211623
  // authoritative; these preserve existing hardening probes while 0.14 moves
@@ -211418,17 +211799,24 @@ var RuntimeProjectWorkspace = class {
211418
211799
  });
211419
211800
  const withEvents = createWorkspaceRuntimeRunnerBridge({
211420
211801
  resolveCommandContext: (context2) => this.resolveCommandContext(context2),
211421
- bindProcess: (context2, descriptorStdio) => {
211802
+ bindProcess: (context2, descriptorStdio, consumesLiveStdin) => {
211422
211803
  const executionHandle = this.processProjection.executionHandle(
211423
211804
  context2.process
211424
211805
  );
211425
211806
  if (executionHandle) {
211426
211807
  executionHandle.descriptorStdio = descriptorStdio;
211808
+ executionHandle.consumesLiveStdin = consumesLiveStdin;
211427
211809
  }
211428
211810
  const processSnapshot = this.processProjection.authoritativeSnapshot(
211429
211811
  context2.process
211430
211812
  );
211431
211813
  return {
211814
+ replayStartupInput: () => this.resolvePendingTerminalStartupInput(
211815
+ context2.process.pid,
211816
+ descriptorStdio,
211817
+ context2.stdinPipe,
211818
+ consumesLiveStdin
211819
+ ),
211432
211820
  ...executionHandle?.abortController?.signal ? { signal: executionHandle.abortController.signal } : {},
211433
211821
  ...executionHandle?.signalChannel ? { kernelSignals: executionHandle.signalChannel } : {},
211434
211822
  ...processSnapshot ? {
@@ -213976,24 +214364,106 @@ var RuntimeProjectWorkspace = class {
213976
214364
  )
213977
214365
  );
213978
214366
  }
213979
- kernelTerminalInputRoute(terminal) {
214367
+ kernelTerminalInputRoute(terminalSessionId, terminal) {
213980
214368
  const hasDescriptorConsumer = this.traceKernelAuthority?.session.processSnapshots().some(
213981
- (process32) => process32.sid === terminal.sessionId && process32.pgid === terminal.foregroundProcessGroupId && this.processState.executionHandles.get(process32.pid)?.descriptorStdio === true
214369
+ (process32) => process32.sid === terminal.sessionId && process32.pgid === terminal.foregroundProcessGroupId && this.processState.executionHandles.get(process32.pid)?.descriptorStdio === true && this.processState.executionHandles.get(process32.pid)?.consumesLiveStdin === true
213982
214370
  ) === true;
213983
- return hasDescriptorConsumer ? "kernel" : "legacy";
214371
+ if (hasDescriptorConsumer) return "kernel";
214372
+ const foregroundPid = this.processState.terminalForeground.get(
214373
+ terminalSessionId
214374
+ );
214375
+ if (foregroundPid === void 0) return "pending";
214376
+ const executionHandle = this.processState.executionHandles.get(foregroundPid);
214377
+ if (executionHandle?.consumesLiveStdin !== true) return "pending";
214378
+ const descriptorStdio = executionHandle.descriptorStdio;
214379
+ return descriptorStdio === void 0 ? "pending" : descriptorStdio ? "kernel" : "legacy";
214380
+ }
214381
+ queueTerminalStartupInput(terminalSessionId, input = {}) {
214382
+ const pending2 = this.pendingTerminalStartupInput.get(terminalSessionId) ?? {
214383
+ chunks: [],
214384
+ byteLength: 0,
214385
+ eof: false
214386
+ };
214387
+ if (input.data) {
214388
+ const byteLength = new TextEncoder().encode(input.data).byteLength;
214389
+ if (pending2.byteLength + byteLength > TERMINAL_STARTUP_INPUT_MAX_BYTES) {
214390
+ return false;
214391
+ }
214392
+ pending2.chunks.push(input.data);
214393
+ pending2.byteLength += byteLength;
214394
+ }
214395
+ if (input.eof) pending2.eof = true;
214396
+ this.pendingTerminalStartupInput.set(terminalSessionId, pending2);
214397
+ return true;
213984
214398
  }
213985
- writeKernelTerminalInput(terminalSessionId, data) {
214399
+ async resolvePendingTerminalStartupInput(foregroundPid, descriptorStdio, stdinPipe, consumesLiveStdin = true) {
214400
+ const boundProcess = this.processProjection.find(foregroundPid);
214401
+ const boundSnapshot = boundProcess ? this.processProjection.authoritativeSnapshot(boundProcess) : void 0;
214402
+ const terminalSessionId = [...this.processState.terminalForeground].find(([, pid]) => {
214403
+ if (pid === foregroundPid) return true;
214404
+ const terminalProcess = this.processProjection.find(pid);
214405
+ const terminalSnapshot = terminalProcess ? this.processProjection.authoritativeSnapshot(terminalProcess) : void 0;
214406
+ return Boolean(
214407
+ boundSnapshot && terminalSnapshot && boundSnapshot.pgid === terminalSnapshot.pgid
214408
+ );
214409
+ })?.[0];
214410
+ if (!terminalSessionId) return;
214411
+ const pending2 = this.pendingTerminalStartupInput.get(terminalSessionId);
214412
+ if (!pending2) return;
214413
+ if (!consumesLiveStdin) return;
214414
+ this.pendingTerminalStartupInput.delete(terminalSessionId);
214415
+ if (!descriptorStdio) {
214416
+ if (!stdinPipe) return;
214417
+ try {
214418
+ for (const chunk2 of pending2.chunks) stdinPipe.write(chunk2);
214419
+ if (pending2.eof) stdinPipe.close();
214420
+ } catch {
214421
+ stdinPipe.close();
214422
+ }
214423
+ return;
214424
+ }
213986
214425
  const authority = this.traceKernelAuthority;
213987
214426
  const terminalId = this.terminalResourceIds.get(terminalSessionId);
213988
214427
  const terminal = terminalId === void 0 ? void 0 : authority?.session.terminalSnapshots().find(
213989
214428
  (candidate) => candidate.id === terminalId
213990
214429
  );
213991
- if (!authority || !terminal || terminal.closed) return "rejected";
214430
+ if (!authority || !terminal || terminal.closed) return;
214431
+ const bytes = new TextEncoder().encode(pending2.chunks.join(""));
214432
+ await runPromise(
214433
+ gen2(function* () {
214434
+ if (bytes.byteLength > 0) {
214435
+ yield* authority.session.writeTerminalInput(terminal.id, bytes);
214436
+ }
214437
+ if (pending2.eof) {
214438
+ yield* authority.session.sendTerminalInputEof(terminal.id);
214439
+ }
214440
+ }).pipe(catchAll2(() => _void))
214441
+ );
214442
+ }
214443
+ discardPendingTerminalStartupInput(terminalSessionId, foregroundPid) {
214444
+ if (terminalSessionId && (foregroundPid === void 0 || this.processState.terminalForeground.get(terminalSessionId) === foregroundPid)) {
214445
+ this.pendingTerminalStartupInput.delete(terminalSessionId);
214446
+ }
214447
+ }
214448
+ writeKernelTerminalInput(terminalSessionId, data) {
213992
214449
  const signalByte = new TextEncoder().encode(data).find(
213993
214450
  (byte) => byte === 3 || byte === 28
213994
214451
  );
213995
- if (signalByte === void 0 && this.kernelTerminalInputRoute(terminal) === "legacy") {
213996
- return "legacy";
214452
+ const authority = this.traceKernelAuthority;
214453
+ const terminalId = this.terminalResourceIds.get(terminalSessionId);
214454
+ const terminal = terminalId === void 0 ? void 0 : authority?.session.terminalSnapshots().find(
214455
+ (candidate) => candidate.id === terminalId
214456
+ );
214457
+ if (!authority || !terminal || terminal.closed) {
214458
+ if (signalByte !== void 0) return "rejected";
214459
+ return this.queueTerminalStartupInput(terminalSessionId, { data }) ? "pending" : "rejected";
214460
+ }
214461
+ if (signalByte === void 0) {
214462
+ const route = this.kernelTerminalInputRoute(terminalSessionId, terminal);
214463
+ if (route === "pending") {
214464
+ return this.queueTerminalStartupInput(terminalSessionId, { data }) ? "pending" : "rejected";
214465
+ }
214466
+ if (route === "legacy") return "legacy";
213997
214467
  }
213998
214468
  if (signalByte !== void 0) {
213999
214469
  const signal = signalByte === 3 ? "SIGINT" : "SIGQUIT";
@@ -214023,8 +214493,16 @@ var RuntimeProjectWorkspace = class {
214023
214493
  const terminal = terminalId === void 0 ? void 0 : authority?.session.terminalSnapshots().find(
214024
214494
  (candidate) => candidate.id === terminalId
214025
214495
  );
214026
- if (!authority || !terminal || terminal.closed) return "rejected";
214027
- if (this.kernelTerminalInputRoute(terminal) === "legacy") return "legacy";
214496
+ if (!authority || !terminal || terminal.closed) {
214497
+ this.queueTerminalStartupInput(terminalSessionId, { eof: true });
214498
+ return "pending";
214499
+ }
214500
+ const route = this.kernelTerminalInputRoute(terminalSessionId, terminal);
214501
+ if (route === "pending") {
214502
+ this.queueTerminalStartupInput(terminalSessionId, { eof: true });
214503
+ return "pending";
214504
+ }
214505
+ if (route === "legacy") return "legacy";
214028
214506
  runFork2(
214029
214507
  authority.session.sendTerminalInputEof(terminal.id).pipe(
214030
214508
  catchAll2(() => _void)
@@ -215178,6 +215656,10 @@ usage: tracekernelctl {status|reset|verbose [on|off|status]|kill <pid> [signal]|
215178
215656
  executionHandle.signalChannel?.close();
215179
215657
  this.processState.executionHandles.delete(process32.pid);
215180
215658
  if (options.terminalSessionId && this.processState.terminalForeground.get(options.terminalSessionId) === process32.pid) {
215659
+ this.discardPendingTerminalStartupInput(
215660
+ options.terminalSessionId,
215661
+ process32.pid
215662
+ );
215181
215663
  this.processState.terminalForeground.delete(options.terminalSessionId);
215182
215664
  }
215183
215665
  clearKernelSignalHandler();
@@ -215432,6 +215914,10 @@ usage: tracekernelctl {status|reset|verbose [on|off|status]|kill <pid> [signal]|
215432
215914
  executionHandle.signalChannel?.close();
215433
215915
  this.processState.executionHandles.delete(process32.pid);
215434
215916
  if (options.terminalSessionId && this.processState.terminalForeground.get(options.terminalSessionId) === process32.pid) {
215917
+ this.discardPendingTerminalStartupInput(
215918
+ options.terminalSessionId,
215919
+ process32.pid
215920
+ );
215435
215921
  this.processState.terminalForeground.delete(options.terminalSessionId);
215436
215922
  }
215437
215923
  this.observeKernelReparentedChildren(process32.pid);
@@ -215738,6 +216224,7 @@ usage: tracekernelctl {status|reset|verbose [on|off|status]|kill <pid> [signal]|
215738
216224
  const shellPromise = this.terminalShells.get(terminalSessionId);
215739
216225
  this.terminalShells.delete(terminalSessionId);
215740
216226
  this.terminalResourceIds.delete(terminalSessionId);
216227
+ this.pendingTerminalStartupInput.delete(terminalSessionId);
215741
216228
  if (!shellPromise) return;
215742
216229
  const disposal = shellPromise.then(async (shell) => {
215743
216230
  const authority = this.traceKernelAuthority;
@@ -215792,7 +216279,8 @@ usage: tracekernelctl {status|reset|verbose [on|off|status]|kill <pid> [signal]|
215792
216279
  signalForeground: (signal) => this.signalTerminalForeground(terminalSessionId, signal),
215793
216280
  terminalInputRouter: {
215794
216281
  write: (data) => this.writeKernelTerminalInput(terminalSessionId, data),
215795
- end: () => this.endKernelTerminalInput(terminalSessionId)
216282
+ end: () => this.endKernelTerminalInput(terminalSessionId),
216283
+ reset: () => this.discardPendingTerminalStartupInput(terminalSessionId)
215796
216284
  },
215797
216285
  resizeTerminal: (columns, rows) => this.resizeKernelTerminal(terminalSessionId, columns, rows),
215798
216286
  closeTerminal: () => this.closeTerminalShell(terminalSessionId),
@@ -215906,13 +216394,14 @@ usage: tracekernelctl {status|reset|verbose [on|off|status]|kill <pid> [signal]|
215906
216394
  const descriptorStdio = this.cppRunner.capabilities?.descriptorStdio === true;
215907
216395
  if (executionHandle) {
215908
216396
  executionHandle.descriptorStdio = descriptorStdio;
216397
+ executionHandle.consumesLiveStdin = true;
215909
216398
  }
215910
216399
  if (descriptorStdio) {
215911
216400
  this.startHostStandardInputPump(request.commandContext);
215912
216401
  }
215913
216402
  let result;
215914
216403
  try {
215915
- result = await this.cppRunner({
216404
+ const execution = this.cppRunner({
215916
216405
  code: "",
215917
216406
  source: "run",
215918
216407
  scriptPath,
@@ -215937,6 +216426,12 @@ usage: tracekernelctl {status|reset|verbose [on|off|status]|kill <pid> [signal]|
215937
216426
  this.handleRuntimeCommandEvent(event, request.commandContext);
215938
216427
  }
215939
216428
  });
216429
+ await this.resolvePendingTerminalStartupInput(
216430
+ request.commandContext.process.pid,
216431
+ descriptorStdio,
216432
+ request.stdinPipe
216433
+ );
216434
+ result = await execution;
215940
216435
  } finally {
215941
216436
  kernelSyscalls?.close();
215942
216437
  }
@@ -218311,6 +218806,18 @@ var BROWSER_PROJECT_PREWARM_PROVIDERS = Object.freeze([
218311
218806
  "cpp"
218312
218807
  ]);
218313
218808
  var BROWSER_PROJECT_INJECTED_PROVIDERS = Object.freeze(["python", "java", "csharp", "cpp"]);
218809
+ var CPP_LEGACY_ASSET_KEYS = Object.freeze([
218810
+ "cppWorker",
218811
+ "cppCompilerWasm",
218812
+ "cppLinkerWasm",
218813
+ "cppSysroot",
218814
+ "cppRuntimeHeader",
218815
+ "cppCompilerIntegrity"
218816
+ ]);
218817
+ function hasConfiguredCppRuntimeAssets(assets) {
218818
+ if (assets?.runtimeManifests?.cpp) return true;
218819
+ return CPP_LEGACY_ASSET_KEYS.some((key) => assets?.[key] !== void 0);
218820
+ }
218314
218821
  function normalizeBrowserProjectProviders(providers) {
218315
218822
  const normalized = [];
218316
218823
  for (const provider of providers ?? DEFAULT_BROWSER_PROJECT_PROVIDERS) {
@@ -218787,11 +219294,25 @@ async function createBrowserProjectWorkspace(options = {}) {
218787
219294
  hasProvider("cpp") ? Promise.all([
218788
219295
  Promise.resolve().then(() => (init_project_browser5(), project_browser_exports5)),
218789
219296
  Promise.resolve().then(() => (init_cpp_worker_client(), cpp_worker_client_exports)),
218790
- Promise.resolve().then(() => (init_browser_runtime_provider(), browser_runtime_provider_exports))
219297
+ Promise.resolve().then(() => (init_browser_runtime_provider(), browser_runtime_provider_exports)),
219298
+ Promise.resolve().then(() => (init_tracecc_runtime_assets(), tracecc_runtime_assets_exports))
218791
219299
  ]) : void 0
218792
219300
  ]);
218793
219301
  const { createRuntimeWorkspace: createRuntimeWorkspace3 } = await projectRuntimePromise;
218794
- const assets = resolveBrowserRuntimeAssets(options);
219302
+ const configuredAssets = options.assets;
219303
+ const assets = resolveBrowserRuntimeAssets({
219304
+ ...options,
219305
+ ...cppProvider && runtimeProviders.cpp === void 0 && !hasConfiguredCppRuntimeAssets(configuredAssets) ? {
219306
+ assets: {
219307
+ ...configuredAssets,
219308
+ runtimeAssetProvider(runtime3) {
219309
+ return configuredAssets?.runtimeAssetProvider?.(runtime3) ?? (runtime3 === "cpp" ? cppProvider[3].resolveBuiltInTraceCCProjectRuntimeManifest(
219310
+ options.assetBaseUrl ?? "/workers"
219311
+ ) : void 0);
219312
+ }
219313
+ }
219314
+ } : {}
219315
+ });
218795
219316
  const runtimeAssetPreflight = createBrowserRuntimeAssetPreflight(assets.runtimeManifests);
218796
219317
  const pythonManifest = assets.runtimeManifests?.python;
218797
219318
  const pythonAsset = (name) => {
@@ -218816,6 +219337,7 @@ async function createBrowserProjectWorkspace(options = {}) {
218816
219337
  runtimeProviders: _runtimeProviders,
218817
219338
  java,
218818
219339
  javaRuntimeAssetBaseUrl,
219340
+ javaProjectWorkerUrl,
218819
219341
  executionHost: executionHostOptions,
218820
219342
  nodeProject,
218821
219343
  typescriptProject,
@@ -218983,7 +219505,8 @@ async function createBrowserProjectWorkspace(options = {}) {
218983
219505
  const builtInJavaFactory = hasProvider("java") && !java && !injectedJavaProvider && builtInJavaAvailable && javaProvider ? javaProvider[2].createJavaProjectClientFactory({
218984
219506
  runtimeAssetBaseUrl: javaRuntimeAssetBaseUrl ?? javaProvider[2].resolveBuiltInTraceJVMRuntimeAssetBaseUrl(
218985
219507
  options.assetBaseUrl ?? "/workers"
218986
- )
219508
+ ),
219509
+ workerUrl: javaProjectWorkerUrl ?? `${javaProvider[2].resolveBuiltInTraceJVMRuntimeAssetBaseUrl()}/browser-worker.js`
218987
219510
  }) : void 0;
218988
219511
  if (builtInJavaFactory) ownedWorkers.push(builtInJavaFactory);
218989
219512
  const builtInJava = builtInJavaFactory ? {
@@ -219215,181 +219738,7 @@ async function createBrowserProjectWorkspace(options = {}) {
219215
219738
 
219216
219739
  // src/tracekernel.ts
219217
219740
  init_runtime_capability_guards();
219218
-
219219
- // packages/runtime-cpp/src/tracecc-runtime-assets.generated.ts
219220
- var TRACECC_RUNTIME_CONTENT_HASH = "fb4b6f41f9e9b7db89b6c8425bb2c6218979219a4150f96619b6461b4b78d294";
219221
- var TRACECC_RUNTIME_ASSETS = Object.freeze({
219222
- "runtimeHeader": {
219223
- "fileName": "tracecode_runtime.hpp",
219224
- "integrity": "sha256-WEbB8mLN8cwKIWPf25UL7yoTSM9nCqWs8MkE0B14EtE=",
219225
- "mediaType": "text/plain",
219226
- "size": 263083
219227
- },
219228
- "compilerWasm": {
219229
- "fileName": "tracecc-reactor.wasm",
219230
- "integrity": "sha256-At40hCU4Rmvynp1s8UzQ1eX/UZybo5BWHMsVgQXUTUE=",
219231
- "mediaType": "application/wasm",
219232
- "size": 33478188
219233
- },
219234
- "sysroot": {
219235
- "fileName": "llvm-resources.tar",
219236
- "integrity": "sha256-2V0qK8hAihbAdEmWrEfJG7PGO7cblDFcl5YIm23ahVU=",
219237
- "mediaType": "application/x-tar",
219238
- "size": 29112320
219239
- },
219240
- "narrowPch": {
219241
- "fileName": "narrow.pch",
219242
- "integrity": "sha256-rbuVm7YeO+HwDpSJPAqGGNrrPKeJveazS/juUWXs5/A=",
219243
- "mediaType": "application/octet-stream",
219244
- "size": 21322216
219245
- },
219246
- "narrowPchSource": {
219247
- "fileName": "narrow.source.hpp",
219248
- "integrity": "sha256-SMqxQfcMBSUHUcAz+7Cp4vkWyOtgv7mNB09JE1cOEAU=",
219249
- "mediaType": "text/plain",
219250
- "size": 815
219251
- },
219252
- "narrowRuntimeObject": {
219253
- "fileName": "narrow.o",
219254
- "integrity": "sha256-il/wX66FvAU9SJSiDepMuEZ00CipED4EEEfqcdxEg8c=",
219255
- "mediaType": "application/wasm",
219256
- "size": 1042570
219257
- },
219258
- "broadPch": {
219259
- "fileName": "broad.pch",
219260
- "integrity": "sha256-ktKxBSglo50GPM9GJJwBpqyYDcFHkKGjoyEtsUmLMrI=",
219261
- "mediaType": "application/octet-stream",
219262
- "size": 24543552
219263
- },
219264
- "broadPchSource": {
219265
- "fileName": "broad.source.hpp",
219266
- "integrity": "sha256-MOayycWl5KYaLS8vP2MoJh4kazsDhg0kH9Bi6dvsy0s=",
219267
- "mediaType": "text/plain",
219268
- "size": 7095
219269
- },
219270
- "broadRuntimeObject": {
219271
- "fileName": "broad.o",
219272
- "integrity": "sha256-f69Oe7kRn9JEIUEPgM1cuYbf50oph4IxEnVP7VIZGp4=",
219273
- "mediaType": "application/wasm",
219274
- "size": 1892879
219275
- },
219276
- "mapPch": {
219277
- "fileName": "map.pch",
219278
- "integrity": "sha256-fX7zTmJXnRJ2acbDiJ4Wu7/xf1G510SB2fLzkTgr2Uc=",
219279
- "mediaType": "application/octet-stream",
219280
- "size": 29951380
219281
- },
219282
- "mapPchSource": {
219283
- "fileName": "map.source.hpp",
219284
- "integrity": "sha256-WHaMpx3nG/h1ro6CppBseoDIkgqahbYnFxShHLGT9/c=",
219285
- "mediaType": "text/plain",
219286
- "size": 10708
219287
- },
219288
- "mapRuntimeObject": {
219289
- "fileName": "map.o",
219290
- "integrity": "sha256-02ktvX6uqV05it5kdBEm/ncOszBeO43wX93Yk079E4U=",
219291
- "mediaType": "application/wasm",
219292
- "size": 3372458
219293
- }
219294
- });
219295
-
219296
- // packages/runtime-cpp/src/tracecc-runtime-assets.ts
219297
- var TRACECC_RUNTIME_ASSET_RELATIVE_PATH = `cpp/tracecc/${TRACECC_RUNTIME_CONTENT_HASH}`;
219298
- var typedTraceCCRuntimeAssets = TRACECC_RUNTIME_ASSETS;
219299
- function stripTrailingSlash3(value) {
219300
- return value.replace(/\/+$/, "");
219301
- }
219302
- function normalizeAssetBaseUrl(value) {
219303
- const normalized = stripTrailingSlash3(value.trim());
219304
- if (!normalized) {
219305
- throw new TypeError("TraceCC requires a non-empty asset base URL.");
219306
- }
219307
- if (/[?#]/u.test(normalized)) {
219308
- throw new TypeError(
219309
- "TraceCC asset base URL must be a directory without a query or fragment."
219310
- );
219311
- }
219312
- return normalized;
219313
- }
219314
- function normalizeWorkerUrl(value) {
219315
- const normalized = value.trim();
219316
- if (!normalized) {
219317
- throw new TypeError("TraceCC worker URL must not be empty.");
219318
- }
219319
- return normalized;
219320
- }
219321
- function descriptor2(asset) {
219322
- return {
219323
- url: asset.fileName,
219324
- integrity: asset.integrity,
219325
- mediaType: asset.mediaType,
219326
- size: asset.size,
219327
- delivery: {
219328
- mutability: "immutable",
219329
- address: "content"
219330
- }
219331
- };
219332
- }
219333
- function createTraceCCRuntimeManifest(assetBaseUrl, options = {}) {
219334
- const normalizedAssetBaseUrl = normalizeAssetBaseUrl(assetBaseUrl);
219335
- const workerUrl = normalizeWorkerUrl(
219336
- options.workerUrl ?? "/workers/cpp-worker.js"
219337
- );
219338
- const compilerWasm = descriptor2(
219339
- typedTraceCCRuntimeAssets.compilerWasm
219340
- );
219341
- return {
219342
- runtime: "cpp",
219343
- runtimeVersion: `tracecc-${TRACECC_RUNTIME_CONTENT_HASH.slice(0, 12)}`,
219344
- protocolVersion: "browser-runtime-assets-v1",
219345
- assetBaseUrl: `${normalizedAssetBaseUrl}/`,
219346
- workerFormat: "module",
219347
- assets: {
219348
- worker: { url: workerUrl },
219349
- runtimeHeader: descriptor2(typedTraceCCRuntimeAssets.runtimeHeader),
219350
- compilerWasm,
219351
- linkerWasm: compilerWasm,
219352
- sysroot: descriptor2(typedTraceCCRuntimeAssets.sysroot),
219353
- compilerResources: {
219354
- "tracecc-narrow-pch": descriptor2(
219355
- typedTraceCCRuntimeAssets.narrowPch
219356
- ),
219357
- "tracecc-narrow-pch-source": descriptor2(
219358
- typedTraceCCRuntimeAssets.narrowPchSource
219359
- ),
219360
- "tracecc-narrow-runtime-object": descriptor2(
219361
- typedTraceCCRuntimeAssets.narrowRuntimeObject
219362
- ),
219363
- "tracecc-broad-pch": descriptor2(
219364
- typedTraceCCRuntimeAssets.broadPch
219365
- ),
219366
- "tracecc-broad-pch-source": descriptor2(
219367
- typedTraceCCRuntimeAssets.broadPchSource
219368
- ),
219369
- "tracecc-broad-runtime-object": descriptor2(
219370
- typedTraceCCRuntimeAssets.broadRuntimeObject
219371
- ),
219372
- "tracecc-map-pch": descriptor2(
219373
- typedTraceCCRuntimeAssets.mapPch
219374
- ),
219375
- "tracecc-map-pch-source": descriptor2(
219376
- typedTraceCCRuntimeAssets.mapPchSource
219377
- ),
219378
- "tracecc-map-runtime-object": descriptor2(
219379
- typedTraceCCRuntimeAssets.mapRuntimeObject
219380
- )
219381
- }
219382
- }
219383
- };
219384
- }
219385
- function resolveBuiltInTraceCCRuntimeManifest(assetBaseUrl = "/workers") {
219386
- const normalizedAssetBaseUrl = normalizeAssetBaseUrl(assetBaseUrl);
219387
- return createTraceCCRuntimeManifest(
219388
- `${normalizedAssetBaseUrl}/${TRACECC_RUNTIME_ASSET_RELATIVE_PATH}`,
219389
- { workerUrl: `${normalizedAssetBaseUrl}/cpp-worker.js` }
219390
- );
219391
- }
219392
- var TRACECC_RUNTIME_MANIFEST = resolveBuiltInTraceCCRuntimeManifest();
219741
+ init_tracecc_runtime_assets();
219393
219742
 
219394
219743
  // src/internal/python-analysis.ts
219395
219744
  init_python_worker_client();
@@ -219716,6 +220065,7 @@ init_runtime_open_source_info();
219716
220065
  readRuntimeProcFile,
219717
220066
  resolveBrowserRuntimeAssetManifests,
219718
220067
  resolveBrowserRuntimeAssets,
220068
+ resolveBuiltInTraceCCProjectRuntimeManifest,
219719
220069
  resolveBuiltInTraceCCRuntimeManifest,
219720
220070
  resolveRuntimeOpenSourceResourceHref,
219721
220071
  runRuntimeProjectWorkerBridge,