@bastani/atomic 0.10.9 → 0.10.10-alpha.2

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 (406) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +226 -163
  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} +150 -62
  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 +87 -116
  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 +61 -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 +74 -141
  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 +61 -88
  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 +238 -243
  297. package/docs/build.md +21 -15
  298. package/docs/changelog.mdx +1 -1
  299. package/docs/codemode.md +68 -51
  300. package/docs/compaction/reference.md +65 -26
  301. package/docs/compaction.md +118 -66
  302. package/docs/computer-use.md +179 -146
  303. package/docs/containerization.md +87 -33
  304. package/docs/custom-provider/api-reference.md +152 -13
  305. package/docs/custom-provider/oauth.md +45 -28
  306. package/docs/custom-provider/override.md +14 -7
  307. package/docs/custom-provider/registration.md +77 -67
  308. package/docs/custom-provider/streaming.md +42 -19
  309. package/docs/custom-provider.md +26 -62
  310. package/docs/development.md +81 -42
  311. package/docs/docs.json +54 -38
  312. package/docs/environment-variables.md +92 -64
  313. package/docs/extensions/api-reference.md +326 -735
  314. package/docs/extensions/authoring.md +186 -269
  315. package/docs/extensions/events.md +308 -375
  316. package/docs/extensions/examples.md +122 -74
  317. package/docs/extensions/ui.md +217 -197
  318. package/docs/extensions.md +189 -259
  319. package/docs/getting-started/authentication.md +27 -14
  320. package/docs/getting-started/first-session.md +25 -26
  321. package/docs/getting-started/installation.md +62 -84
  322. package/docs/getting-started/project-instructions.md +39 -14
  323. package/docs/guides/configuration.md +62 -20
  324. package/docs/guides/intercom.md +20 -12
  325. package/docs/guides/non-interactive.md +31 -16
  326. package/docs/guides/orchestration.md +17 -9
  327. package/docs/guides/resume-on-any-machine.md +63 -52
  328. package/docs/guides/subagents.md +26 -14
  329. package/docs/guides/team-setup.md +49 -27
  330. package/docs/guides.md +30 -23
  331. package/docs/herdr.md +22 -17
  332. package/docs/index.md +24 -17
  333. package/docs/intercom/operations.md +90 -66
  334. package/docs/intercom/reference.md +219 -192
  335. package/docs/intercom.md +111 -92
  336. package/docs/json.md +73 -71
  337. package/docs/keybindings.md +74 -48
  338. package/docs/libraries/agent-core.md +52 -9
  339. package/docs/libraries/ai.md +90 -63
  340. package/docs/libraries/codemode.md +31 -8
  341. package/docs/libraries/schema.md +12 -9
  342. package/docs/libraries/storage-libsql.md +92 -0
  343. package/docs/libraries/storage-postgres.md +119 -0
  344. package/docs/libraries/telemetry.md +42 -9
  345. package/docs/libraries/tui.md +74 -94
  346. package/docs/libraries.md +25 -8
  347. package/docs/llama-cpp.md +38 -33
  348. package/docs/mcp-servers.md +140 -88
  349. package/docs/models/reference.md +53 -36
  350. package/docs/models-configuration.md +19 -13
  351. package/docs/models.md +102 -87
  352. package/docs/orchestration/migrating-workflows.md +22 -20
  353. package/docs/orchestration/patterns.md +36 -21
  354. package/docs/orchestration.md +24 -21
  355. package/docs/packages/authoring.md +29 -18
  356. package/docs/packages/reference.md +77 -16
  357. package/docs/packages.md +34 -34
  358. package/docs/programmatic.md +28 -21
  359. package/docs/prompt-templates.md +65 -41
  360. package/docs/providers/reference.md +36 -20
  361. package/docs/providers.md +78 -76
  362. package/docs/quickstart.md +42 -54
  363. package/docs/reference/cli.md +256 -254
  364. package/docs/reference.md +30 -23
  365. package/docs/rpc/examples.md +121 -17
  366. package/docs/rpc/extension-ui.md +86 -63
  367. package/docs/rpc/protocol.md +817 -358
  368. package/docs/rpc.md +78 -152
  369. package/docs/sdk/reference.md +309 -73
  370. package/docs/sdk/storage.md +614 -0
  371. package/docs/sdk/structured-decisions.md +168 -65
  372. package/docs/sdk/web-server.md +80 -46
  373. package/docs/sdk.md +168 -215
  374. package/docs/security.md +117 -44
  375. package/docs/session-format.md +127 -76
  376. package/docs/sessions.md +155 -113
  377. package/docs/settings.md +293 -205
  378. package/docs/shell-aliases.md +15 -6
  379. package/docs/skills/authoring.md +17 -9
  380. package/docs/skills/reference.md +23 -21
  381. package/docs/skills.md +148 -97
  382. package/docs/storage.md +172 -260
  383. package/docs/subagents/authoring.md +148 -15
  384. package/docs/subagents/reference.md +105 -29
  385. package/docs/subagents.md +247 -250
  386. package/docs/terminal-setup.md +97 -69
  387. package/docs/termux.md +51 -85
  388. package/docs/themes/reference.md +51 -37
  389. package/docs/themes.md +52 -55
  390. package/docs/tmux.md +38 -21
  391. package/docs/tools.md +209 -147
  392. package/docs/tui/reference.md +64 -32
  393. package/docs/tui.md +38 -66
  394. package/docs/usage.md +94 -86
  395. package/docs/verification.md +25 -25
  396. package/docs/web-access.md +106 -54
  397. package/docs/windows.md +55 -57
  398. package/docs/worktree-snapshots.md +82 -74
  399. package/examples/sdk/11-sessions.ts +4 -4
  400. package/package.json +8 -8
  401. package/schemas/models.schema.json +58 -7
  402. package/dist/_shared/sdk-OSBEPR3Q.js.map +0 -1
  403. package/dist/_shared/startup-0-0-TYUFUOJZ.js.map +0 -1
  404. package/dist/_shared/startup-0-1-W2G2UY7R.js.map +0 -1
  405. package/dist/_shared/startup-0-2-UXBUEOXW.js.map +0 -1
  406. package/dist/_shared/startup-0-4-HN5EB4K7.js.map +0 -1
