pi-namespace-patch 0.85.1 → 0.86.1-namespace.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (330) hide show
  1. package/CHANGELOG.md +110 -0
  2. package/README.md +26 -705
  3. package/dist/bundle/chunks/anthropic-messages-MYU5ZMRF.js +6 -0
  4. package/dist/bundle/chunks/azure-openai-responses-HUSQ3GP2.js +2 -0
  5. package/dist/bundle/chunks/bedrock-converse-stream.js +47 -38
  6. package/dist/bundle/chunks/chunk-4YJERF5N.js +2 -0
  7. package/dist/bundle/chunks/chunk-A3JYRWB6.js +2 -0
  8. package/dist/bundle/chunks/chunk-CVPNLAPW.js +1562 -0
  9. package/dist/bundle/chunks/chunk-DTD7JQ7Y.js +42 -0
  10. package/dist/bundle/chunks/chunk-FUXEF6JQ.js +44 -0
  11. package/dist/bundle/chunks/{chunk-IDDQWTHI.js → chunk-RCZIEVGO.js} +10 -1
  12. package/dist/bundle/chunks/chunk-S7SZN6Z3.js +2 -0
  13. package/dist/bundle/chunks/chunk-WIUZI2CJ.js +11 -0
  14. package/dist/bundle/chunks/github-copilot.js +1 -1
  15. package/dist/bundle/chunks/google-generative-ai-IMS5EK2Y.js +2 -0
  16. package/dist/bundle/chunks/google-vertex-O4YJEQUW.js +2 -0
  17. package/dist/bundle/chunks/jiti-loader-C3NU2SDH.js +21 -0
  18. package/dist/bundle/chunks/jiti-static-loader-E6ANQD5T.js +2 -0
  19. package/dist/bundle/chunks/meta.js +2 -0
  20. package/dist/bundle/chunks/mistral-conversations-NOSQHBEY.js +5 -0
  21. package/dist/bundle/chunks/{node-KG362ECQ.js → node-O3RIBJRH.js} +1 -1
  22. package/dist/bundle/chunks/openai-codex-responses-QDSOTBBO.js +10 -0
  23. package/dist/bundle/chunks/openai-completions-CYGM3XXP.js +7 -0
  24. package/dist/bundle/chunks/openai-responses-HWEUZ6WZ.js +2 -0
  25. package/dist/bundle/chunks/{pi-messages-PML4SPVJ.js → pi-messages-GFKBWJHZ.js} +1 -1
  26. package/dist/bundle/chunks/virtual-modules-R7YYFUSE.js +2 -0
  27. package/dist/bundle/cli-runtime.js +3 -0
  28. package/dist/bundle/cli.js +4 -2
  29. package/dist/bundle/index.js +1 -1
  30. package/dist/bundle/rpc-entry.js +1 -1
  31. package/dist/cli/args.d.ts.map +1 -1
  32. package/dist/cli/args.js +1 -0
  33. package/dist/cli/args.js.map +1 -1
  34. package/dist/cli/session-picker.d.ts +1 -1
  35. package/dist/cli/session-picker.d.ts.map +1 -1
  36. package/dist/cli/session-picker.js.map +1 -1
  37. package/dist/config.d.ts.map +1 -1
  38. package/dist/config.js +1 -1
  39. package/dist/config.js.map +1 -1
  40. package/dist/core/agent-session.d.ts +56 -6
  41. package/dist/core/agent-session.d.ts.map +1 -1
  42. package/dist/core/agent-session.js +294 -157
  43. package/dist/core/agent-session.js.map +1 -1
  44. package/dist/core/bug-report-upload.d.ts +12 -0
  45. package/dist/core/bug-report-upload.d.ts.map +1 -0
  46. package/dist/core/bug-report-upload.js +22 -0
  47. package/dist/core/bug-report-upload.js.map +1 -0
  48. package/dist/core/bug-report.d.ts +176 -0
  49. package/dist/core/bug-report.d.ts.map +1 -0
  50. package/dist/core/bug-report.js +292 -0
  51. package/dist/core/bug-report.js.map +1 -0
  52. package/dist/core/cache-stats.d.ts.map +1 -1
  53. package/dist/core/cache-stats.js +12 -1
  54. package/dist/core/cache-stats.js.map +1 -1
  55. package/dist/core/cache-warmer.d.ts +102 -0
  56. package/dist/core/cache-warmer.d.ts.map +1 -0
  57. package/dist/core/cache-warmer.js +342 -0
  58. package/dist/core/cache-warmer.js.map +1 -0
  59. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  60. package/dist/core/compaction/branch-summarization.js +2 -2
  61. package/dist/core/compaction/branch-summarization.js.map +1 -1
  62. package/dist/core/compaction/compaction.d.ts +2 -2
  63. package/dist/core/compaction/compaction.d.ts.map +1 -1
  64. package/dist/core/compaction/compaction.js +11 -12
  65. package/dist/core/compaction/compaction.js.map +1 -1
  66. package/dist/core/crash-log.d.ts +22 -0
  67. package/dist/core/crash-log.d.ts.map +1 -0
  68. package/dist/core/crash-log.js +71 -0
  69. package/dist/core/crash-log.js.map +1 -0
  70. package/dist/core/experimental.d.ts +0 -4
  71. package/dist/core/experimental.d.ts.map +1 -1
  72. package/dist/core/experimental.js +0 -4
  73. package/dist/core/experimental.js.map +1 -1
  74. package/dist/core/extensions/index.d.ts +1 -1
  75. package/dist/core/extensions/index.d.ts.map +1 -1
  76. package/dist/core/extensions/index.js.map +1 -1
  77. package/dist/core/extensions/jiti-loader.d.ts +2 -0
  78. package/dist/core/extensions/jiti-loader.d.ts.map +1 -0
  79. package/dist/core/extensions/jiti-loader.js +4 -0
  80. package/dist/core/extensions/jiti-loader.js.map +1 -0
  81. package/dist/core/extensions/jiti-static-loader.d.ts +2 -0
  82. package/dist/core/extensions/jiti-static-loader.d.ts.map +1 -0
  83. package/dist/core/extensions/jiti-static-loader.js +4 -0
  84. package/dist/core/extensions/jiti-static-loader.js.map +1 -0
  85. package/dist/core/extensions/loader.d.ts.map +1 -1
  86. package/dist/core/extensions/loader.js +38 -51
  87. package/dist/core/extensions/loader.js.map +1 -1
  88. package/dist/core/extensions/runner.d.ts +10 -7
  89. package/dist/core/extensions/runner.d.ts.map +1 -1
  90. package/dist/core/extensions/runner.js +85 -67
  91. package/dist/core/extensions/runner.js.map +1 -1
  92. package/dist/core/extensions/types.d.ts +60 -50
  93. package/dist/core/extensions/types.d.ts.map +1 -1
  94. package/dist/core/extensions/types.js.map +1 -1
  95. package/dist/core/extensions/virtual-modules.d.ts +3 -0
  96. package/dist/core/extensions/virtual-modules.d.ts.map +1 -0
  97. package/dist/core/extensions/virtual-modules.js +38 -0
  98. package/dist/core/extensions/virtual-modules.js.map +1 -0
  99. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  100. package/dist/core/extensions/wrapper.js +1 -20
  101. package/dist/core/extensions/wrapper.js.map +1 -1
  102. package/dist/core/index.d.ts +2 -1
  103. package/dist/core/index.d.ts.map +1 -1
  104. package/dist/core/index.js.map +1 -1
  105. package/dist/core/keybindings.d.ts +1 -1
  106. package/dist/core/keybindings.d.ts.map +1 -1
  107. package/dist/core/keybindings.js +1 -1
  108. package/dist/core/keybindings.js.map +1 -1
  109. package/dist/core/messages.d.ts.map +1 -1
  110. package/dist/core/messages.js +1 -0
  111. package/dist/core/messages.js.map +1 -1
  112. package/dist/core/model-config.d.ts +101 -20
  113. package/dist/core/model-config.d.ts.map +1 -1
  114. package/dist/core/model-config.js +25 -18
  115. package/dist/core/model-config.js.map +1 -1
  116. package/dist/core/model-registry.d.ts +5 -1
  117. package/dist/core/model-registry.d.ts.map +1 -1
  118. package/dist/core/model-registry.js +8 -0
  119. package/dist/core/model-registry.js.map +1 -1
  120. package/dist/core/model-resolver.d.ts.map +1 -1
  121. package/dist/core/model-resolver.js +2 -1
  122. package/dist/core/model-resolver.js.map +1 -1
  123. package/dist/core/model-runtime.d.ts.map +1 -1
  124. package/dist/core/model-runtime.js +5 -3
  125. package/dist/core/model-runtime.js.map +1 -1
  126. package/dist/core/provider-composer.d.ts +3 -2
  127. package/dist/core/provider-composer.d.ts.map +1 -1
  128. package/dist/core/provider-composer.js +2 -0
  129. package/dist/core/provider-composer.js.map +1 -1
  130. package/dist/core/radius.d.ts +3 -0
  131. package/dist/core/radius.d.ts.map +1 -1
  132. package/dist/core/radius.js +6 -0
  133. package/dist/core/radius.js.map +1 -1
  134. package/dist/core/sdk.d.ts.map +1 -1
  135. package/dist/core/sdk.js +60 -38
  136. package/dist/core/sdk.js.map +1 -1
  137. package/dist/core/session-export.d.ts +6 -2
  138. package/dist/core/session-export.d.ts.map +1 -1
  139. package/dist/core/session-export.js +14 -13
  140. package/dist/core/session-export.js.map +1 -1
  141. package/dist/core/session-manager.d.ts +29 -6
  142. package/dist/core/session-manager.d.ts.map +1 -1
  143. package/dist/core/session-manager.js +159 -96
  144. package/dist/core/session-manager.js.map +1 -1
  145. package/dist/core/settings-manager.d.ts +20 -4
  146. package/dist/core/settings-manager.d.ts.map +1 -1
  147. package/dist/core/settings-manager.js +43 -7
  148. package/dist/core/settings-manager.js.map +1 -1
  149. package/dist/core/slash-commands.d.ts.map +1 -1
  150. package/dist/core/slash-commands.js +1 -0
  151. package/dist/core/slash-commands.js.map +1 -1
  152. package/dist/core/system-prompt.d.ts +49 -6
  153. package/dist/core/system-prompt.d.ts.map +1 -1
  154. package/dist/core/system-prompt.js +121 -92
  155. package/dist/core/system-prompt.js.map +1 -1
  156. package/dist/core/tools/bash.d.ts +2 -1
  157. package/dist/core/tools/bash.d.ts.map +1 -1
  158. package/dist/core/tools/bash.js +10 -4
  159. package/dist/core/tools/bash.js.map +1 -1
  160. package/dist/core/tools/edit.d.ts.map +1 -1
  161. package/dist/core/tools/edit.js +1 -2
  162. package/dist/core/tools/edit.js.map +1 -1
  163. package/dist/core/tools/read.d.ts.map +1 -1
  164. package/dist/core/tools/read.js +1 -2
  165. package/dist/core/tools/read.js.map +1 -1
  166. package/dist/core/tools/renderers/bash.d.ts.map +1 -1
  167. package/dist/core/tools/renderers/bash.js +9 -1
  168. package/dist/core/tools/renderers/bash.js.map +1 -1
  169. package/dist/core/tools/write.d.ts.map +1 -1
  170. package/dist/core/tools/write.js +1 -2
  171. package/dist/core/tools/write.js.map +1 -1
  172. package/dist/core/usage-totals.d.ts +1 -1
  173. package/dist/core/usage-totals.d.ts.map +1 -1
  174. package/dist/core/usage-totals.js +5 -1
  175. package/dist/core/usage-totals.js.map +1 -1
  176. package/dist/extensions/llama/client.d.ts +2 -0
  177. package/dist/extensions/llama/client.d.ts.map +1 -1
  178. package/dist/extensions/llama/client.js +7 -3
  179. package/dist/extensions/llama/client.js.map +1 -1
  180. package/dist/extensions/llama/provider.d.ts.map +1 -1
  181. package/dist/extensions/llama/provider.js +20 -5
  182. package/dist/extensions/llama/provider.js.map +1 -1
  183. package/dist/index.d.ts +3 -2
  184. package/dist/index.d.ts.map +1 -1
  185. package/dist/index.js.map +1 -1
  186. package/dist/main.d.ts.map +1 -1
  187. package/dist/main.js +13 -9
  188. package/dist/main.js.map +1 -1
  189. package/dist/migrations.d.ts.map +1 -1
  190. package/dist/migrations.js +2 -2
  191. package/dist/migrations.js.map +1 -1
  192. package/dist/modes/interactive/bug-report.d.ts +16 -0
  193. package/dist/modes/interactive/bug-report.d.ts.map +1 -0
  194. package/dist/modes/interactive/bug-report.js +206 -0
  195. package/dist/modes/interactive/bug-report.js.map +1 -0
  196. package/dist/modes/interactive/chat-viewport.d.ts.map +1 -1
  197. package/dist/modes/interactive/chat-viewport.js +1 -1
  198. package/dist/modes/interactive/chat-viewport.js.map +1 -1
  199. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  200. package/dist/modes/interactive/components/branch-summary-message.js +12 -5
  201. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  202. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  203. package/dist/modes/interactive/components/compaction-summary-message.js +12 -5
  204. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  205. package/dist/modes/interactive/components/custom-editor.d.ts +3 -3
  206. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  207. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  208. package/dist/modes/interactive/components/extension-editor.d.ts +4 -1
  209. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  210. package/dist/modes/interactive/components/extension-editor.js +7 -2
  211. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  212. package/dist/modes/interactive/components/extension-input.d.ts +2 -0
  213. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  214. package/dist/modes/interactive/components/extension-input.js +6 -0
  215. package/dist/modes/interactive/components/extension-input.js.map +1 -1
  216. package/dist/modes/interactive/components/extension-selector.d.ts +1 -0
  217. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  218. package/dist/modes/interactive/components/extension-selector.js +4 -0
  219. package/dist/modes/interactive/components/extension-selector.js.map +1 -1
  220. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  221. package/dist/modes/interactive/components/footer.js +4 -1
  222. package/dist/modes/interactive/components/footer.js.map +1 -1
  223. package/dist/modes/interactive/components/session-selector.d.ts +5 -5
  224. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  225. package/dist/modes/interactive/components/session-selector.js +74 -48
  226. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  227. package/dist/modes/interactive/components/settings-selector.d.ts +3 -1
  228. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  229. package/dist/modes/interactive/components/settings-selector.js +11 -0
  230. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  231. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  232. package/dist/modes/interactive/components/skill-invocation-message.js +11 -4
  233. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  234. package/dist/modes/interactive/components/status-indicator.d.ts +2 -2
  235. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
  236. package/dist/modes/interactive/components/status-indicator.js +7 -7
  237. package/dist/modes/interactive/components/status-indicator.js.map +1 -1
  238. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  239. package/dist/modes/interactive/components/tool-execution.js +18 -9
  240. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  241. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  242. package/dist/modes/interactive/components/tree-selector.js +2 -0
  243. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  244. package/dist/modes/interactive/interactive-mode.d.ts +15 -2
  245. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  246. package/dist/modes/interactive/interactive-mode.js +227 -84
  247. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  248. package/dist/modes/interactive/session-share.d.ts +2 -0
  249. package/dist/modes/interactive/session-share.d.ts.map +1 -1
  250. package/dist/modes/interactive/session-share.js +8 -4
  251. package/dist/modes/interactive/session-share.js.map +1 -1
  252. package/dist/modes/interactive/tui-renderer.d.ts.map +1 -1
  253. package/dist/modes/interactive/tui-renderer.js +2 -2
  254. package/dist/modes/interactive/tui-renderer.js.map +1 -1
  255. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  256. package/dist/modes/rpc/rpc-mode.js +2 -2
  257. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  258. package/dist/utils/clipboard-command.d.ts +7 -0
  259. package/dist/utils/clipboard-command.d.ts.map +1 -0
  260. package/dist/utils/clipboard-command.js +45 -0
  261. package/dist/utils/clipboard-command.js.map +1 -0
  262. package/dist/utils/clipboard-image.d.ts.map +1 -1
  263. package/dist/utils/clipboard-image.js +53 -81
  264. package/dist/utils/clipboard-image.js.map +1 -1
  265. package/dist/utils/clipboard.d.ts.map +1 -1
  266. package/dist/utils/clipboard.js +111 -121
  267. package/dist/utils/clipboard.js.map +1 -1
  268. package/dist/utils/version-check.d.ts.map +1 -1
  269. package/dist/utils/version-check.js +11 -4
  270. package/dist/utils/version-check.js.map +1 -1
  271. package/dist/utils/wsl.d.ts +3 -0
  272. package/dist/utils/wsl.d.ts.map +1 -0
  273. package/dist/utils/wsl.js +15 -0
  274. package/dist/utils/wsl.js.map +1 -0
  275. package/dist/utils/zip.d.ts +7 -0
  276. package/dist/utils/zip.d.ts.map +1 -0
  277. package/dist/utils/zip.js +60 -0
  278. package/dist/utils/zip.js.map +1 -0
  279. package/docs/compaction.md +39 -13
  280. package/docs/custom-provider.md +22 -13
  281. package/docs/development.md +4 -4
  282. package/docs/docs.json +4 -0
  283. package/docs/environment-variables.md +1 -0
  284. package/docs/extensions.md +57 -43
  285. package/docs/json.md +4 -4
  286. package/docs/models.md +33 -2
  287. package/docs/providers.md +10 -2
  288. package/docs/sdk.md +4 -2
  289. package/docs/security.md +1 -1
  290. package/docs/session-format.md +82 -40
  291. package/docs/sessions.md +27 -0
  292. package/docs/settings.md +60 -1
  293. package/docs/termux.md +0 -1
  294. package/docs/tui.md +2 -2
  295. package/docs/usage.md +1 -0
  296. package/examples/extensions/README.md +0 -1
  297. package/examples/extensions/custom-provider-anthropic/index.ts +18 -12
  298. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  299. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  300. package/examples/extensions/custom-provider-gitlab-duo/index.ts +2 -2
  301. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  302. package/examples/extensions/gondolin/package-lock.json +2 -2
  303. package/examples/extensions/gondolin/package.json +1 -1
  304. package/examples/extensions/prompt-customizer.ts +19 -67
  305. package/examples/extensions/sandbox/package-lock.json +2 -2
  306. package/examples/extensions/sandbox/package.json +1 -1
  307. package/examples/extensions/with-deps/package-lock.json +2 -2
  308. package/examples/extensions/with-deps/package.json +1 -1
  309. package/npm-shrinkwrap.json +435 -762
  310. package/package.json +17 -23
  311. package/dist/bundle/chunks/anthropic-messages-VWZZOSJQ.js +0 -6
  312. package/dist/bundle/chunks/azure-openai-responses-BJLAM6CD.js +0 -2
  313. package/dist/bundle/chunks/chunk-AXIIZGTV.js +0 -2
  314. package/dist/bundle/chunks/chunk-CLNPYIDP.js +0 -42
  315. package/dist/bundle/chunks/chunk-GMWCTUPB.js +0 -2
  316. package/dist/bundle/chunks/chunk-JJ2YFCJF.js +0 -1547
  317. package/dist/bundle/chunks/chunk-OUXLLA64.js +0 -11
  318. package/dist/bundle/chunks/chunk-U6ZMQKGD.js +0 -50
  319. package/dist/bundle/chunks/chunk-UAQELI3K.js +0 -2
  320. package/dist/bundle/chunks/google-generative-ai-Q2K7FBDI.js +0 -2
  321. package/dist/bundle/chunks/google-vertex-7UJBF4S7.js +0 -2
  322. package/dist/bundle/chunks/mistral-conversations-4M6BZBX6.js +0 -5
  323. package/dist/bundle/chunks/openai-codex-responses-R6VYZTVY.js +0 -10
  324. package/dist/bundle/chunks/openai-completions-EKZT2IH2.js +0 -7
  325. package/dist/bundle/chunks/openai-responses-TFDINO6W.js +0 -2
  326. package/dist/utils/clipboard-native.d.ts +0 -11
  327. package/dist/utils/clipboard-native.d.ts.map +0 -1
  328. package/dist/utils/clipboard-native.js +0 -20
  329. package/dist/utils/clipboard-native.js.map +0 -1
  330. package/examples/extensions/kimi-deferred-tools.ts +0 -61
