@bastani/atomic 0.9.78 → 0.9.79-alpha.2

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 (186) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/dist/builtin/intercom/CHANGELOG.md +12 -0
  3. package/dist/builtin/intercom/broker/broker.ts +198 -72
  4. package/dist/builtin/intercom/broker/client-message-validation.ts +38 -0
  5. package/dist/builtin/intercom/broker/client.ts +150 -11
  6. package/dist/builtin/intercom/broker/delivery-failure-reason.ts +1 -0
  7. package/dist/builtin/intercom/broker/departed-children.ts +23 -0
  8. package/dist/builtin/intercom/broker/hosted-session-errors.ts +188 -0
  9. package/dist/builtin/intercom/broker/hosted-sessions.ts +113 -0
  10. package/dist/builtin/intercom/broker/multinode-router.ts +7 -2
  11. package/dist/builtin/intercom/broker/presence-handler.ts +2 -1
  12. package/dist/builtin/intercom/broker/protocol-version.ts +6 -1
  13. package/dist/builtin/intercom/broker/recipient-gone-errors.ts +46 -5
  14. package/dist/builtin/intercom/broker/released-reply-errors.ts +1 -1
  15. package/dist/builtin/intercom/broker/send-handler.ts +19 -3
  16. package/dist/builtin/intercom/broker/socket-writes.ts +20 -1
  17. package/dist/builtin/intercom/hosted-session-timeout-error.ts +59 -0
  18. package/dist/builtin/intercom/index.bundle.mjs +634 -125
  19. package/dist/builtin/intercom/package.json +1 -1
  20. package/dist/builtin/intercom/types.ts +41 -3
  21. package/dist/builtin/mcp/package.json +1 -1
  22. package/dist/builtin/subagents/CHANGELOG.md +8 -0
  23. package/dist/builtin/subagents/package.json +1 -1
  24. package/dist/builtin/subagents/src/extension/index.bundle.mjs +90 -34
  25. package/dist/builtin/web-access/package.json +1 -1
  26. package/dist/builtin/workflows/CHANGELOG.md +9 -0
  27. package/dist/builtin/workflows/builtin/{chunk-89we7r4p.js → chunk-5hrzxynt.js} +1 -1
  28. package/dist/builtin/workflows/builtin/{chunk-8yfssw01.js → chunk-m56qhe4b.js} +1 -1
  29. package/dist/builtin/workflows/builtin/{chunk-wh2p4qjg.js → chunk-x8m4t2jy.js} +182 -33
  30. package/dist/builtin/workflows/builtin/goal.js +2 -2
  31. package/dist/builtin/workflows/builtin/index.js +3 -3
  32. package/dist/builtin/workflows/builtin/ralph.js +2 -2
  33. package/dist/builtin/workflows/package.json +1 -1
  34. package/dist/builtin/workflows/src/extension/index.bundle.mjs +1243 -230
  35. package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +854 -170
  36. package/dist/builtin/workflows/src/index.js +854 -170
  37. package/dist/builtin/workflows/src/local-worker-entry.mjs +854 -170
  38. package/dist/cli/startup-progress.d.ts +30 -0
  39. package/dist/cli/startup-progress.d.ts.map +1 -0
  40. package/dist/cli/startup-progress.js +78 -0
  41. package/dist/cli/startup-progress.js.map +1 -0
  42. package/dist/core/agent-session-events.d.ts.map +1 -1
  43. package/dist/core/agent-session-events.js +3 -0
  44. package/dist/core/agent-session-events.js.map +1 -1
  45. package/dist/core/agent-session-extension-bindings.d.ts.map +1 -1
  46. package/dist/core/agent-session-extension-bindings.js +2 -0
  47. package/dist/core/agent-session-extension-bindings.js.map +1 -1
  48. package/dist/core/agent-session-methods.d.ts +2 -0
  49. package/dist/core/agent-session-methods.d.ts.map +1 -1
  50. package/dist/core/agent-session-methods.js.map +1 -1
  51. package/dist/core/agent-session-state.d.ts +12 -4
  52. package/dist/core/agent-session-state.d.ts.map +1 -1
  53. package/dist/core/agent-session-state.js +82 -15
  54. package/dist/core/agent-session-state.js.map +1 -1
  55. package/dist/core/agent-session.d.ts +3 -0
  56. package/dist/core/agent-session.d.ts.map +1 -1
  57. package/dist/core/agent-session.js +3 -0
  58. package/dist/core/agent-session.js.map +1 -1
  59. package/dist/core/builtin-resource-loader.d.ts.map +1 -1
  60. package/dist/core/builtin-resource-loader.js +3 -0
  61. package/dist/core/builtin-resource-loader.js.map +1 -1
  62. package/dist/core/debug.d.ts +4 -2
  63. package/dist/core/debug.d.ts.map +1 -1
  64. package/dist/core/debug.js +15 -1
  65. package/dist/core/debug.js.map +1 -1
  66. package/dist/core/export-html/ansi-to-html.d.ts +5 -0
  67. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  68. package/dist/core/export-html/ansi-to-html.js +57 -20
  69. package/dist/core/export-html/ansi-to-html.js.map +1 -1
  70. package/dist/core/export-html/template.js +1 -1
  71. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  72. package/dist/core/export-html/tool-renderer.js +2 -3
  73. package/dist/core/export-html/tool-renderer.js.map +1 -1
  74. package/dist/core/extensions/workflow-activity-hub.d.ts +7 -0
  75. package/dist/core/extensions/workflow-activity-hub.d.ts.map +1 -1
  76. package/dist/core/extensions/workflow-activity-hub.js +104 -6
  77. package/dist/core/extensions/workflow-activity-hub.js.map +1 -1
  78. package/dist/core/keybindings.d.ts +0 -8
  79. package/dist/core/keybindings.d.ts.map +1 -1
  80. package/dist/core/keybindings.js +0 -1
  81. package/dist/core/keybindings.js.map +1 -1
  82. package/dist/core/mandatory-resource-loader.d.ts.map +1 -1
  83. package/dist/core/mandatory-resource-loader.js +3 -0
  84. package/dist/core/mandatory-resource-loader.js.map +1 -1
  85. package/dist/core/resume/session-resume.d.ts +7 -1
  86. package/dist/core/resume/session-resume.d.ts.map +1 -1
  87. package/dist/core/resume/session-resume.js +136 -16
  88. package/dist/core/resume/session-resume.js.map +1 -1
  89. package/dist/core/session-history-index.d.ts +31 -0
  90. package/dist/core/session-history-index.d.ts.map +1 -0
  91. package/dist/core/session-history-index.js +82 -0
  92. package/dist/core/session-history-index.js.map +1 -0
  93. package/dist/core/session-manager-core.d.ts +3 -0
  94. package/dist/core/session-manager-core.d.ts.map +1 -1
  95. package/dist/core/session-manager-core.js +22 -17
  96. package/dist/core/session-manager-core.js.map +1 -1
  97. package/dist/core/session-manager-history.d.ts +3 -3
  98. package/dist/core/session-manager-history.d.ts.map +1 -1
  99. package/dist/core/session-manager-history.js +6 -5
  100. package/dist/core/session-manager-history.js.map +1 -1
  101. package/dist/core/storage/session/history-load-observer.d.ts +11 -0
  102. package/dist/core/storage/session/history-load-observer.d.ts.map +1 -0
  103. package/dist/core/storage/session/history-load-observer.js +25 -0
  104. package/dist/core/storage/session/history-load-observer.js.map +1 -0
  105. package/dist/core/storage/session/sql-session-store.d.ts.map +1 -1
  106. package/dist/core/storage/session/sql-session-store.js +6 -0
  107. package/dist/core/storage/session/sql-session-store.js.map +1 -1
  108. package/dist/core/tool-deactivation.d.ts +11 -0
  109. package/dist/core/tool-deactivation.d.ts.map +1 -0
  110. package/dist/core/tool-deactivation.js +13 -0
  111. package/dist/core/tool-deactivation.js.map +1 -0
  112. package/dist/core/tool-status.d.ts +6 -1
  113. package/dist/core/tool-status.d.ts.map +1 -1
  114. package/dist/core/tool-status.js +11 -3
  115. package/dist/core/tool-status.js.map +1 -1
  116. package/dist/extensions/llama/errors.js +1 -1
  117. package/dist/extensions/llama/errors.js.map +1 -1
  118. package/dist/extensions/llama/provider.d.ts +1 -1
  119. package/dist/extensions/llama/provider.js +1 -1
  120. package/dist/extensions/llama/provider.js.map +1 -1
  121. package/dist/main-session.d.ts +14 -2
  122. package/dist/main-session.d.ts.map +1 -1
  123. package/dist/main-session.js +42 -9
  124. package/dist/main-session.js.map +1 -1
  125. package/dist/main.d.ts.map +1 -1
  126. package/dist/main.js +4 -2
  127. package/dist/main.js.map +1 -1
  128. package/dist/modes/interactive/components/assistant-message.d.ts +6 -0
  129. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  130. package/dist/modes/interactive/components/assistant-message.js +13 -4
  131. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  132. package/dist/modes/interactive/components/compaction-boundary-message.d.ts.map +1 -1
  133. package/dist/modes/interactive/components/compaction-boundary-message.js +3 -4
  134. package/dist/modes/interactive/components/compaction-boundary-message.js.map +1 -1
  135. package/dist/modes/interactive/components/task-detail.d.ts +1 -1
  136. package/dist/modes/interactive/components/task-detail.d.ts.map +1 -1
  137. package/dist/modes/interactive/components/task-detail.js +1 -3
  138. package/dist/modes/interactive/components/task-detail.js.map +1 -1
  139. package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -1
  140. package/dist/modes/interactive/components/task-inspector.js +1 -7
  141. package/dist/modes/interactive/components/task-inspector.js.map +1 -1
  142. package/dist/modes/interactive/components/task-navigation.d.ts +0 -1
  143. package/dist/modes/interactive/components/task-navigation.d.ts.map +1 -1
  144. package/dist/modes/interactive/components/task-navigation.js +1 -3
  145. package/dist/modes/interactive/components/task-navigation.js.map +1 -1
  146. package/dist/modes/interactive/interactive-agent-events.js +5 -9
  147. package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
  148. package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
  149. package/dist/modes/interactive/interactive-deferred-startup.js +8 -5
  150. package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
  151. package/dist/modes/interactive/interactive-process-lifecycle.js +16 -10
  152. package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -1
  153. package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
  154. package/dist/modes/interactive/interactive-startup.js +2 -0
  155. package/dist/modes/interactive/interactive-startup.js.map +1 -1
  156. package/dist/modes/interactive/interactive-unavailable-tools.d.ts +20 -0
  157. package/dist/modes/interactive/interactive-unavailable-tools.d.ts.map +1 -0
  158. package/dist/modes/interactive/interactive-unavailable-tools.js +40 -0
  159. package/dist/modes/interactive/interactive-unavailable-tools.js.map +1 -0
  160. package/dist/modes/interactive-engine/engine-diagnostic-view.d.ts +3 -2
  161. package/dist/modes/interactive-engine/engine-diagnostic-view.d.ts.map +1 -1
  162. package/dist/modes/interactive-engine/engine-diagnostic-view.js +5 -3
  163. package/dist/modes/interactive-engine/engine-diagnostic-view.js.map +1 -1
  164. package/dist/modes/interactive-engine/remote-component.js +1 -1
  165. package/dist/modes/interactive-engine/remote-component.js.map +1 -1
  166. package/docs/background-tasks.md +1 -1
  167. package/docs/compaction/reference.md +1 -1
  168. package/docs/compaction.md +3 -3
  169. package/docs/extensions/api-reference.md +1 -1
  170. package/docs/extensions/events.md +2 -0
  171. package/docs/extensions.md +1 -1
  172. package/docs/intercom/operations.md +2 -2
  173. package/docs/intercom/reference.md +12 -1
  174. package/docs/keybindings.md +2 -3
  175. package/docs/llama-cpp.md +9 -10
  176. package/docs/models/reference.md +1 -1
  177. package/docs/models-configuration.md +1 -1
  178. package/docs/sessions.md +6 -2
  179. package/docs/subagents.md +3 -1
  180. package/docs/usage.md +1 -1
  181. package/docs/workflows/operations.md +2 -2
  182. package/docs/worktree-snapshots.md +3 -1
  183. package/npm-shrinkwrap.json +32 -32
  184. package/package.json +4 -4
  185. package/schemas/keybindings.schema.json +0 -4
  186. package/schemas/models.schema.json +1 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/intercom",
