@draht/coding-agent 2026.7.13 → 2026.9.5-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (614) hide show
  1. package/CHANGELOG.md +241 -0
  2. package/README.md +47 -2
  3. package/agents/debugger.md +12 -1
  4. package/agents/git-committer.md +1 -0
  5. package/agents/implementer.md +20 -0
  6. package/agents/investigator.md +75 -0
  7. package/agents/reviewer.md +7 -0
  8. package/agents/spec-reviewer.md +66 -0
  9. package/agents/verifier.md +4 -3
  10. package/bin/draht-tools.cjs +472 -41
  11. package/dist/agents/debugger.md +12 -1
  12. package/dist/agents/git-committer.md +1 -0
  13. package/dist/agents/implementer.md +20 -0
  14. package/dist/agents/investigator.md +75 -0
  15. package/dist/agents/reviewer.md +7 -0
  16. package/dist/agents/spec-reviewer.md +66 -0
  17. package/dist/agents/verifier.md +4 -3
  18. package/dist/bun/cli.js +2 -0
  19. package/dist/bun/cli.js.map +1 -1
  20. package/dist/cli/args.d.ts +10 -0
  21. package/dist/cli/args.d.ts.map +1 -1
  22. package/dist/cli/args.js +80 -3
  23. package/dist/cli/args.js.map +1 -1
  24. package/dist/cli/attach-mode.d.ts +61 -0
  25. package/dist/cli/attach-mode.d.ts.map +1 -1
  26. package/dist/cli/attach-mode.js +243 -5
  27. package/dist/cli/attach-mode.js.map +1 -1
  28. package/dist/cli/config-selector.js +1 -1
  29. package/dist/cli/config-selector.js.map +1 -1
  30. package/dist/cli/credential-print.d.ts +23 -0
  31. package/dist/cli/credential-print.d.ts.map +1 -0
  32. package/dist/cli/credential-print.js +117 -0
  33. package/dist/cli/credential-print.js.map +1 -0
  34. package/dist/cli/list-models.d.ts +2 -2
  35. package/dist/cli/list-models.d.ts.map +1 -1
  36. package/dist/cli/list-models.js +3 -3
  37. package/dist/cli/list-models.js.map +1 -1
  38. package/dist/cli/startup-ui.js +1 -1
  39. package/dist/cli/startup-ui.js.map +1 -1
  40. package/dist/config.d.ts +9 -0
  41. package/dist/config.d.ts.map +1 -1
  42. package/dist/config.js +31 -4
  43. package/dist/config.js.map +1 -1
  44. package/dist/core/agent-session-runtime.d.ts +17 -1
  45. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  46. package/dist/core/agent-session-runtime.js +90 -30
  47. package/dist/core/agent-session-runtime.js.map +1 -1
  48. package/dist/core/agent-session-services.d.ts +4 -7
  49. package/dist/core/agent-session-services.d.ts.map +1 -1
  50. package/dist/core/agent-session-services.js +24 -9
  51. package/dist/core/agent-session-services.js.map +1 -1
  52. package/dist/core/agent-session.d.ts +87 -27
  53. package/dist/core/agent-session.d.ts.map +1 -1
  54. package/dist/core/agent-session.js +337 -154
  55. package/dist/core/agent-session.js.map +1 -1
  56. package/dist/core/auth-storage.d.ts +20 -104
  57. package/dist/core/auth-storage.d.ts.map +1 -1
  58. package/dist/core/auth-storage.js +104 -260
  59. package/dist/core/auth-storage.js.map +1 -1
  60. package/dist/core/builtins/checkpoints.d.ts +20 -0
  61. package/dist/core/builtins/checkpoints.d.ts.map +1 -0
  62. package/dist/core/builtins/checkpoints.js +161 -0
  63. package/dist/core/builtins/checkpoints.js.map +1 -0
  64. package/dist/core/builtins/duet.d.ts +26 -0
  65. package/dist/core/builtins/duet.d.ts.map +1 -0
  66. package/dist/core/builtins/duet.js +660 -0
  67. package/dist/core/builtins/duet.js.map +1 -0
  68. package/dist/core/builtins/index.d.ts.map +1 -1
  69. package/dist/core/builtins/index.js +7 -1
  70. package/dist/core/builtins/index.js.map +1 -1
  71. package/dist/core/builtins/subagent.d.ts +24 -4
  72. package/dist/core/builtins/subagent.d.ts.map +1 -1
  73. package/dist/core/builtins/subagent.js +278 -35
  74. package/dist/core/builtins/subagent.js.map +1 -1
  75. package/dist/core/cache-stats.d.ts +2 -2
  76. package/dist/core/cache-stats.d.ts.map +1 -1
  77. package/dist/core/cache-stats.js +1 -1
  78. package/dist/core/cache-stats.js.map +1 -1
  79. package/dist/core/checkpoints/checkpoint-cli.d.ts +17 -0
  80. package/dist/core/checkpoints/checkpoint-cli.d.ts.map +1 -0
  81. package/dist/core/checkpoints/checkpoint-cli.js +78 -0
  82. package/dist/core/checkpoints/checkpoint-cli.js.map +1 -0
  83. package/dist/core/checkpoints/checkpoint-manager.d.ts +294 -0
  84. package/dist/core/checkpoints/checkpoint-manager.d.ts.map +1 -0
  85. package/dist/core/checkpoints/checkpoint-manager.js +865 -0
  86. package/dist/core/checkpoints/checkpoint-manager.js.map +1 -0
  87. package/dist/core/checkpoints/rewind.d.ts +141 -0
  88. package/dist/core/checkpoints/rewind.d.ts.map +1 -0
  89. package/dist/core/checkpoints/rewind.js +246 -0
  90. package/dist/core/checkpoints/rewind.js.map +1 -0
  91. package/dist/core/compaction/branch-summarization.d.ts +9 -3
  92. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  93. package/dist/core/compaction/branch-summarization.js +16 -14
  94. package/dist/core/compaction/branch-summarization.js.map +1 -1
  95. package/dist/core/compaction/compaction.d.ts +24 -3
  96. package/dist/core/compaction/compaction.d.ts.map +1 -1
  97. package/dist/core/compaction/compaction.js +96 -30
  98. package/dist/core/compaction/compaction.js.map +1 -1
  99. package/dist/core/compaction/utils.d.ts +1 -1
  100. package/dist/core/compaction/utils.d.ts.map +1 -1
  101. package/dist/core/compaction/utils.js +6 -17
  102. package/dist/core/compaction/utils.js.map +1 -1
  103. package/dist/core/context-windows.d.ts +7 -0
  104. package/dist/core/context-windows.d.ts.map +1 -0
  105. package/dist/core/context-windows.js +35 -0
  106. package/dist/core/context-windows.js.map +1 -0
  107. package/dist/core/extensions/index.d.ts +1 -1
  108. package/dist/core/extensions/index.d.ts.map +1 -1
  109. package/dist/core/extensions/index.js.map +1 -1
  110. package/dist/core/extensions/loader.d.ts.map +1 -1
  111. package/dist/core/extensions/loader.js +101 -23
  112. package/dist/core/extensions/loader.js.map +1 -1
  113. package/dist/core/extensions/runner.d.ts +19 -3
  114. package/dist/core/extensions/runner.d.ts.map +1 -1
  115. package/dist/core/extensions/runner.js +117 -2
  116. package/dist/core/extensions/runner.js.map +1 -1
  117. package/dist/core/extensions/types.d.ts +236 -9
  118. package/dist/core/extensions/types.d.ts.map +1 -1
  119. package/dist/core/extensions/types.js.map +1 -1
  120. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  121. package/dist/core/extensions/wrapper.js +22 -3
  122. package/dist/core/extensions/wrapper.js.map +1 -1
  123. package/dist/core/footer-data-provider.d.ts +10 -0
  124. package/dist/core/footer-data-provider.d.ts.map +1 -1
  125. package/dist/core/footer-data-provider.js +1 -1
  126. package/dist/core/footer-data-provider.js.map +1 -1
  127. package/dist/core/http-dispatcher.d.ts.map +1 -1
  128. package/dist/core/http-dispatcher.js +7 -0
  129. package/dist/core/http-dispatcher.js.map +1 -1
  130. package/dist/core/index.d.ts +1 -1
  131. package/dist/core/index.d.ts.map +1 -1
  132. package/dist/core/index.js.map +1 -1
  133. package/dist/core/keybindings.d.ts +18 -3
  134. package/dist/core/keybindings.d.ts.map +1 -1
  135. package/dist/core/keybindings.js +12 -3
  136. package/dist/core/keybindings.js.map +1 -1
  137. package/dist/core/model-config.d.ts +542 -0
  138. package/dist/core/model-config.d.ts.map +1 -0
  139. package/dist/core/model-config.js +247 -0
  140. package/dist/core/model-config.js.map +1 -0
  141. package/dist/core/model-registry.d.ts +19 -124
  142. package/dist/core/model-registry.d.ts.map +1 -1
  143. package/dist/core/model-registry.js +56 -727
  144. package/dist/core/model-registry.js.map +1 -1
  145. package/dist/core/model-resolver.d.ts +7 -6
  146. package/dist/core/model-resolver.d.ts.map +1 -1
  147. package/dist/core/model-resolver.js +74 -27
  148. package/dist/core/model-resolver.js.map +1 -1
  149. package/dist/core/model-runtime.d.ts +89 -0
  150. package/dist/core/model-runtime.d.ts.map +1 -0
  151. package/dist/core/model-runtime.js +451 -0
  152. package/dist/core/model-runtime.js.map +1 -0
  153. package/dist/core/models-store.d.ts +17 -0
  154. package/dist/core/models-store.d.ts.map +1 -0
  155. package/dist/core/models-store.js +46 -0
  156. package/dist/core/models-store.js.map +1 -0
  157. package/dist/core/multi-agent/permission-gate.d.ts.map +1 -1
  158. package/dist/core/multi-agent/permission-gate.js +4 -3
  159. package/dist/core/multi-agent/permission-gate.js.map +1 -1
  160. package/dist/core/multi-agent/worktree.d.ts +2 -0
  161. package/dist/core/multi-agent/worktree.d.ts.map +1 -1
  162. package/dist/core/multi-agent/worktree.js +2 -2
  163. package/dist/core/multi-agent/worktree.js.map +1 -1
  164. package/dist/core/package-manager.d.ts +7 -1
  165. package/dist/core/package-manager.d.ts.map +1 -1
  166. package/dist/core/package-manager.js +41 -45
  167. package/dist/core/package-manager.js.map +1 -1
  168. package/dist/core/permission-relay/index.d.ts +19 -0
  169. package/dist/core/permission-relay/index.d.ts.map +1 -0
  170. package/dist/core/permission-relay/index.js +49 -0
  171. package/dist/core/permission-relay/index.js.map +1 -0
  172. package/dist/core/permission-relay/relay-ui-context.d.ts +39 -0
  173. package/dist/core/permission-relay/relay-ui-context.d.ts.map +1 -0
  174. package/dist/core/permission-relay/relay-ui-context.js +788 -0
  175. package/dist/core/permission-relay/relay-ui-context.js.map +1 -0
  176. package/dist/core/permission-relay/types.d.ts +222 -0
  177. package/dist/core/permission-relay/types.d.ts.map +1 -0
  178. package/dist/core/permission-relay/types.js +15 -0
  179. package/dist/core/permission-relay/types.js.map +1 -0
  180. package/dist/core/pi-manifest.d.ts +14 -0
  181. package/dist/core/pi-manifest.d.ts.map +1 -0
  182. package/dist/core/pi-manifest.js +35 -0
  183. package/dist/core/pi-manifest.js.map +1 -0
  184. package/dist/core/project-trust.js +2 -2
  185. package/dist/core/project-trust.js.map +1 -1
  186. package/dist/core/prompt-templates.d.ts +1 -0
  187. package/dist/core/prompt-templates.d.ts.map +1 -1
  188. package/dist/core/prompt-templates.js +4 -4
  189. package/dist/core/prompt-templates.js.map +1 -1
  190. package/dist/core/provider-composer.d.ts +55 -0
  191. package/dist/core/provider-composer.d.ts.map +1 -0
  192. package/dist/core/provider-composer.js +375 -0
  193. package/dist/core/provider-composer.js.map +1 -0
  194. package/dist/core/radius.d.ts +2 -0
  195. package/dist/core/radius.d.ts.map +1 -0
  196. package/dist/core/radius.js +2 -0
  197. package/dist/core/radius.js.map +1 -0
  198. package/dist/core/remote-catalog-provider.d.ts +5 -0
  199. package/dist/core/remote-catalog-provider.d.ts.map +1 -0
  200. package/dist/core/remote-catalog-provider.js +115 -0
  201. package/dist/core/remote-catalog-provider.js.map +1 -0
  202. package/dist/core/resource-loader.d.ts +36 -0
  203. package/dist/core/resource-loader.d.ts.map +1 -1
  204. package/dist/core/resource-loader.js +159 -27
  205. package/dist/core/resource-loader.js.map +1 -1
  206. package/dist/core/runtime-credentials.d.ts +15 -0
  207. package/dist/core/runtime-credentials.d.ts.map +1 -0
  208. package/dist/core/runtime-credentials.js +35 -0
  209. package/dist/core/runtime-credentials.js.map +1 -0
  210. package/dist/core/sandbox/bash-operations.d.ts +149 -0
  211. package/dist/core/sandbox/bash-operations.d.ts.map +1 -0
  212. package/dist/core/sandbox/bash-operations.js +163 -0
  213. package/dist/core/sandbox/bash-operations.js.map +1 -0
  214. package/dist/core/sandbox/env.d.ts +83 -0
  215. package/dist/core/sandbox/env.d.ts.map +1 -0
  216. package/dist/core/sandbox/env.js +123 -0
  217. package/dist/core/sandbox/env.js.map +1 -0
  218. package/dist/core/sandbox/executor.d.ts +104 -0
  219. package/dist/core/sandbox/executor.d.ts.map +1 -0
  220. package/dist/core/sandbox/executor.js +92 -0
  221. package/dist/core/sandbox/executor.js.map +1 -0
  222. package/dist/core/sandbox/index.d.ts +36 -0
  223. package/dist/core/sandbox/index.d.ts.map +1 -0
  224. package/dist/core/sandbox/index.js +36 -0
  225. package/dist/core/sandbox/index.js.map +1 -0
  226. package/dist/core/sandbox/linux.d.ts +121 -0
  227. package/dist/core/sandbox/linux.d.ts.map +1 -0
  228. package/dist/core/sandbox/linux.js +260 -0
  229. package/dist/core/sandbox/linux.js.map +1 -0
  230. package/dist/core/sandbox/policy.d.ts +142 -0
  231. package/dist/core/sandbox/policy.d.ts.map +1 -0
  232. package/dist/core/sandbox/policy.js +297 -0
  233. package/dist/core/sandbox/policy.js.map +1 -0
  234. package/dist/core/sandbox/real-path.d.ts +112 -0
  235. package/dist/core/sandbox/real-path.d.ts.map +1 -0
  236. package/dist/core/sandbox/real-path.js +158 -0
  237. package/dist/core/sandbox/real-path.js.map +1 -0
  238. package/dist/core/sandbox/seatbelt-profile.d.ts +95 -0
  239. package/dist/core/sandbox/seatbelt-profile.d.ts.map +1 -0
  240. package/dist/core/sandbox/seatbelt-profile.js +239 -0
  241. package/dist/core/sandbox/seatbelt-profile.js.map +1 -0
  242. package/dist/core/sandbox/seatbelt.d.ts +95 -0
  243. package/dist/core/sandbox/seatbelt.d.ts.map +1 -0
  244. package/dist/core/sandbox/seatbelt.js +154 -0
  245. package/dist/core/sandbox/seatbelt.js.map +1 -0
  246. package/dist/core/sandbox/self-test.d.ts +109 -0
  247. package/dist/core/sandbox/self-test.d.ts.map +1 -0
  248. package/dist/core/sandbox/self-test.js +369 -0
  249. package/dist/core/sandbox/self-test.js.map +1 -0
  250. package/dist/core/sandbox/spawn.d.ts +33 -0
  251. package/dist/core/sandbox/spawn.d.ts.map +1 -0
  252. package/dist/core/sandbox/spawn.js +87 -0
  253. package/dist/core/sandbox/spawn.js.map +1 -0
  254. package/dist/core/sdk.d.ts +3 -6
  255. package/dist/core/sdk.d.ts.map +1 -1
  256. package/dist/core/sdk.js +25 -22
  257. package/dist/core/sdk.js.map +1 -1
  258. package/dist/core/session-manager.d.ts +74 -7
  259. package/dist/core/session-manager.d.ts.map +1 -1
  260. package/dist/core/session-manager.js +169 -34
  261. package/dist/core/session-manager.js.map +1 -1
  262. package/dist/core/settings-manager.d.ts +22 -1
  263. package/dist/core/settings-manager.d.ts.map +1 -1
  264. package/dist/core/settings-manager.js +36 -16
  265. package/dist/core/settings-manager.js.map +1 -1
  266. package/dist/core/skills.d.ts +3 -1
  267. package/dist/core/skills.d.ts.map +1 -1
  268. package/dist/core/skills.js +19 -6
  269. package/dist/core/skills.js.map +1 -1
  270. package/dist/core/slash-commands.d.ts.map +1 -1
  271. package/dist/core/slash-commands.js +1 -0
  272. package/dist/core/slash-commands.js.map +1 -1
  273. package/dist/core/soak/soak-log.d.ts +298 -0
  274. package/dist/core/soak/soak-log.d.ts.map +1 -0
  275. package/dist/core/soak/soak-log.js +660 -0
  276. package/dist/core/soak/soak-log.js.map +1 -0
  277. package/dist/core/soak/soak-reader.d.ts +60 -0
  278. package/dist/core/soak/soak-reader.d.ts.map +1 -0
  279. package/dist/core/soak/soak-reader.js +106 -0
  280. package/dist/core/soak/soak-reader.js.map +1 -0
  281. package/dist/core/socket-server/discovery.d.ts +78 -1
  282. package/dist/core/socket-server/discovery.d.ts.map +1 -1
  283. package/dist/core/socket-server/discovery.js +356 -37
  284. package/dist/core/socket-server/discovery.js.map +1 -1
  285. package/dist/core/socket-server/index.d.ts +10 -4
  286. package/dist/core/socket-server/index.d.ts.map +1 -1
  287. package/dist/core/socket-server/index.js +6 -3
  288. package/dist/core/socket-server/index.js.map +1 -1
  289. package/dist/core/socket-server/permission-delivery.d.ts +125 -0
  290. package/dist/core/socket-server/permission-delivery.d.ts.map +1 -0
  291. package/dist/core/socket-server/permission-delivery.js +152 -0
  292. package/dist/core/socket-server/permission-delivery.js.map +1 -0
  293. package/dist/core/socket-server/permission-registry.d.ts +301 -0
  294. package/dist/core/socket-server/permission-registry.d.ts.map +1 -0
  295. package/dist/core/socket-server/permission-registry.js +410 -0
  296. package/dist/core/socket-server/permission-registry.js.map +1 -0
  297. package/dist/core/socket-server/permission-relay.d.ts +81 -0
  298. package/dist/core/socket-server/permission-relay.d.ts.map +1 -0
  299. package/dist/core/socket-server/permission-relay.js +528 -0
  300. package/dist/core/socket-server/permission-relay.js.map +1 -0
  301. package/dist/core/socket-server/safe-text.d.ts +83 -0
  302. package/dist/core/socket-server/safe-text.d.ts.map +1 -0
  303. package/dist/core/socket-server/safe-text.js +277 -0
  304. package/dist/core/socket-server/safe-text.js.map +1 -0
  305. package/dist/core/socket-server/session-integration.d.ts +65 -2
  306. package/dist/core/socket-server/session-integration.d.ts.map +1 -1
  307. package/dist/core/socket-server/session-integration.js +434 -32
  308. package/dist/core/socket-server/session-integration.js.map +1 -1
  309. package/dist/core/socket-server/socket-client.d.ts +21 -2
  310. package/dist/core/socket-server/socket-client.d.ts.map +1 -1
  311. package/dist/core/socket-server/socket-client.js +52 -1
  312. package/dist/core/socket-server/socket-client.js.map +1 -1
  313. package/dist/core/socket-server/socket-server.d.ts +152 -1
  314. package/dist/core/socket-server/socket-server.d.ts.map +1 -1
  315. package/dist/core/socket-server/socket-server.js +775 -26
  316. package/dist/core/socket-server/socket-server.js.map +1 -1
  317. package/dist/core/socket-server/types.d.ts +106 -2
  318. package/dist/core/socket-server/types.d.ts.map +1 -1
  319. package/dist/core/socket-server/types.js +13 -1
  320. package/dist/core/socket-server/types.js.map +1 -1
  321. package/dist/core/system-prompt.d.ts.map +1 -1
  322. package/dist/core/system-prompt.js +10 -21
  323. package/dist/core/system-prompt.js.map +1 -1
  324. package/dist/core/tools/bash.d.ts +3 -1
  325. package/dist/core/tools/bash.d.ts.map +1 -1
  326. package/dist/core/tools/bash.js +39 -7
  327. package/dist/core/tools/bash.js.map +1 -1
  328. package/dist/core/tools/edit.d.ts.map +1 -1
  329. package/dist/core/tools/edit.js +17 -2
  330. package/dist/core/tools/edit.js.map +1 -1
  331. package/dist/core/tools/find.d.ts +3 -0
  332. package/dist/core/tools/find.d.ts.map +1 -1
  333. package/dist/core/tools/find.js +11 -18
  334. package/dist/core/tools/find.js.map +1 -1
  335. package/dist/core/tools/read.js +1 -1
  336. package/dist/core/tools/read.js.map +1 -1
  337. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  338. package/dist/core/tools/tool-definition-wrapper.js +3 -1
  339. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  340. package/dist/core/trust-manager.d.ts +6 -4
  341. package/dist/core/trust-manager.d.ts.map +1 -1
  342. package/dist/core/trust-manager.js +55 -21
  343. package/dist/core/trust-manager.js.map +1 -1
  344. package/dist/core/usage-totals.d.ts +19 -0
  345. package/dist/core/usage-totals.d.ts.map +1 -0
  346. package/dist/core/usage-totals.js +52 -0
  347. package/dist/core/usage-totals.js.map +1 -0
  348. package/dist/extensions/index.d.ts +3 -0
  349. package/dist/extensions/index.d.ts.map +1 -0
  350. package/dist/extensions/index.js +7 -0
  351. package/dist/extensions/index.js.map +1 -0
  352. package/dist/extensions/llama/client.d.ts +61 -0
  353. package/dist/extensions/llama/client.d.ts.map +1 -0
  354. package/dist/extensions/llama/client.js +300 -0
  355. package/dist/extensions/llama/client.js.map +1 -0
  356. package/dist/extensions/llama/huggingface.d.ts +23 -0
  357. package/dist/extensions/llama/huggingface.d.ts.map +1 -0
  358. package/dist/extensions/llama/huggingface.js +139 -0
  359. package/dist/extensions/llama/huggingface.js.map +1 -0
  360. package/dist/extensions/llama/index.d.ts +3 -0
  361. package/dist/extensions/llama/index.d.ts.map +1 -0
  362. package/dist/extensions/llama/index.js +208 -0
  363. package/dist/extensions/llama/index.js.map +1 -0
  364. package/dist/extensions/llama/provider.d.ts +10 -0
  365. package/dist/extensions/llama/provider.d.ts.map +1 -0
  366. package/dist/extensions/llama/provider.js +111 -0
  367. package/dist/extensions/llama/provider.js.map +1 -0
  368. package/dist/extensions/llama/ui.d.ts +42 -0
  369. package/dist/extensions/llama/ui.d.ts.map +1 -0
  370. package/dist/extensions/llama/ui.js +400 -0
  371. package/dist/extensions/llama/ui.js.map +1 -0
  372. package/dist/extensions/stub-provider/index.d.ts +9 -0
  373. package/dist/extensions/stub-provider/index.d.ts.map +1 -0
  374. package/dist/extensions/stub-provider/index.js +13 -0
  375. package/dist/extensions/stub-provider/index.js.map +1 -0
  376. package/dist/extensions/stub-provider/provider.d.ts +77 -0
  377. package/dist/extensions/stub-provider/provider.d.ts.map +1 -0
  378. package/dist/extensions/stub-provider/provider.js +193 -0
  379. package/dist/extensions/stub-provider/provider.js.map +1 -0
  380. package/dist/hooks/gsd/draht-quality-gate.js +3 -3
  381. package/dist/index.d.ts +4 -3
  382. package/dist/index.d.ts.map +1 -1
  383. package/dist/index.js +3 -3
  384. package/dist/index.js.map +1 -1
  385. package/dist/main.d.ts.map +1 -1
  386. package/dist/main.js +305 -61
  387. package/dist/main.js.map +1 -1
  388. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  389. package/dist/modes/interactive/components/assistant-message.js +22 -10
  390. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  391. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  392. package/dist/modes/interactive/components/config-selector.js +3 -2
  393. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  394. package/dist/modes/interactive/components/custom-editor.js +1 -1
  395. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  396. package/dist/modes/interactive/components/custom-message.d.ts +3 -1
  397. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  398. package/dist/modes/interactive/components/custom-message.js +9 -2
  399. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  400. package/dist/modes/interactive/components/extension-editor.d.ts +1 -2
  401. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  402. package/dist/modes/interactive/components/extension-editor.js +16 -46
  403. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  404. package/dist/modes/interactive/components/extension-selector.d.ts +49 -0
  405. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  406. package/dist/modes/interactive/components/extension-selector.js +202 -5
  407. package/dist/modes/interactive/components/extension-selector.js.map +1 -1
  408. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  409. package/dist/modes/interactive/components/footer.js +24 -23
  410. package/dist/modes/interactive/components/footer.js.map +1 -1
  411. package/dist/modes/interactive/components/login-dialog.d.ts +5 -5
  412. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  413. package/dist/modes/interactive/components/login-dialog.js +17 -8
  414. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  415. package/dist/modes/interactive/components/model-selector.d.ts +11 -4
  416. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  417. package/dist/modes/interactive/components/model-selector.js +74 -41
  418. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  419. package/dist/modes/interactive/components/oauth-selector.d.ts +4 -4
  420. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  421. package/dist/modes/interactive/components/oauth-selector.js +14 -25
  422. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  423. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  424. package/dist/modes/interactive/components/scoped-models-selector.js +22 -13
  425. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  426. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  427. package/dist/modes/interactive/components/session-selector.js +10 -2
  428. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  429. package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
  430. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  431. package/dist/modes/interactive/components/settings-selector.js +10 -0
  432. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  433. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  434. package/dist/modes/interactive/components/tool-execution.js +10 -1
  435. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  436. package/dist/modes/interactive/components/tree-selector.d.ts +25 -2
  437. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  438. package/dist/modes/interactive/components/tree-selector.js +68 -17
  439. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  440. package/dist/modes/interactive/external-editor.d.ts +12 -0
  441. package/dist/modes/interactive/external-editor.d.ts.map +1 -0
  442. package/dist/modes/interactive/external-editor.js +37 -0
  443. package/dist/modes/interactive/external-editor.js.map +1 -0
  444. package/dist/modes/interactive/interactive-mode.d.ts +107 -10
  445. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  446. package/dist/modes/interactive/interactive-mode.js +763 -285
  447. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  448. package/dist/modes/rpc/rpc-client.d.ts +4 -0
  449. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  450. package/dist/modes/rpc/rpc-client.js +7 -0
  451. package/dist/modes/rpc/rpc-client.js.map +1 -1
  452. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  453. package/dist/modes/rpc/rpc-mode.js +185 -9
  454. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  455. package/dist/modes/rpc/rpc-types.d.ts +79 -1
  456. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  457. package/dist/modes/rpc/rpc-types.js.map +1 -1
  458. package/dist/package-manager-cli.d.ts.map +1 -1
  459. package/dist/package-manager-cli.js +67 -5
  460. package/dist/package-manager-cli.js.map +1 -1
  461. package/dist/prompts/commands/atomic-commit.md +1 -12
  462. package/dist/prompts/commands/brainstorm.md +12 -15
  463. package/dist/prompts/commands/create-verification-skill.md +108 -0
  464. package/dist/prompts/commands/discuss-phase.md +3 -14
  465. package/dist/prompts/commands/execute-phase.md +3 -11
  466. package/dist/prompts/commands/fix.md +41 -18
  467. package/dist/prompts/commands/grill.md +66 -0
  468. package/dist/prompts/commands/init-project.md +5 -15
  469. package/dist/prompts/commands/map-codebase.md +1 -13
  470. package/dist/prompts/commands/new-project.md +5 -15
  471. package/dist/prompts/commands/next-milestone.md +1 -13
  472. package/dist/prompts/commands/orchestrate.md +1 -1
  473. package/dist/prompts/commands/pause-work.md +1 -13
  474. package/dist/prompts/commands/plan-phase.md +2 -11
  475. package/dist/prompts/commands/progress.md +0 -13
  476. package/dist/prompts/commands/quick.md +3 -11
  477. package/dist/prompts/commands/resolve-conflicts.md +71 -0
  478. package/dist/prompts/commands/resume-work.md +0 -13
  479. package/dist/prompts/commands/review.md +4 -13
  480. package/dist/prompts/commands/triage.md +159 -0
  481. package/dist/prompts/commands/verify-work.md +4 -14
  482. package/dist/prompts/commands/why.md +135 -0
  483. package/dist/skills/atomic-reasoning/SKILL.md +115 -0
  484. package/dist/skills/blast-radius/SKILL.md +55 -0
  485. package/dist/skills/epistemics/SKILL.md +99 -0
  486. package/dist/skills/hexagon-animation/SKILL.md +49 -0
  487. package/dist/skills/hexagon-animation/generate.mjs +81 -0
  488. package/dist/skills/hexagon-animation/template.html +361 -0
  489. package/dist/skills/typescript-discipline/SKILL.md +50 -0
  490. package/dist/skills/typescript-discipline/references/patterns.md +294 -0
  491. package/dist/skills/unslop/SKILL.md +101 -0
  492. package/dist/utils/canonical-path.d.ts +28 -0
  493. package/dist/utils/canonical-path.d.ts.map +1 -0
  494. package/dist/utils/canonical-path.js +90 -0
  495. package/dist/utils/canonical-path.js.map +1 -0
  496. package/dist/utils/child-process.d.ts +12 -1
  497. package/dist/utils/child-process.d.ts.map +1 -1
  498. package/dist/utils/child-process.js +25 -8
  499. package/dist/utils/child-process.js.map +1 -1
  500. package/dist/utils/clipboard-native.d.ts +1 -0
  501. package/dist/utils/clipboard-native.d.ts.map +1 -1
  502. package/dist/utils/clipboard-native.js.map +1 -1
  503. package/dist/utils/clipboard.d.ts +2 -0
  504. package/dist/utils/clipboard.d.ts.map +1 -1
  505. package/dist/utils/clipboard.js +53 -9
  506. package/dist/utils/clipboard.js.map +1 -1
  507. package/dist/utils/exif-orientation.d.ts.map +1 -1
  508. package/dist/utils/exif-orientation.js +2 -3
  509. package/dist/utils/exif-orientation.js.map +1 -1
  510. package/dist/utils/paths.d.ts +2 -7
  511. package/dist/utils/paths.d.ts.map +1 -1
  512. package/dist/utils/paths.js +13 -15
  513. package/dist/utils/paths.js.map +1 -1
  514. package/dist/utils/shell.d.ts.map +1 -1
  515. package/dist/utils/shell.js +6 -4
  516. package/dist/utils/shell.js.map +1 -1
  517. package/dist/utils/tools-manager.d.ts.map +1 -1
  518. package/dist/utils/tools-manager.js +3 -5
  519. package/dist/utils/tools-manager.js.map +1 -1
  520. package/dist/utils/version-check.d.ts.map +1 -1
  521. package/dist/utils/version-check.js +3 -1
  522. package/dist/utils/version-check.js.map +1 -1
  523. package/docs/attachable-sessions.md +79 -0
  524. package/docs/compaction.md +29 -24
  525. package/docs/containerization.md +23 -23
  526. package/docs/custom-provider.md +66 -32
  527. package/docs/development.md +9 -9
  528. package/docs/docs.json +6 -2
  529. package/docs/duet.md +42 -0
  530. package/docs/environment-variables.md +88 -0
  531. package/docs/extensions.md +278 -65
  532. package/docs/index.md +12 -10
  533. package/docs/json.md +12 -8
  534. package/docs/keybindings.md +8 -5
  535. package/docs/llama-cpp.md +99 -0
  536. package/docs/models.md +19 -8
  537. package/docs/packages.md +43 -42
  538. package/docs/prompt-templates.md +5 -4
  539. package/docs/providers.md +45 -11
  540. package/docs/quickstart.md +33 -33
  541. package/docs/rpc.md +190 -19
  542. package/docs/sdk.md +18 -15
  543. package/docs/security.md +18 -18
  544. package/docs/session-format.md +53 -15
  545. package/docs/sessions.md +17 -14
  546. package/docs/settings.md +26 -19
  547. package/docs/shell-aliases.md +2 -2
  548. package/docs/skills.md +12 -11
  549. package/docs/terminal-setup.md +12 -12
  550. package/docs/termux.md +6 -6
  551. package/docs/themes.md +11 -11
  552. package/docs/tmux.md +4 -4
  553. package/docs/tui.md +46 -31
  554. package/docs/usage.md +53 -63
  555. package/docs/windows.md +2 -2
  556. package/examples/extensions/custom-compaction.ts +4 -0
  557. package/examples/extensions/custom-provider-anthropic/index.ts +9 -3
  558. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  559. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  560. package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
  561. package/examples/extensions/gondolin/package.json +2 -2
  562. package/examples/extensions/handoff.ts +9 -1
  563. package/examples/extensions/kimi-deferred-tools.ts +61 -0
  564. package/examples/extensions/message-renderer.ts +2 -2
  565. package/examples/extensions/overlay-qa-tests.ts +3 -3
  566. package/examples/extensions/sandbox/package.json +1 -1
  567. package/examples/extensions/summarize.ts +3 -0
  568. package/examples/extensions/with-deps/package.json +1 -1
  569. package/examples/sdk/02-custom-model.ts +5 -8
  570. package/examples/sdk/09-api-keys-and-oauth.ts +15 -31
  571. package/examples/sdk/12-full-control.ts +9 -12
  572. package/hooks/gsd/draht-quality-gate.js +3 -3
  573. package/package.json +14 -11
  574. package/prompts/commands/atomic-commit.md +1 -12
  575. package/prompts/commands/brainstorm.md +12 -15
  576. package/prompts/commands/create-verification-skill.md +108 -0
  577. package/prompts/commands/discuss-phase.md +3 -14
  578. package/prompts/commands/execute-phase.md +3 -11
  579. package/prompts/commands/fix.md +41 -18
  580. package/prompts/commands/grill.md +66 -0
  581. package/prompts/commands/init-project.md +5 -15
  582. package/prompts/commands/map-codebase.md +1 -13
  583. package/prompts/commands/new-project.md +5 -15
  584. package/prompts/commands/next-milestone.md +1 -13
  585. package/prompts/commands/orchestrate.md +1 -1
  586. package/prompts/commands/pause-work.md +1 -13
  587. package/prompts/commands/plan-phase.md +2 -11
  588. package/prompts/commands/progress.md +0 -13
  589. package/prompts/commands/quick.md +3 -11
  590. package/prompts/commands/resolve-conflicts.md +71 -0
  591. package/prompts/commands/resume-work.md +0 -13
  592. package/prompts/commands/review.md +4 -13
  593. package/prompts/commands/triage.md +159 -0
  594. package/prompts/commands/verify-work.md +4 -14
  595. package/prompts/commands/why.md +135 -0
  596. package/skills/atomic-reasoning/SKILL.md +115 -0
  597. package/skills/blast-radius/SKILL.md +55 -0
  598. package/skills/epistemics/SKILL.md +99 -0
  599. package/skills/hexagon-animation/SKILL.md +49 -0
  600. package/skills/hexagon-animation/generate.mjs +81 -0
  601. package/skills/hexagon-animation/template.html +361 -0
  602. package/skills/typescript-discipline/SKILL.md +50 -0
  603. package/skills/typescript-discipline/references/patterns.md +294 -0
  604. package/skills/unslop/SKILL.md +101 -0
  605. package/dist/core/provider-display-names.d.ts +0 -2
  606. package/dist/core/provider-display-names.d.ts.map +0 -1
  607. package/dist/core/provider-display-names.js +0 -36
  608. package/dist/core/provider-display-names.js.map +0 -1
  609. package/dist/prompts/agents/build.md +0 -86
  610. package/dist/prompts/agents/plan.md +0 -79
  611. package/dist/prompts/agents/verify.md +0 -69
  612. package/prompts/agents/build.md +0 -86
  613. package/prompts/agents/plan.md +0 -79
  614. package/prompts/agents/verify.md +0 -69
