@bastani/atomic 0.10.9 → 0.10.10-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 (401) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/README.md +211 -155
  3. package/dist/_shared/dist-KOELCESV.js +2 -2
  4. package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
  5. package/dist/_shared/lib-4PES5P4V.js +2 -2
  6. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js +27 -12
  7. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js.map +1 -1
  8. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +47 -7
  9. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js.map +1 -1
  10. package/dist/_shared/mode-shared-2QJSCUM6.js +48 -19
  11. package/dist/_shared/mode-shared-2QJSCUM6.js.map +1 -1
  12. package/dist/_shared/{p1a-prewarm-UQY3X2UK.js → p1a-prewarm-XIU57JHF.js} +5 -5
  13. package/dist/_shared/{p1a-prewarm-UQY3X2UK.js.map → p1a-prewarm-XIU57JHF.js.map} +1 -1
  14. package/dist/_shared/p2-shell-main-B2WIALFD.js +30 -25
  15. package/dist/_shared/p2-shell-main-B2WIALFD.js.map +1 -1
  16. package/dist/_shared/runtime-O4KCSG4C.js +5 -5
  17. package/dist/_shared/{sdk-OSBEPR3Q.js → sdk-RRLVN7ER.js} +15 -9
  18. package/dist/_shared/sdk-RRLVN7ER.js.map +1 -0
  19. package/dist/_shared/session-data-AHTU7IS6.js +2 -2
  20. package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
  21. package/dist/_shared/settings-startup-8-DNZ2RIHM.js +4 -1
  22. package/dist/_shared/settings-startup-8-DNZ2RIHM.js.map +1 -1
  23. package/dist/_shared/{startup-0-0-TYUFUOJZ.js → startup-0-0-4VG2G44V.js} +427 -33
  24. package/dist/_shared/startup-0-0-4VG2G44V.js.map +1 -0
  25. package/dist/_shared/{startup-0-1-W2G2UY7R.js → startup-0-1-XTIL65D4.js} +18 -11
  26. package/dist/_shared/startup-0-1-XTIL65D4.js.map +1 -0
  27. package/dist/_shared/{startup-0-2-UXBUEOXW.js → startup-0-2-27OWFHV6.js} +145 -58
  28. package/dist/_shared/startup-0-2-27OWFHV6.js.map +1 -0
  29. package/dist/_shared/startup-0-3-T4DVFYWX.js +15 -25
  30. package/dist/_shared/startup-0-3-T4DVFYWX.js.map +1 -1
  31. package/dist/_shared/{startup-0-4-HN5EB4K7.js → startup-0-4-ZMJV547D.js} +81 -12
  32. package/dist/_shared/startup-0-4-ZMJV547D.js.map +1 -0
  33. package/dist/_shared/startup-0-5-FD2P735I.js +90 -50
  34. package/dist/_shared/startup-0-5-FD2P735I.js.map +1 -1
  35. package/dist/_shared/startup-10-0-TDQNBDDL.js +5 -5
  36. package/dist/_shared/startup-12-0-55AAXBJZ.js +13 -7
  37. package/dist/_shared/startup-12-0-55AAXBJZ.js.map +1 -1
  38. package/dist/_shared/startup-14-0-MLX36RBG.js +4 -4
  39. package/dist/_shared/startup-15-0-YUKGAC63.js +4 -4
  40. package/dist/_shared/startup-15-1-4S7FLMNG.js +88 -28
  41. package/dist/_shared/startup-15-1-4S7FLMNG.js.map +1 -1
  42. package/dist/_shared/startup-8-0-34CBHPZH.js +5 -5
  43. package/dist/_shared/startup-8-1-4KANEHRA.js +61 -17
  44. package/dist/_shared/startup-8-1-4KANEHRA.js.map +1 -1
  45. package/dist/_shared/storage-command-7MGXLJGZ.js +4 -4
  46. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
  47. package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
  48. package/dist/builtin/intercom/CHANGELOG.md +6 -0
  49. package/dist/builtin/intercom/README.md +85 -114
  50. package/dist/builtin/intercom/broker/broker.bundle.mjs +3 -3
  51. package/dist/builtin/intercom/broker/presence-handler.ts +1 -1
  52. package/dist/builtin/intercom/group.ts +7 -3
  53. package/dist/builtin/intercom/index.bundle.mjs +1 -1
  54. package/dist/builtin/intercom/package.json +1 -1
  55. package/dist/builtin/mcp/README.md +37 -27
  56. package/dist/builtin/mcp/index.bundle.mjs +1 -1
  57. package/dist/builtin/mcp/package.json +1 -1
  58. package/dist/builtin/subagents/CHANGELOG.md +8 -0
  59. package/dist/builtin/subagents/README.md +71 -138
  60. package/dist/builtin/subagents/package.json +1 -1
  61. package/dist/builtin/subagents/src/extension/index.bundle.mjs +213 -74
  62. package/dist/builtin/web-access/CHANGELOG.md +9 -0
  63. package/dist/builtin/web-access/README.md +60 -87
  64. package/dist/builtin/web-access/index.bundle.mjs +387 -351
  65. package/dist/builtin/web-access/package.json +1 -1
  66. package/dist/cli/args.js +2 -2
  67. package/dist/cli/auth-cli.code.js +4 -4
  68. package/dist/cli/auth-cli.impl.js +3 -3
  69. package/dist/cli/auth-cli.js +3 -3
  70. package/dist/cli/blueprint-command.code.js +2 -2
  71. package/dist/cli/blueprint-command.impl.js +3 -3
  72. package/dist/cli/blueprint-command.js +3 -3
  73. package/dist/cli/intercom-command.code.js +3 -3
  74. package/dist/cli/intercom-command.impl.js +3 -3
  75. package/dist/cli/intercom-command.js +3 -3
  76. package/dist/cli/list-models.code.js +3 -3
  77. package/dist/cli/list-models.impl.js +3 -3
  78. package/dist/cli/list-models.js +3 -3
  79. package/dist/cli/session-picker.code.js +2 -2
  80. package/dist/cli/session-picker.impl.js +3 -3
  81. package/dist/cli/session-picker.js +3 -3
  82. package/dist/cli/startup-ui.code.js +2 -2
  83. package/dist/cli/startup-ui.impl.js +3 -3
  84. package/dist/cli/startup-ui.js +3 -3
  85. package/dist/cli/storage-command.impl.js +3 -3
  86. package/dist/cli/storage-command.js +3 -3
  87. package/dist/cli/storage-search-session.code.js +2 -2
  88. package/dist/cli/storage-search-session.impl.js +3 -3
  89. package/dist/cli/storage-search-session.js +3 -3
  90. package/dist/cli/team-command.code.js +2 -2
  91. package/dist/cli/team-command.impl.js +3 -3
  92. package/dist/cli/team-command.js +3 -3
  93. package/dist/cli.js +2 -2
  94. package/dist/core/agent-session-methods.d.ts +4 -1
  95. package/dist/core/agent-session-methods.js.map +1 -1
  96. package/dist/core/agent-session.d.ts +3 -0
  97. package/dist/core/compaction/compactor.d.ts +20 -14
  98. package/dist/core/compaction/errors.d.ts +120 -0
  99. package/dist/core/compaction/index.d.ts +1 -0
  100. package/dist/core/compaction/model-resolver.d.ts +2 -2
  101. package/dist/core/debug.impl.js +3 -3
  102. package/dist/core/debug.js +3 -3
  103. package/dist/core/export-html/card-projection.impl.js +3 -3
  104. package/dist/core/export-html/card-projection.js +3 -3
  105. package/dist/core/export-html/index.code.js +2 -2
  106. package/dist/core/export-html/index.impl.js +3 -3
  107. package/dist/core/export-html/index.js +3 -3
  108. package/dist/core/export-html/json-spans.impl.js +3 -3
  109. package/dist/core/export-html/json-spans.js +3 -3
  110. package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
  111. package/dist/core/export-html/oversized-render-inputs.js +3 -3
  112. package/dist/core/export-html/tool-renderer.code.js +1 -1
  113. package/dist/core/export-html/tool-renderer.impl.js +3 -3
  114. package/dist/core/export-html/tool-renderer.js +3 -3
  115. package/dist/core/extensions/api-types.d.ts +1 -1
  116. package/dist/core/extensions/api-types.js.map +1 -1
  117. package/dist/core/extensions/index.d.ts +1 -1
  118. package/dist/core/extensions/jiti-loader.impl.js +3 -3
  119. package/dist/core/extensions/jiti-loader.js +3 -3
  120. package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
  121. package/dist/core/extensions/jiti-static-loader.js +3 -3
  122. package/dist/core/extensions/loader-host-modules.code.js +1 -1
  123. package/dist/core/extensions/loader-host-modules.impl.js +3 -3
  124. package/dist/core/extensions/loader-host-modules.js +3 -3
  125. package/dist/core/extensions/loader-virtual-modules.js +1 -1
  126. package/dist/core/extensions/provider-types.d.ts +18 -6
  127. package/dist/core/extensions/provider-types.js.map +1 -1
  128. package/dist/core/extensions/runner-context.js +1 -1
  129. package/dist/core/intercom-broker-control-host.code.js +1 -1
  130. package/dist/core/intercom-broker-control-host.impl.js +3 -3
  131. package/dist/core/intercom-broker-control-host.js +3 -3
  132. package/dist/core/intercom-broker-control.code.js +3 -3
  133. package/dist/core/intercom-broker-control.impl.js +3 -3
  134. package/dist/core/intercom-broker-control.js +3 -3
  135. package/dist/core/model-config.d.ts +40 -0
  136. package/dist/core/model-registry.js +1 -1
  137. package/dist/core/model-resolver-scope.d.ts +4 -4
  138. package/dist/core/model-runtime.d.ts +1 -1
  139. package/dist/core/package-manager-storage-adapters.impl.js +3 -3
  140. package/dist/core/package-manager-storage-adapters.js +3 -3
  141. package/dist/core/provider-composer-internal.d.ts +11 -2
  142. package/dist/core/sdk.code.js +3 -3
  143. package/dist/core/sdk.impl.js +3 -3
  144. package/dist/core/sdk.js +3 -3
  145. package/dist/core/session-manager-core.js +5 -5
  146. package/dist/core/session-manager-list.impl.js +3 -3
  147. package/dist/core/session-manager-list.js +3 -3
  148. package/dist/core/session-manager.code.js +1 -1
  149. package/dist/core/session-manager.impl.js +3 -3
  150. package/dist/core/session-manager.js +3 -3
  151. package/dist/core/session-storage.impl.js +3 -3
  152. package/dist/core/session-storage.js +3 -3
  153. package/dist/core/settings-manager-basic-accessors.d.ts +6 -2
  154. package/dist/core/storage/index.js +2 -2
  155. package/dist/core/storage/node-sqlite-thread.js +2 -2
  156. package/dist/core/storage/node-sqlite.js +2 -2
  157. package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
  158. package/dist/core/storage/offline-snapshot-file.js +3 -3
  159. package/dist/core/storage/provider.js +2 -2
  160. package/dist/core/storage/selection.js +2 -2
  161. package/dist/core/storage/session/branch-fork-source.code.js +2 -2
  162. package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
  163. package/dist/core/storage/session/branch-fork-source.js +3 -3
  164. package/dist/core/storage/session/card-view.impl.js +3 -3
  165. package/dist/core/storage/session/card-view.js +3 -3
  166. package/dist/core/storage/session/child-reader.code.js +3 -3
  167. package/dist/core/storage/session/child-reader.impl.js +3 -3
  168. package/dist/core/storage/session/child-reader.js +3 -3
  169. package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
  170. package/dist/core/storage/session/chunked-resume-projection.js +3 -3
  171. package/dist/core/storage/session/expanded-child-details.code.js +2 -2
  172. package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
  173. package/dist/core/storage/session/expanded-child-details.js +3 -3
  174. package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
  175. package/dist/core/storage/session/fork-row-bytes.js +3 -3
  176. package/dist/core/storage/session/fork-row-index.impl.js +3 -3
  177. package/dist/core/storage/session/fork-row-index.js +3 -3
  178. package/dist/core/storage/session/fork-staging.code.js +2 -2
  179. package/dist/core/storage/session/fork-staging.impl.js +3 -3
  180. package/dist/core/storage/session/fork-staging.js +3 -3
  181. package/dist/core/storage/session/fork-window.code.js +3 -3
  182. package/dist/core/storage/session/fork-window.impl.js +3 -3
  183. package/dist/core/storage/session/fork-window.js +3 -3
  184. package/dist/core/storage/session/history-pages.impl.js +3 -3
  185. package/dist/core/storage/session/history-pages.js +3 -3
  186. package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
  187. package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
  188. package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
  189. package/dist/core/storage/session/jsonl-session-store.js +3 -3
  190. package/dist/core/storage/session/memory-session-store.impl.js +3 -3
  191. package/dist/core/storage/session/memory-session-store.js +3 -3
  192. package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
  193. package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
  194. package/dist/core/storage/session/pinned-branch-resume.js +3 -3
  195. package/dist/core/storage/session/released-history-files.code.js +3 -3
  196. package/dist/core/storage/session/released-history-files.impl.js +3 -3
  197. package/dist/core/storage/session/released-history-files.js +3 -3
  198. package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
  199. package/dist/core/storage/session/resident-fork-rows.js +3 -3
  200. package/dist/core/storage/session/session-resume.impl.js +3 -3
  201. package/dist/core/storage/session/session-resume.js +3 -3
  202. package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
  203. package/dist/core/storage/session/snapshot-cut.js +3 -3
  204. package/dist/core/storage/session/snapshot-history.code.js +3 -3
  205. package/dist/core/storage/session/snapshot-history.impl.js +3 -3
  206. package/dist/core/storage/session/snapshot-history.js +3 -3
  207. package/dist/core/storage/session/sql-session-store.code.js +1 -1
  208. package/dist/core/storage/session/sql-session-store.impl.js +3 -3
  209. package/dist/core/storage/session/sql-session-store.js +3 -3
  210. package/dist/core/storage/session/tree-outline.impl.js +3 -3
  211. package/dist/core/storage/session/tree-outline.js +3 -3
  212. package/dist/core/storage/session/tree-presentation.impl.js +3 -3
  213. package/dist/core/storage/session/tree-presentation.js +3 -3
  214. package/dist/core/storage/storage-status.impl.js +3 -3
  215. package/dist/core/storage/storage-status.js +3 -3
  216. package/dist/core/storage/team.impl.js +3 -3
  217. package/dist/core/storage/team.js +3 -3
  218. package/dist/core/structured-output/index.code.js +1 -1
  219. package/dist/core/structured-output/index.impl.js +3 -3
  220. package/dist/core/structured-output/index.js +3 -3
  221. package/dist/core/tasks/task-completion-entry.impl.js +3 -3
  222. package/dist/core/tasks/task-completion-entry.js +3 -3
  223. package/dist/core/tasks/task-file-history.code.js +3 -3
  224. package/dist/core/tasks/task-file-history.impl.js +3 -3
  225. package/dist/core/tasks/task-file-history.js +3 -3
  226. package/dist/core/tasks/task-reference-archive.code.js +4 -4
  227. package/dist/core/tasks/task-reference-archive.js +3 -3
  228. package/dist/core/tasks/task-reference-identity.code.js +1 -1
  229. package/dist/core/tasks/task-reference-identity.js +3 -3
  230. package/dist/core/tasks/task-reference-stream.impl.js +3 -3
  231. package/dist/core/tasks/task-reference-stream.js +3 -3
  232. package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
  233. package/dist/core/tasks/task-unsaved-answer.js +3 -3
  234. package/dist/core/tasks/task-view-source.impl.js +3 -3
  235. package/dist/core/tasks/task-view-source.js +3 -3
  236. package/dist/core/tools/read-url.code.js +2 -2
  237. package/dist/core/tools/read-url.impl.js +3 -3
  238. package/dist/core/tools/read-url.js +3 -3
  239. package/dist/core/worktree-snapshot/blob-store.js +2 -2
  240. package/dist/core/worktree-snapshot/errors.code.js +3 -3
  241. package/dist/core/worktree-snapshot/errors.impl.js +3 -3
  242. package/dist/core/worktree-snapshot/errors.js +3 -3
  243. package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
  244. package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
  245. package/dist/extensions/codemode/execute.code.js +1 -1
  246. package/dist/extensions/codemode/execute.impl.js +3 -3
  247. package/dist/extensions/codemode/execute.js +3 -3
  248. package/dist/extensions/codemode/renderer.code.js +2 -2
  249. package/dist/extensions/codemode/renderer.impl.js +3 -3
  250. package/dist/extensions/codemode/renderer.js +3 -3
  251. package/dist/extensions/mcp/cli.code.js +2 -2
  252. package/dist/extensions/mcp/cli.impl.js +3 -3
  253. package/dist/extensions/mcp/cli.js +3 -3
  254. package/dist/extensions/mcp/cli.lazy.code.js +2 -2
  255. package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
  256. package/dist/extensions/mcp/cli.lazy.js +3 -3
  257. package/dist/extensions/mcp/runtime.code.js +1 -1
  258. package/dist/extensions/mcp/runtime.impl.js +3 -3
  259. package/dist/extensions/mcp/runtime.js +3 -3
  260. package/dist/index-extensions.d.ts +1 -1
  261. package/dist/index.d.ts +8 -1
  262. package/dist/index.js +7 -7
  263. package/dist/main-first-time-setup.code.js +2 -2
  264. package/dist/main-first-time-setup.impl.js +3 -3
  265. package/dist/main-first-time-setup.js +3 -3
  266. package/dist/modes/interactive/components/settings-selector-types.d.ts +1 -0
  267. package/dist/modes/interactive/components/settings-selector-types.js.map +1 -1
  268. package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
  269. package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
  270. package/dist/modes/interactive/components/stored-tree-view.js +3 -3
  271. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
  272. package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
  273. package/dist/modes/interactive/theme/color-utils.d.ts +5 -5
  274. package/dist/modes/interactive/theme/theme-loading.d.ts +1 -0
  275. package/dist/modes/interactive-engine/engine-prewarm.js +1 -1
  276. package/dist/modes/interactive-engine/remote-model-catalog.d.ts +1 -0
  277. package/dist/modes/print-mode.js +1 -1
  278. package/dist/modes/rpc/rpc-client-api.d.ts +6 -0
  279. package/dist/modes/rpc/rpc-types.d.ts +29 -2
  280. package/dist/package-manager-cli.code.js +5 -5
  281. package/dist/package-manager-cli.impl.js +3 -3
  282. package/dist/package-manager-cli.js +3 -3
  283. package/dist/rpc-entry.js +1 -1
  284. package/dist/startup-files.json +1 -1
  285. package/dist/startup-stages/5.js +1 -1
  286. package/dist/startup-stages/7.js +1 -1
  287. package/dist/startup-stages/8.js +1 -2
  288. package/dist/startup-stages/9.js +2 -1
  289. package/dist/utils/native-module.d.ts +44 -0
  290. package/dist/utils/startup-database-spare.code.js +3 -3
  291. package/dist/utils/startup-database-spare.impl.js +3 -3
  292. package/dist/utils/startup-database-spare.js +3 -3
  293. package/dist/utils/tools-manager.code.js +1 -1
  294. package/dist/utils/tools-manager.impl.js +3 -3
  295. package/dist/utils/tools-manager.js +3 -3
  296. package/docs/background-tasks.md +235 -243
  297. package/docs/build.md +12 -11
  298. package/docs/codemode.md +60 -51
  299. package/docs/compaction/reference.md +61 -24
  300. package/docs/compaction.md +117 -65
  301. package/docs/computer-use.md +179 -146
  302. package/docs/containerization.md +79 -33
  303. package/docs/custom-provider/api-reference.md +148 -11
  304. package/docs/custom-provider/oauth.md +44 -27
  305. package/docs/custom-provider/override.md +14 -7
  306. package/docs/custom-provider/registration.md +75 -65
  307. package/docs/custom-provider/streaming.md +42 -19
  308. package/docs/custom-provider.md +25 -61
  309. package/docs/development.md +47 -43
  310. package/docs/docs.json +33 -33
  311. package/docs/environment-variables.md +83 -57
  312. package/docs/extensions/api-reference.md +323 -734
  313. package/docs/extensions/authoring.md +186 -269
  314. package/docs/extensions/events.md +308 -375
  315. package/docs/extensions/examples.md +122 -74
  316. package/docs/extensions/ui.md +217 -197
  317. package/docs/extensions.md +152 -259
  318. package/docs/getting-started/authentication.md +27 -14
  319. package/docs/getting-started/first-session.md +25 -26
  320. package/docs/getting-started/installation.md +62 -84
  321. package/docs/getting-started/project-instructions.md +39 -14
  322. package/docs/guides/configuration.md +42 -20
  323. package/docs/guides/intercom.md +17 -13
  324. package/docs/guides/non-interactive.md +29 -16
  325. package/docs/guides/orchestration.md +16 -10
  326. package/docs/guides/resume-on-any-machine.md +54 -49
  327. package/docs/guides/subagents.md +22 -14
  328. package/docs/guides/team-setup.md +37 -26
  329. package/docs/guides.md +22 -21
  330. package/docs/herdr.md +21 -16
  331. package/docs/index.md +16 -17
  332. package/docs/intercom/operations.md +68 -66
  333. package/docs/intercom/reference.md +196 -191
  334. package/docs/intercom.md +103 -92
  335. package/docs/json.md +71 -71
  336. package/docs/keybindings.md +63 -50
  337. package/docs/libraries/agent-core.md +49 -8
  338. package/docs/libraries/ai.md +21 -12
  339. package/docs/libraries/codemode.md +28 -6
  340. package/docs/libraries/schema.md +7 -7
  341. package/docs/libraries/telemetry.md +7 -7
  342. package/docs/libraries/tui.md +74 -94
  343. package/docs/libraries.md +5 -5
  344. package/docs/llama-cpp.md +38 -33
  345. package/docs/mcp-servers.md +96 -90
  346. package/docs/models/reference.md +46 -33
  347. package/docs/models-configuration.md +12 -6
  348. package/docs/models.md +93 -88
  349. package/docs/orchestration/migrating-workflows.md +21 -19
  350. package/docs/orchestration/patterns.md +35 -20
  351. package/docs/orchestration.md +22 -21
  352. package/docs/packages/authoring.md +28 -19
  353. package/docs/packages/reference.md +75 -16
  354. package/docs/packages.md +31 -33
  355. package/docs/programmatic.md +22 -21
  356. package/docs/prompt-templates.md +63 -41
  357. package/docs/providers/reference.md +35 -19
  358. package/docs/providers.md +61 -71
  359. package/docs/quickstart.md +32 -46
  360. package/docs/reference/cli.md +249 -252
  361. package/docs/reference.md +23 -20
  362. package/docs/rpc/examples.md +74 -17
  363. package/docs/rpc/extension-ui.md +79 -62
  364. package/docs/rpc/protocol.md +816 -358
  365. package/docs/rpc.md +75 -151
  366. package/docs/sdk/reference.md +175 -45
  367. package/docs/sdk/structured-decisions.md +92 -62
  368. package/docs/sdk/web-server.md +79 -46
  369. package/docs/sdk.md +237 -195
  370. package/docs/security.md +106 -43
  371. package/docs/session-format.md +96 -59
  372. package/docs/sessions.md +149 -113
  373. package/docs/settings.md +289 -204
  374. package/docs/shell-aliases.md +15 -6
  375. package/docs/skills/authoring.md +17 -9
  376. package/docs/skills/reference.md +23 -21
  377. package/docs/skills.md +104 -97
  378. package/docs/storage.md +140 -242
  379. package/docs/subagents/authoring.md +147 -16
  380. package/docs/subagents/reference.md +100 -30
  381. package/docs/subagents.md +220 -252
  382. package/docs/terminal-setup.md +97 -69
  383. package/docs/termux.md +51 -85
  384. package/docs/themes/reference.md +51 -37
  385. package/docs/themes.md +49 -54
  386. package/docs/tmux.md +38 -21
  387. package/docs/tools.md +198 -147
  388. package/docs/tui/reference.md +64 -32
  389. package/docs/tui.md +38 -66
  390. package/docs/usage.md +76 -78
  391. package/docs/verification.md +25 -25
  392. package/docs/web-access.md +72 -55
  393. package/docs/windows.md +53 -58
  394. package/docs/worktree-snapshots.md +62 -65
  395. package/package.json +8 -8
  396. package/schemas/models.schema.json +51 -0
  397. package/dist/_shared/sdk-OSBEPR3Q.js.map +0 -1
  398. package/dist/_shared/startup-0-0-TYUFUOJZ.js.map +0 -1
  399. package/dist/_shared/startup-0-1-W2G2UY7R.js.map +0 -1
  400. package/dist/_shared/startup-0-2-UXBUEOXW.js.map +0 -1
  401. package/dist/_shared/startup-0-4-HN5EB4K7.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: "@bastani/atomic-telemetry"
