@astralyn/pi 0.87.6 → 1.0.0

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 (924) hide show
  1. package/CHANGELOG.md +69 -9
  2. package/README.md +3 -3
  3. package/dist/bun/runtime-setup.js +4 -1
  4. package/dist/bun/runtime-setup.js.map +1 -1
  5. package/dist/bundle/chunks/anthropic-messages-CG2BSDQS.js +6 -0
  6. package/dist/bundle/chunks/anthropic.js +2 -2
  7. package/dist/bundle/chunks/azure-openai-responses-PBA4QKCM.js +2 -0
  8. package/dist/bundle/chunks/bedrock-converse-stream.js +8 -8
  9. package/dist/bundle/chunks/{chunk-NW5FIDD7.js → chunk-6UFFVA7M.js} +3 -3
  10. package/dist/bundle/chunks/chunk-G4RY3GN7.js +11 -0
  11. package/dist/bundle/chunks/chunk-GCKVOFWP.js +2 -0
  12. package/dist/bundle/chunks/chunk-GIG5IHES.js +2 -0
  13. package/dist/bundle/chunks/{chunk-4W4Q2H6W.js → chunk-HESRDUKO.js} +1000 -625
  14. package/dist/bundle/chunks/chunk-MPDALHNJ.js +2 -0
  15. package/dist/bundle/chunks/chunk-OO6DJ3CL.js +31 -0
  16. package/dist/bundle/chunks/{chunk-LPQCB2VJ.js → chunk-PFZKRUMO.js} +2 -2
  17. package/dist/bundle/chunks/chunk-SGLYRVQL.js +2 -0
  18. package/dist/bundle/chunks/chunk-TRHTWM3C.js +2 -0
  19. package/dist/bundle/chunks/chunk-V66VGGOM.js +2 -0
  20. package/dist/bundle/chunks/chunk-Z2RKSI3O.js +2 -0
  21. package/dist/bundle/chunks/cloudflare-workers-ai-system-one-YB7XPPP4.js +2 -0
  22. package/dist/bundle/chunks/codemode-worker.js +354 -0
  23. package/dist/bundle/chunks/github-copilot.js +1 -1
  24. package/dist/bundle/chunks/google-generative-ai-V5ZM5MCL.js +2 -0
  25. package/dist/bundle/chunks/google-vertex-22THOFP5.js +2 -0
  26. package/dist/bundle/chunks/llama-cpp-classify-R7DQLTQN.js +22 -0
  27. package/dist/bundle/chunks/meta.js +2 -0
  28. package/dist/bundle/chunks/mistral-conversations-WHSCJJWP.js +5 -0
  29. package/dist/bundle/chunks/openai-chatgpt.js +75 -0
  30. package/dist/bundle/chunks/openai-codex-responses-N7GDPBPP.js +10 -0
  31. package/dist/bundle/chunks/openai-codex.js +2 -2
  32. package/dist/bundle/chunks/openai-completions-RGGQK5UW.js +7 -0
  33. package/dist/bundle/chunks/openai-responses-3ZLD5JYI.js +3 -0
  34. package/dist/bundle/chunks/{openrouter-images-6XDE2CEW.js → openrouter-images-YP3YVB54.js} +1 -1
  35. package/dist/bundle/chunks/openrouter.js +2 -2
  36. package/dist/bundle/chunks/{pi-messages-MQMPIPNC.js → pi-messages-HZZ7GEEW.js} +2 -2
  37. package/dist/bundle/chunks/radius.js +2 -2
  38. package/dist/bundle/chunks/typesafe-system-one-RREJAKWB.js +2 -0
  39. package/dist/bundle/chunks/virtual-modules-4RQ2L6W4.js +2 -0
  40. package/dist/bundle/cli.js +1 -1
  41. package/dist/bundle/index.js +1 -1
  42. package/dist/bundle/rpc-entry.js +1 -1
  43. package/dist/cli/args.d.ts.map +1 -1
  44. package/dist/cli/args.js +5 -4
  45. package/dist/cli/args.js.map +1 -1
  46. package/dist/cli/startup-ui.d.ts.map +1 -1
  47. package/dist/cli/startup-ui.js +38 -30
  48. package/dist/cli/startup-ui.js.map +1 -1
  49. package/dist/config.d.ts +15 -4
  50. package/dist/config.d.ts.map +1 -1
  51. package/dist/config.js +33 -4
  52. package/dist/config.js.map +1 -1
  53. package/dist/core/agent-session-runtime.d.ts +1 -1
  54. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  55. package/dist/core/agent-session-runtime.js +13 -13
  56. package/dist/core/agent-session-runtime.js.map +1 -1
  57. package/dist/core/agent-session-services.d.ts +2 -2
  58. package/dist/core/agent-session-services.d.ts.map +1 -1
  59. package/dist/core/agent-session-services.js +14 -1
  60. package/dist/core/agent-session-services.js.map +1 -1
  61. package/dist/core/agent-session.d.ts +121 -36
  62. package/dist/core/agent-session.d.ts.map +1 -1
  63. package/dist/core/agent-session.js +518 -203
  64. package/dist/core/agent-session.js.map +1 -1
  65. package/dist/core/bug-report.js +1 -1
  66. package/dist/core/bug-report.js.map +1 -1
  67. package/dist/core/compaction/compaction.d.ts.map +1 -1
  68. package/dist/core/compaction/compaction.js +1 -22
  69. package/dist/core/compaction/compaction.js.map +1 -1
  70. package/dist/core/compaction/utils.d.ts +2 -1
  71. package/dist/core/compaction/utils.d.ts.map +1 -1
  72. package/dist/core/compaction/utils.js +25 -18
  73. package/dist/core/compaction/utils.js.map +1 -1
  74. package/dist/core/crash-log.d.ts.map +1 -1
  75. package/dist/core/crash-log.js +2 -1
  76. package/dist/core/crash-log.js.map +1 -1
  77. package/dist/core/export-html/template.css +10 -0
  78. package/dist/core/export-html/template.js +66 -17
  79. package/dist/core/extensions/distribution-api.d.ts +1 -1
  80. package/dist/core/extensions/distribution-api.d.ts.map +1 -1
  81. package/dist/core/extensions/distribution-api.js.map +1 -1
  82. package/dist/core/extensions/index.d.ts +2 -2
  83. package/dist/core/extensions/index.d.ts.map +1 -1
  84. package/dist/core/extensions/index.js.map +1 -1
  85. package/dist/core/extensions/loader.d.ts.map +1 -1
  86. package/dist/core/extensions/loader.js +67 -5
  87. package/dist/core/extensions/loader.js.map +1 -1
  88. package/dist/core/extensions/runner.d.ts +22 -3
  89. package/dist/core/extensions/runner.d.ts.map +1 -1
  90. package/dist/core/extensions/runner.js +124 -8
  91. package/dist/core/extensions/runner.js.map +1 -1
  92. package/dist/core/extensions/types.d.ts +310 -25
  93. package/dist/core/extensions/types.d.ts.map +1 -1
  94. package/dist/core/extensions/types.js.map +1 -1
  95. package/dist/core/extensions/wrapper.d.ts +2 -2
  96. package/dist/core/extensions/wrapper.d.ts.map +1 -1
  97. package/dist/core/extensions/wrapper.js +3 -3
  98. package/dist/core/extensions/wrapper.js.map +1 -1
  99. package/dist/core/keybindings.d.ts +70 -5
  100. package/dist/core/keybindings.d.ts.map +1 -1
  101. package/dist/core/keybindings.js +15 -1
  102. package/dist/core/keybindings.js.map +1 -1
  103. package/dist/core/mcp-servers.d.ts +125 -0
  104. package/dist/core/mcp-servers.d.ts.map +1 -0
  105. package/dist/core/mcp-servers.js +199 -0
  106. package/dist/core/mcp-servers.js.map +1 -0
  107. package/dist/core/model-registry.d.ts +15 -1
  108. package/dist/core/model-registry.d.ts.map +1 -1
  109. package/dist/core/model-registry.js +29 -0
  110. package/dist/core/model-registry.js.map +1 -1
  111. package/dist/core/model-resolver.d.ts +2 -2
  112. package/dist/core/model-resolver.d.ts.map +1 -1
  113. package/dist/core/model-resolver.js +5 -5
  114. package/dist/core/model-resolver.js.map +1 -1
  115. package/dist/core/model-runtime.d.ts +47 -3
  116. package/dist/core/model-runtime.d.ts.map +1 -1
  117. package/dist/core/model-runtime.js +189 -35
  118. package/dist/core/model-runtime.js.map +1 -1
  119. package/dist/core/nested-tool-calls.d.ts +102 -0
  120. package/dist/core/nested-tool-calls.d.ts.map +1 -0
  121. package/dist/core/nested-tool-calls.js +177 -0
  122. package/dist/core/nested-tool-calls.js.map +1 -0
  123. package/dist/core/package-manager.d.ts +4 -0
  124. package/dist/core/package-manager.d.ts.map +1 -1
  125. package/dist/core/package-manager.js +58 -12
  126. package/dist/core/package-manager.js.map +1 -1
  127. package/dist/core/provider-composer.d.ts +40 -21
  128. package/dist/core/provider-composer.d.ts.map +1 -1
  129. package/dist/core/provider-composer.js +92 -40
  130. package/dist/core/provider-composer.js.map +1 -1
  131. package/dist/core/radius.d.ts +2 -0
  132. package/dist/core/radius.d.ts.map +1 -1
  133. package/dist/core/radius.js +2 -0
  134. package/dist/core/radius.js.map +1 -1
  135. package/dist/core/remote-catalog-provider.d.ts +8 -1
  136. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  137. package/dist/core/remote-catalog-provider.js +21 -11
  138. package/dist/core/remote-catalog-provider.js.map +1 -1
  139. package/dist/core/resource-loader.d.ts +7 -1
  140. package/dist/core/resource-loader.d.ts.map +1 -1
  141. package/dist/core/resource-loader.js +160 -35
  142. package/dist/core/resource-loader.js.map +1 -1
  143. package/dist/core/sdk.d.ts +3 -3
  144. package/dist/core/sdk.d.ts.map +1 -1
  145. package/dist/core/sdk.js +26 -7
  146. package/dist/core/sdk.js.map +1 -1
  147. package/dist/core/session-manager.d.ts +9 -0
  148. package/dist/core/session-manager.d.ts.map +1 -1
  149. package/dist/core/session-manager.js +22 -22
  150. package/dist/core/session-manager.js.map +1 -1
  151. package/dist/core/settings-manager.d.ts +41 -4
  152. package/dist/core/settings-manager.d.ts.map +1 -1
  153. package/dist/core/settings-manager.js +110 -3
  154. package/dist/core/settings-manager.js.map +1 -1
  155. package/dist/core/slash-commands.d.ts.map +1 -1
  156. package/dist/core/slash-commands.js +1 -0
  157. package/dist/core/slash-commands.js.map +1 -1
  158. package/dist/core/source-info.d.ts +8 -0
  159. package/dist/core/source-info.d.ts.map +1 -1
  160. package/dist/core/source-info.js +16 -0
  161. package/dist/core/source-info.js.map +1 -1
  162. package/dist/core/system-prompt.js +1 -1
  163. package/dist/core/system-prompt.js.map +1 -1
  164. package/dist/core/tasks/delivery.d.ts +40 -0
  165. package/dist/core/tasks/delivery.d.ts.map +1 -0
  166. package/dist/core/tasks/delivery.js +157 -0
  167. package/dist/core/tasks/delivery.js.map +1 -0
  168. package/dist/core/tasks/format.d.ts +7 -0
  169. package/dist/core/tasks/format.d.ts.map +1 -0
  170. package/dist/core/tasks/format.js +14 -0
  171. package/dist/core/tasks/format.js.map +1 -0
  172. package/dist/core/tasks/history.d.ts +4 -0
  173. package/dist/core/tasks/history.d.ts.map +1 -0
  174. package/dist/core/{background → tasks}/history.js +8 -51
  175. package/dist/core/tasks/history.js.map +1 -0
  176. package/dist/core/{background → tasks}/output.d.ts +12 -4
  177. package/dist/core/tasks/output.d.ts.map +1 -0
  178. package/dist/core/{background → tasks}/output.js +30 -11
  179. package/dist/core/tasks/output.js.map +1 -0
  180. package/dist/core/tasks/presentation.d.ts +7 -0
  181. package/dist/core/tasks/presentation.d.ts.map +1 -0
  182. package/dist/core/tasks/presentation.js +226 -0
  183. package/dist/core/tasks/presentation.js.map +1 -0
  184. package/dist/core/tasks/runtime.d.ts +74 -0
  185. package/dist/core/tasks/runtime.d.ts.map +1 -0
  186. package/dist/core/tasks/runtime.js +580 -0
  187. package/dist/core/tasks/runtime.js.map +1 -0
  188. package/dist/core/tasks/session.d.ts +49 -0
  189. package/dist/core/tasks/session.d.ts.map +1 -0
  190. package/dist/core/tasks/session.js +138 -0
  191. package/dist/core/tasks/session.js.map +1 -0
  192. package/dist/core/tasks/store.d.ts +46 -0
  193. package/dist/core/tasks/store.d.ts.map +1 -0
  194. package/dist/core/tasks/store.js +162 -0
  195. package/dist/core/tasks/store.js.map +1 -0
  196. package/dist/core/{background → tasks}/types.d.ts +64 -86
  197. package/dist/core/tasks/types.d.ts.map +1 -0
  198. package/dist/core/tasks/types.js +27 -0
  199. package/dist/core/tasks/types.js.map +1 -0
  200. package/dist/core/tools/bash.d.ts +8 -93
  201. package/dist/core/tools/bash.d.ts.map +1 -1
  202. package/dist/core/tools/bash.js +8 -240
  203. package/dist/core/tools/bash.js.map +1 -1
  204. package/dist/core/tools/grep.d.ts +2 -0
  205. package/dist/core/tools/grep.d.ts.map +1 -1
  206. package/dist/core/tools/grep.js +2 -0
  207. package/dist/core/tools/grep.js.map +1 -1
  208. package/dist/core/tools/index.d.ts +2 -1
  209. package/dist/core/tools/index.d.ts.map +1 -1
  210. package/dist/core/tools/index.js +9 -0
  211. package/dist/core/tools/index.js.map +1 -1
  212. package/dist/core/tools/output-accumulator.d.ts +11 -0
  213. package/dist/core/tools/output-accumulator.d.ts.map +1 -1
  214. package/dist/core/tools/output-accumulator.js +36 -0
  215. package/dist/core/tools/output-accumulator.js.map +1 -1
  216. package/dist/core/tools/powershell.d.ts +6 -2
  217. package/dist/core/tools/powershell.d.ts.map +1 -1
  218. package/dist/core/tools/powershell.js +1 -1
  219. package/dist/core/tools/powershell.js.map +1 -1
  220. package/dist/core/tools/render-utils.d.ts +6 -0
  221. package/dist/core/tools/render-utils.d.ts.map +1 -1
  222. package/dist/core/tools/render-utils.js +26 -0
  223. package/dist/core/tools/render-utils.js.map +1 -1
  224. package/dist/core/tools/renderers/bash.d.ts +1 -1
  225. package/dist/core/tools/renderers/bash.d.ts.map +1 -1
  226. package/dist/core/tools/renderers/bash.js +11 -35
  227. package/dist/core/tools/renderers/bash.js.map +1 -1
  228. package/dist/core/tools/renderers/index.d.ts.map +1 -1
  229. package/dist/core/tools/renderers/index.js +5 -7
  230. package/dist/core/tools/renderers/index.js.map +1 -1
  231. package/dist/core/tools/renderers/read.d.ts.map +1 -1
  232. package/dist/core/tools/renderers/read.js +3 -2
  233. package/dist/core/tools/renderers/read.js.map +1 -1
  234. package/dist/core/tools/shell-execution.d.ts +4 -6
  235. package/dist/core/tools/shell-execution.d.ts.map +1 -1
  236. package/dist/core/tools/shell-execution.js +22 -13
  237. package/dist/core/tools/shell-execution.js.map +1 -1
  238. package/dist/core/tools/shell-tool.d.ts +93 -0
  239. package/dist/core/tools/shell-tool.d.ts.map +1 -0
  240. package/dist/core/tools/shell-tool.js +249 -0
  241. package/dist/core/tools/shell-tool.js.map +1 -0
  242. package/dist/core/tools/tasks/actions.d.ts +12 -0
  243. package/dist/core/tools/tasks/actions.d.ts.map +1 -0
  244. package/dist/{extensions/background → core/tools/tasks}/actions.js +44 -29
  245. package/dist/core/tools/tasks/actions.js.map +1 -0
  246. package/dist/core/tools/tasks/constants.d.ts +20 -0
  247. package/dist/core/tools/tasks/constants.d.ts.map +1 -0
  248. package/dist/core/tools/tasks/constants.js +20 -0
  249. package/dist/core/tools/tasks/constants.js.map +1 -0
  250. package/dist/{extensions/background → core/tools/tasks}/schema.d.ts +7 -7
  251. package/dist/core/tools/tasks/schema.d.ts.map +1 -0
  252. package/dist/{extensions/background → core/tools/tasks}/schema.js +21 -20
  253. package/dist/core/tools/tasks/schema.js.map +1 -0
  254. package/dist/core/tools/tasks/types.d.ts +53 -0
  255. package/dist/core/tools/tasks/types.d.ts.map +1 -0
  256. package/dist/core/tools/tasks/types.js +12 -0
  257. package/dist/core/tools/tasks/types.js.map +1 -0
  258. package/dist/core/tools/tasks.d.ts +14 -0
  259. package/dist/core/tools/tasks.d.ts.map +1 -0
  260. package/dist/core/tools/tasks.js +40 -0
  261. package/dist/core/tools/tasks.js.map +1 -0
  262. package/dist/core/tools/tool-definition-wrapper.d.ts +4 -3
  263. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  264. package/dist/core/tools/tool-definition-wrapper.js +4 -2
  265. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  266. package/dist/core/tools/truncate.d.ts +14 -0
  267. package/dist/core/tools/truncate.d.ts.map +1 -1
  268. package/dist/core/tools/truncate.js +29 -0
  269. package/dist/core/tools/truncate.js.map +1 -1
  270. package/dist/core/trust-manager.d.ts.map +1 -1
  271. package/dist/core/trust-manager.js +1 -0
  272. package/dist/core/trust-manager.js.map +1 -1
  273. package/dist/core/usage-totals.d.ts +5 -3
  274. package/dist/core/usage-totals.d.ts.map +1 -1
  275. package/dist/core/usage-totals.js +27 -4
  276. package/dist/core/usage-totals.js.map +1 -1
  277. package/dist/core/virtual-models.d.ts +117 -0
  278. package/dist/core/virtual-models.d.ts.map +1 -0
  279. package/dist/core/virtual-models.js +124 -0
  280. package/dist/core/virtual-models.js.map +1 -0
  281. package/dist/extensions/btw/agent.d.ts +17 -8
  282. package/dist/extensions/btw/agent.d.ts.map +1 -1
  283. package/dist/extensions/btw/agent.js +74 -76
  284. package/dist/extensions/btw/agent.js.map +1 -1
  285. package/dist/extensions/btw/controller.d.ts +0 -1
  286. package/dist/extensions/btw/controller.d.ts.map +1 -1
  287. package/dist/extensions/btw/controller.js +26 -33
  288. package/dist/extensions/btw/controller.js.map +1 -1
  289. package/dist/extensions/btw/panel.d.ts +13 -14
  290. package/dist/extensions/btw/panel.d.ts.map +1 -1
  291. package/dist/extensions/btw/panel.js +38 -29
  292. package/dist/extensions/btw/panel.js.map +1 -1
  293. package/dist/extensions/codemode/execute.d.ts +16 -0
  294. package/dist/extensions/codemode/execute.d.ts.map +1 -0
  295. package/dist/extensions/codemode/execute.js +536 -0
  296. package/dist/extensions/codemode/execute.js.map +1 -0
  297. package/dist/extensions/codemode/execute.lazy.d.ts +3 -0
  298. package/dist/extensions/codemode/execute.lazy.d.ts.map +1 -0
  299. package/dist/extensions/codemode/execute.lazy.js +3 -0
  300. package/dist/extensions/codemode/execute.lazy.js.map +1 -0
  301. package/dist/extensions/codemode/index.d.ts +21 -0
  302. package/dist/extensions/codemode/index.d.ts.map +1 -0
  303. package/dist/extensions/codemode/index.js +36 -0
  304. package/dist/extensions/codemode/index.js.map +1 -0
  305. package/dist/extensions/codemode/renderer.d.ts +12 -0
  306. package/dist/extensions/codemode/renderer.d.ts.map +1 -0
  307. package/dist/extensions/codemode/renderer.js +137 -0
  308. package/dist/extensions/codemode/renderer.js.map +1 -0
  309. package/dist/extensions/codemode/search.d.ts +33 -0
  310. package/dist/extensions/codemode/search.d.ts.map +1 -0
  311. package/dist/extensions/codemode/search.js +117 -0
  312. package/dist/extensions/codemode/search.js.map +1 -0
  313. package/dist/extensions/codemode/tool.d.ts +123 -0
  314. package/dist/extensions/codemode/tool.d.ts.map +1 -0
  315. package/dist/extensions/codemode/tool.js +268 -0
  316. package/dist/extensions/codemode/tool.js.map +1 -0
  317. package/dist/extensions/codemode/worker.d.ts +7 -0
  318. package/dist/extensions/codemode/worker.d.ts.map +1 -0
  319. package/dist/extensions/codemode/worker.js +7 -0
  320. package/dist/extensions/codemode/worker.js.map +1 -0
  321. package/dist/extensions/deepwiki/schema.d.ts +1 -1
  322. package/dist/extensions/index.js +13 -13
  323. package/dist/extensions/index.js.map +1 -1
  324. package/dist/extensions/llama/provider.d.ts +1 -1
  325. package/dist/extensions/llama/provider.d.ts.map +1 -1
  326. package/dist/extensions/llama/provider.js +65 -13
  327. package/dist/extensions/llama/provider.js.map +1 -1
  328. package/dist/extensions/mcp/cli.d.ts +21 -0
  329. package/dist/extensions/mcp/cli.d.ts.map +1 -0
  330. package/dist/extensions/mcp/cli.js +500 -0
  331. package/dist/extensions/mcp/cli.js.map +1 -0
  332. package/dist/extensions/mcp/cli.lazy.d.ts +3 -0
  333. package/dist/extensions/mcp/cli.lazy.d.ts.map +1 -0
  334. package/dist/extensions/mcp/cli.lazy.js +3 -0
  335. package/dist/extensions/mcp/cli.lazy.js.map +1 -0
  336. package/dist/extensions/mcp/config.d.ts +72 -0
  337. package/dist/extensions/mcp/config.d.ts.map +1 -0
  338. package/dist/extensions/mcp/config.js +158 -0
  339. package/dist/extensions/mcp/config.js.map +1 -0
  340. package/dist/extensions/mcp/index.d.ts +76 -0
  341. package/dist/extensions/mcp/index.d.ts.map +1 -0
  342. package/dist/extensions/mcp/index.js +1078 -0
  343. package/dist/extensions/mcp/index.js.map +1 -0
  344. package/dist/extensions/mcp/log.d.ts +16 -0
  345. package/dist/extensions/mcp/log.d.ts.map +1 -0
  346. package/dist/extensions/mcp/log.js +64 -0
  347. package/dist/extensions/mcp/log.js.map +1 -0
  348. package/dist/extensions/mcp/oauth.d.ts +97 -0
  349. package/dist/extensions/mcp/oauth.d.ts.map +1 -0
  350. package/dist/extensions/mcp/oauth.js +355 -0
  351. package/dist/extensions/mcp/oauth.js.map +1 -0
  352. package/dist/extensions/mcp/resources.d.ts +43 -0
  353. package/dist/extensions/mcp/resources.d.ts.map +1 -0
  354. package/dist/extensions/mcp/resources.js +262 -0
  355. package/dist/extensions/mcp/resources.js.map +1 -0
  356. package/dist/extensions/mcp/runtime.d.ts +98 -0
  357. package/dist/extensions/mcp/runtime.d.ts.map +1 -0
  358. package/dist/extensions/mcp/runtime.js +379 -0
  359. package/dist/extensions/mcp/runtime.js.map +1 -0
  360. package/dist/extensions/mcp/runtime.lazy.d.ts +3 -0
  361. package/dist/extensions/mcp/runtime.lazy.d.ts.map +1 -0
  362. package/dist/extensions/mcp/runtime.lazy.js +3 -0
  363. package/dist/extensions/mcp/runtime.lazy.js.map +1 -0
  364. package/dist/extensions/mcp/tools.d.ts +84 -0
  365. package/dist/extensions/mcp/tools.d.ts.map +1 -0
  366. package/dist/extensions/mcp/tools.js +251 -0
  367. package/dist/extensions/mcp/tools.js.map +1 -0
  368. package/dist/extensions/mcp/ui.d.ts +60 -0
  369. package/dist/extensions/mcp/ui.d.ts.map +1 -0
  370. package/dist/extensions/mcp/ui.js +168 -0
  371. package/dist/extensions/mcp/ui.js.map +1 -0
  372. package/dist/extensions/provider/catalog.d.ts +8 -1
  373. package/dist/extensions/provider/catalog.d.ts.map +1 -1
  374. package/dist/extensions/provider/catalog.js +31 -0
  375. package/dist/extensions/provider/catalog.js.map +1 -1
  376. package/dist/extensions/provider/connection.d.ts +4 -1
  377. package/dist/extensions/provider/connection.d.ts.map +1 -1
  378. package/dist/extensions/provider/connection.js +1 -5
  379. package/dist/extensions/provider/connection.js.map +1 -1
  380. package/dist/extensions/provider/editing.d.ts +36 -0
  381. package/dist/extensions/provider/editing.d.ts.map +1 -0
  382. package/dist/extensions/provider/editing.js +99 -0
  383. package/dist/extensions/provider/editing.js.map +1 -0
  384. package/dist/extensions/provider/json-fields.d.ts +5 -0
  385. package/dist/extensions/provider/json-fields.d.ts.map +1 -0
  386. package/dist/extensions/provider/json-fields.js +31 -0
  387. package/dist/extensions/provider/json-fields.js.map +1 -0
  388. package/dist/extensions/provider/store.d.ts +1 -4
  389. package/dist/extensions/provider/store.d.ts.map +1 -1
  390. package/dist/extensions/provider/store.js +2 -30
  391. package/dist/extensions/provider/store.js.map +1 -1
  392. package/dist/extensions/provider/ui/builtin-data.d.ts +0 -2
  393. package/dist/extensions/provider/ui/builtin-data.d.ts.map +1 -1
  394. package/dist/extensions/provider/ui/builtin-data.js +14 -79
  395. package/dist/extensions/provider/ui/builtin-data.js.map +1 -1
  396. package/dist/extensions/provider/ui/compat.d.ts.map +1 -1
  397. package/dist/extensions/provider/ui/compat.js +6 -9
  398. package/dist/extensions/provider/ui/compat.js.map +1 -1
  399. package/dist/extensions/provider/ui/controls.d.ts +48 -0
  400. package/dist/extensions/provider/ui/controls.d.ts.map +1 -0
  401. package/dist/extensions/provider/ui/controls.js +108 -0
  402. package/dist/extensions/provider/ui/controls.js.map +1 -0
  403. package/dist/extensions/provider/ui/dictionary.d.ts.map +1 -1
  404. package/dist/extensions/provider/ui/dictionary.js +6 -9
  405. package/dist/extensions/provider/ui/dictionary.js.map +1 -1
  406. package/dist/extensions/provider/ui/editor.d.ts +3 -3
  407. package/dist/extensions/provider/ui/editor.d.ts.map +1 -1
  408. package/dist/extensions/provider/ui/editor.js +35 -140
  409. package/dist/extensions/provider/ui/editor.js.map +1 -1
  410. package/dist/extensions/provider/ui/fetch-models.d.ts +0 -3
  411. package/dist/extensions/provider/ui/fetch-models.d.ts.map +1 -1
  412. package/dist/extensions/provider/ui/fetch-models.js +49 -44
  413. package/dist/extensions/provider/ui/fetch-models.js.map +1 -1
  414. package/dist/extensions/provider/ui/model-fields.d.ts.map +1 -1
  415. package/dist/extensions/provider/ui/model-fields.js +11 -14
  416. package/dist/extensions/provider/ui/model-fields.js.map +1 -1
  417. package/dist/extensions/provider/ui/model-options.d.ts +4 -34
  418. package/dist/extensions/provider/ui/model-options.d.ts.map +1 -1
  419. package/dist/extensions/provider/ui/model-options.js +90 -271
  420. package/dist/extensions/provider/ui/model-options.js.map +1 -1
  421. package/dist/extensions/provider/ui/pane.d.ts +4 -18
  422. package/dist/extensions/provider/ui/pane.d.ts.map +1 -1
  423. package/dist/extensions/provider/ui/pane.js.map +1 -1
  424. package/dist/extensions/provider/ui/provider-fields.d.ts +2 -19
  425. package/dist/extensions/provider/ui/provider-fields.d.ts.map +1 -1
  426. package/dist/extensions/provider/ui/provider-fields.js +58 -171
  427. package/dist/extensions/provider/ui/provider-fields.js.map +1 -1
  428. package/dist/extensions/provider/ui/thinking-map.d.ts.map +1 -1
  429. package/dist/extensions/provider/ui/thinking-map.js +6 -9
  430. package/dist/extensions/provider/ui/thinking-map.js.map +1 -1
  431. package/dist/extensions/question/detail-pane.d.ts +7 -2
  432. package/dist/extensions/question/detail-pane.d.ts.map +1 -1
  433. package/dist/extensions/question/detail-pane.js +16 -5
  434. package/dist/extensions/question/detail-pane.js.map +1 -1
  435. package/dist/extensions/question/dialog-view.d.ts +41 -0
  436. package/dist/extensions/question/dialog-view.d.ts.map +1 -0
  437. package/dist/extensions/question/dialog-view.js +329 -0
  438. package/dist/extensions/question/dialog-view.js.map +1 -0
  439. package/dist/extensions/question/dialog.d.ts +3 -3
  440. package/dist/extensions/question/dialog.d.ts.map +1 -1
  441. package/dist/extensions/question/dialog.js +220 -634
  442. package/dist/extensions/question/dialog.js.map +1 -1
  443. package/dist/extensions/question/index.d.ts.map +1 -1
  444. package/dist/extensions/question/index.js +2 -3
  445. package/dist/extensions/question/index.js.map +1 -1
  446. package/dist/extensions/question/render.d.ts.map +1 -1
  447. package/dist/extensions/question/render.js +22 -32
  448. package/dist/extensions/question/render.js.map +1 -1
  449. package/dist/extensions/question/results.d.ts.map +1 -1
  450. package/dist/extensions/question/results.js +56 -12
  451. package/dist/extensions/question/results.js.map +1 -1
  452. package/dist/extensions/question/schema.d.ts +21 -6
  453. package/dist/extensions/question/schema.d.ts.map +1 -1
  454. package/dist/extensions/question/schema.js.map +1 -1
  455. package/dist/extensions/question/state.d.ts +9 -7
  456. package/dist/extensions/question/state.d.ts.map +1 -1
  457. package/dist/extensions/question/state.js +63 -54
  458. package/dist/extensions/question/state.js.map +1 -1
  459. package/dist/extensions/question/types.d.ts +41 -18
  460. package/dist/extensions/question/types.d.ts.map +1 -1
  461. package/dist/extensions/question/types.js.map +1 -1
  462. package/dist/extensions/statusline/index.d.ts +4 -0
  463. package/dist/extensions/statusline/index.d.ts.map +1 -1
  464. package/dist/extensions/statusline/index.js +18 -355
  465. package/dist/extensions/statusline/index.js.map +1 -1
  466. package/dist/extensions/statusline/render.d.ts +19 -0
  467. package/dist/extensions/statusline/render.d.ts.map +1 -0
  468. package/dist/extensions/statusline/render.js +163 -0
  469. package/dist/extensions/statusline/render.js.map +1 -0
  470. package/dist/extensions/statusline/usage.d.ts +12 -0
  471. package/dist/extensions/statusline/usage.d.ts.map +1 -0
  472. package/dist/extensions/statusline/usage.js +36 -0
  473. package/dist/extensions/statusline/usage.js.map +1 -0
  474. package/dist/extensions/tool-search/index.d.ts +12 -0
  475. package/dist/extensions/tool-search/index.d.ts.map +1 -0
  476. package/dist/extensions/tool-search/index.js +20 -0
  477. package/dist/extensions/tool-search/index.js.map +1 -0
  478. package/dist/extensions/tool-search/tool.d.ts +73 -0
  479. package/dist/extensions/tool-search/tool.d.ts.map +1 -0
  480. package/dist/extensions/tool-search/tool.js +187 -0
  481. package/dist/extensions/tool-search/tool.js.map +1 -0
  482. package/dist/extensions/web-search/execute.d.ts +1 -5
  483. package/dist/extensions/web-search/execute.d.ts.map +1 -1
  484. package/dist/extensions/web-search/execute.js +4 -9
  485. package/dist/extensions/web-search/execute.js.map +1 -1
  486. package/dist/extensions/web-search/format.d.ts +12 -3
  487. package/dist/extensions/web-search/format.d.ts.map +1 -1
  488. package/dist/extensions/web-search/format.js +33 -25
  489. package/dist/extensions/web-search/format.js.map +1 -1
  490. package/dist/extensions/web-search/index.d.ts.map +1 -1
  491. package/dist/extensions/web-search/index.js +6 -29
  492. package/dist/extensions/web-search/index.js.map +1 -1
  493. package/dist/extensions/web-search/providers/deepseek.d.ts.map +1 -1
  494. package/dist/extensions/web-search/providers/deepseek.js +0 -1
  495. package/dist/extensions/web-search/providers/deepseek.js.map +1 -1
  496. package/dist/extensions/web-search/providers/http.d.ts +1 -1
  497. package/dist/extensions/web-search/providers/http.d.ts.map +1 -1
  498. package/dist/extensions/web-search/providers/http.js.map +1 -1
  499. package/dist/extensions/web-search/providers/minimax.d.ts.map +1 -1
  500. package/dist/extensions/web-search/providers/minimax.js +0 -1
  501. package/dist/extensions/web-search/providers/minimax.js.map +1 -1
  502. package/dist/extensions/web-search/render.d.ts +7 -2
  503. package/dist/extensions/web-search/render.d.ts.map +1 -1
  504. package/dist/extensions/web-search/render.js +32 -4
  505. package/dist/extensions/web-search/render.js.map +1 -1
  506. package/dist/extensions/web-search/results.d.ts.map +1 -1
  507. package/dist/extensions/web-search/results.js +3 -8
  508. package/dist/extensions/web-search/results.js.map +1 -1
  509. package/dist/extensions/web-search/types.d.ts +4 -2
  510. package/dist/extensions/web-search/types.d.ts.map +1 -1
  511. package/dist/extensions/web-search/types.js.map +1 -1
  512. package/dist/index.d.ts +12 -5
  513. package/dist/index.d.ts.map +1 -1
  514. package/dist/index.js +6 -1
  515. package/dist/index.js.map +1 -1
  516. package/dist/main.d.ts.map +1 -1
  517. package/dist/main.js +16 -0
  518. package/dist/main.js.map +1 -1
  519. package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
  520. package/dist/modes/interactive/components/config-selector.js +13 -3
  521. package/dist/modes/interactive/components/config-selector.js.map +1 -1
  522. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  523. package/dist/modes/interactive/components/custom-message.js +3 -1
  524. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  525. package/dist/modes/interactive/components/first-time-setup.d.ts +4 -4
  526. package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
  527. package/dist/modes/interactive/components/first-time-setup.js +8 -2
  528. package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
  529. package/dist/modes/interactive/components/footer.d.ts +7 -0
  530. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  531. package/dist/modes/interactive/components/footer.js +42 -3
  532. package/dist/modes/interactive/components/footer.js.map +1 -1
  533. package/dist/modes/interactive/components/oauth-selector.d.ts +8 -2
  534. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  535. package/dist/modes/interactive/components/oauth-selector.js +24 -21
  536. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  537. package/dist/modes/interactive/components/pi-logo-animation.d.ts +68 -0
  538. package/dist/modes/interactive/components/pi-logo-animation.d.ts.map +1 -0
  539. package/dist/modes/interactive/components/pi-logo-animation.js +1076 -0
  540. package/dist/modes/interactive/components/pi-logo-animation.js.map +1 -0
  541. package/dist/modes/interactive/components/pi-logo-animation.lazy.d.ts +7 -0
  542. package/dist/modes/interactive/components/pi-logo-animation.lazy.d.ts.map +1 -0
  543. package/dist/modes/interactive/components/pi-logo-animation.lazy.js +12 -0
  544. package/dist/modes/interactive/components/pi-logo-animation.lazy.js.map +1 -0
  545. package/dist/modes/interactive/components/pi-logo.d.ts +19 -0
  546. package/dist/modes/interactive/components/pi-logo.d.ts.map +1 -0
  547. package/dist/modes/interactive/components/pi-logo.js +37 -0
  548. package/dist/modes/interactive/components/pi-logo.js.map +1 -0
  549. package/dist/modes/interactive/components/radius-login-selector.d.ts +15 -0
  550. package/dist/modes/interactive/components/radius-login-selector.d.ts.map +1 -0
  551. package/dist/modes/interactive/components/radius-login-selector.js +83 -0
  552. package/dist/modes/interactive/components/radius-login-selector.js.map +1 -0
  553. package/dist/modes/interactive/components/settings-selector.d.ts +6 -4
  554. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  555. package/dist/modes/interactive/components/settings-selector.js +33 -11
  556. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  557. package/dist/modes/interactive/components/status-marker.d.ts +2 -4
  558. package/dist/modes/interactive/components/status-marker.d.ts.map +1 -1
  559. package/dist/modes/interactive/components/status-marker.js +2 -6
  560. package/dist/modes/interactive/components/status-marker.js.map +1 -1
  561. package/dist/modes/interactive/components/themed-text.d.ts +17 -0
  562. package/dist/modes/interactive/components/themed-text.d.ts.map +1 -0
  563. package/dist/modes/interactive/components/themed-text.js +28 -0
  564. package/dist/modes/interactive/components/themed-text.js.map +1 -0
  565. package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
  566. package/dist/modes/interactive/components/user-message.js +5 -4
  567. package/dist/modes/interactive/components/user-message.js.map +1 -1
  568. package/dist/modes/interactive/components/visual-truncate.d.ts +27 -3
  569. package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
  570. package/dist/modes/interactive/components/visual-truncate.js +36 -6
  571. package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
  572. package/dist/modes/interactive/interactive-mode.d.ts +12 -4
  573. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  574. package/dist/modes/interactive/interactive-mode.js +377 -199
  575. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  576. package/dist/modes/interactive/tasks/completion-render.d.ts +8 -0
  577. package/dist/modes/interactive/tasks/completion-render.d.ts.map +1 -0
  578. package/dist/{extensions/background → modes/interactive/tasks}/completion-render.js +41 -91
  579. package/dist/modes/interactive/tasks/completion-render.js.map +1 -0
  580. package/dist/modes/interactive/tasks/index.d.ts +12 -0
  581. package/dist/modes/interactive/tasks/index.d.ts.map +1 -0
  582. package/dist/modes/interactive/tasks/index.js +102 -0
  583. package/dist/modes/interactive/tasks/index.js.map +1 -0
  584. package/dist/modes/interactive/tasks/inspector.d.ts +35 -0
  585. package/dist/modes/interactive/tasks/inspector.d.ts.map +1 -0
  586. package/dist/modes/interactive/tasks/inspector.js +93 -0
  587. package/dist/modes/interactive/tasks/inspector.js.map +1 -0
  588. package/dist/modes/interactive/tasks/layout.d.ts +40 -0
  589. package/dist/modes/interactive/tasks/layout.d.ts.map +1 -0
  590. package/dist/modes/interactive/tasks/layout.js +212 -0
  591. package/dist/modes/interactive/tasks/layout.js.map +1 -0
  592. package/dist/modes/interactive/tasks/list.d.ts +21 -0
  593. package/dist/modes/interactive/tasks/list.d.ts.map +1 -0
  594. package/dist/modes/interactive/tasks/list.js +96 -0
  595. package/dist/modes/interactive/tasks/list.js.map +1 -0
  596. package/dist/modes/interactive/tasks/manager.d.ts +60 -0
  597. package/dist/modes/interactive/tasks/manager.d.ts.map +1 -0
  598. package/dist/modes/interactive/tasks/manager.js +380 -0
  599. package/dist/modes/interactive/tasks/manager.js.map +1 -0
  600. package/dist/modes/interactive/tasks/model.d.ts +21 -0
  601. package/dist/modes/interactive/tasks/model.d.ts.map +1 -0
  602. package/dist/modes/interactive/tasks/model.js +41 -0
  603. package/dist/modes/interactive/tasks/model.js.map +1 -0
  604. package/dist/modes/interactive/tasks/render.d.ts +28 -0
  605. package/dist/modes/interactive/tasks/render.d.ts.map +1 -0
  606. package/dist/modes/interactive/tasks/render.js +141 -0
  607. package/dist/modes/interactive/tasks/render.js.map +1 -0
  608. package/dist/modes/interactive/tasks/task-view.d.ts +13 -0
  609. package/dist/modes/interactive/tasks/task-view.d.ts.map +1 -0
  610. package/dist/modes/interactive/tasks/task-view.js +20 -0
  611. package/dist/modes/interactive/tasks/task-view.js.map +1 -0
  612. package/dist/modes/interactive/tasks/text.d.ts +6 -0
  613. package/dist/modes/interactive/tasks/text.d.ts.map +1 -0
  614. package/dist/modes/interactive/tasks/text.js +16 -0
  615. package/dist/modes/interactive/tasks/text.js.map +1 -0
  616. package/dist/modes/interactive/tasks/viewport.d.ts +17 -0
  617. package/dist/modes/interactive/tasks/viewport.d.ts.map +1 -0
  618. package/dist/modes/interactive/tasks/viewport.js +59 -0
  619. package/dist/modes/interactive/tasks/viewport.js.map +1 -0
  620. package/dist/modes/interactive/tasks/views.d.ts +9 -0
  621. package/dist/modes/interactive/tasks/views.d.ts.map +1 -0
  622. package/dist/modes/interactive/tasks/views.js +42 -0
  623. package/dist/modes/interactive/tasks/views.js.map +1 -0
  624. package/dist/modes/interactive/theme/dark.json +59 -72
  625. package/dist/modes/interactive/theme/light.json +57 -69
  626. package/dist/modes/interactive/theme/system-theme.d.ts +55 -0
  627. package/dist/modes/interactive/theme/system-theme.d.ts.map +1 -0
  628. package/dist/modes/interactive/theme/system-theme.js +546 -0
  629. package/dist/modes/interactive/theme/system-theme.js.map +1 -0
  630. package/dist/modes/interactive/theme/theme-controller.d.ts +46 -6
  631. package/dist/modes/interactive/theme/theme-controller.d.ts.map +1 -1
  632. package/dist/modes/interactive/theme/theme-controller.js +125 -47
  633. package/dist/modes/interactive/theme/theme-controller.js.map +1 -1
  634. package/dist/modes/interactive/theme/theme-json.d.ts +1 -0
  635. package/dist/modes/interactive/theme/theme-json.d.ts.map +1 -1
  636. package/dist/modes/interactive/theme/theme-json.js +3 -1
  637. package/dist/modes/interactive/theme/theme-json.js.map +1 -1
  638. package/dist/modes/interactive/theme/theme-schema.json +7 -2
  639. package/dist/modes/interactive/theme/theme.d.ts +70 -39
  640. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  641. package/dist/modes/interactive/theme/theme.js +247 -313
  642. package/dist/modes/interactive/theme/theme.js.map +1 -1
  643. package/dist/modes/interactive/tool-view/fallback.d.ts +1 -1
  644. package/dist/modes/interactive/tool-view/fallback.d.ts.map +1 -1
  645. package/dist/modes/interactive/tool-view/fallback.js +4 -1
  646. package/dist/modes/interactive/tool-view/fallback.js.map +1 -1
  647. package/dist/modes/interactive/tool-view/tool-execution.js +2 -2
  648. package/dist/modes/interactive/tool-view/tool-execution.js.map +1 -1
  649. package/dist/modes/interactive/tui-renderer.d.ts +2 -1
  650. package/dist/modes/interactive/tui-renderer.d.ts.map +1 -1
  651. package/dist/modes/interactive/tui-renderer.js +1 -0
  652. package/dist/modes/interactive/tui-renderer.js.map +1 -1
  653. package/dist/modes/rpc/rpc-client.d.ts +6 -6
  654. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  655. package/dist/modes/rpc/rpc-client.js +12 -8
  656. package/dist/modes/rpc/rpc-client.js.map +1 -1
  657. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  658. package/dist/modes/rpc/rpc-mode.js +7 -9
  659. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  660. package/dist/modes/rpc/rpc-types.d.ts +10 -1
  661. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  662. package/dist/modes/rpc/rpc-types.js.map +1 -1
  663. package/dist/package-manager-cli.d.ts.map +1 -1
  664. package/dist/package-manager-cli.js +6 -2
  665. package/dist/package-manager-cli.js.map +1 -1
  666. package/dist/utils/clipboard-image.d.ts.map +1 -1
  667. package/dist/utils/clipboard-image.js +14 -17
  668. package/dist/utils/clipboard-image.js.map +1 -1
  669. package/dist/utils/clipboard.d.ts +2 -0
  670. package/dist/utils/clipboard.d.ts.map +1 -1
  671. package/dist/utils/clipboard.js +5 -0
  672. package/dist/utils/clipboard.js.map +1 -1
  673. package/dist/utils/paths.d.ts +3 -3
  674. package/dist/utils/paths.d.ts.map +1 -1
  675. package/dist/utils/paths.js +5 -4
  676. package/dist/utils/paths.js.map +1 -1
  677. package/dist/utils/shell.d.ts +1 -3
  678. package/dist/utils/shell.d.ts.map +1 -1
  679. package/dist/utils/shell.js +3 -30
  680. package/dist/utils/shell.js.map +1 -1
  681. package/docs/bundled/README.md +22 -9
  682. package/docs/bundled/extensions/question.md +2 -2
  683. package/docs/bundled/extensions/statusline.md +26 -17
  684. package/docs/bundled/tasks.md +127 -0
  685. package/docs/bundled/tool-presentation.md +1 -1
  686. package/docs/codemode.md +207 -0
  687. package/docs/custom-provider.md +44 -0
  688. package/docs/docs.json +14 -10
  689. package/docs/environment-variables.md +1 -1
  690. package/docs/extensions.md +94 -93
  691. package/docs/index.md +2 -1
  692. package/docs/keybindings.md +17 -9
  693. package/docs/llama-cpp.md +12 -1
  694. package/docs/mcp.md +248 -0
  695. package/docs/models.md +56 -0
  696. package/docs/packages.md +4 -0
  697. package/docs/providers.md +14 -0
  698. package/docs/rpc.md +5 -3
  699. package/docs/sdk.md +26 -16
  700. package/docs/security.md +4 -0
  701. package/docs/session-format.md +20 -23
  702. package/docs/settings.md +29 -3
  703. package/docs/themes.md +27 -5
  704. package/docs/tui.md +21 -1
  705. package/docs/usage.md +52 -4
  706. package/docs/virtual-models.md +114 -0
  707. package/docs/windows.md +2 -0
  708. package/examples/README.md +2 -2
  709. package/examples/extensions/README.md +3 -2
  710. package/examples/extensions/built-in-tool-renderer.ts +16 -40
  711. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  712. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  713. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  714. package/examples/extensions/custom-provider-gitlab-duo/test.ts +4 -4
  715. package/examples/extensions/debug-provider.ts +90 -0
  716. package/examples/extensions/gondolin/package-lock.json +2 -2
  717. package/examples/extensions/gondolin/package.json +1 -1
  718. package/examples/extensions/jev-router.ts +113 -0
  719. package/examples/extensions/minimal-mode.ts +24 -96
  720. package/examples/extensions/sandbox/package-lock.json +2 -2
  721. package/examples/extensions/sandbox/package.json +1 -1
  722. package/examples/extensions/with-deps/package-lock.json +2 -2
  723. package/examples/extensions/with-deps/package.json +1 -1
  724. package/examples/rpc-client.ts +1 -1
  725. package/examples/rpc-extension-ui.ts +1 -1
  726. package/examples/sdk/14-codemode-mcp.ts +61 -0
  727. package/examples/sdk/README.md +1 -0
  728. package/npm-shrinkwrap.json +420 -423
  729. package/package.json +14 -10
  730. package/dist/bundle/chunks/anthropic-messages-XWFTZP2N.js +0 -6
  731. package/dist/bundle/chunks/azure-openai-responses-HS35BQV6.js +0 -2
  732. package/dist/bundle/chunks/chunk-2IO5GDBS.js +0 -11
  733. package/dist/bundle/chunks/chunk-EDBLK2JQ.js +0 -2
  734. package/dist/bundle/chunks/chunk-I5IVW2WS.js +0 -2
  735. package/dist/bundle/chunks/chunk-IORR2FW4.js +0 -2
  736. package/dist/bundle/chunks/chunk-NUHFSC37.js +0 -25
  737. package/dist/bundle/chunks/chunk-UUSTLCVC.js +0 -2
  738. package/dist/bundle/chunks/google-generative-ai-NOVAJBFC.js +0 -2
  739. package/dist/bundle/chunks/google-vertex-4VHCZJV5.js +0 -2
  740. package/dist/bundle/chunks/mistral-conversations-WC6A2WCJ.js +0 -5
  741. package/dist/bundle/chunks/openai-codex-responses-XCDG75W2.js +0 -10
  742. package/dist/bundle/chunks/openai-completions-SHS3CAEL.js +0 -7
  743. package/dist/bundle/chunks/openai-responses-UT6XFKC7.js +0 -2
  744. package/dist/bundle/chunks/virtual-modules-KUEIEAZN.js +0 -2
  745. package/dist/core/background/history.d.ts +0 -4
  746. package/dist/core/background/history.d.ts.map +0 -1
  747. package/dist/core/background/history.js.map +0 -1
  748. package/dist/core/background/output.d.ts.map +0 -1
  749. package/dist/core/background/output.js.map +0 -1
  750. package/dist/core/background/presentation.d.ts +0 -9
  751. package/dist/core/background/presentation.d.ts.map +0 -1
  752. package/dist/core/background/presentation.js +0 -311
  753. package/dist/core/background/presentation.js.map +0 -1
  754. package/dist/core/background/service.d.ts +0 -68
  755. package/dist/core/background/service.d.ts.map +0 -1
  756. package/dist/core/background/service.js +0 -641
  757. package/dist/core/background/service.js.map +0 -1
  758. package/dist/core/background/session.d.ts +0 -67
  759. package/dist/core/background/session.d.ts.map +0 -1
  760. package/dist/core/background/session.js +0 -248
  761. package/dist/core/background/session.js.map +0 -1
  762. package/dist/core/background/types.d.ts.map +0 -1
  763. package/dist/core/background/types.js +0 -31
  764. package/dist/core/background/types.js.map +0 -1
  765. package/dist/extensions/background/actions.d.ts +0 -11
  766. package/dist/extensions/background/actions.d.ts.map +0 -1
  767. package/dist/extensions/background/actions.js.map +0 -1
  768. package/dist/extensions/background/completion-render.d.ts +0 -8
  769. package/dist/extensions/background/completion-render.d.ts.map +0 -1
  770. package/dist/extensions/background/completion-render.js.map +0 -1
  771. package/dist/extensions/background/constants.d.ts +0 -24
  772. package/dist/extensions/background/constants.d.ts.map +0 -1
  773. package/dist/extensions/background/constants.js +0 -24
  774. package/dist/extensions/background/constants.js.map +0 -1
  775. package/dist/extensions/background/index.d.ts +0 -7
  776. package/dist/extensions/background/index.d.ts.map +0 -1
  777. package/dist/extensions/background/index.js +0 -135
  778. package/dist/extensions/background/index.js.map +0 -1
  779. package/dist/extensions/background/keybindings.d.ts +0 -10
  780. package/dist/extensions/background/keybindings.d.ts.map +0 -1
  781. package/dist/extensions/background/keybindings.js +0 -14
  782. package/dist/extensions/background/keybindings.js.map +0 -1
  783. package/dist/extensions/background/manager.d.ts +0 -80
  784. package/dist/extensions/background/manager.d.ts.map +0 -1
  785. package/dist/extensions/background/manager.js +0 -673
  786. package/dist/extensions/background/manager.js.map +0 -1
  787. package/dist/extensions/background/render.d.ts +0 -42
  788. package/dist/extensions/background/render.d.ts.map +0 -1
  789. package/dist/extensions/background/render.js +0 -225
  790. package/dist/extensions/background/render.js.map +0 -1
  791. package/dist/extensions/background/schema.d.ts.map +0 -1
  792. package/dist/extensions/background/schema.js.map +0 -1
  793. package/dist/extensions/background/task-view.d.ts +0 -53
  794. package/dist/extensions/background/task-view.d.ts.map +0 -1
  795. package/dist/extensions/background/task-view.js +0 -60
  796. package/dist/extensions/background/task-view.js.map +0 -1
  797. package/dist/extensions/background/text.d.ts +0 -12
  798. package/dist/extensions/background/text.d.ts.map +0 -1
  799. package/dist/extensions/background/text.js +0 -39
  800. package/dist/extensions/background/text.js.map +0 -1
  801. package/dist/extensions/background/types.d.ts +0 -85
  802. package/dist/extensions/background/types.d.ts.map +0 -1
  803. package/dist/extensions/background/types.js +0 -17
  804. package/dist/extensions/background/types.js.map +0 -1
  805. package/dist/extensions/subagent/activity.d.ts +0 -34
  806. package/dist/extensions/subagent/activity.d.ts.map +0 -1
  807. package/dist/extensions/subagent/activity.js +0 -192
  808. package/dist/extensions/subagent/activity.js.map +0 -1
  809. package/dist/extensions/subagent/agents-command.d.ts +0 -4
  810. package/dist/extensions/subagent/agents-command.d.ts.map +0 -1
  811. package/dist/extensions/subagent/agents-command.js +0 -230
  812. package/dist/extensions/subagent/agents-command.js.map +0 -1
  813. package/dist/extensions/subagent/agents.d.ts +0 -6
  814. package/dist/extensions/subagent/agents.d.ts.map +0 -1
  815. package/dist/extensions/subagent/agents.js +0 -53
  816. package/dist/extensions/subagent/agents.js.map +0 -1
  817. package/dist/extensions/subagent/budget.d.ts +0 -15
  818. package/dist/extensions/subagent/budget.d.ts.map +0 -1
  819. package/dist/extensions/subagent/budget.js +0 -123
  820. package/dist/extensions/subagent/budget.js.map +0 -1
  821. package/dist/extensions/subagent/cancellation.d.ts +0 -29
  822. package/dist/extensions/subagent/cancellation.d.ts.map +0 -1
  823. package/dist/extensions/subagent/cancellation.js +0 -91
  824. package/dist/extensions/subagent/cancellation.js.map +0 -1
  825. package/dist/extensions/subagent/constants.d.ts +0 -25
  826. package/dist/extensions/subagent/constants.d.ts.map +0 -1
  827. package/dist/extensions/subagent/constants.js +0 -50
  828. package/dist/extensions/subagent/constants.js.map +0 -1
  829. package/dist/extensions/subagent/index.d.ts +0 -3
  830. package/dist/extensions/subagent/index.d.ts.map +0 -1
  831. package/dist/extensions/subagent/index.js +0 -151
  832. package/dist/extensions/subagent/index.js.map +0 -1
  833. package/dist/extensions/subagent/model-selection.d.ts +0 -16
  834. package/dist/extensions/subagent/model-selection.d.ts.map +0 -1
  835. package/dist/extensions/subagent/model-selection.js +0 -51
  836. package/dist/extensions/subagent/model-selection.js.map +0 -1
  837. package/dist/extensions/subagent/render.d.ts +0 -24
  838. package/dist/extensions/subagent/render.d.ts.map +0 -1
  839. package/dist/extensions/subagent/render.js +0 -336
  840. package/dist/extensions/subagent/render.js.map +0 -1
  841. package/dist/extensions/subagent/resolve.d.ts +0 -31
  842. package/dist/extensions/subagent/resolve.d.ts.map +0 -1
  843. package/dist/extensions/subagent/resolve.js +0 -111
  844. package/dist/extensions/subagent/resolve.js.map +0 -1
  845. package/dist/extensions/subagent/runner.d.ts +0 -35
  846. package/dist/extensions/subagent/runner.d.ts.map +0 -1
  847. package/dist/extensions/subagent/runner.js +0 -255
  848. package/dist/extensions/subagent/runner.js.map +0 -1
  849. package/dist/extensions/subagent/schema.d.ts +0 -28
  850. package/dist/extensions/subagent/schema.d.ts.map +0 -1
  851. package/dist/extensions/subagent/schema.js +0 -58
  852. package/dist/extensions/subagent/schema.js.map +0 -1
  853. package/dist/extensions/subagent/sdk-runner.d.ts +0 -33
  854. package/dist/extensions/subagent/sdk-runner.d.ts.map +0 -1
  855. package/dist/extensions/subagent/sdk-runner.js +0 -331
  856. package/dist/extensions/subagent/sdk-runner.js.map +0 -1
  857. package/dist/extensions/subagent/settings.d.ts +0 -8
  858. package/dist/extensions/subagent/settings.d.ts.map +0 -1
  859. package/dist/extensions/subagent/settings.js +0 -206
  860. package/dist/extensions/subagent/settings.js.map +0 -1
  861. package/dist/extensions/subagent/state.d.ts +0 -102
  862. package/dist/extensions/subagent/state.d.ts.map +0 -1
  863. package/dist/extensions/subagent/state.js +0 -383
  864. package/dist/extensions/subagent/state.js.map +0 -1
  865. package/dist/extensions/subagent/text.d.ts +0 -6
  866. package/dist/extensions/subagent/text.d.ts.map +0 -1
  867. package/dist/extensions/subagent/text.js +0 -66
  868. package/dist/extensions/subagent/text.js.map +0 -1
  869. package/dist/extensions/subagent/types.d.ts +0 -91
  870. package/dist/extensions/subagent/types.d.ts.map +0 -1
  871. package/dist/extensions/subagent/types.js +0 -2
  872. package/dist/extensions/subagent/types.js.map +0 -1
  873. package/dist/extensions/subagent/ui/agents-dialog.d.ts +0 -4
  874. package/dist/extensions/subagent/ui/agents-dialog.d.ts.map +0 -1
  875. package/dist/extensions/subagent/ui/agents-dialog.js +0 -84
  876. package/dist/extensions/subagent/ui/agents-dialog.js.map +0 -1
  877. package/dist/extensions/subagent/ui/choice-menu.d.ts +0 -39
  878. package/dist/extensions/subagent/ui/choice-menu.d.ts.map +0 -1
  879. package/dist/extensions/subagent/ui/choice-menu.js +0 -93
  880. package/dist/extensions/subagent/ui/choice-menu.js.map +0 -1
  881. package/dist/extensions/subagent/ui/choices.d.ts +0 -36
  882. package/dist/extensions/subagent/ui/choices.d.ts.map +0 -1
  883. package/dist/extensions/subagent/ui/choices.js +0 -54
  884. package/dist/extensions/subagent/ui/choices.js.map +0 -1
  885. package/dist/extensions/subagent/ui/model-list.d.ts +0 -66
  886. package/dist/extensions/subagent/ui/model-list.d.ts.map +0 -1
  887. package/dist/extensions/subagent/ui/model-list.js +0 -235
  888. package/dist/extensions/subagent/ui/model-list.js.map +0 -1
  889. package/dist/extensions/subagent/ui/model-picker.d.ts +0 -47
  890. package/dist/extensions/subagent/ui/model-picker.d.ts.map +0 -1
  891. package/dist/extensions/subagent/ui/model-picker.js +0 -143
  892. package/dist/extensions/subagent/ui/model-picker.js.map +0 -1
  893. package/dist/extensions/subagent/ui/profile-settings-menu.d.ts +0 -41
  894. package/dist/extensions/subagent/ui/profile-settings-menu.d.ts.map +0 -1
  895. package/dist/extensions/subagent/ui/profile-settings-menu.js +0 -98
  896. package/dist/extensions/subagent/ui/profile-settings-menu.js.map +0 -1
  897. package/dist/extensions/todo/constants.d.ts +0 -16
  898. package/dist/extensions/todo/constants.d.ts.map +0 -1
  899. package/dist/extensions/todo/constants.js +0 -30
  900. package/dist/extensions/todo/constants.js.map +0 -1
  901. package/dist/extensions/todo/index.d.ts +0 -3
  902. package/dist/extensions/todo/index.d.ts.map +0 -1
  903. package/dist/extensions/todo/index.js +0 -98
  904. package/dist/extensions/todo/index.js.map +0 -1
  905. package/dist/extensions/todo/schema.d.ts +0 -60
  906. package/dist/extensions/todo/schema.d.ts.map +0 -1
  907. package/dist/extensions/todo/schema.js +0 -56
  908. package/dist/extensions/todo/schema.js.map +0 -1
  909. package/dist/extensions/todo/state.d.ts +0 -34
  910. package/dist/extensions/todo/state.d.ts.map +0 -1
  911. package/dist/extensions/todo/state.js +0 -425
  912. package/dist/extensions/todo/state.js.map +0 -1
  913. package/dist/extensions/todo/view.d.ts +0 -36
  914. package/dist/extensions/todo/view.d.ts.map +0 -1
  915. package/dist/extensions/todo/view.js +0 -580
  916. package/dist/extensions/todo/view.js.map +0 -1
  917. package/dist/extensions/todo/widget.d.ts +0 -15
  918. package/dist/extensions/todo/widget.d.ts.map +0 -1
  919. package/dist/extensions/todo/widget.js +0 -50
  920. package/dist/extensions/todo/widget.js.map +0 -1
  921. package/docs/bundled/extensions/background.md +0 -132
  922. package/docs/bundled/extensions/subagent.md +0 -148
  923. package/docs/bundled/extensions/todo.md +0 -104
  924. package/examples/extensions/todo.ts +0 -297
