pi-namespace-patch 0.87.1-namespace.1 → 1.0.0-namespace.2

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 (754) hide show
  1. package/CHANGELOG.md +183 -0
  2. package/README.md +100 -25
  3. package/dist/bun/cli.d.ts.map +1 -1
  4. package/dist/bun/restore-sandbox-env.d.ts.map +1 -1
  5. package/dist/bun/restore-sandbox-env.js.map +1 -1
  6. package/dist/bun/runtime-setup.d.ts.map +1 -1
  7. package/dist/bun/runtime-setup.js +4 -1
  8. package/dist/bun/runtime-setup.js.map +1 -1
  9. package/dist/bun/sandbox-env-setup.d.ts.map +1 -1
  10. package/dist/bundle/chunks/anthropic-messages-UID2PALB.js +6 -0
  11. package/dist/bundle/chunks/anthropic.js +2 -2
  12. package/dist/bundle/chunks/azure-openai-responses-AFMVM6NP.js +2 -0
  13. package/dist/bundle/chunks/bedrock-converse-stream.js +2 -2
  14. package/dist/bundle/chunks/chunk-2KTBZM5G.js +132 -0
  15. package/dist/bundle/chunks/{chunk-WIUZI2CJ.js → chunk-2VNGUWBO.js} +3 -3
  16. package/dist/bundle/chunks/{chunk-FUXEF6JQ.js → chunk-3LH3ZQKY.js} +1 -1
  17. package/dist/bundle/chunks/chunk-4N5K4RKC.js +1204 -0
  18. package/dist/bundle/chunks/chunk-6D7LHLKG.js +2 -0
  19. package/dist/bundle/chunks/chunk-7FH3BDRG.js +82 -0
  20. package/dist/bundle/chunks/chunk-7JGR3GZN.js +11 -0
  21. package/dist/bundle/chunks/chunk-H3QXYIF7.js +31 -0
  22. package/dist/bundle/chunks/chunk-IBCPYVFK.js +19 -0
  23. package/dist/bundle/chunks/chunk-KDN6RCEQ.js +4 -0
  24. package/dist/bundle/chunks/chunk-LD2P6SFZ.js +2 -0
  25. package/dist/bundle/chunks/chunk-LTXEMVMA.js +127 -0
  26. package/dist/bundle/chunks/chunk-MJOHEBV7.js +2 -0
  27. package/dist/bundle/chunks/chunk-OSKPX3Z5.js +2 -0
  28. package/dist/bundle/chunks/chunk-PRD6WYBT.js +16 -0
  29. package/dist/bundle/chunks/{chunk-XDUWOHPL.js → chunk-S3GGRYIO.js} +2 -2
  30. package/dist/bundle/chunks/chunk-UTB4DTYQ.js +2 -0
  31. package/dist/bundle/chunks/chunk-VIV3CWXG.js +2 -0
  32. package/dist/bundle/chunks/cli-QOMC26IJ.js +51 -0
  33. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-NPQN263E.js +2 -0
  34. package/dist/bundle/chunks/codemode-worker.js +354 -0
  35. package/dist/bundle/chunks/execute-GVRSEGHL.js +367 -0
  36. package/dist/bundle/chunks/github-copilot.js +1 -1
  37. package/dist/bundle/chunks/google-generative-ai-APTPZOQL.js +2 -0
  38. package/dist/bundle/chunks/google-vertex-MXCOSOY3.js +2 -0
  39. package/dist/bundle/chunks/{lib-HGQMNYVT.js → lib-TEDK3E5I.js} +2 -2
  40. package/dist/bundle/chunks/llama-cpp-classify-XT44PI3C.js +22 -0
  41. package/dist/bundle/chunks/mistral-conversations-DKVFNQL6.js +5 -0
  42. package/dist/bundle/chunks/openai-chatgpt.js +75 -0
  43. package/dist/bundle/chunks/{openai-codex-responses-QDSOTBBO.js → openai-codex-responses-GK67DQQJ.js} +2 -2
  44. package/dist/bundle/chunks/openai-codex.js +2 -2
  45. package/dist/bundle/chunks/{openai-completions-OBX42CLD.js → openai-completions-JXDDPZ23.js} +2 -2
  46. package/dist/bundle/chunks/openai-responses-CQDDLDQF.js +3 -0
  47. package/dist/bundle/chunks/{openrouter-images-N4XVVFSD.js → openrouter-images-ZVXWCSIM.js} +1 -1
  48. package/dist/bundle/chunks/openrouter.js +2 -2
  49. package/dist/bundle/chunks/pi-logo-animation-MPKZE4EK.js +2 -0
  50. package/dist/bundle/chunks/{pi-messages-GFKBWJHZ.js → pi-messages-TM5SOOIW.js} +2 -2
  51. package/dist/bundle/chunks/radius.js +2 -2
  52. package/dist/bundle/chunks/runtime-2SO2JDWM.js +2 -0
  53. package/dist/bundle/chunks/typesafe-system-one-A4CZTQWZ.js +2 -0
  54. package/dist/bundle/chunks/virtual-modules-3THEGRQQ.js +2 -0
  55. package/dist/bundle/cli-runtime.js +1 -1
  56. package/dist/bundle/index.js +1 -1
  57. package/dist/bundle/rpc-entry.js +1 -1
  58. package/dist/cli/args.d.ts.map +1 -1
  59. package/dist/cli/args.js +6 -5
  60. package/dist/cli/args.js.map +1 -1
  61. package/dist/cli/auth-check.d.ts.map +1 -1
  62. package/dist/cli/auth-check.js.map +1 -1
  63. package/dist/cli/auth-command.d.ts.map +1 -1
  64. package/dist/cli/auth-command.js.map +1 -1
  65. package/dist/cli/config-selector.d.ts.map +1 -1
  66. package/dist/cli/config-selector.js.map +1 -1
  67. package/dist/cli/credential-print.d.ts.map +1 -1
  68. package/dist/cli/credential-print.js.map +1 -1
  69. package/dist/cli/file-processor.d.ts.map +1 -1
  70. package/dist/cli/file-processor.js.map +1 -1
  71. package/dist/cli/initial-message.d.ts +1 -1
  72. package/dist/cli/initial-message.d.ts.map +1 -1
  73. package/dist/cli/initial-message.js.map +1 -1
  74. package/dist/cli/list-models.d.ts.map +1 -1
  75. package/dist/cli/list-models.js.map +1 -1
  76. package/dist/cli/project-trust.d.ts.map +1 -1
  77. package/dist/cli/project-trust.js.map +1 -1
  78. package/dist/cli/session-picker.d.ts.map +1 -1
  79. package/dist/cli/session-picker.js.map +1 -1
  80. package/dist/cli/setup.d.ts.map +1 -1
  81. package/dist/cli/setup.js.map +1 -1
  82. package/dist/cli/startup-ui.d.ts.map +1 -1
  83. package/dist/cli/startup-ui.js +38 -30
  84. package/dist/cli/startup-ui.js.map +1 -1
  85. package/dist/cli.d.ts.map +1 -1
  86. package/dist/config.d.ts +15 -4
  87. package/dist/config.d.ts.map +1 -1
  88. package/dist/config.js +33 -4
  89. package/dist/config.js.map +1 -1
  90. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  91. package/dist/core/agent-session-runtime.js +1 -1
  92. package/dist/core/agent-session-runtime.js.map +1 -1
  93. package/dist/core/agent-session-services.d.ts.map +1 -1
  94. package/dist/core/agent-session-services.js +13 -0
  95. package/dist/core/agent-session-services.js.map +1 -1
  96. package/dist/core/agent-session.d.ts +150 -12
  97. package/dist/core/agent-session.d.ts.map +1 -1
  98. package/dist/core/agent-session.js +560 -263
  99. package/dist/core/agent-session.js.map +1 -1
  100. package/dist/core/auth-guidance.d.ts.map +1 -1
  101. package/dist/core/auth-guidance.js.map +1 -1
  102. package/dist/core/auth-storage.d.ts.map +1 -1
  103. package/dist/core/auth-storage.js.map +1 -1
  104. package/dist/core/bash-executor.d.ts.map +1 -1
  105. package/dist/core/bash-executor.js.map +1 -1
  106. package/dist/core/bug-report-upload.d.ts.map +1 -1
  107. package/dist/core/bug-report-upload.js.map +1 -1
  108. package/dist/core/bug-report.d.ts +1 -1
  109. package/dist/core/bug-report.d.ts.map +1 -1
  110. package/dist/core/bug-report.js +1 -1
  111. package/dist/core/bug-report.js.map +1 -1
  112. package/dist/core/cache-stats.d.ts.map +1 -1
  113. package/dist/core/cache-stats.js.map +1 -1
  114. package/dist/core/cache-warmer.d.ts.map +1 -1
  115. package/dist/core/cache-warmer.js.map +1 -1
  116. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  117. package/dist/core/compaction/branch-summarization.js.map +1 -1
  118. package/dist/core/compaction/compaction.d.ts.map +1 -1
  119. package/dist/core/compaction/compaction.js +1 -22
  120. package/dist/core/compaction/compaction.js.map +1 -1
  121. package/dist/core/compaction/index.d.ts.map +1 -1
  122. package/dist/core/compaction/utils.d.ts +2 -1
  123. package/dist/core/compaction/utils.d.ts.map +1 -1
  124. package/dist/core/compaction/utils.js +25 -18
  125. package/dist/core/compaction/utils.js.map +1 -1
  126. package/dist/core/crash-log.d.ts.map +1 -1
  127. package/dist/core/crash-log.js +2 -1
  128. package/dist/core/crash-log.js.map +1 -1
  129. package/dist/core/defaults.d.ts.map +1 -1
  130. package/dist/core/diagnostics.d.ts.map +1 -1
  131. package/dist/core/event-bus.d.ts.map +1 -1
  132. package/dist/core/event-bus.js.map +1 -1
  133. package/dist/core/exec.d.ts.map +1 -1
  134. package/dist/core/exec.js.map +1 -1
  135. package/dist/core/experimental.d.ts.map +1 -1
  136. package/dist/core/experimental.js.map +1 -1
  137. package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
  138. package/dist/core/export-html/ansi-to-html.js.map +1 -1
  139. package/dist/core/export-html/index.d.ts.map +1 -1
  140. package/dist/core/export-html/index.js.map +1 -1
  141. package/dist/core/export-html/template.css +10 -0
  142. package/dist/core/export-html/template.js +66 -17
  143. package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
  144. package/dist/core/export-html/tool-renderer.js.map +1 -1
  145. package/dist/core/extensions/index.d.ts +1 -1
  146. package/dist/core/extensions/index.d.ts.map +1 -1
  147. package/dist/core/extensions/index.js.map +1 -1
  148. package/dist/core/extensions/jiti-loader.d.ts.map +1 -1
  149. package/dist/core/extensions/jiti-static-loader.d.ts.map +1 -1
  150. package/dist/core/extensions/loader.d.ts.map +1 -1
  151. package/dist/core/extensions/loader.js +67 -5
  152. package/dist/core/extensions/loader.js.map +1 -1
  153. package/dist/core/extensions/runner.d.ts +18 -1
  154. package/dist/core/extensions/runner.d.ts.map +1 -1
  155. package/dist/core/extensions/runner.js +99 -0
  156. package/dist/core/extensions/runner.js.map +1 -1
  157. package/dist/core/extensions/types.d.ts +301 -22
  158. package/dist/core/extensions/types.d.ts.map +1 -1
  159. package/dist/core/extensions/types.js.map +1 -1
  160. package/dist/core/extensions/virtual-modules.d.ts.map +1 -1
  161. package/dist/core/extensions/wrapper.d.ts +2 -2
  162. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  163. package/dist/core/extensions/wrapper.js +3 -3
  164. package/dist/core/extensions/wrapper.js.map +1 -1
  165. package/dist/core/footer-data-provider.d.ts.map +1 -1
  166. package/dist/core/footer-data-provider.js.map +1 -1
  167. package/dist/core/http-dispatcher.d.ts.map +1 -1
  168. package/dist/core/http-dispatcher.js.map +1 -1
  169. package/dist/core/index.d.ts.map +1 -1
  170. package/dist/core/keybindings.d.ts +1 -1
  171. package/dist/core/keybindings.d.ts.map +1 -1
  172. package/dist/core/keybindings.js +1 -1
  173. package/dist/core/keybindings.js.map +1 -1
  174. package/dist/core/mcp-servers.d.ts +125 -0
  175. package/dist/core/mcp-servers.d.ts.map +1 -0
  176. package/dist/core/mcp-servers.js +198 -0
  177. package/dist/core/mcp-servers.js.map +1 -0
  178. package/dist/core/messages.d.ts.map +1 -1
  179. package/dist/core/messages.js.map +1 -1
  180. package/dist/core/model-config.d.ts.map +1 -1
  181. package/dist/core/model-config.js.map +1 -1
  182. package/dist/core/model-registry.d.ts +15 -1
  183. package/dist/core/model-registry.d.ts.map +1 -1
  184. package/dist/core/model-registry.js +29 -0
  185. package/dist/core/model-registry.js.map +1 -1
  186. package/dist/core/model-resolver.d.ts +2 -2
  187. package/dist/core/model-resolver.d.ts.map +1 -1
  188. package/dist/core/model-resolver.js +5 -5
  189. package/dist/core/model-resolver.js.map +1 -1
  190. package/dist/core/model-runtime.d.ts +47 -3
  191. package/dist/core/model-runtime.d.ts.map +1 -1
  192. package/dist/core/model-runtime.js +189 -35
  193. package/dist/core/model-runtime.js.map +1 -1
  194. package/dist/core/models-store.d.ts.map +1 -1
  195. package/dist/core/models-store.js.map +1 -1
  196. package/dist/core/nested-tool-calls.d.ts +102 -0
  197. package/dist/core/nested-tool-calls.d.ts.map +1 -0
  198. package/dist/core/nested-tool-calls.js +178 -0
  199. package/dist/core/nested-tool-calls.js.map +1 -0
  200. package/dist/core/output-guard.d.ts.map +1 -1
  201. package/dist/core/output-guard.js.map +1 -1
  202. package/dist/core/package-manager.d.ts +4 -0
  203. package/dist/core/package-manager.d.ts.map +1 -1
  204. package/dist/core/package-manager.js +59 -12
  205. package/dist/core/package-manager.js.map +1 -1
  206. package/dist/core/pi-manifest.d.ts.map +1 -1
  207. package/dist/core/pi-manifest.js.map +1 -1
  208. package/dist/core/project-trust.d.ts.map +1 -1
  209. package/dist/core/project-trust.js.map +1 -1
  210. package/dist/core/prompt-templates.d.ts.map +1 -1
  211. package/dist/core/prompt-templates.js.map +1 -1
  212. package/dist/core/provider-attribution.d.ts.map +1 -1
  213. package/dist/core/provider-attribution.js.map +1 -1
  214. package/dist/core/provider-composer.d.ts +40 -21
  215. package/dist/core/provider-composer.d.ts.map +1 -1
  216. package/dist/core/provider-composer.js +92 -40
  217. package/dist/core/provider-composer.js.map +1 -1
  218. package/dist/core/radius.d.ts +2 -0
  219. package/dist/core/radius.d.ts.map +1 -1
  220. package/dist/core/radius.js +2 -0
  221. package/dist/core/radius.js.map +1 -1
  222. package/dist/core/remote-catalog-provider.d.ts +8 -1
  223. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  224. package/dist/core/remote-catalog-provider.js +21 -11
  225. package/dist/core/remote-catalog-provider.js.map +1 -1
  226. package/dist/core/resolve-config-value.d.ts.map +1 -1
  227. package/dist/core/resolve-config-value.js.map +1 -1
  228. package/dist/core/resource-loader.d.ts +7 -1
  229. package/dist/core/resource-loader.d.ts.map +1 -1
  230. package/dist/core/resource-loader.js +161 -35
  231. package/dist/core/resource-loader.js.map +1 -1
  232. package/dist/core/runtime-credentials.d.ts.map +1 -1
  233. package/dist/core/runtime-credentials.js.map +1 -1
  234. package/dist/core/sdk.d.ts +1 -1
  235. package/dist/core/sdk.d.ts.map +1 -1
  236. package/dist/core/sdk.js +25 -6
  237. package/dist/core/sdk.js.map +1 -1
  238. package/dist/core/session-cwd.d.ts.map +1 -1
  239. package/dist/core/session-cwd.js.map +1 -1
  240. package/dist/core/session-export.d.ts.map +1 -1
  241. package/dist/core/session-export.js.map +1 -1
  242. package/dist/core/session-manager.d.ts +9 -0
  243. package/dist/core/session-manager.d.ts.map +1 -1
  244. package/dist/core/session-manager.js +22 -22
  245. package/dist/core/session-manager.js.map +1 -1
  246. package/dist/core/settings-diagnostics.d.ts.map +1 -1
  247. package/dist/core/settings-diagnostics.js.map +1 -1
  248. package/dist/core/settings-manager.d.ts +36 -4
  249. package/dist/core/settings-manager.d.ts.map +1 -1
  250. package/dist/core/settings-manager.js +75 -4
  251. package/dist/core/settings-manager.js.map +1 -1
  252. package/dist/core/skills.d.ts.map +1 -1
  253. package/dist/core/skills.js.map +1 -1
  254. package/dist/core/slash-commands.d.ts.map +1 -1
  255. package/dist/core/source-info.d.ts +8 -0
  256. package/dist/core/source-info.d.ts.map +1 -1
  257. package/dist/core/source-info.js +16 -0
  258. package/dist/core/source-info.js.map +1 -1
  259. package/dist/core/system-prompt.d.ts.map +1 -1
  260. package/dist/core/system-prompt.js +1 -1
  261. package/dist/core/system-prompt.js.map +1 -1
  262. package/dist/core/telemetry.d.ts.map +1 -1
  263. package/dist/core/telemetry.js.map +1 -1
  264. package/dist/core/timings.d.ts.map +1 -1
  265. package/dist/core/timings.js.map +1 -1
  266. package/dist/core/tools/bash.d.ts +12 -0
  267. package/dist/core/tools/bash.d.ts.map +1 -1
  268. package/dist/core/tools/bash.js +33 -2
  269. package/dist/core/tools/bash.js.map +1 -1
  270. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  271. package/dist/core/tools/edit-diff.js.map +1 -1
  272. package/dist/core/tools/edit.d.ts.map +1 -1
  273. package/dist/core/tools/edit.js.map +1 -1
  274. package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
  275. package/dist/core/tools/file-mutation-queue.js.map +1 -1
  276. package/dist/core/tools/find.d.ts.map +1 -1
  277. package/dist/core/tools/find.js.map +1 -1
  278. package/dist/core/tools/grep.d.ts.map +1 -1
  279. package/dist/core/tools/grep.js.map +1 -1
  280. package/dist/core/tools/index.d.ts.map +1 -1
  281. package/dist/core/tools/index.js.map +1 -1
  282. package/dist/core/tools/ls.d.ts.map +1 -1
  283. package/dist/core/tools/ls.js.map +1 -1
  284. package/dist/core/tools/output-accumulator.d.ts +11 -0
  285. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  286. package/dist/core/tools/output-accumulator.js +36 -0
  287. package/dist/core/tools/output-accumulator.js.map +1 -1
  288. package/dist/core/tools/path-utils.d.ts.map +1 -1
  289. package/dist/core/tools/path-utils.js.map +1 -1
  290. package/dist/core/tools/powershell.d.ts.map +1 -1
  291. package/dist/core/tools/powershell.js.map +1 -1
  292. package/dist/core/tools/read.d.ts.map +1 -1
  293. package/dist/core/tools/read.js.map +1 -1
  294. package/dist/core/tools/render-utils.d.ts +6 -0
  295. package/dist/core/tools/render-utils.d.ts.map +1 -1
  296. package/dist/core/tools/render-utils.js +26 -0
  297. package/dist/core/tools/render-utils.js.map +1 -1
  298. package/dist/core/tools/renderers/bash.d.ts.map +1 -1
  299. package/dist/core/tools/renderers/bash.js +11 -32
  300. package/dist/core/tools/renderers/bash.js.map +1 -1
  301. package/dist/core/tools/renderers/edit.d.ts.map +1 -1
  302. package/dist/core/tools/renderers/edit.js.map +1 -1
  303. package/dist/core/tools/renderers/find.d.ts.map +1 -1
  304. package/dist/core/tools/renderers/find.js.map +1 -1
  305. package/dist/core/tools/renderers/grep.d.ts.map +1 -1
  306. package/dist/core/tools/renderers/grep.js.map +1 -1
  307. package/dist/core/tools/renderers/index.d.ts.map +1 -1
  308. package/dist/core/tools/renderers/index.js.map +1 -1
  309. package/dist/core/tools/renderers/ls.d.ts.map +1 -1
  310. package/dist/core/tools/renderers/ls.js.map +1 -1
  311. package/dist/core/tools/renderers/read.d.ts.map +1 -1
  312. package/dist/core/tools/renderers/read.js +3 -2
  313. package/dist/core/tools/renderers/read.js.map +1 -1
  314. package/dist/core/tools/renderers/write.d.ts.map +1 -1
  315. package/dist/core/tools/renderers/write.js.map +1 -1
  316. package/dist/core/tools/tool-definition-wrapper.d.ts +5 -3
  317. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  318. package/dist/core/tools/tool-definition-wrapper.js +3 -1
  319. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  320. package/dist/core/tools/truncate.d.ts +14 -0
  321. package/dist/core/tools/truncate.d.ts.map +1 -1
  322. package/dist/core/tools/truncate.js +29 -0
  323. package/dist/core/tools/truncate.js.map +1 -1
  324. package/dist/core/tools/write.d.ts.map +1 -1
  325. package/dist/core/tools/write.js.map +1 -1
  326. package/dist/core/trust-manager.d.ts.map +1 -1
  327. package/dist/core/trust-manager.js +1 -0
  328. package/dist/core/trust-manager.js.map +1 -1
  329. package/dist/core/usage-totals.d.ts +2 -0
  330. package/dist/core/usage-totals.d.ts.map +1 -1
  331. package/dist/core/usage-totals.js +23 -0
  332. package/dist/core/usage-totals.js.map +1 -1
  333. package/dist/core/virtual-models.d.ts +117 -0
  334. package/dist/core/virtual-models.d.ts.map +1 -0
  335. package/dist/core/virtual-models.js +124 -0
  336. package/dist/core/virtual-models.js.map +1 -0
  337. package/dist/extensions/codemode/execute.d.ts +16 -0
  338. package/dist/extensions/codemode/execute.d.ts.map +1 -0
  339. package/dist/extensions/codemode/execute.js +536 -0
  340. package/dist/extensions/codemode/execute.js.map +1 -0
  341. package/dist/extensions/codemode/execute.lazy.d.ts +3 -0
  342. package/dist/extensions/codemode/execute.lazy.d.ts.map +1 -0
  343. package/dist/extensions/codemode/execute.lazy.js +3 -0
  344. package/dist/extensions/codemode/execute.lazy.js.map +1 -0
  345. package/dist/extensions/codemode/index.d.ts +21 -0
  346. package/dist/extensions/codemode/index.d.ts.map +1 -0
  347. package/dist/extensions/codemode/index.js +31 -0
  348. package/dist/extensions/codemode/index.js.map +1 -0
  349. package/dist/extensions/codemode/renderer.d.ts +12 -0
  350. package/dist/extensions/codemode/renderer.d.ts.map +1 -0
  351. package/dist/extensions/codemode/renderer.js +137 -0
  352. package/dist/extensions/codemode/renderer.js.map +1 -0
  353. package/dist/extensions/codemode/tool.d.ts +123 -0
  354. package/dist/extensions/codemode/tool.d.ts.map +1 -0
  355. package/dist/extensions/codemode/tool.js +268 -0
  356. package/dist/extensions/codemode/tool.js.map +1 -0
  357. package/dist/extensions/codemode/worker.d.ts +7 -0
  358. package/dist/extensions/codemode/worker.d.ts.map +1 -0
  359. package/dist/extensions/codemode/worker.js +7 -0
  360. package/dist/extensions/codemode/worker.js.map +1 -0
  361. package/dist/extensions/index.d.ts.map +1 -1
  362. package/dist/extensions/index.js +11 -1
  363. package/dist/extensions/index.js.map +1 -1
  364. package/dist/extensions/llama/client.d.ts.map +1 -1
  365. package/dist/extensions/llama/client.js.map +1 -1
  366. package/dist/extensions/llama/huggingface.d.ts.map +1 -1
  367. package/dist/extensions/llama/huggingface.js.map +1 -1
  368. package/dist/extensions/llama/index.d.ts.map +1 -1
  369. package/dist/extensions/llama/index.js.map +1 -1
  370. package/dist/extensions/llama/provider.d.ts +1 -1
  371. package/dist/extensions/llama/provider.d.ts.map +1 -1
  372. package/dist/extensions/llama/provider.js +65 -13
  373. package/dist/extensions/llama/provider.js.map +1 -1
  374. package/dist/extensions/llama/ui.d.ts.map +1 -1
  375. package/dist/extensions/llama/ui.js.map +1 -1
  376. package/dist/extensions/mcp/cli.d.ts +21 -0
  377. package/dist/extensions/mcp/cli.d.ts.map +1 -0
  378. package/dist/extensions/mcp/cli.js +500 -0
  379. package/dist/extensions/mcp/cli.js.map +1 -0
  380. package/dist/extensions/mcp/cli.lazy.d.ts +3 -0
  381. package/dist/extensions/mcp/cli.lazy.d.ts.map +1 -0
  382. package/dist/extensions/mcp/cli.lazy.js +3 -0
  383. package/dist/extensions/mcp/cli.lazy.js.map +1 -0
  384. package/dist/extensions/mcp/config.d.ts +72 -0
  385. package/dist/extensions/mcp/config.d.ts.map +1 -0
  386. package/dist/extensions/mcp/config.js +158 -0
  387. package/dist/extensions/mcp/config.js.map +1 -0
  388. package/dist/extensions/mcp/index.d.ts +76 -0
  389. package/dist/extensions/mcp/index.d.ts.map +1 -0
  390. package/dist/extensions/mcp/index.js +1066 -0
  391. package/dist/extensions/mcp/index.js.map +1 -0
  392. package/dist/extensions/mcp/log.d.ts +16 -0
  393. package/dist/extensions/mcp/log.d.ts.map +1 -0
  394. package/dist/extensions/mcp/log.js +66 -0
  395. package/dist/extensions/mcp/log.js.map +1 -0
  396. package/dist/extensions/mcp/oauth.d.ts +97 -0
  397. package/dist/extensions/mcp/oauth.d.ts.map +1 -0
  398. package/dist/extensions/mcp/oauth.js +358 -0
  399. package/dist/extensions/mcp/oauth.js.map +1 -0
  400. package/dist/extensions/mcp/resources.d.ts +43 -0
  401. package/dist/extensions/mcp/resources.d.ts.map +1 -0
  402. package/dist/extensions/mcp/resources.js +262 -0
  403. package/dist/extensions/mcp/resources.js.map +1 -0
  404. package/dist/extensions/mcp/runtime.d.ts +98 -0
  405. package/dist/extensions/mcp/runtime.d.ts.map +1 -0
  406. package/dist/extensions/mcp/runtime.js +395 -0
  407. package/dist/extensions/mcp/runtime.js.map +1 -0
  408. package/dist/extensions/mcp/runtime.lazy.d.ts +3 -0
  409. package/dist/extensions/mcp/runtime.lazy.d.ts.map +1 -0
  410. package/dist/extensions/mcp/runtime.lazy.js +3 -0
  411. package/dist/extensions/mcp/runtime.lazy.js.map +1 -0
  412. package/dist/extensions/mcp/tools.d.ts +84 -0
  413. package/dist/extensions/mcp/tools.d.ts.map +1 -0
  414. package/dist/extensions/mcp/tools.js +251 -0
  415. package/dist/extensions/mcp/tools.js.map +1 -0
  416. package/dist/extensions/mcp/ui.d.ts +60 -0
  417. package/dist/extensions/mcp/ui.d.ts.map +1 -0
  418. package/dist/extensions/mcp/ui.js +174 -0
  419. package/dist/extensions/mcp/ui.js.map +1 -0
  420. package/dist/extensions/tool-search/index.d.ts +12 -0
  421. package/dist/extensions/tool-search/index.d.ts.map +1 -0
  422. package/dist/extensions/tool-search/index.js +15 -0
  423. package/dist/extensions/tool-search/index.js.map +1 -0
  424. package/dist/extensions/tool-search/tool.d.ts +73 -0
  425. package/dist/extensions/tool-search/tool.d.ts.map +1 -0
  426. package/dist/extensions/tool-search/tool.js +189 -0
  427. package/dist/extensions/tool-search/tool.js.map +1 -0
  428. package/dist/index.d.ts +10 -3
  429. package/dist/index.d.ts.map +1 -1
  430. package/dist/index.js +5 -0
  431. package/dist/index.js.map +1 -1
  432. package/dist/main.d.ts.map +1 -1
  433. package/dist/main.js +16 -0
  434. package/dist/main.js.map +1 -1
  435. package/dist/migrations.d.ts.map +1 -1
  436. package/dist/migrations.js.map +1 -1
  437. package/dist/modes/index.d.ts.map +1 -1
  438. package/dist/modes/interactive/bug-report.d.ts.map +1 -1
  439. package/dist/modes/interactive/bug-report.js.map +1 -1
  440. package/dist/modes/interactive/chat-viewport.d.ts.map +1 -1
  441. package/dist/modes/interactive/chat-viewport.js.map +1 -1
  442. package/dist/modes/interactive/components/armin.d.ts.map +1 -1
  443. package/dist/modes/interactive/components/armin.js.map +1 -1
  444. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  445. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  446. package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
  447. package/dist/modes/interactive/components/bash-execution.js.map +1 -1
  448. package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
  449. package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
  450. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  451. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  452. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  453. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  454. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  455. package/dist/modes/interactive/components/config-selector.js +13 -3
  456. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  457. package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
  458. package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
  459. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  460. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  461. package/dist/modes/interactive/components/custom-entry.d.ts.map +1 -1
  462. package/dist/modes/interactive/components/custom-entry.js.map +1 -1
  463. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  464. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  465. package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -1
  466. package/dist/modes/interactive/components/daxnuts.js.map +1 -1
  467. package/dist/modes/interactive/components/diff.d.ts.map +1 -1
  468. package/dist/modes/interactive/components/diff.js.map +1 -1
  469. package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
  470. package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
  471. package/dist/modes/interactive/components/earendil-announcement.d.ts.map +1 -1
  472. package/dist/modes/interactive/components/earendil-announcement.js.map +1 -1
  473. package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
  474. package/dist/modes/interactive/components/extension-editor.js.map +1 -1
  475. package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
  476. package/dist/modes/interactive/components/extension-input.js.map +1 -1
  477. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  478. package/dist/modes/interactive/components/extension-selector.js.map +1 -1
  479. package/dist/modes/interactive/components/first-time-setup.d.ts +4 -4
  480. package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
  481. package/dist/modes/interactive/components/first-time-setup.js +8 -2
  482. package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
  483. package/dist/modes/interactive/components/footer.d.ts +7 -0
  484. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  485. package/dist/modes/interactive/components/footer.js +43 -3
  486. package/dist/modes/interactive/components/footer.js.map +1 -1
  487. package/dist/modes/interactive/components/index.d.ts.map +1 -1
  488. package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
  489. package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
  490. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  491. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  492. package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -1
  493. package/dist/modes/interactive/components/markdown-transform.js.map +1 -1
  494. package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
  495. package/dist/modes/interactive/components/mermaid.js.map +1 -1
  496. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  497. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  498. package/dist/modes/interactive/components/oauth-selector.d.ts +8 -2
  499. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  500. package/dist/modes/interactive/components/oauth-selector.js +24 -21
  501. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  502. package/dist/modes/interactive/components/pi-logo-animation.d.ts +68 -0
  503. package/dist/modes/interactive/components/pi-logo-animation.d.ts.map +1 -0
  504. package/dist/modes/interactive/components/pi-logo-animation.js +1086 -0
  505. package/dist/modes/interactive/components/pi-logo-animation.js.map +1 -0
  506. package/dist/modes/interactive/components/pi-logo-animation.lazy.d.ts +7 -0
  507. package/dist/modes/interactive/components/pi-logo-animation.lazy.d.ts.map +1 -0
  508. package/dist/modes/interactive/components/pi-logo-animation.lazy.js +12 -0
  509. package/dist/modes/interactive/components/pi-logo-animation.lazy.js.map +1 -0
  510. package/dist/modes/interactive/components/pi-logo.d.ts +19 -0
  511. package/dist/modes/interactive/components/pi-logo.d.ts.map +1 -0
  512. package/dist/modes/interactive/components/pi-logo.js +37 -0
  513. package/dist/modes/interactive/components/pi-logo.js.map +1 -0
  514. package/dist/modes/interactive/components/radius-login-selector.d.ts +15 -0
  515. package/dist/modes/interactive/components/radius-login-selector.d.ts.map +1 -0
  516. package/dist/modes/interactive/components/radius-login-selector.js +85 -0
  517. package/dist/modes/interactive/components/radius-login-selector.js.map +1 -0
  518. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  519. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  520. package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
  521. package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
  522. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  523. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  524. package/dist/modes/interactive/components/settings-selector.d.ts +6 -4
  525. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  526. package/dist/modes/interactive/components/settings-selector.js +33 -11
  527. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  528. package/dist/modes/interactive/components/settings-submenu.d.ts.map +1 -1
  529. package/dist/modes/interactive/components/settings-submenu.js.map +1 -1
  530. package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
  531. package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
  532. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  533. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  534. package/dist/modes/interactive/components/status-indicator.d.ts.map +1 -1
  535. package/dist/modes/interactive/components/status-indicator.js.map +1 -1
  536. package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
  537. package/dist/modes/interactive/components/theme-selector.js.map +1 -1
  538. package/dist/modes/interactive/components/themed-text.d.ts +17 -0
  539. package/dist/modes/interactive/components/themed-text.d.ts.map +1 -0
  540. package/dist/modes/interactive/components/themed-text.js +29 -0
  541. package/dist/modes/interactive/components/themed-text.js.map +1 -0
  542. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  543. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  544. package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
  545. package/dist/modes/interactive/components/tool-execution.js +2 -2
  546. package/dist/modes/interactive/components/tool-execution.js.map +1 -1
  547. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  548. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  549. package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -1
  550. package/dist/modes/interactive/components/trust-selector.js.map +1 -1
  551. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
  552. package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  553. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  554. package/dist/modes/interactive/components/user-message.js +5 -4
  555. package/dist/modes/interactive/components/user-message.js.map +1 -1
  556. package/dist/modes/interactive/components/visual-truncate.d.ts +27 -3
  557. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
  558. package/dist/modes/interactive/components/visual-truncate.js +39 -6
  559. package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
  560. package/dist/modes/interactive/external-editor.d.ts.map +1 -1
  561. package/dist/modes/interactive/external-editor.js.map +1 -1
  562. package/dist/modes/interactive/interactive-mode.d.ts +21 -0
  563. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  564. package/dist/modes/interactive/interactive-mode.js +348 -197
  565. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  566. package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -1
  567. package/dist/modes/interactive/model-catalog-refresh.js.map +1 -1
  568. package/dist/modes/interactive/model-search.d.ts.map +1 -1
  569. package/dist/modes/interactive/model-search.js.map +1 -1
  570. package/dist/modes/interactive/session-share.d.ts.map +1 -1
  571. package/dist/modes/interactive/session-share.js.map +1 -1
  572. package/dist/modes/interactive/theme/dark.json +59 -72
  573. package/dist/modes/interactive/theme/light.json +57 -69
  574. package/dist/modes/interactive/theme/system-theme.d.ts +55 -0
  575. package/dist/modes/interactive/theme/system-theme.d.ts.map +1 -0
  576. package/dist/modes/interactive/theme/system-theme.js +546 -0
  577. package/dist/modes/interactive/theme/system-theme.js.map +1 -0
  578. package/dist/modes/interactive/theme/theme-controller.d.ts +46 -6
  579. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
  580. package/dist/modes/interactive/theme/theme-controller.js +127 -47
  581. package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
  582. package/dist/modes/interactive/theme/theme-json.d.ts +1 -0
  583. package/dist/modes/interactive/theme/theme-json.d.ts.map +1 -1
  584. package/dist/modes/interactive/theme/theme-json.js +3 -1
  585. package/dist/modes/interactive/theme/theme-json.js.map +1 -1
  586. package/dist/modes/interactive/theme/theme-schema.json +7 -2
  587. package/dist/modes/interactive/theme/theme.d.ts +66 -39
  588. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  589. package/dist/modes/interactive/theme/theme.js +238 -317
  590. package/dist/modes/interactive/theme/theme.js.map +1 -1
  591. package/dist/modes/interactive/tui-renderer.d.ts +2 -1
  592. package/dist/modes/interactive/tui-renderer.d.ts.map +1 -1
  593. package/dist/modes/interactive/tui-renderer.js +1 -0
  594. package/dist/modes/interactive/tui-renderer.js.map +1 -1
  595. package/dist/modes/json-event.d.ts.map +1 -1
  596. package/dist/modes/json-event.js.map +1 -1
  597. package/dist/modes/print-mode.d.ts.map +1 -1
  598. package/dist/modes/print-mode.js.map +1 -1
  599. package/dist/modes/rpc/jsonl.d.ts.map +1 -1
  600. package/dist/modes/rpc/jsonl.js.map +1 -1
  601. package/dist/modes/rpc/rpc-client.d.ts +6 -6
  602. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  603. package/dist/modes/rpc/rpc-client.js +12 -8
  604. package/dist/modes/rpc/rpc-client.js.map +1 -1
  605. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  606. package/dist/modes/rpc/rpc-mode.js +7 -9
  607. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  608. package/dist/modes/rpc/rpc-types.d.ts +10 -1
  609. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  610. package/dist/modes/rpc/rpc-types.js.map +1 -1
  611. package/dist/package-manager-cli.d.ts.map +1 -1
  612. package/dist/package-manager-cli.js +6 -2
  613. package/dist/package-manager-cli.js.map +1 -1
  614. package/dist/rpc-entry.d.ts.map +1 -1
  615. package/dist/rpc-entry.js.map +1 -1
  616. package/dist/utils/abort.d.ts.map +1 -1
  617. package/dist/utils/abort.js.map +1 -1
  618. package/dist/utils/ansi.d.ts.map +1 -1
  619. package/dist/utils/ansi.js.map +1 -1
  620. package/dist/utils/changelog.d.ts.map +1 -1
  621. package/dist/utils/changelog.js.map +1 -1
  622. package/dist/utils/child-process.d.ts.map +1 -1
  623. package/dist/utils/child-process.js.map +1 -1
  624. package/dist/utils/clipboard-command.d.ts.map +1 -1
  625. package/dist/utils/clipboard-command.js.map +1 -1
  626. package/dist/utils/clipboard-image.d.ts.map +1 -1
  627. package/dist/utils/clipboard-image.js +14 -17
  628. package/dist/utils/clipboard-image.js.map +1 -1
  629. package/dist/utils/clipboard.d.ts +2 -0
  630. package/dist/utils/clipboard.d.ts.map +1 -1
  631. package/dist/utils/clipboard.js +5 -0
  632. package/dist/utils/clipboard.js.map +1 -1
  633. package/dist/utils/deprecation.d.ts.map +1 -1
  634. package/dist/utils/deprecation.js.map +1 -1
  635. package/dist/utils/exif-orientation.d.ts.map +1 -1
  636. package/dist/utils/exif-orientation.js.map +1 -1
  637. package/dist/utils/frontmatter.d.ts.map +1 -1
  638. package/dist/utils/frontmatter.js.map +1 -1
  639. package/dist/utils/fs-watch.d.ts.map +1 -1
  640. package/dist/utils/fs-watch.js.map +1 -1
  641. package/dist/utils/git.d.ts.map +1 -1
  642. package/dist/utils/git.js.map +1 -1
  643. package/dist/utils/html.d.ts.map +1 -1
  644. package/dist/utils/html.js.map +1 -1
  645. package/dist/utils/image-convert.d.ts.map +1 -1
  646. package/dist/utils/image-convert.js.map +1 -1
  647. package/dist/utils/image-process.d.ts.map +1 -1
  648. package/dist/utils/image-process.js.map +1 -1
  649. package/dist/utils/image-resize-core.d.ts.map +1 -1
  650. package/dist/utils/image-resize-core.js.map +1 -1
  651. package/dist/utils/image-resize-worker.d.ts.map +1 -1
  652. package/dist/utils/image-resize-worker.js.map +1 -1
  653. package/dist/utils/image-resize.d.ts.map +1 -1
  654. package/dist/utils/image-resize.js.map +1 -1
  655. package/dist/utils/json.d.ts.map +1 -1
  656. package/dist/utils/json.js.map +1 -1
  657. package/dist/utils/management-http.d.ts.map +1 -1
  658. package/dist/utils/management-http.js.map +1 -1
  659. package/dist/utils/mime.d.ts.map +1 -1
  660. package/dist/utils/mime.js.map +1 -1
  661. package/dist/utils/open-browser.d.ts.map +1 -1
  662. package/dist/utils/open-browser.js.map +1 -1
  663. package/dist/utils/paths.d.ts +3 -3
  664. package/dist/utils/paths.d.ts.map +1 -1
  665. package/dist/utils/paths.js +5 -4
  666. package/dist/utils/paths.js.map +1 -1
  667. package/dist/utils/photon.d.ts.map +1 -1
  668. package/dist/utils/photon.js.map +1 -1
  669. package/dist/utils/pi-user-agent.d.ts.map +1 -1
  670. package/dist/utils/pi-user-agent.js.map +1 -1
  671. package/dist/utils/shell.d.ts +1 -3
  672. package/dist/utils/shell.d.ts.map +1 -1
  673. package/dist/utils/shell.js +3 -30
  674. package/dist/utils/shell.js.map +1 -1
  675. package/dist/utils/sleep.d.ts.map +1 -1
  676. package/dist/utils/sleep.js.map +1 -1
  677. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  678. package/dist/utils/syntax-highlight.js +2 -0
  679. package/dist/utils/syntax-highlight.js.map +1 -1
  680. package/dist/utils/text.d.ts.map +1 -1
  681. package/dist/utils/text.js.map +1 -1
  682. package/dist/utils/tool-result-images.d.ts.map +1 -1
  683. package/dist/utils/tool-result-images.js.map +1 -1
  684. package/dist/utils/tools-manager.d.ts.map +1 -1
  685. package/dist/utils/tools-manager.js.map +1 -1
  686. package/dist/utils/version-check.d.ts.map +1 -1
  687. package/dist/utils/version-check.js.map +1 -1
  688. package/dist/utils/windows-self-update.d.ts.map +1 -1
  689. package/dist/utils/windows-self-update.js.map +1 -1
  690. package/dist/utils/wsl.d.ts.map +1 -1
  691. package/dist/utils/wsl.js.map +1 -1
  692. package/dist/utils/zip.d.ts.map +1 -1
  693. package/dist/utils/zip.js.map +1 -1
  694. package/docs/cli.md +58 -7
  695. package/docs/codemode.md +207 -0
  696. package/docs/configuration.md +2 -0
  697. package/docs/custom-provider.md +43 -4
  698. package/docs/docs.json +13 -1
  699. package/docs/environment-variables.md +2 -2
  700. package/docs/extensions.md +55 -0
  701. package/docs/index.md +1 -1
  702. package/docs/keybindings.md +1 -1
  703. package/docs/llama-cpp.md +13 -0
  704. package/docs/mcp.md +248 -0
  705. package/docs/models.md +57 -1
  706. package/docs/packages.md +4 -2
  707. package/docs/providers.md +19 -6
  708. package/docs/rpc-commands.md +9 -3
  709. package/docs/rpc.md +3 -1
  710. package/docs/sdk.md +8 -3
  711. package/docs/security.md +2 -0
  712. package/docs/session-format.md +5 -1
  713. package/docs/settings.md +24 -5
  714. package/docs/themes.md +33 -7
  715. package/docs/tui.md +18 -0
  716. package/docs/usage.md +1 -1
  717. package/docs/virtual-models.md +114 -0
  718. package/docs/windows.md +2 -0
  719. package/examples/README.md +1 -1
  720. package/examples/extensions/README.md +2 -0
  721. package/examples/extensions/built-in-tool-renderer.ts +16 -40
  722. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  723. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  724. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  725. package/examples/extensions/custom-provider-gitlab-duo/test.ts +5 -5
  726. package/examples/extensions/debug-provider.ts +90 -0
  727. package/examples/extensions/gondolin/package-lock.json +2 -2
  728. package/examples/extensions/gondolin/package.json +1 -1
  729. package/examples/extensions/jev-router.ts +113 -0
  730. package/examples/extensions/minimal-mode.ts +24 -96
  731. package/examples/extensions/sandbox/package-lock.json +2 -2
  732. package/examples/extensions/sandbox/package.json +1 -1
  733. package/examples/extensions/with-deps/package-lock.json +2 -2
  734. package/examples/extensions/with-deps/package.json +1 -1
  735. package/examples/rpc-client.ts +1 -1
  736. package/examples/rpc-extension-ui.ts +1 -1
  737. package/examples/sdk/14-codemode-mcp.ts +61 -0
  738. package/examples/sdk/README.md +2 -1
  739. package/npm-shrinkwrap.json +88 -43
  740. package/package.json +14 -12
  741. package/dist/bundle/chunks/anthropic-messages-J5WXPPPC.js +0 -6
  742. package/dist/bundle/chunks/azure-openai-responses-HUSQ3GP2.js +0 -2
  743. package/dist/bundle/chunks/chunk-6R7UI4IY.js +0 -2
  744. package/dist/bundle/chunks/chunk-FN7P5NHX.js +0 -1568
  745. package/dist/bundle/chunks/chunk-NUHFSC37.js +0 -25
  746. package/dist/bundle/chunks/chunk-RCZIEVGO.js +0 -11
  747. package/dist/bundle/chunks/chunk-S7SZN6Z3.js +0 -2
  748. package/dist/bundle/chunks/chunk-UXY3GQU2.js +0 -2
  749. package/dist/bundle/chunks/chunk-XNGRGP62.js +0 -2
  750. package/dist/bundle/chunks/google-generative-ai-IMS5EK2Y.js +0 -2
  751. package/dist/bundle/chunks/google-vertex-O4YJEQUW.js +0 -2
  752. package/dist/bundle/chunks/mistral-conversations-NOSQHBEY.js +0 -5
  753. package/dist/bundle/chunks/openai-responses-HWEUZ6WZ.js +0 -2
  754. package/dist/bundle/chunks/virtual-modules-WS3GCBF2.js +0 -2