package/docs/rpc.md CHANGED
@@ -7,7 +7,7 @@ RPC mode enables headless operation of the coding agent via a JSON protocol over
7
7
  ## Starting RPC Mode
8
8
 
9
9
  ```bash
10
- pi --mode rpc [options]
10
+ draht --mode rpc [options]
11
11
  ```
12
12
 
13
13
  Common options:
@@ -23,7 +23,7 @@ Common options:
23
23
  - **Responses**: JSON objects with `type: "response"` indicating command success/failure
24
24
  - **Events**: Agent events streamed to stdout as JSON lines
25
25
 
26
- All commands support an optional `id` field for request/response correlation. If provided, the corresponding response will include the same `id`.
26
+ All commands support an optional `id` field for request/response correlation. If provided, the corresponding response will include the same `id`. `bash_execution_update` events also include the `id` of their originating `bash` command.
27
27
 
28
28
  ### Framing
29
29
 
@@ -313,6 +313,26 @@ Response:
313
313
  }
314
314
  ```
315
315
 
316
+ #### get_available_thinking_levels
317
+
318
+ List the thinking levels supported by the current model. Returns `["off"]` for a model without reasoning support.
319
+
320
+ ```json
321
+ {"type": "get_available_thinking_levels"}
322
+ ```
323
+
324
+ Response:
325
+ ```json
326
+ {
327
+ "type": "response",
328
+ "command": "get_available_thinking_levels",
329
+ "success": true,
330
+ "data": {
331
+ "levels": ["off", "minimal", "low", "medium", "high"]
332
+ }
333
+ }
334
+ ```
335
+
316
336
  ### Queue Modes
317
337
 
318
338
  #### set_steering_mode
@@ -374,11 +394,22 @@ Response:
374
394
  "summary": "Summary of conversation...",
375
395
  "firstKeptEntryId": "abc123",
376
396
  "tokensBefore": 150000,
397
+ "estimatedTokensAfter": 32000,
398
+ "usage": {
399
+ "input": 32000,
400
+ "output": 1200,
401
+ "cacheRead": 0,
402
+ "cacheWrite": 0,
403
+ "totalTokens": 33200,
404
+ "cost": {"input": 0.01, "output": 0.02, "cacheRead": 0, "cacheWrite": 0, "total": 0.03}
405
+ },
377
406
  "details": {}
378
407
  }
379
408
  }
380
409
  ```
