@pheem49/mint 1.16.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 -72
- package/apps/mint-companion/src-tauri/src/compact.rs +69 -0
- package/apps/mint-companion/src-tauri/src/main.rs +218 -11
- package/apps/mint-companion/vite.config.ts +2 -1
- package/crates/mint-cli/src/agent/diff_render.rs +66 -44
- package/crates/mint-cli/src/agent/live_status.rs +64 -6
- package/crates/mint-cli/src/agent/markdown_render.rs +342 -5
- package/crates/mint-cli/src/agent.rs +202 -47
- package/crates/mint-cli/src/commands/agent.rs +223 -117
- package/crates/mint-cli/src/commands/browser.rs +114 -0
- package/crates/mint-cli/src/commands/config.rs +14 -1
- package/crates/mint-cli/src/commands/integrations.rs +3 -3
- package/crates/mint-cli/src/commands/knowledge.rs +16 -2
- package/crates/mint-cli/src/commands/mod.rs +15 -4
- package/crates/mint-cli/src/commands/tailnet_web.rs +3 -7
- package/crates/mint-cli/src/companion_navigation.rs +268 -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 +92 -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 +758 -373
- package/crates/mint-cli/src/interactive/tool_activity.rs +468 -56
- package/crates/mint-cli/src/interactive.rs +74 -5
- package/crates/mint-cli/src/main.rs +26 -2
- package/crates/mint-cli/src/markdown.rs +2 -37
- package/crates/mint-cli/src/onboard.rs +3897 -1321
- 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-cli/tests/mods_testing.rs +5 -1
- package/crates/mint-companion-protocol/src/lib.rs +113 -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 +129 -8
- package/crates/mint-core/src/agent/safety.rs +56 -4
- package/crates/mint-core/src/agent/skill_inventory.rs +3 -1
- package/crates/mint-core/src/agent/skills.rs +1 -0
- package/crates/mint-core/src/agent/tasks.rs +2 -2
- package/crates/mint-core/src/api_server/routes/auth.rs +1 -4
- package/crates/mint-core/src/api_server/routes/chat.rs +53 -17
- 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/misc.rs +116 -0
- package/crates/mint-core/src/api_server/routes/profile_oauth.rs +43 -26
- package/crates/mint-core/src/api_server/routes/sessions.rs +114 -76
- package/crates/mint-core/src/api_server/routes/skills_subagents.rs +11 -7
- package/crates/mint-core/src/api_server/routes/status_health.rs +18 -8
- package/crates/mint-core/src/api_server.rs +211 -65
- package/crates/mint-core/src/avatar_bridge.rs +5 -24
- package/crates/mint-core/src/browser/cdp.rs +92 -30
- 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 +10 -30
- package/crates/mint-core/src/browser/navigate.rs +83 -44
- package/crates/mint-core/src/browser/runtime.rs +282 -0
- package/crates/mint-core/src/browser/session.rs +240 -400
- package/crates/mint-core/src/browser/workflow.rs +496 -0
- package/crates/mint-core/src/companion/navigation.rs +115 -0
- package/crates/mint-core/src/companion.rs +109 -1
- 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/integrations/mcp_result.rs +45 -0
- package/crates/mint-core/src/lib.rs +10 -11
- package/crates/mint-core/src/media/gemini_live.rs +636 -86
- package/crates/mint-core/src/media/image_proxy.rs +563 -0
- 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 +287 -0
- package/crates/mint-core/src/media/tts/playback.rs +609 -0
- package/crates/mint-core/src/media/tts.rs +1 -0
- package/crates/mint-core/src/media.rs +2 -0
- package/crates/mint-core/src/mods/manager.rs +101 -35
- package/crates/mint-core/src/orchestration/context_render.rs +878 -44
- package/crates/mint-core/src/orchestration/decision_parsing.rs +536 -39
- package/crates/mint-core/src/orchestration/diagnostics.rs +307 -0
- package/crates/mint-core/src/orchestration/full_skill_result_tests.rs +12 -0
- package/crates/mint-core/src/orchestration/image_regressions.rs +379 -0
- package/crates/mint-core/src/orchestration/loop_guard.rs +479 -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 +859 -4244
- package/crates/mint-core/src/orchestration/reliability.rs +581 -0
- package/crates/mint-core/src/orchestration/repeated_failures.rs +8 -0
- package/crates/mint-core/src/orchestration/review_regressions.rs +179 -28
- 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 +32 -3
- 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/plugins_mcp.rs +19 -4
- package/crates/mint-core/src/orchestration/tools/project.rs +1 -1
- package/crates/mint-core/src/orchestration/tools/shell.rs +157 -62
- package/crates/mint-core/src/orchestration/tools/web.rs +5 -1
- package/crates/mint-core/src/orchestration/trajectory_schema.rs +353 -0
- package/crates/mint-core/src/orchestration/truncation.rs +368 -0
- package/crates/mint-core/src/orchestration/types.rs +648 -0
- package/crates/mint-core/src/orchestration/verification.rs +36 -9
- package/crates/mint-core/src/orchestration/workspace_helpers.rs +76 -27
- package/crates/mint-core/src/prompts/agent.rs +69 -102
- package/crates/mint-core/src/prompts/tool_catalog.rs +104 -153
- package/crates/mint-core/src/search/files.rs +20 -0
- package/crates/mint-core/src/search/web_search.rs +44 -3
- package/crates/mint-core/src/slash/mod.rs +481 -55
- package/crates/mint-core/src/slash/models.rs +6 -1
- package/crates/mint-core/src/swarm/batch.rs +643 -0
- package/crates/mint-core/src/swarm/dossier.rs +152 -0
- package/crates/mint-core/src/swarm/labels.rs +100 -0
- package/crates/mint-core/src/swarm/mod.rs +158 -0
- package/crates/mint-core/src/swarm/permissions.rs +167 -0
- package/crates/mint-core/src/system/auth.rs +156 -7
- package/crates/mint-core/src/system/bg_shell.rs +78 -9
- package/crates/mint-core/src/system/config.rs +266 -35
- package/crates/mint-core/src/system/mint_web.rs +33 -12
- package/crates/mint-core/src/system/shell.rs +179 -10
- package/crates/mint-core/src/system/workspace.rs +204 -0
- package/crates/mint-core/tests/background_retention.rs +1 -1
- package/crates/mint-core/tests/memory_persistence.rs +27 -0
- package/crates/mint-mod-runtime/src/lib.rs +37 -23
- package/out/web/assets/ArtifactPreviewPanel-Cx6BVOOF.js +2 -0
- package/out/web/assets/ArtifactPreviewPanel-DAT_Y7i0.css +1 -0
- package/out/web/assets/CalculationCard-D2E74u5q.js +1 -0
- package/out/web/assets/CliSessionsView-ZbdtSjvK.css +1 -0
- package/out/web/assets/CliSessionsView-z5i6qGyb.js +1 -0
- package/out/web/assets/CodeReviewPage-BK2bOScd.css +1 -0
- package/out/web/assets/CodeReviewPage-Dp6zHuHu.js +2 -0
- package/out/web/assets/CommandPalette-DaKlzbKs.js +1 -0
- package/out/web/assets/ImageGenCard-BMCJHP9O.js +1 -0
- package/out/web/assets/ImageSearchCard-Cld_SOUg.js +1 -0
- package/out/web/assets/ImageStudioPanel-B5N7TjeB.js +1 -0
- 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-DnXPlzI7.js +1 -0
- 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-DoTg9MVa.js +1 -0
- package/out/web/assets/RewindModal-B5oowrR0.js +1 -0
- package/out/web/assets/ScheduledTasksView-BD5DVPkZ.js +1 -0
- package/out/web/assets/SelectField-Cy6CghrU.js +1 -0
- package/out/web/assets/SelectField-lFEkkWCU.css +1 -0
- package/out/web/assets/SettingsWindow-BYl_oCFh.js +4 -0
- package/out/web/assets/SettingsWindow-Ckcgnjt8.css +1 -0
- package/out/web/assets/SkillsView-CIeWwq5z.js +2 -0
- 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-CdY0hGWy.js +1 -0
- package/out/web/assets/UiGridCard-BBK3I5hC.js +1 -0
- 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-Co6-wEWM.js +4 -0
- package/out/web/assets/WeatherCard-Buzi7Vfu.js +1 -0
- package/out/web/assets/WorkspacePanel-BfHKkulU.js +1 -0
- package/out/web/assets/WorkspacePdfPreview-Bi8Zzyir.js +2 -0
- package/out/web/assets/abnfDiagram-VCTEODGH-CMfR95N2.js +1 -0
- package/out/web/assets/architecture-7GRP2DOG-DhAM4HyO.js +1 -0
- package/out/web/assets/architectureDiagram-5GKGNRK7-Yk3TUJ_F.js +36 -0
- package/out/web/assets/{blockDiagram-NRAW4CY4-BrrqzHW5.js → blockDiagram-I7D4REHJ-X9fBgJik.js} +4 -4
- package/out/web/assets/c4Diagram-7LVT6UL2-Bk9x7N-8.js +38 -0
- package/out/web/assets/chunk-2Q5K7J3B-D2JLPQzF.js +1 -0
- package/out/web/assets/{chunk-TEH6E4GO-G4Cdlyrt.js → chunk-4HAMMTFA-Dx5fk1_0.js} +3 -3
- package/out/web/assets/{chunk-5VM5RSS4-BiPuE0io.js → chunk-5VM5RSS4-BZ2oBPYQ.js} +1 -1
- package/out/web/assets/chunk-75Z2AOVW-BszTQoM4.js +2 -0
- package/out/web/assets/chunk-DU6HZSFF-DK-As3rk.js +128 -0
- package/out/web/assets/chunk-F27PBJKO-LmncZZIS.js +1 -0
- package/out/web/assets/chunk-FOHPRMQF-JXEeeJ9r.js +161 -0
- package/out/web/assets/{chunk-GMAD6QVW-BuhEcgHq.js → chunk-GMAD6QVW-DSQ_sDRJ.js} +12 -12
- package/out/web/assets/chunk-GVQU2GXP-Cno3ulje.js +1 -0
- package/out/web/assets/chunk-IMKFNOWR-bIzfY9Jc.js +231 -0
- package/out/web/assets/chunk-JWPE2WC7-BeEMUFDw.js +1 -0
- package/out/web/assets/chunk-L3NEJ4N5-Dl6eOa0D.js +1 -0
- package/out/web/assets/chunk-OSK3NFVY-BaUGJ-cM.js +10 -0
- package/out/web/assets/chunk-P2QGCYS3-_066ndhH.js +1 -0
- package/out/web/assets/chunk-POPQ4Y6H-YT1AKhTv.js +1 -0
- package/out/web/assets/chunk-PWAF6VOD-CrEgDsxh.js +1 -0
- package/out/web/assets/chunk-SHT3W25Y-_KwaRLOl.js +168 -0
- package/out/web/assets/{chunk-SVP7TREG-Bu_yYb-V.js → chunk-SVP7TREG-BQ1qb32L.js} +1 -1
- package/out/web/assets/{chunk-LCL6LL3I-BhXV9zyH.js → chunk-TICWLB2K-BDyehCtg.js} +4 -4
- package/out/web/assets/chunk-XXDRQBXY-B9YlhOkE.js +1 -0
- package/out/web/assets/chunk-Y2CYZVJY-BxCWjNVG.js +1 -0
- 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-2suVFPZg.css +1 -0
- package/out/web/assets/config-CkRCdkxn.js +2 -0
- package/out/web/assets/core-Mi3s5D4_.js +1 -0
- package/out/web/assets/cose-bilkent-JH36ORCC-qlna31ty.js +1 -0
- package/out/web/assets/cynefin-OW5HDTMX-Dl_31aaN.js +1 -0
- package/out/web/assets/cynefinDiagram-5FMLGOSQ-Bpir8jha.js +62 -0
- package/out/web/assets/cytoscape.esm-DWtAUG0r.js +321 -0
- package/out/web/assets/dagre-CnWJJM5f.js +1 -0
- package/out/web/assets/dagre-GXQ25YYZ-D9xu3nsq.js +4 -0
- package/out/web/assets/diagram-S7CK7UJ4-DeveoEeB.js +30 -0
- package/out/web/assets/diagram-UQ7AKVKN-p4xWRESV.js +41 -0
- package/out/web/assets/{diagram-VSXAHHWV-BJ86Ov2Y.js → diagram-VSXAHHWV-C7qz9NDF.js} +1 -1
- package/out/web/assets/diagram-VX7I27RA-DRiCa3Vd.js +24 -0
- package/out/web/assets/diagram-Z3DM3KII-Bt7zduQX.js +24 -0
- package/out/web/assets/dist-9ISJ7r-g.js +1 -0
- package/out/web/assets/dist-js-BV3mI7uw.js +1 -0
- package/out/web/assets/ebnfDiagram-PWID7BFC-DV9WpwdR.js +1 -0
- package/out/web/assets/{erDiagram-SSCWMZ5O-CzzmnZWT.js → erDiagram-RLTQ6QDP-BJ_nwG2m.js} +3 -3
- package/out/web/assets/event-D7D-EBy9.js +1 -0
- package/out/web/assets/eventmodeling-NTZA5JFV-BTBMrfVa.js +1 -0
- package/out/web/assets/flowDiagram-HODETNUW-Cdlq3cJL.js +1 -0
- package/out/web/assets/ganttDiagram-EL5Y4UJY-DQLdsXrC.js +292 -0
- package/out/web/assets/gitGraph-4MIJSDKK-CL1OEOQ_.js +1 -0
- package/out/web/assets/gitGraphDiagram-WWUBYQGX-8cSi42H7.js +106 -0
- package/out/web/assets/graphlib-Bh9gHply.js +1 -0
- 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-C1zsX5sc.js +1 -0
- package/out/web/assets/infoDiagram-27XIBGKW-DsRYtIyI.js +2 -0
- package/out/web/assets/{ishikawaDiagram-5VMMS53U-s38yo28y.js → ishikawaDiagram-5VMMS53U-B2crwIXj.js} +4 -4
- package/out/web/assets/journeyDiagram-3NMN7TZE-BTH-GyVR.js +139 -0
- package/out/web/assets/jsx-runtime-DmUwWVTj.js +1 -0
- package/out/web/assets/{kanban-definition-3QL26DDD-DodjgySL.js → kanban-definition-UXKFOSKX-BeRfCnuA.js} +6 -6
- package/out/web/assets/katex-MCdQaEAD.js +257 -0
- package/out/web/assets/mermaid-parser.core-BJwgCBBc.js +7 -0
- package/out/web/assets/mermaid.core-CsDDodN8.js +44 -0
- package/out/web/assets/{mindmap-definition-FBJOCRG2-260WBDxZ.js → mindmap-definition-YA3MSWOX-B42efOQ1.js} +4 -4
- package/out/web/assets/modelManager-B3ZFMh8v.js +2 -0
- package/out/web/assets/oauthManager-Ch5Du2fF.js +1 -0
- package/out/web/assets/packet-AYTQ26CC-B6xUyE6r.js +1 -0
- package/out/web/assets/pdf-Bcahc2yC.js +56 -0
- package/out/web/assets/pdf.worker.min-Dkey6ZUl.mjs +27 -0
- package/out/web/assets/pegDiagram-XKGWAZYB-1LabVycL.js +1 -0
- package/out/web/assets/pie-WAS4IAKB-DJwo-nf_.js +1 -0
- package/out/web/assets/pieDiagram-E7YTZNPT-icmAqzy4.js +39 -0
- package/out/web/assets/{quadrantDiagram-AXDQQJYC-B8D3gU5d.js → quadrantDiagram-AXDQQJYC-CZ-wEx41.js} +4 -4
- package/out/web/assets/radar-RG4KPBEZ-D7d-Xriw.js +1 -0
- package/out/web/assets/railroad-74A4TZTK-viuhdYbs.js +1 -0
- package/out/web/assets/railroad-abnf-HS5TGJTU-DNXiCNea.js +1 -0
- package/out/web/assets/railroad-ebnf-LZEXJU2U-nkSu1-0C.js +1 -0
- package/out/web/assets/railroad-peg-WCYAUIDC-BhbMeQzz.js +1 -0
- package/out/web/assets/railroadDiagram-O6MQD6OU-CLpG1jUX.js +1 -0
- package/out/web/assets/{requirementDiagram-EFPCY7ZU-D2X-Ewik.js → requirementDiagram-BXWQKSXE-kRDrvWrc.js} +3 -3
- package/out/web/assets/rolldown-runtime-CNOWq4Kh.js +1 -0
- package/out/web/assets/rough.esm-CNnFptCR.js +1 -0
- package/out/web/assets/sankeyDiagram-P5KCCOFB-DxAwmq4x.js +40 -0
- package/out/web/assets/sequenceDiagram-WJ2MYXX4-aLgY-6Wz.js +162 -0
- package/out/web/assets/sizeCapture-INFHLROL-C8Q8DbV5.js +1 -0
- package/out/web/assets/src-CRDfRlHM.js +1 -0
- package/out/web/assets/stateDiagram-D77RDMKH-D5QWfOhp.js +1 -0
- package/out/web/assets/stateDiagram-v2-MP3YSRHH-D6OiZoAP.js +1 -0
- package/out/web/assets/studio-BBZQ_-QK.js +1 -0
- package/out/web/assets/swimlanes-42K2YHIH-CRs5UyA-.js +1 -0
- 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-Denqd9qb.js +120 -0
- package/out/web/assets/treeView-Q6P3EWNA-0my3Z3s4.js +1 -0
- package/out/web/assets/treemap-WGGIJYW6-B_EjkLYq.js +1 -0
- package/out/web/assets/vennDiagram-4TSXK5OY-DxVg3Ewr.js +34 -0
- package/out/web/assets/wardley-WFR3VGLG-CGD-Tj4p.js +1 -0
- package/out/web/assets/{wardleyDiagram-VM6X3IG4-DAdXELbQ.js → wardleyDiagram-VM6X3IG4-CmfS39Xm.js} +35 -35
- package/out/web/assets/window-CkUOP7t0.js +1 -0
- package/out/web/assets/workspaces-SYPrmbgC.js +1 -0
- package/out/web/assets/{xychartDiagram-S5SC5T6Z-IZIXf3Vo.js → xychartDiagram-S5SC5T6Z-BVM9bKis.js} +4 -4
- package/out/web/index-web.html +4 -4
- package/out/web/index.html +4 -4
- package/out/web/pdfjs/cmaps/78-EUC-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/78-EUC-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/78-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/78-RKSJ-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/78-RKSJ-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/78-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/78ms-RKSJ-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/78ms-RKSJ-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/83pv-RKSJ-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/90ms-RKSJ-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/90ms-RKSJ-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/90msp-RKSJ-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/90msp-RKSJ-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/90pv-RKSJ-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/90pv-RKSJ-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Add-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Add-RKSJ-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Add-RKSJ-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Add-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-CNS1-0.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-CNS1-1.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-CNS1-2.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-CNS1-3.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-CNS1-4.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-CNS1-5.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-CNS1-6.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-CNS1-UCS2.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-GB1-0.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-GB1-1.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-GB1-2.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-GB1-3.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-GB1-4.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-GB1-5.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-GB1-UCS2.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-Japan1-0.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-Japan1-1.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-Japan1-2.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-Japan1-3.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-Japan1-4.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-Japan1-5.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-Japan1-6.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-Japan1-UCS2.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-Korea1-0.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-Korea1-1.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-Korea1-2.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Adobe-Korea1-UCS2.bcmap +0 -0
- package/out/web/pdfjs/cmaps/B5-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/B5-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/B5pc-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/B5pc-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/CNS-EUC-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/CNS-EUC-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/CNS1-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/CNS1-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/CNS2-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/CNS2-V.bcmap +3 -0
- package/out/web/pdfjs/cmaps/ETHK-B5-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/ETHK-B5-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/ETen-B5-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/ETen-B5-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/ETenms-B5-H.bcmap +3 -0
- package/out/web/pdfjs/cmaps/ETenms-B5-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/EUC-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/EUC-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Ext-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Ext-RKSJ-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Ext-RKSJ-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Ext-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/GB-EUC-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/GB-EUC-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/GB-H.bcmap +4 -0
- package/out/web/pdfjs/cmaps/GB-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/GBK-EUC-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/GBK-EUC-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/GBK2K-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/GBK2K-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/GBKp-EUC-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/GBKp-EUC-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/GBT-EUC-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/GBT-EUC-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/GBT-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/GBT-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/GBTpc-EUC-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/GBTpc-EUC-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/GBpc-EUC-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/GBpc-EUC-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/HKdla-B5-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/HKdla-B5-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/HKdlb-B5-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/HKdlb-B5-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/HKgccs-B5-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/HKgccs-B5-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/HKm314-B5-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/HKm314-B5-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/HKm471-B5-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/HKm471-B5-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/HKscs-B5-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/HKscs-B5-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Hankaku.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Hiragana.bcmap +0 -0
- package/out/web/pdfjs/cmaps/KSC-EUC-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/KSC-EUC-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/KSC-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/KSC-Johab-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/KSC-Johab-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/KSC-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/KSCms-UHC-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/KSCms-UHC-HW-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/KSCms-UHC-HW-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/KSCms-UHC-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/KSCpc-EUC-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/KSCpc-EUC-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Katakana.bcmap +0 -0
- package/out/web/pdfjs/cmaps/LICENSE +36 -0
- package/out/web/pdfjs/cmaps/NWP-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/NWP-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/RKSJ-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/RKSJ-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/Roman.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniCNS-UCS2-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniCNS-UCS2-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniCNS-UTF16-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniCNS-UTF16-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniCNS-UTF32-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniCNS-UTF32-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniCNS-UTF8-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniCNS-UTF8-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniGB-UCS2-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniGB-UCS2-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniGB-UTF16-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniGB-UTF16-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniGB-UTF32-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniGB-UTF32-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniGB-UTF8-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniGB-UTF8-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJIS-UCS2-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJIS-UCS2-HW-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJIS-UCS2-HW-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJIS-UCS2-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJIS-UTF16-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJIS-UTF16-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJIS-UTF32-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJIS-UTF32-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJIS-UTF8-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJIS-UTF8-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJIS2004-UTF16-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJIS2004-UTF16-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJIS2004-UTF32-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJIS2004-UTF32-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJIS2004-UTF8-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJIS2004-UTF8-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJISPro-UCS2-HW-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJISPro-UCS2-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJISPro-UTF8-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJISX0213-UTF32-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJISX0213-UTF32-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJISX02132004-UTF32-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniJISX02132004-UTF32-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniKS-UCS2-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniKS-UCS2-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniKS-UTF16-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniKS-UTF16-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniKS-UTF32-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniKS-UTF32-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniKS-UTF8-H.bcmap +0 -0
- package/out/web/pdfjs/cmaps/UniKS-UTF8-V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/V.bcmap +0 -0
- package/out/web/pdfjs/cmaps/WP-Symbol.bcmap +0 -0
- package/out/web/pdfjs/standard_fonts/FoxitDingbats.pfb +0 -0
- package/out/web/pdfjs/standard_fonts/FoxitFixed.pfb +0 -0
- package/out/web/pdfjs/standard_fonts/FoxitFixedBold.pfb +0 -0
- package/out/web/pdfjs/standard_fonts/FoxitFixedBoldItalic.pfb +0 -0
- package/out/web/pdfjs/standard_fonts/FoxitFixedItalic.pfb +0 -0
- package/out/web/pdfjs/standard_fonts/FoxitSerif.pfb +0 -0
- package/out/web/pdfjs/standard_fonts/FoxitSerifBold.pfb +0 -0
- package/out/web/pdfjs/standard_fonts/FoxitSerifBoldItalic.pfb +0 -0
- package/out/web/pdfjs/standard_fonts/FoxitSerifItalic.pfb +0 -0
- package/out/web/pdfjs/standard_fonts/FoxitSymbol.pfb +0 -0
- package/out/web/pdfjs/standard_fonts/LICENSE_FOXIT +27 -0
- package/out/web/pdfjs/standard_fonts/LICENSE_LIBERATION +363 -0
- package/out/web/pdfjs/standard_fonts/LiberationSans-Bold.ttf +0 -0
- package/out/web/pdfjs/standard_fonts/LiberationSans-BoldItalic.ttf +0 -0
- package/out/web/pdfjs/standard_fonts/LiberationSans-Italic.ttf +0 -0
- package/out/web/pdfjs/standard_fonts/LiberationSans-Regular.ttf +0 -0
- package/out/web/pdfjs/wasm/LICENSE_JBIG2 +196 -0
- package/out/web/pdfjs/wasm/LICENSE_OPENJPEG +39 -0
- package/out/web/pdfjs/wasm/LICENSE_PDFJS_JBIG2 +13 -0
- package/out/web/pdfjs/wasm/LICENSE_PDFJS_OPENJPEG +22 -0
- package/out/web/pdfjs/wasm/LICENSE_PDFJS_QCMS +19 -0
- package/out/web/pdfjs/wasm/LICENSE_QCMS +21 -0
- package/out/web/pdfjs/wasm/jbig2.wasm +0 -0
- package/out/web/pdfjs/wasm/jbig2_nowasm_fallback.js +15 -0
- package/out/web/pdfjs/wasm/openjpeg.wasm +0 -0
- package/out/web/pdfjs/wasm/openjpeg_nowasm_fallback.js +17 -0
- package/out/web/pdfjs/wasm/qcms_bg.wasm +0 -0
- package/out/web/pdfjs/wasm/quickjs-eval.js +16 -0
- package/out/web/pdfjs/wasm/quickjs-eval.wasm +0 -0
- package/package.json +6 -4
- 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 +14 -3
- package/src/bin/index.js +4 -1
- package/src/bin/pdfjs-assets.mjs +31 -0
- package/src/renderer/node_modules/.vite/vitest/CACHEDIR.TAG +3 -0
- package/src/renderer/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/src/renderer/shared/agentProgress.ts +62 -5
- package/src/renderer/shared/components/Settings/AgentsTab.tsx +70 -6
- package/src/renderer/shared/components/Settings/AudioTab.tsx +1 -1
- package/src/renderer/shared/components/Settings/AutomationTab.tsx +32 -29
- package/src/renderer/shared/components/Settings/AvatarCropModal.tsx +32 -12
- package/src/renderer/shared/components/Settings/CustomProviderLogoPicker.test.tsx +65 -0
- package/src/renderer/shared/components/Settings/CustomProviderLogoPicker.tsx +456 -0
- package/src/renderer/shared/components/Settings/GeneralTab.tsx +65 -94
- package/src/renderer/shared/components/Settings/PluginsTab.tsx +101 -24
- package/src/renderer/shared/components/Settings/ProfileTab.tsx +1 -1
- package/src/renderer/shared/components/Settings/SettingsWindow.tsx +796 -0
- package/src/renderer/shared/components/Settings/ThemeTab.test.tsx +45 -0
- package/src/renderer/shared/components/Settings/ThemeTab.tsx +119 -4
- package/src/renderer/shared/components/activity/AgentActivityDrawer.tsx +270 -0
- package/src/renderer/shared/components/activity/AgentActivityTable.tsx +582 -0
- 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/{McpToolResults.tsx → activity/McpToolResults.tsx} +69 -13
- package/src/renderer/shared/components/{PlanChecklistWidget.tsx → activity/PlanChecklistWidget.tsx} +2 -2
- package/src/renderer/shared/components/activity/RunSummaryDashboard.test.tsx +127 -0
- package/src/renderer/shared/components/activity/RunSummaryDashboard.tsx +222 -0
- package/src/renderer/shared/components/activity/SubagentDagView.test.ts +123 -0
- package/src/renderer/shared/components/{SubagentDagView.tsx → activity/SubagentDagView.tsx} +104 -50
- package/src/renderer/shared/components/activity/SubagentStatusStrip.test.tsx +82 -0
- package/src/renderer/shared/components/activity/SubagentStatusStrip.tsx +107 -0
- package/src/renderer/shared/components/activity/ViewedImages.tsx +179 -0
- package/src/renderer/shared/components/{AuthGate.tsx → app/AuthGate.tsx} +3 -3
- package/src/renderer/shared/components/{ChunkErrorBoundary.tsx → app/ChunkErrorBoundary.tsx} +13 -13
- package/src/renderer/shared/components/{CommandPalette.tsx → app/CommandPalette.tsx} +30 -30
- package/src/renderer/shared/components/{DashboardSidebar.tsx → app/DashboardSidebar.tsx} +7 -5
- package/src/renderer/shared/components/{DesktopTitlebar.tsx → app/DesktopTitlebar.tsx} +9 -26
- package/src/renderer/shared/components/{ErrorNotice.tsx → app/ErrorNotice.tsx} +1 -1
- package/src/renderer/shared/components/{MintDashboard.tsx → app/MintDashboard.tsx} +217 -228
- package/src/renderer/shared/components/{ModalErrorBoundary.tsx → app/ModalErrorBoundary.tsx} +8 -8
- package/src/renderer/shared/components/{CalculationCard.tsx → cards/CalculationCard.tsx} +16 -30
- package/src/renderer/shared/components/{ImageGenCard.tsx → cards/ImageGenCard.tsx} +11 -24
- package/src/renderer/shared/components/{ImageSearchCard.tsx → cards/ImageSearchCard.tsx} +11 -24
- package/src/renderer/shared/components/{MermaidCard.tsx → cards/MermaidCard.tsx} +38 -22
- 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/{StockCard.tsx → cards/StockCard.tsx} +22 -38
- package/src/renderer/shared/components/cards/ToolResultCards.tsx +94 -0
- package/src/renderer/shared/components/{UiFeatureCard.tsx → cards/UiFeatureCard.tsx} +6 -6
- package/src/renderer/shared/components/{UiGridCard.tsx → cards/UiGridCard.tsx} +3 -3
- package/src/renderer/shared/components/{UiMockupWidget.tsx → cards/UiMockupWidget.tsx} +4 -4
- package/src/renderer/shared/components/{WeatherCard.tsx → cards/WeatherCard.tsx} +6 -6
- package/src/renderer/shared/components/{ApprovalCard.test.tsx → chat/ApprovalCard.test.tsx} +12 -1
- package/src/renderer/shared/components/{ApprovalCard.tsx → chat/ApprovalCard.tsx} +26 -7
- 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/{ChatCodeBlock.tsx → chat/ChatCodeBlock.tsx} +16 -2
- package/src/renderer/shared/components/chat/ChatMessageItem.test.tsx +183 -0
- package/src/renderer/shared/components/chat/ChatMessageItem.tsx +388 -0
- 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 +53 -0
- package/src/renderer/shared/components/{ChatPanel.tsx → chat/ChatPanel.tsx} +462 -537
- package/src/renderer/shared/components/{CollapsiblePasteInput.tsx → chat/CollapsiblePasteInput.tsx} +2 -2
- package/src/renderer/shared/components/{DiffReviewModal.tsx → chat/DiffReviewModal.tsx} +44 -44
- package/src/renderer/shared/components/chat/GeminiLiveOverlay.test.tsx +165 -0
- package/src/renderer/shared/components/{GeminiLiveOverlay.tsx → chat/GeminiLiveOverlay.tsx} +47 -5
- package/src/renderer/shared/components/{ModelSelectorPopover.tsx → chat/ModelSelectorPopover.tsx} +44 -16
- package/src/renderer/shared/components/chat/QueuedMessagesBanner.test.tsx +89 -0
- package/src/renderer/shared/components/chat/QueuedMessagesBanner.tsx +201 -0
- package/src/renderer/shared/components/{RewindModal.tsx → chat/RewindModal.tsx} +14 -14
- package/src/renderer/shared/components/{SlashChoicePanel.tsx → chat/SlashChoicePanel.tsx} +2 -2
- package/src/renderer/shared/components/{SlashSuggestions.test.tsx → chat/SlashSuggestions.test.tsx} +14 -0
- package/src/renderer/shared/components/{SlashSuggestions.tsx → chat/SlashSuggestions.tsx} +4 -4
- package/src/renderer/shared/components/chat/SourcesBlock.test.tsx +53 -0
- package/src/renderer/shared/components/{SourcesBlock.tsx → chat/SourcesBlock.tsx} +262 -123
- package/src/renderer/shared/components/{ThinkingBlock.tsx → chat/ThinkingBlock.tsx} +1 -1
- package/src/renderer/shared/components/chat/TurnFileChanges.test.tsx +130 -0
- package/src/renderer/shared/components/chat/TurnFileChanges.tsx +463 -0
- package/src/renderer/shared/components/{VoicePill.css → chat/VoicePill.css} +1 -1
- package/src/renderer/shared/components/{VoicePill.jsx → chat/VoicePill.jsx} +3 -2
- package/src/renderer/shared/components/{CliSessionsView.test.tsx → extensions/CliSessionsView.test.tsx} +2 -2
- package/src/renderer/shared/components/{CliSessionsView.tsx → extensions/CliSessionsView.tsx} +19 -16
- package/src/renderer/shared/components/{LinkedFoldersView.tsx → extensions/LinkedFoldersView.tsx} +3 -3
- package/src/renderer/shared/components/{McpRegistryPicker.tsx → extensions/McpRegistryPicker.tsx} +6 -6
- package/src/renderer/shared/components/{McpServersView.tsx → extensions/McpServersView.tsx} +105 -36
- package/src/renderer/shared/components/{McpToolAllowlist.tsx → extensions/McpToolAllowlist.tsx} +2 -2
- package/src/renderer/shared/components/{ModUi.test.tsx → extensions/ModUi.test.tsx} +9 -4
- package/src/renderer/shared/components/{ModsPanel.tsx → extensions/ModsPanel.tsx} +59 -7
- package/src/renderer/shared/components/{PluginsView.tsx → extensions/PluginsView.tsx} +6 -6
- package/src/renderer/shared/components/{ScheduledTasksView.tsx → extensions/ScheduledTasksView.tsx} +5 -5
- package/src/renderer/shared/components/extensions/SkillsView.test.tsx +31 -0
- package/src/renderer/shared/components/{SkillsView.tsx → extensions/SkillsView.tsx} +20 -4
- package/src/renderer/shared/components/{ImageStudioPanel.tsx → studio/ImageStudioPanel.tsx} +6 -6
- package/src/renderer/shared/components/{LibraryItemCard.tsx → studio/LibraryItemCard.tsx} +2 -2
- package/src/renderer/shared/components/{LibraryPage.tsx → studio/LibraryPage.tsx} +53 -10
- package/src/renderer/shared/components/{LibraryPreview.tsx → studio/LibraryPreview.tsx} +2 -2
- package/src/renderer/shared/components/{VeoStudioPanel.tsx → studio/VeoStudioPanel.tsx} +7 -7
- package/src/renderer/shared/components/{GlideSelect.css → ui/GlideSelect.css} +7 -6
- package/src/renderer/shared/components/ui/ProviderBrandIcon.test.tsx +67 -0
- package/src/renderer/shared/components/ui/ProviderBrandIcon.tsx +167 -0
- package/src/renderer/shared/components/ui/SelectField.tsx +506 -0
- package/src/renderer/shared/components/ui/error-recovery.css +10 -10
- package/src/renderer/shared/components/ui/error-recovery.tsx +1 -1
- package/src/renderer/shared/components/{ArtifactPreviewPanel.tsx → workspace/ArtifactPreviewPanel.tsx} +374 -118
- package/src/renderer/shared/components/workspace/BackgroundTerminals.test.tsx +63 -0
- package/src/renderer/shared/components/{BackgroundTerminals.tsx → workspace/BackgroundTerminals.tsx} +40 -9
- package/src/renderer/shared/components/workspace/CodeReviewPage.test.tsx +50 -0
- package/src/renderer/shared/components/{CodeReviewPage.tsx → workspace/CodeReviewPage.tsx} +124 -24
- package/src/renderer/shared/components/{GitBranchSelector.tsx → workspace/GitBranchSelector.tsx} +80 -24
- package/src/renderer/shared/components/workspace/SessionSources.tsx +113 -0
- package/src/renderer/shared/components/{TerminalDock.tsx → workspace/TerminalDock.tsx} +5 -2
- package/src/renderer/shared/components/workspace/ToolSurfacePage.test.tsx +81 -0
- package/src/renderer/shared/components/{ToolSurfacePage.tsx → workspace/ToolSurfacePage.tsx} +361 -90
- package/src/renderer/shared/components/{ToolsPanelToggle.tsx → workspace/ToolsPanelToggle.tsx} +1 -1
- package/src/renderer/shared/components/workspace/WorkspaceFileInfo.tsx +28 -0
- package/src/renderer/shared/components/workspace/WorkspaceMediaPreview.tsx +17 -0
- package/src/renderer/shared/components/{WorkspacePaneResizer.tsx → workspace/WorkspacePaneResizer.tsx} +1 -1
- package/src/renderer/shared/components/workspace/WorkspacePdfPreview.tsx +308 -0
- package/src/renderer/shared/components/workspace/WorkspacePreviewActions.test.tsx +101 -0
- package/src/renderer/shared/components/{WorkspacePreviewActions.tsx → workspace/WorkspacePreviewActions.tsx} +3 -3
- package/src/renderer/shared/components/{WorkspaceSelector.tsx → workspace/WorkspaceSelector.tsx} +99 -7
- package/src/renderer/shared/components/{background-terminals.css → workspace/background-terminals.css} +11 -11
- package/src/renderer/shared/components/{workspace-selector.css → workspace/workspace-selector.css} +84 -2
- package/src/renderer/shared/constants/config.ts +6 -3
- package/src/renderer/shared/constants/models.test.ts +51 -0
- package/src/renderer/shared/constants/models.ts +139 -32
- package/src/renderer/shared/conversation/coordinator.test.ts +46 -0
- package/src/renderer/shared/conversation/coordinator.ts +50 -2
- package/src/renderer/shared/conversation/lifecycle.test.ts +254 -4
- package/src/renderer/shared/conversation/lifecycle.ts +268 -12
- package/src/renderer/shared/conversation/progressiveStream.test.ts +83 -0
- package/src/renderer/shared/conversation/progressiveStream.ts +219 -0
- package/src/renderer/shared/conversation/projectNavigation.test.ts +18 -0
- package/src/renderer/shared/conversation/projectNavigation.ts +11 -0
- package/src/renderer/shared/conversation/transport.test.ts +20 -0
- package/src/renderer/shared/conversation/transport.ts +51 -9
- package/src/renderer/shared/conversation/useConversationCoordinator.ts +42 -12
- package/src/renderer/shared/css/agent-observability.css +205 -11
- package/src/renderer/shared/css/chat-ui-cards.css +48 -48
- package/src/renderer/shared/css/code-review.css +139 -110
- package/src/renderer/shared/css/code-sessions.css +56 -27
- 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 +298 -51
- package/src/renderer/shared/css/library.css +105 -10
- package/src/renderer/shared/css/management-views.css +79 -38
- package/src/renderer/shared/css/mcp-results.css +48 -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 +221 -0
- package/src/renderer/shared/css/session-sources.css +12 -7
- package/src/renderer/shared/css/settings/agents.css +2 -2
- package/src/renderer/{src → shared}/css/settings/base.css +101 -107
- package/src/renderer/shared/css/settings/general.css +397 -100
- package/src/renderer/shared/css/settings/plugins.css +8 -8
- package/src/renderer/shared/css/settings/profile.css +5 -5
- package/src/renderer/shared/css/settings/theme.css +49 -37
- 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 +10 -2
- package/src/renderer/shared/css/veo-studio.css +2 -2
- package/src/renderer/shared/css/viewed-images.css +93 -4
- package/src/renderer/shared/css/workspace-file-info.css +12 -0
- package/src/renderer/shared/css/workspace-media-preview.css +13 -0
- package/src/renderer/shared/env.d.ts +9 -0
- package/src/renderer/shared/platform.test.ts +143 -0
- package/src/renderer/shared/platform.ts +12 -5
- package/src/renderer/shared/speech/player.ts +160 -0
- package/src/renderer/shared/speech/types.ts +11 -0
- package/src/renderer/shared/theme/themeManager.test.ts +37 -0
- package/src/renderer/shared/theme/themeManager.ts +24 -5
- package/src/renderer/shared/theme/themes.ts +71 -4
- package/src/renderer/shared/theme/tokens.css +452 -53
- package/src/renderer/shared/types.ts +57 -2
- package/src/renderer/shared/utils/agentActivity.test.ts +633 -8
- package/src/renderer/shared/utils/agentActivity.ts +776 -59
- package/src/renderer/shared/utils/artifactBrowser.test.ts +37 -32
- package/src/renderer/shared/utils/artifactBrowser.ts +18 -20
- package/src/renderer/shared/utils/artifacts.ts +55 -0
- package/src/renderer/shared/utils/attachedDocument.test.ts +73 -0
- package/src/renderer/shared/utils/attachedDocument.ts +49 -0
- package/src/renderer/shared/utils/contextCompaction.test.tsx +1 -1
- package/src/renderer/shared/utils/externalLinks.ts +91 -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/lazyWithRetry.ts +13 -0
- package/src/renderer/shared/utils/markdown.tsx +238 -51
- package/src/renderer/shared/utils/markdown.webImages.test.tsx +140 -2
- package/src/renderer/shared/utils/mcpResults.test.tsx +53 -1
- package/src/renderer/shared/utils/pdfRange.ts +16 -0
- package/src/renderer/shared/utils/previewObjectUrls.ts +20 -0
- package/src/renderer/shared/utils/sessionSources.test.ts +41 -1
- package/src/renderer/shared/utils/sessionSources.ts +2 -0
- package/src/renderer/shared/utils/slashCommandProcessor.ts +7 -1
- package/src/renderer/shared/utils/speech.ts +18 -4
- 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/useNativeVoiceInput.ts +19 -5
- package/src/renderer/shared/utils/useSessionSources.ts +4 -0
- package/src/renderer/shared/utils/viewedImages.test.ts +129 -0
- package/src/renderer/shared/utils/viewedImages.ts +81 -10
- package/src/renderer/shared/utils/workspaceDrag.test.ts +153 -0
- package/src/renderer/shared/utils/workspaceDrag.ts +172 -0
- package/src/renderer/shared/utils/workspaceImage.ts +17 -0
- package/src/renderer/shared/utils/workspaceListPreferences.test.ts +64 -0
- package/src/renderer/shared/utils/workspaceListPreferences.ts +54 -0
- package/src/renderer/shared/utils/workspaceMedia.ts +49 -0
- package/src/renderer/shared/utils/workspacePreview.test.ts +147 -2
- package/src/renderer/shared/utils/workspacePreview.ts +34 -3
- package/src/renderer/shared/utils/workspaces.ts +3 -2
- package/src/renderer/src/App.tsx +20 -16
- package/src/renderer/src/agentProgress.ts +1 -0
- package/src/renderer/src/components/ChatPanel.tsx +1 -1
- package/src/renderer/src/components/DashboardSidebar.tsx +2 -2
- package/src/renderer/src/components/ImageStudioPanel.tsx +1 -1
- package/src/renderer/src/components/LiveTranslateControls.tsx +1 -1
- package/src/renderer/src/components/MintDashboard.tsx +1 -1
- package/src/renderer/src/components/ProactiveGlow.tsx +1 -1
- package/src/renderer/src/components/ScreenPicker.css +1 -1
- package/src/renderer/src/components/ScreenPicker.tsx +1 -1
- package/src/renderer/src/components/SettingsWindow.tsx +6 -830
- package/src/renderer/src/components/SpotlightWindow.tsx +4 -32
- package/src/renderer/src/components/VeoStudioPanel.tsx +1 -1
- package/src/renderer/src/components/WorkspacePanel.tsx +49 -15
- package/src/renderer/src/components/browser-suggestions-popup.css +8 -8
- package/src/renderer/src/css/app-shell.css +26 -106
- package/src/renderer/src/css/chat.css +1499 -292
- package/src/renderer/src/css/desktop-tools.css +17 -348
- package/src/renderer/src/css/sidebar-workspace.css +22 -2
- package/src/renderer/src/css/spotlight.css +2 -2
- package/src/renderer/src/css/tool-surfaces.css +335 -65
- package/src/renderer/src/css/widget.css +6 -5
- package/src/renderer/src/env.d.ts +13 -0
- package/src/renderer/src/index.css +53 -83
- package/src/renderer/src/tauri.ts +99 -13
- package/src/renderer/src/voiceInput.ts +3 -1
- package/src/renderer/src-web/App.tsx +20 -8
- package/src/renderer/src-web/agentProgress.ts +1 -0
- package/src/renderer/src-web/components/ChatPanel.tsx +1 -1
- package/src/renderer/src-web/components/DashboardSidebar.tsx +2 -2
- package/src/renderer/src-web/components/ImageStudioPanel.tsx +1 -1
- package/src/renderer/src-web/components/MintDashboard.tsx +1 -1
- package/src/renderer/src-web/components/SettingsWindow.tsx +6 -851
- package/src/renderer/src-web/components/VeoStudioPanel.tsx +1 -1
- package/src/renderer/src-web/css/app-shell.css +20 -104
- package/src/renderer/src-web/css/chat.css +1536 -261
- 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 +21 -1
- package/src/renderer/src-web/env.d.ts +14 -0
- package/src/renderer/src-web/index.css +53 -83
- package/src/renderer/src-web/tauri.ts +93 -15
- package/src/renderer/tests/browserArtifacts.browser.html +1 -0
- package/src/renderer/tests/browserArtifacts.browser.tsx +68 -0
- package/src/renderer/tests/chatEscape.browser.html +1 -0
- package/src/renderer/tests/chatEscape.browser.tsx +25 -0
- package/src/renderer/tests/chatPerformance.browser.html +1 -1
- package/src/renderer/tests/collapsedPaste.browser.html +1 -1
- package/src/renderer/tests/composerMenus.browser.html +3 -3
- package/src/renderer/tests/contextCompaction.browser.html +1 -1
- package/src/renderer/tests/errorRecovery.browser.html +1 -1
- package/src/renderer/tests/fixtures/preview.webm +0 -0
- package/src/renderer/tests/glideSelect.browser.html +1 -2
- package/src/renderer/tests/glideSelect.preview.html +1 -1
- package/src/renderer/tests/library.browser.tsx +4 -1
- package/src/renderer/tests/liveOrb.browser.html +1 -1
- package/src/renderer/tests/liveVoice.browser.html +1 -0
- package/src/renderer/tests/mediaFixtures.ts +32 -0
- package/src/renderer/tests/modInput.browser.html +1 -1
- package/src/renderer/tests/sessionSources.browser.tsx +76 -15
- package/src/renderer/tests/toolsPanel.browser.tsx +5 -5
- package/src/renderer/tests/viewedImages.browser.tsx +3 -3
- package/src/renderer/tests/voiceDictation.browser.html +101 -0
- package/src/renderer/tests/voicePill.browser.html +3 -3
- package/src/renderer/tests/voicePill.preview.html +1 -1
- package/src/renderer/tests/webSources.browser.tsx +2 -98
- package/src/renderer/tests/workspaceDrop.browser.html +1 -0
- package/src/renderer/tests/workspaceDrop.browser.tsx +183 -0
- package/src/renderer/tests/workspaceExpansion.browser.html +1 -0
- package/src/renderer/tests/workspaceExpansion.browser.tsx +66 -0
- package/src/renderer/tests/workspaceRemoval.browser.html +66 -0
- package/src/renderer/tests/workspaceUndo.browser.html +10 -2
- package/src-tauri/src/app/lifecycle.rs +45 -15
- package/src-tauri/src/background/headless.rs +14 -8
- package/src-tauri/src/commands/conversation.rs +137 -73
- package/src-tauri/src/commands/integrations.rs +7 -1
- package/src-tauri/src/commands/media.rs +7 -0
- package/src-tauri/src/commands/workspace.rs +38 -0
- package/src-tauri/src/native/mod.rs +0 -1
- package/src-tauri/src/native/system.rs +4 -47
- package/tsconfig.json +15 -1
- package/vite.config.ts +2 -1
- package/vite.config.web.ts +2 -0
- package/crates/mint-cli/src/interactive/chat_tui.rs +0 -7853
- package/crates/mint-core/src/agent/chat.rs +0 -4155
- package/crates/mint-core/src/browser/lifecycle.rs +0 -191
- 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/CliSessionsView-CtzUJpK_.css +0 -1
- package/out/web/assets/CliSessionsView-D7hw0Mgj.js +0 -1
- package/out/web/assets/CodeReviewPage-C7bEOJfd.js +0 -4
- package/out/web/assets/CodeReviewPage-Dte9uLiL.css +0 -1
- package/out/web/assets/CommandPalette-0RrF-AOT.js +0 -1
- package/out/web/assets/ImageStudioPanel-CdxkAf_r.js +0 -1
- package/out/web/assets/LibraryPage--Qfisp6D.js +0 -2
- package/out/web/assets/LibraryPage-DAxUTAg7.css +0 -1
- package/out/web/assets/LinkedFoldersView-2nfZbDgN.js +0 -1
- package/out/web/assets/McpRegistryPicker-h9uS8_wT.js +0 -1
- package/out/web/assets/McpServersView-slfQJzNB.js +0 -1
- package/out/web/assets/MintDashboard-BSR5XpXh.js +0 -25
- package/out/web/assets/MintDashboard-CWUcCGhd.css +0 -1
- package/out/web/assets/PluginsView-l7LSm503.js +0 -1
- package/out/web/assets/ScheduledTasksView-CttmLbq1.js +0 -1
- package/out/web/assets/SettingsWindow-BCMLYvEV.js +0 -4
- package/out/web/assets/SettingsWindow-DcMVmU9u.css +0 -1
- package/out/web/assets/SkillsView-rNs1qr_U.js +0 -2
- package/out/web/assets/ToolSurfacePage-B9DzEPWN.js +0 -37
- package/out/web/assets/ToolSurfacePage-CTfgggF2.css +0 -1
- package/out/web/assets/VeoStudioPanel-DiJs_Cg2.js +0 -4
- package/out/web/assets/WorkspacePanel-CbJ1PFoZ.js +0 -1
- package/out/web/assets/WorkspaceSelector-B2xIp04D.js +0 -1
- package/out/web/assets/WorkspaceSelector-Ca8uJOsS.css +0 -1
- package/out/web/assets/abnfDiagram-VCTEODGH-CD0CjoGl.js +0 -1
- package/out/web/assets/architecture-7GRP2DOG-RKV83OeZ.js +0 -1
- package/out/web/assets/architectureDiagram-5GKGNRK7-nN_HAFct.js +0 -36
- package/out/web/assets/c4Diagram-UCG6FXSJ-DTdV8_zE.js +0 -38
- package/out/web/assets/chunk-2Q5K7J3B-Dmqrq8Tp.js +0 -1
- package/out/web/assets/chunk-75Z2AOVW-_M0z5olV.js +0 -2
- package/out/web/assets/chunk-CKBBP62Z-BpQEgeHF.js +0 -2
- package/out/web/assets/chunk-CLGD4ZFX-D54yGvGS.js +0 -1
- package/out/web/assets/chunk-CacB07dV.js +0 -1
- package/out/web/assets/chunk-DSNCTWBM-C-gvT2ru.js +0 -2
- package/out/web/assets/chunk-DU6HZSFF-CnFngIhW.js +0 -128
- package/out/web/assets/chunk-F27PBJKO-BqtWrnEO.js +0 -1
- package/out/web/assets/chunk-FOHPRMQF-BaVC1uA7.js +0 -161
- package/out/web/assets/chunk-G27WJ6UU-Ckoq5mi2.js +0 -231
- package/out/web/assets/chunk-JQ64N6SF-CF8T7GiZ.js +0 -1
- package/out/web/assets/chunk-JWPE2WC7-BwtYOHqU.js +0 -1
- package/out/web/assets/chunk-LNGE3PJU-AdBoOWw2.js +0 -34
- package/out/web/assets/chunk-OBVCFTLP-CRIkunUB.js +0 -1
- package/out/web/assets/chunk-P2QGCYS3-UFEU6BxZ.js +0 -1
- package/out/web/assets/chunk-POPQ4Y6H-CQcrNbjr.js +0 -1
- package/out/web/assets/chunk-PWAF6VOD-Cc2uVDsG.js +0 -1
- package/out/web/assets/chunk-R7TYR2AO-DiCxzdAY.js +0 -10
- package/out/web/assets/chunk-RHFEMEQ7-b7hnPmrR.js +0 -168
- package/out/web/assets/chunk-XXDRQBXY-DnJkbUaw.js +0 -1
- package/out/web/assets/chunk-Y2CYZVJY-C9o-s6OY.js +0 -1
- package/out/web/assets/classDiagram-DTDB5LWJ-RnC2mYO4.js +0 -1
- package/out/web/assets/classDiagram-v2-JRS7N3AN-RnC2mYO4.js +0 -1
- package/out/web/assets/config-CnvCChUM.js +0 -2
- package/out/web/assets/config-DM6oIVO3.css +0 -1
- package/out/web/assets/core-DsKkQ7ig.js +0 -1
- package/out/web/assets/cose-bilkent-JH36ORCC--UN4aw5-.js +0 -1
- package/out/web/assets/cynefin-OW5HDTMX-CnzQfOGp.js +0 -1
- package/out/web/assets/cynefinDiagram-5FMLGOSQ-DVtQnfpm.js +0 -62
- package/out/web/assets/cytoscape.esm-Df1UN4Y1.js +0 -321
- package/out/web/assets/dagre-3AP2YEHR-DG76_k5_.js +0 -4
- package/out/web/assets/dagre-BWadQu2F.js +0 -1
- package/out/web/assets/diagram-S7CK7UJ4-CaouUoze.js +0 -30
- package/out/web/assets/diagram-UQ7AKVKN-B4bEc26B.js +0 -41
- package/out/web/assets/diagram-VX7I27RA-7hH5IPYf.js +0 -24
- package/out/web/assets/diagram-Z3DM3KII-CCM4clo8.js +0 -24
- package/out/web/assets/dist-BoTOASLF.js +0 -1
- package/out/web/assets/dist-js-BkYNznHX.js +0 -1
- package/out/web/assets/ebnfDiagram-PWID7BFC-Da7WAM3k.js +0 -1
- package/out/web/assets/event-Cdt7Byyj.js +0 -1
- package/out/web/assets/eventmodeling-NTZA5JFV-xcfsA0XD.js +0 -1
- package/out/web/assets/flowDiagram-A5DVABFB-JdtH1673.js +0 -1
- package/out/web/assets/ganttDiagram-EL5Y4UJY-B3ClFGmL.js +0 -292
- package/out/web/assets/gitGraph-4MIJSDKK-BZ_y_cDU.js +0 -1
- package/out/web/assets/gitGraphDiagram-WWUBYQGX-drhRSYm3.js +0 -106
- package/out/web/assets/graphlib-CTR5ZhLf.js +0 -1
- package/out/web/assets/index-BZ9xgmMP.css +0 -1
- package/out/web/assets/index-Ca8cCS4h.js +0 -168
- package/out/web/assets/info-A6RAGUB7-B7I3K0F1.js +0 -1
- package/out/web/assets/infoDiagram-RXCK75RN-deX_1MPh.js +0 -2
- package/out/web/assets/journeyDiagram-EYS64GPL-CZn2kB8b.js +0 -139
- package/out/web/assets/jsx-runtime-DN4NhQUK.js +0 -1
- package/out/web/assets/katex-O3jvqgnU.js +0 -257
- package/out/web/assets/markdown-CMhYIcWB.js +0 -39
- package/out/web/assets/mermaid-parser.core-Whu2rlJC.js +0 -7
- package/out/web/assets/mermaid.core-CKyPo8VH.js +0 -11
- package/out/web/assets/modelManager-CUaGWMWu.js +0 -2
- package/out/web/assets/oauthManager-DlNhXJr6.js +0 -1
- package/out/web/assets/packet-AYTQ26CC-CEeIRKRG.js +0 -1
- package/out/web/assets/pegDiagram-XKGWAZYB-BYadI-KO.js +0 -1
- package/out/web/assets/pie-WAS4IAKB-D8uf4dh5.js +0 -1
- package/out/web/assets/pieDiagram-E7YTZNPT-CjSDy4hO.js +0 -39
- package/out/web/assets/radar-RG4KPBEZ-DZJxnokY.js +0 -1
- package/out/web/assets/railroad-74A4TZTK-DBysUiUi.js +0 -1
- package/out/web/assets/railroad-abnf-HS5TGJTU-CHWxoJYg.js +0 -1
- package/out/web/assets/railroad-ebnf-LZEXJU2U-DDv7X6bY.js +0 -1
- package/out/web/assets/railroad-peg-WCYAUIDC-DpfcYYNJ.js +0 -1
- package/out/web/assets/railroadDiagram-O6MQD6OU-CYtyv0t3.js +0 -1
- package/out/web/assets/rough.esm-DFbTUy8a.js +0 -1
- package/out/web/assets/sankeyDiagram-P5KCCOFB-Bn2x6C4Y.js +0 -40
- package/out/web/assets/sequenceDiagram-WJ2MYXX4-BvFLKtPd.js +0 -162
- package/out/web/assets/sizeCapture-X5ZJPWSS-DKeOCaN2.js +0 -1
- package/out/web/assets/src-DnfeXQPr.js +0 -1
- package/out/web/assets/stateDiagram-HBIQ2CUA-Bx0GWeaY.js +0 -1
- package/out/web/assets/stateDiagram-v2-4QOOHH4V--hol1yg_.js +0 -1
- package/out/web/assets/studio-B1mk40wD.js +0 -1
- package/out/web/assets/swimlanes-XN3QIQJK-CCma0T7L.js +0 -1
- package/out/web/assets/swimlanesDiagram-VK2B7HYN-BkohoVsU.js +0 -8
- package/out/web/assets/timeline-definition-24CTP7MA-iCRhhJ7C.js +0 -120
- package/out/web/assets/treeView-Q6P3EWNA-DZ-y08qp.js +0 -1
- package/out/web/assets/treemap-WGGIJYW6-De0CxzMx.js +0 -1
- package/out/web/assets/vennDiagram-4TSXK5OY-w_7aZ6xe.js +0 -34
- package/out/web/assets/wardley-WFR3VGLG-DT0y0xJ4.js +0 -1
- package/out/web/assets/window-BJCVtyET.js +0 -1
- 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/shared/components/AgentActivityDrawer.tsx +0 -204
- package/src/renderer/shared/components/AgentActivityTable.tsx +0 -301
- package/src/renderer/shared/components/ChatMessageItem.test.tsx +0 -68
- package/src/renderer/shared/components/ChatMessageItem.tsx +0 -326
- package/src/renderer/shared/components/ChatPanel.test.tsx +0 -21
- package/src/renderer/shared/components/FormattedMessage.tsx +0 -11
- package/src/renderer/shared/components/GeminiLiveOverlay.test.tsx +0 -24
- package/src/renderer/shared/components/GlideSelect.d.ts +0 -31
- package/src/renderer/shared/components/GlideSelect.jsx +0 -266
- package/src/renderer/shared/components/InlineThoughtNote.tsx +0 -27
- package/src/renderer/shared/components/ModSessionControls.tsx +0 -8
- package/src/renderer/shared/components/ModUi.tsx +0 -26
- package/src/renderer/shared/components/ProgressActivity.tsx +0 -17
- package/src/renderer/shared/components/ReviewHistory.tsx +0 -42
- package/src/renderer/shared/components/RunSummaryDashboard.tsx +0 -143
- package/src/renderer/shared/components/SelectField.tsx +0 -38
- package/src/renderer/shared/components/SessionSources.tsx +0 -48
- package/src/renderer/shared/components/SessionSourcesPopover.tsx +0 -61
- package/src/renderer/shared/components/ToolSurfacePage.test.tsx +0 -32
- package/src/renderer/shared/components/ViewedImages.tsx +0 -36
- package/src/renderer/shared/components/WorkspaceContextPopover.tsx +0 -138
- package/src/renderer/shared/components/WorkspacePreviewActions.test.tsx +0 -44
- package/src/renderer/shared/components/ui/demo.tsx +0 -26
- package/src/renderer/shared/css/session-sources-popover.css +0 -9
- package/src/renderer/src/components/BrowserShell.tsx +0 -108
- package/src/renderer/src/components/BrowserSuggestionsPopup.tsx +0 -91
- package/src/renderer/src/components/CalculationCard.tsx +0 -3
- package/src/renderer/src/components/ImageGenCard.tsx +0 -2
- package/src/renderer/src/components/ImageSearchCard.tsx +0 -2
- package/src/renderer/src/components/MermaidCard.tsx +0 -1
- package/src/renderer/src/components/PicturesLibrary.tsx +0 -2
- package/src/renderer/src/components/Settings/AgentsTab.tsx +0 -4
- package/src/renderer/src/components/Settings/AudioTab.tsx +0 -3
- package/src/renderer/src/components/Settings/AutomationTab.tsx +0 -3
- package/src/renderer/src/components/Settings/GeneralTab.tsx +0 -3
- package/src/renderer/src/components/Settings/MemoryTab.tsx +0 -3
- package/src/renderer/src/components/Settings/PluginsTab.tsx +0 -3
- package/src/renderer/src/components/Settings/ProfileTab.tsx +0 -3
- package/src/renderer/src/components/Settings/ShortcutsTab.tsx +0 -3
- package/src/renderer/src/components/Settings/ThemeTab.tsx +0 -3
- package/src/renderer/src/components/StockCard.tsx +0 -3
- package/src/renderer/src/components/WeatherCard.tsx +0 -3
- package/src/renderer/src/components/browser-shell.css +0 -185
- package/src/renderer/src/css/pictures.css +0 -2
- package/src/renderer/src-web/components/PicturesLibrary.tsx +0 -2
- package/src/renderer/src-web/components/Settings/AgentsTab.tsx +0 -4
- package/src/renderer/src-web/components/Settings/AudioTab.tsx +0 -3
- package/src/renderer/src-web/components/Settings/AutomationTab.tsx +0 -3
- package/src/renderer/src-web/components/Settings/GeneralTab.tsx +0 -3
- package/src/renderer/src-web/components/Settings/MemoryTab.tsx +0 -3
- package/src/renderer/src-web/components/Settings/PluginsTab.tsx +0 -3
- package/src/renderer/src-web/components/Settings/ProfileTab.tsx +0 -3
- package/src/renderer/src-web/components/Settings/ShortcutsTab.tsx +0 -3
- package/src/renderer/src-web/components/Settings/ThemeTab.tsx +0 -3
- package/src/renderer/src-web/css/pictures.css +0 -2
- package/src/renderer/src-web/css/settings/base.css +0 -1266
- package/src/renderer/src-web/css/spotlight.css +0 -102
- package/src/renderer/src-web/css/widget.css +0 -213
- package/src-tauri/src/native/browser.rs +0 -252
- /package/src/renderer/shared/components/{ContextCompactionStatus.tsx → chat/ContextCompactionStatus.tsx} +0 -0
- /package/src/renderer/shared/components/{GeminiLiveOverlay.css → chat/GeminiLiveOverlay.css} +0 -0
- /package/src/renderer/shared/components/{VirtualChatHistory.tsx → chat/VirtualChatHistory.tsx} +0 -0
- /package/src/renderer/shared/components/{VoicePill.d.ts → chat/VoicePill.d.ts} +0 -0
- /package/src/renderer/shared/components/{VoicePill.test.tsx → chat/VoicePill.test.tsx} +0 -0
- /package/src/renderer/shared/components/{ScreenCaptureDialog.css → studio/ScreenCaptureDialog.css} +0 -0
- /package/src/renderer/shared/components/{ScreenCaptureDialog.tsx → studio/ScreenCaptureDialog.tsx} +0 -0
- /package/src/renderer/shared/components/{SelectField.test.tsx → ui/SelectField.test.tsx} +0 -0
|
@@ -0,0 +1,1427 @@
|
|
|
1
|
+
//! Full-screen adapter for interactive chat.
|
|
2
|
+
use super::{
|
|
3
|
+
InteractiveInput, InteractiveSession, active_model, format, format_provider_display_name,
|
|
4
|
+
format_thought_elapsed, format_workspace_with_branch, tool_activity,
|
|
5
|
+
};
|
|
6
|
+
use anyhow::{Result, bail};
|
|
7
|
+
use base64::{Engine as _, engine::general_purpose::STANDARD as BASE64};
|
|
8
|
+
use crossterm::{ExecutableCommand, event, terminal};
|
|
9
|
+
use ratatui::{
|
|
10
|
+
Terminal,
|
|
11
|
+
backend::CrosstermBackend,
|
|
12
|
+
buffer::Buffer,
|
|
13
|
+
layout::{Constraint, Direction, Layout, Position, Rect},
|
|
14
|
+
style::{Color, Modifier, Style},
|
|
15
|
+
text::{Line, Span, Text},
|
|
16
|
+
widgets::{
|
|
17
|
+
Block, BorderType, Borders, Paragraph, Scrollbar, ScrollbarOrientation, ScrollbarState,
|
|
18
|
+
Wrap,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
use std::io::{self, Write};
|
|
22
|
+
use std::path::Path;
|
|
23
|
+
use std::sync::{
|
|
24
|
+
Arc, Mutex,
|
|
25
|
+
atomic::{AtomicBool, Ordering},
|
|
26
|
+
mpsc,
|
|
27
|
+
};
|
|
28
|
+
use unicode_width::UnicodeWidthStr;
|
|
29
|
+
|
|
30
|
+
use super::composer::normalize_prompt_newlines;
|
|
31
|
+
|
|
32
|
+
mod dialog;
|
|
33
|
+
mod render;
|
|
34
|
+
mod selection;
|
|
35
|
+
mod state;
|
|
36
|
+
mod thought;
|
|
37
|
+
mod transcript;
|
|
38
|
+
mod watermark;
|
|
39
|
+
|
|
40
|
+
#[cfg(test)]
|
|
41
|
+
mod tests;
|
|
42
|
+
|
|
43
|
+
#[cfg(test)]
|
|
44
|
+
pub(crate) use self::state::SwarmAgentUiState;
|
|
45
|
+
pub(crate) use self::{
|
|
46
|
+
dialog::{DialogAnswer, DialogState},
|
|
47
|
+
state::{ChatViewState, SwarmUiStatus, TuiHandle},
|
|
48
|
+
thought::ThoughtModalState,
|
|
49
|
+
transcript::{TranscriptEntry, TranscriptRole},
|
|
50
|
+
};
|
|
51
|
+
use self::{
|
|
52
|
+
dialog::{resume_picker_lines, theme_picker_lines},
|
|
53
|
+
render::{RenderAreas, mod_layout},
|
|
54
|
+
selection::{
|
|
55
|
+
CopyMethod, MouseSelection, ScreenPoint, TextClipboard, TranscriptSelection,
|
|
56
|
+
apply_mouse_selection, input_index_at, selected_cells_match, selected_screen_text,
|
|
57
|
+
},
|
|
58
|
+
state::clip_text,
|
|
59
|
+
thought::{ThinkingSegment, shimmer_thinking_line, thought_tail},
|
|
60
|
+
transcript::{TranscriptLayout, highlighted_user_content},
|
|
61
|
+
watermark::{WATERMARK_HEIGHT, WATERMARK_WIDTH, mint_m_watermark, watermark_animation_at},
|
|
62
|
+
};
|
|
63
|
+
#[cfg(test)]
|
|
64
|
+
use self::{selection::NativeClipboard, watermark::WATERMARK_FRAME_COUNT};
|
|
65
|
+
use super::composer::{
|
|
66
|
+
CollapsedPaste, input_row_start, match_composer_suggestions, wrap_input_visual_into_rows,
|
|
67
|
+
};
|
|
68
|
+
use super::resume_picker::ResumePickerCore;
|
|
69
|
+
|
|
70
|
+
fn format_thinking_status(config: &mint_core::MintConfig) -> String {
|
|
71
|
+
let model = active_model(&config.ai_provider, config);
|
|
72
|
+
if !config.resolved_thinking_enabled_for_model(&config.ai_provider, model) {
|
|
73
|
+
return "off".to_string();
|
|
74
|
+
}
|
|
75
|
+
match config.resolved_thinking_effort_for_model(model) {
|
|
76
|
+
"extra_high" => "extra high".to_string(),
|
|
77
|
+
effort => effort.to_string(),
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const MIN_WIDTH: u16 = 60;
|
|
82
|
+
const MIN_HEIGHT: u16 = 12;
|
|
83
|
+
const COPY_LIMIT: usize = 100 * 1024;
|
|
84
|
+
const BACK_TO_BOTTOM_LABEL: &str = " ↓ Back to bottom · End ";
|
|
85
|
+
|
|
86
|
+
pub(crate) struct ChatTui {
|
|
87
|
+
terminal: Terminal<CrosstermBackend<io::Stdout>>,
|
|
88
|
+
active: bool,
|
|
89
|
+
mouse_selection: MouseSelection,
|
|
90
|
+
transcript_selection: Option<TranscriptSelection>,
|
|
91
|
+
transcript_area: Option<Rect>,
|
|
92
|
+
selection_scroll_at: std::time::Instant,
|
|
93
|
+
last_frame: Option<Buffer>,
|
|
94
|
+
back_to_bottom_area: Option<Rect>,
|
|
95
|
+
composer_area: Option<Rect>,
|
|
96
|
+
watermark_area: Option<Rect>,
|
|
97
|
+
clipboard: TextClipboard,
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
fn route_mouse_wheel(
|
|
101
|
+
state: &mut ChatViewState,
|
|
102
|
+
kind: event::MouseEventKind,
|
|
103
|
+
point: Option<Position>,
|
|
104
|
+
transcript_area: Option<Rect>,
|
|
105
|
+
) {
|
|
106
|
+
let in_transcript = match (point, transcript_area) {
|
|
107
|
+
(Some(pt), Some(area)) => area.contains(pt),
|
|
108
|
+
_ => false,
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
if !in_transcript {
|
|
112
|
+
if let Some(dialog) = state.dialog.as_mut() {
|
|
113
|
+
if dialog.body_max_scroll.get() > 0 {
|
|
114
|
+
match kind {
|
|
115
|
+
event::MouseEventKind::ScrollUp => {
|
|
116
|
+
dialog.body_scroll = dialog
|
|
117
|
+
.body_scroll
|
|
118
|
+
.min(dialog.body_max_scroll.get())
|
|
119
|
+
.saturating_sub(3);
|
|
120
|
+
}
|
|
121
|
+
event::MouseEventKind::ScrollDown => {
|
|
122
|
+
dialog.body_scroll = dialog
|
|
123
|
+
.body_scroll
|
|
124
|
+
.saturating_add(3)
|
|
125
|
+
.min(dialog.body_max_scroll.get());
|
|
126
|
+
}
|
|
127
|
+
_ => {}
|
|
128
|
+
}
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
match kind {
|
|
134
|
+
event::MouseEventKind::ScrollUp => {
|
|
135
|
+
if let Some(modal) = state.thought_modal.as_mut() {
|
|
136
|
+
modal.scroll = modal.scroll.saturating_sub(3);
|
|
137
|
+
} else {
|
|
138
|
+
state.scroll_from_bottom = state.scroll_from_bottom.saturating_add(3);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
event::MouseEventKind::ScrollDown => {
|
|
142
|
+
if let Some(modal) = state.thought_modal.as_mut() {
|
|
143
|
+
modal.scroll = modal.scroll.saturating_add(3);
|
|
144
|
+
} else {
|
|
145
|
+
state.scroll_from_bottom = state.scroll_from_bottom.saturating_sub(3);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
_ => {}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
fn activate_back_to_bottom(
|
|
153
|
+
state: &mut ChatViewState,
|
|
154
|
+
area: Option<Rect>,
|
|
155
|
+
kind: event::MouseEventKind,
|
|
156
|
+
point: ScreenPoint,
|
|
157
|
+
) -> bool {
|
|
158
|
+
if kind == event::MouseEventKind::Down(event::MouseButton::Left)
|
|
159
|
+
&& area.is_some_and(|area| area.contains(Position::new(point.column, point.row)))
|
|
160
|
+
{
|
|
161
|
+
state.scroll_from_bottom = 0;
|
|
162
|
+
true
|
|
163
|
+
} else {
|
|
164
|
+
false
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
fn setup_terminal_output<W: Write>(stdout: &mut W) -> io::Result<()> {
|
|
169
|
+
crossterm::execute!(
|
|
170
|
+
stdout,
|
|
171
|
+
terminal::EnterAlternateScreen,
|
|
172
|
+
// Mouse capture lets Mint distinguish wheel scrolling from physical
|
|
173
|
+
// Up/Down keys and powers Mint's own drag-to-copy selection layer.
|
|
174
|
+
event::EnableMouseCapture,
|
|
175
|
+
event::EnableBracketedPaste
|
|
176
|
+
)
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
pub(crate) fn restore_terminal() {
|
|
180
|
+
let mut stdout = io::stdout();
|
|
181
|
+
let _ = stdout.execute(event::DisableBracketedPaste);
|
|
182
|
+
let _ = stdout.execute(event::DisableMouseCapture);
|
|
183
|
+
let _ = stdout.execute(terminal::LeaveAlternateScreen);
|
|
184
|
+
let _ = terminal::disable_raw_mode();
|
|
185
|
+
}
|
|
186
|
+
impl ChatTui {
|
|
187
|
+
pub fn enter(workspace: &Path) -> Result<Self> {
|
|
188
|
+
use crossterm::tty::IsTty;
|
|
189
|
+
if !io::stdin().is_tty() || !io::stdout().is_tty() {
|
|
190
|
+
bail!("stdin/stdout is not a TTY");
|
|
191
|
+
}
|
|
192
|
+
let (w, h) = terminal::size()?;
|
|
193
|
+
if w < MIN_WIDTH || h < MIN_HEIGHT {
|
|
194
|
+
bail!("terminal is too small ({w}x{h}; need {MIN_WIDTH}x{MIN_HEIGHT})");
|
|
195
|
+
}
|
|
196
|
+
terminal::enable_raw_mode()?;
|
|
197
|
+
let mut stdout = io::stdout();
|
|
198
|
+
let workspace_name = workspace
|
|
199
|
+
.file_name()
|
|
200
|
+
.unwrap_or_else(|| workspace.as_os_str())
|
|
201
|
+
.to_string_lossy();
|
|
202
|
+
let workspace_name: String = workspace_name
|
|
203
|
+
.chars()
|
|
204
|
+
.map(|character| {
|
|
205
|
+
if character.is_control() {
|
|
206
|
+
' '
|
|
207
|
+
} else {
|
|
208
|
+
character
|
|
209
|
+
}
|
|
210
|
+
})
|
|
211
|
+
.collect();
|
|
212
|
+
let title = if workspace_name.trim().is_empty() {
|
|
213
|
+
"Mint Agent | workspace".to_owned()
|
|
214
|
+
} else {
|
|
215
|
+
format!("Mint Agent | {}", workspace_name.trim())
|
|
216
|
+
};
|
|
217
|
+
let setup = setup_terminal_output(&mut stdout);
|
|
218
|
+
if let Err(error) = setup {
|
|
219
|
+
restore_terminal();
|
|
220
|
+
return Err(error.into());
|
|
221
|
+
}
|
|
222
|
+
match Terminal::new(CrosstermBackend::new(stdout)) {
|
|
223
|
+
Ok(terminal) => {
|
|
224
|
+
let _ = io::stdout().execute(terminal::SetTitle(title));
|
|
225
|
+
Ok(Self {
|
|
226
|
+
terminal,
|
|
227
|
+
active: true,
|
|
228
|
+
mouse_selection: MouseSelection::default(),
|
|
229
|
+
transcript_selection: None,
|
|
230
|
+
transcript_area: None,
|
|
231
|
+
selection_scroll_at: std::time::Instant::now(),
|
|
232
|
+
last_frame: None,
|
|
233
|
+
back_to_bottom_area: None,
|
|
234
|
+
composer_area: None,
|
|
235
|
+
watermark_area: None,
|
|
236
|
+
clipboard: TextClipboard::default(),
|
|
237
|
+
})
|
|
238
|
+
}
|
|
239
|
+
Err(error) => {
|
|
240
|
+
restore_terminal();
|
|
241
|
+
Err(error.into())
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
pub(super) fn draw_state(&mut self, state: &ChatViewState) -> Result<()> {
|
|
246
|
+
let selection = self.mouse_selection;
|
|
247
|
+
let previous = self.last_frame.as_ref();
|
|
248
|
+
let mut transcript_selection = self.transcript_selection.as_mut();
|
|
249
|
+
let mut invalidated = false;
|
|
250
|
+
let mut areas = RenderAreas::default();
|
|
251
|
+
let completed = self.terminal.draw(|frame| {
|
|
252
|
+
areas = state.render(frame);
|
|
253
|
+
if selection.range().is_some() && state.active_notice().is_none() {
|
|
254
|
+
let area = frame.area();
|
|
255
|
+
let hint_area = Rect::new(area.x, area.bottom().saturating_sub(1), area.width, 1);
|
|
256
|
+
frame.render_widget(
|
|
257
|
+
Paragraph::new(Line::styled(
|
|
258
|
+
" Ctrl+C / right-click copy · Delete input · Esc clear",
|
|
259
|
+
Style::default().fg(crate::terminal_theme::MUTED),
|
|
260
|
+
)),
|
|
261
|
+
hint_area,
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
invalidated = transcript_selection.is_none()
|
|
265
|
+
&& !selection.dragging
|
|
266
|
+
&& selection.range().is_some()
|
|
267
|
+
&& previous
|
|
268
|
+
.map(|buffer| !selected_cells_match(buffer, frame.buffer_mut(), selection))
|
|
269
|
+
.unwrap_or(false);
|
|
270
|
+
if !invalidated {
|
|
271
|
+
if let Some(selected) = transcript_selection.as_deref_mut() {
|
|
272
|
+
if let Some(area) = areas
|
|
273
|
+
.transcript
|
|
274
|
+
.filter(|area| area.width > 0 && area.height > 0)
|
|
275
|
+
{
|
|
276
|
+
selected.area = area;
|
|
277
|
+
}
|
|
278
|
+
selected.paint(frame.buffer_mut(), areas.back_to_bottom);
|
|
279
|
+
} else {
|
|
280
|
+
apply_mouse_selection(frame.buffer_mut(), selection);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
crate::terminal_theme::apply_tui_theme(frame.buffer_mut(), state.theme);
|
|
284
|
+
})?;
|
|
285
|
+
self.last_frame = Some(completed.buffer.clone());
|
|
286
|
+
self.transcript_area = areas.transcript;
|
|
287
|
+
self.back_to_bottom_area = areas.back_to_bottom;
|
|
288
|
+
self.composer_area = areas.composer;
|
|
289
|
+
self.watermark_area = areas.watermark;
|
|
290
|
+
if invalidated {
|
|
291
|
+
self.clear_mouse_selection();
|
|
292
|
+
}
|
|
293
|
+
Ok(())
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
fn handle_selection_mouse(
|
|
297
|
+
&mut self,
|
|
298
|
+
mouse: event::MouseEvent,
|
|
299
|
+
state: &mut ChatViewState,
|
|
300
|
+
) -> Result<bool> {
|
|
301
|
+
use event::{MouseButton, MouseEventKind};
|
|
302
|
+
|
|
303
|
+
let point = ScreenPoint::from_mouse(mouse);
|
|
304
|
+
if activate_back_to_bottom(state, self.back_to_bottom_area, mouse.kind, point) {
|
|
305
|
+
self.clear_mouse_selection();
|
|
306
|
+
return Ok(true);
|
|
307
|
+
}
|
|
308
|
+
match mouse.kind {
|
|
309
|
+
MouseEventKind::Down(MouseButton::Left) => {
|
|
310
|
+
let inside_frame = self
|
|
311
|
+
.last_frame
|
|
312
|
+
.as_ref()
|
|
313
|
+
.map(|buffer| buffer.area.contains(Position::new(point.column, point.row)))
|
|
314
|
+
.unwrap_or(false);
|
|
315
|
+
if inside_frame {
|
|
316
|
+
self.clear_mouse_selection();
|
|
317
|
+
self.mouse_selection.start(point);
|
|
318
|
+
if let Some(area) = self.transcript_area.filter(|area| {
|
|
319
|
+
area.width > 0
|
|
320
|
+
&& area.height > 0
|
|
321
|
+
&& area.contains(Position::new(point.column, point.row))
|
|
322
|
+
}) && state.dialog.is_none()
|
|
323
|
+
&& state.thought_modal.is_none()
|
|
324
|
+
&& !state.transcript.is_empty()
|
|
325
|
+
{
|
|
326
|
+
let text = state.transcript_text(area.width);
|
|
327
|
+
let layout = TranscriptLayout::new(text, area.width);
|
|
328
|
+
let max = layout.height.saturating_sub(area.height as usize);
|
|
329
|
+
let offset = max.saturating_sub(state.scroll_from_bottom.min(max));
|
|
330
|
+
self.transcript_selection = Some(TranscriptSelection::from_text(
|
|
331
|
+
layout.text,
|
|
332
|
+
area,
|
|
333
|
+
offset,
|
|
334
|
+
point,
|
|
335
|
+
));
|
|
336
|
+
}
|
|
337
|
+
state.selection_mode = false;
|
|
338
|
+
state.clear_notice();
|
|
339
|
+
} else {
|
|
340
|
+
self.clear_mouse_selection();
|
|
341
|
+
}
|
|
342
|
+
Ok(true)
|
|
343
|
+
}
|
|
344
|
+
MouseEventKind::Drag(MouseButton::Left) => {
|
|
345
|
+
self.mouse_selection.update(point);
|
|
346
|
+
if let Some(selected) = self.transcript_selection.as_mut() {
|
|
347
|
+
selected.update(point);
|
|
348
|
+
}
|
|
349
|
+
Ok(self.mouse_selection.dragging)
|
|
350
|
+
}
|
|
351
|
+
MouseEventKind::Up(MouseButton::Left) => {
|
|
352
|
+
if let Some(selected) = self.transcript_selection.as_mut() {
|
|
353
|
+
selected.update(point);
|
|
354
|
+
selected.dragging = false;
|
|
355
|
+
}
|
|
356
|
+
if !self.mouse_selection.finish(point) {
|
|
357
|
+
self.transcript_selection = None;
|
|
358
|
+
return Ok(true);
|
|
359
|
+
}
|
|
360
|
+
if self
|
|
361
|
+
.last_frame
|
|
362
|
+
.as_ref()
|
|
363
|
+
.map(|buffer| {
|
|
364
|
+
self.transcript_selection
|
|
365
|
+
.as_ref()
|
|
366
|
+
.map_or_else(
|
|
367
|
+
|| selected_screen_text(buffer, self.mouse_selection),
|
|
368
|
+
TranscriptSelection::text,
|
|
369
|
+
)
|
|
370
|
+
.trim()
|
|
371
|
+
.is_empty()
|
|
372
|
+
})
|
|
373
|
+
.unwrap_or(true)
|
|
374
|
+
{
|
|
375
|
+
self.clear_mouse_selection();
|
|
376
|
+
}
|
|
377
|
+
Ok(true)
|
|
378
|
+
}
|
|
379
|
+
MouseEventKind::Down(MouseButton::Right) => {
|
|
380
|
+
let text = self
|
|
381
|
+
.last_frame
|
|
382
|
+
.as_ref()
|
|
383
|
+
.map(|buffer| {
|
|
384
|
+
self.transcript_selection.as_ref().map_or_else(
|
|
385
|
+
|| selected_screen_text(buffer, self.mouse_selection),
|
|
386
|
+
TranscriptSelection::text,
|
|
387
|
+
)
|
|
388
|
+
})
|
|
389
|
+
.unwrap_or_default();
|
|
390
|
+
if text.trim().is_empty() {
|
|
391
|
+
return Ok(false);
|
|
392
|
+
}
|
|
393
|
+
if text.len() > COPY_LIMIT {
|
|
394
|
+
state.set_notice("Selection exceeds the 100 KiB copy limit");
|
|
395
|
+
return Ok(true);
|
|
396
|
+
}
|
|
397
|
+
let character_count = text.chars().count();
|
|
398
|
+
match self.clipboard.copy(&text, &mut io::stdout()) {
|
|
399
|
+
Ok(CopyMethod::Native) => state
|
|
400
|
+
.set_notice(format!("Copied {character_count} chars to host clipboard")),
|
|
401
|
+
Ok(CopyMethod::Osc52) => {
|
|
402
|
+
state.set_notice(format!("Copied {character_count} chars with OSC52"))
|
|
403
|
+
}
|
|
404
|
+
Err(error) => state.set_notice(format!("Could not copy selection: {error}")),
|
|
405
|
+
}
|
|
406
|
+
self.clear_mouse_selection();
|
|
407
|
+
Ok(true)
|
|
408
|
+
}
|
|
409
|
+
MouseEventKind::ScrollUp | MouseEventKind::ScrollDown => {
|
|
410
|
+
self.clear_mouse_selection();
|
|
411
|
+
Ok(false)
|
|
412
|
+
}
|
|
413
|
+
_ => Ok(false),
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
fn clear_mouse_selection(&mut self) {
|
|
418
|
+
self.mouse_selection.clear();
|
|
419
|
+
self.transcript_selection = None;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
fn scroll_mouse_selection(&mut self, state: &mut ChatViewState) -> bool {
|
|
423
|
+
if self.selection_scroll_at.elapsed() < std::time::Duration::from_millis(50) {
|
|
424
|
+
return false;
|
|
425
|
+
}
|
|
426
|
+
self.selection_scroll_at = std::time::Instant::now();
|
|
427
|
+
self.transcript_selection
|
|
428
|
+
.as_mut()
|
|
429
|
+
.is_some_and(|selection| selection.scroll(&mut state.scroll_from_bottom))
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
fn composer_selection_range(&self, state: &ChatViewState) -> Option<(usize, usize)> {
|
|
433
|
+
if self.transcript_selection.is_some() {
|
|
434
|
+
return None;
|
|
435
|
+
}
|
|
436
|
+
let area = self.composer_area?;
|
|
437
|
+
let (anchor, head) = self.mouse_selection.endpoints()?;
|
|
438
|
+
let (start, end) = if anchor <= head {
|
|
439
|
+
(anchor, head)
|
|
440
|
+
} else {
|
|
441
|
+
(head, anchor)
|
|
442
|
+
};
|
|
443
|
+
let chars = &state.composer;
|
|
444
|
+
let row_width = (area.width as usize).saturating_sub(4).max(1);
|
|
445
|
+
let start = input_index_at(start, area, chars, row_width, state.cursor, false)?;
|
|
446
|
+
let end = input_index_at(end, area, chars, row_width, state.cursor, true)?;
|
|
447
|
+
(start < end).then_some((start.min(chars.len()), end.min(chars.len())))
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
fn copy_mouse_selection(&mut self, state: &mut ChatViewState) -> bool {
|
|
451
|
+
if self.mouse_selection.range().is_none() {
|
|
452
|
+
return false;
|
|
453
|
+
}
|
|
454
|
+
let text = if let Some((start, end)) = self.composer_selection_range(state) {
|
|
455
|
+
state.composer[start..end].iter().collect::<String>()
|
|
456
|
+
} else {
|
|
457
|
+
self.last_frame
|
|
458
|
+
.as_ref()
|
|
459
|
+
.map(|buffer| {
|
|
460
|
+
self.transcript_selection.as_ref().map_or_else(
|
|
461
|
+
|| selected_screen_text(buffer, self.mouse_selection),
|
|
462
|
+
TranscriptSelection::text,
|
|
463
|
+
)
|
|
464
|
+
})
|
|
465
|
+
.unwrap_or_default()
|
|
466
|
+
};
|
|
467
|
+
if text.trim().is_empty() {
|
|
468
|
+
self.clear_mouse_selection();
|
|
469
|
+
state.set_notice("Nothing to copy from this selection");
|
|
470
|
+
return true;
|
|
471
|
+
}
|
|
472
|
+
if text.len() > COPY_LIMIT {
|
|
473
|
+
state.set_notice("Selection exceeds the 100 KiB copy limit");
|
|
474
|
+
} else {
|
|
475
|
+
let character_count = text.chars().count();
|
|
476
|
+
match self.clipboard.copy(&text, &mut io::stdout()) {
|
|
477
|
+
Ok(CopyMethod::Native | CopyMethod::Osc52) => {
|
|
478
|
+
state.set_notice(format!("Copied {character_count} chars to clipboard"))
|
|
479
|
+
}
|
|
480
|
+
Err(error) => state.set_notice(format!("Could not copy selection: {error}")),
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
true
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
fn handle_tool_viewer_key(&mut self, state: &mut ChatViewState, key: event::KeyEvent) -> bool {
|
|
487
|
+
if key.code == event::KeyCode::Char('y')
|
|
488
|
+
&& key.modifiers.contains(event::KeyModifiers::CONTROL)
|
|
489
|
+
&& let Some(tool) = state.tool_viewer.and_then(|index| state.tools.get(index))
|
|
490
|
+
{
|
|
491
|
+
match self.clipboard.copy(&tool.details(), &mut io::stdout()) {
|
|
492
|
+
Ok(_) => state.set_notice("Tool details copied to clipboard"),
|
|
493
|
+
Err(error) => state.set_notice(format!("Could not copy tool details: {error}")),
|
|
494
|
+
}
|
|
495
|
+
return true;
|
|
496
|
+
}
|
|
497
|
+
if state.handle_tool_key(key) {
|
|
498
|
+
return true;
|
|
499
|
+
}
|
|
500
|
+
if state.tool_viewer.is_some() {
|
|
501
|
+
if let Some(dialog) = state.dialog.as_mut()
|
|
502
|
+
&& dialog.handle_key(key).is_some()
|
|
503
|
+
{
|
|
504
|
+
state.dialog = None;
|
|
505
|
+
state.tool_viewer = None;
|
|
506
|
+
}
|
|
507
|
+
return true;
|
|
508
|
+
}
|
|
509
|
+
false
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
pub fn read_input(
|
|
513
|
+
&mut self,
|
|
514
|
+
shared_state: &Arc<Mutex<ChatViewState>>,
|
|
515
|
+
) -> Result<Option<InteractiveInput>> {
|
|
516
|
+
let mut state = shared_state
|
|
517
|
+
.lock()
|
|
518
|
+
.map_err(|_| anyhow::anyhow!("TUI state lock poisoned"))?;
|
|
519
|
+
let mut pasted_image: Option<String> = None;
|
|
520
|
+
let mut last_ctrl_d: Option<std::time::Instant> = None;
|
|
521
|
+
let mut last_sync = std::time::Instant::now();
|
|
522
|
+
state.mods = mint_core::mods::list(
|
|
523
|
+
&state.current_dir,
|
|
524
|
+
&mint_core::scoped_chat_id(&state.chat_id, Some(&state.current_dir.to_string_lossy())),
|
|
525
|
+
)
|
|
526
|
+
.unwrap_or_default();
|
|
527
|
+
let mut previous_bg_count = mint_core::bg_shell::running_count_for(&state.current_dir);
|
|
528
|
+
let mut redraw = true;
|
|
529
|
+
let mut painted_notice_visible = false;
|
|
530
|
+
let mut reported_mod_viewport = None;
|
|
531
|
+
let mut watermark_started: Option<std::time::Instant> = None;
|
|
532
|
+
const DOUBLE_PRESS_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(3);
|
|
533
|
+
|
|
534
|
+
loop {
|
|
535
|
+
let size = self.terminal.size()?;
|
|
536
|
+
let viewport = state.mod_viewport(Rect::new(0, 0, size.width, size.height));
|
|
537
|
+
if reported_mod_viewport.as_ref() != Some(&viewport) {
|
|
538
|
+
let chat = mint_core::scoped_chat_id(
|
|
539
|
+
&state.chat_id,
|
|
540
|
+
Some(&state.current_dir.to_string_lossy()),
|
|
541
|
+
);
|
|
542
|
+
let _ =
|
|
543
|
+
mint_core::mods::update_viewport(&state.current_dir, &chat, viewport.clone());
|
|
544
|
+
state.mods = mint_core::mods::list(&state.current_dir, &chat).unwrap_or_default();
|
|
545
|
+
reported_mod_viewport = Some(viewport);
|
|
546
|
+
redraw = true;
|
|
547
|
+
}
|
|
548
|
+
let watermark_visible = state.transcript.is_empty()
|
|
549
|
+
&& state.dialog.is_none()
|
|
550
|
+
&& state.thought_modal.is_none();
|
|
551
|
+
if state.watermark_animating && watermark_visible {
|
|
552
|
+
let started = *watermark_started.get_or_insert_with(std::time::Instant::now);
|
|
553
|
+
match watermark_animation_at(started.elapsed()).0 {
|
|
554
|
+
Some(frame) if frame != state.watermark_frame => {
|
|
555
|
+
state.watermark_frame = frame;
|
|
556
|
+
redraw = true;
|
|
557
|
+
}
|
|
558
|
+
None => {
|
|
559
|
+
state.watermark_frame = 0;
|
|
560
|
+
state.watermark_animating = false;
|
|
561
|
+
watermark_started = None;
|
|
562
|
+
redraw = true;
|
|
563
|
+
}
|
|
564
|
+
_ => {}
|
|
565
|
+
}
|
|
566
|
+
} else {
|
|
567
|
+
watermark_started = None;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
if let Some(time) = last_ctrl_d {
|
|
571
|
+
if time.elapsed() >= DOUBLE_PRESS_TIMEOUT {
|
|
572
|
+
last_ctrl_d = None;
|
|
573
|
+
if state.active_notice() == Some("Press Ctrl+D again to exit") {
|
|
574
|
+
state.clear_notice();
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
let bg_count = mint_core::bg_shell::running_count_for(&state.current_dir);
|
|
580
|
+
if bg_count != previous_bg_count {
|
|
581
|
+
previous_bg_count = bg_count;
|
|
582
|
+
redraw = true;
|
|
583
|
+
}
|
|
584
|
+
for notice in mint_core::bg_shell::take_finished_notices() {
|
|
585
|
+
state.push_notice(notice);
|
|
586
|
+
redraw = true;
|
|
587
|
+
}
|
|
588
|
+
redraw |= state.notice_visibility_changed_since_draw(painted_notice_visible);
|
|
589
|
+
|
|
590
|
+
redraw |= self.scroll_mouse_selection(&mut state);
|
|
591
|
+
if redraw {
|
|
592
|
+
let notice_visible = state.active_notice().is_some();
|
|
593
|
+
self.draw_state(&state)?;
|
|
594
|
+
painted_notice_visible = notice_visible;
|
|
595
|
+
redraw = false;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
let watermark_animating = state.watermark_animating && watermark_visible;
|
|
599
|
+
{
|
|
600
|
+
let poll_interval = if watermark_animating {
|
|
601
|
+
let elapsed = watermark_started
|
|
602
|
+
.expect("active watermark has a start time")
|
|
603
|
+
.elapsed();
|
|
604
|
+
watermark_animation_at(elapsed)
|
|
605
|
+
.1
|
|
606
|
+
.unwrap_or(elapsed)
|
|
607
|
+
.saturating_sub(elapsed)
|
|
608
|
+
.min(std::time::Duration::from_millis(250))
|
|
609
|
+
} else if self.mouse_selection.dragging
|
|
610
|
+
|| last_ctrl_d.is_some()
|
|
611
|
+
|| state.active_notice().is_some()
|
|
612
|
+
{
|
|
613
|
+
std::time::Duration::from_millis(50)
|
|
614
|
+
} else {
|
|
615
|
+
std::time::Duration::from_millis(250)
|
|
616
|
+
};
|
|
617
|
+
if !event::poll(poll_interval)? {
|
|
618
|
+
if last_sync.elapsed() >= std::time::Duration::from_millis(1500)
|
|
619
|
+
&& self.mouse_selection.range().is_none()
|
|
620
|
+
&& !state.selection_mode
|
|
621
|
+
{
|
|
622
|
+
redraw |= state.refresh_shared_transcript();
|
|
623
|
+
let mods = mint_core::mods::list(
|
|
624
|
+
&state.current_dir,
|
|
625
|
+
&mint_core::scoped_chat_id(
|
|
626
|
+
&state.chat_id,
|
|
627
|
+
Some(&state.current_dir.to_string_lossy()),
|
|
628
|
+
),
|
|
629
|
+
)
|
|
630
|
+
.unwrap_or_default();
|
|
631
|
+
if mods != state.mods {
|
|
632
|
+
state.mods = mods;
|
|
633
|
+
redraw = true;
|
|
634
|
+
}
|
|
635
|
+
last_sync = std::time::Instant::now();
|
|
636
|
+
}
|
|
637
|
+
continue;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
let input_event = event::read()?;
|
|
642
|
+
if matches!(
|
|
643
|
+
&input_event,
|
|
644
|
+
event::Event::Mouse(m) if m.kind == event::MouseEventKind::Moved
|
|
645
|
+
) {
|
|
646
|
+
continue;
|
|
647
|
+
}
|
|
648
|
+
redraw = true;
|
|
649
|
+
match input_event {
|
|
650
|
+
event::Event::Resize(w, h) => {
|
|
651
|
+
self.clear_mouse_selection();
|
|
652
|
+
if w < MIN_WIDTH || h < MIN_HEIGHT {
|
|
653
|
+
state.set_notice(format!("Terminal too small: {w}x{h}"));
|
|
654
|
+
} else if state
|
|
655
|
+
.active_notice()
|
|
656
|
+
.map(|n| n.starts_with("Terminal too small"))
|
|
657
|
+
.unwrap_or(false)
|
|
658
|
+
{
|
|
659
|
+
state.clear_notice();
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
event::Event::Mouse(m) => {
|
|
663
|
+
if m.kind == event::MouseEventKind::Down(event::MouseButton::Left)
|
|
664
|
+
&& self
|
|
665
|
+
.watermark_area
|
|
666
|
+
.is_some_and(|area| area.contains(Position::new(m.column, m.row)))
|
|
667
|
+
{
|
|
668
|
+
self.clear_mouse_selection();
|
|
669
|
+
state.watermark_frame = 0;
|
|
670
|
+
state.watermark_animating = true;
|
|
671
|
+
watermark_started = Some(std::time::Instant::now());
|
|
672
|
+
continue;
|
|
673
|
+
}
|
|
674
|
+
if self.handle_selection_mouse(m, &mut state)? {
|
|
675
|
+
continue;
|
|
676
|
+
}
|
|
677
|
+
route_mouse_wheel(
|
|
678
|
+
&mut state,
|
|
679
|
+
m.kind,
|
|
680
|
+
Some(Position::new(m.column, m.row)),
|
|
681
|
+
self.transcript_area,
|
|
682
|
+
);
|
|
683
|
+
}
|
|
684
|
+
event::Event::Paste(text) => {
|
|
685
|
+
self.clear_mouse_selection();
|
|
686
|
+
state.insert_paste(&text);
|
|
687
|
+
}
|
|
688
|
+
event::Event::Key(key) if key.kind == event::KeyEventKind::Press => {
|
|
689
|
+
use event::{KeyCode, KeyModifiers};
|
|
690
|
+
|
|
691
|
+
if self.handle_tool_viewer_key(&mut state, key) {
|
|
692
|
+
continue;
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
let is_ctrl_c = key.code == KeyCode::Char('c')
|
|
696
|
+
&& key.modifiers.contains(KeyModifiers::CONTROL);
|
|
697
|
+
if is_ctrl_c && self.copy_mouse_selection(&mut state) {
|
|
698
|
+
continue;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
if self.mouse_selection.range().is_some() {
|
|
702
|
+
if matches!(key.code, KeyCode::Delete | KeyCode::Backspace) {
|
|
703
|
+
if let Some((start, end)) = self.composer_selection_range(&state) {
|
|
704
|
+
state.replace_composer(start..end, "");
|
|
705
|
+
state.clear_notice();
|
|
706
|
+
}
|
|
707
|
+
self.clear_mouse_selection();
|
|
708
|
+
continue;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
self.clear_mouse_selection();
|
|
713
|
+
|
|
714
|
+
if key.code == KeyCode::F(7) && state.dialog.is_none() {
|
|
715
|
+
state.mods_open = !state.mods_open;
|
|
716
|
+
state.mod_input = None;
|
|
717
|
+
continue;
|
|
718
|
+
}
|
|
719
|
+
if key.code == KeyCode::F(8) && state.dialog.is_none() {
|
|
720
|
+
if !super::is_cli_voice_recording() {
|
|
721
|
+
match super::start_cli_voice_recording() {
|
|
722
|
+
Ok(()) => {
|
|
723
|
+
state.set_notice(
|
|
724
|
+
"🎙 Recording voice… Press F8 to transcribe into composer, or Esc to cancel",
|
|
725
|
+
);
|
|
726
|
+
}
|
|
727
|
+
Err(err) => {
|
|
728
|
+
state.set_notice(format!("Microphone error: {err}"));
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
} else {
|
|
732
|
+
match super::stop_cli_voice_recording() {
|
|
733
|
+
Ok(Some(wav_bytes)) => {
|
|
734
|
+
state.set_notice("Transcribing voice…");
|
|
735
|
+
let _ = self.draw_state(&state);
|
|
736
|
+
let cfg = mint_core::load_config().unwrap_or_default();
|
|
737
|
+
let transcribed = tokio::task::block_in_place(|| {
|
|
738
|
+
tokio::runtime::Handle::current().block_on(
|
|
739
|
+
mint_core::mic_transcribe::transcribe_recording(
|
|
740
|
+
&cfg, wav_bytes,
|
|
741
|
+
),
|
|
742
|
+
)
|
|
743
|
+
});
|
|
744
|
+
match transcribed {
|
|
745
|
+
Ok(text) if !text.trim().is_empty() => {
|
|
746
|
+
state.insert_paste(text.trim());
|
|
747
|
+
state.set_notice("✓ Voice transcribed into composer");
|
|
748
|
+
}
|
|
749
|
+
Ok(_) => state.set_notice("No speech detected"),
|
|
750
|
+
Err(err) => state.set_notice(format!(
|
|
751
|
+
"Voice transcription error: {err}"
|
|
752
|
+
)),
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
Ok(None) => state.set_notice("No active voice recording"),
|
|
756
|
+
Err(err) => {
|
|
757
|
+
state.set_notice(format!("Voice recording error: {err}"))
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
continue;
|
|
762
|
+
}
|
|
763
|
+
if key.code == KeyCode::Esc
|
|
764
|
+
&& super::is_cli_voice_recording()
|
|
765
|
+
&& state.dialog.is_none()
|
|
766
|
+
{
|
|
767
|
+
let _ = super::stop_cli_voice_recording();
|
|
768
|
+
state.set_notice("Voice recording cancelled");
|
|
769
|
+
continue;
|
|
770
|
+
}
|
|
771
|
+
if state.mods_open && state.dialog.is_none() && state.thought_modal.is_none() {
|
|
772
|
+
let controls = crate::mods_ui::controls(&state.mods);
|
|
773
|
+
match key.code {
|
|
774
|
+
KeyCode::Esc => state.mods_open = false,
|
|
775
|
+
KeyCode::Tab => {
|
|
776
|
+
state.mod_focus = (state.mod_focus + 1) % controls.len().max(1);
|
|
777
|
+
state.mod_input = None;
|
|
778
|
+
}
|
|
779
|
+
KeyCode::BackTab => {
|
|
780
|
+
state.mod_focus = (state.mod_focus + controls.len().max(1) - 1)
|
|
781
|
+
% controls.len().max(1);
|
|
782
|
+
state.mod_input = None;
|
|
783
|
+
}
|
|
784
|
+
KeyCode::Enter => {
|
|
785
|
+
if let Some(control) =
|
|
786
|
+
controls.get(state.mod_focus % controls.len().max(1))
|
|
787
|
+
{
|
|
788
|
+
let chat = mint_core::scoped_chat_id(
|
|
789
|
+
&state.chat_id,
|
|
790
|
+
Some(&state.current_dir.to_string_lossy()),
|
|
791
|
+
);
|
|
792
|
+
let value = if control.input {
|
|
793
|
+
serde_json::json!(state.mod_input_value(control))
|
|
794
|
+
} else {
|
|
795
|
+
serde_json::Value::Null
|
|
796
|
+
};
|
|
797
|
+
let result = mint_core::mods::action(
|
|
798
|
+
&state.current_dir,
|
|
799
|
+
&chat,
|
|
800
|
+
&control.id,
|
|
801
|
+
&control.instance,
|
|
802
|
+
&control.action,
|
|
803
|
+
value,
|
|
804
|
+
);
|
|
805
|
+
if let Err(error) = result {
|
|
806
|
+
state.set_notice(error);
|
|
807
|
+
}
|
|
808
|
+
state.mod_input = None;
|
|
809
|
+
state.mods = mint_core::mods::list(&state.current_dir, &chat)
|
|
810
|
+
.unwrap_or_default();
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
KeyCode::Char(c) if !key.modifiers.contains(KeyModifiers::CONTROL) => {
|
|
814
|
+
if let Some(control) = controls
|
|
815
|
+
.get(state.mod_focus % controls.len().max(1))
|
|
816
|
+
.filter(|c| c.input)
|
|
817
|
+
{
|
|
818
|
+
state.mod_input_draft(control).push(c);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
KeyCode::Backspace => {
|
|
822
|
+
if let Some(control) = controls
|
|
823
|
+
.get(state.mod_focus % controls.len().max(1))
|
|
824
|
+
.filter(|c| c.input)
|
|
825
|
+
{
|
|
826
|
+
state.mod_input_draft(control).pop();
|
|
827
|
+
}
|
|
828
|
+
}
|
|
829
|
+
_ => {}
|
|
830
|
+
}
|
|
831
|
+
continue;
|
|
832
|
+
}
|
|
833
|
+
if key.code == KeyCode::F(6) {
|
|
834
|
+
let _ = super::stop_cli_voice_recording();
|
|
835
|
+
let text = state.composer_text();
|
|
836
|
+
return Ok(Some(InteractiveInput {
|
|
837
|
+
text,
|
|
838
|
+
pasted_image,
|
|
839
|
+
switch_mode: true,
|
|
840
|
+
}));
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
if state.handle_thought_key(key) {
|
|
844
|
+
continue;
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
let is_ctrl_d = key.code == KeyCode::Char('d')
|
|
848
|
+
&& key.modifiers.contains(KeyModifiers::CONTROL);
|
|
849
|
+
if !is_ctrl_d && last_ctrl_d.is_some() {
|
|
850
|
+
last_ctrl_d = None;
|
|
851
|
+
if state.active_notice() == Some("Press Ctrl+D again to exit") {
|
|
852
|
+
state.clear_notice();
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
if state.selection_mode {
|
|
857
|
+
match key.code {
|
|
858
|
+
KeyCode::Esc => state.selection_mode = false,
|
|
859
|
+
KeyCode::Char('c') | KeyCode::Char('d')
|
|
860
|
+
if key.modifiers.contains(KeyModifiers::CONTROL) =>
|
|
861
|
+
{
|
|
862
|
+
state.selection_mode = false;
|
|
863
|
+
}
|
|
864
|
+
KeyCode::Enter | KeyCode::Char('y') => {
|
|
865
|
+
let text = state.selected_text();
|
|
866
|
+
if text.len() > COPY_LIMIT {
|
|
867
|
+
state.set_notice("Transcript exceeds the 100 KiB copy limit");
|
|
868
|
+
} else {
|
|
869
|
+
match self.clipboard.copy(&text, &mut io::stdout()) {
|
|
870
|
+
Ok(CopyMethod::Native) => {
|
|
871
|
+
state.set_notice("Transcript copied to clipboard")
|
|
872
|
+
}
|
|
873
|
+
Ok(CopyMethod::Osc52) => {
|
|
874
|
+
state.set_notice("Transcript copied with OSC52")
|
|
875
|
+
}
|
|
876
|
+
Err(error) => state.set_notice(format!(
|
|
877
|
+
"Could not copy transcript: {error}"
|
|
878
|
+
)),
|
|
879
|
+
}
|
|
880
|
+
state.selection_mode = false;
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
KeyCode::PageUp | KeyCode::Up => {
|
|
884
|
+
state.selection_head = state.selection_head.saturating_sub(1);
|
|
885
|
+
state.scroll_from_bottom =
|
|
886
|
+
state.scroll_from_bottom.saturating_add(1)
|
|
887
|
+
}
|
|
888
|
+
KeyCode::PageDown | KeyCode::Down => {
|
|
889
|
+
let last = state.plain_transcript_lines().len().saturating_sub(1);
|
|
890
|
+
state.selection_head = (state.selection_head + 1).min(last);
|
|
891
|
+
state.scroll_from_bottom =
|
|
892
|
+
state.scroll_from_bottom.saturating_sub(1)
|
|
893
|
+
}
|
|
894
|
+
_ => {}
|
|
895
|
+
}
|
|
896
|
+
continue;
|
|
897
|
+
}
|
|
898
|
+
let composer_width =
|
|
899
|
+
state.composer_width(Rect::new(0, 0, size.width, size.height));
|
|
900
|
+
if state.edit_composer_key(key) {
|
|
901
|
+
continue;
|
|
902
|
+
}
|
|
903
|
+
match key.code {
|
|
904
|
+
KeyCode::Esc if state.editing_turn.is_some() => {
|
|
905
|
+
state.cancel_edit_turn();
|
|
906
|
+
continue;
|
|
907
|
+
}
|
|
908
|
+
KeyCode::Char('v') if key.modifiers.contains(KeyModifiers::CONTROL) => {
|
|
909
|
+
if let Ok(Some(uri)) = crate::image::read_clipboard_image() {
|
|
910
|
+
if let Some(current) = pasted_image.as_mut() {
|
|
911
|
+
current.push(' ');
|
|
912
|
+
current.push_str(&uri);
|
|
913
|
+
} else {
|
|
914
|
+
pasted_image = Some(uri);
|
|
915
|
+
}
|
|
916
|
+
let mut image_draft = state.composer.clone();
|
|
917
|
+
let cursor = state.cursor;
|
|
918
|
+
let mut end = cursor;
|
|
919
|
+
super::insert_image_placeholder(&mut image_draft, &mut end);
|
|
920
|
+
state.replace_composer(
|
|
921
|
+
cursor..cursor,
|
|
922
|
+
&image_draft[cursor..end].iter().collect::<String>(),
|
|
923
|
+
);
|
|
924
|
+
state.set_notice("Image attached");
|
|
925
|
+
} else {
|
|
926
|
+
state.set_notice("No image found in clipboard");
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
KeyCode::PageUp => {
|
|
930
|
+
state.scroll_from_bottom = state.scroll_from_bottom.saturating_add(10)
|
|
931
|
+
}
|
|
932
|
+
KeyCode::PageDown => {
|
|
933
|
+
state.scroll_from_bottom = state.scroll_from_bottom.saturating_sub(10)
|
|
934
|
+
}
|
|
935
|
+
KeyCode::Home if key.modifiers.contains(KeyModifiers::CONTROL) => {
|
|
936
|
+
state.scroll_from_bottom = usize::MAX
|
|
937
|
+
}
|
|
938
|
+
KeyCode::Up if !state.suggestions().is_empty() => {
|
|
939
|
+
state.slash_selected = state.slash_selected.saturating_sub(1)
|
|
940
|
+
}
|
|
941
|
+
KeyCode::Down if !state.suggestions().is_empty() => {
|
|
942
|
+
let last = state.suggestions().len().saturating_sub(1);
|
|
943
|
+
state.slash_selected = (state.slash_selected + 1).min(last);
|
|
944
|
+
}
|
|
945
|
+
KeyCode::Tab if !state.suggestions().is_empty() => {
|
|
946
|
+
state.apply_selected_suggestion();
|
|
947
|
+
}
|
|
948
|
+
KeyCode::Up | KeyCode::Down | KeyCode::Home | KeyCode::End
|
|
949
|
+
if state.navigate_composer(key, composer_width) => {}
|
|
950
|
+
KeyCode::End => state.scroll_from_bottom = 0,
|
|
951
|
+
KeyCode::Up if !state.composer.contains(&'\n') => state.history_previous(),
|
|
952
|
+
KeyCode::Down if !state.composer.contains(&'\n') => state.history_next(),
|
|
953
|
+
KeyCode::Enter => {
|
|
954
|
+
let suggestions = state.suggestions();
|
|
955
|
+
let input: String = state.composer.iter().collect();
|
|
956
|
+
if input.starts_with('/')
|
|
957
|
+
&& !suggestions.is_empty()
|
|
958
|
+
&& !suggestions.iter().any(|(token, _)| token == input.trim())
|
|
959
|
+
{
|
|
960
|
+
state.apply_selected_suggestion();
|
|
961
|
+
}
|
|
962
|
+
let text = state.take_prompt();
|
|
963
|
+
state.history_index = None;
|
|
964
|
+
state.draft_before_history.clear();
|
|
965
|
+
|
|
966
|
+
if state.editing_turn.is_none() {
|
|
967
|
+
let trimmed = text.trim();
|
|
968
|
+
if trimmed == "/edit" || trimmed == "/retry" {
|
|
969
|
+
state.enter_edit_turn();
|
|
970
|
+
continue;
|
|
971
|
+
} else if trimmed.starts_with("/edit ")
|
|
972
|
+
|| trimmed.starts_with("/retry ")
|
|
973
|
+
{
|
|
974
|
+
let prefix = if trimmed.starts_with("/edit ") {
|
|
975
|
+
"/edit "
|
|
976
|
+
} else {
|
|
977
|
+
"/retry "
|
|
978
|
+
};
|
|
979
|
+
let new_prompt = trimmed[prefix.len()..].trim().to_string();
|
|
980
|
+
if state.enter_edit_turn() {
|
|
981
|
+
if !new_prompt.is_empty() {
|
|
982
|
+
state.set_draft(new_prompt);
|
|
983
|
+
state.cursor = state.composer.len();
|
|
984
|
+
}
|
|
985
|
+
continue;
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
} else if let Some((from_id, _turn_num)) = state.editing_turn.take() {
|
|
989
|
+
state.clear_notice();
|
|
990
|
+
if text.trim().is_empty() {
|
|
991
|
+
continue;
|
|
992
|
+
}
|
|
993
|
+
let scoped = mint_core::scoped_chat_id(
|
|
994
|
+
&state.chat_id,
|
|
995
|
+
Some(&state.current_dir.to_string_lossy()),
|
|
996
|
+
);
|
|
997
|
+
if let Ok(memory) = mint_core::MemoryStore::open_default() {
|
|
998
|
+
let _ = memory.truncate_interactions_from(&scoped, from_id);
|
|
999
|
+
let chat_id = state.chat_id.clone();
|
|
1000
|
+
let workspace = state.current_dir.clone();
|
|
1001
|
+
state.reload_transcript_with(&memory, &chat_id, &workspace);
|
|
1002
|
+
}
|
|
1003
|
+
return Ok(Some(InteractiveInput {
|
|
1004
|
+
text,
|
|
1005
|
+
pasted_image,
|
|
1006
|
+
switch_mode: false,
|
|
1007
|
+
}));
|
|
1008
|
+
}
|
|
1009
|
+
|
|
1010
|
+
state.clear_notice();
|
|
1011
|
+
if !text.trim().is_empty() {
|
|
1012
|
+
return Ok(Some(InteractiveInput {
|
|
1013
|
+
text,
|
|
1014
|
+
pasted_image,
|
|
1015
|
+
switch_mode: false,
|
|
1016
|
+
}));
|
|
1017
|
+
}
|
|
1018
|
+
}
|
|
1019
|
+
KeyCode::Char('d') if key.modifiers.contains(KeyModifiers::CONTROL) => {
|
|
1020
|
+
if let Some(time) = last_ctrl_d {
|
|
1021
|
+
if time.elapsed() < DOUBLE_PRESS_TIMEOUT {
|
|
1022
|
+
let _ = super::stop_cli_voice_recording();
|
|
1023
|
+
state.stop_mods();
|
|
1024
|
+
return Ok(None);
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
last_ctrl_d = Some(std::time::Instant::now());
|
|
1028
|
+
state.set_notice("Press Ctrl+D again to exit");
|
|
1029
|
+
}
|
|
1030
|
+
KeyCode::Char('c') if key.modifiers.contains(KeyModifiers::CONTROL) => {
|
|
1031
|
+
if state.editing_turn.is_some() {
|
|
1032
|
+
state.cancel_edit_turn();
|
|
1033
|
+
continue;
|
|
1034
|
+
}
|
|
1035
|
+
if !state.composer.is_empty() {
|
|
1036
|
+
state.take_prompt();
|
|
1037
|
+
state.slash_selected = 0;
|
|
1038
|
+
state.clear_notice();
|
|
1039
|
+
} else {
|
|
1040
|
+
state.set_notice("Press Ctrl+D twice to exit");
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
_ => {}
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
_ => {}
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
pub fn handle(state: Arc<Mutex<ChatViewState>>) -> TuiHandle {
|
|
1051
|
+
TuiHandle {
|
|
1052
|
+
state,
|
|
1053
|
+
interrupted: Arc::new(AtomicBool::new(false)),
|
|
1054
|
+
queued: Arc::new(Mutex::new(Vec::new())),
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
fn handle_dialog_event(
|
|
1059
|
+
&mut self,
|
|
1060
|
+
input_event: event::Event,
|
|
1061
|
+
state: &mut ChatViewState,
|
|
1062
|
+
) -> Result<()> {
|
|
1063
|
+
match input_event {
|
|
1064
|
+
event::Event::Mouse(mouse) => {
|
|
1065
|
+
if !self.handle_selection_mouse(mouse, state)? {
|
|
1066
|
+
route_mouse_wheel(
|
|
1067
|
+
state,
|
|
1068
|
+
mouse.kind,
|
|
1069
|
+
Some(Position::new(mouse.column, mouse.row)),
|
|
1070
|
+
self.transcript_area,
|
|
1071
|
+
);
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
event::Event::Resize(_, _) => self.clear_mouse_selection(),
|
|
1075
|
+
event::Event::Key(key) if key.kind == event::KeyEventKind::Press => {
|
|
1076
|
+
self.clear_mouse_selection();
|
|
1077
|
+
let is_unscrollable_dialog = state
|
|
1078
|
+
.dialog
|
|
1079
|
+
.as_ref()
|
|
1080
|
+
.map_or(false, |d| d.body_max_scroll.get() == 0);
|
|
1081
|
+
if let Some(dialog) = state.dialog.as_mut() {
|
|
1082
|
+
if let Some(answer) = dialog.handle_key(key) {
|
|
1083
|
+
if let Some(dialog) = state.dialog.take() {
|
|
1084
|
+
let _ = dialog.reply.send(answer);
|
|
1085
|
+
}
|
|
1086
|
+
return Ok(());
|
|
1087
|
+
}
|
|
1088
|
+
}
|
|
1089
|
+
if is_unscrollable_dialog {
|
|
1090
|
+
match key.code {
|
|
1091
|
+
event::KeyCode::PageUp => {
|
|
1092
|
+
state.scroll_from_bottom = state.scroll_from_bottom.saturating_add(10);
|
|
1093
|
+
}
|
|
1094
|
+
event::KeyCode::PageDown => {
|
|
1095
|
+
state.scroll_from_bottom = state.scroll_from_bottom.saturating_sub(10);
|
|
1096
|
+
}
|
|
1097
|
+
_ => {}
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
_ => {}
|
|
1102
|
+
}
|
|
1103
|
+
Ok(())
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
pub fn prompt_choice(
|
|
1107
|
+
&mut self,
|
|
1108
|
+
handle: &TuiHandle,
|
|
1109
|
+
title: impl Into<String>,
|
|
1110
|
+
body: impl Into<String>,
|
|
1111
|
+
options: Vec<String>,
|
|
1112
|
+
) -> Result<Option<usize>> {
|
|
1113
|
+
let (reply, response) = mpsc::channel();
|
|
1114
|
+
if let Ok(mut state) = handle.state.lock() {
|
|
1115
|
+
state.dialog = Some(DialogState::new_choice(title, body, options, None, reply));
|
|
1116
|
+
}
|
|
1117
|
+
self.wait_for_choice(handle, response)
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
pub fn prompt_update(
|
|
1121
|
+
&mut self,
|
|
1122
|
+
handle: &TuiHandle,
|
|
1123
|
+
current: &str,
|
|
1124
|
+
latest: &str,
|
|
1125
|
+
) -> Result<Option<usize>> {
|
|
1126
|
+
let (reply, response) = mpsc::channel();
|
|
1127
|
+
if let Ok(mut state) = handle.state.lock() {
|
|
1128
|
+
state.dialog = Some(DialogState::new_update(current, latest, reply));
|
|
1129
|
+
}
|
|
1130
|
+
self.wait_for_choice(handle, response)
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
fn wait_for_dialog_answer(
|
|
1134
|
+
&mut self,
|
|
1135
|
+
handle: &TuiHandle,
|
|
1136
|
+
response: mpsc::Receiver<DialogAnswer>,
|
|
1137
|
+
) -> Result<DialogAnswer> {
|
|
1138
|
+
loop {
|
|
1139
|
+
if let Ok(mut state) = handle.state.lock() {
|
|
1140
|
+
self.scroll_mouse_selection(&mut state);
|
|
1141
|
+
self.draw_state(&state)?;
|
|
1142
|
+
}
|
|
1143
|
+
if let Ok(answer) = response.try_recv() {
|
|
1144
|
+
return Ok(answer);
|
|
1145
|
+
}
|
|
1146
|
+
if event::poll(std::time::Duration::from_millis(50))?
|
|
1147
|
+
&& let Ok(mut state) = handle.state.lock()
|
|
1148
|
+
{
|
|
1149
|
+
self.handle_dialog_event(event::read()?, &mut state)?;
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
fn wait_for_choice(
|
|
1155
|
+
&mut self,
|
|
1156
|
+
handle: &TuiHandle,
|
|
1157
|
+
response: mpsc::Receiver<DialogAnswer>,
|
|
1158
|
+
) -> Result<Option<usize>> {
|
|
1159
|
+
Ok(match self.wait_for_dialog_answer(handle, response)? {
|
|
1160
|
+
DialogAnswer::Choice(index) => Some(index),
|
|
1161
|
+
_ => None,
|
|
1162
|
+
})
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
pub fn prompt_theme(&mut self, handle: &TuiHandle, current: usize) -> Result<Option<usize>> {
|
|
1166
|
+
let (reply, response) = mpsc::channel();
|
|
1167
|
+
if let Ok(mut state) = handle.state.lock() {
|
|
1168
|
+
state.dialog = Some(DialogState::new_theme_picker(current, reply));
|
|
1169
|
+
}
|
|
1170
|
+
self.wait_for_choice(handle, response)
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
pub fn prompt_resume_picker(
|
|
1174
|
+
&mut self,
|
|
1175
|
+
handle: &TuiHandle,
|
|
1176
|
+
sessions: Vec<mint_core::ChatSession>,
|
|
1177
|
+
current_dir: &std::path::Path,
|
|
1178
|
+
current_branch: Option<String>,
|
|
1179
|
+
active_chat_id: &str,
|
|
1180
|
+
) -> Result<Option<usize>> {
|
|
1181
|
+
let (reply, response) = mpsc::channel();
|
|
1182
|
+
if let Ok(mut state) = handle.state.lock() {
|
|
1183
|
+
state.dialog = Some(DialogState::new_resume_picker(
|
|
1184
|
+
sessions,
|
|
1185
|
+
current_dir.to_string_lossy().to_string(),
|
|
1186
|
+
current_branch,
|
|
1187
|
+
active_chat_id.to_string(),
|
|
1188
|
+
reply,
|
|
1189
|
+
));
|
|
1190
|
+
}
|
|
1191
|
+
self.wait_for_choice(handle, response)
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
#[allow(dead_code)]
|
|
1195
|
+
pub fn prompt_multi_choice(
|
|
1196
|
+
&mut self,
|
|
1197
|
+
handle: &TuiHandle,
|
|
1198
|
+
title: impl Into<String>,
|
|
1199
|
+
body: impl Into<String>,
|
|
1200
|
+
options: Vec<String>,
|
|
1201
|
+
) -> Result<Option<Vec<usize>>> {
|
|
1202
|
+
let (reply, response) = mpsc::channel();
|
|
1203
|
+
let checked = vec![false; options.len()];
|
|
1204
|
+
if let Ok(mut state) = handle.state.lock() {
|
|
1205
|
+
state.dialog = Some(DialogState::new_choice(
|
|
1206
|
+
title,
|
|
1207
|
+
body,
|
|
1208
|
+
options,
|
|
1209
|
+
Some(checked),
|
|
1210
|
+
reply,
|
|
1211
|
+
));
|
|
1212
|
+
}
|
|
1213
|
+
Ok(match self.wait_for_dialog_answer(handle, response)? {
|
|
1214
|
+
DialogAnswer::Choices(indices) => Some(indices),
|
|
1215
|
+
_ => None,
|
|
1216
|
+
})
|
|
1217
|
+
}
|
|
1218
|
+
pub fn prompt_text(
|
|
1219
|
+
&mut self,
|
|
1220
|
+
handle: &TuiHandle,
|
|
1221
|
+
title: impl Into<String>,
|
|
1222
|
+
body: impl Into<String>,
|
|
1223
|
+
initial: Option<&str>,
|
|
1224
|
+
) -> Result<Option<String>> {
|
|
1225
|
+
let (reply, response) = mpsc::channel();
|
|
1226
|
+
if let Ok(mut state) = handle.state.lock() {
|
|
1227
|
+
let mut dialog = DialogState::new_text(title, body, reply);
|
|
1228
|
+
if let Some(init) = initial {
|
|
1229
|
+
dialog.input = Some(init.chars().collect());
|
|
1230
|
+
}
|
|
1231
|
+
state.dialog = Some(dialog);
|
|
1232
|
+
}
|
|
1233
|
+
Ok(match self.wait_for_dialog_answer(handle, response)? {
|
|
1234
|
+
DialogAnswer::Text(text) if !text.trim().is_empty() => Some(text),
|
|
1235
|
+
_ => None,
|
|
1236
|
+
})
|
|
1237
|
+
}
|
|
1238
|
+
pub fn run_onboard_wizard(&mut self, config: &mut mint_core::MintConfig) -> Result<bool> {
|
|
1239
|
+
let mut wizard = crate::onboard::OnboardWizard::new(config.clone());
|
|
1240
|
+
let outcome = wizard.run_with_terminal(&mut self.terminal)?;
|
|
1241
|
+
match outcome {
|
|
1242
|
+
crate::onboard::OnboardOutcome::SavedAndLaunch
|
|
1243
|
+
| crate::onboard::OnboardOutcome::SavedAndExit => {
|
|
1244
|
+
*config = wizard.take_config();
|
|
1245
|
+
Ok(true)
|
|
1246
|
+
}
|
|
1247
|
+
crate::onboard::OnboardOutcome::Cancelled => Ok(false),
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
pub async fn drive_agent<T: Send + 'static>(
|
|
1251
|
+
&mut self,
|
|
1252
|
+
handle: &TuiHandle,
|
|
1253
|
+
task: tokio::task::JoinHandle<T>,
|
|
1254
|
+
) -> Result<T> {
|
|
1255
|
+
use event::{KeyCode, KeyModifiers};
|
|
1256
|
+
loop {
|
|
1257
|
+
let mut revealing = false;
|
|
1258
|
+
if let Ok(mut state) = handle.state.lock() {
|
|
1259
|
+
if let Ok(queued) = handle.queued.lock() {
|
|
1260
|
+
state.queued_count = queued.len();
|
|
1261
|
+
state.queued_preview = queued.last().cloned();
|
|
1262
|
+
}
|
|
1263
|
+
state.tick_assistant_reveal_if_due(std::time::Duration::from_millis(18));
|
|
1264
|
+
revealing = state.has_pending_assistant_reveal();
|
|
1265
|
+
self.scroll_mouse_selection(&mut state);
|
|
1266
|
+
self.draw_state(&state)?;
|
|
1267
|
+
}
|
|
1268
|
+
if task.is_finished() {
|
|
1269
|
+
let mut still_revealing = false;
|
|
1270
|
+
if let Ok(mut state) = handle.state.lock() {
|
|
1271
|
+
state.finish_live_thought();
|
|
1272
|
+
state.finish_running_tools();
|
|
1273
|
+
if state.has_unfinished_assistant_stream() {
|
|
1274
|
+
state.flush_assistant_reveal();
|
|
1275
|
+
}
|
|
1276
|
+
still_revealing = state.has_pending_assistant_reveal();
|
|
1277
|
+
if !still_revealing {
|
|
1278
|
+
state.queued_count = 0;
|
|
1279
|
+
state.queued_preview = None;
|
|
1280
|
+
self.draw_state(&state)?;
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
if !still_revealing {
|
|
1284
|
+
return Ok(task.await?);
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
let poll_ms = if revealing { 18 } else { 30 };
|
|
1288
|
+
if event::poll(std::time::Duration::from_millis(poll_ms))? {
|
|
1289
|
+
match event::read()? {
|
|
1290
|
+
event::Event::Resize(_, _) => self.clear_mouse_selection(),
|
|
1291
|
+
event::Event::Mouse(mouse) => {
|
|
1292
|
+
if let Ok(mut state) = handle.state.lock() {
|
|
1293
|
+
if self.handle_selection_mouse(mouse, &mut state)? {
|
|
1294
|
+
continue;
|
|
1295
|
+
}
|
|
1296
|
+
route_mouse_wheel(
|
|
1297
|
+
&mut state,
|
|
1298
|
+
mouse.kind,
|
|
1299
|
+
Some(Position::new(mouse.column, mouse.row)),
|
|
1300
|
+
self.transcript_area,
|
|
1301
|
+
);
|
|
1302
|
+
}
|
|
1303
|
+
}
|
|
1304
|
+
event::Event::Paste(text) => {
|
|
1305
|
+
self.clear_mouse_selection();
|
|
1306
|
+
if let Ok(mut state) = handle.state.lock() {
|
|
1307
|
+
state.insert_paste(&text);
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
event::Event::Key(key) if key.kind == event::KeyEventKind::Press => {
|
|
1311
|
+
let mut selection_handled = false;
|
|
1312
|
+
if let Ok(mut state) = handle.state.lock() {
|
|
1313
|
+
if self.handle_tool_viewer_key(&mut state, key) {
|
|
1314
|
+
selection_handled = true;
|
|
1315
|
+
} else if let Some(dialog) = state.dialog.as_mut() {
|
|
1316
|
+
if let Some(answer) = dialog.handle_key(key) {
|
|
1317
|
+
if let Some(dialog) = state.dialog.take() {
|
|
1318
|
+
let _ = dialog.reply.send(answer);
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
selection_handled = true;
|
|
1322
|
+
} else if state.handle_thought_key(key) {
|
|
1323
|
+
selection_handled = true;
|
|
1324
|
+
} else if key.code == KeyCode::Char('c')
|
|
1325
|
+
&& key.modifiers.contains(KeyModifiers::CONTROL)
|
|
1326
|
+
&& self.copy_mouse_selection(&mut state)
|
|
1327
|
+
{
|
|
1328
|
+
selection_handled = true;
|
|
1329
|
+
} else if self.mouse_selection.range().is_some()
|
|
1330
|
+
&& matches!(key.code, KeyCode::Delete | KeyCode::Backspace)
|
|
1331
|
+
{
|
|
1332
|
+
if let Some((start, end)) = self.composer_selection_range(&state) {
|
|
1333
|
+
state.replace_composer(start..end, "");
|
|
1334
|
+
}
|
|
1335
|
+
self.clear_mouse_selection();
|
|
1336
|
+
selection_handled = true;
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
if selection_handled {
|
|
1340
|
+
continue;
|
|
1341
|
+
}
|
|
1342
|
+
self.clear_mouse_selection();
|
|
1343
|
+
if key.code == KeyCode::Esc
|
|
1344
|
+
|| (key.code == KeyCode::Char('c')
|
|
1345
|
+
&& key.modifiers.contains(KeyModifiers::CONTROL))
|
|
1346
|
+
{
|
|
1347
|
+
if task.is_finished() {
|
|
1348
|
+
if let Ok(mut state) = handle.state.lock() {
|
|
1349
|
+
state.flush_assistant_reveal();
|
|
1350
|
+
}
|
|
1351
|
+
} else {
|
|
1352
|
+
handle.interrupted.store(true, Ordering::Relaxed);
|
|
1353
|
+
}
|
|
1354
|
+
continue;
|
|
1355
|
+
}
|
|
1356
|
+
if let Ok(mut state) = handle.state.lock() {
|
|
1357
|
+
let size = self.terminal.size()?;
|
|
1358
|
+
let composer_width =
|
|
1359
|
+
state.composer_width(Rect::new(0, 0, size.width, size.height));
|
|
1360
|
+
if state.edit_composer_key(key) {
|
|
1361
|
+
continue;
|
|
1362
|
+
}
|
|
1363
|
+
match key.code {
|
|
1364
|
+
KeyCode::Char('d')
|
|
1365
|
+
if key.modifiers.contains(KeyModifiers::CONTROL) =>
|
|
1366
|
+
{
|
|
1367
|
+
if let Ok(mut queued) = handle.queued.lock() {
|
|
1368
|
+
queued.pop();
|
|
1369
|
+
state.queued_count = queued.len();
|
|
1370
|
+
state.queued_preview = queued.last().cloned();
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
KeyCode::Up | KeyCode::Down | KeyCode::Home | KeyCode::End
|
|
1374
|
+
if state.navigate_composer(key, composer_width) => {}
|
|
1375
|
+
KeyCode::End => state.scroll_from_bottom = 0,
|
|
1376
|
+
KeyCode::Enter => {
|
|
1377
|
+
if !state.composer.is_empty() {
|
|
1378
|
+
let text = state.take_prompt();
|
|
1379
|
+
if let Ok(mut queued) = handle.queued.lock() {
|
|
1380
|
+
queued.push(text);
|
|
1381
|
+
state.queued_count = queued.len();
|
|
1382
|
+
state.queued_preview = queued.last().cloned();
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
_ => {}
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
_ => {}
|
|
1391
|
+
}
|
|
1392
|
+
}
|
|
1393
|
+
tokio::task::yield_now().await;
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
pub fn suspend(&mut self) {
|
|
1397
|
+
if !self.active {
|
|
1398
|
+
return;
|
|
1399
|
+
}
|
|
1400
|
+
let _ = self.terminal.show_cursor();
|
|
1401
|
+
restore_terminal();
|
|
1402
|
+
self.active = false;
|
|
1403
|
+
}
|
|
1404
|
+
pub fn resume(&mut self) -> Result<()> {
|
|
1405
|
+
if self.active {
|
|
1406
|
+
return Ok(());
|
|
1407
|
+
}
|
|
1408
|
+
terminal::enable_raw_mode()?;
|
|
1409
|
+
let mut stdout = io::stdout();
|
|
1410
|
+
let setup = setup_terminal_output(&mut stdout);
|
|
1411
|
+
if let Err(error) = setup {
|
|
1412
|
+
restore_terminal();
|
|
1413
|
+
return Err(error.into());
|
|
1414
|
+
}
|
|
1415
|
+
if let Err(error) = self.terminal.clear() {
|
|
1416
|
+
restore_terminal();
|
|
1417
|
+
return Err(error.into());
|
|
1418
|
+
}
|
|
1419
|
+
self.active = true;
|
|
1420
|
+
Ok(())
|
|
1421
|
+
}
|
|
1422
|
+
}
|
|
1423
|
+
impl Drop for ChatTui {
|
|
1424
|
+
fn drop(&mut self) {
|
|
1425
|
+
self.suspend();
|
|
1426
|
+
}
|
|
1427
|
+
}
|