@averyyy/pi-coding-agent 1.5.0-piclient.4 → 1.5.2-piclient.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (363) hide show
  1. package/CHANGELOG.md +134 -0
  2. package/dist/bundle/chunks/anthropic-messages-KT6DV7MK.js +6 -0
  3. package/dist/bundle/chunks/{azure-openai-responses-M725JFGO.js → azure-openai-responses-E2Z734ES.js} +1 -1
  4. package/dist/bundle/chunks/bedrock-converse-stream.js +3 -3
  5. package/dist/bundle/chunks/chunk-27POX4KP.js +82 -0
  6. package/dist/bundle/chunks/{chunk-GJFZM2RZ.js → chunk-D2CMHQWH.js} +9 -9
  7. package/dist/bundle/chunks/chunk-D2LWHJJD.js +1590 -0
  8. package/dist/bundle/chunks/{chunk-N4CTF6DK.js → chunk-ECEUFETK.js} +1 -1
  9. package/dist/bundle/chunks/{chunk-3UW3IQIY.js → chunk-FA5D3PPT.js} +1 -1
  10. package/dist/bundle/chunks/chunk-GFUN2N5K.js +2 -0
  11. package/dist/bundle/chunks/{chunk-OW4KH7CI.js → chunk-H36DQSY7.js} +1 -1
  12. package/dist/bundle/chunks/chunk-IEBK4HQA.js +2 -0
  13. package/dist/bundle/chunks/chunk-IYMNLY6C.js +4 -0
  14. package/dist/bundle/chunks/chunk-M4NMEBFE.js +2 -0
  15. package/dist/bundle/chunks/chunk-OMUE475A.js +35 -0
  16. package/dist/bundle/chunks/chunk-P4REYYCM.js +55 -0
  17. package/dist/bundle/chunks/chunk-RZHIIJ2O.js +2 -0
  18. package/dist/bundle/chunks/chunk-SHIWNICN.js +8 -0
  19. package/dist/bundle/chunks/{chunk-WATJAG5U.js → chunk-TCESBBFS.js} +1 -1
  20. package/dist/bundle/chunks/{chunk-GO33PKBT.js → chunk-V5KN6SNQ.js} +1 -1
  21. package/dist/bundle/chunks/chunk-V7WCKBVO.js +19 -0
  22. package/dist/bundle/chunks/{chunk-OXKIVFVM.js → chunk-VZFAYNKC.js} +1 -1
  23. package/dist/bundle/chunks/{chunk-JM6XUN2B.js → chunk-YAD6BXOQ.js} +5 -1
  24. package/dist/bundle/chunks/{chunk-HLEWK4Q5.js → chunk-ZFWVOFG2.js} +1 -1
  25. package/dist/bundle/chunks/chunk-ZG74NES2.js +2 -0
  26. package/dist/bundle/chunks/{cli-2Q4CKMZK.js → cli-M6DJI5GJ.js} +7 -7
  27. package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-JEJELFEJ.js → cloudflare-workers-ai-system-one-6TWKBBSR.js} +1 -1
  28. package/dist/bundle/chunks/codemode-worker.js +2 -0
  29. package/dist/bundle/chunks/{easter-egg-3d-UEH5CVEM.js → easter-egg-3d-FREKSIW6.js} +1 -1
  30. package/dist/bundle/chunks/{execute-BOGNP5CQ.js → execute-MJMW76MP.js} +5 -3
  31. package/dist/bundle/chunks/github-copilot.js +1 -1
  32. package/dist/bundle/chunks/google-antigravity-runtime.js +3 -3
  33. package/dist/bundle/chunks/{google-generative-ai-UTHMOBSC.js → google-generative-ai-YSOYXY5K.js} +1 -1
  34. package/dist/bundle/chunks/{google-vertex-MKY2BEE7.js → google-vertex-X3ELXR2J.js} +1 -1
  35. package/dist/bundle/chunks/{llama-cpp-classify-CYHVVBOQ.js → llama-cpp-classify-R6PVLK5I.js} +1 -1
  36. package/dist/bundle/chunks/{mistral-conversations-U2CRJEWX.js → mistral-conversations-J4IL2HMK.js} +1 -1
  37. package/dist/bundle/chunks/openai-codex-responses-GULSUKQ4.js +10 -0
  38. package/dist/bundle/chunks/{openai-completions-VPNLDI5K.js → openai-completions-ZGWBSKNR.js} +3 -3
  39. package/dist/bundle/chunks/{openai-decisions-UZ6HF7LF.js → openai-decisions-BU2ER6AQ.js} +1 -1
  40. package/dist/bundle/chunks/openai-responses-WDSDROXC.js +4 -0
  41. package/dist/bundle/chunks/{openrouter-images-P5CYCO4P.js → openrouter-images-MK6H7N26.js} +1 -1
  42. package/dist/bundle/chunks/{pi-messages-XPX326L5.js → pi-messages-7PPZFV3U.js} +1 -1
  43. package/dist/bundle/chunks/{runtime-2Z3FBQRD.js → runtime-X3ZHEI2F.js} +1 -1
  44. package/dist/bundle/chunks/{typesafe-system-one-NKVLMGFF.js → typesafe-system-one-LXDZKNJW.js} +1 -1
  45. package/dist/bundle/chunks/virtual-modules-N6RDW4TA.js +2 -0
  46. package/dist/bundle/cli-runtime.js +1 -1
  47. package/dist/bundle/index.js +1 -1
  48. package/dist/bundle/rpc-entry.js +1 -1
  49. package/dist/cli/args.js +1 -1
  50. package/dist/cli/args.js.map +1 -1
  51. package/dist/cli/auth-command.d.ts.map +1 -1
  52. package/dist/cli/auth-command.js +26 -2
  53. package/dist/cli/auth-command.js.map +1 -1
  54. package/dist/cli/auth-login.d.ts +15 -0
  55. package/dist/cli/auth-login.d.ts.map +1 -0
  56. package/dist/cli/auth-login.js +234 -0
  57. package/dist/cli/auth-login.js.map +1 -0
  58. package/dist/cli/auth-logout.d.ts +14 -0
  59. package/dist/cli/auth-logout.d.ts.map +1 -0
  60. package/dist/cli/auth-logout.js +74 -0
  61. package/dist/cli/auth-logout.js.map +1 -0
  62. package/dist/cli/auth-terminal.d.ts +17 -0
  63. package/dist/cli/auth-terminal.d.ts.map +1 -0
  64. package/dist/cli/auth-terminal.js +63 -0
  65. package/dist/cli/auth-terminal.js.map +1 -0
  66. package/dist/cli/config-selector.d.ts.map +1 -1
  67. package/dist/cli/config-selector.js +3 -1
  68. package/dist/cli/config-selector.js.map +1 -1
  69. package/dist/core/agent-session-runtime.d.ts +5 -0
  70. package/dist/core/agent-session-runtime.d.ts.map +1 -1
  71. package/dist/core/agent-session-runtime.js +17 -2
  72. package/dist/core/agent-session-runtime.js.map +1 -1
  73. package/dist/core/agent-session.d.ts +25 -6
  74. package/dist/core/agent-session.d.ts.map +1 -1
  75. package/dist/core/agent-session.js +137 -54
  76. package/dist/core/agent-session.js.map +1 -1
  77. package/dist/core/auth-storage.d.ts.map +1 -1
  78. package/dist/core/auth-storage.js +3 -2
  79. package/dist/core/auth-storage.js.map +1 -1
  80. package/dist/core/bash-executor.d.ts.map +1 -1
  81. package/dist/core/bash-executor.js +3 -1
  82. package/dist/core/bash-executor.js.map +1 -1
  83. package/dist/core/cache-warmer.d.ts +4 -37
  84. package/dist/core/cache-warmer.d.ts.map +1 -1
  85. package/dist/core/cache-warmer.js +11 -97
  86. package/dist/core/cache-warmer.js.map +1 -1
  87. package/dist/core/compaction/utils.d.ts.map +1 -1
  88. package/dist/core/compaction/utils.js +2 -1
  89. package/dist/core/compaction/utils.js.map +1 -1
  90. package/dist/core/extensions/index.d.ts +1 -1
  91. package/dist/core/extensions/index.d.ts.map +1 -1
  92. package/dist/core/extensions/index.js.map +1 -1
  93. package/dist/core/extensions/loader.d.ts.map +1 -1
  94. package/dist/core/extensions/loader.js +10 -5
  95. package/dist/core/extensions/loader.js.map +1 -1
  96. package/dist/core/extensions/runner.d.ts +1 -0
  97. package/dist/core/extensions/runner.d.ts.map +1 -1
  98. package/dist/core/extensions/runner.js +9 -1
  99. package/dist/core/extensions/runner.js.map +1 -1
  100. package/dist/core/extensions/types.d.ts +28 -6
  101. package/dist/core/extensions/types.d.ts.map +1 -1
  102. package/dist/core/extensions/types.js.map +1 -1
  103. package/dist/core/keybindings.d.ts +2 -2
  104. package/dist/core/keybindings.js +1 -1
  105. package/dist/core/keybindings.js.map +1 -1
  106. package/dist/core/mcp-servers.d.ts +12 -37
  107. package/dist/core/mcp-servers.d.ts.map +1 -1
  108. package/dist/core/mcp-servers.js +42 -121
  109. package/dist/core/mcp-servers.js.map +1 -1
  110. package/dist/core/model-config.d.ts +52 -0
  111. package/dist/core/model-config.d.ts.map +1 -1
  112. package/dist/core/model-resolver.d.ts.map +1 -1
  113. package/dist/core/model-resolver.js +20 -19
  114. package/dist/core/model-resolver.js.map +1 -1
  115. package/dist/core/model-runtime.d.ts +5 -1
  116. package/dist/core/model-runtime.d.ts.map +1 -1
  117. package/dist/core/model-runtime.js +19 -9
  118. package/dist/core/model-runtime.js.map +1 -1
  119. package/dist/core/package-manager.d.ts +10 -1
  120. package/dist/core/package-manager.d.ts.map +1 -1
  121. package/dist/core/package-manager.js +50 -5
  122. package/dist/core/package-manager.js.map +1 -1
  123. package/dist/core/pi-ai-schemas.d.ts +4 -0
  124. package/dist/core/pi-ai-schemas.d.ts.map +1 -1
  125. package/dist/core/pi-server-client.d.ts.map +1 -1
  126. package/dist/core/pi-server-client.js +1 -0
  127. package/dist/core/pi-server-client.js.map +1 -1
  128. package/dist/core/preferred-providers.d.ts +17 -0
  129. package/dist/core/preferred-providers.d.ts.map +1 -0
  130. package/dist/core/preferred-providers.js +24 -0
  131. package/dist/core/preferred-providers.js.map +1 -0
  132. package/dist/core/prompt-templates.d.ts.map +1 -1
  133. package/dist/core/prompt-templates.js +18 -2
  134. package/dist/core/prompt-templates.js.map +1 -1
  135. package/dist/core/provider-composer.d.ts.map +1 -1
  136. package/dist/core/provider-composer.js +3 -1
  137. package/dist/core/provider-composer.js.map +1 -1
  138. package/dist/core/provider-matching.d.ts +6 -0
  139. package/dist/core/provider-matching.d.ts.map +1 -0
  140. package/dist/core/provider-matching.js +8 -0
  141. package/dist/core/provider-matching.js.map +1 -0
  142. package/dist/core/radius-mcp.d.ts +13 -0
  143. package/dist/core/radius-mcp.d.ts.map +1 -0
  144. package/dist/core/radius-mcp.js +29 -0
  145. package/dist/core/radius-mcp.js.map +1 -0
  146. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  147. package/dist/core/remote-catalog-provider.js +2 -0
  148. package/dist/core/remote-catalog-provider.js.map +1 -1
  149. package/dist/core/runtime-credentials.d.ts +8 -0
  150. package/dist/core/runtime-credentials.d.ts.map +1 -1
  151. package/dist/core/runtime-credentials.js +15 -1
  152. package/dist/core/runtime-credentials.js.map +1 -1
  153. package/dist/core/session-cwd.d.ts +7 -0
  154. package/dist/core/session-cwd.d.ts.map +1 -1
  155. package/dist/core/session-cwd.js +9 -1
  156. package/dist/core/session-cwd.js.map +1 -1
  157. package/dist/core/settings-defaults.d.ts +1 -1
  158. package/dist/core/settings-defaults.d.ts.map +1 -1
  159. package/dist/core/settings-defaults.js +1 -1
  160. package/dist/core/settings-defaults.js.map +1 -1
  161. package/dist/core/tools/bash.d.ts +1 -6
  162. package/dist/core/tools/bash.d.ts.map +1 -1
  163. package/dist/core/tools/bash.js +34 -9
  164. package/dist/core/tools/bash.js.map +1 -1
  165. package/dist/core/tools/edit-diff.d.ts +23 -14
  166. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  167. package/dist/core/tools/edit-diff.js +182 -41
  168. package/dist/core/tools/edit-diff.js.map +1 -1
  169. package/dist/core/tools/edit.d.ts.map +1 -1
  170. package/dist/core/tools/edit.js +8 -7
  171. package/dist/core/tools/edit.js.map +1 -1
  172. package/dist/core/tools/find.d.ts.map +1 -1
  173. package/dist/core/tools/find.js +82 -36
  174. package/dist/core/tools/find.js.map +1 -1
  175. package/dist/core/tools/grep.d.ts +5 -3
  176. package/dist/core/tools/grep.d.ts.map +1 -1
  177. package/dist/core/tools/grep.js +87 -75
  178. package/dist/core/tools/grep.js.map +1 -1
  179. package/dist/core/tools/ls.d.ts.map +1 -1
  180. package/dist/core/tools/ls.js +2 -1
  181. package/dist/core/tools/ls.js.map +1 -1
  182. package/dist/core/tools/powershell.d.ts.map +1 -1
  183. package/dist/core/tools/powershell.js +15 -2
  184. package/dist/core/tools/powershell.js.map +1 -1
  185. package/dist/core/tools/read.d.ts +8 -0
  186. package/dist/core/tools/read.d.ts.map +1 -1
  187. package/dist/core/tools/read.js +141 -25
  188. package/dist/core/tools/read.js.map +1 -1
  189. package/dist/core/tools/truncate.d.ts +4 -14
  190. package/dist/core/tools/truncate.d.ts.map +1 -1
  191. package/dist/core/tools/truncate.js +23 -29
  192. package/dist/core/tools/truncate.js.map +1 -1
  193. package/dist/extensions/codemode/execute.js +4 -4
  194. package/dist/extensions/codemode/execute.js.map +1 -1
  195. package/dist/extensions/codemode/tool.d.ts.map +1 -1
  196. package/dist/extensions/codemode/tool.js +34 -12
  197. package/dist/extensions/codemode/tool.js.map +1 -1
  198. package/dist/extensions/llama/client.d.ts +2 -0
  199. package/dist/extensions/llama/client.d.ts.map +1 -1
  200. package/dist/extensions/llama/client.js +23 -2
  201. package/dist/extensions/llama/client.js.map +1 -1
  202. package/dist/extensions/llama/ui.d.ts.map +1 -1
  203. package/dist/extensions/llama/ui.js +15 -3
  204. package/dist/extensions/llama/ui.js.map +1 -1
  205. package/dist/extensions/mcp/cli.d.ts +2 -0
  206. package/dist/extensions/mcp/cli.d.ts.map +1 -1
  207. package/dist/extensions/mcp/cli.js +49 -14
  208. package/dist/extensions/mcp/cli.js.map +1 -1
  209. package/dist/extensions/mcp/config.d.ts.map +1 -1
  210. package/dist/extensions/mcp/config.js +4 -7
  211. package/dist/extensions/mcp/config.js.map +1 -1
  212. package/dist/extensions/mcp/index.d.ts.map +1 -1
  213. package/dist/extensions/mcp/index.js +4 -3
  214. package/dist/extensions/mcp/index.js.map +1 -1
  215. package/dist/extensions/mcp/oauth.d.ts +11 -49
  216. package/dist/extensions/mcp/oauth.d.ts.map +1 -1
  217. package/dist/extensions/mcp/oauth.js +56 -319
  218. package/dist/extensions/mcp/oauth.js.map +1 -1
  219. package/dist/extensions/mcp/resources.d.ts +1 -1
  220. package/dist/extensions/mcp/resources.d.ts.map +1 -1
  221. package/dist/extensions/mcp/resources.js +4 -3
  222. package/dist/extensions/mcp/resources.js.map +1 -1
  223. package/dist/extensions/mcp/runtime.d.ts +4 -3
  224. package/dist/extensions/mcp/runtime.d.ts.map +1 -1
  225. package/dist/extensions/mcp/runtime.js +7 -5
  226. package/dist/extensions/mcp/runtime.js.map +1 -1
  227. package/dist/extensions/mcp/tools.d.ts +2 -23
  228. package/dist/extensions/mcp/tools.d.ts.map +1 -1
  229. package/dist/extensions/mcp/tools.js +6 -58
  230. package/dist/extensions/mcp/tools.js.map +1 -1
  231. package/dist/extensions/tool-search/tool.d.ts.map +1 -1
  232. package/dist/extensions/tool-search/tool.js +18 -6
  233. package/dist/extensions/tool-search/tool.js.map +1 -1
  234. package/dist/index.d.ts +1 -1
  235. package/dist/index.d.ts.map +1 -1
  236. package/dist/index.js.map +1 -1
  237. package/dist/main.d.ts.map +1 -1
  238. package/dist/main.js +63 -11
  239. package/dist/main.js.map +1 -1
  240. package/dist/modes/interactive/components/branch-summary-message.d.ts +5 -1
  241. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  242. package/dist/modes/interactive/components/branch-summary-message.js +12 -4
  243. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  244. package/dist/modes/interactive/components/compaction-summary-message.d.ts +5 -1
  245. package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
  246. package/dist/modes/interactive/components/compaction-summary-message.js +12 -4
  247. package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
  248. package/dist/modes/interactive/components/custom-message.d.ts +5 -2
  249. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  250. package/dist/modes/interactive/components/custom-message.js +10 -3
  251. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  252. package/dist/modes/interactive/components/diff.d.ts.map +1 -1
  253. package/dist/modes/interactive/components/diff.js +11 -5
  254. package/dist/modes/interactive/components/diff.js.map +1 -1
  255. package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
  256. package/dist/modes/interactive/components/extension-selector.js +9 -1
  257. package/dist/modes/interactive/components/extension-selector.js.map +1 -1
  258. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  259. package/dist/modes/interactive/components/login-dialog.js +1 -18
  260. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  261. package/dist/modes/interactive/components/mermaid.d.ts +2 -1
  262. package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
  263. package/dist/modes/interactive/components/mermaid.js +25 -20
  264. package/dist/modes/interactive/components/mermaid.js.map +1 -1
  265. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  266. package/dist/modes/interactive/components/model-selector.js +16 -7
  267. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  268. package/dist/modes/interactive/components/oauth-selector.d.ts +10 -3
  269. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  270. package/dist/modes/interactive/components/oauth-selector.js +32 -5
  271. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  272. package/dist/modes/interactive/components/provider-brand.d.ts +14 -0
  273. package/dist/modes/interactive/components/provider-brand.d.ts.map +1 -0
  274. package/dist/modes/interactive/components/provider-brand.js +66 -0
  275. package/dist/modes/interactive/components/provider-brand.js.map +1 -0
  276. package/dist/modes/interactive/components/radius-login-selector.d.ts +1 -2
  277. package/dist/modes/interactive/components/radius-login-selector.d.ts.map +1 -1
  278. package/dist/modes/interactive/components/radius-login-selector.js +6 -37
  279. package/dist/modes/interactive/components/radius-login-selector.js.map +1 -1
  280. package/dist/modes/interactive/components/skill-invocation-message.d.ts +5 -1
  281. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  282. package/dist/modes/interactive/components/skill-invocation-message.js +12 -4
  283. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  284. package/dist/modes/interactive/components/tree-selector.d.ts +1 -0
  285. package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
  286. package/dist/modes/interactive/components/tree-selector.js +19 -10
  287. package/dist/modes/interactive/components/tree-selector.js.map +1 -1
  288. package/dist/modes/interactive/interactive-mode.d.ts +13 -1
  289. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  290. package/dist/modes/interactive/interactive-mode.js +166 -92
  291. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  292. package/dist/modes/interactive/model-catalog-refresh.d.ts +1 -1
  293. package/dist/modes/interactive/model-catalog-refresh.d.ts.map +1 -1
  294. package/dist/modes/interactive/model-catalog-refresh.js +2 -2
  295. package/dist/modes/interactive/model-catalog-refresh.js.map +1 -1
  296. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  297. package/dist/modes/interactive/theme/theme.js +4 -0
  298. package/dist/modes/interactive/theme/theme.js.map +1 -1
  299. package/dist/modes/print-mode.d.ts.map +1 -1
  300. package/dist/modes/print-mode.js +19 -10
  301. package/dist/modes/print-mode.js.map +1 -1
  302. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  303. package/dist/modes/rpc/rpc-mode.js +53 -23
  304. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  305. package/dist/package-manager-cli.d.ts.map +1 -1
  306. package/dist/package-manager-cli.js +39 -8
  307. package/dist/package-manager-cli.js.map +1 -1
  308. package/dist/utils/changelog.d.ts +2 -2
  309. package/dist/utils/changelog.d.ts.map +1 -1
  310. package/dist/utils/changelog.js +12 -6
  311. package/dist/utils/changelog.js.map +1 -1
  312. package/dist/utils/image-resize.d.ts.map +1 -1
  313. package/dist/utils/image-resize.js +3 -1
  314. package/dist/utils/image-resize.js.map +1 -1
  315. package/dist/utils/terminal-question.d.ts +8 -0
  316. package/dist/utils/terminal-question.d.ts.map +1 -0
  317. package/dist/utils/terminal-question.js +24 -0
  318. package/dist/utils/terminal-question.js.map +1 -0
  319. package/dist/utils/web-url.d.ts +12 -0
  320. package/dist/utils/web-url.d.ts.map +1 -0
  321. package/dist/utils/web-url.js +20 -0
  322. package/dist/utils/web-url.js.map +1 -0
  323. package/docs/cli.md +14 -1
  324. package/docs/extensions.md +27 -7
  325. package/docs/keybindings.md +1 -1
  326. package/docs/llama-cpp.md +5 -8
  327. package/docs/models-configuration.md +6 -1
  328. package/docs/models.md +2 -1
  329. package/docs/prompt-templates.md +1 -1
  330. package/docs/providers.md +1 -1
  331. package/docs/rpc.md +4 -2
  332. package/docs/sessions.md +7 -1
  333. package/docs/settings.md +1 -1
  334. package/docs/tui.md +1 -1
  335. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  336. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  337. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  338. package/examples/extensions/gondolin/package-lock.json +2 -2
  339. package/examples/extensions/gondolin/package.json +1 -1
  340. package/examples/extensions/plan-mode/index.ts +23 -13
  341. package/examples/extensions/plan-mode/utils.ts +42 -16
  342. package/examples/extensions/subagent/README.md +14 -11
  343. package/examples/extensions/subagent/index.ts +392 -171
  344. package/examples/extensions/with-deps/package-lock.json +2 -2
  345. package/examples/extensions/with-deps/package.json +1 -1
  346. package/examples/tsconfig.json +63 -35
  347. package/package.json +7 -7
  348. package/schemas/models.schema.json +29 -0
  349. package/schemas/settings.schema.json +1 -1
  350. package/dist/bundle/chunks/anthropic-messages-WU4RRDFO.js +0 -6
  351. package/dist/bundle/chunks/chunk-4RKLODCT.js +0 -2
  352. package/dist/bundle/chunks/chunk-G23G7KNC.js +0 -4
  353. package/dist/bundle/chunks/chunk-LTLKVIE2.js +0 -65
  354. package/dist/bundle/chunks/chunk-O5CTLHDX.js +0 -82
  355. package/dist/bundle/chunks/chunk-OV4EHN3Q.js +0 -2
  356. package/dist/bundle/chunks/chunk-PWQUNMKT.js +0 -4
  357. package/dist/bundle/chunks/chunk-TTZH2HU3.js +0 -1590
  358. package/dist/bundle/chunks/chunk-UKVNB6C4.js +0 -2
  359. package/dist/bundle/chunks/chunk-USJZMAIR.js +0 -2
  360. package/dist/bundle/chunks/chunk-YH5RGRHQ.js +0 -7
  361. package/dist/bundle/chunks/openai-codex-responses-DK2NKO47.js +0 -10
  362. package/dist/bundle/chunks/openai-responses-S5QT5K5D.js +0 -4
  363. package/dist/bundle/chunks/virtual-modules-34ID7AB7.js +0 -2
