@bastani/atomic 0.10.14 → 0.10.15-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (341) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/_shared/dist-KOELCESV.js +2 -2
  3. package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
  4. package/dist/_shared/lib-4PES5P4V.js +2 -2
  5. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +3 -3
  6. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +3 -3
  7. package/dist/_shared/mode-shared-2QJSCUM6.js +3 -3
  8. package/dist/_shared/p1a-prewarm-XIU57JHF.js +3 -3
  9. package/dist/_shared/runtime-O4KCSG4C.js +2 -2
  10. package/dist/_shared/{sdk-B5LEWGGI.js → sdk-OHKMDJ74.js} +27 -5
  11. package/dist/_shared/{sdk-B5LEWGGI.js.map → sdk-OHKMDJ74.js.map} +1 -1
  12. package/dist/_shared/session-data-AHTU7IS6.js +2 -2
  13. package/dist/_shared/startup-0-0-Q3MWKUK4.js +2 -2
  14. package/dist/_shared/startup-0-1-M6OWAYHH.js +2 -2
  15. package/dist/_shared/{startup-0-2-5QHPCEON.js → startup-0-2-2HUMCPKX.js} +14 -16
  16. package/dist/_shared/startup-0-2-2HUMCPKX.js.map +1 -0
  17. package/dist/_shared/startup-0-3-4ZYBYQNM.js +3 -3
  18. package/dist/_shared/startup-0-4-ZMJV547D.js +3 -3
  19. package/dist/_shared/startup-0-5-YDW47QX6.js +3 -3
  20. package/dist/_shared/startup-10-0-TDQNBDDL.js +3 -3
  21. package/dist/_shared/startup-14-0-MLX36RBG.js +1 -1
  22. package/dist/_shared/startup-15-0-YUKGAC63.js +1 -1
  23. package/dist/_shared/startup-15-1-4S7FLMNG.js +6 -30
  24. package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
  25. package/dist/_shared/startup-8-0-34CBHPZH.js +3 -3
  26. package/dist/_shared/startup-8-1-LZFXSD3Z.js +3 -3
  27. package/dist/_shared/storage-command-7MGXLJGZ.js +2 -2
  28. package/dist/_shared/storage-status-K7PX2RXA.js +3 -3
  29. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
  30. package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
  31. package/dist/builtin/intercom/index.bundle.mjs +1 -1
  32. package/dist/builtin/intercom/package.json +1 -1
  33. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  34. package/dist/builtin/mcp/package.json +1 -1
  35. package/dist/builtin/subagents/package.json +1 -1
  36. package/dist/builtin/subagents/src/extension/index.bundle.mjs +1 -1
  37. package/dist/builtin/web-access/index.bundle.mjs +1 -1
  38. package/dist/builtin/web-access/package.json +1 -1
  39. package/dist/cli/auth-cli.code.js +1 -1
  40. package/dist/cli/auth-cli.impl.js +3 -3
  41. package/dist/cli/auth-cli.js +3 -3
  42. package/dist/cli/blueprint-command.impl.js +3 -3
  43. package/dist/cli/blueprint-command.js +3 -3
  44. package/dist/cli/intercom-command.code.js +3 -3
  45. package/dist/cli/intercom-command.impl.js +3 -3
  46. package/dist/cli/intercom-command.js +3 -3
  47. package/dist/cli/list-models.impl.js +3 -3
  48. package/dist/cli/list-models.js +3 -3
  49. package/dist/cli/session-picker.code.js +1 -1
  50. package/dist/cli/session-picker.impl.js +3 -3
  51. package/dist/cli/session-picker.js +3 -3
  52. package/dist/cli/startup-ui.code.js +1 -1
  53. package/dist/cli/startup-ui.impl.js +3 -3
  54. package/dist/cli/startup-ui.js +3 -3
  55. package/dist/cli/storage-command.impl.js +3 -3
  56. package/dist/cli/storage-command.js +3 -3
  57. package/dist/cli/storage-search-session.code.js +1 -1
  58. package/dist/cli/storage-search-session.impl.js +3 -3
  59. package/dist/cli/storage-search-session.js +3 -3
  60. package/dist/cli/team-command.code.js +1 -1
  61. package/dist/cli/team-command.impl.js +3 -3
  62. package/dist/cli/team-command.js +3 -3
  63. package/dist/cli.js +2 -2
  64. package/dist/core/compaction/compactor.d.ts +0 -8
  65. package/dist/core/debug.impl.js +3 -3
  66. package/dist/core/debug.js +3 -3
  67. package/dist/core/export-html/card-projection.impl.js +3 -3
  68. package/dist/core/export-html/card-projection.js +3 -3
  69. package/dist/core/export-html/index.code.js +2 -2
  70. package/dist/core/export-html/index.impl.js +3 -3
  71. package/dist/core/export-html/index.js +3 -3
  72. package/dist/core/export-html/json-spans.impl.js +3 -3
  73. package/dist/core/export-html/json-spans.js +3 -3
  74. package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
  75. package/dist/core/export-html/oversized-render-inputs.js +3 -3
  76. package/dist/core/export-html/tool-renderer.impl.js +3 -3
  77. package/dist/core/export-html/tool-renderer.js +3 -3
  78. package/dist/core/extensions/jiti-loader.impl.js +3 -3
  79. package/dist/core/extensions/jiti-loader.js +3 -3
  80. package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
  81. package/dist/core/extensions/jiti-static-loader.js +3 -3
  82. package/dist/core/extensions/loader-host-modules.impl.js +3 -3
  83. package/dist/core/extensions/loader-host-modules.js +3 -3
  84. package/dist/core/intercom-broker-control-host.code.js +1 -1
  85. package/dist/core/intercom-broker-control-host.impl.js +3 -3
  86. package/dist/core/intercom-broker-control-host.js +3 -3
  87. package/dist/core/intercom-broker-control.code.js +2 -2
  88. package/dist/core/intercom-broker-control.impl.js +3 -3
  89. package/dist/core/intercom-broker-control.js +3 -3
  90. package/dist/core/package-manager-storage-adapters.impl.js +3 -3
  91. package/dist/core/package-manager-storage-adapters.js +3 -3
  92. package/dist/core/sdk.code.js +1 -1
  93. package/dist/core/sdk.impl.js +3 -3
  94. package/dist/core/sdk.js +3 -3
  95. package/dist/core/session-manager-core.js +3 -3
  96. package/dist/core/session-manager-list.impl.js +3 -3
  97. package/dist/core/session-manager-list.js +3 -3
  98. package/dist/core/session-manager.impl.js +3 -3
  99. package/dist/core/session-manager.js +3 -3
  100. package/dist/core/session-storage.impl.js +3 -3
  101. package/dist/core/session-storage.js +3 -3
  102. package/dist/core/storage/index.js +2 -2
  103. package/dist/core/storage/node-sqlite-thread.js +2 -2
  104. package/dist/core/storage/node-sqlite.js +2 -2
  105. package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
  106. package/dist/core/storage/offline-snapshot-file.js +3 -3
  107. package/dist/core/storage/provider.js +2 -2
  108. package/dist/core/storage/selection.js +2 -2
  109. package/dist/core/storage/session/branch-fork-source.code.js +2 -2
  110. package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
  111. package/dist/core/storage/session/branch-fork-source.js +3 -3
  112. package/dist/core/storage/session/card-view.impl.js +3 -3
  113. package/dist/core/storage/session/card-view.js +3 -3
  114. package/dist/core/storage/session/child-reader.code.js +2 -2
  115. package/dist/core/storage/session/child-reader.impl.js +3 -3
  116. package/dist/core/storage/session/child-reader.js +3 -3
  117. package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
  118. package/dist/core/storage/session/chunked-resume-projection.js +3 -3
  119. package/dist/core/storage/session/expanded-child-details.code.js +2 -2
  120. package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
  121. package/dist/core/storage/session/expanded-child-details.js +3 -3
  122. package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
  123. package/dist/core/storage/session/fork-row-bytes.js +3 -3
  124. package/dist/core/storage/session/fork-row-index.impl.js +3 -3
  125. package/dist/core/storage/session/fork-row-index.js +3 -3
  126. package/dist/core/storage/session/fork-staging.code.js +1 -1
  127. package/dist/core/storage/session/fork-staging.impl.js +3 -3
  128. package/dist/core/storage/session/fork-staging.js +3 -3
  129. package/dist/core/storage/session/fork-window.code.js +2 -2
  130. package/dist/core/storage/session/fork-window.impl.js +3 -3
  131. package/dist/core/storage/session/fork-window.js +3 -3
  132. package/dist/core/storage/session/history-pages.impl.js +3 -3
  133. package/dist/core/storage/session/history-pages.js +3 -3
  134. package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
  135. package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
  136. package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
  137. package/dist/core/storage/session/jsonl-session-store.js +3 -3
  138. package/dist/core/storage/session/memory-session-store.impl.js +3 -3
  139. package/dist/core/storage/session/memory-session-store.js +3 -3
  140. package/dist/core/storage/session/pinned-branch-resume.code.js +2 -2
  141. package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
  142. package/dist/core/storage/session/pinned-branch-resume.js +3 -3
  143. package/dist/core/storage/session/released-history-files.code.js +1 -1
  144. package/dist/core/storage/session/released-history-files.impl.js +3 -3
  145. package/dist/core/storage/session/released-history-files.js +3 -3
  146. package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
  147. package/dist/core/storage/session/resident-fork-rows.js +3 -3
  148. package/dist/core/storage/session/session-resume.impl.js +3 -3
  149. package/dist/core/storage/session/session-resume.js +3 -3
  150. package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
  151. package/dist/core/storage/session/snapshot-cut.js +3 -3
  152. package/dist/core/storage/session/snapshot-history.code.js +2 -2
  153. package/dist/core/storage/session/snapshot-history.impl.js +3 -3
  154. package/dist/core/storage/session/snapshot-history.js +3 -3
  155. package/dist/core/storage/session/sql-session-store.code.js +1 -1
  156. package/dist/core/storage/session/sql-session-store.impl.js +3 -3
  157. package/dist/core/storage/session/sql-session-store.js +3 -3
  158. package/dist/core/storage/session/tree-outline.impl.js +3 -3
  159. package/dist/core/storage/session/tree-outline.js +3 -3
  160. package/dist/core/storage/session/tree-presentation.impl.js +3 -3
  161. package/dist/core/storage/session/tree-presentation.js +3 -3
  162. package/dist/core/storage/storage-status.impl.js +3 -3
  163. package/dist/core/storage/storage-status.js +3 -3
  164. package/dist/core/storage/team.impl.js +3 -3
  165. package/dist/core/storage/team.js +3 -3
  166. package/dist/core/structured-output/index.code.js +1 -1
  167. package/dist/core/structured-output/index.impl.js +3 -3
  168. package/dist/core/structured-output/index.js +3 -3
  169. package/dist/core/tasks/task-completion-entry.impl.js +3 -3
  170. package/dist/core/tasks/task-completion-entry.js +3 -3
  171. package/dist/core/tasks/task-file-history.code.js +2 -2
  172. package/dist/core/tasks/task-file-history.impl.js +3 -3
  173. package/dist/core/tasks/task-file-history.js +3 -3
  174. package/dist/core/tasks/task-reference-archive.code.js +2 -2
  175. package/dist/core/tasks/task-reference-archive.js +3 -3
  176. package/dist/core/tasks/task-reference-identity.js +3 -3
  177. package/dist/core/tasks/task-reference-stream.impl.js +3 -3
  178. package/dist/core/tasks/task-reference-stream.js +3 -3
  179. package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
  180. package/dist/core/tasks/task-unsaved-answer.js +3 -3
  181. package/dist/core/tasks/task-view-source.impl.js +3 -3
  182. package/dist/core/tasks/task-view-source.js +3 -3
  183. package/dist/core/tools/read-url.impl.js +3 -3
  184. package/dist/core/tools/read-url.js +3 -3
  185. package/dist/core/worktree-snapshot/blob-store.js +2 -2
  186. package/dist/core/worktree-snapshot/errors.code.js +1 -1
  187. package/dist/core/worktree-snapshot/errors.impl.js +3 -3
  188. package/dist/core/worktree-snapshot/errors.js +3 -3
  189. package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
  190. package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
  191. package/dist/extensions/codemode/execute.impl.js +3 -3
  192. package/dist/extensions/codemode/execute.js +3 -3
  193. package/dist/extensions/codemode/renderer.impl.js +3 -3
  194. package/dist/extensions/codemode/renderer.js +3 -3
  195. package/dist/extensions/mcp/cli.code.js +1 -1
  196. package/dist/extensions/mcp/cli.impl.js +3 -3
  197. package/dist/extensions/mcp/cli.js +3 -3
  198. package/dist/extensions/mcp/cli.lazy.code.js +2 -2
  199. package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
  200. package/dist/extensions/mcp/cli.lazy.js +3 -3
  201. package/dist/extensions/mcp/runtime.code.js +1 -1
  202. package/dist/extensions/mcp/runtime.impl.js +3 -3
  203. package/dist/extensions/mcp/runtime.js +3 -3
  204. package/dist/index.d.ts +21 -1
  205. package/dist/index.js +2 -2
  206. package/dist/main-first-time-setup.code.js +1 -1
  207. package/dist/main-first-time-setup.impl.js +3 -3
  208. package/dist/main-first-time-setup.js +3 -3
  209. package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
  210. package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
  211. package/dist/modes/interactive/components/stored-tree-view.js +3 -3
  212. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
  213. package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
  214. package/dist/modes/print-mode.js +1 -1
  215. package/dist/package-manager-cli.code.js +2 -2
  216. package/dist/package-manager-cli.impl.js +3 -3
  217. package/dist/package-manager-cli.js +3 -3
  218. package/dist/startup-files.json +1 -1
  219. package/dist/startup-stages/6.js +1 -1
  220. package/dist/utils/startup-database-spare.code.js +1 -1
  221. package/dist/utils/startup-database-spare.impl.js +3 -3
  222. package/dist/utils/startup-database-spare.js +3 -3
  223. package/dist/utils/tools-manager.impl.js +3 -3
  224. package/dist/utils/tools-manager.js +3 -3
  225. package/docs/background-tasks/reference.md +182 -0
  226. package/docs/background-tasks.md +98 -405
  227. package/docs/build.md +67 -27
  228. package/docs/changelog.mdx +1 -1
  229. package/docs/codemode.md +108 -39
  230. package/docs/compaction/branch-summaries.md +54 -0
  231. package/docs/compaction/custom-compactors.md +161 -0
  232. package/docs/compaction/memory-compaction.md +77 -0
  233. package/docs/compaction/reference.md +86 -38
  234. package/docs/compaction.md +51 -252
  235. package/docs/computer-use.md +169 -321
  236. package/docs/containerization.md +71 -57
  237. package/docs/custom-provider/api-reference.md +119 -25
  238. package/docs/custom-provider/oauth.md +114 -132
  239. package/docs/custom-provider/override.md +37 -27
  240. package/docs/custom-provider/registration.md +107 -83
  241. package/docs/custom-provider/streaming.md +85 -71
  242. package/docs/custom-provider.md +85 -52
  243. package/docs/development.md +39 -29
  244. package/docs/docs.json +76 -63
  245. package/docs/environment-variables.md +94 -44
  246. package/docs/extensions/api-reference.md +86 -43
  247. package/docs/extensions/authoring.md +162 -154
  248. package/docs/extensions/events.md +80 -25
  249. package/docs/extensions/examples.md +90 -85
  250. package/docs/extensions/ui.md +206 -82
  251. package/docs/extensions.md +79 -108
  252. package/docs/getting-started/authentication.md +67 -36
  253. package/docs/getting-started/first-session.md +53 -43
  254. package/docs/getting-started/installation.md +116 -89
  255. package/docs/getting-started/project-instructions.md +48 -34
  256. package/docs/guides/configuration.md +82 -20
  257. package/docs/guides/non-interactive.md +66 -24
  258. package/docs/guides/resume-on-any-machine.md +135 -82
  259. package/docs/guides/team-setup.md +114 -105
  260. package/docs/guides.md +76 -32
  261. package/docs/herdr.md +15 -16
  262. package/docs/how-atomic-works.md +140 -0
  263. package/docs/index.md +58 -44
  264. package/docs/intercom/operations.md +141 -151
  265. package/docs/intercom/reference.md +85 -108
  266. package/docs/intercom.md +84 -145
  267. package/docs/json.md +120 -67
  268. package/docs/keybindings.md +85 -49
  269. package/docs/libraries/agent-core.md +137 -275
  270. package/docs/libraries/ai.md +100 -84
  271. package/docs/libraries/codemode.md +210 -300
  272. package/docs/libraries/schema.md +59 -53
  273. package/docs/libraries/storage-postgres.md +49 -35
  274. package/docs/libraries/telemetry.md +153 -354
  275. package/docs/libraries/tui.md +265 -393
  276. package/docs/libraries.md +42 -26
  277. package/docs/llama-cpp.md +171 -161
  278. package/docs/mcp-servers.md +90 -51
  279. package/docs/models/choose-a-model.md +188 -0
  280. package/docs/models/reference.md +74 -30
  281. package/docs/models.md +153 -88
  282. package/docs/orchestration/migrating-workflows.md +23 -16
  283. package/docs/orchestration/patterns.md +39 -44
  284. package/docs/orchestration.md +65 -26
  285. package/docs/packages/authoring.md +51 -29
  286. package/docs/packages/reference.md +42 -21
  287. package/docs/packages.md +69 -58
  288. package/docs/programmatic.md +118 -24
  289. package/docs/prompt-templates.md +84 -83
  290. package/docs/providers/reference.md +43 -48
  291. package/docs/providers.md +219 -451
  292. package/docs/quickstart.md +140 -120
  293. package/docs/reference/cli.md +135 -97
  294. package/docs/reference.md +20 -18
  295. package/docs/rpc/examples.md +76 -20
  296. package/docs/rpc/extension-ui.md +64 -38
  297. package/docs/rpc/protocol.md +361 -110
  298. package/docs/rpc.md +57 -17
  299. package/docs/sdk/reference.md +409 -534
  300. package/docs/sdk/storage.md +53 -13
  301. package/docs/sdk/structured-decisions.md +82 -56
  302. package/docs/sdk/web-server.md +57 -43
  303. package/docs/sdk.md +106 -84
  304. package/docs/security.md +42 -64
  305. package/docs/session-format.md +62 -38
  306. package/docs/sessions.md +99 -214
  307. package/docs/settings.md +165 -195
  308. package/docs/shell-aliases.md +9 -6
  309. package/docs/skills/authoring.md +69 -48
  310. package/docs/skills/reference.md +51 -20
  311. package/docs/skills.md +99 -148
  312. package/docs/slash-commands.md +129 -0
  313. package/docs/storage/custom-adapters.md +160 -85
  314. package/docs/storage/jsonl.md +81 -66
  315. package/docs/storage/postgres/pgbouncer.md +120 -126
  316. package/docs/storage/postgres/tuning.md +120 -143
  317. package/docs/storage/postgres.md +314 -330
  318. package/docs/storage/sqlite.md +71 -42
  319. package/docs/storage.md +298 -302
  320. package/docs/subagents/authoring.md +55 -38
  321. package/docs/subagents/reference.md +73 -33
  322. package/docs/subagents.md +119 -187
  323. package/docs/terminal-setup.md +50 -38
  324. package/docs/termux.md +67 -41
  325. package/docs/themes/reference.md +23 -19
  326. package/docs/themes.md +142 -127
  327. package/docs/tmux.md +47 -55
  328. package/docs/tools.md +147 -109
  329. package/docs/tui/reference.md +166 -214
  330. package/docs/tui.md +196 -341
  331. package/docs/usage.md +118 -138
  332. package/docs/verification.md +79 -51
  333. package/docs/web-access.md +121 -101
  334. package/docs/windows.md +26 -27
  335. package/docs/worktree-snapshots/reference.md +245 -0
  336. package/docs/worktree-snapshots.md +71 -259
  337. package/package.json +8 -8
  338. package/dist/_shared/startup-0-2-5QHPCEON.js.map +0 -1
  339. package/docs/guides/intercom.md +0 -32
  340. package/docs/guides/orchestration.md +0 -28
  341. package/docs/guides/subagents.md +0 -37
