@bastani/atomic 0.9.84 → 0.9.85-alpha.1

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 (183) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/builtin/intercom/CHANGELOG.md +6 -0
  3. package/dist/builtin/intercom/broker/broker.ts +25 -7
  4. package/dist/builtin/intercom/broker/spawn.ts +83 -17
  5. package/dist/builtin/intercom/index.bundle.mjs +89 -26
  6. package/dist/builtin/intercom/package.json +1 -1
  7. package/dist/builtin/mcp/package.json +1 -1
  8. package/dist/builtin/subagents/package.json +1 -1
  9. package/dist/builtin/web-access/package.json +1 -1
  10. package/dist/builtin/workflows/CHANGELOG.md +6 -0
  11. package/dist/builtin/workflows/package.json +1 -1
  12. package/dist/builtin/workflows/src/authoring.d.ts +1 -1
  13. package/dist/builtin/workflows/src/extension/index.bundle.mjs +48 -9
  14. package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +48 -9
  15. package/dist/builtin/workflows/src/index.js +48 -9
  16. package/dist/builtin/workflows/src/local-worker-entry.mjs +48 -9
  17. package/dist/config.d.ts +3 -2
  18. package/dist/config.d.ts.map +1 -1
  19. package/dist/config.js +4 -3
  20. package/dist/config.js.map +1 -1
  21. package/dist/core/agent-session-export.d.ts +2 -2
  22. package/dist/core/agent-session-export.d.ts.map +1 -1
  23. package/dist/core/agent-session-export.js +4 -5
  24. package/dist/core/agent-session-export.js.map +1 -1
  25. package/dist/core/agent-session-services.js +1 -1
  26. package/dist/core/agent-session-services.js.map +1 -1
  27. package/dist/core/agent-session-summary.d.ts.map +1 -1
  28. package/dist/core/agent-session-summary.js +8 -1
  29. package/dist/core/agent-session-summary.js.map +1 -1
  30. package/dist/core/agent-session-tree.d.ts.map +1 -1
  31. package/dist/core/agent-session-tree.js +3 -6
  32. package/dist/core/agent-session-tree.js.map +1 -1
  33. package/dist/core/builtin-resource-loader.d.ts.map +1 -1
  34. package/dist/core/builtin-resource-loader.js +1 -1
  35. package/dist/core/builtin-resource-loader.js.map +1 -1
  36. package/dist/core/extensions/loader-core.d.ts +6 -2
  37. package/dist/core/extensions/loader-core.d.ts.map +1 -1
  38. package/dist/core/extensions/loader-core.js +13 -9
  39. package/dist/core/extensions/loader-core.js.map +1 -1
  40. package/dist/core/extensions/loader-discovery.js +1 -1
  41. package/dist/core/extensions/loader-discovery.js.map +1 -1
  42. package/dist/core/extensions/loader-virtual-modules.d.ts +20 -14
  43. package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
  44. package/dist/core/extensions/loader-virtual-modules.js +133 -78
  45. package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
  46. package/dist/core/extensions/ts-source-specifiers.d.ts +1 -0
  47. package/dist/core/extensions/ts-source-specifiers.d.ts.map +1 -1
  48. package/dist/core/extensions/ts-source-specifiers.js +18 -2
  49. package/dist/core/extensions/ts-source-specifiers.js.map +1 -1
  50. package/dist/core/mandatory-resource-loader.d.ts +5 -2
  51. package/dist/core/mandatory-resource-loader.d.ts.map +1 -1
  52. package/dist/core/mandatory-resource-loader.js +17 -12
  53. package/dist/core/mandatory-resource-loader.js.map +1 -1
  54. package/dist/core/model-fallback-failures.d.ts.map +1 -1
  55. package/dist/core/model-fallback-failures.js +10 -3
  56. package/dist/core/model-fallback-failures.js.map +1 -1
  57. package/dist/core/resource-loader-extensions.d.ts.map +1 -1
  58. package/dist/core/resource-loader-extensions.js +1 -1
  59. package/dist/core/resource-loader-extensions.js.map +1 -1
  60. package/dist/core/resource-loader-reload.js +1 -1
  61. package/dist/core/resource-loader-reload.js.map +1 -1
  62. package/dist/core/resume/blueprint/resume.d.ts +4 -4
  63. package/dist/core/resume/blueprint/resume.js +4 -4
  64. package/dist/core/resume/blueprint/resume.js.map +1 -1
  65. package/dist/core/resume/session-resume.d.ts +6 -3
  66. package/dist/core/resume/session-resume.d.ts.map +1 -1
  67. package/dist/core/resume/session-resume.js +159 -37
  68. package/dist/core/resume/session-resume.js.map +1 -1
  69. package/dist/core/sdk.js +1 -1
  70. package/dist/core/sdk.js.map +1 -1
  71. package/dist/core/session-manager-core.d.ts +10 -4
  72. package/dist/core/session-manager-core.d.ts.map +1 -1
  73. package/dist/core/session-manager-core.js +23 -6
  74. package/dist/core/session-manager-core.js.map +1 -1
  75. package/dist/core/session-manager-entries.d.ts +2 -2
  76. package/dist/core/session-manager-entries.d.ts.map +1 -1
  77. package/dist/core/session-manager-entries.js +2 -1
  78. package/dist/core/session-manager-entries.js.map +1 -1
  79. package/dist/core/session-manager-history.d.ts +13 -1
  80. package/dist/core/session-manager-history.d.ts.map +1 -1
  81. package/dist/core/session-manager-history.js +21 -1
  82. package/dist/core/session-manager-history.js.map +1 -1
  83. package/dist/core/session-manager-types.d.ts +3 -1
  84. package/dist/core/session-manager-types.d.ts.map +1 -1
  85. package/dist/core/session-manager-types.js.map +1 -1
  86. package/dist/core/session-manager.d.ts +1 -1
  87. package/dist/core/session-manager.d.ts.map +1 -1
  88. package/dist/core/session-manager.js +1 -1
  89. package/dist/core/session-manager.js.map +1 -1
  90. package/dist/core/session-worktree-snapshots.d.ts +61 -4
  91. package/dist/core/session-worktree-snapshots.d.ts.map +1 -1
  92. package/dist/core/session-worktree-snapshots.js +261 -28
  93. package/dist/core/session-worktree-snapshots.js.map +1 -1
  94. package/dist/core/storage/session/entry-structure.js +31 -1
  95. package/dist/core/storage/session/entry-structure.js.map +1 -1
  96. package/dist/core/tools/ask-user-question/state/build-questionnaire.d.ts.map +1 -1
  97. package/dist/core/tools/ask-user-question/state/build-questionnaire.js +2 -1
  98. package/dist/core/tools/ask-user-question/state/build-questionnaire.js.map +1 -1
  99. package/dist/core/tools/ask-user-question/state/questionnaire-session.d.ts.map +1 -1
  100. package/dist/core/tools/ask-user-question/state/questionnaire-session.js +2 -0
  101. package/dist/core/tools/ask-user-question/state/questionnaire-session.js.map +1 -1
  102. package/dist/core/tools/ask-user-question/state/selectors/field-tone.d.ts +26 -0
  103. package/dist/core/tools/ask-user-question/state/selectors/field-tone.d.ts.map +1 -0
  104. package/dist/core/tools/ask-user-question/state/selectors/field-tone.js +27 -0
  105. package/dist/core/tools/ask-user-question/state/selectors/field-tone.js.map +1 -0
  106. package/dist/core/tools/ask-user-question/state/selectors/projections.d.ts.map +1 -1
  107. package/dist/core/tools/ask-user-question/state/selectors/projections.js +1 -0
  108. package/dist/core/tools/ask-user-question/state/selectors/projections.js.map +1 -1
  109. package/dist/core/tools/ask-user-question/state/state-reducer.js +1 -1
  110. package/dist/core/tools/ask-user-question/state/state-reducer.js.map +1 -1
  111. package/dist/core/tools/ask-user-question/view/components/multi-select-view.d.ts.map +1 -1
  112. package/dist/core/tools/ask-user-question/view/components/multi-select-view.js +6 -6
  113. package/dist/core/tools/ask-user-question/view/components/multi-select-view.js.map +1 -1
  114. package/dist/core/tools/ask-user-question/view/components/preview/preview-block-renderer.d.ts +5 -3
  115. package/dist/core/tools/ask-user-question/view/components/preview/preview-block-renderer.d.ts.map +1 -1
  116. package/dist/core/tools/ask-user-question/view/components/preview/preview-block-renderer.js +14 -4
  117. package/dist/core/tools/ask-user-question/view/components/preview/preview-block-renderer.js.map +1 -1
  118. package/dist/core/tools/ask-user-question/view/components/preview/preview-pane.d.ts +2 -0
  119. package/dist/core/tools/ask-user-question/view/components/preview/preview-pane.d.ts.map +1 -1
  120. package/dist/core/tools/ask-user-question/view/components/preview/preview-pane.js +3 -3
  121. package/dist/core/tools/ask-user-question/view/components/preview/preview-pane.js.map +1 -1
  122. package/dist/core/tools/ask-user-question/view/components/wrapping-select.d.ts +16 -6
  123. package/dist/core/tools/ask-user-question/view/components/wrapping-select.d.ts.map +1 -1
  124. package/dist/core/tools/ask-user-question/view/components/wrapping-select.js +42 -24
  125. package/dist/core/tools/ask-user-question/view/components/wrapping-select.js.map +1 -1
  126. package/dist/core/tools/ask-user-question/view/tab-content-strategy.d.ts.map +1 -1
  127. package/dist/core/tools/ask-user-question/view/tab-content-strategy.js +12 -3
  128. package/dist/core/tools/ask-user-question/view/tab-content-strategy.js.map +1 -1
  129. package/dist/core/tools/read.d.ts +1 -0
  130. package/dist/core/tools/read.d.ts.map +1 -1
  131. package/dist/core/tools/read.js +13 -14
  132. package/dist/core/tools/read.js.map +1 -1
  133. package/dist/core/worktree-snapshot/index.d.ts +2 -2
  134. package/dist/core/worktree-snapshot/index.d.ts.map +1 -1
  135. package/dist/core/worktree-snapshot/index.js +1 -1
  136. package/dist/core/worktree-snapshot/index.js.map +1 -1
  137. package/dist/core/worktree-snapshot/records.d.ts +6 -0
  138. package/dist/core/worktree-snapshot/records.d.ts.map +1 -1
  139. package/dist/core/worktree-snapshot/records.js +18 -4
  140. package/dist/core/worktree-snapshot/records.js.map +1 -1
  141. package/dist/core/worktree-snapshot/restore.d.ts +24 -1
  142. package/dist/core/worktree-snapshot/restore.d.ts.map +1 -1
  143. package/dist/core/worktree-snapshot/restore.js +443 -72
  144. package/dist/core/worktree-snapshot/restore.js.map +1 -1
  145. package/dist/core/worktree-snapshot/types.d.ts +44 -0
  146. package/dist/core/worktree-snapshot/types.d.ts.map +1 -1
  147. package/dist/core/worktree-snapshot/types.js.map +1 -1
  148. package/dist/index.d.ts +2 -2
  149. package/dist/index.d.ts.map +1 -1
  150. package/dist/index.js +2 -2
  151. package/dist/index.js.map +1 -1
  152. package/dist/modes/interactive/components/tool-execution.js +2 -1
  153. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  154. package/dist/modes/interactive/interactive-slash-commands.js +4 -1
  155. package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
  156. package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
  157. package/dist/modes/interactive-engine/isolated-runtime.js +8 -0
  158. package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
  159. package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
  160. package/dist/modes/rpc/rpc-command-handler.js +11 -2
  161. package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
  162. package/dist/modes/rpc/rpc-command-timeouts.d.ts.map +1 -1
  163. package/dist/modes/rpc/rpc-command-timeouts.js +1 -0
  164. package/dist/modes/rpc/rpc-command-timeouts.js.map +1 -1
  165. package/dist/modes/rpc/rpc-input-scheduler.d.ts.map +1 -1
  166. package/dist/modes/rpc/rpc-input-scheduler.js +1 -0
  167. package/dist/modes/rpc/rpc-input-scheduler.js.map +1 -1
  168. package/dist/modes/rpc/rpc-types.d.ts +11 -1
  169. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  170. package/dist/modes/rpc/rpc-types.js.map +1 -1
  171. package/docs/environment-variables.md +1 -1
  172. package/docs/guides/resume-on-any-machine.md +6 -4
  173. package/docs/intercom/operations.md +4 -0
  174. package/docs/rpc/protocol.md +2 -2
  175. package/docs/sdk/reference.md +3 -0
  176. package/docs/sdk.md +2 -2
  177. package/docs/session-format.md +11 -2
  178. package/docs/sessions.md +4 -2
  179. package/docs/settings.md +1 -1
  180. package/docs/workflows/api-reference.md +2 -2
  181. package/docs/worktree-snapshots.md +13 -5
  182. package/npm-shrinkwrap.json +32 -32
  183. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/intercom",
