@draht/coding-agent 2026.9.5-1 → 2026.10.4-3

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 (1015) hide show
  1. package/CHANGELOG.md +458 -0
  2. package/dist/bun/cli.d.ts +1 -1
  3. package/dist/bun/cli.d.ts.map +1 -1
  4. package/dist/bun/cli.js +6 -3
  5. package/dist/bun/cli.js.map +1 -1
  6. package/dist/bun/sandbox-env-setup.d.ts +2 -0
  7. package/dist/bun/sandbox-env-setup.d.ts.map +1 -0
  8. package/dist/bun/sandbox-env-setup.js +4 -0
  9. package/dist/bun/sandbox-env-setup.js.map +1 -0
  10. package/dist/bundle/chunks/anthropic-messages-E2P6C3P7.js +6 -0
  11. package/dist/bundle/chunks/anthropic.js +75 -0
  12. package/dist/bundle/chunks/azure-openai-responses-JZMSTDIM.js +2 -0
  13. package/dist/bundle/chunks/bedrock-converse-stream.js +79 -0
  14. package/dist/bundle/chunks/chunk-2E5VODES.js +2 -0
  15. package/dist/bundle/chunks/chunk-2FBJKY7F.js +2 -0
  16. package/dist/bundle/chunks/chunk-2JZLKNZ4.js +3 -0
  17. package/dist/bundle/chunks/chunk-2N4I6WXC.js +2 -0
  18. package/dist/bundle/chunks/chunk-3HF756LN.js +1472 -0
  19. package/dist/bundle/chunks/chunk-5QJFWTKA.js +4 -0
  20. package/dist/bundle/chunks/chunk-63BK6WK2.js +2 -0
  21. package/dist/bundle/chunks/chunk-A4OX5CPR.js +146 -0
  22. package/dist/bundle/chunks/chunk-AFL4IDSI.js +82 -0
  23. package/dist/bundle/chunks/chunk-D3HO453P.js +42 -0
  24. package/dist/bundle/chunks/chunk-EBVYI75P.js +2 -0
  25. package/dist/bundle/chunks/chunk-FBU742QF.js +2 -0
  26. package/dist/bundle/chunks/chunk-FHX2S5IG.js +31 -0
  27. package/dist/bundle/chunks/chunk-GBFVS2SF.js +12 -0
  28. package/dist/bundle/chunks/chunk-GVXA72ZA.js +2 -0
  29. package/dist/bundle/chunks/chunk-HJ72RANT.js +2 -0
  30. package/dist/bundle/chunks/chunk-HTJ3L72O.js +2 -0
  31. package/dist/bundle/chunks/chunk-HZ2UHMBT.js +2 -0
  32. package/dist/bundle/chunks/chunk-I5OKY6RH.js +11 -0
  33. package/dist/bundle/chunks/chunk-JTLUBTZT.js +2 -0
  34. package/dist/bundle/chunks/chunk-KPO5375S.js +2 -0
  35. package/dist/bundle/chunks/chunk-KY2BG6BC.js +11 -0
  36. package/dist/bundle/chunks/chunk-LO6CVU2L.js +6 -0
  37. package/dist/bundle/chunks/chunk-QMN7OD6G.js +2 -0
  38. package/dist/bundle/chunks/chunk-SDRCE6OP.js +2 -0
  39. package/dist/bundle/chunks/chunk-SPZUYYP5.js +170 -0
  40. package/dist/bundle/chunks/chunk-UTRX2VHB.js +44 -0
  41. package/dist/bundle/chunks/chunk-V5HG6S2T.js +4 -0
  42. package/dist/bundle/chunks/chunk-VPYAVQLP.js +137 -0
  43. package/dist/bundle/chunks/chunk-VXUJMEMO.js +2 -0
  44. package/dist/bundle/chunks/chunk-XBUEMKIY.js +2 -0
  45. package/dist/bundle/chunks/chunk-XHCO4PPH.js +8 -0
  46. package/dist/bundle/chunks/chunk-XO3IECI5.js +18 -0
  47. package/dist/bundle/chunks/chunk-XOGEYN4Q.js +2 -0
  48. package/dist/bundle/chunks/cli-L74YA5GF.js +51 -0
  49. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-MJKOAE5S.js +2 -0
  50. package/dist/bundle/chunks/codemode-worker.js +315 -0
  51. package/dist/bundle/chunks/execute-EMOVNTD6.js +328 -0
  52. package/dist/bundle/chunks/github-copilot.js +2 -0
  53. package/dist/bundle/chunks/google-antigravity.js +75 -0
  54. package/dist/bundle/chunks/google-gemini-cli.js +75 -0
  55. package/dist/bundle/chunks/google-generative-ai-HPNDIAZD.js +2 -0
  56. package/dist/bundle/chunks/google-vertex-KPAWJ4SP.js +2 -0
  57. package/dist/bundle/chunks/https-proxy-agent-WQIRL24U.js +13 -0
  58. package/dist/bundle/chunks/image-resize-worker.js +2 -0
  59. package/dist/bundle/chunks/jiti-loader-RKXLMQV2.js +2 -0
  60. package/dist/bundle/chunks/kimi-coding.js +2 -0
  61. package/dist/bundle/chunks/lib-ULKZYRGD.js +9 -0
  62. package/dist/bundle/chunks/llama-cpp-classify-EJ5XMSQL.js +22 -0
  63. package/dist/bundle/chunks/meta.js +2 -0
  64. package/dist/bundle/chunks/mistral-conversations-FMSPWQ7A.js +5 -0
  65. package/dist/bundle/chunks/multipart-parser-HMCXZ4BD.js +3 -0
  66. package/dist/bundle/chunks/node-4JNG6XQO.js +16 -0
  67. package/dist/bundle/chunks/node-6IIDYB3K.js +2 -0
  68. package/dist/bundle/chunks/openai-chatgpt.js +75 -0
  69. package/dist/bundle/chunks/openai-codex-responses-TU7NGPXE.js +10 -0
  70. package/dist/bundle/chunks/openai-codex.js +75 -0
  71. package/dist/bundle/chunks/openai-completions-GANCQQO5.js +7 -0
  72. package/dist/bundle/chunks/openai-responses-ASDPAX3E.js +3 -0
  73. package/dist/bundle/chunks/opencode-go.js +2 -0
  74. package/dist/bundle/chunks/openrouter-images-NROSQXMZ.js +2 -0
  75. package/dist/bundle/chunks/openrouter.js +75 -0
  76. package/dist/bundle/chunks/pi-messages-2QEJYOAO.js +8 -0
  77. package/dist/bundle/chunks/radius.js +75 -0
  78. package/dist/bundle/chunks/runtime-RYUR6LRB.js +2 -0
  79. package/dist/bundle/chunks/settings-manager-CHEMMAGQ.js +2 -0
  80. package/dist/bundle/chunks/src-KDGO7EGF.js +4 -0
  81. package/dist/bundle/chunks/typesafe-system-one-YBEEY5XU.js +2 -0
  82. package/dist/bundle/chunks/virtual-modules-OC56AAJ7.js +2 -0
  83. package/dist/bundle/chunks/xai.js +75 -0
  84. package/dist/bundle/cli-runtime.js +3 -0
  85. package/dist/bundle/cli.js +5 -0
  86. package/dist/bundle/index.js +2 -0
  87. package/dist/bundle/rpc-entry.js +3 -0
  88. package/dist/cli/args.d.ts +4 -0
  89. package/dist/cli/args.d.ts.map +1 -1
  90. package/dist/cli/args.js +72 -21
  91. package/dist/cli/args.js.map +1 -1
  92. package/dist/cli/auth-check.d.ts +19 -0
  93. package/dist/cli/auth-check.d.ts.map +1 -0
  94. package/dist/cli/auth-check.js +50 -0
  95. package/dist/cli/auth-check.js.map +1 -0
  96. package/dist/cli/auth-command.d.ts +24 -0
  97. package/dist/cli/auth-command.d.ts.map +1 -0
  98. package/dist/cli/auth-command.js +103 -0
  99. package/dist/cli/auth-command.js.map +1 -0
  100. package/dist/cli/config-selector.d.ts.map +1 -1
  101. package/dist/cli/config-selector.js +3 -2
  102. package/dist/cli/config-selector.js.map +1 -1
  103. package/dist/cli/credential-print.d.ts +5 -3
  104. package/dist/cli/credential-print.d.ts.map +1 -1
  105. package/dist/cli/credential-print.js +42 -30
  106. package/dist/cli/credential-print.js.map +1 -1
  107. package/dist/cli/file-processor.d.ts +1 -1
  108. package/dist/cli/file-processor.d.ts.map +1 -1
  109. package/dist/cli/file-processor.js +2 -1
  110. package/dist/cli/file-processor.js.map +1 -1
  111. package/dist/cli/list-models.d.ts +1 -1
  112. package/dist/cli/list-models.d.ts.map +1 -1
  113. package/dist/cli/list-models.js +2 -2
  114. package/dist/cli/list-models.js.map +1 -1
  115. package/dist/cli/session-picker.d.ts +1 -1
  116. package/dist/cli/session-picker.d.ts.map +1 -1
  117. package/dist/cli/session-picker.js.map +1 -1
  118. package/dist/cli/setup.d.ts +2 -0
  119. package/dist/cli/setup.d.ts.map +1 -0
  120. package/dist/cli/setup.js +12 -0
  121. package/dist/cli/setup.js.map +1 -0
  122. package/dist/cli/startup-ui.d.ts +2 -2
  123. package/dist/cli/startup-ui.d.ts.map +1 -1
  124. package/dist/cli/startup-ui.js +42 -33
  125. package/dist/cli/startup-ui.js.map +1 -1
  126. package/dist/cli.js +3 -12
  127. package/dist/cli.js.map +1 -1
  128. package/dist/config.d.ts +20 -4
  129. package/dist/config.d.ts.map +1 -1
  130. package/dist/config.js +42 -6
  131. package/dist/config.js.map +1 -1
  132. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  133. package/dist/core/agent-session-runtime.js +12 -3
  134. package/dist/core/agent-session-runtime.js.map +1 -1
  135. package/dist/core/agent-session-services.d.ts +1 -0
  136. package/dist/core/agent-session-services.d.ts.map +1 -1
  137. package/dist/core/agent-session-services.js +14 -0
  138. package/dist/core/agent-session-services.js.map +1 -1
  139. package/dist/core/agent-session.d.ts +237 -39
  140. package/dist/core/agent-session.d.ts.map +1 -1
  141. package/dist/core/agent-session.js +1386 -565
  142. package/dist/core/agent-session.js.map +1 -1
  143. package/dist/core/auth-storage.d.ts +20 -8
  144. package/dist/core/auth-storage.d.ts.map +1 -1
  145. package/dist/core/auth-storage.js +199 -56
  146. package/dist/core/auth-storage.js.map +1 -1
  147. package/dist/core/bug-report-upload.d.ts +11 -0
  148. package/dist/core/bug-report-upload.d.ts.map +1 -0
  149. package/dist/core/bug-report-upload.js +20 -0
  150. package/dist/core/bug-report-upload.js.map +1 -0
  151. package/dist/core/bug-report.d.ts +176 -0
  152. package/dist/core/bug-report.d.ts.map +1 -0
  153. package/dist/core/bug-report.js +292 -0
  154. package/dist/core/bug-report.js.map +1 -0
  155. package/dist/core/builtins/duet.js +2 -2
  156. package/dist/core/builtins/duet.js.map +1 -1
  157. package/dist/core/cache-stats.d.ts.map +1 -1
  158. package/dist/core/cache-stats.js +12 -1
  159. package/dist/core/cache-stats.js.map +1 -1
  160. package/dist/core/cache-warmer.d.ts +103 -0
  161. package/dist/core/cache-warmer.d.ts.map +1 -0
  162. package/dist/core/cache-warmer.js +356 -0
  163. package/dist/core/cache-warmer.js.map +1 -0
  164. package/dist/core/checkpoints/checkpoint-manager.d.ts +8 -4
  165. package/dist/core/checkpoints/checkpoint-manager.d.ts.map +1 -1
  166. package/dist/core/checkpoints/checkpoint-manager.js +46 -10
  167. package/dist/core/checkpoints/checkpoint-manager.js.map +1 -1
  168. package/dist/core/checkpoints/rewind.d.ts +4 -2
  169. package/dist/core/checkpoints/rewind.d.ts.map +1 -1
  170. package/dist/core/checkpoints/rewind.js +4 -3
  171. package/dist/core/checkpoints/rewind.js.map +1 -1
  172. package/dist/core/compaction/branch-summarization.js +2 -2
  173. package/dist/core/compaction/branch-summarization.js.map +1 -1
  174. package/dist/core/compaction/compaction.d.ts +9 -6
  175. package/dist/core/compaction/compaction.d.ts.map +1 -1
  176. package/dist/core/compaction/compaction.js +196 -118
  177. package/dist/core/compaction/compaction.js.map +1 -1
  178. package/dist/core/compaction/utils.d.ts +2 -1
  179. package/dist/core/compaction/utils.d.ts.map +1 -1
  180. package/dist/core/compaction/utils.js +25 -18
  181. package/dist/core/compaction/utils.js.map +1 -1
  182. package/dist/core/context-windows.d.ts.map +1 -1
  183. package/dist/core/context-windows.js +13 -3
  184. package/dist/core/context-windows.js.map +1 -1
  185. package/dist/core/crash-log.d.ts +27 -0
  186. package/dist/core/crash-log.d.ts.map +1 -0
  187. package/dist/core/crash-log.js +140 -0
  188. package/dist/core/crash-log.js.map +1 -0
  189. package/dist/core/defaults.d.ts +1 -0
  190. package/dist/core/defaults.d.ts.map +1 -1
  191. package/dist/core/defaults.js +9 -0
  192. package/dist/core/defaults.js.map +1 -1
  193. package/dist/core/experimental.js +1 -1
  194. package/dist/core/experimental.js.map +1 -1
  195. package/dist/core/export-html/template.css +10 -0
  196. package/dist/core/export-html/template.js +72 -18
  197. package/dist/core/extensions/index.d.ts +2 -2
  198. package/dist/core/extensions/index.d.ts.map +1 -1
  199. package/dist/core/extensions/index.js +1 -1
  200. package/dist/core/extensions/index.js.map +1 -1
  201. package/dist/core/extensions/jiti-loader.d.ts +2 -0
  202. package/dist/core/extensions/jiti-loader.d.ts.map +1 -0
  203. package/dist/core/extensions/jiti-loader.js +5 -0
  204. package/dist/core/extensions/jiti-loader.js.map +1 -0
  205. package/dist/core/extensions/loader.d.ts.map +1 -1
  206. package/dist/core/extensions/loader.js +228 -89
  207. package/dist/core/extensions/loader.js.map +1 -1
  208. package/dist/core/extensions/runner.d.ts +47 -8
  209. package/dist/core/extensions/runner.d.ts.map +1 -1
  210. package/dist/core/extensions/runner.js +376 -104
  211. package/dist/core/extensions/runner.js.map +1 -1
  212. package/dist/core/extensions/types.d.ts +521 -88
  213. package/dist/core/extensions/types.d.ts.map +1 -1
  214. package/dist/core/extensions/types.js +3 -0
  215. package/dist/core/extensions/types.js.map +1 -1
  216. package/dist/core/extensions/virtual-modules.d.ts +3 -0
  217. package/dist/core/extensions/virtual-modules.d.ts.map +1 -0
  218. package/dist/core/extensions/virtual-modules.js +37 -0
  219. package/dist/core/extensions/virtual-modules.js.map +1 -0
  220. package/dist/core/extensions/wrapper.d.ts +2 -2
  221. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  222. package/dist/core/extensions/wrapper.js +3 -22
  223. package/dist/core/extensions/wrapper.js.map +1 -1
  224. package/dist/core/footer-data-provider.d.ts +1 -1
  225. package/dist/core/footer-data-provider.js +19 -18
  226. package/dist/core/footer-data-provider.js.map +1 -1
  227. package/dist/core/index.d.ts +2 -1
  228. package/dist/core/index.d.ts.map +1 -1
  229. package/dist/core/index.js.map +1 -1
  230. package/dist/core/keybindings.d.ts +83 -13
  231. package/dist/core/keybindings.d.ts.map +1 -1
  232. package/dist/core/keybindings.js +33 -7
  233. package/dist/core/keybindings.js.map +1 -1
  234. package/dist/core/mcp-servers.d.ts +119 -0
  235. package/dist/core/mcp-servers.d.ts.map +1 -0
  236. package/dist/core/mcp-servers.js +191 -0
  237. package/dist/core/mcp-servers.js.map +1 -0
  238. package/dist/core/messages.d.ts +1 -1
  239. package/dist/core/messages.d.ts.map +1 -1
  240. package/dist/core/messages.js +1 -0
  241. package/dist/core/messages.js.map +1 -1
  242. package/dist/core/model-config.d.ts +202 -20
  243. package/dist/core/model-config.d.ts.map +1 -1
  244. package/dist/core/model-config.js +53 -18
  245. package/dist/core/model-config.js.map +1 -1
  246. package/dist/core/model-registry.d.ts +19 -2
  247. package/dist/core/model-registry.d.ts.map +1 -1
  248. package/dist/core/model-registry.js +39 -2
  249. package/dist/core/model-registry.js.map +1 -1
  250. package/dist/core/model-resolver.d.ts +7 -5
  251. package/dist/core/model-resolver.d.ts.map +1 -1
  252. package/dist/core/model-resolver.js +29 -17
  253. package/dist/core/model-resolver.js.map +1 -1
  254. package/dist/core/model-runtime.d.ts +79 -20
  255. package/dist/core/model-runtime.d.ts.map +1 -1
  256. package/dist/core/model-runtime.js +460 -134
  257. package/dist/core/model-runtime.js.map +1 -1
  258. package/dist/core/models-store.d.ts +12 -7
  259. package/dist/core/models-store.d.ts.map +1 -1
  260. package/dist/core/models-store.js +87 -18
  261. package/dist/core/models-store.js.map +1 -1
  262. package/dist/core/multi-agent/fsm.js +8 -3
  263. package/dist/core/multi-agent/fsm.js.map +1 -1
  264. package/dist/core/multi-agent/mailbox.js +1 -3
  265. package/dist/core/multi-agent/mailbox.js.map +1 -1
  266. package/dist/core/multi-agent/permission-gate.d.ts +5 -2
  267. package/dist/core/multi-agent/permission-gate.d.ts.map +1 -1
  268. package/dist/core/multi-agent/permission-gate.js +597 -34
  269. package/dist/core/multi-agent/permission-gate.js.map +1 -1
  270. package/dist/core/multi-agent/task-board.js +2 -4
  271. package/dist/core/multi-agent/task-board.js.map +1 -1
  272. package/dist/core/multi-agent/worktree.js +1 -3
  273. package/dist/core/multi-agent/worktree.js.map +1 -1
  274. package/dist/core/nested-tool-calls.d.ts +102 -0
  275. package/dist/core/nested-tool-calls.d.ts.map +1 -0
  276. package/dist/core/nested-tool-calls.js +178 -0
  277. package/dist/core/nested-tool-calls.js.map +1 -0
  278. package/dist/core/package-manager.d.ts +10 -0
  279. package/dist/core/package-manager.d.ts.map +1 -1
  280. package/dist/core/package-manager.js +149 -33
  281. package/dist/core/package-manager.js.map +1 -1
  282. package/dist/core/pi-manifest.d.ts.map +1 -1
  283. package/dist/core/pi-manifest.js +13 -12
  284. package/dist/core/pi-manifest.js.map +1 -1
  285. package/dist/core/prompt-templates.d.ts +6 -1
  286. package/dist/core/prompt-templates.d.ts.map +1 -1
  287. package/dist/core/prompt-templates.js +63 -37
  288. package/dist/core/prompt-templates.js.map +1 -1
  289. package/dist/core/provider-attribution.js +5 -5
  290. package/dist/core/provider-attribution.js.map +1 -1
  291. package/dist/core/provider-composer.d.ts +44 -20
  292. package/dist/core/provider-composer.d.ts.map +1 -1
  293. package/dist/core/provider-composer.js +151 -51
  294. package/dist/core/provider-composer.js.map +1 -1
  295. package/dist/core/radius.d.ts +13 -0
  296. package/dist/core/radius.d.ts.map +1 -1
  297. package/dist/core/radius.js +19 -0
  298. package/dist/core/radius.js.map +1 -1
  299. package/dist/core/remote-catalog-provider.d.ts +10 -3
  300. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  301. package/dist/core/remote-catalog-provider.js +105 -81
  302. package/dist/core/remote-catalog-provider.js.map +1 -1
  303. package/dist/core/resource-loader.d.ts +7 -1
  304. package/dist/core/resource-loader.d.ts.map +1 -1
  305. package/dist/core/resource-loader.js +219 -42
  306. package/dist/core/resource-loader.js.map +1 -1
  307. package/dist/core/runtime-credentials.d.ts +5 -5
  308. package/dist/core/runtime-credentials.d.ts.map +1 -1
  309. package/dist/core/runtime-credentials.js +13 -9
  310. package/dist/core/runtime-credentials.js.map +1 -1
  311. package/dist/core/sandbox/executor.js +1 -0
  312. package/dist/core/sandbox/executor.js.map +1 -1
  313. package/dist/core/sdk.d.ts +7 -5
  314. package/dist/core/sdk.d.ts.map +1 -1
  315. package/dist/core/sdk.js +100 -52
  316. package/dist/core/sdk.js.map +1 -1
  317. package/dist/core/session-cwd.js +1 -0
  318. package/dist/core/session-cwd.js.map +1 -1
  319. package/dist/core/session-export.d.ts +8 -0
  320. package/dist/core/session-export.d.ts.map +1 -0
  321. package/dist/core/session-export.js +33 -0
  322. package/dist/core/session-export.js.map +1 -0
  323. package/dist/core/session-manager.d.ts +75 -15
  324. package/dist/core/session-manager.d.ts.map +1 -1
  325. package/dist/core/session-manager.js +314 -144
  326. package/dist/core/session-manager.js.map +1 -1
  327. package/dist/core/settings-diagnostics.d.ts +9 -0
  328. package/dist/core/settings-diagnostics.d.ts.map +1 -0
  329. package/dist/core/settings-diagnostics.js +21 -0
  330. package/dist/core/settings-diagnostics.js.map +1 -0
  331. package/dist/core/settings-manager.d.ts +84 -4
  332. package/dist/core/settings-manager.d.ts.map +1 -1
  333. package/dist/core/settings-manager.js +239 -25
  334. package/dist/core/settings-manager.js.map +1 -1
  335. package/dist/core/skills.d.ts.map +1 -1
  336. package/dist/core/skills.js +51 -33
  337. package/dist/core/skills.js.map +1 -1
  338. package/dist/core/slash-commands.d.ts.map +1 -1
  339. package/dist/core/slash-commands.js +3 -1
  340. package/dist/core/slash-commands.js.map +1 -1
  341. package/dist/core/soak/soak-log.js +6 -0
  342. package/dist/core/soak/soak-log.js.map +1 -1
  343. package/dist/core/socket-server/socket-server.js +11 -0
  344. package/dist/core/socket-server/socket-server.js.map +1 -1
  345. package/dist/core/socket-server/types.d.ts +2 -1
  346. package/dist/core/socket-server/types.d.ts.map +1 -1
  347. package/dist/core/socket-server/types.js.map +1 -1
  348. package/dist/core/source-info.d.ts +8 -0
  349. package/dist/core/source-info.d.ts.map +1 -1
  350. package/dist/core/source-info.js +16 -0
  351. package/dist/core/source-info.js.map +1 -1
  352. package/dist/core/system-prompt.d.ts +49 -6
  353. package/dist/core/system-prompt.d.ts.map +1 -1
  354. package/dist/core/system-prompt.js +126 -89
  355. package/dist/core/system-prompt.js.map +1 -1
  356. package/dist/core/tools/bash.d.ts +32 -2
  357. package/dist/core/tools/bash.d.ts.map +1 -1
  358. package/dist/core/tools/bash.js +82 -143
  359. package/dist/core/tools/bash.js.map +1 -1
  360. package/dist/core/tools/edit-diff.d.ts +0 -5
  361. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  362. package/dist/core/tools/edit-diff.js +2 -5
  363. package/dist/core/tools/edit-diff.js.map +1 -1
  364. package/dist/core/tools/edit.d.ts +5 -12
  365. package/dist/core/tools/edit.d.ts.map +1 -1
  366. package/dist/core/tools/edit.js +19 -171
  367. package/dist/core/tools/edit.js.map +1 -1
  368. package/dist/core/tools/find.d.ts +4 -0
  369. package/dist/core/tools/find.d.ts.map +1 -1
  370. package/dist/core/tools/find.js +11 -58
  371. package/dist/core/tools/find.js.map +1 -1
  372. package/dist/core/tools/grep.d.ts +4 -0
  373. package/dist/core/tools/grep.d.ts.map +1 -1
  374. package/dist/core/tools/grep.js +10 -62
  375. package/dist/core/tools/grep.js.map +1 -1
  376. package/dist/core/tools/index.d.ts +4 -1
  377. package/dist/core/tools/index.d.ts.map +1 -1
  378. package/dist/core/tools/index.js +18 -1
  379. package/dist/core/tools/index.js.map +1 -1
  380. package/dist/core/tools/ls.d.ts +4 -0
  381. package/dist/core/tools/ls.d.ts.map +1 -1
  382. package/dist/core/tools/ls.js +9 -50
  383. package/dist/core/tools/ls.js.map +1 -1
  384. package/dist/core/tools/output-accumulator.d.ts +11 -0
  385. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  386. package/dist/core/tools/output-accumulator.js +54 -12
  387. package/dist/core/tools/output-accumulator.js.map +1 -1
  388. package/dist/core/tools/powershell.d.ts +16 -0
  389. package/dist/core/tools/powershell.d.ts.map +1 -0
  390. package/dist/core/tools/powershell.js +39 -0
  391. package/dist/core/tools/powershell.js.map +1 -0
  392. package/dist/core/tools/read.d.ts +8 -1
  393. package/dist/core/tools/read.d.ts.map +1 -1
  394. package/dist/core/tools/read.js +16 -123
  395. package/dist/core/tools/read.js.map +1 -1
  396. package/dist/core/tools/render-utils.d.ts +6 -0
  397. package/dist/core/tools/render-utils.d.ts.map +1 -1
  398. package/dist/core/tools/render-utils.js +26 -0
  399. package/dist/core/tools/render-utils.js.map +1 -1
  400. package/dist/core/tools/renderers/bash.d.ts +12 -0
  401. package/dist/core/tools/renderers/bash.d.ts.map +1 -0
  402. package/dist/core/tools/renderers/bash.js +117 -0
  403. package/dist/core/tools/renderers/bash.js.map +1 -0
  404. package/dist/core/tools/renderers/edit.d.ts +23 -0
  405. package/dist/core/tools/renderers/edit.d.ts.map +1 -0
  406. package/dist/core/tools/renderers/edit.js +167 -0
  407. package/dist/core/tools/renderers/edit.js.map +1 -0
  408. package/dist/core/tools/renderers/find.d.ts +10 -0
  409. package/dist/core/tools/renderers/find.d.ts.map +1 -0
  410. package/dist/core/tools/renderers/find.js +64 -0
  411. package/dist/core/tools/renderers/find.js.map +1 -0
  412. package/dist/core/tools/renderers/grep.d.ts +10 -0
  413. package/dist/core/tools/renderers/grep.d.ts.map +1 -0
  414. package/dist/core/tools/renderers/grep.js +69 -0
  415. package/dist/core/tools/renderers/grep.js.map +1 -0
  416. package/dist/core/tools/renderers/index.d.ts +28 -0
  417. package/dist/core/tools/renderers/index.d.ts.map +1 -0
  418. package/dist/core/tools/renderers/index.js +47 -0
  419. package/dist/core/tools/renderers/index.js.map +1 -0
  420. package/dist/core/tools/renderers/ls.d.ts +10 -0
  421. package/dist/core/tools/renderers/ls.d.ts.map +1 -0
  422. package/dist/core/tools/renderers/ls.js +58 -0
  423. package/dist/core/tools/renderers/ls.js.map +1 -0
  424. package/dist/core/tools/renderers/read.d.ts +11 -0
  425. package/dist/core/tools/renderers/read.d.ts.map +1 -0
  426. package/dist/core/tools/renderers/read.js +130 -0
  427. package/dist/core/tools/renderers/read.js.map +1 -0
  428. package/dist/core/tools/renderers/write.d.ts +10 -0
  429. package/dist/core/tools/renderers/write.d.ts.map +1 -0
  430. package/dist/core/tools/renderers/write.js +153 -0
  431. package/dist/core/tools/renderers/write.js.map +1 -0
  432. package/dist/core/tools/tool-definition-wrapper.d.ts +5 -3
  433. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  434. package/dist/core/tools/tool-definition-wrapper.js +3 -1
  435. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  436. package/dist/core/tools/truncate.d.ts +14 -0
  437. package/dist/core/tools/truncate.d.ts.map +1 -1
  438. package/dist/core/tools/truncate.js +29 -0
  439. package/dist/core/tools/truncate.js.map +1 -1
  440. package/dist/core/tools/write.d.ts +4 -0
  441. package/dist/core/tools/write.d.ts.map +1 -1
  442. package/dist/core/tools/write.js +12 -147
  443. package/dist/core/tools/write.js.map +1 -1
  444. package/dist/core/trust-manager.d.ts.map +1 -1
  445. package/dist/core/trust-manager.js +4 -1
  446. package/dist/core/trust-manager.js.map +1 -1
  447. package/dist/core/usage-totals.d.ts +3 -1
  448. package/dist/core/usage-totals.d.ts.map +1 -1
  449. package/dist/core/usage-totals.js +28 -1
  450. package/dist/core/usage-totals.js.map +1 -1
  451. package/dist/core/virtual-models.d.ts +117 -0
  452. package/dist/core/virtual-models.d.ts.map +1 -0
  453. package/dist/core/virtual-models.js +124 -0
  454. package/dist/core/virtual-models.js.map +1 -0
  455. package/dist/experimental/micro/api.d.ts +81 -0
  456. package/dist/experimental/micro/api.d.ts.map +1 -0
  457. package/dist/experimental/micro/api.js +2 -0
  458. package/dist/experimental/micro/api.js.map +1 -0
  459. package/dist/experimental/micro/main.d.ts +3 -0
  460. package/dist/experimental/micro/main.d.ts.map +1 -0
  461. package/dist/experimental/micro/main.js +21 -0
  462. package/dist/experimental/micro/main.js.map +1 -0
  463. package/dist/experimental/micro/models.d.ts +11 -0
  464. package/dist/experimental/micro/models.d.ts.map +1 -0
  465. package/dist/experimental/micro/models.js +95 -0
  466. package/dist/experimental/micro/models.js.map +1 -0
  467. package/dist/experimental/micro/runtime.d.ts +12 -0
  468. package/dist/experimental/micro/runtime.d.ts.map +1 -0
  469. package/dist/experimental/micro/runtime.js +465 -0
  470. package/dist/experimental/micro/runtime.js.map +1 -0
  471. package/dist/experimental/micro/sessions.d.ts +10 -0
  472. package/dist/experimental/micro/sessions.d.ts.map +1 -0
  473. package/dist/experimental/micro/sessions.js +41 -0
  474. package/dist/experimental/micro/sessions.js.map +1 -0
  475. package/dist/experimental/micro/tools.d.ts +10 -0
  476. package/dist/experimental/micro/tools.d.ts.map +1 -0
  477. package/dist/experimental/micro/tools.js +96 -0
  478. package/dist/experimental/micro/tools.js.map +1 -0
  479. package/dist/experimental/micro/tui.d.ts +3 -0
  480. package/dist/experimental/micro/tui.d.ts.map +1 -0
  481. package/dist/experimental/micro/tui.js +510 -0
  482. package/dist/experimental/micro/tui.js.map +1 -0
  483. package/dist/experimental/mini/main.d.ts +7 -0
  484. package/dist/experimental/mini/main.d.ts.map +1 -0
  485. package/dist/experimental/mini/main.js +21 -0
  486. package/dist/experimental/mini/main.js.map +1 -0
  487. package/dist/experimental/mini/server/entry.d.ts +3 -0
  488. package/dist/experimental/mini/server/entry.d.ts.map +1 -0
  489. package/dist/experimental/mini/server/entry.js +11 -0
  490. package/dist/experimental/mini/server/entry.js.map +1 -0
  491. package/dist/experimental/mini/server/run.d.ts +13 -0
  492. package/dist/experimental/mini/server/run.d.ts.map +1 -0
  493. package/dist/experimental/mini/server/run.js +150 -0
  494. package/dist/experimental/mini/server/run.js.map +1 -0
  495. package/dist/experimental/mini/shared/protocol.d.ts +127 -0
  496. package/dist/experimental/mini/shared/protocol.d.ts.map +1 -0
  497. package/dist/experimental/mini/shared/protocol.js +13 -0
  498. package/dist/experimental/mini/shared/protocol.js.map +1 -0
  499. package/dist/experimental/mini/shared/rpc.d.ts +49 -0
  500. package/dist/experimental/mini/shared/rpc.d.ts.map +1 -0
  501. package/dist/experimental/mini/shared/rpc.js +171 -0
  502. package/dist/experimental/mini/shared/rpc.js.map +1 -0
  503. package/dist/experimental/mini/shared/transport.d.ts +35 -0
  504. package/dist/experimental/mini/shared/transport.d.ts.map +1 -0
  505. package/dist/experimental/mini/shared/transport.js +94 -0
  506. package/dist/experimental/mini/shared/transport.js.map +1 -0
  507. package/dist/experimental/mini/tui/run.d.ts +9 -0
  508. package/dist/experimental/mini/tui/run.d.ts.map +1 -0
  509. package/dist/experimental/mini/tui/run.js +62 -0
  510. package/dist/experimental/mini/tui/run.js.map +1 -0
  511. package/dist/experimental/mini/tui/session.d.ts +26 -0
  512. package/dist/experimental/mini/tui/session.d.ts.map +1 -0
  513. package/dist/experimental/mini/tui/session.js +94 -0
  514. package/dist/experimental/mini/tui/session.js.map +1 -0
  515. package/dist/experimental/mini/tui/view.d.ts +10 -0
  516. package/dist/experimental/mini/tui/view.d.ts.map +1 -0
  517. package/dist/experimental/mini/tui/view.js +461 -0
  518. package/dist/experimental/mini/tui/view.js.map +1 -0
  519. package/dist/experimental/mini/worker/entry.d.ts +3 -0
  520. package/dist/experimental/mini/worker/entry.d.ts.map +1 -0
  521. package/dist/experimental/mini/worker/entry.js +10 -0
  522. package/dist/experimental/mini/worker/entry.js.map +1 -0
  523. package/dist/experimental/mini/worker/lane-service.d.ts +44 -0
  524. package/dist/experimental/mini/worker/lane-service.d.ts.map +1 -0
  525. package/dist/experimental/mini/worker/lane-service.js +97 -0
  526. package/dist/experimental/mini/worker/lane-service.js.map +1 -0
  527. package/dist/experimental/mini/worker/models-service.d.ts +19 -0
  528. package/dist/experimental/mini/worker/models-service.d.ts.map +1 -0
  529. package/dist/experimental/mini/worker/models-service.js +136 -0
  530. package/dist/experimental/mini/worker/models-service.js.map +1 -0
  531. package/dist/experimental/mini/worker/run.d.ts +14 -0
  532. package/dist/experimental/mini/worker/run.d.ts.map +1 -0
  533. package/dist/experimental/mini/worker/run.js +88 -0
  534. package/dist/experimental/mini/worker/run.js.map +1 -0
  535. package/dist/extensions/codemode/execute.d.ts +16 -0
  536. package/dist/extensions/codemode/execute.d.ts.map +1 -0
  537. package/dist/extensions/codemode/execute.js +429 -0
  538. package/dist/extensions/codemode/execute.js.map +1 -0
  539. package/dist/extensions/codemode/execute.lazy.d.ts +3 -0
  540. package/dist/extensions/codemode/execute.lazy.d.ts.map +1 -0
  541. package/dist/extensions/codemode/execute.lazy.js +3 -0
  542. package/dist/extensions/codemode/execute.lazy.js.map +1 -0
  543. package/dist/extensions/codemode/index.d.ts +21 -0
  544. package/dist/extensions/codemode/index.d.ts.map +1 -0
  545. package/dist/extensions/codemode/index.js +31 -0
  546. package/dist/extensions/codemode/index.js.map +1 -0
  547. package/dist/extensions/codemode/renderer.d.ts +12 -0
  548. package/dist/extensions/codemode/renderer.d.ts.map +1 -0
  549. package/dist/extensions/codemode/renderer.js +137 -0
  550. package/dist/extensions/codemode/renderer.js.map +1 -0
  551. package/dist/extensions/codemode/tool.d.ts +123 -0
  552. package/dist/extensions/codemode/tool.d.ts.map +1 -0
  553. package/dist/extensions/codemode/tool.js +315 -0
  554. package/dist/extensions/codemode/tool.js.map +1 -0
  555. package/dist/extensions/codemode/worker.d.ts +7 -0
  556. package/dist/extensions/codemode/worker.d.ts.map +1 -0
  557. package/dist/extensions/codemode/worker.js +7 -0
  558. package/dist/extensions/codemode/worker.js.map +1 -0
  559. package/dist/extensions/index.d.ts.map +1 -1
  560. package/dist/extensions/index.js +9 -1
  561. package/dist/extensions/index.js.map +1 -1
  562. package/dist/extensions/llama/client.d.ts +8 -0
  563. package/dist/extensions/llama/client.d.ts.map +1 -1
  564. package/dist/extensions/llama/client.js +13 -0
  565. package/dist/extensions/llama/client.js.map +1 -1
  566. package/dist/extensions/llama/huggingface.js +2 -0
  567. package/dist/extensions/llama/huggingface.js.map +1 -1
  568. package/dist/extensions/llama/index.d.ts.map +1 -1
  569. package/dist/extensions/llama/index.js +13 -2
  570. package/dist/extensions/llama/index.js.map +1 -1
  571. package/dist/extensions/llama/provider.d.ts +4 -2
  572. package/dist/extensions/llama/provider.d.ts.map +1 -1
  573. package/dist/extensions/llama/provider.js +119 -17
  574. package/dist/extensions/llama/provider.js.map +1 -1
  575. package/dist/extensions/llama/ui.js +28 -12
  576. package/dist/extensions/llama/ui.js.map +1 -1
  577. package/dist/extensions/mcp/cli.d.ts +21 -0
  578. package/dist/extensions/mcp/cli.d.ts.map +1 -0
  579. package/dist/extensions/mcp/cli.js +500 -0
  580. package/dist/extensions/mcp/cli.js.map +1 -0
  581. package/dist/extensions/mcp/cli.lazy.d.ts +3 -0
  582. package/dist/extensions/mcp/cli.lazy.d.ts.map +1 -0
  583. package/dist/extensions/mcp/cli.lazy.js +3 -0
  584. package/dist/extensions/mcp/cli.lazy.js.map +1 -0
  585. package/dist/extensions/mcp/config.d.ts +72 -0
  586. package/dist/extensions/mcp/config.d.ts.map +1 -0
  587. package/dist/extensions/mcp/config.js +158 -0
  588. package/dist/extensions/mcp/config.js.map +1 -0
  589. package/dist/extensions/mcp/index.d.ts +76 -0
  590. package/dist/extensions/mcp/index.d.ts.map +1 -0
  591. package/dist/extensions/mcp/index.js +1055 -0
  592. package/dist/extensions/mcp/index.js.map +1 -0
  593. package/dist/extensions/mcp/log.d.ts +16 -0
  594. package/dist/extensions/mcp/log.d.ts.map +1 -0
  595. package/dist/extensions/mcp/log.js +66 -0
  596. package/dist/extensions/mcp/log.js.map +1 -0
  597. package/dist/extensions/mcp/oauth.d.ts +96 -0
  598. package/dist/extensions/mcp/oauth.d.ts.map +1 -0
  599. package/dist/extensions/mcp/oauth.js +333 -0
  600. package/dist/extensions/mcp/oauth.js.map +1 -0
  601. package/dist/extensions/mcp/resources.d.ts +43 -0
  602. package/dist/extensions/mcp/resources.d.ts.map +1 -0
  603. package/dist/extensions/mcp/resources.js +262 -0
  604. package/dist/extensions/mcp/resources.js.map +1 -0
  605. package/dist/extensions/mcp/runtime.d.ts +98 -0
  606. package/dist/extensions/mcp/runtime.d.ts.map +1 -0
  607. package/dist/extensions/mcp/runtime.js +394 -0
  608. package/dist/extensions/mcp/runtime.js.map +1 -0
  609. package/dist/extensions/mcp/runtime.lazy.d.ts +3 -0
  610. package/dist/extensions/mcp/runtime.lazy.d.ts.map +1 -0
  611. package/dist/extensions/mcp/runtime.lazy.js +3 -0
  612. package/dist/extensions/mcp/runtime.lazy.js.map +1 -0
  613. package/dist/extensions/mcp/tools.d.ts +84 -0
  614. package/dist/extensions/mcp/tools.d.ts.map +1 -0
  615. package/dist/extensions/mcp/tools.js +251 -0
  616. package/dist/extensions/mcp/tools.js.map +1 -0
  617. package/dist/extensions/mcp/ui.d.ts +60 -0
  618. package/dist/extensions/mcp/ui.d.ts.map +1 -0
  619. package/dist/extensions/mcp/ui.js +174 -0
  620. package/dist/extensions/mcp/ui.js.map +1 -0
  621. package/dist/extensions/stub-provider/provider.d.ts +2 -2
  622. package/dist/extensions/stub-provider/provider.d.ts.map +1 -1
  623. package/dist/extensions/stub-provider/provider.js +2 -1
  624. package/dist/extensions/stub-provider/provider.js.map +1 -1
  625. package/dist/extensions/tool-search/index.d.ts +12 -0
  626. package/dist/extensions/tool-search/index.d.ts.map +1 -0
  627. package/dist/extensions/tool-search/index.js +15 -0
  628. package/dist/extensions/tool-search/index.js.map +1 -0
  629. package/dist/extensions/tool-search/tool.d.ts +73 -0
  630. package/dist/extensions/tool-search/tool.d.ts.map +1 -0
  631. package/dist/extensions/tool-search/tool.js +189 -0
  632. package/dist/extensions/tool-search/tool.js.map +1 -0
  633. package/dist/index.d.ts +20 -11
  634. package/dist/index.d.ts.map +1 -1
  635. package/dist/index.js +12 -6
  636. package/dist/index.js.map +1 -1
  637. package/dist/main.d.ts +4 -0
  638. package/dist/main.d.ts.map +1 -1
  639. package/dist/main.js +123 -51
  640. package/dist/main.js.map +1 -1
  641. package/dist/migrations.d.ts +1 -1
  642. package/dist/migrations.js +7 -6
  643. package/dist/migrations.js.map +1 -1
  644. package/dist/modes/index.d.ts +1 -0
  645. package/dist/modes/index.d.ts.map +1 -1
  646. package/dist/modes/index.js.map +1 -1
  647. package/dist/modes/interactive/bug-report.d.ts +19 -0
  648. package/dist/modes/interactive/bug-report.d.ts.map +1 -0
  649. package/dist/modes/interactive/bug-report.js +211 -0
  650. package/dist/modes/interactive/bug-report.js.map +1 -0
  651. package/dist/modes/interactive/chat-viewport.d.ts +20 -0
  652. package/dist/modes/interactive/chat-viewport.d.ts.map +1 -0
  653. package/dist/modes/interactive/chat-viewport.js +28 -0
  654. package/dist/modes/interactive/chat-viewport.js.map +1 -0
  655. package/dist/modes/interactive/components/armin.js +10 -6
  656. package/dist/modes/interactive/components/armin.js.map +1 -1
  657. package/dist/modes/interactive/components/assistant-message.d.ts +6 -2
  658. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  659. package/dist/modes/interactive/components/assistant-message.js +38 -15
  660. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  661. package/dist/modes/interactive/components/bash-execution.js +9 -4
  662. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  663. package/dist/modes/interactive/components/bordered-loader.js +3 -0
  664. package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
  665. package/dist/modes/interactive/components/branch-summary-message.d.ts +1 -1
  666. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  667. package/dist/modes/interactive/components/branch-summary-message.js +15 -6
  668. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  669. package/dist/modes/interactive/components/compaction-summary-message.d.ts +1 -1
  670. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  671. package/dist/modes/interactive/components/compaction-summary-message.js +15 -6
  672. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  673. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  674. package/dist/modes/interactive/components/config-selector.js +35 -8
  675. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  676. package/dist/modes/interactive/components/countdown-timer.js +5 -0
  677. package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
  678. package/dist/modes/interactive/components/custom-editor.d.ts +10 -1
  679. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  680. package/dist/modes/interactive/components/custom-editor.js +54 -2
  681. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  682. package/dist/modes/interactive/components/custom-entry.js +4 -1
  683. package/dist/modes/interactive/components/custom-entry.js.map +1 -1
  684. package/dist/modes/interactive/components/custom-message.js +7 -1
  685. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  686. package/dist/modes/interactive/components/daxnuts.js +8 -6
  687. package/dist/modes/interactive/components/daxnuts.js.map +1 -1
  688. package/dist/modes/interactive/components/dynamic-border.js +1 -0
  689. package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
  690. package/dist/modes/interactive/components/extension-editor.d.ts +4 -1
  691. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  692. package/dist/modes/interactive/components/extension-editor.js +14 -3
  693. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  694. package/dist/modes/interactive/components/extension-input.d.ts +2 -0
  695. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  696. package/dist/modes/interactive/components/extension-input.js +14 -2
  697. package/dist/modes/interactive/components/extension-input.js.map +1 -1
  698. package/dist/modes/interactive/components/extension-selector.d.ts +1 -0
  699. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  700. package/dist/modes/interactive/components/extension-selector.js +16 -1
  701. package/dist/modes/interactive/components/extension-selector.js.map +1 -1
  702. package/dist/modes/interactive/components/first-time-setup.d.ts +4 -4
  703. package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
  704. package/dist/modes/interactive/components/first-time-setup.js +12 -4
  705. package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
  706. package/dist/modes/interactive/components/footer.d.ts +7 -0
  707. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  708. package/dist/modes/interactive/components/footer.js +51 -6
  709. package/dist/modes/interactive/components/footer.js.map +1 -1
  710. package/dist/modes/interactive/components/index.d.ts +1 -1
  711. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  712. package/dist/modes/interactive/components/index.js.map +1 -1
  713. package/dist/modes/interactive/components/login-dialog.js +9 -3
  714. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  715. package/dist/modes/interactive/components/markdown-transform.d.ts +3 -0
  716. package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -0
  717. package/dist/modes/interactive/components/markdown-transform.js +19 -0
  718. package/dist/modes/interactive/components/markdown-transform.js.map +1 -0
  719. package/dist/modes/interactive/components/mermaid.d.ts +11 -0
  720. package/dist/modes/interactive/components/mermaid.d.ts.map +1 -0
  721. package/dist/modes/interactive/components/mermaid.js +75 -0
  722. package/dist/modes/interactive/components/mermaid.js.map +1 -0
  723. package/dist/modes/interactive/components/model-selector.d.ts +10 -4
  724. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  725. package/dist/modes/interactive/components/model-selector.js +101 -40
  726. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  727. package/dist/modes/interactive/components/oauth-selector.js +11 -3
  728. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  729. package/dist/modes/interactive/components/scoped-models-selector.d.ts +4 -0
  730. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  731. package/dist/modes/interactive/components/scoped-models-selector.js +60 -32
  732. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  733. package/dist/modes/interactive/components/session-selector.d.ts +5 -5
  734. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  735. package/dist/modes/interactive/components/session-selector.js +128 -78
  736. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  737. package/dist/modes/interactive/components/settings-selector.d.ts +23 -4
  738. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  739. package/dist/modes/interactive/components/settings-selector.js +230 -67
  740. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  741. package/dist/modes/interactive/components/settings-submenu.d.ts +72 -0
  742. package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -0
  743. package/dist/modes/interactive/components/settings-submenu.js +165 -0
  744. package/dist/modes/interactive/components/settings-submenu.js.map +1 -0
  745. package/dist/modes/interactive/components/show-images-selector.js +1 -0
  746. package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
  747. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  748. package/dist/modes/interactive/components/skill-invocation-message.js +14 -5
  749. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  750. package/dist/modes/interactive/components/status-indicator.d.ts +3 -1
  751. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
  752. package/dist/modes/interactive/components/status-indicator.js +12 -3
  753. package/dist/modes/interactive/components/status-indicator.js.map +1 -1
  754. package/dist/modes/interactive/components/theme-selector.js +2 -0
  755. package/dist/modes/interactive/components/theme-selector.js.map +1 -1
  756. package/dist/modes/interactive/components/themed-text.d.ts +17 -0
  757. package/dist/modes/interactive/components/themed-text.d.ts.map +1 -0
  758. package/dist/modes/interactive/components/themed-text.js +29 -0
  759. package/dist/modes/interactive/components/themed-text.js.map +1 -0
  760. package/dist/modes/interactive/components/thinking-selector.d.ts +15 -3
  761. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  762. package/dist/modes/interactive/components/thinking-selector.js +76 -18
  763. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  764. package/dist/modes/interactive/components/tool-execution.d.ts +21 -4
  765. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  766. package/dist/modes/interactive/components/tool-execution.js +78 -52
  767. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  768. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  769. package/dist/modes/interactive/components/tree-selector.js +44 -18
  770. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  771. package/dist/modes/interactive/components/trust-selector.js +8 -2
  772. package/dist/modes/interactive/components/trust-selector.js.map +1 -1
  773. package/dist/modes/interactive/components/user-message-selector.js +6 -3
  774. package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  775. package/dist/modes/interactive/components/user-message.d.ts +3 -1
  776. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  777. package/dist/modes/interactive/components/user-message.js +12 -2
  778. package/dist/modes/interactive/components/user-message.js.map +1 -1
  779. package/dist/modes/interactive/components/visual-truncate.d.ts +27 -3
  780. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
  781. package/dist/modes/interactive/components/visual-truncate.js +39 -6
  782. package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
  783. package/dist/modes/interactive/external-editor.d.ts.map +1 -1
  784. package/dist/modes/interactive/external-editor.js +2 -1
  785. package/dist/modes/interactive/external-editor.js.map +1 -1
  786. package/dist/modes/interactive/interactive-mode.d.ts +69 -5
  787. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  788. package/dist/modes/interactive/interactive-mode.js +1314 -593
  789. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  790. package/dist/modes/interactive/model-catalog-refresh.d.ts +7 -0
  791. package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -0
  792. package/dist/modes/interactive/model-catalog-refresh.js +34 -0
  793. package/dist/modes/interactive/model-catalog-refresh.js.map +1 -0
  794. package/dist/modes/interactive/session-share.d.ts +23 -0
  795. package/dist/modes/interactive/session-share.d.ts.map +1 -0
  796. package/dist/modes/interactive/session-share.js +130 -0
  797. package/dist/modes/interactive/session-share.js.map +1 -0
  798. package/dist/modes/interactive/theme/dark.json +54 -63
  799. package/dist/modes/interactive/theme/light.json +52 -60
  800. package/dist/modes/interactive/theme/system-theme.d.ts +54 -0
  801. package/dist/modes/interactive/theme/system-theme.d.ts.map +1 -0
  802. package/dist/modes/interactive/theme/system-theme.js +535 -0
  803. package/dist/modes/interactive/theme/system-theme.js.map +1 -0
  804. package/dist/modes/interactive/theme/theme-controller.d.ts +59 -7
  805. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
  806. package/dist/modes/interactive/theme/theme-controller.js +164 -51
  807. package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
  808. package/dist/modes/interactive/theme/theme-json.d.ts +85 -0
  809. package/dist/modes/interactive/theme/theme-json.d.ts.map +1 -0
  810. package/dist/modes/interactive/theme/theme-json.js +132 -0
  811. package/dist/modes/interactive/theme/theme-json.js.map +1 -0
  812. package/dist/modes/interactive/theme/theme-schema.json +24 -3
  813. package/dist/modes/interactive/theme/theme.d.ts +80 -42
  814. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  815. package/dist/modes/interactive/theme/theme.js +274 -417
  816. package/dist/modes/interactive/theme/theme.js.map +1 -1
  817. package/dist/modes/interactive/tui-renderer.d.ts +22 -0
  818. package/dist/modes/interactive/tui-renderer.d.ts.map +1 -0
  819. package/dist/modes/interactive/tui-renderer.js +67 -0
  820. package/dist/modes/interactive/tui-renderer.js.map +1 -0
  821. package/dist/modes/json-event.d.ts +34 -0
  822. package/dist/modes/json-event.d.ts.map +1 -0
  823. package/dist/modes/json-event.js +29 -0
  824. package/dist/modes/json-event.js.map +1 -0
  825. package/dist/modes/print-mode.d.ts +1 -1
  826. package/dist/modes/print-mode.d.ts.map +1 -1
  827. package/dist/modes/print-mode.js +12 -2
  828. package/dist/modes/print-mode.js.map +1 -1
  829. package/dist/modes/rpc/rpc-client.d.ts +17 -9
  830. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  831. package/dist/modes/rpc/rpc-client.js +27 -15
  832. package/dist/modes/rpc/rpc-client.js.map +1 -1
  833. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  834. package/dist/modes/rpc/rpc-mode.js +14 -12
  835. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  836. package/dist/modes/rpc/rpc-types.d.ts +22 -1
  837. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  838. package/dist/modes/rpc/rpc-types.js.map +1 -1
  839. package/dist/package-manager-cli.d.ts +1 -0
  840. package/dist/package-manager-cli.d.ts.map +1 -1
  841. package/dist/package-manager-cli.js +217 -63
  842. package/dist/package-manager-cli.js.map +1 -1
  843. package/dist/prompts/commands/plan-phase.md +1 -0
  844. package/dist/prompts/commands/review.md +2 -0
  845. package/dist/prompts/commands/verify-work.md +1 -0
  846. package/dist/prompts/commands/why.md +4 -0
  847. package/dist/rpc-entry.js +1 -0
  848. package/dist/rpc-entry.js.map +1 -1
  849. package/dist/skills/blast-radius/SKILL.md +1 -0
  850. package/dist/skills/explainers/SKILL.md +65 -0
  851. package/dist/skills/unslop/SKILL.md +19 -1
  852. package/dist/utils/abort.d.ts +5 -0
  853. package/dist/utils/abort.d.ts.map +1 -0
  854. package/dist/utils/abort.js +48 -0
  855. package/dist/utils/abort.js.map +1 -0
  856. package/dist/utils/changelog.js +1 -1
  857. package/dist/utils/changelog.js.map +1 -1
  858. package/dist/utils/child-process.d.ts +1 -1
  859. package/dist/utils/child-process.js +1 -1
  860. package/dist/utils/child-process.js.map +1 -1
  861. package/dist/utils/clipboard-command.d.ts +7 -0
  862. package/dist/utils/clipboard-command.d.ts.map +1 -0
  863. package/dist/utils/clipboard-command.js +45 -0
  864. package/dist/utils/clipboard-command.js.map +1 -0
  865. package/dist/utils/clipboard-image.d.ts.map +1 -1
  866. package/dist/utils/clipboard-image.js +60 -91
  867. package/dist/utils/clipboard-image.js.map +1 -1
  868. package/dist/utils/clipboard.d.ts +2 -0
  869. package/dist/utils/clipboard.d.ts.map +1 -1
  870. package/dist/utils/clipboard.js +116 -121
  871. package/dist/utils/clipboard.js.map +1 -1
  872. package/dist/utils/draht-user-agent.d.ts +2 -0
  873. package/dist/utils/draht-user-agent.d.ts.map +1 -0
  874. package/dist/utils/draht-user-agent.js +5 -0
  875. package/dist/utils/draht-user-agent.js.map +1 -0
  876. package/dist/utils/exif-orientation.d.ts +2 -1
  877. package/dist/utils/exif-orientation.d.ts.map +1 -1
  878. package/dist/utils/exif-orientation.js.map +1 -1
  879. package/dist/utils/frontmatter.d.ts.map +1 -1
  880. package/dist/utils/frontmatter.js +2 -1
  881. package/dist/utils/frontmatter.js.map +1 -1
  882. package/dist/utils/management-http.d.ts +25 -0
  883. package/dist/utils/management-http.d.ts.map +1 -0
  884. package/dist/utils/management-http.js +54 -0
  885. package/dist/utils/management-http.js.map +1 -0
  886. package/dist/utils/mime.js +1 -1
  887. package/dist/utils/mime.js.map +1 -1
  888. package/dist/utils/paths.d.ts +4 -3
  889. package/dist/utils/paths.d.ts.map +1 -1
  890. package/dist/utils/paths.js +15 -4
  891. package/dist/utils/paths.js.map +1 -1
  892. package/dist/utils/photon.d.ts +2 -1
  893. package/dist/utils/photon.d.ts.map +1 -1
  894. package/dist/utils/photon.js.map +1 -1
  895. package/dist/utils/shell.d.ts +4 -3
  896. package/dist/utils/shell.d.ts.map +1 -1
  897. package/dist/utils/shell.js +20 -35
  898. package/dist/utils/shell.js.map +1 -1
  899. package/dist/utils/syntax-highlight.d.ts +1 -0
  900. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  901. package/dist/utils/syntax-highlight.js +62 -1
  902. package/dist/utils/syntax-highlight.js.map +1 -1
  903. package/dist/utils/text.d.ts +8 -0
  904. package/dist/utils/text.d.ts.map +1 -0
  905. package/dist/utils/text.js +9 -0
  906. package/dist/utils/text.js.map +1 -0
  907. package/dist/utils/tool-result-images.d.ts +21 -0
  908. package/dist/utils/tool-result-images.d.ts.map +1 -0
  909. package/dist/utils/tool-result-images.js +48 -0
  910. package/dist/utils/tool-result-images.js.map +1 -0
  911. package/dist/utils/tools-manager.d.ts +11 -1
  912. package/dist/utils/tools-manager.d.ts.map +1 -1
  913. package/dist/utils/tools-manager.js +53 -36
  914. package/dist/utils/tools-manager.js.map +1 -1
  915. package/dist/utils/version-check.d.ts +4 -1
  916. package/dist/utils/version-check.d.ts.map +1 -1
  917. package/dist/utils/version-check.js +30 -9
  918. package/dist/utils/version-check.js.map +1 -1
  919. package/dist/utils/wsl.d.ts +3 -0
  920. package/dist/utils/wsl.d.ts.map +1 -0
  921. package/dist/utils/wsl.js +15 -0
  922. package/dist/utils/wsl.js.map +1 -0
  923. package/dist/utils/zip.d.ts +7 -0
  924. package/dist/utils/zip.d.ts.map +1 -0
  925. package/dist/utils/zip.js +60 -0
  926. package/dist/utils/zip.js.map +1 -0
  927. package/docs/cli-integration.md +106 -0
  928. package/docs/cli.md +374 -0
  929. package/docs/compaction.md +91 -29
  930. package/docs/configuration.md +47 -0
  931. package/docs/containerization.md +100 -66
  932. package/docs/custom-provider.md +109 -707
  933. package/docs/docs.json +155 -99
  934. package/docs/environment-variables.md +30 -17
  935. package/docs/extensions.md +169 -2811
  936. package/docs/how-pi-works.md +53 -0
  937. package/docs/images/interactive-mode.png +0 -0
  938. package/docs/index.md +25 -69
  939. package/docs/json.md +197 -56
  940. package/docs/keybindings.md +89 -93
  941. package/docs/llama-cpp.md +18 -3
  942. package/docs/mcp.md +231 -0
  943. package/docs/message-types.md +261 -0
  944. package/docs/models.md +94 -478
  945. package/docs/packages.md +67 -163
  946. package/docs/prompt-templates.md +31 -68
  947. package/docs/providers.md +118 -215
  948. package/docs/quickstart.md +55 -108
  949. package/docs/rpc-commands.md +860 -0
  950. package/docs/rpc-extension-ui.md +200 -0
  951. package/docs/rpc.md +139 -1518
  952. package/docs/sdk.md +79 -1127
  953. package/docs/security.md +76 -32
  954. package/docs/session-format.md +73 -219
  955. package/docs/sessions.md +36 -116
  956. package/docs/settings.md +124 -257
  957. package/docs/shell-aliases.md +85 -5
  958. package/docs/skills.md +52 -189
  959. package/docs/slash-commands.md +61 -0
  960. package/docs/terminal-setup.md +132 -61
  961. package/docs/termux.md +74 -84
  962. package/docs/themes.md +91 -252
  963. package/docs/tmux.md +31 -39
  964. package/docs/tui.md +74 -891
  965. package/docs/usage.md +54 -255
  966. package/docs/virtual-models.md +114 -0
  967. package/docs/windows.md +57 -7
  968. package/examples/extensions/antigravity-image-gen.ts +9 -9
  969. package/examples/extensions/bash-spawn-hook.ts +1 -1
  970. package/examples/extensions/border-status-editor.ts +1 -1
  971. package/examples/extensions/built-in-tool-renderer.ts +16 -40
  972. package/examples/extensions/custom-compaction.ts +1 -16
  973. package/examples/extensions/custom-provider-anthropic/index.ts +20 -13
  974. package/examples/extensions/custom-provider-gitlab-duo/index.ts +4 -3
  975. package/examples/extensions/custom-provider-gitlab-duo/test.ts +5 -5
  976. package/examples/extensions/debug-provider.ts +90 -0
  977. package/examples/extensions/doom-overlay/wad-finder.ts +7 -3
  978. package/examples/extensions/dynamic-resources/dynamic.json +3 -1
  979. package/examples/extensions/git-checkpoint.ts +2 -2
  980. package/examples/extensions/handoff.ts +2 -11
  981. package/examples/extensions/jev-router.ts +113 -0
  982. package/examples/extensions/minimal-mode.ts +24 -96
  983. package/examples/extensions/notify.ts +3 -1
  984. package/examples/extensions/prompt-customizer.ts +19 -67
  985. package/examples/extensions/qna.ts +3 -7
  986. package/examples/extensions/subagent/agents.ts +40 -9
  987. package/examples/extensions/subagent/index.ts +27 -4
  988. package/examples/extensions/summarize.ts +7 -18
  989. package/examples/extensions/titlebar-spinner.ts +1 -1
  990. package/examples/rpc-client.ts +35 -0
  991. package/examples/rpc-extension-ui.ts +38 -9
  992. package/examples/sdk/02-custom-model.ts +1 -2
  993. package/examples/sdk/06-extensions.ts +1 -1
  994. package/examples/sdk/09-api-keys-and-oauth.ts +1 -1
  995. package/examples/sdk/12-full-control.ts +1 -1
  996. package/examples/sdk/14-codemode-mcp.ts +61 -0
  997. package/package.json +25 -30
  998. package/prompts/commands/plan-phase.md +1 -0
  999. package/prompts/commands/review.md +2 -0
  1000. package/prompts/commands/verify-work.md +1 -0
  1001. package/prompts/commands/why.md +4 -0
  1002. package/skills/blast-radius/SKILL.md +1 -0
  1003. package/skills/explainers/SKILL.md +65 -0
  1004. package/skills/unslop/SKILL.md +19 -1
  1005. package/dist/utils/clipboard-native.d.ts +0 -11
  1006. package/dist/utils/clipboard-native.d.ts.map +0 -1
  1007. package/dist/utils/clipboard-native.js +0 -20
  1008. package/dist/utils/clipboard-native.js.map +0 -1
  1009. package/dist/utils/pi-user-agent.d.ts +0 -2
  1010. package/dist/utils/pi-user-agent.d.ts.map +0 -1
  1011. package/dist/utils/pi-user-agent.js +0 -5
  1012. package/dist/utils/pi-user-agent.js.map +0 -1
  1013. package/docs/development.md +0 -71
  1014. package/docs/tree.md +0 -231
  1015. package/examples/extensions/kimi-deferred-tools.ts +0 -61
