@averyyy/pi-coding-agent 1.5.0-piclient.3 → 1.5.2-piclient.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (359) 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-NWAB6VML.js → chunk-BWM3ZYWS.js} +1 -1
  7. package/dist/bundle/chunks/{chunk-GJFZM2RZ.js → chunk-D2CMHQWH.js} +9 -9
  8. package/dist/bundle/chunks/chunk-DGLLW4Y4.js +1590 -0
  9. package/dist/bundle/chunks/{chunk-N4CTF6DK.js → chunk-ECEUFETK.js} +1 -1
  10. package/dist/bundle/chunks/{chunk-3UW3IQIY.js → chunk-FA5D3PPT.js} +1 -1
  11. package/dist/bundle/chunks/chunk-GFUN2N5K.js +2 -0
  12. package/dist/bundle/chunks/{chunk-OW4KH7CI.js → chunk-H36DQSY7.js} +1 -1
  13. package/dist/bundle/chunks/chunk-IEBK4HQA.js +2 -0
  14. package/dist/bundle/chunks/chunk-IYMNLY6C.js +4 -0
  15. package/dist/bundle/chunks/chunk-M4NMEBFE.js +2 -0
  16. package/dist/bundle/chunks/chunk-P4REYYCM.js +55 -0
  17. package/dist/bundle/chunks/chunk-RRE46THK.js +35 -0
  18. package/dist/bundle/chunks/chunk-RZHIIJ2O.js +2 -0
  19. package/dist/bundle/chunks/chunk-SHIWNICN.js +8 -0
  20. package/dist/bundle/chunks/{chunk-WATJAG5U.js → chunk-TCESBBFS.js} +1 -1
  21. package/dist/bundle/chunks/{chunk-GO33PKBT.js → chunk-V5KN6SNQ.js} +1 -1
  22. package/dist/bundle/chunks/chunk-V7WCKBVO.js +19 -0
  23. package/dist/bundle/chunks/{chunk-OXKIVFVM.js → chunk-VZFAYNKC.js} +1 -1
  24. package/dist/bundle/chunks/{chunk-JM6XUN2B.js → chunk-YAD6BXOQ.js} +5 -1
  25. package/dist/bundle/chunks/chunk-ZG74NES2.js +2 -0
  26. package/dist/bundle/chunks/{cli-2Q4CKMZK.js → cli-OTDOMRGW.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 +2 -2
  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-J7Z5J7IR.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 +2 -0
  116. package/dist/core/model-runtime.d.ts.map +1 -1
  117. package/dist/core/model-runtime.js +8 -4
  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 +14 -6
  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 +164 -91
  291. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  292. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  293. package/dist/modes/interactive/theme/theme.js +4 -0
  294. package/dist/modes/interactive/theme/theme.js.map +1 -1
  295. package/dist/modes/print-mode.d.ts.map +1 -1
  296. package/dist/modes/print-mode.js +19 -10
  297. package/dist/modes/print-mode.js.map +1 -1
  298. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  299. package/dist/modes/rpc/rpc-mode.js +53 -23
  300. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  301. package/dist/package-manager-cli.d.ts.map +1 -1
  302. package/dist/package-manager-cli.js +39 -8
  303. package/dist/package-manager-cli.js.map +1 -1
  304. package/dist/utils/changelog.d.ts +2 -2
  305. package/dist/utils/changelog.d.ts.map +1 -1
  306. package/dist/utils/changelog.js +12 -6
  307. package/dist/utils/changelog.js.map +1 -1
  308. package/dist/utils/image-resize.d.ts.map +1 -1
  309. package/dist/utils/image-resize.js +3 -1
  310. package/dist/utils/image-resize.js.map +1 -1
  311. package/dist/utils/terminal-question.d.ts +8 -0
  312. package/dist/utils/terminal-question.d.ts.map +1 -0
  313. package/dist/utils/terminal-question.js +24 -0
  314. package/dist/utils/terminal-question.js.map +1 -0
  315. package/dist/utils/web-url.d.ts +12 -0
  316. package/dist/utils/web-url.d.ts.map +1 -0
  317. package/dist/utils/web-url.js +20 -0
  318. package/dist/utils/web-url.js.map +1 -0
  319. package/docs/cli.md +14 -1
  320. package/docs/extensions.md +27 -7
  321. package/docs/keybindings.md +1 -1
  322. package/docs/llama-cpp.md +5 -8
  323. package/docs/models-configuration.md +6 -1
  324. package/docs/models.md +2 -1
  325. package/docs/prompt-templates.md +1 -1
  326. package/docs/providers.md +1 -1
  327. package/docs/rpc.md +4 -2
  328. package/docs/sessions.md +7 -1
  329. package/docs/settings.md +1 -1
  330. package/docs/tui.md +1 -1
  331. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  332. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  333. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  334. package/examples/extensions/gondolin/package-lock.json +2 -2
  335. package/examples/extensions/gondolin/package.json +1 -1
  336. package/examples/extensions/plan-mode/index.ts +23 -13
  337. package/examples/extensions/plan-mode/utils.ts +42 -16
  338. package/examples/extensions/subagent/README.md +14 -11
  339. package/examples/extensions/subagent/index.ts +392 -171
  340. package/examples/extensions/with-deps/package-lock.json +2 -2
  341. package/examples/extensions/with-deps/package.json +1 -1
  342. package/examples/tsconfig.json +63 -35
  343. package/package.json +7 -7
  344. package/schemas/models.schema.json +29 -0
  345. package/schemas/settings.schema.json +1 -1
  346. package/dist/bundle/chunks/anthropic-messages-WU4RRDFO.js +0 -6
  347. package/dist/bundle/chunks/chunk-4RKLODCT.js +0 -2
  348. package/dist/bundle/chunks/chunk-7FMRLQ6P.js +0 -1590
  349. package/dist/bundle/chunks/chunk-G23G7KNC.js +0 -4
  350. package/dist/bundle/chunks/chunk-LTLKVIE2.js +0 -65
  351. package/dist/bundle/chunks/chunk-O5CTLHDX.js +0 -82
  352. package/dist/bundle/chunks/chunk-OV4EHN3Q.js +0 -2
  353. package/dist/bundle/chunks/chunk-PWQUNMKT.js +0 -4
  354. package/dist/bundle/chunks/chunk-UKVNB6C4.js +0 -2
  355. package/dist/bundle/chunks/chunk-USJZMAIR.js +0 -2
  356. package/dist/bundle/chunks/chunk-YH5RGRHQ.js +0 -7
  357. package/dist/bundle/chunks/openai-codex-responses-DK2NKO47.js +0 -10
  358. package/dist/bundle/chunks/openai-responses-S5QT5K5D.js +0 -4
  359. package/dist/bundle/chunks/virtual-modules-CTTKTI6Z.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
  }
