@bastani/atomic 0.10.18-alpha.1 → 0.10.19-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 (369) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/README.md +27 -5
  3. package/dist/_shared/config-binary-install-SNFYFXWB.js +70 -0
  4. package/dist/_shared/config-binary-install-SNFYFXWB.js.map +1 -0
  5. package/dist/_shared/dist-KOELCESV.js +2 -2
  6. package/dist/_shared/fork-row-index-UAUAQRD5.js +2 -2
  7. package/dist/_shared/lib-4PES5P4V.js +2 -2
  8. package/dist/_shared/{mode-interactive-sdk-7KXUFI2F.js → mode-interactive-sdk-JXBZ3H27.js} +434 -11
  9. package/dist/_shared/mode-interactive-sdk-JXBZ3H27.js.map +1 -0
  10. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js +21 -6
  11. package/dist/_shared/mode-rpc-sdk-IOPGDYR4.js.map +1 -1
  12. package/dist/_shared/mode-shared-2QJSCUM6.js +7 -6
  13. package/dist/_shared/mode-shared-2QJSCUM6.js.map +1 -1
  14. package/dist/_shared/p0-cli-BB45ZQY6.js +56 -3
  15. package/dist/_shared/p0-cli-BB45ZQY6.js.map +1 -1
  16. package/dist/_shared/p1a-prewarm-XIU57JHF.js +3 -3
  17. package/dist/_shared/runtime-O4KCSG4C.js +3 -3
  18. package/dist/_shared/{sdk-OHKMDJ74.js → sdk-BHX35EPK.js} +47 -17
  19. package/dist/_shared/sdk-BHX35EPK.js.map +1 -0
  20. package/dist/_shared/session-data-AHTU7IS6.js +2 -2
  21. package/dist/_shared/session-manager-list-2BLEEZVG.js +1 -1
  22. package/dist/_shared/{startup-0-0-OV6RAEAP.js → startup-0-0-4EDVBK5P.js} +464 -7
  23. package/dist/_shared/startup-0-0-4EDVBK5P.js.map +1 -0
  24. package/dist/_shared/{startup-0-1-EZAJI6RE.js → startup-0-1-H5IXVRXQ.js} +85 -7
  25. package/dist/_shared/startup-0-1-H5IXVRXQ.js.map +1 -0
  26. package/dist/_shared/startup-0-2-YZZOC22D.js +4 -4
  27. package/dist/_shared/startup-0-3-DE2NCS6A.js +4 -4
  28. package/dist/_shared/startup-0-4-ZMJV547D.js +6 -5
  29. package/dist/_shared/startup-0-4-ZMJV547D.js.map +1 -1
  30. package/dist/_shared/startup-0-5-HZX3ZPTP.js +44 -13
  31. package/dist/_shared/startup-0-5-HZX3ZPTP.js.map +1 -1
  32. package/dist/_shared/startup-10-0-TDQNBDDL.js +5 -5
  33. package/dist/_shared/startup-12-0-55AAXBJZ.js +2 -2
  34. package/dist/_shared/startup-14-0-MLX36RBG.js +3 -3
  35. package/dist/_shared/startup-15-0-YUKGAC63.js +3 -3
  36. package/dist/_shared/{startup-15-1-4S7FLMNG.js → startup-15-1-WQZBOTMZ.js} +70 -28
  37. package/dist/_shared/{startup-15-1-4S7FLMNG.js.map → startup-15-1-WQZBOTMZ.js.map} +1 -1
  38. package/dist/_shared/startup-8-0-34CBHPZH.js +4 -4
  39. package/dist/_shared/{startup-8-1-LZFXSD3Z.js → startup-8-1-QZMXUGHI.js} +242 -20
  40. package/dist/_shared/startup-8-1-QZMXUGHI.js.map +1 -0
  41. package/dist/_shared/storage-command-7MGXLJGZ.js +75 -11
  42. package/dist/_shared/storage-command-7MGXLJGZ.js.map +1 -1
  43. package/dist/_shared/storage-status-K7PX2RXA.js +3 -3
  44. package/dist/_shared/task-unsaved-answer-VJ2KTB4V.js +2 -2
  45. package/dist/_shared/team-DOQKICG2.js +2 -2
  46. package/dist/_shared/tree-outline-MUEPK5B7.js +2 -2
  47. package/dist/binary-self-update.js +281 -0
  48. package/dist/binary-self-update.js.map +1 -0
  49. package/dist/builtin/intercom/broker/broker.bundle.mjs +158 -78
  50. package/dist/builtin/intercom/broker/multinode-router.ts +41 -8
  51. package/dist/builtin/intercom/broker/multinode-state-store.ts +6 -1
  52. package/dist/builtin/intercom/broker/sql-lease-store.ts +89 -80
  53. package/dist/builtin/intercom/broker/sql-pending-ask-store.ts +65 -6
  54. package/dist/builtin/intercom/index.bundle.mjs +2 -1
  55. package/dist/builtin/intercom/package.json +1 -1
  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 +15 -0
  59. package/dist/builtin/subagents/package.json +1 -1
  60. package/dist/builtin/subagents/skills/agent-browser/SKILL.md +1 -1
  61. package/dist/builtin/subagents/skills/impeccable/SKILL.md +3 -3
  62. package/dist/builtin/subagents/skills/impeccable/reference/audit.md +2 -2
  63. package/dist/builtin/subagents/skills/impeccable/reference/critique.md +3 -3
  64. package/dist/builtin/subagents/skills/impeccable/reference/generate.md +1 -1
  65. package/dist/builtin/subagents/skills/impeccable/reference/init.md +0 -2
  66. package/dist/builtin/subagents/skills/impeccable/reference/live.md +4 -2
  67. package/dist/builtin/subagents/skills/impeccable/reference/new-work-comp.md +1 -1
  68. package/dist/builtin/subagents/skills/impeccable/reference/new-work-world.md +1 -1
  69. package/dist/builtin/subagents/skills/impeccable/scripts/VERSION +1 -1
  70. package/dist/builtin/subagents/skills/impeccable/scripts/engine-checksums.txt +5 -5
  71. package/dist/builtin/subagents/skills/impeccable/scripts/impeccable +28 -5
  72. package/dist/builtin/subagents/skills/impeccable/scripts/impeccable.cmd +11 -2
  73. package/dist/builtin/subagents/skills/impeccable/scripts/live-browser.js +10 -6
  74. package/dist/builtin/subagents/skills/research-codebase/SKILL.md +13 -19
  75. package/dist/builtin/subagents/skills/skill-creator/SKILL.md +1 -1
  76. package/dist/builtin/subagents/skills/subagent/SKILL.md +7 -7
  77. package/dist/builtin/subagents/skills/workflow/SKILL.md +98 -0
  78. package/dist/builtin/subagents/src/extension/index.bundle.mjs +2 -1
  79. package/dist/builtin/web-access/index.bundle.mjs +2 -1
  80. package/dist/builtin/web-access/package.json +1 -1
  81. package/dist/cli/args.js +2 -2
  82. package/dist/cli/auth-cli.code.js +3 -3
  83. package/dist/cli/auth-cli.impl.js +3 -3
  84. package/dist/cli/auth-cli.js +3 -3
  85. package/dist/cli/blueprint-command.code.js +2 -2
  86. package/dist/cli/blueprint-command.impl.js +3 -3
  87. package/dist/cli/blueprint-command.js +3 -3
  88. package/dist/cli/intercom-command.code.js +2 -2
  89. package/dist/cli/intercom-command.impl.js +3 -3
  90. package/dist/cli/intercom-command.js +3 -3
  91. package/dist/cli/list-models.code.js +2 -2
  92. package/dist/cli/list-models.impl.js +3 -3
  93. package/dist/cli/list-models.js +3 -3
  94. package/dist/cli/session-picker.code.js +1 -1
  95. package/dist/cli/session-picker.impl.js +3 -3
  96. package/dist/cli/session-picker.js +3 -3
  97. package/dist/cli/startup-ui.code.js +1 -1
  98. package/dist/cli/startup-ui.impl.js +3 -3
  99. package/dist/cli/startup-ui.js +3 -3
  100. package/dist/cli/storage-command.impl.js +3 -3
  101. package/dist/cli/storage-command.js +3 -3
  102. package/dist/cli/storage-search-session.code.js +3 -3
  103. package/dist/cli/storage-search-session.impl.js +3 -3
  104. package/dist/cli/storage-search-session.js +3 -3
  105. package/dist/cli/team-command.code.js +1 -1
  106. package/dist/cli/team-command.impl.js +3 -3
  107. package/dist/cli/team-command.js +3 -3
  108. package/dist/cli/usage-command.js +22 -0
  109. package/dist/cli/usage-command.js.map +1 -0
  110. package/dist/cli.js +2 -2
  111. package/dist/config-binary-install.js +3 -0
  112. package/dist/config-binary-install.js.map +1 -0
  113. package/dist/core/agent-session-services.js +3 -0
  114. package/dist/core/agent-session-services.js.map +1 -0
  115. package/dist/core/debug.impl.js +3 -3
  116. package/dist/core/debug.js +3 -3
  117. package/dist/core/export-html/card-projection.impl.js +3 -3
  118. package/dist/core/export-html/card-projection.js +3 -3
  119. package/dist/core/export-html/index.code.js +2 -2
  120. package/dist/core/export-html/index.impl.js +3 -3
  121. package/dist/core/export-html/index.js +3 -3
  122. package/dist/core/export-html/json-spans.impl.js +3 -3
  123. package/dist/core/export-html/json-spans.js +3 -3
  124. package/dist/core/export-html/oversized-render-inputs.impl.js +3 -3
  125. package/dist/core/export-html/oversized-render-inputs.js +3 -3
  126. package/dist/core/export-html/tool-renderer.impl.js +3 -3
  127. package/dist/core/export-html/tool-renderer.js +3 -3
  128. package/dist/core/extensions/jiti-loader.impl.js +3 -3
  129. package/dist/core/extensions/jiti-loader.js +3 -3
  130. package/dist/core/extensions/jiti-static-loader.impl.js +3 -3
  131. package/dist/core/extensions/jiti-static-loader.js +3 -3
  132. package/dist/core/extensions/loader-host-modules.code.js +1 -1
  133. package/dist/core/extensions/loader-host-modules.impl.js +3 -3
  134. package/dist/core/extensions/loader-host-modules.js +3 -3
  135. package/dist/core/extensions/loader-virtual-modules.js +1 -1
  136. package/dist/core/extensions/runner-context.js +2 -2
  137. package/dist/core/intercom-broker-control-host.code.js +1 -1
  138. package/dist/core/intercom-broker-control-host.impl.js +3 -3
  139. package/dist/core/intercom-broker-control-host.js +3 -3
  140. package/dist/core/intercom-broker-control.code.js +3 -3
  141. package/dist/core/intercom-broker-control.impl.js +3 -3
  142. package/dist/core/intercom-broker-control.js +3 -3
  143. package/dist/core/{legacy-workflow-files.d.ts → legacy-workflows.d.ts} +1 -1
  144. package/dist/core/model-runtime.d.ts +8 -2
  145. package/dist/core/package-manager-storage-adapters.code.js +1 -1
  146. package/dist/core/package-manager-storage-adapters.impl.js +3 -3
  147. package/dist/core/package-manager-storage-adapters.js +3 -3
  148. package/dist/core/resource-loader-core.d.ts +1 -1
  149. package/dist/core/resource-loader-internals.d.ts +1 -1
  150. package/dist/core/resource-loader-types.d.ts +1 -1
  151. package/dist/core/resource-loader-types.js.map +1 -1
  152. package/dist/core/sdk.code.js +4 -4
  153. package/dist/core/sdk.impl.js +3 -3
  154. package/dist/core/sdk.js +3 -3
  155. package/dist/core/session-manager-core.js +5 -5
  156. package/dist/core/session-manager-list.impl.js +3 -3
  157. package/dist/core/session-manager-list.js +3 -3
  158. package/dist/core/session-manager.code.js +1 -1
  159. package/dist/core/session-manager.impl.js +3 -3
  160. package/dist/core/session-manager.js +3 -3
  161. package/dist/core/session-storage.code.js +1 -1
  162. package/dist/core/session-storage.impl.js +3 -3
  163. package/dist/core/session-storage.js +3 -3
  164. package/dist/core/settings-manager.js +5 -0
  165. package/dist/core/settings-manager.js.map +1 -0
  166. package/dist/core/storage/database.d.ts +6 -2
  167. package/dist/core/storage/database.js.map +1 -1
  168. package/dist/core/storage/fenced-paths.d.ts +15 -0
  169. package/dist/core/storage/fenced-paths.js +25 -0
  170. package/dist/core/storage/fenced-paths.js.map +1 -1
  171. package/dist/core/storage/index.js +2 -2
  172. package/dist/core/storage/migrations.d.ts +2 -11
  173. package/dist/core/storage/migrations.js +2 -9
  174. package/dist/core/storage/migrations.js.map +1 -1
  175. package/dist/core/storage/node-sqlite-thread.js +2 -2
  176. package/dist/core/storage/node-sqlite.js +2 -2
  177. package/dist/core/storage/offline-snapshot-file.impl.js +3 -3
  178. package/dist/core/storage/offline-snapshot-file.js +3 -3
  179. package/dist/core/storage/postgres-locks.d.ts +11 -0
  180. package/dist/core/storage/postgres-locks.js +9 -0
  181. package/dist/core/storage/postgres-locks.js.map +1 -0
  182. package/dist/core/storage/provider.js +2 -2
  183. package/dist/core/storage/selection.js +2 -2
  184. package/dist/core/storage/session/branch-fork-source.code.js +2 -2
  185. package/dist/core/storage/session/branch-fork-source.impl.js +3 -3
  186. package/dist/core/storage/session/branch-fork-source.js +3 -3
  187. package/dist/core/storage/session/card-view.impl.js +3 -3
  188. package/dist/core/storage/session/card-view.js +3 -3
  189. package/dist/core/storage/session/child-reader.code.js +3 -3
  190. package/dist/core/storage/session/child-reader.impl.js +3 -3
  191. package/dist/core/storage/session/child-reader.js +3 -3
  192. package/dist/core/storage/session/chunked-resume-projection.impl.js +3 -3
  193. package/dist/core/storage/session/chunked-resume-projection.js +3 -3
  194. package/dist/core/storage/session/expanded-child-details.code.js +2 -2
  195. package/dist/core/storage/session/expanded-child-details.impl.js +3 -3
  196. package/dist/core/storage/session/expanded-child-details.js +3 -3
  197. package/dist/core/storage/session/fork-row-bytes.impl.js +3 -3
  198. package/dist/core/storage/session/fork-row-bytes.js +3 -3
  199. package/dist/core/storage/session/fork-row-index.impl.js +3 -3
  200. package/dist/core/storage/session/fork-row-index.js +3 -3
  201. package/dist/core/storage/session/fork-staging.code.js +2 -2
  202. package/dist/core/storage/session/fork-staging.impl.js +3 -3
  203. package/dist/core/storage/session/fork-staging.js +3 -3
  204. package/dist/core/storage/session/fork-window.code.js +3 -3
  205. package/dist/core/storage/session/fork-window.impl.js +3 -3
  206. package/dist/core/storage/session/fork-window.js +3 -3
  207. package/dist/core/storage/session/history-pages.impl.js +3 -3
  208. package/dist/core/storage/session/history-pages.js +3 -3
  209. package/dist/core/storage/session/jsonl-entry-projection.impl.js +3 -3
  210. package/dist/core/storage/session/jsonl-entry-projection.js +3 -3
  211. package/dist/core/storage/session/jsonl-session-store.impl.js +3 -3
  212. package/dist/core/storage/session/jsonl-session-store.js +3 -3
  213. package/dist/core/storage/session/memory-session-store.impl.js +3 -3
  214. package/dist/core/storage/session/memory-session-store.js +3 -3
  215. package/dist/core/storage/session/pinned-branch-resume.code.js +3 -3
  216. package/dist/core/storage/session/pinned-branch-resume.impl.js +3 -3
  217. package/dist/core/storage/session/pinned-branch-resume.js +3 -3
  218. package/dist/core/storage/session/released-history-files.code.js +2 -2
  219. package/dist/core/storage/session/released-history-files.impl.js +3 -3
  220. package/dist/core/storage/session/released-history-files.js +3 -3
  221. package/dist/core/storage/session/resident-fork-rows.impl.js +3 -3
  222. package/dist/core/storage/session/resident-fork-rows.js +3 -3
  223. package/dist/core/storage/session/session-resume.impl.js +3 -3
  224. package/dist/core/storage/session/session-resume.js +3 -3
  225. package/dist/core/storage/session/snapshot-cut.impl.js +3 -3
  226. package/dist/core/storage/session/snapshot-cut.js +3 -3
  227. package/dist/core/storage/session/snapshot-history.code.js +3 -3
  228. package/dist/core/storage/session/snapshot-history.impl.js +3 -3
  229. package/dist/core/storage/session/snapshot-history.js +3 -3
  230. package/dist/core/storage/session/sql-session-store.code.js +1 -1
  231. package/dist/core/storage/session/sql-session-store.d.ts +1 -1
  232. package/dist/core/storage/session/sql-session-store.impl.js +3 -3
  233. package/dist/core/storage/session/sql-session-store.js +3 -3
  234. package/dist/core/storage/session/tree-outline.impl.js +3 -3
  235. package/dist/core/storage/session/tree-outline.js +3 -3
  236. package/dist/core/storage/session/tree-presentation.impl.js +3 -3
  237. package/dist/core/storage/session/tree-presentation.js +3 -3
  238. package/dist/core/storage/sqlite-facade.js +6 -4
  239. package/dist/core/storage/sqlite-facade.js.map +1 -1
  240. package/dist/core/storage/storage-status.impl.js +3 -3
  241. package/dist/core/storage/storage-status.js +3 -3
  242. package/dist/core/storage/team.impl.js +3 -3
  243. package/dist/core/storage/team.js +3 -3
  244. package/dist/core/structured-output/index.code.js +1 -1
  245. package/dist/core/structured-output/index.impl.js +3 -3
  246. package/dist/core/structured-output/index.js +3 -3
  247. package/dist/core/subscription-usage-credential.d.ts +2 -0
  248. package/dist/core/subscription-usage-endpoints.d.ts +54 -0
  249. package/dist/core/subscription-usage.d.ts +55 -0
  250. package/dist/core/subscription-usage.js +3 -0
  251. package/dist/core/subscription-usage.js.map +1 -0
  252. package/dist/core/tasks/heartbeat-notice.d.ts +0 -1
  253. package/dist/core/tasks/task-completion-entry.impl.js +3 -3
  254. package/dist/core/tasks/task-completion-entry.js +3 -3
  255. package/dist/core/tasks/task-file-history.code.js +3 -3
  256. package/dist/core/tasks/task-file-history.impl.js +3 -3
  257. package/dist/core/tasks/task-file-history.js +3 -3
  258. package/dist/core/tasks/task-reference-archive.code.js +4 -4
  259. package/dist/core/tasks/task-reference-archive.js +3 -3
  260. package/dist/core/tasks/task-reference-identity.js +3 -3
  261. package/dist/core/tasks/task-reference-stream.impl.js +3 -3
  262. package/dist/core/tasks/task-reference-stream.js +3 -3
  263. package/dist/core/tasks/task-unsaved-answer.impl.js +3 -3
  264. package/dist/core/tasks/task-unsaved-answer.js +3 -3
  265. package/dist/core/tasks/task-view-source.code.js +1 -1
  266. package/dist/core/tasks/task-view-source.impl.js +3 -3
  267. package/dist/core/tasks/task-view-source.js +3 -3
  268. package/dist/core/tools/edit-diff.d.ts +4 -6
  269. package/dist/core/tools/read-url.code.js +3 -3
  270. package/dist/core/tools/read-url.impl.js +3 -3
  271. package/dist/core/tools/read-url.js +3 -3
  272. package/dist/core/worktree-snapshot/blob-store.d.ts +14 -16
  273. package/dist/core/worktree-snapshot/blob-store.js +194 -81
  274. package/dist/core/worktree-snapshot/blob-store.js.map +1 -1
  275. package/dist/core/worktree-snapshot/collection-claim.js +8 -0
  276. package/dist/core/worktree-snapshot/collection-claim.js.map +1 -0
  277. package/dist/core/worktree-snapshot/errors.code.js +2 -2
  278. package/dist/core/worktree-snapshot/errors.impl.js +3 -3
  279. package/dist/core/worktree-snapshot/errors.js +3 -3
  280. package/dist/core/worktree-snapshot/session-index-reset.impl.js +3 -3
  281. package/dist/core/worktree-snapshot/session-index-reset.js +3 -3
  282. package/dist/core/worktree-snapshot/snapshot-epoch-migration.js +209 -0
  283. package/dist/core/worktree-snapshot/snapshot-epoch-migration.js.map +1 -0
  284. package/dist/core/worktree-snapshot/snapshot-epoch.js +100 -0
  285. package/dist/core/worktree-snapshot/snapshot-epoch.js.map +1 -0
  286. package/dist/extensions/codemode/execute.code.js +1 -1
  287. package/dist/extensions/codemode/execute.impl.js +3 -3
  288. package/dist/extensions/codemode/execute.js +3 -3
  289. package/dist/extensions/codemode/renderer.code.js +2 -2
  290. package/dist/extensions/codemode/renderer.impl.js +3 -3
  291. package/dist/extensions/codemode/renderer.js +3 -3
  292. package/dist/extensions/mcp/cli.code.js +2 -2
  293. package/dist/extensions/mcp/cli.impl.js +3 -3
  294. package/dist/extensions/mcp/cli.js +3 -3
  295. package/dist/extensions/mcp/cli.lazy.code.js +2 -2
  296. package/dist/extensions/mcp/cli.lazy.impl.js +3 -3
  297. package/dist/extensions/mcp/cli.lazy.js +3 -3
  298. package/dist/extensions/mcp/runtime.code.js +1 -1
  299. package/dist/extensions/mcp/runtime.impl.js +3 -3
  300. package/dist/extensions/mcp/runtime.js +3 -3
  301. package/dist/index.d.ts +3 -0
  302. package/dist/index.js +7 -7
  303. package/dist/main-first-time-setup.code.js +1 -1
  304. package/dist/main-first-time-setup.impl.js +3 -3
  305. package/dist/main-first-time-setup.js +3 -3
  306. package/dist/main.js +2 -2
  307. package/dist/modes/interactive/components/stored-tree-view.code.js +2 -2
  308. package/dist/modes/interactive/components/stored-tree-view.impl.js +3 -3
  309. package/dist/modes/interactive/components/stored-tree-view.js +3 -3
  310. package/dist/modes/interactive/components/user-message-selector-archive.impl.js +3 -3
  311. package/dist/modes/interactive/components/user-message-selector-archive.js +3 -3
  312. package/dist/modes/interactive/interactive-mode-surface.d.ts +1 -0
  313. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  314. package/dist/modes/interactive/interactive-mode.js +1 -1
  315. package/dist/modes/interactive-engine/isolated-runtime.d.ts +3 -0
  316. package/dist/modes/print-mode.js +1 -1
  317. package/dist/modes/rpc/rpc-client-api.d.ts +3 -0
  318. package/dist/modes/rpc/rpc-types.d.ts +25 -0
  319. package/dist/package-manager-cli.code.js +31 -8
  320. package/dist/package-manager-cli.code.js.map +1 -1
  321. package/dist/package-manager-cli.impl.js +3 -3
  322. package/dist/package-manager-cli.js +3 -3
  323. package/dist/rpc-entry.js +2 -2
  324. package/dist/startup-files.json +1 -1
  325. package/dist/startup-stages/12.js +1 -1
  326. package/dist/startup-stages/4.js +1 -1
  327. package/dist/startup-stages/6.js +1 -1
  328. package/dist/subscription-usage-sdk.d.ts +9 -0
  329. package/dist/utils/changelog.d.ts +1 -0
  330. package/dist/utils/startup-database-spare.code.js +2 -2
  331. package/dist/utils/startup-database-spare.impl.js +3 -3
  332. package/dist/utils/startup-database-spare.js +3 -3
  333. package/dist/utils/tools-manager.code.js +1 -1
  334. package/dist/utils/tools-manager.impl.js +3 -3
  335. package/dist/utils/tools-manager.js +3 -3
  336. package/docs/background-tasks/reference.md +1 -1
  337. package/docs/background-tasks.md +1 -1
  338. package/docs/changelog.mdx +53 -1
  339. package/docs/containerization.md +17 -15
  340. package/docs/docs.json +1 -0
  341. package/docs/getting-started/installation.md +132 -80
  342. package/docs/guides/subscription-usage.md +133 -0
  343. package/docs/guides/team-setup.md +14 -3
  344. package/docs/guides.md +3 -0
  345. package/docs/index.md +18 -6
  346. package/docs/intercom/operations.md +1 -1
  347. package/docs/orchestration/migrating-workflows.md +16 -10
  348. package/docs/orchestration/patterns.md +8 -2
  349. package/docs/orchestration.md +17 -8
  350. package/docs/quickstart.md +7 -15
  351. package/docs/reference/cli.md +32 -24
  352. package/docs/rpc/protocol.md +9 -1
  353. package/docs/rpc.md +1 -1
  354. package/docs/sdk/reference.md +5 -1
  355. package/docs/skills.md +20 -4
  356. package/docs/slash-commands.md +3 -2
  357. package/docs/storage/postgres/tuning.md +2 -0
  358. package/docs/storage/postgres.md +17 -0
  359. package/docs/tools.md +57 -12
  360. package/docs/usage.md +1 -0
  361. package/docs/windows.md +4 -4
  362. package/docs/worktree-snapshots/reference.md +1 -1
  363. package/package.json +9 -9
  364. package/dist/_shared/mode-interactive-sdk-7KXUFI2F.js.map +0 -1
  365. package/dist/_shared/sdk-OHKMDJ74.js.map +0 -1
  366. package/dist/_shared/startup-0-0-OV6RAEAP.js.map +0 -1
  367. package/dist/_shared/startup-0-1-EZAJI6RE.js.map +0 -1
  368. package/dist/_shared/startup-8-1-LZFXSD3Z.js.map +0 -1
  369. package/dist/builtin/subagents/skills/workflow-files/SKILL.md +0 -28