package/docs/security.md CHANGED
@@ -1,55 +1,99 @@
1
- # Security
1
+ # Run draht safely
2
2
 
3
- draht is a local coding agent. It runs with the permissions of the user account that starts it, and it treats files writable by that user as inside the same local trust boundary.
3
+ Treat model-generated commands and code as untrusted. draht can read, change, and execute files with the permissions of the account that started it, and it does not ask for approval before every tool call. Extensions, package installers, language servers, and other child processes run with those same permissions unless an operating-system or virtualization boundary restricts them.
4
4
 
5
- ## Project Trust
5
+ Files, comments, instructions, command output, and model responses can steer the model through prompt injection. Project trust controls which project resources load at startup, but it does not make that content or the resulting actions safe.
6
6
 
7
- Project trust controls whether draht loads project-local settings, resources, packages, and extensions. It is not a sandbox and it does not restrict what the model can ask tools to do after you start working in a directory.
7
+ Safety comes from limiting the files, credentials, processes, and network services draht can access and affect if a generated action is wrong or hostile. Watching the transcript, using project trust, and reviewing changes do not create a security boundary.
8
8
 
9
- draht considers a project to have trust inputs when it finds any of these from the current working directory:
9
+ ## Choose how to run draht
10
10
 
11
- - `.draht/` in the current directory
12
- - `.agents/skills` in the current directory or an ancestor directory
11
+ Different ways of running draht place different limits on what generated commands can access:
13
12
 