package/docs/tui.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Extensions and custom tools can render custom TUI components for interactive user interfaces. This page covers the component system and available building blocks.
6
6
 
7
- **Source:** [`@earendil-works/pi-tui`](https://github.com/earendil-works/pi-mono/tree/main/packages/tui)
7
+ **Source:** [`@earendil-works/pi-tui`](https://github.com/earendil-works/pi/tree/main/packages/tui)
8
8
 
9
9
  ## Component Interface
10
10
 
@@ -930,7 +930,7 @@ export default function (pi: ExtensionAPI) {
930
930
 
931
931
  - **Extend `CustomEditor`** (not base `Editor`) to get app keybindings (escape to abort, ctrl+d to exit, model switching, etc.)
932
932
  - **Call `super.handleInput(data)`** for keys you don't handle
933
- - **Working status**: custom editors keep the standalone working row by default. Pass `{ embedWorkingStatus: true }` as the fourth `CustomEditor` constructor argument to use the built-in editor-border spinner instead.
933
+ - **Status spinners**: custom editors keep standalone status rows by default. Pass `{ embedWorkingStatus: true }` as the fourth `CustomEditor` constructor argument to embed working, compaction, branch summarization, and retry spinners in the editor border instead.
934
934
  - **Factory pattern**: `setEditorComponent` receives a factory function that gets `tui`, `theme`, and `keybindings`
935
935
  - **Pass `undefined`** to restore the default editor: `ctx.ui.setEditorComponent(undefined)`
936
936
 
package/docs/usage.md CHANGED
@@ -55,6 +55,7 @@ Type `/` in the editor to open command completion. Extensions can register custo
55
55
  | `/export [file]` | Export session to HTML or JSONL |
56
56
  | `/import <file>` | Import and resume a session from a JSONL file |
57
57
  | `/share` | Upload as private GitHub gist with shareable HTML link |
58
+ | `/bug [description]` | Report a bug to the Pi developers; see [Sessions](sessions.md#reporting-bugs) |
58
59
  | `/reload` | Reload keybindings, extensions, skills, prompts, themes, and context files |
59
60
  | `/hotkeys` | Show all keyboard shortcuts |
60
61
  | `/changelog` | Display version history |
@@ -36,7 +36,6 @@ cp permission-gate.ts ~/.pi/agent/extensions/
36
36
  | `questionnaire.ts` | Multi-question input with tab bar navigation between questions |
37
37
  | `tool-override.ts` | Override built-in tools (e.g., add logging/access control to `read`) |
38
38
  | `dynamic-tools.ts` | Register tools after startup (`session_start`) and at runtime via command, with prompt snippets and tool-specific prompt guidelines |
39
- | `kimi-deferred-tools.ts` | Search for and progressively activate tools for Kimi's deferred-tool loading protocol |
40
39
  | `structured-output.ts` | Final structured-output tool that returns `terminate: true` so the agent can end on the tool call |
41
40
  | `built-in-tool-renderer.ts` | Custom compact rendering for built-in tools (read, bash, edit, write) while keeping original behavior |
42
41
  | `minimal-mode.ts` | Override built-in tool rendering for minimal display (only tool calls, no output in collapsed mode) |
@@ -27,9 +27,11 @@ import {
27
27
  type Api,
28
28
  type AssistantMessage,
29
29
  type AssistantMessageEventStream,
30
- type Context,
31
30
  calculateCost,
31
+ collapseSystemMessages,
32
32
  createAssistantMessageEventStream,
33
+ getCurrentSystemPrompt,
34
+ getCurrentTools,
33
35
  type ImageContent,
34
36
  type Message,
35
37
  type Model,
@@ -42,6 +44,7 @@ import {
42
44
  type Tool,
43
45
  type ToolCall,
44
46
  type ToolResultMessage,
47
+ type TranscriptContext,
45
48
  } from "@earendil-works/pi-ai";
46
49
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
47
50
 
@@ -334,10 +337,15 @@ function mapStopReason(reason: string): StopReason {
334
337
 
335
338
  function streamCustomAnthropic(
336
339
  model: Model<Api>,
337
- context: Context,
340
+ context: TranscriptContext,
338
341
  options?: SimpleStreamOptions,
339
342
  ): AssistantMessageEventStream {
340
343
  const stream = createAssistantMessageEventStream();
344
+ // The transcript carries the prompt and tools in its system messages. This provider sends
345
+ // one top-level system prompt, so fold later system messages into the leading one first.
346
+ const transcript = collapseSystemMessages(context);
347
+ const systemPrompt = getCurrentSystemPrompt(transcript.messages);
348
+ const tools = getCurrentTools(transcript.messages);
341
349
 
342
350
  (async () => {
343
351
  const output: AssistantMessage = {
@@ -393,7 +401,7 @@ function streamCustomAnthropic(
393
401
  // Build request params
394
402
  const params: MessageCreateParamsStreaming = {
395
403
  model: model.id,
396
- messages: convertMessages(context.messages, isOAuth, context.tools),
404
+ messages: convertMessages(transcript.messages, isOAuth, tools),
397
405
  max_tokens: options?.maxTokens || Math.floor(model.maxTokens / 3),
398
406
  stream: true,
399
407
  };
@@ -407,25 +415,25 @@ function streamCustomAnthropic(
407
415
  cache_control: { type: "ephemeral" },
408
416
  },
409
417
  ];
410
- if (context.systemPrompt) {
418
+ if (systemPrompt) {
411
419
  params.system.push({
412
420
  type: "text",
413
- text: sanitizeSurrogates(context.systemPrompt),
421
+ text: sanitizeSurrogates(systemPrompt),
414
422
  cache_control: { type: "ephemeral" },
415
423
  });
416
424
  }
417
- } else if (context.systemPrompt) {
425
+ } else if (systemPrompt) {
418
426
  params.system = [
419
427
  {
420
428
  type: "text",
421
- text: sanitizeSurrogates(context.systemPrompt),
429
+ text: sanitizeSurrogates(systemPrompt),
422
430
  cache_control: { type: "ephemeral" },
423
431
  },
424
432
  ];
425
433
  }
426
434
 
427
- if (context.tools) {
428
- params.tools = convertTools(context.tools, isOAuth);
435
+ if (tools.length > 0) {
436
+ params.tools = convertTools(tools, isOAuth);
429
437
  }
430
438
 
431
439
  // Handle thinking/reasoning
@@ -474,9 +482,7 @@ function streamCustomAnthropic(
474
482
  output.content.push({
475
483
  type: "toolCall",
476
484
  id: event.content_block.id,
477
- name: isOAuth
478
- ? fromClaudeCodeName(event.content_block.name, context.tools)
479
- : event.content_block.name,
485
+ name: isOAuth ? fromClaudeCodeName(event.content_block.name, tools) : event.content_block.name,
480
486
  arguments: {},
481
487
  partialJson: "",
482
488
  index: event.index,
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider",
3
- "version": "0.85.1",
3
+ "version": "0.86.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-custom-provider",
9
- "version": "0.85.1",
9
+ "version": "0.86.1",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sdk": "^0.52.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-anthropic",
3
3
  "private": true,
4
- "version": "0.85.1",
4
+ "version": "0.86.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -13,7 +13,6 @@ import {
13
13
  type Api,
14
14
  type AssistantMessageEventStream,
15
15
  anthropicMessagesApi,
16
- type Context,
17
16
  createAssistantMessageEventStream,
18
17
  type Model,
19
18
  type OAuthCredentials,
@@ -21,6 +20,7 @@ import {
21
20
  openAIResponsesApi,
22
21
  type SimpleStreamOptions,
23
22
  type ThinkingLevelMap,
23
+ type TranscriptContext,
24
24
  } from "@earendil-works/pi-ai/compat";
25
25
  import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
26
26
 
@@ -306,7 +306,7 @@ async function refreshGitLabToken(credentials: OAuthCredentials, signal: AbortSi
306
306
 
307
307
  export function streamGitLabDuo(
308
308
  model: Model<Api>,
309
- context: Context,
309
+ context: TranscriptContext,
310
310
  options?: SimpleStreamOptions,
311
311
  ): AssistantMessageEventStream {
312
312
  const stream = createAssistantMessageEventStream();
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-custom-provider-gitlab-duo",
3
3
  "private": true,
4
- "version": "0.85.1",
4
+ "version": "0.86.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-gondolin",
3
- "version": "0.85.1",
3
+ "version": "0.86.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-gondolin",
9
- "version": "0.85.1",
9
+ "version": "0.86.1",
10
10
  "dependencies": {
11
11
  "@earendil-works/gondolin": "0.12.0"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-gondolin",
3
3
  "private": true,
4
- "version": "0.85.1",
4
+ "version": "0.86.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,11 +1,8 @@
1
1
  /**
2
2
  * Prompt Customizer Extension
3
3
  *
4
- * Demonstrates using systemPromptOptions to make informed, context-aware
5
- * modifications to the system prompt without re-discovering resources.
6
- *
7
- * This extension adds tool-specific guidance based on what tools and skills
8
- * are currently active, respecting whatever the user has configured.
4
+ * Demonstrates using systemPromptOptions to add context-aware prompt sections
5
+ * without replacing or reparsing the complete rendered prompt.
9
6
  *
10
7
  * Usage:
11
8
  * 1. Copy this file to ~/.pi/agent/extensions/ or your project's .pi/extensions/
@@ -14,84 +11,39 @@
14
11
 
15
12
  import type { BuildSystemPromptOptions, ExtensionAPI } from "@earendil-works/pi-coding-agent";
16
13
 
17
- /**
18
- * Adds tool-specific guidance that adapts to the active tool set.
19
- * Instead of appending one-size-fits-all instructions, this reads what's
20
- * actually loaded and tailors the guidance accordingly.
21
- */
22
- function addToolGuidance(options: BuildSystemPromptOptions, basePrompt: string): string {
14
+ function buildToolGuidance(options: BuildSystemPromptOptions): string {
23
15
  const hasTool = (name: string) => options.selectedTools?.includes(name) ?? false;
24
-
25
- const parts: string[] = [];
16
+ const rules: string[] = [];
26
17
 
27
18
  if (hasTool("read")) {
28
- parts.push(
29
- "• Use the `read` tool for file contents (supports text and images).",
30
- " - For large files, use `offset` and `limit` to read in chunks.",
19
+ rules.push(
20
+ "- Use `read` for file contents; it supports text and images.",
21
+ "- For large files, use `offset` and `limit` to read in chunks.",
31
22
  );
32
23
  }
33
-
34
24
  if (hasTool("bash")) {
35
- parts.push("• Execute commands with the `bash` tool. Use it for file operations like `ls`, `find`, `grep`.");
25
+ rules.push("- Use `bash` for file operations such as `ls`, `find`, and `grep`.");
36
26
  }
37
-
38
27
  if (hasTool("edit")) {
39
- parts.push(
40
- "• Use the `edit` tool for precise text replacements in files. Match exact content including whitespace.",
41
- );
28
+ rules.push("- Use `edit` for precise text replacements that match existing content exactly.");
42
29
  }
43
-
44
30
  if (hasTool("write")) {
45
- parts.push("• Use the `write` tool to create new files or overwrite existing ones completely.");
31
+ rules.push("- Use `write` to create new files or replace existing files completely.");
46
32
  }
47
-
48
33
  if (options.skills && options.skills.length > 0) {
49
- const skillNames = options.skills.map((s) => s.name).join(", ");
50
- parts.push(`\nAvailable skills: ${skillNames}`, "Use skill documentation for best practices on specific tools.");
34
+ rules.push(`- Available skills: ${options.skills.map((skill) => skill.name).join(", ")}.`);
51
35
  }
52
36
 
53
- if (parts.length === 0) {
54
- return basePrompt;
55
- }
56
-
57
- return `${basePrompt}
58
-
59
- ## Tool Guidance
60
-
61
- ${parts.join("\n")}
62
- `;
63
- }
64
-
65
- /**
66
- * Merges extension instructions with user-provided append prompts.
67
- * This respects whatever the user configured via --append-system-prompt
68
- * flags or files, rather than duplicating that work.
69
- */
70
- function mergeWithUserAppend(options: BuildSystemPromptOptions): string {
71
- const userAppend = options.appendSystemPrompt;
72
- const extensionSpecific = `
73
- ## Extension-Added Context
74
-
75
- This prompt includes tool guidance and skill information loaded dynamically.
76
- If you have additional requirements, configure them via --append-system-prompt or project context files.
77
- `;
78
-
79
- if (userAppend) {
80
- return `${userAppend}\n\n${extensionSpecific}`;
81
- }
82
-
83
- return extensionSpecific;
37
+ return rules.join("\n");
84
38
  }
85
39
 
86
40
  export default function promptCustomizer(pi: ExtensionAPI) {
87
- pi.on("before_agent_start", async (event) => {
88
- const { systemPrompt, systemPromptOptions } = event;
89
-
90
- const customPrompt = addToolGuidance(systemPromptOptions, systemPrompt);
91
- const appendSection = mergeWithUserAppend(systemPromptOptions);
92
-
93
- return {
94
- systemPrompt: `${customPrompt}${appendSection}`,
95
- };
41
+ pi.on("before_agent_start", (event) => {
42
+ const guidance = buildToolGuidance(event.systemPromptOptions);
43
+ if (guidance) {
44
+ event.systemPromptOptions.sections.tool_guidance = guidance;
45
+ } else {
46
+ delete event.systemPromptOptions.sections.tool_guidance;
47
+ }
96
48
  });
97
49
  }
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-sandbox",
3
- "version": "1.15.1",
3
+ "version": "1.16.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-sandbox",
9
- "version": "1.15.1",
9
+ "version": "1.16.1",
10
10
  "dependencies": {
11
11
  "@anthropic-ai/sandbox-runtime": "^0.0.26"
12
12
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-sandbox",
3
3
  "private": true,
4
- "version": "1.15.1",
4
+ "version": "1.16.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
- "version": "0.85.1",
3
+ "version": "0.86.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "pi-extension-with-deps",
9
- "version": "0.85.1",
9
+ "version": "0.86.1",
10
10
  "dependencies": {
11
11
  "ms": "^2.1.3"
12
12
  },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-extension-with-deps",
3
3
  "private": true,
4
- "version": "0.85.1",
4
+ "version": "0.86.1",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "clean": "echo 'nothing to clean'",