3
- sidebarTitle: "Telemetry"
4
- description: "Vendor-neutral telemetry contracts, a no-op and an in-memory context, metrics and typed schemas."
3
+ sidebarTitle: "@bastani/atomic-telemetry"
4
+ description: "Vendor-neutral telemetry contracts, no-op and in-memory contexts, metrics, trace rendering, and typed telemetry schemas."
5
5
  ---
6
6
 
7
7
  Vendor-neutral telemetry contracts and typed schema utilities for Atomic's libraries. This package contains no exporter and sends nothing on its own; you supply the adapter.
@@ -273,13 +273,13 @@ Storage in `InMemoryTelemetryContext` is unbounded and process-local. Create a f
273
273
 
274
274
  `TelemetryStore` separates querying from recording. `InMemoryTelemetryContext` implements it, and persistent adapters can implement it too:
275
275
 
276
- - `findTraces(query?)` returns locally stored traces, newest trace start first. Filters include the earliest stored span's `name`, inclusive `startMin` and `startMax`, `errors: true`, and scalar `attributes` (all requested attributes must match one span anywhere in the trace). Pages default to 20 traces; pass the returned opaque `cursor` with the same filters to continue. Equal start times order by trace ID.
277
- - `getTrace(traceId)` returns a trace or `undefined`.
278
- - `findMetrics({ name, startMin?, startMax?, attributes? })` returns metric rows with count, sum, minimum, and maximum. Time bounds are inclusive interval-start times. `InMemoryTelemetryContext` maps each raw measurement to a count-one row in its 10-second interval, while persistent stores can aggregate measurements per series and interval.
276
+ - `findTraces(query?)` returns `Promise<{ traces: readonly StoredTrace[]; cursor?: string }>`, newest trace start first, where each `StoredTrace` is `{ traceId, spans }`. `TraceQuery` filters include the earliest stored span's `name`, inclusive `startMin` and `startMax`, `errors: true`, `attributes` (scalar equalities that must all match one span anywhere in the trace), `limit` (default `20`), and opaque `cursor` (pass with the same filters to fetch the next page). Equal start times order by `traceId`.
277
+ - `getTrace(traceId)` returns `Promise<StoredTrace | undefined>`.
278
+ - `findMetrics({ name, startMin?, startMax?, attributes? })` returns `Promise<readonly StoredMetric[]>`, where each `StoredMetric` has `{ intervalMs, name, kind, unit?, attributes, count, sum, min, max }`. Time bounds are inclusive interval-start times. `InMemoryTelemetryContext` maps each raw measurement to a count-one row in its 10-second interval, while persistent stores can aggregate measurements per series and interval.
279
279
 
