@pheem49/mint 1.15.0 → 1.16.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 +1012 -69
- package/Cargo.toml +5 -2
- package/LICENSE +21 -654
- package/README.md +92 -817
- package/Release_Note.md +53 -560
- package/apps/mint-companion/src-tauri/Cargo.toml +20 -0
- package/apps/mint-companion/src-tauri/build.rs +3 -0
- package/apps/mint-companion/src-tauri/src/main.rs +468 -0
- package/apps/mint-companion/tsconfig.json +20 -0
- package/apps/mint-companion/vite.config.ts +3 -0
- package/components.json +19 -0
- package/crates/mint-cli/Cargo.toml +6 -0
- package/crates/mint-cli/src/agent/live_status.rs +187 -39
- package/crates/mint-cli/src/agent.rs +323 -95
- package/crates/mint-cli/src/commands/agent.rs +69 -55
- package/crates/mint-cli/src/commands/integrations.rs +7 -0
- package/crates/mint-cli/src/commands/knowledge.rs +12 -32
- package/crates/mint-cli/src/commands/mod.rs +44 -0
- package/crates/mint-cli/src/image.rs +31 -33
- package/crates/mint-cli/src/interactive/chat_tui.rs +3594 -483
- package/crates/mint-cli/src/interactive/input_box.rs +56 -6
- package/crates/mint-cli/src/interactive/slash_commands.rs +208 -56
- package/crates/mint-cli/src/interactive/tool_activity.rs +328 -0
- package/crates/mint-cli/src/interactive.rs +64 -40
- package/crates/mint-cli/src/main.rs +13 -7
- package/crates/mint-cli/src/mcp.rs +5 -0
- package/crates/mint-cli/src/mod_host.rs +6 -0
- package/crates/mint-cli/src/mods_cli.rs +62 -0
- package/crates/mint-cli/src/mods_ui.rs +187 -0
- package/crates/mint-cli/src/onboard.rs +5 -31
- package/crates/mint-cli/src/terminal_theme.rs +3 -1
- package/crates/mint-cli/src/updater.rs +56 -2
- package/crates/mint-cli/tests/library_intake.rs +77 -0
- package/crates/mint-cli/tests/mods_testing.rs +133 -0
- package/crates/mint-companion-protocol/Cargo.toml +10 -0
- package/crates/mint-companion-protocol/src/lib.rs +163 -0
- package/crates/mint-core/Cargo.toml +6 -3
- package/crates/mint-core/build.rs +26 -0
- package/crates/mint-core/src/agent/chat.rs +167 -39
- package/crates/mint-core/src/agent/code_tools.rs +15 -0
- package/crates/mint-core/src/agent/memory/sources.rs +240 -0
- package/crates/mint-core/src/agent/memory.rs +147 -13
- package/crates/mint-core/src/agent/skill_inventory.rs +325 -0
- package/crates/mint-core/src/agent/skills.rs +437 -90
- package/crates/mint-core/src/agent.rs +1 -0
- package/crates/mint-core/src/api_server/routes/background_jobs.rs +310 -0
- package/crates/mint-core/src/api_server/routes/chat.rs +216 -199
- package/crates/mint-core/src/api_server/routes/html_preview.rs +77 -0
- package/crates/mint-core/src/api_server/routes/library.rs +97 -0
- package/crates/mint-core/src/api_server/routes/media_gen.rs +10 -57
- package/crates/mint-core/src/api_server/routes/misc.rs +104 -107
- package/crates/mint-core/src/api_server/routes/mod.rs +6 -0
- package/crates/mint-core/src/api_server/routes/mods.rs +31 -0
- package/crates/mint-core/src/api_server/routes/sessions.rs +41 -0
- package/crates/mint-core/src/api_server/routes/skills_subagents.rs +12 -42
- package/crates/mint-core/src/api_server/routes/slash.rs +50 -1
- package/crates/mint-core/src/api_server/routes/sources.rs +101 -0
- package/crates/mint-core/src/api_server.rs +118 -9
- package/crates/mint-core/src/avatar_bridge.rs +11 -2
- package/crates/mint-core/src/browser/session.rs +52 -0
- package/crates/mint-core/src/companion.rs +716 -0
- package/crates/mint-core/src/cron/scheduler.rs +34 -2
- package/crates/mint-core/src/integrations/channels.rs +87 -345
- package/crates/mint-core/src/integrations/mcp.rs +397 -50
- package/crates/mint-core/src/integrations/mcp_calls.rs +823 -0
- package/crates/mint-core/src/integrations/mcp_catalog.rs +267 -0
- package/crates/mint-core/src/integrations/mcp_device.rs +319 -0
- package/crates/mint-core/src/integrations/mcp_result.rs +356 -0
- package/crates/mint-core/src/integrations/webhooks.rs +539 -0
- package/crates/mint-core/src/integrations.rs +2 -0
- package/crates/mint-core/src/lib.rs +85 -26
- package/crates/mint-core/src/media/gemini_live.rs +134 -14
- package/crates/mint-core/src/media/image_models.rs +3 -27
- package/crates/mint-core/src/media/image_workflow.rs +216 -0
- package/crates/mint-core/src/media/library/intake.rs +144 -0
- package/crates/mint-core/src/media/library/migration.rs +56 -0
- package/crates/mint-core/src/media/library/removal.rs +55 -0
- package/crates/mint-core/src/media/library/tests.rs +730 -0
- package/crates/mint-core/src/media/library/thumbnails.rs +72 -0
- package/crates/mint-core/src/media/library.rs +545 -0
- package/crates/mint-core/src/media/model_catalog.rs +375 -0
- package/crates/mint-core/src/media/pictures.rs +79 -222
- package/crates/mint-core/src/media/video_models.rs +3 -22
- package/crates/mint-core/src/media.rs +3 -0
- package/crates/mint-core/src/mods/manager.rs +1124 -0
- package/crates/mint-core/src/mods/mod.rs +569 -0
- package/crates/mint-core/src/mods/operations.rs +204 -0
- package/crates/mint-core/src/mods/session.rs +146 -0
- package/crates/mint-core/src/mods/slash.rs +59 -0
- package/crates/mint-core/src/mods/telemetry.rs +306 -0
- package/crates/mint-core/src/orchestration/approvals.rs +344 -0
- package/crates/mint-core/src/orchestration/context_render.rs +104 -0
- package/crates/mint-core/src/orchestration/mcp_review.rs +153 -0
- package/crates/mint-core/src/orchestration/memory_skill.rs +104 -32
- package/crates/mint-core/src/orchestration/mod.rs +2139 -244
- package/crates/mint-core/src/orchestration/mod_authoring_regressions.rs +209 -0
- package/crates/mint-core/src/orchestration/progress_clock.rs +80 -0
- package/crates/mint-core/src/orchestration/repeated_failures.rs +116 -0
- package/crates/mint-core/src/orchestration/review_regressions.rs +449 -0
- package/crates/mint-core/src/orchestration/run_control.rs +196 -0
- package/crates/mint-core/src/orchestration/tools/files.rs +161 -14
- package/crates/mint-core/src/orchestration/tools/media.rs +37 -41
- package/crates/mint-core/src/orchestration/tools/misc.rs +3 -2
- package/crates/mint-core/src/orchestration/tools/mod.rs +2 -0
- package/crates/mint-core/src/orchestration/tools/mods.rs +161 -0
- package/crates/mint-core/src/orchestration/tools/plugins_mcp.rs +303 -71
- package/crates/mint-core/src/orchestration/tools/shell.rs +95 -2
- package/crates/mint-core/src/orchestration/workspace_helpers.rs +4 -1
- package/crates/mint-core/src/prompts/agent.rs +17 -2
- package/crates/mint-core/src/prompts/tool_catalog.rs +28 -2
- package/crates/mint-core/src/search/knowledge.rs +7 -1
- package/crates/mint-core/src/search/linked_folders/index.rs +177 -13
- package/crates/mint-core/src/search/linked_folders.rs +83 -2
- package/crates/mint-core/src/slash/catalog.rs +1 -1
- package/crates/mint-core/src/slash/mod.rs +174 -11
- package/crates/mint-core/src/slash/mods.rs +155 -0
- package/crates/mint-core/src/system/bg_shell.rs +1129 -95
- package/crates/mint-core/src/system/config.rs +5 -10
- package/crates/mint-core/src/system/html_preview.rs +398 -0
- package/crates/mint-core/src/system/mint_web.rs +164 -0
- package/crates/mint-core/src/system/release_notes.rs +18 -0
- package/crates/mint-core/src/system/shell.rs +21 -6
- package/crates/mint-core/src/system/workspace.rs +72 -8
- package/crates/mint-core/src/system/workspace_history.rs +604 -0
- package/crates/mint-core/src/system.rs +4 -0
- package/crates/mint-core/tests/background_retention.rs +34 -0
- package/crates/mint-core/tests/background_shutdown.rs +24 -0
- package/crates/mint-core/tests/library_http.rs +209 -0
- package/crates/mint-core/tests/mcp_contract.rs +283 -0
- package/crates/mint-core/tests/mcp_stdio.rs +11 -10
- package/crates/mint-core/tests/media_model_catalog_http.rs +403 -0
- package/crates/mint-core/tests/mods_http.rs +215 -0
- package/crates/mint-core/tests/terminal_shutdown.rs +109 -0
- package/crates/mint-mod-runtime/Cargo.toml +18 -0
- package/crates/mint-mod-runtime/src/lib.rs +507 -0
- package/crates/mint-mod-runtime/src/sdk.js +56 -0
- package/crates/mint-mod-runtime/src/test_sdk.js +32 -0
- package/crates/mint-mod-runtime/src/testing.rs +94 -0
- package/crates/mint-mod-runtime/tests/runtime.rs +156 -0
- package/docs/mods/AUTHORING.md +61 -0
- package/docs/mods/README.md +139 -0
- package/docs/mods/TESTING.md +56 -0
- package/docs/mods/mint-mods.d.ts +66 -0
- package/examples/device-mcp/README.md +22 -0
- package/examples/device-mcp/contract.md +49 -0
- package/examples/device-mcp/mock-device.mjs +66 -0
- package/examples/device-mcp/server.mjs +48 -0
- package/examples/device-mcp/server.test.mjs +78 -0
- package/examples/mods/task-checklist/README.md +1 -0
- package/examples/mods/task-checklist/main.ts +17 -0
- package/examples/mods/task-checklist/manifest.json +1 -0
- package/examples/mods/task-checklist/tests/checklist.test.ts +15 -0
- package/examples/mods/token-meter/README.md +1 -0
- package/examples/mods/token-meter/main.ts +8 -0
- package/examples/mods/token-meter/manifest.json +1 -0
- package/examples/mods/tool-guard/README.md +1 -0
- package/examples/mods/tool-guard/main.ts +9 -0
- package/examples/mods/tool-guard/manifest.json +1 -0
- package/out/web/assets/CliSessionsView-CtzUJpK_.css +1 -0
- package/out/web/assets/CliSessionsView-D7hw0Mgj.js +1 -0
- package/out/web/assets/CodeReviewPage-C7bEOJfd.js +4 -0
- package/out/web/assets/CodeReviewPage-Dte9uLiL.css +1 -0
- package/out/web/assets/CommandPalette-0RrF-AOT.js +1 -0
- package/out/web/assets/ImageStudioPanel-CdxkAf_r.js +1 -0
- package/out/web/assets/LibraryPage--Qfisp6D.js +2 -0
- package/out/web/assets/LibraryPage-DAxUTAg7.css +1 -0
- package/out/web/assets/LinkedFoldersView-2nfZbDgN.js +1 -0
- package/out/web/assets/McpRegistryPicker-h9uS8_wT.js +1 -0
- package/out/web/assets/McpServersView-slfQJzNB.js +1 -0
- package/out/web/assets/MintDashboard-BSR5XpXh.js +25 -0
- package/out/web/assets/MintDashboard-CWUcCGhd.css +1 -0
- package/out/web/assets/PluginsView-l7LSm503.js +1 -0
- package/out/web/assets/ScheduledTasksView-CttmLbq1.js +1 -0
- package/out/web/assets/SettingsWindow-BCMLYvEV.js +4 -0
- package/out/web/assets/SettingsWindow-DcMVmU9u.css +1 -0
- package/out/web/assets/SkillsView-rNs1qr_U.js +2 -0
- package/out/web/assets/ToolSurfacePage-B9DzEPWN.js +37 -0
- package/out/web/assets/ToolSurfacePage-CTfgggF2.css +1 -0
- package/out/web/assets/VeoStudioPanel-DiJs_Cg2.js +4 -0
- package/out/web/assets/WorkspaceSelector-B2xIp04D.js +1 -0
- package/out/web/assets/WorkspaceSelector-Ca8uJOsS.css +1 -0
- package/out/web/assets/{abnfDiagram-VCTEODGH-ByMyfanq.js → abnfDiagram-VCTEODGH-CD0CjoGl.js} +1 -1
- package/out/web/assets/{architecture-7GRP2DOG-CLq2kEOB.js → architecture-7GRP2DOG-RKV83OeZ.js} +1 -1
- package/out/web/assets/{architectureDiagram-5GKGNRK7-6PoVSmNG.js → architectureDiagram-5GKGNRK7-nN_HAFct.js} +1 -1
- package/out/web/assets/{blockDiagram-NRAW4CY4-cKw9mAKi.js → blockDiagram-NRAW4CY4-BrrqzHW5.js} +1 -1
- package/out/web/assets/{c4Diagram-UCG6FXSJ-Cqy8N5Ge.js → c4Diagram-UCG6FXSJ-DTdV8_zE.js} +1 -1
- package/out/web/assets/{chunk-75Z2AOVW-3qybijF5.js → chunk-75Z2AOVW-_M0z5olV.js} +1 -1
- package/out/web/assets/chunk-CKBBP62Z-BpQEgeHF.js +2 -0
- package/out/web/assets/{chunk-CLGD4ZFX-CndDQkww.js → chunk-CLGD4ZFX-D54yGvGS.js} +1 -1
- package/out/web/assets/{chunk-DSNCTWBM-Cc4NxvgD.js → chunk-DSNCTWBM-C-gvT2ru.js} +1 -1
- package/out/web/assets/{chunk-DU6HZSFF-drzh6GsU.js → chunk-DU6HZSFF-CnFngIhW.js} +1 -1
- package/out/web/assets/{chunk-F27PBJKO-FiY35l4v.js → chunk-F27PBJKO-BqtWrnEO.js} +1 -1
- package/out/web/assets/{chunk-G27WJ6UU-Bjt9Il4A.js → chunk-G27WJ6UU-Ckoq5mi2.js} +1 -1
- package/out/web/assets/{chunk-GMAD6QVW-Bppi3Ctd.js → chunk-GMAD6QVW-BuhEcgHq.js} +1 -1
- package/out/web/assets/{chunk-JQ64N6SF-DGg5kcEV.js → chunk-JQ64N6SF-CF8T7GiZ.js} +1 -1
- package/out/web/assets/{chunk-LCL6LL3I-CCYcjd7p.js → chunk-LCL6LL3I-BhXV9zyH.js} +1 -1
- package/out/web/assets/{chunk-OBVCFTLP-DJeNil5M.js → chunk-OBVCFTLP-CRIkunUB.js} +1 -1
- package/out/web/assets/{chunk-P2QGCYS3-lRzkRjBB.js → chunk-P2QGCYS3-UFEU6BxZ.js} +1 -1
- package/out/web/assets/{chunk-POPQ4Y6H-DouASMBW.js → chunk-POPQ4Y6H-CQcrNbjr.js} +1 -1
- package/out/web/assets/{chunk-PWAF6VOD-DMmD1vVf.js → chunk-PWAF6VOD-Cc2uVDsG.js} +1 -1
- package/out/web/assets/{chunk-R7TYR2AO-CYLA5UC5.js → chunk-R7TYR2AO-DiCxzdAY.js} +1 -1
- package/out/web/assets/{chunk-RHFEMEQ7-BiXwEcUT.js → chunk-RHFEMEQ7-b7hnPmrR.js} +1 -1
- package/out/web/assets/{chunk-SVP7TREG-BV-zPslF.js → chunk-SVP7TREG-Bu_yYb-V.js} +1 -1
- package/out/web/assets/{chunk-TEH6E4GO-B2RGEohZ.js → chunk-TEH6E4GO-G4Cdlyrt.js} +1 -1
- package/out/web/assets/classDiagram-DTDB5LWJ-RnC2mYO4.js +1 -0
- package/out/web/assets/classDiagram-v2-JRS7N3AN-RnC2mYO4.js +1 -0
- package/out/web/assets/config-CnvCChUM.js +2 -0
- package/out/web/assets/config-DM6oIVO3.css +1 -0
- package/out/web/assets/core-DsKkQ7ig.js +1 -0
- package/out/web/assets/{cynefin-OW5HDTMX-Cas4csHM.js → cynefin-OW5HDTMX-CnzQfOGp.js} +1 -1
- package/out/web/assets/{cynefinDiagram-5FMLGOSQ-Bbpj66Y3.js → cynefinDiagram-5FMLGOSQ-DVtQnfpm.js} +1 -1
- package/out/web/assets/{dagre-3AP2YEHR-B0-2RDEd.js → dagre-3AP2YEHR-DG76_k5_.js} +1 -1
- package/out/web/assets/{diagram-S7CK7UJ4-BdzEjUyH.js → diagram-S7CK7UJ4-CaouUoze.js} +1 -1
- package/out/web/assets/{diagram-UQ7AKVKN-CJDwyPxF.js → diagram-UQ7AKVKN-B4bEc26B.js} +1 -1
- package/out/web/assets/{diagram-VSXAHHWV-BxaG1r_B.js → diagram-VSXAHHWV-BJ86Ov2Y.js} +1 -1
- package/out/web/assets/{diagram-VX7I27RA-BMmUqm8f.js → diagram-VX7I27RA-7hH5IPYf.js} +1 -1
- package/out/web/assets/{diagram-Z3DM3KII-CFtd03eE.js → diagram-Z3DM3KII-CCM4clo8.js} +1 -1
- package/out/web/assets/dist-js-BkYNznHX.js +1 -0
- package/out/web/assets/{ebnfDiagram-PWID7BFC-DwAen1hO.js → ebnfDiagram-PWID7BFC-Da7WAM3k.js} +1 -1
- package/out/web/assets/{erDiagram-SSCWMZ5O-BCZSHACj.js → erDiagram-SSCWMZ5O-CzzmnZWT.js} +1 -1
- package/out/web/assets/{event-ChBVpRy0.js → event-Cdt7Byyj.js} +1 -1
- package/out/web/assets/{eventmodeling-NTZA5JFV-XHStE4E_.js → eventmodeling-NTZA5JFV-xcfsA0XD.js} +1 -1
- package/out/web/assets/flowDiagram-A5DVABFB-JdtH1673.js +1 -0
- package/out/web/assets/{ganttDiagram-EL5Y4UJY-BAEu1Cql.js → ganttDiagram-EL5Y4UJY-B3ClFGmL.js} +1 -1
- package/out/web/assets/{gitGraph-4MIJSDKK-r32Vyper.js → gitGraph-4MIJSDKK-BZ_y_cDU.js} +1 -1
- package/out/web/assets/{gitGraphDiagram-WWUBYQGX-z9o9qt6V.js → gitGraphDiagram-WWUBYQGX-drhRSYm3.js} +1 -1
- package/out/web/assets/index-BZ9xgmMP.css +1 -0
- package/out/web/assets/index-Ca8cCS4h.js +168 -0
- package/out/web/assets/{info-A6RAGUB7-BvLaC2cw.js → info-A6RAGUB7-B7I3K0F1.js} +1 -1
- package/out/web/assets/{infoDiagram-RXCK75RN-Be6WAXXw.js → infoDiagram-RXCK75RN-deX_1MPh.js} +1 -1
- package/out/web/assets/{ishikawaDiagram-5VMMS53U-DZjoHJHC.js → ishikawaDiagram-5VMMS53U-s38yo28y.js} +1 -1
- package/out/web/assets/{journeyDiagram-EYS64GPL-CtVkjkGm.js → journeyDiagram-EYS64GPL-CZn2kB8b.js} +1 -1
- package/out/web/assets/jsx-runtime-DN4NhQUK.js +1 -0
- package/out/web/assets/{kanban-definition-3QL26DDD-CW5FMv1w.js → kanban-definition-3QL26DDD-DodjgySL.js} +1 -1
- package/out/web/assets/markdown-CMhYIcWB.js +39 -0
- package/out/web/assets/{mermaid-parser.core-aUgCqsZ5.js → mermaid-parser.core-Whu2rlJC.js} +3 -3
- package/out/web/assets/{mermaid.core-D57sEiSL.js → mermaid.core-CKyPo8VH.js} +4 -4
- package/out/web/assets/{mindmap-definition-FBJOCRG2-DAmSpM3a.js → mindmap-definition-FBJOCRG2-260WBDxZ.js} +1 -1
- package/out/web/assets/modelManager-CUaGWMWu.js +2 -0
- package/out/web/assets/{oauthManager-9jxicDWJ.js → oauthManager-DlNhXJr6.js} +1 -1
- package/out/web/assets/{packet-AYTQ26CC-DJ27iIoJ.js → packet-AYTQ26CC-CEeIRKRG.js} +1 -1
- package/out/web/assets/{pegDiagram-XKGWAZYB-Bj3ii-gS.js → pegDiagram-XKGWAZYB-BYadI-KO.js} +1 -1
- package/out/web/assets/{pie-WAS4IAKB-DG5mCUbc.js → pie-WAS4IAKB-D8uf4dh5.js} +1 -1
- package/out/web/assets/{pieDiagram-E7YTZNPT-BrJLPnDA.js → pieDiagram-E7YTZNPT-CjSDy4hO.js} +1 -1
- package/out/web/assets/{quadrantDiagram-AXDQQJYC-3x_TmF3j.js → quadrantDiagram-AXDQQJYC-B8D3gU5d.js} +1 -1
- package/out/web/assets/{radar-RG4KPBEZ-CrXaTTuV.js → radar-RG4KPBEZ-DZJxnokY.js} +1 -1
- package/out/web/assets/{railroad-74A4TZTK-BpqMH9BE.js → railroad-74A4TZTK-DBysUiUi.js} +1 -1
- package/out/web/assets/{railroad-abnf-HS5TGJTU-DHI0uLlV.js → railroad-abnf-HS5TGJTU-CHWxoJYg.js} +1 -1
- package/out/web/assets/{railroad-ebnf-LZEXJU2U-CQCb316y.js → railroad-ebnf-LZEXJU2U-DDv7X6bY.js} +1 -1
- package/out/web/assets/{railroad-peg-WCYAUIDC-Ph1giKkH.js → railroad-peg-WCYAUIDC-DpfcYYNJ.js} +1 -1
- package/out/web/assets/{railroadDiagram-O6MQD6OU-BRq6wIxx.js → railroadDiagram-O6MQD6OU-CYtyv0t3.js} +1 -1
- package/out/web/assets/{requirementDiagram-EFPCY7ZU-DIJj6G1g.js → requirementDiagram-EFPCY7ZU-D2X-Ewik.js} +1 -1
- package/out/web/assets/{sankeyDiagram-P5KCCOFB-DZajSryq.js → sankeyDiagram-P5KCCOFB-Bn2x6C4Y.js} +1 -1
- package/out/web/assets/{sequenceDiagram-WJ2MYXX4-DxJCWyZS.js → sequenceDiagram-WJ2MYXX4-BvFLKtPd.js} +1 -1
- package/out/web/assets/{stateDiagram-HBIQ2CUA-k6voi8Vf.js → stateDiagram-HBIQ2CUA-Bx0GWeaY.js} +1 -1
- package/out/web/assets/stateDiagram-v2-4QOOHH4V--hol1yg_.js +1 -0
- package/out/web/assets/{swimlanes-XN3QIQJK-igYhTjXB.js → swimlanes-XN3QIQJK-CCma0T7L.js} +1 -1
- package/out/web/assets/swimlanesDiagram-VK2B7HYN-BkohoVsU.js +8 -0
- package/out/web/assets/{timeline-definition-24CTP7MA-Dke2p93p.js → timeline-definition-24CTP7MA-iCRhhJ7C.js} +1 -1
- package/out/web/assets/{treeView-Q6P3EWNA-hNELnXUs.js → treeView-Q6P3EWNA-DZ-y08qp.js} +1 -1
- package/out/web/assets/{treemap-WGGIJYW6-D2B6wDsx.js → treemap-WGGIJYW6-De0CxzMx.js} +1 -1
- package/out/web/assets/{vennDiagram-4TSXK5OY-CDkW7rUP.js → vennDiagram-4TSXK5OY-w_7aZ6xe.js} +1 -1
- package/out/web/assets/{wardley-WFR3VGLG-BECdXETi.js → wardley-WFR3VGLG-DT0y0xJ4.js} +1 -1
- package/out/web/assets/{wardleyDiagram-VM6X3IG4-B5BycpQ4.js → wardleyDiagram-VM6X3IG4-DAdXELbQ.js} +1 -1
- package/out/web/assets/window-BJCVtyET.js +1 -0
- package/out/web/assets/{xychartDiagram-S5SC5T6Z-CtJS3b--.js → xychartDiagram-S5SC5T6Z-IZIXf3Vo.js} +1 -1
- package/out/web/index-web.html +3 -2
- package/out/web/index.html +3 -2
- package/package.json +71 -22
- package/shared-modules/.github/workflows/ci.yml +120 -0
- package/shared-modules/.github/workflows/update.yaml +28 -0
- package/slash-commands.json +7 -2
- package/src/bin/auto-build.js +66 -0
- package/src/bin/desktop.js +113 -0
- package/src/bin/desktop.test.js +113 -0
- package/src/bin/index.js +18 -25
- package/src/bin/index.test.js +89 -0
- package/src/bin/measure-effects.mjs +53 -0
- package/src/bin/package.test.js +28 -0
- package/src/bin/release-notes.test.js +84 -0
- package/src/bin/styles.test.js +20 -0
- package/src/bin/web.js +5 -0
- package/src/bin/web.test.js +39 -0
- package/src/renderer/index.html +0 -2
- package/src/renderer/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/src/renderer/shared/agentProgress.ts +33 -0
- package/src/renderer/shared/components/AgentActivityDrawer.tsx +3 -2
- package/src/renderer/shared/components/AgentActivityTable.tsx +1 -1
- package/src/renderer/shared/components/ApprovalCard.test.tsx +24 -0
- package/src/renderer/shared/components/ApprovalCard.tsx +10 -3
- package/src/renderer/shared/components/ArtifactPreviewPanel.tsx +88 -37
- package/src/renderer/shared/components/AuthGate.tsx +75 -39
- package/src/renderer/shared/components/BackgroundTerminals.tsx +181 -0
- package/src/renderer/shared/components/ChatCodeBlock.tsx +8 -4
- package/src/renderer/shared/components/ChatMessageItem.test.tsx +68 -0
- package/src/renderer/shared/components/ChatMessageItem.tsx +36 -16
- package/src/renderer/shared/components/ChatPanel.test.tsx +21 -0
- package/src/renderer/shared/components/ChatPanel.tsx +294 -272
- package/src/renderer/shared/components/ChunkErrorBoundary.tsx +4 -102
- package/src/renderer/shared/components/CliSessionsView.test.tsx +125 -0
- package/src/renderer/shared/components/CliSessionsView.tsx +61 -13
- package/src/renderer/shared/components/CodeReviewPage.tsx +111 -8
- package/src/renderer/shared/components/CollapsiblePasteInput.tsx +90 -0
- package/src/renderer/shared/components/ContextCompactionStatus.tsx +17 -0
- package/src/renderer/shared/components/DashboardSidebar.tsx +15 -128
- package/src/renderer/shared/components/DesktopTitlebar.tsx +45 -19
- package/src/renderer/shared/components/ErrorNotice.tsx +29 -0
- package/src/renderer/shared/components/FormattedMessage.tsx +11 -0
- package/src/renderer/shared/components/GeminiLiveOverlay.css +86 -0
- package/src/renderer/shared/components/GeminiLiveOverlay.test.tsx +24 -0
- package/src/renderer/shared/components/GeminiLiveOverlay.tsx +85 -101
- package/src/renderer/shared/components/GlideSelect.css +138 -0
- package/src/renderer/shared/components/GlideSelect.d.ts +31 -0
- package/src/renderer/shared/components/GlideSelect.jsx +266 -0
- package/src/renderer/shared/components/ImageSearchCard.tsx +46 -56
- package/src/renderer/shared/components/ImageStudioPanel.tsx +9 -8
- package/src/renderer/shared/components/LibraryItemCard.tsx +72 -0
- package/src/renderer/shared/components/LibraryPage.tsx +165 -0
- package/src/renderer/shared/components/LibraryPreview.tsx +59 -0
- package/src/renderer/shared/components/McpServersView.tsx +27 -8
- package/src/renderer/shared/components/McpToolAllowlist.tsx +2 -4
- package/src/renderer/shared/components/McpToolResults.tsx +99 -0
- package/src/renderer/shared/components/MintDashboard.tsx +308 -770
- package/src/renderer/shared/components/ModSessionControls.tsx +8 -0
- package/src/renderer/shared/components/ModUi.test.tsx +65 -0
- package/src/renderer/shared/components/ModUi.tsx +26 -0
- package/src/renderer/shared/components/ModelSelectorPopover.tsx +14 -7
- package/src/renderer/shared/components/ModsPanel.tsx +156 -0
- package/src/renderer/shared/components/ProgressActivity.tsx +17 -0
- package/src/renderer/shared/components/ReviewHistory.tsx +42 -0
- package/src/renderer/shared/components/RewindModal.tsx +5 -12
- package/src/renderer/shared/components/RunSummaryDashboard.tsx +6 -12
- package/src/renderer/shared/components/ScheduledTasksView.tsx +7 -6
- package/src/renderer/shared/components/SelectField.test.tsx +27 -0
- package/src/renderer/shared/components/SelectField.tsx +38 -0
- package/src/renderer/shared/components/SessionSources.tsx +48 -0
- package/src/renderer/shared/components/SessionSourcesPopover.tsx +61 -0
- package/src/renderer/shared/components/Settings/AgentsTab.tsx +7 -6
- package/src/renderer/shared/components/Settings/AudioTab.tsx +8 -7
- package/src/renderer/shared/components/Settings/AutomationTab.tsx +2 -2
- package/src/renderer/shared/components/Settings/GeneralTab.tsx +33 -32
- package/src/renderer/shared/components/Settings/MemoryTab.test.tsx +37 -0
- package/src/renderer/shared/components/Settings/MemoryTab.tsx +71 -31
- package/src/renderer/shared/components/Settings/NotificationsTab.test.tsx +15 -0
- package/src/renderer/shared/components/Settings/NotificationsTab.tsx +84 -0
- package/src/renderer/shared/components/Settings/ThemeTab.tsx +19 -11
- package/src/renderer/shared/components/SlashChoicePanel.tsx +88 -0
- package/src/renderer/shared/components/SlashSuggestions.test.tsx +33 -0
- package/src/renderer/shared/components/SlashSuggestions.tsx +38 -10
- package/src/renderer/shared/components/SourcesBlock.tsx +12 -20
- package/src/renderer/shared/components/ToolSurfacePage.test.tsx +32 -0
- package/src/renderer/shared/components/ToolSurfacePage.tsx +59 -11
- package/src/renderer/shared/components/ToolsPanelToggle.tsx +13 -0
- package/src/renderer/shared/components/VeoStudioPanel.tsx +9 -8
- package/src/renderer/shared/components/ViewedImages.tsx +36 -0
- package/src/renderer/shared/components/VirtualChatHistory.tsx +82 -0
- package/src/renderer/shared/components/VoicePill.css +85 -0
- package/src/renderer/shared/components/VoicePill.d.ts +12 -0
- package/src/renderer/shared/components/VoicePill.jsx +190 -0
- package/src/renderer/shared/components/VoicePill.test.tsx +22 -0
- package/src/renderer/shared/components/WorkspaceContextPopover.tsx +20 -15
- package/src/renderer/shared/components/WorkspacePaneResizer.tsx +92 -0
- package/src/renderer/shared/components/WorkspacePreviewActions.test.tsx +44 -0
- package/src/renderer/shared/components/WorkspacePreviewActions.tsx +19 -0
- package/src/renderer/shared/components/WorkspaceSelector.tsx +13 -8
- package/src/renderer/shared/components/background-terminals.css +292 -0
- package/src/renderer/shared/components/ui/README.md +52 -0
- package/src/renderer/shared/components/ui/button.tsx +37 -0
- package/src/renderer/shared/components/ui/demo.tsx +26 -0
- package/src/renderer/shared/components/ui/error-recovery.css +35 -0
- package/src/renderer/shared/components/ui/error-recovery.tsx +35 -0
- package/src/renderer/shared/components/ui/voice-powered-orb.css +6 -0
- package/src/renderer/shared/components/ui/voice-powered-orb.tsx +374 -0
- package/src/renderer/shared/components/workspace-selector.css +248 -0
- package/src/renderer/shared/constants/config.ts +30 -1
- package/src/renderer/shared/constants/slashCommands.ts +1 -1
- package/src/renderer/shared/conversation/lifecycle.test.ts +362 -0
- package/src/renderer/shared/conversation/lifecycle.ts +418 -0
- package/src/renderer/shared/conversation/projectNavigation.test.ts +105 -0
- package/src/renderer/shared/conversation/projectNavigation.ts +39 -0
- package/src/renderer/shared/conversation/sourcesTransport.ts +27 -0
- package/src/renderer/shared/conversation/syncView.test.ts +1 -34
- package/src/renderer/shared/conversation/syncView.ts +0 -37
- package/src/renderer/shared/conversation/transport.test.ts +163 -0
- package/src/renderer/shared/conversation/transport.ts +159 -0
- package/src/renderer/shared/conversation/useConversationCoordinator.ts +30 -72
- package/src/renderer/shared/css/agent-observability.css +20 -21
- package/src/renderer/shared/css/auth-gate.css +112 -13
- package/src/renderer/shared/css/code-review.css +33 -0
- package/src/renderer/shared/css/code-sessions.css +27 -0
- package/src/renderer/shared/css/collapsed-paste.css +35 -0
- package/src/renderer/shared/css/effects.css +15 -0
- package/src/renderer/shared/css/error-notice.css +60 -0
- package/src/renderer/shared/css/library.css +476 -0
- package/src/renderer/shared/css/management-views.css +138 -0
- package/src/renderer/shared/css/mcp-results.css +11 -0
- package/src/renderer/shared/css/model-selector.css +163 -105
- package/src/renderer/shared/css/mods.css +77 -0
- package/src/renderer/shared/css/notification-notice.css +28 -0
- package/src/renderer/shared/css/session-sources-popover.css +9 -0
- package/src/renderer/shared/css/session-sources.css +23 -0
- package/src/renderer/shared/css/settings/memory.css +154 -0
- package/src/renderer/shared/css/settings/notifications.css +11 -0
- package/src/renderer/shared/css/settings/theme.css +5 -0
- package/src/renderer/shared/css/slash-choice.css +95 -0
- package/src/renderer/shared/css/slash-suggestions.css +68 -0
- package/src/renderer/shared/css/sources-block.css +91 -0
- package/src/renderer/shared/css/thinking-status.css +46 -0
- package/src/renderer/shared/css/tools-panel.css +7 -0
- package/src/renderer/shared/css/ui-tailwind.css +19 -0
- package/src/renderer/shared/css/viewed-images.css +15 -0
- package/src/renderer/shared/fonts.css +46 -0
- package/src/renderer/shared/fonts.ts +3 -12
- package/src/renderer/shared/lib/utils.ts +6 -0
- package/src/renderer/shared/library/controller.test.ts +61 -0
- package/src/renderer/shared/library/controller.ts +57 -0
- package/src/renderer/shared/library/transport.test.ts +26 -0
- package/src/renderer/shared/library/transport.ts +60 -0
- package/src/renderer/shared/library/useLibraryFile.ts +38 -0
- package/src/renderer/shared/mods.ts +58 -0
- package/src/renderer/shared/platform.test.ts +57 -1
- package/src/renderer/shared/platform.ts +46 -1
- package/src/renderer/shared/theme/themeManager.test.ts +43 -0
- package/src/renderer/shared/theme/themeManager.ts +17 -4
- package/src/renderer/shared/types.ts +56 -2
- package/src/renderer/shared/utils/agentActivity.test.ts +75 -0
- package/src/renderer/shared/utils/agentActivity.ts +42 -3
- package/src/renderer/shared/utils/approval.tsx +7 -0
- package/src/renderer/shared/utils/artifactBrowser.test.ts +80 -0
- package/src/renderer/shared/utils/artifactBrowser.ts +41 -0
- package/src/renderer/shared/utils/contextCompaction.test.tsx +48 -0
- package/src/renderer/shared/utils/contextCompaction.ts +21 -0
- package/src/renderer/shared/utils/effectVisibility.ts +9 -0
- package/src/renderer/shared/utils/markdown.tsx +3 -3
- package/src/renderer/shared/utils/mcpResults.test.tsx +91 -0
- package/src/renderer/shared/utils/modViewport.ts +7 -0
- package/src/renderer/shared/utils/nativeRecordingSession.test.ts +61 -0
- package/src/renderer/shared/utils/nativeRecordingSession.ts +46 -0
- package/src/renderer/shared/utils/notificationSettings.test.ts +14 -0
- package/src/renderer/shared/utils/notificationSettings.ts +23 -0
- package/src/renderer/shared/utils/notifications.test.ts +51 -0
- package/src/renderer/shared/utils/notifications.ts +54 -0
- package/src/renderer/shared/utils/pastedText.test.ts +20 -0
- package/src/renderer/shared/utils/pastedText.ts +13 -0
- package/src/renderer/shared/utils/progressCache.test.ts +32 -0
- package/src/renderer/shared/utils/sessionSources.test.ts +31 -0
- package/src/renderer/shared/utils/sessionSources.ts +34 -0
- package/src/renderer/shared/utils/slashCommandProcessor.ts +1 -1
- package/src/renderer/shared/utils/sourceAttachments.ts +28 -0
- package/src/renderer/shared/utils/speech.ts +51 -9
- package/src/renderer/shared/utils/syntaxHighlight.test.tsx +22 -0
- package/src/renderer/shared/utils/syntaxHighlight.tsx +26 -0
- package/src/renderer/shared/utils/useGeminiLiveVoice.ts +49 -5
- package/src/renderer/shared/utils/useLatestCallback.ts +9 -0
- package/src/renderer/shared/utils/useNativeVoiceInput.ts +80 -72
- package/src/renderer/shared/utils/useSessionSources.ts +33 -0
- package/src/renderer/shared/utils/viewedImages.ts +26 -0
- package/src/renderer/shared/utils/workspacePane.test.ts +33 -0
- package/src/renderer/shared/utils/workspacePane.ts +20 -0
- package/src/renderer/shared/utils/workspacePreview.test.ts +24 -0
- package/src/renderer/shared/utils/workspacePreview.ts +16 -0
- package/src/renderer/shared/utils/workspaceSnapshot.test.ts +49 -0
- package/src/renderer/shared/utils/workspaceSnapshot.ts +26 -0
- package/src/renderer/shared/utils/workspaces.ts +10 -0
- package/src/renderer/shared/workspaceUndo.ts +88 -0
- package/src/renderer/src/App.tsx +9 -1
- package/src/renderer/src/components/LiveTranslateControls.tsx +65 -0
- package/src/renderer/src/components/PicturesLibrary.tsx +2 -288
- package/src/renderer/src/components/ScreenPicker.css +67 -30
- package/src/renderer/src/components/ScreenPicker.tsx +201 -60
- package/src/renderer/src/components/SettingsWindow.tsx +10 -5
- package/src/renderer/src/components/WorkspacePanel.tsx +222 -32
- package/src/renderer/src/components/browser-shell.css +1 -1
- package/src/renderer/src/components/browser-suggestions-popup.css +1 -1
- package/src/renderer/src/components/liveTranslateFrames.test.ts +26 -5
- package/src/renderer/src/components/liveTranslateFrames.ts +18 -7
- package/src/renderer/src/components/liveTranslateLanguage.ts +6 -0
- package/src/renderer/src/css/app-shell.css +52 -137
- package/src/renderer/src/css/chat.css +21 -495
- package/src/renderer/src/css/desktop-tools.css +199 -1
- package/src/renderer/src/css/misc.css +0 -52
- package/src/renderer/src/css/pictures.css +2 -415
- package/src/renderer/src/css/settings/base.css +50 -47
- package/src/renderer/src/css/sidebar-workspace.css +151 -94
- package/src/renderer/src/css/tool-surfaces.css +65 -9
- package/src/renderer/src/css/widget.css +1 -1
- package/src/renderer/src/env.d.ts +1 -9
- package/src/renderer/src/index.css +1 -1
- package/src/renderer/src/main.tsx +2 -1
- package/src/renderer/src/proactiveSuggestions.ts +29 -0
- package/src/renderer/src/tauri.ts +122 -330
- package/src/renderer/src/voiceInput.ts +2 -1
- package/src/renderer/src-web/components/PicturesLibrary.tsx +2 -285
- package/src/renderer/src-web/components/PullToRefresh.tsx +1 -1
- package/src/renderer/src-web/components/SettingsWindow.tsx +10 -5
- package/src/renderer/src-web/css/app-shell.css +24 -121
- package/src/renderer/src-web/css/chat.css +21 -495
- package/src/renderer/src-web/css/misc.css +0 -52
- package/src/renderer/src-web/css/mobile.css +15 -14
- package/src/renderer/src-web/css/pictures.css +2 -462
- package/src/renderer/src-web/css/settings/base.css +50 -47
- package/src/renderer/src-web/css/sidebar-workspace.css +9 -95
- package/src/renderer/src-web/css/widget.css +1 -1
- package/src/renderer/src-web/env.d.ts +1 -12
- package/src/renderer/src-web/index.css +1 -1
- package/src/renderer/src-web/main.tsx +2 -1
- package/src/renderer/src-web/proactiveSuggestions.ts +3 -0
- package/src/renderer/src-web/tauri.ts +129 -354
- package/src/renderer/tests/backgroundTerminals.browser.html +81 -0
- package/src/renderer/tests/chatPanelFixture.ts +23 -0
- package/src/renderer/tests/chatPerformance.browser.html +71 -0
- package/src/renderer/tests/cliSessions.browser.html +82 -0
- package/src/renderer/tests/collapsedPaste.browser.html +70 -0
- package/src/renderer/tests/composerMenus.browser.html +116 -0
- package/src/renderer/tests/contextCompaction.browser.html +17 -0
- package/src/renderer/tests/conversationLifecycle.browser.html +70 -0
- package/src/renderer/tests/effectsPerformance.browser.html +13 -0
- package/src/renderer/tests/errorRecovery.browser.html +21 -0
- package/src/renderer/tests/glideSelect.browser.html +71 -0
- package/src/renderer/tests/glideSelect.preview.html +27 -0
- package/src/renderer/tests/library.browser.html +1 -0
- package/src/renderer/tests/library.browser.tsx +78 -0
- package/src/renderer/tests/liveOrb.browser.html +49 -0
- package/src/renderer/tests/liveVoice.browser.html +29 -0
- package/src/renderer/tests/modInput.browser.html +22 -0
- package/src/renderer/tests/sessionSources.browser.html +1 -0
- package/src/renderer/tests/sessionSources.browser.tsx +107 -0
- package/src/renderer/tests/skills.browser.html +24 -0
- package/src/renderer/tests/toolsPanel.browser.html +1 -0
- package/src/renderer/tests/toolsPanel.browser.tsx +113 -0
- package/src/renderer/tests/viewedImages.browser.html +1 -0
- package/src/renderer/tests/viewedImages.browser.tsx +93 -0
- package/src/renderer/tests/voicePill.browser.html +80 -0
- package/src/renderer/tests/voicePill.preview.html +34 -0
- package/src/renderer/tests/webSources.browser.html +1 -0
- package/src/renderer/tests/webSources.browser.tsx +98 -0
- package/src/renderer/tests/workspaceUndo.browser.html +92 -0
- package/src-tauri/Cargo.toml +40 -0
- package/src-tauri/build.rs +3 -0
- package/src-tauri/src/app/lifecycle.rs +277 -0
- package/src-tauri/src/app/mod.rs +4 -0
- package/src-tauri/src/app/shortcuts.rs +40 -0
- package/src-tauri/src/app/tray.rs +52 -0
- package/src-tauri/src/background/events.rs +70 -0
- package/src-tauri/src/background/headless.rs +230 -0
- package/src-tauri/src/background/mod.rs +4 -0
- package/src-tauri/src/background/proactive.rs +262 -0
- package/src-tauri/src/commands/approvals.rs +20 -0
- package/src-tauri/src/commands/auth.rs +127 -0
- package/src-tauri/src/commands/conversation.rs +642 -0
- package/src-tauri/src/commands/integrations.rs +157 -0
- package/src-tauri/src/commands/media.rs +179 -0
- package/src-tauri/src/commands/mod.rs +11 -0
- package/src-tauri/src/commands/mods.rs +6 -0
- package/src-tauri/src/commands/settings.rs +141 -0
- package/src-tauri/src/commands/voice.rs +153 -0
- package/src-tauri/src/commands/workspace.rs +501 -0
- package/src-tauri/src/lib.rs +10 -0
- package/src-tauri/src/main.rs +3 -0
- package/src-tauri/src/native/actions.rs +206 -0
- package/src-tauri/src/native/browser.rs +252 -0
- package/src-tauri/src/native/capture.rs +695 -0
- package/src-tauri/src/native/discord_rpc.rs +99 -0
- package/src-tauri/src/native/integrations.rs +126 -0
- package/src-tauri/src/native/mod.rs +12 -0
- package/src-tauri/src/native/notifications.rs +51 -0
- package/src-tauri/src/native/plugins.rs +14 -0
- package/src-tauri/src/native/system.rs +250 -0
- package/src-tauri/src/native/terminal.rs +201 -0
- package/src-tauri/src/native/updater.rs +148 -0
- package/src-tauri/src/native/windows.rs +143 -0
- package/tsconfig.json +2 -0
- package/vite.config.ts +4 -1
- package/vite.config.web.ts +4 -0
- package/.cargo/config.toml +0 -13
- package/.claude/settings.local.json +0 -182
- package/.codex +0 -0
- package/CLAUDE.md +0 -102
- package/ROADMAP.md +0 -30
- package/mint-presentation-demo.mp4 +0 -0
- package/out/web/Live2DCubismCore.js +0 -9
- package/out/web/assets/CliSessionsView-BxUVWEEL.js +0 -1
- package/out/web/assets/CliSessionsView-CBDTXuQv.css +0 -1
- package/out/web/assets/CodeReviewPage-DkMgfcos.css +0 -1
- package/out/web/assets/CodeReviewPage-jKlmLJwT.js +0 -3
- package/out/web/assets/CommandPalette-DnwPA5hy.js +0 -1
- package/out/web/assets/ImageStudioPanel-BR1XFwhR.js +0 -1
- package/out/web/assets/LinkedFoldersView-bi-CWQ-I.js +0 -1
- package/out/web/assets/McpRegistryPicker-D5tEFnyq.js +0 -1
- package/out/web/assets/McpServersView-BGG1dhFM.js +0 -1
- package/out/web/assets/MintDashboard-BIglDEWX.js +0 -20
- package/out/web/assets/MintDashboard-DSMywSgs.css +0 -1
- package/out/web/assets/ModelPanel-CbJ1PFoZ.js +0 -1
- package/out/web/assets/PicturesLibrary-CQP0fLP1.css +0 -1
- package/out/web/assets/PicturesLibrary-DoYN7T1p.js +0 -1
- package/out/web/assets/PluginsView-CU1HWXGk.js +0 -1
- package/out/web/assets/ScheduledTasksView-Bnl36y2N.js +0 -1
- package/out/web/assets/SettingsWindow-DhWLAn9T.css +0 -1
- package/out/web/assets/SettingsWindow-Dw8L01pw.js +0 -2
- package/out/web/assets/SkillsView-cnl8aY5p.js +0 -2
- package/out/web/assets/ToolSurfacePage-CgsQw6l5.css +0 -1
- package/out/web/assets/ToolSurfacePage-Cz2VJAPZ.js +0 -37
- package/out/web/assets/VeoStudioPanel-D4JnERWR.js +0 -4
- package/out/web/assets/chunk-CKBBP62Z-cIrXq6jN.js +0 -2
- package/out/web/assets/classDiagram-DTDB5LWJ-Dq0smRWk.js +0 -1
- package/out/web/assets/classDiagram-v2-JRS7N3AN-Dq0smRWk.js +0 -1
- package/out/web/assets/config-C-ZFtipU.css +0 -1
- package/out/web/assets/config-eEDngJXO.js +0 -1
- package/out/web/assets/core-hQ2VA9Ti.js +0 -1
- package/out/web/assets/dist-js-Bf2bhoku.js +0 -1
- package/out/web/assets/flowDiagram-A5DVABFB-BLg7nEcd.js +0 -1
- package/out/web/assets/index-Btsf4L8M.css +0 -1
- package/out/web/assets/index-D8D9MeRA.js +0 -11
- package/out/web/assets/lucide-react-Ip3L6Jtn.js +0 -1
- package/out/web/assets/markdown-BSeeUbJH.js +0 -38
- package/out/web/assets/modelManager-tMVmJVAW.js +0 -2
- package/out/web/assets/prompt-latin-400-normal-BQ9zjSN8.woff2 +0 -0
- package/out/web/assets/prompt-latin-400-normal-CxU4ec_r.woff +0 -0
- package/out/web/assets/prompt-latin-500-normal-B1edBDQ9.woff +0 -0
- package/out/web/assets/prompt-latin-500-normal-CxzxEHZc.woff2 +0 -0
- package/out/web/assets/prompt-latin-600-normal-CSDDLorv.woff +0 -0
- package/out/web/assets/prompt-latin-600-normal-hKZWXsc1.woff2 +0 -0
- 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-400-normal-BrkKv8cO.woff2 +0 -0
- package/out/web/assets/prompt-thai-400-normal-DJypnfr3.woff +0 -0
- package/out/web/assets/prompt-thai-500-normal-C18pDUoL.woff2 +0 -0
- package/out/web/assets/prompt-thai-500-normal-D7YNqUJD.woff +0 -0
- package/out/web/assets/prompt-thai-600-normal-CYPViXds.woff +0 -0
- package/out/web/assets/prompt-thai-600-normal-MrdfU7zR.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/stateDiagram-v2-4QOOHH4V-DeEc0lGZ.js +0 -1
- package/out/web/assets/swimlanesDiagram-VK2B7HYN-DpVik9v7.js +0 -8
- package/out/web/assets/window-5qYXKoW7.js +0 -1
- package/skills-lock.json +0 -77
- package/src/renderer/public/Live2DCubismCore.js +0 -9
- package/src/renderer/src/companionWidget.ts +0 -95
- package/src/renderer/src/components/Live2DStage.tsx +0 -412
- package/src/renderer/src/components/ModelPanel.tsx +0 -155
- package/src/renderer/src/css/model.css +0 -628
- package/src/renderer/src-web/companionWidget.ts +0 -37
- package/src/renderer/src-web/components/ModelPanel.tsx +0 -12
- package/src/renderer/src-web/css/model.css +0 -628
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#![cfg(unix)]
|
|
2
|
+
|
|
3
|
+
use std::{
|
|
4
|
+
io::{BufRead, BufReader, Write},
|
|
5
|
+
net::TcpListener,
|
|
6
|
+
process::{Child, Command, Stdio},
|
|
7
|
+
time::{Duration, Instant},
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
struct Worker(Child);
|
|
11
|
+
impl Drop for Worker {
|
|
12
|
+
fn drop(&mut self) {
|
|
13
|
+
let _ = self.0.kill();
|
|
14
|
+
let _ = self.0.wait();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
#[test]
|
|
19
|
+
fn shutdown_worker() {
|
|
20
|
+
let Ok(port) = std::env::var("MINT_SHUTDOWN_TEST_PORT") else {
|
|
21
|
+
return;
|
|
22
|
+
};
|
|
23
|
+
let runtime = tokio::runtime::Runtime::new().unwrap();
|
|
24
|
+
runtime.block_on(async {
|
|
25
|
+
let (exit, exited) = tokio::sync::oneshot::channel();
|
|
26
|
+
tokio::spawn(mint_core::api_server::shutdown_on_signal(move || {
|
|
27
|
+
let _ = exit.send(());
|
|
28
|
+
}));
|
|
29
|
+
tokio::spawn(async move {
|
|
30
|
+
let result = mint_core::start_api_server(port.parse().unwrap()).await;
|
|
31
|
+
println!("API_STOPPED: {}", result.is_ok());
|
|
32
|
+
std::io::stdout().flush().unwrap();
|
|
33
|
+
});
|
|
34
|
+
// Let the watcher install its signal subscriptions even when the API cannot bind.
|
|
35
|
+
tokio::time::sleep(Duration::from_millis(100)).await;
|
|
36
|
+
println!("READY");
|
|
37
|
+
std::io::stdout().flush().unwrap();
|
|
38
|
+
exited.await.unwrap();
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
fn expect_shutdown(signal: i32, occupied: bool) {
|
|
43
|
+
let reservation = TcpListener::bind("127.0.0.1:0").unwrap();
|
|
44
|
+
let port = reservation.local_addr().unwrap().port();
|
|
45
|
+
let reservation = occupied.then_some(reservation);
|
|
46
|
+
let config = std::env::temp_dir().join(format!(
|
|
47
|
+
"mint-shutdown-missing-{}.json",
|
|
48
|
+
uuid::Uuid::new_v4()
|
|
49
|
+
));
|
|
50
|
+
let mut worker = Worker(
|
|
51
|
+
Command::new(std::env::current_exe().unwrap())
|
|
52
|
+
.args(["--exact", "shutdown_worker", "--nocapture"])
|
|
53
|
+
.env("MINT_SHUTDOWN_TEST_PORT", port.to_string())
|
|
54
|
+
.env("MINT_CONFIG_PATH", config)
|
|
55
|
+
.stdout(Stdio::piped())
|
|
56
|
+
.stderr(Stdio::null())
|
|
57
|
+
.spawn()
|
|
58
|
+
.unwrap(),
|
|
59
|
+
);
|
|
60
|
+
let mut output = BufReader::new(worker.0.stdout.take().unwrap());
|
|
61
|
+
let mut line = String::new();
|
|
62
|
+
loop {
|
|
63
|
+
line.clear();
|
|
64
|
+
assert_ne!(
|
|
65
|
+
output.read_line(&mut line).unwrap(),
|
|
66
|
+
0,
|
|
67
|
+
"worker exited before readiness"
|
|
68
|
+
);
|
|
69
|
+
if line.trim() == "READY" {
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if !occupied {
|
|
74
|
+
std::net::TcpStream::connect(("127.0.0.1", port)).unwrap();
|
|
75
|
+
}
|
|
76
|
+
assert_eq!(unsafe { libc::kill(worker.0.id() as i32, signal) }, 0);
|
|
77
|
+
let deadline = Instant::now() + Duration::from_secs(3);
|
|
78
|
+
let status = loop {
|
|
79
|
+
if let Some(status) = worker.0.try_wait().unwrap() {
|
|
80
|
+
break Some(status);
|
|
81
|
+
}
|
|
82
|
+
if Instant::now() >= deadline {
|
|
83
|
+
break None;
|
|
84
|
+
}
|
|
85
|
+
std::thread::sleep(Duration::from_millis(20));
|
|
86
|
+
};
|
|
87
|
+
drop(reservation);
|
|
88
|
+
assert!(
|
|
89
|
+
status.is_some(),
|
|
90
|
+
"terminal signal stopped the embedded API but left the Desktop lifetime running"
|
|
91
|
+
);
|
|
92
|
+
assert!(
|
|
93
|
+
status.unwrap().success(),
|
|
94
|
+
"shutdown callback was bypassed by the OS default signal action"
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
#[test]
|
|
99
|
+
fn ctrl_c_exits_the_host_of_an_embedded_api() {
|
|
100
|
+
expect_shutdown(libc::SIGINT, false);
|
|
101
|
+
}
|
|
102
|
+
#[test]
|
|
103
|
+
fn sigterm_exits_the_host_of_an_embedded_api() {
|
|
104
|
+
expect_shutdown(libc::SIGTERM, false);
|
|
105
|
+
}
|
|
106
|
+
#[test]
|
|
107
|
+
fn ctrl_c_exits_the_host_even_when_the_api_port_is_in_use() {
|
|
108
|
+
expect_shutdown(libc::SIGINT, true);
|
|
109
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "mint-mod-runtime"
|
|
3
|
+
version.workspace = true
|
|
4
|
+
edition.workspace = true
|
|
5
|
+
license.workspace = true
|
|
6
|
+
|
|
7
|
+
[dependencies]
|
|
8
|
+
serde.workspace = true
|
|
9
|
+
serde_json.workspace = true
|
|
10
|
+
sha2.workspace = true
|
|
11
|
+
thiserror.workspace = true
|
|
12
|
+
rquickjs = "0.14"
|
|
13
|
+
cpu-time = "1"
|
|
14
|
+
oxc = { version = "0.120", features = ["transformer", "codegen", "semantic"] }
|
|
15
|
+
zip = { version = "2.4", default-features = false, features = ["deflate"] }
|
|
16
|
+
|
|
17
|
+
[dev-dependencies]
|
|
18
|
+
uuid.workspace = true
|
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
//! Portable single-file mod compiler and restricted QuickJS execution engine.
|
|
2
|
+
use rquickjs::{Context, Function, Module, Object, Promise, Runtime, function::Func};
|
|
3
|
+
use serde::{Deserialize, Serialize};
|
|
4
|
+
use serde_json::{Value, json};
|
|
5
|
+
use sha2::{Digest, Sha256};
|
|
6
|
+
use std::{
|
|
7
|
+
io::{self, Write},
|
|
8
|
+
sync::{Arc, Mutex},
|
|
9
|
+
time::Duration,
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
pub const SDK_VERSION: u32 = 1;
|
|
13
|
+
pub const MAX_SOURCE: usize = 512 * 1024;
|
|
14
|
+
mod testing;
|
|
15
|
+
pub use testing::run_tests;
|
|
16
|
+
|
|
17
|
+
pub fn unavailable_usage() -> Value {
|
|
18
|
+
json!({"turnId":0,"totalTokens":null,"contextUsedTokens":null,"contextWindowTokens":null,"contextPercent":null,"contextInputTokens":null,"contextOutputTokens":null,"contextStatus":"unavailable","contextWindowSource":"mint_config","provider":"","model":"","lastTurnDelta":null,"compacted":false,
|
|
19
|
+
"context":{"tokens":null,"window":null,"percent":null,"basis":"input","lastTurnDelta":null},"contextIncludingOutput":{"tokens":null,"window":null,"percent":null,"basis":"input_output","lastTurnDelta":null}})
|
|
20
|
+
}
|
|
21
|
+
pub fn unavailable_viewport() -> Value {
|
|
22
|
+
json!({"surface":null,"columns":null,"rows":null,"widthPx":null,"heightPx":null,"sidePanelOpen":false})
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
26
|
+
#[serde(rename_all = "camelCase", deny_unknown_fields)]
|
|
27
|
+
pub struct Manifest {
|
|
28
|
+
pub id: String,
|
|
29
|
+
pub name: String,
|
|
30
|
+
pub version: String,
|
|
31
|
+
pub sdk_version: u32,
|
|
32
|
+
pub entry: String,
|
|
33
|
+
#[serde(default)]
|
|
34
|
+
pub permissions: Vec<String>,
|
|
35
|
+
}
|
|
36
|
+
impl Manifest {
|
|
37
|
+
pub fn validate(&self) -> Result<(), String> {
|
|
38
|
+
if !valid_id(&self.id)
|
|
39
|
+
|| self.name.is_empty()
|
|
40
|
+
|| self.name.len() > 120
|
|
41
|
+
|| self.version.is_empty()
|
|
42
|
+
|| self.version.len() > 48
|
|
43
|
+
{
|
|
44
|
+
return Err("Invalid mod ID, name or version".into());
|
|
45
|
+
}
|
|
46
|
+
if self.sdk_version != SDK_VERSION {
|
|
47
|
+
return Err("Unsupported SDK version".into());
|
|
48
|
+
}
|
|
49
|
+
if !matches!(self.entry.as_str(), "main.ts" | "main.js") {
|
|
50
|
+
return Err("Entry must be main.ts or main.js".into());
|
|
51
|
+
}
|
|
52
|
+
if self
|
|
53
|
+
.permissions
|
|
54
|
+
.iter()
|
|
55
|
+
.any(|p| !matches!(p.as_str(), "workspace.read" | "tools.request"))
|
|
56
|
+
{
|
|
57
|
+
return Err("Unknown permission".into());
|
|
58
|
+
}
|
|
59
|
+
Ok(())
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
pub fn valid_id(id: &str) -> bool {
|
|
63
|
+
!id.is_empty()
|
|
64
|
+
&& id.len() <= 48
|
|
65
|
+
&& id.as_bytes()[0].is_ascii_lowercase()
|
|
66
|
+
&& id
|
|
67
|
+
.bytes()
|
|
68
|
+
.all(|b| b.is_ascii_lowercase() || b.is_ascii_digit() || b == b'-')
|
|
69
|
+
}
|
|
70
|
+
pub fn content_hash(manifest: &Manifest, source: &str) -> String {
|
|
71
|
+
let mut h = Sha256::new();
|
|
72
|
+
h.update(serde_json::to_vec(manifest).unwrap());
|
|
73
|
+
h.update([0]);
|
|
74
|
+
h.update(source);
|
|
75
|
+
format!("{:x}", h.finalize())
|
|
76
|
+
}
|
|
77
|
+
pub fn validate_package(manifest: &Value, source: &str) -> Result<String, String> {
|
|
78
|
+
let manifest: Manifest = serde_json::from_value(manifest.clone()).map_err(|e| e.to_string())?;
|
|
79
|
+
manifest.validate()?;
|
|
80
|
+
compile(&manifest, source)
|
|
81
|
+
}
|
|
82
|
+
pub fn compile(manifest: &Manifest, source: &str) -> Result<String, String> {
|
|
83
|
+
use oxc::{
|
|
84
|
+
allocator::Allocator,
|
|
85
|
+
ast::ast::Statement,
|
|
86
|
+
codegen::Codegen,
|
|
87
|
+
parser::Parser,
|
|
88
|
+
semantic::SemanticBuilder,
|
|
89
|
+
span::SourceType,
|
|
90
|
+
transformer::{TransformOptions, Transformer},
|
|
91
|
+
};
|
|
92
|
+
manifest.validate()?;
|
|
93
|
+
if source.len() > MAX_SOURCE {
|
|
94
|
+
return Err("Mod source exceeds 512 KiB".into());
|
|
95
|
+
}
|
|
96
|
+
let allocator = Allocator::default();
|
|
97
|
+
let parsed = Parser::new(
|
|
98
|
+
&allocator,
|
|
99
|
+
source,
|
|
100
|
+
SourceType::from_path(&manifest.entry).map_err(|e| e.to_string())?,
|
|
101
|
+
)
|
|
102
|
+
.parse();
|
|
103
|
+
if !parsed.errors.is_empty() {
|
|
104
|
+
return Err(format!("Syntax error: {:?}", parsed.errors));
|
|
105
|
+
}
|
|
106
|
+
let mut program = parsed.program;
|
|
107
|
+
for statement in &program.body {
|
|
108
|
+
if let Statement::ImportDeclaration(import) = statement {
|
|
109
|
+
if import.source.value.as_str() != "@mint/mods" {
|
|
110
|
+
return Err("Only @mint/mods imports are supported".into());
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if matches!(statement, Statement::ExportAllDeclaration(_)) {
|
|
114
|
+
return Err("Re-exports are not supported".into());
|
|
115
|
+
}
|
|
116
|
+
if let Statement::ExportNamedDeclaration(export) = statement {
|
|
117
|
+
if export.source.is_some() {
|
|
118
|
+
return Err("Re-exports are not supported".into());
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
program
|
|
123
|
+
.body
|
|
124
|
+
.retain(|s| !matches!(s, Statement::ImportDeclaration(_)));
|
|
125
|
+
let semantic = SemanticBuilder::new().build(&program);
|
|
126
|
+
if !semantic.errors.is_empty() {
|
|
127
|
+
return Err(format!("Invalid module: {:?}", semantic.errors));
|
|
128
|
+
}
|
|
129
|
+
let result = Transformer::new(
|
|
130
|
+
&allocator,
|
|
131
|
+
std::path::Path::new(&manifest.entry),
|
|
132
|
+
&TransformOptions::default(),
|
|
133
|
+
)
|
|
134
|
+
.build_with_scoping(semantic.semantic.into_scoping(), &mut program);
|
|
135
|
+
if !result.errors.is_empty() {
|
|
136
|
+
return Err(format!("Transform error: {:?}", result.errors));
|
|
137
|
+
}
|
|
138
|
+
Ok(Codegen::new().build(&program).code)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
pub fn validate_ui(tree: &Value) -> Result<(), String> {
|
|
142
|
+
fn walk(v: &Value, depth: usize, nodes: &mut usize) -> Result<(), String> {
|
|
143
|
+
*nodes += 1;
|
|
144
|
+
if depth > 12 || *nodes > 256 {
|
|
145
|
+
return Err("UI tree is too large".into());
|
|
146
|
+
}
|
|
147
|
+
let obj = v.as_object().ok_or("UI node must be an object")?;
|
|
148
|
+
let kind = obj
|
|
149
|
+
.get("type")
|
|
150
|
+
.and_then(Value::as_str)
|
|
151
|
+
.ok_or("Missing UI type")?;
|
|
152
|
+
if !matches!(
|
|
153
|
+
kind,
|
|
154
|
+
"text" | "stack" | "button" | "input" | "table" | "badge" | "progress"
|
|
155
|
+
) {
|
|
156
|
+
return Err("Unsupported UI type".into());
|
|
157
|
+
}
|
|
158
|
+
if obj.keys().any(|k| {
|
|
159
|
+
![
|
|
160
|
+
"type",
|
|
161
|
+
"text",
|
|
162
|
+
"children",
|
|
163
|
+
"action",
|
|
164
|
+
"label",
|
|
165
|
+
"value",
|
|
166
|
+
"max",
|
|
167
|
+
"columns",
|
|
168
|
+
"rows",
|
|
169
|
+
"direction",
|
|
170
|
+
"placeholder",
|
|
171
|
+
"tone",
|
|
172
|
+
"color",
|
|
173
|
+
]
|
|
174
|
+
.contains(&k.as_str())
|
|
175
|
+
}) {
|
|
176
|
+
return Err("Unsupported UI property".into());
|
|
177
|
+
}
|
|
178
|
+
if obj.get("color").is_some_and(|v| {
|
|
179
|
+
!matches!(
|
|
180
|
+
v.as_str(),
|
|
181
|
+
Some("default" | "yellow" | "cyan" | "blue" | "magenta" | "red")
|
|
182
|
+
)
|
|
183
|
+
}) {
|
|
184
|
+
return Err("Unsupported UI color".into());
|
|
185
|
+
}
|
|
186
|
+
if obj
|
|
187
|
+
.get("direction")
|
|
188
|
+
.is_some_and(|v| kind != "stack" || !matches!(v.as_str(), Some("row" | "column")))
|
|
189
|
+
{
|
|
190
|
+
return Err("Stack direction must be row or column".into());
|
|
191
|
+
}
|
|
192
|
+
for key in [
|
|
193
|
+
"text",
|
|
194
|
+
"label",
|
|
195
|
+
"action",
|
|
196
|
+
"placeholder",
|
|
197
|
+
"direction",
|
|
198
|
+
"tone",
|
|
199
|
+
] {
|
|
200
|
+
if let Some(value) = obj.get(key) {
|
|
201
|
+
if !value.is_string() {
|
|
202
|
+
return Err(format!("{key} must be a string"));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
if matches!(kind, "text" | "badge") && !obj.get("text").is_some_and(Value::is_string) {
|
|
207
|
+
return Err("Text nodes need text".into());
|
|
208
|
+
}
|
|
209
|
+
if matches!(kind, "button" | "input") && !obj.get("label").is_some_and(Value::is_string) {
|
|
210
|
+
return Err("Controls need a label".into());
|
|
211
|
+
}
|
|
212
|
+
if kind == "input"
|
|
213
|
+
&& obj
|
|
214
|
+
.get("value")
|
|
215
|
+
.is_some_and(|v| !v.is_string() && !v.is_number())
|
|
216
|
+
{
|
|
217
|
+
return Err("Input value must be text or number".into());
|
|
218
|
+
}
|
|
219
|
+
if matches!(kind, "button" | "input")
|
|
220
|
+
&& !obj
|
|
221
|
+
.get("action")
|
|
222
|
+
.and_then(Value::as_str)
|
|
223
|
+
.is_some_and(valid_id)
|
|
224
|
+
{
|
|
225
|
+
return Err("Controls require a valid action".into());
|
|
226
|
+
}
|
|
227
|
+
if let Some(children) = obj.get("children") {
|
|
228
|
+
for child in children.as_array().ok_or("Children must be an array")? {
|
|
229
|
+
walk(child, depth + 1, nodes)?;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
if kind == "table" {
|
|
233
|
+
if !obj
|
|
234
|
+
.get("columns")
|
|
235
|
+
.and_then(Value::as_array)
|
|
236
|
+
.is_some_and(|c| c.iter().all(Value::is_string))
|
|
237
|
+
|| !obj
|
|
238
|
+
.get("rows")
|
|
239
|
+
.and_then(Value::as_array)
|
|
240
|
+
.is_some_and(|rows| {
|
|
241
|
+
rows.iter().all(|r| {
|
|
242
|
+
r.as_array().is_some_and(|a| {
|
|
243
|
+
a.iter()
|
|
244
|
+
.all(|c| c.is_string() || c.is_number() || c.is_null())
|
|
245
|
+
})
|
|
246
|
+
})
|
|
247
|
+
})
|
|
248
|
+
{
|
|
249
|
+
return Err("Invalid table".into());
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
if kind == "progress"
|
|
253
|
+
&& (!obj
|
|
254
|
+
.get("value")
|
|
255
|
+
.and_then(Value::as_f64)
|
|
256
|
+
.is_some_and(|n| n.is_finite() && n >= 0.0)
|
|
257
|
+
|| !obj
|
|
258
|
+
.get("max")
|
|
259
|
+
.and_then(Value::as_f64)
|
|
260
|
+
.is_some_and(|n| n.is_finite() && n > 0.0))
|
|
261
|
+
{
|
|
262
|
+
return Err("Invalid progress".into());
|
|
263
|
+
}
|
|
264
|
+
Ok(())
|
|
265
|
+
}
|
|
266
|
+
if tree.to_string().len() > 64 * 1024 {
|
|
267
|
+
return Err("UI exceeds 64 KiB".into());
|
|
268
|
+
}
|
|
269
|
+
walk(tree, 0, &mut 0)
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
pub struct Engine {
|
|
273
|
+
runtime: Runtime,
|
|
274
|
+
context: Context,
|
|
275
|
+
deadline: Arc<Mutex<Duration>>,
|
|
276
|
+
}
|
|
277
|
+
impl Engine {
|
|
278
|
+
pub fn new(
|
|
279
|
+
compiled: &str,
|
|
280
|
+
state: &Value,
|
|
281
|
+
host: impl Fn(String) -> String + 'static,
|
|
282
|
+
) -> Result<Self, String> {
|
|
283
|
+
let runtime = Runtime::new().map_err(|e| e.to_string())?;
|
|
284
|
+
runtime.set_memory_limit(64 * 1024 * 1024);
|
|
285
|
+
runtime.set_max_stack_size(512 * 1024);
|
|
286
|
+
let deadline = Arc::new(Mutex::new(cpu_time::ThreadTime::now().as_duration()));
|
|
287
|
+
let d = deadline.clone();
|
|
288
|
+
runtime.set_interrupt_handler(Some(Box::new(move || {
|
|
289
|
+
cpu_time::ThreadTime::now()
|
|
290
|
+
.as_duration()
|
|
291
|
+
.saturating_sub(*d.lock().unwrap())
|
|
292
|
+
>= Duration::from_millis(250)
|
|
293
|
+
})));
|
|
294
|
+
let context = Context::full(&runtime).map_err(|e| e.to_string())?;
|
|
295
|
+
let engine = Self {
|
|
296
|
+
runtime,
|
|
297
|
+
context,
|
|
298
|
+
deadline,
|
|
299
|
+
};
|
|
300
|
+
engine
|
|
301
|
+
.context
|
|
302
|
+
.with(|ctx| -> rquickjs::Result<()> {
|
|
303
|
+
ctx.globals().set("__host", Func::from(host))?;
|
|
304
|
+
ctx.eval::<(), _>(include_str!("sdk.js"))?;
|
|
305
|
+
ctx.eval::<(), _>(format!("__view.state = {};", state))?;
|
|
306
|
+
let module = Module::declare(ctx.clone(), "mod", compiled)?;
|
|
307
|
+
let (module, promise) = module.eval()?;
|
|
308
|
+
promise.finish::<()>()?;
|
|
309
|
+
let register: Function = module.get("register")?;
|
|
310
|
+
let mint: Object = ctx.eval("mint")?;
|
|
311
|
+
let returned: rquickjs::Value = register.call((mint,))?;
|
|
312
|
+
if let Some(promise) = returned.as_promise() {
|
|
313
|
+
promise.clone().finish::<()>()?;
|
|
314
|
+
}
|
|
315
|
+
Ok(())
|
|
316
|
+
})
|
|
317
|
+
.map_err(|e| engine.error(e))?;
|
|
318
|
+
engine.snapshot()?;
|
|
319
|
+
Ok(engine)
|
|
320
|
+
}
|
|
321
|
+
fn error(&self, error: rquickjs::Error) -> String {
|
|
322
|
+
self.context.with(|ctx| {
|
|
323
|
+
if error.is_exception() {
|
|
324
|
+
format!("Mod exception: {:?}", ctx.catch())
|
|
325
|
+
} else {
|
|
326
|
+
error.to_string()
|
|
327
|
+
}
|
|
328
|
+
})
|
|
329
|
+
}
|
|
330
|
+
pub fn dispatch(&self, kind: &str, payload: &Value) -> Result<Value, String> {
|
|
331
|
+
*self.deadline.lock().unwrap() = cpu_time::ThreadTime::now().as_duration();
|
|
332
|
+
let result = self
|
|
333
|
+
.context
|
|
334
|
+
.with(|ctx| -> rquickjs::Result<String> {
|
|
335
|
+
let promise: Promise =
|
|
336
|
+
ctx.eval(format!("__dispatch({}, {})", json!(kind), payload))?;
|
|
337
|
+
let value: rquickjs::Value = promise.finish()?;
|
|
338
|
+
ctx.globals().set("__result", value)?;
|
|
339
|
+
ctx.eval("JSON.stringify(__result)")
|
|
340
|
+
})
|
|
341
|
+
.map_err(|e| self.error(e))?;
|
|
342
|
+
let mut result: Value = serde_json::from_str(&result).map_err(|e| e.to_string())?;
|
|
343
|
+
result["snapshot"] = self.snapshot()?;
|
|
344
|
+
Ok(result)
|
|
345
|
+
}
|
|
346
|
+
pub fn snapshot(&self) -> Result<Value, String> {
|
|
347
|
+
let text = self
|
|
348
|
+
.context
|
|
349
|
+
.with(|ctx| ctx.eval::<String, _>("JSON.stringify(__view)"))
|
|
350
|
+
.map_err(|e| self.error(e))?;
|
|
351
|
+
if text.len() > 256 * 1024 {
|
|
352
|
+
return Err("Mod state/output exceeds 256 KiB".into());
|
|
353
|
+
}
|
|
354
|
+
let value: Value = serde_json::from_str(&text).map_err(|e| e.to_string())?;
|
|
355
|
+
validate_snapshot(&value)?;
|
|
356
|
+
let _ = &self.runtime;
|
|
357
|
+
Ok(value)
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
fn validate_snapshot(value: &Value) -> Result<(), String> {
|
|
361
|
+
if value.to_string().len() > 256 * 1024 {
|
|
362
|
+
return Err("Mod state/output exceeds 256 KiB".into());
|
|
363
|
+
}
|
|
364
|
+
for tree in value["ui"]
|
|
365
|
+
.as_object()
|
|
366
|
+
.ok_or("Invalid UI snapshot")?
|
|
367
|
+
.values()
|
|
368
|
+
{
|
|
369
|
+
validate_ui(tree)?;
|
|
370
|
+
}
|
|
371
|
+
Ok(())
|
|
372
|
+
}
|
|
373
|
+
pub fn preview(manifest: &Value, source: &str) -> Result<Value, String> {
|
|
374
|
+
let compiled = validate_package(manifest, source)?;
|
|
375
|
+
Engine::new(&compiled, &json!({}), |request| {
|
|
376
|
+
let request: Value = serde_json::from_str(&request).unwrap_or_default();
|
|
377
|
+
match request["kind"].as_str() {
|
|
378
|
+
Some("usage") => json!({"value":unavailable_usage()}),
|
|
379
|
+
Some("viewport") => json!({"value":unavailable_viewport()}),
|
|
380
|
+
_ => json!({"error":"Host access is unavailable during preview"}),
|
|
381
|
+
}
|
|
382
|
+
.to_string()
|
|
383
|
+
})?
|
|
384
|
+
.snapshot()
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/// Newline-delimited IPC. The parent grants capabilities; this process has no OS SDK.
|
|
388
|
+
pub fn worker_main() -> Result<(), String> {
|
|
389
|
+
fn read() -> Result<Value, String> {
|
|
390
|
+
let mut line = String::new();
|
|
391
|
+
io::stdin()
|
|
392
|
+
.read_line(&mut line)
|
|
393
|
+
.map_err(|e| e.to_string())?;
|
|
394
|
+
if line.len() > 1024 * 1024 {
|
|
395
|
+
return Err("IPC request too large".into());
|
|
396
|
+
}
|
|
397
|
+
serde_json::from_str(&line).map_err(|e| e.to_string())
|
|
398
|
+
}
|
|
399
|
+
fn send(value: &Value) {
|
|
400
|
+
println!("{}", value);
|
|
401
|
+
let _ = io::stdout().flush();
|
|
402
|
+
}
|
|
403
|
+
let init = read()?;
|
|
404
|
+
let engine = Engine::new(
|
|
405
|
+
init["compiled"].as_str().ok_or("Missing compiled source")?,
|
|
406
|
+
&init["state"],
|
|
407
|
+
|request| {
|
|
408
|
+
let request = serde_json::from_str::<Value>(&request).unwrap_or(Value::Null);
|
|
409
|
+
send(&json!({"host":request}));
|
|
410
|
+
read().unwrap_or_else(|e| json!({"error":e})).to_string()
|
|
411
|
+
},
|
|
412
|
+
);
|
|
413
|
+
let engine = match engine {
|
|
414
|
+
Ok(e) => {
|
|
415
|
+
send(&json!({"ok":e.snapshot()?}));
|
|
416
|
+
e
|
|
417
|
+
}
|
|
418
|
+
Err(e) => {
|
|
419
|
+
send(&json!({"error":e}));
|
|
420
|
+
return Ok(());
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
loop {
|
|
424
|
+
let request = match read() {
|
|
425
|
+
Ok(v) => v,
|
|
426
|
+
Err(_) => break,
|
|
427
|
+
};
|
|
428
|
+
let kind = request["kind"].as_str().unwrap_or("");
|
|
429
|
+
if kind == "stop" {
|
|
430
|
+
break;
|
|
431
|
+
}
|
|
432
|
+
match engine.dispatch(kind, &request["payload"]) {
|
|
433
|
+
Ok(v) => send(&json!({"ok":v})),
|
|
434
|
+
Err(e) => {
|
|
435
|
+
send(&json!({"error":e}));
|
|
436
|
+
break;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
Ok(())
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
pub fn pack(manifest: &Value, source: &str, readme: &str) -> Result<Vec<u8>, String> {
|
|
444
|
+
let m: Manifest = serde_json::from_value(manifest.clone()).map_err(|e| e.to_string())?;
|
|
445
|
+
compile(&m, source)?;
|
|
446
|
+
if readme.len() > 64 * 1024 {
|
|
447
|
+
return Err("README exceeds 64 KiB".into());
|
|
448
|
+
}
|
|
449
|
+
let mut zip = zip::ZipWriter::new(std::io::Cursor::new(Vec::new()));
|
|
450
|
+
for (name, text) in [
|
|
451
|
+
("manifest.json", serde_json::to_string_pretty(&m).unwrap()),
|
|
452
|
+
(m.entry.as_str(), source.into()),
|
|
453
|
+
("README.md", readme.into()),
|
|
454
|
+
] {
|
|
455
|
+
zip.start_file(name, zip::write::SimpleFileOptions::default())
|
|
456
|
+
.map_err(|e| e.to_string())?;
|
|
457
|
+
zip.write_all(text.as_bytes()).map_err(|e| e.to_string())?;
|
|
458
|
+
}
|
|
459
|
+
Ok(zip.finish().map_err(|e| e.to_string())?.into_inner())
|
|
460
|
+
}
|
|
461
|
+
pub fn unpack(bytes: &[u8]) -> Result<Value, String> {
|
|
462
|
+
use std::io::Read;
|
|
463
|
+
if bytes.len() > 1024 * 1024 {
|
|
464
|
+
return Err("Package exceeds 1 MiB".into());
|
|
465
|
+
}
|
|
466
|
+
let mut zip = zip::ZipArchive::new(std::io::Cursor::new(bytes)).map_err(|e| e.to_string())?;
|
|
467
|
+
if !(2..=3).contains(&zip.len()) {
|
|
468
|
+
return Err("A package must contain only manifest, entry and optional README".into());
|
|
469
|
+
}
|
|
470
|
+
let mut files = std::collections::BTreeMap::new();
|
|
471
|
+
for i in 0..zip.len() {
|
|
472
|
+
let file = zip.by_index(i).map_err(|e| e.to_string())?;
|
|
473
|
+
let name = file.name().to_owned();
|
|
474
|
+
if !["manifest.json", "main.ts", "main.js", "README.md"].contains(&name.as_str())
|
|
475
|
+
|| file.is_dir()
|
|
476
|
+
|| file.unix_mode().is_some_and(|m| m & 0xf000 == 0xa000)
|
|
477
|
+
{
|
|
478
|
+
return Err("Unsafe package entry".into());
|
|
479
|
+
}
|
|
480
|
+
if files.contains_key(&name) {
|
|
481
|
+
return Err("Duplicate package entry".into());
|
|
482
|
+
}
|
|
483
|
+
let mut text = String::new();
|
|
484
|
+
file.take((MAX_SOURCE + 1) as u64)
|
|
485
|
+
.read_to_string(&mut text)
|
|
486
|
+
.map_err(|e| e.to_string())?;
|
|
487
|
+
if text.len() > MAX_SOURCE {
|
|
488
|
+
return Err("Package entry exceeds limit".into());
|
|
489
|
+
}
|
|
490
|
+
files.insert(name, text);
|
|
491
|
+
}
|
|
492
|
+
let m: Manifest = serde_json::from_str(files.get("manifest.json").ok_or("Missing manifest")?)
|
|
493
|
+
.map_err(|e| e.to_string())?;
|
|
494
|
+
let source = files.get(&m.entry).ok_or("Missing source entry")?;
|
|
495
|
+
if files
|
|
496
|
+
.keys()
|
|
497
|
+
.any(|k| k != "manifest.json" && k != &m.entry && k != "README.md")
|
|
498
|
+
{
|
|
499
|
+
return Err("Unexpected package entry".into());
|
|
500
|
+
}
|
|
501
|
+
compile(&m, source)?;
|
|
502
|
+
let readme = files.get("README.md").cloned().unwrap_or_default();
|
|
503
|
+
if readme.len() > 64 * 1024 {
|
|
504
|
+
return Err("README exceeds limit".into());
|
|
505
|
+
}
|
|
506
|
+
Ok(json!({"manifest":m,"source":source,"readme":readme}))
|
|
507
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
const __handlers = Object.create(null);
|
|
2
|
+
const __commands = Object.create(null);
|
|
3
|
+
let __phase = '';
|
|
4
|
+
let __view = { ui: {}, commands: [], state: {}, logs: [], requests: [] };
|
|
5
|
+
const defineMod = fn => fn;
|
|
6
|
+
const __events = Object.freeze(['session_start','session_end','turn_start','turn_end','pre_tool_use','post_tool_use','usage_update','context_compacted','ui_resize','tool_result']);
|
|
7
|
+
function __readHost(kind) {
|
|
8
|
+
const result = JSON.parse(__host(JSON.stringify({kind})));
|
|
9
|
+
if (result.error) throw Error(result.error);
|
|
10
|
+
return result.value;
|
|
11
|
+
}
|
|
12
|
+
const mint = Object.freeze({
|
|
13
|
+
session: Object.freeze({ usage() { return __readHost('usage'); } }),
|
|
14
|
+
on(event, handler) {
|
|
15
|
+
if (!__events.includes(event) || typeof handler !== 'function') throw Error('Invalid event');
|
|
16
|
+
(__handlers[event] ||= []).push(handler);
|
|
17
|
+
},
|
|
18
|
+
ui: Object.freeze({ viewport() { return __readHost('viewport'); }, set(slot, tree) {
|
|
19
|
+
if (!['above_composer','side_panel'].includes(slot)) throw Error('Invalid UI slot');
|
|
20
|
+
__view.ui[slot] = JSON.parse(JSON.stringify(tree));
|
|
21
|
+
}}),
|
|
22
|
+
commands: Object.freeze({ register(name, handler, description = '') {
|
|
23
|
+
if (!/^[a-z][a-z0-9-]{0,47}$/.test(name) || typeof handler !== 'function' || __commands[name]) throw Error('Invalid or duplicate command');
|
|
24
|
+
__commands[name] = handler; __view.commands.push({name, description});
|
|
25
|
+
}}),
|
|
26
|
+
state: Object.freeze({ get(key) { return __view.state[key]; }, set(key, value) {
|
|
27
|
+
if (typeof key !== 'string' || ['__proto__','constructor','prototype'].includes(key)) throw Error('Invalid state key');
|
|
28
|
+
__view.state[key] = JSON.parse(JSON.stringify(value));
|
|
29
|
+
}}),
|
|
30
|
+
workspace: Object.freeze({ read(path) {
|
|
31
|
+
const result = JSON.parse(__host(JSON.stringify({kind:'read', path})));
|
|
32
|
+
if (result.error) throw Error(result.error); return result.value;
|
|
33
|
+
}}),
|
|
34
|
+
tools: Object.freeze({ request(action, input = {}) {
|
|
35
|
+
if (__phase === 'pre_tool_use') throw Error('Tools cannot be requested from pre-tool hooks');
|
|
36
|
+
const result = JSON.parse(__host(JSON.stringify({kind:'tool', action, input})));
|
|
37
|
+
if (result.error) throw Error(result.error);
|
|
38
|
+
return result.value;
|
|
39
|
+
}}),
|
|
40
|
+
log(message) { __view.logs.push(String(message).slice(0,4000)); __view.logs = __view.logs.slice(-100); }
|
|
41
|
+
});
|
|
42
|
+
async function __dispatch(kind, payload) {
|
|
43
|
+
__phase = kind;
|
|
44
|
+
try {
|
|
45
|
+
if (kind === 'action') {
|
|
46
|
+
const handler = __commands[payload.action];
|
|
47
|
+
if (!handler) throw Error('Unknown action or command');
|
|
48
|
+
return {value: await handler(payload.value)};
|
|
49
|
+
}
|
|
50
|
+
for (const handler of __handlers[kind] || []) {
|
|
51
|
+
const result = await handler(payload);
|
|
52
|
+
if (kind === 'pre_tool_use' && result?.block) return {block: String(result.block)};
|
|
53
|
+
}
|
|
54
|
+
return {};
|
|
55
|
+
} finally { __phase = ''; }
|
|
56
|
+
}
|