@@ -1,26 +1,18 @@
1
1
  ---
2
- title: Extension UI
3
- description: Render custom UI from an extension.
2
+ title: "Extension UI"
3
+ sidebarTitle: "Custom UI"
4
+ description: "Build dialogs, widgets, status indicators, host-native pickers and forms, custom overlays, editors, and message renderers."
4
5
  ---
5
6
 
6
- # Extension UI
7
+ <div id="custom-ui" />
7
8
 
8
- ## Custom UI
9
+ Extensions interact with users through `ctx.ui` methods and customize how messages, entries, and tools render.
9
10
 
10
- Extensions interact with users through `ctx.ui` methods and customize how messages and tools render.
11
+ Check `ctx.hasUI` (or `ctx.mode === "tui"`) before showing interactive UI. For reusable component patterns (`SelectList`, `BorderedLoader`, `SettingsList`, working indicators, widgets, autocomplete, and custom footers), see [TUI components](/tui).
11
12
 
12
- For custom components, see [TUI components](/tui), which provides copy-paste patterns for:
13
+ > **Interactive mode note:** In default interactive mode, extensions run in a separate background worker process. Dialogs, `ctx.ui.custom()`, widgets, status, notifications, and host-native pickers and forms work everywhere. APIs that require synchronous terminal UI callbacks (`onTerminalInput`, sync `getEditorText`, `setEditorComponent`, `addAutocompleteProvider`, `setHeader`, and `setFooter`) warn and do not run in default interactive mode. See [Responsive UI and crash recovery](/extensions#interactive-callback-isolation).
13
14
 
14
- - Selection dialogs (`SelectList`)
15
- - Async operations with cancellation (`BorderedLoader`)
16
- - Settings toggles (`SettingsList`)
17
- - Status indicators (`setStatus`)
18
- - Working message, visibility, and indicator from accepted prompt startup through active turns (`setWorkingMessage`, `setWorkingVisible`, `setWorkingIndicator`)
19
- - Widgets above and below the editor (`setWidget`)
20
- - Autocomplete providers layered on top of built-in slash and path completion (`addAutocompleteProvider`)
21
- - Custom footers (`setFooter`)
22
-
23
- ### Dialogs
15
+ ## Dialogs
24
16
 
25
17
  ```typescript
26
18
  // Select from options
@@ -39,25 +31,19 @@ const text = await ctx.ui.editor("Edit:", "prefilled text");
39
31
  ctx.ui.notify("Done!", "info"); // "info" | "warning" | "error"
40
32
  ```
41
33
 
42
- Notifications emitted while extensions load or startup is in progress always appear below the startup `RESOURCES` disclosure line, never above it.
34
+ Notifications emitted during extension loading or startup always appear below the startup `RESOURCES` line.
43
35
 
44
- #### Timed dialogs with countdown
36
+ ### Timed dialogs with countdown
45
37
 
46
- Dialogs support a `timeout` option that auto-dismisses with a live countdown display:
38
+ Dialogs accept `{ timeout }` (in milliseconds) to auto-dismiss with a live countdown:
47
39
 
48
40
  ```typescript
49
- // Dialog shows "Title (5s)", then "Title (4s)", and auto-dismisses at 0
41
+ // Shows "Title (5s)", "Title (4s)", and auto-dismisses at 0
50
42
  const confirmed = await ctx.ui.confirm(
51
43
  "Timed Confirmation",
52
44
  "This dialog will auto-cancel in 5 seconds. Confirm?",
53
45
  { timeout: 5000 }
54
46
  );
55
-
56
- if (confirmed) {
57
- // User confirmed
58
- } else {
59
- // User cancelled or timed out
60
- }
61
47
  ```
62
48
 
63
49
  Return values on timeout or caller abort:
@@ -66,11 +52,11 @@ Return values on timeout or caller abort:
66
52
  - `confirm()` returns `false`
67
53
  - `input()` and `editor()` return `undefined`
68
54
 
69
- The dialog closes without requiring an answer. These defaults apply to the request's `timeout` and `signal`. Cancelling all pending human input, closing the session, or replacing its input host can still reject with `HumanInputCancelled`.
55
+ Cancelling all pending input, closing the session, or replacing its input host can still reject with `HumanInputCancelled`.
70
56
 
71
- #### Manual dismissal with AbortSignal
57
+ ### Manual dismissal with AbortSignal
72
58
 
73
- For finer control, such as distinguishing a timeout from a user cancel, pass an `AbortSignal`:
59
+ Pass `{ signal }` to dismiss a dialog programmatically and distinguish a timeout from a user cancel:
74
60
 
75
61
  ```typescript
76
62
  const controller = new AbortController();
@@ -87,31 +73,80 @@ clearTimeout(timeoutId);
87
73
  if (confirmed) {
88
74
  // User confirmed
89
75
  } else if (controller.signal.aborted) {
90
- // Dialog timed out
76
+ // Timed out
91
77
  } else {
92
- // User cancelled (pressed Escape or selected "No")
78
+ // User cancelled (Escape or "No")
93
79
  }
94
80
  ```
95
81
 
96
- See [examples/extensions/timed-confirm.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/examples/extensions/timed-confirm.ts) for complete examples.
82
+ See [examples/extensions/timed-confirm.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/examples/extensions/timed-confirm.ts).
83
+
84
+ ## Host-native pickers and forms
85
+
86
+ These APIs render directly in the terminal UI process so typing, search, validation, and keybindings stay instant even in default interactive mode. They are omitted in print and headless RPC modes (check before calling).
87
+
88
+ ### Session picker (`ctx.ui.hostSessionPicker`)
89
+
90
+ Open a searchable session-style picker with JSON-safe `HostSessionPickerRow` items (`SessionInfo` with `createdAt` and `modifiedAt` in epoch milliseconds):
91
+
92
+ ```typescript
93
+ const picker = ctx.ui.hostSessionPicker?.({
94
+ title: "Resume session",
95
+ sessions: rows,
96
+ onDelete: async (path) => {
97
+ await deleteSession(path);
98
+ },
99
+ });
100
+
101
+ // Update rows dynamically, surface a transient error, or close early:
102
+ picker?.update(updatedRows);
103
+ picker?.error("Could not refresh list");
104
+
105
+ const selectedPath = await picker?.result; // Selected path or undefined on cancel
106
+ ```
107
+
108
+ The returned `HostSessionPickerHandle` exposes `result`, `update(rows)`, `error(message)`, and `close()`. See [Host-native session picker](/tui/reference#host-native-session-picker).
97
109
 
98
- ### Widgets, status, and footer
110
+ ### Structured input form (`ctx.ui.hostInputForm`)
99
111
 
100
- Inline custom UIs opened with `{ purpose: "navigation" }` temporarily hide every `setWidget()` widget above and below the editor, including the agent panel. Queued-message and pending-shell previews also stay hidden. The widgets and previews keep updating and return with their latest content after the last inline navigation view closes. Overlays and the default `"prompt"` custom UIs do not hide them.
112
+ Open an inline structured form with JSON-safe field descriptors (`string`, `text`, `number`, `integer`, `boolean`, or `select`) and raw `initialValue` strings:
113
+
114
+ ```typescript
115
+ const values = await ctx.ui.hostInputForm?.({
116
+ title: "Configure endpoint",
117
+ fields: [
118
+ { name: "url", label: "Base URL", type: "string", initialValue: "https://api.example.com" },
119
+ { name: "retries", label: "Retries", type: "integer", initialValue: "3" },
120
+ ],
121
+ });
122
+ ```
123
+
124
+ `hostInputForm()` resolves to a raw `Record<string, string>` or `undefined` on cancel, and rejects with `"The host could not read this input form."` if the host cannot read the form. See [Host-native input form](/tui/reference#host-native-input-form).
125
+
126
+ ### Native questionnaire (`ctx.ui.hostQuestionnaire`)
127
+
128
+ Optional `ctx.ui.hostQuestionnaire?(params, signal)` delegates a full `ask_user_question` questionnaire to a host that implements native question UI. It returns the `QuestionnaireResult`, or `undefined` when the host cannot display it (so the caller renders the questionnaire itself).
129
+
130
+ ## Widgets, status, header, and footer
131
+
132
+ Inline custom UIs opened with `{ purpose: "navigation" }` temporarily hide all `setWidget()` widgets above and below the editor (including the agent panel) as well as queued-message and pending-shell previews. Widgets keep updating in the background and return with their latest content once the navigation view closes. Overlays and `"prompt"` custom UIs do not hide them.
101
133
 
102
134
  ```typescript
103
135
  // Status in footer (persistent until cleared)
104
136
  ctx.ui.setStatus("my-ext", "Processing...");
105
- ctx.ui.setStatus("my-ext", undefined); // Clear
137
+ ctx.ui.setStatus("my-ext", undefined);
106
138
 
107
- // Working loader customization (active from accepted prompt startup through the agent turn)
139
+ // Request a TUI repaint after async state changes
140
+ ctx.ui.requestRender();
141
+
142
+ // Working loader customization (active from prompt submission through the turn)
108
143
  ctx.ui.setWorkingMessage("Thinking deeply...");
109
- ctx.ui.setWorkingMessage(); // Restore default
110
- ctx.ui.setWorkingVisible(false); // Hide the built-in working indicator; the compaction indicator stays visible
111
- ctx.ui.setWorkingVisible(true); // Show the built-in working indicator
144
+ ctx.ui.setWorkingMessage(); // Restore default
145
+ ctx.ui.setWorkingVisible(false); // Hide working row (compaction indicator stays visible)
146
+ ctx.ui.setWorkingVisible(true);
112
147
 
113
- // Working indicator customization (same lifecycle; see TUI Pattern 4b)
114
- ctx.ui.setWorkingIndicator({ frames: [ctx.ui.theme.fg("accent", "●")] }); // Static dot
148
+ // Working indicator customization (see TUI Pattern 4b)
149
+ ctx.ui.setWorkingIndicator({ frames: [ctx.ui.theme.fg("accent", "●")] });
115
150
  ctx.ui.setWorkingIndicator({
116
151
  frames: [
117
152
  ctx.ui.theme.fg("dim", "·"),
@@ -121,99 +156,84 @@ ctx.ui.setWorkingIndicator({
121
156
  ],
122
157
  intervalMs: 120,
123
158
  });
124
- ctx.ui.setWorkingIndicator({ frames: [] }); // Hide indicator
125
- ctx.ui.setWorkingIndicator(); // Restore the default one-cell ∀ luminance ramp
126
- // The working status uses a standalone row by default. A CustomEditor can opt
127
- // into placing it in the top border with { embedWorkingStatus: true }.
159
+ ctx.ui.setWorkingIndicator({ frames: [] }); // Hide indicator
160
+ ctx.ui.setWorkingIndicator(); // Restore default ∀ ramp
161
+
162
+ // Label shown when thinking blocks are collapsed (Ctrl+T)
163
+ ctx.ui.setHiddenThinkingLabel("Pondering...");
164
+ ctx.ui.setHiddenThinkingLabel(); // Restore default
128
165
 
129
- // Widget above editor (default)
166
+ // Widget above or below editor
130
167
  ctx.ui.setWidget("my-widget", ["Line 1", "Line 2"]);
131
- // Widget below editor
132
168
  ctx.ui.setWidget("my-widget", ["Line 1", "Line 2"], { placement: "belowEditor" });
133
169
  ctx.ui.setWidget("my-widget", (tui, theme) => new Text(theme.fg("accent", "Custom"), 0, 0));
134
- ctx.ui.setWidget("my-widget", undefined); // Clear
170
+ ctx.ui.setWidget("my-widget", undefined); // Clear
135
171
 
136
- // Custom footer (replaces built-in footer)
137
- ctx.ui.setFooter((tui, theme) => ({
138
- render(width) { return [theme.fg("dim", "Custom footer")]; },
172
+ // Scrollable widget with capped height and release callback
173
+ ctx.ui.setWidget(
174
+ "my-scrollable",
175
+ (tui, theme) => myScrollableComponent, // Implements ScrollableWidgetComponent (getScrollRequest?, onScroll?)
176
+ { placement: "aboveEditor", scroll: { maxHeight: 12, maxHeightFraction: 0.35 } },
177
+ );
178
+ const unsubscribeRelease = ctx.ui.onWidgetRelease?.("my-scrollable", () => {
179
+ // Clean up resources when the host releases this widget
180
+ });
181
+
182
+ // Custom startup header and custom footer (embedded/non-worker interactive sessions)
183
+ ctx.ui.setHeader((tui, theme) => new Text(theme.fg("accent", "Custom header"), 0, 0));
184
+ ctx.ui.setHeader(undefined); // Restore built-in header
185
+
186
+ ctx.ui.setFooter((tui, theme, footerData) => ({
187
+ render(width) {
188
+ const branch = footerData.getGitBranch() ?? "";
189
+ return [theme.fg("dim", `Custom footer ${branch}`)];
190
+ },
139
191
  invalidate() {},
140
192
  }));
141
- ctx.ui.setFooter(undefined); // Restore built-in footer
193
+ ctx.ui.setFooter(undefined); // Restore built-in footer
142
194
 
143
- // Terminal title
195
+ // Read built-in footer data (git branch, extension statuses) directly
196
+ const footerData = ctx.ui.getFooterDataProvider();
197
+
198
+ // Terminal window/tab title
144
199
  ctx.ui.setTitle("atomic - my-project");
145
200
 
146
- // Editor text
201
+ // Editor text and paste
147
202
  ctx.ui.setEditorText("Prefill text");
148
203
  const current = ctx.ui.getEditorText();
204
+ ctx.ui.pasteToEditor("pasted content"); // Applies normal paste handling and large-paste collapse
149
205
 
150
- // Paste into editor (triggers paste handling, including collapse for large content)
151
- ctx.ui.pasteToEditor("pasted content");
152
-
153
- // Stack custom autocomplete behavior on top of the built-in provider
154
- ctx.ui.addAutocompleteProvider((current) => ({
155
- async getSuggestions(lines, line, col, options) {
156
- const beforeCursor = (lines[line] ?? "").slice(0, col);
157
- const match = beforeCursor.match(/(?:^|[ \t])#([^\s#]*)$/);
158
- if (!match) {
159
- return current.getSuggestions(lines, line, col, options);
160
- }
161
-
162
- return {
163
- prefix: `#${match[1] ?? ""}`,
164
- items: [{ value: "#42", label: "#42", description: "Fix login redirect" }],
165
- };
166
- },
167
- applyCompletion(lines, line, col, item, prefix) {
168
- return current.applyCompletion(lines, line, col, item, prefix);
169
- },
170
- shouldTriggerFileCompletion(lines, line, col) {
171
- return current.shouldTriggerFileCompletion?.(lines, line, col) ?? true;
172
- },
173
- }));
206
+ // Raw terminal input interceptor (embedded/non-worker interactive sessions)
207
+ const stopInput = ctx.ui.onTerminalInput((data) => {
208
+ if (data === "\x07") return { consume: true };
209
+ return undefined;
210
+ });
174
211
 