3
- "version": "0.9.84",
3
+ "version": "0.9.85-alpha.1",
4
4
  "private": true,
5
5
  "description": "Atomic extension providing a private coordination channel between parent and child agent sessions. Fork of: https://github.com/nicobailon/pi-intercom",
6
6
  "contributors": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/mcp",
3
- "version": "0.9.84",
3
+ "version": "0.9.85-alpha.1",
4
4
  "private": true,
5
5
  "description": "Atomic's pi-compatible MCP integration for server connections, OAuth, tools, resources, and terminal management.",
6
6
  "contributors": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/subagents",
3
- "version": "0.9.84",
3
+ "version": "0.9.85-alpha.1",
4
4
  "private": true,
5
5
  "description": "Atomic extension for delegating tasks to subagents with parallel execution. Fork of: https://github.com/nicobailon/pi-subagents",
6
6
  "contributors": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/web-access",
3
- "version": "0.9.84",
3
+ "version": "0.9.85-alpha.1",
4
4
  "private": true,
5
5
  "description": "Atomic extension for web search, URL fetching, GitHub repo cloning, PDF/video extraction. Fork of: https://github.com/nicobailon/pi-web-access",
6
6
  "contributors": [
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.9.85-alpha.1] - 2026-11-13
10
+
11
+ ### Fixed
12
+
13
+ - Fixed `listForkPoints()` naming a stage session's last entry as its `entryId` after `/tree` moved the stage chat back to an earlier entry without a summary. It now names the entry the stage continues from, and a run fork's copy of that stage session reopens on the same branch ([#3325](https://github.com/bastani-inc/atomic/issues/3325))
14
+
9
15
  ## [0.9.81] - 2026-11-13
10
16
 
11
17
  Parallel reviewers pick different models, and Escape stops a retrying stage.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/workflows",
3
- "version": "0.9.84",
3
+ "version": "0.9.85-alpha.1",
4
4
  "private": true,
5
5
  "description": "Atomic extension for multi-stage workflow authoring and execution.",
6
6
  "contributors": [
@@ -102,7 +102,7 @@ export interface ForkPoint {
102
102
  readonly stagePath: string;
103
103
  /** Agent session the stage ran in, when it ran one. */
104
104
  readonly sessionId?: string;
105
- /** Last entry of that session, for `forkFromEntryId`. */
105
+ /** The entry that session continues from (its leaf), for `forkFromEntryId`. */
106
106
  readonly entryId?: string;
107
107
  readonly completedAt: number;
108
108
  }
@@ -78406,24 +78406,28 @@ ${tail}`;
78406
78406
  function toError2(error) {
78407
78407
  return error instanceof Error ? error : new Error(String(error));
78408
78408
  }
78409
- async function spawnBrokerIfNeeded(brokerCommand, brokerArgs, readyTimeoutMs = BROKER_READY_TIMEOUT_MS, extensionDir = EXTENSION_DIR) {
78409
+ async function spawnBrokerIfNeeded(brokerCommand, brokerArgs, readyTimeoutMs = BROKER_READY_TIMEOUT_MS, extensionDir = EXTENSION_DIR, signal) {
78410
+ signal?.throwIfAborted();
78410
78411
  ensurePrivateDirectory(getIntercomDirPath());
78411
78412
  if (await isBrokerRunning()) {
78412
78413
  return;
78413
78414
  }
78415
+ signal?.throwIfAborted();
78414
78416
  const lockOwner = acquireSpawnLock();
78415
78417
  if (lockOwner === undefined) {
78416
- await waitForBroker(readyTimeoutMs);
78418
+ await waitForBroker(readyTimeoutMs, undefined, signal);
78417
78419
  return;
78418
78420
  }
78419
- await spawnBrokerHoldingLock(lockOwner, brokerCommand, brokerArgs, readyTimeoutMs, extensionDir, true);
78421
+ await spawnBrokerHoldingLock(lockOwner, brokerCommand, brokerArgs, readyTimeoutMs, extensionDir, true, signal);
78420
78422
  }
78421
- async function spawnBrokerHoldingLock(lockOwner, brokerCommand, brokerArgs, readyTimeoutMs, extensionDir, recheck) {
78423
+ async function spawnBrokerHoldingLock(lockOwner, brokerCommand, brokerArgs, readyTimeoutMs, extensionDir, recheck, signal, launchAnyway = false) {
78424
+ const cancelSignal = launchAnyway ? undefined : signal;
78422
78425
  let keepLock = false;
78423
78426
  try {
78424
78427
  if (recheck && await isBrokerRunning()) {
78425
78428
  return;
78426
78429
  }
78430
+ cancelSignal?.throwIfAborted();
78427
78431
  const brokerPath = resolveBrokerEntrypoint(extensionDir);
78428
78432
  const launch = getBrokerLaunchSpec(brokerPath, brokerCommand, brokerArgs, extensionDir);
78429
78433
  const announcement = launch.kind === "windows-launcher" ? { path: getBrokerStartAnnouncementPath(), token: randomUUID16() } : undefined;
@@ -78436,9 +78440,10 @@ async function spawnBrokerHoldingLock(lockOwner, brokerCommand, brokerArgs, read
78436
78440
  writeWindowsHiddenLauncher(launch.launcherCommandLine, launch.launcherPath);
78437
78441
  }
78438
78442
  if (!await resetBrokerLogOnceReleased()) {
78439
- await waitForBroker(readyTimeoutMs);
78443
+ await waitForBroker(readyTimeoutMs, undefined, cancelSignal);
78440
78444
  return;
78441
78445
  }
78446
+ cancelSignal?.throwIfAborted();
78442
78447
  const logFd = launch.kind === "direct" ? openSync4(getBrokerLogPath(), "a") : undefined;
78443
78448
  let child;
78444
78449
  try {
@@ -78483,7 +78488,19 @@ ${describeBrokerLog()}`);
78483
78488
  resolve();
78484
78489
  }, (error) => {
78485
78490
  cleanup();
78486
- keepLock = launch.kind === "direct" && child.exitCode === null && child.signalCode === null && handSpawnLockToBroker(child.pid, lockOwner);
78491
+ const starting = launch.kind === "direct" && child.exitCode === null && child.signalCode === null;
78492
+ let abandonedPid;
78493
+ if (signal?.aborted) {
78494
+ if (launch.kind === "direct")
78495
+ abandonedPid = starting ? child.pid : undefined;
78496
+ else if (announcement !== undefined)
78497
+ abandonedPid = readBrokerStartAnnouncement(announcement);
78498
+ }
78499
+ if (abandonedPid !== undefined) {
78500
+ stopStartingBroker(abandonedPid).finally(() => reject(toError2(error)));
78501
+ return;
78502
+ }
78503
+ keepLock = starting && handSpawnLockToBroker(child.pid, lockOwner);
78487
78504
  reject(toError2(error));
78488
78505
  });
