@bastani/atomic 0.9.11-alpha.7 → 0.9.11-alpha.8

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 (325) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +3 -5
  3. package/dist/builtin/intercom/package.json +1 -1
  4. package/dist/builtin/mcp/package.json +1 -1
  5. package/dist/builtin/mcp/sampling-handler.ts +1 -5
  6. package/dist/builtin/subagents/package.json +1 -1
  7. package/dist/builtin/web-access/package.json +1 -1
  8. package/dist/builtin/workflows/CHANGELOG.md +1 -0
  9. package/dist/builtin/workflows/README.md +1 -1
  10. package/dist/builtin/workflows/package.json +1 -1
  11. package/dist/builtin/workflows/src/extension/extension-runtime-state.ts +1 -24
  12. package/dist/builtin/workflows/src/extension/index.bundle.mjs +31 -28
  13. package/dist/builtin/workflows/src/extension/workflow-model-catalog.ts +26 -0
  14. package/dist/builtin/workflows/src/extension/workflow-prompts.ts +3 -2
  15. package/dist/builtin/workflows/src/runs/foreground/stage-runner-controller.ts +5 -5
  16. package/dist/builtin/workflows/src/runs/foreground/stage-runner-session-options.ts +3 -3
  17. package/dist/builtin/workflows/src/runs/foreground/stage-runner-session.ts +2 -2
  18. package/dist/cli/list-models.d.ts +2 -2
  19. package/dist/cli/list-models.d.ts.map +1 -1
  20. package/dist/cli/list-models.js +5 -5
  21. package/dist/cli/list-models.js.map +1 -1
  22. package/dist/core/agent-session-accessors.js +1 -1
  23. package/dist/core/agent-session-accessors.js.map +1 -1
  24. package/dist/core/agent-session-auto-compaction.d.ts.map +1 -1
  25. package/dist/core/agent-session-auto-compaction.js +2 -5
  26. package/dist/core/agent-session-auto-compaction.js.map +1 -1
  27. package/dist/core/agent-session-compaction.js +1 -1
  28. package/dist/core/agent-session-compaction.js.map +1 -1
  29. package/dist/core/agent-session-extension-bindings.js +5 -5
  30. package/dist/core/agent-session-extension-bindings.js.map +1 -1
  31. package/dist/core/agent-session-methods.d.ts +4 -4
  32. package/dist/core/agent-session-methods.d.ts.map +1 -1
  33. package/dist/core/agent-session-methods.js.map +1 -1
  34. package/dist/core/agent-session-models.d.ts +1 -1
  35. package/dist/core/agent-session-models.d.ts.map +1 -1
  36. package/dist/core/agent-session-models.js +18 -14
  37. package/dist/core/agent-session-models.js.map +1 -1
  38. package/dist/core/agent-session-post-tool-compaction.d.ts.map +1 -1
  39. package/dist/core/agent-session-post-tool-compaction.js +2 -4
  40. package/dist/core/agent-session-post-tool-compaction.js.map +1 -1
  41. package/dist/core/agent-session-prompt.d.ts.map +1 -1
  42. package/dist/core/agent-session-prompt.js +3 -7
  43. package/dist/core/agent-session-prompt.js.map +1 -1
  44. package/dist/core/agent-session-retry.js +1 -1
  45. package/dist/core/agent-session-retry.js.map +1 -1
  46. package/dist/core/agent-session-runtime-auth.d.ts +3 -3
  47. package/dist/core/agent-session-runtime-auth.d.ts.map +1 -1
  48. package/dist/core/agent-session-runtime-auth.js +4 -14
  49. package/dist/core/agent-session-runtime-auth.js.map +1 -1
  50. package/dist/core/agent-session-runtime.d.ts +1 -1
  51. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  52. package/dist/core/agent-session-runtime.js +3 -3
  53. package/dist/core/agent-session-runtime.js.map +1 -1
  54. package/dist/core/agent-session-services.d.ts +3 -8
  55. package/dist/core/agent-session-services.d.ts.map +1 -1
  56. package/dist/core/agent-session-services.js +16 -23
  57. package/dist/core/agent-session-services.js.map +1 -1
  58. package/dist/core/agent-session-tool-registry.d.ts.map +1 -1
  59. package/dist/core/agent-session-tool-registry.js +2 -1
  60. package/dist/core/agent-session-tool-registry.js.map +1 -1
  61. package/dist/core/agent-session-types.d.ts +2 -2
  62. package/dist/core/agent-session-types.d.ts.map +1 -1
  63. package/dist/core/agent-session-types.js.map +1 -1
  64. package/dist/core/agent-session.d.ts +2 -2
  65. package/dist/core/agent-session.d.ts.map +1 -1
  66. package/dist/core/agent-session.js +1 -1
  67. package/dist/core/agent-session.js.map +1 -1
  68. package/dist/core/auth-storage-backends.d.ts +1 -0
  69. package/dist/core/auth-storage-backends.d.ts.map +1 -1
  70. package/dist/core/auth-storage-backends.js +18 -4
  71. package/dist/core/auth-storage-backends.js.map +1 -1
  72. package/dist/core/auth-storage.d.ts +12 -139
  73. package/dist/core/auth-storage.d.ts.map +1 -1
  74. package/dist/core/auth-storage.js +68 -374
  75. package/dist/core/auth-storage.js.map +1 -1
  76. package/dist/core/copilot-env-routing.d.ts +36 -0
  77. package/dist/core/copilot-env-routing.d.ts.map +1 -0
  78. package/dist/core/copilot-env-routing.js +94 -0
  79. package/dist/core/copilot-env-routing.js.map +1 -0
  80. package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
  81. package/dist/core/extensions/loader-virtual-modules.js +10 -2
  82. package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
  83. package/dist/core/extensions/provider-types.d.ts +0 -40
  84. package/dist/core/extensions/provider-types.d.ts.map +1 -1
  85. package/dist/core/extensions/provider-types.js.map +1 -1
  86. package/dist/core/fallback-models.d.ts +4 -4
  87. package/dist/core/fallback-models.d.ts.map +1 -1
  88. package/dist/core/fallback-models.js +3 -3
  89. package/dist/core/fallback-models.js.map +1 -1
  90. package/dist/core/model-config.d.ts +542 -0
  91. package/dist/core/model-config.d.ts.map +1 -0
  92. package/dist/core/{model-registry-schemas.js → model-config.js} +85 -34
  93. package/dist/core/model-config.js.map +1 -0
  94. package/dist/core/model-registry.d.ts +25 -85
  95. package/dist/core/model-registry.d.ts.map +1 -1
  96. package/dist/core/model-registry.js +65 -388
  97. package/dist/core/model-registry.js.map +1 -1
  98. package/dist/core/model-resolver-cli.d.ts +2 -2
  99. package/dist/core/model-resolver-cli.d.ts.map +1 -1
  100. package/dist/core/model-resolver-cli.js +2 -2
  101. package/dist/core/model-resolver-cli.js.map +1 -1
  102. package/dist/core/model-resolver-initial.d.ts +4 -4
  103. package/dist/core/model-resolver-initial.d.ts.map +1 -1
  104. package/dist/core/model-resolver-initial.js +17 -17
  105. package/dist/core/model-resolver-initial.js.map +1 -1
  106. package/dist/core/model-resolver-scope.d.ts +3 -3
  107. package/dist/core/model-resolver-scope.d.ts.map +1 -1
  108. package/dist/core/model-resolver-scope.js +4 -4
  109. package/dist/core/model-resolver-scope.js.map +1 -1
  110. package/dist/core/model-runtime-auth.d.ts +7 -0
  111. package/dist/core/model-runtime-auth.d.ts.map +1 -0
  112. package/dist/core/model-runtime-auth.js +14 -0
  113. package/dist/core/model-runtime-auth.js.map +1 -0
  114. package/dist/core/model-runtime-providers.d.ts +6 -0
  115. package/dist/core/model-runtime-providers.d.ts.map +1 -0
  116. package/dist/core/model-runtime-providers.js +22 -0
  117. package/dist/core/model-runtime-providers.js.map +1 -0
  118. package/dist/core/model-runtime-restoration.d.ts +6 -0
  119. package/dist/core/model-runtime-restoration.d.ts.map +1 -0
  120. package/dist/core/model-runtime-restoration.js +21 -0
  121. package/dist/core/model-runtime-restoration.js.map +1 -0
  122. package/dist/core/model-runtime-snapshot.d.ts +16 -0
  123. package/dist/core/model-runtime-snapshot.d.ts.map +1 -0
  124. package/dist/core/model-runtime-snapshot.js +52 -0
  125. package/dist/core/model-runtime-snapshot.js.map +1 -0
  126. package/dist/core/model-runtime-streaming.d.ts +17 -0
  127. package/dist/core/model-runtime-streaming.d.ts.map +1 -0
  128. package/dist/core/model-runtime-streaming.js +66 -0
  129. package/dist/core/model-runtime-streaming.js.map +1 -0
  130. package/dist/core/model-runtime-types.d.ts +21 -0
  131. package/dist/core/model-runtime-types.d.ts.map +1 -0
  132. package/dist/core/model-runtime-types.js +2 -0
  133. package/dist/core/model-runtime-types.js.map +1 -0
  134. package/dist/core/model-runtime.d.ts +50 -29
  135. package/dist/core/model-runtime.d.ts.map +1 -1
  136. package/dist/core/model-runtime.js +330 -90
  137. package/dist/core/model-runtime.js.map +1 -1
  138. package/dist/core/models-store.d.ts +2 -10
  139. package/dist/core/models-store.d.ts.map +1 -1
  140. package/dist/core/models-store.js +2 -29
  141. package/dist/core/models-store.js.map +1 -1
  142. package/dist/core/oauth-login.d.ts +24 -0
  143. package/dist/core/oauth-login.d.ts.map +1 -0
  144. package/dist/core/oauth-login.js +87 -0
  145. package/dist/core/oauth-login.js.map +1 -0
  146. package/dist/core/oauth-provider-metadata.d.ts +5 -0
  147. package/dist/core/oauth-provider-metadata.d.ts.map +1 -0
  148. package/dist/core/oauth-provider-metadata.js +19 -0
  149. package/dist/core/oauth-provider-metadata.js.map +1 -0
  150. package/dist/core/provider-composer-internal.d.ts +53 -0
  151. package/dist/core/provider-composer-internal.d.ts.map +1 -0
  152. package/dist/core/provider-composer-internal.js +273 -0
  153. package/dist/core/provider-composer-internal.js.map +1 -0
  154. package/dist/core/provider-composer.d.ts +16 -0
  155. package/dist/core/provider-composer.d.ts.map +1 -0
  156. package/dist/core/provider-composer.js +108 -0
  157. package/dist/core/provider-composer.js.map +1 -0
  158. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  159. package/dist/core/remote-catalog-provider.js +74 -122
  160. package/dist/core/remote-catalog-provider.js.map +1 -1
  161. package/dist/core/resolve-config-value.d.ts +8 -7
  162. package/dist/core/resolve-config-value.d.ts.map +1 -1
  163. package/dist/core/resolve-config-value.js +26 -23
  164. package/dist/core/resolve-config-value.js.map +1 -1
  165. package/dist/core/runtime-credentials.d.ts +16 -0
  166. package/dist/core/runtime-credentials.d.ts.map +1 -0
  167. package/dist/core/runtime-credentials.js +42 -0
  168. package/dist/core/runtime-credentials.js.map +1 -0
  169. package/dist/core/sdk-types.d.ts +1 -7
  170. package/dist/core/sdk-types.d.ts.map +1 -1
  171. package/dist/core/sdk-types.js.map +1 -1
  172. package/dist/core/sdk.d.ts.map +1 -1
  173. package/dist/core/sdk.js +27 -28
  174. package/dist/core/sdk.js.map +1 -1
  175. package/dist/extensions/llama/index.js +1 -1
  176. package/dist/extensions/llama/index.js.map +1 -1
  177. package/dist/extensions/llama/provider.d.ts +2 -4
  178. package/dist/extensions/llama/provider.d.ts.map +1 -1
  179. package/dist/extensions/llama/provider.js +25 -17
  180. package/dist/extensions/llama/provider.js.map +1 -1
  181. package/dist/index.d.ts +2 -3
  182. package/dist/index.d.ts.map +1 -1
  183. package/dist/index.js +3 -4
  184. package/dist/index.js.map +1 -1
  185. package/dist/main-runtime-api-key.d.ts +6 -0
  186. package/dist/main-runtime-api-key.d.ts.map +1 -0
  187. package/dist/main-runtime-api-key.js +6 -0
  188. package/dist/main-runtime-api-key.js.map +1 -0
  189. package/dist/main-session-options.d.ts +2 -2
  190. package/dist/main-session-options.d.ts.map +1 -1
  191. package/dist/main-session-options.js +3 -3
  192. package/dist/main-session-options.js.map +1 -1
  193. package/dist/main.d.ts.map +1 -1
  194. package/dist/main.js +9 -11
  195. package/dist/main.js.map +1 -1
  196. package/dist/modes/interactive/components/footer.js +1 -1
  197. package/dist/modes/interactive/components/footer.js.map +1 -1
  198. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  199. package/dist/modes/interactive/components/login-dialog.js +1 -3
  200. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  201. package/dist/modes/interactive/components/model-selector.d.ts +4 -3
  202. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  203. package/dist/modes/interactive/components/model-selector.js +56 -73
  204. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  205. package/dist/modes/interactive/components/oauth-selector.d.ts +4 -3
  206. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  207. package/dist/modes/interactive/components/oauth-selector.js +15 -24
  208. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  209. package/dist/modes/interactive/interactive-agent-events.js +1 -1
  210. package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
  211. package/dist/modes/interactive/interactive-auth-login.js +20 -31
  212. package/dist/modes/interactive/interactive-auth-login.js.map +1 -1
  213. package/dist/modes/interactive/interactive-auth-routing.d.ts +1 -1
  214. package/dist/modes/interactive/interactive-auth-routing.d.ts.map +1 -1
  215. package/dist/modes/interactive/interactive-auth-routing.js +21 -47
  216. package/dist/modes/interactive/interactive-auth-routing.js.map +1 -1
  217. package/dist/modes/interactive/interactive-autocomplete.js +3 -3
  218. package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
  219. package/dist/modes/interactive/interactive-deferred-startup.js +8 -8
  220. package/dist/modes/interactive/interactive-deferred-startup.js.map +1 -1
  221. package/dist/modes/interactive/interactive-extension-runtime.js +2 -1
  222. package/dist/modes/interactive/interactive-extension-runtime.js.map +1 -1
  223. package/dist/modes/interactive/interactive-model-catalog-startup.js +2 -2
  224. package/dist/modes/interactive/interactive-model-catalog-startup.js.map +1 -1
  225. package/dist/modes/interactive/interactive-model-routing.js +11 -11
  226. package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
  227. package/dist/modes/interactive/interactive-render-chat.js +1 -1
  228. package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
  229. package/dist/modes/interactive/interactive-slash-commands.js +2 -2
  230. package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
  231. package/dist/modes/interactive/interactive-startup.js +1 -1
  232. package/dist/modes/interactive/interactive-startup.js.map +1 -1
  233. package/dist/modes/interactive-engine/isolated-auth.d.ts +2 -2
  234. package/dist/modes/interactive-engine/isolated-auth.d.ts.map +1 -1
  235. package/dist/modes/interactive-engine/isolated-auth.js +4 -3
  236. package/dist/modes/interactive-engine/isolated-auth.js.map +1 -1
  237. package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
  238. package/dist/modes/interactive-engine/isolated-runtime.js +4 -3
  239. package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
  240. package/dist/modes/interactive-engine/remote-model-catalog.d.ts +0 -1
  241. package/dist/modes/interactive-engine/remote-model-catalog.d.ts.map +1 -1
  242. package/dist/modes/interactive-engine/remote-model-catalog.js +11 -50
  243. package/dist/modes/interactive-engine/remote-model-catalog.js.map +1 -1
  244. package/dist/modes/rpc/rpc-client-api.d.ts +2 -2
  245. package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -1
  246. package/dist/modes/rpc/rpc-client-api.js.map +1 -1
  247. package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
  248. package/dist/modes/rpc/rpc-command-handler.js +26 -19
  249. package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
  250. package/dist/modes/rpc/rpc-oauth-client.d.ts +1 -1
  251. package/dist/modes/rpc/rpc-oauth-client.d.ts.map +1 -1
  252. package/dist/modes/rpc/rpc-oauth-client.js +1 -1
  253. package/dist/modes/rpc/rpc-oauth-client.js.map +1 -1
  254. package/dist/modes/rpc/rpc-oauth-interaction.d.ts +1 -1
  255. package/dist/modes/rpc/rpc-oauth-interaction.d.ts.map +1 -1
  256. package/dist/modes/rpc/rpc-oauth-interaction.js +1 -1
  257. package/dist/modes/rpc/rpc-oauth-interaction.js.map +1 -1
  258. package/dist/modes/rpc/rpc-provider-auth.d.ts +4 -5
  259. package/dist/modes/rpc/rpc-provider-auth.d.ts.map +1 -1
  260. package/dist/modes/rpc/rpc-provider-auth.js +19 -66
  261. package/dist/modes/rpc/rpc-provider-auth.js.map +1 -1
  262. package/dist/modes/rpc/rpc-session-binding.js +1 -1
  263. package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
  264. package/dist/modes/rpc/rpc-types.d.ts +7 -4
  265. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  266. package/dist/modes/rpc/rpc-types.js.map +1 -1
  267. package/dist/package-manager-cli.d.ts.map +1 -1
  268. package/dist/package-manager-cli.js +5 -7
  269. package/dist/package-manager-cli.js.map +1 -1
  270. package/docs/changelog.mdx +1 -1
  271. package/docs/custom-provider.md +1 -1
  272. package/docs/models.md +4 -6
  273. package/docs/providers.md +13 -0
  274. package/docs/quickstart.md +2 -1
  275. package/docs/sdk.md +32 -49
  276. package/docs/workflows.md +3 -3
  277. package/examples/sdk/02-custom-model.ts +8 -10
  278. package/examples/sdk/09-api-keys-and-oauth.ts +17 -23
  279. package/examples/sdk/12-full-control.ts +9 -11
  280. package/examples/sdk/README.md +17 -21
  281. package/npm-shrinkwrap.json +23 -23
  282. package/package.json +2 -2
  283. package/dist/core/model-registry-auth.d.ts +0 -10
  284. package/dist/core/model-registry-auth.d.ts.map +0 -1
  285. package/dist/core/model-registry-auth.js +0 -98
  286. package/dist/core/model-registry-auth.js.map +0 -1
  287. package/dist/core/model-registry-builtins.d.ts +0 -8
  288. package/dist/core/model-registry-builtins.d.ts.map +0 -1
  289. package/dist/core/model-registry-builtins.js +0 -104
  290. package/dist/core/model-registry-builtins.js.map +0 -1
  291. package/dist/core/model-registry-custom-loader.d.ts +0 -3
  292. package/dist/core/model-registry-custom-loader.d.ts.map +0 -1
  293. package/dist/core/model-registry-custom-loader.js +0 -255
  294. package/dist/core/model-registry-custom-loader.js.map +0 -1
  295. package/dist/core/model-registry-dynamic.d.ts +0 -7
  296. package/dist/core/model-registry-dynamic.d.ts.map +0 -1
  297. package/dist/core/model-registry-dynamic.js +0 -189
  298. package/dist/core/model-registry-dynamic.js.map +0 -1
  299. package/dist/core/model-registry-extension-refresh.d.ts +0 -23
  300. package/dist/core/model-registry-extension-refresh.d.ts.map +0 -1
  301. package/dist/core/model-registry-extension-refresh.js +0 -32
  302. package/dist/core/model-registry-extension-refresh.js.map +0 -1
  303. package/dist/core/model-registry-loader.d.ts +0 -5
  304. package/dist/core/model-registry-loader.d.ts.map +0 -1
  305. package/dist/core/model-registry-loader.js +0 -29
  306. package/dist/core/model-registry-loader.js.map +0 -1
  307. package/dist/core/model-registry-schemas.d.ts +0 -1399
  308. package/dist/core/model-registry-schemas.d.ts.map +0 -1
  309. package/dist/core/model-registry-schemas.js.map +0 -1
  310. package/dist/core/model-registry-types.d.ts +0 -91
  311. package/dist/core/model-registry-types.d.ts.map +0 -1
  312. package/dist/core/model-registry-types.js +0 -2
  313. package/dist/core/model-registry-types.js.map +0 -1
  314. package/dist/core/model-registry-validation.d.ts +0 -7
  315. package/dist/core/model-registry-validation.d.ts.map +0 -1
  316. package/dist/core/model-registry-validation.js +0 -12
  317. package/dist/core/model-registry-validation.js.map +0 -1
  318. package/dist/core/oauth-compat.d.ts +0 -17
  319. package/dist/core/oauth-compat.d.ts.map +0 -1
  320. package/dist/core/oauth-compat.js +0 -2
  321. package/dist/core/oauth-compat.js.map +0 -1
  322. package/dist/core/oauth-provider-bridge.d.ts +0 -63
  323. package/dist/core/oauth-provider-bridge.d.ts.map +0 -1
  324. package/dist/core/oauth-provider-bridge.js +0 -232
  325. package/dist/core/oauth-provider-bridge.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,30 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [0.9.11-alpha.8] - 2026-07-29