14
- When an interactive session starts in a project with configs in `.draht` or `.agents/skills` and no saved decision for the current directory or a parent directory, draht follows `defaultProjectTrust` from global settings. The default value is `"ask"`, which asks whether to trust the project when UI is available. Saved decisions are stored by canonical directory in `~/.draht/agent/trust.json`, and the closest saved decision on the current or parent path applies before the global default.
13
+ | How draht runs | What remains protected |
14
+ |---|---|
15
+ | Directly, with the permissions of its operating-system user | Anything that user cannot access. A dedicated user account can narrow those permissions, but draht still shares the operating system and network with other users. |
16
+ | Entirely inside a container, virtual machine, or sandbox | Host files and processes that you do not expose to the environment. Credentials and network services remain accessible if you make them available inside it. This is usually the strongest practical option. |
17
+ | Outside the isolated environment, with only its built-in tools running inside | Host resources are protected from actions performed through those tools. draht itself and other extensions remain outside the boundary, so this is a narrower form of isolation. |
15
18
 
16
- Trusting a project allows draht to load trust-gated project inputs, including:
19
+ The working folder controls resource discovery and the default location for tools, but it does not prevent commands from accessing other paths available to the draht process.
20
+
21
+ Whichever option you choose, only provide the files and services required for the task. Keep credentials outside the environment where possible, or use narrowly scoped, short-lived credentials. Restrict network access when commands do not need it.
22
+
23
+ For setup instructions and the limitations of each isolation method, see [Run draht in an isolated environment](containerization.md).
24
+
25
+ <a id="project-trust"></a>
26
+
27
+ ## Understand project trust
28
+
29
+ Project trust controls whether draht loads most settings and resources supplied by a working folder. It prevents a folder from silently loading executable extensions before you approve it.
30
+
31
+ Project trust is not a complete startup boundary. draht reads the project `sessionDir` setting while selecting or creating a session, before it resolves project trust. Declining trust prevents the remaining project settings and protected resources from loading, but it cannot undo that initial session-directory lookup.
32
+
33
+ Project trust does not limit what tool calls can access or affect. After draht starts, enabled tools still use the operating-system permissions of the draht process. Instructions and other content in the folder can also influence the model.
34
+
35
+ ### Resources protected by project trust
36
+
37
+ draht requires a project-trust decision when it finds any of these resources from the current working directory:
17
38
 
