@bastani/atomic 0.9.70 → 0.9.71

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 (381) hide show
  1. package/CHANGELOG.md +130 -0
  2. package/dist/builtin/intercom/package.json +2 -2
  3. package/dist/builtin/mcp/CHANGELOG.md +16 -0
  4. package/dist/builtin/mcp/package.json +1 -1
  5. package/dist/builtin/subagents/CHANGELOG.md +12 -0
  6. package/dist/builtin/subagents/package.json +3 -3
  7. package/dist/builtin/subagents/src/extension/index.bundle.mjs +8 -5
  8. package/dist/builtin/web-access/index.bundle.mjs +14750 -6455
  9. package/dist/builtin/web-access/package.json +3 -3
  10. package/dist/builtin/workflows/CHANGELOG.md +20 -0
  11. package/dist/builtin/workflows/package.json +2 -2
  12. package/dist/builtin/workflows/src/extension/index.bundle.mjs +27 -10
  13. package/dist/builtin/workflows/src/extension/local-worker-entry.mjs +19 -5
  14. package/dist/builtin/workflows/src/index.js +19 -5
  15. package/dist/builtin/workflows/src/local-worker-entry.mjs +19 -5
  16. package/dist/cli/list-models.d.ts +7 -2
  17. package/dist/cli/list-models.d.ts.map +1 -1
  18. package/dist/cli/list-models.js +22 -50
  19. package/dist/cli/list-models.js.map +1 -1
  20. package/dist/core/agent-session-events.d.ts.map +1 -1
  21. package/dist/core/agent-session-events.js +2 -0
  22. package/dist/core/agent-session-events.js.map +1 -1
  23. package/dist/core/agent-session-message-queue.d.ts +9 -8
  24. package/dist/core/agent-session-message-queue.d.ts.map +1 -1
  25. package/dist/core/agent-session-message-queue.js +24 -7
  26. package/dist/core/agent-session-message-queue.js.map +1 -1
  27. package/dist/core/agent-session-methods.d.ts +4 -7
  28. package/dist/core/agent-session-methods.d.ts.map +1 -1
  29. package/dist/core/agent-session-methods.js.map +1 -1
  30. package/dist/core/agent-session-models.d.ts.map +1 -1
  31. package/dist/core/agent-session-models.js +6 -10
  32. package/dist/core/agent-session-models.js.map +1 -1
  33. package/dist/core/agent-session-prompt.d.ts.map +1 -1
  34. package/dist/core/agent-session-prompt.js +9 -8
  35. package/dist/core/agent-session-prompt.js.map +1 -1
  36. package/dist/core/agent-session-retry.d.ts.map +1 -1
  37. package/dist/core/agent-session-retry.js +5 -0
  38. package/dist/core/agent-session-retry.js.map +1 -1
  39. package/dist/core/agent-session-transfer.d.ts.map +1 -1
  40. package/dist/core/agent-session-transfer.js +2 -0
  41. package/dist/core/agent-session-transfer.js.map +1 -1
  42. package/dist/core/agent-session-typed-queue.d.ts +19 -0
  43. package/dist/core/agent-session-typed-queue.d.ts.map +1 -0
  44. package/dist/core/agent-session-typed-queue.js +34 -0
  45. package/dist/core/agent-session-typed-queue.js.map +1 -0
  46. package/dist/core/agent-session-types.d.ts +20 -0
  47. package/dist/core/agent-session-types.d.ts.map +1 -1
  48. package/dist/core/agent-session-types.js.map +1 -1
  49. package/dist/core/agent-session.d.ts +1 -1
  50. package/dist/core/agent-session.d.ts.map +1 -1
  51. package/dist/core/agent-session.js.map +1 -1
  52. package/dist/core/cache-warmer.d.ts.map +1 -1
  53. package/dist/core/cache-warmer.js +2 -0
  54. package/dist/core/cache-warmer.js.map +1 -1
  55. package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
  56. package/dist/core/compaction/branch-summarization.js +13 -2
  57. package/dist/core/compaction/branch-summarization.js.map +1 -1
  58. package/dist/core/extensions/api-types.d.ts +6 -3
  59. package/dist/core/extensions/api-types.d.ts.map +1 -1
  60. package/dist/core/extensions/api-types.js.map +1 -1
  61. package/dist/core/extensions/index.d.ts +1 -1
  62. package/dist/core/extensions/index.d.ts.map +1 -1
  63. package/dist/core/extensions/index.js.map +1 -1
  64. package/dist/core/extensions/loader-api.d.ts.map +1 -1
  65. package/dist/core/extensions/loader-api.js +6 -2
  66. package/dist/core/extensions/loader-api.js.map +1 -1
  67. package/dist/core/extensions/loader-virtual-modules.d.ts.map +1 -1
  68. package/dist/core/extensions/loader-virtual-modules.js +2 -0
  69. package/dist/core/extensions/loader-virtual-modules.js.map +1 -1
  70. package/dist/core/extensions/message-types.d.ts +18 -1
  71. package/dist/core/extensions/message-types.d.ts.map +1 -1
  72. package/dist/core/extensions/message-types.js.map +1 -1
  73. package/dist/core/extensions/runner-registries.d.ts.map +1 -1
  74. package/dist/core/extensions/runner-registries.js +8 -1
  75. package/dist/core/extensions/runner-registries.js.map +1 -1
  76. package/dist/core/extensions/runner.d.ts +1 -0
  77. package/dist/core/extensions/runner.d.ts.map +1 -1
  78. package/dist/core/extensions/runner.js +1 -0
  79. package/dist/core/extensions/runner.js.map +1 -1
  80. package/dist/core/extensions/runtime-types.d.ts +2 -2
  81. package/dist/core/extensions/runtime-types.d.ts.map +1 -1
  82. package/dist/core/extensions/runtime-types.js.map +1 -1
  83. package/dist/core/fast-model-variants.d.ts +0 -9
  84. package/dist/core/fast-model-variants.d.ts.map +1 -1
  85. package/dist/core/fast-model-variants.js +0 -14
  86. package/dist/core/fast-model-variants.js.map +1 -1
  87. package/dist/core/model-config.d.ts +14 -0
  88. package/dist/core/model-config.d.ts.map +1 -1
  89. package/dist/core/model-label.d.ts +38 -0
  90. package/dist/core/model-label.d.ts.map +1 -0
  91. package/dist/core/model-label.js +46 -0
  92. package/dist/core/model-label.js.map +1 -0
  93. package/dist/core/model-resolver-initial.d.ts +5 -0
  94. package/dist/core/model-resolver-initial.d.ts.map +1 -1
  95. package/dist/core/model-resolver-initial.js +26 -1
  96. package/dist/core/model-resolver-initial.js.map +1 -1
  97. package/dist/core/model-resolver.d.ts +1 -1
  98. package/dist/core/model-resolver.d.ts.map +1 -1
  99. package/dist/core/model-resolver.js +1 -1
  100. package/dist/core/model-resolver.js.map +1 -1
  101. package/dist/core/model-runtime.d.ts +5 -7
  102. package/dist/core/model-runtime.d.ts.map +1 -1
  103. package/dist/core/model-runtime.js +14 -19
  104. package/dist/core/model-runtime.js.map +1 -1
  105. package/dist/core/model-switch-thinking-level.d.ts +23 -0
  106. package/dist/core/model-switch-thinking-level.d.ts.map +1 -0
  107. package/dist/core/model-switch-thinking-level.js +19 -0
  108. package/dist/core/model-switch-thinking-level.js.map +1 -0
  109. package/dist/core/package-manager-git.d.ts +2 -0
  110. package/dist/core/package-manager-git.d.ts.map +1 -1
  111. package/dist/core/package-manager-git.js +32 -4
  112. package/dist/core/package-manager-git.js.map +1 -1
  113. package/dist/core/package-manager-operations.d.ts.map +1 -1
  114. package/dist/core/package-manager-operations.js +37 -5
  115. package/dist/core/package-manager-operations.js.map +1 -1
  116. package/dist/core/package-manager-types.d.ts +7 -1
  117. package/dist/core/package-manager-types.d.ts.map +1 -1
  118. package/dist/core/package-manager-types.js.map +1 -1
  119. package/dist/core/remote-catalog-provider.d.ts +14 -0
  120. package/dist/core/remote-catalog-provider.d.ts.map +1 -1
  121. package/dist/core/remote-catalog-provider.js +73 -0
  122. package/dist/core/remote-catalog-provider.js.map +1 -1
  123. package/dist/core/sdk.d.ts.map +1 -1
  124. package/dist/core/sdk.js +11 -4
  125. package/dist/core/sdk.js.map +1 -1
  126. package/dist/core/skills.js +1 -1
  127. package/dist/core/skills.js.map +1 -1
  128. package/dist/core/storage/index.d.ts +1 -0
  129. package/dist/core/storage/index.d.ts.map +1 -1
  130. package/dist/core/storage/index.js +1 -0
  131. package/dist/core/storage/index.js.map +1 -1
  132. package/dist/core/storage/node-sqlite.d.ts.map +1 -1
  133. package/dist/core/storage/node-sqlite.js +13 -8
  134. package/dist/core/storage/node-sqlite.js.map +1 -1
  135. package/dist/core/storage/write-ahead-log.d.ts +25 -0
  136. package/dist/core/storage/write-ahead-log.d.ts.map +1 -0
  137. package/dist/core/storage/write-ahead-log.js +78 -0
  138. package/dist/core/storage/write-ahead-log.js.map +1 -0
  139. package/dist/core/system-prompt.d.ts.map +1 -1
  140. package/dist/core/system-prompt.js +3 -4
  141. package/dist/core/system-prompt.js.map +1 -1
  142. package/dist/core/tasks/completion.d.ts +3 -2
  143. package/dist/core/tasks/completion.d.ts.map +1 -1
  144. package/dist/core/tasks/completion.js +7 -2
  145. package/dist/core/tasks/completion.js.map +1 -1
  146. package/dist/core/tasks/heartbeat-notice.d.ts +2 -0
  147. package/dist/core/tasks/heartbeat-notice.d.ts.map +1 -1
  148. package/dist/core/tasks/heartbeat-notice.js +8 -4
  149. package/dist/core/tasks/heartbeat-notice.js.map +1 -1
  150. package/dist/core/tasks/heartbeat.d.ts.map +1 -1
  151. package/dist/core/tasks/heartbeat.js +1 -0
  152. package/dist/core/tasks/heartbeat.js.map +1 -1
  153. package/dist/core/tools/tool-definition-wrapper.d.ts +4 -4
  154. package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
  155. package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
  156. package/dist/core/tools/write.d.ts.map +1 -1
  157. package/dist/core/tools/write.js +13 -16
  158. package/dist/core/tools/write.js.map +1 -1
  159. package/dist/extensions/codemode/renderer.d.ts.map +1 -1
  160. package/dist/extensions/codemode/renderer.js +6 -2
  161. package/dist/extensions/codemode/renderer.js.map +1 -1
  162. package/dist/extensions/llama/huggingface-ui.d.ts +1 -0
  163. package/dist/extensions/llama/huggingface-ui.d.ts.map +1 -1
  164. package/dist/extensions/llama/huggingface-ui.js +13 -4
  165. package/dist/extensions/llama/huggingface-ui.js.map +1 -1
  166. package/dist/extensions/llama/ui.d.ts.map +1 -1
  167. package/dist/extensions/llama/ui.js +3 -0
  168. package/dist/extensions/llama/ui.js.map +1 -1
  169. package/dist/extensions/mcp/client/transports/stdio.d.ts.map +1 -1
  170. package/dist/extensions/mcp/client/transports/stdio.js +13 -2
  171. package/dist/extensions/mcp/client/transports/stdio.js.map +1 -1
  172. package/dist/extensions/mcp/client/transports/streamable-http.d.ts.map +1 -1
  173. package/dist/extensions/mcp/client/transports/streamable-http.js +41 -3
  174. package/dist/extensions/mcp/client/transports/streamable-http.js.map +1 -1
  175. package/dist/extensions/mcp/ui.d.ts +1 -0
  176. package/dist/extensions/mcp/ui.d.ts.map +1 -1
  177. package/dist/extensions/mcp/ui.js +33 -24
  178. package/dist/extensions/mcp/ui.js.map +1 -1
  179. package/dist/index-extensions.d.ts +1 -1
  180. package/dist/index-extensions.d.ts.map +1 -1
  181. package/dist/index-extensions.js.map +1 -1
  182. package/dist/index.d.ts +1 -0
  183. package/dist/index.d.ts.map +1 -1
  184. package/dist/index.js +1 -0
  185. package/dist/index.js.map +1 -1
  186. package/dist/main-deferred-startup.d.ts +23 -1
  187. package/dist/main-deferred-startup.d.ts.map +1 -1
  188. package/dist/main-deferred-startup.js +28 -0
  189. package/dist/main-deferred-startup.js.map +1 -1
  190. package/dist/main.d.ts.map +1 -1
  191. package/dist/main.js +8 -14
  192. package/dist/main.js.map +1 -1
  193. package/dist/modes/interactive/components/assistant-message.d.ts +1 -3
  194. package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
  195. package/dist/modes/interactive/components/assistant-message.js +17 -9
  196. package/dist/modes/interactive/components/assistant-message.js.map +1 -1
  197. package/dist/modes/interactive/components/branch-summary-message.d.ts +5 -1
  198. package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
  199. package/dist/modes/interactive/components/branch-summary-message.js +15 -3
  200. package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
  201. package/dist/modes/interactive/components/chat-message-renderer.d.ts +4 -0
  202. package/dist/modes/interactive/components/chat-message-renderer.d.ts.map +1 -1
  203. package/dist/modes/interactive/components/chat-message-renderer.js +23 -7
  204. package/dist/modes/interactive/components/chat-message-renderer.js.map +1 -1
  205. package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
  206. package/dist/modes/interactive/components/custom-editor.js +7 -0
  207. package/dist/modes/interactive/components/custom-editor.js.map +1 -1
  208. package/dist/modes/interactive/components/custom-message.d.ts +5 -2
  209. package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
  210. package/dist/modes/interactive/components/custom-message.js +12 -2
  211. package/dist/modes/interactive/components/custom-message.js.map +1 -1
  212. package/dist/modes/interactive/components/footer.d.ts.map +1 -1
  213. package/dist/modes/interactive/components/footer.js +7 -9
  214. package/dist/modes/interactive/components/footer.js.map +1 -1
  215. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  216. package/dist/modes/interactive/components/login-dialog.js +1 -2
  217. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  218. package/dist/modes/interactive/components/markdown-transform.d.ts +2 -1
  219. package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -1
  220. package/dist/modes/interactive/components/markdown-transform.js +2 -1
  221. package/dist/modes/interactive/components/markdown-transform.js.map +1 -1
  222. package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
  223. package/dist/modes/interactive/components/mermaid.js +2 -1
  224. package/dist/modes/interactive/components/mermaid.js.map +1 -1
  225. package/dist/modes/interactive/components/model-selector.d.ts +9 -1
  226. package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
  227. package/dist/modes/interactive/components/model-selector.js +46 -16
  228. package/dist/modes/interactive/components/model-selector.js.map +1 -1
  229. package/dist/modes/interactive/components/oauth-selector.d.ts +1 -0
  230. package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
  231. package/dist/modes/interactive/components/oauth-selector.js +13 -4
  232. package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
  233. package/dist/modes/interactive/components/scoped-models-selector.d.ts +4 -0
  234. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  235. package/dist/modes/interactive/components/scoped-models-selector.js +32 -11
  236. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  237. package/dist/modes/interactive/components/session-selector.d.ts +1 -0
  238. package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
  239. package/dist/modes/interactive/components/session-selector.js +3 -0
  240. package/dist/modes/interactive/components/session-selector.js.map +1 -1
  241. package/dist/modes/interactive/components/settings-selector-items.d.ts.map +1 -1
  242. package/dist/modes/interactive/components/settings-selector-items.js +6 -5
  243. package/dist/modes/interactive/components/settings-selector-items.js.map +1 -1
  244. package/dist/modes/interactive/components/settings-selector-submenus.d.ts.map +1 -1
  245. package/dist/modes/interactive/components/settings-selector-submenus.js +2 -0
  246. package/dist/modes/interactive/components/settings-selector-submenus.js.map +1 -1
  247. package/dist/modes/interactive/components/skill-invocation-message.d.ts +5 -1
  248. package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
  249. package/dist/modes/interactive/components/skill-invocation-message.js +15 -3
  250. package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
  251. package/dist/modes/interactive/components/task-row.d.ts +1 -0
  252. package/dist/modes/interactive/components/task-row.d.ts.map +1 -1
  253. package/dist/modes/interactive/components/task-row.js +3 -1
  254. package/dist/modes/interactive/components/task-row.js.map +1 -1
  255. package/dist/modes/interactive/components/tree-selector-component.d.ts +1 -0
  256. package/dist/modes/interactive/components/tree-selector-component.d.ts.map +1 -1
  257. package/dist/modes/interactive/components/tree-selector-component.js +3 -0
  258. package/dist/modes/interactive/components/tree-selector-component.js.map +1 -1
  259. package/dist/modes/interactive/components/tree-selector-content.d.ts.map +1 -1
  260. package/dist/modes/interactive/components/tree-selector-content.js +2 -1
  261. package/dist/modes/interactive/components/tree-selector-content.js.map +1 -1
  262. package/dist/modes/interactive/components/user-message-selector.d.ts +1 -0
  263. package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
  264. package/dist/modes/interactive/components/user-message-selector.js +9 -1
  265. package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
  266. package/dist/modes/interactive/components/user-message.js +1 -1
  267. package/dist/modes/interactive/components/user-message.js.map +1 -1
  268. package/dist/modes/interactive/interactive-agent-events.js +3 -4
  269. package/dist/modes/interactive/interactive-agent-events.js.map +1 -1
  270. package/dist/modes/interactive/interactive-autocomplete.js +6 -4
  271. package/dist/modes/interactive/interactive-autocomplete.js.map +1 -1
  272. package/dist/modes/interactive/interactive-editor-actions.js +2 -2
  273. package/dist/modes/interactive/interactive-editor-actions.js.map +1 -1
  274. package/dist/modes/interactive/interactive-extension-context.js +1 -1
  275. package/dist/modes/interactive/interactive-extension-context.js.map +1 -1
  276. package/dist/modes/interactive/interactive-input-handling.js +11 -1
  277. package/dist/modes/interactive/interactive-input-handling.js.map +1 -1
  278. package/dist/modes/interactive/interactive-mode-base.d.ts +11 -2
  279. package/dist/modes/interactive/interactive-mode-base.d.ts.map +1 -1
  280. package/dist/modes/interactive/interactive-mode-base.js +11 -2
  281. package/dist/modes/interactive/interactive-mode-base.js.map +1 -1
  282. package/dist/modes/interactive/interactive-mode-surface.d.ts +4 -1
  283. package/dist/modes/interactive/interactive-mode-surface.d.ts.map +1 -1
  284. package/dist/modes/interactive/interactive-mode-surface.js.map +1 -1
  285. package/dist/modes/interactive/interactive-model-routing.d.ts.map +1 -1
  286. package/dist/modes/interactive/interactive-model-routing.js +18 -4
  287. package/dist/modes/interactive/interactive-model-routing.js.map +1 -1
  288. package/dist/modes/interactive/interactive-prompt-turn.js +5 -1
  289. package/dist/modes/interactive/interactive-prompt-turn.js.map +1 -1
  290. package/dist/modes/interactive/interactive-queueing.d.ts.map +1 -1
  291. package/dist/modes/interactive/interactive-queueing.js +17 -6
  292. package/dist/modes/interactive/interactive-queueing.js.map +1 -1
  293. package/dist/modes/interactive/interactive-render-chat.js +51 -5
  294. package/dist/modes/interactive/interactive-render-chat.js.map +1 -1
  295. package/dist/modes/interactive/interactive-slash-commands.js +2 -2
  296. package/dist/modes/interactive/interactive-slash-commands.js.map +1 -1
  297. package/dist/modes/interactive/interactive-startup.d.ts.map +1 -1
  298. package/dist/modes/interactive/interactive-startup.js +9 -12
  299. package/dist/modes/interactive/interactive-startup.js.map +1 -1
  300. package/dist/modes/interactive/interactive-tui.d.ts.map +1 -1
  301. package/dist/modes/interactive/interactive-tui.js +6 -5
  302. package/dist/modes/interactive/interactive-tui.js.map +1 -1
  303. package/dist/modes/interactive/theme/global-theme.d.ts +1 -0
  304. package/dist/modes/interactive/theme/global-theme.d.ts.map +1 -1
  305. package/dist/modes/interactive/theme/global-theme.js +3 -0
  306. package/dist/modes/interactive/theme/global-theme.js.map +1 -1
  307. package/dist/modes/interactive/theme/theme.d.ts +1 -1
  308. package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
  309. package/dist/modes/interactive/theme/theme.js +1 -1
  310. package/dist/modes/interactive/theme/theme.js.map +1 -1
  311. package/dist/modes/interactive/theme/tui-theme.d.ts +5 -0
  312. package/dist/modes/interactive/theme/tui-theme.d.ts.map +1 -1
  313. package/dist/modes/interactive/theme/tui-theme.js +21 -2
  314. package/dist/modes/interactive/theme/tui-theme.js.map +1 -1
  315. package/dist/modes/interactive-engine/extension-ui-bridge.d.ts +2 -5
  316. package/dist/modes/interactive-engine/extension-ui-bridge.d.ts.map +1 -1
  317. package/dist/modes/interactive-engine/extension-ui-bridge.js.map +1 -1
  318. package/dist/modes/interactive-engine/isolated-runtime.d.ts +2 -6
  319. package/dist/modes/interactive-engine/isolated-runtime.d.ts.map +1 -1
  320. package/dist/modes/interactive-engine/isolated-runtime.js.map +1 -1
  321. package/dist/modes/print-mode.d.ts.map +1 -1
  322. package/dist/modes/print-mode.js +39 -14
  323. package/dist/modes/print-mode.js.map +1 -1
  324. package/dist/modes/rpc/rpc-client-api.d.ts +2 -5
  325. package/dist/modes/rpc/rpc-client-api.d.ts.map +1 -1
  326. package/dist/modes/rpc/rpc-client-api.js.map +1 -1
  327. package/dist/modes/rpc/rpc-command-handler.d.ts +2 -1
  328. package/dist/modes/rpc/rpc-command-handler.d.ts.map +1 -1
  329. package/dist/modes/rpc/rpc-command-handler.js +11 -4
  330. package/dist/modes/rpc/rpc-command-handler.js.map +1 -1
  331. package/dist/modes/rpc/rpc-input.d.ts +3 -2
  332. package/dist/modes/rpc/rpc-input.d.ts.map +1 -1
  333. package/dist/modes/rpc/rpc-input.js +5 -1
  334. package/dist/modes/rpc/rpc-input.js.map +1 -1
  335. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  336. package/dist/modes/rpc/rpc-mode.js +45 -16
  337. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  338. package/dist/modes/rpc/rpc-session-binding.d.ts +3 -1
  339. package/dist/modes/rpc/rpc-session-binding.d.ts.map +1 -1
  340. package/dist/modes/rpc/rpc-session-binding.js +5 -1
  341. package/dist/modes/rpc/rpc-session-binding.js.map +1 -1
  342. package/dist/modes/rpc/rpc-types.d.ts +2 -5
  343. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  344. package/dist/modes/rpc/rpc-types.js.map +1 -1
  345. package/dist/package-manager-cli.d.ts.map +1 -1
  346. package/dist/package-manager-cli.js +26 -4
  347. package/dist/package-manager-cli.js.map +1 -1
  348. package/dist/utils/ansi.d.ts +0 -2
  349. package/dist/utils/ansi.d.ts.map +1 -1
  350. package/dist/utils/ansi.js +0 -5
  351. package/dist/utils/ansi.js.map +1 -1
  352. package/dist/utils/syntax-highlight.d.ts +5 -0
  353. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  354. package/dist/utils/syntax-highlight.js +7 -0
  355. package/dist/utils/syntax-highlight.js.map +1 -1
  356. package/docs/extensions/api-reference.md +21 -7
  357. package/docs/extensions/events.md +2 -0
  358. package/docs/extensions/examples.md +0 -1
  359. package/docs/extensions.md +7 -0
  360. package/docs/keybindings.md +1 -1
  361. package/docs/models/reference.md +8 -6
  362. package/docs/models-configuration.md +1 -0
  363. package/docs/models.md +2 -0
  364. package/docs/packages.md +2 -0
  365. package/docs/providers.md +14 -5
  366. package/docs/rpc/protocol.md +8 -2
  367. package/docs/rpc.md +4 -0
  368. package/docs/sdk.md +2 -0
  369. package/docs/storage.md +2 -0
  370. package/docs/tmux.md +6 -0
  371. package/docs/tui/reference.md +2 -0
  372. package/docs/windows.md +26 -0
  373. package/examples/extensions/README.md +2 -1
  374. package/examples/extensions/preset.ts +2 -0
  375. package/examples/extensions/tools.ts +2 -0
  376. package/npm-shrinkwrap.json +90 -72
  377. package/package.json +14 -15
  378. package/schemas/models.schema.json +4 -0
  379. package/examples/extensions/sandbox/index.ts +0 -323
  380. package/examples/extensions/sandbox/package-lock.json +0 -92
  381. package/examples/extensions/sandbox/package.json +0 -19
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-model-routing.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-model-routing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAEN,4BAA4B,EAE5B,sBAAsB,EACtB,2BAA2B,EAC3B,6BAA6B,EAC7B,yBAAyB,EACzB,4BAA4B,GAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,mCAAmC,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AACpH,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,MAAM,UAAU,8BAA8B,CAC7C,UAAqC,EACrC,eAAyC,EACzC,KAA6B;IAE7B,IAAI,UAAU,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC/C,IAAI,eAAe,CAAC,QAAQ,CAAC,UAAU,CAAC;QAAE,OAAO,UAAU,CAAC;IAC5D,IAAI,CAAC,KAAK;QAAE,OAAO,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAChF,MAAM,OAAO,GAAG,kBAAkB,CAAC,KAAK,EAAE,UAAU,CAAkB,CAAC;IACvE,IAAI,eAAe,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IACtD,OAAO,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;AACrE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,6BAA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AAC,oBAAoB,GAAG;IACpD,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE,EAAE;QAC1B,MAAM,MAAM,GAAG,KAAK,EAAE,KAAoB,EAAE,EAAE;YAC7C,IAAI,CAAC;gBACJ,MAAM,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;gBACtC,IAAI,EAAE,CAAC;YACR,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,CAAC,SAAS,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACxE,CAAC;QACF,CAAC,CAAC;QACF,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QACjC,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,0BAA0B,EAAE,CAAC;QAClE,MAAM,UAAU,GAAG,6BAA6B,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QACzG,MAAM,QAAQ,GAAG,IAAI,yBAAyB,CAC7C,IAAI,CAAC,OAAO,CAAC,aAAa,EAC1B,eAAe,EACf,MAAM,EACN,GAAG,EAAE,CAAC,IAAI,EAAE,EACZ,8BAA8B,CAAC,UAAU,EAAE,eAAe,EAAE,KAAK,CAAC,CAClE,CAAC;QACF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IACjD,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { clampThinkingLevel } from \"@bastani/pi-ai/compat\";\nimport type { ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport { boundedInteractiveModelRefresh } from \"../../core/bounded-model-refresh.ts\";\nimport { isOfflineModeEnabled } from \"../../core/package-manager-env.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\ttype Api,\n\tfindExactModelReferenceMatch,\n\ttype Model,\n\tModelSelectorComponent,\n\tresolveModelScopeFromModels,\n\tScopedModelsSelectorComponent,\n\tThinkingSelectorComponent,\n\tUserMessageSelectorComponent,\n} from \"./interactive-mode-deps.ts\";\nimport { ANTHROPIC_SUBSCRIPTION_AUTH_WARNING, isAnthropicSubscriptionAuthKey } from \"./interactive-mode-helpers.ts\";\nimport { refreshModelCatalogs } from \"./model-catalog-refresh.ts\";\n\nexport function resolveThinkingSelectorDefault(\n\trawDefault: ThinkingLevel | undefined,\n\tavailableLevels: readonly ThinkingLevel[],\n\tmodel: Model<Api> | undefined,\n): ThinkingLevel | undefined {\n\tif (rawDefault === undefined) return undefined;\n\tif (availableLevels.includes(rawDefault)) return rawDefault;\n\tif (!model) return availableLevels.includes(\"off\") ? \"off\" : availableLevels[0];\n\tconst clamped = clampThinkingLevel(model, rawDefault) as ThinkingLevel;\n\tif (availableLevels.includes(clamped)) return clamped;\n\treturn availableLevels.includes(\"off\") ? \"off\" : availableLevels[0];\n}\n\n/**\n * The saved level the active session would start from, in the precedence\n * `findInitialModel` uses: a scoped `--models \"id:level\"` entry wins over a\n * persisted per-model override, which wins over the global default. Matching\n * it keeps the selector badge from advertising a level the session never used.\n */\nexport function resolveSessionThinkingDefault(\n\tmodel: Model<Api> | undefined,\n\tscopedModels: ReadonlyArray<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>,\n\tsettings: {\n\t\tgetModelThinkingLevel(provider: string, modelId: string): ThinkingLevel | undefined;\n\t\tgetDefaultThinkingLevel(): ThinkingLevel | undefined;\n\t},\n): ThinkingLevel | undefined {\n\tif (model === undefined) return settings.getDefaultThinkingLevel();\n\tconst scopedLevel = scopedModels.find(\n\t\t(scoped) => scoped.model.provider === model.provider && scoped.model.id === model.id,\n\t)?.thinkingLevel;\n\treturn scopedLevel ?? settings.getModelThinkingLevel(model.provider, model.id) ?? settings.getDefaultThinkingLevel();\n}\n\nInteractiveModeBase.prototype.handleModelCommand = async function (\n\tthis: InteractiveModeBase,\n\tsearchTerm?: string,\n): Promise<void> {\n\tif (!searchTerm) {\n\t\tthis.showModelSelector();\n\t\treturn;\n\t}\n\n\tconst model = await this.findExactModelMatch(searchTerm);\n\tif (model) {\n\t\ttry {\n\t\t\tawait this.session.setModel(model, { persist: true });\n\t\t\tthis.footer.invalidate();\n\t\t\tthis.updateEditorBorderColor();\n\t\t\tthis.showStatus(`Model: ${model.id}`);\n\t\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth(model);\n\t\t} catch (error) {\n\t\t\tthis.showError(error instanceof Error ? error.message : String(error));\n\t\t}\n\t\treturn;\n\t}\n\n\tthis.showModelSelector(searchTerm);\n};\n\nInteractiveModeBase.prototype.findExactModelMatch = async function (\n\tthis: InteractiveModeBase,\n\tsearchTerm: string,\n): Promise<Model<Api> | undefined> {\n\tif (this.session.scopedModels.length > 0) {\n\t\treturn findExactModelReferenceMatch(\n\t\t\tsearchTerm,\n\t\t\tthis.session.scopedModels.map((scoped) => scoped.model),\n\t\t);\n\t}\n\n\ttry {\n\t\tconst cachedMatch = findExactModelReferenceMatch(searchTerm, [\n\t\t\t...this.session.modelRuntime.getAvailableSnapshot(),\n\t\t]);\n\t\tif (cachedMatch) return cachedMatch;\n\t} catch {\n\t\t// A refresh below retries the snapshot read and safely falls back to no match.\n\t}\n\n\tconst models = await this.getModelCandidates();\n\treturn findExactModelReferenceMatch(searchTerm, models);\n};\n\nInteractiveModeBase.prototype.getModelCandidates = async function (this: InteractiveModeBase): Promise<Model<Api>[]> {\n\tif (this.session.scopedModels.length > 0) {\n\t\treturn this.session.scopedModels.map((scoped) => scoped.model);\n\t}\n\n\tconst allowNetwork = !isOfflineModeEnabled();\n\tawait boundedInteractiveModelRefresh(\n\t\t(refreshOptions) => refreshModelCatalogs(this.session.modelRuntime, refreshOptions),\n\t\t{ allowNetwork },\n\t);\n\ttry {\n\t\treturn [...this.session.modelRuntime.getAvailableSnapshot()];\n\t} catch {\n\t\treturn [];\n\t}\n};\n\nInteractiveModeBase.prototype.updateAvailableProviderCount = async function (this: InteractiveModeBase): Promise<void> {\n\tconst models =\n\t\tthis.session.scopedModels.length > 0\n\t\t\t? this.session.scopedModels.map((scoped) => scoped.model)\n\t\t\t: this.session.modelRuntime.getAvailableSnapshot();\n\tthis.footerDataProvider.setAvailableProviderCount(new Set(models.map((model) => model.provider)).size);\n};\n\nInteractiveModeBase.prototype.maybeWarnAboutAnthropicSubscriptionAuth = async function (\n\tthis: InteractiveModeBase,\n\tmodel: Model<Api> | undefined = this.session.model,\n\ttargetContainer = this.chatContainer,\n): Promise<void> {\n\tif (this.settingsManager.getWarnings().anthropicExtraUsage === false) {\n\t\treturn;\n\t}\n\tif (this.anthropicSubscriptionWarningShown) {\n\t\treturn;\n\t}\n\tif (model?.provider !== \"anthropic\") {\n\t\treturn;\n\t}\n\n\tif (this.session.modelRuntime.isUsingOAuth(\"anthropic\")) {\n\t\tthis.anthropicSubscriptionWarningShown = true;\n\t\tthis.showWarning(ANTHROPIC_SUBSCRIPTION_AUTH_WARNING, targetContainer);\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst storedCredential = await this.session.modelRuntime.getAuth(\"anthropic\");\n\t\tconst apiKey = storedCredential?.auth.apiKey;\n\t\tif (!isAnthropicSubscriptionAuthKey(apiKey)) {\n\t\t\treturn;\n\t\t}\n\t\tthis.anthropicSubscriptionWarningShown = true;\n\t\tthis.showWarning(ANTHROPIC_SUBSCRIPTION_AUTH_WARNING, targetContainer);\n\t} catch {\n\t\t// Ignore auth lookup failures for warning-only checks.\n\t}\n};\n\nInteractiveModeBase.prototype.showModelSelector = function (\n\tthis: InteractiveModeBase,\n\tinitialSearchInput?: string,\n): void {\n\tthis.showSelector((done) => {\n\t\tconst selector = new ModelSelectorComponent(\n\t\t\tthis.ui,\n\t\t\tthis.session.model,\n\t\t\tthis.settingsManager,\n\t\t\tthis.session.modelRuntime,\n\t\t\tthis.session.scopedModels,\n\t\t\tasync (model) => {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.session.setModel(model, { persist: true });\n\t\t\t\t\tawait this.updateAvailableProviderCount();\n\t\t\t\t\tthis.footer.invalidate();\n\t\t\t\t\tthis.updateEditorBorderColor();\n\t\t\t\t\tdone();\n\t\t\t\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth(model);\n\t\t\t\t\tthis.showStatus(`Model: ${model.id}`);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tdone();\n\t\t\t\t\tthis.showError(error instanceof Error ? error.message : String(error));\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t},\n\t\t\tinitialSearchInput,\n\t\t);\n\t\treturn { component: selector, focus: selector, dispose: () => selector.dispose() };\n\t});\n};\n\nInteractiveModeBase.prototype.showModelsSelector = function (this: InteractiveModeBase): void {\n\tlet availableModels = [...this.session.modelRuntime.getAvailableSnapshot()];\n\tlet availableModelIds = new Set(availableModels.map((model) => `${model.provider}/${model.id}`));\n\tconst sessionScopedModels = this.session.scopedModels;\n\tconst sessionScopedIds = sessionScopedModels.map((scoped) => `${scoped.model.provider}/${scoped.model.id}`);\n\tconst getConfiguredScope = (\n\t\tmodels: readonly Model<Api>[],\n\t): { enabledIds: string[]; unavailableIds: string[] } | undefined => {\n\t\tconst configuredPatterns = this.settingsManager.getEnabledModels();\n\t\tif (!configuredPatterns?.length) return undefined;\n\t\tconst { scopedModels, diagnostics } = resolveModelScopeFromModels(configuredPatterns, models);\n\t\tconst enabledIds = scopedModels.map((scoped) => `${scoped.model.provider}/${scoped.model.id}`);\n\t\tconst unavailableIds: string[] = [];\n\t\tfor (const diagnostic of diagnostics) {\n\t\t\tif (diagnostic.code === \"no-match\" && !unavailableIds.includes(diagnostic.pattern)) {\n\t\t\t\tunavailableIds.push(diagnostic.pattern);\n\t\t\t}\n\t\t}\n\t\treturn { enabledIds: [...enabledIds, ...unavailableIds], unavailableIds };\n\t};\n\n\tconst configuredScope = getConfiguredScope(availableModels);\n\tlet currentEnabledIds =\n\t\tsessionScopedIds.length > 0\n\t\t\t? [...sessionScopedIds, ...(configuredScope?.unavailableIds ?? [])]\n\t\t\t: (configuredScope?.enabledIds ?? null);\n\tlet selectionChanged = false;\n\n\tconst updateSessionModels = (enabledIds: string[] | null): void => {\n\t\tcurrentEnabledIds = enabledIds === null ? null : [...enabledIds];\n\t\tconst hasEnabledAvailableModel = enabledIds?.some((id) => availableModelIds.has(id)) ?? false;\n\t\tconst allAvailableModelsEnabled =\n\t\t\tenabledIds !== null && [...availableModelIds].every((id) => enabledIds.includes(id));\n\t\tif (enabledIds && hasEnabledAvailableModel && !allAvailableModelsEnabled) {\n\t\t\tconst newScopedModels = resolveModelScopeFromModels(enabledIds, availableModels).scopedModels;\n\t\t\tthis.session.setScopedModels(\n\t\t\t\tnewScopedModels.map((scoped) => ({ model: scoped.model, thinkingLevel: scoped.thinkingLevel })),\n\t\t\t);\n\t\t} else {\n\t\t\tthis.session.setScopedModels([]);\n\t\t}\n\t\tvoid this.updateAvailableProviderCount();\n\t\tthis.setupAutocompleteProvider();\n\t\tthis.ui.requestRender();\n\t};\n\n\tthis.showSelector((done) => {\n\t\tlet disposed = false;\n\t\tconst refreshAbortController = new AbortController();\n\t\tconst selector = new ScopedModelsSelectorComponent(\n\t\t\t{\n\t\t\t\tallModels: availableModels,\n\t\t\t\tenabledModelIds: currentEnabledIds,\n\t\t\t\trefreshStatus: \"Refreshing model catalogs…\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tonChange: (enabledIds) => {\n\t\t\t\t\tselectionChanged = true;\n\t\t\t\t\tupdateSessionModels(enabledIds);\n\t\t\t\t\tconst allEnabled =\n\t\t\t\t\t\tenabledIds !== null &&\n\t\t\t\t\t\tenabledIds.length === availableModels.length &&\n\t\t\t\t\t\tenabledIds.every((id) => availableModelIds.has(id));\n\t\t\t\t\tconst newPatterns = enabledIds === null || allEnabled ? undefined : enabledIds;\n\t\t\t\t\tthis.settingsManager.setEnabledModels(newPatterns ? [...newPatterns] : undefined);\n\t\t\t\t},\n\t\t\t\tonCancel: () => {\n\t\t\t\t\tdone();\n\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\t\tvoid boundedInteractiveModelRefresh(\n\t\t\t(options) => refreshModelCatalogs(this.session.modelRuntime, options),\n\t\t\t{ allowNetwork: !isOfflineModeEnabled() },\n\t\t\trefreshAbortController.signal,\n\t\t)\n\t\t\t.then((outcome) => {\n\t\t\t\tif (disposed) return;\n\t\t\t\tavailableModels = [...this.session.modelRuntime.getAvailableSnapshot()];\n\t\t\t\tavailableModelIds = new Set(availableModels.map((model) => `${model.provider}/${model.id}`));\n\t\t\t\tif (!selectionChanged) {\n\t\t\t\t\tconst refreshedConfiguredScope = getConfiguredScope(availableModels);\n\t\t\t\t\tcurrentEnabledIds =\n\t\t\t\t\t\tsessionScopedIds.length > 0\n\t\t\t\t\t\t\t? [...sessionScopedIds, ...(refreshedConfiguredScope?.unavailableIds ?? [])]\n\t\t\t\t\t\t\t: (refreshedConfiguredScope?.enabledIds ?? null);\n\t\t\t\t\tselector.updateModels(availableModels, currentEnabledIds);\n\t\t\t\t} else {\n\t\t\t\t\tselector.updateModels(availableModels);\n\t\t\t\t}\n\t\t\t\tif (outcome.status === \"timed-out\") {\n\t\t\t\t\tselector.setRefreshStatus(\"Model refresh timed out; showing cached models.\", \"warning\");\n\t\t\t\t} else if (outcome.status === \"aborted\") {\n\t\t\t\t\tselector.setRefreshStatus(\"Model refresh was cancelled; showing cached models.\", \"warning\");\n\t\t\t\t} else if (outcome.status === \"rejected\") {\n\t\t\t\t\tselector.setRefreshStatus(\"Could not refresh model catalogs; showing cached models.\", \"warning\");\n\t\t\t\t} else if (outcome.value.aborted) {\n\t\t\t\t\tselector.setRefreshStatus(\"Model refresh was cancelled; showing cached models.\", \"warning\");\n\t\t\t\t} else if (outcome.value.errors.size === 1) {\n\t\t\t\t\tselector.setRefreshStatus(\n\t\t\t\t\t\t`Could not refresh ${outcome.value.errors.keys().next().value}; showing cached models.`,\n\t\t\t\t\t\t\"warning\",\n\t\t\t\t\t);\n\t\t\t\t} else if (outcome.value.errors.size > 1) {\n\t\t\t\t\tselector.setRefreshStatus(\n\t\t\t\t\t\t`Could not refresh ${outcome.value.errors.size} model catalogs; showing cached models.`,\n\t\t\t\t\t\t\"warning\",\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tselector.setRefreshStatus(\"Model catalogs refreshed.\", \"success\");\n\t\t\t\t}\n\t\t\t\tthis.ui.requestRender();\n\t\t\t})\n\t\t\t.catch(() => {\n\t\t\t\tif (disposed) return;\n\t\t\t\tselector.setRefreshStatus(\"Could not update cached models; showing cached models.\", \"warning\");\n\t\t\t\tthis.ui.requestRender();\n\t\t\t});\n\t\treturn {\n\t\t\tcomponent: selector,\n\t\t\tfocus: selector,\n\t\t\tdispose: () => {\n\t\t\t\tdisposed = true;\n\t\t\t\trefreshAbortController.abort();\n\t\t\t},\n\t\t};\n\t});\n};\n\nInteractiveModeBase.prototype.showUserMessageSelector = async function (this: InteractiveModeBase): Promise<void> {\n\tawait this.ensureDeferredStartupComplete();\n\tconst userMessages = this.session.getUserMessagesForForking();\n\n\tif (userMessages.length === 0) {\n\t\tthis.showStatus(\"No messages to fork from\");\n\t\treturn;\n\t}\n\n\tconst initialSelectedId = userMessages[userMessages.length - 1]?.entryId;\n\n\tthis.showSelector((done) => {\n\t\tlet selectionHandled = false;\n\t\tconst selector = new UserMessageSelectorComponent(\n\t\t\tuserMessages.map((m) => ({ id: m.entryId, text: m.text })),\n\t\t\tasync (entryId) => {\n\t\t\t\tif (selectionHandled) return;\n\t\t\t\tselectionHandled = true;\n\t\t\t\tdone();\n\t\t\t\ttry {\n\t\t\t\t\tawait this.ensureDeferredStartupComplete();\n\t\t\t\t\tconst result = await this.runtimeHost.fork(entryId);\n\t\t\t\t\tif (result.cancelled) {\n\t\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.renderCurrentSessionState();\n\t\t\t\t\tthis.editor.setText(result.selectedText ?? \"\");\n\t\t\t\t\tthis.showStatus(\"Forked to new session\");\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\tthis.showError(error instanceof Error ? error.message : String(error));\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tif (selectionHandled) return;\n\t\t\t\tselectionHandled = true;\n\t\t\t\tdone();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t},\n\t\t\tinitialSelectedId,\n\t\t);\n\t\treturn { component: selector, focus: selector.getMessageList() };\n\t});\n};\n\nInteractiveModeBase.prototype.handleThinkingCommand = async function (\n\tthis: InteractiveModeBase,\n\tsearchTerm?: string,\n): Promise<void> {\n\tif (!searchTerm) {\n\t\tthis.showThinkingSelector();\n\t\treturn;\n\t}\n\tconst levels = this.session.getAvailableThinkingLevels();\n\tconst normalized = searchTerm.trim().toLowerCase();\n\tconst level = levels.find((candidate) => candidate === normalized);\n\tif (!level) {\n\t\tthis.showError(`Unknown thinking level \"${searchTerm}\". Available levels: ${levels.join(\", \")}.`);\n\t\treturn;\n\t}\n\tawait this.selectThinkingLevel(level);\n};\n\nInteractiveModeBase.prototype.selectThinkingLevel = async function (\n\tthis: InteractiveModeBase,\n\tlevel: ThinkingLevel,\n): Promise<void> {\n\tawait this.session.setThinkingLevel(level, { persist: true });\n\tthis.footer.invalidate();\n\tthis.updateEditorBorderColor();\n\tthis.showStatus(`Thinking level: ${level}`);\n};\n\nInteractiveModeBase.prototype.showThinkingSelector = function (this: InteractiveModeBase): void {\n\tthis.showSelector((done) => {\n\t\tconst select = async (level: ThinkingLevel) => {\n\t\t\ttry {\n\t\t\t\tawait this.selectThinkingLevel(level);\n\t\t\t\tdone();\n\t\t\t} catch (error) {\n\t\t\t\tthis.showError(error instanceof Error ? error.message : String(error));\n\t\t\t}\n\t\t};\n\t\tconst model = this.session.model;\n\t\tconst availableLevels = this.session.getAvailableThinkingLevels();\n\t\tconst rawDefault = resolveSessionThinkingDefault(model, this.session.scopedModels, this.settingsManager);\n\t\tconst selector = new ThinkingSelectorComponent(\n\t\t\tthis.session.thinkingLevel,\n\t\t\tavailableLevels,\n\t\t\tselect,\n\t\t\t() => done(),\n\t\t\tresolveThinkingSelectorDefault(rawDefault, availableLevels, model),\n\t\t);\n\t\treturn { component: selector, focus: selector };\n\t});\n};\n"]}
1
+ {"version":3,"file":"interactive-model-routing.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-model-routing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE3E,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,2CAA2C,CAAC;AACxF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAEN,4BAA4B,EAE5B,sBAAsB,EACtB,2BAA2B,EAC3B,6BAA6B,EAC7B,yBAAyB,EACzB,4BAA4B,GAC5B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,mCAAmC,EAAE,8BAA8B,EAAE,MAAM,+BAA+B,CAAC;AACpH,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,MAAM,UAAU,8BAA8B,CAC7C,UAAqC,EACrC,eAAyC,EACzC,KAA6B;IAE7B,IAAI,UAAU,KAAK,SAAS;QAAE,OAAO,SAAS,CAAC;IAC/C,IAAI,eAAe,CAAC,QAAQ,CAAC,UAAU,CAAC;QAAE,OAAO,UAAU,CAAC;IAC5D,IAAI,CAAC,KAAK;QAAE,OAAO,eAAe,CAAC,QAAQ,CAAC,KAAK,CAA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AAEF,mBAAmB,CAAC,SAAS,CAAC,oBAAoB,GAAG;IACpD,IAAI,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE,EAAE;QAC1B,MAAM,MAAM,GAAG,KAAK,EAAE,KAAoB,EAAE,EAAE;YAC7C,IAAI,CAAC;gBACJ,MAAM,IAAI,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC;gBACtC,IAAI,EAAE,CAAC;YACR,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,CAAC,SAAS,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACxE,CAAC;QACF,CAAC,CAAC;QACF,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QACjC,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,0BAA0B,EAAE,CAAC;QAClE,MAAM,UAAU,GAAG,6BAA6B,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QACzG,MAAM,QAAQ,GAAG,IAAI,yBAAyB,CAC7C,IAAI,CAAC,OAAO,CAAC,aAAa,EAC1B,eAAe,EACf,MAAM,EACN,GAAG,EAAE,CAAC,IAAI,EAAE,EACZ,8BAA8B,CAAC,UAAU,EAAE,eAAe,EAAE,KAAK,CAAC,CAClE,CAAC;QACF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IACjD,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { clampThinkingLevel, modelsAreEqual } from \"@bastani/pi-ai/compat\";\nimport type { ThinkingLevel } from \"@earendil-works/pi-agent-core\";\nimport { boundedInteractiveModelRefresh } from \"../../core/bounded-model-refresh.ts\";\nimport { formatModelLabel } from \"../../core/model-label.ts\";\nimport { thinkingLevelForModelSwitch } from \"../../core/model-switch-thinking-level.ts\";\nimport { isOfflineModeEnabled } from \"../../core/package-manager-env.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport {\n\ttype Api,\n\tfindExactModelReferenceMatch,\n\ttype Model,\n\tModelSelectorComponent,\n\tresolveModelScopeFromModels,\n\tScopedModelsSelectorComponent,\n\tThinkingSelectorComponent,\n\tUserMessageSelectorComponent,\n} from \"./interactive-mode-deps.ts\";\nimport { ANTHROPIC_SUBSCRIPTION_AUTH_WARNING, isAnthropicSubscriptionAuthKey } from \"./interactive-mode-helpers.ts\";\nimport { refreshModelCatalogs } from \"./model-catalog-refresh.ts\";\n\nexport function resolveThinkingSelectorDefault(\n\trawDefault: ThinkingLevel | undefined,\n\tavailableLevels: readonly ThinkingLevel[],\n\tmodel: Model<Api> | undefined,\n): ThinkingLevel | undefined {\n\tif (rawDefault === undefined) return undefined;\n\tif (availableLevels.includes(rawDefault)) return rawDefault;\n\tif (!model) return availableLevels.includes(\"off\") ? \"off\" : availableLevels[0];\n\tconst clamped = clampThinkingLevel(model, rawDefault) as ThinkingLevel;\n\tif (availableLevels.includes(clamped)) return clamped;\n\treturn availableLevels.includes(\"off\") ? \"off\" : availableLevels[0];\n}\n\n/**\n * The saved level the active session would start from, in the precedence\n * `findInitialModel` uses: a scoped `--models \"id:level\"` entry wins over a\n * persisted per-model override, which wins over the global default. Matching\n * it keeps the selector badge from advertising a level the session never used.\n */\nexport function resolveSessionThinkingDefault(\n\tmodel: Model<Api> | undefined,\n\tscopedModels: ReadonlyArray<{ model: Model<Api>; thinkingLevel?: ThinkingLevel }>,\n\tsettings: {\n\t\tgetModelThinkingLevel(provider: string, modelId: string): ThinkingLevel | undefined;\n\t\tgetDefaultThinkingLevel(): ThinkingLevel | undefined;\n\t},\n): ThinkingLevel | undefined {\n\tif (model === undefined) return settings.getDefaultThinkingLevel();\n\tconst scopedLevel = scopedModels.find(\n\t\t(scoped) => scoped.model.provider === model.provider && scoped.model.id === model.id,\n\t)?.thinkingLevel;\n\treturn scopedLevel ?? settings.getModelThinkingLevel(model.provider, model.id) ?? settings.getDefaultThinkingLevel();\n}\n\nInteractiveModeBase.prototype.handleModelCommand = async function (\n\tthis: InteractiveModeBase,\n\tsearchTerm?: string,\n): Promise<void> {\n\tif (!searchTerm) {\n\t\tthis.showModelSelector();\n\t\treturn;\n\t}\n\n\tconst model = await this.findExactModelMatch(searchTerm);\n\tif (model) {\n\t\ttry {\n\t\t\tawait this.session.setModel(model, { persist: true });\n\t\t\tthis.footer.invalidate();\n\t\t\tthis.updateEditorBorderColor();\n\t\t\tthis.showStatus(`Model: ${formatModelLabel(model, { thinkingLevel: this.session.thinkingLevel })}`);\n\t\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth(model);\n\t\t} catch (error) {\n\t\t\tthis.showError(error instanceof Error ? error.message : String(error));\n\t\t}\n\t\treturn;\n\t}\n\n\tthis.showModelSelector(searchTerm);\n};\n\nInteractiveModeBase.prototype.findExactModelMatch = async function (\n\tthis: InteractiveModeBase,\n\tsearchTerm: string,\n): Promise<Model<Api> | undefined> {\n\tif (this.session.scopedModels.length > 0) {\n\t\treturn findExactModelReferenceMatch(\n\t\t\tsearchTerm,\n\t\t\tthis.session.scopedModels.map((scoped) => scoped.model),\n\t\t);\n\t}\n\n\ttry {\n\t\tconst cachedMatch = findExactModelReferenceMatch(searchTerm, [\n\t\t\t...this.session.modelRuntime.getAvailableSnapshot(),\n\t\t]);\n\t\tif (cachedMatch) return cachedMatch;\n\t} catch {\n\t\t// A refresh below retries the snapshot read and safely falls back to no match.\n\t}\n\n\tconst models = await this.getModelCandidates();\n\treturn findExactModelReferenceMatch(searchTerm, models);\n};\n\nInteractiveModeBase.prototype.getModelCandidates = async function (this: InteractiveModeBase): Promise<Model<Api>[]> {\n\tif (this.session.scopedModels.length > 0) {\n\t\treturn this.session.scopedModels.map((scoped) => scoped.model);\n\t}\n\n\tconst allowNetwork = !isOfflineModeEnabled();\n\tawait boundedInteractiveModelRefresh(\n\t\t(refreshOptions) => refreshModelCatalogs(this.session.modelRuntime, refreshOptions),\n\t\t{ allowNetwork },\n\t);\n\ttry {\n\t\treturn [...this.session.modelRuntime.getAvailableSnapshot()];\n\t} catch {\n\t\treturn [];\n\t}\n};\n\nInteractiveModeBase.prototype.updateAvailableProviderCount = async function (this: InteractiveModeBase): Promise<void> {\n\tconst models =\n\t\tthis.session.scopedModels.length > 0\n\t\t\t? this.session.scopedModels.map((scoped) => scoped.model)\n\t\t\t: this.session.modelRuntime.getAvailableSnapshot();\n\tthis.footerDataProvider.setAvailableProviderCount(new Set(models.map((model) => model.provider)).size);\n};\n\nInteractiveModeBase.prototype.maybeWarnAboutAnthropicSubscriptionAuth = async function (\n\tthis: InteractiveModeBase,\n\tmodel: Model<Api> | undefined = this.session.model,\n\ttargetContainer = this.chatContainer,\n): Promise<void> {\n\tif (this.settingsManager.getWarnings().anthropicExtraUsage === false) {\n\t\treturn;\n\t}\n\tif (this.anthropicSubscriptionWarningShown) {\n\t\treturn;\n\t}\n\tif (model?.provider !== \"anthropic\") {\n\t\treturn;\n\t}\n\n\tif (this.session.modelRuntime.isUsingOAuth(\"anthropic\")) {\n\t\tthis.anthropicSubscriptionWarningShown = true;\n\t\tthis.showWarning(ANTHROPIC_SUBSCRIPTION_AUTH_WARNING, targetContainer);\n\t\treturn;\n\t}\n\n\ttry {\n\t\tconst storedCredential = await this.session.modelRuntime.getAuth(\"anthropic\");\n\t\tconst apiKey = storedCredential?.auth.apiKey;\n\t\tif (!isAnthropicSubscriptionAuthKey(apiKey)) {\n\t\t\treturn;\n\t\t}\n\t\tthis.anthropicSubscriptionWarningShown = true;\n\t\tthis.showWarning(ANTHROPIC_SUBSCRIPTION_AUTH_WARNING, targetContainer);\n\t} catch {\n\t\t// Ignore auth lookup failures for warning-only checks.\n\t}\n};\n\nInteractiveModeBase.prototype.showModelSelector = function (\n\tthis: InteractiveModeBase,\n\tinitialSearchInput?: string,\n): void {\n\tthis.showSelector((done) => {\n\t\tconst selector = new ModelSelectorComponent(\n\t\t\tthis.ui,\n\t\t\tthis.session.model,\n\t\t\tthis.settingsManager,\n\t\t\tthis.session.modelRuntime,\n\t\t\tthis.session.scopedModels,\n\t\t\tasync (model) => {\n\t\t\t\ttry {\n\t\t\t\t\tawait this.session.setModel(model, { persist: true });\n\t\t\t\t\tawait this.updateAvailableProviderCount();\n\t\t\t\t\tthis.footer.invalidate();\n\t\t\t\t\tthis.updateEditorBorderColor();\n\t\t\t\t\tdone();\n\t\t\t\t\tvoid this.maybeWarnAboutAnthropicSubscriptionAuth(model);\n\t\t\t\t\tthis.showStatus(`Model: ${formatModelLabel(model, { thinkingLevel: this.session.thinkingLevel })}`);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tdone();\n\t\t\t\t\tthis.showError(error instanceof Error ? error.message : String(error));\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tdone();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t},\n\t\t\tinitialSearchInput,\n\t\t\tthis.session.thinkingLevel,\n\t\t);\n\t\treturn { component: selector, focus: selector, dispose: () => selector.dispose() };\n\t});\n};\n\nInteractiveModeBase.prototype.showModelsSelector = function (this: InteractiveModeBase): void {\n\tlet availableModels = [...this.session.modelRuntime.getAvailableSnapshot()];\n\tlet availableModelIds = new Set(availableModels.map((model) => `${model.provider}/${model.id}`));\n\tconst sessionScopedModels = this.session.scopedModels;\n\tconst sessionScopedIds = sessionScopedModels.map((scoped) => `${scoped.model.provider}/${scoped.model.id}`);\n\tconst getConfiguredScope = (\n\t\tmodels: readonly Model<Api>[],\n\t): { enabledIds: string[]; unavailableIds: string[] } | undefined => {\n\t\tconst configuredPatterns = this.settingsManager.getEnabledModels();\n\t\tif (!configuredPatterns?.length) return undefined;\n\t\tconst { scopedModels, diagnostics } = resolveModelScopeFromModels(configuredPatterns, models);\n\t\tconst enabledIds = scopedModels.map((scoped) => `${scoped.model.provider}/${scoped.model.id}`);\n\t\tconst unavailableIds: string[] = [];\n\t\tfor (const diagnostic of diagnostics) {\n\t\t\tif (diagnostic.code === \"no-match\" && !unavailableIds.includes(diagnostic.pattern)) {\n\t\t\t\tunavailableIds.push(diagnostic.pattern);\n\t\t\t}\n\t\t}\n\t\treturn { enabledIds: [...enabledIds, ...unavailableIds], unavailableIds };\n\t};\n\n\tconst configuredScope = getConfiguredScope(availableModels);\n\tlet currentEnabledIds =\n\t\tsessionScopedIds.length > 0\n\t\t\t? [...sessionScopedIds, ...(configuredScope?.unavailableIds ?? [])]\n\t\t\t: (configuredScope?.enabledIds ?? null);\n\tlet selectionChanged = false;\n\n\tconst updateSessionModels = (enabledIds: string[] | null): void => {\n\t\tcurrentEnabledIds = enabledIds === null ? null : [...enabledIds];\n\t\tconst hasEnabledAvailableModel = enabledIds?.some((id) => availableModelIds.has(id)) ?? false;\n\t\tconst allAvailableModelsEnabled =\n\t\t\tenabledIds !== null && [...availableModelIds].every((id) => enabledIds.includes(id));\n\t\tif (enabledIds && hasEnabledAvailableModel && !allAvailableModelsEnabled) {\n\t\t\tconst newScopedModels = resolveModelScopeFromModels(enabledIds, availableModels).scopedModels;\n\t\t\tthis.session.setScopedModels(\n\t\t\t\tnewScopedModels.map((scoped) => ({ model: scoped.model, thinkingLevel: scoped.thinkingLevel })),\n\t\t\t);\n\t\t} else {\n\t\t\tthis.session.setScopedModels([]);\n\t\t}\n\t\tvoid this.updateAvailableProviderCount();\n\t\tthis.setupAutocompleteProvider();\n\t\tthis.ui.requestRender();\n\t};\n\n\tthis.showSelector((done) => {\n\t\tlet disposed = false;\n\t\tconst refreshAbortController = new AbortController();\n\t\tconst selector = new ScopedModelsSelectorComponent(\n\t\t\t{\n\t\t\t\tallModels: availableModels,\n\t\t\t\tenabledModelIds: currentEnabledIds,\n\t\t\t\trefreshStatus: \"Refreshing model catalogs…\",\n\t\t\t\t// The level Ctrl+P cycling gives each model: its scoped level, else the level a switch to it applies.\n\t\t\t\tthinkingLevelFor: (model) => {\n\t\t\t\t\tif (modelsAreEqual(this.session.model, model)) return this.session.thinkingLevel;\n\t\t\t\t\tconst scoped = this.session.scopedModels.find((entry) => modelsAreEqual(entry.model, model));\n\t\t\t\t\treturn scoped?.thinkingLevel !== undefined\n\t\t\t\t\t\t? clampThinkingLevel(model, scoped.thinkingLevel)\n\t\t\t\t\t\t: thinkingLevelForModelSwitch(model, {\n\t\t\t\t\t\t\t\tsettings: this.settingsManager,\n\t\t\t\t\t\t\t\tcurrent: { model: this.session.model, thinkingLevel: this.session.thinkingLevel },\n\t\t\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tonChange: (enabledIds) => {\n\t\t\t\t\tselectionChanged = true;\n\t\t\t\t\tupdateSessionModels(enabledIds);\n\t\t\t\t\tconst allEnabled =\n\t\t\t\t\t\tenabledIds !== null &&\n\t\t\t\t\t\tenabledIds.length === availableModels.length &&\n\t\t\t\t\t\tenabledIds.every((id) => availableModelIds.has(id));\n\t\t\t\t\tconst newPatterns = enabledIds === null || allEnabled ? undefined : enabledIds;\n\t\t\t\t\tthis.settingsManager.setEnabledModels(newPatterns ? [...newPatterns] : undefined);\n\t\t\t\t},\n\t\t\t\tonCancel: () => {\n\t\t\t\t\tdone();\n\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\t\tvoid boundedInteractiveModelRefresh(\n\t\t\t(options) => refreshModelCatalogs(this.session.modelRuntime, options),\n\t\t\t{ allowNetwork: !isOfflineModeEnabled() },\n\t\t\trefreshAbortController.signal,\n\t\t)\n\t\t\t.then((outcome) => {\n\t\t\t\tif (disposed) return;\n\t\t\t\tavailableModels = [...this.session.modelRuntime.getAvailableSnapshot()];\n\t\t\t\tavailableModelIds = new Set(availableModels.map((model) => `${model.provider}/${model.id}`));\n\t\t\t\tif (!selectionChanged) {\n\t\t\t\t\tconst refreshedConfiguredScope = getConfiguredScope(availableModels);\n\t\t\t\t\tcurrentEnabledIds =\n\t\t\t\t\t\tsessionScopedIds.length > 0\n\t\t\t\t\t\t\t? [...sessionScopedIds, ...(refreshedConfiguredScope?.unavailableIds ?? [])]\n\t\t\t\t\t\t\t: (refreshedConfiguredScope?.enabledIds ?? null);\n\t\t\t\t\tselector.updateModels(availableModels, currentEnabledIds);\n\t\t\t\t} else {\n\t\t\t\t\tselector.updateModels(availableModels);\n\t\t\t\t}\n\t\t\t\tif (outcome.status === \"timed-out\") {\n\t\t\t\t\tselector.setRefreshStatus(\"Model refresh timed out; showing cached models.\", \"warning\");\n\t\t\t\t} else if (outcome.status === \"aborted\") {\n\t\t\t\t\tselector.setRefreshStatus(\"Model refresh was cancelled; showing cached models.\", \"warning\");\n\t\t\t\t} else if (outcome.status === \"rejected\") {\n\t\t\t\t\tselector.setRefreshStatus(\"Could not refresh model catalogs; showing cached models.\", \"warning\");\n\t\t\t\t} else if (outcome.value.aborted) {\n\t\t\t\t\tselector.setRefreshStatus(\"Model refresh was cancelled; showing cached models.\", \"warning\");\n\t\t\t\t} else if (outcome.value.errors.size === 1) {\n\t\t\t\t\tselector.setRefreshStatus(\n\t\t\t\t\t\t`Could not refresh ${outcome.value.errors.keys().next().value}; showing cached models.`,\n\t\t\t\t\t\t\"warning\",\n\t\t\t\t\t);\n\t\t\t\t} else if (outcome.value.errors.size > 1) {\n\t\t\t\t\tselector.setRefreshStatus(\n\t\t\t\t\t\t`Could not refresh ${outcome.value.errors.size} model catalogs; showing cached models.`,\n\t\t\t\t\t\t\"warning\",\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tselector.setRefreshStatus(\"Model catalogs refreshed.\", \"success\");\n\t\t\t\t}\n\t\t\t\tthis.ui.requestRender();\n\t\t\t})\n\t\t\t.catch(() => {\n\t\t\t\tif (disposed) return;\n\t\t\t\tselector.setRefreshStatus(\"Could not update cached models; showing cached models.\", \"warning\");\n\t\t\t\tthis.ui.requestRender();\n\t\t\t});\n\t\treturn {\n\t\t\tcomponent: selector,\n\t\t\tfocus: selector,\n\t\t\tdispose: () => {\n\t\t\t\tdisposed = true;\n\t\t\t\trefreshAbortController.abort();\n\t\t\t},\n\t\t};\n\t});\n};\n\nInteractiveModeBase.prototype.showUserMessageSelector = async function (this: InteractiveModeBase): Promise<void> {\n\tawait this.ensureDeferredStartupComplete();\n\tconst userMessages = this.session.getUserMessagesForForking();\n\n\tif (userMessages.length === 0) {\n\t\tthis.showStatus(\"No messages to fork from\");\n\t\treturn;\n\t}\n\n\tconst initialSelectedId = userMessages[userMessages.length - 1]?.entryId;\n\n\tthis.showSelector((done) => {\n\t\tlet selectionHandled = false;\n\t\tconst selector = new UserMessageSelectorComponent(\n\t\t\tuserMessages.map((m) => ({ id: m.entryId, text: m.text })),\n\t\t\tasync (entryId) => {\n\t\t\t\tif (selectionHandled) return;\n\t\t\t\tselectionHandled = true;\n\t\t\t\tdone();\n\t\t\t\ttry {\n\t\t\t\t\tawait this.ensureDeferredStartupComplete();\n\t\t\t\t\tconst result = await this.runtimeHost.fork(entryId);\n\t\t\t\t\tif (result.cancelled) {\n\t\t\t\t\t\tthis.ui.requestRender();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.renderCurrentSessionState();\n\t\t\t\t\tthis.editor.setText(result.selectedText ?? \"\");\n\t\t\t\t\tthis.showStatus(\"Forked to new session\");\n\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\tthis.showError(error instanceof Error ? error.message : String(error));\n\t\t\t\t}\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tif (selectionHandled) return;\n\t\t\t\tselectionHandled = true;\n\t\t\t\tdone();\n\t\t\t\tthis.ui.requestRender();\n\t\t\t},\n\t\t\tinitialSelectedId,\n\t\t);\n\t\treturn { component: selector, focus: selector.getMessageList() };\n\t});\n};\n\nInteractiveModeBase.prototype.handleThinkingCommand = async function (\n\tthis: InteractiveModeBase,\n\tsearchTerm?: string,\n): Promise<void> {\n\tif (!searchTerm) {\n\t\tthis.showThinkingSelector();\n\t\treturn;\n\t}\n\tconst levels = this.session.getAvailableThinkingLevels();\n\tconst normalized = searchTerm.trim().toLowerCase();\n\tconst level = levels.find((candidate) => candidate === normalized);\n\tif (!level) {\n\t\tthis.showError(`Unknown thinking level \"${searchTerm}\". Available levels: ${levels.join(\", \")}.`);\n\t\treturn;\n\t}\n\tawait this.selectThinkingLevel(level);\n};\n\nInteractiveModeBase.prototype.selectThinkingLevel = async function (\n\tthis: InteractiveModeBase,\n\tlevel: ThinkingLevel,\n): Promise<void> {\n\tawait this.session.setThinkingLevel(level, { persist: true });\n\tthis.footer.invalidate();\n\tthis.updateEditorBorderColor();\n\tthis.showStatus(`Thinking level: ${level}`);\n};\n\nInteractiveModeBase.prototype.showThinkingSelector = function (this: InteractiveModeBase): void {\n\tthis.showSelector((done) => {\n\t\tconst select = async (level: ThinkingLevel) => {\n\t\t\ttry {\n\t\t\t\tawait this.selectThinkingLevel(level);\n\t\t\t\tdone();\n\t\t\t} catch (error) {\n\t\t\t\tthis.showError(error instanceof Error ? error.message : String(error));\n\t\t\t}\n\t\t};\n\t\tconst model = this.session.model;\n\t\tconst availableLevels = this.session.getAvailableThinkingLevels();\n\t\tconst rawDefault = resolveSessionThinkingDefault(model, this.session.scopedModels, this.settingsManager);\n\t\tconst selector = new ThinkingSelectorComponent(\n\t\t\tthis.session.thinkingLevel,\n\t\t\tavailableLevels,\n\t\t\tselect,\n\t\t\t() => done(),\n\t\t\tresolveThinkingSelectorDefault(rawDefault, availableLevels, model),\n\t\t);\n\t\treturn { component: selector, focus: selector };\n\t});\n};\n"]}
@@ -43,12 +43,16 @@ InteractiveModeBase.prototype.runUserPromptTurn = async function (input) {
43
43
  if (!(this.runtimeHost instanceof IsolatedInteractiveRuntime) || !this.isExtensionCommand(userInput)) {
44
44
  await this.session.resumeQueuedMessages();
45
45
  }
46
+ const shownBefore = this.userMessagesShownBySession;
46
47
  await this.session.prompt(userInput, {
47
48
  streamingBehavior: "steer",
48
49
  preflightResult: (success, disposition) => {
49
50
  refused = !success;
50
- if (success && disposition === "queued")
51
+ // A queued message is listed as queued, and one an `input` hook handled is not sent at all (#4285).
52
+ if (success && (disposition === "queued" || disposition === "handled"))
51
53
  this.discardDeferredRenderedUserInput(userInput);
54
+ if (success && disposition === "started")
55
+ this.expectStartedUserInput(userInput, shownBefore);
52
56
  if (success)
53
57
  settleDispatch();
54
58
  },
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-prompt-turn.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-prompt-turn.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,4BAA4B,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AACzG,OAAO,EAA8B,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAElG,mBAAmB,CAAC,SAAS,CAAC,iBAAiB,GAAG,KAAK,WAEtD,KAAqC;IAErC,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,uBAAuB,CAAC,KAAK,CAAC,CAAC;IAClE,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;IACtD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IACvB,MAAM,cAAc,GAAG,GAAS,EAAE;QACjC,IAAI,IAAI,CAAC,UAAU;YAAE,OAAO;QAC5B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,IAAI,CAAC,wBAAwB,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxE,KAAK,IAAI,CAAC,oBAAoB,CAAC,EAAE,WAAW,EAAE,IAA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InternalSurface } from \"../../core/agent-session-methods.ts\";\nimport { tryExecuteSessionSlashCommand } from \"../../core/agent-session-prompt.ts\";\nimport { yieldToEventLoop } from \"../../utils/event-loop.ts\";\nimport { IsolatedInteractiveRuntime } from \"../interactive-engine/isolated-runtime.js\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { restoreFailedSubmissionDraft, restoreRefusedSubmission } from \"./interactive-prompt-restore.ts\";\nimport { type InteractiveSubmission, toInteractiveSubmission } from \"./interactive-submission.ts\";\n\nInteractiveModeBase.prototype.runUserPromptTurn = async function (\n\tthis: InteractiveModeBase,\n\tinput: InteractiveSubmission | string,\n): Promise<void> {\n\tconst { text: userInput, draft } = toInteractiveSubmission(input);\n\tconst turn = this.promptTurn ?? { dispatched: false };\n\tthis.promptTurn = turn;\n\tconst settleDispatch = (): void => {\n\t\tif (turn.dispatched) return;\n\t\tturn.dispatched = true;\n\t\tif (this.compactionQueuedMessages.length > 0 && !this.compactionActive) {\n\t\t\tvoid this.flushCompactionQueue({ afterPrompt: true });\n\t\t}\n\t};\n\t// Show the working spinner immediately on submit so there is no visible gap\n\t// while prompt preflight runs before the agent emits `agent_start`. The\n\t// ownership flag keeps deferred startup from tearing it down mid-way.\n\tthis.promptTurnWorkingLoaderActive = true;\n\tthis.showWorkingLoaderNow();\n\tconst deferredStartupNeedsPromptGate = this.deferredStartupPending || this.deferredStartupPromise !== undefined;\n\t// Yield once so the freshly-mounted spinner paints before synchronous\n\t// preflight work can block the event loop.\n\tawait yieldToEventLoop();\n\t// A submission that never reaches an agent turn stays user-owned, so track\n\t// whether the turn actually started before deciding to restore the draft.\n\tlet turnStarted = false;\n\tlet refused = false;\n\tconst unsubscribeTurnStart = this.session.subscribe((event) => {\n\t\tif (event.type === \"agent_start\") turnStarted = true;\n\t});\n\ttry {\n\t\tif (deferredStartupNeedsPromptGate) {\n\t\t\tawait this.ensureDeferredStartupComplete();\n\t\t}\n\t\tconst handledSlashCommand =\n\t\t\t!(this.runtimeHost instanceof IsolatedInteractiveRuntime) &&\n\t\t\t(await tryExecuteSessionSlashCommand(\n\t\t\t\tthis.session as typeof this.session & Pick<AgentSessionInternalSurface, \"_tryExecuteExtensionCommand\">,\n\t\t\t\tuserInput,\n\t\t\t));\n\t\tif (!handledSlashCommand) {\n\t\t\tif (!(this.runtimeHost instanceof IsolatedInteractiveRuntime) || !this.isExtensionCommand(userInput)) {\n\t\t\t\tawait this.session.resumeQueuedMessages();\n\t\t\t}\n\t\t\tawait this.session.prompt(userInput, {\n\t\t\t\tstreamingBehavior: \"steer\",\n\t\t\t\tpreflightResult: (success, disposition) => {\n\t\t\t\t\trefused = !success;\n\t\t\t\t\tif (success && disposition === \"queued\") this.discardDeferredRenderedUserInput(userInput);\n\t\t\t\t\tif (success) settleDispatch();\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t} catch (error) {\n\t\tthis.discardDeferredRenderedUserInput(userInput);\n\t\tif (refused && !turnStarted) {\n\t\t\trestoreRefusedSubmission(this, error, draft);\n\t\t\treturn;\n\t\t}\n\t\tconst restored = restoreFailedSubmissionDraft(this, error, draft, { turnStarted });\n\t\t// A restored draft already tells the user the submission did not land, and\n\t\t// the recovery status explains why. A red transport error beside it is noise.\n\t\tif (!restored) {\n\t\t\tthis.showError(error instanceof Error ? error.message : \"Unknown error occurred\");\n\t\t}\n\t} finally {\n\t\tunsubscribeTurnStart();\n\t\tif (this.promptTurn === turn) this.promptTurn = undefined;\n\t\tif (!refused || turnStarted) settleDispatch();\n\t\tthis.promptTurnWorkingLoaderActive = false;\n\t\t// A submission that resolves without starting an agent turn (e.g. a\n\t\t// handled slash command) never emits `agent_end`, so clear the pre-shown\n\t\t// spinner here when idle to avoid a lingering indicator.\n\t\tif (!this.session.isStreaming) {\n\t\t\tthis.stopWorkingLoader();\n\t\t}\n\t}\n};\n"]}
1
+ {"version":3,"file":"interactive-prompt-turn.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-prompt-turn.ts"],"names":[],"mappings":"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BAAsB,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;oBAC9F,IAAI,OAAO;wBAAE,cAAc,EAAE,CAAC;gBAC/B,CAAC;aACD,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,CAAC,gCAAgC,CAAC,SAAS,CAAC,CAAC;QACjD,IAAI,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC;YAC7B,wBAAwB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAC7C,OAAO;QACR,CAAC;QACD,MAAM,QAAQ,GAAG,4BAA4B,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;QACnF,2EAA2E;QAC3E,8EAA8E;QAC9E,IAAI,CAAC,QAAQ,EAAE,CAAC;YACf,IAAI,CAAC,SAAS,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC;QACnF,CAAC;IACF,CAAC;YAAS,CAAC;QACV,oBAAoB,EAAE,CAAC;QACvB,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI;YAAE,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC1D,IAAI,CAAC,OAAO,IAAI,WAAW;YAAE,cAAc,EAAE,CAAC;QAC9C,IAAI,CAAC,6BAA6B,GAAG,KAAK,CAAC;QAC3C,oEAAoE;QACpE,yEAAyE;QACzE,yDAAyD;QACzD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;YAC/B,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC1B,CAAC;IACF,CAAC;AACF,CAAC,CAAC","sourcesContent":["import type { AgentSessionInternalSurface } from \"../../core/agent-session-methods.ts\";\nimport { tryExecuteSessionSlashCommand } from \"../../core/agent-session-prompt.ts\";\nimport { yieldToEventLoop } from \"../../utils/event-loop.ts\";\nimport { IsolatedInteractiveRuntime } from \"../interactive-engine/isolated-runtime.js\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { restoreFailedSubmissionDraft, restoreRefusedSubmission } from \"./interactive-prompt-restore.ts\";\nimport { type InteractiveSubmission, toInteractiveSubmission } from \"./interactive-submission.ts\";\n\nInteractiveModeBase.prototype.runUserPromptTurn = async function (\n\tthis: InteractiveModeBase,\n\tinput: InteractiveSubmission | string,\n): Promise<void> {\n\tconst { text: userInput, draft } = toInteractiveSubmission(input);\n\tconst turn = this.promptTurn ?? { dispatched: false };\n\tthis.promptTurn = turn;\n\tconst settleDispatch = (): void => {\n\t\tif (turn.dispatched) return;\n\t\tturn.dispatched = true;\n\t\tif (this.compactionQueuedMessages.length > 0 && !this.compactionActive) {\n\t\t\tvoid this.flushCompactionQueue({ afterPrompt: true });\n\t\t}\n\t};\n\t// Show the working spinner immediately on submit so there is no visible gap\n\t// while prompt preflight runs before the agent emits `agent_start`. The\n\t// ownership flag keeps deferred startup from tearing it down mid-way.\n\tthis.promptTurnWorkingLoaderActive = true;\n\tthis.showWorkingLoaderNow();\n\tconst deferredStartupNeedsPromptGate = this.deferredStartupPending || this.deferredStartupPromise !== undefined;\n\t// Yield once so the freshly-mounted spinner paints before synchronous\n\t// preflight work can block the event loop.\n\tawait yieldToEventLoop();\n\t// A submission that never reaches an agent turn stays user-owned, so track\n\t// whether the turn actually started before deciding to restore the draft.\n\tlet turnStarted = false;\n\tlet refused = false;\n\tconst unsubscribeTurnStart = this.session.subscribe((event) => {\n\t\tif (event.type === \"agent_start\") turnStarted = true;\n\t});\n\ttry {\n\t\tif (deferredStartupNeedsPromptGate) {\n\t\t\tawait this.ensureDeferredStartupComplete();\n\t\t}\n\t\tconst handledSlashCommand =\n\t\t\t!(this.runtimeHost instanceof IsolatedInteractiveRuntime) &&\n\t\t\t(await tryExecuteSessionSlashCommand(\n\t\t\t\tthis.session as typeof this.session & Pick<AgentSessionInternalSurface, \"_tryExecuteExtensionCommand\">,\n\t\t\t\tuserInput,\n\t\t\t));\n\t\tif (!handledSlashCommand) {\n\t\t\tif (!(this.runtimeHost instanceof IsolatedInteractiveRuntime) || !this.isExtensionCommand(userInput)) {\n\t\t\t\tawait this.session.resumeQueuedMessages();\n\t\t\t}\n\t\t\tconst shownBefore = this.userMessagesShownBySession;\n\t\t\tawait this.session.prompt(userInput, {\n\t\t\t\tstreamingBehavior: \"steer\",\n\t\t\t\tpreflightResult: (success, disposition) => {\n\t\t\t\t\trefused = !success;\n\t\t\t\t\t// A queued message is listed as queued, and one an `input` hook handled is not sent at all (#4285).\n\t\t\t\t\tif (success && (disposition === \"queued\" || disposition === \"handled\"))\n\t\t\t\t\t\tthis.discardDeferredRenderedUserInput(userInput);\n\t\t\t\t\tif (success && disposition === \"started\") this.expectStartedUserInput(userInput, shownBefore);\n\t\t\t\t\tif (success) settleDispatch();\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t} catch (error) {\n\t\tthis.discardDeferredRenderedUserInput(userInput);\n\t\tif (refused && !turnStarted) {\n\t\t\trestoreRefusedSubmission(this, error, draft);\n\t\t\treturn;\n\t\t}\n\t\tconst restored = restoreFailedSubmissionDraft(this, error, draft, { turnStarted });\n\t\t// A restored draft already tells the user the submission did not land, and\n\t\t// the recovery status explains why. A red transport error beside it is noise.\n\t\tif (!restored) {\n\t\t\tthis.showError(error instanceof Error ? error.message : \"Unknown error occurred\");\n\t\t}\n\t} finally {\n\t\tunsubscribeTurnStart();\n\t\tif (this.promptTurn === turn) this.promptTurn = undefined;\n\t\tif (!refused || turnStarted) settleDispatch();\n\t\tthis.promptTurnWorkingLoaderActive = false;\n\t\t// A submission that resolves without starting an agent turn (e.g. a\n\t\t// handled slash command) never emits `agent_end`, so clear the pre-shown\n\t\t// spinner here when idle to avoid a lingering indicator.\n\t\tif (!this.session.isStreaming) {\n\t\t\tthis.stopWorkingLoader();\n\t\t}\n\t}\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-queueing.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-queueing.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AA0HjE,4GAA4G;AAC5G,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAEvF;AA6GD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI,CA2BtE"}
1
+ {"version":3,"file":"interactive-queueing.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-queueing.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AA6HjE,4GAA4G;AAC5G,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAEvF;AA6GD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,mBAAmB,GAAG,IAAI,CA2BtE"}
@@ -55,10 +55,13 @@ InteractiveModeBase.prototype.clearAllQueues = async function (options) {
55
55
  this.updatePendingMessagesDisplay();
56
56
  throw error;
57
57
  }