175
212
  // Tool output expansion
176
213
  const wasExpanded = ctx.ui.getToolsExpanded();
177
214
  ctx.ui.setToolsExpanded(true);
178
215
  ctx.ui.setToolsExpanded(wasExpanded);
179
216
 
180
- // Custom editor (vim mode, emacs mode, etc.)
181
- ctx.ui.setEditorComponent((tui, theme, keybindings) => new VimEditor(tui, theme, keybindings));
182
- const currentEditor = ctx.ui.getEditorComponent();
183
- ctx.ui.setEditorComponent((tui, theme, keybindings) =>
184
- new WrappedEditor(tui, theme, keybindings, currentEditor?.(tui, theme, keybindings))
185
- );
186
- ctx.ui.setEditorComponent(undefined); // Restore default editor
187
-
188
- // Theme management (see Themes for creating custom themes)
189
- const themes = ctx.ui.getAllThemes(); // [{ name: "dark", path: "/..." | undefined }, ...]
190
- const lightTheme = ctx.ui.getTheme("light"); // Load without switching
191
- const result = ctx.ui.setTheme("light"); // Switch by name
217
+ // Theme management
218
+ const themes = ctx.ui.getAllThemes(); // [{ name: "dark", path: "/..." | undefined }, ...]
219
+ const lightTheme = ctx.ui.getTheme("light");
220
+ const result = ctx.ui.setTheme("light");
192
221
  if (!result.success) {
193
222
  ctx.ui.notify(`Failed: ${result.error}`, "error");
194
223
  }