78489
78506
  });
@@ -78492,6 +78509,26 @@ ${describeBrokerLog()}`);
78492
78509
  releaseSpawnLock(lockOwner);
78493
78510
  }
78494
78511
  }
78512
+ async function stopStartingBroker(pid) {
78513
+ const deadline = Date.now() + STARTING_BROKER_KILL_WAIT_MS;
78514
+ if (process.platform === "win32") {
78515
+ await new Promise((resolve) => {
78516
+ const taskkill = spawn("taskkill", ["/PID", String(pid), "/T", "/F"], { stdio: "ignore", windowsHide: true });
78517
+ taskkill.once("error", () => resolve());
78518
+ taskkill.once("exit", () => resolve());
78519
+ });
78520
+ while (isProcessAlive(pid) && Date.now() < deadline)
78521
+ await sleep(BROKER_POLL_MAX_INTERVAL_MS);
78522
+ return;
78523
+ }
78524
+ try {
78525
+ process.kill(-pid, "SIGKILL");
78526
+ } catch {
78527
+ return;
78528
+ }
78529
+ while (isProcessAlive(-pid) && Date.now() < deadline)
78530
+ await sleep(BROKER_POLL_MAX_INTERVAL_MS);
78531
+ }
78495
78532
  async function isBrokerRunning() {
78496
78533
  if (await checkSocketConnectable()) {
78497
78534
  return true;
@@ -78587,10 +78624,11 @@ function releaseSpawnLock(owner, lockPath = getBrokerSpawnLockPath()) {
78587
78624
  unlinkSync4(lockPath);
78588
78625
  } catch {}
78589
78626
  }
78590
- async function waitForBroker(timeoutMs = BROKER_READY_TIMEOUT_MS, announcedPid) {
78627
+ async function waitForBroker(timeoutMs = BROKER_READY_TIMEOUT_MS, announcedPid, signal) {
78591
78628
  const start = Date.now();
78592
78629
  let interval = BROKER_POLL_INITIAL_INTERVAL_MS;
78593
78630
  while (Date.now() - start < timeoutMs) {
78631
+ signal?.throwIfAborted();
78594
78632
  if (await checkSocketConnectable()) {
78595
78633
  return;
78596
78634
  }
@@ -78608,7 +78646,7 @@ ${describeBrokerLog()}`);
78608
78646
  ` + "The broker did not answer on its socket in time; it may still be starting, which a busy machine or an empty jiti " + "cache slows. Try again, or raise `brokerStartupTimeoutMs` in the Intercom config.json (default " + `${BROKER_READY_TIMEOUT_MS} ms).