@@ -1038,6 +1051,11 @@ export class InteractiveMode {
1038
1051
  return undefined;
1039
1052
  }
1040
1053
  const newEntries = getNewEntries(entries, lastVersion);
1054
+ if (!newEntries) {
1055
+ // Unreadable saved version: show nothing and record the current one so later updates compare again
1056
+ this.settingsManager.setLastChangelogVersion(VERSION);
1057
+ return undefined;
1058
+ }
1041
1059
  if (newEntries.length > 0) {
1042
1060
  this.settingsManager.setLastChangelogVersion(VERSION);
1043
1061
  this.reportInstallTelemetry(VERSION);
@@ -1072,6 +1090,11 @@ export class InteractiveMode {
1072
1090
  continue;
1073
1091
  }
1074
1092
  const newEntries = getNewEntries(parseChangelog(sourceInfo.changelogPath), lastVersion);
1093
+ if (!newEntries) {
1094
+ // Unreadable saved version: show nothing and record the current one so later updates compare again
1095
+ this.settingsManager.setExtensionChangelogVersion(key, pkg.version);
1096
+ continue;
1097
+ }
1075
1098
  if (newEntries.length > 0) {
1076
1099
  this.settingsManager.setExtensionChangelogVersion(key, pkg.version);
1077
1100
  const name = pkg.name || sourceInfo.source;
@@ -1799,6 +1822,7 @@ export class InteractiveMode {
1799
1822
  this.loadedResourcesContainer.clear();
1800
1823
  this.chatContainer.clear();
1801
1824
  this.pendingMessagesContainer.clear();
1825
+ this.pendingBashComponents = [];
1802
1826
  this.compactionQueuedMessages = [];
1803
1827
  this.streamingComponent = undefined;
1804
1828
  this.streamingMessage = undefined;
@@ -1818,6 +1842,12 @@ export class InteractiveMode {
1818
1842
  getMarkdownTransformers() {
1819
1843
  return [this.mermaidMarkdownTransformer, ...this.session.extensionRunner.getMarkdownTransformers()];
1820
1844
  }
1845
+ /** Markdown of a changelog or release note that runs the Markdown transformers of the `changelog` type. */
1846
+ createChangelogMarkdown(markdown, paddingX, paddingY, defaultTextStyle) {
1847
+ return new Markdown(markdown, paddingX, paddingY, this.getMarkdownThemeWithSettings(), defaultTextStyle, {
1848
+ transform: createMarkdownTransform("changelog", () => false, this.getMarkdownTransformers()),
1849
+ });
1850
+ }
1821
1851
  /**
1822
1852
  * Set up keyboard shortcuts registered by extensions.
1823
1853
  */
@@ -2072,7 +2102,10 @@ export class InteractiveMode {
2072
2102
  this.extensionDialogs = [];
2073
2103
  this.showTopExtensionDialog();
2074
2104
  }
2075
- this.ui.hideOverlay();
2105
+ // Reload and session switches replace every extension without calling done(): remove their overlays,
2106
+ // newest first, the same way done() does, but leave the promises pending as for inline dialogs.
2107
+ for (const removeOverlay of [...this.extensionOverlays.values()].reverse())
2108
+ removeOverlay();
2076
2109
  this.clearExtensionTerminalInputListeners();
2077
2110
  this.setExtensionFooter(undefined);
2078
2111
  this.setExtensionHeader(undefined);
@@ -2348,8 +2381,9 @@ export class InteractiveMode {
2348
2381
  return result === "Yes";
2349
2382
  }
2350
2383
  async promptForMissingSessionCwd(error) {
2351
- const confirmed = await this.showExtensionConfirm("Session cwd not found", formatMissingSessionCwdPrompt(error.issue));
2352
- return confirmed ? error.issue.fallbackCwd : undefined;
2384
+ const options = getMissingSessionCwdOptions(error.issue);
2385
+ const label = await this.showExtensionSelector(formatMissingSessionCwdPrompt(error.issue), options.map((option) => option.label));
2386
+ return options.find((option) => option.label === label)?.value;
2353
2387
  }
2354
2388
  /**
2355
2389
  * Show a text input for extensions.
@@ -2392,7 +2426,7 @@ export class InteractiveMode {
2392
2426
  setCustomEditorComponent(factory) {
2393
2427
  this.editorComponentFactory = factory;
2394
2428
  // Save text from current editor before switching
2395
- const currentText = this.editor.getText();
2429
+ const currentText = this.editor.getExpandedText?.() ?? this.editor.getText();
2396
2430
  // An open extension dialog keeps the editor slot; the new editor is shown when the last dialog closes.
2397
2431
  const dialogOpen = this.extensionDialogs.length > 0;
2398
2432
  if (!dialogOpen) {
@@ -2478,11 +2512,13 @@ export class InteractiveMode {
2478
2512
  }
2479
2513
  /** Show a custom component with keyboard focus. Overlay mode renders on top of existing content. */
2480
2514
  async showExtensionCustom(factory, options) {
2481
- const savedText = this.editor.getText();
2515
+ const savedText = this.editor.getExpandedText?.() ?? this.editor.getText();
2482
2516
  const isOverlay = options?.overlay ?? false;
2483
2517
  return new Promise((resolve, reject) => {
2484
2518
  let component;
2485
2519
  let overlayHandle;
2520
+ // An overlay stays blocked until its interaction ends, also while setHidden() hides it.
2521
+ const overlayStatusSource = isOverlay && options?.blocked ? `extension-overlay:${this.nextBlockingOverlayId++}` : undefined;
2486
2522
  let closed = false;
2487
2523
  const restoreEditor = () => {
2488
2524
  if (component)
@@ -2490,17 +2526,7 @@ export class InteractiveMode {
2490
2526
  this.editor.setText(savedText);
2491
2527
  this.ui.requestRender();
2492
2528
  };
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);
2529
+ const disposeComponent = () => {
2504
2530
  try {
2505
2531
  component?.dispose?.();
2506
2532
  }
@@ -2508,6 +2534,30 @@ export class InteractiveMode {
2508
2534
  /* ignore dispose errors */
2509
2535
  }
2510
2536
  };
2537
+ // Shared by done() and resetExtensionUI(). Removing the map entry first makes a second call a no-op.
2538
+ const removeOverlay = () => {
2539
+ if (!overlayHandle || !this.extensionOverlays.delete(overlayHandle))
2540
+ return;
2541
+ // Remove this overlay, not the topmost one: another overlay may have opened above it.
2542
+ overlayHandle.hide();
2543
+ if (overlayStatusSource)
2544
+ this.programStatus.setBlocked(overlayStatusSource, undefined);
2545
+ disposeComponent();
2546
+ };
2547
+ const close = (result) => {
2548
+ if (closed)
2549
+ return;
2550
+ closed = true;
2551
+ if (isOverlay) {
2552
+ removeOverlay();
2553
+ resolve(result);
2554
+ }
2555
+ else {
2556
+ restoreEditor();
2557
+ resolve(result);
2558
+ disposeComponent();
2559
+ }
2560
+ };
2511
2561
  Promise.resolve(factory(this.ui, theme, this.keybindings, close))
2512
2562
  .then((c) => {
2513
2563
  if (closed)
@@ -2527,6 +2577,9 @@ export class InteractiveMode {
2527
2577
  return w ? { width: w } : undefined;
2528
2578
  };
2529
2579
  overlayHandle = this.ui.showOverlay(c, resolveOptions());
2580
+ this.extensionOverlays.set(overlayHandle, removeOverlay);
2581
+ if (overlayStatusSource)
2582
+ this.programStatus.setBlocked(overlayStatusSource, options?.blocked);
2530
2583
  // Expose handle to caller for visibility control
2531
2584
  options?.onHandle?.(overlayHandle);
2532
2585
  }
@@ -3206,6 +3259,12 @@ export class InteractiveMode {
3206
3259
  this.pendingTools.clear();
3207
3260
  this.ui.requestRender();
3208
3261
  break;
3262
+ case "agent_settled":
3263
+ // The session records deferred user bash results when the run settles; show them there too.
3264
+ this.flushPendingBashComponents();
3265
+ this.ui.requestRender();
3266
+ await this.checkShutdownRequested();
3267
+ break;
3209
3268
  case "compaction_start": {
3210
3269
  if (this.settingsManager.getShowTerminalProgress()) {
3211
3270
  this.ui.terminal.setProgress(true);
@@ -3416,7 +3475,7 @@ export class InteractiveMode {
3416
3475
  case "custom": {
3417
3476
  if (message.display) {
3418
3477
  const renderer = this.session.extensionRunner.getMessageRenderer(message.customType);
3419
- const component = new CustomMessageComponent(message, renderer, this.getMarkdownThemeWithSettings(), this.outputPad);
3478
+ const component = new CustomMessageComponent(message, renderer, this.getMarkdownThemeWithSettings(), this.outputPad, this.getMarkdownTransformers(), options?.messageId, options?.timestamp);
3420
3479
  component.setExpanded(this.toolOutputExpanded);
3421
3480
  this.chatContainer.addChild(component);
3422
3481
  }
@@ -3424,14 +3483,14 @@ export class InteractiveMode {
3424
3483
  }
3425
3484
  case "compactionSummary": {
3426
3485
  this.chatContainer.addChild(new Spacer(1));
3427
- const component = new CompactionSummaryMessageComponent(message, this.getMarkdownThemeWithSettings(), this.outputPad);
3486
+ const component = new CompactionSummaryMessageComponent(message, this.getMarkdownThemeWithSettings(), this.outputPad, this.getMarkdownTransformers(), options?.messageId, options?.timestamp);
3428
3487
  component.setExpanded(this.toolOutputExpanded);
3429
3488
  this.chatContainer.addChild(component);
3430
3489
  break;
3431
3490
  }
3432
3491
  case "branchSummary": {
3433
3492
  this.chatContainer.addChild(new Spacer(1));
3434
- const component = new BranchSummaryMessageComponent(message, this.getMarkdownThemeWithSettings(), this.outputPad);
3493
+ const component = new BranchSummaryMessageComponent(message, this.getMarkdownThemeWithSettings(), this.outputPad, this.getMarkdownTransformers(), options?.messageId, options?.timestamp);
3435
3494
  component.setExpanded(this.toolOutputExpanded);
3436
3495
  this.chatContainer.addChild(component);
3437
3496
  break;
@@ -3447,7 +3506,7 @@ export class InteractiveMode {
3447
3506
  const skillBlock = parseSkillBlock(textContent);
3448
3507
  if (skillBlock) {
3449
3508
  // Render skill block (collapsible)
3450
- const component = new SkillInvocationMessageComponent(skillBlock, this.getMarkdownThemeWithSettings(), this.outputPad);
3509
+ const component = new SkillInvocationMessageComponent(skillBlock, this.getMarkdownThemeWithSettings(), this.outputPad, this.getMarkdownTransformers(), options?.messageId, options?.timestamp);
3451
3510
  component.setExpanded(this.toolOutputExpanded);
3452
3511
  this.chatContainer.addChild(component);
3453
3512
  // Render user message separately if present
@@ -3601,9 +3660,18 @@ export class InteractiveMode {
3601
3660
  addCacheWarmingUsage(entry) {
3602
3661
  if (!this.settingsManager.getShowCacheMissNotices())
3603
3662
  return;
3663
+ // Back-to-back warms collapse into one line with the cumulative cost.
3664
+ const previous = this.cacheWarmingNotice;
3665
+ if (previous && this.chatContainer.children.at(-1) === previous.component && previous.note === entry.note) {
3666
+ previous.total.cost += entry.usage.cost.total;
3667
+ previous.component.invalidate();
3668
+ return;
3669
+ }
3670
+ const total = { cost: entry.usage.cost.total };
3671
+ const component = new ThemedText(() => theme.fg("dim", formatCacheWarmingUsage(total.cost, entry.note)), 1, 0);
3672
+ this.cacheWarmingNotice = { component, total, note: entry.note };
3604
3673
  this.chatContainer.addChild(new Spacer(1));
3605
- const usage = formatCacheWarmingUsage(entry);
3606
- this.chatContainer.addChild(new ThemedText(() => theme.fg("dim", usage), 1, 0));
3674
+ this.chatContainer.addChild(component);
3607
3675
  }
3608
3676
  /**
3609
3677
  * Render billing usage for a compaction or branch summary. The notice is derived
@@ -4022,7 +4090,7 @@ export class InteractiveMode {
4022
4090
  if (isExpandable(activeHeader)) {
4023
4091
  activeHeader.setExpanded(expanded);
4024
4092
  }
4025
- for (const container of [this.loadedResourcesContainer, this.chatContainer]) {
4093
+ for (const container of [this.loadedResourcesContainer, this.chatContainer, this.pendingMessagesContainer]) {
4026
4094
  for (const child of container.children) {
4027
4095
  if (isExpandable(child)) {
4028
4096
  child.setExpanded(expanded);
@@ -4100,9 +4168,7 @@ export class InteractiveMode {
4100
4168
  this.chatContainer.addChild(new ThemedText(() => `${theme.bold(theme.fg("warning", "Update Available"))}\n${updateInstruction()}`, 1, 0));
4101
4169
  if (note) {
4102
4170
  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
- }));
4171
+ this.chatContainer.addChild(this.createChangelogMarkdown(note, 1, 0, { color: (text) => theme.fg("muted", text) }));
4106
4172
  this.chatContainer.addChild(new Spacer(1));
4107
4173
  }
4108
4174
  this.chatContainer.addChild(new ThemedText(changelogLine, 1, 0));
@@ -4155,6 +4221,10 @@ export class InteractiveMode {
4155
4221
  }
4156
4222
  updatePendingMessagesDisplay() {
4157
4223
  this.pendingMessagesContainer.clear();
4224
+ // User bash output shown while the agent works lives here until it moves to the chat.
4225
+ for (const component of this.pendingBashComponents) {
4226
+ this.pendingMessagesContainer.addChild(component);
4227
+ }
4158
4228
  const { steering: steeringMessages, followUp: followUpMessages } = this.getAllQueuedMessages();
4159
4229
  if (steeringMessages.length > 0 || followUpMessages.length > 0) {
4160
4230
  this.pendingMessagesContainer.addChild(new Spacer(1));
@@ -4188,7 +4258,7 @@ export class InteractiveMode {
4188
4258
  return 0;
4189
4259
  }
4190
4260
  const queuedText = allQueued.join("\n\n");
4191
- const currentText = options?.currentText ?? this.editor.getText();
4261
+ const currentText = options?.currentText ?? this.editor.getExpandedText?.() ?? this.editor.getText();
4192
4262
  const combinedText = [queuedText, currentText].filter((t) => t.trim()).join("\n\n");
4193
4263
  this.editor.setText(combinedText);
4194
4264
  this.updatePendingMessagesDisplay();
@@ -5108,25 +5178,43 @@ export class InteractiveMode {
5108
5178
  }
5109
5179
  catch (error) {
5110
5180
  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;
5181
+ switch (await this.promptForMissingSessionCwd(error)) {
5182
+ case "continue": {
5183
+ const result = await this.runtimeHost.switchSession(sessionPath, {
5184
+ cwdOverride: error.issue.fallbackCwd,
5185
+ withSession: options?.withSession,
5186
+ projectTrustContextFactory: (cwd) => this.createProjectTrustContext(cwd),
5187
+ });
5188
+ if (!result.cancelled)
5189
+ this.showStatus(`Resumed session in ${error.issue.fallbackCwd}`);
5190
+ return result;
5191
+ }
5192
+ case "fork":
5193
+ return this.switchToForkedSession(sessionPath, error.issue.fallbackCwd, options);
5194
+ case undefined:
5195
+ this.showStatus("Resume cancelled");
5196
+ return { cancelled: true };
5123
5197
  }
5124
- this.showStatus("Resumed session in current cwd");
5125
- return result;
5126
5198
  }
5127
5199
  return this.handleFatalRuntimeError("Failed to resume session", error);
5128
5200
  }
5129
5201
  }
5202
+ /** Fork a session whose stored cwd is gone into `cwd` and switch to the fork, like `--session <id>` from another project (#11060). */
5203
+ async switchToForkedSession(sourcePath, cwd, options) {
5204
+ const fork = SessionManager.forkFrom(sourcePath, cwd, this.sessionManager.getSessionDir());
5205
+ const forkPath = fork.getSessionFile();
5206
+ const result = await this.runtimeHost.switchSession(forkPath, {
5207
+ withSession: options?.withSession,
5208
+ projectTrustContextFactory: (cwd) => this.createProjectTrustContext(cwd),
5209
+ });
5210
+ if (result.cancelled) {
5211
+ // An extension vetoed the switch; drop the fork so cancelling leaves no copy behind.
5212
+ fs.rmSync(forkPath, { force: true });
5213
+ return result;
5214
+ }
5215
+ this.showStatus(`Forked into new session ${fork.getSessionId()} in ${cwd}`);
5216
+ return result;
5217
+ }
5130
5218
  getLoginProviderOptions(authType) {
5131
5219
  const options = [];
5132
5220
  for (const provider of this.session.modelRuntime.getProviders()) {
@@ -5159,7 +5247,8 @@ export class InteractiveMode {
5159
5247
  });
5160
5248
  }
5161
5249
  }
5162
- return options.sort((a, b) => a.name.localeCompare(b.name));
5250
+ // The sort is stable, so a provider's account option stays above its API key option.
5251
+ return options.sort(compareProviders);
5163
5252
  }
5164
5253
  async getLogoutProviderOptions() {
5165
5254
  return (await this.session.modelRuntime.listCredentials({ signal: AbortSignal.timeout(15_000) }))
@@ -5178,22 +5267,14 @@ export class InteractiveMode {
5178
5267
  subscription: provider?.auth.oauth?.isSubscription === true,
5179
5268
  };
5180
5269
  })
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);
5270
+ .sort(compareProviders);
5190
5271
  }
5191
5272
  async handleLoginCommand(providerRef) {
5192
5273
  if (!providerRef) {
5193
5274
  this.showLoginAuthTypeSelector();
5194
5275
  return;
5195
5276
  }
5196
- const providerOptions = this.findLoginProviderOptions(providerRef);
5277
+ const providerOptions = findMatchingProviders(this.getLoginProviderOptions(), providerRef);
5197
5278
  if (providerOptions.length === 1) {
5198
5279
  await this.startProviderLogin(providerOptions[0]);
5199
5280
  return;
@@ -5310,8 +5391,8 @@ export class InteractiveMode {
5310
5391
  else {
5311
5392
  this.ui.requestRender();
5312
5393
  }
5313
- }, initialSearchInput);
5314
- return { component: selector, focus: selector };
5394
+ }, initialSearchInput, this.ui);
5395
+ return { component: selector, focus: selector, dispose: () => selector.dispose() };
5315
5396
  });
5316
5397
  }
5317
5398
  async showOAuthSelector(mode) {
@@ -5373,8 +5454,8 @@ export class InteractiveMode {
5373
5454
  }, () => {
5374
5455
  done();
5375
5456
  this.ui.requestRender();
5376
- });
5377
- return { component: selector, focus: selector };
5457
+ }, undefined, this.ui);
5458
+ return { component: selector, focus: selector, dispose: () => selector.dispose() };
5378
5459
  });
5379
5460
  }
5380
5461
  async completeProviderAuthentication(providerId, providerName, authType, previousModel) {
@@ -5653,24 +5734,10 @@ export class InteractiveMode {
5653
5734
  * when missing. Nothing is asked when a global server already uses this login.
5654
5735
  */
5655
5736
  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)
5737
+ const plan = planRadiusMcpServer(providerId, getAgentDir(), this.sessionManager.getCwd());
5738
+ if (!plan)
5665
5739
  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;
5740
+ const { mcpPath, name, config } = plan;
5674
5741
  this.showSelector((done) => {
5675
5742
  const selector = new ExtensionSelectorComponent(`Configure ${providerName} MCP in ${mcpPath}?`, ["Yes", "No"], (option) => {
5676
5743
  done();
@@ -5883,18 +5950,22 @@ export class InteractiveMode {
5883
5950
  }
5884
5951
  catch (error) {
5885
5952
  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;
5953
+ switch (await this.promptForMissingSessionCwd(error)) {
5954
+ case "continue": {
5955
+ const result = await this.runtimeHost.importFromJsonl(inputPath, error.issue.fallbackCwd);
5956
+ this.showStatus(result.cancelled ? "Import cancelled" : `Session imported from: ${inputPath}`);
5957
+ return;
5958
+ }
5959
+ case "fork": {
5960
+ const result = await this.switchToForkedSession(inputPath, error.issue.fallbackCwd);
5961
+ if (result.cancelled)
5962
+ this.showStatus("Import cancelled");
5963
+ return;
5964
+ }
5965
+ case undefined:
5966
+ this.showStatus("Import cancelled");
5967
+ return;
5895
5968
  }
5896
- this.showStatus(`Session imported from: ${inputPath}`);
5897
- return;
5898
5969
  }
5899
5970
  if (error instanceof SessionImportFileNotFoundError) {
5900
5971
  this.showError(`Failed to import session: ${error.message}`);
@@ -6061,7 +6132,7 @@ export class InteractiveMode {
6061
6132
  this.chatContainer.addChild(new DynamicBorder());
6062
6133
  this.chatContainer.addChild(new ThemedText(() => theme.bold(theme.fg("accent", "What's New")), 1, 0));
6063
6134
  this.chatContainer.addChild(new Spacer(1));
6064
- this.chatContainer.addChild(new Markdown(changelogMarkdown, 1, 1, this.getMarkdownThemeWithSettings()));
6135
+ this.chatContainer.addChild(this.createChangelogMarkdown(changelogMarkdown, 1, 1));
6065
6136
  this.chatContainer.addChild(new DynamicBorder());
6066
6137
  this.ui.requestRender();
6067
6138
  }
@@ -6263,6 +6334,7 @@ export class InteractiveMode {
6263
6334
  const result = eventResult.result;
6264
6335
  // Create UI component for display
6265
6336
  this.bashComponent = new BashExecutionComponent(command, this.ui, excludeFromContext, this.outputPad);
6337
+ this.bashComponent.setExpanded(this.toolOutputExpanded);
6266
6338
  if (this.session.isStreaming) {
6267
6339
  this.pendingMessagesContainer.addChild(this.bashComponent);
6268
6340
  this.pendingBashComponents.push(this.bashComponent);
@@ -6284,6 +6356,7 @@ export class InteractiveMode {
6284
6356
  // Normal execution path (possibly with custom operations)
6285
6357
  const isDeferred = this.session.isStreaming;
6286
6358
  this.bashComponent = new BashExecutionComponent(command, this.ui, excludeFromContext, this.outputPad);
6359
+ this.bashComponent.setExpanded(this.toolOutputExpanded);
6287
6360
  if (isDeferred) {
6288
6361
  // Show in pending area when agent is streaming
6289
6362
  this.pendingMessagesContainer.addChild(this.bashComponent);