195
- ctx.ui.setTheme(lightTheme!); // Or switch by Theme object
196
- ctx.ui.theme.fg("accent", "styled text"); // Access current theme
224
+ if (lightTheme) ctx.ui.setTheme(lightTheme);
225
+ ctx.ui.theme.fg("accent", "styled text");
197
226
  ```
198
227
 
199
- Calling `setToolsExpanded()` with the current value is a no-op.
200
-
201
- The default indicator is `∀`. `ATOMIC_REDUCED_MOTION=1` makes it static, and `NO_COLOR` disables foreground colors. Custom frames and intervals render as supplied; add colors with `ctx.ui.theme.fg(...)` if wanted.
202
-
203
- These APIs customize presentation only; they do not start work or emit an extension stream event before prompt startup. See [Working indicator customization](/tui#pattern-4b-working-indicator-customization) for accepted-prompt, pre-stream, and agent-turn handoff timing.
204
-
205
- ### Autocomplete providers
228
+ Calling `setToolsExpanded()` with the current value is a no-op. `ATOMIC_REDUCED_MOTION=1` makes the default `∀` working indicator static, and `NO_COLOR` disables foreground colors. Custom frames render verbatim; apply theme colors with `ctx.ui.theme.fg(...)` when needed.
206
229
 
207
- Use `ctx.ui.addAutocompleteProvider()` to stack custom autocomplete logic on top of the built-in slash-command and path provider.
230
+ These APIs customize display only; they do not start turns or emit stream events. See [Working indicator customization](/tui#pattern-4b-working-indicator-customization) for timing details.
208
231
 
209
- Return the complete result from a provider you wrap, including its metadata. Slash-command suggestions can set `completeOnConfirm: false` so Enter submits the typed command literally until the user navigates the suggestion list; Tab still accepts the highlighted completion.
232
+ ## Autocomplete providers
210
233
 
211
- Typical pattern:
234
+ Use `ctx.ui.addAutocompleteProvider()` (available when running directly in the terminal UI process) to layer custom completion on top of built-in slash-command and path completion.
212
235
 
213
- - Inspect the text before the cursor.
214
- - Return your own suggestions when your extension-specific syntax matches.
215
- - Delegate to `current.getSuggestions(...)` otherwise.
216
- - Delegate `applyCompletion(...)` unless you need custom insertion behavior.
236
+ Return the complete result from the wrapped provider, including its metadata. Slash-command suggestions can set `completeOnConfirm: false` so `Enter` submits the typed command literally until the user navigates the list, while `Tab` still accepts the highlighted item.
217
237
 
218
238
  ```typescript
