@bastani/atomic 0.9.20-alpha.4 → 0.9.20-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 (474) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +37 -0
  3. package/dist/builtin/intercom/CHANGELOG.md +16 -0
  4. package/dist/builtin/intercom/broker/broker.ts +110 -39
  5. package/dist/builtin/intercom/broker/client.ts +8 -1
  6. package/dist/builtin/intercom/index.bundle.mjs +61 -2
  7. package/dist/builtin/intercom/live-route-refusal.ts +69 -0
  8. package/dist/builtin/intercom/package.json +2 -2
  9. package/dist/builtin/intercom/recoverable-disconnect.ts +16 -4
  10. package/dist/builtin/intercom/skills/intercom/SKILL.md +43 -12
  11. package/dist/builtin/intercom/types.ts +3 -1
  12. package/dist/builtin/mcp/package.json +2 -2
  13. package/dist/builtin/subagents/CHANGELOG.md +18 -0
  14. package/dist/builtin/subagents/README.md +2 -0
  15. package/dist/builtin/subagents/agents/code-simplifier.md +1 -1
  16. package/dist/builtin/subagents/agents/codebase-analyzer.md +1 -1
  17. package/dist/builtin/subagents/agents/codebase-online-researcher.md +3 -3
  18. package/dist/builtin/subagents/agents/debugger.md +7 -5
  19. package/dist/builtin/subagents/agents/worker.md +4 -2
  20. package/dist/builtin/subagents/package.json +3 -3
  21. package/dist/builtin/subagents/skills/agent-browser/SKILL.md +56 -0
  22. package/dist/builtin/subagents/skills/cua-driver/BROWSER.md +494 -0
  23. package/dist/builtin/subagents/skills/cua-driver/EMBEDDING.md +578 -0
  24. package/dist/builtin/subagents/skills/cua-driver/LINUX.md +364 -0
  25. package/dist/builtin/subagents/skills/cua-driver/MACOS.md +509 -0
  26. package/dist/builtin/subagents/skills/cua-driver/README.md +113 -0
  27. package/dist/builtin/subagents/skills/cua-driver/RECORDING.md +162 -0
  28. package/dist/builtin/subagents/skills/cua-driver/SKILL.md +1105 -0
  29. package/dist/builtin/subagents/skills/cua-driver/WINDOWS.md +866 -0
  30. package/dist/builtin/subagents/skills/subagent/SKILL.md +32 -8
  31. package/dist/builtin/subagents/src/extension/index.bundle.mjs +7 -4
  32. package/dist/builtin/web-access/package.json +2 -2
  33. package/dist/builtin/workflows/CHANGELOG.md +43 -0
  34. package/dist/builtin/workflows/README.md +4 -2
  35. package/dist/builtin/workflows/builtin/adversarial-verification.js +3 -3
  36. package/dist/builtin/workflows/builtin/{chunk-1dydq7w3.js → chunk-2hzrv5y8.js} +202 -45
  37. package/dist/builtin/workflows/builtin/{chunk-n4yxrsm9.js → chunk-3tx8ry44.js} +3 -2
  38. package/dist/builtin/workflows/builtin/{chunk-n8g2da69.js → chunk-5724b0cf.js} +1 -1
  39. package/dist/builtin/workflows/builtin/{chunk-scgprmdj.js → chunk-7n51c5gh.js} +1 -1
  40. package/dist/builtin/workflows/builtin/{chunk-9y0f90rd.js → chunk-9z3ztr2a.js} +1 -1
  41. package/dist/builtin/workflows/builtin/{chunk-vt9zgr9d.js → chunk-deq63d9p.js} +4 -4
  42. package/dist/builtin/workflows/builtin/{chunk-k18g9me8.js → chunk-dxjxtgmp.js} +1 -1
  43. package/dist/builtin/workflows/builtin/{chunk-kf5xpbkz.js → chunk-ffdrv23t.js} +1 -1
  44. package/dist/builtin/workflows/builtin/{chunk-119kxb28.js → chunk-hmt5w62g.js} +72 -45
  45. package/dist/builtin/workflows/builtin/{chunk-hnbbb5r0.js → chunk-jngsbbpm.js} +4 -4
  46. package/dist/builtin/workflows/builtin/{chunk-d1xqh1rd.js → chunk-njmf5ze7.js} +1 -1
  47. package/dist/builtin/workflows/builtin/{chunk-sn5mchnx.js → chunk-vn0wb31x.js} +1 -1
  48. package/dist/builtin/workflows/builtin/classify-and-act.js +3 -3
  49. package/dist/builtin/workflows/builtin/fan-out-and-synthesize.js +3 -3
  50. package/dist/builtin/workflows/builtin/generate-and-filter.js +3 -3
  51. package/dist/builtin/workflows/builtin/goal.js +4 -4
  52. package/dist/builtin/workflows/builtin/index.d.ts +1 -1
  53. package/dist/builtin/workflows/builtin/index.js +12 -12
  54. package/dist/builtin/workflows/builtin/loop-until-done.js +3 -3
  55. package/dist/builtin/workflows/builtin/open-claude-design.d.ts +1 -1
  56. package/dist/builtin/workflows/builtin/open-claude-design.js +3 -3
  57. package/dist/builtin/workflows/builtin/ralph.js +4 -4
  58. package/dist/builtin/workflows/builtin/steering-context.js +1 -1
  59. package/dist/builtin/workflows/builtin/tournament.js +3 -3
  60. package/dist/builtin/workflows/package.json +2 -2
  61. package/dist/builtin/workflows/skills/impeccable/SKILL.md +18 -11
  62. package/dist/builtin/workflows/skills/impeccable/reference/adapt.md +1 -1
  63. package/dist/builtin/workflows/skills/impeccable/reference/adapt.native.md +1 -1
  64. package/dist/builtin/workflows/skills/impeccable/reference/animate.md +1 -1
  65. package/dist/builtin/workflows/skills/impeccable/reference/audit.md +5 -5
  66. package/dist/builtin/workflows/skills/impeccable/reference/audit.native.md +6 -6
  67. package/dist/builtin/workflows/skills/impeccable/reference/bolder.md +2 -2
  68. package/dist/builtin/workflows/skills/impeccable/reference/clarify.md +1 -1
  69. package/dist/builtin/workflows/skills/impeccable/reference/colorize.md +1 -1
  70. package/dist/builtin/workflows/skills/impeccable/reference/craft-floor.md +0 -6
  71. package/dist/builtin/workflows/skills/impeccable/reference/critique.md +19 -41
  72. package/dist/builtin/workflows/skills/impeccable/reference/degraded/asset-producer.md +11 -65
  73. package/dist/builtin/workflows/skills/impeccable/reference/degraded/documenter.md +3 -3
  74. package/dist/builtin/workflows/skills/impeccable/reference/degraded/finish-reviewer.md +4 -4
  75. package/dist/builtin/workflows/skills/impeccable/reference/degraded/manual-edit-applier.md +1 -1
  76. package/dist/builtin/workflows/skills/impeccable/reference/delight.md +1 -1
  77. package/dist/builtin/workflows/skills/impeccable/reference/distill.md +2 -2
  78. package/dist/builtin/workflows/skills/impeccable/reference/doctor.md +4 -4
  79. package/dist/builtin/workflows/skills/impeccable/reference/document.md +4 -4
  80. package/dist/builtin/workflows/skills/impeccable/reference/extract.md +1 -1
  81. package/dist/builtin/workflows/skills/impeccable/reference/harden.md +1 -1
  82. package/dist/builtin/workflows/skills/impeccable/reference/hooks.md +21 -21
  83. package/dist/builtin/workflows/skills/impeccable/reference/init.md +8 -8
  84. package/dist/builtin/workflows/skills/impeccable/reference/layout.md +2 -2
  85. package/dist/builtin/workflows/skills/impeccable/reference/live-setup.md +10 -8
  86. package/dist/builtin/workflows/skills/impeccable/reference/live.md +39 -38
  87. package/dist/builtin/workflows/skills/impeccable/reference/new-work.md +48 -21
  88. package/dist/builtin/workflows/skills/impeccable/reference/onboard.md +1 -1
  89. package/dist/builtin/workflows/skills/impeccable/reference/optimize.md +1 -1
  90. package/dist/builtin/workflows/skills/impeccable/reference/overdrive.md +1 -1
  91. package/dist/builtin/workflows/skills/impeccable/reference/polish.md +11 -3
  92. package/dist/builtin/workflows/skills/impeccable/reference/quieter.md +2 -2
  93. package/dist/builtin/workflows/skills/impeccable/reference/routing.md +13 -7
  94. package/dist/builtin/workflows/skills/impeccable/reference/typeset.md +2 -2
  95. package/dist/builtin/workflows/skills/impeccable/reference/visualize.md +13 -19
  96. package/dist/builtin/workflows/skills/impeccable/scripts/VERSION +1 -0
  97. package/dist/builtin/workflows/skills/impeccable/scripts/data/font-index-failures.json +121 -0
  98. package/dist/builtin/workflows/skills/impeccable/scripts/data/font-index.json +1 -0
  99. package/dist/builtin/workflows/skills/impeccable/scripts/impeccable +212 -0
  100. package/dist/builtin/workflows/skills/impeccable/scripts/impeccable.cmd +218 -0
  101. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-dom.js +21 -0
  102. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-ignores.js +242 -0
  103. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser-session.js +25 -4
  104. package/dist/builtin/workflows/skills/impeccable/scripts/live-browser.js +666 -197
  105. package/dist/builtin/workflows/skills/research-codebase/SKILL.md +1 -1
  106. package/dist/builtin/workflows/src/extension/index.bundle.mjs +352 -117
  107. package/dist/builtin/workflows/src/index.js +1403 -1218
  108. package/dist/cli/args.d.ts.map +1 -1
  109. package/dist/cli/args.js +15 -4
  110. package/dist/cli/args.js.map +1 -1
  111. package/dist/cli/file-processor.d.ts +1 -1
  112. package/dist/cli/file-processor.d.ts.map +1 -1
  113. package/dist/cli/file-processor.js.map +1 -1
  114. package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
  115. package/dist/core/agent-session-auto-compaction.js +40 -12
  116. package/dist/core/agent-session-auto-compaction.js.map +1 -1
  117. package/dist/core/agent-session-bash.d.ts.map +1 -1
  118. package/dist/core/agent-session-bash.js +9 -8
  119. package/dist/core/agent-session-bash.js.map +1 -1
  120. package/dist/core/agent-session-boundaries.d.ts +68 -0
  121. package/dist/core/agent-session-boundaries.d.ts.map +1 -0
  122. package/dist/core/agent-session-boundaries.js +334 -0
  123. package/dist/core/agent-session-boundaries.js.map +1 -0
  124. package/dist/core/agent-session-compaction.js +1 -1
  125. package/dist/core/agent-session-compaction.js.map +1 -1
  126. package/dist/core/agent-session-events.d.ts.map +1 -1
  127. package/dist/core/agent-session-events.js +27 -13
  128. package/dist/core/agent-session-events.js.map +1 -1
  129. package/dist/core/agent-session-export.d.ts.map +1 -1
  130. package/dist/core/agent-session-export.js +16 -20
  131. package/dist/core/agent-session-export.js.map +1 -1
  132. package/dist/core/agent-session-message-queue.d.ts.map +1 -1
  133. package/dist/core/agent-session-message-queue.js +3 -2
  134. package/dist/core/agent-session-message-queue.js.map +1 -1
  135. package/dist/core/agent-session-methods.d.ts +30 -4
  136. package/dist/core/agent-session-methods.d.ts.map +1 -1
  137. package/dist/core/agent-session-methods.js.map +1 -1
  138. package/dist/core/agent-session-persistent-custom-messages.d.ts.map +1 -1
  139. package/dist/core/agent-session-persistent-custom-messages.js +2 -1
  140. package/dist/core/agent-session-persistent-custom-messages.js.map +1 -1
  141. package/dist/core/agent-session-prompt.d.ts.map +1 -1
  142. package/dist/core/agent-session-prompt.js +93 -25
  143. package/dist/core/agent-session-prompt.js.map +1 -1
  144. package/dist/core/agent-session-retry.d.ts.map +1 -1
  145. package/dist/core/agent-session-retry.js +4 -9
  146. package/dist/core/agent-session-retry.js.map +1 -1
  147. package/dist/core/agent-session-runtime.js +1 -1
  148. package/dist/core/agent-session-runtime.js.map +1 -1
  149. package/dist/core/agent-session-tool-hooks.d.ts.map +1 -1
  150. package/dist/core/agent-session-tool-hooks.js +15 -5
  151. package/dist/core/agent-session-tool-hooks.js.map +1 -1
  152. package/dist/core/agent-session-tree.d.ts.map +1 -1
  153. package/dist/core/agent-session-tree.js +2 -3
  154. package/dist/core/agent-session-tree.js.map +1 -1
  155. package/dist/core/agent-session-types.d.ts +6 -0
  156. package/dist/core/agent-session-types.d.ts.map +1 -1
  157. package/dist/core/agent-session-types.js.map +1 -1
  158. package/dist/core/agent-session.d.ts +15 -2
  159. package/dist/core/agent-session.d.ts.map +1 -1
  160. package/dist/core/agent-session.js +17 -1
  161. package/dist/core/agent-session.js.map +1 -1
  162. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  163. package/dist/core/compaction/branch-summarization.js +1 -0
  164. package/dist/core/compaction/branch-summarization.js.map +1 -1
  165. package/dist/core/compaction/compaction-boundary.d.ts.map +1 -1
  166. package/dist/core/compaction/compaction-boundary.js +11 -6
  167. package/dist/core/compaction/compaction-boundary.js.map +1 -1
  168. package/dist/core/compaction/compaction.d.ts +3 -1
  169. package/dist/core/compaction/compaction.d.ts.map +1 -1
  170. package/dist/core/compaction/compaction.js +37 -0
  171. package/dist/core/compaction/compaction.js.map +1 -1
  172. package/dist/core/crash-log.d.ts +6 -0
  173. package/dist/core/crash-log.d.ts.map +1 -0
  174. package/dist/core/crash-log.js +69 -0
  175. package/dist/core/crash-log.js.map +1 -0
  176. package/dist/core/execution-model-router.d.ts +3 -0
  177. package/dist/core/execution-model-router.d.ts.map +1 -1
  178. package/dist/core/execution-model-router.js +45 -16
  179. package/dist/core/execution-model-router.js.map +1 -1
  180. package/dist/core/export-html/template-js/tree-filter-render.js +6 -1
  181. package/dist/core/export-html/template.js +6 -1
  182. package/dist/core/extensions/agent-events.d.ts +69 -3
  183. package/dist/core/extensions/agent-events.d.ts.map +1 -1
  184. package/dist/core/extensions/agent-events.js.map +1 -1
  185. package/dist/core/extensions/api-types.d.ts +5 -3
  186. package/dist/core/extensions/api-types.d.ts.map +1 -1
  187. package/dist/core/extensions/api-types.js.map +1 -1
  188. package/dist/core/extensions/event-results.d.ts +3 -0
  189. package/dist/core/extensions/event-results.d.ts.map +1 -1
  190. package/dist/core/extensions/event-results.js.map +1 -1
  191. package/dist/core/extensions/event-types.d.ts +2 -2
  192. package/dist/core/extensions/event-types.d.ts.map +1 -1
  193. package/dist/core/extensions/event-types.js.map +1 -1
  194. package/dist/core/extensions/index.d.ts +1 -1
  195. package/dist/core/extensions/index.d.ts.map +1 -1
  196. package/dist/core/extensions/index.js.map +1 -1
  197. package/dist/core/extensions/provider-types.d.ts +2 -0
  198. package/dist/core/extensions/provider-types.d.ts.map +1 -1
  199. package/dist/core/extensions/provider-types.js.map +1 -1
  200. package/dist/core/extensions/runner-events.d.ts +16 -2
  201. package/dist/core/extensions/runner-events.d.ts.map +1 -1
  202. package/dist/core/extensions/runner-events.js +98 -5
  203. package/dist/core/extensions/runner-events.js.map +1 -1
  204. package/dist/core/extensions/runner.d.ts +3 -2
  205. package/dist/core/extensions/runner.d.ts.map +1 -1
  206. package/dist/core/extensions/runner.js +4 -1
  207. package/dist/core/extensions/runner.js.map +1 -1
  208. package/dist/core/index.d.ts +1 -1
  209. package/dist/core/index.d.ts.map +1 -1
  210. package/dist/core/index.js.map +1 -1
  211. package/dist/core/messages.d.ts +10 -0
  212. package/dist/core/messages.d.ts.map +1 -1
  213. package/dist/core/messages.js +57 -0
  214. package/dist/core/messages.js.map +1 -1
  215. package/dist/core/model-config.d.ts +52 -0
  216. package/dist/core/model-config.d.ts.map +1 -1
  217. package/dist/core/model-config.js +16 -0
  218. package/dist/core/model-config.js.map +1 -1
  219. package/dist/core/model-resolver-defaults.d.ts.map +1 -1
  220. package/dist/core/model-resolver-defaults.js +2 -1
  221. package/dist/core/model-resolver-defaults.js.map +1 -1
  222. package/dist/core/model-routing-task.d.ts +1 -1
  223. package/dist/core/model-routing-task.d.ts.map +1 -1
  224. package/dist/core/model-routing-task.js +4 -3
  225. package/dist/core/model-routing-task.js.map +1 -1
  226. package/dist/core/prompt-templates-async.d.ts +2 -2
  227. package/dist/core/prompt-templates-async.d.ts.map +1 -1
  228. package/dist/core/prompt-templates-async.js +57 -29
  229. package/dist/core/prompt-templates-async.js.map +1 -1
  230. package/dist/core/prompt-templates.d.ts +6 -1
  231. package/dist/core/prompt-templates.d.ts.map +1 -1
  232. package/dist/core/prompt-templates.js +61 -35
  233. package/dist/core/prompt-templates.js.map +1 -1
  234. package/dist/core/provider-composer-internal.d.ts +1 -0
  235. package/dist/core/provider-composer-internal.d.ts.map +1 -1
  236. package/dist/core/provider-composer-internal.js +19 -0
  237. package/dist/core/provider-composer-internal.js.map +1 -1
  238. package/dist/core/resource-loader-assets.d.ts.map +1 -1
  239. package/dist/core/resource-loader-assets.js +6 -6
  240. package/dist/core/resource-loader-assets.js.map +1 -1
  241. package/dist/core/sdk.js +3 -2
  242. package/dist/core/sdk.js.map +1 -1
  243. package/dist/core/session-manager-core.d.ts +10 -3
  244. package/dist/core/session-manager-core.d.ts.map +1 -1
  245. package/dist/core/session-manager-core.js +65 -7
  246. package/dist/core/session-manager-core.js.map +1 -1
  247. package/dist/core/session-manager-entries.d.ts +4 -1
  248. package/dist/core/session-manager-entries.d.ts.map +1 -1
  249. package/dist/core/session-manager-entries.js +8 -0
  250. package/dist/core/session-manager-entries.js.map +1 -1
  251. package/dist/core/session-manager-history.d.ts +16 -1
  252. package/dist/core/session-manager-history.d.ts.map +1 -1
  253. package/dist/core/session-manager-history.js +105 -42
  254. package/dist/core/session-manager-history.js.map +1 -1
  255. package/dist/core/session-manager-types.d.ts +30 -3
  256. package/dist/core/session-manager-types.d.ts.map +1 -1
  257. package/dist/core/session-manager-types.js.map +1 -1
  258. package/dist/core/session-manager.d.ts +2 -2
  259. package/dist/core/session-manager.d.ts.map +1 -1
  260. package/dist/core/session-manager.js +1 -1
  261. package/dist/core/session-manager.js.map +1 -1
  262. package/dist/core/structured-output/index.d.ts +0 -1
  263. package/dist/core/structured-output/index.d.ts.map +1 -1
  264. package/dist/core/structured-output/index.js +3 -15
  265. package/dist/core/structured-output/index.js.map +1 -1
  266. package/dist/core/structured-output/jev-client.d.ts +4 -8
  267. package/dist/core/structured-output/jev-client.d.ts.map +1 -1
  268. package/dist/core/structured-output/jev-client.js +36 -32
  269. package/dist/core/structured-output/jev-client.js.map +1 -1
  270. package/dist/core/structured-output/jev.d.ts.map +1 -1
  271. package/dist/core/structured-output/jev.js +4 -12
  272. package/dist/core/structured-output/jev.js.map +1 -1
  273. package/dist/core/structured-output/types.d.ts +0 -2
  274. package/dist/core/structured-output/types.d.ts.map +1 -1
  275. package/dist/core/structured-output/types.js.map +1 -1
  276. package/dist/core/system-prompt.d.ts.map +1 -1
  277. package/dist/core/system-prompt.js +2 -1
  278. package/dist/core/system-prompt.js.map +1 -1
  279. package/dist/core/tools/read.d.ts +4 -0
  280. package/dist/core/tools/read.d.ts.map +1 -1
  281. package/dist/core/tools/read.js +5 -1
  282. package/dist/core/tools/read.js.map +1 -1
  283. package/dist/index-extensions.d.ts +1 -1
  284. package/dist/index-extensions.d.ts.map +1 -1
  285. package/dist/index-extensions.js.map +1 -1
  286. package/dist/index.d.ts +3 -3
  287. package/dist/index.d.ts.map +1 -1
  288. package/dist/index.js +3 -3
  289. package/dist/index.js.map +1 -1
  290. package/dist/main-app-mode.d.ts +1 -1
  291. package/dist/main-app-mode.d.ts.map +1 -1
  292. package/dist/main-app-mode.js +3 -2
  293. package/dist/main-app-mode.js.map +1 -1
  294. package/dist/main.d.ts.map +1 -1
  295. package/dist/main.js +1 -1
  296. package/dist/main.js.map +1 -1
  297. package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
  298. package/dist/modes/interactive/components/chat-message-renderer.js +4 -0
  299. package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
  300. package/dist/modes/interactive/components/tree-selector-content.d.ts.map +1 -1
  301. package/dist/modes/interactive/components/tree-selector-content.js +6 -0
  302. package/dist/modes/interactive/components/tree-selector-content.js.map +1 -1
  303. package/dist/modes/interactive/components/tree-selector-model.d.ts.map +1 -1
  304. package/dist/modes/interactive/components/tree-selector-model.js +1 -0
  305. package/dist/modes/interactive/components/tree-selector-model.js.map +1 -1
  306. package/dist/modes/interactive/interactive-agent-events.js +17 -1
  307. package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
  308. package/dist/modes/interactive/interactive-mode-helpers.d.ts +1 -0
  309. package/dist/modes/interactive/interactive-mode-helpers.d.ts.map +1 -1
  310. package/dist/modes/interactive/interactive-mode-helpers.js +16 -0
  311. package/dist/modes/interactive/interactive-mode-helpers.js.map +1 -1
  312. package/dist/modes/interactive/interactive-mode-surface.d.ts +1 -0
  313. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
  314. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  315. package/dist/modes/interactive/interactive-process-lifecycle.js +13 -1
  316. package/dist/modes/interactive/interactive-process-lifecycle.js.map +1 -1
  317. package/dist/modes/interactive/interactive-session-runtime.js +5 -1
  318. package/dist/modes/interactive/interactive-session-runtime.js.map +1 -1
  319. package/dist/utils/mime.js +1 -1
  320. package/dist/utils/mime.js.map +1 -1
  321. package/dist/utils/tool-result-images.d.ts +3 -1
  322. package/dist/utils/tool-result-images.d.ts.map +1 -1
  323. package/dist/utils/tool-result-images.js +4 -1
  324. package/dist/utils/tool-result-images.js.map +1 -1
  325. package/docs/compaction.md +5 -1
  326. package/docs/computer-use.md +123 -73
  327. package/docs/extensions/events.md +75 -7
  328. package/docs/extensions.md +6 -2
  329. package/docs/getting-started/first-session.md +3 -2
  330. package/docs/getting-started/installation.md +6 -2
  331. package/docs/intercom/operations.md +13 -1
  332. package/docs/intercom.md +7 -2
  333. package/docs/models/evals.md +68 -82
  334. package/docs/models/model-selection.md +11 -7
  335. package/docs/models/reference.md +30 -2
  336. package/docs/packages.md +2 -0
  337. package/docs/prompt-templates.md +1 -0
  338. package/docs/providers.md +8 -2
  339. package/docs/quickstart.md +1 -1
  340. package/docs/sdk/reference.md +1 -2
  341. package/docs/sdk/structured-decisions.md +10 -9
  342. package/docs/sdk.md +13 -2
  343. package/docs/session-format.md +17 -2
  344. package/docs/settings.md +1 -1
  345. package/docs/skills.md +3 -1
  346. package/docs/subagents/reference.md +6 -6
  347. package/docs/subagents.md +8 -2
  348. package/docs/usage.md +2 -0
  349. package/docs/windows.md +1 -1
  350. package/docs/workflows/api-reference.md +5 -4
  351. package/docs/workflows/authoring.md +191 -0
  352. package/docs/workflows/builtins.md +2 -2
  353. package/docs/workflows/operations.md +10 -4
  354. package/docs/workflows/reliable-design.md +12 -1
  355. package/docs/workflows/verification.md +27 -14
  356. package/npm-shrinkwrap.json +69 -69
  357. package/package.json +8 -8
  358. package/dist/builtin/subagents/skills/playwright-cli/SKILL.md +0 -420
  359. package/dist/builtin/subagents/skills/playwright-cli/references/element-attributes.md +0 -23
  360. package/dist/builtin/subagents/skills/playwright-cli/references/playwright-tests.md +0 -39
  361. package/dist/builtin/subagents/skills/playwright-cli/references/request-mocking.md +0 -87
  362. package/dist/builtin/subagents/skills/playwright-cli/references/running-code.md +0 -241
  363. package/dist/builtin/subagents/skills/playwright-cli/references/session-management.md +0 -225
  364. package/dist/builtin/subagents/skills/playwright-cli/references/storage-state.md +0 -275
  365. package/dist/builtin/subagents/skills/playwright-cli/references/test-generation.md +0 -433
  366. package/dist/builtin/subagents/skills/playwright-cli/references/tracing.md +0 -139
  367. package/dist/builtin/subagents/skills/playwright-cli/references/video-recording.md +0 -143
  368. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_asset_producer.toml +0 -94
  369. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_documenter.toml +0 -27
  370. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_finish_reviewer.toml +0 -41
  371. package/dist/builtin/workflows/skills/impeccable/agents/impeccable_manual_edit_applier.toml +0 -95
  372. package/dist/builtin/workflows/skills/impeccable/agents/openai.yaml +0 -4
  373. package/dist/builtin/workflows/skills/impeccable/scripts/concept-seed.mjs +0 -695
  374. package/dist/builtin/workflows/skills/impeccable/scripts/context-signals.mjs +0 -325
  375. package/dist/builtin/workflows/skills/impeccable/scripts/context.mjs +0 -1503
  376. package/dist/builtin/workflows/skills/impeccable/scripts/critique-storage.mjs +0 -222
  377. package/dist/builtin/workflows/skills/impeccable/scripts/detect-csp.mjs +0 -198
  378. package/dist/builtin/workflows/skills/impeccable/scripts/detect.mjs +0 -21
  379. package/dist/builtin/workflows/skills/impeccable/scripts/detector/browser/injected/index.mjs +0 -2073
  380. package/dist/builtin/workflows/skills/impeccable/scripts/detector/cli/main.mjs +0 -432
  381. package/dist/builtin/workflows/skills/impeccable/scripts/detector/design-system.mjs +0 -1121
  382. package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +0 -8746
  383. package/dist/builtin/workflows/skills/impeccable/scripts/detector/detect-antipatterns.mjs +0 -51
  384. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +0 -376
  385. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +0 -1168
  386. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +0 -1192
  387. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +0 -290
  388. package/dist/builtin/workflows/skills/impeccable/scripts/detector/engines/visual/screenshot-contrast.mjs +0 -189
  389. package/dist/builtin/workflows/skills/impeccable/scripts/detector/findings.mjs +0 -18
  390. package/dist/builtin/workflows/skills/impeccable/scripts/detector/node/file-system.mjs +0 -213
  391. package/dist/builtin/workflows/skills/impeccable/scripts/detector/profile/profiler.mjs +0 -166
  392. package/dist/builtin/workflows/skills/impeccable/scripts/detector/registry/antipatterns.mjs +0 -617
  393. package/dist/builtin/workflows/skills/impeccable/scripts/detector/rules/checks.mjs +0 -5534
  394. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/color.mjs +0 -588
  395. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/constants.mjs +0 -112
  396. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/fonts.mjs +0 -30
  397. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/inline-ignores.mjs +0 -148
  398. package/dist/builtin/workflows/skills/impeccable/scripts/detector/shared/page.mjs +0 -35
  399. package/dist/builtin/workflows/skills/impeccable/scripts/doctor.mjs +0 -338
  400. package/dist/builtin/workflows/skills/impeccable/scripts/embed-prompt.mjs +0 -270
  401. package/dist/builtin/workflows/skills/impeccable/scripts/generate-image.mjs +0 -277
  402. package/dist/builtin/workflows/skills/impeccable/scripts/hook-admin.mjs +0 -783
  403. package/dist/builtin/workflows/skills/impeccable/scripts/hook-lib.mjs +0 -2305
  404. package/dist/builtin/workflows/skills/impeccable/scripts/hook.mjs +0 -78
  405. package/dist/builtin/workflows/skills/impeccable/scripts/lib/artifact-schema.mjs +0 -93
  406. package/dist/builtin/workflows/skills/impeccable/scripts/lib/composition-catalog.mjs +0 -200
  407. package/dist/builtin/workflows/skills/impeccable/scripts/lib/concept-catalog.mjs +0 -395
  408. package/dist/builtin/workflows/skills/impeccable/scripts/lib/design-parser.mjs +0 -925
  409. package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-config.mjs +0 -640
  410. package/dist/builtin/workflows/skills/impeccable/scripts/lib/impeccable-paths.mjs +0 -137
  411. package/dist/builtin/workflows/skills/impeccable/scripts/lib/is-generated.mjs +0 -72
  412. package/dist/builtin/workflows/skills/impeccable/scripts/lib/open-system-browser.mjs +0 -57
  413. package/dist/builtin/workflows/skills/impeccable/scripts/lib/provider.mjs +0 -5
  414. package/dist/builtin/workflows/skills/impeccable/scripts/lib/roll-selection.mjs +0 -369
  415. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness-deep.mjs +0 -483
  416. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness-notice.mjs +0 -169
  417. package/dist/builtin/workflows/skills/impeccable/scripts/lib/staleness.mjs +0 -528
  418. package/dist/builtin/workflows/skills/impeccable/scripts/lib/surface-briefs.mjs +0 -151
  419. package/dist/builtin/workflows/skills/impeccable/scripts/lib/target-args.mjs +0 -42
  420. package/dist/builtin/workflows/skills/impeccable/scripts/lib/target-slug.mjs +0 -33
  421. package/dist/builtin/workflows/skills/impeccable/scripts/lib/template-extensions.mjs +0 -146
  422. package/dist/builtin/workflows/skills/impeccable/scripts/live/accept-css.mjs +0 -617
  423. package/dist/builtin/workflows/skills/impeccable/scripts/live/accept-verify.mjs +0 -71
  424. package/dist/builtin/workflows/skills/impeccable/scripts/live/browser-script-parts.mjs +0 -77
  425. package/dist/builtin/workflows/skills/impeccable/scripts/live/completion.mjs +0 -28
  426. package/dist/builtin/workflows/skills/impeccable/scripts/live/event-validation.mjs +0 -199
  427. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/astro.mjs +0 -47
  428. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/detect-utils.mjs +0 -157
  429. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/index.mjs +0 -143
  430. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/journal.mjs +0 -205
  431. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/nextjs.mjs +0 -49
  432. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/nuxt.mjs +0 -170
  433. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/script-src.mjs +0 -26
  434. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/static-html.mjs +0 -26
  435. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/sveltekit.mjs +0 -71
  436. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/tag-strategy.mjs +0 -247
  437. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/tanstack-start.mjs +0 -70
  438. package/dist/builtin/workflows/skills/impeccable/scripts/live/frameworks/vite-generic.mjs +0 -42
  439. package/dist/builtin/workflows/skills/impeccable/scripts/live/generation-preflight.mjs +0 -149
  440. package/dist/builtin/workflows/skills/impeccable/scripts/live/insert-ui.mjs +0 -458
  441. package/dist/builtin/workflows/skills/impeccable/scripts/live/instructions.mjs +0 -169
  442. package/dist/builtin/workflows/skills/impeccable/scripts/live/manual-apply.mjs +0 -939
  443. package/dist/builtin/workflows/skills/impeccable/scripts/live/manual-edit-routes.mjs +0 -357
  444. package/dist/builtin/workflows/skills/impeccable/scripts/live/manual-edits-buffer.mjs +0 -152
  445. package/dist/builtin/workflows/skills/impeccable/scripts/live/poll-lanes.mjs +0 -14
  446. package/dist/builtin/workflows/skills/impeccable/scripts/live/roots.mjs +0 -670
  447. package/dist/builtin/workflows/skills/impeccable/scripts/live/session-store.mjs +0 -563
  448. package/dist/builtin/workflows/skills/impeccable/scripts/live/source-lock.mjs +0 -105
  449. package/dist/builtin/workflows/skills/impeccable/scripts/live/source-search.mjs +0 -105
  450. package/dist/builtin/workflows/skills/impeccable/scripts/live/svelte-ast.mjs +0 -969
  451. package/dist/builtin/workflows/skills/impeccable/scripts/live/svelte-component.mjs +0 -1401
  452. package/dist/builtin/workflows/skills/impeccable/scripts/live/sveltekit-adapter.mjs +0 -314
  453. package/dist/builtin/workflows/skills/impeccable/scripts/live/tanstack-adapter.mjs +0 -280
  454. package/dist/builtin/workflows/skills/impeccable/scripts/live/ui-surfaces.mjs +0 -75
  455. package/dist/builtin/workflows/skills/impeccable/scripts/live/vocabulary.mjs +0 -171
  456. package/dist/builtin/workflows/skills/impeccable/scripts/live-accept.mjs +0 -961
  457. package/dist/builtin/workflows/skills/impeccable/scripts/live-commit-manual-edits.mjs +0 -1244
  458. package/dist/builtin/workflows/skills/impeccable/scripts/live-complete.mjs +0 -107
  459. package/dist/builtin/workflows/skills/impeccable/scripts/live-copy-edit-agent.mjs +0 -800
  460. package/dist/builtin/workflows/skills/impeccable/scripts/live-discard-manual-edits.mjs +0 -51
  461. package/dist/builtin/workflows/skills/impeccable/scripts/live-inject.mjs +0 -515
  462. package/dist/builtin/workflows/skills/impeccable/scripts/live-insert.mjs +0 -292
  463. package/dist/builtin/workflows/skills/impeccable/scripts/live-manual-edit-evidence.mjs +0 -371
  464. package/dist/builtin/workflows/skills/impeccable/scripts/live-poll.mjs +0 -427
  465. package/dist/builtin/workflows/skills/impeccable/scripts/live-resume.mjs +0 -123
  466. package/dist/builtin/workflows/skills/impeccable/scripts/live-server.mjs +0 -1675
  467. package/dist/builtin/workflows/skills/impeccable/scripts/live-status.mjs +0 -71
  468. package/dist/builtin/workflows/skills/impeccable/scripts/live-target.mjs +0 -30
  469. package/dist/builtin/workflows/skills/impeccable/scripts/live-wrap.mjs +0 -927
  470. package/dist/builtin/workflows/skills/impeccable/scripts/live.mjs +0 -365
  471. package/dist/builtin/workflows/skills/impeccable/scripts/palette.mjs +0 -628
  472. package/dist/builtin/workflows/skills/impeccable/scripts/pin.mjs +0 -224
  473. package/dist/builtin/workflows/skills/impeccable/scripts/serve-question.mjs +0 -1540
  474. package/dist/builtin/workflows/skills/impeccable/scripts/surface-brief.mjs +0 -74
