@bastani/atomic 0.9.38 → 0.9.39-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 (108) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/builtin/intercom/CHANGELOG.md +6 -0
  3. package/dist/builtin/intercom/index.bundle.mjs +216 -2
  4. package/dist/builtin/intercom/package.json +1 -1
  5. package/dist/builtin/mcp/package.json +1 -1
  6. package/dist/builtin/subagents/CHANGELOG.md +6 -0
  7. package/dist/builtin/subagents/package.json +1 -1
  8. package/dist/builtin/subagents/src/extension/index.bundle.mjs +16 -1
  9. package/dist/builtin/web-access/package.json +1 -1
  10. package/dist/builtin/workflows/CHANGELOG.md +14 -0
  11. package/dist/builtin/workflows/package.json +1 -1
  12. package/dist/builtin/workflows/src/durable/journal/resolution.d.ts +2 -15
  13. package/dist/builtin/workflows/src/extension/index.bundle.mjs +527 -64
  14. package/dist/builtin/workflows/src/index.js +301 -27
  15. package/dist/cli.js +13 -6
  16. package/dist/cli.js.map +1 -1
  17. package/dist/config.d.ts +1 -0
  18. package/dist/config.d.ts.map +1 -1
  19. package/dist/config.js +1 -0
  20. package/dist/config.js.map +1 -1
  21. package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
  22. package/dist/core/agent-session-extension-bindings.js +4 -1
  23. package/dist/core/agent-session-extension-bindings.js.map +1 -1
  24. package/dist/core/agent-session-methods.d.ts +1 -0
  25. package/dist/core/agent-session-methods.d.ts.map +1 -1
  26. package/dist/core/agent-session-methods.js.map +1 -1
  27. package/dist/core/agent-session-types.d.ts +1 -0
  28. package/dist/core/agent-session-types.d.ts.map +1 -1
  29. package/dist/core/agent-session-types.js.map +1 -1
  30. package/dist/core/agent-session.d.ts +1 -0
  31. package/dist/core/agent-session.d.ts.map +1 -1
  32. package/dist/core/agent-session.js +2 -0
  33. package/dist/core/agent-session.js.map +1 -1
  34. package/dist/core/export-html/index.d.ts.map +1 -1
  35. package/dist/core/export-html/index.js +13 -10
  36. package/dist/core/export-html/index.js.map +1 -1
  37. package/dist/core/extensions/api-types.d.ts +2 -0
  38. package/dist/core/extensions/api-types.d.ts.map +1 -1
  39. package/dist/core/extensions/api-types.js.map +1 -1
  40. package/dist/core/extensions/context-types.d.ts +5 -0
  41. package/dist/core/extensions/context-types.d.ts.map +1 -1
  42. package/dist/core/extensions/context-types.js.map +1 -1
  43. package/dist/core/extensions/loader-api.d.ts.map +1 -1
  44. package/dist/core/extensions/loader-api.js +4 -0
  45. package/dist/core/extensions/loader-api.js.map +1 -1
  46. package/dist/core/extensions/runner-context.d.ts.map +1 -1
  47. package/dist/core/extensions/runner-context.js +1 -0
  48. package/dist/core/extensions/runner-context.js.map +1 -1
  49. package/dist/core/extensions/runner.d.ts +1 -0
  50. package/dist/core/extensions/runner.d.ts.map +1 -1
  51. package/dist/core/extensions/runner.js +3 -0
  52. package/dist/core/extensions/runner.js.map +1 -1
  53. package/dist/core/extensions/runtime-types.d.ts +1 -0
  54. package/dist/core/extensions/runtime-types.d.ts.map +1 -1
  55. package/dist/core/extensions/runtime-types.js.map +1 -1
  56. package/dist/core/sdk-types.d.ts +7 -1
  57. package/dist/core/sdk-types.d.ts.map +1 -1
  58. package/dist/core/sdk-types.js.map +1 -1
  59. package/dist/core/sdk.js +1 -0
  60. package/dist/core/sdk.js.map +1 -1
  61. package/dist/core/session-manager-core.d.ts +1 -0
  62. package/dist/core/session-manager-core.d.ts.map +1 -1
  63. package/dist/core/session-manager-core.js +12 -0
  64. package/dist/core/session-manager-core.js.map +1 -1
  65. package/dist/core/storage/provider.d.ts +14 -0
  66. package/dist/core/storage/provider.d.ts.map +1 -1
  67. package/dist/core/storage/provider.js.map +1 -1
  68. package/dist/core/storage/session/legacy-session-store.d.ts +4 -1
  69. package/dist/core/storage/session/legacy-session-store.d.ts.map +1 -1
  70. package/dist/core/storage/session/legacy-session-store.js +42 -2
  71. package/dist/core/storage/session/legacy-session-store.js.map +1 -1
  72. package/dist/core/storage/session/legacy-session-summary.d.ts +8 -0
  73. package/dist/core/storage/session/legacy-session-summary.d.ts.map +1 -1
  74. package/dist/core/storage/session/legacy-session-summary.js +42 -2
  75. package/dist/core/storage/session/legacy-session-summary.js.map +1 -1
  76. package/dist/modes/interactive-engine/create-isolated-runtime.d.ts.map +1 -1
  77. package/dist/modes/interactive-engine/create-isolated-runtime.js +2 -0
  78. package/dist/modes/interactive-engine/create-isolated-runtime.js.map +1 -1
  79. package/dist/modes/interactive-engine/engine-heap.d.ts +24 -0
  80. package/dist/modes/interactive-engine/engine-heap.d.ts.map +1 -0
  81. package/dist/modes/interactive-engine/engine-heap.js +88 -0
  82. package/dist/modes/interactive-engine/engine-heap.js.map +1 -0
  83. package/dist/modes/rpc/rpc-client-api.d.ts +1 -0
  84. package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -1
  85. package/dist/modes/rpc/rpc-client-api.js +3 -0
  86. package/dist/modes/rpc/rpc-client-api.js.map +1 -1
  87. package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
  88. package/dist/modes/rpc/rpc-command-handler.js +7 -0
  89. package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
  90. package/dist/modes/rpc/rpc-types.d.ts +9 -0
  91. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  92. package/dist/modes/rpc/rpc-types.js.map +1 -1
  93. package/dist/utils/heap-relaunch.d.ts +14 -0
  94. package/dist/utils/heap-relaunch.d.ts.map +1 -0
  95. package/dist/utils/heap-relaunch.js +59 -0
  96. package/dist/utils/heap-relaunch.js.map +1 -0
  97. package/docs/environment-variables.md +2 -1
  98. package/docs/intercom/reference.md +1 -1
  99. package/docs/rpc/protocol.md +23 -0
  100. package/docs/sdk/web-server.md +1 -1
  101. package/docs/sdk.md +10 -1
  102. package/docs/session-format.md +1 -0
  103. package/docs/sessions.md +2 -0
  104. package/docs/settings.md +1 -1
  105. package/docs/workflows/api-reference.md +1 -1
  106. package/docs/workflows/operations.md +5 -1
  107. package/npm-shrinkwrap.json +32 -32
  108. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -2,6 +2,19 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.9.39-alpha.1] - 2026-10-19