219
239
  atomic.on("session_start", (_event, ctx) => {
@@ -246,16 +266,18 @@ atomic.on("session_start", (_event, ctx) => {
246
266
  });
247
267
  ```
248
268
 
249
- See [github-issue-autocomplete.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/examples/extensions/github-issue-autocomplete.ts) for a complete example that preloads the latest open GitHub issues with `gh issue list` and filters them locally for `#...` completion. It requires GitHub CLI (`gh`) and a GitHub repository checkout.
269
+ See [github-issue-autocomplete.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/examples/extensions/github-issue-autocomplete.ts) for a complete example using `gh issue list`.
250
270
 
251
- ### Custom components
271
+ ## Custom components
252
272
 
253
- For complex UI, use `ctx.ui.custom()`. This temporarily replaces the editor with your component until `done()` is called:
273
+ Use `ctx.ui.custom()` to mount an interactive component until it calls `done(value)`. The `factory` callback may be synchronous or async (`Promise<ExtensionCustomComponent>`):
254
274
 
255
275
  ```typescript
256
276
  import { Text, type Component } from "@bastani/atomic-tui";
257
277
 
258
278
  class ConfirmPrompt implements Component {
279
+ constructor(private readonly done: (value: boolean) => void) {}
280
+
259
281
  render(width: number): string[] {
260
282
  return new Text("Enter Confirm · Escape Cancel", 1, 1).render(width);
261
283
  }
@@ -273,63 +295,65 @@ class ConfirmPrompt implements Component {
273
295
  }
274
296
  return false;
275
297
  }
276
-
277
- constructor(private readonly done: (value: boolean) => void) {}
278
298
  }
279
299
 
280
- const result = await ctx.ui.custom<boolean>((_tui, _theme, _keybindings, done) => {
300
+ const result = await ctx.ui.custom<boolean>(async (_tui, _theme, _keybindings, done) => {
281
301
  return new ConfirmPrompt(done);
282
302
  });
283
-
284
- if (result) {
285
- // User pressed Enter
286
- }
287
303
  ```
288
304
 
289
- The callback receives four arguments:
305
+ The factory receives four arguments:
290
306
 
291
- - `tui`. The TUI instance for screen dimensions and focus management.
292
- - `theme`. The current theme for styling.
293
- - `keybindings`. The app keybinding manager for checking shortcuts.
294
- - `done(value)`. Call to close the component and return a value.
307
+ - `tui`: TUI instance for screen dimensions and focus management
308
+ - `theme`: current theme for styling
309
+ - `keybindings`: configured `KeybindingsManager` for shortcut matching
310
+ - `done(value)`: closes the component and resolves `ctx.ui.custom()` with `value` (must be JSON-serializable in default interactive mode)
295
311
 
296
- Pass `{ signal }` to dismiss the custom UI when an operation aborts. In-process mode rejects the returned promise with the signal reason; isolated interactive mode resolves it with `undefined`, like host-side cancellation.
312
+ Supported `options`:
297
313
 
298
- Custom component `handleInput` methods must return `true` when they consume an input and `false` or `undefined` when they do not. In fullscreen mode, an unhandled viewport key continues to the transcript; remote components also fall through on a failed or timed-out reply. Return `true` for a handled key so it is not applied twice.
314
+ | Option | Type | Purpose |
315
+ | --- | --- | --- |
316
+ | `purpose` | `"prompt" \| "navigation"` | Defaults to `"prompt"`. `"navigation"` skips approval-prompt events and temporarily hides widgets while an inline view is open. |
317
+ | `overlay` | `boolean` | Render as a floating modal over existing content instead of replacing the editor. |
318
+ | `overlayOptions` | `OverlayOptions \| (() => OverlayOptions)` | Static or dynamic positioning and sizing options; function form recomputes on terminal resize. |
319
+ | `onHandle` | `(handle: OverlayHandle) => void` | Receive the overlay handle to show or hide it programmatically. |
320
+ | `reserveTranscriptRows` | `boolean` | Overlay-only. Reserves at least six visible transcript rows above a bottom-anchored blocking dialog. |
321
+ | `handlesCtrlC` | `boolean` | Set `true` when the component handles `Ctrl+C` itself; otherwise Atomic closes it on the first `Ctrl+C` press. |
322
+ | `handlesInternalUiAction` | `boolean` | Declare that the component handles internal UI actions such as jump-to-bottom links. |
323
+ | `deferInlineCustomUiFocus` | `boolean` | Keep a pending inline custom UI unfocused in the background while this overlay is open. |
324
+ | `blocked` | `{ kind: ProgramStatus["kind"], message: string }` | Report Atomic as blocked on user input (OSC 7501 status) while waiting. |
325
+ | `signal` | `AbortSignal` | Dismiss the custom UI programmatically. In default interactive mode, aborting resolves `ctx.ui.custom()` with `undefined` (like user cancel); when embedded in the same process, it rejects with the signal's abort reason. |
299
326
 
300
- A handler that returns a promise is judged when it settles. Only a resolved `true` consumes the key, while `false`, `undefined`, and a rejection fall through to the viewport. A component with no `handleInput` declines everything, so viewport keys still scroll the transcript behind it.
327
+ ### Input handling contract
301
328
 
302
- Pass `{ handlesCtrlC: true }` when the component binds Ctrl+C itself (cancel, skip, or close). In isolated interactive sessions the host otherwise closes a component that owns input on the first Ctrl+C, so a component that never resolves cannot trap the keyboard. See [Interactive callback isolation](/extensions#interactive-callback-isolation).
329
+ - `handleInput(data)` must return `true` when it consumes an input and `false` or `undefined` when it does not.
330
+ - In fullscreen mode, an unhandled viewport key continues to the transcript. If a component does not reply in time, the key also falls through to the transcript.
331
+ - An async `handleInput()` is judged when its promise settles: only a resolved `true` consumes the key, while `false`, `undefined`, and rejections fall through.
332
+ - A component without `handleInput` declines all keys so viewport keys continue scrolling the transcript behind it.
333
+ - Set `{ handlesCtrlC: true }` whenever your component binds `Ctrl+C` itself. Otherwise Atomic closes the component on the first `Ctrl+C` so a hung component cannot trap the keyboard. See [Responsive UI and crash recovery](/extensions#interactive-callback-isolation).
303
334
 
304
335
  See [TUI components](/tui) for the full component API.
305
336
 
306
- #### Overlay mode (experimental)
337
+ ### Overlay mode
307
338
 
308
- Pass `{ overlay: true }` to render the component as a floating modal on top of existing content, without clearing the screen:
309
-
310
- ```typescript
311
- const result = await ctx.ui.custom<string | null>(
312
- (tui, theme, keybindings, done) => new MyOverlayComponent({ onClose: done }),
313
- { overlay: true }
314
- );
315
- ```
316
-
317
- For positioning (anchors, margins, percentages, and responsive visibility), pass `overlayOptions`. Use `onHandle` to control visibility programmatically:
339
+ Pass `{ overlay: true }` to render a floating modal without clearing the screen:
318
340
 
319
341
  ```typescript
320
342
  const result = await ctx.ui.custom<string | null>(
321
343
  (tui, theme, keybindings, done) => new MyOverlayComponent({ onClose: done }),
322
344
  {
323
345
  overlay: true,
324
- overlayOptions: { anchor: "top-right", width: "50%", margin: 2 },
325
- onHandle: (handle) => { /* handle.setHidden(true/false) */ }
326
- }
346
+ overlayOptions: () => ({ anchor: "top-right", width: "50%", margin: 2 }),
347
+ onHandle: (handle) => {
348
+ // handle.setHidden(true/false)
349
+ },
350
+ },
327
351
  );
328
352
  ```
329
353
 
330
- See [TUI components](/tui) for the full `OverlayOptions` API and [overlay-qa-tests.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/examples/extensions/overlay-qa-tests.ts) for examples.
354
+ See [overlay-qa-tests.ts](https://github.com/bastani-inc/atomic/blob/main/packages/coding-agent/examples/extensions/overlay-qa-tests.ts) for positioning and resize examples.
331
355
 
332
- Pass `{ reserveTranscriptRows: true }` for a blocking bottom dialog that must leave at least six transcript rows visible. Set `overlayOptions.anchor` to `bottom-left`, `bottom-center`, or `bottom-right`; `row` and nonzero `offsetY` are rejected. Horizontal placement, margins, and numeric or percentage `maxHeight` remain supported. Reservation updates on resize and visibility changes and ends when the overlay closes. Leave it unset for a full-screen overlay. The built-in `ask_user_question` dialog uses it.
356
+ Pass `{ reserveTranscriptRows: true }` for a blocking bottom dialog that must leave at least six transcript rows visible:
333
357
 
334
358
  ```typescript
335
359
  const result = await ctx.ui.custom<string | null>(
@@ -338,13 +362,13 @@ const result = await ctx.ui.custom<string | null>(
338
362
  overlay: true,
339
363
  reserveTranscriptRows: true,
340
364
  overlayOptions: { anchor: "bottom-center", width: "100%" },
341
- }
365
+ },
342
366
  );
343
367
  ```
344
368
 
345
- A component mounted with `reserveTranscriptRows` always releases configured fullscreen transcript actions and vertical wheel input to the host viewport, including while a nested input has focus. The component keeps all other keyboard and mouse input, including text editing, arrows, confirmation, cancellation, and clicks. This rule applies only to reserving overlays. Other focused overlays still receive page and wheel input first and can keep it by returning `true`.
346
-
347
- Embed `OVERLAY_ACTIVE_ROW_MARKER` once per frame on the line that should stay visible when the dialog is cropped, usually the selected row. The first marked line wins, even with `maxHeight: 1`. The marker has zero visible width and is removed before terminal output. Focused inputs also keep their cursor row visible.
369
+ - Set `overlayOptions.anchor` to `bottom-left`, `bottom-center`, or `bottom-right`; `row` and nonzero `offsetY` are rejected.
370
+ - A reserving overlay always passes fullscreen transcript scroll keys and vertical mouse wheel input through to the transcript, even when a nested input has focus, while keeping all other keyboard and mouse input.
371
+ - Embed `OVERLAY_ACTIVE_ROW_MARKER` from `@bastani/atomic` once per frame on the active row so it remains visible when the dialog is cropped (zero visible width, stripped before terminal output):
348
372
 
349
373
  ```typescript
350
374
  import { OVERLAY_ACTIVE_ROW_MARKER } from "@bastani/atomic";
@@ -356,9 +380,9 @@ render(width: number): string[] {
356
380
  }
357
381
  ```
358
382
 
359
- ### Custom editor
383
+ ## Custom editor
360
384
 
361
- Replace the main input editor with a custom implementation (such as vim or emacs mode):
385
+ Replace the main input editor (available when extensions run directly in the terminal UI process) by extending `CustomEditor`:
362
386
 
363
387
  ```typescript
364
388
  import { CustomEditor, type ExtensionAPI } from "@bastani/atomic";
@@ -376,14 +400,14 @@ class VimEditor extends CustomEditor {
376
400
  this.mode = "insert";
377
401
  return true;
378
402
  }
379
- return super.handleInput(data); // App keybindings + text editing
403
+ return super.handleInput(data);
380
404
  }
381
405
  }
382
406
 
383
407
  export default function (atomic: ExtensionAPI) {
384
408
  atomic.on("session_start", (_event, ctx) => {
385
409
  ctx.ui.setEditorComponent((tui, theme, keybindings) =>
386
- new VimEditor(tui, theme, keybindings)
410
+ new VimEditor(tui, theme, keybindings),
387
411
  );
388
412
  });
389
413
  }
@@ -391,40 +415,28 @@ export default function (atomic: ExtensionAPI) {
391
415
 
392
416
  Key points:
393
417
 
394
- - Extend `CustomEditor` (not base `Editor`) to get app keybindings such as Escape to abort, Ctrl+D, and model switching.
395
- - Call `super.handleInput(data)` for keys you do not handle. A passed-through key keeps its prompt behavior: Down (`app.agents.focus`) on an empty prompt focuses the agent panel, and Left (`app.nav.back`) on an empty prompt returns from a subagent's chat to `main`.
396
- - Editors keep the standalone working row by default. Pass `{ embedWorkingStatus: true }` as the fourth `CustomEditor` constructor argument to place the spinner in the editor border.
397
- - The factory receives `tui`, `theme`, and `keybindings` from the app.
398
- - Call `ctx.ui.getEditorComponent()` before `setEditorComponent()` to wrap a previously configured custom editor.
399
- - Pass `undefined` to restore the default editor: `ctx.ui.setEditorComponent(undefined)`.
400
- - When a custom editor installed through `ctx.ui.setEditorComponent()` exposes `setAutocompleteMaxVisible()`, Atomic initializes it from the active `autocompleteMaxVisible` setting.
418
+ - Extend `CustomEditor` (not base `Editor`) so built-in shortcuts such as Escape, Ctrl+D, model switching, and prompt navigation (`Down` to focus the agent panel, `Left` to return from a subagent to `main`) keep working via `super.handleInput(data)`.
419
+ - Pass `{ embedWorkingStatus: true }` as the fourth `CustomEditor` constructor argument to draw the working indicator inside the editor's top border instead of a standalone row.
420
+ - Capture `const previous = ctx.ui.getEditorComponent()` before calling `setEditorComponent()` to wrap another extension's editor, and pass `undefined` to restore the default editor.
421
+ - If your custom editor implements `setAutocompleteMaxVisible()`, Atomic initializes it from `autocompleteMaxVisible` in settings.
401
422
 
402
- To compose with another extension that already replaced the editor, capture the previous factory before setting yours:
423
+ ## Message rendering
403
424
 
404
- ```typescript
405
- const previous = ctx.ui.getEditorComponent();
406
- ctx.ui.setEditorComponent((tui, theme, keybindings) =>
407
- new MyEditor(tui, theme, keybindings, { base: previous?.(tui, theme, keybindings) })
408
- );
409
- ```
410
-
411
- See [TUI components](/tui) Pattern 7 for a complete example with a mode indicator.
412
-
413
- ### Message rendering
414
-
415
- Register a custom renderer for messages with your `customType`:
425
+ Register a custom renderer for messages carrying your `customType`:
416
426
 
417
427
  ```typescript
418
428
  import { Text } from "@bastani/atomic-tui";
419
429
 
420
430
  atomic.registerMessageRenderer("my-extension", (message, options, theme) => {
431
+ if (!message.details) return null; // Suppress completely (no box, no spacer)
432
+
421
433
  const { expanded, outputPad } = options;
422
434
  let text = theme.fg("accent", `[${message.customType}] `);
423
435
  text += message.content;
424
436
 
425
- if (expanded && message.details) {
437
+ if (expanded) {
426
438
  text += "\n" + theme.fg("dim", JSON.stringify(message.details, null, 2));
427
- } else if (message.details) {
439
+ } else {
428
440
  text += ` (${options.keyHint("app.tools.expand", "to expand")})`;
429
441
  }
430
442
 
@@ -432,55 +444,63 @@ atomic.registerMessageRenderer("my-extension", (message, options, theme) => {
432
444
  });
433
445
  ```
434
446
 
435
- In fullscreen mode, clicking the message toggles `expanded` for that message alone (just as Ctrl+O does for every block) and Atomic calls your renderer again.
447
+ Return-value contract for `registerMessageRenderer`:
448
+
449
+ - **`Component`:** Mounts and renders your component in the transcript.
450
+ - **`null`:** Suppresses the message completely (zero rows, no spacer, and no default fallback box). Useful for hiding rehydrated messages whose backing state no longer exists.
451
+ - **`undefined`:** Falls back to Atomic's default boxed `[customType]` rendering.
436
452
 
437
- When the main chat runs in the terminal UI process, a message, saved-entry, or tool renderer's component can handle a click first by returning `{ handled: true }` from `handleMouse`. Leave clicks outside the control unhandled to keep click-to-expand there. A tool's title row always toggles first. A separate engine sends rendered rows rather than mouse callbacks, and if your renderer draws the same rows either way, clicking leaves the message unchanged.
453
+ In fullscreen mode, clicking a custom message toggles `expanded` for that message alone (just as `Ctrl+O` toggles every block) and calls your renderer again. When running directly in the terminal UI process, a component can intercept clicks first by returning `{ handled: true }` from `handleMouse`; in default interactive mode, rendered rows are sent without custom mouse callbacks. A tool's title row always toggles first.
438
454
 
439
- Messages are sent via `atomic.sendMessage()`:
455
+ Send matching messages with `atomic.sendMessage()`:
440
456
 
441
457
  ```typescript
442
- atomic.sendMessage({
443
- customType: "my-extension", // Matches registerMessageRenderer
458
+ await atomic.sendMessage({
459
+ customType: "my-extension",
444
460
  content: "Status update",
445
- display: true, // Show in TUI
446
- details: { ... }, // Available in renderer
461
+ display: true,
462
+ details: { step: 2 },
447
463
  });
448
464
  ```
449
465
 
450
- ### Theme colors
466
+ ## Theme colors
451
467
 
452
- All render functions receive a `theme` object. See [Themes](/themes) for creating custom themes and the full color palette.
468
+ All render functions receive the active `theme` object. See [Customize themes](/themes) and [Theme reference](/themes/reference) for all color tokens.
453
469
 
454
470
  ```typescript
455
- // Foreground colors
456
- theme.fg("toolTitle", text) // Tool names
457
- theme.fg("accent", text) // Highlights
458
- theme.fg("success", text) // Success (green)
459
- theme.fg("error", text) // Errors (red)
460
- theme.fg("warning", text) // Warnings (yellow)
461
- theme.fg("muted", text) // Secondary text
462
- theme.fg("dim", text) // Tertiary text
471
+ // Foreground and background colors
472
+ theme.fg("toolTitle", text)
473
+ theme.fg("accent", text)
474
+ theme.fg("success", text)
475
+ theme.fg("error", text)
476
+ theme.fg("warning", text)
477
+ theme.fg("muted", text)
478
+ theme.fg("dim", text)
479
+ theme.bg("selectedBg", text)
463
480
 
464
481
  // Text styles
465
482
  theme.bold(text)
466
483
  theme.italic(text)
484
+ theme.underline(text)
485
+ theme.dim(text)
486
+ theme.inverse(text)
467
487
  theme.strikethrough(text)
488
+
489
+ // Raw ANSI escape sequences
490
+ theme.getFgAnsi("accent")
491
+ theme.getBgAnsi("selectedBg")
468
492
  ```
469
493
 
470
- For syntax highlighting in custom tool renderers:
494
+ Syntax highlighting helper for custom renderers:
471
495
 
472
496
  ```typescript
473
497
  import { highlightCode, getLanguageFromPath } from "@bastani/atomic";
474
498
 
475
- // Highlight code with explicit language
476
- const highlighted = highlightCode("const x = 1;", "typescript", theme);
477
-
478
- // Auto-detect language from file path
479
- const lang = getLanguageFromPath("/path/to/file.rs"); // "rust"
480
- const highlighted = highlightCode(code, lang, theme);
499
+ const lang = getLanguageFromPath("/path/to/file.rs"); // "rust"
500
+ const highlighted = highlightCode("fn main() {}", lang, theme);
481
501
  ```
482
502
 
483
- To label a `read` call's line range from `offset` and `limit` arguments, use `formatReadLineRange`. It accepts numbers, numeric strings, and `null`, and returns an empty string for missing or malformed ranges:
503
+ Line-range label helper for `read`-like tools (`formatReadLineRange` accepts numbers, numeric strings, and `null`, returning `""` for missing or malformed ranges):
484
504
 
485
505
  ```typescript
486
506
  import { formatReadLineRange } from "@bastani/atomic";
@@ -492,4 +512,4 @@ formatReadLineRange("abc", 13); // ""
492
512
 
493
513
  ## Next steps
494
514
 
495
- Try the runnable [extension examples](/extensions/examples), and use the [Extension API reference](/extensions/api-reference) for context and method contracts.
515
+ Try the runnable [Extension examples](/extensions/examples), and check context properties and method signatures in the [Extension API reference](/extensions/api-reference).