@xopcai/xopc 0.0.445 → 0.0.447
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/src/draft-stream-lifecycle.d.ts +2 -3
- package/dist/extensions/telegram/src/plugin.d.ts +0 -1
- package/dist/extensions/telegram/src/plugin.js +0 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-CuPXAoLe.js → activity-store-D_KDDoA1.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-D92uHOFV.js → agent-avatar-dicebear-CGHzO0HR.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-display-DINzeGs0.js → agent-avatar-display-Dm1YHaAt.js} +2 -2
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-rH1QpgiR.js → agent-defaults-settings-panel-BGTfRvG5.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-B2vXlrDW.js → agent-plugin-dialog-D0AQB-2O.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-lvQfOQPN.js → agents-Ckr-T2KU.js} +3 -3
- package/dist/gateway/static/root/assets/{agents-admin-api-DPLtjJtX.js → agents-admin-api-D0qHxAok.js} +1 -1
- package/dist/gateway/static/root/assets/{api-snfMD8_Y.js → api-pQXrYBTk.js} +1 -1
- package/dist/gateway/static/root/assets/{api-CEzBruRJ.js → api-uriioEZx.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CONwDpqL.js → app-management-settings-panel-CQbKhrjd.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-Bu7K-_ri.js → appearance-settings-Dm0GM368.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-C3iDd3ZQ.js → apps-page-DCeINCy-.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-CfLz9o-2.js → archive-plugin-Cd4FOTEH.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-api-Dl9fi8t0.js → automation-api-B3df53ms.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-result-state-BjjZCxee.js → automation-result-state-CpgaWu2r.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-run-list-9IPHu_UC.js → automation-run-list-DrJfwJN_.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-task-card-CKbHMLSy.js → automation-task-card-C2mxNw5Q.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-K3trjTZl.js → automations-page-B5bnb-N8.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-D7m3w_9B.js → automations-workspace-7R4mL3M-.js} +2 -2
- package/dist/gateway/static/root/assets/{binary-plugins-Bv4ixxo4.js → binary-plugins-C0QOjfJV.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CtaJSB9U.js → block-editor-BY1Mb-WW.js} +3 -2
- package/dist/gateway/static/root/assets/{browser-settings-page-CmBsnx24.js → browser-settings-page-DUsk02LK.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-DJYgOjeq.js → capabilities-Bt1fAcDI.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-DDJJhQ40.js → capabilities-Bu7efUpH.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-CBqvHAyp.js → capabilities-page-DFv5-mPY.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-wjezs0OE.js → capabilities-settings-panel-BtRMZjAx.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-D4q8hiD0.js → channels-CByFQQ_H.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-agents-api-BOB3dILf.js → chat-agents-api-SruH_oEQ.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-chart-block-DsaCatBN.js → chat-chart-block-BBchFbUa.js} +1 -1
- package/dist/gateway/static/root/assets/chat-page-C3ttsYGZ.js +71 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-D9o0nUEV.js → chat-terminal-dock-DCNAz0CB.js} +1 -1
- package/dist/gateway/static/root/assets/{command-palette-api-Cj0_7g9o.js → command-palette-api-r8U5soT7.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-payload-handoff-CoDWKzBm.js → composer-payload-handoff-RaEQXTjj.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-DJ9BIOHC.js → computer-settings-page-C7cj9Zyx.js} +1 -1
- package/dist/gateway/static/root/assets/{connected-providers-grid-C5-3MDIj.js → connected-providers-grid-DgJ7I1do.js} +1 -1
- package/dist/gateway/static/root/assets/{connection-usage-guide-bD1sKiAp.js → connection-usage-guide-De6QJt8B.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-BEq3i3Vi.js → connector-service-page-qSYlFATU.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-DEExP6a7.js → connectors-api-CqyteNnT.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-QVWuoxuK.js → connectors-page-BB3V-zJS.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-D2whl8Ci.js → date-picker-CB6IVCiq.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-narrative-C8zQtMcw.js → desktop-pet-narrative-B7I1II0Z.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-C54b1FY4.js → desktop-pet-settings-Cm1O5CEG.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-qnIdmNnH.js → desktop-pet-wqyOn6xs.js} +1 -1
- package/dist/gateway/static/root/assets/{dev-view-store-bryv5YRw.js → dev-view-store-BxPWx1Gi.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-Du-yOxZv.js → device-pairing-wizard-CqgjknYy.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-GsMkjw59.js → directory-picker-path-field-BCOUShCs.js} +1 -1
- package/dist/gateway/static/root/assets/{discussion-annotation-sync-CrpDiC7J.js → discussion-annotation-sync-uvwyXFX3.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CDZfdMAR.js → extension-debug-page-C7ZJumIY.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-CG70QWPS.js → extension-iframe-host-B0rM3Ohp.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-marketplace-api-D7Av-sOf.js → extension-marketplace-api-DIGw487r.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DpJTL6-v.js → extension-page-C5LnL_Dy.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-BZTbdvCF.js → extension-provider-D5L3t0e3.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CC4rmiFC.js → extension-settings-page-DnXoNNDa.js} +1 -1
- package/dist/gateway/static/root/assets/{file-preview-surface-Dtla5oAW.js → file-preview-surface-Bfqc0ZKv.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-B5THNdYK.js → gateway-config-swr-Db2fE-gT.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-nI6k8qP8.js +1 -0
- package/dist/gateway/static/root/assets/gateway-realtime-store-CjYSSi_l.js +1 -0
- package/dist/gateway/static/root/assets/gateway-restart-CyhN9Fk3.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-Nr0Bzbsy.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CqtCJzWJ.js → gateway-startup-retry-Du7l0oxt.js} +1 -1
- package/dist/gateway/static/root/assets/{global-defaults-api-BQMdHLlp.js → global-defaults-api-qGBKLt28.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-Df3X6-Ko.js → home-page-h6D4Pqqc.js} +2 -2
- package/dist/gateway/static/root/assets/{image-generation-api-G3tQFhif.js → image-generation-api-DeolJQxY.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-BmEqiunH.js → imports-page-B3kUV_dq.js} +1 -1
- package/dist/gateway/static/root/assets/index-Bj6IrJGJ.js +11 -0
- package/dist/gateway/static/root/assets/index-D3YWUSNe.css +1 -0
- package/dist/gateway/static/root/assets/install-connector-dialog-Brl22l1N.js +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CtNI6i7K.js → keyboard-shortcuts-settings-CFrEEDZu.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-CbHgQzs4.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-DqZT5hLH.js → local-apps-page-Cdeawk2X.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-Bt_e3A8f.js → local-session-drafts-oWhYPECv.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Bld7_m-Q.js → locale-store-BY-fRY-q.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CzajqK40.js → logs-page-3dWLrUy0.js} +1 -1
- package/dist/gateway/static/root/assets/management-api-BzdYxqsC.js +1 -0
- package/dist/gateway/static/root/assets/management-settings-yWWgFlzF.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-ClNfoiYC.js} +1 -1
- package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-ZcY1nqMO.js → mcp-conversation-setup-page-C0M7yW4O.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DSOplRhW.js → media-plugins-DmVG3TQ5.js} +1 -1
- package/dist/gateway/static/root/assets/messages-DFCLetQl.js +3 -0
- package/dist/gateway/static/root/assets/{model-selector-yAKlOR3O.js → model-selector-DkytsBae.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-cache-8V-ZpAIa.js → models-hub-cache-CESzQ_tk.js} +1 -1
- package/dist/gateway/static/root/assets/navigation-ByOzYT0t.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-CQIrUO6h.js +7 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-Cw-TaViX.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-CVQqqmGI.js → notes-api-32qiHxz2.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-DIugUbkV.js → notes-page-gl59x-7l.js} +2 -2
- package/dist/gateway/static/root/assets/{oauth-api-DGa6PTuq.js → oauth-api-CMpfoRed.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-provider-connect-Bc-KLH1e.js → oauth-provider-connect-XzlLkqnK.js} +1 -1
- package/dist/gateway/static/root/assets/page-context-capture-button-CdMxGZaM.js +1 -0
- package/dist/gateway/static/root/assets/{page-context-draft-GveHK8e2.js → page-context-draft-CrgFs0h3.js} +1 -1
- package/dist/gateway/static/root/assets/page-header-store-BNjlQHqU.js +1 -0
- package/dist/gateway/static/root/assets/{personal-avatar-Cu8lGBXZ.js → personal-avatar-BHMRbUIc.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-BZWJKyZ8.js → personal-page-DUuJe2P9.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-settings-panel-awr10jTV.js → personal-settings-panel-CZjvI9rl.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-dependencies-card-CAxn3usD.js → phone-dependencies-card-BCEI4PGp.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-connection-BBG3LxRP.js → phone-model-connection-BqOzyoRr.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-picker-CfPjKpnd.js → phone-model-picker-BGAAMeo6.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-settings-page-C4dJdwRW.js → phone-settings-page-BdoFCa2J.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-workspace-store-BKltFHtG.js → phone-workspace-store-D1BS7otl.js} +1 -1
- package/dist/gateway/static/root/assets/{plugin-details-dialog-BqcFfZFH.js → plugin-details-dialog-BP-ZS2g2.js} +1 -1
- package/dist/gateway/static/root/assets/{preference-select-fields-QlyIA8ve.js → preference-select-fields-RITbo_ES.js} +1 -1
- package/dist/gateway/static/root/assets/{product-automation-feedback-CRsfuAXl.js → product-automation-feedback-CQvcSORB.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CQ4dk-_l.js → product-open-page-CJfYOVkw.js} +1 -1
- package/dist/gateway/static/root/assets/product-preview-content-B0-rh4uS.js +1 -0
- package/dist/gateway/static/root/assets/product-preview-modal-CSFxc7oy.js +2 -0
- package/dist/gateway/static/root/assets/project-detail-page-CgU7vGyT.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-szQw-qin.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-BsgZb6n9.js → projects-page-BFZsIyzp.js} +1 -1
- package/dist/gateway/static/root/assets/{providers-api-CspehmSU.js → providers-api-j511FMYv.js} +1 -1
- package/dist/gateway/static/root/assets/{recording-upload-BOZAOdCI.js → recording-upload-jq70ER5Y.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-Bdp3UUyz.js → registry-api-BnEoY6_B.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-Bos3uwAT.js → remote-access-hub-B8AHjzC5.js} +1 -1
- package/dist/gateway/static/root/assets/{resource-unavailable-DJR3SCy6.js → resource-unavailable-AT-LkLIB.js} +1 -1
- package/dist/gateway/static/root/assets/route-preload-ByDpGuZp.js +2 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-DsbahxzE.js → runtime-tools-api-BDjAwlQF.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DW9_OFi2.js → runtime-tools-settings-panel-kvbXN_HV.js} +1 -1
- package/dist/gateway/static/root/assets/{service-recommendation-list-Bd1JDO5T.js → service-recommendation-list-DquxQCKH.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-DjnHJ-0n.js → session-api-CgTDekPG.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-ChHnJOWW.js → session-manager-V8cj3NVD.js} +2 -2
- package/dist/gateway/static/root/assets/{sessions-page-BM-oqd22.js → sessions-page-KFescmNm.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-JCPJyeK-.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-section-CM44UlF8.js → settings-advanced-section-Daxv3VGf.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-mode-store-Blc4C8aw.js → settings-mode-store-LUeLxacj.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-irv-JoTz.js → settings-page-Bi6rvZGw.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-BYFaTD8a.js → settings-page-header-Dmw3nYJ1.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-CnUQSxT3.js → settings-page-layout-YJXlkr_Z.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-interaction-page-DqaiLQ0I.js → setup-interaction-page-Dd3Ovfgm.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-iOYgfkoK.js → setup-status-panel-BZZXpXiB.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-C_uYNUlp.js → share-link-dialog-B1g7Xero.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-CFebGqyB.js → share-preview-page-1GlB7603.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-C2GDyqxP.js → shares-api-DXOD--vt.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-B-7la3QN.js → shares-settings-Bj-HKS3s.js} +1 -1
- package/dist/gateway/static/root/assets/skill-api-HQEXke4-.js +1 -0
- package/dist/gateway/static/root/assets/{skill-list-api-7MY9ewiu.js → skill-list-api-CJBrtxil.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-DkDpu3Wd.js → skill-reload-api-CO6jhwui.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page-DAxov1a8.js +2 -0
- 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-By3gokfs.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-6awKGnOr.js → task-detail-page-Cf58C6gC.js} +1 -1
- package/dist/gateway/static/root/assets/{task-result-evidence-Cy9txdqV.js → task-result-evidence-DWfp9UIc.js} +1 -1
- package/dist/gateway/static/root/assets/{terminal-panel-store-DUEJoa1M.js → terminal-panel-store-DBC-pqGy.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-DsvYj7Vy.js → theme-store-C57ZxHqm.js} +1 -1
- package/dist/gateway/static/root/assets/tool-friendly-title-YQmN1S2k.js +2 -0
- package/dist/gateway/static/root/assets/{tracing-settings-page-B_Xdc2VF.js → tracing-settings-page-BQ7regHS.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-B6BhWTh3.js → tunnel-api-BOJVQPqI.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-activity-store-B7rFXhDk.js → understanding-activity-store-YrDh1XvR.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-refresh-store-DCFASve5.js → understanding-refresh-store-D6gM1s8M.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-DqzosTxy.js → usage-page-DpC6gP1I.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-DsqcLHV9.js → use-autosave-NOpNkLFw.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-ClakaDU1.js → use-composer-attachments-R6kKpDgc.js} +1 -1
- package/dist/gateway/static/root/assets/use-file-preview-expanded-M7LSoDLc.js +15 -0
- package/dist/gateway/static/root/assets/{use-personal-profile-T2e6P5Ed.js → use-personal-profile-JPLBYzew.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-Dq0qgK3N.js → use-workspace-tree-jzKVAl3N.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-Ziz55hVM.js → user-model-page-CPZgl93P.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-D7NPAc1E.js → voice-api-key-field-R_KAYzHp.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-UQDTh6hh.js → voice-config-api-D6ueBjfw.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-input-shortcut-events-SD2gZVg8.js → voice-input-shortcut-events-04u9YoRg.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-transcribe-api-Bf9FaI-p.js → voice-transcribe-api-B2NVJYnu.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-B41GOFXh.js → work-discovery-overlay-BHaemIrQ.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-NNhExALx.js → work-discovery-page-Bt_j5iQ5.js} +1 -1
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-DeNWVFFK.js → working-directory-picker-modal-5EsBeKBO.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-api-DrVss2Fd.js → workspace-api-BmUCKePi.js} +2 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-Sy1CLe2K.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-C2egBzza.js → workspace-file-preview-dialog-hYGX2hWZ.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-XFUtwfLY.js → workspace-open-location-menu-DqLui4B1.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-BlhFT1q9.js → xopc-cloud-account-card-CVq7U7Ft.js} +1 -1
- package/dist/gateway/static/root/index.html +85 -84
- 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.d.ts +0 -1
- package/dist/src/agent/agent-manager.js +1 -4
- 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 +4 -7
- package/dist/src/agent/embedded/session-runner.js +8 -3
- 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/mcp/native-mcp.d.ts +2 -0
- package/dist/src/agent/mcp/native-mcp.js +5 -0
- package/dist/src/agent/mcp/transport.d.ts +2 -1
- package/dist/src/agent/mcp/transport.js +21 -6
- 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/marketplace/adapters/clawhub/adapter.d.ts +1 -0
- package/dist/src/agent/skills/marketplace/adapters/clawhub/adapter.js +56 -30
- package/dist/src/agent/skills/marketplace/search.js +2 -2
- 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/pairing/paths.d.ts +1 -1
- package/dist/src/channels/pairing/paths.js +1 -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.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/paths.d.ts +1 -1
- package/dist/src/config/paths.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/refresh-runtime-access.d.ts +7 -2
- package/dist/src/extensions/agent-plugins/refresh-runtime-access.js +36 -25
- package/dist/src/extensions/agent-plugins/setup.d.ts +1 -1
- package/dist/src/extensions/agent-plugins/setup.js +2 -2
- package/dist/src/extensions/agent-plugins/skill-catalog.js +1 -1
- package/dist/src/extensions/agent-plugins/validation.js +1 -1
- package/dist/src/extensions/loader.d.ts +0 -1
- package/dist/src/extensions/loader.js +3 -38
- package/dist/src/extensions/typed-event-bus.d.ts +0 -1
- package/dist/src/extensions/typed-event-bus.js +0 -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 +9 -4
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/home-intelligence/host.js +2 -2
- 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 +4 -5
- package/dist/extensions/feishu/src/auth/paths.d.ts +0 -2
- package/dist/extensions/feishu/src/auth/paths.js +0 -16
- package/dist/extensions/feishu/src/state/thread-bindings.d.ts +0 -19
- package/dist/extensions/feishu/src/state/thread-bindings.js +0 -44
- package/dist/extensions/feishu/src/subagent-hooks.d.ts +0 -12
- package/dist/extensions/feishu/src/subagent-hooks.js +0 -50
- package/dist/extensions/feishu/src/tools/docx/docx-batch-insert.d.ts +0 -11
- package/dist/extensions/feishu/src/tools/docx/docx-batch-insert.js +0 -93
- package/dist/extensions/feishu/src/tools/docx/docx-color-text.d.ts +0 -15
- package/dist/extensions/feishu/src/tools/docx/docx-color-text.js +0 -73
- package/dist/extensions/feishu/src/tools/docx/docx-table-ops.d.ts +0 -20
- package/dist/extensions/feishu/src/tools/docx/docx-table-ops.js +0 -171
- package/dist/extensions/feishu/src/tools/docx/docx-types.d.ts +0 -34
- 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/install-connector-dialog-BU4l6KJv.js +0 -1
- 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/messages-CGO1P4mz.js +0 -3
- 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/skill-api-BnpTSZGc.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-sL2kGqHZ.js +0 -2
- package/dist/gateway/static/root/assets/tool-friendly-title-DEGpbye4.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
- /package/dist/{extensions/feishu/src/tools/docx/docx-types.js → src/cli/commands/device-host.d.ts} +0 -0
|
@@ -569,6 +569,7 @@ export declare const GatewayConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
569
569
|
url: z.ZodDefault<z.ZodString>;
|
|
570
570
|
noProxy: z.ZodDefault<z.ZodString>;
|
|
571
571
|
}, z.core.$strict>>;
|
|
572
|
+
deviceProvidersEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
572
573
|
bind: z.ZodOptional<z.ZodEnum<{
|
|
573
574
|
custom: "custom";
|
|
574
575
|
auto: "auto";
|
|
@@ -1579,6 +1580,7 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
1579
1580
|
url: z.ZodDefault<z.ZodString>;
|
|
1580
1581
|
noProxy: z.ZodDefault<z.ZodString>;
|
|
1581
1582
|
}, z.core.$strict>>;
|
|
1583
|
+
deviceProvidersEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
1582
1584
|
bind: z.ZodOptional<z.ZodEnum<{
|
|
1583
1585
|
custom: "custom";
|
|
1584
1586
|
auto: "auto";
|
|
@@ -460,6 +460,7 @@ activityDetailDefault: z.enum([
|
|
|
460
460
|
]).default("on") }).default({ activityDetailDefault: "on" });
|
|
461
461
|
GatewayConfigSchema = z.object({
|
|
462
462
|
outboundProxy: OutboundProxySchema.optional(),
|
|
463
|
+
deviceProvidersEnabled: z.boolean().optional(),
|
|
463
464
|
/** Semantic bind mode. */
|
|
464
465
|
bind: GatewayBindModeSchema.optional(),
|
|
465
466
|
/** IPv4 listen address when `bind` is `custom`. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { init_connector_repository, listConnectorConnections, upsertConnectorConnection } from "../storage/sqlite/connector-repository.js";
|
|
2
1
|
import { DurableState } from "../storage/sqlite/durable-state.js";
|
|
2
|
+
import { init_connector_repository, listConnectorConnections, upsertConnectorConnection } from "../storage/sqlite/connector-repository.js";
|
|
3
3
|
import crypto, { createHmac, timingSafeEqual } from "node:crypto";
|
|
4
4
|
//#region src/connectors/composio-triggers.ts
|
|
5
5
|
init_connector_repository();
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { type EndpointToolRegistry } from '@xopcai/endpoint-tools-client';
|
|
1
|
+
import { type EndpointToolRegistry, type EndpointToolApprovalRequest } from '@xopcai/endpoint-tools-client';
|
|
2
2
|
export interface DeviceBridgeHostOptions {
|
|
3
3
|
gatewayUrl: string;
|
|
4
|
-
token
|
|
4
|
+
token?: string;
|
|
5
5
|
identityPath: string;
|
|
6
6
|
registry: EndpointToolRegistry;
|
|
7
7
|
displayName?: string;
|
|
8
|
+
confirm?: (request: EndpointToolApprovalRequest) => Promise<boolean>;
|
|
8
9
|
onStateChange?: (state: string) => void;
|
|
9
10
|
}
|
|
10
|
-
/** Connects a Node hardware adapter through the existing signed Endpoint
|
|
11
|
+
/** Connects a Node hardware adapter through the existing signed Endpoint transport. */
|
|
11
12
|
export declare function connectDeviceBridge(options: DeviceBridgeHostOptions): Promise<{
|
|
13
|
+
close(): Promise<void>;
|
|
12
14
|
endpointId: string;
|
|
13
15
|
principalId: string;
|
|
14
|
-
close: () => void;
|
|
15
16
|
}>;
|
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createLogger } from "../utils/logger/index.js";
|
|
2
|
+
import { init_logger } from "../utils/logger.js";
|
|
3
|
+
import { endpointHelloSigningPayload, endpointToolContentSchema, init_src } from "../../packages/endpoint-tools-protocol/src/index.js";
|
|
2
4
|
import { EndpointToolHostController } from "../../packages/endpoint-tools-client/src/index.js";
|
|
3
5
|
import { RealtimeClient } from "../../packages/realtime-client/src/index.js";
|
|
6
|
+
import { FileProviderOperationJournal } from "./provider-operation-journal.js";
|
|
7
|
+
import { createDeviceHostCredentials } from "./host-credentials.js";
|
|
4
8
|
import { dirname } from "node:path";
|
|
5
|
-
import { generateKeyPairSync, randomUUID, sign } from "node:crypto";
|
|
6
|
-
import { mkdir, readFile,
|
|
9
|
+
import { createHash, generateKeyPairSync, randomUUID, sign } from "node:crypto";
|
|
10
|
+
import { lstat, mkdir, open, readFile, rename, unlink, writeFile } from "node:fs/promises";
|
|
7
11
|
import WebSocket from "ws";
|
|
8
12
|
//#region src/endpoint-tools/bridge-host.ts
|
|
9
13
|
init_src();
|
|
14
|
+
init_logger();
|
|
15
|
+
const log = createLogger("DeviceBridge");
|
|
10
16
|
async function loadIdentity(path) {
|
|
11
17
|
try {
|
|
12
|
-
const info = await
|
|
18
|
+
const info = await lstat(path);
|
|
13
19
|
if (!info.isFile() || process.platform !== "win32" && (info.mode & 63) !== 0) throw new Error("Bridge identity must be a private file (mode 0600)");
|
|
14
20
|
const identity = JSON.parse(await readFile(path, "utf8"));
|
|
15
21
|
if (!identity.principalId || !identity.publicKey || !identity.privateKey) throw new Error("Invalid Bridge identity file");
|
|
@@ -39,8 +45,39 @@ async function loadIdentity(path) {
|
|
|
39
45
|
return identity;
|
|
40
46
|
}
|
|
41
47
|
}
|
|
42
|
-
/** Connects a Node hardware adapter through the existing signed Endpoint
|
|
48
|
+
/** Connects a Node hardware adapter through the existing signed Endpoint transport. */
|
|
43
49
|
async function connectDeviceBridge(options) {
|
|
50
|
+
await mkdir(dirname(options.identityPath), {
|
|
51
|
+
recursive: true,
|
|
52
|
+
mode: 448
|
|
53
|
+
});
|
|
54
|
+
const lockPath = options.identityPath + ".lock";
|
|
55
|
+
const lock = await open(lockPath, "wx", 384).catch(() => {
|
|
56
|
+
throw new Error("Device identity is already in use; remove a stale lock only after its host has stopped");
|
|
57
|
+
});
|
|
58
|
+
await lock.writeFile(String(process.pid));
|
|
59
|
+
let released = false;
|
|
60
|
+
const release = async () => {
|
|
61
|
+
if (released) return;
|
|
62
|
+
released = true;
|
|
63
|
+
await lock.close();
|
|
64
|
+
await unlink(lockPath).catch(() => {});
|
|
65
|
+
};
|
|
66
|
+
try {
|
|
67
|
+
const host = await connectBridge(options);
|
|
68
|
+
return {
|
|
69
|
+
...host,
|
|
70
|
+
async close() {
|
|
71
|
+
await host.close();
|
|
72
|
+
await release();
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
} catch (error) {
|
|
76
|
+
await release();
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async function connectBridge(options) {
|
|
44
81
|
const url = new URL(options.gatewayUrl);
|
|
45
82
|
if (url.username || url.password || url.search || url.hash || url.pathname !== "/") throw new Error("Use a Gateway origin URL without credentials or path");
|
|
46
83
|
if (url.protocol !== "https:" && !(url.protocol === "http:" && [
|
|
@@ -49,13 +86,44 @@ async function connectDeviceBridge(options) {
|
|
|
49
86
|
"[::1]"
|
|
50
87
|
].includes(url.hostname))) throw new Error("Remote Bridge connections require HTTPS");
|
|
51
88
|
const lifetime = new AbortController();
|
|
89
|
+
const identity = await loadIdentity(options.identityPath);
|
|
90
|
+
const endpointId = `${identity.principalId}:bridge`;
|
|
91
|
+
const displayName = options.displayName ?? "xopc Device Bridge";
|
|
92
|
+
if (!displayName.trim() || displayName.length > 80) throw new Error("Bridge name must contain 1–80 characters");
|
|
93
|
+
const credentials = await createDeviceHostCredentials({
|
|
94
|
+
origin: url,
|
|
95
|
+
identity,
|
|
96
|
+
bootstrapToken: options.token,
|
|
97
|
+
displayName,
|
|
98
|
+
signal: lifetime.signal,
|
|
99
|
+
persist: async () => {
|
|
100
|
+
const temporary = options.identityPath + `.${randomUUID()}.tmp`;
|
|
101
|
+
try {
|
|
102
|
+
const file = await open(temporary, "wx", 384);
|
|
103
|
+
try {
|
|
104
|
+
await file.writeFile(JSON.stringify(identity));
|
|
105
|
+
await file.sync();
|
|
106
|
+
} finally {
|
|
107
|
+
await file.close();
|
|
108
|
+
}
|
|
109
|
+
await rename(temporary, options.identityPath);
|
|
110
|
+
if (process.platform !== "win32") {
|
|
111
|
+
const directory = await open(dirname(options.identityPath), "r");
|
|
112
|
+
try {
|
|
113
|
+
await directory.sync();
|
|
114
|
+
} finally {
|
|
115
|
+
await directory.close();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
} finally {
|
|
119
|
+
await unlink(temporary).catch(() => {});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
});
|
|
52
123
|
const request = async (path, body, signal) => {
|
|
53
124
|
const response = await fetch(new URL(path, url), {
|
|
54
125
|
method: body === void 0 ? "GET" : "POST",
|
|
55
|
-
headers: {
|
|
56
|
-
Authorization: `Bearer ${options.token}`,
|
|
57
|
-
"Content-Type": "application/json"
|
|
58
|
-
},
|
|
126
|
+
headers: await credentials.headers(body === void 0 ? "GET" : "POST", path, body === void 0 ? "" : JSON.stringify(body), { "Content-Type": "application/json" }),
|
|
59
127
|
...body === void 0 ? {} : { body: JSON.stringify(body) },
|
|
60
128
|
redirect: "error",
|
|
61
129
|
signal: AbortSignal.any([lifetime.signal, signal ?? AbortSignal.timeout(1e4)])
|
|
@@ -65,48 +133,108 @@ async function connectDeviceBridge(options) {
|
|
|
65
133
|
if (!result.ok) throw new Error("Bridge Gateway request was rejected");
|
|
66
134
|
return result.payload;
|
|
67
135
|
};
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const displayName = options.displayName ?? "xopc Device Bridge";
|
|
72
|
-
if (!displayName.trim() || displayName.length > 80) throw new Error("Bridge name must contain 1–80 characters");
|
|
136
|
+
const compatibility = await request("/api/endpoint-tools/compatibility");
|
|
137
|
+
if (compatibility.endpointProtocolVersion !== 3) throw new Error("Gateway and device Endpoint versions differ; upgrade both before connecting");
|
|
138
|
+
if (compatibility.hardwareBridgeV1 !== true) throw new Error("Gateway does not support hardwareBridgeV1");
|
|
73
139
|
const register = () => request("/api/endpoint-tools/principals", {
|
|
74
140
|
principalId: identity.principalId,
|
|
75
141
|
publicKey: identity.publicKey,
|
|
76
|
-
kind: "
|
|
142
|
+
kind: "bridge",
|
|
77
143
|
platform: process.platform,
|
|
78
144
|
displayName
|
|
79
145
|
});
|
|
80
146
|
await register();
|
|
81
147
|
const controller = new EndpointToolHostController({
|
|
148
|
+
journal: new FileProviderOperationJournal(options.identityPath + ".operations"),
|
|
82
149
|
registry: options.registry,
|
|
83
150
|
getAvailability: () => "background",
|
|
84
151
|
createMessageId: randomUUID,
|
|
85
|
-
confirm: async () => false,
|
|
86
|
-
|
|
87
|
-
|
|
152
|
+
confirm: options.confirm ?? (async () => false),
|
|
153
|
+
onProviderCatalogAck: (ack) => {
|
|
154
|
+
if (ack.accepted === false) log.warn({
|
|
155
|
+
endpointId,
|
|
156
|
+
revision: ack.revision,
|
|
157
|
+
code: ack.code
|
|
158
|
+
}, "Gateway rejected device capability catalog");
|
|
159
|
+
},
|
|
160
|
+
downloadArtifact: async (artifact, context) => {
|
|
161
|
+
const path = `/api/endpoint-tools/invocations/${encodeURIComponent(context.invocationId)}/artifact`;
|
|
162
|
+
const response = await fetch(new URL(path, url), {
|
|
163
|
+
redirect: "error",
|
|
164
|
+
headers: await credentials.headers("GET", path, new Uint8Array(), {
|
|
165
|
+
"x-endpoint-id": endpointId,
|
|
166
|
+
"idempotency-key": artifact.token
|
|
167
|
+
}),
|
|
168
|
+
signal: AbortSignal.any([
|
|
169
|
+
lifetime.signal,
|
|
170
|
+
context.signal,
|
|
171
|
+
AbortSignal.timeout(3e4)
|
|
172
|
+
])
|
|
173
|
+
});
|
|
174
|
+
if (!response.ok || response.headers.get("content-length") !== String(artifact.size) || response.headers.has("content-encoding")) {
|
|
175
|
+
await response.body?.cancel();
|
|
176
|
+
throw new Error("Device artifact download rejected");
|
|
177
|
+
}
|
|
178
|
+
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
179
|
+
if (bytes.length !== artifact.size || createHash("sha256").update(bytes).digest("hex") !== artifact.sha256) {
|
|
180
|
+
bytes.fill(0);
|
|
181
|
+
throw new Error("Device artifact failed integrity verification");
|
|
182
|
+
}
|
|
183
|
+
return bytes;
|
|
184
|
+
},
|
|
185
|
+
uploadFile: async (grant, file, context) => {
|
|
186
|
+
if (grant.path !== `/api/endpoint-tools/invocations/${encodeURIComponent(context.invocationId)}/files` || grant.expiresAt <= Date.now() || file.bytes.byteLength > grant.maxBytes) throw new Error("Invalid or expired device upload grant");
|
|
187
|
+
const destination = new URL(grant.path, url);
|
|
188
|
+
destination.searchParams.set("name", file.name);
|
|
189
|
+
const response = await fetch(destination, {
|
|
190
|
+
method: "POST",
|
|
191
|
+
redirect: "error",
|
|
192
|
+
headers: await credentials.headers("POST", destination.pathname + destination.search, file.bytes, {
|
|
193
|
+
"Content-Type": file.mimeType,
|
|
194
|
+
"x-endpoint-id": endpointId,
|
|
195
|
+
"x-endpoint-upload-token": grant.token
|
|
196
|
+
}),
|
|
197
|
+
body: new Uint8Array(file.bytes).buffer,
|
|
198
|
+
signal: AbortSignal.any([
|
|
199
|
+
lifetime.signal,
|
|
200
|
+
context.signal,
|
|
201
|
+
AbortSignal.timeout(3e4)
|
|
202
|
+
])
|
|
203
|
+
});
|
|
204
|
+
if (!response.ok) throw new Error(`Device upload rejected: HTTP ${response.status}`);
|
|
205
|
+
const result = await response.json();
|
|
206
|
+
const content = endpointToolContentSchema.parse(result.payload);
|
|
207
|
+
if (!result.ok || content.type !== "file") throw new Error("Invalid device upload response");
|
|
208
|
+
return content;
|
|
88
209
|
}
|
|
89
210
|
});
|
|
90
211
|
const clientId = randomUUID();
|
|
91
212
|
const websocketUrl = new URL("/api/realtime/v1/ws", url);
|
|
92
213
|
websocketUrl.protocol = url.protocol === "https:" ? "wss:" : "ws:";
|
|
214
|
+
let latestTicket = "";
|
|
93
215
|
const client = new RealtimeClient({
|
|
94
216
|
clientId,
|
|
95
|
-
clientKind: "
|
|
217
|
+
clientKind: "bridge",
|
|
96
218
|
createMessageId: randomUUID,
|
|
97
219
|
getWebSocketUrl: () => websocketUrl.href,
|
|
98
|
-
issueTicket: (signal) =>
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
220
|
+
issueTicket: async (signal) => {
|
|
221
|
+
const ticket = await request("/api/realtime/tickets", {
|
|
222
|
+
clientId,
|
|
223
|
+
clientKind: "bridge",
|
|
224
|
+
protocolVersion: 2
|
|
225
|
+
}, signal);
|
|
226
|
+
latestTicket = ticket.ticket;
|
|
227
|
+
return ticket;
|
|
228
|
+
},
|
|
229
|
+
createWebSocket: (address) => new WebSocket(address, { headers: credentials.connectionHeaders(latestTicket) }),
|
|
104
230
|
onStateChange: (state) => options.onStateChange?.(state)
|
|
105
231
|
});
|
|
106
|
-
const
|
|
232
|
+
const processing = /* @__PURE__ */ new Set();
|
|
233
|
+
const close = async () => {
|
|
107
234
|
lifetime.abort();
|
|
108
235
|
client.disconnect();
|
|
109
236
|
controller.disconnect();
|
|
237
|
+
await Promise.allSettled(processing);
|
|
110
238
|
};
|
|
111
239
|
let resolveReady;
|
|
112
240
|
const ready = new Promise((resolve) => {
|
|
@@ -120,7 +248,7 @@ async function connectDeviceBridge(options) {
|
|
|
120
248
|
endpointId,
|
|
121
249
|
connectionInstanceId: randomUUID(),
|
|
122
250
|
displayName,
|
|
123
|
-
kind: "
|
|
251
|
+
kind: "bridge",
|
|
124
252
|
platform: process.platform,
|
|
125
253
|
appVersion: "1",
|
|
126
254
|
availability: "background",
|
|
@@ -140,9 +268,16 @@ async function connectDeviceBridge(options) {
|
|
|
140
268
|
resolveReady();
|
|
141
269
|
},
|
|
142
270
|
onMessage: (message) => {
|
|
143
|
-
controller.handleMessage(message)
|
|
271
|
+
const task = controller.handleMessage(message).catch(() => {
|
|
272
|
+
log.warn({
|
|
273
|
+
endpointId,
|
|
274
|
+
messageType: message.type
|
|
275
|
+
}, "Device protocol message failed");
|
|
276
|
+
});
|
|
277
|
+
processing.add(task);
|
|
278
|
+
task.then(() => processing.delete(task));
|
|
144
279
|
},
|
|
145
|
-
onDisconnected: () => controller.disconnect()
|
|
280
|
+
onDisconnected: () => controller.disconnect(!lifetime.signal.aborted)
|
|
146
281
|
});
|
|
147
282
|
client.connect();
|
|
148
283
|
let timeout;
|
|
@@ -151,7 +286,7 @@ async function connectDeviceBridge(options) {
|
|
|
151
286
|
timeout = setTimeout(() => reject(/* @__PURE__ */ new Error("Bridge endpoint did not become ready")), 15e3);
|
|
152
287
|
})]);
|
|
153
288
|
} catch (error) {
|
|
154
|
-
close();
|
|
289
|
+
await close();
|
|
155
290
|
throw error;
|
|
156
291
|
} finally {
|
|
157
292
|
clearTimeout(timeout);
|
|
@@ -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();
|