@vaclav-synacek/pi-coding-agent-termux 0.45.7

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 (478) hide show
  1. package/CHANGELOG.md +1961 -0
  2. package/README.md +1392 -0
  3. package/dist/cli/args.d.ts +42 -0
  4. package/dist/cli/args.d.ts.map +1 -0
  5. package/dist/cli/args.js +248 -0
  6. package/dist/cli/args.js.map +1 -0
  7. package/dist/cli/file-processor.d.ts +15 -0
  8. package/dist/cli/file-processor.d.ts.map +1 -0
  9. package/dist/cli/file-processor.js +79 -0
  10. package/dist/cli/file-processor.js.map +1 -0
  11. package/dist/cli/list-models.d.ts +9 -0
  12. package/dist/cli/list-models.d.ts.map +1 -0
  13. package/dist/cli/list-models.js +92 -0
  14. package/dist/cli/list-models.js.map +1 -0
  15. package/dist/cli/session-picker.d.ts +9 -0
  16. package/dist/cli/session-picker.d.ts.map +1 -0
  17. package/dist/cli/session-picker.js +32 -0
  18. package/dist/cli/session-picker.js.map +1 -0
  19. package/dist/cli.d.ts +3 -0
  20. package/dist/cli.d.ts.map +1 -0
  21. package/dist/cli.js +10 -0
  22. package/dist/cli.js.map +1 -0
  23. package/dist/config.d.ts +61 -0
  24. package/dist/config.d.ts.map +1 -0
  25. package/dist/config.js +141 -0
  26. package/dist/config.js.map +1 -0
  27. package/dist/core/agent-session.d.ts +523 -0
  28. package/dist/core/agent-session.d.ts.map +1 -0
  29. package/dist/core/agent-session.js +1795 -0
  30. package/dist/core/agent-session.js.map +1 -0
  31. package/dist/core/auth-storage.d.ts +112 -0
  32. package/dist/core/auth-storage.d.ts.map +1 -0
  33. package/dist/core/auth-storage.js +297 -0
  34. package/dist/core/auth-storage.js.map +1 -0
  35. package/dist/core/bash-executor.d.ts +47 -0
  36. package/dist/core/bash-executor.d.ts.map +1 -0
  37. package/dist/core/bash-executor.js +211 -0
  38. package/dist/core/bash-executor.js.map +1 -0
  39. package/dist/core/compaction/branch-summarization.d.ts +84 -0
  40. package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
  41. package/dist/core/compaction/branch-summarization.js +235 -0
  42. package/dist/core/compaction/branch-summarization.js.map +1 -0
  43. package/dist/core/compaction/compaction.d.ts +110 -0
  44. package/dist/core/compaction/compaction.d.ts.map +1 -0
  45. package/dist/core/compaction/compaction.js +559 -0
  46. package/dist/core/compaction/compaction.js.map +1 -0
  47. package/dist/core/compaction/index.d.ts +7 -0
  48. package/dist/core/compaction/index.d.ts.map +1 -0
  49. package/dist/core/compaction/index.js +7 -0
  50. package/dist/core/compaction/index.js.map +1 -0
  51. package/dist/core/compaction/utils.d.ts +35 -0
  52. package/dist/core/compaction/utils.d.ts.map +1 -0
  53. package/dist/core/compaction/utils.js +138 -0
  54. package/dist/core/compaction/utils.js.map +1 -0
  55. package/dist/core/event-bus.d.ts +9 -0
  56. package/dist/core/event-bus.d.ts.map +1 -0
  57. package/dist/core/event-bus.js +25 -0
  58. package/dist/core/event-bus.js.map +1 -0
  59. package/dist/core/exec.d.ts +29 -0
  60. package/dist/core/exec.d.ts.map +1 -0
  61. package/dist/core/exec.js +71 -0
  62. package/dist/core/exec.js.map +1 -0
  63. package/dist/core/export-html/index.d.ts +17 -0
  64. package/dist/core/export-html/index.d.ts.map +1 -0
  65. package/dist/core/export-html/index.js +193 -0
  66. package/dist/core/export-html/index.js.map +1 -0
  67. package/dist/core/export-html/template.css +910 -0
  68. package/dist/core/export-html/template.html +54 -0
  69. package/dist/core/export-html/template.js +1329 -0
  70. package/dist/core/export-html/vendor/highlight.min.js +1213 -0
  71. package/dist/core/export-html/vendor/marked.min.js +6 -0
  72. package/dist/core/extensions/index.d.ts +10 -0
  73. package/dist/core/extensions/index.d.ts.map +1 -0
  74. package/dist/core/extensions/index.js +9 -0
  75. package/dist/core/extensions/index.js.map +1 -0
  76. package/dist/core/extensions/loader.d.ts +25 -0
  77. package/dist/core/extensions/loader.d.ts.map +1 -0
  78. package/dist/core/extensions/loader.js +383 -0
  79. package/dist/core/extensions/loader.js.map +1 -0
  80. package/dist/core/extensions/runner.d.ts +89 -0
  81. package/dist/core/extensions/runner.d.ts.map +1 -0
  82. package/dist/core/extensions/runner.js +406 -0
  83. package/dist/core/extensions/runner.js.map +1 -0
  84. package/dist/core/extensions/types.d.ts +654 -0
  85. package/dist/core/extensions/types.d.ts.map +1 -0
  86. package/dist/core/extensions/types.js +32 -0
  87. package/dist/core/extensions/types.js.map +1 -0
  88. package/dist/core/extensions/wrapper.d.ts +27 -0
  89. package/dist/core/extensions/wrapper.d.ts.map +1 -0
  90. package/dist/core/extensions/wrapper.js +102 -0
  91. package/dist/core/extensions/wrapper.js.map +1 -0
  92. package/dist/core/footer-data-provider.d.ts +25 -0
  93. package/dist/core/footer-data-provider.d.ts.map +1 -0
  94. package/dist/core/footer-data-provider.js +121 -0
  95. package/dist/core/footer-data-provider.js.map +1 -0
  96. package/dist/core/index.d.ts +9 -0
  97. package/dist/core/index.d.ts.map +1 -0
  98. package/dist/core/index.js +9 -0
  99. package/dist/core/index.js.map +1 -0
  100. package/dist/core/keybindings.d.ts +59 -0
  101. package/dist/core/keybindings.d.ts.map +1 -0
  102. package/dist/core/keybindings.js +151 -0
  103. package/dist/core/keybindings.js.map +1 -0
  104. package/dist/core/messages.d.ts +77 -0
  105. package/dist/core/messages.d.ts.map +1 -0
  106. package/dist/core/messages.js +123 -0
  107. package/dist/core/messages.js.map +1 -0
  108. package/dist/core/model-registry.d.ts +57 -0
  109. package/dist/core/model-registry.d.ts.map +1 -0
  110. package/dist/core/model-registry.js +314 -0
  111. package/dist/core/model-registry.js.map +1 -0
  112. package/dist/core/model-resolver.d.ts +76 -0
  113. package/dist/core/model-resolver.d.ts.map +1 -0
  114. package/dist/core/model-resolver.js +308 -0
  115. package/dist/core/model-resolver.js.map +1 -0
  116. package/dist/core/prompt-templates.d.ts +40 -0
  117. package/dist/core/prompt-templates.d.ts.map +1 -0
  118. package/dist/core/prompt-templates.js +197 -0
  119. package/dist/core/prompt-templates.js.map +1 -0
  120. package/dist/core/sdk.d.ts +181 -0
  121. package/dist/core/sdk.d.ts.map +1 -0
  122. package/dist/core/sdk.js +466 -0
  123. package/dist/core/sdk.js.map +1 -0
  124. package/dist/core/session-manager.d.ts +313 -0
  125. package/dist/core/session-manager.d.ts.map +1 -0
  126. package/dist/core/session-manager.js +996 -0
  127. package/dist/core/session-manager.js.map +1 -0
  128. package/dist/core/settings-manager.d.ts +138 -0
  129. package/dist/core/settings-manager.d.ts.map +1 -0
  130. package/dist/core/settings-manager.js +327 -0
  131. package/dist/core/settings-manager.js.map +1 -0
  132. package/dist/core/skills.d.ts +50 -0
  133. package/dist/core/skills.d.ts.map +1 -0
  134. package/dist/core/skills.js +338 -0
  135. package/dist/core/skills.js.map +1 -0
  136. package/dist/core/system-prompt.d.ts +48 -0
  137. package/dist/core/system-prompt.d.ts.map +1 -0
  138. package/dist/core/system-prompt.js +224 -0
  139. package/dist/core/system-prompt.js.map +1 -0
  140. package/dist/core/timings.d.ts +7 -0
  141. package/dist/core/timings.d.ts.map +1 -0
  142. package/dist/core/timings.js +25 -0
  143. package/dist/core/timings.js.map +1 -0
  144. package/dist/core/tools/bash.d.ts +42 -0
  145. package/dist/core/tools/bash.d.ts.map +1 -0
  146. package/dist/core/tools/bash.js +223 -0
  147. package/dist/core/tools/bash.js.map +1 -0
  148. package/dist/core/tools/edit-diff.d.ts +33 -0
  149. package/dist/core/tools/edit-diff.d.ts.map +1 -0
  150. package/dist/core/tools/edit-diff.js +171 -0
  151. package/dist/core/tools/edit-diff.js.map +1 -0
  152. package/dist/core/tools/edit.d.ts +37 -0
  153. package/dist/core/tools/edit.d.ts.map +1 -0
  154. package/dist/core/tools/edit.js +143 -0
  155. package/dist/core/tools/edit.js.map +1 -0
  156. package/dist/core/tools/find.d.ts +37 -0
  157. package/dist/core/tools/find.d.ts.map +1 -0
  158. package/dist/core/tools/find.js +206 -0
  159. package/dist/core/tools/find.js.map +1 -0
  160. package/dist/core/tools/grep.d.ts +43 -0
  161. package/dist/core/tools/grep.d.ts.map +1 -0
  162. package/dist/core/tools/grep.js +239 -0
  163. package/dist/core/tools/grep.js.map +1 -0
  164. package/dist/core/tools/index.d.ts +70 -0
  165. package/dist/core/tools/index.d.ts.map +1 -0
  166. package/dist/core/tools/index.js +56 -0
  167. package/dist/core/tools/index.js.map +1 -0
  168. package/dist/core/tools/ls.d.ts +38 -0
  169. package/dist/core/tools/ls.d.ts.map +1 -0
  170. package/dist/core/tools/ls.js +118 -0
  171. package/dist/core/tools/ls.js.map +1 -0
  172. package/dist/core/tools/path-utils.d.ts +8 -0
  173. package/dist/core/tools/path-utils.d.ts.map +1 -0
  174. package/dist/core/tools/path-utils.js +53 -0
  175. package/dist/core/tools/path-utils.js.map +1 -0
  176. package/dist/core/tools/read.d.ts +37 -0
  177. package/dist/core/tools/read.d.ts.map +1 -0
  178. package/dist/core/tools/read.js +165 -0
  179. package/dist/core/tools/read.js.map +1 -0
  180. package/dist/core/tools/truncate.d.ts +70 -0
  181. package/dist/core/tools/truncate.d.ts.map +1 -0
  182. package/dist/core/tools/truncate.js +205 -0
  183. package/dist/core/tools/truncate.js.map +1 -0
  184. package/dist/core/tools/write.d.ts +27 -0
  185. package/dist/core/tools/write.d.ts.map +1 -0
  186. package/dist/core/tools/write.js +78 -0
  187. package/dist/core/tools/write.js.map +1 -0
  188. package/dist/index.d.ts +19 -0
  189. package/dist/index.d.ts.map +1 -0
  190. package/dist/index.js +35 -0
  191. package/dist/index.js.map +1 -0
  192. package/dist/main.d.ts +8 -0
  193. package/dist/main.d.ts.map +1 -0
  194. package/dist/main.js +354 -0
  195. package/dist/main.js.map +1 -0
  196. package/dist/migrations.d.ts +33 -0
  197. package/dist/migrations.d.ts.map +1 -0
  198. package/dist/migrations.js +261 -0
  199. package/dist/migrations.js.map +1 -0
  200. package/dist/modes/index.d.ts +9 -0
  201. package/dist/modes/index.d.ts.map +1 -0
  202. package/dist/modes/index.js +8 -0
  203. package/dist/modes/index.js.map +1 -0
  204. package/dist/modes/interactive/components/armin.d.ts +34 -0
  205. package/dist/modes/interactive/components/armin.d.ts.map +1 -0
  206. package/dist/modes/interactive/components/armin.js +333 -0
  207. package/dist/modes/interactive/components/armin.js.map +1 -0
  208. package/dist/modes/interactive/components/assistant-message.d.ts +15 -0
  209. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
  210. package/dist/modes/interactive/components/assistant-message.js +89 -0
  211. package/dist/modes/interactive/components/assistant-message.js.map +1 -0
  212. package/dist/modes/interactive/components/bash-execution.d.ts +35 -0
  213. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
  214. package/dist/modes/interactive/components/bash-execution.js +161 -0
  215. package/dist/modes/interactive/components/bash-execution.js.map +1 -0
  216. package/dist/modes/interactive/components/bordered-loader.d.ts +12 -0
  217. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
  218. package/dist/modes/interactive/components/bordered-loader.js +30 -0
  219. package/dist/modes/interactive/components/bordered-loader.js.map +1 -0
  220. package/dist/modes/interactive/components/branch-summary-message.d.ts +15 -0
  221. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
  222. package/dist/modes/interactive/components/branch-summary-message.js +39 -0
  223. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
  224. package/dist/modes/interactive/components/compaction-summary-message.d.ts +15 -0
  225. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
  226. package/dist/modes/interactive/components/compaction-summary-message.js +40 -0
  227. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
  228. package/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
  229. package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
  230. package/dist/modes/interactive/components/countdown-timer.js +33 -0
  231. package/dist/modes/interactive/components/countdown-timer.js.map +1 -0
  232. package/dist/modes/interactive/components/custom-editor.d.ts +21 -0
  233. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
  234. package/dist/modes/interactive/components/custom-editor.js +69 -0
  235. package/dist/modes/interactive/components/custom-editor.js.map +1 -0
  236. package/dist/modes/interactive/components/custom-message.d.ts +19 -0
  237. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
  238. package/dist/modes/interactive/components/custom-message.js +84 -0
  239. package/dist/modes/interactive/components/custom-message.js.map +1 -0
  240. package/dist/modes/interactive/components/diff.d.ts +12 -0
  241. package/dist/modes/interactive/components/diff.d.ts.map +1 -0
  242. package/dist/modes/interactive/components/diff.js +133 -0
  243. package/dist/modes/interactive/components/diff.js.map +1 -0
  244. package/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
  245. package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
  246. package/dist/modes/interactive/components/dynamic-border.js +21 -0
  247. package/dist/modes/interactive/components/dynamic-border.js.map +1 -0
  248. package/dist/modes/interactive/components/extension-editor.d.ts +15 -0
  249. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
  250. package/dist/modes/interactive/components/extension-editor.js +96 -0
  251. package/dist/modes/interactive/components/extension-editor.js.map +1 -0
  252. package/dist/modes/interactive/components/extension-input.d.ts +20 -0
  253. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
  254. package/dist/modes/interactive/components/extension-input.js +51 -0
  255. package/dist/modes/interactive/components/extension-input.js.map +1 -0
  256. package/dist/modes/interactive/components/extension-selector.d.ts +24 -0
  257. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
  258. package/dist/modes/interactive/components/extension-selector.js +73 -0
  259. package/dist/modes/interactive/components/extension-selector.js.map +1 -0
  260. package/dist/modes/interactive/components/footer.d.ts +26 -0
  261. package/dist/modes/interactive/components/footer.d.ts.map +1 -0
  262. package/dist/modes/interactive/components/footer.js +207 -0
  263. package/dist/modes/interactive/components/footer.js.map +1 -0
  264. package/dist/modes/interactive/components/index.d.ts +29 -0
  265. package/dist/modes/interactive/components/index.d.ts.map +1 -0
  266. package/dist/modes/interactive/components/index.js +30 -0
  267. package/dist/modes/interactive/components/index.js.map +1 -0
  268. package/dist/modes/interactive/components/login-dialog.d.ts +39 -0
  269. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
  270. package/dist/modes/interactive/components/login-dialog.js +135 -0
  271. package/dist/modes/interactive/components/login-dialog.js.map +1 -0
  272. package/dist/modes/interactive/components/model-selector.d.ts +35 -0
  273. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
  274. package/dist/modes/interactive/components/model-selector.js +211 -0
  275. package/dist/modes/interactive/components/model-selector.js.map +1 -0
  276. package/dist/modes/interactive/components/oauth-selector.d.ts +19 -0
  277. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
  278. package/dist/modes/interactive/components/oauth-selector.js +98 -0
  279. package/dist/modes/interactive/components/oauth-selector.js.map +1 -0
  280. package/dist/modes/interactive/components/scoped-models-selector.d.ts +46 -0
  281. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
  282. package/dist/modes/interactive/components/scoped-models-selector.js +258 -0
  283. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
  284. package/dist/modes/interactive/components/session-selector.d.ts +44 -0
  285. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
  286. package/dist/modes/interactive/components/session-selector.js +311 -0
  287. package/dist/modes/interactive/components/session-selector.js.map +1 -0
  288. package/dist/modes/interactive/components/settings-selector.d.ts +43 -0
  289. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
  290. package/dist/modes/interactive/components/settings-selector.js +219 -0
  291. package/dist/modes/interactive/components/settings-selector.js.map +1 -0
  292. package/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
  293. package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
  294. package/dist/modes/interactive/components/show-images-selector.js +35 -0
  295. package/dist/modes/interactive/components/show-images-selector.js.map +1 -0
  296. package/dist/modes/interactive/components/theme-selector.d.ts +11 -0
  297. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
  298. package/dist/modes/interactive/components/theme-selector.js +46 -0
  299. package/dist/modes/interactive/components/theme-selector.js.map +1 -0
  300. package/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
  301. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
  302. package/dist/modes/interactive/components/thinking-selector.js +47 -0
  303. package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
  304. package/dist/modes/interactive/components/tool-execution.d.ts +70 -0
  305. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
  306. package/dist/modes/interactive/components/tool-execution.js +606 -0
  307. package/dist/modes/interactive/components/tool-execution.js.map +1 -0
  308. package/dist/modes/interactive/components/tree-selector.d.ts +52 -0
  309. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
  310. package/dist/modes/interactive/components/tree-selector.js +745 -0
  311. package/dist/modes/interactive/components/tree-selector.js.map +1 -0
  312. package/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
  313. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
  314. package/dist/modes/interactive/components/user-message-selector.js +113 -0
  315. package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
  316. package/dist/modes/interactive/components/user-message.d.ts +8 -0
  317. package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
  318. package/dist/modes/interactive/components/user-message.js +16 -0
  319. package/dist/modes/interactive/components/user-message.js.map +1 -0
  320. package/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
  321. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
  322. package/dist/modes/interactive/components/visual-truncate.js +33 -0
  323. package/dist/modes/interactive/components/visual-truncate.js.map +1 -0
  324. package/dist/modes/interactive/interactive-mode.d.ts +261 -0
  325. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
  326. package/dist/modes/interactive/interactive-mode.js +3194 -0
  327. package/dist/modes/interactive/interactive-mode.js.map +1 -0
  328. package/dist/modes/interactive/theme/dark.json +85 -0
  329. package/dist/modes/interactive/theme/light.json +84 -0
  330. package/dist/modes/interactive/theme/theme-schema.json +308 -0
  331. package/dist/modes/interactive/theme/theme.d.ts +71 -0
  332. package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
  333. package/dist/modes/interactive/theme/theme.js +893 -0
  334. package/dist/modes/interactive/theme/theme.js.map +1 -0
  335. package/dist/modes/print-mode.d.ts +28 -0
  336. package/dist/modes/print-mode.d.ts.map +1 -0
  337. package/dist/modes/print-mode.js +140 -0
  338. package/dist/modes/print-mode.js.map +1 -0
  339. package/dist/modes/rpc/rpc-client.d.ts +209 -0
  340. package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
  341. package/dist/modes/rpc/rpc-client.js +392 -0
  342. package/dist/modes/rpc/rpc-client.js.map +1 -0
  343. package/dist/modes/rpc/rpc-mode.d.ts +20 -0
  344. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
  345. package/dist/modes/rpc/rpc-mode.js +486 -0
  346. package/dist/modes/rpc/rpc-mode.js.map +1 -0
  347. package/dist/modes/rpc/rpc-types.d.ts +372 -0
  348. package/dist/modes/rpc/rpc-types.d.ts.map +1 -0
  349. package/dist/modes/rpc/rpc-types.js +8 -0
  350. package/dist/modes/rpc/rpc-types.js.map +1 -0
  351. package/dist/utils/changelog.d.ts +21 -0
  352. package/dist/utils/changelog.d.ts.map +1 -0
  353. package/dist/utils/changelog.js +87 -0
  354. package/dist/utils/changelog.js.map +1 -0
  355. package/dist/utils/clipboard-image.d.ts +11 -0
  356. package/dist/utils/clipboard-image.d.ts.map +1 -0
  357. package/dist/utils/clipboard-image.js +129 -0
  358. package/dist/utils/clipboard-image.js.map +1 -0
  359. package/dist/utils/clipboard.d.ts +2 -0
  360. package/dist/utils/clipboard.d.ts.map +1 -0
  361. package/dist/utils/clipboard.js +73 -0
  362. package/dist/utils/clipboard.js.map +1 -0
  363. package/dist/utils/image-convert.d.ts +9 -0
  364. package/dist/utils/image-convert.d.ts.map +1 -0
  365. package/dist/utils/image-convert.js +31 -0
  366. package/dist/utils/image-convert.js.map +1 -0
  367. package/dist/utils/image-resize.d.ts +36 -0
  368. package/dist/utils/image-resize.d.ts.map +1 -0
  369. package/dist/utils/image-resize.js +188 -0
  370. package/dist/utils/image-resize.js.map +1 -0
  371. package/dist/utils/mime.d.ts +2 -0
  372. package/dist/utils/mime.d.ts.map +1 -0
  373. package/dist/utils/mime.js +26 -0
  374. package/dist/utils/mime.js.map +1 -0
  375. package/dist/utils/shell.d.ts +26 -0
  376. package/dist/utils/shell.d.ts.map +1 -0
  377. package/dist/utils/shell.js +151 -0
  378. package/dist/utils/shell.js.map +1 -0
  379. package/dist/utils/tools-manager.d.ts +3 -0
  380. package/dist/utils/tools-manager.d.ts.map +1 -0
  381. package/dist/utils/tools-manager.js +187 -0
  382. package/dist/utils/tools-manager.js.map +1 -0
  383. package/dist/utils/vips.d.ts +11 -0
  384. package/dist/utils/vips.d.ts.map +1 -0
  385. package/dist/utils/vips.js +35 -0
  386. package/dist/utils/vips.js.map +1 -0
  387. package/docs/compaction.md +388 -0
  388. package/docs/extensions.md +1524 -0
  389. package/docs/rpc.md +1046 -0
  390. package/docs/sdk.md +1024 -0
  391. package/docs/session.md +255 -0
  392. package/docs/skills.md +317 -0
  393. package/docs/theme.md +617 -0
  394. package/docs/tree.md +201 -0
  395. package/docs/tui.md +797 -0
  396. package/examples/README.md +24 -0
  397. package/examples/extensions/README.md +168 -0
  398. package/examples/extensions/auto-commit-on-exit.ts +49 -0
  399. package/examples/extensions/chalk-logger.ts +26 -0
  400. package/examples/extensions/claude-rules.ts +86 -0
  401. package/examples/extensions/confirm-destructive.ts +59 -0
  402. package/examples/extensions/custom-compaction.ts +114 -0
  403. package/examples/extensions/custom-footer.ts +64 -0
  404. package/examples/extensions/custom-header.ts +72 -0
  405. package/examples/extensions/dirty-repo-guard.ts +56 -0
  406. package/examples/extensions/doom-overlay/README.md +46 -0
  407. package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
  408. package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
  409. package/examples/extensions/doom-overlay/doom/build.sh +152 -0
  410. package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
  411. package/examples/extensions/doom-overlay/doom-component.ts +132 -0
  412. package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
  413. package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
  414. package/examples/extensions/doom-overlay/index.ts +74 -0
  415. package/examples/extensions/doom-overlay/wad-finder.ts +51 -0
  416. package/examples/extensions/file-trigger.ts +41 -0
  417. package/examples/extensions/git-checkpoint.ts +53 -0
  418. package/examples/extensions/handoff.ts +150 -0
  419. package/examples/extensions/hello.ts +25 -0
  420. package/examples/extensions/interactive-shell.ts +196 -0
  421. package/examples/extensions/mac-system-theme.ts +47 -0
  422. package/examples/extensions/modal-editor.ts +85 -0
  423. package/examples/extensions/model-status.ts +31 -0
  424. package/examples/extensions/notify.ts +25 -0
  425. package/examples/extensions/overlay-qa-tests.ts +881 -0
  426. package/examples/extensions/overlay-test.ts +145 -0
  427. package/examples/extensions/permission-gate.ts +34 -0
  428. package/examples/extensions/pirate.ts +47 -0
  429. package/examples/extensions/plan-mode/README.md +65 -0
  430. package/examples/extensions/plan-mode/index.ts +340 -0
  431. package/examples/extensions/plan-mode/utils.ts +168 -0
  432. package/examples/extensions/preset.ts +398 -0
  433. package/examples/extensions/protected-paths.ts +30 -0
  434. package/examples/extensions/qna.ts +119 -0
  435. package/examples/extensions/question.ts +277 -0
  436. package/examples/extensions/questionnaire.ts +427 -0
  437. package/examples/extensions/rainbow-editor.ts +95 -0
  438. package/examples/extensions/sandbox/index.ts +318 -0
  439. package/examples/extensions/sandbox/package-lock.json +92 -0
  440. package/examples/extensions/sandbox/package.json +19 -0
  441. package/examples/extensions/send-user-message.ts +97 -0
  442. package/examples/extensions/shutdown-command.ts +63 -0
  443. package/examples/extensions/snake.ts +343 -0
  444. package/examples/extensions/ssh.ts +220 -0
  445. package/examples/extensions/status-line.ts +40 -0
  446. package/examples/extensions/subagent/README.md +172 -0
  447. package/examples/extensions/subagent/agents/planner.md +37 -0
  448. package/examples/extensions/subagent/agents/reviewer.md +35 -0
  449. package/examples/extensions/subagent/agents/scout.md +50 -0
  450. package/examples/extensions/subagent/agents/worker.md +24 -0
  451. package/examples/extensions/subagent/agents.ts +156 -0
  452. package/examples/extensions/subagent/index.ts +963 -0
  453. package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
  454. package/examples/extensions/subagent/prompts/implement.md +10 -0
  455. package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
  456. package/examples/extensions/summarize.ts +195 -0
  457. package/examples/extensions/timed-confirm.ts +70 -0
  458. package/examples/extensions/todo.ts +299 -0
  459. package/examples/extensions/tool-override.ts +143 -0
  460. package/examples/extensions/tools.ts +146 -0
  461. package/examples/extensions/truncated-tool.ts +192 -0
  462. package/examples/extensions/with-deps/index.ts +36 -0
  463. package/examples/extensions/with-deps/package-lock.json +31 -0
  464. package/examples/extensions/with-deps/package.json +22 -0
  465. package/examples/sdk/01-minimal.ts +22 -0
  466. package/examples/sdk/02-custom-model.ts +49 -0
  467. package/examples/sdk/03-custom-prompt.ts +44 -0
  468. package/examples/sdk/04-skills.ts +47 -0
  469. package/examples/sdk/05-tools.ts +56 -0
  470. package/examples/sdk/06-extensions.ts +79 -0
  471. package/examples/sdk/07-context-files.ts +36 -0
  472. package/examples/sdk/08-prompt-templates.ts +42 -0
  473. package/examples/sdk/09-api-keys-and-oauth.ts +55 -0
  474. package/examples/sdk/10-settings.ts +38 -0
  475. package/examples/sdk/11-sessions.ts +48 -0
  476. package/examples/sdk/12-full-control.ts +72 -0
  477. package/examples/sdk/README.md +150 -0
  478. package/package.json +88 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,1961 @@
