collabmd 0.1.47 → 0.1.49
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/README.md +70 -11
- package/bin/collabmd.js +3 -0
- package/dist/client/assets/CodeMirrorEditor-UCMRAMCV-C-nmgL5g.js +1 -0
- package/dist/client/assets/JetBrainsMono-Regular-BQaDgvhP.woff2 +0 -0
- package/dist/client/assets/abnfDiagram-VCTEODGH-CdVZqicp.js +1 -0
- package/dist/client/assets/{architectureDiagram-5GKGNRK7-I39sYjHI.js → architectureDiagram-5GKGNRK7-wUo0bXif.js} +3 -3
- package/dist/client/assets/babel-CY5KOv-I.js +16 -0
- package/dist/client/assets/{blockDiagram-NRAW4CY4-C6DtJy5Y.js → blockDiagram-I7D4REHJ-BRSK3m49.js} +4 -4
- package/dist/client/assets/browser-utils-DbXSMI-6.js +1 -0
- package/dist/client/assets/{c4Diagram-UCG6FXSJ-CtWtxS9_.js → c4Diagram-7LVT6UL2-yD2poxqw.js} +1 -1
- package/dist/client/assets/channel-Fa4GS_-F.js +1 -0
- package/dist/client/assets/chunk-2E4U76K2-BPnTT-J3.js +2 -0
- package/dist/client/assets/{chunk-TEH6E4GO-DVayPj-q.js → chunk-4HAMMTFA-DStbIfJ1.js} +20 -20
- package/dist/client/assets/{chunk-75Z2AOVW-CdFSaPjz.js → chunk-75Z2AOVW-C5pGd3W9.js} +1 -1
- package/dist/client/assets/{chunk-CLGD4ZFX-DQLgbQrv.js → chunk-CLGD4ZFX-BMeArk03.js} +1 -1
- package/dist/client/assets/chunk-DU6HZSFF-Zkp69c6c.js +127 -0
- package/dist/client/assets/{chunk-F27PBJKO-CNHIFhjo.js → chunk-F27PBJKO-D4xNct1r.js} +1 -1
- package/dist/client/assets/{chunk-GMAD6QVW-CbcBqPM5.js → chunk-GMAD6QVW-NZ6WpDb8.js} +1 -1
- package/dist/client/assets/{chunk-OBVCFTLP-BJR7u1jh.js → chunk-GVQU2GXP-D8SDprfX.js} +1 -1
- package/dist/client/assets/{chunk-G27WJ6UU-D9-eg537.js → chunk-IMKFNOWR-D8jEuU3Q.js} +2 -2
- package/dist/client/assets/{chunk-JQ64N6SF-DSFNH4bh.js → chunk-L3NEJ4N5-aijKP-eh.js} +1 -1
- package/dist/client/assets/chunk-OSK3NFVY-CCbLQAMa.js +10 -0
- package/dist/client/assets/{chunk-P2QGCYS3-BRpqY32H.js → chunk-P2QGCYS3-Oag_FdCq.js} +1 -1
- package/dist/client/assets/{chunk-POPQ4Y6H-Cb4SlVZF.js → chunk-POPQ4Y6H-CYnpIgXT.js} +1 -1
- package/dist/client/assets/{chunk-PWAF6VOD-Cz8IwBB5.js → chunk-PWAF6VOD-JSNrcBmP.js} +1 -1
- package/dist/client/assets/{chunk-RM4UPSZO-CWRwxNWJ.js → chunk-RM4UPSZO-DOWllDY8.js} +4 -4
- package/dist/client/assets/{chunk-RHFEMEQ7-CWY8cf4H.js → chunk-SHT3W25Y-BiQGljao.js} +5 -5
- package/dist/client/assets/{chunk-SVP7TREG-CyHOmcac.js → chunk-SVP7TREG-DB485R5x.js} +1 -1
- package/dist/client/assets/{chunk-LCL6LL3I-DmDkVukh.js → chunk-TICWLB2K-8rAVvoS3.js} +4 -4
- package/dist/client/assets/{chunk-CKBBP62Z-DG26UiBv.js → chunk-TLUHSLCS-DTY5v0aj.js} +2 -2
- package/dist/client/assets/classDiagram-ZZMXUADV-BsQWoR3Q.js +1 -0
- package/dist/client/assets/classDiagram-v2-VYDZK3BY-BsQWoR3Q.js +1 -0
- package/dist/client/assets/{comment-thread-store-CdcwrObc.js → comment-thread-store-CX98zR6q.js} +1 -1
- package/dist/client/assets/comment-threads-BnRwo5B9.js +4 -0
- package/dist/client/assets/{cynefinDiagram-5FMLGOSQ-CdTPi2yO.js → cynefinDiagram-5FMLGOSQ-rTz9RhFH.js} +1 -1
- package/dist/client/assets/{dagre-3AP2YEHR-5gtJtd0O.js → dagre-GXQ25YYZ-Cr67wLpQ.js} +2 -2
- package/dist/client/assets/{diagram-S7CK7UJ4-BudWz9WU.js → diagram-S7CK7UJ4-DywERe__.js} +2 -2
- package/dist/client/assets/{diagram-UQ7AKVKN-3v4rbH-s.js → diagram-UQ7AKVKN-CNYlXtu4.js} +1 -1
- package/dist/client/assets/diagram-VSXAHHWV-0H1a61Bn.js +3 -0
- package/dist/client/assets/{diagram-VX7I27RA-C_-rj0sw.js → diagram-VX7I27RA-CsJbsx5F.js} +1 -1
- package/dist/client/assets/{diagram-Z3DM3KII-B4yxavgj.js → diagram-Z3DM3KII-D0mLxEgI.js} +1 -1
- package/dist/client/assets/dist--hk9I5HQ.js +1 -0
- package/dist/client/assets/{dist-DutPuFmC.js → dist-B1XEa-Zs.js} +1 -1
- package/dist/client/assets/dist-Bd1JucQF.js +1 -0
- package/dist/client/assets/{dist-DZAAWTG-.js → dist-C0G3AaXG.js} +1 -1
- package/dist/client/assets/dist-ChRoo3IB.js +9 -0
- package/dist/client/assets/dist-Dm4w5UId.js +1 -0
- package/dist/client/assets/{dist-B_yQaEv_.js → dist-DpYDHR9p.js} +1 -1
- package/dist/client/assets/{dist-CietwTVS.js → dist-DzNmC81X.js} +1 -1
- package/dist/client/assets/{dist-DDUn5zTz.js → dist-GvvCNBe4.js} +1 -1
- package/dist/client/assets/dist-JaU3aRlD.js +19 -0
- package/dist/client/assets/{dist-Bw3VIE_v.js → dist-TW8iFRyW.js} +1 -1
- package/dist/client/assets/{dist-Dir5dDKZ.js → dist-jVU5Be5P.js} +1 -1
- package/dist/client/assets/document-formatter-rDDjRfZ2.js +2 -0
- package/dist/client/assets/drawioEditor-JubEEha7.js +9 -0
- package/dist/client/assets/ebnfDiagram-PWID7BFC-HeTxHpCU.js +1 -0
- package/dist/client/assets/editor-session-Bk6oIvSr.js +54 -0
- package/dist/client/assets/embedded-editor-base-BlCgz6mw.css +1 -0
- package/dist/client/assets/{erDiagram-SSCWMZ5O-C-iy6VkX.js → erDiagram-RLTQ6QDP-CbrDdd5P.js} +2 -2
- package/dist/client/assets/{es-CAsWR6hG.js → es-Bfdp096f.js} +13 -13
- package/dist/client/assets/estree-CuT_pB8K.js +44 -0
- package/dist/client/assets/excalidraw-element-link-YLIaTnVF.js +7 -0
- package/dist/client/assets/{excalidraw-scene-BOben2gr.js → excalidraw-scene-6uROebca.js} +1 -1
- package/dist/client/assets/{excalidraw-editor-BlcN6umJ.css → excalidrawEditor-BbSbI80a.css} +1 -1
- package/dist/client/assets/excalidrawEditor-dBMbRX_S.js +9 -0
- package/dist/client/assets/export-page-CRRQ2NEl.js +57 -0
- package/dist/client/assets/exportDocument-BlQRd9_m.js +2 -0
- package/dist/client/assets/exportDocument-CNSbjZwu.css +1 -0
- package/dist/client/assets/{file-icon-svg-CQAjlWjK.js → file-icon-svg-Y_kpF957.js} +1 -1
- package/dist/client/assets/file-kind-BwMIcZbi.js +1 -0
- package/dist/client/assets/file-search-DDLyyLDU.js +1 -0
- package/dist/client/assets/flowDiagram-HODETNUW-D5Gy0wmg.js +1 -0
- package/dist/client/assets/{ganttDiagram-EL5Y4UJY-DtKHAbez.js → ganttDiagram-EL5Y4UJY-BHgOYiZz.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-WWUBYQGX-oue8fQ5o.js → gitGraphDiagram-WWUBYQGX-Dl__X3Sk.js} +1 -1
- package/dist/client/assets/html-Cdnr2qzU.js +25 -0
- package/dist/client/assets/image-ZVKINSPA-DgzW5zAy.js +1 -0
- package/dist/client/assets/index-D3RER1SZ.js +1023 -0
- package/dist/client/assets/index-DREVKl_K.css +1 -0
- package/dist/client/assets/{infoDiagram-RXCK75RN-BMzo6KIn.js → infoDiagram-27XIBGKW-DBpoANC9.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-5VMMS53U-BIM3h287.js → ishikawaDiagram-5VMMS53U-BMPC6hfp.js} +1 -1
- package/dist/client/assets/{journeyDiagram-EYS64GPL-mF6Lh8O-.js → journeyDiagram-3NMN7TZE-B1sApUmM.js} +2 -2
- package/dist/client/assets/{kanban-definition-3QL26DDD-DLN2NyoR.js → kanban-definition-UXKFOSKX-C9yP4td1.js} +4 -4
- package/dist/client/assets/{line-BfTWJmgf.js → line-BFl3ujec.js} +1 -1
- package/dist/client/assets/markdown-CByV-4CU.js +70 -0
- package/dist/client/assets/{mermaid.core-CLZBlpIW.js → mermaid.core-BrY09czX.js} +5 -5
- package/dist/client/assets/mermaid.core-DfcNfOTv.js +1 -0
- package/dist/client/assets/{mindmap-definition-FBJOCRG2-CRyHaHTk.js → mindmap-definition-YA3MSWOX-BUQHcYbK.js} +8 -8
- package/dist/client/assets/pegDiagram-XKGWAZYB-Bi2Iml7Z.js +1 -0
- package/dist/client/assets/{pieDiagram-E7YTZNPT-B5OZPb88.js → pieDiagram-E7YTZNPT-_gYXnMoi.js} +1 -1
- package/dist/client/assets/preview-render-compiler-CfxJYldJ.js +41 -0
- package/dist/client/assets/preview-render-compiler-Cu8_i9iS.js +1 -0
- package/dist/client/assets/{preview-render-worker-BmN79bVc.js → preview-render-worker-c4Yi93qW.js} +41 -35
- package/dist/client/assets/prod-BiJL30sl.js +1 -0
- package/dist/client/assets/prod-qAk7rHa4.js +177 -0
- package/dist/client/assets/{quadrantDiagram-AXDQQJYC-Drrw14YH.js → quadrantDiagram-AXDQQJYC-DwexhEhd.js} +1 -1
- package/dist/client/assets/quick-switcher-controller-BoIK_wuG.js +1 -0
- package/dist/client/assets/railroadDiagram-O6MQD6OU-BVA5UbMu.js +1 -0
- package/dist/client/assets/{requirementDiagram-EFPCY7ZU-CRZG6mRB.js → requirementDiagram-BXWQKSXE-C4cKwiIw.js} +2 -2
- package/dist/client/assets/runtime-config-DcmnGcXU.js +1 -0
- package/dist/client/assets/{sankeyDiagram-P5KCCOFB-DvarEJpo.js → sankeyDiagram-P5KCCOFB-B5HHkRT2.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-WJ2MYXX4-B4oWlb-w.js → sequenceDiagram-WJ2MYXX4-BX6jqJFD.js} +6 -6
- package/dist/client/assets/standalone-6z5x8CWe.js +29 -0
- package/dist/client/assets/{stateDiagram-HBIQ2CUA-qbHIIqRZ.js → stateDiagram-D77RDMKH-CmqxyRGx.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-MP3YSRHH-zoLLQVyh.js +1 -0
- package/dist/client/assets/{swimlanes-XN3QIQJK-xB6CtUGj.js → swimlanes-42K2YHIH-Bmgb9Zld.js} +1 -1
- package/dist/client/assets/swimlanesDiagram-VR7AAH4N-DS-KQN37.js +8 -0
- package/dist/client/assets/{timeline-definition-24CTP7MA-Lj_yTNlY.js → timeline-definition-24CTP7MA-BA-lVH6P.js} +1 -1
- package/dist/client/assets/vault-api-client-iZLhMJKe.js +6 -0
- package/dist/client/assets/{vennDiagram-4TSXK5OY-BekRp5Y0.js → vennDiagram-4TSXK5OY-DNdUC_Xj.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-VM6X3IG4-kdnV_Hdm.js → wardleyDiagram-VM6X3IG4-C2oY-YbF.js} +1 -1
- package/dist/client/assets/wiki-link-resolver-DFIwErjc.js +1 -0
- package/dist/client/assets/{xychartDiagram-S5SC5T6Z-DufGwNSB.js → xychartDiagram-S5SC5T6Z-CoIR8CBX.js} +1 -1
- package/dist/client/assets/yaml-9ltHPDNO.js +154 -0
- package/dist/client/assets/{yjs-provider-reset-guard-DE0vINDP.js → yjs-provider-reset-guard-9ul1qF6k.js} +1 -1
- package/dist/client/drawio-editor.html +11 -3
- package/dist/client/excalidraw-editor.html +45 -2
- package/dist/client/export-document.html +3 -3
- package/dist/client/index.html +106 -52
- package/integrations/pi/index.ts +94 -0
- package/package.json +41 -29
- package/src/client/app/drawio-editor.html +2 -2
- package/src/client/app/excalidraw-editor.html +2 -2
- package/src/client/app/export-document.html +1 -1
- package/src/client/app/index.html +88 -50
- package/src/client/app/main-entry.js +15 -1
- package/src/client/application/app-shell/chat-feature.js +7 -22
- package/src/client/application/app-shell/export-feature.js +17 -1
- package/src/client/application/app-shell/git-feature.js +51 -14
- package/src/client/application/app-shell/presence-feature.js +8 -25
- package/src/client/application/app-shell/ui-feature-identity.js +13 -0
- package/src/client/application/app-shell/ui-feature-shell.js +199 -99
- package/src/client/application/app-shell/ui-feature-sidebar.js +43 -7
- package/src/client/application/app-shell/ui-feature-tab-activity.js +19 -6
- package/src/client/application/app-shell/ui-feature-toolbar.js +16 -129
- package/src/client/application/app-shell-elements.js +8 -0
- package/src/client/application/preview-render-compiler.js +1 -87
- package/src/client/application/preview-render-scheduler.js +8 -24
- package/src/client/application/preview-renderer.js +2 -2
- package/src/client/application/webmcp-diagram-renderer.js +47 -0
- package/src/client/application/workspace-coordinator.js +23 -4
- package/src/client/application/workspace-preview-controller.js +120 -2
- package/src/client/application/workspace-route-controller.js +11 -1
- package/src/client/assets/vendor/jetbrains-mono/JetBrainsMono-Regular.woff2 +0 -0
- package/src/client/assets/vendor/jetbrains-mono/OFL.txt +93 -0
- package/src/client/bootstrap/collabmd-app-shell.js +99 -6
- package/src/client/domain/document-formatter.js +193 -0
- package/src/client/domain/excalidraw-element-link.js +73 -0
- package/src/client/domain/excalidraw-scene.js +21 -0
- package/src/client/domain/file-search.js +73 -0
- package/src/client/domain/git-labels.js +5 -0
- package/src/client/domain/hash-routes.js +8 -0
- package/src/client/domain/room.js +1 -5
- package/src/client/domain/runtime-paths.js +5 -0
- package/src/client/domain/vault-paths.js +6 -4
- package/src/client/domain/wiki-link-completions.js +20 -20
- package/src/client/drawio-editor.js +8 -3
- package/src/client/excalidraw-editor.js +287 -16
- package/src/client/export/export-host.js +59 -36
- package/src/client/export/export-page.js +14 -4
- package/src/client/export/export-pipeline.js +270 -42
- package/src/client/infrastructure/agent-connection-api-client.js +23 -0
- package/src/client/infrastructure/auth-client.js +3 -13
- package/src/client/infrastructure/editor-session.js +15 -0
- package/src/client/infrastructure/editor-view-adapter.js +73 -14
- package/src/client/infrastructure/excalidraw-room-client.js +80 -1
- package/src/client/infrastructure/git-api-client.js +39 -33
- package/src/client/infrastructure/lobby-presence.js +2 -5
- package/src/client/infrastructure/runtime-config.js +11 -1
- package/src/client/infrastructure/tab-activity-lock.js +2 -5
- package/src/client/infrastructure/vault-api-client.js +33 -26
- package/src/client/infrastructure/webmcp-tool-registry.js +283 -0
- package/src/client/infrastructure/workspace-sync-client.js +6 -4
- package/src/client/presentation/agent-connection-controller.js +255 -0
- package/src/client/presentation/backlinks-panel.js +3 -0
- package/src/client/presentation/bases-preview-controller.js +59 -26
- package/src/client/presentation/comment-ui/comment-ui-card.js +4 -2
- package/src/client/presentation/create-menu-presenter.js +19 -16
- package/src/client/presentation/excalidraw-embed-controller.js +164 -4
- package/src/client/presentation/file-action-controller.js +15 -2
- package/src/client/presentation/file-explorer-controller.js +3 -0
- package/src/client/presentation/file-explorer-view.js +71 -12
- package/src/client/presentation/file-history-view-controller.js +19 -12
- package/src/client/presentation/file-tree-state.js +1 -11
- package/src/client/presentation/git-diff-view-controller.js +70 -53
- package/src/client/presentation/git-panel-controller.js +86 -32
- package/src/client/presentation/image-lightbox-controller.js +20 -16
- package/src/client/presentation/layout-controller.js +3 -1
- package/src/client/presentation/quick-switcher-controller.js +74 -232
- package/src/client/presentation/quick-switcher-text-search.js +10 -14
- package/src/client/styles/components/navigation.css +1 -2
- package/src/client/styles/components/scrollbars.css +10 -0
- package/src/client/styles/export-document.css +44 -29
- package/src/client/styles/features/agent-connection.css +202 -0
- package/src/client/styles/features/collaboration-chat.css +8 -1
- package/src/client/styles/features/collaboration-dialogs.css +16 -1
- package/src/client/styles/features/collaboration-presence.css +30 -5
- package/src/client/styles/features/diff-toolbar.css +1 -1
- package/src/client/styles/features/media-lightbox.css +12 -3
- package/src/client/styles/features/preview-markdown.css +54 -0
- package/src/client/styles/features/quick-switcher.css +20 -11
- package/src/client/styles/foundation/themes.css +2 -0
- package/src/client/styles/foundation/tokens.css +8 -0
- package/src/client/styles/layout/editor-page.css +25 -11
- package/src/client/styles/layout/responsive.css +2 -20
- package/src/client/styles/layout/shell.css +77 -24
- package/src/client/styles/layout/sidebar.css +7 -4
- package/src/client/styles/layout/view-modes.css +2 -0
- package/src/client/styles/overrides/codemirror.css +31 -19
- package/src/client/styles/primitives/controls.css +21 -54
- package/src/client/styles/style.css +1 -0
- package/src/client/styles/surfaces/excalidraw-editor.css +42 -0
- package/src/domain/agent-tool-definitions.js +796 -0
- package/src/domain/collabmd-content-capabilities.js +149 -0
- package/src/domain/collaboration-protocol.js +2 -0
- package/src/domain/comment-threads.js +3 -5
- package/src/domain/diagram-source.js +50 -0
- package/src/domain/editable-content-revision.js +10 -0
- package/src/domain/editable-text.js +3 -0
- package/src/domain/exact-text-edits.js +69 -0
- package/src/domain/excalidraw-agent-scene.js +522 -0
- package/src/domain/excalidraw-agent-verification.js +460 -0
- package/src/domain/excalidraw-room-codec.js +1 -5
- package/src/domain/file-kind.js +12 -1
- package/src/domain/video-embed.js +76 -0
- package/src/server/application/agent-connection-service.js +178 -0
- package/src/server/application/agent-content-service.js +773 -0
- package/src/server/application/workspace-reconciliation.js +5 -7
- package/src/server/config/env.js +51 -1
- package/src/server/create-app-server.js +36 -0
- package/src/server/domain/bases/base-query-service.js +1 -5
- package/src/server/domain/collaboration/collaboration-room.js +121 -25
- package/src/server/domain/collaboration/protocol.js +4 -0
- package/src/server/domain/hosted-workspace.js +21 -0
- package/src/server/domain/markdown-reference-extractor.js +15 -1
- package/src/server/domain/ripgrep-search-service.js +110 -37
- package/src/server/infrastructure/git/git-service.js +19 -1
- package/src/server/infrastructure/git/history-service.js +1 -1
- package/src/server/infrastructure/git/local-exclude.js +25 -0
- package/src/server/infrastructure/git/parsers.js +19 -17
- package/src/server/infrastructure/git/path-utils.js +0 -16
- package/src/server/infrastructure/git/status-service.js +1 -1
- package/src/server/infrastructure/git/untracked-files.js +12 -21
- package/src/server/infrastructure/http/create-agent-api-handler.js +171 -0
- package/src/server/infrastructure/http/create-git-api-command-handler.js +32 -0
- package/src/server/infrastructure/http/create-request-handler.js +28 -0
- package/src/server/infrastructure/http/create-static-handler.js +6 -0
- package/src/server/infrastructure/mcp/create-agent-mcp-handler.js +199 -0
- package/src/server/infrastructure/persistence/agent-connection-store.js +120 -0
- package/src/server/infrastructure/persistence/path-utils.js +10 -4
- package/src/server/infrastructure/persistence/pull-backup-store.js +2 -27
- package/src/server/infrastructure/persistence/vault-file-store.js +11 -2
- package/src/server/shared/agent-tool-image.js +22 -0
- package/src/server/shared/agent-tool-rate-limiter.js +20 -0
- package/src/server/startup/git-remote-bootstrap.js +5 -33
- package/dist/client/assets/CodeMirrorEditor-UCMRAMCV-BPH4FJkv.js +0 -1
- package/dist/client/assets/abnfDiagram-VCTEODGH-BNDLzJ7L.js +0 -1
- package/dist/client/assets/browser-utils--H_DkyEF.js +0 -1
- package/dist/client/assets/channel-CaoKA_We.js +0 -1
- package/dist/client/assets/chunk-DSNCTWBM-8xkug7fQ.js +0 -2
- package/dist/client/assets/chunk-DU6HZSFF-COXDzJK1.js +0 -127
- package/dist/client/assets/chunk-R7TYR2AO-CTd0Yj98.js +0 -10
- package/dist/client/assets/classDiagram-DTDB5LWJ-7fEmn0zV.js +0 -1
- package/dist/client/assets/classDiagram-v2-JRS7N3AN-7fEmn0zV.js +0 -1
- package/dist/client/assets/comment-threads-9J6Em-_y.js +0 -4
- package/dist/client/assets/comment-ui-shared-DWkk9Vh3.js +0 -7
- package/dist/client/assets/diagram-VSXAHHWV-CQRVEZR7.js +0 -3
- package/dist/client/assets/dist-73RPdcyU.js +0 -1
- package/dist/client/assets/dist-CH-sQu3r.js +0 -1
- package/dist/client/assets/drawio-editor-BjrxTe3l.js +0 -9
- package/dist/client/assets/drawioEditor-DUVZjSSr.js +0 -2
- package/dist/client/assets/ebnfDiagram-PWID7BFC-OXa8VEp1.js +0 -1
- package/dist/client/assets/editor-session-DfZuRgB_.js +0 -54
- package/dist/client/assets/embedded-editor-base-DvMynhKu.css +0 -1
- package/dist/client/assets/excalidraw-editor-D7pnUCLH.js +0 -9
- package/dist/client/assets/excalidraw-mermaid-stub-BNckbX2n.js +0 -1
- package/dist/client/assets/excalidraw-mermaid-stub-DE5FTiZB.js +0 -1
- package/dist/client/assets/excalidrawEditor-B0jOK3lv.js +0 -2
- package/dist/client/assets/export-page-Bs3xE1fg.js +0 -57
- package/dist/client/assets/exportDocument-Dg9MjkIk.js +0 -2
- package/dist/client/assets/exportDocument-PnYU3v1s.css +0 -1
- package/dist/client/assets/file-kind-BbqgGzpc.js +0 -1
- package/dist/client/assets/flowDiagram-A5DVABFB-CiW1eN8C.js +0 -1
- package/dist/client/assets/image-ZVKINSPA-0zXSnE7M.js +0 -1
- package/dist/client/assets/index-BIpgxyGZ.css +0 -1
- package/dist/client/assets/index-Z5sI0Bj-.js +0 -2
- package/dist/client/assets/main-Dwnj9Gaq.js +0 -903
- package/dist/client/assets/pegDiagram-XKGWAZYB-B31fKPR2.js +0 -1
- package/dist/client/assets/preview-render-compiler-BApvlLLo.js +0 -35
- package/dist/client/assets/preview-render-compiler-BQ_3h9vD.js +0 -1
- package/dist/client/assets/preview-render-profile-CE-5rVTC.js +0 -1
- package/dist/client/assets/prod-BiYPMR1i.js +0 -177
- package/dist/client/assets/prod-VxdGZ5Ly.js +0 -1
- package/dist/client/assets/quick-switcher-controller-ButWPmCI.js +0 -12
- package/dist/client/assets/railroadDiagram-O6MQD6OU-BPifP0MB.js +0 -1
- package/dist/client/assets/runtime-config-BLrEKVO1.js +0 -1
- package/dist/client/assets/stateDiagram-v2-4QOOHH4V-B--gjrit.js +0 -1
- package/dist/client/assets/swimlanesDiagram-VK2B7HYN-DO8XNXEg.js +0 -8
- package/dist/client/assets/vault-api-client-_LpV1aIn.js +0 -6
- package/dist/client/assets/vault-utils-wdQ0RNR9.js +0 -1
- package/src/client/app/drawio-editor-entry.js +0 -1
- package/src/client/app/excalidraw-editor-entry.js +0 -1
- package/src/client/excalidraw-mermaid-stub.js +0 -7
- package/src/client/main.js +0 -16
- /package/dist/client/assets/{drawio-editor-UQQ8XHou.css → drawioEditor-UQQ8XHou.css} +0 -0
- /package/dist/client/assets/{sizeCapture-X5ZJPWSS-B0uUizjq.js → sizeCapture-INFHLROL-B0uUizjq.js} +0 -0
|
@@ -26,21 +26,30 @@ async function triggerDownload(url, {
|
|
|
26
26
|
return response;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export
|
|
29
|
+
export const vaultApiClient = {
|
|
30
30
|
async readTree() {
|
|
31
31
|
const response = await fetch(resolveApiUrl('/files'));
|
|
32
32
|
return parseApiResponse(response, 'Failed to load file tree');
|
|
33
|
-
}
|
|
33
|
+
},
|
|
34
|
+
async callAgentTool(name, input, { signal } = {}) {
|
|
35
|
+
const response = await fetch(resolveApiUrl(`/agent/tools/${encodeURIComponent(name)}`), {
|
|
36
|
+
body: JSON.stringify(input),
|
|
37
|
+
headers: { 'Content-Type': 'application/json' },
|
|
38
|
+
method: 'POST',
|
|
39
|
+
signal,
|
|
40
|
+
});
|
|
41
|
+
return parseApiResponse(response, `Failed to execute ${name}`);
|
|
42
|
+
},
|
|
34
43
|
|
|
35
44
|
async readCommentOverview() {
|
|
36
45
|
const response = await fetch(resolveApiUrl('/comments/overview'));
|
|
37
46
|
return parseApiResponse(response, 'Failed to load comment overview');
|
|
38
|
-
}
|
|
47
|
+
},
|
|
39
48
|
|
|
40
49
|
async readFile(path) {
|
|
41
50
|
const response = await fetch(resolveApiUrl(`/file?path=${encodeURIComponent(path)}`));
|
|
42
51
|
return parseApiResponse(response, 'Failed to read file');
|
|
43
|
-
}
|
|
52
|
+
},
|
|
44
53
|
|
|
45
54
|
async readBacklinks(filePath, { signal } = {}) {
|
|
46
55
|
const response = await fetch(
|
|
@@ -49,7 +58,7 @@ export class VaultApiClient {
|
|
|
49
58
|
);
|
|
50
59
|
const data = await parseApiResponse(response, 'Failed to load backlinks');
|
|
51
60
|
return Array.isArray(data.backlinks) ? data.backlinks : [];
|
|
52
|
-
}
|
|
61
|
+
},
|
|
53
62
|
|
|
54
63
|
async syncStructurizrWorkspace({ path, source }) {
|
|
55
64
|
const response = await fetch(resolveApiUrl('/structurizr/sync'), {
|
|
@@ -63,7 +72,7 @@ export class VaultApiClient {
|
|
|
63
72
|
method: 'POST',
|
|
64
73
|
});
|
|
65
74
|
return parseApiResponse(response, 'Failed to sync Structurizr workspace');
|
|
66
|
-
}
|
|
75
|
+
},
|
|
67
76
|
|
|
68
77
|
async renderSvg(source) {
|
|
69
78
|
const response = await fetch(resolveApiUrl('/plantuml/render'), {
|
|
@@ -79,7 +88,7 @@ export class VaultApiClient {
|
|
|
79
88
|
}
|
|
80
89
|
|
|
81
90
|
return data.svg;
|
|
82
|
-
}
|
|
91
|
+
},
|
|
83
92
|
|
|
84
93
|
async searchText({ limit = 50, query = '', signal = null } = {}) {
|
|
85
94
|
const searchParams = new URLSearchParams({
|
|
@@ -90,7 +99,7 @@ export class VaultApiClient {
|
|
|
90
99
|
signal,
|
|
91
100
|
});
|
|
92
101
|
return parseApiResponse(response, 'Failed to search files');
|
|
93
|
-
}
|
|
102
|
+
},
|
|
94
103
|
|
|
95
104
|
async queryBase({
|
|
96
105
|
activeFilePath = '',
|
|
@@ -113,7 +122,7 @@ export class VaultApiClient {
|
|
|
113
122
|
method: 'POST',
|
|
114
123
|
});
|
|
115
124
|
return parseApiResponse(response, 'Failed to query base');
|
|
116
|
-
}
|
|
125
|
+
},
|
|
117
126
|
|
|
118
127
|
async exportBaseCsv({
|
|
119
128
|
activeFilePath = '',
|
|
@@ -144,7 +153,7 @@ export class VaultApiClient {
|
|
|
144
153
|
blob: await response.blob(),
|
|
145
154
|
contentDisposition: response.headers.get('content-disposition') || '',
|
|
146
155
|
};
|
|
147
|
-
}
|
|
156
|
+
},
|
|
148
157
|
|
|
149
158
|
async queryBasePropertyValues({
|
|
150
159
|
activeFilePath = '',
|
|
@@ -169,7 +178,7 @@ export class VaultApiClient {
|
|
|
169
178
|
method: 'POST',
|
|
170
179
|
});
|
|
171
180
|
return parseApiResponse(response, 'Failed to load base property values');
|
|
172
|
-
}
|
|
181
|
+
},
|
|
173
182
|
|
|
174
183
|
async transformBase({
|
|
175
184
|
activeFilePath = '',
|
|
@@ -192,7 +201,7 @@ export class VaultApiClient {
|
|
|
192
201
|
method: 'POST',
|
|
193
202
|
});
|
|
194
203
|
return parseApiResponse(response, 'Failed to transform base');
|
|
195
|
-
}
|
|
204
|
+
},
|
|
196
205
|
|
|
197
206
|
async createFile({ content, path, requestId = null }) {
|
|
198
207
|
const response = await fetch(resolveApiUrl('/file'), {
|
|
@@ -201,7 +210,7 @@ export class VaultApiClient {
|
|
|
201
210
|
method: 'POST',
|
|
202
211
|
});
|
|
203
212
|
return parseApiResponse(response, 'Failed to create file');
|
|
204
|
-
}
|
|
213
|
+
},
|
|
205
214
|
|
|
206
215
|
async writeFile({ content, path, requestId = null }) {
|
|
207
216
|
const response = await fetch(resolveApiUrl('/file'), {
|
|
@@ -210,7 +219,7 @@ export class VaultApiClient {
|
|
|
210
219
|
method: 'PUT',
|
|
211
220
|
});
|
|
212
221
|
return parseApiResponse(response, 'Failed to write file');
|
|
213
|
-
}
|
|
222
|
+
},
|
|
214
223
|
|
|
215
224
|
async renameFile({ oldPath, newPath, requestId = null }) {
|
|
216
225
|
const response = await fetch(resolveApiUrl('/file'), {
|
|
@@ -219,7 +228,7 @@ export class VaultApiClient {
|
|
|
219
228
|
method: 'PATCH',
|
|
220
229
|
});
|
|
221
230
|
return parseApiResponse(response, 'Failed to rename file');
|
|
222
|
-
}
|
|
231
|
+
},
|
|
223
232
|
|
|
224
233
|
async deleteFile(path, { requestId = null } = {}) {
|
|
225
234
|
const response = await fetch(resolveApiUrl(`/file?path=${encodeURIComponent(path)}`), {
|
|
@@ -227,7 +236,7 @@ export class VaultApiClient {
|
|
|
227
236
|
method: 'DELETE',
|
|
228
237
|
});
|
|
229
238
|
return parseApiResponse(response, 'Failed to delete file');
|
|
230
|
-
}
|
|
239
|
+
},
|
|
231
240
|
|
|
232
241
|
async createDirectory(path, { requestId = null } = {}) {
|
|
233
242
|
const response = await fetch(resolveApiUrl('/directory'), {
|
|
@@ -236,7 +245,7 @@ export class VaultApiClient {
|
|
|
236
245
|
method: 'POST',
|
|
237
246
|
});
|
|
238
247
|
return parseApiResponse(response, 'Failed to create folder');
|
|
239
|
-
}
|
|
248
|
+
},
|
|
240
249
|
|
|
241
250
|
async renameDirectory({ oldPath, newPath, requestId = null }) {
|
|
242
251
|
const response = await fetch(resolveApiUrl('/directory'), {
|
|
@@ -245,7 +254,7 @@ export class VaultApiClient {
|
|
|
245
254
|
method: 'PATCH',
|
|
246
255
|
});
|
|
247
256
|
return parseApiResponse(response, 'Failed to rename folder');
|
|
248
|
-
}
|
|
257
|
+
},
|
|
249
258
|
|
|
250
259
|
async deleteDirectory(path, { recursive = false, requestId = null } = {}) {
|
|
251
260
|
const searchParams = new URLSearchParams({
|
|
@@ -260,7 +269,7 @@ export class VaultApiClient {
|
|
|
260
269
|
method: 'DELETE',
|
|
261
270
|
});
|
|
262
271
|
return parseApiResponse(response, 'Failed to delete folder');
|
|
263
|
-
}
|
|
272
|
+
},
|
|
264
273
|
|
|
265
274
|
async uploadImageAttachment({ file, fileName = '', sourcePath }) {
|
|
266
275
|
const response = await fetch(resolveApiUrl('/attachments'), {
|
|
@@ -273,7 +282,7 @@ export class VaultApiClient {
|
|
|
273
282
|
method: 'POST',
|
|
274
283
|
});
|
|
275
284
|
return parseApiResponse(response, 'Failed to upload image');
|
|
276
|
-
}
|
|
285
|
+
},
|
|
277
286
|
|
|
278
287
|
async uploadFile({ file, path, requestId = null }) {
|
|
279
288
|
const response = await fetch(resolveApiUrl('/file/upload'), {
|
|
@@ -285,7 +294,7 @@ export class VaultApiClient {
|
|
|
285
294
|
method: 'POST',
|
|
286
295
|
});
|
|
287
296
|
return parseApiResponse(response, 'Failed to upload file');
|
|
288
|
-
}
|
|
297
|
+
},
|
|
289
298
|
|
|
290
299
|
async downloadFile(path) {
|
|
291
300
|
const fallbackFileName = getVaultPathLeaf(path) || 'download';
|
|
@@ -293,7 +302,7 @@ export class VaultApiClient {
|
|
|
293
302
|
fallbackError: 'Failed to download file',
|
|
294
303
|
fallbackFileName,
|
|
295
304
|
});
|
|
296
|
-
}
|
|
305
|
+
},
|
|
297
306
|
|
|
298
307
|
async downloadDirectory(path) {
|
|
299
308
|
const directoryName = getVaultPathLeaf(path) || 'vault';
|
|
@@ -301,7 +310,5 @@ export class VaultApiClient {
|
|
|
301
310
|
fallbackError: 'Failed to download folder',
|
|
302
311
|
fallbackFileName: `${directoryName}.zip`,
|
|
303
312
|
});
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
export const vaultApiClient = new VaultApiClient();
|
|
313
|
+
},
|
|
314
|
+
};
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import {
|
|
2
|
+
listWebMcpToolDefinitions,
|
|
3
|
+
toWebMcpToolName,
|
|
4
|
+
} from '../../domain/agent-tool-definitions.js';
|
|
5
|
+
import { createExcalidrawExportOptions } from '../domain/excalidraw-scene.js';
|
|
6
|
+
|
|
7
|
+
const MAX_RENDER_DIMENSION = 4096;
|
|
8
|
+
const ACTIVE_CONTEXT_TOOL_NAME = 'collabmd_get_active_context';
|
|
9
|
+
const EXCALIDRAW_WORKFLOW_NOTE = 'Call collabmd_get_active_context first. Use create_excalidraw only for a new path; for an existing diagram, inspect_excalidraw then edit_excalidraw with its exact revision and inline verification.';
|
|
10
|
+
|
|
11
|
+
async function renderExactExcalidrawScene(scene, {
|
|
12
|
+
format = 'png',
|
|
13
|
+
padding = 32,
|
|
14
|
+
scale = 1,
|
|
15
|
+
} = {}) {
|
|
16
|
+
const {
|
|
17
|
+
exportToBlob,
|
|
18
|
+
exportToSvg,
|
|
19
|
+
} = await import('@excalidraw/excalidraw');
|
|
20
|
+
const options = createExcalidrawExportOptions(scene, { padding, scale });
|
|
21
|
+
let data;
|
|
22
|
+
let height;
|
|
23
|
+
let mimeType;
|
|
24
|
+
let width;
|
|
25
|
+
if (format === 'svg') {
|
|
26
|
+
const svg = await exportToSvg(options);
|
|
27
|
+
const markup = svg.outerHTML;
|
|
28
|
+
data = new TextEncoder().encode(markup).toBase64();
|
|
29
|
+
height = Math.max(1, Math.ceil(Number.parseFloat(svg.getAttribute('height')) || 1));
|
|
30
|
+
mimeType = 'image/svg+xml';
|
|
31
|
+
width = Math.max(1, Math.ceil(Number.parseFloat(svg.getAttribute('width')) || 1));
|
|
32
|
+
} else {
|
|
33
|
+
const blob = await exportToBlob({
|
|
34
|
+
...options,
|
|
35
|
+
maxWidthOrHeight: MAX_RENDER_DIMENSION,
|
|
36
|
+
mimeType: 'image/png',
|
|
37
|
+
});
|
|
38
|
+
const bitmap = await createImageBitmap(blob);
|
|
39
|
+
data = new Uint8Array(await blob.arrayBuffer()).toBase64();
|
|
40
|
+
height = bitmap.height;
|
|
41
|
+
mimeType = 'image/png';
|
|
42
|
+
width = bitmap.width;
|
|
43
|
+
bitmap.close();
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
format,
|
|
47
|
+
height,
|
|
48
|
+
image: { data, encoding: 'base64', mimeType },
|
|
49
|
+
mimeType,
|
|
50
|
+
renderer: 'excalidraw-official-browser',
|
|
51
|
+
rendererVersion: 'bundled',
|
|
52
|
+
scale,
|
|
53
|
+
warnings: [],
|
|
54
|
+
width,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function stripSceneSnapshots(result) {
|
|
59
|
+
if (!result || typeof result !== 'object') return result;
|
|
60
|
+
const cleanResult = { ...result };
|
|
61
|
+
delete cleanResult.scene;
|
|
62
|
+
if (!cleanResult.verification?.scene) return cleanResult;
|
|
63
|
+
const verification = { ...cleanResult.verification };
|
|
64
|
+
delete verification.scene;
|
|
65
|
+
return { ...cleanResult, verification };
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function throwIfAborted(signal) {
|
|
69
|
+
if (signal?.aborted) {
|
|
70
|
+
throw signal.reason ?? new DOMException('Tool execution was cancelled', 'AbortError');
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async function replaceSnapshotRendering(result, renderScene, input = {}) {
|
|
75
|
+
const scene = result?.verification?.scene ?? result?.scene;
|
|
76
|
+
if (!scene) return result;
|
|
77
|
+
const renderOptions = {
|
|
78
|
+
...(result.verification?.scene ? input.verify : input),
|
|
79
|
+
...(result.verification?.scene ? result.verification : result),
|
|
80
|
+
};
|
|
81
|
+
try {
|
|
82
|
+
const rendered = await renderScene(scene, renderOptions);
|
|
83
|
+
const cleanResult = stripSceneSnapshots(result);
|
|
84
|
+
if (result.verification?.scene) {
|
|
85
|
+
const { image, ...metadata } = rendered;
|
|
86
|
+
return {
|
|
87
|
+
...cleanResult,
|
|
88
|
+
image,
|
|
89
|
+
verification: {
|
|
90
|
+
...cleanResult.verification,
|
|
91
|
+
...metadata,
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
...cleanResult,
|
|
97
|
+
...rendered,
|
|
98
|
+
};
|
|
99
|
+
} catch (error) {
|
|
100
|
+
console.error('[webmcp] Exact Excalidraw rendering failed:', error.message);
|
|
101
|
+
const cleanResult = stripSceneSnapshots(result);
|
|
102
|
+
if (result?.verification?.scene) {
|
|
103
|
+
return {
|
|
104
|
+
...cleanResult,
|
|
105
|
+
verification: {
|
|
106
|
+
...cleanResult.verification,
|
|
107
|
+
warnings: [...(cleanResult.verification?.warnings ?? []), 'exact-render-unavailable'],
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
...cleanResult,
|
|
113
|
+
warnings: [...(cleanResult.warnings ?? []), 'exact-render-unavailable'],
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function addWebMcpExecution(result, execution) {
|
|
119
|
+
if (!execution || Object.keys(execution).length === 0 || !result || typeof result !== 'object') {
|
|
120
|
+
return result;
|
|
121
|
+
}
|
|
122
|
+
return { ...result, webMcp: execution };
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function createActiveContextResult(context = {}) {
|
|
126
|
+
const activeDiagramPath = context.activeDiagramPath || null;
|
|
127
|
+
const activePath = context.activePath || null;
|
|
128
|
+
return {
|
|
129
|
+
activeDiagramPath,
|
|
130
|
+
activePath,
|
|
131
|
+
preferredDiagramPath: activeDiagramPath,
|
|
132
|
+
workflow: activeDiagramPath
|
|
133
|
+
? `Current diagram is ${activeDiagramPath}. Inspect it, edit with the returned exact revision, request inline verification, then use the returned canvas paint acknowledgement.`
|
|
134
|
+
: 'No diagram is active. Use create_excalidraw with a new .excalidraw path and request inline verification. Inspect then revision-edit any existing path; do not retry stale edits without rereading.',
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
function getWebMcpDescription(definition) {
|
|
139
|
+
return definition.name.includes('excalidraw')
|
|
140
|
+
? `${definition.description} ${EXCALIDRAW_WORKFLOW_NOTE}`
|
|
141
|
+
: definition.description;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
function runOptionalHook(hook, payload) {
|
|
145
|
+
return typeof hook === 'function' ? hook(payload) : null;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
async function runAcknowledgementHook(hook, payload) {
|
|
149
|
+
try {
|
|
150
|
+
return await runOptionalHook(hook, payload);
|
|
151
|
+
} catch (error) {
|
|
152
|
+
console.error('[webmcp] Failed to acknowledge an applied mutation:', error.message);
|
|
153
|
+
return { status: 'unavailable' };
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function createActiveContextTool(getActiveContext) {
|
|
158
|
+
return {
|
|
159
|
+
annotations: {
|
|
160
|
+
readOnlyHint: true,
|
|
161
|
+
untrustedContentHint: false,
|
|
162
|
+
},
|
|
163
|
+
description: 'Return current CollabMD file and active-diagram context plus the safe create-or-edit workflow. Call before Excalidraw tools.',
|
|
164
|
+
execute: async () => createActiveContextResult(getActiveContext?.()),
|
|
165
|
+
inputSchema: {
|
|
166
|
+
additionalProperties: false,
|
|
167
|
+
properties: {},
|
|
168
|
+
required: [],
|
|
169
|
+
type: 'object',
|
|
170
|
+
},
|
|
171
|
+
name: ACTIVE_CONTEXT_TOOL_NAME,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
export class WebMcpToolRegistry {
|
|
177
|
+
constructor({
|
|
178
|
+
acknowledgeToolCall = null,
|
|
179
|
+
callTool,
|
|
180
|
+
getActiveContext = null,
|
|
181
|
+
getIsTabActive,
|
|
182
|
+
modelContext = globalThis.document?.modelContext ?? null,
|
|
183
|
+
onDidMutate = null,
|
|
184
|
+
prepareToolCall = null,
|
|
185
|
+
renderExcalidrawScene = renderExactExcalidrawScene,
|
|
186
|
+
}) {
|
|
187
|
+
this.acknowledgeToolCall = acknowledgeToolCall;
|
|
188
|
+
this.callTool = callTool;
|
|
189
|
+
this.getActiveContext = getActiveContext;
|
|
190
|
+
this.getIsTabActive = getIsTabActive;
|
|
191
|
+
this.modelContext = modelContext;
|
|
192
|
+
this.onDidMutate = onDidMutate;
|
|
193
|
+
this.prepareToolCall = prepareToolCall;
|
|
194
|
+
this.renderExcalidrawScene = renderExcalidrawScene;
|
|
195
|
+
this.registration = null;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
async refresh() {
|
|
199
|
+
if (
|
|
200
|
+
typeof this.modelContext?.registerTool !== 'function'
|
|
201
|
+
|| typeof this.callTool !== 'function'
|
|
202
|
+
|| !this.getIsTabActive()
|
|
203
|
+
) {
|
|
204
|
+
this.unregister();
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
if (this.registration) return true;
|
|
208
|
+
|
|
209
|
+
const controller = new AbortController();
|
|
210
|
+
const registration = { controller };
|
|
211
|
+
this.registration = registration;
|
|
212
|
+
|
|
213
|
+
try {
|
|
214
|
+
const tools = listWebMcpToolDefinitions().map((definition) => ({
|
|
215
|
+
annotations: {
|
|
216
|
+
readOnlyHint: definition.annotations.readOnlyHint,
|
|
217
|
+
untrustedContentHint: Boolean(definition.untrustedContentHint),
|
|
218
|
+
},
|
|
219
|
+
description: getWebMcpDescription(definition),
|
|
220
|
+
execute: async (input = {}, { signal } = {}) => {
|
|
221
|
+
throwIfAborted(signal);
|
|
222
|
+
let preparation = null;
|
|
223
|
+
if (typeof this.prepareToolCall === 'function') {
|
|
224
|
+
preparation = await this.prepareToolCall({
|
|
225
|
+
input,
|
|
226
|
+
name: definition.name,
|
|
227
|
+
signal,
|
|
228
|
+
});
|
|
229
|
+
throwIfAborted(signal);
|
|
230
|
+
}
|
|
231
|
+
const serverResult = await this.callTool(definition.name, input, { signal });
|
|
232
|
+
let result = await replaceSnapshotRendering(
|
|
233
|
+
serverResult,
|
|
234
|
+
this.renderExcalidrawScene,
|
|
235
|
+
input,
|
|
236
|
+
);
|
|
237
|
+
throwIfAborted(signal);
|
|
238
|
+
const execution = preparation ? { preparation } : {};
|
|
239
|
+
if (!definition.annotations.readOnlyHint) {
|
|
240
|
+
const acknowledgement = await runAcknowledgementHook(this.acknowledgeToolCall, {
|
|
241
|
+
input,
|
|
242
|
+
name: definition.name,
|
|
243
|
+
preparation,
|
|
244
|
+
result,
|
|
245
|
+
signal,
|
|
246
|
+
});
|
|
247
|
+
if (acknowledgement) execution.acknowledgement = acknowledgement;
|
|
248
|
+
result = addWebMcpExecution(result, execution);
|
|
249
|
+
try {
|
|
250
|
+
this.onDidMutate?.({ name: definition.name, result });
|
|
251
|
+
} catch (error) {
|
|
252
|
+
console.error('[webmcp] Failed to report an applied mutation:', error.message);
|
|
253
|
+
}
|
|
254
|
+
} else {
|
|
255
|
+
result = addWebMcpExecution(result, execution);
|
|
256
|
+
}
|
|
257
|
+
return result;
|
|
258
|
+
},
|
|
259
|
+
inputSchema: definition.inputSchema,
|
|
260
|
+
name: toWebMcpToolName(definition.name),
|
|
261
|
+
}));
|
|
262
|
+
tools.push(createActiveContextTool(this.getActiveContext));
|
|
263
|
+
await Promise.all(tools.map((tool) => (
|
|
264
|
+
this.modelContext.registerTool(tool, { signal: controller.signal })
|
|
265
|
+
)));
|
|
266
|
+
return true;
|
|
267
|
+
} catch (error) {
|
|
268
|
+
if (!controller.signal.aborted) {
|
|
269
|
+
controller.abort();
|
|
270
|
+
console.error('[webmcp] Failed to register tools:', error.message);
|
|
271
|
+
}
|
|
272
|
+
if (this.registration === registration) {
|
|
273
|
+
this.registration = null;
|
|
274
|
+
}
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
unregister() {
|
|
280
|
+
this.registration?.controller.abort();
|
|
281
|
+
this.registration = null;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
@@ -342,10 +342,12 @@ export class WorkspaceSyncClient {
|
|
|
342
342
|
}
|
|
343
343
|
|
|
344
344
|
disconnect() {
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
345
|
+
if (this.provider) {
|
|
346
|
+
this.entries.unobserve(this.handleEntriesChange);
|
|
347
|
+
this.events.unobserve(this.handleEventsChange);
|
|
348
|
+
this.provider.disconnect();
|
|
349
|
+
this.provider.destroy();
|
|
350
|
+
}
|
|
349
351
|
this.provider = null;
|
|
350
352
|
this._didInitialSync = false;
|
|
351
353
|
this.seenEventIds.clear();
|