6
+
7
+ ### Breaking Changes
8
+
9
+ - Replaced Atomic's legacy extension OAuth registration bridge with provider-owned authentication from `@earendil-works/pi-ai`. Extensions must declare OAuth or API-key authentication on their provider registration. The package root no longer exports the bridge functions `registerOAuthProvider`, `resetOAuthProviders`, `getOAuthApiKey`, `getOAuthProvider`, or `getOAuthProviders`, nor the bridge and credential/status types `LegacyOAuthProvider`, `OAuthProviderDescriptor`, `ApiKeyCredential`, `AuthCredential`, `AuthStatus`, or `OAuthCredential`; import current credential types from `@earendil-works/pi-ai` and use provider-owned authentication instead. The internal legacy registration/refresh machinery and custom API-key login hooks beyond pi's provider contract were also removed.
10
+ - Model configuration now follows pi's single-file `ModelConfig` contract. Atomic reads one `models.json` from the active Atomic agent directory (`~/.atomic/agent/models.json`, or the directory selected by `ATOMIC_CODING_AGENT_DIR`/`PI_CODING_AGENT_DIR`); it no longer reads project-scoped `.atomic/models.json`, falls back to `~/.pi/agent/models.json`, or layers and merges `.pi` and `.atomic` model configuration files. Move project-scoped custom providers and models into the active agent-directory file. The legacy `.pi` read fallback remains only for configuration surfaces that explicitly use layered paths, such as `auth.json`.
11
+ - Model-catalog refreshes now use pi's exact timeout semantics. `modelRefreshTimeoutMs` applies only to the initial runtime creation refresh, and post-login catalog refreshes are unbounded; the interactive `/model` selector owns its 15-second refresh timeout like pi, rendering cached models immediately, aborting a slow refresh, and reporting "Model refresh timed out; showing cached models." Callers of `ModelRuntime.refresh()` that require cancellation must provide their own abort signal.
12
+ - Extension `streamSimple` implementations are now scoped to their registered provider and `ModelRuntime`, matching pi's provider composer. Unregistering a newer provider no longer restores an older global API-owner registration; extensions that replace a provider stream must keep that provider registered for as long as the stream should remain active.
13
+ - Remote model catalogs now publish refreshed models in memory before persisting the catalog, matching pi's ordering. If the catalog-store write fails, refresh reports the storage error but the newly refreshed in-memory catalog remains active for the current process.
14
+ - `AuthStorage` now implements pi's asynchronous `CredentialStore` contract directly. Its synchronous compatibility methods (`get`, `set`, `remove`, `has`, `hasAuth`, `getAll`, `getAuthStatus`, `getLoadError`, `drainErrors`, and synchronous `list`), `asCredentialStore()` adapter, fallback/runtime-key helpers (`setFallbackResolver`, `getRuntimeApiKey`, `setRuntimeApiKey`, and `removeRuntimeApiKey`), and provider-auth methods (`login`, `logout`, `logoutAsync`, `getModelAuth`, `getApiKey`, and `getOAuthProviders`) were removed. Use and `await` `read`, `list`, `modify`, and `delete` for persisted credentials, call `reload` when an existing instance must reread its backing store, and use `ModelRuntime` for authentication resolution, login/logout, and runtime API-key overrides.
15
+ - `ModelRegistry` is now constructed from a `ModelRuntime` and exposes only pi's thin compatibility-facade surface. The `create` and `inMemory` factories, public `authStorage` member, and the `canRestoreUnknownModel`, `checkAuth`, `getAuth`, `getCustomApiKeyAuth`, `getCustomApiKeyAuthProviders`, `getProviders`, `hasProvider`, `hasRegisteredStreamSimpleForApi`, `login`, and `logoutProvider` methods were removed. Instantiate and consume `ModelRuntime` for runtime-owned model/provider discovery and authentication, and pass it to `new ModelRegistry(runtime)` only where the synchronous extension-facing facade is required.
16
+ - `CreateAgentSessionOptions` no longer accepts the public `authStorage` and `modelRegistry` overrides. Construct or supply a `ModelRuntime` through `modelRuntime` instead; when omitted, `createAgentSession()` creates the runtime from the active agent directory's `auth.json` and `models.json`.
17
+
18
+ ### Changed
19
+
20
+ - Adopted pi's provider-owned `ModelRuntime` architecture for model composition, credentials, streaming, and catalog refresh. `ModelRegistry` is now the thin synchronous extension-compatibility facade used by pi, while coding-agent, SDK, RPC, isolated-engine, workflow, and MCP internals consume `ModelRuntime` directly.
21
+
22
+ ### Fixed
23
+
24
+ - Fixed OAuth logins being destroyed by an unrelated model-catalog refresh, matching upstream pi's behavior. After a successful `/login`, a timed-out (aborted) or partially failed catalog refresh threw `Model refresh aborted after OAuth login` and rolled the freshly acquired tokens back to the previous credential. Because providers rotate refresh tokens, that rollback could permanently strand a server-side-invalidated credential — every send then failed with `invalid_grant` ("Refresh token not found or invalid") and every re-login was rolled back again, typically on machines with slow routes to catalog endpoints. Freshly persisted OAuth credentials now always survive the post-login refresh: per-provider refresh errors and refresh timeouts no longer fail the login in either the direct interactive or isolated-engine path, and models fall back to the cached snapshot.
25
+ - Fixed the `/model` selector reporting `Could not refresh llama.cpp; showing cached models.` for users who never configured a llama.cpp server. The bundled llama.cpp extension now uses pi's provider-owned registration: the provider stays dormant — no refresh attempt, no error — until a server is configured through `LLAMA_BASE_URL` or a stored login, and `/login` prompts for the server URL plus optional API key exactly like pi.
26
+ - Fixed RPC `save_provider_credential` writes disappearing after process restart. Saved API-key and OAuth credentials now persist to `auth.json` through `ModelRuntime.saveCredential()` instead of being stored as non-persistent runtime API-key overrides; the RPC command again accepts the full credential union, awaits a model-catalog refresh, and returns the refreshed catalog.
27
+ - Fixed GitHub Copilot requests failing with `421 Misdirected Request` for users who authenticate with `COPILOT_GITHUB_TOKEN`. Upstream pi pins the `github-copilot` provider to `https://api.individual.githubcopilot.com` and only derives a per-tenant host inside its OAuth loader, so business, enterprise, and GHE tokens supplied through the environment were sent to the individual CAPI host. Atomic now resolves the endpoint for env-token auth again, highest precedence first: `COPILOT_API_TARGET` / `GITHUB_COPILOT_BASE_URL`, the token's embedded `proxy-ep` segment, `GITHUB_SERVER_URL` (`<tenant>.ghe.com` routes to `copilot-api.<tenant>.ghe.com`, other non-`github.com` hosts to `https://api.enterprise.githubcopilot.com`), and finally the public routing hub `https://api.githubcopilot.com`. A `models.json` provider `baseUrl` still overrides all of it, and the OAuth path remains exactly upstream.
28
+
5
29
  ## [0.9.11-alpha.7] - 2026-07-28
