@draht/coding-agent 2026.5.12 → 2026.6.11

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 (605) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/bin/draht-tools.cjs +3756 -1
  3. package/dist/bun/cli.d.ts.map +1 -1
  4. package/dist/bun/cli.js +4 -2
  5. package/dist/bun/cli.js.map +1 -1
  6. package/dist/bun/restore-sandbox-env.d.ts +13 -0
  7. package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
  8. package/dist/bun/restore-sandbox-env.js +32 -0
  9. package/dist/bun/restore-sandbox-env.js.map +1 -0
  10. package/dist/cli/args.d.ts +9 -4
  11. package/dist/cli/args.d.ts.map +1 -1
  12. package/dist/cli/args.js +88 -35
  13. package/dist/cli/args.js.map +1 -1
  14. package/dist/cli/config-selector.d.ts +2 -2
  15. package/dist/cli/config-selector.d.ts.map +1 -1
  16. package/dist/cli/config-selector.js +1 -1
  17. package/dist/cli/config-selector.js.map +1 -1
  18. package/dist/cli/file-processor.d.ts.map +1 -1
  19. package/dist/cli/file-processor.js +2 -3
  20. package/dist/cli/file-processor.js.map +1 -1
  21. package/dist/cli/initial-message.d.ts +1 -1
  22. package/dist/cli/initial-message.d.ts.map +1 -1
  23. package/dist/cli/initial-message.js.map +1 -1
  24. package/dist/cli/list-models.d.ts +1 -1
  25. package/dist/cli/list-models.d.ts.map +1 -1
  26. package/dist/cli/list-models.js +7 -1
  27. package/dist/cli/list-models.js.map +1 -1
  28. package/dist/cli/project-trust.d.ts +10 -0
  29. package/dist/cli/project-trust.d.ts.map +1 -0
  30. package/dist/cli/project-trust.js +48 -0
  31. package/dist/cli/project-trust.js.map +1 -0
  32. package/dist/cli/session-picker.d.ts +1 -1
  33. package/dist/cli/session-picker.d.ts.map +1 -1
  34. package/dist/cli/session-picker.js.map +1 -1
  35. package/dist/cli/startup-ui.d.ts +16 -0
  36. package/dist/cli/startup-ui.d.ts.map +1 -0
  37. package/dist/cli/startup-ui.js +112 -0
  38. package/dist/cli/startup-ui.js.map +1 -0
  39. package/dist/cli.d.ts.map +1 -1
  40. package/dist/cli.js +7 -4
  41. package/dist/cli.js.map +1 -1
  42. package/dist/config.d.ts +23 -13
  43. package/dist/config.d.ts.map +1 -1
  44. package/dist/config.js +264 -62
  45. package/dist/config.js.map +1 -1
  46. package/dist/core/agent-session-runtime.d.ts +45 -9
  47. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  48. package/dist/core/agent-session-runtime.js +100 -33
  49. package/dist/core/agent-session-runtime.js.map +1 -1
  50. package/dist/core/agent-session-services.d.ts +6 -4
  51. package/dist/core/agent-session-services.d.ts.map +1 -1
  52. package/dist/core/agent-session-services.js +7 -4
  53. package/dist/core/agent-session-services.js.map +1 -1
  54. package/dist/core/agent-session.d.ts +47 -31
  55. package/dist/core/agent-session.d.ts.map +1 -1
  56. package/dist/core/agent-session.js +470 -443
  57. package/dist/core/agent-session.js.map +1 -1
  58. package/dist/core/auth-guidance.d.ts +5 -0
  59. package/dist/core/auth-guidance.d.ts.map +1 -0
  60. package/dist/core/auth-guidance.js +21 -0
  61. package/dist/core/auth-guidance.js.map +1 -0
  62. package/dist/core/auth-storage.d.ts +10 -1
  63. package/dist/core/auth-storage.d.ts.map +1 -1
  64. package/dist/core/auth-storage.js +27 -6
  65. package/dist/core/auth-storage.js.map +1 -1
  66. package/dist/core/bash-executor.d.ts +1 -15
  67. package/dist/core/bash-executor.d.ts.map +1 -1
  68. package/dist/core/bash-executor.js +10 -24
  69. package/dist/core/bash-executor.js.map +1 -1
  70. package/dist/core/builtins/subagent.d.ts.map +1 -1
  71. package/dist/core/builtins/subagent.js +1 -2
  72. package/dist/core/builtins/subagent.js.map +1 -1
  73. package/dist/core/compaction/branch-summarization.d.ts +6 -4
  74. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  75. package/dist/core/compaction/branch-summarization.js +9 -3
  76. package/dist/core/compaction/branch-summarization.js.map +1 -1
  77. package/dist/core/compaction/compaction.d.ts +5 -5
  78. package/dist/core/compaction/compaction.d.ts.map +1 -1
  79. package/dist/core/compaction/compaction.js +43 -37
  80. package/dist/core/compaction/compaction.js.map +1 -1
  81. package/dist/core/compaction/index.d.ts +3 -3
  82. package/dist/core/compaction/index.d.ts.map +1 -1
  83. package/dist/core/compaction/index.js.map +1 -1
  84. package/dist/core/compaction/utils.d.ts +1 -1
  85. package/dist/core/compaction/utils.d.ts.map +1 -1
  86. package/dist/core/compaction/utils.js +1 -1
  87. package/dist/core/compaction/utils.js.map +1 -1
  88. package/dist/core/exec.d.ts.map +1 -1
  89. package/dist/core/exec.js.map +1 -1
  90. package/dist/core/experimental.d.ts +2 -0
  91. package/dist/core/experimental.d.ts.map +1 -0
  92. package/dist/core/experimental.js +4 -0
  93. package/dist/core/experimental.js.map +1 -0
  94. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  95. package/dist/core/export-html/ansi-to-html.js +1 -1
  96. package/dist/core/export-html/ansi-to-html.js.map +1 -1
  97. package/dist/core/export-html/index.d.ts +1 -1
  98. package/dist/core/export-html/index.d.ts.map +1 -1
  99. package/dist/core/export-html/index.js +13 -11
  100. package/dist/core/export-html/index.js.map +1 -1
  101. package/dist/core/export-html/template.css +69 -4
  102. package/dist/core/export-html/template.js +231 -57
  103. package/dist/core/export-html/tool-renderer.d.ts +0 -6
  104. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  105. package/dist/core/export-html/tool-renderer.js +15 -2
  106. package/dist/core/export-html/tool-renderer.js.map +1 -1
  107. package/dist/core/extensions/index.d.ts +8 -8
  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 +3 -3
  111. package/dist/core/extensions/loader.d.ts.map +1 -1
  112. package/dist/core/extensions/loader.js +27 -35
  113. package/dist/core/extensions/loader.js.map +1 -1
  114. package/dist/core/extensions/runner.d.ts +30 -12
  115. package/dist/core/extensions/runner.d.ts.map +1 -1
  116. package/dist/core/extensions/runner.js +215 -32
  117. package/dist/core/extensions/runner.js.map +1 -1
  118. package/dist/core/extensions/types.d.ts +163 -35
  119. package/dist/core/extensions/types.d.ts.map +1 -1
  120. package/dist/core/extensions/types.js.map +1 -1
  121. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  122. package/dist/core/extensions/wrapper.js +2 -2
  123. package/dist/core/extensions/wrapper.js.map +1 -1
  124. package/dist/core/footer-data-provider.d.ts +7 -1
  125. package/dist/core/footer-data-provider.d.ts.map +1 -1
  126. package/dist/core/footer-data-provider.js +78 -54
  127. package/dist/core/footer-data-provider.js.map +1 -1
  128. package/dist/core/http-dispatcher.d.ts +21 -0
  129. package/dist/core/http-dispatcher.d.ts.map +1 -0
  130. package/dist/core/http-dispatcher.js +48 -0
  131. package/dist/core/http-dispatcher.js.map +1 -0
  132. package/dist/core/index.d.ts +9 -8
  133. package/dist/core/index.d.ts.map +1 -1
  134. package/dist/core/index.js +2 -1
  135. package/dist/core/index.js.map +1 -1
  136. package/dist/core/keybindings.d.ts +66 -1
  137. package/dist/core/keybindings.d.ts.map +1 -1
  138. package/dist/core/keybindings.js +56 -1
  139. package/dist/core/keybindings.js.map +1 -1
  140. package/dist/core/model-registry.d.ts +22 -4
  141. package/dist/core/model-registry.d.ts.map +1 -1
  142. package/dist/core/model-registry.js +216 -44
  143. package/dist/core/model-registry.js.map +1 -1
  144. package/dist/core/model-resolver.d.ts +2 -1
  145. package/dist/core/model-resolver.d.ts.map +1 -1
  146. package/dist/core/model-resolver.js +48 -21
  147. package/dist/core/model-resolver.js.map +1 -1
  148. package/dist/core/output-guard.d.ts +1 -0
  149. package/dist/core/output-guard.d.ts.map +1 -1
  150. package/dist/core/output-guard.js +52 -22
  151. package/dist/core/output-guard.js.map +1 -1
  152. package/dist/core/package-manager.d.ts +17 -2
  153. package/dist/core/package-manager.d.ts.map +1 -1
  154. package/dist/core/package-manager.js +363 -121
  155. package/dist/core/package-manager.js.map +1 -1
  156. package/dist/core/project-trust.d.ts +15 -0
  157. package/dist/core/project-trust.d.ts.map +1 -0
  158. package/dist/core/project-trust.js +58 -0
  159. package/dist/core/project-trust.js.map +1 -0
  160. package/dist/core/prompt-templates.d.ts +13 -11
  161. package/dist/core/prompt-templates.d.ts.map +1 -1
  162. package/dist/core/prompt-templates.js +67 -76
  163. package/dist/core/prompt-templates.js.map +1 -1
  164. package/dist/core/provider-attribution.d.ts +4 -0
  165. package/dist/core/provider-attribution.d.ts.map +1 -0
  166. package/dist/core/provider-attribution.js +72 -0
  167. package/dist/core/provider-attribution.js.map +1 -0
  168. package/dist/core/provider-display-names.d.ts +2 -0
  169. package/dist/core/provider-display-names.d.ts.map +1 -0
  170. package/dist/core/provider-display-names.js +36 -0
  171. package/dist/core/provider-display-names.js.map +1 -0
  172. package/dist/core/resolve-config-value.d.ts +9 -1
  173. package/dist/core/resolve-config-value.d.ts.map +1 -1
  174. package/dist/core/resolve-config-value.js +134 -11
  175. package/dist/core/resolve-config-value.js.map +1 -1
  176. package/dist/core/resource-loader.d.ts +34 -14
  177. package/dist/core/resource-loader.d.ts.map +1 -1
  178. package/dist/core/resource-loader.js +165 -76
  179. package/dist/core/resource-loader.js.map +1 -1
  180. package/dist/core/sdk.d.ts +26 -10
  181. package/dist/core/sdk.d.ts.map +1 -1
  182. package/dist/core/sdk.js +45 -16
  183. package/dist/core/sdk.js.map +1 -1
  184. package/dist/core/session-manager.d.ts +11 -12
  185. package/dist/core/session-manager.d.ts.map +1 -1
  186. package/dist/core/session-manager.js +245 -132
  187. package/dist/core/session-manager.js.map +1 -1
  188. package/dist/core/settings-manager.d.ts +52 -5
  189. package/dist/core/settings-manager.d.ts.map +1 -1
  190. package/dist/core/settings-manager.js +202 -38
  191. package/dist/core/settings-manager.js.map +1 -1
  192. package/dist/core/skills.d.ts +10 -10
  193. package/dist/core/skills.d.ts.map +1 -1
  194. package/dist/core/skills.js +13 -35
  195. package/dist/core/skills.js.map +1 -1
  196. package/dist/core/slash-commands.d.ts +1 -1
  197. package/dist/core/slash-commands.d.ts.map +1 -1
  198. package/dist/core/slash-commands.js +7 -4
  199. package/dist/core/slash-commands.js.map +1 -1
  200. package/dist/core/source-info.d.ts +1 -1
  201. package/dist/core/source-info.d.ts.map +1 -1
  202. package/dist/core/source-info.js.map +1 -1
  203. package/dist/core/system-prompt.d.ts +4 -4
  204. package/dist/core/system-prompt.d.ts.map +1 -1
  205. package/dist/core/system-prompt.js +14 -10
  206. package/dist/core/system-prompt.js.map +1 -1
  207. package/dist/core/telemetry.d.ts +3 -0
  208. package/dist/core/telemetry.d.ts.map +1 -0
  209. package/dist/core/telemetry.js +9 -0
  210. package/dist/core/telemetry.js.map +1 -0
  211. package/dist/core/tools/bash.d.ts +11 -16
  212. package/dist/core/tools/bash.d.ts.map +1 -1
  213. package/dist/core/tools/bash.js +162 -177
  214. package/dist/core/tools/bash.js.map +1 -1
  215. package/dist/core/tools/edit-diff.d.ts +3 -1
  216. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  217. package/dist/core/tools/edit-diff.js +11 -3
  218. package/dist/core/tools/edit-diff.js.map +1 -1
  219. package/dist/core/tools/edit.d.ts +22 -24
  220. package/dist/core/tools/edit.d.ts.map +1 -1
  221. package/dist/core/tools/edit.js +199 -111
  222. package/dist/core/tools/edit.js.map +1 -1
  223. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
  224. package/dist/core/tools/file-mutation-queue.js +27 -12
  225. package/dist/core/tools/file-mutation-queue.js.map +1 -1
  226. package/dist/core/tools/find.d.ts +7 -18
  227. package/dist/core/tools/find.d.ts.map +1 -1
  228. package/dist/core/tools/find.js +134 -95
  229. package/dist/core/tools/find.js.map +1 -1
  230. package/dist/core/tools/grep.d.ts +11 -30
  231. package/dist/core/tools/grep.d.ts.map +1 -1
  232. package/dist/core/tools/grep.js +23 -12
  233. package/dist/core/tools/grep.js.map +1 -1
  234. package/dist/core/tools/index.d.ts +26 -101
  235. package/dist/core/tools/index.d.ts.map +1 -1
  236. package/dist/core/tools/index.js +78 -52
  237. package/dist/core/tools/index.js.map +1 -1
  238. package/dist/core/tools/ls.d.ts +6 -15
  239. package/dist/core/tools/ls.d.ts.map +1 -1
  240. package/dist/core/tools/ls.js +12 -17
  241. package/dist/core/tools/ls.js.map +1 -1
  242. package/dist/core/tools/output-accumulator.d.ts +52 -0
  243. package/dist/core/tools/output-accumulator.d.ts.map +1 -0
  244. package/dist/core/tools/output-accumulator.js +184 -0
  245. package/dist/core/tools/output-accumulator.js.map +1 -0
  246. package/dist/core/tools/path-utils.d.ts +2 -0
  247. package/dist/core/tools/path-utils.d.ts.map +1 -1
  248. package/dist/core/tools/path-utils.js +40 -22
  249. package/dist/core/tools/path-utils.js.map +1 -1
  250. package/dist/core/tools/read.d.ts +7 -18
  251. package/dist/core/tools/read.d.ts.map +1 -1
  252. package/dist/core/tools/read.js +100 -36
  253. package/dist/core/tools/read.js.map +1 -1
  254. package/dist/core/tools/render-utils.d.ts +5 -2
  255. package/dist/core/tools/render-utils.d.ts.map +1 -1
  256. package/dist/core/tools/render-utils.js +18 -2
  257. package/dist/core/tools/render-utils.js.map +1 -1
  258. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  259. package/dist/core/tools/tool-definition-wrapper.js +2 -0
  260. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  261. package/dist/core/tools/truncate.d.ts.map +1 -1
  262. package/dist/core/tools/truncate.js +12 -2
  263. package/dist/core/tools/truncate.js.map +1 -1
  264. package/dist/core/tools/write.d.ts +5 -14
  265. package/dist/core/tools/write.d.ts.map +1 -1
  266. package/dist/core/tools/write.js +27 -46
  267. package/dist/core/tools/write.js.map +1 -1
  268. package/dist/core/trust-manager.d.ts +31 -0
  269. package/dist/core/trust-manager.d.ts.map +1 -0
  270. package/dist/core/trust-manager.js +187 -0
  271. package/dist/core/trust-manager.js.map +1 -0
  272. package/dist/index.d.ts +31 -29
  273. package/dist/index.d.ts.map +1 -1
  274. package/dist/index.js +9 -8
  275. package/dist/index.js.map +1 -1
  276. package/dist/main.d.ts +5 -1
  277. package/dist/main.d.ts.map +1 -1
  278. package/dist/main.js +170 -87
  279. package/dist/main.js.map +1 -1
  280. package/dist/migrations.d.ts +2 -2
  281. package/dist/migrations.d.ts.map +1 -1
  282. package/dist/migrations.js +127 -5
  283. package/dist/migrations.js.map +1 -1
  284. package/dist/modes/index.d.ts +5 -5
  285. package/dist/modes/index.d.ts.map +1 -1
  286. package/dist/modes/index.js.map +1 -1
  287. package/dist/modes/interactive/components/assistant-message.d.ts +2 -0
  288. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  289. package/dist/modes/interactive/components/assistant-message.js +14 -0
  290. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  291. package/dist/modes/interactive/components/bash-execution.d.ts +1 -1
  292. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  293. package/dist/modes/interactive/components/bash-execution.js +3 -3
  294. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  295. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
  296. package/dist/modes/interactive/components/bordered-loader.js +3 -0
  297. package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
  298. package/dist/modes/interactive/components/config-selector.d.ts +4 -4
  299. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  300. package/dist/modes/interactive/components/config-selector.js +38 -11
  301. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  302. package/dist/modes/interactive/components/countdown-timer.d.ts +2 -2
  303. package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
  304. package/dist/modes/interactive/components/countdown-timer.js +2 -2
  305. package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
  306. package/dist/modes/interactive/components/custom-editor.d.ts +1 -1
  307. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  308. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  309. package/dist/modes/interactive/components/custom-message.d.ts +2 -2
  310. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  311. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  312. package/dist/modes/interactive/components/diff.d.ts.map +1 -1
  313. package/dist/modes/interactive/components/diff.js.map +1 -1
  314. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -1
  315. package/dist/modes/interactive/components/earendil-announcement.js.map +1 -1
  316. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  317. package/dist/modes/interactive/components/extension-editor.js +14 -6
  318. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  319. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  320. package/dist/modes/interactive/components/extension-input.js.map +1 -1
  321. package/dist/modes/interactive/components/extension-selector.d.ts +2 -0
  322. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  323. package/dist/modes/interactive/components/extension-selector.js +8 -3
  324. package/dist/modes/interactive/components/extension-selector.js.map +1 -1
  325. package/dist/modes/interactive/components/first-time-setup.d.ts +25 -0
  326. package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -0
  327. package/dist/modes/interactive/components/first-time-setup.js +103 -0
  328. package/dist/modes/interactive/components/first-time-setup.js.map +1 -0
  329. package/dist/modes/interactive/components/footer.d.ts +2 -1
  330. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  331. package/dist/modes/interactive/components/footer.js +23 -7
  332. package/dist/modes/interactive/components/footer.js.map +1 -1
  333. package/dist/modes/interactive/components/index.d.ts +33 -31
  334. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  335. package/dist/modes/interactive/components/index.js +2 -0
  336. package/dist/modes/interactive/components/index.js.map +1 -1
  337. package/dist/modes/interactive/components/keybinding-hints.d.ts +5 -0
  338. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
  339. package/dist/modes/interactive/components/keybinding-hints.js +19 -5
  340. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
  341. package/dist/modes/interactive/components/login-dialog.d.ts +12 -2
  342. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  343. package/dist/modes/interactive/components/login-dialog.js +46 -11
  344. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  345. package/dist/modes/interactive/components/model-selector.d.ts +2 -2
  346. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  347. package/dist/modes/interactive/components/model-selector.js +8 -5
  348. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  349. package/dist/modes/interactive/components/oauth-selector.d.ts +18 -6
  350. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  351. package/dist/modes/interactive/components/oauth-selector.js +93 -25
  352. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  353. package/dist/modes/interactive/components/scoped-models-selector.d.ts +5 -12
  354. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  355. package/dist/modes/interactive/components/scoped-models-selector.js +45 -30
  356. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  357. package/dist/modes/interactive/components/session-selector.d.ts +2 -1
  358. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  359. package/dist/modes/interactive/components/session-selector.js +20 -7
  360. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  361. package/dist/modes/interactive/components/settings-selector.d.ts +13 -0
  362. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  363. package/dist/modes/interactive/components/settings-selector.js +113 -4
  364. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  365. package/dist/modes/interactive/components/skill-invocation-message.d.ts +1 -1
  366. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  367. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  368. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  369. package/dist/modes/interactive/components/thinking-selector.js +1 -1
  370. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  371. package/dist/modes/interactive/components/tool-execution.d.ts +6 -1
  372. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  373. package/dist/modes/interactive/components/tool-execution.js +57 -14
  374. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  375. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  376. package/dist/modes/interactive/components/tree-selector.js +18 -9
  377. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  378. package/dist/modes/interactive/components/trust-selector.d.ts +23 -0
  379. package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -0
  380. package/dist/modes/interactive/components/trust-selector.js +91 -0
  381. package/dist/modes/interactive/components/trust-selector.js.map +1 -0
  382. package/dist/modes/interactive/components/user-message-selector.d.ts +2 -2
  383. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
  384. package/dist/modes/interactive/components/user-message-selector.js +8 -7
  385. package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  386. package/dist/modes/interactive/components/user-message.d.ts +1 -0
  387. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  388. package/dist/modes/interactive/components/user-message.js +8 -7
  389. package/dist/modes/interactive/components/user-message.js.map +1 -1
  390. package/dist/modes/interactive/interactive-mode.d.ts +68 -13
  391. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  392. package/dist/modes/interactive/interactive-mode.js +1100 -319
  393. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  394. package/dist/modes/interactive/theme/dark.json +5 -4
  395. package/dist/modes/interactive/theme/light.json +5 -4
  396. package/dist/modes/interactive/theme/theme.d.ts +22 -3
  397. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  398. package/dist/modes/interactive/theme/theme.js +160 -105
  399. package/dist/modes/interactive/theme/theme.js.map +1 -1
  400. package/dist/modes/print-mode.d.ts.map +1 -1
  401. package/dist/modes/print-mode.js +40 -20
  402. package/dist/modes/print-mode.js.map +1 -1
  403. package/dist/modes/rpc/rpc-client.d.ts +11 -1
  404. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  405. package/dist/modes/rpc/rpc-client.js +73 -8
  406. package/dist/modes/rpc/rpc-client.js.map +1 -1
  407. package/dist/modes/rpc/rpc-mode.d.ts +2 -2
  408. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  409. package/dist/modes/rpc/rpc-mode.js +96 -30
  410. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  411. package/dist/modes/rpc/rpc-types.d.ts +16 -4
  412. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  413. package/dist/modes/rpc/rpc-types.js.map +1 -1
  414. package/dist/package-manager-cli.d.ts +6 -2
  415. package/dist/package-manager-cli.d.ts.map +1 -1
  416. package/dist/package-manager-cli.js +396 -21
  417. package/dist/package-manager-cli.js.map +1 -1
  418. package/dist/prompts/commands/map-codebase.md +14 -0
  419. package/dist/utils/ansi.d.ts +2 -0
  420. package/dist/utils/ansi.d.ts.map +1 -0
  421. package/dist/utils/ansi.js +52 -0
  422. package/dist/utils/ansi.js.map +1 -0
  423. package/dist/utils/changelog.d.ts +2 -1
  424. package/dist/utils/changelog.d.ts.map +1 -1
  425. package/dist/utils/changelog.js +78 -0
  426. package/dist/utils/changelog.js.map +1 -1
  427. package/dist/utils/child-process.d.ts +5 -1
  428. package/dist/utils/child-process.d.ts.map +1 -1
  429. package/dist/utils/child-process.js +10 -0
  430. package/dist/utils/child-process.js.map +1 -1
  431. package/dist/utils/clipboard-image.d.ts.map +1 -1
  432. package/dist/utils/clipboard-image.js +2 -2
  433. package/dist/utils/clipboard-image.js.map +1 -1
  434. package/dist/utils/clipboard-native.d.ts +3 -1
  435. package/dist/utils/clipboard-native.d.ts.map +1 -1
  436. package/dist/utils/clipboard-native.js +14 -8
  437. package/dist/utils/clipboard-native.js.map +1 -1
  438. package/dist/utils/clipboard.d.ts.map +1 -1
  439. package/dist/utils/clipboard.js +84 -45
  440. package/dist/utils/clipboard.js.map +1 -1
  441. package/dist/utils/deprecation.d.ts +4 -0
  442. package/dist/utils/deprecation.d.ts.map +1 -0
  443. package/dist/utils/deprecation.js +13 -0
  444. package/dist/utils/deprecation.js.map +1 -0
  445. package/dist/utils/exif-orientation.d.ts +1 -1
  446. package/dist/utils/exif-orientation.d.ts.map +1 -1
  447. package/dist/utils/exif-orientation.js.map +1 -1
  448. package/dist/utils/fs-watch.d.ts +5 -0
  449. package/dist/utils/fs-watch.d.ts.map +1 -0
  450. package/dist/utils/fs-watch.js +25 -0
  451. package/dist/utils/fs-watch.js.map +1 -0
  452. package/dist/utils/git.d.ts.map +1 -1
  453. package/dist/utils/git.js +54 -22
  454. package/dist/utils/git.js.map +1 -1
  455. package/dist/utils/html.d.ts +7 -0
  456. package/dist/utils/html.d.ts.map +1 -0
  457. package/dist/utils/html.js +40 -0
  458. package/dist/utils/html.js.map +1 -0
  459. package/dist/utils/image-convert.d.ts.map +1 -1
  460. package/dist/utils/image-convert.js.map +1 -1
  461. package/dist/utils/image-resize-core.d.ts +30 -0
  462. package/dist/utils/image-resize-core.d.ts.map +1 -0
  463. package/dist/utils/image-resize-core.js +124 -0
  464. package/dist/utils/image-resize-core.js.map +1 -0
  465. package/dist/utils/image-resize-worker.d.ts +2 -0
  466. package/dist/utils/image-resize-worker.d.ts.map +1 -0
  467. package/dist/utils/image-resize-worker.js +31 -0
  468. package/dist/utils/image-resize-worker.js.map +1 -0
  469. package/dist/utils/image-resize.d.ts +7 -27
  470. package/dist/utils/image-resize.d.ts.map +1 -1
  471. package/dist/utils/image-resize.js +75 -115
  472. package/dist/utils/image-resize.js.map +1 -1
  473. package/dist/utils/json.d.ts +3 -0
  474. package/dist/utils/json.d.ts.map +1 -0
  475. package/dist/utils/json.js +7 -0
  476. package/dist/utils/json.js.map +1 -0
  477. package/dist/utils/mime.d.ts +1 -0
  478. package/dist/utils/mime.d.ts.map +1 -1
  479. package/dist/utils/mime.js +59 -16
  480. package/dist/utils/mime.js.map +1 -1
  481. package/dist/utils/open-browser.d.ts +9 -0
  482. package/dist/utils/open-browser.d.ts.map +1 -0
  483. package/dist/utils/open-browser.js +22 -0
  484. package/dist/utils/open-browser.js.map +1 -0
  485. package/dist/utils/paths.d.ts +25 -1
  486. package/dist/utils/paths.d.ts.map +1 -1
  487. package/dist/utils/paths.js +75 -2
  488. package/dist/utils/paths.js.map +1 -1
  489. package/dist/utils/pi-user-agent.d.ts +2 -0
  490. package/dist/utils/pi-user-agent.d.ts.map +1 -0
  491. package/dist/utils/pi-user-agent.js +5 -0
  492. package/dist/utils/pi-user-agent.js.map +1 -0
  493. package/dist/utils/shell.d.ts +10 -6
  494. package/dist/utils/shell.d.ts.map +1 -1
  495. package/dist/utils/shell.js +35 -26
  496. package/dist/utils/shell.js.map +1 -1
  497. package/dist/utils/syntax-highlight.d.ts +12 -0
  498. package/dist/utils/syntax-highlight.d.ts.map +1 -0
  499. package/dist/utils/syntax-highlight.js +118 -0
  500. package/dist/utils/syntax-highlight.js.map +1 -0
  501. package/dist/utils/tools-manager.d.ts.map +1 -1
  502. package/dist/utils/tools-manager.js +86 -10
  503. package/dist/utils/tools-manager.js.map +1 -1
  504. package/dist/utils/version-check.d.ts +15 -0
  505. package/dist/utils/version-check.d.ts.map +1 -0
  506. package/dist/utils/version-check.js +82 -0
  507. package/dist/utils/version-check.js.map +1 -0
  508. package/dist/utils/windows-self-update.d.ts +3 -0
  509. package/dist/utils/windows-self-update.d.ts.map +1 -0
  510. package/dist/utils/windows-self-update.js +77 -0
  511. package/dist/utils/windows-self-update.js.map +1 -0
  512. package/docs/compaction.md +12 -12
  513. package/docs/containerization.md +111 -0
  514. package/docs/custom-provider.md +187 -47
  515. package/docs/development.md +5 -5
  516. package/docs/docs.json +156 -0
  517. package/docs/extensions.md +465 -71
  518. package/docs/index.md +82 -0
  519. package/docs/json.md +4 -4
  520. package/docs/keybindings.md +23 -1
  521. package/docs/models.md +119 -17
  522. package/docs/packages.md +17 -9
  523. package/docs/prompt-templates.md +30 -2
  524. package/docs/providers.md +83 -22
  525. package/docs/quickstart.md +165 -0
  526. package/docs/rpc.md +41 -10
  527. package/docs/sdk.md +68 -50
  528. package/docs/security.md +55 -0
  529. package/docs/{session.md → session-format.md} +11 -11
  530. package/docs/sessions.md +145 -0
  531. package/docs/settings.md +61 -11
  532. package/docs/skills.md +16 -17
  533. package/docs/terminal-setup.md +44 -2
  534. package/docs/termux.md +4 -4
  535. package/docs/themes.md +3 -3
  536. package/docs/tmux.md +4 -2
  537. package/docs/tui.md +44 -4
  538. package/docs/usage.md +305 -0
  539. package/examples/extensions/border-status-editor.ts +145 -0
  540. package/examples/extensions/built-in-tool-renderer.ts +3 -0
  541. package/examples/extensions/custom-header.ts +1 -1
  542. package/examples/extensions/custom-provider-anthropic/index.ts +1 -1
  543. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  544. package/examples/extensions/custom-provider-anthropic/package.json +2 -2
  545. package/examples/extensions/custom-provider-gitlab-duo/index.ts +55 -4
  546. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  547. package/examples/extensions/custom-provider-gitlab-duo/test.ts +1 -1
  548. package/examples/extensions/doom-overlay/doom-component.ts +2 -2
  549. package/examples/extensions/doom-overlay/index.ts +1 -1
  550. package/examples/extensions/dynamic-resources/dynamic.json +1 -1
  551. package/examples/extensions/dynamic-tools.ts +2 -2
  552. package/examples/extensions/git-merge-and-resolve.ts +115 -0
  553. package/examples/extensions/github-issue-autocomplete.ts +185 -0
  554. package/examples/extensions/gondolin/index.ts +531 -0
  555. package/examples/extensions/gondolin/package-lock.json +185 -0
  556. package/examples/extensions/gondolin/package.json +19 -0
  557. package/examples/extensions/handoff.ts +50 -12
  558. package/examples/extensions/input-transform-streaming.ts +39 -0
  559. package/examples/extensions/interactive-shell.ts +1 -1
  560. package/examples/extensions/notify.ts +2 -9
  561. package/examples/extensions/overlay-qa-tests.ts +240 -138
  562. package/examples/extensions/overlay-test.ts +7 -4
  563. package/examples/extensions/plan-mode/utils.ts +1 -1
  564. package/examples/extensions/preset.ts +36 -3
  565. package/examples/extensions/project-trust.ts +64 -0
  566. package/examples/extensions/prompt-customizer.ts +97 -0
  567. package/examples/extensions/provider-payload.ts +4 -0
  568. package/examples/extensions/qna.ts +1 -1
  569. package/examples/extensions/question.ts +2 -2
  570. package/examples/extensions/questionnaire.ts +2 -2
  571. package/examples/extensions/reload-runtime.ts +1 -1
  572. package/examples/extensions/sandbox/index.ts +4 -4
  573. package/examples/extensions/sandbox/package-lock.json +5 -5
  574. package/examples/extensions/sandbox/package.json +2 -2
  575. package/examples/extensions/shutdown-command.ts +1 -1
  576. package/examples/extensions/snake.ts +1 -1
  577. package/examples/extensions/space-invaders.ts +1 -1
  578. package/examples/extensions/structured-output.ts +65 -0
  579. package/examples/extensions/subagent/index.ts +51 -28
  580. package/examples/extensions/summarize.ts +1 -1
  581. package/examples/extensions/tic-tac-toe.ts +1008 -0
  582. package/examples/extensions/titlebar-spinner.ts +2 -2
  583. package/examples/extensions/todo.ts +2 -2
  584. package/examples/extensions/tool-override.ts +1 -1
  585. package/examples/extensions/tools.ts +5 -0
  586. package/examples/extensions/truncated-tool.ts +1 -1
  587. package/examples/extensions/with-deps/index.ts +1 -1
  588. package/examples/extensions/with-deps/package-lock.json +2 -2
  589. package/examples/extensions/with-deps/package.json +3 -3
  590. package/examples/extensions/working-indicator.ts +123 -0
  591. package/examples/extensions/working-message-test.ts +25 -0
  592. package/examples/sdk/01-minimal.ts +14 -10
  593. package/examples/sdk/02-custom-model.ts +12 -8
  594. package/examples/sdk/03-custom-prompt.ts +32 -17
  595. package/examples/sdk/04-skills.ts +5 -2
  596. package/examples/sdk/05-tools.ts +23 -31
  597. package/examples/sdk/06-extensions.ts +14 -8
  598. package/examples/sdk/07-context-files.ts +5 -3
  599. package/examples/sdk/08-prompt-templates.ts +5 -2
  600. package/examples/sdk/09-api-keys-and-oauth.ts +8 -4
  601. package/examples/sdk/10-settings.ts +8 -6
  602. package/examples/sdk/11-sessions.ts +4 -0
  603. package/examples/sdk/12-full-control.ts +13 -17
  604. package/package.json +13 -6
  605. package/prompts/commands/map-codebase.md +14 -0