18
39
  - `.draht/settings.json`
19
- - `.draht` resources such as extensions, skills, prompt templates, themes, and system prompt files
20
- - missing project packages configured through project settings
21
- - project-local extensions and project package-managed extensions
40
+ - `.draht/mcp.json`
41
+ - `.draht/extensions`, `.draht/skills`, `.draht/prompts`, or `.draht/themes`
42
+ - `.draht/SYSTEM.md` or `.draht/APPEND_SYSTEM.md`
43
+ - project `.agents/skills` in the current directory or an ancestor directory
44
+
45
+ A bare `.draht` directory does not require project trust.
46
+
47
+ Granting project trust allows draht to load:
48
+
49
+ - project settings
50
+ - project MCP servers from `.draht/mcp.json`
51
+ - extensions, skills, prompt templates, themes, and system-prompt files under `.draht`
52
+ - missing packages configured through project settings
53
+ - project-local and project-package extensions
54
+
55
+ Declining project trust skips those protected resources, except for the initial `sessionDir` lookup described above.
56
+
57
+ Context files such as `AGENTS.override.md`, `AGENTS.md`, and `CLAUDE.md` load regardless of project trust unless you disable context loading. Pass `--context-root <absolute-path>` to stop the context-file ancestor walk at a known project root. Treat instructions in a folder as untrusted input even when you decline project trust.
58
+
59
+ ### How draht chooses a trust decision
60
+
61
+ A command-line `--approve` or `--no-approve` override applies first. When protected resources exist and there is no command-line override:
22
62
 
