@pheem49/mint 1.14.0 → 1.15.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/CLAUDE.md +1 -1
- package/Cargo.lock +291 -11
- package/Cargo.toml +1 -1
- package/README.md +71 -9
- package/ROADMAP.md +30 -0
- package/Release_Note.md +579 -465
- package/crates/mint-cli/Cargo.toml +3 -1
- package/crates/mint-cli/src/agent/approval_prompts.rs +16 -3
- package/crates/mint-cli/src/agent/live_status.rs +367 -118
- package/crates/mint-cli/src/agent/markdown_render.rs +601 -61
- package/crates/mint-cli/src/agent.rs +452 -215
- package/crates/mint-cli/src/commands/agent.rs +16 -21
- package/crates/mint-cli/src/commands/eval.rs +9 -5
- package/crates/mint-cli/src/commands/git.rs +204 -0
- package/crates/mint-cli/src/commands/integrations.rs +28 -0
- package/crates/mint-cli/src/commands/knowledge.rs +1 -0
- package/crates/mint-cli/src/commands/mod.rs +37 -2
- package/crates/mint-cli/src/commands/tailnet_web.rs +235 -0
- package/crates/mint-cli/src/image.rs +26 -3
- package/crates/mint-cli/src/interactive/chat_tui.rs +4742 -0
- package/crates/mint-cli/src/interactive/command_ui.rs +477 -0
- package/crates/mint-cli/src/interactive/format.rs +8 -0
- package/crates/mint-cli/src/interactive/input_box.rs +38 -2
- package/crates/mint-cli/src/interactive/picker.rs +180 -37
- package/crates/mint-cli/src/interactive/resume_picker.rs +686 -0
- package/crates/mint-cli/src/interactive/slash_commands.rs +868 -450
- package/crates/mint-cli/src/interactive/thought_viewer.rs +286 -0
- package/crates/mint-cli/src/interactive.rs +400 -136
- package/crates/mint-cli/src/main.rs +84 -23
- package/crates/mint-cli/src/markdown.rs +12 -5
- package/crates/mint-cli/src/onboard.rs +32 -30
- package/crates/mint-cli/src/plugins_cli.rs +8 -5
- package/crates/mint-cli/src/setup.rs +10 -8
- package/crates/mint-cli/src/terminal_theme.rs +187 -0
- package/crates/mint-cli/src/updater.rs +56 -21
- package/crates/mint-core/src/agent/agent_loop.rs +1 -0
- package/crates/mint-core/src/agent/chat.rs +843 -177
- package/crates/mint-core/src/agent/code_tools.rs +83 -2
- package/crates/mint-core/src/agent/memory.rs +658 -20
- package/crates/mint-core/src/agent/skills.rs +1 -1
- package/crates/mint-core/src/api_server/routes/chat.rs +31 -5
- package/crates/mint-core/src/api_server/routes/linked_folders.rs +118 -3
- package/crates/mint-core/src/api_server/routes/misc.rs +10 -14
- package/crates/mint-core/src/api_server/routes/sessions.rs +44 -0
- package/crates/mint-core/src/api_server.rs +22 -3
- package/crates/mint-core/src/avatar_bridge.rs +2 -0
- package/crates/mint-core/src/browser/cdp.rs +74 -83
- package/crates/mint-core/src/browser/evidence.rs +260 -0
- package/crates/mint-core/src/browser/input.rs +1 -1
- package/crates/mint-core/src/browser/interact.rs +98 -124
- package/crates/mint-core/src/browser/lifecycle.rs +75 -4
- package/crates/mint-core/src/browser/mod.rs +16 -2
- package/crates/mint-core/src/browser/navigate.rs +27 -19
- package/crates/mint-core/src/browser/observe.js +40 -0
- package/crates/mint-core/src/browser/session.rs +1558 -0
- package/crates/mint-core/src/git/branches.rs +348 -0
- package/crates/mint-core/src/git/checkpoint.rs +40 -0
- package/crates/mint-core/src/git/diff.rs +206 -0
- package/crates/mint-core/src/git/mod.rs +10 -2
- package/crates/mint-core/src/integrations/channels.rs +1 -0
- package/crates/mint-core/src/lib.rs +22 -14
- package/crates/mint-core/src/live_sync.rs +28 -9
- package/crates/mint-core/src/media/auto_shorts.rs +1 -0
- package/crates/mint-core/src/media/gemini_live.rs +12 -1
- package/crates/mint-core/src/media/mic_transcribe.rs +1 -0
- package/crates/mint-core/src/media/subtitle.rs +1 -0
- package/crates/mint-core/src/orchestration/context_render.rs +1 -0
- package/crates/mint-core/src/orchestration/memory_skill.rs +6 -1
- package/crates/mint-core/src/orchestration/mod.rs +1024 -271
- package/crates/mint-core/src/orchestration/tools/browser.rs +16 -139
- package/crates/mint-core/src/orchestration/tools/misc.rs +2 -1
- package/crates/mint-core/src/orchestration/tools/web.rs +1 -1
- package/crates/mint-core/src/prompts/agent.rs +58 -29
- package/crates/mint-core/src/prompts/chat.rs +1 -1
- package/crates/mint-core/src/prompts/persona.rs +1 -1
- package/crates/mint-core/src/prompts/tool_catalog.rs +93 -25
- package/crates/mint-core/src/search/linked_folders/index.rs +732 -0
- package/crates/mint-core/src/search/linked_folders.rs +391 -130
- package/crates/mint-core/src/slash/mod.rs +470 -22
- package/crates/mint-core/src/slash/model_fetcher.rs +12 -3
- package/crates/mint-core/src/slash/models.rs +66 -10
- package/crates/mint-core/src/system/config.rs +230 -0
- package/crates/mint-core/src/system/workspace.rs +228 -0
- package/crates/mint-core/src/system.rs +1 -0
- package/crates/mint-core/tests/memory_persistence.rs +39 -0
- package/mint-presentation-demo.mp4 +0 -0
- package/out/web/assets/CliSessionsView-BxUVWEEL.js +1 -0
- package/out/web/assets/CliSessionsView-CBDTXuQv.css +1 -0
- package/out/web/assets/CodeReviewPage-DkMgfcos.css +1 -0
- package/out/web/assets/CodeReviewPage-jKlmLJwT.js +3 -0
- package/out/web/assets/CommandPalette-DnwPA5hy.js +1 -0
- package/out/web/assets/ImageStudioPanel-BR1XFwhR.js +1 -0
- package/out/web/assets/ImageStudioPanel-D0lnhQV5.css +1 -0
- package/out/web/assets/LinkedFoldersView-bi-CWQ-I.js +1 -0
- package/out/web/assets/McpRegistryPicker-D5tEFnyq.js +1 -0
- package/out/web/assets/McpServersView-BGG1dhFM.js +1 -0
- package/out/web/assets/MintDashboard-BIglDEWX.js +20 -0
- package/out/web/assets/MintDashboard-DSMywSgs.css +1 -0
- package/out/web/assets/ModelPanel-CbJ1PFoZ.js +1 -0
- package/out/web/assets/PicturesLibrary-CQP0fLP1.css +1 -0
- package/out/web/assets/PicturesLibrary-DoYN7T1p.js +1 -0
- package/out/web/assets/PluginsView-CU1HWXGk.js +1 -0
- package/out/web/assets/ScheduledTasksView-Bnl36y2N.js +1 -0
- package/out/web/assets/SettingsWindow-DhWLAn9T.css +1 -0
- package/out/web/assets/SettingsWindow-Dw8L01pw.js +2 -0
- package/out/web/assets/SkillsView-cnl8aY5p.js +2 -0
- package/out/web/assets/ToolSurfacePage-CgsQw6l5.css +1 -0
- package/out/web/assets/ToolSurfacePage-Cz2VJAPZ.js +37 -0
- package/out/web/assets/VeoStudioPanel-D4JnERWR.js +4 -0
- package/out/web/assets/VeoStudioPanel-DOj7_WR3.css +1 -0
- package/out/web/assets/WorkspacePanel-CbJ1PFoZ.js +1 -0
- package/out/web/assets/{abnfDiagram-VCTEODGH-DAOBA7ZG.js → abnfDiagram-VCTEODGH-ByMyfanq.js} +1 -1
- package/out/web/assets/{architecture-7GRP2DOG-CgSwQOPQ.js → architecture-7GRP2DOG-CLq2kEOB.js} +1 -1
- package/out/web/assets/{architectureDiagram-5GKGNRK7-CYp3yupP.js → architectureDiagram-5GKGNRK7-6PoVSmNG.js} +1 -1
- package/out/web/assets/{blockDiagram-NRAW4CY4-CyWybDWr.js → blockDiagram-NRAW4CY4-cKw9mAKi.js} +1 -1
- package/out/web/assets/{c4Diagram-UCG6FXSJ-BvY3U709.js → c4Diagram-UCG6FXSJ-Cqy8N5Ge.js} +1 -1
- package/out/web/assets/{chunk-75Z2AOVW-TLXCoZYv.js → chunk-75Z2AOVW-3qybijF5.js} +1 -1
- package/out/web/assets/chunk-CKBBP62Z-cIrXq6jN.js +2 -0
- package/out/web/assets/{chunk-CLGD4ZFX-xjsKtNS7.js → chunk-CLGD4ZFX-CndDQkww.js} +1 -1
- package/out/web/assets/chunk-DSNCTWBM-Cc4NxvgD.js +2 -0
- package/out/web/assets/chunk-DU6HZSFF-drzh6GsU.js +128 -0
- package/out/web/assets/{chunk-F27PBJKO-BFpgF55A.js → chunk-F27PBJKO-FiY35l4v.js} +1 -1
- package/out/web/assets/{chunk-G27WJ6UU-DfF7qW-C.js → chunk-G27WJ6UU-Bjt9Il4A.js} +1 -1
- package/out/web/assets/{chunk-GMAD6QVW-C-558kh_.js → chunk-GMAD6QVW-Bppi3Ctd.js} +1 -1
- package/out/web/assets/{chunk-JQ64N6SF-wJmeGKAw.js → chunk-JQ64N6SF-DGg5kcEV.js} +1 -1
- package/out/web/assets/{chunk-LCL6LL3I-C1wHD8Ie.js → chunk-LCL6LL3I-CCYcjd7p.js} +1 -1
- package/out/web/assets/{chunk-OBVCFTLP-BsRTPBqs.js → chunk-OBVCFTLP-DJeNil5M.js} +1 -1
- package/out/web/assets/{chunk-P2QGCYS3-HZIiM7Ni.js → chunk-P2QGCYS3-lRzkRjBB.js} +1 -1
- package/out/web/assets/{chunk-POPQ4Y6H-Dk9wvVb0.js → chunk-POPQ4Y6H-DouASMBW.js} +1 -1
- package/out/web/assets/{chunk-PWAF6VOD-BmjYLNbq.js → chunk-PWAF6VOD-DMmD1vVf.js} +1 -1
- package/out/web/assets/{chunk-R7TYR2AO-CaHIf-lK.js → chunk-R7TYR2AO-CYLA5UC5.js} +1 -1
- package/out/web/assets/{chunk-RHFEMEQ7-_T561hOU.js → chunk-RHFEMEQ7-BiXwEcUT.js} +1 -1
- package/out/web/assets/{chunk-SVP7TREG-CM-GGYoY.js → chunk-SVP7TREG-BV-zPslF.js} +1 -1
- package/out/web/assets/{chunk-TEH6E4GO-K2A8Vg2C.js → chunk-TEH6E4GO-B2RGEohZ.js} +1 -1
- package/out/web/assets/classDiagram-DTDB5LWJ-Dq0smRWk.js +1 -0
- package/out/web/assets/classDiagram-v2-JRS7N3AN-Dq0smRWk.js +1 -0
- package/out/web/assets/config-C-ZFtipU.css +1 -0
- package/out/web/assets/config-eEDngJXO.js +1 -0
- package/out/web/assets/core-hQ2VA9Ti.js +1 -0
- package/out/web/assets/{cynefin-OW5HDTMX-ClzaB6cc.js → cynefin-OW5HDTMX-Cas4csHM.js} +1 -1
- package/out/web/assets/{cynefinDiagram-5FMLGOSQ-D_JzZBzf.js → cynefinDiagram-5FMLGOSQ-Bbpj66Y3.js} +1 -1
- package/out/web/assets/{dagre-3AP2YEHR-BDuUeMHj.js → dagre-3AP2YEHR-B0-2RDEd.js} +1 -1
- package/out/web/assets/{diagram-S7CK7UJ4-DgtcfE8P.js → diagram-S7CK7UJ4-BdzEjUyH.js} +1 -1
- package/out/web/assets/{diagram-UQ7AKVKN-DTLoEYti.js → diagram-UQ7AKVKN-CJDwyPxF.js} +1 -1
- package/out/web/assets/{diagram-VSXAHHWV-ChGl9pXz.js → diagram-VSXAHHWV-BxaG1r_B.js} +1 -1
- package/out/web/assets/{diagram-VX7I27RA-Be8DWz0S.js → diagram-VX7I27RA-BMmUqm8f.js} +1 -1
- package/out/web/assets/{diagram-Z3DM3KII-BMXjRTOF.js → diagram-Z3DM3KII-CFtd03eE.js} +1 -1
- package/out/web/assets/dist-js-Bf2bhoku.js +1 -0
- package/out/web/assets/{ebnfDiagram-PWID7BFC-8Q9pl1CJ.js → ebnfDiagram-PWID7BFC-DwAen1hO.js} +1 -1
- package/out/web/assets/{erDiagram-SSCWMZ5O-DjH8Lnkn.js → erDiagram-SSCWMZ5O-BCZSHACj.js} +1 -1
- package/out/web/assets/event-ChBVpRy0.js +1 -0
- package/out/web/assets/{eventmodeling-NTZA5JFV-BKUH_DOp.js → eventmodeling-NTZA5JFV-XHStE4E_.js} +1 -1
- package/out/web/assets/fira-code-latin-600-normal-BmSSHshu.woff +0 -0
- package/out/web/assets/fira-code-latin-600-normal-CvYZpPHg.woff2 +0 -0
- package/out/web/assets/fira-code-symbols2-600-normal-Dvq6IQE5.woff +0 -0
- package/out/web/assets/flowDiagram-A5DVABFB-BLg7nEcd.js +1 -0
- package/out/web/assets/{ganttDiagram-EL5Y4UJY-D7fZKJNM.js → ganttDiagram-EL5Y4UJY-BAEu1Cql.js} +1 -1
- package/out/web/assets/{gitGraph-4MIJSDKK-BypWaaBU.js → gitGraph-4MIJSDKK-r32Vyper.js} +1 -1
- package/out/web/assets/{gitGraphDiagram-WWUBYQGX-DWiw_3bq.js → gitGraphDiagram-WWUBYQGX-z9o9qt6V.js} +1 -1
- package/out/web/assets/index-Btsf4L8M.css +1 -0
- package/out/web/assets/index-D8D9MeRA.js +11 -0
- package/out/web/assets/{info-A6RAGUB7-KkAUxT4j.js → info-A6RAGUB7-BvLaC2cw.js} +1 -1
- package/out/web/assets/{infoDiagram-RXCK75RN-BNb6E48y.js → infoDiagram-RXCK75RN-Be6WAXXw.js} +1 -1
- package/out/web/assets/{ishikawaDiagram-5VMMS53U-Caa-JoAK.js → ishikawaDiagram-5VMMS53U-DZjoHJHC.js} +1 -1
- package/out/web/assets/{journeyDiagram-EYS64GPL-DOrmFGz6.js → journeyDiagram-EYS64GPL-CtVkjkGm.js} +1 -1
- package/out/web/assets/{kanban-definition-3QL26DDD-BOWCYcK0.js → kanban-definition-3QL26DDD-CW5FMv1w.js} +1 -1
- package/out/web/assets/lucide-react-Ip3L6Jtn.js +1 -0
- package/out/web/assets/markdown-BSeeUbJH.js +38 -0
- package/out/web/assets/{mermaid-parser.core-BQqjCkS_.js → mermaid-parser.core-aUgCqsZ5.js} +3 -3
- package/out/web/assets/mermaid.core-D57sEiSL.js +11 -0
- package/out/web/assets/{mindmap-definition-FBJOCRG2-jTceWpr0.js → mindmap-definition-FBJOCRG2-DAmSpM3a.js} +1 -1
- package/out/web/assets/modelManager-tMVmJVAW.js +2 -0
- package/out/web/assets/oauthManager-9jxicDWJ.js +1 -0
- package/out/web/assets/{packet-AYTQ26CC-CJ5RXgol.js → packet-AYTQ26CC-DJ27iIoJ.js} +1 -1
- package/out/web/assets/{pegDiagram-XKGWAZYB-y8wMtd0y.js → pegDiagram-XKGWAZYB-Bj3ii-gS.js} +1 -1
- package/out/web/assets/{pie-WAS4IAKB-72fTBbl4.js → pie-WAS4IAKB-DG5mCUbc.js} +1 -1
- package/out/web/assets/{pieDiagram-E7YTZNPT-e0O02qWq.js → pieDiagram-E7YTZNPT-BrJLPnDA.js} +1 -1
- package/out/web/assets/prompt-latin-700-normal-BfbftDSq.woff +0 -0
- package/out/web/assets/prompt-latin-700-normal-I2gc831J.woff2 +0 -0
- package/out/web/assets/prompt-thai-700-normal-Cb5ilR-c.woff +0 -0
- package/out/web/assets/prompt-thai-700-normal-Cg4aQ0Nn.woff2 +0 -0
- package/out/web/assets/{quadrantDiagram-AXDQQJYC-C9phYLom.js → quadrantDiagram-AXDQQJYC-3x_TmF3j.js} +1 -1
- package/out/web/assets/{radar-RG4KPBEZ-BAU2hzUT.js → radar-RG4KPBEZ-CrXaTTuV.js} +1 -1
- package/out/web/assets/{railroad-74A4TZTK-B0bCAVHC.js → railroad-74A4TZTK-BpqMH9BE.js} +1 -1
- package/out/web/assets/{railroad-abnf-HS5TGJTU-WhxO7ndE.js → railroad-abnf-HS5TGJTU-DHI0uLlV.js} +1 -1
- package/out/web/assets/{railroad-ebnf-LZEXJU2U-BkA0m7-F.js → railroad-ebnf-LZEXJU2U-CQCb316y.js} +1 -1
- package/out/web/assets/{railroad-peg-WCYAUIDC-BsVpHIaj.js → railroad-peg-WCYAUIDC-Ph1giKkH.js} +1 -1
- package/out/web/assets/{railroadDiagram-O6MQD6OU-CyOLN65Q.js → railroadDiagram-O6MQD6OU-BRq6wIxx.js} +1 -1
- package/out/web/assets/{requirementDiagram-EFPCY7ZU-DQXJ7Dud.js → requirementDiagram-EFPCY7ZU-DIJj6G1g.js} +1 -1
- package/out/web/assets/{sankeyDiagram-P5KCCOFB-B2XLyIIc.js → sankeyDiagram-P5KCCOFB-DZajSryq.js} +1 -1
- package/out/web/assets/{sequenceDiagram-WJ2MYXX4-DGQY4wwm.js → sequenceDiagram-WJ2MYXX4-DxJCWyZS.js} +1 -1
- package/out/web/assets/{stateDiagram-HBIQ2CUA-DHZpDwNy.js → stateDiagram-HBIQ2CUA-k6voi8Vf.js} +1 -1
- package/out/web/assets/stateDiagram-v2-4QOOHH4V-DeEc0lGZ.js +1 -0
- package/out/web/assets/studio-B1mk40wD.js +1 -0
- package/out/web/assets/{swimlanes-XN3QIQJK-Bn_jcZz-.js → swimlanes-XN3QIQJK-igYhTjXB.js} +1 -1
- package/out/web/assets/swimlanesDiagram-VK2B7HYN-DpVik9v7.js +8 -0
- package/out/web/assets/{timeline-definition-24CTP7MA-CdTERuJZ.js → timeline-definition-24CTP7MA-Dke2p93p.js} +1 -1
- package/out/web/assets/{treeView-Q6P3EWNA-TKBKQG6R.js → treeView-Q6P3EWNA-hNELnXUs.js} +1 -1
- package/out/web/assets/{treemap-WGGIJYW6-BP7gQoiC.js → treemap-WGGIJYW6-D2B6wDsx.js} +1 -1
- package/out/web/assets/{vennDiagram-4TSXK5OY-BHUmxDuK.js → vennDiagram-4TSXK5OY-CDkW7rUP.js} +1 -1
- package/out/web/assets/{wardley-WFR3VGLG-9bct5AAN.js → wardley-WFR3VGLG-BECdXETi.js} +1 -1
- package/out/web/assets/{wardleyDiagram-VM6X3IG4-BfJwDDso.js → wardleyDiagram-VM6X3IG4-B5BycpQ4.js} +1 -1
- package/out/web/assets/window-5qYXKoW7.js +1 -0
- package/out/web/assets/{xychartDiagram-S5SC5T6Z-Dqd9Mvpo.js → xychartDiagram-S5SC5T6Z-CtJS3b--.js} +1 -1
- package/out/web/index-web.html +3 -4
- package/out/web/index.html +3 -4
- package/package.json +17 -6
- package/skills-lock.json +36 -0
- package/slash-commands.json +9 -0
- package/src/renderer/index-web.html +1 -0
- package/src/renderer/index.html +1 -0
- package/src/renderer/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -0
- package/src/renderer/shared/agentProgress.ts +168 -3
- package/src/renderer/shared/components/AgentActivityDrawer.tsx +6 -6
- package/src/renderer/shared/components/AgentActivityTable.tsx +192 -132
- package/src/renderer/shared/components/ArtifactPreviewPanel.tsx +4 -4
- package/src/renderer/shared/components/AuthGate.tsx +4 -9
- package/src/renderer/shared/components/CalculationCard.tsx +41 -15
- package/src/renderer/shared/components/ChatMessageItem.tsx +20 -21
- package/src/renderer/shared/components/ChatPanel.tsx +432 -193
- package/src/renderer/shared/components/ChunkErrorBoundary.tsx +198 -49
- package/src/renderer/shared/components/CliSessionsView.tsx +495 -0
- package/src/renderer/shared/components/CodeReviewPage.tsx +565 -0
- package/src/renderer/shared/components/CommandPalette.tsx +8 -8
- package/src/renderer/shared/components/DashboardSidebar.tsx +862 -125
- package/src/renderer/shared/components/DesktopTitlebar.tsx +345 -0
- package/src/renderer/shared/components/DiffReviewModal.tsx +3 -3
- package/src/renderer/shared/components/GitBranchSelector.tsx +442 -0
- package/src/renderer/shared/components/ImageGenCard.tsx +31 -12
- package/src/renderer/shared/components/ImageSearchCard.tsx +59 -38
- package/src/renderer/shared/components/ImageStudioPanel.tsx +40 -41
- package/src/renderer/shared/components/InlineThoughtNote.tsx +27 -0
- package/src/renderer/shared/components/LinkedFoldersView.tsx +365 -46
- package/src/renderer/shared/components/McpRegistryPicker.tsx +1 -1
- package/src/renderer/shared/components/McpServersView.tsx +24 -22
- package/src/renderer/shared/components/MermaidCard.tsx +14 -8
- package/src/renderer/shared/components/MintDashboard.tsx +1141 -508
- package/src/renderer/shared/components/ModelSelectorPopover.tsx +535 -214
- package/src/renderer/shared/components/PlanChecklistWidget.tsx +1 -1
- package/src/renderer/shared/components/PluginsView.tsx +1 -1
- package/src/renderer/shared/components/RewindModal.tsx +6 -6
- package/src/renderer/shared/components/RunSummaryDashboard.tsx +3 -3
- package/src/renderer/shared/components/ScheduledTasksView.tsx +4 -4
- package/src/renderer/shared/components/ScreenCaptureDialog.css +221 -0
- package/src/renderer/shared/components/ScreenCaptureDialog.tsx +199 -0
- package/src/renderer/shared/components/Settings/AgentsTab.tsx +34 -39
- package/src/renderer/shared/components/Settings/AudioTab.tsx +8 -8
- package/src/renderer/shared/components/Settings/AutomationTab.tsx +8 -58
- package/src/renderer/shared/components/Settings/AvatarCropModal.tsx +368 -0
- package/src/renderer/shared/components/Settings/GeneralTab.tsx +335 -81
- package/src/renderer/shared/components/Settings/MemoryTab.tsx +3 -3
- package/src/renderer/shared/components/Settings/PluginsTab.tsx +20 -12
- package/src/renderer/shared/components/Settings/ProfileTab.tsx +29 -5
- package/src/renderer/shared/components/Settings/SearchableModelCombobox.tsx +411 -0
- package/src/renderer/shared/components/Settings/ThemeTab.tsx +401 -158
- package/src/renderer/shared/components/SkillsView.tsx +41 -16
- package/src/renderer/shared/components/SlashSuggestions.tsx +3 -2
- package/src/renderer/shared/components/SourcesBlock.tsx +44 -32
- package/src/renderer/shared/components/StockCard.tsx +58 -24
- package/src/renderer/shared/components/SubagentDagView.tsx +4 -4
- package/src/renderer/shared/components/TerminalDock.tsx +241 -0
- package/src/renderer/shared/components/ThinkingBlock.tsx +14 -8
- package/src/renderer/shared/components/ToolSurfacePage.tsx +520 -0
- package/src/renderer/shared/components/UiFeatureCard.tsx +267 -0
- package/src/renderer/shared/components/UiGridCard.tsx +188 -0
- package/src/renderer/shared/components/UiMockupWidget.tsx +149 -0
- package/src/renderer/shared/components/VeoStudioPanel.tsx +13 -29
- package/src/renderer/shared/components/WeatherCard.tsx +3 -3
- package/src/renderer/shared/components/WorkspaceContextPopover.tsx +133 -0
- package/src/renderer/shared/components/WorkspaceSelector.tsx +149 -0
- package/src/renderer/shared/constants/config.ts +28 -3
- package/src/renderer/shared/constants/models.ts +189 -2
- package/src/renderer/shared/conversation/coordinator.test.ts +27 -0
- package/src/renderer/shared/conversation/coordinator.ts +82 -0
- package/src/renderer/shared/conversation/syncView.test.ts +46 -0
- package/src/renderer/shared/conversation/syncView.ts +43 -0
- package/src/renderer/shared/conversation/useConversationCoordinator.ts +106 -0
- package/src/renderer/shared/css/agent-observability.css +35 -3
- package/src/renderer/shared/css/auth-gate.css +2 -2
- package/src/renderer/shared/css/chat-ui-cards.css +495 -0
- package/src/renderer/shared/css/code-review.css +823 -0
- package/src/renderer/shared/css/code-sessions.css +452 -0
- package/src/renderer/shared/css/file-changes.css +132 -0
- package/src/renderer/shared/css/image-studio.css +16 -16
- package/src/renderer/shared/css/management-views.css +277 -27
- package/src/renderer/shared/css/model-selector.css +442 -42
- package/src/renderer/shared/css/settings/agents.css +1 -1
- package/src/renderer/shared/css/settings/automation.css +13 -13
- package/src/renderer/shared/css/settings/general.css +526 -5
- package/src/renderer/shared/css/settings/plugins.css +5 -5
- package/src/renderer/shared/css/settings/profile.css +331 -1
- package/src/renderer/shared/css/settings/theme.css +651 -3
- package/src/renderer/shared/css/veo-studio.css +16 -15
- package/src/renderer/shared/fonts.ts +19 -37
- package/src/renderer/shared/platform.test.ts +34 -0
- package/src/renderer/shared/platform.ts +173 -6
- package/src/renderer/shared/theme/themeManager.ts +144 -0
- package/src/renderer/shared/theme/themes.ts +116 -0
- package/src/renderer/shared/theme/tokens.css +318 -0
- package/src/renderer/shared/types.ts +82 -1
- package/src/renderer/shared/utils/agentActivity.ts +126 -5
- package/src/renderer/shared/utils/cardJson.test.ts +35 -0
- package/src/renderer/shared/utils/cardJson.ts +30 -0
- package/src/renderer/shared/utils/fileIcons.ts +1 -1
- package/src/renderer/shared/utils/markdown.tsx +329 -80
- package/src/renderer/shared/utils/markdown.webImages.test.tsx +40 -0
- package/src/renderer/shared/utils/providers.ts +8 -3
- package/src/renderer/shared/utils/screenCapture.ts +43 -0
- package/src/renderer/shared/utils/slashCommandProcessor.ts +4 -1
- package/src/renderer/shared/utils/ui.ts +4 -64
- package/src/renderer/src/App.tsx +7 -0
- package/src/renderer/src/components/BrowserShell.tsx +108 -0
- package/src/renderer/src/components/BrowserSuggestionsPopup.tsx +91 -0
- package/src/renderer/src/components/Live2DStage.tsx +32 -9
- package/src/renderer/src/components/MintDashboard.tsx +4 -2
- package/src/renderer/src/components/ModelPanel.tsx +2 -1
- package/src/renderer/src/components/PicturesLibrary.tsx +3 -2
- package/src/renderer/src/components/ScreenPicker.css +190 -0
- package/src/renderer/src/components/ScreenPicker.tsx +185 -540
- package/src/renderer/src/components/SettingsWindow.tsx +40 -2
- package/src/renderer/src/components/SpotlightWindow.tsx +1 -0
- package/src/renderer/src/components/WidgetWindow.tsx +27 -3
- package/src/renderer/src/components/WorkspacePanel.tsx +61 -43
- package/src/renderer/src/components/browser-shell.css +185 -0
- package/src/renderer/src/components/browser-suggestions-popup.css +55 -0
- package/src/renderer/src/components/liveTranslateFrames.test.ts +23 -0
- package/src/renderer/src/components/liveTranslateFrames.ts +34 -0
- package/src/renderer/src/css/app-shell.css +394 -113
- package/src/renderer/src/css/chat.css +1926 -380
- package/src/renderer/src/css/dashboard.css +11 -0
- package/src/renderer/src/css/desktop-tools.css +730 -0
- package/src/renderer/src/css/misc.css +19 -22
- package/src/renderer/src/css/model.css +49 -48
- package/src/renderer/src/css/pictures.css +144 -136
- package/src/renderer/src/css/settings/base.css +357 -123
- package/src/renderer/src/css/sidebar-workspace.css +930 -291
- package/src/renderer/src/css/spotlight.css +15 -26
- package/src/renderer/src/css/tool-surfaces.css +728 -0
- package/src/renderer/src/css/widget.css +35 -7
- package/src/renderer/src/env.d.ts +3 -0
- package/src/renderer/src/hooks/useProviderModels.ts +2 -9
- package/src/renderer/src/index.css +53 -46
- package/src/renderer/src/main.tsx +11 -0
- package/src/renderer/src/tauri.ts +201 -30
- package/src/renderer/src-web/App.tsx +40 -0
- package/src/renderer/src-web/components/MintDashboard.tsx +4 -2
- package/src/renderer/src-web/components/PicturesLibrary.tsx +3 -2
- package/src/renderer/src-web/components/PullToRefresh.tsx +107 -0
- package/src/renderer/src-web/components/SettingsWindow.tsx +28 -2
- package/src/renderer/src-web/css/app-shell.css +174 -96
- package/src/renderer/src-web/css/chat.css +1519 -316
- package/src/renderer/src-web/css/dashboard.css +11 -0
- package/src/renderer/src-web/css/misc.css +17 -17
- package/src/renderer/src-web/css/mobile.css +678 -0
- package/src/renderer/src-web/css/model.css +46 -46
- package/src/renderer/src-web/css/pictures.css +81 -34
- package/src/renderer/src-web/css/pull-to-refresh.css +54 -0
- package/src/renderer/src-web/css/settings/base.css +316 -100
- package/src/renderer/src-web/css/settings/mobile.css +320 -0
- package/src/renderer/src-web/css/sidebar-workspace.css +545 -100
- package/src/renderer/src-web/css/spotlight.css +9 -26
- package/src/renderer/src-web/css/widget.css +0 -5
- package/src/renderer/src-web/env.d.ts +3 -0
- package/src/renderer/src-web/hooks/useProviderModels.ts +2 -9
- package/src/renderer/src-web/index.css +53 -96
- package/src/renderer/src-web/main.tsx +11 -0
- package/src/renderer/src-web/tauri.ts +200 -30
- package/vite.config.web.ts +1 -0
- package/out/web/assets/MintDashboard-DWSqucgb.js +0 -57
- package/out/web/assets/SettingsWindow-DFM2aj5B.js +0 -2
- package/out/web/assets/chunk-CKBBP62Z-nr1uKPj9.js +0 -2
- package/out/web/assets/chunk-DSNCTWBM-Dtj8Rqsd.js +0 -2
- package/out/web/assets/chunk-DU6HZSFF-2tv5K1wT.js +0 -128
- package/out/web/assets/classDiagram-DTDB5LWJ-BdSFArgw.js +0 -1
- package/out/web/assets/classDiagram-v2-JRS7N3AN-BdSFArgw.js +0 -1
- package/out/web/assets/core-DImejIUG.js +0 -1
- package/out/web/assets/dist-js-BxuKEVWM.js +0 -1
- package/out/web/assets/event-BNl8Zahw.js +0 -1
- package/out/web/assets/fira-code-cyrillic-400-normal-UC0NFL4U.woff2 +0 -0
- package/out/web/assets/fira-code-cyrillic-400-normal-dc1q3VD7.woff +0 -0
- package/out/web/assets/fira-code-cyrillic-500-normal-Bu7VCL72.woff +0 -0
- package/out/web/assets/fira-code-cyrillic-500-normal-CX35h3Mg.woff2 +0 -0
- package/out/web/assets/fira-code-cyrillic-ext-400-normal-Buh61xzB.woff +0 -0
- package/out/web/assets/fira-code-cyrillic-ext-400-normal-txZ9Fk_1.woff2 +0 -0
- package/out/web/assets/fira-code-cyrillic-ext-500-normal-CYRspHgm.woff2 +0 -0
- package/out/web/assets/fira-code-cyrillic-ext-500-normal-CwtLmSFD.woff +0 -0
- package/out/web/assets/fira-code-greek-400-normal-B2Gh_Y8s.woff2 +0 -0
- package/out/web/assets/fira-code-greek-400-normal-DobhaxvF.woff +0 -0
- package/out/web/assets/fira-code-greek-500-normal-CVO0IRNt.woff2 +0 -0
- package/out/web/assets/fira-code-greek-500-normal-DEXIWiey.woff +0 -0
- package/out/web/assets/fira-code-greek-ext-400-normal-DR7mBgIM.woff2 +0 -0
- package/out/web/assets/fira-code-greek-ext-400-normal-DSPUheWg.woff +0 -0
- package/out/web/assets/fira-code-greek-ext-500-normal-BO3iq16n.woff2 +0 -0
- package/out/web/assets/fira-code-greek-ext-500-normal-CMiNLXER.woff +0 -0
- package/out/web/assets/fira-code-latin-ext-400-normal-DG73JjOf.woff +0 -0
- package/out/web/assets/fira-code-latin-ext-400-normal-KSMg0QLl.woff2 +0 -0
- package/out/web/assets/fira-code-latin-ext-500-normal-CaANqXjI.woff +0 -0
- package/out/web/assets/fira-code-latin-ext-500-normal-Crd9e_oI.woff2 +0 -0
- package/out/web/assets/flowDiagram-A5DVABFB-BpnHUSU7.js +0 -1
- package/out/web/assets/index-CVRg270z.css +0 -1
- package/out/web/assets/index-DxZQr9yD.js +0 -10
- package/out/web/assets/inter-cyrillic-400-normal-HOLc17fK.woff +0 -0
- package/out/web/assets/inter-cyrillic-400-normal-obahsSVq.woff2 +0 -0
- package/out/web/assets/inter-cyrillic-500-normal-BasfLYem.woff2 +0 -0
- package/out/web/assets/inter-cyrillic-500-normal-CxZf_p3X.woff +0 -0
- package/out/web/assets/inter-cyrillic-600-normal-4D_pXhcN.woff +0 -0
- package/out/web/assets/inter-cyrillic-600-normal-CWCymEST.woff2 +0 -0
- package/out/web/assets/inter-cyrillic-ext-400-normal-BQZuk6qB.woff2 +0 -0
- package/out/web/assets/inter-cyrillic-ext-400-normal-DQukG94-.woff +0 -0
- package/out/web/assets/inter-cyrillic-ext-500-normal-B0yAr1jD.woff2 +0 -0
- package/out/web/assets/inter-cyrillic-ext-500-normal-BmqWE9Dz.woff +0 -0
- package/out/web/assets/inter-cyrillic-ext-600-normal-Bcila6Z-.woff +0 -0
- package/out/web/assets/inter-cyrillic-ext-600-normal-Dfes3d0z.woff2 +0 -0
- package/out/web/assets/inter-greek-400-normal-B4URO6DV.woff2 +0 -0
- package/out/web/assets/inter-greek-400-normal-q2sYcFCs.woff +0 -0
- package/out/web/assets/inter-greek-500-normal-BIZE56-Y.woff2 +0 -0
- package/out/web/assets/inter-greek-500-normal-Xzm54t5V.woff +0 -0
- package/out/web/assets/inter-greek-600-normal-BZpKdvQh.woff +0 -0
- package/out/web/assets/inter-greek-600-normal-plRanbMR.woff2 +0 -0
- package/out/web/assets/inter-greek-ext-400-normal-DGGRlc-M.woff2 +0 -0
- package/out/web/assets/inter-greek-ext-400-normal-KugGGMne.woff +0 -0
- package/out/web/assets/inter-greek-ext-500-normal-2j5mBUwD.woff +0 -0
- package/out/web/assets/inter-greek-ext-500-normal-C4iEst2y.woff2 +0 -0
- package/out/web/assets/inter-greek-ext-600-normal-B8X0CLgF.woff +0 -0
- package/out/web/assets/inter-greek-ext-600-normal-DRtmH8MT.woff2 +0 -0
- package/out/web/assets/inter-latin-400-normal-C38fXH4l.woff2 +0 -0
- package/out/web/assets/inter-latin-400-normal-CyCys3Eg.woff +0 -0
- package/out/web/assets/inter-latin-500-normal-BL9OpVg8.woff +0 -0
- package/out/web/assets/inter-latin-500-normal-Cerq10X2.woff2 +0 -0
- package/out/web/assets/inter-latin-600-normal-CiBQ2DWP.woff +0 -0
- package/out/web/assets/inter-latin-600-normal-LgqL8muc.woff2 +0 -0
- package/out/web/assets/inter-latin-ext-400-normal-77YHD8bZ.woff +0 -0
- package/out/web/assets/inter-latin-ext-400-normal-C1nco2VV.woff2 +0 -0
- package/out/web/assets/inter-latin-ext-500-normal-BxGbmqWO.woff +0 -0
- package/out/web/assets/inter-latin-ext-500-normal-CV4jyFjo.woff2 +0 -0
- package/out/web/assets/inter-latin-ext-600-normal-CIVaiw4L.woff +0 -0
- package/out/web/assets/inter-latin-ext-600-normal-D2bJ5OIk.woff2 +0 -0
- package/out/web/assets/inter-vietnamese-400-normal-Bbgyi5SW.woff +0 -0
- package/out/web/assets/inter-vietnamese-400-normal-DMkecbls.woff2 +0 -0
- package/out/web/assets/inter-vietnamese-500-normal-DOriooB6.woff2 +0 -0
- package/out/web/assets/inter-vietnamese-500-normal-mJboJaSs.woff +0 -0
- package/out/web/assets/inter-vietnamese-600-normal-BuLX-rYi.woff +0 -0
- package/out/web/assets/inter-vietnamese-600-normal-Cc8MFFhd.woff2 +0 -0
- package/out/web/assets/kanit-latin-400-normal-BUlsQXH3.woff2 +0 -0
- package/out/web/assets/kanit-latin-400-normal-HVZWrfev.woff +0 -0
- package/out/web/assets/kanit-latin-500-normal-CX_4XcKi.woff2 +0 -0
- package/out/web/assets/kanit-latin-500-normal-qBha86O4.woff +0 -0
- package/out/web/assets/kanit-latin-600-normal-0lS78yAd.woff2 +0 -0
- package/out/web/assets/kanit-latin-600-normal-DlacpeTg.woff +0 -0
- package/out/web/assets/kanit-latin-ext-400-normal-B2xPf58u.woff2 +0 -0
- package/out/web/assets/kanit-latin-ext-400-normal-CHvNKHHD.woff +0 -0
- package/out/web/assets/kanit-latin-ext-500-normal-BFdWrG22.woff +0 -0
- package/out/web/assets/kanit-latin-ext-500-normal-EHs3suD6.woff2 +0 -0
- package/out/web/assets/kanit-latin-ext-600-normal-BBDzoLaj.woff +0 -0
- package/out/web/assets/kanit-latin-ext-600-normal-DAX3wtuq.woff2 +0 -0
- package/out/web/assets/kanit-thai-400-normal-D2nliXKa.woff +0 -0
- package/out/web/assets/kanit-thai-400-normal-D80Pglro.woff2 +0 -0
- package/out/web/assets/kanit-thai-500-normal-BB8gri04.woff2 +0 -0
- package/out/web/assets/kanit-thai-500-normal-Iy_w0a80.woff +0 -0
- package/out/web/assets/kanit-thai-600-normal-Bj6oiaDc.woff2 +0 -0
- package/out/web/assets/kanit-thai-600-normal-wbTlPO7I.woff +0 -0
- package/out/web/assets/kanit-vietnamese-400-normal-DRI8YWyb.woff2 +0 -0
- package/out/web/assets/kanit-vietnamese-400-normal-dow6Bnto.woff +0 -0
- package/out/web/assets/kanit-vietnamese-500-normal-BzTrpCM3.woff2 +0 -0
- package/out/web/assets/kanit-vietnamese-500-normal-T1ndT7MF.woff +0 -0
- package/out/web/assets/kanit-vietnamese-600-normal-Bi7fw3I4.woff2 +0 -0
- package/out/web/assets/kanit-vietnamese-600-normal-DXCRAa_8.woff +0 -0
- package/out/web/assets/mali-latin-400-normal-ByPcZ8Gx.woff +0 -0
- package/out/web/assets/mali-latin-400-normal-Cuc6Ykl8.woff2 +0 -0
- package/out/web/assets/mali-latin-500-normal-B01M-LP6.woff2 +0 -0
- package/out/web/assets/mali-latin-500-normal-Thgqw_9f.woff +0 -0
- package/out/web/assets/mali-latin-600-normal-B9TiUNpT.woff2 +0 -0
- package/out/web/assets/mali-latin-600-normal-CycpQCwU.woff +0 -0
- package/out/web/assets/mali-latin-ext-400-normal-DUVdJQO4.woff +0 -0
- package/out/web/assets/mali-latin-ext-400-normal-iCG1ALuJ.woff2 +0 -0
- package/out/web/assets/mali-latin-ext-500-normal-BfJE4UMZ.woff2 +0 -0
- package/out/web/assets/mali-latin-ext-500-normal-FoLEyOKS.woff +0 -0
- package/out/web/assets/mali-latin-ext-600-normal-BTvIfiCp.woff2 +0 -0
- package/out/web/assets/mali-latin-ext-600-normal-DAQcLVmD.woff +0 -0
- package/out/web/assets/mali-thai-400-normal-BO7A3bLZ.woff2 +0 -0
- package/out/web/assets/mali-thai-400-normal-CX9VrjTn.woff +0 -0
- package/out/web/assets/mali-thai-500-normal-Cph2qha9.woff +0 -0
- package/out/web/assets/mali-thai-500-normal-D89rMT77.woff2 +0 -0
- package/out/web/assets/mali-thai-600-normal-DPgXT6rZ.woff +0 -0
- package/out/web/assets/mali-thai-600-normal-DlTx3OsB.woff2 +0 -0
- package/out/web/assets/mali-vietnamese-400-normal-DUKxzXaz.woff2 +0 -0
- package/out/web/assets/mali-vietnamese-400-normal-gFDLvsOK.woff +0 -0
- package/out/web/assets/mali-vietnamese-500-normal--OY07q2c.woff +0 -0
- package/out/web/assets/mali-vietnamese-500-normal-KDrNRwfW.woff2 +0 -0
- package/out/web/assets/mali-vietnamese-600-normal-CtTMUU7T.woff +0 -0
- package/out/web/assets/mali-vietnamese-600-normal-DFlJr66u.woff2 +0 -0
- package/out/web/assets/mermaid.core-DYGGlqOf.js +0 -11
- package/out/web/assets/mitr-latin-400-normal-Cb18vPmZ.woff +0 -0
- package/out/web/assets/mitr-latin-400-normal-CwbkLQ4a.woff2 +0 -0
- package/out/web/assets/mitr-latin-500-normal-B4JOhzAi.woff +0 -0
- package/out/web/assets/mitr-latin-500-normal-BmClOow2.woff2 +0 -0
- package/out/web/assets/mitr-latin-ext-400-normal-B3CPG7Yo.woff2 +0 -0
- package/out/web/assets/mitr-latin-ext-400-normal-DTx65hiC.woff +0 -0
- package/out/web/assets/mitr-latin-ext-500-normal-B_Diajz1.woff2 +0 -0
- package/out/web/assets/mitr-latin-ext-500-normal-DYOsVaVT.woff +0 -0
- package/out/web/assets/mitr-thai-400-normal-CS4Do6aM.woff +0 -0
- package/out/web/assets/mitr-thai-400-normal-CXWaAdVj.woff2 +0 -0
- package/out/web/assets/mitr-thai-500-normal-CVdBrEVH.woff2 +0 -0
- package/out/web/assets/mitr-thai-500-normal-CW_B5D-i.woff +0 -0
- package/out/web/assets/mitr-vietnamese-400-normal-CPMGWyoC.woff2 +0 -0
- package/out/web/assets/mitr-vietnamese-400-normal-Z6XhIpdY.woff +0 -0
- package/out/web/assets/mitr-vietnamese-500-normal-CDrv0585.woff2 +0 -0
- package/out/web/assets/mitr-vietnamese-500-normal-CMQWyq-Z.woff +0 -0
- package/out/web/assets/noto-sans-thai-latin-400-normal-BaWBrqFP.woff2 +0 -0
- package/out/web/assets/noto-sans-thai-latin-400-normal-Dh_FJjOB.woff +0 -0
- package/out/web/assets/noto-sans-thai-latin-500-normal-BC04jsmm.woff +0 -0
- package/out/web/assets/noto-sans-thai-latin-500-normal-fyBKClF1.woff2 +0 -0
- package/out/web/assets/noto-sans-thai-latin-600-normal-CemcjnVR.woff2 +0 -0
- package/out/web/assets/noto-sans-thai-latin-600-normal-Dbc-dNO6.woff +0 -0
- package/out/web/assets/noto-sans-thai-latin-ext-400-normal-B-1H0YkH.woff +0 -0
- package/out/web/assets/noto-sans-thai-latin-ext-400-normal-nBP59pVw.woff2 +0 -0
- package/out/web/assets/noto-sans-thai-latin-ext-500-normal-B-ZWb8SZ.woff2 +0 -0
- package/out/web/assets/noto-sans-thai-latin-ext-500-normal-CrEHO7C8.woff +0 -0
- package/out/web/assets/noto-sans-thai-latin-ext-600-normal-PkMZo0xa.woff +0 -0
- package/out/web/assets/noto-sans-thai-latin-ext-600-normal-maHHBsez.woff2 +0 -0
- package/out/web/assets/noto-sans-thai-thai-400-normal-BEOmKAI1.woff2 +0 -0
- package/out/web/assets/noto-sans-thai-thai-400-normal-Dxb_unuU.woff +0 -0
- package/out/web/assets/noto-sans-thai-thai-500-normal-BOGXO2tw.woff +0 -0
- package/out/web/assets/noto-sans-thai-thai-500-normal-CU_X86GQ.woff2 +0 -0
- package/out/web/assets/noto-sans-thai-thai-600-normal-CmgB8_JK.woff +0 -0
- package/out/web/assets/noto-sans-thai-thai-600-normal-Cs73sVjl.woff2 +0 -0
- package/out/web/assets/oauthManager-DNiwM8Rn.js +0 -2
- package/out/web/assets/oauthManager-DuamS1Av.css +0 -1
- package/out/web/assets/outfit-latin-300-normal-AWLfuCom.woff +0 -0
- package/out/web/assets/outfit-latin-300-normal-CRYTwY6m.woff2 +0 -0
- package/out/web/assets/outfit-latin-400-normal-BGsTXAXT.woff2 +0 -0
- package/out/web/assets/outfit-latin-400-normal-DMwTpYkH.woff +0 -0
- package/out/web/assets/outfit-latin-500-normal-ClnHRwRh.woff +0 -0
- package/out/web/assets/outfit-latin-500-normal-DKnIMDSk.woff2 +0 -0
- package/out/web/assets/outfit-latin-600-normal-B7SfZ07L.woff2 +0 -0
- package/out/web/assets/outfit-latin-600-normal-BEfTtDA7.woff +0 -0
- package/out/web/assets/outfit-latin-ext-300-normal-BYS6Dpvq.woff2 +0 -0
- package/out/web/assets/outfit-latin-ext-300-normal-CMIMshEd.woff +0 -0
- package/out/web/assets/outfit-latin-ext-400-normal-5tcqmc2S.woff2 +0 -0
- package/out/web/assets/outfit-latin-ext-400-normal-DHm7mdGe.woff +0 -0
- package/out/web/assets/outfit-latin-ext-500-normal-DrCvqoFD.woff +0 -0
- package/out/web/assets/outfit-latin-ext-500-normal-zeox_O30.woff2 +0 -0
- package/out/web/assets/outfit-latin-ext-600-normal-B85nYjL1.woff2 +0 -0
- package/out/web/assets/outfit-latin-ext-600-normal-CWJcPgd7.woff +0 -0
- package/out/web/assets/preload-helper-D0uHx7FM.js +0 -1
- package/out/web/assets/prompt-latin-ext-400-normal-1pHbN9uy.woff +0 -0
- package/out/web/assets/prompt-latin-ext-400-normal-DdSafGZ9.woff2 +0 -0
- package/out/web/assets/prompt-latin-ext-500-normal--EZ1um7s.woff2 +0 -0
- package/out/web/assets/prompt-latin-ext-500-normal-D-lI1EVT.woff +0 -0
- package/out/web/assets/prompt-latin-ext-600-normal-C8b50x67.woff +0 -0
- package/out/web/assets/prompt-latin-ext-600-normal-Cg9L7iJU.woff2 +0 -0
- package/out/web/assets/prompt-vietnamese-400-normal-BCPzsgPT.woff2 +0 -0
- package/out/web/assets/prompt-vietnamese-400-normal-D4pLyeNK.woff +0 -0
- package/out/web/assets/prompt-vietnamese-500-normal-DmzxmPwa.woff2 +0 -0
- package/out/web/assets/prompt-vietnamese-500-normal-w_sS_j2F.woff +0 -0
- package/out/web/assets/prompt-vietnamese-600-normal-1dyohtNh.woff +0 -0
- package/out/web/assets/prompt-vietnamese-600-normal-7QWjJBsF.woff2 +0 -0
- package/out/web/assets/sarabun-latin-400-normal-DmguIS-7.woff +0 -0
- package/out/web/assets/sarabun-latin-400-normal-URPBxl-K.woff2 +0 -0
- package/out/web/assets/sarabun-latin-500-normal-BjUTcdxu.woff2 +0 -0
- package/out/web/assets/sarabun-latin-500-normal-CJexTAnl.woff +0 -0
- package/out/web/assets/sarabun-latin-600-normal-9FonlkKx.woff +0 -0
- package/out/web/assets/sarabun-latin-600-normal-DMD3TROr.woff2 +0 -0
- package/out/web/assets/sarabun-latin-ext-400-normal-BbP7GpLL.woff2 +0 -0
- package/out/web/assets/sarabun-latin-ext-400-normal-BsmTn0SS.woff +0 -0
- package/out/web/assets/sarabun-latin-ext-500-normal-Cot16Bd2.woff +0 -0
- package/out/web/assets/sarabun-latin-ext-500-normal-DE1LysqI.woff2 +0 -0
- package/out/web/assets/sarabun-latin-ext-600-normal-0tXu9x_i.woff +0 -0
- package/out/web/assets/sarabun-latin-ext-600-normal-BRxjKUQ6.woff2 +0 -0
- package/out/web/assets/sarabun-thai-400-normal-C2DaJlKK.woff2 +0 -0
- package/out/web/assets/sarabun-thai-400-normal-CH-UbWgg.woff +0 -0
- package/out/web/assets/sarabun-thai-500-normal-BVssjame.woff2 +0 -0
- package/out/web/assets/sarabun-thai-500-normal-C3iDLEzi.woff +0 -0
- package/out/web/assets/sarabun-thai-600-normal-3dIAQ-_s.woff2 +0 -0
- package/out/web/assets/sarabun-thai-600-normal-DWKeTe6a.woff +0 -0
- package/out/web/assets/sarabun-vietnamese-400-normal-DPfkSCMy.woff +0 -0
- package/out/web/assets/sarabun-vietnamese-400-normal-igdrzAGY.woff2 +0 -0
- package/out/web/assets/sarabun-vietnamese-500-normal-CpRVvGRU.woff +0 -0
- package/out/web/assets/sarabun-vietnamese-500-normal-Dpe7Br9m.woff2 +0 -0
- package/out/web/assets/sarabun-vietnamese-600-normal-BMbOgAW-.woff +0 -0
- package/out/web/assets/sarabun-vietnamese-600-normal-DkxrOlLB.woff2 +0 -0
- package/out/web/assets/stateDiagram-v2-4QOOHH4V-s6P9g2_b.js +0 -1
- package/out/web/assets/swimlanesDiagram-VK2B7HYN-CV9fOLrV.js +0 -8
- package/out/web/assets/tauri-CNrHQ2Gb.js +0 -3
- package/out/web/assets/window-DkIhgI7B.js +0 -1
|
@@ -0,0 +1,732 @@
|
|
|
1
|
+
//! Local, folder-scoped document index and durable note ledger.
|
|
2
|
+
use std::collections::{HashMap, HashSet};
|
|
3
|
+
use std::fs::{self, OpenOptions};
|
|
4
|
+
use std::io::{Read, Write};
|
|
5
|
+
use std::path::Path;
|
|
6
|
+
use std::time::UNIX_EPOCH;
|
|
7
|
+
|
|
8
|
+
use chrono::Local;
|
|
9
|
+
use ignore::WalkBuilder;
|
|
10
|
+
use rusqlite::{Connection, OptionalExtension, params};
|
|
11
|
+
use uuid::Uuid;
|
|
12
|
+
|
|
13
|
+
use super::{LinkedFolder, LinkedFolderNote, LinkedFolderStatus};
|
|
14
|
+
use crate::search::text_embedding::{
|
|
15
|
+
cosine_similarity, decode_embedding, embedding, encode_embedding,
|
|
16
|
+
};
|
|
17
|
+
use crate::{Capability, MintConfig, assert_path_capability, extract_document_text, memory_path};
|
|
18
|
+
|
|
19
|
+
const MAX_FILE_BYTES: u64 = 10 * 1024 * 1024;
|
|
20
|
+
const CHUNK_CHARS: usize = 1000;
|
|
21
|
+
const CHUNK_OVERLAP: usize = 200;
|
|
22
|
+
|
|
23
|
+
fn db() -> Result<Connection, String> {
|
|
24
|
+
let path = memory_path().map_err(|e| e.to_string())?;
|
|
25
|
+
if let Some(parent) = path.parent() {
|
|
26
|
+
fs::create_dir_all(parent).map_err(|e| e.to_string())?;
|
|
27
|
+
}
|
|
28
|
+
let conn = Connection::open(path).map_err(|e| e.to_string())?;
|
|
29
|
+
conn.busy_timeout(std::time::Duration::from_secs(5))
|
|
30
|
+
.map_err(|e| e.to_string())?;
|
|
31
|
+
conn.execute_batch(
|
|
32
|
+
"CREATE TABLE IF NOT EXISTS linked_folder_files (
|
|
33
|
+
folder TEXT NOT NULL, root TEXT NOT NULL, path TEXT NOT NULL,
|
|
34
|
+
mtime INTEGER NOT NULL, bytes INTEGER NOT NULL, PRIMARY KEY(folder, root, path));
|
|
35
|
+
CREATE TABLE IF NOT EXISTS linked_folder_chunks (
|
|
36
|
+
folder TEXT NOT NULL, root TEXT NOT NULL, path TEXT NOT NULL,
|
|
37
|
+
ordinal INTEGER NOT NULL, text TEXT NOT NULL, embedding BLOB NOT NULL,
|
|
38
|
+
PRIMARY KEY(folder, root, path, ordinal));
|
|
39
|
+
CREATE INDEX IF NOT EXISTS idx_linked_chunks_folder ON linked_folder_chunks(folder, root);
|
|
40
|
+
CREATE TABLE IF NOT EXISTS linked_folder_index_status (
|
|
41
|
+
folder TEXT NOT NULL, root TEXT NOT NULL, indexed_at TEXT, error TEXT,
|
|
42
|
+
PRIMARY KEY(folder, root));
|
|
43
|
+
CREATE TABLE IF NOT EXISTS linked_folder_notes (
|
|
44
|
+
id TEXT PRIMARY KEY, job_id TEXT, folder TEXT NOT NULL, root TEXT NOT NULL,
|
|
45
|
+
path TEXT NOT NULL, content TEXT NOT NULL, created_at TEXT NOT NULL,
|
|
46
|
+
status TEXT NOT NULL, error TEXT,
|
|
47
|
+
UNIQUE(job_id, folder, root));
|
|
48
|
+
CREATE INDEX IF NOT EXISTS idx_linked_notes_folder ON linked_folder_notes(folder, root, created_at);
|
|
49
|
+
CREATE TABLE IF NOT EXISTS linked_folder_jobs (
|
|
50
|
+
id TEXT PRIMARY KEY, user_text TEXT NOT NULL, ai_text TEXT NOT NULL,
|
|
51
|
+
status TEXT NOT NULL, attempts INTEGER NOT NULL DEFAULT 0,
|
|
52
|
+
error TEXT, created_at TEXT NOT NULL, claimed_at INTEGER);"
|
|
53
|
+
).map_err(|e| e.to_string())?;
|
|
54
|
+
Ok(conn)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
fn root(folder: &LinkedFolder) -> String {
|
|
58
|
+
folder.path.to_string_lossy().into_owned()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
fn supported(path: &Path) -> bool {
|
|
62
|
+
path.extension().and_then(|e| e.to_str()).is_some_and(|e| {
|
|
63
|
+
matches!(
|
|
64
|
+
e.to_ascii_lowercase().as_str(),
|
|
65
|
+
"txt"
|
|
66
|
+
| "md"
|
|
67
|
+
| "pdf"
|
|
68
|
+
| "docx"
|
|
69
|
+
| "xlsx"
|
|
70
|
+
| "json"
|
|
71
|
+
| "toml"
|
|
72
|
+
| "yaml"
|
|
73
|
+
| "yml"
|
|
74
|
+
| "rs"
|
|
75
|
+
| "ts"
|
|
76
|
+
| "tsx"
|
|
77
|
+
| "js"
|
|
78
|
+
| "jsx"
|
|
79
|
+
| "py"
|
|
80
|
+
| "html"
|
|
81
|
+
| "css"
|
|
82
|
+
)
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
pub(super) fn refresh(
|
|
87
|
+
folder: &LinkedFolder,
|
|
88
|
+
config: &MintConfig,
|
|
89
|
+
) -> Result<LinkedFolderStatus, String> {
|
|
90
|
+
if fs::canonicalize(&folder.path).map_err(|e| e.to_string())? != folder.path {
|
|
91
|
+
return Err("linked folder path has changed".into());
|
|
92
|
+
}
|
|
93
|
+
assert_path_capability(&folder.path, Capability::Read, config).map_err(|e| e.to_string())?;
|
|
94
|
+
let mut conn = db()?;
|
|
95
|
+
let root = root(folder);
|
|
96
|
+
let mut seen = HashSet::new();
|
|
97
|
+
let mut errors = Vec::new();
|
|
98
|
+
let walker = WalkBuilder::new(&folder.path)
|
|
99
|
+
.hidden(true)
|
|
100
|
+
.follow_links(false)
|
|
101
|
+
.build();
|
|
102
|
+
for entry in walker {
|
|
103
|
+
let entry = match entry {
|
|
104
|
+
Ok(v) => v,
|
|
105
|
+
Err(e) => {
|
|
106
|
+
errors.push(e.to_string());
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
let path = entry.path();
|
|
111
|
+
if !entry.file_type().is_some_and(|t| t.is_file())
|
|
112
|
+
|| !supported(path)
|
|
113
|
+
|| path
|
|
114
|
+
.strip_prefix(&folder.path)
|
|
115
|
+
.ok()
|
|
116
|
+
.is_some_and(|relative| {
|
|
117
|
+
relative
|
|
118
|
+
.components()
|
|
119
|
+
.any(|part| part.as_os_str() == "mint-notes")
|
|
120
|
+
})
|
|
121
|
+
{
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
let metadata = match entry.metadata() {
|
|
125
|
+
Ok(v) => v,
|
|
126
|
+
Err(e) => {
|
|
127
|
+
errors.push(e.to_string());
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
if metadata.len() > MAX_FILE_BYTES {
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
let path_text = path.to_string_lossy().into_owned();
|
|
135
|
+
seen.insert(path_text.clone());
|
|
136
|
+
let mtime = metadata
|
|
137
|
+
.modified()
|
|
138
|
+
.ok()
|
|
139
|
+
.and_then(|v| v.duration_since(UNIX_EPOCH).ok())
|
|
140
|
+
.map_or(0, |v| v.as_nanos().min(i64::MAX as u128) as i64);
|
|
141
|
+
let old: Option<(i64, i64)> = conn.query_row(
|
|
142
|
+
"SELECT mtime, bytes FROM linked_folder_files WHERE folder=?1 AND root=?2 AND path=?3",
|
|
143
|
+
params![folder.name, root, path_text], |r| Ok((r.get(0)?, r.get(1)?)))
|
|
144
|
+
.optional().map_err(|e| e.to_string())?;
|
|
145
|
+
if old == Some((mtime, metadata.len() as i64)) {
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
let content = match extract_document_text(path, config) {
|
|
149
|
+
Ok(v) => v,
|
|
150
|
+
Err(e) => {
|
|
151
|
+
errors.push(e.to_string());
|
|
152
|
+
conn.execute(
|
|
153
|
+
"DELETE FROM linked_folder_chunks WHERE folder=?1 AND root=?2 AND path=?3",
|
|
154
|
+
params![folder.name, root, path_text],
|
|
155
|
+
)
|
|
156
|
+
.map_err(|e| e.to_string())?;
|
|
157
|
+
conn.execute(
|
|
158
|
+
"DELETE FROM linked_folder_files WHERE folder=?1 AND root=?2 AND path=?3",
|
|
159
|
+
params![folder.name, root, path_text],
|
|
160
|
+
)
|
|
161
|
+
.map_err(|e| e.to_string())?;
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
};
|
|
165
|
+
let tx = conn.transaction().map_err(|e| e.to_string())?;
|
|
166
|
+
tx.execute(
|
|
167
|
+
"DELETE FROM linked_folder_chunks WHERE folder=?1 AND root=?2 AND path=?3",
|
|
168
|
+
params![folder.name, root, path_text],
|
|
169
|
+
)
|
|
170
|
+
.map_err(|e| e.to_string())?;
|
|
171
|
+
let chars: Vec<char> = content.chars().collect();
|
|
172
|
+
let mut start = 0;
|
|
173
|
+
let mut ordinal = 0;
|
|
174
|
+
while start < chars.len() {
|
|
175
|
+
let end = (start + CHUNK_CHARS).min(chars.len());
|
|
176
|
+
let text: String = chars[start..end].iter().collect();
|
|
177
|
+
tx.execute("INSERT INTO linked_folder_chunks(folder,root,path,ordinal,text,embedding) VALUES(?1,?2,?3,?4,?5,?6)",
|
|
178
|
+
params![folder.name, root, path_text, ordinal, text, encode_embedding(&embedding(&text))]).map_err(|e| e.to_string())?;
|
|
179
|
+
ordinal += 1;
|
|
180
|
+
if end == chars.len() {
|
|
181
|
+
break;
|
|
182
|
+
}
|
|
183
|
+
start = end.saturating_sub(CHUNK_OVERLAP);
|
|
184
|
+
}
|
|
185
|
+
tx.execute("INSERT INTO linked_folder_files(folder,root,path,mtime,bytes) VALUES(?1,?2,?3,?4,?5)
|
|
186
|
+
ON CONFLICT(folder,root,path) DO UPDATE SET mtime=excluded.mtime,bytes=excluded.bytes",
|
|
187
|
+
params![folder.name, root, path_text, mtime, metadata.len() as i64]).map_err(|e| e.to_string())?;
|
|
188
|
+
tx.commit().map_err(|e| e.to_string())?;
|
|
189
|
+
}
|
|
190
|
+
let mut stmt = conn
|
|
191
|
+
.prepare("SELECT path FROM linked_folder_files WHERE folder=?1 AND root=?2")
|
|
192
|
+
.map_err(|e| e.to_string())?;
|
|
193
|
+
let old_paths = stmt
|
|
194
|
+
.query_map(params![folder.name, root], |r| r.get::<_, String>(0))
|
|
195
|
+
.map_err(|e| e.to_string())?
|
|
196
|
+
.collect::<Result<Vec<_>, _>>()
|
|
197
|
+
.map_err(|e| e.to_string())?;
|
|
198
|
+
drop(stmt);
|
|
199
|
+
for path in old_paths {
|
|
200
|
+
if !seen.contains(&path) {
|
|
201
|
+
conn.execute(
|
|
202
|
+
"DELETE FROM linked_folder_chunks WHERE folder=?1 AND root=?2 AND path=?3",
|
|
203
|
+
params![folder.name, root, path],
|
|
204
|
+
)
|
|
205
|
+
.map_err(|e| e.to_string())?;
|
|
206
|
+
conn.execute(
|
|
207
|
+
"DELETE FROM linked_folder_files WHERE folder=?1 AND root=?2 AND path=?3",
|
|
208
|
+
params![folder.name, root, path],
|
|
209
|
+
)
|
|
210
|
+
.map_err(|e| e.to_string())?;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
let indexed_at = Local::now().to_rfc3339();
|
|
214
|
+
let error = (!errors.is_empty()).then(|| {
|
|
215
|
+
format!(
|
|
216
|
+
"{} files could not be indexed: {}",
|
|
217
|
+
errors.len(),
|
|
218
|
+
errors.into_iter().take(2).collect::<Vec<_>>().join("; ")
|
|
219
|
+
)
|
|
220
|
+
});
|
|
221
|
+
conn.execute("INSERT INTO linked_folder_index_status(folder,root,indexed_at,error) VALUES(?1,?2,?3,?4)
|
|
222
|
+
ON CONFLICT(folder,root) DO UPDATE SET indexed_at=excluded.indexed_at,error=excluded.error",
|
|
223
|
+
params![folder.name, root, indexed_at, error]).map_err(|e| e.to_string())?;
|
|
224
|
+
status(folder)
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
pub(super) fn status(folder: &LinkedFolder) -> Result<LinkedFolderStatus, String> {
|
|
228
|
+
let conn = db()?;
|
|
229
|
+
let root = root(folder);
|
|
230
|
+
let indexed_files: i64 = conn
|
|
231
|
+
.query_row(
|
|
232
|
+
"SELECT count(*) FROM linked_folder_files WHERE folder=?1 AND root=?2",
|
|
233
|
+
params![folder.name, root],
|
|
234
|
+
|r| r.get(0),
|
|
235
|
+
)
|
|
236
|
+
.map_err(|e| e.to_string())?;
|
|
237
|
+
let state = conn
|
|
238
|
+
.query_row(
|
|
239
|
+
"SELECT indexed_at,error FROM linked_folder_index_status WHERE folder=?1 AND root=?2",
|
|
240
|
+
params![folder.name, root],
|
|
241
|
+
|r| Ok((r.get(0)?, r.get(1)?)),
|
|
242
|
+
)
|
|
243
|
+
.optional()
|
|
244
|
+
.map_err(|e| e.to_string())?;
|
|
245
|
+
let (indexed_at, index_error) = state.unwrap_or((None, None));
|
|
246
|
+
let pending_jobs: i64 = conn
|
|
247
|
+
.query_row(
|
|
248
|
+
"SELECT count(*) FROM linked_folder_jobs WHERE status IN ('pending','running')",
|
|
249
|
+
[],
|
|
250
|
+
|r| r.get(0),
|
|
251
|
+
)
|
|
252
|
+
.map_err(|e| e.to_string())?;
|
|
253
|
+
let failed_jobs: i64 = conn
|
|
254
|
+
.query_row(
|
|
255
|
+
"SELECT count(*) FROM linked_folder_jobs WHERE status='failed'",
|
|
256
|
+
[],
|
|
257
|
+
|r| r.get(0),
|
|
258
|
+
)
|
|
259
|
+
.map_err(|e| e.to_string())?;
|
|
260
|
+
let last_job_error: Option<String> = conn.query_row("SELECT error FROM linked_folder_jobs WHERE status='failed' ORDER BY created_at DESC LIMIT 1", [], |r| r.get(0)).optional().map_err(|e| e.to_string())?.flatten();
|
|
261
|
+
Ok(LinkedFolderStatus {
|
|
262
|
+
indexed_files: indexed_files as usize,
|
|
263
|
+
indexed_at,
|
|
264
|
+
index_error,
|
|
265
|
+
pending_jobs: pending_jobs as usize,
|
|
266
|
+
failed_jobs: failed_jobs as usize,
|
|
267
|
+
last_job_error,
|
|
268
|
+
})
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
pub(super) fn search(
|
|
272
|
+
folder: &LinkedFolder,
|
|
273
|
+
query: &str,
|
|
274
|
+
limit: usize,
|
|
275
|
+
) -> Result<Vec<(String, String)>, String> {
|
|
276
|
+
let conn = db()?;
|
|
277
|
+
let root = root(folder);
|
|
278
|
+
let vector = embedding(query);
|
|
279
|
+
let query_grams = char_trigrams(query);
|
|
280
|
+
let mut stmt = conn
|
|
281
|
+
.prepare("SELECT path,text,embedding FROM linked_folder_chunks WHERE folder=?1 AND root=?2")
|
|
282
|
+
.map_err(|e| e.to_string())?;
|
|
283
|
+
let mut hits = stmt
|
|
284
|
+
.query_map(params![folder.name, root], |r| {
|
|
285
|
+
Ok((
|
|
286
|
+
r.get::<_, String>(0)?,
|
|
287
|
+
r.get::<_, String>(1)?,
|
|
288
|
+
r.get::<_, Vec<u8>>(2)?,
|
|
289
|
+
))
|
|
290
|
+
})
|
|
291
|
+
.map_err(|e| e.to_string())?
|
|
292
|
+
.collect::<Result<Vec<_>, _>>()
|
|
293
|
+
.map_err(|e| e.to_string())?
|
|
294
|
+
.into_iter()
|
|
295
|
+
.map(|(path, text, raw)| {
|
|
296
|
+
let score = decode_embedding(&raw)
|
|
297
|
+
.map(|v| cosine_similarity(&vector, &v))
|
|
298
|
+
.unwrap_or(0.0)
|
|
299
|
+
.max(0.0)
|
|
300
|
+
+ 0.5 * trigram_overlap(&query_grams, &text);
|
|
301
|
+
let stem = Path::new(&path)
|
|
302
|
+
.file_stem()
|
|
303
|
+
.unwrap_or_default()
|
|
304
|
+
.to_string_lossy()
|
|
305
|
+
.to_lowercase();
|
|
306
|
+
let name_score = if stem.chars().count() >= 3 && query.to_lowercase().contains(&stem) {
|
|
307
|
+
0.25
|
|
308
|
+
} else {
|
|
309
|
+
0.0
|
|
310
|
+
};
|
|
311
|
+
(score + name_score, path, text)
|
|
312
|
+
})
|
|
313
|
+
.collect::<Vec<_>>();
|
|
314
|
+
hits.retain(|(score, _, _)| *score >= 0.1);
|
|
315
|
+
hits.sort_by(|a, b| b.0.total_cmp(&a.0));
|
|
316
|
+
hits.truncate(limit);
|
|
317
|
+
Ok(hits
|
|
318
|
+
.into_iter()
|
|
319
|
+
.map(|(_, path, text)| (path, text.chars().take(500).collect()))
|
|
320
|
+
.collect())
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
fn char_trigrams(text: &str) -> HashSet<String> {
|
|
324
|
+
let chars = text
|
|
325
|
+
.to_lowercase()
|
|
326
|
+
.chars()
|
|
327
|
+
.filter(|c| c.is_alphanumeric())
|
|
328
|
+
.collect::<Vec<_>>();
|
|
329
|
+
chars
|
|
330
|
+
.windows(3)
|
|
331
|
+
.map(|window| window.iter().collect())
|
|
332
|
+
.collect()
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
fn trigram_overlap(query_grams: &HashSet<String>, text: &str) -> f32 {
|
|
336
|
+
if query_grams.is_empty() {
|
|
337
|
+
return 0.0;
|
|
338
|
+
}
|
|
339
|
+
let text_grams = char_trigrams(text);
|
|
340
|
+
if text_grams.is_empty() {
|
|
341
|
+
return 0.0;
|
|
342
|
+
}
|
|
343
|
+
let matched = text_grams.intersection(query_grams).count();
|
|
344
|
+
matched as f32 / query_grams.len().min(text_grams.len()) as f32
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
pub(super) fn remove_folder(name: &str) -> Result<(), String> {
|
|
348
|
+
let conn = db()?;
|
|
349
|
+
for table in [
|
|
350
|
+
"linked_folder_chunks",
|
|
351
|
+
"linked_folder_files",
|
|
352
|
+
"linked_folder_index_status",
|
|
353
|
+
] {
|
|
354
|
+
conn.execute(&format!("DELETE FROM {table} WHERE folder=?1"), [name])
|
|
355
|
+
.map_err(|e| e.to_string())?;
|
|
356
|
+
}
|
|
357
|
+
Ok(())
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
pub(super) fn save_note(
|
|
361
|
+
folder: &LinkedFolder,
|
|
362
|
+
content: &str,
|
|
363
|
+
config: &MintConfig,
|
|
364
|
+
job_id: Option<&str>,
|
|
365
|
+
) -> Result<LinkedFolderNote, String> {
|
|
366
|
+
let conn = db()?;
|
|
367
|
+
let root = root(folder);
|
|
368
|
+
if let Some(job_id) = job_id
|
|
369
|
+
&& let Some(note) = conn.query_row("SELECT id,folder,path,content,created_at,status,error FROM linked_folder_notes WHERE job_id=?1 AND folder=?2 AND root=?3",
|
|
370
|
+
params![job_id, folder.name, root], note_row).optional().map_err(|e| e.to_string())? {
|
|
371
|
+
return write_pending(folder, note, config);
|
|
372
|
+
}
|
|
373
|
+
let now = Local::now();
|
|
374
|
+
let id = Uuid::new_v4().to_string();
|
|
375
|
+
let path = folder
|
|
376
|
+
.path
|
|
377
|
+
.join("mint-notes")
|
|
378
|
+
.join(format!("{}.md", now.format("%Y-%m-%d")));
|
|
379
|
+
assert_path_capability(&path, Capability::Write, config).map_err(|e| e.to_string())?;
|
|
380
|
+
let note = LinkedFolderNote {
|
|
381
|
+
id,
|
|
382
|
+
folder: folder.name.clone(),
|
|
383
|
+
path: path.to_string_lossy().into_owned(),
|
|
384
|
+
content: content.to_owned(),
|
|
385
|
+
created_at: now.to_rfc3339(),
|
|
386
|
+
status: "pending".into(),
|
|
387
|
+
error: None,
|
|
388
|
+
};
|
|
389
|
+
conn.execute("INSERT INTO linked_folder_notes(id,job_id,folder,root,path,content,created_at,status) VALUES(?1,?2,?3,?4,?5,?6,?7,'pending')",
|
|
390
|
+
params![note.id, job_id, note.folder, root, note.path, note.content, note.created_at]).map_err(|e| e.to_string())?;
|
|
391
|
+
write_pending(folder, note, config)
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
fn note_row(r: &rusqlite::Row<'_>) -> rusqlite::Result<LinkedFolderNote> {
|
|
395
|
+
Ok(LinkedFolderNote {
|
|
396
|
+
id: r.get(0)?,
|
|
397
|
+
folder: r.get(1)?,
|
|
398
|
+
path: r.get(2)?,
|
|
399
|
+
content: r.get(3)?,
|
|
400
|
+
created_at: r.get(4)?,
|
|
401
|
+
status: r.get(5)?,
|
|
402
|
+
error: r.get(6)?,
|
|
403
|
+
})
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
fn write_pending(
|
|
407
|
+
folder: &LinkedFolder,
|
|
408
|
+
mut note: LinkedFolderNote,
|
|
409
|
+
config: &MintConfig,
|
|
410
|
+
) -> Result<LinkedFolderNote, String> {
|
|
411
|
+
if note.status == "saved" {
|
|
412
|
+
return Ok(note);
|
|
413
|
+
}
|
|
414
|
+
let path = Path::new(¬e.path);
|
|
415
|
+
let result = (|| -> Result<(), String> {
|
|
416
|
+
if fs::canonicalize(&folder.path).map_err(|e| e.to_string())? != folder.path {
|
|
417
|
+
return Err("linked folder path has changed".into());
|
|
418
|
+
}
|
|
419
|
+
if !path.starts_with(folder.path.join("mint-notes")) {
|
|
420
|
+
return Err("note path is outside linked folder".into());
|
|
421
|
+
}
|
|
422
|
+
assert_path_capability(path, Capability::Write, config).map_err(|e| e.to_string())?;
|
|
423
|
+
fs::create_dir_all(path.parent().ok_or("missing note directory")?)
|
|
424
|
+
.map_err(|e| e.to_string())?;
|
|
425
|
+
if fs::symlink_metadata(path.parent().ok_or("missing note directory")?)
|
|
426
|
+
.map_err(|e| e.to_string())?
|
|
427
|
+
.file_type()
|
|
428
|
+
.is_symlink()
|
|
429
|
+
{
|
|
430
|
+
return Err("note directory must not be a symlink".into());
|
|
431
|
+
}
|
|
432
|
+
if fs::symlink_metadata(path).is_ok_and(|m| m.file_type().is_symlink()) {
|
|
433
|
+
return Err("note file must not be a symlink".into());
|
|
434
|
+
}
|
|
435
|
+
append_note_entry(path, ¬e)
|
|
436
|
+
})();
|
|
437
|
+
let conn = db()?;
|
|
438
|
+
note.status = if result.is_ok() {
|
|
439
|
+
"saved".into()
|
|
440
|
+
} else {
|
|
441
|
+
"failed".into()
|
|
442
|
+
};
|
|
443
|
+
note.error = result.err();
|
|
444
|
+
conn.execute(
|
|
445
|
+
"UPDATE linked_folder_notes SET status=?2,error=?3 WHERE id=?1",
|
|
446
|
+
params![note.id, note.status, note.error],
|
|
447
|
+
)
|
|
448
|
+
.map_err(|e| e.to_string())?;
|
|
449
|
+
Ok(note)
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
fn append_note_entry(path: &Path, note: &LinkedFolderNote) -> Result<(), String> {
|
|
453
|
+
let mut file = OpenOptions::new()
|
|
454
|
+
.create(true)
|
|
455
|
+
.read(true)
|
|
456
|
+
.append(true)
|
|
457
|
+
.open(path)
|
|
458
|
+
.map_err(|e| e.to_string())?;
|
|
459
|
+
file.lock().map_err(|e| e.to_string())?;
|
|
460
|
+
let mut existing = String::new();
|
|
461
|
+
file.read_to_string(&mut existing)
|
|
462
|
+
.map_err(|e| e.to_string())?;
|
|
463
|
+
let marker = format!("<!-- mint-note:{} -->", note.id);
|
|
464
|
+
if !existing.contains(&marker) {
|
|
465
|
+
let entry = format!(
|
|
466
|
+
"\n## {} · {}\n\n{}\n{}\n",
|
|
467
|
+
¬e.created_at[11..19],
|
|
468
|
+
note.id,
|
|
469
|
+
note.content,
|
|
470
|
+
marker
|
|
471
|
+
);
|
|
472
|
+
let original_len = file.metadata().map_err(|e| e.to_string())?.len();
|
|
473
|
+
if let Err(error) = file.write_all(entry.as_bytes()) {
|
|
474
|
+
let _ = file.set_len(original_len);
|
|
475
|
+
return Err(error.to_string());
|
|
476
|
+
}
|
|
477
|
+
file.sync_all().map_err(|e| e.to_string())?;
|
|
478
|
+
}
|
|
479
|
+
file.unlock().map_err(|e| e.to_string())?;
|
|
480
|
+
Ok(())
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
pub(super) fn notes(
|
|
484
|
+
folder: &LinkedFolder,
|
|
485
|
+
config: &MintConfig,
|
|
486
|
+
) -> Result<Vec<LinkedFolderNote>, String> {
|
|
487
|
+
assert_path_capability(&folder.path, Capability::Read, config).map_err(|e| e.to_string())?;
|
|
488
|
+
let conn = db()?;
|
|
489
|
+
let root = root(folder);
|
|
490
|
+
let mut stmt = conn.prepare("SELECT id,folder,path,content,created_at,status,error FROM linked_folder_notes WHERE folder=?1 AND root=?2 ORDER BY created_at DESC LIMIT 100").map_err(|e| e.to_string())?;
|
|
491
|
+
let mut notes = stmt
|
|
492
|
+
.query_map(params![folder.name, root], note_row)
|
|
493
|
+
.map_err(|e| e.to_string())?
|
|
494
|
+
.collect::<Result<Vec<_>, _>>()
|
|
495
|
+
.map_err(|e| e.to_string())?;
|
|
496
|
+
let mut file_cache: HashMap<String, Vec<(String, String)>> = HashMap::new();
|
|
497
|
+
for note in &mut notes {
|
|
498
|
+
if note.status == "saved" && !Path::new(¬e.path).is_file() {
|
|
499
|
+
note.status = "failed".into();
|
|
500
|
+
note.error = Some("note file is missing".into());
|
|
501
|
+
} else if note.status == "saved" && !safe_note_path(folder, Path::new(¬e.path), config) {
|
|
502
|
+
note.status = "failed".into();
|
|
503
|
+
note.error = Some("note path is not readable".into());
|
|
504
|
+
} else if note.status == "saved" {
|
|
505
|
+
let sections = file_cache.entry(note.path.clone()).or_insert_with(|| {
|
|
506
|
+
fs::read_to_string(¬e.path)
|
|
507
|
+
.map(|body| super::note_sections(&body))
|
|
508
|
+
.unwrap_or_default()
|
|
509
|
+
});
|
|
510
|
+
let marker = format!("<!-- mint-note:{} -->", note.id);
|
|
511
|
+
if let Some((_, entry)) = sections.iter().find(|(_, entry)| entry.contains(&marker)) {
|
|
512
|
+
note.content = entry
|
|
513
|
+
.lines()
|
|
514
|
+
.filter(|line| !line.contains(&marker))
|
|
515
|
+
.collect::<Vec<_>>()
|
|
516
|
+
.join("\n")
|
|
517
|
+
.trim()
|
|
518
|
+
.to_owned();
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
let notes_dir = folder.path.join("mint-notes");
|
|
523
|
+
if fs::symlink_metadata(¬es_dir).is_ok_and(|meta| !meta.file_type().is_symlink())
|
|
524
|
+
&& let Ok(files) = fs::read_dir(¬es_dir)
|
|
525
|
+
{
|
|
526
|
+
for file in files.flatten().take(365) {
|
|
527
|
+
if !file.file_type().is_ok_and(|kind| kind.is_file()) {
|
|
528
|
+
continue;
|
|
529
|
+
}
|
|
530
|
+
let path = file.path();
|
|
531
|
+
if !safe_note_path(folder, &path, config) {
|
|
532
|
+
continue;
|
|
533
|
+
}
|
|
534
|
+
let Some(date) = path.file_stem().and_then(|v| v.to_str()) else {
|
|
535
|
+
continue;
|
|
536
|
+
};
|
|
537
|
+
if path.extension().and_then(|v| v.to_str()) != Some("md") || !valid_date(date) {
|
|
538
|
+
continue;
|
|
539
|
+
}
|
|
540
|
+
let Ok(body) = fs::read_to_string(&path) else {
|
|
541
|
+
continue;
|
|
542
|
+
};
|
|
543
|
+
for (ordinal, (heading, chunk)) in super::note_sections(&body).into_iter().enumerate() {
|
|
544
|
+
if chunk.contains("<!-- mint-note:") {
|
|
545
|
+
continue;
|
|
546
|
+
}
|
|
547
|
+
let time = heading.split(" · ").next().unwrap_or("00:00");
|
|
548
|
+
let time = if time.len() == 5 { time } else { "00:00" };
|
|
549
|
+
notes.push(LinkedFolderNote {
|
|
550
|
+
id: format!("legacy:{date}:{ordinal}"),
|
|
551
|
+
folder: folder.name.clone(),
|
|
552
|
+
path: path.to_string_lossy().into_owned(),
|
|
553
|
+
content: chunk
|
|
554
|
+
.lines()
|
|
555
|
+
.collect::<Vec<_>>()
|
|
556
|
+
.join("\n")
|
|
557
|
+
.trim()
|
|
558
|
+
.chars()
|
|
559
|
+
.take(160)
|
|
560
|
+
.collect(),
|
|
561
|
+
created_at: format!("{date}T{time}:00"),
|
|
562
|
+
status: "saved".into(),
|
|
563
|
+
error: None,
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
notes.sort_by(|a, b| b.created_at.cmp(&a.created_at));
|
|
569
|
+
notes.truncate(100);
|
|
570
|
+
Ok(notes)
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
fn valid_date(date: &str) -> bool {
|
|
574
|
+
date.len() == 10
|
|
575
|
+
&& date.chars().enumerate().all(|(i, c)| {
|
|
576
|
+
if i == 4 || i == 7 {
|
|
577
|
+
c == '-'
|
|
578
|
+
} else {
|
|
579
|
+
c.is_ascii_digit()
|
|
580
|
+
}
|
|
581
|
+
})
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
fn safe_note_path(folder: &LinkedFolder, path: &Path, config: &MintConfig) -> bool {
|
|
585
|
+
let Ok(root) = fs::canonicalize(&folder.path) else {
|
|
586
|
+
return false;
|
|
587
|
+
};
|
|
588
|
+
if root != folder.path {
|
|
589
|
+
return false;
|
|
590
|
+
}
|
|
591
|
+
let Ok(dir) = fs::canonicalize(folder.path.join("mint-notes")) else {
|
|
592
|
+
return false;
|
|
593
|
+
};
|
|
594
|
+
let Ok(file) = fs::canonicalize(path) else {
|
|
595
|
+
return false;
|
|
596
|
+
};
|
|
597
|
+
dir.starts_with(root)
|
|
598
|
+
&& file.starts_with(dir)
|
|
599
|
+
&& assert_path_capability(&file, Capability::Read, config).is_ok()
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
pub(super) fn read_note(
|
|
603
|
+
folder: &LinkedFolder,
|
|
604
|
+
id: &str,
|
|
605
|
+
config: &MintConfig,
|
|
606
|
+
) -> Result<String, String> {
|
|
607
|
+
let (path, legacy_ordinal): (String, Option<usize>) = if let Some(remainder) =
|
|
608
|
+
id.strip_prefix("legacy:")
|
|
609
|
+
{
|
|
610
|
+
let (date, ordinal) = remainder.split_once(':').ok_or("invalid legacy note id")?;
|
|
611
|
+
if !valid_date(date) {
|
|
612
|
+
return Err("invalid legacy note date".into());
|
|
613
|
+
}
|
|
614
|
+
let ordinal: usize = ordinal.parse().map_err(|_| "invalid legacy note id")?;
|
|
615
|
+
let path = folder.path.join("mint-notes").join(format!("{date}.md"));
|
|
616
|
+
(path.to_string_lossy().into_owned(), Some(ordinal))
|
|
617
|
+
} else {
|
|
618
|
+
let conn = db()?;
|
|
619
|
+
let root = root(folder);
|
|
620
|
+
(conn.query_row("SELECT path FROM linked_folder_notes WHERE id=?1 AND folder=?2 AND root=?3 AND status='saved'",
|
|
621
|
+
params![id,folder.name,root], |r| r.get(0)).map_err(|e| e.to_string())?, None)
|
|
622
|
+
};
|
|
623
|
+
let path = Path::new(&path);
|
|
624
|
+
if !path.starts_with(folder.path.join("mint-notes")) {
|
|
625
|
+
return Err("note path is outside linked folder".into());
|
|
626
|
+
}
|
|
627
|
+
let actual_root = fs::canonicalize(&folder.path).map_err(|e| e.to_string())?;
|
|
628
|
+
if actual_root != folder.path {
|
|
629
|
+
return Err("linked folder path has changed".into());
|
|
630
|
+
}
|
|
631
|
+
let actual_dir = fs::canonicalize(folder.path.join("mint-notes")).map_err(|e| e.to_string())?;
|
|
632
|
+
let actual_path = fs::canonicalize(path).map_err(|e| e.to_string())?;
|
|
633
|
+
if !actual_dir.starts_with(&actual_root) || !actual_path.starts_with(&actual_dir) {
|
|
634
|
+
return Err("note path resolves outside linked folder".into());
|
|
635
|
+
}
|
|
636
|
+
assert_path_capability(&actual_path, Capability::Read, config).map_err(|e| e.to_string())?;
|
|
637
|
+
let body = fs::read_to_string(actual_path).map_err(|e| e.to_string())?;
|
|
638
|
+
if let Some(ordinal) = legacy_ordinal
|
|
639
|
+
&& super::note_sections(&body)
|
|
640
|
+
.into_iter()
|
|
641
|
+
.nth(ordinal)
|
|
642
|
+
.is_none_or(|(_, entry)| entry.contains("<!-- mint-note:"))
|
|
643
|
+
{
|
|
644
|
+
return Err("legacy note not found".into());
|
|
645
|
+
}
|
|
646
|
+
Ok(body)
|
|
647
|
+
}
|
|
648
|
+
|
|
649
|
+
pub(super) fn queue_job(id: &str, user_text: &str, ai_text: &str) -> Result<(), String> {
|
|
650
|
+
let conn = db()?;
|
|
651
|
+
conn.execute("DELETE FROM linked_folder_jobs WHERE status IN ('saved','skipped') AND unixepoch(created_at) < unixepoch()-2592000", []).map_err(|e| e.to_string())?;
|
|
652
|
+
conn.execute("INSERT OR IGNORE INTO linked_folder_jobs(id,user_text,ai_text,status,created_at) VALUES(?1,?2,?3,'pending',?4)",
|
|
653
|
+
params![id,user_text,ai_text,Local::now().to_rfc3339()]).map_err(|e| e.to_string())?;
|
|
654
|
+
Ok(())
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
pub(super) fn claim_job() -> Result<Option<(String, String, String, i64)>, String> {
|
|
658
|
+
let mut conn = db()?;
|
|
659
|
+
let tx = conn.transaction().map_err(|e| e.to_string())?;
|
|
660
|
+
let job = tx.query_row("SELECT id,user_text,ai_text,attempts FROM linked_folder_jobs WHERE (status='pending' AND (claimed_at IS NULL OR claimed_at <= unixepoch())) OR (status='running' AND claimed_at < unixepoch()-600) ORDER BY created_at LIMIT 1", [],
|
|
661
|
+
|r| Ok((r.get::<_,String>(0)?,r.get::<_,String>(1)?,r.get::<_,String>(2)?,r.get::<_,i64>(3)?))).optional().map_err(|e| e.to_string())?;
|
|
662
|
+
if let Some((ref id, _, _, _)) = job {
|
|
663
|
+
tx.execute("UPDATE linked_folder_jobs SET status='running',attempts=attempts+1,claimed_at=unixepoch() WHERE id=?1",[id]).map_err(|e| e.to_string())?;
|
|
664
|
+
}
|
|
665
|
+
tx.commit().map_err(|e| e.to_string())?;
|
|
666
|
+
Ok(job)
|
|
667
|
+
}
|
|
668
|
+
|
|
669
|
+
pub(super) fn finish_job(id: &str, status: &str, error: Option<&str>) -> Result<(), String> {
|
|
670
|
+
db()?
|
|
671
|
+
.execute(
|
|
672
|
+
"UPDATE linked_folder_jobs SET status=?2,error=?3,user_text='',ai_text='' WHERE id=?1",
|
|
673
|
+
params![id, status, error],
|
|
674
|
+
)
|
|
675
|
+
.map_err(|e| e.to_string())?;
|
|
676
|
+
Ok(())
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
pub(super) fn retry_job(id: &str, error: &str, delay_seconds: i64) -> Result<(), String> {
|
|
680
|
+
db()?.execute("UPDATE linked_folder_jobs SET status='pending',error=?2,claimed_at=unixepoch()+?3 WHERE id=?1",
|
|
681
|
+
params![id,error,delay_seconds]).map_err(|e| e.to_string())?;
|
|
682
|
+
Ok(())
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
#[cfg(test)]
|
|
686
|
+
mod tests {
|
|
687
|
+
use super::*;
|
|
688
|
+
|
|
689
|
+
#[test]
|
|
690
|
+
fn concurrent_appends_keep_each_note_once() {
|
|
691
|
+
let dir = std::env::temp_dir().join(format!("mint-linked-write-{}", Uuid::new_v4()));
|
|
692
|
+
fs::create_dir_all(&dir).unwrap();
|
|
693
|
+
let path = dir.join("2026-10-01.md");
|
|
694
|
+
let notes = (0..12)
|
|
695
|
+
.map(|i| LinkedFolderNote {
|
|
696
|
+
id: Uuid::new_v4().to_string(),
|
|
697
|
+
folder: "test".into(),
|
|
698
|
+
path: path.to_string_lossy().into_owned(),
|
|
699
|
+
content: format!("entry {i}"),
|
|
700
|
+
created_at: "2026-10-01T10:15:00+07:00".into(),
|
|
701
|
+
status: "pending".into(),
|
|
702
|
+
error: None,
|
|
703
|
+
})
|
|
704
|
+
.collect::<Vec<_>>();
|
|
705
|
+
std::thread::scope(|scope| {
|
|
706
|
+
for note in ¬es {
|
|
707
|
+
let path = &path;
|
|
708
|
+
scope.spawn(move || append_note_entry(path, note).unwrap());
|
|
709
|
+
}
|
|
710
|
+
});
|
|
711
|
+
for note in ¬es {
|
|
712
|
+
append_note_entry(&path, note).unwrap();
|
|
713
|
+
}
|
|
714
|
+
let content = fs::read_to_string(&path).unwrap();
|
|
715
|
+
for note in ¬es {
|
|
716
|
+
assert_eq!(
|
|
717
|
+
content
|
|
718
|
+
.matches(&format!("<!-- mint-note:{} -->", note.id))
|
|
719
|
+
.count(),
|
|
720
|
+
1
|
|
721
|
+
);
|
|
722
|
+
}
|
|
723
|
+
fs::remove_dir_all(dir).unwrap();
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
#[test]
|
|
727
|
+
fn thai_topic_overlap_beats_unrelated_text() {
|
|
728
|
+
let query = char_trigrams("ผัดไทยใส่มะขามอย่างไร");
|
|
729
|
+
assert!(trigram_overlap(&query, "สูตรผัดไทยใส่มะขามเปียก") > 0.1);
|
|
730
|
+
assert_eq!(trigram_overlap(&query, "ตารางการแข่งขันฟุตบอล"), 0.0);
|
|
731
|
+
}
|
|
732
|
+
}
|