78609
78647
  ${describeBrokerLog()}`);
78610
78648
  }
78611
- var EXTENSION_DIR, BROKER_LOG_TAIL_BYTES, BROKER_POLL_INITIAL_INTERVAL_MS = 10, BROKER_POLL_MAX_INTERVAL_MS = 100, BROKER_SPAWN_LOCK_MAX_AGE_MS = 60000, INTERNAL_INTERCOM_BROKER_ARG = "--atomic-internal-intercom-broker", BROKER_LOG_RELEASE_WAIT_MS = 1000;
78649
+ var EXTENSION_DIR, BROKER_LOG_TAIL_BYTES, BROKER_POLL_INITIAL_INTERVAL_MS = 10, BROKER_POLL_MAX_INTERVAL_MS = 100, BROKER_SPAWN_LOCK_MAX_AGE_MS = 60000, INTERNAL_INTERCOM_BROKER_ARG = "--atomic-internal-intercom-broker", BROKER_LOG_RELEASE_WAIT_MS = 1000, STARTING_BROKER_KILL_WAIT_MS = 5000;
78612
78650
  var init_spawn = __esm(() => {
78613
78651
  init_socket_liveness();
78614
78652
  init_start_announcement();
@@ -98631,6 +98669,7 @@ import { isAbsolute as isAbsolute17, resolve as resolve20 } from "node:path";
98631
98669
  import {
98632
98670
  assertSessionBlobStore as assertSessionBlobStore2,
98633
98671
  copySessionBlobs as copySessionBlobs2,
98672
+ getSessionLeafId,
98634
98673
  SessionManager as SessionManager3,
98635
98674
  sessionBlobHashes as sessionBlobHashes2
98636
98675
  } from "@bastani/atomic";
@@ -98859,7 +98898,7 @@ async function* durableForkPoints(backend, runId, options = {}) {
98859
98898
  runId: source.runId,
98860
98899
  stagePath: record.stagePath
98861
98900
  });
98862
- const entryId = snapshot.entries.at(-1)?.id;
98901
+ const entryId = getSessionLeafId(snapshot.entries) ?? undefined;
98863
98902
  yield {
98864
98903
  stagePath: record.stagePath,
98865
98904
  sessionId: record.sessionId,
@@ -75829,24 +75829,28 @@ ${tail}`;
75829
75829
  function toError2(error) {
75830
75830
  return error instanceof Error ? error : new Error(String(error));
75831
75831
  }