381
410
 
411
+ `estimatedTokensAfter` is a heuristic estimate over the rebuilt message context immediately after compaction, not a provider-exact token count. `usage` reports the LLM call or calls that generated the summary and may be omitted by custom compaction handlers.
412
+
382
413
  #### set_auto_compaction
383
414
 
384
415
  Enable or disable automatic compaction when context is nearly full.
@@ -424,15 +455,18 @@ Response:
424
455
 
425
456
  #### bash
426
457
 
427
- Execute a shell command and add output to conversation context.
458
+ Execute a shell command and add output to conversation context. Output streams as `bash_execution_update` events while the command runs; the response contains the final result.
428
459
 
429
460
  ```json
430
- {"type": "bash", "command": "ls -la"}
461
+ {"id": "req-1", "type": "bash", "command": "ls -la"}
431
462
  ```
432
463
 
464
+ Include an `id` to associate streamed `bash_execution_update` events with this command.
465
+
433
466
  Response:
434
467
  ```json
435
468
  {
469
+ "id": "req-1",
436
470
  "type": "response",
437
471
  "command": "bash",
438
472
  "success": true,
@@ -463,7 +497,7 @@ If output was truncated, includes `fullOutputPath`:
463
497
 
464
498
  **How bash results reach the LLM:**
465
499
 
466
- The `bash` command executes immediately and returns a `BashResult`. Internally, a `BashExecutionMessage` is created and stored in the agent's message state. This message does NOT emit an event.
500
+ The `bash` command executes immediately and returns a `BashResult`. Internally, a `BashExecutionMessage` is created and stored in the agent's message state.
467
501
 
468
502
  When the next `prompt` command is sent, all messages (including `BashExecutionMessage`) are transformed before being sent to the LLM. The `BashExecutionMessage` is converted to a `UserMessage` with this format:
469
503
 
@@ -478,7 +512,6 @@ drwxr-xr-x ...
478
512
  This means:
479
513
  1. Bash output is included in the LLM context on the **next prompt**, not immediately
480
514
  2. Multiple bash commands can be executed before a prompt; all outputs will be included
481
- 3. No event is emitted for the `BashExecutionMessage` itself
482
515
 
483
516
  #### abort_bash
484
517
 
@@ -534,7 +567,7 @@ Response:
534
567
  }
535
568
  ```