@@ -10,7 +10,9 @@ Inside an Atomic extension, import it without installing it because the host pro
10
10
 
11
11
  `@bastani/atomic-ai` provides one LLM API across providers with provider collections, automatic auth resolution, token and cost tracking, and JSON-serializable contexts for mid-session model handoffs.
12
12
 
13
- **Note:** The chat catalog includes only models that support tool calling (function calling). Image and classifier catalogs use their operation-specific capabilities.
13
+ <Note>
14
+ The chat catalog includes only models that support tool calling (function calling). Image and classifier catalogs use their operation-specific capabilities.
15
+ </Note>
14
16
 
15
17
  ## Supported providers
16
18
 
@@ -60,7 +62,7 @@ Requires Node.js 24.20 or newer.
60
62
 
61
63
  Key root and subpath exports:
62
64
 
63
- - Root `@bastani/atomic-ai`: `createModels`, `createProvider`, `Type`/`Static`/`TSchema` (re-exported from TypeBox), thinking helpers (`DEFAULT_THINKING_BUDGETS`, `fittedThinkingBudget`, `thinkingBudgetForLevel`, `getSupportedThinkingLevels`, `clampThinkingLevel`), `OAuthRefreshRejectedError`, `GitHubCopilot*Error`, `cleanupSessionResources`, and `PI_AI_VERSION`.
65
+ - Root `@bastani/atomic-ai`: `createModels`, `createProvider`, `Type`/`Static`/`TSchema` (re-exported from TypeBox), thinking helpers (`DEFAULT_THINKING_BUDGETS`, `fittedThinkingBudget`, `thinkingBudgetForLevel`, `getSupportedThinkingLevels`, `clampThinkingLevel`), `OAuthRefreshRejectedError`, `GitHubCopilot*Error`, `cleanupSessionResources`, and `PI_AI_VERSION` (intentionally retains its legacy `PI_` prefix for compatibility).
64
66
  - Subpaths: `@bastani/atomic-ai/models`, `@bastani/atomic-ai/providers/<provider>`, `@bastani/atomic-ai/providers/all`, `@bastani/atomic-ai/api/<api-id>`, `@bastani/atomic-ai/utils/*`, `@bastani/atomic-ai/session-resources`, `@bastani/atomic-ai/bedrock-provider`, `@bastani/atomic-ai/lazy-bedrock-provider`, `@bastani/atomic-ai/oauth`, `@bastani/atomic-ai/bun-oauth`, `@bastani/atomic-ai/lazy-oauth`, and `@bastani/atomic-ai/compat`.
