@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,7 +1,7 @@
1
1
  import { __commonJSMin, __require } from "./rolldown-runtime-BGM3D5V3.js";
2
2
  import { APP_NAME, ENV_SESSION_DIR, VERSION, createChildProcessEnvironment, createModuleRequire, findHelperExecutable, findHelperExecutableAsync, getAgentDir, getBinDir, getProjectConfigDirs, isBunBinary, isBundledBuild, isPathWithin, loadOnDemand, markLifecycleTiming, normalizePath, processLaunch, processLaunchAsync, releaseRetainedWindowsProcessExitHandle, resolutionBaseUrl, resolvePath, resolveSafeWindowsKillCwdLexical, resolveSafeWindowsWorkingDirectoryAsync, retainWindowsProcessExitHandle, spawnLaunchedProcess, spawnLaunchedProcessSync, stripBom } from "./p0-cli-BB45ZQY6.js";
3
- import { ActivityWatchdog, Diff, JSON_RPC_ERROR_CODES, MAX_TOOL_DETACHMENT_AFTER_MS, McpAbortError, McpConnectionClosedError, NON_SECRET_HTTP_HEADERS, ROW_INTENT_META, STARTUP_DECISION_TYPED_TEXT_NOTICE, TASK_MARKS, TaskCleanupAdmissionTimeoutError, TaskEvictedError, TrustDecisionSelector, VisualLinePreview, asyncScope, chatEpoch, collectSecretsForMasking, combineUsage, computeBoxDimensions, createSourceInfo, createTypeScriptSourceSpecifierTransform, defaultModelPerProvider, defineTool, fetchWithRetry, fieldTone, flushable, formatSize, getErrnoCode, getFunctionList, getPiUserAgent, getSyntheticPathSource, getTextOutput, holdProcessDescendants, holdProcessDescendantsResult, invalidArgText, isFlushable, isFunctionList, isJsonRpcRequest, isJsonRpcResponse, isStdoutTakenOver, isStop, isSyntheticPath, isTrustDecision, isValidThinkingLevel, linkPath, many, none, parseJsonRpcMessage, redactCredentials, redactOAuthErrorText, redactOAuthErrorTextCapped, redactWwwAuthenticateHeader, removedProviderMessage, renderBorderedBox, require_applyReviver, require_constants, require_debug, require_identifiers, require_identity, require_parse_options, require_parse_url, resolveDecisionDeadlineMs, resourceInternals, safeTrustChoiceIndex, scrubFetchError, scrubUnknownErrorData, setFunctionList, spanElapsedMs, spawnContainedProcess, str, styleFieldTone, toError, validateTimeoutOverride } from "./startup-0-0-TYUFUOJZ.js";
4
- import { AgentRehydrateError, AgentReleaseConfigError, EMPTY_OUTPUT_TEXT, ExtensionInputComponent, ExtensionSelectorComponent, FirstTimeSetupComponent, LlamaClient, MULTI_SUBMIT_LABEL, MarkdownContentCache, NestedToolCallRunner, RESERVED_LABELS, SESSION_STORAGE_JOIN, SessionKeyDigests, SessionStorageSelectionSchema, SettingsSchema, StorageSelectionSchema, StringEnum as StringEnum$1, TransportEvents, WorkspaceConfigError, WrappingSelect, acceptsForkReplay, cancelReceiptStatus, chatAnswerIntent, chatNumberingFor, cleanupFailureSummary, computeFocusedOptionHasPreview, currentResourceAdmission, diffLines, discoverChatFile, errorMessage, flush, formatAnswerScalar, formatTokenSegment, genBridge, getBuiltinExtensionEntryLabel, getCommandEnv, getGitShellEnvironmentAsync, getLoaderAgentDirs, getVirtualModules, lifecycleScopeForOwner, llamaInferenceUrl, messageIsLlmVisible, next, normalizeLlamaServerUrl, normalizeMessageContent, normalizeModelFailureSignal, normalizeModelReference, normalizeProviderKeys, parseInteractiveEngineMessage, presentTaskError, readFileChatRecords, readInlineCaret, require_from_url, require_re, require_toJS, require_visit, resizeImageInProcess, resolveInlineDraftValue, runCallback, runSynchronousCallback, selectActivePreviewPaneIndex, selectActiveTabItems, selectConfirmedIndicator, sessionLifecycleCreation, stopIndex, streamCutDurationMs, tokenize, trackTranspileCacheWrite, trackWindowsDirectorySecurityWork, userLikeContentBlockIsLlmVisible, verifyWindowsDirectorySecurity, verifyWindowsDirectorySecurityAsync, waitResultTail, waitStatus, withInlineDraft, withTranspileCacheWriteOwner, withWindowsDirectorySecurityOwner } from "./startup-0-1-W2G2UY7R.js";
3
+ import { ActivityWatchdog, CompactionCancelledError, CompactorFailure, Diff, JSON_RPC_ERROR_CODES, MAX_TOOL_DETACHMENT_AFTER_MS, McpAbortError, McpConnectionClosedError, NON_SECRET_HTTP_HEADERS, ROW_INTENT_META, STARTUP_DECISION_TYPED_TEXT_NOTICE, TASK_MARKS, TaskCleanupAdmissionTimeoutError, TaskEvictedError, TrustDecisionSelector, VisualLinePreview, asyncScope, chatEpoch, collectSecretsForMasking, combineUsage, computeBoxDimensions, createSourceInfo, createTypeScriptSourceSpecifierTransform, defaultModelPerProvider, defineTool, fetchWithRetry, fieldTone, flushable, formatSize, getErrnoCode, getFunctionList, getPiUserAgent, getSyntheticPathSource, getTextOutput, holdProcessDescendants, holdProcessDescendantsResult, invalidArgText, isFlushable, isFunctionList, isJsonRpcRequest, isJsonRpcResponse, isStdoutTakenOver, isStop, isSyntheticPath, isTrustDecision, isValidThinkingLevel, linkPath, many, none, parseJsonRpcMessage, redactCredentials, redactOAuthErrorText, redactOAuthErrorTextCapped, redactWwwAuthenticateHeader, removedProviderMessage, renderBorderedBox, require_applyReviver, require_constants, require_debug, require_identifiers, require_identity, require_parse_options, require_parse_url, resolveDecisionDeadlineMs, resourceInternals, safeTrustChoiceIndex, scrubFetchError, scrubUnknownErrorData, setFunctionList, spanElapsedMs, spawnContainedProcess, str, styleFieldTone, toError, validateTimeoutOverride } from "./startup-0-0-4VG2G44V.js";
4
+ import { AgentRehydrateError, AgentReleaseConfigError, EMPTY_OUTPUT_TEXT, ExtensionInputComponent, ExtensionSelectorComponent, FirstTimeSetupComponent, LlamaClient, MULTI_SUBMIT_LABEL, MarkdownContentCache, NestedToolCallRunner, RESERVED_LABELS, SESSION_STORAGE_JOIN, SessionKeyDigests, SessionStorageSelectionSchema, SettingsSchema, StorageSelectionSchema, StringEnum as StringEnum$1, TransportEvents, WorkspaceConfigError, WrappingSelect, acceptsForkReplay, cancelReceiptStatus, chatAnswerIntent, chatNumberingFor, cleanupFailureSummary, computeFocusedOptionHasPreview, currentResourceAdmission, diffLines, discoverChatFile, errorMessage, flush, formatAnswerScalar, formatTokenSegment, genBridge, getBuiltinExtensionEntryLabel, getCommandEnv, getGitShellEnvironmentAsync, getLoaderAgentDirs, getVirtualModules, lifecycleScopeForOwner, llamaInferenceUrl, messageIsLlmVisible, next, normalizeLlamaServerUrl, normalizeMessageContent, normalizeModelFailureSignal, normalizeModelReference, normalizeProviderKeys, parseInteractiveEngineMessage, presentTaskError, readFileChatRecords, readInlineCaret, require_from_url, require_re, require_toJS, require_visit, resizeImageInProcess, resolveInlineDraftValue, runCallback, runSynchronousCallback, selectActivePreviewPaneIndex, selectActiveTabItems, selectConfirmedIndicator, sessionLifecycleCreation, stopIndex, streamCutDurationMs, tokenize, trackTranspileCacheWrite, trackWindowsDirectorySecurityWork, userLikeContentBlockIsLlmVisible, verifyWindowsDirectorySecurity, verifyWindowsDirectorySecurityAsync, waitResultTail, waitStatus, withInlineDraft, withTranspileCacheWriteOwner, withWindowsDirectorySecurityOwner } from "./startup-0-1-XTIL65D4.js";
5
5
  import { KeybindingsManager as KeybindingsManager$1, clickableHintText, clickableKeyTextHint, detectTerminalThemeForAuto, graphemeAt, initTheme, keepStartupDialogDraft, parenthesizedKeyHint, setTheme, singleLineDisplayText, terminalDisplayCursor, terminalDisplayText, theme, withEarlyInputHeldForStartupDialog } from "./p2-shell-main-B2WIALFD.js";
