@bastani/atomic 0.9.16-alpha.4 → 0.9.16-alpha.6

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 (404) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/README.md +11 -6
  3. package/dist/builtin/intercom/CHANGELOG.md +15 -0
  4. package/dist/builtin/intercom/README.md +6 -4
  5. package/dist/builtin/intercom/broker/broker.ts +34 -8
  6. package/dist/builtin/intercom/broker/client.ts +13 -0
  7. package/dist/builtin/intercom/broker/pending-question-index.ts +50 -0
  8. package/dist/builtin/intercom/broker/send-handler.ts +8 -0
  9. package/dist/builtin/intercom/index.bundle.mjs +2045 -1211
  10. package/dist/builtin/intercom/package.json +2 -2
  11. package/dist/builtin/intercom/skills/intercom/SKILL.md +20 -19
  12. package/dist/builtin/mcp/index.bundle.mjs +1778 -1026
  13. package/dist/builtin/mcp/package.json +2 -2
  14. package/dist/builtin/subagents/CHANGELOG.md +11 -0
  15. package/dist/builtin/subagents/README.md +3 -3
  16. package/dist/builtin/subagents/package.json +3 -3
  17. package/dist/builtin/subagents/skills/subagent/SKILL.md +4 -4
  18. package/dist/builtin/subagents/src/extension/index.bundle.mjs +2645 -1506
  19. package/dist/builtin/web-access/index.bundle.mjs +1754 -1002
  20. package/dist/builtin/web-access/package.json +2 -2
  21. package/dist/builtin/workflows/CHANGELOG.md +28 -0
  22. package/dist/builtin/workflows/README.md +3 -1
  23. package/dist/builtin/workflows/builtin/goal-ledger.ts +54 -10
  24. package/dist/builtin/workflows/builtin/goal-runner.ts +57 -12
  25. package/dist/builtin/workflows/package.json +2 -2
  26. package/dist/builtin/workflows/src/extension/index.bundle.mjs +13626 -12023
  27. package/dist/builtin/workflows/src/index.bundle.mjs +2338 -1279
  28. package/dist/bun/split-loader.js +2 -1
  29. package/dist/bun/split-loader.js.map +1 -1
  30. package/dist/cli/args.d.ts.map +1 -1
  31. package/dist/cli/args.js +6 -1
  32. package/dist/cli/args.js.map +1 -1
  33. package/dist/cli/file-processor.d.ts.map +1 -1
  34. package/dist/cli/file-processor.js +2 -1
  35. package/dist/cli/file-processor.js.map +1 -1
  36. package/dist/config-package-identity.d.ts.map +1 -1
  37. package/dist/config-package-identity.js +2 -1
  38. package/dist/config-package-identity.js.map +1 -1
  39. package/dist/config.d.ts.map +1 -1
  40. package/dist/config.js +2 -1
  41. package/dist/config.js.map +1 -1
  42. package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
  43. package/dist/core/agent-session-auto-compaction.js +64 -28
  44. package/dist/core/agent-session-auto-compaction.js.map +1 -1
  45. package/dist/core/agent-session-compaction.d.ts +2 -0
  46. package/dist/core/agent-session-compaction.d.ts.map +1 -1
  47. package/dist/core/agent-session-compaction.js +25 -5
  48. package/dist/core/agent-session-compaction.js.map +1 -1
  49. package/dist/core/agent-session-custom-message-commit.d.ts.map +1 -1
  50. package/dist/core/agent-session-custom-message-commit.js +12 -0
  51. package/dist/core/agent-session-custom-message-commit.js.map +1 -1
  52. package/dist/core/agent-session-events.d.ts.map +1 -1
  53. package/dist/core/agent-session-events.js +2 -0
  54. package/dist/core/agent-session-events.js.map +1 -1
  55. package/dist/core/agent-session-export.d.ts +3 -1
  56. package/dist/core/agent-session-export.d.ts.map +1 -1
  57. package/dist/core/agent-session-export.js +22 -2
  58. package/dist/core/agent-session-export.js.map +1 -1
  59. package/dist/core/agent-session-message-queue.d.ts +3 -0
  60. package/dist/core/agent-session-message-queue.d.ts.map +1 -1
  61. package/dist/core/agent-session-message-queue.js +10 -0
  62. package/dist/core/agent-session-message-queue.js.map +1 -1
  63. package/dist/core/agent-session-methods.d.ts +15 -9
  64. package/dist/core/agent-session-methods.d.ts.map +1 -1
  65. package/dist/core/agent-session-methods.js.map +1 -1
  66. package/dist/core/agent-session-models.d.ts +8 -13
  67. package/dist/core/agent-session-models.d.ts.map +1 -1
  68. package/dist/core/agent-session-models.js +53 -19
  69. package/dist/core/agent-session-models.js.map +1 -1
  70. package/dist/core/agent-session-post-tool-compaction.d.ts.map +1 -1
  71. package/dist/core/agent-session-post-tool-compaction.js +12 -0
  72. package/dist/core/agent-session-post-tool-compaction.js.map +1 -1
  73. package/dist/core/agent-session-prompt.d.ts.map +1 -1
  74. package/dist/core/agent-session-prompt.js +3 -1
  75. package/dist/core/agent-session-prompt.js.map +1 -1
  76. package/dist/core/agent-session-tool-registry.js +3 -3
  77. package/dist/core/agent-session-tool-registry.js.map +1 -1
  78. package/dist/core/agent-session-transfer.d.ts.map +1 -1
  79. package/dist/core/agent-session-transfer.js +1 -0
  80. package/dist/core/agent-session-transfer.js.map +1 -1
  81. package/dist/core/agent-session-tree.d.ts.map +1 -1
  82. package/dist/core/agent-session-tree.js +1 -1
  83. package/dist/core/agent-session-tree.js.map +1 -1
  84. package/dist/core/agent-session-types.d.ts +3 -0
  85. package/dist/core/agent-session-types.d.ts.map +1 -1
  86. package/dist/core/agent-session-types.js.map +1 -1
  87. package/dist/core/agent-session.d.ts +2 -0
  88. package/dist/core/agent-session.d.ts.map +1 -1
  89. package/dist/core/agent-session.js +2 -0
  90. package/dist/core/agent-session.js.map +1 -1
  91. package/dist/core/auth-storage-backends.d.ts.map +1 -1
  92. package/dist/core/auth-storage-backends.js +10 -6
  93. package/dist/core/auth-storage-backends.js.map +1 -1
  94. package/dist/core/auth-storage.d.ts.map +1 -1
  95. package/dist/core/auth-storage.js +4 -3
  96. package/dist/core/auth-storage.js.map +1 -1
  97. package/dist/core/builtin-packages.d.ts.map +1 -1
  98. package/dist/core/builtin-packages.js +2 -1
  99. package/dist/core/builtin-packages.js.map +1 -1
  100. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  101. package/dist/core/compaction/branch-summarization.js +6 -0
  102. package/dist/core/compaction/branch-summarization.js.map +1 -1
  103. package/dist/core/compaction/compaction-runner.d.ts +3 -1
  104. package/dist/core/compaction/compaction-runner.d.ts.map +1 -1
  105. package/dist/core/compaction/compaction-runner.js +30 -4
  106. package/dist/core/compaction/compaction-runner.js.map +1 -1
  107. package/dist/core/compaction/compaction-types.d.ts +3 -1
  108. package/dist/core/compaction/compaction-types.d.ts.map +1 -1
  109. package/dist/core/compaction/compaction-types.js.map +1 -1
  110. package/dist/core/compaction/range-planner.d.ts +3 -1
  111. package/dist/core/compaction/range-planner.d.ts.map +1 -1
  112. package/dist/core/compaction/range-planner.js +11 -1
  113. package/dist/core/compaction/range-planner.js.map +1 -1
  114. package/dist/core/compaction/session-summarization.d.ts.map +1 -1
  115. package/dist/core/compaction/session-summarization.js +6 -0
  116. package/dist/core/compaction/session-summarization.js.map +1 -1
  117. package/dist/core/extensions/api-types.d.ts +8 -3
  118. package/dist/core/extensions/api-types.d.ts.map +1 -1
  119. package/dist/core/extensions/api-types.js.map +1 -1
  120. package/dist/core/extensions/index.d.ts +2 -2
  121. package/dist/core/extensions/index.d.ts.map +1 -1
  122. package/dist/core/extensions/index.js +1 -1
  123. package/dist/core/extensions/index.js.map +1 -1
  124. package/dist/core/extensions/loader-api.d.ts +5 -1
  125. package/dist/core/extensions/loader-api.d.ts.map +1 -1
  126. package/dist/core/extensions/loader-api.js +124 -36
  127. package/dist/core/extensions/loader-api.js.map +1 -1
  128. package/dist/core/extensions/loader-core.d.ts.map +1 -1
  129. package/dist/core/extensions/loader-core.js +18 -4
  130. package/dist/core/extensions/loader-core.js.map +1 -1
  131. package/dist/core/extensions/loader-runtime.d.ts.map +1 -1
  132. package/dist/core/extensions/loader-runtime.js +10 -2
  133. package/dist/core/extensions/loader-runtime.js.map +1 -1
  134. package/dist/core/extensions/session-events.d.ts +11 -2
  135. package/dist/core/extensions/session-events.d.ts.map +1 -1
  136. package/dist/core/extensions/session-events.js.map +1 -1
  137. package/dist/core/extensions/tool-events.d.ts +13 -3
  138. package/dist/core/extensions/tool-events.d.ts.map +1 -1
  139. package/dist/core/extensions/tool-events.js +3 -0
  140. package/dist/core/extensions/tool-events.js.map +1 -1
  141. package/dist/core/extensions/types.d.ts +1 -1
  142. package/dist/core/extensions/types.d.ts.map +1 -1
  143. package/dist/core/extensions/types.js +1 -1
  144. package/dist/core/extensions/types.js.map +1 -1
  145. package/dist/core/extensions/ui-types.d.ts +2 -2
  146. package/dist/core/extensions/ui-types.js.map +1 -1
  147. package/dist/core/footer-data-provider.d.ts +1 -1
  148. package/dist/core/footer-data-provider.js +1 -1
  149. package/dist/core/footer-data-provider.js.map +1 -1
  150. package/dist/core/keybindings.d.ts +17 -16
  151. package/dist/core/keybindings.d.ts.map +1 -1
  152. package/dist/core/keybindings.js +23 -6
  153. package/dist/core/keybindings.js.map +1 -1
  154. package/dist/core/model-config.d.ts.map +1 -1
  155. package/dist/core/model-config.js +2 -1
  156. package/dist/core/model-config.js.map +1 -1
  157. package/dist/core/model-resolver-initial.d.ts +1 -0
  158. package/dist/core/model-resolver-initial.d.ts.map +1 -1
  159. package/dist/core/model-resolver-initial.js +9 -5
  160. package/dist/core/model-resolver-initial.js.map +1 -1
  161. package/dist/core/models-store.d.ts.map +1 -1
  162. package/dist/core/models-store.js +2 -1
  163. package/dist/core/models-store.js.map +1 -1
  164. package/dist/core/package-manager-git.d.ts.map +1 -1
  165. package/dist/core/package-manager-git.js +2 -1
  166. package/dist/core/package-manager-git.js.map +1 -1
  167. package/dist/core/package-manager-manifest.d.ts.map +1 -1
  168. package/dist/core/package-manager-manifest.js +2 -1
  169. package/dist/core/package-manager-manifest.js.map +1 -1
  170. package/dist/core/package-manager-npm.d.ts.map +1 -1
  171. package/dist/core/package-manager-npm.js +4 -3
  172. package/dist/core/package-manager-npm.js.map +1 -1
  173. package/dist/core/package-manager-operations.d.ts.map +1 -1
  174. package/dist/core/package-manager-operations.js +2 -1
  175. package/dist/core/package-manager-operations.js.map +1 -1
  176. package/dist/core/package-manager-resource-collector.d.ts.map +1 -1
  177. package/dist/core/package-manager-resource-collector.js +2 -1
  178. package/dist/core/package-manager-resource-collector.js.map +1 -1
  179. package/dist/core/package-manager-resource-files.d.ts.map +1 -1
  180. package/dist/core/package-manager-resource-files.js +7 -2
  181. package/dist/core/package-manager-resource-files.js.map +1 -1
  182. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  183. package/dist/core/remote-catalog-provider.js +2 -1
  184. package/dist/core/remote-catalog-provider.js.map +1 -1
  185. package/dist/core/resource-loader-context-files.d.ts.map +1 -1
  186. package/dist/core/resource-loader-context-files.js +3 -2
  187. package/dist/core/resource-loader-context-files.js.map +1 -1
  188. package/dist/core/sdk-exports.d.ts +5 -3
  189. package/dist/core/sdk-exports.d.ts.map +1 -1
  190. package/dist/core/sdk-exports.js +4 -2
  191. package/dist/core/sdk-exports.js.map +1 -1
  192. package/dist/core/sdk.d.ts.map +1 -1
  193. package/dist/core/sdk.js +7 -3
  194. package/dist/core/sdk.js.map +1 -1
  195. package/dist/core/session-manager-core.d.ts +2 -2
  196. package/dist/core/session-manager-core.d.ts.map +1 -1
  197. package/dist/core/session-manager-core.js +4 -4
  198. package/dist/core/session-manager-core.js.map +1 -1
  199. package/dist/core/session-manager-entries.d.ts +2 -2
  200. package/dist/core/session-manager-entries.d.ts.map +1 -1
  201. package/dist/core/session-manager-entries.js +4 -3
  202. package/dist/core/session-manager-entries.js.map +1 -1
  203. package/dist/core/session-manager-storage.d.ts.map +1 -1
  204. package/dist/core/session-manager-storage.js +4 -2
  205. package/dist/core/session-manager-storage.js.map +1 -1
  206. package/dist/core/session-manager-types.d.ts +2 -0
  207. package/dist/core/session-manager-types.d.ts.map +1 -1
  208. package/dist/core/session-manager-types.js.map +1 -1
  209. package/dist/core/settings-diagnostics.d.ts +4 -0
  210. package/dist/core/settings-diagnostics.d.ts.map +1 -0
  211. package/dist/core/settings-diagnostics.js +12 -0
  212. package/dist/core/settings-diagnostics.js.map +1 -0
  213. package/dist/core/settings-manager-basic-accessors.d.ts +4 -0
  214. package/dist/core/settings-manager-basic-accessors.d.ts.map +1 -1
  215. package/dist/core/settings-manager-basic-accessors.js +23 -0
  216. package/dist/core/settings-manager-basic-accessors.js.map +1 -1
  217. package/dist/core/settings-manager-core.d.ts.map +1 -1
  218. package/dist/core/settings-manager-core.js +10 -2
  219. package/dist/core/settings-manager-core.js.map +1 -1
  220. package/dist/core/settings-storage.d.ts.map +1 -1
  221. package/dist/core/settings-storage.js +10 -3
  222. package/dist/core/settings-storage.js.map +1 -1
  223. package/dist/core/settings-types.d.ts +2 -0
  224. package/dist/core/settings-types.d.ts.map +1 -1
  225. package/dist/core/settings-types.js.map +1 -1
  226. package/dist/core/skills.d.ts.map +1 -1
  227. package/dist/core/skills.js +51 -33
  228. package/dist/core/skills.js.map +1 -1
  229. package/dist/core/slash-commands.d.ts.map +1 -1
  230. package/dist/core/slash-commands.js +3 -2
  231. package/dist/core/slash-commands.js.map +1 -1
  232. package/dist/core/system-prompt.d.ts.map +1 -1
  233. package/dist/core/system-prompt.js +15 -3
  234. package/dist/core/system-prompt.js.map +1 -1
  235. package/dist/core/tools/ask-user-question/config.d.ts.map +1 -1
  236. package/dist/core/tools/ask-user-question/config.js +2 -1
  237. package/dist/core/tools/ask-user-question/config.js.map +1 -1
  238. package/dist/core/tools/bash.d.ts +13 -1
  239. package/dist/core/tools/bash.d.ts.map +1 -1
  240. package/dist/core/tools/bash.js +9 -5
  241. package/dist/core/tools/bash.js.map +1 -1
  242. package/dist/core/tools/index.d.ts +21 -5
  243. package/dist/core/tools/index.d.ts.map +1 -1
  244. package/dist/core/tools/index.js +45 -13
  245. package/dist/core/tools/index.js.map +1 -1
  246. package/dist/core/tools/powershell.d.ts +83 -0
  247. package/dist/core/tools/powershell.d.ts.map +1 -0
  248. package/dist/core/tools/powershell.js +89 -0
  249. package/dist/core/tools/powershell.js.map +1 -0
  250. package/dist/core/usage-totals.d.ts.map +1 -1
  251. package/dist/core/usage-totals.js +2 -1
  252. package/dist/core/usage-totals.js.map +1 -1
  253. package/dist/extensions/llama/client.d.ts +6 -0
  254. package/dist/extensions/llama/client.d.ts.map +1 -1
  255. package/dist/extensions/llama/client.js +12 -0
  256. package/dist/extensions/llama/client.js.map +1 -1
  257. package/dist/extensions/llama/index.d.ts.map +1 -1
  258. package/dist/extensions/llama/index.js +2 -0
  259. package/dist/extensions/llama/index.js.map +1 -1
  260. package/dist/extensions/llama/provider.d.ts +3 -1
  261. package/dist/extensions/llama/provider.d.ts.map +1 -1
  262. package/dist/extensions/llama/provider.js +25 -8
  263. package/dist/extensions/llama/provider.js.map +1 -1
  264. package/dist/index-extensions.d.ts +2 -2
  265. package/dist/index-extensions.d.ts.map +1 -1
  266. package/dist/index-extensions.js +1 -1
  267. package/dist/index-extensions.js.map +1 -1
  268. package/dist/index.d.ts +4 -3
  269. package/dist/index.d.ts.map +1 -1
  270. package/dist/index.js +4 -3
  271. package/dist/index.js.map +1 -1
  272. package/dist/main-stdio.d.ts.map +1 -1
  273. package/dist/main-stdio.js +4 -2
  274. package/dist/main-stdio.js.map +1 -1
  275. package/dist/main.d.ts.map +1 -1
  276. package/dist/main.js +10 -3
  277. package/dist/main.js.map +1 -1
  278. package/dist/migrations-config-values.d.ts.map +1 -1
  279. package/dist/migrations-config-values.js +2 -1
  280. package/dist/migrations-config-values.js.map +1 -1
  281. package/dist/migrations.d.ts.map +1 -1
  282. package/dist/migrations.js +5 -4
  283. package/dist/migrations.js.map +1 -1
  284. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  285. package/dist/modes/interactive/components/footer.js +2 -1
  286. package/dist/modes/interactive/components/footer.js.map +1 -1
  287. package/dist/modes/interactive/components/model-selector.d.ts +2 -2
  288. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  289. package/dist/modes/interactive/components/model-selector.js +27 -16
  290. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  291. package/dist/modes/interactive/components/settings-selector-items.d.ts.map +1 -1
  292. package/dist/modes/interactive/components/settings-selector-items.js +67 -14
  293. package/dist/modes/interactive/components/settings-selector-items.js.map +1 -1
  294. package/dist/modes/interactive/components/settings-selector-submenus.d.ts +7 -1
  295. package/dist/modes/interactive/components/settings-selector-submenus.d.ts.map +1 -1
  296. package/dist/modes/interactive/components/settings-selector-submenus.js +38 -3
  297. package/dist/modes/interactive/components/settings-selector-submenus.js.map +1 -1
  298. package/dist/modes/interactive/components/settings-selector-types.d.ts +5 -1
  299. package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
  300. package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
  301. package/dist/modes/interactive/components/thinking-selector.d.ts +15 -6
  302. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  303. package/dist/modes/interactive/components/thinking-selector.js +65 -27
  304. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  305. package/dist/modes/interactive/external-editor.d.ts.map +1 -1
  306. package/dist/modes/interactive/external-editor.js +2 -1
  307. package/dist/modes/interactive/external-editor.js.map +1 -1
  308. package/dist/modes/interactive/interactive-agent-events.js +2 -0
  309. package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
  310. package/dist/modes/interactive/interactive-auth-login.d.ts +1 -1
  311. package/dist/modes/interactive/interactive-auth-login.d.ts.map +1 -1
  312. package/dist/modes/interactive/interactive-auth-login.js +9 -1
  313. package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
  314. package/dist/modes/interactive/interactive-autocomplete.js +9 -0
  315. package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
  316. package/dist/modes/interactive/interactive-deferred-startup.d.ts.map +1 -1
  317. package/dist/modes/interactive/interactive-deferred-startup.js +2 -0
  318. package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
  319. package/dist/modes/interactive/interactive-editor-actions.js +11 -10
  320. package/dist/modes/interactive/interactive-editor-actions.js.map +1 -1
  321. package/dist/modes/interactive/interactive-input-handling.js +6 -0
  322. package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
  323. package/dist/modes/interactive/interactive-mode-deps.d.ts +1 -0
  324. package/dist/modes/interactive/interactive-mode-deps.d.ts.map +1 -1
  325. package/dist/modes/interactive/interactive-mode-deps.js +1 -0
  326. package/dist/modes/interactive/interactive-mode-deps.js.map +1 -1
  327. package/dist/modes/interactive/interactive-mode-surface.d.ts +7 -0
  328. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
  329. package/dist/modes/interactive/interactive-mode-surface.js +0 -1
  330. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  331. package/dist/modes/interactive/interactive-mode-types.d.ts +3 -0
  332. package/dist/modes/interactive/interactive-mode-types.d.ts.map +1 -1
  333. package/dist/modes/interactive/interactive-mode-types.js.map +1 -1
  334. package/dist/modes/interactive/interactive-model-routing.d.ts +16 -1
  335. package/dist/modes/interactive/interactive-model-routing.d.ts.map +1 -1
  336. package/dist/modes/interactive/interactive-model-routing.js +62 -3
  337. package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
  338. package/dist/modes/interactive/interactive-render-chat.js +18 -0
  339. package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
  340. package/dist/modes/interactive/interactive-selectors.js +10 -8
  341. package/dist/modes/interactive/interactive-selectors.js.map +1 -1
  342. package/dist/modes/interactive/interactive-slash-commands.js +6 -5
  343. package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
  344. package/dist/modes/interactive/interactive-startup.js +9 -1
  345. package/dist/modes/interactive/interactive-startup.js.map +1 -1
  346. package/dist/modes/interactive/theme/theme-parse.d.ts.map +1 -1
  347. package/dist/modes/interactive/theme/theme-parse.js +2 -1
  348. package/dist/modes/interactive/theme/theme-parse.js.map +1 -1
  349. package/dist/modes/json-event.d.ts +15 -18
  350. package/dist/modes/json-event.d.ts.map +1 -1
  351. package/dist/modes/json-event.js +21 -17
  352. package/dist/modes/json-event.js.map +1 -1
  353. package/dist/modes/rpc/rpc-client-api.d.ts +4 -0
  354. package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -1
  355. package/dist/modes/rpc/rpc-client-api.js +3 -0
  356. package/dist/modes/rpc/rpc-client-api.js.map +1 -1
  357. package/dist/utils/frontmatter.d.ts.map +1 -1
  358. package/dist/utils/frontmatter.js +2 -1
  359. package/dist/utils/frontmatter.js.map +1 -1
  360. package/dist/utils/management-http.d.ts +2 -0
  361. package/dist/utils/management-http.d.ts.map +1 -1
  362. package/dist/utils/management-http.js +11 -7
  363. package/dist/utils/management-http.js.map +1 -1
  364. package/dist/utils/shell.d.ts +3 -0
  365. package/dist/utils/shell.d.ts.map +1 -1
  366. package/dist/utils/shell.js +41 -10
  367. package/dist/utils/shell.js.map +1 -1
  368. package/dist/utils/syntax-highlight.d.ts +1 -0
  369. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  370. package/dist/utils/syntax-highlight.js +61 -1
  371. package/dist/utils/syntax-highlight.js.map +1 -1
  372. package/dist/utils/text.d.ts +8 -0
  373. package/dist/utils/text.d.ts.map +1 -0
  374. package/dist/utils/text.js +9 -0
  375. package/dist/utils/text.js.map +1 -0
  376. package/docs/changelog.mdx +1 -1
  377. package/docs/compaction.md +16 -3
  378. package/docs/containerization.md +17 -0
  379. package/docs/custom-provider.md +1 -1
  380. package/docs/environment-variables.md +3 -3
  381. package/docs/extensions.md +22 -5
  382. package/docs/index.md +12 -10
  383. package/docs/intercom.md +5 -3
  384. package/docs/keybindings.md +1 -1
  385. package/docs/llama-cpp.md +1 -1
  386. package/docs/models.md +2 -0
  387. package/docs/quickstart.md +80 -9
  388. package/docs/rpc.md +24 -1
  389. package/docs/sdk.md +11 -0
  390. package/docs/settings.md +16 -7
  391. package/docs/skills.md +3 -2
  392. package/docs/subagents.md +7 -0
  393. package/docs/termux.md +1 -1
  394. package/docs/usage.md +4 -3
  395. package/docs/windows.md +33 -3
  396. package/docs/workflows.md +22 -10
  397. package/examples/extensions/border-status-editor.ts +1 -1
  398. package/examples/extensions/git-checkpoint.ts +1 -1
  399. package/examples/extensions/notify.ts +1 -1
  400. package/examples/extensions/titlebar-spinner.ts +1 -1
  401. package/examples/rpc-extension-ui.ts +1 -1
  402. package/examples/sdk/README.md +1 -1
  403. package/npm-shrinkwrap.json +73 -65
  404. package/package.json +11 -13