23
- Declining trust skips protected resources. `AGENTS.md` and `CLAUDE.md` context files are loaded regardless of project trust unless context loading is disabled. Before trust is resolved, draht only loads context files, user/global extensions, and CLI `-e` extensions. User/global and CLI extensions can handle the `project_trust` event; the first extension that returns a yes/no decision owns the decision.
63
+ 1. User-level and command-line extensions can handle the `project_trust` event. The first extension that returns yes or no owns the decision.
64
+ 2. If no extension decides, draht looks for a saved decision for the current directory or one of its parents. The closest decision applies.
65
+ 3. If no saved decision applies, draht follows the global `defaultProjectTrust` setting, whose default is `"ask"`.
24
66
 
25
- Non-interactive modes (`-p`, `--mode json`, and `--mode rpc`) do not show a trust prompt. Without an applicable saved trust decision, `defaultProjectTrust: "ask"` and `"never"` ignore such resources, while `"always"` trusts them. Use `--approve`/`-a` or `--no-approve`/`-na` to override project trust for one run.
67
+ Saved decisions use canonical directory paths and live in:
26
68
 
27
- ## No Built-in Sandbox
69
+ ```text
70
+ ~/.draht/agent/trust.json
71
+ ```
28
72
 
29
- draht does not include a built-in sandbox. Built-in tools can read files, write files, edit files, and run shell commands with the permissions of the draht process. Extensions are TypeScript modules that run with the same permissions. Package installs, shell commands, language servers, test commands, and other developer tools behave as ordinary local processes.
73
+ Use `/trust` to save a decision for future draht processes.
30
74
 
