@bastani/atomic 0.9.85-alpha.1 → 0.9.86-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 (125) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/dist/builtin/intercom/CHANGELOG.md +25 -0
  3. package/dist/builtin/intercom/README.md +10 -9
  4. package/dist/builtin/intercom/broker/away-asks.ts +260 -0
  5. package/dist/builtin/intercom/broker/broker.ts +170 -9
  6. package/dist/builtin/intercom/broker/client.ts +5 -3
  7. package/dist/builtin/intercom/broker/held-reply-targets.ts +5 -0
  8. package/dist/builtin/intercom/broker/multinode-router.ts +16 -7
  9. package/dist/builtin/intercom/broker/paths.ts +5 -0
  10. package/dist/builtin/intercom/broker/pending-question-index.ts +119 -0
  11. package/dist/builtin/intercom/broker/released-asker-replies.ts +39 -0
  12. package/dist/builtin/intercom/broker/send-handler.ts +44 -3
  13. package/dist/builtin/intercom/broker/terminal-questions.ts +2 -0
  14. package/dist/builtin/intercom/index.bundle.mjs +799 -177
  15. package/dist/builtin/intercom/package.json +1 -1
  16. package/dist/builtin/intercom/retry-policy.ts +1 -1
  17. package/dist/builtin/intercom/skills/intercom/SKILL.md +29 -35
  18. package/dist/builtin/intercom/types.ts +7 -2
  19. package/dist/builtin/mcp/package.json +1 -1
  20. package/dist/builtin/subagents/CHANGELOG.md +20 -0
  21. package/dist/builtin/subagents/package.json +1 -1
  22. package/dist/builtin/subagents/skills/subagent/SKILL.md +1 -1
  23. package/dist/builtin/subagents/src/extension/index.bundle.mjs +2765 -2719
  24. package/dist/builtin/web-access/package.json +1 -1
  25. package/dist/builtin/workflows/CHANGELOG.md +22 -0
  26. package/dist/builtin/workflows/package.json +1 -1
  27. package/dist/builtin/workflows/src/authoring.d.ts +1 -1
  28. package/dist/builtin/workflows/src/extension/index.bundle.mjs +371 -193
  29. package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +358 -181
  30. package/dist/builtin/workflows/src/index.js +356 -183
  31. package/dist/builtin/workflows/src/local-worker-entry.mjs +358 -181
  32. package/dist/builtin/workflows/src/shared/worktree-restore-outcome.d.ts +16 -0
  33. package/dist/builtin/workflows/src/workers/workspace-binding.d.ts +13 -2
  34. package/dist/core/agent-session-methods.d.ts +1 -0
  35. package/dist/core/agent-session-methods.d.ts.map +1 -1
  36. package/dist/core/agent-session-methods.js.map +1 -1
  37. package/dist/core/agent-session-prompt.d.ts.map +1 -1
  38. package/dist/core/agent-session-prompt.js +2 -35
  39. package/dist/core/agent-session-prompt.js.map +1 -1
  40. package/dist/core/agent-session-runtime.d.ts +3 -1
  41. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  42. package/dist/core/agent-session-runtime.js +12 -5
  43. package/dist/core/agent-session-runtime.js.map +1 -1
  44. package/dist/core/agent-session-state.d.ts.map +1 -1
  45. package/dist/core/agent-session-state.js +14 -1
  46. package/dist/core/agent-session-state.js.map +1 -1
  47. package/dist/core/agent-session.d.ts +2 -0
  48. package/dist/core/agent-session.d.ts.map +1 -1
  49. package/dist/core/agent-session.js +3 -1
  50. package/dist/core/agent-session.js.map +1 -1
  51. package/dist/core/resume/index.d.ts +1 -1
  52. package/dist/core/resume/index.d.ts.map +1 -1
  53. package/dist/core/resume/index.js +1 -1
  54. package/dist/core/resume/index.js.map +1 -1
  55. package/dist/core/resume/path-mapping.d.ts +10 -0
  56. package/dist/core/resume/path-mapping.d.ts.map +1 -1
  57. package/dist/core/resume/path-mapping.js +20 -0
  58. package/dist/core/resume/path-mapping.js.map +1 -1
  59. package/dist/core/resume/session-resume.d.ts +5 -0
  60. package/dist/core/resume/session-resume.d.ts.map +1 -1
  61. package/dist/core/resume/session-resume.js +24 -9
  62. package/dist/core/resume/session-resume.js.map +1 -1
  63. package/dist/core/session-worktree-snapshots.d.ts +5 -8
  64. package/dist/core/session-worktree-snapshots.d.ts.map +1 -1
  65. package/dist/core/session-worktree-snapshots.js +34 -99
  66. package/dist/core/session-worktree-snapshots.js.map +1 -1
  67. package/dist/core/skill-catalog.d.ts +11 -0
  68. package/dist/core/skill-catalog.d.ts.map +1 -1
  69. package/dist/core/skill-catalog.js +31 -0
  70. package/dist/core/skill-catalog.js.map +1 -1
  71. package/dist/core/tasks/agent-adapter.d.ts +2 -0
  72. package/dist/core/tasks/agent-adapter.d.ts.map +1 -1
  73. package/dist/core/tasks/agent-adapter.js +5 -1
  74. package/dist/core/tasks/agent-adapter.js.map +1 -1
  75. package/dist/core/tasks/supervisor.d.ts +17 -0
  76. package/dist/core/tasks/supervisor.d.ts.map +1 -1
  77. package/dist/core/tasks/supervisor.js +12 -6
  78. package/dist/core/tasks/supervisor.js.map +1 -1
  79. package/dist/core/tasks/task-view-source.d.ts +10 -0
  80. package/dist/core/tasks/task-view-source.d.ts.map +1 -1
  81. package/dist/core/tasks/task-view-source.js +24 -1
  82. package/dist/core/tasks/task-view-source.js.map +1 -1
  83. package/dist/core/worktree-snapshot/best-restore.d.ts +45 -0
  84. package/dist/core/worktree-snapshot/best-restore.d.ts.map +1 -0
  85. package/dist/core/worktree-snapshot/best-restore.js +92 -0
  86. package/dist/core/worktree-snapshot/best-restore.js.map +1 -0
  87. package/dist/core/worktree-snapshot/git.d.ts +2 -2
  88. package/dist/core/worktree-snapshot/git.d.ts.map +1 -1
  89. package/dist/core/worktree-snapshot/git.js +2 -5
  90. package/dist/core/worktree-snapshot/git.js.map +1 -1
  91. package/dist/core/worktree-snapshot/index.d.ts +1 -0
  92. package/dist/core/worktree-snapshot/index.d.ts.map +1 -1
  93. package/dist/core/worktree-snapshot/index.js +1 -0
  94. package/dist/core/worktree-snapshot/index.js.map +1 -1
  95. package/dist/core/worktree-snapshot/restore.d.ts.map +1 -1
  96. package/dist/core/worktree-snapshot/restore.js +18 -2
  97. package/dist/core/worktree-snapshot/restore.js.map +1 -1
  98. package/dist/index.d.ts +3 -2
  99. package/dist/index.d.ts.map +1 -1
  100. package/dist/index.js +1 -0
  101. package/dist/index.js.map +1 -1
  102. package/dist/modes/interactive/chat-autocomplete.d.ts +7 -0
  103. package/dist/modes/interactive/chat-autocomplete.d.ts.map +1 -0
  104. package/dist/modes/interactive/chat-autocomplete.js +85 -0
  105. package/dist/modes/interactive/chat-autocomplete.js.map +1 -0
  106. package/dist/modes/interactive/components/task-transcript-page.d.ts.map +1 -1
  107. package/dist/modes/interactive/components/task-transcript-page.js +8 -0
  108. package/dist/modes/interactive/components/task-transcript-page.js.map +1 -1
  109. package/dist/modes/interactive/interactive-autocomplete.js +3 -79
  110. package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
  111. package/dist/modes/interactive/skill-command-autocomplete.d.ts +6 -0
  112. package/dist/modes/interactive/skill-command-autocomplete.d.ts.map +1 -1
  113. package/dist/modes/interactive/skill-command-autocomplete.js +18 -2
  114. package/dist/modes/interactive/skill-command-autocomplete.js.map +1 -1
  115. package/docs/background-tasks.md +1 -1
  116. package/docs/intercom/operations.md +4 -4
  117. package/docs/intercom/reference.md +39 -8
  118. package/docs/intercom.md +26 -9
  119. package/docs/skills.md +3 -1
  120. package/docs/subagents.md +2 -0
  121. package/docs/workflows/api-reference.md +3 -3
  122. package/docs/workflows/operations.md +2 -2
  123. package/docs/worktree-snapshots.md +10 -4
  124. package/npm-shrinkwrap.json +32 -32
  125. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/intercom",