package/CHANGELOG.md CHANGED
@@ -2,6 +2,66 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.9.20-alpha.6] - 2026-09-22
6
+
7
+ ### Breaking Changes
8
+
9
+ - Removed the `timeoutMs` option from `StructuredOutputRequest` and `RouterDecisionRequest`, and the `DEFAULT_STRUCTURED_OUTPUT_TIMEOUT_MS` export. SDK integrations can pass an `AbortSignal` for cancellation or a caller-owned deadline.
10
+ - Removed the inherited `shouldStopAfterTurn` agent option (pi-agent-core 0.87.0). Use `finishTurn` and return `{ action: "end" }` instead. `finishTurn` runs before `turn_end` but applies the decision afterward, and it also receives error and aborted responses; migrate normal-response predicates by returning `undefined` for those hard exits. See the `@earendil-works/pi-agent-core` changelog for a complete before-and-after example.
11
+ - Added `ContextEditEntry` to the exported `SessionEntry` union. TypeScript consumers with exhaustive entry switches must handle `context_edit`; use `replacement: null` for omission and a content replacement otherwise.
12
+ - Made `SessionManager` canonical for `AgentSession` provider context. Assigning `session.agent.state.messages` no longer replaces future request history; restore with `SessionManager.inMemory(cwd, { id }, entries)`, navigate with `session.navigateTree()`, or append through `session.sessionManager` and call `session.refreshContext()`. A caller-supplied `prepareNextTurnWithContext` replacement context is still honored for the request it prepared.
13
+ - Expanded `TurnEndEvent` with required boundary fields (`messageEntryId`, `toolResultEntryIds`, `outcome`, `entries`, `continue`, `context`) and added `AgentBeforeSettleEvent` to the exported `ExtensionEvent` union. Consumers constructing events or exhaustively switching on `ExtensionEvent` must handle the new shapes. `ExtensionRunner.emit()` no longer accepts `turn_end`; host integrations dispatch actionable boundaries with `emitBoundary(baseEvent, buildContext)`.
14
+ - Deferred runs requested from `agent_settled` handlers until all settled handlers finish. Handlers still observe `ctx.isIdle() === true`, but no longer see a reentrant `agent_start` during the same notification dispatch.
15
+ - Every provider request now waits for the session's queued agent events (including `agent_start`, `turn_start`, `message_start`, `message_end`, and `tool_execution_*` extension handlers) before it is sent, because the request is built from the persisted canonical projection and `message_end` handlers may replace the message that gets persisted. Per-event listener dispatch stays nonblocking, but an extension handler that awaits a later part of the same run (for example a provider response) now stalls that run instead of merely running late; move such waits to `agent_end` or `agent_settled`.
16
+
17
+ ### Added
18
+
19
+ - Added Meta (Muse subscription) login via `/login meta` with automatic Model API key refresh, plus `META_API_KEY` support.
20
+ - Added append-only model-context edits. For example, `sessionManager.appendContextEdit(entryId, null)` omits one message from future provider context without changing raw history, usage, or UI history. See [ContextEditEntry](docs/session-format.md#contexteditentry).
21
+ - Added actionable `turn_end` and `agent_before_settle` extension boundaries. Return `{ entries: [...event.entries, draft], continue: true }` to persist structural entries (`custom`, `custom_message`, `context_edit`, or a verbatim `compaction` handoff) in order and ensure one next provider request without changing steering or follow-up scheduling. See [extension events](docs/extensions/events.md#turn_start-/-turn_end).
22
+ - Added the `context_with_system` extension event, which runs after `context` handlers on the full transcript including system messages and sends its result verbatim. See [`context_with_system`](docs/extensions/events.md#context_with_system).
23
+ - Added per-model image resize profiles through `inputLimits.images.resize` in `models.json` (deep-merged by `modelOverrides`), applied to `@file` attachments, `read` tool images, and tool-result images. Attachments are resized once the run's model is known, so a `before_agent_start` model switch selects the profile. See [Image Input Limits](docs/models/reference.md#image-input-limits) ([#9631](https://github.com/earendil-works/pi/issues/9631)).
24
+ - Added crash diagnostics that identify loaded extensions whose source files appear in an uncaught-exception or fatal-error stack trace, with a hint to disable them with `atomic config` or confirm with `atomic -ne`.
25
+
26
+ ### Changed
27
+
28
+ - Desktop, simulator, and emulator computer use now routes to [Cua Driver](https://github.com/trycua/cua/tree/main/libs/cua-driver) instead of PyAutoGUI. The default system prompt, the Goal/Ralph end-to-end verification guidance, and the workflow-authoring guidance state one face rule: the `cua-driver` CLI through the bundled `cua-driver` skill when a model chooses each action, and the `@trycua/cua-driver` TypeScript SDK inside `ctx.tool` when workflow code owns the scenario. Guidance installs a missing `cua-driver` executable with upstream's one-line installer in one bounded attempt, runs every invocation with `CUA_DRIVER_RS_TELEMETRY_ENABLED=false` plus `cua-driver telemetry disable` after an install, reports missing macOS grants or a non-interactive session as `blocked`/`needs_human` with exact remediation, and never runs `cua-driver skills install`. The Computer use, Verification, Workflow authoring, and Skills guides document installation, readiness, telemetry and update-check switches, a `cua-driver call` example, and a runnable `ctx.tool` verification example ([#3181](https://github.com/bastani-inc/atomic/issues/3181)).
29
+ - A custom message sent with `triggerTurn: false` during an active run is still appended after the current turn's tool results rather than steered into it, and, because provider requests now use the canonical session projection, it is visible to that run's next request instead of only a later turn.
30
+ - Changed the default xAI model to Grok 4.7.
31
+ - Replaced the routing evals snapshot with one Artificial Analysis table of the top 26 catalog models by Intelligence Index, accessed 2026-09-21, with each published benchmark as a column. Grok 4.7 is a row in that table. Auto routing sends that snapshot in full, with the model-selection guide, inside Jev's 32k-token state-plus-longest-question limit.
32
+
33
+ ### Fixed
34
+
35
+ - Fixed string context-edit replacements producing invalid assistant and tool-result message content instead of text blocks.
36
+ - Fixed edited-context accounting both discarding valid assistant usage captured after the latest context edit and reusing that usage after a later compaction made it stale.
37
+ - Fixed selected error retries, model fallbacks, and final length/overflow recovery retaining abandoned model attempts in future provider context; post-run recovery omissions are now persisted as `context_edit` entries without hiding raw transcript history or changing queue scheduling.
38
+ - Fixed `context` handlers that filter or slice messages dropping the prompt and tool declarations, which after extension-driven compaction left requests without built-in tools or made Codex emit raw tool-call text. Handlers no longer see system messages; Atomic restores the prompt and tool state after they run. See [`context`](docs/extensions/events.md#context) ([#9789](https://github.com/earendil-works/pi/issues/9789), [#9822](https://github.com/earendil-works/pi/issues/9822)).
39
+ - Fixed text files beginning with `GIF` being misclassified as images and omitted from `read` and CLI `@file` input ([#9755](https://github.com/earendil-works/pi/issues/9755)).
40
+ - Fixed malformed prompt template frontmatter being silently ignored instead of reported as a resource warning naming the file and parse position ([#9830](https://github.com/earendil-works/pi/pull/9830) by [@christianklotz](https://github.com/christianklotz)).
41
+ - Fixed inherited unknown OpenAI-compatible Chat Completions endpoints receiving strict tool schemas unless they explicitly advertise support ([#9816](https://github.com/earendil-works/pi/issues/9816)).
42
+ - Structured decisions and automatic model selection no longer fail at a fixed 30-second deadline, including during model ranking, output repairs and Jev-to-chat fallback. Explicit cancellation and independent provider and tool-request limits still apply.
43
+ - Workflow reviewers and other stages no longer fail extension startup with a misleading `Live workflow-stage route is owned by another active session` when their workflow owner is re-registering with the Intercom broker, when the previous attempt's session is still being torn down, or when a later review round reuses a stage name whose earlier occurrence is still connected. Refusals now name the actual condition, transient ones recover through the bounded stage warm-up retry, and genuine duplicate owners are still refused. See [Intercom operations](/intercom/operations#workflow-stage-route-refusals) ([#3163](https://github.com/bastani-inc/atomic/issues/3163)).
44
+ - Fixed missing or invalid `--mode` values being silently ignored instead of reporting an error and exiting with a nonzero status ([#9045](https://github.com/earendil-works/pi/issues/9045)).
45
+
46
+ ## [0.9.20-alpha.5] - 2026-09-20
47
+
48
+ ### Added
49
+
50
+ - The SDK exports `spawnProcess` next to `createChildProcessEnvironment`: the child-process spawner that stamps Atomic's agent attribution into the environment and, on Windows, runs `.cmd`/`.bat` launchers through `cross-spawn` with correct argument quoting. The bundled `impeccable` skill's engine launcher and the `open-claude-design` live loop use it.
51
+
52
+ ### Changed
53
+
54
+ - Automatic subagent and workflow-stage model selection now sends a fixed `model_selection_guide` state field next to `evals`: the "Benchmarks are evidence, not policy" and "Role-based thinking effort" sections from [Model Selection](/models/model-selection), so the router applies the role defaults and effort rules rather than only the dated benchmark tables. To keep every Jev request within its input budget, the model-selection task excerpt cap is now 10,000 JSON-encoded UTF-8 bytes (was 12,000); execution tasks are still sent in full.
55
+ - The `model_selection_guide` sent with automatic model routing, and the [Model Selection](/models/model-selection) guide it mirrors, now pair each stage role with a model cost tier as well as a thinking level: cheap, fast models for codebase exploration and routine implementation, frontier models for code review, verification, and final approval, and mid-priced models for orchestration and reporting. The router is told to match the role tier first, so high-volume tool-driven work stops defaulting to the most expensive candidate. The larger guide is paid for by lowering the model-selection task excerpt cap to 9,000 JSON-encoded UTF-8 bytes (was 10,000); execution tasks are still sent in full.
56
+ - The default system prompt's Guidelines section now tells the agent to write self-describing code and not add comments unless the user explicitly asks for them or the task instructions call for them; code that needs a comment to be understood is treated as a smell to restructure with clearer names, smaller units, or explicit types.
57
+ - The default system prompt and the computer-use, skills, first-session, and verification guides now direct browser automation to the `agent-browser` skill and CLI ([vercel-labs/agent-browser](https://github.com/vercel-labs/agent-browser) v0.38.1) instead of the removed `playwright-cli` skill; install with `npm i -g agent-browser && agent-browser install`.
58
+ - The bundled `impeccable` skill is upstream `skill-v4.3.1` with its self-contained engine (0.1.5). Its commands run through `scripts/impeccable` (`impeccable.cmd` on Windows), which uses an engine binary beside the launcher or downloads and checksum-verifies the pinned release for your platform on first use; set `IMPECCABLE_BIN` to a preinstalled engine on machines without network access. Atomic's launcher keeps the engine's anonymous ping and `npx impeccable update` prompt off. See the [first session](/getting-started/first-session) guide.
59
+
60
+ ### Fixed
61
+
62
+ - Workflow stage chats and other transcript views built from session messages no longer print a bare dim "system" line for the session's system-prompt message.
63
+ - Auto model routing no longer prints `Text was truncated to fit the input budget. Continuing with the shortened text.` to the console when it shortens a long task for its own routing request; the execution prompt was never affected.
64
+
5
65
  ## [0.9.20-alpha.4] - 2026-09-20
6
66
 
7
67
  ### Breaking Changes
package/README.md CHANGED
@@ -124,6 +124,7 @@ For each built-in provider, Atomic maintains a list of tool-capable models, upda
124
124
  - Together AI
125
125
  - Baseten
126
126
  - Kimi For Coding
127
+ - Meta
127
128
  - MiniMax
128
129
  - MiniMax (China)
129
130
  - Moonshot AI
@@ -277,6 +278,15 @@ Long sessions can exhaust context windows. Compaction now uses deletion-only con
277
278
 
278
279
  The full history still remains in the JSONL file; use `/tree` to revisit. See [docs/compaction.md](docs/compaction.md) for internals.
279
280
 
281
+ Session model context is projected from append-only history. Extensions can append a `context_edit` to omit or replace an earlier message only for future model requests; raw history and usage remain unchanged:
282
+
283
+ ```typescript
284
+ const assistantId = sessionManager.appendMessage(partialAssistant);
285
+ sessionManager.appendContextEdit(assistantId, null); // Hidden from model context, retained in JSONL.
286
+ ```
287
+
288
+ Atomic uses the same mechanism itself when it retries a failed attempt: the attempt stays in the JSONL file but is omitted from what the model sees.
289
+
280
290
  ---
281
291
 
282
292
  ## Settings
@@ -368,6 +378,33 @@ export default function (pi: ExtensionAPI) {
368
378
  }
369
379
  ```
370
380
 
381
+ `turn_end` and `agent_before_settle` are actionable persistence boundaries. Handlers can append structural entries and request one continuation. Later handlers see earlier proposals:
382
+
383
+ ```typescript
384
+ let replacedResponse = false;
385
+ pi.on("turn_end", (event) => {
386
+ if (replacedResponse || event.outcome !== "completed" || event.toolResults.length > 0) return;
387
+ replacedResponse = true;
388
+ return {
389
+ entries: [
390
+ ...event.entries,
391
+ { type: "context_edit", targetId: event.messageEntryId, replacement: null },
392
+ {
393
+ type: "custom_message",
394
+ customType: "replacement-instruction",
395
+ content: "Answer again using the persisted user request.",
396
+ display: false,
397
+ },
398
+ ],
399
+ continue: true,
400
+ };
401
+ });
402
+ ```
403
+
404
+ Continuation is one-shot per boundary result, not per registered handler. It ensures one next provider request: tool-result, steering, or follow-up scheduling can satisfy that request without adding another one; otherwise Atomic makes one context-only request. Guard handlers like the example above because an unconditional `continue: true` is evaluated again after the next response and can loop indefinitely. Error and aborted responses remain hard exits.
405
+
406
+ Use `agent_before_settle` for final actions after retries, compaction, and queued input are exhausted. See [docs/extensions/events.md](docs/extensions/events.md#agent_start-/-agent_end-/-agent_before_settle-/-agent_settled).
407
+
371
408
  The default export can also be `async`. Atomic waits for async extension factories before startup continues, which is useful for one-time initialization such as fetching remote model lists before calling `pi.registerProvider()`.
372
409
 
373
410
  **What's possible:**
@@ -4,6 +4,22 @@ All notable changes to the `pi-intercom` extension will be documented in this fi
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.9.20-alpha.6] - 2026-09-22
8
+
9
+ ### Fixed
10
+
11
+ - Admitted subagent children now connect to Intercom when their session starts instead of on their own first Intercom call, so a working child launched from a workflow stage or main chat appears in `intercom list` and can be steered with `send`/`ask` from its supervisor and peers even if it never uses Intercom itself. A recoverable broker disconnect during that warm-up no longer aborts the child's launch; the child falls back to connecting lazily.
12
+ - Workflow-stage live route refusals now name the condition that failed — no registered workflow owner, capability mismatch, registrant outside the invocation group, non-agent stage key, or a genuine duplicate live owner — instead of reporting every case as `Live workflow-stage route is owned by another active session`. Each refusal carries a machine-readable `code` ([#3163](https://github.com/bastani-inc/atomic/issues/3163)).
13
+ - A stage that starts while its workflow owner is re-registering after a reconnect, or while the previous attempt's session is still being torn down, now recovers through the bounded warm-up retry instead of failing extension startup. Genuine duplicate live owners are still refused on every attempt; authority and configuration mismatches remain terminal ([#3163](https://github.com/bastani-inc/atomic/issues/3163)).
14
+ - A stage name reused by a later occurrence in the same run (for example `reviewer-a` in a second review round while the first round's completed session is still connected) no longer collides as a duplicate owner. The later stage registers under its stage id, and the ambiguous name keeps no live alias for either occurrence, so it routes through the workflow owner instead of reaching the earlier round ([#3163](https://github.com/bastani-inc/atomic/issues/3163)).
15
+ - The bundled `intercom` skill's optional cmux/tmux peer-launch examples now start `atomic` instead of `pi`, and the troubleshooting step refers to Atomic's bundled Intercom extension ([#3180](https://github.com/bastani-inc/atomic/issues/3180)).
16
+
17
+ ## [0.9.20-alpha.5] - 2026-09-20
18
+
19
+ ### Changed
20
+
21
+ - The `intercom` skill adds a peer-coordination pattern for subagents and workflow stages that share a group, covering connect, coordinate, learn, and debate exchanges alongside the existing supervisor-escalation patterns.
22
+
7
23
  ## [0.9.20-alpha.4] - 2026-09-20
8
24
 
9
25
  ### Added
@@ -52,6 +52,10 @@ import { PendingQuestionIndex } from "./pending-question-index.js";
52
52
  import { matchStagePathSegments } from "../workflow-stage-path-matching.js";
53
53
  import { DELIVERED_MESSAGE_TTL_MS } from "../retry-policy.js";
54
54
  import { isAgentRecipient } from "../recipient-purpose.js";
55
+ import {
56
+ LIVE_WORKFLOW_STAGE_ROUTE_REFUSAL_REASONS,
57
+ type LiveWorkflowStageRouteRefusalCode,
58
+ } from "../live-route-refusal.js";
55
59
 
56
60
  const INTERCOM_DIR = getIntercomDirPath();
57
61
  const SOCKET_PATH = getBrokerSocketPath();
@@ -563,37 +567,88 @@ class IntercomBroker {
563
567
  }
564
568
  }
565
569
 
570
+ /** Stage names shared by more than one agent stage of a roster; hosts resolve them to no stage. */
571
+ private ambiguousStageNames(roster: WorkflowRosterRegistration | undefined): ReadonlySet<string> {
572
+ const counts = new Map<string, number>();
573
+ for (const stage of roster?.stages ?? []) {
574
+ if (!isAgentRecipient(stage)) continue;
575
+ counts.set(stage.stageName, (counts.get(stage.stageName) ?? 0) + 1);
576
+ }
577
+ return new Set([...counts].filter(([, count]) => count > 1).map(([name]) => name));
578
+ }
579
+
580
+ /**
581
+ * #3163: once a run's roster makes a stage name ambiguous, no occurrence may keep the
582
+ * name-form alias — otherwise a send to `workflow:<root>/reviewer-a` would still reach
583
+ * the retained earlier round while the later round is the one running. The id-form
584
+ * aliases stay; the name resolves through the owner, which treats it as ambiguous.
585
+ */
586
+ private retireAmbiguousNameAliases(runId: string): void {
587
+ const roster = this.workflowRosters.get(runId);
588
+ const ambiguousNames = this.ambiguousStageNames(roster);
589
+ if (ambiguousNames.size === 0) return;
590
+ const stages = roster?.stages ?? [];
591
+ for (const stage of stages) {
592
+ if (!ambiguousNames.has(stage.stageName)) continue;
593
+ // A name that is also some stage's id addresses that stage; leave its id alias alone.
594
+ if (stages.some((candidate) => candidate.stageId === stage.stageName)) continue;
595
+ const nameTarget = withWorkflowStageTargetFinalSegment(stage.target, stage.stageName);
596
+ if (nameTarget === undefined || nameTarget === stage.target) continue;
597
+ if (this.liveWorkflowStageRoutes.get(nameTarget)?.runId === runId) this.liveWorkflowStageRoutes.delete(nameTarget);
598
+ }
599
+ }
600
+
601
+ /** Register the stage's live aliases; returns the refusal code when a precondition fails. */
566
602
  private registerLiveWorkflowStageRoute(
567
603
  currentId: string,
568
604
  requestId: string,
569
605
  runId: string,
570
606
  stageKeys: readonly string[],
571
607
  capability: string,
572
- ): boolean {
608
+ ): LiveWorkflowStageRouteRefusalCode | undefined {
573
609
  const uniqueStageKeys = [...new Set(stageKeys)];
574
610
  const owner = this.pendingStageRoutes.get(runId);
575
- if (owner === undefined || !owner.group.startsWith("workflow:")) return false;
611
+ if (owner === undefined) return "owner_missing";
612
+ if (!owner.group.startsWith("workflow:")) return "owner_not_workflow";
576
613
  const rootRunId = owner.group.slice("workflow:".length);
577
614
  // D8 clarification: advertised targets are depth-faithful, so the live aliases must be
578
615
  // depth-faithful too. The roster publishes the id-form target per stage; the name form
579
616
  // swaps its final segment. Without a roster entry, fall back to the flat run-id prefix
580
617
  // (still an accepted resolver input).
581
618
  const roster = this.workflowRosters.get(runId);
619
+ const rosterMatches = (key: string): WorkflowStageRosterAnnouncement[] =>
620
+ roster?.stages.filter((stage) => stage.stageId === key || stage.stageName === key) ?? [];
582
621
  if (uniqueStageKeys.some((key) => {
583
- const matches = roster?.stages.filter((stage) => stage.stageId === key || stage.stageName === key) ?? [];
622
+ const matches = rosterMatches(key);
584
623
  return matches.length > 0 && matches.every((stage) => !isAgentRecipient(stage));
585
- })) return false;
586
- const targets = uniqueStageKeys.map((stageKey) => {
587
- const entry = roster?.stages.find((stage) => stage.stageId === stageKey || stage.stageName === stageKey);
588
- const entryTarget = entry === undefined ? undefined : parseWorkflowStageTarget(entry.target);
589
- if (entry !== undefined && entryTarget?.kind === "path") {
590
- if (stageKey !== entry.stageName) return entry.target;
591
- return (
592
- withWorkflowStageTargetFinalSegment(entry.target, entry.stageName) ?? entry.target
593
- );
624
+ })) return "non_agent_stage_key";
625
+ // #3163: a stage name reused by a later occurrence (`reviewer-a` in review round two)
626
+ // is ambiguous — hosts resolve such a name to no stage — so it gets no name alias
627
+ // rather than colliding with the retained earlier occurrence's live session. The
628
+ // stage stays addressable by its id-form target, which the roster advertises.
629
+ const ambiguousNames = this.ambiguousStageNames(roster);
630
+ this.retireAmbiguousNameAliases(runId);
631
+ const stages = roster?.stages ?? [];
632
+ // The registrant is the roster stage its own `[id, name]` keys describe. A key is an
633
+ // id alias only when it is *that* stage's id: a name that happens to equal another
634
+ // stage's id must not take over that stage's route.
635
+ const registrant =
636
+ stages.find((stage) => uniqueStageKeys.includes(stage.stageId) &&
637
+ (uniqueStageKeys.length === 1 || uniqueStageKeys.includes(stage.stageName))) ??
638
+ (uniqueStageKeys.length === 1 ? rosterMatches(uniqueStageKeys[0]!).find(isAgentRecipient) : undefined);
639
+ const idOfAnotherStage = (key: string): boolean =>
640
+ stages.some((stage) => stage.stageId === key && stage !== registrant);
641
+ const targets = uniqueStageKeys.flatMap((stageKey) => {
642
+ if (idOfAnotherStage(stageKey)) return [];
643
+ const registrantTarget = registrant === undefined ? undefined : parseWorkflowStageTarget(registrant.target);
644
+ if (registrant !== undefined && registrantTarget?.kind === "path") {
645
+ if (stageKey === registrant.stageId) return [registrant.target];
646
+ if (ambiguousNames.has(stageKey)) return [];
647
+ return [withWorkflowStageTargetFinalSegment(registrant.target, stageKey) ?? registrant.target];
594
648
  }
649
+ if (ambiguousNames.has(stageKey)) return [];
595
650
  const prefix = runId === rootRunId ? [] : [runId];
596
- return formatWorkflowStageTarget(rootRunId, ...prefix, stageKey);
651
+ return [formatWorkflowStageTarget(rootRunId, ...prefix, stageKey)];
597
652
  });
598
653
  for (const target of targets) {
599
654
  const existing = this.liveWorkflowStageRoutes.get(target);
@@ -602,7 +657,7 @@ class IntercomBroker {
602
657
  existing.sessionId !== currentId &&
603
658
  this.sessions.has(existing.sessionId)
604
659
  ) {
605
- return false;
660
+ return "duplicate_live_owner";
606
661
  }
607
662
  }
608
663
  for (const target of targets) {
@@ -636,7 +691,7 @@ class IntercomBroker {
636
691
  );
637
692
  this.liveWorkflowStageRouteActivations.set(requestId, { sessionId: currentId, pendingRequestIds });
638
693
  this.acknowledgeLiveWorkflowStageRoute(requestId);
639
- return true;
694
+ return undefined;
640
695
  }
641
696
 
642
697
  private routePendingStage = (route: PendingStageRoute): boolean => {
@@ -1456,6 +1511,7 @@ class IntercomBroker {
1456
1511
  ...(possibleStages === undefined ? {} : { possibleStages }),
1457
1512
  ...(parent === undefined ? {} : { parent }),
1458
1513
  });
1514
+ this.retireAmbiguousNameAliases(clientMessage.runId);
1459
1515
  }
1460
1516
  break;
1461
1517
  }
@@ -1472,6 +1528,7 @@ class IntercomBroker {
1472
1528
  ...(possibleStages === undefined ? {} : { possibleStages }),
1473
1529
  ...(parent === undefined ? {} : { parent }),
1474
1530
  });
1531
+ this.retireAmbiguousNameAliases(clientMessage.runId);
1475
1532
  }
1476
1533
  break;
1477
1534
  }
@@ -1489,42 +1546,56 @@ class IntercomBroker {
1489
1546
  ) {
1490
1547
  throw new Error("Invalid live workflow-stage route registration");
1491
1548
  }
1549
+ const refuse = (code: LiveWorkflowStageRouteRefusalCode): void => {
1550
+ // #3163: every precondition names its own condition, so a stage that started
1551
+ // while its owner was reconnecting is not reported as a duplicate live owner.
1552
+ writeMessageIfOpen(socket, {
1553
+ type: "registration_failed",
1554
+ reason: LIVE_WORKFLOW_STAGE_ROUTE_REFUSAL_REASONS[code],
1555
+ code,
1556
+ });
1557
+ this.endRefusedConnection(socket, currentId, setId);
1558
+ };
1492
1559
  if (!clientMessage.stageKeys.every((stageKey) => !stageKey.includes("/") && !stageKey.includes("*"))) {
1493
1560
  // A stage name containing "/" or "*" cannot be a canonical path segment, but throwing
1494
1561
  // here reaches the framing reader's onError and destroys the stage session's whole
1495
1562
  // broker connection. Refuse orderly like every neighbouring rejection; host clients
1496
1563
  // filter such name keys and register the stage-id key instead.
1497
- writeMessageIfOpen(socket, {
1498
- type: "registration_failed",
1499
- reason: "Live workflow-stage route keys must be single path segments",
1500
- });
1501
- this.endRefusedConnection(socket, currentId, setId);
1564
+ refuse("invalid_stage_key");
1502
1565
  return;
1503
1566
  }
1504
1567
  const ownerRegistration = this.pendingStageRoutes.get(clientMessage.runId);
1505
1568
  const registeringSession = this.sessions.get(currentId);
1569
+ if (ownerRegistration === undefined) {
1570
+ refuse("owner_missing");
1571
+ return;
1572
+ }
1573
+ if (registeringSession === undefined || !isAgentRecipient(registeringSession.info)) {
1574
+ refuse("registrant_not_agent");
1575
+ return;
1576
+ }
1577
+ if (ownerRegistration.capability !== clientMessage.capability) {
1578
+ refuse("capability_mismatch");
1579
+ return;
1580
+ }
1506
1581
  if (
1507
- ownerRegistration === undefined ||
1508
- registeringSession === undefined ||
1509
- !isAgentRecipient(registeringSession.info) ||
1510
- ownerRegistration.capability !== clientMessage.capability ||
1511
- !invocationOwnsGroup(
1512
- ownerRegistration.group,
1513
- registeringSession.registrationGroup ?? registeringSession.info.group ?? "default",
1514
- ) ||
1515
- !this.registerLiveWorkflowStageRoute(
1516
- currentId,
1517
- clientMessage.requestId,
1518
- clientMessage.runId,
1519
- clientMessage.stageKeys,
1520
- clientMessage.capability,
1582
+ !invocationOwnsGroup(
1583
+ ownerRegistration.group,
1584
+ registeringSession.registrationGroup ?? registeringSession.info.group ?? "default",
1521
1585
  )
1522
1586
  ) {
1523
- writeMessageIfOpen(socket, {
1524
- type: "registration_failed",
1525
- reason: "Live workflow-stage route is owned by another active session",
1526
- });
1527
- this.endRefusedConnection(socket, currentId, setId);
1587
+ refuse("group_mismatch");
1588
+ return;
1589
+ }
1590
+ const refusal = this.registerLiveWorkflowStageRoute(
1591
+ currentId,
1592
+ clientMessage.requestId,
1593
+ clientMessage.runId,
1594
+ clientMessage.stageKeys,
1595
+ clientMessage.capability,
1596
+ );
1597
+ if (refusal !== undefined) {
1598
+ refuse(refusal);
1528
1599
  return;
1529
1600
  }
1530
1601
  break;
@@ -21,6 +21,7 @@ import { readSubagentMessageSource } from "../source-ownership.js";
21
21
  import { isMessage, isSessionInfo } from "./client-message-validation.js";
22
22
  import { normalizeGroups } from "../group.js";
23
23
  import { IntercomClientDisconnectedError } from "../recoverable-disconnect.js";
24
+ import { IntercomLiveRouteRefusedError, isLiveWorkflowStageRouteRefusalCode } from "../live-route-refusal.js";
24
25
 
25
26
  const BROKER_SOCKET = getBrokerSocketPath();
26
27
  const GROUP_REQUEST_TIMEOUT_MS = 5000;
@@ -417,7 +418,13 @@ export class IntercomClient extends EventEmitter {
417
418
  }
418
419
  case "registration_failed": {
419
420
  if (typeof brokerMessage.reason !== "string") throw new Error("Invalid registration_failed message");
420
- const refusal = new Error(brokerMessage.reason);
421
+ // A coded refusal is classified by construction downstream; the code, not
422
+ // the wording, decides whether the stage's bounded warm-up retry may clear it.
423
+ // A code this client does not know (broker/client version skew) keeps the
424
+ // reason as an ordinary, non-recoverable error.
425
+ const refusal = isLiveWorkflowStageRouteRefusalCode(brokerMessage.code)
426
+ ? new IntercomLiveRouteRefusedError(brokerMessage.code, brokerMessage.reason)
427
+ : new Error(brokerMessage.reason);
421
428
  if (this._sessionId === null) {
422
429
  // Still registering: `connect()` owns the failure and its own cleanup.
423
430
  this.emit("_registration_failed", refusal);
@@ -92,6 +92,51 @@ var renderContactSupervisorResult = (result, { isPartial }, theme, context) => {
92
92
  };
93
93
  var init_result_renderers = () => {};
94
94
 
95
+ // dist/builtin/intercom/live-route-refusal.ts
96
+ function isLiveWorkflowStageRouteRefusalCode(value) {
97
+ return typeof value === "string" && LIVE_WORKFLOW_STAGE_ROUTE_REFUSAL_CODES.includes(value);
98
+ }
99
+ function isTransientLiveWorkflowStageRouteRefusal(code) {
100
+ return TRANSIENT_REFUSAL_CODES.has(code);
101
+ }
102
+ var LIVE_WORKFLOW_STAGE_ROUTE_REFUSAL_CODES, LIVE_WORKFLOW_STAGE_ROUTE_REFUSAL_REASONS, TRANSIENT_REFUSAL_CODES, IntercomLiveRouteRefusedError;
103
+ var init_live_route_refusal = __esm(() => {
104
+ LIVE_WORKFLOW_STAGE_ROUTE_REFUSAL_CODES = [
105
+ "owner_missing",
106
+ "owner_not_workflow",
107
+ "registrant_not_agent",
108
+ "capability_mismatch",
109
+ "group_mismatch",
110
+ "invalid_stage_key",
111
+ "non_agent_stage_key",
112
+ "duplicate_live_owner"
113
+ ];
114
+ LIVE_WORKFLOW_STAGE_ROUTE_REFUSAL_REASONS = {
115
+ owner_missing: "Live workflow-stage route has no registered workflow owner",
116
+ owner_not_workflow: "Live workflow-stage route owner is not registered under a workflow invocation group",
117
+ registrant_not_agent: "Live workflow-stage route registrant is not an agent session",
118
+ capability_mismatch: "Live workflow-stage route capability does not match the workflow owner",
119
+ group_mismatch: "Live workflow-stage route registrant is outside the workflow invocation group",
120
+ invalid_stage_key: "Live workflow-stage route keys must be single path segments",
121
+ non_agent_stage_key: "Live workflow-stage route keys name a non-agent workflow node",
122
+ duplicate_live_owner: "Live workflow-stage route is owned by another active session"
123
+ };
124
+ TRANSIENT_REFUSAL_CODES = new Set([
125
+ "owner_missing",
126
+ "duplicate_live_owner"
127
+ ]);
128
+ IntercomLiveRouteRefusedError = class IntercomLiveRouteRefusedError extends Error {
129
+ code;
130
+ transient;
131
+ constructor(code, reason = LIVE_WORKFLOW_STAGE_ROUTE_REFUSAL_REASONS[code]) {
132
+ super(reason);
133
+ this.name = "IntercomLiveRouteRefusedError";
134
+ this.code = code;
135
+ this.transient = isTransientLiveWorkflowStageRouteRefusal(code);
136
+ }
137
+ };
138
+ });
139
+
95
140
  // dist/builtin/intercom/recoverable-disconnect.ts
96
141
  function isRecoverableIntercomDisconnect(error) {
97
142
  let current = error;
@@ -100,12 +145,15 @@ function isRecoverableIntercomDisconnect(error) {
100
145
  return false;
101
146
  if (current instanceof IntercomClientDisconnectedError)
102
147
  return true;
148
+ if (current instanceof IntercomLiveRouteRefusedError)
149
+ return current.transient;
103
150
  current = current.cause;
104
151
  }
105
152
  return false;
106
153
  }
107
154
  var RECOVERABLE_DISCONNECT_MESSAGE = "Client disconnected", MAX_CAUSE_DEPTH = 8, IntercomClientDisconnectedError;
108
155
  var init_recoverable_disconnect = __esm(() => {
156
+ init_live_route_refusal();
109
157
  IntercomClientDisconnectedError = class IntercomClientDisconnectedError extends Error {
110
158
  intercomRecoverableDisconnect = true;
111
159
  constructor(options) {
@@ -529,6 +577,7 @@ var init_client = __esm(() => {
529
577
  init_pending_send_registry();
530
578
  init_group();
531
579
  init_recoverable_disconnect();
580
+ init_live_route_refusal();
532
581
  BROKER_SOCKET = getBrokerSocketPath();
533
582
  IntercomClient = class IntercomClient extends EventEmitter {
534
583
  returnAddress;
@@ -742,7 +791,7 @@ var init_client = __esm(() => {
742
791
  case "registration_failed": {
743
792
  if (typeof brokerMessage.reason !== "string")
744
793
  throw new Error("Invalid registration_failed message");
745
- const refusal = new Error(brokerMessage.reason);
794
+ const refusal = isLiveWorkflowStageRouteRefusalCode(brokerMessage.code) ? new IntercomLiveRouteRefusedError(brokerMessage.code, brokerMessage.reason) : new Error(brokerMessage.reason);
746
795
  if (this._sessionId === null) {
747
796
  this.emit("_registration_failed", refusal);
748
797
  break;
@@ -7206,8 +7255,11 @@ function piIntercomExtension(pi, testOverrides = {}) {
7206
7255
  });
7207
7256
  pi.on("session_start", async (_event, ctx) => {
7208
7257
  const pendingStageDelivery = ctx.orchestrationContext?.kind === "workflow-stage" ? ctx.orchestrationContext.pendingStageDelivery : undefined;
7209
- if (pendingStageDelivery === undefined)
7258
+ if (pendingStageDelivery === undefined) {
7259
+ if (ctx.subagentPolicy?.intercom !== undefined)
7260
+ await ensureConnected("startup");
7210
7261
  return;
7262
+ }
7211
7263
  await ensureConnected("startup");
7212
7264
  await pendingStageDelivery.deliverPending((from, message) => handleIncomingMessage(ctx, from, message, undefined, true));
7213
7265
  });
@@ -7877,6 +7929,13 @@ function intercom(pi, options = {}) {
7877
7929
  throw error;
7878
7930
  scheduleWarmUpRetry(ctx, lease, generation, pendingStageDelivery, error);
7879
7931
  }
7932
+ } else if (typedIdentity) {
7933
+ try {
7934
+ await loadHeavy(ctx);
7935
+ } catch (error) {
7936
+ if (!isRecoverableIntercomDisconnect(error))
7937
+ throw error;
7938
+ }
7880
7939
  } else if (loadedHeavy) {
7881
7940
  await ensureSessionStartReplayed(loadedHeavy.heavy, lease);
7882
7941
  }
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Refusal vocabulary for `register_live_workflow_stage_route`.
3
+ *
4
+ * The broker used one sentence — "owned by another active session" — for every
5
+ * failing precondition, so a stage that started while its workflow owner was
6
+ * reconnecting, or whose capability no longer matched, was reported as a
7
+ * duplicate owner (#3163). Each condition now carries its own code and reason.
8
+ * The code, not the wording, decides whether a stage may try again.
9
+ */
10
+
11
+ export const LIVE_WORKFLOW_STAGE_ROUTE_REFUSAL_CODES = [
12
+ "owner_missing",
13
+ "owner_not_workflow",
14
+ "registrant_not_agent",
15
+ "capability_mismatch",
16
+ "group_mismatch",
17
+ "invalid_stage_key",
18
+ "non_agent_stage_key",
19
+ "duplicate_live_owner",
20
+ ] as const;
21
+
22
+ export type LiveWorkflowStageRouteRefusalCode = (typeof LIVE_WORKFLOW_STAGE_ROUTE_REFUSAL_CODES)[number];
23
+
24
+ export const LIVE_WORKFLOW_STAGE_ROUTE_REFUSAL_REASONS: Readonly<Record<LiveWorkflowStageRouteRefusalCode, string>> = {
25
+ owner_missing: "Live workflow-stage route has no registered workflow owner",
26
+ owner_not_workflow: "Live workflow-stage route owner is not registered under a workflow invocation group",
27
+ registrant_not_agent: "Live workflow-stage route registrant is not an agent session",
28
+ capability_mismatch: "Live workflow-stage route capability does not match the workflow owner",
29
+ group_mismatch: "Live workflow-stage route registrant is outside the workflow invocation group",
30
+ invalid_stage_key: "Live workflow-stage route keys must be single path segments",
31
+ non_agent_stage_key: "Live workflow-stage route keys name a non-agent workflow node",
32
+ duplicate_live_owner: "Live workflow-stage route is owned by another active session",
33
+ };
34
+
35
+ /**
36
+ * Refusals that a later attempt can legitimately clear without any change on
37
+ * the registrant's side: the owner is re-registering its pending route after a
38
+ * broker reconnect, or the previous attempt's session has not yet been torn
39
+ * down at the broker. Every other code reflects a configuration or authority
40
+ * mismatch that repeats identically on retry.
41
+ */
42
+ const TRANSIENT_REFUSAL_CODES: ReadonlySet<LiveWorkflowStageRouteRefusalCode> = new Set([
43
+ "owner_missing",
44
+ "duplicate_live_owner",
45
+ ]);
46
+
47
+ export function isLiveWorkflowStageRouteRefusalCode(value: unknown): value is LiveWorkflowStageRouteRefusalCode {
48
+ return (
49
+ typeof value === "string" &&
50
+ (LIVE_WORKFLOW_STAGE_ROUTE_REFUSAL_CODES as readonly string[]).includes(value)
51
+ );
52
+ }
53
+
54
+ export function isTransientLiveWorkflowStageRouteRefusal(code: LiveWorkflowStageRouteRefusalCode): boolean {
55
+ return TRANSIENT_REFUSAL_CODES.has(code);
56
+ }
57
+
58
+ /** Broker refusal of a live workflow-stage route registration, classified by construction. */
59
+ export class IntercomLiveRouteRefusedError extends Error {
60
+ readonly code: LiveWorkflowStageRouteRefusalCode;
61
+ readonly transient: boolean;
62
+
63
+ constructor(code: LiveWorkflowStageRouteRefusalCode, reason: string = LIVE_WORKFLOW_STAGE_ROUTE_REFUSAL_REASONS[code]) {
64
+ super(reason);
65
+ this.name = "IntercomLiveRouteRefusedError";
66
+ this.code = code;
67
+ this.transient = isTransientLiveWorkflowStageRouteRefusal(code);
68
+ }
69
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/intercom",
3
- "version": "0.9.20-alpha.4",
3
+ "version": "0.9.20-alpha.6",
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": [
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@bastani/atomic": "*",
47
- "@earendil-works/pi-tui": "^0.86.1"
47
+ "@earendil-works/pi-tui": "^0.87.0"
48
48
  },
49
49
  "peerDependenciesMeta": {
50
50
  "@bastani/atomic": {
@@ -9,11 +9,19 @@
9
9
  * Explicit, user-initiated operations keep rejecting visibly.
10
10
  *
11
11
  * Classification is by construction, never by message text. Only errors this
12
- * module creates carry the marker, so an identically worded error raised
13
- * anywhere else — and every protocol, authentication, configuration, or
14
- * non-recoverable initialization failure — stays actionable.
12
+ * module or `live-route-refusal.ts` create carry the marker, so an identically
13
+ * worded error raised anywhere else — and every protocol, authentication,
14
+ * configuration, or non-recoverable initialization failure — stays actionable.
15
+ *
16
+ * A broker refusal of a live workflow-stage route ends the socket too. When its
17
+ * code is transient (the workflow owner is re-registering after its own
18
+ * reconnect, or the previous attempt's session is still being torn down), the
19
+ * same bounded retry that recovers a lost socket clears it (#3163). A refusal
20
+ * whose code repeats identically on retry is not recoverable.
15
21
  */
16
22
 
23
+ import { IntercomLiveRouteRefusedError } from "./live-route-refusal.js";
24
+
17
25
  /** Transport diagnosis. Delivery tools own bounded recovery, not their callers. */
18
26
  export const RECOVERABLE_DISCONNECT_MESSAGE = "Client disconnected";
19
27
 
@@ -39,12 +47,16 @@ export class IntercomClientDisconnectedError extends Error implements Recoverabl
39
47
  }
40
48
  }
41
49
 
42
- /** True only for an `IntercomClientDisconnectedError`, directly or as a bounded `cause` ancestor. */
50
+ /**
51
+ * True for an `IntercomClientDisconnectedError` or a transient
52
+ * `IntercomLiveRouteRefusedError`, directly or as a bounded `cause` ancestor.
53
+ */
43
54
  export function isRecoverableIntercomDisconnect(error: unknown): boolean {
44
55
  let current: unknown = error;
45
56
  for (let depth = 0; depth <= MAX_CAUSE_DEPTH; depth += 1) {
46
57
  if (!(current instanceof Error)) return false;
47
58
  if (current instanceof IntercomClientDisconnectedError) return true;
59
+ if (current instanceof IntercomLiveRouteRefusedError) return current.transient;
48
60
  current = current.cause;
49
61
  }
50
62
  return false;