65
67
 
66
68
  ## Quick start
@@ -523,6 +525,25 @@ Stored credentials remain provider-scoped, so save the key under the provider ID
523
525
 
524
526
  Amazon Bedrock resolves ambient AWS credentials (`AWS_PROFILE`, access key pairs, `AWS_BEARER_TOKEN_BEDROCK`, ECS task roles, web identity tokens); its provider-owned login flow supports bearer tokens, AWS profiles, and the existing credential chain. Vertex AI resolves either an explicit key or gcloud Application Default Credentials plus project/location, with a provider-owned login flow for API keys, ADC, and service-account files.
525
527
 
528
+ ### Provider-scoped environment overrides
529
+
530
+ Pass `env` in stream options to scope provider configuration to a single request. Values in `env` take precedence over process environment variables for provider auth and configuration such as Cloudflare account IDs, Azure OpenAI settings, Vertex project and location, Bedrock settings, `ATOMIC_CACHE_RETENTION` (legacy alias `PI_CACHE_RETENTION`), and `HTTP_PROXY` / `HTTPS_PROXY`:
531
+
532
+ ```typescript
533
+ const models = builtinModels();
534
+ const model = models.getModel('cloudflare-ai-gateway', 'workers-ai/@cf/moonshotai/kimi-k2.6')!;
535
+
536
+ const response = await models.complete(model, context, {
537
+ env: {
538
+ CLOUDFLARE_API_KEY: '...',
539
+ CLOUDFLARE_ACCOUNT_ID: 'account-id',
540
+ CLOUDFLARE_GATEWAY_ID: 'gateway-id'
541
+ }
542
+ });
543
+ ```
544
+
545
+ Use this when one process needs different provider settings per request, or when ambient environment variables should not leak into a provider call.
546
+
526
547
  ## Tools