75832
- async function spawnBrokerIfNeeded(brokerCommand, brokerArgs, readyTimeoutMs = BROKER_READY_TIMEOUT_MS, extensionDir = EXTENSION_DIR) {
75832
+ async function spawnBrokerIfNeeded(brokerCommand, brokerArgs, readyTimeoutMs = BROKER_READY_TIMEOUT_MS, extensionDir = EXTENSION_DIR, signal) {
75833
+ signal?.throwIfAborted();
75833
75834
  ensurePrivateDirectory(getIntercomDirPath());
75834
75835
  if (await isBrokerRunning()) {
75835
75836
  return;
75836
75837
  }
75838
+ signal?.throwIfAborted();
75837
75839
  const lockOwner = acquireSpawnLock();
75838
75840
  if (lockOwner === undefined) {
75839
- await waitForBroker(readyTimeoutMs);
75841
+ await waitForBroker(readyTimeoutMs, undefined, signal);
75840
75842
  return;
75841
75843
  }
75842
- await spawnBrokerHoldingLock(lockOwner, brokerCommand, brokerArgs, readyTimeoutMs, extensionDir, true);
75844
+ await spawnBrokerHoldingLock(lockOwner, brokerCommand, brokerArgs, readyTimeoutMs, extensionDir, true, signal);
75843
75845
  }
75844
- async function spawnBrokerHoldingLock(lockOwner, brokerCommand, brokerArgs, readyTimeoutMs, extensionDir, recheck) {
75846
+ async function spawnBrokerHoldingLock(lockOwner, brokerCommand, brokerArgs, readyTimeoutMs, extensionDir, recheck, signal, launchAnyway = false) {
75847
+ const cancelSignal = launchAnyway ? undefined : signal;
75845
75848
  let keepLock = false;
75846
75849
  try {
75847
75850
  if (recheck && await isBrokerRunning()) {
75848
75851
  return;
75849
75852
  }
75853
+ cancelSignal?.throwIfAborted();
75850
75854
  const brokerPath = resolveBrokerEntrypoint(extensionDir);
75851
75855
  const launch = getBrokerLaunchSpec(brokerPath, brokerCommand, brokerArgs, extensionDir);
75852
75856
  const announcement = launch.kind === "windows-launcher" ? { path: getBrokerStartAnnouncementPath(), token: randomUUID15() } : undefined;
@@ -75859,9 +75863,10 @@ async function spawnBrokerHoldingLock(lockOwner, brokerCommand, brokerArgs, read
75859
75863
  writeWindowsHiddenLauncher(launch.launcherCommandLine, launch.launcherPath);
75860
75864
  }
75861
75865
  if (!await resetBrokerLogOnceReleased()) {
75862
- await waitForBroker(readyTimeoutMs);
75866
+ await waitForBroker(readyTimeoutMs, undefined, cancelSignal);
75863
75867
  return;
75864
75868
  }
75869
+ cancelSignal?.throwIfAborted();
75865
75870
  const logFd = launch.kind === "direct" ? openSync3(getBrokerLogPath(), "a") : undefined;
75866
75871
  let child;
75867
75872
  try {
@@ -75906,7 +75911,19 @@ ${describeBrokerLog()}`);
75906
75911
  resolve();
75907
75912
  }, (error) => {
75908
75913
  cleanup();
75909
- keepLock = launch.kind === "direct" && child.exitCode === null && child.signalCode === null && handSpawnLockToBroker(child.pid, lockOwner);
75914
+ const starting = launch.kind === "direct" && child.exitCode === null && child.signalCode === null;
75915
+ let abandonedPid;
75916
+ if (signal?.aborted) {
75917
+ if (launch.kind === "direct")
75918
+ abandonedPid = starting ? child.pid : undefined;
75919
+ else if (announcement !== undefined)
75920
+ abandonedPid = readBrokerStartAnnouncement(announcement);
75921
+ }
75922
+ if (abandonedPid !== undefined) {
75923
+ stopStartingBroker(abandonedPid).finally(() => reject(toError2(error)));
75924
+ return;
75925
+ }
75926
+ keepLock = starting && handSpawnLockToBroker(child.pid, lockOwner);
75910
75927
  reject(toError2(error));
75911
75928
  });
75912
75929
  });
@@ -75915,6 +75932,26 @@ ${describeBrokerLog()}`);
75915
75932
  releaseSpawnLock(lockOwner);
75916
75933
  }
75917
75934
  }
75935
+ async function stopStartingBroker(pid) {
75936
+ const deadline = Date.now() + STARTING_BROKER_KILL_WAIT_MS;
75937
+ if (process.platform === "win32") {
75938
+ await new Promise((resolve) => {
75939
+ const taskkill = spawn("taskkill", ["/PID", String(pid), "/T", "/F"], { stdio: "ignore", windowsHide: true });
75940
+ taskkill.once("error", () => resolve());
75941
+ taskkill.once("exit", () => resolve());
75942
+ });
75943
+ while (isProcessAlive(pid) && Date.now() < deadline)
75944
+ await sleep(BROKER_POLL_MAX_INTERVAL_MS);
75945
+ return;
75946
+ }
75947
+ try {
75948
+ process.kill(-pid, "SIGKILL");
75949
+ } catch {
75950
+ return;
75951
+ }
75952
+ while (isProcessAlive(-pid) && Date.now() < deadline)
75953
+ await sleep(BROKER_POLL_MAX_INTERVAL_MS);
75954
+ }
75918
75955
  async function isBrokerRunning() {
75919
75956
  if (await checkSocketConnectable()) {
75920
75957
  return true;
@@ -76010,10 +76047,11 @@ function releaseSpawnLock(owner, lockPath = getBrokerSpawnLockPath()) {
76010
76047
  unlinkSync4(lockPath);
76011
76048
  } catch {}
76012
76049
  }
76013
- async function waitForBroker(timeoutMs = BROKER_READY_TIMEOUT_MS, announcedPid) {
76050
+ async function waitForBroker(timeoutMs = BROKER_READY_TIMEOUT_MS, announcedPid, signal) {
76014
76051
  const start = Date.now();
76015
76052
  let interval = BROKER_POLL_INITIAL_INTERVAL_MS;
76016
76053
  while (Date.now() - start < timeoutMs) {
76054
+ signal?.throwIfAborted();
76017
76055
  if (await checkSocketConnectable()) {
76018
76056
  return;
76019
76057
  }
@@ -76031,7 +76069,7 @@ ${describeBrokerLog()}`);
76031
76069
  ` + "The broker did not answer on its socket in time; it may still be starting, which a busy machine or an empty jiti " + "cache slows. Try again, or raise `brokerStartupTimeoutMs` in the Intercom config.json (default " + `${BROKER_READY_TIMEOUT_MS} ms).
76032
76070
  ${describeBrokerLog()}`);
76033
76071
  }
76034
- var EXTENSION_DIR, BROKER_LOG_TAIL_BYTES, BROKER_POLL_INITIAL_INTERVAL_MS = 10, BROKER_POLL_MAX_INTERVAL_MS = 100, BROKER_SPAWN_LOCK_MAX_AGE_MS = 60000, INTERNAL_INTERCOM_BROKER_ARG = "--atomic-internal-intercom-broker", BROKER_LOG_RELEASE_WAIT_MS = 1000;
76072
+ var EXTENSION_DIR, BROKER_LOG_TAIL_BYTES, BROKER_POLL_INITIAL_INTERVAL_MS = 10, BROKER_POLL_MAX_INTERVAL_MS = 100, BROKER_SPAWN_LOCK_MAX_AGE_MS = 60000, INTERNAL_INTERCOM_BROKER_ARG = "--atomic-internal-intercom-broker", BROKER_LOG_RELEASE_WAIT_MS = 1000, STARTING_BROKER_KILL_WAIT_MS = 5000;
76035
76073
  var init_spawn = __esm(() => {
76036
76074
  init_socket_liveness();
76037
76075
  init_start_announcement();
@@ -92203,6 +92241,7 @@ import { isAbsolute as isAbsolute17, resolve as resolve20 } from "node:path";
92203
92241
  import {
92204
92242
  assertSessionBlobStore as assertSessionBlobStore2,
92205
92243
  copySessionBlobs as copySessionBlobs2,
92244
+ getSessionLeafId,
92206
92245
  SessionManager as SessionManager3,
92207
92246
  sessionBlobHashes as sessionBlobHashes2
92208
92247
  } from "@bastani/atomic";
@@ -92431,7 +92470,7 @@ async function* durableForkPoints(backend, runId, options = {}) {
92431
92470
  runId: source.runId,
92432
92471
  stagePath: record.stagePath
92433
92472
  });
92434
- const entryId = snapshot.entries.at(-1)?.id;
92473
+ const entryId = getSessionLeafId(snapshot.entries) ?? undefined;
92435
92474
  yield {
92436
92475
  stagePath: record.stagePath,
92437
92476
  sessionId: record.sessionId,
@@ -75981,24 +75981,28 @@ ${tail}`;
75981
75981
  function toError2(error) {
75982
75982
  return error instanceof Error ? error : new Error(String(error));
75983
75983
  }
75984
- async function spawnBrokerIfNeeded(brokerCommand, brokerArgs, readyTimeoutMs = BROKER_READY_TIMEOUT_MS, extensionDir = EXTENSION_DIR) {
75984
+ async function spawnBrokerIfNeeded(brokerCommand, brokerArgs, readyTimeoutMs = BROKER_READY_TIMEOUT_MS, extensionDir = EXTENSION_DIR, signal) {
75985
+ signal?.throwIfAborted();
75985
75986
  ensurePrivateDirectory(getIntercomDirPath());
75986
75987
  if (await isBrokerRunning()) {
75987
75988
  return;
75988
75989
  }
75990
+ signal?.throwIfAborted();
75989
75991
  const lockOwner = acquireSpawnLock();
75990
75992
  if (lockOwner === undefined) {
75991
- await waitForBroker(readyTimeoutMs);
75993
+ await waitForBroker(readyTimeoutMs, undefined, signal);
75992
75994
  return;
75993
75995
  }
75994
- await spawnBrokerHoldingLock(lockOwner, brokerCommand, brokerArgs, readyTimeoutMs, extensionDir, true);
75996
+ await spawnBrokerHoldingLock(lockOwner, brokerCommand, brokerArgs, readyTimeoutMs, extensionDir, true, signal);
75995
75997
  }
75996
- async function spawnBrokerHoldingLock(lockOwner, brokerCommand, brokerArgs, readyTimeoutMs, extensionDir, recheck) {
75998
+ async function spawnBrokerHoldingLock(lockOwner, brokerCommand, brokerArgs, readyTimeoutMs, extensionDir, recheck, signal, launchAnyway = false) {
75999
+ const cancelSignal = launchAnyway ? undefined : signal;
75997
76000
  let keepLock = false;
75998
76001
  try {
75999
76002
  if (recheck && await isBrokerRunning()) {
76000
76003
  return;
76001
76004
  }
76005
+ cancelSignal?.throwIfAborted();
76002
76006
  const brokerPath = resolveBrokerEntrypoint(extensionDir);
76003
76007
  const launch = getBrokerLaunchSpec(brokerPath, brokerCommand, brokerArgs, extensionDir);
76004
76008
  const announcement = launch.kind === "windows-launcher" ? { path: getBrokerStartAnnouncementPath(), token: randomUUID16() } : undefined;
@@ -76011,9 +76015,10 @@ async function spawnBrokerHoldingLock(lockOwner, brokerCommand, brokerArgs, read
76011
76015
  writeWindowsHiddenLauncher(launch.launcherCommandLine, launch.launcherPath);
76012
76016
  }
76013
76017
  if (!await resetBrokerLogOnceReleased()) {
76014
- await waitForBroker(readyTimeoutMs);
76018
+ await waitForBroker(readyTimeoutMs, undefined, cancelSignal);
76015
76019
  return;
76016
76020
  }
76021
+ cancelSignal?.throwIfAborted();
76017
76022
  const logFd = launch.kind === "direct" ? openSync3(getBrokerLogPath(), "a") : undefined;
76018
76023
  let child;
76019
76024
  try {
@@ -76058,7 +76063,19 @@ ${describeBrokerLog()}`);
76058
76063
  resolve();
76059
76064
  }, (error) => {
76060
76065
  cleanup();
76061
- keepLock = launch.kind === "direct" && child.exitCode === null && child.signalCode === null && handSpawnLockToBroker(child.pid, lockOwner);
76066
+ const starting = launch.kind === "direct" && child.exitCode === null && child.signalCode === null;
76067
+ let abandonedPid;
76068
+ if (signal?.aborted) {
76069
+ if (launch.kind === "direct")
76070
+ abandonedPid = starting ? child.pid : undefined;
76071
+ else if (announcement !== undefined)
76072
+ abandonedPid = readBrokerStartAnnouncement(announcement);
76073
+ }
76074
+ if (abandonedPid !== undefined) {
76075
+ stopStartingBroker(abandonedPid).finally(() => reject(toError2(error)));
76076
+ return;
76077
+ }
76078
+ keepLock = starting && handSpawnLockToBroker(child.pid, lockOwner);
76062
76079
  reject(toError2(error));
76063
76080
  });
76064
76081
  });
@@ -76067,6 +76084,26 @@ ${describeBrokerLog()}`);
76067
76084
  releaseSpawnLock(lockOwner);
76068
76085
  }
76069
76086
  }
76087
+ async function stopStartingBroker(pid) {
76088
+ const deadline = Date.now() + STARTING_BROKER_KILL_WAIT_MS;
76089
+ if (process.platform === "win32") {
76090
+ await new Promise((resolve) => {
76091
+ const taskkill = spawn("taskkill", ["/PID", String(pid), "/T", "/F"], { stdio: "ignore", windowsHide: true });
76092
+ taskkill.once("error", () => resolve());
76093
+ taskkill.once("exit", () => resolve());
76094
+ });
76095
+ while (isProcessAlive(pid) && Date.now() < deadline)
76096
+ await sleep(BROKER_POLL_MAX_INTERVAL_MS);
76097
+ return;
76098
+ }
76099
+ try {
76100
+ process.kill(-pid, "SIGKILL");
76101
+ } catch {
76102
+ return;
76103
+ }
76104
+ while (isProcessAlive(-pid) && Date.now() < deadline)
76105
+ await sleep(BROKER_POLL_MAX_INTERVAL_MS);
76106
+ }
76070
76107
  async function isBrokerRunning() {
76071
76108
  if (await checkSocketConnectable()) {
76072
76109
  return true;
@@ -76162,10 +76199,11 @@ function releaseSpawnLock(owner, lockPath = getBrokerSpawnLockPath()) {
76162
76199
  unlinkSync4(lockPath);
76163
76200
  } catch {}
76164
76201
  }
76165
- async function waitForBroker(timeoutMs = BROKER_READY_TIMEOUT_MS, announcedPid) {
76202
+ async function waitForBroker(timeoutMs = BROKER_READY_TIMEOUT_MS, announcedPid, signal) {
76166
76203
  const start = Date.now();
76167
76204
  let interval = BROKER_POLL_INITIAL_INTERVAL_MS;
76168
76205
  while (Date.now() - start < timeoutMs) {
76206
+ signal?.throwIfAborted();
76169
76207
  if (await checkSocketConnectable()) {
76170
76208
  return;
76171
76209
  }
@@ -76183,7 +76221,7 @@ ${describeBrokerLog()}`);
76183
76221
  ` + "The broker did not answer on its socket in time; it may still be starting, which a busy machine or an empty jiti " + "cache slows. Try again, or raise `brokerStartupTimeoutMs` in the Intercom config.json (default " + `${BROKER_READY_TIMEOUT_MS} ms).