536
569
 
537
- `tokens` contains assistant usage totals for the current session state. `contextUsage` contains the actual current context-window estimate used for compaction and footer display.
570
+ `tokens` and `cost` include assistant messages, usage reported by tools, and compaction/branch-summary generation across the full session. `contextUsage` contains the actual current context-window estimate used for compaction and footer display.
538
571
 
539
572
  `contextUsage` is omitted when no model or context window is available. `contextUsage.tokens` and `contextUsage.percent` are `null` immediately after compaction until a fresh post-compaction assistant response provides valid usage data.
540
573
 
@@ -753,7 +786,7 @@ Response:
753
786
  }
754
787
  ```
755
788
 
756
- The current session name is available via `get_state` in the `sessionName` field. To set the initial name when starting RPC mode, pass `--name <name>` or `-n <name>` to the `pi --mode rpc` process.
789
+ The current session name is available via `get_state` in the `sessionName` field. To set the initial name when starting RPC mode, pass `--name <name>` or `-n <name>` to the `draht --mode rpc` process.
757
790
 
758
791
  ### Commands
759
792
 
@@ -773,9 +806,9 @@ Response:
773
806
  "success": true,
774
807
  "data": {
775
808
  "commands": [
776
- {"name": "session-name", "description": "Set or clear session name", "source": "extension", "path": "/home/user/.pi/agent/extensions/session.ts"},
777
- {"name": "fix-tests", "description": "Fix failing tests", "source": "prompt", "location": "project", "path": "/home/user/myproject/.pi/agent/prompts/fix-tests.md"},
778
- {"name": "skill:brave-search", "description": "Web search via Brave API", "source": "skill", "location": "user", "path": "/home/user/.pi/agent/skills/brave-search/SKILL.md"}
809
+ {"name": "session-name", "description": "Set or clear session name", "source": "extension", "path": "/home/user/.draht/agent/extensions/session.ts"},
810
+ {"name": "fix-tests", "description": "Fix failing tests", "source": "prompt", "location": "project", "path": "/home/user/myproject/.draht/agent/prompts/fix-tests.md"},
811
+ {"name": "skill:brave-search", "description": "Web search via Brave API", "source": "skill", "location": "user", "path": "/home/user/.draht/agent/skills/brave-search/SKILL.md"}
779
812
  ]
780
813
  }
781
814
  }
@@ -789,8 +822,8 @@ Each command has:
789
822
  - `"prompt"`: Loaded from a prompt template `.md` file
790
823
  - `"skill"`: Loaded from a skill directory (name is prefixed with `skill:`)
791
824
  - `location`: Where it was loaded from (optional, not present for extensions):
792
- - `"user"`: User-level (`~/.pi/agent/`)
793
- - `"project"`: Project-level (`./.pi/agent/`)
825
+ - `"user"`: User-level (`~/.draht/agent/`)
826
+ - `"project"`: Project-level (`./.draht/agent/`)
794
827
  - `"path"`: Explicit path via CLI or settings
795
828
  - `path`: Absolute file path to the command source (optional)
796
829
 
@@ -798,7 +831,7 @@ Each command has:
798
831
 
799
832
  ## Events
800
833
 
801
- Events are streamed to stdout as JSON lines during agent operation. Events do NOT include an `id` field (only responses do).
834
+ Events are streamed to stdout as JSON lines during agent operation. Events do not generally include an `id` field; `bash_execution_update` includes the `id` of its originating `bash` command when one was provided.
802
835
 
803
836
  ### Event Types
804
837
 
@@ -812,6 +845,7 @@ Events are streamed to stdout as JSON lines during agent operation. Events do NO
812
845
  | `message_start` | Message begins |
813
846
  | `message_update` | Streaming update (text/thinking/toolcall deltas) |
814
847
  | `message_end` | Message completes |
848
+ | `bash_execution_update` | Direct RPC bash command output chunk |
815
849
  | `tool_execution_start` | Tool begins execution |
816
850
  | `tool_execution_update` | Tool execution progress (streaming output) |
817
851
  | `tool_execution_end` | Tool completes |
@@ -820,6 +854,9 @@ Events are streamed to stdout as JSON lines during agent operation. Events do NO
820
854
  | `compaction_end` | Compaction completes |
821
855
  | `auto_retry_start` | Auto-retry begins (after transient error) |
822
856
  | `auto_retry_end` | Auto-retry completes (success or final failure) |
857
+ | `summarization_retry_scheduled` | Retry scheduled for a transient compaction or branch-summary summarization error |
858
+ | `summarization_retry_attempt_start` | Retried summarization request starts |
859
+ | `summarization_retry_finished` | Summarization retry loop completes |
823
860
  | `extension_error` | Extension threw an error |
824
861
 
825
862
  ### agent_start
@@ -844,7 +881,7 @@ Emitted when one low-level agent run completes. Contains all messages generated
844
881
 
845
882
  ### agent_settled
846
883
 
847
- Emitted after the full session-level run settles. At this point Pi will not continue automatically through retry, compaction retry, or queued follow-up messages.
884
+ Emitted after the full session-level run settles. At this point draht will not continue automatically through retry, compaction retry, or queued follow-up messages.
848
885
 
849
886
  ```json
