@pheem49/mint 1.15.0 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1162) hide show
  1. package/Cargo.lock +1012 -69
  2. package/Cargo.toml +5 -2
  3. package/LICENSE +21 -654
  4. package/README.md +92 -817
  5. package/Release_Note.md +71 -579
  6. package/apps/mint-companion/src-tauri/Cargo.toml +20 -0
  7. package/apps/mint-companion/src-tauri/build.rs +3 -0
  8. package/apps/mint-companion/src-tauri/src/compact.rs +69 -0
  9. package/apps/mint-companion/src-tauri/src/main.rs +675 -0
  10. package/apps/mint-companion/tsconfig.json +20 -0
  11. package/apps/mint-companion/vite.config.ts +4 -0
  12. package/components.json +19 -0
  13. package/crates/mint-cli/Cargo.toml +6 -0
  14. package/crates/mint-cli/src/agent/live_status.rs +230 -41
  15. package/crates/mint-cli/src/agent.rs +476 -108
  16. package/crates/mint-cli/src/commands/agent.rs +294 -86
  17. package/crates/mint-cli/src/commands/browser.rs +127 -0
  18. package/crates/mint-cli/src/commands/config.rs +14 -1
  19. package/crates/mint-cli/src/commands/integrations.rs +7 -0
  20. package/crates/mint-cli/src/commands/knowledge.rs +28 -34
  21. package/crates/mint-cli/src/commands/mod.rs +59 -1
  22. package/crates/mint-cli/src/commands/tailnet_web.rs +2 -7
  23. package/crates/mint-cli/src/companion_navigation.rs +268 -0
  24. package/crates/mint-cli/src/image.rs +31 -33
  25. package/crates/mint-cli/src/interactive/chat_tui.rs +4977 -864
  26. package/crates/mint-cli/src/interactive/command_ui.rs +39 -0
  27. package/crates/mint-cli/src/interactive/input_box.rs +56 -6
  28. package/crates/mint-cli/src/interactive/slash_commands.rs +321 -61
  29. package/crates/mint-cli/src/interactive/tool_activity.rs +667 -0
  30. package/crates/mint-cli/src/interactive.rs +93 -37
  31. package/crates/mint-cli/src/main.rs +36 -9
  32. package/crates/mint-cli/src/mcp.rs +5 -0
  33. package/crates/mint-cli/src/mod_host.rs +6 -0
  34. package/crates/mint-cli/src/mods_cli.rs +62 -0
  35. package/crates/mint-cli/src/mods_ui.rs +187 -0
  36. package/crates/mint-cli/src/onboard.rs +3492 -1360
  37. package/crates/mint-cli/src/terminal_theme.rs +3 -1
  38. package/crates/mint-cli/src/updater.rs +56 -2
  39. package/crates/mint-cli/tests/library_intake.rs +77 -0
  40. package/crates/mint-cli/tests/mods_testing.rs +137 -0
  41. package/crates/mint-companion-protocol/Cargo.toml +10 -0
  42. package/crates/mint-companion-protocol/src/lib.rs +276 -0
  43. package/crates/mint-core/Cargo.toml +6 -3
  44. package/crates/mint-core/build.rs +26 -0
  45. package/crates/mint-core/src/agent/chat.rs +406 -39
  46. package/crates/mint-core/src/agent/code_tools.rs +15 -0
  47. package/crates/mint-core/src/agent/memory/sources.rs +240 -0
  48. package/crates/mint-core/src/agent/memory.rs +220 -19
  49. package/crates/mint-core/src/agent/safety.rs +56 -4
  50. package/crates/mint-core/src/agent/skill_inventory.rs +327 -0
  51. package/crates/mint-core/src/agent/skills.rs +438 -90
  52. package/crates/mint-core/src/agent.rs +1 -0
  53. package/crates/mint-core/src/api_server/routes/auth.rs +1 -4
  54. package/crates/mint-core/src/api_server/routes/background_jobs.rs +310 -0
  55. package/crates/mint-core/src/api_server/routes/chat.rs +245 -214
  56. package/crates/mint-core/src/api_server/routes/html_preview.rs +77 -0
  57. package/crates/mint-core/src/api_server/routes/library.rs +97 -0
  58. package/crates/mint-core/src/api_server/routes/media_gen.rs +10 -57
  59. package/crates/mint-core/src/api_server/routes/misc.rs +220 -107
  60. package/crates/mint-core/src/api_server/routes/mod.rs +6 -0
  61. package/crates/mint-core/src/api_server/routes/mods.rs +31 -0
  62. package/crates/mint-core/src/api_server/routes/profile_oauth.rs +43 -26
  63. package/crates/mint-core/src/api_server/routes/sessions.rs +127 -69
  64. package/crates/mint-core/src/api_server/routes/skills_subagents.rs +16 -42
  65. package/crates/mint-core/src/api_server/routes/slash.rs +50 -1
  66. package/crates/mint-core/src/api_server/routes/sources.rs +101 -0
  67. package/crates/mint-core/src/api_server/routes/status_health.rs +18 -8
  68. package/crates/mint-core/src/api_server.rs +327 -72
  69. package/crates/mint-core/src/avatar_bridge.rs +15 -3
  70. package/crates/mint-core/src/browser/cdp.rs +82 -26
  71. package/crates/mint-core/src/browser/lifecycle.rs +143 -43
  72. package/crates/mint-core/src/browser/mod.rs +5 -4
  73. package/crates/mint-core/src/browser/navigate.rs +82 -9
  74. package/crates/mint-core/src/browser/runtime.rs +284 -0
  75. package/crates/mint-core/src/browser/session.rs +315 -7
  76. package/crates/mint-core/src/browser/workflow.rs +386 -0
  77. package/crates/mint-core/src/companion/navigation.rs +115 -0
  78. package/crates/mint-core/src/companion.rs +824 -0
  79. package/crates/mint-core/src/cron/scheduler.rs +34 -2
  80. package/crates/mint-core/src/integrations/channels.rs +87 -345
  81. package/crates/mint-core/src/integrations/mcp.rs +397 -50
  82. package/crates/mint-core/src/integrations/mcp_calls.rs +823 -0
  83. package/crates/mint-core/src/integrations/mcp_catalog.rs +267 -0
  84. package/crates/mint-core/src/integrations/mcp_device.rs +319 -0
  85. package/crates/mint-core/src/integrations/mcp_result.rs +401 -0
  86. package/crates/mint-core/src/integrations/webhooks.rs +539 -0
  87. package/crates/mint-core/src/integrations.rs +2 -0
  88. package/crates/mint-core/src/lib.rs +95 -32
  89. package/crates/mint-core/src/media/gemini_live.rs +134 -14
  90. package/crates/mint-core/src/media/image_models.rs +3 -27
  91. package/crates/mint-core/src/media/image_proxy.rs +563 -0
  92. package/crates/mint-core/src/media/image_workflow.rs +216 -0
  93. package/crates/mint-core/src/media/library/intake.rs +144 -0
  94. package/crates/mint-core/src/media/library/migration.rs +56 -0
  95. package/crates/mint-core/src/media/library/removal.rs +55 -0
  96. package/crates/mint-core/src/media/library/tests.rs +730 -0
  97. package/crates/mint-core/src/media/library/thumbnails.rs +72 -0
  98. package/crates/mint-core/src/media/library.rs +545 -0
  99. package/crates/mint-core/src/media/model_catalog.rs +375 -0
  100. package/crates/mint-core/src/media/pictures.rs +79 -222
  101. package/crates/mint-core/src/media/tool_images.rs +196 -0
  102. package/crates/mint-core/src/media/tts/playback.rs +609 -0
  103. package/crates/mint-core/src/media/tts.rs +1 -0
  104. package/crates/mint-core/src/media/video_models.rs +3 -22
  105. package/crates/mint-core/src/media.rs +5 -0
  106. package/crates/mint-core/src/mods/manager.rs +1124 -0
  107. package/crates/mint-core/src/mods/mod.rs +569 -0
  108. package/crates/mint-core/src/mods/operations.rs +204 -0
  109. package/crates/mint-core/src/mods/session.rs +146 -0
  110. package/crates/mint-core/src/mods/slash.rs +59 -0
  111. package/crates/mint-core/src/mods/telemetry.rs +306 -0
  112. package/crates/mint-core/src/orchestration/approvals.rs +344 -0
  113. package/crates/mint-core/src/orchestration/context_render.rs +553 -32
  114. package/crates/mint-core/src/orchestration/decision_parsing.rs +5 -23
  115. package/crates/mint-core/src/orchestration/diagnostics.rs +307 -0
  116. package/crates/mint-core/src/orchestration/image_regressions.rs +379 -0
  117. package/crates/mint-core/src/orchestration/loop_guard.rs +334 -0
  118. package/crates/mint-core/src/orchestration/mcp_review.rs +153 -0
  119. package/crates/mint-core/src/orchestration/memory_skill.rs +104 -32
  120. package/crates/mint-core/src/orchestration/mod.rs +3194 -755
  121. package/crates/mint-core/src/orchestration/mod_authoring_regressions.rs +209 -0
  122. package/crates/mint-core/src/orchestration/progress_clock.rs +80 -0
  123. package/crates/mint-core/src/orchestration/reliability.rs +541 -0
  124. package/crates/mint-core/src/orchestration/repeated_failures.rs +124 -0
  125. package/crates/mint-core/src/orchestration/review_regressions.rs +595 -0
  126. package/crates/mint-core/src/orchestration/run_control.rs +196 -0
  127. package/crates/mint-core/src/orchestration/tools/files.rs +191 -16
  128. package/crates/mint-core/src/orchestration/tools/media.rs +37 -41
  129. package/crates/mint-core/src/orchestration/tools/misc.rs +3 -2
  130. package/crates/mint-core/src/orchestration/tools/mod.rs +2 -0
  131. package/crates/mint-core/src/orchestration/tools/mods.rs +161 -0
  132. package/crates/mint-core/src/orchestration/tools/plugins_mcp.rs +321 -74
  133. package/crates/mint-core/src/orchestration/tools/project.rs +1 -1
  134. package/crates/mint-core/src/orchestration/tools/shell.rs +124 -7
  135. package/crates/mint-core/src/orchestration/tools/web.rs +5 -1
  136. package/crates/mint-core/src/orchestration/trajectory_schema.rs +353 -0
  137. package/crates/mint-core/src/orchestration/truncation.rs +211 -0
  138. package/crates/mint-core/src/orchestration/verification.rs +36 -6
  139. package/crates/mint-core/src/orchestration/workspace_helpers.rs +57 -23
  140. package/crates/mint-core/src/prompts/agent.rs +47 -41
  141. package/crates/mint-core/src/prompts/tool_catalog.rs +158 -38
  142. package/crates/mint-core/src/search/knowledge.rs +7 -1
  143. package/crates/mint-core/src/search/linked_folders/index.rs +177 -13
  144. package/crates/mint-core/src/search/linked_folders.rs +83 -2
  145. package/crates/mint-core/src/search/web_search.rs +44 -3
  146. package/crates/mint-core/src/slash/catalog.rs +1 -1
  147. package/crates/mint-core/src/slash/mod.rs +638 -12
  148. package/crates/mint-core/src/slash/mods.rs +155 -0
  149. package/crates/mint-core/src/swarm/batch.rs +643 -0
  150. package/crates/mint-core/src/swarm/dossier.rs +152 -0
  151. package/crates/mint-core/src/swarm/labels.rs +100 -0
  152. package/crates/mint-core/src/swarm/mod.rs +158 -0
  153. package/crates/mint-core/src/swarm/permissions.rs +167 -0
  154. package/crates/mint-core/src/system/auth.rs +156 -7
  155. package/crates/mint-core/src/system/bg_shell.rs +1197 -95
  156. package/crates/mint-core/src/system/config.rs +97 -13
  157. package/crates/mint-core/src/system/html_preview.rs +398 -0
  158. package/crates/mint-core/src/system/mint_web.rs +185 -0
  159. package/crates/mint-core/src/system/release_notes.rs +18 -0
  160. package/crates/mint-core/src/system/shell.rs +200 -16
  161. package/crates/mint-core/src/system/workspace.rs +276 -8
  162. package/crates/mint-core/src/system/workspace_history.rs +604 -0
  163. package/crates/mint-core/src/system.rs +4 -0
  164. package/crates/mint-core/tests/background_retention.rs +34 -0
  165. package/crates/mint-core/tests/background_shutdown.rs +24 -0
  166. package/crates/mint-core/tests/library_http.rs +209 -0
  167. package/crates/mint-core/tests/mcp_contract.rs +283 -0
  168. package/crates/mint-core/tests/mcp_stdio.rs +11 -10
  169. package/crates/mint-core/tests/media_model_catalog_http.rs +403 -0
  170. package/crates/mint-core/tests/memory_persistence.rs +27 -0
  171. package/crates/mint-core/tests/mods_http.rs +215 -0
  172. package/crates/mint-core/tests/terminal_shutdown.rs +109 -0
  173. package/crates/mint-mod-runtime/Cargo.toml +18 -0
  174. package/crates/mint-mod-runtime/src/lib.rs +507 -0
  175. package/crates/mint-mod-runtime/src/sdk.js +56 -0
  176. package/crates/mint-mod-runtime/src/test_sdk.js +32 -0
  177. package/crates/mint-mod-runtime/src/testing.rs +94 -0
  178. package/crates/mint-mod-runtime/tests/runtime.rs +156 -0
  179. package/docs/mods/AUTHORING.md +61 -0
  180. package/docs/mods/README.md +139 -0
  181. package/docs/mods/TESTING.md +56 -0
  182. package/docs/mods/mint-mods.d.ts +66 -0
  183. package/examples/device-mcp/README.md +22 -0
  184. package/examples/device-mcp/contract.md +49 -0
  185. package/examples/device-mcp/mock-device.mjs +66 -0
  186. package/examples/device-mcp/server.mjs +48 -0
  187. package/examples/device-mcp/server.test.mjs +78 -0
  188. package/examples/mods/task-checklist/README.md +1 -0
  189. package/examples/mods/task-checklist/main.ts +17 -0
  190. package/examples/mods/task-checklist/manifest.json +1 -0
  191. package/examples/mods/task-checklist/tests/checklist.test.ts +15 -0
  192. package/examples/mods/token-meter/README.md +1 -0
  193. package/examples/mods/token-meter/main.ts +8 -0
  194. package/examples/mods/token-meter/manifest.json +1 -0
  195. package/examples/mods/tool-guard/README.md +1 -0
  196. package/examples/mods/tool-guard/main.ts +9 -0
  197. package/examples/mods/tool-guard/manifest.json +1 -0
  198. package/out/web/assets/ArtifactPreviewPanel-DAT_Y7i0.css +1 -0
  199. package/out/web/assets/ArtifactPreviewPanel-S0dPfYFx.js +2 -0
  200. package/out/web/assets/CalculationCard-CRjP3E1j.js +1 -0
  201. package/out/web/assets/CliSessionsView-C3Br2v5Y.css +1 -0
  202. package/out/web/assets/CliSessionsView-MI8kXMAb.js +1 -0
  203. package/out/web/assets/CodeReviewPage-CUJceQme.css +1 -0
  204. package/out/web/assets/CodeReviewPage-VCUgPla_.js +2 -0
  205. package/out/web/assets/CommandPalette-BD8SlTE5.js +1 -0
  206. package/out/web/assets/ImageGenCard-BCXxkVJX.js +1 -0
  207. package/out/web/assets/ImageSearchCard-N3yQOr8Z.js +1 -0
  208. package/out/web/assets/ImageStudioPanel-BP7N4rLr.js +1 -0
  209. package/out/web/assets/LibraryPage-DAxUTAg7.css +1 -0
  210. package/out/web/assets/LibraryPage-WlviRdR8.js +2 -0
  211. package/out/web/assets/LinkedFoldersView-CKRgroWK.js +1 -0
  212. package/out/web/assets/McpRegistryPicker-CoS83vtc.js +1 -0
  213. package/out/web/assets/McpServersView-D3wHnuHg.js +1 -0
  214. package/out/web/assets/MermaidCard-NqrHdyJW.js +2 -0
  215. package/out/web/assets/MintDashboard-B2DJsDDO.css +1 -0
  216. package/out/web/assets/MintDashboard-COw_xol7.js +63 -0
  217. package/out/web/assets/PluginsView-jBYmcKh4.js +1 -0
  218. package/out/web/assets/RewindModal-DempuDod.js +1 -0
  219. package/out/web/assets/ScheduledTasksView-5uw9-V9H.js +1 -0
  220. package/out/web/assets/SelectField-DXBQtrUK.js +1 -0
  221. package/out/web/assets/SelectField-lFEkkWCU.css +1 -0
  222. package/out/web/assets/SettingsWindow-2YP3yj7s.js +4 -0
  223. package/out/web/assets/SettingsWindow-Dz8LQVgD.css +1 -0
  224. package/out/web/assets/SkillsView-C-gp9J7m.js +2 -0
  225. package/out/web/assets/StockCard-BDMCe7mx.js +1 -0
  226. package/out/web/assets/ToolSurfacePage-B0J_q0Jl.js +38 -0
  227. package/out/web/assets/ToolSurfacePage-CRIQ1owD.css +1 -0
  228. package/out/web/assets/UiFeatureCard-6BwxTOCe.js +1 -0
  229. package/out/web/assets/UiGridCard-DvZcLNxb.js +1 -0
  230. package/out/web/assets/UiMockupWidget-DD73QWg1.js +1 -0
  231. package/out/web/assets/VeoStudioPanel-DfsOJKv0.js +4 -0
  232. package/out/web/assets/WeatherCard-CPucIfq8.js +1 -0
  233. package/out/web/assets/WorkspacePanel-BfHKkulU.js +1 -0
  234. package/out/web/assets/WorkspacePdfPreview-Dx_lkjNu.js +2 -0
  235. package/out/web/assets/abnfDiagram-VCTEODGH-BOo3Ckng.js +1 -0
  236. package/out/web/assets/architecture-7GRP2DOG-ZOwheW3n.js +1 -0
  237. package/out/web/assets/architectureDiagram-5GKGNRK7-DC2FDzVd.js +36 -0
  238. package/out/web/assets/blockDiagram-I7D4REHJ-BrKFWdAH.js +129 -0
  239. package/out/web/assets/c4Diagram-7LVT6UL2-BHTHK1Yd.js +38 -0
  240. package/out/web/assets/chunk-2Q5K7J3B-D2JLPQzF.js +1 -0
  241. package/out/web/assets/chunk-4HAMMTFA-BYFkZwNj.js +62 -0
  242. package/out/web/assets/chunk-5VM5RSS4-BZ2oBPYQ.js +15 -0
  243. package/out/web/assets/chunk-75Z2AOVW-BSKfSKSA.js +2 -0
  244. package/out/web/assets/chunk-DU6HZSFF-vIhsiW6n.js +128 -0
  245. package/out/web/assets/chunk-F27PBJKO-BlYpW9xq.js +1 -0
  246. package/out/web/assets/chunk-FOHPRMQF-JXEeeJ9r.js +161 -0
  247. package/out/web/assets/chunk-GMAD6QVW-BIBz_Ug5.js +72 -0
  248. package/out/web/assets/chunk-GVQU2GXP-NPSHxeqC.js +1 -0
  249. package/out/web/assets/chunk-IMKFNOWR-YlJK8_Fp.js +231 -0
  250. package/out/web/assets/chunk-JWPE2WC7-BeEMUFDw.js +1 -0
  251. package/out/web/assets/chunk-L3NEJ4N5-DMYi4-af.js +1 -0
  252. package/out/web/assets/chunk-OSK3NFVY-Begd3-jA.js +10 -0
  253. package/out/web/assets/chunk-P2QGCYS3-D1I4xFHN.js +1 -0
  254. package/out/web/assets/chunk-POPQ4Y6H-CafZZzNE.js +1 -0
  255. package/out/web/assets/chunk-PWAF6VOD-Dwh6_Lnt.js +1 -0
  256. package/out/web/assets/chunk-SHT3W25Y-B0XrCSEb.js +168 -0
  257. package/out/web/assets/chunk-SVP7TREG-CxLsddxC.js +88 -0
  258. package/out/web/assets/chunk-TICWLB2K-y156QInb.js +206 -0
  259. package/out/web/assets/chunk-XXDRQBXY-B9YlhOkE.js +1 -0
  260. package/out/web/assets/chunk-Y2CYZVJY-BxCWjNVG.js +1 -0
  261. package/out/web/assets/classDiagram-ZZMXUADV-BgJ5WtSp.js +1 -0
  262. package/out/web/assets/classDiagram-v2-VYDZK3BY-BgJ5WtSp.js +1 -0
  263. package/out/web/assets/config-CvIO5hkn.js +2 -0
  264. package/out/web/assets/config-DqXJXeZM.css +1 -0
  265. package/out/web/assets/core-Mi3s5D4_.js +1 -0
  266. package/out/web/assets/cose-bilkent-JH36ORCC-qlna31ty.js +1 -0
  267. package/out/web/assets/cynefin-OW5HDTMX-SMVvrLf-.js +1 -0
  268. package/out/web/assets/cynefinDiagram-5FMLGOSQ-rZznN24T.js +62 -0
  269. package/out/web/assets/cytoscape.esm-DWtAUG0r.js +321 -0
  270. package/out/web/assets/dagre-CnWJJM5f.js +1 -0
  271. package/out/web/assets/dagre-GXQ25YYZ-BOToydFu.js +4 -0
  272. package/out/web/assets/diagram-S7CK7UJ4-TMVaGQEJ.js +30 -0
  273. package/out/web/assets/diagram-UQ7AKVKN-C2JK-GP2.js +41 -0
  274. package/out/web/assets/diagram-VSXAHHWV-Cw8VSi2K.js +3 -0
  275. package/out/web/assets/diagram-VX7I27RA-DXp4fKk9.js +24 -0
  276. package/out/web/assets/diagram-Z3DM3KII-CzSicYiW.js +24 -0
  277. package/out/web/assets/dist-9ISJ7r-g.js +1 -0
  278. package/out/web/assets/dist-js-BV3mI7uw.js +1 -0
  279. package/out/web/assets/ebnfDiagram-PWID7BFC-Dqj-zqPu.js +1 -0
  280. package/out/web/assets/erDiagram-RLTQ6QDP-DZwFZAuD.js +99 -0
  281. package/out/web/assets/event-D7D-EBy9.js +1 -0
  282. package/out/web/assets/eventmodeling-NTZA5JFV-C0O-Lvgp.js +1 -0
  283. package/out/web/assets/flowDiagram-HODETNUW-uqCHJond.js +1 -0
  284. package/out/web/assets/ganttDiagram-EL5Y4UJY-Da4ULXTl.js +292 -0
  285. package/out/web/assets/gitGraph-4MIJSDKK-B9wNFZIP.js +1 -0
  286. package/out/web/assets/gitGraphDiagram-WWUBYQGX-RjrhB0MP.js +106 -0
  287. package/out/web/assets/graphlib-Bh9gHply.js +1 -0
  288. package/out/web/assets/index-BmpulIkg.js +168 -0
  289. package/out/web/assets/index-CkvBwhX_.css +1 -0
  290. package/out/web/assets/info-A6RAGUB7-B3dfCpeY.js +1 -0
  291. package/out/web/assets/infoDiagram-27XIBGKW-QVWkLVx7.js +2 -0
  292. package/out/web/assets/ishikawaDiagram-5VMMS53U-CLFNIRI9.js +70 -0
  293. package/out/web/assets/journeyDiagram-3NMN7TZE-fgOQadYF.js +139 -0
  294. package/out/web/assets/jsx-runtime-DmUwWVTj.js +1 -0
  295. package/out/web/assets/kanban-definition-UXKFOSKX-G3Q_9g9O.js +89 -0
  296. package/out/web/assets/katex-MCdQaEAD.js +257 -0
  297. package/out/web/assets/mermaid-parser.core-v3Jm7nco.js +7 -0
  298. package/out/web/assets/mermaid.core-DTEjLUA1.js +44 -0
  299. package/out/web/assets/mindmap-definition-YA3MSWOX-C_D42_fF.js +96 -0
  300. package/out/web/assets/modelManager-BPLycQrN.js +2 -0
  301. package/out/web/assets/oauthManager-BUK7ic7q.js +1 -0
  302. package/out/web/assets/packet-AYTQ26CC-B-R-SHlF.js +1 -0
  303. package/out/web/assets/pdf-Bcahc2yC.js +56 -0
  304. package/out/web/assets/pdf.worker.min-Dkey6ZUl.mjs +27 -0
  305. package/out/web/assets/pegDiagram-XKGWAZYB-Da2q_giz.js +1 -0
  306. package/out/web/assets/pie-WAS4IAKB-BC8F0N7-.js +1 -0
  307. package/out/web/assets/pieDiagram-E7YTZNPT-Iy9REJNC.js +39 -0
  308. package/out/web/assets/quadrantDiagram-AXDQQJYC-ztsiYw7h.js +7 -0
  309. package/out/web/assets/radar-RG4KPBEZ-B_1P8Z_z.js +1 -0
  310. package/out/web/assets/railroad-74A4TZTK-DuTqczSo.js +1 -0
  311. package/out/web/assets/railroad-abnf-HS5TGJTU-Df29WLmp.js +1 -0
  312. package/out/web/assets/railroad-ebnf-LZEXJU2U-ePFMo-qp.js +1 -0
  313. package/out/web/assets/railroad-peg-WCYAUIDC-DYXLW4_E.js +1 -0
  314. package/out/web/assets/railroadDiagram-O6MQD6OU-LStnZf2S.js +1 -0
  315. package/out/web/assets/requirementDiagram-BXWQKSXE-DmzonMH-.js +84 -0
  316. package/out/web/assets/rolldown-runtime-CNOWq4Kh.js +1 -0
  317. package/out/web/assets/rough.esm-CNnFptCR.js +1 -0
  318. package/out/web/assets/sankeyDiagram-P5KCCOFB-B8vjmUU1.js +40 -0
  319. package/out/web/assets/sequenceDiagram-WJ2MYXX4-CTnplOAX.js +162 -0
  320. package/out/web/assets/sizeCapture-INFHLROL-C8Q8DbV5.js +1 -0
  321. package/out/web/assets/src-CRDfRlHM.js +1 -0
  322. package/out/web/assets/stateDiagram-D77RDMKH-BFrIaLdI.js +1 -0
  323. package/out/web/assets/stateDiagram-v2-MP3YSRHH-uf3kdNW4.js +1 -0
  324. package/out/web/assets/studio-BBZQ_-QK.js +1 -0
  325. package/out/web/assets/swimlanes-42K2YHIH-BXGngUNU.js +1 -0
  326. package/out/web/assets/swimlanesDiagram-VR7AAH4N-Y8q5bQce.js +8 -0
  327. package/out/web/assets/timeline-definition-24CTP7MA-CegH7n43.js +120 -0
  328. package/out/web/assets/treeView-Q6P3EWNA-DTpJv2Tw.js +1 -0
  329. package/out/web/assets/treemap-WGGIJYW6-i8M9iJU6.js +1 -0
  330. package/out/web/assets/vennDiagram-4TSXK5OY-Dpzo1S8U.js +34 -0
  331. package/out/web/assets/wardley-WFR3VGLG-BrNsgtfw.js +1 -0
  332. package/out/web/assets/wardleyDiagram-VM6X3IG4-lQ92LFE1.js +78 -0
  333. package/out/web/assets/window-CkUOP7t0.js +1 -0
  334. package/out/web/assets/workspaces-SYPrmbgC.js +1 -0
  335. package/out/web/assets/xychartDiagram-S5SC5T6Z-BaOaEoBd.js +7 -0
  336. package/out/web/index-web.html +4 -3
  337. package/out/web/index.html +4 -3
  338. package/out/web/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
  339. package/out/web/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
  340. package/out/web/pdfjs/cmaps/78-H.bcmap +0 -0
  341. package/out/web/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
  342. package/out/web/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
  343. package/out/web/pdfjs/cmaps/78-V.bcmap +0 -0
  344. package/out/web/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
  345. package/out/web/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
  346. package/out/web/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
  347. package/out/web/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
  348. package/out/web/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
  349. package/out/web/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
  350. package/out/web/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
  351. package/out/web/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
  352. package/out/web/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
  353. package/out/web/pdfjs/cmaps/Add-H.bcmap +0 -0
  354. package/out/web/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
  355. package/out/web/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
  356. package/out/web/pdfjs/cmaps/Add-V.bcmap +0 -0
  357. package/out/web/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
  358. package/out/web/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
  359. package/out/web/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
  360. package/out/web/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
  361. package/out/web/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
  362. package/out/web/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
  363. package/out/web/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
  364. package/out/web/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
  365. package/out/web/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
  366. package/out/web/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
  367. package/out/web/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
  368. package/out/web/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
  369. package/out/web/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
  370. package/out/web/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
  371. package/out/web/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
  372. package/out/web/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
  373. package/out/web/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
  374. package/out/web/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
  375. package/out/web/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
  376. package/out/web/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
  377. package/out/web/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
  378. package/out/web/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
  379. package/out/web/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
  380. package/out/web/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
  381. package/out/web/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
  382. package/out/web/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
  383. package/out/web/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
  384. package/out/web/pdfjs/cmaps/B5-H.bcmap +0 -0
  385. package/out/web/pdfjs/cmaps/B5-V.bcmap +0 -0
  386. package/out/web/pdfjs/cmaps/B5pc-H.bcmap +0 -0
  387. package/out/web/pdfjs/cmaps/B5pc-V.bcmap +0 -0
  388. package/out/web/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
  389. package/out/web/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
  390. package/out/web/pdfjs/cmaps/CNS1-H.bcmap +0 -0
  391. package/out/web/pdfjs/cmaps/CNS1-V.bcmap +0 -0
  392. package/out/web/pdfjs/cmaps/CNS2-H.bcmap +0 -0
  393. package/out/web/pdfjs/cmaps/CNS2-V.bcmap +3 -0
  394. package/out/web/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
  395. package/out/web/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
  396. package/out/web/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
  397. package/out/web/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
  398. package/out/web/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
  399. package/out/web/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
  400. package/out/web/pdfjs/cmaps/EUC-H.bcmap +0 -0
  401. package/out/web/pdfjs/cmaps/EUC-V.bcmap +0 -0
  402. package/out/web/pdfjs/cmaps/Ext-H.bcmap +0 -0
  403. package/out/web/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
  404. package/out/web/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
  405. package/out/web/pdfjs/cmaps/Ext-V.bcmap +0 -0
  406. package/out/web/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
  407. package/out/web/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
  408. package/out/web/pdfjs/cmaps/GB-H.bcmap +4 -0
  409. package/out/web/pdfjs/cmaps/GB-V.bcmap +0 -0
  410. package/out/web/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
  411. package/out/web/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
  412. package/out/web/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
  413. package/out/web/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
  414. package/out/web/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
  415. package/out/web/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
  416. package/out/web/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
  417. package/out/web/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
  418. package/out/web/pdfjs/cmaps/GBT-H.bcmap +0 -0
  419. package/out/web/pdfjs/cmaps/GBT-V.bcmap +0 -0
  420. package/out/web/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
  421. package/out/web/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
  422. package/out/web/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
  423. package/out/web/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
  424. package/out/web/pdfjs/cmaps/H.bcmap +0 -0
  425. package/out/web/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
  426. package/out/web/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
  427. package/out/web/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
  428. package/out/web/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
  429. package/out/web/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
  430. package/out/web/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
  431. package/out/web/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
  432. package/out/web/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
  433. package/out/web/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
  434. package/out/web/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
  435. package/out/web/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
  436. package/out/web/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
  437. package/out/web/pdfjs/cmaps/Hankaku.bcmap +0 -0
  438. package/out/web/pdfjs/cmaps/Hiragana.bcmap +0 -0
  439. package/out/web/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
  440. package/out/web/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
  441. package/out/web/pdfjs/cmaps/KSC-H.bcmap +0 -0
  442. package/out/web/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
  443. package/out/web/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
  444. package/out/web/pdfjs/cmaps/KSC-V.bcmap +0 -0
  445. package/out/web/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
  446. package/out/web/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
  447. package/out/web/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
  448. package/out/web/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
  449. package/out/web/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
  450. package/out/web/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
  451. package/out/web/pdfjs/cmaps/Katakana.bcmap +0 -0
  452. package/out/web/pdfjs/cmaps/LICENSE +36 -0
  453. package/out/web/pdfjs/cmaps/NWP-H.bcmap +0 -0
  454. package/out/web/pdfjs/cmaps/NWP-V.bcmap +0 -0
  455. package/out/web/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
  456. package/out/web/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
  457. package/out/web/pdfjs/cmaps/Roman.bcmap +0 -0
  458. package/out/web/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
  459. package/out/web/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
  460. package/out/web/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
  461. package/out/web/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
  462. package/out/web/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
  463. package/out/web/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
  464. package/out/web/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
  465. package/out/web/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
  466. package/out/web/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
  467. package/out/web/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
  468. package/out/web/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
  469. package/out/web/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
  470. package/out/web/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
  471. package/out/web/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
  472. package/out/web/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
  473. package/out/web/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
  474. package/out/web/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
  475. package/out/web/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
  476. package/out/web/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
  477. package/out/web/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
  478. package/out/web/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
  479. package/out/web/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
  480. package/out/web/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
  481. package/out/web/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
  482. package/out/web/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
  483. package/out/web/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
  484. package/out/web/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
  485. package/out/web/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
  486. package/out/web/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
  487. package/out/web/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
  488. package/out/web/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
  489. package/out/web/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
  490. package/out/web/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
  491. package/out/web/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
  492. package/out/web/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
  493. package/out/web/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
  494. package/out/web/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
  495. package/out/web/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
  496. package/out/web/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
  497. package/out/web/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
  498. package/out/web/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
  499. package/out/web/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
  500. package/out/web/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
  501. package/out/web/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
  502. package/out/web/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
  503. package/out/web/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
  504. package/out/web/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
  505. package/out/web/pdfjs/cmaps/V.bcmap +0 -0
  506. package/out/web/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
  507. package/out/web/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
  508. package/out/web/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
  509. package/out/web/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
  510. package/out/web/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
  511. package/out/web/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
  512. package/out/web/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
  513. package/out/web/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
  514. package/out/web/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
  515. package/out/web/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
  516. package/out/web/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
  517. package/out/web/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
  518. package/out/web/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
  519. package/out/web/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
  520. package/out/web/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
  521. package/out/web/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
  522. package/out/web/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
  523. package/out/web/pdfjs/wasm/LICENSE_JBIG2 +196 -0
  524. package/out/web/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
  525. package/out/web/pdfjs/wasm/LICENSE_PDFJS_JBIG2 +13 -0
  526. package/out/web/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
  527. package/out/web/pdfjs/wasm/LICENSE_PDFJS_QCMS +19 -0
  528. package/out/web/pdfjs/wasm/LICENSE_QCMS +21 -0
  529. package/out/web/pdfjs/wasm/jbig2.wasm +0 -0
  530. package/out/web/pdfjs/wasm/jbig2_nowasm_fallback.js +15 -0
  531. package/out/web/pdfjs/wasm/openjpeg.wasm +0 -0
  532. package/out/web/pdfjs/wasm/openjpeg_nowasm_fallback.js +17 -0
  533. package/out/web/pdfjs/wasm/qcms_bg.wasm +0 -0
  534. package/out/web/pdfjs/wasm/quickjs-eval.js +16 -0
  535. package/out/web/pdfjs/wasm/quickjs-eval.wasm +0 -0
  536. package/package.json +74 -23
  537. package/shared-modules/.github/workflows/ci.yml +120 -0
  538. package/shared-modules/.github/workflows/update.yaml +28 -0
  539. package/slash-commands.json +14 -3
  540. package/src/bin/auto-build.js +66 -0
  541. package/src/bin/desktop.js +113 -0
  542. package/src/bin/desktop.test.js +113 -0
  543. package/src/bin/index.js +21 -25
  544. package/src/bin/index.test.js +89 -0
  545. package/src/bin/measure-effects.mjs +53 -0
  546. package/src/bin/package.test.js +28 -0
  547. package/src/bin/pdfjs-assets.mjs +31 -0
  548. package/src/bin/release-notes.test.js +84 -0
  549. package/src/bin/styles.test.js +20 -0
  550. package/src/bin/web.js +5 -0
  551. package/src/bin/web.test.js +39 -0
  552. package/src/renderer/index.html +0 -2
  553. package/src/renderer/node_modules/.vite/vitest/CACHEDIR.TAG +3 -0
  554. package/src/renderer/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
  555. package/src/renderer/shared/agentProgress.ts +42 -0
  556. package/src/renderer/shared/components/Settings/AgentsTab.tsx +76 -11
  557. package/src/renderer/shared/components/Settings/AudioTab.tsx +8 -7
  558. package/src/renderer/shared/components/Settings/AutomationTab.tsx +59 -2
  559. package/src/renderer/shared/components/Settings/AvatarCropModal.tsx +18 -12
  560. package/src/renderer/shared/components/Settings/CustomProviderLogoPicker.test.tsx +65 -0
  561. package/src/renderer/shared/components/Settings/CustomProviderLogoPicker.tsx +456 -0
  562. package/src/renderer/shared/components/Settings/GeneralTab.tsx +72 -113
  563. package/src/renderer/shared/components/Settings/MemoryTab.test.tsx +37 -0
  564. package/src/renderer/shared/components/Settings/MemoryTab.tsx +71 -31
  565. package/src/renderer/shared/components/Settings/NotificationsTab.test.tsx +15 -0
  566. package/src/renderer/shared/components/Settings/NotificationsTab.tsx +84 -0
  567. package/src/renderer/shared/components/Settings/PluginsTab.tsx +101 -24
  568. package/src/renderer/shared/components/Settings/ProfileTab.tsx +1 -1
  569. package/src/renderer/shared/components/Settings/SettingsWindow.tsx +796 -0
  570. package/src/renderer/shared/components/Settings/ThemeTab.tsx +31 -11
  571. package/src/renderer/shared/components/activity/AgentActivityDrawer.tsx +220 -0
  572. package/src/renderer/shared/components/activity/AgentActivityTable.tsx +340 -0
  573. package/src/renderer/shared/components/activity/McpToolResults.tsx +118 -0
  574. package/src/renderer/shared/components/activity/PlanChecklistWidget.tsx +77 -0
  575. package/src/renderer/shared/components/activity/RunSummaryDashboard.test.tsx +127 -0
  576. package/src/renderer/shared/components/activity/RunSummaryDashboard.tsx +222 -0
  577. package/src/renderer/shared/components/activity/SubagentDagView.test.ts +123 -0
  578. package/src/renderer/shared/components/activity/SubagentDagView.tsx +420 -0
  579. package/src/renderer/shared/components/activity/SubagentStatusStrip.test.tsx +82 -0
  580. package/src/renderer/shared/components/activity/SubagentStatusStrip.tsx +107 -0
  581. package/src/renderer/shared/components/activity/ViewedImages.tsx +140 -0
  582. package/src/renderer/shared/components/app/AuthGate.tsx +227 -0
  583. package/src/renderer/shared/components/app/ChunkErrorBoundary.tsx +186 -0
  584. package/src/renderer/shared/components/app/CommandPalette.tsx +593 -0
  585. package/src/renderer/shared/components/app/DashboardSidebar.tsx +1230 -0
  586. package/src/renderer/shared/components/app/DesktopTitlebar.tsx +354 -0
  587. package/src/renderer/shared/components/app/ErrorNotice.tsx +29 -0
  588. package/src/renderer/shared/components/app/MintDashboard.tsx +2182 -0
  589. package/src/renderer/shared/components/app/ModalErrorBoundary.tsx +127 -0
  590. package/src/renderer/shared/components/cards/CalculationCard.tsx +86 -0
  591. package/src/renderer/shared/components/cards/ImageGenCard.tsx +146 -0
  592. package/src/renderer/shared/components/cards/ImageSearchCard.tsx +145 -0
  593. package/src/renderer/shared/components/cards/MermaidCard.tsx +283 -0
  594. package/src/renderer/shared/components/cards/StockCard.tsx +152 -0
  595. package/src/renderer/shared/components/cards/ToolResultCards.tsx +86 -0
  596. package/src/renderer/shared/components/cards/UiFeatureCard.tsx +267 -0
  597. package/src/renderer/shared/components/cards/UiGridCard.tsx +188 -0
  598. package/src/renderer/shared/components/cards/WeatherCard.tsx +224 -0
  599. package/src/renderer/shared/components/chat/ApprovalCard.test.tsx +24 -0
  600. package/src/renderer/shared/components/chat/ApprovalCard.tsx +347 -0
  601. package/src/renderer/shared/components/chat/ChatCodeBlock.tsx +109 -0
  602. package/src/renderer/shared/components/chat/ChatMessageItem.test.tsx +145 -0
  603. package/src/renderer/shared/components/chat/ChatMessageItem.tsx +242 -0
  604. package/src/renderer/shared/components/chat/ChatPanel.test.tsx +31 -0
  605. package/src/renderer/shared/components/chat/ChatPanel.tsx +1999 -0
  606. package/src/renderer/shared/components/chat/CollapsiblePasteInput.tsx +90 -0
  607. package/src/renderer/shared/components/chat/ContextCompactionStatus.tsx +17 -0
  608. package/src/renderer/shared/components/chat/DiffReviewModal.tsx +565 -0
  609. package/src/renderer/shared/components/chat/GeminiLiveOverlay.css +86 -0
  610. package/src/renderer/shared/components/chat/GeminiLiveOverlay.test.tsx +24 -0
  611. package/src/renderer/shared/components/chat/GeminiLiveOverlay.tsx +112 -0
  612. package/src/renderer/shared/components/chat/ModelSelectorPopover.tsx +936 -0
  613. package/src/renderer/shared/components/chat/QueuedMessagesBanner.test.tsx +89 -0
  614. package/src/renderer/shared/components/chat/QueuedMessagesBanner.tsx +201 -0
  615. package/src/renderer/shared/components/chat/RewindModal.tsx +414 -0
  616. package/src/renderer/shared/components/chat/SlashChoicePanel.tsx +88 -0
  617. package/src/renderer/shared/components/chat/SlashSuggestions.test.tsx +33 -0
  618. package/src/renderer/shared/components/chat/SlashSuggestions.tsx +346 -0
  619. package/src/renderer/shared/components/chat/SourcesBlock.tsx +435 -0
  620. package/src/renderer/shared/components/chat/ThinkingBlock.tsx +102 -0
  621. package/src/renderer/shared/components/chat/TurnFileChanges.test.tsx +86 -0
  622. package/src/renderer/shared/components/chat/TurnFileChanges.tsx +430 -0
  623. package/src/renderer/shared/components/chat/VirtualChatHistory.tsx +82 -0
  624. package/src/renderer/shared/components/chat/VoicePill.css +85 -0
  625. package/src/renderer/shared/components/chat/VoicePill.d.ts +12 -0
  626. package/src/renderer/shared/components/chat/VoicePill.jsx +191 -0
  627. package/src/renderer/shared/components/chat/VoicePill.test.tsx +22 -0
  628. package/src/renderer/shared/components/extensions/CliSessionsView.test.tsx +125 -0
  629. package/src/renderer/shared/components/extensions/CliSessionsView.tsx +545 -0
  630. package/src/renderer/shared/components/extensions/LinkedFoldersView.tsx +614 -0
  631. package/src/renderer/shared/components/extensions/McpRegistryPicker.tsx +302 -0
  632. package/src/renderer/shared/components/extensions/McpServersView.tsx +1040 -0
  633. package/src/renderer/shared/components/extensions/McpToolAllowlist.tsx +182 -0
  634. package/src/renderer/shared/components/extensions/ModUi.test.tsx +70 -0
  635. package/src/renderer/shared/components/extensions/ModsPanel.tsx +208 -0
  636. package/src/renderer/shared/components/extensions/PluginsView.tsx +325 -0
  637. package/src/renderer/shared/components/extensions/ScheduledTasksView.tsx +614 -0
  638. package/src/renderer/shared/components/extensions/SkillsView.test.tsx +31 -0
  639. package/src/renderer/shared/components/extensions/SkillsView.tsx +363 -0
  640. package/src/renderer/shared/components/studio/ImageStudioPanel.tsx +740 -0
  641. package/src/renderer/shared/components/studio/LibraryItemCard.tsx +72 -0
  642. package/src/renderer/shared/components/studio/LibraryPage.tsx +165 -0
  643. package/src/renderer/shared/components/studio/LibraryPreview.tsx +59 -0
  644. package/src/renderer/shared/components/studio/VeoStudioPanel.tsx +708 -0
  645. package/src/renderer/shared/components/ui/GlideSelect.css +139 -0
  646. package/src/renderer/shared/components/ui/ProviderBrandIcon.test.tsx +67 -0
  647. package/src/renderer/shared/components/ui/ProviderBrandIcon.tsx +167 -0
  648. package/src/renderer/shared/components/ui/README.md +52 -0
  649. package/src/renderer/shared/components/ui/SelectField.test.tsx +27 -0
  650. package/src/renderer/shared/components/ui/SelectField.tsx +506 -0
  651. package/src/renderer/shared/components/ui/button.tsx +37 -0
  652. package/src/renderer/shared/components/ui/error-recovery.css +35 -0
  653. package/src/renderer/shared/components/ui/error-recovery.tsx +35 -0
  654. package/src/renderer/shared/components/ui/voice-powered-orb.css +6 -0
  655. package/src/renderer/shared/components/ui/voice-powered-orb.tsx +374 -0
  656. package/src/renderer/shared/components/workspace/ArtifactPreviewPanel.tsx +700 -0
  657. package/src/renderer/shared/components/workspace/BackgroundTerminals.test.tsx +63 -0
  658. package/src/renderer/shared/components/workspace/BackgroundTerminals.tsx +212 -0
  659. package/src/renderer/shared/components/workspace/CodeReviewPage.tsx +707 -0
  660. package/src/renderer/shared/components/workspace/GitBranchSelector.tsx +442 -0
  661. package/src/renderer/shared/components/workspace/SessionSources.tsx +113 -0
  662. package/src/renderer/shared/components/workspace/TerminalDock.tsx +244 -0
  663. package/src/renderer/shared/components/workspace/ToolSurfacePage.test.tsx +68 -0
  664. package/src/renderer/shared/components/workspace/ToolSurfacePage.tsx +819 -0
  665. package/src/renderer/shared/components/workspace/ToolsPanelToggle.tsx +13 -0
  666. package/src/renderer/shared/components/workspace/WorkspaceFileInfo.tsx +28 -0
  667. package/src/renderer/shared/components/workspace/WorkspaceMediaPreview.tsx +17 -0
  668. package/src/renderer/shared/components/workspace/WorkspacePaneResizer.tsx +92 -0
  669. package/src/renderer/shared/components/workspace/WorkspacePdfPreview.tsx +89 -0
  670. package/src/renderer/shared/components/workspace/WorkspacePreviewActions.test.tsx +89 -0
  671. package/src/renderer/shared/components/workspace/WorkspacePreviewActions.tsx +19 -0
  672. package/src/renderer/shared/components/workspace/WorkspaceSelector.tsx +246 -0
  673. package/src/renderer/shared/components/workspace/background-terminals.css +292 -0
  674. package/src/renderer/shared/components/workspace/workspace-selector.css +330 -0
  675. package/src/renderer/shared/constants/config.ts +37 -1
  676. package/src/renderer/shared/constants/slashCommands.ts +1 -1
  677. package/src/renderer/shared/conversation/coordinator.test.ts +46 -0
  678. package/src/renderer/shared/conversation/coordinator.ts +50 -2
  679. package/src/renderer/shared/conversation/lifecycle.test.ts +524 -0
  680. package/src/renderer/shared/conversation/lifecycle.ts +575 -0
  681. package/src/renderer/shared/conversation/projectNavigation.test.ts +123 -0
  682. package/src/renderer/shared/conversation/projectNavigation.ts +50 -0
  683. package/src/renderer/shared/conversation/sourcesTransport.ts +27 -0
  684. package/src/renderer/shared/conversation/syncView.test.ts +1 -34
  685. package/src/renderer/shared/conversation/syncView.ts +0 -37
  686. package/src/renderer/shared/conversation/transport.test.ts +183 -0
  687. package/src/renderer/shared/conversation/transport.ts +201 -0
  688. package/src/renderer/shared/conversation/useConversationCoordinator.ts +67 -79
  689. package/src/renderer/shared/css/agent-observability.css +90 -30
  690. package/src/renderer/shared/css/auth-gate.css +112 -13
  691. package/src/renderer/shared/css/chat-ui-cards.css +35 -35
  692. package/src/renderer/shared/css/code-review.css +119 -86
  693. package/src/renderer/shared/css/code-sessions.css +37 -10
  694. package/src/renderer/shared/css/collapsed-paste.css +35 -0
  695. package/src/renderer/shared/css/effects.css +15 -0
  696. package/src/renderer/shared/css/error-notice.css +60 -0
  697. package/src/renderer/shared/css/file-changes.css +167 -5
  698. package/src/renderer/shared/css/library.css +476 -0
  699. package/src/renderer/shared/css/management-views.css +216 -37
  700. package/src/renderer/shared/css/mcp-results.css +54 -0
  701. package/src/renderer/shared/css/model-selector.css +163 -105
  702. package/src/renderer/shared/css/mods.css +77 -0
  703. package/src/renderer/shared/css/notification-notice.css +28 -0
  704. package/src/renderer/shared/css/queued-messages.css +221 -0
  705. package/src/renderer/shared/css/session-sources.css +28 -0
  706. package/src/renderer/shared/css/settings/agents.css +2 -2
  707. package/src/renderer/shared/css/settings/base.css +1260 -0
  708. package/src/renderer/shared/css/settings/general.css +384 -92
  709. package/src/renderer/shared/css/settings/memory.css +154 -0
  710. package/src/renderer/shared/css/settings/notifications.css +11 -0
  711. package/src/renderer/shared/css/settings/plugins.css +8 -8
  712. package/src/renderer/shared/css/settings/theme.css +49 -32
  713. package/src/renderer/shared/css/slash-choice.css +95 -0
  714. package/src/renderer/shared/css/slash-suggestions.css +68 -0
  715. package/src/renderer/shared/css/sources-block.css +91 -0
  716. package/src/renderer/shared/css/thinking-status.css +46 -0
  717. package/src/renderer/shared/css/tools-panel.css +7 -0
  718. package/src/renderer/shared/css/ui-tailwind.css +19 -0
  719. package/src/renderer/shared/css/viewed-images.css +104 -0
  720. package/src/renderer/shared/css/workspace-file-info.css +12 -0
  721. package/src/renderer/shared/css/workspace-media-preview.css +13 -0
  722. package/src/renderer/shared/env.d.ts +9 -0
  723. package/src/renderer/shared/fonts.css +46 -0
  724. package/src/renderer/shared/fonts.ts +3 -12
  725. package/src/renderer/shared/lib/utils.ts +6 -0
  726. package/src/renderer/shared/library/controller.test.ts +61 -0
  727. package/src/renderer/shared/library/controller.ts +57 -0
  728. package/src/renderer/shared/library/transport.test.ts +26 -0
  729. package/src/renderer/shared/library/transport.ts +60 -0
  730. package/src/renderer/shared/library/useLibraryFile.ts +38 -0
  731. package/src/renderer/shared/mods.ts +58 -0
  732. package/src/renderer/shared/platform.test.ts +200 -1
  733. package/src/renderer/shared/platform.ts +55 -4
  734. package/src/renderer/shared/speech/player.ts +160 -0
  735. package/src/renderer/shared/speech/types.ts +11 -0
  736. package/src/renderer/shared/theme/themeManager.test.ts +63 -0
  737. package/src/renderer/shared/theme/themeManager.ts +20 -5
  738. package/src/renderer/shared/theme/themes.ts +17 -4
  739. package/src/renderer/shared/theme/tokens.css +448 -51
  740. package/src/renderer/shared/types.ts +111 -2
  741. package/src/renderer/shared/utils/agentActivity.test.ts +234 -0
  742. package/src/renderer/shared/utils/agentActivity.ts +221 -32
  743. package/src/renderer/shared/utils/approval.tsx +7 -0
  744. package/src/renderer/shared/utils/artifactBrowser.test.ts +80 -0
  745. package/src/renderer/shared/utils/artifactBrowser.ts +41 -0
  746. package/src/renderer/shared/utils/artifacts.ts +55 -0
  747. package/src/renderer/shared/utils/contextCompaction.test.tsx +48 -0
  748. package/src/renderer/shared/utils/contextCompaction.ts +21 -0
  749. package/src/renderer/shared/utils/effectVisibility.ts +9 -0
  750. package/src/renderer/shared/utils/externalLinks.ts +91 -0
  751. package/src/renderer/shared/utils/lazyWithRetry.ts +13 -0
  752. package/src/renderer/shared/utils/markdown.tsx +172 -38
  753. package/src/renderer/shared/utils/markdown.webImages.test.tsx +124 -2
  754. package/src/renderer/shared/utils/mcpResults.test.tsx +114 -0
  755. package/src/renderer/shared/utils/modViewport.ts +7 -0
  756. package/src/renderer/shared/utils/nativeRecordingSession.test.ts +61 -0
  757. package/src/renderer/shared/utils/nativeRecordingSession.ts +46 -0
  758. package/src/renderer/shared/utils/notificationSettings.test.ts +14 -0
  759. package/src/renderer/shared/utils/notificationSettings.ts +23 -0
  760. package/src/renderer/shared/utils/notifications.test.ts +51 -0
  761. package/src/renderer/shared/utils/notifications.ts +54 -0
  762. package/src/renderer/shared/utils/pastedText.test.ts +20 -0
  763. package/src/renderer/shared/utils/pastedText.ts +13 -0
  764. package/src/renderer/shared/utils/pdfRange.ts +16 -0
  765. package/src/renderer/shared/utils/previewObjectUrls.ts +20 -0
  766. package/src/renderer/shared/utils/progressCache.test.ts +32 -0
  767. package/src/renderer/shared/utils/sessionSources.test.ts +71 -0
  768. package/src/renderer/shared/utils/sessionSources.ts +36 -0
  769. package/src/renderer/shared/utils/slashCommandProcessor.ts +5 -2
  770. package/src/renderer/shared/utils/sourceAttachments.ts +28 -0
  771. package/src/renderer/shared/utils/speech.ts +65 -9
  772. package/src/renderer/shared/utils/syntaxHighlight.test.tsx +22 -0
  773. package/src/renderer/shared/utils/syntaxHighlight.tsx +26 -0
  774. package/src/renderer/shared/utils/useGeminiLiveVoice.ts +49 -5
  775. package/src/renderer/shared/utils/useLatestCallback.ts +9 -0
  776. package/src/renderer/shared/utils/useNativeVoiceInput.ts +95 -73
  777. package/src/renderer/shared/utils/useSessionSources.ts +37 -0
  778. package/src/renderer/shared/utils/viewedImages.test.ts +129 -0
  779. package/src/renderer/shared/utils/viewedImages.ts +97 -0
  780. package/src/renderer/shared/utils/workspaceDrag.ts +30 -0
  781. package/src/renderer/shared/utils/workspaceImage.ts +17 -0
  782. package/src/renderer/shared/utils/workspaceListPreferences.test.ts +64 -0
  783. package/src/renderer/shared/utils/workspaceListPreferences.ts +54 -0
  784. package/src/renderer/shared/utils/workspaceMedia.ts +41 -0
  785. package/src/renderer/shared/utils/workspacePane.test.ts +33 -0
  786. package/src/renderer/shared/utils/workspacePane.ts +20 -0
  787. package/src/renderer/shared/utils/workspacePreview.test.ts +169 -0
  788. package/src/renderer/shared/utils/workspacePreview.ts +47 -0
  789. package/src/renderer/shared/utils/workspaceSnapshot.test.ts +49 -0
  790. package/src/renderer/shared/utils/workspaceSnapshot.ts +26 -0
  791. package/src/renderer/shared/utils/workspaces.ts +11 -0
  792. package/src/renderer/shared/workspaceUndo.ts +88 -0
  793. package/src/renderer/src/App.tsx +15 -9
  794. package/src/renderer/src/components/ChatPanel.tsx +1 -1
  795. package/src/renderer/src/components/DashboardSidebar.tsx +2 -2
  796. package/src/renderer/src/components/ImageStudioPanel.tsx +1 -1
  797. package/src/renderer/src/components/LiveTranslateControls.tsx +65 -0
  798. package/src/renderer/src/components/MintDashboard.tsx +1 -1
  799. package/src/renderer/src/components/ProactiveGlow.tsx +1 -1
  800. package/src/renderer/src/components/ScreenPicker.css +67 -30
  801. package/src/renderer/src/components/ScreenPicker.tsx +201 -60
  802. package/src/renderer/src/components/SettingsWindow.tsx +6 -825
  803. package/src/renderer/src/components/SpotlightWindow.tsx +4 -32
  804. package/src/renderer/src/components/VeoStudioPanel.tsx +1 -1
  805. package/src/renderer/src/components/WorkspacePanel.tsx +261 -38
  806. package/src/renderer/src/components/browser-shell.css +27 -27
  807. package/src/renderer/src/components/browser-suggestions-popup.css +9 -9
  808. package/src/renderer/src/components/liveTranslateFrames.test.ts +26 -5
  809. package/src/renderer/src/components/liveTranslateFrames.ts +18 -7
  810. package/src/renderer/src/components/liveTranslateLanguage.ts +6 -0
  811. package/src/renderer/src/css/app-shell.css +69 -234
  812. package/src/renderer/src/css/chat.css +207 -494
  813. package/src/renderer/src/css/desktop-tools.css +6 -139
  814. package/src/renderer/src/css/misc.css +0 -52
  815. package/src/renderer/src/css/sidebar-workspace.css +171 -94
  816. package/src/renderer/src/css/spotlight.css +2 -2
  817. package/src/renderer/src/css/tool-surfaces.css +387 -61
  818. package/src/renderer/src/css/widget.css +7 -6
  819. package/src/renderer/src/env.d.ts +14 -9
  820. package/src/renderer/src/index.css +16 -64
  821. package/src/renderer/src/main.tsx +2 -1
  822. package/src/renderer/src/proactiveSuggestions.ts +29 -0
  823. package/src/renderer/src/tauri.ts +195 -337
  824. package/src/renderer/src/voiceInput.ts +5 -2
  825. package/src/renderer/src-web/App.tsx +6 -8
  826. package/src/renderer/src-web/components/ChatPanel.tsx +1 -1
  827. package/src/renderer/src-web/components/DashboardSidebar.tsx +2 -2
  828. package/src/renderer/src-web/components/ImageStudioPanel.tsx +1 -1
  829. package/src/renderer/src-web/components/MintDashboard.tsx +1 -1
  830. package/src/renderer/src-web/components/PullToRefresh.tsx +1 -1
  831. package/src/renderer/src-web/components/SettingsWindow.tsx +6 -846
  832. package/src/renderer/src-web/components/VeoStudioPanel.tsx +1 -1
  833. package/src/renderer/src-web/css/app-shell.css +40 -221
  834. package/src/renderer/src-web/css/chat.css +207 -494
  835. package/src/renderer/src-web/css/misc.css +0 -52
  836. package/src/renderer/src-web/css/mobile.css +15 -14
  837. package/src/renderer/src-web/css/sidebar-workspace.css +29 -95
  838. package/src/renderer/src-web/env.d.ts +15 -12
  839. package/src/renderer/src-web/index.css +16 -64
  840. package/src/renderer/src-web/main.tsx +2 -1
  841. package/src/renderer/src-web/proactiveSuggestions.ts +3 -0
  842. package/src/renderer/src-web/tauri.ts +194 -361
  843. package/src/renderer/tests/backgroundTerminals.browser.html +81 -0
  844. package/src/renderer/tests/browserArtifacts.browser.html +1 -0
  845. package/src/renderer/tests/browserArtifacts.browser.tsx +68 -0
  846. package/src/renderer/tests/chatEscape.browser.html +1 -0
  847. package/src/renderer/tests/chatEscape.browser.tsx +25 -0
  848. package/src/renderer/tests/chatPanelFixture.ts +23 -0
  849. package/src/renderer/tests/chatPerformance.browser.html +71 -0
  850. package/src/renderer/tests/cliSessions.browser.html +82 -0
  851. package/src/renderer/tests/collapsedPaste.browser.html +70 -0
  852. package/src/renderer/tests/composerMenus.browser.html +116 -0
  853. package/src/renderer/tests/contextCompaction.browser.html +17 -0
  854. package/src/renderer/tests/conversationLifecycle.browser.html +70 -0
  855. package/src/renderer/tests/effectsPerformance.browser.html +13 -0
  856. package/src/renderer/tests/errorRecovery.browser.html +21 -0
  857. package/src/renderer/tests/fixtures/preview.webm +0 -0
  858. package/src/renderer/tests/glideSelect.browser.html +70 -0
  859. package/src/renderer/tests/glideSelect.preview.html +27 -0
  860. package/src/renderer/tests/library.browser.html +1 -0
  861. package/src/renderer/tests/library.browser.tsx +78 -0
  862. package/src/renderer/tests/liveOrb.browser.html +49 -0
  863. package/src/renderer/tests/liveVoice.browser.html +29 -0
  864. package/src/renderer/tests/mediaFixtures.ts +32 -0
  865. package/src/renderer/tests/modInput.browser.html +22 -0
  866. package/src/renderer/tests/sessionSources.browser.html +1 -0
  867. package/src/renderer/tests/sessionSources.browser.tsx +168 -0
  868. package/src/renderer/tests/skills.browser.html +24 -0
  869. package/src/renderer/tests/toolsPanel.browser.html +1 -0
  870. package/src/renderer/tests/toolsPanel.browser.tsx +113 -0
  871. package/src/renderer/tests/viewedImages.browser.html +1 -0
  872. package/src/renderer/tests/viewedImages.browser.tsx +93 -0
  873. package/src/renderer/tests/voiceDictation.browser.html +101 -0
  874. package/src/renderer/tests/voicePill.browser.html +80 -0
  875. package/src/renderer/tests/voicePill.preview.html +34 -0
  876. package/src/renderer/tests/webSources.browser.html +1 -0
  877. package/src/renderer/tests/webSources.browser.tsx +2 -0
  878. package/src/renderer/tests/workspaceDrop.browser.html +1 -0
  879. package/src/renderer/tests/workspaceDrop.browser.tsx +183 -0
  880. package/src/renderer/tests/workspaceExpansion.browser.html +1 -0
  881. package/src/renderer/tests/workspaceExpansion.browser.tsx +66 -0
  882. package/src/renderer/tests/workspaceRemoval.browser.html +66 -0
  883. package/src/renderer/tests/workspaceUndo.browser.html +100 -0
  884. package/src-tauri/Cargo.toml +40 -0
  885. package/src-tauri/build.rs +3 -0
  886. package/src-tauri/src/app/lifecycle.rs +320 -0
  887. package/src-tauri/src/app/mod.rs +4 -0
  888. package/src-tauri/src/app/shortcuts.rs +40 -0
  889. package/src-tauri/src/app/tray.rs +52 -0
  890. package/src-tauri/src/background/events.rs +70 -0
  891. package/src-tauri/src/background/headless.rs +230 -0
  892. package/src-tauri/src/background/mod.rs +4 -0
  893. package/src-tauri/src/background/proactive.rs +262 -0
  894. package/src-tauri/src/commands/approvals.rs +20 -0
  895. package/src-tauri/src/commands/auth.rs +127 -0
  896. package/src-tauri/src/commands/conversation.rs +668 -0
  897. package/src-tauri/src/commands/integrations.rs +163 -0
  898. package/src-tauri/src/commands/media.rs +186 -0
  899. package/src-tauri/src/commands/mod.rs +11 -0
  900. package/src-tauri/src/commands/mods.rs +6 -0
  901. package/src-tauri/src/commands/settings.rs +141 -0
  902. package/src-tauri/src/commands/voice.rs +153 -0
  903. package/src-tauri/src/commands/workspace.rs +539 -0
  904. package/src-tauri/src/lib.rs +10 -0
  905. package/src-tauri/src/main.rs +3 -0
  906. package/src-tauri/src/native/actions.rs +206 -0
  907. package/src-tauri/src/native/browser.rs +252 -0
  908. package/src-tauri/src/native/capture.rs +695 -0
  909. package/src-tauri/src/native/discord_rpc.rs +99 -0
  910. package/src-tauri/src/native/integrations.rs +126 -0
  911. package/src-tauri/src/native/mod.rs +12 -0
  912. package/src-tauri/src/native/notifications.rs +51 -0
  913. package/src-tauri/src/native/plugins.rs +14 -0
  914. package/src-tauri/src/native/system.rs +250 -0
  915. package/src-tauri/src/native/terminal.rs +201 -0
  916. package/src-tauri/src/native/updater.rs +148 -0
  917. package/src-tauri/src/native/windows.rs +143 -0
  918. package/tsconfig.json +17 -1
  919. package/vite.config.ts +5 -1
  920. package/vite.config.web.ts +6 -0
  921. package/.cargo/config.toml +0 -13
  922. package/.claude/settings.local.json +0 -182
  923. package/.codex +0 -0
  924. package/CLAUDE.md +0 -102
  925. package/ROADMAP.md +0 -30
  926. package/mint-presentation-demo.mp4 +0 -0
  927. package/out/web/Live2DCubismCore.js +0 -9
  928. package/out/web/assets/CliSessionsView-BxUVWEEL.js +0 -1
  929. package/out/web/assets/CliSessionsView-CBDTXuQv.css +0 -1
  930. package/out/web/assets/CodeReviewPage-DkMgfcos.css +0 -1
  931. package/out/web/assets/CodeReviewPage-jKlmLJwT.js +0 -3
  932. package/out/web/assets/CommandPalette-DnwPA5hy.js +0 -1
  933. package/out/web/assets/ImageStudioPanel-BR1XFwhR.js +0 -1
  934. package/out/web/assets/LinkedFoldersView-bi-CWQ-I.js +0 -1
  935. package/out/web/assets/McpRegistryPicker-D5tEFnyq.js +0 -1
  936. package/out/web/assets/McpServersView-BGG1dhFM.js +0 -1
  937. package/out/web/assets/MintDashboard-BIglDEWX.js +0 -20
  938. package/out/web/assets/MintDashboard-DSMywSgs.css +0 -1
  939. package/out/web/assets/ModelPanel-CbJ1PFoZ.js +0 -1
  940. package/out/web/assets/PicturesLibrary-CQP0fLP1.css +0 -1
  941. package/out/web/assets/PicturesLibrary-DoYN7T1p.js +0 -1
  942. package/out/web/assets/PluginsView-CU1HWXGk.js +0 -1
  943. package/out/web/assets/ScheduledTasksView-Bnl36y2N.js +0 -1
  944. package/out/web/assets/SettingsWindow-DhWLAn9T.css +0 -1
  945. package/out/web/assets/SettingsWindow-Dw8L01pw.js +0 -2
  946. package/out/web/assets/SkillsView-cnl8aY5p.js +0 -2
  947. package/out/web/assets/ToolSurfacePage-CgsQw6l5.css +0 -1
  948. package/out/web/assets/ToolSurfacePage-Cz2VJAPZ.js +0 -37
  949. package/out/web/assets/VeoStudioPanel-D4JnERWR.js +0 -4
  950. package/out/web/assets/WorkspacePanel-CbJ1PFoZ.js +0 -1
  951. package/out/web/assets/abnfDiagram-VCTEODGH-ByMyfanq.js +0 -1
  952. package/out/web/assets/architecture-7GRP2DOG-CLq2kEOB.js +0 -1
  953. package/out/web/assets/architectureDiagram-5GKGNRK7-6PoVSmNG.js +0 -36
  954. package/out/web/assets/blockDiagram-NRAW4CY4-cKw9mAKi.js +0 -129
  955. package/out/web/assets/c4Diagram-UCG6FXSJ-Cqy8N5Ge.js +0 -38
  956. package/out/web/assets/chunk-2Q5K7J3B-Dmqrq8Tp.js +0 -1
  957. package/out/web/assets/chunk-5VM5RSS4-BiPuE0io.js +0 -15
  958. package/out/web/assets/chunk-75Z2AOVW-3qybijF5.js +0 -2
  959. package/out/web/assets/chunk-CKBBP62Z-cIrXq6jN.js +0 -2
  960. package/out/web/assets/chunk-CLGD4ZFX-CndDQkww.js +0 -1
  961. package/out/web/assets/chunk-CacB07dV.js +0 -1
  962. package/out/web/assets/chunk-DSNCTWBM-Cc4NxvgD.js +0 -2
  963. package/out/web/assets/chunk-DU6HZSFF-drzh6GsU.js +0 -128
  964. package/out/web/assets/chunk-F27PBJKO-FiY35l4v.js +0 -1
  965. package/out/web/assets/chunk-FOHPRMQF-BaVC1uA7.js +0 -161
  966. package/out/web/assets/chunk-G27WJ6UU-Bjt9Il4A.js +0 -231
  967. package/out/web/assets/chunk-GMAD6QVW-Bppi3Ctd.js +0 -72
  968. package/out/web/assets/chunk-JQ64N6SF-DGg5kcEV.js +0 -1
  969. package/out/web/assets/chunk-JWPE2WC7-BwtYOHqU.js +0 -1
  970. package/out/web/assets/chunk-LCL6LL3I-CCYcjd7p.js +0 -206
  971. package/out/web/assets/chunk-LNGE3PJU-AdBoOWw2.js +0 -34
  972. package/out/web/assets/chunk-OBVCFTLP-DJeNil5M.js +0 -1
  973. package/out/web/assets/chunk-P2QGCYS3-lRzkRjBB.js +0 -1
  974. package/out/web/assets/chunk-POPQ4Y6H-DouASMBW.js +0 -1
  975. package/out/web/assets/chunk-PWAF6VOD-DMmD1vVf.js +0 -1
  976. package/out/web/assets/chunk-R7TYR2AO-CYLA5UC5.js +0 -10
  977. package/out/web/assets/chunk-RHFEMEQ7-BiXwEcUT.js +0 -168
  978. package/out/web/assets/chunk-SVP7TREG-BV-zPslF.js +0 -88
  979. package/out/web/assets/chunk-TEH6E4GO-B2RGEohZ.js +0 -62
  980. package/out/web/assets/chunk-XXDRQBXY-DnJkbUaw.js +0 -1
  981. package/out/web/assets/chunk-Y2CYZVJY-C9o-s6OY.js +0 -1
  982. package/out/web/assets/classDiagram-DTDB5LWJ-Dq0smRWk.js +0 -1
  983. package/out/web/assets/classDiagram-v2-JRS7N3AN-Dq0smRWk.js +0 -1
  984. package/out/web/assets/config-C-ZFtipU.css +0 -1
  985. package/out/web/assets/config-eEDngJXO.js +0 -1
  986. package/out/web/assets/core-hQ2VA9Ti.js +0 -1
  987. package/out/web/assets/cose-bilkent-JH36ORCC--UN4aw5-.js +0 -1
  988. package/out/web/assets/cynefin-OW5HDTMX-Cas4csHM.js +0 -1
  989. package/out/web/assets/cynefinDiagram-5FMLGOSQ-Bbpj66Y3.js +0 -62
  990. package/out/web/assets/cytoscape.esm-Df1UN4Y1.js +0 -321
  991. package/out/web/assets/dagre-3AP2YEHR-B0-2RDEd.js +0 -4
  992. package/out/web/assets/dagre-BWadQu2F.js +0 -1
  993. package/out/web/assets/diagram-S7CK7UJ4-BdzEjUyH.js +0 -30
  994. package/out/web/assets/diagram-UQ7AKVKN-CJDwyPxF.js +0 -41
  995. package/out/web/assets/diagram-VSXAHHWV-BxaG1r_B.js +0 -3
  996. package/out/web/assets/diagram-VX7I27RA-BMmUqm8f.js +0 -24
  997. package/out/web/assets/diagram-Z3DM3KII-CFtd03eE.js +0 -24
  998. package/out/web/assets/dist-BoTOASLF.js +0 -1
  999. package/out/web/assets/dist-js-Bf2bhoku.js +0 -1
  1000. package/out/web/assets/ebnfDiagram-PWID7BFC-DwAen1hO.js +0 -1
  1001. package/out/web/assets/erDiagram-SSCWMZ5O-BCZSHACj.js +0 -99
  1002. package/out/web/assets/event-ChBVpRy0.js +0 -1
  1003. package/out/web/assets/eventmodeling-NTZA5JFV-XHStE4E_.js +0 -1
  1004. package/out/web/assets/flowDiagram-A5DVABFB-BLg7nEcd.js +0 -1
  1005. package/out/web/assets/ganttDiagram-EL5Y4UJY-BAEu1Cql.js +0 -292
  1006. package/out/web/assets/gitGraph-4MIJSDKK-r32Vyper.js +0 -1
  1007. package/out/web/assets/gitGraphDiagram-WWUBYQGX-z9o9qt6V.js +0 -106
  1008. package/out/web/assets/graphlib-CTR5ZhLf.js +0 -1
  1009. package/out/web/assets/index-Btsf4L8M.css +0 -1
  1010. package/out/web/assets/index-D8D9MeRA.js +0 -11
  1011. package/out/web/assets/info-A6RAGUB7-BvLaC2cw.js +0 -1
  1012. package/out/web/assets/infoDiagram-RXCK75RN-Be6WAXXw.js +0 -2
  1013. package/out/web/assets/ishikawaDiagram-5VMMS53U-DZjoHJHC.js +0 -70
  1014. package/out/web/assets/journeyDiagram-EYS64GPL-CtVkjkGm.js +0 -139
  1015. package/out/web/assets/kanban-definition-3QL26DDD-CW5FMv1w.js +0 -89
  1016. package/out/web/assets/katex-O3jvqgnU.js +0 -257
  1017. package/out/web/assets/lucide-react-Ip3L6Jtn.js +0 -1
  1018. package/out/web/assets/markdown-BSeeUbJH.js +0 -38
  1019. package/out/web/assets/mermaid-parser.core-aUgCqsZ5.js +0 -7
  1020. package/out/web/assets/mermaid.core-D57sEiSL.js +0 -11
  1021. package/out/web/assets/mindmap-definition-FBJOCRG2-DAmSpM3a.js +0 -96
  1022. package/out/web/assets/modelManager-tMVmJVAW.js +0 -2
  1023. package/out/web/assets/oauthManager-9jxicDWJ.js +0 -1
  1024. package/out/web/assets/packet-AYTQ26CC-DJ27iIoJ.js +0 -1
  1025. package/out/web/assets/pegDiagram-XKGWAZYB-Bj3ii-gS.js +0 -1
  1026. package/out/web/assets/pie-WAS4IAKB-DG5mCUbc.js +0 -1
  1027. package/out/web/assets/pieDiagram-E7YTZNPT-BrJLPnDA.js +0 -39
  1028. package/out/web/assets/prompt-latin-400-normal-BQ9zjSN8.woff2 +0 -0
  1029. package/out/web/assets/prompt-latin-400-normal-CxU4ec_r.woff +0 -0
  1030. package/out/web/assets/prompt-latin-500-normal-B1edBDQ9.woff +0 -0
  1031. package/out/web/assets/prompt-latin-500-normal-CxzxEHZc.woff2 +0 -0
  1032. package/out/web/assets/prompt-latin-600-normal-CSDDLorv.woff +0 -0
  1033. package/out/web/assets/prompt-latin-600-normal-hKZWXsc1.woff2 +0 -0
  1034. package/out/web/assets/prompt-latin-700-normal-BfbftDSq.woff +0 -0
  1035. package/out/web/assets/prompt-latin-700-normal-I2gc831J.woff2 +0 -0
  1036. package/out/web/assets/prompt-thai-400-normal-BrkKv8cO.woff2 +0 -0
  1037. package/out/web/assets/prompt-thai-400-normal-DJypnfr3.woff +0 -0
  1038. package/out/web/assets/prompt-thai-500-normal-C18pDUoL.woff2 +0 -0
  1039. package/out/web/assets/prompt-thai-500-normal-D7YNqUJD.woff +0 -0
  1040. package/out/web/assets/prompt-thai-600-normal-CYPViXds.woff +0 -0
  1041. package/out/web/assets/prompt-thai-600-normal-MrdfU7zR.woff2 +0 -0
  1042. package/out/web/assets/prompt-thai-700-normal-Cb5ilR-c.woff +0 -0
  1043. package/out/web/assets/prompt-thai-700-normal-Cg4aQ0Nn.woff2 +0 -0
  1044. package/out/web/assets/quadrantDiagram-AXDQQJYC-3x_TmF3j.js +0 -7
  1045. package/out/web/assets/radar-RG4KPBEZ-CrXaTTuV.js +0 -1
  1046. package/out/web/assets/railroad-74A4TZTK-BpqMH9BE.js +0 -1
  1047. package/out/web/assets/railroad-abnf-HS5TGJTU-DHI0uLlV.js +0 -1
  1048. package/out/web/assets/railroad-ebnf-LZEXJU2U-CQCb316y.js +0 -1
  1049. package/out/web/assets/railroad-peg-WCYAUIDC-Ph1giKkH.js +0 -1
  1050. package/out/web/assets/railroadDiagram-O6MQD6OU-BRq6wIxx.js +0 -1
  1051. package/out/web/assets/requirementDiagram-EFPCY7ZU-DIJj6G1g.js +0 -84
  1052. package/out/web/assets/rough.esm-DFbTUy8a.js +0 -1
  1053. package/out/web/assets/sankeyDiagram-P5KCCOFB-DZajSryq.js +0 -40
  1054. package/out/web/assets/sequenceDiagram-WJ2MYXX4-DxJCWyZS.js +0 -162
  1055. package/out/web/assets/sizeCapture-X5ZJPWSS-DKeOCaN2.js +0 -1
  1056. package/out/web/assets/src-DnfeXQPr.js +0 -1
  1057. package/out/web/assets/stateDiagram-HBIQ2CUA-k6voi8Vf.js +0 -1
  1058. package/out/web/assets/stateDiagram-v2-4QOOHH4V-DeEc0lGZ.js +0 -1
  1059. package/out/web/assets/studio-B1mk40wD.js +0 -1
  1060. package/out/web/assets/swimlanes-XN3QIQJK-igYhTjXB.js +0 -1
  1061. package/out/web/assets/swimlanesDiagram-VK2B7HYN-DpVik9v7.js +0 -8
  1062. package/out/web/assets/timeline-definition-24CTP7MA-Dke2p93p.js +0 -120
  1063. package/out/web/assets/treeView-Q6P3EWNA-hNELnXUs.js +0 -1
  1064. package/out/web/assets/treemap-WGGIJYW6-D2B6wDsx.js +0 -1
  1065. package/out/web/assets/vennDiagram-4TSXK5OY-CDkW7rUP.js +0 -34
  1066. package/out/web/assets/wardley-WFR3VGLG-BECdXETi.js +0 -1
  1067. package/out/web/assets/wardleyDiagram-VM6X3IG4-B5BycpQ4.js +0 -78
  1068. package/out/web/assets/window-5qYXKoW7.js +0 -1
  1069. package/out/web/assets/xychartDiagram-S5SC5T6Z-CtJS3b--.js +0 -7
  1070. package/skills-lock.json +0 -77
  1071. package/src/renderer/public/Live2DCubismCore.js +0 -9
  1072. package/src/renderer/shared/components/AgentActivityDrawer.tsx +0 -203
  1073. package/src/renderer/shared/components/AgentActivityTable.tsx +0 -301
  1074. package/src/renderer/shared/components/ApprovalCard.tsx +0 -340
  1075. package/src/renderer/shared/components/ArtifactPreviewPanel.tsx +0 -505
  1076. package/src/renderer/shared/components/AuthGate.tsx +0 -191
  1077. package/src/renderer/shared/components/CalculationCard.tsx +0 -100
  1078. package/src/renderer/shared/components/ChatCodeBlock.tsx +0 -105
  1079. package/src/renderer/shared/components/ChatMessageItem.tsx +0 -306
  1080. package/src/renderer/shared/components/ChatPanel.tsx +0 -2226
  1081. package/src/renderer/shared/components/ChunkErrorBoundary.tsx +0 -284
  1082. package/src/renderer/shared/components/CliSessionsView.tsx +0 -495
  1083. package/src/renderer/shared/components/CodeReviewPage.tsx +0 -565
  1084. package/src/renderer/shared/components/CommandPalette.tsx +0 -593
  1085. package/src/renderer/shared/components/DashboardSidebar.tsx +0 -1341
  1086. package/src/renderer/shared/components/DesktopTitlebar.tsx +0 -345
  1087. package/src/renderer/shared/components/DiffReviewModal.tsx +0 -565
  1088. package/src/renderer/shared/components/GeminiLiveOverlay.tsx +0 -128
  1089. package/src/renderer/shared/components/GitBranchSelector.tsx +0 -442
  1090. package/src/renderer/shared/components/ImageGenCard.tsx +0 -159
  1091. package/src/renderer/shared/components/ImageSearchCard.tsx +0 -168
  1092. package/src/renderer/shared/components/ImageStudioPanel.tsx +0 -739
  1093. package/src/renderer/shared/components/InlineThoughtNote.tsx +0 -27
  1094. package/src/renderer/shared/components/LinkedFoldersView.tsx +0 -614
  1095. package/src/renderer/shared/components/McpRegistryPicker.tsx +0 -302
  1096. package/src/renderer/shared/components/McpServersView.tsx +0 -952
  1097. package/src/renderer/shared/components/McpToolAllowlist.tsx +0 -184
  1098. package/src/renderer/shared/components/MermaidCard.tsx +0 -267
  1099. package/src/renderer/shared/components/MintDashboard.tsx +0 -2665
  1100. package/src/renderer/shared/components/ModalErrorBoundary.tsx +0 -127
  1101. package/src/renderer/shared/components/ModelSelectorPopover.tsx +0 -929
  1102. package/src/renderer/shared/components/PlanChecklistWidget.tsx +0 -77
  1103. package/src/renderer/shared/components/PluginsView.tsx +0 -325
  1104. package/src/renderer/shared/components/RewindModal.tsx +0 -421
  1105. package/src/renderer/shared/components/RunSummaryDashboard.tsx +0 -149
  1106. package/src/renderer/shared/components/ScheduledTasksView.tsx +0 -613
  1107. package/src/renderer/shared/components/SkillsView.tsx +0 -347
  1108. package/src/renderer/shared/components/SlashSuggestions.tsx +0 -318
  1109. package/src/renderer/shared/components/SourcesBlock.tsx +0 -450
  1110. package/src/renderer/shared/components/StockCard.tsx +0 -168
  1111. package/src/renderer/shared/components/SubagentDagView.tsx +0 -366
  1112. package/src/renderer/shared/components/TerminalDock.tsx +0 -241
  1113. package/src/renderer/shared/components/ThinkingBlock.tsx +0 -102
  1114. package/src/renderer/shared/components/ToolSurfacePage.tsx +0 -520
  1115. package/src/renderer/shared/components/UiFeatureCard.tsx +0 -267
  1116. package/src/renderer/shared/components/UiGridCard.tsx +0 -188
  1117. package/src/renderer/shared/components/VeoStudioPanel.tsx +0 -707
  1118. package/src/renderer/shared/components/WeatherCard.tsx +0 -224
  1119. package/src/renderer/shared/components/WorkspaceContextPopover.tsx +0 -133
  1120. package/src/renderer/shared/components/WorkspaceSelector.tsx +0 -149
  1121. package/src/renderer/src/companionWidget.ts +0 -95
  1122. package/src/renderer/src/components/CalculationCard.tsx +0 -3
  1123. package/src/renderer/src/components/ImageGenCard.tsx +0 -2
  1124. package/src/renderer/src/components/ImageSearchCard.tsx +0 -2
  1125. package/src/renderer/src/components/Live2DStage.tsx +0 -412
  1126. package/src/renderer/src/components/MermaidCard.tsx +0 -1
  1127. package/src/renderer/src/components/ModelPanel.tsx +0 -155
  1128. package/src/renderer/src/components/PicturesLibrary.tsx +0 -288
  1129. package/src/renderer/src/components/Settings/AgentsTab.tsx +0 -4
  1130. package/src/renderer/src/components/Settings/AudioTab.tsx +0 -3
  1131. package/src/renderer/src/components/Settings/AutomationTab.tsx +0 -3
  1132. package/src/renderer/src/components/Settings/GeneralTab.tsx +0 -3
  1133. package/src/renderer/src/components/Settings/MemoryTab.tsx +0 -3
  1134. package/src/renderer/src/components/Settings/PluginsTab.tsx +0 -3
  1135. package/src/renderer/src/components/Settings/ProfileTab.tsx +0 -3
  1136. package/src/renderer/src/components/Settings/ShortcutsTab.tsx +0 -3
  1137. package/src/renderer/src/components/Settings/ThemeTab.tsx +0 -3
  1138. package/src/renderer/src/components/StockCard.tsx +0 -3
  1139. package/src/renderer/src/components/WeatherCard.tsx +0 -3
  1140. package/src/renderer/src/css/model.css +0 -628
  1141. package/src/renderer/src/css/pictures.css +0 -415
  1142. package/src/renderer/src/css/settings/base.css +0 -1263
  1143. package/src/renderer/src-web/companionWidget.ts +0 -37
  1144. package/src/renderer/src-web/components/ModelPanel.tsx +0 -12
  1145. package/src/renderer/src-web/components/PicturesLibrary.tsx +0 -285
  1146. package/src/renderer/src-web/components/Settings/AgentsTab.tsx +0 -4
  1147. package/src/renderer/src-web/components/Settings/AudioTab.tsx +0 -3
  1148. package/src/renderer/src-web/components/Settings/AutomationTab.tsx +0 -3
  1149. package/src/renderer/src-web/components/Settings/GeneralTab.tsx +0 -3
  1150. package/src/renderer/src-web/components/Settings/MemoryTab.tsx +0 -3
  1151. package/src/renderer/src-web/components/Settings/PluginsTab.tsx +0 -3
  1152. package/src/renderer/src-web/components/Settings/ProfileTab.tsx +0 -3
  1153. package/src/renderer/src-web/components/Settings/ShortcutsTab.tsx +0 -3
  1154. package/src/renderer/src-web/components/Settings/ThemeTab.tsx +0 -3
  1155. package/src/renderer/src-web/css/model.css +0 -628
  1156. package/src/renderer/src-web/css/pictures.css +0 -462
  1157. package/src/renderer/src-web/css/settings/base.css +0 -1263
  1158. package/src/renderer/src-web/css/spotlight.css +0 -102
  1159. package/src/renderer/src-web/css/widget.css +0 -213
  1160. /package/src/renderer/shared/components/{UiMockupWidget.tsx → cards/UiMockupWidget.tsx} +0 -0
  1161. /package/src/renderer/shared/components/{ScreenCaptureDialog.css → studio/ScreenCaptureDialog.css} +0 -0
  1162. /package/src/renderer/shared/components/{ScreenCaptureDialog.tsx → studio/ScreenCaptureDialog.tsx} +0 -0
