@astralyn/pi 0.99.0 → 1.0.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 (569) hide show
  1. package/CHANGELOG.md +58 -3
  2. package/dist/bundle/chunks/anthropic-messages-YET4T7BO.js +6 -0
  3. package/dist/bundle/chunks/anthropic.js +2 -2
  4. package/dist/bundle/chunks/azure-openai-responses-SBLL5YN3.js +2 -0
  5. package/dist/bundle/chunks/bedrock-converse-stream.js +3 -3
  6. package/dist/bundle/chunks/chunk-4TT2QGFL.js +2 -0
  7. package/dist/bundle/chunks/chunk-GIG5IHES.js +2 -0
  8. package/dist/bundle/chunks/{chunk-VW2P3X6P.js → chunk-H2N2THAO.js} +436 -668
  9. package/dist/bundle/chunks/{chunk-A576H74Y.js → chunk-IZ3S3GDX.js} +1 -1
  10. package/dist/bundle/chunks/{chunk-ABVRAYXT.js → chunk-NY3CWK44.js} +2 -2
  11. package/dist/bundle/chunks/chunk-SVJ7OGEB.js +2 -0
  12. package/dist/bundle/chunks/chunk-TRHTWM3C.js +2 -0
  13. package/dist/bundle/chunks/{chunk-DEWXBB6W.js → chunk-V66VGGOM.js} +1 -1
  14. package/dist/bundle/chunks/chunk-XDYM2567.js +20 -0
  15. package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-ZYSAFXXL.js → cloudflare-workers-ai-system-one-QI46LUZ6.js} +1 -1
  16. package/dist/bundle/chunks/codemode-worker.js +90 -10
  17. package/dist/bundle/chunks/github-copilot.js +1 -1
  18. package/dist/bundle/chunks/{google-generative-ai-SDNQVVXA.js → google-generative-ai-YTZCSHQN.js} +1 -1
  19. package/dist/bundle/chunks/{google-vertex-LZXOLBIO.js → google-vertex-OTFZJJXQ.js} +1 -1
  20. package/dist/bundle/chunks/{llama-cpp-classify-7IYGGPND.js → llama-cpp-classify-R7DQLTQN.js} +1 -1
  21. package/dist/bundle/chunks/{mistral-conversations-VYKPSSAM.js → mistral-conversations-ELH4V4TY.js} +1 -1
  22. package/dist/bundle/chunks/node-USQQ7C6M.js +16 -0
  23. package/dist/bundle/chunks/openai-chatgpt.js +2 -2
  24. package/dist/bundle/chunks/{openai-codex-responses-HZ4VUDXD.js → openai-codex-responses-OLVTU4UA.js} +1 -1
  25. package/dist/bundle/chunks/openai-codex.js +1 -1
  26. package/dist/bundle/chunks/openai-completions-53M2KJ67.js +7 -0
  27. package/dist/bundle/chunks/openai-responses-4ABDEL4Z.js +3 -0
  28. package/dist/bundle/chunks/{openrouter-images-5524IQHX.js → openrouter-images-YP3YVB54.js} +1 -1
  29. package/dist/bundle/chunks/openrouter.js +1 -1
  30. package/dist/bundle/chunks/radius.js +1 -1
  31. package/dist/bundle/chunks/{typesafe-system-one-Z2CDLKEY.js → typesafe-system-one-RREJAKWB.js} +1 -1
  32. package/dist/bundle/chunks/virtual-modules-YFKU7JZF.js +2 -0
  33. package/dist/bundle/cli.js +1 -1
  34. package/dist/bundle/index.js +1 -1
  35. package/dist/bundle/rpc-entry.js +1 -1
  36. package/dist/cli/args.d.ts.map +1 -1
  37. package/dist/cli/args.js +5 -2
  38. package/dist/cli/args.js.map +1 -1
  39. package/dist/config.d.ts +5 -8
  40. package/dist/config.d.ts.map +1 -1
  41. package/dist/config.js +19 -13
  42. package/dist/config.js.map +1 -1
  43. package/dist/core/agent-session.d.ts +21 -1
  44. package/dist/core/agent-session.d.ts.map +1 -1
  45. package/dist/core/agent-session.js +65 -12
  46. package/dist/core/agent-session.js.map +1 -1
  47. package/dist/core/export-html/tool-renderer.d.ts +3 -3
  48. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  49. package/dist/core/export-html/tool-renderer.js +3 -3
  50. package/dist/core/export-html/tool-renderer.js.map +1 -1
  51. package/dist/core/extensions/index.d.ts +2 -2
  52. package/dist/core/extensions/index.d.ts.map +1 -1
  53. package/dist/core/extensions/index.js.map +1 -1
  54. package/dist/core/extensions/loader.d.ts.map +1 -1
  55. package/dist/core/extensions/loader.js +18 -1
  56. package/dist/core/extensions/loader.js.map +1 -1
  57. package/dist/core/extensions/runner.d.ts +3 -1
  58. package/dist/core/extensions/runner.d.ts.map +1 -1
  59. package/dist/core/extensions/runner.js +6 -0
  60. package/dist/core/extensions/runner.js.map +1 -1
  61. package/dist/core/extensions/types.d.ts +15 -1
  62. package/dist/core/extensions/types.d.ts.map +1 -1
  63. package/dist/core/extensions/types.js.map +1 -1
  64. package/dist/core/keybindings.d.ts +51 -11
  65. package/dist/core/keybindings.d.ts.map +1 -1
  66. package/dist/core/keybindings.js +11 -3
  67. package/dist/core/keybindings.js.map +1 -1
  68. package/dist/core/mcp-servers.d.ts +40 -7
  69. package/dist/core/mcp-servers.d.ts.map +1 -1
  70. package/dist/core/mcp-servers.js +63 -11
  71. package/dist/core/mcp-servers.js.map +1 -1
  72. package/dist/core/model-config.d.ts +36 -0
  73. package/dist/core/model-config.d.ts.map +1 -1
  74. package/dist/core/model-config.js +14 -2
  75. package/dist/core/model-config.js.map +1 -1
  76. package/dist/core/model-registry.d.ts +3 -1
  77. package/dist/core/model-registry.d.ts.map +1 -1
  78. package/dist/core/model-registry.js +4 -0
  79. package/dist/core/model-registry.js.map +1 -1
  80. package/dist/core/model-resolver.js +1 -1
  81. package/dist/core/model-resolver.js.map +1 -1
  82. package/dist/core/model-runtime.d.ts +6 -0
  83. package/dist/core/model-runtime.d.ts.map +1 -1
  84. package/dist/core/model-runtime.js +22 -18
  85. package/dist/core/model-runtime.js.map +1 -1
  86. package/dist/core/provider-composer.d.ts +2 -1
  87. package/dist/core/provider-composer.d.ts.map +1 -1
  88. package/dist/core/provider-composer.js +13 -0
  89. package/dist/core/provider-composer.js.map +1 -1
  90. package/dist/core/radius.d.ts +2 -0
  91. package/dist/core/radius.d.ts.map +1 -1
  92. package/dist/core/radius.js +2 -0
  93. package/dist/core/radius.js.map +1 -1
  94. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  95. package/dist/core/remote-catalog-provider.js +4 -9
  96. package/dist/core/remote-catalog-provider.js.map +1 -1
  97. package/dist/core/sdk.d.ts.map +1 -1
  98. package/dist/core/sdk.js +1 -0
  99. package/dist/core/sdk.js.map +1 -1
  100. package/dist/core/settings-manager.d.ts +7 -5
  101. package/dist/core/settings-manager.d.ts.map +1 -1
  102. package/dist/core/settings-manager.js +2 -1
  103. package/dist/core/settings-manager.js.map +1 -1
  104. package/dist/core/system-prompt.js +1 -1
  105. package/dist/core/system-prompt.js.map +1 -1
  106. package/dist/core/tasks/format.d.ts +7 -0
  107. package/dist/core/tasks/format.d.ts.map +1 -0
  108. package/dist/core/tasks/format.js +14 -0
  109. package/dist/core/tasks/format.js.map +1 -0
  110. package/dist/core/tasks/history.d.ts.map +1 -1
  111. package/dist/core/tasks/history.js +0 -19
  112. package/dist/core/tasks/history.js.map +1 -1
  113. package/dist/core/tasks/output.d.ts +8 -0
  114. package/dist/core/tasks/output.d.ts.map +1 -1
  115. package/dist/core/tasks/output.js +19 -0
  116. package/dist/core/tasks/output.js.map +1 -1
  117. package/dist/core/tasks/presentation.d.ts +1 -3
  118. package/dist/core/tasks/presentation.d.ts.map +1 -1
  119. package/dist/core/tasks/presentation.js +79 -166
  120. package/dist/core/tasks/presentation.js.map +1 -1
  121. package/dist/core/tasks/runtime.d.ts +16 -9
  122. package/dist/core/tasks/runtime.d.ts.map +1 -1
  123. package/dist/core/tasks/runtime.js +89 -106
  124. package/dist/core/tasks/runtime.js.map +1 -1
  125. package/dist/core/tasks/session.d.ts.map +1 -1
  126. package/dist/core/tasks/session.js +13 -4
  127. package/dist/core/tasks/session.js.map +1 -1
  128. package/dist/core/tasks/store.d.ts +20 -6
  129. package/dist/core/tasks/store.d.ts.map +1 -1
  130. package/dist/core/tasks/store.js +45 -18
  131. package/dist/core/tasks/store.js.map +1 -1
  132. package/dist/core/tasks/types.d.ts +14 -54
  133. package/dist/core/tasks/types.d.ts.map +1 -1
  134. package/dist/core/tasks/types.js +1 -5
  135. package/dist/core/tasks/types.js.map +1 -1
  136. package/dist/core/tools/renderers/bash.d.ts.map +1 -1
  137. package/dist/core/tools/renderers/bash.js +11 -34
  138. package/dist/core/tools/renderers/bash.js.map +1 -1
  139. package/dist/core/tools/renderers/index.d.ts +2 -2
  140. package/dist/core/tools/renderers/index.d.ts.map +1 -1
  141. package/dist/core/tools/renderers/index.js.map +1 -1
  142. package/dist/core/tools/shell-execution.d.ts +0 -1
  143. package/dist/core/tools/shell-execution.d.ts.map +1 -1
  144. package/dist/core/tools/shell-execution.js +3 -10
  145. package/dist/core/tools/shell-execution.js.map +1 -1
  146. package/dist/core/tools/shell-tool.d.ts.map +1 -1
  147. package/dist/core/tools/shell-tool.js +2 -4
  148. package/dist/core/tools/shell-tool.js.map +1 -1
  149. package/dist/core/tools/tasks/actions.d.ts +1 -1
  150. package/dist/core/tools/tasks/actions.d.ts.map +1 -1
  151. package/dist/core/tools/tasks/actions.js +26 -12
  152. package/dist/core/tools/tasks/actions.js.map +1 -1
  153. package/dist/core/tools/tasks/constants.d.ts +2 -6
  154. package/dist/core/tools/tasks/constants.d.ts.map +1 -1
  155. package/dist/core/tools/tasks/constants.js +2 -6
  156. package/dist/core/tools/tasks/constants.js.map +1 -1
  157. package/dist/core/tools/tasks/schema.d.ts +1 -1
  158. package/dist/core/tools/tasks/schema.d.ts.map +1 -1
  159. package/dist/core/tools/tasks/schema.js +8 -7
  160. package/dist/core/tools/tasks/schema.js.map +1 -1
  161. package/dist/core/tools/tasks/types.d.ts +8 -38
  162. package/dist/core/tools/tasks/types.d.ts.map +1 -1
  163. package/dist/core/tools/tasks/types.js +6 -11
  164. package/dist/core/tools/tasks/types.js.map +1 -1
  165. package/dist/core/virtual-models.d.ts +2 -0
  166. package/dist/core/virtual-models.d.ts.map +1 -1
  167. package/dist/core/virtual-models.js +19 -12
  168. package/dist/core/virtual-models.js.map +1 -1
  169. package/dist/extensions/btw/agent.d.ts +17 -8
  170. package/dist/extensions/btw/agent.d.ts.map +1 -1
  171. package/dist/extensions/btw/agent.js +74 -76
  172. package/dist/extensions/btw/agent.js.map +1 -1
  173. package/dist/extensions/btw/controller.d.ts +0 -1
  174. package/dist/extensions/btw/controller.d.ts.map +1 -1
  175. package/dist/extensions/btw/controller.js +26 -33
  176. package/dist/extensions/btw/controller.js.map +1 -1
  177. package/dist/extensions/btw/panel.d.ts +13 -14
  178. package/dist/extensions/btw/panel.d.ts.map +1 -1
  179. package/dist/extensions/btw/panel.js +38 -29
  180. package/dist/extensions/btw/panel.js.map +1 -1
  181. package/dist/extensions/codemode/execute.d.ts.map +1 -1
  182. package/dist/extensions/codemode/execute.js +197 -51
  183. package/dist/extensions/codemode/execute.js.map +1 -1
  184. package/dist/extensions/codemode/renderer.d.ts.map +1 -1
  185. package/dist/extensions/codemode/renderer.js +43 -25
  186. package/dist/extensions/codemode/renderer.js.map +1 -1
  187. package/dist/extensions/codemode/tool.d.ts +12 -11
  188. package/dist/extensions/codemode/tool.d.ts.map +1 -1
  189. package/dist/extensions/codemode/tool.js +73 -129
  190. package/dist/extensions/codemode/tool.js.map +1 -1
  191. package/dist/extensions/codemode/worker.d.ts +1 -1
  192. package/dist/extensions/codemode/worker.js +1 -1
  193. package/dist/extensions/codemode/worker.js.map +1 -1
  194. package/dist/extensions/deepwiki/schema.d.ts +1 -1
  195. package/dist/extensions/index.d.ts.map +1 -1
  196. package/dist/extensions/index.js +0 -2
  197. package/dist/extensions/index.js.map +1 -1
  198. package/dist/extensions/mcp/cli.d.ts.map +1 -1
  199. package/dist/extensions/mcp/cli.js +23 -5
  200. package/dist/extensions/mcp/cli.js.map +1 -1
  201. package/dist/extensions/mcp/config.d.ts +19 -5
  202. package/dist/extensions/mcp/config.d.ts.map +1 -1
  203. package/dist/extensions/mcp/config.js +60 -12
  204. package/dist/extensions/mcp/config.js.map +1 -1
  205. package/dist/extensions/mcp/index.d.ts +36 -9
  206. package/dist/extensions/mcp/index.d.ts.map +1 -1
  207. package/dist/extensions/mcp/index.js +309 -100
  208. package/dist/extensions/mcp/index.js.map +1 -1
  209. package/dist/extensions/mcp/oauth.d.ts +14 -8
  210. package/dist/extensions/mcp/oauth.d.ts.map +1 -1
  211. package/dist/extensions/mcp/oauth.js +105 -36
  212. package/dist/extensions/mcp/oauth.js.map +1 -1
  213. package/dist/extensions/mcp/runtime.d.ts +2 -0
  214. package/dist/extensions/mcp/runtime.d.ts.map +1 -1
  215. package/dist/extensions/mcp/runtime.js +17 -9
  216. package/dist/extensions/mcp/runtime.js.map +1 -1
  217. package/dist/extensions/mcp/tools.d.ts +8 -5
  218. package/dist/extensions/mcp/tools.d.ts.map +1 -1
  219. package/dist/extensions/mcp/tools.js +50 -26
  220. package/dist/extensions/mcp/tools.js.map +1 -1
  221. package/dist/extensions/mcp/ui.d.ts.map +1 -1
  222. package/dist/extensions/mcp/ui.js +7 -1
  223. package/dist/extensions/mcp/ui.js.map +1 -1
  224. package/dist/extensions/provider/catalog.d.ts +8 -1
  225. package/dist/extensions/provider/catalog.d.ts.map +1 -1
  226. package/dist/extensions/provider/catalog.js +31 -0
  227. package/dist/extensions/provider/catalog.js.map +1 -1
  228. package/dist/extensions/provider/connection.d.ts +4 -1
  229. package/dist/extensions/provider/connection.d.ts.map +1 -1
  230. package/dist/extensions/provider/connection.js +1 -5
  231. package/dist/extensions/provider/connection.js.map +1 -1
  232. package/dist/extensions/provider/editing.d.ts +36 -0
  233. package/dist/extensions/provider/editing.d.ts.map +1 -0
  234. package/dist/extensions/provider/editing.js +99 -0
  235. package/dist/extensions/provider/editing.js.map +1 -0
  236. package/dist/extensions/provider/json-fields.d.ts +5 -0
  237. package/dist/extensions/provider/json-fields.d.ts.map +1 -0
  238. package/dist/extensions/provider/json-fields.js +31 -0
  239. package/dist/extensions/provider/json-fields.js.map +1 -0
  240. package/dist/extensions/provider/store.d.ts +1 -4
  241. package/dist/extensions/provider/store.d.ts.map +1 -1
  242. package/dist/extensions/provider/store.js +2 -30
  243. package/dist/extensions/provider/store.js.map +1 -1
  244. package/dist/extensions/provider/ui/builtin-data.d.ts +0 -2
  245. package/dist/extensions/provider/ui/builtin-data.d.ts.map +1 -1
  246. package/dist/extensions/provider/ui/builtin-data.js +14 -79
  247. package/dist/extensions/provider/ui/builtin-data.js.map +1 -1
  248. package/dist/extensions/provider/ui/compat.d.ts.map +1 -1
  249. package/dist/extensions/provider/ui/compat.js +6 -9
  250. package/dist/extensions/provider/ui/compat.js.map +1 -1
  251. package/dist/extensions/provider/ui/controls.d.ts +48 -0
  252. package/dist/extensions/provider/ui/controls.d.ts.map +1 -0
  253. package/dist/extensions/provider/ui/controls.js +108 -0
  254. package/dist/extensions/provider/ui/controls.js.map +1 -0
  255. package/dist/extensions/provider/ui/dictionary.d.ts.map +1 -1
  256. package/dist/extensions/provider/ui/dictionary.js +6 -9
  257. package/dist/extensions/provider/ui/dictionary.js.map +1 -1
  258. package/dist/extensions/provider/ui/editor.d.ts +3 -3
  259. package/dist/extensions/provider/ui/editor.d.ts.map +1 -1
  260. package/dist/extensions/provider/ui/editor.js +35 -140
  261. package/dist/extensions/provider/ui/editor.js.map +1 -1
  262. package/dist/extensions/provider/ui/fetch-models.d.ts +0 -3
  263. package/dist/extensions/provider/ui/fetch-models.d.ts.map +1 -1
  264. package/dist/extensions/provider/ui/fetch-models.js +49 -44
  265. package/dist/extensions/provider/ui/fetch-models.js.map +1 -1
  266. package/dist/extensions/provider/ui/model-fields.d.ts.map +1 -1
  267. package/dist/extensions/provider/ui/model-fields.js +11 -14
  268. package/dist/extensions/provider/ui/model-fields.js.map +1 -1
  269. package/dist/extensions/provider/ui/model-options.d.ts +4 -34
  270. package/dist/extensions/provider/ui/model-options.d.ts.map +1 -1
  271. package/dist/extensions/provider/ui/model-options.js +90 -271
  272. package/dist/extensions/provider/ui/model-options.js.map +1 -1
  273. package/dist/extensions/provider/ui/pane.d.ts +4 -18
  274. package/dist/extensions/provider/ui/pane.d.ts.map +1 -1
  275. package/dist/extensions/provider/ui/pane.js.map +1 -1
  276. package/dist/extensions/provider/ui/provider-fields.d.ts +2 -19
  277. package/dist/extensions/provider/ui/provider-fields.d.ts.map +1 -1
  278. package/dist/extensions/provider/ui/provider-fields.js +58 -171
  279. package/dist/extensions/provider/ui/provider-fields.js.map +1 -1
  280. package/dist/extensions/provider/ui/thinking-map.d.ts.map +1 -1
  281. package/dist/extensions/provider/ui/thinking-map.js +6 -9
  282. package/dist/extensions/provider/ui/thinking-map.js.map +1 -1
  283. package/dist/extensions/question/detail-pane.d.ts +7 -2
  284. package/dist/extensions/question/detail-pane.d.ts.map +1 -1
  285. package/dist/extensions/question/detail-pane.js +16 -5
  286. package/dist/extensions/question/detail-pane.js.map +1 -1
  287. package/dist/extensions/question/dialog-view.d.ts +41 -0
  288. package/dist/extensions/question/dialog-view.d.ts.map +1 -0
  289. package/dist/extensions/question/dialog-view.js +329 -0
  290. package/dist/extensions/question/dialog-view.js.map +1 -0
  291. package/dist/extensions/question/dialog.d.ts +3 -3
  292. package/dist/extensions/question/dialog.d.ts.map +1 -1
  293. package/dist/extensions/question/dialog.js +220 -634
  294. package/dist/extensions/question/dialog.js.map +1 -1
  295. package/dist/extensions/question/index.d.ts.map +1 -1
  296. package/dist/extensions/question/index.js +2 -3
  297. package/dist/extensions/question/index.js.map +1 -1
  298. package/dist/extensions/question/render.d.ts.map +1 -1
  299. package/dist/extensions/question/render.js +22 -32
  300. package/dist/extensions/question/render.js.map +1 -1
  301. package/dist/extensions/question/results.d.ts.map +1 -1
  302. package/dist/extensions/question/results.js +56 -12
  303. package/dist/extensions/question/results.js.map +1 -1
  304. package/dist/extensions/question/schema.d.ts +21 -6
  305. package/dist/extensions/question/schema.d.ts.map +1 -1
  306. package/dist/extensions/question/schema.js.map +1 -1
  307. package/dist/extensions/question/state.d.ts +9 -7
  308. package/dist/extensions/question/state.d.ts.map +1 -1
  309. package/dist/extensions/question/state.js +63 -54
  310. package/dist/extensions/question/state.js.map +1 -1
  311. package/dist/extensions/question/types.d.ts +41 -18
  312. package/dist/extensions/question/types.d.ts.map +1 -1
  313. package/dist/extensions/question/types.js.map +1 -1
  314. package/dist/extensions/statusline/index.d.ts +4 -0
  315. package/dist/extensions/statusline/index.d.ts.map +1 -1
  316. package/dist/extensions/statusline/index.js +18 -355
  317. package/dist/extensions/statusline/index.js.map +1 -1
  318. package/dist/extensions/statusline/render.d.ts +19 -0
  319. package/dist/extensions/statusline/render.d.ts.map +1 -0
  320. package/dist/extensions/statusline/render.js +163 -0
  321. package/dist/extensions/statusline/render.js.map +1 -0
  322. package/dist/extensions/statusline/usage.d.ts +12 -0
  323. package/dist/extensions/statusline/usage.d.ts.map +1 -0
  324. package/dist/extensions/statusline/usage.js +36 -0
  325. package/dist/extensions/statusline/usage.js.map +1 -0
  326. package/dist/extensions/tool-search/tool.d.ts +5 -4
  327. package/dist/extensions/tool-search/tool.d.ts.map +1 -1
  328. package/dist/extensions/tool-search/tool.js +7 -28
  329. package/dist/extensions/tool-search/tool.js.map +1 -1
  330. package/dist/extensions/web-search/execute.d.ts +1 -5
  331. package/dist/extensions/web-search/execute.d.ts.map +1 -1
  332. package/dist/extensions/web-search/execute.js +4 -9
  333. package/dist/extensions/web-search/execute.js.map +1 -1
  334. package/dist/extensions/web-search/format.d.ts +12 -3
  335. package/dist/extensions/web-search/format.d.ts.map +1 -1
  336. package/dist/extensions/web-search/format.js +33 -25
  337. package/dist/extensions/web-search/format.js.map +1 -1
  338. package/dist/extensions/web-search/index.d.ts.map +1 -1
  339. package/dist/extensions/web-search/index.js +6 -29
  340. package/dist/extensions/web-search/index.js.map +1 -1
  341. package/dist/extensions/web-search/providers/deepseek.d.ts.map +1 -1
  342. package/dist/extensions/web-search/providers/deepseek.js +0 -1
  343. package/dist/extensions/web-search/providers/deepseek.js.map +1 -1
  344. package/dist/extensions/web-search/providers/http.d.ts +1 -1
  345. package/dist/extensions/web-search/providers/http.d.ts.map +1 -1
  346. package/dist/extensions/web-search/providers/http.js.map +1 -1
  347. package/dist/extensions/web-search/providers/minimax.d.ts.map +1 -1
  348. package/dist/extensions/web-search/providers/minimax.js +0 -1
  349. package/dist/extensions/web-search/providers/minimax.js.map +1 -1
  350. package/dist/extensions/web-search/render.d.ts +7 -2
  351. package/dist/extensions/web-search/render.d.ts.map +1 -1
  352. package/dist/extensions/web-search/render.js +32 -4
  353. package/dist/extensions/web-search/render.js.map +1 -1
  354. package/dist/extensions/web-search/results.d.ts.map +1 -1
  355. package/dist/extensions/web-search/results.js +3 -8
  356. package/dist/extensions/web-search/results.js.map +1 -1
  357. package/dist/extensions/web-search/types.d.ts +4 -2
  358. package/dist/extensions/web-search/types.d.ts.map +1 -1
  359. package/dist/extensions/web-search/types.js.map +1 -1
  360. package/dist/index.d.ts +3 -5
  361. package/dist/index.d.ts.map +1 -1
  362. package/dist/index.js +0 -1
  363. package/dist/index.js.map +1 -1
  364. package/dist/main.d.ts.map +1 -1
  365. package/dist/main.js +6 -0
  366. package/dist/main.js.map +1 -1
  367. package/dist/modes/interactive/components/armin.d.ts +3 -0
  368. package/dist/modes/interactive/components/armin.d.ts.map +1 -1
  369. package/dist/modes/interactive/components/armin.js +7 -5
  370. package/dist/modes/interactive/components/armin.js.map +1 -1
  371. package/dist/modes/interactive/components/auth-url.d.ts +14 -0
  372. package/dist/modes/interactive/components/auth-url.d.ts.map +1 -0
  373. package/dist/modes/interactive/components/auth-url.js +34 -0
  374. package/dist/modes/interactive/components/auth-url.js.map +1 -0
  375. package/dist/modes/interactive/components/easter-egg-3d.d.ts +104 -0
  376. package/dist/modes/interactive/components/easter-egg-3d.d.ts.map +1 -0
  377. package/dist/modes/interactive/components/easter-egg-3d.js +1123 -0
  378. package/dist/modes/interactive/components/easter-egg-3d.js.map +1 -0
  379. package/dist/modes/interactive/components/easter-egg-3d.lazy.d.ts +6 -0
  380. package/dist/modes/interactive/components/easter-egg-3d.lazy.d.ts.map +1 -0
  381. package/dist/modes/interactive/components/easter-egg-3d.lazy.js +24 -0
  382. package/dist/modes/interactive/components/easter-egg-3d.lazy.js.map +1 -0
  383. package/dist/modes/interactive/components/index.d.ts +0 -1
  384. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  385. package/dist/modes/interactive/components/index.js +0 -1
  386. package/dist/modes/interactive/components/index.js.map +1 -1
  387. package/dist/modes/interactive/components/login-dialog.d.ts +2 -0
  388. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  389. package/dist/modes/interactive/components/login-dialog.js +9 -5
  390. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  391. package/dist/modes/interactive/components/oauth-selector.d.ts +8 -2
  392. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  393. package/dist/modes/interactive/components/oauth-selector.js +24 -21
  394. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  395. package/dist/modes/interactive/components/pi-logo.d.ts +7 -0
  396. package/dist/modes/interactive/components/pi-logo.d.ts.map +1 -1
  397. package/dist/modes/interactive/components/pi-logo.js +13 -1
  398. package/dist/modes/interactive/components/pi-logo.js.map +1 -1
  399. package/dist/modes/interactive/components/radius-login-selector.d.ts +15 -0
  400. package/dist/modes/interactive/components/radius-login-selector.d.ts.map +1 -0
  401. package/dist/modes/interactive/components/radius-login-selector.js +83 -0
  402. package/dist/modes/interactive/components/radius-login-selector.js.map +1 -0
  403. package/dist/modes/interactive/components/settings-selector.d.ts +3 -3
  404. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  405. package/dist/modes/interactive/components/settings-selector.js +5 -5
  406. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  407. package/dist/modes/interactive/components/status-marker.d.ts +0 -2
  408. package/dist/modes/interactive/components/status-marker.d.ts.map +1 -1
  409. package/dist/modes/interactive/components/status-marker.js +0 -4
  410. package/dist/modes/interactive/components/status-marker.js.map +1 -1
  411. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  412. package/dist/modes/interactive/components/user-message.js +5 -4
  413. package/dist/modes/interactive/components/user-message.js.map +1 -1
  414. package/dist/modes/interactive/components/visual-truncate.d.ts +27 -3
  415. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
  416. package/dist/modes/interactive/components/visual-truncate.js +36 -6
  417. package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
  418. package/dist/modes/interactive/interactive-mode.d.ts +12 -2
  419. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  420. package/dist/modes/interactive/interactive-mode.js +180 -55
  421. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  422. package/dist/modes/interactive/tasks/completion-render.d.ts +1 -1
  423. package/dist/modes/interactive/tasks/completion-render.d.ts.map +1 -1
  424. package/dist/modes/interactive/tasks/completion-render.js +28 -82
  425. package/dist/modes/interactive/tasks/completion-render.js.map +1 -1
  426. package/dist/modes/interactive/tasks/index.d.ts.map +1 -1
  427. package/dist/modes/interactive/tasks/index.js +18 -13
  428. package/dist/modes/interactive/tasks/index.js.map +1 -1
  429. package/dist/modes/interactive/tasks/inspector.d.ts +35 -0
  430. package/dist/modes/interactive/tasks/inspector.d.ts.map +1 -0
  431. package/dist/modes/interactive/tasks/inspector.js +93 -0
  432. package/dist/modes/interactive/tasks/inspector.js.map +1 -0
  433. package/dist/modes/interactive/tasks/layout.d.ts +40 -0
  434. package/dist/modes/interactive/tasks/layout.d.ts.map +1 -0
  435. package/dist/modes/interactive/tasks/layout.js +212 -0
  436. package/dist/modes/interactive/tasks/layout.js.map +1 -0
  437. package/dist/modes/interactive/tasks/list.d.ts +21 -0
  438. package/dist/modes/interactive/tasks/list.d.ts.map +1 -0
  439. package/dist/modes/interactive/tasks/list.js +96 -0
  440. package/dist/modes/interactive/tasks/list.js.map +1 -0
  441. package/dist/modes/interactive/tasks/manager.d.ts +29 -36
  442. package/dist/modes/interactive/tasks/manager.d.ts.map +1 -1
  443. package/dist/modes/interactive/tasks/manager.js +315 -315
  444. package/dist/modes/interactive/tasks/manager.js.map +1 -1
  445. package/dist/modes/interactive/tasks/model.d.ts +21 -0
  446. package/dist/modes/interactive/tasks/model.d.ts.map +1 -0
  447. package/dist/modes/interactive/tasks/model.js +41 -0
  448. package/dist/modes/interactive/tasks/model.js.map +1 -0
  449. package/dist/modes/interactive/tasks/render.d.ts +5 -19
  450. package/dist/modes/interactive/tasks/render.d.ts.map +1 -1
  451. package/dist/modes/interactive/tasks/render.js +18 -102
  452. package/dist/modes/interactive/tasks/render.js.map +1 -1
  453. package/dist/modes/interactive/tasks/task-view.d.ts +8 -48
  454. package/dist/modes/interactive/tasks/task-view.d.ts.map +1 -1
  455. package/dist/modes/interactive/tasks/task-view.js +11 -51
  456. package/dist/modes/interactive/tasks/task-view.js.map +1 -1
  457. package/dist/modes/interactive/tasks/text.d.ts +1 -7
  458. package/dist/modes/interactive/tasks/text.d.ts.map +1 -1
  459. package/dist/modes/interactive/tasks/text.js +6 -29
  460. package/dist/modes/interactive/tasks/text.js.map +1 -1
  461. package/dist/modes/interactive/tasks/viewport.d.ts +2 -0
  462. package/dist/modes/interactive/tasks/viewport.d.ts.map +1 -1
  463. package/dist/modes/interactive/tasks/viewport.js +17 -7
  464. package/dist/modes/interactive/tasks/viewport.js.map +1 -1
  465. package/dist/modes/interactive/tasks/views.d.ts +9 -0
  466. package/dist/modes/interactive/tasks/views.d.ts.map +1 -0
  467. package/dist/modes/interactive/tasks/views.js +42 -0
  468. package/dist/modes/interactive/tasks/views.js.map +1 -0
  469. package/dist/modes/interactive/theme/system-theme.d.ts +2 -1
  470. package/dist/modes/interactive/theme/system-theme.d.ts.map +1 -1
  471. package/dist/modes/interactive/theme/system-theme.js +16 -5
  472. package/dist/modes/interactive/theme/system-theme.js.map +1 -1
  473. package/dist/modes/interactive/tool-view/tool-execution.d.ts +4 -19
  474. package/dist/modes/interactive/tool-view/tool-execution.d.ts.map +1 -1
  475. package/dist/modes/interactive/tool-view/tool-execution.js +23 -67
  476. package/dist/modes/interactive/tool-view/tool-execution.js.map +1 -1
  477. package/dist/utils/image-convert.d.ts +12 -0
  478. package/dist/utils/image-convert.d.ts.map +1 -1
  479. package/dist/utils/image-convert.js +45 -6
  480. package/dist/utils/image-convert.js.map +1 -1
  481. package/docs/bundled/README.md +0 -1
  482. package/docs/bundled/extensions/question.md +2 -2
  483. package/docs/bundled/extensions/statusline.md +24 -15
  484. package/docs/bundled/tasks.md +34 -48
  485. package/docs/codemode.md +207 -0
  486. package/docs/docs.json +4 -4
  487. package/docs/environment-variables.md +1 -1
  488. package/docs/extensions.md +11 -9
  489. package/docs/keybindings.md +14 -7
  490. package/docs/mcp.md +164 -82
  491. package/docs/models.md +51 -3
  492. package/docs/providers.md +8 -0
  493. package/docs/sdk.md +2 -2
  494. package/docs/session-format.md +12 -22
  495. package/docs/settings.md +4 -2
  496. package/docs/tui.md +1 -1
  497. package/docs/usage.md +6 -16
  498. package/examples/README.md +1 -1
  499. package/examples/extensions/README.md +1 -2
  500. package/examples/extensions/built-in-tool-renderer.ts +16 -40
  501. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  502. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  503. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  504. package/examples/extensions/gondolin/package-lock.json +2 -2
  505. package/examples/extensions/gondolin/package.json +1 -1
  506. package/examples/extensions/minimal-mode.ts +24 -96
  507. package/examples/extensions/sandbox/package-lock.json +2 -2
  508. package/examples/extensions/sandbox/package.json +1 -1
  509. package/examples/extensions/with-deps/package-lock.json +2 -2
  510. package/examples/extensions/with-deps/package.json +1 -1
  511. package/examples/sdk/14-codemode-mcp.ts +2 -2
  512. package/npm-shrinkwrap.json +73 -62
  513. package/package.json +11 -10
  514. package/dist/bundle/chunks/anthropic-messages-KIXY7EDT.js +0 -6
  515. package/dist/bundle/chunks/azure-openai-responses-RPBERDXD.js +0 -2
  516. package/dist/bundle/chunks/chunk-CLLDCO64.js +0 -2
  517. package/dist/bundle/chunks/chunk-PJVFYVHE.js +0 -42
  518. package/dist/bundle/chunks/chunk-UUSTLCVC.js +0 -2
  519. package/dist/bundle/chunks/chunk-VWCWZD6E.js +0 -2
  520. package/dist/bundle/chunks/node-CXWYTK2I.js +0 -16
  521. package/dist/bundle/chunks/openai-completions-SKDGF6OE.js +0 -7
  522. package/dist/bundle/chunks/openai-responses-FPML4SSG.js +0 -3
  523. package/dist/bundle/chunks/virtual-modules-TQRORWJQ.js +0 -2
  524. package/dist/core/tasks/view-data.d.ts +0 -8
  525. package/dist/core/tasks/view-data.d.ts.map +0 -1
  526. package/dist/core/tasks/view-data.js +0 -61
  527. package/dist/core/tasks/view-data.js.map +0 -1
  528. package/dist/core/tasks/view.d.ts +0 -30
  529. package/dist/core/tasks/view.d.ts.map +0 -1
  530. package/dist/core/tasks/view.js +0 -50
  531. package/dist/core/tasks/view.js.map +0 -1
  532. package/dist/core/tools/renderers/shell-task.d.ts +0 -4
  533. package/dist/core/tools/renderers/shell-task.d.ts.map +0 -1
  534. package/dist/core/tools/renderers/shell-task.js +0 -35
  535. package/dist/core/tools/renderers/shell-task.js.map +0 -1
  536. package/dist/extensions/todo/constants.d.ts +0 -16
  537. package/dist/extensions/todo/constants.d.ts.map +0 -1
  538. package/dist/extensions/todo/constants.js +0 -30
  539. package/dist/extensions/todo/constants.js.map +0 -1
  540. package/dist/extensions/todo/index.d.ts +0 -3
  541. package/dist/extensions/todo/index.d.ts.map +0 -1
  542. package/dist/extensions/todo/index.js +0 -98
  543. package/dist/extensions/todo/index.js.map +0 -1
  544. package/dist/extensions/todo/schema.d.ts +0 -60
  545. package/dist/extensions/todo/schema.d.ts.map +0 -1
  546. package/dist/extensions/todo/schema.js +0 -56
  547. package/dist/extensions/todo/schema.js.map +0 -1
  548. package/dist/extensions/todo/state.d.ts +0 -34
  549. package/dist/extensions/todo/state.d.ts.map +0 -1
  550. package/dist/extensions/todo/state.js +0 -425
  551. package/dist/extensions/todo/state.js.map +0 -1
  552. package/dist/extensions/todo/view.d.ts +0 -36
  553. package/dist/extensions/todo/view.d.ts.map +0 -1
  554. package/dist/extensions/todo/view.js +0 -580
  555. package/dist/extensions/todo/view.js.map +0 -1
  556. package/dist/extensions/todo/widget.d.ts +0 -15
  557. package/dist/extensions/todo/widget.d.ts.map +0 -1
  558. package/dist/extensions/todo/widget.js +0 -50
  559. package/dist/extensions/todo/widget.js.map +0 -1
  560. package/dist/modes/interactive/components/daxnuts.d.ts +0 -23
  561. package/dist/modes/interactive/components/daxnuts.d.ts.map +0 -1
  562. package/dist/modes/interactive/components/daxnuts.js +0 -138
  563. package/dist/modes/interactive/components/daxnuts.js.map +0 -1
  564. package/dist/modes/interactive/tasks/fallback-view.d.ts +0 -4
  565. package/dist/modes/interactive/tasks/fallback-view.d.ts.map +0 -1
  566. package/dist/modes/interactive/tasks/fallback-view.js +0 -27
  567. package/dist/modes/interactive/tasks/fallback-view.js.map +0 -1
  568. package/docs/bundled/extensions/todo.md +0 -104
  569. package/examples/extensions/todo.ts +0 -297