850
887
  {"type": "agent_settled"}
@@ -917,6 +954,20 @@ Example streaming a text response:
917
954
  {"type":"message_update","message":{...},"assistantMessageEvent":{"type":"text_end","contentIndex":0,"content":"Hello world","partial":{...}}}
918
955
  ```
919
956
 
957
+ ### bash_execution_update
958
+
959
+ Emitted once for each output chunk from a direct `bash` command. `id` matches the command's `id`, allowing clients to associate output with the correct command.
960
+
961
+ Events stream all output while the command runs, even if the final `bash` response's `output` is truncated.
962
+
963
+ ```json
964
+ {
965
+ "type": "bash_execution_update",
966
+ "id": "req-1",
967
+ "delta": "total 48\n"
968
+ }
969
+ ```
970
+
920
971
  ### tool_execution_start / tool_execution_update / tool_execution_end
921
972
 
922
973
  Emitted when a tool begins, streams progress, and completes execution.
@@ -992,6 +1043,15 @@ The `reason` field is `"manual"`, `"threshold"`, or `"overflow"`.
992
1043
  "summary": "Summary of conversation...",
993
1044
  "firstKeptEntryId": "abc123",
994
1045
  "tokensBefore": 150000,
1046
+ "estimatedTokensAfter": 32000,
1047
+ "usage": {
1048
+ "input": 32000,
1049
+ "output": 1200,
1050
+ "cacheRead": 0,
1051
+ "cacheWrite": 0,
1052
+ "totalTokens": 33200,
1053
+ "cost": {"input": 0.01, "output": 0.02, "cacheRead": 0, "cacheWrite": 0, "total": 0.03}
1054
+ },
995
1055
  "details": {}
996
1056
  },
997
1057
  "aborted": false,
@@ -1037,6 +1097,36 @@ On final failure (max retries exceeded):
1037
1097
  }
1038
1098
  ```