31
- This is intentional. draht is designed to operate on local source trees, invoke project toolchains, and integrate with the user's existing development environment. A partial in-process sandbox would be easy to misunderstand as a security boundary while still depending on the host shell, filesystem, package managers, credentials, and extension code. Real isolation needs to come from the operating system or a virtualization/container boundary.
75
+ ### Project trust without an interactive prompt
32
76
 
33
- Project trust is only an input-loading guard. It prevents a repository from silently changing draht's settings or extensions before you approve it. It does not make untrusted code, untrusted prompts, or untrusted model output safe. Prompt injection from repository files, comments, documentation, context files, or build output is expected local-agent risk and cannot be reliably prevented by draht.
77
+ Print, JSON, and RPC modes cannot show the built-in trust prompt. If no command-line override, extension, or saved decision applies:
34
78
 
35
- ## Running Untrusted or Unmonitored Work
79
+ - `defaultProjectTrust: "always"` loads protected project resources.
80
+ - `defaultProjectTrust: "ask"` or `"never"` skips them.
36
81
 
37
- For untrusted repositories, generated code you do not intend to monitor closely, or unattended automation, run draht in a contained environment. Use a container, VM, micro-VM, remote sandbox, or policy-controlled sandbox with only the files and credentials required for the task.
82
+ Use `--approve` or `--no-approve` when an automated run needs an explicit one-time decision.
38
83
 
39
- Common patterns are documented in [Containerization](containerization.md):
84
+ ## Reduce impact and improve recovery
40
85
 
41
- - run the whole `draht` process inside OpenShell or Docker
42
- - run host draht while routing built-in tool execution into a Gondolin micro-VM
43
- - mount only the workspace paths the agent should access
44
- - avoid mounting host `~/.draht/agent` unless the container should access host sessions, settings, and credentials
45
- - pass the minimum required API keys or use short-lived credentials
46
- - restrict network access when the task does not need it
47
- - review diffs and outputs before copying results back to trusted systems
86
+ These practices do not replace isolation, but they reduce exposure or make recovery easier:
48
87
 
49
- If you bind-mount a host workspace read/write, writes from inside the container or VM can still modify host files. Use read-only mounts or copy files into and out of the sandbox when you need stronger protection from unintended writes.
88
+ - Give draht access only to files and services required for the task.
89
+ - Use snapshots, backups, or version control before substantial changes.
90
+ - Review extensions and packages before loading them. Extensions execute inside the draht process.
91
+ - Prefer narrowly scoped, short-lived credentials.
92
+ - Review diffs and generated output before applying results to another system.
93
+ - Review sessions before exporting or sharing them. They can contain prompts, tool arguments, command output, file contents, and credentials exposed during the conversation.
50
94
 
51
- ## Reporting Security Issues
95
+ ## Report a security issue
52
96
 