@@ -1159,22 +1159,20 @@ Session-bound `TasksContext` supervises native and extension-owned execution. Fo
1159
1159
  | Method | Contract |
1160
1160
  |---|---|
1161
1161
  | `execute<T>(execution)` | Returns `{ kind: "result", result, status?, error? }` or `{ kind: "background", task }` |
1162
- | `list()` / `get(id)` | Bounded retained snapshots; IDs support unique prefixes |
1162
+ | `list()` / `get(id)` | Bounded, read-only (frozen) retained snapshots; IDs support unique prefixes |
1163
1163
  | `read(id, options?)` | Bounded head, tail, or byte-offset output |
1164
1164
  | `wait(id, timeoutMs?, signal?)` | Observation only; timeout or cancellation ends the wait, not execution |
1165
1165
  | `kill(id)` | Requests cancellation; `stopping` is not a terminal status |
1166
- | `detach(id)` / `detachForeground()` | Hands off one task or all eligible foreground tasks without restarting them |
1166
+ | `detach(id)` / `detachForeground()` | Hands off one task, or eligible foreground tasks oldest first while background slots remain, without restarting them; throws when every background slot is taken |
1167
1167
  | `subscribe(listener)` | Observes task state and progress |
1168
1168
  | `retain(id)` | Returns an idempotent release function protecting retained data, without delaying notifications |
