@xopcai/xopc 0.0.437 → 0.0.438
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/{page-context-b-rB5vJC.js → page-context-DngcqfGf.js} +130 -9
- package/dist/browser-ext/dist/background.js +9 -1
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-CXhhy7_9.js → activity-store-Fl327RND.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-_h4GxzUK.js → agent-avatar-dicebear-DL_MfWA8.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-display-B_QEDfMT.js → agent-avatar-display-BTDt883i.js} +2 -2
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DWIluCZB.js → agent-defaults-settings-panel-CuiIuR1Q.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-lCWIS06R.js → agent-plugin-dialog-moOAOJPs.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-C-tIn72l.js → agents-B1yM1cWS.js} +3 -3
- package/dist/gateway/static/root/assets/{agents-admin-api-DIStX2e1.js → agents-admin-api-D6pZX7nW.js} +1 -1
- package/dist/gateway/static/root/assets/{api-C4xrqOKi.js → api-H3OfSCEz.js} +1 -1
- package/dist/gateway/static/root/assets/{api-bT-kA268.js → api-np_upIrk.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-Dk75Bmi2.js → app-management-settings-panel-IFKcvOK9.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DTj1XI4v.js → appearance-settings-Cfb4s0Ik.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-7iAULaEl.js → apps-page-DMDwnwEi.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-BADrW4yR.js → archive-plugin-DBKvxHvn.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-api-CRz5EE_c.js → automation-api-iUvu64Gn.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-result-state-D0EHDk4V.js → automation-result-state-EFwxlLpI.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-run-list-CnaV2j9R.js → automation-run-list-C66yqC4g.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-task-card-DD4yjrI6.js → automation-task-card-DXNh_uKL.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-DDNx4Gn3.js → automations-page-iCsHbzY_.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-CtidgXTX.js → automations-workspace-DnLrs-fb.js} +2 -2
- package/dist/gateway/static/root/assets/{binary-plugins-hpeH8g5V.js → binary-plugins-C5K0CWqt.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-P_RGb2rE.js → block-editor-3TVEcFpk.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automation-inputs-C3gQlgox.js → browser-automation-inputs-Wuph6STC.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-CsdyL6q5.js → browser-automations-page-THaENU71.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-control-api-Btwz8koK.js → browser-control-api-DeRUE9Io.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-B-ks3b8r.js → browser-settings-page-CeNb4Kyc.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-f0YyWX04.js → capabilities-B3cchabB.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-C4F2D1gH.js → capabilities-CFO_gAma.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-CJm5gNu8.js → capabilities-page-KM3X4Bj-.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-BMg8DBa0.js → capabilities-settings-panel-CX201jtA.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-DYgvP8sO.js → channels-DmF6s5BH.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-agents-api-BrsUEl3u.js → chat-agents-api-ipkXPITj.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-chart-block-Cq3aoRzV.js → chat-chart-block-KOdy3HcB.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-page-dh7ImvX8.js → chat-page-DZy7iw5A.js} +6 -6
- package/dist/gateway/static/root/assets/{chat-terminal-dock-2eGZ5qZ7.js → chat-terminal-dock-BouLAS3C.js} +1 -1
- package/dist/gateway/static/root/assets/{command-palette-api-BEqdX7Q-.js → command-palette-api-CHEmmKmY.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-payload-handoff-BBm3ypBb.js → composer-payload-handoff-DQVtV0L9.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-DUhsxs4l.js → computer-settings-page-DwEzbr0-.js} +1 -1
- package/dist/gateway/static/root/assets/{connected-providers-grid-BsCLGLnw.js → connected-providers-grid-CWdA7VtN.js} +1 -1
- package/dist/gateway/static/root/assets/{connection-usage-guide-BgvvHMc4.js → connection-usage-guide-5RmYdXoS.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-C3SmPK1c.js → connector-service-page-TeYvzScr.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-Now9xXuA.js → connectors-api-Byw6RD4z.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-CTMeC7Pt.js → connectors-page-B4PrSnT8.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-CBoc2ETg.js → date-picker-BpccZyjF.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DS2dJydK.js → desktop-pet-DfGMB4GN.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CzGc9byI.js → desktop-pet-settings-ky__zEoY.js} +1 -1
- package/dist/gateway/static/root/assets/{dev-view-store-BXMp1Npf.js → dev-view-store-do-XMWDA.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard--SCayxiS.js → device-pairing-wizard-CQNlQGYH.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-P_-tLtwi.js → directory-picker-path-field-DjhHz-4p.js} +1 -1
- package/dist/gateway/static/root/assets/{discussion-annotation-sync-D_NJLur2.js → discussion-annotation-sync-CvGsuUi9.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CE9KJpjL.js → extension-debug-page-BimrAkDl.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-ClbrQvGF.js → extension-iframe-host-7zoDddj6.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-marketplace-api-BNNQYLeu.js → extension-marketplace-api-DA-nbL9C.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-C6qZ9pGs.js → extension-page-wjS2go2N.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-KmpUveDY.js → extension-provider-C2L-lGqA.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DWKB4ETv.js → extension-settings-page-CTHs7h7H.js} +1 -1
- package/dist/gateway/static/root/assets/{file-preview-surface-CEDfehx5.js → file-preview-surface-QUJiCKCs.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-CtEdaxOS.js → gateway-config-swr-RHiDzhCY.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-DUlVfng6.js +1 -0
- package/dist/gateway/static/root/assets/gateway-realtime-store-C_CDU3to.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-restart-srJ9TMC5.js → gateway-restart-L34umMj8.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DWVxjM9y.js → gateway-settings-DjwPEBcq.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-xpHdw5uq.js → gateway-startup-retry-CgLo6P66.js} +1 -1
- package/dist/gateway/static/root/assets/{global-defaults-api-C-ogBDn1.js → global-defaults-api-Cv6QEJBa.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-2Uj--v_o.js → home-page-D9gDR4MB.js} +2 -2
- package/dist/gateway/static/root/assets/{image-generation-api-DFGE3Ait.js → image-generation-api-C_GDIILz.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-BkslHrr5.js → imports-page-CvY8wdNu.js} +1 -1
- package/dist/gateway/static/root/assets/{index-BxHzmTJV.js → index-BVyX4V3C.js} +5 -5
- package/dist/gateway/static/root/assets/{install-connector-dialog-Fctw32Lx.js → install-connector-dialog-Cnx5oOXv.js} +1 -1
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DFBpeaA_.js → keyboard-shortcuts-settings-AXisbvQn.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-hJzkUVoK.js → local-app-workbench-page-DxO9ZTU_.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-Bj-nywIv.js → local-apps-page-sas0hMvK.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-hodTdtvj.js → local-session-drafts-DzHbV0VQ.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-LhhHA2sK.js → locale-store-BRJAl_Kx.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CcM2foZi.js → logs-page-BkuLDfZ4.js} +1 -1
- package/dist/gateway/static/root/assets/management-settings-CPPZfnc7.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-usF9EoMp.js → markdown-view-BRNPKsnn.js} +1 -1
- package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-CfHcS8aO.js → mcp-conversation-setup-page-C5gTNa2U.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Kpj3pQ3i.js → media-plugins-BMvgnbE7.js} +1 -1
- package/dist/gateway/static/root/assets/messages-Ct1hODNU.js +3 -0
- package/dist/gateway/static/root/assets/{model-selector-VVkCmNdS.js → model-selector-kWRDioTb.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-cache-BfrcizHv.js → models-hub-cache-h2vf54qy.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-vvlPKLHz.js → note-detail-panel-DcTiI934.js} +3 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-Bjefof6e.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-DflS6I2c.js → notes-api-D29fdWyC.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-DKPHaszO.js → notes-page-CqnQ_UEf.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-api-CZiot_FY.js → oauth-api-C8McgC-r.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-provider-connect-BjLEJ4az.js → oauth-provider-connect-BDTdg0lv.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-C3okR3ap.js → page-context-capture-button-Bf0qvNmd.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-draft-DRE6i2wO.js → page-context-draft-Dx0F3tHK.js} +1 -1
- package/dist/gateway/static/root/assets/page-header-store-lsAlAXWQ.js +1 -0
- package/dist/gateway/static/root/assets/{personal-avatar-TZzkeDZK.js → personal-avatar-CpEFjQ4Q.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-Cz-KnXHT.js → personal-page-BvjPpwdy.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-settings-panel-BilBWHZ1.js → personal-settings-panel-DixKsLRd.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-dependencies-card-B_l_JCRy.js → phone-dependencies-card-BfpFV3SG.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-connection-DmYRqxCF.js → phone-model-connection-Os87SvBE.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-picker-wK2tRuj0.js → phone-model-picker-8pkA8k_N.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-settings-page-DWUZuu3k.js → phone-settings-page-ByERmr61.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-workspace-store-CpH233TG.js → phone-workspace-store-DfhWmYic.js} +1 -1
- package/dist/gateway/static/root/assets/{plugin-details-dialog-DIQH12Ki.js → plugin-details-dialog-J4PKpTud.js} +1 -1
- package/dist/gateway/static/root/assets/{preference-select-fields-DPXt3YyQ.js → preference-select-fields-C-PLFUS9.js} +1 -1
- package/dist/gateway/static/root/assets/{product-automation-feedback-BVkkAJkY.js → product-automation-feedback-DLsF8VBW.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-D-fwzOTB.js → product-open-page-BP-ssaP8.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-DLnOxTnn.js → product-preview-content-BMI7ZuKU.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-modal-AeEtUDZQ.js → product-preview-modal-DZ0zi6ZF.js} +2 -2
- package/dist/gateway/static/root/assets/{project-detail-page-B7L3Kvhc.js → project-detail-page-CS-NrYi5.js} +1 -1
- package/dist/gateway/static/root/assets/{project-understanding-tqZ0etEw.js → project-understanding-C9WWE-3t.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-D65pw44g.js → projects-page-DVa38OsG.js} +1 -1
- package/dist/gateway/static/root/assets/{providers-api-DzeStdCu.js → providers-api-C1KpkGUT.js} +1 -1
- package/dist/gateway/static/root/assets/{recording-upload-Id3p5Vyv.js → recording-upload-T5ArHnPJ.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-B3YqZBhQ.js → registry-api-Cs-R00dn.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-DxAInmWy.js → remote-access-hub-C6NBt2s-.js} +1 -1
- package/dist/gateway/static/root/assets/{resource-unavailable-DH-GGLSM.js → resource-unavailable-BuySLm9q.js} +1 -1
- package/dist/gateway/static/root/assets/{route-preload-C22MIvup.js → route-preload-CDMyXjLQ.js} +2 -2
- package/dist/gateway/static/root/assets/{runtime-tools-api-8mXDTzc2.js → runtime-tools-api-CvTCMobW.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-S2HxRVlT.js → runtime-tools-settings-panel-DlW9tAnO.js} +1 -1
- package/dist/gateway/static/root/assets/{service-recommendation-list-DFqBz8S6.js → service-recommendation-list-Biono7Ua.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-DZ2Ov33K.js → session-api-BNt6b3Xl.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-DSaoWM1F.js → session-manager-CQNN8D0M.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-BpUbNplq.js → sessions-page-3LErqoR9.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-SSCcDrIV.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-section-TJ8MAroB.js → settings-advanced-section-D4uJuQwW.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-mode-store-xhm6JIs-.js → settings-mode-store-CnG8uLvP.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-B_XKKvWr.js → settings-page-9BthXfuc.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-BEDxq_lT.js → settings-page-header-BXdbhzia.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-BftgkTYo.js → settings-page-layout-BQvK_gmr.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-interaction-page-BtihoIoz.js → setup-interaction-page-D1uhozUt.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-DehYof2V.js → setup-status-panel-C1o4-hF4.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-C-mhzvLF.js → share-link-dialog-QTEdYG4I.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-Cnxfv66F.js → share-preview-page-Ba77bFgS.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-D2HTaQZH.js → shares-api-DayDdoBR.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-BLcnCGon.js → shares-settings-67poMpxi.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-DOISy5q8.js → skill-api-DR3vdsrS.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-list-api-LoIlcCDf.js → skill-list-api-D6X3XyTd.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-qSwB_mAH.js → skill-reload-api-Wu0UkQ13.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-CJXLVK0U.js → skills-page-FmjOxilb.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BT6_yFco.js → system-settings-panel-BLeXSW3w.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-1AFyRTia.js → task-detail-page-B5uwlFwb.js} +1 -1
- package/dist/gateway/static/root/assets/{task-result-evidence-CkwEM0In.js → task-result-evidence-m78K4eAp.js} +1 -1
- package/dist/gateway/static/root/assets/{terminal-panel-store-BP3dN3md.js → terminal-panel-store-CWpiIbPY.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-BZ8YC33M.js → theme-store-B9upxkW-.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-9YvEnES_.js → tracing-settings-page-CACPSXVV.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-CnPOg1pg.js → tunnel-api-CCC7XSFJ.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-activity-store-3sOhoxX4.js → understanding-activity-store-D7WFQ-t7.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-refresh-store-BBXlbRLa.js → understanding-refresh-store-CvOFPfDi.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-6LW4yLy1.js → usage-page-P9-7xf1p.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-CDy9yziL.js → use-autosave-BNNxl23c.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-C4eSyX-C.js → use-composer-attachments-7uMSpyxm.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-SFqd8k7K.js → use-file-preview-expanded-C-NCuwM3.js} +2 -2
- package/dist/gateway/static/root/assets/{use-personal-profile-sQzaa6Dy.js → use-personal-profile-1lm_wDMe.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-DKPvcyw1.js → use-workspace-tree-HlkNpRDC.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-DYVp7nA6.js → user-model-page-B6XfYtEm.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-BKXWXCit.js → voice-api-key-field-CRZS6XEF.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-DNxzs-eF.js → voice-config-api-CrgRaCMk.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-input-shortcut-events-3kcfHPrY.js → voice-input-shortcut-events-vjcw6SRC.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-transcribe-api-CVVa_x99.js → voice-transcribe-api-CtUoGgGT.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-B4F3MACu.js → work-discovery-overlay-C9tI_qQv.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-BuKTCGSR.js → work-discovery-page-C-8kE4mx.js} +1 -1
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-BiDK93J_.js → working-directory-picker-modal-B5fxn2wG.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-api-S2aJOX7w.js → workspace-api-DP2ozrRe.js} +2 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-Dw3xS3sE.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-B9f3GN7l.js → workspace-file-preview-dialog-Cp86E6-h.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-BNjipenH.js → workspace-open-location-menu-CWOgHMmR.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-Csye7zKU.js → xopc-cloud-account-card-CIaHnCGw.js} +1 -1
- package/dist/gateway/static/root/index.html +80 -80
- package/dist/package.js +1 -1
- package/dist/packages/browser-control-contract/src/remote.js +237 -0
- package/dist/packages/computer-control-contract/src/index.js +12 -2
- package/dist/packages/endpoint-tools-client/src/index.js +8 -0
- package/dist/packages/endpoint-tools-protocol/src/command.js +83 -0
- package/dist/packages/endpoint-tools-protocol/src/execution.js +102 -0
- package/dist/packages/endpoint-tools-protocol/src/index.js +61 -7
- package/dist/packages/endpoint-tools-protocol/src/operation-status.js +76 -0
- package/dist/packages/endpoint-tools-protocol/src/screen.js +28 -0
- package/dist/packages/endpoint-tools-protocol/src/terminal.js +173 -0
- package/dist/packages/endpoint-tools-protocol/src/workspace.js +143 -0
- package/dist/packages/gateway-contract/src/desktop-chat.js +29 -0
- package/dist/packages/gateway-contract/src/desktop-execution-stop.js +36 -0
- package/dist/packages/gateway-contract/src/desktop-host.js +87 -0
- package/dist/packages/gateway-contract/src/device-pairing.js +17 -4
- package/dist/packages/gateway-contract/src/gateway-scopes.js +6 -2
- package/dist/packages/gateway-contract/src/index.js +6 -0
- package/dist/packages/realtime-protocol/src/index.js +15 -2
- package/dist/src/agent/context/project-context.d.ts +1 -0
- package/dist/src/agent/context/project-context.js +9 -2
- package/dist/src/agent/embedded/run-turn.js +5 -2
- package/dist/src/agent/external-tools/endpoint-provider.js +76 -4
- package/dist/src/agent/memory/context-recovery.d.ts +3 -3
- package/dist/src/agent/memory/context-recovery.js +10 -3
- package/dist/src/agent/memory/repeated-read-projection.d.ts +9 -0
- package/dist/src/agent/memory/repeated-read-projection.js +78 -0
- package/dist/src/agent/sandbox/exec-policy.js +2 -0
- package/dist/src/agent/sandbox/types.d.ts +1 -0
- package/dist/src/agent/service/direct-turn-helpers.js +2 -1
- package/dist/src/agent/service/process-direct-streaming.js +4 -2
- package/dist/src/agent/source-context/browser-tab.js +1 -0
- package/dist/src/agent/source-context/device-environment.js +9 -3
- package/dist/src/agent/source-context/index.js +7 -3
- package/dist/src/agent/source-context/injector.d.ts +4 -0
- package/dist/src/agent/source-context/injector.js +23 -8
- package/dist/src/agent/source-context/source-context-projection.d.ts +8 -0
- package/dist/src/agent/source-context/source-context-projection.js +127 -0
- package/dist/src/agent/source-context/types.js +4 -1
- package/dist/src/agent/tools/exec-command.js +3 -2
- package/dist/src/agent/tools/factory.d.ts +7 -1
- package/dist/src/agent/tools/factory.js +103 -14
- package/dist/src/automations/api/dispatcher.d.ts +6 -0
- package/dist/src/automations/api/dispatcher.js +17 -0
- package/dist/src/automations/api/routes.js +2 -6
- package/dist/src/browser/drivers/browser-driver.d.ts +1 -1
- package/dist/src/browser/remote/device-driver.d.ts +26 -0
- package/dist/src/browser/remote/device-driver.js +247 -0
- package/dist/src/browser/remote/device-runtime.d.ts +9 -0
- package/dist/src/browser/remote/device-runtime.js +27 -0
- package/dist/src/browser/remote/device-target.d.ts +4 -0
- package/dist/src/browser/remote/device-target.js +20 -0
- package/dist/src/browser/remote/endpoint-transport.d.ts +4 -0
- package/dist/src/browser/remote/endpoint-transport.js +48 -0
- package/dist/src/browser/runtime/browser-runtime.d.ts +1 -0
- package/dist/src/browser/runtime/browser-runtime.js +1 -0
- package/dist/src/browser/url-policy.js +19 -6
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/platform.js +2 -2
- package/dist/src/computer/diagnostics.d.ts +3 -3
- package/dist/src/computer/endpoint-transport.d.ts +4 -0
- package/dist/src/computer/endpoint-transport.js +54 -0
- package/dist/src/computer/evaluation.d.ts +2 -2
- package/dist/src/computer/program-runtime.js +14 -2
- package/dist/src/computer/runtime.d.ts +1 -0
- package/dist/src/computer/runtime.js +31 -11
- package/dist/src/computer/task-state.js +3 -1
- package/dist/src/endpoint-tools/capability-catalog.js +1 -1
- package/dist/src/endpoint-tools/desktop-authority-response.d.ts +19 -0
- package/dist/src/endpoint-tools/desktop-authority-response.js +38 -0
- package/dist/src/endpoint-tools/desktop-device-frame.d.ts +18 -0
- package/dist/src/endpoint-tools/desktop-device-frame.js +94 -0
- package/dist/src/endpoint-tools/desktop-execution.d.ts +14 -0
- package/dist/src/endpoint-tools/desktop-execution.js +28 -0
- package/dist/src/endpoint-tools/desktop-frame.d.ts +12 -0
- package/dist/src/endpoint-tools/desktop-frame.js +35 -0
- package/dist/src/endpoint-tools/desktop-observation.d.ts +4 -0
- package/dist/src/endpoint-tools/desktop-observation.js +20 -0
- package/dist/src/endpoint-tools/invocation-service.d.ts +35 -2
- package/dist/src/endpoint-tools/invocation-service.js +138 -14
- package/dist/src/endpoint-tools/policy.js +27 -2
- package/dist/src/endpoint-tools/registry.d.ts +5 -3
- package/dist/src/endpoint-tools/registry.js +10 -3
- package/dist/src/endpoint-tools/runtime.d.ts +4 -2
- package/dist/src/endpoint-tools/runtime.js +9 -3
- package/dist/src/endpoint-tools/terminal-broker.d.ts +90 -0
- package/dist/src/endpoint-tools/terminal-broker.js +320 -0
- package/dist/src/gateway/hono/app.js +7 -4
- package/dist/src/gateway/hono/middleware/auth.js +11 -1
- package/dist/src/gateway/hono/routes/agent-stream.js +2 -1
- package/dist/src/gateway/hono/routes/desktop-chat.d.ts +3 -0
- package/dist/src/gateway/hono/routes/desktop-chat.js +30 -0
- package/dist/src/gateway/hono/routes/desktop-execution-stop.d.ts +6 -0
- package/dist/src/gateway/hono/routes/desktop-execution-stop.js +52 -0
- package/dist/src/gateway/hono/routes/desktop-host.d.ts +3 -0
- package/dist/src/gateway/hono/routes/desktop-host.js +485 -0
- package/dist/src/gateway/hono/routes/devices.d.ts +3 -1
- package/dist/src/gateway/hono/routes/devices.js +7 -2
- package/dist/src/gateway/hono/routes/endpoint-tools.js +16 -4
- package/dist/src/gateway/hono/routes/lazy-bundles.js +21 -0
- package/dist/src/gateway/hono/routes/models.js +5 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +2 -1
- package/dist/src/gateway/security/gateway-scopes.js +10 -0
- package/dist/src/gateway/security/phone-access.js +4 -1
- package/dist/src/gateway/service/session-input-coordinator.js +5 -3
- package/dist/src/gateway/service.js +5 -4
- package/dist/src/gateway/session-context-summary.js +2 -1
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/providers/presentation.js +1 -1
- package/dist/src/realtime/runtime.js +86 -7
- package/dist/src/session/session-context-for-llm.js +3 -1
- package/dist/src/storage/sqlite/desktop-execution-repository.d.ts +44 -0
- package/dist/src/storage/sqlite/desktop-execution-repository.js +76 -0
- package/dist/src/storage/sqlite/desktop-execution-state.d.ts +13 -0
- package/dist/src/storage/sqlite/desktop-execution-state.js +22 -0
- package/dist/src/storage/sqlite/desktop-execution-stop-repository.d.ts +19 -0
- package/dist/src/storage/sqlite/desktop-execution-stop-repository.js +66 -0
- package/dist/src/storage/sqlite/desktop-operation-repository.d.ts +79 -0
- package/dist/src/storage/sqlite/desktop-operation-repository.js +143 -0
- package/dist/src/storage/sqlite/device-access-repository.d.ts +12 -0
- package/dist/src/storage/sqlite/device-access-repository.js +54 -3
- package/dist/src/storage/sqlite/device-pairing-approval.js +4 -4
- package/dist/src/storage/sqlite/device-pairing-repository.d.ts +1 -1
- package/dist/src/storage/sqlite/endpoint-principal-repository.d.ts +2 -0
- package/dist/src/storage/sqlite/endpoint-principal-repository.js +5 -1
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.d.ts +2 -0
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.js +8 -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 +48 -3
- package/dist/src/storage/sqlite/upgrades/263_desktop_device_credentials.sql +39 -0
- package/dist/src/storage/sqlite/upgrades/264_desktop_observation_grants.sql +5 -0
- package/dist/src/storage/sqlite/upgrades/265_desktop_screen_scope.sql +3 -0
- package/dist/src/storage/sqlite/upgrades/266_endpoint_operation_audit.sql +3 -0
- package/dist/src/storage/sqlite/upgrades/267_desktop_reliable_execution.sql +15 -0
- package/dist/src/storage/sqlite/upgrades/268_desktop_operation_reviews.sql +9 -0
- package/dist/src/storage/sqlite/upgrades/269_desktop_execution_stops.sql +10 -0
- package/dist/src/tasks/task-handoff.js +2 -1
- package/package.json +6 -2
- package/dist/gateway/static/root/assets/gateway-realtime-SunJUMP3.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BywiC4CK.js +0 -1
- package/dist/gateway/static/root/assets/management-settings-gwDIT7mY.js +0 -1
- package/dist/gateway/static/root/assets/messages-C3xqMM9W.js +0 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-BDZGHYaZ.js +0 -1
- package/dist/gateway/static/root/assets/page-header-store-BVj8nDdi.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CGgt1myW.js +0 -1
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-oZKoWMdV.js +0 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { DESKTOP_SCREEN_OBSERVATION_TOOL, DESKTOP_STATE_OBSERVATION_TOOL } from "../../packages/gateway-contract/src/desktop-host.js";
|
|
2
|
+
import { init_src } from "../../packages/gateway-contract/src/index.js";
|
|
3
|
+
import { createPublicKey } from "node:crypto";
|
|
4
|
+
//#region src/endpoint-tools/desktop-observation.ts
|
|
5
|
+
init_src();
|
|
6
|
+
function desktopDeviceEndpointKey(device) {
|
|
7
|
+
return createPublicKey({
|
|
8
|
+
key: device.publicKeyJwk,
|
|
9
|
+
format: "jwk"
|
|
10
|
+
}).export({
|
|
11
|
+
type: "spki",
|
|
12
|
+
format: "der"
|
|
13
|
+
}).toString("base64url");
|
|
14
|
+
}
|
|
15
|
+
function assertDesktopObservationHello(device, hello, registeredKey) {
|
|
16
|
+
const allowed = [...device.scopes.includes("desktop.observe.state") ? [DESKTOP_STATE_OBSERVATION_TOOL] : [], ...device.scopes.includes("desktop.observe.screen") ? [DESKTOP_SCREEN_OBSERVATION_TOOL] : []];
|
|
17
|
+
if (device.platform !== "desktop" || device.revokedAt !== void 0 || hello.principalId !== device.id || hello.kind !== "desktop" || hello.platform !== "desktop" || registeredKey !== desktopDeviceEndpointKey(device) || hello.tools.length !== 1 || !allowed.includes(hello.tools[0]?.name)) throw new Error("DESKTOP_OBSERVATION_DENIED");
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { assertDesktopObservationHello, desktopDeviceEndpointKey };
|
|
@@ -1,10 +1,38 @@
|
|
|
1
|
-
import { type ClientEndpointMessage, type EndpointToolContent, type EndpointToolErrorCode } from '@xopcai/endpoint-tools-protocol';
|
|
1
|
+
import { type DesktopOperationIntent, 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
4
|
import type { EndpointUploadService } from './upload-service.js';
|
|
5
5
|
type ToolClientMessage = Exclude<ClientEndpointMessage, {
|
|
6
6
|
type: `endpoint.${string}`;
|
|
7
7
|
}>;
|
|
8
|
+
type PendingState = 'sent' | 'running';
|
|
9
|
+
interface PendingInvocation {
|
|
10
|
+
id: string;
|
|
11
|
+
endpointId: string;
|
|
12
|
+
toolName: string;
|
|
13
|
+
descriptor: EndpointToolDescriptor;
|
|
14
|
+
arguments: Record<string, unknown>;
|
|
15
|
+
state: PendingState;
|
|
16
|
+
operationQuery?: DesktopOperationIntent;
|
|
17
|
+
execution?: {
|
|
18
|
+
intent: DesktopOperationIntent;
|
|
19
|
+
connectionInstanceId: string;
|
|
20
|
+
};
|
|
21
|
+
stopTimer?: ReturnType<typeof setTimeout>;
|
|
22
|
+
receiptTimer: ReturnType<typeof setTimeout>;
|
|
23
|
+
deadlineTimer: ReturnType<typeof setTimeout>;
|
|
24
|
+
abortSignal?: AbortSignal;
|
|
25
|
+
abortHandler?: () => void;
|
|
26
|
+
onProgress?: (progress: {
|
|
27
|
+
message?: string;
|
|
28
|
+
percent?: number;
|
|
29
|
+
}) => void;
|
|
30
|
+
onTerminal?: (invocationId: string, event: Extract<ClientEndpointMessage, {
|
|
31
|
+
type: 'terminal.event';
|
|
32
|
+
}>['payload']['event']) => void;
|
|
33
|
+
resolve: (result: EndpointInvocationResult) => void;
|
|
34
|
+
reject: (error: Error) => void;
|
|
35
|
+
}
|
|
8
36
|
export interface EndpointInvocationAuditSink {
|
|
9
37
|
started(params: {
|
|
10
38
|
id: string;
|
|
@@ -15,6 +43,7 @@ export interface EndpointInvocationAuditSink {
|
|
|
15
43
|
effect: 'read' | 'write' | 'destructive';
|
|
16
44
|
confirmationRequired: boolean;
|
|
17
45
|
argumentsSha256: string;
|
|
46
|
+
operationId?: string;
|
|
18
47
|
startedAt: number;
|
|
19
48
|
}): void;
|
|
20
49
|
finished(params: {
|
|
@@ -37,7 +66,8 @@ export interface EndpointInvocationResult {
|
|
|
37
66
|
}
|
|
38
67
|
export declare class EndpointToolExecutionError extends Error {
|
|
39
68
|
readonly code: EndpointToolErrorCode;
|
|
40
|
-
|
|
69
|
+
readonly confirmedNoEffect: boolean;
|
|
70
|
+
constructor(code: EndpointToolErrorCode, message: string, confirmedNoEffect?: boolean);
|
|
41
71
|
}
|
|
42
72
|
export declare class EndpointInvocationService {
|
|
43
73
|
private readonly registry;
|
|
@@ -52,16 +82,19 @@ export declare class EndpointInvocationService {
|
|
|
52
82
|
toolName: string;
|
|
53
83
|
arguments: Record<string, unknown>;
|
|
54
84
|
descriptorRevision: string;
|
|
85
|
+
operationId?: string;
|
|
55
86
|
signal?: AbortSignal;
|
|
56
87
|
onProgress?: (progress: {
|
|
57
88
|
message?: string;
|
|
58
89
|
percent?: number;
|
|
59
90
|
}) => void;
|
|
91
|
+
onTerminal?: PendingInvocation['onTerminal'];
|
|
60
92
|
}): Promise<EndpointInvocationResult>;
|
|
61
93
|
handleMessage(endpointId: string, message: ToolClientMessage): void;
|
|
62
94
|
failEndpoint(endpointId: string): void;
|
|
63
95
|
close(): void;
|
|
64
96
|
private cancel;
|
|
97
|
+
private verifyExecutionReceipt;
|
|
65
98
|
private succeed;
|
|
66
99
|
private fail;
|
|
67
100
|
private finishAudit;
|
|
@@ -1,18 +1,27 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
+
import { getOrCreateGatewayIdentity } from "../storage/sqlite/gateway-identity-repository.js";
|
|
4
|
+
import { desktopOperationReceiptSchema } from "../../packages/endpoint-tools-protocol/src/execution.js";
|
|
5
|
+
import "../../packages/endpoint-tools-protocol/src/command.js";
|
|
3
6
|
import { ENDPOINT_INVOCATION_RECEIPT_TIMEOUT_MS, canonicalJson, init_src } from "../../packages/endpoint-tools-protocol/src/index.js";
|
|
7
|
+
import { init_src as init_src$1 } from "../../packages/computer-control-contract/src/index.js";
|
|
8
|
+
import "../../packages/browser-control-contract/src/remote.js";
|
|
9
|
+
import { getDesktopExecutionGrant } from "../storage/sqlite/desktop-execution-repository.js";
|
|
10
|
+
import { getDesktopOperationIntent, recordDesktopOperationIntent, recordDesktopOperationReceipt } from "../storage/sqlite/desktop-operation-repository.js";
|
|
4
11
|
import { EndpointToolPolicy, EndpointToolPolicyError } from "./policy.js";
|
|
5
12
|
import crypto from "node:crypto";
|
|
6
13
|
import { z } from "zod";
|
|
7
14
|
import Ajv2020 from "ajv/dist/2020.js";
|
|
8
15
|
//#region src/endpoint-tools/invocation-service.ts
|
|
16
|
+
init_src$1();
|
|
9
17
|
init_src();
|
|
10
18
|
init_logger();
|
|
11
19
|
const log = createLogger("EndpointInvocations");
|
|
12
20
|
var EndpointToolExecutionError = class extends Error {
|
|
13
|
-
constructor(code, message) {
|
|
21
|
+
constructor(code, message, confirmedNoEffect = false) {
|
|
14
22
|
super(message);
|
|
15
23
|
this.code = code;
|
|
24
|
+
this.confirmedNoEffect = confirmedNoEffect;
|
|
16
25
|
this.name = "EndpointToolExecutionError";
|
|
17
26
|
}
|
|
18
27
|
};
|
|
@@ -33,16 +42,19 @@ var EndpointInvocationService = class {
|
|
|
33
42
|
});
|
|
34
43
|
}
|
|
35
44
|
invoke(params) {
|
|
45
|
+
if (params.operationId !== void 0 && !z.uuid().safeParse(params.operationId).success) return Promise.reject(this.error("INVALID_ARGUMENTS", "Invalid stable operation identity"));
|
|
36
46
|
const endpoint = this.registry.get(params.endpointId);
|
|
37
47
|
if (!endpoint) return Promise.reject(this.error("ENDPOINT_OFFLINE", "Endpoint is offline"));
|
|
48
|
+
if (["desktop.computer.remote_control", "desktop.browser.control"].includes(params.toolName) && !endpoint.executionAuthority) return Promise.reject(new EndpointToolExecutionError("PERMISSION_DENIED", "Remote device control requires independent desktop execution authority", true));
|
|
38
49
|
const tool = this.registry.getTool(params.endpointId, params.toolName);
|
|
39
50
|
if (!tool) return Promise.reject(this.error("TOOL_NOT_FOUND", "Endpoint tool is unavailable"));
|
|
40
51
|
if (tool.revision !== params.descriptorRevision) return Promise.reject(this.error("TOOL_REVISION_MISMATCH", "Endpoint tool contract changed"));
|
|
41
|
-
if (!this.ajv.compile(tool.descriptor.inputSchema)(params.arguments)) return Promise.reject(
|
|
52
|
+
if (!this.ajv.compile(tool.descriptor.inputSchema)(params.arguments)) return Promise.reject(new EndpointToolExecutionError("INVALID_ARGUMENTS", "Invalid endpoint tool arguments", params.toolName === "desktop.command.run"));
|
|
42
53
|
if (params.toolName.startsWith("mobile.calendar.")) {
|
|
43
54
|
const { startAt, endAt } = params.arguments;
|
|
44
55
|
if (typeof startAt !== "number" || typeof endAt !== "number" || endAt <= startAt || endAt - startAt > 7 * 864e5) return Promise.reject(this.error("INVALID_ARGUMENTS", "Calendar range must be positive and at most seven days"));
|
|
45
56
|
}
|
|
57
|
+
if (["desktop.command.run", "desktop.terminal.open"].includes(params.toolName) && (!Array.isArray(params.arguments.argv) || !params.arguments.argv[0] || params.arguments.argv.some((value) => typeof value !== "string" || value.includes("\0")) || Buffer.byteLength(JSON.stringify(params.arguments.argv)) > 4e3)) return Promise.reject(new EndpointToolExecutionError("INVALID_ARGUMENTS", "Container argv exceeds its bounded contract", true));
|
|
46
58
|
let confirmationRequired;
|
|
47
59
|
try {
|
|
48
60
|
confirmationRequired = this.policy.evaluate(tool.descriptor, endpoint.availability).confirmationRequired;
|
|
@@ -57,7 +69,42 @@ var EndpointInvocationService = class {
|
|
|
57
69
|
if (endpointPending.filter((item) => item.toolName === params.toolName).length >= tool.descriptor.maxConcurrency) return Promise.reject(this.error("TOOL_BUSY", "Endpoint tool has reached its invocation limit"));
|
|
58
70
|
const invocationId = crypto.randomUUID();
|
|
59
71
|
const startedAt = Date.now();
|
|
60
|
-
|
|
72
|
+
let execution;
|
|
73
|
+
const deadlineAt = Math.min(startedAt + tool.descriptor.timeoutMs, endpoint.executionAuthority?.expiresAt ?? Infinity);
|
|
74
|
+
if ((params.toolName.startsWith("desktop.workspace.") || ["desktop.command.run", "desktop.terminal.open"].includes(params.toolName)) && (!endpoint.executionAuthority?.workspaceId || params.arguments.workspaceId !== endpoint.executionAuthority.workspaceId)) return Promise.reject(new EndpointToolExecutionError("PROTOCOL_ERROR", "The selected workspace is not authorized for this device connection", true));
|
|
75
|
+
if (endpoint.executionAuthority && tool.descriptor.effect !== "read") try {
|
|
76
|
+
const authority = endpoint.executionAuthority, grant = getDesktopExecutionGrant(authority.deviceId, startedAt);
|
|
77
|
+
if (!params.operationId || !confirmationRequired || !grant?.active || grant.revision !== authority.authorizationRevision || grant.grant?.grantId !== authority.grantId || getOrCreateGatewayIdentity().id !== authority.gatewayId) throw new Error("Desktop execution authority is no longer active");
|
|
78
|
+
execution = {
|
|
79
|
+
intent: recordDesktopOperationIntent({
|
|
80
|
+
operationId: params.operationId,
|
|
81
|
+
gatewayId: authority.gatewayId,
|
|
82
|
+
deviceId: authority.deviceId,
|
|
83
|
+
tool: params.toolName,
|
|
84
|
+
...authority.workspaceId ? { workspaceId: authority.workspaceId } : {},
|
|
85
|
+
argumentHash: crypto.createHash("sha256").update(canonicalJson(params.arguments)).digest("hex"),
|
|
86
|
+
toolRevision: tool.revision,
|
|
87
|
+
authorizationRevision: authority.authorizationRevision,
|
|
88
|
+
expiresAt: deadlineAt
|
|
89
|
+
}, authority.grantId, startedAt),
|
|
90
|
+
connectionInstanceId: authority.connectionInstanceId
|
|
91
|
+
};
|
|
92
|
+
} catch {
|
|
93
|
+
return Promise.reject(this.error("PROTOCOL_ERROR", "Durable desktop intent could not be recorded"));
|
|
94
|
+
}
|
|
95
|
+
let operationQuery;
|
|
96
|
+
if (params.toolName === "desktop.operation.get_status") {
|
|
97
|
+
const authority = endpoint.executionAuthority, grant = authority && getDesktopExecutionGrant(authority.deviceId, startedAt);
|
|
98
|
+
if (!authority?.operationStatus || !grant?.active || grant.revision !== authority.authorizationRevision || grant.grant?.grantId !== authority.grantId || typeof params.arguments.operationId !== "string") return Promise.reject(this.error("PERMISSION_DENIED", "Operation status is not authorized"));
|
|
99
|
+
operationQuery = getDesktopOperationIntent(params.arguments.operationId, authority.deviceId, authority.gatewayId);
|
|
100
|
+
if (!operationQuery) return Promise.reject(this.error("TOOL_NOT_FOUND", "Operation metadata is not available for this device"));
|
|
101
|
+
}
|
|
102
|
+
const uploadGrant = tool.descriptor.resultKinds.includes("file") ? this.options.uploads?.createGrant(invocationId, params.endpointId, startedAt, [
|
|
103
|
+
"desktop.computer.control",
|
|
104
|
+
"desktop.computer.remote_control",
|
|
105
|
+
"desktop.browser.control",
|
|
106
|
+
"desktop.screen.capture"
|
|
107
|
+
].includes(params.toolName) ? "computer-frame" : params.toolName.startsWith("mobile.") ? "personal" : "durable", endpoint.principalId) : void 0;
|
|
61
108
|
try {
|
|
62
109
|
this.options.audit?.started({
|
|
63
110
|
id: invocationId,
|
|
@@ -68,6 +115,7 @@ var EndpointInvocationService = class {
|
|
|
68
115
|
effect: tool.descriptor.effect,
|
|
69
116
|
confirmationRequired,
|
|
70
117
|
argumentsSha256: crypto.createHash("sha256").update(canonicalJson(params.arguments)).digest("hex"),
|
|
118
|
+
...params.operationId ? { operationId: params.operationId } : {},
|
|
71
119
|
startedAt
|
|
72
120
|
});
|
|
73
121
|
} catch (error) {
|
|
@@ -82,14 +130,17 @@ var EndpointInvocationService = class {
|
|
|
82
130
|
descriptor: tool.descriptor,
|
|
83
131
|
arguments: params.arguments,
|
|
84
132
|
state: "sent",
|
|
133
|
+
...execution ? { execution } : {},
|
|
134
|
+
...operationQuery ? { operationQuery } : {},
|
|
85
135
|
receiptTimer: setTimeout(() => {
|
|
86
|
-
this.fail(invocationId, this.error("TOOL_TIMEOUT", "Endpoint did not
|
|
136
|
+
this.fail(invocationId, this.error(execution ? "OUTCOME_UNKNOWN" : "TOOL_TIMEOUT", "Endpoint did not acknowledge the invocation"));
|
|
87
137
|
}, ENDPOINT_INVOCATION_RECEIPT_TIMEOUT_MS),
|
|
88
138
|
deadlineTimer: setTimeout(() => {
|
|
89
139
|
this.cancel(invocationId, "Endpoint tool timed out", "TOOL_TIMEOUT");
|
|
90
|
-
},
|
|
140
|
+
}, Math.max(1, deadlineAt - Date.now())),
|
|
91
141
|
abortSignal: params.signal,
|
|
92
142
|
onProgress: params.onProgress,
|
|
143
|
+
onTerminal: params.onTerminal,
|
|
93
144
|
resolve,
|
|
94
145
|
reject
|
|
95
146
|
};
|
|
@@ -106,11 +157,13 @@ var EndpointInvocationService = class {
|
|
|
106
157
|
arguments: params.arguments,
|
|
107
158
|
descriptorRevision: params.descriptorRevision,
|
|
108
159
|
confirmationRequired,
|
|
109
|
-
deadlineAt
|
|
160
|
+
deadlineAt,
|
|
161
|
+
...execution ? { execution: execution.intent } : {},
|
|
162
|
+
...operationQuery ? { operationQuery } : {},
|
|
110
163
|
...uploadGrant ? { uploadGrant } : {}
|
|
111
164
|
});
|
|
112
165
|
} catch {
|
|
113
|
-
this.fail(invocationId, this.error("ENDPOINT_DISCONNECTED", "Endpoint disconnected before
|
|
166
|
+
this.fail(invocationId, this.error(execution ? "OUTCOME_UNKNOWN" : "ENDPOINT_DISCONNECTED", "Endpoint disconnected before acknowledgement"));
|
|
114
167
|
}
|
|
115
168
|
});
|
|
116
169
|
}
|
|
@@ -118,7 +171,28 @@ var EndpointInvocationService = class {
|
|
|
118
171
|
const invocationId = message.payload.invocationId;
|
|
119
172
|
const pending = this.pending.get(invocationId);
|
|
120
173
|
if (!pending || pending.endpointId !== endpointId) return;
|
|
174
|
+
if ([
|
|
175
|
+
"tool.result",
|
|
176
|
+
"tool.error",
|
|
177
|
+
"tool.cancelled"
|
|
178
|
+
].includes(message.type)) try {
|
|
179
|
+
this.verifyExecutionReceipt(pending, message);
|
|
180
|
+
} catch {
|
|
181
|
+
this.fail(invocationId, this.error(pending.execution ? "OUTCOME_UNKNOWN" : "PROTOCOL_ERROR", "Endpoint operation evidence is invalid"));
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
121
184
|
switch (message.type) {
|
|
185
|
+
case "terminal.event":
|
|
186
|
+
if (pending.state !== "running" || pending.toolName !== "desktop.terminal.open" || !pending.execution || !pending.onTerminal || message.payload.event.connectionInstanceId !== pending.execution.connectionInstanceId) {
|
|
187
|
+
this.fail(invocationId, this.error("PROTOCOL_ERROR", "Terminal event is outside its running root"));
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
try {
|
|
191
|
+
pending.onTerminal(invocationId, message.payload.event);
|
|
192
|
+
} catch {
|
|
193
|
+
this.cancel(invocationId, "Terminal event failed its scope check", "TOOL_CANCELLED");
|
|
194
|
+
}
|
|
195
|
+
return;
|
|
122
196
|
case "tool.received":
|
|
123
197
|
if (pending.state !== "sent") return;
|
|
124
198
|
pending.state = "running";
|
|
@@ -138,6 +212,10 @@ var EndpointInvocationService = class {
|
|
|
138
212
|
const validate = this.ajv.compile(pending.descriptor.outputSchema);
|
|
139
213
|
if (!validate(message.payload.content)) throw new Error(`Endpoint result does not match its contract: ${this.ajv.errorsText(validate.errors)}`);
|
|
140
214
|
const reading = message.payload.content[0];
|
|
215
|
+
if (pending.operationQuery) {
|
|
216
|
+
const value = reading?.type === "json" ? reading.value : void 0;
|
|
217
|
+
if (!value || value.operationId !== pending.operationQuery.operationId || message.payload.details !== void 0 || value.status === "not-found" && value.receipt !== void 0 || value.status === "recorded" && desktopOperationReceiptSchema.parse(value.receipt).operationId !== pending.operationQuery.operationId) throw new Error("Operation status identity changed");
|
|
218
|
+
}
|
|
141
219
|
if (pending.toolName.startsWith("mobile.calendar.") && reading?.type === "json") {
|
|
142
220
|
const value = reading.value;
|
|
143
221
|
if (value.startAt !== pending.arguments.startAt || value.endAt !== pending.arguments.endAt || value.events.some((event) => event.endAt <= event.startAt || event.endAt <= value.startAt || event.startAt >= value.endAt) || pending.toolName.endsWith("free_busy") && value.events.some((event) => event.title !== void 0)) throw new Error("Calendar result exceeded the approved scope");
|
|
@@ -148,7 +226,7 @@ var EndpointInvocationService = class {
|
|
|
148
226
|
}
|
|
149
227
|
this.options.uploads?.validateAndClose(invocationId, message.payload.content);
|
|
150
228
|
} catch (error) {
|
|
151
|
-
this.fail(invocationId, this.error("PROTOCOL_ERROR", pending.descriptor.sensitivity === "personal" && pending.descriptor.effect === "read" ? "Invalid personal device result" : error instanceof Error ? error.message : String(error)));
|
|
229
|
+
this.fail(invocationId, this.error(pending.execution ? "OUTCOME_UNKNOWN" : "PROTOCOL_ERROR", pending.descriptor.sensitivity === "personal" && pending.descriptor.effect === "read" ? "Invalid personal device result" : error instanceof Error ? error.message : String(error)));
|
|
152
230
|
return;
|
|
153
231
|
}
|
|
154
232
|
this.succeed(invocationId, {
|
|
@@ -156,28 +234,68 @@ var EndpointInvocationService = class {
|
|
|
156
234
|
...message.payload.details === void 0 || pending.descriptor.sensitivity === "personal" && pending.descriptor.effect === "read" ? {} : { details: message.payload.details }
|
|
157
235
|
});
|
|
158
236
|
return;
|
|
159
|
-
case "tool.error":
|
|
160
|
-
|
|
237
|
+
case "tool.error": {
|
|
238
|
+
const content = message.payload.operationResult?.content[0], value = content?.type === "json" && content.value && typeof content.value === "object" ? content.value : void 0;
|
|
239
|
+
const noEffect = pending.toolName === "desktop.workspace.write" && Boolean(pending.execution) && message.payload.operationReceipt?.state === "failed" && typeof value?.error === "string" && [
|
|
240
|
+
"WORKSPACE_PATH_INVALID",
|
|
241
|
+
"WORKSPACE_PATH_DENIED",
|
|
242
|
+
"WORKSPACE_ARGUMENT_INVALID",
|
|
243
|
+
"WORKSPACE_FILE_DENIED",
|
|
244
|
+
"WORKSPACE_FILE_TOO_LARGE",
|
|
245
|
+
"WORKSPACE_VERSION_CONFLICT",
|
|
246
|
+
"WORKSPACE_FILE_BUSY"
|
|
247
|
+
].includes(value.error);
|
|
248
|
+
this.fail(invocationId, new EndpointToolExecutionError(message.payload.code, pending.descriptor.sensitivity === "personal" && pending.descriptor.effect === "read" ? `Personal device request failed: ${message.payload.code}` : message.payload.message, noEffect));
|
|
161
249
|
return;
|
|
250
|
+
}
|
|
162
251
|
case "tool.cancelled": this.fail(invocationId, this.error("TOOL_CANCELLED", "Endpoint cancelled the tool call"));
|
|
163
252
|
}
|
|
164
253
|
}
|
|
165
254
|
failEndpoint(endpointId) {
|
|
166
|
-
for (const pending of this.pending.values()) if (pending.endpointId === endpointId) this.fail(pending.id, this.error("ENDPOINT_DISCONNECTED", "Endpoint disconnected"));
|
|
255
|
+
for (const pending of this.pending.values()) if (pending.endpointId === endpointId) this.fail(pending.id, this.error(pending.execution ? "OUTCOME_UNKNOWN" : "ENDPOINT_DISCONNECTED", "Endpoint disconnected"));
|
|
167
256
|
}
|
|
168
257
|
close() {
|
|
169
|
-
for (const pending of this.pending.values()) this.fail(pending.id, this.error("ENDPOINT_DISCONNECTED", "Endpoint runtime stopped"));
|
|
258
|
+
for (const pending of this.pending.values()) this.fail(pending.id, this.error(pending.execution ? "OUTCOME_UNKNOWN" : "ENDPOINT_DISCONNECTED", "Endpoint runtime stopped"));
|
|
170
259
|
}
|
|
171
260
|
cancel(invocationId, reason, code) {
|
|
172
261
|
const pending = this.pending.get(invocationId);
|
|
173
262
|
if (!pending) return;
|
|
263
|
+
if (pending.execution && pending.stopTimer) return;
|
|
264
|
+
if (pending.execution) {
|
|
265
|
+
clearTimeout(pending.receiptTimer);
|
|
266
|
+
clearTimeout(pending.deadlineTimer);
|
|
267
|
+
pending.stopTimer = setTimeout(() => this.fail(invocationId, this.error("OUTCOME_UNKNOWN", "Desktop stop could not be confirmed")), 3e3);
|
|
268
|
+
}
|
|
174
269
|
try {
|
|
175
270
|
this.registry.send(pending.endpointId, "tool.cancel", {
|
|
176
271
|
invocationId,
|
|
177
272
|
reason
|
|
178
273
|
});
|
|
179
274
|
} catch {}
|
|
180
|
-
this.fail(invocationId, this.error(code, reason));
|
|
275
|
+
if (!pending.execution) this.fail(invocationId, this.error(code, reason));
|
|
276
|
+
}
|
|
277
|
+
verifyExecutionReceipt(pending, message) {
|
|
278
|
+
if (message.type !== "tool.result" && message.type !== "tool.error" && message.type !== "tool.cancelled") return;
|
|
279
|
+
const receipt = message.payload.operationReceipt;
|
|
280
|
+
if (!pending.execution) {
|
|
281
|
+
if (receipt || message.type === "tool.error" && message.payload.operationResult) throw new Error("Unexpected execution evidence");
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
if (!receipt && message.type === "tool.error" && message.payload.code === "USER_DENIED") return;
|
|
285
|
+
const parsed = desktopOperationReceiptSchema.parse(receipt), execution = pending.execution;
|
|
286
|
+
if (parsed.operationId !== execution.intent.operationId || parsed.invocationId !== pending.id || parsed.connectionInstanceId !== execution.connectionInstanceId) throw new Error("Operation attempt changed");
|
|
287
|
+
if (message.type === "tool.result" || message.type === "tool.error" && message.payload.code === "TOOL_EXECUTION_FAILED") {
|
|
288
|
+
const result = message.type === "tool.result" ? {
|
|
289
|
+
content: message.payload.content,
|
|
290
|
+
...message.payload.details === void 0 ? {} : { details: message.payload.details }
|
|
291
|
+
} : message.payload.operationResult;
|
|
292
|
+
const expectedState = message.type === "tool.result" ? "succeeded" : "failed";
|
|
293
|
+
if (!result || parsed.state !== expectedState || !parsed.executionStopped || parsed.resultHash !== crypto.createHash("sha256").update(canonicalJson(result)).digest("hex")) throw new Error("Operation result hash mismatch");
|
|
294
|
+
if (!this.ajv.compile(pending.descriptor.outputSchema)(result.content)) throw new Error("Operation result contract mismatch");
|
|
295
|
+
} else if (message.type === "tool.cancelled") {
|
|
296
|
+
if (parsed.state !== "stopped" || !parsed.executionStopped) throw new Error("Executor has not stopped");
|
|
297
|
+
} else if (message.payload.code !== "OUTCOME_UNKNOWN" || parsed.state !== "unknown") throw new Error("Unexpected operation outcome");
|
|
298
|
+
recordDesktopOperationReceipt(execution.intent, parsed);
|
|
181
299
|
}
|
|
182
300
|
succeed(invocationId, result) {
|
|
183
301
|
const pending = this.take(invocationId);
|
|
@@ -187,7 +305,12 @@ var EndpointInvocationService = class {
|
|
|
187
305
|
status: "succeeded",
|
|
188
306
|
completedAt: Date.now()
|
|
189
307
|
});
|
|
190
|
-
pending.resolve(
|
|
308
|
+
pending.resolve([
|
|
309
|
+
"desktop.computer.control",
|
|
310
|
+
"desktop.computer.remote_control",
|
|
311
|
+
"desktop.browser.control",
|
|
312
|
+
"desktop.screen.capture"
|
|
313
|
+
].includes(pending.toolName) ? {
|
|
191
314
|
...result,
|
|
192
315
|
invocationId
|
|
193
316
|
} : result);
|
|
@@ -242,6 +365,7 @@ var EndpointInvocationService = class {
|
|
|
242
365
|
this.pending.delete(invocationId);
|
|
243
366
|
clearTimeout(pending.receiptTimer);
|
|
244
367
|
clearTimeout(pending.deadlineTimer);
|
|
368
|
+
clearTimeout(pending.stopTimer);
|
|
245
369
|
if (pending.abortSignal && pending.abortHandler) pending.abortSignal.removeEventListener("abort", pending.abortHandler);
|
|
246
370
|
return pending;
|
|
247
371
|
}
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { DEVICE_EMPTY_INPUT_SCHEMA, ENDPOINT_CONTACT_LIST_OUTPUT_SCHEMA, ENDPOINT_CONTACT_OUTPUT_SCHEMA, ENDPOINT_FILE_OUTPUT_SCHEMA } from "../../packages/endpoint-tools-protocol/src/shared-schemas.js";
|
|
2
|
+
import { desktopCommandDescriptor } from "../../packages/endpoint-tools-protocol/src/command.js";
|
|
3
|
+
import { desktopTerminalDescriptors } from "../../packages/endpoint-tools-protocol/src/terminal.js";
|
|
2
4
|
import { BRIDGE_LIST_OUTPUT_SCHEMA, BRIDGE_READ_INPUT_SCHEMA, BRIDGE_READ_OUTPUT_SCHEMA } from "../../packages/endpoint-tools-protocol/src/bridge.js";
|
|
3
5
|
import { LOCATION_INPUT_SCHEMA, LOCATION_OUTPUT_SCHEMA } from "../../packages/endpoint-tools-protocol/src/location.js";
|
|
4
6
|
import { PERSONAL_TOOL_NAMES, personalDescriptor } from "../../packages/endpoint-tools-protocol/src/personal.js";
|
|
7
|
+
import { SCREEN_CAPTURE_OUTPUT_SCHEMA } from "../../packages/endpoint-tools-protocol/src/screen.js";
|
|
8
|
+
import { DESKTOP_OPERATION_STATUS_INPUT_SCHEMA, DESKTOP_OPERATION_STATUS_OUTPUT_SCHEMA } from "../../packages/endpoint-tools-protocol/src/operation-status.js";
|
|
9
|
+
import { DESKTOP_WORKSPACE_ACTIONS, desktopWorkspaceDescriptor } from "../../packages/endpoint-tools-protocol/src/workspace.js";
|
|
5
10
|
import { DEVICE_POWER_OUTPUT_SCHEMA, DEVICE_STATE_OUTPUT_SCHEMA, ENDPOINT_TEXT_OUTPUT_SCHEMA, canonicalJson, init_src } from "../../packages/endpoint-tools-protocol/src/index.js";
|
|
6
|
-
import { COMPUTER_INPUT_SCHEMA, COMPUTER_OUTPUT_SCHEMA, init_src as init_src$1 } from "../../packages/computer-control-contract/src/index.js";
|
|
11
|
+
import { COMPUTER_INPUT_SCHEMA, COMPUTER_OUTPUT_SCHEMA, REMOTE_COMPUTER_CONTROL_TOOL, init_src as init_src$1 } from "../../packages/computer-control-contract/src/index.js";
|
|
7
12
|
import { BROWSER_CONTROL_ENDPOINT_DESCRIPTOR, BROWSER_CONTROL_ENDPOINT_INPUT_SCHEMA, BROWSER_CONTROL_ENDPOINT_OUTPUT_SCHEMA, BROWSER_RECORDING_ENDPOINT_DESCRIPTOR, BROWSER_RECORDING_ENDPOINT_INPUT_SCHEMA } from "../../packages/browser-control-contract/src/index.js";
|
|
13
|
+
import { REMOTE_BROWSER_CONTROL_TOOL, REMOTE_BROWSER_DESCRIPTOR } from "../../packages/browser-control-contract/src/remote.js";
|
|
8
14
|
import Ajv2020 from "ajv/dist/2020.js";
|
|
9
15
|
//#region src/endpoint-tools/policy.ts
|
|
10
16
|
init_src$1();
|
|
@@ -20,6 +26,16 @@ function contract(policyId, outputSchema, resultKinds, permissions, inputSchema)
|
|
|
20
26
|
};
|
|
21
27
|
}
|
|
22
28
|
const POLICY_BY_TOOL = {
|
|
29
|
+
[REMOTE_BROWSER_CONTROL_TOOL]: contract(REMOTE_BROWSER_DESCRIPTOR.policyId, REMOTE_BROWSER_DESCRIPTOR.outputSchema, ["json", "file"], ["browser-control"], REMOTE_BROWSER_DESCRIPTOR.inputSchema),
|
|
30
|
+
...Object.fromEntries(desktopTerminalDescriptors().map((descriptor) => [descriptor.name, contract(descriptor.policyId, descriptor.outputSchema, descriptor.resultKinds, descriptor.requiredPermissions, descriptor.inputSchema)])),
|
|
31
|
+
"desktop.command.run": (() => {
|
|
32
|
+
const descriptor = desktopCommandDescriptor();
|
|
33
|
+
return contract(descriptor.policyId, descriptor.outputSchema, descriptor.resultKinds, descriptor.requiredPermissions, descriptor.inputSchema);
|
|
34
|
+
})(),
|
|
35
|
+
...Object.fromEntries(DESKTOP_WORKSPACE_ACTIONS.map((action) => {
|
|
36
|
+
const descriptor = desktopWorkspaceDescriptor(action);
|
|
37
|
+
return [descriptor.name, contract(descriptor.policyId, descriptor.outputSchema, descriptor.resultKinds, descriptor.requiredPermissions, descriptor.inputSchema)];
|
|
38
|
+
})),
|
|
23
39
|
...Object.fromEntries([
|
|
24
40
|
"mobile",
|
|
25
41
|
"desktop",
|
|
@@ -34,12 +50,15 @@ const POLICY_BY_TOOL = {
|
|
|
34
50
|
"desktop.bridge.list_resources": contract("public.background-read", BRIDGE_LIST_OUTPUT_SCHEMA, ["json"], [], DEVICE_EMPTY_INPUT_SCHEMA),
|
|
35
51
|
"desktop.bridge.read_sensor": contract("public.background-read", BRIDGE_READ_OUTPUT_SCHEMA, ["json"], [], BRIDGE_READ_INPUT_SCHEMA),
|
|
36
52
|
"desktop.computer.control": contract("computer.session-scoped", COMPUTER_OUTPUT_SCHEMA, ["json", "file"], ["computer-control"], COMPUTER_INPUT_SCHEMA),
|
|
53
|
+
[REMOTE_COMPUTER_CONTROL_TOOL]: contract("computer.remote-session-scoped", COMPUTER_OUTPUT_SCHEMA, ["json", "file"], ["computer-control"], COMPUTER_INPUT_SCHEMA),
|
|
37
54
|
"web.file.pick": contract("personal.foreground-read", ENDPOINT_FILE_OUTPUT_SCHEMA, ["file"], ["file-read"]),
|
|
38
55
|
"web.file.download": contract("user.foreground-write", ENDPOINT_TEXT_OUTPUT_SCHEMA, ["text"], ["file-download"]),
|
|
39
56
|
"web.page.get_selection": contract("public.foreground-read", ENDPOINT_TEXT_OUTPUT_SCHEMA, ["text"], []),
|
|
40
57
|
"web.clipboard.write": contract("user.foreground-write", ENDPOINT_TEXT_OUTPUT_SCHEMA, ["text"], ["clipboard-write"]),
|
|
41
58
|
"web.page.navigate": contract("user.foreground-write", ENDPOINT_TEXT_OUTPUT_SCHEMA, ["text"], ["navigation"]),
|
|
59
|
+
"desktop.operation.get_status": contract("public.foreground-read", DESKTOP_OPERATION_STATUS_OUTPUT_SCHEMA, ["json"], [], DESKTOP_OPERATION_STATUS_INPUT_SCHEMA),
|
|
42
60
|
"desktop.file.pick": contract("personal.foreground-read", ENDPOINT_FILE_OUTPUT_SCHEMA, ["file"], ["file-read"]),
|
|
61
|
+
"desktop.screen.capture": contract("personal.foreground-read", SCREEN_CAPTURE_OUTPUT_SCHEMA, ["file"], ["screen-read-once"], DEVICE_EMPTY_INPUT_SCHEMA),
|
|
43
62
|
"desktop.file.save": contract("user.foreground-write", ENDPOINT_TEXT_OUTPUT_SCHEMA, ["text"], ["file-write"]),
|
|
44
63
|
"desktop.notification.show": contract("user.foreground-write", ENDPOINT_TEXT_OUTPUT_SCHEMA, ["text"], ["notifications"]),
|
|
45
64
|
"desktop.clipboard.read": contract("personal.foreground-read", ENDPOINT_TEXT_OUTPUT_SCHEMA, ["text"], ["clipboard-read"]),
|
|
@@ -111,8 +130,14 @@ var EndpointToolPolicy = class {
|
|
|
111
130
|
this.assertFields(descriptor, "write", "never", false, "personal");
|
|
112
131
|
if (descriptor.requiredPermissions.length !== 1 || descriptor.requiredPermissions[0] !== "browser-control" || descriptor.timeoutMs !== 12e4 || descriptor.maxConcurrency !== (descriptor.name === BROWSER_RECORDING_ENDPOINT_DESCRIPTOR.name ? BROWSER_RECORDING_ENDPOINT_DESCRIPTOR.maxConcurrency : BROWSER_CONTROL_ENDPOINT_DESCRIPTOR.maxConcurrency) || descriptor.supportsCancellation !== true || descriptor.idempotent !== false) throw new EndpointToolPolicyError(`Browser tool ${descriptor.name} violates its trusted policy`);
|
|
113
132
|
return;
|
|
133
|
+
case "desktop.terminal-scoped":
|
|
134
|
+
this.assertFields(descriptor, "write", "never", true, "personal");
|
|
135
|
+
if (descriptor.timeoutMs !== 6e4 || descriptor.maxConcurrency !== 1 || !descriptor.supportsCancellation || descriptor.idempotent) throw new EndpointToolPolicyError("Terminal transport violates its trusted policy");
|
|
136
|
+
return;
|
|
137
|
+
case "browser.remote-session-scoped":
|
|
138
|
+
case "computer.remote-session-scoped":
|
|
114
139
|
case "computer.session-scoped":
|
|
115
|
-
this.assertFields(descriptor, "write", "never",
|
|
140
|
+
this.assertFields(descriptor, "write", descriptor.policyId !== "computer.session-scoped" ? "always" : "never", descriptor.policyId !== "computer.session-scoped", "personal");
|
|
116
141
|
if (descriptor.timeoutMs !== 3e4 || descriptor.maxConcurrency !== 1 || !descriptor.supportsCancellation || descriptor.idempotent) throw new EndpointToolPolicyError("Computer transport violates its trusted policy");
|
|
117
142
|
return;
|
|
118
143
|
default: throw new EndpointToolPolicyError(`Unknown endpoint policy: ${descriptor.policyId}`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type EndpointAvailability, type EndpointHelloPayload, type EndpointKind, type EndpointToolDescriptor } from '@xopcai/endpoint-tools-protocol';
|
|
1
|
+
import { type EndpointDesktopExecutionAuthority, type EndpointAvailability, type EndpointHelloPayload, type EndpointKind, type EndpointToolDescriptor, type ServerEndpointMessage } from '@xopcai/endpoint-tools-protocol';
|
|
2
2
|
import { EndpointToolPolicy } from './policy.js';
|
|
3
3
|
export interface EndpointTransport {
|
|
4
4
|
readonly readyState: number;
|
|
@@ -20,6 +20,8 @@ export interface EndpointConnectionSnapshot {
|
|
|
20
20
|
availability: EndpointAvailability;
|
|
21
21
|
lastHeartbeatAt: number;
|
|
22
22
|
tools: RegisteredEndpointTool[];
|
|
23
|
+
executionAuthority?: EndpointDesktopExecutionAuthority;
|
|
24
|
+
terminalVersion?: 1;
|
|
23
25
|
}
|
|
24
26
|
export interface EndpointRegistration {
|
|
25
27
|
connection: EndpointConnectionSnapshot;
|
|
@@ -35,7 +37,7 @@ export declare class EndpointRegistry {
|
|
|
35
37
|
onPrincipalRevoked(principalId: string, listener: () => void): () => void;
|
|
36
38
|
revokePrincipal(principalId: string): void;
|
|
37
39
|
constructor(policy?: EndpointToolPolicy);
|
|
38
|
-
register(hello: EndpointHelloPayload, connectionId: string, transport: EndpointTransport, now?: number): EndpointRegistration;
|
|
40
|
+
register(hello: EndpointHelloPayload, connectionId: string, transport: EndpointTransport, now?: number, executionAuthority?: EndpointDesktopExecutionAuthority): EndpointRegistration;
|
|
39
41
|
remove(endpointId: string, connectionId: string): boolean;
|
|
40
42
|
heartbeat(endpointId: string, connectionId: string, availability: EndpointAvailability, now?: number): void;
|
|
41
43
|
get(endpointId: string): EndpointConnectionSnapshot | undefined;
|
|
@@ -43,7 +45,7 @@ export declare class EndpointRegistry {
|
|
|
43
45
|
list(): EndpointConnectionSnapshot[];
|
|
44
46
|
getTool(endpointId: string, toolName: string): RegisteredEndpointTool | undefined;
|
|
45
47
|
verifyTurnClaim(endpointId: string, turnToken: string): boolean;
|
|
46
|
-
send(endpointId: string, type: '
|
|
48
|
+
send(endpointId: string, type: ServerEndpointMessage['type'], payload: unknown): void;
|
|
47
49
|
disconnect(endpointId: string, code?: number, reason?: string): boolean;
|
|
48
50
|
closeAll(code?: number, reason?: string): void;
|
|
49
51
|
private requireConnection;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { endpointDesktopExecutionAuthoritySchema } from "../../packages/endpoint-tools-protocol/src/execution.js";
|
|
1
2
|
import { canonicalJson, init_src } from "../../packages/endpoint-tools-protocol/src/index.js";
|
|
2
3
|
import { EndpointToolPolicy } from "./policy.js";
|
|
3
4
|
import crypto from "node:crypto";
|
|
@@ -17,7 +18,9 @@ function snapshot(connection) {
|
|
|
17
18
|
appVersion: connection.appVersion,
|
|
18
19
|
availability: connection.availability,
|
|
19
20
|
lastHeartbeatAt: connection.lastHeartbeatAt,
|
|
20
|
-
tools: [...connection.toolByName.values()]
|
|
21
|
+
tools: [...connection.toolByName.values()],
|
|
22
|
+
...connection.executionAuthority ? { executionAuthority: { ...connection.executionAuthority } } : {},
|
|
23
|
+
...connection.terminalVersion ? { terminalVersion: connection.terminalVersion } : {}
|
|
21
24
|
};
|
|
22
25
|
}
|
|
23
26
|
var EndpointRegistry = class {
|
|
@@ -45,7 +48,9 @@ var EndpointRegistry = class {
|
|
|
45
48
|
constructor(policy = new EndpointToolPolicy()) {
|
|
46
49
|
this.policy = policy;
|
|
47
50
|
}
|
|
48
|
-
register(hello, connectionId, transport, now = Date.now()) {
|
|
51
|
+
register(hello, connectionId, transport, now = Date.now(), executionAuthority) {
|
|
52
|
+
const authority = executionAuthority ? endpointDesktopExecutionAuthoritySchema.parse(executionAuthority) : void 0;
|
|
53
|
+
if (authority && (hello.kind !== "desktop" || hello.principalId !== authority.deviceId || hello.connectionInstanceId !== authority.connectionInstanceId || hello.execution?.grantId !== authority.grantId || hello.execution.authorizationRevision !== authority.authorizationRevision || hello.execution.expiresAt !== authority.expiresAt || hello.deviceFrames?.authorizationRevision !== authority.authorizationRevision || authority.expiresAt <= now)) throw new Error("DESKTOP_EXECUTION_AUTHORITY_INVALID");
|
|
49
54
|
const toolByName = /* @__PURE__ */ new Map();
|
|
50
55
|
for (const descriptor of hello.tools) {
|
|
51
56
|
this.policy.validateDescriptor(hello.kind, descriptor);
|
|
@@ -71,7 +76,9 @@ var EndpointRegistry = class {
|
|
|
71
76
|
tools: [],
|
|
72
77
|
transport,
|
|
73
78
|
turnToken: crypto.randomBytes(32).toString("base64url"),
|
|
74
|
-
toolByName
|
|
79
|
+
toolByName,
|
|
80
|
+
...authority ? { executionAuthority: authority } : {},
|
|
81
|
+
...hello.terminal && authority ? { terminalVersion: 1 } : {}
|
|
75
82
|
};
|
|
76
83
|
this.connectionByEndpointId.set(connection.endpointId, connection);
|
|
77
84
|
for (const listener of this.changeListeners) listener(connection.endpointId);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ClientEndpointMessage, type EndpointHelloPayload } from '@xopcai/endpoint-tools-protocol';
|
|
1
|
+
import { type ClientEndpointMessage, type EndpointHelloPayload, type EndpointDesktopExecutionAuthority } from '@xopcai/endpoint-tools-protocol';
|
|
2
2
|
import { type EndpointAuthenticatorDeps } from './auth.js';
|
|
3
3
|
import { DeviceGrantService } from './grant-service.js';
|
|
4
4
|
import { EndpointBindingService } from './binding-service.js';
|
|
@@ -7,6 +7,7 @@ import { EndpointRegistry, type EndpointRegistration, type EndpointTransport } f
|
|
|
7
7
|
import { EndpointUploadService } from './upload-service.js';
|
|
8
8
|
import { EndpointContextStore } from './context-store.js';
|
|
9
9
|
import { LocationSharingService } from './location-sharing.js';
|
|
10
|
+
import { DesktopTerminalGatewayBroker } from './terminal-broker.js';
|
|
10
11
|
export declare class EndpointToolRuntime {
|
|
11
12
|
readonly registry: EndpointRegistry;
|
|
12
13
|
readonly contexts: EndpointContextStore;
|
|
@@ -15,6 +16,7 @@ export declare class EndpointToolRuntime {
|
|
|
15
16
|
readonly invocations: EndpointInvocationService;
|
|
16
17
|
readonly uploads: EndpointUploadService;
|
|
17
18
|
readonly bindings: EndpointBindingService;
|
|
19
|
+
readonly terminals: DesktopTerminalGatewayBroker;
|
|
18
20
|
private readonly authenticator;
|
|
19
21
|
private closed;
|
|
20
22
|
constructor(options?: {
|
|
@@ -22,7 +24,7 @@ export declare class EndpointToolRuntime {
|
|
|
22
24
|
audit?: EndpointInvocationAuditSink;
|
|
23
25
|
uploadRoot?: string;
|
|
24
26
|
});
|
|
25
|
-
connect(hello: EndpointHelloPayload, connectionId: string, transport: EndpointTransport): EndpointRegistration;
|
|
27
|
+
connect(hello: EndpointHelloPayload, connectionId: string, transport: EndpointTransport, executionAuthority?: EndpointDesktopExecutionAuthority): EndpointRegistration;
|
|
26
28
|
handleMessage(endpointId: string, connectionId: string, message: ClientEndpointMessage): void;
|
|
27
29
|
touch(endpointId: string, connectionId: string): void;
|
|
28
30
|
remove(endpointId: string, connectionId: string): void;
|
|
@@ -12,11 +12,12 @@ import { EndpointInvocationService } from "./invocation-service.js";
|
|
|
12
12
|
import { EndpointAuthenticator } from "./auth.js";
|
|
13
13
|
import { EndpointBindingService } from "./binding-service.js";
|
|
14
14
|
import { EndpointContextStore } from "./context-store.js";
|
|
15
|
+
import { EndpointRegistry } from "./registry.js";
|
|
15
16
|
import { DeviceGrantService } from "./grant-service.js";
|
|
16
17
|
import { recordDeviceGrantEvent } from "../storage/sqlite/device-grant-audit-repository.js";
|
|
17
|
-
import { EndpointRegistry } from "./registry.js";
|
|
18
18
|
import { EndpointUploadService } from "./upload-service.js";
|
|
19
19
|
import { LocationSharingService } from "./location-sharing.js";
|
|
20
|
+
import { DesktopTerminalGatewayBroker } from "./terminal-broker.js";
|
|
20
21
|
import { join } from "node:path";
|
|
21
22
|
//#region src/endpoint-tools/runtime.ts
|
|
22
23
|
init_paths();
|
|
@@ -31,6 +32,7 @@ var EndpointToolRuntime = class {
|
|
|
31
32
|
invocations;
|
|
32
33
|
uploads;
|
|
33
34
|
bindings;
|
|
35
|
+
terminals;
|
|
34
36
|
authenticator;
|
|
35
37
|
closed = false;
|
|
36
38
|
constructor(options = {}) {
|
|
@@ -58,16 +60,18 @@ var EndpointToolRuntime = class {
|
|
|
58
60
|
uploads: this.uploads,
|
|
59
61
|
policy
|
|
60
62
|
});
|
|
63
|
+
this.terminals = new DesktopTerminalGatewayBroker(this.registry, this.invocations);
|
|
61
64
|
}
|
|
62
|
-
connect(hello, connectionId, transport) {
|
|
65
|
+
connect(hello, connectionId, transport, executionAuthority) {
|
|
63
66
|
if (this.closed) throw new Error("Endpoint runtime is closed");
|
|
64
67
|
this.authenticator.authenticate(hello);
|
|
68
|
+
if (hello.execution && !executionAuthority) throw new Error("DESKTOP_EXECUTION_AUTHORITY_REQUIRED");
|
|
65
69
|
const previous = this.registry.get(hello.endpointId);
|
|
66
70
|
if (previous) {
|
|
67
71
|
this.grants.revokeEndpoint(previous.endpointId, previous.principalId);
|
|
68
72
|
this.invocations.failEndpoint(previous.endpointId);
|
|
69
73
|
}
|
|
70
|
-
const registration = this.registry.register(hello, connectionId, transport);
|
|
74
|
+
const registration = this.registry.register(hello, connectionId, transport, Date.now(), executionAuthority);
|
|
71
75
|
log.info({
|
|
72
76
|
endpointId: hello.endpointId,
|
|
73
77
|
connectionId,
|
|
@@ -82,6 +86,7 @@ var EndpointToolRuntime = class {
|
|
|
82
86
|
this.registry.heartbeat(endpointId, connectionId, message.payload.availability);
|
|
83
87
|
return;
|
|
84
88
|
}
|
|
89
|
+
if (message.type === "terminal.event" && this.registry.get(endpointId)?.terminalVersion !== 1) throw new Error("DESKTOP_TERMINAL_NOT_NEGOTIATED");
|
|
85
90
|
this.invocations.handleMessage(endpointId, message);
|
|
86
91
|
}
|
|
87
92
|
touch(endpointId, connectionId) {
|
|
@@ -106,6 +111,7 @@ var EndpointToolRuntime = class {
|
|
|
106
111
|
close() {
|
|
107
112
|
if (this.closed) return;
|
|
108
113
|
this.closed = true;
|
|
114
|
+
this.terminals.close();
|
|
109
115
|
this.grants.close();
|
|
110
116
|
this.invocations.close();
|
|
111
117
|
this.uploads.close();
|