@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
@@ -180,6 +180,20 @@ function sanitizeGeneratedSessionName(text) {
180
180
  }
181
181
  // AgentSession Class
182
182
  // ============================================================================
183
+ /**
184
+ * Index of the model to cycle to, or undefined when there is nothing to switch to.
185
+ * When the current model is not in the list (currentIndex -1), forward picks the first
186
+ * entry and backward the last, so a one-entry list still selects its only model.
187
+ */
188
+ function getNextCycleIndex(currentIndex, length, direction) {
189
+ if (length === 0)
190
+ return undefined;
191
+ if (currentIndex === -1)
192
+ return direction === "forward" ? 0 : length - 1;
193
+ if (length === 1)
194
+ return undefined;
195
+ return direction === "forward" ? (currentIndex + 1) % length : (currentIndex - 1 + length) % length;
196
+ }
183
197
  export class AgentSession {
184
198
  agent;
185
199
  sessionManager;
@@ -193,6 +207,7 @@ export class AgentSession {
193
207
  _pendingAgentSettlements = 0;
194
208
  /** True while before_agent_start and pre-run compaction prepare a run that has sent no request yet. */
195
209
  _isPreparingRun = false;
210
+ _promptPreflightCount = 0;
196
211
  _agentRunAbortRequested = false;
197
212
  _idleWaitPromise;
198
213
  _resolveIdleWait;
@@ -204,6 +219,8 @@ export class AgentSession {
204
219
  _steeringMessages = [];
205
220
  /** Tracks pending follow-up messages for UI display. Removed when delivered. */
206
221
  _followUpMessages = [];
222
+ /** Queued image content shared by provisional queue selections and their original messages. */
223
+ _queuedImageContents = new WeakSet();
207
224
  /** Messages queued to be included with the next user prompt as context ("asides"). */
208
225
  _pendingNextTurnMessages = [];
209
226
  /** Context-only custom messages queued during a run, flushed once the current turn's tool results are in. */
@@ -428,19 +445,25 @@ export class AgentSession {
428
445
  return this._modelRuntime.getPhysicalModel(message.provider, message.model);
429
446
  return model?.provider === message.provider && model.id === message.model ? model : undefined;
430
447
  }
448
+ /** Record the live model and thinking level on the current branch, so a resume restores them. */
449
+ _recordSelection() {
450
+ const branch = this.sessionManager.getBranch();
451
+ this._recordModelSelection(branch);
452
+ this._recordThinkingLevel(branch);
453
+ }
431
454
  /**
432
- * Record the selection on the current branch when the branch implies another one, so a resume
433
- * restores it. Tree navigation can leave the latest `model_change` on another branch; responses
434
- * cannot record a virtual selection because they name physical models. Responses do record a
435
- * physical selection unless the branch holds a virtual one; checking a physical selection against
436
- * responses would record it on every prompt while `prepareRequest` redirects to another model.
455
+ * Record the model on the current branch when the branch implies another one. Tree navigation
456
+ * can leave the latest `model_change` on another branch; responses cannot record a virtual
457
+ * selection because they name physical models. Responses do record a physical selection unless
458
+ * the branch holds a virtual one; checking a physical selection against responses would record
459
+ * it on every prompt while `prepareRequest` redirects to another model.
437
460
  */
438
- _recordSelection() {
461
+ _recordModelSelection(branch) {
439
462
  const model = this.model;
440
463
  if (!model)
441
464
  return;
442
465
  const getModel = (provider, modelId) => this._modelRuntime.getModel(provider, modelId);
443
- const recorded = getBranchSelection(this.sessionManager.getBranch(), getModel);
466
+ const recorded = getBranchSelection(branch, getModel);
444
467
  if (!recorded || (recorded.provider === model.provider && recorded.modelId === model.id))
445
468
  return;
446
469
  const recordedModel = getModel(recorded.provider, recorded.modelId);
@@ -448,6 +471,25 @@ export class AgentSession {
448
471
  return;
449
472
  this.sessionManager.appendModelChange(model.provider, model.id);
450
473
  }
474
+ /**
475
+ * Record the thinking level on the current branch when the branch implies another one (#11451).
476
+ * Tree navigation can leave the latest `thinking_level_change` on another branch. The recorded
477
+ * level is compared after clamping to the current model, so a level clamped on resume (e.g.
478
+ * `xhigh` running as `high`) is not recorded over the requested one.
479
+ */
480
+ _recordThinkingLevel(branch) {
481
+ const recorded = branch.findLast((entry) => entry.type === "thinking_level_change");
482
+ if (!recorded)
483
+ return;
484
+ const recordedLevel = recorded.thinkingLevel;
485
+ const availableLevels = this.getAvailableThinkingLevels();
486
+ const effective = availableLevels.includes(recordedLevel)
487
+ ? recordedLevel
488
+ : this._clampThinkingLevel(recordedLevel, availableLevels);
489
+ if (effective === this.thinkingLevel)
490
+ return;
491
+ this.sessionManager.appendThinkingLevelChange(this.thinkingLevel);
492
+ }
451
493
  /** The model whose limits apply to the conversation. */
452
494
  _limitsModel() {
453
495
  return this.routedModel?.model ?? this.model;
@@ -910,21 +952,25 @@ export class AgentSession {
910
952
  if (event.type === "message_start" && event.message.role === "user") {
911
953
  this._overflowRecoveryAttempted = false;
912
954
  const messageText = contentText(event.message.content, "");
913
- if (messageText) {
914
- // Check steering queue first
915
- const steeringIndex = this._steeringMessages.indexOf(messageText);
916
- if (steeringIndex !== -1) {
917
- this._steeringMessages.splice(steeringIndex, 1);
955
+ // Check steering queue first
956
+ const steeringIndex = this._steeringMessages.indexOf(messageText);
957
+ if (steeringIndex !== -1) {
958
+ this._steeringMessages.splice(steeringIndex, 1);
959
+ this._emitQueueUpdate();
960
+ }
961
+ else {
962
+ // Check follow-up queue
963
+ const followUpIndex = this._followUpMessages.indexOf(messageText);
964
+ if (followUpIndex !== -1) {
965
+ this._followUpMessages.splice(followUpIndex, 1);
918
966
  this._emitQueueUpdate();
919
967
  }
920
- else {
921
- // Check follow-up queue
922
- const followUpIndex = this._followUpMessages.indexOf(messageText);
923
- if (followUpIndex !== -1) {
924
- this._followUpMessages.splice(followUpIndex, 1);
925
- this._emitQueueUpdate();
926
- }
927
- }
968
+ }
969
+ // Normalize queued images at delivery, before events and persistence see the message,
970
+ // so they get the same resize as idle prompts with the current model's limits (#11738).
971
+ if (typeof event.message.content !== "string" && this._queuedImageContents.has(event.message.content)) {
972
+ this._queuedImageContents.delete(event.message.content);
973
+ await this._normalizeQueuedMessageImages(event.message);
928
974
  }
929
975
  }
930
976
  // Emit to extensions first, then notify public listeners.
@@ -1357,6 +1403,7 @@ export class AgentSession {
1357
1403
  this.isRetrying ||
1358
1404
  this.isBashRunning ||
1359
1405
  this._compactionCompletionPromise !== undefined ||
1406
+ this._branchSummaryCompletionPromise !== undefined ||
1360
1407
  this._pendingAgentSettlements > 0 ||
1361
1408
  this._isAborting);
1362
1409
  }
@@ -2086,14 +2133,35 @@ export class AgentSession {
2086
2133
  return;
2087
2134
  }
2088
2135
  }
2089
- if (this._compactionAbortController !== undefined && !this._isAborting) {
2136
+ if ((this._compactionAbortController !== undefined || this._branchSummaryAbortController !== undefined) &&
2137
+ !this._isAborting) {
2090
2138
  throw new Error("Cannot submit a prompt while compaction is in progress. Wait for compaction to finish and retry.");
2091
2139
  }
2140
+ // Reserve the context through async input hooks and auth checks so tree navigation cannot
2141
+ // start meanwhile (#9154). _startRun marks the run active synchronously, so there is no gap.
2142
+ this._promptPreflightCount++;
2143
+ let trigger;
2144
+ try {
2145
+ trigger = await this._preparePrompt(text, options);
2146
+ }
2147
+ finally {
2148
+ this._promptPreflightCount--;
2149
+ }
2150
+ if (trigger)
2151
+ await this._startRun(trigger, () => preflightResult?.("started"));
2152
+ }
2153
+ /**
2154
+ * Run input hooks, expand templates, queue while streaming, and validate model and auth.
2155
+ * Returns the run trigger, or undefined when the prompt was handled or queued.
2156
+ */
2157
+ async _preparePrompt(text, options) {
2158
+ const expandPromptTemplates = options?.expandPromptTemplates ?? true;
2159
+ const preflightResult = options?.preflightResult;
2092
2160
  // Emit input event for extension interception (before skill/template expansion)
2093
2161
  const processedInput = await this._runInputHandlers(text, options?.images, options?.source ?? "interactive", this.isStreaming ? options?.streamingBehavior : undefined);
2094
2162
  if (!processedInput) {
2095
2163
  preflightResult?.("handled");
2096
- return;
2164
+ return undefined;
2097
2165
  }
2098
2166
  const { text: currentText, images: currentImages } = processedInput;
2099
2167
  // Expand skill commands (/skill:name args) and prompt templates (/template args)
@@ -2114,7 +2182,7 @@ export class AgentSession {
2114
2182
  await this._queueSteer(expandedText, currentImages);
2115
2183
  }
2116
2184
  preflightResult?.("queued");
2117
- return;
2185
+ return undefined;
2118
2186
  }
2119
2187
  // Validate model
2120
2188
  if (!this.model) {
@@ -2131,7 +2199,7 @@ export class AgentSession {
2131
2199
  }
2132
2200
  throw new Error(formatNoApiKeyFoundMessage(this.model.provider));
2133
2201
  }
2134
- await this._startRun({ messageType: "user", prompt: expandedText, images: currentImages }, () => preflightResult?.("started"));
2202
+ return { messageType: "user", prompt: expandedText, images: currentImages };
2135
2203
  }
2136
2204
  /**
2137
2205
  * Try to execute an extension command. Returns true if command was found and executed.
@@ -2240,11 +2308,10 @@ export class AgentSession {
2240
2308
  if (images) {
2241
2309
  content.push(...images);
2242
2310
  }
2243
- this.agent.steer({
2244
- role: "user",
2245
- content,
2246
- timestamp: Date.now(),
2247
- });
2311
+ const message = { role: "user", content, timestamp: Date.now() };
2312
+ if (images?.length)
2313
+ this._queuedImageContents.add(content);
2314
+ this.agent.steer(message);
2248
2315
  if (this._isAborting) {
2249
2316
  this._continueAfterAbortRequested = true;
2250
2317
  }
@@ -2259,15 +2326,26 @@ export class AgentSession {
2259
2326
  if (images) {
2260
2327
  content.push(...images);
2261
2328
  }
2262
- this.agent.followUp({
2263
- role: "user",
2264
- content,
2265
- timestamp: Date.now(),
2266
- });
2329
+ const message = { role: "user", content, timestamp: Date.now() };
2330
+ if (images?.length)
2331
+ this._queuedImageContents.add(content);
2332
+ this.agent.followUp(message);
2267
2333
  if (this._isAborting) {
2268
2334
  this._continueAfterAbortRequested = true;
2269
2335
  }
2270
2336
  }
2337
+ /** Replace a queued user message's images in place with normalized ones, appending hints to its text. */
2338
+ async _normalizeQueuedMessageImages(message) {
2339
+ if (typeof message.content === "string")
2340
+ return;
2341
+ const [first, ...rest] = message.content;
2342
+ if (first?.type !== "text")
2343
+ return;
2344
+ const images = rest.filter((block) => block.type === "image");
2345
+ const normalized = await this._normalizePromptImages(images);
2346
+ const text = normalized.hints.length > 0 ? `${first.text}\n\n${normalized.hints.join("\n")}` : first.text;
2347
+ message.content.splice(0, message.content.length, { type: "text", text }, ...rest.filter((block) => block.type !== "image"), ...normalized.images);
2348
+ }
2271
2349
  /**
2272
2350
  * Throw an error if the text is an extension command.
2273
2351
  */
@@ -2594,14 +2672,11 @@ export class AgentSession {
2594
2672
  }
2595
2673
  async _cycleScopedModel(direction, options) {
2596
2674
  const scopedModels = getAvailableScopedModels(this._scopedModels, this._modelRuntime.getAvailableSnapshot());
2597
- if (scopedModels.length <= 1)
2598
- return undefined;
2599
2675
  const currentModel = this.model;
2600
- let currentIndex = scopedModels.findIndex((sm) => modelsAreEqual(sm.model, currentModel));
2601
- if (currentIndex === -1)
2602
- currentIndex = 0;
2603
- const len = scopedModels.length;
2604
- const nextIndex = direction === "forward" ? (currentIndex + 1) % len : (currentIndex - 1 + len) % len;
2676
+ const currentIndex = scopedModels.findIndex((sm) => modelsAreEqual(sm.model, currentModel));
2677
+ const nextIndex = getNextCycleIndex(currentIndex, scopedModels.length, direction);
2678
+ if (nextIndex === undefined)
2679
+ return undefined;
2605
2680
  const next = scopedModels[nextIndex];
2606
2681
  const thinkingLevel = this._getThinkingLevelForModelSwitch(next.model, next.thinkingLevel);
2607
2682
  // Apply model
@@ -2622,14 +2697,11 @@ export class AgentSession {
2622
2697
  }
2623
2698
  async _cycleAvailableModel(direction, options) {
2624
2699
  const availableModels = this._modelRuntime.getAvailableSnapshot();
2625
- if (availableModels.length <= 1)
2626
- return undefined;
2627
2700
  const currentModel = this.model;
2628
- let currentIndex = availableModels.findIndex((m) => modelsAreEqual(m, currentModel));
2629
- if (currentIndex === -1)
2630
- currentIndex = 0;
2631
- const len = availableModels.length;
2632
- const nextIndex = direction === "forward" ? (currentIndex + 1) % len : (currentIndex - 1 + len) % len;
2701
+ const currentIndex = availableModels.findIndex((m) => modelsAreEqual(m, currentModel));
2702
+ const nextIndex = getNextCycleIndex(currentIndex, availableModels.length, direction);
2703
+ if (nextIndex === undefined)
2704
+ return undefined;
2633
2705
  const nextModel = availableModels[nextIndex];
2634
2706
  const thinkingLevel = this._getThinkingLevelForModelSwitch(nextModel);
2635
2707
  this.agent.state.model = nextModel;
@@ -3815,6 +3887,12 @@ export class AgentSession {
3815
3887
  });
3816
3888
  }
3817
3889
  async reload(options) {
3890
+ if (this.isStreaming) {
3891
+ throw new Error("Wait for the current response to finish before reloading.");
3892
+ }
3893
+ if (this.isCompacting) {
3894
+ throw new Error("Wait for compaction to finish before reloading.");
3895
+ }
3818
3896
  const oldRunner = this._extensionRunner;
3819
3897
  const previousFlagValues = oldRunner.getFlagValues();
3820
3898
  await emitSessionShutdownEvent(oldRunner, { type: "session_shutdown", reason: "reload" });
@@ -4111,7 +4189,7 @@ export class AgentSession {
4111
4189
  * @returns Result with editorText (if user message) and cancelled status
4112
4190
  */
4113
4191
  async navigateTree(targetId, options = {}) {
4114
- if (this.isStreaming) {
4192
+ if (this.isStreaming || this._promptPreflightCount > 0) {
4115
4193
  throw new Error("Wait for the current response to finish before navigating the session tree.");
4116
4194
  }
4117
4195
  if (this.isCompacting) {
@@ -4147,7 +4225,8 @@ export class AgentSession {
4147
4225
  label,
4148
4226
  };
4149
4227
  // Set up abort controller for summarization
4150
- this._branchSummaryAbortController = new AbortController();
4228
+ const abortController = new AbortController();
4229
+ this._branchSummaryAbortController = abortController;
4151
4230
  let resolveBranchSummaryCompletion;
4152
4231
  const branchSummaryCompletion = new Promise((resolve) => {
4153
4232
  resolveBranchSummaryCompletion = resolve;
@@ -4162,7 +4241,7 @@ export class AgentSession {
4162
4241
  const result = (await this._extensionRunner.emit({
4163
4242
  type: "session_before_tree",
4164
4243
  preparation,
4165
- signal: this._branchSummaryAbortController.signal,
4244
+ signal: abortController.signal,
4166
4245
  }));
4167
4246
  if (result?.cancel) {
4168
4247
  return { cancelled: true };
@@ -4187,7 +4266,7 @@ export class AgentSession {
4187
4266
  let summaryDetails;
4188
4267
  let summaryUsage;
4189
4268
  if (options.summarize && entriesToSummarize.length > 0 && !extensionSummary) {
4190
- const signal = this._branchSummaryAbortController.signal;
4269
+ const signal = abortController.signal;
4191
4270
  const branchSummarySettings = this.settingsManager.getBranchSummarySettings();
4192
4271
  const result = await generateBranchSummary(entriesToSummarize, {
4193
4272
  ...(await this._getSummarizationRequestAuth(this.model, signal, this.agent.streamFunction)),
@@ -4262,7 +4341,8 @@ export class AgentSession {
4262
4341
  this._refreshFinalizedContext();
4263
4342
  this._restoreToolsFromTranscript();
4264
4343
  this._emit({ type: "session_tree_changed" });
4265
- // Emit session_tree event
4344
+ // The selected context is installed; session_tree handlers may now prompt or navigate again.
4345
+ this._branchSummaryAbortController = undefined;
4266
4346
  await this._extensionRunner.emit({
4267
4347
  type: "session_tree",
4268
4348
  newLeafId: this.sessionManager.getLeafId(),
@@ -4274,7 +4354,10 @@ export class AgentSession {
4274
4354
  return { editorText, cancelled: false, summaryEntry };
4275
4355
  }
4276
4356
  finally {
4277
- this._branchSummaryAbortController = undefined;
4357
+ // A navigation started from session_tree owns the controller now; do not clear it.
4358
+ if (this._branchSummaryAbortController === abortController) {
4359
+ this._branchSummaryAbortController = undefined;
4360
+ }
4278
4361
  if (this._branchSummaryCompletionPromise === branchSummaryCompletion) {
4279
4362
  this._branchSummaryCompletionPromise = undefined;
4280
4363
  }