1
+ # Changelog
2
+
3
+ ## [0.45.7] - 2026-01-13
4
+
5
+ ### Added
6
+
7
+ - Exported `highlightCode` and `getLanguageFromPath` for extensions ([#703](https://github.com/badlogic/pi-mono/pull/703) by [@dannote](https://github.com/dannote))
8
+
9
+ ## [0.45.6] - 2026-01-13
10
+
11
+ ### Added
12
+
13
+ - `ctx.ui.custom()` now accepts `overlayOptions` for overlay positioning and sizing (anchor, margins, offsets, percentages, absolute positioning) ([#667](https://github.com/badlogic/pi-mono/pull/667) by [@nicobailon](https://github.com/nicobailon))
14
+ - `ctx.ui.custom()` now accepts `onHandle` callback to receive the `OverlayHandle` for controlling overlay visibility ([#667](https://github.com/badlogic/pi-mono/pull/667) by [@nicobailon](https://github.com/nicobailon))
15
+ - Extension example: `overlay-qa-tests.ts` with 10 commands for testing overlay positioning, animation, and toggle scenarios ([#667](https://github.com/badlogic/pi-mono/pull/667) by [@nicobailon](https://github.com/nicobailon))
16
+ - Extension example: `doom-overlay/` - DOOM game running as an overlay at 35 FPS (auto-downloads WAD on first run) ([#667](https://github.com/badlogic/pi-mono/pull/667) by [@nicobailon](https://github.com/nicobailon))
17
+
18
+ ## [0.45.5] - 2026-01-13
19
+
20
+ ### Fixed
21
+
22
+ - Skip changelog display on fresh install (only show on upgrades)
23
+
24
+ ## [0.45.4] - 2026-01-13
25
+
26
+ ### Changed
27
+
28
+ - Light theme colors adjusted for WCAG AA compliance (4.5:1 contrast ratio against white backgrounds)
29
+ - Replaced `sharp` with `wasm-vips` for image processing (resize, PNG conversion). Eliminates native build requirements that caused installation failures on some systems. ([#696](https://github.com/badlogic/pi-mono/issues/696))
30
+
31
+ ### Added
32
+
33
+ - Extension example: `summarize.ts` for summarizing conversations using custom UI and an external model ([#684](https://github.com/badlogic/pi-mono/pull/684) by [@scutifer](https://github.com/scutifer))
34
+ - Extension example: `question.ts` enhanced with custom UI for asking user questions ([#693](https://github.com/badlogic/pi-mono/pull/693) by [@ferologics](https://github.com/ferologics))
35
+ - Extension example: `plan-mode/` enhanced with explicit step tracking and progress widget ([#694](https://github.com/badlogic/pi-mono/pull/694) by [@ferologics](https://github.com/ferologics))
36
+ - Extension example: `questionnaire.ts` for multi-question input with tab bar navigation ([#695](https://github.com/badlogic/pi-mono/pull/695) by [@ferologics](https://github.com/ferologics))
37
+ - Experimental Vercel AI Gateway provider support: set `AI_GATEWAY_API_KEY` and use `--provider vercel-ai-gateway`. Token usage is currently reported incorrectly by Anthropic Messages compatible endpoint. ([#689](https://github.com/badlogic/pi-mono/pull/689) by [@timolins](https://github.com/timolins))
38
+
39
+ ### Fixed
40
+
41
+ - Fix API key resolution after model switches by using provider argument ([#691](https://github.com/badlogic/pi-mono/pull/691) by [@joshp123](https://github.com/joshp123))
42
+ - Fixed z.ai thinking/reasoning: thinking toggle now correctly enables/disables thinking for z.ai models ([#688](https://github.com/badlogic/pi-mono/issues/688))
43
+ - Fixed extension loading in compiled Bun binary: extensions with local file imports now work correctly. Updated `@mariozechner/jiti` to v2.6.5 which bundles babel for Bun binary compatibility. ([#681](https://github.com/badlogic/pi-mono/issues/681))
44
+ - Fixed theme loading when installed via mise: use wrapper directory in release tarballs for compatibility with mise's `strip_components=1` extraction. ([#681](https://github.com/badlogic/pi-mono/issues/681))
45
+
46
+ ## [0.45.3] - 2026-01-13
47
+
48
+ ## [0.45.2] - 2026-01-13
49
+
50
+ ### Fixed
51
+
52
+ - Extensions now load correctly in compiled Bun binary using `@mariozechner/jiti` fork with `virtualModules` support. Bundled packages (`@sinclair/typebox`, `@mariozechner/pi-tui`, `@mariozechner/pi-ai`, `@mariozechner/pi-coding-agent`) are accessible to extensions without filesystem node_modules.
53
+
54
+ ## [0.45.1] - 2026-01-13
55
+
56
+ ### Changed
57
+
58
+ - `/share` now outputs `buildwithpi.ai` session preview URLs instead of `shittycodingagent.ai`
59
+
60
+ ## [0.45.0] - 2026-01-13
61
+
62
+ ### Added
63
+
64
+ - MiniMax provider support: set `MINIMAX_API_KEY` and use `minimax/MiniMax-M2.1` ([#656](https://github.com/badlogic/pi-mono/pull/656) by [@dannote](https://github.com/dannote))
65
+ - `/scoped-models`: Alt+Up/Down to reorder enabled models. Order is preserved when saving with Ctrl+S and determines Ctrl+P cycling order. ([#676](https://github.com/badlogic/pi-mono/pull/676) by [@thomasmhr](https://github.com/thomasmhr))
66
+ - Amazon Bedrock provider support (experimental, tested with Anthropic Claude models only) ([#494](https://github.com/badlogic/pi-mono/pull/494) by [@unexge](https://github.com/unexge))
67
+ - Extension example: `sandbox/` for OS-level bash sandboxing using `@anthropic-ai/sandbox-runtime` with per-project config ([#673](https://github.com/badlogic/pi-mono/pull/673) by [@dannote](https://github.com/dannote))
68
+ - Print mode JSON output now emits the session header as the first line.
69
+
70
+ ## [0.44.0] - 2026-01-12
71
+
72
+ ### Breaking Changes
73
+
74
+ - `pi.getAllTools()` now returns `ToolInfo[]` (with `name` and `description`) instead of `string[]`. Extensions that only need names can use `.map(t => t.name)`. ([#648](https://github.com/badlogic/pi-mono/pull/648) by [@carsonfarmer](https://github.com/carsonfarmer))
75
+
76
+ ### Added
77
+
78
+ - Session naming: `/name <name>` command sets a display name shown in the session selector instead of the first message. Useful for distinguishing forked sessions. Extensions can use `pi.setSessionName()` and `pi.getSessionName()`. ([#650](https://github.com/badlogic/pi-mono/pull/650) by [@scutifer](https://github.com/scutifer))
79
+ - Extension example: `notify.ts` for desktop notifications via OSC 777 escape sequence ([#658](https://github.com/badlogic/pi-mono/pull/658) by [@ferologics](https://github.com/ferologics))
80
+ - Inline hint for queued messages showing the `Alt+Up` restore shortcut ([#657](https://github.com/badlogic/pi-mono/pull/657) by [@tmustier](https://github.com/tmustier))
81
+ - Page-up/down navigation in `/resume` session selector to jump by 5 items ([#662](https://github.com/badlogic/pi-mono/pull/662) by [@aliou](https://github.com/aliou))
82
+ - Fuzzy search in `/settings` menu: type to filter settings by label ([#643](https://github.com/badlogic/pi-mono/pull/643) by [@ninlds](https://github.com/ninlds))
83
+
84
+ ### Fixed
85
+
86
+ - Session selector now stays open when current folder has no sessions, allowing Tab to switch to "all" scope ([#661](https://github.com/badlogic/pi-mono/pull/661) by [@aliou](https://github.com/aliou))
87
+ - Extensions using theme utilities like `getSettingsListTheme()` now work in dev mode with tsx
88
+
89
+ ## [0.43.0] - 2026-01-11
90
+
91
+ ### Breaking Changes
92
+
93
+ - Extension editor (`ctx.ui.editor()`) now uses Enter to submit and Shift+Enter for newlines, matching the main editor. Previously used Ctrl+Enter to submit. Extensions with hardcoded "ctrl+enter" hints need updating. ([#642](https://github.com/badlogic/pi-mono/pull/642) by [@mitsuhiko](https://github.com/mitsuhiko))
94
+ - Renamed `/branch` command to `/fork` ([#641](https://github.com/badlogic/pi-mono/issues/641))
95
+ - RPC: `branch` → `fork`, `get_branch_messages` → `get_fork_messages`
96
+ - SDK: `branch()` → `fork()`, `getBranchMessages()` → `getForkMessages()`
97
+ - AgentSession: `branch()` → `fork()`, `getUserMessagesForBranching()` → `getUserMessagesForForking()`
98
+ - Extension events: `session_before_branch` → `session_before_fork`, `session_branch` → `session_fork`
99
+ - Settings: `doubleEscapeAction: "branch" | "tree"` → `"fork" | "tree"`
100
+ - `SessionManager.list()` and `SessionManager.listAll()` are now async, returning `Promise<SessionInfo[]>`. Callers must await them. ([#620](https://github.com/badlogic/pi-mono/pull/620) by [@tmustier](https://github.com/tmustier))
101
+
102
+ ### Added
103
+ - `/resume` selector now toggles between current-folder and all sessions with Tab, showing the session cwd in the All view and loading progress. ([#620](https://github.com/badlogic/pi-mono/pull/620) by [@tmustier](https://github.com/tmustier))
104
+ - `SessionManager.list()` and `SessionManager.listAll()` accept optional `onProgress` callback for progress updates
105
+ - `SessionInfo.cwd` field containing the session's working directory (empty string for old sessions)
106
+ - `SessionListProgress` type export for progress callbacks
107
+ - `/scoped-models` command to enable/disable models for Ctrl+P cycling. Changes are session-only by default; press Ctrl+S to persist to settings.json. ([#626](https://github.com/badlogic/pi-mono/pull/626) by [@CarlosGtrz](https://github.com/CarlosGtrz))
108
+ - `model_select` extension hook fires when model changes via `/model`, model cycling, or session restore with `source` field and `previousModel` ([#628](https://github.com/badlogic/pi-mono/pull/628) by [@marckrenn](https://github.com/marckrenn))
109
+ - `ctx.ui.setWorkingMessage()` extension API to customize the "Working..." message during streaming ([#625](https://github.com/badlogic/pi-mono/pull/625) by [@nicobailon](https://github.com/nicobailon))
110
+ - Skill slash commands: loaded skills are registered as `/skill:name` commands for quick access. Toggle via `/settings` or `skills.enableSkillCommands` in settings.json. ([#630](https://github.com/badlogic/pi-mono/pull/630) by [@Dwsy](https://github.com/Dwsy))
111
+ - Slash command autocomplete now uses fuzzy matching (type `/skbra` to match `/skill:brave-search`)
112
+ - `/tree` branch summarization now offers three options: "No summary", "Summarize", and "Summarize with custom prompt". Custom prompts are appended as additional focus to the default summarization instructions. ([#642](https://github.com/badlogic/pi-mono/pull/642) by [@mitsuhiko](https://github.com/mitsuhiko))
113
+
114
+ ### Fixed
115
+
116
+ - Missing spacer between assistant message and text editor ([#655](https://github.com/badlogic/pi-mono/issues/655))
117
+ - Session picker respects custom keybindings when using `--resume` ([#633](https://github.com/badlogic/pi-mono/pull/633) by [@aos](https://github.com/aos))
118
+ - Custom footer extensions now see model changes: `ctx.model` is now a getter that returns the current model instead of a snapshot from when the context was created ([#634](https://github.com/badlogic/pi-mono/pull/634) by [@ogulcancelik](https://github.com/ogulcancelik))
119
+ - Footer git branch not updating after external branch switches. Git uses atomic writes (temp file + rename), which changes the inode and breaks `fs.watch` on the file. Now watches the directory instead.
120
+ - Extension loading errors are now displayed to the user instead of being silently ignored ([#639](https://github.com/badlogic/pi-mono/pull/639) by [@aliou](https://github.com/aliou))
121
+
122
+ ## [0.42.5] - 2026-01-11
123
+
124
+ ### Fixed
125
+
126
+ - Reduced flicker by only re-rendering changed lines ([#617](https://github.com/badlogic/pi-mono/pull/617) by [@ogulcancelik](https://github.com/ogulcancelik)). No worries tho, there's still a little flicker in the VS Code Terminal. Praise the flicker.
127
+ - Cursor position tracking when content shrinks with unchanged remaining lines
128
+ - TUI renders with wrong dimensions after suspend/resume if terminal was resized while suspended ([#599](https://github.com/badlogic/pi-mono/issues/599))
129
+ - Pasted content containing Kitty key release patterns (e.g., `:3F` in MAC addresses) was incorrectly filtered out ([#623](https://github.com/badlogic/pi-mono/pull/623) by [@ogulcancelik](https://github.com/ogulcancelik))
130
+
131
+ ## [0.42.4] - 2026-01-10
132
+
133
+ ### Fixed
134
+
135
+ - Bash output expanded hint now says "(ctrl+o to collapse)" ([#610](https://github.com/badlogic/pi-mono/pull/610) by [@tallshort](https://github.com/tallshort))
136
+ - Fixed UTF-8 text corruption in remote bash execution (SSH, containers) by using streaming TextDecoder ([#608](https://github.com/badlogic/pi-mono/issues/608))
137
+
138
+ ## [0.42.3] - 2026-01-10
139
+
140
+ ### Changed
141
+
142
+ - OpenAI Codex: updated to use bundled system prompt from upstream
143
+
144
+ ## [0.42.2] - 2026-01-10
145
+
146
+ ### Added
147
+
148
+ - `/model <search>` now pre-filters the model selector or auto-selects on exact match. Use `provider/model` syntax to disambiguate (e.g., `/model openai/gpt-4`). ([#587](https://github.com/badlogic/pi-mono/pull/587) by [@zedrdave](https://github.com/zedrdave))
149
+ - `FooterDataProvider` for custom footers: `ctx.ui.setFooter()` now receives a third `footerData` parameter providing `getGitBranch()`, `getExtensionStatuses()`, and `onBranchChange()` for reactive updates ([#600](https://github.com/badlogic/pi-mono/pull/600) by [@nicobailon](https://github.com/nicobailon))
150
+ - `Alt+Up` hotkey to restore queued steering/follow-up messages back into the editor without aborting the current run ([#604](https://github.com/badlogic/pi-mono/pull/604) by [@tmustier](https://github.com/tmustier))
151
+
152
+ ### Fixed
153
+
154
+ - Fixed LM Studio compatibility for OpenAI Responses tool strict mapping in the ai provider ([#598](https://github.com/badlogic/pi-mono/pull/598) by [@gnattu](https://github.com/gnattu))
155
+
156
+ ## [0.42.1] - 2026-01-09
157
+
158
+ ### Fixed
159
+
160
+ - Symlinked directories in `prompts/` folders are now followed when loading prompt templates ([#601](https://github.com/badlogic/pi-mono/pull/601) by [@aliou](https://github.com/aliou))
161
+
162
+ ## [0.42.0] - 2026-01-09
163
+
164
+ ### Added
165
+
166
+ - Added OpenCode Zen provider support. Set `OPENCODE_API_KEY` env var and use `opencode/<model-id>` (e.g., `opencode/claude-opus-4-5`).
167
+
168
+ ## [0.41.0] - 2026-01-09
169
+
170
+ ### Added
171
+
172
+ - Anthropic OAuth support is back! Use `/login` to authenticate with your Claude Pro/Max subscription.
173
+
174
+ ## [0.40.1] - 2026-01-09
175
+
176
+ ### Removed
177
+
178
+ - Anthropic OAuth support (`/login`). Use API keys instead.
179
+
180
+ ## [0.40.0] - 2026-01-08
181
+
182
+ ### Added
183
+
184
+ - Documentation on component invalidation and theme changes in `docs/tui.md`
185
+
186
+ ### Fixed
187
+
188
+ - Components now properly rebuild their content on theme change (tool executions, assistant messages, bash executions, custom messages, branch/compaction summaries)
189
+
190
+ ## [0.39.1] - 2026-01-08
191
+
192
+ ### Fixed
193
+
194
+ - `setTheme()` now triggers a full rerender so previously rendered components update with the new theme colors
195
+ - `mac-system-theme.ts` example now polls every 2 seconds and uses `osascript` for real-time macOS appearance detection
196
+
197
+ ## [0.39.0] - 2026-01-08
198
+
199
+ ### Breaking Changes
200
+
201
+ - `before_agent_start` event now receives `systemPrompt` in the event object and returns `systemPrompt` (full replacement) instead of `systemPromptAppend`. Extensions that were appending must now use `event.systemPrompt + extra` pattern. ([#575](https://github.com/badlogic/pi-mono/issues/575))
202
+ - `discoverSkills()` now returns `{ skills: Skill[], warnings: SkillWarning[] }` instead of `Skill[]`. This allows callers to handle skill loading warnings. ([#577](https://github.com/badlogic/pi-mono/pull/577) by [@cv](https://github.com/cv))
203
+
204
+ ### Added
205
+
206
+ - `ctx.ui.getAllThemes()`, `ctx.ui.getTheme(name)`, and `ctx.ui.setTheme(name | Theme)` methods for extensions to list, load, and switch themes at runtime ([#576](https://github.com/badlogic/pi-mono/pull/576))
207
+ - `--no-tools` flag to disable all built-in tools, allowing extension-only tool setups ([#557](https://github.com/badlogic/pi-mono/pull/557) by [@cv](https://github.com/cv))
208
+ - Pluggable operations for built-in tools enabling remote execution via SSH or other transports ([#564](https://github.com/badlogic/pi-mono/issues/564)). Interfaces: `ReadOperations`, `WriteOperations`, `EditOperations`, `BashOperations`, `LsOperations`, `GrepOperations`, `FindOperations`
209
+ - `user_bash` event for intercepting user `!`/`!!` commands, allowing extensions to redirect to remote systems ([#528](https://github.com/badlogic/pi-mono/issues/528))
210
+ - `setActiveTools()` in ExtensionAPI for dynamic tool management
211
+ - Built-in renderers used automatically for tool overrides without custom `renderCall`/`renderResult`
212
+ - `ssh.ts` example: remote tool execution via `--ssh user@host:/path`
213
+ - `interactive-shell.ts` example: run interactive commands (vim, git rebase, htop) with full terminal access via `!i` prefix or auto-detection
214
+ - Wayland clipboard support for `/copy` command using wl-copy with xclip/xsel fallback ([#570](https://github.com/badlogic/pi-mono/pull/570) by [@OgulcanCelik](https://github.com/OgulcanCelik))
215
+ - **Experimental:** `ctx.ui.custom()` now accepts `{ overlay: true }` option for floating modal components that composite over existing content without clearing the screen ([#558](https://github.com/badlogic/pi-mono/pull/558) by [@nicobailon](https://github.com/nicobailon))
216
+ - `AgentSession.skills` and `AgentSession.skillWarnings` properties to access loaded skills without rediscovery ([#577](https://github.com/badlogic/pi-mono/pull/577) by [@cv](https://github.com/cv))
217
+
218
+ ### Fixed
219
+
220
+ - String `systemPrompt` in `createAgentSession()` now works as a full replacement instead of having context files and skills appended, matching documented behavior ([#543](https://github.com/badlogic/pi-mono/issues/543))
221
+ - Update notification for bun binary installs now shows release download URL instead of npm command ([#567](https://github.com/badlogic/pi-mono/pull/567) by [@ferologics](https://github.com/ferologics))
222
+ - ESC key now works during "Working..." state after auto-retry ([#568](https://github.com/badlogic/pi-mono/pull/568) by [@tmustier](https://github.com/tmustier))
223
+ - Abort messages now show correct retry attempt count (e.g., "Aborted after 2 retry attempts") ([#568](https://github.com/badlogic/pi-mono/pull/568) by [@tmustier](https://github.com/tmustier))
224
+ - Fixed Antigravity provider returning 429 errors despite available quota ([#571](https://github.com/badlogic/pi-mono/pull/571) by [@ben-vargas](https://github.com/ben-vargas))
225
+ - Fixed malformed thinking text in Gemini/Antigravity responses where thinking content appeared as regular text or vice versa. Cross-model conversations now properly convert thinking blocks to plain text. ([#561](https://github.com/badlogic/pi-mono/issues/561))
226
+ - `--no-skills` flag now correctly prevents skills from loading in interactive mode ([#577](https://github.com/badlogic/pi-mono/pull/577) by [@cv](https://github.com/cv))
227
+
228
+ ## [0.38.0] - 2026-01-08
229
+
230
+ ### Breaking Changes
231
+
232
+ - `ctx.ui.custom()` factory signature changed from `(tui, theme, done)` to `(tui, theme, keybindings, done)` for keybinding access in custom components
233
+ - `LoadedExtension` type renamed to `Extension`
234
+ - `LoadExtensionsResult.setUIContext()` removed, replaced with `runtime: ExtensionRuntime`
235
+ - `ExtensionRunner` constructor now requires `runtime: ExtensionRuntime` as second parameter
236
+ - `ExtensionRunner.initialize()` signature changed from options object to positional params `(actions, contextActions, commandContextActions?, uiContext?)`
237
+ - `ExtensionRunner.getHasUI()` renamed to `hasUI()`
238
+ - OpenAI Codex model aliases removed (`gpt-5`, `gpt-5-mini`, `gpt-5-nano`, `codex-mini-latest`). Use canonical IDs: `gpt-5.1`, `gpt-5.1-codex-mini`, `gpt-5.2`, `gpt-5.2-codex`. ([#536](https://github.com/badlogic/pi-mono/pull/536) by [@ghoulr](https://github.com/ghoulr))
239
+
240
+ ### Added
241
+
242
+ - `--no-extensions` flag to disable extension discovery while still allowing explicit `-e` paths ([#524](https://github.com/badlogic/pi-mono/pull/524) by [@cv](https://github.com/cv))
243
+ - SDK: `InteractiveMode`, `runPrintMode()`, `runRpcMode()` exported for building custom run modes. See `docs/sdk.md`.
244
+ - `PI_SKIP_VERSION_CHECK` environment variable to disable new version notifications at startup ([#549](https://github.com/badlogic/pi-mono/pull/549) by [@aos](https://github.com/aos))
245
+ - `thinkingBudgets` setting to customize token budgets per thinking level for token-based providers ([#529](https://github.com/badlogic/pi-mono/pull/529) by [@melihmucuk](https://github.com/melihmucuk))
246
+ - Extension UI dialogs (`ctx.ui.select()`, `ctx.ui.confirm()`, `ctx.ui.input()`) now support a `timeout` option with live countdown display ([#522](https://github.com/badlogic/pi-mono/pull/522) by [@nicobailon](https://github.com/nicobailon))
247
+ - Extensions can now provide custom editor components via `ctx.ui.setEditorComponent()`. See `examples/extensions/modal-editor.ts` and `docs/tui.md` Pattern 7.
248
+ - Extension factories can now be async, enabling dynamic imports and lazy-loaded dependencies ([#513](https://github.com/badlogic/pi-mono/pull/513) by [@austinm911](https://github.com/austinm911))
249
+ - `ctx.shutdown()` is now available in extension contexts for requesting a graceful shutdown. In interactive mode, shutdown is deferred until the agent becomes idle (after processing all queued steering and follow-up messages). In RPC mode, shutdown is deferred until after completing the current command response. In print mode, shutdown is a no-op as the process exits automatically when prompts complete. ([#542](https://github.com/badlogic/pi-mono/pull/542) by [@kaofelix](https://github.com/kaofelix))
250
+
251
+ ### Fixed
252
+
253
+ - Default thinking level from settings now applies correctly when `enabledModels` is configured ([#540](https://github.com/badlogic/pi-mono/pull/540) by [@ferologics](https://github.com/ferologics))
254
+ - External edits to `settings.json` while pi is running are now preserved when pi saves settings ([#527](https://github.com/badlogic/pi-mono/pull/527) by [@ferologics](https://github.com/ferologics))
255
+ - Overflow-based compaction now skips if error came from a different model or was already handled by a previous compaction ([#535](https://github.com/badlogic/pi-mono/pull/535) by [@mitsuhiko](https://github.com/mitsuhiko))
256
+ - OpenAI Codex context window reduced from 400k to 272k tokens to match Codex CLI defaults and prevent 400 errors ([#536](https://github.com/badlogic/pi-mono/pull/536) by [@ghoulr](https://github.com/ghoulr))
257
+ - Context overflow detection now recognizes `context_length_exceeded` errors.
258
+ - Key presses no longer dropped when input is batched over SSH ([#538](https://github.com/badlogic/pi-mono/issues/538))
259
+ - Clipboard image support now works on Alpine Linux and other musl-based distros ([#533](https://github.com/badlogic/pi-mono/issues/533))
260
+
261
+ ## [0.37.8] - 2026-01-07
262
+
263
+ ## [0.37.7] - 2026-01-07
264
+
265
+ ## [0.37.6] - 2026-01-06
266
+
267
+ ### Added
268
+
269
+ - Extension UI dialogs (`ctx.ui.select()`, `ctx.ui.confirm()`, `ctx.ui.input()`) now accept an optional `AbortSignal` to programmatically dismiss dialogs. Useful for implementing timeouts. See `examples/extensions/timed-confirm.ts`. ([#474](https://github.com/badlogic/pi-mono/issues/474))
270
+ - HTML export now shows bridge prompts in model change messages for Codex sessions ([#510](https://github.com/badlogic/pi-mono/pull/510) by [@mitsuhiko](https://github.com/mitsuhiko))
271
+
272
+ ## [0.37.5] - 2026-01-06
273
+
274
+ ### Added
275
+
276
+ - ExtensionAPI: `setModel()`, `getThinkingLevel()`, `setThinkingLevel()` methods for extensions to change model and thinking level at runtime ([#509](https://github.com/badlogic/pi-mono/issues/509))
277
+ - Exported truncation utilities for custom tools: `truncateHead`, `truncateTail`, `truncateLine`, `formatSize`, `DEFAULT_MAX_BYTES`, `DEFAULT_MAX_LINES`, `TruncationOptions`, `TruncationResult`
278
+ - New example `truncated-tool.ts` demonstrating proper output truncation with custom rendering for extensions
279
+ - New example `preset.ts` demonstrating preset configurations with model/thinking/tools switching ([#347](https://github.com/badlogic/pi-mono/issues/347))
280
+ - Documentation for output truncation best practices in `docs/extensions.md`
281
+ - Exported all UI components for extensions: `ArminComponent`, `AssistantMessageComponent`, `BashExecutionComponent`, `BorderedLoader`, `BranchSummaryMessageComponent`, `CompactionSummaryMessageComponent`, `CustomEditor`, `CustomMessageComponent`, `DynamicBorder`, `ExtensionEditorComponent`, `ExtensionInputComponent`, `ExtensionSelectorComponent`, `FooterComponent`, `LoginDialogComponent`, `ModelSelectorComponent`, `OAuthSelectorComponent`, `SessionSelectorComponent`, `SettingsSelectorComponent`, `ShowImagesSelectorComponent`, `ThemeSelectorComponent`, `ThinkingSelectorComponent`, `ToolExecutionComponent`, `TreeSelectorComponent`, `UserMessageComponent`, `UserMessageSelectorComponent`, plus utilities `renderDiff`, `truncateToVisualLines`
282
+ - `docs/tui.md`: Common Patterns section with copy-paste code for SelectList, BorderedLoader, SettingsList, setStatus, setWidget, setFooter
283
+ - `docs/tui.md`: Key Rules section documenting critical patterns for extension UI development
284
+ - `docs/extensions.md`: Exhaustive example links for all ExtensionAPI methods and events
285
+ - System prompt now references `docs/tui.md` for TUI component development
286
+
287
+ ## [0.37.4] - 2026-01-06
288
+
289
+ ### Added
290
+
291
+ - Session picker (`pi -r`) and `--session` flag now support searching/resuming by session ID (UUID prefix) ([#495](https://github.com/badlogic/pi-mono/issues/495) by [@arunsathiya](https://github.com/arunsathiya))
292
+ - Extensions can now replace the startup header with `ctx.ui.setHeader()`, see `examples/extensions/custom-header.ts` ([#500](https://github.com/badlogic/pi-mono/pull/500) by [@tudoroancea](https://github.com/tudoroancea))
293
+
294
+ ### Changed
295
+
296
+ - Startup help text: fixed misleading "ctrl+k to delete line" to "ctrl+k to delete to end"
297
+ - Startup help text and `/hotkeys`: added `!!` shortcut for running bash without adding output to context
298
+
299
+ ### Fixed
300
+
301
+ - Queued steering/follow-up messages no longer wipe unsent editor input ([#503](https://github.com/badlogic/pi-mono/pull/503) by [@tmustier](https://github.com/tmustier))
302
+ - OAuth token refresh failure no longer crashes app at startup, allowing user to `/login` to re-authenticate ([#498](https://github.com/badlogic/pi-mono/issues/498))
303
+
304
+ ## [0.37.3] - 2026-01-06
305
+
306
+ ### Added
307
+
308
+ - Extensions can now replace the footer with `ctx.ui.setFooter()`, see `examples/extensions/custom-footer.ts` ([#481](https://github.com/badlogic/pi-mono/issues/481))
309
+ - Session ID is now forwarded to LLM providers for session-based caching (used by OpenAI Codex for prompt caching).
310
+ - Added `blockImages` setting to prevent images from being sent to LLM providers ([#492](https://github.com/badlogic/pi-mono/pull/492) by [@jsinge97](https://github.com/jsinge97))
311
+ - Extensions can now send user messages via `pi.sendUserMessage()` ([#483](https://github.com/badlogic/pi-mono/issues/483))
312
+
313
+ ### Fixed
314
+
315
+ - Add `minimatch` as a direct dependency for explicit imports.
316
+ - Status bar now shows correct git branch when running in a git worktree ([#490](https://github.com/badlogic/pi-mono/pull/490) by [@kcosr](https://github.com/kcosr))
317
+ - Interactive mode: Ctrl+V clipboard image paste now works on Wayland sessions by using `wl-paste` with `xclip` fallback ([#488](https://github.com/badlogic/pi-mono/pull/488) by [@ghoulr](https://github.com/ghoulr))
318
+
319
+ ## [0.37.2] - 2026-01-05
320
+
321
+ ### Fixed
322
+
323
+ - Extension directories in `settings.json` now respect `package.json` manifests, matching global extension behavior ([#480](https://github.com/badlogic/pi-mono/pull/480) by [@prateekmedia](https://github.com/prateekmedia))
324
+ - Share viewer: deep links now scroll to the target message when opened via `/share`
325
+ - Bash tool now handles spawn errors gracefully instead of crashing the agent (missing cwd, invalid shell path) ([#479](https://github.com/badlogic/pi-mono/pull/479) by [@robinwander](https://github.com/robinwander))
326
+
327
+ ## [0.37.1] - 2026-01-05
328
+
329
+ ### Fixed
330
+
331
+ - Share viewer: copy-link buttons now generate correct URLs when session is viewed via `/share` (iframe context)
332
+
333
+ ## [0.37.0] - 2026-01-05
334
+
335
+ ### Added
336
+
337
+ - Share viewer: copy-link button on messages to share URLs that navigate directly to a specific message ([#477](https://github.com/badlogic/pi-mono/pull/477) by [@lockmeister](https://github.com/lockmeister))
338
+ - Extension example: add `claude-rules` to load `.claude/rules/` entries into the system prompt ([#461](https://github.com/badlogic/pi-mono/pull/461) by [@vaayne](https://github.com/vaayne))
339
+ - Headless OAuth login: all providers now show paste input for manual URL/code entry, works over SSH without DISPLAY ([#428](https://github.com/badlogic/pi-mono/pull/428) by [@ben-vargas](https://github.com/ben-vargas), [#468](https://github.com/badlogic/pi-mono/pull/468) by [@crcatala](https://github.com/crcatala))
340
+
341
+ ### Changed
342
+
343
+ - OAuth login UI now uses dedicated dialog component with consistent borders
344
+ - Assume truecolor support for all terminals except `dumb`, empty, or `linux` (fixes colors over SSH)
345
+ - OpenAI Codex clean-up: removed per-thinking-level model variants, thinking level is now set separately and the provider clamps to what each model supports internally (initial implementation in [#472](https://github.com/badlogic/pi-mono/pull/472) by [@ben-vargas](https://github.com/ben-vargas))
346
+
347
+ ### Fixed
348
+
349
+ - Messages submitted during compaction are queued and delivered after compaction completes, preserving steering and follow-up behavior. Extension commands execute immediately during compaction. ([#476](https://github.com/badlogic/pi-mono/pull/476) by [@tmustier](https://github.com/tmustier))
350
+ - Managed binaries (`fd`, `rg`) now stored in `~/.pi/agent/bin/` instead of `tools/`, eliminating false deprecation warnings ([#470](https://github.com/badlogic/pi-mono/pull/470) by [@mcinteerj](https://github.com/mcinteerj))
351
+ - Extensions defined in `settings.json` were not loaded ([#463](https://github.com/badlogic/pi-mono/pull/463) by [@melihmucuk](https://github.com/melihmucuk))
352
+ - OAuth refresh no longer logs users out when multiple pi instances are running ([#466](https://github.com/badlogic/pi-mono/pull/466) by [@Cursivez](https://github.com/Cursivez))
353
+ - Migration warnings now ignore `fd.exe` and `rg.exe` in `tools/` on Windows ([#458](https://github.com/badlogic/pi-mono/pull/458) by [@carlosgtrz](https://github.com/carlosgtrz))
354
+ - CI: add `examples/extensions/with-deps` to workspaces to fix typecheck ([#467](https://github.com/badlogic/pi-mono/pull/467) by [@aliou](https://github.com/aliou))
355
+ - SDK: passing `extensions: []` now disables extension discovery as documented ([#465](https://github.com/badlogic/pi-mono/pull/465) by [@aliou](https://github.com/aliou))
356
+
357
+ ## [0.36.0] - 2026-01-05
358
+
359
+ ### Added
360
+
361
+ - Experimental: OpenAI Codex OAuth provider support: access Codex models via ChatGPT Plus/Pro subscription using `/login openai-codex` ([#451](https://github.com/badlogic/pi-mono/pull/451) by [@kim0](https://github.com/kim0))
362
+
363
+ ## [0.35.0] - 2026-01-05
364
+
365
+ This release unifies hooks and custom tools into a single "extensions" system and renames "slash commands" to "prompt templates". ([#454](https://github.com/badlogic/pi-mono/issues/454))
366
+
367
+ **Before migrating, read:**
368
+
369
+ - [docs/extensions.md](docs/extensions.md) - Full API reference
370
+ - [README.md](README.md) - Extensions section with examples
371
+ - [examples/extensions/](examples/extensions/) - Working examples
372
+
373
+ ### Extensions Migration
374
+
375
+ Hooks and custom tools are now unified as **extensions**. Both were TypeScript modules exporting a factory function that receives an API object. Now there's one concept, one discovery location, one CLI flag, one settings.json entry.
376
+
377
+ **Automatic migration:**
378
+
379
+ - `commands/` directories are automatically renamed to `prompts/` on startup (both `~/.pi/agent/commands/` and `.pi/commands/`)
380
+
381
+ **Manual migration required:**
382
+
383
+ 1. Move files from `hooks/` and `tools/` directories to `extensions/` (deprecation warnings shown on startup)
384
+ 2. Update imports and type names in your extension code
385
+ 3. Update `settings.json` if you have explicit hook and custom tool paths configured
386
+
387
+ **Directory changes:**
388
+
389
+ ```
390
+ # Before
391
+ ~/.pi/agent/hooks/*.ts → ~/.pi/agent/extensions/*.ts
392
+ ~/.pi/agent/tools/*.ts → ~/.pi/agent/extensions/*.ts
393
+ .pi/hooks/*.ts → .pi/extensions/*.ts
394
+ .pi/tools/*.ts → .pi/extensions/*.ts
395
+ ```
396
+
397
+ **Extension discovery rules** (in `extensions/` directories):
398
+
399
+ 1. **Direct files:** `extensions/*.ts` or `*.js` → loaded directly
400
+ 2. **Subdirectory with index:** `extensions/myext/index.ts` → loaded as single extension
401
+ 3. **Subdirectory with package.json:** `extensions/myext/package.json` with `"pi"` field → loads declared paths
402
+
403
+ ```json
404
+ // extensions/my-package/package.json
405
+ {
406
+ "name": "my-extension-package",
407
+ "dependencies": { "zod": "^3.0.0" },
408
+ "pi": {
409
+ "extensions": ["./src/main.ts", "./src/tools.ts"]
410
+ }
411
+ }
412
+ ```
413
+
414
+ No recursion beyond one level. Complex packages must use the `package.json` manifest. Dependencies are resolved via jiti, and extensions can be published to and installed from npm.
415
+
416
+ **Type renames:**
417
+
418
+ - `HookAPI` → `ExtensionAPI`
419
+ - `HookContext` → `ExtensionContext`
420
+ - `HookCommandContext` → `ExtensionCommandContext`
421
+ - `HookUIContext` → `ExtensionUIContext`
422
+ - `CustomToolAPI` → `ExtensionAPI` (merged)
423
+ - `CustomToolContext` → `ExtensionContext` (merged)
424
+ - `CustomToolUIContext` → `ExtensionUIContext`
425
+ - `CustomTool` → `ToolDefinition`
426
+ - `CustomToolFactory` → `ExtensionFactory`
427
+ - `HookMessage` → `CustomMessage`
428
+
429
+ **Import changes:**
430
+
431
+ ```typescript
432
+ // Before (hook)
433
+ import type { HookAPI, HookContext } from "@mariozechner/pi-coding-agent";
434
+ export default function (pi: HookAPI) { ... }
435
+
436
+ // Before (custom tool)
437
+ import type { CustomToolFactory } from "@mariozechner/pi-coding-agent";
438
+ const factory: CustomToolFactory = (pi) => ({ name: "my_tool", ... });
439
+ export default factory;
440
+
441
+ // After (both are now extensions)
442
+ import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
443
+ export default function (pi: ExtensionAPI) {
444
+ pi.on("tool_call", async (event, ctx) => { ... });
445
+ pi.registerTool({ name: "my_tool", ... });
446
+ }
447
+ ```
448
+
449
+ **Custom tools now have full context access.** Tools registered via `pi.registerTool()` now receive the same `ctx` object that event handlers receive. Previously, custom tools had limited context. Now all extension code shares the same capabilities:
450
+
451
+ - `pi.registerTool()` - Register tools the LLM can call
452
+ - `pi.registerCommand()` - Register commands like `/mycommand`
453
+ - `pi.registerShortcut()` - Register keyboard shortcuts (shown in `/hotkeys`)
454
+ - `pi.registerFlag()` - Register CLI flags (shown in `--help`)
455
+ - `pi.registerMessageRenderer()` - Custom TUI rendering for message types
456
+ - `pi.on()` - Subscribe to lifecycle events (tool_call, session_start, etc.)
457
+ - `pi.sendMessage()` - Inject messages into the conversation
458
+ - `pi.appendEntry()` - Persist custom data in session (survives restart/branch)
459
+ - `pi.exec()` - Run shell commands
460
+ - `pi.getActiveTools()` / `pi.setActiveTools()` - Dynamic tool enable/disable
461
+ - `pi.getAllTools()` - List all available tools
462
+ - `pi.events` - Event bus for cross-extension communication
463
+ - `ctx.ui.confirm()` / `select()` / `input()` - User prompts
464
+ - `ctx.ui.notify()` - Toast notifications
465
+ - `ctx.ui.setStatus()` - Persistent status in footer (multiple extensions can set their own)
466
+ - `ctx.ui.setWidget()` - Widget display above editor
467
+ - `ctx.ui.setTitle()` - Set terminal window title
468
+ - `ctx.ui.custom()` - Full TUI component with keyboard handling
469
+ - `ctx.ui.editor()` - Multi-line text editor with external editor support
470
+ - `ctx.sessionManager` - Read session entries, get branch history
471
+
472
+ **Settings changes:**
473
+
474
+ ```json
475
+ // Before
476
+ {
477
+ "hooks": ["./my-hook.ts"],
478
+ "customTools": ["./my-tool.ts"]
479
+ }
480
+
481
+ // After
482
+ {
483
+ "extensions": ["./my-extension.ts"]
484
+ }
485
+ ```
486
+
487
+ **CLI changes:**
488
+
489
+ ```bash
490
+ # Before
491
+ pi --hook ./safety.ts --tool ./todo.ts
492
+
493
+ # After
494
+ pi --extension ./safety.ts -e ./todo.ts
495
+ ```
496
+
497
+ ### Prompt Templates Migration
498
+
499
+ "Slash commands" (markdown files defining reusable prompts invoked via `/name`) are renamed to "prompt templates" to avoid confusion with extension-registered commands.
500
+
501
+ **Automatic migration:** The `commands/` directory is automatically renamed to `prompts/` on startup (if `prompts/` doesn't exist). Works for both regular directories and symlinks.
502
+
503
+ **Directory changes:**
504
+
505
+ ```
506
+ ~/.pi/agent/commands/*.md → ~/.pi/agent/prompts/*.md
507
+ .pi/commands/*.md → .pi/prompts/*.md
508
+ ```
509
+
510
+ **SDK type renames:**
511
+
512
+ - `FileSlashCommand` → `PromptTemplate`
513
+ - `LoadSlashCommandsOptions` → `LoadPromptTemplatesOptions`
514
+
515
+ **SDK function renames:**
516
+
517
+ - `discoverSlashCommands()` → `discoverPromptTemplates()`
518
+ - `loadSlashCommands()` → `loadPromptTemplates()`
519
+ - `expandSlashCommand()` → `expandPromptTemplate()`
520
+ - `getCommandsDir()` → `getPromptsDir()`
521
+
522
+ **SDK option renames:**
523
+
524
+ - `CreateAgentSessionOptions.slashCommands` → `.promptTemplates`
525
+ - `AgentSession.fileCommands` → `.promptTemplates`
526
+ - `PromptOptions.expandSlashCommands` → `.expandPromptTemplates`
527
+
528
+ ### SDK Migration
529
+
530
+ **Discovery functions:**
531
+
532
+ - `discoverAndLoadHooks()` → `discoverAndLoadExtensions()`
533
+ - `discoverAndLoadCustomTools()` → merged into `discoverAndLoadExtensions()`
534
+ - `loadHooks()` → `loadExtensions()`
535
+ - `loadCustomTools()` → merged into `loadExtensions()`
536
+
537
+ **Runner and wrapper:**
538
+
539
+ - `HookRunner` → `ExtensionRunner`
540
+ - `wrapToolsWithHooks()` → `wrapToolsWithExtensions()`
541
+ - `wrapToolWithHooks()` → `wrapToolWithExtensions()`
542
+
543
+ **CreateAgentSessionOptions:**
544
+
545
+ - `.hooks` → removed (use `.additionalExtensionPaths` for paths)
546
+ - `.additionalHookPaths` → `.additionalExtensionPaths`
547
+ - `.preloadedHooks` → `.preloadedExtensions`
548
+ - `.customTools` type changed: `Array<{ path?; tool: CustomTool }>` → `ToolDefinition[]`
549
+ - `.additionalCustomToolPaths` → merged into `.additionalExtensionPaths`
550
+ - `.slashCommands` → `.promptTemplates`
551
+
552
+ **AgentSession:**
553
+
554
+ - `.hookRunner` → `.extensionRunner`
555
+ - `.fileCommands` → `.promptTemplates`
556
+ - `.sendHookMessage()` → `.sendCustomMessage()`
557
+
558
+ ### Session Migration
559
+
560
+ **Automatic.** Session version bumped from 2 to 3. Existing sessions are migrated on first load:
561
+
562
+ - Message role `"hookMessage"` → `"custom"`
563
+
564
+ ### Breaking Changes
565
+
566
+ - **Settings:** `hooks` and `customTools` arrays replaced with single `extensions` array
567
+ - **CLI:** `--hook` and `--tool` flags replaced with `--extension` / `-e`
568
+ - **Directories:** `hooks/`, `tools/` → `extensions/`; `commands/` → `prompts/`
569
+ - **Types:** See type renames above
570
+ - **SDK:** See SDK migration above
571
+
572
+ ### Changed
573
+
574
+ - Extensions can have their own `package.json` with dependencies (resolved via jiti)
575
+ - Documentation: `docs/hooks.md` and `docs/custom-tools.md` merged into `docs/extensions.md`
576
+ - Examples: `examples/hooks/` and `examples/custom-tools/` merged into `examples/extensions/`
577
+ - README: Extensions section expanded with custom tools, commands, events, state persistence, shortcuts, flags, and UI examples
578
+ - SDK: `customTools` option now accepts `ToolDefinition[]` directly (simplified from `Array<{ path?, tool }>`)
579
+ - SDK: `extensions` option accepts `ExtensionFactory[]` for inline extensions
580
+ - SDK: `additionalExtensionPaths` replaces both `additionalHookPaths` and `additionalCustomToolPaths`
581
+
582
+ ## [0.34.2] - 2026-01-04
583
+
584
+ ## [0.34.1] - 2026-01-04
585
+
586
+ ### Added
587
+
588
+ - Hook API: `ctx.ui.setTitle(title)` allows hooks to set the terminal window/tab title ([#446](https://github.com/badlogic/pi-mono/pull/446) by [@aliou](https://github.com/aliou))
589
+
590
+ ### Changed
591
+
592
+ - Expanded keybinding documentation to list all 32 supported symbol keys with notes on ctrl+symbol behavior ([#450](https://github.com/badlogic/pi-mono/pull/450) by [@kaofelix](https://github.com/kaofelix))
593
+
594
+ ## [0.34.0] - 2026-01-04
595
+
596
+ ### Added
597
+
598
+ - Hook API: `pi.getActiveTools()` and `pi.setActiveTools(toolNames)` for dynamically enabling/disabling tools from hooks
599
+ - Hook API: `pi.getAllTools()` to enumerate all configured tools (built-in via --tools or default, plus custom tools)
600
+ - Hook API: `pi.registerFlag(name, options)` and `pi.getFlag(name)` for hooks to register custom CLI flags (parsed automatically)
601
+ - Hook API: `pi.registerShortcut(shortcut, options)` for hooks to register custom keyboard shortcuts using `KeyId` (e.g., `Key.shift("p")`). Conflicts with built-in shortcuts are skipped, conflicts between hooks logged as warnings.
602
+ - Hook API: `ctx.ui.setWidget(key, content)` for status displays above the editor. Accepts either a string array or a component factory function.
603
+ - Hook API: `theme.strikethrough(text)` for strikethrough text styling
604
+ - Hook API: `before_agent_start` handlers can now return `systemPromptAppend` to dynamically append text to the system prompt for that turn. Multiple hooks' appends are concatenated.
605
+ - Hook API: `before_agent_start` handlers can now return multiple messages (all are injected, not just the first)
606
+ - `/hotkeys` command now shows hook-registered shortcuts in a separate "Hooks" section
607
+ - New example hook: `plan-mode.ts` - Claude Code-style read-only exploration mode:
608
+ - Toggle via `/plan` command, `Shift+P` shortcut, or `--plan` CLI flag
609
+ - Read-only tools: `read`, `bash`, `grep`, `find`, `ls` (no `edit`/`write`)
610
+ - Bash commands restricted to non-destructive operations (blocks `rm`, `mv`, `git commit`, `npm install`, etc.)
611
+ - Interactive prompt after each response: execute plan, stay in plan mode, or refine
612
+ - Todo list widget showing progress with checkboxes and strikethrough for completed items
613
+ - Each todo has a unique ID; agent marks items done by outputting `[DONE:id]`
614
+ - Progress updates via `agent_end` hook (parses completed items from final message)
615
+ - `/todos` command to view current plan progress
616
+ - Shows `⏸ plan` indicator in footer when in plan mode, `📋 2/5` when executing
617
+ - State persists across sessions (including todo progress)
618
+ - New example hook: `tools.ts` - Interactive `/tools` command to enable/disable tools with session persistence
619
+ - New example hook: `pirate.ts` - Demonstrates `systemPromptAppend` to make the agent speak like a pirate
620
+ - Tool registry now contains all built-in tools (read, bash, edit, write, grep, find, ls) even when `--tools` limits the initially active set. Hooks can enable any tool from the registry via `pi.setActiveTools()`.
621
+ - System prompt now automatically rebuilds when tools change via `setActiveTools()`, updating tool descriptions and guidelines to match the new tool set
622
+ - Hook errors now display full stack traces for easier debugging
623
+ - Event bus (`pi.events`) for tool/hook communication: shared pub/sub between custom tools and hooks
624
+ - Custom tools now have `pi.sendMessage()` to send messages directly to the agent session without needing the event bus
625
+ - `sendMessage()` supports `deliverAs: "nextTurn"` to queue messages for the next user prompt
626
+
627
+ ### Changed
628
+
629
+ - Removed image placeholders after copy & paste, replaced with inserting image file paths directly. ([#442](https://github.com/badlogic/pi-mono/pull/442) by [@mitsuhiko](https://github.com/mitsuhiko))
630
+
631
+ ### Fixed
632
+
633
+ - Fixed potential text decoding issues in bash executor by using streaming TextDecoder instead of Buffer.toString()
634
+ - External editor (Ctrl-G) now shows full pasted content instead of `[paste #N ...]` placeholders ([#444](https://github.com/badlogic/pi-mono/pull/444) by [@aliou](https://github.com/aliou))
635
+
636
+ ## [0.33.0] - 2026-01-04
637
+
638
+ ### Breaking Changes
639
+
640
+ - **Key detection functions removed from `@mariozechner/pi-tui`**: All `isXxx()` key detection functions (`isEnter()`, `isEscape()`, `isCtrlC()`, etc.) have been removed. Use `matchesKey(data, keyId)` instead (e.g., `matchesKey(data, "enter")`, `matchesKey(data, "ctrl+c")`). This affects hooks and custom tools that use `ctx.ui.custom()` with keyboard input handling. ([#405](https://github.com/badlogic/pi-mono/pull/405))
641
+
642
+ ### Added
643
+
644
+ - Clipboard image paste support via `Ctrl+V`. Images are saved to a temp file and attached to the message. Works on macOS, Windows, and Linux (X11). ([#419](https://github.com/badlogic/pi-mono/issues/419))
645
+ - Configurable keybindings via `~/.pi/agent/keybindings.json`. All keyboard shortcuts (editor navigation, deletion, app actions like model cycling, etc.) can now be customized. Supports multiple bindings per action. ([#405](https://github.com/badlogic/pi-mono/pull/405) by [@hjanuschka](https://github.com/hjanuschka))
646
+ - `/quit` and `/exit` slash commands to gracefully exit the application. Unlike double Ctrl+C, these properly await hook and custom tool cleanup handlers before exiting. ([#426](https://github.com/badlogic/pi-mono/pull/426) by [@ben-vargas](https://github.com/ben-vargas))
647
+
648
+ ### Fixed
649
+
650
+ - Subagent example README referenced incorrect filename `subagent.ts` instead of `index.ts` ([#427](https://github.com/badlogic/pi-mono/pull/427) by [@Whamp](https://github.com/Whamp))
651
+
652
+ ## [0.32.3] - 2026-01-03
653
+
654
+ ### Fixed
655
+
656
+ - `--list-models` no longer shows Google Vertex AI models without explicit authentication configured
657
+ - JPEG/GIF/WebP images not displaying in terminals using Kitty graphics protocol (Kitty, Ghostty, WezTerm). The protocol requires PNG format, so non-PNG images are now converted before display.
658
+ - Version check URL typo preventing update notifications from working ([#423](https://github.com/badlogic/pi-mono/pull/423) by [@skuridin](https://github.com/skuridin))
659
+ - Large images exceeding Anthropic's 5MB limit now retry with progressive quality/size reduction ([#424](https://github.com/badlogic/pi-mono/pull/424) by [@mitsuhiko](https://github.com/mitsuhiko))
660
+
661
+ ## [0.32.2] - 2026-01-03
662
+
663
+ ### Added
664
+
665
+ - `$ARGUMENTS` syntax for custom slash commands as alternative to `$@` for all arguments joined. Aligns with patterns used by Claude, Codex, and OpenCode. Both syntaxes remain fully supported. ([#418](https://github.com/badlogic/pi-mono/pull/418) by [@skuridin](https://github.com/skuridin))
666
+
667
+ ### Changed
668
+
669
+ - **Slash commands and hook commands now work during streaming**: Previously, using a slash command or hook command while the agent was streaming would crash with "Agent is already processing". Now:
670
+ - Hook commands execute immediately (they manage their own LLM interaction via `pi.sendMessage()`)
671
+ - File-based slash commands are expanded and queued via steer/followUp
672
+ - `steer()` and `followUp()` now expand file-based slash commands and error on hook commands (hook commands cannot be queued)
673
+ - `prompt()` accepts new `streamingBehavior` option (`"steer"` or `"followUp"`) to specify queueing behavior during streaming
674
+ - RPC `prompt` command now accepts optional `streamingBehavior` field
675
+ ([#420](https://github.com/badlogic/pi-mono/issues/420))
676
+
677
+ ### Fixed
678
+
679
+ - Slash command argument substitution now processes positional arguments (`$1`, `$2`, etc.) before all-arguments (`$@`, `$ARGUMENTS`) to prevent recursive substitution when argument values contain dollar-digit patterns like `$100`. ([#418](https://github.com/badlogic/pi-mono/pull/418) by [@skuridin](https://github.com/skuridin))
680
+
681
+ ## [0.32.1] - 2026-01-03
682
+
683
+ ### Added
684
+
685
+ - Shell commands without context contribution: use `!!command` to execute a bash command that is shown in the TUI and saved to session history but excluded from LLM context. Useful for running commands you don't want the AI to see. ([#414](https://github.com/badlogic/pi-mono/issues/414))
686
+
687
+ ### Fixed
688
+
689
+ - Edit tool diff not displaying in TUI due to race condition between async preview computation and tool execution
690
+
691
+ ## [0.32.0] - 2026-01-03
692
+
693
+ ### Breaking Changes
694
+
695
+ - **Queue API replaced with steer/followUp**: The `queueMessage()` method has been split into two methods with different delivery semantics ([#403](https://github.com/badlogic/pi-mono/issues/403)):
696
+ - `steer(text)`: Interrupts the agent mid-run (Enter while streaming). Delivered after current tool execution.
697
+ - `followUp(text)`: Waits until the agent finishes (Alt+Enter while streaming). Delivered only when agent stops.
698
+ - **Settings renamed**: `queueMode` setting renamed to `steeringMode`. Added new `followUpMode` setting. Old settings.json files are migrated automatically.
699
+ - **AgentSession methods renamed**:
700
+ - `queueMessage()` → `steer()` and `followUp()`
701
+ - `queueMode` getter → `steeringMode` and `followUpMode` getters
702
+ - `setQueueMode()` → `setSteeringMode()` and `setFollowUpMode()`
703
+ - `queuedMessageCount` → `pendingMessageCount`
704
+ - `getQueuedMessages()` → `getSteeringMessages()` and `getFollowUpMessages()`
705
+ - `clearQueue()` now returns `{ steering: string[], followUp: string[] }`
706
+ - `hasQueuedMessages()` → `hasPendingMessages()`
707
+ - **Hook API signature changed**: `pi.sendMessage()` second parameter changed from `triggerTurn?: boolean` to `options?: { triggerTurn?, deliverAs? }`. Use `deliverAs: "followUp"` for follow-up delivery. Affects both hooks and internal `sendHookMessage()` method.
708
+ - **RPC API changes**:
709
+ - `queue_message` command → `steer` and `follow_up` commands
710
+ - `set_queue_mode` command → `set_steering_mode` and `set_follow_up_mode` commands
711
+ - `RpcSessionState.queueMode` → `steeringMode` and `followUpMode`
712
+ - **Settings UI**: "Queue mode" setting split into "Steering mode" and "Follow-up mode"
713
+
714
+ ### Added
715
+
716
+ - Configurable double-escape action: choose whether double-escape with empty editor opens `/tree` (default) or `/branch`. Configure via `/settings` or `doubleEscapeAction` in settings.json ([#404](https://github.com/badlogic/pi-mono/issues/404))
717
+ - Vertex AI provider (`google-vertex`): access Gemini models via Google Cloud Vertex AI using Application Default Credentials ([#300](https://github.com/badlogic/pi-mono/pull/300) by [@default-anton](https://github.com/default-anton))
718
+ - Built-in provider overrides in `models.json`: override just `baseUrl` to route a built-in provider through a proxy while keeping all its models, or define `models` to fully replace the provider ([#406](https://github.com/badlogic/pi-mono/pull/406) by [@yevhen](https://github.com/yevhen))
719
+ - Automatic image resizing: images larger than 2000x2000 are resized for better model compatibility. Original dimensions are injected into the prompt. Controlled via `/settings` or `images.autoResize` in settings.json. ([#402](https://github.com/badlogic/pi-mono/pull/402) by [@mitsuhiko](https://github.com/mitsuhiko))
720
+ - Alt+Enter keybind to queue follow-up messages while agent is streaming
721
+ - `Theme` and `ThemeColor` types now exported for hooks using `ctx.ui.custom()`
722
+ - Terminal window title now displays "pi - dirname" to identify which project session you're in ([#407](https://github.com/badlogic/pi-mono/pull/407) by [@kaofelix](https://github.com/kaofelix))
723
+
724
+ ### Changed
725
+
726
+ - Editor component now uses word wrapping instead of character-level wrapping for better readability ([#382](https://github.com/badlogic/pi-mono/pull/382) by [@nickseelert](https://github.com/nickseelert))
727
+
728
+ ### Fixed
729
+
730
+ - `/model` selector now opens instantly instead of waiting for OAuth token refresh. Token refresh is deferred until a model is actually used.
731
+ - Shift+Space, Shift+Backspace, and Shift+Delete now work correctly in Kitty-protocol terminals (Kitty, WezTerm, etc.) instead of being silently ignored ([#411](https://github.com/badlogic/pi-mono/pull/411) by [@nathyong](https://github.com/nathyong))
732
+ - `AgentSession.prompt()` now throws if called while the agent is already streaming, preventing race conditions. Use `steer()` or `followUp()` to queue messages during streaming.
733
+ - Ctrl+C now works like Escape in selector components, so mashing Ctrl+C will eventually close the program ([#400](https://github.com/badlogic/pi-mono/pull/400) by [@mitsuhiko](https://github.com/mitsuhiko))
734
+
735
+ ## [0.31.1] - 2026-01-02
736
+
737
+ ### Fixed
738
+
739
+ - Model selector no longer allows negative index when pressing arrow keys before models finish loading ([#398](https://github.com/badlogic/pi-mono/pull/398) by [@mitsuhiko](https://github.com/mitsuhiko))
740
+ - Type guard functions (`isBashToolResult`, etc.) now exported at runtime, not just in type declarations ([#397](https://github.com/badlogic/pi-mono/issues/397))
741
+
742
+ ## [0.31.0] - 2026-01-02
743
+
744
+ This release introduces session trees for in-place branching, major API changes to hooks and custom tools, and structured compaction with file tracking.
745
+
746
+ ### Session Tree
747
+
748
+ Sessions now use a tree structure with `id`/`parentId` fields. This enables in-place branching: navigate to any previous point with `/tree`, continue from there, and switch between branches while preserving all history in a single file.
749
+
750
+ **Existing sessions are automatically migrated** (v1 → v2) on first load. No manual action required.
751
+
752
+ New entry types: `BranchSummaryEntry` (context from abandoned branches), `CustomEntry` (hook state), `CustomMessageEntry` (hook-injected messages), `LabelEntry` (bookmarks).
753
+
754
+ See [docs/session.md](docs/session.md) for the file format and `SessionManager` API.
755
+
756
+ ### Hooks Migration
757
+
758
+ The hooks API has been restructured with more granular events and better session access.
759
+
760
+ **Type renames:**
761
+
762
+ - `HookEventContext` → `HookContext`
763
+ - `HookCommandContext` is now a new interface extending `HookContext` with session control methods
764
+
765
+ **Event changes:**
766
+
767
+ - The monolithic `session` event is now split into granular events: `session_start`, `session_before_switch`, `session_switch`, `session_before_branch`, `session_branch`, `session_before_compact`, `session_compact`, `session_shutdown`
768
+ - `session_before_switch` and `session_switch` events now include `reason: "new" | "resume"` to distinguish between `/new` and `/resume`
769
+ - New `session_before_tree` and `session_tree` events for `/tree` navigation (hook can provide custom branch summary)
770
+ - New `before_agent_start` event: inject messages before the agent loop starts
771
+ - New `context` event: modify messages non-destructively before each LLM call
772
+ - Session entries are no longer passed in events. Use `ctx.sessionManager.getEntries()` or `ctx.sessionManager.getBranch()` instead
773
+
774
+ **API changes:**
775
+
776
+ - `pi.send(text, attachments?)` → `pi.sendMessage(message, triggerTurn?)` (creates `CustomMessageEntry`)
777
+ - New `pi.appendEntry(customType, data?)` for hook state persistence (not in LLM context)
778
+ - New `pi.registerCommand(name, options)` for custom slash commands (handler receives `HookCommandContext`)
779
+ - New `pi.registerMessageRenderer(customType, renderer)` for custom TUI rendering
780
+ - New `ctx.isIdle()`, `ctx.abort()`, `ctx.hasQueuedMessages()` for agent state (available in all events)
781
+ - New `ctx.ui.editor(title, prefill?)` for multi-line text editing with Ctrl+G external editor support
782
+ - New `ctx.ui.custom(component)` for full TUI component rendering with keyboard focus
783
+ - New `ctx.ui.setStatus(key, text)` for persistent status text in footer (multiple hooks can set their own)
784
+ - New `ctx.ui.theme` getter for styling text with theme colors
785
+ - `ctx.exec()` moved to `pi.exec()`
786
+ - `ctx.sessionFile` → `ctx.sessionManager.getSessionFile()`
787
+ - New `ctx.modelRegistry` and `ctx.model` for API key resolution
788
+
789
+ **HookCommandContext (slash commands only):**
790
+
791
+ - `ctx.waitForIdle()` - wait for agent to finish streaming
792
+ - `ctx.newSession(options?)` - create new sessions with optional setup callback
793
+ - `ctx.branch(entryId)` - branch from a specific entry
794
+ - `ctx.navigateTree(targetId, options?)` - navigate the session tree
795
+
796
+ These methods are only on `HookCommandContext` (not `HookContext`) because they can deadlock if called from event handlers that run inside the agent loop.
797
+
798
+ **Removed:**
799
+
800
+ - `hookTimeout` setting (hooks no longer have timeouts; use Ctrl+C to abort)
801
+ - `resolveApiKey` parameter (use `ctx.modelRegistry.getApiKey(model)`)
802
+
803
+ See [docs/hooks.md](docs/hooks.md) and [examples/hooks/](examples/hooks/) for the current API.
804
+
805
+ ### Custom Tools Migration
806
+
807
+ The custom tools API has been restructured to mirror the hooks pattern with a context object.
808
+
809
+ **Type renames:**
810
+
811
+ - `CustomAgentTool` → `CustomTool`
812
+ - `ToolAPI` → `CustomToolAPI`
813
+ - `ToolContext` → `CustomToolContext`
814
+ - `ToolSessionEvent` → `CustomToolSessionEvent`
815
+
816
+ **Execute signature changed:**
817
+
818
+ ```typescript
819
+ // Before (v0.30.2)
820
+ execute(toolCallId, params, signal, onUpdate)
821
+
822
+ // After
823
+ execute(toolCallId, params, onUpdate, ctx, signal?)
824
+ ```
825
+
826
+ The new `ctx: CustomToolContext` provides `sessionManager`, `modelRegistry`, `model`, and agent state methods:
827
+
828
+ - `ctx.isIdle()` - check if agent is streaming
829
+ - `ctx.hasQueuedMessages()` - check if user has queued messages (skip interactive prompts)
830
+ - `ctx.abort()` - abort current operation (fire-and-forget)
831
+
832
+ **Session event changes:**
833
+
834
+ - `CustomToolSessionEvent` now only has `reason` and `previousSessionFile`
835
+ - Session entries are no longer in the event. Use `ctx.sessionManager.getBranch()` or `ctx.sessionManager.getEntries()` to reconstruct state
836
+ - Reasons: `"start" | "switch" | "branch" | "tree" | "shutdown"` (no separate `"new"` reason; `/new` triggers `"switch"`)
837
+ - `dispose()` method removed. Use `onSession` with `reason: "shutdown"` for cleanup
838
+
839
+ See [docs/custom-tools.md](docs/custom-tools.md) and [examples/custom-tools/](examples/custom-tools/) for the current API.
840
+
841
+ ### SDK Migration
842
+
843
+ **Type changes:**
844
+
845
+ - `CustomAgentTool` → `CustomTool`
846
+ - `AppMessage` → `AgentMessage`
847
+ - `sessionFile` returns `string | undefined` (was `string | null`)
848
+ - `model` returns `Model | undefined` (was `Model | null`)
849
+ - `Attachment` type removed. Use `ImageContent` from `@mariozechner/pi-ai` instead. Add images directly to message content arrays.
850
+
851
+ **AgentSession API:**
852
+
853
+ - `branch(entryIndex: number)` → `branch(entryId: string)`
854
+ - `getUserMessagesForBranching()` returns `{ entryId, text }` instead of `{ entryIndex, text }`
855
+ - `reset()` → `newSession(options?)` where options has optional `parentSession` for lineage tracking
856
+ - `newSession()` and `switchSession()` now return `Promise<boolean>` (false if cancelled by hook)
857
+ - New `navigateTree(targetId, options?)` for in-place tree navigation
858
+
859
+ **Hook integration:**
860
+
861
+ - New `sendHookMessage(message, triggerTurn?)` for hook message injection
862
+
863
+ **SessionManager API:**
864
+
865
+ - Method renames: `saveXXX()` → `appendXXX()` (e.g., `appendMessage`, `appendCompaction`)
866
+ - `branchInPlace()` → `branch()`
867
+ - `reset()` → `newSession(options?)` with optional `parentSession` for lineage tracking
868
+ - `createBranchedSessionFromEntries(entries, index)` → `createBranchedSession(leafId)`
869
+ - `SessionHeader.branchedFrom` → `SessionHeader.parentSession`
870
+ - `saveCompaction(entry)` → `appendCompaction(summary, firstKeptEntryId, tokensBefore, details?)`
871
+ - `getEntries()` now excludes the session header (use `getHeader()` separately)
872
+ - `getSessionFile()` returns `string | undefined` (undefined for in-memory sessions)
873
+ - New tree methods: `getTree()`, `getBranch()`, `getLeafId()`, `getLeafEntry()`, `getEntry()`, `getChildren()`, `getLabel()`
874
+ - New append methods: `appendCustomEntry()`, `appendCustomMessageEntry()`, `appendLabelChange()`
875
+ - New branch methods: `branch(entryId)`, `branchWithSummary()`
876
+
877
+ **ModelRegistry (new):**
878
+
879
+ `ModelRegistry` is a new class that manages model discovery and API key resolution. It combines built-in models with custom models from `models.json` and resolves API keys via `AuthStorage`.
880
+
881
+ ```typescript
882
+ import {
883
+ discoverAuthStorage,
884
+ discoverModels,
885
+ } from "@mariozechner/pi-coding-agent";
886
+
887
+ const authStorage = discoverAuthStorage(); // ~/.pi/agent/auth.json
888
+ const modelRegistry = discoverModels(authStorage); // + ~/.pi/agent/models.json
889
+
890
+ // Get all models (built-in + custom)
891
+ const allModels = modelRegistry.getAll();
892
+
893
+ // Get only models with valid API keys
894
+ const available = await modelRegistry.getAvailable();
895
+
896
+ // Find specific model
897
+ const model = modelRegistry.find("anthropic", "claude-sonnet-4-20250514");
898
+
899
+ // Get API key for a model
900
+ const apiKey = await modelRegistry.getApiKey(model);
901
+ ```
902
+
903
+ This replaces the old `resolveApiKey` callback pattern. Hooks and custom tools access it via `ctx.modelRegistry`.
904
+
905
+ **Renamed exports:**
906
+
907
+ - `messageTransformer` → `convertToLlm`
908
+ - `SessionContext` alias `LoadedSession` removed
909
+
910
+ See [docs/sdk.md](docs/sdk.md) and [examples/sdk/](examples/sdk/) for the current API.
911
+
912
+ ### RPC Migration
913
+
914
+ **Session commands:**
915
+
916
+ - `reset` command → `new_session` command with optional `parentSession` field
917
+
918
+ **Branching commands:**
919
+
920
+ - `branch` command: `entryIndex` → `entryId`
921
+ - `get_branch_messages` response: `entryIndex` → `entryId`
922
+
923
+ **Type changes:**
924
+
925
+ - Messages are now `AgentMessage` (was `AppMessage`)
926
+ - `prompt` command: `attachments` field replaced with `images` field using `ImageContent` format
927
+
928
+ **Compaction events:**
929
+
930
+ - `auto_compaction_start` now includes `reason` field (`"threshold"` or `"overflow"`)
931
+ - `auto_compaction_end` now includes `willRetry` field
932
+ - `compact` response includes full `CompactionResult` (`summary`, `firstKeptEntryId`, `tokensBefore`, `details`)
933
+
934
+ See [docs/rpc.md](docs/rpc.md) for the current protocol.
935
+
936
+ ### Structured Compaction
937
+
938
+ Compaction and branch summarization now use a structured output format:
939
+
940
+ - Clear sections: Goal, Progress, Key Information, File Operations
941
+ - File tracking: `readFiles` and `modifiedFiles` arrays in `details`, accumulated across compactions
942
+ - Conversations are serialized to text before summarization to prevent the model from "continuing" them
943
+
944
+ The `before_compact` and `before_tree` hook events allow custom compaction implementations. See [docs/compaction.md](docs/compaction.md).
945
+
946
+ ### Interactive Mode
947
+
948
+ **`/tree` command:**
949
+
950
+ - Navigate the full session tree in-place
951
+ - Search by typing, page with ←/→
952
+ - Filter modes (Ctrl+O): default → no-tools → user-only → labeled-only → all
953
+ - Press `l` to label entries as bookmarks
954
+ - Selecting a branch switches context and optionally injects a summary of the abandoned branch
955
+
956
+ **Entry labels:**
957
+
958
+ - Bookmark any entry via `/tree` → select → `l`
959
+ - Labels appear in tree view and persist as `LabelEntry`
960
+
961
+ **Theme changes (breaking for custom themes):**
962
+
963
+ Custom themes must add these new color tokens or they will fail to load:
964
+
965
+ - `selectedBg`: background for selected/highlighted items in tree selector and other components
966
+ - `customMessageBg`: background for hook-injected messages (`CustomMessageEntry`)
967
+ - `customMessageText`: text color for hook messages
968
+ - `customMessageLabel`: label color for hook messages (the `[customType]` prefix)
969
+
970
+ Total color count increased from 46 to 50. See [docs/theme.md](docs/theme.md) for the full color list and copy values from the built-in dark/light themes.
971
+
972
+ **Settings:**
973
+
974
+ - `enabledModels`: allowlist models in `settings.json` (same format as `--models` CLI)
975
+
976
+ ### Added
977
+
978
+ - `ctx.ui.setStatus(key, text)` for hooks to display persistent status text in the footer ([#385](https://github.com/badlogic/pi-mono/pull/385) by [@prateekmedia](https://github.com/prateekmedia))
979
+ - `ctx.ui.theme` getter for styling status text and other output with theme colors
980
+ - `/share` command to upload session as a secret GitHub gist and get a shareable URL via shittycodingagent.ai ([#380](https://github.com/badlogic/pi-mono/issues/380))
981
+ - HTML export now includes a tree visualization sidebar for navigating session branches ([#375](https://github.com/badlogic/pi-mono/issues/375))
982
+ - HTML export supports keyboard shortcuts: Ctrl+T to toggle thinking blocks, Ctrl+O to toggle tool outputs
983
+ - HTML export supports theme-configurable background colors via optional `export` section in theme JSON ([#387](https://github.com/badlogic/pi-mono/pull/387) by [@mitsuhiko](https://github.com/mitsuhiko))
984
+ - HTML export syntax highlighting now uses theme colors and matches TUI rendering
985
+ - **Snake game example hook**: Demonstrates `ui.custom()`, `registerCommand()`, and session persistence. See [examples/hooks/snake.ts](examples/hooks/snake.ts).
986
+ - **`thinkingText` theme token**: Configurable color for thinking block text. ([#366](https://github.com/badlogic/pi-mono/pull/366) by [@paulbettner](https://github.com/paulbettner))
987
+
988
+ ### Changed
989
+
990
+ - **Entry IDs**: Session entries now use short 8-character hex IDs instead of full UUIDs
991
+ - **API key priority**: `ANTHROPIC_OAUTH_TOKEN` now takes precedence over `ANTHROPIC_API_KEY`
992
+ - HTML export template split into separate files (template.html, template.css, template.js) for easier maintenance
993
+
994
+ ### Fixed
995
+
996
+ - HTML export now properly sanitizes user messages containing HTML tags like `<style>` that could break DOM rendering
997
+ - Crash when displaying bash output containing Unicode format characters like U+0600-U+0604 ([#372](https://github.com/badlogic/pi-mono/pull/372) by [@HACKE-RC](https://github.com/HACKE-RC))
998
+ - **Footer shows full session stats**: Token usage and cost now include all messages, not just those after compaction. ([#322](https://github.com/badlogic/pi-mono/issues/322))
999
+ - **Status messages spam chat log**: Rapidly changing settings (e.g., thinking level via Shift+Tab) would add multiple status lines. Sequential status updates now coalesce into a single line. ([#365](https://github.com/badlogic/pi-mono/pull/365) by [@paulbettner](https://github.com/paulbettner))
1000
+ - **Toggling thinking blocks during streaming shows nothing**: Pressing Ctrl+T while streaming would hide the current message until streaming completed.
1001
+ - **Resuming session resets thinking level to off**: Initial model and thinking level were not saved to session file, causing `--resume`/`--continue` to default to `off`. ([#342](https://github.com/badlogic/pi-mono/issues/342) by [@aliou](https://github.com/aliou))
1002
+ - **Hook `tool_result` event ignores errors from custom tools**: The `tool_result` hook event was never emitted when tools threw errors, and always had `isError: false` for successful executions. Now emits the event with correct `isError` value in both success and error cases. ([#374](https://github.com/badlogic/pi-mono/issues/374) by [@nicobailon](https://github.com/nicobailon))
1003
+ - **Edit tool fails on Windows due to CRLF line endings**: Files with CRLF line endings now match correctly when LLMs send LF-only text. Line endings are normalized before matching and restored to original style on write. ([#355](https://github.com/badlogic/pi-mono/issues/355) by [@Pratham-Dubey](https://github.com/Pratham-Dubey))
1004
+ - **Edit tool fails on files with UTF-8 BOM**: Files with UTF-8 BOM marker could cause "text not found" errors since the LLM doesn't include the invisible BOM character. BOM is now stripped before matching and restored on write. ([#394](https://github.com/badlogic/pi-mono/pull/394) by [@prathamdby](https://github.com/prathamdby))
1005
+ - **Use bash instead of sh on Unix**: Fixed shell commands using `/bin/sh` instead of `/bin/bash` on Unix systems. ([#328](https://github.com/badlogic/pi-mono/pull/328) by [@dnouri](https://github.com/dnouri))
1006
+ - **OAuth login URL clickable**: Made OAuth login URLs clickable in terminal. ([#349](https://github.com/badlogic/pi-mono/pull/349) by [@Cursivez](https://github.com/Cursivez))
1007
+ - **Improved error messages**: Better error messages when `apiKey` or `model` are missing. ([#346](https://github.com/badlogic/pi-mono/pull/346) by [@ronyrus](https://github.com/ronyrus))
1008
+ - **Session file validation**: `findMostRecentSession()` now validates session headers before returning, preventing non-session JSONL files from being loaded
1009
+ - **Compaction error handling**: `generateSummary()` and `generateTurnPrefixSummary()` now throw on LLM errors instead of returning empty strings
1010
+ - **Compaction with branched sessions**: Fixed compaction incorrectly including entries from abandoned branches, causing token overflow errors. Compaction now uses `sessionManager.getPath()` to work only on the current branch path, eliminating 80+ lines of duplicate entry collection logic between `prepareCompaction()` and `compact()`
1011
+ - **enabledModels glob patterns**: `--models` and `enabledModels` now support glob patterns like `github-copilot/*` or `*sonnet*`. Previously, patterns were only matched literally or via substring search. ([#337](https://github.com/badlogic/pi-mono/issues/337))
1012
+
1013
+ ## [0.30.2] - 2025-12-26
1014
+
1015
+ ### Changed
1016
+
1017
+ - **Consolidated migrations**: Moved auth migration from `AuthStorage.migrateLegacy()` to new `migrations.ts` module.
1018
+
1019
+ ## [0.30.1] - 2025-12-26
1020
+
1021
+ ### Fixed
1022
+
1023
+ - **Sessions saved to wrong directory**: In v0.30.0, sessions were being saved to `~/.pi/agent/` instead of `~/.pi/agent/sessions/<encoded-cwd>/`, breaking `--resume` and `/resume`. Misplaced sessions are automatically migrated on startup. ([#320](https://github.com/badlogic/pi-mono/issues/320) by [@aliou](https://github.com/aliou))
1024
+ - **Custom system prompts missing context**: When using a custom system prompt string, project context files (AGENTS.md), skills, date/time, and working directory were not appended. ([#321](https://github.com/badlogic/pi-mono/issues/321))
1025
+
1026
+ ## [0.30.0] - 2025-12-25
1027
+
1028
+ ### Breaking Changes
1029
+
1030
+ - **SessionManager API**: The second parameter of `create()`, `continueRecent()`, and `list()` changed from `agentDir` to `sessionDir`. When provided, it specifies the session directory directly (no cwd encoding). When omitted, uses default (`~/.pi/agent/sessions/<encoded-cwd>/`). `open()` no longer takes `agentDir`. ([#313](https://github.com/badlogic/pi-mono/pull/313))
1031
+
1032
+ ### Added
1033
+
1034
+ - **`--session-dir` flag**: Use a custom directory for sessions instead of the default `~/.pi/agent/sessions/<encoded-cwd>/`. Works with `-c` (continue) and `-r` (resume) flags. ([#313](https://github.com/badlogic/pi-mono/pull/313) by [@scutifer](https://github.com/scutifer))
1035
+ - **Reverse model cycling and model selector**: Shift+Ctrl+P cycles models backward, Ctrl+L opens model selector (retaining text in editor). ([#315](https://github.com/badlogic/pi-mono/pull/315) by [@mitsuhiko](https://github.com/mitsuhiko))
1036
+
1037
+ ## [0.29.1] - 2025-12-25
1038
+
1039
+ ### Added
1040
+
1041
+ - **Automatic custom system prompt loading**: Pi now auto-loads `SYSTEM.md` files to replace the default system prompt. Project-local `.pi/SYSTEM.md` takes precedence over global `~/.pi/agent/SYSTEM.md`. CLI `--system-prompt` flag overrides both. ([#309](https://github.com/badlogic/pi-mono/issues/309))
1042
+ - **Unified `/settings` command**: New settings menu consolidating thinking level, theme, queue mode, auto-compact, show images, hide thinking, and collapse changelog. Replaces individual `/thinking`, `/queue`, `/theme`, `/autocompact`, and `/show-images` commands. ([#310](https://github.com/badlogic/pi-mono/issues/310))
1043
+
1044
+ ### Fixed
1045
+
1046
+ - **Custom tools/hooks with typebox subpath imports**: Fixed jiti alias for `@sinclair/typebox` to point to package root instead of entry file, allowing imports like `@sinclair/typebox/compiler` to resolve correctly. ([#311](https://github.com/badlogic/pi-mono/issues/311) by [@kim0](https://github.com/kim0))
1047
+
1048
+ ## [0.29.0] - 2025-12-25
1049
+
1050
+ ### Breaking Changes
1051
+
1052
+ - **Renamed `/clear` to `/new`**: The command to start a fresh session is now `/new`. Hook event reasons `before_clear`/`clear` are now `before_new`/`new`. Merry Christmas [@mitsuhiko](https://github.com/mitsuhiko)! ([#305](https://github.com/badlogic/pi-mono/pull/305))
1053
+
1054
+ ### Added
1055
+
1056
+ - **Auto-space before pasted file paths**: When pasting a file path (starting with `/`, `~`, or `.`) after a word character, a space is automatically prepended. ([#307](https://github.com/badlogic/pi-mono/pull/307) by [@mitsuhiko](https://github.com/mitsuhiko))
1057
+ - **Word navigation in input fields**: Added Ctrl+Left/Right and Alt+Left/Right for word-by-word cursor movement. ([#306](https://github.com/badlogic/pi-mono/pull/306) by [@kim0](https://github.com/kim0))
1058
+ - **Full Unicode input**: Input fields now accept Unicode characters beyond ASCII. ([#306](https://github.com/badlogic/pi-mono/pull/306) by [@kim0](https://github.com/kim0))
1059
+
1060
+ ### Fixed
1061
+
1062
+ - **Readline-style Ctrl+W**: Now skips trailing whitespace before deleting the preceding word, matching standard readline behavior. ([#306](https://github.com/badlogic/pi-mono/pull/306) by [@kim0](https://github.com/kim0))
1063
+
1064
+ ## [0.28.0] - 2025-12-25
1065
+
1066
+ ### Changed
1067
+
1068
+ - **Credential storage refactored**: API keys and OAuth tokens are now stored in `~/.pi/agent/auth.json` instead of `oauth.json` and `settings.json`. Existing credentials are automatically migrated on first run. ([#296](https://github.com/badlogic/pi-mono/issues/296))
1069
+
1070
+ - **SDK API changes** ([#296](https://github.com/badlogic/pi-mono/issues/296)):
1071
+
1072
+ - Added `AuthStorage` class for credential management (API keys and OAuth tokens)
1073
+ - Added `ModelRegistry` class for model discovery and API key resolution
1074
+ - Added `discoverAuthStorage()` and `discoverModels()` discovery functions
1075
+ - `createAgentSession()` now accepts `authStorage` and `modelRegistry` options
1076
+ - Removed `configureOAuthStorage()`, `defaultGetApiKey()`, `findModel()`, `discoverAvailableModels()`
1077
+ - Removed `getApiKey` callback option (use `AuthStorage.setRuntimeApiKey()` for runtime overrides)
1078
+ - Use `getModel()` from `@mariozechner/pi-ai` for built-in models, `modelRegistry.find()` for custom models + built-in models
1079
+ - See updated [SDK documentation](docs/sdk.md) and [README](README.md)
1080
+
1081
+ - **Settings changes**: Removed `apiKeys` from `settings.json`. Use `auth.json` instead. ([#296](https://github.com/badlogic/pi-mono/issues/296))
1082
+
1083
+ ### Fixed
1084
+
1085
+ - **Duplicate skill warnings for symlinks**: Skills loaded via symlinks pointing to the same file are now silently deduplicated instead of showing name collision warnings. ([#304](https://github.com/badlogic/pi-mono/pull/304) by [@mitsuhiko](https://github.com/mitsuhiko))
1086
+
1087
+ ## [0.27.9] - 2025-12-24
1088
+
1089
+ ### Fixed
1090
+
1091
+ - **Model selector and --list-models with settings.json API keys**: Models with API keys configured in settings.json (but not in environment variables) now properly appear in the /model selector and `--list-models` output. ([#295](https://github.com/badlogic/pi-mono/issues/295))
1092
+
1093
+ ## [0.27.8] - 2025-12-24
1094
+
1095
+ ### Fixed
1096
+
1097
+ - **API key priority**: OAuth tokens now take priority over settings.json API keys. Previously, an API key in settings.json would trump OAuth, causing users logged in with a plan (unlimited tokens) to be billed via PAYG instead.
1098
+
1099
+ ## [0.27.7] - 2025-12-24
1100
+
1101
+ ### Fixed
1102
+
1103
+ - **Thinking tag leakage**: Fixed Claude mimicking literal `</thinking>` tags in responses. Unsigned thinking blocks (from aborted streams) are now converted to plain text without `<thinking>` tags. The TUI still displays them as thinking blocks. ([#302](https://github.com/badlogic/pi-mono/pull/302) by [@nicobailon](https://github.com/nicobailon))
1104
+
1105
+ ## [0.27.6] - 2025-12-24
1106
+
1107
+ ### Added
1108
+
1109
+ - **Compaction hook improvements**: The `before_compact` session event now includes:
1110
+
1111
+ - `previousSummary`: Summary from the last compaction (if any), so hooks can preserve accumulated context
1112
+ - `messagesToKeep`: Messages that will be kept after the summary (recent turns), in addition to `messagesToSummarize`
1113
+ - `resolveApiKey`: Function to resolve API keys for any model (checks settings, OAuth, env vars)
1114
+ - Removed `apiKey` string in favor of `resolveApiKey` for more flexibility
1115
+
1116
+ - **SessionManager API cleanup**:
1117
+ - Renamed `loadSessionFromEntries()` to `buildSessionContext()` (builds LLM context from entries, handling compaction)
1118
+ - Renamed `loadEntries()` to `getEntries()` (returns defensive copy of all session entries)
1119
+ - Added `buildSessionContext()` method to SessionManager
1120
+
1121
+ ## [0.27.5] - 2025-12-24
1122
+
1123
+ ### Added
1124
+
1125
+ - **HTML export syntax highlighting**: Code blocks in markdown and tool outputs (read, write) now have syntax highlighting using highlight.js with theme-aware colors matching the TUI.
1126
+ - **HTML export improvements**: Render markdown server-side using marked (tables, headings, code blocks, etc.), honor user's chosen theme (light/dark), add image rendering for user messages, and style code blocks with TUI-like language markers. ([@scutifer](https://github.com/scutifer))
1127
+
1128
+ ### Fixed
1129
+
1130
+ - **Ghostty inline images in tmux**: Fixed terminal detection for Ghostty when running inside tmux by checking `GHOSTTY_RESOURCES_DIR` env var. ([#299](https://github.com/badlogic/pi-mono/pull/299) by [@nicobailon](https://github.com/nicobailon))
1131
+
1132
+ ## [0.27.4] - 2025-12-24
1133
+
1134
+ ### Fixed
1135
+
1136
+ - **Symlinked skill directories**: Skills in symlinked directories (e.g., `~/.pi/agent/skills/my-skills -> /path/to/skills`) are now correctly discovered and loaded.
1137
+
1138
+ ## [0.27.3] - 2025-12-24
1139
+
1140
+ ### Added
1141
+
1142
+ - **API keys in settings.json**: Store API keys in `~/.pi/agent/settings.json` under the `apiKeys` field (e.g., `{ "apiKeys": { "anthropic": "sk-..." } }`). Settings keys take priority over environment variables. ([#295](https://github.com/badlogic/pi-mono/issues/295))
1143
+
1144
+ ### Fixed
1145
+
1146
+ - **Allow startup without API keys**: Interactive mode no longer throws when no API keys are configured. Users can now start the agent and use `/login` to authenticate. ([#288](https://github.com/badlogic/pi-mono/issues/288))
1147
+ - **`--system-prompt` file path support**: The `--system-prompt` argument now correctly resolves file paths (like `--append-system-prompt` already did). ([#287](https://github.com/badlogic/pi-mono/pull/287) by [@scutifer](https://github.com/scutifer))
1148
+
1149
+ ## [0.27.2] - 2025-12-23
1150
+
1151
+ ### Added
1152
+
1153
+ - **Skip conversation restore on branch**: Hooks can return `{ skipConversationRestore: true }` from `before_branch` to create the branched session file without restoring conversation messages. Useful for checkpoint hooks that restore files separately. ([#286](https://github.com/badlogic/pi-mono/pull/286) by [@nicobarray](https://github.com/nicobarray))
1154
+
1155
+ ## [0.27.1] - 2025-12-22
1156
+
1157
+ ### Fixed
1158
+
1159
+ - **Skill discovery performance**: Skip `node_modules` directories when recursively scanning for skills. Fixes ~60ms startup delay when skill directories contain npm dependencies.
1160
+
1161
+ ### Added
1162
+
1163
+ - **Startup timing instrumentation**: Set `PI_TIMING=1` to see startup performance breakdown (interactive mode only).
1164
+
1165
+ ## [0.27.0] - 2025-12-22
1166
+
1167
+ ### Breaking
1168
+
1169
+ - **Session hooks API redesign**: Merged `branch` event into `session` event. `BranchEvent`, `BranchEventResult` types and `pi.on("branch", ...)` removed. Use `pi.on("session", ...)` with `reason: "before_branch" | "branch"` instead. `AgentSession.branch()` returns `{ cancelled }` instead of `{ skipped }`. `AgentSession.reset()` and `switchSession()` now return `boolean` (false if cancelled by hook). RPC commands `reset`, `switch_session`, and `branch` now include `cancelled` in response data. ([#278](https://github.com/badlogic/pi-mono/issues/278))
1170
+
1171
+ ### Added
1172
+
1173
+ - **Session lifecycle hooks**: Added `before_*` variants (`before_switch`, `before_clear`, `before_branch`) that fire before actions and can be cancelled with `{ cancel: true }`. Added `shutdown` reason for graceful exit handling. ([#278](https://github.com/badlogic/pi-mono/issues/278))
1174
+
1175
+ ### Fixed
1176
+
1177
+ - **File tab completion display**: File paths no longer get cut off early. Folders now show trailing `/` and removed redundant "directory"/"file" labels to maximize horizontal space. ([#280](https://github.com/badlogic/pi-mono/issues/280))
1178
+
1179
+ - **Bash tool visual line truncation**: Fixed bash tool output in collapsed mode to use visual line counting (accounting for line wrapping) instead of logical line counting. Now consistent with bash-execution.ts behavior. Extracted shared `truncateToVisualLines` utility. ([#275](https://github.com/badlogic/pi-mono/issues/275))
1180
+
1181
+ ## [0.26.1] - 2025-12-22
1182
+
1183
+ ### Fixed
1184
+
1185
+ - **SDK tools respect cwd**: Core tools (bash, read, edit, write, grep, find, ls) now properly use the `cwd` option from `createAgentSession()`. Added tool factory functions (`createBashTool`, `createReadTool`, etc.) for SDK users who specify custom `cwd` with explicit tools. ([#279](https://github.com/badlogic/pi-mono/issues/279))
1186
+
1187
+ ## [0.26.0] - 2025-12-22
1188
+
1189
+ ### Added
1190
+
1191
+ - **SDK for programmatic usage**: New `createAgentSession()` factory with full control over model, tools, hooks, skills, session persistence, and settings. Philosophy: "omit to discover, provide to override". Includes 12 examples and comprehensive documentation. ([#272](https://github.com/badlogic/pi-mono/issues/272))
1192
+
1193
+ - **Project-specific settings**: Settings now load from both `~/.pi/agent/settings.json` (global) and `<cwd>/.pi/settings.json` (project). Project settings override global with deep merge for nested objects. Project settings are read-only (for version control). ([#276](https://github.com/badlogic/pi-mono/pull/276))
1194
+
1195
+ - **SettingsManager static factories**: `SettingsManager.create(cwd?, agentDir?)` for file-based settings, `SettingsManager.inMemory(settings?)` for testing. Added `applyOverrides()` for programmatic overrides.
1196
+
1197
+ - **SessionManager static factories**: `SessionManager.create()`, `SessionManager.open()`, `SessionManager.continueRecent()`, `SessionManager.inMemory()`, `SessionManager.list()` for flexible session management.
1198
+
1199
+ ## [0.25.4] - 2025-12-22
1200
+
1201
+ ### Fixed
1202
+
1203
+ - **Syntax highlighting stderr spam**: Fixed cli-highlight logging errors to stderr when markdown contains malformed code fences (e.g., missing newlines around closing backticks). Now validates language identifiers before highlighting and falls back silently to plain text. ([#274](https://github.com/badlogic/pi-mono/issues/274))
1204
+
1205
+ ## [0.25.3] - 2025-12-21
1206
+
1207
+ ### Added
1208
+
1209
+ - **Gemini 3 preview models**: Added `gemini-3-pro-preview` and `gemini-3-flash-preview` to the google-gemini-cli provider. ([#264](https://github.com/badlogic/pi-mono/pull/264) by [@LukeFost](https://github.com/LukeFost))
1210
+
1211
+ - **External editor support**: Press `Ctrl+G` to edit your message in an external editor. Uses `$VISUAL` or `$EDITOR` environment variable. On successful save, the message is replaced; on cancel, the original is kept. ([#266](https://github.com/badlogic/pi-mono/pull/266) by [@aliou](https://github.com/aliou))
1212
+
1213
+ - **Process suspension**: Press `Ctrl+Z` to suspend pi and return to the shell. Resume with `fg` as usual. ([#267](https://github.com/badlogic/pi-mono/pull/267) by [@aliou](https://github.com/aliou))
1214
+
1215
+ - **Configurable skills directories**: Added granular control over skill sources with `enableCodexUser`, `enableClaudeUser`, `enableClaudeProject`, `enablePiUser`, `enablePiProject` toggles, plus `customDirectories` and `ignoredSkills` settings. ([#269](https://github.com/badlogic/pi-mono/pull/269) by [@nicobailon](https://github.com/nicobailon))
1216
+
1217
+ - **Skills CLI filtering**: Added `--skills <patterns>` flag for filtering skills with glob patterns. Also added `includeSkills` setting and glob pattern support for `ignoredSkills`. ([#268](https://github.com/badlogic/pi-mono/issues/268))
1218
+
1219
+ ## [0.25.2] - 2025-12-21
1220
+
1221
+ ### Fixed
1222
+
1223
+ - **Image shifting in tool output**: Fixed an issue where images in tool output would shift down (due to accumulating spacers) each time the tool output was expanded or collapsed via Ctrl+O.
1224
+
1225
+ ## [0.25.1] - 2025-12-21
1226
+
1227
+ ### Fixed
1228
+
1229
+ - **Gemini image reading broken**: Fixed the `read` tool returning images causing flaky/broken responses with Gemini models. Images in tool results are now properly formatted per the Gemini API spec.
1230
+
1231
+ - **Tab completion for absolute paths**: Fixed tab completion producing `//tmp` instead of `/tmp/`. Also fixed symlinks to directories (like `/tmp`) not getting a trailing slash, which prevented continuing to tab through subdirectories.
1232
+
1233
+ ## [0.25.0] - 2025-12-20
1234
+
1235
+ ### Added
1236
+
1237
+ - **Interruptible tool execution**: Queuing a message while tools are executing now interrupts the current tool batch. Remaining tools are skipped with an error result, and your queued message is processed immediately. Useful for redirecting the agent mid-task. ([#259](https://github.com/badlogic/pi-mono/pull/259) by [@steipete](https://github.com/steipete))
1238
+
1239
+ - **Google Gemini CLI OAuth provider**: Access Gemini 2.0/2.5 models for free via Google Cloud Code Assist. Login with `/login` and select "Google Gemini CLI". Uses your Google account with rate limits.
1240
+
1241
+ - **Google Antigravity OAuth provider**: Access Gemini 3, Claude (sonnet/opus thinking models), and GPT-OSS models for free via Google's Antigravity sandbox. Login with `/login` and select "Antigravity". Uses your Google account with rate limits.
1242
+
1243
+ ### Changed
1244
+
1245
+ - **Model selector respects --models scope**: The `/model` command now only shows models specified via `--models` flag when that flag is used, instead of showing all available models. This prevents accidentally selecting models from unintended providers. ([#255](https://github.com/badlogic/pi-mono/issues/255))
1246
+
1247
+ ### Fixed
1248
+
1249
+ - **Connection errors not retried**: Added "connection error" to the list of retryable errors so Anthropic connection drops trigger auto-retry instead of silently failing. ([#252](https://github.com/badlogic/pi-mono/issues/252))
1250
+
1251
+ - **Thinking level not clamped on model switch**: Fixed TUI showing xhigh thinking level after switching to a model that doesn't support it. Thinking level is now automatically clamped to model capabilities. ([#253](https://github.com/badlogic/pi-mono/issues/253))
1252
+
1253
+ - **Cross-model thinking handoff**: Fixed error when switching between models with different thinking signature formats (e.g., GPT-OSS to Claude thinking models via Antigravity). Thinking blocks without signatures are now converted to text with `<thinking>` delimiters.
1254
+
1255
+ ## [0.24.5] - 2025-12-20
1256
+
1257
+ ### Fixed
1258
+
1259
+ - **Input buffering in iTerm2**: Fixed Ctrl+C, Ctrl+D, and other keys requiring multiple presses in iTerm2. The cell size query response parser was incorrectly holding back keyboard input.
1260
+
1261
+ ## [0.24.4] - 2025-12-20
1262
+
1263
+ ### Fixed
1264
+
1265
+ - **Arrow keys and Enter in selector components**: Fixed arrow keys and Enter not working in model selector, session selector, OAuth selector, and other selector components when Caps Lock or Num Lock is enabled. ([#243](https://github.com/badlogic/pi-mono/issues/243))
1266
+
1267
+ ## [0.24.3] - 2025-12-19
1268
+
1269
+ ### Fixed
1270
+
1271
+ - **Footer overflow on narrow terminals**: Fixed footer path display exceeding terminal width when resizing to very narrow widths, causing rendering crashes. /arminsayshi
1272
+
1273
+ ## [0.24.2] - 2025-12-20
1274
+
1275
+ ### Fixed
1276
+
1277
+ - **More Kitty keyboard protocol fixes**: Fixed Backspace, Enter, Home, End, and Delete keys not working with Caps Lock enabled. The initial fix in 0.24.1 missed several key handlers that were still using raw byte detection. Now all key handlers use the helper functions that properly mask out lock key bits. ([#243](https://github.com/badlogic/pi-mono/issues/243))
1278
+
1279
+ ## [0.24.1] - 2025-12-19
1280
+
1281
+ ### Added
1282
+
1283
+ - **OAuth and model config exports**: Scripts using `AgentSession` directly can now import `getAvailableModels`, `getApiKeyForModel`, `findModel`, `login`, `logout`, and `getOAuthProviders` from `@mariozechner/pi-coding-agent` to reuse OAuth token storage and model resolution. ([#245](https://github.com/badlogic/pi-mono/issues/245))
1284
+
1285
+ - **xhigh thinking level for gpt-5.2 models**: The thinking level selector and shift+tab cycling now show xhigh option for gpt-5.2 and gpt-5.2-codex models (in addition to gpt-5.1-codex-max). ([#236](https://github.com/badlogic/pi-mono/pull/236) by [@theBucky](https://github.com/theBucky))
1286
+
1287
+ ### Fixed
1288
+
1289
+ - **Hooks wrap custom tools**: Custom tools are now executed through the hook wrapper, so `tool_call`/`tool_result` hooks can observe, block, and modify custom tool executions (consistent with hook type docs). ([#248](https://github.com/badlogic/pi-mono/pull/248) by [@nicobailon](https://github.com/nicobailon))
1290
+
1291
+ - **Hook onUpdate callback forwarding**: The `onUpdate` callback is now correctly forwarded through the hook wrapper, fixing custom tool progress updates. ([#238](https://github.com/badlogic/pi-mono/pull/238) by [@nicobailon](https://github.com/nicobailon))
1292
+
1293
+ - **Terminal cleanup on Ctrl+C in session selector**: Fixed terminal not being properly restored when pressing Ctrl+C in the session selector. ([#247](https://github.com/badlogic/pi-mono/pull/247) by [@aliou](https://github.com/aliou))
1294
+
1295
+ - **OpenRouter models with colons in IDs**: Fixed parsing of OpenRouter model IDs that contain colons (e.g., `openrouter:meta-llama/llama-4-scout:free`). ([#242](https://github.com/badlogic/pi-mono/pull/242) by [@aliou](https://github.com/aliou))
1296
+
1297
+ - **Global AGENTS.md loaded twice**: Fixed global AGENTS.md being loaded twice when present in both `~/.pi/agent/` and the current directory. ([#239](https://github.com/badlogic/pi-mono/pull/239) by [@aliou](https://github.com/aliou))
1298
+
1299
+ - **Kitty keyboard protocol on Linux**: Fixed keyboard input not working in Ghostty on Linux when Num Lock is enabled. The Kitty protocol includes Caps Lock and Num Lock state in modifier values, which broke key detection. Now correctly masks out lock key bits when matching keyboard shortcuts. ([#243](https://github.com/badlogic/pi-mono/issues/243))
1300
+
1301
+ - **Emoji deletion and cursor movement**: Backspace, Delete, and arrow keys now correctly handle multi-codepoint characters like emojis. Previously, deleting an emoji would leave partial bytes, corrupting the editor state. ([#240](https://github.com/badlogic/pi-mono/issues/240))
1302
+
1303
+ ## [0.24.0] - 2025-12-19
1304
+
1305
+ ### Added
1306
+
1307
+ - **Subagent orchestration example**: Added comprehensive custom tool example for spawning and orchestrating sub-agents with isolated context windows. Includes scout/planner/reviewer/worker agents and workflow commands for multi-agent pipelines. ([#215](https://github.com/badlogic/pi-mono/pull/215) by [@nicobailon](https://github.com/nicobailon))
1308
+
1309
+ - **`getMarkdownTheme()` export**: Custom tools can now import `getMarkdownTheme()` from `@mariozechner/pi-coding-agent` to use the same markdown styling as the main UI.
1310
+
1311
+ - **`pi.exec()` signal and timeout support**: Custom tools and hooks can now pass `{ signal, timeout }` options to `pi.exec()` for cancellation and timeout handling. The result includes a `killed` flag when the process was terminated.
1312
+
1313
+ - **Kitty keyboard protocol support**: Shift+Enter, Alt+Enter, Shift+Tab, Ctrl+D, and all Ctrl+key combinations now work in Ghostty, Kitty, WezTerm, and other modern terminals. ([#225](https://github.com/badlogic/pi-mono/pull/225) by [@kim0](https://github.com/kim0))
1314
+
1315
+ - **Dynamic API key refresh**: OAuth tokens (GitHub Copilot, Anthropic OAuth) are now refreshed before each LLM call, preventing failures in long-running agent loops where tokens expire mid-session. ([#223](https://github.com/badlogic/pi-mono/pull/223) by [@kim0](https://github.com/kim0))
1316
+
1317
+ - **`/hotkeys` command**: Shows all keyboard shortcuts in a formatted table.
1318
+
1319
+ - **Markdown table borders**: Tables now render with proper top and bottom borders.
1320
+
1321
+ ### Changed
1322
+
1323
+ - **Subagent example improvements**: Parallel mode now streams updates from all tasks. Chain mode shows all completed steps during streaming. Expanded view uses proper markdown rendering with syntax highlighting. Usage footer shows turn count.
1324
+
1325
+ - **Skills standard compliance**: Skills now adhere to the [Agent Skills standard](https://agentskills.io/specification). Validates name (must match parent directory, lowercase, max 64 chars), description (required, max 1024 chars), and frontmatter fields. Warns on violations but remains lenient. Prompt format changed to XML structure. Removed `{baseDir}` placeholder in favor of relative paths. ([#231](https://github.com/badlogic/pi-mono/issues/231))
1326
+
1327
+ ### Fixed
1328
+
1329
+ - **JSON mode stdout flush**: Fixed race condition where `pi --mode json` could exit before all output was written to stdout, causing consumers to miss final events.
1330
+
1331
+ - **Symlinked tools, hooks, and slash commands**: Discovery now correctly follows symlinks when scanning for custom tools, hooks, and slash commands. ([#219](https://github.com/badlogic/pi-mono/pull/219), [#232](https://github.com/badlogic/pi-mono/pull/232) by [@aliou](https://github.com/aliou))
1332
+
1333
+ ### Breaking Changes
1334
+
1335
+ - **Custom tools now require `index.ts` entry point**: Auto-discovered custom tools must be in a subdirectory with an `index.ts` file. The old pattern `~/.pi/agent/tools/mytool.ts` must become `~/.pi/agent/tools/mytool/index.ts`. This allows multi-file tools to import helper modules. Explicit paths via `--tool` or `settings.json` still work with any `.ts` file.
1336
+
1337
+ - **Hook `tool_result` event restructured**: The `ToolResultEvent` now exposes full tool result data instead of just text. ([#233](https://github.com/badlogic/pi-mono/pull/233))
1338
+ - Removed: `result: string` field
1339
+ - Added: `content: (TextContent | ImageContent)[]` - full content array
1340
+ - Added: `details: unknown` - tool-specific details (typed per tool via discriminated union on `toolName`)
1341
+ - `ToolResultEventResult.result` renamed to `ToolResultEventResult.text` (removed), use `content` instead
1342
+ - Hook handlers returning `{ result: "..." }` must change to `{ content: [{ type: "text", text: "..." }] }`
1343
+ - Built-in tool details types exported: `BashToolDetails`, `ReadToolDetails`, `GrepToolDetails`, `FindToolDetails`, `LsToolDetails`, `TruncationResult`
1344
+ - Type guards exported for narrowing: `isBashToolResult`, `isReadToolResult`, `isEditToolResult`, `isWriteToolResult`, `isGrepToolResult`, `isFindToolResult`, `isLsToolResult`
1345
+
1346
+ ## [0.23.4] - 2025-12-18
1347
+
1348
+ ### Added
1349
+
1350
+ - **Syntax highlighting**: Added syntax highlighting for markdown code blocks, read tool output, and write tool content. Uses cli-highlight with theme-aware color mapping and VS Code-style syntax colors. ([#214](https://github.com/badlogic/pi-mono/pull/214) by [@svkozak](https://github.com/svkozak))
1351
+
1352
+ - **Intra-line diff highlighting**: Edit tool now shows word-level changes with inverse highlighting when a single line is modified. Multi-line changes show all removed lines first, then all added lines.
1353
+
1354
+ ### Fixed
1355
+
1356
+ - **Gemini tool result format**: Fixed tool result format for Gemini 3 Flash Preview which strictly requires `{ output: value }` for success and `{ error: value }` for errors. Previous format using `{ result, isError }` was rejected by newer Gemini models. ([#213](https://github.com/badlogic/pi-mono/issues/213), [#220](https://github.com/badlogic/pi-mono/pull/220))
1357
+
1358
+ - **Google baseUrl configuration**: Google provider now respects `baseUrl` configuration for custom endpoints or API proxies. ([#216](https://github.com/badlogic/pi-mono/issues/216), [#221](https://github.com/badlogic/pi-mono/pull/221) by [@theBucky](https://github.com/theBucky))
1359
+
1360
+ - **Google provider FinishReason**: Added handling for new `IMAGE_RECITATION` and `IMAGE_OTHER` finish reasons. Upgraded @google/genai to 1.34.0.
1361
+
1362
+ ## [0.23.3] - 2025-12-17
1363
+
1364
+ ### Fixed
1365
+
1366
+ - Check for compaction before submitting user prompt, not just after agent turn ends. This catches cases where user aborts mid-response and context is already near the limit.
1367
+
1368
+ ### Changed
1369
+
1370
+ - Improved system prompt documentation section with clearer pointers to specific doc files for custom models, themes, skills, hooks, custom tools, and RPC.
1371
+
1372
+ - Cleaned up documentation:
1373
+
1374
+ - `theme.md`: Added missing color tokens (`thinkingXhigh`, `bashMode`)
1375
+ - `skills.md`: Rewrote with better framing and examples
1376
+ - `hooks.md`: Fixed timeout/error handling docs, added import aliases section
1377
+ - `custom-tools.md`: Added intro with use cases and comparison table
1378
+ - `rpc.md`: Added missing `hook_error` event documentation
1379
+ - `README.md`: Complete settings table, condensed philosophy section, standardized OAuth docs
1380
+
1381
+ - Hooks loader now supports same import aliases as custom tools (`@sinclair/typebox`, `@mariozechner/pi-ai`, `@mariozechner/pi-tui`, `@mariozechner/pi-coding-agent`).
1382
+
1383
+ ### Breaking Changes
1384
+
1385
+ - **Hooks**: `turn_end` event's `toolResults` type changed from `AppMessage[]` to `ToolResultMessage[]`. If you have hooks that handle `turn_end` events and explicitly type the results, update your type annotations.
1386
+
1387
+ ## [0.23.2] - 2025-12-17
1388
+
1389
+ ### Fixed
1390
+
1391
+ - Fixed Claude models via GitHub Copilot re-answering all previous prompts in multi-turn conversations. The issue was that assistant message content was sent as an array instead of a string, which Copilot's Claude adapter misinterpreted. Also added missing `Openai-Intent: conversation-edits` header and fixed `X-Initiator` logic to check for any assistant/tool message in history. ([#209](https://github.com/badlogic/pi-mono/issues/209))
1392
+
1393
+ - Detect image MIME type via file magic (read tool and `@file` attachments), not filename extension.
1394
+
1395
+ - Fixed markdown tables overflowing terminal width. Tables now wrap cell contents to fit available width instead of breaking borders mid-row. ([#206](https://github.com/badlogic/pi-mono/pull/206) by [@kim0](https://github.com/kim0))
1396
+
1397
+ ## [0.23.1] - 2025-12-17
1398
+
1399
+ ### Fixed
1400
+
1401
+ - Fixed TUI performance regression caused by Box component lacking render caching. Built-in tools now use Text directly (like v0.22.5), and Box has proper caching for custom tool rendering.
1402
+
1403
+ - Fixed custom tools failing to load from `~/.pi/agent/tools/` when pi is installed globally. Module imports (`@sinclair/typebox`, `@mariozechner/pi-tui`, `@mariozechner/pi-ai`) are now resolved via aliases.
1404
+
1405
+ ## [0.23.0] - 2025-12-17
1406
+
1407
+ ### Added
1408
+
1409
+ - **Custom tools**: Extend pi with custom tools written in TypeScript. Tools can provide custom TUI rendering, interact with users via `pi.ui` (select, confirm, input, notify), and maintain state across sessions via `onSession` callback. See [docs/custom-tools.md](docs/custom-tools.md) and [examples/custom-tools/](examples/custom-tools/). ([#190](https://github.com/badlogic/pi-mono/issues/190))
1410
+
1411
+ - **Hook and tool examples**: Added `examples/hooks/` and `examples/custom-tools/` with working examples. Examples are now bundled in npm and binary releases.
1412
+
1413
+ ### Breaking Changes
1414
+
1415
+ - **Hooks**: Replaced `session_start` and `session_switch` events with unified `session` event. Use `event.reason` (`"start" | "switch" | "clear"`) to distinguish. Event now includes `entries` array for state reconstruction.
1416
+
1417
+ ## [0.22.5] - 2025-12-17
1418
+
1419
+ ### Fixed
1420
+
1421
+ - Fixed `--session` flag not saving sessions in print mode (`-p`). The session manager was never receiving events because no subscriber was attached.
1422
+
1423
+ ## [0.22.4] - 2025-12-17
1424
+
1425
+ ### Added
1426
+
1427
+ - `--list-models [search]` CLI flag to list available models with optional fuzzy search. Shows provider, model ID, context window, max output, thinking support, and image support. Only lists models with configured API keys. ([#203](https://github.com/badlogic/pi-mono/issues/203))
1428
+
1429
+ ### Fixed
1430
+
1431
+ - Fixed tool execution showing green (success) background while still running. Now correctly shows gray (pending) background until the tool completes.
1432
+
1433
+ ## [0.22.3] - 2025-12-16
1434
+
1435
+ ### Added
1436
+
1437
+ - **Streaming bash output**: Bash tool now streams output in real-time during execution. The TUI displays live progress with the last 5 lines visible (expandable with ctrl+o). ([#44](https://github.com/badlogic/pi-mono/issues/44))
1438
+
1439
+ ### Changed
1440
+
1441
+ - **Tool output display**: When collapsed, tool output now shows the last N lines instead of the first N lines, making streaming output more useful.
1442
+
1443
+ - Updated `@mariozechner/pi-ai` with X-Initiator header support for GitHub Copilot, ensuring agent calls are not deducted from quota. ([#200](https://github.com/badlogic/pi-mono/pull/200) by [@kim0](https://github.com/kim0))
1444
+
1445
+ ### Fixed
1446
+
1447
+ - Fixed editor text being cleared during compaction. Text typed while compaction is running is now preserved. ([#179](https://github.com/badlogic/pi-mono/issues/179))
1448
+ - Improved RGB to 256-color mapping for terminals without truecolor support. Now correctly uses grayscale ramp for neutral colors and preserves semantic tints (green for success, red for error, blue for pending) instead of mapping everything to wrong cube colors.
1449
+ - `/think off` now actually disables thinking for all providers. Previously, providers like Gemini with "dynamic thinking" enabled by default would still use thinking even when turned off. ([#180](https://github.com/badlogic/pi-mono/pull/180) by [@markusylisiurunen](https://github.com/markusylisiurunen))
1450
+
1451
+ ## [0.22.2] - 2025-12-15
1452
+
1453
+ ### Changed
1454
+
1455
+ - Updated `@mariozechner/pi-ai` with interleaved thinking enabled by default for Anthropic Claude 4 models.
1456
+
1457
+ ## [0.22.1] - 2025-12-15
1458
+
1459
+ _Dedicated to Peter's shoulder ([@steipete](https://twitter.com/steipete))_
1460
+
1461
+ ### Changed
1462
+
1463
+ - Updated `@mariozechner/pi-ai` with interleaved thinking support for Anthropic models.
1464
+
1465
+ ## [0.22.0] - 2025-12-15
1466
+
1467
+ ### Added
1468
+
1469
+ - **GitHub Copilot support**: Use GitHub Copilot models via OAuth login (`/login` -> "GitHub Copilot"). Supports both github.com and GitHub Enterprise. Models are sourced from models.dev and include Claude, GPT, Gemini, Grok, and more. All models are automatically enabled after login. ([#191](https://github.com/badlogic/pi-mono/pull/191) by [@cau1k](https://github.com/cau1k))
1470
+
1471
+ ### Fixed
1472
+
1473
+ - Model selector fuzzy search now matches against provider name (not just model ID) and supports space-separated tokens where all tokens must match
1474
+
1475
+ ## [0.21.0] - 2025-12-14
1476
+
1477
+ ### Added
1478
+
1479
+ - **Inline image rendering**: Terminals supporting Kitty graphics protocol (Kitty, Ghostty, WezTerm) or iTerm2 inline images now render images inline in tool output. Aspect ratio is preserved by querying terminal cell dimensions on startup. Toggle with `/show-images` command or `terminal.showImages` setting. Falls back to text placeholder on unsupported terminals or when disabled. ([#177](https://github.com/badlogic/pi-mono/pull/177) by [@nicobailon](https://github.com/nicobailon))
1480
+
1481
+ - **Gemini 3 Pro thinking levels**: Thinking level selector now works with Gemini 3 Pro models. Minimal/low map to Google's LOW, medium/high map to Google's HIGH. ([#176](https://github.com/badlogic/pi-mono/pull/176) by [@markusylisiurunen](https://github.com/markusylisiurunen))
1482
+
1483
+ ### Fixed
1484
+
1485
+ - Fixed read tool failing on macOS screenshot filenames due to Unicode Narrow No-Break Space (U+202F) in timestamp. Added fallback to try macOS variant paths and consolidated duplicate expandPath functions into shared path-utils.ts. ([#181](https://github.com/badlogic/pi-mono/pull/181) by [@nicobailon](https://github.com/nicobailon))
1486
+
1487
+ - Fixed double blank lines rendering after markdown code blocks ([#173](https://github.com/badlogic/pi-mono/pull/173) by [@markusylisiurunen](https://github.com/markusylisiurunen))
1488
+
1489
+ ## [0.20.1] - 2025-12-13
1490
+
1491
+ ### Added
1492
+
1493
+ - **Exported skills API**: `loadSkillsFromDir`, `formatSkillsForPrompt`, and related types are now exported for use by other packages (e.g., mom).
1494
+
1495
+ ## [0.20.0] - 2025-12-13
1496
+
1497
+ ### Breaking Changes
1498
+
1499
+ - **Pi skills now use `SKILL.md` convention**: Pi skills must now be named `SKILL.md` inside a directory, matching Codex CLI format. Previously any `*.md` file was treated as a skill. Migrate by renaming `~/.pi/agent/skills/foo.md` to `~/.pi/agent/skills/foo/SKILL.md`.
1500
+
1501
+ ### Added
1502
+
1503
+ - Display loaded skills on startup in interactive mode
1504
+
1505
+ ## [0.19.1] - 2025-12-12
1506
+
1507
+ ### Fixed
1508
+
1509
+ - Documentation: Added skills system documentation to README (setup, usage, CLI flags, settings)
1510
+
1511
+ ## [0.19.0] - 2025-12-12
1512
+
1513
+ ### Added
1514
+
1515
+ - **Skills system**: Auto-discover and load instruction files on-demand. Supports Claude Code (`~/.claude/skills/*/SKILL.md`), Codex CLI (`~/.codex/skills/`), and Pi-native formats (`~/.pi/agent/skills/`, `.pi/skills/`). Skills are listed in system prompt with descriptions, agent loads them via read tool when needed. Supports `{baseDir}` placeholder. Disable with `--no-skills` or `skills.enabled: false` in settings. ([#169](https://github.com/badlogic/pi-mono/issues/169))
1516
+
1517
+ - **Version flag**: Added `--version` / `-v` flag to display the current version and exit. ([#170](https://github.com/badlogic/pi-mono/pull/170))
1518
+
1519
+ ## [0.18.2] - 2025-12-11
1520
+
1521
+ ### Added
1522
+
1523
+ - **Auto-retry on transient errors**: Automatically retries requests when providers return overloaded, rate limit, or server errors (429, 500, 502, 503, 504). Uses exponential backoff (2s, 4s, 8s). Shows retry status in TUI with option to cancel via Escape. Configurable in `settings.json` via `retry.enabled`, `retry.maxRetries`, `retry.baseDelayMs`. RPC mode emits `auto_retry_start` and `auto_retry_end` events. ([#157](https://github.com/badlogic/pi-mono/issues/157))
1524
+
1525
+ - **HTML export line numbers**: Read tool calls in HTML exports now display line number ranges (e.g., `file.txt:10-20`) when offset/limit parameters are used, matching the TUI display format. Line numbers appear in yellow color for better visibility. ([#166](https://github.com/badlogic/pi-mono/issues/166))
1526
+
1527
+ ### Fixed
1528
+
1529
+ - **Branch selector now works with single message**: Previously the branch selector would not open when there was only one user message. Now it correctly allows branching from any message, including the first one. This is needed for checkpoint hooks to restore state from before the first message. ([#163](https://github.com/badlogic/pi-mono/issues/163))
1530
+
1531
+ - **In-memory branching for `--no-session` mode**: Branching now works correctly in `--no-session` mode without creating any session files. The conversation is truncated in memory.
1532
+
1533
+ - **Git branch indicator now works in subdirectories**: The footer's git branch detection now walks up the directory hierarchy to find the git root, so it works when running pi from a subdirectory of a repository. ([#156](https://github.com/badlogic/pi-mono/issues/156))
1534
+
1535
+ ## [0.18.1] - 2025-12-10
1536
+
1537
+ ### Added
1538
+
1539
+ - **Mistral provider**: Added support for Mistral AI models. Set `MISTRAL_API_KEY` environment variable to use.
1540
+
1541
+ ### Fixed
1542
+
1543
+ - Fixed print mode (`-p`) not exiting after output when custom themes are present (theme watcher now properly stops in print mode) ([#161](https://github.com/badlogic/pi-mono/issues/161))
1544
+
1545
+ ## [0.18.0] - 2025-12-10
1546
+
1547
+ ### Added
1548
+
1549
+ - **Hooks system**: TypeScript modules that extend agent behavior by subscribing to lifecycle events. Hooks can intercept tool calls, prompt for confirmation, modify results, and inject messages from external sources. Auto-discovered from `~/.pi/agent/hooks/*.ts` and `.pi/hooks/*.ts`. Thanks to [@nicobailon](https://github.com/nicobailon) for the collaboration on the design and implementation. ([#145](https://github.com/badlogic/pi-mono/issues/145), supersedes [#158](https://github.com/badlogic/pi-mono/pull/158))
1550
+
1551
+ - **`pi.send()` API**: Hooks can inject messages into the agent session from external sources (file watchers, webhooks, CI systems). If streaming, messages are queued; otherwise a new agent loop starts immediately.
1552
+
1553
+ - **`--hook <path>` CLI flag**: Load hook files directly for testing without modifying settings.
1554
+
1555
+ - **Hook events**: `session_start`, `session_switch`, `agent_start`, `agent_end`, `turn_start`, `turn_end`, `tool_call` (can block), `tool_result` (can modify), `branch`.
1556
+
1557
+ - **Hook UI primitives**: `ctx.ui.select()`, `ctx.ui.confirm()`, `ctx.ui.input()`, `ctx.ui.notify()` for interactive prompts from hooks.
1558
+
1559
+ - **Hooks documentation**: Full API reference at `docs/hooks.md`, shipped with npm package.
1560
+
1561
+ ## [0.17.0] - 2025-12-09
1562
+
1563
+ ### Changed
1564
+
1565
+ - **Simplified compaction flow**: Removed proactive compaction (aborting mid-turn when threshold approached). Compaction now triggers in two cases only: (1) overflow error from LLM, which compacts and auto-retries, or (2) threshold crossed after a successful turn, which compacts without retry.
1566
+
1567
+ - **Compaction retry uses `Agent.continue()`**: Auto-retry after overflow now uses the new `continue()` API instead of re-sending the user message, preserving exact context state.
1568
+
1569
+ - **Merged turn prefix summary**: When a turn is split during compaction, the turn prefix summary is now merged into the main history summary instead of being stored separately.
1570
+
1571
+ ### Added
1572
+
1573
+ - **`isCompacting` property on AgentSession**: Check if auto-compaction is currently running.
1574
+
1575
+ - **Session compaction indicator**: When resuming a compacted session, displays "Session compacted N times" status message.
1576
+
1577
+ ### Fixed
1578
+
1579
+ - **Block input during compaction**: User input is now blocked while auto-compaction is running to prevent race conditions.
1580
+
1581
+ - **Skip error messages in usage calculation**: Context size estimation now skips both aborted and error messages, as neither have valid usage data.
1582
+
1583
+ ## [0.16.0] - 2025-12-09
1584
+
1585
+ ### Breaking Changes
1586
+
1587
+ - **New RPC protocol**: The RPC mode (`--mode rpc`) has been completely redesigned with a new JSON protocol. The old protocol is no longer supported. See [`docs/rpc.md`](docs/rpc.md) for the new protocol documentation and [`test/rpc-example.ts`](test/rpc-example.ts) for a working example. Includes `RpcClient` TypeScript class for easy integration. ([#91](https://github.com/badlogic/pi-mono/issues/91))
1588
+
1589
+ ### Changed
1590
+
1591
+ - **README restructured**: Reorganized documentation from 30+ flat sections into 10 logical groups. Converted verbose subsections to scannable tables. Consolidated philosophy sections. Reduced size by ~60% while preserving all information.
1592
+
1593
+ ## [0.15.0] - 2025-12-09
1594
+
1595
+ ### Changed
1596
+
1597
+ - **Major code refactoring**: Restructured codebase for better maintainability and separation of concerns. Moved files into organized directories (`core/`, `modes/`, `utils/`, `cli/`). Extracted `AgentSession` class as central session management abstraction. Split `main.ts` and `tui-renderer.ts` into focused modules. See `DEVELOPMENT.md` for the new code map. ([#153](https://github.com/badlogic/pi-mono/issues/153))
1598
+
1599
+ ## [0.14.2] - 2025-12-08
1600
+
1601
+ ### Added
1602
+
1603
+ - `/debug` command now includes agent messages as JSONL in the output
1604
+
1605
+ ### Fixed
1606
+
1607
+ - Fix crash when bash command outputs binary data (e.g., `curl` downloading a video file)
1608
+
1609
+ ## [0.14.1] - 2025-12-08
1610
+
1611
+ ### Fixed
1612
+
1613
+ - Fix build errors with tsgo 7.0.0-dev.20251208.1 by properly importing `ReasoningEffort` type
1614
+
1615
+ ## [0.14.0] - 2025-12-08
1616
+
1617
+ ### Breaking Changes
1618
+
1619
+ - **Custom themes require new color tokens**: Themes must now include `thinkingXhigh` and `bashMode` color tokens. The theme loader provides helpful error messages listing missing tokens. See built-in themes (dark.json, light.json) for reference values.
1620
+
1621
+ ### Added
1622
+
1623
+ - **OpenAI compatibility overrides in models.json**: Custom models using `openai-completions` API can now specify a `compat` object to override provider quirks (`supportsStore`, `supportsDeveloperRole`, `supportsReasoningEffort`, `maxTokensField`). Useful for LiteLLM, custom proxies, and other non-standard endpoints. ([#133](https://github.com/badlogic/pi-mono/issues/133), thanks @fink-andreas for the initial idea and PR)
1624
+
1625
+ - **xhigh thinking level**: Added `xhigh` thinking level for OpenAI codex-max models. Cycle through thinking levels with Shift+Tab; `xhigh` appears only when using a codex-max model. ([#143](https://github.com/badlogic/pi-mono/issues/143))
1626
+
1627
+ - **Collapse changelog setting**: Add `"collapseChangelog": true` to `~/.pi/agent/settings.json` to show a condensed "Updated to vX.Y.Z" message instead of the full changelog after updates. Use `/changelog` to view the full changelog. ([#148](https://github.com/badlogic/pi-mono/issues/148))
1628
+
1629
+ - **Bash mode**: Execute shell commands directly from the editor by prefixing with `!` (e.g., `!ls -la`). Output streams in real-time, is added to the LLM context, and persists in session history. Supports multiline commands, cancellation (Escape), truncation for large outputs, and preview/expand toggle (Ctrl+O). Also available in RPC mode via `{"type":"bash","command":"..."}`. ([#112](https://github.com/badlogic/pi-mono/pull/112), original implementation by [@markusylisiurunen](https://github.com/markusylisiurunen))
1630
+
1631
+ ## [0.13.2] - 2025-12-07
1632
+
1633
+ ### Changed
1634
+
1635
+ - **Tool output truncation**: All tools now enforce consistent truncation limits with actionable notices for the LLM. ([#134](https://github.com/badlogic/pi-mono/issues/134))
1636
+ - **Limits**: 2000 lines OR 50KB (whichever hits first), never partial lines
1637
+ - **read**: Shows `[Showing lines X-Y of Z. Use offset=N to continue]`. If first line exceeds 50KB, suggests bash command
1638
+ - **bash**: Tail truncation with temp file. Shows `[Showing lines X-Y of Z. Full output: /tmp/...]`
1639
+ - **grep**: Pre-truncates match lines to 500 chars. Shows match limit and line truncation notices
1640
+ - **find/ls**: Shows result/entry limit notices
1641
+ - TUI displays truncation warnings in yellow at bottom of tool output (visible even when collapsed)
1642
+
1643
+ ## [0.13.1] - 2025-12-06
1644
+
1645
+ ### Added
1646
+
1647
+ - **Flexible Windows shell configuration**: The bash tool now supports multiple shell sources beyond Git Bash. Resolution order: (1) custom `shellPath` in settings.json, (2) Git Bash in standard locations, (3) any bash.exe on PATH. This enables Cygwin, MSYS2, and other bash environments. Configure with `~/.pi/agent/settings.json`: `{"shellPath": "C:\\cygwin64\\bin\\bash.exe"}`.
1648
+
1649
+ ### Fixed
1650
+
1651
+ - **Windows binary detection**: Fixed Bun compiled binary detection on Windows by checking for URL-encoded `%7EBUN` in addition to `$bunfs` and `~BUN` in `import.meta.url`. This ensures the binary correctly locates supporting files (package.json, themes, etc.) next to the executable.
1652
+
1653
+ ## [0.12.15] - 2025-12-06
1654
+
1655
+ ### Fixed
1656
+
1657
+ - **Editor crash with emojis/CJK characters**: Fixed crash when pasting or typing text containing wide characters (emojis like ✅, CJK characters) that caused line width to exceed terminal width. The editor now uses grapheme-aware text wrapping with proper visible width calculation.
1658
+
1659
+ ## [0.12.14] - 2025-12-06
1660
+
1661
+ ### Added
1662
+
1663
+ - **Double-Escape Branch Shortcut**: Press Escape twice with an empty editor to quickly open the `/branch` selector for conversation branching.
1664
+
1665
+ ## [0.12.13] - 2025-12-05
1666
+
1667
+ ### Changed
1668
+
1669
+ - **Faster startup**: Version check now runs in parallel with TUI initialization instead of blocking startup for up to 1 second. Update notifications appear in chat when the check completes.
1670
+
1671
+ ## [0.12.12] - 2025-12-05
1672
+
1673
+ ### Changed
1674
+
1675
+ - **Footer display**: Token counts now use M suffix for millions (e.g., `10.2M` instead of `10184k`). Context display shortened from `61.3% of 200k` to `61.3%/200k`.
1676
+
1677
+ ### Fixed
1678
+
1679
+ - **Multi-key sequences in inputs**: Inputs like model search now handle multi-key sequences identically to the main prompt editor. ([#122](https://github.com/badlogic/pi-mono/pull/122) by [@markusylisiurunen](https://github.com/markusylisiurunen))
1680
+ - **Line wrapping escape codes**: Fixed underline style bleeding into padding when wrapping long URLs. ANSI codes now attach to the correct content, and line-end resets only turn off underline (preserving background colors). ([#109](https://github.com/badlogic/pi-mono/issues/109))
1681
+
1682
+ ### Added
1683
+
1684
+ - **Fuzzy search models and sessions**: Implemented a simple fuzzy search for models and sessions (e.g., `codexmax` now finds `gpt-5.1-codex-max`). ([#122](https://github.com/badlogic/pi-mono/pull/122) by [@markusylisiurunen](https://github.com/markusylisiurunen))
1685
+ - **Prompt History Navigation**: Browse previously submitted prompts using Up/Down arrow keys when the editor is empty. Press Up to cycle through older prompts, Down to return to newer ones or clear the editor. Similar to shell history and Claude Code's prompt history feature. History is session-scoped and stores up to 100 entries. ([#121](https://github.com/badlogic/pi-mono/pull/121) by [@nicobailon](https://github.com/nicobailon))
1686
+ - **`/resume` Command**: Switch to a different session mid-conversation. Opens an interactive selector showing all available sessions. Equivalent to the `--resume` CLI flag but can be used without restarting the agent. ([#117](https://github.com/badlogic/pi-mono/pull/117) by [@hewliyang](https://github.com/hewliyang))
1687
+
1688
+ ## [0.12.11] - 2025-12-05
1689
+
1690
+ ### Changed
1691
+
1692
+ - **Compaction UI**: Simplified collapsed compaction indicator to show warning-colored text with token count instead of styled banner. Removed redundant success message after compaction. ([#108](https://github.com/badlogic/pi-mono/issues/108))
1693
+
1694
+ ### Fixed
1695
+
1696
+ - **Print mode error handling**: `-p` flag now outputs error messages and exits with code 1 when requests fail, instead of silently producing no output.
1697
+ - **Branch selector crash**: Fixed TUI crash when user messages contained Unicode characters (like `✔` or `›`) that caused line width to exceed terminal width. Now uses proper `truncateToWidth` instead of `substring`.
1698
+ - **Bash output escape sequences**: Fixed incomplete stripping of terminal escape sequences in bash tool output. `stripAnsi` misses some sequences like standalone String Terminator (`ESC \`), which could cause rendering issues when displaying captured TUI output.
1699
+ - **Footer overflow crash**: Fixed TUI crash when terminal width is too narrow for the footer stats line. The footer now truncates gracefully instead of overflowing.
1700
+
1701
+ ### Added
1702
+
1703
+ - **`authHeader` option in models.json**: Custom providers can set `"authHeader": true` to automatically add `Authorization: Bearer <apiKey>` header. Useful for providers that require explicit auth headers. ([#81](https://github.com/badlogic/pi-mono/issues/81))
1704
+ - **`--append-system-prompt` Flag**: Append additional text or file contents to the system prompt. Supports both inline text and file paths. Complements `--system-prompt` for layering custom instructions without replacing the base system prompt. ([#114](https://github.com/badlogic/pi-mono/pull/114) by [@markusylisiurunen](https://github.com/markusylisiurunen))
1705
+ - **Thinking Block Toggle**: Added `Ctrl+T` shortcut to toggle visibility of LLM thinking blocks. When toggled off, shows a static "Thinking..." label instead of full content. Useful for reducing visual clutter during long conversations. ([#113](https://github.com/badlogic/pi-mono/pull/113) by [@markusylisiurunen](https://github.com/markusylisiurunen))
1706
+
1707
+ ## [0.12.10] - 2025-12-04
1708
+
1709
+ ### Added
1710
+
1711
+ - Added `gpt-5.1-codex-max` model support
1712
+
1713
+ ## [0.12.9] - 2025-12-04
1714
+
1715
+ ### Added
1716
+
1717
+ - **`/copy` Command**: Copy the last agent message to clipboard. Works cross-platform (macOS, Windows, Linux). Useful for extracting text from rendered Markdown output. ([#105](https://github.com/badlogic/pi-mono/pull/105) by [@markusylisiurunen](https://github.com/markusylisiurunen))
1718
+
1719
+ ## [0.12.8] - 2025-12-04
1720
+
1721
+ - Fix: Use CTRL+O consistently for compaction expand shortcut (not CMD+O on Mac)
1722
+
1723
+ ## [0.12.7] - 2025-12-04
1724
+
1725
+ ### Added
1726
+
1727
+ - **Context Compaction**: Long sessions can now be compacted to reduce context usage while preserving recent conversation history. ([#92](https://github.com/badlogic/pi-mono/issues/92), [docs](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/README.md#context-compaction))
1728
+ - `/compact [instructions]`: Manually compact context with optional custom instructions for the summary
1729
+ - `/autocompact`: Toggle automatic compaction when context exceeds threshold
1730
+ - Compaction summarizes older messages while keeping recent messages (default 20k tokens) verbatim
1731
+ - Auto-compaction triggers when context reaches `contextWindow - reserveTokens` (default 16k reserve)
1732
+ - Compacted sessions show a collapsible summary in the TUI (toggle with `o` key)
1733
+ - HTML exports include compaction summaries as collapsible sections
1734
+ - RPC mode supports `{"type":"compact"}` command and auto-compaction (emits compaction events)
1735
+ - **Branch Source Tracking**: Branched sessions now store `branchedFrom` in the session header, containing the path to the original session file. Useful for tracing session lineage.
1736
+
1737
+ ## [0.12.5] - 2025-12-03
1738
+
1739
+ ### Added
1740
+
1741
+ - **Forking/Rebranding Support**: All branding (app name, config directory, environment variable names) is now configurable via `piConfig` in `package.json`. Forks can change `piConfig.name` and `piConfig.configDir` to rebrand the CLI without code changes. Affects CLI banner, help text, config paths, and error messages. ([#95](https://github.com/badlogic/pi-mono/pull/95))
1742
+
1743
+ ### Fixed
1744
+
1745
+ - **Bun Binary Detection**: Fixed Bun compiled binary failing to start after Bun updated its virtual filesystem path format from `%7EBUN` to `$bunfs`. ([#95](https://github.com/badlogic/pi-mono/pull/95))
1746
+
1747
+ ## [0.12.4] - 2025-12-02
1748
+
1749
+ ### Added
1750
+
1751
+ - **RPC Termination Safeguard**: When running as an RPC worker (stdin pipe detected), the CLI now exits immediately if the parent process terminates unexpectedly. Prevents orphaned RPC workers from persisting indefinitely and consuming system resources.
1752
+
1753
+ ## [0.12.3] - 2025-12-02
1754
+
1755
+ ### Fixed
1756
+
1757
+ - **Rate limit handling**: Anthropic rate limit errors now trigger automatic retry with exponential backoff (base 10s, max 5 retries). Previously these errors would abort the request immediately.
1758
+ - **Usage tracking during retries**: Retried requests now correctly accumulate token usage from all attempts, not just the final successful one. Fixes artificially low token counts when requests were retried.
1759
+
1760
+ ## [0.12.2] - 2025-12-02
1761
+
1762
+ ### Changed
1763
+
1764
+ - Removed support for gpt-4.5-preview and o3 models (not yet available)
1765
+
1766
+ ## [0.12.1] - 2025-12-02
1767
+
1768
+ ### Added
1769
+
1770
+ - **Models**: Added support for OpenAI's new models:
1771
+ - `gpt-4.1` (128K context)
1772
+ - `gpt-4.1-mini` (128K context)
1773
+ - `gpt-4.1-nano` (128K context)
1774
+ - `o3` (200K context, reasoning model)
1775
+ - `o4-mini` (200K context, reasoning model)
1776
+
1777
+ ## [0.12.0] - 2025-12-02
1778
+
1779
+ ### Added
1780
+
1781
+ - **`-p, --print` Flag**: Run in non-interactive batch mode. Processes input message or piped stdin without TUI, prints agent response directly to stdout. Ideal for scripting, piping, and CI/CD integration. Exits after first response.
1782
+ - **`-P, --print-streaming` Flag**: Like `-p`, but streams response tokens as they arrive. Use `--print-streaming --no-markdown` for raw unformatted output.
1783
+ - **`--print-turn` Flag**: Continue processing tool calls and agent turns until the agent naturally finishes or requires user input. Combine with `-p` for complete multi-turn conversations.
1784
+ - **`--no-markdown` Flag**: Output raw text without Markdown formatting. Useful when piping output to tools that expect plain text.
1785
+ - **Streaming Print Mode**: Added internal `printStreaming` option for streaming output in non-TUI mode.
1786
+ - **RPC Mode `print` Command**: Send `{"type":"print","content":"text"}` to get formatted print output via `print_output` events.
1787
+ - **Auto-Save in Print Mode**: Print mode conversations are automatically saved to the session directory, allowing later resumption with `--continue`.
1788
+ - **Thinking level options**: Added `--thinking-off`, `--thinking-minimal`, `--thinking-low`, `--thinking-medium`, `--thinking-high` flags for directly specifying thinking level without the selector UI.
1789
+
1790
+ ### Changed
1791
+
1792
+ - **Simplified RPC Protocol**: Replaced the `prompt` wrapper command with direct message objects. Send `{"role":"user","content":"text"}` instead of `{"type":"prompt","message":"text"}`. Better aligns with message format throughout the codebase.
1793
+ - **RPC Message Handling**: Agent now processes raw message objects directly, with `timestamp` auto-populated if missing.
1794
+
1795
+ ## [0.11.9] - 2025-12-02
1796
+
1797
+ ### Changed
1798
+
1799
+ - Change Ctrl+I to Ctrl+P for model cycling shortcut to avoid collision with Tab key in some terminals
1800
+
1801
+ ## [0.11.8] - 2025-12-01
1802
+
1803
+ ### Fixed
1804
+
1805
+ - Absolute glob patterns (e.g., `/Users/foo/**/*.ts`) are now handled correctly. Previously the leading `/` was being stripped, causing the pattern to be interpreted relative to the current directory.
1806
+
1807
+ ## [0.11.7] - 2025-12-01
1808
+
1809
+ ### Fixed
1810
+
1811
+ - Fix read path traversal vulnerability. Paths are now validated to prevent reading outside the working directory or its parents. The `read` tool can read from `cwd`, its ancestors (for config files), and all descendants. Symlinks are resolved before validation.
1812
+
1813
+ ## [0.11.6] - 2025-12-01
1814
+
1815
+ ### Fixed
1816
+
1817
+ - Fix `--system-prompt <path>` allowing the path argument to be captured by the message collection, causing "file not found" errors.
1818
+
1819
+ ## [0.11.5] - 2025-11-30
1820
+
1821
+ ### Fixed
1822
+
1823
+ - Fixed fatal error "Cannot set properties of undefined (setting '0')" when editing empty files in the `edit` tool.
1824
+ - Simplified `edit` tool output: Shows only "Edited file.txt" for successful edits instead of verbose search/replace details.
1825
+ - Fixed fatal error in footer rendering when token counts contain NaN values due to missing usage data.
1826
+
1827
+ ## [0.11.4] - 2025-11-30
1828
+
1829
+ ### Fixed
1830
+
1831
+ - Fixed chat rendering crash when messages contain preformatted/styled text (e.g., thinking traces with gray italic styling). The markdown renderer now preserves existing ANSI escape codes when they appear before inline elements.
1832
+
1833
+ ## [0.11.3] - 2025-11-29
1834
+
1835
+ ### Fixed
1836
+
1837
+ - Fix file drop functionality for absolute paths
1838
+
1839
+ ## [0.11.2] - 2025-11-29
1840
+
1841
+ ### Fixed
1842
+
1843
+ - Fixed TUI crash when pasting content containing tab characters. Tabs are now converted to 4 spaces before insertion.
1844
+ - Fixed terminal corruption after exit when shell integration sequences (OSC 133) appeared in bash output. These sequences are now stripped along with other ANSI codes.
1845
+
1846
+ ## [0.11.1] - 2025-11-29
1847
+
1848
+ ### Added
1849
+
1850
+ - Added `fd` integration for file path autocompletion. Now uses `fd` for faster fuzzy file search
1851
+
1852
+ ### Fixed
1853
+
1854
+ - Fixed keyboard shortcuts Ctrl+A, Ctrl+E, Ctrl+K, Ctrl+U, Ctrl+W, and word navigation (Option+Arrow) not working in VS Code integrated terminal and some other terminal emulators
1855
+
1856
+ ## [0.11.0] - 2025-11-29
1857
+
1858
+ ### Added
1859
+
1860
+ - **File-based Slash Commands**: Create custom reusable prompts as `.txt` files in `~/.pi/slash-commands/`. Files become `/filename` commands with first-line descriptions. Supports `{{selection}}` placeholder for referencing selected/attached content.
1861
+ - **`/branch` Command**: Create conversation branches from any previous user message. Opens a selector to pick a message, then creates a new session file starting from that point. Original message text is placed in the editor for modification.
1862
+ - **Unified Content References**: Both `@path` in messages and `--file path` CLI arguments now use the same attachment system with consistent MIME type detection.
1863
+ - **Drag & Drop Files**: Drop files onto the terminal to attach them to your message. Supports multiple files and both text and image content.
1864
+
1865
+ ### Changed
1866
+
1867
+ - **Model Selector with Search**: The `/model` command now opens a searchable list. Type to filter models by name, use arrows to navigate, Enter to select.
1868
+ - **Improved File Autocomplete**: File path completion after `@` now supports fuzzy matching and shows file/directory indicators.
1869
+ - **Session Selector with Search**: The `--resume` and `--session` flags now open a searchable session list with fuzzy filtering.
1870
+ - **Attachment Display**: Files added via `@path` are now shown as "Attached: filename" in the user message, separate from the prompt text.
1871
+ - **Tab Completion**: Tab key now triggers file path autocompletion anywhere in the editor, not just after `@` symbol.
1872
+
1873
+ ### Fixed
1874
+
1875
+ - Fixed autocomplete z-order issue where dropdown could appear behind chat messages
1876
+ - Fixed cursor position when navigating through wrapped lines in the editor
1877
+ - Fixed attachment handling for continued sessions to preserve file references
1878
+
1879
+ ## [0.10.6] - 2025-11-28
1880
+
1881
+ ### Changed
1882
+
1883
+ - Show base64-truncated indicator for large images in tool output
1884
+
1885
+ ### Fixed
1886
+
1887
+ - Fixed image dimensions not being read correctly from PNG/JPEG/GIF files
1888
+ - Fixed PDF images being incorrectly base64-truncated in display
1889
+ - Allow reading files from ancestor directories (needed for monorepo configs)
1890
+
1891
+ ## [0.10.5] - 2025-11-28
1892
+
1893
+ ### Added
1894
+
1895
+ - Full multimodal support: attach images (PNG, JPEG, GIF, WebP) and PDFs to prompts using `@path` syntax or `--file` flag
1896
+
1897
+ ### Fixed
1898
+
1899
+ - `@`-references now handle special characters in file names (spaces, quotes, unicode)
1900
+ - Fixed cursor positioning issues with multi-byte unicode characters in editor
1901
+
1902
+ ## [0.10.4] - 2025-11-28
1903
+
1904
+ ### Fixed
1905
+
1906
+ - Removed padding on first user message in TUI to improve visual consistency.
1907
+
1908
+ ## [0.10.3] - 2025-11-28
1909
+
1910
+ ### Added
1911
+
1912
+ - Added RPC mode (`--rpc`) for programmatic integration. Accepts JSON commands on stdin, emits JSON events on stdout. See [RPC mode documentation](https://github.com/nicobailon/pi-mono/blob/main/packages/coding-agent/README.md#rpc-mode) for protocol details.
1913
+
1914
+ ### Changed
1915
+
1916
+ - Refactored internal architecture to support multiple frontends (TUI, RPC) with shared agent logic.
1917
+
1918
+ ## [0.10.2] - 2025-11-26
1919
+
1920
+ ### Added
1921
+
1922
+ - Added thinking level persistence. Default level stored in `~/.pi/settings.json`, restored on startup. Per-session overrides saved in session files.
1923
+ - Added model cycling shortcut: `Ctrl+I` cycles through available models (or scoped models with `-m` flag).
1924
+ - Added automatic retry with exponential backoff for transient API errors (network issues, 500s, overload).
1925
+ - Cumulative token usage now shown in footer (total tokens used across all messages in session).
1926
+ - Added `--system-prompt` flag to override default system prompt with custom text or file contents.
1927
+ - Footer now shows estimated total cost in USD based on model pricing.
1928
+
1929
+ ### Changed
1930
+
1931
+ - Replaced `--models` flag with `-m/--model` supporting multiple values. Specify models as `provider/model@thinking` (e.g., `anthropic/claude-sonnet-4-20250514@high`). Multiple `-m` flags scope available models for the session.
1932
+ - Thinking level border now persists visually after selector closes.
1933
+ - Improved tool result display with collapsible output (default collapsed, expand with `Ctrl+O`).
1934
+
1935
+ ## [0.10.1] - 2025-11-25
1936
+
1937
+ ### Added
1938
+
1939
+ - Add custom model configuration via `~/.pi/models.json`
1940
+
1941
+ ## [0.10.0] - 2025-11-25
1942
+
1943
+ Initial public release.
1944
+
1945
+ ### Added
1946
+
1947
+ - Interactive TUI with streaming responses
1948
+ - Conversation session management with `--continue`, `--resume`, and `--session` flags
1949
+ - Multi-line input support (Shift+Enter or Option+Enter for new lines)
1950
+ - Tool execution: `read`, `write`, `edit`, `bash`, `glob`, `grep`, `think`
1951
+ - Thinking mode support for Claude with visual indicator and `/thinking` selector
1952
+ - File path autocompletion with `@` prefix
1953
+ - Slash command autocompletion
1954
+ - `/export` command for HTML session export
1955
+ - `/model` command for runtime model switching
1956
+ - `/session` command for session statistics
1957
+ - Model provider support: Anthropic (Claude), OpenAI, Google (Gemini)
1958
+ - Git branch display in footer
1959
+ - Message queueing during streaming responses
1960
+ - OAuth integration for Gmail and Google Calendar access
1961
+ - HTML export with syntax highlighting and collapsible sections