58
+ // Each message goes back as it was typed, so sending it again runs `input` hooks and expansions once (#4284).
59
+ // A session from before `typed` was added gives back only the text it queued.
60
+ const typed = removed.typed ?? removed;
58
61
  // A hand-off the session has not confirmed yet is the session's: it either lists it or reports its refusal.
59
62
  return {
60
- steering: [...removed.steering, ...held.filter((msg) => msg.mode === "steer").map((msg) => msg.text)],
61
- followUp: [...removed.followUp, ...held.filter((msg) => msg.mode === "followUp").map((msg) => msg.text)],
63
+ steering: [...typed.steering, ...held.filter((msg) => msg.mode === "steer").map((msg) => msg.text)],
64
+ followUp: [...typed.followUp, ...held.filter((msg) => msg.mode === "followUp").map((msg) => msg.text)],
62
65
  };
63
66
  };
64
67
  InteractiveModeBase.prototype.updatePendingMessagesDisplay = function () {
@@ -273,7 +276,7 @@ async function startCompactionQueuePrompt(mode) {
273
276
  returnCompactionMessage(mode, first, refused.error);
274
277
  return false;
275
278
  }
276
- async function promptUntilAccepted(mode, message, onQueued) {
279
+ async function promptUntilAccepted(mode, message, onAccepted) {
277
280
  let accept;
278
281
  const accepted = new Promise((resolve) => {
279
282
  accept = resolve;
@@ -281,8 +284,8 @@ async function promptUntilAccepted(mode, message, onQueued) {
281
284
  const prompt = mode.session.prompt(message.text, {
282
285
  streamingBehavior: message.mode,
283
286
  preflightResult: (success, disposition) => {
284
- if (success && disposition === "queued")
285
- onQueued?.();
287
+ if (success)
288
+ onAccepted?.(disposition);
286
289
  accept(success);
287
290
  },
288
291
  });
@@ -303,7 +306,15 @@ async function sendHeldInput(mode) {
303
306
  const echoed = !message.text.startsWith("/");
304
307
  if (echoed)
305
308
  mode.renderDeferredUserInput(message.text);
306
- const refused = await promptUntilAccepted(mode, message, echoed ? () => mode.discardDeferredRenderedUserInput(message.text) : undefined);
309
+ const shownBefore = mode.userMessagesShownBySession;
310
+ const refused = await promptUntilAccepted(mode, message, echoed
311
+ ? (disposition) => {
312
+ if (disposition === "queued" || disposition === "handled")
313
+ mode.discardDeferredRenderedUserInput(message.text);
314
+ if (disposition === "started")
315
+ mode.expectStartedUserInput(message.text, shownBefore);
316
+ }
317
+ : undefined);
307
318
  if (refused !== undefined) {
308
319
  if (echoed)
309
320
  mode.discardDeferredRenderedUserInput(message.text);
@@ -1 +1 @@
1
- {"version":3,"file":"interactive-queueing.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-queueing.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,2BAA2B,EAC3B,kCAAkC,GAClC,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,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iveEngineQueue,\n\tgetInteractiveEngineRemoteCommands,\n} from \"../interactive-engine/extension-ui-bridge.ts\";\nimport { isRpcRequestAcceptedFailure } from \"../rpc/rpc-transport-error.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { combineQueuedMessagesForEditor, Spacer, TruncatedText, theme } from \"./interactive-mode-deps.ts\";\nimport type { CompactionQueuedMessage } from \"./interactive-mode-types.ts\";\n\n/** Typing order of messages handed to the session, so one it refuses returns to its own place. */\nconst handOffOrder = new WeakMap<CompactionQueuedMessage, number>();\nlet nextHandOff = 0;\n/**\n * Messages handed to the session that it has not confirmed yet. The editor keeps showing them until the session\n * reports it took them; from then on the session lists them itself. They are the session's from the moment they\n * are sent, so a restore takes them from the session's own answer and never from this copy.\n */\nconst unconfirmedHandOffs = new WeakMap<InteractiveModeBase, CompactionQueuedMessage[]>();\n\nfunction heldByEditor(mode: InteractiveModeBase): CompactionQueuedMessage[] {\n\treturn [...(unconfirmedHandOffs.get(mode) ?? []), ...mode.compactionQueuedMessages];\n}\n\nInteractiveModeBase.prototype.getAllQueuedMessages = function (this: InteractiveModeBase): {\n\tsteering: string[];\n\tfollowUp: string[];\n} {\n\tconst held = heldByEditor(this);\n\treturn {\n\t\tsteering: [\n\t\t\t...this.session.getSteeringMessages(),\n\t\t\t...held.filter((msg) => msg.mode === \"steer\").map((msg) => msg.text),\n\t\t],\n\t\tfollowUp: [\n\t\t\t...this.session.getFollowUpMessages(),\n\t\t\t...held.filter((msg) => msg.mode === \"followUp\").map((msg) => msg.text),\n\t\t],\n\t};\n};\n\n/**\n * Take every queued message back from the session and this editor, so the caller can restore them.\n *\n * What the session removed is its own answer, not this editor's copy of its queue. An engine child lists its queue\n * by `queue_update` events that trail it by a round trip, so a message it queued meanwhile is missing from the copy\n * and one it already took into a turn is still in it (#4257). The messages only this editor holds follow them.\n * When the session cannot be reached nothing is removed and the held messages stay queued.\n */\nInteractiveModeBase.prototype.clearAllQueues = async function (\n\tthis: InteractiveModeBase,\n\toptions?: { preserveUnprotectedCustomMessages?: boolean },\n): Promise<{\n\tsteering: string[];\n\tfollowUp: string[];\n}> {\n\t// Leave the editor queue now, so nothing sends these messages while the session answers.\n\tconst held = this.compactionQueuedMessages;\n\tconst heldSendFailed = this.compactionSendFailed;\n\tthis.compactionQueuedMessages = [];\n\tthis.compactionSendFailed = false;\n\tlet removed: { steering: string[]; followUp: string[] };\n\ttry {\n\t\tconst clearing =\n\t\t\tclearInteractiveEngineQueue(this.runtimeHost) ?? Promise.resolve(this.session.clearQueue(options));\n\t\tthis.updatePendingMessagesDisplay();\n\t\tremoved = await clearing;\n\t} catch (error) {\n\t\tthis.compactionQueuedMessages = [...held, ...this.compactionQueuedMessages];\n\t\t// If compaction ended meanwhile, its flush found the queue empty and nothing else will send these. Marked as\n\t\t// unsent, they go out in order ahead of the next submission, as a batch whose first send failed does.\n\t\tthis.compactionSendFailed ||= heldSendFailed || (held.length > 0 && !this.compactionActive);\n\t\tthis.updatePendingMessagesDisplay();\n\t\tthrow error;\n\t}\n\t// A hand-off the session has not confirmed yet is the session's: it either lists it or reports its refusal.\n\treturn {\n\t\tsteering: [...removed.steering, ...held.filter((msg) => msg.mode === \"steer\").map((msg) => msg.text)],\n\t\tfollowUp: [...removed.followUp, ...held.filter((msg) => msg.mode === \"followUp\").map((msg) => msg.text)],\n\t};\n};\n\nInteractiveModeBase.prototype.updatePendingMessagesDisplay = function (this: InteractiveModeBase): void {\n\tthis.pendingMessagesContainer.clear();\n\tconst { steering: steeringMessages, followUp: followUpMessages } = this.getAllQueuedMessages();\n\tif (steeringMessages.length > 0 || followUpMessages.length > 0) {\n\t\tthis.pendingMessagesContainer.addChild(new Spacer(1));\n\t\tfor (const message of steeringMessages) {\n\t\t\tconst text = theme.fg(\"dim\", `Steering: ${message}`);\n\t\t\tthis.pendingMessagesContainer.addChild(new TruncatedText(text, 1, 0));\n\t\t}\n\t\tfor (const message of followUpMessages) {\n\t\t\tconst text = theme.fg(\"dim\", `Follow-up: ${message}`);\n\t\t\tthis.pendingMessagesContainer.addChild(new TruncatedText(text, 1, 0));\n\t\t}\n\t\tconst dequeueHint = this.getAppKeyDisplay(\"app.message.dequeue\");\n\t\tconst hintText = theme.fg(\"dim\", `↳ ${dequeueHint} to edit all queued messages`);\n\t\tthis.pendingMessagesContainer.addChild(new TruncatedText(hintText, 1, 0));\n\t}\n};\n\nInteractiveModeBase.prototype.restoreQueuedMessagesToEditor = async function (\n\tthis: InteractiveModeBase,\n\toptions?: {\n\t\tabort?: boolean;\n\t\tcurrentText?: string;\n\t\tpreserveUnprotectedCustomMessages?: boolean;\n\t},\n): Promise<number> {\n\tconst { steering, followUp } = await this.clearAllQueues(options);\n\tconst allQueued = [...steering, ...followUp];\n\tif (allQueued.length === 0) {\n\t\tthis.updatePendingMessagesDisplay();\n\t\tif (options?.abort) {\n\t\t\tvoid this.session.abort();\n\t\t}\n\t\treturn 0;\n\t}\n\tconst currentText = options?.currentText ?? this.editor.getText();\n\tconst combinedText = combineQueuedMessagesForEditor(allQueued, currentText);\n\tthis.editor.setText(combinedText);\n\tthis.updatePendingMessagesDisplay();\n\tif (options?.abort) {\n\t\tvoid this.session.abort();\n\t}\n\treturn allQueued.length;\n};\n\n/** Report a restore the session could not answer; nothing was removed, so every message is still queued. */\nexport function showQueueRestoreFailure(mode: InteractiveModeBase, error: unknown): void {\n\tmode.showError(`Failed to restore queued messages: ${error instanceof Error ? error.message : String(error)}`);\n}\n\nInteractiveModeBase.prototype.queueCompactionMessage = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n\tmode: \"steer\" | \"followUp\",\n): void {\n\tthis.compactionQueuedMessages.push({ text, mode });\n\tthis.editor.addToHistory?.(text);\n\tthis.editor.setText(\"\");\n\tthis.updatePendingMessagesDisplay();\n\tif (this.compactionActive) {\n\t\tthis.showStatus(\"Queued message for after compaction\");\n\t\treturn;\n\t}\n\tif (!this.compactionFlushPending) void this.flushCompactionQueue({ willRetry: false });\n};\n\nInteractiveModeBase.prototype.isExtensionCommand = function (this: InteractiveModeBase, text: string): boolean {\n\tif (!text.startsWith(\"/\")) return false;\n\n\tconst extensionRunner = this.session.extensionRunner;\n\n\tconst spaceIndex = text.indexOf(\" \");\n\tconst commandName = spaceIndex === -1 ? text.slice(1) : text.slice(1, spaceIndex);\n\tif (extensionRunner.getCommand(commandName)) return true;\n\treturn getInteractiveEngineRemoteCommands(this.runtimeHost).some(\n\t\t(command) => command.source === \"extension\" && command.name === commandName,\n\t);\n};\n\nInteractiveModeBase.prototype.flushCompactionQueue = async function (\n\tthis: InteractiveModeBase,\n\toptions?: {\n\t\twillRetry?: boolean;\n\t\tafterPrompt?: boolean;\n\t},\n): Promise<void> {\n\tif (this.compactionFlushPending || this.compactionQueuedMessages.length === 0) return;\n\tif (this.promptTurn?.dispatched === false) return;\n\tthis.compactionFlushPending = true;\n\tthis.compactionSendFailed = false;\n\ttry {\n\t\tif (options?.afterPrompt === true) await sendHeldInput(this);\n\t\telse await sendCompactionQueue(this, options?.willRetry === true);\n\t} finally {\n\t\tthis.compactionFlushPending = false;\n\t\tthis.updatePendingMessagesDisplay();\n\t}\n\tconst arrivedAfterDrain =\n\t\tthis.compactionQueuedMessages.length > 0 && !this.compactionSendFailed && !this.compactionActive;\n\tif (arrivedAfterDrain) await this.flushCompactionQueue(options);\n};\n\nasync function sendCompactionQueue(mode: InteractiveModeBase, willRetry: boolean): Promise<void> {\n\tconst queueOnly = !willRetry && (mode.session.isStreaming || mode.session.queuedMessagesPaused);\n\tif (queueOnly) {\n\t\tawait drainCompactionQueue(mode, (message) =>\n\t\t\tmode.session.prompt(message.text, { streamingBehavior: message.mode }),\n\t\t);\n\t\treturn;\n\t}\n\tif (!willRetry && !(await startCompactionQueuePrompt(mode))) return;\n\tawait drainCompactionQueue(mode, (message) => {\n\t\tif (mode.isExtensionCommand(message.text)) return mode.session.prompt(message.text);\n\t\tif (message.mode === \"followUp\") return mode.session.followUp(message.text);\n\t\treturn mode.session.steer(message.text);\n\t});\n}\n\nfunction showCompactionQueueError(mode: InteractiveModeBase, error: unknown): void {\n\tmode.showError(`Failed to send queued message: ${error instanceof Error ? error.message : String(error)}`);\n}\n\nfunction takeNextCompactionMessage(mode: InteractiveModeBase): CompactionQueuedMessage | undefined {\n\tconst [next, ...rest] = mode.compactionQueuedMessages;\n\tmode.compactionQueuedMessages = rest;\n\tmode.updatePendingMessagesDisplay();\n\treturn next;\n}\n\nfunction returnCompactionMessage(mode: InteractiveModeBase, message: CompactionQueuedMessage, error: unknown): void {\n\tmode.compactionQueuedMessages = [message, ...mode.compactionQueuedMessages];\n\tmode.compactionSendFailed = true;\n\tmode.updatePendingMessagesDisplay();\n\tshowCompactionQueueError(mode, error);\n}\n\nfunction returnHandedOffMessage(mode: InteractiveModeBase, message: CompactionQueuedMessage, error: unknown): void {\n\tconst rank = handOffOrder.get(message) ?? -1;\n\tconst queue = mode.compactionQueuedMessages;\n\tconst index = queue.findIndex((queued) => (handOffOrder.get(queued) ?? Number.POSITIVE_INFINITY) > rank);\n\tmode.compactionQueuedMessages =\n\t\tindex === -1 ? [...queue, message] : [...queue.slice(0, index), message, ...queue.slice(index)];\n\tmode.compactionSendFailed = true;\n\tmode.updatePendingMessagesDisplay();\n\tshowCompactionQueueError(mode, error);\n}\n\nfunction confirmHandOff(mode: InteractiveModeBase, message: CompactionQueuedMessage): boolean {\n\tconst pending = unconfirmedHandOffs.get(mode);\n\tconst index = pending?.indexOf(message) ?? -1;\n\tif (!pending || index === -1) return false;\n\tpending.splice(index, 1);\n\tif (pending.length === 0) unconfirmedHandOffs.delete(mode);\n\tmode.updatePendingMessagesDisplay();\n\treturn true;\n}\n\n/**\n * Hand the editor's held messages to the session before an extension command runs during compaction (#4251).\n * The session registers input as it arrives and holds it until compaction ends, so a message the command sends\n * goes out after them, in typing order. Each message stays shown here until the session confirms it took it, and\n * from then on the session lists it as queued. The session's clearQueue() returns it for Alt+Up and Ctrl+C, also\n * when the confirmation is still on its way. A message the session refuses returns to the editor queue.\n */\nexport function handOffCompactionQueue(mode: InteractiveModeBase): void {\n\tconst messages = mode.compactionQueuedMessages;\n\tif (messages.length === 0) return;\n\tmode.compactionQueuedMessages = [];\n\tunconfirmedHandOffs.set(mode, [...(unconfirmedHandOffs.get(mode) ?? []), ...messages]);\n\tfor (const message of messages) {\n\t\thandOffOrder.set(message, nextHandOff++);\n\t\tlet accepted = false;\n\t\tvoid mode.session\n\t\t\t.prompt(message.text, {\n\t\t\t\tstreamingBehavior: message.mode,\n\t\t\t\tpreflightResult: (success) => {\n\t\t\t\t\taccepted = success;\n\t\t\t\t\tif (success) confirmHandOff(mode, message);\n\t\t\t\t},\n\t\t\t})\n\t\t\t.catch((error: unknown) => {\n\t\t\t\tif (accepted || isRpcRequestAcceptedFailure(error)) {\n\t\t\t\t\tconfirmHandOff(mode, message);\n\t\t\t\t\tshowCompactionQueueError(mode, error);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// Alt+Up may already have returned it to the editor; only an unconfirmed message goes back.\n\t\t\t\tif (confirmHandOff(mode, message)) returnHandedOffMessage(mode, message, error);\n\t\t\t});\n\t}\n\tmode.updatePendingMessagesDisplay();\n}\n\n/**\n * Deliver messages one at a time from the front of the compaction queue. Input submitted meanwhile\n * joins the back of that queue, so a failed message returns to the front ahead of everything after it.\n */\nasync function drainCompactionQueue(\n\tmode: InteractiveModeBase,\n\tdeliver: (message: CompactionQueuedMessage) => Promise<unknown>,\n\tlimit = Number.POSITIVE_INFINITY,\n): Promise<boolean> {\n\tfor (let delivered = 0; delivered < limit; delivered++) {\n\t\tconst message = takeNextCompactionMessage(mode);\n\t\tif (!message) break;\n\t\ttry {\n\t\t\tawait deliver(message);\n\t\t} catch (error) {\n\t\t\treturnCompactionMessage(mode, message, error);\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n/**\n * Run leading extension commands, then start the first prompt. The rest of the batch stays in the\n * compaction queue until that prompt is accepted, so a rejected prompt is restored ahead of it.\n */\nasync function startCompactionQueuePrompt(mode: InteractiveModeBase): Promise<boolean> {\n\tconst firstPromptIndex = mode.compactionQueuedMessages.findIndex(\n\t\t(message) => !mode.isExtensionCommand(message.text),\n\t);\n\tconst leadingCommands = firstPromptIndex === -1 ? mode.compactionQueuedMessages.length : firstPromptIndex;\n\tconst ranCommands = await drainCompactionQueue(\n\t\tmode,\n\t\t(message) => mode.session.prompt(message.text),\n\t\tleadingCommands,\n\t);\n\tif (!ranCommands) return false;\n\tconst first = takeNextCompactionMessage(mode);\n\tif (!first) return false;\n\tconst refused = await promptUntilAccepted(mode, first);\n\tif (refused === undefined) return true;\n\treturnCompactionMessage(mode, first, refused.error);\n\treturn false;\n}\n\nasync function promptUntilAccepted(\n\tmode: InteractiveModeBase,\n\tmessage: CompactionQueuedMessage,\n\tonQueued?: () => void,\n): Promise<{ error: unknown } | undefined> {\n\tlet accept!: (accepted: boolean) => void;\n\tconst accepted = new Promise<boolean>((resolve) => {\n\t\taccept = resolve;\n\t});\n\tconst prompt = mode.session.prompt(message.text, {\n\t\tstreamingBehavior: message.mode,\n\t\tpreflightResult: (success, disposition) => {\n\t\t\tif (success && disposition === \"queued\") onQueued?.();\n\t\t\taccept(success);\n\t\t},\n\t});\n\tprompt.then(\n\t\t() => accept(true),\n\t\t(error: unknown) => accept(isRpcRequestAcceptedFailure(error)),\n\t);\n\tif (await accepted) {\n\t\tprompt.catch((error) => showCompactionQueueError(mode, error));\n\t\treturn undefined;\n\t}\n\treturn {\n\t\terror: await prompt.then(\n\t\t\t() => undefined,\n\t\t\t(error: unknown) => error,\n\t\t),\n\t};\n}\n\nasync function sendHeldInput(mode: InteractiveModeBase): Promise<void> {\n\twhile (mode.compactionQueuedMessages.length > 0) {\n\t\tconst message = takeNextCompactionMessage(mode);\n\t\tif (!message) return;\n\t\tconst echoed = !message.text.startsWith(\"/\");\n\t\tif (echoed) mode.renderDeferredUserInput(message.text);\n\t\tconst refused = await promptUntilAccepted(\n\t\t\tmode,\n\t\t\tmessage,\n\t\t\techoed ? () => mode.discardDeferredRenderedUserInput(message.text) : undefined,\n\t\t);\n\t\tif (refused !== undefined) {\n\t\t\tif (echoed) mode.discardDeferredRenderedUserInput(message.text);\n\t\t\treturnCompactionMessage(mode, message, refused.error);\n\t\t\treturn;\n\t\t}\n\t}\n}\n\nInteractiveModeBase.prototype.flushPendingBashComponents = function (this: InteractiveModeBase): void {\n\tfor (const component of this.pendingBashComponents) {\n\t\tthis.pendingMessagesContainer.removeChild(component);\n\t\tthis.chatContainer.addChild(component);\n\t}\n\tthis.pendingBashComponents = [];\n};\n"]}
1
+ {"version":3,"file":"interactive-queueing.js","sourceRoot":"","sources":["../../../src/modes/interactive/interactive-queueing.ts"],"names":[],"mappings":"AACA,OAAO,EACN,2BAA2B,EAC3B,kCAAkC,GAClC,MAAM,8CAA8C,CAAC;AACtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,8BAA8B,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAG1G,kGAAkG;AAClG,MAAM,YAAY,GAAG,IAAI,OAAO,EAAmC,CAAC;AACpE,IAAI,WAAW,GAAG,CAAC,CAAC;AACpB;;;;GAIG;AACH,MAAM,mBAAmB,GAAG,IAAI,OAAO,EAAkD,CAAC;AAE1F,SAAS,YAAY,CAAC,IAAyB;IAC9C,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,wBAAwB,CAAC,CAAC;AACrF,CAAC;AAED,mBAAmB,CAAC,SAAS,CAAC,oBAAoB,GAAG;IAIpD,MAAM,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAChC,OAAO;QACN,QAAQ,EAAE;YACT,GAAG,IAAI,CAAC,OAAO,CAAC,mBAAmB,EAAE;YAC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WAAW,GAAG,IAAI,CAAC,0BAA0B,CAAC;QACpD,MAAM,OAAO,GAAG,MAAM,mBAAmB,CACxC,IAAI,EACJ,OAAO,EACP,MAAM;YACL,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE;gBAChB,IAAI,WAAW,KAAK,QAAQ,IAAI,WAAW,KAAK,SAAS;oBACxD,IAAI,CAAC,gCAAgC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBACrD,IAAI,WAAW,KAAK,SAAS;oBAAE,IAAI,CAAC,sBAAsB,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;YACvF,CAAC;YACF,CAAC,CAAC,SAAS,CACZ,CAAC;QACF,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC3B,IAAI,MAAM;gBAAE,IAAI,CAAC,gCAAgC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAChE,uBAAuB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;YACtD,OAAO;QACR,CAAC;IACF,CAAC;AACF,CAAC;AAED,mBAAmB,CAAC,SAAS,CAAC,0BAA0B,GAAG;IAC1D,KAAK,MAAM,SAAS,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC;QACpD,IAAI,CAAC,wBAAwB,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;QACrD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IACD,IAAI,CAAC,qBAAqB,GAAG,EAAE,CAAC;AACjC,CAAC,CAAC","sourcesContent":["import type { ClearedQueue, PromptDisposition } from \"../../core/agent-session-types.js\";\nimport {\n\tclearInteractiveEngineQueue,\n\tgetInteractiveEngineRemoteCommands,\n} from \"../interactive-engine/extension-ui-bridge.ts\";\nimport { isRpcRequestAcceptedFailure } from \"../rpc/rpc-transport-error.ts\";\nimport { InteractiveModeBase } from \"./interactive-mode-base.ts\";\nimport { combineQueuedMessagesForEditor, Spacer, TruncatedText, theme } from \"./interactive-mode-deps.ts\";\nimport type { CompactionQueuedMessage } from \"./interactive-mode-types.ts\";\n\n/** Typing order of messages handed to the session, so one it refuses returns to its own place. */\nconst handOffOrder = new WeakMap<CompactionQueuedMessage, number>();\nlet nextHandOff = 0;\n/**\n * Messages handed to the session that it has not confirmed yet. The editor keeps showing them until the session\n * reports it took them; from then on the session lists them itself. They are the session's from the moment they\n * are sent, so a restore takes them from the session's own answer and never from this copy.\n */\nconst unconfirmedHandOffs = new WeakMap<InteractiveModeBase, CompactionQueuedMessage[]>();\n\nfunction heldByEditor(mode: InteractiveModeBase): CompactionQueuedMessage[] {\n\treturn [...(unconfirmedHandOffs.get(mode) ?? []), ...mode.compactionQueuedMessages];\n}\n\nInteractiveModeBase.prototype.getAllQueuedMessages = function (this: InteractiveModeBase): {\n\tsteering: string[];\n\tfollowUp: string[];\n} {\n\tconst held = heldByEditor(this);\n\treturn {\n\t\tsteering: [\n\t\t\t...this.session.getSteeringMessages(),\n\t\t\t...held.filter((msg) => msg.mode === \"steer\").map((msg) => msg.text),\n\t\t],\n\t\tfollowUp: [\n\t\t\t...this.session.getFollowUpMessages(),\n\t\t\t...held.filter((msg) => msg.mode === \"followUp\").map((msg) => msg.text),\n\t\t],\n\t};\n};\n\n/**\n * Take every queued message back from the session and this editor, so the caller can restore them.\n *\n * What the session removed is its own answer, not this editor's copy of its queue. An engine child lists its queue\n * by `queue_update` events that trail it by a round trip, so a message it queued meanwhile is missing from the copy\n * and one it already took into a turn is still in it (#4257). The messages only this editor holds follow them.\n * When the session cannot be reached nothing is removed and the held messages stay queued.\n */\nInteractiveModeBase.prototype.clearAllQueues = async function (\n\tthis: InteractiveModeBase,\n\toptions?: { preserveUnprotectedCustomMessages?: boolean },\n): Promise<{\n\tsteering: string[];\n\tfollowUp: string[];\n}> {\n\t// Leave the editor queue now, so nothing sends these messages while the session answers.\n\tconst held = this.compactionQueuedMessages;\n\tconst heldSendFailed = this.compactionSendFailed;\n\tthis.compactionQueuedMessages = [];\n\tthis.compactionSendFailed = false;\n\tlet removed: ClearedQueue;\n\ttry {\n\t\tconst clearing =\n\t\t\tclearInteractiveEngineQueue(this.runtimeHost) ?? Promise.resolve(this.session.clearQueue(options));\n\t\tthis.updatePendingMessagesDisplay();\n\t\tremoved = await clearing;\n\t} catch (error) {\n\t\tthis.compactionQueuedMessages = [...held, ...this.compactionQueuedMessages];\n\t\t// If compaction ended meanwhile, its flush found the queue empty and nothing else will send these. Marked as\n\t\t// unsent, they go out in order ahead of the next submission, as a batch whose first send failed does.\n\t\tthis.compactionSendFailed ||= heldSendFailed || (held.length > 0 && !this.compactionActive);\n\t\tthis.updatePendingMessagesDisplay();\n\t\tthrow error;\n\t}\n\t// Each message goes back as it was typed, so sending it again runs `input` hooks and expansions once (#4284).\n\t// A session from before `typed` was added gives back only the text it queued.\n\tconst typed = removed.typed ?? removed;\n\t// A hand-off the session has not confirmed yet is the session's: it either lists it or reports its refusal.\n\treturn {\n\t\tsteering: [...typed.steering, ...held.filter((msg) => msg.mode === \"steer\").map((msg) => msg.text)],\n\t\tfollowUp: [...typed.followUp, ...held.filter((msg) => msg.mode === \"followUp\").map((msg) => msg.text)],\n\t};\n};\n\nInteractiveModeBase.prototype.updatePendingMessagesDisplay = function (this: InteractiveModeBase): void {\n\tthis.pendingMessagesContainer.clear();\n\tconst { steering: steeringMessages, followUp: followUpMessages } = this.getAllQueuedMessages();\n\tif (steeringMessages.length > 0 || followUpMessages.length > 0) {\n\t\tthis.pendingMessagesContainer.addChild(new Spacer(1));\n\t\tfor (const message of steeringMessages) {\n\t\t\tconst text = theme.fg(\"dim\", `Steering: ${message}`);\n\t\t\tthis.pendingMessagesContainer.addChild(new TruncatedText(text, 1, 0));\n\t\t}\n\t\tfor (const message of followUpMessages) {\n\t\t\tconst text = theme.fg(\"dim\", `Follow-up: ${message}`);\n\t\t\tthis.pendingMessagesContainer.addChild(new TruncatedText(text, 1, 0));\n\t\t}\n\t\tconst dequeueHint = this.getAppKeyDisplay(\"app.message.dequeue\");\n\t\tconst hintText = theme.fg(\"dim\", `↳ ${dequeueHint} to edit all queued messages`);\n\t\tthis.pendingMessagesContainer.addChild(new TruncatedText(hintText, 1, 0));\n\t}\n};\n\nInteractiveModeBase.prototype.restoreQueuedMessagesToEditor = async function (\n\tthis: InteractiveModeBase,\n\toptions?: {\n\t\tabort?: boolean;\n\t\tcurrentText?: string;\n\t\tpreserveUnprotectedCustomMessages?: boolean;\n\t},\n): Promise<number> {\n\tconst { steering, followUp } = await this.clearAllQueues(options);\n\tconst allQueued = [...steering, ...followUp];\n\tif (allQueued.length === 0) {\n\t\tthis.updatePendingMessagesDisplay();\n\t\tif (options?.abort) {\n\t\t\tvoid this.session.abort();\n\t\t}\n\t\treturn 0;\n\t}\n\tconst currentText = options?.currentText ?? this.editor.getText();\n\tconst combinedText = combineQueuedMessagesForEditor(allQueued, currentText);\n\tthis.editor.setText(combinedText);\n\tthis.updatePendingMessagesDisplay();\n\tif (options?.abort) {\n\t\tvoid this.session.abort();\n\t}\n\treturn allQueued.length;\n};\n\n/** Report a restore the session could not answer; nothing was removed, so every message is still queued. */\nexport function showQueueRestoreFailure(mode: InteractiveModeBase, error: unknown): void {\n\tmode.showError(`Failed to restore queued messages: ${error instanceof Error ? error.message : String(error)}`);\n}\n\nInteractiveModeBase.prototype.queueCompactionMessage = function (\n\tthis: InteractiveModeBase,\n\ttext: string,\n\tmode: \"steer\" | \"followUp\",\n): void {\n\tthis.compactionQueuedMessages.push({ text, mode });\n\tthis.editor.addToHistory?.(text);\n\tthis.editor.setText(\"\");\n\tthis.updatePendingMessagesDisplay();\n\tif (this.compactionActive) {\n\t\tthis.showStatus(\"Queued message for after compaction\");\n\t\treturn;\n\t}\n\tif (!this.compactionFlushPending) void this.flushCompactionQueue({ willRetry: false });\n};\n\nInteractiveModeBase.prototype.isExtensionCommand = function (this: InteractiveModeBase, text: string): boolean {\n\tif (!text.startsWith(\"/\")) return false;\n\n\tconst extensionRunner = this.session.extensionRunner;\n\n\tconst spaceIndex = text.indexOf(\" \");\n\tconst commandName = spaceIndex === -1 ? text.slice(1) : text.slice(1, spaceIndex);\n\tif (extensionRunner.getCommand(commandName)) return true;\n\treturn getInteractiveEngineRemoteCommands(this.runtimeHost).some(\n\t\t(command) => command.source === \"extension\" && command.name === commandName,\n\t);\n};\n\nInteractiveModeBase.prototype.flushCompactionQueue = async function (\n\tthis: InteractiveModeBase,\n\toptions?: {\n\t\twillRetry?: boolean;\n\t\tafterPrompt?: boolean;\n\t},\n): Promise<void> {\n\tif (this.compactionFlushPending || this.compactionQueuedMessages.length === 0) return;\n\tif (this.promptTurn?.dispatched === false) return;\n\tthis.compactionFlushPending = true;\n\tthis.compactionSendFailed = false;\n\ttry {\n\t\tif (options?.afterPrompt === true) await sendHeldInput(this);\n\t\telse await sendCompactionQueue(this, options?.willRetry === true);\n\t} finally {\n\t\tthis.compactionFlushPending = false;\n\t\tthis.updatePendingMessagesDisplay();\n\t}\n\tconst arrivedAfterDrain =\n\t\tthis.compactionQueuedMessages.length > 0 && !this.compactionSendFailed && !this.compactionActive;\n\tif (arrivedAfterDrain) await this.flushCompactionQueue(options);\n};\n\nasync function sendCompactionQueue(mode: InteractiveModeBase, willRetry: boolean): Promise<void> {\n\tconst queueOnly = !willRetry && (mode.session.isStreaming || mode.session.queuedMessagesPaused);\n\tif (queueOnly) {\n\t\tawait drainCompactionQueue(mode, (message) =>\n\t\t\tmode.session.prompt(message.text, { streamingBehavior: message.mode }),\n\t\t);\n\t\treturn;\n\t}\n\tif (!willRetry && !(await startCompactionQueuePrompt(mode))) return;\n\tawait drainCompactionQueue(mode, (message) => {\n\t\tif (mode.isExtensionCommand(message.text)) return mode.session.prompt(message.text);\n\t\tif (message.mode === \"followUp\") return mode.session.followUp(message.text);\n\t\treturn mode.session.steer(message.text);\n\t});\n}\n\nfunction showCompactionQueueError(mode: InteractiveModeBase, error: unknown): void {\n\tmode.showError(`Failed to send queued message: ${error instanceof Error ? error.message : String(error)}`);\n}\n\nfunction takeNextCompactionMessage(mode: InteractiveModeBase): CompactionQueuedMessage | undefined {\n\tconst [next, ...rest] = mode.compactionQueuedMessages;\n\tmode.compactionQueuedMessages = rest;\n\tmode.updatePendingMessagesDisplay();\n\treturn next;\n}\n\nfunction returnCompactionMessage(mode: InteractiveModeBase, message: CompactionQueuedMessage, error: unknown): void {\n\tmode.compactionQueuedMessages = [message, ...mode.compactionQueuedMessages];\n\tmode.compactionSendFailed = true;\n\tmode.updatePendingMessagesDisplay();\n\tshowCompactionQueueError(mode, error);\n}\n\nfunction returnHandedOffMessage(mode: InteractiveModeBase, message: CompactionQueuedMessage, error: unknown): void {\n\tconst rank = handOffOrder.get(message) ?? -1;\n\tconst queue = mode.compactionQueuedMessages;\n\tconst index = queue.findIndex((queued) => (handOffOrder.get(queued) ?? Number.POSITIVE_INFINITY) > rank);\n\tmode.compactionQueuedMessages =\n\t\tindex === -1 ? [...queue, message] : [...queue.slice(0, index), message, ...queue.slice(index)];\n\tmode.compactionSendFailed = true;\n\tmode.updatePendingMessagesDisplay();\n\tshowCompactionQueueError(mode, error);\n}\n\nfunction confirmHandOff(mode: InteractiveModeBase, message: CompactionQueuedMessage): boolean {\n\tconst pending = unconfirmedHandOffs.get(mode);\n\tconst index = pending?.indexOf(message) ?? -1;\n\tif (!pending || index === -1) return false;\n\tpending.splice(index, 1);\n\tif (pending.length === 0) unconfirmedHandOffs.delete(mode);\n\tmode.updatePendingMessagesDisplay();\n\treturn true;\n}\n\n/**\n * Hand the editor's held messages to the session before an extension command runs during compaction (#4251).\n * The session registers input as it arrives and holds it until compaction ends, so a message the command sends\n * goes out after them, in typing order. Each message stays shown here until the session confirms it took it, and\n * from then on the session lists it as queued. The session's clearQueue() returns it for Alt+Up and Ctrl+C, also\n * when the confirmation is still on its way. A message the session refuses returns to the editor queue.\n */\nexport function handOffCompactionQueue(mode: InteractiveModeBase): void {\n\tconst messages = mode.compactionQueuedMessages;\n\tif (messages.length === 0) return;\n\tmode.compactionQueuedMessages = [];\n\tunconfirmedHandOffs.set(mode, [...(unconfirmedHandOffs.get(mode) ?? []), ...messages]);\n\tfor (const message of messages) {\n\t\thandOffOrder.set(message, nextHandOff++);\n\t\tlet accepted = false;\n\t\tvoid mode.session\n\t\t\t.prompt(message.text, {\n\t\t\t\tstreamingBehavior: message.mode,\n\t\t\t\tpreflightResult: (success) => {\n\t\t\t\t\taccepted = success;\n\t\t\t\t\tif (success) confirmHandOff(mode, message);\n\t\t\t\t},\n\t\t\t})\n\t\t\t.catch((error: unknown) => {\n\t\t\t\tif (accepted || isRpcRequestAcceptedFailure(error)) {\n\t\t\t\t\tconfirmHandOff(mode, message);\n\t\t\t\t\tshowCompactionQueueError(mode, error);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t// Alt+Up may already have returned it to the editor; only an unconfirmed message goes back.\n\t\t\t\tif (confirmHandOff(mode, message)) returnHandedOffMessage(mode, message, error);\n\t\t\t});\n\t}\n\tmode.updatePendingMessagesDisplay();\n}\n\n/**\n * Deliver messages one at a time from the front of the compaction queue. Input submitted meanwhile\n * joins the back of that queue, so a failed message returns to the front ahead of everything after it.\n */\nasync function drainCompactionQueue(\n\tmode: InteractiveModeBase,\n\tdeliver: (message: CompactionQueuedMessage) => Promise<unknown>,\n\tlimit = Number.POSITIVE_INFINITY,\n): Promise<boolean> {\n\tfor (let delivered = 0; delivered < limit; delivered++) {\n\t\tconst message = takeNextCompactionMessage(mode);\n\t\tif (!message) break;\n\t\ttry {\n\t\t\tawait deliver(message);\n\t\t} catch (error) {\n\t\t\treturnCompactionMessage(mode, message, error);\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n/**\n * Run leading extension commands, then start the first prompt. The rest of the batch stays in the\n * compaction queue until that prompt is accepted, so a rejected prompt is restored ahead of it.\n */\nasync function startCompactionQueuePrompt(mode: InteractiveModeBase): Promise<boolean> {\n\tconst firstPromptIndex = mode.compactionQueuedMessages.findIndex(\n\t\t(message) => !mode.isExtensionCommand(message.text),\n\t);\n\tconst leadingCommands = firstPromptIndex === -1 ? mode.compactionQueuedMessages.length : firstPromptIndex;\n\tconst ranCommands = await drainCompactionQueue(\n\t\tmode,\n\t\t(message) => mode.session.prompt(message.text),\n\t\tleadingCommands,\n\t);\n\tif (!ranCommands) return false;\n\tconst first = takeNextCompactionMessage(mode);\n\tif (!first) return false;\n\tconst refused = await promptUntilAccepted(mode, first);\n\tif (refused === undefined) return true;\n\treturnCompactionMessage(mode, first, refused.error);\n\treturn false;\n}\n\nasync function promptUntilAccepted(\n\tmode: InteractiveModeBase,\n\tmessage: CompactionQueuedMessage,\n\tonAccepted?: (disposition: PromptDisposition | undefined) => void,\n): Promise<{ error: unknown } | undefined> {\n\tlet accept!: (accepted: boolean) => void;\n\tconst accepted = new Promise<boolean>((resolve) => {\n\t\taccept = resolve;\n\t});\n\tconst prompt = mode.session.prompt(message.text, {\n\t\tstreamingBehavior: message.mode,\n\t\tpreflightResult: (success, disposition) => {\n\t\t\tif (success) onAccepted?.(disposition);\n\t\t\taccept(success);\n\t\t},\n\t});\n\tprompt.then(\n\t\t() => accept(true),\n\t\t(error: unknown) => accept(isRpcRequestAcceptedFailure(error)),\n\t);\n\tif (await accepted) {\n\t\tprompt.catch((error) => showCompactionQueueError(mode, error));\n\t\treturn undefined;\n\t}\n\treturn {\n\t\terror: await prompt.then(\n\t\t\t() => undefined,\n\t\t\t(error: unknown) => error,\n\t\t),\n\t};\n}\n\nasync function sendHeldInput(mode: InteractiveModeBase): Promise<void> {\n\twhile (mode.compactionQueuedMessages.length > 0) {\n\t\tconst message = takeNextCompactionMessage(mode);\n\t\tif (!message) return;\n\t\tconst echoed = !message.text.startsWith(\"/\");\n\t\tif (echoed) mode.renderDeferredUserInput(message.text);\n\t\tconst shownBefore = mode.userMessagesShownBySession;\n\t\tconst refused = await promptUntilAccepted(\n\t\t\tmode,\n\t\t\tmessage,\n\t\t\techoed\n\t\t\t\t? (disposition) => {\n\t\t\t\t\t\tif (disposition === \"queued\" || disposition === \"handled\")\n\t\t\t\t\t\t\tmode.discardDeferredRenderedUserInput(message.text);\n\t\t\t\t\t\tif (disposition === \"started\") mode.expectStartedUserInput(message.text, shownBefore);\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t\t);\n\t\tif (refused !== undefined) {\n\t\t\tif (echoed) mode.discardDeferredRenderedUserInput(message.text);\n\t\t\treturnCompactionMessage(mode, message, refused.error);\n\t\t\treturn;\n\t\t}\n\t}\n}\n\nInteractiveModeBase.prototype.flushPendingBashComponents = function (this: InteractiveModeBase): void {\n\tfor (const component of this.pendingBashComponents) {\n\t\tthis.pendingMessagesContainer.removeChild(component);\n\t\tthis.chatContainer.addChild(component);\n\t}\n\tthis.pendingBashComponents = [];\n};\n"]}
@@ -9,10 +9,12 @@ import { IsolatedInteractiveRuntime } from "../interactive-engine/isolated-runti
9
9
  import { RemoteCustomMessageComponent, RemoteToolExecutionComponent } from "../interactive-engine/remote-renderer.js";
10
10
  import { appendBoundedStderr } from "../rpc/rpc-client-process.js";
11
11
  import { CustomEntryComponent } from "./components/custom-entry.js";
12
+ import { createMarkdownTransform } from "./components/markdown-transform.js";
12
13
  import { createMermaidMarkdownTransformer } from "./components/mermaid.js";
13
14
  import { ThemedText } from "./components/themed-text.js";
15
+ import { appendNewChildrenBeforeAttachedChild } from "./interactive-child-ordering.js";
14
16
  import { InteractiveModeBase } from "./interactive-mode-base.js";
15
- import { APP_NAME, AssistantMessageComponent, addChatTranscriptEntry, BashExecutionComponent, BranchSummaryMessageComponent, CompactionBoundaryMessageComponent, CustomMessageComponent, chatEntriesFromAgentMessages, hasTrustRequiringProjectResources, parseSkillBlock, recordTimeSinceReset, renderChatMessageEntry, SkillInvocationMessageComponent, Spacer, Text, ToolExecutionComponent, theme, UserMessageComponent, } from "./interactive-mode-deps.js";
17
+ import { APP_NAME, AssistantMessageComponent, addChatTranscriptEntry, BashExecutionComponent, BranchSummaryMessageComponent, CompactionBoundaryMessageComponent, CustomMessageComponent, chatEntriesFromAgentMessages, hasTrustRequiringProjectResources, Markdown, parseSkillBlock, recordTimeSinceReset, renderChatMessageEntry, SkillInvocationMessageComponent, Spacer, Text, ToolExecutionComponent, theme, UserMessageComponent, } from "./interactive-mode-deps.js";
16
18
  import { refreshInteractiveTasks } from "./interactive-task-projection.js";
17
19
  function countDroppedThinkingBlocks(message) {
18
20
  return (message.diagnostics ?? []).reduce((count, diagnostic) => {
@@ -107,6 +109,8 @@ InteractiveModeBase.prototype.consumeDeferredRenderedUserInput = function (text)
107
109
  if (index === -1)
108
110
  return false;
109
111
  this.deferredRenderedUserInputs.splice(index, 1);
112
+ if (this.startedDeferredUserInput === text)
113
+ this.startedDeferredUserInput = undefined;
110
114
  const trackedComponents = this.deferredRenderedUserInputComponents.get(text);
111
115
  trackedComponents?.shift();
112
116
  if (trackedComponents && trackedComponents.length === 0) {
@@ -116,8 +120,11 @@ InteractiveModeBase.prototype.consumeDeferredRenderedUserInput = function (text)
116
120
  };
117
121
  InteractiveModeBase.prototype.discardDeferredRenderedUserInput = function (text) {
118
122
  const index = this.deferredRenderedUserInputs.indexOf(text);
119
- if (index !== -1)
123
+ if (index !== -1) {
120
124
  this.deferredRenderedUserInputs.splice(index, 1);
125
+ if (this.startedDeferredUserInput === text)
126
+ this.startedDeferredUserInput = undefined;
127
+ }
121
128
  const trackedComponents = this.deferredRenderedUserInputComponents.get(text);
122
129
  const componentsToRemove = trackedComponents?.shift();
123
130
  if (trackedComponents && trackedComponents.length === 0) {
@@ -131,6 +138,36 @@ InteractiveModeBase.prototype.discardDeferredRenderedUserInput = function (text)
131
138
  this.updatePendingMessagesDisplay();
132
139
  this.ui.requestRender();
133
140
  };
141
+ /**
142
+ * The session started a run for a submission this host echoed as `text`. The run begins with the submission's message,
143
+ * as sent: an `input` hook may have rewritten it, so its `message_start` need not match the echo (#4277). An engine's
144
+ * answer can reach the host after that `message_start`, which the session then showed itself (#4272): if it showed any
145
+ * message of its own since `shownBefore`, the echo goes. Otherwise the session's next message that matches no echo
146
+ * takes the echo's place. A run starts only after the one before it showed its message, so an earlier run still
147
+ * waiting here never got to show it, and its echo stays as it is.
148
+ */
149
+ InteractiveModeBase.prototype.expectStartedUserInput = function (text, shownBefore) {
150
+ if (!this.deferredRenderedUserInputs.includes(text))
151
+ return;
152
+ if (this.userMessagesShownBySession !== shownBefore)
153
+ this.discardDeferredRenderedUserInput(text);
154
+ else
155
+ this.startedDeferredUserInput = text;
156
+ };
157
+ /** Show a user message from the session: in place of its echo, or of the echo of the run it started, or as new. */
158
+ InteractiveModeBase.prototype.showSessionUserMessage = function (message) {
159
+ if (this.consumeDeferredRenderedUserInput(this.getUserMessageText(message)))
160
+ return;
161
+ const started = this.startedDeferredUserInput;
162
+ if (started !== undefined) {
163
+ const echo = this.deferredRenderedUserInputComponents.get(started)?.[0];
164
+ appendNewChildrenBeforeAttachedChild(this.chatContainer, echo?.[0], () => this.addMessageToChat(message));
165
+ this.discardDeferredRenderedUserInput(started);
166
+ return;
167
+ }
168
+ this.userMessagesShownBySession += 1;
169
+ this.addMessageToChat(message);
170
+ };
134
171
  InteractiveModeBase.prototype.getMarkdownTransformers = function () {
135
172
  const mode = this.settingsManager.getMermaidRenderingMode();
136
173
  if (this.mermaidMarkdownTransformerMode !== mode) {
@@ -145,6 +182,15 @@ InteractiveModeBase.prototype.getMarkdownTransformers = function () {
145
182
  : this.session.extensionRunner.getMarkdownTransformers();
146
183
  return [this.mermaidMarkdownTransformer, ...extensionTransformers];
147
184
  };
185
+ /**
186
+ * Markdown of a changelog that runs the Markdown transformers registered for the `changelog` type. Transformers are
187
+ * looked up on each render, so a notice shown before deferred extensions load uses them once it is invalidated.
188
+ */
189
+ InteractiveModeBase.prototype.createChangelogMarkdown = function (markdown, paddingX, paddingY) {
190
+ return new Markdown(markdown, paddingX, paddingY, this.getMarkdownThemeWithSettings(), undefined, {
191
+ transform: (text, width) => createMarkdownTransform("changelog", () => false, this.getMarkdownTransformers())(text, width),
192
+ });
193
+ };
148
194
  InteractiveModeBase.prototype.chatMessageRenderOptions = function () {
149
195
  const isolated = this.runtimeHost instanceof IsolatedInteractiveRuntime;
150
196
  return {
@@ -236,7 +282,7 @@ InteractiveModeBase.prototype.addMessageToChat = function (message, options) {
236
282
  if (message.display) {
237
283
  const component = this.runtimeHost instanceof IsolatedInteractiveRuntime
238
284
  ? new RemoteCustomMessageComponent(message, this.runtimeHost, () => this.ui.requestRender(), this.outputPad)
239
- : new CustomMessageComponent(message, this.session.extensionRunner.getMessageRenderer(message.customType), this.getMarkdownThemeWithSettings(), this.outputPad, this.settingsManager.getLatexRenderingEnabled());
285
+ : new CustomMessageComponent(message, this.session.extensionRunner.getMessageRenderer(message.customType), this.getMarkdownThemeWithSettings(), this.outputPad, this.settingsManager.getLatexRenderingEnabled(), markdownTransformers);
240
286
  component.setExpanded(this.toolOutputExpanded);
241
287
  this.chatContainer.addChild(component);
242
288
  }
@@ -244,7 +290,7 @@ InteractiveModeBase.prototype.addMessageToChat = function (message, options) {
244
290
  }
245
291
  case "branchSummary": {
246
292
  this.chatContainer.addChild(new Spacer(1));
247
- const component = new BranchSummaryMessageComponent(message, this.getMarkdownThemeWithSettings(), this.settingsManager.getLatexRenderingEnabled(), this.outputPad);
293
+ const component = new BranchSummaryMessageComponent(message, this.getMarkdownThemeWithSettings(), this.settingsManager.getLatexRenderingEnabled(), this.outputPad, markdownTransformers);
248
294
  component.setExpanded(this.toolOutputExpanded);
249
295
  this.chatContainer.addChild(component);
250
296
  break;
@@ -258,7 +304,7 @@ InteractiveModeBase.prototype.addMessageToChat = function (message, options) {
258
304
  const skillBlock = parseSkillBlock(textContent);
259
305
  if (skillBlock) {
260
306
  // Render skill block (collapsible)
261
- const component = new SkillInvocationMessageComponent(skillBlock, this.getMarkdownThemeWithSettings(), this.settingsManager.getLatexRenderingEnabled(), this.outputPad);
307
+ const component = new SkillInvocationMessageComponent(skillBlock, this.getMarkdownThemeWithSettings(), this.settingsManager.getLatexRenderingEnabled(), this.outputPad, markdownTransformers);
262
308
  component.setExpanded(this.toolOutputExpanded);
263
309
  this.chatContainer.addChild(component);
264
310
  // Render user message separately if present