1169
1169
  | `holdDelivery(id)` | Explicitly retains data and delays automatic delivery until released |
1170
1170
 
1171
- `TaskExecution<T>` supplies `kind`, `title`, `toolCallId`, `run(control)`, optional `format`, `command`, `cwd`, `background`, `signal`, and `onUpdate`. `kind` is an executor-owned source label matching `[a-z][a-z0-9-]{0,63}`; the runtime never dispatches on it. `format` is `"report"` (default) or `"log"`. Foreground log records have a separate history quota and are hidden from the finished panel unless selected.
1171
+ `TaskExecution<T>` supplies `kind`, `title`, `toolCallId`, `run(control)`, optional `command`, `cwd`, `background`, `signal`, and `onUpdate`. `kind` is an executor-owned source label matching `[a-z][a-z0-9-]{0,63}`; the runtime never dispatches on it. At most eight background executions run at once; foreground executions are not limited by them. Foreground and background results have separate history quotas.
1172
1172
 
1173
1173
  `run` returns `TaskCompletion<T>`: `{ result, status?, error?, exitCode?, usage? }`. The original tool result is returned to a foreground caller; private `result.details` is not copied into task history. Explicit terminal statuses are `completed`, `partial`, `failed`, `cancelled`, and `timeout`. Usage is settled by the host once; managed foreground results omit usage to avoid billing it twice.