@@ -1,7 +1,7 @@
1
1
  import { __name } from "./rolldown-runtime-BGM3D5V3.js";
2
- import { APP_NAME, APP_TITLE, CHANGELOG_URL, CONFIG_DIR_NAME, UpdatedInstallError, VERSION, VERSION_ADOPTION_ENDPOINT, canonicalizePathAsync, createChildProcessEnvironment, createModuleRequire, detectInstallChangeAsync, engineHeapRuntimeArgsForHost, findHelperExecutableAsync, getAgentDir, getAuthPath, getChangelogPath, getCwdRelativePath, getDebugLogPath, getDocsPath, getShareViewerUrl, helperLaunchAsync, isModuleLoadFailure, loadOnDemand, markLifecycleTiming, missingHelperOptions, processCompileCacheDeferral, setDebugSetting, shortenHomePath, updatedInstallError } from "./p0-cli-BB45ZQY6.js";
3
- import { BUILTIN_SLASH_COMMANDS, BUNDLED_EXTENSION_SLASH_COMMANDS, CountdownTimer, DynamicBorder, MissingSessionCwdError, NO_QUEUED_MESSAGES, TrustDecisionSelector, asyncScope, carryRowSource, chatPosition, chatReceipt, deduplicateDiagnostics, findProviderDefaultModel, formatAppendRecoveryNotice, formatMissingSessionCwdPrompt, formatNoModelsAvailableMessage, getEngineSessionStats, getMissingSessionCwdOptions, getPiUserAgent, isGitUnavailableError, isInstallTelemetryEnabled, isInteractiveEngineResourceReadinessError, isPathInside, isTrustDecision, isUnknownModel, keepDroppedQueuedMessages, markEventLoopShutdown, markEventLoopStartupComplete, noteRowSource, noteSavedSeq, onSessionProviderRequestDispatched, parseSlashCommand, placeTranscriptFrame, projectTrustWarningVisible, queuedMessagesUnderWay, quitAsInteractiveApp, recordStartupThinkingLevel, rowSource, safeTrustChoiceIndex, savedRowKey, savedSeqOf, setDeprecationWarningSink, setMarkitDiagnosticSink, shouldRenderEngineDiagnosticAsChatError, takeQueuedMessagesDroppedAt, usageCostBreakdown, userMessageOrigin, yieldToEventLoop, yieldToTimerTurn } from "./startup-0-0-OV6RAEAP.js";
4
- import { ExtensionInputComponent, ExtensionSelectorComponent, ReopenedCompletionHeaders, cancelInitialBinding, createCustomMessage, ensurePngTranscoder, ensureTool, formatResumeTimings, formatToolStatus, getBuiltinExtensionEntryLabel, getPromptCacheTtlMs as getPromptCacheTtlMs$1, initialBindScope, isOfflineModeEnabled, isVerbatimCompactionMessage, isWorkspaceError, latestResumeTimings, normalizeMessageContent, normalizeModelFailureSignal, prewarmModelApi, readHostInputFormRequest, registerInitialBindings, stripVerbatimCompactionPrefix, taskPromptHost, thinkingLevelForModelSwitch } from "./startup-0-1-EZAJI6RE.js";
2
+ import { APP_NAME, APP_TITLE, CHANGELOG_URL, CONFIG_DIR_NAME, UpdatedInstallError, VERSION, VERSION_ADOPTION_ENDPOINT, canonicalizePathAsync, createChildProcessEnvironment, createModuleRequire, detectInstallChangeAsync, engineHeapRuntimeArgsForHost, findHelperExecutableAsync, getAgentDir, getAuthPath, getChangelogPath, getCwdRelativePath, getDebugLogPath, getDocsPath, getShareViewerUrl, helperLaunchAsync, isBunBinary, isModuleLoadFailure, loadOnDemand, markLifecycleTiming, missingHelperOptions, processCompileCacheDeferral, setDebugSetting, shortenHomePath, updatedInstallError } from "./p0-cli-BB45ZQY6.js";
3
+ import { BUILTIN_SLASH_COMMANDS, BUNDLED_EXTENSION_SLASH_COMMANDS, CountdownTimer, DynamicBorder, MissingSessionCwdError, NO_QUEUED_MESSAGES, TrustDecisionSelector, asyncScope, carryRowSource, chatPosition, chatReceipt, deduplicateDiagnostics, fetchSubscriptionUsage, findProviderDefaultModel, formatAppendRecoveryNotice, formatMissingSessionCwdPrompt, formatNoModelsAvailableMessage, getEngineSessionStats, getMissingSessionCwdOptions, getPiUserAgent, isGitUnavailableError, isInstallTelemetryEnabled, isInteractiveEngineResourceReadinessError, isPathInside, isTrustDecision, isUnknownModel, keepDroppedQueuedMessages, markEventLoopShutdown, markEventLoopStartupComplete, noteRowSource, noteSavedSeq, onSessionProviderRequestDispatched, parseSlashCommand, placeTranscriptFrame, projectTrustWarningVisible, queuedMessagesUnderWay, quitAsInteractiveApp, raceWithAbortSignal, readSubscriptionCredential, recordStartupThinkingLevel, rowSource, safeTrustChoiceIndex, savedRowKey, savedSeqOf, setDeprecationWarningSink, setMarkitDiagnosticSink, shouldRenderEngineDiagnosticAsChatError, takeQueuedMessagesDroppedAt, usageCostBreakdown, userMessageOrigin, yieldToEventLoop, yieldToTimerTurn } from "./startup-0-0-4EDVBK5P.js";
4
+ import { ExtensionInputComponent, ExtensionSelectorComponent, ReopenedCompletionHeaders, cancelInitialBinding, codexAccountId, createCustomMessage, ensurePngTranscoder, ensureTool, formatResumeTimings, formatToolStatus, getBuiltinExtensionEntryLabel, getPromptCacheTtlMs as getPromptCacheTtlMs$1, initialBindScope, isOfflineModeEnabled, isVerbatimCompactionMessage, isWorkspaceError, latestResumeTimings, normalizeMessageContent, normalizeModelFailureSignal, observedOpenAiDirectUsage, observedSubscriptionUsage, prewarmModelApi, readHostInputFormRequest, registerInitialBindings, stripVerbatimCompactionPrefix, subscriptionBearer, subscriptionCredentialKey, taskPromptHost, thinkingLevelForModelSwitch } from "./startup-0-1-H5IXVRXQ.js";
5
5
  import { KeybindingsManager as KeybindingsManager$1, OVERLAY_ACTIVE_ROW_MARKER, Theme, clickableKeyTextHint, consumeStartupInput, formatKeyText, getAvailableThemes, getAvailableThemesWithPaths, getEditorTheme, getMarkdownTheme, getThemeByName, isNavHelpKey, keyDisplayText, keyHint, keyText, keyTextHint, loadAllHighlightLanguages, navEntryKeyParts, onThemeChange, recordTimeSinceReset, refreshCustomThemes, renderNavKeyOverlay, setRegisteredThemes, slashCommandHint, stopThemeWatcher, theme } from "./p2-shell-main-B2WIALFD.js";