3
- "version": "0.9.85-alpha.1",
3
+ "version": "0.9.86-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": [
@@ -20,7 +20,7 @@ export const RECIPIENT_SAVING_REPORT_INTERVAL_MS = RECIPIENT_RECEIPT_TIMEOUT_MS
20
20
  /** No save holds its sender longer than this, however long the recipient keeps reporting progress. */
21
21
  export const RECIPIENT_SAVE_MAX_WAIT_MS = 120_000;
22
22
 
23
- /** Wording shared with a released question that reaches the same timeout. */
23
+ /** Wording for an operation whose automatic recovery stopped with an unknown outcome. */
24
24
  export function intercomRecoveryStoppedText(reason: string, retries: number): string {
25
25
  return `${reason}\nIntercom recovery stopped after ${retries} automatic retries. Delivery may already have occurred. Do not repeat this operation automatically; check with the recipient before intentionally sending a new message.`;
26
26
  }
@@ -47,14 +47,16 @@ intercom({
47
47
  })
48
48
  ```
49
49
 
50
- **Worker asks for clarification** (blocks until answer):
50
+ **Worker asks for clarification** (never blocks):
51
51
  ```typescript
52
52
  intercom({
53
53
  action: "ask",
54
54
  to: "planner",
55
55
  message: "Should I use exponential backoff or fixed intervals?"
56
56
  })
57
- // → Returns the planner's reply as the result
57
+ // → A quick reply comes back as the result. Otherwise the ask stays pending and the
58
+ // reply arrives later as a message: "Reply to your ask <id> from planner".
59
+ // Keep working on what you can meanwhile; do not ask again.
58
60
  ```
59
61
 
60
62
  **Worker reports completion**:
@@ -133,18 +135,18 @@ Explicit `to` selects that sender's pending ask even if another message triggere
133
135
 
134
136
  ### Pattern 4: Broadcast to Multiple Workers
135
137
 
136
- Send to multiple sessions in parallel:
138
+ Send one message to every matching session in one call:
137
139
 
138
140
  ```typescript
139
- const workers = ["worker-1", "worker-2", "worker-3"];
140
- const task = "Check for null pointer exceptions in your assigned files";
141
-
142
- // Fire-and-forget to all workers
143
- workers.forEach(w =>
144
- intercom({ action: "send", to: w, message: task })
145
- );
141
+ // Every visible session whose name matches the glob (never yourself, never outside your groups)
142
+ intercom({ action: "send", to: "worker-*", message: "Check for null pointer exceptions in your assigned files" })
143
+ // Every running, released or paused subagent you launched, or those of one run
144
+ intercom({ action: "send", to: "subagents:*", message: "Scope changed: skip the migration" })
145
+ intercom({ action: "send", to: "subagents:<runId>/*", message: "Wrap up and report" })
146
146
  ```
147
147
 
148
+ The result lists each recipient's outcome (delivered, queued, or not delivered with the reason). A glob that matches no session is an error that lists close names. `ask` takes only one exact target.
149
+
148
150
  ### Pattern 5: Send with Attachments
149
151
 
150
152
  Share code snippets, files, or context:
@@ -288,9 +290,10 @@ How a swarm works:
288
290
  | `leave` | Removes one named membership, or resets to home when omitted | Stop sharing one group or restore startup membership |
289
291
  | `groups` | Lists every available group with counts and membership markers | Discover a group instead of guessing its name |
290
292
  | `send` | Fire-and-forget to a live session, or durable sticky delivery to `workflow:<rootRunId>/<segment>[/<segment>...]`; globs and `**` broadcasts cover live and future matches | You don't need a response |
291
- | `ask` | Blocks until a live recipient replies (10 min timeout); refused for an unstarted stage | You need an answer to continue |
293
+ | `ask` | Returns once delivered (or with the reply if it comes within `wait`); the reply otherwise arrives later as a message. Refused for an unstarted stage | You need an answer |
292
294
  | `reply` | Responds to the active or pending inbound ask; `to` accepts an exact name/full session ID or unique 8-hex session UUID prefix | You were asked something and need to answer naturally |
293
- | `pending` | Lists unresolved inbound asks | You need to see who is waiting before replying |
295
+ | `pending` | Lists unresolved inbound asks and your own pending asks | You need to see who is waiting, or what you are still waiting for |
296
+ | `cancel` | Cancels one of your pending asks by `askId`; a later reply is shown once, marked late | You no longer need the answer |
294
297
  | `list` | Returns all sessions sharing any membership, with full IDs and live status | Discover targets or choose an idle peer |
295
298
  | `status` | Returns connection state and every current membership | Troubleshooting |
296
299
 
@@ -395,18 +398,16 @@ If neither `cmux` nor `tmux` is available, skip this path and use normal `interc
395
398
  ### `ask` Limitations
396
399
 
397
400
  - **Terminal noninteractive children**: Completed, failed, interrupted, or cancelled subagents cannot reply, even if listed as `idle`. New asks fail immediately; an admitted ask fails if the child terminates before replying. Launch a fresh child with explicit context. Live interactive idle sessions and reply-capable workflow post-mortem conversations remain askable; `send` semantics are unchanged.
398
- - **10-minute timeout**: If no reply comes within 10 minutes, the ask fails
399
- - **Bounded concurrency**: Up to `maxPendingAsks` asks (default: 6) may wait concurrently; additional calls receive a structured capacity error
401
+ - **Never blocks**: `ask` returns once delivered. `wait` works as in `bash`: omitted waits up to the automatic yield (default 10s), `{ kind: "foreground", budgetMs }` up to a budget, `{ kind: "background" }` not at all. An ask has no expiry; its reply arrives later as a message starting `Reply to your ask <id> from <name>`, and a refusal or an ended recipient as `Your ask <id> to <name> failed`
402
+ - **Bounded waiting**: Up to `maxPendingAsks` calls (default: 6) may wait for a reply at once; further asks are still delivered and their replies arrive as messages
400
403
  - **Exact correlation**: Same-target and mixed-target asks may run together; out-of-order replies and peer disconnects settle only the matching sender/message pair
401
404
  - **Cannot self-target**: A session cannot ask itself
402
405
  - **Supervisor exclusivity**: One blocking `contact_supervisor` decision/interview may coexist with peer asks, but a second supervisor wait is refused with `Already waiting for a supervisor reply`
403
406
 
404
407
  ```typescript
405
- // Parallel fan-out is supported within the configured capacity.
406
- const [design, tests] = await Promise.all([
407
- intercom({ action: "ask", to: "architect", message: "Review the design" }),
408
- intercom({ action: "ask", to: "qa", message: "Review the tests" }),
409
- ]);
408
+ // Fan out without waiting; each reply arrives as its own message.
409
+ intercom({ action: "ask", to: "architect", message: "Review the design", wait: { kind: "background" } });
410
+ intercom({ action: "ask", to: "qa", message: "Review the tests", wait: { kind: "background" } });
410
411
  ```
411
412
 
412
413
  ### `send` Behavior
@@ -417,18 +418,18 @@ const [design, tests] = await Promise.all([
417
418
 
418
419
  ## Best Practices
419
420
 
420
- ### Use `ask` for blocking workflows
421
+ ### Use `ask` when you need an answer
421
422
 
422
423
  When the worker needs information to proceed:
423
424
 
424
425
  ```typescript
425
- // GOOD: Worker blocks until planner responds
426
- const reply = await intercom({
426
+ // GOOD: Ask, keep working on what does not depend on the answer, and act on the
427
+ // "Reply to your ask <id> from planner" message when it arrives.
428
+ intercom({
427
429
  action: "ask",
428
430
  to: "planner",
429
431
  message: "API rate limit is 100/min. Should I implement client-side throttling or batching?"
430
432
  });
431
- // Continue with the answer...
432
433
  ```
433
434
 
434
435
  ### Use `send` for notifications
@@ -474,13 +475,6 @@ Use `/name` so others can target you easily:
474
475
 
475
476
  ### Common Errors and Solutions
476
477
 
477
- **"Too many pending asks"**
478
- ```typescript
479
- // This session reached maxPendingAsks. Wait for an existing ask to settle,
480
- // or use fire-and-forget send when the answer need not be this tool result.
481
- intercom({ action: "send", to: "planner", message: "..." });
482
- ```
483
-
484
478
  **"Already waiting for a supervisor reply"**
485
479
  ```typescript
486
480
  // Supervisor decisions/interviews are exclusive per child. Ordinary peer
@@ -503,11 +497,11 @@ if (!result.delivered) {
503
497
  }
504
498
  ```
505
499
 
506
- **Ask timeout (after 10 minutes)**
500
+ **An ask that stays pending**
507
501
  ```typescript
508
- // The ask will reject with a timeout error
509
- // Design your workflow so answers come within 10 minutes
510
- // For longer tasks, use send + follow-up ask pattern
502
+ // Asks do not expire. Check what you are still waiting for, and cancel what you no longer need.
503
+ intercom({ action: "pending" });
504
+ intercom({ action: "cancel", askId: "4c4d8427" });
511
505
  ```
512
506
 
513
507
  ## Troubleshooting
@@ -598,7 +592,7 @@ intercom({ action: "send", to: "planner", message: "Task-3 complete. All done."
598
592
  ### Long-Running Task with Checkpoints
599
593
 
600
594
  ```typescript
601
- // For tasks that might exceed 10 minutes, use send + periodic asks
595
+ // For long tasks, use send for progress and ask at decision points
602
596
 
603
597
  // 1. Initial send with full context
604
598
  intercom({
@@ -299,7 +299,8 @@ export type ClientMessage =
299
299
  /** The registration is refused, before it takes effect, unless the broker's multi-node routing is still this. */
300
300
  expectedRouting: { acrossMachines: boolean };
301
301
  } & RegisterRequest)
302
- | { type: "unregister" }
302
+ /** `resumable`: the session can be resumed, so its asks stay pending while it is away (#4751). */
303
+ | { type: "unregister"; resumable?: true }
303
304
  /** #3761: the recipient saved this message; it ignores a copy of it sent again. */
304
305
  | { type: "received"; messageId: string }
305
306
  /** #3983: the recipient is still saving this message; its sender keeps waiting. Sent only to a broker that advertised `extendsSaves`. */
@@ -334,7 +335,11 @@ export type ClientMessage =
334
335
  /** #4326: the owner is waking this child; the broker extends the sends held for it once per wake. */
335
336
  | { type: "acknowledge_released_child_wake"; requestId: string; childName: string }
336
337
  /** #4326: the owner answers one `released_child_reply` handoff; an ack that names another handoff is ignored. */
337
- | { type: "released_child_reply_ack"; messageId: string; handoffId: string; accepted: boolean }
338
+ /**
339
+ * #4751: `deliverToChild`: the released child has no call waiting for this reply (its `ask` already returned), so the
340
+ * broker delivers the reply to the child as an ordinary send, held for the child and waking it.
341
+ */
342
+ | { type: "released_child_reply_ack"; messageId: string; handoffId: string; accepted: boolean; deliverToChild?: true }
338
343
  /** #4642: host sessions without a connection each; protocol 3. The broker answers `hosted_sessions_ack`. */
339
344
  | { type: "host_sessions"; requestId: string; sessions: HostedSessionFrameItem[] }
340
345
  /** #4642: remove sessions this connection hosts, in a frame of at most 500. */
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/mcp",
3
- "version": "0.9.85-alpha.1",
3
+ "version": "0.9.86-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,26 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.9.86-alpha.1] - 2026-11-14
6
+
7
+ Subagents are easier to reach and to talk to.
8
+
9
+ - **Message all your subagents at once.** The Intercom `subagents:*` and `subagents:<runId>/*` targets reach every running, released or paused subagent this session launched ([#4752](https://github.com/bastani-inc/atomic/issues/4752), [#4756](https://github.com/bastani-inc/atomic/pull/4756)).
10
+ - **Asks no longer block.** Subagents know an Intercom `ask` returns at delivery and its reply arrives later as a message ([#4751](https://github.com/bastani-inc/atomic/issues/4751), [#4758](https://github.com/bastani-inc/atomic/pull/4758)).
11
+ - **Autocomplete in subagent chats.** A subagent's chat completes `/tasks`, its own `/skill:` commands and `@` and Tab paths, even after it finished ([#4755](https://github.com/bastani-inc/atomic/issues/4755), [#4757](https://github.com/bastani-inc/atomic/pull/4757)).
12
+
13
+ ### Added
14
+
15
+ - Added Intercom `subagents:*` and `subagents:<runId>/*` send targets, which message every running, released or paused subagent this session launched, or those of one run, in one call ([#4752](https://github.com/bastani-inc/atomic/issues/4752))
16
+
17
+ ### Changed
18
+
19
+ - Subagents are told that an Intercom `ask` to a peer or the supervisor no longer blocks: its reply arrives later as a message ([#4751](https://github.com/bastani-inc/atomic/issues/4751))
20
+
21
+ ### Fixed
22
+
23
+ - Fixed a subagent's chat having no autocomplete: it now completes `/tasks`, the subagent's own `/skill:` commands and `@` and Tab paths in the subagent's working directory, including after the subagent finished ([#4755](https://github.com/bastani-inc/atomic/issues/4755))
24
+
5
25
  ## [0.9.81] - 2026-11-13
6
26
 
7
27
  Parallel subagent calls survive a single child's failure, and the desktop skill learns sandboxes.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/subagents",
3
- "version": "0.9.85-alpha.1",
3
+ "version": "0.9.86-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": [
@@ -432,7 +432,7 @@ If a prompt-template extension is installed, additional user prompt templates ca
432
432
  - **Delegation is one level deep and not configurable.** A subagent cannot call `subagent`: every launch and run control (`pause`, `resume`, `quit`) from inside a child is refused. Only `list`, `get`, `status`, and `wait` stay available to a child.
433
433
  - **Attention signals are not lifecycle state.** `needs_attention` means no activity has been observed past the configured threshold. `killed` means the child was cancelled for good by owner or batch cancellation (or, in older sessions, the removed kill action); it cannot be resumed and is not the same as `failed`. `paused` and `quit` children stay resumable.
434
434
  - **Builtin coordination respects caller restrictions.** Every builtin agent declares `intercom`, but a parent that disables it prevents live coordination. Resolve decisions up front when running without coordination tools.
435
- - **Intercom asks are blocking.** A session can only maintain one pending outbound ask wait state at a time.
435
+ - **Intercom asks do not block.** An `ask` returns once delivered; a reply that misses its wait arrives later as a message starting `Reply to your ask <id> from <name>`. `contact_supervisor` decisions and interviews still wait for the reply.
436
436
  - **Keep conversational authority clear.** Advisory specialists should not silently become second decision-makers.
437
437
 
438
438
  ## Best Practices