280
280
  Only settled spans are returned. A trace ID propagates from the root span with the parent identity. Stores return the spans available locally, so remote or expired parents may be absent and a child can appear before its parent settles. Pagination is not a frozen snapshot across requests because late settlements and retention can change a trace's earliest stored span.
281
281
 
282
- `StoredSpan` includes epoch-millisecond `startedMs` and `endedMs`, event offsets in `timeMs`, and links carrying both target `traceId` and `spanId`. Durations use a monotonic clock because wall clocks across processes may disagree. Merge spans from multiple stores by trace ID; parent relationships, not timestamp containment, define the tree.
282
+ `StoredSpan` has `{ id, traceId, parentId?, name, startedMs, endedMs, attributes, events: [{ name, timeMs, attributes }], links: [{ traceId, spanId, attributes? }], status }`. `startedMs` and `endedMs` are epoch milliseconds (`telemetryNow()`), and event `timeMs` values are offsets relative to span start. Durations use a monotonic clock because wall clocks across processes may disagree. Merge spans from multiple stores by `traceId`; parent relationships, not timestamp containment, define the tree.
283
283
 
284
284
  Trace formatting lives in `@bastani/atomic-telemetry/render`:
285
285
 
@@ -383,7 +383,7 @@ const startSpan = createTypedSpanStarter(
383
383
  );