6
+
7
+ ### Added
8
+
9
+ - Added RPC `delete_session` (`{"type":"delete_session","sessionId":"<id>"}`, or `{"type":"delete_session","id":"<id>"}` when `sessionId` is omitted), `RpcClient.deleteSession(sessionId)`, and `SessionManager.deleteSession(sessionId)` to delete a stored session and its entries from SQLite or JSONL storage. The session currently open in the process cannot be deleted and returns an error ([#3740](https://github.com/bastani-inc/atomic/issues/3740)).
10
+ - Added `createAgentSession({ journal })` so each SDK session can choose its workflow journal (file path, caller-owned database, process-local memory, adapter, or supplied journal) without the process-wide `ATOMIC_WORKFLOW_JOURNAL_PATH` ([#3743](https://github.com/bastani-inc/atomic/issues/3743)).
11
+ - When Atomic runs on Node, the process that runs agents now gets half of system memory for its heap when that is more than Node's default limit (about 4 GiB), so large machines can run more subagents and workflow stages at once. This applies to the interactive engine and to headless runs (`-p`, `--mode json`, `--mode rpc`), which restart themselves once with the larger heap. Set `ATOMIC_HEAP_MB` to choose the size or `0` to keep Node's default; an explicit `--max-old-space-size` in `NODE_OPTIONS` still wins.
12
+
13
+ ### Fixed
14
+
15
+ - `/export` and the RPC `export_html` command now export sessions stored in the default SQLite session store instead of refusing them, reading entries through the session store rather than a session file ([#3741](https://github.com/bastani-inc/atomic/issues/3741))
16
+ - When the earlier JSONL sessions folder holds several copies of one session, such as conflict copies left by a file-sync tool, the default store now lists and imports the copy with the newest message instead of the alphabetically first file.
17
+
5
18
  ## [0.9.38] - 2026-10-18
6
19
 
7
20
  ### Breaking Changes
@@ -4,6 +4,12 @@ All notable changes to the `pi-intercom` extension will be documented in this fi
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.9.39-alpha.1] - 2026-10-19
8
+
9
+ ### Added
10
+
11
+ - A workflow stage whose session was released from memory when its run ended stays in the session list under its previous name, as `closed · reply: post-mortem only`, while the session that ran the workflow is open. An ask to it reopens the stage's saved conversation, runs one turn with the question, and returns that turn's answer, or a failure if the conversation cannot be reopened; a plain send reaches the session that ran the workflow ([#3622](https://github.com/bastani-inc/atomic/issues/3622) by [@vishnu363728](https://github.com/vishnu363728)).
12
+
7
13
  ## [0.9.38] - 2026-10-18
8
14
 
9
15
  ### Fixed
@@ -6464,6 +6464,197 @@ function clearRuntimeIntercomGroup(sessionId) {
6464
6464
  }
6465
6465
  var init_runtime_group = () => {};
6466
6466
 
6467
+ // dist/builtin/intercom/released-stage-peers.ts
6468
+ function isReleasedStageAnnouncement(value) {
6469
+ const route = value;
6470
+ const live = route.liveRoute;
6471
+ return typeof route.runId === "string" && route.runId.length > 0 && typeof route.stageId === "string" && route.stageId.length > 0 && typeof route.stageName === "string" && typeof route.sessionId === "string" && route.sessionId.length > 0 && typeof route.group === "string" && (route.model === undefined || typeof route.model === "string") && typeof route.answer === "function" && (live === undefined || typeof live.capability === "string" && Array.isArray(live.stageKeys) && live.stageKeys.every((key) => typeof key === "string"));
6472
+ }
6473
+ function peerKey(route) {
6474
+ return `${route.runId}\x00${route.stageId}`;
6475
+ }
6476
+ function askPrompt(from, message) {
6477
+ const attachments = message.content.attachments?.length ? formatAttachments(message.content.attachments) : "";
6478
+ return [
6479
+ `**\uD83D\uDCE8 From ${from.name || from.id}** (${from.cwd})`,
6480
+ "",
6481
+ `${message.content.text}${attachments}`,
6482
+ "",
6483
+ "---",
6484
+ "This workflow stage finished earlier and was reopened from its saved conversation to answer this ask.",
6485
+ "Answer in your final message; Atomic delivers it to the asker. Do not call the intercom tool to reply."
6486
+ ].join(`
6487
+ `);
6488
+ }
6489
+
6490
+ class ReleasedStagePeers {
6491
+ deps;
6492
+ peers = new Map;
6493
+ constructor(deps) {
6494
+ this.deps = deps;
6495
+ }
6496
+ get size() {
6497
+ return this.peers.size;
6498
+ }
6499
+ async adopt(route) {
6500
+ const key = peerKey(route);
6501
+ const previous = this.peers.get(key);
6502
+ if (previous !== undefined)
6503
+ await this.close(previous);
6504
+ const peer = {
6505
+ route,
6506
+ returnAddress: `${route.sessionId}:released-stage`,
6507
+ client: null,
6508
+ connecting: null,
6509
+ reconnectTimer: null,
6510
+ reconnectAttempt: 0,
6511
+ closed: false,
6512
+ answering: new Set
6513
+ };
6514
+ this.peers.set(key, peer);
6515
+ await this.connect(peer);
6516
+ }
6517
+ async disconnectAll() {
6518
+ const peers = [...this.peers.values()];
6519
+ this.peers.clear();
6520
+ await Promise.all(peers.map((peer) => this.close(peer)));
6521
+ }
6522
+ connect(peer) {
6523
+ if (peer.connecting !== null)
6524
+ return peer.connecting;
6525
+ const attempt = this.connectOnce(peer).then(() => {
6526
+ peer.reconnectAttempt = 0;
6527
+ }, (error) => {
6528
+ if (peer.connecting === attempt)
6529
+ peer.connecting = null;
6530
+ this.scheduleReconnect(peer);
6531
+ throw toError3(error);
6532
+ });
6533
+ peer.connecting = attempt;
6534
+ const settled = () => {
6535
+ if (peer.connecting === attempt)
6536
+ peer.connecting = null;
6537
+ };
6538
+ attempt.then(settled, settled);
6539
+ return attempt;
6540
+ }
6541
+ async connectOnce(peer) {
6542
+ const { route } = peer;
6543
+ await this.deps.prepare();
6544
+ if (peer.closed)
6545
+ return;
6546
+ const group = normalizeGroup(route.group);
6547
+ const client = this.deps.createClient(peer.returnAddress);
6548
+ client.on("message", (from, message, channel) => {
6549
+ if (peer.client !== client)
6550
+ return;
6551
+ this.receive(peer, client, from, message, channel);
6552
+ });
6553
+ client.on("disconnected", () => {
6554
+ if (peer.client !== client)
6555
+ return;
6556
+ peer.client = null;
6557
+ this.scheduleReconnect(peer);
6558
+ });
6559
+ client.on("error", () => {});
6560
+ peer.client = client;
6561
+ try {
6562
+ const now = Date.now();
6563
+ await client.connect({
6564
+ name: resolveIntercomPresenceName(undefined, route.sessionId),
6565
+ cwd: this.deps.cwd(),
6566
+ model: route.model ?? "unknown",
6567
+ pid: process.pid,
6568
+ startedAt: now,
6569
+ lastActivity: now,
6570
+ status: RELEASED_STAGE_STATUS,
6571
+ replyCapability: "live",
6572
+ groups: [group],
6573
+ group
6574
+ }, undefined, undefined, undefined, group);
6575
+ if (route.liveRoute !== undefined && route.liveRoute.stageKeys.length > 0) {
6576
+ try {
6577
+ await client.registerLiveWorkflowStageRoute(route.runId, [...route.liveRoute.stageKeys], route.liveRoute.capability);
6578
+ } catch (error) {
6579
+ if (!(error instanceof IntercomLiveRouteRefusedError))
6580
+ throw error;
6581
+ }
6582
+ }
6583
+ if (peer.closed) {
6584
+ peer.client = null;
6585
+ await client.disconnect();
6586
+ }
6587
+ } catch (error) {
6588
+ if (peer.client === client)
6589
+ peer.client = null;
6590
+ try {
6591
+ await client.disconnect();
6592
+ } catch {}
6593
+ throw error;
6594
+ }
6595
+ }
6596
+ scheduleReconnect(peer) {
6597
+ if (peer.closed || peer.reconnectTimer !== null || peer.connecting !== null)
6598
+ return;
6599
+ peer.reconnectTimer = setTimeout(() => {
6600
+ peer.reconnectTimer = null;
6601
+ if (peer.closed)
6602
+ return;
6603
+ peer.reconnectAttempt += 1;
6604
+ this.connect(peer).catch(() => {});
6605
+ }, reconnectDelayMs(peer.reconnectAttempt));
6606
+ }
6607
+ receive(peer, client, from, message, channel) {
6608
+ if (message.expectsReply !== true || channel !== undefined) {
6609
+ this.deps.relay(from, message, channel);
6610
+ return;
6611
+ }
6612
+ if (peer.answering.has(message.id))
6613
+ return;
6614
+ peer.answering.add(message.id);
6615
+ this.answer(peer, client, from, message).finally(() => peer.answering.delete(message.id));
6616
+ }
6617
+ async answer(peer, client, from, message) {
6618
+ let reply;
6619
+ try {
6620
+ reply = { text: await peer.route.answer(askPrompt(from, message)) };
6621
+ } catch (error) {
6622
+ const failure = `Released workflow stage could not answer: ${toError3(error).message}`;
6623
+ reply = { text: failure, replyError: failure };
6624
+ }
6625
+ if (peer.closed || !client.isConnected())
6626
+ return;
6627
+ try {
6628
+ await client.send(from.id, { ...reply, replyTo: message.id, requirePendingReply: true });
6629
+ } catch {}
6630
+ }
6631
+ async close(peer) {
6632
+ peer.closed = true;
6633
+ if (peer.reconnectTimer !== null)
6634
+ clearTimeout(peer.reconnectTimer);
6635
+ peer.reconnectTimer = null;
6636
+ if (this.peers.get(peerKey(peer.route)) === peer)
6637
+ this.peers.delete(peerKey(peer.route));
6638
+ try {
6639
+ await peer.connecting;
6640
+ } catch {}
6641
+ const client = peer.client;
6642
+ peer.client = null;
6643
+ if (client === null)
6644
+ return;
6645
+ try {
6646
+ await client.disconnect();
6647
+ } catch {}
6648
+ }
6649
+ }
6650
+ var RELEASED_STAGE_EVENT = "atomic:workflow-released-stage", RELEASED_STAGE_STATUS = "closed · reply: post-mortem only";
6651
+ var init_released_stage_peers = __esm(() => {
6652
+ init_group();
6653
+ init_intercom_utils();
6654
+ init_live_route_refusal();
6655
+ init_reconnect_backoff();
6656
+ });
6657
+
6467
6658
  // dist/builtin/intercom/supervisor-authorization-registry.ts
6468
6659
  import { randomUUID as randomUUID6 } from "node:crypto";
6469
6660
 
@@ -6545,6 +6736,16 @@ function piIntercomExtension(pi, testOverrides = {}) {
6545
6736
  const pendingStageRoutes = new Map;
6546
6737
  const pendingStageRouteClients = new Map;
6547
6738
  const supervisorAuthorizations = new SupervisorAuthorizationRegistry;
6739
+ const releasedStagePeers = new ReleasedStagePeers({
6740
+ prepare: () => spawnBrokerIfNeeded(config.brokerCommand, config.brokerArgs),
6741
+ createClient: (returnAddress) => new IntercomClient(returnAddress),
6742
+ cwd: () => getLiveContext()?.cwd ?? process.cwd(),
6743
+ relay: (from, message, channel) => {
6744
+ const liveContext = getLiveContext();
6745
+ if (liveContext)
6746
+ handleIncomingMessage(liveContext, from, message, channel);
6747
+ }
6748
+ });
6548
6749
  let inboundFlushTimer = null;
6549
6750
  function rejectReplyWaiter(error) {
6550
6751
  replyWaiters.rejectAll(error);
@@ -7243,6 +7444,13 @@ function piIntercomExtension(pi, testOverrides = {}) {
7243
7444
  payload.completion = completion;
7244
7445
  completion.catch(() => {});
7245
7446
  });
7447
+ pi.events.on(RELEASED_STAGE_EVENT, (payload) => {
7448
+ if (typeof payload !== "object" || payload === null || !isReleasedStageAnnouncement(payload))
7449
+ return;
7450
+ if (!getLiveContext())
7451
+ return;
7452
+ releasedStagePeers.adopt(payload).catch(() => {});
7453
+ });
7246
7454
  async function pendingStageNotificationClient(runId) {
7247
7455
  const route = pendingStageRoutes.get(runId);
7248
7456
  if (route === undefined)
@@ -7307,7 +7515,10 @@ function piIntercomExtension(pi, testOverrides = {}) {
7307
7515
  registerIntercomLifecycle(pi, {
7308
7516
  config,
7309
7517
  client: () => client,
7310
- disconnectAuxiliaryClients: disconnectPendingStageRouteClients,
7518
+ disconnectAuxiliaryClients: async () => {
7519
+ await disconnectPendingStageRouteClients();
7520
+ await releasedStagePeers.disconnectAll();
7521
+ },
7311
7522
  setClient: (value) => {
7312
7523
  client = value;
7313
7524
  if (value === null)
@@ -7449,6 +7660,7 @@ var init_index_heavy = __esm(() => {
7449
7660
  init_group();
7450
7661
  init_runtime_group();
7451
7662
  init_reconnect_backoff();
7663
+ init_released_stage_peers();
7452
7664
  init_supervisor_authorization_registry();
7453
7665
  if (process.env.ATOMIC_TEST_LAZY_IMPORT_SENTINEL === "1") {
7454
7666
  process.env.ATOMIC_INTERCOM_HEAVY_IMPORTED = "1";
@@ -7710,6 +7922,7 @@ var SUBAGENT_SUPERVISOR_AUTHORIZATION_EVENT2 = "subagent:supervisor-authorizatio
7710
7922
  var WORKFLOW_STAGE_LATE_MESSAGE_EVENT = "atomic:workflow-stage-late-message";
7711
7923
  var PENDING_STAGE_ROUTE_EVENT2 = "atomic:workflow-pending-stage-route";
7712
7924
  var PENDING_STAGE_UNDELIVERABLE_EVENT2 = "atomic:workflow-pending-stage-undeliverable";
7925
+ var RELEASED_STAGE_EVENT2 = "atomic:workflow-released-stage";
7713
7926
  function isPendingStageUndeliverableRelay(value) {
7714
7927
  if (typeof value !== "object" || value === null)
7715
7928
  return false;
@@ -8211,7 +8424,8 @@ function intercom(pi, options = {}) {
8211
8424
  for (const eventName of [
8212
8425
  SUBAGENT_CONTROL_INTERCOM_EVENT2,
8213
8426
  SUBAGENT_RESULT_INTERCOM_EVENT3,
8214
- PENDING_STAGE_ROUTE_EVENT2
8427
+ PENDING_STAGE_ROUTE_EVENT2,
8428
+ RELEASED_STAGE_EVENT2
8215
8429
  ]) {
8216
8430
  pi.events.on(eventName, (payload) => {
8217
8431
  const ctx = latestLifecycleContext();
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/intercom",
3
- "version": "0.9.38",
3
+ "version": "0.9.39-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.38",
3
+ "version": "0.9.39-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": [
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.9.39-alpha.1] - 2026-10-19
6
+
7
+ ### Fixed
8
+
9
+ - A finished in-process subagent child no longer keeps its disposed agent session reachable for as long as its task exists. The task keeps the child's transcript entries for inspection but releases the session itself, so a long-lived parent session that launches many children stops accumulating their memory ([#3622](https://github.com/bastani-inc/atomic/issues/3622) by [@vishnu363728](https://github.com/vishnu363728)).
10
+
5
11
  ## [0.9.38] - 2026-10-18
6
12
 
7
13
  ### Breaking Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/subagents",
3
- "version": "0.9.38",
3
+ "version": "0.9.39-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": [
@@ -10746,6 +10746,11 @@ function createTestSession(sessionManager, spec) {
10746
10746
  dispose: testOptions.dispose ?? (() => {})
10747
10747
  };
10748
10748
  }
10749
+ function settledTranscript(manager) {
10750
+ const sessionId = manager.getSessionId();
10751
+ const entries = manager.getEntries();
10752
+ return { getSessionId: () => sessionId, getEntries: () => [...entries] };
10753
+ }
10749
10754
  function nativeStatus(value) {
10750
10755
  return value === "killed" ? "interrupted" : value;
10751
10756
  }
@@ -10960,6 +10965,7 @@ class SubagentControlRuntime {
10960
10965
  const configuredThinking = candidate.thinkingLevel ?? admitted.policy.thinkingLevel;
10961
10966
  let effectiveModelId = candidateModelId;
10962
10967
  let effectiveThinking = initialThinkingForAttempt(candidateModelId, configuredThinking);
10968
+ let transcriptManager;
10963
10969
  let attemptedModels = candidateModelId ? [candidateModelId] : [];
10964
10970
  const selectedModel = candidate.model ?? admitted.policy.model;
10965
10971
  if (selectedModel)
@@ -11066,6 +11072,7 @@ class SubagentControlRuntime {
11066
11072
  try {
11067
11073
  const workflow = workflowMetadataFromContext(admitted.spec.parent?.orchestrationContext);
11068
11074
  const sessionManager = admitted.sessionManager ? await SessionManager.open(admitted.sessionManager.getSessionStore(), admitted.sessionManager.getSessionId(), admitted.policy.cwd) : await SessionManager.create(admitted.policy.cwd, admitted.sessionDir, workflow ? { internal: true, workflow } : { internal: true });
11075
+ transcriptManager = sessionManager;
11069
11076
  taskHooks?.bindTranscript?.(sessionManager);
11070
11077
  if (workflow)
11071
11078
  await sessionManager.markSessionInternal(workflow);
@@ -11336,6 +11343,10 @@ class SubagentControlRuntime {
11336
11343
  try {
11337
11344
  unsubscribe?.();
11338
11345
  } catch {}
11346
+ const settleTranscript = () => {
11347
+ if (transcriptManager !== undefined)
11348
+ taskHooks?.bindTranscript?.(settledTranscript(transcriptManager));
11349
+ };
11339
11350
  if (onCleanup) {
11340
11351
  onCleanup((async () => {
11341
11352
  try {
@@ -11352,12 +11363,16 @@ class SubagentControlRuntime {
11352
11363
  }
11353
11364
  ]
11354
11365
  };
11366
+ } finally {
11367
+ settleTranscript();
11355
11368
  }
11356
11369
  })());
11357
11370
  } else {
11358
11371
  try {
11359
11372
  await session?.dispose();
11360
- } catch {}
11373
+ } catch {} finally {
11374
+ settleTranscript();
11375
+ }
11361
11376
  }
11362
11377
  if (this.attemptTokens.get(admitted.identity.path) === token)
11363
11378
  this.attemptTokens.delete(admitted.identity.path);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/web-access",
3
- "version": "0.9.38",
3
+ "version": "0.9.39-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,20 @@ 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.39-alpha.1] - 2026-10-19
10
+
11
+ ### Added
12
+
13
+ - `workflow({ action: "status", runId, summary: true })` returns a compact status of one run: status, timing, final outputs (`result`), error and blockers (failed or blocked stages and tools, and stages awaiting input), without the stage and tool history ([#3744](https://github.com/bastani-inc/atomic/issues/3744)).
14
+
15
+ ### Fixed
16
+
17
+ - `workflow({ action: "status", runId })` for a run another session started now includes the run's final outputs in `detail.result`, because the journal now records them when the run finishes; runs finished by an earlier version have no recorded outputs ([#3744](https://github.com/bastani-inc/atomic/issues/3744)).
18
+ - A workflow run that finishes after receiving a sticky Intercom message (for example a send to `workflow:<rootRunId>/**`) no longer prints `pending stage delivery sweep failed: Workflow execution for <runId> is retired`, and its leftover sticky messages are settled instead of staying queued ([#3745](https://github.com/bastani-inc/atomic/issues/3745)).
19
+ - The `workflow` tool now honours the session's settings, including in-memory `workflows.journal` settings, and a per-session `journal` passed to `createAgentSession`, instead of reading only `ATOMIC_WORKFLOW_JOURNAL_PATH` and `settings.json`. A memory journal selected through session settings belongs to that session alone, and disposing a session closes the journals it opened (once no other session shares them) instead of keeping them and their process-exit hooks until exit ([#3743](https://github.com/bastani-inc/atomic/issues/3743)).
20
+ - Disposing a session now leaves its paused workflow runs `paused` and resumable instead of turning them `failed` with `SessionClosed`, and a run whose stage was mid-step when the session closed is paused rather than failed. `session.workflows.resume(runId)` still adopts the released runs ([#3742](https://github.com/bastani-inc/atomic/issues/3742)).
21
+ - Completed workflow stages no longer keep their agent sessions in memory for the life of the process, which could exhaust the V8 heap in long-running sessions. When a run ends, including a run that failed and can be resumed, each completed stage whose conversation is saved is disposed and dropped from the stage registry and completed-workflow inspection; attaching to it or messaging it reopens the saved conversation without rerunning the workflow, and the stage stays in the Intercom list as `closed · reply: post-mortem only` for as long as the session that ran the workflow is open: an ask to it reopens the saved conversation, runs one turn with the question, and returns that turn's answer. A stage with a mounted chat (visible or hidden), queued or in-flight messages, an active turn, compaction or retry, or no saved transcript stays live until the session that ran the workflow is replaced or shut down, and a stage reopened by attach, a message, or an Intercom ask stays in memory until then ([#3622](https://github.com/bastani-inc/atomic/issues/3622) by [@vishnu363728](https://github.com/vishnu363728)).
22
+
9
23
  ## [0.9.38] - 2026-10-18
10
24
 
11
25
  ### Breaking Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/workflows",
3
- "version": "0.9.38",
3
+ "version": "0.9.39-alpha.1",
4
4
  "private": true,
5
5
  "description": "Atomic extension for multi-stage workflow authoring and execution.",
6
6
  "contributors": [
@@ -1,19 +1,6 @@
1
- import { type AdapterOptions, type SecretRef, type SqliteDatabase, type StorageSelection, type StorageSettingsSelection } from "@bastani/atomic/storage";
1
+ import { type RunJournalOption, type StorageSelection, type StorageSettingsSelection } from "@bastani/atomic/storage";
2
2
  import type { RunJournal } from "./types.js";
3
- export type RunJournalOption = {
4
- path: string;
5
- prefix?: string;
6
- } | {
7
- database: SqliteDatabase;
8
- prefix?: string;
9
- } | {
10
- memory: true;
11
- } | {
12
- adapter: string;
13
- options?: AdapterOptions;
14
- secrets?: Readonly<Record<string, SecretRef>>;
15
- prefix?: string;
16
- } | RunJournal;
3
+ export type { RunJournalOption };
17
4
  export interface RunJournalSettings {
18
5
  workflows?: string[] | {
19
6
  journal?: StorageSettingsSelection;