3
- "version": "0.9.78",
3
+ "version": "0.9.79-alpha.2",
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": [
@@ -4,6 +4,7 @@ import type {
4
4
  SerializedIntercomRecipientGoneError,
5
5
  SubagentEndedOutcome,
6
6
  } from "./broker/recipient-gone-errors.js";
7
+ import type { SerializedIntercomHostedSessionError } from "./broker/hosted-session-errors.js";
7
8
  import type { SerializedIntercomReleasedReplyError } from "./broker/released-reply-errors.js";
8
9
 
9
10
  export interface SessionInfo {
@@ -168,7 +169,36 @@ export type DeliveryFailureReasonCode =
168
169
  | "recipient_not_restored"
169
170
  | "recipient_parked"
170
171
  | ReleasedReplyRefusalCode
171
- | IntercomRecipientGoneErrorCode;
172
+ | IntercomRecipientGoneErrorCode
173
+ | "not_hosted_by_connection";
174
+
175
+ /** #4642: why the broker refused a hosted-session request; see `IntercomHostedSessionError`. */
176
+ export type HostedSessionRefusalCode = "invalid_hosted_frame" | "invalid_hosted_session" | "not_hosted_by_connection";
177
+
178
+ /** The broker's typed refusal of a hosted-session request; `key` or `sessionId` names the offending item. */
179
+ export interface HostedSessionRefusal {
180
+ code: HostedSessionRefusalCode;
181
+ key?: string;
182
+ sessionId?: string;
183
+ }
184
+
185
+ /**
186
+ * #4642: one session a connection hosts in a `host_sessions` frame of at most 500. It is listed and addressed like a
187
+ * connected session, without a connection of its own; `key` is the host's name for it in the answer.
188
+ */
189
+ export interface HostedSessionFrameItem {
190
+ key: string;
191
+ session: Omit<SessionInfo, "id">;
192
+ returnAddress?: string;
193
+ liveRoute?: { runId: string; stageKeys: string[]; capability: string };
194
+ }
195
+
196
+ /** The broker id of one hosted session, and whether its live workflow-stage route was registered or why not. */
197
+ export interface HostedSessionAssignment {
198
+ key: string;
199
+ sessionId: string;
200
+ liveRouteRefusal?: LiveWorkflowStageRouteRefusalCode;
201
+ }
172
202
 
173
203
  /** One subagent in a `mark_ended_children` frame: its owner reports how its last run ended (#4639). */
174
204
  export interface EndedChildFrame {
@@ -305,6 +335,10 @@ export type ClientMessage =
305
335
  | { type: "acknowledge_released_child_wake"; requestId: string; childName: string }
306
336
  /** #4326: the owner answers one `released_child_reply` handoff; an ack that names another handoff is ignored. */
307
337
  | { type: "released_child_reply_ack"; messageId: string; handoffId: string; accepted: boolean }
338
+ /** #4642: host sessions without a connection each; protocol 3. The broker answers `hosted_sessions_ack`. */
339
+ | { type: "host_sessions"; requestId: string; sessions: HostedSessionFrameItem[] }
340
+ /** #4642: remove sessions this connection hosts, in a frame of at most 500. */
341
+ | { type: "unhost_sessions"; requestId: string; sessionIds: string[] }
308
342
  | {
309
343
  type: "send" | "supervisor_send";
310
344
  to: string;
@@ -314,6 +348,8 @@ export type ClientMessage =
314
348
  resolveReplyTarget?: true;
315
349
  /** The sender understands `send_held` and may wait past its usual acknowledgement timeout (#3760). */
316
350
  awaitRestoringRecipient?: true;
351
+ /** #4642: send as this session, which this connection hosts. */
352
+ hostedSender?: string;
317
353
  message: Message;
318
354
  attemptId?: string;
319
355
  }
@@ -426,7 +462,8 @@ export type BrokerMessage =
426
462
  | { type: "groups"; requestId: string; groups: GroupSummary[] }
427
463
  | { type: "membership_ack"; requestId: string; groups: string[] }
428
464
  | { type: "supervisor_authorized"; requestId: string; capability: string; supervisorSessionId: string; childName: string }
429
- | { type: "message"; from: SessionInfo; message: Message; channel?: "supervisor" }
465
+ /** `hostedRecipient` names the hosted session the message is for, written only to the connection hosting it (#4642). */
466
+ | { type: "message"; from: SessionInfo; message: Message; channel?: "supervisor"; hostedRecipient?: string }
430
467
  | { type: "pending_stage_notification"; requestId: string; from: SessionInfo; message: Message }
431
468
  | {
432
469
  type: "pending_stage_message";
@@ -474,6 +511,7 @@ export type BrokerMessage =
474
511
  | { type: "released_child_reply"; childName: string; handoffId: string; replyTo: string; from: SessionInfo; message: Message }
475
512
  | { type: "restoring_recipient_ack"; requestId: string; error?: string }
476
513
  | { type: "released_children_ack"; requestId: string; refusal?: ReleasedChildRefusal }
514
+ | { type: "hosted_sessions_ack"; requestId: string; sessions?: HostedSessionAssignment[]; refusal?: HostedSessionRefusal }
477
515
  | {
478
516
  type: "delivery_failed";
479
517
  messageId: string;
@@ -481,7 +519,7 @@ export type BrokerMessage =
481
519
  reasonCode?: DeliveryFailureReasonCode;
482
520
  attemptId?: string;
483
521
  /** #4386: the typed refusal of a reply to a released subagent; its `code` equals `reasonCode`. */
484
- error?: SerializedIntercomReleasedReplyError;
522
+ error?: SerializedIntercomReleasedReplyError | SerializedIntercomHostedSessionError;
485
523
  /**
486
524
  * #4639: why a subagent with no live session is gone. Carried apart from `error` and `reasonCode`, which older
487
525
  * clients validate strictly; they read only `reason`, which is this error's message.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/mcp",
3
- "version": "0.9.78",
3
+ "version": "0.9.79-alpha.2",
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,14 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.9.79-alpha.1] - 2026-11-11
6
+
7
+ ### Fixed
8
+
9
+ - Fixed background subagents being lost when a machine rebooted before their parent session was resumed: a parent on the default SQLite session store kept its children's sessions in the system temporary directory, which a reboot clears. They now live under the agent directory (`subagent-sessions/<parent session id>`), and a recorded session file that is gone is reported by its path instead of as a session-store loss ([#4660](https://github.com/bastani-inc/atomic/issues/4660))
10
+ - Fixed one background subagent whose restoration failed unexpectedly after a restart hiding the notices for every other subagent: each child is now reported on its own, and a child that failed this way is retried on the next resume instead of being recorded as gone ([#4660](https://github.com/bastani-inc/atomic/issues/4660))
11
+ - Fixed the notice for a subagent that could not be restored after a restart saying only to launch a fresh one: it now gives the agent, its task, run and child ids, working directory, worktree and branch, session, a ready `subagent` call to relaunch it in its worktree when its task was recorded (otherwise where to find the launching call), and how to inspect what it left behind ([#4660](https://github.com/bastani-inc/atomic/issues/4660))
12
+
5
13
  ## [0.9.77] - 2026-11-11
6
14
 
7
15
  Delegation guidance uses session memory, and messages to ended subagents say how to continue them.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/subagents",
3
- "version": "0.9.78",
3
+ "version": "0.9.79-alpha.2",
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": [
@@ -6944,11 +6944,9 @@ var require_public_api = __commonJS(function(exports) {
6944
6944
  });
6945
6945
 
6946
6946
  // dist/builtin/subagents/src/extension/index.ts
6947
- import * as fs21 from "node:fs";
6948
6947
  import * as os8 from "node:os";
6949
- import * as path23 from "node:path";
6948
+ import * as path24 from "node:path";
6950
6949
  import {
6951
- APP_NAME as APP_NAME3,
6952
6950
  keyHintIfBound as keyHintIfBound5
6953
6951
  } from "@bastani/atomic";
6954
6952
  import {
@@ -9143,7 +9141,9 @@ function readPreviousIntercomId(sessionManager) {
9143
9141
  }
9144
9142
  async function reopenChildSession(ctx, record) {
9145
9143
  try {
9146
- if (record.childSessionFile && existsSync6(record.childSessionFile)) {
9144
+ if (record.childSessionFile && !existsSync6(record.childSessionFile))
9145
+ return { reason: `its session file is missing: ${record.childSessionFile}` };
9146
+ if (record.childSessionFile) {
9147
9147
  const sessionManager = await SessionManager.open(record.childSessionFile, undefined, record.cwd);
9148
9148
  return record.childSessionId !== undefined && sessionManager.getSessionId() !== record.childSessionId ? { reason: "its session file now belongs to a different session" } : { sessionManager };
9149
9149
  }
@@ -10387,6 +10387,14 @@ function subagentChildModelChoice(options, agent) {
10387
10387
  ...options.modelConstraints ? { modelConstraints: options.modelConstraints } : {}
10388
10388
  };
10389
10389
  }
10390
+ var TASK_SUMMARY_LIMIT = 300;
10391
+ function summarizeSubagentTask(task) {
10392
+ const line = task.replace(/\s+/g, " ").trim();
10393
+ return line.length > TASK_SUMMARY_LIMIT ? `${line.slice(0, TASK_SUMMARY_LIMIT - 1)}…` : line;
10394
+ }
10395
+ function subagentChildTask(task, options) {
10396
+ return options.resumeSession === true || task.trim() === "" ? {} : { task: summarizeSubagentTask(task) };
10397
+ }
10390
10398
  function subagentChildInheritance(options) {
10391
10399
  return {
10392
10400
  ...options.currentModel ? { model: options.currentModel } : {},
@@ -11953,6 +11961,7 @@ async function runAgentTask(input) {
11953
11961
  ...input.options.intercomSessionName ? { intercomTarget: input.options.intercomSessionName } : {},
11954
11962
  ...input.options.intercomGroup ? { intercomGroup: input.options.intercomGroup } : {},
11955
11963
  ...input.options.orchestratorIntercomTarget ? { orchestratorTarget: input.options.orchestratorIntercomTarget } : {},
11964
+ ...subagentChildTask(input.intentTask ?? input.task, input.options),
11956
11965
  ...worktree ? { worktree } : {},
11957
11966
  ...terminalStatus ? { terminalStatus } : {},
11958
11967
  ...waitingOn ? { waitingOn } : {},
@@ -12510,6 +12519,7 @@ function runOwnerlessChild(input) {
12510
12519
  ...input.options.intercomSessionName ? { intercomTarget: input.options.intercomSessionName } : {},
12511
12520
  ...input.options.intercomGroup ? { intercomGroup: input.options.intercomGroup } : {},
12512
12521
  ...input.options.orchestratorIntercomTarget ? { orchestratorTarget: input.options.orchestratorIntercomTarget } : {},
12522
+ ...subagentChildTask(input.task, input.options),
12513
12523
  ...worktree ? { worktree } : {},
12514
12524
  ...terminalStatus ? { terminalStatus } : {},
12515
12525
  ...held?.messages.length ? { heldMessages: { taskId: launchId, ...held } } : {},
@@ -12821,6 +12831,39 @@ function holdDormantRunSubagentChildren(events, ctx, request) {
12821
12831
  };
12822
12832
  }
12823
12833
 
12834
+ // dist/builtin/subagents/src/runs/foreground/subagent-child-lost.ts
12835
+ var FULL_TASK_LIMIT = 2000;
12836
+ function recordedTask(record) {
12837
+ const launched = record.launch?.intentTask ?? record.launch?.task;
12838
+ if (launched) {
12839
+ return launched.length <= FULL_TASK_LIMIT ? { kind: "complete", text: launched } : { kind: "cut", text: summarizeSubagentTask(launched) };
12840
+ }
12841
+ if (!record.task)
12842
+ return { kind: "unrecorded" };
12843
+ return record.task === summarizeSubagentTask(record.task) && record.task.endsWith("…") ? { kind: "cut", text: record.task } : { kind: "complete", text: record.task };
12844
+ }
12845
+ function shellWord(value) {
12846
+ return /^[\w./:@%+=,-]+$/.test(value) ? value : `'${value.replaceAll("'", "'\\''")}'`;
12847
+ }
12848
+ function describeLostSubagentChild(record) {
12849
+ const task = recordedTask(record);
12850
+ const worktree = record.worktree;
12851
+ const cwd = worktree?.path ?? record.cwd;
12852
+ const launchHint = `the \`subagent\` call that launched run ${record.runId} is in this session's history`;
12853
+ const facts = [
12854
+ `agent ${record.agent}`,
12855
+ task.kind === "unrecorded" ? `task: not recorded (${launchHint})` : `task: ${task.kind === "cut" ? `${task.text} (cut to ${TASK_SUMMARY_LIMIT} characters; the full text is in the launching call)` : summarizeSubagentTask(task.text)}`,
12856
+ `run ${record.runId}, child ${record.childId}`,
12857
+ `cwd ${record.cwd}`,
12858
+ ...worktree ? [`worktree ${worktree.path} (branch ${worktree.branch})`] : [],
12859
+ ...record.childSessionId ? [`session ${record.childSessionId}`] : [],
12860
+ ...record.childSessionFile ? [`session file ${record.childSessionFile}`] : []
12861
+ ];
12862
+ const relaunch = task.kind === "complete" ? `To relaunch it: \`subagent({ agent: ${JSON.stringify(record.agent)}, task: ${JSON.stringify(task.text)}, cwd: ${JSON.stringify(cwd)} })\`.` : task.kind === "cut" ? `To relaunch it, take its task from the launching call (${launchHint}) and run \`subagent({ agent: ${JSON.stringify(record.agent)}, task: <its task>, cwd: ${JSON.stringify(cwd)} })\`.` : `To relaunch it, take its task from the launching call and run it with agent ${JSON.stringify(record.agent)} in ${JSON.stringify(cwd)}.`;
12863
+ const inspect = worktree ? `Inspect what it left behind with \`git -C ${shellWord(worktree.path)} status\` and \`git -C ${shellWord(worktree.path)} log ${worktree.baseCommit}..${worktree.branch}\`; relaunching in its worktree continues from that work.` : `Inspect what it left behind in ${record.cwd}.`;
12864
+ return `Facts: ${facts.join("; ")}. ${relaunch} ${inspect}`;
12865
+ }
12866
+
12824
12867
  // dist/builtin/subagents/src/runs/foreground/inprocess-run-sync.ts
12825
12868
  import { existsSync as existsSync14, statSync as statSync9 } from "node:fs";
12826
12869
  import { join as join17 } from "node:path";
@@ -17032,18 +17075,27 @@ function restoredChildrenAwaitingIntercom(ownerSessionId) {
17032
17075
  }
17033
17076
  async function restoreSubagentChildren(deps, ctx) {
17034
17077
  const owned = readSubagentChildRecords(ctx.sessionManager.getEntries(), subagentChildOwner(ctx).sessionId);
17035
- const outcomes = await Promise.all([...owned.values()].filter(isRestorableSubagentChild).map((record) => restoreSubagentChild(deps, ctx, record.childId).catch((error) => {
17036
- if (!isRetryableStorageError(error))
17037
- throw error;
17038
- return;
17039
- })));
17078
+ const restorable = [...owned.values()].filter(isRestorableSubagentChild);
17079
+ const settled = await Promise.allSettled(restorable.map((record) => restoreSubagentChild(deps, ctx, record.childId)));
17080
+ const outcomes = settled.map((result, index) => {
17081
+ if (result.status === "fulfilled")
17082
+ return result.value;
17083
+ const error = result.reason;
17084
+ if (isRetryableStorageError(error))
17085
+ return;
17086
+ return {
17087
+ kind: "unrestorable",
17088
+ childId: restorable[index].childId,
17089
+ reason: error instanceof Error ? error.message : String(error)
17090
+ };
17091
+ });
17040
17092
  return outcomes.filter((outcome) => outcome !== undefined);
17041
17093
  }
17042
17094
  function addressesChild(record, target, previousIntercomId) {
17043
17095
  return [record.intercomTarget, record.childSessionId, previousIntercomId].some((address) => address?.trim().toLowerCase() === target);
17044
17096
  }
17045
- function goneChildRefusal(label, reason) {
17046
- return `Subagent \`${label}\` did not survive the restart and is gone${reason ? `: ${reason}` : ""}. The message was not sent; launch a fresh subagent if its work is still needed.`;
17097
+ function goneChildRefusal(label, record, reason) {
17098
+ return `Subagent \`${label}\` did not survive the restart and is gone${reason ? `: ${reason}` : ""}. The message was not sent. ${describeLostSubagentChild(record)}`;
17047
17099
  }
17048
17100
  function settleWithin(promise, timeoutMs) {
17049
17101
  return new Promise((resolve, reject) => {
@@ -17079,17 +17131,17 @@ async function awaitSubagentChildRestoration(ownerSessionId, entries, targetName
17079
17131
  if (!outcome)
17080
17132
  return `Subagent \`${label}\` is still being restored after the restart. The message was not sent; try again shortly.`;
17081
17133
  if (outcome.kind === "unrestorable")
17082
- return goneChildRefusal(label, outcome.reason);
17134
+ return goneChildRefusal(label, active.record, outcome.reason);
17083
17135
  if (outcome.kind === "restored" && outcome.intercomLive === false)
17084
17136
  return `Subagent \`${label}\` was relaunched after the restart but has not reconnected to Intercom. The message was not sent; its result will still arrive as a task completion.`;
17085
17137
  return;
17086
17138
  }
17087
17139
  for (const reported of goneChildren.values()) {
17088
17140
  if (reported.ownerSessionId === ownerSessionId && addressesChild(reported.record, target, reported.previousIntercomId))
17089
- return goneChildRefusal(reported.record.intercomTarget ?? targetName.trim(), reported.reason);
17141
+ return goneChildRefusal(reported.record.intercomTarget ?? targetName.trim(), reported.record, reported.reason);
17090
17142
  }
17091
17143
  const gone = [...readSubagentChildRecords(entries, ownerSessionId).values()].find((record) => addressesChild(record, target) && record.state === "terminal" && record.terminalStatus === SUBAGENT_CHILD_GONE_STATUS);
17092
- return gone ? goneChildRefusal(gone.intercomTarget ?? targetName.trim()) : undefined;
17144
+ return gone ? goneChildRefusal(gone.intercomTarget ?? targetName.trim(), gone) : undefined;
17093
17145
  }
17094
17146
  function childLabel(record, childId) {
17095
17147
  if (!record)
@@ -17102,7 +17154,7 @@ function subagentChildRestoreNotices(outcomes) {
17102
17154
  return [];
17103
17155
  if (outcome.kind === "unrestorable")
17104
17156
  return [
17105
- `${childLabel(outcome.record, outcome.childId)} did not survive the restart and could not be restored: ${outcome.reason}. It is gone: do not send it Intercom messages or wait for its result. Launch a fresh subagent if its work is still needed.`
17157
+ `${childLabel(outcome.record, outcome.childId)} did not survive the restart and could not be restored: ${outcome.reason}. It is gone: do not send it Intercom messages or wait for its result.${outcome.record ? ` ${describeLostSubagentChild(outcome.record)}` : " Launch a fresh subagent if its work is still needed."}`
17106
17158
  ];
17107
17159
  const label = childLabel(outcome.record, outcome.record.childId);
17108
17160
  const how = outcome.fresh ? "started fresh with its task, since it had not started before the restart," : "relaunched from its own session";
@@ -18708,7 +18760,7 @@ ${effectiveParams.task ?? ""}` };
18708
18760
  if (effectiveParams.sessionDir) {
18709
18761
  sessionRoot = path18.resolve(deps.expandTilde(effectiveParams.sessionDir));
18710
18762
  } else {
18711
- const baseSessionRoot = deps.config.defaultSessionDir ? path18.resolve(deps.expandTilde(deps.config.defaultSessionDir)) : deps.getSubagentSessionRoot(parentSessionFile);
18763
+ const baseSessionRoot = deps.config.defaultSessionDir ? path18.resolve(deps.expandTilde(deps.config.defaultSessionDir)) : deps.getSubagentSessionRoot(parentSessionFile, resolveCurrentSessionId(ctx.sessionManager));
18712
18764
  sessionRoot = path18.join(baseSessionRoot, runId);
18713
18765
  }
18714
18766
  try {
@@ -20065,6 +20117,18 @@ function createSubagentExecutor(rawDeps) {
20065
20117
  };
20066
20118
  }
20067
20119
 
20120
+ // dist/builtin/subagents/src/shared/session-root.ts
20121
+ import * as path21 from "node:path";
20122
+ var SUBAGENT_SESSIONS_DIR = "subagent-sessions";
20123
+ function subagentSessionRoot(parentSessionFile, parentSessionId) {
20124
+ if (parentSessionFile) {
20125
+ const baseName = path21.basename(parentSessionFile, ".jsonl");
20126
+ const sessionsDir = path21.dirname(parentSessionFile);
20127
+ return path21.join(sessionsDir, baseName);
20128
+ }
20129
+ return path21.join(getAgentDir(), SUBAGENT_SESSIONS_DIR, parentSessionId.replace(/[^\w.-]/g, "_"));
20130
+ }
20131
+
20068
20132
  // dist/builtin/subagents/src/slash/bridge-settlement.ts
20069
20133
  import { isStaleExtensionContextError as isStaleExtensionContextError8 } from "@bastani/atomic";
20070
20134
  function bridgeSettlementRegistry() {
@@ -22155,12 +22219,12 @@ function getApiScopedSet(pi, key) {
22155
22219
  }
22156
22220
 
22157
22221
  // dist/builtin/subagents/src/extension/startup-maintenance.ts
22158
- import * as path22 from "node:path";
22222
+ import * as path23 from "node:path";
22159
22223
 
22160
22224
  // dist/builtin/subagents/src/runs/inprocess/runtime-support/temp-cleanup.ts
22161
22225
  import * as fs20 from "node:fs";
22162
- import * as path21 from "node:path";
22163
- var SUBAGENT_RUNTIME_TEMP_DIR = path21.join(TEMP_ROOT_DIR, "nested-subagent-events");
22226
+ import * as path22 from "node:path";
22227
+ var SUBAGENT_RUNTIME_TEMP_DIR = path22.join(TEMP_ROOT_DIR, "nested-subagent-events");
22164
22228
  function hasEntryNewerThan(filePath, cutoff) {
22165
22229
  const stat = fs20.statSync(filePath);
22166
22230
  if (stat.mtimeMs >= cutoff)
@@ -22177,7 +22241,7 @@ function directoryHasEntryNewerThan(dirPath, cutoff) {
22177
22241
  return false;
22178
22242
  }
22179
22243
  for (const entry of entries) {
22180
- const childPath = path21.join(dirPath, entry);
22244
+ const childPath = path22.join(dirPath, entry);
22181
22245
  try {
22182
22246
  const stat = fs20.statSync(childPath);
22183
22247
  if (stat.mtimeMs >= cutoff)
@@ -22199,7 +22263,7 @@ function cleanupOldSubdirectories(root, maxAgeDays) {
22199
22263
  }
22200
22264
  const cutoff = Date.now() - maxAgeDays * 24 * 60 * 60 * 1000;
22201
22265
  for (const entry of entries) {
22202
- const entryPath = path21.join(root, entry);
22266
+ const entryPath = path22.join(root, entry);
22203
22267
  try {
22204
22268
  if (!hasEntryNewerThan(entryPath, cutoff))
22205
22269
  fs20.rmSync(entryPath, { recursive: true, force: true });
@@ -22254,9 +22318,9 @@ function createSubagentStartupMaintenance(_first, second, third) {
22254
22318
  const sessionDir = ctx.sessionManager.getSessionDir();
22255
22319
  if (!sessionDir)
22256
22320
  return;
22257
- const parent = path22.dirname(sessionDir);
22258
- const safeCwd = `--${path22.resolve(ctx.cwd).replace(/^[/\\]/, "").replace(/[/\\:]/g, "-")}--`;
22259
- contextSessionsRoots = path22.basename(parent) === "sessions" && path22.basename(sessionDir) === safeCwd ? [parent] : [];
22321
+ const parent = path23.dirname(sessionDir);
22322
+ const safeCwd = `--${path23.resolve(ctx.cwd).replace(/^[/\\]/, "").replace(/[/\\:]/g, "-")}--`;
22323
+ contextSessionsRoots = path23.basename(parent) === "sessions" && path23.basename(sessionDir) === safeCwd ? [parent] : [];
22260
22324
  } catch {}
22261
22325
  };
22262
22326
  const schedule = (task) => {
@@ -22301,16 +22365,8 @@ function createSubagentStartupMaintenance(_first, second, third) {
22301
22365
  }
22302
22366
 
22303
22367
  // dist/builtin/subagents/src/extension/index.ts
22304
- function getSubagentSessionRoot(parentSessionFile) {
22305
- if (parentSessionFile) {
22306
- const baseName = path23.basename(parentSessionFile, ".jsonl");
22307
- const sessionsDir = path23.dirname(parentSessionFile);
22308
- return path23.join(sessionsDir, baseName);
22309
- }
22310
- return fs21.mkdtempSync(path23.join(os8.tmpdir(), `${APP_NAME3}-subagent-session-`));
22311
- }
22312
22368
  function expandTilde2(p) {
22313
- return p.startsWith("~/") ? path23.join(os8.homedir(), p.slice(2)) : p;
22369
+ return p.startsWith("~/") ? path24.join(os8.homedir(), p.slice(2)) : p;
22314
22370
  }
22315
22371
  function isSlashResultRunning(result) {
22316
22372
  return result.details?.progress?.some((entry) => entry.status === "running") || result.details?.results.some((entry) => entry.progress?.status === "running") || false;
@@ -22438,7 +22494,7 @@ function registerSubagentExtension(pi) {
22438
22494
  state,
22439
22495
  config,
22440
22496
  tempArtifactsDir,
22441
- getSubagentSessionRoot,
22497
+ getSubagentSessionRoot: subagentSessionRoot,
22442
22498
  expandTilde: expandTilde2,
22443
22499
  discoverAgents
22444
22500
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/web-access",
3
- "version": "0.9.78",
3
+ "version": "0.9.79-alpha.2",
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,15 @@ 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.79-alpha.1] - 2026-11-11
10
+
11
+ ### Fixed
12
+
13
+ - Fixed finished workflow stages that you attached to, messaged or asked over Intercom staying in memory until the session ended: a reopened stage, including one of a completed run you opened for inspection, goes back to its saved transcript once its chat is closed and its turn has ended, and the next attach, message or ask reopens it under the same Intercom name ([#4642](https://github.com/bastani-inc/atomic/issues/4642))
14
+ - Fixed the workflow graph overlay and the progress widget slowing down as runs finish more stages: the graph no longer redraws its scrollbar through every row, node lookups no longer rescan the run, and widget frames reuse the run's expanded graph until the run changes ([#4642](https://github.com/bastani-inc/atomic/issues/4642))
15
+ - Fixed starting each stage of a long run walking every earlier stage when nothing in the run is paused or blocked ([#4642](https://github.com/bastani-inc/atomic/issues/4642))
16
+ - Fixed workflow store changes re-reading every stage a long run had finished: the graph snapshot, the progress widget's counts and the root activity published to extensions now redo only the stages that changed, and a run made only of `ctx.stage` stages is expanded from its previous expansion. A run with `ctx.tool` calls or nested workflows still expands in full on each change, so its cost still grows with its finished stages. The executor now tells the store when it edits a finished stage's wait results or worktree snapshot ([#4642](https://github.com/bastani-inc/atomic/issues/4642))
17
+
9
18
  ## [0.9.77] - 2026-11-11
10
19
 
11
20
  The workflow page explains stalled runs, and the bundled Impeccable skill is current.
@@ -37,7 +37,7 @@ import {
37
37
  parseFailureDiagnostics,
38
38
  summarizeReviewConvergence,
39
39
  reverify_consolidated_batch
40
- } from "./chunk-wh2p4qjg.js";
40
+ } from "./chunk-x8m4t2jy.js";
41
41
  import {
42
42
  VERIFICATION_SCALE
43
43
  } from "./chunk-n1910xc4.js";
@@ -39,7 +39,7 @@ import {
39
39
  reviewerFailureText,
40
40
  summarizeReviewConvergence,
41
41
  reverify_consolidated_batch
42
- } from "./chunk-wh2p4qjg.js";
42
+ } from "./chunk-x8m4t2jy.js";
43
43
  import {
44
44
  fold_usage
45
45
  } from "./chunk-tgt0s5e5.js";