1174
1174
 
1175
- `TaskControl<T>` exposes `id`, `signal`, `mode`, `accept()`, `publish(result, projection?)`, `setOutputPath(path, cleanup?)`, `onModeChange(listener)`, and `requestCancel()`. Call `accept()` after whole-invocation preflight, before allowing a background handoff. Use the control's signal throughout execution. Parent-call cancellation is disconnected after handoff, while runtime shutdown still cancels the task. Mode subscriptions concern only this task; executors do not need the global registry to observe their own handoff or cancel themselves.
1176
-
1177
- `TaskProjection` contains optional bounded `text`, executor-provided `nextStep` guidance, `shell: { name, output }`, and generic report `items`. Each item has `id`, `label`, `category`, `description`, `status`, `report`, optional `error`, live `input`/`activity`, and optional `context`/`usage` display strings. `TaskText` is `{ text, truncated }`. Report groups retain at most eight items, with 4 KiB per report; log output retains at most 40 KiB in the projection. Extensions may translate their reports into these public items; the core does not import executor internals.
1175
+ `TaskControl<T>` exposes `id`, `signal`, `mode`, `accept()`, `publish(result)`, `setOutputPath(path, cleanup?)`, `onModeChange(listener)`, and `requestCancel()`. `publish` replaces the task's bounded text result, which the `/tasks` panel, `tasks read`, and the completion notification show; a task with an output path is read from that log instead. Call `accept()` after whole-invocation preflight, before allowing a background handoff. Use the control's signal throughout execution. Parent-call cancellation is disconnected after handoff, while runtime shutdown still cancels the task. Mode subscriptions concern only this task; executors do not need the global registry to observe their own handoff or cancel themselves.
1178
1176
 
1179
1177
  Completion messages store a self-contained `TaskCompletionSnapshot`; only their bounded `content` enters model context. Built-in `tasks wait` binds delivery to the actual tool call, and the host confirms it after successful persistence. Ordinary extension reads/waits do not acknowledge delivery, and arbitrary tool-result detail fields cannot acknowledge a task.
1180
1178
 
@@ -3217,7 +3215,7 @@ A tool can run other tools with `ctx.executeTool(name, args, { signal, onUpdate
3217
3215
  - `deferred`: like `codemode`, but codemode tools do not list it; `tool_search` can find and activate it.
3218
3216
  - `hidden`: registered but unreachable. Re-register a tool with `exposure: "hidden"` to withdraw it, since tools cannot be unregistered.
3219
3217
 
3220
- `namespace: { name, description }` groups related tools, as MCP servers do. Codemode tools list a namespace under one heading.
3218
+ `namespace: { name, description, instructions }` groups related tools, as MCP servers do. Codemode tools list a namespace under one heading with its `description`. `instructions` holds longer usage guidance; it is not listed, and codemode scripts read it with `describeNamespace(name)`.
3221
3219
 
3222
3220
  Registering a `direct` or `model-only` tool activates it; the other exposures are not activated on registration. The active set (`pi.getActiveTools()`, `pi.setActiveTools()`) is the set of tools declared to the model. `pi.getAllTools()` reports each tool's `exposure`, `namespace`, and `annotations`.
3223
3221
 
@@ -3235,11 +3233,15 @@ pi.on("tool_call", async (event, ctx) => {
3235
3233
  });
3236
3234
  ```
3237
3235
 
3238
- A tool that orchestrates other tools can adjust what the model sees while it is active with `prepareLoadout(loadout)`. It runs whenever the active tools change and receives the declared tools, the callable tools, and every registered tool with its exposure and namespace. It returns replacement `descriptions` for declared tools (including its own) and `hiddenDeclarations`: active tools whose declarations requests leave out while they stay active and callable. `codemode` and `tool_search` use only this hook, `exposure`, and `ctx.executeTool()`, so another tool can implement the same behavior under a different name.
3236
+ A tool that orchestrates other tools can adjust what the model sees while it is active with `prepareLoadout(loadout)`. It runs whenever the active tools change and receives the declared tools, the callable tools, and every registered tool with its exposure and namespace. It returns replacement `descriptions` for declared tools (including its own) and `hiddenDeclarations`: active tools whose declarations requests leave out while they stay active and callable. `codemode` uses only this hook, `exposure`, and `ctx.executeTool()`, so another tool can implement the same behavior under a different name.
3237
+
3238
+ ### Tool renderer resolution
3239
+
3240
+ `pi.registerToolRenderer((toolName, next) => renderers)` chooses `renderCall`, `renderResult`, and `renderShell` for calls to any tool, including tools that are not registered yet, such as MCP tools in a resumed session. Resolvers run in extension load order. `next()` returns the remaining resolvers' result or the registered tool's renderers, so `next() ?? mine` supplies a fallback. Interactive transcripts and HTML exports both use these resolvers.
3239
3241
 
3240
3242
  ### MCP servers
3241
3243
 
3242
- `pi.registerMcpServer(name, config)` adds an MCP server for the current session. `config` has the shape of an `mcpServers` entry in [`mcp.json`](mcp.md): `command`, `args`, `env`, and `cwd` for stdio servers, `url`, `headers`, and `oauth` for HTTP servers, plus `exposure`, `toolExposure`, `enabled`, and `timeout`.
3244
+ `pi.registerMcpServer(name, config)` adds an MCP server for the current session. `config` has the shape of an `mcpServers` entry in [`mcp.json`](mcp.md): `command`, `args`, `env`, and `cwd` for stdio servers, `url`, `headers`, and `oauth` for HTTP servers, plus `exposure`, `toolExposure`, `description`, `enabled`, and `timeout`.
3243
3245
 
