@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
|
@@ -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
|
+
}>;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { buildRefreshProofMessage, deviceRequestProofMessage } from "../../packages/gateway-contract/src/device-request-proof.js";
|
|
2
|
+
import { init_src } from "../../packages/gateway-contract/src/index.js";
|
|
3
|
+
import { createHash, randomBytes, randomUUID, sign, verify } from "node:crypto";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
//#region src/endpoint-tools/host-credentials.ts
|
|
6
|
+
init_src();
|
|
7
|
+
const tokenPairSchema = z.strictObject({
|
|
8
|
+
accessToken: z.string().min(1).max(256),
|
|
9
|
+
accessTokenExpiresAt: z.number().int().positive(),
|
|
10
|
+
refreshToken: z.string().min(1).max(256),
|
|
11
|
+
refreshTokenExpiresAt: z.number().int().positive()
|
|
12
|
+
});
|
|
13
|
+
const pendingSchema = z.strictObject({
|
|
14
|
+
timestamp: z.number(),
|
|
15
|
+
nonce: z.string(),
|
|
16
|
+
requestId: z.uuid(),
|
|
17
|
+
nextRefreshToken: z.string(),
|
|
18
|
+
requestProofVersion: z.literal(1)
|
|
19
|
+
});
|
|
20
|
+
const hostCredentialSchema = z.strictObject({
|
|
21
|
+
gatewayUrl: z.url(),
|
|
22
|
+
gatewayId: z.uuid(),
|
|
23
|
+
gatewayPublicKey: z.string().max(1e3),
|
|
24
|
+
tokens: tokenPairSchema,
|
|
25
|
+
pendingRefresh: pendingSchema.optional()
|
|
26
|
+
});
|
|
27
|
+
const digest = (bytes) => createHash("sha256").update(bytes).digest("hex");
|
|
28
|
+
/** Owner bootstrap is used once; subsequent HTTP/WS requests use only signed host-scoped credentials. */
|
|
29
|
+
async function createDeviceHostCredentials(options) {
|
|
30
|
+
const { origin, identity, signal } = options;
|
|
31
|
+
const fetchJson = async (path, body, headers = {}) => {
|
|
32
|
+
const response = await fetch(new URL(path, origin), {
|
|
33
|
+
method: "POST",
|
|
34
|
+
headers: {
|
|
35
|
+
"Content-Type": "application/json",
|
|
36
|
+
...headers
|
|
37
|
+
},
|
|
38
|
+
body: JSON.stringify(body),
|
|
39
|
+
redirect: "error",
|
|
40
|
+
signal: AbortSignal.any([signal, AbortSignal.timeout(15e3)])
|
|
41
|
+
});
|
|
42
|
+
if (!response.ok) throw new Error(`Device credential request failed: HTTP ${response.status}`);
|
|
43
|
+
return response.json();
|
|
44
|
+
};
|
|
45
|
+
if (identity.credential) {
|
|
46
|
+
identity.credential = hostCredentialSchema.parse(identity.credential);
|
|
47
|
+
if (identity.credential.gatewayUrl !== origin.origin) throw new Error("Device identity belongs to another Gateway origin; use a separate identity file");
|
|
48
|
+
} else {
|
|
49
|
+
if (!options.bootstrapToken) throw new Error("First device host enrollment requires an owner bootstrap credential");
|
|
50
|
+
const response = await fetchJson("/api/endpoint-tools/hosts/enrollment", {
|
|
51
|
+
principalId: identity.principalId,
|
|
52
|
+
publicKey: identity.publicKey,
|
|
53
|
+
displayName: options.displayName,
|
|
54
|
+
platform: process.platform
|
|
55
|
+
}, { Authorization: `Bearer ${options.bootstrapToken}` });
|
|
56
|
+
if (response.ok !== true) throw new Error("Device host enrollment was rejected");
|
|
57
|
+
identity.credential = hostCredentialSchema.parse({
|
|
58
|
+
gatewayUrl: origin.origin,
|
|
59
|
+
...response.payload
|
|
60
|
+
});
|
|
61
|
+
await options.persist();
|
|
62
|
+
}
|
|
63
|
+
let refresh;
|
|
64
|
+
const ensureAccess = async () => {
|
|
65
|
+
const credential = identity.credential;
|
|
66
|
+
if (!credential.pendingRefresh && credential.tokens.accessTokenExpiresAt > Date.now() + 6e4) return;
|
|
67
|
+
refresh ??= (async () => {
|
|
68
|
+
credential.pendingRefresh ??= {
|
|
69
|
+
timestamp: Date.now(),
|
|
70
|
+
nonce: randomBytes(24).toString("base64url"),
|
|
71
|
+
requestId: randomUUID(),
|
|
72
|
+
nextRefreshToken: `xopc_rt_${randomUUID()}_${randomBytes(32).toString("base64url")}`,
|
|
73
|
+
requestProofVersion: 1
|
|
74
|
+
};
|
|
75
|
+
credential.pendingRefresh.timestamp = Date.now();
|
|
76
|
+
credential.pendingRefresh.nonce = randomBytes(24).toString("base64url");
|
|
77
|
+
await options.persist();
|
|
78
|
+
const pending = credential.pendingRefresh;
|
|
79
|
+
const match = /^xopc_rt_([0-9a-f-]{36})_/i.exec(credential.tokens.refreshToken);
|
|
80
|
+
if (!match) throw new Error("Invalid device refresh credential");
|
|
81
|
+
const message = buildRefreshProofMessage({
|
|
82
|
+
...pending,
|
|
83
|
+
credentialId: match[1]
|
|
84
|
+
});
|
|
85
|
+
const response = await fetchJson("/api/device-auth/refresh", {
|
|
86
|
+
...pending,
|
|
87
|
+
refreshToken: credential.tokens.refreshToken,
|
|
88
|
+
signature: sign("sha256", Buffer.from(message), {
|
|
89
|
+
key: identity.privateKey,
|
|
90
|
+
dsaEncoding: "ieee-p1363"
|
|
91
|
+
}).toString("base64url")
|
|
92
|
+
});
|
|
93
|
+
if (response.ok !== true || typeof response.signedPayload !== "string" || response.signedPayload.length > 8192 || typeof response.signature !== "string" || !verify(null, Buffer.from(response.signedPayload), credential.gatewayPublicKey, Buffer.from(response.signature, "base64url"))) throw new Error("Invalid Gateway credential rotation signature");
|
|
94
|
+
const payload = JSON.parse(Buffer.from(response.signedPayload, "base64url").toString());
|
|
95
|
+
if (payload.purpose !== "device-refresh-v3" || payload.gatewayId !== credential.gatewayId || payload.requestId !== pending.requestId || payload.nonce !== pending.nonce || payload.requestProofVersion !== 1 || payload.expiresAt <= Date.now() || payload.expiresAt > Date.now() + 6e4) throw new Error("Gateway credential rotation response changed");
|
|
96
|
+
const tokens = tokenPairSchema.parse(payload.tokens);
|
|
97
|
+
if (tokens.refreshToken !== pending.nextRefreshToken) throw new Error("Gateway refresh credential differs from the recorded rotation");
|
|
98
|
+
credential.tokens = tokens;
|
|
99
|
+
delete credential.pendingRefresh;
|
|
100
|
+
await options.persist();
|
|
101
|
+
})().finally(() => {
|
|
102
|
+
refresh = void 0;
|
|
103
|
+
});
|
|
104
|
+
await refresh;
|
|
105
|
+
};
|
|
106
|
+
const proofHeaders = (credential, method, target, body, headers) => {
|
|
107
|
+
const proof = {
|
|
108
|
+
timestamp: Date.now(),
|
|
109
|
+
nonce: randomBytes(24).toString("base64url"),
|
|
110
|
+
digest: digest(body)
|
|
111
|
+
};
|
|
112
|
+
const message = deviceRequestProofMessage({
|
|
113
|
+
gatewayId: identity.credential.gatewayId,
|
|
114
|
+
credentialDigest: digest(credential),
|
|
115
|
+
method,
|
|
116
|
+
target,
|
|
117
|
+
headers: (name) => Object.entries(headers).find(([key]) => key.toLowerCase() === name)?.[1],
|
|
118
|
+
proof
|
|
119
|
+
});
|
|
120
|
+
const signature = sign("sha256", Buffer.from(message), {
|
|
121
|
+
key: identity.privateKey,
|
|
122
|
+
dsaEncoding: "ieee-p1363"
|
|
123
|
+
}).toString("base64url");
|
|
124
|
+
return {
|
|
125
|
+
...headers,
|
|
126
|
+
"X-Xopc-Proof": `${proof.timestamp}.${proof.nonce}.${proof.digest}.${signature}`
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
return {
|
|
130
|
+
async headers(method, target, body = "", headers = {}) {
|
|
131
|
+
await ensureAccess();
|
|
132
|
+
const token = identity.credential.tokens.accessToken;
|
|
133
|
+
return {
|
|
134
|
+
...proofHeaders(token, method, target, body, headers),
|
|
135
|
+
Authorization: `Bearer ${token}`
|
|
136
|
+
};
|
|
137
|
+
},
|
|
138
|
+
connectionHeaders(ticket) {
|
|
139
|
+
return proofHeaders(ticket, "CONNECT", "/api/realtime/v1/ws", "", {});
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
//#endregion
|
|
144
|
+
export { createDeviceHostCredentials, hostCredentialSchema };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { EndpointToolRuntime } from './runtime.js';
|
|
2
|
-
export {
|
|
2
|
+
export { EndpointTaskTargetService, type EndpointExecutionTarget, } from './task-targets.js';
|
|
3
3
|
export { EndpointInvocationService, EndpointToolExecutionError, type EndpointInvocationAuditSink, type EndpointInvocationResult, } from './invocation-service.js';
|
|
4
4
|
export { EndpointToolPolicy, EndpointToolPolicyError } from './policy.js';
|
|
5
5
|
export { EndpointRegistry, endpointToolRevision, type EndpointConnectionSnapshot, type RegisteredEndpointTool, } from './registry.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EndpointToolPolicy, EndpointToolPolicyError } from "./policy.js";
|
|
2
|
-
import { EndpointInvocationService, EndpointToolExecutionError } from "./invocation-service.js";
|
|
3
|
-
import { EndpointBindingService } from "./binding-service.js";
|
|
4
2
|
import { EndpointRegistry, endpointToolRevision } from "./registry.js";
|
|
3
|
+
import { EndpointInvocationService, EndpointToolExecutionError } from "./invocation-service.js";
|
|
4
|
+
import { EndpointTaskTargetService } from "./task-targets.js";
|
|
5
5
|
import { ENDPOINT_UPLOAD_MAX_BYTES, EndpointUploadError, EndpointUploadService } from "./upload-service.js";
|
|
6
6
|
import { EndpointToolRuntime } from "./runtime.js";
|
|
7
|
-
export { ENDPOINT_UPLOAD_MAX_BYTES,
|
|
7
|
+
export { ENDPOINT_UPLOAD_MAX_BYTES, EndpointInvocationService, EndpointRegistry, EndpointTaskTargetService, EndpointToolExecutionError, EndpointToolPolicy, EndpointToolPolicyError, EndpointToolRuntime, EndpointUploadError, EndpointUploadService, endpointToolRevision };
|
|
@@ -1,25 +1,41 @@
|
|
|
1
|
-
import { type DesktopOperationIntent, type ClientEndpointMessage, type EndpointToolContent, type EndpointToolDescriptor, type EndpointToolErrorCode } from '@xopcai/endpoint-tools-protocol';
|
|
1
|
+
import { type DesktopOperationIntent, type ProviderOperationIntent, type ProviderOperationReceipt, type ClientEndpointMessage, type EndpointToolContent, type EndpointToolDescriptor, type EndpointToolErrorCode } from '@xopcai/endpoint-tools-protocol';
|
|
2
2
|
import { EndpointRegistry } from './registry.js';
|
|
3
3
|
import { EndpointToolPolicy } from './policy.js';
|
|
4
|
-
import type { EndpointUploadService } from './upload-service.js';
|
|
4
|
+
import type { EndpointInvocationScope, EndpointUploadService } from './upload-service.js';
|
|
5
5
|
type ToolClientMessage = Exclude<ClientEndpointMessage, {
|
|
6
|
-
type: `endpoint.${string}`;
|
|
6
|
+
type: `endpoint.${string}` | `provider.${string}`;
|
|
7
7
|
}>;
|
|
8
8
|
type PendingState = 'sent' | 'running';
|
|
9
|
+
type DeviceInteraction = Extract<ClientEndpointMessage, {
|
|
10
|
+
type: 'provider.interaction.request';
|
|
11
|
+
}>['payload'];
|
|
12
|
+
type InteractionOrigin = EndpointInvocationScope & {
|
|
13
|
+
runId: string;
|
|
14
|
+
targetRef?: string;
|
|
15
|
+
};
|
|
9
16
|
interface PendingInvocation {
|
|
10
17
|
id: string;
|
|
11
18
|
endpointId: string;
|
|
12
19
|
toolName: string;
|
|
13
20
|
descriptor: EndpointToolDescriptor;
|
|
21
|
+
providerDigest?: string;
|
|
22
|
+
resourceKey?: string;
|
|
14
23
|
arguments: Record<string, unknown>;
|
|
24
|
+
deadlineAt: number;
|
|
25
|
+
interactionScope?: EndpointInvocationScope;
|
|
26
|
+
interaction?: DeviceInteraction;
|
|
27
|
+
interactionRequests?: Set<string>;
|
|
28
|
+
interactionOrigin?: InteractionOrigin;
|
|
29
|
+
recovered?: boolean;
|
|
15
30
|
state: PendingState;
|
|
16
31
|
operationQuery?: DesktopOperationIntent;
|
|
32
|
+
providerExecution?: ProviderOperationIntent;
|
|
17
33
|
execution?: {
|
|
18
34
|
intent: DesktopOperationIntent;
|
|
19
35
|
connectionInstanceId: string;
|
|
20
36
|
};
|
|
21
37
|
stopTimer?: ReturnType<typeof setTimeout>;
|
|
22
|
-
receiptTimer
|
|
38
|
+
receiptTimer?: ReturnType<typeof setTimeout>;
|
|
23
39
|
deadlineTimer: ReturnType<typeof setTimeout>;
|
|
24
40
|
abortSignal?: AbortSignal;
|
|
25
41
|
abortHandler?: () => void;
|
|
@@ -52,15 +68,19 @@ export interface EndpointInvocationAuditSink {
|
|
|
52
68
|
errorCode?: EndpointToolErrorCode;
|
|
53
69
|
errorMessage?: string;
|
|
54
70
|
completedAt: number;
|
|
71
|
+
recovered?: true;
|
|
55
72
|
}): void;
|
|
56
73
|
}
|
|
57
74
|
export interface EndpointInvocationServiceOptions {
|
|
75
|
+
authorizeProvider?: (endpointId: string, toolName: string) => void;
|
|
58
76
|
audit?: EndpointInvocationAuditSink;
|
|
59
77
|
uploads?: EndpointUploadService;
|
|
60
78
|
policy?: EndpointToolPolicy;
|
|
79
|
+
authorizeInteractionRecovery?: (origin: InteractionOrigin, endpointId: string) => boolean;
|
|
61
80
|
}
|
|
62
81
|
export interface EndpointInvocationResult {
|
|
63
82
|
invocationId?: string;
|
|
83
|
+
providerReceipt?: ProviderOperationReceipt;
|
|
64
84
|
content: EndpointToolContent[];
|
|
65
85
|
details?: Record<string, unknown>;
|
|
66
86
|
}
|
|
@@ -72,10 +92,14 @@ export declare class EndpointToolExecutionError extends Error {
|
|
|
72
92
|
export declare class EndpointInvocationService {
|
|
73
93
|
private readonly registry;
|
|
74
94
|
private readonly options;
|
|
95
|
+
private readonly interactionCheckpoints;
|
|
96
|
+
private nextInteractionPruneAt;
|
|
75
97
|
private readonly pending;
|
|
76
98
|
private readonly policy;
|
|
77
99
|
private readonly ajv;
|
|
100
|
+
private readonly validators;
|
|
78
101
|
constructor(registry: EndpointRegistry, options?: EndpointInvocationServiceOptions);
|
|
102
|
+
private validator;
|
|
79
103
|
invoke(params: {
|
|
80
104
|
endpointId: string;
|
|
81
105
|
toolCallId: string;
|
|
@@ -83,6 +107,8 @@ export declare class EndpointInvocationService {
|
|
|
83
107
|
arguments: Record<string, unknown>;
|
|
84
108
|
descriptorRevision: string;
|
|
85
109
|
operationId?: string;
|
|
110
|
+
invocationScope?: EndpointInvocationScope;
|
|
111
|
+
interactionOrigin?: InteractionOrigin;
|
|
86
112
|
signal?: AbortSignal;
|
|
87
113
|
onProgress?: (progress: {
|
|
88
114
|
message?: string;
|
|
@@ -90,9 +116,26 @@ export declare class EndpointInvocationService {
|
|
|
90
116
|
}) => void;
|
|
91
117
|
onTerminal?: PendingInvocation['onTerminal'];
|
|
92
118
|
}): Promise<EndpointInvocationResult>;
|
|
119
|
+
requestInteraction(endpointId: string, request: DeviceInteraction): void;
|
|
120
|
+
private reattachInteraction;
|
|
121
|
+
listInteractions(scope: EndpointInvocationScope, activeActor?: boolean): {
|
|
122
|
+
endpointId: string;
|
|
123
|
+
toolName: string;
|
|
124
|
+
deadlineAt: number;
|
|
125
|
+
invocationId: string;
|
|
126
|
+
requestId: string;
|
|
127
|
+
message: string;
|
|
128
|
+
inputSchema: Record<string, unknown>;
|
|
129
|
+
}[];
|
|
130
|
+
answerInteraction(scope: EndpointInvocationScope, requestId: string, action: 'accept' | 'decline' | 'cancel', content?: Record<string, unknown>, activeActor?: boolean): boolean;
|
|
131
|
+
private interactionMatches;
|
|
93
132
|
handleMessage(endpointId: string, message: ToolClientMessage): void;
|
|
94
133
|
failEndpoint(endpointId: string): void;
|
|
134
|
+
invalidateContracts(endpointId: string): void;
|
|
95
135
|
close(): void;
|
|
136
|
+
discardDetachedInteractions(): void;
|
|
137
|
+
private pruneInteractionCheckpoints;
|
|
138
|
+
private markInteractionUnknown;
|
|
96
139
|
private cancel;
|
|
97
140
|
private verifyExecutionReceipt;
|
|
98
141
|
private succeed;
|