6
6
  import { stripJsonComments } from "./p1-shared-RG5I5LJ6.js";
7
7
  import { findInCauseChain, guardLockRemoval, nativeProcessCreationTime, nativeTerminateProcess, redactCredentialShapes, rehydrateErrorCause, releaseLock, releaseLockSync, renameReplacing, renameReplacingAsync, serializeErrorCause, waitForLock, waitForLockSync } from "./p1b-elig-ENCUPKKJ.js";
@@ -1434,7 +1434,7 @@ function formatDimensionNote(result) {
1434
1434
  // dist/core/model-resolver-patterns.js
1435
1435
  function splitThinkingSuffix(text) {
1436
1436
  const colonIndex = text.lastIndexOf(":");
1437
- const suffix = text.substring(colonIndex + 1);
1437
+ const suffix = text.substring(colonIndex + 1).toLowerCase();
1438
1438
  if (colonIndex <= 0 || !isValidThinkingLevel(suffix)) return void 0;
1439
1439
  return {
1440
1440
  base: text.substring(0, colonIndex),
@@ -10135,12 +10135,23 @@ const SamplingParamsByThinkingLevelSchema = Type$1.Object({
10135
10135
  max: Type$1.Optional(SamplingParamsSchema)
10136
10136
  }, { description: "samplingParams per thinking level, merged over samplingParams." });
10137
10137
  const SamplingParamsFieldSchema = Type$1.Record(Type$1.String(), Type$1.Unknown(), { description: "Fields merged into every request body. Applies only to OpenAI-compatible APIs." });
10138
+ const CompactionParamsFieldSchema = Type$1.Record(Type$1.String(), Type$1.Unknown(), { description: "API-specific request-body parameters merged into { messages, query, model } for compactor requests. Omit to let the remote API use its own defaults. Applies only to compactor models." });
10139
+ const EndpointPathFieldSchema = Type$1.String({ description: "Endpoint path appended to baseUrl for compactor requests (default \"/compact\"). Set to \"\" to POST directly to baseUrl. Applies only to compactor models." });
10140
+ const CompactorTimeoutFieldSchema = Type$1.Number({
10141
+ exclusiveMinimum: 0,
10142
+ description: "Wall-clock timeout in milliseconds for one compactor request (default 120000). Applies only to compactor models."
10143
+ });
10144
+ const ModelTypeFieldSchema = Type$1.Union([Type$1.Literal("chat"), Type$1.Literal("compactor")], {
10145
+ default: "chat",
10146
+ description: "Model kind: \"chat\" (default) or \"compactor\" for a dedicated remote compaction endpoint."
10147
+ });
10138
10148
  const HeadersSchema = Type$1.Record(Type$1.String(), Type$1.String(), { description: "Request headers. Values resolve like apiKey." });
10139
10149
  const ModelFieldDescriptions = {
10140
10150
  name: "Display name, also matched by --model patterns.",
10141
- reasoning: "Whether the model supports thinking.",
10142
- contextWindow: "Context window in tokens.",
10143
- maxTokens: "Maximum output tokens."
10151
+ reasoning: "Whether the model supports thinking. Applies only to chat models.",
10152
+ contextWindow: "Context window in tokens. Applies only to chat models.",
10153
+ maxTokens: "Maximum output tokens. Defaults to 16384 for chat models. When omitted on compactor models, defaults to 32000 estimated tokens, capped at 50% of the automatic trigger.",
10154
+ maxTokensOverride: "Maximum output tokens. On compactor models, sets the upper bound on compacted output in estimated tokens, capped at 50% of the automatic trigger."
10144
10155
  };
10145
10156
  /** Everything pi-ai defines for compatibility, plus Atomic's alias for the grammar-tool capability. */
10146
10157
  const ModelsJsonCompatSchema = Type$1.Object({
@@ -10159,6 +10170,7 @@ const ModelDefinitionSchema = Type$1.Object({
10159
10170
  minLength: 1,
10160
10171
  description: ModelFieldDescriptions.name
10161
10172
  })),
10173
+ type: Type$1.Optional(ModelTypeFieldSchema),
10162
10174
  api: Type$1.Optional(Type$1.String({
10163
10175
  minLength: 1,
10164
10176
  description: "Overrides the provider api."
@@ -10167,6 +10179,7 @@ const ModelDefinitionSchema = Type$1.Object({
10167
10179
  minLength: 1,
10168
10180
  description: "Overrides the provider baseUrl."
10169
10181
  })),
10182
+ endpointPath: Type$1.Optional(EndpointPathFieldSchema),
10170
10183
  reasoning: Type$1.Optional(Type$1.Boolean({
10171
10184
  default: false,
10172
10185
  description: ModelFieldDescriptions.reasoning
@@ -10186,8 +10199,10 @@ const ModelDefinitionSchema = Type$1.Object({
10186
10199
  default: 16384,
10187
10200
  description: ModelFieldDescriptions.maxTokens
10188
10201
  })),
10202
+ timeoutMs: Type$1.Optional(CompactorTimeoutFieldSchema),
10189
10203
  samplingParams: Type$1.Optional(SamplingParamsFieldSchema),
10190
10204
  samplingParamsByThinkingLevel: Type$1.Optional(SamplingParamsByThinkingLevelSchema),
10205
+ compactionParams: Type$1.Optional(CompactionParamsFieldSchema),
10191
10206
  headers: Type$1.Optional(HeadersSchema),
10192
10207
  compat: Type$1.Optional(ModelsJsonCompatSchema)
10193
10208
  });
@@ -10196,6 +10211,11 @@ const ModelOverrideSchema = Type$1.Object({
10196
10211
  minLength: 1,
10197
10212
  description: ModelFieldDescriptions.name
10198
10213
  })),
10214
+ baseUrl: Type$1.Optional(Type$1.String({
10215
+ minLength: 1,
10216
+ description: "Overrides the model baseUrl."
10217
+ })),
10218
+ endpointPath: Type$1.Optional(EndpointPathFieldSchema),
10199
10219
  reasoning: Type$1.Optional(Type$1.Boolean({ description: ModelFieldDescriptions.reasoning })),
10200
10220
  thinkingLevelMap: Type$1.Optional(ThinkingLevelMapSchema),
10201
10221
  input: Type$1.Optional(Type$1.Array(ModelInputModalitySchema)),
@@ -10208,10 +10228,12 @@ const ModelOverrideSchema = Type$1.Object({
10208
10228
  })),
10209
10229
  maxTokens: Type$1.Optional(Type$1.Number({
10210
10230
  exclusiveMinimum: 0,
10211
- description: ModelFieldDescriptions.maxTokens
10231
+ description: ModelFieldDescriptions.maxTokensOverride
10212
10232
  })),
10233
+ timeoutMs: Type$1.Optional(CompactorTimeoutFieldSchema),
10213
10234
  samplingParams: Type$1.Optional(SamplingParamsFieldSchema),
10214
10235
  samplingParamsByThinkingLevel: Type$1.Optional(SamplingParamsByThinkingLevelSchema),
10236
+ compactionParams: Type$1.Optional(CompactionParamsFieldSchema),
10215
10237
  headers: Type$1.Optional(HeadersSchema),
10216
10238
  compat: Type$1.Optional(ModelsJsonCompatSchema)
10217
10239
  });
@@ -11181,26 +11203,23 @@ function estimateTokens(message) {
11181
11203
  return 0;
11182
11204
  }
11183
11205
  // dist/core/compaction/compactor.js
11184
- /** Share of the conversation the compactor keeps. A constant, not a setting. */
11185
- const COMPACTOR_COMPRESSION_RATIO = .5;
11186
- /** Wall-clock bound on one compactor request; past it the context is cleared instead. */
11206
+ /** Default wall-clock bound on one compactor request unless overridden by model `timeoutMs`; past it the context is cleared instead. */
11187
11207
  const COMPACTOR_REQUEST_TIMEOUT_MS = 12e4;
11188
11208
  /** Lines longer than this are wrapped before they are sent, so the compactor can keep or drop parts of them. */
11189
11209
  const COMPACTOR_LINE_WIDTH = 2e3;
11190
- /** Upper bound on compacted text, in estimated tokens. Longer output is a failure and the context is cleared. */
11210
+ /** Default upper bound on compacted text, in estimated tokens, unless overridden by model `maxTokens`. Longer output is a failure and the context is cleared. */
11191
11211
  const COMPACTED_OUTPUT_MAX_TOKENS = 32e3;
11192
11212
  /** Compacted text never fills more than this share of the context the automatic trigger allows. */
11193
11213
  const COMPACTED_OUTPUT_MAX_TRIGGER_SHARE = .5;
11194
- const DEFAULT_COMPACTOR_BASE_URL = "https://api.morphllm.com/v1";
11214
+ const DEFAULT_COMPACTOR_ENDPOINT_PATH = "/compact";
11195
11215
  const HTTP_ERROR_EXCERPT_MAX_CHARS = 500;
11196
11216
  const HTTP_ERROR_BODY_MAX_BYTES = 8192;
11197
- /** Why a compactor request produced no usable text. The context is cleared instead. */
11198
- var CompactorFailure = class extends Error {
11199
- constructor(message) {
11200
- super(message);
11201
- this.name = "CompactorFailure";
11202
- }
11203
- };
11217
+ const SENSITIVE_HEADER_NAMES = /* @__PURE__ */ new Set([
11218
+ "authorization",
11219
+ "proxy-authorization",
11220
+ "x-api-key",
11221
+ "api-key"
11222
+ ]);
11204
11223
  /** Splits every line longer than `width` characters into parts of at most `width` characters. */
11205
11224
  function wrapLongLines(text, width = COMPACTOR_LINE_WIDTH) {
11206
11225
  return text.split(/\r?\n/u).flatMap((line) => {
@@ -11266,8 +11285,8 @@ function buildCompactorMessages(messages, isBoundary) {
11266
11285
  return [...boundaries, ...rest].flatMap((message) => messageIsLlmVisible(message) ? compactorMessage(message, isBoundary) ?? [] : []);
11267
11286
  }
11268
11287
  /** Largest compacted text, in estimated tokens, for a model whose automatic trigger fires above `triggerTokens`. */
11269
- function compactedOutputTokenCap(triggerTokens) {
11270
- return Math.max(0, Math.min(COMPACTED_OUTPUT_MAX_TOKENS, Math.floor(triggerTokens * COMPACTED_OUTPUT_MAX_TRIGGER_SHARE)));
11288
+ function compactedOutputTokenCap(triggerTokens, maxOutputTokens = COMPACTED_OUTPUT_MAX_TOKENS) {
11289
+ return Math.max(0, Math.min(Number.isFinite(maxOutputTokens) && maxOutputTokens > 0 ? maxOutputTokens : COMPACTED_OUTPUT_MAX_TOKENS, Math.floor(triggerTokens * COMPACTED_OUTPUT_MAX_TRIGGER_SHARE)));
11271
11290
  }
11272
11291
  /** A conservative token estimate for text: four characters per token, one per character outside ASCII. */
11273
11292
  function estimateTextTokens(text) {
@@ -11275,8 +11294,26 @@ function estimateTextTokens(text) {
11275
11294
  for (let index = 0; index < text.length; index++) if (text.charCodeAt(index) > 127) dense++;
11276
11295
  return Math.ceil((text.length - dense) / 4) + dense;
11277
11296
  }
11278
- function redact(text, apiKey) {
11279
- return redactCredentialShapes(apiKey ? text.replaceAll(apiKey, "[redacted]") : text);
11297
+ function collectSecrets(apiKey, headers) {
11298
+ const secrets = [];
11299
+ if (apiKey) secrets.push(apiKey);
11300
+ if (headers) for (const [name, value] of Object.entries(headers)) {
11301
+ if (!value) continue;
11302
+ if (SENSITIVE_HEADER_NAMES.has(name.toLowerCase())) {
11303
+ secrets.push(value);
11304
+ const trimmed = value.trim();
11305
+ if (trimmed.slice(0, 7).toLowerCase() === "bearer ") {
11306
+ const token = trimmed.slice(7).trim();
11307
+ if (token) secrets.push(token);
11308
+ }
11309
+ }
11310
+ }
11311
+ return [...new Set(secrets)].sort((a, b) => b.length - a.length);
11312
+ }
11313
+ function redact(text, secrets) {
11314
+ let cleaned = text;
11315
+ for (const secret of secrets) if (secret) cleaned = cleaned.replaceAll(secret, "[redacted]");
11316
+ return redactCredentialShapes(cleaned);
11280
11317
  }
11281
11318
  async function readHttpErrorBody(response) {
11282
11319
  if (!response.body) return "";
@@ -11301,8 +11338,8 @@ async function readHttpErrorBody(response) {
11301
11338
  reader.releaseLock();
11302
11339
  }
11303
11340
  }
11304
- async function httpErrorMessage(response, apiKey) {
11305
- const excerpt = redact(await readHttpErrorBody(response), apiKey).replace(/[\x00-\x1f\x7f-\x9f]/g, " ").replace(/\s+/g, " ").trim().slice(0, HTTP_ERROR_EXCERPT_MAX_CHARS);
11341
+ async function httpErrorMessage(response, secrets) {
11342
+ const excerpt = redact(await readHttpErrorBody(response), secrets).replace(/[\x00-\x1f\x7f-\x9f]/g, " ").replace(/\s+/g, " ").trim().slice(0, HTTP_ERROR_EXCERPT_MAX_CHARS);
11306
11343
  return `HTTP ${response.status}${excerpt ? `: ${excerpt}` : ""}`;
11307
11344
  }
11308
11345
  function compactorUsage(usage) {
@@ -11333,63 +11370,114 @@ function trimTrailingSlashes(url) {
11333
11370
  while (end > 0 && url.charCodeAt(end - 1) === 47) end--;
11334
11371
  return url.slice(0, end);
11335
11372
  }
11373
+ function resolveCompactorUrl(baseUrl, endpointPath) {
11374
+ const base = trimTrailingSlashes(baseUrl);
11375
+ const path = endpointPath === void 0 ? DEFAULT_COMPACTOR_ENDPOINT_PATH : endpointPath.trim();
11376
+ if (!path) return base;
11377
+ return path.startsWith("/") ? `${base}${path}` : `${base}/${path}`;
11378
+ }
11379
+ function hasHeaderCaseInsensitive(headers, target) {
11380
+ const lower = target.toLowerCase();
11381
+ return Object.keys(headers).some((key) => key.toLowerCase() === lower);
11382
+ }
11383
+ function buildCompactorPayload(request) {
11384
+ const payload = {};
11385
+ if (request.params) {
11386
+ for (const [key, value] of Object.entries(request.params)) if (value !== void 0) payload[key] = value;
11387
+ }
11388
+ payload.messages = request.messages;
11389
+ payload.query = request.query;
11390
+ payload.model = request.modelId;
11391
+ return payload;
11392
+ }
11336
11393
  /**
11337
- * Send the framed conversation to a compactor endpoint and return its text. Throws `CompactorFailure` naming the
11338
- * reason for every failure (no credentials, HTTP error, malformed or empty output, timeout), and `Compaction cancelled`
11339
- * when `signal` aborts. The API key never appears in a thrown message.
11394
+ * Send the framed conversation to a compactor endpoint and return its text. Throws {@link CompactorFailure} (a
11395
+ * {@link CompactionError}) naming the reason for every failure (missing baseUrl, no credentials, HTTP error, malformed
11396
+ * or empty output, timeout), and {@link CompactionCancelledError} when `signal` aborts. Credentials never appear in a
11397
+ * thrown message.
11340
11398
  */
11341
11399
  async function requestCompactorOutput(request) {
11342
- if (request.signal.aborted) throw new Error("Compaction cancelled");
11400
+ if (request.signal.aborted) throw new CompactionCancelledError({ reason: "aborted" });
11401
+ const baseUrl = request.baseUrl?.trim();
11402
+ if (!baseUrl) throw new CompactorFailure("no baseUrl configured for compactor model", {
11403
+ code: "missing-base-url",
11404
+ model: request.modelId
11405
+ });
11343
11406
  const apiKey = request.apiKey;
11344
- if (!apiKey) throw new CompactorFailure("no credentials (use /login or the provider's API key variable)");
11345
- const timeoutMs = request.timeoutMs ?? 12e4;
11407
+ const customHeaders = request.headers;
11408
+ const hasCustomHeaders = customHeaders !== void 0 && Object.keys(customHeaders).length > 0;
11409
+ if (!apiKey && !hasCustomHeaders) throw new CompactorFailure("no credentials (use /login or the provider's API key variable)", {
11410
+ code: "missing-credentials",
11411
+ model: request.modelId
11412
+ });
11413
+ const secrets = collectSecrets(apiKey, customHeaders);
11414
+ const timeoutMs = request.timeoutMs !== void 0 && Number.isFinite(request.timeoutMs) && request.timeoutMs > 0 ? request.timeoutMs : COMPACTOR_REQUEST_TIMEOUT_MS;
11346
11415
  const timeout = AbortSignal.timeout(timeoutMs);
11347
11416
  const signal = AbortSignal.any([
11348
11417
  request.signal,
11349
11418
  timeout,
11350
11419
  ...request.stop ? [request.stop] : []
11351
11420
  ]);
11352
- const failure = (error) => {
11353
- if (request.signal.aborted) throw new Error("Compaction cancelled");
11354
- if (request.stop?.aborted) throw new CompactorFailure("request aborted");
11355
- if (timeout.aborted) throw new CompactorFailure(`timed out after ${timeoutMs} ms`);
11356
- throw new CompactorFailure(redact(typeof error === "string" ? error : error.message || error.name, apiKey));
11421
+ const failure = (error, options) => {
11422
+ if (request.signal.aborted) throw new CompactionCancelledError({ reason: "aborted" });
11423
+ if (request.stop?.aborted) throw new CompactorFailure("request aborted", {
11424
+ code: "request-aborted",
11425
+ model: request.modelId
11426
+ });
11427
+ if (timeout.aborted) throw new CompactorFailure(`timed out after ${timeoutMs} ms`, {
11428
+ code: "timeout",
11429
+ timeoutMs,
11430
+ model: request.modelId
11431
+ });
11432
+ const message = typeof error === "string" ? error : error.message || error.name;
11433
+ throw new CompactorFailure(redact(message, secrets), {
11434
+ code: options?.code ?? "network-error",
11435
+ ...options?.status !== void 0 ? { status: options.status } : {},
11436
+ model: request.modelId
11437
+ });
11438
+ };
11439
+ const url = resolveCompactorUrl(baseUrl, request.endpointPath);
11440
+ const headers = {
11441
+ "Content-Type": "application/json",
11442
+ ...customHeaders
11357
11443
  };
11358
- const baseUrl = trimTrailingSlashes(request.baseUrl ?? DEFAULT_COMPACTOR_BASE_URL);
11444
+ if (apiKey && !hasHeaderCaseInsensitive(headers, "authorization")) headers.Authorization = `Bearer ${apiKey}`;
11359
11445
  let response;
11360
11446
  try {
11361
- response = await (request.fetchFn ?? fetch)(`${baseUrl}/compact`, {
11447
+ response = await (request.fetchFn ?? fetch)(url, {
11362
11448
  method: "POST",
11363
- headers: {
11364
- Authorization: `Bearer ${apiKey}`,
11365
- "Content-Type": "application/json"
11366
- },
11367
- body: JSON.stringify({
11368
- messages: request.messages,
11369
- query: request.query,
11370
- compression_ratio: COMPACTOR_COMPRESSION_RATIO,
11371
- preserve_recent: 0,
11372
- include_markers: true,
11373
- include_line_ranges: false,
11374
- model: request.modelId
11375
- }),
11449
+ headers,
11450
+ body: JSON.stringify(buildCompactorPayload(request)),
11376
11451
  signal
11377
11452
  });
11378
11453
  } catch (error) {
11379
- return failure(error instanceof Error ? error : String(error));
11454
+ return failure(error instanceof Error ? error : String(error), { code: "network-error" });
11380
11455
  }
11381
- if (!response.ok) return failure(await httpErrorMessage(response, apiKey));
11456
+ if (!response.ok) return failure(await httpErrorMessage(response, secrets), {
11457
+ code: "http-error",
11458
+ status: response.status
11459
+ });
11382
11460
  let body;
11383
11461
  try {
11384
11462
  body = await response.json();
11385
11463
  } catch (error) {
11386
11464
  if (request.signal.aborted || timeout.aborted) return failure(error instanceof Error ? error : String(error));
11387
- throw new CompactorFailure("malformed response");
11465
+ throw new CompactorFailure("malformed response", {
11466
+ code: "malformed-response",
11467
+ model: request.modelId
11468
+ });
11388
11469
  }
11389
- if (request.signal.aborted) throw new Error("Compaction cancelled");
11390
- if (typeof body !== "object" || body === null) throw new CompactorFailure("malformed response");
11391
- const text = responseText(body).replaceAll(apiKey, "[redacted]");
11392
- if (!text) throw new CompactorFailure("empty output");
11470
+ if (request.signal.aborted) throw new CompactionCancelledError({ reason: "aborted" });
11471
+ if (typeof body !== "object" || body === null) throw new CompactorFailure("malformed response", {
11472
+ code: "malformed-response",
11473
+ model: request.modelId
11474
+ });
11475
+ let text = responseText(body);
11476
+ for (const secret of secrets) if (secret) text = text.replaceAll(secret, "[redacted]");
11477
+ if (!text) throw new CompactorFailure("empty output", {
11478
+ code: "empty-output",
11479
+ model: request.modelId
11480
+ });
11393
11481
  const usage = compactorUsage(body.usage);
11394
11482
  return {
11395
11483
  text,
@@ -12122,16 +12210,16 @@ var RpcTerminalDrain = class {
12122
12210
  return this.generation === generation && this.settlement ? this.settlement : Promise.resolve();
12123
12211
  }
12124
12212
  };
12125
- export { AgentTokenMeter, AgentWakeDispatcher, COMPACTED_OUTPUT_MAX_TOKENS, COMPACTOR_COMPRESSION_RATIO, COMPACTOR_REQUEST_TIMEOUT_MS, ChatRowView, CompactorFailure, DEFAULT_AGENT_WAIT_BUDGET_MS, DEFAULT_COMPACTION_SETTINGS, DialogView, FILE_HEADERS_ONLY, FileAuthStorageBackend, InMemoryAuthStorageBackend, InteractiveEngineMonitor, JsonRpcLineReader, LLAMA_PROVIDER_ID, LONG_STREAM_CUT_ADVICE, LONG_STREAM_CUT_MS, MAX_LONG_STREAM_CUT_RETRIES, McpAuthRequiredError, McpHttpError, McpSessionExpiredError, MessageAdmissionBoundary, ModelConfig, OptionListView, PreviewBlockRenderer, QuestionnairePropsAdapter, ResumeCatalogTimeoutError, ResumeCatalogUnavailableError, ResumeError, ResumeNotFoundError, ResumePreconditionError, RpcTerminalDrain, SESSIONS_STORAGE_ENV, STORAGE_ENV, STRUCTURED_OUTPUT_TOOL_NAME, SessionWorkUnsettledError, StartupDialogInputGuard, StreamableHttpTransport, TaskSupervisor, TempDirRefusedError, TodoParams, WorkingRunMeter, abortSessionWork, acquireProtectedPaths, addShellOutputPreview, agentTokenTotal, agentWakeDispatcher, applyExtensionSourceInfo, applyProviderRateLimitObservation, armSessionQuitStops, assertPrivateDirectory, assertPrivateDirectoryAsync, assertSessionOpen, assertWorkspace, asyncAuthStorageReads, automaticWaitBudgetMs, bindTaskChatPage, buildCompactorMessages, buildFallbackModel, buildQuestionnaireResponse, buildToolResult, calculateContextTokens, captureChatSnapshot, captureTaskChatFile, chatPageRequest, classifyRepository, clearNestedToolCalls, compactedOutputTokenCap, compactionMeta, configureProviderRequestBudget, createLlamaProvider, createStructuredOutputCapture, createStructuredOutputTool, createToolDefinitionFromAgentTool, createTwoFilesPatch, detectStartupTheme, discoverAppendSystemPromptFile, discoverSystemPromptFile, drainSessionReload, drainSessionWork, drainSessionWorkWithin, dropWrongTypedSettings, ensurePrivateTempDir, ensurePrivateTempDirAsync, ensureSessionTempDirAsync, ensureTempDirAsync, estimateContextTokens, estimateDirectBranchContextTokens, estimateProjectedContextTokens, estimateTextTokens, estimateTokens, executeNestedToolCall, findExactModelReferenceMatch, findResumeError, findSourceInfoForPath, formatDimensionNote, formatKillCall, formatPatch, formatTruncationNotice, formatWorkingElapsed, formatWorkingMeta, fun, gen, getCallableTools, getDefaultSourceInfoForPath, getLastAssistantUsage, getNativeMcpToolIdentity, getPowerShellConfig, getPowerShellConfigAsync, getShellConfig, getShellConfigAsync, getShellEnvAsync, getTempRootDir, hasCallingSessionWork, hasProcessStorageSelection, hasSessionReload, importAfterEvaluation, installHostModuleBridge, invalidSettingMessage, isLongStreamCut, isPowerShellAvailable, isPowerShellAvailableAsync, isProtectedSessionTempDir, isProviderLimitFailure, isProviderRateLimit, isResumeCatalogTimeoutError, isResumeCatalogUnavailableError, isResumeError, isResumeNotFoundError, isResumePreconditionError, isRetryableResumeError, isSelectedNativeMcpTool, isTodoOperationError, isWorkspace, killChildProcessTree, killProcessTree, killSupervisedProcessTrees, killTrackedDetachedChildren, limitQuitShutdownHandlers, loadTaskOwnTranscriptEntries, loadTaskOwnTranscriptHistory, markDetachedChildExited, markNativeMcpToolDefinition, markProviderRateLimitObserved, matchesMcpDirectToolSelection, modelIdForModel, nextRetryDecision, normalizeDerivedSessionEntries, normalizeWorkingRunSnapshot, observeAccountCatalog, observeProviderRateLimits, observedTaskChatWrite, onSessionQuit, ownedSessionManagerStores, ownedSessionPermits, ownedSessionStores, prepareSourceEntries, prepareSourceEntry, previewProcessStorageSelection, previewSessionSettingSelection, processSharedStorageSelection, processSharedStorageSelectionAsync, processStorageEnvironment, processStorageEnvironmentAsync, providerAdmissionTurn, providerCooldownMs, providerIdForModel, providerLimitScope, providerRateLimitObservations, providerRateLimitSnapshot, providerRequestGate, providerRetryHint, providerUnavailableMs, rebuildKillResult, rebuildShellWaitResult, recordNestedToolCalls, recordProviderRateLimit, recordProviderRetryHint, recordProviderSuccess, recordedRepo, reduce, registerSessionRetirement, registerSessionWorkOwner, registerSourceBuiltinLoad, rehydrateResumeError, renewSessionWork, repeatsLongStreamCut, requestCompactorOutput, require_Node, require_anchors, require_directives, require_lib, require_semver, resizeImage, resolveModelReference, resolveSessionTempDirPath, restoreAnthropicReplayThinkingBlocks, retireSessionReloadGeneration, runCommand, runCommandCapture, runCommandSync, runInProgress, runWithConcurrency, sanitizeTempPathComponent, selectChatRowProps, selectDialogProps, selectMultiSelectProps, selectOptionListProps, selectPreviewPaneProps, selectProcessStorage, selectProcessStorageAsync, selectProcessStorageSteps, selectSubmitPickerProps, selectTabBarProps, serializeResumeError, sessionGenerationClosing, sessionLifetime, sessionQuitSignal, setActiveSessionTempId, setCliStorageSelection, setProviderRequestGate, shouldCompact, showFirstTimeSetup, showStartupInput, showStartupSelector, shutdownDeadline, spawnShellProcess, startParentProcessGuardian, structuredPatch, summarizeQuestions, taskChatPage, taskExtensionStatuses, taskOwnTranscriptEntries, taskTranscriptSource, trackDetachedChildPid, trackDetachedChildProcess, trackSessionReload, trackSessionWork, transformTemplate, tryAdmitProviderRequest, untilShutdownHandlerDeadline, untrackDetachedChildPid, validateProcessStorageAsync, validateQuestionnaire, wakeKeyNamespace, watchTaskExtensionStatuses, watchTaskTranscriptBindings, withBuiltinDiagnostics, withDiscoveredModels, withPersonalizedCatalog, withRemoteCatalog, withTaskChatRows, workspace, wrapToolDefinition };
12213
+ export { AgentTokenMeter, AgentWakeDispatcher, COMPACTED_OUTPUT_MAX_TOKENS, COMPACTED_OUTPUT_MAX_TRIGGER_SHARE, COMPACTOR_LINE_WIDTH, COMPACTOR_REQUEST_TIMEOUT_MS, ChatRowView, DEFAULT_AGENT_WAIT_BUDGET_MS, DEFAULT_COMPACTION_SETTINGS, DialogView, FILE_HEADERS_ONLY, FileAuthStorageBackend, InMemoryAuthStorageBackend, InteractiveEngineMonitor, JsonRpcLineReader, LLAMA_PROVIDER_ID, LONG_STREAM_CUT_ADVICE, LONG_STREAM_CUT_MS, MAX_LONG_STREAM_CUT_RETRIES, McpAuthRequiredError, McpHttpError, McpSessionExpiredError, MessageAdmissionBoundary, ModelConfig, OptionListView, PreviewBlockRenderer, QuestionnairePropsAdapter, ResumeCatalogTimeoutError, ResumeCatalogUnavailableError, ResumeError, ResumeNotFoundError, ResumePreconditionError, RpcTerminalDrain, SESSIONS_STORAGE_ENV, STORAGE_ENV, STRUCTURED_OUTPUT_TOOL_NAME, SessionWorkUnsettledError, StartupDialogInputGuard, StreamableHttpTransport, TaskSupervisor, TempDirRefusedError, TodoParams, WorkingRunMeter, abortSessionWork, acquireProtectedPaths, addShellOutputPreview, agentTokenTotal, agentWakeDispatcher, applyExtensionSourceInfo, applyProviderRateLimitObservation, armSessionQuitStops, assertPrivateDirectory, assertPrivateDirectoryAsync, assertSessionOpen, assertWorkspace, asyncAuthStorageReads, automaticWaitBudgetMs, bindTaskChatPage, buildCompactorMessages, buildFallbackModel, buildQuestionnaireResponse, buildToolResult, calculateContextTokens, captureChatSnapshot, captureTaskChatFile, chatPageRequest, classifyRepository, clearNestedToolCalls, compactedOutputTokenCap, compactionMeta, configureProviderRequestBudget, createLlamaProvider, createStructuredOutputCapture, createStructuredOutputTool, createToolDefinitionFromAgentTool, createTwoFilesPatch, detectStartupTheme, discoverAppendSystemPromptFile, discoverSystemPromptFile, drainSessionReload, drainSessionWork, drainSessionWorkWithin, dropWrongTypedSettings, ensurePrivateTempDir, ensurePrivateTempDirAsync, ensureSessionTempDirAsync, ensureTempDirAsync, estimateContextTokens, estimateDirectBranchContextTokens, estimateProjectedContextTokens, estimateTextTokens, estimateTokens, executeNestedToolCall, findExactModelReferenceMatch, findResumeError, findSourceInfoForPath, formatDimensionNote, formatKillCall, formatPatch, formatTruncationNotice, formatWorkingElapsed, formatWorkingMeta, fun, gen, getCallableTools, getDefaultSourceInfoForPath, getLastAssistantUsage, getNativeMcpToolIdentity, getPowerShellConfig, getPowerShellConfigAsync, getShellConfig, getShellConfigAsync, getShellEnvAsync, getTempRootDir, hasCallingSessionWork, hasProcessStorageSelection, hasSessionReload, importAfterEvaluation, installHostModuleBridge, invalidSettingMessage, isLongStreamCut, isPowerShellAvailable, isPowerShellAvailableAsync, isProtectedSessionTempDir, isProviderLimitFailure, isProviderRateLimit, isResumeCatalogTimeoutError, isResumeCatalogUnavailableError, isResumeError, isResumeNotFoundError, isResumePreconditionError, isRetryableResumeError, isSelectedNativeMcpTool, isTodoOperationError, isWorkspace, killChildProcessTree, killProcessTree, killSupervisedProcessTrees, killTrackedDetachedChildren, limitQuitShutdownHandlers, loadTaskOwnTranscriptEntries, loadTaskOwnTranscriptHistory, markDetachedChildExited, markNativeMcpToolDefinition, markProviderRateLimitObserved, matchesMcpDirectToolSelection, modelIdForModel, nextRetryDecision, normalizeDerivedSessionEntries, normalizeWorkingRunSnapshot, observeAccountCatalog, observeProviderRateLimits, observedTaskChatWrite, onSessionQuit, ownedSessionManagerStores, ownedSessionPermits, ownedSessionStores, prepareSourceEntries, prepareSourceEntry, previewProcessStorageSelection, previewSessionSettingSelection, processSharedStorageSelection, processSharedStorageSelectionAsync, processStorageEnvironment, processStorageEnvironmentAsync, providerAdmissionTurn, providerCooldownMs, providerIdForModel, providerLimitScope, providerRateLimitObservations, providerRateLimitSnapshot, providerRequestGate, providerRetryHint, providerUnavailableMs, rebuildKillResult, rebuildShellWaitResult, recordNestedToolCalls, recordProviderRateLimit, recordProviderRetryHint, recordProviderSuccess, recordedRepo, reduce, registerSessionRetirement, registerSessionWorkOwner, registerSourceBuiltinLoad, rehydrateResumeError, renewSessionWork, repeatsLongStreamCut, requestCompactorOutput, require_Node, require_anchors, require_directives, require_lib, require_semver, resizeImage, resolveModelReference, resolveSessionTempDirPath, restoreAnthropicReplayThinkingBlocks, retireSessionReloadGeneration, runCommand, runCommandCapture, runCommandSync, runInProgress, runWithConcurrency, sanitizeTempPathComponent, selectChatRowProps, selectDialogProps, selectMultiSelectProps, selectOptionListProps, selectPreviewPaneProps, selectProcessStorage, selectProcessStorageAsync, selectProcessStorageSteps, selectSubmitPickerProps, selectTabBarProps, serializeResumeError, sessionGenerationClosing, sessionLifetime, sessionQuitSignal, setActiveSessionTempId, setCliStorageSelection, setProviderRequestGate, shouldCompact, showFirstTimeSetup, showStartupInput, showStartupSelector, shutdownDeadline, spawnShellProcess, startParentProcessGuardian, structuredPatch, summarizeQuestions, taskChatPage, taskExtensionStatuses, taskOwnTranscriptEntries, taskTranscriptSource, trackDetachedChildPid, trackDetachedChildProcess, trackSessionReload, trackSessionWork, transformTemplate, tryAdmitProviderRequest, untilShutdownHandlerDeadline, untrackDetachedChildPid, validateProcessStorageAsync, validateQuestionnaire, wakeKeyNamespace, watchTaskExtensionStatuses, watchTaskTranscriptBindings, withBuiltinDiagnostics, withDiscoveredModels, withPersonalizedCatalog, withRemoteCatalog, withTaskChatRows, workspace, wrapLongLines, wrapToolDefinition };
12126
12214
 
12127
- //# sourceMappingURL=startup-0-2-UXBUEOXW.js.map
12215
+ //# sourceMappingURL=startup-0-2-27OWFHV6.js.map
12128
12216
  // __atomicOnDemandFailed: written by the build (scripts/in-place-update-gate.mjs). An import of this release's code on
12129
12217
  // demand that fails in a process an in-place update left running says to restart.
12130
12218
  function __atomicOnDemandFailed(error, feature) {
12131
12219
  return (async () => {
12132
12220
  const root = new URL("../", import.meta.url);
12133
12221
  const releases = (globalThis[Symbol.for("atomic.in-place-update-release.v1")] ??= new Map());
12134
- const key = `${root.href}#0.10.9`;
12222
+ const key = `${root.href}#0.10.10-alpha.2`;
12135
12223
  let release = releases.get(key);
12136
12224
  if (release === undefined) {
12137
12225
  const current = (async () => {
@@ -12159,7 +12247,7 @@ function __atomicOnDemandFailed(error, feature) {
12159
12247
  } catch {
12160
12248
  // No installation to read, as in a bundle of the package: the release the process runs decides.
12161
12249
  }
12162
- const updatedTo = typeof installed === "string" && installed !== "0.10.9" ? installed : running !== undefined && running.version !== "0.10.9" ? "0.10.9" : undefined;
12250
+ const updatedTo = typeof installed === "string" && installed !== "0.10.10-alpha.2" ? installed : running !== undefined && running.version !== "0.10.10-alpha.2" ? "0.10.10-alpha.2" : undefined;
12163
12251
  if (updatedTo === undefined) throw error;
12164
12252
  const application = typeof running?.name === "string" ? running.name : "atomic";
12165
12253
  const restart = new Error(`${application} was updated to ${updatedTo} while this session was running; restart it to keep using ${feature}.`, {