527
548
 
528
549
  Tools enable LLMs to interact with external systems. This library uses TypeBox schemas for type-safe tool definitions with automatic validation using TypeBox's built-in validator and value conversion utilities. TypeBox schemas can be serialized and deserialized as plain JSON, making them ideal for distributed systems.
@@ -645,12 +666,6 @@ context.messages.push({
645
666
  });
646
667
  ```
647
668
 
648
- ### Fireworks deferred tools
649
-
650
- Fireworks models using the Anthropic Messages API support native deferred tool loading. Keep your discovery tool in `context.tools`. After the discovery tool result, append a chronological system message with `toolsAdded` containing the newly discovered tool definitions (`toolsRemoved` when tools drop out). The adapter sends deferred schemas and `tool_reference` blocks while preserving ordinary result text and unsigned thinking during replay.
651
-
652
- Name the discovery tool `ToolSearch` or `tool_search` for Fireworks prompt-prefix deferral. Other discovery names serialize correctly but do not get that prefix optimization. Set `model.compat.supportsToolReferences` to `false` to send ordinary tool schemas instead. This feature does not apply to Fireworks Chat Completions models.
653
-
654
669
  ### Streaming tool calls with partial JSON
655
670
 
656
671
  During streaming, tool call arguments are progressively parsed as they arrive. This enables real-time UI updates before the complete arguments are available:
@@ -893,11 +908,20 @@ console.log(model.input); // ['text'] or ['text', 'image']
893
908
  console.log(model.output); // ['image'] or ['image', 'text']
894
909
  ```
895
910
 