package/CHANGELOG.md CHANGED
@@ -2,6 +2,68 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.9.16-alpha.6] - 2026-08-26
6
+
7
+ ### Changed
8
+
9
+ - The default system prompt now teaches repository-intent inference when a shell tool is available: review recent commits, open and merged PRs, issues and their comments, and project/board status to learn maintainer conventions, and identify the requesting user (`git config user.name`/`user.email`, `gh api user`) to interpret ambiguous requests through their own patterns.
10
+ - The ask_user_question fallback guideline now instructs the agent, when no human input channel exists, to choose the interpretation best supported by the repository and stated objective — mining git history, commits, PRs, issues, and the user's own comments to infer how they would decide — state the assumption, and continue fully autonomously instead of stalling.
11
+
12
+ ## [0.9.16-alpha.5] - 2026-08-26
13
+
14
+ ### Added
15
+
16
+ - Added `/thinking [level]` plus searchable model and per-model thinking selectors. Selectors show saved defaults, search by model/provider/default state, order the current and default models first, and use `Ctrl+S` to persist a startup default while Enter changes only the current session ([#8399](https://github.com/earendil-works/pi/issues/8399)).
17
+ - Added a Windows PowerShell tool that prefers PowerShell 7 and falls back to Windows PowerShell when `pwsh.exe` or `powershell.exe` is on `PATH`. The tool is omitted when neither executable is available and is exposed through the SDK with typed extension events and result guards. Bash remains the shell for `!`/`!!`, plus Windows/WSL-friendly default keybindings ([#8512](https://github.com/earendil-works/pi/issues/8512)).
18
+ - Added path-aware, deduplicated settings diagnostics and routed startup diagnostics into the fullscreen transcript so alternate-screen startup cannot hide configuration errors.
19
+ - Added transcript billing notices for compaction and branch summaries when cache-miss notices are enabled. Verbatim Compaction aggregates usage from every completed planner response, including retries, into the persisted boundary, session statistics, footer totals, and cost breakdowns.
20
+ - Added export-only `atomic.share` context records containing the system prompt and tool schemas. Session sharing keeps private-Gist transport and Atomic viewer URLs; no persisted session is mutated and no Radius upload is introduced.
21
+ - Added RPC `clear_queue` to retrieve and remove queued steering and follow-up messages ([#8432](https://github.com/earendil-works/pi/issues/8432)).
22
+ - Exported `detectSupportedImageMimeTypeFromFile` from the public coding-agent API ([#8600](https://github.com/earendil-works/pi/pull/8600)).
23
+
24
+ ### Changed
25
+
26
+ - Updated the external pi runtime dependencies to 0.84.3, inheriting the matching agent/client/protocol updates and TUI fixes for narrow-width padding and wrapped Markdown-table link colors ([#8252](https://github.com/earendil-works/pi/issues/8252), [#8335](https://github.com/earendil-works/pi/issues/8335)).
27
+ - Model and thinking-level changes are session-scoped by default; saved per-model thinking overrides determine startup behavior, and persistence is now explicit through `Ctrl+S` ([#8356](https://github.com/earendil-works/pi/issues/8356)).
28
+ - Skill discovery silently ignores ordinary root Markdown files without skill frontmatter, continues diagnosing malformed declared skills, and loads nested Markdown skills from packages ([#8012](https://github.com/earendil-works/pi/issues/8012), [#8255](https://github.com/earendil-works/pi/issues/8255)).
29
+ - llama.cpp catalogs now expose sleeping models, refresh local-router catalogs even in offline mode, detect autoload support and offer presets, and explain when `/llama` is required after login ([#8235](https://github.com/earendil-works/pi/issues/8235), [#8236](https://github.com/earendil-works/pi/issues/8236), [#8238](https://github.com/earendil-works/pi/issues/8238), [#8558](https://github.com/earendil-works/pi/issues/8558)).
30
+ - Deferred uncommon syntax grammars until after first render to reduce interactive startup work while keeping common languages available immediately.
31
+ - Extension examples whose intent is final settlement now listen for `agent_settled`; JSON mode exposes tool-call ID and tool name at stream start; session-share links use canonical terminal hyperlinks and perform GitHub authentication preflight before export ([#8242](https://github.com/earendil-works/pi/issues/8242), [#7953](https://github.com/earendil-works/pi/issues/7953)).
32
+ - Compaction now reports truthful aggregate planner usage notices, including multi-attempt Verbatim planning, when cache-miss notices are enabled.
33
+ - Documented `/thinking`, the Ctrl+S startup-default shortcut in the model and thinking pickers, and the `modelThinkingLevels` setting.
34
+
35
+ ### Fixed
36
+
37
+ - Fixed `/thinking` being absent from slash-command autocomplete and added completions for the active model's available thinking levels.
38
+ - Fixed the thinking-level selector so a capability-clamped default still receives the default badge when the saved setting is higher than the active model supports.
39
+ - Failed extension loads now roll back provider registrations applied during that load instead of leaving an earlier provider in the runtime.
40
+ - PowerShell cancellation now terminates the Windows process tree and returns without waiting on descendant-held stdout or stderr.
41
+ - Fixed `/tree` ranking below `/thinking` in slash-command autocomplete, so typing `/t` again offers branch navigation before the thinking-level command.
42
+ - Fixed PowerShell tool calls rendering with the Bash `$` transcript prompt. PowerShell calls now render as `PS> <command>`, and truncated PowerShell output is saved under its own temp-file prefix.
43
+ - Fixed the per-model thinking-level settings row opening an empty, unexplained picker when no models are available; it now states that a provider login or API key is required.
44
+ - Fixed Windows compiled binaries crashing with `ERR_INVALID_FILE_URL_PATH` when Return reached native modifier detection, including from the `/model` selector. Release app bundles keep only `pi-tui`'s native modifier loader runtime-relative, avoiding both the Linux build host's frozen module URL and Bun's inability to resolve a fully external `pi-tui` from a compiled split launcher, while retaining the staged Windows native helper for Shift+Enter handling.
45
+ - Fixed `bundle:dev` and `start:fast` omitting the statically registered OAuth adapters. Development bundles now use the Bun entrypoint shared with compiled builds, so OpenAI Codex and xAI OAuth derivation and refresh no longer fail on unresolved runtime imports.
46
+ - Fixed duplicate fullscreen right-click paste in VS Code-based terminals on Windows ([#8186](https://github.com/earendil-works/pi/issues/8186)).
47
+ - Fixed padded text exceeding narrow terminal widths ([#8252](https://github.com/earendil-works/pi/issues/8252)).
48
+ - Fixed wrapped Markdown table links leaking color into borders and neighboring cells, including tables inside blockquotes ([#8335](https://github.com/earendil-works/pi/issues/8335)).
49
+ - Compaction failures and cancellations now emit `session_compact_failed` to extensions and expose public failure details with their trigger, error, abort/retry state, and whether an extension supplied the compacted text ([#8241](https://github.com/earendil-works/pi/issues/8241)).
50
+ - Automatic compaction now estimates message size when providers report all-zero usage instead of silently skipping the threshold check ([#8328](https://github.com/earendil-works/pi/issues/8328)).
51
+ - Branch and session summaries reject tool calls, and their requests explicitly disable tools; planner requests do the same while retaining validated truncated-range recovery.
52
+ - Branch and session summaries reject token-cap-truncated prose instead of persisting incomplete checkpoints ([#7048](https://github.com/earendil-works/pi/issues/7048)).
53
+ - Branch summaries record the source leaf rather than the navigation destination.
54
+ - Fixed package updates comparing versions for inequality and potentially downgrading a newer installed package; upgrades now use semantic-version ordering ([#8239](https://github.com/earendil-works/pi/issues/8239)).
55
+ - Fixed extension flags accepting runtime defaults whose value did not match the declared boolean/string type, and failed extension factories leaking partially registered commands, tools, flags, and inherited resources into later loads ([#8123](https://github.com/earendil-works/pi/issues/8123), [#8424](https://github.com/earendil-works/pi/issues/8424)).
56
+ - Fixed hung authenticated model-catalog attempts consuming the whole request budget without retrying by applying a per-attempt timeout before retrying.
57
+ - Fixed UTF-8 BOMs breaking auth, model, keybinding, frontmatter, package, resource, theme, CLI, and external-editor text inputs while preserving BOM-aware hashline edits.
58
+ - Fixed atomic managed-state rewrites resetting existing file permissions. `auth.json` and `models-store.json` are created owner-only (`0600`) but keep an administrator-managed mode across later rewrites instead of having it reset by the atomic replacement.
59
+ - Fixed explicitly persisted default models disappearing from non-empty model scopes; persisted defaults are now added to both the active and saved scope.
60
+ - Fixed extension messages sent with `triggerTurn: false` while the agent is running being inserted between a tool call and its result; they are now appended after the turn's tool results ([#8537](https://github.com/earendil-works/pi/issues/8537)).
61
+ - Fixed compaction range planning and branch/session summaries forcing `toolChoice: "none"`, which sent `tool_choice` with no tools and could be rejected by gateways ([#8649](https://github.com/earendil-works/pi/issues/8649), [#8638](https://github.com/earendil-works/pi/issues/8638)).
62
+ - Fixed Windows shell aborts crashing Atomic when `taskkill.exe` is not on `PATH`. Both `killProcessTree` and the detached-child guardian worker now spawn the System32 executable and consume the asynchronous spawn error ([#6596](https://github.com/earendil-works/pi/issues/6596)).
63
+ - Fixed Windows `taskkill` spawning without `windowsHide`. Because the spawn is `detached`, Windows allocated and briefly flashed a console window on every process-tree kill.
64
+ - Fixed session files whose final record has no trailing newline not being repaired on load, so a later append no longer concatenates onto that record.
65
+ - Fixed toggling thinking-block visibility discarding partial Bash output. Rendered assistant messages are updated in place instead of rebuilding the chat and its live tool components ([#8611](https://github.com/earendil-works/pi/issues/8611)).
66
+
5
67
  ## [0.9.16-alpha.4] - 2026-08-23
6
68
 
7
69
  ### Fixed
package/README.md CHANGED
@@ -77,7 +77,7 @@ atomic
77
77
  /login # Then select provider
78
78
  ```
79
79
 
80
- Then just talk to Atomic. By default, Atomic gives the model six coding tools: `read`, `write`, `edit`, `bash`, `find`, and `search`. The model uses these to fulfill your requests. `read`, `search`, `write`, and successful `edit` calls emit session-scoped hashline anchors (`[path#TAG]` plus `LINE:text`) so the model can make stale-safe line edits; see [docs/tools.md](docs/tools.md). Add capabilities via [skills](#skills), [prompt templates](#prompt-templates), [extensions](#extensions), or [Atomic packages](#atomic-packages).
80
+ Then just talk to Atomic. By default, Atomic gives the model six coding tools: `read`, `write`, `edit`, `bash`, `find`, and `search`. On native Windows, Atomic also enables `powershell` when `pwsh.exe` or `powershell.exe` is available. The model uses these to fulfill your requests. `read`, `search`, `write`, and successful `edit` calls emit session-scoped hashline anchors (`[path#TAG]` plus `LINE:text`) so the model can make stale-safe line edits; see [docs/tools.md](docs/tools.md). Add capabilities via [skills](#skills), [prompt templates](#prompt-templates), [extensions](#extensions), or [Atomic packages](#atomic-packages).
81
81
 
82
82
  **Platform notes:** [Windows](docs/windows.md) | [Alpine/musl Linux](docs/index.md#alpine-and-musl-linux-archives) | [Termux (Android)](docs/termux.md) | [tmux](docs/tmux.md) | [Terminal setup](docs/terminal-setup.md) | [Shell aliases](docs/shell-aliases.md)
83
83
 
@@ -176,9 +176,10 @@ Type `/` in the editor to trigger commands. [Extensions](#extensions) can regist
176
176
  | Command | Description |
177
177
  |---------|-------------|
178
178
  | `/login`, `/logout` | OAuth authentication |
179
- | `/model` | Switch models |
179
+ | `/model` | Switch models; Ctrl+S in the picker saves the startup default |
180
+ | `/thinking` | Switch thinking level; Ctrl+S in the picker saves the startup default |
180
181
  | `/scoped-models` | Enable/disable models for CTRL+P cycling |
181
- | `/settings` | Thinking level, theme, message delivery, transport |
182
+ | `/settings` | Theme, message delivery, transport, and other preferences |
182
183
  | `/resume` | Pick from previous sessions |
183
184
  | `/new` | Start a new session |
184
185
  | `/name <name>` | Set session display name |
@@ -492,7 +493,7 @@ Upstream Pi's minimal-core rationale is documented in the [original blog post](h
492
493
  ## CLI Reference
493
494
 
494
495
  ```bash
495
- atomic [options] [@files...] [messages...]
496
+ atomic [options] [--] [@files...] [messages...]
496
497
  ```
497
498
 
498
499
  ### Package Commands
@@ -561,7 +562,7 @@ cat README.md | atomic -p "Summarize this text"
561
562
  | `--no-builtin-tools`, `-nbt` | Disable built-in tools by default but keep extension/custom tools enabled |
562
563
  | `--no-tools`, `-nt` | Disable all tools by default |
563
564
 
564
- Default built-in tools: `read`, `bash`, `edit`, `write`, `find`, `search`, `ask_user_question`, `todo`. `find.paths` accepts directories, files, or glob paths such as `*.ts` and honors `timeout`; `search` accepts `pattern`, `paths`, `i`, `gitignore`, and `skip` for regex content-search pagination. `read`/`search`/`write`/`edit` share session-scoped hashline snapshot tags for stale-safe line edits; copied hashline output is stripped by `write` only when it matches a known current-session snapshot. Archive selectors are Bun-native, and internal-resource selectors use the session router when available. Use `--exclude-tools` to disable one or more tools while leaving the rest available.
565
+ Default built-in tools: `read`, `bash`, `edit`, `write`, `find`, `search`, `ask_user_question`, `todo`, plus `powershell` on native Windows when a PowerShell executable is available. `find.paths` accepts directories, files, or glob paths such as `*.ts` and honors `timeout`; `search` accepts `pattern`, `paths`, `i`, `gitignore`, and `skip` for regex content-search pagination. `read`/`search`/`write`/`edit` share session-scoped hashline snapshot tags for stale-safe line edits; copied hashline output is stripped by `write` only when it matches a known current-session snapshot. Archive selectors are Bun-native, and internal-resource selectors use the session router when available. Use `--exclude-tools` to disable one or more tools while leaving the rest available.
565
566
 
566
567
  ### Project Trust Options
567
568
 
@@ -596,6 +597,7 @@ Combine `--no-*` with explicit flags to load exactly what you need, ignoring set
596
597
  | `--append-system-prompt <text>` | Append to system prompt |
597
598
  | `--offline` | Disable startup network operations, including update checks, package updates, and telemetry |
598
599
  | `--verbose` | Force verbose startup |
600
+ | `--` | Stop option parsing; remaining arguments are prompts or `@file` inputs |
599
601
  | `-h`, `--help` | Show help |
600
602
  | `-v`, `--version` | Show version |
601
603
 
@@ -618,6 +620,9 @@ atomic "List all .ts files in src/"
618
620
  # Non-interactive
619
621
  atomic -p "Summarize this codebase"
620
622
 
623
+ # Prompt beginning with a dash
624
+ atomic -p -- "- Summarize these points"
625
+
621
626
  # Non-interactive with piped stdin
622
627
  cat README.md | atomic -p "Summarize this text"
623
628
 
@@ -657,7 +662,7 @@ atomic --thinking high "Solve this complex problem"
657
662
  | `PI_CACHE_RETENTION` | Provider/upstream-specific prompt-cache retention knob; set to `long` where supported. This is not an `ATOMIC_*` alias and has no Atomic-prefixed equivalent. |
658
663
  | `VISUAL`, `EDITOR` | External editor for CTRL+G |
659
664
 
660
- Bash commands also receive an execution-time session snapshot through `ATOMIC_SESSION_ID`, `ATOMIC_SESSION_FILE` (omitted for unsaved sessions), `ATOMIC_PROVIDER`, `ATOMIC_MODEL`, and `ATOMIC_REASONING_LEVEL`. The exact `PI_SESSION_ID`, `PI_SESSION_FILE`, `PI_PROVIDER`, `PI_MODEL`, and `PI_REASONING_LEVEL` aliases carry identical values. Unrelated inherited or caller-supplied environment variables are preserved.
665
+ Bash and PowerShell commands also receive an execution-time session snapshot through `ATOMIC_SESSION_ID`, `ATOMIC_SESSION_FILE` (omitted for unsaved sessions), `ATOMIC_PROVIDER`, `ATOMIC_MODEL`, and `ATOMIC_REASONING_LEVEL`. The exact `PI_SESSION_ID`, `PI_SESSION_FILE`, `PI_PROVIDER`, `PI_MODEL`, and `PI_REASONING_LEVEL` aliases carry identical values. Unrelated inherited or caller-supplied environment variables are preserved.
661
666
 
662
667
  ---
663
668
 
@@ -4,6 +4,21 @@ All notable changes to the `pi-intercom` extension will be documented in this fi
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.9.16-alpha.5] - 2026-08-26
8
+
9
+ ### Added
10
+
11
+ - Concurrent blocking asks now use a correlation-keyed waiter registry, with configurable `maxPendingAsks` capacity, exact out-of-order reply and selective-disconnect settlement, and a structured refusal when full. Blocking supervisor decisions remain exclusive per child while coexisting with ordinary peer asks ([#2628](https://github.com/bastani-inc/atomic/issues/2628)).
12
+
13
+ ### Changed
14
+
15
+ - Session teardown rejects every pending reply waiter while preserving per-waiter reply, timeout, abort, cancel, and peer-disconnect settlement.
16
+
17
+ ### Fixed
18
+
19
+ - Blocking `ask` and `contact_supervisor` waits now fail promptly with the departed session's name when their target disconnects after delivery, instead of hanging until the 10-minute timeout ([#2627](https://github.com/bastani-inc/atomic/issues/2627)).
20
+ - Replying to an exact pending ask now removes its queued turn context, preventing the same ask from resurfacing and being answered twice ([#2628](https://github.com/bastani-inc/atomic/issues/2628)).
21
+
7
22
  ## [0.9.16-alpha.1] - 2026-08-23
8
23
 
9
24
  ### Breaking Changes
@@ -230,7 +230,7 @@ This matters because the agent receiving the message doesn't need to reconstruct
230
230
 
231
231
  `send` is fire-and-forget — the tool returns immediately after delivery. By default, it sends immediately even in interactive sessions. If you want an approval dialog before non-reply sends, set `confirmSend: true` in config. Replies that include `replyTo` still skip confirmation so reply-hint flows can continue without an extra approval step.
232
232
 
233
- `ask` sends the message and blocks until the recipient responds (10-minute timeout). The reply comes back as the tool result, so the agent continues in the same turn with full context. No confirmation dialog — if you're asking and waiting, the intent is clear. A completed workflow-stage target with a retained conversation is automatically reopened for one post-mortem turn; unavailable or non-resumable completed targets fail actionably without consuming the full reply timeout.
233
+ `ask` sends the message and blocks until the recipient responds (10-minute timeout). If the recipient disconnects after delivery, the ask fails promptly with an error naming that session; the timeout remains the backstop for a connected but unresponsive recipient. The reply comes back as the tool result, so the agent continues in the same turn with full context. No confirmation dialog — if you're asking and waiting, the intent is clear. A completed workflow-stage target with a retained conversation is automatically reopened for one post-mortem turn; unavailable or non-resumable completed targets fail actionably without consuming the full reply timeout.
234
234
 
235
235
  `reply` is receiver-side sugar for replying to an inbound ask. In the turn triggered by an incoming intercom ask, `intercom({ action: "reply", message: "..." })` targets that exact sender and message automatically. If you reply later, it falls back to the single unresolved inbound ask. If multiple asks are pending, use `intercom({ action: "pending" })` to inspect them and then call `reply` with `to` to disambiguate.
236
236
 
@@ -350,7 +350,7 @@ Only registered in sessions where `pi-subagents` supplied the required child bri
350
350
  | `message` | string | The decision request, optional interview note, or progress update |
351
351
  | `interview` | object | Required for `interview_request`: `{ title?, description?, questions: [...] }` |
352
352
 
353
- **`need_decision`** — Sends a formatted ask to the supervisor and blocks until it replies (10-minute timeout). The reply comes back as the tool result. Includes run metadata in the message so the supervisor knows which subagent is asking.
353
+ **`need_decision`** — Sends a formatted ask to the supervisor and blocks until it replies (10-minute timeout). If the supervisor disconnects after delivery, the wait fails promptly instead. The reply comes back as the tool result. Includes run metadata in the message so the supervisor knows which subagent is asking.
354
354
 
355
355
  **`interview_request`** — Sends a formatted, agent-readable interview to the supervisor and blocks until it replies. Questions use a local pi-interview-like shape: `{ id, type, question, options?, context? }` where `type` is `single`, `multi`, `text`, `image`, or `info`. `info` questions are context-only and do not need responses. The supervisor reply should be JSON with `{ "responses": [{ "id": "...", "value": ... }] }`. Parsed JSON replies are returned in `details.structuredReply`.
356
356
 
@@ -368,12 +368,14 @@ Target lookup accepts only an exact full session ID or an exact case-insensitive
368
368
 
369
369
  **`send`** — Sends a message to the specified session. By default it sends immediately, including in interactive sessions. Set `confirmSend: true` in config if you want a confirmation dialog for non-reply sends. Replies that include `replyTo` skip confirmation. Returns delivery confirmation.
370
370
 
371
- **`ask`** — Sends a message and waits for the recipient to reply (10-minute timeout). The reply is returned as the tool result. No confirmation dialog. Only one pending `ask` is allowed per session at a time; if several blocking requests race (parallel `ask` calls, or `ask` alongside `contact_supervisor`), one wins the reservation and each other call returns a normal "Already waiting for a reply" tool error without disturbing the pending ask. Use this when the agent needs the answer to continue working.
371
+ **`ask`** — Sends a message and waits for the recipient to reply (10-minute timeout). A recipient disconnect after delivery fails only that peer's exact wait promptly; the timeout remains the backstop while the recipient stays connected. Up to `maxPendingAsks` blocking asks (default: 6) may run concurrently, including same-target and mixed-target fan-out. Replies resolve by exact sender and message ID, so out-of-order replies cannot cross-settle another call. When capacity is full, new asks receive a structured refusal. Use this when the agent needs the answer to continue working.
372
372
 
373
- **`reply`** — Replies to the current intercom-triggered message if there is one. Otherwise it falls back to the single unresolved inbound ask. If multiple asks are pending, pass an exact name or exact full session ID in `to`, or inspect them with `pending` first. Under the hood this is still a normal `send` with the exact `replyTo` value.
373
+ **`reply`** — Replies to the current intercom-triggered message if there is one. Otherwise it falls back to the single unresolved inbound ask. If multiple asks are pending, pass an exact name/full session ID in `to`, or the listed message ID in `replyTo`; use `pending` to inspect them first. `replyTo` also disambiguates multiple asks from the same sender. Under the hood this is still a normal `send` with the exact `replyTo` value.
374
374
 
375
375
  **`pending`** — Lists unresolved inbound asks with sender, message ID, elapsed time, and a short preview. Useful when replying after the original triggered turn.
376
376
 
377
+ `contact_supervisor` decisions and interviews are deliberately exclusive per child: one supervisor wait may coexist with ordinary peer asks, but a second concurrent supervisor wait receives `Already waiting for a supervisor reply`. Claimed foreground parent handoffs remain first-claim-wins and do not allocate a waiter. Multiple children can contact the same parent independently because inbound asks and handoffs are keyed by child/message identity. Mutual peer asks are supported, but each side must process inbound work to reply; the per-waiter timeout remains the deadlock backstop.
378
+
377
379
  **`status`** — Shows connection status, session ID, current group, and the total count of active sessions in that group. A `group` filter remains a read-only peek.
378
380
 
379
381
  ## Keyboard Shortcuts
@@ -12,6 +12,7 @@ import { handleBrokerSend, type BrokerConnectedSession } from "./send-handler.js
12
12
  import { SupervisorChannelCache } from "./supervisor-channel.js";
13
13
  import { normalizeGroup } from "../group.js";
14
14
  import { handleBrokerPresence } from "./presence-handler.js";
15
+ import { PendingQuestionIndex } from "./pending-question-index.js";
15
16
 
16
17
  const INTERCOM_DIR = getIntercomDirPath();
17
18
  const SOCKET_PATH = getBrokerSocketPath();
@@ -60,6 +61,7 @@ class IntercomBroker {
60
61
  private shutdownTimer: NodeJS.Timeout | null = null;
61
62
  private deliveredMessages = new DeliveredMessageCache();
62
63
  private supervisorChannel = new SupervisorChannelCache();
64
+ private pendingQuestions = new PendingQuestionIndex();
63
65
 
64
66
  constructor() {
65
67
  mkdirSync(INTERCOM_DIR, { recursive: true });
@@ -97,10 +99,7 @@ class IntercomBroker {
97
99
 
98
100
  socket.on("close", () => {
99
101
  if (sessionId) {
100
- const leavingGroup = this.sessions.get(sessionId)?.info.group;
101
- this.sessions.delete(sessionId);
102
- this.broadcastToGroup({ type: "session_left", sessionId }, leavingGroup, sessionId);
103
-
102
+ this.disconnectSession(sessionId);
104
103
  this.scheduleShutdownCheck();
105
104
  }
106
105
  });
@@ -195,9 +194,7 @@ class IntercomBroker {
195
194
  }
196
195
 
197
196
  case "unregister": {
198
- const leavingGroup = this.sessions.get(currentId)?.info.group;
199
- this.sessions.delete(currentId);
200
- this.broadcastToGroup({ type: "session_left", sessionId: currentId }, leavingGroup, currentId);
197
+ this.disconnectSession(currentId);
201
198
  setId(null);
202
199
  this.scheduleShutdownCheck();
203
200
  break;
@@ -248,7 +245,16 @@ class IntercomBroker {
248
245
 
249
246
  case "send":
250
247
  case "supervisor_send": {
251
- handleBrokerSend(socket, clientMessage, currentId, this.sessions, this.deliveredMessages, writeMessage, this.supervisorChannel);
248
+ handleBrokerSend(
249
+ socket,
250
+ clientMessage,
251
+ currentId,
252
+ this.sessions,
253
+ this.deliveredMessages,
254
+ writeMessage,
255
+ this.supervisorChannel,
256
+ this.pendingQuestions,
257
+ );
252
258
  break;
253
259
  }
254
260
 
@@ -268,6 +274,26 @@ class IntercomBroker {
268
274
  }
269
275
  }
270
276
 
277
+ private disconnectSession(sessionId: string): void {
278
+ const departed = this.sessions.get(sessionId);
279
+ if (!departed) return;
280
+
281
+ this.pendingQuestions.pruneSender(sessionId);
282
+ for (const question of this.pendingQuestions.takeForTarget(sessionId)) {
283
+ const asker = this.sessions.get(question.senderSessionId);
284
+ if (!asker) continue;
285
+ writeMessage(asker.socket, {
286
+ type: "peer_disconnected",
287
+ replyTo: question.messageId,
288
+ peerSessionId: departed.info.id,
289
+ ...(departed.info.name !== undefined ? { peerName: departed.info.name } : {}),
290
+ });
291
+ }
292
+
293
+ this.sessions.delete(sessionId);
294
+ this.broadcastToGroup({ type: "session_left", sessionId }, departed.info.group, sessionId);
295
+ }
296
+
271
297
  /** Deliver a broadcast only to sessions in the given (normalized) group. */
272
298
  private broadcastToGroup(msg: BrokerMessage, group: string | undefined, exclude?: string): void {
273
299
  const target = normalizeGroup(group);
@@ -365,6 +365,19 @@ export class IntercomClient extends EventEmitter {
365
365
  pending.reject(new Error(brokerMessage.reason));
366
366
  break;
367
367
  }
368
+ case "peer_disconnected": {
369
+ const { replyTo, peerSessionId, peerName } = brokerMessage;
370
+ if (typeof replyTo !== "string" || typeof peerSessionId !== "string"
371
+ || (peerName !== undefined && typeof peerName !== "string")) {
372
+ throw new Error("Invalid peer_disconnected message");
373
+ }
374
+ this.emit("peer_disconnected", {
375
+ replyTo,
376
+ peerSessionId,
377
+ ...(peerName !== undefined ? { peerName } : {}),
378
+ });
379
+ break;
380
+ }
368
381
  case "error": {
369
382
  if (typeof brokerMessage.error !== "string") {
370
383
  throw new Error("Invalid error message");
@@ -0,0 +1,50 @@
1
+ export interface PendingQuestion {
2
+ senderSessionId: string;
3
+ targetSessionId: string;
4
+ messageId: string;
5
+ }
6
+
7
+ /** Tracks delivered questions until their reply or either peer's departure. */
8
+ export class PendingQuestionIndex {
9
+ private readonly questions = new Map<string, PendingQuestion[]>();
10
+
11
+ record(senderSessionId: string, targetSessionId: string, messageId: string): void {
12
+ const routes = this.questions.get(messageId) ?? [];
13
+ if (routes.some((route) => route.senderSessionId === senderSessionId && route.targetSessionId === targetSessionId)) return;
14
+ routes.push({ senderSessionId, targetSessionId, messageId });
15
+ this.questions.set(messageId, routes);
16
+ }
17
+
18
+ clearReply(senderSessionId: string, targetSessionId: string, replyTo: string): boolean {
19
+ const routes = this.questions.get(replyTo);
20
+ const index = routes?.findIndex(
21
+ (route) => route.targetSessionId === senderSessionId && route.senderSessionId === targetSessionId,
22
+ ) ?? -1;
23
+ if (!routes || index < 0) return false;
24
+ routes.splice(index, 1);
25
+ if (routes.length === 0) this.questions.delete(replyTo);
26
+ return true;
27
+ }
28
+
29
+ pruneSender(senderSessionId: string): void {
30
+ for (const [messageId, routes] of this.questions) {
31
+ const remaining = routes.filter((route) => route.senderSessionId !== senderSessionId);
32
+ if (remaining.length === 0) this.questions.delete(messageId);
33
+ else if (remaining.length !== routes.length) this.questions.set(messageId, remaining);
34
+ }
35
+ }
36
+
37
+ takeForTarget(targetSessionId: string): PendingQuestion[] {
38
+ const pending: PendingQuestion[] = [];
39
+ for (const [messageId, routes] of this.questions) {
40
+ const remaining = routes.filter((route) => {
41
+ if (route.targetSessionId !== targetSessionId) return true;
42
+ pending.push(route);
43
+ return false;
44
+ });
45
+ if (remaining.length === 0) this.questions.delete(messageId);
46
+ else if (remaining.length !== routes.length) this.questions.set(messageId, remaining);
47
+ }
48
+ return pending;
49
+ }
50
+ }
@@ -6,6 +6,7 @@ import { buildMessageSendSignature } from "./send-signature.js";
6
6
  import { SupervisorChannelCache } from "./supervisor-channel.js";
7
7
  import { isVerticalBypass, sameGroup } from "./group-isolation.js";
8
8
  import { normalizeGroup } from "../group.js";
9
+ import { PendingQuestionIndex } from "./pending-question-index.js";
9
10
 
10
11
  export interface BrokerConnectedSession {
11
12
  socket: net.Socket;
@@ -49,6 +50,7 @@ export function handleBrokerSend(
49
50
  deliveredMessages: DeliveredMessageCache,
50
51
  write: (target: net.Socket, message: BrokerMessage) => void,
51
52
  supervisorCache: SupervisorChannelCache = new SupervisorChannelCache(),
53
+ pendingQuestions: PendingQuestionIndex = new PendingQuestionIndex(),
52
54
  ): void {
53
55
  const message = clientMessage.message;
54
56
  const messageId = isMessage(message) ? message.id : "unknown";
@@ -147,6 +149,12 @@ export function handleBrokerSend(
147
149
  ? { type: "message", from: fromSession.info, message, channel: "supervisor" }
148
150
  : { type: "message", from: fromSession.info, message });
149
151
  deliveredMessages.record(message.id, signature);
152
+ if (message.expectsReply === true) {
153
+ pendingQuestions.record(fromSession.info.id, target.info.id, message.id);
154
+ }
155
+ if (message.replyTo !== undefined) {
156
+ pendingQuestions.clearReply(fromSession.info.id, target.info.id, message.replyTo);
157
+ }
150
158
  if (supervisorSend) supervisorCache.record(message.id, fromSession.info.id, target.info.id);
151
159
  write(socket, { type: "delivered", messageId: message.id, attemptId });
152
160
  return;