53
- To report a security issue, follow the repository [Security Policy](https://github.com/draht-dev/draht/blob/main/SECURITY.md). Do not open a public issue for security-sensitive reports.
97
+ Report it privately through [GitHub Security Advisories](https://github.com/draht-dev/draht/security/advisories/new) for the repository. Do not open a public issue for a security-sensitive report.
54
98
 
55
- Expected local-agent behavior, lack of a built-in sandbox, prompt injection from untrusted content, and behavior of user-installed extensions or skills are generally outside the security boundary unless the report demonstrates a real privilege-boundary bypass or shows how draht grants access that the local user did not already have.
99
+ Expected local-agent behavior, prompt injection from untrusted content, lack of a built-in sandbox, and behavior from user-installed extensions or skills are generally outside the security boundary unless the report demonstrates a privilege-boundary bypass or access that the local user did not already have.
@@ -2,13 +2,16 @@
2
2
 
3
3
  Sessions are stored as JSONL (JSON Lines) files. Each line is a JSON object with a `type` field. Session entries form a tree structure via `id`/`parentId` fields, enabling in-place branching without creating new files.
4
4
 
5
+ For programmatic creation, persistence, and tree navigation, see the [`SessionManager` API](sdk.md#sessionmanager-api).
6
+
7
+
5
8
  ## File Location
6
9
 
7
10
  ```
8
- ~/.draht/agent/sessions/--<path>--/<timestamp>_<uuid>.jsonl
11
+ ~/.draht/agent/sessions/--<path>--/<timestamp>_<session-id>.jsonl
9
12
  ```
10
13
 
11
- Where `<path>` is the working directory with `/` replaced by `-`.
14
+ By default, `<session-id>` is a UUID. Callers can supply a custom ID through the SDK or `--session-id`. For `<path>`, draht removes the leading path separator and replaces `/`, `\\`, and `:` with `-`.
12
15
 
13
16
  ## Deleting Sessions
14
17
 
@@ -30,146 +33,18 @@ Existing sessions are automatically migrated to the current version (v3) when lo
30
33
 
31
34
  Source on GitHub ([draht](https://github.com/draht-dev/draht)):
32
35
  - [`packages/coding-agent/src/core/session-manager.ts`](https://github.com/draht-dev/draht/blob/main/packages/coding-agent/src/core/session-manager.ts) - Session entry types and SessionManager
33
- - [`packages/coding-agent/src/core/messages.ts`](https://github.com/draht-dev/draht/blob/main/packages/coding-agent/src/core/messages.ts) - Extended message types (BashExecutionMessage, CustomMessage, etc.)
34
- - [`packages/ai/src/types.ts`](https://github.com/draht-dev/draht/blob/main/packages/ai/src/types.ts) - Base message types (UserMessage, AssistantMessage, ToolResultMessage)
35
- - [`packages/agent/src/types.ts`](https://github.com/draht-dev/draht/blob/main/packages/agent/src/types.ts) - AgentMessage union type
36
+ - [Message Types](message-types.md) - Shared message and content-block reference
37
+ - [`packages/coding-agent/src/core/messages.ts`](https://github.com/draht-dev/draht/blob/main/packages/coding-agent/src/core/messages.ts) - Extended message types
38
+ - [`packages/ai/src/types.ts`](https://github.com/draht-dev/draht/blob/main/packages/ai/src/types.ts) - Base message and content-block types
39
+ - [`packages/agent/src/types.ts`](https://github.com/draht-dev/draht/blob/main/packages/agent/src/types.ts) - Extensible `AgentMessage` union
36
40
 
37
41
  For TypeScript definitions in your project, inspect `node_modules/@draht/coding-agent/dist/` and `node_modules/@draht/ai/dist/`.
38
42
 
39
- ## Message Types
40
-
41
- Session entries contain `AgentMessage` objects. Understanding these types is essential for parsing sessions and writing extensions.
42
-
43
- ### Content Blocks
44
-
45
- Messages contain arrays of typed content blocks:
46
-
47
- ```typescript
48
- interface TextContent {
49
- type: "text";
50
- text: string;
51
- }
52
-
53
- interface ImageContent {
54
- type: "image";
55
- data: string; // base64 encoded
56
- mimeType: string; // e.g., "image/jpeg", "image/png"
57
- }
58
-
59
- interface ThinkingContent {
60
- type: "thinking";
61
- thinking: string;
62
- }
63
-
64
- interface ToolCall {
65
- type: "toolCall";
66
- id: string;
67
- name: string;
68
- arguments: Record<string, any>;
69
- }
70
- ```
43
+ ## Messages
71
44
 
72
- ### Base Message Types (from @draht/ai)
45
+ A `message` entry stores an [`AgentMessage`](message-types.md). Message content blocks, roles, usage, and message timestamps are defined in [Message Types](message-types.md).
73
46
 
74
- ```typescript
75
- interface UserMessage {
76
- role: "user";
77
- content: string | (TextContent | ImageContent)[];
78
- timestamp: number; // Unix ms
79
- }
80
-
81
- interface AssistantMessage {
82
- role: "assistant";
83
- content: (TextContent | ThinkingContent | ToolCall)[];
84
- api: string;
85
- provider: string;
86
- model: string;
87
- usage: Usage;
88
- stopReason: "stop" | "length" | "toolUse" | "error" | "aborted";
89
- errorMessage?: string;
90
- timestamp: number;
91
- }
92
-
93
- interface ToolResultMessage {
94
- role: "toolResult";
95
- toolCallId: string;
96
- toolName: string;
97
- content: (TextContent | ImageContent)[];
98
- details?: any; // Tool-specific metadata
99
- usage?: Usage; // Nested LLM work performed by the tool
100
- isError: boolean;
101
- timestamp: number;
102
- }
103
-
104
- interface Usage {
105
- input: number;
106
- output: number;
107
- cacheRead: number;
108
- cacheWrite: number;
109
- totalTokens: number;
110
- cost: {
111
- input: number;
112
- output: number;
113
- cacheRead: number;
114
- cacheWrite: number;
115
- total: number;
116
- };
117
- }
118
- ```
119
-
120
- The exported @draht/ai `StopReason` type also includes `"pending"`, but that value is reserved for partial messages in streaming events. Terminal `done`/`error` messages replace it with a completion reason before draht persists the assistant message, so `"pending"` should never appear in session JSONL.
121
-
122
- ### Extended Message Types (from @draht/coding-agent)
123
-
124
- ```typescript
125
- interface BashExecutionMessage {
126
- role: "bashExecution";
127
- command: string;
128
- output: string;
129
- exitCode: number | undefined;
130
- cancelled: boolean;
131
- truncated: boolean;
132
- fullOutputPath?: string;
133
- excludeFromContext?: boolean; // true for !! prefix commands
134
- timestamp: number;
135
- }
136
-
137
- interface CustomMessage {
138
- role: "custom";
139
- customType: string; // Extension identifier
140
- content: string | (TextContent | ImageContent)[];
141
- display: boolean; // Show in TUI
142
- details?: any; // Extension-specific metadata
143
- timestamp: number;
144
- }
145
-
146
- interface BranchSummaryMessage {
147
- role: "branchSummary";
148
- summary: string;
149
- fromId: string; // Entry we branched from
150
- timestamp: number;
151
- }
152
-
153
- interface CompactionSummaryMessage {
154
- role: "compactionSummary";
155
- summary: string;
156
- tokensBefore: number;
157
- timestamp: number;
158
- }
159
- ```
160
-
161
- ### AgentMessage Union
162
-
163
- ```typescript
164
- type AgentMessage =
165
- | UserMessage
166
- | AssistantMessage
167
- | ToolResultMessage
168
- | BashExecutionMessage
169
- | CustomMessage
170
- | BranchSummaryMessage
171
- | CompactionSummaryMessage;
172
- ```
47
+ Session entry timestamps are ISO 8601 strings. The nested message timestamp is a Unix timestamp in milliseconds.
173
48
 
174
49
  ## Entry Base
175
50
 
@@ -178,8 +53,8 @@ All entries (except `SessionHeader`) extend `SessionEntryBase`:
178
53
  ```typescript
179
54
  interface SessionEntryBase {
180
55
  type: string;
181
- id: string; // 8-char hex ID
182
- parentId: string | null; // Parent entry ID (null for first entry)
56
+ id: string; // Usually an 8-char hex ID; may fall back to a full UUID
57
+ parentId: string | null; // Parent entry ID (null for a root entry)
183
58
  timestamp: string; // ISO timestamp
184
59
  }
185
60
  ```
@@ -202,17 +77,26 @@ For sessions with a parent (created via `/fork`, `/clone`, or `newSession({ pare
202
77
 
203
78
  ### SessionMessageEntry
204
79
 
205
- A message in the conversation. The `message` field contains an `AgentMessage`.
80
+ A message in the conversation. The `message` field contains an `AgentMessage`. System messages carry the prompt and tool loadout: the first request of a session persists one with every prompt section and tool declaration, and later changes persist as system messages that patch `sections` by name (`null` removes one) and list `toolsAdded`/`toolsRemoved`. Replaying them in order yields the current prompt and tools; there is no separate prompt state entry.
206
81
 
207
82
  ```json
208
- {"type":"message","id":"a1b2c3d4","parentId":"prev1234","timestamp":"2024-12-03T14:00:01.000Z","message":{"role":"user","content":"Hello"}}
209
- {"type":"message","id":"b2c3d4e5","parentId":"a1b2c3d4","timestamp":"2024-12-03T14:00:02.000Z","message":{"role":"assistant","content":[{"type":"text","text":"Hi!"}],"provider":"anthropic","model":"claude-sonnet-4-5","usage":{...},"stopReason":"stop"}}
210
- {"type":"message","id":"c3d4e5f6","parentId":"b2c3d4e5","timestamp":"2024-12-03T14:00:03.000Z","message":{"role":"toolResult","toolCallId":"call_123","toolName":"bash","content":[{"type":"text","text":"output"}],"isError":false}}
83
+ {"type":"message","id":"a0b1c2d3","parentId":null,"timestamp":"2024-12-03T14:00:00.000Z","message":{"role":"system","content":"","sections":{"preamble":"You are an expert coding assistant...","tools":"<tools>\n- read: ...\n</tools>","cwd":"/project"},"toolsAdded":[{"name":"read","description":"...","parameters":{}}],"timestamp":1733234400000}}
84
+ {"type":"message","id":"d4e5f6g7","parentId":"c3d4e5f6","timestamp":"2024-12-03T14:04:00.000Z","message":{"role":"system","content":"","sections":{"skills":"<skills>...</skills>"},"toolsRemoved":[{"name":"write"}],"timestamp":1733234640000}}
211
85
  ```
212
86
 
87
+ Sessions created before system messages existed have no leading system message; the first request declares the current prompt as a later system message, which replays the same way.
88
+
89
+ ```json
90
+ {"type":"message","id":"a1b2c3d4","parentId":"prev1234","timestamp":"2024-12-03T14:00:01.000Z","message":{"role":"user","content":"Hello","timestamp":1733234401000}}
91
+ {"type":"message","id":"b2c3d4e5","parentId":"a1b2c3d4","timestamp":"2024-12-03T14:00:02.000Z","message":{"role":"assistant","content":[{"type":"text","text":"Hi!"}],"api":"anthropic-messages","provider":"anthropic","model":"claude-sonnet-4-5","usage":{...},"stopReason":"stop","timestamp":1733234402000}}
92
+ {"type":"message","id":"c3d4e5f6","parentId":"b2c3d4e5","timestamp":"2024-12-03T14:00:03.000Z","message":{"role":"toolResult","toolCallId":"call_123","toolName":"bash","content":[{"type":"text","text":"output"}],"isError":false,"timestamp":1733234403000}}
93
+ ```
94
+
95
+ Assistant messages name the model that produced them. Newer messages also record `thinkingLevel`, the draht thinking level requested for that response.
96
+
213
97
  ### ModelChangeEntry
214
98
 
215
- Emitted when the user switches models mid-session.
99
+ Emitted when the user switches models mid-session. The latest entry is the selected model, which may be a [virtual model](virtual-models.md); assistant messages then name the physical model that answered.
216
100
 
217
101
  ```json
218
102
  {"type":"model_change","id":"d4e5f6g7","parentId":"c3d4e5f6","timestamp":"2024-12-03T14:05:00.000Z","provider":"openai","modelId":"gpt-4o"}
@@ -226,26 +110,41 @@ Emitted when the user changes the thinking/reasoning level.
226
110
  {"type":"thinking_level_change","id":"e5f6g7h8","parentId":"d4e5f6g7","timestamp":"2024-12-03T14:06:00.000Z","thinkingLevel":"high"}
227
111
  ```
228
112
 
229
- ### CompactionEntry
113
+ ### UsageEntry
230
114
 
231
- Created when context is compacted. Stores a summary of earlier messages.
115
+ Records model-attributed usage that is not an assistant message and does not participate in LLM context. `kind` is an arbitrary string identifying the operation; for example, cache warming uses `"cache_warm"`.
232
116
 
233
117
  ```json
234
- {"type":"compaction","id":"f6g7h8i9","parentId":"e5f6g7h8","timestamp":"2024-12-03T14:10:00.000Z","summary":"User discussed X, Y, Z...","firstKeptEntryId":"c3d4e5f6","tokensBefore":50000}
118
+ {"type":"usage","id":"f6g7h8i9","parentId":"e5f6g7h8","timestamp":"2024-12-03T14:08:00.000Z","kind":"cache_warm","provider":"anthropic","model":"claude-sonnet-4-5","usage":{"input":0,"output":0,"cacheRead":50000,"cacheWrite":0,"totalTokens":50000,"cost":{"input":0,"output":0,"cacheRead":0.015,"cacheWrite":0,"total":0.015}}}
235
119
  ```
236
120
 
237
- Newer harness-generated compactions embed the retained post-compaction context directly on the entry, instead of `firstKeptEntryId`:
121
+ Usage entries contribute to session token and cost totals. draht hides them from the conversation tree. Consumers should treat unknown `kind` values as normal usage rather than rejecting them.
122
+
123
+ ### CompactionEntry
124
+
125
+ Created when context is compacted. Stores a summary of earlier messages and a complete system prompt/tool checkpoint.
238
126
 
239
127
  ```json
240
- {"type":"compaction","id":"f6g7h8i9","parentId":"e5f6g7h8","timestamp":"2024-12-03T14:10:00.000Z","summary":"User discussed X, Y, Z...","tokensBefore":50000,"retainedTail":[{"role":"user","content":"latest request"},{"role":"assistant","content":[{"type":"text","text":"latest reply"}],"provider":"anthropic","model":"claude-sonnet-4-5","usage":{...},"stopReason":"stop"}]}
128
+ {"type":"compaction","id":"f6g7h8i9","parentId":"e5f6g7h8","timestamp":"2024-12-03T14:10:00.000Z","summary":"User discussed X, Y, Z...","firstKeptEntryId":"c3d4e5f6","tokensBefore":50000,"systemMessage":{"role":"system","content":"You are a coding assistant.","toolsAdded":[],"timestamp":1733235000000}}
241
129
  ```
242
130
 
131
+ `firstKeptEntryId` is required. It identifies the first entry retained from before the compaction entry. When rebuilding context, draht replaces older summarized entries with the compaction summary and keeps the range beginning at this entry. A retain-none compaction stores its own ID in this field, so no preceding entries are retained.
132
+
243
133
  Optional fields:
134
+ - `systemMessage`: The replayed prompt sections and tool declarations at the compaction boundary; it becomes the leading system message of the compacted context, and system messages among the kept entries are dropped in its favor. It is absent on older session entries.
244
135
  - `usage`: LLM usage from generating the summary; included in session token and cost totals
245
- - `retainedTail`: Materialized `AgentMessage[]` kept after compaction. This is optional only for backward compatibility with older sessions. Newer harness-generated compactions include it so we can rebuild context from this checkpoint without walking older entries before the compaction entry.
246
136
  - `details`: Implementation-specific data (e.g., `{ readFiles: string[], modifiedFiles: string[] }` for default, or custom data for extensions)
247
137
  - `fromHook`: `true` if generated by an extension, `false`/`undefined` if draht-generated (legacy field name)
248
- - `firstKeptEntryId`: for compatibility with old entry format.
138
+
139
+ ### ContextEditEntry
140
+
141
+ Append-only edit of one earlier context-producing entry. It changes only future model context; the target entry and its metadata remain unchanged in raw history, UI, exports, and session accounting.
142
+
143
+ ```json
144
+ {"type":"context_edit","id":"g6h7i8j9","parentId":"f6g7h8i9","timestamp":"2024-12-03T14:11:00.000Z","targetId":"c3d4e5f6","replacement":null}
145
+ ```
146
+
147
+ Targets may be user, assistant, tool-result, or custom-message entries. `replacement: null` omits the target from model context. A non-null `replacement` replaces only the target message content. String replacements for assistant and tool-result entries are normalized to one text block because those roles require content arrays. If several edits target the same entry, the latest edit on the active branch wins. Edits are branch-relative: navigating to a point before the edit reveals the target's original contribution again.
249
148
 
250
149
  ### BranchSummaryEntry
251
150
 
@@ -255,6 +154,8 @@ Created when switching branches via `/tree` with an LLM generated summary of the
255
154
  {"type":"branch_summary","id":"g7h8i9j0","parentId":"a1b2c3d4","timestamp":"2024-12-03T14:15:00.000Z","fromId":"f6g7h8i9","summary":"Branch explored approach A..."}
256
155
  ```
257
156
 
157
+ `parentId` is the entry from which the new branch continues. `fromId` is the previous leaf whose abandoned path was summarized.
158
+
258
159
  Optional fields:
259
160
  - `usage`: LLM usage from generating the summary; included in session token and cost totals
260
161
  - `details`: File tracking data (`{ readFiles: string[], modifiedFiles: string[] }`) for default, or custom data for extensions
@@ -270,6 +171,8 @@ Extension state persistence. Does NOT participate in LLM context.
270
171
 
271
172
  Use `customType` to identify your extension's entries on reload. Interactive mode can render custom entries via `pi.registerEntryRenderer(customType, renderer)`, but they still do not participate in LLM context.
272
173
 
174
+ draht stores [virtual model](virtual-models.md) router state as custom entries with `customType` `pi.virtual-model-state` and `data` `{ provider, modelId, state }`.
175
+
273
176
  ### CustomMessageEntry
274
177
 
275
178
  Extension-injected messages that DO participate in LLM context.
@@ -305,7 +208,7 @@ The session name is displayed in the session selector (`/resume`) instead of the
305
208
 
306
209
  ### PermissionResolutionEntry
307
210
 
308
- Audit record of a resolved tool-permission request: what was asked, which options were offered, what was decided, and which surface decided it. Does NOT participate in LLM context.
211
+ Audit record of a resolved tool-permission request: what was asked, which options were offered, what was decided, and which surface decided it. Does NOT participate in LLM context. Written through `SessionManager.appendPermissionResolution(resolution)`.
309
212
 
310
213
  ```json
311
214
  {"type":"permission_resolution","id":"l2m3n4o5","parentId":"k1l2m3n4","timestamp":"2024-12-03T14:40:02.000Z","requestId":"perm_01HV","toolCallId":"call_456","toolName":"bash","cwd":"/path/to/project","detail":{"command":"rm -rf build"},"offeredOptionIds":["approve","approve-always","deny"],"decision":"approved","chosenOptionId":"approve","decidedBy":{"surface":"attach","clientId":"client-7"},"requestedAt":"2024-12-03T14:40:00.000Z","deadline":"2024-12-03T14:45:00.000Z"}
@@ -321,15 +224,16 @@ Fields:
321
224
  - `decidedBy.surface`: `tui` | `attach` | `rpc` | `acp` | `system`; `clientId` is `null` for local/system decisions
322
225
  - `deadline`: advisory expiry communicated with the ask, or `null`
323
226
 
324
- This is a RECORD ONLY and must never be treated as answerable state: `createBranchedSession` copies path entries verbatim into a fork (so `requestId`/`toolCallId` can appear in more than one session), the entry becomes the leaf on reload (the next appended message parents off it), and the RPC `get_entries` command ships it verbatim to connected clients.
227
+ This is a RECORD ONLY and must never be treated as answerable state: `createBranchedSession` copies path entries verbatim into a fork (so `requestId`/`toolCallId` can appear in more than one session), the entry becomes the leaf on reload (the next appended message parents off it), and the RPC [`get_entries`](rpc-commands.md#get_entries) command ships it verbatim to connected clients.
325
228
 
326
229
  ## Tree Structure
327
230
 
328
- Entries form a tree:
329
- - First entry has `parentId: null`
330
- - Each subsequent entry points to its parent via `parentId`
231
+ Entries normally form one tree, but navigation APIs can create multiple roots:
232
+ - A root entry has `parentId: null`; the first entry is initially the root
233
+ - Each non-root entry points to its parent via `parentId`
331
234
  - Branching creates new children from an earlier entry
332
235
  - The "leaf" is the current position in the tree
236
+ - Calling `resetLeaf()` or `branchWithSummary(null, ...)` allows a later entry to become another root
333
237
 
334
238
  ```
335
239
  [user msg] ─── [assistant] ─── [user msg] ─── [assistant] ─┬─ [user msg] ← current leaf
@@ -342,25 +246,27 @@ Entries form a tree:
342
246
  `buildContextEntries()` walks from the current leaf to the root, producing the active entry list while honoring compaction:
343
247
 
344
248
  1. Collects all entries on the path
345
- 2. If a `CompactionEntry` is on the path:
249
+ 2. If one or more `CompactionEntry` values are on the path, uses the latest one:
346
250
  - Includes the compaction entry first
347
- - If `retainedTail` is present, it acts as a self-contained checkpoint and entries after the compaction are included
348
- - Otherwise entries from `firstKeptEntryId` to the compaction are included
349
- - Then entries after compaction are included
251
+ - Includes non-system entries from `firstKeptEntryId` up to, but not including, the compaction entry
252
+ - Includes entries after the compaction entry
350
253
  3. Preserves non-message entries in the selected range so interactive mode can render them
351
254
 
352
- `buildSessionContext()` builds on that entry list to produce the message list for the LLM:
255
+ `buildSessionProjection()` then applies the latest `context_edit` for each selected target. It returns the model-visible messages together with their source entries. Omitted targets produce no message; replacements retain the source entry's role and metadata while changing only content. The raw selected entries are not modified.
256
+
257
+ `buildSessionContext()` builds on that projection to produce the message list for the LLM:
353
258
 
354
259
  1. Extracts current model and thinking level settings from the full path
355
260
  2. Converts selected entries to messages:
356
261
  - `message` -> stored `AgentMessage`
357
- - `compaction` -> `compactionSummary` plus `retainedTail` when present
262
+ - `compaction` -> complete system checkpoint followed by `compactionSummary`
358
263
  - `branch_summary` -> `branchSummary`
359
264
  - `custom_message` -> `CustomMessage`
360
- - `custom` -> no context message
265
+ - `context_edit` -> no context message of its own
266
+ - `usage` and `custom` -> no context message
361
267
  - `permission_resolution` -> no context message
362
268
 
363
- This makes newer compactions act like self-contained checkpoints. `retainedTail` is optional only so older sessions that only store `firstKeptEntryId` continue to load correctly.
269
+ The compaction summary replaces entries before `firstKeptEntryId`. Pre-compaction system messages are folded into the complete checkpoint rather than replayed from the retained range. Retained non-system entries and all entries after the compaction remain available to the LLM.
364
270
 
365
271
  ## Parsing Example
366
272
 
@@ -385,6 +291,9 @@ for (const line of lines) {
385
291
  case "branch_summary":
386
292
  console.log(`[${entry.id}] Branch from ${entry.fromId}`);
387
293
  break;
294
+ case "usage":
295
+ console.log(`[${entry.id}] Usage (${entry.kind}): ${entry.usage.totalTokens} tokens`);
296
+ break;
388
297
  case "custom":
389
298
  console.log(`[${entry.id}] Custom (${entry.customType}): ${JSON.stringify(entry.data)}`);
390
299
  break;
@@ -403,58 +312,3 @@ for (const line of lines) {
403
312
  }
404
313
  }
405
314
  ```
406
-
407
- ## SessionManager API
408
-
409
- Key methods for working with sessions programmatically.
410
-
411
- ### Static Creation Methods
412
- - `SessionManager.create(cwd, sessionDir?)` - New session
413
- - `SessionManager.open(path, sessionDir?)` - Open existing session file
414
- - `SessionManager.continueRecent(cwd, sessionDir?)` - Continue most recent or create new
415
- - `SessionManager.inMemory(cwd?)` - No file persistence
416
- - `SessionManager.forkFrom(sourcePath, targetCwd, sessionDir?)` - Fork session from another project
417
-
418
- ### Static Listing Methods
419
- - `SessionManager.list(cwd, sessionDir?, onProgress?)` - List sessions for a directory
420
- - `SessionManager.listAll(onProgress?)` - List all sessions across all projects
421
-
422
- ### Instance Methods - Session Management
423
- - `newSession(options?)` - Start a new session (options: `{ parentSession?: string }`)
424
- - `setSessionFile(path)` - Switch to a different session file
425
- - `createBranchedSession(leafId)` - Extract branch to new session file
426
-
427
- ### Instance Methods - Appending (all return entry ID)
428
- - `appendMessage(message)` - Add message
429
- - `appendThinkingLevelChange(level)` - Record thinking change
430
- - `appendModelChange(provider, modelId)` - Record model change
431
- - `appendCompaction(summary, firstKeptEntryId, tokensBefore, details?, fromHook?)` - Add compaction
432
- - `appendCustomEntry(customType, data?)` - Extension state (not in context)
433
- - `appendSessionInfo(name)` - Set session display name
434
- - `appendPermissionResolution(resolution)` - Record a resolved permission request (not in context)
435
- - `appendCustomMessageEntry(customType, content, display, details?)` - Extension message (in context)
436
- - `appendLabelChange(targetId, label)` - Set/clear label
437
-
438
- ### Instance Methods - Tree Navigation
439
- - `getLeafId()` - Current position
440
- - `getLeafEntry()` - Get current leaf entry
441
- - `getEntry(id)` - Get entry by ID
442
- - `getBranch(fromId?)` - Walk from entry to root
443
- - `getTree()` - Get full tree structure
444
- - `getChildren(parentId)` - Get direct children
445
- - `getLabel(id)` - Get label for entry
446
- - `branch(entryId)` - Move leaf to earlier entry
447
- - `resetLeaf()` - Reset leaf to null (before any entries)
448
- - `branchWithSummary(entryId, summary, details?, fromHook?)` - Branch with context summary
449
-
450
- ### Instance Methods - Context & Info
451
- - `buildContextEntries()` - Get active branch entries with compaction applied
452
- - `buildSessionContext()` - Get messages, thinkingLevel, and model for LLM
453
- - `getEntries()` - All entries (excluding header)
454
- - `getHeader()` - Session header metadata
455
- - `getSessionName()` - Get display name from latest session_info entry
456
- - `getCwd()` - Working directory
457
- - `getSessionDir()` - Session storage directory
458
- - `getSessionId()` - Session UUID
459
- - `getSessionFile()` - Session file path (undefined for in-memory)
460
- - `isPersisted()` - Whether session is saved to disk