76184
76222
  ${describeBrokerLog()}`);
76185
76223
  }
76186
- var EXTENSION_DIR, BROKER_LOG_TAIL_BYTES, BROKER_POLL_INITIAL_INTERVAL_MS = 10, BROKER_POLL_MAX_INTERVAL_MS = 100, BROKER_SPAWN_LOCK_MAX_AGE_MS = 60000, INTERNAL_INTERCOM_BROKER_ARG = "--atomic-internal-intercom-broker", BROKER_LOG_RELEASE_WAIT_MS = 1000;
76224
+ var EXTENSION_DIR, BROKER_LOG_TAIL_BYTES, BROKER_POLL_INITIAL_INTERVAL_MS = 10, BROKER_POLL_MAX_INTERVAL_MS = 100, BROKER_SPAWN_LOCK_MAX_AGE_MS = 60000, INTERNAL_INTERCOM_BROKER_ARG = "--atomic-internal-intercom-broker", BROKER_LOG_RELEASE_WAIT_MS = 1000, STARTING_BROKER_KILL_WAIT_MS = 5000;
76187
76225
  var init_spawn = __esm(() => {
76188
76226
  init_socket_liveness();
76189
76227
  init_start_announcement();
@@ -92268,6 +92306,7 @@ import { isAbsolute as isAbsolute17, resolve as resolve21 } from "node:path";
92268
92306
  import {
92269
92307
  assertSessionBlobStore as assertSessionBlobStore2,
92270
92308
  copySessionBlobs as copySessionBlobs2,
92309
+ getSessionLeafId,
92271
92310
  SessionManager as SessionManager3,
92272
92311
  sessionBlobHashes as sessionBlobHashes2
92273
92312
  } from "@bastani/atomic";
@@ -92496,7 +92535,7 @@ async function* durableForkPoints(backend, runId, options = {}) {
92496
92535
  runId: source.runId,
92497
92536
  stagePath: record.stagePath
92498
92537
  });
92499
- const entryId = snapshot.entries.at(-1)?.id;
92538
+ const entryId = getSessionLeafId(snapshot.entries) ?? undefined;
92500
92539
  yield {
92501
92540
  stagePath: record.stagePath,
92502
92541
  sessionId: record.sessionId,
@@ -75829,24 +75829,28 @@ ${tail}`;
75829
75829
  function toError2(error) {
75830
75830
  return error instanceof Error ? error : new Error(String(error));
75831
75831
  }