3244
3246
  ```typescript
3245
3247
  pi.registerMcpServer("jira", { url: "https://mcp.example.com/jira", exposure: "codemode" });
@@ -129,12 +129,19 @@ This routing remains configurable through the ordinary action bindings. For exam
129
129
  | `app.editor.external` | `ctrl+g` | Open in external editor (`externalEditor`, `$VISUAL`, `$EDITOR`, Notepad on Windows, or `nano` elsewhere) |
130
130
  | `app.clipboard.pasteImage` | `ctrl+v` (`alt+v` on Windows and WSL) | Paste image or text from clipboard |
131
131
  | `app.tasks.detach` | `ctrl+b` | Move all eligible current foreground managed tasks to the background |
132
- | `app.tasks.focusList` | `left` | Focus the task list in `/tasks` |
133
- | `app.tasks.focusPreview` | `right` | Focus the selected preview in `/tasks` |
134
- | `app.tasks.focusInfo` | `i` | Focus the selected task's information in `/tasks` |
135
- | `app.tasks.kill` | `k` | Ask to stop the selected ongoing task in `/tasks` (confirmed with `y`) |
136
-
137
- In `/tasks`, Up/Down and Page Up/Page Down target the focused pane: row selection/list paging or preview scrolling/paging. Enter focuses the preview; Escape returns to the list before closing. Left/Right focus controls can be rebound independently of editor cursor actions. List paging uses `tui.select.pageUp`/`pageDown`; preview paging uses `tui.editor.pageUp`/`pageDown` (including their default Ctrl+Page Up/Down aliases).
132
+ | `app.tasks.nextFocus` | `tab` | Switch between task list and inspector |
133
+ | `app.tasks.previousFocus` | `shift+tab` | Switch between task inspector and list |
134
+ | `app.tasks.previousTab` | `left` | Show Output while the inspector has focus |
135
+ | `app.tasks.nextTab` | `right` | Show Details while the inspector has focus |
136
+ | `app.tasks.search` | `/` | Locate a retained task; Enter chooses, Escape restores selection |
137
+ | `app.tasks.follow` | `f` | Follow latest or final output while Output has focus |
138
+ | `app.tasks.top` / `app.tasks.bottom` | `home` / `end` | Beginning / end of the focused list or content |
139
+ | `app.tasks.kill` | `k` | Ask to stop the selected ongoing task |
140
+ | `app.tasks.confirmStop` | `enter` | Confirm stopping the task named in the confirmation |
141
+ | `app.tasks.detachSelected` | `b` | Move only the selected foreground task to the background |
142
+ | `app.tasks.help` | `?` | Show task controls |
143
+
144
+ In `/tasks`, Tab switches between two panes and preserves the inspector's Output/Details tab. Left/Right only change that tab while the inspector has focus. Up/Down and Page Up/Page Down select tasks or scroll the focused content. Escape closes the current search, help or confirmation first, and otherwise closes the panel from either pane. Narrow terminals use the same rules. List paging uses `tui.select.pageUp`/`pageDown`; inspector paging uses `tui.editor.pageUp`/`pageDown` (including their default Ctrl+Page Up/Down aliases).
138
145
 
139
146
  Ctrl+B also works while `/tasks` owns focus. It does not restart execution, reset shell timeouts, or affect user `!` commands. With no eligible work the key falls through to other bindings. See [Background tasks](bundled/tasks.md).
140
147
 
@@ -199,7 +206,7 @@ Rebind these save actions with `app.models.save` and `app.thinking.save`; the se
199
206
  | Keybinding id | Default | Description |
200
207
  |--------|---------|-------------|
201
208
  | `app.tools.expand` | `ctrl+o` | Collapse or expand tool output |
202
- | `app.message.copy` | `ctrl+x` | Copy the selected message in `/tree`; otherwise copy the last assistant message, or the active fullscreen text selection when `fullscreenCopyOnSelect` is disabled |
209
+ | `app.message.copy` | `ctrl+x` | Copy the selected message in `/tree`; otherwise copy the last assistant message, or the active fullscreen text selection when `fullscreenCopyOnSelect` is disabled. On OAuth sign-in screens, copy the sign-in URL |
203
210
  | `app.message.followUp` | `alt+enter` (`ctrl+q` on Windows and WSL) | Queue follow-up message |
204
211
  | `app.message.dequeue` | `alt+up` (`alt+q` on Windows and WSL) | Restore queued messages to editor |
205
212
 
package/docs/mcp.md CHANGED
@@ -1,10 +1,47 @@
1
1
  # MCP Servers
2
2
 
3
- The MCP integration is provided by [upstream Pi](https://github.com/earendil-works/pi) and included in `@astralyn/pi`. It connects to [Model Context Protocol](https://modelcontextprotocol.io) servers over stdio or streamable HTTP and makes their tools available to the model.
3
+ The MCP integration is provided by [upstream Pi](https://github.com/earendil-works/pi) and included in `@astralyn/pi`. It connects to [Model Context Protocol](https://modelcontextprotocol.io) servers over stdio or streamable HTTP and makes their tools and resources available to the model.
4
+
5
+ ## Quick setup
6
+
7
+ Add a local stdio server, check the connection, then start Pi:
8
+
9
+ ```bash
10
+ pi mcp add filesystem -- npx -y @modelcontextprotocol/server-filesystem .
11
+ pi mcp list
12
+ pi
13
+ ```
14
+
15
+ For a remote server:
16
+
17
+ ```bash
18
+ pi mcp add docs --url https://example.com/mcp --bearer-token-env-var DOCS_TOKEN
19
+ pi mcp list
20
+ ```
21
+
22
+ These commands add user-level servers by default. Add `--local` or `-l` to write the project configuration instead:
23
+
24
+ ```bash
25
+ pi mcp add -l tools --env API_KEY='${TOOLS_KEY}' -- uvx tools-mcp
26
+ ```
27
+
28
+ Use `/mcp` inside an interactive session to inspect connections, sign in, reconnect, change exposure, or enable and disable servers. Run `/reload` after adding, removing, or changing a server outside the session.
4
29
 
5
30
  ## Configure servers
6
31
 
7
- Add servers to `~/.pi/agent/mcp.json`, or to `.pi/mcp.json` in a project. The format matches other MCP clients, so existing `mcpServers` entries can be copied over:
32
+ Pi reads user-level servers from `~/.pi/agent/mcp.json` and project servers from `.pi/mcp.json`. Project configuration is read only after [project trust](security.md#project-trust) is granted. A project entry replaces a user-level entry with the same name.
33
+
34
+ A project entry without `command`, `url`, or `type` overrides only `enabled`, `exposure`, and `toolExposure` of the user-level server with the same name and keeps the rest, including `env`, `headers`, and `auth`. For example, this turns off a user-level server in one project:
35
+
36
+ ```json
37
+ {
38
+ "mcpServers": {
39
+ "internal-tools": { "enabled": false }
40
+ }
41
+ }
42
+ ```
43
+
44
+ The format matches other MCP clients:
8
45
 
9
46
  ```json
10
47
  {
@@ -16,77 +53,66 @@ Add servers to `~/.pi/agent/mcp.json`, or to `.pi/mcp.json` in a project. The fo
16
53
  "docs": {
17
54
  "url": "https://example.com/mcp",
18
55
  "headers": { "Authorization": "Bearer ${DOCS_TOKEN}" },
19
- "exposure": "direct"
56
+ "description": "Search and read the product documentation"
20
57
  }
21
58
  }
22
59
  }