package/docs/providers.md CHANGED
@@ -15,36 +15,31 @@ Pi supports subscription-based providers via OAuth and API key providers via env
15
15
 
16
16
  Use `/login` in interactive mode, then select a provider:
17
17
 
18
- - Claude Pro/Max
19
18
  - ChatGPT Plus/Pro (Codex)
19
+ - Claude Pro/Max
20
20
  - GitHub Copilot
21
- - Google Gemini CLI
22
- - Google Antigravity
23
21
 
24
22
  Use `/logout` to clear credentials. Tokens are stored in `~/.pi/agent/auth.json` and auto-refresh when expired.
25
23
 
26
- ### GitHub Copilot
24
+ ### OpenAI Codex
27
25
 
28
- - Press Enter for github.com, or enter your GitHub Enterprise Server domain
29
- - If you get "model not supported", enable it in VS Code: Copilot Chat → model selector → select model → "Enable"
26
+ - Requires ChatGPT Plus or Pro subscription
27
+ - Officially endorsed by OpenAI: [Codex for OSS](https://developers.openai.com/community/codex-for-oss)
30
28
 
31
- ### Google Providers
29
+ ### Claude Pro/Max
32
30
 
33
- - **Gemini CLI**: Standard Gemini models via Cloud Code Assist
34
- - **Antigravity**: Sandbox with Gemini 3, Claude, and GPT-OSS models
35
- - Both free with any Google account, subject to rate limits
36
- - For paid Cloud Code Assist: set `GOOGLE_CLOUD_PROJECT` env var
31
+ Anthropic subscription auth is active for Claude Pro/Max accounts. Third-party harness usage draws from [extra usage](https://claude.ai/settings/usage) and is billed per token, not against Claude plan limits.
37
32
 
38
- ### OpenAI Codex
33
+ ### GitHub Copilot
39
34
 
40
- - Requires ChatGPT Plus or Pro subscription
41
- - Personal use only; for production, use the OpenAI Platform API
35
+ - Press Enter for github.com, or enter your GitHub Enterprise Server domain
36
+ - If you get "model not supported", enable it in VS Code: Copilot Chat → model selector → select model → "Enable"
42
37
 
43
38
  ## API Keys
44
39
 
45
40
  ### Environment Variables or Auth File
46
41
 
47
- Set via environment variable:
42
+ Use `/login` in interactive mode and select a provider to store an API key in `auth.json`, or set credentials via environment variable:
48
43
 
49
44
  ```bash
50
45
  export ANTHROPIC_API_KEY=sk-ant-...
@@ -54,24 +49,36 @@ pi
54
49
  | Provider | Environment Variable | `auth.json` key |
55
50
  |----------|----------------------|------------------|
56
51
  | Anthropic | `ANTHROPIC_API_KEY` | `anthropic` |
52
+ | Ant Ling | `ANT_LING_API_KEY` | `ant-ling` |
57
53
  | Azure OpenAI Responses | `AZURE_OPENAI_API_KEY` | `azure-openai-responses` |
58
54
  | OpenAI | `OPENAI_API_KEY` | `openai` |
55
+ | DeepSeek | `DEEPSEEK_API_KEY` | `deepseek` |
56
+ | NVIDIA NIM | `NVIDIA_API_KEY` | `nvidia` |
59
57
  | Google Gemini | `GEMINI_API_KEY` | `google` |
60
58
  | Mistral | `MISTRAL_API_KEY` | `mistral` |
61
59
  | Groq | `GROQ_API_KEY` | `groq` |
62
60
  | Cerebras | `CEREBRAS_API_KEY` | `cerebras` |
61
+ | Cloudflare AI Gateway | `CLOUDFLARE_API_KEY` (+ `CLOUDFLARE_ACCOUNT_ID`, `CLOUDFLARE_GATEWAY_ID`) | `cloudflare-ai-gateway` |
62
+ | Cloudflare Workers AI | `CLOUDFLARE_API_KEY` (+ `CLOUDFLARE_ACCOUNT_ID`) | `cloudflare-workers-ai` |
63
63
  | xAI | `XAI_API_KEY` | `xai` |
64
64
  | OpenRouter | `OPENROUTER_API_KEY` | `openrouter` |
65
65
  | Vercel AI Gateway | `AI_GATEWAY_API_KEY` | `vercel-ai-gateway` |
66
66
  | ZAI | `ZAI_API_KEY` | `zai` |
67
+ | ZAI Coding Plan (China) | `ZAI_CODING_CN_API_KEY` | `zai-coding-cn` |
67
68
  | OpenCode Zen | `OPENCODE_API_KEY` | `opencode` |
68
69
  | OpenCode Go | `OPENCODE_API_KEY` | `opencode-go` |
69
70
  | Hugging Face | `HF_TOKEN` | `huggingface` |
71
+ | Fireworks | `FIREWORKS_API_KEY` | `fireworks` |
72
+ | Together AI | `TOGETHER_API_KEY` | `together` |
70
73
  | Kimi For Coding | `KIMI_API_KEY` | `kimi-coding` |
71
74
  | MiniMax | `MINIMAX_API_KEY` | `minimax` |
72
75
  | MiniMax (China) | `MINIMAX_CN_API_KEY` | `minimax-cn` |
76
+ | Xiaomi MiMo | `XIAOMI_API_KEY` | `xiaomi` |
77
+ | Xiaomi MiMo Token Plan (China) | `XIAOMI_TOKEN_PLAN_CN_API_KEY` | `xiaomi-token-plan-cn` |
78
+ | Xiaomi MiMo Token Plan (Amsterdam) | `XIAOMI_TOKEN_PLAN_AMS_API_KEY` | `xiaomi-token-plan-ams` |
79
+ | Xiaomi MiMo Token Plan (Singapore) | `XIAOMI_TOKEN_PLAN_SGP_API_KEY` | `xiaomi-token-plan-sgp` |
73
80
 
74
- Reference for environment variables and `auth.json` keys: [`const envMap`](https://github.com/draht-dev/draht/blob/main/packages/ai/src/env-api-keys.ts) in [`packages/ai/src/env-api-keys.ts`](https://github.com/draht-dev/draht/blob/main/packages/ai/src/env-api-keys.ts).
81
+ Reference for environment variables and `auth.json` keys: [`const envMap`](https://github.com/earendil-works/pi-mono/blob/main/packages/ai/src/env-api-keys.ts) in [`packages/ai/src/env-api-keys.ts`](https://github.com/earendil-works/pi-mono/blob/main/packages/ai/src/env-api-keys.ts).
75
82
 
76
83
  #### Auth File
77
84
 
@@ -80,10 +87,18 @@ Store credentials in `~/.pi/agent/auth.json`:
80
87
  ```json
81
88
  {
82
89
  "anthropic": { "type": "api_key", "key": "sk-ant-..." },
90
+ "ant-ling": { "type": "api_key", "key": "..." },
83
91
  "openai": { "type": "api_key", "key": "sk-..." },
92
+ "deepseek": { "type": "api_key", "key": "sk-..." },
93
+ "nvidia": { "type": "api_key", "key": "nvapi-..." },
84
94
  "google": { "type": "api_key", "key": "..." },
85
95
  "opencode": { "type": "api_key", "key": "..." },
86
- "opencode-go": { "type": "api_key", "key": "..." }
96
+ "opencode-go": { "type": "api_key", "key": "..." },
97
+ "together": { "type": "api_key", "key": "..." },
98
+ "xiaomi": { "type": "api_key", "key": "..." },
99
+ "xiaomi-token-plan-cn": { "type": "api_key", "key": "..." },
100
+ "xiaomi-token-plan-ams": { "type": "api_key", "key": "..." },
101
+ "xiaomi-token-plan-sgp": { "type": "api_key", "key": "..." }
87
102
  }
88
103
  ```
89
104
 
@@ -91,23 +106,31 @@ The file is created with `0600` permissions (user read/write only). Auth file cr
91
106
 
92
107
  ### Key Resolution
93
108
 
94
- The `key` field supports three formats:
109
+ The `key` field supports command execution, environment interpolation, and literals:
95
110
 
96
- - **Shell command:** `"!command"` executes and uses stdout (cached for process lifetime)
111
+ - **Shell command:** `"!command"` at the start executes the whole value as a command and uses stdout (cached for process lifetime)
97
112
  ```json
98
113
  { "type": "api_key", "key": "!security find-generic-password -ws 'anthropic'" }
99
114
  { "type": "api_key", "key": "!op read 'op://vault/item/credential'" }
100
115
  ```
101
- - **Environment variable:** Uses the value of the named variable
116
+ - **Environment interpolation:** `"$ENV_VAR"` or `"${ENV_VAR}"` uses the value of the named variable. Interpolation works inside larger literals.
102
117
  ```json
103
- { "type": "api_key", "key": "MY_ANTHROPIC_KEY" }
118
+ { "type": "api_key", "key": "$MY_ANTHROPIC_KEY" }
119
+ { "type": "api_key", "key": "${KEY_PREFIX}_${KEY_SUFFIX}" }
120
+ ```
121
+ `$FOO_BAR` is the variable `FOO_BAR`; use `${FOO}_BAR` when `BAR` is literal text. Missing environment variables make the value unresolved.
122
+ - **Escapes:** `"$$"` emits a literal `"$"`; `"$!"` emits a literal `"!"` without triggering command execution.
123
+ ```json
124
+ { "type": "api_key", "key": "$$literal-dollar-prefix" }
125
+ { "type": "api_key", "key": "$!literal-bang-prefix" }
104
126
  ```
105
127
  - **Literal value:** Used directly
106
128
  ```json
107
129
  { "type": "api_key", "key": "sk-ant-..." }
130
+ { "type": "api_key", "key": "public" }
108
131
  ```
109
132
 
110
- OAuth credentials are also stored here after `/login` and managed automatically.
133
+ Legacy uppercase env-var-like values such as `MY_API_KEY` are migrated to `$MY_API_KEY` on startup. OAuth credentials are also stored here after `/login` and managed automatically.
111
134
 
112
135
  ## Cloud Providers
113
136
 
@@ -116,6 +139,8 @@ OAuth credentials are also stored here after `/login` and managed automatically.
116
139
  ```bash
117
140
  export AZURE_OPENAI_API_KEY=...
118
141
  export AZURE_OPENAI_BASE_URL=https://your-resource.openai.azure.com
142
+ # also supported: https://your-resource.cognitiveservices.azure.com
143
+ # root endpoints are auto-normalized to /openai/v1
119
144
  # or use resource name instead of base URL
120
145
  export AZURE_OPENAI_RESOURCE_NAME=your-resource
121
146
 
@@ -167,6 +192,42 @@ export AWS_BEDROCK_SKIP_AUTH=1
167
192
  export AWS_BEDROCK_FORCE_HTTP1=1
168
193
  ```
169
194
 
195
+ ### Cloudflare AI Gateway
196
+
197
+ `CLOUDFLARE_API_KEY` can be set via `/login`. The account ID and gateway slug must be set as environment variables.
198
+
199
+ ```bash
200
+ export CLOUDFLARE_API_KEY=... # or use /login
201
+ export CLOUDFLARE_ACCOUNT_ID=...
202
+ export CLOUDFLARE_GATEWAY_ID=... # create at dash.cloudflare.com → AI → AI Gateway
203
+ pi --provider cloudflare-ai-gateway --model "claude-sonnet-4-5"
204
+ ```
205
+
206
+ Routes to OpenAI, Anthropic, and Workers AI through Cloudflare AI Gateway. Workers AI uses the Unified API (`/compat`) and prefixed model IDs (`workers-ai/@cf/...`). OpenAI uses the OpenAI passthrough route (`/openai`) with native OpenAI model IDs such as `gpt-5.1`. Anthropic uses the Anthropic passthrough route (`/anthropic`) with native Anthropic model IDs such as `claude-sonnet-4-5`.
207
+
208
+ AI Gateway authentication uses `CLOUDFLARE_API_KEY` as `cf-aig-authorization`. Upstream authentication can be one of:
209
+
210
+ | Mode | Request auth | Upstream auth |
211
+ |------|--------------|---------------|
212
+ | Workers AI | Cloudflare token only | Cloudflare-native |
213
+ | Unified billing | Cloudflare token only | Cloudflare handles upstream auth and deducts credits |
214
+ | Stored BYOK | Cloudflare token only | Cloudflare injects provider keys stored in the AI Gateway dashboard |
215
+ | Inline BYOK | Cloudflare token plus upstream `Authorization` header | The request supplies the upstream provider key |
216
+
217
+ For normal pi usage, prefer unified billing or stored BYOK. Inline BYOK requires configuring an additional upstream `Authorization` header for the Cloudflare AI Gateway provider, for example via a `models.json` provider/model override.
218
+
219
+ ### Cloudflare Workers AI
220
+
221
+ `CLOUDFLARE_API_KEY` can be set via `/login`. `CLOUDFLARE_ACCOUNT_ID` must be set as an environment variable.
222
+
223
+ ```bash
224
+ export CLOUDFLARE_API_KEY=... # or use /login
225
+ export CLOUDFLARE_ACCOUNT_ID=...
226
+ pi --provider cloudflare-workers-ai --model "@cf/moonshotai/kimi-k2.6"
227
+ ```
228
+
229
+ Pi automatically sets `x-session-affinity` for [prefix caching](https://developers.cloudflare.com/workers-ai/features/prompt-caching/) discounts.
230
+
170
231
  ### Google Vertex AI
171
232
 
172
233
  Uses Application Default Credentials:
@@ -0,0 +1,165 @@
1
+ # Quickstart
2
+
3
+ This page gets you from install to a useful first pi session.
4
+
5
+ ## Install
6
+
7
+ Pi is distributed as an npm package:
8
+
9
+ ```bash
10
+ npm install -g --ignore-scripts @draht/coding-agent
11
+ ```
12
+
13
+ `--ignore-scripts` disables dependency lifecycle scripts during install. Pi does not require install scripts for normal npm installs.
14
+
15
+ ### Uninstall
16
+
17
+ Use the package manager that installed pi. The curl installer uses npm globally, so curl and npm installs are removed with npm:
18
+
19
+ ```bash
20
+ # curl installer or npm install -g
21
+ npm uninstall -g @draht/coding-agent
22
+
23
+ # pnpm
24
+ pnpm remove -g @draht/coding-agent
25
+
26
+ # Yarn
27
+ yarn global remove @draht/coding-agent
28
+
29
+ # Bun
30
+ bun uninstall -g @draht/coding-agent
31
+ ```
32
+
33
+ Uninstalling pi leaves settings, credentials, sessions, and installed pi packages in `~/.pi/agent/`.
34
+
35
+ Then start pi in the project directory you want it to work on:
36
+
37
+ ```bash
38
+ cd /path/to/project
39
+ pi
40
+ ```
41
+
42
+ ## Authenticate
43
+
44
+ Pi can use subscription providers through `/login`, or API-key providers through environment variables or the auth file.
45
+
46
+ ### Option 1: subscription login
47
+
48
+ Start pi and run:
49
+
50
+ ```text
51
+ /login
52
+ ```
53
+
54
+ Then select a provider. Built-in subscription logins include Claude Pro/Max, ChatGPT Plus/Pro (Codex), and GitHub Copilot.
55
+
56
+ ### Option 2: API key
57
+
58
+ Set an API key before launching pi:
59
+
60
+ ```bash
61
+ export ANTHROPIC_API_KEY=sk-ant-...
62
+ pi
63
+ ```
64
+
65
+ You can also run `/login` and select an API-key provider to store the key in `~/.pi/agent/auth.json`.
66
+
67
+ See [Providers](providers.md) for all supported providers, environment variables, and cloud-provider setup.
68
+
69
+ ## First session
70
+
71
+ Once pi starts, type a request and press Enter:
72
+
73
+ ```text
74
+ Summarize this repository and tell me how to run its checks.
75
+ ```
76
+
77
+ By default, pi gives the model four tools:
78
+
79
+ - `read` - read files
80
+ - `write` - create or overwrite files
81
+ - `edit` - patch files
82
+ - `bash` - run shell commands
83
+
84
+ Additional built-in read-only tools (`grep`, `find`, `ls`) are available through tool options. Pi runs in your current working directory and can modify files there. Use git or another checkpointing workflow if you want easy rollback.
85
+
86
+ ## Give pi project instructions
87
+
88
+ Pi loads context files at startup. Add an `AGENTS.md` file to tell it how to work in a project:
89
+
90
+ ```markdown
91
+ # Project Instructions
92
+
93
+ - Run `npm run check` after code changes.
94
+ - Do not run production migrations locally.
95
+ - Keep responses concise.
96
+ ```
97
+
98
+ Pi loads:
99
+
100
+ - `~/.pi/agent/AGENTS.md` for global instructions
101
+ - `AGENTS.md` or `CLAUDE.md` from parent directories and the current directory
102
+
103
+ Restart pi, or run `/reload`, after changing context files.
104
+
105
+ ## Common things to try
106
+
107
+ ### Reference files
108
+
109
+ Type `@` in the editor to fuzzy-search files, or pass files on the command line:
110
+
111
+ ```bash
112
+ pi @README.md "Summarize this"
113
+ pi @src/app.ts @src/app.test.ts "Review these together"
114
+ ```
115
+
116
+ Images can be pasted with Ctrl+V (Alt+V on Windows) or dragged into supported terminals.
117
+
118
+ ### Run shell commands
119
+
120
+ In interactive mode:
121
+
122
+ ```text
123
+ !npm run lint
124
+ ```
125
+
126
+ The command output is sent to the model. Use `!!command` to run a command without adding its output to the model context.
127
+
128
+ ### Switch models
129
+
130
+ Use `/model` or Ctrl+L to choose a model. Use Shift+Tab to cycle thinking level. Use Ctrl+P / Shift+Ctrl+P to cycle through scoped models.
131
+
132
+ ### Continue later
133
+
134
+ Sessions are saved automatically:
135
+
136
+ ```bash
137
+ pi -c # Continue most recent session
138
+ pi -r # Browse previous sessions
139
+ pi --name "my task" # Set session display name at startup
140
+ pi --session <path|id> # Open a specific session
141
+ ```
142
+
143
+ Inside pi, use `/resume`, `/new`, `/tree`, `/fork`, and `/clone` to manage sessions.
144
+
145
+ ### Non-interactive mode
146
+
147
+ For one-shot prompts:
148
+
149
+ ```bash
150
+ pi -p "Summarize this codebase"
151
+ cat README.md | pi -p "Summarize this text"
152
+ pi -p @screenshot.png "What's in this image?"
153
+ ```
154
+
155
+ Use `--mode json` for JSON event output or `--mode rpc` for process integration.
156
+
157
+ ## Next steps
158
+
159
+ - [Using Pi](usage.md) - interactive mode, slash commands, sessions, context files, and CLI reference.
160
+ - [Providers](providers.md) - authentication and model setup.
161
+ - [Settings](settings.md) - global and project configuration.
162
+ - [Keybindings](keybindings.md) - shortcuts and customization.
163
+ - [Pi Packages](packages.md) - install shared extensions, skills, prompts, and themes.
164
+
165
+ Platform notes: [Windows](windows.md), [Termux](termux.md), [tmux](tmux.md), [Terminal setup](terminal-setup.md), [Shell aliases](shell-aliases.md).
package/docs/rpc.md CHANGED
@@ -13,6 +13,7 @@ pi --mode rpc [options]
13
13
  Common options:
14
14
  - `--provider <name>`: Set the LLM provider (anthropic, openai, google, etc.)
15
15
  - `--model <pattern>`: Model pattern or ID (supports `provider/id` and optional `:<thinking>`)
16
+ - `--name <name>` / `-n <name>`: Set the session display name at startup
16
17
  - `--no-session`: Disable session persistence
17
18
  - `--session-dir <path>`: Custom session storage directory
18
19
 
@@ -41,7 +42,7 @@ In particular, Node `readline` is not protocol-compliant for RPC mode because it
41
42
 
42
43
  #### prompt
43
44
 
44
- Send a user prompt to the agent. Returns immediately; events stream asynchronously.
45
+ Send a user prompt to the agent. The command response is emitted after the prompt is accepted, queued, or handled. Events continue streaming asynchronously after acceptance.
45
46
 
46
47
  ```json
47
48
  {"id": "req-1", "type": "prompt", "message": "Hello, world!"}
@@ -72,6 +73,8 @@ Response:
72
73
  {"id": "req-1", "type": "response", "command": "prompt", "success": true}
73
74
  ```
74
75
 
76
+ `success: true` means the prompt was accepted, queued, or handled immediately. `success: false` means the prompt was rejected before acceptance. Failures after acceptance are reported through the normal event and message stream, not as a second `response` for the same request id.
77
+
75
78
  The `images` field is optional. Each image uses `ImageContent` format: `{"type": "image", "data": "base64-encoded-data", "mimeType": "image/png"}`.
76
79
 
77
80
  #### steer
@@ -464,13 +467,13 @@ The `bash` command executes immediately and returns a `BashResult`. Internally,
464
467
 
465
468
  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:
466
469
 
467
- ```
470
+ ````
468
471
  Ran `ls -la`
469
- \`\`\`
472
+ ```
470
473
  total 48
471
474
  drwxr-xr-x ...
472
- \`\`\`
473
475
  ```
476
+ ````
474
477
 
475
478
  This means:
476
479
  1. Bash output is included in the LLM context on the **next prompt**, not immediately
@@ -578,7 +581,7 @@ If an extension cancelled the switch:
578
581
 
579
582
  #### fork
580
583
 
581
- Create a new fork from a previous user message. Can be cancelled by a `session_before_fork` extension event handler. Returns the text of the message being forked from.
584
+ Create a new fork from a previous user message on the active branch. Can be cancelled by a `session_before_fork` extension event handler. Returns the text of the message being forked from.
582
585
 
583
586
  ```json
584
587
  {"type": "fork", "entryId": "abc123"}
@@ -604,6 +607,34 @@ If an extension cancelled the fork:
604
607
  }
605
608
  ```
606
609
 
610
+ #### clone
611
+
612
+ Duplicate the current active branch into a new session at the current position. Can be cancelled by a `session_before_fork` extension event handler.
613
+
614
+ ```json
615
+ {"type": "clone"}
616
+ ```
617
+
618
+ Response:
619
+ ```json
620
+ {
621
+ "type": "response",
622
+ "command": "clone",
623
+ "success": true,
624
+ "data": {"cancelled": false}
625
+ }
626
+ ```
627
+
628
+ If an extension cancelled the clone:
629
+ ```json
630
+ {
631
+ "type": "response",
632
+ "command": "clone",
633
+ "success": true,
634
+ "data": {"cancelled": true}
635
+ }
636
+ ```
637
+
607
638
  #### get_fork_messages
608
639
 
609
640
  Get user messages available for forking.
@@ -664,7 +695,7 @@ Response:
664
695
  }
665
696
  ```
666
697
 
667
- The current session name is available via `get_state` in the `sessionName` field.
698
+ 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.
668
699
 
669
700
  ### Commands
670
701
 
@@ -964,7 +995,7 @@ If a dialog method includes a `timeout` field, the agent-side will auto-resolve
964
995
 
965
996
  Some `ExtensionUIContext` methods are not supported or degraded in RPC mode because they require direct TUI access:
966
997
  - `custom()` returns `undefined`
967
- - `setWorkingMessage()`, `setFooter()`, `setHeader()`, `setEditorComponent()`, `setToolsExpanded()` are no-ops
998
+ - `setWorkingMessage()`, `setWorkingIndicator()`, `setFooter()`, `setHeader()`, `setEditorComponent()`, `setToolsExpanded()` are no-ops
968
999
  - `getEditorText()` returns `""`
969
1000
  - `getToolsExpanded()` returns `false`
970
1001
  - `pasteToEditor()` delegates to `setEditorText()` (no paste/collapse handling)
@@ -972,7 +1003,7 @@ Some `ExtensionUIContext` methods are not supported or degraded in RPC mode beca
972
1003
  - `getTheme()` returns `undefined`
973
1004
  - `setTheme()` returns `{ success: false, error: "..." }`
974
1005
 
975
- Note: `ctx.hasUI` is `true` in RPC mode because the dialog and fire-and-forget methods are functional via the extension UI sub-protocol.
1006
+ Note: `ctx.mode` is `"rpc"` and `ctx.hasUI` is `true` in RPC mode because the dialog and fire-and-forget methods are functional via the extension UI sub-protocol. Use `ctx.mode === "tui"` to guard TUI-specific features like `custom()` that require a real terminal.
976
1007
 
977
1008
  ### Extension UI Requests (stdout)
978
1009
 
@@ -1289,7 +1320,7 @@ import subprocess
1289
1320
  import json
1290
1321
 
1291
1322
  proc = subprocess.Popen(
1292
- ["draht", "--mode", "rpc", "--no-session"],
1323
+ ["pi", "--mode", "rpc", "--no-session"],
1293
1324
  stdin=subprocess.PIPE,
1294
1325
  stdout=subprocess.PIPE,
1295
1326
  text=True
@@ -1328,7 +1359,7 @@ For a complete example of handling the extension UI protocol, see [`examples/rpc
1328
1359
  const { spawn } = require("child_process");
1329
1360
  const { StringDecoder } = require("string_decoder");
1330
1361
 
1331
- const agent = spawn("draht", ["--mode", "rpc", "--no-session"]);
1362
+ const agent = spawn("pi", ["--mode", "rpc", "--no-session"]);
1332
1363
 
1333
1364
  function attachJsonlReader(stream, onLine) {
1334
1365
  const decoder = new StringDecoder("utf8");