@@ -1 +1 @@
1
- {"version":3,"file":"zip.d.ts","sourceRoot":"","sources":["../../src/utils/zip.ts"],"names":[],"mappings":"AAGA,UAAU,QAAQ;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;CAC1B;AA+DD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,QAAQ,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7F","sourcesContent":["import { writeFile } from \"node:fs/promises\";\nimport { crc32, deflateRawSync } from \"node:zlib\";\n\ninterface ZipEntry {\n\tname: string;\n\tdata: string | Uint8Array;\n}\n\nfunction dosDateTime(date: Date): { time: number; day: number } {\n\treturn {\n\t\ttime: (date.getHours() << 11) | (date.getMinutes() << 5) | (date.getSeconds() >> 1),\n\t\tday: ((Math.max(1980, date.getFullYear()) - 1980) << 9) | ((date.getMonth() + 1) << 5) | date.getDate(),\n\t};\n}\n\n/** Create the small, classic ZIP archives used by bug reports. */\nfunction createZipArchive(entries: readonly ZipEntry[]): Buffer {\n\tconst files: Buffer[] = [];\n\tconst directory: Buffer[] = [];\n\tconst { time, day } = dosDateTime(new Date());\n\tlet offset = 0;\n\n\tfor (const entry of entries) {\n\t\tconst name = Buffer.from(entry.name);\n\t\tconst data = typeof entry.data === \"string\" ? Buffer.from(entry.data) : Buffer.from(entry.data);\n\t\tconst compressed = deflateRawSync(data);\n\t\tconst checksum = crc32(data);\n\n\t\tconst local = Buffer.alloc(30);\n\t\tlocal.writeUInt32LE(0x04034b50, 0);\n\t\tlocal.writeUInt16LE(20, 4);\n\t\tlocal.writeUInt16LE(0x0800, 6);\n\t\tlocal.writeUInt16LE(8, 8);\n\t\tlocal.writeUInt16LE(time, 10);\n\t\tlocal.writeUInt16LE(day, 12);\n\t\tlocal.writeUInt32LE(checksum, 14);\n\t\tlocal.writeUInt32LE(compressed.length, 18);\n\t\tlocal.writeUInt32LE(data.length, 22);\n\t\tlocal.writeUInt16LE(name.length, 26);\n\n\t\tconst central = Buffer.alloc(46);\n\t\tcentral.writeUInt32LE(0x02014b50, 0);\n\t\tcentral.writeUInt16LE(20, 4);\n\t\tcentral.writeUInt16LE(20, 6);\n\t\tcentral.writeUInt16LE(0x0800, 8);\n\t\tcentral.writeUInt16LE(8, 10);\n\t\tcentral.writeUInt16LE(time, 12);\n\t\tcentral.writeUInt16LE(day, 14);\n\t\tcentral.writeUInt32LE(checksum, 16);\n\t\tcentral.writeUInt32LE(compressed.length, 20);\n\t\tcentral.writeUInt32LE(data.length, 24);\n\t\tcentral.writeUInt16LE(name.length, 28);\n\t\tcentral.writeUInt32LE(offset, 42);\n\n\t\tfiles.push(local, name, compressed);\n\t\tdirectory.push(central, name);\n\t\toffset += local.length + name.length + compressed.length;\n\t}\n\n\tconst centralDirectory = Buffer.concat(directory);\n\tconst end = Buffer.alloc(22);\n\tend.writeUInt32LE(0x06054b50, 0);\n\tend.writeUInt16LE(entries.length, 8);\n\tend.writeUInt16LE(entries.length, 10);\n\tend.writeUInt32LE(centralDirectory.length, 12);\n\tend.writeUInt32LE(offset, 16);\n\treturn Buffer.concat([...files, centralDirectory, end]);\n}\n\nexport function writeZipArchive(filePath: string, entries: readonly ZipEntry[]): Promise<void> {\n\treturn writeFile(filePath, createZipArchive(entries));\n}\n"]}
1
+ {"version":3,"file":"zip.d.ts","sourceRoot":"","sources":["../../src/utils/zip.ts"],"names":[],"mappings":"AAGA,UAAU,QAAQ;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,UAAU,CAAC;CAC1B;AA+DD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,QAAQ,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7F"}
@@ -1 +1 @@
1
- {"version":3,"file":"zip.js","sourceRoot":"","sources":["../../src/utils/zip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAOlD,SAAS,WAAW,CAAC,IAAU,EAAiC;IAC/D,OAAO;QACN,IAAI,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;QACnF,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,OAAO,EAAE;KACvG,CAAC;AAAA,CACF;AAED,kEAAkE;AAClE,SAAS,gBAAgB,CAAC,OAA4B,EAAU;IAC/D,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,SAAS,GAAa,EAAE,CAAC;IAC/B,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,WAAW,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;IAC9C,IAAI,MAAM,GAAG,C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AC,MAAM,EAAE,CAAC,CAAC,CAAC;IACrC,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACtC,GAAG,CAAC,aAAa,CAAC,gBAAgB,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC/C,GAAG,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC9B,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,EAAE,gBAAgB,EAAE,GAAG,CAAC,CAAC,CAAC;AAAA,CACxD;AAED,MAAM,UAAU,eAAe,CAAC,QAAgB,EAAE,OAA4B,EAAiB;IAC9F,OAAO,SAAS,CAAC,QAAQ,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;AAAA,CACtD","sourcesContent":["import { writeFile } from \"node:fs/promises\";\nimport { crc32, deflateRawSync } from \"node:zlib\";\n\ninterface ZipEntry {\n\tname: string;\n\tdata: string | Uint8Array;\n}\n\nfunction dosDateTime(date: Date): { time: number; day: number } {\n\treturn {\n\t\ttime: (date.getHours() << 11) | (date.getMinutes() << 5) | (date.getSeconds() >> 1),\n\t\tday: ((Math.max(1980, date.getFullYear()) - 1980) << 9) | ((date.getMonth() + 1) << 5) | date.getDate(),\n\t};\n}\n\n/** Create the small, classic ZIP archives used by bug reports. */\nfunction createZipArchive(entries: readonly ZipEntry[]): Buffer {\n\tconst files: Buffer[] = [];\n\tconst directory: Buffer[] = [];\n\tconst { time, day } = dosDateTime(new Date());\n\tlet offset = 0;\n\n\tfor (const entry of entries) {\n\t\tconst name = Buffer.from(entry.name);\n\t\tconst data = typeof entry.data === \"string\" ? Buffer.from(entry.data) : Buffer.from(entry.data);\n\t\tconst compressed = deflateRawSync(data);\n\t\tconst checksum = crc32(data);\n\n\t\tconst local = Buffer.alloc(30);\n\t\tlocal.writeUInt32LE(0x04034b50, 0);\n\t\tlocal.writeUInt16LE(20, 4);\n\t\tlocal.writeUInt16LE(0x0800, 6);\n\t\tlocal.writeUInt16LE(8, 8);\n\t\tlocal.writeUInt16LE(time, 10);\n\t\tlocal.writeUInt16LE(day, 12);\n\t\tlocal.writeUInt32LE(checksum, 14);\n\t\tlocal.writeUInt32LE(compressed.length, 18);\n\t\tlocal.writeUInt32LE(data.length, 22);\n\t\tlocal.writeUInt16LE(name.length, 26);\n\n\t\tconst central = Buffer.alloc(46);\n\t\tcentral.writeUInt32LE(0x02014b50, 0);\n\t\tcentral.writeUInt16LE(20, 4);\n\t\tcentral.writeUInt16LE(20, 6);\n\t\tcentral.writeUInt16LE(0x0800, 8);\n\t\tcentral.writeUInt16LE(8, 10);\n\t\tcentral.writeUInt16LE(time, 12);\n\t\tcentral.writeUInt16LE(day, 14);\n\t\tcentral.writeUInt32LE(checksum, 16);\n\t\tcentral.writeUInt32LE(compressed.length, 20);\n\t\tcentral.writeUInt32LE(data.length, 24);\n\t\tcentral.writeUInt16LE(name.length, 28);\n\t\tcentral.writeUInt32LE(offset, 42);\n\n\t\tfiles.push(local, name, compressed);\n\t\tdirectory.push(central, name);\n\t\toffset += local.length + name.length + compressed.length;\n\t}\n\n\tconst centralDirectory = Buffer.concat(directory);\n\tconst end = Buffer.alloc(22);\n\tend.writeUInt32LE(0x06054b50, 0);\n\tend.writeUInt16LE(entries.length, 8);\n\tend.writeUInt16LE(entries.length, 10);\n\tend.writeUInt32LE(centralDirectory.length, 12);\n\tend.writeUInt32LE(offset, 16);\n\treturn Buffer.concat([...files, centralDirectory, end]);\n}\n\nexport function writeZipArchive(filePath: string, entries: readonly ZipEntry[]): Promise<void> {\n\treturn writeFile(filePath, createZipArchive(entries));\n}\n"]}
1
+ {"version":3,"file":"zip.js","sourceRoot":"","sources":["../../src/utils/zip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAOlD,SAAS,WAAW,CAAC,IAAU;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Sync } from \"node:zlib\";\n\ninterface ZipEntry {\n\tname: string;\n\tdata: string | Uint8Array;\n}\n\nfunction dosDateTime(date: Date): { time: number; day: number } {\n\treturn {\n\t\ttime: (date.getHours() << 11) | (date.getMinutes() << 5) | (date.getSeconds() >> 1),\n\t\tday: ((Math.max(1980, date.getFullYear()) - 1980) << 9) | ((date.getMonth() + 1) << 5) | date.getDate(),\n\t};\n}\n\n/** Create the small, classic ZIP archives used by bug reports. */\nfunction createZipArchive(entries: readonly ZipEntry[]): Buffer {\n\tconst files: Buffer[] = [];\n\tconst directory: Buffer[] = [];\n\tconst { time, day } = dosDateTime(new Date());\n\tlet offset = 0;\n\n\tfor (const entry of entries) {\n\t\tconst name = Buffer.from(entry.name);\n\t\tconst data = typeof entry.data === \"string\" ? Buffer.from(entry.data) : Buffer.from(entry.data);\n\t\tconst compressed = deflateRawSync(data);\n\t\tconst checksum = crc32(data);\n\n\t\tconst local = Buffer.alloc(30);\n\t\tlocal.writeUInt32LE(0x04034b50, 0);\n\t\tlocal.writeUInt16LE(20, 4);\n\t\tlocal.writeUInt16LE(0x0800, 6);\n\t\tlocal.writeUInt16LE(8, 8);\n\t\tlocal.writeUInt16LE(time, 10);\n\t\tlocal.writeUInt16LE(day, 12);\n\t\tlocal.writeUInt32LE(checksum, 14);\n\t\tlocal.writeUInt32LE(compressed.length, 18);\n\t\tlocal.writeUInt32LE(data.length, 22);\n\t\tlocal.writeUInt16LE(name.length, 26);\n\n\t\tconst central = Buffer.alloc(46);\n\t\tcentral.writeUInt32LE(0x02014b50, 0);\n\t\tcentral.writeUInt16LE(20, 4);\n\t\tcentral.writeUInt16LE(20, 6);\n\t\tcentral.writeUInt16LE(0x0800, 8);\n\t\tcentral.writeUInt16LE(8, 10);\n\t\tcentral.writeUInt16LE(time, 12);\n\t\tcentral.writeUInt16LE(day, 14);\n\t\tcentral.writeUInt32LE(checksum, 16);\n\t\tcentral.writeUInt32LE(compressed.length, 20);\n\t\tcentral.writeUInt32LE(data.length, 24);\n\t\tcentral.writeUInt16LE(name.length, 28);\n\t\tcentral.writeUInt32LE(offset, 42);\n\n\t\tfiles.push(local, name, compressed);\n\t\tdirectory.push(central, name);\n\t\toffset += local.length + name.length + compressed.length;\n\t}\n\n\tconst centralDirectory = Buffer.concat(directory);\n\tconst end = Buffer.alloc(22);\n\tend.writeUInt32LE(0x06054b50, 0);\n\tend.writeUInt16LE(entries.length, 8);\n\tend.writeUInt16LE(entries.length, 10);\n\tend.writeUInt32LE(centralDirectory.length, 12);\n\tend.writeUInt32LE(offset, 16);\n\treturn Buffer.concat([...files, centralDirectory, end]);\n}\n\nexport function writeZipArchive(filePath: string, entries: readonly ZipEntry[]): Promise<void> {\n\treturn writeFile(filePath, createZipArchive(entries));\n}\n"]}
package/docs/cli.md CHANGED
@@ -13,6 +13,7 @@ pi update [target] [options]
13
13
  pi list
14
14
  pi config [options]
15
15
  pi auth <check|print-api-key|print-bearer-token> [options]
16
+ pi mcp <list|login|logout> [options]
16
17
  ```
17
18
 
18
19
  <a id="modes"></a>
@@ -57,10 +58,10 @@ RPC mode rejects `@file` arguments. JSON and RPC modes reserve stdout for protoc
57
58
  pi --model sonnet:high
58
59
  ```
59
60
 
60
- See [Choose a Model](models.md) for model selection and [Provider Authentication](providers.md) for credentials.
61
+ See [Choose a Model](models.md) for model selection and [Providers](providers.md) for credentials.
61
62
 
62
63
  - `--provider <name>`<br>
63
- Restricts `--model` lookup to one provider.
64
+ Restricts `--model` lookup to one provider. It requires `--model`.
64
65
  - `--model <pattern>`<br>
65
66
  Selects by exact ID or fuzzy ID/name match. It accepts `provider/id` and an optional `:<thinking>` suffix.
66
67
  - `--api-key <key>`<br>
@@ -124,7 +125,7 @@ See [Settings](settings.md#tools) for configuring the default tool selection.
124
125
  - `-nt`, `--no-tools`<br>
125
126
  Starts with all built-in, extension, and custom tools disabled.
126
127
 
127
- Default enabled tools are `read`, `bash`, `edit`, and `write`, unless `defaultTools` changes them.
128
+ Default enabled tools are `read`, `bash`, `edit`, and `write`, unless `defaultTools` changes them. `--tools` replaces the whole selection, so name every tool you want; `defaultTools` also accepts `+name` and `-name` to change the defaults instead.
128
129
 
129
130
  | Built-in | Purpose |
130
131
  |---|---|
@@ -137,6 +138,39 @@ Default enabled tools are `read`, `bash`, `edit`, and `write`, unless `defaultTo
137
138
  | `find` | Find paths using glob patterns |
138
139
  | `ls` | List directory contents |
139
140
 
141
+ Built-in extensions add two more tools. They are off by default; the MCP extension turns them on when an MCP server needs them (see [MCP](mcp.md#exposure)). To enable them yourself, name them in `--tools` or `defaultTools`.
142
+
143
+ | Built-in extension | Purpose |
144
+ |---|---|
145
+ | `codemode` | Run JavaScript that calls the other tools, for example in parallel with `Promise.allSettled`; only the script's output reaches the model |
146
+ | `tool_search` | Search tools that are not declared to the model (`codemode` and `deferred` exposure, such as MCP tools) and declare the matches for the next call |
147
+
148
+ ### Enable codemode
149
+
150
+ To turn on `codemode` for every session, add it to the default tools in `~/.pi/agent/settings.json` or a project's `.pi/settings.json`:
151
+
152
+ ```json
153
+ {
154
+ "defaultTools": ["+codemode"]
155
+ }
156
+ ```
157
+
158
+ This keeps `read`, `bash`, `edit`, and `write` and adds `codemode`. For one invocation, list every tool, since `--tools` replaces the selection:
159
+
160
+ ```sh
161
+ pi --tools read,bash,edit,write,codemode
162
+ ```
163
+
164
+ Codemode is useful without MCP: scripts can run several tool calls in parallel, filter large output before it reaches the model, call classifier models such as TypeSafe's Jev through `models.classify()` (see [Classifier models](models.md#use-classifier-models)), and generate images through `models.generateImages()` (see [Image models](models.md#use-image-models)).
165
+
166
+ ### How codemode works
167
+
168
+ Scripts run in a QuickJS sandbox and reach the other tools through `tools.<name>(args)`. [Codemode](codemode.md) describes the script API, how tools are listed and found, the `store()` and `models` globals, and the limits.
169
+
170
+ ### Tool search
171
+
172
+ `tool_search` is off by default; enable it with `"defaultTools": ["+tool_search"]` or `--tools`. It uses the same ranking as `searchTools()` over tools that are not declared yet and declares the matches for the next model call. Loaded tools are recorded in the session like other tool changes, so they stay declared on that branch.
173
+
140
174
  <a id="resource-options"></a>
141
175
 
142
176
  ## Resources
@@ -148,9 +182,9 @@ pi --extension ./review.ts
148
182
  See [Configuration](configuration.md) for conventional directories and project trust, [Settings](settings.md#resources) for configured paths, and [Pi Packages](packages.md) for package sources.
149
183
 
150
184
  - `-e`, `--extension <path>`<br>
151
- Loads an extension file or directory and is repeatable.
185
+ Loads an extension file or directory, or a built-in extension such as `builtin:mcp`, and is repeatable.
152
186
  - `-ne`, `--no-extensions`<br>
153
- Disables discovered and configured extensions. Explicit `-e` paths still load.
187
+ Disables discovered, configured, and built-in extensions. Explicit `-e` paths still load, so `pi -ne -e builtin:mcp` keeps only the built-in MCP support.
154
188
  - `--skill <path>`<br>
155
189
  Loads a skill file or directory and is repeatable.
156
190
  - `-ns`, `--no-skills`<br>
@@ -185,7 +219,7 @@ See [Configuration](configuration.md) for saved configuration, [Security](securi
185
219
  - `--append-system-prompt <text|path>`<br>
186
220
  Appends text or an existing file to the system prompt and is repeatable.
187
221
  - `--tui-mode <mode>`<br>
188
- Uses `regular` or `fullscreen` terminal mode.
222
+ Uses `fullscreen` (default) or `regular` terminal mode.
189
223
  - `--verbose`<br>
190
224
  Shows verbose interactive startup information, overriding `quietStartup`.
191
225
  - `-a`, `--approve`<br>
@@ -248,7 +282,7 @@ Add `--force` to reinstall Pi when the selected update includes Pi.
248
282
  pi auth check --provider openai --json
249
283
  ```
250
284
 
251
- Authentication commands require `--provider <provider>` or `--model <model>`. See [Provider Authentication](providers.md) for supported methods.
285
+ Authentication commands require `--provider <provider>` or `--model <model>`. See [Providers](providers.md) for supported methods.
252
286
 
253
287
  | Command | Description |
254
288
  |---|---|
@@ -266,3 +300,20 @@ Authentication commands require `--provider <provider>` or `--model <model>`. Se
266
300
  | `--min-expiry <duration>` | `print-bearer-token` | Require remaining token lifetime using `ms`, `s`, `m`, or `h`, such as `30m` |
267
301
 
268
302
  Credential-printing commands write secrets to stdout.
303
+
304
+ ## MCP commands
305
+
306
+ These commands work outside a session, so agents can run them through `bash`. See [MCP Servers](mcp.md).
307
+
308
+ | Command | Description |
309
+ |---|---|
310
+ | `pi mcp add <server> [options] -- <command> [args...]` | Add or replace a stdio server in `mcp.json`; `--env KEY=VALUE` (repeatable) and `--cwd <dir>` set its environment and working directory. Arguments after the command are passed to it |
311
+ | `pi mcp add <server> [options] --url <url>` | Add or replace a streamable HTTP server; `--header KEY=VALUE` (repeatable), `--bearer-token-env-var <NAME>` (sends `Authorization: Bearer ${NAME}`), `--oauth-client-id`, `--oauth-client-secret`, `--oauth-callback-port`, and `--oauth-client-name` configure authentication |
312
+ | `pi mcp remove <server>` | Remove a server from `mcp.json`; stored OAuth credentials are kept |
313
+ | `pi mcp list [--json]` | Connect to every enabled server and print its state, tools, and errors; exit with `1` when a config entry is invalid or an enabled server is not connected |
314
+ | `pi mcp login <server> [--timeout <seconds>]` | Sign in to an OAuth server: open the authorization page and wait for the browser (default 300 seconds); a terminal also accepts the pasted redirect URL |
315
+ | `pi mcp logout <server>` | Delete the stored OAuth credentials of a server |
316
+
317
+ `add` and `remove` change `~/.pi/agent/mcp.json`, or `.pi/mcp.json` in the current directory with `--local` (`-l`). `add` also takes `--exposure <mode>` (see [Exposure](mcp.md#exposure)) and `--description <text>` and does not connect; run `pi mcp list` to check the server.
318
+
319
+ Project `.pi/mcp.json` files are only read for projects that are already trusted.
@@ -0,0 +1,207 @@
1
+ # Codemode
2
+
3
+ The `codemode` tool lets the model write a JavaScript script that calls pi's other tools and runs non-LLM models, such as classifiers and image models. Only the script's output reaches the model, so a script can run calls in parallel and filter large results before the model sees them. To turn it on, see [Enable codemode](cli.md#enable-codemode).
4
+
5
+ ## Scripts
6
+
7
+ The tool input is raw JavaScript source, not JSON and not a markdown code fence. It runs as the body of an async function in a QuickJS sandbox, so top-level `await` and `return` work. The sandbox has no Node APIs, file system, network, or timers; scripts reach the outside world only through tools and `models`.
8
+
9
+ A script may start with an options line:
10
+
11
+ ```js
12
+ // @options: {"max_output_tokens": 2000, "timeout_ms": 60000}
13
+ ```
14
+
15
+ - `max_output_tokens` (default 10000) limits the output. Longer output keeps its start and end, and the full text is written to a temp file whose path is included in the result.
16
+ - `timeout_ms` is a hard deadline for the whole script. It is unset by default. Image generation can take minutes, so do not set a short deadline for scripts that generate images.
17
+
18
+ The result starts with `Script completed` or `Script failed`, the wall time, and the output. A failed script keeps its partial output, followed by `Script error:` and the error. Tool calls are real: calls made before a failure are not undone. Calls still running when the script ends are cancelled, and unawaited promises are discarded.
19
+
20
+ ## Globals
21
+
22
+ | Global | Purpose |
23
+ |---|---|
24
+ | `tools.<name>(args)` | Call a tool. See [Call tools](#call-tools). |
25
+ | `text(value)` | Add a text item to the output. Strings are added as is, other values as JSON. |
26
+ | `image(value)` | Add an image to the output: a base64 `data:` URL, an `{ image_url }` object, or an image block `{ type: "image", data, mimeType }` such as those returned by MCP tools and `models.generateImages()`. Remote URLs are not supported. PNG, JPEG, GIF, and WebP are accepted. |
27
+ | `console.log(...)` | Like `text()`; `info`, `warn`, `error`, and `debug` do the same. |
28
+ | `return value` | A top-level `return` adds the value like `text()`. |
29
+ | `exit()` | End the script successfully. |
30
+ | `store(key, value)` / `load(key)` | Keep small JSON values across `codemode` calls. See [Store values](#store-values). |
31
+ | `ALL_TOOLS` | Every callable tool as `{ name, description }`, including tools the description does not list. |
32
+ | `searchTools(query, { limit?, namespace? })` | Rank callable tools by relevance (BM25, default limit 8). Resolves to `{ name, description }[]`. |
33
+ | `describeTool(name)` | Resolves to a tool's description and TypeScript declaration, or `undefined`. |
34
+ | `describeNamespace(name)` | Resolves to `{ name, description?, instructions?, tools }` for a namespace such as an MCP server, or `undefined`. |
35
+ | `models` | List and run non-LLM models. See [Models](#models). |
36
+
37
+ ## Call tools
38
+
39
+ Every tool the session can call is a method of `tools`, named by its identifier: characters that are not valid in a JavaScript identifier become `_`, so the MCP tool `mcp__dev-radius__search` is `tools.mcp__dev_radius__search`. Each method takes one object with the tool's arguments.
40
+
41
+ What a call resolves to depends on the tool:
42
+
43
+ - Tools with an output schema resolve to a structured value. `bash` resolves to `{ output, truncated, full_output_path?, exit_code, wall_time_seconds }`, also for non-zero exit codes. Its `output` is not limited to the 2000 lines or 50KB the model sees: it holds up to 1 MiB, and longer output keeps its first and last 512 KiB around an omission marker, with `truncated` set and the full output in `full_output_path`.
44
+ - MCP tools resolve to their `CallToolResult`, including `isError` and `structuredContent`.
45
+ - Other tools, such as `read`, `edit`, and `write`, resolve to their text output.
46
+
47
+ A call that fails, is blocked, or gets invalid arguments rejects with an `Error` that carries the tool's error text. Use `Promise.allSettled()` to keep the results of the calls that succeed.
48
+
49
+ The `codemode` description lists tools with their TypeScript declarations, grouped by namespace (for example one MCP server). Tools with `deferred` exposure, which includes MCP tools with the default `codemode` exposure, are not listed, so the description stays the same while MCP servers connect. Listed declarations share a budget of 3000 estimated tokens (`codemode.inlineBudget` in [settings](settings.md#tools)). Scripts find the other tools with `searchTools()`, `describeTool()`, `describeNamespace()`, or by filtering `ALL_TOOLS`.
50
+
51
+ While `codemode` is active, `codemode.mode` in [settings](settings.md#tools) decides how the other tools are presented. With `on` (default) declared tools stay declared, and their descriptions say how to call them from scripts. With `only` they are hidden from the model and listed in the `codemode` description instead, so the model calls them through scripts.
52
+
53
+ ## Store values
54
+
55
+ `store(key, value)` keeps a JSON value under a string key for later `codemode` calls; storing `undefined` deletes the key. `load(key)` returns the value, or `undefined`. Writes are kept only when the script succeeds: each successful script that stores values appends a `codemode-store` custom entry to the session, so resumed sessions keep the values and each branch sees only the values written on its path.
56
+
57
+ The store is for small state such as IDs, cursors, or summaries. One value may have at most 262144 characters of JSON and all values together at most 1048576. Do not store image data; show images with `image()` or write them to a file with a tool.
58
+
59
+ ## Models
60
+
61
+ `models` reaches the model catalog and runs non-LLM models with the session's credentials: classifiers, which answer typed questions about JSON state, and image models, which generate images. Chat models are listed but cannot be run from scripts. Which classifier and image models exist is described in [Use classifier models](models.md#use-classifier-models) and [Use image models](models.md#use-image-models).
62
+
63
+ ```ts
64
+ type ModelType = "chat" | "image" | "classifier";
65
+
66
+ /** A catalog entry. `provider` and `id` identify it; other fields depend on the type. */
67
+ interface ModelInfo {
68
+ type?: ModelType;
69
+ provider: string;
70
+ id: string;
71
+ name: string;
72
+ api: string;
73
+ input: ("text" | "image")[];
74
+ contextWindow?: number;
75
+ [key: string]: unknown;
76
+ }
77
+
78
+ declare const models: {
79
+ /** Every known model of a type, optionally for one provider. */
80
+ getModelsOfType(type: ModelType, provider?: string): Promise<ModelInfo[]>;
81
+ /** Models of a type whose provider has working credentials. */
82
+ getAvailableOfType(type: ModelType, provider?: string): Promise<ModelInfo[]>;
83
+ /** One catalog entry, or undefined. */
84
+ getModelOfType(type: ModelType, provider: string, id: string): Promise<ModelInfo | undefined>;
85
+ /** Answer `context.questions` about `context.state`; answers are in `result.answers` by question ID. */
86
+ classify(model: ModelInfo, context: ClassifierContext): Promise<ClassifierResult>;
87
+ /** Generate images from `context.input` text and image blocks; show `result.output` blocks with image(). Can take minutes. */
88
+ generateImages(model: ModelInfo, context: ImagesContext): Promise<ImagesResult>;
89
+ };
90
+ ```
91
+
92
+ `classify()` and `generateImages()` use only the `provider` and `id` of `model`, so `{ provider, id }` works as well. They do not throw on provider errors: check `stopReason` and `errorMessage`. At most four such calls run at once per script; more calls wait for a free slot, so `Promise.all()` over many items is fine. Their usage is added to the `codemode` tool result and counts toward the session cost.
93
+
94
+ Model IDs differ between providers, for example `typesafe/jev-latest` and `openrouter/typesafe/jev-1.13`. Use `models.getAvailableOfType(type)` to find the IDs that work with the current credentials.
95
+
96
+ ### Classify
97
+
98
+ ```ts
99
+ interface ClassifierContext {
100
+ /** The data to classify. */
101
+ state: Record<string, unknown>;
102
+ /** Questions by ID. One call answers all of them. */
103
+ questions: Record<string, ClassifierQuestion>;
104
+ }
105
+
106
+ type ClassifierQuestion =
107
+ /** Pick one label. `criteria` maps each label to what it means. */
108
+ | { type: "choice"; instructions: string; criteria: Record<string, string> }
109
+ /** Score on an ordered scale. `criteria` describes each level, lowest first. */
110
+ | { type: "score"; instructions: string; criteria: string[] }
111
+ /** Yes or no. */
112
+ | { type: "bool"; instructions: string; criteria: { true: string; false: string } };
113
+
114
+ interface ClassifierResult {
115
+ provider: string;
116
+ model: string;
117
+ /** Answers by question ID. */
118
+ answers: Record<string, ClassifierAnswer>;
119
+ usage?: ModelUsage;
120
+ stopReason: "stop" | "error" | "aborted";
121
+ errorMessage?: string;
122
+ }
123
+
124
+ type ClassifierAnswer =
125
+ | { type: "choice"; choice: string; probabilities: Record<string, number>; confidence: number }
126
+ /** `score` is the expected level index, from 0 to `criteria.length - 1`. */
127
+ | { type: "score"; score: number; confidence: number }
128
+ /** Probability of `true`. */
129
+ | { type: "bool"; probability: number };
130
+
131
+ /** Token counts and cost in USD, when the service reports them. */
132
+ type ModelUsage = { input: number; output: number; totalTokens: number; cost: { total: number } };
133
+ ```
134
+
135
+ Classify several items by calling `classify()` once per item. This script sorts feedback messages, for example ones a tool returned earlier in the script:
136
+
137
+ ```js
138
+ const jev = await models.getModelOfType("classifier", "typesafe", "jev-latest");
139
+ const results = await Promise.all(
140
+ messages.map((message) =>
141
+ models.classify(jev, {
142
+ state: { message },
143
+ questions: {
144
+ sentiment: {
145
+ type: "choice",
146
+ instructions: "How does the user feel about the product?",
147
+ criteria: { positive: "Satisfied or happy", negative: "Unhappy or frustrated", neutral: "Neither" },
148
+ },
149
+ urgency: {
150
+ type: "score",
151
+ instructions: "How urgently does this need a reply?",
152
+ criteria: ["no reply needed", "reply this week", "reply today"],
153
+ },
154
+ },
155
+ }),
156
+ ),
157
+ );
158
+ return results.map((result, i) =>
159
+ result.stopReason === "stop"
160
+ ? { message: messages[i], sentiment: result.answers.sentiment.choice, urgency: result.answers.urgency.score }
161
+ : { message: messages[i], error: result.errorMessage },
162
+ );
163
+ ```
164
+
165
+ ### Generate images
166
+
167
+ ```ts
168
+ interface ImagesContext {
169
+ /** The prompt as text blocks, plus image blocks to edit or use as references. */
170
+ input: (TextBlock | ImageBlock)[];
171
+ }
172
+
173
+ interface ImagesResult {
174
+ provider: string;
175
+ model: string;
176
+ /** Generated images, and text blocks for models that also return text. */
177
+ output: (TextBlock | ImageBlock)[];
178
+ usage?: ModelUsage;
179
+ stopReason: "stop" | "error" | "aborted";
180
+ errorMessage?: string;
181
+ }
182
+
183
+ type TextBlock = { type: "text"; text: string };
184
+ /** `data` is base64. */
185
+ type ImageBlock = { type: "image"; data: string; mimeType: string };
186
+ ```
187
+
188
+ Show generated images with `image(block)`. Do not print `data` with `text()`, `console`, or `return`: it is large and the model cannot read it as text. Generated images are not saved to disk; to keep one, write it to a file with a tool.
189
+
190
+ ```js
191
+ // @options: {"timeout_ms": 300000}
192
+ const painter = await models.getModelOfType("image", "openrouter", "google/gemini-2.5-flash-image");
193
+ const result = await models.generateImages(painter, {
194
+ input: [{ type: "text", text: "A red fox in the snow, watercolor" }],
195
+ });
196
+ if (result.stopReason !== "stop") return result.errorMessage;
197
+ for (const block of result.output) {
198
+ if (block.type === "image") image(block);
199
+ else text(block.text);
200
+ }
201
+ ```
202
+
203
+ ## Limits
204
+
205
+ - A script's VM has 256 MB of memory. Running out throws `InternalError: out of memory`; filter or aggregate large data instead of accumulating it.
206
+ - A script that waits on a promise that can never settle (no tool call pending) fails immediately, since there are no timers.
207
+ - Scripts cannot start other `codemode` scripts.
@@ -12,6 +12,7 @@ The agent directory is shown as `<agent-dir>` below. Set its location with the `
12
12
  |---|---|
13
13
  | `<agent-dir>/settings.json` | User-level [settings](settings.md), including preferences, defaults, resource paths, and Pi package declarations. |
14
14
  | `<agent-dir>/keybindings.json` | Custom terminal UI and application [keybindings](keybindings.md). |
15
+ | `<agent-dir>/mcp.json` | [MCP servers](mcp.md) available in every project. |
15
16
  | `<agent-dir>/models.json` | [Compatible endpoints, models, and model overrides](models.md#configure-a-compatible-endpoint). |
16
17
  | `<agent-dir>/auth.json` | Saved API keys and OAuth credentials. |
17
18
  | `<agent-dir>/AGENTS.override.md`, `AGENTS.md`, `AGENTS.MD`, `CLAUDE.md`, or `CLAUDE.MD` | User instructions applied across working directories. |
@@ -27,6 +28,7 @@ The agent directory is shown as `<agent-dir>` below. Set its location with the `
27
28
  | Path | Responsibility |
28
29
  |---|---|
29
30
  | `.pi/settings.json` | Project-level [settings](settings.md), resource paths, and Pi package declarations. |
31
+ | `.pi/mcp.json` | Project [MCP servers](mcp.md). |
30
32
  | `.pi/SYSTEM.md` | Replaces the system prompt for the project. |
31
33
  | `.pi/APPEND_SYSTEM.md` | Adds project-specific instructions to the system prompt. |
32
34
  | `.pi/extensions/` | Project extensions. |
@@ -27,7 +27,45 @@ There are two registration forms:
27
27
 
28
28
  Prefer a complete provider for new integrations that own more than static endpoint and model metadata. Pi composes `models.json` overrides above a registered native provider.
29
29
 
30
- Registering only `baseUrl` or `headers` for an existing provider preserves its built-in models. Supplying `models` in the legacy form replaces the models supplied by that registration.
30
+ Registering only `baseUrl` or `headers` for an existing provider preserves its built-in models. Supplying `models` in the legacy form replaces that provider's models across chat, image, and classifier operations. An omitted `type` means `"chat"`; image and classifier models require explicit discriminants and implementations keyed by their `api` values through the `images` and `classifiers` fields.
31
+
32
+ For example, a mixed-operation provider can register non-chat models and their implementations together:
33
+
34
+ ```typescript
35
+ pi.registerProvider("media-tools", {
36
+ apiKey: "$MEDIA_TOOLS_API_KEY",
37
+ models: [
38
+ {
39
+ type: "image",
40
+ id: "image-v1",
41
+ name: "Image V1",
42
+ api: "media-images",
43
+ baseUrl: "https://media.example.com/v1",
44
+ input: ["text"],
45
+ output: ["image"],
46
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
47
+ },
48
+ {
49
+ type: "classifier",
50
+ id: "classifier-v1",
51
+ name: "Classifier V1",
52
+ api: "media-classifier",
53
+ baseUrl: "https://media.example.com/v1",
54
+ input: ["text"],
55
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
56
+ contextWindow: 64000,
57
+ },
58
+ ],
59
+ images: {
60
+ "media-images": { generateImages: async (model, context, options) => result },
61
+ },
62
+ classifiers: {
63
+ "media-classifier": { classify: async (model, context, options) => result },
64
+ },
65
+ });
66
+ ```
67
+
68
+ Model-level `baseUrl` values take precedence over the provider endpoint. If no `models` list is supplied, built-in models of every operation remain registered. Equal model IDs in different operations remain distinct, including their model-specific headers.
31
69
 
32
70
  Calls made after initial extension loading take effect immediately. Use `pi.unregisterProvider()` to remove the dynamic provider and restore built-in behavior that it replaced.
33
71
 
@@ -52,7 +90,7 @@ Never write access tokens, refresh tokens, authorization headers, or complete pr
52
90
 
53
91
  ## Supply and refresh models
54
92
 
55
- Every model needs an ID, display name, input capabilities, context window, output limit, reasoning support, and cost metadata. Choose the API implementation at the provider level unless one model requires an override.
93
+ Every model needs an ID, display name, input capabilities, and cost metadata. Chat and classifier models also need a context window; chat models need an output limit and reasoning support; image models declare their output modalities. Choose the API implementation at the provider level unless one model requires an override.
56
94
 
57
95
  Set `promptCache.short` or `promptCache.long` to the provider's best-effort cache lifetime in seconds when Pi should keep an idle prompt cache warm. Leave them unset to disable cache warming for that retention tier.
58
96
 
@@ -65,7 +103,7 @@ Use `refreshModels` when the available catalog comes from a live service. Pass `
65
103
  The two registration forms have different refresh contracts:
66
104
 
67
105
  - A complete `Provider` returns nothing. It calls `context.publish({ update })` to install provider-owned model state, after which its synchronous `getModels()` exposes the latest list.
68
- - Legacy `ProviderConfig.refreshModels` returns model definitions. Pi replaces that registration’s live models with the returned list and applies any requested persistence.
106
+ - Legacy `ProviderConfig.refreshModels` returns mixed-operation model definitions. Pi replaces that registration’s live models with the returned list and applies any requested persistence.
69
107
 
70
108
  Publish persisted catalog data only when it should survive across runs. A live service such as llama.cpp can update its in-memory list without persisting it; a remote catalog can retain a snapshot for offline startup.
71
109
 
@@ -102,9 +140,10 @@ The stream must also honor request instrumentation supplied through `SimpleStrea
102
140
 
103
141
  - Call `options.onPayload` before sending the provider request and use any replacement payload it returns.
104
142
  - Call `options.onResponse` after receiving the response but before consuming its body.
143
+ - Await `options.onProviderStreamEvent?.(providerEvent, model)` for each parsed provider event before normalizing it.
105
144
  - Pass through the abort signal and provider-scoped environment.
106
145
 
107
- These hooks power extension request inspection and response-header events. Omitting them makes the provider behave differently from Pi’s built-in providers.
146
+ These hooks power extension request inspection, response-header events, and provider-stream observation. Omitting them makes the provider behave differently from Pi’s built-in providers.
108
147
 
109
148
  ## Report failures and usage
110
149
 
package/docs/docs.json CHANGED
@@ -91,6 +91,10 @@
91
91
  {
92
92
  "title": "Use Pi Packages",
93
93
  "path": "packages.md"
94
+ },
95
+ {
96
+ "title": "Connect MCP Servers",
97
+ "path": "mcp.md"
94
98
  }
95
99
  ]
96
100
  },
@@ -105,6 +109,10 @@
105
109
  "title": "Add Custom Providers",
106
110
  "path": "custom-provider.md"
107
111
  },
112
+ {
113
+ "title": "Route with Virtual Models",
114
+ "path": "virtual-models.md"
115
+ },
108
116
  {
109
117
  "title": "Build Terminal UI Components",
110
118
  "path": "tui.md"
@@ -128,6 +136,10 @@
128
136
  "title": "CLI",
129
137
  "path": "cli.md"
130
138
  },
139
+ {
140
+ "title": "Codemode",
141
+ "path": "codemode.md"
142
+ },
131
143
  {
132
144
  "title": "Slash Commands",
133
145
  "path": "slash-commands.md"
@@ -145,7 +157,7 @@
145
157
  "path": "keybindings.md"
146
158
  },
147
159
  {
148
- "title": "Provider Authentication",
160
+ "title": "Providers",
149
161
  "path": "providers.md"
150
162
  },
151
163
  {
@@ -6,7 +6,7 @@ Pi uses environment variables in three ways:
6
6
  - Pi sets process markers so child processes can identify Pi as the launching agent.
7
7
  - Commands run by the LLM-callable shell tools receive `PI_*` variables describing the current session.
8
8
 
9
- Provider API-key variables are documented separately in [Provider Authentication](providers.md#use-an-api-key-from-the-environment).
9
+ Provider API-key variables are documented separately in [Providers](providers.md#use-an-api-key-from-the-environment).
10
10
 
11
11
  ## Process Marker
12
12
 
@@ -95,4 +95,4 @@ These variables are read by Pi itself:
95
95
  | `VISUAL`, `EDITOR` | External editor fallback when `externalEditor` is unset |
96
96
  | `HTTP_PROXY`, `HTTPS_PROXY` | Proxy outbound HTTP requests |
97
97
 
98
- Provider credentials such as `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, and cloud-provider configuration are listed in [Provider Authentication](providers.md#use-an-api-key-from-the-environment).
98
+ Provider credentials such as `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`, and provider-specific configuration are listed in [Providers](providers.md#use-an-api-key-from-the-environment).
@@ -80,6 +80,8 @@ Automatic retries, recovery, compaction, or queued work can continue afterward.
80
80
  | Persist non-context session data | `pi.appendEntry()` |
81
81
  | Change active tools, model, or thinking level | Session control methods on `pi` |
82
82
  | Add a model provider | `pi.registerProvider()` |
83
+ | Add an MCP server | `pi.registerMcpServer()` |
84
+ | Route each request to a model | [`pi.registerVirtualModel()`](virtual-models.md) |
83
85
  | Add terminal rendering | Renderer registration and `ctx.ui` |
84
86
  | Communicate with another extension | `pi.events` |
85
87
 
@@ -102,6 +104,12 @@ Events cover resource discovery, sessions, agent and message lifecycle, provider
102
104
 
103
105
  `message_end` can replace a finalized message while preserving its role. `tool_call` can mutate input or block execution. `tool_result` handlers compose, with each handler seeing prior changes.
104
106
 
107
+ <a id="provider_stream_event"></a>
108
+
109
+ `provider_stream_event` fires for each parsed provider stream event before Pi normalizes it. The event identifies the provider, API, and model; `event.data` is the earliest structured value available to Pi, not necessarily the original HTTP bytes or SSE frame. Treat it as read-only because mutation can affect normalization. The event is notification-only and is not persisted.
110
+
111
+ Handlers are awaited in stream order, so slow handlers delay stream consumption. Handler errors are reported without changing the provider response. See [`debug-provider.ts`](../examples/extensions/debug-provider.ts) for an opt-in viewer that groups raw events by assistant message.
112
+
105
113
  <a id="context_with_system"></a>
106
114
 
107
115
  `context` transforms conversation messages without prompt and tool system messages; Pi restores that state afterward. Use `context_with_system` only when a request-local transformation must own the complete transcript, and keep a system message at index zero.
@@ -135,14 +143,61 @@ Use sequential execution when tools share mutable in-memory state.
135
143
  File-mutating tools should wrap the complete read-modify-write operation with `withFileMutationQueue()`.
136
144
  Truncate large model-facing results and tell the model where to read the complete output.
137
145
 
146
+ Declare `outputSchema` and return a matching `structuredContent` when the result is data. The model still receives `content`; programmatic callers such as codemode scripts receive `structuredContent` instead of the text. Tools without `outputSchema` are passed to scripts as their text content. To report a failure that still carries data, return the result with `isError: true` instead of throwing: the model sees an error, and scripts still receive `structuredContent`.
147
+
148
+ A tool can run other tools with `ctx.executeTool(name, args, { signal, onUpdate })`. Nested calls go through argument validation and the `tool_call` and `tool_result` handlers like model-issued calls, and emit `tool_execution_start`, `tool_execution_update`, and `tool_execution_end`; all of these events carry `parentToolCallId`, and their `toolCallId` is assigned by pi as `<parent id>/<n>`. These ids do not appear as tool calls or tool results in the transcript. Nested calls do not add transcript entries: their results only reach the calling tool, which reports them itself, for example through `onUpdate` and `details`. The session keeps a bounded record of them (name, arguments, status, duration, error; never results) as `nestedCalls` on the calling tool's result message. It is used for compaction file lists and shown in HTML exports. Arguments over 8 KiB per call or 32 KiB per tool result are omitted, at most 256 calls are kept, and `complete: false` marks a record that lost anything. The `usage` of nested results, at every depth, is added to the calling tool's result `usage`, so a tool reports only its own usage, not that of the tools it called. `ctx.tools` lists the tools `ctx.executeTool()` can call. `tool_result` handlers that redact `content` should also replace `structuredContent`; replacing only `content` drops it.
149
+
138
150
  See [`hello.ts`](../examples/extensions/hello.ts), [`todo.ts`](../examples/extensions/todo.ts), [`dynamic-tools.ts`](../examples/extensions/dynamic-tools.ts), and [`truncated-tool.ts`](../examples/extensions/truncated-tool.ts).
139
151
 
152
+ ### Tool exposure
153
+
154
+ `exposure` controls how the model reaches a tool. "Callable" means callable from other tools through `ctx.executeTool()` (`ctx.tools`), as the `codemode` tool's scripts do:
155
+
156
+ - `direct` (default): declared to the model while active, and callable while active.
157
+ - `model-only`: declared to the model while active, never callable. Use it for tools that orchestrate other tools or ask the user.
158
+ - `codemode`: callable whenever registered, and listed by the `codemode` tool. Not declared to the model unless activated explicitly.
159
+ - `deferred`: like `codemode`, but codemode tools do not list it; `tool_search` can find and activate it.
160
+ - `hidden`: registered but unreachable. Re-register a tool with `exposure: "hidden"` to withdraw it, since tools cannot be unregistered.
161
+
162
+ `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)`.
163
+
164
+ 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`.
165
+
166
+ `annotations` are hints about what a tool does, with the meaning of MCP tool annotations: `readOnlyHint`, `destructiveHint`, `idempotentHint`, and `openWorldHint`. MCP tools carry the hints their server declares. Missing hints take the MCP defaults: a tool is not read-only, and may be destructive and reach an open world. The hints are not verified, but a permission extension can use them to decide which calls to confirm. This confirms the calls Codex asks approval for:
167
+
168
+ ```typescript
169
+ pi.on("tool_call", async (event, ctx) => {
170
+ const hints = pi.getAllTools().find((tool) => tool.name === event.toolName)?.annotations;
171
+ const needsApproval =
172
+ hints?.destructiveHint === true ||
173
+ (!hints?.readOnlyHint && ((hints?.destructiveHint ?? true) || (hints?.openWorldHint ?? true)));
174
+ if (needsApproval && !(await ctx.ui.confirm("Allow tool call?", event.toolName))) {
175
+ return { block: true, reason: `${event.toolName} was not approved` };
176
+ }
177
+ });
178
+ ```
179
+
180
+ 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.
181
+
140
182
  ### Activate tools dynamically
141
183
 
142
184
  Register every tool first, keep optional tools inactive, and use `pi.setActiveTools()` from a loader tool to select the desired active tools. Names must already be registered; unknown names are ignored.
143
185
 
144
186
  Pi records the initial prompt and tool set in the transcript's first system message, then appends tool and prompt changes before the next model request. Providers that cannot represent the transition receive a complete transcript checkpoint, which can invalidate the cached prefix.
145
187
 
188
+ ### MCP servers
189
+
190
+ `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`.
191
+
192
+ ```typescript
193
+ pi.registerMcpServer("jira", { url: "https://mcp.example.com/jira", exposure: "codemode" });
194
+ pi.unregisterMcpServer("jira");
195
+ ```
196
+
197
+ Servers registered while the extension loads connect when the session starts, together with the `mcp.json` servers; servers registered later connect right away, and `pi.unregisterMcpServer()` closes the connection and makes the server's tools unreachable. Registrations are not saved: register again on every load, for example based on the extension's own settings. A server in `mcp.json` with the same name takes precedence, and `/mcp` shows the override. Registering the same name again replaces the extension's earlier registration; names registered by another extension, invalid names, and invalid configs throw.
198
+
199
+ The built-in MCP support connects registered servers. When nothing does, because another extension replaced it (see [MCP](mcp.md#other-mcp-extensions)), each registration is reported as an extension error. Other MCP extensions can connect registered servers too: read them with `pi.getMcpServers()` on `session_start` and handle the `mcp_servers_change` event for later changes.
200
+
146
201
  <a id="extensioncontext"></a>
147
202
  <a id="extensioncommandcontext"></a>
148
203
  <a id="use-extension-context"></a>
package/docs/index.md CHANGED
@@ -30,7 +30,7 @@ Use the [Quickstart customization chooser](quickstart.md#choose-how-to-customize
30
30
 
31
31
  ## Find reference and setup information
32
32
 
33
- Use the reference pages to look up [CLI options](cli.md), [settings](settings.md), [provider authentication](providers.md), [keybindings](keybindings.md), and [environment variables](environment-variables.md).
33
+ Use the reference pages to look up [CLI options](cli.md), [settings](settings.md), [providers](providers.md), [keybindings](keybindings.md), and [environment variables](environment-variables.md).
34
34
 
35
35
  For platform-specific help, see [Terminal Setup](terminal-setup.md), [Windows](windows.md), [tmux](tmux.md), [Termux on Android](termux.md), or [Containerization](containerization.md).
36
36
 
@@ -125,7 +125,7 @@ In fullscreen mode, these actions control the transcript and take precedence ove
125
125
  | `app.exit` | `ctrl+d` | Exit (when editor empty) |
126
126
  | `app.suspend` | `ctrl+z` (None on Windows) | Suspend to background |
127
127
  | `app.editor.external` | `ctrl+g` | Open in external editor (`externalEditor`, `$VISUAL`, `$EDITOR`, Notepad on Windows, or `nano` elsewhere) |
128
- | `app.clipboard.pasteImage` | `ctrl+v` (`alt+v` on Windows and WSL) | Paste image or text from clipboard |
128
+ | `app.clipboard.pasteImage` | `ctrl+v` (`alt+v` on Windows and WSL) | Paste files on macOS, images, or text from clipboard |
129
129
 
130
130
  On native Windows, `app.suspend` has no default because Windows terminals do not support Unix job control. If you assign it manually, Pi shows a status message instead of suspending. WSL uses the normal `ctrl+z` and `fg` behavior.
131
131