911
+ ### Notes and limitations
912
+
913
+ - Image models and chat models share `Models` and `Provider`; list image models with `getModelsOfType('image')` and call `generateImages()`, never the chat streaming APIs.
914
+ - Image-generation models do not participate in tool calling.
915
+ - Outputs arrive in `AssistantImages.output` and can contain both base64-encoded `ImageContent` blocks and `TextContent` blocks. Check `model.output` and `model.input` for each model's capabilities.
916
+ - Like streaming APIs, image generation accepts options such as `apiKey`, `signal`, `headers`, `onPayload`, and `onResponse`, and results may include `stopReason`, `responseId`, and `usage`.
917
+ - To analyze images in a conversation or call tools, use the chat APIs with a vision-capable model.
918
+ - Built-in image generation is available through `openrouter` and `openai-images`.
919
+
896
920
  ### OpenAI Images API
897
921
 
898
922
  The `openai-images` provider serves OpenAI's GPT Image models (`gpt-image-2.6-sunburst`, `gpt-image-2.6-flare`, `gpt-image-2.5-sunburst`, `gpt-image-2.5-flare`, `gpt-image-2`, `gpt-image-1.5`, `gpt-image-1`, and `gpt-image-1-mini`) through the OpenAI Images API. It borrows the API key stored for `openai-api`, then `openai`, then `OPENAI_API_KEY`. A ChatGPT OAuth credential on `openai` is skipped, so with only OAuth stored those models are unavailable and `generateImages()` returns `Provider is not configured: openai-images`.
899
923
 
900
- Text blocks become the `prompt`. Requests without image blocks call `/images/generations`; requests with image blocks call `/images/edits` and upload each image block. `OpenAIImagesOptions` adds the request fields below, sending each only when set:
924
+ Text blocks become the `prompt`. Requests without image blocks call `/images/generations`; requests with image blocks call `/images/edits` and upload each image block:
901
925
 
902
926
  ```typescript
903
927
  import { getBuiltinImageModel } from '@bastani/atomic-ai/providers/all';
@@ -910,6 +934,8 @@ const result = await models.generateImages(flare, {
910
934
 
911
935
  Each returned image is an `ImageContent` block whose `mimeType` matches the response's `output_format`: `image/png`, `image/jpeg`, `image/webp`, `image/gif`, or `image/svg+xml`. An SVG block stores UTF-8 XML in `data` as base64; save GIFs with `.gif` and SVGs with `.svg`.
912
936
 
937
+ #### Request options (`OpenAIImagesOptions`)
938
+
913
939
  | Option | Sent as | Notes |
914
940
  | --- | --- | --- |
915
941
  | `size`, `quality`, `n`, `background` | same name | `n` is the number of images. `background: 'transparent'` needs `png` or `webp` output. |
@@ -924,7 +950,9 @@ Each returned image is an `ImageContent` block whose `mimeType` matches the resp
924
950
 
925
951
  GIF and SVG output are generation-only: they cannot be combined with input image blocks, SVG requires `n` of 1, and neither supports streaming, partial images, or `outputCompression`. `outputFormat: 'gif'` consumes more tokens as `frameCount` grows; `size` applies to each frame, and total frame dimensions must stay within the model's size limits.
926
952
 
927
- **Reference images, markup, and mask.** When sending input images, the first image without a `role` is the base image to edit and any remaining unroled images are references.
953
+ #### Reference images, markup, and mask
954
+
955
+ When sending input images, the first image without a `role` is the base image to edit and any remaining unroled images are references.
928
956
 
929
957
  Set `role: 'markup'` on a transparent PNG with annotations (circles or sketches) to send it as the `markup` field guiding edits to the base image; it must match the base image's dimensions. Set `role: 'mask'` on an image with an alpha channel to send it as the `mask` field. Markup and mask images do not count as references, each request accepts at most one of either, and you cannot send both together. Markup-guided edits work on GPT Image 2.5 and 2.6.
930
958
 
@@ -938,21 +966,23 @@ await models.generateImages(flare, {
938
966
  }, { quality: 'medium' });
939
967
  ```
940
968
 
941
- **Validation.** Invalid requests fail locally before sending anything, returning an `ImageGenerationConfigError` with `field`, `reason`, and a hint for what to change. Checks cover out-of-range values, `frameCount` or `frameDurationMs` without GIF output, GIF or SVG on an edit, SVG with `n` above 1, `outputCompression` outside `jpeg` or `webp`, `svg` without SVG output, markup combined with a mask, a role image without a base image, duplicate roles, and features not declared by the model.
969
+ #### Local validation
942
970
 
943
- Models declare optional features in `ImageModel.capabilities`; undeclared features are treated as unsupported, so custom `openai-images` models must set `capabilities` to use them. Validation runs both before `onPayload` sees the request and again on the final payload after `onPayload` returns or mutates it. `reason` is one of:
971
+ Invalid requests fail locally before sending anything, returning an `ImageGenerationConfigError` with `field`, `reason`, and a hint for what to change. Models declare optional features in `ImageModel.capabilities`; undeclared features are treated as unsupported, so custom `openai-images` models must set `capabilities` to use them. Validation runs both before `onPayload` sees the request and again on the final payload after `onPayload` returns or mutates it.
944
972
 
945
973
  | `reason` | When it fires | What to do |
946
974
  | --- | --- | --- |
947
- | `out-of-range` | `frameCount` outside 2-16, `frameDurationMs` outside 20-2000, `outputCompression` outside 0-100 (or not an integer), or `safetyIdentifier` longer than 128 characters. The bounds are in `OPENAI_IMAGES_LIMITS`. | Use a value within the bounds. |
975
+ | `out-of-range` | `frameCount` outside 2-16, `frameDurationMs` outside 20-2000, `outputCompression` outside 0-100 (or not an integer), or `safetyIdentifier` longer than 128 characters. Bounds are in `OPENAI_IMAGES_LIMITS`. | Use a value within the bounds. |
948
976
  | `requires-option` | `frameCount` or `frameDurationMs` without `outputFormat: "gif"`, or `svg` without `outputFormat: "svg"`. `related` names the missing option. | Set the option in `related`, or remove `field`. |
949
- | `conflicts-with-option` | SVG output with `n` above 1; `outputCompression` with `png`, `gif`, `svg`, or no format; `background: "transparent"` with `jpeg`, `gif`, or `svg`; a markup image together with a mask image; GIF or SVG output with streaming or partial images. | Remove `field` or the option named in `related`. |
950
- | `generation-only` | GIF or SVG output on a request with input images, which goes to the edits endpoint. | Remove the input images, or choose `png`, `jpeg`, or `webp`. |
977
+ | `conflicts-with-option` | SVG output with `n` above 1; `outputCompression` with `png`, `gif`, `svg`, or no format; `background: "transparent"` with `jpeg`, `gif`, or `svg`; markup combined with mask; GIF or SVG with streaming or partial images. | Remove `field` or the option named in `related`. |
978
+ | `generation-only` | GIF or SVG output on a request with input images (edits endpoint). | Remove the input images, or choose `png`, `jpeg`, or `webp`. |
951
979
  | `unsupported-by-model` | `complexity`, GIF, SVG, or markup on a model whose `capabilities` do not declare it. GPT Image 2.6 declares all four; GPT Image 2.5 declares markup; older models declare none. | Use a model that declares the feature. |