23
60
  ```
24
61
 
25
- - stdio servers take `command`, `args`, `env`, and `cwd`. Relative `cwd` resolves against the session directory. A leading `~/` in `command`, an argument, or `cwd` names the home directory.
26
- - HTTP servers take `url`, `headers`, and `oauth` (see [Sign in with OAuth](#sign-in-with-oauth)). The legacy SSE transport is not supported.
27
- - `env` and `headers` values can reference environment variables (`${NAME}`) or commands (`!command`), like provider API keys.
28
- - `timeout` sets the per-request timeout in seconds (default 60). Progress notifications from the server reset it.
29
- - `enabled: false` keeps an entry without connecting to it.
62
+ Stdio servers use `command`, `args`, `env`, and `cwd`. Relative `cwd` values resolve against the session directory. A leading `~/` in `command`, an argument, or `cwd` names the home directory.
30
63
 
31
- Project entries replace global entries with the same name. A project `mcp.json` is only read after the project is trusted, because stdio servers run commands.
64
+ HTTP servers use `url`, `headers`, and `oauth` (see [Authenticate with OAuth](#authenticate-with-oauth)). The legacy SSE transport is not supported.
32
65
 
33
- `pi mcp add` and `pi mcp remove` edit the file from a shell (see [MCP commands](usage.md#mcp-commands)):
66
+ Both server types support:
34
67
 
35
- ```bash
36
- pi mcp add filesystem -- npx -y @modelcontextprotocol/server-filesystem .
37
- pi mcp add docs --url https://example.com/mcp --bearer-token-env-var DOCS_TOKEN --exposure direct
38
- pi mcp add -l tools --env API_KEY='${TOOLS_KEY}' -- uvx tools-mcp
39
- pi mcp remove docs
40
- ```
68
+ - `timeout`: per-request timeout in seconds (default 60). Progress notifications reset it.
69
+ - `enabled: false`: keep the entry without connecting to it.
70
+ - `exposure` and `toolExposure`: control how tools reach the model (see [Control tool exposure](#control-tool-exposure)).
71
+ - `description`: what the server offers, in a sentence. It lists the server in the system prompt (see [Control tool exposure](#control-tool-exposure)), tool search ranks the server's tools by it, and codemode's `describeNamespace()` returns it. Without it, the first line of the server instructions is used once the server connects.
72
+
73
+ Keep personal servers and servers with credentials in the user-level file. Use the project file only for servers the project requires, and only in trusted projects.
41
74
 
42
- Rules that are easy to get wrong:
75
+ ### Configuration rules
43
76
 
44
- - Server names may only contain letters, digits, `_`, and `-`. Tools are named `mcp__<server>__<tool>`.
45
- - `type` is optional: a `command` makes a stdio server and a `url` a streamable HTTP server. When present, it must be `stdio`, `http`, or `streamable-http`. `sse` is rejected; most servers that document an SSE endpoint also serve streamable HTTP, often at `/mcp` instead of `/sse`.
46
- - `command` is a single executable and `args` its arguments, not one shell string.
47
- - Keep secrets out of the file: use `${NAME}` for environment variables, as in `"Authorization": "Bearer ${GITHUB_TOKEN}"`, or `!command` to run a command. A command must make up the whole value, so it has to print the header value itself: `"Authorization": "!echo Bearer $(gh auth token)"`.
48
- - Invalid entries are skipped and reported; the other servers still connect.
77
+ - Server names may contain only letters, digits, `_`, and `-`. Tools are named `mcp__<server>__<tool>`, with every character other than letters, digits, and `_` replaced by `_`; tools of a server whose names then collide all get a hash suffix. Server names that differ only in `-` and `_` count as the same server: a second one is rejected, and a `mcp.json` server overrides a registered one.
78
+ - `type` is optional. A `command` selects stdio and a `url` selects streamable HTTP. When present, `type` must be `stdio`, `http`, or `streamable-http`.
79
+ - `sse` is rejected. Servers that document an SSE endpoint often also provide streamable HTTP, commonly at `/mcp` instead of `/sse`.
80
+ - `command` is one executable and `args` contains its arguments. It is not a shell command string.
81
+ - `env` and `headers` values can use environment variables such as `${GITHUB_TOKEN}`. They can also run a command with `!command`, but the command must make up the whole value, for example `"Authorization": "!echo Bearer $(gh auth token)"`.
82
+ - Invalid entries are reported and skipped without preventing other servers from connecting.
49
83
 
50
- ## Set up servers
84
+ `pi mcp add` and `pi mcp remove` cover common changes from a shell. See [MCP commands](usage.md#mcp-commands) for their options.
51
85
 
52
- When asked to add an MCP server, the agent should:
86
+ ### Inspect or change a server
53
87
 
54
- 1. Add simple servers with `pi mcp add` (add `-l` for the project file), or edit `mcp.json` directly for settings the command does not cover. Put personal servers and servers with credentials in `~/.pi/agent/mcp.json`. Use the project `.pi/mcp.json` only for servers the project itself needs, and only in trusted projects.
55
- 2. Convert entries written for other clients:
56
- - Claude Desktop, Claude Code, and Cursor use the same `mcpServers` shape; copy the entry.
57
- - VS Code uses a top-level `servers` object and `inputs` prompts; move the entry under `mcpServers` and replace `${input:...}` with `${NAME}` environment variables.
58
- - Codex uses TOML (`[mcp_servers.<name>]` with `command`, `args`, `env`, or `url`); write the same fields as JSON.
59
- - opencode uses `"type": "local"` with `command` as an array (split it into `command` and `args`), `"type": "remote"` for URLs, `environment` for `env`, and `{env:NAME}` for `${NAME}`.
60
- 3. Run `pi mcp list` to check the entry. It connects to every enabled server and prints the state, the tools, and errors such as the stderr of a stdio server that failed to start. It exits with 1 while anything is wrong.
61
- 4. For a server that needs a sign-in, run `pi mcp login <server>`. It opens the authorization page in the user's browser and waits until the user approves access; tell the user to approve it. A running session uses the new credentials on its next turn.
62
- 5. Tell the user to run `/reload` (or start a new session) so the running session connects to added or changed servers.
88
+ `/mcp` lists configured servers with their state, tool count, exposure, and configuration source. Servers that need attention appear first. Select a server to inspect its tools and connection details, reconnect, sign in or out, change exposure, or enable and disable it.
63
89
 
64
- Pi connects when a session starts. The first prompt waits up to 10 seconds for startup connections; the tools of servers that take longer become available once they connect. HTTP connections that fail with a network error or a transient status (408, 429, 5xx) are retried twice. A server that drops its connection shows as disconnected and is reconnected on the next call. When a server announces that its tool list changed, new tools are added and withdrawn tools become unreachable until the server offers them again.
90
+ Exposure and enabled-state changes are saved to the file that defines the server without replacing unrelated content. In a trusted project, "Enable in this project" and "Disable in this project" add a project override for a user-level server; later changes to that server are saved to the override. Disabled servers remain listed. Outside the interactive TUI, `/mcp` prints server status; `/mcp login <server>`, `/mcp logout <server>`, and `/mcp reconnect <server>` perform those actions directly.
65
91
 
66
- Config errors, servers that failed to connect, and servers that need a sign-in are reported once after startup.
92
+ Shell commands work without a session: `pi mcp add`, `pi mcp remove`, `pi mcp list`, `pi mcp login`, and `pi mcp logout`. Shell commands do not load extensions.
67
93
 
68
- Log messages servers send with MCP logging notifications are appended to `~/.pi/agent/mcp.log` as `<time> [<server>] <level> <logger>: <message>`. The file is moved to `mcp.log.1` when it grows past 5 MB.
94
+ ### Diagnose connection problems
69
95
 
70
- ## Manage servers
96
+ Run `pi mcp list` to connect to every enabled server and print its state, tools, and errors. It exits with status 1 when an entry is invalid or an enabled server is not connected. `/mcp` shows the full connection error and the tail of stderr from a failed stdio server.
71
97
 
72
- `/mcp` opens the server manager. It lists every configured server with its state, tool count, exposure, and whether it comes from the global or the project `mcp.json`; servers that need attention come first. Select a server to:
98
+ Pi reports configuration errors, failed connections, and required sign-ins once after startup. Server logging notifications are appended to `~/.pi/agent/mcp.log` as `<time> [<server>] <level> <logger>: <message>`. The file moves to `mcp.log.1` after it grows past 5 MB.
73
99
 
74
- - sign in, for OAuth servers that need it (see [Sign in with OAuth](#sign-in-with-oauth))
75
- - see its tools, its command or URL, and the full connection error, including the tail of a stdio server's stderr
76
- - reconnect
77
- - sign out, which deletes the stored OAuth credentials
78
- - change its exposure (see [Exposure](#exposure))
79
- - disable or enable it
100
+ Pi connects every enabled server in the background when a session starts. A server's tools appear once it connects; the `codemode` description does not list them, so it does not change when servers connect. The first prompt waits up to 10 seconds only for servers with `direct` tools, which must be declared in its request. Other servers are waited for when they are needed: a codemode script waits for the servers it names (`mcp__<server>`) and, when it calls `searchTools()` or reads `ALL_TOOLS`, for all of them; `tool_search` and the resource tools also wait for all of them. HTTP network errors and transient statuses (408, 429, and 5xx) are retried twice. A dropped connection is shown as disconnected and reconnects on the next call. When a server announces a changed tool list, new tools are added and withdrawn tools become unreachable.
80
101
 
81
- Exposure changes and enabling or disabling are saved to the `mcp.json` that defines the server; other content of the file is kept. Disabled servers stay listed so they can be enabled again.
102
+ Stopping a stdio server closes its stdin, sends SIGTERM, then sends SIGKILL to its process group. This also stops servers launched through wrappers such as `npx` or `uvx`.
82
103
 
83
- Outside the interactive TUI, `/mcp` prints the server status. `/mcp login <server>`, `/mcp logout <server>`, and `/mcp reconnect <server>` run those actions directly.
104
+ ## Migrate configuration from another client
84
105
 
85
- From a shell, `pi mcp add`, `pi mcp remove`, `pi mcp list`, `pi mcp login <server>`, and `pi mcp logout <server>` manage servers without a session (see [MCP commands](usage.md#mcp-commands)).
106
+ Move the converted entry under `mcpServers` in `mcp.json`, then run `pi mcp list` to validate it.
86
107
 
87
- Stopping a stdio server closes its stdin, then sends SIGTERM and finally SIGKILL to its whole process group, so servers started through wrappers such as `npx` or `uvx` do not linger.
108
+ | Client | Conversion |
109
+ |---|---|
110
+ | Claude Desktop, Claude Code, or Cursor | Copy the existing `mcpServers` entry. |
111
+ | VS Code | Move an entry from the top-level `servers` object and replace `${input:...}` prompts with `${NAME}` environment variables. |
112
+ | Codex | Convert `[mcp_servers.<name>]` TOML fields such as `command`, `args`, `env`, and `url` to JSON. |
113
+ | OpenCode | Convert `"type": "local"` to a stdio entry, split its `command` array into `command` and `args`, rename `environment` to `env`, and replace `{env:NAME}` with `${NAME}`. Convert `"type": "remote"` to a URL entry. |
88
114
 
89
- ## Sign in with OAuth
115
+ ## Authenticate with OAuth
90
116
 
91
117
  Remote servers that use OAuth, such as Sentry, need no credentials in `mcp.json`:
92
118
 
@@ -98,11 +124,13 @@ Remote servers that use OAuth, such as Sentry, need no credentials in `mcp.json`
98
124
  }
99
125
  ```
100
126
 
101
- When such a server rejects the connection, `/mcp` shows it as needing sign-in. Select it and choose "Sign in" (or run `/mcp login sentry`, or `pi mcp login sentry` in a shell) to open the authorization page in your browser. After you approve access, the browser redirects to a temporary server on `127.0.0.1` and pi connects. If the browser runs on another machine, for example over SSH, paste the URL it was redirected to into the sign-in screen instead.
127
+ When the server rejects an unauthenticated connection, `/mcp` shows that it needs sign-in. Select "Sign in", run `/mcp login sentry`, or run `pi mcp login sentry`. Pi opens the authorization page and waits for approval. If the browser runs on another machine, such as over SSH, paste its redirected URL into the sign-in screen. A running session uses the new credentials on its next turn.
102
128
 
103
- Pi registers itself with the authorization server (dynamic client registration), stores tokens in `~/.pi/agent/mcp-auth.json`, and refreshes access tokens automatically when they expire or the server rejects them. If the server later asks for more scope than was granted, it shows as needing sign-in again, and signing in requests the new scope. "Sign out" in `/mcp` (or `/mcp logout sentry`) deletes the stored credentials.
129
+ Pi registers itself with the authorization server, stores tokens in `~/.pi/agent/mcp-auth.json`, and refreshes access tokens when they expire or the server rejects them. If a server later requests additional scope, Pi asks for sign-in again. Signing out deletes the stored credentials.
104
130
 
105
- OAuth applies to HTTP servers without an `Authorization` header. For authorization servers that do not support dynamic client registration, configure a pre-registered client:
131
+ Credentials belong to a server name and URL. Servers with the same URL under different names, such as one per account, sign in separately; servers with the same name and URL in different `mcp.json` files share one sign-in.
132
+
133
+ OAuth applies to HTTP servers without an `Authorization` header. For a server that does not support dynamic client registration, configure a registered client:
106
134
 
107
135
  ```json
108
136
  {
@@ -115,21 +143,67 @@ OAuth applies to HTTP servers without an `Authorization` header. For authorizati
115
143
  }
116
144
  ```
117
145
 
118
- The redirect URI must match the one registered for the client. `callbackPort` fixes it to `http://127.0.0.1:<port>/callback`. For another redirect URI, set `callbackUrl`, for example `"callbackUrl": "http://localhost:8080/oauth/callback"`. It must be an `http` URI on `localhost`, `127.0.0.1`, or `[::1]`, and is sent exactly as written. Without a port in `callbackUrl`, pi listens on `callbackPort`, or on a free port, and adds it to the URI; authorization servers accept any port for loopback redirects (RFC 8252). `clientSecret` is optional and can reference environment variables or commands.
146
+ The redirect URI must match the registered URI. `callbackPort` uses `http://127.0.0.1:<port>/callback`. To use another URI, set `callbackUrl`; it must use HTTP on `localhost`, `127.0.0.1`, or `[::1]`. Pi sends it exactly as written. When `callbackUrl` omits a port, Pi uses `callbackPort` or a free port and adds it to the URI, as allowed for loopback redirects by RFC 8252. `clientSecret` is optional and can use an environment variable or command.
147
+
148
+ Set `scope` to a space-separated list for servers that do not advertise their required scopes. Otherwise, Pi requests the advertised scopes. Later scope requests are added to the configured value.
149
+
150
+ Pi registers as `pi`. Some servers only accept registrations from known clients. Set `clientName` to send another name:
151
+
152
+ ```json
153
+ {
154
+ "mcpServers": {
155
+ "figma": { "url": "https://mcp.figma.com/mcp", "oauth": { "clientName": "Claude Code" } }
156
+ }
157
+ }
158
+ ```
159
+
160
+ The name is only sent when Pi registers a client. To register again under a new name, sign out first.
161
+
162
+ Some authorization servers allow clients by their Client ID Metadata Document URL instead of registering them. Set `clientRegistration` to `cimd` to identify as Pi's document on pi.dev instead of registering:
163
+
164
+ ```json
165
+ {
166
+ "mcpServers": {
167
+ "example": { "url": "https://mcp.example.com/mcp", "oauth": { "clientRegistration": "cimd" } }
168
+ }
169
+ }
170
+ ```
171
+
172
+ The client ID is `https://pi.dev/oauth/client.json` with the redirect URI `http://127.0.0.1:<port>/callback`. If the authorization server does not send the `iss` parameter in authorization responses (RFC 9207), Pi uses a document and redirect path specific to the MCP server instead: `https://pi.dev/oauth/<id>/client.json` with `http://127.0.0.1:<port>/callback/<id>`. The authorization server must advertise Client ID Metadata Document support and public clients, or sign-in fails. `cimd` cannot be combined with `clientId` or `clientName`, and a `callbackUrl` must use `localhost` or `127.0.0.1` with the path `/callback`.
173
+
174
+ Pi finds the authorization server through the server's protected resource metadata (RFC 9728) and checks that the authorization server's metadata names the expected issuer (RFC 8414). Some servers advertise the wrong authorization server or none, so sign-in opens a page that does not exist. Set `authServerMetadataUrl` to the metadata document of the right authorization server:
175
+
176
+ ```json
177
+ {
178
+ "mcpServers": {
179
+ "example": {
180
+ "url": "https://mcp.example.com/mcp",
181
+ "oauth": { "authServerMetadataUrl": "https://example.okta.com/.well-known/openid-configuration" }
182
+ }
183
+ }
184
+ }
185
+ ```
186
+
187
+ Pi uses that document instead of discovery and trusts it as configured, so only point it at a document you trust. The URL must use HTTPS, except on `localhost`, `127.0.0.1`, or `[::1]`.
188
+
189
+ ## Control tool exposure
190
+
191
+ Each server tool is registered as `mcp__<server>__<tool>`. The server's `exposure` determines how the model reaches it:
119
192
 