@@ -27,8 +27,11 @@ import { CredentialSynchronizationError } from "../../core/model-runtime.js";
27
27
  import { DefaultPackageManager } from "../../core/package-manager.js";
28
28
  import { getCliBinName } from "../../core/pi-client-cli-adapter.js";
29
29
  import { PI_CLIENT_RUNTIME_RELOAD_EXIT_CODE, readPiClientUpdateMarker, writePiClientRuntimeReloadState, } from "../../core/pi-client-runtime-update.js";
30
- import { RADIUS_MCP_URL, RADIUS_PROVIDER_ID } from "../../core/radius.js";
31
- import { formatMissingSessionCwdPrompt, MissingSessionCwdError } from "../../core/session-cwd.js";
30
+ import { compareProviders } from "../../core/preferred-providers.js";
31
+ import { findMatchingProviders } from "../../core/provider-matching.js";
32
+ import { RADIUS_PROVIDER_ID } from "../../core/radius.js";
33
+ import { planRadiusMcpServer } from "../../core/radius-mcp.js";
34
+ import { formatMissingSessionCwdPrompt, getMissingSessionCwdOptions, MissingSessionCwdError, } from "../../core/session-cwd.js";
32
35
  import { SessionManager, sessionEntryToContextMessages, } from "../../core/session-manager.js";