@@ -0,0 +1,1999 @@
1
+ import { SpeechPlayer } from '../../speech/player'
2
+ import McpToolResults from '../activity/McpToolResults'
3
+ import ViewedImages from '../activity/ViewedImages'
4
+ import { CollapsiblePasteInput } from './CollapsiblePasteInput'
5
+ import { ContextCompactionStatus } from './ContextCompactionStatus'
6
+ import { activeCompactionFrom } from '../../utils/contextCompaction'
7
+ import { useEffect, useMemo, useRef, useState, useCallback, Fragment, lazy, Suspense, useSyncExternalStore, type ChangeEvent, type ClipboardEvent, type DragEvent, type FormEvent, type KeyboardEvent, type RefObject } from 'react'
8
+ import { EMPTY_AGENT_PROGRESS, hasAgentToolActivity, thoughtsFrom, extendedThoughtsFrom, mergeFileChanges, parseFileChangesFromProgress } from '../../agentProgress'
9
+ import { visibleInteractionsDuringRun } from '../../conversation/syncView'
10
+ import {
11
+ GEMINI_MODELS,
12
+ OPENAI_MODELS,
13
+ ANTHROPIC_MODELS,
14
+ OPENROUTER_MODELS,
15
+ DEEPSEEK_MODELS,
16
+ HF_MODELS,
17
+ LOCAL_MODELS,
18
+ OLLAMA_MODELS,
19
+ GEMINI_LIVE_VOICES,
20
+ } from '../../constants/models'
21
+ import { badge, providerLabel, fallbackNotice } from '../../utils/providers'
22
+ import { parseWebSearchSources } from '../../utils/agentActivity'
23
+ import { useLatestCallback } from '../../utils/useLatestCallback'
24
+ import SlashChoicePanel from './SlashChoicePanel'
25
+ import SlashSuggestions, { type SlashSuggestionsHandle } from './SlashSuggestions'
26
+ import { ChatCodeBlock } from './ChatCodeBlock'
27
+ import { renderApprovalDetails, renderDiff, type ApprovalDetails } from '../../utils/approval'
28
+ import { ApprovalCard } from './ApprovalCard'
29
+ import { FormattedMessage, readableAssistantText, renderSpeakerIcon, renderCopyIcon } from '../../utils/markdown'
30
+ import { ThinkingBlock } from './ThinkingBlock'
31
+ import ChatMessageItem from './ChatMessageItem'
32
+ import ProviderBrandIcon from '../ui/ProviderBrandIcon'
33
+ import { AgentActivityDrawer } from '../activity/AgentActivityDrawer'
34
+ import { TurnFileChanges, type RewindRequestPayload } from './TurnFileChanges'
35
+ import { SubagentStatusStrip } from '../activity/SubagentStatusStrip'
36
+ import { VirtualChatHistory, type VirtualChatHistoryHandle } from './VirtualChatHistory'
37
+ import type { ArtifactFile } from '../../utils/artifacts'
38
+ import type { AgentProgress, ChatResponse, DiffHunk, FileChange, GitCheckpoint, QueuedPrompt, RuntimeStatus } from '../../types'
39
+ import { shouldShowSessionDivider, formatSessionDividerLabel } from '../../utils/ui'
40
+ import { useVoiceInput } from '@/voiceInput'
41
+ import VoicePill from './VoicePill'
42
+ import { useGeminiLiveVoice } from '../../utils/useGeminiLiveVoice'
43
+ import GeminiLiveOverlay from './GeminiLiveOverlay'
44
+ import { isSupportedDocument, SUPPORTED_DOCUMENT_ACCEPT } from '../../utils/documentTypes'
45
+ import ModelSelectorPopover from './ModelSelectorPopover'
46
+ import GitBranchSelector from '../workspace/GitBranchSelector'
47
+ import WorkspaceSelector from '../workspace/WorkspaceSelector'
48
+ import ToolsPanelToggle from '../workspace/ToolsPanelToggle'
49
+ import { ModsPanel } from '../extensions/ModsPanel'
50
+ import type { ToolSurface } from '../workspace/ToolSurfacePage'
51
+ import QueuedMessagesBanner from './QueuedMessagesBanner'
52
+ import '../../css/thinking-status.css'
53
+ import '../../css/slash-choice.css'
54
+
55
+ import { catalogPlatform, conversationPlatform, runtimePlatform } from '../../platform'
56
+
57
+ const ArtifactPreviewPanel = lazy(() => import('../workspace/ArtifactPreviewPanel').then(m => ({ default: m.ArtifactPreviewPanel })))
58
+ const RewindModal = lazy(() => import('./RewindModal').then(m => ({ default: m.RewindModal })))
59
+ const CodeReviewPage = lazy(() => import('../workspace/CodeReviewPage'))
60
+
61
+ export function shouldProbeOllamaModels(status?: RuntimeStatus | null, settingsConfig?: any): boolean {
62
+ return status?.activeProvider === 'ollama' || Boolean(settingsConfig?.ollamaHost || settingsConfig?.ollamaModel)
63
+ }
64
+
65
+ export function ThinkingElapsedMeta() {
66
+ const [elapsedSeconds, setElapsedSeconds] = useState(0)
67
+ useEffect(() => {
68
+ const startTime = Date.now()
69
+ const timer = setInterval(() => {
70
+ setElapsedSeconds(Math.round((Date.now() - startTime) / 1000))
71
+ }, 1000)
72
+ return () => clearInterval(timer)
73
+ }, [])
74
+ return (
75
+ <span className="thinking-status-meta">
76
+ {` · ${elapsedSeconds}s · Esc to cancel`}
77
+ </span>
78
+ )
79
+ }
80
+
81
+ const STREAM_MARKDOWN_UPDATE_MS = 120
82
+
83
+ function useThrottledValue<T>(value: T, intervalMs: number): T {
84
+ const [throttledValue, setThrottledValue] = useState(value)
85
+ const latestValueRef = useRef(value)
86
+ const lastUpdateRef = useRef(0)
87
+ const timerRef = useRef<ReturnType<typeof window.setTimeout> | null>(null)
88
+
89
+ useEffect(() => {
90
+ latestValueRef.current = value
91
+ if (Object.is(value, throttledValue)) return
92
+
93
+ const flush = () => {
94
+ timerRef.current = null
95
+ lastUpdateRef.current = Date.now()
96
+ setThrottledValue(latestValueRef.current)
97
+ }
98
+ const remaining = intervalMs - (Date.now() - lastUpdateRef.current)
99
+ if (remaining <= 0) flush()
100
+ else if (timerRef.current === null) timerRef.current = window.setTimeout(flush, remaining)
101
+ }, [value, throttledValue, intervalMs])
102
+
103
+ useEffect(() => () => {
104
+ if (timerRef.current !== null) window.clearTimeout(timerRef.current)
105
+ }, [])
106
+
107
+ return throttledValue
108
+ }
109
+
110
+ const {
111
+ speechRequest, startGeminiLiveSession, sendGeminiLiveAudioChunk, stopGeminiLiveSession,
112
+ listGitCheckpoints, rollbackGitCheckpoint, undoGitCheckpoint,
113
+ } = conversationPlatform
114
+ const { fetchProviderModels } = catalogPlatform
115
+
116
+
117
+ interface ChatPanelContract {
118
+ interactions: any[]
119
+ sendingInteractionId?: number | null
120
+ hasOlder?: boolean
121
+ onLoadOlder?: () => Promise<void>
122
+ sending: boolean
123
+ sendingMessage: string
124
+ sendingImageCount: number
125
+ sendingVideoCount?: number
126
+ streamedReply: string
127
+ streamedResponse: ChatResponse | null
128
+ agentProgress: AgentProgress[]
129
+ agentActivitySnapshots: Record<string, AgentProgress[]>
130
+ thinkingExpanded: Record<string, boolean>
131
+ onThinkingExpandedChange: (key: string, open: boolean) => void
132
+ message: string
133
+ imageAttachments: Array<{ dataUri: string; name: string; previewDataUri?: string; objectUrl?: string }>
134
+ videoAttachments: Array<{ dataUri: string; name: string }>
135
+ documentName: string
136
+ pendingApproval: any | null
137
+ agentMode: boolean
138
+ /** Desktop only — plan-mode-approval UI isn't available on web. */
139
+ planMode?: boolean
140
+ status: RuntimeStatus | null
141
+ /** Desktop only — web has no local workspace-folder concept to select from. */
142
+ workspacePath?: string
143
+ chatId: string
144
+ chatEnd: RefObject<HTMLDivElement | null>
145
+ welcomeInteraction: any
146
+ queuedPrompts?: QueuedPrompt[]
147
+ queuePaused?: boolean
148
+ onSubmit: (event: FormEvent<HTMLFormElement>) => void
149
+ onSelectImage: (event: ChangeEvent<HTMLInputElement>) => void
150
+ onSelectVideo: (event: ChangeEvent<HTMLInputElement>) => void
151
+ onSelectDocument: (event: ChangeEvent<HTMLInputElement>) => void
152
+ onPasteImage: (clipboardData: DataTransfer) => boolean
153
+ onSetMessage: (message: string) => void
154
+ onSendVoiceMessage: (message: string, audioDataUri?: string | null) => Promise<void>
155
+ onRemoveImage: (idx: number) => void
156
+ onRemoveVideo: (idx: number) => void
157
+ onRemoveDocument: () => void
158
+ onStartWebSearch: () => void
159
+ onCaptureScreen: () => void
160
+ onSetAgentMode: (enabled: boolean) => void
161
+ /** Desktop only — see `planMode`. */
162
+ onSetPlanMode?: (enabled: boolean) => void
163
+ onSetProvider: (provider: string) => void
164
+ /** Desktop only — see `workspacePath`. */
165
+ onSelectWorkspace?: (path?: string) => void
166
+ onWorkspaceChanged?: () => void
167
+ recentWorkspacePaths: string[]
168
+ onApproval: (approved: boolean, autoApproveSession?: boolean, answer?: string) => void
169
+ settingsConfig: any
170
+ onUpdateSettings?: (config: any) => void
171
+ onSetModel: (model: string) => void
172
+ onSelectModelAndProvider?: (provider: string, model: string) => void
173
+ onCancelMessage: () => void
174
+ onClearMessages: () => void
175
+ onSetGeminiLiveVoice: (voice: string) => Promise<void>
176
+ /** Web only — desktop's window has no mobile-width sidebar to toggle. */
177
+ onToggleMobileSidebar?: () => void
178
+ isCliSession?: boolean
179
+ cliSessionId?: string
180
+ onBackToCode?: () => void
181
+ conversationTitle?: string
182
+ slashChoice?: { command: string; title: string; options: { label: string; value: string }[] } | null
183
+ onOpenArtifact?: (artifact: ArtifactFile) => void
184
+ onOpenReview?: (review: Extract<ToolSurface, { kind: 'review' }>) => void
185
+ onSelectSlashChoice?: (value: string) => void
186
+ onDismissSlashChoice?: () => void
187
+ subscribeMessage?: (notify: () => void) => () => void
188
+ getMessage?: () => string
189
+ onRemoveQueuedPrompt?: (id: string) => void
190
+ onEditQueuedPrompt?: (id: string) => void
191
+ onClearQueuedPrompts?: () => void
192
+ onSteerQueuedPrompt?: (id: string) => void
193
+ onResumeQueue?: () => void
194
+ }
195
+
196
+ export type ConversationViewModel = Pick<ChatPanelContract,
197
+ | 'interactions' | 'sending' | 'sendingMessage' | 'sendingImageCount' | 'sendingVideoCount'
198
+ | 'streamedReply' | 'streamedResponse' | 'agentProgress' | 'agentActivitySnapshots'
199
+ | 'thinkingExpanded' | 'message' | 'imageAttachments' | 'videoAttachments' | 'documentName'
200
+ | 'pendingApproval' | 'agentMode' | 'planMode' | 'status' | 'workspacePath' | 'chatId' | 'recentWorkspacePaths'
201
+ | 'chatEnd' | 'welcomeInteraction' | 'settingsConfig' | 'isCliSession' | 'cliSessionId'
202
+ | 'conversationTitle' | 'slashChoice'
203
+ | 'hasOlder'
204
+ | 'sendingInteractionId'
205
+ | 'queuedPrompts'
206
+ | 'queuePaused'
207
+ >
208
+ export type ConversationActions = Omit<ChatPanelContract, keyof ConversationViewModel> & {
209
+ subscribeMessage?: (notify: () => void) => () => void
210
+ getMessage?: () => string
211
+ }
212
+
213
+ const NOOP_SUBSCRIBE = () => () => {}
214
+
215
+ export function useComposerDraft(
216
+ fallbackMessage: string,
217
+ subscribe?: (notify: () => void) => () => void,
218
+ getMessage?: () => string,
219
+ ): string {
220
+ const getSnapshot = () => (getMessage ? getMessage() : fallbackMessage)
221
+ return useSyncExternalStore(
222
+ subscribe ?? NOOP_SUBSCRIBE,
223
+ getSnapshot,
224
+ getSnapshot,
225
+ )
226
+ }
227
+
228
+ interface ChatPanelProps {
229
+ conversation: ConversationViewModel
230
+ actions: ConversationActions
231
+ tools?: { modsPanelTarget: HTMLElement | null; onOpenMods: () => void; onToggle?: () => void; open: boolean; backgroundTaskCount: number }
232
+ }
233
+
234
+ export default function ChatPanel({
235
+ conversation,
236
+ actions,
237
+ tools,
238
+ }: ChatPanelProps) {
239
+ const {
240
+ interactions,
241
+ sendingInteractionId,
242
+ hasOlder,
243
+ onLoadOlder,
244
+ sending,
245
+ sendingMessage,
246
+ sendingImageCount,
247
+ sendingVideoCount,
248
+ streamedReply,
249
+ streamedResponse,
250
+ agentProgress,
251
+ agentActivitySnapshots,
252
+ thinkingExpanded,
253
+ onThinkingExpandedChange: handleThinkingExpandedChange,
254
+ message: initialMessage,
255
+ imageAttachments,
256
+ videoAttachments,
257
+ documentName,
258
+ pendingApproval,
259
+ agentMode,
260
+ planMode,
261
+ status,
262
+ workspacePath,
263
+ chatId,
264
+ recentWorkspacePaths,
265
+ chatEnd,
266
+ welcomeInteraction,
267
+ onSubmit,
268
+ onSelectImage,
269
+ onSelectVideo,
270
+ onSelectDocument,
271
+ onPasteImage,
272
+ onSetMessage,
273
+ onSendVoiceMessage,
274
+ onRemoveImage,
275
+ onRemoveVideo,
276
+ onRemoveDocument,
277
+ onStartWebSearch,
278
+ onCaptureScreen,
279
+ onSetAgentMode,
280
+ onSetPlanMode,
281
+ onSetProvider,
282
+ onSelectWorkspace,
283
+ onWorkspaceChanged,
284
+ onApproval,
285
+ settingsConfig,
286
+ onUpdateSettings,
287
+ onSetModel,
288
+ onSelectModelAndProvider,
289
+ onCancelMessage,
290
+ onClearMessages,
291
+ onSetGeminiLiveVoice,
292
+ onToggleMobileSidebar,
293
+ isCliSession,
294
+ cliSessionId,
295
+ onBackToCode,
296
+ conversationTitle,
297
+ slashChoice,
298
+ onOpenArtifact,
299
+ onOpenReview,
300
+ onSelectSlashChoice,
301
+ onDismissSlashChoice,
302
+ queuedPrompts = [],
303
+ queuePaused = false,
304
+ onRemoveQueuedPrompt,
305
+ onEditQueuedPrompt,
306
+ onClearQueuedPrompts,
307
+ onSteerQueuedPrompt,
308
+ onResumeQueue,
309
+ } = { ...conversation, ...actions }
310
+ const message = useComposerDraft(initialMessage, actions.subscribeMessage, actions.getMessage)
311
+ const onThinkingExpandedChange = useLatestCallback(handleThinkingExpandedChange)
312
+ // The initiating surface already renders a live prompt/reply pair below.
313
+ // Hide its matching persisted turn until the local stream settles, while
314
+ // still showing turns submitted from other surfaces during that time.
315
+ const visibleInteractions = useMemo(
316
+ () => visibleInteractionsDuringRun(interactions, sending, sendingInteractionId),
317
+ [interactions, sending, sendingInteractionId],
318
+ )
319
+ // Keep the composer summary tied to the active/latest agent run. This is cheap
320
+ // metadata, but memoizing it avoids parsing the activity stream while typing.
321
+ const composerChanges = useMemo(() => parseFileChangesFromProgress(agentProgress), [agentProgress])
322
+ const composerAdditions = useMemo(
323
+ () => composerChanges.reduce((sum, change) => sum + change.additions, 0),
324
+ [composerChanges],
325
+ )
326
+ const composerDeletions = useMemo(
327
+ () => composerChanges.reduce((sum, change) => sum + change.deletions, 0),
328
+ [composerChanges],
329
+ )
330
+ const composerChangeLabel = composerChanges.length === 1
331
+ ? '1 file changed'
332
+ : `${composerChanges.length} files changed`
333
+ const historicalChanges = useMemo(() => {
334
+ const historicalGroups = interactions.map((interaction) => {
335
+ const interactionId = String(interaction.id)
336
+ const progress = agentActivitySnapshots[interactionId] ?? interaction.agentActivity ?? EMPTY_AGENT_PROGRESS
337
+ return parseFileChangesFromProgress(progress)
338
+ })
339
+ return mergeFileChanges(historicalGroups)
340
+ }, [agentActivitySnapshots, interactions])
341
+ // Review uses current data even from a memoized historical message's button.
342
+ // Merge the conversation only when requested, not on each progress update.
343
+ const getConversationChanges = useLatestCallback(() => mergeFileChanges([historicalChanges, composerChanges]))
344
+
345
+ const projectName = useMemo(() => {
346
+ if (!workspacePath) return null
347
+ const clean = workspacePath.replace(/[\\/]+$/, '').trim()
348
+ if (!clean) return null
349
+ const parts = clean.split(/[\\/]/)
350
+ return parts[parts.length - 1] || clean
351
+ }, [workspacePath])
352
+
353
+ // Markdown parsing can be expensive for code, tables, and interactive cards.
354
+ // Limit it to a steady cadence instead of parsing on every stream chunk.
355
+ const throttledStreamedReply = useThrottledValue(streamedReply, STREAM_MARKDOWN_UPDATE_MS)
356
+ const liveWebSources = useMemo(() => parseWebSearchSources(agentProgress), [agentProgress])
357
+ const activeFallbackNotice = fallbackNotice(streamedResponse)
358
+ const compaction = useMemo(() => activeCompactionFrom(agentProgress), [agentProgress])
359
+ const liveThoughts = useMemo(() => thoughtsFrom(agentProgress), [agentProgress])
360
+ const liveExtendedThoughts = useMemo(() => extendedThoughtsFrom(agentProgress), [agentProgress])
361
+ const lastThinkingProgress = useMemo(() => [...agentProgress].reverse().find(p => p.type === 'Thinking'), [agentProgress])
362
+ let activeAgentName: string | null = null
363
+ let activeModelName: string | null = null
364
+ if (lastThinkingProgress && lastThinkingProgress.type === 'Thinking') {
365
+ activeAgentName = (lastThinkingProgress.data as any).agent_name || null
366
+ activeModelName = (lastThinkingProgress.data as any).model_name || null
367
+ }
368
+ const [openActivityIds, setOpenActivityIds] = useState<Record<string, boolean>>({})
369
+ const [reviewPage, setReviewPage] = useState<{ title: string; changes: FileChange[] } | null>(null)
370
+ const [activeArtifact, setActiveArtifact] = useState<ArtifactFile | null>(null)
371
+ const [toolMenuOpen, setToolMenuOpen] = useState(false)
372
+ const [dynamicOllamaModels, setDynamicOllamaModels] = useState<string[]>(OLLAMA_MODELS)
373
+ const toggleActivity = useCallback((id: string) => {
374
+ setOpenActivityIds(current => ({ ...current, [id]: !(current[id] ?? (id === 'live')) }))
375
+ }, [])
376
+
377
+ const openArtifact = useLatestCallback((artifact: ArtifactFile) => {
378
+ if (onOpenArtifact) onOpenArtifact(artifact)
379
+ else setActiveArtifact({ ...artifact, workspacePath: artifact.workspacePath ?? workspacePath })
380
+ })
381
+
382
+ const openReview = useLatestCallback((title: string, changes: FileChange[]) => {
383
+ if (onOpenReview) onOpenReview({ id: `review:${Date.now()}`, kind: 'review', title: 'Review', reviewTitle: title, changes })
384
+ else setReviewPage({ title, changes })
385
+ })
386
+
387
+ const openAllConversationReview = useLatestCallback(() => {
388
+ openReview('All conversation changes', getConversationChanges())
389
+ })
390
+
391
+ useEffect(() => {
392
+ if (!shouldProbeOllamaModels(status, settingsConfig)) return
393
+ let cancelled = false
394
+ const fetchOllamaModels = async () => {
395
+ const host = settingsConfig?.ollamaHost || 'http://localhost:11434'
396
+ const cleanHost = host.endsWith('/') ? host.slice(0, -1) : host
397
+ try {
398
+ const controller = new AbortController()
399
+ const timer = setTimeout(() => controller.abort(), 2000)
400
+ const res = await fetch(`${cleanHost}/api/tags`, { signal: controller.signal })
401
+ clearTimeout(timer)
402
+ if (res.ok) {
403
+ const data = await res.json()
404
+ if (!cancelled && data && Array.isArray(data.models) && data.models.length > 0) {
405
+ setDynamicOllamaModels(data.models.map((m: any) => m.name))
406
+ return
407
+ }
408
+ }
409
+ } catch (err) {
410
+ // Direct fetch failed or timed out — try backend Tauri / API server
411
+ }
412
+
413
+ try {
414
+ const live = await fetchProviderModels('ollama', '')
415
+ if (!cancelled && live && live.length > 0) {
416
+ setDynamicOllamaModels(live)
417
+ return
418
+ }
419
+ } catch (err) {
420
+ // Fallback
421
+ }
422
+
423
+ if (!cancelled) {
424
+ if (settingsConfig?.ollamaModel) {
425
+ setDynamicOllamaModels([settingsConfig.ollamaModel])
426
+ } else {
427
+ setDynamicOllamaModels(OLLAMA_MODELS)
428
+ }
429
+ }
430
+ }
431
+ fetchOllamaModels()
432
+ return () => {
433
+ cancelled = true
434
+ }
435
+ }, [status?.activeProvider, settingsConfig?.ollamaHost, settingsConfig?.ollamaModel])
436
+ const [speechError, setSpeechError] = useState('')
437
+ const [speakingText, setSpeakingText] = useState<string | null>(null)
438
+ const [copiedId, setCopiedId] = useState<string | number | null>(null)
439
+
440
+ const chatContainerRef = useRef<HTMLDivElement | null>(null)
441
+ const virtualHistoryRef = useRef<VirtualChatHistoryHandle | null>(null)
442
+ const [showScrollToBottom, setShowScrollToBottom] = useState(false)
443
+ const [loadingOlder, setLoadingOlder] = useState(false)
444
+ const isNearBottomRef = useRef(true)
445
+ const scrollFrameRef = useRef<number | null>(null)
446
+
447
+ const handleChatScroll = useCallback(() => {
448
+ const el = chatContainerRef.current
449
+ if (!el) return
450
+ const distanceFromBottom = el.scrollHeight - el.scrollTop - el.clientHeight
451
+ const nearBottom = distanceFromBottom <= 240
452
+ setShowScrollToBottom(!nearBottom)
453
+ isNearBottomRef.current = nearBottom
454
+ }, [])
455
+
456
+ const scheduleScrollToLatest = useCallback(() => {
457
+ if (!isNearBottomRef.current || scrollFrameRef.current !== null) return
458
+ scrollFrameRef.current = window.requestAnimationFrame(() => {
459
+ scrollFrameRef.current = null
460
+ const element = chatContainerRef.current
461
+ if (element && isNearBottomRef.current) {
462
+ // Smooth scrolling on every token restarts animations and causes jank.
463
+ virtualHistoryRef.current?.scrollToEnd()
464
+ }
465
+ })
466
+ }, [])
467
+
468
+ useEffect(() => {
469
+ scheduleScrollToLatest()
470
+ }, [interactions, sending, streamedReply, pendingApproval, agentProgress, scheduleScrollToLatest])
471
+
472
+ useEffect(() => {
473
+ isNearBottomRef.current = true
474
+ setShowScrollToBottom(false)
475
+ scheduleScrollToLatest()
476
+ }, [chatId, scheduleScrollToLatest])
477
+
478
+ useEffect(() => () => {
479
+ if (scrollFrameRef.current !== null) window.cancelAnimationFrame(scrollFrameRef.current)
480
+ }, [])
481
+
482
+ useEffect(() => {
483
+ const el = chatContainerRef.current
484
+ if (!el) return
485
+ if (isNearBottomRef.current) {
486
+ el.scrollTop = el.scrollHeight
487
+ }
488
+ }, [activeArtifact])
489
+
490
+ const scrollToBottom = useCallback(() => {
491
+ isNearBottomRef.current = true
492
+ virtualHistoryRef.current?.scrollToEnd()
493
+ }, [])
494
+
495
+ const [splitRatio, setSplitRatio] = useState<number>(() => {
496
+ try {
497
+ const saved = localStorage.getItem('mint_preview_split_ratio')
498
+ if (saved) {
499
+ const val = parseFloat(saved)
500
+ if (!isNaN(val) && val >= 0.2 && val <= 0.8) {
501
+ return val
502
+ }
503
+ }
504
+ } catch {
505
+ // ignore
506
+ }
507
+ return 0.5
508
+ })
509
+ const currentRatioRef = useRef(splitRatio)
510
+ const wrapperRef = useRef<HTMLDivElement | null>(null)
511
+
512
+ const handleResizerMouseDown = useCallback((e: React.MouseEvent) => {
513
+ e.preventDefault()
514
+ const wrapper = wrapperRef.current
515
+ if (!wrapper) return
516
+
517
+ wrapper.classList.add('is-resizing')
518
+
519
+ const onMouseMove = (moveEvent: MouseEvent) => {
520
+ const rect = wrapper.getBoundingClientRect()
521
+ const totalWidth = rect.width
522
+ if (totalWidth <= 0) return
523
+
524
+ const previewPx = rect.right - moveEvent.clientX
525
+ const clampedPreviewPx = Math.max(280, Math.min(totalWidth - 340, previewPx))
526
+ const newRatio = clampedPreviewPx / totalWidth
527
+ currentRatioRef.current = newRatio
528
+ wrapper.style.setProperty('--preview-width', `${(newRatio * 100).toFixed(2)}%`)
529
+ }
530
+
531
+ const onMouseUp = () => {
532
+ window.removeEventListener('mousemove', onMouseMove)
533
+ window.removeEventListener('mouseup', onMouseUp)
534
+ wrapper.classList.remove('is-resizing')
535
+ setSplitRatio(currentRatioRef.current)
536
+ try {
537
+ localStorage.setItem('mint_preview_split_ratio', currentRatioRef.current.toFixed(4))
538
+ } catch {
539
+ // ignore
540
+ }
541
+ }
542
+
543
+ window.addEventListener('mousemove', onMouseMove)
544
+ window.addEventListener('mouseup', onMouseUp)
545
+ }, [])
546
+
547
+ const handleResizerDoubleClick = useCallback(() => {
548
+ const defaultRatio = 0.5
549
+ currentRatioRef.current = defaultRatio
550
+ setSplitRatio(defaultRatio)
551
+ if (wrapperRef.current) {
552
+ wrapperRef.current.style.setProperty('--preview-width', '50%')
553
+ }
554
+ try {
555
+ localStorage.setItem('mint_preview_split_ratio', '0.5')
556
+ } catch {
557
+ // ignore
558
+ }
559
+ }, [])
560
+
561
+ const [rewindModalState, setRewindModalState] = useState<{
562
+ isOpen: boolean
563
+ interaction: any | null
564
+ changes: FileChange[]
565
+ checkpoints: GitCheckpoint[]
566
+ targetCheckpoint: GitCheckpoint | null
567
+ isLoading: boolean
568
+ }>({
569
+ isOpen: false,
570
+ interaction: null,
571
+ changes: [],
572
+ checkpoints: [],
573
+ targetCheckpoint: null,
574
+ isLoading: false,
575
+ })
576
+
577
+ const [undoToastState, setUndoToastState] = useState<{
578
+ visible: boolean
579
+ message: string
580
+ canUndo: boolean
581
+ isUndoing: boolean
582
+ type: 'success' | 'error'
583
+ }>({
584
+ visible: false,
585
+ message: '',
586
+ canUndo: false,
587
+ isUndoing: false,
588
+ type: 'success',
589
+ })
590
+
591
+ useEffect(() => {
592
+ if (!undoToastState.visible) return
593
+ const timer = setTimeout(() => {
594
+ setUndoToastState((prev) => ({ ...prev, visible: false }))
595
+ }, 16000)
596
+ return () => clearTimeout(timer)
597
+ }, [undoToastState.visible, undoToastState.message])
598
+
599
+ const handleConfirmRewind = useCallback(async (targetStep: number) => {
600
+ const interaction = rewindModalState.interaction
601
+ if (!interaction) return
602
+ const chatId = interaction.chatId || 'cli'
603
+
604
+ setRewindModalState((prev) => ({ ...prev, isLoading: true }))
605
+ try {
606
+ const res = await rollbackGitCheckpoint(chatId, targetStep, workspacePath)
607
+ setRewindModalState((prev) => ({ ...prev, isOpen: false, isLoading: false }))
608
+ if (res.status === 'ok') {
609
+ setUndoToastState({
610
+ visible: true,
611
+ message: res.message,
612
+ canUndo: true,
613
+ isUndoing: false,
614
+ type: 'success',
615
+ })
616
+ } else {
617
+ setUndoToastState({
618
+ visible: true,
619
+ message: `Failed to rewind: ${res.message}`,
620
+ canUndo: false,
621
+ isUndoing: false,
622
+ type: 'error',
623
+ })
624
+ }
625
+ } catch (err: any) {
626
+ setRewindModalState((prev) => ({ ...prev, isOpen: false, isLoading: false }))
627
+ setUndoToastState({
628
+ visible: true,
629
+ message: `Error: ${err.message || String(err)}`,
630
+ canUndo: false,
631
+ isUndoing: false,
632
+ type: 'error',
633
+ })
634
+ }
635
+ }, [rewindModalState.interaction, workspacePath])
636
+
637
+ const handleUndoRewind = useCallback(async () => {
638
+ setUndoToastState((prev) => ({ ...prev, isUndoing: true }))
639
+ try {
640
+ const res = await undoGitCheckpoint(workspacePath)
641
+ if (res.status === 'ok') {
642
+ setUndoToastState({
643
+ visible: true,
644
+ message: res.message,
645
+ canUndo: false,
646
+ isUndoing: false,
647
+ type: 'success',
648
+ })
649
+ } else {
650
+ setUndoToastState({
651
+ visible: true,
652
+ message: `Failed to undo rewind: ${res.message}`,
653
+ canUndo: true,
654
+ isUndoing: false,
655
+ type: 'error',
656
+ })
657
+ }
658
+ } catch (err: any) {
659
+ setUndoToastState({
660
+ visible: true,
661
+ message: `Error: ${err.message || String(err)}`,
662
+ canUndo: true,
663
+ isUndoing: false,
664
+ type: 'error',
665
+ })
666
+ }
667
+ }, [workspacePath])
668
+
669
+ const handleCopyMessage = useCallback(async (id: string | number, text: string) => {
670
+ try {
671
+ const cleanText = readableAssistantText(text) || text
672
+ await navigator.clipboard.writeText(cleanText)
673
+ setCopiedId(id)
674
+ setTimeout(() => {
675
+ setCopiedId((current) => (current === id ? null : current))
676
+ }, 2000)
677
+ } catch (err) {
678
+ console.error('Failed to copy message:', err)
679
+ }
680
+ }, [])
681
+
682
+
683
+ const toolMenuRef = useRef<HTMLDivElement | null>(null)
684
+ const historyReadyRef = useRef(false)
685
+ const submittedDuringSessionRef = useRef(false)
686
+ const lastAutoSpokenIdRef = useRef<number | string | null>(null)
687
+ const speakingRef = useRef<string | null>(null)
688
+
689
+ // Drag and Drop Zone Overlay
690
+ const [isDragging, setIsDragging] = useState(false)
691
+ const dragCounter = useRef(0)
692
+ const lastDropTimeRef = useRef(0)
693
+
694
+ const handleDragEnter = (e: DragEvent<HTMLElement>) => {
695
+ e.preventDefault()
696
+ if (e.dataTransfer?.types?.includes('Files')) {
697
+ dragCounter.current++
698
+ setIsDragging(true)
699
+ }
700
+ }
701
+
702
+ const handleDragLeave = (e: DragEvent<HTMLElement>) => {
703
+ e.preventDefault()
704
+ if (e.dataTransfer?.types?.includes('Files')) {
705
+ dragCounter.current--
706
+ if (dragCounter.current === 0) {
707
+ setIsDragging(false)
708
+ }
709
+ }
710
+ }
711
+
712
+ const handleDragOver = (e: DragEvent<HTMLElement>) => {
713
+ e.preventDefault()
714
+ }
715
+
716
+ const handleDrop = (e: DragEvent<HTMLElement>) => {
717
+ e.preventDefault()
718
+ e.stopPropagation()
719
+ dragCounter.current = 0
720
+ setIsDragging(false)
721
+
722
+ const now = Date.now()
723
+ if (now - lastDropTimeRef.current < 250) {
724
+ return
725
+ }
726
+ lastDropTimeRef.current = now
727
+
728
+ const files = e.dataTransfer?.files
729
+ if (files && files.length > 0) {
730
+ const file = files[0]
731
+ if (file.type.startsWith('image/')) {
732
+ const input = document.getElementById('vision-file-input') as HTMLInputElement | null
733
+ if (input) {
734
+ const dt = new DataTransfer()
735
+ dt.items.add(file)
736
+ input.files = dt.files
737
+ const event = { target: input } as ChangeEvent<HTMLInputElement>
738
+ onSelectImage(event)
739
+ }
740
+ } else if (file.type.startsWith('video/')) {
741
+ const input = document.getElementById('video-file-input') as HTMLInputElement | null
742
+ if (input) {
743
+ const dt = new DataTransfer()
744
+ dt.items.add(file)
745
+ input.files = dt.files
746
+ const event = { target: input } as ChangeEvent<HTMLInputElement>
747
+ onSelectVideo(event)
748
+ }
749
+ } else if (isSupportedDocument(file.name)) {
750
+ const input = document.getElementById('document-file-input') as HTMLInputElement | null
751
+ if (input) {
752
+ const dt = new DataTransfer()
753
+ dt.items.add(file)
754
+ input.files = dt.files
755
+ const event = { target: input } as ChangeEvent<HTMLInputElement>
756
+ onSelectDocument(event)
757
+ }
758
+ }
759
+ }
760
+ }
761
+
762
+
763
+ // The mic button dictates into the composer (native capture on Desktop,
764
+ // browser speech recognition on Web). Gemini Live has its own button and overlay.
765
+ const {
766
+ isRecording,
767
+ voiceMode,
768
+ setVoiceMode,
769
+ voiceTranscript,
770
+ setVoiceTranscript,
771
+ voiceAwaitingResponse,
772
+ voiceAwaitingResponseRef,
773
+ voiceModeRef,
774
+ startRecognition,
775
+ stopRecognition,
776
+ cancelRecognition,
777
+ scheduleVoiceListen,
778
+ clearRestartTimer
779
+ } = useVoiceInput({
780
+ chatId,
781
+ onSendVoiceMessage,
782
+ language: settingsConfig?.language,
783
+ message,
784
+ sending,
785
+ isSpeaking: Boolean(speakingText),
786
+ onSetMessage,
787
+ })
788
+
789
+ const geminiLiveEnabled = settingsConfig?.voiceMode === 'geminiLive'
790
+ const geminiLive = useGeminiLiveVoice({
791
+ workspacePath,
792
+ chatId,
793
+ startSession: startGeminiLiveSession,
794
+ sendAudioChunk: sendGeminiLiveAudioChunk,
795
+ stopSession: stopGeminiLiveSession
796
+ })
797
+
798
+ const canSubmit = Boolean(message.trim() || imageAttachments.length > 0 || videoAttachments.length > 0 || documentName)
799
+ const sendingImageMarkers = Array.from({ length: sendingImageCount }, (_, index) => `[Image #${index + 1}]`).join(' ')
800
+ const sendingVideoMarkers = Array.from({ length: sendingVideoCount || 0 }, (_, index) => `[Video #${index + 1}]`).join(' ')
801
+
802
+ const getAvailableModels = (provider: string) => {
803
+ switch (provider) {
804
+ case 'gemini':
805
+ return GEMINI_MODELS
806
+ case 'openai':
807
+ return OPENAI_MODELS
808
+ case 'openrouter':
809
+ return OPENROUTER_MODELS
810
+ case 'deepseek':
811
+ return DEEPSEEK_MODELS
812
+ case 'anthropic':
813
+ return ANTHROPIC_MODELS
814
+ case 'huggingface':
815
+ return HF_MODELS
816
+ case 'local_openai':
817
+ return LOCAL_MODELS
818
+ case 'ollama':
819
+ return dynamicOllamaModels
820
+ default:
821
+ if (provider.startsWith('custom:')) {
822
+ const id = provider.replace(/^custom:/, '')
823
+ const cp = (settingsConfig?.customProviders ?? []).find(p => p.id === id)
824
+ return cp?.models.map(m => m.modelId) ?? []
825
+ }
826
+ return []
827
+ }
828
+ }
829
+
830
+ const activeProvider = status?.activeProvider ?? ''
831
+ const availableModels = getAvailableModels(activeProvider)
832
+
833
+ const getActiveModel = (provider: string) => {
834
+ if (!settingsConfig) return ''
835
+ switch (provider) {
836
+ case 'gemini':
837
+ return settingsConfig.geminiModel
838
+ case 'openai':
839
+ return settingsConfig.openaiModel
840
+ case 'openrouter':
841
+ return settingsConfig.openrouterModel
842
+ case 'deepseek':
843
+ return settingsConfig.deepseekModel
844
+ case 'anthropic':
845
+ return settingsConfig.anthropicModel
846
+ case 'huggingface':
847
+ return settingsConfig.hfModel
848
+ case 'local_openai':
849
+ return settingsConfig.localModelName
850
+ case 'ollama':
851
+ return settingsConfig.ollamaModel
852
+ default:
853
+ if (provider.startsWith('custom:')) {
854
+ const id = provider.replace(/^custom:/, '')
855
+ const cp = (settingsConfig?.customProviders ?? []).find(p => p.id === id)
856
+ return (settingsConfig.customModelSelections ?? {})[id] ?? cp?.models[0]?.modelId ?? ''
857
+ }
858
+ return ''
859
+ }
860
+ }
861
+ const activeModel = getActiveModel(activeProvider)
862
+ const textareaRef = useRef<HTMLTextAreaElement>(null)
863
+ const slashRef = useRef<SlashSuggestionsHandle>(null)
864
+
865
+ // Up/Down input history: recall previously submitted prompts (parity with the CLI).
866
+ // `historyIndex` counts back from the newest entry — 0 is the most recent, null
867
+ // means "editing the live draft". The draft is stashed the moment browsing starts.
868
+ const promptHistory = useMemo(() => {
869
+ const out: string[] = []
870
+ for (const it of interactions) {
871
+ if (it?.provider === 'system') continue
872
+ const text = typeof it?.userText === 'string' ? it.userText.trim() : ''
873
+ if (!text) continue
874
+ if (out[out.length - 1] === text) continue
875
+ out.push(text)
876
+ }
877
+ return out
878
+ }, [interactions])
879
+ const [historyIndex, setHistoryIndex] = useState<number | null>(null)
880
+ const historyDraftRef = useRef('')
881
+
882
+ const applyHistoryValue = (value: string) => {
883
+ onSetMessage(value)
884
+ setTimeout(() => {
885
+ const el = textareaRef.current
886
+ if (!el) return
887
+ resizeInput(el)
888
+ const end = el.value.length
889
+ el.setSelectionRange(end, end)
890
+ el.focus()
891
+ }, 0)
892
+ }
893
+ const navigateHistoryPrev = () => {
894
+ if (promptHistory.length === 0) return false
895
+ if (historyIndex === null) {
896
+ historyDraftRef.current = message
897
+ setHistoryIndex(0)
898
+ applyHistoryValue(promptHistory[promptHistory.length - 1])
899
+ return true
900
+ }
901
+ if (historyIndex + 1 < promptHistory.length) {
902
+ const next = historyIndex + 1
903
+ setHistoryIndex(next)
904
+ applyHistoryValue(promptHistory[promptHistory.length - 1 - next])
905
+ }
906
+ return true
907
+ }
908
+ // "Edit" on a past user message: drop its text back into the composer so it
909
+ // can be tweaked and sent again as a new message (nothing is deleted).
910
+ const handleEditMessage = useLatestCallback((text: string) => {
911
+ setHistoryIndex(null)
912
+ applyHistoryValue(text)
913
+ })
914
+ const navigateHistoryNext = () => {
915
+ if (historyIndex === null) return false
916
+ if (historyIndex === 0) {
917
+ setHistoryIndex(null)
918
+ applyHistoryValue(historyDraftRef.current)
919
+ return true
920
+ }
921
+ const next = historyIndex - 1
922
+ setHistoryIndex(next)
923
+ applyHistoryValue(promptHistory[promptHistory.length - 1 - next])
924
+ return true
925
+ }
926
+
927
+ // Fill a menu pick into the composer (never submits — a separate Enter runs
928
+ // it). The <SlashSuggestions> child owns all the menu state; this only writes
929
+ // the completed text back and refocuses.
930
+ const completeSuggestion = (text: string) => {
931
+ onSetMessage(text)
932
+ setTimeout(() => {
933
+ const el = textareaRef.current
934
+ if (!el) return
935
+ resizeInput(el)
936
+ el.focus()
937
+ }, 0)
938
+ }
939
+
940
+ const submitOnEnter = (event: KeyboardEvent<HTMLTextAreaElement>) => {
941
+ if (event.key !== 'Enter' || event.shiftKey || event.nativeEvent.isComposing) return
942
+ event.preventDefault()
943
+ event.currentTarget.form?.requestSubmit()
944
+ }
945
+ const handleInputKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {
946
+ const isPlainArrowNav =
947
+ (event.key === 'ArrowUp' || event.key === 'ArrowDown') &&
948
+ !event.shiftKey && !event.altKey && !event.metaKey && !event.ctrlKey &&
949
+ !event.nativeEvent.isComposing
950
+
951
+ // History browsing wins over the suggestion menu: once it's started, ↑/↓
952
+ // keep stepping through history even if a recalled slash/@ entry would
953
+ // otherwise open the menu (the menu is `suppressed` while browsing anyway).
954
+ if (
955
+ isPlainArrowNav && historyIndex !== null &&
956
+ event.currentTarget.selectionStart === event.currentTarget.selectionEnd
957
+ ) {
958
+ if (event.key === 'ArrowUp' ? navigateHistoryPrev() : navigateHistoryNext()) {
959
+ event.preventDefault()
960
+ return
961
+ }
962
+ }
963
+
964
+ // Let the suggestion menu claim ↑/↓/Enter/Tab/Escape when it's showing.
965
+ if (slashRef.current?.handleKeyDown(event)) return
966
+
967
+ if (isPlainArrowNav) {
968
+ const el = event.currentTarget
969
+ if (el.selectionStart === el.selectionEnd) {
970
+ if (event.key === 'ArrowUp') {
971
+ const onFirstLine = !el.value.slice(0, el.selectionStart).includes('\n')
972
+ if (onFirstLine && navigateHistoryPrev()) {
973
+ event.preventDefault()
974
+ return
975
+ }
976
+ } else {
977
+ const onLastLine = !el.value.slice(el.selectionEnd).includes('\n')
978
+ if (onLastLine && navigateHistoryNext()) {
979
+ event.preventDefault()
980
+ return
981
+ }
982
+ }
983
+ }
984
+ }
985
+
986
+ submitOnEnter(event)
987
+ }
988
+
989
+ const speechPlayerRef = useRef<SpeechPlayer | null>(null)
990
+ const speechTextRef = useRef<string | null>(null)
991
+ if (!speechPlayerRef.current) speechPlayerRef.current = new SpeechPlayer(speechRequest, state => {
992
+ setSpeakingText(state === 'idle' ? null : speechTextRef.current)
993
+ speakingRef.current = state === 'idle' ? null : speechTextRef.current
994
+ if (state === 'idle') scheduleVoiceListen(900)
995
+ }, message => setSpeechError(message))
996
+ const cancelSpeech = () => { void speechPlayerRef.current?.stop() }
997
+ const speak = useLatestCallback((text: string, turnId?: number, automatic = false) => {
998
+ if (!automatic && speakingText === text) { cancelSpeech(); return }
999
+ setSpeechError('')
1000
+ speechTextRef.current = text
1001
+ const saved = turnId ?? Number([...interactions].reverse().find(interaction => interaction.aiText === text)?.id)
1002
+ void speechPlayerRef.current?.play({ chatId, text, turnId: Number.isFinite(saved) && saved > 0 ? saved : undefined, automatic })
1003
+ })
1004
+ useEffect(() => { cancelSpeech() }, [chatId, sending])
1005
+ useEffect(() => {
1006
+ historyReadyRef.current = false; submittedDuringSessionRef.current = false; lastAutoSpokenIdRef.current = null
1007
+ }, [chatId])
1008
+
1009
+ const resizeInput = (element: HTMLTextAreaElement) => {
1010
+ element.style.height = 'auto'
1011
+ element.style.height = `${Math.min(element.scrollHeight, 120)}px`
1012
+ }
1013
+ useEffect(() => {
1014
+ return () => {
1015
+ void speechPlayerRef.current?.dispose()
1016
+ }
1017
+ }, [])
1018
+ useEffect(() => {
1019
+ if (sending) submittedDuringSessionRef.current = true
1020
+ }, [sending])
1021
+ useEffect(() => {
1022
+ if (interactions.length === 0) return
1023
+ const latest = interactions[interactions.length - 1]
1024
+ if (!historyReadyRef.current) {
1025
+ historyReadyRef.current = true
1026
+ if (!submittedDuringSessionRef.current) {
1027
+ lastAutoSpokenIdRef.current = latest?.id ?? null
1028
+ return
1029
+ }
1030
+ }
1031
+ if (sending) return
1032
+ if (!latest?.aiText || latest.id === lastAutoSpokenIdRef.current) return
1033
+
1034
+ // Gemini Live speaks its own replies over the realtime audio stream — skip the
1035
+ // separate browser/Google TTS pass while a live voice session is active.
1036
+ if (!settingsConfig?.enableVoiceReply || geminiLive.voiceMode) {
1037
+ lastAutoSpokenIdRef.current = latest.id
1038
+ if (voiceMode) {
1039
+ scheduleVoiceListen(350)
1040
+ }
1041
+ return
1042
+ }
1043
+
1044
+ lastAutoSpokenIdRef.current = latest.id
1045
+ speak(latest.aiText, Number(latest.id), true)
1046
+ }, [interactions, sending, settingsConfig?.enableVoiceReply, geminiLive.voiceMode, voiceMode])
1047
+ useEffect(() => {
1048
+ if (!toolMenuOpen) return
1049
+ const closeMenu = (event: MouseEvent) => {
1050
+ if (toolMenuRef.current?.contains(event.target as Node)) return
1051
+ setToolMenuOpen(false)
1052
+ }
1053
+ window.addEventListener('mousedown', closeMenu)
1054
+ return () => window.removeEventListener('mousedown', closeMenu)
1055
+ }, [toolMenuOpen])
1056
+ useEffect(() => {
1057
+ const handleWindowPaste = (event: globalThis.ClipboardEvent) => {
1058
+ if (!event.clipboardData) return
1059
+ if (onPasteImage(event.clipboardData)) {
1060
+ event.preventDefault()
1061
+ event.stopPropagation()
1062
+ }
1063
+ }
1064
+ window.addEventListener('paste', handleWindowPaste, true)
1065
+ return () => window.removeEventListener('paste', handleWindowPaste, true)
1066
+ }, [onPasteImage])
1067
+ useEffect(() => {
1068
+ const handleEscapeKeyDown = (event: globalThis.KeyboardEvent) => {
1069
+ const insideTools = event.target instanceof Element && event.target.closest('.tool-surface-page')
1070
+ if (event.key === 'Escape' && sending && !event.defaultPrevented && !insideTools) {
1071
+ onCancelMessage()
1072
+ }
1073
+ }
1074
+ window.addEventListener('keydown', handleEscapeKeyDown, true)
1075
+ return () => window.removeEventListener('keydown', handleEscapeKeyDown, true)
1076
+ }, [sending, onCancelMessage])
1077
+ useEffect(() => {
1078
+ if (message) return
1079
+ const input = document.getElementById('chat-input') as HTMLTextAreaElement | null
1080
+ if (input) input.style.height = ''
1081
+ }, [message])
1082
+
1083
+ const openImagePicker = () => {
1084
+ setToolMenuOpen(false)
1085
+ document.getElementById('vision-file-input')?.click()
1086
+ }
1087
+ const openVideoPicker = () => {
1088
+ setToolMenuOpen(false)
1089
+ document.getElementById('video-file-input')?.click()
1090
+ }
1091
+ const openDocumentPicker = () => {
1092
+ setToolMenuOpen(false)
1093
+ document.getElementById('document-file-input')?.click()
1094
+ }
1095
+ const startWebSearch = () => {
1096
+ setToolMenuOpen(false)
1097
+ onStartWebSearch()
1098
+ }
1099
+ const startGenerateImagePrompt = () => {
1100
+ setToolMenuOpen(false)
1101
+ if (!agentMode) onSetAgentMode(true)
1102
+ onSetMessage('Generate an image of ')
1103
+ textareaRef.current?.focus()
1104
+ }
1105
+ const startGenerateVideoPrompt = () => {
1106
+ setToolMenuOpen(false)
1107
+ if (!agentMode) onSetAgentMode(true)
1108
+ onSetMessage('Generate a video of ')
1109
+ textareaRef.current?.focus()
1110
+ }
1111
+ const appendWorkspaceReference = (reference: string) => {
1112
+ const trimmed = reference.trim()
1113
+ if (!trimmed) return
1114
+ onSetMessage(message.trim() ? `${message.trimEnd()} ${trimmed} ` : `${trimmed} `)
1115
+ }
1116
+ const handleWorkspaceDrop = (event: DragEvent<HTMLElement>) => {
1117
+ const reference =
1118
+ event.dataTransfer.getData('application/x-mint-workspace-path') ||
1119
+ event.dataTransfer.getData('text/plain')
1120
+ if (!reference.trim().startsWith('@')) return
1121
+ event.preventDefault()
1122
+ appendWorkspaceReference(reference)
1123
+ }
1124
+ const isEmptyChat = interactions.length === 0 && !sending && !pendingApproval
1125
+
1126
+ const handleRewindRequest = useLatestCallback((payload: RewindRequestPayload) => {
1127
+ setRewindModalState({
1128
+ isOpen: true,
1129
+ interaction: payload.interaction,
1130
+ changes: payload.changes,
1131
+ checkpoints: payload.checkpoints,
1132
+ targetCheckpoint: payload.targetCheckpoint,
1133
+ isLoading: false,
1134
+ })
1135
+ })
1136
+
1137
+ const handleRewindError = useLatestCallback((message: string) => {
1138
+ setUndoToastState({
1139
+ visible: true,
1140
+ message,
1141
+ canUndo: false,
1142
+ isUndoing: false,
1143
+ type: 'error',
1144
+ })
1145
+ })
1146
+
1147
+ const liveTurn = sending || pendingApproval ? (
1148
+ <>
1149
+ {sending && (
1150
+ <div style={{ display: 'flex', flexDirection: 'column', gap: '8px', marginBottom: '16px' }}>
1151
+ <div className="message user-message"><div className="bubble-wrapper"><div className="message-bubble"><FormattedMessage text={[sendingMessage, sendingImageMarkers, sendingVideoMarkers].filter(Boolean).join(' ')} /></div></div></div>
1152
+ {agentMode && (
1153
+ <AgentActivityDrawer
1154
+ progress={agentProgress}
1155
+ id="live"
1156
+ isOpen={openActivityIds['live'] ?? true}
1157
+ onToggle={toggleActivity}
1158
+ pendingApproval={!!pendingApproval}
1159
+ chatId={chatId}
1160
+ onOpenArtifact={openArtifact}
1161
+ />
1162
+ )}
1163
+ <TurnFileChanges
1164
+ changes={composerChanges}
1165
+ isLive
1166
+ onOpenArtifact={openArtifact}
1167
+ onOpenReview={openAllConversationReview}
1168
+ />
1169
+ <div className="message ai-message thinking-message">
1170
+ <div className="bubble-wrapper">
1171
+ {!agentMode && liveExtendedThoughts.length > 0 && (
1172
+ <ThinkingBlock
1173
+ blockKey="live-extended"
1174
+ thoughts={liveExtendedThoughts}
1175
+ isLive={true}
1176
+ variant="extended"
1177
+ expanded={thinkingExpanded['live-extended'] ?? true}
1178
+ onExpandedChange={onThinkingExpandedChange}
1179
+ />
1180
+ )}
1181
+ {!agentMode && liveThoughts.length > 0 && liveExtendedThoughts.length === 0 && (
1182
+ <ThinkingBlock
1183
+ blockKey="live"
1184
+ thoughts={liveThoughts}
1185
+ isLive={true}
1186
+ expanded={thinkingExpanded.live ?? true}
1187
+ onExpandedChange={onThinkingExpandedChange}
1188
+ />
1189
+ )}
1190
+ <div className="message-bubble">
1191
+ <McpToolResults progress={agentProgress} running chatId={chatId} />
1192
+ <ViewedImages progress={agentProgress} chatId={chatId} onOpenArtifact={openArtifact} />
1193
+ <span>
1194
+ {compaction ? (
1195
+ <ContextCompactionStatus key={compaction.index} />
1196
+ ) : throttledStreamedReply ? (
1197
+ <FormattedMessage text={throttledStreamedReply} sources={liveWebSources} />
1198
+ ) : (
1199
+ <div className="thinking-status">
1200
+ <span className="thinking-status-label">
1201
+ <span aria-hidden="true">✦ </span>
1202
+ {activeAgentName && activeModelName
1203
+ ? `${activeAgentName} (${activeModelName}) is thinking...`
1204
+ : 'Thinking'}
1205
+ </span>
1206
+ <ThinkingElapsedMeta />
1207
+ </div>
1208
+ )}
1209
+ </span>
1210
+ </div>
1211
+ {streamedResponse && (
1212
+ <div className="message-time" style={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
1213
+ <span className="provider-model-chip" data-provider={(streamedResponse.provider || '').toLowerCase()} title={`${streamedResponse.provider} • ${streamedResponse.model}`}>
1214
+ <ProviderBrandIcon provider={streamedResponse.provider} model={streamedResponse.model} customProviders={settingsConfig?.customProviders} size={13} />
1215
+ <span className="provider-chip-name">{streamedResponse.provider}</span>
1216
+ <span className="provider-chip-divider">/</span>
1217
+ <span className="provider-chip-model">{streamedResponse.model}</span>
1218
+ </span>
1219
+ {activeFallbackNotice && <span className="provider-fallback-notice">{activeFallbackNotice}</span>}
1220
+ {throttledStreamedReply && (
1221
+ <div className="message-action-buttons" style={{ display: 'flex', alignItems: 'center', gap: '4px', marginLeft: 'auto' }}>
1222
+ <button
1223
+ type="button"
1224
+ className={`msg-action-btn copy-btn ${copiedId === 'live' ? 'is-copied' : ''}`}
1225
+ onClick={() => handleCopyMessage('live', throttledStreamedReply)}
1226
+ title={copiedId === 'live' ? 'คัดลอกแล้ว (Copied!)' : 'คัดลอกข้อความ (Copy message)'}
1227
+ >
1228
+ {renderCopyIcon(copiedId === 'live')}
1229
+ </button>
1230
+ <button
1231
+ type="button"
1232
+ className={`msg-action-btn tts-btn ${speakingText === throttledStreamedReply ? 'is-speaking' : ''}`}
1233
+ disabled={sending}
1234
+ onClick={() => speak(throttledStreamedReply)}
1235
+ title={sending ? 'Read after the reply finishes' : speakingText === throttledStreamedReply ? 'Stop reading' : 'Read aloud'}
1236
+ >
1237
+ {renderSpeakerIcon(speakingText === throttledStreamedReply)}
1238
+ </button>
1239
+ </div>
1240
+ )}
1241
+ </div>
1242
+ )}
1243
+ </div>
1244
+ </div>
1245
+ </div>
1246
+ )}
1247
+
1248
+ {pendingApproval && (
1249
+ <ApprovalCard
1250
+ key={pendingApproval.id || JSON.stringify(pendingApproval)}
1251
+ pendingApproval={pendingApproval}
1252
+ onApproval={onApproval}
1253
+ />
1254
+ )}
1255
+ </>
1256
+ ) : null
1257
+
1258
+ const sectionContent = (
1259
+ <section
1260
+ className={`conversation-panel ${isEmptyChat ? 'is-empty' : ''}`}
1261
+ onDragEnter={handleDragEnter}
1262
+ onDragOver={handleDragOver}
1263
+ onDragLeave={handleDragLeave}
1264
+ onDrop={handleDrop}
1265
+ style={activeArtifact || reviewPage ? { flex: '0 0 calc(100% - var(--preview-width, 50%))', width: 'calc(100% - var(--preview-width, 50%))', minWidth: '320px', maxWidth: 'none', margin: 0, position: 'relative' } : undefined}
1266
+ >
1267
+ {speechError && <p role="status" style={{ padding: '8px 16px', fontSize: '12px', color: 'var(--text-muted)' }}>{speechError} <button type="button" onClick={() => setSpeechError('')}>Dismiss</button></p>}
1268
+ {isDragging && (
1269
+ <div
1270
+ className="drag-drop-overlay"
1271
+ onDragEnter={handleDragEnter}
1272
+ onDragLeave={handleDragLeave}
1273
+ onDragOver={handleDragOver}
1274
+ onDrop={handleDrop}
1275
+ style={{
1276
+ position: 'absolute',
1277
+ top: 0,
1278
+ left: 0,
1279
+ right: 0,
1280
+ bottom: 0,
1281
+ background: 'var(--bg-backdrop)',
1282
+ backdropFilter: 'blur(8px)',
1283
+ border: '2px dashed var(--accent)',
1284
+ borderRadius: '16px',
1285
+ margin: '12px',
1286
+ display: 'flex',
1287
+ flexDirection: 'column',
1288
+ alignItems: 'center',
1289
+ justifyContent: 'center',
1290
+ color: 'var(--text-primary)',
1291
+ zIndex: 1000,
1292
+ pointerEvents: 'auto',
1293
+ }}
1294
+ >
1295
+ <div style={{ marginBottom: '16px', color: 'var(--interactive-fg)' }}>
1296
+ <svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
1297
+ <rect x="3" y="3" width="18" height="18" rx="2" ry="2" />
1298
+ <circle cx="8.5" cy="8.5" r="1.5" />
1299
+ <polyline points="21 15 16 10 5 21" />
1300
+ </svg>
1301
+ </div>
1302
+ <div style={{ fontSize: '1.25rem', fontWeight: 'bold', letterSpacing: '0.5px' }}>Drag files to attach data</div>
1303
+ <div style={{ fontSize: '0.85rem', color: 'var(--text-muted)', marginTop: '8px' }}>Supports images (PNG, JPEG, WebP, GIF), videos (MP4, WebM, MOV, MKV), and PDF files</div>
1304
+ </div>
1305
+ )}
1306
+ <div className="chat-header">
1307
+ {onToggleMobileSidebar && (
1308
+ <button
1309
+ className="mobile-menu-btn"
1310
+ type="button"
1311
+ onClick={onToggleMobileSidebar}
1312
+ aria-label="Open navigation menu"
1313
+ >
1314
+ <svg width="22" height="22" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
1315
+ <line x1="3" y1="12" x2="21" y2="12" />
1316
+ <line x1="3" y1="6" x2="21" y2="6" />
1317
+ <line x1="3" y1="18" x2="21" y2="18" />
1318
+ </svg>
1319
+ </button>
1320
+ )}
1321
+ <div className="chat-header-title">
1322
+ {isCliSession ? (
1323
+ <div className="chat-header-breadcrumb">
1324
+ {onBackToCode && (
1325
+ <button
1326
+ type="button"
1327
+ className="chat-header-back-btn"
1328
+ onClick={onBackToCode}
1329
+ title="Back to Code sessions Hub"
1330
+ >
1331
+ <svg
1332
+ width="12"
1333
+ height="12"
1334
+ viewBox="0 0 24 24"
1335
+ fill="none"
1336
+ stroke="currentColor"
1337
+ strokeWidth="2.5"
1338
+ strokeLinecap="round"
1339
+ strokeLinejoin="round"
1340
+ >
1341
+ <path d="M15 18l-6-6 6-6" />
1342
+ </svg>
1343
+ <span>Code</span>
1344
+ </button>
1345
+ )}
1346
+ <span className="chat-header-sep">/</span>
1347
+ <span className="chat-header-session-tag" title={cliSessionId || 'CLI Session'}>
1348
+ <span>
1349
+ {cliSessionId ? (cliSessionId === 'cli' ? 'cli' : `cli::${cliSessionId.replace(/^cli::/, '').slice(0, 7)}`) : 'cli'}
1350
+ </span>
1351
+ </span>
1352
+ </div>
1353
+ ) : (
1354
+ <div className="chat-header-brand-group">
1355
+ <img src={runtimePlatform.appIconPath()} alt="Logo" className="chat-header-logo" />
1356
+ <span
1357
+ className="chat-header-title-text"
1358
+ title={conversationTitle && conversationTitle.trim() && conversationTitle !== 'New chat' ? conversationTitle.trim() : 'Mint Agent'}
1359
+ >
1360
+ {conversationTitle && conversationTitle.trim() && conversationTitle !== 'New chat' ? conversationTitle.trim() : 'Mint Agent'}
1361
+ </span>
1362
+ {projectName && (
1363
+ <span className="chat-header-project-pill" title={`Project: ${workspacePath}`}>
1364
+ <svg width="11" height="11" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round">
1365
+ <path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"></path>
1366
+ </svg>
1367
+ <span>{projectName}</span>
1368
+ </span>
1369
+ )}
1370
+ </div>
1371
+ )}
1372
+ </div>
1373
+ <div className="chat-header-actions">
1374
+ {tools?.onToggle && <ToolsPanelToggle open={tools.open} count={tools.backgroundTaskCount} onToggle={tools.onToggle} />}
1375
+ {activeArtifact && (
1376
+ <button
1377
+ type="button"
1378
+ className="chat-header-pill-btn"
1379
+ title="Close Live Preview"
1380
+ onClick={() => setActiveArtifact(null)}
1381
+ >
1382
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
1383
+ <line x1="18" y1="6" x2="6" y2="18"></line>
1384
+ <line x1="6" y1="6" x2="18" y2="18"></line>
1385
+ </svg>
1386
+ <span>Close preview</span>
1387
+ </button>
1388
+ )}
1389
+ <button
1390
+ type="button"
1391
+ className="chat-header-action-btn"
1392
+ title="Clear conversation"
1393
+ onClick={onClearMessages}
1394
+ >
1395
+ <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
1396
+ <polyline points="3 6 5 6 21 6"></polyline>
1397
+ <path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path>
1398
+ <line x1="10" y1="11" x2="10" y2="17"></line>
1399
+ <line x1="14" y1="11" x2="14" y2="17"></line>
1400
+ </svg>
1401
+ </button>
1402
+ </div>
1403
+ </div>
1404
+ <div className="chat-container" ref={chatContainerRef} onScroll={handleChatScroll} style={{ overflowAnchor: 'none' }}>
1405
+ {hasOlder && onLoadOlder && (
1406
+ <button type="button" className="load-older-messages" disabled={loadingOlder}
1407
+ style={{ display: 'block', margin: '0 auto 20px', padding: '7px 14px', borderRadius: 8,
1408
+ border: '1px solid var(--border-color, #3a3a3a)', background: 'var(--surface, #252525)',
1409
+ color: 'var(--text-secondary, #c0c0c0)', cursor: loadingOlder ? 'default' : 'pointer' }}
1410
+ onClick={async () => {
1411
+ setLoadingOlder(true)
1412
+ try {
1413
+ await onLoadOlder()
1414
+ } finally { setLoadingOlder(false) }
1415
+ }}>
1416
+ {loadingOlder ? 'Loading earlier messages…' : 'Load earlier messages'}
1417
+ </button>
1418
+ )}
1419
+ <VirtualChatHistory key={chatId} ref={virtualHistoryRef} items={visibleInteractions}
1420
+ scrollRef={chatContainerRef} hasOlder={hasOlder}
1421
+ renderRow={(index) => {
1422
+ const interaction = visibleInteractions[index]
1423
+ return (
1424
+ <Fragment key={interaction.id}>
1425
+ {index > 0 && shouldShowSessionDivider(visibleInteractions[index - 1].createdAt, interaction.createdAt) && (
1426
+ <div className="system-event-divider">
1427
+ <div className="system-event-line" />
1428
+ <div className="system-event-pill">
1429
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2">
1430
+ <circle cx="12" cy="12" r="9" />
1431
+ <polyline points="12 7 12 12 15.5 14" />
1432
+ </svg>
1433
+ <span>{formatSessionDividerLabel(interaction.createdAt)}</span>
1434
+ </div>
1435
+ <div className="system-event-line" />
1436
+ </div>
1437
+ )}
1438
+ <ChatMessageItem
1439
+ interaction={interaction}
1440
+ copiedId={copiedId}
1441
+ onEditMessage={handleEditMessage}
1442
+ speakingText={speakingText}
1443
+ agentActivitySnapshots={agentActivitySnapshots}
1444
+ openActivityIds={openActivityIds}
1445
+ handleCopyMessage={handleCopyMessage}
1446
+ speak={speak}
1447
+ toggleActivity={toggleActivity}
1448
+ chatId={chatId}
1449
+ customProviders={settingsConfig?.customProviders}
1450
+ onOpenArtifact={openArtifact}
1451
+ onOpenReview={openAllConversationReview}
1452
+ onRewindRequest={handleRewindRequest}
1453
+ onRewindError={handleRewindError}
1454
+ />
1455
+ </Fragment>
1456
+ )
1457
+ }}
1458
+ tail={liveTurn} />
1459
+ {showScrollToBottom && (
1460
+ <button
1461
+ type="button"
1462
+ className="scroll-to-bottom-btn"
1463
+ onClick={scrollToBottom}
1464
+ title="Scroll to latest message"
1465
+ aria-label="Scroll to latest message"
1466
+ >
1467
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round">
1468
+ <path d="M12 5v14"></path>
1469
+ <path d="M6 13l6 6 6-6"></path>
1470
+ </svg>
1471
+ </button>
1472
+ )}
1473
+ <div ref={chatEnd} />
1474
+ </div>
1475
+
1476
+ <div className="input-area">
1477
+ <ModsPanel workspacePath={workspacePath} chatId={chatId} panelTarget={tools?.modsPanelTarget} onOpen={tools?.onOpenMods ?? (() => {})} />
1478
+ <SubagentStatusStrip
1479
+ progress={agentProgress}
1480
+ onOpenDetails={() => toggleActivity('live')}
1481
+ />
1482
+ {composerChanges.length > 0 && (
1483
+ <button
1484
+ type="button"
1485
+ className={`composer-change-status ${sending ? 'is-live' : ''}`}
1486
+ onClick={() => openReview(composerChangeLabel, composerChanges)}
1487
+ title="Review recent agent changes"
1488
+ >
1489
+ <span className="composer-change-status-copy">
1490
+ {sending && <span className="composer-change-status-spinner" aria-hidden="true" />}
1491
+ <span>{sending ? `Editing ${composerChanges.length} ${composerChanges.length === 1 ? 'file' : 'files'}…` : composerChangeLabel}</span>
1492
+ </span>
1493
+ <span className="composer-change-status-counts" aria-label={`${composerAdditions} additions and ${composerDeletions} deletions`}>
1494
+ {composerAdditions > 0 && <strong>+{composerAdditions}</strong>}
1495
+ {composerDeletions > 0 && <em>-{composerDeletions}</em>}
1496
+ </span>
1497
+ </button>
1498
+ )}
1499
+ {isEmptyChat && (
1500
+ <div className="empty-chat-prompt-wrap">
1501
+ <div className="empty-chat-prompt">Mint Agent is ready to work</div>
1502
+ {projectName && (
1503
+ <div className="empty-chat-project-badge">
1504
+ <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round">
1505
+ <path d="M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"></path>
1506
+ </svg>
1507
+ <span>Working in <strong>{projectName}</strong></span>
1508
+ </div>
1509
+ )}
1510
+ </div>
1511
+ )}
1512
+ {onSelectWorkspace && (
1513
+ <div className="project-context-row">
1514
+ <WorkspaceSelector
1515
+ currentPath={workspacePath || ''}
1516
+ recentPaths={recentWorkspacePaths}
1517
+ onSelectWorkspace={onSelectWorkspace}
1518
+ />
1519
+ {workspacePath && <GitBranchSelector workspacePath={workspacePath} disabled={sending} onBranchChanged={onWorkspaceChanged} />}
1520
+ </div>
1521
+ )}
1522
+ <div className="smart-context-bar">
1523
+ <label className={`smart-context-option ${agentMode ? 'is-active' : ''}`}>
1524
+ <span className="toggle-switch">
1525
+ <input type="checkbox" checked={agentMode} onChange={(event) => onSetAgentMode(event.target.checked)} />
1526
+ <span className="slider round" />
1527
+ </span>
1528
+ <span className="smart-context-copy"><span className="smart-context-title">Agent mode</span></span>
1529
+ </label>
1530
+ {onSetPlanMode && (
1531
+ <label className={`smart-context-option ${planMode ? 'is-active' : ''}`} title="Investigate read-only and require plan approval before editing files or running commands">
1532
+ <span className="toggle-switch">
1533
+ <input type="checkbox" checked={Boolean(planMode)} onChange={(event) => onSetPlanMode(event.target.checked)} />
1534
+ <span className="slider round" />
1535
+ </span>
1536
+ <span className="smart-context-copy"><span className="smart-context-title">Plan mode</span></span>
1537
+ </label>
1538
+ )}
1539
+ </div>
1540
+ {queuedPrompts && queuedPrompts.length > 0 && (
1541
+ <QueuedMessagesBanner
1542
+ queuedPrompts={queuedPrompts}
1543
+ queuePaused={Boolean(queuePaused)}
1544
+ sending={sending}
1545
+ onRemove={onRemoveQueuedPrompt || (() => {})}
1546
+ onEdit={onEditQueuedPrompt || (() => {})}
1547
+ onClear={onClearQueuedPrompts || (() => {})}
1548
+ onSteer={onSteerQueuedPrompt || (() => {})}
1549
+ onResumeQueue={onResumeQueue}
1550
+ />
1551
+ )}
1552
+ <form
1553
+ id="chat-form"
1554
+ className={geminiLiveEnabled ? 'has-live-btn' : ''}
1555
+ style={{ position: 'relative' }}
1556
+ onSubmit={(event) => {
1557
+ setHistoryIndex(null)
1558
+ historyDraftRef.current = ''
1559
+ onSubmit(event)
1560
+ }}
1561
+ onDragOver={(event) => {
1562
+ if (event.dataTransfer.types.includes('application/x-mint-workspace-path')) {
1563
+ event.preventDefault()
1564
+ event.dataTransfer.dropEffect = 'copy'
1565
+ }
1566
+ }}
1567
+ onDrop={handleWorkspaceDrop}
1568
+ onPaste={(event: ClipboardEvent<HTMLElement>) => {
1569
+ if (onPasteImage(event.clipboardData)) event.preventDefault()
1570
+ }}
1571
+ >
1572
+ {slashChoice && (
1573
+ <SlashChoicePanel
1574
+ choice={slashChoice}
1575
+ inputRef={textareaRef}
1576
+ onSelect={onSelectSlashChoice}
1577
+ onDismiss={onDismissSlashChoice}
1578
+ />
1579
+ )}
1580
+ {(imageAttachments.length > 0 || videoAttachments.length > 0 || documentName) && (
1581
+ <div className="mint-attachment">
1582
+ {imageAttachments.map((attachment, idx) => (
1583
+ <div className="mint-image-attachment" key={idx}>
1584
+ <img className="mint-image-preview" src={attachment.objectUrl || attachment.previewDataUri || attachment.dataUri} alt={attachment.name || 'Image attachment'} />
1585
+ <button className="mint-attachment-remove" type="button" onClick={() => onRemoveImage(idx)} aria-label="Remove image">
1586
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
1587
+ <line x1="18" y1="6" x2="6" y2="18"></line>
1588
+ <line x1="6" y1="6" x2="18" y2="18"></line>
1589
+ </svg>
1590
+ </button>
1591
+ </div>
1592
+ ))}
1593
+ {videoAttachments.map((attachment, idx) => (
1594
+ <div className="mint-image-attachment" key={idx}>
1595
+ <video className="mint-image-preview" src={attachment.dataUri} muted playsInline preload="metadata" />
1596
+ <div className="mint-video-play-indicator" style={{ position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)', pointerEvents: 'none', background: 'rgba(0,0,0,0.6)', borderRadius: '50%', display: 'flex', alignItems: 'center', justifyContent: 'center', width: '22px', height: '22px', border: '1.5px solid white' }}>
1597
+ <svg width="10" height="10" viewBox="0 0 24 24" fill="white" stroke="white" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
1598
+ <polygon points="5 3 19 12 5 21 5 3"></polygon>
1599
+ </svg>
1600
+ </div>
1601
+ <button className="mint-attachment-remove" type="button" onClick={() => onRemoveVideo(idx)} aria-label="Remove video">
1602
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
1603
+ <line x1="18" y1="6" x2="6" y2="18"></line>
1604
+ <line x1="6" y1="6" x2="18" y2="18"></line>
1605
+ </svg>
1606
+ </button>
1607
+ </div>
1608
+ ))}
1609
+ {documentName && (
1610
+ <div style={{ display: 'flex', alignItems: 'center', gap: '8px', minWidth: 0 }}>
1611
+ <span aria-hidden="true" style={{ display: 'inline-flex', alignItems: 'center', color: 'var(--text-soft)' }}>
1612
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
1613
+ <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
1614
+ <polyline points="14 2 14 8 20 8"></polyline>
1615
+ </svg>
1616
+ </span>
1617
+ <span style={{ fontSize: '0.76rem', color: 'var(--text-soft)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap', maxWidth: '220px' }}>{documentName}</span>
1618
+ <button type="button" onClick={onRemoveDocument} style={{ background: 'transparent', border: 0, color: 'var(--status-error)', cursor: 'pointer', display: 'inline-flex', alignItems: 'center' }}>
1619
+ <svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
1620
+ <line x1="18" y1="6" x2="6" y2="18"></line>
1621
+ <line x1="6" y1="6" x2="18" y2="18"></line>
1622
+ </svg>
1623
+ </button>
1624
+ </div>
1625
+ )}
1626
+ </div>
1627
+ )}
1628
+ {historyIndex !== null && promptHistory.length > 0 && (
1629
+ <div
1630
+ className="chat-history-indicator"
1631
+ aria-live="polite"
1632
+ style={{
1633
+ position: 'absolute',
1634
+ top: '-9px',
1635
+ right: '14px',
1636
+ padding: '1px 8px',
1637
+ fontSize: '0.68rem',
1638
+ fontWeight: 600,
1639
+ letterSpacing: '0.02em',
1640
+ color: 'var(--text-soft, #94a3b8)',
1641
+ background: 'var(--input-bg, #1e293b)',
1642
+ border: '1px solid var(--border, rgba(148,163,184,0.25))',
1643
+ borderRadius: '999px',
1644
+ pointerEvents: 'none',
1645
+ zIndex: 2,
1646
+ }}
1647
+ >
1648
+ History {historyIndex + 1}/{promptHistory.length}
1649
+ </div>
1650
+ )}
1651
+ <CollapsiblePasteInput
1652
+ id="chat-input"
1653
+ inputRef={textareaRef}
1654
+ value={message}
1655
+ onValueChange={(value) => {
1656
+ onSetMessage(value)
1657
+ if (historyIndex !== null) setHistoryIndex(null)
1658
+ }}
1659
+ onResizeInput={resizeInput}
1660
+ onChange={(event) => {
1661
+ resizeInput(event.currentTarget)
1662
+ onSetMessage(event.target.value)
1663
+ // A real keystroke drops out of history browsing (recalled text kept).
1664
+ if (historyIndex !== null) setHistoryIndex(null)
1665
+ }}
1666
+ onKeyDown={handleInputKeyDown}
1667
+ onDrop={handleWorkspaceDrop}
1668
+ placeholder="Ask anything, @ to mention, / for actions"
1669
+ rows={1}
1670
+ />
1671
+ <SlashSuggestions
1672
+ ref={slashRef}
1673
+ message={message}
1674
+ onComplete={completeSuggestion}
1675
+ workspacePath={workspacePath}
1676
+ mcpServers={settingsConfig?.mcpServers}
1677
+ anchorRef={textareaRef}
1678
+ suppressed={historyIndex !== null || Boolean(slashChoice)}
1679
+ />
1680
+ <div className="chat-tool-menu-wrap" ref={toolMenuRef}>
1681
+ <button id="chat-tool-btn" type="button" aria-haspopup="menu" aria-expanded={toolMenuOpen} onClick={() => setToolMenuOpen((open) => !open)} style={{ display: 'inline-flex', alignItems: 'center', justifyContent: 'center' }}>
1682
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
1683
+ <line x1="12" y1="5" x2="12" y2="19"></line>
1684
+ <line x1="5" y1="12" x2="19" y2="12"></line>
1685
+ </svg>
1686
+ </button>
1687
+ {toolMenuOpen && (
1688
+ <div className="chat-tool-menu" role="menu">
1689
+ <button type="button" role="menuitem" onClick={openImagePicker}>
1690
+ <span aria-hidden="true">
1691
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
1692
+ <rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect>
1693
+ <circle cx="8.5" cy="8.5" r="1.5"></circle>
1694
+ <polyline points="21 15 16 10 5 21"></polyline>
1695
+ </svg>
1696
+ </span>
1697
+ <span>Add image</span>
1698
+ </button>
1699
+ <button type="button" role="menuitem" onClick={openVideoPicker}>
1700
+ <span aria-hidden="true">
1701
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
1702
+ <polygon points="23 7 16 12 23 17 23 7"></polygon>
1703
+ <rect x="1" y="5" width="15" height="14" rx="2" ry="2"></rect>
1704
+ </svg>
1705
+ </span>
1706
+ <span>Add video</span>
1707
+ </button>
1708
+ <button type="button" role="menuitem" onClick={openDocumentPicker}>
1709
+ <span aria-hidden="true">
1710
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
1711
+ <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
1712
+ <polyline points="14 2 14 8 20 8"></polyline>
1713
+ </svg>
1714
+ </span>
1715
+ <span>Add file</span>
1716
+ </button>
1717
+ <button type="button" role="menuitem" onClick={startWebSearch}>
1718
+ <span aria-hidden="true">
1719
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
1720
+ <circle cx="11" cy="11" r="8"></circle>
1721
+ <line x1="21" y1="21" x2="16.65" y2="16.65"></line>
1722
+ </svg>
1723
+ </span>
1724
+ <span>Search web</span>
1725
+ </button>
1726
+ <button type="button" role="menuitem" onClick={startGenerateImagePrompt}>
1727
+ <span aria-hidden="true">
1728
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
1729
+ <path d="M12 2v4M12 18v4M4.93 4.93l2.83 2.83M16.24 16.24l2.83 2.83M2 12h4M18 12h4M4.93 19.07l2.83-2.83M16.24 7.76l2.83-2.83"></path>
1730
+ </svg>
1731
+ </span>
1732
+ <span>Generate image</span>
1733
+ </button>
1734
+ <button type="button" role="menuitem" onClick={startGenerateVideoPrompt}>
1735
+ <span aria-hidden="true">
1736
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5" strokeLinecap="round" strokeLinejoin="round">
1737
+ <polygon points="23 7 16 12 23 17 23 7"></polygon>
1738
+ <rect x="1" y="5" width="15" height="14" rx="2" ry="2"></rect>
1739
+ </svg>
1740
+ </span>
1741
+ <span>Generate video</span>
1742
+ </button>
1743
+ </div>
1744
+ )}
1745
+ </div>
1746
+ <input id="vision-file-input" type="file" accept="image/png,image/jpeg,image/webp,image/gif" onChange={onSelectImage} style={{ display: 'none' }} />
1747
+ <input id="video-file-input" type="file" accept="video/mp4,video/webm,video/quicktime,video/x-matroska" onChange={onSelectVideo} style={{ display: 'none' }} />
1748
+ <input id="document-file-input" type="file" accept={SUPPORTED_DOCUMENT_ACCEPT} onChange={onSelectDocument} style={{ display: 'none' }} />
1749
+ <button id="screen-capture-btn" type="button" onClick={onCaptureScreen} aria-label="Capture screen">
1750
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
1751
+ <rect x="2" y="3" width="20" height="15" rx="2" />
1752
+ <path d="M8 22h8M12 18v4M7 10h10M12 5v10" />
1753
+ </svg>
1754
+ </button>
1755
+ <ModelSelectorPopover
1756
+ activeProvider={status?.activeProvider ?? ''}
1757
+ activeModel={activeModel}
1758
+ availableProviders={status?.availableProviders ?? []}
1759
+ settingsConfig={settingsConfig}
1760
+ dynamicOllamaModels={dynamicOllamaModels}
1761
+ onSelect={(provider, model) => {
1762
+ if (onSelectModelAndProvider) {
1763
+ onSelectModelAndProvider(provider, model)
1764
+ } else {
1765
+ onSetProvider(provider)
1766
+ onSetModel(model)
1767
+ }
1768
+ }}
1769
+ onUpdateSettings={onUpdateSettings}
1770
+ />
1771
+ <VoicePill
1772
+ id="voice-input-btn"
1773
+ className="composer-voice-pill"
1774
+ active={isRecording}
1775
+ disabled={sending || voiceAwaitingResponse || geminiLive.voiceMode}
1776
+ ariaLabel="Voice input"
1777
+ title={isRecording ? 'Stop recording · Esc or slide left to cancel' : 'Tap to dictate · hold to record'}
1778
+ accentColor="var(--text-primary)"
1779
+ iconColor="var(--text-muted)"
1780
+ background="var(--bg-surface-soft)"
1781
+ size={28}
1782
+ shape="pill"
1783
+ reach={8}
1784
+ mode="auto"
1785
+ holdAfter={300}
1786
+ reactive="simulated"
1787
+ showTime
1788
+ waveform
1789
+ slideToCancel
1790
+ cancelDistance={64}
1791
+ attack={40}
1792
+ release={240}
1793
+ openDuration={200}
1794
+ pressScale={0.95}
1795
+ onStart={() => {
1796
+ cancelSpeech()
1797
+ return startRecognition()
1798
+ }}
1799
+ onStop={({ reason }) => {
1800
+ cancelSpeech()
1801
+ if (reason === 'release' || reason === 'tap' || reason === 'key') {
1802
+ void stopRecognition()
1803
+ } else {
1804
+ void cancelRecognition()
1805
+ }
1806
+ }}
1807
+ />
1808
+ {geminiLiveEnabled && (
1809
+ <button
1810
+ id="gemini-live-btn"
1811
+ type="button"
1812
+ onClick={() => geminiLive.setVoiceMode(true)}
1813
+ title="Start Gemini Live conversation"
1814
+ style={{ display: 'inline-flex', alignItems: 'center', justifyContent: 'center' }}
1815
+ >
1816
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
1817
+ <circle cx="12" cy="12" r="2"></circle>
1818
+ <path d="M8.5 8.5a5 5 0 0 0 0 7"></path>
1819
+ <path d="M15.5 8.5a5 5 0 0 1 0 7"></path>
1820
+ <path d="M5.5 5.5a9 9 0 0 0 0 13"></path>
1821
+ <path d="M18.5 5.5a9 9 0 0 1 0 13"></path>
1822
+ </svg>
1823
+ </button>
1824
+ )}
1825
+ {sending ? (
1826
+ <div style={{ display: 'inline-flex', alignItems: 'center', gap: '6px' }}>
1827
+ {canSubmit && (
1828
+ <button
1829
+ id="queue-btn"
1830
+ className="queue-btn"
1831
+ type="submit"
1832
+ title="Add to queue (Enter)"
1833
+ style={{ display: 'inline-flex', alignItems: 'center', justifyContent: 'center' }}
1834
+ >
1835
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
1836
+ <line x1="22" y1="2" x2="11" y2="13"></line>
1837
+ <polygon points="22 2 15 22 11 13 2 9 22 2"></polygon>
1838
+ </svg>
1839
+ </button>
1840
+ )}
1841
+ <button
1842
+ id="send-btn"
1843
+ className="stop-btn"
1844
+ type="button"
1845
+ onClick={onCancelMessage}
1846
+ title="Stop generating"
1847
+ style={{ display: 'inline-flex', alignItems: 'center', justifyContent: 'center' }}
1848
+ >
1849
+ <svg width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
1850
+ <rect x="4" y="4" width="16" height="16" rx="2" ry="2"></rect>
1851
+ </svg>
1852
+ </button>
1853
+ </div>
1854
+ ) : (
1855
+ <button id="send-btn" type="submit" disabled={!canSubmit} style={{ display: 'inline-flex', alignItems: 'center', justifyContent: 'center' }}>
1856
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
1857
+ <line x1="22" y1="2" x2="11" y2="13"></line>
1858
+ <polygon points="22 2 15 22 11 13 2 9 22 2"></polygon>
1859
+ </svg>
1860
+ </button>
1861
+ )}
1862
+ </form>
1863
+ {voiceMode && !isRecording && voiceTranscript && (
1864
+ <p className="composer-voice-feedback" role="status">{voiceTranscript}</p>
1865
+ )}
1866
+ </div>
1867
+ {geminiLive.voiceMode && (
1868
+ <GeminiLiveOverlay
1869
+ status={
1870
+ geminiLive.errorMessage
1871
+ ? 'error'
1872
+ : !geminiLive.isRecording
1873
+ ? 'connecting'
1874
+ : geminiLive.isPaused
1875
+ ? 'paused'
1876
+ : geminiLive.isSpeaking
1877
+ ? 'speaking'
1878
+ : geminiLive.voiceAwaitingResponse
1879
+ ? 'thinking'
1880
+ : 'listening'
1881
+ }
1882
+ userTranscript={geminiLive.userTranscript}
1883
+ assistantTranscript={geminiLive.assistantTranscript}
1884
+ isPaused={geminiLive.isPaused}
1885
+ analyserRef={geminiLive.analyserRef}
1886
+ onTogglePause={geminiLive.togglePause}
1887
+ onEndCall={() => geminiLive.setVoiceMode(false)}
1888
+ voice={settingsConfig?.geminiLiveVoice || 'Puck'}
1889
+ voices={GEMINI_LIVE_VOICES}
1890
+ onChangeVoice={async (voiceName) => {
1891
+ await onSetGeminiLiveVoice(voiceName)
1892
+ geminiLive.restart()
1893
+ }}
1894
+ />
1895
+ )}
1896
+ {undoToastState.visible && (
1897
+ <div className={`rewind-toast-banner ${undoToastState.type === 'error' ? 'is-error' : 'is-success'}`}>
1898
+ <div className="rewind-toast-content">
1899
+ {undoToastState.type === 'error' ? (
1900
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="var(--status-error, #ef4444)" strokeWidth="2">
1901
+ <circle cx="12" cy="12" r="10" />
1902
+ <line x1="12" y1="8" x2="12" y2="12" />
1903
+ <line x1="12" y1="16" x2="12.01" y2="16" />
1904
+ </svg>
1905
+ ) : (
1906
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="var(--accent)" strokeWidth="2.2">
1907
+ <path d="M22 11.08V12a10 10 0 1 1-5.93-9.14" />
1908
+ <polyline points="22 4 12 14.01 9 11.01" />
1909
+ </svg>
1910
+ )}
1911
+ <span className="rewind-toast-text">{undoToastState.message}</span>
1912
+ </div>
1913
+
1914
+ <div className="rewind-toast-actions">
1915
+ {undoToastState.canUndo && (
1916
+ <button
1917
+ type="button"
1918
+ className="rewind-toast-undo-btn"
1919
+ onClick={handleUndoRewind}
1920
+ disabled={undoToastState.isUndoing}
1921
+ title="Restore workspace files back from safety rescue snapshot"
1922
+ >
1923
+ {undoToastState.isUndoing ? (
1924
+ 'Undoing...'
1925
+ ) : (
1926
+ <>
1927
+ <svg width="13" height="13" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.5">
1928
+ <polyline points="9 14 4 9 9 4" />
1929
+ <path d="M20 20v-7a4 4 0 0 0-4-4H4" />
1930
+ </svg>
1931
+ Undo Rewind
1932
+ </>
1933
+ )}
1934
+ </button>
1935
+ )}
1936
+ <button
1937
+ type="button"
1938
+ className="rewind-toast-close-btn"
1939
+ onClick={() => setUndoToastState((prev) => ({ ...prev, visible: false }))}
1940
+ aria-label="Close notification"
1941
+ >
1942
+ ✕
1943
+ </button>
1944
+ </div>
1945
+ </div>
1946
+ )}
1947
+ </section>
1948
+ )
1949
+
1950
+ return (
1951
+ <div
1952
+ ref={wrapperRef}
1953
+ className={`chat-panel-split-wrapper ${activeArtifact || reviewPage ? 'has-preview' : 'no-preview'}`}
1954
+ style={{
1955
+ '--preview-width': `${(splitRatio * 100).toFixed(2)}%`,
1956
+ } as React.CSSProperties}
1957
+ >
1958
+ {sectionContent}
1959
+ {(activeArtifact || reviewPage) && (
1960
+ <>
1961
+ <div
1962
+ className="preview-split-resizer"
1963
+ onMouseDown={handleResizerMouseDown}
1964
+ onDoubleClick={handleResizerDoubleClick}
1965
+ title="Drag to resize · Double-click to reset 50/50"
1966
+ >
1967
+ <div className="preview-split-resizer-grip" />
1968
+ </div>
1969
+ <Suspense fallback={null}>
1970
+ {reviewPage ? (
1971
+ <CodeReviewPage
1972
+ title={reviewPage.title}
1973
+ changes={reviewPage.changes}
1974
+ workspacePath={workspacePath}
1975
+ onBack={() => setReviewPage(null)}
1976
+ />
1977
+ ) : activeArtifact ? (
1978
+ <ArtifactPreviewPanel artifact={activeArtifact} onClose={() => setActiveArtifact(null)} workspacePath={workspacePath} />
1979
+ ) : null}
1980
+ </Suspense>
1981
+ </>
1982
+ )}
1983
+ {rewindModalState.isOpen && (
1984
+ <Suspense fallback={null}>
1985
+ <RewindModal
1986
+ isOpen={rewindModalState.isOpen}
1987
+ onClose={() => setRewindModalState((prev) => ({ ...prev, isOpen: false }))}
1988
+ onConfirm={handleConfirmRewind}
1989
+ checkpoints={rewindModalState.checkpoints}
1990
+ targetCheckpoint={rewindModalState.targetCheckpoint}
1991
+ changes={rewindModalState.changes}
1992
+ workspacePath={workspacePath}
1993
+ isLoading={rewindModalState.isLoading}
1994
+ />
1995
+ </Suspense>
1996
+ )}
1997
+ </div>
1998
+ )
1999
+ }