6
30
 
7
31
  ### Changed
package/README.md CHANGED
@@ -429,14 +429,12 @@ See [docs/packages.md](docs/packages.md).
429
429
  ### SDK
430
430
 
431
431
  ```typescript
432
- import { AuthStorage, createAgentSession, ModelRegistry, SessionManager } from "@bastani/atomic";
432
+ import { createAgentSession, SessionManager } from "@bastani/atomic";
433
433
 
434
- const authStorage = AuthStorage.create();
435
- const modelRegistry = ModelRegistry.create(authStorage);
434
+ // By default, createAgentSession builds a ModelRuntime from the active agent
435
+ // directory's auth.json and models.json.
436
436
  const { session } = await createAgentSession({
437
437
  sessionManager: SessionManager.inMemory(),
438
- authStorage,
439
- modelRegistry,
440
438
  });
441
439
 
442
440
  await session.prompt("What files are in the current directory?");
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/intercom",
3
- "version": "0.9.11-alpha.7",
3
+ "version": "0.9.11-alpha.8",
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": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/mcp",
3
- "version": "0.9.11-alpha.7",
3
+ "version": "0.9.11-alpha.8",
4
4
  "private": true,
5
5
  "description": "Atomic extension that adapts MCP (Model Context Protocol) servers into the coding agent. Fork of: https://github.com/nicobailon/pi-mcp-adapter",
6
6
  "contributors": [
@@ -152,11 +152,7 @@ async function resolveSamplingModel(
152
152
  errors.push(`${model.provider}/${model.id}: ${auth.error}`);
153
153
  continue;
154
154
  }
155
- return {
156
- model: auth.baseUrl === undefined ? model : { ...model, baseUrl: auth.baseUrl },
157
- apiKey: auth.apiKey,
158
- headers: auth.headers,
159
- };
155
+ return { model, apiKey: auth.apiKey, headers: auth.headers };
160
156
  }
161
157
 
162
158
  if (errors.length > 0) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/subagents",
3
- "version": "0.9.11-alpha.7",
3
+ "version": "0.9.11-alpha.8",
4
4
  "private": true,
5
5
  "description": "Atomic extension for delegating tasks to subagents with chains, parallel execution, and background runs. Fork of: https://github.com/nicobailon/pi-subagents",
6
6
  "contributors": [
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/web-access",
3
- "version": "0.9.11-alpha.7",
3
+ "version": "0.9.11-alpha.8",
4
4
  "private": true,
5
5
  "description": "Atomic extension for web search, URL fetching, GitHub repo cloning, PDF/video extraction. Fork of: https://github.com/nicobailon/pi-web-access",
6
6
  "contributors": [
@@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
15
15
  - Added a run-contract discipline to every builtin workflow. Only the user may change a run's contract: mid-run steering, follow-ups, and resume text are authoritative amendments, while agents may never widen the contract themselves. A new steering propagation contract requires each stage to restate the amendments it received under a `Contract amendments received` heading in its handoff, keep them separate from its own observations, treat inherited amendments as contract clauses rather than out-of-scope work, and resolve ambiguity through `intercom` before implementing. Every bundled workflow wraps its run context once through `withSteeringPropagationContext` (exported from `@bastani/workflows/builtin/steering-context`), so `ctx.task`, `ctx.chain`, and `ctx.parallel` prompts carry the contract automatically and a stage added later inherits it. Without propagation an implementer builds to an amended contract while reviewers still score the launch contract and mark the added work as unrequested scope.
16
16
  - Added a scope discipline contract to builtin implementation stages: freeze the acceptance criteria before writing code, stop when they pass, trace every addition to a criterion, keep a deferred list instead of a growing diff, prefer the smallest diff that satisfies the contract, and report the contract, per-criterion evidence, and deferred items at the end.
17
17
  - Added a draft handoff for `ralph` runs that exhaust their review budget. When `create_pr` is enabled and the loop ends without unanimous approval, the run now opens a provider-native draft pull request that reproduces every unresolved blocking finding with priority, objective alignment, and cited `file:line`, states the iteration count, and requests no reviewers. Previously the branch was left unpushed with no handoff. Runs without `create_pr` still never touch a pull request, approved or not.
18
+ - Added workflow-authoring guidance so, after creating and reloading a custom workflow, Atomic reports `Custom workflow created. You can inspect its code at: <workflow-folder-path>` only for newly created custom workflows, explicitly excluding builtin and pre-existing workflows ([#1978](https://github.com/bastani-inc/atomic/issues/1978)).
18
19
 
19
20
  ### Removed
20
21
 
@@ -606,7 +606,7 @@ Raw stage-chat prompt answer replay is live-memory only. `StageSnapshot.promptAn
606
606
  ```json
607
607
  {
608
608
  "name": "workflow",
609
- "description": "Run named builtin, project, user, or package workflows; custom definitions may import reusable project/package workflows or builtin definitions from @bastani/workflows/builtin and nest them with ctx.workflow(...), including deeper composition within the configured maxDepth; when workflow execution fits but another shape would better achieve the task, author a custom TypeScript workflow({...}) inline with normal coding tools, reload it, and run it; discover with list/get/inputs/models, list session runs with status (no runId; statusFilter narrows the list), inspect status/stages/stage details, send prompt answers or steering only while the root workflow is nonterminal, pause/resume/interrupt/quit runs, and reload workflow resources. For large stage handoffs, write context to files/artifacts, pass paths via reads, and prompt downstream agents to 'Read the file at <path>...' instead of injecting large previous text. For transcripts, prefer status/stages/stage to get sessionFile/transcriptPath, quote the exact path without rewriting separators (Windows backslashes are valid), then search it with rg/grep and read small ranges; transcript is path-only by default when sessionFile/transcriptPath exists, explicit tail/limit returns bounded previews, and missing transcript paths fall back to a small preview. Use action 'models' to inspect models in the configured catalog; the result is a configured-auth snapshot showing what's present in the registry with configured authentication, not proof of credentials, entitlements, OAuth freshness, or live provider access. When authoring a workflow that should dynamically select a model, first call workflow({ action: 'models' }) to inspect the configured catalog, then select from the returned provider/id entries considering the isCurrent marker and available thinking levels.",
609
+ "description": "Run named builtin, project, user, or package workflows; custom definitions may import reusable project/package workflows or builtin definitions from @bastani/workflows/builtin and nest them with ctx.workflow(...), including deeper composition within the configured maxDepth; when workflow execution fits but another shape would better achieve the task, author a custom TypeScript workflow({...}) inline with normal coding tools, reload it, and run it; after successfully creating and reloading a newly authored custom workflow, report the folder containing its generated code as 'Custom workflow created. You can inspect its code at: <workflow-folder-path>'; do this only for newly created custom workflows, never builtin or pre-existing workflows; discover with list/get/inputs/models, list session runs with status (no runId; statusFilter narrows the list), inspect status/stages/stage details, send prompt answers or steering only while the root workflow is nonterminal, pause/resume/interrupt/quit runs, and reload workflow resources. For large stage handoffs, write context to files/artifacts, pass paths via reads, and prompt downstream agents to 'Read the file at <path>...' instead of injecting large previous text. For transcripts, prefer status/stages/stage to get sessionFile/transcriptPath, quote the exact path without rewriting separators (Windows backslashes are valid), then search it with rg/grep and read small ranges; transcript is path-only by default when sessionFile/transcriptPath exists, explicit tail/limit returns bounded previews, and missing transcript paths fall back to a small preview. Use action 'models' to inspect models in the configured catalog; the result is a configured-auth snapshot showing what's present in the registry with configured authentication, not proof of credentials, entitlements, OAuth freshness, or live provider access. When authoring a workflow that should dynamically select a model, first call workflow({ action: 'models' }) to inspect the configured catalog, then select from the returned provider/id entries considering the isCurrent marker and available thinking levels.",
610
610
  "parameters": {
611
611
  "workflow": "string (optional) — workflow ID or normalized name",
612
612
  "inputs": "object (optional) — key/value map of workflow inputs",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bastani/workflows",
3
- "version": "0.9.11-alpha.7",
3
+ "version": "0.9.11-alpha.8",
4
4
  "private": true,
5
5
  "description": "Atomic extension for multi-stage workflow authoring and execution.",
6
6
  "contributors": [
@@ -1,12 +1,9 @@
1
- import type { CreateAgentSessionOptions } from "@bastani/atomic";
2
1
  import type { StageAdapters } from "../runs/foreground/stage-runner.js";
3
2
  import type { SessionManager } from "../shared/persistence-restore.js";
4
3
  import type { RunSnapshot } from "../shared/store-types.js";
5
4
  import type {
6
5
  WorkflowExecutionPolicy,
7
6
  WorkflowMcpPort,
8
- WorkflowModelCatalogPort,
9
- WorkflowModelInfo,
10
7
  WorkflowPersistencePort,
11
8
  WorkflowRuntimeConfig,
12
9
  } from "../shared/types.js";
@@ -43,6 +40,7 @@ import {
43
40
  workflowReloadDiagnostics,
44
41
  type WorkflowReloadReport,
45
42
  } from "./workflow-reload-report.js";
43
+ import { workflowModelCatalogFromContext } from "./workflow-model-catalog.js";
46
44
 
47
45
  export interface WorkflowExtensionRuntimeState {
48
46
  persistenceRef: { current: WorkflowPersistencePort | undefined };
@@ -171,27 +169,6 @@ export function createWorkflowExtensionRuntimeState(
171
169
  },
172
170
  };
173
171
 
174
- function workflowModelCatalogFromContext(ctx?: PiModelContext): WorkflowModelCatalogPort | undefined {
175
- if (ctx?.modelRegistry === undefined && ctx?.model === undefined) return undefined;
176
- return {
177
- listModels: async (): Promise<readonly WorkflowModelInfo[]> => {
178
- const available = ctx.modelRegistry?.getAvailable() ?? (ctx.model === undefined ? [] : [ctx.model]);
179
- return available.map((model) => ({
180
- provider: String(model.provider),
181
- id: model.id,
182
- fullId: `${String(model.provider)}/${model.id}`,
183
- model: model as NonNullable<CreateAgentSessionOptions["model"]>,
184
- }));
185
- },
186
- ...(ctx.model !== undefined
187
- ? {
188
- currentModel: ctx.model as NonNullable<CreateAgentSessionOptions["model"]>,
189
- preferredProvider: String(ctx.model.provider),
190
- }
191
- : {}),
192
- };
193
- }
194
-
195
172
  function runtimeForContext(ctx?: PiModelContext): ExtensionRuntime {
196
173
  const models = workflowModelCatalogFromContext(ctx);
197
174
  if (models === undefined) return runtimeProxy;
@@ -48527,7 +48527,7 @@ function asAgentSession(activeSession) {
48527
48527
  if (!activeSession)
48528
48528
  return;
48529
48529
  const candidate = activeSession;
48530
- if (candidate.state !== undefined && candidate.sessionManager !== undefined && candidate.modelRegistry !== undefined && typeof candidate.getContextUsage === "function") {
48530
+ if (candidate.state !== undefined && candidate.sessionManager !== undefined && candidate.modelRuntime !== undefined && typeof candidate.getContextUsage === "function") {
48531
48531
  return candidate;
48532
48532
  }
48533
48533
  return;
@@ -48637,8 +48637,8 @@ function buildStageSessionOptions(input) {
48637
48637
  options.context = undefined;
48638
48638
  options.forkFromSessionFile = undefined;
48639
48639
  }
48640
- if (input.sharedModelRegistry !== undefined && options.modelRegistry === undefined) {
48641
- options.modelRegistry = input.sharedModelRegistry;
48640
+ if (input.sharedModelRuntime !== undefined && options.modelRuntime === undefined) {
48641
+ options.modelRuntime = input.sharedModelRuntime;
48642
48642
  }
48643
48643
  return Object.keys(options).length === 0 ? undefined : options;
48644
48644
  }
@@ -49232,7 +49232,7 @@ class StageSessionController {
49232
49232
  candidatesPromise;
49233
49233
  activeCandidateIndex;
49234
49234
  selectedModel;
49235
- sharedModelRegistry;
49235
+ sharedModelRuntime;
49236
49236
  sharedOrchestrationContext;
49237
49237
  resumeCurrentSession = false;
49238
49238
  modelAttempts = [];
@@ -49486,7 +49486,7 @@ class StageSessionController {
49486
49486
  candidate,
49487
49487
  restoreSavedModel: resumeOptions?.restoreSavedModel,
49488
49488
  reattachSessionFile: this.reattachSessionFile,
49489
- sharedModelRegistry: this.sharedModelRegistry
49489
+ sharedModelRuntime: this.sharedModelRuntime
49490
49490
  });
49491
49491
  const created = this.opts.adapters.agentSession ? await this.opts.adapters.agentSession.create(stripWorkflowOnlyOptions2(stageOptions, this.opts.defaultSessionDir, this.meta), {
49492
49492
  ...this.meta,
@@ -49505,10 +49505,10 @@ class StageSessionController {
49505
49505
  result.session.sealWorkflowStageGeneration?.();
49506
49506
  this.replacement.adopt(result.session);
49507
49507
  this.session = result.session;
49508
- if (this.sharedModelRegistry === undefined) {
49508
+ if (this.sharedModelRuntime === undefined) {
49509
49509
  const withRegistry = result.session;
49510
- if (withRegistry.modelRegistry !== undefined)
49511
- this.sharedModelRegistry = withRegistry.modelRegistry;
49510
+ if (withRegistry.modelRuntime !== undefined)
49511
+ this.sharedModelRuntime = withRegistry.modelRuntime;
49512
49512
  }
49513
49513
  this.sessionSettingsManager = result.settingsManager ?? result.session.settingsManager;
49514
49514
  if (this.pendingThinkingLevel !== undefined)
@@ -68708,6 +68708,27 @@ function workflowReloadDiagnostics(configDiagnostics, discoveryDiagnostics) {
68708
68708
  ];
68709
68709
  }
68710
68710
 
68711
+ // dist/builtin/workflows/src/extension/workflow-model-catalog.ts
68712
+ function workflowModelCatalogFromContext(ctx) {
68713
+ if (ctx?.modelRegistry === undefined && ctx?.model === undefined)
68714
+ return;
68715
+ return {
68716
+ listModels: async () => {
68717
+ const available = ctx.modelRegistry?.getAvailable() ?? (ctx.model === undefined ? [] : [ctx.model]);
68718
+ return available.map((model) => ({
68719
+ provider: String(model.provider),
68720
+ id: model.id,
68721
+ fullId: `${String(model.provider)}/${model.id}`,
68722
+ model
68723
+ }));
68724
+ },
68725
+ ...ctx.model !== undefined ? {
68726
+ currentModel: ctx.model,
68727
+ preferredProvider: String(ctx.model.provider)
68728
+ } : {}
68729
+ };
68730
+ }
68731
+
68711
68732
  // dist/builtin/workflows/src/extension/extension-runtime-state.ts
68712
68733
  function createWorkflowExtensionRuntimeState(pi, adapters, resolveCwd = () => pi.sessionManager?.getCwd?.() ?? process.cwd()) {
68713
68734
  const persistenceRef = { current: makePersistencePort(pi, WORKFLOW_CONFIG_DEFAULTS.persistRuns) };
@@ -68818,25 +68839,6 @@ function createWorkflowExtensionRuntimeState(pi, adapters, resolveCwd = () => pi
68818
68839
  return open(workflowIdOrPrefix, catalog);
68819
68840
  }
68820
68841
  };
68821
- function workflowModelCatalogFromContext(ctx) {
68822
- if (ctx?.modelRegistry === undefined && ctx?.model === undefined)
68823
- return;
68824
- return {
68825
- listModels: async () => {
68826
- const available = ctx.modelRegistry?.getAvailable() ?? (ctx.model === undefined ? [] : [ctx.model]);
68827
- return available.map((model) => ({
68828
- provider: String(model.provider),
68829
- id: model.id,
68830
- fullId: `${String(model.provider)}/${model.id}`,
68831
- model
68832
- }));
68833
- },
68834
- ...ctx.model !== undefined ? {
68835
- currentModel: ctx.model,
68836
- preferredProvider: String(ctx.model.provider)
68837
- } : {}
68838
- };
68839
- }
68840
68842
  function runtimeForContext(ctx) {
68841
68843
  const models = workflowModelCatalogFromContext(ctx);
68842
68844
  if (models === undefined)
@@ -72233,7 +72235,7 @@ var WorkflowParametersSchema = Type21.Object({
72233
72235
  }, { additionalProperties: false });
72234
72236
 
72235
72237
  // dist/builtin/workflows/src/extension/workflow-prompts.ts
72236
- var WORKFLOW_TOOL_DESCRIPTION = "Run named builtin, project, user, or package workflows; custom definitions may import reusable project/package workflows or builtin definitions from @bastani/workflows/builtin and nest them with ctx.workflow(...), including deeper composition within the configured maxDepth; " + "when workflow execution fits but another shape would better achieve the task, author a custom TypeScript workflow({...}) inline with normal coding tools, reload it, and run it; " + "discover with list/get/inputs/models, list session runs with status (no runId; statusFilter narrows the list), inspect status/stages/stage details, " + "send prompt answers or steering only while the root workflow is nonterminal, pause/resume/interrupt/quit runs, and reload workflow resources. " + "For large stage handoffs, write context to files/artifacts, pass paths via reads, and prompt downstream agents to 'Read the file at <path>...' instead of injecting large previous text. " + "For transcripts, prefer status/stages/stage to get sessionFile/transcriptPath, " + "quote the exact path without rewriting separators (Windows backslashes are valid), " + "then search it with rg/grep and read small ranges; transcript is path-only by default when sessionFile/transcriptPath exists, explicit tail/limit returns bounded previews, and missing transcript paths fall back to a small preview. " + "Use action 'models' to inspect models in the configured catalog; the result is a configured-auth snapshot showing what's present in the registry with configured authentication, not proof of credentials, entitlements, OAuth freshness, or live provider access. " + "When authoring a workflow that should dynamically select a model, first call workflow({ action: 'models' }) to inspect the configured catalog, then select from the returned provider/id entries considering the isCurrent marker and available thinking levels.";
72238
+ var WORKFLOW_TOOL_DESCRIPTION = "Run named builtin, project, user, or package workflows; custom definitions may import reusable project/package workflows or builtin definitions from @bastani/workflows/builtin and nest them with ctx.workflow(...), including deeper composition within the configured maxDepth; " + "when workflow execution fits but another shape would better achieve the task, author a custom TypeScript workflow({...}) inline with normal coding tools, reload it, and run it; after successfully creating and reloading a newly authored custom workflow, report the folder containing its generated code as 'Custom workflow created. You can inspect its code at: <workflow-folder-path>'; do this only for newly created custom workflows, never builtin or pre-existing workflows; " + "discover with list/get/inputs/models, list session runs with status (no runId; statusFilter narrows the list), inspect status/stages/stage details, " + "send prompt answers or steering only while the root workflow is nonterminal, pause/resume/interrupt/quit runs, and reload workflow resources. " + "For large stage handoffs, write context to files/artifacts, pass paths via reads, and prompt downstream agents to 'Read the file at <path>...' instead of injecting large previous text. " + "For transcripts, prefer status/stages/stage to get sessionFile/transcriptPath, " + "quote the exact path without rewriting separators (Windows backslashes are valid), " + "then search it with rg/grep and read small ranges; transcript is path-only by default when sessionFile/transcriptPath exists, explicit tail/limit returns bounded previews, and missing transcript paths fall back to a small preview. " + "Use action 'models' to inspect models in the configured catalog; the result is a configured-auth snapshot showing what's present in the registry with configured authentication, not proof of credentials, entitlements, OAuth freshness, or live provider access. " + "When authoring a workflow that should dynamically select a model, first call workflow({ action: 'models' }) to inspect the configured catalog, then select from the returned provider/id entries considering the isCurrent marker and available thinking levels.";
72237
72239
  var DEFAULT_PROMPT_GUIDANCE = [
72238
72240
  `**Workflows**: Treat workflows as the default execution path for any non-trivial task and for any request that has inherent structure plus an objective you can make verifiable. Use the \`workflow\` tool for existing named workflows; when the task needs a graph that is not installed, author a custom TypeScript \`workflow({...})\` inline with normal coding tools, reload workflow resources, and run it.
72239
72241
  - Workflow fit check: prefer a workflow for implementation, build, debug/diagnosis, bug-fix, migration, new-feature, scoped multi-file, or docs/code changes with validation; and whenever there are multiple steps, dependencies, handoffs, uncertainty, review/validation needs, long-running work, measurable done criteria, or an outcome that needs evidence.
@@ -72268,6 +72270,7 @@ var DEFAULT_PROMPT_GUIDANCE = [
72268
72270
  - For transcripts, avoid whole-file reads. Get \`sessionFile\`/\`transcriptPath\` from \`stages\` or \`stage\`, preserve the exact path and platform separators, search with \`rg\`/\`grep\`, and read small relevant ranges; use explicit \`tail\` or \`limit\` only for a bounded preview.`,