952
- | `requires-base-image` | An image with `role: "markup"` or `role: "mask"` but no image without a role for it to apply to. | Put the base image first, without a role. |
980
+ | `requires-base-image` | An image with `role: "markup"` or `role: "mask"` and no unroled base image. | Put the base image first, without a role. |
953
981
  | `duplicate-role` | Two images with `role: "markup"`, or two with `role: "mask"`. | Send at most one image per role. |
954
982
 
955
- **Errors.** `generateImages()` resolves with `stopReason: 'error'`, `errorMessage`, and a JSON-safe `error` (`ImageGenerationErrorData`). Rehydrate the typed error with `imageGenerationErrorFromData(result.error)` and branch on its class, guard, `code`, or `retryable` rather than parsing message text. Cancellation resolves with `stopReason: 'aborted'` and no `error`.
983
+ #### Structured errors
984
+
985
+ `generateImages()` resolves with `stopReason: 'error'`, `errorMessage`, and a JSON-safe `error` (`ImageGenerationErrorData`). Rehydrate the typed error with `imageGenerationErrorFromData(result.error)` and branch on its class, guard, `code`, or `retryable` rather than parsing message text. Cancellation resolves with `stopReason: 'aborted'` and no `error`.
956
986
 
957
987
  The typed error retains only the HTTP status and the provider's type, code, and request ID in `detail` and its message; it excludes the provider's raw message because that can quote the prompt, while `errorMessage` keeps the provider's text.
958
988
 
@@ -967,22 +997,7 @@ The typed error retains only the HTTP status and the provider's type, code, and
967
997
  | `ImageModerationBlockedError` (`isImageModerationBlockedError`) | `moderation-blocked` | `error.code` is `moderation_blocked`. | No | `moderationStage` (`input`, `output`, `unknown`), `categories` |
968
998
  | `ImageGenerationTimeoutError` (`isImageGenerationTimeoutError`) | `timeout` | The request exceeded `timeoutMs`. | Yes | `timeoutMs`, `elapsedMs`, `phase` |
969
999
 
970
- All classes extend `ImageGenerationError`, and `isImageGenerationError()` matches any of them. Type guards check either class instances or serialized objects from another process whose `name` and `code` match.
971
-
972
- Use `findImageGenerationError(error, guard)` to search a `cause` chain (up to 8 links), for example `findImageGenerationError(error, isImageGenerationQuotaError)`, and `isRetryableImageGenerationError()` to test whether the nearest matching error in the chain is retryable. `result.error` preserves up to 8 cause-chain links: family causes retain their structured data, while foreign causes keep a safe name and any known errno code with their message replaced by `[foreign error message omitted]`.
973
-
974
- With `maxRetries`, rate-limit and server errors retry automatically while quota and user errors do not. Usage on an SVG request tracks the image model only; OpenAI reports the SVG-authoring model's tokens separately as `svg_usage`, which is not added to `usage` or its cost.
975
-
976
- ### Notes and limitations
977
-
978
- - Image models and chat models share `Models` and `Provider`; list image models with `getModelsOfType('image')` and call `generateImages()`, never the chat streaming APIs.
979
- - Image-generation models do not participate in tool calling.
980
- - Outputs arrive in `AssistantImages.output` and can contain both base64-encoded `ImageContent` blocks and `TextContent` blocks.
981
- - Some models return only images while others return images plus text; check `model.output`.
982
- - Some models accept image input while others are text-to-image only; check `model.input`.
983
- - Like streaming APIs, image generation accepts options such as `apiKey`, `signal`, `headers`, `onPayload`, and `onResponse`, and results may include `stopReason`, `responseId`, and `usage`.
984
- - To analyze images in a conversation or call tools, use the chat APIs with a vision-capable model.
985
- - Built-in image generation is available through `openrouter` and `openai-images`.
1000
+ All classes extend `ImageGenerationError`, and `isImageGenerationError()` matches any of them (including serialized objects from another process whose `name` and `code` match). Use `findImageGenerationError(error, guard)` to search a `cause` chain (up to 8 links) and `isRetryableImageGenerationError()` to test retryability. With `maxRetries`, rate-limit and server errors retry automatically while quota and user errors do not. Usage on an SVG request tracks the image model only; OpenAI reports the SVG-authoring model's tokens separately as `svg_usage`, which is not added to `usage` or its cost.
986
1001
 
987
1002
  ## Classification
988
1003
 
@@ -1128,13 +1143,7 @@ for (const block of response.content) {
1128
1143
  }
1129
1144
  ```
1130
1145
 
1131
- `xhigh` and `max` are model-specific, opt-in levels. Use `getSupportedThinkingLevels(model)` to determine whether a concrete model exposes either level; models such as GPT-5.6 can expose both.
1132
-
1133
- | Model | Providers | Levels | `off` | `minimal` |
1134
- | --- | --- | --- | --- | --- |
1135
- | GPT-6.2 Astra, GPT-6.2 Sol | OpenAI, Azure and Codex Responses | `low`, `medium`, `high`, `xhigh`, `max` | No | No |
1136
- | GPT-6.1 Sol | OpenAI, Azure and Codex Responses | `low`, `medium`, `high`, `xhigh`, `max` | No | Codex UI alias that sends `low` |
1137
- | GPT-6.1 Terra | OpenAI, Azure and Codex Responses | `off`, `low`, `medium`, `high`, `xhigh`, `max` | Sends reasoning effort `none` | Codex UI alias that sends `low` |
1146
+ `xhigh` and `max` are model-specific, opt-in levels, and some models also omit `off` or `minimal`. Call `getSupportedThinkingLevels(model)` to inspect the exact levels a concrete model supports (and `clampThinkingLevel()` to normalize a requested level). For OpenAI/Codex model-specific reasoning levels, see [OpenAI and Codex](#openai-and-codex).
1138
1147
 
1139
1148
  ### Provider-specific options (`stream` / `complete`)
1140
1149
 
@@ -1686,6 +1695,10 @@ Every provider accepts messages produced by other providers, including text, too
1686
1695
 
1687
1696
  ## System messages
1688
1697
 
1698
+ <Note>
1699
+ **For custom provider and adapter authors:** Ordinary application callers pass `systemPrompt` and `tools` on `Context` and rarely construct `SystemMessage` directly. The wire details below apply when building custom providers or managing mid-conversation system/tool transitions.
1700
+ </Note>
1701
+
1689
1702
  Public entry points (`Models.stream()`, `streamSimple()`, `complete()`, and `completeSimple()`) accept `Context` and normalize `systemPrompt` and `tools` into a leading system message. Provider implementations, `ProviderStreams`, and direct API modules receive a `TranscriptContext` containing only `messages`.
1690
1703
 
1691
1704
  ```typescript