33
36
  import { BUILTIN_SLASH_COMMANDS } from "../../core/slash-commands.js";
34
37
  import { getSourcePackageKey } from "../../core/source-info.js";
@@ -36,7 +39,7 @@ import { isInstallTelemetryEnabled } from "../../core/telemetry.js";
36
39
  import { withBuiltInRenderers } from "../../core/tools/renderers/index.js";
37
40
  import { hasTrustRequiringProjectResources, ProjectTrustStore } from "../../core/trust-manager.js";
38
41
  import { getUsageCostBreakdown } from "../../core/usage-totals.js";
39
- import { addMcpServerConfig, loadMcpConfig } from "../../extensions/mcp/config.js";
42
+ import { addMcpServerConfig } from "../../extensions/mcp/config.js";
40
43
  import { getChangelogPath, getNewEntries, normalizeChangelogLinks, parseChangelog } from "../../utils/changelog.js";
41
44
  import { copyToClipboard, readClipboardFilePaths, readClipboardText } from "../../utils/clipboard.js";
42
45
  import { extensionForImageMimeType, readClipboardImage } from "../../utils/clipboard-image.js";
@@ -68,6 +71,7 @@ import { ExtensionSelectorComponent } from "./components/extension-selector.js";
68
71
  import { FooterComponent, formatTokens } from "./components/footer.js";