72269
72271
  `**Workflow authoring and handoffs**:
72270
72272
  - When a user asks to create or edit a workflow, clarify only unresolved requirements that materially affect its purpose, inputs, stages, handoffs, validation, success criteria, or starter pattern. Read the workflow docs/examples, implement the TypeScript definition with normal coding tools, reload it, and run representative test inputs before presenting it. Use the create-spec skill when it adds value; it is not mandatory when context is already sufficient.
72273
+ - After creating and reloading a newly authored custom workflow, close the loop by stating the folder containing the workflow file just written, for example \`.atomic/workflows/\`, in this shape: \`Custom workflow created. You can inspect its code at: <workflow-folder-path>\`. Do this only for newly created custom workflows, never builtin or pre-existing workflows.
72271
72274
  - When creating or editing a workflow that pins an explicit stage \`model\` or \`fallbackModels\`, consult \`packages/coding-agent/docs/models/model-selection.md\` for role-based recommendations, then call \`workflow({ action: "models" })\` to see the models actually present in the user's configured catalog. Use only the catalog's returned \`fullId\` values as model strings, and append a thinking suffix only when that exact level appears in the entry's \`availableThinkingLevels\`; treat an absent or empty \`availableThinkingLevels\` as no suffix support rather than inferring one. If a guide-recommended model for the role is unavailable, try another guide-recommended model that is present in the catalog. If no recommendation intersects with the catalog, leave the stage unpinned rather than inventing a substitute, and mention the limitation, asking the user only if the workflow requires an explicit model choice. If the catalog is empty, continue with unpinned stages, state that no configured models were returned, and do not fabricate model IDs. Do not inspect or infer credentials, environment variables, auth files, token validity, entitlements, or the reason a model is absent; \`isCurrent\` marks the active selection, not a quality recommendation.
72272
72275
  - Consult docs/workflows.md and its starter patterns (Classify-and-act, Fan-out-and-synthesize, Adversarial verification, Generate-and-filter, Tournament, and Loop until done) when designing a stage graph.
72273
72276
  - Treat workflow composition as a first-class authoring option. Before duplicating stages, inspect reusable workflow modules and builtin exports; import their definitions and invoke them with \`ctx.workflow(...)\`, mapping typed inputs and consuming only declared outputs. Nested workflows can themselves import children, so combine small reusable graphs into a richer parent while respecting \`maxDepth\`.
@@ -0,0 +1,26 @@
1
+ import type { CreateAgentSessionOptions } from "@bastani/atomic";
2
+ import type { WorkflowModelCatalogPort, WorkflowModelInfo } from "../shared/types.js";
3
+ import type { PiModelContext } from "./public-types.js";
4
+
5
+ export function workflowModelCatalogFromContext(
6
+ ctx?: PiModelContext,
7
+ ): WorkflowModelCatalogPort | undefined {
8
+ if (ctx?.modelRegistry === undefined && ctx?.model === undefined) return undefined;
9
+ return {
10
+ listModels: async (): Promise<readonly WorkflowModelInfo[]> => {
11
+ const available = ctx.modelRegistry?.getAvailable() ?? (ctx.model === undefined ? [] : [ctx.model]);
12
+ return available.map((model) => ({
13
+ provider: String(model.provider),
14
+ id: model.id,
15
+ fullId: `${String(model.provider)}/${model.id}`,
16
+ model: model as NonNullable<CreateAgentSessionOptions["model"]>,
17
+ }));
18
+ },
19
+ ...(ctx.model !== undefined
20
+ ? {
21
+ currentModel: ctx.model as NonNullable<CreateAgentSessionOptions["model"]>,
22
+ preferredProvider: String(ctx.model.provider),
23
+ }
24
+ : {}),
25
+ };
26
+ }
@@ -1,6 +1,6 @@
1
1
  export const WORKFLOW_TOOL_DESCRIPTION =
2
2
  "Run named builtin, project, user, or package workflows; custom definitions may import reusable project/package workflows or builtin definitions from @bastani/workflows/builtin and nest them with ctx.workflow(...), including deeper composition within the configured maxDepth; " +
3
- "when workflow execution fits but another shape would better achieve the task, author a custom TypeScript workflow({...}) inline with normal coding tools, reload it, and run it; " +
3
+ "when workflow execution fits but another shape would better achieve the task, author a custom TypeScript workflow({...}) inline with normal coding tools, reload it, and run it; after successfully creating and reloading a newly authored custom workflow, report the folder containing its generated code as 'Custom workflow created. You can inspect its code at: <workflow-folder-path>'; do this only for newly created custom workflows, never builtin or pre-existing workflows; " +
4
4
  "discover with list/get/inputs/models, list session runs with status (no runId; statusFilter narrows the list), inspect status/stages/stage details, " +
5
5
  "send prompt answers or steering only while the root workflow is nonterminal, pause/resume/interrupt/quit runs, and reload workflow resources. " +
6
6
  "For large stage handoffs, write context to files/artifacts, pass paths via reads, and prompt downstream agents to 'Read the file at <path>...' instead of injecting large previous text. " +
@@ -44,6 +44,7 @@ export const DEFAULT_PROMPT_GUIDANCE: string[] = [
44
44
  - For transcripts, avoid whole-file reads. Get \`sessionFile\`/\`transcriptPath\` from \`stages\` or \`stage\`, preserve the exact path and platform separators, search with \`rg\`/\`grep\`, and read small relevant ranges; use explicit \`tail\` or \`limit\` only for a bounded preview.`,
