@bastani/atomic 0.9.20-alpha.7 → 0.9.20-alpha.9

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 (315) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/builtin/intercom/package.json +3 -5
  3. package/dist/builtin/mcp/package.json +3 -3
  4. package/dist/builtin/subagents/CHANGELOG.md +6 -0
  5. package/dist/builtin/subagents/package.json +3 -3
  6. package/dist/builtin/subagents/src/extension/index.bundle.mjs +11 -2
  7. package/dist/builtin/web-access/package.json +1 -1
  8. package/dist/builtin/workflows/CHANGELOG.md +37 -0
  9. package/dist/builtin/workflows/builtin/adversarial-verification.js +3 -3
  10. package/dist/builtin/workflows/builtin/{chunk-ffdrv23t.js → chunk-18yz7r43.js} +1 -1
  11. package/dist/builtin/workflows/builtin/{chunk-9z3ztr2a.js → chunk-1pd5zcfa.js} +1 -1
  12. package/dist/builtin/workflows/builtin/{chunk-5724b0cf.js → chunk-24c235x7.js} +1 -1
  13. package/dist/builtin/workflows/builtin/{chunk-vn0wb31x.js → chunk-2jv44yz7.js} +1 -1
  14. package/dist/builtin/workflows/builtin/{chunk-hmt5w62g.js → chunk-2npg6daz.js} +1 -1
  15. package/dist/builtin/workflows/builtin/{chunk-njmf5ze7.js → chunk-7ps7bnb4.js} +1 -1
  16. package/dist/builtin/workflows/builtin/{chunk-jngsbbpm.js → chunk-ad864596.js} +3 -3
  17. package/dist/builtin/workflows/builtin/{chunk-7n51c5gh.js → chunk-f8jjd90r.js} +1 -1
  18. package/dist/builtin/workflows/builtin/{chunk-3tx8ry44.js → chunk-gxrhbnaj.js} +2 -1
  19. package/dist/builtin/workflows/builtin/{chunk-2hzrv5y8.js → chunk-twefqrv0.js} +986 -199
  20. package/dist/builtin/workflows/builtin/{chunk-7bzcersz.js → chunk-ynded223.js} +3 -3
  21. package/dist/builtin/workflows/builtin/{chunk-dxjxtgmp.js → chunk-z5xdqrs6.js} +1 -1
  22. package/dist/builtin/workflows/builtin/classify-and-act.js +3 -3
  23. package/dist/builtin/workflows/builtin/fan-out-and-synthesize.js +3 -3
  24. package/dist/builtin/workflows/builtin/generate-and-filter.js +3 -3
  25. package/dist/builtin/workflows/builtin/goal.js +4 -4
  26. package/dist/builtin/workflows/builtin/index.js +12 -12
  27. package/dist/builtin/workflows/builtin/loop-until-done.js +3 -3
  28. package/dist/builtin/workflows/builtin/open-claude-design.js +3 -3
  29. package/dist/builtin/workflows/builtin/ralph.js +4 -4
  30. package/dist/builtin/workflows/builtin/steering-context.js +1 -1
  31. package/dist/builtin/workflows/builtin/tournament.js +3 -3
  32. package/dist/builtin/workflows/package.json +4 -4
  33. package/dist/builtin/workflows/src/authoring.d.ts +6 -3
  34. package/dist/builtin/workflows/src/extension/index.bundle.mjs +26991 -26238
  35. package/dist/builtin/workflows/src/index.js +41619 -12907
  36. package/dist/builtin/workflows/src/shared/authoring-contract-ui.d.ts +13 -0
  37. package/dist/core/agent-session-boundaries.d.ts.map +1 -1
  38. package/dist/core/agent-session-boundaries.js +9 -4
  39. package/dist/core/agent-session-boundaries.js.map +1 -1
  40. package/dist/core/agent-session-events.d.ts.map +1 -1
  41. package/dist/core/agent-session-events.js +4 -0
  42. package/dist/core/agent-session-events.js.map +1 -1
  43. package/dist/core/agent-session-methods.d.ts +3 -0
  44. package/dist/core/agent-session-methods.d.ts.map +1 -1
  45. package/dist/core/agent-session-methods.js.map +1 -1
  46. package/dist/core/agent-session-tasks.js +4 -4
  47. package/dist/core/agent-session-tasks.js.map +1 -1
  48. package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
  49. package/dist/core/agent-session-tool-registry.js +4 -3
  50. package/dist/core/agent-session-tool-registry.js.map +1 -1
  51. package/dist/core/agent-session.d.ts +3 -0
  52. package/dist/core/agent-session.d.ts.map +1 -1
  53. package/dist/core/agent-session.js +3 -0
  54. package/dist/core/agent-session.js.map +1 -1
  55. package/dist/core/cache-stats.d.ts +7 -1
  56. package/dist/core/cache-stats.d.ts.map +1 -1
  57. package/dist/core/cache-stats.js +24 -5
  58. package/dist/core/cache-stats.js.map +1 -1
  59. package/dist/core/execution-model-router.d.ts +1 -1
  60. package/dist/core/execution-model-router.d.ts.map +1 -1
  61. package/dist/core/execution-model-router.js +23 -14
  62. package/dist/core/execution-model-router.js.map +1 -1
  63. package/dist/core/extensions/agent-events.d.ts +9 -1
  64. package/dist/core/extensions/agent-events.d.ts.map +1 -1
  65. package/dist/core/extensions/agent-events.js.map +1 -1
  66. package/dist/core/extensions/api-types.d.ts +2 -1
  67. package/dist/core/extensions/api-types.d.ts.map +1 -1
  68. package/dist/core/extensions/api-types.js.map +1 -1
  69. package/dist/core/extensions/event-types.d.ts +2 -2
  70. package/dist/core/extensions/event-types.d.ts.map +1 -1
  71. package/dist/core/extensions/event-types.js.map +1 -1
  72. package/dist/core/extensions/index.d.ts +1 -1
  73. package/dist/core/extensions/index.d.ts.map +1 -1
  74. package/dist/core/extensions/index.js.map +1 -1
  75. package/dist/core/extensions/loader-core.d.ts.map +1 -1
  76. package/dist/core/extensions/loader-core.js +1 -0
  77. package/dist/core/extensions/loader-core.js.map +1 -1
  78. package/dist/core/extensions/provider-types.d.ts +34 -16
  79. package/dist/core/extensions/provider-types.d.ts.map +1 -1
  80. package/dist/core/extensions/provider-types.js.map +1 -1
  81. package/dist/core/extensions/runtime-types.d.ts +4 -0
  82. package/dist/core/extensions/runtime-types.d.ts.map +1 -1
  83. package/dist/core/extensions/runtime-types.js.map +1 -1
  84. package/dist/core/extensions/tool-types.d.ts +9 -0
  85. package/dist/core/extensions/tool-types.d.ts.map +1 -1
  86. package/dist/core/extensions/tool-types.js.map +1 -1
  87. package/dist/core/fast-model-routing.d.ts.map +1 -1
  88. package/dist/core/fast-model-routing.js +1 -0
  89. package/dist/core/fast-model-routing.js.map +1 -1
  90. package/dist/core/fast-model-variants.d.ts +10 -0
  91. package/dist/core/fast-model-variants.d.ts.map +1 -1
  92. package/dist/core/fast-model-variants.js +13 -1
  93. package/dist/core/fast-model-variants.js.map +1 -1
  94. package/dist/core/model-registry.d.ts +3 -1
  95. package/dist/core/model-registry.d.ts.map +1 -1
  96. package/dist/core/model-registry.js +6 -0
  97. package/dist/core/model-registry.js.map +1 -1
  98. package/dist/core/model-runtime-auth.d.ts +2 -2
  99. package/dist/core/model-runtime-auth.d.ts.map +1 -1
  100. package/dist/core/model-runtime-auth.js.map +1 -1
  101. package/dist/core/model-runtime-streaming.d.ts.map +1 -1
  102. package/dist/core/model-runtime-streaming.js +2 -1
  103. package/dist/core/model-runtime-streaming.js.map +1 -1
  104. package/dist/core/model-runtime.d.ts +11 -3
  105. package/dist/core/model-runtime.d.ts.map +1 -1
  106. package/dist/core/model-runtime.js +41 -6
  107. package/dist/core/model-runtime.js.map +1 -1
  108. package/dist/core/package-manager-npm.d.ts.map +1 -1
  109. package/dist/core/package-manager-npm.js +32 -8
  110. package/dist/core/package-manager-npm.js.map +1 -1
  111. package/dist/core/package-manager-resolver.js +3 -1
  112. package/dist/core/package-manager-resolver.js.map +1 -1
  113. package/dist/core/package-manager-types.d.ts +1 -0
  114. package/dist/core/package-manager-types.d.ts.map +1 -1
  115. package/dist/core/package-manager-types.js.map +1 -1
  116. package/dist/core/provider-composer-internal.d.ts +40 -21
  117. package/dist/core/provider-composer-internal.d.ts.map +1 -1
  118. package/dist/core/provider-composer-internal.js +22 -20
  119. package/dist/core/provider-composer-internal.js.map +1 -1
  120. package/dist/core/provider-composer.d.ts +3 -3
  121. package/dist/core/provider-composer.d.ts.map +1 -1
  122. package/dist/core/provider-composer.js +54 -10
  123. package/dist/core/provider-composer.js.map +1 -1
  124. package/dist/core/remote-catalog-provider.d.ts +8 -1
  125. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  126. package/dist/core/remote-catalog-provider.js +46 -4
  127. package/dist/core/remote-catalog-provider.js.map +1 -1
  128. package/dist/core/resource-loader-core.d.ts.map +1 -1
  129. package/dist/core/resource-loader-core.js +7 -3
  130. package/dist/core/resource-loader-core.js.map +1 -1
  131. package/dist/core/resource-loader-extension-warnings.d.ts +9 -0
  132. package/dist/core/resource-loader-extension-warnings.d.ts.map +1 -0
  133. package/dist/core/resource-loader-extension-warnings.js +54 -0
  134. package/dist/core/resource-loader-extension-warnings.js.map +1 -0
  135. package/dist/core/resource-loader-extensions.d.ts.map +1 -1
  136. package/dist/core/resource-loader-extensions.js +1 -0
  137. package/dist/core/resource-loader-extensions.js.map +1 -1
  138. package/dist/core/resource-loader-reload.d.ts.map +1 -1
  139. package/dist/core/resource-loader-reload.js +6 -0
  140. package/dist/core/resource-loader-reload.js.map +1 -1
  141. package/dist/core/runtime-credentials.d.ts.map +1 -1
  142. package/dist/core/runtime-credentials.js +3 -1
  143. package/dist/core/runtime-credentials.js.map +1 -1
  144. package/dist/core/sdk.js +16 -6
  145. package/dist/core/sdk.js.map +1 -1
  146. package/dist/core/settings-manager-basic-accessors.js +4 -4
  147. package/dist/core/settings-manager-basic-accessors.js.map +1 -1
  148. package/dist/core/skill-catalog.d.ts.map +1 -1
  149. package/dist/core/skill-catalog.js +18 -6
  150. package/dist/core/skill-catalog.js.map +1 -1
  151. package/dist/core/structured-output/choice-schema.d.ts +8 -0
  152. package/dist/core/structured-output/choice-schema.d.ts.map +1 -0
  153. package/dist/core/structured-output/choice-schema.js +79 -0
  154. package/dist/core/structured-output/choice-schema.js.map +1 -0
  155. package/dist/core/structured-output/index.d.ts +3 -5
  156. package/dist/core/structured-output/index.d.ts.map +1 -1
  157. package/dist/core/structured-output/index.js +218 -41
  158. package/dist/core/structured-output/index.js.map +1 -1
  159. package/dist/core/structured-output/resolver.d.ts +0 -46
  160. package/dist/core/structured-output/resolver.d.ts.map +1 -1
  161. package/dist/core/structured-output/resolver.js +15 -93
  162. package/dist/core/structured-output/resolver.js.map +1 -1
  163. package/dist/core/structured-output/types.d.ts +27 -21
  164. package/dist/core/structured-output/types.d.ts.map +1 -1
  165. package/dist/core/structured-output/types.js.map +1 -1
  166. package/dist/core/system-prompt.d.ts.map +1 -1
  167. package/dist/core/system-prompt.js +9 -1
  168. package/dist/core/system-prompt.js.map +1 -1
  169. package/dist/core/tasks/owner-store.d.ts +6 -0
  170. package/dist/core/tasks/owner-store.d.ts.map +1 -1
  171. package/dist/core/tasks/owner-store.js +16 -3
  172. package/dist/core/tasks/owner-store.js.map +1 -1
  173. package/dist/core/tasks/pause.js +1 -1
  174. package/dist/core/tasks/pause.js.map +1 -1
  175. package/dist/core/tasks/supervisor.d.ts +4 -2
  176. package/dist/core/tasks/supervisor.d.ts.map +1 -1
  177. package/dist/core/tasks/supervisor.js +9 -3
  178. package/dist/core/tasks/supervisor.js.map +1 -1
  179. package/dist/core/tools/ask-user-question/ask-user-question.d.ts.map +1 -1
  180. package/dist/core/tools/ask-user-question/ask-user-question.js +1 -0
  181. package/dist/core/tools/ask-user-question/ask-user-question.js.map +1 -1
  182. package/dist/core/tools/bash.d.ts.map +1 -1
  183. package/dist/core/tools/bash.js +16 -13
  184. package/dist/core/tools/bash.js.map +1 -1
  185. package/dist/core/tools/edit.d.ts.map +1 -1
  186. package/dist/core/tools/edit.js +1 -0
  187. package/dist/core/tools/edit.js.map +1 -1
  188. package/dist/core/tools/file-mutation-coordinator.d.ts +4 -3
  189. package/dist/core/tools/file-mutation-coordinator.d.ts.map +1 -1
  190. package/dist/core/tools/file-mutation-coordinator.js +45 -38
  191. package/dist/core/tools/file-mutation-coordinator.js.map +1 -1
  192. package/dist/core/tools/powershell.d.ts +16 -0
  193. package/dist/core/tools/powershell.d.ts.map +1 -1
  194. package/dist/core/tools/structured-output.d.ts +9 -6
  195. package/dist/core/tools/structured-output.d.ts.map +1 -1
  196. package/dist/core/tools/structured-output.js +36 -8
  197. package/dist/core/tools/structured-output.js.map +1 -1
  198. package/dist/core/tools/todos.d.ts.map +1 -1
  199. package/dist/core/tools/todos.js +1 -0
  200. package/dist/core/tools/todos.js.map +1 -1
  201. package/dist/core/tools/tool-concurrency.d.ts +23 -0
  202. package/dist/core/tools/tool-concurrency.d.ts.map +1 -0
  203. package/dist/core/tools/tool-concurrency.js +58 -0
  204. package/dist/core/tools/tool-concurrency.js.map +1 -0
  205. package/dist/core/tools/tool-definition-wrapper.d.ts +4 -1
  206. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  207. package/dist/core/tools/tool-definition-wrapper.js +2 -0
  208. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  209. package/dist/core/tools/write.d.ts.map +1 -1
  210. package/dist/core/tools/write.js +1 -0
  211. package/dist/core/tools/write.js.map +1 -1
  212. package/dist/index-extensions.d.ts +1 -1
  213. package/dist/index-extensions.d.ts.map +1 -1
  214. package/dist/index-extensions.js.map +1 -1
  215. package/dist/index.d.ts +2 -2
  216. package/dist/index.d.ts.map +1 -1
  217. package/dist/index.js +2 -2
  218. package/dist/index.js.map +1 -1
  219. package/dist/main.d.ts.map +1 -1
  220. package/dist/main.js +4 -0
  221. package/dist/main.js.map +1 -1
  222. package/dist/modes/interactive/components/atomic-banner.d.ts.map +1 -1
  223. package/dist/modes/interactive/components/atomic-banner.js +3 -2
  224. package/dist/modes/interactive/components/atomic-banner.js.map +1 -1
  225. package/dist/modes/interactive/components/settings-selector-items.d.ts.map +1 -1
  226. package/dist/modes/interactive/components/settings-selector-items.js +11 -9
  227. package/dist/modes/interactive/components/settings-selector-items.js.map +1 -1
  228. package/dist/modes/interactive/components/settings-selector-types.d.ts +2 -1
  229. package/dist/modes/interactive/components/settings-selector-types.d.ts.map +1 -1
  230. package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
  231. package/dist/modes/interactive/components/startup-identity.d.ts +3 -0
  232. package/dist/modes/interactive/components/startup-identity.d.ts.map +1 -1
  233. package/dist/modes/interactive/components/startup-identity.js +11 -2
  234. package/dist/modes/interactive/components/startup-identity.js.map +1 -1
  235. package/dist/modes/interactive/components/task-inspector.d.ts +1 -0
  236. package/dist/modes/interactive/components/task-inspector.d.ts.map +1 -1
  237. package/dist/modes/interactive/components/task-inspector.js +11 -11
  238. package/dist/modes/interactive/components/task-inspector.js.map +1 -1
  239. package/dist/modes/interactive/components/task-list.d.ts +9 -3
  240. package/dist/modes/interactive/components/task-list.d.ts.map +1 -1
  241. package/dist/modes/interactive/components/task-list.js +26 -2
  242. package/dist/modes/interactive/components/task-list.js.map +1 -1
  243. package/dist/modes/interactive/interactive-agent-events.js +3 -9
  244. package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
  245. package/dist/modes/interactive/interactive-auth-login.js +1 -1
  246. package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
  247. package/dist/modes/interactive/interactive-render-chat.js +3 -9
  248. package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
  249. package/dist/modes/interactive/interactive-resource-rendering.js +6 -9
  250. package/dist/modes/interactive/interactive-resource-rendering.js.map +1 -1
  251. package/dist/modes/interactive/interactive-selectors.js +1 -0
  252. package/dist/modes/interactive/interactive-selectors.js.map +1 -1
  253. package/dist/modes/interactive/interactive-slash-commands.js +2 -4
  254. package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
  255. package/dist/modes/interactive/interactive-tui.d.ts.map +1 -1
  256. package/dist/modes/interactive/interactive-tui.js +2 -0
  257. package/dist/modes/interactive/interactive-tui.js.map +1 -1
  258. package/dist/modes/interactive/overlay-line-composite.d.ts +7 -0
  259. package/dist/modes/interactive/overlay-line-composite.d.ts.map +1 -0
  260. package/dist/modes/interactive/overlay-line-composite.js +24 -0
  261. package/dist/modes/interactive/overlay-line-composite.js.map +1 -0
  262. package/dist/modes/interactive-engine/isolated-runtime.d.ts +1 -0
  263. package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
  264. package/dist/modes/interactive-engine/isolated-runtime.js +5 -0
  265. package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
  266. package/dist/utils/child-process.d.ts +1 -0
  267. package/dist/utils/child-process.d.ts.map +1 -1
  268. package/dist/utils/child-process.js +7 -8
  269. package/dist/utils/child-process.js.map +1 -1
  270. package/dist/utils/clipboard-image.d.ts.map +1 -1
  271. package/dist/utils/clipboard-image.js +14 -17
  272. package/dist/utils/clipboard-image.js.map +1 -1
  273. package/dist/utils/shell.d.ts.map +1 -1
  274. package/dist/utils/shell.js +18 -1
  275. package/dist/utils/shell.js.map +1 -1
  276. package/docs/background-tasks.md +1 -0
  277. package/docs/computer-use.md +2 -2
  278. package/docs/custom-provider/registration.md +1 -1
  279. package/docs/custom-provider.md +43 -1
  280. package/docs/extensions/authoring.md +22 -3
  281. package/docs/extensions/events.md +18 -0
  282. package/docs/extensions/examples.md +1 -0
  283. package/docs/models/evals.md +31 -79
  284. package/docs/models/model-selection.md +5 -1
  285. package/docs/packages/authoring.md +3 -1
  286. package/docs/providers.md +11 -12
  287. package/docs/sdk/reference.md +18 -42
  288. package/docs/sdk/structured-decisions.md +44 -89
  289. package/docs/sdk.md +1 -1
  290. package/docs/settings.md +6 -6
  291. package/docs/subagents/reference.md +7 -8
  292. package/docs/usage.md +13 -0
  293. package/docs/workflows/api-reference.md +38 -35
  294. package/docs/workflows/authoring.md +113 -1
  295. package/docs/workflows/builtins.md +1 -1
  296. package/docs/workflows/operations.md +51 -29
  297. package/docs/workflows/verification.md +13 -0
  298. package/examples/extensions/README.md +1 -0
  299. package/examples/extensions/debug-provider.ts +90 -0
  300. package/examples/extensions/structured-output.ts +6 -0
  301. package/npm-shrinkwrap.json +32 -32
  302. package/package.json +3 -3
  303. package/dist/builtin/workflows/src/durable/dependency-doctor-types.d.ts +0 -42
  304. package/dist/core/decision-provider.d.ts +0 -4
  305. package/dist/core/decision-provider.d.ts.map +0 -1
  306. package/dist/core/decision-provider.js +0 -12
  307. package/dist/core/decision-provider.js.map +0 -1
  308. package/dist/core/structured-output/jev-client.d.ts +0 -25
  309. package/dist/core/structured-output/jev-client.d.ts.map +0 -1
  310. package/dist/core/structured-output/jev-client.js +0 -174
  311. package/dist/core/structured-output/jev-client.js.map +0 -1
  312. package/dist/core/structured-output/jev.d.ts +0 -5
  313. package/dist/core/structured-output/jev.d.ts.map +0 -1
  314. package/dist/core/structured-output/jev.js +0 -249
  315. package/dist/core/structured-output/jev.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/utils/shell.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACpC;AAsDD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,WAAW,CAqDpE;AAED,eAAO,MAAM,eAAe,YAAI,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,QAAQ,EAAE,UAAU,CAAU,CAAC;AAEpH,wBAAgB,mBAAmB,IAAI,WAAW,CAKjD;AAED,wBAAgB,qBAAqB,IAAI,OAAO,CAO/C;AAED,wBAAgB,WAAW,IAAI,MAAM,CAAC,UAAU,CAY/C;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA8BxD;AA4CD,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAcpG;AAQD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAGvD;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAGzD;AAED,wBAAgB,2BAA2B,IAAI,IAAI,CAMlD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAmCjD"}