1039
1099
 
1100
+ ### summarization_retry_scheduled / summarization_retry_attempt_start / summarization_retry_finished
1101
+
1102
+ Emitted when compaction or branch-summary summarization retries after a transient provider error. These events use the same retry settings as automatic assistant-turn retries.
1103
+
1104
+ ```json
1105
+ {
1106
+ "type": "summarization_retry_scheduled",
1107
+ "attempt": 1,
1108
+ "maxAttempts": 3,
1109
+ "delayMs": 2000,
1110
+ "errorMessage": "terminated"
1111
+ }
1112
+ ```
1113
+
1114
+ ```json
1115
+ {
1116
+ "type": "summarization_retry_attempt_start",
1117
+ "source": "compaction",
1118
+ "reason": "threshold"
1119
+ }
1120
+ ```
1121
+
1122
+ For branch summaries, `source` is `"branchSummary"` and no `reason` is present.
1123
+
1124
+ ```json
1125
+ {
1126
+ "type": "summarization_retry_finished"
1127
+ }
1128
+ ```
1129
+
1040
1130
  ### extension_error
1041
1131
 
1042
1132
  Emitted when an extension throws an error.
@@ -1201,7 +1291,7 @@ Set the terminal window/tab title. Fire-and-forget.
1201
1291
  "type": "extension_ui_request",