120
- `scope` sets the scopes to request, separated by spaces, for servers that do not advertise the ones they need. Without it, pi requests the scopes the server advertises. When a server later asks for more scope, pi requests those on top of `scope`.
193
+ | Exposure | Behavior | Typical use |
194
+ |---|---|---|
195
+ | `codemode` (default) | Callable from [`codemode`](usage.md#codemode-and-tool-search) scripts, but neither declared to the model nor listed in the codemode description. Scripts find tools with `searchTools()`, `describeTool()`, or `ALL_TOOLS`. | General MCP servers, especially when scripts should combine or filter calls. |
196
+ | `deferred` | Not declared until [`tool_search`](usage.md#codemode-and-tool-search) loads a match for the next model call. | Large servers whose tools should be called directly after discovery. |
197
+ | `direct` | Declared to the model like a built-in tool and also callable from codemode. | Small, frequently used tool sets. |
198
+ | `hidden` | Registered but unreachable. | Servers or tools that should remain unavailable. |
121
199
 
122
- ## Exposure
200
+ `codemode-deferred` is accepted as an alias for `codemode`.
123
201
 
124
- Each server's tools are registered as `mcp__<server>__<tool>`. The `exposure` setting controls how the model reaches them:
202
+ Servers with `codemode` or `deferred` tools are listed in the `mcp_servers` section of the system prompt, with how their tools are reached and one line from the configured `description` or, once connected, from the server instructions. Pi updates the section when a prompt starts, after waiting for servers with `direct` tools. When it changed, for example because a server connected and its summary became available, Pi appends the new section to the conversation instead of changing tool declarations, so earlier messages stay cached. `describeNamespace()` and the `namespace` option of `searchTools()` accept `mcp__dev-radius`, `mcp__dev_radius`, `dev-radius`, or `dev_radius`.
125
203
 
126
- - `codemode` (default): the tools are callable from [`codemode`](usage.md#tools) scripts and listed in the `codemode` tool's description, but are not declared to the model. Large MCP tool lists stay out of the model's tool declarations, and scripts can call several MCP tools, in parallel if needed, while returning only the part of the result the model needs. Pi activates the `codemode` tool when such a server connects. Large servers do not fill the description: declarations share a token budget, and scripts find the remaining tools with `searchTools()` (see [`codemode`](usage.md#tools)).
127
- - `codemode-deferred`: like `codemode`, but the tools are not listed in the `codemode` tool's description either; it only names the server and its tool count. Scripts call them by name and find them with `searchTools()` or in `ALL_TOOLS`. Use it for large servers that codemode scripts use rarely.
128
- - `deferred`: the tools are not declared to the model until the [`tool_search`](usage.md#tools) tool loads them. The model searches, and the matches are declared from its next call on and called directly, without codemode. Pi activates the `tool_search` tool when such a server connects. Use it for large servers without codemode.
129
- - `direct`: the tools are declared to the model like built-in tools, and are also callable from codemode.
130
- - `hidden`: the tools are registered but cannot be called.
204
+ Pi activates `codemode` when a server with `codemode` exposure connects. It activates `tool_search` for a server with `deferred` exposure. To make the model see a tool without searching, give it `direct` exposure with `toolExposure`.
131
205
 
132
- `toolExposure` sets the exposure of single tools and overrides `exposure` for them. Keys are tool names as the server offers them, or patterns where `*` matches any characters. An exact name wins over patterns; among patterns, the first match in the object wins. With `hidden` as the server's exposure, only the listed tools are reachable:
206
+ `toolExposure` overrides the server exposure for individual tools. Keys are exact server tool names or patterns where `*` matches any characters. Exact names win over patterns; among patterns, the first match wins. A server with `hidden` exposure can expose only selected tools:
133
207
 
134
208
  ```json
135
209
  {
@@ -147,42 +221,50 @@ Each server's tools are registered as `mcp__<server>__<tool>`. The `exposure` se
147
221
  }
148
222
  ```
149
223
 
150
- `pi mcp list` marks tools whose exposure differs from the server's, and the Tools view in `/mcp` shows it too.
224
+ `pi mcp list` marks tools whose exposure differs from their server. The Tools view in `/mcp` also shows the effective exposure.
151
225
 
152
- Tools that are not declared (`codemode`, `codemode-deferred`, and `deferred` exposure) are reachable through either tool: codemode scripts can call all of them, and `tool_search` can load any of them. For example, with `codemode` active, scripts can call the tools of a `deferred` server, and with `tool_search` active, the model can load the tools of a `codemode` server.
226
+ Tools with `codemode` or `deferred` exposure can be reached through either indirect mechanism: codemode scripts can call them, and `tool_search` can load them. Codemode calls do not depend on the active tool set, so they remain available after `/tree`, resume, and fork. Tools loaded by `tool_search` are recorded in the transcript and remain declared on that branch.
153
227
 
154
- Tools called from codemode scripts do not depend on the active tool set, so they stay callable after `/tree`, resume, and fork. Tools loaded by `tool_search` are recorded in the transcript like any other tool change and stay declared on that branch. To keep `codemode` active without MCP servers too, add `"defaultTools": ["+codemode"]` to [settings](settings.md#tools). To keep pi from activating the `codemode` tool, set `"autoEnableCodemode": false` at the top level of `mcp.json`, next to `mcpServers`. A project `mcp.json` value overrides the global one. Pi warns once when neither `codemode` nor `tool_search` is active, since the tools then cannot be called.
228
+ To keep `codemode` active without MCP servers, add `"defaultTools": ["+codemode"]` to [settings](settings.md#tools). To prevent automatic codemode activation, set `"autoEnableCodemode": false` beside `mcpServers`. A project value overrides the user-level value. Pi warns once when neither `codemode` nor `tool_search` is active and non-direct tools cannot be called.
155
229
 
156
- Text results over 20KB reach the model with the middle cut out, in the format Codex uses: the start and end of the text around a `…N chars truncated…` marker. The full text is saved to a temp file whose path the result names. Codemode scripts always receive the whole result, so a script can filter a large result down to what the model needs.
230
+ Text results over 20 KB reach the model with their middle removed around a `…N chars truncated…` marker. The full text is saved to a temporary file named in the result. Codemode scripts receive the complete result and can reduce it before returning output to the model.
157
231
 
158
- Codemode scripts receive an MCP tool's whole `CallToolResult` (`content` blocks as sent by the server, `structuredContent`, and `isError`), and the `codemode` description declares it as `CallToolResult<T>`. A result with `isError` resolves in scripts and is reported to the model as an error for direct calls. `image(result.content[0])` forwards an image block to the model. The server's `instructions` describe its tools in the `codemode` description.
232
+ Codemode scripts receive the complete MCP `CallToolResult`, including `content`, `structuredContent`, and `isError`. A result with `isError` resolves inside scripts but is reported as an error for direct calls. `image(result.content[0])` forwards an image block. Server instructions are not part of any tool description; scripts read them with `describeNamespace("mcp__<server>")`, which also returns the server's tool names.
159
233
 
160
- ## Resources
234
+ ## Use resources
161
235
 
162
- When a connected server offers [resources](https://modelcontextprotocol.io/specification/2025-11-25/server/resources), pi adds the resource tools Codex and opencode use:
236
+ When a connected server offers [resources](https://modelcontextprotocol.io/specification/2025-11-25/server/resources), Pi adds the resource tools used by Codex and OpenCode:
163
237
 
164
- - `list_mcp_resources` lists resources as JSON: `{ server?, resources: [{ server, uri, name, ... }], nextCursor? }`. With `server`, it lists one page of that server, and `cursor` continues with the next one. Without, it lists every resource of every server.
165
- - `list_mcp_resource_templates` lists URI templates for resources the servers do not list, in the same way.
166
- - `read_mcp_resource` reads a resource given `server` and `uri`. Text resources reach the model as text and images as images; other binary resources are saved to temp files, and the model sees the file path. Scripts receive `{ server, uri, contents }`.
238
+ - `list_mcp_resources` lists resources as JSON: `{ server?, resources: [{ server, uri, name, ... }], nextCursor? }`. With `server`, it lists one page; `cursor` continues with the next page. Without `server`, it lists every resource from every server.
239
+ - `list_mcp_resource_templates` lists URI templates for resources the servers do not list directly.
240
+ - `read_mcp_resource` reads a resource by `server` and `uri`. Text reaches the model as text and images as images. Other binary resources are saved to temporary files, and the model receives the path. Scripts receive `{ server, uri, contents }`.
167
241
 
168
- The tools reach every enabled server with resources whose exposure is not `hidden`, and take the widest exposure among them: `direct` if one of the servers is direct, else `codemode`, else `codemode-deferred`, else `deferred`. Resource links in tool results name `read_mcp_resource` and the server.
242
+ These tools reach every enabled, non-hidden server with resources. Their exposure is the widest exposure among those servers: `direct`, then `codemode` or `deferred`. Resource links in tool results identify `read_mcp_resource` and the server.
169
243
 
170
- Resources for MCP Apps (`ui://` URIs or `text/html;profile=mcp-app`) are left out of the listings, since pi does not render them, and so are resource icons.
244
+ Resources for MCP Apps, identified by `ui://` URIs or `text/html;profile=mcp-app`, are omitted because Pi does not render them. Resource icons are also omitted.
171
245
 
172
- Reading and listing resources is retried once after a transient HTTP error (408, 429, 5xx). Tool calls are not retried, since the server may have run them.
246
+ Reading and listing resources is retried once after a transient HTTP error (408, 429, or 5xx). Tool calls are not retried because the server may already have performed them.
173
247
 
174
248
  ## Permissions
175
249
 
176
- Every MCP call goes through pi's tool pipeline, so `tool_call` and `tool_result` extension handlers, including permission gates, apply to MCP tools. Calls made from codemode scripts carry the `codemode` call's id as `parentToolCallId`. `pi.getAllTools()` reports the tool annotations servers declare (`readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`), so a permission extension can confirm only calls that change something (see [Extensions](extensions.md#tool-exposure)). The resource tools are marked read-only.
250
+ Every MCP call passes through Pi's tool pipeline. Extension `tool_call` and `tool_result` handlers, including permission gates, therefore apply to MCP tools. Calls made from codemode scripts carry the codemode call ID as `parentToolCallId`.
251
+
252
+ `pi.getAllTools()` reports the annotations declared by each server: `readOnlyHint`, `destructiveHint`, `idempotentHint`, and `openWorldHint`. Permission extensions can use these hints to decide which calls require confirmation (see [Tool exposure](extensions.md#tool-exposure)). Resource tools are marked read-only.
253
+
254
+ ## Extensions and SDK
255
+
256
+ ### Add servers from extensions
257
+
258
+ Extensions can add servers for the current session with `pi.registerMcpServer(name, config)`, using the same shape as an `mcpServers` entry (see [MCP servers in extensions](extensions.md#mcp-servers)). Registered servers connect like configured servers and appear in `/mcp` with the extension as their source.
177
259
 
178
- ## Servers from extensions
260
+ Changes to enabled state or exposure apply only to the current session. A file-configured server with the same name takes precedence, and `/mcp` lists the overridden registration. `pi mcp` shell commands do not load extensions and only see file-configured servers.
179
261
 
180
- Extensions can add servers for the current session with `pi.registerMcpServer(name, config)`, using the same config shape as `mcp.json` (see [Extensions](extensions.md#mcp-servers)). They connect like configured servers and appear in `/mcp` with the extension as their source. Enabling, disabling, and exposure changes for them apply to the current session only. A server in `mcp.json` with the same name takes precedence; `/mcp` lists the overridden registration. `pi mcp` shell commands do not load extensions and only see `mcp.json` servers.
262
+ ### Replace the built-in MCP support
181
263
 
182
- ## Other MCP extensions
264
+ An installed extension that registers `/mcp`, such as `pi-mcp-adapter`, replaces the built-in MCP support for sessions. Pi then does not read `mcp.json` or connect its servers in a session, and `/mcp` belongs to the extension. Remove the extension to restore the built-in behavior. To disable built-in MCP support without a replacement, disable `mcp` under Built-in in `pi config`, or set `"extensions": ["-builtin:mcp"]` in [settings](settings.md#resources).
183
265
 
184
- An installed extension that registers the `/mcp` command, such as `pi-mcp-adapter`, replaces the built-in MCP support: pi then neither reads `mcp.json` in sessions nor connects servers, and `/mcp` belongs to that extension. Remove the extension to use the built-in support. To turn off the built-in support without installing another extension, disable `mcp` under Built-in in `pi config`, or set `"extensions": ["-builtin:mcp"]` in [settings](settings.md#resources); `pi mcp` shell commands still work. Likewise, an extension that registers a tool named `codemode` or `tool_search` replaces the built-in tool of that name. `pi mcp` shell commands always use the built-in support.
266
+ An extension that registers `codemode` or `tool_search` similarly replaces the built-in tool with that name. Shell-level `pi mcp` commands always use the built-in implementation.
185
267
 
186
- ## SDK
268
+ ### Use MCP from the SDK
187
269
 
188
- SDK sessions do not load the built-in extensions. Add the MCP extension, the codemode extension for `codemode` and `codemode-deferred` servers, and the tool search extension for `deferred` servers to the resource loader. See [SDK](sdk.md#codemode-mcp).
270
+ SDK sessions do not load built-in extensions. Add the MCP extension, the codemode extension for `codemode` servers, and the tool-search extension for `deferred` servers to the resource loader. See [Codemode and MCP](sdk.md#codemode-mcp).
package/docs/models.md CHANGED
@@ -247,6 +247,7 @@ A `models` entry supplies a complete custom model definition with useful default
247
247
  | `inputLimits` | No | omitted | Request limits and image preprocessing for this model; see [Image Input Limits](#image-input-limits). |
248
248
  | `contextWindow` | No | `128000` | Context window in tokens. |
249
249
  | `maxTokens` | No | `16384` | Maximum generated tokens. |
250
+ | `samplingParamsByThinkingLevel` | No | omitted | Per-level sampling overrides; see [Configure sampling by thinking level](#configure-sampling-by-thinking-level). |
250
251
  | `samplingParams` | No | omitted | Free-form sampling parameters merged verbatim into every request body; see [Sampling Parameters](#sampling-parameters). |
251
252
  | `cost` | No | all rates `0` | Per-million-token rates and optional request-wide price tiers. |
252
253
  | `promptCache` | No | omitted | Best-effort prompt cache lifetime in seconds per retention tier; see [Prompt Cache Lifetimes](#prompt-cache-lifetimes). |
@@ -337,6 +338,32 @@ Only OpenAI-compatible APIs apply it (`openai-completions`, `openai-responses`,
337
338
 
338
339
  A constant thinking-token cap can go here too, but it will not follow `thinkingBudgets` or leave room for the answer. Prefer `compat.thinkingTokenBudgetField` (or the `supportsThinkingTokenBudget` alias) for that.
339
340
 
341
+ ### Configure sampling by thinking level
342
+
343
+ OpenAI-compatible APIs support free-form `samplingParams` model defaults and `samplingParamsByThinkingLevel` overrides. The latter uses Pi thinking-level keys (`off`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`), not provider values from `thinkingLevelMap`:
344
+
345
+ ```json
346
+ {
347
+ "id": "qwen-thinking-model",
348
+ "reasoning": true,
349
+ "samplingParams": {
350
+ "temperature": 1.0,
351
+ "top_p": 0.95
352
+ },
353
+ "samplingParamsByThinkingLevel": {
354
+ "off": {
355
+ "temperature": 0.7,
356
+ "top_p": 0.8
357
+ },
358
+ "high": {
359
+ "top_k": 20
360
+ }
361
+ }
362
+ }
363
+ ```
364
+
365
+ Pi first clamps unsupported thinking levels, then merges model `samplingParams`, the effective level's override, and request-level `samplingParams` in that order. Later values win per key. Missing levels inherit the model defaults. `modelOverrides` merges per-level entries per key with the base model. These fields apply only to `openai-completions`, `openai-responses`, and `azure-openai-responses`; other APIs ignore them.
366
+
340
367
  ### Thinking Level Map
341
368
 
342
369
  `thinkingLevelMap` uses these Pi levels: `off`, `minimal`, `low`, `medium`, `high`, `xhigh`, and `max`. It only affects a model with `reasoning: true`; a non-reasoning model exposes `off` only.
@@ -434,7 +461,7 @@ The built-in models remain. A new custom `id` is added, while a matching ID is r
434
461
  }
435
462
  ```
436
463
 
437
- An override supports `name`, `reasoning`, `thinkingLevelMap`, `input`, `inputLimits`, `cost`, `promptCache` (merged per tier), `contextWindow`, `maxTokens`, `samplingParams` (merged per key), `headers`, and `compat`. Its `cost` base rates are individually optional and retain omitted values; a supplied `tiers` array replaces the existing array. Thinking maps merge by level. `inputLimits` deep-merges down to the `images.resize` profile. `compat` merges by field, and its `openRouterRouting`, `vercelGatewayRouting`, and `chatTemplateKwargs` objects merge by key.
464
+ An override supports `name`, `reasoning`, `thinkingLevelMap`, `input`, `inputLimits`, `cost`, `promptCache` (merged per tier), `contextWindow`, `maxTokens`, `samplingParams` (merged per key), `samplingParamsByThinkingLevel` (merged per level and key), `headers`, and `compat`. Its `cost` base rates are individually optional and retain omitted values; a supplied `tiers` array replaces the existing array. Thinking maps merge by level. `inputLimits` deep-merges down to the `images.resize` profile. `compat` merges by field, and its `openRouterRouting`, `vercelGatewayRouting`, and `chatTemplateKwargs` objects merge by key.
438
465
 
439
466
  Use a `promptCache` override to enable cache warming through a proxy whose backing cache you know, for example OpenRouter routed to Anthropic:
440
467
 
@@ -676,13 +703,13 @@ For `bedrock-converse-stream`, `compat.supportsStrictMode` controls Bedrock stri
676
703
 
677
704
  ## Use classifier models
678
705
 
679
- Classifier models do not chat. They answer typed questions about JSON state: pick one of several choices, answer yes or no, or give a score, each with probabilities. Pi includes TypeSafe's Jev model from these providers:
706
+ Classifier models do not chat. They answer typed questions about JSON state: pick one of several choices, answer yes or no, or give a score, each with probabilities. Pi includes TypeSafe's Jev model from these providers, and Cloudflare's Clef and Clef Flash models from Workers AI:
680
707
 
681
708
  | Provider | Model IDs | Authentication |
682
709
  |---|---|---|
683
710
  | `typesafe` | `jev-latest` | `TYPESAFE_API_KEY` |
684
711
  | `openrouter` | `typesafe/jev-1.13`, `~typesafe/jev-latest` | `OPENROUTER_API_KEY` or `/login` |
685
- | `cloudflare-workers-ai` | `typesafe/jev` | `CLOUDFLARE_API_KEY` and `CLOUDFLARE_ACCOUNT_ID` |
712
+ | `cloudflare-workers-ai` | `typesafe/jev`, `@cf/cloudflare/clef`, `@cf/cloudflare/clef-flash` | `CLOUDFLARE_API_KEY` and `CLOUDFLARE_ACCOUNT_ID` |
686
713
  | `vercel-ai-gateway` | `typesafe-ai/jev` | `AI_GATEWAY_API_KEY` |
687
714
  | `opencode` | `jev-1.13`, `jev-1.13-free` | `OPENCODE_API_KEY` |
688
715
 
@@ -705,6 +732,27 @@ const result = await models.classify(jev, {
705
732
  return result.answers;
706
733
  ```
707
734
 
735
+ [Codemode](codemode.md#classify) describes the question and answer types.
736
+
708
737
  When the service reports token counts, as all System One services do, `result.usage` carries them with their cost. Pi adds the usage of a script's classifier calls to the `codemode` tool result, so it counts toward the session cost in the footer and `/session`. The cost uses the model's catalog price; models without one, such as TypeSafe's direct `jev-latest`, report tokens at no cost.
709
738
 
710
739
  Extensions call classifiers through `ctx.modelRegistry.classify()`, without codemode. [Virtual models](virtual-models.md#route-requests) can use them to route requests; see the `jev-router.ts` example.
740
+
741
+ ## Use image models
742
+
743
+ Image models generate images from a prompt and optional input images. Pi lists OpenRouter's image models, such as `google/gemini-2.5-flash-image` and `black-forest-labs/flux.2-pro`, under the `openrouter` provider; they use the same `OPENROUTER_API_KEY` or `/login` credential as its chat models.
744
+
745
+ Like classifier models, image models do not appear in `/model`; the model reaches them through the [`codemode`](usage.md#enable-codemode) tool. Scripts list them with `models.getAvailableOfType("image")` and call `models.generateImages(model, { input })`. The result's `output` holds base64 image blocks, which `image()` attaches to the `codemode` result so the model sees them:
746
+
747
+ ```js
748
+ const painter = await models.getModelOfType("image", "openrouter", "google/gemini-2.5-flash-image");
749
+ const result = await models.generateImages(painter, {
750
+ input: [{ type: "text", text: "A red fox in the snow, watercolor" }],
751
+ });
752
+ if (result.stopReason !== "stop") return result.errorMessage;
753
+ for (const block of result.output) if (block.type === "image") image(block);
754
+ ```
755
+
756
+ `input` can also contain `{ type: "image", data, mimeType }` blocks to edit or use as references. Pi adds the usage of a script's image calls to the `codemode` tool result, like classifier calls. Generated images are not saved to disk. [Codemode](codemode.md#generate-images) describes the full API.
757
+
758
+ Extensions generate images through `ctx.modelRegistry.generateImages()`, without codemode.
package/docs/providers.md CHANGED
@@ -35,6 +35,8 @@ Use `/logout` to clear credentials. Tokens are stored in `~/.pi/agent/auth.json`
35
35
 
36
36
  Anthropic subscription auth is active for Claude Pro/Max accounts. Third-party harness usage draws from [extra usage](https://claude.ai/settings/usage) and is billed per token, not against Claude plan limits.
37
37
 
38
+ When the browser runs on another machine, select the copy code login method in `/login anthropic` and paste the code the browser shows.
39
+
38
40
  ### GitHub Copilot
39
41
 
40
42
  - Press Enter for github.com, or enter your GitHub Enterprise Server domain
@@ -60,6 +62,10 @@ Anthropic subscription auth is active for Claude Pro/Max accounts. Third-party h
60
62
 
61
63
  ### Radius
62
64
 
65
+ Radius is a service by Earendil Works, the builders of upstream Pi. It provides an AI gateway with organization-level controls and analytics, and artifacts for sharing what you create with Pi. It is in early alpha; see [radius.earendil.com](https://radius.earendil.com).
66
+
67
+ `/login` lists "Sign in with Radius" as its last top-level option. After a Radius sign-in, `/login` offers to configure the Radius MCP server in the global `mcp.json` with `"auth": { "provider": "radius" }` and reloads, so Pi can manage Radius for you.
68
+
63
69
  Radius is a `pi-messages` gateway. Pi ships the public Radius model catalog for immediate and offline model lookup, then overlays it with the effective gateway catalog after authentication. `/login radius` stores OAuth tokens in `auth.json`; refreshed catalogs are cached in `models-store.json`. Custom Radius gateways can be declared in `models.json` with `"oauth": "radius"` and a gateway `baseUrl`; they do not inherit the public `radius.pi.dev` catalog.
64
70
 
65
71
  ## API Keys
@@ -112,6 +118,8 @@ pi
112
118
  | Xiaomi MiMo Token Plan (Amsterdam) | `XIAOMI_TOKEN_PLAN_AMS_API_KEY` | `xiaomi-token-plan-ams` |
113
119
  | Xiaomi MiMo Token Plan (Singapore) | `XIAOMI_TOKEN_PLAN_SGP_API_KEY` | `xiaomi-token-plan-sgp` |
114
120
 
121
+ Anthropic also recognizes `ANTHROPIC_OAUTH_TOKEN` as an API credential and `ANTHROPIC_AUTH_TOKEN` as bearer authentication. With no key or token set, Anthropic uses workload identity federation when `ANTHROPIC_FEDERATION_RULE_ID`, `ANTHROPIC_ORGANIZATION_ID`, and `ANTHROPIC_IDENTITY_TOKEN_FILE` are set: the Anthropic SDK exchanges the identity token for a short-lived access token and refreshes it itself, re-reading the identity token file, so keep that file fresh for long sessions. `ANTHROPIC_SERVICE_ACCOUNT_ID` and `ANTHROPIC_WORKSPACE_ID` are passed through when set.
122
+
115
123
  See [Environment variables](environment-variables.md) for process configuration and [Auth File](#auth-file) for credential storage.
116
124
 
117
125
  #### Auth File