shadow-claw 1.59.6 → 1.59.7
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/.well-known/mcp/server-card.json +12 -4
- package/.well-known/mcp.json +12 -4
- package/dist/cli/build/build.js +1 -1
- package/dist/cli/{chunk-DM4xsTry.js → chunk-3vNYrs_L.js} +1 -1
- package/dist/cli/{chunk-Ctg5L55n.js → chunk-66BvqAV0.js} +1 -1
- package/dist/cli/{chunk-Bq38OubR.js → chunk-B0qusANw.js} +1 -1
- package/dist/cli/{chunk-yiVdvGCJ.js → chunk-B3TrWbca.js} +7 -7
- package/dist/cli/{chunk-C8DBACtx.js → chunk-B88Z8T_9.js} +1 -1
- package/dist/cli/chunk-BCjL0JXf.js +1 -0
- package/dist/cli/chunk-BNcu1oiT.js +1 -0
- package/dist/cli/{chunk-gvNsvav0.js → chunk-C5ypckWC.js} +7 -7
- package/dist/cli/{chunk-Dw8GndPD.js → chunk-CAAeGOdy.js} +1 -1
- package/dist/cli/chunk-CFxww5Yz.js +1 -0
- package/dist/cli/chunk-CGIgtL6R.js +1 -0
- package/dist/cli/{chunk-DJqHK-qS.js → chunk-CQaCgswD.js} +7 -7
- package/dist/cli/chunk-CZdCRqNe.js +7 -0
- package/dist/cli/chunk-CafdvLx-.js +1 -0
- package/dist/cli/{chunk-Bc_weULz.js → chunk-CncW6_WL.js} +1 -1
- package/dist/cli/chunk-DDvuLVfW.js +1 -0
- package/dist/cli/{chunk-Cq_kQohv.js → chunk-DMs7kREC.js} +1 -1
- package/dist/cli/{chunk-CX2itile.js → chunk-D_te8ufL.js} +1 -1
- package/dist/cli/{chunk-3wTukVof.js → chunk-DhOU6GYX.js} +1 -1
- package/dist/cli/chunk-Dhap1VwA.js +1 -0
- package/dist/cli/chunk-DwvavohW.js +1 -0
- package/dist/cli/{chunk-DLde6nuO.js → chunk-SRBRVorc.js} +1 -1
- package/dist/cli/{chunk-D3y7h9Xe.js → chunk-SxK79JmB.js} +1 -1
- package/dist/cli/chunk-_a0CkUNS.js +139 -0
- package/dist/cli/{chunk-C9o6lXP3.js → chunk-hVf839t7.js} +1 -1
- package/dist/cli/chunk-iB8OoMmW.js +7 -0
- package/dist/cli/cli.js +1 -1
- package/dist/headless-agent.js +1 -1
- package/dist/lib/{app-routes-DJdIjp2V.js → app-routes-BXiRvlNl.js} +7 -25
- package/dist/lib/{app-routes-DJdIjp2V.js.map → app-routes-BXiRvlNl.js.map} +1 -1
- package/dist/lib/{attachment-capabilities-Dbb-4ZP5.js → attachment-capabilities-BjkEPip8.js} +2 -2
- package/dist/lib/{attachment-capabilities-Dbb-4ZP5.js.map → attachment-capabilities-BjkEPip8.js.map} +1 -1
- package/dist/lib/{channel-Dlru5ofR.js → channel-mmdGzPkT.js} +3 -3
- package/dist/lib/{channel-Dlru5ofR.js.map → channel-mmdGzPkT.js.map} +1 -1
- package/dist/lib/{chat-template-BuuLY8l7.js → chat-template-DPEKGJhB.js} +2 -2
- package/dist/lib/{chat-template-BuuLY8l7.js.map → chat-template-DPEKGJhB.js.map} +1 -1
- package/dist/lib/{compact-context-BtR55YPU.js → compact-context-CY9BBlUQ.js} +19 -19
- package/dist/lib/{compact-context-BtR55YPU.js.map → compact-context-CY9BBlUQ.js.map} +1 -1
- package/dist/lib/components/common/shadow-claw-provider-model-picker.js +1 -1
- package/dist/lib/components/index.js +27 -27
- package/dist/lib/components/settings/shadow-claw-accounts.js +1 -1
- package/dist/lib/components/settings/shadow-claw-channel-config.js +1 -1
- package/dist/lib/components/settings/shadow-claw-control-plane.js +1 -1
- package/dist/lib/components/settings/shadow-claw-git.js +1 -1
- package/dist/lib/components/settings/shadow-claw-integrations.js +1 -1
- package/dist/lib/components/settings/shadow-claw-llm.js +1 -1
- package/dist/lib/components/settings/shadow-claw-mcp-remote.js +1 -1
- package/dist/lib/components/settings/shadow-claw-networking.js +1 -1
- package/dist/lib/components/settings/shadow-claw-notifications.js +1 -1
- package/dist/lib/components/settings/shadow-claw-peerjs.js +1 -1
- package/dist/lib/components/settings/shadow-claw-storage.js +1 -1
- package/dist/lib/components/settings/shadow-claw-task-server.js +1 -1
- package/dist/lib/components/settings/shadow-claw-webvm.js +1 -1
- package/dist/lib/components/shadow-claw-a2ui.js +1 -1
- package/dist/lib/components/shadow-claw-accounts.js +1 -1
- package/dist/lib/components/shadow-claw-channel-config.js +1 -1
- package/dist/lib/components/shadow-claw-channels.js +1 -1
- package/dist/lib/components/shadow-claw-chat.js +1 -1
- package/dist/lib/components/shadow-claw-control-plane.js +1 -1
- package/dist/lib/components/shadow-claw-conversations.js +1 -1
- package/dist/lib/components/shadow-claw-file-viewer.js +1 -1
- package/dist/lib/components/shadow-claw-files.js +1 -1
- package/dist/lib/components/shadow-claw-git.js +1 -1
- package/dist/lib/components/shadow-claw-integrations.js +1 -1
- package/dist/lib/components/shadow-claw-llm.js +1 -1
- package/dist/lib/components/shadow-claw-mcp-remote.js +1 -1
- package/dist/lib/components/shadow-claw-networking.js +1 -1
- package/dist/lib/components/shadow-claw-notifications.js +1 -1
- package/dist/lib/components/shadow-claw-page-header.js +1 -1
- package/dist/lib/components/shadow-claw-pages.js +1 -1
- package/dist/lib/components/shadow-claw-peerjs.js +1 -1
- package/dist/lib/components/shadow-claw-provider-model-picker.js +1 -1
- package/dist/lib/components/shadow-claw-settings.js +1 -1
- package/dist/lib/components/shadow-claw-storage.js +1 -1
- package/dist/lib/components/shadow-claw-task-server.js +1 -1
- package/dist/lib/components/shadow-claw-tasks.js +1 -1
- package/dist/lib/components/shadow-claw-terminal.js +1 -1
- package/dist/lib/components/shadow-claw-tools.js +1 -1
- package/dist/lib/components/shadow-claw-webvm.js +1 -1
- package/dist/lib/components/shadow-claw.js +1 -1
- package/dist/lib/{config-DxNI3TlW.js → config-BrHR97zt.js} +2 -2
- package/dist/lib/{config-DxNI3TlW.js.map → config-BrHR97zt.js.map} +1 -1
- package/dist/lib/{configure-peer-js-ChDhOZU4.js → configure-peer-js-ccNvax2N.js} +3 -3
- package/dist/lib/{configure-peer-js-ChDhOZU4.js.map → configure-peer-js-ccNvax2N.js.map} +1 -1
- package/dist/lib/{connections-DC4NZkJE.js → connections-C1FWsBsE.js} +2 -2
- package/dist/lib/{connections-DC4NZkJE.js.map → connections-C1FWsBsE.js.map} +1 -1
- package/dist/lib/{credentials-5vpz0XPk.js → credentials-CZbngHXW.js} +2 -2
- package/dist/lib/{credentials-5vpz0XPk.js.map → credentials-CZbngHXW.js.map} +1 -1
- package/dist/lib/{discover-skills-CD0sKvAI.js → discover-skills-OwlQ2sXA.js} +13 -13
- package/dist/lib/{discover-skills-CD0sKvAI.js.map → discover-skills-OwlQ2sXA.js.map} +1 -1
- package/dist/lib/{download-group-file-Dk3qaxhJ.js → download-group-file-D0wgg10Q.js} +2 -2
- package/dist/lib/{download-group-file-Dk3qaxhJ.js.map → download-group-file-D0wgg10Q.js.map} +1 -1
- package/dist/lib/{file-viewer-B4pRW-_G.js → file-viewer-DOfvX6yy.js} +5 -5
- package/dist/lib/{file-viewer-B4pRW-_G.js.map → file-viewer-DOfvX6yy.js.map} +1 -1
- package/dist/lib/{get-or-create-subscriber-id-HCcgDEPz.js → get-or-create-subscriber-id-wyzaML7Z.js} +2 -2
- package/dist/lib/{get-or-create-subscriber-id-HCcgDEPz.js.map → get-or-create-subscriber-id-wyzaML7Z.js.map} +1 -1
- package/dist/lib/{git-B3Q1euc5.js → git-D2J_j9X9.js} +5 -5
- package/dist/lib/{git-B3Q1euc5.js.map → git-D2J_j9X9.js.map} +1 -1
- package/dist/lib/{iframe-bridge-scripts-D8iuFhUk.js → iframe-bridge-scripts-Dx825LLG.js} +2 -2
- package/dist/lib/{iframe-bridge-scripts-D8iuFhUk.js.map → iframe-bridge-scripts-Dx825LLG.js.map} +1 -1
- package/dist/lib/index.js +28 -28
- package/dist/lib/{init-chat-split-resize-B0ODULx9.js → init-chat-split-resize-Cc0bd2z9.js} +2 -2
- package/dist/lib/{init-chat-split-resize-B0ODULx9.js.map → init-chat-split-resize-Cc0bd2z9.js.map} +1 -1
- package/dist/lib/{init-control-plane-C1FRRmjC.js → init-control-plane-B7blDVIE.js} +15 -15
- package/dist/lib/{init-control-plane-C1FRRmjC.js.map → init-control-plane-B7blDVIE.js.map} +1 -1
- package/dist/lib/{invoke-agent-CzN7sVh-.js → invoke-agent-SxvudiDT.js} +11 -11
- package/dist/lib/{invoke-agent-CzN7sVh-.js.map → invoke-agent-SxvudiDT.js.map} +1 -1
- package/dist/lib/{markdown-mbNo7cV3.js → markdown--6vTAPEH.js} +2 -2
- package/dist/lib/{markdown-mbNo7cV3.js.map → markdown--6vTAPEH.js.map} +1 -1
- package/dist/lib/{mcp-reconnect-3T7yWGEY.js → mcp-reconnect-BeqQvNWO.js} +3 -3
- package/dist/lib/{mcp-reconnect-3T7yWGEY.js.map → mcp-reconnect-BeqQvNWO.js.map} +1 -1
- package/dist/lib/{model-ranking-DGNSWYwN.js → model-ranking-BhsJV7vb.js} +2 -2
- package/dist/lib/{model-ranking-DGNSWYwN.js.map → model-ranking-BhsJV7vb.js.map} +1 -1
- package/dist/lib/{move-group-entry-NMTJ59M9.js → move-group-entry-DDpjxa10.js} +5 -5
- package/dist/lib/{move-group-entry-NMTJ59M9.js.map → move-group-entry-DDpjxa10.js.map} +1 -1
- package/dist/lib/{orchestrator-B8FV1V7x.js → orchestrator-C7fkh7T7.js} +24 -24
- package/dist/lib/{orchestrator-B8FV1V7x.js.map → orchestrator-C7fkh7T7.js.map} +1 -1
- package/dist/lib/{orchestrator-i_QJ-o22.js → orchestrator-CCARkxQC.js} +11 -11
- package/dist/lib/orchestrator-CCARkxQC.js.map +1 -0
- package/dist/lib/{parse-path-DPCn-HwI.js → parse-path-BOHQP_IQ.js} +3 -3
- package/dist/lib/{parse-path-DPCn-HwI.js.map → parse-path-BOHQP_IQ.js.map} +1 -1
- package/dist/lib/{peerjs-z5zeioPV.js → peerjs-Bfw_FWLB.js} +8 -8
- package/dist/lib/{peerjs-z5zeioPV.js.map → peerjs-Bfw_FWLB.js.map} +1 -1
- package/dist/lib/{process-peer-query-param-CJp7w7AU.js → process-peer-query-param-BxYiZNdf.js} +5 -5
- package/dist/lib/{process-peer-query-param-CJp7w7AU.js.map → process-peer-query-param-BxYiZNdf.js.map} +1 -1
- package/dist/lib/{process-pending-shared-payloads-B6_TlBFA.js → process-pending-shared-payloads-DPIbwRb3.js} +4 -4
- package/dist/lib/{process-pending-shared-payloads-B6_TlBFA.js.map → process-pending-shared-payloads-DPIbwRb3.js.map} +1 -1
- package/dist/lib/{process-room-query-param-C3FFGGn6.js → process-room-query-param-B2_d50nE.js} +4 -4
- package/dist/lib/{process-room-query-param-C3FFGGn6.js.map → process-room-query-param-B2_d50nE.js.map} +1 -1
- package/dist/lib/{provider-DcQZypu5.js → provider-BC9KPI14.js} +3 -3
- package/dist/lib/{provider-DcQZypu5.js.map → provider-BC9KPI14.js.map} +1 -1
- package/dist/lib/{push-client-Cx5rMs6J.js → push-client-rrjTdc-U.js} +5 -5
- package/dist/lib/{push-client-Cx5rMs6J.js.map → push-client-rrjTdc-U.js.map} +1 -1
- package/dist/lib/{read-group-file-bytes-CXOG_YyM.js → read-group-file-bytes-UQIk1eJG.js} +2 -2
- package/dist/lib/{read-group-file-bytes-CXOG_YyM.js.map → read-group-file-bytes-UQIk1eJG.js.map} +1 -1
- package/dist/lib/{rooms-CwlkYLDU.js → rooms-bwGoYb1q.js} +2 -2
- package/dist/lib/{rooms-CwlkYLDU.js.map → rooms-bwGoYb1q.js.map} +1 -1
- package/dist/lib/{shadow-claw-DoQ7fgl5.js → shadow-claw-CypGVlVO.js} +17 -20
- package/dist/lib/shadow-claw-CypGVlVO.js.map +1 -0
- package/dist/lib/{shadow-claw-a2ui-Br6qJMs1.js → shadow-claw-a2ui-lG0vQbW8.js} +2 -2
- package/dist/lib/{shadow-claw-a2ui-Br6qJMs1.js.map → shadow-claw-a2ui-lG0vQbW8.js.map} +1 -1
- package/dist/lib/{shadow-claw-accounts-BTDILfWw.js → shadow-claw-accounts-CkqyCxwp.js} +3 -3
- package/dist/lib/{shadow-claw-accounts-BTDILfWw.js.map → shadow-claw-accounts-CkqyCxwp.js.map} +1 -1
- package/dist/lib/{shadow-claw-channel-config-IKiL34tI.js → shadow-claw-channel-config-DJpDovkF.js} +4 -4
- package/dist/lib/{shadow-claw-channel-config-IKiL34tI.js.map → shadow-claw-channel-config-DJpDovkF.js.map} +1 -1
- package/dist/lib/{shadow-claw-channels-JgEzuHWK.js → shadow-claw-channels-DJLwRovH.js} +3 -3
- package/dist/lib/{shadow-claw-channels-JgEzuHWK.js.map → shadow-claw-channels-DJLwRovH.js.map} +1 -1
- package/dist/lib/{shadow-claw-chat-SGUDT31r.js → shadow-claw-chat-B92cPaft.js} +15 -15
- package/dist/lib/{shadow-claw-chat-SGUDT31r.js.map → shadow-claw-chat-B92cPaft.js.map} +1 -1
- package/dist/lib/{shadow-claw-control-plane-CRWFZ3vD.js → shadow-claw-control-plane-fvn-qyHj.js} +7 -7
- package/dist/lib/{shadow-claw-control-plane-CRWFZ3vD.js.map → shadow-claw-control-plane-fvn-qyHj.js.map} +1 -1
- package/dist/lib/{shadow-claw-conversations-D23GJ7qo.js → shadow-claw-conversations-CsVyDOny.js} +7 -7
- package/dist/lib/{shadow-claw-conversations-D23GJ7qo.js.map → shadow-claw-conversations-CsVyDOny.js.map} +1 -1
- package/dist/lib/{shadow-claw-file-viewer-C1V8WTiU.js → shadow-claw-file-viewer-DFfyP7s5.js} +10 -10
- package/dist/lib/{shadow-claw-file-viewer-C1V8WTiU.js.map → shadow-claw-file-viewer-DFfyP7s5.js.map} +1 -1
- package/dist/lib/{shadow-claw-files-DN7irmE1.js → shadow-claw-files-cT6HL7ye.js} +11 -11
- package/dist/lib/{shadow-claw-files-DN7irmE1.js.map → shadow-claw-files-cT6HL7ye.js.map} +1 -1
- package/dist/lib/{shadow-claw-git-D-1oIh65.js → shadow-claw-git-Cv9mQgTx.js} +6 -6
- package/dist/lib/{shadow-claw-git-D-1oIh65.js.map → shadow-claw-git-Cv9mQgTx.js.map} +1 -1
- package/dist/lib/{shadow-claw-integrations-CZjnm7cM.js → shadow-claw-integrations-RZZ-m-Id.js} +4 -4
- package/dist/lib/{shadow-claw-integrations-CZjnm7cM.js.map → shadow-claw-integrations-RZZ-m-Id.js.map} +1 -1
- package/dist/lib/{shadow-claw-llm-4Gefh5FN.js → shadow-claw-llm-CKOYzPDp.js} +9 -9
- package/dist/lib/{shadow-claw-llm-4Gefh5FN.js.map → shadow-claw-llm-CKOYzPDp.js.map} +1 -1
- package/dist/lib/{shadow-claw-mcp-remote-B9ssb3YV.js → shadow-claw-mcp-remote-BKFROurv.js} +4 -4
- package/dist/lib/{shadow-claw-mcp-remote-B9ssb3YV.js.map → shadow-claw-mcp-remote-BKFROurv.js.map} +1 -1
- package/dist/lib/{shadow-claw-networking-BN5BB4hb.js → shadow-claw-networking-DYfiUQaH.js} +2 -2
- package/dist/lib/{shadow-claw-networking-BN5BB4hb.js.map → shadow-claw-networking-DYfiUQaH.js.map} +1 -1
- package/dist/lib/{shadow-claw-notifications-71KARtkY.js → shadow-claw-notifications-JJlzriuX.js} +3 -3
- package/dist/lib/{shadow-claw-notifications-71KARtkY.js.map → shadow-claw-notifications-JJlzriuX.js.map} +1 -1
- package/dist/lib/{shadow-claw-page-header-DMGO-TSe.js → shadow-claw-page-header-C_Qr3xZM.js} +2 -2
- package/dist/lib/{shadow-claw-page-header-DMGO-TSe.js.map → shadow-claw-page-header-C_Qr3xZM.js.map} +1 -1
- package/dist/lib/{shadow-claw-pages-BiRM6qiA.js → shadow-claw-pages-BCo3ihZI.js} +11 -11
- package/dist/lib/{shadow-claw-pages-BiRM6qiA.js.map → shadow-claw-pages-BCo3ihZI.js.map} +1 -1
- package/dist/lib/{shadow-claw-peerjs-BZu7jNSe.js → shadow-claw-peerjs-CFNjfrY5.js} +6 -6
- package/dist/lib/{shadow-claw-peerjs-BZu7jNSe.js.map → shadow-claw-peerjs-CFNjfrY5.js.map} +1 -1
- package/dist/lib/{shadow-claw-provider-model-picker-BXYXEobD.js → shadow-claw-provider-model-picker-B-Ct4yW-.js} +2 -2
- package/dist/lib/{shadow-claw-provider-model-picker-BXYXEobD.js.map → shadow-claw-provider-model-picker-B-Ct4yW-.js.map} +1 -1
- package/dist/lib/{shadow-claw-settings-CcT5EK08.js → shadow-claw-settings-BMwne0bh.js} +7 -7
- package/dist/lib/{shadow-claw-settings-CcT5EK08.js.map → shadow-claw-settings-BMwne0bh.js.map} +1 -1
- package/dist/lib/{shadow-claw-storage-eTOpbvpi.js → shadow-claw-storage-DUY8B9m-.js} +5 -5
- package/dist/lib/{shadow-claw-storage-eTOpbvpi.js.map → shadow-claw-storage-DUY8B9m-.js.map} +1 -1
- package/dist/lib/{shadow-claw-task-server-DFImTUbw.js → shadow-claw-task-server-yWeoA3eL.js} +2 -2
- package/dist/lib/{shadow-claw-task-server-DFImTUbw.js.map → shadow-claw-task-server-yWeoA3eL.js.map} +1 -1
- package/dist/lib/{shadow-claw-tasks-BjaxsmUx.js → shadow-claw-tasks-Bg0uM15I.js} +9 -9
- package/dist/lib/{shadow-claw-tasks-BjaxsmUx.js.map → shadow-claw-tasks-Bg0uM15I.js.map} +1 -1
- package/dist/lib/{shadow-claw-terminal-C-4wreFe.js → shadow-claw-terminal-fyJPppY_.js} +2 -2
- package/dist/lib/{shadow-claw-terminal-C-4wreFe.js.map → shadow-claw-terminal-fyJPppY_.js.map} +1 -1
- package/dist/lib/{shadow-claw-tools-COdrGZJk.js → shadow-claw-tools-D0T8m3go.js} +7 -7
- package/dist/lib/{shadow-claw-tools-COdrGZJk.js.map → shadow-claw-tools-D0T8m3go.js.map} +1 -1
- package/dist/lib/{shadow-claw-webvm-sxqVjO0L.js → shadow-claw-webvm-CQvzJwKI.js} +3 -3
- package/dist/lib/{shadow-claw-webvm-sxqVjO0L.js.map → shadow-claw-webvm-CQvzJwKI.js.map} +1 -1
- package/dist/lib/{sync-web-mcp-registration-D4hdUwtv.js → sync-web-mcp-registration-BFtG_4kx.js} +6 -6
- package/dist/lib/{sync-web-mcp-registration-D4hdUwtv.js.map → sync-web-mcp-registration-BFtG_4kx.js.map} +1 -1
- package/dist/lib/{system-prompt-DT_KeYaL.js → system-prompt-bhGRLoL2.js} +7 -7
- package/dist/lib/{system-prompt-DT_KeYaL.js.map → system-prompt-bhGRLoL2.js.map} +1 -1
- package/dist/lib/{tools-Beuyh8y1.js → tools-B8OJ4sMF.js} +4 -4
- package/dist/lib/{tools-Beuyh8y1.js.map → tools-B8OJ4sMF.js.map} +1 -1
- package/dist/lib/{transformers-DydnReu4.js → transformers-BMURofG6.js} +2 -2
- package/dist/lib/{transformers-DydnReu4.js.map → transformers-BMURofG6.js.map} +1 -1
- package/dist/lib/{trusted-types-CfwZl_rr.js → trusted-types-HwsGS5Nj.js} +19 -17
- package/dist/lib/{trusted-types-CfwZl_rr.js.map → trusted-types-HwsGS5Nj.js.map} +1 -1
- package/dist/lib/{upload-group-file-BbBzjTcN.js → upload-group-file-CJpoNjEb.js} +3 -3
- package/dist/lib/{upload-group-file-BbBzjTcN.js.map → upload-group-file-CJpoNjEb.js.map} +1 -1
- package/dist/lib/utils/index.js +1 -1
- package/dist/lib/utils/namespaced-storage.js +1 -1
- package/dist/lib/utils/runtime-assets.js +1 -1
- package/dist/lib/utils/utils.js +1 -1
- package/dist/lib/{webmcp-DCfAFiIO.js → webmcp-BoMTvgmX.js} +3 -3
- package/dist/lib/{webmcp-DCfAFiIO.js.map → webmcp-BoMTvgmX.js.map} +1 -1
- package/dist/lib/{write-group-file-bytes-Ccn-VFUU.js → write-group-file-bytes-CNT7DqOZ.js} +3 -3
- package/dist/lib/{write-group-file-bytes-Ccn-VFUU.js.map → write-group-file-bytes-CNT7DqOZ.js.map} +1 -1
- package/dist/public/.well-known/mcp/server-card.json +12 -4
- package/dist/public/.well-known/mcp.json +12 -4
- package/dist/public/agent.worker.js +1 -1
- package/dist/public/attachment-capabilities-AdwXt3--.js +1 -0
- package/dist/public/{channel-BylT3rJC.js → channel-Dk7wl-Av.js} +1 -1
- package/dist/public/{chat-template-DPHJy7tr.js → chat-template-BwAnTFKf.js} +1 -1
- package/dist/public/{compact-context-BINQh64w.js → compact-context-fOTqwKF6.js} +2 -2
- package/dist/public/config-C16fFWtP.js +1 -0
- package/dist/public/{configure-peer-js-DChhcOfe.js → configure-peer-js-BOV0tR6G.js} +1 -1
- package/dist/public/{connections-CHaw0VqP.js → connections-Dxwj8yK_.js} +1 -1
- package/dist/public/{create-model-cache-fetch-DQebkoPL.js → create-model-cache-fetch-DSAFjOwc.js} +1 -1
- package/dist/public/{credentials-CgVqS119.js → credentials-CJUQ5Ep2.js} +1 -1
- package/dist/public/{custom-element-security-kiDhPfb8.js → custom-element-security-B2daIE5r.js} +2 -2
- package/dist/public/{discover-skills-Cvmx5I9V.js → discover-skills-D1sNTy2r.js} +6 -6
- package/dist/public/docs/example/article/index.html +28 -29
- package/dist/public/docs/example/article.html +28 -29
- package/dist/public/docs/publishing/index.html +28 -29
- package/dist/public/docs/publishing.html +28 -29
- package/dist/public/docs/skill-creator/index.html +28 -29
- package/dist/public/docs/skill-creator.html +28 -29
- package/dist/public/{download-group-file-BapoRgfU.js → download-group-file-BkMH-JKi.js} +1 -1
- package/dist/public/{e2e-bridge-C0g8vZKr.js → e2e-bridge-Cz95DLlb.js} +1 -1
- package/dist/public/get-group-dir-D--BiEyk.js +1 -0
- package/dist/public/{get-or-create-subscriber-id-GvRZYXwA.js → get-or-create-subscriber-id-jVHnQfbr.js} +1 -1
- package/dist/public/{git-CaAAZfVd.js → git-BmMlwIMP.js} +2 -2
- package/dist/public/{iframe-bridge-scripts-BnqtKhE4.js → iframe-bridge-scripts-Cibg0m6A.js} +1 -1
- package/dist/public/index.html +28 -29
- package/dist/public/index.js +1 -1
- package/dist/public/{init-chat-split-resize-Btonoy8u.js → init-chat-split-resize-C8AqCCiK.js} +1 -1
- package/dist/public/init-control-plane-Cb31yLTY.js +1 -0
- package/dist/public/{invoke-agent-B3Osw6K7.js → invoke-agent-CN7mSV0Z.js} +1 -1
- package/dist/public/main/index.html +28 -29
- package/dist/public/main/memory/index.html +28 -29
- package/dist/public/main/memory.html +28 -29
- package/dist/public/main.html +28 -29
- package/dist/public/{markdown-CPbU4r1U.js → markdown-CDSb5Hrl.js} +1 -1
- package/dist/public/{mcp-reconnect-CzROVsXG.js → mcp-reconnect-iPZPihwX.js} +1 -1
- package/dist/public/{memory-storage-BkoMlxOr.js → memory-storage-2m7KZ-aP.js} +1 -1
- package/dist/public/{model-ranking-CK0iBo3Z.js → model-ranking-BgOSaNIy.js} +1 -1
- package/dist/public/{move-group-entry-CTxoq7lw.js → move-group-entry-CXneuNVa.js} +1 -1
- package/dist/public/orchestrator-DBO4NZqd.js +63 -0
- package/dist/public/{orchestrator-BrDjQbGf.js → orchestrator-Dyylc8IU.js} +2 -2
- package/dist/public/{peerjs-CgF4Iz5W.js → peerjs-l0jiBoh6.js} +1 -1
- package/dist/public/{process-peer-query-param-BL2k0Hu-.js → process-peer-query-param-s-aSP1Rq.js} +1 -1
- package/dist/public/{process-pending-shared-payloads-C1AgGvn8.js → process-pending-shared-payloads-BN3GigPT.js} +1 -1
- package/dist/public/{process-room-query-param-DM0QCq3_.js → process-room-query-param-B2Qe0F0M.js} +1 -1
- package/dist/public/provider-YPZmsuHR.js +1 -0
- package/dist/public/{push-client-DJEOz7bi.js → push-client-B2LC8Qp9.js} +1 -1
- package/dist/public/{rooms-C6LXIJl4.js → rooms-ChCEOvkw.js} +1 -1
- package/dist/public/service-worker.js +1 -1
- package/dist/public/shadow-claw-Br8mWDUx.js +1176 -0
- package/dist/public/{shadow-claw-accounts--4hd_oCz.js → shadow-claw-accounts-Dm6G7KMP.js} +1 -1
- package/dist/public/{shadow-claw-card-IbNlZAdK.js → shadow-claw-card-CggS8uSa.js} +1 -1
- package/dist/public/{shadow-claw-channels-Vq_pPGa2.js → shadow-claw-channels-088vhuWO.js} +1 -1
- package/dist/public/{shadow-claw-chat-D7_GS25e.js → shadow-claw-chat-BRwRlq-n.js} +3 -3
- package/dist/public/{shadow-claw-control-plane-WTMEV8_p.js → shadow-claw-control-plane-rhKACK85.js} +2 -2
- package/dist/public/{shadow-claw-conversations-CLQgU1IT.js → shadow-claw-conversations-CF_yUfKl.js} +1 -1
- package/dist/public/{shadow-claw-empty-state-D4CrFGsN.js → shadow-claw-empty-state-CkpOSXCS.js} +1 -1
- package/dist/public/{shadow-claw-file-viewer-BhqiqLWQ.js → shadow-claw-file-viewer-DWCejuY3.js} +4 -4
- package/dist/public/{shadow-claw-files-senDiG9l.js → shadow-claw-files-L6_ioyzh.js} +2 -2
- package/dist/public/{shadow-claw-git-DOOCqY23.js → shadow-claw-git-DsdkwLqQ.js} +2 -2
- package/dist/public/{shadow-claw-integrations-Bsvc3Agq.js → shadow-claw-integrations-CSbRTOm3.js} +1 -1
- package/dist/public/{shadow-claw-llm-actYICAk.js → shadow-claw-llm-BitaeAVc.js} +2 -2
- package/dist/public/{shadow-claw-mcp-remote-BYUgrK3v.js → shadow-claw-mcp-remote-gSbV5riy.js} +1 -1
- package/dist/public/{shadow-claw-networking-Dk3p5Ny_.js → shadow-claw-networking-Dn_y6Cl9.js} +1 -1
- package/dist/public/{shadow-claw-notifications-CzPAlay8.js → shadow-claw-notifications-Cj4Lqx8U.js} +1 -1
- package/dist/public/{shadow-claw-page-header-CjJpVkyL.js → shadow-claw-page-header-DR4OZFt2.js} +1 -1
- package/dist/public/{shadow-claw-page-header-action-button-2DH5O1TD.js → shadow-claw-page-header-action-button-BnCV_2Kb.js} +1 -1
- package/dist/public/{shadow-claw-pages-3r5I-wI8.js → shadow-claw-pages-mpDOtNYj.js} +6 -6
- package/dist/public/{shadow-claw-pdf-viewer-BiCEwsoY.js → shadow-claw-pdf-viewer-DZ_84qJH.js} +1 -1
- package/dist/public/{shadow-claw-settings-DgB9RSZN.js → shadow-claw-settings-CfFTYTEy.js} +2 -2
- package/dist/public/{shadow-claw-storage-JB_43nd8.js → shadow-claw-storage-DLmiT4bG.js} +1 -1
- package/dist/public/{shadow-claw-task-server-oi5UIxdA.js → shadow-claw-task-server-BoMBCsiS.js} +1 -1
- package/dist/public/{shadow-claw-tasks-CnyiOt81.js → shadow-claw-tasks-ChEp1j7x.js} +3 -3
- package/dist/public/{shadow-claw-terminal-BC3RynHt.js → shadow-claw-terminal-BaoVbOda.js} +1 -1
- package/dist/public/{shadow-claw-toast-YjG--2Za.js → shadow-claw-toast-e8oz7z6Z.js} +1 -1
- package/dist/public/{shadow-claw-tools-Bbwk4vlT.js → shadow-claw-tools-BYjUBiJz.js} +1 -1
- package/dist/public/{shadow-claw-webvm-HZqzl2H5.js → shadow-claw-webvm-xGb13TME.js} +1 -1
- package/dist/public/{sync-web-mcp-registration-BaH2nAP0.js → sync-web-mcp-registration-CQluj-Kz.js} +1 -1
- package/dist/public/{system-prompt-Dck3N8T0.js → system-prompt-CTJn0tK-.js} +1 -1
- package/dist/public/{tools-DHA1dK2I.js → tools-D-52Zmfc.js} +1 -1
- package/dist/public/{transformers-C-DuTM2K.js → transformers-CQ9ss9rD.js} +1 -1
- package/dist/public/{upload-group-file-Cejr3zo1.js → upload-group-file-A8kB7lvO.js} +1 -1
- package/dist/public/{webmcp-CMRtu57-.js → webmcp-DIUZjVF5.js} +1 -1
- package/dist/public/{write-group-file-CmJuVQNO.js → write-group-file-R67DjJ-q.js} +1 -1
- package/dist/public/{write-group-file-bytes-Cejr3zo1.js → write-group-file-bytes-A8kB7lvO.js} +1 -1
- package/dist/public/{zip-reader-CuQ13eLe.js → zip-reader-DN7FB-Q0.js} +1 -1
- package/dist/server.js +1 -1
- package/package.json +1 -1
- package/dist/cli/chunk-BFziiMKt.js +0 -7
- package/dist/cli/chunk-BM3llsxb.js +0 -1
- package/dist/cli/chunk-Bj5qFsDi.js +0 -7
- package/dist/cli/chunk-Bj95zm-y.js +0 -1
- package/dist/cli/chunk-BpyP-esT.js +0 -1
- package/dist/cli/chunk-CX696s3_.js +0 -1
- package/dist/cli/chunk-DRxCrCAA.js +0 -139
- package/dist/cli/chunk-DjbCHa0h.js +0 -1
- package/dist/cli/chunk-DsQhAF31.js +0 -1
- package/dist/cli/chunk-VM-dECyG.js +0 -1
- package/dist/cli/chunk-heu2xRw1.js +0 -1
- package/dist/lib/orchestrator-i_QJ-o22.js.map +0 -1
- package/dist/lib/shadow-claw-DoQ7fgl5.js.map +0 -1
- package/dist/public/app-routes-V_-URXc5.js +0 -1
- package/dist/public/attachment-capabilities-B6ibLwQB.js +0 -1
- package/dist/public/config-C-YdSFZB.js +0 -1
- package/dist/public/get-group-dir-DL44kvqW.js +0 -1
- package/dist/public/init-control-plane-BoJijVtf.js +0 -1
- package/dist/public/orchestrator-CaUpEVkQ.js +0 -63
- package/dist/public/provider-DNIL4-Hw.js +0 -1
- package/dist/public/shadow-claw-DdgeYPg5.js +0 -1176
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webmcp-DCfAFiIO.js","names":[],"sources":["../../node_modules/@mcp-b/webmcp-polyfill/dist/index.js","../../src/subsystems/mcp/webmcp.ts"],"sourcesContent":["//#region src/upstream/frames.ts\nconst annotationNames = [\n\t\"consequentialHint\",\n\t\"debugging\",\n\t\"readOnlyHint\",\n\t\"untrustedContentHint\"\n];\nconst protocol = \"webmcp-polyfill\";\nconst deadline = 500;\nconst NativeDOMException$1 = globalThis.DOMException;\nvar FrameBridge = class {\n\t#document;\n\t#window;\n\t#handlers;\n\t#knownPeers = /* @__PURE__ */ new Set();\n\t#unanswered = /* @__PURE__ */ new Set();\n\t#started = Promise.withResolvers();\n\t#handshakes = /* @__PURE__ */ new Map();\n\t#sessions = /* @__PURE__ */ new Set();\n\t#monitor;\n\t#hidden = false;\n\tconstructor(view, handlers) {\n\t\tthis.#window = view;\n\t\tthis.#document = view.document;\n\t\tthis.#handlers = handlers;\n\t\tthis.#window.addEventListener(\"message\", (event) => this.#receive(event), true);\n\t\tthis.#window.addEventListener(\"pagehide\", () => {\n\t\t\tthis.#hidden = true;\n\t\t\tfor (const session of this.#sessions) session.end();\n\t\t});\n\t\tthis.#window.addEventListener(\"pageshow\", (event) => {\n\t\t\tif (event.persisted) {\n\t\t\t\tthis.#hidden = false;\n\t\t\t\tthis.#announce();\n\t\t\t}\n\t\t});\n\t\tfor (const frame of this.#announce()) this.#unanswered.add(frame);\n\t\tif (this.#unanswered.size === 0) this.#started.resolve();\n\t\telse setTimeout(() => {\n\t\t\tthis.#unanswered.clear();\n\t\t\tthis.#started.resolve();\n\t\t}, deadline);\n\t}\n\tasync allowed() {\n\t\tif (this.#hidden) return false;\n\t\treturn this.#documentAllowed(this.#document);\n\t}\n\tasync getTools(fromOrigins) {\n\t\tawait this.#started.promise;\n\t\tconst ownOrigin = this.#window.origin;\n\t\tconst origins = [ownOrigin, ...fromOrigins];\n\t\treturn (await Promise.all(this.#participants().map(async (peer) => {\n\t\t\tif (peer === this.#window) return this.#handlers.getTools(ownOrigin).map((metadata) => toRegisteredTool(metadata, this.#window, ownOrigin));\n\t\t\ttry {\n\t\t\t\tconst reply = await this.#request(peer, origins, { kind: \"getTools\" });\n\t\t\t\tif (!Array.isArray(reply.value)) throw new TypeError(\"Expected a tool list from the frame\");\n\t\t\t\treturn reply.value.map((value) => toRegisteredTool(readToolMetadata(value), peer, reply.origin));\n\t\t\t} catch (error) {\n\t\t\t\tif (!(error instanceof NativeDOMException$1 && error.name === \"UnknownError\")) console.warn(\"WebMCP: could not read tools from a frame.\", error);\n\t\t\t\treturn [];\n\t\t\t}\n\t\t}))).flat();\n\t}\n\tasync execute(target, expectedOrigin, name, serializedInput, signal) {\n\t\tconst reply = await this.#request(target, [expectedOrigin], {\n\t\t\tkind: \"execute\",\n\t\t\tname,\n\t\t\tinput: serializedInput\n\t\t}, signal);\n\t\tif (typeof reply.value !== \"string\") throw executionError();\n\t\treturn reply.value;\n\t}\n\tasync notify(exposedTo) {\n\t\tawait this.#started.promise;\n\t\tconst origins = [this.#window.origin, ...exposedTo];\n\t\tfor (const peer of this.#participants()) {\n\t\t\tif (peer === this.#window) {\n\t\t\t\tawait this.#handlers.changed();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait this.#request(peer, origins, { kind: \"changed\" });\n\t\t\t} catch {}\n\t\t}\n\t}\n\t#request(target, origins, request, signal) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tsignal?.throwIfAborted();\n\t\t\tif (this.#hidden || !this.#related(target)) {\n\t\t\t\treject(executionError());\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst id = crypto.randomUUID();\n\t\t\tconst { port1, port2 } = new MessageChannel();\n\t\t\tlet peerOrigin;\n\t\t\tconst close = () => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\tstopWatching();\n\t\t\t\tsignal?.removeEventListener(\"abort\", abort);\n\t\t\t\tthis.#handshakes.delete(id);\n\t\t\t\tport1.close();\n\t\t\t};\n\t\t\tconst fail = (error = executionError()) => {\n\t\t\t\tport1.postMessage({ kind: \"cancel\" });\n\t\t\t\tclose();\n\t\t\t\treject(error);\n\t\t\t};\n\t\t\tconst abort = () => fail(signal?.reason);\n\t\t\tconst expire = () => {\n\t\t\t\tif (peerOrigin === void 0) this.#forget(target);\n\t\t\t\tfail();\n\t\t\t};\n\t\t\tconst connected = (event) => {\n\t\t\t\tif (event.source !== target) return;\n\t\t\t\tthis.#handshakes.delete(id);\n\t\t\t\tif (origins && !origins.includes(event.origin)) {\n\t\t\t\t\tfail();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tpeerOrigin = event.origin;\n\t\t\t\tclearTimeout(timer);\n\t\t\t\tif (request.kind !== \"execute\" && request.kind !== \"changed\") timer = setTimeout(expire, deadline);\n\t\t\t\tport1.postMessage(request);\n\t\t\t};\n\t\t\tlet timer = setTimeout(expire, deadline);\n\t\t\tconst stopWatching = this.#watch(target, fail);\n\t\t\tport1.onmessage = (event) => {\n\t\t\t\tconst reply = record(event.data);\n\t\t\t\tif (reply?.kind === \"error\") {\n\t\t\t\t\tfail();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (reply?.kind !== \"result\" || peerOrigin === void 0) return;\n\t\t\t\tclose();\n\t\t\t\tresolve({\n\t\t\t\t\tvalue: reply.value,\n\t\t\t\t\torigin: peerOrigin\n\t\t\t\t});\n\t\t\t};\n\t\t\tport1.onmessageerror = () => fail();\n\t\t\tsignal?.addEventListener(\"abort\", abort, { once: true });\n\t\t\tthis.#handshakes.set(id, connected);\n\t\t\ttry {\n\t\t\t\ttarget.postMessage(`${protocol}:connect:${id}`, \"*\", [port2]);\n\t\t\t} catch {\n\t\t\t\tport2.close();\n\t\t\t\tfail();\n\t\t\t}\n\t\t});\n\t}\n\t#receive(event) {\n\t\tconst message = readWindowMessage(event.data);\n\t\tif (!message) return;\n\t\tevent.stopImmediatePropagation();\n\t\tconst source = event.source;\n\t\tif (!event.isTrusted || !source || !isWindow(source) || !this.#related(source) || event.origin === \"null\" || this.#hidden) return;\n\t\tif (message.kind === \"announce\") {\n\t\t\tconst isNew = !this.#knownPeers.has(source);\n\t\t\tthis.#learn(source);\n\t\t\tsource.postMessage(`${protocol}:present`, event.origin);\n\t\t\tif (!isNew || this.#window !== this.#window.top) return;\n\t\t\tfor (const peer of this.#knownPeers) {\n\t\t\t\tif (peer === source) continue;\n\t\t\t\tpeer.postMessage(`${protocol}:refresh`, \"*\");\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (message.kind === \"present\") {\n\t\t\tthis.#learn(source);\n\t\t\treturn;\n\t\t}\n\t\tif (message.kind === \"refresh\") {\n\t\t\tif (source === this.#window.top) this.#announce();\n\t\t\treturn;\n\t\t}\n\t\tif (message.kind === \"ready\") {\n\t\t\tthis.#handshakes.get(message.id)?.(event);\n\t\t\treturn;\n\t\t}\n\t\tconst [port] = event.ports;\n\t\tif (message.kind !== \"connect\" || !message.id || !port || event.ports.length !== 1) return;\n\t\tthis.#learn(source);\n\t\tthis.#accept(source, event.origin, message.id, port);\n\t}\n\t#accept(source, origin, id, port) {\n\t\tconst controller = new AbortController();\n\t\tlet requested = false;\n\t\tconst close = () => {\n\t\t\tclearTimeout(timer);\n\t\t\tstopWatching();\n\t\t\tport.close();\n\t\t};\n\t\tconst cancel = () => {\n\t\t\tcontroller.abort();\n\t\t\tclose();\n\t\t};\n\t\tconst fail = () => {\n\t\t\tport.postMessage({ kind: \"error\" });\n\t\t\tcancel();\n\t\t};\n\t\tconst timer = setTimeout(fail, deadline);\n\t\tconst stopWatching = this.#watch(source, fail);\n\t\tport.onmessageerror = fail;\n\t\tport.onmessage = async (event) => {\n\t\t\tconst request = record(event.data);\n\t\t\tif (request?.kind === \"cancel\") {\n\t\t\t\tcancel();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (requested) return;\n\t\t\trequested = true;\n\t\t\tclearTimeout(timer);\n\t\t\ttry {\n\t\t\t\tconst value = await this.#respond(source, origin, request, controller.signal);\n\t\t\t\tport.postMessage({\n\t\t\t\t\tkind: \"result\",\n\t\t\t\t\tvalue\n\t\t\t\t});\n\t\t\t\tclose();\n\t\t\t} catch {\n\t\t\t\tfail();\n\t\t\t}\n\t\t};\n\t\tsource.postMessage(`${protocol}:ready:${id}`, origin);\n\t}\n\tasync #respond(source, origin, request, signal) {\n\t\tif (!request || !this.#related(source)) throw executionError();\n\t\tif (request.kind === \"permission\") {\n\t\t\tconst { childIndex, childOrigin } = request;\n\t\t\tif (typeof childIndex !== \"number\" || !Number.isInteger(childIndex) || childIndex < 0 || typeof childOrigin !== \"string\") throw executionError();\n\t\t\treturn this.#childPermission(childIndex, childOrigin);\n\t\t}\n\t\tif (!await this.allowed() || !await this.#sourceAllowed(source, origin)) throw executionError();\n\t\tif (!this.#related(source)) throw executionError();\n\t\tsignal.throwIfAborted();\n\t\tif (request.kind === \"getTools\") return this.#handlers.getTools(origin);\n\t\tif (request.kind === \"execute\" && typeof request.name === \"string\" && typeof request.input === \"string\") return this.#handlers.execute(origin, request.name, request.input, signal);\n\t\tif (request.kind === \"changed\") {\n\t\t\tawait this.#handlers.changed();\n\t\t\treturn;\n\t\t}\n\t\tthrow executionError();\n\t}\n\tasync #childPermission(childIndex, childOrigin) {\n\t\tconst child = this.#window[childIndex];\n\t\treturn child !== void 0 && await this.allowed() && childAllowed(this.#document, child, childOrigin);\n\t}\n\tasync #documentAllowed(owner) {\n\t\tconst view = activeWindow(owner);\n\t\tif (!view) return false;\n\t\tconst policy = readToolsPolicy(owner);\n\t\tif (policy !== void 0) return policy;\n\t\tif (view === view.parent) return true;\n\t\tconst parentOrigin = view.location.ancestorOrigins?.[0];\n\t\tconst parentDocument = readDocument(view.parent, parentOrigin === void 0 || parentOrigin === view.origin);\n\t\tif (!parentDocument) return this.#parentPermission(view, view.origin);\n\t\treturn childAllowed(parentDocument, view, view.origin) && await this.#documentAllowed(parentDocument);\n\t}\n\tasync #sourceAllowed(source, origin) {\n\t\tconst sourceDocument = readDocument(source, origin === this.#window.origin);\n\t\treturn sourceDocument ? this.#documentAllowed(sourceDocument) : this.#parentPermission(source, origin);\n\t}\n\tasync #parentPermission(child, origin) {\n\t\tconst parent = child.parent;\n\t\tif (parent === child) return true;\n\t\tlet childIndex = -1;\n\t\tfor (let index = 0; index < parent.length; index++) if (parent[index] === child) {\n\t\t\tchildIndex = index;\n\t\t\tbreak;\n\t\t}\n\t\tif (childIndex < 0) return false;\n\t\tif (parent === this.#window) return await this.allowed() && childAllowed(this.#document, child, origin);\n\t\tawait this.#started.promise;\n\t\tif (!this.#knownPeers.has(parent)) return false;\n\t\ttry {\n\t\t\tconst reply = await this.#request(parent, void 0, {\n\t\t\t\tkind: \"permission\",\n\t\t\t\tchildIndex,\n\t\t\t\tchildOrigin: origin\n\t\t\t});\n\t\t\treturn reply.value === true && await this.#sourceAllowed(parent, reply.origin);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n\t#related(peer) {\n\t\ttry {\n\t\t\treturn !peer.closed && peer !== this.#window && peer.top === this.#window.top;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n\t#tree() {\n\t\tif (this.#window.closed) return [];\n\t\tfor (const peer of this.#knownPeers) if (!this.#related(peer)) this.#knownPeers.delete(peer);\n\t\tconst candidates = [this.#window, ...this.#knownPeers];\n\t\tfor (let ancestor = this.#window.parent; ancestor !== ancestor.parent; ancestor = ancestor.parent) candidates.push(ancestor);\n\t\tconst tree = /* @__PURE__ */ new Set();\n\t\tconst pending = [this.#window.top];\n\t\twhile (pending.length) {\n\t\t\tconst frame = pending.pop();\n\t\t\tif (tree.has(frame)) continue;\n\t\t\ttree.add(frame);\n\t\t\tconst children = [];\n\t\t\tfor (let index = 0; index < frame.length; index++) {\n\t\t\t\tconst child = frame[index];\n\t\t\t\tif (child) children.push(child);\n\t\t\t}\n\t\t\tfor (const candidate of candidates) if (candidate !== frame && candidate.parent === frame && !children.includes(candidate)) children.push(candidate);\n\t\t\tpending.push(...children.reverse());\n\t\t}\n\t\treturn Array.from(tree).filter((frame) => frame === this.#window || this.#related(frame));\n\t}\n\t#participants() {\n\t\treturn this.#tree().filter((frame) => frame === this.#window || this.#knownPeers.has(frame));\n\t}\n\t#announce() {\n\t\tconst others = this.#tree().filter((frame) => frame !== this.#window);\n\t\tfor (const frame of others) frame.postMessage(`${protocol}:announce`, \"*\");\n\t\treturn others;\n\t}\n\t#learn(peer) {\n\t\tthis.#knownPeers.add(peer);\n\t\tthis.#unanswered.delete(peer);\n\t\tif (this.#unanswered.size === 0) this.#started.resolve();\n\t}\n\t#forget(peer) {\n\t\tthis.#knownPeers.delete(peer);\n\t\tif (this.#related(peer)) peer.postMessage(`${protocol}:announce`, \"*\");\n\t}\n\t#watch(peer, end) {\n\t\tconst session = {\n\t\t\tpeer,\n\t\t\tend\n\t\t};\n\t\tthis.#sessions.add(session);\n\t\tif (this.#monitor === void 0) this.#monitor = this.#window.setInterval(() => {\n\t\t\tfor (const open of this.#sessions) if (!this.#related(open.peer)) open.end();\n\t\t}, 100);\n\t\treturn () => {\n\t\t\tthis.#sessions.delete(session);\n\t\t\tif (this.#sessions.size === 0) {\n\t\t\t\tthis.#window.clearInterval(this.#monitor);\n\t\t\t\tthis.#monitor = void 0;\n\t\t\t}\n\t\t};\n\t}\n};\nfunction childAllowed(owner, child, origin) {\n\tconst ownerOrigin = owner.defaultView?.origin;\n\tconst frame = findFrame(owner, child, origin === ownerOrigin);\n\tif (!frame) return false;\n\tconst directive = (frame.getAttribute(\"allow\") ?? \"\").split(\";\").map((part) => part.trim().split(/\\s+/u)).find(([name]) => name === \"tools\");\n\tif (!directive) return origin === ownerOrigin;\n\tconst sources = directive.length === 1 ? [\"'src'\"] : directive.slice(1);\n\tif (sources.includes(\"'none'\")) return false;\n\tconst src = frame.hasAttribute(\"srcdoc\") ? null : frame.getAttribute(\"src\");\n\tconst srcURL = src ? URL.parse(src, owner.baseURI) : null;\n\tconst sourceOrigin = !src || srcURL?.protocol === \"about:\" ? ownerOrigin : srcURL?.origin;\n\treturn sources.some((source) => source === \"*\" || source === \"'self'\" && origin === ownerOrigin || source === \"'src'\" && origin === sourceOrigin || source === origin);\n}\nfunction readDocument(view, sameOrigin) {\n\tif (!sameOrigin) return;\n\ttry {\n\t\treturn view.document;\n\t} catch {\n\t\treturn;\n\t}\n}\nfunction findFrame(owner, child, sameOrigin) {\n\tif (sameOrigin) try {\n\t\tconst frame = child.frameElement;\n\t\tif (frame?.ownerDocument === owner) return frame;\n\t} catch {}\n\treturn searchFrames(owner, child);\n}\nfunction searchFrames(root, child) {\n\tconst frames = root.querySelectorAll(\"iframe, frame\");\n\tfor (const frame of frames) if (frame.contentWindow === child) return frame;\n\tfor (const element of root.querySelectorAll(\"*\")) {\n\t\tif (!element.shadowRoot) continue;\n\t\tconst frame = searchFrames(element.shadowRoot, child);\n\t\tif (frame) return frame;\n\t}\n}\nfunction activeWindow(owner) {\n\tconst view = owner.defaultView;\n\treturn view && !view.closed && view.document === owner ? view : void 0;\n}\nfunction readToolsPolicy(owner) {\n\tconst source = owner;\n\tconst policy = record(source.permissionsPolicy ?? source.featurePolicy);\n\tif (typeof policy?.features !== \"function\" || typeof policy.allowsFeature !== \"function\") return;\n\tconst features = policy.features();\n\treturn Array.isArray(features) && features.includes(\"tools\") ? Boolean(policy.allowsFeature(\"tools\")) : void 0;\n}\nfunction toRegisteredTool(metadata, owner, origin) {\n\tconst inputSchema = metadata.serializedSchema === void 0 ? void 0 : JSON.parse(metadata.serializedSchema);\n\treturn {\n\t\t...metadata.annotations !== void 0 && { annotations: { ...metadata.annotations } },\n\t\tdescription: metadata.description,\n\t\t...inputSchema !== void 0 && { inputSchema },\n\t\tname: metadata.name,\n\t\torigin,\n\t\ttitle: metadata.title,\n\t\twindow: owner\n\t};\n}\nfunction readToolMetadata(value) {\n\tconst tool = record(value);\n\tif (!tool || typeof tool.name !== \"string\" || typeof tool.title !== \"string\" || typeof tool.description !== \"string\" || tool.serializedSchema !== void 0 && typeof tool.serializedSchema !== \"string\") throw new TypeError(\"Invalid tool metadata from the frame\");\n\tconst metadata = {\n\t\tname: tool.name,\n\t\ttitle: tool.title,\n\t\tdescription: tool.description,\n\t\tannotations: void 0,\n\t\tserializedSchema: tool.serializedSchema\n\t};\n\tif (tool.annotations === void 0) return metadata;\n\tconst hints = record(tool.annotations);\n\tif (!hints) throw new TypeError(\"Invalid tool annotations from the frame\");\n\tconst annotations = {};\n\tfor (const name of annotationNames) {\n\t\tconst hint = hints[name];\n\t\tif (hint === void 0) continue;\n\t\tif (typeof hint !== \"boolean\") throw new TypeError(`Invalid ${name} annotation from the frame`);\n\t\tannotations[name] = hint;\n\t}\n\tmetadata.annotations = annotations;\n\treturn metadata;\n}\nfunction readWindowMessage(value) {\n\tif (typeof value !== \"string\") return;\n\tconst [namespace, kind = \"\", id = \"\", extra] = value.split(\":\");\n\treturn namespace === protocol && extra === void 0 ? {\n\t\tkind,\n\t\tid\n\t} : void 0;\n}\nfunction record(value) {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) return;\n\treturn value;\n}\nfunction isWindow(value) {\n\ttry {\n\t\treturn \"postMessage\" in value && \"window\" in value;\n\t} catch {\n\t\treturn false;\n\t}\n}\nfunction executionError() {\n\treturn new NativeDOMException$1(\"Tool execution failed\", \"UnknownError\");\n}\n\n//#endregion\n//#region src/declarative-forms.ts\nconst agentInvokedEvents = /* @__PURE__ */ new WeakSet();\nconst agentResponses = /* @__PURE__ */ new WeakMap();\nconst activeSubmissions = /* @__PURE__ */ new WeakMap();\nfunction isAgentInvokedSubmitEvent(event) {\n\treturn event.isTrusted && (agentInvokedEvents.has(event) || event.eventPhase !== Event.NONE && event.target instanceof HTMLFormElement && activeSubmissions.has(event.target));\n}\nfunction respondWithAgentSubmitEvent(event, agentResponse) {\n\tif (!isAgentInvokedSubmitEvent(event)) throw new DOMException(\"respondWith() is only available during an agent-invoked submit event\", \"InvalidStateError\");\n\tif (!event.defaultPrevented) throw new DOMException(\"respondWith() requires preventDefault() during an agent-invoked submit event\", \"InvalidStateError\");\n\tif (event.eventPhase === Event.NONE) throw new DOMException(\"respondWith() is only available while the submit event is being dispatched\", \"InvalidStateError\");\n\tagentInvokedEvents.add(event);\n\tconst response = Promise.resolve(agentResponse);\n\tagentResponses.set(event, response);\n\tif (event.target instanceof HTMLFormElement) activeSubmissions.get(event.target)?.respond(event);\n}\nconst TEXT_INPUT_TYPES = new Set([\n\t\"email\",\n\t\"password\",\n\t\"search\",\n\t\"tel\",\n\t\"text\",\n\t\"url\"\n]);\nconst READONLY_INPUT_TYPES = new Set([\n\t...TEXT_INPUT_TYPES,\n\t\"date\",\n\t\"datetime-local\",\n\t\"month\",\n\t\"number\",\n\t\"time\",\n\t\"week\"\n]);\nfunction isControl(element) {\n\treturn element instanceof HTMLInputElement || element instanceof HTMLSelectElement || element instanceof HTMLTextAreaElement;\n}\nfunction getFormControls(form) {\n\treturn Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, \"elements\")?.get?.call(form);\n}\nfunction getFormAttribute(form, name) {\n\treturn Element.prototype.getAttribute.call(form, name);\n}\nfunction formHasAttribute(form, name) {\n\treturn Element.prototype.hasAttribute.call(form, name);\n}\nfunction isConnected(node) {\n\treturn Object.getOwnPropertyDescriptor(Node.prototype, \"isConnected\")?.get?.call(node);\n}\nfunction getOpenShadowRoot(element) {\n\treturn Object.getOwnPropertyDescriptor(Element.prototype, \"shadowRoot\")?.get?.call(element);\n}\nfunction checkFormValidity(form) {\n\treturn HTMLFormElement.prototype.checkValidity.call(form);\n}\nfunction requestFormSubmit(form, submitter) {\n\tHTMLFormElement.prototype.requestSubmit.call(form, submitter);\n}\nfunction getControls(form) {\n\treturn [...getFormControls(form)].filter((element) => isControl(element) && !element.matches(\":disabled\") && !(\"readOnly\" in element && element.readOnly && (element instanceof HTMLTextAreaElement || READONLY_INPUT_TYPES.has(element.type))));\n}\nfunction controlGroups(form) {\n\tconst groups = /* @__PURE__ */ new Map();\n\tfor (const control of getControls(form)) {\n\t\tconst name = control.name.trim();\n\t\tconst controls = groups.get(name);\n\t\tif (controls) controls.push(control);\n\t\telse groups.set(name, [control]);\n\t}\n\treturn groups;\n}\nfunction labelText(control) {\n\treturn [...control.labels ?? []].map((label) => {\n\t\tconst copy = label.cloneNode(true);\n\t\tif (!(copy instanceof HTMLElement)) return \"\";\n\t\tcopy.querySelectorAll(\"button, input, meter, output, progress, select, textarea\").forEach((element) => element.remove());\n\t\treturn copy.textContent?.trim() ?? \"\";\n\t}).filter(Boolean).join(\"; \");\n}\nfunction commonFieldset(form, controls) {\n\tfor (let element = controls[0]?.parentElement; element && element !== form; element = element.parentElement) if (element instanceof HTMLFieldSetElement && controls.every((control) => element.contains(control))) return element;\n}\nfunction parameterDescription(form, controls) {\n\tif (controls.length === 1) {\n\t\tconst control = controls[0];\n\t\tif (!control) return void 0;\n\t\treturn control.getAttribute(\"toolparamdescription\") || labelText(control) || control.getAttribute(\"aria-description\") || void 0;\n\t}\n\treturn commonFieldset(form, controls)?.getAttribute(\"toolparamdescription\") || void 0;\n}\nfunction withDescription(schema, form, controls, extra) {\n\tconst description = parameterDescription(form, controls);\n\tconst combined = description && extra ? `${description} (${extra})` : description || extra;\n\treturn combined ? {\n\t\t...schema,\n\t\tdescription: combined\n\t} : schema;\n}\nfunction validNumberAttribute(input, name) {\n\tconst raw = input.getAttribute(name);\n\tif (raw === null || raw.trim() === \"\") return void 0;\n\tconst value = Number(raw);\n\treturn Number.isFinite(value) ? value : void 0;\n}\nfunction validStep(input, fallback) {\n\tconst step = Number(input.getAttribute(\"step\"));\n\treturn Number.isFinite(step) && step > 0 ? step : fallback;\n}\nfunction isStepBaseMultiple(stepBase, step) {\n\tconst quotient = stepBase / step;\n\treturn Math.abs(quotient - Math.round(quotient)) < Number.EPSILON * 16;\n}\nfunction withPattern(schema, input) {\n\tconst pattern = input.getAttribute(\"pattern\");\n\tif (pattern === null) return schema;\n\ttry {\n\t\tnew RegExp(pattern, \"v\");\n\t} catch {\n\t\treturn schema;\n\t}\n\treturn {\n\t\t...schema,\n\t\tpattern\n\t};\n}\nfunction numberSchema(input) {\n\tconst schema = { type: \"number\" };\n\tconst minimum = validNumberAttribute(input, \"min\");\n\tconst maximum = validNumberAttribute(input, \"max\");\n\tif (minimum !== void 0) schema.minimum = minimum;\n\tif (maximum !== void 0) schema.maximum = maximum;\n\tif (input.getAttribute(\"step\") !== \"any\") {\n\t\tconst step = validStep(input, 1);\n\t\tconst rawValue = Number(input.getAttribute(\"value\"));\n\t\tif (isStepBaseMultiple(minimum ?? (Number.isFinite(rawValue) ? rawValue : 0), step)) schema.multipleOf = step;\n\t}\n\treturn schema;\n}\nfunction temporalFormat(input, datePrefix) {\n\tconst step = validStep(input, 60);\n\tif (step < 1) return `${datePrefix}(:[0-5][0-9](\\\\.[0-9]{1,3})?)?$`;\n\tif (step < 60) return `${datePrefix}(:[0-5][0-9])?$`;\n\treturn `${datePrefix}$`;\n}\nfunction optionSchemas(options) {\n\treturn {\n\t\tanyOf: options.map((option) => ({\n\t\t\ttype: \"string\",\n\t\t\tconst: option.value,\n\t\t\ttitle: option.textContent ?? \"\"\n\t\t})),\n\t\tenum: options.map((option) => option.value)\n\t};\n}\nfunction groupChoiceSchemas(controls) {\n\treturn {\n\t\tanyOf: controls.map((control) => {\n\t\t\tconst title = labelText(control);\n\t\t\tconst schema = {\n\t\t\t\ttype: \"string\",\n\t\t\t\tconst: control.value\n\t\t\t};\n\t\t\tif (title) schema.title = title;\n\t\t\treturn schema;\n\t\t}),\n\t\tenum: controls.map((control) => control.value)\n\t};\n}\nfunction isInput(control, type) {\n\treturn control instanceof HTMLInputElement && control.type === type;\n}\nfunction inputSchema(input) {\n\tif (TEXT_INPUT_TYPES.has(input.type)) return withPattern({ type: \"string\" }, input);\n\tswitch (input.type) {\n\t\tcase \"hidden\": return input.getAttribute(\"toolparamdescription\") ? { type: \"string\" } : void 0;\n\t\tcase \"number\": return withPattern(numberSchema(input), input);\n\t\tcase \"range\": {\n\t\t\tconst schema = numberSchema(input);\n\t\t\tschema.minimum ??= 0;\n\t\t\tschema.maximum ??= 100;\n\t\t\treturn schema;\n\t\t}\n\t\tcase \"checkbox\": return { type: \"boolean\" };\n\t\tcase \"date\": return {\n\t\t\ttype: \"string\",\n\t\t\tformat: \"date\"\n\t\t};\n\t\tcase \"month\": return {\n\t\t\ttype: \"string\",\n\t\t\tformat: \"^[0-9]{4}-(0[1-9]|1[0-2])$\"\n\t\t};\n\t\tcase \"week\": return {\n\t\t\ttype: \"string\",\n\t\t\tformat: \"^[0-9]{4}-W(0[1-9]|[1-4][0-9]|5[0-3])$\"\n\t\t};\n\t\tcase \"time\": return {\n\t\t\ttype: \"string\",\n\t\t\tformat: temporalFormat(input, \"^([01][0-9]|2[0-3]):[0-5][0-9]\")\n\t\t};\n\t\tcase \"datetime-local\": return {\n\t\t\ttype: \"string\",\n\t\t\tformat: temporalFormat(input, \"^[0-9]{4}-(0[1-9]|1[0-2])-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]\")\n\t\t};\n\t\tcase \"color\": return {\n\t\t\ttype: \"string\",\n\t\t\tformat: \"^#[0-9a-zA-Z]{6}$\"\n\t\t};\n\t\tdefault: return;\n\t}\n}\nfunction parameterSchema(form, controls) {\n\tconst [first] = controls;\n\tif (!first) return void 0;\n\tlet schema;\n\tif (controls.every((control) => isInput(control, \"radio\"))) schema = {\n\t\ttype: \"string\",\n\t\t...groupChoiceSchemas(controls)\n\t};\n\telse if (controls.length > 1) {\n\t\tif (controls.every((control) => isInput(control, \"checkbox\"))) schema = {\n\t\t\ttype: \"array\",\n\t\t\titems: {\n\t\t\t\ttype: \"string\",\n\t\t\t\t...groupChoiceSchemas(controls)\n\t\t\t},\n\t\t\tuniqueItems: true\n\t\t};\n\t} else if (first instanceof HTMLTextAreaElement) schema = { type: \"string\" };\n\telse if (first instanceof HTMLSelectElement) {\n\t\tconst choices = optionSchemas([...first.options]);\n\t\tschema = first.multiple ? {\n\t\t\ttype: \"array\",\n\t\t\titems: {\n\t\t\t\ttype: \"string\",\n\t\t\t\t...choices\n\t\t\t},\n\t\t\tuniqueItems: true\n\t\t} : {\n\t\t\ttype: \"string\",\n\t\t\t...choices\n\t\t};\n\t} else schema = inputSchema(first);\n\tconst dateHint = first.type === \"date\" ? \"Dates MUST be provided in 'YYYY-MM-DD' format.\" : void 0;\n\treturn schema && withDescription(schema, form, controls, dateHint);\n}\nfunction synthesizeSchema(form) {\n\tconst properties = {};\n\tconst required = [];\n\tfor (const [name, controls] of controlGroups(form)) {\n\t\tif (!name) continue;\n\t\tconst schema = parameterSchema(form, controls);\n\t\tif (!schema) continue;\n\t\tObject.defineProperty(properties, name, {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: true,\n\t\t\tvalue: schema,\n\t\t\twritable: true\n\t\t});\n\t\tif (controls.some((control) => control.required)) required.push(name);\n\t}\n\treturn {\n\t\ttype: \"object\",\n\t\tproperties,\n\t\trequired\n\t};\n}\nfunction toolDefinition(form) {\n\treturn {\n\t\tname: getFormAttribute(form, \"toolname\") ?? \"\",\n\t\ttitle: getFormAttribute(form, \"tooltitle\") ?? \"\",\n\t\tdescription: getFormAttribute(form, \"tooldescription\") ?? \"\",\n\t\tinputSchema: synthesizeSchema(form),\n\t\tautosubmit: formHasAttribute(form, \"toolautosubmit\")\n\t};\n}\nfunction toFormString(value) {\n\tif (typeof value === \"string\" || typeof value === \"boolean\") return String(value);\n\tif (typeof value === \"number\" && Number.isFinite(value)) return String(value);\n}\nfunction toFormBoolean(value) {\n\tif (typeof value === \"boolean\") return value;\n\tif (typeof value === \"number\" && Number.isInteger(value)) return value !== 0;\n\tif (typeof value !== \"string\") return void 0;\n\tif (value === \"1\" || value.toLowerCase() === \"true\") return true;\n\tif (value === \"0\" || value.toLowerCase() === \"false\") return false;\n}\nfunction hasUniqueAllowedValues(value, allowed) {\n\tif (!Array.isArray(value)) return false;\n\tconst remaining = new Set(allowed);\n\tfor (const item of value) {\n\t\tconst string = toFormString(item);\n\t\tif (string === void 0 || !remaining.delete(string)) return false;\n\t}\n\treturn true;\n}\nfunction inputAcceptsValue(input, value) {\n\tif (value === \"\") return input.type !== \"number\" && input.type !== \"range\";\n\tconst probe = input.ownerDocument.createElement(\"input\");\n\tprobe.type = input.type;\n\tprobe.value = value;\n\treturn probe.value !== \"\";\n}\nfunction isFormParameterValue(form, controls, value) {\n\tconst [first] = controls;\n\tif (!first || !parameterSchema(form, controls)) return false;\n\tconst string = toFormString(value);\n\tif (controls.every((control) => isInput(control, \"radio\"))) return controls.some((control) => control.value === string);\n\tif (controls.length > 1) return hasUniqueAllowedValues(value, new Set(controls.map((control) => control.value)));\n\tif (first instanceof HTMLSelectElement) {\n\t\tconst allowed = new Set([...first.options].map((option) => option.value));\n\t\tif (first.multiple) return hasUniqueAllowedValues(value, allowed);\n\t\treturn string !== void 0 && allowed.has(string);\n\t}\n\tif (first instanceof HTMLTextAreaElement) return string !== void 0;\n\tif (first.type === \"checkbox\") return toFormBoolean(value) !== void 0;\n\treturn string !== void 0 && inputAcceptsValue(first, string);\n}\nfunction dispatchInputAndChange(control) {\n\tcontrol.dispatchEvent(new Event(\"input\", {\n\t\tbubbles: true,\n\t\tcomposed: true\n\t}));\n\tcontrol.dispatchEvent(new Event(\"change\", { bubbles: true }));\n}\nfunction setValue(control, value) {\n\tif (control.value === value) return;\n\tconst prototype = control instanceof HTMLInputElement ? HTMLInputElement.prototype : HTMLTextAreaElement.prototype;\n\tObject.getOwnPropertyDescriptor(prototype, \"value\")?.set?.call(control, value);\n\tdispatchInputAndChange(control);\n}\nfunction setChecked(control, checked) {\n\tif (control.checked === checked) return;\n\tObject.getOwnPropertyDescriptor(HTMLInputElement.prototype, \"checked\")?.set?.call(control, checked);\n\tdispatchInputAndChange(control);\n}\nfunction fillParameter(controls, value) {\n\tconst [first] = controls;\n\tconst string = toFormString(value);\n\tconst values = new Set(Array.isArray(value) ? value.map(toFormString) : []);\n\tif (controls.every((control) => isInput(control, \"radio\"))) {\n\t\tconst control = controls.find((candidate) => candidate.value === string);\n\t\tif (control) setChecked(control, true);\n\t} else if (controls.length > 1) {\n\t\tfor (const control of controls) if (control instanceof HTMLInputElement) setChecked(control, values.has(control.value));\n\t} else if (first instanceof HTMLSelectElement) {\n\t\tif (first.multiple) {\n\t\t\tlet changed = false;\n\t\t\tfor (const option of first.options) {\n\t\t\t\tconst next = values.has(option.value);\n\t\t\t\tif (option.selected === next) continue;\n\t\t\t\toption.selected = next;\n\t\t\t\tchanged = true;\n\t\t\t}\n\t\t\tif (changed) dispatchInputAndChange(first);\n\t\t} else if (string !== void 0 && first.value !== string) {\n\t\t\tfirst.value = string;\n\t\t\tdispatchInputAndChange(first);\n\t\t}\n\t} else if (first && isInput(first, \"checkbox\")) {\n\t\tconst checked = toFormBoolean(value);\n\t\tif (checked !== void 0) setChecked(first, checked);\n\t} else if (first && string !== void 0) setValue(first, string);\n}\nfunction fillForm(form, input) {\n\tif (Array.isArray(input)) throw executionError();\n\tconst groups = controlGroups(form);\n\tconst parameters = [];\n\tfor (const [name, value] of Object.entries(input)) {\n\t\tconst controls = groups.get(name);\n\t\tif (!controls || !isFormParameterValue(form, controls, value)) throw executionError();\n\t\tparameters.push({\n\t\t\tcontrols,\n\t\t\tvalue\n\t\t});\n\t}\n\tfor (const { controls, value } of parameters) fillParameter(controls, value);\n}\nfunction findSubmitter(form) {\n\treturn [...getFormControls(form)].find((element) => !element.matches(\":disabled\") && (element instanceof HTMLButtonElement && element.type === \"submit\" || element instanceof HTMLInputElement && [\"image\", \"submit\"].includes(element.type)));\n}\nfunction lifecycleEvent(type, toolName) {\n\tconst event = new Event(type);\n\tObject.defineProperty(event, \"toolName\", {\n\t\tenumerable: true,\n\t\tvalue: toolName\n\t});\n\treturn event;\n}\nfunction waitForSubmission(context, registration, definition, submitter, signal) {\n\tconst { form } = registration;\n\tregistration.cancelPending?.(executionError());\n\treturn new Promise((resolve, reject) => {\n\t\tlet settled = false;\n\t\tconst cleanup = () => {\n\t\t\tEventTarget.prototype.removeEventListener.call(form, \"invalid\", onInvalid, true);\n\t\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t\t\tactiveSubmissions.delete(form);\n\t\t\tif (registration.cancelPending === cancel) delete registration.cancelPending;\n\t\t};\n\t\tconst finish = (callback) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\tcallback();\n\t\t};\n\t\tconst cancel = (reason) => finish(() => reject(reason));\n\t\tconst settleResponse = (response) => {\n\t\t\tif (registration.cancelPending === cancel) delete registration.cancelPending;\n\t\t\tresponse.then((value) => finish(() => resolve(value ?? null)), (cause) => finish(() => reject(cause)));\n\t\t};\n\t\tconst onInvalid = (event) => {\n\t\t\tif (!event.isTrusted) return;\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tif (!checkFormValidity(form)) cancel(executionError());\n\t\t\t});\n\t\t};\n\t\tconst onAbort = () => {\n\t\t\tfinish(() => {\n\t\t\t\tcontext.dispatchEvent(lifecycleEvent(\"toolcancel\", definition.name));\n\t\t\t\treject(signal.reason);\n\t\t\t});\n\t\t};\n\t\tactiveSubmissions.set(form, {\n\t\t\tcomplete(event) {\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tconst response = agentResponses.get(event);\n\t\t\t\t\tif (response) settleResponse(response);\n\t\t\t\t\telse if (event.defaultPrevented) cancel(executionError());\n\t\t\t\t\telse finish(() => resolve(null));\n\t\t\t\t});\n\t\t\t},\n\t\t\tdirect() {\n\t\t\t\tfinish(() => resolve(null));\n\t\t\t},\n\t\t\trespond(event) {\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\tconst response = agentResponses.get(event);\n\t\t\t\t\tif (response) settleResponse(response);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t\tregistration.cancelPending = cancel;\n\t\tEventTarget.prototype.addEventListener.call(form, \"invalid\", onInvalid, true);\n\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t\tif (!definition.autosubmit) {\n\t\t\tsubmitter?.focus();\n\t\t\tcontext.dispatchEvent(lifecycleEvent(\"toolactivated\", definition.name));\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\trequestFormSubmit(form, submitter);\n\t\t\tcontext.dispatchEvent(lifecycleEvent(\"toolactivated\", definition.name));\n\t\t} catch (error) {\n\t\t\tcancel(error);\n\t\t}\n\t});\n}\n/** Adds declarative tools until the vendored upstream implements them. */\nfunction installWebMCPDeclarativeExtensions(context) {\n\tconst prototype = SubmitEvent.prototype;\n\tif (\"agentInvoked\" in prototype && \"respondWith\" in prototype) return;\n\tif (!(\"agentInvoked\" in prototype)) Object.defineProperty(prototype, \"agentInvoked\", {\n\t\tconfigurable: true,\n\t\tenumerable: true,\n\t\tget() {\n\t\t\treturn isAgentInvokedSubmitEvent(this);\n\t\t}\n\t});\n\tif (!(\"respondWith\" in prototype)) Object.defineProperty(prototype, \"respondWith\", {\n\t\tconfigurable: true,\n\t\tenumerable: true,\n\t\twritable: true,\n\t\tvalue(agentResponse) {\n\t\t\trespondWithAgentSubmitEvent(this, agentResponse);\n\t\t}\n\t});\n\tconst registrations = /* @__PURE__ */ new Map();\n\tconst blockedDefinitions = /* @__PURE__ */ new Map();\n\tconst observers = /* @__PURE__ */ new Map();\n\tconst onSubmit = (event) => {\n\t\tif (!(event instanceof SubmitEvent) || !event.isTrusted || !(event.target instanceof HTMLFormElement)) return;\n\t\tconst submission = activeSubmissions.get(event.target);\n\t\tif (!submission) return;\n\t\tagentInvokedEvents.add(event);\n\t\tsubmission.complete(event);\n\t};\n\tconst onReset = (event) => {\n\t\tif (!event.isTrusted || !(event.target instanceof HTMLFormElement)) return;\n\t\tconst form = event.target;\n\t\tsetTimeout(() => {\n\t\t\tif (event.defaultPrevented) return;\n\t\t\tregistrations.get(form)?.cancelPending?.(executionError());\n\t\t});\n\t};\n\tfunction stopObservingRoot(root) {\n\t\tobservers.get(root)?.disconnect();\n\t\tobservers.delete(root);\n\t\troot.removeEventListener(\"reset\", onReset, true);\n\t\troot.removeEventListener(\"submit\", onSubmit, true);\n\t}\n\tfunction observeRoot(root) {\n\t\tif (observers.has(root)) return;\n\t\tconst observer = new MutationObserver(sync);\n\t\tobservers.set(root, observer);\n\t\tobserver.observe(root, {\n\t\t\tattributes: true,\n\t\t\tcharacterData: true,\n\t\t\tchildList: true,\n\t\t\tsubtree: true\n\t\t});\n\t\troot.addEventListener(\"reset\", onReset, true);\n\t\troot.addEventListener(\"submit\", onSubmit, true);\n\t}\n\tfunction sync() {\n\t\tobserveRoot(document);\n\t\tfor (const root of observers.keys()) if (root instanceof ShadowRoot && !root.host.isConnected) stopObservingRoot(root);\n\t\tconst candidates = /* @__PURE__ */ new Set();\n\t\tconst selected = /* @__PURE__ */ new Map();\n\t\tconst selectedByName = /* @__PURE__ */ new Map();\n\t\tfor (const root of observers.keys()) for (const element of root.querySelectorAll(\"*\")) {\n\t\t\tconst shadowRoot = getOpenShadowRoot(element);\n\t\t\tif (shadowRoot) observeRoot(shadowRoot);\n\t\t\tif (!(element instanceof HTMLFormElement) || !formHasAttribute(element, \"toolname\") || !formHasAttribute(element, \"tooldescription\") || !isConnected(element)) continue;\n\t\t\tconst form = element;\n\t\t\tcandidates.add(form);\n\t\t\tconst definition = toolDefinition(form);\n\t\t\tconst fingerprint = JSON.stringify(definition);\n\t\t\tif (blockedDefinitions.get(form) === fingerprint) continue;\n\t\t\tblockedDefinitions.delete(form);\n\t\t\tconst existingForm = selectedByName.get(definition.name);\n\t\t\tif (existingForm) {\n\t\t\t\tconst holdsName = (candidate) => registrations.get(candidate)?.name === definition.name;\n\t\t\t\tif (!holdsName(form) || holdsName(existingForm)) {\n\t\t\t\t\tblockedDefinitions.set(form, fingerprint);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst existingSelection = selected.get(existingForm);\n\t\t\t\tif (existingSelection) blockedDefinitions.set(existingForm, existingSelection.fingerprint);\n\t\t\t\tselected.delete(existingForm);\n\t\t\t}\n\t\t\tselectedByName.set(definition.name, form);\n\t\t\tselected.set(form, {\n\t\t\t\tdefinition,\n\t\t\t\tfingerprint\n\t\t\t});\n\t\t}\n\t\tfor (const form of blockedDefinitions.keys()) if (!candidates.has(form)) blockedDefinitions.delete(form);\n\t\tfor (const [form, registration] of registrations) if (selected.get(form)?.fingerprint !== registration.fingerprint) {\n\t\t\tregistration.cancelPending?.(executionError());\n\t\t\tregistration.controller.abort();\n\t\t\tregistrations.delete(form);\n\t\t}\n\t\tfor (const [form, { definition, fingerprint }] of selected) {\n\t\t\tif (registrations.has(form)) continue;\n\t\t\tconst controller = new AbortController();\n\t\t\tconst registration = {\n\t\t\t\tcontroller,\n\t\t\t\tfingerprint,\n\t\t\t\tform,\n\t\t\t\tname: definition.name\n\t\t\t};\n\t\t\tregistrations.set(form, registration);\n\t\t\tcontext.registerTool({\n\t\t\t\tname: definition.name,\n\t\t\t\ttitle: definition.title,\n\t\t\t\tdescription: definition.description,\n\t\t\t\tinputSchema: definition.inputSchema,\n\t\t\t\texecute(input, options) {\n\t\t\t\t\tconst submitter = findSubmitter(form);\n\t\t\t\t\tif (!definition.autosubmit && !submitter) throw executionError();\n\t\t\t\t\tfillForm(form, input);\n\t\t\t\t\treturn waitForSubmission(context, registration, definition, submitter, options.signal);\n\t\t\t\t}\n\t\t\t}, { signal: controller.signal }).catch((cause) => {\n\t\t\t\tcontroller.abort();\n\t\t\t\tif (cause instanceof DOMException && cause.name === \"AbortError\") return;\n\t\t\t\tconsole.error(`[webmcp] declarative form tool \"${definition.name}\" was not registered:`, cause);\n\t\t\t});\n\t\t}\n\t}\n\tconst attachShadowDescriptor = Object.getOwnPropertyDescriptor(Element.prototype, \"attachShadow\");\n\tif (attachShadowDescriptor?.configurable) {\n\t\tconst nativeAttachShadow = Element.prototype.attachShadow;\n\t\tconst attachShadow = function(init) {\n\t\t\tconst root = nativeAttachShadow.call(this, init);\n\t\t\tif (root.mode === \"open\" && Object.getOwnPropertyDescriptor(Node.prototype, \"ownerDocument\")?.get?.call(this) === document && isConnected(this)) observeRoot(root);\n\t\t\treturn root;\n\t\t};\n\t\tObject.defineProperty(Element.prototype, \"attachShadow\", {\n\t\t\t...attachShadowDescriptor,\n\t\t\tvalue: attachShadow\n\t\t});\n\t}\n\tconst submitDescriptor = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, \"submit\");\n\tif (submitDescriptor?.configurable) {\n\t\tconst nativeSubmit = HTMLFormElement.prototype.submit;\n\t\tconst submit = function() {\n\t\t\tnativeSubmit.call(this);\n\t\t\tactiveSubmissions.get(this)?.direct();\n\t\t};\n\t\tObject.defineProperty(HTMLFormElement.prototype, \"submit\", {\n\t\t\t...submitDescriptor,\n\t\t\tvalue: submit\n\t\t});\n\t}\n\tsync();\n}\n\n//#endregion\n//#region src/upstream/index.ts\n/*!\n* Copyright (c) 2026 WebMCP polyfill contributors\n* SPDX-License-Identifier: MIT\n*/\nconst NativeDOMException = globalThis.DOMException;\nconst getWindow = Object.getOwnPropertyDescriptor(globalThis, \"window\")?.get;\nconst contexts = /* @__PURE__ */ new WeakMap();\n/**\n* Install WebMCP in the current window.\n*\n* Does nothing outside a secure browser context or when `document.modelContext`\n* already exists, including partial native implementations. Call before registering\n* tools in each frame; repeated calls preserve existing contexts and registrations.\n*\n* Installing joins cross-frame discovery: the window listens for the polyfill's messages and\n* announces itself to the other frames of its tree.\n*\n* @throws {TypeError} If the window or Document prototype prevents installation.\n* @example\n* import { installWebMCP } from \"webmcp-polyfill\";\n* installWebMCP();\n*\n* @see https://webmachinelearning.github.io/webmcp/#document-extension\n* @see https://github.com/webmachinelearning/webmcp-polyfill/blob/main/TESTING.md\n*/\nfunction installWebMCP$1() {\n\tif (typeof document === \"undefined\" || !globalThis.isSecureContext) return;\n\tif (\"modelContext\" in document) return;\n\tconst documentPrototype = Document.prototype;\n\tconst getDefaultView = Object.getOwnPropertyDescriptor(documentPrototype, \"defaultView\").get;\n\tconst constructorDescriptor = Object.getOwnPropertyDescriptor(globalThis, \"ModelContext\");\n\tif (!Object.isExtensible(documentPrototype) || constructorDescriptor && !constructorDescriptor.configurable || !constructorDescriptor && !Object.isExtensible(globalThis)) throw new TypeError(\"Cannot install WebMCP on this realm\");\n\tObject.defineProperty(globalThis, \"ModelContext\", {\n\t\tvalue: modelContextConstructor,\n\t\tconfigurable: true,\n\t\twritable: true\n\t});\n\tconst { getModelContext } = { getModelContext() {\n\t\tgetDefaultView.call(this);\n\t\tlet context = contexts.get(this);\n\t\tif (!context) {\n\t\t\tcontext = new ModelContextPolyfill(this);\n\t\t\tcontexts.set(this, context);\n\t\t}\n\t\treturn context;\n\t} };\n\tObject.defineProperty(getModelContext, \"name\", { value: \"get modelContext\" });\n\tObject.defineProperty(documentPrototype, \"modelContext\", {\n\t\tconfigurable: true,\n\t\tenumerable: true,\n\t\tget: getModelContext\n\t});\n\tdocument.modelContext;\n}\nvar ModelContextPolyfill = class extends EventTarget {\n\t#document;\n\t#tools = /* @__PURE__ */ new Map();\n\t#frames;\n\t#toolchangeHandler = null;\n\t#toolchangeListener = (event) => {\n\t\tconst handler = this.#toolchangeHandler;\n\t\tif (typeof handler !== \"function\") return;\n\t\tif (Reflect.apply(handler, this, [event]) === false) Event.prototype.preventDefault.call(event);\n\t};\n\tconstructor(owner) {\n\t\tsuper();\n\t\tthis.#document = owner;\n\t\tconst view = activeWindow(owner);\n\t\tif (!view) return;\n\t\tthis.#frames = new FrameBridge(view, {\n\t\t\tgetTools: (callerOrigin) => this.#exposedTools(callerOrigin),\n\t\t\texecute: (callerOrigin, name, serializedInput, signal) => {\n\t\t\t\tconst ownerOrigin = requireActiveWindow(owner).origin;\n\t\t\t\treturn this.#executeLocal(name, serializedInput, ownerOrigin, callerOrigin, signal);\n\t\t\t},\n\t\t\tchanged: () => this.#queueToolChange()\n\t\t});\n\t}\n\tget ontoolchange() {\n\t\treturn this.#toolchangeHandler;\n\t}\n\tset ontoolchange(handler) {\n\t\tconst nextHandler = isObject(handler) ? handler : null;\n\t\tif (!this.#toolchangeHandler && nextHandler) this.addEventListener(\"toolchange\", this.#toolchangeListener);\n\t\tif (this.#toolchangeHandler && !nextHandler) this.removeEventListener(\"toolchange\", this.#toolchangeListener);\n\t\tthis.#toolchangeHandler = nextHandler;\n\t}\n\tasync registerTool(tool, options = {}) {\n\t\tconst ownerDocument = this.#document;\n\t\tconst { name, title, description, annotations, inputSchema, execute } = readToolDefinition(tool);\n\t\tconst settings = readDictionary(options);\n\t\tconst exposedTo = readOriginSequence(settings.exposedTo);\n\t\tconst registrationSignal = readAbortSignal(settings.signal);\n\t\trequireActiveWindow(ownerDocument);\n\t\tconst requireUnusedName = () => {\n\t\t\tif (this.#tools.has(name)) throw new NativeDOMException(`A tool named ${name} is already registered`, \"InvalidStateError\");\n\t\t};\n\t\trequireUnusedName();\n\t\tif (!/^[A-Za-z0-9_.-]{1,128}$/u.test(name)) throw new NativeDOMException(`Tool names are 1 to 128 characters of ASCII alphanumerics, \"_\", \"-\" or \".\": ${name}`, \"InvalidStateError\");\n\t\tif (!description) throw new NativeDOMException(\"A tool description cannot be empty\", \"InvalidStateError\");\n\t\tconst serializedSchema = inputSchema === void 0 ? void 0 : serializeJSON(inputSchema);\n\t\tregistrationSignal?.throwIfAborted();\n\t\tconst exposedOrigins = parseOrigins(exposedTo);\n\t\tconst storedTool = {\n\t\t\tmetadata: {\n\t\t\t\tname,\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tannotations,\n\t\t\t\tserializedSchema\n\t\t\t},\n\t\t\texecute,\n\t\t\texposedTo: exposedOrigins\n\t\t};\n\t\tconst frames = await this.#requireFrames();\n\t\tregistrationSignal?.throwIfAborted();\n\t\trequireUnusedName();\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tregistrationSignal?.addEventListener(\"abort\", () => {\n\t\t\t\tthis.#tools.delete(name);\n\t\t\t\tframes.notify(exposedOrigins);\n\t\t\t\treject(registrationSignal.reason);\n\t\t\t}, { once: true });\n\t\t\tthis.#tools.set(name, storedTool);\n\t\t\tframes.notify(exposedOrigins).then(resolve, reject);\n\t\t});\n\t}\n\tasync getTools(options = {}) {\n\t\tconst ownerDocument = this.#document;\n\t\tconst fromOrigins = readOriginSequence(readDictionary(options).fromOrigins);\n\t\trequireActiveWindow(ownerDocument);\n\t\tconst frames = await this.#requireFrames();\n\t\tconst requestedOrigins = parseOrigins(fromOrigins);\n\t\tconst tools = await frames.getTools(requestedOrigins);\n\t\ttools.sort((left, right) => {\n\t\t\tif (left.name === right.name) return 0;\n\t\t\treturn left.name < right.name ? -1 : 1;\n\t\t});\n\t\treturn new Promise((resolve) => {\n\t\t\tqueueTask(() => resolve(tools));\n\t\t});\n\t}\n\tasync executeTool(tool, inputObject = {}, options = {}) {\n\t\tconst ownerDocument = this.#document;\n\t\tconst target = readExecutionTarget(tool);\n\t\tconst callerSignal = readAbortSignal(readDictionary(options).signal);\n\t\trequireActiveWindow(ownerDocument);\n\t\tconst expectedOrigin = URL.parse(target.origin)?.origin;\n\t\tif (!expectedOrigin || expectedOrigin === \"null\") throw new NativeDOMException(\"Invalid or opaque origin\", \"NotSupportedError\");\n\t\tif (!isObject(inputObject)) throw new TypeError(\"inputObject must be an object\");\n\t\tconst serializedInput = serializeJSON(inputObject);\n\t\tcallerSignal?.throwIfAborted();\n\t\tconst frames = await this.#requireFrames();\n\t\tcallerSignal?.throwIfAborted();\n\t\tconst callerWindow = requireActiveWindow(ownerDocument);\n\t\tif (target.window !== callerWindow) return frames.execute(target.window, expectedOrigin, target.name, serializedInput, callerSignal);\n\t\treturn this.#executeLocal(target.name, serializedInput, expectedOrigin, callerWindow.origin, callerSignal);\n\t}\n\t#executeLocal(name, serializedInput, expectedOrigin, callerOrigin, callerSignal) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tcallerSignal?.throwIfAborted();\n\t\t\tconst callbackController = new AbortController();\n\t\t\tlet callbackFinished = false;\n\t\t\tconst onCallerAbort = () => {\n\t\t\t\treject(callerSignal.reason);\n\t\t\t\tqueueTask(() => {\n\t\t\t\t\tif (!callbackFinished) callbackController.abort();\n\t\t\t\t});\n\t\t\t};\n\t\t\tconst rejectExecution = () => {\n\t\t\t\tcallbackFinished = true;\n\t\t\t\tqueueTask(() => {\n\t\t\t\t\tcallerSignal?.removeEventListener(\"abort\", onCallerAbort);\n\t\t\t\t\treject(executionError());\n\t\t\t\t});\n\t\t\t};\n\t\t\tconst completeExecution = (value) => {\n\t\t\t\tcallbackFinished = true;\n\t\t\t\tif (callerSignal?.aborted) return;\n\t\t\t\ttry {\n\t\t\t\t\tconst serializedResult = serializeJSON(value);\n\t\t\t\t\tqueueTask(() => {\n\t\t\t\t\t\tcallerSignal?.removeEventListener(\"abort\", onCallerAbort);\n\t\t\t\t\t\tresolve(serializedResult);\n\t\t\t\t\t});\n\t\t\t\t} catch {\n\t\t\t\t\trejectExecution();\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst dispatchTool = () => {\n\t\t\t\tif (callerSignal?.aborted) return;\n\t\t\t\ttry {\n\t\t\t\t\tconst ownerWindow = requireActiveWindow(this.#document);\n\t\t\t\t\tconst storedTool = this.#tools.get(name);\n\t\t\t\t\tif (!storedTool || expectedOrigin !== ownerWindow.origin || !isExposedTo(storedTool, ownerWindow.origin, callerOrigin)) {\n\t\t\t\t\t\trejectExecution();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tconst input = JSON.parse(serializedInput);\n\t\t\t\t\tif (!isObject(input)) {\n\t\t\t\t\t\trejectExecution();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tconst execute = storedTool.execute;\n\t\t\t\t\tconst callbackResult = execute(input, { signal: callbackController.signal });\n\t\t\t\t\tPromise.resolve(callbackResult).then(completeExecution, rejectExecution);\n\t\t\t\t} catch {\n\t\t\t\t\trejectExecution();\n\t\t\t\t}\n\t\t\t};\n\t\t\tcallerSignal?.addEventListener(\"abort\", onCallerAbort, { once: true });\n\t\t\tqueueTask(dispatchTool);\n\t\t});\n\t}\n\tasync #requireFrames() {\n\t\tconst frames = this.#frames;\n\t\tif (!frames || !await frames.allowed()) throw new NativeDOMException(\"WebMCP is disabled by Permissions Policy\", \"NotAllowedError\");\n\t\trequireActiveWindow(this.#document);\n\t\treturn frames;\n\t}\n\t#exposedTools(callerOrigin) {\n\t\tconst ownerOrigin = requireActiveWindow(this.#document).origin;\n\t\tconst exposed = [];\n\t\tfor (const storedTool of this.#tools.values()) {\n\t\t\tif (!isExposedTo(storedTool, ownerOrigin, callerOrigin)) continue;\n\t\t\texposed.push(storedTool.metadata);\n\t\t}\n\t\treturn exposed;\n\t}\n\t#queueToolChange() {\n\t\treturn new Promise((resolve) => {\n\t\t\tqueueTask(() => {\n\t\t\t\tthis.dispatchEvent(new Event(\"toolchange\"));\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\t}\n};\nfunction isExposedTo(tool, ownerOrigin, callerOrigin) {\n\treturn ownerOrigin === callerOrigin || tool.exposedTo.includes(callerOrigin);\n}\nconst modelContextConstructor = function ModelContext() {\n\tthrow new TypeError(\"Illegal constructor\");\n};\nObject.defineProperty(modelContextConstructor, \"name\", { value: \"ModelContext\" });\nObject.defineProperty(modelContextConstructor, \"prototype\", {\n\tvalue: ModelContextPolyfill.prototype,\n\twritable: false\n});\nObject.setPrototypeOf(modelContextConstructor, EventTarget);\nObject.defineProperties(ModelContextPolyfill.prototype, {\n\tconstructor: {\n\t\tvalue: modelContextConstructor,\n\t\tconfigurable: true,\n\t\twritable: true\n\t},\n\t[Symbol.toStringTag]: {\n\t\tvalue: \"ModelContext\",\n\t\tconfigurable: true\n\t},\n\tregisterTool: { enumerable: true },\n\tgetTools: { enumerable: true },\n\texecuteTool: { enumerable: true },\n\tontoolchange: { enumerable: true }\n});\nfunction readToolDefinition(value) {\n\tconst descriptor = readDictionary(value);\n\tconst annotations = readAnnotations(descriptor.annotations);\n\tconst description = toDOMString(requireMember(descriptor.description, \"description\"));\n\tconst callback = requireMember(descriptor.execute, \"execute\");\n\tif (typeof callback !== \"function\") throw new TypeError(\"execute must be a function\");\n\tconst execute = callback;\n\tconst inputSchema = readInputSchema(descriptor.inputSchema);\n\tconst name = toDOMString(requireMember(descriptor.name, \"name\"));\n\tconst rawTitle = descriptor.title;\n\treturn {\n\t\tname,\n\t\ttitle: rawTitle === void 0 ? \"\" : toUSVString(rawTitle),\n\t\tdescription,\n\t\tannotations,\n\t\tinputSchema,\n\t\texecute\n\t};\n}\nfunction readExecutionTarget(value) {\n\tconst descriptor = readDictionary(value);\n\treadAnnotations(descriptor.annotations);\n\ttoDOMString(requireMember(descriptor.description, \"description\"));\n\treadInputSchema(descriptor.inputSchema);\n\tconst name = toDOMString(requireMember(descriptor.name, \"name\"));\n\tconst origin = toUSVString(requireMember(descriptor.origin, \"origin\"));\n\tconst title = descriptor.title;\n\tif (title !== void 0) toDOMString(title);\n\tconst targetWindow = requireMember(descriptor.window, \"window\");\n\tif (!isObject(targetWindow)) throw new TypeError(\"window must be a Window\");\n\tgetWindow.call(targetWindow);\n\treturn {\n\t\tname,\n\t\torigin,\n\t\twindow: targetWindow\n\t};\n}\nfunction readInputSchema(value) {\n\tif (value !== void 0 && !isObject(value)) throw new TypeError(\"inputSchema must be an object\");\n\treturn value;\n}\nfunction isObject(value) {\n\treturn typeof value === \"object\" && value !== null || typeof value === \"function\";\n}\nfunction readDictionary(value) {\n\tif (value == null) return {};\n\tif (!isObject(value)) throw new TypeError(\"Expected a dictionary\");\n\treturn value;\n}\nfunction readAnnotations(value) {\n\tif (value === void 0) return;\n\tconst dictionary = readDictionary(value);\n\tconst annotations = {};\n\tfor (const name of annotationNames) annotations[name] = Boolean(dictionary[name]);\n\treturn annotations;\n}\nfunction toDOMString(value) {\n\tif (typeof value === \"symbol\") throw new TypeError(\"Cannot convert a Symbol to a string\");\n\treturn String(value);\n}\nfunction toUSVString(value) {\n\treturn toDOMString(value).toWellFormed();\n}\nfunction requireMember(value, name) {\n\tif (value === void 0) throw new TypeError(`${name} is required`);\n\treturn value;\n}\nfunction serializeJSON(value) {\n\tconst result = JSON.stringify(value);\n\tif (result === void 0) throw new TypeError(\"Value is not JSON-serializable\");\n\treturn result;\n}\nfunction readAbortSignal(value) {\n\tif (value === void 0) return;\n\treturn AbortSignal.any([value]);\n}\nfunction readOriginSequence(value) {\n\tif (value === void 0) return [];\n\tif (!isObject(value)) throw new TypeError(\"Origins must be a sequence\");\n\tconst getIterator = readDictionary(value)[Symbol.iterator];\n\tif (typeof getIterator !== \"function\") throw new TypeError(\"Origins must be a sequence\");\n\tconst iterable = { [Symbol.iterator]() {\n\t\tconst iterator = Reflect.apply(getIterator, value, []);\n\t\tif (!isObject(iterator)) throw new TypeError(\"Iterator must be an object\");\n\t\tconst next = readDictionary(iterator).next;\n\t\tif (typeof next !== \"function\") throw new TypeError(\"Iterator next must be a function\");\n\t\treturn { next() {\n\t\t\treturn Reflect.apply(next, iterator, []);\n\t\t} };\n\t} };\n\treturn Array.from(iterable, toUSVString);\n}\nfunction parseOrigins(origins) {\n\treturn origins.map((value) => {\n\t\tconst origin = URL.parse(value)?.origin;\n\t\tif (origin === void 0) throw new NativeDOMException(\"Invalid origin\", \"SecurityError\");\n\t\tconst url = URL.parse(origin);\n\t\tif (!url || !isPotentiallyTrustworthy(url)) throw new NativeDOMException(\"Origin is not potentially trustworthy\", \"SecurityError\");\n\t\treturn origin;\n\t});\n}\nfunction isPotentiallyTrustworthy({ protocol, hostname }) {\n\tif ([\"https:\", \"wss:\"].includes(protocol)) return true;\n\tconst isLoopback = hostname === \"[::1]\" || /^127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/.test(hostname);\n\tconst isLocalhost = hostname === \"localhost\" || hostname === \"localhost.\" || hostname.endsWith(\".localhost\") || hostname.endsWith(\".localhost.\");\n\treturn [\"http:\", \"ws:\"].includes(protocol) && (isLoopback || isLocalhost);\n}\nfunction requireActiveWindow(owner) {\n\tconst view = activeWindow(owner);\n\tif (!view) throw new NativeDOMException(\"The document is not fully active\", \"InvalidStateError\");\n\tif (readToolsPolicy(owner) === false) throw new NativeDOMException(\"WebMCP is disabled by Permissions Policy\", \"NotAllowedError\");\n\treturn view;\n}\nlet taskPort;\nconst queuedTasks = [];\nfunction queueTask(callback) {\n\tif (!taskPort) {\n\t\tconst channel = new MessageChannel();\n\t\tchannel.port1.onmessage = () => queuedTasks.shift()?.();\n\t\ttaskPort = channel.port2;\n\t}\n\tqueuedTasks.push(callback);\n\ttaskPort.postMessage(void 0);\n}\n\n//#endregion\n//#region src/index.ts\n/**\n* Installs upstream WebMCP and the temporary declarative tools layer.\n* Engines missing an API the vendored core calls are left untouched: upstream defines\n* the document getter before it constructs the context, so a failed construction would\n* leave `document.modelContext` throwing.\n*/\nfunction installWebMCP() {\n\tif (typeof document === \"undefined\" || !globalThis.isSecureContext) return;\n\tif (typeof Promise.withResolvers !== \"function\" || typeof AbortSignal.any !== \"function\" || typeof String.prototype.toWellFormed !== \"function\" || typeof URL.parse !== \"function\") return;\n\tinstallWebMCP$1();\n\tconst context = document.modelContext;\n\tif (context) installWebMCPDeclarativeExtensions(context);\n}\n\n//#endregion\nexport { installWebMCP };\n//# sourceMappingURL=index.js.map","import { installWebMCP } from \"@mcp-b/webmcp-polyfill\";\nexport type { WebMCP } from \"webmcp-types\";\n\nimport { DEFAULT_GROUP_ID } from \"../../config/config.js\";\nimport { TOOL_DEFINITIONS, type ToolDefinition } from \"../tools/tools.js\";\n\nexport type WebMcpMode = \"polyfill\" | \"native\";\n\nconst registeredToolControllers: Map<string, AbortController> = new Map();\nconst registeredToolNames: Set<string> = new Set();\n\nlet currentMode: WebMcpMode = \"polyfill\";\n\n/**\n * Set the WebMCP mode (polyfill vs native).\n *\n * - `\"polyfill\"` (default): Uses `@mcp-b/webmcp-polyfill` for a pure-JS\n * `document.modelContext` that works in all browsers.\n * - `\"native\"`: Uses Chrome's native `document.modelContext` from\n * `chrome://flags/#enable-webmcp-testing`. Requires the flag to be\n * enabled. May crash in early Canary builds.\n *\n * Detection follows Chrome's recommended compat pattern:\n * `document.modelContext || navigator.modelContext`\n * `navigator.modelContext` was deprecated in Chrome 150 and removed in\n * Chrome 152.0.7943.0, but the fallback keeps older clients working.\n */\nexport function setWebMcpMode(mode: WebMcpMode): void {\n currentMode = mode;\n}\n\nexport function getWebMcpMode(): WebMcpMode {\n return currentMode;\n}\n\n/**\n * Install the `@mcp-b/webmcp-polyfill` onto `document.modelContext`.\n *\n * In `@mcp-b/webmcp-polyfill` 6.0.0+, the entry point is `installWebMCP()`\n * (previously `initializeWebMCPPolyfill()` in v5).\n * The polyfill itself bails out when Chrome's native `document.modelContext`\n * is already present — it does NOT override the native API. We call it\n * unconditionally; if the polyfill is already installed it returns quickly.\n */\nfunction ensurePolyfill(): void {\n try {\n // Some test / mock environments or non-HTTPS dev setups may not define isSecureContext.\n // If running in a browser-like environment without isSecureContext set, ensure safe default.\n if (\n typeof globalThis !== \"undefined\" &&\n typeof globalThis.isSecureContext === \"undefined\" &&\n typeof location !== \"undefined\" &&\n (location.protocol === \"https:\" ||\n location.hostname === \"localhost\" ||\n location.hostname === \"127.0.0.1\")\n ) {\n try {\n Object.defineProperty(globalThis, \"isSecureContext\", {\n value: true,\n configurable: true,\n });\n } catch {\n // Ignore if read-only\n }\n }\n\n if (typeof installWebMCP === \"function\") {\n installWebMCP();\n }\n } catch (err) {\n console.warn(\"WebMCP polyfill initialization failed:\", err);\n }\n}\n\n/**\n * Returns true when the `@mcp-b/webmcp-polyfill` v5.1.0+ security gate will\n * allow `registerTool()` to proceed.\n *\n * The polyfill's `validateOriginAgentCluster()` throws `DOMException(\"\",\n * \"SecurityError\")` when `globalThis.originAgentCluster === false` (and the\n * protocol is not `file:`). Chrome automatically origin-isolates HTTPS pages so\n * this is never an issue there. Firefox ≥ 138 exposes `originAgentCluster` but\n * returns `false` unless the server sends `Origin-Agent-Cluster: ?1` — a\n * header that GitHub Pages does not set. This check lets us detect Firefox\n * (and any other browser with the same behaviour) early and skip registration\n * with a single descriptive warning instead of N per-tool `DOMException`s.\n *\n * Native mode bypasses the polyfill entirely and is unaffected.\n */\nfunction isOriginAgentClusterCompatible(): boolean {\n // If the property is absent the browser is old enough not to enforce the\n // check — allow registration to proceed.\n if (typeof globalThis.originAgentCluster === \"undefined\") {\n return true;\n }\n\n // file: protocol is explicitly exempt in the polyfill guard.\n const protocol = globalThis.location?.protocol;\n if (protocol === \"file:\") {\n return true;\n }\n\n return globalThis.originAgentCluster !== false;\n}\n\n/**\n * Access the WebMCP ModelContext API.\n *\n * In polyfill mode: installs the `@mcp-b/webmcp-polyfill` which surfaces\n * `document.modelContext`.\n * In native mode: follows Chrome's recommended feature-detection pattern:\n * `document.modelContext || navigator.modelContext`\n * `navigator.modelContext` was deprecated in Chrome 150 and removed in\n * Chrome 152.0.7943.0, but the fallback preserves compatibility with\n * earlier builds that may still be in the wild.\n */\nfunction getModelContextApi(): any {\n if (typeof document === \"undefined\" && typeof navigator === \"undefined\") {\n return null;\n }\n\n if (currentMode === \"polyfill\") {\n ensurePolyfill();\n }\n\n try {\n const modelContext: unknown =\n typeof document !== \"undefined\" &&\n typeof (document as any).modelContext !== \"undefined\"\n ? Reflect.get(document, \"modelContext\")\n : typeof navigator !== \"undefined\" &&\n typeof (navigator as any).modelContext !== \"undefined\"\n ? Reflect.get(navigator, \"modelContext\")\n : undefined;\n\n if (!modelContext || typeof modelContext !== \"object\") {\n return null;\n }\n\n const api = modelContext as {\n registerTool?: unknown;\n unregisterTool?: unknown;\n getTools?: unknown;\n executeTool?: unknown;\n };\n\n if (typeof api.registerTool !== \"function\") {\n return null;\n }\n\n return api;\n } catch (err) {\n console.warn(\"WebMCP modelContext access failed:\", err);\n\n return null;\n }\n}\n\n/**\n * Safely parse or normalize WebMCP input schema.\n *\n * Starting in Chrome 154.0.8014.0 (PR #241), `RegisteredTool#inputSchema` returns\n * a JavaScript object (a deep copy of the schema provided at registration).\n * In Chrome < 154.0.8014.0, `RegisteredTool#inputSchema` returned a stringified JSON schema (DOMString).\n *\n * This function provides backwards-compatible schema parsing:\n * - If inputSchema is a string: attempts JSON.parse.\n * - If inputSchema is an object: returns the object.\n * - Fallbacks gracefully to an empty object schema if null, undefined, or invalid JSON.\n */\nexport function parseWebMcpInputSchema(\n inputSchema: unknown,\n): Record<string, unknown> {\n if (typeof inputSchema === \"string\") {\n try {\n const parsed = JSON.parse(inputSchema);\n if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n return parsed as Record<string, unknown>;\n }\n } catch {\n // Fallback on JSON parse error\n }\n\n return { type: \"object\", properties: {} };\n }\n\n if (\n inputSchema &&\n typeof inputSchema === \"object\" &&\n !Array.isArray(inputSchema)\n ) {\n return inputSchema as Record<string, unknown>;\n }\n\n return { type: \"object\", properties: {} };\n}\n\nexport interface WebMcpExecuteContext {\n signal?: AbortSignal;\n}\n\nexport interface WebMcpRegisteredTool {\n name: string;\n title?: string;\n description?: string;\n inputSchema?: unknown;\n annotations?: Record<string, unknown>;\n execute?: (\n input: Record<string, unknown>,\n context?: WebMcpExecuteContext | AbortSignal,\n ) => Promise<unknown>;\n}\n\nexport interface NormalizedWebMcpRegisteredTool {\n name: string;\n title?: string;\n description?: string;\n inputSchema: Record<string, unknown>;\n annotations?: Record<string, unknown>;\n execute?: (\n input: Record<string, unknown>,\n context?: WebMcpExecuteContext | AbortSignal,\n ) => Promise<unknown>;\n}\n\n/**\n * Safely extract AbortSignal from execute options/context.\n * Supports Chrome 153+ options object `{ signal }` (PR #247), direct AbortSignal instances,\n * or undefined for backward compatibility with Chrome < 153 and legacy callers.\n */\nexport function extractAbortSignal(\n context?: WebMcpExecuteContext | AbortSignal,\n): AbortSignal | undefined {\n if (!context) {\n return undefined;\n }\n\n if (typeof AbortSignal !== \"undefined\" && context instanceof AbortSignal) {\n return context;\n }\n\n if (\n typeof context === \"object\" &&\n \"signal\" in context &&\n typeof AbortSignal !== \"undefined\" &&\n context.signal instanceof AbortSignal\n ) {\n return context.signal;\n }\n\n return undefined;\n}\n\n/**\n * Retrieve tools registered on the WebMCP ModelContext API.\n *\n * Practicing graceful degradation:\n * - Feature-detects `getTools()` on `document.modelContext` / `navigator.modelContext`.\n * - If `getTools()` is absent (older browser builds or polyfills without getTools),\n * returns an empty array `[]` without throwing.\n * - Supports options dictionary with `fromOrigins` to discover cross-frame/cross-origin tools (Chrome 155+).\n * - Normalizes `RegisteredTool#inputSchema` so caller receives a JavaScript object\n * whether running on Chrome 154+ (native object) or Chrome < 154 (DOMString JSON).\n */\nexport async function getWebMcpTools(options?: {\n fromOrigins?: string[];\n}): Promise<NormalizedWebMcpRegisteredTool[]> {\n const modelContext = getModelContextApi() as {\n getTools?: (options?: {\n fromOrigins?: string[];\n }) => Promise<WebMcpRegisteredTool[]>;\n } | null;\n\n if (!modelContext || typeof modelContext.getTools !== \"function\") {\n return [];\n }\n\n try {\n const rawTools = await modelContext.getTools(options);\n if (!Array.isArray(rawTools)) {\n return [];\n }\n\n return rawTools.map((tool) => ({\n name: tool.name,\n ...(tool.title ? { title: tool.title } : {}),\n ...(tool.description ? { description: tool.description } : {}),\n inputSchema: parseWebMcpInputSchema(tool.inputSchema),\n ...(tool.annotations ? { annotations: tool.annotations } : {}),\n ...(tool.execute ? { execute: tool.execute } : {}),\n }));\n } catch (err) {\n console.warn(\"Failed to retrieve WebMCP tools via getTools():\", err);\n\n return [];\n }\n}\n\n/**\n * Gracefully execute a WebMCP tool on a ModelContext instance with backwards compatibility.\n *\n * Starting in Chrome 155.0.8052.0 (PR #246, PR #251), `document.modelContext.executeTool()`\n * accepts an optional JavaScript object directly instead of a JSON DOMString.\n * In Chrome < 155 and earlier polyfills, `executeTool()` required a stringified JSON arguments string.\n *\n * This function practices graceful degradation:\n * 1. Prepares both an `inputObject` (for Chrome 155+) and an `inputStr` (for Chrome < 155 & polyfills).\n * 2. Attempts to execute `executeTool(tool, inputObject, options)` first.\n * 3. Catches errors starting with \"Failed to parse input\" (or TypeErrors from WebIDL DOMString checks)\n * and retries transparently with `JSON.stringify(inputObject)`.\n * 4. Re-throws any unrelated execution errors.\n */\nexport async function executeWebMcpTool(\n modelContext: any,\n tool: any,\n input?: unknown,\n options?: WebMcpExecuteContext | AbortSignal,\n): Promise<unknown> {\n if (!modelContext || typeof modelContext.executeTool !== \"function\") {\n throw new Error(\"ModelContext executeTool is not available\");\n }\n\n let inputObject: Record<string, unknown>;\n let inputStr: string;\n\n if (typeof input === \"string\") {\n inputStr = input;\n try {\n const parsed = JSON.parse(input);\n inputObject =\n parsed && typeof parsed === \"object\" && !Array.isArray(parsed)\n ? (parsed as Record<string, unknown>)\n : {};\n } catch {\n inputObject = {};\n }\n } else if (input && typeof input === \"object\" && !Array.isArray(input)) {\n inputObject = input as Record<string, unknown>;\n try {\n inputStr = JSON.stringify(input);\n } catch {\n inputStr = \"{}\";\n }\n } else {\n inputObject = {};\n inputStr = \"{}\";\n }\n\n try {\n return await modelContext.executeTool(tool, inputObject, options);\n } catch (err: any) {\n const isParseError =\n typeof err?.message === \"string\" &&\n err.message.startsWith(\"Failed to parse input\");\n const isTypeError = err instanceof TypeError;\n\n if (isParseError || isTypeError) {\n return await modelContext.executeTool(tool, inputStr, options);\n }\n\n throw err;\n }\n}\n\n/**\n * Feature detection for the WebMCP imperative API.\n *\n * To test this integration in Google Chrome, use the Model Context Tool\n * Inspector extension:\n * https://chromewebstore.google.com/detail/model-context-tool-inspec/gbpdfapgefenggkahomfgkhfehlcenpd\n */\nexport function isWebMcpSupported(): boolean {\n return !!getModelContextApi();\n}\n\n/**\n * Event fired when a tool execution begins (PR #245 / Chrome 156+).\n * Dispatched on `document.modelContext` in Chrome 156+, or `window` in Chrome < 156.\n */\nexport interface WebMcpToolActivatedEvent extends Event {\n readonly toolName: string;\n}\n\n/**\n * Event fired when a tool execution is cancelled (PR #245 / Chrome 156+).\n * Dispatched on `document.modelContext` in Chrome 156+, or `window` in Chrome < 156.\n */\nexport interface WebMcpToolCancelEvent extends Event {\n readonly toolName: string;\n}\n\nexport type WebMcpEventTarget = EventTarget & {\n addEventListener: (type: string, listener: any, options?: any) => void;\n removeEventListener: (type: string, listener: any, options?: any) => void;\n};\n\nexport interface WebMcpEventListenerOptions extends AddEventListenerOptions {\n /**\n * If true, also attaches a fallback listener to window when modelContext is selected\n * (or vice versa), deduplicating events by toolName within the same tick if both fire.\n */\n listenBoth?: boolean;\n}\n\n/**\n * Resolves the appropriate EventTarget for WebMCP lifecycle events\n * (`toolactivated` and `toolcancel`) with backwards compatibility.\n *\n * Starting in Chrome 156.0.8076.0 (PR #245), `ontoolactivated` and `ontoolcancel`\n * event handler properties and lifecycle events moved from `window` to `document.modelContext`.\n * In Chrome < 156, these events were fired on `window`.\n *\n * This function practices robust feature detection and graceful degradation:\n * 1. Safely checks for existence of `document` and `window` to avoid ReferenceErrors\n * in non-DOM / headless / Node.js environments.\n * 2. Checks if `on${type}` is present in `document.modelContext` (or `navigator.modelContext`).\n * If present and it supports `addEventListener`, `modelContext` is returned.\n * 3. Checks if `on${type}` is present in `window`. If present and `window` supports\n * `addEventListener`, `window` is returned (legacy Chrome < 156 path).\n * 4. Fallback: If neither has `on${type}` (e.g. polyfill, synthetic mock, or uninitialized prototype),\n * prefers `modelContext` if it supports `addEventListener`, otherwise falls back to `window`.\n * 5. Returns `null` if no valid EventTarget is found.\n */\nexport function getWebMcpEventTarget(\n type?: \"toolactivated\" | \"toolcancel\" | string,\n): WebMcpEventTarget | null {\n const doc = typeof document !== \"undefined\" ? document : undefined;\n const win = typeof window !== \"undefined\" ? window : undefined;\n const nav = typeof navigator !== \"undefined\" ? navigator : undefined;\n\n const modelContext: any =\n (doc as any)?.modelContext ?? (nav as any)?.modelContext;\n\n const hasModelContextListener =\n modelContext && typeof modelContext.addEventListener === \"function\";\n const hasWindowListener =\n win && typeof (win as any).addEventListener === \"function\";\n\n if (type) {\n const handlerKey = `on${type}`;\n\n // 1. Chrome 156+ path (PR #245): ontoolactivated / ontoolcancel on document.modelContext\n if (modelContext && handlerKey in modelContext && hasModelContextListener) {\n return modelContext as WebMcpEventTarget;\n }\n\n // 2. Chrome < 156 legacy path: ontoolactivated / ontoolcancel on window\n if (win && handlerKey in win && hasWindowListener) {\n return win as WebMcpEventTarget;\n }\n }\n\n // 3. Fallback when neither target explicitly reflects on${type}\n if (hasModelContextListener) {\n return modelContext as WebMcpEventTarget;\n }\n\n if (hasWindowListener) {\n return win as WebMcpEventTarget;\n }\n\n return null;\n}\n\n/**\n * Safely registers a listener for WebMCP lifecycle events (`toolactivated`, `toolcancel`)\n * with graceful degradation, event payload normalization, and automatic unsubscription.\n *\n * Returns an idempotent unsubscribe cleanup function.\n */\nexport function addWebMcpEventListener<\n T extends \"toolactivated\" | \"toolcancel\" | string =\n \"toolactivated\" | \"toolcancel\",\n>(\n type: T,\n listener: (\n event: T extends \"toolactivated\"\n ? WebMcpToolActivatedEvent\n : T extends \"toolcancel\"\n ? WebMcpToolCancelEvent\n : Event & { toolName?: string },\n ) => void,\n options?: boolean | WebMcpEventListenerOptions,\n): () => void {\n const target = getWebMcpEventTarget(type);\n const opts = typeof options === \"object\" ? options : undefined;\n const listenBoth = opts?.listenBoth ?? false;\n\n const win =\n typeof window !== \"undefined\" &&\n typeof (window as any).addEventListener === \"function\"\n ? (window as unknown as WebMcpEventTarget)\n : null;\n const doc = typeof document !== \"undefined\" ? document : null;\n const nav = typeof navigator !== \"undefined\" ? navigator : null;\n const modelContext: any =\n (doc as any)?.modelContext ?? (nav as any)?.modelContext;\n const hasMc =\n modelContext && typeof modelContext.addEventListener === \"function\";\n\n const secondaryTarget: WebMcpEventTarget | null = listenBoth\n ? target === modelContext\n ? win !== target\n ? win\n : null\n : hasMc\n ? (modelContext as WebMcpEventTarget)\n : null\n : null;\n\n if (!target && !secondaryTarget) {\n return () => {};\n }\n\n let recentToolNames: Set<string> | null = null;\n let clearTimer: ReturnType<typeof setTimeout> | null = null;\n\n const wrapHandler = (evt: Event) => {\n let toolName = (evt as any).toolName;\n if (\n typeof toolName !== \"string\" &&\n \"detail\" in evt &&\n typeof (evt as any).detail === \"object\"\n ) {\n toolName = (evt as any).detail?.toolName;\n }\n if (typeof toolName !== \"string\") {\n toolName = \"\";\n }\n\n if (!(\"toolName\" in evt) || (evt as any).toolName !== toolName) {\n try {\n Object.defineProperty(evt, \"toolName\", {\n value: toolName,\n configurable: true,\n enumerable: true,\n });\n } catch {\n // Ignore errors if event is sealed\n }\n }\n\n if (listenBoth && toolName) {\n if (!recentToolNames) {\n recentToolNames = new Set();\n }\n if (recentToolNames.has(toolName)) {\n return;\n }\n recentToolNames.add(toolName);\n if (!clearTimer) {\n clearTimer = setTimeout(() => {\n recentToolNames?.clear();\n clearTimer = null;\n }, 100);\n }\n }\n\n listener(evt as any);\n };\n\n if (target) {\n target.addEventListener(type, wrapHandler as EventListener, options);\n }\n if (secondaryTarget) {\n secondaryTarget.addEventListener(\n type,\n wrapHandler as EventListener,\n options,\n );\n }\n\n let unsubscribed = false;\n const unsubscribe = () => {\n if (unsubscribed) {\n return;\n }\n unsubscribed = true;\n if (clearTimer) {\n clearTimeout(clearTimer);\n clearTimer = null;\n }\n if (target) {\n target.removeEventListener(type, wrapHandler as EventListener, options);\n }\n if (secondaryTarget) {\n secondaryTarget.removeEventListener(\n type,\n wrapHandler as EventListener,\n options,\n );\n }\n };\n\n if (opts?.signal) {\n if (opts.signal.aborted) {\n unsubscribe();\n return () => {};\n }\n opts.signal.addEventListener(\"abort\", () => unsubscribe(), { once: true });\n }\n\n return unsubscribe;\n}\n\n/**\n * Convenience helper to subscribe to tool execution start events (`toolactivated`).\n * Returns an unsubscribe cleanup function.\n */\nexport function onWebMcpToolActivated(\n listener: (event: WebMcpToolActivatedEvent) => void,\n options?: boolean | WebMcpEventListenerOptions,\n): () => void {\n return addWebMcpEventListener(\"toolactivated\", listener, options);\n}\n\n/**\n * Convenience helper to subscribe to tool execution cancel events (`toolcancel`).\n * Returns an unsubscribe cleanup function.\n */\nexport function onWebMcpToolCancel(\n listener: (event: WebMcpToolCancelEvent) => void,\n options?: boolean | WebMcpEventListenerOptions,\n): () => void {\n return addWebMcpEventListener(\"toolcancel\", listener, options);\n}\n\n/**\n * Convenience helper to subscribe to tool registration change events (`toolchange`).\n * Dispatched on `document.modelContext` when tools are registered or unregistered.\n * Returns an unsubscribe cleanup function.\n */\nexport function onWebMcpToolChange(\n listener: (event: Event) => void,\n options?: boolean | AddEventListenerOptions,\n): () => void {\n const doc = typeof document !== \"undefined\" ? document : undefined;\n const nav = typeof navigator !== \"undefined\" ? navigator : undefined;\n const modelContext: any =\n (doc as any)?.modelContext ?? (nav as any)?.modelContext;\n\n if (!modelContext || typeof modelContext.addEventListener !== \"function\") {\n return () => {};\n }\n\n modelContext.addEventListener(\"toolchange\", listener, options);\n return () => {\n try {\n modelContext.removeEventListener(\"toolchange\", listener, options);\n } catch {\n // Ignore cleanup error\n }\n };\n}\n\n/**\n * Consequential tools that perform high-stakes, irreversible, or external real-world actions\n * (such as deleting data, executing arbitrary system commands, or transmitting live communications).\n * Signals consuming agents to require explicit user confirmation prior to execution (Chrome 154.0.8017.0+).\n */\nexport const CONSEQUENTIAL_TOOL_NAMES: ReadonlySet<string> = new Set([\n \"bash\",\n \"clear_chat\",\n \"delete_file\",\n \"delete_task\",\n \"email_send_message\",\n \"git_delete_branch\",\n \"git_delete_repo\",\n \"git_push\",\n \"git_reset\",\n]);\n\n/**\n * Read-only tools that query information without mutating state.\n */\nexport const READ_ONLY_TOOL_NAMES: ReadonlySet<string> = new Set([\n \"ask_user\",\n \"detect_language\",\n \"diff_files\",\n \"email_read_messages\",\n \"fetch_url\",\n \"get_current_time\",\n \"git_branches\",\n \"git_diff\",\n \"git_list_repos\",\n \"git_log\",\n \"git_read_file_at_ref\",\n \"git_show\",\n \"git_status\",\n \"list_components\",\n \"list_files\",\n \"list_room_members\",\n \"list_tasks\",\n \"list_tool_profiles\",\n \"proofread_text\",\n \"read_file\",\n \"remote_mcp_list_tools\",\n \"rewrite_text\",\n \"search_files\",\n \"summarize_text\",\n \"translate_text\",\n \"web_search\",\n \"write_text\",\n]);\n\nexport interface WebMcpToolAnnotations {\n readOnlyHint?: boolean;\n consequentialHint?: boolean;\n untrustedContentHint?: boolean;\n debugging?: boolean;\n [key: string]: unknown;\n}\n\n/**\n * Resolve annotations for a WebMCP tool registration.\n * Allows custom annotations (from declarative or customized tool definitions)\n * to override defaults.\n */\nexport function resolveWebMcpToolAnnotations(\n toolName: string,\n customAnnotations?: Record<string, unknown>,\n): WebMcpToolAnnotations {\n const isConsequential = CONSEQUENTIAL_TOOL_NAMES.has(toolName);\n const isReadOnly = !isConsequential && READ_ONLY_TOOL_NAMES.has(toolName);\n\n return {\n readOnlyHint: isReadOnly,\n consequentialHint: isConsequential,\n untrustedContentHint: true,\n ...(typeof customAnnotations?.debugging === \"boolean\"\n ? { debugging: customAnnotations.debugging }\n : {}),\n ...(customAnnotations || {}),\n };\n}\n\n/**\n * Register ShadowClaw tools with the WebMCP ModelContext API.\n *\n * Both the `@mcp-b/webmcp-polyfill` and Chrome's native API support\n * `registerTool(tool, { signal })`. We always use AbortController signals so\n * that unregistration works identically regardless of which implementation is\n * actually active.\n *\n * Key correctness detail: `ensurePolyfill()` is a no-op when\n * Chrome's native `document.modelContext` already exists — it does NOT\n * override the native API. In that situation we are talking to the native\n * Chrome API even in \"polyfill\" mode. The native Chrome API only supports\n * signal-based unregistration, so using AbortController signals everywhere\n * prevents \"Duplicate tool name\" errors when tools are re-configured.\n */\nexport async function registerWebMcpTools(\n agentWorker: Worker | null,\n _emit: (message: any) => Promise<void> | void,\n groupId: string = DEFAULT_GROUP_ID,\n tools?: ToolDefinition[],\n): Promise<boolean> {\n const activeTools = Array.isArray(tools) ? tools : TOOL_DEFINITIONS;\n\n if (activeTools.length === 0) {\n return true;\n }\n\n // In polyfill mode, the polyfill's validateOriginAgentCluster() guard throws\n // DOMException(\"\", \"SecurityError\") when originAgentCluster === false.\n // Chrome automatically origin-isolates HTTPS pages so this never occurs\n // there, but Firefox returns false unless the server sends\n // Origin-Agent-Cluster: ?1 (a header GitHub Pages does not set).\n // Pre-checking here avoids N identical per-tool DOMException spam and\n // surfaces a single, actionable warning instead.\n if (currentMode === \"polyfill\" && !isOriginAgentClusterCompatible()) {\n console.warn(\n \"WebMCP polyfill registration skipped: this browser reports \" +\n \"originAgentCluster = false. The @mcp-b/webmcp-polyfill v5.1.0+ \" +\n \"requires an origin-keyed agent cluster (Chrome enforces this \" +\n \"automatically for HTTPS; Firefox requires the server to send \" +\n \"Origin-Agent-Cluster: ?1). WebMCP tools are unavailable in this \" +\n \"browser session.\",\n );\n return false;\n }\n\n const modelContext = getModelContextApi();\n if (!modelContext) {\n return false;\n }\n\n for (const def of activeTools) {\n if (registeredToolNames.has(def.name)) {\n continue;\n }\n\n const controller = new AbortController();\n registeredToolControllers.set(def.name, controller);\n registeredToolNames.add(def.name);\n\n try {\n const toolDef: any = {\n name: def.name,\n title: (def as any).title || def.name,\n description: def.description,\n inputSchema: parseWebMcpInputSchema(def.input_schema),\n annotations: resolveWebMcpToolAnnotations(\n def.name,\n (def as any).annotations,\n ),\n execute: (\n input: Record<string, unknown>,\n context?: WebMcpExecuteContext | AbortSignal,\n ) => {\n if (!agentWorker) {\n throw new Error(\"Cannot execute tool: agent worker is not ready\");\n }\n\n const signal = extractAbortSignal(context);\n\n if (signal?.aborted) {\n return Promise.reject(new Error(\"Tool execution aborted\"));\n }\n\n return new Promise((resolve, reject) => {\n const callId =\n Date.now().toString(36) + Math.random().toString(36).slice(2);\n\n let timeout: ReturnType<typeof setTimeout> | null = null;\n\n const cleanup = () => {\n if (timeout !== null) {\n clearTimeout(timeout);\n timeout = null;\n }\n agentWorker?.removeEventListener(\"message\", handler);\n if (signal && onAbort) {\n signal.removeEventListener(\"abort\", onAbort);\n }\n };\n\n const onAbort = () => {\n cleanup();\n reject(new Error(\"Tool execution aborted\"));\n };\n\n if (signal) {\n signal.addEventListener(\"abort\", onAbort, { once: true });\n }\n\n timeout = setTimeout(() => {\n cleanup();\n reject(new Error(\"Timeout waiting for tool execution\"));\n }, 600000);\n\n const handler = (event: MessageEvent) => {\n const data = event.data;\n if (\n data &&\n data.type === \"execute-tool-result\" &&\n data.callId === callId\n ) {\n cleanup();\n\n if (data.error) {\n reject(new Error(data.error));\n } else {\n resolve(data.result);\n }\n }\n };\n\n agentWorker.addEventListener(\"message\", handler);\n\n agentWorker.postMessage({\n type: \"execute-tool\",\n callId,\n payload: { name: def.name, input: input || {}, groupId },\n });\n });\n },\n };\n\n // Always use AbortController signals — both the polyfill and the native\n // Chrome API honour { signal } for lifecycle management.\n await modelContext.registerTool(toolDef, { signal: controller.signal });\n\n // Yield to the event loop between registrations.\n await new Promise((resolve) => setTimeout(resolve, 0));\n } catch (err) {\n registeredToolControllers.delete(def.name);\n registeredToolNames.delete(def.name);\n\n // Treat duplicate-registration errors as a no-op. The polyfill throws\n // \"Tool already registered: <name>\" and the native Chrome API throws\n // \"Duplicate tool name\" — both mean the tool is already present.\n const isDuplicate =\n err instanceof Error &&\n (err.message.includes(\"already registered\") ||\n err.message.includes(\"Duplicate tool name\"));\n\n if (isDuplicate) {\n continue;\n }\n\n // A SecurityError DOMException (typically with an empty message) means\n // the polyfill's origin-agent-cluster or permissions-policy gate\n // rejected the registration. This is not recoverable for this session —\n // bail out cleanly rather than spamming one error per remaining tool.\n const isSecurityError =\n err instanceof DOMException && err.name === \"SecurityError\";\n\n if (isSecurityError) {\n console.warn(\n \"WebMCP tool registration aborted: browser security policy \" +\n \"(SecurityError) prevented registration. Remaining tools will \" +\n \"not be registered for this session.\",\n err,\n );\n return false;\n }\n\n console.error(`Failed to register tool ${def.name}:`, err);\n\n throw err;\n }\n }\n\n return true;\n}\n\n/**\n * Unregister previously registered ShadowClaw WebMCP tools.\n *\n * Aborts every AbortController associated with a registered tool. This works\n * for both the polyfill (which listens for the `abort` event on the signal it\n * was given) and Chrome's native API (which also uses signal-based lifecycle).\n * The deprecated `unregisterTool(name)` is intentionally NOT called here\n * because it is absent from the native Chrome API and causes silent failures\n * that prevent proper cleanup.\n */\nexport function unregisterWebMcpTools() {\n for (const controller of registeredToolControllers.values()) {\n try {\n controller.abort();\n } catch {\n // Ignore unregister errors in experimental API contexts.\n }\n }\n\n registeredToolControllers.clear();\n registeredToolNames.clear();\n}\n"],"ignoreList":[0],"mappings":";;;;;;AACA,MAAM,kBAAkB;CACvB;CACA;CACA;CACA;AACD;AACA,MAAM,WAAW;AACjB,MAAM,WAAW;AACjB,MAAM,uBAAuB,WAAW;AACxC,IAAI,cAAc,MAAM;CACvB;CACA;CACA;CACA,8BAA8B,IAAI,IAAI;CACtC,8BAA8B,IAAI,IAAI;CACtC,WAAW,QAAQ,cAAc;CACjC,8BAA8B,IAAI,IAAI;CACtC,4BAA4B,IAAI,IAAI;CACpC;CACA,UAAU;CACV,YAAY,MAAM,UAAU;EAC3B,KAAK,UAAU;EACf,KAAK,YAAY,KAAK;EACtB,KAAK,YAAY;EACjB,KAAK,QAAQ,iBAAiB,YAAY,UAAU,KAAK,SAAS,KAAK,GAAG,IAAI;EAC9E,KAAK,QAAQ,iBAAiB,kBAAkB;GAC/C,KAAK,UAAU;GACf,KAAK,MAAM,WAAW,KAAK,WAAW,QAAQ,IAAI;EACnD,CAAC;EACD,KAAK,QAAQ,iBA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AS,iBAEzB;IACnB,QAAQ,KACN,8JAGA,GACF;IACA,OAAO;GACT;GAEA,QAAQ,MAAM,2BAA2B,IAAI,KAAK,IAAI,GAAG;GAEzD,MAAM;EACR;CACF;CAEA,OAAO;AACT;;;;;;;;;;;AAYA,SAAgB,wBAAwB;CACtC,KAAK,MAAM,cAAc,0BAA0B,OAAO,GACxD,IAAI;EACF,WAAW,MAAM;CACnB,QAAQ,CAER;CAGF,0BAA0B,MAAM;CAChC,oBAAoB,MAAM;AAC5B"}
|
|
1
|
+
{"version":3,"file":"webmcp-BoMTvgmX.js","names":[],"sources":["../../node_modules/@mcp-b/webmcp-polyfill/dist/index.js","../../src/subsystems/mcp/webmcp.ts"],"sourcesContent":["//#region src/upstream/frames.ts\nconst annotationNames = [\n\t\"consequentialHint\",\n\t\"debugging\",\n\t\"readOnlyHint\",\n\t\"untrustedContentHint\"\n];\nconst protocol = \"webmcp-polyfill\";\nconst deadline = 500;\nconst NativeDOMException$1 = globalThis.DOMException;\nvar FrameBridge = class {\n\t#document;\n\t#window;\n\t#handlers;\n\t#knownPeers = /* @__PURE__ */ new Set();\n\t#unanswered = /* @__PURE__ */ new Set();\n\t#started = Promise.withResolvers();\n\t#handshakes = /* @__PURE__ */ new Map();\n\t#sessions = /* @__PURE__ */ new Set();\n\t#monitor;\n\t#hidden = false;\n\tconstructor(view, handlers) {\n\t\tthis.#window = view;\n\t\tthis.#document = view.document;\n\t\tthis.#handlers = handlers;\n\t\tthis.#window.addEventListener(\"message\", (event) => this.#receive(event), true);\n\t\tthis.#window.addEventListener(\"pagehide\", () => {\n\t\t\tthis.#hidden = true;\n\t\t\tfor (const session of this.#sessions) session.end();\n\t\t});\n\t\tthis.#window.addEventListener(\"pageshow\", (event) => {\n\t\t\tif (event.persisted) {\n\t\t\t\tthis.#hidden = false;\n\t\t\t\tthis.#announce();\n\t\t\t}\n\t\t});\n\t\tfor (const frame of this.#announce()) this.#unanswered.add(frame);\n\t\tif (this.#unanswered.size === 0) this.#started.resolve();\n\t\telse setTimeout(() => {\n\t\t\tthis.#unanswered.clear();\n\t\t\tthis.#started.resolve();\n\t\t}, deadline);\n\t}\n\tasync allowed() {\n\t\tif (this.#hidden) return false;\n\t\treturn this.#documentAllowed(this.#document);\n\t}\n\tasync getTools(fromOrigins) {\n\t\tawait this.#started.promise;\n\t\tconst ownOrigin = this.#window.origin;\n\t\tconst origins = [ownOrigin, ...fromOrigins];\n\t\treturn (await Promise.all(this.#participants().map(async (peer) => {\n\t\t\tif (peer === this.#window) return this.#handlers.getTools(ownOrigin).map((metadata) => toRegisteredTool(metadata, this.#window, ownOrigin));\n\t\t\ttry {\n\t\t\t\tconst reply = await this.#request(peer, origins, { kind: \"getTools\" });\n\t\t\t\tif (!Array.isArray(reply.value)) throw new TypeError(\"Expected a tool list from the frame\");\n\t\t\t\treturn reply.value.map((value) => toRegisteredTool(readToolMetadata(value), peer, reply.origin));\n\t\t\t} catch (error) {\n\t\t\t\tif (!(error instanceof NativeDOMException$1 && error.name === \"UnknownError\")) console.warn(\"WebMCP: could not read tools from a frame.\", error);\n\t\t\t\treturn [];\n\t\t\t}\n\t\t}))).flat();\n\t}\n\tasync execute(target, expectedOrigin, name, serializedInput, signal) {\n\t\tconst reply = await this.#request(target, [expectedOrigin], {\n\t\t\tkind: \"execute\",\n\t\t\tname,\n\t\t\tinput: serializedInput\n\t\t}, signal);\n\t\tif (typeof reply.value !== \"string\") throw executionError();\n\t\treturn reply.value;\n\t}\n\tasync notify(exposedTo) {\n\t\tawait this.#started.promise;\n\t\tconst origins = [this.#window.origin, ...exposedTo];\n\t\tfor (const peer of this.#participants()) {\n\t\t\tif (peer === this.#window) {\n\t\t\t\tawait this.#handlers.changed();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tawait this.#request(peer, origins, { kind: \"changed\" });\n\t\t\t} catch {}\n\t\t}\n\t}\n\t#request(target, origins, request, signal) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tsignal?.throwIfAborted();\n\t\t\tif (this.#hidden || !this.#related(target)) {\n\t\t\t\treject(executionError());\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst id = crypto.randomUUID();\n\t\t\tconst { port1, port2 } = new MessageChannel();\n\t\t\tlet peerOrigin;\n\t\t\tconst close = () => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\tstopWatching();\n\t\t\t\tsignal?.removeEventListener(\"abort\", abort);\n\t\t\t\tthis.#handshakes.delete(id);\n\t\t\t\tport1.close();\n\t\t\t};\n\t\t\tconst fail = (error = executionError()) => {\n\t\t\t\tport1.postMessage({ kind: \"cancel\" });\n\t\t\t\tclose();\n\t\t\t\treject(error);\n\t\t\t};\n\t\t\tconst abort = () => fail(signal?.reason);\n\t\t\tconst expire = () => {\n\t\t\t\tif (peerOrigin === void 0) this.#forget(target);\n\t\t\t\tfail();\n\t\t\t};\n\t\t\tconst connected = (event) => {\n\t\t\t\tif (event.source !== target) return;\n\t\t\t\tthis.#handshakes.delete(id);\n\t\t\t\tif (origins && !origins.includes(event.origin)) {\n\t\t\t\t\tfail();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tpeerOrigin = event.origin;\n\t\t\t\tclearTimeout(timer);\n\t\t\t\tif (request.kind !== \"execute\" && request.kind !== \"changed\") timer = setTimeout(expire, deadline);\n\t\t\t\tport1.postMessage(request);\n\t\t\t};\n\t\t\tlet timer = setTimeout(expire, deadline);\n\t\t\tconst stopWatching = this.#watch(target, fail);\n\t\t\tport1.onmessage = (event) => {\n\t\t\t\tconst reply = record(event.data);\n\t\t\t\tif (reply?.kind === \"error\") {\n\t\t\t\t\tfail();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (reply?.kind !== \"result\" || peerOrigin === void 0) return;\n\t\t\t\tclose();\n\t\t\t\tresolve({\n\t\t\t\t\tvalue: reply.value,\n\t\t\t\t\torigin: peerOrigin\n\t\t\t\t});\n\t\t\t};\n\t\t\tport1.onmessageerror = () => fail();\n\t\t\tsignal?.addEventListener(\"abort\", abort, { once: true });\n\t\t\tthis.#handshakes.set(id, connected);\n\t\t\ttry {\n\t\t\t\ttarget.postMessage(`${protocol}:connect:${id}`, \"*\", [port2]);\n\t\t\t} catch {\n\t\t\t\tport2.close();\n\t\t\t\tfail();\n\t\t\t}\n\t\t});\n\t}\n\t#receive(event) {\n\t\tconst message = readWindowMessage(event.data);\n\t\tif (!message) return;\n\t\tevent.stopImmediatePropagation();\n\t\tconst source = event.source;\n\t\tif (!event.isTrusted || !source || !isWindow(source) || !this.#related(source) || event.origin === \"null\" || this.#hidden) return;\n\t\tif (message.kind === \"announce\") {\n\t\t\tconst isNew = !this.#knownPeers.has(source);\n\t\t\tthis.#learn(source);\n\t\t\tsource.postMessage(`${protocol}:present`, event.origin);\n\t\t\tif (!isNew || this.#window !== this.#window.top) return;\n\t\t\tfor (const peer of this.#knownPeers) {\n\t\t\t\tif (peer === source) continue;\n\t\t\t\tpeer.postMessage(`${protocol}:refresh`, \"*\");\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (message.kind === \"present\") {\n\t\t\tthis.#learn(source);\n\t\t\treturn;\n\t\t}\n\t\tif (message.kind === \"refresh\") {\n\t\t\tif (source === this.#window.top) this.#announce();\n\t\t\treturn;\n\t\t}\n\t\tif (message.kind === \"ready\") {\n\t\t\tthis.#handshakes.get(message.id)?.(event);\n\t\t\treturn;\n\t\t}\n\t\tconst [port] = event.ports;\n\t\tif (message.kind !== \"connect\" || !message.id || !port || event.ports.length !== 1) return;\n\t\tthis.#learn(source);\n\t\tthis.#accept(source, event.origin, message.id, port);\n\t}\n\t#accept(source, origin, id, port) {\n\t\tconst controller = new AbortController();\n\t\tlet requested = false;\n\t\tconst close = () => {\n\t\t\tclearTimeout(timer);\n\t\t\tstopWatching();\n\t\t\tport.close();\n\t\t};\n\t\tconst cancel = () => {\n\t\t\tcontroller.abort();\n\t\t\tclose();\n\t\t};\n\t\tconst fail = () => {\n\t\t\tport.postMessage({ kind: \"error\" });\n\t\t\tcancel();\n\t\t};\n\t\tconst timer = setTimeout(fail, deadline);\n\t\tconst stopWatching = this.#watch(source, fail);\n\t\tport.onmessageerror = fail;\n\t\tport.onmessage = async (event) => {\n\t\t\tconst request = record(event.data);\n\t\t\tif (request?.kind === \"cancel\") {\n\t\t\t\tcancel();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (requested) return;\n\t\t\trequested = true;\n\t\t\tclearTimeout(timer);\n\t\t\ttry {\n\t\t\t\tconst value = await this.#respond(source, origin, request, controller.signal);\n\t\t\t\tport.postMessage({\n\t\t\t\t\tkind: \"result\",\n\t\t\t\t\tvalue\n\t\t\t\t});\n\t\t\t\tclose();\n\t\t\t} catch {\n\t\t\t\tfail();\n\t\t\t}\n\t\t};\n\t\tsource.postMessage(`${protocol}:ready:${id}`, origin);\n\t}\n\tasync #respond(source, origin, request, signal) {\n\t\tif (!request || !this.#related(source)) throw executionError();\n\t\tif (request.kind === \"permission\") {\n\t\t\tconst { childIndex, childOrigin } = request;\n\t\t\tif (typeof childIndex !== \"number\" || !Number.isInteger(childIndex) || childIndex < 0 || typeof childOrigin !== \"string\") throw executionError();\n\t\t\treturn this.#childPermission(childIndex, childOrigin);\n\t\t}\n\t\tif (!await this.allowed() || !await this.#sourceAllowed(source, origin)) throw executionError();\n\t\tif (!this.#related(source)) throw executionError();\n\t\tsignal.throwIfAborted();\n\t\tif (request.kind === \"getTools\") return this.#handlers.getTools(origin);\n\t\tif (request.kind === \"execute\" && typeof request.name === \"string\" && typeof request.input === \"string\") return this.#handlers.execute(origin, request.name, request.input, signal);\n\t\tif (request.kind === \"changed\") {\n\t\t\tawait this.#handlers.changed();\n\t\t\treturn;\n\t\t}\n\t\tthrow executionError();\n\t}\n\tasync #childPermission(childIndex, childOrigin) {\n\t\tconst child = this.#window[childIndex];\n\t\treturn child !== void 0 && await this.allowed() && childAllowed(this.#document, child, childOrigin);\n\t}\n\tasync #documentAllowed(owner) {\n\t\tconst view = activeWindow(owner);\n\t\tif (!view) return false;\n\t\tconst policy = readToolsPolicy(owner);\n\t\tif (policy !== void 0) return policy;\n\t\tif (view === view.parent) return true;\n\t\tconst parentOrigin = view.location.ancestorOrigins?.[0];\n\t\tconst parentDocument = readDocument(view.parent, parentOrigin === void 0 || parentOrigin === view.origin);\n\t\tif (!parentDocument) return this.#parentPermission(view, view.origin);\n\t\treturn childAllowed(parentDocument, view, view.origin) && await this.#documentAllowed(parentDocument);\n\t}\n\tasync #sourceAllowed(source, origin) {\n\t\tconst sourceDocument = readDocument(source, origin === this.#window.origin);\n\t\treturn sourceDocument ? this.#documentAllowed(sourceDocument) : this.#parentPermission(source, origin);\n\t}\n\tasync #parentPermission(child, origin) {\n\t\tconst parent = child.parent;\n\t\tif (parent === child) return true;\n\t\tlet childIndex = -1;\n\t\tfor (let index = 0; index < parent.length; index++) if (parent[index] === child) {\n\t\t\tchildIndex = index;\n\t\t\tbreak;\n\t\t}\n\t\tif (childIndex < 0) return false;\n\t\tif (parent === this.#window) return await this.allowed() && childAllowed(this.#document, child, origin);\n\t\tawait this.#started.promise;\n\t\tif (!this.#knownPeers.has(parent)) return false;\n\t\ttry {\n\t\t\tconst reply = await this.#request(parent, void 0, {\n\t\t\t\tkind: \"permission\",\n\t\t\t\tchildIndex,\n\t\t\t\tchildOrigin: origin\n\t\t\t});\n\t\t\treturn reply.value === true && await this.#sourceAllowed(parent, reply.origin);\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n\t#related(peer) {\n\t\ttry {\n\t\t\treturn !peer.closed && peer !== this.#window && peer.top === this.#window.top;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n\t#tree() {\n\t\tif (this.#window.closed) return [];\n\t\tfor (const peer of this.#knownPeers) if (!this.#related(peer)) this.#knownPeers.delete(peer);\n\t\tconst candidates = [this.#window, ...this.#knownPeers];\n\t\tfor (let ancestor = this.#window.parent; ancestor !== ancestor.parent; ancestor = ancestor.parent) candidates.push(ancestor);\n\t\tconst tree = /* @__PURE__ */ new Set();\n\t\tconst pending = [this.#window.top];\n\t\twhile (pending.length) {\n\t\t\tconst frame = pending.pop();\n\t\t\tif (tree.has(frame)) continue;\n\t\t\ttree.add(frame);\n\t\t\tconst children = [];\n\t\t\tfor (let index = 0; index < frame.length; index++) {\n\t\t\t\tconst child = frame[index];\n\t\t\t\tif (child) children.push(child);\n\t\t\t}\n\t\t\tfor (const candidate of candidates) if (candidate !== frame && candidate.parent === frame && !children.includes(candidate)) children.push(candidate);\n\t\t\tpending.push(...children.reverse());\n\t\t}\n\t\treturn Array.from(tree).filter((frame) => frame === this.#window || this.#related(frame));\n\t}\n\t#participants() {\n\t\treturn this.#tree().filter((frame) => frame === this.#window || this.#knownPeers.has(frame));\n\t}\n\t#announce() {\n\t\tconst others = this.#tree().filter((frame) => frame !== this.#window);\n\t\tfor (const frame of others) frame.postMessage(`${protocol}:announce`, \"*\");\n\t\treturn others;\n\t}\n\t#learn(peer) {\n\t\tthis.#knownPeers.add(peer);\n\t\tthis.#unanswered.delete(peer);\n\t\tif (this.#unanswered.size === 0) this.#started.resolve();\n\t}\n\t#forget(peer) {\n\t\tthis.#knownPeers.delete(peer);\n\t\tif (this.#related(peer)) peer.postMessage(`${protocol}:announce`, \"*\");\n\t}\n\t#watch(peer, end) {\n\t\tconst session = {\n\t\t\tpeer,\n\t\t\tend\n\t\t};\n\t\tthis.#sessions.add(session);\n\t\tif (this.#monitor === void 0) this.#monitor = this.#window.setInterval(() => {\n\t\t\tfor (const open of this.#sessions) if (!this.#related(open.peer)) open.end();\n\t\t}, 100);\n\t\treturn () => {\n\t\t\tthis.#sessions.delete(session);\n\t\t\tif (this.#sessions.size === 0) {\n\t\t\t\tthis.#window.clearInterval(this.#monitor);\n\t\t\t\tthis.#monitor = void 0;\n\t\t\t}\n\t\t};\n\t}\n};\nfunction childAllowed(owner, child, origin) {\n\tconst ownerOrigin = owner.defaultView?.origin;\n\tconst frame = findFrame(owner, child, origin === ownerOrigin);\n\tif (!frame) return false;\n\tconst directive = (frame.getAttribute(\"allow\") ?? \"\").split(\";\").map((part) => part.trim().split(/\\s+/u)).find(([name]) => name === \"tools\");\n\tif (!directive) return origin === ownerOrigin;\n\tconst sources = directive.length === 1 ? [\"'src'\"] : directive.slice(1);\n\tif (sources.includes(\"'none'\")) return false;\n\tconst src = frame.hasAttribute(\"srcdoc\") ? null : frame.getAttribute(\"src\");\n\tconst srcURL = src ? URL.parse(src, owner.baseURI) : null;\n\tconst sourceOrigin = !src || srcURL?.protocol === \"about:\" ? ownerOrigin : srcURL?.origin;\n\treturn sources.some((source) => source === \"*\" || source === \"'self'\" && origin === ownerOrigin || source === \"'src'\" && origin === sourceOrigin || source === origin);\n}\nfunction readDocument(view, sameOrigin) {\n\tif (!sameOrigin) return;\n\ttry {\n\t\treturn view.document;\n\t} catch {\n\t\treturn;\n\t}\n}\nfunction findFrame(owner, child, sameOrigin) {\n\tif (sameOrigin) try {\n\t\tconst frame = child.frameElement;\n\t\tif (frame?.ownerDocument === owner) return frame;\n\t} catch {}\n\treturn searchFrames(owner, child);\n}\nfunction searchFrames(root, child) {\n\tconst frames = root.querySelectorAll(\"iframe, frame\");\n\tfor (const frame of frames) if (frame.contentWindow === child) return frame;\n\tfor (const element of root.querySelectorAll(\"*\")) {\n\t\tif (!element.shadowRoot) continue;\n\t\tconst frame = searchFrames(element.shadowRoot, child);\n\t\tif (frame) return frame;\n\t}\n}\nfunction activeWindow(owner) {\n\tconst view = owner.defaultView;\n\treturn view && !view.closed && view.document === owner ? view : void 0;\n}\nfunction readToolsPolicy(owner) {\n\tconst source = owner;\n\tconst policy = record(source.permissionsPolicy ?? source.featurePolicy);\n\tif (typeof policy?.features !== \"function\" || typeof policy.allowsFeature !== \"function\") return;\n\tconst features = policy.features();\n\treturn Array.isArray(features) && features.includes(\"tools\") ? Boolean(policy.allowsFeature(\"tools\")) : void 0;\n}\nfunction toRegisteredTool(metadata, owner, origin) {\n\tconst inputSchema = metadata.serializedSchema === void 0 ? void 0 : JSON.parse(metadata.serializedSchema);\n\treturn {\n\t\t...metadata.annotations !== void 0 && { annotations: { ...metadata.annotations } },\n\t\tdescription: metadata.description,\n\t\t...inputSchema !== void 0 && { inputSchema },\n\t\tname: metadata.name,\n\t\torigin,\n\t\ttitle: metadata.title,\n\t\twindow: owner\n\t};\n}\nfunction readToolMetadata(value) {\n\tconst tool = record(value);\n\tif (!tool || typeof tool.name !== \"string\" || typeof tool.title !== \"string\" || typeof tool.description !== \"string\" || tool.serializedSchema !== void 0 && typeof tool.serializedSchema !== \"string\") throw new TypeError(\"Invalid tool metadata from the frame\");\n\tconst metadata = {\n\t\tname: tool.name,\n\t\ttitle: tool.title,\n\t\tdescription: tool.description,\n\t\tannotations: void 0,\n\t\tserializedSchema: tool.serializedSchema\n\t};\n\tif (tool.annotations === void 0) return metadata;\n\tconst hints = record(tool.annotations);\n\tif (!hints) throw new TypeError(\"Invalid tool annotations from the frame\");\n\tconst annotations = {};\n\tfor (const name of annotationNames) {\n\t\tconst hint = hints[name];\n\t\tif (hint === void 0) continue;\n\t\tif (typeof hint !== \"boolean\") throw new TypeError(`Invalid ${name} annotation from the frame`);\n\t\tannotations[name] = hint;\n\t}\n\tmetadata.annotations = annotations;\n\treturn metadata;\n}\nfunction readWindowMessage(value) {\n\tif (typeof value !== \"string\") return;\n\tconst [namespace, kind = \"\", id = \"\", extra] = value.split(\":\");\n\treturn namespace === protocol && extra === void 0 ? {\n\t\tkind,\n\t\tid\n\t} : void 0;\n}\nfunction record(value) {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) return;\n\treturn value;\n}\nfunction isWindow(value) {\n\ttry {\n\t\treturn \"postMessage\" in value && \"window\" in value;\n\t} catch {\n\t\treturn false;\n\t}\n}\nfunction executionError() {\n\treturn new NativeDOMException$1(\"Tool execution failed\", \"UnknownError\");\n}\n\n//#endregion\n//#region src/declarative-forms.ts\nconst agentInvokedEvents = /* @__PURE__ */ new WeakSet();\nconst agentResponses = /* @__PURE__ */ new WeakMap();\nconst activeSubmissions = /* @__PURE__ */ new WeakMap();\nfunction isAgentInvokedSubmitEvent(event) {\n\treturn event.isTrusted && (agentInvokedEvents.has(event) || event.eventPhase !== Event.NONE && event.target instanceof HTMLFormElement && activeSubmissions.has(event.target));\n}\nfunction respondWithAgentSubmitEvent(event, agentResponse) {\n\tif (!isAgentInvokedSubmitEvent(event)) throw new DOMException(\"respondWith() is only available during an agent-invoked submit event\", \"InvalidStateError\");\n\tif (!event.defaultPrevented) throw new DOMException(\"respondWith() requires preventDefault() during an agent-invoked submit event\", \"InvalidStateError\");\n\tif (event.eventPhase === Event.NONE) throw new DOMException(\"respondWith() is only available while the submit event is being dispatched\", \"InvalidStateError\");\n\tagentInvokedEvents.add(event);\n\tconst response = Promise.resolve(agentResponse);\n\tagentResponses.set(event, response);\n\tif (event.target instanceof HTMLFormElement) activeSubmissions.get(event.target)?.respond(event);\n}\nconst TEXT_INPUT_TYPES = new Set([\n\t\"email\",\n\t\"password\",\n\t\"search\",\n\t\"tel\",\n\t\"text\",\n\t\"url\"\n]);\nconst READONLY_INPUT_TYPES = new Set([\n\t...TEXT_INPUT_TYPES,\n\t\"date\",\n\t\"datetime-local\",\n\t\"month\",\n\t\"number\",\n\t\"time\",\n\t\"week\"\n]);\nfunction isControl(element) {\n\treturn element instanceof HTMLInputElement || element instanceof HTMLSelectElement || element instanceof HTMLTextAreaElement;\n}\nfunction getFormControls(form) {\n\treturn Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, \"elements\")?.get?.call(form);\n}\nfunction getFormAttribute(form, name) {\n\treturn Element.prototype.getAttribute.call(form, name);\n}\nfunction formHasAttribute(form, name) {\n\treturn Element.prototype.hasAttribute.call(form, name);\n}\nfunction isConnected(node) {\n\treturn Object.getOwnPropertyDescriptor(Node.prototype, \"isConnected\")?.get?.call(node);\n}\nfunction getOpenShadowRoot(element) {\n\treturn Object.getOwnPropertyDescriptor(Element.prototype, \"shadowRoot\")?.get?.call(element);\n}\nfunction checkFormValidity(form) {\n\treturn HTMLFormElement.prototype.checkValidity.call(form);\n}\nfunction requestFormSubmit(form, submitter) {\n\tHTMLFormElement.prototype.requestSubmit.call(form, submitter);\n}\nfunction getControls(form) {\n\treturn [...getFormControls(form)].filter((element) => isControl(element) && !element.matches(\":disabled\") && !(\"readOnly\" in element && element.readOnly && (element instanceof HTMLTextAreaElement || READONLY_INPUT_TYPES.has(element.type))));\n}\nfunction controlGroups(form) {\n\tconst groups = /* @__PURE__ */ new Map();\n\tfor (const control of getControls(form)) {\n\t\tconst name = control.name.trim();\n\t\tconst controls = groups.get(name);\n\t\tif (controls) controls.push(control);\n\t\telse groups.set(name, [control]);\n\t}\n\treturn groups;\n}\nfunction labelText(control) {\n\treturn [...control.labels ?? []].map((label) => {\n\t\tconst copy = label.cloneNode(true);\n\t\tif (!(copy instanceof HTMLElement)) return \"\";\n\t\tcopy.querySelectorAll(\"button, input, meter, output, progress, select, textarea\").forEach((element) => element.remove());\n\t\treturn copy.textContent?.trim() ?? \"\";\n\t}).filter(Boolean).join(\"; \");\n}\nfunction commonFieldset(form, controls) {\n\tfor (let element = controls[0]?.parentElement; element && element !== form; element = element.parentElement) if (element instanceof HTMLFieldSetElement && controls.every((control) => element.contains(control))) return element;\n}\nfunction parameterDescription(form, controls) {\n\tif (controls.length === 1) {\n\t\tconst control = controls[0];\n\t\tif (!control) return void 0;\n\t\treturn control.getAttribute(\"toolparamdescription\") || labelText(control) || control.getAttribute(\"aria-description\") || void 0;\n\t}\n\treturn commonFieldset(form, controls)?.getAttribute(\"toolparamdescription\") || void 0;\n}\nfunction withDescription(schema, form, controls, extra) {\n\tconst description = parameterDescription(form, controls);\n\tconst combined = description && extra ? `${description} (${extra})` : description || extra;\n\treturn combined ? {\n\t\t...schema,\n\t\tdescription: combined\n\t} : schema;\n}\nfunction validNumberAttribute(input, name) {\n\tconst raw = input.getAttribute(name);\n\tif (raw === null || raw.trim() === \"\") return void 0;\n\tconst value = Number(raw);\n\treturn Number.isFinite(value) ? value : void 0;\n}\nfunction validStep(input, fallback) {\n\tconst step = Number(input.getAttribute(\"step\"));\n\treturn Number.isFinite(step) && step > 0 ? step : fallback;\n}\nfunction isStepBaseMultiple(stepBase, step) {\n\tconst quotient = stepBase / step;\n\treturn Math.abs(quotient - Math.round(quotient)) < Number.EPSILON * 16;\n}\nfunction withPattern(schema, input) {\n\tconst pattern = input.getAttribute(\"pattern\");\n\tif (pattern === null) return schema;\n\ttry {\n\t\tnew RegExp(pattern, \"v\");\n\t} catch {\n\t\treturn schema;\n\t}\n\treturn {\n\t\t...schema,\n\t\tpattern\n\t};\n}\nfunction numberSchema(input) {\n\tconst schema = { type: \"number\" };\n\tconst minimum = validNumberAttribute(input, \"min\");\n\tconst maximum = validNumberAttribute(input, \"max\");\n\tif (minimum !== void 0) schema.minimum = minimum;\n\tif (maximum !== void 0) schema.maximum = maximum;\n\tif (input.getAttribute(\"step\") !== \"any\") {\n\t\tconst step = validStep(input, 1);\n\t\tconst rawValue = Number(input.getAttribute(\"value\"));\n\t\tif (isStepBaseMultiple(minimum ?? (Number.isFinite(rawValue) ? rawValue : 0), step)) schema.multipleOf = step;\n\t}\n\treturn schema;\n}\nfunction temporalFormat(input, datePrefix) {\n\tconst step = validStep(input, 60);\n\tif (step < 1) return `${datePrefix}(:[0-5][0-9](\\\\.[0-9]{1,3})?)?$`;\n\tif (step < 60) return `${datePrefix}(:[0-5][0-9])?$`;\n\treturn `${datePrefix}$`;\n}\nfunction optionSchemas(options) {\n\treturn {\n\t\tanyOf: options.map((option) => ({\n\t\t\ttype: \"string\",\n\t\t\tconst: option.value,\n\t\t\ttitle: option.textContent ?? \"\"\n\t\t})),\n\t\tenum: options.map((option) => option.value)\n\t};\n}\nfunction groupChoiceSchemas(controls) {\n\treturn {\n\t\tanyOf: controls.map((control) => {\n\t\t\tconst title = labelText(control);\n\t\t\tconst schema = {\n\t\t\t\ttype: \"string\",\n\t\t\t\tconst: control.value\n\t\t\t};\n\t\t\tif (title) schema.title = title;\n\t\t\treturn schema;\n\t\t}),\n\t\tenum: controls.map((control) => control.value)\n\t};\n}\nfunction isInput(control, type) {\n\treturn control instanceof HTMLInputElement && control.type === type;\n}\nfunction inputSchema(input) {\n\tif (TEXT_INPUT_TYPES.has(input.type)) return withPattern({ type: \"string\" }, input);\n\tswitch (input.type) {\n\t\tcase \"hidden\": return input.getAttribute(\"toolparamdescription\") ? { type: \"string\" } : void 0;\n\t\tcase \"number\": return withPattern(numberSchema(input), input);\n\t\tcase \"range\": {\n\t\t\tconst schema = numberSchema(input);\n\t\t\tschema.minimum ??= 0;\n\t\t\tschema.maximum ??= 100;\n\t\t\treturn schema;\n\t\t}\n\t\tcase \"checkbox\": return { type: \"boolean\" };\n\t\tcase \"date\": return {\n\t\t\ttype: \"string\",\n\t\t\tformat: \"date\"\n\t\t};\n\t\tcase \"month\": return {\n\t\t\ttype: \"string\",\n\t\t\tformat: \"^[0-9]{4}-(0[1-9]|1[0-2])$\"\n\t\t};\n\t\tcase \"week\": return {\n\t\t\ttype: \"string\",\n\t\t\tformat: \"^[0-9]{4}-W(0[1-9]|[1-4][0-9]|5[0-3])$\"\n\t\t};\n\t\tcase \"time\": return {\n\t\t\ttype: \"string\",\n\t\t\tformat: temporalFormat(input, \"^([01][0-9]|2[0-3]):[0-5][0-9]\")\n\t\t};\n\t\tcase \"datetime-local\": return {\n\t\t\ttype: \"string\",\n\t\t\tformat: temporalFormat(input, \"^[0-9]{4}-(0[1-9]|1[0-2])-[0-9]{2}T([01][0-9]|2[0-3]):[0-5][0-9]\")\n\t\t};\n\t\tcase \"color\": return {\n\t\t\ttype: \"string\",\n\t\t\tformat: \"^#[0-9a-zA-Z]{6}$\"\n\t\t};\n\t\tdefault: return;\n\t}\n}\nfunction parameterSchema(form, controls) {\n\tconst [first] = controls;\n\tif (!first) return void 0;\n\tlet schema;\n\tif (controls.every((control) => isInput(control, \"radio\"))) schema = {\n\t\ttype: \"string\",\n\t\t...groupChoiceSchemas(controls)\n\t};\n\telse if (controls.length > 1) {\n\t\tif (controls.every((control) => isInput(control, \"checkbox\"))) schema = {\n\t\t\ttype: \"array\",\n\t\t\titems: {\n\t\t\t\ttype: \"string\",\n\t\t\t\t...groupChoiceSchemas(controls)\n\t\t\t},\n\t\t\tuniqueItems: true\n\t\t};\n\t} else if (first instanceof HTMLTextAreaElement) schema = { type: \"string\" };\n\telse if (first instanceof HTMLSelectElement) {\n\t\tconst choices = optionSchemas([...first.options]);\n\t\tschema = first.multiple ? {\n\t\t\ttype: \"array\",\n\t\t\titems: {\n\t\t\t\ttype: \"string\",\n\t\t\t\t...choices\n\t\t\t},\n\t\t\tuniqueItems: true\n\t\t} : {\n\t\t\ttype: \"string\",\n\t\t\t...choices\n\t\t};\n\t} else schema = inputSchema(first);\n\tconst dateHint = first.type === \"date\" ? \"Dates MUST be provided in 'YYYY-MM-DD' format.\" : void 0;\n\treturn schema && withDescription(schema, form, controls, dateHint);\n}\nfunction synthesizeSchema(form) {\n\tconst properties = {};\n\tconst required = [];\n\tfor (const [name, controls] of controlGroups(form)) {\n\t\tif (!name) continue;\n\t\tconst schema = parameterSchema(form, controls);\n\t\tif (!schema) continue;\n\t\tObject.defineProperty(properties, name, {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: true,\n\t\t\tvalue: schema,\n\t\t\twritable: true\n\t\t});\n\t\tif (controls.some((control) => control.required)) required.push(name);\n\t}\n\treturn {\n\t\ttype: \"object\",\n\t\tproperties,\n\t\trequired\n\t};\n}\nfunction toolDefinition(form) {\n\treturn {\n\t\tname: getFormAttribute(form, \"toolname\") ?? \"\",\n\t\ttitle: getFormAttribute(form, \"tooltitle\") ?? \"\",\n\t\tdescription: getFormAttribute(form, \"tooldescription\") ?? \"\",\n\t\tinputSchema: synthesizeSchema(form),\n\t\tautosubmit: formHasAttribute(form, \"toolautosubmit\")\n\t};\n}\nfunction toFormString(value) {\n\tif (typeof value === \"string\" || typeof value === \"boolean\") return String(value);\n\tif (typeof value === \"number\" && Number.isFinite(value)) return String(value);\n}\nfunction toFormBoolean(value) {\n\tif (typeof value === \"boolean\") return value;\n\tif (typeof value === \"number\" && Number.isInteger(value)) return value !== 0;\n\tif (typeof value !== \"string\") return void 0;\n\tif (value === \"1\" || value.toLowerCase() === \"true\") return true;\n\tif (value === \"0\" || value.toLowerCase() === \"false\") return false;\n}\nfunction hasUniqueAllowedValues(value, allowed) {\n\tif (!Array.isArray(value)) return false;\n\tconst remaining = new Set(allowed);\n\tfor (const item of value) {\n\t\tconst string = toFormString(item);\n\t\tif (string === void 0 || !remaining.delete(string)) return false;\n\t}\n\treturn true;\n}\nfunction inputAcceptsValue(input, value) {\n\tif (value === \"\") return input.type !== \"number\" && input.type !== \"range\";\n\tconst probe = input.ownerDocument.createElement(\"input\");\n\tprobe.type = input.type;\n\tprobe.value = value;\n\treturn probe.value !== \"\";\n}\nfunction isFormParameterValue(form, controls, value) {\n\tconst [first] = controls;\n\tif (!first || !parameterSchema(form, controls)) return false;\n\tconst string = toFormString(value);\n\tif (controls.every((control) => isInput(control, \"radio\"))) return controls.some((control) => control.value === string);\n\tif (controls.length > 1) return hasUniqueAllowedValues(value, new Set(controls.map((control) => control.value)));\n\tif (first instanceof HTMLSelectElement) {\n\t\tconst allowed = new Set([...first.options].map((option) => option.value));\n\t\tif (first.multiple) return hasUniqueAllowedValues(value, allowed);\n\t\treturn string !== void 0 && allowed.has(string);\n\t}\n\tif (first instanceof HTMLTextAreaElement) return string !== void 0;\n\tif (first.type === \"checkbox\") return toFormBoolean(value) !== void 0;\n\treturn string !== void 0 && inputAcceptsValue(first, string);\n}\nfunction dispatchInputAndChange(control) {\n\tcontrol.dispatchEvent(new Event(\"input\", {\n\t\tbubbles: true,\n\t\tcomposed: true\n\t}));\n\tcontrol.dispatchEvent(new Event(\"change\", { bubbles: true }));\n}\nfunction setValue(control, value) {\n\tif (control.value === value) return;\n\tconst prototype = control instanceof HTMLInputElement ? HTMLInputElement.prototype : HTMLTextAreaElement.prototype;\n\tObject.getOwnPropertyDescriptor(prototype, \"value\")?.set?.call(control, value);\n\tdispatchInputAndChange(control);\n}\nfunction setChecked(control, checked) {\n\tif (control.checked === checked) return;\n\tObject.getOwnPropertyDescriptor(HTMLInputElement.prototype, \"checked\")?.set?.call(control, checked);\n\tdispatchInputAndChange(control);\n}\nfunction fillParameter(controls, value) {\n\tconst [first] = controls;\n\tconst string = toFormString(value);\n\tconst values = new Set(Array.isArray(value) ? value.map(toFormString) : []);\n\tif (controls.every((control) => isInput(control, \"radio\"))) {\n\t\tconst control = controls.find((candidate) => candidate.value === string);\n\t\tif (control) setChecked(control, true);\n\t} else if (controls.length > 1) {\n\t\tfor (const control of controls) if (control instanceof HTMLInputElement) setChecked(control, values.has(control.value));\n\t} else if (first instanceof HTMLSelectElement) {\n\t\tif (first.multiple) {\n\t\t\tlet changed = false;\n\t\t\tfor (const option of first.options) {\n\t\t\t\tconst next = values.has(option.value);\n\t\t\t\tif (option.selected === next) continue;\n\t\t\t\toption.selected = next;\n\t\t\t\tchanged = true;\n\t\t\t}\n\t\t\tif (changed) dispatchInputAndChange(first);\n\t\t} else if (string !== void 0 && first.value !== string) {\n\t\t\tfirst.value = string;\n\t\t\tdispatchInputAndChange(first);\n\t\t}\n\t} else if (first && isInput(first, \"checkbox\")) {\n\t\tconst checked = toFormBoolean(value);\n\t\tif (checked !== void 0) setChecked(first, checked);\n\t} else if (first && string !== void 0) setValue(first, string);\n}\nfunction fillForm(form, input) {\n\tif (Array.isArray(input)) throw executionError();\n\tconst groups = controlGroups(form);\n\tconst parameters = [];\n\tfor (const [name, value] of Object.entries(input)) {\n\t\tconst controls = groups.get(name);\n\t\tif (!controls || !isFormParameterValue(form, controls, value)) throw executionError();\n\t\tparameters.push({\n\t\t\tcontrols,\n\t\t\tvalue\n\t\t});\n\t}\n\tfor (const { controls, value } of parameters) fillParameter(controls, value);\n}\nfunction findSubmitter(form) {\n\treturn [...getFormControls(form)].find((element) => !element.matches(\":disabled\") && (element instanceof HTMLButtonElement && element.type === \"submit\" || element instanceof HTMLInputElement && [\"image\", \"submit\"].includes(element.type)));\n}\nfunction lifecycleEvent(type, toolName) {\n\tconst event = new Event(type);\n\tObject.defineProperty(event, \"toolName\", {\n\t\tenumerable: true,\n\t\tvalue: toolName\n\t});\n\treturn event;\n}\nfunction waitForSubmission(context, registration, definition, submitter, signal) {\n\tconst { form } = registration;\n\tregistration.cancelPending?.(executionError());\n\treturn new Promise((resolve, reject) => {\n\t\tlet settled = false;\n\t\tconst cleanup = () => {\n\t\t\tEventTarget.prototype.removeEventListener.call(form, \"invalid\", onInvalid, true);\n\t\t\tsignal.removeEventListener(\"abort\", onAbort);\n\t\t\tactiveSubmissions.delete(form);\n\t\t\tif (registration.cancelPending === cancel) delete registration.cancelPending;\n\t\t};\n\t\tconst finish = (callback) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tcleanup();\n\t\t\tcallback();\n\t\t};\n\t\tconst cancel = (reason) => finish(() => reject(reason));\n\t\tconst settleResponse = (response) => {\n\t\t\tif (registration.cancelPending === cancel) delete registration.cancelPending;\n\t\t\tresponse.then((value) => finish(() => resolve(value ?? null)), (cause) => finish(() => reject(cause)));\n\t\t};\n\t\tconst onInvalid = (event) => {\n\t\t\tif (!event.isTrusted) return;\n\t\t\tqueueMicrotask(() => {\n\t\t\t\tif (!checkFormValidity(form)) cancel(executionError());\n\t\t\t});\n\t\t};\n\t\tconst onAbort = () => {\n\t\t\tfinish(() => {\n\t\t\t\tcontext.dispatchEvent(lifecycleEvent(\"toolcancel\", definition.name));\n\t\t\t\treject(signal.reason);\n\t\t\t});\n\t\t};\n\t\tactiveSubmissions.set(form, {\n\t\t\tcomplete(event) {\n\t\t\t\tsetTimeout(() => {\n\t\t\t\t\tconst response = agentResponses.get(event);\n\t\t\t\t\tif (response) settleResponse(response);\n\t\t\t\t\telse if (event.defaultPrevented) cancel(executionError());\n\t\t\t\t\telse finish(() => resolve(null));\n\t\t\t\t});\n\t\t\t},\n\t\t\tdirect() {\n\t\t\t\tfinish(() => resolve(null));\n\t\t\t},\n\t\t\trespond(event) {\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\tconst response = agentResponses.get(event);\n\t\t\t\t\tif (response) settleResponse(response);\n\t\t\t\t});\n\t\t\t}\n\t\t});\n\t\tregistration.cancelPending = cancel;\n\t\tEventTarget.prototype.addEventListener.call(form, \"invalid\", onInvalid, true);\n\t\tsignal.addEventListener(\"abort\", onAbort, { once: true });\n\t\tif (!definition.autosubmit) {\n\t\t\tsubmitter?.focus();\n\t\t\tcontext.dispatchEvent(lifecycleEvent(\"toolactivated\", definition.name));\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\trequestFormSubmit(form, submitter);\n\t\t\tcontext.dispatchEvent(lifecycleEvent(\"toolactivated\", definition.name));\n\t\t} catch (error) {\n\t\t\tcancel(error);\n\t\t}\n\t});\n}\n/** Adds declarative tools until the vendored upstream implements them. */\nfunction installWebMCPDeclarativeExtensions(context) {\n\tconst prototype = SubmitEvent.prototype;\n\tif (\"agentInvoked\" in prototype && \"respondWith\" in prototype) return;\n\tif (!(\"agentInvoked\" in prototype)) Object.defineProperty(prototype, \"agentInvoked\", {\n\t\tconfigurable: true,\n\t\tenumerable: true,\n\t\tget() {\n\t\t\treturn isAgentInvokedSubmitEvent(this);\n\t\t}\n\t});\n\tif (!(\"respondWith\" in prototype)) Object.defineProperty(prototype, \"respondWith\", {\n\t\tconfigurable: true,\n\t\tenumerable: true,\n\t\twritable: true,\n\t\tvalue(agentResponse) {\n\t\t\trespondWithAgentSubmitEvent(this, agentResponse);\n\t\t}\n\t});\n\tconst registrations = /* @__PURE__ */ new Map();\n\tconst blockedDefinitions = /* @__PURE__ */ new Map();\n\tconst observers = /* @__PURE__ */ new Map();\n\tconst onSubmit = (event) => {\n\t\tif (!(event instanceof SubmitEvent) || !event.isTrusted || !(event.target instanceof HTMLFormElement)) return;\n\t\tconst submission = activeSubmissions.get(event.target);\n\t\tif (!submission) return;\n\t\tagentInvokedEvents.add(event);\n\t\tsubmission.complete(event);\n\t};\n\tconst onReset = (event) => {\n\t\tif (!event.isTrusted || !(event.target instanceof HTMLFormElement)) return;\n\t\tconst form = event.target;\n\t\tsetTimeout(() => {\n\t\t\tif (event.defaultPrevented) return;\n\t\t\tregistrations.get(form)?.cancelPending?.(executionError());\n\t\t});\n\t};\n\tfunction stopObservingRoot(root) {\n\t\tobservers.get(root)?.disconnect();\n\t\tobservers.delete(root);\n\t\troot.removeEventListener(\"reset\", onReset, true);\n\t\troot.removeEventListener(\"submit\", onSubmit, true);\n\t}\n\tfunction observeRoot(root) {\n\t\tif (observers.has(root)) return;\n\t\tconst observer = new MutationObserver(sync);\n\t\tobservers.set(root, observer);\n\t\tobserver.observe(root, {\n\t\t\tattributes: true,\n\t\t\tcharacterData: true,\n\t\t\tchildList: true,\n\t\t\tsubtree: true\n\t\t});\n\t\troot.addEventListener(\"reset\", onReset, true);\n\t\troot.addEventListener(\"submit\", onSubmit, true);\n\t}\n\tfunction sync() {\n\t\tobserveRoot(document);\n\t\tfor (const root of observers.keys()) if (root instanceof ShadowRoot && !root.host.isConnected) stopObservingRoot(root);\n\t\tconst candidates = /* @__PURE__ */ new Set();\n\t\tconst selected = /* @__PURE__ */ new Map();\n\t\tconst selectedByName = /* @__PURE__ */ new Map();\n\t\tfor (const root of observers.keys()) for (const element of root.querySelectorAll(\"*\")) {\n\t\t\tconst shadowRoot = getOpenShadowRoot(element);\n\t\t\tif (shadowRoot) observeRoot(shadowRoot);\n\t\t\tif (!(element instanceof HTMLFormElement) || !formHasAttribute(element, \"toolname\") || !formHasAttribute(element, \"tooldescription\") || !isConnected(element)) continue;\n\t\t\tconst form = element;\n\t\t\tcandidates.add(form);\n\t\t\tconst definition = toolDefinition(form);\n\t\t\tconst fingerprint = JSON.stringify(definition);\n\t\t\tif (blockedDefinitions.get(form) === fingerprint) continue;\n\t\t\tblockedDefinitions.delete(form);\n\t\t\tconst existingForm = selectedByName.get(definition.name);\n\t\t\tif (existingForm) {\n\t\t\t\tconst holdsName = (candidate) => registrations.get(candidate)?.name === definition.name;\n\t\t\t\tif (!holdsName(form) || holdsName(existingForm)) {\n\t\t\t\t\tblockedDefinitions.set(form, fingerprint);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst existingSelection = selected.get(existingForm);\n\t\t\t\tif (existingSelection) blockedDefinitions.set(existingForm, existingSelection.fingerprint);\n\t\t\t\tselected.delete(existingForm);\n\t\t\t}\n\t\t\tselectedByName.set(definition.name, form);\n\t\t\tselected.set(form, {\n\t\t\t\tdefinition,\n\t\t\t\tfingerprint\n\t\t\t});\n\t\t}\n\t\tfor (const form of blockedDefinitions.keys()) if (!candidates.has(form)) blockedDefinitions.delete(form);\n\t\tfor (const [form, registration] of registrations) if (selected.get(form)?.fingerprint !== registration.fingerprint) {\n\t\t\tregistration.cancelPending?.(executionError());\n\t\t\tregistration.controller.abort();\n\t\t\tregistrations.delete(form);\n\t\t}\n\t\tfor (const [form, { definition, fingerprint }] of selected) {\n\t\t\tif (registrations.has(form)) continue;\n\t\t\tconst controller = new AbortController();\n\t\t\tconst registration = {\n\t\t\t\tcontroller,\n\t\t\t\tfingerprint,\n\t\t\t\tform,\n\t\t\t\tname: definition.name\n\t\t\t};\n\t\t\tregistrations.set(form, registration);\n\t\t\tcontext.registerTool({\n\t\t\t\tname: definition.name,\n\t\t\t\ttitle: definition.title,\n\t\t\t\tdescription: definition.description,\n\t\t\t\tinputSchema: definition.inputSchema,\n\t\t\t\texecute(input, options) {\n\t\t\t\t\tconst submitter = findSubmitter(form);\n\t\t\t\t\tif (!definition.autosubmit && !submitter) throw executionError();\n\t\t\t\t\tfillForm(form, input);\n\t\t\t\t\treturn waitForSubmission(context, registration, definition, submitter, options.signal);\n\t\t\t\t}\n\t\t\t}, { signal: controller.signal }).catch((cause) => {\n\t\t\t\tcontroller.abort();\n\t\t\t\tif (cause instanceof DOMException && cause.name === \"AbortError\") return;\n\t\t\t\tconsole.error(`[webmcp] declarative form tool \"${definition.name}\" was not registered:`, cause);\n\t\t\t});\n\t\t}\n\t}\n\tconst attachShadowDescriptor = Object.getOwnPropertyDescriptor(Element.prototype, \"attachShadow\");\n\tif (attachShadowDescriptor?.configurable) {\n\t\tconst nativeAttachShadow = Element.prototype.attachShadow;\n\t\tconst attachShadow = function(init) {\n\t\t\tconst root = nativeAttachShadow.call(this, init);\n\t\t\tif (root.mode === \"open\" && Object.getOwnPropertyDescriptor(Node.prototype, \"ownerDocument\")?.get?.call(this) === document && isConnected(this)) observeRoot(root);\n\t\t\treturn root;\n\t\t};\n\t\tObject.defineProperty(Element.prototype, \"attachShadow\", {\n\t\t\t...attachShadowDescriptor,\n\t\t\tvalue: attachShadow\n\t\t});\n\t}\n\tconst submitDescriptor = Object.getOwnPropertyDescriptor(HTMLFormElement.prototype, \"submit\");\n\tif (submitDescriptor?.configurable) {\n\t\tconst nativeSubmit = HTMLFormElement.prototype.submit;\n\t\tconst submit = function() {\n\t\t\tnativeSubmit.call(this);\n\t\t\tactiveSubmissions.get(this)?.direct();\n\t\t};\n\t\tObject.defineProperty(HTMLFormElement.prototype, \"submit\", {\n\t\t\t...submitDescriptor,\n\t\t\tvalue: submit\n\t\t});\n\t}\n\tsync();\n}\n\n//#endregion\n//#region src/upstream/index.ts\n/*!\n* Copyright (c) 2026 WebMCP polyfill contributors\n* SPDX-License-Identifier: MIT\n*/\nconst NativeDOMException = globalThis.DOMException;\nconst getWindow = Object.getOwnPropertyDescriptor(globalThis, \"window\")?.get;\nconst contexts = /* @__PURE__ */ new WeakMap();\n/**\n* Install WebMCP in the current window.\n*\n* Does nothing outside a secure browser context or when `document.modelContext`\n* already exists, including partial native implementations. Call before registering\n* tools in each frame; repeated calls preserve existing contexts and registrations.\n*\n* Installing joins cross-frame discovery: the window listens for the polyfill's messages and\n* announces itself to the other frames of its tree.\n*\n* @throws {TypeError} If the window or Document prototype prevents installation.\n* @example\n* import { installWebMCP } from \"webmcp-polyfill\";\n* installWebMCP();\n*\n* @see https://webmachinelearning.github.io/webmcp/#document-extension\n* @see https://github.com/webmachinelearning/webmcp-polyfill/blob/main/TESTING.md\n*/\nfunction installWebMCP$1() {\n\tif (typeof document === \"undefined\" || !globalThis.isSecureContext) return;\n\tif (\"modelContext\" in document) return;\n\tconst documentPrototype = Document.prototype;\n\tconst getDefaultView = Object.getOwnPropertyDescriptor(documentPrototype, \"defaultView\").get;\n\tconst constructorDescriptor = Object.getOwnPropertyDescriptor(globalThis, \"ModelContext\");\n\tif (!Object.isExtensible(documentPrototype) || constructorDescriptor && !constructorDescriptor.configurable || !constructorDescriptor && !Object.isExtensible(globalThis)) throw new TypeError(\"Cannot install WebMCP on this realm\");\n\tObject.defineProperty(globalThis, \"ModelContext\", {\n\t\tvalue: modelContextConstructor,\n\t\tconfigurable: true,\n\t\twritable: true\n\t});\n\tconst { getModelContext } = { getModelContext() {\n\t\tgetDefaultView.call(this);\n\t\tlet context = contexts.get(this);\n\t\tif (!context) {\n\t\t\tcontext = new ModelContextPolyfill(this);\n\t\t\tcontexts.set(this, context);\n\t\t}\n\t\treturn context;\n\t} };\n\tObject.defineProperty(getModelContext, \"name\", { value: \"get modelContext\" });\n\tObject.defineProperty(documentPrototype, \"modelContext\", {\n\t\tconfigurable: true,\n\t\tenumerable: true,\n\t\tget: getModelContext\n\t});\n\tdocument.modelContext;\n}\nvar ModelContextPolyfill = class extends EventTarget {\n\t#document;\n\t#tools = /* @__PURE__ */ new Map();\n\t#frames;\n\t#toolchangeHandler = null;\n\t#toolchangeListener = (event) => {\n\t\tconst handler = this.#toolchangeHandler;\n\t\tif (typeof handler !== \"function\") return;\n\t\tif (Reflect.apply(handler, this, [event]) === false) Event.prototype.preventDefault.call(event);\n\t};\n\tconstructor(owner) {\n\t\tsuper();\n\t\tthis.#document = owner;\n\t\tconst view = activeWindow(owner);\n\t\tif (!view) return;\n\t\tthis.#frames = new FrameBridge(view, {\n\t\t\tgetTools: (callerOrigin) => this.#exposedTools(callerOrigin),\n\t\t\texecute: (callerOrigin, name, serializedInput, signal) => {\n\t\t\t\tconst ownerOrigin = requireActiveWindow(owner).origin;\n\t\t\t\treturn this.#executeLocal(name, serializedInput, ownerOrigin, callerOrigin, signal);\n\t\t\t},\n\t\t\tchanged: () => this.#queueToolChange()\n\t\t});\n\t}\n\tget ontoolchange() {\n\t\treturn this.#toolchangeHandler;\n\t}\n\tset ontoolchange(handler) {\n\t\tconst nextHandler = isObject(handler) ? handler : null;\n\t\tif (!this.#toolchangeHandler && nextHandler) this.addEventListener(\"toolchange\", this.#toolchangeListener);\n\t\tif (this.#toolchangeHandler && !nextHandler) this.removeEventListener(\"toolchange\", this.#toolchangeListener);\n\t\tthis.#toolchangeHandler = nextHandler;\n\t}\n\tasync registerTool(tool, options = {}) {\n\t\tconst ownerDocument = this.#document;\n\t\tconst { name, title, description, annotations, inputSchema, execute } = readToolDefinition(tool);\n\t\tconst settings = readDictionary(options);\n\t\tconst exposedTo = readOriginSequence(settings.exposedTo);\n\t\tconst registrationSignal = readAbortSignal(settings.signal);\n\t\trequireActiveWindow(ownerDocument);\n\t\tconst requireUnusedName = () => {\n\t\t\tif (this.#tools.has(name)) throw new NativeDOMException(`A tool named ${name} is already registered`, \"InvalidStateError\");\n\t\t};\n\t\trequireUnusedName();\n\t\tif (!/^[A-Za-z0-9_.-]{1,128}$/u.test(name)) throw new NativeDOMException(`Tool names are 1 to 128 characters of ASCII alphanumerics, \"_\", \"-\" or \".\": ${name}`, \"InvalidStateError\");\n\t\tif (!description) throw new NativeDOMException(\"A tool description cannot be empty\", \"InvalidStateError\");\n\t\tconst serializedSchema = inputSchema === void 0 ? void 0 : serializeJSON(inputSchema);\n\t\tregistrationSignal?.throwIfAborted();\n\t\tconst exposedOrigins = parseOrigins(exposedTo);\n\t\tconst storedTool = {\n\t\t\tmetadata: {\n\t\t\t\tname,\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tannotations,\n\t\t\t\tserializedSchema\n\t\t\t},\n\t\t\texecute,\n\t\t\texposedTo: exposedOrigins\n\t\t};\n\t\tconst frames = await this.#requireFrames();\n\t\tregistrationSignal?.throwIfAborted();\n\t\trequireUnusedName();\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tregistrationSignal?.addEventListener(\"abort\", () => {\n\t\t\t\tthis.#tools.delete(name);\n\t\t\t\tframes.notify(exposedOrigins);\n\t\t\t\treject(registrationSignal.reason);\n\t\t\t}, { once: true });\n\t\t\tthis.#tools.set(name, storedTool);\n\t\t\tframes.notify(exposedOrigins).then(resolve, reject);\n\t\t});\n\t}\n\tasync getTools(options = {}) {\n\t\tconst ownerDocument = this.#document;\n\t\tconst fromOrigins = readOriginSequence(readDictionary(options).fromOrigins);\n\t\trequireActiveWindow(ownerDocument);\n\t\tconst frames = await this.#requireFrames();\n\t\tconst requestedOrigins = parseOrigins(fromOrigins);\n\t\tconst tools = await frames.getTools(requestedOrigins);\n\t\ttools.sort((left, right) => {\n\t\t\tif (left.name === right.name) return 0;\n\t\t\treturn left.name < right.name ? -1 : 1;\n\t\t});\n\t\treturn new Promise((resolve) => {\n\t\t\tqueueTask(() => resolve(tools));\n\t\t});\n\t}\n\tasync executeTool(tool, inputObject = {}, options = {}) {\n\t\tconst ownerDocument = this.#document;\n\t\tconst target = readExecutionTarget(tool);\n\t\tconst callerSignal = readAbortSignal(readDictionary(options).signal);\n\t\trequireActiveWindow(ownerDocument);\n\t\tconst expectedOrigin = URL.parse(target.origin)?.origin;\n\t\tif (!expectedOrigin || expectedOrigin === \"null\") throw new NativeDOMException(\"Invalid or opaque origin\", \"NotSupportedError\");\n\t\tif (!isObject(inputObject)) throw new TypeError(\"inputObject must be an object\");\n\t\tconst serializedInput = serializeJSON(inputObject);\n\t\tcallerSignal?.throwIfAborted();\n\t\tconst frames = await this.#requireFrames();\n\t\tcallerSignal?.throwIfAborted();\n\t\tconst callerWindow = requireActiveWindow(ownerDocument);\n\t\tif (target.window !== callerWindow) return frames.execute(target.window, expectedOrigin, target.name, serializedInput, callerSignal);\n\t\treturn this.#executeLocal(target.name, serializedInput, expectedOrigin, callerWindow.origin, callerSignal);\n\t}\n\t#executeLocal(name, serializedInput, expectedOrigin, callerOrigin, callerSignal) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tcallerSignal?.throwIfAborted();\n\t\t\tconst callbackController = new AbortController();\n\t\t\tlet callbackFinished = false;\n\t\t\tconst onCallerAbort = () => {\n\t\t\t\treject(callerSignal.reason);\n\t\t\t\tqueueTask(() => {\n\t\t\t\t\tif (!callbackFinished) callbackController.abort();\n\t\t\t\t});\n\t\t\t};\n\t\t\tconst rejectExecution = () => {\n\t\t\t\tcallbackFinished = true;\n\t\t\t\tqueueTask(() => {\n\t\t\t\t\tcallerSignal?.removeEventListener(\"abort\", onCallerAbort);\n\t\t\t\t\treject(executionError());\n\t\t\t\t});\n\t\t\t};\n\t\t\tconst completeExecution = (value) => {\n\t\t\t\tcallbackFinished = true;\n\t\t\t\tif (callerSignal?.aborted) return;\n\t\t\t\ttry {\n\t\t\t\t\tconst serializedResult = serializeJSON(value);\n\t\t\t\t\tqueueTask(() => {\n\t\t\t\t\t\tcallerSignal?.removeEventListener(\"abort\", onCallerAbort);\n\t\t\t\t\t\tresolve(serializedResult);\n\t\t\t\t\t});\n\t\t\t\t} catch {\n\t\t\t\t\trejectExecution();\n\t\t\t\t}\n\t\t\t};\n\t\t\tconst dispatchTool = () => {\n\t\t\t\tif (callerSignal?.aborted) return;\n\t\t\t\ttry {\n\t\t\t\t\tconst ownerWindow = requireActiveWindow(this.#document);\n\t\t\t\t\tconst storedTool = this.#tools.get(name);\n\t\t\t\t\tif (!storedTool || expectedOrigin !== ownerWindow.origin || !isExposedTo(storedTool, ownerWindow.origin, callerOrigin)) {\n\t\t\t\t\t\trejectExecution();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tconst input = JSON.parse(serializedInput);\n\t\t\t\t\tif (!isObject(input)) {\n\t\t\t\t\t\trejectExecution();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tconst execute = storedTool.execute;\n\t\t\t\t\tconst callbackResult = execute(input, { signal: callbackController.signal });\n\t\t\t\t\tPromise.resolve(callbackResult).then(completeExecution, rejectExecution);\n\t\t\t\t} catch {\n\t\t\t\t\trejectExecution();\n\t\t\t\t}\n\t\t\t};\n\t\t\tcallerSignal?.addEventListener(\"abort\", onCallerAbort, { once: true });\n\t\t\tqueueTask(dispatchTool);\n\t\t});\n\t}\n\tasync #requireFrames() {\n\t\tconst frames = this.#frames;\n\t\tif (!frames || !await frames.allowed()) throw new NativeDOMException(\"WebMCP is disabled by Permissions Policy\", \"NotAllowedError\");\n\t\trequireActiveWindow(this.#document);\n\t\treturn frames;\n\t}\n\t#exposedTools(callerOrigin) {\n\t\tconst ownerOrigin = requireActiveWindow(this.#document).origin;\n\t\tconst exposed = [];\n\t\tfor (const storedTool of this.#tools.values()) {\n\t\t\tif (!isExposedTo(storedTool, ownerOrigin, callerOrigin)) continue;\n\t\t\texposed.push(storedTool.metadata);\n\t\t}\n\t\treturn exposed;\n\t}\n\t#queueToolChange() {\n\t\treturn new Promise((resolve) => {\n\t\t\tqueueTask(() => {\n\t\t\t\tthis.dispatchEvent(new Event(\"toolchange\"));\n\t\t\t\tresolve();\n\t\t\t});\n\t\t});\n\t}\n};\nfunction isExposedTo(tool, ownerOrigin, callerOrigin) {\n\treturn ownerOrigin === callerOrigin || tool.exposedTo.includes(callerOrigin);\n}\nconst modelContextConstructor = function ModelContext() {\n\tthrow new TypeError(\"Illegal constructor\");\n};\nObject.defineProperty(modelContextConstructor, \"name\", { value: \"ModelContext\" });\nObject.defineProperty(modelContextConstructor, \"prototype\", {\n\tvalue: ModelContextPolyfill.prototype,\n\twritable: false\n});\nObject.setPrototypeOf(modelContextConstructor, EventTarget);\nObject.defineProperties(ModelContextPolyfill.prototype, {\n\tconstructor: {\n\t\tvalue: modelContextConstructor,\n\t\tconfigurable: true,\n\t\twritable: true\n\t},\n\t[Symbol.toStringTag]: {\n\t\tvalue: \"ModelContext\",\n\t\tconfigurable: true\n\t},\n\tregisterTool: { enumerable: true },\n\tgetTools: { enumerable: true },\n\texecuteTool: { enumerable: true },\n\tontoolchange: { enumerable: true }\n});\nfunction readToolDefinition(value) {\n\tconst descriptor = readDictionary(value);\n\tconst annotations = readAnnotations(descriptor.annotations);\n\tconst description = toDOMString(requireMember(descriptor.description, \"description\"));\n\tconst callback = requireMember(descriptor.execute, \"execute\");\n\tif (typeof callback !== \"function\") throw new TypeError(\"execute must be a function\");\n\tconst execute = callback;\n\tconst inputSchema = readInputSchema(descriptor.inputSchema);\n\tconst name = toDOMString(requireMember(descriptor.name, \"name\"));\n\tconst rawTitle = descriptor.title;\n\treturn {\n\t\tname,\n\t\ttitle: rawTitle === void 0 ? \"\" : toUSVString(rawTitle),\n\t\tdescription,\n\t\tannotations,\n\t\tinputSchema,\n\t\texecute\n\t};\n}\nfunction readExecutionTarget(value) {\n\tconst descriptor = readDictionary(value);\n\treadAnnotations(descriptor.annotations);\n\ttoDOMString(requireMember(descriptor.description, \"description\"));\n\treadInputSchema(descriptor.inputSchema);\n\tconst name = toDOMString(requireMember(descriptor.name, \"name\"));\n\tconst origin = toUSVString(requireMember(descriptor.origin, \"origin\"));\n\tconst title = descriptor.title;\n\tif (title !== void 0) toDOMString(title);\n\tconst targetWindow = requireMember(descriptor.window, \"window\");\n\tif (!isObject(targetWindow)) throw new TypeError(\"window must be a Window\");\n\tgetWindow.call(targetWindow);\n\treturn {\n\t\tname,\n\t\torigin,\n\t\twindow: targetWindow\n\t};\n}\nfunction readInputSchema(value) {\n\tif (value !== void 0 && !isObject(value)) throw new TypeError(\"inputSchema must be an object\");\n\treturn value;\n}\nfunction isObject(value) {\n\treturn typeof value === \"object\" && value !== null || typeof value === \"function\";\n}\nfunction readDictionary(value) {\n\tif (value == null) return {};\n\tif (!isObject(value)) throw new TypeError(\"Expected a dictionary\");\n\treturn value;\n}\nfunction readAnnotations(value) {\n\tif (value === void 0) return;\n\tconst dictionary = readDictionary(value);\n\tconst annotations = {};\n\tfor (const name of annotationNames) annotations[name] = Boolean(dictionary[name]);\n\treturn annotations;\n}\nfunction toDOMString(value) {\n\tif (typeof value === \"symbol\") throw new TypeError(\"Cannot convert a Symbol to a string\");\n\treturn String(value);\n}\nfunction toUSVString(value) {\n\treturn toDOMString(value).toWellFormed();\n}\nfunction requireMember(value, name) {\n\tif (value === void 0) throw new TypeError(`${name} is required`);\n\treturn value;\n}\nfunction serializeJSON(value) {\n\tconst result = JSON.stringify(value);\n\tif (result === void 0) throw new TypeError(\"Value is not JSON-serializable\");\n\treturn result;\n}\nfunction readAbortSignal(value) {\n\tif (value === void 0) return;\n\treturn AbortSignal.any([value]);\n}\nfunction readOriginSequence(value) {\n\tif (value === void 0) return [];\n\tif (!isObject(value)) throw new TypeError(\"Origins must be a sequence\");\n\tconst getIterator = readDictionary(value)[Symbol.iterator];\n\tif (typeof getIterator !== \"function\") throw new TypeError(\"Origins must be a sequence\");\n\tconst iterable = { [Symbol.iterator]() {\n\t\tconst iterator = Reflect.apply(getIterator, value, []);\n\t\tif (!isObject(iterator)) throw new TypeError(\"Iterator must be an object\");\n\t\tconst next = readDictionary(iterator).next;\n\t\tif (typeof next !== \"function\") throw new TypeError(\"Iterator next must be a function\");\n\t\treturn { next() {\n\t\t\treturn Reflect.apply(next, iterator, []);\n\t\t} };\n\t} };\n\treturn Array.from(iterable, toUSVString);\n}\nfunction parseOrigins(origins) {\n\treturn origins.map((value) => {\n\t\tconst origin = URL.parse(value)?.origin;\n\t\tif (origin === void 0) throw new NativeDOMException(\"Invalid origin\", \"SecurityError\");\n\t\tconst url = URL.parse(origin);\n\t\tif (!url || !isPotentiallyTrustworthy(url)) throw new NativeDOMException(\"Origin is not potentially trustworthy\", \"SecurityError\");\n\t\treturn origin;\n\t});\n}\nfunction isPotentiallyTrustworthy({ protocol, hostname }) {\n\tif ([\"https:\", \"wss:\"].includes(protocol)) return true;\n\tconst isLoopback = hostname === \"[::1]\" || /^127\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/.test(hostname);\n\tconst isLocalhost = hostname === \"localhost\" || hostname === \"localhost.\" || hostname.endsWith(\".localhost\") || hostname.endsWith(\".localhost.\");\n\treturn [\"http:\", \"ws:\"].includes(protocol) && (isLoopback || isLocalhost);\n}\nfunction requireActiveWindow(owner) {\n\tconst view = activeWindow(owner);\n\tif (!view) throw new NativeDOMException(\"The document is not fully active\", \"InvalidStateError\");\n\tif (readToolsPolicy(owner) === false) throw new NativeDOMException(\"WebMCP is disabled by Permissions Policy\", \"NotAllowedError\");\n\treturn view;\n}\nlet taskPort;\nconst queuedTasks = [];\nfunction queueTask(callback) {\n\tif (!taskPort) {\n\t\tconst channel = new MessageChannel();\n\t\tchannel.port1.onmessage = () => queuedTasks.shift()?.();\n\t\ttaskPort = channel.port2;\n\t}\n\tqueuedTasks.push(callback);\n\ttaskPort.postMessage(void 0);\n}\n\n//#endregion\n//#region src/index.ts\n/**\n* Installs upstream WebMCP and the temporary declarative tools layer.\n* Engines missing an API the vendored core calls are left untouched: upstream defines\n* the document getter before it constructs the context, so a failed construction would\n* leave `document.modelContext` throwing.\n*/\nfunction installWebMCP() {\n\tif (typeof document === \"undefined\" || !globalThis.isSecureContext) return;\n\tif (typeof Promise.withResolvers !== \"function\" || typeof AbortSignal.any !== \"function\" || typeof String.prototype.toWellFormed !== \"function\" || typeof URL.parse !== \"function\") return;\n\tinstallWebMCP$1();\n\tconst context = document.modelContext;\n\tif (context) installWebMCPDeclarativeExtensions(context);\n}\n\n//#endregion\nexport { installWebMCP };\n//# sourceMappingURL=index.js.map","import { installWebMCP } from \"@mcp-b/webmcp-polyfill\";\nexport type { WebMCP } from \"webmcp-types\";\n\nimport { DEFAULT_GROUP_ID } from \"../../config/config.js\";\nimport { TOOL_DEFINITIONS, type ToolDefinition } from \"../tools/tools.js\";\n\nexport type WebMcpMode = \"polyfill\" | \"native\";\n\nconst registeredToolControllers: Map<string, AbortController> = new Map();\nconst registeredToolNames: Set<string> = new Set();\n\nlet currentMode: WebMcpMode = \"polyfill\";\n\n/**\n * Set the WebMCP mode (polyfill vs native).\n *\n * - `\"polyfill\"` (default): Uses `@mcp-b/webmcp-polyfill` for a pure-JS\n * `document.modelContext` that works in all browsers.\n * - `\"native\"`: Uses Chrome's native `document.modelContext` from\n * `chrome://flags/#enable-webmcp-testing`. Requires the flag to be\n * enabled. May crash in early Canary builds.\n *\n * Detection follows Chrome's recommended compat pattern:\n * `document.modelContext || navigator.modelContext`\n * `navigator.modelContext` was deprecated in Chrome 150 and removed in\n * Chrome 152.0.7943.0, but the fallback keeps older clients working.\n */\nexport function setWebMcpMode(mode: WebMcpMode): void {\n currentMode = mode;\n}\n\nexport function getWebMcpMode(): WebMcpMode {\n return currentMode;\n}\n\n/**\n * Install the `@mcp-b/webmcp-polyfill` onto `document.modelContext`.\n *\n * In `@mcp-b/webmcp-polyfill` 6.0.0+, the entry point is `installWebMCP()`\n * (previously `initializeWebMCPPolyfill()` in v5).\n * The polyfill itself bails out when Chrome's native `document.modelContext`\n * is already present — it does NOT override the native API. We call it\n * unconditionally; if the polyfill is already installed it returns quickly.\n */\nfunction ensurePolyfill(): void {\n try {\n // Some test / mock environments or non-HTTPS dev setups may not define isSecureContext.\n // If running in a browser-like environment without isSecureContext set, ensure safe default.\n if (\n typeof globalThis !== \"undefined\" &&\n typeof globalThis.isSecureContext === \"undefined\" &&\n typeof location !== \"undefined\" &&\n (location.protocol === \"https:\" ||\n location.hostname === \"localhost\" ||\n location.hostname === \"127.0.0.1\")\n ) {\n try {\n Object.defineProperty(globalThis, \"isSecureContext\", {\n value: true,\n configurable: true,\n });\n } catch {\n // Ignore if read-only\n }\n }\n\n if (typeof installWebMCP === \"function\") {\n installWebMCP();\n }\n } catch (err) {\n console.warn(\"WebMCP polyfill initialization failed:\", err);\n }\n}\n\n/**\n * Returns true when the `@mcp-b/webmcp-polyfill` v5.1.0+ security gate will\n * allow `registerTool()` to proceed.\n *\n * The polyfill's `validateOriginAgentCluster()` throws `DOMException(\"\",\n * \"SecurityError\")` when `globalThis.originAgentCluster === false` (and the\n * protocol is not `file:`). Chrome automatically origin-isolates HTTPS pages so\n * this is never an issue there. Firefox ≥ 138 exposes `originAgentCluster` but\n * returns `false` unless the server sends `Origin-Agent-Cluster: ?1` — a\n * header that GitHub Pages does not set. This check lets us detect Firefox\n * (and any other browser with the same behaviour) early and skip registration\n * with a single descriptive warning instead of N per-tool `DOMException`s.\n *\n * Native mode bypasses the polyfill entirely and is unaffected.\n */\nfunction isOriginAgentClusterCompatible(): boolean {\n // If the property is absent the browser is old enough not to enforce the\n // check — allow registration to proceed.\n if (typeof globalThis.originAgentCluster === \"undefined\") {\n return true;\n }\n\n // file: protocol is explicitly exempt in the polyfill guard.\n const protocol = globalThis.location?.protocol;\n if (protocol === \"file:\") {\n return true;\n }\n\n return globalThis.originAgentCluster !== false;\n}\n\n/**\n * Access the WebMCP ModelContext API.\n *\n * In polyfill mode: installs the `@mcp-b/webmcp-polyfill` which surfaces\n * `document.modelContext`.\n * In native mode: follows Chrome's recommended feature-detection pattern:\n * `document.modelContext || navigator.modelContext`\n * `navigator.modelContext` was deprecated in Chrome 150 and removed in\n * Chrome 152.0.7943.0, but the fallback preserves compatibility with\n * earlier builds that may still be in the wild.\n */\nfunction getModelContextApi(): any {\n if (typeof document === \"undefined\" && typeof navigator === \"undefined\") {\n return null;\n }\n\n if (currentMode === \"polyfill\") {\n ensurePolyfill();\n }\n\n try {\n const modelContext: unknown =\n typeof document !== \"undefined\" &&\n typeof (document as any).modelContext !== \"undefined\"\n ? Reflect.get(document, \"modelContext\")\n : typeof navigator !== \"undefined\" &&\n typeof (navigator as any).modelContext !== \"undefined\"\n ? Reflect.get(navigator, \"modelContext\")\n : undefined;\n\n if (!modelContext || typeof modelContext !== \"object\") {\n return null;\n }\n\n const api = modelContext as {\n registerTool?: unknown;\n unregisterTool?: unknown;\n getTools?: unknown;\n executeTool?: unknown;\n };\n\n if (typeof api.registerTool !== \"function\") {\n return null;\n }\n\n return api;\n } catch (err) {\n console.warn(\"WebMCP modelContext access failed:\", err);\n\n return null;\n }\n}\n\n/**\n * Safely parse or normalize WebMCP input schema.\n *\n * Starting in Chrome 154.0.8014.0 (PR #241), `RegisteredTool#inputSchema` returns\n * a JavaScript object (a deep copy of the schema provided at registration).\n * In Chrome < 154.0.8014.0, `RegisteredTool#inputSchema` returned a stringified JSON schema (DOMString).\n *\n * This function provides backwards-compatible schema parsing:\n * - If inputSchema is a string: attempts JSON.parse.\n * - If inputSchema is an object: returns the object.\n * - Fallbacks gracefully to an empty object schema if null, undefined, or invalid JSON.\n */\nexport function parseWebMcpInputSchema(\n inputSchema: unknown,\n): Record<string, unknown> {\n if (typeof inputSchema === \"string\") {\n try {\n const parsed = JSON.parse(inputSchema);\n if (parsed && typeof parsed === \"object\" && !Array.isArray(parsed)) {\n return parsed as Record<string, unknown>;\n }\n } catch {\n // Fallback on JSON parse error\n }\n\n return { type: \"object\", properties: {} };\n }\n\n if (\n inputSchema &&\n typeof inputSchema === \"object\" &&\n !Array.isArray(inputSchema)\n ) {\n return inputSchema as Record<string, unknown>;\n }\n\n return { type: \"object\", properties: {} };\n}\n\nexport interface WebMcpExecuteContext {\n signal?: AbortSignal;\n}\n\nexport interface WebMcpRegisteredTool {\n name: string;\n title?: string;\n description?: string;\n inputSchema?: unknown;\n annotations?: Record<string, unknown>;\n execute?: (\n input: Record<string, unknown>,\n context?: WebMcpExecuteContext | AbortSignal,\n ) => Promise<unknown>;\n}\n\nexport interface NormalizedWebMcpRegisteredTool {\n name: string;\n title?: string;\n description?: string;\n inputSchema: Record<string, unknown>;\n annotations?: Record<string, unknown>;\n execute?: (\n input: Record<string, unknown>,\n context?: WebMcpExecuteContext | AbortSignal,\n ) => Promise<unknown>;\n}\n\n/**\n * Safely extract AbortSignal from execute options/context.\n * Supports Chrome 153+ options object `{ signal }` (PR #247), direct AbortSignal instances,\n * or undefined for backward compatibility with Chrome < 153 and legacy callers.\n */\nexport function extractAbortSignal(\n context?: WebMcpExecuteContext | AbortSignal,\n): AbortSignal | undefined {\n if (!context) {\n return undefined;\n }\n\n if (typeof AbortSignal !== \"undefined\" && context instanceof AbortSignal) {\n return context;\n }\n\n if (\n typeof context === \"object\" &&\n \"signal\" in context &&\n typeof AbortSignal !== \"undefined\" &&\n context.signal instanceof AbortSignal\n ) {\n return context.signal;\n }\n\n return undefined;\n}\n\n/**\n * Retrieve tools registered on the WebMCP ModelContext API.\n *\n * Practicing graceful degradation:\n * - Feature-detects `getTools()` on `document.modelContext` / `navigator.modelContext`.\n * - If `getTools()` is absent (older browser builds or polyfills without getTools),\n * returns an empty array `[]` without throwing.\n * - Supports options dictionary with `fromOrigins` to discover cross-frame/cross-origin tools (Chrome 155+).\n * - Normalizes `RegisteredTool#inputSchema` so caller receives a JavaScript object\n * whether running on Chrome 154+ (native object) or Chrome < 154 (DOMString JSON).\n */\nexport async function getWebMcpTools(options?: {\n fromOrigins?: string[];\n}): Promise<NormalizedWebMcpRegisteredTool[]> {\n const modelContext = getModelContextApi() as {\n getTools?: (options?: {\n fromOrigins?: string[];\n }) => Promise<WebMcpRegisteredTool[]>;\n } | null;\n\n if (!modelContext || typeof modelContext.getTools !== \"function\") {\n return [];\n }\n\n try {\n const rawTools = await modelContext.getTools(options);\n if (!Array.isArray(rawTools)) {\n return [];\n }\n\n return rawTools.map((tool) => ({\n name: tool.name,\n ...(tool.title ? { title: tool.title } : {}),\n ...(tool.description ? { description: tool.description } : {}),\n inputSchema: parseWebMcpInputSchema(tool.inputSchema),\n ...(tool.annotations ? { annotations: tool.annotations } : {}),\n ...(tool.execute ? { execute: tool.execute } : {}),\n }));\n } catch (err) {\n console.warn(\"Failed to retrieve WebMCP tools via getTools():\", err);\n\n return [];\n }\n}\n\n/**\n * Gracefully execute a WebMCP tool on a ModelContext instance with backwards compatibility.\n *\n * Starting in Chrome 155.0.8052.0 (PR #246, PR #251), `document.modelContext.executeTool()`\n * accepts an optional JavaScript object directly instead of a JSON DOMString.\n * In Chrome < 155 and earlier polyfills, `executeTool()` required a stringified JSON arguments string.\n *\n * This function practices graceful degradation:\n * 1. Prepares both an `inputObject` (for Chrome 155+) and an `inputStr` (for Chrome < 155 & polyfills).\n * 2. Attempts to execute `executeTool(tool, inputObject, options)` first.\n * 3. Catches errors starting with \"Failed to parse input\" (or TypeErrors from WebIDL DOMString checks)\n * and retries transparently with `JSON.stringify(inputObject)`.\n * 4. Re-throws any unrelated execution errors.\n */\nexport async function executeWebMcpTool(\n modelContext: any,\n tool: any,\n input?: unknown,\n options?: WebMcpExecuteContext | AbortSignal,\n): Promise<unknown> {\n if (!modelContext || typeof modelContext.executeTool !== \"function\") {\n throw new Error(\"ModelContext executeTool is not available\");\n }\n\n let inputObject: Record<string, unknown>;\n let inputStr: string;\n\n if (typeof input === \"string\") {\n inputStr = input;\n try {\n const parsed = JSON.parse(input);\n inputObject =\n parsed && typeof parsed === \"object\" && !Array.isArray(parsed)\n ? (parsed as Record<string, unknown>)\n : {};\n } catch {\n inputObject = {};\n }\n } else if (input && typeof input === \"object\" && !Array.isArray(input)) {\n inputObject = input as Record<string, unknown>;\n try {\n inputStr = JSON.stringify(input);\n } catch {\n inputStr = \"{}\";\n }\n } else {\n inputObject = {};\n inputStr = \"{}\";\n }\n\n try {\n return await modelContext.executeTool(tool, inputObject, options);\n } catch (err: any) {\n const isParseError =\n typeof err?.message === \"string\" &&\n err.message.startsWith(\"Failed to parse input\");\n const isTypeError = err instanceof TypeError;\n\n if (isParseError || isTypeError) {\n return await modelContext.executeTool(tool, inputStr, options);\n }\n\n throw err;\n }\n}\n\n/**\n * Feature detection for the WebMCP imperative API.\n *\n * To test this integration in Google Chrome, use the Model Context Tool\n * Inspector extension:\n * https://chromewebstore.google.com/detail/model-context-tool-inspec/gbpdfapgefenggkahomfgkhfehlcenpd\n */\nexport function isWebMcpSupported(): boolean {\n return !!getModelContextApi();\n}\n\n/**\n * Event fired when a tool execution begins (PR #245 / Chrome 156+).\n * Dispatched on `document.modelContext` in Chrome 156+, or `window` in Chrome < 156.\n */\nexport interface WebMcpToolActivatedEvent extends Event {\n readonly toolName: string;\n}\n\n/**\n * Event fired when a tool execution is cancelled (PR #245 / Chrome 156+).\n * Dispatched on `document.modelContext` in Chrome 156+, or `window` in Chrome < 156.\n */\nexport interface WebMcpToolCancelEvent extends Event {\n readonly toolName: string;\n}\n\nexport type WebMcpEventTarget = EventTarget & {\n addEventListener: (type: string, listener: any, options?: any) => void;\n removeEventListener: (type: string, listener: any, options?: any) => void;\n};\n\nexport interface WebMcpEventListenerOptions extends AddEventListenerOptions {\n /**\n * If true, also attaches a fallback listener to window when modelContext is selected\n * (or vice versa), deduplicating events by toolName within the same tick if both fire.\n */\n listenBoth?: boolean;\n}\n\n/**\n * Resolves the appropriate EventTarget for WebMCP lifecycle events\n * (`toolactivated` and `toolcancel`) with backwards compatibility.\n *\n * Starting in Chrome 156.0.8076.0 (PR #245), `ontoolactivated` and `ontoolcancel`\n * event handler properties and lifecycle events moved from `window` to `document.modelContext`.\n * In Chrome < 156, these events were fired on `window`.\n *\n * This function practices robust feature detection and graceful degradation:\n * 1. Safely checks for existence of `document` and `window` to avoid ReferenceErrors\n * in non-DOM / headless / Node.js environments.\n * 2. Checks if `on${type}` is present in `document.modelContext` (or `navigator.modelContext`).\n * If present and it supports `addEventListener`, `modelContext` is returned.\n * 3. Checks if `on${type}` is present in `window`. If present and `window` supports\n * `addEventListener`, `window` is returned (legacy Chrome < 156 path).\n * 4. Fallback: If neither has `on${type}` (e.g. polyfill, synthetic mock, or uninitialized prototype),\n * prefers `modelContext` if it supports `addEventListener`, otherwise falls back to `window`.\n * 5. Returns `null` if no valid EventTarget is found.\n */\nexport function getWebMcpEventTarget(\n type?: \"toolactivated\" | \"toolcancel\" | string,\n): WebMcpEventTarget | null {\n const doc = typeof document !== \"undefined\" ? document : undefined;\n const win = typeof window !== \"undefined\" ? window : undefined;\n const nav = typeof navigator !== \"undefined\" ? navigator : undefined;\n\n const modelContext: any =\n (doc as any)?.modelContext ?? (nav as any)?.modelContext;\n\n const hasModelContextListener =\n modelContext && typeof modelContext.addEventListener === \"function\";\n const hasWindowListener =\n win && typeof (win as any).addEventListener === \"function\";\n\n if (type) {\n const handlerKey = `on${type}`;\n\n // 1. Chrome 156+ path (PR #245): ontoolactivated / ontoolcancel on document.modelContext\n if (modelContext && handlerKey in modelContext && hasModelContextListener) {\n return modelContext as WebMcpEventTarget;\n }\n\n // 2. Chrome < 156 legacy path: ontoolactivated / ontoolcancel on window\n if (win && handlerKey in win && hasWindowListener) {\n return win as WebMcpEventTarget;\n }\n }\n\n // 3. Fallback when neither target explicitly reflects on${type}\n if (hasModelContextListener) {\n return modelContext as WebMcpEventTarget;\n }\n\n if (hasWindowListener) {\n return win as WebMcpEventTarget;\n }\n\n return null;\n}\n\n/**\n * Safely registers a listener for WebMCP lifecycle events (`toolactivated`, `toolcancel`)\n * with graceful degradation, event payload normalization, and automatic unsubscription.\n *\n * Returns an idempotent unsubscribe cleanup function.\n */\nexport function addWebMcpEventListener<\n T extends \"toolactivated\" | \"toolcancel\" | string =\n \"toolactivated\" | \"toolcancel\",\n>(\n type: T,\n listener: (\n event: T extends \"toolactivated\"\n ? WebMcpToolActivatedEvent\n : T extends \"toolcancel\"\n ? WebMcpToolCancelEvent\n : Event & { toolName?: string },\n ) => void,\n options?: boolean | WebMcpEventListenerOptions,\n): () => void {\n const target = getWebMcpEventTarget(type);\n const opts = typeof options === \"object\" ? options : undefined;\n const listenBoth = opts?.listenBoth ?? false;\n\n const win =\n typeof window !== \"undefined\" &&\n typeof (window as any).addEventListener === \"function\"\n ? (window as unknown as WebMcpEventTarget)\n : null;\n const doc = typeof document !== \"undefined\" ? document : null;\n const nav = typeof navigator !== \"undefined\" ? navigator : null;\n const modelContext: any =\n (doc as any)?.modelContext ?? (nav as any)?.modelContext;\n const hasMc =\n modelContext && typeof modelContext.addEventListener === \"function\";\n\n const secondaryTarget: WebMcpEventTarget | null = listenBoth\n ? target === modelContext\n ? win !== target\n ? win\n : null\n : hasMc\n ? (modelContext as WebMcpEventTarget)\n : null\n : null;\n\n if (!target && !secondaryTarget) {\n return () => {};\n }\n\n let recentToolNames: Set<string> | null = null;\n let clearTimer: ReturnType<typeof setTimeout> | null = null;\n\n const wrapHandler = (evt: Event) => {\n let toolName = (evt as any).toolName;\n if (\n typeof toolName !== \"string\" &&\n \"detail\" in evt &&\n typeof (evt as any).detail === \"object\"\n ) {\n toolName = (evt as any).detail?.toolName;\n }\n if (typeof toolName !== \"string\") {\n toolName = \"\";\n }\n\n if (!(\"toolName\" in evt) || (evt as any).toolName !== toolName) {\n try {\n Object.defineProperty(evt, \"toolName\", {\n value: toolName,\n configurable: true,\n enumerable: true,\n });\n } catch {\n // Ignore errors if event is sealed\n }\n }\n\n if (listenBoth && toolName) {\n if (!recentToolNames) {\n recentToolNames = new Set();\n }\n if (recentToolNames.has(toolName)) {\n return;\n }\n recentToolNames.add(toolName);\n if (!clearTimer) {\n clearTimer = setTimeout(() => {\n recentToolNames?.clear();\n clearTimer = null;\n }, 100);\n }\n }\n\n listener(evt as any);\n };\n\n if (target) {\n target.addEventListener(type, wrapHandler as EventListener, options);\n }\n if (secondaryTarget) {\n secondaryTarget.addEventListener(\n type,\n wrapHandler as EventListener,\n options,\n );\n }\n\n let unsubscribed = false;\n const unsubscribe = () => {\n if (unsubscribed) {\n return;\n }\n unsubscribed = true;\n if (clearTimer) {\n clearTimeout(clearTimer);\n clearTimer = null;\n }\n if (target) {\n target.removeEventListener(type, wrapHandler as EventListener, options);\n }\n if (secondaryTarget) {\n secondaryTarget.removeEventListener(\n type,\n wrapHandler as EventListener,\n options,\n );\n }\n };\n\n if (opts?.signal) {\n if (opts.signal.aborted) {\n unsubscribe();\n return () => {};\n }\n opts.signal.addEventListener(\"abort\", () => unsubscribe(), { once: true });\n }\n\n return unsubscribe;\n}\n\n/**\n * Convenience helper to subscribe to tool execution start events (`toolactivated`).\n * Returns an unsubscribe cleanup function.\n */\nexport function onWebMcpToolActivated(\n listener: (event: WebMcpToolActivatedEvent) => void,\n options?: boolean | WebMcpEventListenerOptions,\n): () => void {\n return addWebMcpEventListener(\"toolactivated\", listener, options);\n}\n\n/**\n * Convenience helper to subscribe to tool execution cancel events (`toolcancel`).\n * Returns an unsubscribe cleanup function.\n */\nexport function onWebMcpToolCancel(\n listener: (event: WebMcpToolCancelEvent) => void,\n options?: boolean | WebMcpEventListenerOptions,\n): () => void {\n return addWebMcpEventListener(\"toolcancel\", listener, options);\n}\n\n/**\n * Convenience helper to subscribe to tool registration change events (`toolchange`).\n * Dispatched on `document.modelContext` when tools are registered or unregistered.\n * Returns an unsubscribe cleanup function.\n */\nexport function onWebMcpToolChange(\n listener: (event: Event) => void,\n options?: boolean | AddEventListenerOptions,\n): () => void {\n const doc = typeof document !== \"undefined\" ? document : undefined;\n const nav = typeof navigator !== \"undefined\" ? navigator : undefined;\n const modelContext: any =\n (doc as any)?.modelContext ?? (nav as any)?.modelContext;\n\n if (!modelContext || typeof modelContext.addEventListener !== \"function\") {\n return () => {};\n }\n\n modelContext.addEventListener(\"toolchange\", listener, options);\n return () => {\n try {\n modelContext.removeEventListener(\"toolchange\", listener, options);\n } catch {\n // Ignore cleanup error\n }\n };\n}\n\n/**\n * Consequential tools that perform high-stakes, irreversible, or external real-world actions\n * (such as deleting data, executing arbitrary system commands, or transmitting live communications).\n * Signals consuming agents to require explicit user confirmation prior to execution (Chrome 154.0.8017.0+).\n */\nexport const CONSEQUENTIAL_TOOL_NAMES: ReadonlySet<string> = new Set([\n \"bash\",\n \"clear_chat\",\n \"delete_file\",\n \"delete_task\",\n \"email_send_message\",\n \"git_delete_branch\",\n \"git_delete_repo\",\n \"git_push\",\n \"git_reset\",\n]);\n\n/**\n * Read-only tools that query information without mutating state.\n */\nexport const READ_ONLY_TOOL_NAMES: ReadonlySet<string> = new Set([\n \"ask_user\",\n \"detect_language\",\n \"diff_files\",\n \"email_read_messages\",\n \"fetch_url\",\n \"get_current_time\",\n \"git_branches\",\n \"git_diff\",\n \"git_list_repos\",\n \"git_log\",\n \"git_read_file_at_ref\",\n \"git_show\",\n \"git_status\",\n \"list_components\",\n \"list_files\",\n \"list_room_members\",\n \"list_tasks\",\n \"list_tool_profiles\",\n \"proofread_text\",\n \"read_file\",\n \"remote_mcp_list_tools\",\n \"rewrite_text\",\n \"search_files\",\n \"summarize_text\",\n \"translate_text\",\n \"web_search\",\n \"write_text\",\n]);\n\nexport interface WebMcpToolAnnotations {\n readOnlyHint?: boolean;\n consequentialHint?: boolean;\n untrustedContentHint?: boolean;\n debugging?: boolean;\n [key: string]: unknown;\n}\n\n/**\n * Resolve annotations for a WebMCP tool registration.\n * Allows custom annotations (from declarative or customized tool definitions)\n * to override defaults.\n */\nexport function resolveWebMcpToolAnnotations(\n toolName: string,\n customAnnotations?: Record<string, unknown>,\n): WebMcpToolAnnotations {\n const isConsequential = CONSEQUENTIAL_TOOL_NAMES.has(toolName);\n const isReadOnly = !isConsequential && READ_ONLY_TOOL_NAMES.has(toolName);\n\n return {\n readOnlyHint: isReadOnly,\n consequentialHint: isConsequential,\n untrustedContentHint: true,\n ...(typeof customAnnotations?.debugging === \"boolean\"\n ? { debugging: customAnnotations.debugging }\n : {}),\n ...(customAnnotations || {}),\n };\n}\n\n/**\n * Register ShadowClaw tools with the WebMCP ModelContext API.\n *\n * Both the `@mcp-b/webmcp-polyfill` and Chrome's native API support\n * `registerTool(tool, { signal })`. We always use AbortController signals so\n * that unregistration works identically regardless of which implementation is\n * actually active.\n *\n * Key correctness detail: `ensurePolyfill()` is a no-op when\n * Chrome's native `document.modelContext` already exists — it does NOT\n * override the native API. In that situation we are talking to the native\n * Chrome API even in \"polyfill\" mode. The native Chrome API only supports\n * signal-based unregistration, so using AbortController signals everywhere\n * prevents \"Duplicate tool name\" errors when tools are re-configured.\n */\nexport async function registerWebMcpTools(\n agentWorker: Worker | null,\n _emit: (message: any) => Promise<void> | void,\n groupId: string = DEFAULT_GROUP_ID,\n tools?: ToolDefinition[],\n): Promise<boolean> {\n const activeTools = Array.isArray(tools) ? tools : TOOL_DEFINITIONS;\n\n if (activeTools.length === 0) {\n return true;\n }\n\n // In polyfill mode, the polyfill's validateOriginAgentCluster() guard throws\n // DOMException(\"\", \"SecurityError\") when originAgentCluster === false.\n // Chrome automatically origin-isolates HTTPS pages so this never occurs\n // there, but Firefox returns false unless the server sends\n // Origin-Agent-Cluster: ?1 (a header GitHub Pages does not set).\n // Pre-checking here avoids N identical per-tool DOMException spam and\n // surfaces a single, actionable warning instead.\n if (currentMode === \"polyfill\" && !isOriginAgentClusterCompatible()) {\n console.warn(\n \"WebMCP polyfill registration skipped: this browser reports \" +\n \"originAgentCluster = false. The @mcp-b/webmcp-polyfill v5.1.0+ \" +\n \"requires an origin-keyed agent cluster (Chrome enforces this \" +\n \"automatically for HTTPS; Firefox requires the server to send \" +\n \"Origin-Agent-Cluster: ?1). WebMCP tools are unavailable in this \" +\n \"browser session.\",\n );\n return false;\n }\n\n const modelContext = getModelContextApi();\n if (!modelContext) {\n return false;\n }\n\n for (const def of activeTools) {\n if (registeredToolNames.has(def.name)) {\n continue;\n }\n\n const controller = new AbortController();\n registeredToolControllers.set(def.name, controller);\n registeredToolNames.add(def.name);\n\n try {\n const toolDef: any = {\n name: def.name,\n title: (def as any).title || def.name,\n description: def.description,\n inputSchema: parseWebMcpInputSchema(def.input_schema),\n annotations: resolveWebMcpToolAnnotations(\n def.name,\n (def as any).annotations,\n ),\n execute: (\n input: Record<string, unknown>,\n context?: WebMcpExecuteContext | AbortSignal,\n ) => {\n if (!agentWorker) {\n throw new Error(\"Cannot execute tool: agent worker is not ready\");\n }\n\n const signal = extractAbortSignal(context);\n\n if (signal?.aborted) {\n return Promise.reject(new Error(\"Tool execution aborted\"));\n }\n\n return new Promise((resolve, reject) => {\n const callId =\n Date.now().toString(36) + Math.random().toString(36).slice(2);\n\n let timeout: ReturnType<typeof setTimeout> | null = null;\n\n const cleanup = () => {\n if (timeout !== null) {\n clearTimeout(timeout);\n timeout = null;\n }\n agentWorker?.removeEventListener(\"message\", handler);\n if (signal && onAbort) {\n signal.removeEventListener(\"abort\", onAbort);\n }\n };\n\n const onAbort = () => {\n cleanup();\n reject(new Error(\"Tool execution aborted\"));\n };\n\n if (signal) {\n signal.addEventListener(\"abort\", onAbort, { once: true });\n }\n\n timeout = setTimeout(() => {\n cleanup();\n reject(new Error(\"Timeout waiting for tool execution\"));\n }, 600000);\n\n const handler = (event: MessageEvent) => {\n const data = event.data;\n if (\n data &&\n data.type === \"execute-tool-result\" &&\n data.callId === callId\n ) {\n cleanup();\n\n if (data.error) {\n reject(new Error(data.error));\n } else {\n resolve(data.result);\n }\n }\n };\n\n agentWorker.addEventListener(\"message\", handler);\n\n agentWorker.postMessage({\n type: \"execute-tool\",\n callId,\n payload: { name: def.name, input: input || {}, groupId },\n });\n });\n },\n };\n\n // Always use AbortController signals — both the polyfill and the native\n // Chrome API honour { signal } for lifecycle management.\n await modelContext.registerTool(toolDef, { signal: controller.signal });\n\n // Yield to the event loop between registrations.\n await new Promise((resolve) => setTimeout(resolve, 0));\n } catch (err) {\n registeredToolControllers.delete(def.name);\n registeredToolNames.delete(def.name);\n\n // Treat duplicate-registration errors as a no-op. The polyfill throws\n // \"Tool already registered: <name>\" and the native Chrome API throws\n // \"Duplicate tool name\" — both mean the tool is already present.\n const isDuplicate =\n err instanceof Error &&\n (err.message.includes(\"already registered\") ||\n err.message.includes(\"Duplicate tool name\"));\n\n if (isDuplicate) {\n continue;\n }\n\n // A SecurityError DOMException (typically with an empty message) means\n // the polyfill's origin-agent-cluster or permissions-policy gate\n // rejected the registration. This is not recoverable for this session —\n // bail out cleanly rather than spamming one error per remaining tool.\n const isSecurityError =\n err instanceof DOMException && err.name === \"SecurityError\";\n\n if (isSecurityError) {\n console.warn(\n \"WebMCP tool registration aborted: browser security policy \" +\n \"(SecurityError) prevented registration. Remaining tools will \" +\n \"not be registered for this session.\",\n err,\n );\n return false;\n }\n\n console.error(`Failed to register tool ${def.name}:`, err);\n\n throw err;\n }\n }\n\n return true;\n}\n\n/**\n * Unregister previously registered ShadowClaw WebMCP tools.\n *\n * Aborts every AbortController associated with a registered tool. This works\n * for both the polyfill (which listens for the `abort` event on the signal it\n * was given) and Chrome's native API (which also uses signal-based lifecycle).\n * The deprecated `unregisterTool(name)` is intentionally NOT called here\n * because it is absent from the native Chrome API and causes silent failures\n * that prevent proper cleanup.\n */\nexport function unregisterWebMcpTools() {\n for (const controller of registeredToolControllers.values()) {\n try {\n controller.abort();\n } catch {\n // Ignore unregister errors in experimental API contexts.\n }\n }\n\n registeredToolControllers.clear();\n registeredToolNames.clear();\n}\n"],"ignoreList":[0],"mappings":";;;;;;AACA,MAAM,kBAAkB;CACvB;CACA;CACA;CACA;AACD;AACA,MAAM,WAAW;AACjB,MAAM,WAAW;AACjB,MAAM,uBAAuB,WAAW;AACxC,IAAI,cAAc,MAAM;CACvB;CACA;CACA;CACA,8BAA8B,IAAI,IAAI;CACtC,8BAA8B,IAAI,IAAI;CACtC,WAAW,QAAQ,cAAc;CACjC,8BAA8B,IAAI,IAAI;CACtC,4BAA4B,IAAI,IAAI;CACpC;CACA,UAAU;CACV,YAAY,MAAM,UAAU;EAC3B,KAAK,UAAU;EACf,KAAK,YAAY,KAAK;EACtB,KAAK,YAAY;EACjB,KAAK,QAAQ,iBAAiB,YAAY,UAAU,KAAK,SAAS,KAAK,GAAG,IAAI;EAC9E,KAAK,QAAQ,iBAAiB,kBAAkB;GAC/C,KAAK,UAAU;GACf,KAAK,MAAM,WAAW,KAAK,WAAW,QAAQ,IAAI;EACnD,CAAC;EACD,KAAK,QAAQ,iBAAiB,aAAa,UAAU;GACpD,IAAI,MAAM,WAAW;IACpB,KAAK,UAAU;IACf,KAAK,UAAU;GAChB;EACD,CAAC;EACD,KAAK,MAAM,SAAS,KAAK,UAAU,GAAG,KAAK,YAAY,IAAI,KAAK;EAChE,IAAI,KAAK,YAAY,SAAS,GAAG,KAAK,SAAS,QAAQ;OAClD,iBA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