1202
1292
  "id": "uuid-8",
1203
1293
  "method": "setTitle",
1204
- "title": "pi - my project"
1294
+ "title": "draht - my project"
1205
1295
  }
1206
1296
  ```
1207
1297
 
@@ -1220,7 +1310,7 @@ Set the text in the input editor. Fire-and-forget.
1220
1310
 
1221
1311
  ### Extension UI Responses (stdin)
1222
1312
 
1223
- Responses are sent for dialog methods only (`select`, `confirm`, `input`, `editor`). The `id` must match the request.
1313
+ Responses are sent for dialog methods only (`select`, `confirm`, `input`, `editor`). The `id` must match the request. An answer whose `id` matches no open dialog is silently dropped.
1224
1314
 
1225
1315
  #### Value response (select, input, editor)
1226
1316
 
@@ -1234,6 +1324,77 @@ Responses are sent for dialog methods only (`select`, `confirm`, `input`, `edito
1234
1324
  {"type": "extension_ui_response", "id": "uuid-2", "confirmed": true}
1235
1325
  ```
1236
1326
 
1327
+ #### Naming the option that was chosen (`optionId`)
1328
+
1329
+ A request may carry a `detail` object describing what is being decided. When it does, `detail.options`
1330
+ is the immutable set of options that request offered, each stating its own meaning:
1331
+
1332
+ ```json
1333
+ {
1334
+ "type": "extension_ui_request",
1335
+ "id": "uuid-2",
1336
+ "method": "confirm",
1337
+ "title": "Approve tool call?",
1338
+ "message": "bash wants to run a command",
1339
+ "detail": {
1340
+ "kind": "tool_permission",
1341
+ "toolCallId": "call-1",
1342
+ "toolName": "bash",
1343
+ "cwd": "/private/tmp/project",
1344
+ "command": "rm -rf build",
1345
+ "reason": "bash commands require approval by default",
1346
+ "options": [
1347
+ {"id": "approve", "label": "Yes", "decision": "approve"},
1348
+ {"id": "deny", "label": "No", "decision": "deny"}
1349
+ ]
1350
+ }
1351
+ }
1352
+ ```
1353
+
1354
+ An answer may name which of those options was chosen by adding `optionId`:
1355
+
1356
+ ```json
1357
+ {"type": "extension_ui_response", "id": "uuid-2", "confirmed": false, "optionId": "deny"}
1358
+ ```
1359
+
1360
+ Rules, all enforced by the agent:
1361
+
1362
+ - `optionId` is **optional**. Clients that only know yes/no keep sending `confirmed` alone and are
1363
+ unaffected.
1364
+ - When present, it **decides**: the named option's own `decision` (`"approve"` or `"deny"`) wins over
1365
+ `confirmed`, in both directions. `{"confirmed": true, "optionId": "deny"}` denies. Never infer an
1366
+ option's meaning from its position in the array, from the array's length, or from its id — read
1367
+ `decision`.
1368
+ - When present, it must be **one of the ids that this request offered**. An id nobody offered, an id
1369
+ that appears twice in the offered set, and a present-but-non-string value such as
1370
+ `{"optionId": 123}` are all refused (see below). A wrongly-typed `optionId` is *not* treated as
1371
+ absent.
1372
+ - When the matching request offered **no options** — any dialog raised without `detail`, such as
1373
+ `/rewind`'s "Restore files?" confirm or `/agent`'s picker — there is nothing to validate against,
1374
+ so `optionId` is ignored and the answer decides on `confirmed` / `value` as usual. A client may
1375
+ therefore attach `optionId` unconditionally without risk of stranding those dialogs.
1376
+
1377
+ #### Refused response (`command: "extension_ui_response"`)
1378
+
1379
+ A rejected `optionId` is reported on stdout as an ordinary failed-command response — note that
1380
+ `command` here is `"extension_ui_response"`, a value **no client ever sends as a command**. Clients
1381
+ that switch exhaustively on `command` must expect it:
1382
+
1383
+ ```json
1384
+ {
1385
+ "id": "uuid-2",
1386
+ "type": "response",
1387
+ "command": "extension_ui_response",
1388
+ "success": false,
1389
+ "error": "optionId \"not-an-option\" is not one of the options offered for this request; the request is still pending"
1390
+ }
1391
+ ```
1392
+
1393
+ The `id` is the **dialog request id**, not a command id. The refusal does **not** consume the
1394
+ request: the dialog is still open and still answerable, and a subsequent valid answer — with a good
1395
+ `optionId`, or with none at all — decides it. A client that receives this line should correct its
1396
+ answer and send it again; ignoring it leaves the agent waiting.
1397
+
1237
1398
  #### Cancellation response (any dialog)
1238
1399
 
1239
1400
  Dismiss any dialog method. The extension receives `undefined` (for select/input/editor) or `false` (for confirm).
@@ -1344,11 +1505,21 @@ Stop reasons: `"stop"`, `"length"`, `"toolUse"`, `"error"`, `"aborted"`
1344
1505
  "toolCallId": "call_123",
1345
1506
  "toolName": "bash",
1346
1507
  "content": [{"type": "text", "text": "total 48\ndrwxr-xr-x ..."}],
1508
+ "usage": {
1509
+ "input": 100,
1510
+ "output": 50,
1511
+ "cacheRead": 0,
1512
+ "cacheWrite": 0,
1513
+ "totalTokens": 150,
1514
+ "cost": {"input": 0.0003, "output": 0.00075, "cacheRead": 0, "cacheWrite": 0, "total": 0.00105}
1515
+ },
1347
1516
  "isError": false,
1348
1517
  "timestamp": 1733234567890
1349
1518
  }
1350
1519
  ```
1351
1520
 
1521
+ `usage` is optional and reports nested LLM work performed by the tool. When present, it contributes to session token and cost totals.
1522
+
1352
1523
  ### BashExecutionMessage
1353
1524
 
1354
1525
  Created by the `bash` RPC command (not by LLM tool calls):
@@ -1388,7 +1559,7 @@ import subprocess
1388
1559
  import json
1389
1560
 