45
45
  `**Workflow authoring and handoffs**:
46
46
  - When a user asks to create or edit a workflow, clarify only unresolved requirements that materially affect its purpose, inputs, stages, handoffs, validation, success criteria, or starter pattern. Read the workflow docs/examples, implement the TypeScript definition with normal coding tools, reload it, and run representative test inputs before presenting it. Use the create-spec skill when it adds value; it is not mandatory when context is already sufficient.
47
+ - After creating and reloading a newly authored custom workflow, close the loop by stating the folder containing the workflow file just written, for example \`.atomic/workflows/\`, in this shape: \`Custom workflow created. You can inspect its code at: <workflow-folder-path>\`. Do this only for newly created custom workflows, never builtin or pre-existing workflows.
47
48
  - When creating or editing a workflow that pins an explicit stage \`model\` or \`fallbackModels\`, consult \`packages/coding-agent/docs/models/model-selection.md\` for role-based recommendations, then call \`workflow({ action: "models" })\` to see the models actually present in the user's configured catalog. Use only the catalog's returned \`fullId\` values as model strings, and append a thinking suffix only when that exact level appears in the entry's \`availableThinkingLevels\`; treat an absent or empty \`availableThinkingLevels\` as no suffix support rather than inferring one. If a guide-recommended model for the role is unavailable, try another guide-recommended model that is present in the catalog. If no recommendation intersects with the catalog, leave the stage unpinned rather than inventing a substitute, and mention the limitation, asking the user only if the workflow requires an explicit model choice. If the catalog is empty, continue with unpinned stages, state that no configured models were returned, and do not fabricate model IDs. Do not inspect or infer credentials, environment variables, auth files, token validity, entitlements, or the reason a model is absent; \`isCurrent\` marks the active selection, not a quality recommendation.
48
49
  - Consult docs/workflows.md and its starter patterns (Classify-and-act, Fan-out-and-synthesize, Adversarial verification, Generate-and-filter, Tournament, and Loop until done) when designing a stage graph.
49
50
  - Treat workflow composition as a first-class authoring option. Before duplicating stages, inspect reusable workflow modules and builtin exports; import their definitions and invoke them with \`ctx.workflow(...)\`, mapping typed inputs and consuming only declared outputs. Nested workflows can themselves import children, so combine small reusable graphs into a richer parent while respecting \`maxDepth\`.
@@ -56,4 +57,4 @@ export const DEFAULT_PROMPT_GUIDANCE: string[] = [
56
57
  - Pass large stage context through files/artifacts and \`reads\` with an explicit \`Read the file at <path>...\` prompt rather than large \`previous\` payloads or injected session history.
57
58
  - Separate implementation/review acceptance from explicitly authorized final actions such as PR/MR/review creation, release tagging, deployment, or publication. Stop implementation loops once acceptance is proven and carry a remaining final action separately.
58
59
  - A model stage sees its local prompt, artifacts, tools, and reads, not the graph name or surrounding implementation. State the concrete action, evidence, and success criteria directly.`,