package/docs/mcp.md ADDED
@@ -0,0 +1,248 @@
1
+ # MCP Servers
2
+
3
+ The MCP integration is provided by [upstream Pi](https://github.com/earendil-works/pi) and included in `@astralyn/pi`. It connects to [Model Context Protocol](https://modelcontextprotocol.io) servers over stdio or streamable HTTP and makes their tools and resources available to the model.
4
+
5
+ ## Quick setup
6
+
7
+ Add a local stdio server, check the connection, then start Pi:
8
+
9
+ ```bash
10
+ pi mcp add filesystem -- npx -y @modelcontextprotocol/server-filesystem .
11
+ pi mcp list
12
+ pi
13
+ ```
14
+
15
+ For a remote server:
16
+
17
+ ```bash
18
+ pi mcp add docs --url https://example.com/mcp --bearer-token-env-var DOCS_TOKEN
19
+ pi mcp list
20
+ ```
21
+
22
+ These commands add user-level servers by default. Add `--local` or `-l` to write the project configuration instead:
23
+
24
+ ```bash
25
+ pi mcp add -l tools --env API_KEY='${TOOLS_KEY}' -- uvx tools-mcp
26
+ ```
27
+
28
+ Use `/mcp` inside an interactive session to inspect connections, sign in, reconnect, change exposure, or enable and disable servers. Run `/reload` after adding, removing, or changing a server outside the session.
29
+
30
+ ## Configure servers
31
+
32
+ Pi reads user-level servers from `~/.pi/agent/mcp.json` and project servers from `.pi/mcp.json`. Project configuration is read only after [project trust](security.md#project-trust) is granted. A project entry replaces a user-level entry with the same name.
33
+
34
+ The format matches other MCP clients:
35
+
36
+ ```json
37
+ {
38
+ "mcpServers": {
39
+ "filesystem": {
40
+ "command": "npx",
41
+ "args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
42
+ },
43
+ "docs": {
44
+ "url": "https://example.com/mcp",
45
+ "headers": { "Authorization": "Bearer ${DOCS_TOKEN}" },
46
+ "description": "Search and read the product documentation"
47
+ }
48
+ }
49
+ }
50
+ ```
51
+
52
+ Stdio servers use `command`, `args`, `env`, and `cwd`. Relative `cwd` values resolve against the session directory. A leading `~/` in `command`, an argument, or `cwd` names the home directory.
53
+
54
+ HTTP servers use `url`, `headers`, and `oauth` (see [Authenticate with OAuth](#authenticate-with-oauth)). The legacy SSE transport is not supported.
55
+
56
+ Both server types support:
57
+
58
+ - `timeout`: per-request timeout in seconds (default 60). Progress notifications reset it.
59
+ - `enabled: false`: keep the entry without connecting to it.
60
+ - `exposure` and `toolExposure`: control how tools reach the model (see [Control tool exposure](#control-tool-exposure)).
61
+ - `description`: what the server offers, in a sentence. It lists the server in the system prompt (see [Control tool exposure](#control-tool-exposure)), tool search ranks the server's tools by it, and codemode's `describeNamespace()` returns it. Without it, the first line of the server instructions is used once the server connects.
62
+
63
+ Keep personal servers and servers with credentials in the user-level file. Use the project file only for servers the project requires, and only in trusted projects.
64
+
65
+ ### Configuration rules
66
+
67
+ - Server names may contain only letters, digits, `_`, and `-`. Tools are named `mcp__<server>__<tool>`, with every character other than letters, digits, and `_` replaced by `_`; tools of a server whose names then collide all get a hash suffix. Server names that differ only in `-` and `_` count as the same server: a second one is rejected, and a `mcp.json` server overrides a registered one.
68
+ - `type` is optional. A `command` selects stdio and a `url` selects streamable HTTP. When present, `type` must be `stdio`, `http`, or `streamable-http`.
69
+ - `sse` is rejected. Servers that document an SSE endpoint often also provide streamable HTTP, commonly at `/mcp` instead of `/sse`.
70
+ - `command` is one executable and `args` contains its arguments. It is not a shell command string.
71
+ - `env` and `headers` values can use environment variables such as `${GITHUB_TOKEN}`. They can also run a command with `!command`, but the command must make up the whole value, for example `"Authorization": "!echo Bearer $(gh auth token)"`.
72
+ - Invalid entries are reported and skipped without preventing other servers from connecting.
73
+
74
+ `pi mcp add` and `pi mcp remove` cover common changes from a shell. See [MCP commands](usage.md#mcp-commands) for their options.
75
+
76
+ ### Inspect or change a server
77
+
78
+ `/mcp` lists configured servers with their state, tool count, exposure, and configuration source. Servers that need attention appear first. Select a server to inspect its tools and connection details, reconnect, sign in or out, change exposure, or enable and disable it.
79
+
80
+ Exposure and enabled-state changes are saved to the file that defines the server without replacing unrelated content. Disabled servers remain listed. Outside the interactive TUI, `/mcp` prints server status; `/mcp login <server>`, `/mcp logout <server>`, and `/mcp reconnect <server>` perform those actions directly.
81
+
82
+ Shell commands work without a session: `pi mcp add`, `pi mcp remove`, `pi mcp list`, `pi mcp login`, and `pi mcp logout`. Shell commands do not load extensions.
83
+
84
+ ### Diagnose connection problems
85
+
86
+ Run `pi mcp list` to connect to every enabled server and print its state, tools, and errors. It exits with status 1 when an entry is invalid or an enabled server is not connected. `/mcp` shows the full connection error and the tail of stderr from a failed stdio server.
87
+
88
+ Pi reports configuration errors, failed connections, and required sign-ins once after startup. Server logging notifications are appended to `~/.pi/agent/mcp.log` as `<time> [<server>] <level> <logger>: <message>`. The file moves to `mcp.log.1` after it grows past 5 MB.
89
+
90
+ Pi connects every enabled server in the background when a session starts. A server's tools appear once it connects; the `codemode` description does not list them, so it does not change when servers connect. The first prompt waits up to 10 seconds only for servers with `direct` tools, which must be declared in its request. Other servers are waited for when they are needed: a codemode script waits for the servers it names (`mcp__<server>`) and, when it calls `searchTools()` or reads `ALL_TOOLS`, for all of them; `tool_search` and the resource tools also wait for all of them. HTTP network errors and transient statuses (408, 429, and 5xx) are retried twice. A dropped connection is shown as disconnected and reconnects on the next call. When a server announces a changed tool list, new tools are added and withdrawn tools become unreachable.
91
+
92
+ Stopping a stdio server closes its stdin, sends SIGTERM, then sends SIGKILL to its process group. This also stops servers launched through wrappers such as `npx` or `uvx`.
93
+
94
+ ## Migrate configuration from another client
95
+
96
+ Move the converted entry under `mcpServers` in `mcp.json`, then run `pi mcp list` to validate it.
97
+
98
+ | Client | Conversion |
99
+ |---|---|
100
+ | Claude Desktop, Claude Code, or Cursor | Copy the existing `mcpServers` entry. |
101
+ | VS Code | Move an entry from the top-level `servers` object and replace `${input:...}` prompts with `${NAME}` environment variables. |
102
+ | Codex | Convert `[mcp_servers.<name>]` TOML fields such as `command`, `args`, `env`, and `url` to JSON. |
103
+ | OpenCode | Convert `"type": "local"` to a stdio entry, split its `command` array into `command` and `args`, rename `environment` to `env`, and replace `{env:NAME}` with `${NAME}`. Convert `"type": "remote"` to a URL entry. |
104
+
105
+ ## Authenticate with OAuth
106
+
107
+ Remote servers that use OAuth, such as Sentry, need no credentials in `mcp.json`:
108
+
109
+ ```json
110
+ {
111
+ "mcpServers": {
112
+ "sentry": { "url": "https://mcp.sentry.dev/mcp" }
113
+ }
114
+ }
115
+ ```
116
+
117
+ When the server rejects an unauthenticated connection, `/mcp` shows that it needs sign-in. Select "Sign in", run `/mcp login sentry`, or run `pi mcp login sentry`. Pi opens the authorization page and waits for approval. If the browser runs on another machine, such as over SSH, paste its redirected URL into the sign-in screen. A running session uses the new credentials on its next turn.
118
+
119
+ Pi registers itself with the authorization server, stores tokens in `~/.pi/agent/mcp-auth.json`, and refreshes access tokens when they expire or the server rejects them. If a server later requests additional scope, Pi asks for sign-in again. Signing out deletes the stored credentials.
120
+
121
+ Credentials belong to a server name and URL. Servers with the same URL under different names, such as one per account, sign in separately; servers with the same name and URL in different `mcp.json` files share one sign-in.
122
+
123
+ OAuth applies to HTTP servers without an `Authorization` header. For a server that does not support dynamic client registration, configure a registered client:
124
+
125
+ ```json
126
+ {
127
+ "mcpServers": {
128
+ "example": {
129
+ "url": "https://mcp.example.com/mcp",
130
+ "oauth": { "clientId": "my-client", "clientSecret": "${EXAMPLE_SECRET}", "callbackPort": 8765 }
131
+ }
132
+ }
133
+ }
134
+ ```
135
+
136
+ The redirect URI must match the registered URI. `callbackPort` uses `http://127.0.0.1:<port>/callback`. To use another URI, set `callbackUrl`; it must use HTTP on `localhost`, `127.0.0.1`, or `[::1]`. Pi sends it exactly as written. When `callbackUrl` omits a port, Pi uses `callbackPort` or a free port and adds it to the URI, as allowed for loopback redirects by RFC 8252. `clientSecret` is optional and can use an environment variable or command.
137
+
138
+ Set `scope` to a space-separated list for servers that do not advertise their required scopes. Otherwise, Pi requests the advertised scopes. Later scope requests are added to the configured value.
139
+
140
+ Pi registers as `pi`. Some servers only accept registrations from known clients. Set `clientName` to send another name:
141
+
142
+ ```json
143
+ {
144
+ "mcpServers": {
145
+ "figma": { "url": "https://mcp.figma.com/mcp", "oauth": { "clientName": "Claude Code" } }
146
+ }
147
+ }
148
+ ```
149
+
150
+ The name is only sent when Pi registers a client. To register again under a new name, sign out first.
151
+
152
+ Pi finds the authorization server through the server's protected resource metadata (RFC 9728) and checks that the authorization server's metadata names the expected issuer (RFC 8414). Some servers advertise the wrong authorization server or none, so sign-in opens a page that does not exist. Set `authServerMetadataUrl` to the metadata document of the right authorization server:
153
+
154
+ ```json
155
+ {
156
+ "mcpServers": {
157
+ "example": {
158
+ "url": "https://mcp.example.com/mcp",
159
+ "oauth": { "authServerMetadataUrl": "https://example.okta.com/.well-known/openid-configuration" }
160
+ }
161
+ }
162
+ }
163
+ ```
164
+
165
+ Pi uses that document instead of discovery and trusts it as configured, so only point it at a document you trust. The URL must use HTTPS, except on `localhost`, `127.0.0.1`, or `[::1]`.
166
+
167
+ ## Control tool exposure
168
+
169
+ Each server tool is registered as `mcp__<server>__<tool>`. The server's `exposure` determines how the model reaches it:
170
+
171
+ | Exposure | Behavior | Typical use |
172
+ |---|---|---|
173
+ | `codemode` (default) | Callable from [`codemode`](usage.md#codemode-and-tool-search) scripts, but neither declared to the model nor listed in the codemode description. Scripts find tools with `searchTools()`, `describeTool()`, or `ALL_TOOLS`. | General MCP servers, especially when scripts should combine or filter calls. |
174
+ | `deferred` | Not declared until [`tool_search`](usage.md#codemode-and-tool-search) loads a match for the next model call. | Large servers whose tools should be called directly after discovery. |
175
+ | `direct` | Declared to the model like a built-in tool and also callable from codemode. | Small, frequently used tool sets. |
176
+ | `hidden` | Registered but unreachable. | Servers or tools that should remain unavailable. |
177
+
178
+ `codemode-deferred` is accepted as an alias for `codemode`.
179
+
180
+ Servers with `codemode` or `deferred` tools are listed in the `mcp_servers` section of the system prompt, with how their tools are reached and one line from the configured `description` or, once connected, from the server instructions. Pi updates the section when a prompt starts, after waiting for servers with `direct` tools. When it changed, for example because a server connected and its summary became available, Pi appends the new section to the conversation instead of changing tool declarations, so earlier messages stay cached. `describeNamespace()` and the `namespace` option of `searchTools()` accept `mcp__dev-radius`, `mcp__dev_radius`, `dev-radius`, or `dev_radius`.
181
+
182
+ Pi activates `codemode` when a server with `codemode` exposure connects. It activates `tool_search` for a server with `deferred` exposure. To make the model see a tool without searching, give it `direct` exposure with `toolExposure`.
183
+
184
+ `toolExposure` overrides the server exposure for individual tools. Keys are exact server tool names or patterns where `*` matches any characters. Exact names win over patterns; among patterns, the first match wins. A server with `hidden` exposure can expose only selected tools:
185
+
186
+ ```json
187
+ {
188
+ "mcpServers": {
189
+ "github": {
190
+ "url": "https://api.githubcopilot.com/mcp/",
191
+ "exposure": "deferred",
192
+ "toolExposure": {
193
+ "search_code": "direct",
194
+ "get_*": "codemode",
195
+ "delete_*": "hidden"
196
+ }
197
+ }
198
+ }
199
+ }
200
+ ```
201
+
202
+ `pi mcp list` marks tools whose exposure differs from their server. The Tools view in `/mcp` also shows the effective exposure.
203
+
204
+ Tools with `codemode` or `deferred` exposure can be reached through either indirect mechanism: codemode scripts can call them, and `tool_search` can load them. Codemode calls do not depend on the active tool set, so they remain available after `/tree`, resume, and fork. Tools loaded by `tool_search` are recorded in the transcript and remain declared on that branch.
205
+
206
+ To keep `codemode` active without MCP servers, add `"defaultTools": ["+codemode"]` to [settings](settings.md#tools). To prevent automatic codemode activation, set `"autoEnableCodemode": false` beside `mcpServers`. A project value overrides the user-level value. Pi warns once when neither `codemode` nor `tool_search` is active and non-direct tools cannot be called.
207
+
208
+ Text results over 20 KB reach the model with their middle removed around a `…N chars truncated…` marker. The full text is saved to a temporary file named in the result. Codemode scripts receive the complete result and can reduce it before returning output to the model.
209
+
210
+ Codemode scripts receive the complete MCP `CallToolResult`, including `content`, `structuredContent`, and `isError`. A result with `isError` resolves inside scripts but is reported as an error for direct calls. `image(result.content[0])` forwards an image block. Server instructions are not part of any tool description; scripts read them with `describeNamespace("mcp__<server>")`, which also returns the server's tool names.
211
+
212
+ ## Use resources
213
+
214
+ When a connected server offers [resources](https://modelcontextprotocol.io/specification/2025-11-25/server/resources), Pi adds the resource tools used by Codex and OpenCode:
215
+
216
+ - `list_mcp_resources` lists resources as JSON: `{ server?, resources: [{ server, uri, name, ... }], nextCursor? }`. With `server`, it lists one page; `cursor` continues with the next page. Without `server`, it lists every resource from every server.
217
+ - `list_mcp_resource_templates` lists URI templates for resources the servers do not list directly.
218
+ - `read_mcp_resource` reads a resource by `server` and `uri`. Text reaches the model as text and images as images. Other binary resources are saved to temporary files, and the model receives the path. Scripts receive `{ server, uri, contents }`.
219
+
220
+ These tools reach every enabled, non-hidden server with resources. Their exposure is the widest exposure among those servers: `direct`, then `codemode` or `deferred`. Resource links in tool results identify `read_mcp_resource` and the server.
221
+
222
+ Resources for MCP Apps, identified by `ui://` URIs or `text/html;profile=mcp-app`, are omitted because Pi does not render them. Resource icons are also omitted.
223
+
224
+ Reading and listing resources is retried once after a transient HTTP error (408, 429, or 5xx). Tool calls are not retried because the server may already have performed them.
225
+
226
+ ## Permissions
227
+
228
+ Every MCP call passes through Pi's tool pipeline. Extension `tool_call` and `tool_result` handlers, including permission gates, therefore apply to MCP tools. Calls made from codemode scripts carry the codemode call ID as `parentToolCallId`.
229
+
230
+ `pi.getAllTools()` reports the annotations declared by each server: `readOnlyHint`, `destructiveHint`, `idempotentHint`, and `openWorldHint`. Permission extensions can use these hints to decide which calls require confirmation (see [Tool exposure](extensions.md#tool-exposure)). Resource tools are marked read-only.
231
+
232
+ ## Extensions and SDK
233
+
234
+ ### Add servers from extensions
235
+
236
+ Extensions can add servers for the current session with `pi.registerMcpServer(name, config)`, using the same shape as an `mcpServers` entry (see [MCP servers in extensions](extensions.md#mcp-servers)). Registered servers connect like configured servers and appear in `/mcp` with the extension as their source.
237
+
238
+ Changes to enabled state or exposure apply only to the current session. A file-configured server with the same name takes precedence, and `/mcp` lists the overridden registration. `pi mcp` shell commands do not load extensions and only see file-configured servers.
239
+
240
+ ### Replace the built-in MCP support
241
+
242
+ An installed extension that registers `/mcp`, such as `pi-mcp-adapter`, replaces the built-in MCP support for sessions. Pi then does not read `mcp.json` or connect its servers in a session, and `/mcp` belongs to the extension. Remove the extension to restore the built-in behavior. To disable built-in MCP support without a replacement, disable `mcp` under Built-in in `pi config`, or set `"extensions": ["-builtin:mcp"]` in [settings](settings.md#resources).
243
+
244
+ An extension that registers `codemode` or `tool_search` similarly replaces the built-in tool with that name. Shell-level `pi mcp` commands always use the built-in implementation.
245
+
246
+ ### Use MCP from the SDK
247
+
248
+ SDK sessions do not load built-in extensions. Add the MCP extension, the codemode extension for `codemode` servers, and the tool-search extension for `deferred` servers to the resource loader. See [Codemode and MCP](sdk.md#codemode-mcp).
package/docs/models.md CHANGED
@@ -673,3 +673,59 @@ For `api: "openai-responses"`, the compatible fields are `supportsDeveloperRole`
673
673
  The public Pi AI model type also exposes the Responses compatibility shape for `azure-openai-responses` and `openai-codex-responses`. The Azure transport uses `supportsDeveloperRole`, `supportsStrictMode`, and `supportsOpenAIGrammarTools`; the Codex transport uses `supportsStrictMode`, `supportsOpenAIGrammarTools`, and `supportsToolSearch`. Other Responses options do not alter those transports.
674
674
 
675
675
  For `bedrock-converse-stream`, `compat.supportsStrictMode` controls Bedrock strict JSON-schema tool definitions and defaults to `false`. The other built-in API tags do not define model compatibility options.
676
+
677
+ ## Use classifier models
678
+
679
+ Classifier models do not chat. They answer typed questions about JSON state: pick one of several choices, answer yes or no, or give a score, each with probabilities. Pi includes TypeSafe's Jev model from these providers:
680
+
681
+ | Provider | Model IDs | Authentication |
682
+ |---|---|---|
683
+ | `typesafe` | `jev-latest` | `TYPESAFE_API_KEY` |
684
+ | `openrouter` | `typesafe/jev-1.13`, `~typesafe/jev-latest` | `OPENROUTER_API_KEY` or `/login` |
685
+ | `cloudflare-workers-ai` | `typesafe/jev` | `CLOUDFLARE_API_KEY` and `CLOUDFLARE_ACCOUNT_ID` |
686
+ | `vercel-ai-gateway` | `typesafe-ai/jev` | `AI_GATEWAY_API_KEY` |
687
+ | `opencode` | `jev-1.13`, `jev-1.13-free` | `OPENCODE_API_KEY` |
688
+
689
+ Chat models on a [llama.cpp router](llama-cpp.md#classification) are also listed as classifier models.
690
+
691
+ Classifier models do not appear in `/model`. The model reaches them through the [`codemode`](usage.md#enable-codemode) tool, which is off unless an MCP server turned it on. Enable it with `"defaultTools": ["+codemode"]` in [settings](settings.md#tools). Scripts then list classifier models with `models.getAvailableOfType("classifier")` and call `models.classify(model, { state, questions })`:
692
+
693
+ ```js
694
+ const jev = await models.getModelOfType("classifier", "typesafe", "jev-latest");
695
+ const result = await models.classify(jev, {
696
+ state: { message: "The change works, thanks." },
697
+ questions: {
698
+ approved: {
699
+ type: "bool",
700
+ instructions: "Does the user approve of the result?",
701
+ criteria: { true: "Approval", false: "No approval" },
702
+ },
703
+ },
704
+ });
705
+ return result.answers;
706
+ ```
707
+
708
+ [Codemode](codemode.md#classify) describes the question and answer types.
709
+
710
+ When the service reports token counts, as all System One services do, `result.usage` carries them with their cost. Pi adds the usage of a script's classifier calls to the `codemode` tool result, so it counts toward the session cost in the footer and `/session`. The cost uses the model's catalog price; models without one, such as TypeSafe's direct `jev-latest`, report tokens at no cost.
711
+
712
+ Extensions call classifiers through `ctx.modelRegistry.classify()`, without codemode. [Virtual models](virtual-models.md#route-requests) can use them to route requests; see the `jev-router.ts` example.
713
+
714
+ ## Use image models
715
+
716
+ Image models generate images from a prompt and optional input images. Pi lists OpenRouter's image models, such as `google/gemini-2.5-flash-image` and `black-forest-labs/flux.2-pro`, under the `openrouter` provider; they use the same `OPENROUTER_API_KEY` or `/login` credential as its chat models.
717
+
718
+ Like classifier models, image models do not appear in `/model`; the model reaches them through the [`codemode`](usage.md#enable-codemode) tool. Scripts list them with `models.getAvailableOfType("image")` and call `models.generateImages(model, { input })`. The result's `output` holds base64 image blocks, which `image()` attaches to the `codemode` result so the model sees them:
719
+
720
+ ```js
721
+ const painter = await models.getModelOfType("image", "openrouter", "google/gemini-2.5-flash-image");
722
+ const result = await models.generateImages(painter, {
723
+ input: [{ type: "text", text: "A red fox in the snow, watercolor" }],
724
+ });
725
+ if (result.stopReason !== "stop") return result.errorMessage;
726
+ for (const block of result.output) if (block.type === "image") image(block);
727
+ ```
728
+
729
+ `input` can also contain `{ type: "image", data, mimeType }` blocks to edit or use as references. Pi adds the usage of a script's image calls to the `codemode` tool result, like classifier calls. Generated images are not saved to disk. [Codemode](codemode.md#generate-images) describes the full API.
730
+
731
+ Extensions generate images through `ctx.modelRegistry.generateImages()`, without codemode.
package/docs/packages.md CHANGED
@@ -227,3 +227,7 @@ Packages can appear in both global and project settings. If the same package app
227
227
  - npm: package name
228
228
  - git: repository URL without ref
229
229
  - local: resolved absolute path
230
+
231
+ ## Built-in extensions and host dependencies
232
+
233
+ `pi config` also manages built-in extensions. Managed npm and git packages suppress automatic installation of host-provided Pi peer dependencies. Declare these as peers, not production dependencies: physical copies can create duplicate classes and registries, and Pi warns about that manifest configuration. Local packages keep their own dependency trees.
package/docs/providers.md CHANGED
@@ -35,6 +35,8 @@ Use `/logout` to clear credentials. Tokens are stored in `~/.pi/agent/auth.json`
35
35
 
36
36
  Anthropic subscription auth is active for Claude Pro/Max accounts. Third-party harness usage draws from [extra usage](https://claude.ai/settings/usage) and is billed per token, not against Claude plan limits.
37
37
 
38
+ When the browser runs on another machine, select the copy code login method in `/login anthropic` and paste the code the browser shows.
39
+
38
40
  ### GitHub Copilot
39
41
 
40
42
  - Press Enter for github.com, or enter your GitHub Enterprise Server domain
@@ -60,6 +62,10 @@ Anthropic subscription auth is active for Claude Pro/Max accounts. Third-party h
60
62
 
61
63
  ### Radius
62
64
 
65
+ Radius is a service by Earendil Works, the builders of upstream Pi. It provides an AI gateway with organization-level controls and analytics, and artifacts for sharing what you create with Pi. It is in early alpha; see [radius.earendil.com](https://radius.earendil.com).
66
+
67
+ `/login` lists "Sign in with Radius" as its last top-level option. After a Radius sign-in, `/login` offers to configure the Radius MCP server in the global `mcp.json` with `"auth": { "provider": "radius" }` and reloads, so Pi can manage Radius for you.
68
+
63
69
  Radius is a `pi-messages` gateway. Pi ships the public Radius model catalog for immediate and offline model lookup, then overlays it with the effective gateway catalog after authentication. `/login radius` stores OAuth tokens in `auth.json`; refreshed catalogs are cached in `models-store.json`. Custom Radius gateways can be declared in `models.json` with `"oauth": "radius"` and a gateway `baseUrl`; they do not inherit the public `radius.pi.dev` catalog.
64
70
 
65
71
  ## API Keys
@@ -112,6 +118,8 @@ pi
112
118
  | Xiaomi MiMo Token Plan (Amsterdam) | `XIAOMI_TOKEN_PLAN_AMS_API_KEY` | `xiaomi-token-plan-ams` |
113
119
  | Xiaomi MiMo Token Plan (Singapore) | `XIAOMI_TOKEN_PLAN_SGP_API_KEY` | `xiaomi-token-plan-sgp` |
114
120
 
121
+ Anthropic also recognizes `ANTHROPIC_OAUTH_TOKEN` as an API credential and `ANTHROPIC_AUTH_TOKEN` as bearer authentication. With no key or token set, Anthropic uses workload identity federation when `ANTHROPIC_FEDERATION_RULE_ID`, `ANTHROPIC_ORGANIZATION_ID`, and `ANTHROPIC_IDENTITY_TOKEN_FILE` are set: the Anthropic SDK exchanges the identity token for a short-lived access token and refreshes it itself, re-reading the identity token file, so keep that file fresh for long sessions. `ANTHROPIC_SERVICE_ACCOUNT_ID` and `ANTHROPIC_WORKSPACE_ID` are passed through when set.
122
+
115
123
  See [Environment variables](environment-variables.md) for process configuration and [Auth File](#auth-file) for credential storage.
116
124
 
117
125
  #### Auth File
@@ -323,3 +331,9 @@ When resolving credentials for a provider:
323
331
  2. `auth.json` entry (API key or OAuth token)
324
332
  3. Environment variable
325
333
  4. Custom provider keys from `models.json`
334
+
335
+ ## OpenAI subscriptions and classifiers
336
+
337
+ `/login openai` offers Sign in with ChatGPT. The older OpenAI Codex provider remains available as OpenAI Codex (legacy), with `gpt-6.1-sol` as its default model. GPT-6.1 Sol is also available through OpenAI and Azure OpenAI.
338
+
339
+ TypeSafe classifier models use `TYPESAFE_API_KEY`; see [Classifier models](models.md#use-classifier-models).
package/docs/rpc.md CHANGED
@@ -70,7 +70,7 @@ If the agent is streaming and no `streamingBehavior` is specified, the command r
70
70
 
71
71
  Response:
72
72
  ```json
73
- {"id": "req-1", "type": "response", "command": "prompt", "success": true}
73
+ {"id": "req-1", "type": "response", "command": "prompt", "success": true, "data": {"disposition": "started"}}
74
74
  ```
75
75
 
76
76
  `success: true` means the prompt was accepted, queued, or handled immediately. `success: false` means the prompt was rejected before acceptance. Failures after acceptance are reported through the normal event and message stream, not as a second `response` for the same request id.
@@ -94,7 +94,7 @@ The `images` field is optional. Each image uses `ImageContent` format (same as `
94
94
 
95
95
  Response:
96
96
  ```json
97
- {"type": "response", "command": "steer", "success": true}
97
+ {"type": "response", "command": "steer", "success": true, "data": {"disposition": "queued"}}
98
98
  ```
99
99
 
100
100
  See [set_steering_mode](#set_steering_mode) for controlling how steering messages are processed.
@@ -116,7 +116,7 @@ The `images` field is optional. Each image uses `ImageContent` format (same as `
116
116
 
117
117
  Response:
118
118
  ```json
119
- {"type": "response", "command": "follow_up", "success": true}
119
+ {"type": "response", "command": "follow_up", "success": true, "data": {"disposition": "queued"}}
120
120
  ```
121
121
 
122
122
  See [set_follow_up_mode](#set_follow_up_mode) for controlling how follow-up messages are processed.
@@ -1651,3 +1651,5 @@ process.on("SIGINT", () => {
1651
1651
  agent.stdin.write(JSON.stringify({ type: "abort" }) + "\n");
1652
1652
  });
1653
1653
  ```
1654
+
1655
+ Successful `prompt` responses include `data.disposition`: `handled`, `queued`, or `started`. `steer` and `follow_up` return `handled` or `queued`. This describes the submitted input, not completion. When an extension handles input, do not wait for a run to settle on its behalf.
package/docs/sdk.md CHANGED
@@ -111,8 +111,8 @@ interface AgentSession {
111
111
  abort(): Promise<void>;
112
112
 
113
113
  // Background host controls (see Background execution below)
114
- pauseBackgroundNotifications(): () => void;
115
- retryBackgroundNotifications(): void;
114
+ pauseTaskNotifications(): () => void;
115
+ retryTaskNotifications(): void;
116
116
  getSessionStats(): SessionStats;
117
117
 
118
118
  // Cleanup (does not await Background draining)
@@ -273,15 +273,15 @@ Both `steer()` and `followUp()` expand file-based prompt templates but error on
273
273
 
274
274
  ### Background execution
275
275
 
276
- Background is a session-owned capability, not a daemon or a flag on `createAgentSession()`. Interactive mode enables it. Ordinary SDK sessions and the built-in print, JSON, and RPC hosts leave it disabled and reject native shell or Subagent calls with `background: true`. Normal foreground tools still work, including standalone `createBashTool()` / `createPowerShellTool()` calls without a session context.
276
+ Background is a session-owned capability, not a daemon or a flag on `createAgentSession()`. Interactive mode enables it. Ordinary SDK sessions and the built-in print, JSON, and RPC hosts leave it disabled and reject native shell or extension calls with `background: true`. Normal foreground tools still work, including standalone `createBashTool()` / `createPowerShellTool()` calls without a session context.
277
277
 
278
- An embedding can opt in with `await session.bindExtensions({ backgroundEnabled: true })`. Bind before prompting; this also binds extensions and emits their session-start lifecycle. When using `AgentSessionRuntime`, rebind the replacement session through the runtime's rebind callback. Setting `mode` or providing a UI alone does not enable Background.
278
+ An embedding can opt in with `await session.bindExtensions({ tasksEnabled: true })`. Bind before prompting; this also binds extensions and emits their session-start lifecycle. When using `AgentSessionRuntime`, rebind the replacement session through the runtime's rebind callback. Setting `mode` or providing a UI alone does not enable Background.
279
279
 
280
280
  The host must choose:
281
281
 
282
- - **Lifetime and cancellation:** a settled main-agent turn is not the end of background work. `session.abort()` cancels foreground-owned work, not detached work. Use `session.background.kill(id)` for a whole execution, or `await session.background.shutdown(graceMs?)` to close admission, cancel all owned work and drain within a bounded grace period (default 2 seconds, maximum 60 seconds). A non-cooperating executor can outlive that grace period.
283
- - **Result-driven turns and cost:** automatic completions join the host's prompt queue, so a running turn receives them as steering and an idle session starts a completion turn. Use the nestable `session.pauseBackgroundNotifications()` to defer delivery; its returned release function is idempotent. Pausing does not stop execution or its costs. Budget worker activity and completion-triggered turns explicitly.
284
- - **Observation and delivery:** `session.background` exposes the [public supervision methods](extensions.md#ctxbackground). `read()` and `wait()` observe; a terminal snapshot alone does not acknowledge model delivery. The bundled `bg wait` result carries `details.backgroundTaskId`, which the host acknowledges only after persisting the tool result. A direct SDK waiter that consumes the result outside model history can explicitly call `session.background.markDelivered(task.id)` after successful consumption. A timeout or cancelled wait does not stop the execution. Failed notification delivery leaves the result available for inspection; after fixing the host failure, call `session.retryBackgroundNotifications()` explicitly. Pi does not retry a failed delivery forever on a timer.
282
+ - **Lifetime and cancellation:** a settled main-agent turn is not the end of background work. `session.abort()` cancels foreground-owned work, not detached work. Use `session.tasks.kill(id)` for a whole execution, or `await session.tasks.shutdown(graceMs?)` to close admission, cancel all owned work and drain within a bounded grace period (default 2 seconds, maximum 60 seconds). A non-cooperating executor can outlive that grace period.
283
+ - **Result-driven turns and cost:** automatic completions join the host's prompt queue, so a running turn receives them as steering and an idle session starts a completion turn. Use the nestable `session.pauseTaskNotifications()` to defer delivery; its returned release function is idempotent. Pausing does not stop execution or its costs. Budget worker activity and completion-triggered turns explicitly.
284
+ - **Observation and delivery:** `session.tasks` exposes the [public supervision methods](extensions.md#ctxtasks). `read()` and `wait()` observe; a terminal snapshot alone does not acknowledge model delivery. The built-in `tasks wait` tool binds a delivery receipt to its tool-call ID; the host confirms it only after persisting the result, even if extensions rewrite its details. A direct SDK waiter that consumes the result outside model history can explicitly call `session.tasks.markDelivered(task.id)` after successful consumption. A timeout or cancelled wait does not stop the execution. Failed notification delivery leaves the result available for inspection; after fixing the host failure, call `session.retryTaskNotifications()` explicitly. Pi does not retry a failed delivery forever on a timer.
285
285
  - **Shutdown:** `await runtime.dispose()` handles background shutdown and extension lifecycle when using the runtime API. For a directly owned session, drain Background, abort the main agent, then dispose; synchronous `session.dispose()` alone is not an awaited drain.
286
286
 
287
287
  A deliberately single-turn embedding can suppress completion-triggered turns and cancel leftover work on exit:
@@ -292,14 +292,14 @@ import { createAgentSession, SessionManager } from "@astralyn/pi";
292
292
  const { session } = await createAgentSession({
293
293
  sessionManager: SessionManager.inMemory(),
294
294
  });
295
- const resumeNotifications = session.pauseBackgroundNotifications();
295
+ const resumeNotifications = session.pauseTaskNotifications();
296
296
  try {
297
- await session.bindExtensions({ backgroundEnabled: true });
297
+ await session.bindExtensions({ tasksEnabled: true });
298
298
  await session.prompt("Inspect the project; delegate independent investigations if useful.");
299
299
  // Snapshot only: some executions may still be running.
300
- console.log(session.background.list());
300
+ console.log(session.tasks.list());
301
301
  } finally {
302
- await Promise.all([session.background.shutdown(), session.abort()]);
302
+ await Promise.all([session.tasks.shutdown(), session.abort()]);
303
303
  session.dispose();
304
304
  resumeNotifications();
305
305
  }
@@ -307,19 +307,19 @@ try {
307
307
 
308
308
  For a longer-lived embedding, keep the host alive, subscribe to snapshots and choose bounded waits or release notification delivery according to your model-turn policy. Do not use a panel or repeated reads as the billing or cleanup mechanism.
309
309
 
310
- Automatic completion messages carry a version-1 `BackgroundCompletionSnapshot` in `details`, with independent shell output or worker reports, diagnostics and explicit truncation flags. This snapshot is self-contained for transcript replay and is not sent to the model; `content` contains the separately bounded prose generated from it. Current terminal history uses version-2 `background-task-result` records, with no migration of earlier result records. The usage ledger remains independent. See [Background records](session-format.md#background-records).
310
+ Automatic completion messages carry a version-2 `TaskCompletionSnapshot` in `details`, with the command, the tail of the output, diagnostics and explicit truncation flags. This snapshot is self-contained for transcript replay and is not sent to the model; `content` contains the separately bounded prose generated from it. Current terminal history uses version-2 `task-result` records, with no migration of earlier result records. The usage ledger remains independent. See [Background records](session-format.md#background-records).
311
311
 
312
- `executionRole: "subagent"` on `createAgentSession()` is a trusted host-assigned identity, not a model argument. It prevents enabling Background even through `bindExtensions`; built-in workers also receive a no-background prompt rule. Their shared shell schema retains the optional flag but runtime requests for `background: true` are rejected before startup. Foreground shell access remains normal. This capability restriction is not an OS sandbox.
312
+ `backgroundAllowed: false` on `createAgentSession()` is a host capability ceiling, independent of task kind. It prevents enabling background execution through `bindExtensions` or direct runtime activation, including after reload. Requests for `background: true` are rejected before startup; foreground execution remains available. Omitting this option permits host opt-in but does not enable background execution by itself. This capability restriction is not an OS sandbox.
313
313
 
314
- Reload, replacement/fork, shutdown and branch navigation enforce the [Background lifetime rules](bundled/extensions/background.md#lifetime). Saved terminal branch history is observational only: no live processes/workers resume, and restoration does not replay accounting or completion events. Managed logs expire with their runtime records; save anything needed before eviction or shutdown.
314
+ Reload, replacement/fork, shutdown and branch navigation enforce the [Background lifetime rules](bundled/tasks.md#lifetime). Saved terminal branch history is observational only: no live processes/workers resume, and restoration does not replay accounting or completion events. Managed logs expire with their runtime records; save anything needed before eviction or shutdown.
315
315
 
316
- An executor that ignores abort and settles after its originating runtime/branch has been retired is quarantined, not charged to the active session. The old session exposes the latest 32 bounded records through `quarantinedBackgroundSettlements`; persisted sessions also attempt to append them to `<session-file>.background-late.jsonl`, reporting a diagnostic if the write fails. This is an audit trail, not automatic reconciliation or a promise that the executor stopped. See [Background records](session-format.md#background-records).
316
+ An executor that ignores abort and settles after its originating runtime/branch has been retired is quarantined, not charged to the active session. The old session exposes the latest 32 bounded records through `quarantinedTaskSettlements`; persisted sessions also attempt to append them to `<session-file>.tasks-late.jsonl`, reporting a diagnostic if the write fails. This is an audit trail, not automatic reconciliation or a promise that the executor stopped. See [Background records](session-format.md#background-records).
317
317
 
318
318
  ### Session statistics
319
319
 
320
320
  `session.getSessionStats()` returns `sessionFile`, `sessionId`, `userMessages`, `assistantMessages`, `toolCalls`, `toolResults`, `totalMessages`, `tokens`, `cost`, and optional `contextUsage`. `tokens` contains `input`, `output`, `cacheRead`, `cacheWrite`, and `total` (the sum of those four categories); `cost` is accumulated reported cost.
321
321
 
322
- Usage totals cover all session entries, including other branches and compacted history: assistant requests, usage-bearing tool results, compaction/branch summaries, and the first valid `background-usage` record per execution ID. Managed foreground results omit duplicate usage. Background records do not increment message/tool counts, and reads, waits, handoff and history restoration do not add billing. Worker retry, failure, cancellation and compaction usage is included when supplied; missing provider usage is not fabricated. Quarantined late settlements are excluded.
322
+ Usage totals cover all session entries, including other branches and compacted history: assistant requests, usage-bearing tool results, compaction/branch summaries, and the first valid `task-usage` record per execution ID. Managed foreground results omit duplicate usage. Background records do not increment message/tool counts, and reads, waits, handoff and history restoration do not add billing. Worker retry, failure, cancellation and compaction usage is included when supplied; missing provider usage is not fabricated. Quarantined late settlements are excluded.
323
323
 
324
324
  This differs from the bundled Statusline's active-branch totals. Neither accumulated worker usage nor Background billing changes the parent context-occupancy estimate or the latest parent request's cache-hit ratio.
325
325
 
@@ -1261,3 +1261,13 @@ type PromptTemplate
1261
1261
  ```
1262
1262
 
1263
1263
  For extension types, see [extensions.md](extensions.md) for the full API.
1264
+
1265
+ ## Codemode and MCP
1266
+
1267
+ <a id="codemode-mcp"></a>
1268
+
1269
+ The CLI loads `codemode`, `tool_search`, and MCP as built-in extensions. SDK sessions do not; add `createCodemodeExtension()`, `createToolSearchExtension()`, and `createMcpExtension()` to the `extensionFactories` of `DefaultResourceLoader`. `codemode` and `tool_search` are registered inactive: enable them through the `defaultTools` setting (`["+codemode", "+tool_search"]` keeps the other default tools), or let the MCP extension activate them: `codemode` for servers with `codemode` exposure, `tool_search` for servers with `deferred` exposure. The MCP extension connects its servers on `session_start`, so call `session.bindExtensions()`. See [Codemode and MCP](../examples/sdk/14-codemode-mcp.ts).
1270
+
1271
+ Named inline extensions accept `builtin: true` to load as `builtin:<name>`, with user/project configuration and `noExtensions` support. `replaceable: true` lets another extension replace one when its tool, command, or flag names overlap.
1272
+
1273
+ `steer()` and `followUp()` return `"queued"` when queued or `"handled"` when an extension consumes the input.
package/docs/security.md CHANGED
@@ -57,3 +57,7 @@ If you bind-mount a host workspace read/write, writes from inside the container
57
57
  For issues that also affect upstream Pi, follow the [upstream security policy](https://github.com/earendil-works/pi/blob/main/SECURITY.md). This distribution does not operate a separate security-reporting process.
58
58
 
59
59
  Expected local-agent behavior, lack of a built-in sandbox, prompt injection from untrusted content, and behavior of user-installed extensions or skills are generally outside the security boundary unless the report demonstrates a real privilege-boundary bypass or shows how pi grants access that the local user did not already have.
60
+
61
+ ## MCP configuration
62
+
63
+ Project `.pi/mcp.json` requires project trust before its servers are loaded. Trust permits stdio server commands to run. Global servers are configured in `~/.pi/agent/mcp.json`. See [MCP Servers](mcp.md).
@@ -335,47 +335,38 @@ Use `customType` to identify your extension's entries on reload. Interactive mod
335
335
 
336
336
  ### Background records
337
337
 
338
- Managed execution uses ordinary version-3 custom entries; it does not add a new session-file version or persist live execution handles. Every managed execution — including a foreground one — appends its own bounded terminal snapshot, so the file carries both the tool result and this snapshot; that duplication is the deliberate price of replay-safe history.
338
+ Managed execution uses ordinary version-3 custom entries; it does not add a new session-file version or persist live execution handles. Every managed execution — including a foreground one — appends its own bounded terminal snapshot. A foreground snapshot omits `result`: its tool result already holds the output, and restoration reads it from the tool result with the same `toolCallId` on the branch.
339
339
 
340
340
  | `customType` | `data` | Purpose |
341
341
  |---|---|---|
342
- | `background-usage` | `{ version: 1, taskId, usage }` | Independent settlement of provider-reported nested usage |
343
- | `background-task-result` | `{ version: 2, task }` | Bounded terminal `BackgroundTask` snapshot with structured presentation |
342
+ | `task-usage` | `{ version: 1, taskId, usage }` | Independent settlement of provider-reported nested usage |
343
+ | `task-result` | `{ version: 2, task }` | Bounded terminal `TaskSnapshot` |
344
344
 
345
345
  `taskId` is the execution/group ID, not a worker display number. `usage` has the `Usage` shape above. Consumers count only the first valid usage record per ID within the entries they aggregate; malformed records, unsupported versions, blank IDs, and non-finite or negative usage/cost values are ignored. A later valid duplicate is not an adjustment. Do not create these host-owned entries yourself or bill again from a result/read/notification.
346
346
 
347
- A `BackgroundTask` has `id`, `kind` (`bash` or `subagent`; PowerShell shares the shell kind), `title`, `toolCallId`, `anchorId`, `mode`, `status`, and numeric millisecond `startedAt`; optional fields include `endedAt`, `command`, `commandTruncated`, `cwd`, `outputPath`, `projection`, `result`, `resultTruncated`, and `error`. Truncation flags record clipping at the producing/retention boundary. Mode (`foreground` or `background`) is independent of status. Persisted terminal statuses are `completed`, `partial`, `failed`, `cancelled`, or `timeout`; live snapshots can also be `queued`, `running`, or `stopping`.
347
+ A `TaskSnapshot` has `id`, `kind` (executor-owned source label, such as `bash`, `powershell`, or an extension-defined label), `title`, `toolCallId`, `anchorId`, `mode`, `status`, and numeric millisecond `startedAt`; optional fields include `endedAt`, `command`, `commandTruncated`, `cwd`, `exitCode`, `outputPath`, `result`, `resultTruncated`, and `error`. Truncation flags record clipping at the producing/retention boundary. Mode (`foreground` or `background`) is independent of status. Persisted terminal statuses are `completed`, `partial`, `failed`, `cancelled`, or `timeout`; live snapshots can also be `queued`, `running`, or `stopping`.
348
348
 
349
- `projection` contains optional bounded status `text`, `shell: { name, output: { text, truncated } }`, and worker summaries. Each worker has `id`, `label`, `profile`, `description`, observed `status`, `report: { text, truncated }`, optional `error`, plus live `prompt`, `activity`, and optional `model`/`usage` display strings. The projection has no worker sessions or execution handles. Source truncation is explicit; the reader never recognizes truncation by matching output text.
349
+ The retained tool result contains bounded text (up to 48 KiB) and no executor-private details; images are replaced with a text omission marker. Source truncation is explicit; the reader never recognizes truncation by matching output text. `outputPath`, if present, points to an ephemeral executor-owned file which may already have been removed on eviction or runtime shutdown; restored records drop it. Save important output separately.
350
350
 
351
- The retained tool result contains bounded text (up to 48 KiB) and bounded serializable private details (up to 120 KiB, otherwise omitted); images are replaced with a text omission marker. Completion cards use the public projection independently of those private details. `outputPath`, if present, points to an ephemeral executor-owned file which may already have been removed on eviction or runtime shutdown. Save important output separately.
351
+ Terminal history is restored only from the selected branch's valid version-2 result records; older fields such as `format` and `projection` are ignored. Version-1 result records are ignored without migration; their independent usage entries still participate in accounting. This is read-only history: no processes or workers are restarted or reattached, and restoration does not replay usage settlement or completion events. Forks can carry historical entries on their copied path, never live execution handles.
352
352
 
353
- Terminal history is restored only from the selected branch's valid version-2 result records. Version-1 result records are ignored without migration; their independent usage entries still participate in accounting. This is read-only history: no processes or workers are restarted or reattached, and restoration does not replay usage settlement or completion events. Forks can carry historical entries on their copied path, never live execution handles.
353
+ These `custom` entries do not enter model context. Automatic delivery creates a `custom_message` with `customType: "task-completion"`, `display: true`, and a self-contained `TaskCompletionSnapshot` in `details`. The session formats `content` from the same snapshot, with a total limit of 48 KiB and 2,000 lines, keeping the end of the output. Only `content` is sent to the model.
354
354
 
355
- These `custom` entries do not enter model context. Automatic delivery creates a `custom_message` with `customType: "background-completion"`, `display: true`, and a self-contained `BackgroundCompletionSnapshot` in `details`. The session formats `content` from the same snapshot, with a total limit of 48 KiB and 2,000 lines. Each worker gets a share before formatting, so an early report cannot erase later workers. Only `content` is sent to the model.
355
+ Completion details use one format, `version: 2`, bounded to 120 KiB of serialized JSON including escaping. It has `version`, `kind`, `taskId`, `title`, terminal `status`, numeric millisecond `startedAt` and `endedAt`, and `output: { text, truncated }`, plus optional `error`, `command: { text, truncated }`, `cwd`, `outputPath`, and `exitCode` (a number, or `null` when signal-reaped).
356
356
 
357
- Completion details use one format, `version: 1`, bounded to 120 KiB of serialized JSON including escaping:
358
-
359
- | Part | Fields |
360
- |---|---|
361
- | Common | `version`, `taskId`, `title`, terminal `status`, numeric millisecond `startedAt` and `endedAt`, optional `error` |
362
- | `kind: "bash"` | `output: { text, truncated }`; optional `shell` name, `command: { text, truncated }`, `cwd`, `outputPath` |
363
- | `kind: "subagent"` | `workers[]` with `id`, `label`, `profile`, `description`, observed `status`, `report: { text, truncated }`, optional `error`; optional plain `output` fallback for executors without a worker projection |
364
-
365
- Shell output is bounded to 40 KiB, each worker report to 4 KiB, and worker count to eight. Field limits include JSON escaping; source flags survive further clipping. Completion worker snapshots omit live prompt/activity/model/usage fields. Missing shell metadata is left unspecified, and worker status is never inferred from the group verdict. The renderer sanitizes terminal control sequences and applies separate display row limits.
357
+ `output` is the end of the final result text, bounded to 40 KiB including JSON escaping. Source flags survive further clipping. Missing shell metadata is left unspecified. The renderer sanitizes terminal control sequences and applies separate display row limits.
366
358
 
367
359
  A shell completion's `details` can look like this:
368
360
 
369
361
  ```json
370
362
  {
371
- "version": 1,
363
+ "version": 2,
372
364
  "taskId": "bash-12345678-abcd-4321-abcd-123456789012",
373
365
  "kind": "bash",
374
- "title": "Build",
366
+ "title": "npm run build",
375
367
  "status": "completed",
376
368
  "startedAt": 1733234400000,
377
369
  "endedAt": 1733234405000,
378
- "shell": "bash",
379
370
  "command": { "text": "npm run build", "truncated": false },
380
371
  "cwd": "/project",
381
372
  "outputPath": "/tmp/pi-bash-example.log",
@@ -383,13 +374,13 @@ A shell completion's `details` can look like this:
383
374
  }
384
375
  ```
385
376
 
386
- The message carries everything needed for replay after `/reload`, branch navigation, history eviction or restart; rendering does not open the saved log or query a live task. Unsupported or malformed completion details use bounded plain message text. There is no legacy text parser, dual-format reconstruction or migration.
377
+ The message carries everything needed for replay after `/reload`, branch navigation, history eviction or restart; rendering does not open the saved log or query a live task. Unsupported or malformed completion details, including version 1, use bounded plain message text. There is no legacy text parser, dual-format reconstruction or migration.
387
378
 
388
- A completion is acknowledged only after its message is persisted. A terminal `bg wait` result instead includes `details.backgroundTaskId`; only persisting that tool result acknowledges delivery, so aborting during an output read cannot consume a notification. Direct `BackgroundContext.wait()` is observational. Snapshots and repeated reads do not create more usage. Historical extension-owned `background-task` notifications and old `bg create` tool results remain transcript history, not new runnable tasks.
379
+ A completion is acknowledged only after its message is persisted. A terminal `tasks wait` binds a host-owned receipt to the tool-call ID. Only persisting that tool result acknowledges delivery, even if its details were rewritten; aborting during an output read cannot consume a notification. Direct `TasksContext.wait()` is observational. Snapshots and repeated reads do not create more usage. Historical extension-owned `background-task` notifications and old `bg create` tool results remain transcript history shown as saved text, not new runnable tasks.
389
380
 
390
381
  Session-wide statistics aggregate the ledger across all entries; the bundled Statusline uses the active branch. Accrued retries, failures, cancellations and worker compaction count when usage is reported. No usage is invented for a provider that does not expose it, and worker billing does not occupy the parent's context window. See [SDK session statistics](sdk.md#session-statistics).
391
382
 
392
- **Late settlement quarantine:** an executor that ignores cancellation and settles after its runtime or launch branch is retired cannot append to the replacement session or move its active leaf. The originating session retains the latest 32 bounded quarantine records in memory. For persisted sessions it also appends audit JSONL to `<session-file>.background-late.jsonl`, with `{ version: 1, sessionId, generation, task, usage? }`. A sidecar write failure is reported and leaves only the bounded in-memory record. This sidecar is separate from the session tree and active totals; it is not automatically reconciled, replayed or used to resume execution. Preserve it if you need to audit late provider costs, and manage its disk retention separately from the session file.
383
+ **Late settlement quarantine:** an executor that ignores cancellation and settles after its runtime or launch branch is retired cannot append to the replacement session or move its active leaf. The originating session retains the latest 32 bounded quarantine records in memory. For persisted sessions it also appends audit JSONL to `<session-file>.tasks-late.jsonl`, with `{ version: 1, sessionId, generation, task, usage? }`. A sidecar write failure is reported and leaves only the bounded in-memory record. This sidecar is separate from the session tree and active totals; it is not automatically reconciled, replayed or used to resume execution. Preserve it if you need to audit late provider costs, and manage its disk retention separately from the session file.
393
384
 
394
385
  ### CustomMessageEntry
395
386
 
@@ -572,3 +563,9 @@ All of these return the appended entry ID:
572
563
  - `getSessionName(): string | undefined`
573
564
  - `getCwd(): string`, `getSessionDir(): string`, `getSessionId(): string`, and `getSessionFile(): string | undefined`
574
565
  - `usesDefaultSessionDir(): boolean` and `isPersisted(): boolean`
566
+
567
+ ## Virtual selections and nested calls
568
+
569
+ The latest `model_change` records the selected model, including a [virtual model](virtual-models.md). Assistant messages record the physical model that answered and its `thinkingLevel`. Router state is stored in custom entries named `pi.virtual-model-state` with `{ provider, modelId, state }`.
570
+
571
+ Tool results can include bounded `nestedCalls` metadata for calls made through `ctx.executeTool()`. It records arguments and execution status, never nested results; compaction and HTML exports use it.