6
6
  import { ProjectTrustStore, failureDebugFields, getProjectTrustPathAsync, hasTrustRequiringProjectResourcesAsync, reportDebugAsync } from "./p1b-elig-BY2G5BUE.js";
7
7
  import { WorkingRunMeter, compactionMeta, findExactModelReferenceMatch, getPowerShellConfigAsync, killSupervisedProcessTrees, killTrackedDetachedChildren, runInProgress, sessionLifetime, showStartupInput, showStartupSelector, taskTranscriptSource } from "./startup-0-2-YZZOC22D.js";
@@ -10,10 +10,10 @@ import { SESSION_HISTORY_SCAN_ENTRIES, findDecisionError, isDecisionConfigError,
10
10
  import { readAhead } from "./startup-8-0-34CBHPZH.js";
11
11
  import { CredentialSynchronizationError, DefaultPackageManager, chunkedToolResult, chunkedToolResultEntry, findInitialModel, firstSubagentAttempt, getSkillCatalog, isOAuthLoginCancelled, resolveRestoredModelReference, uncachedCopilotModelHint } from "./startup-0-5-HZX3ZPTP.js";
12
12
  import { formatModelLabel } from "./startup-0-4-ZMJV547D.js";
13
- import { ENGINE_SHUTDOWN_GRACE_MS, FooterDataProvider, appendBoundedStderr, compareWorktreeSnapshot, currentWorktreeSnapshots, describeExportedSnapshots, describeLastCapture, describeSnapshotExport, describeWorktreeRestoreStatus, describeWorktreeSnapshot, dismissedAgentPanelItems, ownerTaskViewSource, sourceError, subscribeAgentPanel, worktreeRestoreNotices } from "./startup-8-1-LZFXSD3Z.js";
13
+ import { ENGINE_SHUTDOWN_GRACE_MS, FooterDataProvider, appendBoundedStderr, compareWorktreeSnapshot, currentWorktreeSnapshots, describeExportedSnapshots, describeLastCapture, describeSnapshotExport, describeWorktreeRestoreStatus, describeWorktreeSnapshot, dismissedAgentPanelItems, ownerTaskViewSource, sourceError, subscribeAgentPanel, worktreeRestoreNotices } from "./startup-8-1-QZMXUGHI.js";
14
14
  import { tryExecuteSessionSlashCommand } from "./startup-15-0-YUKGAC63.js";
15
15
  import { SessionManager } from "./startup-10-0-TDQNBDDL.js";
16
- import { IsolatedInteractiveRuntime, SessionImportFileNotFoundError, parseSkillBlock, sessionCloseReason } from "./startup-15-1-4S7FLMNG.js";
16
+ import { IsolatedInteractiveRuntime, SessionImportFileNotFoundError, parseSkillBlock, sessionCloseReason } from "./startup-15-1-WQZBOTMZ.js";
17
17
  import { configureHttpDispatcher } from "./http-YFAPTIZD.js";
18
18
  import { AGENT_PANEL_WIDGET_KEY, ANTHROPIC_SUBSCRIPTION_AUTH_WARNING, AgentViewSwitcher, ArminComponent, AssistantMessageComponent, BUILTIN_SLASH_COMMAND_NAMES, BashExecutionComponent, BorderedLoader, BranchSummaryMessageComponent, COMMITTED_WIDGET_PREVIEW_GATE, CONSOLE_CLOSED_EXIT_CODE, CONSOLE_CLOSED_SHUTDOWN_MS, ChatSessionHost, CombinedAutocompleteProvider as CombinedAutocompleteProvider$1, CompactionBoundaryMessageComponent, Container as Container$1, CustomMessageComponent, EarendilAnnouncementComponent, ExpandableText, ExtensionEditorComponent, FooterComponent, InteractiveThemeController, KeybindingsReloadCoordinator, Loader as Loader$1, LoginDialogComponent, Markdown as Markdown$1, ModelSelectorComponent, OAuthSelectorComponent, PromptHistorySelectorComponent, QueuedMessagesView, RemoteCustomMessageComponent, RemoteFrameWidthClamp, RemoteToolExecutionComponent, STARTUP_ASSEMBLY_GAPS, STOP_ALL_STATUS_KEY, SavedRendererInstances, ScopedModelsSelectorComponent, SessionSelectorComponent, SettingsSelectorComponent, SkillInvocationMessageComponent, Spacer as Spacer$1, SteeringQueueController, Text as Text$1, ThinkingSelectorComponent, ToolExecutionComponent, ToolGroupTracker, TranscriptTaskRow, TreeSelectorComponent, TrustSelectorComponent, UsageMeterComponent, UserMessageSelectorComponent, WorkingStatusComponent, addChatTranscriptEntry, agentPanelBoardSource, agentPanelCounts, agentPanelHasRows, applyAssistantMessageDelta, applyToolEntryState, assistantCallBreaks, atomicWordmark, beginStreamingAssistantMessage, bindAgentPanel, blockRows, boundedInteractiveModelRefresh, callsAwaitingLaterResults, canPaintWidgetFrame, chalk, chatEntriesFromAgentMessages, chatRecordsChanged, checkForNewPiVersion, classifyWidgetFrame, clickableBlocksView, combineQueuedMessagesForEditor, compareProviders, composeStartupIdentity, countTasksBy, createChatAutocompleteProvider, createRemoteAgentSteering, createStopAllChord, createStopAllNotices, decisionSettingScopes, declaresHistoryReplayable, discardChatMount, disposeRemoteRenderers, disposeRenderer, endsAwaitedResults, exitWithStatus, formatAuthSelectorProviderType, formatCrashExtensionHint, formatResumeCommand, fs, fuzzyFilter as fuzzyFilter$1, getAutocompleteSourceTag, getCachedChangelog, getCapabilities as getCapabilities$1, getChangelogHighlights, getEntriesForVersion, getModelSearchText, getNewEntries, getSessionSkillCommands, handleTranscriptBlockClick, hasAssistantVisibleContent, hasDefaultModelProvider, hyperlink as hyperlink$1, initialHostEngineViewSyncState, interruptedNotice, isAnthropicSubscriptionAuthKey, isChatSessionWorking, isClickExpandableBlock, isDeadTerminalError, isEngineHintRoute, isExpandable, isResultWithoutCall, isSingleLeftClick, isUnansweredCancelMatch, loadEarendilAnnouncementImage, matchesKey as matchesKey$1, needsChangelogPreload, normalizeChangelogLinks, observeClickExpansion, openExternalEditorForText, openLocalAgentViewPort, openWaitedShellOf, os, panelHintParts, panelHintSegments, parkedRun, parseChangelogAsync, pasteClipboardImageToEditor, path as path$1, pickWhimsicalWorkingMessage, planPreViewCancelAck, prefixAutocompleteDescription, preloadChangelog, promptHistoryEntries, queuedMessageRows, readMountedAnchors, readTaskCompletionHistory, refreshModelCatalogs, remoteAgentCommands, remoteAgentPrompts, renderAtomicAssemblyBanner, renderChatMessageEntry, renderStartupManifesto, restoredQueue, retainChatRecords, retryCancelHint, retryWaitFromEvent, retryWaitMessage, rowsFrom, runHintRoute, sessionChatMount, sessionPromptsFromEntries, setAgentViewBridge, setKeybindings as setKeybindings$1, setRendererClickTarget, settleUnansweredCalls, shouldCancelEngineViewOnArrival, showAgentPanel, showTaskInspector, spawn, stopAllBackgroundWork, supersedeBlockClicks, supportsAtomicBanner, taskNameAndTitle, taskSiblings, themedChatHostStyle, toolResultGroupState, viewedAgentCommand, visibleWidth as visibleWidth$1 } from "./mode-shared-2QJSCUM6.js";
19
19
  import { CustomEditor, TRANSCRIPT_JUMP_TO_END_URL, UserMessageComponent, abortStartupShell, copyToClipboard, createInteractiveTui, createInteractiveTuiReference, createMarkdownTransform, extractMessageText, handOverStartupShell, handleFocusedOverlayInternalUiAction, isMouseWheelInput, isOverlayMounted, isPhysicalCtrlC, isPhysicalEscape, isSafetyKeyRelease, readClipboardText, releaseStartupShellSignals, replayableMarkdownTransform, startupShellTerminal, stripAnsi$1 as stripAnsi, stripTerminalControls, whenStartupShellCanHandOver } from "./p2-shell-TJBYQMCJ.js";
@@ -21,11 +21,12 @@ import { exitOnDecisionConfigError } from "./settings-startup-8-DNZ2RIHM.js";
21
21
  import { dirname } from "node:path";
22
22
  import { setLongTimeout } from "../__atomic_timers/index.js";
23
23
  import { normalizeProviderId } from "@bastani/atomic-ai";
24
- import { Box, CURSOR_MARKER, Container, Editor, Input, Key, Marked, ScrollView, Spacer, Text, TuiAltScreen, VStack, WindowedContainer, bindBundledHintCommands, clickableKeysHint, decodePrintableKey, editorDraftText, emptyEditorDraft, fuzzyFilter, getCapabilities, isHintActivation, isKeyRelease, isViewportTUI, matchesKey, replaceControlCharacters, setCapabilityOverrides, setKeybindings, stripHintMarkers, truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@bastani/atomic-tui";
24
+ import { Box, CURSOR_MARKER, Container, Editor, Input, Key, Marked, ScrollView, Spacer, Text, TuiAltScreen, VStack, WindowedContainer, bindBundledHintCommands, clickableKeysHint, decodePrintableKey, editorDraftText, emptyEditorDraft, fuzzyFilter, getCapabilities, isHintActivation, isKeyRelease, isViewportTUI, matchesKey, replaceControlCharacters, setCapabilityOverrides, setKeybindings, stripHintMarkers, stripTerminalSequences, truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@bastani/atomic-tui";
25
25
  import { createHash, randomUUID } from "node:crypto";
26
26
  import { setImmediate as setImmediate$1 } from "node:timers/promises";
27
27
  import { clampThinkingLevel, modelsAreEqual } from "@bastani/atomic-ai/compat";
28
28
  import { createInterface } from "node:readline";
29
+ import { withProviderTimeout } from "@bastani/atomic-ai/utils/provider-waits/timeout";
29
30
  import { isProxy } from "node:util/types";
30
31
  import { copyScopedModels } from "../core/extensions/runner-context.js";
31
32
  import { ModelRegistry } from "../core/model-registry.js";
@@ -20240,6 +20241,11 @@ async function submitToMainChat(text, submittedDraft, prompt) {
20240
20241
  held.settle();
20241
20242
  }
20242
20243
  }
20244
+ if (bare("usage")) {
20245
+ prompt.setText("");
20246
+ this.showUsageSelector();
20247
+ return;
20248
+ }
20243
20249
  if (bare("settings")) {
20244
20250
  const shown = this.showSettingsSelector();
20245
20251
  prompt.setText("");
@@ -25119,7 +25125,7 @@ InteractiveModeBase.prototype.maybeShowInstallChangeWarning = async function() {
25119
25125
  if (this.installChangeWarningShown) return true;
25120
25126
  this.installChangeWarningShown = true;
25121
25127
  const cause = change.kind === "updated" ? `${APP_NAME} was updated to ${change.version} while this session was running (${VERSION})` : `The ${APP_NAME} installation this session runs from was removed or replaced`;
25122
- formatResumeCommand(this.sessionManager, process.platform, this.runtimeHost).then((resume) => this.showWarning(`${cause}. Features that load code on demand can fail until restart. ${resume ? `Restart with \`${resume}\` to continue this session.` : `Restart ${APP_NAME}.`}`));
25128
+ formatResumeCommand(this.sessionManager, process.platform, this.runtimeHost).then((resume) => this.showWarning(`${cause}. ${isBunBinary ? "This session can keep using the old version." : "Features that load code on demand can fail until restart."} ${resume ? `Restart with \`${resume}\` to continue this session.` : `Restart ${APP_NAME}.`}`));
25123
25129
  return true;
25124
25130
  };
25125
25131
  function createToolComponent(mode, toolName, toolCallId, args) {
@@ -25234,6 +25240,7 @@ async function handleAgentEvent(event, call) {
25234
25240
  const drawnAfter = liveChat?.children.at(-1);
25235
25241
  switch (event.type) {
25236
25242
  case "agent_start":
25243
+ if (isBunBinary) this.maybeShowInstallChangeWarning();
25237
25244
  this.lastWorkingMessage = this.workingMessage;
25238
25245
  if (this.retryLoader !== void 0 || this.fallbackLoader !== void 0 && this.workingRunMeter.endedOnFailedAttempt()) this.workingRunMeter.continueRun(event.turnStartedAt);
25239
25246
  else this.workingRunMeter.start(event.turnStartedAt);
@@ -26398,6 +26405,398 @@ InteractiveModeBase.prototype.showPackageUpdateNotification = function(packages,
26398
26405
  targetContainer.addChild(new DynamicBorder((text) => theme.fg("warning", text)));
26399
26406
  this.ui.requestRender();
26400
26407
  };
26408
+ // dist/core/subscription-usage.js
26409
+ const USAGE_TIMEOUT_MS = 5e3;
26410
+ const CACHE_MS = 6e4;
26411
+ const usageProviders = {
26412
+ anthropic: "claude",
26413
+ openai: "openai-direct",
26414
+ "openai-codex": "codex",
26415
+ xai: "xai",
26416
+ "github-copilot": "copilot",
26417
+ "kimi-coding": "kimi",
26418
+ openrouter: "openrouter"
26419
+ };
26420
+ function accountType(runtime, provider, refresh = true) {
26421
+ const account = {
26422
+ provider,
26423
+ name: runtime.getProvider(provider)?.name ?? provider,
26424
+ current: false
26425
+ };
26426
+ const status = runtime.getProviderAuthStatus(provider, { refresh });
26427
+ const source = runtime.getBuiltinAccountProvider(provider);
26428
+ const kind = source ? usageProviders[source] : void 0;
26429
+ const credential = runtime.getCredentialSnapshot(provider);
26430
+ const claudeToken = kind === "claude" && (status.source === "stored" && credential?.type === "api_key" && credential.key?.startsWith("sk-ant-oat") || status.source === "environment" && status.label === "ANTHROPIC_OAUTH_TOKEN");
26431
+ if (status.configured && (status.source === "stored" && (credential?.type ?? runtime.getStoredCredentialType(provider)) === "oauth" || claudeToken)) {
26432
+ if (kind) return {
26433
+ account,
26434
+ kind
26435
+ };
26436
+ return {
26437
+ account,
26438
+ reason: "unsupported"
26439
+ };
26440
+ }
26441
+ return {
26442
+ account,
26443
+ reason: status.configured ? "api_key" : "not_signed_in"
26444
+ };
26445
+ }
26446
+ async function listUsageAccounts(runtime, current, signal) {
26447
+ const credentials = await runtime.listCredentials({ signal });
26448
+ const catalog = runtime.getProviders();
26449
+ if (catalog[0]) runtime.getProviderAuthStatus(catalog[0].id);
26450
+ return [.../* @__PURE__ */ new Set([...credentials.map(({ providerId }) => providerId), ...catalog.filter(({ id }) => runtime.getProviderAuthStatus(id, { refresh: false }).configured).map(({ id }) => id)])].map((provider) => {
26451
+ const { account, reason } = accountType(runtime, provider, false);
26452
+ account.current = provider === current;
26453
+ return reason ? {
26454
+ ...account,
26455
+ status: "unavailable",
26456
+ reason,
26457
+ message: usageReason[reason]
26458
+ } : {
26459
+ ...account,
26460
+ status: "loading"
26461
+ };
26462
+ }).sort((a, b) => Number(b.current) - Number(a.current) || a.name.localeCompare(b.name) || a.provider.localeCompare(b.provider));
26463
+ }
26464
+ const cache = /* @__PURE__ */ new Map();
26465
+ const RETAIN_CACHE_MS = 9e5;
26466
+ async function loadAccountUsage(runtime, provider, current, options = {}) {
26467
+ options.signal?.throwIfAborted();
26468
+ const { account, kind, reason } = accountType(runtime, provider);
26469
+ account.current = provider === current;
26470
+ if (!kind) {
26471
+ const unavailable = reason ?? "unsupported";
26472
+ return {
26473
+ ...account,
26474
+ status: "unavailable",
26475
+ reason: unavailable,
26476
+ message: usageReason[unavailable]
26477
+ };
26478
+ }
26479
+ const stored = runtime.getCredentialSnapshot(provider);
26480
+ if (kind === "openai-direct") try {
26481
+ const credential = stored ?? await runtime[readSubscriptionCredential](provider, options.signal ?? AbortSignal.timeout(USAGE_TIMEOUT_MS));
26482
+ options.signal?.throwIfAborted();
26483
+ const observation = credential?.type === "oauth" ? observedOpenAiDirectUsage(provider, credential.access) : void 0;
26484
+ return observation ? {
26485
+ ...account,
26486
+ status: "ready",
26487
+ source: "last_request",
26488
+ ...observation
26489
+ } : {
26490
+ ...account,
26491
+ status: "unavailable",
26492
+ reason: "not_observed",
26493
+ message: usageReason.not_observed
26494
+ };
26495
+ } catch {
26496
+ options.signal?.throwIfAborted();
26497
+ return {
26498
+ ...account,
26499
+ status: "failed",
26500
+ reason: "request_failed",
26501
+ message: "Could not read local account details."
26502
+ };
26503
+ }
26504
+ if (isOfflineModeEnabled()) return {
26505
+ ...account,
26506
+ status: "unavailable",
26507
+ reason: "offline",
26508
+ message: usageReason.offline
26509
+ };
26510
+ let key = stored?.type === "oauth" ? subscriptionCredentialKey(kind, stored.access) : void 0;
26511
+ let result;
26512
+ try {
26513
+ result = await withProviderTimeout(options.timeoutMs ?? USAGE_TIMEOUT_MS, options.signal, async (signal) => {
26514
+ let token;
26515
+ if (kind === "copilot") {
26516
+ const github = await runtime[readSubscriptionCredential](provider, signal);
26517
+ if (github?.type === "oauth" && github.enterpriseUrl) return {
26518
+ status: "unavailable",
26519
+ reason: "no_subscription"
26520
+ };
26521
+ token = github?.type === "oauth" ? github.refresh : void 0;
26522
+ } else {
26523
+ const auth = await runtime.getAuth(provider, { signal });
26524
+ token = auth && subscriptionBearer(auth.auth);
26525
+ }
26526
+ if (!token) return {
26527
+ status: "unavailable",
26528
+ reason: "sign_in_again"
26529
+ };
26530
+ signal.throwIfAborted();
26531
+ key = subscriptionCredentialKey(kind, token);
26532
+ const cached = cache.get(key);
26533
+ const maxAge = Math.min(options.maxAgeMs ?? CACHE_MS, RETAIN_CACHE_MS);
26534
+ if (cached && Date.now() - cached.observedAt < maxAge) return cached.result;
26535
+ const credential = runtime.getCredentialSnapshot(provider);
26536
+ if (kind === "claude" && credential?.type === "oauth" && Array.isArray(credential.scopes) && !credential.scopes.includes("user:profile")) return {
26537
+ status: "unavailable",
26538
+ reason: "needs_profile_scope"
26539
+ };
26540
+ const accountId = kind === "codex" ? codexAccountId(token) ?? (credential?.type === "oauth" && typeof credential.accountId === "string" ? credential.accountId : void 0) : void 0;
26541
+ const result = await fetchSubscriptionUsage(kind, token, accountId, signal, options.fetch);
26542
+ if (!signal.aborted) {
26543
+ const observedAt = Date.now();
26544
+ for (const [id, entry] of cache) if (observedAt - entry.observedAt >= RETAIN_CACHE_MS) cache.delete(id);
26545
+ cache.set(key, {
26546
+ observedAt,
26547
+ result
26548
+ });
26549
+ }
26550
+ return result;
26551
+ }, "Subscription usage");
26552
+ } catch (error) {
26553
+ options.signal?.throwIfAborted();
26554
+ result = {
26555
+ status: "failed",
26556
+ reason: error instanceof Error && error.name === "TimeoutError" ? "timeout" : "request_failed"
26557
+ };
26558
+ }
26559
+ if (result.status === "ready") return {
26560
+ ...account,
26561
+ ...structuredClone(result),
26562
+ source: "live"
26563
+ };
26564
+ const windows = key ? structuredClone(observedSubscriptionUsage(key)) : [];
26565
+ const message = usageReason[result.reason];
26566
+ return windows.length ? {
26567
+ ...account,
26568
+ status: "ready",
26569
+ source: "recent_response",
26570
+ windows,
26571
+ reason: result.reason,
26572
+ message
26573
+ } : {
26574
+ ...account,
26575
+ ...result,
26576
+ message
26577
+ };
26578
+ }
26579
+ async function loadSubscriptionUsage(runtime, current, options = {}) {
26580
+ const { accounts, signal } = options;
26581
+ signal?.throwIfAborted();
26582
+ if (accounts) {
26583
+ const providers = [...new Set(accounts.map(normalizeProviderId))];
26584
+ return { accounts: await Promise.all(providers.map((provider) => loadAccountUsage(runtime, provider, current, options))) };
26585
+ }
26586
+ const listed = listUsageAccounts(runtime, current, signal);
26587
+ const rows = signal ? await raceWithAbortSignal(listed, signal) : await listed;
26588
+ return { accounts: await Promise.all(rows.map((row) => row.status === "loading" ? loadAccountUsage(runtime, row.provider, current, options) : row)) };
26589
+ }
26590
+ const usageReason = {
26591
+ api_key: "API key: billed per token.",
26592
+ unsupported: "This provider does not report subscription usage.",
26593
+ not_signed_in: "No account is signed in for this provider.",
26594
+ not_observed: "No usage observed yet; usage appears after the next request.",
26595
+ offline: "Usage checks are off in offline mode.",
26596
+ no_subscription: "This account does not report subscription usage.",
26597
+ needs_profile_scope: "This login lacks usage access (user:profile). Sign in to Claude again without a setup token.",
26598
+ sign_in_again: "The provider rejected this login. Sign in again.",
26599
+ forbidden: "This login does not have access to subscription usage.",
26600
+ rate_limited: "The provider is limiting usage checks. Try again later.",
26601
+ http_error: "The provider’s usage service returned an error. Try again later.",
26602
+ timeout: "The usage request timed out.",
26603
+ malformed: "The provider returned usage data Atomic could not read.",
26604
+ request_failed: "Could not reach the provider’s usage service."
26605
+ };
26606
+ // dist/core/subscription-usage-format.js
26607
+ function duration(seconds, maxUnits = 2) {
26608
+ let remaining = Math.ceil(seconds);
26609
+ const parts = [];
26610
+ for (const [size, unit] of [
26611
+ [86400, "d"],
26612
+ [3600, "h"],
26613
+ [60, "min"],
26614
+ [1, "s"]
26615
+ ]) {
26616
+ const count = Math.floor(remaining / size);
26617
+ remaining %= size;
26618
+ if (count) parts.push(`${count} ${unit}`);
26619
+ }
26620
+ return parts.slice(0, maxUnits).join(" ");
26621
+ }
26622
+ function usageWindowLabel(window) {
26623
+ return window.durationSeconds ? `${window.label} (${duration(window.durationSeconds, 4)})` : window.label;
26624
+ }
26625
+ const localReset = new Intl.DateTimeFormat(void 0, {
26626
+ weekday: "short",
26627
+ hour: "numeric",
26628
+ minute: "2-digit"
26629
+ });
26630
+ function usageResetLabel(window, now) {
26631
+ if (!window.resetsAt) return "Reset time not reported";
26632
+ const reset = new Date(window.resetsAt);
26633
+ const remaining = reset.getTime() - now;
26634
+ return `${remaining <= 0 ? "Reset due" : remaining < 6e4 ? "Resets in <1 min" : `Resets in ${duration(Math.ceil(remaining / 6e4) * 60)}`} · ${localReset.format(reset)}`;
26635
+ }
26636
+ const dollars = new Intl.NumberFormat("en-US", {
26637
+ style: "currency",
26638
+ currency: "USD",
26639
+ maximumFractionDigits: 4
26640
+ });
26641
+ function usageObservationLabel(usage) {
26642
+ return `${usage.rateLimits?.length ? "Rate limit (last request)" : "From your last request"} · as of ${localReset.format(new Date(usage.observedAt))}`;
26643
+ }
26644
+ function usageExtras(usage, now) {
26645
+ const lines = [];
26646
+ for (const rateLimit of usage.rateLimits ?? []) {
26647
+ const { kind, limit, remaining } = rateLimit;
26648
+ const capacity = remaining === void 0 ? `${limit?.toLocaleString()} limit` : `${remaining.toLocaleString()}${limit === void 0 ? "" : ` / ${limit.toLocaleString()}`} remaining`;
26649
+ const label = kind === "requests" ? "Requests" : "Tokens";
26650
+ lines.push(`${label}: ${capacity} · ${usageResetLabel(rateLimit, now)}`);
26651
+ }
26652
+ if (usage.plan) lines.push(`Plan: ${usage.plan.replaceAll("_", " ")}`);
26653
+ if (usage.resetCredits !== void 0) lines.push(`Reset credits: ${usage.resetCredits} available`);
26654
+ if (usage.credits) {
26655
+ const { available, balance, unlimited } = usage.credits;
26656
+ if (unlimited) lines.push("Usage credits: unlimited");
26657
+ else if (balance !== void 0) lines.push(`Usage credits: ${balance} remaining`);
26658
+ else if (available !== void 0) lines.push(`Usage credits: ${available ? "available" : "none"}`);
26659
+ }
26660
+ for (const label of usage.unlimitedWindows ?? []) lines.push(`${label}: unlimited`);
26661
+ if (usage.creditCap) {
26662
+ const { limit, remaining, reset, dailyUsed, weeklyUsed, monthlyUsed } = usage.creditCap;
26663
+ if (limit === null) lines.push("Credit cap: none set");
26664
+ else if (limit !== void 0) {
26665
+ const cap = `${dollars.format(limit)}${reset ? ` · resets ${reset}` : ""}`;
26666
+ lines.push(`Credit cap: ${cap}${remaining === void 0 ? "" : ` · ${dollars.format(remaining)} left`}`);
26667
+ }
26668
+ const totals = [
26669
+ ["today", dailyUsed],
26670
+ ["this week", weeklyUsed],
26671
+ ["this month", monthlyUsed]
26672
+ ].flatMap(([period, used]) => used === void 0 ? [] : [`${dollars.format(used)} ${period}`]);
26673
+ if (totals.length) lines.push(`Credits used: ${totals.join(" · ")}`);
26674
+ }
26675
+ if (usage.extraUsage) {
26676
+ const { enabled, usedPercent } = usage.extraUsage;
26677
+ lines.push(`Extra usage: ${!enabled ? "off" : usedPercent === void 0 ? "on" : `on · ${usedPercent}% used`}`);
26678
+ }
26679
+ if (!usage.windows.length && !lines.length) lines.push("No usage windows reported.");
26680
+ return lines;
26681
+ }
26682
+ // dist/modes/interactive/components/usage-selector.js
26683
+ function safeLabel(text) {
26684
+ return replaceControlCharacters(stripTerminalSequences(text)).replace(/\s+/g, " ");
26685
+ }
26686
+ function windowLines(window, width, labelWidth, now) {
26687
+ const label = usageWindowLabel(window);
26688
+ const percent = `${window.usedPercent}% used`;
26689
+ const reset = usageResetLabel(window, now);
26690
+ const size = width >= 36 ? 12 : 8;
26691
+ const fill = window.usedPercent >= 100 ? size : window.usedPercent === 0 ? 0 : Math.max(1, Math.floor(window.usedPercent / 100 * size));
26692
+ const tone = window.usedPercent >= 100 ? "error" : window.usedPercent >= 80 ? "warning" : "text";
26693
+ const bar = `${theme.fg(tone, "█".repeat(fill))}${theme.fg("dim", "░".repeat(size - fill))}`;
26694
+ const aligned = `${label.padEnd(labelWidth)} ${bar} ${theme.fg(tone, percent.padStart(11))} ${theme.fg("muted", reset)}`;
26695
+ if (visibleWidth(aligned) <= width) return [aligned];
26696
+ const gauge = `${bar} ${theme.fg(tone, percent)}`;
26697
+ const time = theme.fg("muted", reset);
26698
+ return [...wrapTextWithAnsi(label, width), ...visibleWidth(`${gauge} ${time}`) <= width ? [`${gauge} ${time}`] : [...wrapTextWithAnsi(gauge, width), ...wrapTextWithAnsi(time, width)]];
26699
+ }
26700
+ var UsageSelector = class {
26701
+ rows;
26702
+ loading = false;
26703
+ listFailed = false;
26704
+ revision = 0;
26705
+ offset = 0;
26706
+ maxOffset = 0;
26707
+ border = new DynamicBorder();
26708
+ options;
26709
+ constructor(options) {
26710
+ this.options = options;
26711
+ this.reload(false);
26712
+ }
26713
+ dispose() {
26714
+ this.revision++;
26715
+ }
26716
+ invalidate() {}
26717
+ async reload(refresh) {
26718
+ const revision = ++this.revision;
26719
+ this.loading = true;
26720
+ this.listFailed = false;
26721
+ this.offset = 0;
26722
+ this.rows = void 0;
26723
+ this.options.requestRender();
26724
+ try {
26725
+ const rows = await this.options.list();
26726
+ if (revision !== this.revision) return;
26727
+ this.rows = rows;
26728
+ this.options.requestRender();
26729
+ await Promise.all(rows.map(async (row, index) => {
26730
+ if (row.status !== "loading") return;
26731
+ const result = await this.options.load(row.provider, refresh).catch(() => ({
26732
+ ...row,
26733
+ status: "failed",
26734
+ reason: "request_failed",
26735
+ message: usageReason.request_failed
26736
+ }));
26737
+ if (revision !== this.revision) return;
26738
+ rows[index] = result;
26739
+ this.options.requestRender();
26740
+ }));
26741
+ } catch {
26742
+ if (revision === this.revision) this.listFailed = true;
26743
+ } finally {
26744
+ if (revision === this.revision) {
26745
+ this.loading = false;
26746
+ this.options.requestRender();
26747
+ }
26748
+ }
26749
+ }
26750
+ handleInput(data) {
26751
+ if (matchesKey(data, "escape")) this.options.close();
26752
+ else if (matchesKey(data, "r") && !this.loading) this.reload(true);
26753
+ else if (matchesKey(data, "up")) this.offset = Math.max(0, this.offset - 1);
26754
+ else if (matchesKey(data, "down")) this.offset = Math.min(this.maxOffset, this.offset + 1);
26755
+ }
26756
+ render(width) {
26757
+ const pad = width >= 20 ? " " : "";
26758
+ const inner = Math.max(1, width - 2 * pad.length);
26759
+ const body = [];
26760
+ const now = Date.now();
26761
+ const add = (value) => body.push(...wrapTextWithAnsi(value, inner));
26762
+ if (this.listFailed) add(theme.fg("error", "Could not read signed-in accounts."));
26763
+ else if (!this.rows) add(theme.fg("muted", "Reading signed-in accounts…"));
26764
+ else if (!this.rows.length) add(theme.fg("muted", "No signed-in accounts. Use /login to connect one."));
26765
+ else {
26766
+ const labelWidth = Math.min(18, Math.max(0, ...this.rows.flatMap((row) => row.status === "ready" ? row.windows.map((window) => usageWindowLabel(window).length) : [])));
26767
+ for (const [index, row] of this.rows.entries()) {
26768
+ if (index) body.push("");
26769
+ const name = safeLabel(row.name);
26770
+ const id = row.provider === row.name ? "" : theme.fg("muted", ` · ${safeLabel(row.provider)}`);
26771
+ const current = row.current ? theme.fg("accent", " · Current") : "";
26772
+ add(`${theme.bold(name)}${current}${id}`);
26773
+ if (row.status === "loading") add(theme.fg("muted", "Loading usage…"));
26774
+ else if (row.status === "ready") {
26775
+ if (row.source === "recent_response") add(theme.fg("muted", `From a recent response. ${row.message}`));
26776
+ if (row.source === "last_request") add(theme.fg("muted", usageObservationLabel(row)));
26777
+ for (const window of row.windows) body.push(...windowLines(window, inner, labelWidth, now));
26778
+ for (const extra of usageExtras(row, now)) add(theme.fg("muted", extra));
26779
+ } else add(theme.fg(row.status === "failed" ? "error" : "muted", row.message));
26780
+ }
26781
+ }
26782
+ const capacity = Math.max(1, Math.min(18, this.options.terminalRows() - 9));
26783
+ this.maxOffset = Math.max(0, body.length - capacity);
26784
+ this.offset = Math.min(this.offset, this.maxOffset);
26785
+ const keys = `${theme.bold("Esc")} close ${theme.bold("r")} refresh${this.maxOffset ? ` ${theme.bold("↑ ↓")} scroll` : ""}`;
26786
+ const content = [
26787
+ theme.bold("Subscription usage"),
26788
+ "",
26789
+ ...body.slice(this.offset, this.offset + capacity),
26790
+ "",
26791
+ theme.fg("muted", keys)
26792
+ ];
26793
+ return [
26794
+ ...this.border.render(width),
26795
+ ...content.map((line) => `${pad}${truncateToWidth(line, inner)}`),
26796
+ ...this.border.render(width)
26797
+ ];
26798
+ }
26799
+ };
26401
26800
  // dist/modes/interactive/interactive-selectors.js
26402
26801
  InteractiveModeBase.prototype.showSelector = function(create) {
26403
26802
  const token = {};
@@ -26431,6 +26830,30 @@ InteractiveModeBase.prototype.showSelector = function(create) {
26431
26830
  this.ui.setFocus(created.focus);
26432
26831
  this.ui.requestRender();
26433
26832
  };
26833
+ InteractiveModeBase.prototype.showUsageSelector = function() {
26834
+ this.showSelector((done) => {
26835
+ const runtime = this.runtimeHost;
26836
+ const component = new UsageSelector({
26837
+ list: async () => {
26838
+ if (runtime instanceof IsolatedInteractiveRuntime) return runtime.listUsageAccounts();
26839
+ await this.ensureDeferredStartupComplete();
26840
+ return listUsageAccounts(this.session.modelRuntime, this.session.model?.provider);
26841
+ },
26842
+ load: (provider, refresh) => runtime instanceof IsolatedInteractiveRuntime ? runtime.loadAccountUsage(provider, refresh) : loadAccountUsage(this.session.modelRuntime, provider, this.session.model?.provider, { maxAgeMs: refresh ? 0 : void 0 }),
26843
+ requestRender: () => this.ui.requestRender(),
26844
+ close: () => {
26845
+ done();
26846
+ this.ui.requestRender();
26847
+ },
26848
+ terminalRows: () => this.ui.terminal.rows
26849
+ });
26850
+ return {
26851
+ component,
26852
+ focus: component,
26853
+ dispose: () => component.dispose()
26854
+ };
26855
+ });
26856
+ };
26434
26857
  InteractiveModeBase.prototype.showSettingsSelector = async function() {
26435
26858
  const availableThemes = getAvailableThemes();
26436
26859
  const readThemeChoices = this.runtimeHost?.isProjectTrustPending?.() ? () => this.isInitialized ? {
@@ -28197,16 +28620,16 @@ var InteractiveMode = class extends InteractiveModeBase {
28197
28620
  return false;
28198
28621
  }
28199
28622
  };
28200
- export { CustomEntryComponent, InteractiveMode, serviceTierWarnings };
28623
+ export { CustomEntryComponent, InteractiveMode, listUsageAccounts, loadAccountUsage, loadSubscriptionUsage, serviceTierWarnings, usageExtras, usageObservationLabel, usageReason, usageResetLabel, usageWindowLabel };
28201
28624
 
28202
- //# sourceMappingURL=mode-interactive-sdk-7KXUFI2F.js.map
28625
+ //# sourceMappingURL=mode-interactive-sdk-JXBZ3H27.js.map
28203
28626
  // __atomicOnDemandFailed: written by the build (scripts/in-place-update-gate.mjs). An import of this release's code on
28204
28627
  // demand that fails in a process an in-place update left running says to restart.
28205
28628
  function __atomicOnDemandFailed(error, feature) {
28206
28629
  return (async () => {
28207
28630
  const root = new URL("../", import.meta.url);
28208
28631
  const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
28209
- const key = `${root.href}#0.10.18-alpha.1`;
28632
+ const key = `${root.href}#0.10.19-alpha.1`;
28210
28633
  let release = releases.get(key);
28211
28634
  if (release === undefined) {
28212
28635
  const current = (async () => {
@@ -28234,7 +28657,7 @@ function __atomicOnDemandFailed(error, feature) {
28234
28657
  } catch {
28235
28658
  // No installation to read, as in a bundle of the package: the release the process runs decides.
28236
28659
  }
28237
- const updatedTo = typeof installed === "string" && installed !== "0.10.18-alpha.1" ? installed : running !== undefined && running.version !== "0.10.18-alpha.1" ? "0.10.18-alpha.1" : undefined;
28660
+ const updatedTo = typeof installed === "string" && installed !== "0.10.19-alpha.1" ? installed : running !== undefined && running.version !== "0.10.19-alpha.1" ? "0.10.19-alpha.1" : undefined;
28238
28661
  if (updatedTo === undefined) throw error;
28239
28662
  const application = typeof running?.name === "string" ? running.name : "atomic";
28240
28663
  const restart = new Error(`${application} was updated to ${updatedTo} while this session was running; restart it to keep using ${feature}.`, {