@@ -1745,7 +1758,9 @@ const continuation = await models.complete(newModel, restored);
1745
1758
 
1746
1759
  Models are plain serializable data with no attached functions, so you can store the active model with `JSON.stringify()` as well.
1747
1760
 
1748
- > **Note**: If the context contains base64-encoded images (as shown in Image input), they are serialized with the context.
1761
+ <Note>
1762
+ If the context contains base64-encoded images (as shown in [Image input](#image-input)), they are serialized inline with the context.
1763
+ </Note>
1749
1764
 
1750
1765
  ## Browser usage
1751
1766
 
@@ -1766,7 +1781,9 @@ const response = await models.complete(model, {
1766
1781
  });
1767
1782
  ```
1768
1783
 
1769
- > **Security warning**: Exposing API keys in frontend code lets anyone extract and abuse them. Only use direct browser keys for internal tools or demos; in production, proxy requests through a backend.
1784
+ <Warning>
1785
+ Exposing API keys in frontend browser code lets anyone extract and abuse them. Use direct browser keys only for internal tools or demos; in production, proxy requests through a backend (see [`streamProxy()` in `@bastani/atomic-agent-core`](/libraries/agent-core#proxy-usage)).
1786
+ </Warning>
1770
1787
 
1771
1788
  Browser compatibility notes:
1772
1789
 
@@ -1842,25 +1859,6 @@ registerLazyOAuthFlows();
1842
1859
 
1843
1860
  Both modules are Node-only; never import them into a browser bundle.
1844
1861
 
1845
- ### Provider-scoped environment overrides
1846
-
1847
- Pass `env` in stream options to scope provider configuration to a request. Values in `env` take precedence over process environment variables for provider auth and configuration such as Cloudflare account IDs, Azure OpenAI settings, Vertex project and location, Bedrock settings, `ATOMIC_CACHE_RETENTION` (legacy alias `PI_CACHE_RETENTION`), and `HTTP_PROXY` / `HTTPS_PROXY`.
1848
-
1849
- ```typescript
1850
- const models = builtinModels();
1851
- const model = models.getModel('cloudflare-ai-gateway', 'workers-ai/@cf/moonshotai/kimi-k2.6')!;
1852
-
1853
- const response = await models.complete(model, context, {
1854
- env: {
1855
- CLOUDFLARE_API_KEY: '...',
1856
- CLOUDFLARE_ACCOUNT_ID: 'account-id',
1857
- CLOUDFLARE_GATEWAY_ID: 'gateway-id'
1858
- }
1859
- });
1860
- ```
1861
-
1862
- Use this when one process needs different provider settings per request, or when ambient environment variables should not leak into a provider call.
1863
-
1864
1862
  ## OAuth providers
1865
1863
 
1866
1864
  These built-in providers support OAuth authentication in addition to or instead of static API keys:
@@ -1914,15 +1912,33 @@ await models.logout('anthropic');
1914
1912
 
1915
1913
  For OpenAI Sign in with ChatGPT, pass a fourth `LoginOptions` argument with `getDeviceId: () => installationUuid`. Persist this UUID and return the same value on later logins. The login registers a user-owned client and stores its issued client ID and granted scopes with the credential. Direct ChatGPT access omits unsupported temperature, output-token limits, and cache-retention fields. If its shared subscription limit is exhausted, check [ChatGPT usage](https://chatgpt.com/settings/usage).
1916
1914
 
1915
+ ### CLI login
1916
+
1917
+ `@bastani/atomic-ai` ships the `atomic-ai` binary (with `pi-ai` kept as a legacy alias) to log into built-in **OAuth** providers:
1918
+
1919
+ ```bash
1920
+ npx @bastani/atomic-ai login # interactive OAuth provider selection
1921
+ npx @bastani/atomic-ai login anthropic # log into a specific OAuth provider
1922
+ npx @bastani/atomic-ai list # list OAuth-enabled providers
1923
+ # Or when installed locally/globally:
1924
+ atomic-ai login anthropic
1925
+ ```
1926
+
1927
+ The CLI lists only providers that support OAuth (`provider.auth.oauth`), and writes credentials to `auth.json` in the current working directory with owner-only permissions (`0600`).
1928
+
1929
+ ### Programmatic OAuth
1930
+
1931
+ Built-in login and refresh flows are private provider implementations. Use provider-owned `OAuthAuth`, which composes with `CredentialStore` and gets locked auto-refresh through `Models`. The `@bastani/atomic-ai/oauth` entry point retains only type declarations required for extension OAuth compatibility.
1932
+
1933
+ ## Provider-specific notes
1934
+
1917
1935
  ### Vertex AI
1918
1936
 
1919
1937
  Vertex AI models support either a Google Cloud API key or Application Default Credentials (ADC). Its provider-owned API-key login flow can configure either method:
1920
1938
 
1921
- - **API key**: Set `GOOGLE_CLOUD_API_KEY` or pass `apiKey` in the call options.
1922
- - **Local development (ADC)**: Run `gcloud auth application-default login`
1923
- - **CI/Production (ADC)**: Set `GOOGLE_APPLICATION_CREDENTIALS` to point to a service account JSON key file
1924
-
1925
- When using ADC, also set `GOOGLE_CLOUD_PROJECT` (or `GCLOUD_PROJECT`) and `GOOGLE_CLOUD_LOCATION`. You can also pass `project` and `location` in the call options. When using `GOOGLE_CLOUD_API_KEY`, `project` and `location` are not required.
1939
+ - **API key:** Set `GOOGLE_CLOUD_API_KEY` or pass `apiKey` in the call options (`project` and `location` are not required).
1940
+ - **Local development (ADC):** Run `gcloud auth application-default login` and set `GOOGLE_CLOUD_PROJECT` (or `GCLOUD_PROJECT`) and `GOOGLE_CLOUD_LOCATION` (or pass `project` and `location` in call options).
1941
+ - **CI/Production (ADC):** Set `GOOGLE_APPLICATION_CREDENTIALS` to a service account JSON key file alongside project and location.
1926
1942
 
1927
1943
  ```bash
1928
1944
  # Local (uses your user credentials)
@@ -1936,35 +1952,35 @@ export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"
1936
1952
 
1937
1953
  Official docs: [Application Default Credentials](https://cloud.google.com/docs/authentication/application-default-credentials)
1938
1954
 
1939
- ### CLI login
1955
+ ### Azure
1940
1956
 
1941
- `@bastani/atomic-ai` ships the `atomic-ai` binary (with `pi-ai` kept as a legacy alias) to log into built-in **OAuth** providers:
1957
+ Supports both Azure OpenAI Responses (`azure-openai-responses`) and Microsoft Foundry Chat Completions (`openai-completions`, such as `deepseek-v4-pro`). Set `AZURE_OPENAI_API_KEY` and either `AZURE_OPENAI_BASE_URL` or `AZURE_OPENAI_RESOURCE_NAME`. `AZURE_OPENAI_BASE_URL` accepts `https://<resource>.openai.azure.com`, `https://<resource>.cognitiveservices.azure.com`, and `https://<resource>.ai.azure.com` (including `*.services.ai.azure.com`); root endpoints normalize to `/openai/v1` automatically.
1942
1958
 
1943
- ```bash
1944
- npx @bastani/atomic-ai login # interactive OAuth provider selection
1945
- npx @bastani/atomic-ai login anthropic # log into a specific OAuth provider
1946
- npx @bastani/atomic-ai list # list OAuth-enabled providers
1947
- # Or when installed locally/globally:
1948
- atomic-ai login anthropic
1949
- ```
1959
+ Use `AZURE_OPENAI_API_VERSION` (defaults to `v1`) to override the API version. Deployment names default to model IDs and can be overridden with `azureDeploymentName` or `AZURE_OPENAI_DEPLOYMENT_NAME_MAP` using comma-separated `model-id=deployment` pairs (for example `gpt-4o-mini=my-deployment,gpt-4o=prod`). Legacy deployment-based URLs are not supported.
1950
1960
 
1951
- The CLI lists only providers that support OAuth (`provider.auth.oauth`), and writes credentials to `auth.json` in the current working directory with owner-only permissions (`0600`).
1961
+ ### OpenAI and Codex
1952
1962
 
1953
- ### Programmatic OAuth
1963
+ OpenAI Codex requires a ChatGPT subscription with model access and includes GPT-6.2 Sol and Codex models with extended context windows and reasoning capabilities. Prompt caching is enabled automatically when `sessionId` is provided unless `cacheRetention` is `"none"`. Set `transport` to `"sse"`, `"websocket"`, or `"auto"` for Codex Responses transport selection; WebSocket connections with `sessionId` and caching enabled reuse connections per session and expire after 5 minutes of inactivity.
1954
1964
 
1955
- Built-in login and refresh flows are private provider implementations. Use provider-owned `OAuthAuth`, which composes with `CredentialStore` and gets locked auto-refresh through `Models`. The `@bastani/atomic-ai/oauth` entry point retains only type declarations required for extension OAuth compatibility.
1965
+ Call `cleanupSessionResources(sessionId)` (imported from `@bastani/atomic-ai`) when finished with a Codex session so its pooled WebSocket connection does not keep the process alive.
1956
1966
 
1957
- Provider notes:
1967
+ Model-specific reasoning levels across OpenAI, Azure, and Codex Responses:
1958
1968
 
1959
- **OpenAI Codex.** Requires a ChatGPT subscription with model access. Includes GPT-6.2 Sol and Codex models with extended context windows and reasoning capabilities. Prompt caching is enabled automatically when `sessionId` is provided unless `cacheRetention` is `"none"`. Set `transport` to `"sse"`, `"websocket"`, or `"auto"` for Codex Responses transport selection. WebSocket connections with `sessionId` and caching enabled are reused per session and expire after 5 minutes of inactivity.
1969
+ | Model | Levels | `off` | `minimal` |
1970
+ | --- | --- | --- | --- |
1971
+ | GPT-6.2 Astra, GPT-6.2 Sol | `low`, `medium`, `high`, `xhigh`, `max` | No | No |
1972
+ | GPT-6.1 Sol | `low`, `medium`, `high`, `xhigh`, `max` | No | Codex UI alias that sends `low` |
1973
+ | GPT-6.1 Terra | `off`, `low`, `medium`, `high`, `xhigh`, `max` | Sends reasoning effort `none` | Codex UI alias that sends `low` |
1960
1974
 
1961
- Call `cleanupSessionResources(sessionId)` (imported from `@bastani/atomic-ai`) when finished with a Codex session so its pooled WebSocket connection does not keep the process alive.
1975
+ ### GitHub Copilot
1962
1976
 
1963
- **Azure.** Supports both Azure OpenAI Responses (`azure-openai-responses`) and Microsoft Foundry Chat Completions (`openai-completions`, such as `deepseek-v4-pro`). Set `AZURE_OPENAI_API_KEY` and either `AZURE_OPENAI_BASE_URL` or `AZURE_OPENAI_RESOURCE_NAME`. `AZURE_OPENAI_BASE_URL` accepts `https://<resource>.openai.azure.com`, `https://<resource>.cognitiveservices.azure.com`, and `https://<resource>.ai.azure.com` (including `*.services.ai.azure.com`); root endpoints normalize to `/openai/v1` automatically.
1977
+ If you receive `"The requested model is not supported"`, enable the model manually in VS Code: open Copilot Chat, click the model selector, select the model (warning icon), and click **Enable**.
1964
1978
 
1965
- Use `AZURE_OPENAI_API_VERSION` (defaults to `v1`) to override the API version. Deployment names default to model IDs and can be overridden with `azureDeploymentName` or `AZURE_OPENAI_DEPLOYMENT_NAME_MAP` using comma-separated `model-id=deployment` pairs (for example `gpt-4o-mini=my-deployment,gpt-4o=prod`). Legacy deployment-based URLs are not supported.
1979
+ ### Fireworks deferred tools
1966
1980
 
1967
- **GitHub Copilot.** If you get "The requested model is not supported", enable the model manually in VS Code: open Copilot Chat, click the model selector, select the model (warning icon), and click "Enable".
1981
+ Fireworks models using the Anthropic Messages API support native deferred tool loading. Keep your discovery tool in `context.tools`. After the discovery tool result, append a chronological system message with `toolsAdded` containing the newly discovered tool definitions (`toolsRemoved` when tools drop out). The adapter sends deferred schemas and `tool_reference` blocks while preserving ordinary result text and unsigned thinking during replay.
1982
+
1983
+ Name the discovery tool `ToolSearch` or `tool_search` for Fireworks prompt-prefix deferral. Other discovery names serialize correctly but do not get that prefix optimization. Set `model.compat.supportsToolReferences` to `false` to send ordinary tool schemas instead. This feature does not apply to Fireworks Chat Completions models.
1968
1984
 
1969
1985
  ## Migrating from the old global API
1970
1986