1
+ {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/utils/shell.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,WAAW;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACpC;AA+ED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,WAAW,CAqDpE;AAED,eAAO,MAAM,eAAe,YAAI,YAAY,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,QAAQ,EAAE,UAAU,CAAU,CAAC;AAEpH,wBAAgB,mBAAmB,IAAI,WAAW,CAKjD;AAED,wBAAgB,qBAAqB,IAAI,OAAO,CAO/C;AAED,wBAAgB,WAAW,IAAI,MAAM,CAAC,UAAU,CAY/C;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA8BxD;AA4CD,wBAAgB,0BAA0B,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAcpG;AAQD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAGvD;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAGzD;AAED,wBAAgB,2BAA2B,IAAI,IAAI,CAMlD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAmCjD"}
@@ -11,10 +11,27 @@ function isLegacyWslBashPath(path) {
11
11
  function getBashShellConfig(shell) {
12
12
  return isLegacyWslBashPath(shell) ? { shell, args: ["-s"], commandTransport: "stdin" } : { shell, args: ["-c"] };
13
13
  }
14
+ const MISSING_EXECUTABLE_RECHECK_MS = 30_000;
15
+ const executablePathLookups = new Map();
16
+ function isReusableLookup(lookup) {
17
+ return lookup.path === null
18
+ ? Date.now() - lookup.checkedAt < MISSING_EXECUTABLE_RECHECK_MS
19
+ : existsSync(lookup.path);
20
+ }
14
21
  /**
15
- * Find bash executable on PATH (cross-platform)
22
+ * Find an executable on PATH (cross-platform), memoized per PATH value.
23
+ * A missing executable is looked up again once its result is 30 seconds old.
16
24
  */
17
25
  function findExecutableOnPath(executable) {
26
+ const key = `${executable}\0${process.env.PATH ?? ""}`;
27
+ const cached = executablePathLookups.get(key);
28
+ if (cached && isReusableLookup(cached))
29
+ return cached.path;
30
+ const path = lookupExecutableOnPath(executable);
31
+ executablePathLookups.set(key, { path, checkedAt: Date.now() });
32
+ return path;
33
+ }
34
+ function lookupExecutableOnPath(executable) {
18
35
  if (process.platform === "win32") {
19
36
  // Windows: Use 'where' and verify file exists (where can return non-existent paths)
20
37
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/utils/shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAQnE,SAAS,mBAAmB,CAAC,IAAY;IACxC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;IAC3D,OAAO,sDAAsD,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAa;IACxC,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,gBAAgB,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,CA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AC,CAAC;QAC/B,CAAC;QAAC,MAAM,CAAC;YACR,iEAAiE;YACjE,IAAI,CAAC;gBACJ,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;YAC9B,CAAC;YAAC,MAAM,CAAC;gBACR,uBAAuB;YACxB,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["import { existsSync } from \"node:fs\";\nimport { delimiter, join } from \"node:path\";\nimport { Worker } from \"node:worker_threads\";\nimport { spawn, spawnSync } from \"child_process\";\nimport { getBinDir } from \"../config.js\";\nimport { createChildProcessEnvironment } from \"./child-process.ts\";\n\nexport interface ShellConfig {\n\tshell: string;\n\targs: string[];\n\tcommandTransport?: \"argv\" | \"stdin\";\n}\n\nfunction isLegacyWslBashPath(path: string): boolean {\n\tconst normalized = path.replace(/\\//g, \"\\\\\").toLowerCase();\n\treturn /^[a-z]:\\\\windows\\\\(?:system32|sysnative)\\\\bash\\.exe$/.test(normalized);\n}\n\nfunction getBashShellConfig(shell: string): ShellConfig {\n\treturn isLegacyWslBashPath(shell) ? { shell, args: [\"-s\"], commandTransport: \"stdin\" } : { shell, args: [\"-c\"] };\n}\n\n/**\n * Find bash executable on PATH (cross-platform)\n */\nfunction findExecutableOnPath(executable: string): string | null {\n\tif (process.platform === \"win32\") {\n\t\t// Windows: Use 'where' and verify file exists (where can return non-existent paths)\n\t\ttry {\n\t\t\tconst result = spawnSync(\"where\", [executable], {\n\t\t\t\tencoding: \"utf-8\",\n\t\t\t\ttimeout: 5000,\n\t\t\t\tenv: createChildProcessEnvironment(),\n\t\t\t});\n\t\t\tif (result.status === 0 && result.stdout) {\n\t\t\t\tconst firstMatch = result.stdout.trim().split(/\\r?\\n/)[0];\n\t\t\t\tif (firstMatch && existsSync(firstMatch)) {\n\t\t\t\t\treturn firstMatch;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {\n\t\t\t// Ignore errors\n\t\t}\n\t\treturn null;\n\t}\n\n\t// Unix: Use 'which' and trust its output (handles Termux and special filesystems)\n\ttry {\n\t\tconst result = spawnSync(\"which\", [executable], {\n\t\t\tencoding: \"utf-8\",\n\t\t\ttimeout: 5000,\n\t\t\tenv: createChildProcessEnvironment(),\n\t\t});\n\t\tif (result.status === 0 && result.stdout) {\n\t\t\tconst firstMatch = result.stdout.trim().split(/\\r?\\n/)[0];\n\t\t\tif (firstMatch) {\n\t\t\t\treturn firstMatch;\n\t\t\t}\n\t\t}\n\t} catch {\n\t\t// Ignore errors\n\t}\n\treturn null;\n}\n\n/**\n * Resolve shell configuration based on platform and an optional explicit shell path.\n * Resolution order:\n * 1. User-specified shellPath\n * 2. On Windows: Git Bash in known locations, then bash on PATH\n * 3. On Unix: /bin/bash, then bash on PATH, then fallback to sh\n */\nexport function getShellConfig(customShellPath?: string): ShellConfig {\n\t// 1. Check user-specified shell path\n\tif (customShellPath) {\n\t\tif (existsSync(customShellPath)) {\n\t\t\treturn getBashShellConfig(customShellPath);\n\t\t}\n\t\tthrow new Error(`Custom shell path not found: ${customShellPath}`);\n\t}\n\n\tif (process.platform === \"win32\") {\n\t\t// 2. Try Git Bash in known locations\n\t\tconst paths: string[] = [];\n\t\tconst programFiles = process.env.ProgramFiles;\n\t\tif (programFiles) {\n\t\t\tpaths.push(`${programFiles}\\\\Git\\\\bin\\\\bash.exe`);\n\t\t}\n\t\tconst programFilesX86 = process.env[\"ProgramFiles(x86)\"];\n\t\tif (programFilesX86) {\n\t\t\tpaths.push(`${programFilesX86}\\\\Git\\\\bin\\\\bash.exe`);\n\t\t}\n\n\t\tfor (const path of paths) {\n\t\t\tif (existsSync(path)) {\n\t\t\t\treturn getBashShellConfig(path);\n\t\t\t}\n\t\t}\n\n\t\t// 3. Fallback: search bash.exe on PATH (Cygwin, MSYS2, WSL, etc.)\n\t\tconst bashOnPath = findExecutableOnPath(\"bash.exe\");\n\t\tif (bashOnPath) {\n\t\t\treturn getBashShellConfig(bashOnPath);\n\t\t}\n\n\t\tthrow new Error(\n\t\t\t`No bash shell found. Options:\\n` +\n\t\t\t\t` 1. Install Git for Windows: https://git-scm.com/download/win\\n` +\n\t\t\t\t` 2. Add your bash to PATH (Cygwin, MSYS2, etc.)\\n` +\n\t\t\t\t\" 3. Set shellPath in settings.json\\n\\n\" +\n\t\t\t\t`Searched Git Bash in:\\n${paths.map((p) => ` ${p}`).join(\"\\n\")}`,\n\t\t);\n\t}\n\n\t// Unix: try /bin/bash, then bash on PATH, then fallback to sh\n\tif (existsSync(\"/bin/bash\")) {\n\t\treturn getBashShellConfig(\"/bin/bash\");\n\t}\n\n\tconst bashOnPath = findExecutableOnPath(\"bash\");\n\tif (bashOnPath) {\n\t\treturn getBashShellConfig(bashOnPath);\n\t}\n\n\treturn { shell: \"sh\", args: [\"-c\"] };\n}\n\nexport const POWERSHELL_ARGS = [\"-NoProfile\", \"-NonInteractive\", \"-ExecutionPolicy\", \"Bypass\", \"-Command\"] as const;\n\nexport function getPowerShellConfig(): ShellConfig {\n\tif (process.platform !== \"win32\") throw new Error(\"The powershell tool is only available on Windows.\");\n\tconst shell = findExecutableOnPath(\"pwsh.exe\") ?? findExecutableOnPath(\"powershell.exe\");\n\tif (!shell) throw new Error(\"No PowerShell executable found. Install PowerShell or add it to PATH.\");\n\treturn { shell, args: [...POWERSHELL_ARGS] };\n}\n\nexport function isPowerShellAvailable(): boolean {\n\ttry {\n\t\tgetPowerShellConfig();\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function getShellEnv(): NodeJS.ProcessEnv {\n\tconst binDir = getBinDir();\n\tconst pathKey = Object.keys(process.env).find((key) => key.toLowerCase() === \"path\") ?? \"PATH\";\n\tconst currentPath = process.env[pathKey] ?? \"\";\n\tconst pathEntries = currentPath.split(delimiter).filter(Boolean);\n\tconst hasBinDir = pathEntries.includes(binDir);\n\tconst updatedPath = hasBinDir ? currentPath : [binDir, currentPath].filter(Boolean).join(delimiter);\n\n\treturn {\n\t\t...process.env,\n\t\t[pathKey]: updatedPath,\n\t};\n}\n\n/**\n * Sanitize binary output for display/storage.\n * Removes characters that crash string-width or cause display issues:\n * - Control characters (except tab, newline, carriage return)\n * - Lone surrogates\n * - Unicode Format characters (crash string-width due to a bug)\n * - Characters with undefined code points\n */\nexport function sanitizeBinaryOutput(str: string): string {\n\t// Use Array.from to properly iterate over code points (not code units)\n\t// This handles surrogate pairs correctly and catches edge cases where\n\t// codePointAt() might return undefined\n\treturn Array.from(str)\n\t\t.filter((char) => {\n\t\t\t// Filter out characters that cause string-width to crash\n\t\t\t// This includes:\n\t\t\t// - Unicode format characters\n\t\t\t// - Lone surrogates (already filtered by Array.from)\n\t\t\t// - Control chars except \\t \\n \\r\n\t\t\t// - Characters with undefined code points\n\n\t\t\tconst code = char.codePointAt(0);\n\n\t\t\t// Skip if code point is undefined (edge case with invalid strings)\n\t\t\tif (code === undefined) return false;\n\n\t\t\t// Allow tab, newline, carriage return\n\t\t\tif (code === 0x09 || code === 0x0a || code === 0x0d) return true;\n\n\t\t\t// Filter out control characters (0x00-0x1F, except 0x09, 0x0a, 0x0x0d)\n\t\t\tif (code <= 0x1f) return false;\n\n\t\t\t// Filter out Unicode format characters\n\t\t\tif (code >= 0xfff9 && code <= 0xfffb) return false;\n\n\t\t\treturn true;\n\t\t})\n\t\t.join(\"\");\n}\n\ninterface DetachedChildGuardian {\n\tpostMessage(message: { action: \"track\" | \"untrack\"; pid: number }): void;\n\tterminate(): Promise<number>;\n\tunref(): void;\n}\n\nlet detachedChildGuardian: DetachedChildGuardian | undefined;\n\nconst PARENT_GUARDIAN_SOURCE = `\nconst { parentPort, workerData } = require(\"node:worker_threads\");\nconst { spawn } = require(\"node:child_process\");\nconst { existsSync } = require(\"node:fs\");\nconst { join } = require(\"node:path\");\nconst tracked = new Set();\nparentPort.on(\"message\", ({ action, pid }) => {\n if (action === \"track\") tracked.add(pid);\n else tracked.delete(pid);\n});\nfunction killTree(pid) {\n if (process.platform === \"win32\") {\n // Same System32 hardening as killProcessTree: PATH is not trusted here, and an\n // unconsumed async \"error\" from a failed spawn would take the guardian thread\n // down and leak every detached child it exists to reap.\n try {\n const child = spawn(join(process.env.SystemRoot || \"C:\\\\\\\\Windows\", \"System32\", \"taskkill.exe\"), [\"/F\", \"/T\", \"/PID\", String(pid)], { stdio: \"ignore\", detached: true, windowsHide: true, env: { ...process.env, AI_AGENT: workerData.aiAgent } });\n child.once(\"error\", () => {});\n } catch {}\n return;\n }\n try { process.kill(-pid, \"SIGKILL\"); }\n catch { try { process.kill(pid, \"SIGKILL\"); } catch {} }\n}\nconst timer = setInterval(() => {\n let parentAlive = true;\n try { process.kill(workerData.parentPid, 0); } catch { parentAlive = false; }\n if (parentAlive && (!workerData.stopFile || !existsSync(workerData.stopFile))) return;\n for (const pid of tracked) killTree(pid);\n killTree(process.pid);\n}, 50);\ntimer.unref?.();\n`;\n\nexport function startParentProcessGuardian(parentPid: number, stopFile?: string): () => Promise<void> {\n\tif (detachedChildGuardian) return async () => {};\n\tconst guardian = new Worker(PARENT_GUARDIAN_SOURCE, {\n\t\teval: true,\n\t\tworkerData: { parentPid, stopFile, aiAgent: createChildProcessEnvironment().AI_AGENT },\n\t});\n\tdetachedChildGuardian = guardian;\n\tfor (const pid of trackedDetachedChildPids) guardian.postMessage({ action: \"track\", pid });\n\tguardian.unref();\n\treturn async () => {\n\t\tif (detachedChildGuardian !== guardian) return;\n\t\tdetachedChildGuardian = undefined;\n\t\tawait guardian.terminate();\n\t};\n}\n\n/**\n * Detached child processes must be tracked so they can be killed on parent\n * shutdown signals (SIGHUP/SIGTERM).\n */\nconst trackedDetachedChildPids = new Set<number>();\n\nexport function trackDetachedChildPid(pid: number): void {\n\ttrackedDetachedChildPids.add(pid);\n\tdetachedChildGuardian?.postMessage({ action: \"track\", pid });\n}\n\nexport function untrackDetachedChildPid(pid: number): void {\n\ttrackedDetachedChildPids.delete(pid);\n\tdetachedChildGuardian?.postMessage({ action: \"untrack\", pid });\n}\n\nexport function killTrackedDetachedChildren(): void {\n\tfor (const pid of trackedDetachedChildPids) {\n\t\tkillProcessTree(pid);\n\t\tdetachedChildGuardian?.postMessage({ action: \"untrack\", pid });\n\t}\n\ttrackedDetachedChildPids.clear();\n}\n\n/**\n * Kill a process and all its children (cross-platform)\n */\nexport function killProcessTree(pid: number): void {\n\tif (process.platform === \"win32\") {\n\t\t// Use the trusted System32 executable so cleanup does not depend on PATH.\n\t\ttry {\n\t\t\tconst child = spawn(\n\t\t\t\tjoin(process.env.SystemRoot ?? \"C:\\\\Windows\", \"System32\", \"taskkill.exe\"),\n\t\t\t\t[\"/F\", \"/T\", \"/PID\", String(pid)],\n\t\t\t\t{\n\t\t\t\t\tstdio: \"ignore\",\n\t\t\t\t\tdetached: true,\n\t\t\t\t\t// `detached` gives the child its own console on Windows unless this is\n\t\t\t\t\t// set, so omitting it both flashes a window and pays for a console\n\t\t\t\t\t// allocation on every tree kill. Every other spawn in the fork sets it.\n\t\t\t\t\twindowsHide: true,\n\t\t\t\t\tenv: createChildProcessEnvironment(),\n\t\t\t\t},\n\t\t\t);\n\t\t\t// A failed spawn emits \"error\" asynchronously; consume it to avoid crashing Node.\n\t\t\tchild.once(\"error\", () => {});\n\t\t} catch {\n\t\t\t// Ignore errors if taskkill fails.\n\t\t}\n\t} else {\n\t\t// Use SIGKILL on Unix/Linux/Mac\n\t\ttry {\n\t\t\tprocess.kill(-pid, \"SIGKILL\");\n\t\t} catch {\n\t\t\t// Fallback to killing just the child if process group kill fails\n\t\t\ttry {\n\t\t\t\tprocess.kill(pid, \"SIGKILL\");\n\t\t\t} catch {\n\t\t\t\t// Process already dead\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/utils/shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CA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AE,GAAE,CAAC,CAAC,CAAC;QAC/B,CAAC;QAAC,MAAM,CAAC;YACR,mCAAmC;QACpC,CAAC;IACF,CAAC;SAAM,CAAC;QACP,gCAAgC;QAChC,IAAI,CAAC;YACJ,OAAO,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QAC/B,CAAC;QAAC,MAAM,CAAC;YACR,iEAAiE;YACjE,IAAI,CAAC;gBACJ,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;YAC9B,CAAC;YAAC,MAAM,CAAC;gBACR,uBAAuB;YACxB,CAAC;QACF,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["import { existsSync } from \"node:fs\";\nimport { delimiter, join } from \"node:path\";\nimport { Worker } from \"node:worker_threads\";\nimport { spawn, spawnSync } from \"child_process\";\nimport { getBinDir } from \"../config.js\";\nimport { createChildProcessEnvironment } from \"./child-process.ts\";\n\nexport interface ShellConfig {\n\tshell: string;\n\targs: string[];\n\tcommandTransport?: \"argv\" | \"stdin\";\n}\n\nfunction isLegacyWslBashPath(path: string): boolean {\n\tconst normalized = path.replace(/\\//g, \"\\\\\").toLowerCase();\n\treturn /^[a-z]:\\\\windows\\\\(?:system32|sysnative)\\\\bash\\.exe$/.test(normalized);\n}\n\nfunction getBashShellConfig(shell: string): ShellConfig {\n\treturn isLegacyWslBashPath(shell) ? { shell, args: [\"-s\"], commandTransport: \"stdin\" } : { shell, args: [\"-c\"] };\n}\n\nconst MISSING_EXECUTABLE_RECHECK_MS = 30_000;\n\ninterface ExecutableLookup {\n\tpath: string | null;\n\tcheckedAt: number;\n}\n\nconst executablePathLookups = new Map<string, ExecutableLookup>();\n\nfunction isReusableLookup(lookup: ExecutableLookup): boolean {\n\treturn lookup.path === null\n\t\t? Date.now() - lookup.checkedAt < MISSING_EXECUTABLE_RECHECK_MS\n\t\t: existsSync(lookup.path);\n}\n\n/**\n * Find an executable on PATH (cross-platform), memoized per PATH value.\n * A missing executable is looked up again once its result is 30 seconds old.\n */\nfunction findExecutableOnPath(executable: string): string | null {\n\tconst key = `${executable}\\0${process.env.PATH ?? \"\"}`;\n\tconst cached = executablePathLookups.get(key);\n\tif (cached && isReusableLookup(cached)) return cached.path;\n\tconst path = lookupExecutableOnPath(executable);\n\texecutablePathLookups.set(key, { path, checkedAt: Date.now() });\n\treturn path;\n}\n\nfunction lookupExecutableOnPath(executable: string): string | null {\n\tif (process.platform === \"win32\") {\n\t\t// Windows: Use 'where' and verify file exists (where can return non-existent paths)\n\t\ttry {\n\t\t\tconst result = spawnSync(\"where\", [executable], {\n\t\t\t\tencoding: \"utf-8\",\n\t\t\t\ttimeout: 5000,\n\t\t\t\tenv: createChildProcessEnvironment(),\n\t\t\t});\n\t\t\tif (result.status === 0 && result.stdout) {\n\t\t\t\tconst firstMatch = result.stdout.trim().split(/\\r?\\n/)[0];\n\t\t\t\tif (firstMatch && existsSync(firstMatch)) {\n\t\t\t\t\treturn firstMatch;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch {\n\t\t\t// Ignore errors\n\t\t}\n\t\treturn null;\n\t}\n\n\t// Unix: Use 'which' and trust its output (handles Termux and special filesystems)\n\ttry {\n\t\tconst result = spawnSync(\"which\", [executable], {\n\t\t\tencoding: \"utf-8\",\n\t\t\ttimeout: 5000,\n\t\t\tenv: createChildProcessEnvironment(),\n\t\t});\n\t\tif (result.status === 0 && result.stdout) {\n\t\t\tconst firstMatch = result.stdout.trim().split(/\\r?\\n/)[0];\n\t\t\tif (firstMatch) {\n\t\t\t\treturn firstMatch;\n\t\t\t}\n\t\t}\n\t} catch {\n\t\t// Ignore errors\n\t}\n\treturn null;\n}\n\n/**\n * Resolve shell configuration based on platform and an optional explicit shell path.\n * Resolution order:\n * 1. User-specified shellPath\n * 2. On Windows: Git Bash in known locations, then bash on PATH\n * 3. On Unix: /bin/bash, then bash on PATH, then fallback to sh\n */\nexport function getShellConfig(customShellPath?: string): ShellConfig {\n\t// 1. Check user-specified shell path\n\tif (customShellPath) {\n\t\tif (existsSync(customShellPath)) {\n\t\t\treturn getBashShellConfig(customShellPath);\n\t\t}\n\t\tthrow new Error(`Custom shell path not found: ${customShellPath}`);\n\t}\n\n\tif (process.platform === \"win32\") {\n\t\t// 2. Try Git Bash in known locations\n\t\tconst paths: string[] = [];\n\t\tconst programFiles = process.env.ProgramFiles;\n\t\tif (programFiles) {\n\t\t\tpaths.push(`${programFiles}\\\\Git\\\\bin\\\\bash.exe`);\n\t\t}\n\t\tconst programFilesX86 = process.env[\"ProgramFiles(x86)\"];\n\t\tif (programFilesX86) {\n\t\t\tpaths.push(`${programFilesX86}\\\\Git\\\\bin\\\\bash.exe`);\n\t\t}\n\n\t\tfor (const path of paths) {\n\t\t\tif (existsSync(path)) {\n\t\t\t\treturn getBashShellConfig(path);\n\t\t\t}\n\t\t}\n\n\t\t// 3. Fallback: search bash.exe on PATH (Cygwin, MSYS2, WSL, etc.)\n\t\tconst bashOnPath = findExecutableOnPath(\"bash.exe\");\n\t\tif (bashOnPath) {\n\t\t\treturn getBashShellConfig(bashOnPath);\n\t\t}\n\n\t\tthrow new Error(\n\t\t\t`No bash shell found. Options:\\n` +\n\t\t\t\t` 1. Install Git for Windows: https://git-scm.com/download/win\\n` +\n\t\t\t\t` 2. Add your bash to PATH (Cygwin, MSYS2, etc.)\\n` +\n\t\t\t\t\" 3. Set shellPath in settings.json\\n\\n\" +\n\t\t\t\t`Searched Git Bash in:\\n${paths.map((p) => ` ${p}`).join(\"\\n\")}`,\n\t\t);\n\t}\n\n\t// Unix: try /bin/bash, then bash on PATH, then fallback to sh\n\tif (existsSync(\"/bin/bash\")) {\n\t\treturn getBashShellConfig(\"/bin/bash\");\n\t}\n\n\tconst bashOnPath = findExecutableOnPath(\"bash\");\n\tif (bashOnPath) {\n\t\treturn getBashShellConfig(bashOnPath);\n\t}\n\n\treturn { shell: \"sh\", args: [\"-c\"] };\n}\n\nexport const POWERSHELL_ARGS = [\"-NoProfile\", \"-NonInteractive\", \"-ExecutionPolicy\", \"Bypass\", \"-Command\"] as const;\n\nexport function getPowerShellConfig(): ShellConfig {\n\tif (process.platform !== \"win32\") throw new Error(\"The powershell tool is only available on Windows.\");\n\tconst shell = findExecutableOnPath(\"pwsh.exe\") ?? findExecutableOnPath(\"powershell.exe\");\n\tif (!shell) throw new Error(\"No PowerShell executable found. Install PowerShell or add it to PATH.\");\n\treturn { shell, args: [...POWERSHELL_ARGS] };\n}\n\nexport function isPowerShellAvailable(): boolean {\n\ttry {\n\t\tgetPowerShellConfig();\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function getShellEnv(): NodeJS.ProcessEnv {\n\tconst binDir = getBinDir();\n\tconst pathKey = Object.keys(process.env).find((key) => key.toLowerCase() === \"path\") ?? \"PATH\";\n\tconst currentPath = process.env[pathKey] ?? \"\";\n\tconst pathEntries = currentPath.split(delimiter).filter(Boolean);\n\tconst hasBinDir = pathEntries.includes(binDir);\n\tconst updatedPath = hasBinDir ? currentPath : [binDir, currentPath].filter(Boolean).join(delimiter);\n\n\treturn {\n\t\t...process.env,\n\t\t[pathKey]: updatedPath,\n\t};\n}\n\n/**\n * Sanitize binary output for display/storage.\n * Removes characters that crash string-width or cause display issues:\n * - Control characters (except tab, newline, carriage return)\n * - Lone surrogates\n * - Unicode Format characters (crash string-width due to a bug)\n * - Characters with undefined code points\n */\nexport function sanitizeBinaryOutput(str: string): string {\n\t// Use Array.from to properly iterate over code points (not code units)\n\t// This handles surrogate pairs correctly and catches edge cases where\n\t// codePointAt() might return undefined\n\treturn Array.from(str)\n\t\t.filter((char) => {\n\t\t\t// Filter out characters that cause string-width to crash\n\t\t\t// This includes:\n\t\t\t// - Unicode format characters\n\t\t\t// - Lone surrogates (already filtered by Array.from)\n\t\t\t// - Control chars except \\t \\n \\r\n\t\t\t// - Characters with undefined code points\n\n\t\t\tconst code = char.codePointAt(0);\n\n\t\t\t// Skip if code point is undefined (edge case with invalid strings)\n\t\t\tif (code === undefined) return false;\n\n\t\t\t// Allow tab, newline, carriage return\n\t\t\tif (code === 0x09 || code === 0x0a || code === 0x0d) return true;\n\n\t\t\t// Filter out control characters (0x00-0x1F, except 0x09, 0x0a, 0x0x0d)\n\t\t\tif (code <= 0x1f) return false;\n\n\t\t\t// Filter out Unicode format characters\n\t\t\tif (code >= 0xfff9 && code <= 0xfffb) return false;\n\n\t\t\treturn true;\n\t\t})\n\t\t.join(\"\");\n}\n\ninterface DetachedChildGuardian {\n\tpostMessage(message: { action: \"track\" | \"untrack\"; pid: number }): void;\n\tterminate(): Promise<number>;\n\tunref(): void;\n}\n\nlet detachedChildGuardian: DetachedChildGuardian | undefined;\n\nconst PARENT_GUARDIAN_SOURCE = `\nconst { parentPort, workerData } = require(\"node:worker_threads\");\nconst { spawn } = require(\"node:child_process\");\nconst { existsSync } = require(\"node:fs\");\nconst { join } = require(\"node:path\");\nconst tracked = new Set();\nparentPort.on(\"message\", ({ action, pid }) => {\n if (action === \"track\") tracked.add(pid);\n else tracked.delete(pid);\n});\nfunction killTree(pid) {\n if (process.platform === \"win32\") {\n // Same System32 hardening as killProcessTree: PATH is not trusted here, and an\n // unconsumed async \"error\" from a failed spawn would take the guardian thread\n // down and leak every detached child it exists to reap.\n try {\n const child = spawn(join(process.env.SystemRoot || \"C:\\\\\\\\Windows\", \"System32\", \"taskkill.exe\"), [\"/F\", \"/T\", \"/PID\", String(pid)], { stdio: \"ignore\", detached: true, windowsHide: true, env: { ...process.env, AI_AGENT: workerData.aiAgent } });\n child.once(\"error\", () => {});\n } catch {}\n return;\n }\n try { process.kill(-pid, \"SIGKILL\"); }\n catch { try { process.kill(pid, \"SIGKILL\"); } catch {} }\n}\nconst timer = setInterval(() => {\n let parentAlive = true;\n try { process.kill(workerData.parentPid, 0); } catch { parentAlive = false; }\n if (parentAlive && (!workerData.stopFile || !existsSync(workerData.stopFile))) return;\n for (const pid of tracked) killTree(pid);\n killTree(process.pid);\n}, 50);\ntimer.unref?.();\n`;\n\nexport function startParentProcessGuardian(parentPid: number, stopFile?: string): () => Promise<void> {\n\tif (detachedChildGuardian) return async () => {};\n\tconst guardian = new Worker(PARENT_GUARDIAN_SOURCE, {\n\t\teval: true,\n\t\tworkerData: { parentPid, stopFile, aiAgent: createChildProcessEnvironment().AI_AGENT },\n\t});\n\tdetachedChildGuardian = guardian;\n\tfor (const pid of trackedDetachedChildPids) guardian.postMessage({ action: \"track\", pid });\n\tguardian.unref();\n\treturn async () => {\n\t\tif (detachedChildGuardian !== guardian) return;\n\t\tdetachedChildGuardian = undefined;\n\t\tawait guardian.terminate();\n\t};\n}\n\n/**\n * Detached child processes must be tracked so they can be killed on parent\n * shutdown signals (SIGHUP/SIGTERM).\n */\nconst trackedDetachedChildPids = new Set<number>();\n\nexport function trackDetachedChildPid(pid: number): void {\n\ttrackedDetachedChildPids.add(pid);\n\tdetachedChildGuardian?.postMessage({ action: \"track\", pid });\n}\n\nexport function untrackDetachedChildPid(pid: number): void {\n\ttrackedDetachedChildPids.delete(pid);\n\tdetachedChildGuardian?.postMessage({ action: \"untrack\", pid });\n}\n\nexport function killTrackedDetachedChildren(): void {\n\tfor (const pid of trackedDetachedChildPids) {\n\t\tkillProcessTree(pid);\n\t\tdetachedChildGuardian?.postMessage({ action: \"untrack\", pid });\n\t}\n\ttrackedDetachedChildPids.clear();\n}\n\n/**\n * Kill a process and all its children (cross-platform)\n */\nexport function killProcessTree(pid: number): void {\n\tif (process.platform === \"win32\") {\n\t\t// Use the trusted System32 executable so cleanup does not depend on PATH.\n\t\ttry {\n\t\t\tconst child = spawn(\n\t\t\t\tjoin(process.env.SystemRoot ?? \"C:\\\\Windows\", \"System32\", \"taskkill.exe\"),\n\t\t\t\t[\"/F\", \"/T\", \"/PID\", String(pid)],\n\t\t\t\t{\n\t\t\t\t\tstdio: \"ignore\",\n\t\t\t\t\tdetached: true,\n\t\t\t\t\t// `detached` gives the child its own console on Windows unless this is\n\t\t\t\t\t// set, so omitting it both flashes a window and pays for a console\n\t\t\t\t\t// allocation on every tree kill. Every other spawn in the fork sets it.\n\t\t\t\t\twindowsHide: true,\n\t\t\t\t\tenv: createChildProcessEnvironment(),\n\t\t\t\t},\n\t\t\t);\n\t\t\t// A failed spawn emits \"error\" asynchronously; consume it to avoid crashing Node.\n\t\t\tchild.once(\"error\", () => {});\n\t\t} catch {\n\t\t\t// Ignore errors if taskkill fails.\n\t\t}\n\t} else {\n\t\t// Use SIGKILL on Unix/Linux/Mac\n\t\ttry {\n\t\t\tprocess.kill(-pid, \"SIGKILL\");\n\t\t} catch {\n\t\t\t// Fallback to killing just the child if process group kill fails\n\t\t\ttry {\n\t\t\t\tprocess.kill(pid, \"SIGKILL\");\n\t\t\t} catch {\n\t\t\t\t// Process already dead\n\t\t\t}\n\t\t}\n\t}\n}\n"]}
@@ -20,6 +20,7 @@ The indicator counts active agents and shells, including queued, stopping, and a
20
20
  Run `/tasks` to inspect work without stopping it:
21
21
 
22
22
  - The compact picker opens in the editor slot, with the conversation visible above it. It lists only tasks owned by that chat.
23
+ - Within the **Agents** and **Shells** sections, tasks are ordered by status: running (tasks needing attention first), stopping, queued, failed, cancelled, then completed. The newest launch or settlement comes first within each status, and your selection follows its task when it moves.
23
24
  - Detail, transcript, input, and cancellation-confirmation pages use the full screen.
24
25
  - Escape returns to the picker with your selection preserved, then to chat.
25
26
  - Completed background work remains available, including after a later foreground wait. Foreground-only commands are excluded.
@@ -192,11 +192,11 @@ Atomic uses Cua Driver through two faces of one typed surface. Choose by who dec
192
192
 
193
193
  The rule of thumb: **when a model chooses the next action, use the CLI; when TypeScript code owns the sequence and the postcondition, use the SDK.** Prefer [agent-browser](#browser-automation-with-agent-browser) for what its skill covers: websites and web apps in Chrome/Chromium, Electron desktop apps, Slack, and cloud browsers. Use Cua Driver for everything else, including iOS simulators, Android emulators, OS dialogs, and non-Chromium browsers, and whenever agent-browser hits a limitation. Terminals stay with [Herdr](#terminal-automation-with-herdr), falling back to tmux or psmux. Both faces share tool names (`list_apps`, `list_windows`, `get_window_state`, `click`, `type_text`, and the rest), so a scenario worked out interactively translates directly into code.
194
194
 
195
- The bundled `cua-driver` skill is the upstream skill, vendored verbatim, and is the only place the driving loop is described. Do not run `cua-driver skills install`: it links the skill into `~/.agents/skills`, `~/.claude/skills`, and similar directories that Atomic does not own. The bundled copy is the skill.
195
+ The bundled `cua-driver` skill is the upstream skill, vendored verbatim, and is the only place the driving loop is described. The executable installer below does not install an agent skill. Do not run `cua-driver skills install`, `cua-driver skills update`, or `clawhub install @cua/driver`: upstream's README describes those optional skill commands for other agents. Do not link or copy another skill into `~/.agents/skills/cua-driver`, `~/.claude/skills`, or other agent directories. Atomic already supplies its bundled copy; leave any existing user-level skill alone.
196
196
 
197
197
  ### Install if missing
198
198
 
199
- Check `cua-driver --version`. If the executable is missing, make **one bounded attempt** with upstream's one-line installer for the host. It needs no administrator access:
199
+ Check `cua-driver --version`. If the executable is missing, make **one bounded attempt** with upstream's one-line executable installer for the host. It needs no administrator access and does not install an agent skill:
200
200
 
201
201
  ```sh
202
202
  # macOS (14 Sonoma or later) and Linux
@@ -68,7 +68,7 @@ pi.registerProvider("my-llm", {
68
68
  });
69
69
  ```
70
70
 
71
- When `models` is provided, it **replaces** all existing models for that provider.
71
+ When `models` is provided, it **replaces** all existing chat, image, and classifier models for that provider. A missing `type` means chat; image and classifier models need `type: "image"` or `type: "classifier"` and implementations in the `images` or `classifiers` maps keyed by each model's `api`. See the [mixed-operation provider example](/custom-provider#quick-reference).
72
72
 
73
73
  ## Unregister Provider
74
74
 
@@ -78,6 +78,48 @@ export default function (pi: ExtensionAPI) {
78
78
 
79
79
  The extension factory can also be `async`. For dynamic model discovery, fetch and register models in the factory instead of `session_start`. Atomic waits for the factory before startup continues, so the provider is available during interactive startup and to `atomic --list-models`.
80
80
 
81
+ Registering only `baseUrl` or `headers` for an existing provider preserves its built-in models. Supplying `models` in the legacy form replaces that provider's models across chat, image, and classifier operations. An omitted `type` means `"chat"`; image and classifier models require explicit discriminants and implementations keyed by their `api` values through the `images` and `classifiers` fields.
82
+
83
+ For example, a mixed-operation provider can register non-chat models and their implementations together:
84
+
85
+ ```typescript
86
+ pi.registerProvider("media-tools", {
87
+ apiKey: "$MEDIA_TOOLS_API_KEY",
88
+ models: [
89
+ {
90
+ type: "image",
91
+ id: "image-v1",
92
+ name: "Image V1",
93
+ api: "media-images",
94
+ baseUrl: "https://media.example.com/v1",
95
+ input: ["text"],
96
+ output: ["image"],
97
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
98
+ },
99
+ {
100
+ type: "classifier",
101
+ id: "classifier-v1",
102
+ name: "Classifier V1",
103
+ api: "media-classifier",
104
+ baseUrl: "https://media.example.com/v1",
105
+ input: ["text"],
106
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
107
+ contextWindow: 64000,
108
+ },
109
+ ],
110
+ images: {
111
+ "media-images": { generateImages: async (model, context, options) => result },
112
+ },
113
+ classifiers: {
114
+ "media-classifier": { classify: async (model, context, options) => result },
115
+ },
116
+ });
117
+ ```
118
+
119
+ Model-level `baseUrl` values take precedence over the provider endpoint. If no `models` list is supplied, built-in models of every operation remain registered. Equal model IDs in different operations remain distinct, including their model-specific headers.
120
+
121
+ Every model needs an ID, display name, input capabilities, and cost metadata. Chat and classifier models also need a context window; chat models need an output limit and reasoning support; image models declare their output modalities. Choose the API implementation at the provider level unless one model requires an override.
122
+
81
123
  ## Override Existing Provider
82
124
 
83
125
  Moved to [Override an existing provider](/custom-provider/override#override-existing-provider).
@@ -104,7 +146,7 @@ Moved to [Provider OAuth](/custom-provider/oauth#oauth-support).
104
146
 
105
147
  ## Dynamic model catalog refresh
106
148
 
107
- Moved to [Provider OAuth](/custom-provider/oauth#dynamic-model-catalog-refresh).
149
+ Moved to [Provider OAuth](/custom-provider/oauth#dynamic-model-catalog-refresh). A complete `Provider` calls `context.publish({ update })` to install provider-owned model state, then exposes the latest list through `getModels()`. Legacy `ProviderConfig.refreshModels` returns mixed-operation model definitions that replace that registration's live models.
108
150
 
109
151
  ### OAuthLoginCallbacks
110
152
 
@@ -315,9 +315,7 @@ pi.registerTool({
315
315
 
316
316
  Return `terminate: true` from `execute()` to skip the automatic follow-up model call only when every finalized result in the tool batch also terminates.
317
317
 
318
- For a schema-backed final-answer tool, use `createStructuredOutputTool({ schema, capture, output, name })`. Atomic does not register `structured_output` in normal sessions by default. The factory uses your schema directly as tool parameters, captures the matching JSON value, returns pretty-printed JSON as terminating result text, and optionally writes `output.outputPath`. Text print mode emits that result as the final stdout response.
319
-
320
- Include a custom name such as `final_decision` in any explicit tool allowlist. The default `structured_output` name is likewise available only in the session/runtime where you register it.
318
+ For a schema-backed decision, use `createStructuredOutputTool({ schema, name })`. Atomic does not register `structured_output` in normal sessions by default. The calling model supplies `instructions`, nonempty named `state`, and optional `model` and `fallbackModels`. The tool resolves those exact IDs through the session model registry, infers a value matching `schema`, and returns that value as terminating JSON. It does not treat the calling model's arguments as the result. Omit `model` to use the current session chat model; explicit fallbacks run next, and the current chat model is the terminal fallback. A registered classifier runs only for a finite Choice schema. An incompatible schema skips that classifier. Provider errors, including refusals, advance to the next model. Plain-text responses without the required result are repaired up to three times before advancing. Cancellation stops the call. Include a custom name such as `final_decision` in any explicit tool allowlist.
321
319
 
322
320
  ```typescript
323
321
  // Correct: throw to signal an error
@@ -388,6 +386,27 @@ pi.registerTool({
388
386
  });
389
387
  ```
390
388
 
389
+ **Call ordering:** when one assistant message contains several tool calls, Atomic starts them in message order and runs them concurrently unless a tool declares `concurrency`:
390
+
391
+ - `"shared"` (default): may overlap other shared calls, but starts only after the latest earlier `"exclusive"` call finishes.
392
+ - `"exclusive"`: starts only after every earlier call in the message finishes, and later calls wait for it.
393
+ - A function `(args) => "shared" | "exclusive"` decides per call. If it throws, the call runs exclusively.
394
+
395
+ Built-in `edit`, `write`, `todo`, and `ask_user_question` are exclusive, and `bash` is exclusive when it runs with `pty: true`. Other `bash` calls are shared, so a later call in the same message can run before a shell command's file changes land. Declare `"exclusive"` for a tool that changes state later calls depend on. `executionMode: "sequential"` still runs the whole message one call at a time.
396
+
397
+ ```typescript
398
+ pi.registerTool({
399
+ name: "apply_migration",
400
+ label: "Apply Migration",
401
+ description: "Apply one database migration",
402
+ parameters: Type.Object({ name: Type.String(), dryRun: Type.Optional(Type.Boolean()) }),
403
+ concurrency: (args) => (args.dryRun === true ? "shared" : "exclusive"),
404
+ async execute(toolCallId, params) {
405
+ return { content: [{ type: "text", text: `Applied ${params.name}` }], details: {} };
406
+ },
407
+ });
408
+ ```
409
+
391
410
  ### Fireworks deferred tool loading
392
411
 
393
412
  Extensions making requests directly through `@bastani/pi-ai` can use native deferred tool loading with Fireworks `anthropic-messages` models. Keep the discovery tool in `context.tools`. After the discovery tool result, append a chronological system message with `toolsAdded` (and `toolsRemoved` if needed) containing the newly loaded tool definitions. The provider serializes deferred definitions with `defer_loading` and inserts `tool_reference` content at the load point.
@@ -36,6 +36,7 @@ user sends prompt ────────────────────
36
36
  │ ├─► context_with_system (can modify the full transcript)
37
37
  │ ├─► before_provider_request (can inspect or replace payload)
38
38
  │ ├─► after_provider_response (status + headers, before stream consume)
39
+ │ ├─► provider_stream_event (each parsed provider event, before normalization)
39
40
  │ │ │ │
40
41
  │ │ LLM responds, may call tools: │ │
41
42
  │ │ ├─► tool_execution_start │ │
@@ -537,6 +538,23 @@ pi.on("after_provider_response", (event, ctx) => {
537
538
 
538
539
  Header availability depends on provider and transport. Providers that abstract HTTP responses may not expose headers.
539
540
 
541
+ #### provider_stream_event
542
+
543
+ Fired for each parsed provider stream event before Atomic normalizes it into assistant message events. Use it to inspect provider-specific fields that Atomic does not keep in the assistant message.
544
+
545
+ ```typescript
546
+ pi.on("provider_stream_event", (event, ctx) => {
547
+ // event.provider, event.api, event.model - the model that produced the event
548
+ // event.data - the parsed provider event (read-only)
549
+ const chunk = event.data as Record<string, unknown>;
550
+ if (chunk.openrouter_metadata) console.log(chunk.openrouter_metadata);
551
+ });
552
+ ```
553
+
554
+ `event.data` is the earliest structured value available to Atomic, not necessarily the original HTTP bytes or SSE frame, and SDK-backed providers expose only the fields their SDK keeps. Treat it as read-only: changing it can change how the response is normalized. The event is notification-only and is not saved to the session. Cache-warming requests do not emit it.
555
+
556
+ Handlers run in stream order and are awaited, so a slow handler delays the response. Handler errors are reported without changing the provider response. Custom providers registered with `streamSimple` emit this event only if they call `options.onProviderStreamEvent`. See [`debug-provider.ts`](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/examples/extensions/debug-provider.ts) for an opt-in viewer.
557
+
540
558
  ### Model Events
541
559
 
542
560
  #### model_select
@@ -80,6 +80,7 @@ All examples in [examples/extensions/](https://github.com/bastani-inc/atomic/tre
80
80
  | `custom-provider-gitlab-duo/` | GitLab Duo integration | `registerProvider` with OAuth |
81
81
  | **Messages & Communication** |||
82
82
  | `message-renderer.ts` | Custom message rendering | `registerMessageRenderer`, `sendMessage` |
83
+ | `debug-provider.ts` | Capture raw provider stream events per assistant message with `/debug-provider` | `on("provider_stream_event")`, `registerEntryRenderer`, `appendEntry` |
83
84
  | `event-bus.ts` | Inter-extension events | `pi.events` |
84
85
  | **Session Metadata** |||
85
86
  | `session-name.ts` | Name sessions for selector | `setSessionName`, `getSessionName` |
@@ -12,38 +12,38 @@ Key:
12
12
  - `∅`=source null/absent, not zero.
13
13
  - Values are rounded to 1 decimal from the [model leaderboard](https://artificialanalysis.ai/leaderboards/models) payload, Coding Index and Agentic Index fields on free `GET /api/v2/language/models/free`, and default-chart constituent fields on the [Intelligence Index](https://artificialanalysis.ai/evaluations/artificial-analysis-intelligence-index) page.
14
14
  - A chart label may show the nearest integer of `idx`.
15
- - `idx`: Intelligence Index points.
16
- - `Cod`: Coding Index points.
17
- - `Agt`: Agentic Index points.
18
- - `Brief`: AA-Briefcase normalized Elo `clamp((Elo-500)/2000)*100`.
19
- - `Gn`: GDPval-AA normalized Elo `clamp((Elo-500)/2000)*100`.
20
- - `Omni`: Omniscience Index, -100 to 100.
21
- - `Open`: Openness Index points.
15
+ - `idx`: Intelligence Index points, aggregate performance across knowledge, reasoning, coding, and agentic work.
16
+ - `Cod`: Coding Index points, aggregate coding capability, including scientific code generation and terminal tasks; distinct from the Coding Agent Index.
17
+ - `Agt`: Agentic Index points, aggregate performance on multi-step tasks using tools.
18
+ - `Brief`: AA-Briefcase, long-horizon business knowledge work producing spreadsheets, presentations, and memos; normalized Elo `clamp((Elo-500)/2000)*100`.
19
+ - `Gn`: GDPval-AA, economically valuable professional work across occupations; normalized Elo `clamp((Elo-500)/2000)*100`.
20
+ - `Omni`: Omniscience Index, factual knowledge reliability, rewarding correct answers and penalizing incorrect guesses without penalizing abstention; -100 to 100.
21
+ - `Open`: Openness Index points, model availability and transparency of training data and methodology, not task-solving ability.
22
22
  - Other score columns are percent.
23
- - `OA`: Omniscience accuracy.
24
- - `ONH`: the 6,000-question ONH rate `(partial+notattempted)/(incorrect+partial+notattempted)`, not 1 minus the hallucination rate.
25
- - `PDF`: GDP.pdf All-pass.
26
- - `Auto`: AutomationBench-AA.
27
- - `TB4`: Terminal-Bench 4.0.
28
- - `TB21`: Terminal-Bench 2.1.
29
- - `TBh`: Terminal-Bench Hard.
30
- - `Sci`: SciCode.
31
- - `HLE`: Humanity's Last Exam.
32
- - `Crit`: CritPt.
33
- - `LCR`: AA-LCR.
34
- - `GPQA`: GPQA Diamond.
35
- - `IF`: IFBench.
36
- - `MMMU`: MMMU-Pro.
37
- - `tau2`: τ².
38
- - `tauB`: τ²-Banking.
39
- - `Analyst`: Analyst Agent.
40
- - `ITB`: ITBench SRE.
41
- - `Apex`: Apex Agents.
42
- - `AIME`: AIME 2025.
43
- - `LCB`: LiveCodeBench.
44
- - `Harvey`: Harvey Lab.
45
- - `MLCR`: MLCR overall.
46
- - `Ent`: EnterpriseOps Gym.
23
+ - `OA`: Omniscience accuracy, factual recall across knowledge domains.
24
+ - `ONH`: Omniscience non-hallucination, avoiding incorrect guesses when unable to answer fully; the 6,000-question ONH rate `(partial+notattempted)/(incorrect+partial+notattempted)`, not 1 minus the hallucination rate.
25
+ - `PDF`: GDP.pdf All-pass, reasoning over long professional documents while satisfying every task-specific criterion.
26
+ - `Auto`: AutomationBench-AA, completing multi-step SaaS workflows without guardrail violations.
27
+ - `TB4`: Terminal-Bench 4.0, agentic coding and terminal work across software engineering, systems administration, data processing, model training, and security.
28
+ - `TB21`: Terminal-Bench 2.1, an earlier terminal-task suite covering coding, systems administration, data processing, model training, and security.
29
+ - `TBh`: Terminal-Bench Hard, the legacy hard terminal-task subset testing coding, systems administration, and data processing.
30
+ - `Sci`: SciCode, writing scientific Python code to solve scientist-curated research problems, graded by execution tests.
31
+ - `HLE`: Humanity's Last Exam, expert-level academic knowledge and reasoning across mathematics, sciences, and humanities.
32
+ - `Crit`: CritPt, research-level physics reasoning.
33
+ - `LCR`: AA-LCR, extracting, reasoning about, and synthesizing information across long documents.
34
+ - `GPQA`: GPQA Diamond, graduate-level scientific reasoning in biology, physics, and chemistry.
35
+ - `IF`: IFBench, precise instruction following under verifiable output constraints.
36
+ - `MMMU`: MMMU-Pro, multimodal understanding and visual reasoning across academic disciplines.
37
+ - `tau2`: τ²-Bench Telecom, conversational tool use and coordination with a simulated user to resolve telecom support issues.
38
+ - `tauB`: Banking tool-use benchmark, knowledge retrieval and multi-step customer-support workflows; the snapshot labels this τ²-Banking, while the current source calls it τ³-Banking.
39
+ - `Analyst`: AA-AnalystAgent, end-to-end quantitative analysis of real-world spreadsheets and documents.
40
+ - `ITB`: ITBench SRE, identifying Kubernetes incident root causes from alerts, events, traces, and topology.
41
+ - `Apex`: [APEX-Agents](https://www.mercor.com/apex/apex-agents-leaderboard/), long-horizon, cross-application work in investment banking, consulting, and corporate law.
42
+ - `AIME`: AIME 2025, competition-level mathematical problem solving.
43
+ - `LCB`: LiveCodeBench, generating correct code for recent competitive programming problems.
44
+ - `Harvey`: Harvey LAB-AA, producing legal deliverables from case documents, graded against task-specific criteria.
45
+ - `MLCR`: Medical Long Context Reasoning overall, synthesizing long, fragmented medical records for healthcare and insurance case review.
46
+ - `Ent`: EnterpriseOps-Gym-AA, stateful, multi-step business workflows using tools, graded on the resulting database state.
47
47
  - `Brief`, `Auto`, `PDF`, `AIME`, `LCB`, `Harvey`, `MLCR`, `Open`, and `Ent` are published for default-chart models; other rows are `∅` for those columns.
48
48
 
49
49
  ## Artificial Analysis Intelligence Index v4.3.2
@@ -79,51 +79,3 @@ Table: top 26 catalog models by Intelligence Index, plus GPT-6 Luna (max) from b
79
79
  | qwen3-8-max | Qwen3.8 Max (0902) | 45.4 | 57 | 58.4 | 56.2 | 38.9 | 52.1 | 43.1 | 22.8 | 17.7 | 31.7 | 71.2 | 80.3 | 76.2 | 56 | 12 | 92.8 | 88.8 | ∅ | ∅ | 82.8 | ∅ | 47.8 | ∅ | ∅ | ∅ | ∅ | ∅ | ∅ | 20 | ∅ | ∅ |
80
80
  | muse-spark-1-3-xhigh | Muse Spark 1.3 (xhigh) | 45.1 | ∅ | 56.4 | 56.8 | 16.7 | 59.7 | 47.5 | 24.2 | 26 | 41.5 | 68.5 | 83 | 76.5 | 51.5 | 23.1 | 94.1 | 85.4 | ∅ | ∅ | 82 | ∅ | 47.2 | ∅ | ∅ | ∅ | ∅ | ∅ | 95.5 | ∅ | ∅ | ∅ |
81
81
  | gpt-6-luna | GPT-6 Luna (max) | 37.3 | ∅ | 43.4 | ∅ | 12.6 | 54.6 | 38.5 | ∅ | 19.4 | 43.8 | 23.3 | 83.3 | ∅ | ∅ | 0.7 | ∅ | ∅ | ∅ | ∅ | 75.5 | ∅ | ∅ | ∅ | ∅ | ∅ | ∅ | ∅ | ∅ | ∅ | ∅ | ∅ |
82
-
83
- ## Cognition FrontierCode 1.1
84
-
85
- [FrontierCode](https://cognition.com/frontiercode) 1.1 (revision 2026-07-07; [data](https://cognition.com/data/frontiercode-leaderboard/data.json); [methods](https://cognition.com/blog/frontier-code-1.1) and https://cognition.com/blog/frontier-code) measures code quality rather than only correctness: would the maintainer merge this PR. Tasks come from 36 open-source repositories whose maintainers wrote the rubrics, grading behavioral correctness, regression safety, lint and style, test correctness, scope discipline, and adherence to codebase conventions. A run passes only if it clears every blocker criterion; score is the weighted aggregate of all rubric items, and blocker or unfair-internet-use failures score zero. Main is 100 tasks and Extended is 150.
86
-
87
- Table: Main Best rows in source order. Columns: model, source effort label, harness, score, pass, flag (percent), USD/task, output k-tokens. Harness: `cc`=claude-code, `gb`=grok-build, `msa`=mini-swe-agent. `—`=source null, not 0; Inkling `0.99` is unexplained. Extended values remain linked (not routed).
88
-
89
- | ID | Model | Effort | Harness | score | pass | flag | USD/task | output k-tokens |
90
- | --- | --- | --- | --- | ---: | ---: | ---: | ---: | ---: |
91
- | F01 | Claude Opus 5.5 | medium | cc | 54.6 | 59.6 | 0.0 | 0.80 | 18.5 |
92
- | F02 | Claude Fable 5 | xhigh | cc | 53.5 | 58.9 | 0.3 | 13.09 | 58.6 |
93
- | F03 | Claude Opus 5 | medium | cc | 53.4 | 58.9 | 0.6 | 4.31 | 33.6 |
94
- | F04 | GPT-6 Astra | max | codex | 53.3 | 58.8 | — | 4.59 | 30.1 |
95
- | F05 | Claude Fable 5.1 | medium | cc | 50.9 | 55.5 | 0.0 | 3.28 | 26.1 |
96
- | F06 | SWE-2 | max | devin | 50.0 | 55.5 | — | 1.18 | 72.8 |
97
- | F07 | GPT-6 Sol | max | codex | 49.3 | 54.3 | 0.0 | 2.07 | 41.3 |
98
- | F08 | Grok 4.6 | high | gb | 48.0 | 53.1 | 0.7 | 2.88 | 36.8 |
99
- | F09 | GPT-5.6 Sol | max | codex | 47.5 | 52.9 | 0.0 | 5.19 | 33.2 |
100
- | F10 | Claude Opus 4.8 | max | cc | 46.5 | 51.6 | 0.6 | 9.62 | 95.9 |
101
- | F11 | Kimi K3 | none | msa | 44.2 | 48.9 | 0.2 | 3.82 | 53.6 |
102
- | F12 | Gemini 3.7 Flash | medium | chisel | 43.6 | 48.9 | 0.0 | 1.82 | 51.1 |
103
- | F13 | GPT-5.5 | xhigh | codex | 43.0 | 48.2 | 0.4 | 4.03 | 25.0 |
104
- | F14 | Claude Sonnet 5 | xhigh | cc | 42.7 | 47.6 | 0.5 | 10.07 | 87.9 |
105
- | F15 | Grok 4.5 | high | gb | 42.4 | 47.2 | 0.0 | 1.30 | 15.3 |
106
- | F16 | GPT-6 Luna | max | codex | 42.4 | 47.8 | 0.0 | 0.10 | 56.6 |
107
- | F17 | SWE-1.7 | none | chisel | 42.0 | 47.4 | 1.2 | 1.97 | 64.8 |
108
- | F18 | GPT-5.6 Terra | max | codex | 41.3 | 46.3 | 0.1 | 1.87 | 40.5 |
109
- | F19 | Gemini 3.8 Flash | medium | chisel | 41.2 | 46.7 | 0.0 | 2.60 | 78.9 |
110
- | F20 | GLM 5.3 | max | chisel | 40.1 | 44.7 | 0.0 | 16.91 | 112.2 |
111
- | F21 | GPT-5.6 Luna | max | codex | 39.8 | 44.7 | 0.1 | 0.37 | 37.4 |
112
- | F22 | Claude Opus 4.7 | max | cc | 38.5 | 42.8 | 0.1 | 9.09 | 49.1 |
113
- | F23 | Gemini 3.6 Flash | medium | chisel | 34.4 | 38.9 | 0.0 | 4.04 | 46.7 |
114
- | F24 | GLM 5.3 Flash | max | chisel | 31.8 | 35.7 | 0.0 | 1.15 | 169.3 |
115
- | F25 | Kimi K2.7 | none | msa | 30.1 | 33.6 | 0.0 | 3.01 | 43.9 |
116
- | F26 | DeepSeek V4 Pro 0813 | high | chisel | 28.5 | 31.8 | 10.6 | 1.81 | 104.7 |
117
- | F27 | GPT-5.4-mini | xhigh | codex | 27.0 | 30.8 | 0.0 | 1.52 | 90.9 |
118
- | F28 | Claude Opus 4.6 | high | cc | 26.6 | 29.7 | 0.1 | 3.98 | 26.7 |
119
- | F29 | Composer 2.5 | none | cursor | 25.6 | 29.3 | 2.4 | 3.09 | 16.0 |
120
- | F30 | GLM 5.2 | none | msa | 24.5 | 27.4 | 0.0 | 2.47 | 17.8 |
121
- | F31 | Claude Sonnet 4.6 | max | cc | 24.3 | 27.5 | 0.2 | 2.90 | 44.2 |
122
- | F32 | DeepSeek V4 Flash 0731 | high | chisel | 18.8 | 21.1 | 25.5 | 1.53 | 94.4 |
123
- | F33 | DeepSeek V4 Pro | none | msa | 17.6 | 20.0 | 1.0 | 1.55 | 28.8 |
124
- | F34 | MiniMax M3 | none | msa | 14.7 | 16.6 | 1.5 | 0.68 | 34.0 |
125
- | F35 | Inkling | 0.99 | msa | 14.0 | 15.9 | 7.6 | 3.60 | 33.6 |
126
- | F36 | Nemotron 3 Ultra | none | chisel | 13.6 | 15.4 | 0.2 | 1.47 | 27.7 |
127
- | F37 | Qwen 3.7 Plus | none | msa | 10.2 | 11.5 | 0.9 | 0.24 | 45.3 |
128
- | F38 | SWE-1.6 | none | chisel | 9.4 | 10.4 | 0.0 | 0.49 | 19.8 |
129
- | F39 | Mistral 3.5 Medium | none | chisel | 8.0 | 9.0 | 0.6 | 1.35 | 22.5 |
@@ -19,7 +19,11 @@ Subagent and workflow-stage `model: "auto"` routes before execution starts. Atom
19
19
  - hard `modelConstraints`, and
20
20
  - the factual markdown tables in [Evals](/models/evals).
21
21
 
22
- The router returns one primary `{ model, effort }` pair and up to two ordered fallback pairs. It cannot add candidates, bypass constraints, alter the execution prompt, change the selected chat model, or use Jev as an execution model. [`routerModel`](/settings#routermodel) chooses the decision provider only.
22
+ The router returns one primary `{ model, effort }` pair and up to two ordered fallback pairs. It cannot add candidates, bypass constraints, alter the execution prompt, or change the selected chat model. [`routerModel`](/settings#routermodel) chooses the decision model only: an explicit registered classifier or chat language model. Unset and `auto` use the current chat model, regardless of saved classifier credentials. An image-generation model cannot decide.
23
+
24
+ Only chat language models are eligible for execution `auto`, including models that accept image or PDF input. Image-generation and classifier models cannot be execution candidates, even when a classifier makes the routing decision.
25
+
26
+ In authored workflows, a classifier can make a structured triage decision without executing the stage; an image model can generate an asset inside a durable tool step. See [classifier and image models in `ctx.tool`](/workflows/authoring#classifier-and-image-models-in-ctx-tool).
23
27
 
24
28
  Long tasks may be excerpted for routing so the decision fits the decision provider's input budget. Execution still receives the full task. Put essential selection requirements in `<keepContext>...</keepContext>` spans because the excerpt preserves those spans, plus the beginning and end of the task.
25
29
 
@@ -68,7 +68,9 @@ When a package manifest exists, declared resource arrays normally define what lo
68
68
 
69
69
  Third-party runtime dependencies belong in `dependencies` in `package.json`. Dependencies that do not register extensions, skills, prompt templates, themes, or workflows also belong in `dependencies`. When Atomic installs a package from npm or git, it runs the configured npm-compatible install command, so those dependencies are installed automatically.
70
70
 
71
- Atomic bundles core packages for extensions and skills. If you import any of these, list them in `peerDependencies` with a `"*"` range and do not bundle them: `@bastani/pi-ai`, `@earendil-works/pi-agent-core`, `@bastani/atomic`, `@earendil-works/pi-tui`, `typebox`.
71
+ Atomic bundles core packages for extensions and skills. If you import any of these, list them in `peerDependencies` with a `"*"` range and do not bundle them: `@bastani/pi-ai`, `@earendil-works/pi-agent-core`, `@bastani/atomic`, `@earendil-works/pi-tui`, `typebox`. Atomic does not install peer dependencies for npm packages or for git packages installed with npm, pnpm, or Bun. Local packages are not installed or modified, so their dependency tree is up to the package author.
72
+
73
+ Do not list these host-provided packages in `dependencies`. An installed copy can bypass Atomic's extension module mapping and create duplicate classes, registries, and startup work. Atomic shows an extension warning when a package's `dependencies` include one of them.
72
74
 
73
75
  Workflow packages import `workflow` from `@bastani/atomic/workflows`, import `Type` from `typebox`, and export definitions returned by `workflow({ ... })`. List `@bastani/atomic` and `typebox` in `peerDependencies` so package consumers receive the workflow SDK and schema library.
74
76
 
package/docs/providers.md CHANGED
@@ -74,9 +74,10 @@ Codex describes Astra Fast as "2x speed, increased usage." OpenAI prices Fast at
74
74
 
75
75
  Fast inference is a model choice, not a mode. Where a provider supports it, Atomic adds a second selectable model whose canonical ID is the base model ID plus `-fast` — for example `openai-codex/gpt-5.6-sol-fast`. It appears in `/model`, in `atomic --list-models`, and in workflow model catalogs alongside its normal sibling, and it is persisted and restored by that exact ID. Select it anywhere you name a model, including with a thinking suffix: `openai-codex/gpt-5.6-sol-fast:medium`.
76
76
 
77
- Three provider paths produce these variants:
77
+ Four provider paths produce these variants:
78
78
 
79
79
  - Only first-party OpenAI `openai/*` and OpenAI Codex `openai-codex/*` models send the **base** upstream model ID plus the fixed `service_tier: priority`. A renamed provider, proxy, Azure OpenAI, OpenRouter, or generic OpenAI-compatible provider does not receive a synthetic fast variant.
80
+ - First-party xAI `xai/*` models get a fast variant for every Grok model, such as `xai/grok-4.7-fast`. It sends the **base** upstream model ID with xAI's [Priority Processing](https://docs.x.ai/developers/advanced-api-usage/priority-processing) `service_tier: priority`. xAI has no separate `-fast` model IDs for current Grok models. OpenRouter, Vercel AI Gateway, and renamed or proxied xAI-compatible providers do not receive a synthetic fast variant.
80
81
  - First-party Anthropic `anthropic/*` exposes [fast mode](https://platform.claude.com/docs/en/build-with-claude/fast-mode) for Claude Opus 5.5, Claude Opus 5, and Claude Opus 4.8: `anthropic/claude-opus-5-5-fast`, `anthropic/claude-opus-5-fast`, and `anthropic/claude-opus-4-8-fast`. Each sends the **base** upstream model ID with `speed: "fast"` and the `fast-mode-2026-02-01` beta header. It works with API keys and Claude subscription logins. Amazon Bedrock, Google Vertex, GitHub Copilot, OpenRouter, and renamed or proxied Anthropic-compatible providers do not receive a synthetic fast variant.
81
82
  - GitHub Copilot exposes only the real fast sibling IDs the OAuth model catalog advertises for the signed-in account, and only when the corresponding base model exists in Atomic's Copilot catalog. It sends those suffixed IDs verbatim with no OpenAI service-tier field. Copilot fast models require the account catalog metadata obtained through `/login`; a raw `COPILOT_GITHUB_TOKEN` does not provide that metadata.
82
83
 
@@ -138,6 +139,8 @@ Run `/login xai`, then select **Use a subscription**. `XAI_API_KEY` remains avai
138
139
 
139
140
  Atomic defaults xAI sessions to `grok-4.7`. GitHub Copilot also exposes Grok 4.7 when the account's model policy enables it. Network-backed catalogs refresh and cache these newer entries independently of the bundled catalog snapshot.
140
141
 
142
+ `xai/grok-4.7-fast` and the other `xai/*-fast` choices request xAI Priority Processing for lower time-to-first-token and faster streaming. xAI bills priority at twice the standard token rates, and only when the response confirms the priority tier. When priority capacity is unavailable, xAI serves the request at the default tier and Atomic prices it at the standard rate.
143
+
141
144
  Builtin workflows and subagents default to `model: "auto"`, selecting an available model and supported effort for each task rather than using fixed role models or shipped fallback chains. This does not change your main-chat model. To choose the decision provider, use `/settings` → **Router model**. For explicit child models, fallback lists or provider restrictions, see [Subagent reference](/subagents/reference#automatic-model-selection) and [builtin workflow model options](/workflows/builtins#built-in-workflows).
142
145
 
143
146
  ### Meta (Muse subscription)
@@ -191,7 +194,7 @@ Catalog failures preserve the last usable models for each provider. See [catalog
191
194
  | OpenCode Go | `OPENCODE_API_KEY` | `opencode-go` |
192
195
  | Radius | `RADIUS_API_KEY` | `radius` |
193
196
  | Hugging Face | `HF_TOKEN` | `huggingface` |
194
- | TypeSafe Jev | `TYPESAFE_API_KEY` | `typesafe-ai` |
197
+ | TypeSafe Jev | `TYPESAFE_API_KEY` | `typesafe` |
195
198
  | Fireworks | `FIREWORKS_API_KEY` | `fireworks` |
196
199
  | Together AI | `TOGETHER_API_KEY` | `together` |
197
200
  | Baseten | `BASETEN_API_KEY` | `baseten` |
@@ -499,21 +502,17 @@ For router-mode discovery, load/unload management, and Hugging Face downloads wi
499
502
 
500
503
  ## TypeSafe Jev
501
504
 
502
- `typesafe-ai/jev-latest`, `openrouter/~typesafe/jev-latest`, `vercel-ai-gateway/typesafe-ai/jev`, `opencode/jev-1.13`, and `opencode/jev-1.13-free` are built-in structured-decision models, not chat or tool-calling models. They are available for automatic workflow-stage and subagent model selection and [SDK structured decisions](/sdk/structured-decisions), not `/model`, chat `--model`, or child execution model fields. SDK integrations can inspect their supported capabilities with `getStructuredOutputProviders()`.
503
-
504
- Use `/login typesafe-ai` to save an API key in `auth.json`, or set `TYPESAFE_API_KEY` in Atomic's process environment. Stored credentials take precedence over the environment key, just as for other API-key providers. `/logout` removes the saved key; an environment key remains active until you unset it. Jev appears in `/login` but not `/model`, because it only makes structured decisions. Do not put the key in prompts, decision state, or `settings.json`.
505
-
506
- For OpenRouter, select `openrouter/~typesafe/jev-latest` in `/settings` → **Router model**, or set `"routerModel": "openrouter/~typesafe/jev-latest"`. It uses your existing `/login openrouter` sign-in or saved API key, with the usual `OPENROUTER_API_KEY` fallback. No TypeSafe key or separate login is needed. Atomic sends wire model `~typesafe/jev-latest` to OpenRouter's Decisions API, not its chat endpoint. OpenRouter credentials alone do not change automatic router selection.
505
+ `typesafe/jev-latest` is the built-in TypeSafe classifier. Name it explicitly in `routerModel`, `structured_output`, or `generateStructuredOutput()` when you want it. An unset or `auto` router uses the current chat model; saved credentials do not select a classifier. Jev is never an execution `auto` candidate, chat `--model`, or `/model` choice. Any other classifier works the same way only when the current model registry lists it. A models.dev listing does not register a classifier.
507
506
 
508
- Vercel AI Gateway and OpenCode Zen resell Jev on TypeSafe-compatible `systemone` endpoints. Select `vercel-ai-gateway/typesafe-ai/jev`, `opencode/jev-1.13`, or the limited-time `opencode/jev-1.13-free` the same way. Each uses that provider's existing `/login` credentials or its `AI_GATEWAY_API_KEY` / `OPENCODE_API_KEY` environment key, never a TypeSafe or OpenRouter key. The gateway model IDs, context limits, and prices come from the [models.dev](https://models.dev/models/typesafe/jev-latest/) decision catalog that Atomic regenerates with its chat catalogs; Cloudflare AI Gateway, NanoGPT, and Vivgrid also list Jev there but are not registered because they need a different request envelope or have no verified `systemone` route. Like OpenRouter, gateway selections are explicit-only.
507
+ Use `/login typesafe` to save an API key under `typesafe` in `auth.json`, or set `TYPESAFE_API_KEY` in Atomic's process environment. Stored credentials take precedence over the environment key. `/logout typesafe` removes the saved TypeSafe credential; an environment key remains active until you unset it. Jev appears in `/login` but not `/model`, because it only makes structured decisions. Do not put the key in prompts, decision state, or `settings.json`.
509
508
 
510
- Replace the former direct ID `typesafe-ai/jev` with `typesafe-ai/jev-latest` in saved router settings and SDK calls. Direct TypeSafe credentials and the wire model `jev-latest` are unchanged.
509
+ `openrouter/~typesafe/jev-latest`, `vercel-ai-gateway/typesafe-ai/jev`, `opencode/jev-1.13`, and `opencode/jev-1.13-free` are not registered classifiers and no longer resolve. Use `typesafe/jev-latest` or another classifier the current registry lists, or use a chat model.
511
510
 
512
- With an empty `routerModel`, configured Jev credentials select Jev for workflow-stage and subagent `model: "auto"` selection. An explicit router selection takes precedence. General SDK structured-output requests select their inference model explicitly. This does not change the `structured_output` tool's model. User-issued `/workflow` commands launch directly.
511
+ An explicit `routerModel` other than `auto` selects that exact registered chat or classifier model for workflow-stage and subagent `model: "auto"` routing. An unset or `auto` router uses the current chat model. General `generateStructuredOutput()` calls and the `structured_output` tool select their own model: an optional exact `model`, then `fallbackModels`, then the current chat model. Those calls resolve the ID through the current model registry and use the generic classify operation for a registered classifier, including `typesafe/jev-latest`. They do not inherit `routerModel`. A catalog entry does not prove that classify is available or entitled. User-issued `/workflow` commands launch directly.
513
512
 
514
- Routers can repair malformed or schema-invalid answers up to three times after the initial attempt, without a structured-decision deadline. Cancel the request to stop waiting; independent provider and enclosing tool-request limits still apply. Generic SDK decisions remain one-shot. Large choices can require several requests, increasing latency and usage; state is never trimmed automatically. See [structured decision limits](/sdk/structured-decisions#provider-behavior-and-limits) before sending large candidate lists or context.
513
+ Routers send one classify request for a registered classifier and can repair a malformed chat answer up to three times after the initial attempt, without a structured-decision deadline. Cancel the request to stop waiting; independent provider and enclosing tool-request limits still apply. A `structured_output` or `generateStructuredOutput()` classifier candidate is skipped, not repaired into a free-form value, when the schema is not a finite Choice. Missing credentials, an unavailable provider, an unsupported classify operation, a provider size rejection, a refusal, and a malformed classifier answer switch routing to the current chat model and advance a general structured-output chain. Cancellation does not. See [structured decision limits](/sdk/structured-decisions#provider-behavior-and-limits).
515
514
 
516
- HTTP 401 means check the key saved through `/login typesafe-ai` or `TYPESAFE_API_KEY`, 422 means check the question/state contract, and 429 or 529 means wait before retrying explicitly. Configured credentials do not verify access or quota. See [TypeSafe's API](https://docs.typesafe.ai/api.md) and [Choice reference](https://docs.typesafe.ai/primitives/choice.md).
515
+ HTTP 401 means check the key saved through `/login typesafe` or `TYPESAFE_API_KEY`, 422 means check the question/state contract, and 429 or 529 means wait before retrying explicitly. Configured credentials do not verify access or quota. See [TypeSafe's API](https://docs.typesafe.ai/api.md) and [Choice reference](https://docs.typesafe.ai/primitives/choice.md).
517
516
 
518
517
  ## Custom Providers
519
518