384
384
  ```
385
385
 
386
- The starter exposes one overload per span and checks names and attributes at compile time. Union-valued names must be narrowed before a call, preserving the relationship between each runtime name and its attribute schema. Its callback receives a child starter over the same schemas, already bound to the callback span:
386
+ The starter exposes one overload per span and checks names and attributes at compile time. Union-valued names must be narrowed before a call, preserving the relationship between each runtime name and its attribute schema. Always pass the second `attributes` argument (pass `{}` when a span declares `startAttributes: {}`), unlike `span.addEvent()` where `attributes` is optional when no attributes are required. Its callback receives a child starter over the same schemas, already bound to the callback span:
387
387
 
388
388
  ```typescript
389
389
  await startSpan(
@@ -1,10 +1,16 @@
1
1
  ---
2
2
  title: "@bastani/atomic-tui"
3
- sidebarTitle: "TUI"
4
- description: "Terminal UI framework with differential rendering, components, overlays, key handling and images."
3
+ sidebarTitle: "@bastani/atomic-tui"
4
+ description: "Terminal UI framework with differential rendering, alternate-screen viewports, components, overlays, key handling, and images."
5
5
  ---
6
6
 
7
- Minimal terminal UI framework with differential rendering and synchronized output for flicker-free interactive CLI applications.
7
+ Minimal terminal UI framework with differential rendering and synchronized output for flicker-free interactive CLI applications (requires Node.js 22.19+).
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ npm install @bastani/atomic-tui
13
+ ```
8
14
 
9
15
  ## Features
10
16
 
@@ -13,9 +19,9 @@ Minimal terminal UI framework with differential rendering and synchronized outpu
13
19
  - **Application-owned scrolling.** Alternate-screen viewport supports mouse, trackpad, and keyboard navigation.
14
20
  - **Synchronized output.** Uses CSI 2026 for atomic, flicker-free screen updates.
15
21
  - **Bracketed paste mode.** Handles large pastes with compact markers for pastes over 10 lines.
16
- - **Component-based.** Simple `Component` interface with a `render(width)` method.
22
+ - **Component-based.** Simple `Component` interface with `render(width)` and optional `renderSized(width, height)`.
17
23
  - **Theme support.** Components accept theme interfaces for styling.
18
- - **Built-in components.** `Text`, `TruncatedText`, `Input`, `Editor`, `Markdown`, `Loader`, `CancellableLoader`, `SelectList`, `SettingsList`, `MouseRegion`, `Spacer`, `Image`, `Box`, `Container`, `VStack`, `HStack`, and `ScrollView`.
24
+ - **Built-in components.** `Text`, `TruncatedText`, `Input`, `Editor`, `Markdown`, `Loader`, `CancellableLoader`, `SelectList`, `SettingsList`, `MouseRegion`, `Spacer`, `Image`, `Box`, `Container`, `WindowedContainer`, `VStack`, `HStack`, and `ScrollView`.
19
25
  - **Inline images.** Renders images in terminals supporting Kitty or iTerm2 graphics protocols.
20
26
  - **Autocomplete support.** File paths and slash commands.
21
27
 
@@ -187,6 +193,21 @@ Press `Ctrl+Shift+F` to open or close the primary scroll view's bordered search
187
193
 
188
194
  `TuiAltScreenOptions.scrollToEndIndicator` renders a clickable label centered on the last row of a `follow: "end"` primary scroll view while scrolled away from the end. Clicking it resumes end-following.
189
195
 
196
+ **`TuiAltScreenOptions` summary:**
197
+
198
+ | Option | Type | Description |
199
+ | --- | --- | --- |
200
+ | `wheelScrollLines` | `number \| "auto"` | Logical lines moved per wheel event (default `1`; `"auto"` accelerates fast spins; Alt+wheel moves 5x). |
201
+ | `mouse` | `boolean` | Capture mouse events for scrolling and application-owned text selection. |
202
+ | `copyOnSelect` | `boolean` | Automatically copy dragged selections on mouse release (default `true`). |
203
+ | `copySelection` | `(text: string) => Promise<boolean \| string>` | Custom system clipboard writer; falls back to OSC 52 when omitted. |
204
+ | `openUrl` | `(url: string) => void` | Handler invoked when clicking an OSC 8 hyperlink. |
205
+ | `onRightClickPaste` | `() => void` | Secondary-button paste handler (currently Windows only). |
206
+ | `searchMatchStyle` / `searchCurrentMatchStyle` | `(text: string) => string` | Highlighters for transcript search matches and the active match. |
207
+ | `searchNavigationButtonStyle` | `(text: string, hovered: boolean) => string` | Styling callback for the search panel's previous/next buttons. |
208
+ | `scrollToEndIndicator` | `() => string` | Clickable jump-to-end indicator shown when scrolled away from the bottom. |
209
+ | `scrollPinnedPrompt` | `{ isPrompt, render }` | Pins matching prompt rows at the top of the scroll viewport. |
210
+
190
211
  Layout geometry is rebuilt for each requested frame. Stateful components are retained, and their existing rendered-line caches remain effective. Calling `render(width)` directly on these layout components produces an unbounded document, which is also used when alt mode restores the main screen.
191
212
 
192
213
  ### Overlays
@@ -275,21 +296,29 @@ All components implement:
275
296
  ```typescript
276
297
  interface Component {
277
298
  render(width: number): string[];
299
+ renderSized?(width: number, height: number): string[];
278
300
  handleInput?(data: string): void;
279
301
  handleMouse?(event: TuiMouseEvent): TuiMouseEventResult | undefined;
280
- capturesViewportInput?: boolean;
302
+ paintedRowKey?(row: number): string | undefined;
281
303
  readonly selectionTextMayChangeOnReplay?: boolean;
304
+ readonly historyReplayable?: boolean;
305
+ wantsKeyRelease?: boolean;
306
+ capturesViewportInput?: boolean;
282
307
  invalidate(): void;
283
308
  }
284
309
  ```
285
310
 
286
- | Method | Description |
287
- |--------|-------------|
311
+ | Member | Description |
312
+ | --- | --- |
288
313
  | `render(width)` | Returns an array of strings, one per line. Each line **must not exceed `width`** or the TUI throws an error. Use `truncateToWidth()` or manual wrapping. |
314
+ | `renderSized?(width, height)` | Optional sized renderer invoked instead of `render()` when a layout slot allocates a fixed row height. |
289
315
  | `handleInput?(data)` | Called when the component has focus and receives keyboard input. The `data` string contains raw terminal input, which may include ANSI escape sequences. |
290
316
  | `handleMouse?(event)` | Called by `TuiAltScreen` for normalized pointer input targeted at the component. |
291
- | `capturesViewportInput?` | When `true` on the focused component, `TuiAltScreen` forwards viewport scrolling and prompt-jump keys (`tui.altScreen.*` except search) to the component instead of scrolling the viewport, matching focused overlays. `SelectList`, `SettingsList`, and `Editor` (while autocomplete is open) set this so PageUp and PageDown move selection. Only the focused component is checked, so a wrapper forwarding input to a list must mirror this flag. Use `getSelectPageIndex(keybindings, data, selectedIndex, itemCount, pageSize)` to compute page movement. |
292
- | `selectionTextMayChangeOnReplay` | Set to `true` on a `WindowedContainer` component whose text cannot be recreated from saved input. Fullscreen selection then keeps the selected fragments in memory until dismissed or replaced. While the component remains on screen, copying uses its latest painted text; if evicted and recreated, repeated copies keep the original selection. Leave unset for deterministic rows. |
317
+ | `paintedRowKey?(row)` | Optional stable identity for what the last render drew on `row`, so press and release become a click only when both target the same item across repaints. |
318
+ | `selectionTextMayChangeOnReplay` | Set to `true` on a `WindowedContainer` component whose text cannot be recreated from saved input. Fullscreen selection then keeps the selected fragments in memory until dismissed or replaced. Leave unset for deterministic rows. |
319
+ | `historyReplayable` | Set to `true` on a chat-rendered component that can be discarded offscreen and recreated from saved input without losing state. |
320
+ | `wantsKeyRelease` | When `true`, receives Kitty key release events in `handleInput()`. Default: `false`. |
321
+ | `capturesViewportInput` | When `true` on the focused component, `TuiAltScreen` forwards viewport scrolling and prompt-jump keys (`tui.altScreen.*` except search) to the component instead of scrolling the viewport, matching focused overlays. `SelectList`, `SettingsList`, and `Editor` (while autocomplete is open) set this so PageUp and PageDown move selection. Use `getSelectPageIndex(keybindings, data, selectedIndex, itemCount, pageSize)` to compute page movement. |
293
322
  | `invalidate()` | Required. Clears cached render state so the next `render()` rebuilds from scratch. Stateless components can leave the body empty. |
294
323
 
295
324
  The TUI appends a full SGR reset and OSC 8 reset at the end of each rendered line, so styles do not carry across lines. Reapply styles per line or use `wrapTextWithAnsi()` to preserve styling across wrapped lines.
@@ -403,7 +432,7 @@ Without this propagation, typing with an IME (Chinese, Japanese, Korean, etc.) w
403
432
 
404
433
  ### Container
405
434
 
406
- Groups child components.
435
+ Groups child components vertically.
407
436
 
408
437
  ```typescript
409
438
  const container = new Container();
@@ -411,6 +440,10 @@ container.addChild(component);
411
440
  container.removeChild(component);
412
441
  ```
413
442
 
443
+ ### WindowedContainer
444
+
445
+ Virtualized vertical container for large transcripts inside `ScrollView`. Keeps only visible children mounted in memory and materializes or evicts off-screen rows on demand (respecting `historyReplayable` and `selectionTextMayChangeOnReplay` for fullscreen text selection).
446
+
414
447
  ### Box
415
448
 
416
449
  Container that applies padding and background color to all children.
@@ -824,8 +857,13 @@ The TUI works with any object implementing the `Terminal` interface:
824
857
  interface Terminal {
825
858
  start(onInput: (data: string) => void, onResize: () => void): void;
826
859
  stop(): void;
860
+ handOff?(held?: readonly string[]): void;
861
+ readonly continuedFromHandOff?: boolean;
862
+ restoreOnExit?(before: string, after: string): void;
827
863
  drainInput(maxMs?: number, idleMs?: number): Promise<void>;
828
864
  write(data: string): void;
865
+ flush?(): Promise<void>;
866
+ readonly colorDepth?: number;
829
867
  get columns(): number;
830
868
  get rows(): number;
831
869
  get kittyProtocolActive(): boolean;
@@ -851,7 +889,7 @@ import { visibleWidth, truncateToWidth, wrapTextWithAnsi } from "@bastani/atomic
851
889
  // Get visible width of string (ignoring ANSI codes)
852
890
  const width = visibleWidth("\x1b[31mHello\x1b[0m"); // 5
853
891
 
854
- // Truncate string to width (preserving ANSI codes, adds ellipsis)
892
+ // Truncate string to width (preserving ANSI codes and closing active styles)
855
893
  const truncated = truncateToWidth("Hello World", 8); // "Hello..."
856
894
 
857
895
  // Truncate without ellipsis
@@ -862,30 +900,42 @@ const lines = wrapTextWithAnsi("This is a long line that needs wrapping", 20);
862
900
  // ["This is a long line", "that needs wrapping"]
863
901
  ```
864
902
 
865
- ## Creating custom components
903
+ Additional exported helpers:
866
904
 
867
- When creating custom components, **each line returned by `render()` must not exceed the `width` parameter**. The TUI throws an error if any line is wider than the terminal.
905
+ | Export | Purpose |
906
+ | --- | --- |
907
+ | `fuzzyFilter` / `fuzzyMatch` | Fuzzy matching and ranked filtering for pickers and search inputs. |
908
+ | `KeybindingsManager` / `TUI_KEYBINDINGS` | Configurable TUI keybinding definitions and lookup. |
909
+ | `decodePrintableKey` | Decode printable Kitty CSI-u and `modifyOtherKeys` sequences. |
910
+ | `normalizePastedText` | Normalize bracketed paste text (CRLF/CR, tmux control bytes, tabs, C0 control filtering). |
911
+ | `stripTerminalSequences` / `sliceByColumn` | Strip ANSI/OSC sequences or slice styled strings by display column range. |
912
+ | `hyperlink` / `clickableHint` | Format OSC 8 clickable terminal links and clickable hint badges. |
913
+ | `renderLatex` | Render inline or block LaTeX math into Unicode text for terminals. |
914
+ | `formatProgramStatus` | Encode OSC 7501 program-status escape sequences. |
915
+ | `getNativeClipboard` | Access the native clipboard integration when available. |
868
916
 
869
- ### Handling input
917
+ ## Creating custom components
870
918
 
871
- Use `matchesKey()` with the `Key` helper for keyboard input:
919
+ When building a custom `Component`, keep every line returned by `render(width)` within `width` columns using `truncateToWidth()`, `wrapTextWithAnsi()`, or `visibleWidth()`, handle keys via `matchesKey()` (see [Key detection](#key-detection)), and cache rendered output by width until `invalidate()` runs:
872
920
 
873
921
  ```typescript
874
- import { matchesKey, Key, truncateToWidth } from "@bastani/atomic-tui";
875
- import type { Component } from "@bastani/atomic-tui";
922
+ import { Key, matchesKey, truncateToWidth, type Component } from "@bastani/atomic-tui";
876
923
 
877
- class MyInteractiveComponent implements Component {
924
+ class CachedList implements Component {
878
925
  private selectedIndex = 0;
879
926
  private items = ["Option 1", "Option 2", "Option 3"];
880
-
927
+ private cachedWidth?: number;
928
+ private cachedLines?: string[];
881
929
  public onSelect?: (index: number) => void;
882
930
  public onCancel?: () => void;
883
931
 
884
932
  handleInput(data: string): void {
885
933
  if (matchesKey(data, Key.up)) {
886
934
  this.selectedIndex = Math.max(0, this.selectedIndex - 1);
935
+ this.invalidate();
887
936
  } else if (matchesKey(data, Key.down)) {
888
937
  this.selectedIndex = Math.min(this.items.length - 1, this.selectedIndex + 1);
938
+ this.invalidate();
889
939
  } else if (matchesKey(data, Key.enter)) {
890
940
  this.onSelect?.(this.selectedIndex);
891
941
  } else if (matchesKey(data, Key.escape) || matchesKey(data, Key.ctrl("c"))) {
@@ -893,85 +943,15 @@ class MyInteractiveComponent implements Component {
893
943
  }
894
944
  }
895
945
 
896
- render(width: number): string[] {
897
- return this.items.map((item, i) => {
898
- const prefix = i === this.selectedIndex ? "> " : " ";
899
- return truncateToWidth(prefix + item, width);
900
- });
901
- }
902
-
903
- invalidate(): void {}
904
- }
905
- ```
906
-
907
- ### Handling line width
908
-
909
- Use the provided utilities so lines stay within `width`:
910
-
911
- ```typescript
912
- import { visibleWidth, truncateToWidth } from "@bastani/atomic-tui";
913
- import type { Component } from "@bastani/atomic-tui";
914
-
915
- class MyComponent implements Component {
916
- private text: string;
917
-
918
- constructor(text: string) {
919
- this.text = text;
920
- }
921
-
922
- render(width: number): string[] {
923
- // Option 1: Truncate long lines
924
- return [truncateToWidth(this.text, width)];
925
-
926
- // Option 2: Check and pad to exact width
927
- const line = this.text;
928
- const visible = visibleWidth(line);
929
- if (visible > width) {
930
- return [truncateToWidth(line, width)];
931
- }
932
- // Pad to exact width (optional, for backgrounds)
933
- return [line + " ".repeat(width - visible)];
934
- }
935
-
936
- invalidate(): void {}
937
- }
938
- ```
939
-
940
- ### ANSI code considerations
941
-
942
- Both `visibleWidth()` and `truncateToWidth()` handle ANSI escape codes:
943
-
944
- - `visibleWidth()` ignores ANSI codes when calculating display width.
945
- - `truncateToWidth()` preserves ANSI codes and closes active styles when truncating.
946
-
947
- ```typescript
948
- import chalk from "chalk";
949
-
950
- const styled = chalk.red("Hello") + " " + chalk.blue("World");
951
- const width = visibleWidth(styled); // 11 (not counting ANSI codes)
952
- const truncated = truncateToWidth(styled, 8); // Red "Hello" + " W..." with proper reset
953
- ```
954
-
955
- ### Caching
956
-
957
- Cache rendered lines and rebuild only when `width` changes or `invalidate()` runs:
958
-
959
- ```typescript
960
- class CachedComponent implements Component {
961
- private text: string;
962
- private cachedWidth?: number;
963
- private cachedLines?: string[];
964
-
965
946
  render(width: number): string[] {
966
947
  if (this.cachedLines && this.cachedWidth === width) {
967
948
  return this.cachedLines;
968
949
  }
969
-
970
- const lines = [truncateToWidth(this.text, width)];
971
-
972
950
  this.cachedWidth = width;
973
- this.cachedLines = lines;
974
- return lines;
951
+ this.cachedLines = this.items.map((item, i) =>
952
+ truncateToWidth(`${i === this.selectedIndex ? "> " : " "}${item}`, width),
953
+ );
954
+ return this.cachedLines;
975
955
  }
976
956
 
977
957
  invalidate(): void {
package/docs/libraries.md CHANGED
@@ -1,10 +1,10 @@
1
1
  ---
2
- title: "Libraries"
3
- sidebarTitle: "Libraries"
4
- description: "The TypeScript libraries Atomic is built on, published as @bastani/atomic-* packages you can use in extensions, SDK apps, or on their own."
2
+ title: "Standalone libraries"
3
+ sidebarTitle: "Overview"
4
+ description: "Explore the six standalone @bastani/atomic-* TypeScript libraries you can use in extensions, SDK apps, or independently on Node.js 22.19+."
5
5
  ---
6
6
 
7
- Atomic is built on six TypeScript libraries. Each one is published on npm at Atomic's version with every release, and each works on its own outside Atomic.
7
+ Atomic is built on six TypeScript libraries (requiring Node.js 22.19 or newer). Each package is published on npm at Atomic's version with every release, and each works independently outside Atomic.
8
8
 
9
9
  | Package | What it does |
10
10
  | --- | --- |
@@ -29,6 +29,6 @@ To build on Atomic's sessions, tools, and extensions rather than the bare librar
29
29
 
30
30
  ## Older package names
31
31
 
32
- These libraries began as forks of pi's packages. Extensions written for pi still work inside Atomic. Imports of `@earendil-works/pi-ai`, `@earendil-works/pi-tui`, `@earendil-works/pi-agent-core`, `@earendil-works/pi-codemode`, `@earendil-works/pi-schema`, `@earendil-works/pi-telemetry`, their `@mariozechner/pi-*` equivalents, and `@bastani/pi-ai`, along with their subpaths, resolve to the matching `@bastani/atomic-*` package.
32
+ These libraries began as forks of pi's packages. Extensions written for pi still work inside Atomic: imports of `@earendil-works/pi-coding-agent` and `@mariozechner/pi-coding-agent` map to `@bastani/atomic`, while `@earendil-works/pi-ai`, `@earendil-works/pi-tui`, `@earendil-works/pi-agent-core`, `@earendil-works/pi-codemode`, `@earendil-works/pi-schema`, `@earendil-works/pi-telemetry`, their `@mariozechner/pi-*` equivalents, and `@bastani/pi-ai` (plus subpaths) map to the matching `@bastani/atomic-*` package.
33
33
 
34
34
  Use the `@bastani/atomic-*` names in new code. The older names resolve only inside Atomic. Outside Atomic, install the `@bastani/atomic-*` packages.
package/docs/llama-cpp.md CHANGED
@@ -1,11 +1,10 @@
1
1
  ---
2
- title: "Local models"
3
- description: "Run models locally with a llama.cpp router server: discovery, load management, downloads, and local classification."
2
+ title: "Local models with llama.cpp"
3
+ sidebarTitle: "Local models"
4
+ description: "Connect Atomic to a local llama.cpp router server to discover, load, download, and run GGUF models and local classifiers."
4
5
  ---
5
6
 
6
- # llama.cpp
7
-
8
- Atomic supports the [llama.cpp](https://llama.app) router server. The router discovers multiple GGUF models and loads or unloads them on demand.
7
+ Atomic integrates with the [llama.cpp](https://llama.app) router server to discover local GGUF models, load or unload them on demand, download models from Hugging Face, and run local classification.
9
8
 
10
9
  ## Install llama.cpp
11
10
 
@@ -46,7 +45,7 @@ For settings tuned to a specific NVIDIA GPU and model, see [NVIDIA RTX recipes](
46
45
 
47
46
  ## Configure Atomic
48
47
 
49
- Run `/login llama.cpp` and enter the router URL and optional API key. The default URL is `http://127.0.0.1:9931`. When the router runs with `--no-models-autoload`, login saves only the connection; load a model with `/llama`, then select it with `/model`.
48
+ Run `/login llama.cpp` and enter the router URL and optional API key. The default URL is `http://127.0.0.1:9931` (trailing slashes and `/v1` are normalized automatically). When the router runs with `--no-models-autoload`, login saves only the connection; load a model with `/llama`, then select it with `/model`.
50
49
 
51
50
  You can configure the same values with environment variables instead of `/login`:
52
51
 
@@ -56,14 +55,14 @@ export LLAMA_API_KEY=optional-secret
56
55
  atomic
57
56
  ```
58
57
 
59
- If the server requires an API key, start `llama serve` with the matching `--api-key`. Keep `--host 127.0.0.1` for local-only access.
58
+ A server URL saved with `/login llama.cpp` (stored in `auth.json` under `env.LLAMA_BASE_URL`) takes precedence over `LLAMA_BASE_URL`. When no API key is configured, Atomic sends `"local"` as a placeholder key. If the server requires authentication, start `llama serve` with the matching `--api-key` and keep `--host 127.0.0.1` for local-only access.
60
59
 
61
60
  ## Manage models
62
61
 
63
62
  Run `/llama` in interactive mode to manage router models:
64
63
 
65
64
  - Select an unloaded model to load it, or a loaded model to unload it.
66
- - Select **Download model…** to search Hugging Face and pick a repository and quantization. Typing an exact `owner/repository[:quant]` value and pressing Enter downloads it directly.
65
+ - Select **Download model...** to search Hugging Face and pick a repository and quantization. Search returns up to 20 GGUF repositories sorted by downloads (15-second timeout). The quantization picker excludes `mmproj` projection files, lists `Q4_K_M` first, and sorts remaining quantizations from smallest to largest. Typing an exact `owner/repository` or `owner/repository:QUANT` value and pressing Enter downloads it directly.
67
66
  - Press Escape during a load or download to confirm cancellation.
68
67
 
69
68
  Hugging Face search checks `HF_TOKEN`, then `$HF_TOKEN_PATH`, `$HF_HOME/token`, `$XDG_CACHE_HOME/huggingface/token`, and `~/.cache/huggingface/token`. Unauthenticated search has lower rate limits. Atomic warns before gated downloads and links to the access page; because llama.cpp performs the download, its process also needs `HF_TOKEN` for gated repositories.
@@ -74,7 +73,36 @@ Atomic caches the last loaded-model catalog in `~/.atomic/agent/models-store.jso
74
73
 
75
74
  If the router disconnects, select **Retry** to reconnect and refresh state without replaying the interrupted action.
76
75
 
77
- Each llama.cpp model sets both `contextWindow` and `maxTokens` from the router-reported context window (`meta.n_ctx`, then the model's configured `--ctx-size`, cached context, training context `meta.n_ctx_train`, or the 128,000-token fallback). The server remains authoritative and may enforce a smaller generation limit.
76
+ Each llama.cpp model sets both `contextWindow` and `maxTokens` from the router-reported context window (`meta.n_ctx`, then the model's configured `--ctx-size`, `-c`, or `-ctx` argument, cached context, training context `meta.n_ctx_train`, or the 128,000-token fallback). The server remains authoritative and may enforce a smaller generation limit.
77
+
78
+ ### Thinking and vision detection
79
+
80
+ - **Thinking controls:** Atomic enables thinking controls only when a **currently loaded** model's server `/props` `chat_template` contains `"enable_thinking"`. Sleeping or unloaded autoload-preset models are not queried during discovery so they are not woken unexpectedly; load a model in `/llama` and refresh to detect its thinking template. When thinking is detected, Atomic exposes only **`off`** and **`medium`** thinking levels (`minimal`, `low`, `high`, `xhigh`, and `max` are unavailable).
81
+ - **Vision support:** Image input is enabled automatically when the server reports `"image"` in `architecture.input_modalities`.
82
+
83
+ ## Classification
84
+
85
+ Classifier models answer typed `choice`, `bool`, and `score` questions about JSON state, letting a local model serve `decide()` and `structured_output` decisions as your [`decisionModel`](/settings#decisionmodel). Extensions can call `ctx.modelRegistry.classify()` and codemode scripts can call `models.classify()`; see [Classifier models](/models#use-classifier-models).
86
+
87
+ Atomic exposes llama.cpp models as classifiers in two ways:
88
+
89
+ - **Decision models** (such as Julia-1, Laya, Kev, lev, and OpenJev) answer natively through llama.cpp's decision endpoint (`/v1/systemone`, API `typesafe-system-one`). Decision-only models do not appear in `/model`.
90
+ - **Chat models** are also exposed as classifiers under the same ID using next-token probability classification (API `llama-cpp-classify`).
91
+
92
+ llama.cpp 0.6.0 and newer identify decision models by including `decisions` in `architecture.output_modalities`. Atomic detects them even when sleeping or unloaded without waking them during discovery. Unloaded presets are selectable only when router autoload is enabled. Older servers omit this metadata and fall back to `llama-cpp-classify`.
93
+
94
+ ### Chat models as classifiers
95
+
96
+ Rather than generating text, Atomic formats each question as a single chat prompt (state, all request questions, state again, then the target question and single-token labels) and reads next-token probabilities for the labels. Labels are alphanumeric characters for `choice` (2 to 62 options; 1 option throws an error), `Yes`/`No` for `bool`, and digits for `score` (2 to 10 levels). If a label token is absent from the server's top probabilities, Atomic retries with larger `n_probs` up to 32,768. Choices return normalized option probabilities and a confidence of `(n * peak - 1) / (n - 1)`; scores return the expected level.
97
+
98
+ Key behavior for chat-model classifiers:
99
+
100
+ - An explicit [`decisionModel`](/settings#decisionmodel) resolves classifiers before chat models, so `decisionModel: "llama.cpp/<id>"` uses the classifier. A choice with more than 62 options fails on `llama-cpp-classify` and falls back to the active chat model. The **Decision model** picker lists each chat model twice (classifier and chat), saving the same ID; decision-only models have only a classifier row.
101
+ - `structured_output` and `generateStructuredOutput()` resolve chat models before classifiers when both share an ID, so naming `llama.cpp/<id>` there uses the chat model.
102
+ - SDK `classify()` accepts a `temperature` option that divides label logits before normalizing. Values above `1` soften overconfident probabilities without changing the winning answer.
103
+ - Questions run sequentially and share the prompt prefix so the server's prompt cache evaluates it once. Because the state appears twice in the prompt, reserve twice the state size in context.
104
+ - Small models may follow prompt-injection instructions inside the state despite the system prompt instructing them to judge the state as data.
105
+ - Hybrid models such as Qwen3.5 need context checkpoints to reuse a cached prefix across questions. If every question reprocesses the full state, start the router with `--ctx-checkpoints 32 --checkpoint-min-step 0`.
78
106
 
79
107
  ## NVIDIA RTX recipes
80
108
 
@@ -169,30 +197,6 @@ Follow [Configure Atomic](#configure-atomic) to connect to `http://127.0.0.1:993
169
197
 
170
198
  NVIDIA recipe memory budgets assume only that model occupies the GPU. Unload any other loaded models in `/llama` before running the recipe model.
171
199
 
172
- ## Classification
173
-
174
- Classifier models answer typed `choice`, `bool`, and `score` questions about JSON state, letting a local model serve `decide()` and `structured_output` decisions as your [`decisionModel`](/settings#decisionmodel). Extensions can call `ctx.modelRegistry.classify()` and codemode scripts can call `models.classify()`; see [Classifier models](/models#use-classifier-models).
175
-
176
- Atomic exposes llama.cpp models as classifiers in two ways:
177
-
178
- - **Decision models** (such as Julia-1, Laya, Kev, lev, and OpenJev) answer natively through llama.cpp's `/v1/systemone` endpoint with the `typesafe-system-one` API. Decision-only models do not appear in `/model`.
179
- - **Chat models** are also exposed as classifiers under the same ID with the `llama-cpp-classify` API, using next-token log-probabilities.
180
-
181
- llama.cpp 0.6.0 and newer identify decision models by including `decisions` in `architecture.output_modalities`. Atomic detects them even when sleeping or unloaded without waking them during discovery. Unloaded presets are selectable only when router autoload is enabled. Older servers omit this metadata and fall back to `llama-cpp-classify`.
182
-
183
- ### Chat models as classifiers
184
-
185
- Rather than generating text, Atomic formats each question as a single chat prompt (state, all request questions, state again, then the target question and single-token labels) and reads next-token probabilities for the labels. Labels are alphanumeric characters for `choice` (2 to 62 options), `Yes`/`No` for `bool`, and digits for `score` (2 to 10 levels). Choices return normalized option probabilities and a confidence of `(n * peak - 1) / (n - 1)`; scores return the expected level.
186
-
187
- Key behavior for chat-model classifiers:
188
-
189
- - An explicit [`decisionModel`](/settings#decisionmodel) resolves classifiers before chat models, so `decisionModel: "llama.cpp/<id>"` uses the classifier. A choice with more than 62 options fails on `llama-cpp-classify` and falls back to the active chat model. The **Decision model** picker lists each chat model twice (classifier and chat), saving the same ID; decision-only models have only a classifier row.
190
- - `structured_output` and `generateStructuredOutput()` resolve chat models before classifiers when both share an ID, so naming `llama.cpp/<id>` there uses the chat model.
191
- - SDK `classify()` accepts a `temperature` option that divides label logits before normalizing. Values above `1` soften overconfident probabilities without changing the winning answer.
192
- - Questions run sequentially and share the prompt prefix so the server's prompt cache evaluates it once. Because the state appears twice in the prompt, reserve twice the state size in context.
193
- - Small models may follow prompt-injection instructions inside the state despite the system prompt instructing them to judge the state as data.
194
- - Hybrid models such as Qwen3.5 need context checkpoints to reuse a cached prefix across questions. If every question reprocesses the full state, start the router with `--ctx-checkpoints 32 --checkpoint-min-step 0`.
195
-
196
200
  ## Troubleshooting
197
201
 
198
202
  ```bash
@@ -202,5 +206,6 @@ curl http://127.0.0.1:9931/models
202
206
 
203
207
  - **No models in `/llama`:** Verify cached models or `--models-dir` layout, then restart the router.
204
208
  - **Model missing from `/model` with `--no-models-autoload`:** Load it in `/llama` first.
209
+ - **Thinking controls missing:** Load the model in `/llama`, then refresh `/model`; thinking controls appear only for loaded models whose chat template includes `"enable_thinking"`.
205
210
  - **Load fails or runs out of memory:** Lower `-c` or unload another model.
206
211
  - **Server is not in router mode:** Start `llama serve` without `--model`, `-m`, or `-hf`.