69
72
  import { formatKeyText, keyDisplayText, keyHint, keyText, rawKeyHint } from "./components/keybinding-hints.js";
70
73
  import { LoginDialogComponent } from "./components/login-dialog.js";
74
+ import { createMarkdownTransform } from "./components/markdown-transform.js";
71
75
  import { createMermaidMarkdownTransformer } from "./components/mermaid.js";
72
76
  import { ModelSelectorComponent } from "./components/model-selector.js";
73
77
  import { formatAuthSelectorProviderStatus, formatAuthSelectorProviderType, OAuthSelectorComponent, } from "./components/oauth-selector.js";
@@ -222,7 +226,7 @@ function getLoginProviderCompletionOptions(providerOptions) {
222
226
  subscription: provider.subscription,
223
227
  });
224
228
  }
225
- return Array.from(byId.values()).sort((a, b) => a.name.localeCompare(b.name));
229
+ return Array.from(byId.values()).sort(compareProviders);
226
230
  }
227
231
  function getLoginProviderSearchText(provider) {
228
232
  const authTypes = provider.authTypes
@@ -280,6 +284,8 @@ export class InteractiveMode {
280
284
  changelogMarkdown = undefined;
281
285
  extensionChangelogUpdates = [];
282
286
  startupNoticesShown = false;
287
+ /** Last cache-warming notice, extended in place while it is the last chat line. */
288
+ cacheWarmingNotice;
283
289
  anthropicSubscriptionWarningShown = false;
284
290
  // Status line tracking (for mutating immediately-sequential status updates)
285
291
  lastStatusSpacer = undefined;
@@ -331,6 +337,13 @@ export class InteractiveMode {
331
337
  // Extension dialogs shown in the editor slot (select, confirm, input, editor, inline custom).
332
338
  // The last entry is visible; see pushExtensionDialog().
333
339
  extensionDialogs = [];
340
+ /** Numbers the program status sources of blocking overlays, so closing one keeps the others. */
341
+ nextBlockingOverlayId = 0;
342
+ /**
343
+ * Open extension overlays (custom with overlay: true) and the function that removes each, in opening
344
+ * order. Reset removes only these, not pi's own overlays.
345
+ */
346
+ extensionOverlays = new Map();
334
347
  extensionTerminalInputSubscriptions = new Set();
335
348
  // Extension widgets (components rendered above/below the editor)
336
349
  extensionWidgetsAbove = new Map();
@@ -590,7 +603,7 @@ export class InteractiveMode {
590
603
  else {
591
604
  this.chatContainer.addChild(new ThemedText(() => theme.bold(theme.fg("accent", "What's New")), 1, 0));
592
605
  this.chatContainer.addChild(new Spacer(1));
593
- this.chatContainer.addChild(new Markdown(this.changelogMarkdown.trim(), 1, 0, this.getMarkdownThemeWithSettings()));
606
+ this.chatContainer.addChild(this.createChangelogMarkdown(this.changelogMarkdown.trim(), 1, 0));
594
607
  this.chatContainer.addChild(new Spacer(1));
595
608
  }
596
609
  }
@@ -608,7 +621,7 @@ export class InteractiveMode {
608
621
  this.chatContainer.addChild(new ThemedText(() => theme.bold(theme.fg("accent", "Extension Updates")), 1, 0));
609
622
  this.chatContainer.addChild(new Spacer(1));
610
623
  const markdown = this.extensionChangelogUpdates.map((update) => update.markdown).join("\n\n");
611
- this.chatContainer.addChild(new Markdown(markdown, 1, 0, this.getMarkdownThemeWithSettings()));
624
+ this.chatContainer.addChild(this.createChangelogMarkdown(markdown, 1, 0));
612
625
  this.chatContainer.addChild(new Spacer(1));
613
626
  }
614
627
  }
@@ -858,7 +871,8 @@ export class InteractiveMode {
858
871
  if (!process.env.PI_OFFLINE) {
859
872
  const controller = new AbortController();
860
873
  const timeout = setTimeout(() => controller.abort(), 15_000);
861
- void refreshModelCatalogs(this.session.modelRuntime, controller.signal)
874
+ void this.session.modelRuntime
875
+ .refresh({ signal: controller.signal })
862
876
  .then((result) => {
863
877
  this.updateAvailableProviderCount();
864
878
  if (result.aborted)
@@ -1038,6 +1052,11 @@ export class InteractiveMode {
1038
1052
  return undefined;
1039
1053
  }
1040
1054
  const newEntries = getNewEntries(entries, lastVersion);
1055
+ if (!newEntries) {
1056
+ // Unreadable saved version: show nothing and record the current one so later updates compare again
1057
+ this.settingsManager.setLastChangelogVersion(VERSION);
1058
+ return undefined;
1059
+ }
1041
1060
  if (newEntries.length > 0) {
1042
1061
  this.settingsManager.setLastChangelogVersion(VERSION);
1043
1062
  this.reportInstallTelemetry(VERSION);
@@ -1072,6 +1091,11 @@ export class InteractiveMode {
1072
1091
  continue;
1073
1092
  }
1074
1093
  const newEntries = getNewEntries(parseChangelog(sourceInfo.changelogPath), lastVersion);
1094
+ if (!newEntries) {
1095
+ // Unreadable saved version: show nothing and record the current one so later updates compare again
1096
+ this.settingsManager.setExtensionChangelogVersion(key, pkg.version);
1097
+ continue;
1098
+ }
1075
1099
  if (newEntries.length > 0) {
1076
1100
  this.settingsManager.setExtensionChangelogVersion(key, pkg.version);
1077
1101
  const name = pkg.name || sourceInfo.source;
@@ -1799,6 +1823,7 @@ export class InteractiveMode {
1799
1823
  this.loadedResourcesContainer.clear();
1800
1824
  this.chatContainer.clear();
1801
1825
  this.pendingMessagesContainer.clear();
1826
+ this.pendingBashComponents = [];
1802
1827
  this.compactionQueuedMessages = [];
1803
1828
  this.streamingComponent = undefined;
1804
1829
  this.streamingMessage = undefined;
@@ -1818,6 +1843,12 @@ export class InteractiveMode {
1818
1843
  getMarkdownTransformers() {
1819
1844
  return [this.mermaidMarkdownTransformer, ...this.session.extensionRunner.getMarkdownTransformers()];
1820
1845
  }
1846
+ /** Markdown of a changelog or release note that runs the Markdown transformers of the `changelog` type. */
1847
+ createChangelogMarkdown(markdown, paddingX, paddingY, defaultTextStyle) {
1848
+ return new Markdown(markdown, paddingX, paddingY, this.getMarkdownThemeWithSettings(), defaultTextStyle, {
1849
+ transform: createMarkdownTransform("changelog", () => false, this.getMarkdownTransformers()),
1850
+ });
1851
+ }
1821
1852
  /**
1822
1853
  * Set up keyboard shortcuts registered by extensions.
1823
1854
  */
@@ -2072,7 +2103,10 @@ export class InteractiveMode {
2072
2103
  this.extensionDialogs = [];
2073
2104
  this.showTopExtensionDialog();
2074
2105
  }
2075
- this.ui.hideOverlay();
2106
+ // Reload and session switches replace every extension without calling done(): remove their overlays,
2107
+ // newest first, the same way done() does, but leave the promises pending as for inline dialogs.
2108
+ for (const removeOverlay of [...this.extensionOverlays.values()].reverse())
2109
+ removeOverlay();
2076
2110
  this.clearExtensionTerminalInputListeners();
2077
2111
  this.setExtensionFooter(undefined);
2078
2112
  this.setExtensionHeader(undefined);
@@ -2348,8 +2382,9 @@ export class InteractiveMode {
2348
2382
  return result === "Yes";
2349
2383
  }
2350
2384
  async promptForMissingSessionCwd(error) {
2351
- const confirmed = await this.showExtensionConfirm("Session cwd not found", formatMissingSessionCwdPrompt(error.issue));
2352
- return confirmed ? error.issue.fallbackCwd : undefined;
2385
+ const options = getMissingSessionCwdOptions(error.issue);
2386
+ const label = await this.showExtensionSelector(formatMissingSessionCwdPrompt(error.issue), options.map((option) => option.label));
2387
+ return options.find((option) => option.label === label)?.value;
2353
2388
  }
2354
2389
  /**
2355
2390
  * Show a text input for extensions.
@@ -2392,7 +2427,7 @@ export class InteractiveMode {
2392
2427
  setCustomEditorComponent(factory) {
2393
2428
  this.editorComponentFactory = factory;
2394
2429
  // Save text from current editor before switching
2395
- const currentText = this.editor.getText();
2430
+ const currentText = this.editor.getExpandedText?.() ?? this.editor.getText();
2396
2431
  // An open extension dialog keeps the editor slot; the new editor is shown when the last dialog closes.
2397
2432
  const dialogOpen = this.extensionDialogs.length > 0;
2398
2433
  if (!dialogOpen) {
@@ -2478,11 +2513,13 @@ export class InteractiveMode {
2478
2513
  }
2479
2514
  /** Show a custom component with keyboard focus. Overlay mode renders on top of existing content. */
2480
2515
  async showExtensionCustom(factory, options) {
2481
- const savedText = this.editor.getText();
2516
+ const savedText = this.editor.getExpandedText?.() ?? this.editor.getText();
2482
2517
  const isOverlay = options?.overlay ?? false;
2483
2518
  return new Promise((resolve, reject) => {
2484
2519
  let component;
2485
2520
  let overlayHandle;
2521
+ // An overlay stays blocked until its interaction ends, also while setHidden() hides it.
2522
+ const overlayStatusSource = isOverlay && options?.blocked ? `extension-overlay:${this.nextBlockingOverlayId++}` : undefined;
2486
2523
  let closed = false;
2487
2524
  const restoreEditor = () => {
2488
2525
  if (component)
@@ -2490,17 +2527,7 @@ export class InteractiveMode {
2490
2527
  this.editor.setText(savedText);
2491
2528
  this.ui.requestRender();
2492
2529
  };
2493
- const close = (result) => {
2494
- if (closed)
2495
- return;
2496
- closed = true;
2497
- // Remove this overlay, not the topmost one: another overlay may have opened above it.
2498
- if (isOverlay)
2499
- overlayHandle?.hide();
2500
- else
2501
- restoreEditor();
2502
- // Note: both branches above already call requestRender
2503
- resolve(result);
2530
+ const disposeComponent = () => {
2504
2531
  try {
2505
2532
  component?.dispose?.();
2506
2533
  }
@@ -2508,6 +2535,30 @@ export class InteractiveMode {
2508
2535
  /* ignore dispose errors */
2509
2536
  }
2510
2537
  };
2538
+ // Shared by done() and resetExtensionUI(). Removing the map entry first makes a second call a no-op.
2539
+ const removeOverlay = () => {
2540
+ if (!overlayHandle || !this.extensionOverlays.delete(overlayHandle))
2541
+ return;
2542
+ // Remove this overlay, not the topmost one: another overlay may have opened above it.
2543
+ overlayHandle.hide();
2544
+ if (overlayStatusSource)
2545
+ this.programStatus.setBlocked(overlayStatusSource, undefined);
2546
+ disposeComponent();
2547
+ };
2548
+ const close = (result) => {
2549
+ if (closed)
2550
+ return;
2551
+ closed = true;
2552
+ if (isOverlay) {
2553
+ removeOverlay();
2554
+ resolve(result);
2555
+ }
2556
+ else {
2557
+ restoreEditor();
2558
+ resolve(result);
2559
+ disposeComponent();
2560
+ }
2561
+ };
2511
2562
  Promise.resolve(factory(this.ui, theme, this.keybindings, close))
2512
2563
  .then((c) => {
2513
2564
  if (closed)
@@ -2527,6 +2578,9 @@ export class InteractiveMode {
2527
2578
  return w ? { width: w } : undefined;
2528
2579
  };
2529
2580
  overlayHandle = this.ui.showOverlay(c, resolveOptions());
2581
+ this.extensionOverlays.set(overlayHandle, removeOverlay);
2582
+ if (overlayStatusSource)
2583
+ this.programStatus.setBlocked(overlayStatusSource, options?.blocked);
2530
2584
  // Expose handle to caller for visibility control
2531
2585
  options?.onHandle?.(overlayHandle);
2532
2586
  }
@@ -3206,6 +3260,12 @@ export class InteractiveMode {
3206
3260
  this.pendingTools.clear();
3207
3261
  this.ui.requestRender();
3208
3262
  break;
3263
+ case "agent_settled":
3264
+ // The session records deferred user bash results when the run settles; show them there too.
3265
+ this.flushPendingBashComponents();
3266
+ this.ui.requestRender();
3267
+ await this.checkShutdownRequested();
3268
+ break;
3209
3269
  case "compaction_start": {
3210
3270
  if (this.settingsManager.getShowTerminalProgress()) {
3211
3271
  this.ui.terminal.setProgress(true);
@@ -3416,7 +3476,7 @@ export class InteractiveMode {
3416
3476
  case "custom": {
3417
3477
  if (message.display) {
3418
3478
  const renderer = this.session.extensionRunner.getMessageRenderer(message.customType);
3419
- const component = new CustomMessageComponent(message, renderer, this.getMarkdownThemeWithSettings(), this.outputPad);
3479
+ const component = new CustomMessageComponent(message, renderer, this.getMarkdownThemeWithSettings(), this.outputPad, this.getMarkdownTransformers(), options?.messageId, options?.timestamp);
3420
3480
  component.setExpanded(this.toolOutputExpanded);
3421
3481
  this.chatContainer.addChild(component);
3422
3482
  }
@@ -3424,14 +3484,14 @@ export class InteractiveMode {
3424
3484
  }
3425
3485
  case "compactionSummary": {
3426
3486
  this.chatContainer.addChild(new Spacer(1));
3427
- const component = new CompactionSummaryMessageComponent(message, this.getMarkdownThemeWithSettings(), this.outputPad);
3487
+ const component = new CompactionSummaryMessageComponent(message, this.getMarkdownThemeWithSettings(), this.outputPad, this.getMarkdownTransformers(), options?.messageId, options?.timestamp);
3428
3488
  component.setExpanded(this.toolOutputExpanded);
3429
3489
  this.chatContainer.addChild(component);
3430
3490
  break;
3431
3491
  }
3432
3492
  case "branchSummary": {
3433
3493
  this.chatContainer.addChild(new Spacer(1));
3434
- const component = new BranchSummaryMessageComponent(message, this.getMarkdownThemeWithSettings(), this.outputPad);
3494
+ const component = new BranchSummaryMessageComponent(message, this.getMarkdownThemeWithSettings(), this.outputPad, this.getMarkdownTransformers(), options?.messageId, options?.timestamp);
3435
3495
  component.setExpanded(this.toolOutputExpanded);
3436
3496
  this.chatContainer.addChild(component);
3437
3497
  break;
@@ -3447,7 +3507,7 @@ export class InteractiveMode {
3447
3507
  const skillBlock = parseSkillBlock(textContent);
3448
3508
  if (skillBlock) {
3449
3509
  // Render skill block (collapsible)
3450
- const component = new SkillInvocationMessageComponent(skillBlock, this.getMarkdownThemeWithSettings(), this.outputPad);
3510
+ const component = new SkillInvocationMessageComponent(skillBlock, this.getMarkdownThemeWithSettings(), this.outputPad, this.getMarkdownTransformers(), options?.messageId, options?.timestamp);
3451
3511
  component.setExpanded(this.toolOutputExpanded);
3452
3512
  this.chatContainer.addChild(component);
3453
3513
  // Render user message separately if present
@@ -3601,9 +3661,18 @@ export class InteractiveMode {
3601
3661
  addCacheWarmingUsage(entry) {
3602
3662
  if (!this.settingsManager.getShowCacheMissNotices())
3603
3663
  return;
3664
+ // Back-to-back warms collapse into one line with the cumulative cost.
3665
+ const previous = this.cacheWarmingNotice;
3666
+ if (previous && this.chatContainer.children.at(-1) === previous.component && previous.note === entry.note) {
3667
+ previous.total.cost += entry.usage.cost.total;
3668
+ previous.component.invalidate();
3669
+ return;
3670
+ }
3671
+ const total = { cost: entry.usage.cost.total };
3672
+ const component = new ThemedText(() => theme.fg("dim", formatCacheWarmingUsage(total.cost, entry.note)), 1, 0);
3673
+ this.cacheWarmingNotice = { component, total, note: entry.note };
3604
3674
  this.chatContainer.addChild(new Spacer(1));
3605
- const usage = formatCacheWarmingUsage(entry);
3606
- this.chatContainer.addChild(new ThemedText(() => theme.fg("dim", usage), 1, 0));
3675
+ this.chatContainer.addChild(component);
3607
3676
  }
3608
3677
  /**
3609
3678
  * Render billing usage for a compaction or branch summary. The notice is derived
@@ -4022,7 +4091,7 @@ export class InteractiveMode {
4022
4091
  if (isExpandable(activeHeader)) {
4023
4092
  activeHeader.setExpanded(expanded);
4024
4093
  }
4025
- for (const container of [this.loadedResourcesContainer, this.chatContainer]) {
4094
+ for (const container of [this.loadedResourcesContainer, this.chatContainer, this.pendingMessagesContainer]) {
4026
4095
  for (const child of container.children) {
4027
4096
  if (isExpandable(child)) {
4028
4097
  child.setExpanded(expanded);
@@ -4100,9 +4169,7 @@ export class InteractiveMode {
4100
4169
  this.chatContainer.addChild(new ThemedText(() => `${theme.bold(theme.fg("warning", "Update Available"))}\n${updateInstruction()}`, 1, 0));
4101
4170
  if (note) {
4102
4171
  this.chatContainer.addChild(new Spacer(1));
4103
- this.chatContainer.addChild(new Markdown(note, 1, 0, this.getMarkdownThemeWithSettings(), {
4104
- color: (text) => theme.fg("muted", text),
4105
- }));
4172
+ this.chatContainer.addChild(this.createChangelogMarkdown(note, 1, 0, { color: (text) => theme.fg("muted", text) }));
4106
4173
  this.chatContainer.addChild(new Spacer(1));
4107
4174
  }
4108
4175
  this.chatContainer.addChild(new ThemedText(changelogLine, 1, 0));
@@ -4155,6 +4222,10 @@ export class InteractiveMode {
4155
4222
  }
4156
4223
  updatePendingMessagesDisplay() {
4157
4224
  this.pendingMessagesContainer.clear();
4225
+ // User bash output shown while the agent works lives here until it moves to the chat.
4226
+ for (const component of this.pendingBashComponents) {
4227
+ this.pendingMessagesContainer.addChild(component);
4228
+ }
4158
4229
  const { steering: steeringMessages, followUp: followUpMessages } = this.getAllQueuedMessages();
4159
4230
  if (steeringMessages.length > 0 || followUpMessages.length > 0) {
4160
4231
  this.pendingMessagesContainer.addChild(new Spacer(1));
@@ -4188,7 +4259,7 @@ export class InteractiveMode {
4188
4259
  return 0;
4189
4260
  }
4190
4261
  const queuedText = allQueued.join("\n\n");
4191
- const currentText = options?.currentText ?? this.editor.getText();
4262
+ const currentText = options?.currentText ?? this.editor.getExpandedText?.() ?? this.editor.getText();
4192
4263
  const combinedText = [queuedText, currentText].filter((t) => t.trim()).join("\n\n");
4193
4264
  this.editor.setText(combinedText);
4194
4265
  this.updatePendingMessagesDisplay();
@@ -5108,25 +5179,43 @@ export class InteractiveMode {
5108
5179
  }
5109
5180
  catch (error) {
5110
5181
  if (error instanceof MissingSessionCwdError) {
5111
- const selectedCwd = await this.promptForMissingSessionCwd(error);
5112
- if (!selectedCwd) {
5113
- this.showStatus("Resume cancelled");
5114
- return { cancelled: true };
5115
- }
5116
- const result = await this.runtimeHost.switchSession(sessionPath, {
5117
- cwdOverride: selectedCwd,
5118
- withSession: options?.withSession,
5119
- projectTrustContextFactory: (cwd) => this.createProjectTrustContext(cwd),
5120
- });
5121
- if (result.cancelled) {
5122
- return result;
5182
+ switch (await this.promptForMissingSessionCwd(error)) {
5183
+ case "continue": {
5184
+ const result = await this.runtimeHost.switchSession(sessionPath, {
5185
+ cwdOverride: error.issue.fallbackCwd,
5186
+ withSession: options?.withSession,
5187
+ projectTrustContextFactory: (cwd) => this.createProjectTrustContext(cwd),
5188
+ });
5189
+ if (!result.cancelled)
5190
+ this.showStatus(`Resumed session in ${error.issue.fallbackCwd}`);
5191
+ return result;
5192
+ }
5193
+ case "fork":
5194
+ return this.switchToForkedSession(sessionPath, error.issue.fallbackCwd, options);
5195
+ case undefined:
5196
+ this.showStatus("Resume cancelled");
5197
+ return { cancelled: true };
5123
5198
  }
5124
- this.showStatus("Resumed session in current cwd");
5125
- return result;
5126
5199
  }
5127
5200
  return this.handleFatalRuntimeError("Failed to resume session", error);
5128
5201
  }
5129
5202
  }
5203
+ /** Fork a session whose stored cwd is gone into `cwd` and switch to the fork, like `--session <id>` from another project (#11060). */
5204
+ async switchToForkedSession(sourcePath, cwd, options) {
5205
+ const fork = SessionManager.forkFrom(sourcePath, cwd, this.sessionManager.getSessionDir());
5206
+ const forkPath = fork.getSessionFile();
5207
+ const result = await this.runtimeHost.switchSession(forkPath, {
5208
+ withSession: options?.withSession,
5209
+ projectTrustContextFactory: (cwd) => this.createProjectTrustContext(cwd),
5210
+ });
5211
+ if (result.cancelled) {
5212
+ // An extension vetoed the switch; drop the fork so cancelling leaves no copy behind.
5213
+ fs.rmSync(forkPath, { force: true });
5214
+ return result;
5215
+ }
5216
+ this.showStatus(`Forked into new session ${fork.getSessionId()} in ${cwd}`);
5217
+ return result;
5218
+ }
5130
5219
  getLoginProviderOptions(authType) {
5131
5220
  const options = [];
5132
5221
  for (const provider of this.session.modelRuntime.getProviders()) {
@@ -5159,7 +5248,8 @@ export class InteractiveMode {
5159
5248
  });
5160
5249
  }
5161
5250
  }
5162
- return options.sort((a, b) => a.name.localeCompare(b.name));
5251
+ // The sort is stable, so a provider's account option stays above its API key option.
5252
+ return options.sort(compareProviders);
5163
5253
  }
5164
5254
  async getLogoutProviderOptions() {
5165
5255
  return (await this.session.modelRuntime.listCredentials({ signal: AbortSignal.timeout(15_000) }))
@@ -5178,22 +5268,14 @@ export class InteractiveMode {
5178
5268
  subscription: provider?.auth.oauth?.isSubscription === true,
5179
5269
  };
5180
5270
  })
5181
- .sort((a, b) => a.name.localeCompare(b.name));
5182
- }
5183
- findLoginProviderOptions(providerRef) {
5184
- const normalizedProviderRef = providerRef.trim().toLowerCase();
5185
- if (!normalizedProviderRef) {
5186
- return [];
5187
- }
5188
- return this.getLoginProviderOptions().filter((provider) => provider.id.toLowerCase() === normalizedProviderRef ||
5189
- provider.name.toLowerCase() === normalizedProviderRef);
5271
+ .sort(compareProviders);
5190
5272
  }
5191
5273
  async handleLoginCommand(providerRef) {
5192
5274
  if (!providerRef) {
5193
5275
  this.showLoginAuthTypeSelector();
5194
5276
  return;
5195
5277
  }
5196
- const providerOptions = this.findLoginProviderOptions(providerRef);
5278
+ const providerOptions = findMatchingProviders(this.getLoginProviderOptions(), providerRef);
5197
5279
  if (providerOptions.length === 1) {
5198
5280
  await this.startProviderLogin(providerOptions[0]);
5199
5281
  return;
@@ -5310,8 +5392,8 @@ export class InteractiveMode {
5310
5392
  else {
5311
5393
  this.ui.requestRender();
5312
5394
  }
5313
- }, initialSearchInput);
5314
- return { component: selector, focus: selector };
5395
+ }, initialSearchInput, this.ui);
5396
+ return { component: selector, focus: selector, dispose: () => selector.dispose() };
5315
5397
  });
5316
5398
  }
5317
5399
  async showOAuthSelector(mode) {
@@ -5373,8 +5455,8 @@ export class InteractiveMode {
5373
5455
  }, () => {
5374
5456
  done();
5375
5457
  this.ui.requestRender();
5376
- });
5377
- return { component: selector, focus: selector };
5458
+ }, undefined, this.ui);
5459
+ return { component: selector, focus: selector, dispose: () => selector.dispose() };
5378
5460
  });
5379
5461
  }
5380
5462
  async completeProviderAuthentication(providerId, providerName, authType, previousModel) {
@@ -5653,24 +5735,10 @@ export class InteractiveMode {
5653
5735
  * when missing. Nothing is asked when a global server already uses this login.
5654
5736
  */
5655
5737
  offerRadiusMcpServer(providerId, providerName) {
5656
- const mcpPath = path.join(getAgentDir(), "mcp.json");
5657
- const normalizeUrl = (url) => url.replace(/\/+$/u, "");
5658
- const { servers } = loadMcpConfig({
5659
- agentDir: getAgentDir(),
5660
- cwd: this.sessionManager.getCwd(),
5661
- projectTrusted: false,
5662
- });
5663
- const existing = servers.find((server) => "url" in server.config && normalizeUrl(server.config.url) === normalizeUrl(RADIUS_MCP_URL));
5664
- if (existing && "url" in existing.config && existing.config.auth?.provider === providerId)
5738
+ const plan = planRadiusMcpServer(providerId, getAgentDir(), this.sessionManager.getCwd());
5739
+ if (!plan)
5665
5740
  return;
5666
- let name = existing?.name ?? "radius";
5667
- if (!existing && servers.some((server) => server.name === name))
5668
- name = "radius-mcp";
5669
- const config = existing && "url" in existing.config
5670
- ? { ...existing.config, auth: { provider: providerId } }
5671
- : { url: RADIUS_MCP_URL, auth: { provider: providerId } };
5672
- // `auth` replaces the MCP OAuth sign-in.
5673
- delete config.oauth;
5741
+ const { mcpPath, name, config } = plan;
5674
5742
  this.showSelector((done) => {
5675
5743
  const selector = new ExtensionSelectorComponent(`Configure ${providerName} MCP in ${mcpPath}?`, ["Yes", "No"], (option) => {
5676
5744
  done();
@@ -5883,18 +5951,22 @@ export class InteractiveMode {
5883
5951
  }
5884
5952
  catch (error) {
5885
5953
  if (error instanceof MissingSessionCwdError) {
5886
- const selectedCwd = await this.promptForMissingSessionCwd(error);
5887
- if (!selectedCwd) {
5888
- this.showStatus("Import cancelled");
5889
- return;
5890
- }
5891
- const result = await this.runtimeHost.importFromJsonl(inputPath, selectedCwd);
5892
- if (result.cancelled) {
5893
- this.showStatus("Import cancelled");
5894
- return;
5954
+ switch (await this.promptForMissingSessionCwd(error)) {
5955
+ case "continue": {
5956
+ const result = await this.runtimeHost.importFromJsonl(inputPath, error.issue.fallbackCwd);
5957
+ this.showStatus(result.cancelled ? "Import cancelled" : `Session imported from: ${inputPath}`);
5958
+ return;
5959
+ }
5960
+ case "fork": {
5961
+ const result = await this.switchToForkedSession(inputPath, error.issue.fallbackCwd);
5962
+ if (result.cancelled)
5963
+ this.showStatus("Import cancelled");
5964
+ return;
5965
+ }
5966
+ case undefined:
5967
+ this.showStatus("Import cancelled");
5968
+ return;
5895
5969
  }
5896
- this.showStatus(`Session imported from: ${inputPath}`);
5897
- return;
5898
5970
  }
5899
5971
  if (error instanceof SessionImportFileNotFoundError) {
5900
5972
  this.showError(`Failed to import session: ${error.message}`);
@@ -6061,7 +6133,7 @@ export class InteractiveMode {
6061
6133
  this.chatContainer.addChild(new DynamicBorder());
6062
6134
  this.chatContainer.addChild(new ThemedText(() => theme.bold(theme.fg("accent", "What's New")), 1, 0));
6063
6135
  this.chatContainer.addChild(new Spacer(1));
6064
- this.chatContainer.addChild(new Markdown(changelogMarkdown, 1, 1, this.getMarkdownThemeWithSettings()));
6136
+ this.chatContainer.addChild(this.createChangelogMarkdown(changelogMarkdown, 1, 1));
6065
6137
  this.chatContainer.addChild(new DynamicBorder());
6066
6138
  this.ui.requestRender();
6067
6139
  }
@@ -6263,6 +6335,7 @@ export class InteractiveMode {
6263
6335
  const result = eventResult.result;
6264
6336
  // Create UI component for display
6265
6337
  this.bashComponent = new BashExecutionComponent(command, this.ui, excludeFromContext, this.outputPad);
6338
+ this.bashComponent.setExpanded(this.toolOutputExpanded);
6266
6339
  if (this.session.isStreaming) {
6267
6340
  this.pendingMessagesContainer.addChild(this.bashComponent);
6268
6341
  this.pendingBashComponents.push(this.bashComponent);
@@ -6284,6 +6357,7 @@ export class InteractiveMode {
6284
6357
  // Normal execution path (possibly with custom operations)
6285
6358
  const isDeferred = this.session.isStreaming;
6286
6359
  this.bashComponent = new BashExecutionComponent(command, this.ui, excludeFromContext, this.outputPad);
6360
+ this.bashComponent.setExpanded(this.toolOutputExpanded);
6287
6361
  if (isDeferred) {
6288
6362
  // Show in pending area when agent is streaming
6289
6363
  this.pendingMessagesContainer.addChild(this.bashComponent);