75832
- async function spawnBrokerIfNeeded(brokerCommand, brokerArgs, readyTimeoutMs = BROKER_READY_TIMEOUT_MS, extensionDir = EXTENSION_DIR) {
75832
+ async function spawnBrokerIfNeeded(brokerCommand, brokerArgs, readyTimeoutMs = BROKER_READY_TIMEOUT_MS, extensionDir = EXTENSION_DIR, signal) {
75833
+ signal?.throwIfAborted();
75833
75834
  ensurePrivateDirectory(getIntercomDirPath());
75834
75835
  if (await isBrokerRunning()) {
75835
75836
  return;
75836
75837
  }
75838
+ signal?.throwIfAborted();
75837
75839
  const lockOwner = acquireSpawnLock();
75838
75840
  if (lockOwner === undefined) {
75839
- await waitForBroker(readyTimeoutMs);
75841
+ await waitForBroker(readyTimeoutMs, undefined, signal);
75840
75842
  return;
75841
75843
  }
75842
- await spawnBrokerHoldingLock(lockOwner, brokerCommand, brokerArgs, readyTimeoutMs, extensionDir, true);
75844
+ await spawnBrokerHoldingLock(lockOwner, brokerCommand, brokerArgs, readyTimeoutMs, extensionDir, true, signal);
75843
75845
  }
75844
- async function spawnBrokerHoldingLock(lockOwner, brokerCommand, brokerArgs, readyTimeoutMs, extensionDir, recheck) {
75846
+ async function spawnBrokerHoldingLock(lockOwner, brokerCommand, brokerArgs, readyTimeoutMs, extensionDir, recheck, signal, launchAnyway = false) {
75847
+ const cancelSignal = launchAnyway ? undefined : signal;
75845
75848
  let keepLock = false;
75846
75849
  try {
75847
75850
  if (recheck && await isBrokerRunning()) {
75848
75851
  return;
75849
75852
  }
75853
+ cancelSignal?.throwIfAborted();
75850
75854
  const brokerPath = resolveBrokerEntrypoint(extensionDir);
75851
75855
  const launch = getBrokerLaunchSpec(brokerPath, brokerCommand, brokerArgs, extensionDir);
75852
75856
  const announcement = launch.kind === "windows-launcher" ? { path: getBrokerStartAnnouncementPath(), token: randomUUID15() } : undefined;
@@ -75859,9 +75863,10 @@ async function spawnBrokerHoldingLock(lockOwner, brokerCommand, brokerArgs, read
75859
75863
  writeWindowsHiddenLauncher(launch.launcherCommandLine, launch.launcherPath);
75860
75864
  }
75861
75865
  if (!await resetBrokerLogOnceReleased()) {
75862
- await waitForBroker(readyTimeoutMs);
75866
+ await waitForBroker(readyTimeoutMs, undefined, cancelSignal);
75863
75867
  return;
75864
75868
  }
75869
+ cancelSignal?.throwIfAborted();
75865
75870
  const logFd = launch.kind === "direct" ? openSync3(getBrokerLogPath(), "a") : undefined;
75866
75871
  let child;
75867
75872
  try {
@@ -75906,7 +75911,19 @@ ${describeBrokerLog()}`);
75906
75911
  resolve();
75907
75912
  }, (error) => {
75908
75913
  cleanup();
75909
- keepLock = launch.kind === "direct" && child.exitCode === null && child.signalCode === null && handSpawnLockToBroker(child.pid, lockOwner);
75914
+ const starting = launch.kind === "direct" && child.exitCode === null && child.signalCode === null;
75915
+ let abandonedPid;
75916
+ if (signal?.aborted) {
75917
+ if (launch.kind === "direct")
75918
+ abandonedPid = starting ? child.pid : undefined;
75919
+ else if (announcement !== undefined)
75920
+ abandonedPid = readBrokerStartAnnouncement(announcement);
75921
+ }
75922
+ if (abandonedPid !== undefined) {
75923
+ stopStartingBroker(abandonedPid).finally(() => reject(toError2(error)));
75924
+ return;
75925
+ }
75926
+ keepLock = starting && handSpawnLockToBroker(child.pid, lockOwner);
75910
75927
  reject(toError2(error));
75911
75928
  });
75912
75929
  });
@@ -75915,6 +75932,26 @@ ${describeBrokerLog()}`);
75915
75932
  releaseSpawnLock(lockOwner);
75916
75933
  }
75917
75934
  }
75935
+ async function stopStartingBroker(pid) {
75936
+ const deadline = Date.now() + STARTING_BROKER_KILL_WAIT_MS;
75937
+ if (process.platform === "win32") {
75938
+ await new Promise((resolve) => {
75939
+ const taskkill = spawn("taskkill", ["/PID", String(pid), "/T", "/F"], { stdio: "ignore", windowsHide: true });
75940
+ taskkill.once("error", () => resolve());
75941
+ taskkill.once("exit", () => resolve());
75942
+ });
75943
+ while (isProcessAlive(pid) && Date.now() < deadline)
75944
+ await sleep(BROKER_POLL_MAX_INTERVAL_MS);
75945
+ return;
75946
+ }
75947
+ try {
75948
+ process.kill(-pid, "SIGKILL");
75949
+ } catch {
75950
+ return;
75951
+ }
75952
+ while (isProcessAlive(-pid) && Date.now() < deadline)
75953
+ await sleep(BROKER_POLL_MAX_INTERVAL_MS);
75954
+ }
75918
75955
  async function isBrokerRunning() {
75919
75956
  if (await checkSocketConnectable()) {
75920
75957
  return true;
@@ -76010,10 +76047,11 @@ function releaseSpawnLock(owner, lockPath = getBrokerSpawnLockPath()) {
76010
76047
  unlinkSync4(lockPath);
76011
76048
  } catch {}
76012
76049
  }
76013
- async function waitForBroker(timeoutMs = BROKER_READY_TIMEOUT_MS, announcedPid) {
76050
+ async function waitForBroker(timeoutMs = BROKER_READY_TIMEOUT_MS, announcedPid, signal) {
76014
76051
  const start = Date.now();
76015
76052
  let interval = BROKER_POLL_INITIAL_INTERVAL_MS;
76016
76053
  while (Date.now() - start < timeoutMs) {
76054
+ signal?.throwIfAborted();
76017
76055
  if (await checkSocketConnectable()) {
76018
76056
  return;
76019
76057
  }
@@ -76031,7 +76069,7 @@ ${describeBrokerLog()}`);
76031
76069
  ` + "The broker did not answer on its socket in time; it may still be starting, which a busy machine or an empty jiti " + "cache slows. Try again, or raise `brokerStartupTimeoutMs` in the Intercom config.json (default " + `${BROKER_READY_TIMEOUT_MS} ms).
76032
76070
  ${describeBrokerLog()}`);
76033
76071
  }
76034
- var EXTENSION_DIR, BROKER_LOG_TAIL_BYTES, BROKER_POLL_INITIAL_INTERVAL_MS = 10, BROKER_POLL_MAX_INTERVAL_MS = 100, BROKER_SPAWN_LOCK_MAX_AGE_MS = 60000, INTERNAL_INTERCOM_BROKER_ARG = "--atomic-internal-intercom-broker", BROKER_LOG_RELEASE_WAIT_MS = 1000;
76072
+ var EXTENSION_DIR, BROKER_LOG_TAIL_BYTES, BROKER_POLL_INITIAL_INTERVAL_MS = 10, BROKER_POLL_MAX_INTERVAL_MS = 100, BROKER_SPAWN_LOCK_MAX_AGE_MS = 60000, INTERNAL_INTERCOM_BROKER_ARG = "--atomic-internal-intercom-broker", BROKER_LOG_RELEASE_WAIT_MS = 1000, STARTING_BROKER_KILL_WAIT_MS = 5000;
76035
76073
  var init_spawn = __esm(() => {
76036
76074
  init_socket_liveness();
76037
76075
  init_start_announcement();
@@ -92203,6 +92241,7 @@ import { isAbsolute as isAbsolute17, resolve as resolve20 } from "node:path";
92203
92241
  import {
92204
92242
  assertSessionBlobStore as assertSessionBlobStore2,
92205
92243
  copySessionBlobs as copySessionBlobs2,
92244
+ getSessionLeafId,
92206
92245
  SessionManager as SessionManager3,
92207
92246
  sessionBlobHashes as sessionBlobHashes2
92208
92247
  } from "@bastani/atomic";
@@ -92431,7 +92470,7 @@ async function* durableForkPoints(backend, runId, options = {}) {
92431
92470
  runId: source.runId,
92432
92471
  stagePath: record.stagePath
92433
92472
  });
92434
- const entryId = snapshot.entries.at(-1)?.id;
92473
+ const entryId = getSessionLeafId(snapshot.entries) ?? undefined;
92435
92474
  yield {
92436
92475
  stagePath: record.stagePath,
92437
92476
  sessionId: record.sessionId,
package/dist/config.d.ts CHANGED
@@ -149,9 +149,10 @@ export declare function getBlueprintActionsDir(agentDir?: string): string;
149
149
  /**
150
150
  * Get path to the extension transpile cache directory (jiti fsCache).
151
151
  * Scoped by version and transform format so neither a release upgrade nor a
152
- * loader transform change reads stale transpiled output.
152
+ * loader transform change reads stale transpiled output. Lives under the agent
153
+ * directory of the load that uses it, which defaults to the one in effect now.
153
154
  */
154
- export declare function getExtensionTranspileCacheDir(): string;
155
+ export declare function getExtensionTranspileCacheDir(agentDir?: string): string;
155
156
  /** Get path to prompt templates directory */
156
157
  export declare function getPromptsDir(): string;
157
158
  /** Get path to sessions directory */
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAwBA,eAAO,MAAM,WAAW,SAItB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,cAAc,SAA2C,CAAC;AAEvE,gEAAgE;AAChE,eAAO,MAAM,YAAY,SAAyB,CAAC;AAMnD,OAAO,EAMN,KAAK,iBAAiB,EAEtB,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAWlG,wBAAgB,mBAAmB,IAAI,OAAO,yBAAyB,EAAE,aAAa,CAErF;AAED,wBAAgB,oBAAoB,CACnC,WAAW,EAAE,MAAM,EACnB,UAAU,CAAC,EAAE,MAAM,EAAE,EACrB,YAAY,GAAE,OAAO,yBAAyB,EAAE,gBAA4D,GAC1G,OAAO,yBAAyB,EAAE,iBAAiB,GAAG,SAAS,CAEjE;AAED,wBAAgB,mCAAmC,CAClD,WAAW,EAAE,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wBAAgB,eAAe,IAAI,MAAM,CAExC"}
package/dist/config.js CHANGED
@@ -398,10 +398,11 @@ const EXTENSION_TRANSPILE_CACHE_FORMAT = "ts-source-specifiers";
398
398
  /**
399
399
  * Get path to the extension transpile cache directory (jiti fsCache).
400
400
  * Scoped by version and transform format so neither a release upgrade nor a
401
- * loader transform change reads stale transpiled output.
401
+ * loader transform change reads stale transpiled output. Lives under the agent
402
+ * directory of the load that uses it, which defaults to the one in effect now.
402
403
  */
403
- export function getExtensionTranspileCacheDir() {
404
- return join(getAgentDir(), "cache", "jiti", `${VERSION}+${EXTENSION_TRANSPILE_CACHE_FORMAT}`);
404
+ export function getExtensionTranspileCacheDir(agentDir = getAgentDir()) {
405
+ return join(agentDir, "cache", "jiti", `${VERSION}+${EXTENSION_TRANSPILE_CACHE_FORMAT}`);
405
406
  }
406
407
  /** Get path to prompt templates directory */
407
408
  export function getPromptsDir() {