59
- ];
60
+ ];
@@ -35,7 +35,7 @@ export class StageSessionController {
35
35
  private candidatesPromise: Promise<WorkflowResolvedModelCandidate[]> | undefined;
36
36
  private activeCandidateIndex: number | undefined;
37
37
  private selectedModel: string | undefined;
38
- private sharedModelRegistry: CreateAgentSessionOptions["modelRegistry"];
38
+ private sharedModelRuntime: CreateAgentSessionOptions["modelRuntime"];
39
39
  private sharedOrchestrationContext: CreateAgentSessionOptions["orchestrationContext"];
40
40
  private resumeCurrentSession = false;
41
41
  private readonly modelAttempts: WorkflowModelAttempt[] = [];
@@ -299,7 +299,7 @@ export class StageSessionController {
299
299
  candidate,
300
300
  restoreSavedModel: resumeOptions?.restoreSavedModel,
301
301
  reattachSessionFile: this.reattachSessionFile,
302
- sharedModelRegistry: this.sharedModelRegistry,
302
+ sharedModelRuntime: this.sharedModelRuntime,
303
303
  });
304
304
  const created = this.opts.adapters.agentSession
305
305
  ? await this.opts.adapters.agentSession.create(
@@ -325,9 +325,9 @@ export class StageSessionController {
325
325
  if (this.generationSealed) result.session.sealWorkflowStageGeneration?.();
326
326
  this.replacement.adopt(result.session);
327
327
  this.session = result.session;
328
- if (this.sharedModelRegistry === undefined) {
329
- const withRegistry = result.session as Partial<Pick<AgentSession, "modelRegistry">>;
330
- if (withRegistry.modelRegistry !== undefined) this.sharedModelRegistry = withRegistry.modelRegistry;
328
+ if (this.sharedModelRuntime === undefined) {
329
+ const withRegistry = result.session as Partial<Pick<AgentSession, "modelRuntime">>;
330
+ if (withRegistry.modelRuntime !== undefined) this.sharedModelRuntime = withRegistry.modelRuntime;
331
331
  }
332
332
  this.sessionSettingsManager = result.settingsManager ?? result.session.settingsManager;
333
333
  if (this.pendingThinkingLevel !== undefined) result.session.setThinkingLevel(this.pendingThinkingLevel);
@@ -10,7 +10,7 @@ interface StageSessionOptionsInput {
10
10
  readonly candidate: WorkflowResolvedModelCandidate | undefined;
11
11
  readonly restoreSavedModel?: boolean;
12
12
  readonly reattachSessionFile: string | undefined;
13
- readonly sharedModelRegistry: CreateAgentSessionOptions["modelRegistry"];
13
+ readonly sharedModelRuntime: CreateAgentSessionOptions["modelRuntime"];
14
14
  }
15
15
 
16
16
  export function buildStageSessionOptions(input: StageSessionOptionsInput): StageOptions | undefined {
@@ -31,8 +31,8 @@ export function buildStageSessionOptions(input: StageSessionOptionsInput): Stage
31
31
  options.context = undefined;
32
32
  options.forkFromSessionFile = undefined;
33
33
  }
34
- if (input.sharedModelRegistry !== undefined && options.modelRegistry === undefined) {
35
- options.modelRegistry = input.sharedModelRegistry;
34
+ if (input.sharedModelRuntime !== undefined && options.modelRuntime === undefined) {
35
+ options.modelRuntime = input.sharedModelRuntime;
36
36
  }
37
37
  return Object.keys(options).length === 0 ? undefined : options;
38
38
  }
@@ -35,11 +35,11 @@ export async function disposeStageSession(current: StageSessionRuntime | undefin
35
35
 
36
36
  export function asAgentSession(activeSession: StageSessionRuntime | undefined): AgentSession | undefined {
37
37
  if (!activeSession) return undefined;
38
- const candidate = activeSession as StageSessionRuntime & Partial<Pick<AgentSession, "state" | "sessionManager" | "modelRegistry" | "getContextUsage">>;
38
+ const candidate = activeSession as StageSessionRuntime & Partial<Pick<AgentSession, "state" | "sessionManager" | "modelRuntime" | "getContextUsage">>;
39
39
  if (
40
40
  candidate.state !== undefined &&
41
41
  candidate.sessionManager !== undefined &&
42
- candidate.modelRegistry !== undefined &&
42
+ candidate.modelRuntime !== undefined &&
43
43
  typeof candidate.getContextUsage === "function"
44
44
  ) {
45
45
  return candidate as AgentSession;
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * List available models with optional fuzzy search
3
3
  */
4
- import type { ModelRegistry } from "../core/model-registry.ts";
4
+ import type { ModelRuntime } from "../core/model-runtime.ts";
5
5
  /**
6
6
  * List available models, optionally filtered by search pattern
7
7
  */
8
- export declare function listModels(modelRegistry: ModelRegistry, searchPattern?: string): Promise<void>;
8
+ export declare function listModels(modelRuntime: ModelRuntime, searchPattern?: string): Promise<void>;
9
9
  //# sourceMappingURL=list-models.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"list-models.d.ts","sourceRoot":"","sources":["../../src/cli/list-models.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAiB/D;;GAEG;AACH,wBAAsB,UAAU,CAAC,aAAa,EAAE,aAAa,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkFpG"}
1
+ {"version":3,"file":"list-models.d.ts","sourceRoot":"","sources":["../../src/cli/list-models.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAiB7D;;GAEG;AACH,wBAAsB,UAAU,CAAC,YAAY,EAAE,YAAY,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAkFlG"}
@@ -21,20 +21,20 @@ function formatTokenCount(count) {
21
21
  /**
22
22
  * List available models, optionally filtered by search pattern
23
23
  */
24
- export async function listModels(modelRegistry, searchPattern) {
25
- const loadError = modelRegistry.getError();
24
+ export async function listModels(modelRuntime, searchPattern) {
25
+ const loadError = modelRuntime.getError();
26
26
  if (loadError) {
27
27
  console.error(chalk.yellow(`Warning: errors loading models.json:\n${loadError}`));
28
28
  }
29
- const models = modelRegistry.getAvailable();
29
+ const models = modelRuntime.getAvailableSnapshot();
30
30
  if (models.length === 0) {
31
31
  console.log(formatNoModelsAvailableMessage());
32
32
  return;
33
33
  }
34
34
  // Apply fuzzy filter if search pattern provided
35
- let filteredModels = models;
35
+ let filteredModels = [...models];
36
36
  if (searchPattern) {
37
- filteredModels = fuzzyFilter(models, searchPattern, (m) => `${m.provider} ${m.id}`);
37
+ filteredModels = fuzzyFilter([...models], searchPattern, (m) => `${m.provider} ${m.id}`);
38
38
  }
39
39
  if (filteredModels.length === 0) {
40
40
  console.log(`No models matching "${searchPattern}"`);
@@ -1 +1 @@
1
- {"version":3,"file":"list-models.js","sourceRoot":"","sources":["../../src/cli/list-models.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAG1E;;GAEG;AACH,SAAS,gBAAgB,CAAC,KAAa;IACtC,IAAI,KAAK,IAAI,SAAS,EAAE,CAAC;QACxB,MAAM,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;QACnC,OAAO,QAAQ,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,GAAG,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IACxE,CAAC;IACD,IAAI,KAAK,IAAI,KAAK,EAAE,CAAC;QACpB,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK,CAAC;QAChC,OAAO,SAAS,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IAC3E,CAAC;IACD,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,aAA4B,EAAE,aAAsB;IACpF,MAAM,SAAS,GAAG,aAAa,CAAC,QAAQ,EAAE,CAAC;IAC3C,IAAI,SAAS,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,yCAAyC,SAAS,EAAE,CAAC,CAAC,CAAC;IACnF,CAAC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M,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;SAChC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACb,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;AACF,CAAC","sourcesContent":["/**\n * List available models with optional fuzzy search\n */\n\nimport type { Api, Model } from \"@earendil-works/pi-ai/compat\";\nimport { fuzzyFilter } from \"@earendil-works/pi-tui\";\nimport chalk from \"chalk\";\nimport { formatNoModelsAvailableMessage } from \"../core/auth-guidance.ts\";\nimport type { ModelRegistry } from \"../core/model-registry.ts\";\n\n/**\n * Format a number as human-readable (e.g., 200000 -> \"200K\", 1000000 -> \"1M\")\n */\nfunction formatTokenCount(count: number): string {\n\tif (count >= 1_000_000) {\n\t\tconst millions = count / 1_000_000;\n\t\treturn millions % 1 === 0 ? `${millions}M` : `${millions.toFixed(1)}M`;\n\t}\n\tif (count >= 1_000) {\n\t\tconst thousands = count / 1_000;\n\t\treturn thousands % 1 === 0 ? `${thousands}K` : `${thousands.toFixed(1)}K`;\n\t}\n\treturn count.toString();\n}\n\n/**\n * List available models, optionally filtered by search pattern\n */\nexport async function listModels(modelRegistry: ModelRegistry, searchPattern?: string): Promise<void> {\n\tconst loadError = modelRegistry.getError();\n\tif (loadError) {\n\t\tconsole.error(chalk.yellow(`Warning: errors loading models.json:\\n${loadError}`));\n\t}\n\n\tconst models = modelRegistry.getAvailable();\n\n\tif (models.length === 0) {\n\t\tconsole.log(formatNoModelsAvailableMessage());\n\t\treturn;\n\t}\n\n\t// Apply fuzzy filter if search pattern provided\n\tlet filteredModels: Model<Api>[] = models;\n\tif (searchPattern) {\n\t\tfilteredModels = fuzzyFilter(models, searchPattern, (m) => `${m.provider} ${m.id}`);\n\t}\n\n\tif (filteredModels.length === 0) {\n\t\tconsole.log(`No models matching \"${searchPattern}\"`);\n\t\treturn;\n\t}\n\n\t// Sort by provider, then by model id\n\tfilteredModels.sort((a, b) => {\n\t\tconst providerCmp = a.provider.localeCompare(b.provider);\n\t\tif (providerCmp !== 0) return providerCmp;\n\t\treturn a.id.localeCompare(b.id);\n\t});\n\n\t// Calculate column widths\n\tconst rows = filteredModels.map((m) => ({\n\t\tprovider: m.provider,\n\t\tmodel: m.id,\n\t\tcontext: formatTokenCount(m.contextWindow),\n\t\tmaxOut: formatTokenCount(m.maxTokens),\n\t\tthinking: m.reasoning ? \"yes\" : \"no\",\n\t\timages: m.input.includes(\"image\") ? \"yes\" : \"no\",\n\t}));\n\n\tconst headers = {\n\t\tprovider: \"provider\",\n\t\tmodel: \"model\",\n\t\tcontext: \"context\",\n\t\tmaxOut: \"max-out\",\n\t\tthinking: \"thinking\",\n\t\timages: \"images\",\n\t};\n\n\tconst widths = {\n\t\tprovider: Math.max(headers.provider.length, ...rows.map((r) => r.provider.length)),\n\t\tmodel: Math.max(headers.model.length, ...rows.map((r) => r.model.length)),\n\t\tcontext: Math.max(headers.context.length, ...rows.map((r) => r.context.length)),\n\t\tmaxOut: Math.max(headers.maxOut.length, ...rows.map((r) => r.maxOut.length)),\n\t\tthinking: Math.max(headers.thinking.length, ...rows.map((r) => r.thinking.length)),\n\t\timages: Math.max(headers.images.length, ...rows.map((r) => r.images.length)),\n\t};\n\n\t// Print header\n\tconst headerLine = [\n\t\theaders.provider.padEnd(widths.provider),\n\t\theaders.model.padEnd(widths.model),\n\t\theaders.context.padEnd(widths.context),\n\t\theaders.maxOut.padEnd(widths.maxOut),\n\t\theaders.thinking.padEnd(widths.thinking),\n\t\theaders.images.padEnd(widths.images),\n\t].join(\" \");\n\tconsole.log(headerLine);\n\n\t// Print rows\n\tfor (const row of rows) {\n\t\tconst line = [\n\t\t\trow.provider.padEnd(widths.provider),\n\t\t\trow.model.padEnd(widths.model),\n\t\t\trow.context.padEnd(widths.context),\n\t\t\trow.maxOut.padEnd(widths.maxOut),\n\t\t\trow.thinking.padEnd(widths.thinking),\n\t\t\trow.images.padEnd(widths.images),\n\t\t].join(\" \");\n\t\tconsole.log(line);\n\t}\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;QACb,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACnB,CAAC;AACF,CAAC","sourcesContent":["/**\n * List available models with optional fuzzy search\n */\n\nimport type { Api, Model } from \"@earendil-works/pi-ai/compat\";\nimport { fuzzyFilter } from \"@earendil-works/pi-tui\";\nimport chalk from \"chalk\";\nimport { formatNoModelsAvailableMessage } from \"../core/auth-guidance.ts\";\nimport type { ModelRuntime } from \"../core/model-runtime.ts\";\n\n/**\n * Format a number as human-readable (e.g., 200000 -> \"200K\", 1000000 -> \"1M\")\n */\nfunction formatTokenCount(count: number): string {\n\tif (count >= 1_000_000) {\n\t\tconst millions = count / 1_000_000;\n\t\treturn millions % 1 === 0 ? `${millions}M` : `${millions.toFixed(1)}M`;\n\t}\n\tif (count >= 1_000) {\n\t\tconst thousands = count / 1_000;\n\t\treturn thousands % 1 === 0 ? `${thousands}K` : `${thousands.toFixed(1)}K`;\n\t}\n\treturn count.toString();\n}\n\n/**\n * List available models, optionally filtered by search pattern\n */\nexport async function listModels(modelRuntime: ModelRuntime, searchPattern?: string): Promise<void> {\n\tconst loadError = modelRuntime.getError();\n\tif (loadError) {\n\t\tconsole.error(chalk.yellow(`Warning: errors loading models.json:\\n${loadError}`));\n\t}\n\n\tconst models = modelRuntime.getAvailableSnapshot();\n\n\tif (models.length === 0) {\n\t\tconsole.log(formatNoModelsAvailableMessage());\n\t\treturn;\n\t}\n\n\t// Apply fuzzy filter if search pattern provided\n\tlet filteredModels: Model<Api>[] = [...models];\n\tif (searchPattern) {\n\t\tfilteredModels = fuzzyFilter([...models], searchPattern, (m) => `${m.provider} ${m.id}`);\n\t}\n\n\tif (filteredModels.length === 0) {\n\t\tconsole.log(`No models matching \"${searchPattern}\"`);\n\t\treturn;\n\t}\n\n\t// Sort by provider, then by model id\n\tfilteredModels.sort((a, b) => {\n\t\tconst providerCmp = a.provider.localeCompare(b.provider);\n\t\tif (providerCmp !== 0) return providerCmp;\n\t\treturn a.id.localeCompare(b.id);\n\t});\n\n\t// Calculate column widths\n\tconst rows = filteredModels.map((m) => ({\n\t\tprovider: m.provider,\n\t\tmodel: m.id,\n\t\tcontext: formatTokenCount(m.contextWindow),\n\t\tmaxOut: formatTokenCount(m.maxTokens),\n\t\tthinking: m.reasoning ? \"yes\" : \"no\",\n\t\timages: m.input.includes(\"image\") ? \"yes\" : \"no\",\n\t}));\n\n\tconst headers = {\n\t\tprovider: \"provider\",\n\t\tmodel: \"model\",\n\t\tcontext: \"context\",\n\t\tmaxOut: \"max-out\",\n\t\tthinking: \"thinking\",\n\t\timages: \"images\",\n\t};\n\n\tconst widths = {\n\t\tprovider: Math.max(headers.provider.length, ...rows.map((r) => r.provider.length)),\n\t\tmodel: Math.max(headers.model.length, ...rows.map((r) => r.model.length)),\n\t\tcontext: Math.max(headers.context.length, ...rows.map((r) => r.context.length)),\n\t\tmaxOut: Math.max(headers.maxOut.length, ...rows.map((r) => r.maxOut.length)),\n\t\tthinking: Math.max(headers.thinking.length, ...rows.map((r) => r.thinking.length)),\n\t\timages: Math.max(headers.images.length, ...rows.map((r) => r.images.length)),\n\t};\n\n\t// Print header\n\tconst headerLine = [\n\t\theaders.provider.padEnd(widths.provider),\n\t\theaders.model.padEnd(widths.model),\n\t\theaders.context.padEnd(widths.context),\n\t\theaders.maxOut.padEnd(widths.maxOut),\n\t\theaders.thinking.padEnd(widths.thinking),\n\t\theaders.images.padEnd(widths.images),\n\t].join(\" \");\n\tconsole.log(headerLine);\n\n\t// Print rows\n\tfor (const row of rows) {\n\t\tconst line = [\n\t\t\trow.provider.padEnd(widths.provider),\n\t\t\trow.model.padEnd(widths.model),\n\t\t\trow.context.padEnd(widths.context),\n\t\t\trow.maxOut.padEnd(widths.maxOut),\n\t\t\trow.thinking.padEnd(widths.thinking),\n\t\t\trow.images.padEnd(widths.images),\n\t\t].join(\" \");\n\t\tconsole.log(line);\n\t}\n}\n"]}
@@ -1,7 +1,7 @@
1
1
  export function installAgentSessionAccessors(prototype) {
2
2
  Object.defineProperties(prototype, {
3
3
  orchestrationContext: { get() { return this._orchestrationContext; } },
4
- modelRegistry: { get() { return this._modelRegistry; } },
4
+ modelRuntime: { get() { return this._modelRuntime; } },
5
5
  state: { get() { return this.agent.state; } },
6
6
  model: { get() { return this.agent.state.model; } },
7
7
  thinkingLevel: { get() { return this.agent.state.thinkingLevel; } },
@@ -1 +1 @@
1
- {"version":3,"file":"agent-session-accessors.js","sourceRoot":"","sources":["../../src/core/agent-session-accessors.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,4BAA4B,CAAC,SAAuB;IACnE,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE;QAClC,oBAAoB,EAAE,EAAE,GAAG,KAAK,OAAO,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE;QACtE,aAAa,EAAE,EAAE,GAAG,KAAK,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE;QACxD,KAAK,EAAE,EAAE,GAAG,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;QAC7C,KAAK,EAAE,EAAE,GAAG,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;QACnD,aAAa,EAAE,EAAE,GAAG,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE;QACnE,WAAW,EAAE,EAAE,GAAG,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE;QAC/D,YAAY,EAAE,EAAE,GAAG,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE;QACjE,YAAY,EAAE,EAAE,GAAG,KAAK,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE;QACtD,YAAY,EAAE;YACb,GAAG;gBACF,OAAO,CACN,IAAI,C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CAAC,CAAC,CAAC,EAAE;QAC1D,qBAAqB,EAAE,EAAE,GAAG,KAAK,OAAO,IAAI,CAAC,eAAe,CAAC,oBAAoB,EAAE,CAAC,CAAC,CAAC,EAAE;QACxF,UAAU,EAAE,EAAE,GAAG,KAAK,OAAO,IAAI,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE;QAClE,gBAAgB,EAAE,EAAE,GAAG,KAAK,OAAO,IAAI,CAAC,eAAe,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE;QAC9E,aAAa,EAAE,EAAE,GAAG,KAAK,OAAO,IAAI,CAAC,qBAAqB,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE;QACxE,sBAAsB,EAAE,EAAE,GAAG,KAAK,OAAO,IAAI,CAAC,oBAAoB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE;QAClF,eAAe,EAAE,EAAE,GAAG,KAAK,OAAO,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE;KAC5D,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import type { AgentSessionInternalSurface as AgentSession } from \"./agent-session-methods.ts\";\n\nexport function installAgentSessionAccessors(prototype: AgentSession): void {\n\tObject.defineProperties(prototype, {\n\t\torchestrationContext: { get() { return this._orchestrationContext; } },\n\t\tmodelRegistry: { get() { return this._modelRegistry; } },\n\t\tstate: { get() { return this.agent.state; } },\n\t\tmodel: { get() { return this.agent.state.model; } },\n\t\tthinkingLevel: { get() { return this.agent.state.thinkingLevel; } },\n\t\tisStreaming: { get() { return this.agent.state.isStreaming; } },\n\t\tsystemPrompt: { get() { return this.agent.state.systemPrompt; } },\n\t\tretryAttempt: { get() { return this._retryAttempt; } },\n\t\tisCompacting: {\n\t\t\tget() {\n\t\t\t\treturn (\n\t\t\t\t\tthis._autoCompactionAbortController !== undefined ||\n\t\t\t\t\tthis._compactionAbortController !== undefined ||\n\t\t\t\t\tthis._branchSummaryAbortController !== undefined\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\tmessages: { get() { return this.agent.state.messages; } },\n\t\tsteeringMode: { get() { return this.agent.steeringMode; } },\n\t\tfollowUpMode: { get() { return this.agent.followUpMode; } },\n\t\tsessionFile: { get() { return this.sessionManager.getSessionFile(); } },\n\t\tsessionId: { get() { return this.sessionManager.getSessionId(); } },\n\t\tsessionName: { get() { return this.sessionManager.getSessionName(); } },\n\t\tscopedModels: { get() { return this._scopedModels; } },\n\t\tpromptTemplates: { get() { return this._resourceLoader.getPrompts().prompts; } },\n\t\tpendingMessageCount: { get() { return this._steeringMessages.length + this._followUpMessages.length; } },\n\t\tqueuedMessagesPaused: { get() { return this._queuedMessagesPaused; } },\n\t\tresourceLoader: { get() { return this._resourceLoader; } },\n\t\tautoCompactionEnabled: { get() { return this.settingsManager.getCompactionEnabled(); } },\n\t\tisRetrying: { get() { return this._retryPromise !== undefined; } },\n\t\tautoRetryEnabled: { get() { return this.settingsManager.getRetryEnabled(); } },\n\t\tisBashRunning: { get() { return this._bashAbortControllers.size > 0; } },\n\t\thasPendingBashMessages: { get() { return this._pendingBashMessages.length > 0; } },\n\t\textensionRunner: { get() { return this._extensionRunner; } },\n\t});\n}\n"]}
1
+ {"version":3,"file":"agent-session-accessors.js","sourceRoot":"","sources":["../../src/core/agent-session-accessors.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,4BAA4B,CAAC,SAAuB;IACnE,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE;QAClC,oBAAoB,EAAE,EAAE,GAAG,KAAK,OAAO,IAAI,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE;QACtE,YAAY,EAAE,EAAE,GAAG,KAAK,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE;QACtD,KAAK,EAAE,EAAE,GAAG,KAAK,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;QAC7C,KAAK,EAAE,EAAE,GAAG,KAAK,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InternalSurface as AgentSession } from \"./agent-session-methods.ts\";\n\nexport function installAgentSessionAccessors(prototype: AgentSession): void {\n\tObject.defineProperties(prototype, {\n\t\torchestrationContext: { get() { return this._orchestrationContext; } },\n\t\tmodelRuntime: { get() { return this._modelRuntime; } },\n\t\tstate: { get() { return this.agent.state; } },\n\t\tmodel: { get() { return this.agent.state.model; } },\n\t\tthinkingLevel: { get() { return this.agent.state.thinkingLevel; } },\n\t\tisStreaming: { get() { return this.agent.state.isStreaming; } },\n\t\tsystemPrompt: { get() { return this.agent.state.systemPrompt; } },\n\t\tretryAttempt: { get() { return this._retryAttempt; } },\n\t\tisCompacting: {\n\t\t\tget() {\n\t\t\t\treturn (\n\t\t\t\t\tthis._autoCompactionAbortController !== undefined ||\n\t\t\t\t\tthis._compactionAbortController !== undefined ||\n\t\t\t\t\tthis._branchSummaryAbortController !== undefined\n\t\t\t\t);\n\t\t\t},\n\t\t},\n\t\tmessages: { get() { return this.agent.state.messages; } },\n\t\tsteeringMode: { get() { return this.agent.steeringMode; } },\n\t\tfollowUpMode: { get() { return this.agent.followUpMode; } },\n\t\tsessionFile: { get() { return this.sessionManager.getSessionFile(); } },\n\t\tsessionId: { get() { return this.sessionManager.getSessionId(); } },\n\t\tsessionName: { get() { return this.sessionManager.getSessionName(); } },\n\t\tscopedModels: { get() { return this._scopedModels; } },\n\t\tpromptTemplates: { get() { return this._resourceLoader.getPrompts().prompts; } },\n\t\tpendingMessageCount: { get() { return this._steeringMessages.length + this._followUpMessages.length; } },\n\t\tqueuedMessagesPaused: { get() { return this._queuedMessagesPaused; } },\n\t\tresourceLoader: { get() { return this._resourceLoader; } },\n\t\tautoCompactionEnabled: { get() { return this.settingsManager.getCompactionEnabled(); } },\n\t\tisRetrying: { get() { return this._retryPromise !== undefined; } },\n\t\tautoRetryEnabled: { get() { return this.settingsManager.getRetryEnabled(); } },\n\t\tisBashRunning: { get() { return this._bashAbortControllers.size > 0; } },\n\t\thasPendingBashMessages: { get() { return this._pendingBashMessages.length > 0; } },\n\t\textensionRunner: { get() { return this._extensionRunner; } },\n\t});\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"agent-session-auto-compaction.d.ts","sourceRoot":"","sources":["../../src/core/agent-session-auto-compaction.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAKrE,OAAO,KAAK,EAAE,2BAA2B,IAAI,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE9F;;;;;;GAMG;AACH,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAElD,eAAO,MAAM,6CAA6C,IAAI,CAAC;AAc/D,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,gBAAgB,UAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAuIrI;AAED,wBAAgB,uBAAuB,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAEnF;AAmDD,wBAAgB,8BAA8B,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAQ1F;AAED,wBAAgB,mCAAmC,CAAC,gBAAgB,EAAE,gBAAgB,GAAG,OAAO,CAE/F;AAED;;GAEG;AAEH,wBAAgB,kDAAkD,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAQ3F;AAED;;;;;GAKG;AAEH,wBAAgB,4CAA4C,CAAC,IAAI,EAAE,YAAY,EAC9E,OAAO,EAAE,UAAU,GAAG,WAAW,EACjC,SAAS,EAAE,OAAO,GAChB,IAAI,CA4BN;AAED,wBAAsB,uCAAuC,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAI/F;AAED;;GAEG;AAEH,wBAAsB,0BAA0B,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAWlF;AAED;;;;;;GAMG;AAEH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAQrE;AAO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YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAWlF;AAED;;;;;;GAMG;AAEH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,CAQrE;AAOD,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,GAAG,WAAW,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAoFhI;AAED;;GAEG;AAEH,eAAO,MAAM,iCAAiC;;;;;;;;CAQ7C,CAAC"}
@@ -327,11 +327,8 @@ export async function _runAutoCompaction(reason, willRetry) {
327
327
  // before persistence or continuation, matching other provider-call failures.
328
328
  const result = await this._applyVerbatimCompaction({
329
329
  resolvePlannerAuth: async (candidate) => {
330
- const authResult = await this._modelRegistry.getApiKeyAndHeaders(candidate);
331
- if (!authResult.ok || (!authResult.apiKey && !authResult.headers)) {
332
- return undefined;
333
- }
334
- return { apiKey: authResult.apiKey, headers: authResult.headers, baseUrl: authResult.baseUrl };
330
+ const authResult = await this._getRequiredRequestAuth(candidate);
331
+ return authResult.apiKey || authResult.headers ? authResult : undefined;
335
332
  },
336
333
  abortController: this._autoCompactionAbortController,
337
334
  backupLabel: reason === "overflow" ? "overflow-auto-compact" : "auto-compact",