@xopcai/xopc 0.0.445 → 0.0.446
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/dist/browser-ext/dist/assets/{auth-DAIwDtVp.js → auth-CQmxIyWw.js} +225 -8
- package/dist/browser-ext/dist/background.js +254 -16
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +3 -49
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-CuPXAoLe.js → activity-store-Ddf-02Rf.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-D92uHOFV.js → agent-avatar-dicebear-Dcu4ggpV.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-display-DINzeGs0.js → agent-avatar-display-CarpM_qc.js} +2 -2
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-rH1QpgiR.js → agent-defaults-settings-panel-B4GynTfH.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-B2vXlrDW.js → agent-plugin-dialog-BWQ_Diyv.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-lvQfOQPN.js → agents-DKaImiga.js} +3 -3
- package/dist/gateway/static/root/assets/{agents-admin-api-DPLtjJtX.js → agents-admin-api-BwoePPTG.js} +1 -1
- package/dist/gateway/static/root/assets/{api-snfMD8_Y.js → api-Cc72Y3ct.js} +1 -1
- package/dist/gateway/static/root/assets/{api-CEzBruRJ.js → api-MJxs2HLk.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CONwDpqL.js → app-management-settings-panel-Cy6szt9g.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-Bu7K-_ri.js → appearance-settings-Dy75gAe7.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-C3iDd3ZQ.js → apps-page-DlwW9ClN.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-CfLz9o-2.js → archive-plugin-_5jgYMZC.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-api-Dl9fi8t0.js → automation-api-DrxC4rCG.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-result-state-BjjZCxee.js → automation-result-state-Ba_q8_Jj.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-run-list-9IPHu_UC.js → automation-run-list-DuyMQwtf.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-task-card-CKbHMLSy.js → automation-task-card-D4Ojt-Q4.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-K3trjTZl.js → automations-page-D-Sl7Dhr.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-D7m3w_9B.js → automations-workspace-ND9J7xtt.js} +2 -2
- package/dist/gateway/static/root/assets/{binary-plugins-Bv4ixxo4.js → binary-plugins-BYHCUreq.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CtaJSB9U.js → block-editor-DI_JHx-P.js} +3 -2
- package/dist/gateway/static/root/assets/{browser-settings-page-CmBsnx24.js → browser-settings-page-DXBM5lpK.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-DDJJhQ40.js → capabilities-CUHCbQ5N.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-DJYgOjeq.js → capabilities-C_mZ4wUq.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-CBqvHAyp.js → capabilities-page-RJnyR_V9.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-wjezs0OE.js → capabilities-settings-panel-CxSrK6bJ.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-D4q8hiD0.js → channels-CBXmRfVR.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-agents-api-BOB3dILf.js → chat-agents-api-D6sJpLeT.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-chart-block-DsaCatBN.js → chat-chart-block-B2U7epTQ.js} +1 -1
- package/dist/gateway/static/root/assets/chat-page-U5hc4rIa.js +72 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-D9o0nUEV.js → chat-terminal-dock-XNPvQhNw.js} +1 -1
- package/dist/gateway/static/root/assets/{command-palette-api-Cj0_7g9o.js → command-palette-api-DbL0oPXq.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-payload-handoff-CoDWKzBm.js → composer-payload-handoff-CaxZicbL.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-DJ9BIOHC.js → computer-settings-page-Velpw46s.js} +1 -1
- package/dist/gateway/static/root/assets/{connected-providers-grid-C5-3MDIj.js → connected-providers-grid-Y79g354a.js} +1 -1
- package/dist/gateway/static/root/assets/{connection-usage-guide-bD1sKiAp.js → connection-usage-guide-BaDoesqn.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-BEq3i3Vi.js → connector-service-page-C5mVM3zg.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-DEExP6a7.js → connectors-api-Cgiy3Dyn.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-QVWuoxuK.js → connectors-page-DDSTfe3M.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-D2whl8Ci.js → date-picker-BCxU-AEv.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-qnIdmNnH.js → desktop-pet-D1buh7JC.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-C54b1FY4.js → desktop-pet-settings-CVs5timB.js} +1 -1
- package/dist/gateway/static/root/assets/{dev-view-store-bryv5YRw.js → dev-view-store-rdp0Stsh.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-Du-yOxZv.js → device-pairing-wizard-ZX1oup6S.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-GsMkjw59.js → directory-picker-path-field-BN57kiUt.js} +1 -1
- package/dist/gateway/static/root/assets/{discussion-annotation-sync-CrpDiC7J.js → discussion-annotation-sync-BG-sbtYu.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CDZfdMAR.js → extension-debug-page-DuuOhNRp.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-CG70QWPS.js → extension-iframe-host-DzzKhhvD.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-marketplace-api-D7Av-sOf.js → extension-marketplace-api-5BBPFsmU.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DpJTL6-v.js → extension-page-DDmRVcIm.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-BZTbdvCF.js → extension-provider-CFzHYMV0.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CC4rmiFC.js → extension-settings-page-DGAD52bm.js} +1 -1
- package/dist/gateway/static/root/assets/{file-preview-surface-Dtla5oAW.js → file-preview-surface-DgG6OJyj.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-B5THNdYK.js → gateway-config-swr-D0yocd87.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-DpNC3Y7U.js +1 -0
- package/dist/gateway/static/root/assets/gateway-realtime-store-BQELP9Or.js +1 -0
- package/dist/gateway/static/root/assets/gateway-restart-C_8Z4DRU.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-CGlpz-Ft.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CqtCJzWJ.js → gateway-startup-retry-BPSM56sw.js} +1 -1
- package/dist/gateway/static/root/assets/{global-defaults-api-BQMdHLlp.js → global-defaults-api-BFsm77dC.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-Df3X6-Ko.js → home-page-UXS36f7M.js} +2 -2
- package/dist/gateway/static/root/assets/{image-generation-api-G3tQFhif.js → image-generation-api-wJi7zpES.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-BmEqiunH.js → imports-page-iddP3PVx.js} +1 -1
- package/dist/gateway/static/root/assets/index-D0p4v0SG.js +11 -0
- package/dist/gateway/static/root/assets/index-Uxz0OdzD.css +1 -0
- package/dist/gateway/static/root/assets/{install-connector-dialog-BU4l6KJv.js → install-connector-dialog-DSIVSJRz.js} +1 -1
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CtNI6i7K.js → keyboard-shortcuts-settings-Cxdd0r3Z.js} +1 -1
- package/dist/gateway/static/root/assets/languages-kF11aUYU.js +2 -0
- package/dist/gateway/static/root/assets/{local-app-workbench-page-CE46mHc0.js → local-app-workbench-page-jfkZZHHd.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-DqZT5hLH.js → local-apps-page-BwWuY0x2.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-Bt_e3A8f.js → local-session-drafts-cTAkoNSf.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Bld7_m-Q.js → locale-store-DJYUYPdV.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CzajqK40.js → logs-page-CuxC8O1E.js} +1 -1
- package/dist/gateway/static/root/assets/management-api-CmBUdfsn.js +1 -0
- package/dist/gateway/static/root/assets/management-settings-CYn1EOVo.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-editor-BuuGlcfG.js → markdown-editor-CjQJ-Nho.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-B3cFKCfO.js → markdown-view-DrcA6Cfr.js} +1 -1
- package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-ZcY1nqMO.js → mcp-conversation-setup-page-C5D5oueS.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DSOplRhW.js → media-plugins-CQZ0Jh_x.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-CGO1P4mz.js → messages-DziUGfxF.js} +2 -2
- package/dist/gateway/static/root/assets/{model-selector-yAKlOR3O.js → model-selector-CbKl8YPf.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-cache-8V-ZpAIa.js → models-hub-cache-CwxnL3rY.js} +1 -1
- package/dist/gateway/static/root/assets/navigation-ByOzYT0t.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-uQO4kymH.js +7 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-CaO_VuWl.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-CVQqqmGI.js → notes-api-DoCb3QlH.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-DIugUbkV.js → notes-page-DOl7cqLg.js} +2 -2
- package/dist/gateway/static/root/assets/{oauth-api-DGa6PTuq.js → oauth-api-3b_QtYeo.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-provider-connect-Bc-KLH1e.js → oauth-provider-connect-D1JQ4FBf.js} +1 -1
- package/dist/gateway/static/root/assets/page-context-capture-button-CVIVl1MQ.js +1 -0
- package/dist/gateway/static/root/assets/{page-context-draft-GveHK8e2.js → page-context-draft-Ky5J09qv.js} +1 -1
- package/dist/gateway/static/root/assets/page-header-store-Jt0XBQxm.js +1 -0
- package/dist/gateway/static/root/assets/{personal-avatar-Cu8lGBXZ.js → personal-avatar-Dh4qjZYy.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-BZWJKyZ8.js → personal-page-edoGNvVa.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-settings-panel-awr10jTV.js → personal-settings-panel-BtTwDaw0.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-dependencies-card-CAxn3usD.js → phone-dependencies-card-B6rA2lO_.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-connection-BBG3LxRP.js → phone-model-connection-xqaXDOVF.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-picker-CfPjKpnd.js → phone-model-picker-yuGXKCM9.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-settings-page-C4dJdwRW.js → phone-settings-page-DhjuPpF4.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-workspace-store-BKltFHtG.js → phone-workspace-store-2xQhZsJr.js} +1 -1
- package/dist/gateway/static/root/assets/{plugin-details-dialog-BqcFfZFH.js → plugin-details-dialog-CIS3SUKM.js} +1 -1
- package/dist/gateway/static/root/assets/{preference-select-fields-QlyIA8ve.js → preference-select-fields-BAZSKhoi.js} +1 -1
- package/dist/gateway/static/root/assets/{product-automation-feedback-CRsfuAXl.js → product-automation-feedback-Bh37tBpR.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CQ4dk-_l.js → product-open-page-BXcS7lCW.js} +1 -1
- package/dist/gateway/static/root/assets/product-preview-content-BNultFGN.js +1 -0
- package/dist/gateway/static/root/assets/product-preview-modal-BTlUoG48.js +2 -0
- package/dist/gateway/static/root/assets/project-detail-page-DNvQzRnU.js +7 -0
- package/dist/gateway/static/root/assets/project-overview-model-DrLXaO-t.js +1 -0
- package/dist/gateway/static/root/assets/{project-understanding-CU2af95r.js → project-understanding-CrYVzB8i.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-BsgZb6n9.js → projects-page-nEhOaONB.js} +1 -1
- package/dist/gateway/static/root/assets/{providers-api-CspehmSU.js → providers-api-MimHCxo_.js} +1 -1
- package/dist/gateway/static/root/assets/{recording-upload-BOZAOdCI.js → recording-upload-BUe8jmx8.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-Bdp3UUyz.js → registry-api-CkrGCW-C.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-Bos3uwAT.js → remote-access-hub-QqFEiO0m.js} +1 -1
- package/dist/gateway/static/root/assets/{resource-unavailable-DJR3SCy6.js → resource-unavailable-CSc5SeHy.js} +1 -1
- package/dist/gateway/static/root/assets/route-preload-BTPpGwjV.js +2 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-DsbahxzE.js → runtime-tools-api-BzLDrYX8.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DW9_OFi2.js → runtime-tools-settings-panel-DST1lBFY.js} +1 -1
- package/dist/gateway/static/root/assets/{service-recommendation-list-Bd1JDO5T.js → service-recommendation-list-DezuXPLs.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-DjnHJ-0n.js → session-api-QnBTnXGH.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-ChHnJOWW.js → session-manager-b2zxVzZI.js} +2 -2
- package/dist/gateway/static/root/assets/{sessions-page-BM-oqd22.js → sessions-page-uarYA2Xw.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Bq6eQ3It.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-section-CM44UlF8.js → settings-advanced-section-Crhl0mQp.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-mode-store-Blc4C8aw.js → settings-mode-store-CrM7SFWJ.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-irv-JoTz.js → settings-page-BrogpvEd.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-BYFaTD8a.js → settings-page-header-DPKy790x.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-CnUQSxT3.js → settings-page-layout-8kCWtU5m.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-interaction-page-DqaiLQ0I.js → setup-interaction-page-BVnMLwC-.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-iOYgfkoK.js → setup-status-panel--Fb7FwVG.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-C_uYNUlp.js → share-link-dialog-C45dGG9y.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CFebGqyB.js → share-preview-page-ConV6wRP.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-C2GDyqxP.js → shares-api-BsDhQwd3.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-B-7la3QN.js → shares-settings-DJz0p2PL.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-BnpTSZGc.js → skill-api-BrM5Ctxg.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-list-api-7MY9ewiu.js → skill-list-api-DWCkzC6W.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-DkDpu3Wd.js → skill-reload-api-C2jfZi01.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-sL2kGqHZ.js → skills-page-DbAc1Y4C.js} +1 -1
- package/dist/gateway/static/root/assets/{source-workspace-editor-kxosllTu.js → source-workspace-editor-BwYU5OEh.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BltKPJdb.js → system-settings-panel-BiswiIqg.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-6awKGnOr.js → task-detail-page-R0_AM-IE.js} +1 -1
- package/dist/gateway/static/root/assets/{task-result-evidence-Cy9txdqV.js → task-result-evidence-C1AEUu9S.js} +1 -1
- package/dist/gateway/static/root/assets/{terminal-panel-store-DUEJoa1M.js → terminal-panel-store-qS6f2G-H.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DsvYj7Vy.js → theme-store-Docer0tD.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-B_Xdc2VF.js → tracing-settings-page-DiXHv8C3.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-B6BhWTh3.js → tunnel-api-UYBm3Hqd.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-activity-store-B7rFXhDk.js → understanding-activity-store-CK6cQ0iJ.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-refresh-store-DCFASve5.js → understanding-refresh-store-DVNqbtHk.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-DqzosTxy.js → usage-page-DmA7kQI2.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-DsqcLHV9.js → use-autosave-D1tFBLQO.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-ClakaDU1.js → use-composer-attachments-CwJslPRU.js} +1 -1
- package/dist/gateway/static/root/assets/use-file-preview-expanded-CK1OJENF.js +15 -0
- package/dist/gateway/static/root/assets/{use-personal-profile-T2e6P5Ed.js → use-personal-profile-CpsJdlEs.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-Dq0qgK3N.js → use-workspace-tree-CW9hcMwg.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-Ziz55hVM.js → user-model-page-BlYKXzCa.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-D7NPAc1E.js → voice-api-key-field-DD9V94Y7.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-UQDTh6hh.js → voice-config-api-Cr6IkfV2.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-input-shortcut-events-SD2gZVg8.js → voice-input-shortcut-events-hsEdKDO6.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-transcribe-api-Bf9FaI-p.js → voice-transcribe-api-DKain9tL.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-B41GOFXh.js → work-discovery-overlay-yYdAqtrO.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-NNhExALx.js → work-discovery-page-8hTykUqr.js} +1 -1
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-DeNWVFFK.js → working-directory-picker-modal-CXPSsy2J.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-api-DrVss2Fd.js → workspace-api-DNSoGsW8.js} +2 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-ENv6zDBq.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-C2egBzza.js → workspace-file-preview-dialog-BVYsAXwp.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-XFUtwfLY.js → workspace-open-location-menu-DN7E_-eH.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-BlhFT1q9.js → xopc-cloud-account-card-CGs77iKb.js} +1 -1
- package/dist/gateway/static/root/index.html +83 -82
- package/dist/package.js +1 -1
- package/dist/packages/endpoint-tools-client/src/index.js +309 -17
- package/dist/packages/endpoint-tools-protocol/src/index.js +62 -10
- package/dist/packages/endpoint-tools-protocol/src/provider-execution.js +32 -0
- package/dist/packages/endpoint-tools-protocol/src/providers.js +233 -0
- package/dist/packages/gateway-contract/src/clarifications.js +1 -1
- package/dist/packages/gateway-contract/src/device-pairing.js +2 -1
- package/dist/packages/gateway-contract/src/device-request-proof.js +32 -0
- package/dist/packages/gateway-contract/src/index.js +2 -2
- package/dist/packages/realtime-client/src/index.js +1 -0
- package/dist/packages/realtime-protocol/src/index.js +4 -1
- package/dist/src/agent/agent-manager.js +1 -1
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/commands/command-registry.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/embedded/session-runner.js +7 -2
- package/dist/src/agent/embedded/tool-metadata.d.ts +1 -1
- package/dist/src/agent/embedded/tool-search-extension.d.ts +1 -0
- package/dist/src/agent/embedded/tool-search-extension.js +35 -2
- package/dist/src/agent/external-tools/cliProvider.js +2 -2
- package/dist/src/agent/external-tools/composio-provider.js +2 -2
- package/dist/src/agent/external-tools/endpoint-provider.d.ts +3 -0
- package/dist/src/agent/external-tools/endpoint-provider.js +96 -18
- package/dist/src/agent/external-tools/index.js +2 -2
- package/dist/src/agent/external-tools/personal-request-scope.js +6 -0
- package/dist/src/agent/external-tools/read-policy.js +15 -8
- package/dist/src/agent/external-tools/service.js +8 -0
- package/dist/src/agent/external-tools/types.d.ts +1 -0
- package/dist/src/agent/inbound/inbound-loop.js +2 -1
- package/dist/src/agent/mcp/continuation-guard.js +1 -1
- package/dist/src/agent/mcp/conversation-setup.js +1 -1
- package/dist/src/agent/mcp/discovery.js +1 -1
- package/dist/src/agent/orchestration/agent-orchestrator.d.ts +2 -1
- package/dist/src/agent/orchestration/agent-orchestrator.js +6 -5
- package/dist/src/agent/service.js +1 -1
- package/dist/src/agent/skills/index.js +1 -1
- package/dist/src/agent/skills/managed-store.js +1 -1
- package/dist/src/agent/skills/skill-manage-ops.js +1 -1
- package/dist/src/agent/tool-manuals/computer.d.ts +1 -1
- package/dist/src/agent/tool-manuals/computer.js +2 -0
- package/dist/src/agent/tools/clarify-tool.d.ts +1 -0
- package/dist/src/agent/tools/device-use-tool.d.ts +9 -0
- package/dist/src/agent/tools/device-use-tool.js +158 -0
- package/dist/src/agent/tools/factory.js +24 -3
- package/dist/src/agent/tools/personal-read-tool.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/agent-catalog/capabilities.js +2 -2
- package/dist/src/agent-catalog/repository.js +1 -1
- package/dist/src/automations/api/routes.js +2 -2
- package/dist/src/automations/capabilities/drafts.js +1 -1
- package/dist/src/automations/capabilities/write.js +1 -1
- package/dist/src/automations/configuration-conversation.js +1 -1
- package/dist/src/automations/mcp-source.js +1 -1
- package/dist/src/automations/service/action-executor.js +10 -2
- package/dist/src/browser/providers/browser-ext-install.js +1 -1
- package/dist/src/browser/remote/device-driver.js +7 -3
- package/dist/src/browser/remote/device-target.d.ts +1 -1
- package/dist/src/browser/remote/device-target.js +8 -6
- package/dist/src/capabilities/runtime/dispatcher.js +1 -1
- package/dist/src/capabilities/runtime/product.js +1 -1
- package/dist/src/channels/lifecycle-supervisor.js +2 -1
- package/dist/src/channels/verified-inbound.d.ts +13 -0
- package/dist/src/channels/verified-inbound.js +29 -0
- package/dist/src/cli/command-loaders.js +1 -0
- package/dist/src/cli/command-manifest.js +4 -0
- package/dist/src/cli/commands/agents.js +1 -1
- package/dist/src/cli/commands/device-host.d.ts +1 -0
- package/dist/src/cli/commands/device-host.js +52 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/commands/onboard/model.js +1 -1
- package/dist/src/cli/index.js +1 -1
- package/dist/src/cli/utils/init-workspace-core.js +1 -1
- package/dist/src/computer/diagnostics.d.ts +3 -3
- package/dist/src/computer/endpoint-transport.js +1 -1
- package/dist/src/computer/errors.js +4 -0
- package/dist/src/computer/evaluation.d.ts +2 -2
- package/dist/src/computer/flows.js +1 -1
- package/dist/src/computer/runtime.d.ts +1 -0
- package/dist/src/computer/runtime.js +25 -3
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/schema.d.ts +2 -0
- package/dist/src/config/schema.js +1 -0
- package/dist/src/connectors/composio-triggers.js +1 -1
- package/dist/src/endpoint-tools/bridge-host.d.ts +5 -4
- package/dist/src/endpoint-tools/bridge-host.js +165 -30
- package/dist/src/endpoint-tools/bridge.d.ts +1 -1
- package/dist/src/endpoint-tools/bridge.js +39 -7
- package/dist/src/endpoint-tools/capability-catalog.d.ts +1 -1
- package/dist/src/endpoint-tools/capability-catalog.js +1 -1
- package/dist/src/endpoint-tools/delegation.d.ts +60 -0
- package/dist/src/endpoint-tools/delegation.js +130 -0
- package/dist/src/endpoint-tools/desktop-execution.js +1 -1
- package/dist/src/endpoint-tools/device-host.d.ts +98 -0
- package/dist/src/endpoint-tools/device-host.js +89 -0
- package/dist/src/endpoint-tools/execution-actor.d.ts +6 -0
- package/dist/src/endpoint-tools/execution-actor.js +53 -0
- package/dist/src/endpoint-tools/grant-service.d.ts +7 -4
- package/dist/src/endpoint-tools/grant-service.js +12 -4
- package/dist/src/endpoint-tools/host-credentials.d.ts +42 -0
- package/dist/src/endpoint-tools/host-credentials.js +144 -0
- package/dist/src/endpoint-tools/index.d.ts +1 -1
- package/dist/src/endpoint-tools/index.js +3 -3
- package/dist/src/endpoint-tools/invocation-service.d.ts +47 -4
- package/dist/src/endpoint-tools/invocation-service.js +328 -36
- package/dist/src/endpoint-tools/mcp-provider.d.ts +32 -0
- package/dist/src/endpoint-tools/mcp-provider.js +258 -0
- package/dist/src/endpoint-tools/policy.js +0 -3
- package/dist/src/endpoint-tools/provider-catalog.d.ts +45 -0
- package/dist/src/endpoint-tools/provider-catalog.js +202 -0
- package/dist/src/endpoint-tools/provider-operation-journal.d.ts +18 -0
- package/dist/src/endpoint-tools/provider-operation-journal.js +111 -0
- package/dist/src/endpoint-tools/provider-operation-status.d.ts +33 -0
- package/dist/src/endpoint-tools/provider-operation-status.js +80 -0
- package/dist/src/endpoint-tools/registry.d.ts +14 -1
- package/dist/src/endpoint-tools/registry.js +15 -1
- package/dist/src/endpoint-tools/result-projector.d.ts +1 -2
- package/dist/src/endpoint-tools/result-projector.js +3 -11
- package/dist/src/endpoint-tools/runtime.d.ts +10 -2
- package/dist/src/endpoint-tools/runtime.js +102 -11
- package/dist/src/endpoint-tools/target-resolver.d.ts +8 -3
- package/dist/src/endpoint-tools/target-resolver.js +24 -5
- package/dist/src/endpoint-tools/task-targets.d.ts +38 -0
- package/dist/src/endpoint-tools/task-targets.js +95 -0
- package/dist/src/endpoint-tools/upload-service.d.ts +34 -1
- package/dist/src/endpoint-tools/upload-service.js +88 -2
- package/dist/src/execution-environments/local-worktree-manager.js +1 -1
- package/dist/src/extensions/agent-plugins/skill-catalog.js +1 -1
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/global-defaults-admin.js +1 -1
- package/dist/src/gateway/hono/routes/agent-stream.js +12 -1
- package/dist/src/gateway/hono/routes/agents.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
- package/dist/src/gateway/hono/routes/device-authorizations.js +4 -10
- package/dist/src/gateway/hono/routes/device-hosts.d.ts +3 -0
- package/dist/src/gateway/hono/routes/device-hosts.js +82 -0
- package/dist/src/gateway/hono/routes/device-providers.d.ts +3 -0
- package/dist/src/gateway/hono/routes/device-providers.js +297 -0
- package/dist/src/gateway/hono/routes/device-targets.d.ts +3 -0
- package/dist/src/gateway/hono/routes/device-targets.js +117 -0
- package/dist/src/gateway/hono/routes/endpoint-compatibility.js +2 -1
- package/dist/src/gateway/hono/routes/endpoint-tools.js +2 -78
- package/dist/src/gateway/hono/routes/lazy-bundles.js +24 -8
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/phone-setup.js +1 -1
- package/dist/src/gateway/hono/routes/projects.js +2 -2
- package/dist/src/gateway/hono/routes/session-command-handler.js +2 -0
- package/dist/src/gateway/hono/routes/session-input-handler.js +3 -1
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/image-generation-setup.js +1 -1
- package/dist/src/gateway/security/device-request-proof.js +8 -18
- package/dist/src/gateway/security/gateway-scopes.js +1 -0
- package/dist/src/gateway/service/agent-runner.d.ts +3 -0
- package/dist/src/gateway/service/agent-runner.js +21 -5
- package/dist/src/gateway/service/config-coordinator.d.ts +1 -0
- package/dist/src/gateway/service.js +5 -0
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/imports/importService.js +1 -1
- package/dist/src/local-apps/service.js +1 -1
- package/dist/src/mcp/capability-server.js +1 -1
- package/dist/src/notes/agent-context.d.ts +3 -0
- package/dist/src/notes/agent-context.js +32 -4
- package/dist/src/personal-agent/proactivity/repository.js +1 -1
- package/dist/src/personal-agent/proactivity/service.js +1 -1
- package/dist/src/personal-agent/service.js +1 -1
- package/dist/src/phone/assistance.js +1 -1
- package/dist/src/phone/location-environment.js +1 -1
- package/dist/src/phone/repository.js +1 -1
- package/dist/src/phone/setup/service.js +1 -1
- package/dist/src/realtime/runtime.js +5 -0
- package/dist/src/runtime-tools/archive.js +1 -1
- package/dist/src/session/session-context-for-llm.js +9 -1
- package/dist/src/session/store.js +1 -1
- package/dist/src/share/hosted-session-share.js +1 -1
- package/dist/src/share/share-store.js +1 -1
- package/dist/src/storage/sqlite/clarification-wait-repository.d.ts +7 -1
- package/dist/src/storage/sqlite/clarification-wait-repository.js +40 -2
- package/dist/src/storage/sqlite/device-access-repository.d.ts +2 -8
- package/dist/src/storage/sqlite/device-access-repository.js +1 -3
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.js +2 -2
- package/dist/src/storage/sqlite/index.d.ts +0 -1
- package/dist/src/storage/sqlite/index.js +3 -3
- package/dist/src/storage/sqlite/schema.d.ts +2 -2
- package/dist/src/storage/sqlite/schema.js +7 -7
- package/dist/src/storage/sqlite/schema.sql +2 -10
- package/dist/src/storage/sqlite/session-input-repository.js +8 -0
- package/dist/src/storage/sqlite/upgrades/270_device_bridge_kind.sql +30 -0
- package/dist/src/tasks/capabilities/read.js +2 -2
- package/dist/src/tasks/capabilities/write.js +1 -1
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/voice/realtime/persona-context.js +1 -1
- package/package.json +2 -2
- package/dist/gateway/static/root/assets/chat-page-CeHOmJqM.js +0 -72
- package/dist/gateway/static/root/assets/gateway-realtime-hnEaDFaA.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-ugwtyD4q.js +0 -1
- package/dist/gateway/static/root/assets/gateway-restart-kwv0njYq.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-CxYPJTy8.js +0 -1
- package/dist/gateway/static/root/assets/index-DE2bG5EI.css +0 -1
- package/dist/gateway/static/root/assets/index-PewrhviZ.js +0 -11
- package/dist/gateway/static/root/assets/languages-zXtNocoy.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-BgdAP0kf.js +0 -1
- package/dist/gateway/static/root/assets/navigation-D62kPsA9.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-DWIWloib.js +0 -5
- package/dist/gateway/static/root/assets/note-image-lightbox-BbNYW2Rw.js +0 -1
- package/dist/gateway/static/root/assets/page-context-capture-button-B9L7V_n2.js +0 -1
- package/dist/gateway/static/root/assets/page-header-store-YZfSLNTg.js +0 -1
- package/dist/gateway/static/root/assets/product-preview-content-CGbqoID0.js +0 -1
- package/dist/gateway/static/root/assets/product-preview-modal-0wvIDcVr.js +0 -2
- package/dist/gateway/static/root/assets/project-detail-page-Bkxs8knZ.js +0 -7
- package/dist/gateway/static/root/assets/route-preload-BVo8JPwW.js +0 -2
- package/dist/gateway/static/root/assets/settings-advanced-gate-DyGT3o1e.js +0 -1
- package/dist/gateway/static/root/assets/use-file-preview-expanded-9DED7ohY.js +0 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-CmSYxTmk.js +0 -1
- package/dist/packages/endpoint-tools-protocol/src/bridge.js +0 -105
- package/dist/packages/gateway-contract/src/desktop-chat.js +0 -29
- package/dist/src/endpoint-tools/binding-service.d.ts +0 -24
- package/dist/src/endpoint-tools/binding-service.js +0 -57
- package/dist/src/gateway/hono/routes/desktop-chat.d.ts +0 -3
- package/dist/src/gateway/hono/routes/desktop-chat.js +0 -30
- package/dist/src/storage/sqlite/endpoint-session-binding-repository.d.ts +0 -9
- package/dist/src/storage/sqlite/endpoint-session-binding-repository.js +0 -41
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { bridgeDescriptor } from "../../packages/endpoint-tools-protocol/src/bridge.js";
|
|
2
|
-
import { init_src } from "../../packages/endpoint-tools-protocol/src/index.js";
|
|
3
1
|
import { EndpointToolRegistry } from "../../packages/endpoint-tools-client/src/index.js";
|
|
4
2
|
import { z } from "zod";
|
|
5
3
|
//#region src/endpoint-tools/bridge.ts
|
|
6
|
-
init_src();
|
|
7
4
|
const resourceSchema = z.object({
|
|
8
5
|
resourceId: z.string().regex(/^[a-zA-Z0-9._:-]{1,128}$/),
|
|
9
6
|
name: z.string().min(1).max(80),
|
|
@@ -23,8 +20,27 @@ function createDeviceBridge(adapters, now = Date.now) {
|
|
|
23
20
|
read: adapter.read.bind(adapter)
|
|
24
21
|
});
|
|
25
22
|
}
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
const descriptor = (name, description, inputSchema) => ({
|
|
24
|
+
name,
|
|
25
|
+
title: name === "list_resources" ? "Discover sensors" : "Read sensor",
|
|
26
|
+
description,
|
|
27
|
+
inputSchema,
|
|
28
|
+
effect: "read",
|
|
29
|
+
sensitivity: "public",
|
|
30
|
+
confirmation: "never",
|
|
31
|
+
requiresForeground: false,
|
|
32
|
+
requiredPermissions: [],
|
|
33
|
+
timeoutMs: 1e4,
|
|
34
|
+
maxConcurrency: 1,
|
|
35
|
+
supportsCancellation: true,
|
|
36
|
+
idempotent: true,
|
|
37
|
+
resultKinds: ["json"]
|
|
38
|
+
});
|
|
39
|
+
const definitions = [{
|
|
40
|
+
descriptor: descriptor("list_resources", "List temperature and humidity sensors with stable resource IDs and simulation labels.", {
|
|
41
|
+
type: "object",
|
|
42
|
+
additionalProperties: false
|
|
43
|
+
}),
|
|
28
44
|
execute: async (args) => {
|
|
29
45
|
z.object({}).strict().parse(args);
|
|
30
46
|
return { content: [{
|
|
@@ -33,7 +49,15 @@ function createDeviceBridge(adapters, now = Date.now) {
|
|
|
33
49
|
}] };
|
|
34
50
|
}
|
|
35
51
|
}, {
|
|
36
|
-
descriptor:
|
|
52
|
+
descriptor: descriptor("read_sensor", "Read a fresh temperature or humidity sample by resourceId. Simulated samples are marked; unavailable values are null.", {
|
|
53
|
+
type: "object",
|
|
54
|
+
properties: { resourceId: {
|
|
55
|
+
type: "string",
|
|
56
|
+
maxLength: 128
|
|
57
|
+
} },
|
|
58
|
+
required: ["resourceId"],
|
|
59
|
+
additionalProperties: false
|
|
60
|
+
}),
|
|
37
61
|
execute: async (args, context) => {
|
|
38
62
|
const { resourceId } = z.object({ resourceId: z.string() }).strict().parse(args);
|
|
39
63
|
const adapter = resources.get(resourceId);
|
|
@@ -55,7 +79,15 @@ function createDeviceBridge(adapters, now = Date.now) {
|
|
|
55
79
|
}
|
|
56
80
|
}] };
|
|
57
81
|
}
|
|
58
|
-
}]
|
|
82
|
+
}];
|
|
83
|
+
const registry = new EndpointToolRegistry([]);
|
|
84
|
+
registry.registerProvider({
|
|
85
|
+
localId: "sensors",
|
|
86
|
+
title: "Environment sensors",
|
|
87
|
+
summary: "Read connected temperature and humidity sensors",
|
|
88
|
+
tools: definitions
|
|
89
|
+
});
|
|
90
|
+
return registry;
|
|
59
91
|
}
|
|
60
92
|
function simulatedEnvironmentSensors(now = Date.now) {
|
|
61
93
|
return [{
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** Server-owned targeting rules; device descriptors cannot change these defaults. */
|
|
2
|
-
export declare function deviceCapabilityTarget(toolName: string): 'turn_origin' | '
|
|
2
|
+
export declare function deviceCapabilityTarget(toolName: string): 'turn_origin' | 'task_target';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/** Server-owned targeting rules; device descriptors cannot change these defaults. */
|
|
3
3
|
function deviceCapabilityTarget(toolName) {
|
|
4
4
|
if (/^(mobile|desktop|web|browser)\.device\./.test(toolName) || /^(mobile|desktop|web)\.(file\.pick|media\.pick|camera\.capture|contacts\.(pick|search|get)|calendar\.query_(events|free_busy))$/.test(toolName) || toolName === "desktop.clipboard.read" || toolName === "desktop.screen.capture" || toolName === "web.page.get_selection") return "turn_origin";
|
|
5
|
-
return "
|
|
5
|
+
return "task_target";
|
|
6
6
|
}
|
|
7
7
|
//#endregion
|
|
8
8
|
export { deviceCapabilityTarget };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { Automation } from '../automations/domain/types.js';
|
|
3
|
+
import type { EndpointConnectionSnapshot, EndpointRegistry } from './registry.js';
|
|
4
|
+
declare const subjectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
5
|
+
kind: z.ZodLiteral<"channel">;
|
|
6
|
+
channel: z.ZodString;
|
|
7
|
+
accountId: z.ZodString;
|
|
8
|
+
chatId: z.ZodString;
|
|
9
|
+
senderId: z.ZodString;
|
|
10
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
11
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
12
|
+
kind: z.ZodLiteral<"automation">;
|
|
13
|
+
automationId: z.ZodString;
|
|
14
|
+
}, z.core.$strict>], "kind">;
|
|
15
|
+
export declare const deviceDelegationRequestSchema: z.ZodObject<{
|
|
16
|
+
subject: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
17
|
+
kind: z.ZodLiteral<"channel">;
|
|
18
|
+
channel: z.ZodString;
|
|
19
|
+
accountId: z.ZodString;
|
|
20
|
+
chatId: z.ZodString;
|
|
21
|
+
senderId: z.ZodString;
|
|
22
|
+
threadId: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
24
|
+
kind: z.ZodLiteral<"automation">;
|
|
25
|
+
automationId: z.ZodString;
|
|
26
|
+
}, z.core.$strict>], "kind">;
|
|
27
|
+
endpointId: z.ZodString;
|
|
28
|
+
toolName: z.ZodString;
|
|
29
|
+
arguments: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
30
|
+
expiresAt: z.ZodNumber;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
export type DeviceDelegationSubject = z.infer<typeof subjectSchema>;
|
|
33
|
+
type Request = z.infer<typeof deviceDelegationRequestSchema>;
|
|
34
|
+
type Grant = {
|
|
35
|
+
id: string;
|
|
36
|
+
subject: DeviceDelegationSubject;
|
|
37
|
+
endpointId: string;
|
|
38
|
+
principalId: string;
|
|
39
|
+
toolName: string;
|
|
40
|
+
providerDigest: string;
|
|
41
|
+
argumentsDigest: string;
|
|
42
|
+
expiresAt: number;
|
|
43
|
+
issuedAt: number;
|
|
44
|
+
automationContract?: string;
|
|
45
|
+
};
|
|
46
|
+
export declare function issueDeviceDelegation(request: Request, registry: EndpointRegistry): Grant;
|
|
47
|
+
export declare function listDeviceDelegations(): Grant[];
|
|
48
|
+
export declare function revokeDeviceDelegation(id: string): void;
|
|
49
|
+
/** Call only from the verified channel or automation dispatcher, with host-owned run identity. */
|
|
50
|
+
export declare function withDeviceDelegation<T>(input: {
|
|
51
|
+
subject: DeviceDelegationSubject;
|
|
52
|
+
acceptedAt: number;
|
|
53
|
+
automation?: Automation;
|
|
54
|
+
} | undefined, conversationId: string, runId: string, execute: () => T): T;
|
|
55
|
+
export declare function resolveDeviceDelegation(conversationId: string, runId: string | undefined, registry: EndpointRegistry): {
|
|
56
|
+
grant?: Grant;
|
|
57
|
+
endpoint?: EndpointConnectionSnapshot;
|
|
58
|
+
} | undefined;
|
|
59
|
+
export declare function deviceDelegationAllowsArguments(grant: Grant, args: Record<string, unknown>): boolean;
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { init_connection, isXopcDatabaseOpen } from "../storage/sqlite/connection.js";
|
|
2
|
+
import { canonicalJson, init_src } from "../../packages/endpoint-tools-protocol/src/index.js";
|
|
3
|
+
import { DurableState } from "../storage/sqlite/durable-state.js";
|
|
4
|
+
import { getEndpointPrincipal } from "../storage/sqlite/endpoint-principal-repository.js";
|
|
5
|
+
import { getAutomation } from "../automations/storage/automation-repository.js";
|
|
6
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
//#region src/endpoint-tools/delegation.ts
|
|
10
|
+
init_src();
|
|
11
|
+
init_connection();
|
|
12
|
+
const identifier = z.string().trim().min(1).max(200);
|
|
13
|
+
const subjectSchema = z.discriminatedUnion("kind", [z.strictObject({
|
|
14
|
+
kind: z.literal("channel"),
|
|
15
|
+
channel: identifier,
|
|
16
|
+
accountId: identifier,
|
|
17
|
+
chatId: identifier,
|
|
18
|
+
senderId: identifier,
|
|
19
|
+
threadId: identifier.optional()
|
|
20
|
+
}), z.strictObject({
|
|
21
|
+
kind: z.literal("automation"),
|
|
22
|
+
automationId: identifier
|
|
23
|
+
})]);
|
|
24
|
+
const deviceDelegationRequestSchema = z.strictObject({
|
|
25
|
+
subject: subjectSchema,
|
|
26
|
+
endpointId: identifier,
|
|
27
|
+
toolName: z.string().min(1).max(256),
|
|
28
|
+
arguments: z.record(z.string(), z.unknown()),
|
|
29
|
+
expiresAt: z.number().int().positive()
|
|
30
|
+
});
|
|
31
|
+
const grants = new DurableState("device.delegations");
|
|
32
|
+
const runs = new DurableState("device.delegated-runs");
|
|
33
|
+
const scope = new AsyncLocalStorage();
|
|
34
|
+
const digest = (input) => createHash("sha256").update(canonicalJson(input)).digest("hex");
|
|
35
|
+
const key = (subject) => canonicalJson(subject);
|
|
36
|
+
const runKey = (run) => JSON.stringify([run.conversationId, run.runId]);
|
|
37
|
+
const MAX_TTL = 720 * 60 * 6e4;
|
|
38
|
+
function automationContract(automation) {
|
|
39
|
+
if (!automation?.enabled || automation.action.kind !== "agent") return;
|
|
40
|
+
return digest(JSON.parse(JSON.stringify({
|
|
41
|
+
createdAtMs: automation.createdAtMs,
|
|
42
|
+
action: automation.action,
|
|
43
|
+
safety: automation.safety
|
|
44
|
+
})));
|
|
45
|
+
}
|
|
46
|
+
function issueDeviceDelegation(request, registry) {
|
|
47
|
+
const now = Date.now();
|
|
48
|
+
if (request.expiresAt <= now || request.expiresAt > now + MAX_TTL) throw new Error("Delegation expiry must be within 30 days");
|
|
49
|
+
const endpoint = registry.get(request.endpointId), tool = registry.getTool(request.endpointId, request.toolName);
|
|
50
|
+
if (!endpoint || !tool?.provider || tool.provider.artifactInput || tool.descriptor.sensitivity !== "public") throw new Error("Select an admitted public Provider tool");
|
|
51
|
+
const subjectKey = key(request.subject);
|
|
52
|
+
const existing = grants.entries();
|
|
53
|
+
for (const [id, grant] of existing) if (grant.expiresAt <= now) grants.delete(id);
|
|
54
|
+
if (!grants.get(subjectKey) && grants.values(256).length >= 256) throw new Error("Device delegation capacity reached");
|
|
55
|
+
const automation = request.subject.kind === "automation" ? getAutomation(request.subject.automationId) : null;
|
|
56
|
+
const contract = automationContract(automation);
|
|
57
|
+
if (request.subject.kind === "automation" && !contract) throw new Error("Automation must be enabled and use an agent action");
|
|
58
|
+
if (automation && tool.descriptor.effect !== "read" && automation.safety?.mode !== "auto_apply") throw new Error("Automation policy does not permit delegated mutations");
|
|
59
|
+
const grant = {
|
|
60
|
+
id: randomUUID(),
|
|
61
|
+
subject: request.subject,
|
|
62
|
+
endpointId: endpoint.endpointId,
|
|
63
|
+
principalId: endpoint.principalId,
|
|
64
|
+
toolName: request.toolName,
|
|
65
|
+
providerDigest: tool.provider.digest,
|
|
66
|
+
argumentsDigest: digest(request.arguments),
|
|
67
|
+
expiresAt: request.expiresAt,
|
|
68
|
+
issuedAt: now,
|
|
69
|
+
...contract ? { automationContract: contract } : {}
|
|
70
|
+
};
|
|
71
|
+
grants.set(subjectKey, grant);
|
|
72
|
+
return grant;
|
|
73
|
+
}
|
|
74
|
+
function listDeviceDelegations() {
|
|
75
|
+
return grants.values(256).filter((grant) => grant.expiresAt > Date.now());
|
|
76
|
+
}
|
|
77
|
+
function revokeDeviceDelegation(id) {
|
|
78
|
+
const match = grants.entries().find(([, grant]) => grant.id === id);
|
|
79
|
+
if (match) grants.delete(match[0]);
|
|
80
|
+
}
|
|
81
|
+
/** Call only from the verified channel or automation dispatcher, with host-owned run identity. */
|
|
82
|
+
function withDeviceDelegation(input, conversationId, runId, execute) {
|
|
83
|
+
if (!input || !isXopcDatabaseOpen()) return scope.exit(execute);
|
|
84
|
+
const { subject } = input;
|
|
85
|
+
const grant = grants.get(key(subject)), now = Date.now();
|
|
86
|
+
if (!grant || grant.expiresAt <= now || grant.issuedAt > input.acceptedAt || subject.kind === "automation" && (!input.automation || automationContract(input.automation) !== grant.automationContract)) return scope.exit(execute);
|
|
87
|
+
const authority = {
|
|
88
|
+
subject,
|
|
89
|
+
grantId: grant.id,
|
|
90
|
+
conversationId,
|
|
91
|
+
runId,
|
|
92
|
+
expiresAt: Math.min(grant.expiresAt, now + 60 * 6e4)
|
|
93
|
+
};
|
|
94
|
+
const id = runKey(authority);
|
|
95
|
+
const existing = runs.get(id);
|
|
96
|
+
if (existing) return existing.grantId === grant.id && key(existing.subject) === key(subject) ? scope.run(existing, execute) : scope.exit(execute);
|
|
97
|
+
const all = runs.entries();
|
|
98
|
+
for (const [recordId, record] of all) if (record.expiresAt <= now) runs.delete(recordId);
|
|
99
|
+
if (runs.values(1024).length >= 1024) return scope.exit(execute);
|
|
100
|
+
runs.set(id, authority);
|
|
101
|
+
return scope.run(authority, execute);
|
|
102
|
+
}
|
|
103
|
+
function resolveDeviceDelegation(conversationId, runId, registry) {
|
|
104
|
+
const authority = scope.getStore();
|
|
105
|
+
if (!authority || authority.conversationId !== conversationId || authority.runId !== runId) return;
|
|
106
|
+
if (!isXopcDatabaseOpen()) return {};
|
|
107
|
+
const now = Date.now(), grant = grants.get(key(authority.subject));
|
|
108
|
+
if (!grant || grant.id !== authority.grantId || grant.expiresAt <= now || authority.expiresAt <= now) return {};
|
|
109
|
+
if (authority.subject.kind === "automation" && automationContract(getAutomation(authority.subject.automationId)) !== grant.automationContract) return {};
|
|
110
|
+
const endpoint = registry.get(grant.endpointId), tool = registry.getTool(grant.endpointId, grant.toolName);
|
|
111
|
+
const principal = getEndpointPrincipal(grant.principalId);
|
|
112
|
+
if (!principal || principal.revokedAt !== void 0 || endpoint?.principalId !== grant.principalId || tool?.provider?.digest !== grant.providerDigest || authority.connectionId && authority.connectionId !== endpoint.connectionId) return {};
|
|
113
|
+
if (!authority.connectionId) {
|
|
114
|
+
const pinned = {
|
|
115
|
+
...authority,
|
|
116
|
+
connectionId: endpoint.connectionId
|
|
117
|
+
};
|
|
118
|
+
runs.set(runKey(authority), pinned);
|
|
119
|
+
authority.connectionId = pinned.connectionId;
|
|
120
|
+
}
|
|
121
|
+
return {
|
|
122
|
+
grant,
|
|
123
|
+
endpoint
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function deviceDelegationAllowsArguments(grant, args) {
|
|
127
|
+
return grant.argumentsDigest === digest(args);
|
|
128
|
+
}
|
|
129
|
+
//#endregion
|
|
130
|
+
export { deviceDelegationAllowsArguments, deviceDelegationRequestSchema, issueDeviceDelegation, listDeviceDelegations, resolveDeviceDelegation, revokeDeviceDelegation, withDeviceDelegation };
|
|
@@ -3,8 +3,8 @@ import { init_src } from "../../packages/endpoint-tools-protocol/src/index.js";
|
|
|
3
3
|
import { init_src as init_src$1 } from "../../packages/computer-control-contract/src/index.js";
|
|
4
4
|
import "../../packages/browser-control-contract/src/remote.js";
|
|
5
5
|
import { getDesktopExecutionGrant } from "../storage/sqlite/desktop-execution-repository.js";
|
|
6
|
-
import { desktopDeviceEndpointKey } from "./desktop-observation.js";
|
|
7
6
|
import { endpointToolRevision } from "./registry.js";
|
|
7
|
+
import { desktopDeviceEndpointKey } from "./desktop-observation.js";
|
|
8
8
|
//#region src/endpoint-tools/desktop-execution.ts
|
|
9
9
|
init_src();
|
|
10
10
|
init_src$1();
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { EndpointToolRegistry, type EndpointToolApprovalRequest } from '@xopcai/endpoint-tools-client';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
export declare const deviceHostConfigSchema: z.ZodObject<{
|
|
4
|
+
gatewayUrl: z.ZodURL;
|
|
5
|
+
tokenEnv: z.ZodString;
|
|
6
|
+
identityPath: z.ZodString;
|
|
7
|
+
displayName: z.ZodString;
|
|
8
|
+
providers: z.ZodArray<z.ZodObject<{
|
|
9
|
+
title: z.ZodString;
|
|
10
|
+
summary: z.ZodString;
|
|
11
|
+
localId: z.ZodString;
|
|
12
|
+
gatewayFormInput: z.ZodOptional<z.ZodLiteral<1>>;
|
|
13
|
+
server: z.ZodUnion<readonly [z.ZodObject<{
|
|
14
|
+
command: z.ZodString;
|
|
15
|
+
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
16
|
+
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
17
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
19
|
+
url: z.ZodURL;
|
|
20
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
21
|
+
}, z.core.$strict>]>;
|
|
22
|
+
policies: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
23
|
+
sensitivity: z.ZodEnum<{
|
|
24
|
+
public: "public";
|
|
25
|
+
personal: "personal";
|
|
26
|
+
}>;
|
|
27
|
+
resourceId: z.ZodOptional<z.ZodString>;
|
|
28
|
+
effect: z.ZodEnum<{
|
|
29
|
+
read: "read";
|
|
30
|
+
write: "write";
|
|
31
|
+
destructive: "destructive";
|
|
32
|
+
}>;
|
|
33
|
+
confirmation: z.ZodEnum<{
|
|
34
|
+
never: "never";
|
|
35
|
+
always: "always";
|
|
36
|
+
}>;
|
|
37
|
+
requiresForeground: z.ZodBoolean;
|
|
38
|
+
requiredPermissions: z.ZodArray<z.ZodString>;
|
|
39
|
+
timeoutMs: z.ZodNumber;
|
|
40
|
+
maxConcurrency: z.ZodNumber;
|
|
41
|
+
supportsCancellation: z.ZodBoolean;
|
|
42
|
+
idempotent: z.ZodBoolean;
|
|
43
|
+
resultKinds: z.ZodArray<z.ZodEnum<{
|
|
44
|
+
json: "json";
|
|
45
|
+
file: "file";
|
|
46
|
+
text: "text";
|
|
47
|
+
}>>;
|
|
48
|
+
artifactInput: z.ZodOptional<z.ZodString>;
|
|
49
|
+
}, z.core.$strict>>;
|
|
50
|
+
resourcePrefixes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
51
|
+
}, z.core.$strict>>;
|
|
52
|
+
}, z.core.$strict>;
|
|
53
|
+
/** Explicit device-local configuration; never reads Gateway-owned MCP configuration or credentials. */
|
|
54
|
+
export declare function startDeviceHost(config: z.infer<typeof deviceHostConfigSchema>, options?: {
|
|
55
|
+
confirm?: (request: EndpointToolApprovalRequest) => Promise<boolean>;
|
|
56
|
+
onError?: (providerId: string, error: Error) => void;
|
|
57
|
+
}): Promise<{
|
|
58
|
+
registry: EndpointToolRegistry;
|
|
59
|
+
principalId: string;
|
|
60
|
+
endpointId: string;
|
|
61
|
+
close: () => Promise<void>;
|
|
62
|
+
}>;
|
|
63
|
+
export declare function readDeviceHostConfig(path: string): Promise<{
|
|
64
|
+
gatewayUrl: string;
|
|
65
|
+
tokenEnv: string;
|
|
66
|
+
identityPath: string;
|
|
67
|
+
displayName: string;
|
|
68
|
+
providers: {
|
|
69
|
+
title: string;
|
|
70
|
+
summary: string;
|
|
71
|
+
localId: string;
|
|
72
|
+
policies: Record<string, {
|
|
73
|
+
sensitivity: "public" | "personal";
|
|
74
|
+
effect: "read" | "write" | "destructive";
|
|
75
|
+
confirmation: "never" | "always";
|
|
76
|
+
requiresForeground: boolean;
|
|
77
|
+
requiredPermissions: string[];
|
|
78
|
+
timeoutMs: number;
|
|
79
|
+
maxConcurrency: number;
|
|
80
|
+
supportsCancellation: boolean;
|
|
81
|
+
idempotent: boolean;
|
|
82
|
+
resultKinds: ("json" | "file" | "text")[];
|
|
83
|
+
resourceId?: string;
|
|
84
|
+
artifactInput?: string;
|
|
85
|
+
}>;
|
|
86
|
+
gatewayFormInput?: 1;
|
|
87
|
+
server?: {
|
|
88
|
+
command: string;
|
|
89
|
+
args?: string[];
|
|
90
|
+
env?: Record<string, string>;
|
|
91
|
+
cwd?: string;
|
|
92
|
+
} | {
|
|
93
|
+
url: string;
|
|
94
|
+
headers?: Record<string, string>;
|
|
95
|
+
};
|
|
96
|
+
resourcePrefixes?: string[];
|
|
97
|
+
}[];
|
|
98
|
+
}>;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { providerIdentitySchema, providerToolSchema } from "../../packages/endpoint-tools-protocol/src/providers.js";
|
|
2
|
+
import { init_src } from "../../packages/endpoint-tools-protocol/src/index.js";
|
|
3
|
+
import { EndpointToolRegistry } from "../../packages/endpoint-tools-client/src/index.js";
|
|
4
|
+
import { connectDeviceBridge } from "./bridge-host.js";
|
|
5
|
+
import { connectDeviceMcpProvider } from "./mcp-provider.js";
|
|
6
|
+
import { resolve } from "node:path";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
import { readFile } from "node:fs/promises";
|
|
9
|
+
//#region src/endpoint-tools/device-host.ts
|
|
10
|
+
init_src();
|
|
11
|
+
const policySchema = providerToolSchema.omit({
|
|
12
|
+
name: true,
|
|
13
|
+
title: true,
|
|
14
|
+
description: true,
|
|
15
|
+
inputSchema: true,
|
|
16
|
+
outputSchema: true
|
|
17
|
+
});
|
|
18
|
+
const deviceHostConfigSchema = z.strictObject({
|
|
19
|
+
gatewayUrl: z.url(),
|
|
20
|
+
tokenEnv: z.string().regex(/^[A-Z][A-Z0-9_]*$/),
|
|
21
|
+
identityPath: z.string().min(1),
|
|
22
|
+
displayName: z.string().min(1).max(80),
|
|
23
|
+
providers: z.array(providerIdentitySchema.omit({
|
|
24
|
+
instructions: true,
|
|
25
|
+
durableOperations: true
|
|
26
|
+
}).extend({
|
|
27
|
+
server: z.union([z.strictObject({
|
|
28
|
+
command: z.string().min(1),
|
|
29
|
+
args: z.array(z.string()).max(100).optional(),
|
|
30
|
+
env: z.record(z.string(), z.string()).optional(),
|
|
31
|
+
cwd: z.string().optional()
|
|
32
|
+
}), z.strictObject({
|
|
33
|
+
url: z.url(),
|
|
34
|
+
headers: z.record(z.string(), z.string()).optional()
|
|
35
|
+
})]),
|
|
36
|
+
policies: z.record(z.string(), policySchema),
|
|
37
|
+
resourcePrefixes: z.array(z.string().min(1).max(2e3)).max(20).optional()
|
|
38
|
+
})).max(20)
|
|
39
|
+
}).superRefine((config, context) => {
|
|
40
|
+
const ids = config.providers.map((provider) => provider.localId);
|
|
41
|
+
if (new Set(ids).size !== ids.length) context.addIssue({
|
|
42
|
+
code: "custom",
|
|
43
|
+
message: "Duplicate device provider ID"
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
/** Explicit device-local configuration; never reads Gateway-owned MCP configuration or credentials. */
|
|
47
|
+
async function startDeviceHost(config, options = {}) {
|
|
48
|
+
config = deviceHostConfigSchema.parse(config);
|
|
49
|
+
const token = process.env[config.tokenEnv];
|
|
50
|
+
const registry = new EndpointToolRegistry([]);
|
|
51
|
+
const providers = [];
|
|
52
|
+
let bridge;
|
|
53
|
+
const close = async () => {
|
|
54
|
+
const stopping = bridge?.close();
|
|
55
|
+
await Promise.allSettled(providers.map((provider) => provider.close()));
|
|
56
|
+
await stopping;
|
|
57
|
+
};
|
|
58
|
+
try {
|
|
59
|
+
for (const provider of config.providers) providers.push(await connectDeviceMcpProvider({
|
|
60
|
+
...provider,
|
|
61
|
+
server: provider.server,
|
|
62
|
+
registry,
|
|
63
|
+
durableOperations: 1,
|
|
64
|
+
onError: (error) => options.onError?.(provider.localId, error)
|
|
65
|
+
}));
|
|
66
|
+
bridge = await connectDeviceBridge({
|
|
67
|
+
...config,
|
|
68
|
+
token,
|
|
69
|
+
registry,
|
|
70
|
+
confirm: options.confirm
|
|
71
|
+
});
|
|
72
|
+
return {
|
|
73
|
+
registry,
|
|
74
|
+
principalId: bridge.principalId,
|
|
75
|
+
endpointId: bridge.endpointId,
|
|
76
|
+
close
|
|
77
|
+
};
|
|
78
|
+
} catch (error) {
|
|
79
|
+
await close();
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
async function readDeviceHostConfig(path) {
|
|
84
|
+
const bytes = await readFile(resolve(path));
|
|
85
|
+
if (bytes.byteLength > 512 * 1024) throw new Error("Device host configuration exceeds its budget");
|
|
86
|
+
return deviceHostConfigSchema.parse(JSON.parse(bytes.toString("utf8")));
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
export { deviceHostConfigSchema, readDeviceHostConfig, startDeviceHost };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { GatewayPrincipal } from '../gateway/security/gateway-principal.js';
|
|
2
|
+
export declare function deviceExecutionPrincipalId(principal: GatewayPrincipal): string;
|
|
3
|
+
/** Only authenticated input handlers may establish the identity of a queued request. */
|
|
4
|
+
export declare function recordDeviceExecutionActor(conversationId: string, clientMessageId: string, principal: GatewayPrincipal): void;
|
|
5
|
+
/** Resolve the actual executing input, never the most recently submitted message or a model argument. */
|
|
6
|
+
export declare function currentDeviceExecutionActor(conversationId: string, runId?: string): GatewayPrincipal | undefined;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { init_connection, isXopcDatabaseOpen } from "../storage/sqlite/connection.js";
|
|
2
|
+
import { getSqliteDatabase, init_transaction } from "../storage/sqlite/transaction.js";
|
|
3
|
+
import { getDevice, isDeviceAccessSessionActive } from "../storage/sqlite/device-access-repository.js";
|
|
4
|
+
import { DurableState } from "../storage/sqlite/durable-state.js";
|
|
5
|
+
//#region src/endpoint-tools/execution-actor.ts
|
|
6
|
+
init_transaction();
|
|
7
|
+
init_connection();
|
|
8
|
+
function deviceExecutionPrincipalId(principal) {
|
|
9
|
+
return principal.kind === "owner" && principal.browserSessionId ? "gateway-owner" : principal.principalId;
|
|
10
|
+
}
|
|
11
|
+
const actors = new DurableState("device.input-actors");
|
|
12
|
+
const actorKey = (conversationId, clientMessageId) => JSON.stringify([conversationId, clientMessageId]);
|
|
13
|
+
/** Only authenticated input handlers may establish the identity of a queued request. */
|
|
14
|
+
function recordDeviceExecutionActor(conversationId, clientMessageId, principal) {
|
|
15
|
+
principal = {
|
|
16
|
+
...principal,
|
|
17
|
+
principalId: deviceExecutionPrincipalId(principal)
|
|
18
|
+
};
|
|
19
|
+
if (!clientMessageId.trim() || clientMessageId.length > 200) return;
|
|
20
|
+
actors.update(actorKey(conversationId, clientMessageId), (previous) => {
|
|
21
|
+
if (previous && previous.principal.principalId !== principal.principalId) throw new Error("Input belongs to another principal");
|
|
22
|
+
return {
|
|
23
|
+
value: previous ?? {
|
|
24
|
+
principal,
|
|
25
|
+
acceptedAt: Date.now()
|
|
26
|
+
},
|
|
27
|
+
result: void 0
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/** Resolve the actual executing input, never the most recently submitted message or a model argument. */
|
|
32
|
+
function currentDeviceExecutionActor(conversationId, runId) {
|
|
33
|
+
if (!isXopcDatabaseOpen()) return;
|
|
34
|
+
const row = getSqliteDatabase().prepare(`SELECT i.client_message_id FROM session_inputs i
|
|
35
|
+
WHERE i.conversation_id=? AND i.run_id=COALESCE(?,
|
|
36
|
+
(SELECT active_run_id FROM session_input_runtime WHERE conversation_id=?)) ORDER BY i.position ASC LIMIT 1`).get(conversationId, runId ?? null, conversationId);
|
|
37
|
+
if (!row) return;
|
|
38
|
+
const actor = actors.get(actorKey(conversationId, row.client_message_id));
|
|
39
|
+
if (!actor || Date.now() - actor.acceptedAt > 1440 * 60 * 1e3) return;
|
|
40
|
+
const principal = actor.principal;
|
|
41
|
+
if (principal.browserSessionId && !getSqliteDatabase().prepare("SELECT 1 FROM browser_sessions WHERE session_id=? AND expires_at>?").get(principal.browserSessionId, Date.now())) return;
|
|
42
|
+
if (principal.kind === "device") {
|
|
43
|
+
const device = principal.deviceId ? getDevice(principal.deviceId) : void 0;
|
|
44
|
+
if (!device || device.revokedAt !== void 0 || principal.accessSessionId && !isDeviceAccessSessionActive(device.id, principal.accessSessionId)) return;
|
|
45
|
+
return {
|
|
46
|
+
...principal,
|
|
47
|
+
scopes: principal.scopes.filter((scope) => device.scopes.includes(scope))
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return principal;
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { currentDeviceExecutionActor, deviceExecutionPrincipalId, recordDeviceExecutionActor };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type TurnOrigin } from '@xopcai/endpoint-tools-protocol';
|
|
2
2
|
import type { DeviceGrantAuditEvent } from '../storage/sqlite/device-grant-audit-repository.js';
|
|
3
3
|
import type { EndpointRegistry } from './registry.js';
|
|
4
4
|
export interface DeviceGrantLease {
|
|
@@ -11,7 +11,8 @@ interface DeviceGrant {
|
|
|
11
11
|
requestorPrincipalId: string;
|
|
12
12
|
targetEndpointId: string;
|
|
13
13
|
targetPrincipalId: string;
|
|
14
|
-
arguments:
|
|
14
|
+
arguments: Record<string, unknown>;
|
|
15
|
+
toolRevision: string;
|
|
15
16
|
connectionId: string;
|
|
16
17
|
toolName: string;
|
|
17
18
|
argumentsDigest: string;
|
|
@@ -38,7 +39,8 @@ export declare class DeviceGrantService {
|
|
|
38
39
|
requestorPrincipalId: string;
|
|
39
40
|
targetEndpointId: string;
|
|
40
41
|
targetPrincipalId: string;
|
|
41
|
-
arguments:
|
|
42
|
+
arguments: Record<string, unknown>;
|
|
43
|
+
toolRevision: string;
|
|
42
44
|
connectionId: string;
|
|
43
45
|
toolName: string;
|
|
44
46
|
expiresAt: number;
|
|
@@ -54,7 +56,8 @@ export declare class DeviceGrantService {
|
|
|
54
56
|
requestorPrincipalId: string;
|
|
55
57
|
targetEndpointId: string;
|
|
56
58
|
targetPrincipalId: string;
|
|
57
|
-
arguments:
|
|
59
|
+
arguments: Record<string, unknown>;
|
|
60
|
+
toolRevision: string;
|
|
58
61
|
connectionId: string;
|
|
59
62
|
toolName: string;
|
|
60
63
|
expiresAt: number;
|
|
@@ -3,6 +3,7 @@ import { init_logger } from "../utils/logger.js";
|
|
|
3
3
|
import { locationRequestSchema } from "../../packages/endpoint-tools-protocol/src/location.js";
|
|
4
4
|
import { canonicalJson, init_src } from "../../packages/endpoint-tools-protocol/src/index.js";
|
|
5
5
|
import { createHash, randomUUID } from "node:crypto";
|
|
6
|
+
import Ajv2020 from "ajv/dist/2020.js";
|
|
6
7
|
//#region src/endpoint-tools/grant-service.ts
|
|
7
8
|
init_src();
|
|
8
9
|
init_logger();
|
|
@@ -20,9 +21,15 @@ var DeviceGrantService = class {
|
|
|
20
21
|
this.prune();
|
|
21
22
|
if (this.grants.size >= 100) throw new Error("Too many outstanding device authorizations");
|
|
22
23
|
const target = this.registry.get(input.targetEndpointId);
|
|
23
|
-
|
|
24
|
-
if (
|
|
25
|
-
const
|
|
24
|
+
const tool = target && this.registry.getTool(target.endpointId, input.toolName);
|
|
25
|
+
if (!target || !tool || tool.descriptor.requiresForeground && target.availability !== "foreground" || !this.registry.list().some((endpoint) => endpoint.principalId === input.requestorPrincipalId)) throw new Error("Device is offline");
|
|
26
|
+
const location = /^(mobile|web|desktop)\.device\.get_location$/.test(input.toolName);
|
|
27
|
+
if (!location && !tool.provider) throw new Error("Unsupported device authorization");
|
|
28
|
+
const args = location ? locationRequestSchema.parse(input.arguments) : structuredClone(input.arguments);
|
|
29
|
+
if (Buffer.byteLength(canonicalJson(args)) > 32 * 1024 || !new Ajv2020({
|
|
30
|
+
strict: false,
|
|
31
|
+
validateFormats: false
|
|
32
|
+
}).compile(tool.descriptor.inputSchema)(args)) throw new Error("Invalid device authorization arguments");
|
|
26
33
|
for (const grant of this.grants.values()) if (grant.conversationId === input.conversationId && grant.requestorPrincipalId === input.requestorPrincipalId && grant.toolName === input.toolName) this.revoke(grant.id);
|
|
27
34
|
const grant = {
|
|
28
35
|
conversationId: input.conversationId,
|
|
@@ -33,6 +40,7 @@ var DeviceGrantService = class {
|
|
|
33
40
|
id: randomUUID(),
|
|
34
41
|
targetPrincipalId: target.principalId,
|
|
35
42
|
connectionId: target.connectionId,
|
|
43
|
+
toolRevision: tool.revision,
|
|
36
44
|
argumentsDigest: digest(args),
|
|
37
45
|
expiresAt: this.now() + 6e4,
|
|
38
46
|
state: "ready",
|
|
@@ -102,7 +110,7 @@ var DeviceGrantService = class {
|
|
|
102
110
|
for (const id of this.grants.keys()) this.revoke(id);
|
|
103
111
|
}
|
|
104
112
|
prune() {
|
|
105
|
-
for (const grant of this.grants.values()) if (grant.expiresAt <= this.now() || this.registry.get(grant.targetEndpointId)?.connectionId !== grant.connectionId || !this.registry.list().some((endpoint) => endpoint.principalId === grant.requestorPrincipalId)) this.revoke(grant.id, grant.expiresAt <= this.now() ? "expired" : "revoked");
|
|
113
|
+
for (const grant of this.grants.values()) if (grant.expiresAt <= this.now() || this.registry.get(grant.targetEndpointId)?.connectionId !== grant.connectionId || this.registry.getTool(grant.targetEndpointId, grant.toolName)?.revision !== grant.toolRevision || !this.registry.list().some((endpoint) => endpoint.principalId === grant.requestorPrincipalId)) this.revoke(grant.id, grant.expiresAt <= this.now() ? "expired" : "revoked");
|
|
106
114
|
}
|
|
107
115
|
summary(grant) {
|
|
108
116
|
const { controller: _controller, argumentsDigest: _digest, ...summary } = grant;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const hostCredentialSchema: z.ZodObject<{
|
|
3
|
+
gatewayUrl: z.ZodURL;
|
|
4
|
+
gatewayId: z.ZodUUID;
|
|
5
|
+
gatewayPublicKey: z.ZodString;
|
|
6
|
+
tokens: z.ZodObject<{
|
|
7
|
+
accessToken: z.ZodString;
|
|
8
|
+
accessTokenExpiresAt: z.ZodNumber;
|
|
9
|
+
refreshToken: z.ZodString;
|
|
10
|
+
refreshTokenExpiresAt: z.ZodNumber;
|
|
11
|
+
}, z.core.$strict>;
|
|
12
|
+
pendingRefresh: z.ZodOptional<z.ZodObject<{
|
|
13
|
+
timestamp: z.ZodNumber;
|
|
14
|
+
nonce: z.ZodString;
|
|
15
|
+
requestId: z.ZodUUID;
|
|
16
|
+
nextRefreshToken: z.ZodString;
|
|
17
|
+
requestProofVersion: z.ZodLiteral<1>;
|
|
18
|
+
}, z.core.$strict>>;
|
|
19
|
+
}, z.core.$strict>;
|
|
20
|
+
export interface DeviceHostIdentity {
|
|
21
|
+
principalId: string;
|
|
22
|
+
publicKey: string;
|
|
23
|
+
privateKey: string;
|
|
24
|
+
credential?: z.infer<typeof hostCredentialSchema>;
|
|
25
|
+
}
|
|
26
|
+
/** Owner bootstrap is used once; subsequent HTTP/WS requests use only signed host-scoped credentials. */
|
|
27
|
+
export declare function createDeviceHostCredentials(options: {
|
|
28
|
+
origin: URL;
|
|
29
|
+
identity: DeviceHostIdentity;
|
|
30
|
+
bootstrapToken?: string;
|
|
31
|
+
displayName: string;
|
|
32
|
+
signal: AbortSignal;
|
|
33
|
+
persist(): Promise<void>;
|
|
34
|
+
}): Promise<{
|
|
35
|
+
headers(method: string, target: string, body?: string | Uint8Array, headers?: Record<string, string>): Promise<{
|
|
36
|
+
Authorization: string;
|
|
37
|
+
'X-Xopc-Proof': string;
|
|
38
|
+
}>;
|
|
39
|
+
connectionHeaders(ticket: string): {
|
|
40
|
+
'X-Xopc-Proof': string;
|
|
41
|
+
};
|
|
42
|
+
}>;
|