@pheem49/mint 1.17.0 → 1.18.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.
- package/Cargo.lock +6 -6
- package/Cargo.toml +2 -2
- package/README.md +8 -2
- package/Release_Note.md +222 -71
- package/crates/mint-cli/src/agent/diff_render.rs +66 -44
- package/crates/mint-cli/src/agent/live_status.rs +21 -4
- package/crates/mint-cli/src/agent/markdown_render.rs +342 -5
- package/crates/mint-cli/src/agent.rs +25 -10
- package/crates/mint-cli/src/commands/agent.rs +4 -92
- package/crates/mint-cli/src/commands/browser.rs +2 -15
- package/crates/mint-cli/src/commands/integrations.rs +3 -3
- package/crates/mint-cli/src/commands/mod.rs +0 -3
- package/crates/mint-cli/src/commands/tailnet_web.rs +1 -0
- package/crates/mint-cli/src/interactive/chat_tui/dialog.rs +572 -0
- package/crates/mint-cli/src/interactive/chat_tui/mod.rs +1427 -0
- package/crates/mint-cli/src/interactive/chat_tui/render.rs +1524 -0
- package/crates/mint-cli/src/interactive/chat_tui/selection.rs +401 -0
- package/crates/mint-cli/src/interactive/chat_tui/state.rs +1833 -0
- package/crates/mint-cli/src/interactive/chat_tui/tests.rs +3414 -0
- package/crates/mint-cli/src/interactive/chat_tui/thought.rs +202 -0
- package/crates/mint-cli/src/interactive/chat_tui/transcript.rs +728 -0
- package/crates/mint-cli/src/interactive/chat_tui/watermark.rs +148 -0
- package/crates/mint-cli/src/interactive/command_ui.rs +53 -5
- package/crates/mint-cli/src/interactive/composer.rs +186 -0
- package/crates/mint-cli/src/interactive/format.rs +78 -3
- package/crates/mint-cli/src/interactive/input_box.rs +61 -1
- package/crates/mint-cli/src/interactive/resume_picker.rs +367 -25
- package/crates/mint-cli/src/interactive/slash_commands.rs +648 -371
- package/crates/mint-cli/src/interactive/tool_activity.rs +93 -20
- package/crates/mint-cli/src/interactive.rs +37 -0
- package/crates/mint-cli/src/main.rs +6 -3
- package/crates/mint-cli/src/markdown.rs +2 -37
- package/crates/mint-cli/src/onboard.rs +700 -282
- package/crates/mint-cli/src/setup.rs +1342 -624
- package/crates/mint-cli/src/terminal_theme.rs +159 -35
- package/crates/mint-cli/tests/library_intake.rs +1 -0
- package/crates/mint-core/src/agent/chat/anthropic.rs +318 -0
- package/crates/mint-core/src/agent/chat/custom.rs +149 -0
- package/crates/mint-core/src/agent/chat/gemini.rs +518 -0
- package/crates/mint-core/src/agent/chat/mod.rs +857 -0
- package/crates/mint-core/src/agent/chat/ollama.rs +321 -0
- package/crates/mint-core/src/agent/chat/openai.rs +582 -0
- package/crates/mint-core/src/agent/chat/streaming.rs +469 -0
- package/crates/mint-core/src/agent/chat/tests.rs +1479 -0
- package/crates/mint-core/src/agent/memory.rs +56 -2
- package/crates/mint-core/src/agent/tasks.rs +2 -2
- package/crates/mint-core/src/api_server/routes/chat.rs +24 -2
- package/crates/mint-core/src/api_server/routes/gemini_live.rs +14 -1
- package/crates/mint-core/src/api_server/routes/html_preview.rs +1 -8
- package/crates/mint-core/src/api_server/routes/sessions.rs +21 -0
- package/crates/mint-core/src/avatar_bridge.rs +0 -22
- package/crates/mint-core/src/browser/cdp.rs +10 -4
- package/crates/mint-core/src/browser/headless.rs +582 -0
- package/crates/mint-core/src/browser/input.rs +7 -62
- package/crates/mint-core/src/browser/interact.rs +0 -14
- package/crates/mint-core/src/browser/mod.rs +8 -29
- package/crates/mint-core/src/browser/navigate.rs +2 -36
- package/crates/mint-core/src/browser/runtime.rs +2 -4
- package/crates/mint-core/src/browser/session.rs +50 -466
- package/crates/mint-core/src/browser/workflow.rs +142 -32
- package/crates/mint-core/src/cron/store.rs +2 -2
- package/crates/mint-core/src/integrations/mcp.rs +6 -8
- package/crates/mint-core/src/lib.rs +0 -5
- package/crates/mint-core/src/media/gemini_live.rs +636 -86
- package/crates/mint-core/src/media/library/migration.rs +26 -0
- package/crates/mint-core/src/media/library/tests.rs +1 -1
- package/crates/mint-core/src/media/library/thumbnails.rs +8 -2
- package/crates/mint-core/src/media/pictures.rs +1 -1
- package/crates/mint-core/src/media/tool_images.rs +92 -1
- package/crates/mint-core/src/mods/manager.rs +101 -35
- package/crates/mint-core/src/orchestration/context_render.rs +441 -24
- package/crates/mint-core/src/orchestration/decision_parsing.rs +531 -16
- package/crates/mint-core/src/orchestration/full_skill_result_tests.rs +12 -0
- package/crates/mint-core/src/orchestration/loop_guard.rs +145 -0
- package/crates/mint-core/src/orchestration/mcp_outcome_tests.rs +864 -0
- package/crates/mint-core/src/orchestration/memory_skill.rs +88 -28
- package/crates/mint-core/src/orchestration/mod.rs +320 -4249
- package/crates/mint-core/src/orchestration/reliability.rs +67 -27
- package/crates/mint-core/src/orchestration/review_regressions.rs +5 -0
- package/crates/mint-core/src/orchestration/tests.rs +1665 -0
- package/crates/mint-core/src/orchestration/tools/dispatch.rs +967 -0
- package/crates/mint-core/src/orchestration/tools/files.rs +1 -0
- package/crates/mint-core/src/orchestration/tools/mod.rs +5 -1
- package/crates/mint-core/src/orchestration/tools/planning.rs +102 -42
- package/crates/mint-core/src/orchestration/tools/shell.rs +129 -58
- package/crates/mint-core/src/orchestration/truncation.rs +170 -13
- package/crates/mint-core/src/orchestration/types.rs +648 -0
- package/crates/mint-core/src/orchestration/verification.rs +0 -3
- package/crates/mint-core/src/orchestration/workspace_helpers.rs +24 -6
- package/crates/mint-core/src/prompts/agent.rs +52 -76
- package/crates/mint-core/src/prompts/tool_catalog.rs +8 -151
- package/crates/mint-core/src/search/files.rs +20 -0
- package/crates/mint-core/src/slash/mod.rs +228 -265
- package/crates/mint-core/src/slash/models.rs +6 -1
- package/crates/mint-core/src/system/bg_shell.rs +1 -0
- package/crates/mint-core/src/system/config.rs +176 -34
- package/crates/mint-mod-runtime/src/lib.rs +37 -23
- package/out/web/assets/ArtifactPreviewPanel-Cx6BVOOF.js +2 -0
- package/out/web/assets/CalculationCard-D2E74u5q.js +1 -0
- package/out/web/assets/CliSessionsView-ZbdtSjvK.css +1 -0
- package/out/web/assets/{CliSessionsView-MI8kXMAb.js → CliSessionsView-z5i6qGyb.js} +1 -1
- package/out/web/assets/CodeReviewPage-BK2bOScd.css +1 -0
- package/out/web/assets/CodeReviewPage-Dp6zHuHu.js +2 -0
- package/out/web/assets/{CommandPalette-BD8SlTE5.js → CommandPalette-DaKlzbKs.js} +1 -1
- package/out/web/assets/ImageGenCard-BMCJHP9O.js +1 -0
- package/out/web/assets/ImageSearchCard-Cld_SOUg.js +1 -0
- package/out/web/assets/{ImageStudioPanel-BP7N4rLr.js → ImageStudioPanel-B5N7TjeB.js} +1 -1
- package/out/web/assets/LibraryPage-CMB89rJ0.css +1 -0
- package/out/web/assets/LibraryPage-DbZEi4W_.js +2 -0
- package/out/web/assets/LinkedFoldersView-9B9DIPoZ.js +1 -0
- package/out/web/assets/{McpRegistryPicker-CoS83vtc.js → McpRegistryPicker-DnXPlzI7.js} +1 -1
- package/out/web/assets/McpServersView-CiNBNUl4.js +1 -0
- package/out/web/assets/MermaidCard-BBDNEXbY.js +2 -0
- package/out/web/assets/MintDashboard-C_UYPoNV.js +119 -0
- package/out/web/assets/MintDashboard-DTd8C_c8.css +1 -0
- package/out/web/assets/PlanCard-C2x5pajq.js +1 -0
- package/out/web/assets/{PluginsView-jBYmcKh4.js → PluginsView-DoTg9MVa.js} +1 -1
- package/out/web/assets/RewindModal-B5oowrR0.js +1 -0
- package/out/web/assets/{ScheduledTasksView-5uw9-V9H.js → ScheduledTasksView-BD5DVPkZ.js} +1 -1
- package/out/web/assets/{SelectField-DXBQtrUK.js → SelectField-Cy6CghrU.js} +1 -1
- package/out/web/assets/SettingsWindow-BYl_oCFh.js +4 -0
- package/out/web/assets/SettingsWindow-Ckcgnjt8.css +1 -0
- package/out/web/assets/{SkillsView-C-gp9J7m.js → SkillsView-CIeWwq5z.js} +1 -1
- package/out/web/assets/StockCard-DxUciKyp.js +1 -0
- package/out/web/assets/ToolSurfacePage-qBgs_VHq.css +1 -0
- package/out/web/assets/ToolSurfacePage-saVbVrkE.js +38 -0
- package/out/web/assets/{UiFeatureCard-6BwxTOCe.js → UiFeatureCard-CdY0hGWy.js} +1 -1
- package/out/web/assets/{UiGridCard-DvZcLNxb.js → UiGridCard-BBK3I5hC.js} +1 -1
- package/out/web/assets/UiMockupWidget-CpR9EDuc.js +1 -0
- package/out/web/assets/{VeoStudioPanel-DOj7_WR3.css → VeoStudioPanel-9kU9YLEN.css} +1 -1
- package/out/web/assets/{VeoStudioPanel-DfsOJKv0.js → VeoStudioPanel-Co6-wEWM.js} +2 -2
- package/out/web/assets/WeatherCard-Buzi7Vfu.js +1 -0
- package/out/web/assets/WorkspacePdfPreview-Bi8Zzyir.js +2 -0
- package/out/web/assets/{abnfDiagram-VCTEODGH-BOo3Ckng.js → abnfDiagram-VCTEODGH-CMfR95N2.js} +1 -1
- package/out/web/assets/{architecture-7GRP2DOG-ZOwheW3n.js → architecture-7GRP2DOG-DhAM4HyO.js} +1 -1
- package/out/web/assets/{architectureDiagram-5GKGNRK7-DC2FDzVd.js → architectureDiagram-5GKGNRK7-Yk3TUJ_F.js} +1 -1
- package/out/web/assets/{blockDiagram-I7D4REHJ-BrKFWdAH.js → blockDiagram-I7D4REHJ-X9fBgJik.js} +1 -1
- package/out/web/assets/{c4Diagram-7LVT6UL2-BHTHK1Yd.js → c4Diagram-7LVT6UL2-Bk9x7N-8.js} +1 -1
- package/out/web/assets/{chunk-4HAMMTFA-BYFkZwNj.js → chunk-4HAMMTFA-Dx5fk1_0.js} +1 -1
- package/out/web/assets/{chunk-75Z2AOVW-BSKfSKSA.js → chunk-75Z2AOVW-BszTQoM4.js} +1 -1
- package/out/web/assets/{chunk-DU6HZSFF-vIhsiW6n.js → chunk-DU6HZSFF-DK-As3rk.js} +1 -1
- package/out/web/assets/{chunk-F27PBJKO-BlYpW9xq.js → chunk-F27PBJKO-LmncZZIS.js} +1 -1
- package/out/web/assets/{chunk-GMAD6QVW-BIBz_Ug5.js → chunk-GMAD6QVW-DSQ_sDRJ.js} +1 -1
- package/out/web/assets/{chunk-GVQU2GXP-NPSHxeqC.js → chunk-GVQU2GXP-Cno3ulje.js} +1 -1
- package/out/web/assets/{chunk-IMKFNOWR-YlJK8_Fp.js → chunk-IMKFNOWR-bIzfY9Jc.js} +1 -1
- package/out/web/assets/{chunk-L3NEJ4N5-DMYi4-af.js → chunk-L3NEJ4N5-Dl6eOa0D.js} +1 -1
- package/out/web/assets/{chunk-OSK3NFVY-Begd3-jA.js → chunk-OSK3NFVY-BaUGJ-cM.js} +1 -1
- package/out/web/assets/{chunk-P2QGCYS3-D1I4xFHN.js → chunk-P2QGCYS3-_066ndhH.js} +1 -1
- package/out/web/assets/{chunk-POPQ4Y6H-CafZZzNE.js → chunk-POPQ4Y6H-YT1AKhTv.js} +1 -1
- package/out/web/assets/{chunk-PWAF6VOD-Dwh6_Lnt.js → chunk-PWAF6VOD-CrEgDsxh.js} +1 -1
- package/out/web/assets/{chunk-SHT3W25Y-B0XrCSEb.js → chunk-SHT3W25Y-_KwaRLOl.js} +1 -1
- package/out/web/assets/{chunk-SVP7TREG-CxLsddxC.js → chunk-SVP7TREG-BQ1qb32L.js} +1 -1
- package/out/web/assets/{chunk-TICWLB2K-y156QInb.js → chunk-TICWLB2K-BDyehCtg.js} +1 -1
- package/out/web/assets/classDiagram-ZZMXUADV-BoSpzRCJ.js +1 -0
- package/out/web/assets/classDiagram-v2-VYDZK3BY-BoSpzRCJ.js +1 -0
- package/out/web/assets/{config-DqXJXeZM.css → config-2suVFPZg.css} +1 -1
- package/out/web/assets/config-CkRCdkxn.js +2 -0
- package/out/web/assets/{cynefin-OW5HDTMX-SMVvrLf-.js → cynefin-OW5HDTMX-Dl_31aaN.js} +1 -1
- package/out/web/assets/{cynefinDiagram-5FMLGOSQ-rZznN24T.js → cynefinDiagram-5FMLGOSQ-Bpir8jha.js} +1 -1
- package/out/web/assets/{dagre-GXQ25YYZ-BOToydFu.js → dagre-GXQ25YYZ-D9xu3nsq.js} +1 -1
- package/out/web/assets/{diagram-S7CK7UJ4-TMVaGQEJ.js → diagram-S7CK7UJ4-DeveoEeB.js} +1 -1
- package/out/web/assets/{diagram-UQ7AKVKN-C2JK-GP2.js → diagram-UQ7AKVKN-p4xWRESV.js} +1 -1
- package/out/web/assets/{diagram-VSXAHHWV-Cw8VSi2K.js → diagram-VSXAHHWV-C7qz9NDF.js} +1 -1
- package/out/web/assets/{diagram-VX7I27RA-DXp4fKk9.js → diagram-VX7I27RA-DRiCa3Vd.js} +1 -1
- package/out/web/assets/{diagram-Z3DM3KII-CzSicYiW.js → diagram-Z3DM3KII-Bt7zduQX.js} +1 -1
- package/out/web/assets/{ebnfDiagram-PWID7BFC-Dqj-zqPu.js → ebnfDiagram-PWID7BFC-DV9WpwdR.js} +1 -1
- package/out/web/assets/{erDiagram-RLTQ6QDP-DZwFZAuD.js → erDiagram-RLTQ6QDP-BJ_nwG2m.js} +1 -1
- package/out/web/assets/{eventmodeling-NTZA5JFV-C0O-Lvgp.js → eventmodeling-NTZA5JFV-BTBMrfVa.js} +1 -1
- package/out/web/assets/flowDiagram-HODETNUW-Cdlq3cJL.js +1 -0
- package/out/web/assets/{ganttDiagram-EL5Y4UJY-Da4ULXTl.js → ganttDiagram-EL5Y4UJY-DQLdsXrC.js} +1 -1
- package/out/web/assets/{gitGraph-4MIJSDKK-B9wNFZIP.js → gitGraph-4MIJSDKK-CL1OEOQ_.js} +1 -1
- package/out/web/assets/{gitGraphDiagram-WWUBYQGX-RjrhB0MP.js → gitGraphDiagram-WWUBYQGX-8cSi42H7.js} +1 -1
- package/out/web/assets/index-BocxnrDG.js +168 -0
- package/out/web/assets/index-yeh_r55a.css +1 -0
- package/out/web/assets/{info-A6RAGUB7-B3dfCpeY.js → info-A6RAGUB7-C1zsX5sc.js} +1 -1
- package/out/web/assets/{infoDiagram-27XIBGKW-QVWkLVx7.js → infoDiagram-27XIBGKW-DsRYtIyI.js} +1 -1
- package/out/web/assets/{ishikawaDiagram-5VMMS53U-CLFNIRI9.js → ishikawaDiagram-5VMMS53U-B2crwIXj.js} +1 -1
- package/out/web/assets/{journeyDiagram-3NMN7TZE-fgOQadYF.js → journeyDiagram-3NMN7TZE-BTH-GyVR.js} +1 -1
- package/out/web/assets/{kanban-definition-UXKFOSKX-G3Q_9g9O.js → kanban-definition-UXKFOSKX-BeRfCnuA.js} +1 -1
- package/out/web/assets/{mermaid-parser.core-v3Jm7nco.js → mermaid-parser.core-BJwgCBBc.js} +3 -3
- package/out/web/assets/{mermaid.core-DTEjLUA1.js → mermaid.core-CsDDodN8.js} +4 -4
- package/out/web/assets/{mindmap-definition-YA3MSWOX-C_D42_fF.js → mindmap-definition-YA3MSWOX-B42efOQ1.js} +1 -1
- package/out/web/assets/{modelManager-BPLycQrN.js → modelManager-B3ZFMh8v.js} +2 -2
- package/out/web/assets/{oauthManager-BUK7ic7q.js → oauthManager-Ch5Du2fF.js} +1 -1
- package/out/web/assets/{packet-AYTQ26CC-B-R-SHlF.js → packet-AYTQ26CC-B6xUyE6r.js} +1 -1
- package/out/web/assets/{pegDiagram-XKGWAZYB-Da2q_giz.js → pegDiagram-XKGWAZYB-1LabVycL.js} +1 -1
- package/out/web/assets/{pie-WAS4IAKB-BC8F0N7-.js → pie-WAS4IAKB-DJwo-nf_.js} +1 -1
- package/out/web/assets/{pieDiagram-E7YTZNPT-Iy9REJNC.js → pieDiagram-E7YTZNPT-icmAqzy4.js} +1 -1
- package/out/web/assets/{quadrantDiagram-AXDQQJYC-ztsiYw7h.js → quadrantDiagram-AXDQQJYC-CZ-wEx41.js} +1 -1
- package/out/web/assets/{radar-RG4KPBEZ-B_1P8Z_z.js → radar-RG4KPBEZ-D7d-Xriw.js} +1 -1
- package/out/web/assets/{railroad-74A4TZTK-DuTqczSo.js → railroad-74A4TZTK-viuhdYbs.js} +1 -1
- package/out/web/assets/{railroad-abnf-HS5TGJTU-Df29WLmp.js → railroad-abnf-HS5TGJTU-DNXiCNea.js} +1 -1
- package/out/web/assets/{railroad-ebnf-LZEXJU2U-ePFMo-qp.js → railroad-ebnf-LZEXJU2U-nkSu1-0C.js} +1 -1
- package/out/web/assets/{railroad-peg-WCYAUIDC-DYXLW4_E.js → railroad-peg-WCYAUIDC-BhbMeQzz.js} +1 -1
- package/out/web/assets/{railroadDiagram-O6MQD6OU-LStnZf2S.js → railroadDiagram-O6MQD6OU-CLpG1jUX.js} +1 -1
- package/out/web/assets/{requirementDiagram-BXWQKSXE-DmzonMH-.js → requirementDiagram-BXWQKSXE-kRDrvWrc.js} +1 -1
- package/out/web/assets/{sankeyDiagram-P5KCCOFB-B8vjmUU1.js → sankeyDiagram-P5KCCOFB-DxAwmq4x.js} +1 -1
- package/out/web/assets/{sequenceDiagram-WJ2MYXX4-CTnplOAX.js → sequenceDiagram-WJ2MYXX4-aLgY-6Wz.js} +1 -1
- package/out/web/assets/{stateDiagram-D77RDMKH-BFrIaLdI.js → stateDiagram-D77RDMKH-D5QWfOhp.js} +1 -1
- package/out/web/assets/stateDiagram-v2-MP3YSRHH-D6OiZoAP.js +1 -0
- package/out/web/assets/{swimlanes-42K2YHIH-BXGngUNU.js → swimlanes-42K2YHIH-CRs5UyA-.js} +1 -1
- package/out/web/assets/swimlanesDiagram-VR7AAH4N-UgEXIsV0.js +8 -0
- package/out/web/assets/syntaxHighlight-C-wAGT84.js +3 -0
- package/out/web/assets/{timeline-definition-24CTP7MA-CegH7n43.js → timeline-definition-24CTP7MA-Denqd9qb.js} +1 -1
- package/out/web/assets/{treeView-Q6P3EWNA-DTpJv2Tw.js → treeView-Q6P3EWNA-0my3Z3s4.js} +1 -1
- package/out/web/assets/{treemap-WGGIJYW6-i8M9iJU6.js → treemap-WGGIJYW6-B_EjkLYq.js} +1 -1
- package/out/web/assets/{vennDiagram-4TSXK5OY-Dpzo1S8U.js → vennDiagram-4TSXK5OY-DxVg3Ewr.js} +1 -1
- package/out/web/assets/{wardley-WFR3VGLG-BrNsgtfw.js → wardley-WFR3VGLG-CGD-Tj4p.js} +1 -1
- package/out/web/assets/{wardleyDiagram-VM6X3IG4-lQ92LFE1.js → wardleyDiagram-VM6X3IG4-CmfS39Xm.js} +1 -1
- package/out/web/assets/{xychartDiagram-S5SC5T6Z-BaOaEoBd.js → xychartDiagram-S5SC5T6Z-BVM9bKis.js} +1 -1
- package/out/web/index-web.html +2 -2
- package/out/web/index.html +2 -2
- package/package.json +2 -2
- package/shared-modules/CODEOWNERS +3 -3
- package/shared-modules/SDL2/SDL2_mixer.json +27 -0
- package/shared-modules/appstream/README.md +13 -0
- package/shared-modules/appstream/appstream-compose.json +111 -0
- package/shared-modules/dbus-glib/dbus-glib.json +2 -2
- package/shared-modules/libportal/libportal.json +23 -0
- package/shared-modules/linux-audio/fluidsynth2-static.json +2 -2
- package/shared-modules/linux-audio/fluidsynth2.json +2 -2
- package/shared-modules/linux-audio/libinstpatch.json +2 -2
- package/shared-modules/linux-audio/liblo-static.json +3 -0
- package/shared-modules/luajit/luajit.json +2 -2
- package/shared-modules/squashfs-tools/squashfs-tools.json +0 -3
- package/slash-commands.json +7 -2
- package/src/renderer/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/src/renderer/shared/agentProgress.ts +51 -3
- package/src/renderer/shared/components/Settings/AutomationTab.tsx +2 -56
- package/src/renderer/shared/components/Settings/AvatarCropModal.tsx +15 -1
- package/src/renderer/shared/components/Settings/GeneralTab.tsx +25 -12
- package/src/renderer/shared/components/Settings/ThemeTab.test.tsx +45 -0
- package/src/renderer/shared/components/Settings/ThemeTab.tsx +106 -3
- package/src/renderer/shared/components/activity/AgentActivityDrawer.tsx +67 -17
- package/src/renderer/shared/components/activity/AgentActivityTable.tsx +376 -134
- package/src/renderer/shared/components/activity/AskUserActivityCard.test.tsx +122 -0
- package/src/renderer/shared/components/activity/AskUserActivityCard.tsx +70 -0
- package/src/renderer/shared/components/activity/McpToolResults.tsx +39 -2
- package/src/renderer/shared/components/activity/SubagentDagView.tsx +7 -7
- package/src/renderer/shared/components/activity/ViewedImages.tsx +41 -2
- package/src/renderer/shared/components/app/ChunkErrorBoundary.tsx +3 -3
- package/src/renderer/shared/components/app/CommandPalette.tsx +7 -7
- package/src/renderer/shared/components/app/DesktopTitlebar.tsx +2 -2
- package/src/renderer/shared/components/app/MintDashboard.tsx +27 -17
- package/src/renderer/shared/components/app/ModalErrorBoundary.tsx +3 -3
- package/src/renderer/shared/components/cards/CalculationCard.tsx +3 -3
- package/src/renderer/shared/components/cards/ImageGenCard.tsx +2 -2
- package/src/renderer/shared/components/cards/ImageSearchCard.tsx +2 -2
- package/src/renderer/shared/components/cards/MermaidCard.tsx +1 -1
- package/src/renderer/shared/components/cards/PlanCard.test.tsx +41 -0
- package/src/renderer/shared/components/cards/PlanCard.tsx +32 -0
- package/src/renderer/shared/components/cards/ReleaseNotesCard.test.tsx +29 -0
- package/src/renderer/shared/components/cards/ReleaseNotesCard.tsx +137 -0
- package/src/renderer/shared/components/cards/StockCard.tsx +7 -7
- package/src/renderer/shared/components/cards/ToolResultCards.tsx +11 -3
- package/src/renderer/shared/components/cards/UiMockupWidget.tsx +4 -4
- package/src/renderer/shared/components/cards/WeatherCard.tsx +5 -5
- package/src/renderer/shared/components/chat/ApprovalCard.test.tsx +11 -0
- package/src/renderer/shared/components/chat/ApprovalCard.tsx +21 -2
- package/src/renderer/shared/components/chat/ArtifactCards.test.tsx +69 -0
- package/src/renderer/shared/components/chat/ArtifactCards.tsx +238 -0
- package/src/renderer/shared/components/chat/AttachedDocumentCard.test.tsx +39 -0
- package/src/renderer/shared/components/chat/AttachedDocumentCard.tsx +220 -0
- package/src/renderer/shared/components/chat/ChatCodeBlock.test.tsx +33 -0
- package/src/renderer/shared/components/chat/ChatCodeBlock.tsx +15 -1
- package/src/renderer/shared/components/chat/ChatMessageItem.test.tsx +40 -2
- package/src/renderer/shared/components/chat/ChatMessageItem.tsx +180 -34
- package/src/renderer/shared/components/chat/ChatModeSelector.css +227 -0
- package/src/renderer/shared/components/chat/ChatModeSelector.test.tsx +45 -0
- package/src/renderer/shared/components/chat/ChatModeSelector.tsx +198 -0
- package/src/renderer/shared/components/chat/ChatPanel.test.tsx +22 -0
- package/src/renderer/shared/components/chat/ChatPanel.tsx +227 -53
- package/src/renderer/shared/components/chat/DiffReviewModal.tsx +6 -6
- package/src/renderer/shared/components/chat/GeminiLiveOverlay.test.tsx +142 -1
- package/src/renderer/shared/components/chat/GeminiLiveOverlay.tsx +45 -3
- package/src/renderer/shared/components/chat/ModelSelectorPopover.tsx +42 -14
- package/src/renderer/shared/components/chat/RewindModal.tsx +10 -10
- package/src/renderer/shared/components/chat/SlashSuggestions.test.tsx +14 -0
- package/src/renderer/shared/components/chat/SourcesBlock.test.tsx +53 -0
- package/src/renderer/shared/components/chat/SourcesBlock.tsx +236 -90
- package/src/renderer/shared/components/chat/TurnFileChanges.test.tsx +45 -1
- package/src/renderer/shared/components/chat/TurnFileChanges.tsx +202 -169
- package/src/renderer/shared/components/extensions/CliSessionsView.tsx +5 -4
- package/src/renderer/shared/components/extensions/McpRegistryPicker.tsx +3 -3
- package/src/renderer/shared/components/studio/LibraryPage.tsx +48 -5
- package/src/renderer/shared/components/workspace/ArtifactPreviewPanel.tsx +125 -13
- package/src/renderer/shared/components/workspace/CodeReviewPage.test.tsx +50 -0
- package/src/renderer/shared/components/workspace/CodeReviewPage.tsx +77 -16
- package/src/renderer/shared/components/workspace/GitBranchSelector.tsx +78 -22
- package/src/renderer/shared/components/workspace/ToolSurfacePage.test.tsx +13 -0
- package/src/renderer/shared/components/workspace/ToolSurfacePage.tsx +48 -28
- package/src/renderer/shared/components/workspace/WorkspacePdfPreview.tsx +266 -47
- package/src/renderer/shared/components/workspace/WorkspacePreviewActions.test.tsx +18 -6
- package/src/renderer/shared/components/workspace/background-terminals.css +11 -11
- package/src/renderer/shared/constants/config.ts +1 -5
- package/src/renderer/shared/constants/models.test.ts +51 -0
- package/src/renderer/shared/constants/models.ts +139 -32
- package/src/renderer/shared/conversation/lifecycle.test.ts +91 -3
- package/src/renderer/shared/conversation/lifecycle.ts +104 -5
- package/src/renderer/shared/conversation/progressiveStream.test.ts +83 -0
- package/src/renderer/shared/conversation/progressiveStream.ts +219 -0
- package/src/renderer/shared/css/agent-observability.css +133 -0
- package/src/renderer/shared/css/chat-ui-cards.css +13 -13
- package/src/renderer/shared/css/code-review.css +63 -34
- package/src/renderer/shared/css/code-sessions.css +47 -18
- package/src/renderer/shared/css/collapsed-paste.css +1 -1
- package/src/renderer/shared/css/error-notice.css +1 -1
- package/src/renderer/shared/css/file-changes.css +165 -80
- package/src/renderer/shared/css/library.css +105 -10
- package/src/renderer/shared/css/management-views.css +1 -1
- package/src/renderer/shared/css/mcp-results.css +5 -5
- package/src/renderer/shared/css/model-selector.css +18 -18
- package/src/renderer/shared/css/mods.css +7 -7
- package/src/renderer/shared/css/notification-notice.css +2 -2
- package/src/renderer/shared/css/queued-messages.css +5 -5
- package/src/renderer/shared/css/settings/general.css +18 -13
- package/src/renderer/shared/css/settings/profile.css +5 -5
- package/src/renderer/shared/css/settings/theme.css +5 -5
- package/src/renderer/shared/css/slash-choice.css +2 -2
- package/src/renderer/shared/css/slash-suggestions.css +3 -3
- package/src/renderer/shared/css/sources-block.css +41 -2
- package/src/renderer/shared/css/tools-panel.css +2 -2
- package/src/renderer/shared/css/ui-tailwind.css +8 -0
- package/src/renderer/shared/css/veo-studio.css +2 -2
- package/src/renderer/shared/css/viewed-images.css +7 -7
- package/src/renderer/shared/platform.ts +2 -1
- package/src/renderer/shared/theme/themeManager.test.ts +17 -0
- package/src/renderer/shared/theme/themeManager.ts +21 -4
- package/src/renderer/shared/theme/themes.ts +54 -0
- package/src/renderer/shared/theme/tokens.css +6 -4
- package/src/renderer/shared/types.ts +1 -1
- package/src/renderer/shared/utils/agentActivity.test.ts +468 -2
- package/src/renderer/shared/utils/agentActivity.ts +602 -35
- package/src/renderer/shared/utils/artifactBrowser.test.ts +37 -32
- package/src/renderer/shared/utils/artifactBrowser.ts +17 -19
- package/src/renderer/shared/utils/attachedDocument.test.ts +73 -0
- package/src/renderer/shared/utils/attachedDocument.ts +49 -0
- package/src/renderer/shared/utils/fileIcons.test.ts +59 -0
- package/src/renderer/shared/utils/fileIcons.ts +149 -16
- package/src/renderer/shared/utils/markdown.tsx +72 -19
- package/src/renderer/shared/utils/markdown.webImages.test.tsx +16 -0
- package/src/renderer/shared/utils/mcpResults.test.tsx +29 -0
- package/src/renderer/shared/utils/slashCommandProcessor.ts +4 -1
- package/src/renderer/shared/utils/syntaxHighlight.test.tsx +11 -1
- package/src/renderer/shared/utils/syntaxHighlight.tsx +51 -3
- package/src/renderer/shared/utils/useGeminiLiveVoice.ts +324 -51
- package/src/renderer/shared/utils/workspaceDrag.test.ts +153 -0
- package/src/renderer/shared/utils/workspaceDrag.ts +142 -0
- package/src/renderer/shared/utils/workspaceMedia.ts +10 -2
- package/src/renderer/src/App.tsx +14 -8
- package/src/renderer/src/agentProgress.ts +1 -0
- package/src/renderer/src/components/ScreenPicker.css +1 -1
- package/src/renderer/src/components/WorkspacePanel.tsx +6 -5
- package/src/renderer/src/css/app-shell.css +4 -4
- package/src/renderer/src/css/chat.css +1261 -241
- package/src/renderer/src/css/desktop-tools.css +11 -11
- package/src/renderer/src/css/sidebar-workspace.css +2 -2
- package/src/renderer/src/css/tool-surfaces.css +12 -12
- package/src/renderer/src/index.css +38 -20
- package/src/renderer/src/tauri.ts +22 -2
- package/src/renderer/src-web/App.tsx +14 -0
- package/src/renderer/src-web/agentProgress.ts +1 -0
- package/src/renderer/src-web/css/app-shell.css +4 -4
- package/src/renderer/src-web/css/chat.css +1278 -190
- package/src/renderer/src-web/css/mobile.css +29 -13
- package/src/renderer/src-web/css/settings/mobile.css +2 -2
- package/src/renderer/src-web/css/sidebar-workspace.css +1 -1
- package/src/renderer/src-web/index.css +38 -20
- package/src/renderer/src-web/tauri.ts +22 -2
- package/src/renderer/tests/browserArtifacts.browser.tsx +1 -1
- package/src/renderer/tests/library.browser.tsx +3 -0
- package/src/renderer/tests/liveVoice.browser.html +1 -0
- package/src/renderer/tests/workspaceDrop.browser.tsx +1 -1
- package/src-tauri/src/app/lifecycle.rs +1 -14
- package/src-tauri/src/background/headless.rs +14 -8
- package/src-tauri/src/commands/conversation.rs +38 -0
- package/src-tauri/src/native/mod.rs +0 -1
- package/src-tauri/src/native/system.rs +4 -47
- package/crates/mint-cli/src/interactive/chat_tui.rs +0 -8855
- package/crates/mint-core/src/agent/chat.rs +0 -4394
- package/crates/mint-core/src/browser/lifecycle.rs +0 -291
- package/crates/mint-core/src/browser/logging.rs +0 -20
- package/crates/mint-core/src/orchestration/tools/browser.rs +0 -31
- package/out/web/assets/ArtifactPreviewPanel-S0dPfYFx.js +0 -2
- package/out/web/assets/CalculationCard-CRjP3E1j.js +0 -1
- package/out/web/assets/CliSessionsView-C3Br2v5Y.css +0 -1
- package/out/web/assets/CodeReviewPage-CUJceQme.css +0 -1
- package/out/web/assets/CodeReviewPage-VCUgPla_.js +0 -2
- package/out/web/assets/ImageGenCard-BCXxkVJX.js +0 -1
- package/out/web/assets/ImageSearchCard-N3yQOr8Z.js +0 -1
- package/out/web/assets/LibraryPage-DAxUTAg7.css +0 -1
- package/out/web/assets/LibraryPage-WlviRdR8.js +0 -2
- package/out/web/assets/LinkedFoldersView-CKRgroWK.js +0 -1
- package/out/web/assets/McpServersView-D3wHnuHg.js +0 -1
- package/out/web/assets/MermaidCard-NqrHdyJW.js +0 -2
- package/out/web/assets/MintDashboard-B2DJsDDO.css +0 -1
- package/out/web/assets/MintDashboard-COw_xol7.js +0 -63
- package/out/web/assets/RewindModal-DempuDod.js +0 -1
- package/out/web/assets/SettingsWindow-2YP3yj7s.js +0 -4
- package/out/web/assets/SettingsWindow-Dz8LQVgD.css +0 -1
- package/out/web/assets/StockCard-BDMCe7mx.js +0 -1
- package/out/web/assets/ToolSurfacePage-B0J_q0Jl.js +0 -38
- package/out/web/assets/ToolSurfacePage-CRIQ1owD.css +0 -1
- package/out/web/assets/UiMockupWidget-DD73QWg1.js +0 -1
- package/out/web/assets/WeatherCard-CPucIfq8.js +0 -1
- package/out/web/assets/WorkspacePdfPreview-Dx_lkjNu.js +0 -2
- package/out/web/assets/classDiagram-ZZMXUADV-BgJ5WtSp.js +0 -1
- package/out/web/assets/classDiagram-v2-VYDZK3BY-BgJ5WtSp.js +0 -1
- package/out/web/assets/config-CvIO5hkn.js +0 -2
- package/out/web/assets/flowDiagram-HODETNUW-uqCHJond.js +0 -1
- package/out/web/assets/index-BmpulIkg.js +0 -168
- package/out/web/assets/index-CkvBwhX_.css +0 -1
- package/out/web/assets/stateDiagram-v2-MP3YSRHH-uf3kdNW4.js +0 -1
- package/out/web/assets/swimlanesDiagram-VR7AAH4N-Y8q5bQce.js +0 -8
- package/shared-modules/libsecret/libsecret.json +0 -23
- package/shared-modules/libusb/libusb.json +0 -27
- package/shared-modules/lzo/lzo.json +0 -27
- package/src/renderer/src/components/BrowserShell.tsx +0 -108
- package/src/renderer/src/components/BrowserSuggestionsPopup.tsx +0 -91
- package/src/renderer/src/components/browser-shell.css +0 -185
- package/src-tauri/src/native/browser.rs +0 -252
|
@@ -0,0 +1,967 @@
|
|
|
1
|
+
use std::collections::BTreeMap;
|
|
2
|
+
use std::path::Path;
|
|
3
|
+
|
|
4
|
+
use futures_util::StreamExt;
|
|
5
|
+
use serde_json::Value;
|
|
6
|
+
|
|
7
|
+
use crate::chat::{ChatMessage, ChatRole, ContentBlock};
|
|
8
|
+
use crate::config::MintConfig;
|
|
9
|
+
use crate::{Capability, assert_path_capability};
|
|
10
|
+
|
|
11
|
+
use super::super::context_render::format_trajectory_step;
|
|
12
|
+
use super::super::decision_parsing::*;
|
|
13
|
+
use super::super::types::*;
|
|
14
|
+
use super::super::workspace_helpers::*;
|
|
15
|
+
use super::super::{
|
|
16
|
+
is_internal_cot, mcp_review, model_tool_result, plan_mode_allows, reliability, run_control,
|
|
17
|
+
tool_progress_input,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type LoadedImage = (String, Option<(Vec<u8>, &'static str, String)>);
|
|
21
|
+
|
|
22
|
+
#[allow(clippy::too_many_arguments)]
|
|
23
|
+
pub(crate) async fn run_parallel_read_only_batch(
|
|
24
|
+
decisions: &[(String, AgentDecision)],
|
|
25
|
+
step: usize,
|
|
26
|
+
root: &Path,
|
|
27
|
+
config: &MintConfig,
|
|
28
|
+
chat_id: &str,
|
|
29
|
+
approve: &mut (dyn FnMut(&AgentApproval) -> Result<ApprovalOutcome, String> + Send),
|
|
30
|
+
progress: &mut (dyn FnMut(AgentProgress) + Send),
|
|
31
|
+
action_counts: &mut BTreeMap<String, usize>,
|
|
32
|
+
trajectory: &mut Vec<String>,
|
|
33
|
+
step_images: &mut std::collections::HashMap<String, Vec<String>>,
|
|
34
|
+
hooks: &[crate::hooks::HookEntry],
|
|
35
|
+
pinned_mcp_server: Option<&str>,
|
|
36
|
+
fast_mode: bool,
|
|
37
|
+
) -> Vec<ToolResultEntry> {
|
|
38
|
+
let approve_mutex = std::sync::Mutex::new(approve);
|
|
39
|
+
let progress_mutex = std::sync::Mutex::new(progress);
|
|
40
|
+
|
|
41
|
+
let mut tasks = Vec::with_capacity(decisions.len());
|
|
42
|
+
for (index, (call_id, decision)) in decisions.iter().enumerate() {
|
|
43
|
+
let call_id = call_id.clone();
|
|
44
|
+
let thought = decision.thought.clone();
|
|
45
|
+
let action = decision.action.clone();
|
|
46
|
+
let input_val = tool_progress_input(&root, &decision);
|
|
47
|
+
let action_key = action_fingerprint(decision);
|
|
48
|
+
let approve_mutex = &approve_mutex;
|
|
49
|
+
let progress_mutex = &progress_mutex;
|
|
50
|
+
let decision = decision;
|
|
51
|
+
|
|
52
|
+
tasks.push(async move {
|
|
53
|
+
let activity_call_id=call_id.clone();
|
|
54
|
+
if !fast_mode && !thought.trim().is_empty() {
|
|
55
|
+
let t = thought.trim();
|
|
56
|
+
let mut guard = progress_mutex.lock().unwrap();
|
|
57
|
+
if is_internal_cot(t) {
|
|
58
|
+
(*guard)(AgentProgress::ExtendedThinking {
|
|
59
|
+
id: None,
|
|
60
|
+
thought: t.to_owned(),
|
|
61
|
+
elapsed_ms: None,
|
|
62
|
+
});
|
|
63
|
+
} else {
|
|
64
|
+
(*guard)(AgentProgress::Thought {
|
|
65
|
+
thought: t.to_owned(),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
{
|
|
71
|
+
let mut guard = progress_mutex.lock().unwrap();
|
|
72
|
+
(*guard)(AgentProgress::ToolStart { call_id: Some(activity_call_id.clone()),
|
|
73
|
+
action: action.clone(),
|
|
74
|
+
input: input_val.clone(),
|
|
75
|
+
subagent: None,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
let mut images=Vec::new();
|
|
80
|
+
let mut typed_status=None;
|
|
81
|
+
let result: String = if pinned_mcp_server.is_some_and(|p| {
|
|
82
|
+
(action == "mcp_tool" || action == "mcp_list_tools") && decision.input.server != p
|
|
83
|
+
}) {
|
|
84
|
+
let p = pinned_mcp_server.unwrap();
|
|
85
|
+
format!(
|
|
86
|
+
"Blocked: this turn is pinned to the \"{p}\" MCP server only (selected via @{p} in the composer). Retry with \"server\":\"{p}\", or use a different (non-MCP) tool."
|
|
87
|
+
)
|
|
88
|
+
} else {
|
|
89
|
+
match crate::hooks::run_pre_tool_hooks(hooks, &action, &input_val, root) {
|
|
90
|
+
crate::hooks::PreHookOutcome::Blocked(reason) => {
|
|
91
|
+
format!(
|
|
92
|
+
"Blocked by hook: {}\n\n[System Tip: A configured PreToolUse hook rejected this action. Adjust your approach or ask the user for guidance.]",
|
|
93
|
+
reason
|
|
94
|
+
)
|
|
95
|
+
}
|
|
96
|
+
crate::hooks::PreHookOutcome::Allowed => {
|
|
97
|
+
let mut approve_adapter =
|
|
98
|
+
|approval: &AgentApproval| -> Result<ApprovalOutcome, String> {
|
|
99
|
+
let mut guard = approve_mutex.lock().unwrap();
|
|
100
|
+
(*guard)(approval)
|
|
101
|
+
};
|
|
102
|
+
let mut progress_adapter = |event: AgentProgress| {
|
|
103
|
+
let mut guard = progress_mutex.lock().unwrap();
|
|
104
|
+
(*guard)(event);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
let (tool_result, success) = match execute_tool_outcome(
|
|
108
|
+
root,
|
|
109
|
+
config,
|
|
110
|
+
&decision,
|
|
111
|
+
chat_id,
|
|
112
|
+
&mut approve_adapter,
|
|
113
|
+
&mut progress_adapter,
|
|
114
|
+
&activity_call_id,
|
|
115
|
+
)
|
|
116
|
+
.await
|
|
117
|
+
{
|
|
118
|
+
Ok(outcome) => {images=outcome.images;typed_status=Some(outcome.status);(outcome.text,outcome.status==crate::mcp_result::ToolStatus::Success)},
|
|
119
|
+
Err(err) => (format!("Error: {}", err), false),
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
let hook_messages = crate::hooks::run_post_tool_hooks(
|
|
123
|
+
hooks,
|
|
124
|
+
&action,
|
|
125
|
+
&input_val,
|
|
126
|
+
&tool_result,
|
|
127
|
+
success,
|
|
128
|
+
root,
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
if hook_messages.is_empty() {
|
|
132
|
+
tool_result
|
|
133
|
+
} else {
|
|
134
|
+
format!(
|
|
135
|
+
"{}\n\n{}",
|
|
136
|
+
tool_result,
|
|
137
|
+
hook_messages
|
|
138
|
+
.iter()
|
|
139
|
+
.map(|msg| format!("[Hook] {}", msg))
|
|
140
|
+
.collect::<Vec<_>>()
|
|
141
|
+
.join("\n")
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
{
|
|
149
|
+
let mut guard = progress_mutex.lock().unwrap();
|
|
150
|
+
(*guard)(AgentProgress::ToolEnd { elapsed_ms: None, call_id: Some(activity_call_id.clone()), status: typed_status,
|
|
151
|
+
action: action.clone(),
|
|
152
|
+
input: input_val.clone(),
|
|
153
|
+
result: result.clone(),
|
|
154
|
+
subagent: None,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
(
|
|
159
|
+
index, call_id, thought, action, input_val, action_key, result, images, typed_status,
|
|
160
|
+
)
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
let mut results = futures_util::stream::iter(tasks)
|
|
165
|
+
.buffer_unordered(PARALLEL_READ_ONLY_LIMIT)
|
|
166
|
+
.collect::<Vec<_>>()
|
|
167
|
+
.await;
|
|
168
|
+
|
|
169
|
+
results.sort_by_key(|(index, ..)| *index);
|
|
170
|
+
|
|
171
|
+
let mut step_tool_results = Vec::with_capacity(results.len());
|
|
172
|
+
for (_, call_id, thought, action, input_val, action_key, result, images, typed_status) in
|
|
173
|
+
results
|
|
174
|
+
{
|
|
175
|
+
if !images.is_empty() {
|
|
176
|
+
step_images.insert(call_id.clone(), images);
|
|
177
|
+
}
|
|
178
|
+
let action_count = {
|
|
179
|
+
let count = action_counts.entry(action_key).or_insert(0);
|
|
180
|
+
*count += 1;
|
|
181
|
+
*count
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
let mut final_result = if result.starts_with("data:image/")
|
|
185
|
+
&& matches!(
|
|
186
|
+
action.as_str(),
|
|
187
|
+
"video_filmstrip" | "video_waveform" | "view_image"
|
|
188
|
+
) {
|
|
189
|
+
step_images.insert(call_id.clone(), vec![result.clone()]);
|
|
190
|
+
match action.as_str() {
|
|
191
|
+
"video_filmstrip" => {
|
|
192
|
+
"[Filmstrip generated — see attached image: sampled frames across the video timeline]".to_string()
|
|
193
|
+
}
|
|
194
|
+
"video_waveform" => {
|
|
195
|
+
"[Waveform generated — see attached image: audio amplitude over time]".to_string()
|
|
196
|
+
}
|
|
197
|
+
"view_image" => "[Image loaded — see attached image]".to_string(),
|
|
198
|
+
_ => "[Screenshot captured — see attached image]".to_string(),
|
|
199
|
+
}
|
|
200
|
+
} else {
|
|
201
|
+
model_tool_result(Some(root), &action, &result)
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
if action_count >= 3 {
|
|
205
|
+
final_result.push_str(
|
|
206
|
+
"\n\n[System Tip: You repeated the same tool action three or more times. \
|
|
207
|
+
Stop repeating it. If you already have enough information or the requested edit is done, \
|
|
208
|
+
use the finish action now. Otherwise choose a different necessary action.]",
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
trajectory.push(format_trajectory_step(
|
|
213
|
+
step,
|
|
214
|
+
&thought,
|
|
215
|
+
&action,
|
|
216
|
+
&final_result,
|
|
217
|
+
));
|
|
218
|
+
|
|
219
|
+
let mut entry = ToolResultEntry::from((call_id, action, input_val, final_result));
|
|
220
|
+
if let Some(status) = typed_status {
|
|
221
|
+
entry.status = status;
|
|
222
|
+
}
|
|
223
|
+
step_tool_results.push(entry);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
step_tool_results
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Takes a trait object rather than being generic over `Approve` like it used
|
|
230
|
+
// to be: `dispatch_subagent` recurses back into `orchestrate_agent_loop`
|
|
231
|
+
// (which is itself generic over its own `Approve`), and reborrowing a generic
|
|
232
|
+
// `&mut Approve` into that recursive call makes the type grow by one `&mut`
|
|
233
|
+
// layer per nesting level during monomorphization — `&mut Approve`, then
|
|
234
|
+
// `&mut &mut Approve`, then `&mut &mut &mut Approve`, forever, since the type
|
|
235
|
+
// system has no way to know the runtime depth limit that
|
|
236
|
+
// `tool_catalog`/`allow_subagent_dispatch` enforces. A `&mut dyn FnMut(...)`
|
|
237
|
+
// trait object is a single fixed type regardless of recursion depth, so it
|
|
238
|
+
// doesn't hit that.
|
|
239
|
+
|
|
240
|
+
pub(crate) async fn execute_tool(
|
|
241
|
+
root: &Path,
|
|
242
|
+
config: &MintConfig,
|
|
243
|
+
decision: &AgentDecision,
|
|
244
|
+
chat_id: &str,
|
|
245
|
+
approve: &mut (dyn FnMut(&AgentApproval) -> Result<ApprovalOutcome, String> + Send),
|
|
246
|
+
progress: &mut (dyn FnMut(AgentProgress) + Send),
|
|
247
|
+
) -> Result<String, OrchestrationError> {
|
|
248
|
+
Ok(execute_tool_outcome(
|
|
249
|
+
root,
|
|
250
|
+
config,
|
|
251
|
+
decision,
|
|
252
|
+
chat_id,
|
|
253
|
+
approve,
|
|
254
|
+
progress,
|
|
255
|
+
&uuid::Uuid::new_v4().to_string(),
|
|
256
|
+
)
|
|
257
|
+
.await?
|
|
258
|
+
.text)
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
pub(crate) async fn execute_tool_outcome(
|
|
262
|
+
root: &Path,
|
|
263
|
+
config: &MintConfig,
|
|
264
|
+
decision: &AgentDecision,
|
|
265
|
+
chat_id: &str,
|
|
266
|
+
approve: &mut (dyn FnMut(&AgentApproval) -> Result<ApprovalOutcome, String> + Send),
|
|
267
|
+
progress: &mut (dyn FnMut(AgentProgress) + Send),
|
|
268
|
+
call_id: &str,
|
|
269
|
+
) -> Result<crate::integrations::mcp_result::ToolOutcome, OrchestrationError> {
|
|
270
|
+
execute_tool_outcome_reviewed(
|
|
271
|
+
root, config, decision, chat_id, approve, progress, call_id, None,
|
|
272
|
+
)
|
|
273
|
+
.await
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
#[allow(clippy::too_many_arguments)]
|
|
277
|
+
pub(crate) async fn execute_tool_outcome_reviewed(
|
|
278
|
+
root: &Path,
|
|
279
|
+
config: &MintConfig,
|
|
280
|
+
decision: &AgentDecision,
|
|
281
|
+
chat_id: &str,
|
|
282
|
+
approve: &mut (dyn FnMut(&AgentApproval) -> Result<ApprovalOutcome, String> + Send),
|
|
283
|
+
progress: &mut (dyn FnMut(AgentProgress) + Send),
|
|
284
|
+
call_id: &str,
|
|
285
|
+
expected: Option<&mcp_review::McpReview>,
|
|
286
|
+
) -> Result<crate::integrations::mcp_result::ToolOutcome, OrchestrationError> {
|
|
287
|
+
run_control::check()?;
|
|
288
|
+
let origin = MOD_ORIGIN.try_with(Clone::clone).ok().flatten();
|
|
289
|
+
let input = serde_json::to_value(&decision.input).unwrap_or(Value::Null);
|
|
290
|
+
crate::mods::event(
|
|
291
|
+
root,
|
|
292
|
+
chat_id,
|
|
293
|
+
"pre_tool_use",
|
|
294
|
+
serde_json::json!({"callId":call_id,"action":decision.action,"input":input}),
|
|
295
|
+
origin.as_deref(),
|
|
296
|
+
)
|
|
297
|
+
.map_err(OrchestrationError::Agent)?;
|
|
298
|
+
let execution = execute_tool_outcome_reviewed_inner(
|
|
299
|
+
root, config, decision, chat_id, approve, progress, call_id, expected,
|
|
300
|
+
);
|
|
301
|
+
let result = if matches!(
|
|
302
|
+
decision.action.as_str(),
|
|
303
|
+
"run_shell" | "verify" | "run_tests" | "run_typecheck" | "run_linter"
|
|
304
|
+
) {
|
|
305
|
+
// Foreground shell cancellation joins process cleanup and imports any
|
|
306
|
+
// checkpointed screenshots before the turn is marked interrupted.
|
|
307
|
+
execution.await
|
|
308
|
+
} else {
|
|
309
|
+
run_control::run(Box::pin(execution)).await
|
|
310
|
+
};
|
|
311
|
+
let _ = crate::mods::event(
|
|
312
|
+
root,
|
|
313
|
+
chat_id,
|
|
314
|
+
"post_tool_use",
|
|
315
|
+
serde_json::json!({"callId":call_id,"action":decision.action,"input":input,"result":result.as_ref().map(|r|r.text.clone()).unwrap_or_else(|e|e.to_string()),"success":result.is_ok()}),
|
|
316
|
+
origin.as_deref(),
|
|
317
|
+
);
|
|
318
|
+
result
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
tokio::task_local! { static MOD_ORIGIN: Option<String>; }
|
|
322
|
+
|
|
323
|
+
/// Run queued requests through the same policy and approval path as agent tools.
|
|
324
|
+
pub async fn execute_mod_requests(
|
|
325
|
+
root: &Path,
|
|
326
|
+
chat: &str,
|
|
327
|
+
config: &MintConfig,
|
|
328
|
+
plan_mode: bool,
|
|
329
|
+
approve: &mut (dyn FnMut(&AgentApproval) -> Result<ApprovalOutcome, String> + Send),
|
|
330
|
+
progress: &mut (dyn FnMut(AgentProgress) + Send),
|
|
331
|
+
selected: Option<&[String]>,
|
|
332
|
+
) -> Result<(), String> {
|
|
333
|
+
let requests = match selected {
|
|
334
|
+
Some(ids) => crate::mods::take_selected_requests(root, chat, ids)?,
|
|
335
|
+
None => crate::mods::take_requests(root, chat)?,
|
|
336
|
+
};
|
|
337
|
+
let (remembered_plan, pin) = crate::mods::turn_policy(root, chat);
|
|
338
|
+
let plan_mode = plan_mode || remembered_plan;
|
|
339
|
+
for request in requests {
|
|
340
|
+
let action = request["action"].as_str().unwrap_or("");
|
|
341
|
+
let id = request["modId"].as_str().unwrap_or("");
|
|
342
|
+
let input = match decode_agent_input(request["input"].clone()) {
|
|
343
|
+
Ok(input) => input,
|
|
344
|
+
Err(error) => {
|
|
345
|
+
crate::mods::complete_request(
|
|
346
|
+
root,
|
|
347
|
+
chat,
|
|
348
|
+
id,
|
|
349
|
+
request["hash"].as_str().unwrap_or(""),
|
|
350
|
+
serde_json::json!({"requestId":request["id"],"action":action,"error":error}),
|
|
351
|
+
)?;
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
let allowed = crate::prompts::agent::base_allowed_actions().contains(&action)
|
|
356
|
+
&& !action.starts_with("mod_")
|
|
357
|
+
&& !config.disabled_tools.iter().any(|t| t == action)
|
|
358
|
+
&& (!plan_mode || plan_mode_allows(action, &input))
|
|
359
|
+
&& pin.as_deref().is_none_or(|p| {
|
|
360
|
+
!matches!(action, "mcp_tool" | "mcp_list_tools") || input.server == p
|
|
361
|
+
});
|
|
362
|
+
let result = if allowed {
|
|
363
|
+
let decision = AgentDecision {
|
|
364
|
+
thought: String::new(),
|
|
365
|
+
action: action.into(),
|
|
366
|
+
input,
|
|
367
|
+
};
|
|
368
|
+
MOD_ORIGIN
|
|
369
|
+
.scope(
|
|
370
|
+
Some(id.into()),
|
|
371
|
+
execute_tool_outcome_reviewed(
|
|
372
|
+
root,
|
|
373
|
+
config,
|
|
374
|
+
&decision,
|
|
375
|
+
chat,
|
|
376
|
+
approve,
|
|
377
|
+
progress,
|
|
378
|
+
request["id"].as_str().unwrap_or(""),
|
|
379
|
+
None,
|
|
380
|
+
),
|
|
381
|
+
)
|
|
382
|
+
.await
|
|
383
|
+
.map(|r| r.text)
|
|
384
|
+
.map_err(|e| e.to_string())
|
|
385
|
+
} else {
|
|
386
|
+
Err("This tool is unavailable to mods in the current mode".into())
|
|
387
|
+
};
|
|
388
|
+
crate::mods::complete_request(
|
|
389
|
+
root,
|
|
390
|
+
chat,
|
|
391
|
+
id,
|
|
392
|
+
request["hash"].as_str().unwrap_or(""),
|
|
393
|
+
serde_json::json!({"requestId":request["id"],"action":action,"result":result.as_ref().ok(),"error":result.as_ref().err()}),
|
|
394
|
+
)?;
|
|
395
|
+
}
|
|
396
|
+
Ok(())
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
#[allow(clippy::too_many_arguments)]
|
|
400
|
+
async fn execute_tool_outcome_reviewed_inner(
|
|
401
|
+
root: &Path,
|
|
402
|
+
config: &MintConfig,
|
|
403
|
+
decision: &AgentDecision,
|
|
404
|
+
chat_id: &str,
|
|
405
|
+
approve: &mut (dyn FnMut(&AgentApproval) -> Result<ApprovalOutcome, String> + Send),
|
|
406
|
+
progress: &mut (dyn FnMut(AgentProgress) + Send),
|
|
407
|
+
call_id: &str,
|
|
408
|
+
expected: Option<&mcp_review::McpReview>,
|
|
409
|
+
) -> Result<crate::integrations::mcp_result::ToolOutcome, OrchestrationError> {
|
|
410
|
+
run_control::check()?;
|
|
411
|
+
if decision.action == "view_image" {
|
|
412
|
+
use crate::media::tool_images::{self, ViewTarget};
|
|
413
|
+
let target =
|
|
414
|
+
tool_images::resolve_view_target(&decision.input.path, &decision.input.artifact_id)
|
|
415
|
+
.map_err(OrchestrationError::Agent)?;
|
|
416
|
+
let root = root.to_path_buf();
|
|
417
|
+
let config = config.clone();
|
|
418
|
+
let chat = chat_id.to_owned();
|
|
419
|
+
let call = call_id.to_owned();
|
|
420
|
+
let (path, artifact_id) = match target {
|
|
421
|
+
ViewTarget::Artifact(id) => (String::new(), id.to_owned()),
|
|
422
|
+
ViewTarget::Path(path) => (path.to_owned(), String::new()),
|
|
423
|
+
};
|
|
424
|
+
// Phase 1: validate and identify the image without saving anything, so a
|
|
425
|
+
// repeat request can be refused before it creates another chat artifact.
|
|
426
|
+
let loaded = {
|
|
427
|
+
let (chat, artifact_id) = (chat.clone(), artifact_id.clone());
|
|
428
|
+
tokio::task::spawn_blocking(move || -> Result<LoadedImage, String> {
|
|
429
|
+
if !artifact_id.is_empty() {
|
|
430
|
+
let (entry, bytes) = crate::mcp_result::read_artifact(&artifact_id)?;
|
|
431
|
+
if entry.chat_id != chat || entry.kind != "image" {
|
|
432
|
+
return Err("Image artifact is not available in this conversation.".into());
|
|
433
|
+
}
|
|
434
|
+
return Ok((tool_images::content_key(&bytes), None));
|
|
435
|
+
}
|
|
436
|
+
let path = agent_read_path(&root, &path, &config).map_err(|e| e.to_string())?;
|
|
437
|
+
let path = assert_path_capability(&path, Capability::Read, &config)
|
|
438
|
+
.map_err(|e| e.to_string())?;
|
|
439
|
+
if std::fs::metadata(&path).map_err(|e| e.to_string())?.len()
|
|
440
|
+
> tool_images::ORIGINAL_LIMIT as u64
|
|
441
|
+
{
|
|
442
|
+
return Err("Image exceeds 20 MiB".into());
|
|
443
|
+
}
|
|
444
|
+
let mime = match path
|
|
445
|
+
.extension()
|
|
446
|
+
.and_then(|e| e.to_str())
|
|
447
|
+
.unwrap_or("")
|
|
448
|
+
.to_ascii_lowercase()
|
|
449
|
+
.as_str()
|
|
450
|
+
{
|
|
451
|
+
"png" => "image/png",
|
|
452
|
+
"jpg" | "jpeg" => "image/jpeg",
|
|
453
|
+
"gif" => "image/gif",
|
|
454
|
+
"webp" => "image/webp",
|
|
455
|
+
"svg" => "image/svg+xml",
|
|
456
|
+
_ => return Err("Unsupported image type".into()),
|
|
457
|
+
};
|
|
458
|
+
let bytes = std::fs::read(&path).map_err(|e| e.to_string())?;
|
|
459
|
+
let name = path
|
|
460
|
+
.file_name()
|
|
461
|
+
.and_then(|n| n.to_str())
|
|
462
|
+
.unwrap_or("Image")
|
|
463
|
+
.to_owned();
|
|
464
|
+
Ok((tool_images::content_key(&bytes), Some((bytes, mime, name))))
|
|
465
|
+
})
|
|
466
|
+
.await
|
|
467
|
+
.map_err(|e| OrchestrationError::Agent(e.to_string()))?
|
|
468
|
+
.map_err(OrchestrationError::Agent)?
|
|
469
|
+
};
|
|
470
|
+
let (key, file) = loaded;
|
|
471
|
+
if !reliability::first_image_view(&key) {
|
|
472
|
+
return Ok(crate::mcp_result::ToolOutcome::from(
|
|
473
|
+
"Image already in context: this exact image was shown earlier in this turn, so it \
|
|
474
|
+
was not attached again. Use what you saw, capture something different, or call finish."
|
|
475
|
+
.to_string(),
|
|
476
|
+
));
|
|
477
|
+
}
|
|
478
|
+
// Phase 2: attach (and, for files, persist) the image.
|
|
479
|
+
let out = tokio::task::spawn_blocking(
|
|
480
|
+
move || -> Result<crate::mcp_result::ToolOutcome, String> {
|
|
481
|
+
match file {
|
|
482
|
+
None => tool_images::view_artifact(&artifact_id, &chat),
|
|
483
|
+
Some((bytes, mime, name)) => {
|
|
484
|
+
tool_images::save(&bytes, mime, &name, &chat, &call, "view_image", None)
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
},
|
|
488
|
+
)
|
|
489
|
+
.await
|
|
490
|
+
.map_err(|e| OrchestrationError::Agent(e.to_string()))?
|
|
491
|
+
.map_err(OrchestrationError::Agent)?;
|
|
492
|
+
progress(AgentProgress::ToolArtifacts {
|
|
493
|
+
call_id: call_id.into(),
|
|
494
|
+
artifacts: out.artifacts.clone(),
|
|
495
|
+
warnings: out.warnings.clone(),
|
|
496
|
+
});
|
|
497
|
+
return Ok(out);
|
|
498
|
+
}
|
|
499
|
+
if matches!(decision.action.as_str(), "mcp_tool" | "mcp_list_tools") {
|
|
500
|
+
let mut out = super::plugins_mcp::execute_reviewed(
|
|
501
|
+
&decision.action,
|
|
502
|
+
&decision.input,
|
|
503
|
+
config,
|
|
504
|
+
chat_id,
|
|
505
|
+
call_id,
|
|
506
|
+
expected,
|
|
507
|
+
approve,
|
|
508
|
+
progress,
|
|
509
|
+
)
|
|
510
|
+
.await?;
|
|
511
|
+
if !out.images.is_empty()
|
|
512
|
+
&& config.extra.get("mcpImageInput").and_then(Value::as_bool) == Some(false)
|
|
513
|
+
{
|
|
514
|
+
out.images.clear();
|
|
515
|
+
let warning="Model image input is disabled for MCP. Use attachment metadata only; do not claim visual inspection.".to_string();
|
|
516
|
+
out.text.push_str(&format!("\nWarning: {warning}"));
|
|
517
|
+
out.warnings.push(warning);
|
|
518
|
+
}
|
|
519
|
+
if !out.artifacts.is_empty() || !out.warnings.is_empty() {
|
|
520
|
+
progress(AgentProgress::ToolArtifacts {
|
|
521
|
+
call_id: call_id.into(),
|
|
522
|
+
artifacts: out.artifacts.clone(),
|
|
523
|
+
warnings: out.warnings.clone(),
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
Ok(out)
|
|
527
|
+
} else {
|
|
528
|
+
let mut tool_config = config.clone();
|
|
529
|
+
let bridge = if decision.action == "run_shell" && !decision.input.background {
|
|
530
|
+
crate::browser::workflow::ShellBridge::prepare(
|
|
531
|
+
&decision.input.command,
|
|
532
|
+
root,
|
|
533
|
+
&mut tool_config,
|
|
534
|
+
)
|
|
535
|
+
.map_err(OrchestrationError::Agent)?
|
|
536
|
+
} else {
|
|
537
|
+
None
|
|
538
|
+
};
|
|
539
|
+
let checkpoint = reliability::checkpoint();
|
|
540
|
+
let text = match execute_tool_text(root, &tool_config, decision, chat_id, approve, progress)
|
|
541
|
+
.await
|
|
542
|
+
{
|
|
543
|
+
Ok(text) => text,
|
|
544
|
+
Err(error) => {
|
|
545
|
+
reliability::complete_tool(&decision.action, call_id, checkpoint, false);
|
|
546
|
+
return Err(error);
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
let mut out = crate::mcp_result::ToolOutcome::from(text);
|
|
550
|
+
let mut workflow_verified = None;
|
|
551
|
+
if let Some(bridge) = bridge {
|
|
552
|
+
match bridge.images(chat_id, call_id) {
|
|
553
|
+
Ok((images, verified)) => {
|
|
554
|
+
workflow_verified = Some(verified);
|
|
555
|
+
out.text.push_str(&images.text);
|
|
556
|
+
out.images.extend(images.images);
|
|
557
|
+
out.artifacts.extend(images.artifacts);
|
|
558
|
+
out.warnings.extend(images.warnings);
|
|
559
|
+
progress(AgentProgress::ToolArtifacts {
|
|
560
|
+
call_id: call_id.into(),
|
|
561
|
+
artifacts: out.artifacts.clone(),
|
|
562
|
+
warnings: out.warnings.clone(),
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
Err(error) => {
|
|
566
|
+
out.text.push_str(&format!("\nWarning: {error}"));
|
|
567
|
+
out.warnings.push(error);
|
|
568
|
+
workflow_verified = Some(false);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
let mut entries = reliability::complete_tool(
|
|
573
|
+
&decision.action,
|
|
574
|
+
call_id,
|
|
575
|
+
checkpoint,
|
|
576
|
+
out.status == crate::mcp_result::ToolStatus::Success,
|
|
577
|
+
);
|
|
578
|
+
if let Some(verified) = workflow_verified {
|
|
579
|
+
entries = reliability::mark_workflow(call_id, verified);
|
|
580
|
+
}
|
|
581
|
+
if decision.action == "shell_output" {
|
|
582
|
+
entries = reliability::for_job(&decision.input.job_id);
|
|
583
|
+
}
|
|
584
|
+
if !entries.is_empty() {
|
|
585
|
+
out.status = if entries
|
|
586
|
+
.iter()
|
|
587
|
+
.any(|e| e.state == reliability::ExecutionState::Cancelled)
|
|
588
|
+
{
|
|
589
|
+
crate::mcp_result::ToolStatus::Cancelled
|
|
590
|
+
} else if entries
|
|
591
|
+
.iter()
|
|
592
|
+
.any(|e| e.state == reliability::ExecutionState::Failed)
|
|
593
|
+
{
|
|
594
|
+
crate::mcp_result::ToolStatus::Failed
|
|
595
|
+
} else if entries
|
|
596
|
+
.iter()
|
|
597
|
+
.any(|e| e.state == reliability::ExecutionState::Running)
|
|
598
|
+
{
|
|
599
|
+
crate::mcp_result::ToolStatus::Running
|
|
600
|
+
} else if entries
|
|
601
|
+
.iter()
|
|
602
|
+
.any(|e| e.state == reliability::ExecutionState::Unknown)
|
|
603
|
+
{
|
|
604
|
+
crate::mcp_result::ToolStatus::Unknown
|
|
605
|
+
} else {
|
|
606
|
+
crate::mcp_result::ToolStatus::Success
|
|
607
|
+
};
|
|
608
|
+
progress(AgentProgress::ExecutionUpdate {
|
|
609
|
+
call_id: call_id.into(),
|
|
610
|
+
executions: entries,
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
Ok(out)
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
async fn execute_tool_text(
|
|
618
|
+
root: &Path,
|
|
619
|
+
config: &MintConfig,
|
|
620
|
+
decision: &AgentDecision,
|
|
621
|
+
chat_id: &str,
|
|
622
|
+
approve_cb: &mut (dyn FnMut(&AgentApproval) -> Result<ApprovalOutcome, String> + Send),
|
|
623
|
+
progress: &mut (dyn FnMut(AgentProgress) + Send),
|
|
624
|
+
) -> Result<String, OrchestrationError> {
|
|
625
|
+
if let Some(permissions) = crate::swarm::current_permissions() {
|
|
626
|
+
if !permissions.allows(&decision.action) {
|
|
627
|
+
return Err(OrchestrationError::Agent(format!(
|
|
628
|
+
"action '{}' is not permitted by this subagent's permissions",
|
|
629
|
+
decision.action
|
|
630
|
+
)));
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
let input = &decision.input;
|
|
634
|
+
match decision.action.as_str() {
|
|
635
|
+
"mod_help" | "mod_list" | "mod_validate" | "mod_publish" => {
|
|
636
|
+
super::mods::execute(&decision.action, input, root, config, chat_id, approve_cb).await
|
|
637
|
+
}
|
|
638
|
+
"list_files" | "read_file" | "note_write" | "apply_patch" | "write_file" => {
|
|
639
|
+
super::files::execute(
|
|
640
|
+
decision.action.as_str(),
|
|
641
|
+
input,
|
|
642
|
+
root,
|
|
643
|
+
config,
|
|
644
|
+
chat_id,
|
|
645
|
+
approve_cb,
|
|
646
|
+
)
|
|
647
|
+
.await
|
|
648
|
+
}
|
|
649
|
+
"search_code" | "symbols" | "find_definition" | "find_references" | "repo_map"
|
|
650
|
+
| "semantic_index" | "semantic_search" => {
|
|
651
|
+
super::code_search::execute(
|
|
652
|
+
decision.action.as_str(),
|
|
653
|
+
input,
|
|
654
|
+
root,
|
|
655
|
+
config,
|
|
656
|
+
chat_id,
|
|
657
|
+
approve_cb,
|
|
658
|
+
)
|
|
659
|
+
.await
|
|
660
|
+
}
|
|
661
|
+
"knowledge_search" | "web_search" | "image_search" => {
|
|
662
|
+
super::web::execute(
|
|
663
|
+
decision.action.as_str(),
|
|
664
|
+
input,
|
|
665
|
+
root,
|
|
666
|
+
config,
|
|
667
|
+
chat_id,
|
|
668
|
+
approve_cb,
|
|
669
|
+
)
|
|
670
|
+
.await
|
|
671
|
+
}
|
|
672
|
+
"weather" | "stock" | "calculation" | "memory_recall" => {
|
|
673
|
+
super::misc::execute(
|
|
674
|
+
decision.action.as_str(),
|
|
675
|
+
input,
|
|
676
|
+
root,
|
|
677
|
+
config,
|
|
678
|
+
chat_id,
|
|
679
|
+
approve_cb,
|
|
680
|
+
)
|
|
681
|
+
.await
|
|
682
|
+
}
|
|
683
|
+
"git_status" | "git_diff" | "git_log" | "git_branch" | "git_checkpoint"
|
|
684
|
+
| "git_rollback" | "git_restore_file" | "git_commit" | "git_create_branch" => {
|
|
685
|
+
super::git::execute(
|
|
686
|
+
decision.action.as_str(),
|
|
687
|
+
input,
|
|
688
|
+
root,
|
|
689
|
+
config,
|
|
690
|
+
chat_id,
|
|
691
|
+
approve_cb,
|
|
692
|
+
)
|
|
693
|
+
.await
|
|
694
|
+
}
|
|
695
|
+
"create_plan" | "update_plan" | "request_user_approval" | "ask_user" => {
|
|
696
|
+
super::planning::execute(
|
|
697
|
+
decision.action.as_str(),
|
|
698
|
+
input,
|
|
699
|
+
root,
|
|
700
|
+
config,
|
|
701
|
+
chat_id,
|
|
702
|
+
approve_cb,
|
|
703
|
+
progress,
|
|
704
|
+
)
|
|
705
|
+
.await
|
|
706
|
+
}
|
|
707
|
+
"detect_project" | "list_tests" | "read_diagnostics" | "view_image" | "search_docs"
|
|
708
|
+
| "create_project_doc" => {
|
|
709
|
+
super::project::execute(
|
|
710
|
+
decision.action.as_str(),
|
|
711
|
+
input,
|
|
712
|
+
root,
|
|
713
|
+
config,
|
|
714
|
+
chat_id,
|
|
715
|
+
approve_cb,
|
|
716
|
+
)
|
|
717
|
+
.await
|
|
718
|
+
}
|
|
719
|
+
"avatar_signal" => super::avatar::execute(input).await,
|
|
720
|
+
"run_plugin" | "dispatch_agents" | "dispatch_subagent" | "mcp_tool" | "mcp_list_tools" => {
|
|
721
|
+
super::plugins_mcp::execute(
|
|
722
|
+
decision.action.as_str(),
|
|
723
|
+
input,
|
|
724
|
+
root,
|
|
725
|
+
config,
|
|
726
|
+
chat_id,
|
|
727
|
+
approve_cb,
|
|
728
|
+
progress,
|
|
729
|
+
)
|
|
730
|
+
.await
|
|
731
|
+
}
|
|
732
|
+
"run_shell" | "shell_output" | "kill_shell" | "verify" | "run_tests" | "run_typecheck"
|
|
733
|
+
| "run_linter" => {
|
|
734
|
+
super::shell::execute(
|
|
735
|
+
decision.action.as_str(),
|
|
736
|
+
input,
|
|
737
|
+
root,
|
|
738
|
+
config,
|
|
739
|
+
chat_id,
|
|
740
|
+
approve_cb,
|
|
741
|
+
)
|
|
742
|
+
.await
|
|
743
|
+
}
|
|
744
|
+
"video_trim"
|
|
745
|
+
| "video.trim"
|
|
746
|
+
| "video_remove_silence"
|
|
747
|
+
| "video.remove_silence"
|
|
748
|
+
| "video_resize"
|
|
749
|
+
| "video_merge"
|
|
750
|
+
| "video_export"
|
|
751
|
+
| "video.export"
|
|
752
|
+
| "video_extract_audio"
|
|
753
|
+
| "video_filmstrip"
|
|
754
|
+
| "video.filmstrip"
|
|
755
|
+
| "video_waveform"
|
|
756
|
+
| "video.waveform"
|
|
757
|
+
| "speech_transcribe"
|
|
758
|
+
| "subtitle_generate"
|
|
759
|
+
| "subtitle.generate"
|
|
760
|
+
| "subtitle_translate"
|
|
761
|
+
| "subtitle.translate"
|
|
762
|
+
| "subtitle_burn"
|
|
763
|
+
| "timeline_reorder"
|
|
764
|
+
| "timeline.reorder"
|
|
765
|
+
| "effect_zoom_on_speaker"
|
|
766
|
+
| "effect.zoom_on_speaker"
|
|
767
|
+
| "audio_duck_music"
|
|
768
|
+
| "audio.duck_music"
|
|
769
|
+
| "make_shorts"
|
|
770
|
+
| "video.make_shorts"
|
|
771
|
+
| "generate_image"
|
|
772
|
+
| "image_studio.generate"
|
|
773
|
+
| "image_generate"
|
|
774
|
+
| "generate_video"
|
|
775
|
+
| "veo.generate"
|
|
776
|
+
| "video_generate" => {
|
|
777
|
+
super::media::execute(
|
|
778
|
+
decision.action.as_str(),
|
|
779
|
+
input,
|
|
780
|
+
root,
|
|
781
|
+
config,
|
|
782
|
+
chat_id,
|
|
783
|
+
approve_cb,
|
|
784
|
+
)
|
|
785
|
+
.await
|
|
786
|
+
}
|
|
787
|
+
other => Err(OrchestrationError::Agent(format!(
|
|
788
|
+
"unsupported code-agent action '{}'",
|
|
789
|
+
other
|
|
790
|
+
))),
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
/// Bridge for callers outside this module (e.g. the Gemini Live realtime voice
|
|
795
|
+
/// session) that receive an action name and raw JSON input rather than a parsed
|
|
796
|
+
/// `AgentDecision`, and so can't construct one directly since its fields are
|
|
797
|
+
/// private to this module.
|
|
798
|
+
pub(crate) async fn execute_tool_from_json<Approve>(
|
|
799
|
+
root: &Path,
|
|
800
|
+
config: &MintConfig,
|
|
801
|
+
action: &str,
|
|
802
|
+
input: Value,
|
|
803
|
+
chat_id: &str,
|
|
804
|
+
approve_cb: &mut Approve,
|
|
805
|
+
) -> Result<String, OrchestrationError>
|
|
806
|
+
where
|
|
807
|
+
Approve: FnMut(&AgentApproval) -> Result<ApprovalOutcome, String> + Send,
|
|
808
|
+
{
|
|
809
|
+
let decision = AgentDecision {
|
|
810
|
+
thought: String::new(),
|
|
811
|
+
action: action.to_string(),
|
|
812
|
+
input: parse_tool_input(action, input)?,
|
|
813
|
+
};
|
|
814
|
+
// No progress channel from the realtime voice session — tool-call
|
|
815
|
+
// activity isn't surfaced there the way it is in the CLI/GUI.
|
|
816
|
+
execute_tool(root, config, &decision, chat_id, approve_cb, &mut |_| {}).await
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
pub(crate) fn append_native_tool_results(
|
|
820
|
+
messages: &mut Vec<ChatMessage>,
|
|
821
|
+
response_text: &str,
|
|
822
|
+
results: &[ToolResultEntry],
|
|
823
|
+
signatures: &std::collections::HashMap<String, String>,
|
|
824
|
+
images: &std::collections::HashMap<String, Vec<String>>,
|
|
825
|
+
) {
|
|
826
|
+
let mut assistant_content: Vec<ContentBlock> = Vec::new();
|
|
827
|
+
if !response_text.is_empty() {
|
|
828
|
+
assistant_content.push(ContentBlock::Text {
|
|
829
|
+
text: response_text.to_string(),
|
|
830
|
+
});
|
|
831
|
+
}
|
|
832
|
+
let mut tool_result_content: Vec<ContentBlock> = Vec::new();
|
|
833
|
+
for ToolResultEntry {
|
|
834
|
+
call_id,
|
|
835
|
+
action,
|
|
836
|
+
input: input_value,
|
|
837
|
+
text: final_result,
|
|
838
|
+
status,
|
|
839
|
+
} in results
|
|
840
|
+
{
|
|
841
|
+
// Activity annotations are for the UI, not parameters of the provider tool schema.
|
|
842
|
+
let mut tool_input = input_value.clone();
|
|
843
|
+
if let Some(object) = tool_input.as_object_mut() {
|
|
844
|
+
object.remove("skill_name");
|
|
845
|
+
}
|
|
846
|
+
assistant_content.push(ContentBlock::ToolUse {
|
|
847
|
+
id: call_id.clone(),
|
|
848
|
+
name: action.clone(),
|
|
849
|
+
input: tool_input,
|
|
850
|
+
thought_signature: signatures.get(call_id).cloned(),
|
|
851
|
+
});
|
|
852
|
+
tool_result_content.push(ContentBlock::ToolResult {
|
|
853
|
+
tool_use_id: call_id.clone(),
|
|
854
|
+
content: final_result.clone(),
|
|
855
|
+
is_error: matches!(
|
|
856
|
+
*status,
|
|
857
|
+
crate::mcp_result::ToolStatus::Failed
|
|
858
|
+
| crate::mcp_result::ToolStatus::TimedOut
|
|
859
|
+
| crate::mcp_result::ToolStatus::Cancelled
|
|
860
|
+
),
|
|
861
|
+
});
|
|
862
|
+
if let Some(data_uris) = images.get(call_id) {
|
|
863
|
+
for data_uri in data_uris {
|
|
864
|
+
tool_result_content.push(ContentBlock::Image {
|
|
865
|
+
data_uri: data_uri.clone(),
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
if !assistant_content.is_empty() {
|
|
871
|
+
messages.push(ChatMessage {
|
|
872
|
+
role: ChatRole::Assistant,
|
|
873
|
+
content: assistant_content,
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
if !tool_result_content.is_empty() {
|
|
877
|
+
messages.push(ChatMessage {
|
|
878
|
+
role: ChatRole::Tool,
|
|
879
|
+
content: tool_result_content,
|
|
880
|
+
});
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
pub(crate) fn extract_modified_paths(results: &[ToolResultEntry]) -> Vec<String> {
|
|
885
|
+
let mut paths = Vec::new();
|
|
886
|
+
for entry in results {
|
|
887
|
+
if matches!(entry.status, crate::mcp_result::ToolStatus::Success) {
|
|
888
|
+
match entry.action.as_str() {
|
|
889
|
+
"apply_patch" => {
|
|
890
|
+
let path_opt = entry
|
|
891
|
+
.input
|
|
892
|
+
.get("patch")
|
|
893
|
+
.and_then(|p| p.get("path"))
|
|
894
|
+
.and_then(|p| p.as_str())
|
|
895
|
+
.or_else(|| entry.input.get("path").and_then(|p| p.as_str()));
|
|
896
|
+
if let Some(path) = path_opt {
|
|
897
|
+
let trimmed = path.trim();
|
|
898
|
+
if !trimmed.is_empty() {
|
|
899
|
+
paths.push(trimmed.to_string());
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
"write_file" | "apply_code_edits" | "patch_file" | "delete_file" => {
|
|
904
|
+
if let Some(path) = entry.input.get("path").and_then(|p| p.as_str()) {
|
|
905
|
+
let trimmed = path.trim();
|
|
906
|
+
if !trimmed.is_empty() {
|
|
907
|
+
paths.push(trimmed.to_string());
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
_ => {}
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
paths
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
#[cfg(test)]
|
|
919
|
+
mod tests {
|
|
920
|
+
use super::*;
|
|
921
|
+
use serde_json::json;
|
|
922
|
+
|
|
923
|
+
#[test]
|
|
924
|
+
fn extract_modified_paths_captures_apply_patch_and_write_file() {
|
|
925
|
+
let results = vec![
|
|
926
|
+
ToolResultEntry {
|
|
927
|
+
call_id: "c1".into(),
|
|
928
|
+
action: "apply_patch".into(),
|
|
929
|
+
input: json!({
|
|
930
|
+
"patch": {
|
|
931
|
+
"path": "crates/mint-core/src/lib.rs",
|
|
932
|
+
"hunks": []
|
|
933
|
+
}
|
|
934
|
+
}),
|
|
935
|
+
text: "success".into(),
|
|
936
|
+
status: crate::mcp_result::ToolStatus::Success,
|
|
937
|
+
},
|
|
938
|
+
ToolResultEntry {
|
|
939
|
+
call_id: "c2".into(),
|
|
940
|
+
action: "write_file".into(),
|
|
941
|
+
input: json!({
|
|
942
|
+
"path": "README.md",
|
|
943
|
+
"fileContent": "new content"
|
|
944
|
+
}),
|
|
945
|
+
text: "created".into(),
|
|
946
|
+
status: crate::mcp_result::ToolStatus::Success,
|
|
947
|
+
},
|
|
948
|
+
ToolResultEntry {
|
|
949
|
+
call_id: "c3".into(),
|
|
950
|
+
action: "read_file".into(),
|
|
951
|
+
input: json!({"path": "src/main.rs"}),
|
|
952
|
+
text: "read".into(),
|
|
953
|
+
status: crate::mcp_result::ToolStatus::Success,
|
|
954
|
+
},
|
|
955
|
+
ToolResultEntry {
|
|
956
|
+
call_id: "c4".into(),
|
|
957
|
+
action: "apply_patch".into(),
|
|
958
|
+
input: json!({"patch": {"path": "failed.rs"}}),
|
|
959
|
+
text: "failed".into(),
|
|
960
|
+
status: crate::mcp_result::ToolStatus::Failed,
|
|
961
|
+
},
|
|
962
|
+
];
|
|
963
|
+
|
|
964
|
+
let modified = extract_modified_paths(&results);
|
|
965
|
+
assert_eq!(modified, vec!["crates/mint-core/src/lib.rs", "README.md"]);
|
|
966
|
+
}
|
|
967
|
+
}
|