1390
1561
  proc = subprocess.Popen(
1391
- ["pi", "--mode", "rpc", "--no-session"],
1562
+ ["draht", "--mode", "rpc", "--no-session"],
1392
1563
  stdin=subprocess.PIPE,
1393
1564
  stdout=subprocess.PIPE,
1394
1565
  text=True
@@ -1427,7 +1598,7 @@ For a complete example of handling the extension UI protocol, see [`examples/rpc
1427
1598
  const { spawn } = require("child_process");
1428
1599
  const { StringDecoder } = require("string_decoder");
1429
1600
 
1430
- const agent = spawn("pi", ["--mode", "rpc", "--no-session"]);
1601
+ const agent = spawn("draht", ["--mode", "rpc", "--no-session"]);
1431
1602
 
1432
1603
  function attachJsonlReader(stream, onLine) {
1433
1604
  const decoder = new StringDecoder("utf8");
package/docs/sdk.md CHANGED
@@ -1,8 +1,8 @@
1
- > pi can help you use the SDK. Ask it to build an integration for your use case.
1
+ > draht can help you use the SDK. Ask it to build an integration for your use case.
2
2
 
3
3
  # SDK
4
4
 
5
- The SDK provides programmatic access to pi's agent capabilities. Use it to embed pi in other applications, build custom interfaces, or integrate with automated workflows.
5
+ The SDK provides programmatic access to draht's agent capabilities. Use it to embed draht in other applications, build custom interfaces, or integrate with automated workflows.
6
6
 
7
7
  **Example use cases:**
8
8
  - Build a custom UI (web, desktop, mobile)
@@ -88,8 +88,8 @@ interface AgentSession {
88
88
  sessionId: string;
89
89
 
90
90
  // Model control
91
- setModel(model: Model): Promise<void>;
92
- setThinkingLevel(level: ThinkingLevel): void;
91
+ setModel(model: Model, options?: { persistDefault?: boolean }): Promise<void>;
92
+ setThinkingLevel(level: ThinkingLevel, options?: { persistDefault?: boolean }): void;
93
93
  cycleModel(): Promise<ModelCycleResult | undefined>;
94
94
  cycleThinkingLevel(): ThinkingLevel | undefined;
95
95
 
@@ -323,6 +323,9 @@ session.subscribe((event) => {
323
323
  case "compaction_end":
324
324
  case "auto_retry_start":
325
325
  case "auto_retry_end":
326
+ case "summarization_retry_scheduled":
327
+ case "summarization_retry_attempt_start":
328
+ case "summarization_retry_finished":
326
329
  break;
327
330
  }
328
331
  });
@@ -338,23 +341,23 @@ const { session } = await createAgentSession({
338
341
  cwd: process.cwd(), // default
339
342
 
340
343
  // Global config directory
341
- agentDir: "~/.pi/agent", // default (expands ~)
344
+ agentDir: "~/.draht/agent", // default (expands ~)
342
345
  });
343
346
  ```
344
347
 
345
348
  `cwd` is used by `DefaultResourceLoader` for:
346
- - Project extensions (`.pi/extensions/`)
349
+ - Project extensions (`.draht/extensions/`)
347
350
  - Project skills:
348
- - `.pi/skills/`
351
+ - `.draht/skills/`
349
352
  - `.agents/skills/` in `cwd` and ancestor directories (up to git repo root, or filesystem root when not in a repo)
350
- - Project prompts (`.pi/prompts/`)
353
+ - Project prompts (`.draht/prompts/`)
351
354
  - Context files (`AGENTS.md` walking up from cwd)
352
355
  - Session directory naming
353
356
 
354
357
  `agentDir` is used by `DefaultResourceLoader` for:
355
358
  - Global extensions (`extensions/`)
356
359
  - Global skills:
357
- - `skills/` under `agentDir` (for example `~/.pi/agent/skills/`)
360
+ - `skills/` under `agentDir` (for example `~/.draht/agent/skills/`)
358
361
  - `~/.agents/skills/`
359
362
  - Global prompts (`prompts/`)
360
363
  - Global context file (`AGENTS.md`)
@@ -444,7 +447,7 @@ API key resolution priority (handled by AuthStorage):
444
447
  ```typescript
445
448
  import { AuthStorage, ModelRegistry } from "@draht/coding-agent";
446
449
 
447
- // Default: uses ~/.pi/agent/auth.json and ~/.pi/agent/models.json
450
+ // Default: uses ~/.draht/agent/auth.json and ~/.draht/agent/models.json
448
451
  const authStorage = AuthStorage.create();
449
452
  const modelRegistry = ModelRegistry.create(authStorage);
450
453
 
@@ -500,7 +503,7 @@ Specify which built-in tools to enable:
500
503
  - `noTools: "builtin"` disables default built-ins while keeping extension and custom tools enabled
501
504
  - `excludeTools` disables specific built-in, extension, or custom tool names after any `tools` allowlist is applied
502
505
 
503
- The `edit` tool returns `details.diff` for Pi's TUI display and `details.patch` as a standard unified patch for SDK consumers.
506
+ The `edit` tool returns `details.diff` for draht's TUI display and `details.patch` as a standard unified patch for SDK consumers.
504
507
 
505
508
  ```typescript
506
509
  import { createAgentSession } from "@draht/coding-agent";
@@ -582,7 +585,7 @@ If you pass `tools`, include each custom or extension tool name you want enabled
582
585
 
583
586
  ### Extensions
584
587
 
585
- Extensions are loaded by the `ResourceLoader`. `DefaultResourceLoader` discovers extensions from `~/.pi/agent/extensions/`, `.pi/extensions/`, and settings.json extension sources.
588
+ Extensions are loaded by the `ResourceLoader`. `DefaultResourceLoader` discovers extensions from `~/.draht/agent/extensions/`, `.draht/extensions/`, and settings.json extension sources.
586
589
 
587
590
  ```typescript
588
591
  import { createAgentSession, DefaultResourceLoader } from "@draht/coding-agent";
@@ -861,8 +864,8 @@ const { session } = await createAgentSession({
861
864
  **Project-specific settings:**
862
865
 
863
866
  Settings load from two locations and merge:
864
- 1. Global: `~/.pi/agent/settings.json`
865
- 2. Project: `<cwd>/.pi/settings.json`
867
+ 1. Global: `~/.draht/agent/settings.json`
868
+ 2. Project: `<cwd>/.draht/settings.json`
866
869
 
867
870
  Project overrides global. Nested objects merge keys. Setters modify global settings by default.
868
871
 
@@ -1122,7 +1125,7 @@ See [RPC documentation](rpc.md) for the JSON protocol.
1122
1125
  For subprocess-based integration without building with the SDK, use the CLI directly:
1123
1126
 
1124
1127
  ```bash
1125
- pi --mode rpc --no-session
1128
+ draht --mode rpc --no-session
1126
1129
  ```
1127
1130
 
1128
1131
  See [RPC documentation](rpc.md) for the JSON protocol.
package/docs/security.md CHANGED
@@ -1,47 +1,47 @@
1
1
  # Security
2
2
 
3
- Pi 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
+ 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.
4
4
 
5
5
  ## Project Trust
6
6
 
7
- Project trust controls whether pi 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
+ 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.
8
8
 
9
- Pi considers a project to have trust inputs when it finds any of these from the current working directory:
9
+ draht considers a project to have trust inputs when it finds any of these from the current working directory:
10
10
 
11
- - `.pi/` in the current directory
11
+ - `.draht/` in the current directory
12
12
  - `.agents/skills` in the current directory or an ancestor directory
13
13
 
14
- When an interactive session starts in a project with configs in `.pi` or `.agents/skills` and no saved decision for the current directory or a parent directory, pi 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 `~/.pi/agent/trust.json`, and the closest saved decision on the current or parent path applies before the global default.
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.
15
15
 
16
- Trusting a project allows pi to load trust-gated project inputs, including:
16
+ Trusting a project allows draht to load trust-gated project inputs, including:
17
17
 
18
- - `.pi/settings.json`
19
- - `.pi` resources such as extensions, skills, prompt templates, themes, and system prompt files
18
+ - `.draht/settings.json`
19
+ - `.draht` resources such as extensions, skills, prompt templates, themes, and system prompt files
20
20
  - missing project packages configured through project settings
21
21
  - project-local extensions and project package-managed extensions
22
22
 
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, pi 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.
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.
24
24
 
25
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.
26
26
 
27
27
  ## No Built-in Sandbox
28
28
 
29
- Pi 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 pi 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.
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.
30
30
 
31
- This is intentional. Pi 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.
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.
32
32
 
33
- Project trust is only an input-loading guard. It prevents a repository from silently changing pi'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 pi.
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.
34
34
 
35
35
  ## Running Untrusted or Unmonitored Work
36
36
 
37
- For untrusted repositories, generated code you do not intend to monitor closely, or unattended automation, run pi 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.
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.
38
38
 
39
39
  Common patterns are documented in [Containerization](containerization.md):
40
40
 
41
- - run the whole `pi` process inside OpenShell or Docker
42
- - run host pi while routing built-in tool execution into a Gondolin micro-VM
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
43
  - mount only the workspace paths the agent should access
44
- - avoid mounting host `~/.pi/agent` unless the container should access host sessions, settings, and credentials
44
+ - avoid mounting host `~/.draht/agent` unless the container should access host sessions, settings, and credentials
45
45
  - pass the minimum required API keys or use short-lived credentials
46
46
  - restrict network access when the task does not need it
47
47
  - review diffs and outputs before copying results back to trusted systems
@@ -50,6 +50,6 @@ If you bind-mount a host workspace read/write, writes from inside the container
50
50
 
51
51
  ## Reporting Security Issues
52
52
 
53
- To report a security issue, follow the repository [Security Policy](https://github.com/earendil-works/pi-mono/blob/main/SECURITY.md). Do not open a public issue for security-sensitive reports.
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.
54
54
 
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 pi grants access that the local user did not already have.
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.