@xopcai/xopc 0.0.436 → 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-Cwn_CNwl.js → activity-store-Fl327RND.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Cd23LnJJ.js → agent-avatar-dicebear-DL_MfWA8.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-display-ByzM7u9S.js → agent-avatar-display-BTDt883i.js} +2 -2
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-B0i37diS.js → agent-defaults-settings-panel-CuiIuR1Q.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-XN-tZ-Ox.js → agent-plugin-dialog-moOAOJPs.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-ZDA1OaLv.js → agents-B1yM1cWS.js} +3 -3
- package/dist/gateway/static/root/assets/{agents-admin-api-B5lKH_ps.js → agents-admin-api-D6pZX7nW.js} +1 -1
- package/dist/gateway/static/root/assets/{api-B9fZL-V8.js → api-H3OfSCEz.js} +1 -1
- package/dist/gateway/static/root/assets/{api-Djju8qIR.js → api-np_upIrk.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-IlyzDPJu.js → app-management-settings-panel-IFKcvOK9.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BxdFGob3.js → appearance-settings-Cfb4s0Ik.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-CxEKiOTA.js → apps-page-DMDwnwEi.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-4gEvotPr.js → archive-plugin-DBKvxHvn.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-api-4fVKv9PJ.js → automation-api-iUvu64Gn.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-result-state-m7PeK2kl.js → automation-result-state-EFwxlLpI.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-run-list-CJOdy_R2.js → automation-run-list-C66yqC4g.js} +1 -1
- package/dist/gateway/static/root/assets/automation-task-card-DXNh_uKL.js +3 -0
- package/dist/gateway/static/root/assets/{automations-page-BjbM15eY.js → automations-page-iCsHbzY_.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-CqurzLYX.js → automations-workspace-DnLrs-fb.js} +2 -2
- package/dist/gateway/static/root/assets/{binary-plugins-69WyJLNW.js → binary-plugins-C5K0CWqt.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DUONDIZR.js → block-editor-3TVEcFpk.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automation-inputs-DL4YPCuN.js → browser-automation-inputs-Wuph6STC.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-1Aq6XmRs.js → browser-automations-page-THaENU71.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-control-api-yjru8E7R.js → browser-control-api-DeRUE9Io.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-CvwpT8Um.js → browser-settings-page-CeNb4Kyc.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-DaeQXJT4.js → capabilities-B3cchabB.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-C7lnwKKm.js → capabilities-CFO_gAma.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-page-B5avAOUM.js → capabilities-page-KM3X4Bj-.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-_9yCS78i.js → capabilities-settings-panel-CX201jtA.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-CoQb4HOF.js → channels-DmF6s5BH.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-agents-api-BUi_7GRo.js → chat-agents-api-ipkXPITj.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-chart-block-CcVcKsDZ.js → chat-chart-block-KOdy3HcB.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-page--wcFhTjW.js → chat-page-DZy7iw5A.js} +10 -10
- package/dist/gateway/static/root/assets/{chat-terminal-dock-BMXJpPuH.js → chat-terminal-dock-BouLAS3C.js} +1 -1
- package/dist/gateway/static/root/assets/{command-palette-api-luUjQPsh.js → command-palette-api-CHEmmKmY.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-payload-handoff-B5XNxNCb.js → composer-payload-handoff-DQVtV0L9.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-CWtdyEJH.js → computer-settings-page-DwEzbr0-.js} +1 -1
- package/dist/gateway/static/root/assets/{connected-providers-grid-2idMtk65.js → connected-providers-grid-CWdA7VtN.js} +1 -1
- package/dist/gateway/static/root/assets/{connection-usage-guide-Ddh0bfkj.js → connection-usage-guide-5RmYdXoS.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-C3msXaBk.js → connector-service-page-TeYvzScr.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-NcWECWKg.js → connectors-api-Byw6RD4z.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-Crb6DILX.js → connectors-page-B4PrSnT8.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-Cfjq1hD_.js → date-picker-BpccZyjF.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-ChFn9v-3.js → desktop-pet-DfGMB4GN.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-DvnVIv25.js → desktop-pet-settings-ky__zEoY.js} +1 -1
- package/dist/gateway/static/root/assets/{dev-view-store-DQJ61P5L.js → dev-view-store-do-XMWDA.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-KxaIL-OX.js → device-pairing-wizard-CQNlQGYH.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-Drv864uE.js → directory-picker-path-field-DjhHz-4p.js} +1 -1
- package/dist/gateway/static/root/assets/{discussion-annotation-sync-DfBRkWtw.js → discussion-annotation-sync-CvGsuUi9.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DAlBIt_R.js → extension-debug-page-BimrAkDl.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-Bds-5kY_.js → extension-iframe-host-7zoDddj6.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-marketplace-api-CZg8nBwW.js → extension-marketplace-api-DA-nbL9C.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-ZTw-oucT.js → extension-page-wjS2go2N.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-NKWfjpdP.js → extension-provider-C2L-lGqA.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CT7PPt_q.js → extension-settings-page-CTHs7h7H.js} +1 -1
- package/dist/gateway/static/root/assets/{file-preview-surface-BcLeaSNe.js → file-preview-surface-QUJiCKCs.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-Cq-ByXL4.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-DdiVzbkL.js → gateway-restart-L34umMj8.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-1QUdNwrZ.js → gateway-settings-DjwPEBcq.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-PMJi5mX4.js → gateway-startup-retry-CgLo6P66.js} +1 -1
- package/dist/gateway/static/root/assets/{global-defaults-api-DgzZh3wX.js → global-defaults-api-Cv6QEJBa.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-Chn7YTiD.js → home-page-D9gDR4MB.js} +2 -2
- package/dist/gateway/static/root/assets/{image-generation-api-CjVpsckq.js → image-generation-api-C_GDIILz.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-CJCvZFaQ.js → imports-page-CvY8wdNu.js} +1 -1
- package/dist/gateway/static/root/assets/{index-C4moZbZv.js → index-BVyX4V3C.js} +5 -5
- package/dist/gateway/static/root/assets/index-CIYNPxDl.css +1 -0
- package/dist/gateway/static/root/assets/{install-connector-dialog-Bo06Ry3H.js → install-connector-dialog-Cnx5oOXv.js} +1 -1
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BylFJeGu.js → keyboard-shortcuts-settings-AXisbvQn.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-B3MSSFsr.js → local-app-workbench-page-DxO9ZTU_.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BeV86rMJ.js → local-apps-page-sas0hMvK.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-jgw8UGsO.js → local-session-drafts-DzHbV0VQ.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CAZaC05J.js → locale-store-BRJAl_Kx.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-BMmSsUP5.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-BatP4qeK.js → markdown-view-BRNPKsnn.js} +1 -1
- package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-rROtr0UN.js → mcp-conversation-setup-page-C5gTNa2U.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-88OV72YE.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-raBRBkN_.js → model-selector-kWRDioTb.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-cache-CzC9y3D0.js → models-hub-cache-h2vf54qy.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-BvA8Vkbm.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-zXpV6UXu.js → notes-api-D29fdWyC.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CjYH9Kle.js → notes-page-CqnQ_UEf.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-api-DmxSaxM1.js → oauth-api-C8McgC-r.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-provider-connect-D4Gfs-Ba.js → oauth-provider-connect-BDTdg0lv.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-Mig3d0UX.js → page-context-capture-button-Bf0qvNmd.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-draft-C4IIZaKd.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-DLa-CpaK.js → personal-avatar-CpEFjQ4Q.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-BhuT79Wd.js → personal-page-BvjPpwdy.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-settings-panel-XSUkgcr2.js → personal-settings-panel-DixKsLRd.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-dependencies-card-DYwnuVh3.js → phone-dependencies-card-BfpFV3SG.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-connection-2F32QTHA.js → phone-model-connection-Os87SvBE.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-picker-DCVzIr0s.js → phone-model-picker-8pkA8k_N.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-settings-page-DJttE4id.js → phone-settings-page-ByERmr61.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-workspace-store-Dxp-KhFP.js → phone-workspace-store-DfhWmYic.js} +1 -1
- package/dist/gateway/static/root/assets/{plugin-details-dialog-tyjAjFjA.js → plugin-details-dialog-J4PKpTud.js} +1 -1
- package/dist/gateway/static/root/assets/{preference-select-fields-BVP3MhGK.js → preference-select-fields-C-PLFUS9.js} +1 -1
- package/dist/gateway/static/root/assets/{product-automation-feedback-DbJvv92z.js → product-automation-feedback-DLsF8VBW.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-RImqlhCD.js → product-open-page-BP-ssaP8.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-DxSqrKsg.js → product-preview-content-BMI7ZuKU.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-modal-Cw8Q8Uom.js → product-preview-modal-DZ0zi6ZF.js} +2 -2
- package/dist/gateway/static/root/assets/{project-detail-page-CuugOYfe.js → project-detail-page-CS-NrYi5.js} +1 -1
- package/dist/gateway/static/root/assets/{project-understanding-BMKcoUW5.js → project-understanding-C9WWE-3t.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-CFsABLvs.js → projects-page-DVa38OsG.js} +1 -1
- package/dist/gateway/static/root/assets/{providers-api-CAeXbJNF.js → providers-api-C1KpkGUT.js} +1 -1
- package/dist/gateway/static/root/assets/{recording-upload-CfpllTe5.js → recording-upload-T5ArHnPJ.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-fLOqFyrz.js → registry-api-Cs-R00dn.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-BvKOxy0L.js → remote-access-hub-C6NBt2s-.js} +1 -1
- package/dist/gateway/static/root/assets/{resource-unavailable-D15jzjV_.js → resource-unavailable-BuySLm9q.js} +1 -1
- package/dist/gateway/static/root/assets/{route-preload-BQapekpy.js → route-preload-CDMyXjLQ.js} +2 -2
- package/dist/gateway/static/root/assets/{runtime-tools-api-D0Nrvuqv.js → runtime-tools-api-CvTCMobW.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CA27XgL2.js → runtime-tools-settings-panel-DlW9tAnO.js} +1 -1
- package/dist/gateway/static/root/assets/{service-recommendation-list-B0RoYLVT.js → service-recommendation-list-Biono7Ua.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-CHRP5Lwf.js → session-api-BNt6b3Xl.js} +1 -1
- package/dist/gateway/static/root/assets/{session-manager-DRRWwKE4.js → session-manager-CQNN8D0M.js} +1 -1
- package/dist/gateway/static/root/assets/{sessions-page-uJHS3-6F.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-D-llwfSj.js → settings-advanced-section-D4uJuQwW.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-mode-store-BspMKc9N.js → settings-mode-store-CnG8uLvP.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-CedwaHM0.js → settings-page-9BthXfuc.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-LuOJvqNa.js → settings-page-header-BXdbhzia.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-CduQ8w4a.js → settings-page-layout-BQvK_gmr.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-interaction-page-ujpPGl84.js → setup-interaction-page-D1uhozUt.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-BN2aCJUN.js → setup-status-panel-C1o4-hF4.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-CTATUaa4.js → share-link-dialog-QTEdYG4I.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-Dq0J3VgS.js → share-preview-page-Ba77bFgS.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-zegE8pSE.js → shares-api-DayDdoBR.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-DXpvsRXq.js → shares-settings-67poMpxi.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-DCL1EN7f.js → skill-api-DR3vdsrS.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-list-api-Bv0mmHbu.js → skill-list-api-D6X3XyTd.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-DPZbadiO.js → skill-reload-api-Wu0UkQ13.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-DMC7Gaku.js → skills-page-FmjOxilb.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BYFUhlqG.js → system-settings-panel-BLeXSW3w.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-_Og3plZL.js → task-detail-page-B5uwlFwb.js} +1 -1
- package/dist/gateway/static/root/assets/{task-result-evidence-Bxm8-H0B.js → task-result-evidence-m78K4eAp.js} +1 -1
- package/dist/gateway/static/root/assets/{terminal-panel-store-Djf9l2qZ.js → terminal-panel-store-CWpiIbPY.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-8GFVtotZ.js → theme-store-B9upxkW-.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-oWW3SBZ4.js → tracing-settings-page-CACPSXVV.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-D-mEsSGF.js → tunnel-api-CCC7XSFJ.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-activity-store-CvDjsd0I.js → understanding-activity-store-D7WFQ-t7.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-refresh-store-DzOZJm7A.js → understanding-refresh-store-CvOFPfDi.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-z-o6Uuev.js → usage-page-P9-7xf1p.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-BVYS8UoK.js → use-autosave-BNNxl23c.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-lecOV2q5.js → use-composer-attachments-7uMSpyxm.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-nd_CuFsd.js → use-file-preview-expanded-C-NCuwM3.js} +2 -2
- package/dist/gateway/static/root/assets/{use-personal-profile-CQi2ZCxV.js → use-personal-profile-1lm_wDMe.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-BiaddkzX.js → use-workspace-tree-HlkNpRDC.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-Bks1n0Nj.js → user-model-page-B6XfYtEm.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-BbW8NFeZ.js → voice-api-key-field-CRZS6XEF.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-jSMzZWWy.js → voice-config-api-CrgRaCMk.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-input-shortcut-events-_SgYmx7X.js → voice-input-shortcut-events-vjcw6SRC.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-transcribe-api-BJCfiRFU.js → voice-transcribe-api-CtUoGgGT.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DSTSNyU7.js → work-discovery-overlay-C9tI_qQv.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-Dd_QJJvb.js → work-discovery-page-C-8kE4mx.js} +1 -1
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-q39BUcJ6.js → working-directory-picker-modal-B5fxn2wG.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-api-Di2OmCvz.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-BUGNT765.js → workspace-file-preview-dialog-Cp86E6-h.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-bMSvmQW7.js → workspace-open-location-menu-CWOgHMmR.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-Bbe19Del.js → xopc-cloud-account-card-CIaHnCGw.js} +1 -1
- package/dist/gateway/static/root/index.html +81 -81
- 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/client-error-format.d.ts +1 -1
- package/dist/src/agent/client-error-format.js +3 -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/orchestration/llm-turn-retry.js +8 -1
- 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/tool-manuals/computer.d.ts +1 -1
- package/dist/src/agent/tool-manuals/computer.js +1 -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/computer/broker.d.ts +2 -1
- package/dist/src/computer/broker.js +15 -0
- 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/errors.js +1 -1
- 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 +1 -0
- package/dist/src/gateway/session-context-summary.js +2 -1
- package/dist/src/providers/model-response.js +1 -0
- 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/automation-task-card-DZWhCWJa.js +0 -3
- package/dist/gateway/static/root/assets/gateway-realtime-DwMd2PCt.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-CHrf6-nR.js +0 -1
- package/dist/gateway/static/root/assets/index-iukJWzxG.css +0 -1
- package/dist/gateway/static/root/assets/management-settings-Bu7T8ewk.js +0 -1
- package/dist/gateway/static/root/assets/messages-C7fckbyG.js +0 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-D6kUDDd5.js +0 -1
- package/dist/gateway/static/root/assets/page-header-store-D7G5utVi.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CZ4J3Kuy.js +0 -1
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-B2r9wlix.js +0 -1
|
@@ -13,10 +13,20 @@ function methodScope(method, read, write) {
|
|
|
13
13
|
function requiredGatewayScope(method, path) {
|
|
14
14
|
if (/^\/api\/local-app-capabilities\/[^/]+(?:\/[^/]+\/invocations)?$/.test(path)) return void 0;
|
|
15
15
|
if (path === "/api/capabilities/operations" || path.startsWith("/api/capabilities/operations/")) return void 0;
|
|
16
|
+
if (method === "GET" && path === "/api/desktop-host/compatibility") return "device.self";
|
|
17
|
+
if (method === "GET" && (path === "/api/desktop-host/operations" || /^\/api\/desktop-host\/operations\/[^/]+$/.test(path)) || method === "POST" && /^\/api\/desktop-host\/operations\/[^/]+\/review$/.test(path)) return "device.self";
|
|
18
|
+
if (method === "GET" && path === "/api/desktop-host/status") return "device.self";
|
|
19
|
+
if ([
|
|
20
|
+
"GET",
|
|
21
|
+
"POST",
|
|
22
|
+
"DELETE"
|
|
23
|
+
].includes(method) && path === "/api/desktop-host/execution") return "device.self";
|
|
24
|
+
if (method === "DELETE" && ["/api/desktop-host/observation", "/api/desktop-host/screen"].includes(path)) return "device.self";
|
|
16
25
|
if (method === "GET" && path === "/api/mobile/privacy") return "gateway.status";
|
|
17
26
|
if (path === "/api/realtime/tickets" || path.startsWith("/api/status")) return "gateway.status";
|
|
18
27
|
if (path === "/api/device-auth/refresh" || path === "/api/devices/me") return "device.self";
|
|
19
28
|
if (path.startsWith("/api/devices/me/push")) return "notifications.self";
|
|
29
|
+
if (method === "POST" && path === "/api/endpoint-tools/devices/revoke") return "gateway.admin";
|
|
20
30
|
if (/^\/api\/phone\/conversations\/[^/]+\/summary$/.test(path) && method === "GET") return "sessions.read";
|
|
21
31
|
if (/^\/api\/phone\/conversations\/[^/]+$/.test(path) && method === "GET") return "phone.view";
|
|
22
32
|
if (/^\/api\/phone\/conversations\/[^/]+\/[^/]+\/frame$/.test(path) && method === "GET") return "phone.view";
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { isMobileDevicePlatform } from "../../../packages/gateway-contract/src/device-pairing.js";
|
|
2
|
+
import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
1
3
|
import { getDevice, isDeviceAccessSessionActive } from "../../storage/sqlite/device-access-repository.js";
|
|
2
4
|
import { PhoneError, init_contracts } from "../../phone/contracts.js";
|
|
3
5
|
//#region src/gateway/security/phone-access.ts
|
|
6
|
+
init_src();
|
|
4
7
|
init_contracts();
|
|
5
8
|
function phoneAdministrator(principal) {
|
|
6
9
|
return principal.kind !== "device" && principal.scopes.includes("gateway.admin");
|
|
@@ -9,7 +12,7 @@ function phoneAdministrator(principal) {
|
|
|
9
12
|
function authorizePhoneAccess(principal, control = false) {
|
|
10
13
|
if (phoneAdministrator(principal)) return;
|
|
11
14
|
const device = principal.deviceId ? getDevice(principal.deviceId) : void 0;
|
|
12
|
-
if (principal.kind !== "device" || !device || device.platform
|
|
15
|
+
if (principal.kind !== "device" || !device || !isMobileDevicePlatform(device.platform) || !principal.accessSessionId || !isDeviceAccessSessionActive(device.id, principal.accessSessionId)) throw new PhoneError("PHONE_ACCESS_REVOKED", "Phone access is unavailable for this device", 403);
|
|
13
16
|
if (![
|
|
14
17
|
"sessions.read",
|
|
15
18
|
"phone.view",
|
|
@@ -4,6 +4,8 @@ import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "
|
|
|
4
4
|
import { init_session_instance_repository, readCurrentTranscriptId } from "../../storage/sqlite/session-instance-repository.js";
|
|
5
5
|
import { SessionInputControlConflict, acceptSessionInputControl, hasSessionInputControlOperation, init_session_input_control_repository, readSessionInputControl } from "../../storage/sqlite/session-input-control-repository.js";
|
|
6
6
|
import { SessionInstanceChangedError, cancelQueuedSessionInput, claimNextSessionInput, findSessionInput, findSessionInputByRunId, finishSessionInputRun, getSessionInputById, getSessionInputState, init_session_input_repository, insertSessionInput, mutateQueuedSessionInput, recoverSessionInputState, setSessionInputStatus } from "../../storage/sqlite/session-input-repository.js";
|
|
7
|
+
import { init_types, summarizeSourceContext } from "../../agent/source-context/types.js";
|
|
8
|
+
import { init_injector, injectSourceContextsIntoUserMessage } from "../../agent/source-context/injector.js";
|
|
7
9
|
import { TaskRunRepository, init_task_run_repository } from "../../tasks/task-run-repository.js";
|
|
8
10
|
import { cancelConnectionObjective, consumeConnectionResume, getActiveConnectionWait, getConnectionWait, hasPendingConnectionMessages, init_connection_wait_repository, interruptedConnectionMessage, publishConnectionWait, reconcileConnectionWaits } from "../../storage/sqlite/connection-wait-repository.js";
|
|
9
11
|
import { appendTranscriptEntry } from "../../storage/sqlite/transcript-repository.js";
|
|
@@ -12,19 +14,19 @@ import { replaceLatestSessionTurnAndQueueInput, validateLatestSessionTurnTarget
|
|
|
12
14
|
import "../../storage/sqlite/index.js";
|
|
13
15
|
import { emitSessionTranscriptUpdate } from "../../session/transcript-events.js";
|
|
14
16
|
import { consumePhoneAssistance, finishPhoneAssistance, phoneAssistance, queuePhoneAssistance, reconcilePhoneAssistance } from "../../phone/assistance.js";
|
|
15
|
-
import { summarizeSourceContext } from "../../agent/source-context/types.js";
|
|
16
17
|
import { TaskApplicationService } from "../../tasks/task-application-service.js";
|
|
17
|
-
import { injectSourceContextsIntoUserMessage } from "../../agent/source-context/injector.js";
|
|
18
18
|
import { deleteMediaUrisNoLongerReferenced } from "../../media/session-references.js";
|
|
19
19
|
import { fitSourceContextsToBudget } from "../../agent/source-context/budget.js";
|
|
20
20
|
import crypto from "node:crypto";
|
|
21
21
|
import { isDeepStrictEqual } from "node:util";
|
|
22
22
|
//#region src/gateway/service/session-input-coordinator.ts
|
|
23
23
|
init_session_input_control_repository();
|
|
24
|
+
init_injector();
|
|
24
25
|
init_session_input_repository();
|
|
25
26
|
init_connection_wait_repository();
|
|
26
27
|
init_transaction();
|
|
27
28
|
init_session_instance_repository();
|
|
29
|
+
init_types();
|
|
28
30
|
init_logger();
|
|
29
31
|
init_task_run_repository();
|
|
30
32
|
const log = createLogger("SessionInputCoordinator");
|
|
@@ -96,7 +98,7 @@ var SessionInputCoordinator = class {
|
|
|
96
98
|
if (!validateLatestSessionTurnTarget(conversationId, command.turnId).ok) throw new SessionInputControlConflict("Only the latest user turn can be edited");
|
|
97
99
|
}
|
|
98
100
|
const row = command.inputId ? getSessionInputById(conversationId, command.inputId) : void 0;
|
|
99
|
-
if (!replay && command.action === "steer" && (!row || row.attachments?.length || row.contextRefs?.
|
|
101
|
+
if (!replay && command.action === "steer" && (!row || row.attachments?.length || row.contextRefs?.some((ref) => ref.kind !== "device_context") || !canSteerContexts(this.snapshot(conversationId), row.origin, row.contextSnapshots))) throw new SessionInputControlConflict("This input cannot steer the active reply");
|
|
100
102
|
const accepted = acceptSessionInputControl(conversationId, command);
|
|
101
103
|
this.publish(conversationId);
|
|
102
104
|
if (command.action === "steer") {
|
|
@@ -1699,6 +1699,7 @@ var GatewayService = class {
|
|
|
1699
1699
|
this.readiness.markStarting();
|
|
1700
1700
|
await this.endpointTools.locations.close();
|
|
1701
1701
|
this.endpointTools.close();
|
|
1702
|
+
await this.endpointTools.terminals.whenStopped();
|
|
1702
1703
|
await this.sideChats.disposeAll();
|
|
1703
1704
|
this.homeIntelligenceHost?.stop();
|
|
1704
1705
|
this.homeIntelligenceHost = null;
|
|
@@ -2,6 +2,7 @@ import { createLogger } from "../utils/logger/index.js";
|
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { getSqliteDatabase, init_transaction } from "../storage/sqlite/transaction.js";
|
|
4
4
|
import { hasGatewayScope } from "./security/gateway-scopes.js";
|
|
5
|
+
import { init_types, isSessionSourceBinding } from "../agent/source-context/types.js";
|
|
5
6
|
import { TaskRepository, init_task_repository } from "../tasks/task-repository.js";
|
|
6
7
|
import { getSessionMetadata } from "../storage/sqlite/session-read-repository.js";
|
|
7
8
|
import { getCurrentTranscriptId, init_session_repository } from "../storage/sqlite/session-repository.js";
|
|
@@ -12,10 +13,10 @@ import { effectiveWorkspacePathForSession } from "../session/session-workspace.j
|
|
|
12
13
|
import { ProjectStore } from "../projects/project-store.js";
|
|
13
14
|
import { TaskOriginRepository } from "../tasks/task-origin-repository.js";
|
|
14
15
|
import { TaskConversationRepository } from "../tasks/task-conversation-repository.js";
|
|
15
|
-
import { isSessionSourceBinding } from "../agent/source-context/types.js";
|
|
16
16
|
import { TaskCollaborationRepository } from "../tasks/task-collaboration-repository.js";
|
|
17
17
|
import { realpath, stat } from "node:fs/promises";
|
|
18
18
|
//#region src/gateway/session-context-summary.ts
|
|
19
|
+
init_types();
|
|
19
20
|
init_session_repository();
|
|
20
21
|
init_transaction();
|
|
21
22
|
init_task_repository();
|
|
@@ -268,7 +268,7 @@ function sortModelsForPicker(models) {
|
|
|
268
268
|
});
|
|
269
269
|
}
|
|
270
270
|
function getRecommendedModelsForProvider(provider, limit = 4) {
|
|
271
|
-
const fromRegistry = sortModelsForPicker(getModelsByProvider(provider)
|
|
271
|
+
const fromRegistry = sortModelsForPicker(getModelsByProvider(provider).filter((model) => !isDedicatedPhoneModel(model) && !isDedicatedComputerModel(model) && isRecommendedModel(provider, model.id))).slice(0, limit).map(modelToCatalogView);
|
|
272
272
|
if (fromRegistry.length > 0) return fromRegistry;
|
|
273
273
|
const preset = getDomesticProviderPreset(provider);
|
|
274
274
|
if (!preset) return [];
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { hasGatewayScope } from "../gateway/security/gateway-scopes.js";
|
|
4
|
+
import { getDesktopStateObservation, getDevice } from "../storage/sqlite/device-access-repository.js";
|
|
5
|
+
import { getOrCreateGatewayIdentity, signGatewayPayload } from "../storage/sqlite/gateway-identity-repository.js";
|
|
6
|
+
import { getEndpointPrincipal } from "../storage/sqlite/endpoint-principal-repository.js";
|
|
7
|
+
import { getDesktopExecutionGrant } from "../storage/sqlite/desktop-execution-repository.js";
|
|
4
8
|
import { EndpointToolPolicyError } from "../endpoint-tools/policy.js";
|
|
5
9
|
import { REALTIME_CAPABILITIES, REALTIME_HEARTBEAT_INTERVAL_MS, REALTIME_HEARTBEAT_TIMEOUT_MS, REALTIME_HELLO_TIMEOUT_MS, REALTIME_MAX_CLIENT_FRAME_BYTES, parseClientRealtimeJsonFrame, parseClientRealtimeMessage } from "../../packages/realtime-protocol/src/index.js";
|
|
10
|
+
import { DesktopDeviceFrameVerifier } from "../endpoint-tools/desktop-device-frame.js";
|
|
11
|
+
import { assertDesktopObservationHello } from "../endpoint-tools/desktop-observation.js";
|
|
12
|
+
import { assertDesktopExecutionHello } from "../endpoint-tools/desktop-execution.js";
|
|
13
|
+
import { signDesktopGatewayFrame } from "../endpoint-tools/desktop-frame.js";
|
|
6
14
|
import { verifyDeviceConnectionProof } from "../gateway/security/device-request-proof.js";
|
|
7
15
|
import { compactRunEvent } from "./compact-run-event.js";
|
|
8
16
|
import { createPreauthConnectionBudget } from "../gateway/security/preauth-connection-budget.js";
|
|
@@ -126,6 +134,18 @@ var RealtimeRuntime = class {
|
|
|
126
134
|
let endpointId;
|
|
127
135
|
let principalId;
|
|
128
136
|
let grantedScopes = [];
|
|
137
|
+
let desktopBinding;
|
|
138
|
+
let desktopDeviceFrames;
|
|
139
|
+
let executionAuthority;
|
|
140
|
+
const executionActive = () => {
|
|
141
|
+
if (!executionAuthority) return true;
|
|
142
|
+
const grant = getDesktopExecutionGrant(executionAuthority.deviceId);
|
|
143
|
+
return grant?.active && grant.revision === executionAuthority.authorizationRevision && grant.grant?.grantId === executionAuthority.grantId;
|
|
144
|
+
};
|
|
145
|
+
let desktopSequence = 0;
|
|
146
|
+
let desktopReady = false;
|
|
147
|
+
const pendingDesktopFrames = [];
|
|
148
|
+
const scopedFrame = (message) => desktopBinding ? signDesktopGatewayFrame(message, desktopBinding, ++desktopSequence, signGatewayPayload) : message;
|
|
129
149
|
let budgetHeld = true;
|
|
130
150
|
const releaseBudget = () => {
|
|
131
151
|
if (!budgetHeld) return;
|
|
@@ -158,7 +178,7 @@ var RealtimeRuntime = class {
|
|
|
158
178
|
});
|
|
159
179
|
const helloTimer = setTimeout(() => socket.close(4401, "Realtime hello timeout"), REALTIME_HELLO_TIMEOUT_MS);
|
|
160
180
|
const heartbeatTimer = setInterval(() => guardConnection("heartbeat", () => {
|
|
161
|
-
if (principalId && !this.isPrincipalActive(principalId)) {
|
|
181
|
+
if (!executionActive() || principalId && !this.isPrincipalActive(principalId)) {
|
|
162
182
|
socket.terminate();
|
|
163
183
|
return;
|
|
164
184
|
}
|
|
@@ -172,7 +192,7 @@ var RealtimeRuntime = class {
|
|
|
172
192
|
};
|
|
173
193
|
const subscribe = (requested) => {
|
|
174
194
|
const authorized = requested.filter((item) => {
|
|
175
|
-
if (isAuthorizedTopic(item.topic, grantedScopes)) return true;
|
|
195
|
+
if (!desktopBinding && isAuthorizedTopic(item.topic, grantedScopes)) return true;
|
|
176
196
|
sendError("FORBIDDEN_TOPIC", `Topic is not available: ${item.topic}`);
|
|
177
197
|
return false;
|
|
178
198
|
});
|
|
@@ -252,6 +272,45 @@ var RealtimeRuntime = class {
|
|
|
252
272
|
principalSockets.add(socket);
|
|
253
273
|
this.socketsByPrincipal.set(principalId, principalSockets);
|
|
254
274
|
connectionId = crypto.randomUUID();
|
|
275
|
+
const endpointPrincipalId = message.payload.endpoint?.kind === "desktop" ? message.payload.endpoint.principalId : void 0;
|
|
276
|
+
const device = claim.deviceId ? getDevice(claim.deviceId) : endpointPrincipalId && /^[0-9a-f-]{36}$/.test(endpointPrincipalId) ? getDevice(endpointPrincipalId) : void 0;
|
|
277
|
+
if (device?.platform === "desktop") try {
|
|
278
|
+
if (claim.deviceId !== device.id || claim.clientKind !== "desktop" || !message.payload.endpoint) throw new Error("DESKTOP_OBSERVATION_DENIED");
|
|
279
|
+
if (message.payload.endpoint.execution) {
|
|
280
|
+
if (!claim.scopes.includes("desktop.execute")) throw new Error("DESKTOP_EXECUTION_DENIED");
|
|
281
|
+
executionAuthority = assertDesktopExecutionHello(device, message.payload.endpoint, getEndpointPrincipal(device.id)?.publicKey, getOrCreateGatewayIdentity().id, claim.clientId, message.payload.capabilities ?? []);
|
|
282
|
+
} else assertDesktopObservationHello(device, message.payload.endpoint, getEndpointPrincipal(device.id)?.publicKey);
|
|
283
|
+
desktopBinding = {
|
|
284
|
+
gatewayId: getOrCreateGatewayIdentity().id,
|
|
285
|
+
deviceId: device.id,
|
|
286
|
+
clientId: claim.clientId,
|
|
287
|
+
connectionInstanceId: message.payload.endpoint.connectionInstanceId
|
|
288
|
+
};
|
|
289
|
+
const frames = message.payload.endpoint.deviceFrames;
|
|
290
|
+
if (frames) {
|
|
291
|
+
if (!message.payload.capabilities?.includes("desktop.device-frames.v1") || (executionAuthority?.authorizationRevision ?? getDesktopStateObservation(device.id)?.revision) !== frames.authorizationRevision) throw new Error("DESKTOP_DEVICE_FRAME_INVALID");
|
|
292
|
+
desktopDeviceFrames = {
|
|
293
|
+
authorizationRevision: frames.authorizationRevision,
|
|
294
|
+
verifier: new DesktopDeviceFrameVerifier({
|
|
295
|
+
...desktopBinding,
|
|
296
|
+
authorizationRevision: frames.authorizationRevision
|
|
297
|
+
}, crypto.createPublicKey({
|
|
298
|
+
key: device.publicKeyJwk,
|
|
299
|
+
format: "jwk"
|
|
300
|
+
}).export({
|
|
301
|
+
type: "spki",
|
|
302
|
+
format: "pem"
|
|
303
|
+
}).toString())
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
} catch {
|
|
307
|
+
socket.close(4401, "Desktop observation is not authorized");
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
if (message.payload.endpoint?.execution && !executionAuthority || message.payload.endpoint?.deviceFrames && !desktopDeviceFrames) {
|
|
311
|
+
socket.close(4401, "Device frame proof requires an independently authenticated desktop");
|
|
312
|
+
return;
|
|
313
|
+
}
|
|
255
314
|
let endpointReady;
|
|
256
315
|
if (message.payload.endpoint) {
|
|
257
316
|
const endpointKindMatches = message.payload.endpoint.kind === message.payload.clientKind || message.payload.clientKind === "browser_extension" && message.payload.endpoint.kind === "browser";
|
|
@@ -264,12 +323,21 @@ var RealtimeRuntime = class {
|
|
|
264
323
|
return socket.readyState;
|
|
265
324
|
},
|
|
266
325
|
send: (data) => {
|
|
267
|
-
|
|
326
|
+
const frame = serverMessage("endpoint.message", JSON.parse(data));
|
|
327
|
+
if (desktopBinding && !desktopReady) {
|
|
328
|
+
if (pendingDesktopFrames.length >= 32) {
|
|
329
|
+
socket.close(4413, "Desktop startup message limit");
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
pendingDesktopFrames.push(frame);
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
writer.enqueue(scopedFrame(frame), "critical");
|
|
268
336
|
},
|
|
269
337
|
close: (code, reason) => socket.close(code, reason)
|
|
270
338
|
};
|
|
271
339
|
try {
|
|
272
|
-
const registration = this.endpointTools.connect(message.payload.endpoint, connectionId, transport);
|
|
340
|
+
const registration = this.endpointTools.connect(message.payload.endpoint, connectionId, transport, executionAuthority);
|
|
273
341
|
endpointId = message.payload.endpoint.endpointId;
|
|
274
342
|
this.setupAuthorities.delete(endpointId);
|
|
275
343
|
if (hasGatewayScope(claim.scopes, "gateway.admin")) this.setupAuthorities.set(endpointId, {
|
|
@@ -301,13 +369,15 @@ var RealtimeRuntime = class {
|
|
|
301
369
|
clearTimeout(helloTimer);
|
|
302
370
|
releaseBudget();
|
|
303
371
|
const negotiatedCapabilities = message.payload.capabilities ? [...new Set(message.payload.capabilities.filter((capability) => REALTIME_CAPABILITIES.includes(capability)))] : void 0;
|
|
304
|
-
writer.enqueue(serverMessage("realtime.ready", {
|
|
372
|
+
writer.enqueue(scopedFrame(serverMessage("realtime.ready", {
|
|
305
373
|
connectionId,
|
|
306
374
|
heartbeatIntervalMs: REALTIME_HEARTBEAT_INTERVAL_MS,
|
|
307
375
|
heartbeatTimeoutMs: REALTIME_HEARTBEAT_TIMEOUT_MS,
|
|
308
376
|
...message.payload.capabilities ? { negotiatedCapabilities } : {},
|
|
309
377
|
...endpointReady ? { endpoint: endpointReady } : {}
|
|
310
|
-
}), "critical");
|
|
378
|
+
})), "critical");
|
|
379
|
+
desktopReady = true;
|
|
380
|
+
for (const frame of pendingDesktopFrames.splice(0)) writer.enqueue(scopedFrame(frame), "critical");
|
|
311
381
|
subscribe(message.payload.subscriptions);
|
|
312
382
|
log.info({
|
|
313
383
|
connectionId,
|
|
@@ -323,12 +393,21 @@ var RealtimeRuntime = class {
|
|
|
323
393
|
subscriptions.get(topic)?.unsubscribe();
|
|
324
394
|
subscriptions.delete(topic);
|
|
325
395
|
}
|
|
396
|
+
else if (!executionActive()) socket.close(4401, "Desktop execution authorization expired");
|
|
326
397
|
else if (message.kind === "realtime.ping") {
|
|
327
398
|
if (endpointId && connectionId) this.endpointTools?.touch(endpointId, connectionId);
|
|
328
399
|
writer.enqueue(serverMessage("realtime.pong", {}), "critical");
|
|
329
400
|
} else if (!endpointId || !connectionId || !this.endpointTools) sendError("ENDPOINT_NOT_REGISTERED", "Endpoint messages require an endpoint identity");
|
|
330
401
|
else try {
|
|
331
|
-
|
|
402
|
+
if (desktopDeviceFrames) {
|
|
403
|
+
const device = desktopBinding && getDevice(desktopBinding.deviceId);
|
|
404
|
+
if (message.kind !== "desktop.endpoint.message" || !device || device.revokedAt !== void 0 || !executionActive() || (executionAuthority?.authorizationRevision ?? getDesktopStateObservation(device.id)?.revision) !== desktopDeviceFrames.authorizationRevision) throw new Error("DESKTOP_DEVICE_FRAME_INVALID");
|
|
405
|
+
const verified = desktopDeviceFrames.verifier.verify(JSON.stringify(message.payload));
|
|
406
|
+
this.endpointTools.handleMessage(endpointId, connectionId, verified);
|
|
407
|
+
} else {
|
|
408
|
+
if (message.kind !== "endpoint.message") throw new Error("DESKTOP_DEVICE_FRAME_NOT_NEGOTIATED");
|
|
409
|
+
this.endpointTools.handleMessage(endpointId, connectionId, message.payload);
|
|
410
|
+
}
|
|
332
411
|
} catch (error) {
|
|
333
412
|
log.warn({
|
|
334
413
|
err: error,
|
|
@@ -2,6 +2,7 @@ import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
|
2
2
|
import { parseTaskResultDelivery } from "../../packages/gateway-contract/src/task-result-delivery.js";
|
|
3
3
|
import { parsePersonalProactiveMessage } from "../../packages/gateway-contract/src/personal-proactivity.js";
|
|
4
4
|
import { init_src } from "../../packages/gateway-contract/src/index.js";
|
|
5
|
+
import { init_source_context_projection, projectSourceContextsForLlm } from "../agent/source-context/source-context-projection.js";
|
|
5
6
|
import { init_task_allocation_status, isRoutineTaskAllocationStatus } from "./task-allocation-status.js";
|
|
6
7
|
import { init_voice_transcript, voiceTranscriptMessage } from "./voice-transcript.js";
|
|
7
8
|
import { init_compaction_types, isCompactionAudit, isCompactionHandover } from "./compaction-types.js";
|
|
@@ -348,7 +349,7 @@ function buildSessionContextForLlm(rows) {
|
|
|
348
349
|
}
|
|
349
350
|
if (isLikelyAgentMessage(r)) out.push(r);
|
|
350
351
|
}
|
|
351
|
-
return projectBrowserVisualContext(sanitizeToolPairs(out));
|
|
352
|
+
return projectSourceContextsForLlm(projectBrowserVisualContext(sanitizeToolPairs(out)));
|
|
352
353
|
}
|
|
353
354
|
/** Visible chat messages only - no LLM-only audit/context expansion. */
|
|
354
355
|
function buildSessionDisplayMessages(rows) {
|
|
@@ -431,6 +432,7 @@ function mergeLlmMessagesPreservingContextRows(prevRows, llmMessages) {
|
|
|
431
432
|
var LLM_ROLES;
|
|
432
433
|
var init_session_context_for_llm = __esmMin((() => {
|
|
433
434
|
init_src();
|
|
435
|
+
init_source_context_projection();
|
|
434
436
|
init_task_allocation_status();
|
|
435
437
|
init_voice_transcript();
|
|
436
438
|
init_compaction_types();
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type DesktopExecutionGrant } from '@xopcai/gateway-contract';
|
|
2
|
+
export declare function getDesktopExecutionGrant(deviceId: string, now?: number): {
|
|
3
|
+
grant?: {
|
|
4
|
+
version: 1;
|
|
5
|
+
grantId: string;
|
|
6
|
+
localApprovalId: string;
|
|
7
|
+
toolRevisions: Partial<Record<"desktop.clipboard.write" | "desktop.operation.get_status" | "desktop.workspace.list" | "desktop.workspace.read" | "desktop.workspace.write" | "desktop.command.run" | "desktop.terminal.open" | "desktop.terminal.control" | "desktop.computer.remote_control" | "desktop.browser.control", string>>;
|
|
8
|
+
expiresAt: number;
|
|
9
|
+
workspaceId?: string;
|
|
10
|
+
};
|
|
11
|
+
deviceId: string;
|
|
12
|
+
revision: number;
|
|
13
|
+
enabled: boolean;
|
|
14
|
+
active: boolean;
|
|
15
|
+
};
|
|
16
|
+
/** Input must have been approved locally and authenticated with this device's request proof. */
|
|
17
|
+
export declare function setDesktopExecutionGrant(deviceId: string, expectedRevision: number, input: DesktopExecutionGrant, now?: number): {
|
|
18
|
+
grant?: {
|
|
19
|
+
version: 1;
|
|
20
|
+
grantId: string;
|
|
21
|
+
localApprovalId: string;
|
|
22
|
+
toolRevisions: Partial<Record<"desktop.clipboard.write" | "desktop.operation.get_status" | "desktop.workspace.list" | "desktop.workspace.read" | "desktop.workspace.write" | "desktop.command.run" | "desktop.terminal.open" | "desktop.terminal.control" | "desktop.computer.remote_control" | "desktop.browser.control", string>>;
|
|
23
|
+
expiresAt: number;
|
|
24
|
+
workspaceId?: string;
|
|
25
|
+
};
|
|
26
|
+
deviceId: string;
|
|
27
|
+
revision: number;
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
active: boolean;
|
|
30
|
+
};
|
|
31
|
+
export declare function revokeDesktopExecutionGrant(deviceId: string, grantId: string, expectedRevision: number, now?: number): {
|
|
32
|
+
grant?: {
|
|
33
|
+
version: 1;
|
|
34
|
+
grantId: string;
|
|
35
|
+
localApprovalId: string;
|
|
36
|
+
toolRevisions: Partial<Record<"desktop.clipboard.write" | "desktop.operation.get_status" | "desktop.workspace.list" | "desktop.workspace.read" | "desktop.workspace.write" | "desktop.command.run" | "desktop.terminal.open" | "desktop.terminal.control" | "desktop.computer.remote_control" | "desktop.browser.control", string>>;
|
|
37
|
+
expiresAt: number;
|
|
38
|
+
workspaceId?: string;
|
|
39
|
+
};
|
|
40
|
+
deviceId: string;
|
|
41
|
+
revision: number;
|
|
42
|
+
enabled: boolean;
|
|
43
|
+
active: boolean;
|
|
44
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "./transaction.js";
|
|
2
|
+
import { desktopExecutionGrantSchema } from "../../../packages/gateway-contract/src/desktop-host.js";
|
|
3
|
+
import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
4
|
+
import { desktopExecutionRow, recordDesktopExecutionEvent, revokeDesktopExecutionRow } from "./desktop-execution-state.js";
|
|
5
|
+
import { getDesktopStateObservation, getDevice } from "./device-access-repository.js";
|
|
6
|
+
import { canonicalJson, init_src as init_src$1 } from "../../../packages/endpoint-tools-protocol/src/index.js";
|
|
7
|
+
//#region src/storage/sqlite/desktop-execution-repository.ts
|
|
8
|
+
init_src();
|
|
9
|
+
init_src$1();
|
|
10
|
+
init_transaction();
|
|
11
|
+
function getDesktopExecutionGrant(deviceId, now = Date.now()) {
|
|
12
|
+
const device = getDevice(deviceId);
|
|
13
|
+
if (!device || device.revokedAt !== void 0 || device.platform !== "desktop") return;
|
|
14
|
+
const row = desktopExecutionRow(getSqliteDatabase(), deviceId);
|
|
15
|
+
const grant = row ? desktopExecutionGrantSchema.parse(JSON.parse(row.grant_json)) : void 0;
|
|
16
|
+
return {
|
|
17
|
+
deviceId,
|
|
18
|
+
revision: row?.revision ?? 0,
|
|
19
|
+
enabled: row?.active === 1,
|
|
20
|
+
active: row?.active === 1 && device.scopes.includes("desktop.execute") && grant.expiresAt > now,
|
|
21
|
+
...grant ? { grant } : {}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** Input must have been approved locally and authenticated with this device's request proof. */
|
|
25
|
+
function setDesktopExecutionGrant(deviceId, expectedRevision, input, now = Date.now()) {
|
|
26
|
+
const grant = desktopExecutionGrantSchema.parse(input), json = canonicalJson(grant);
|
|
27
|
+
if (grant.expiresAt <= now + 1e3 || grant.expiresAt > now + 3e5) throw new Error("DESKTOP_EXECUTION_GRANT_EXPIRED");
|
|
28
|
+
return runSqliteWriteTransaction((db) => {
|
|
29
|
+
const device = getDevice(deviceId), row = desktopExecutionRow(db, deviceId);
|
|
30
|
+
if (!device || device.revokedAt !== void 0 || device.platform !== "desktop") throw new Error("DESKTOP_EXECUTION_DEVICE_INVALID");
|
|
31
|
+
if (!Number.isSafeInteger(expectedRevision) || expectedRevision < 0) throw new Error("DESKTOP_EXECUTION_REVISION_CHANGED");
|
|
32
|
+
if (row?.active && row.grant_json === json) return getDesktopExecutionGrant(deviceId, now);
|
|
33
|
+
if (expectedRevision !== (row?.revision ?? 0)) throw new Error("DESKTOP_EXECUTION_REVISION_CHANGED");
|
|
34
|
+
if (db.prepare("SELECT 1 FROM desktop_execution_grant_events WHERE device_id=? AND action='granted' AND (grant_id=? OR approval_id=?)").get(deviceId, grant.grantId, grant.localApprovalId)) throw new Error("DESKTOP_EXECUTION_APPROVAL_ALREADY_USED");
|
|
35
|
+
if (db.prepare("SELECT count(*) AS count FROM desktop_execution_grant_events WHERE device_id=?").get(deviceId)?.count + (row?.active ? 2 : 1) + 1 > 1e4) throw new Error("DESKTOP_EXECUTION_GRANT_LIMIT");
|
|
36
|
+
const revision = (row?.revision ?? 0) + 1, observation = getDesktopStateObservation(deviceId);
|
|
37
|
+
if (!Number.isSafeInteger(revision) || !Number.isSafeInteger(observation.revision + 1)) throw new Error("DESKTOP_EXECUTION_REVISION_LIMIT");
|
|
38
|
+
const next = {
|
|
39
|
+
device_id: deviceId,
|
|
40
|
+
revision,
|
|
41
|
+
grant_id: grant.grantId,
|
|
42
|
+
approval_id: grant.localApprovalId,
|
|
43
|
+
grant_json: json,
|
|
44
|
+
active: 1
|
|
45
|
+
};
|
|
46
|
+
if (row?.active) recordDesktopExecutionEvent(db, {
|
|
47
|
+
...row,
|
|
48
|
+
revision,
|
|
49
|
+
active: 0
|
|
50
|
+
}, "revoked", now);
|
|
51
|
+
db.prepare(`INSERT INTO desktop_execution_grants(device_id,revision,grant_id,approval_id,grant_json,active,updated_at) VALUES (?,?,?,?,?,1,?)
|
|
52
|
+
ON CONFLICT(device_id) DO UPDATE SET revision=excluded.revision,grant_id=excluded.grant_id,approval_id=excluded.approval_id,grant_json=excluded.grant_json,active=1,updated_at=excluded.updated_at`).run(deviceId, revision, grant.grantId, grant.localApprovalId, json, now);
|
|
53
|
+
recordDesktopExecutionEvent(db, next, "granted", now);
|
|
54
|
+
const scopes = device.scopes.filter((scope) => ![
|
|
55
|
+
"desktop.observe.state",
|
|
56
|
+
"desktop.observe.screen",
|
|
57
|
+
"desktop.execute"
|
|
58
|
+
].includes(scope));
|
|
59
|
+
db.prepare("UPDATE devices SET scopes_json=? WHERE device_id=?").run(JSON.stringify([...scopes, "desktop.execute"]), deviceId);
|
|
60
|
+
db.prepare(`INSERT INTO desktop_observation_grants(device_id,revision,updated_at) VALUES (?,?,?)
|
|
61
|
+
ON CONFLICT(device_id) DO UPDATE SET revision=excluded.revision,updated_at=excluded.updated_at`).run(deviceId, observation.revision + 1, now);
|
|
62
|
+
return getDesktopExecutionGrant(deviceId, now);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function revokeDesktopExecutionGrant(deviceId, grantId, expectedRevision, now = Date.now()) {
|
|
66
|
+
return runSqliteWriteTransaction((db) => {
|
|
67
|
+
const current = getDesktopExecutionGrant(deviceId, now), row = desktopExecutionRow(db, deviceId);
|
|
68
|
+
if (!current || !row || row.grant_id !== grantId || !Number.isSafeInteger(expectedRevision) || expectedRevision < 0 || (row.active === 1 ? row.revision !== expectedRevision : expectedRevision > row.revision)) throw new Error("DESKTOP_EXECUTION_REVISION_CHANGED");
|
|
69
|
+
revokeDesktopExecutionRow(db, deviceId, now);
|
|
70
|
+
const device = getDevice(deviceId);
|
|
71
|
+
db.prepare("UPDATE devices SET scopes_json=? WHERE device_id=?").run(JSON.stringify(device.scopes.filter((scope) => scope !== "desktop.execute")), deviceId);
|
|
72
|
+
return getDesktopExecutionGrant(deviceId, now);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
//#endregion
|
|
76
|
+
export { getDesktopExecutionGrant, revokeDesktopExecutionGrant, setDesktopExecutionGrant };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DatabaseSync } from 'node:sqlite';
|
|
2
|
+
export type DesktopExecutionRow = {
|
|
3
|
+
device_id: string;
|
|
4
|
+
revision: number;
|
|
5
|
+
grant_id: string;
|
|
6
|
+
approval_id: string;
|
|
7
|
+
grant_json: string;
|
|
8
|
+
active: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function desktopExecutionRow(db: DatabaseSync, deviceId: string): DesktopExecutionRow | undefined;
|
|
11
|
+
export declare function recordDesktopExecutionEvent(db: DatabaseSync, row: DesktopExecutionRow, action: 'granted' | 'revoked', now: number): void;
|
|
12
|
+
/** Called inside the existing device-scope transaction; never restores a revoked grant. */
|
|
13
|
+
export declare function revokeDesktopExecutionRow(db: DatabaseSync, deviceId: string, now?: number): void;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
//#region src/storage/sqlite/desktop-execution-state.ts
|
|
3
|
+
function desktopExecutionRow(db, deviceId) {
|
|
4
|
+
return db.prepare("SELECT device_id,revision,grant_id,approval_id,grant_json,active FROM desktop_execution_grants WHERE device_id=?").get(deviceId);
|
|
5
|
+
}
|
|
6
|
+
function recordDesktopExecutionEvent(db, row, action, now) {
|
|
7
|
+
db.prepare("INSERT INTO desktop_execution_grant_events(event_id,device_id,revision,grant_id,approval_id,action,grant_json,created_at) VALUES (?,?,?,?,?,?,?,?)").run(randomUUID(), row.device_id, row.revision, row.grant_id, row.approval_id, action, row.grant_json, now);
|
|
8
|
+
}
|
|
9
|
+
/** Called inside the existing device-scope transaction; never restores a revoked grant. */
|
|
10
|
+
function revokeDesktopExecutionRow(db, deviceId, now = Date.now()) {
|
|
11
|
+
const row = desktopExecutionRow(db, deviceId);
|
|
12
|
+
if (!row?.active) return;
|
|
13
|
+
if (!Number.isSafeInteger(row.revision + 1)) throw new Error("DESKTOP_EXECUTION_REVISION_LIMIT");
|
|
14
|
+
db.prepare("UPDATE desktop_execution_grants SET active=0,revision=?,updated_at=? WHERE device_id=?").run(row.revision + 1, now, deviceId);
|
|
15
|
+
recordDesktopExecutionEvent(db, {
|
|
16
|
+
...row,
|
|
17
|
+
revision: row.revision + 1,
|
|
18
|
+
active: 0
|
|
19
|
+
}, "revoked", now);
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { desktopExecutionRow, recordDesktopExecutionEvent, revokeDesktopExecutionRow };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type SignedDesktopExecutionStop } from '@xopcai/gateway-contract';
|
|
2
|
+
/** The device key remains valid only for stopping its exact historical grant after revocation, never for access or execution. */
|
|
3
|
+
export declare function recordDesktopExecutionStop(input: SignedDesktopExecutionStop, now?: number): {
|
|
4
|
+
stopId: string;
|
|
5
|
+
gatewayId: string;
|
|
6
|
+
deviceId: string;
|
|
7
|
+
grantId: string;
|
|
8
|
+
authorizationRevision: number;
|
|
9
|
+
stopped: true;
|
|
10
|
+
revokedCurrent: boolean;
|
|
11
|
+
};
|
|
12
|
+
/** Releases only stale session admission. Unknown operations keep their original state and replay prohibition. */
|
|
13
|
+
export declare function hasVerifiedDesktopExecutionStop(scope: {
|
|
14
|
+
gatewayId: string;
|
|
15
|
+
deviceId: string;
|
|
16
|
+
authorizationRevision: number;
|
|
17
|
+
tool: string;
|
|
18
|
+
toolRevision: string;
|
|
19
|
+
}): boolean;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "./transaction.js";
|
|
2
|
+
import { desktopExecutionGrantSchema } from "../../../packages/gateway-contract/src/desktop-host.js";
|
|
3
|
+
import { desktopExecutionStopSigningPayload, signedDesktopExecutionStopSchema } from "../../../packages/gateway-contract/src/desktop-execution-stop.js";
|
|
4
|
+
import { init_src } from "../../../packages/gateway-contract/src/index.js";
|
|
5
|
+
import { desktopExecutionRow, revokeDesktopExecutionRow } from "./desktop-execution-state.js";
|
|
6
|
+
import { getDevice } from "./device-access-repository.js";
|
|
7
|
+
import { getOrCreateGatewayIdentity } from "./gateway-identity-repository.js";
|
|
8
|
+
import { canonicalJson, init_src as init_src$1 } from "../../../packages/endpoint-tools-protocol/src/index.js";
|
|
9
|
+
import { createHash, createPublicKey, verify } from "node:crypto";
|
|
10
|
+
//#region src/storage/sqlite/desktop-execution-stop-repository.ts
|
|
11
|
+
init_src();
|
|
12
|
+
init_src$1();
|
|
13
|
+
init_transaction();
|
|
14
|
+
const digest = (json) => createHash("sha256").update(json).digest("hex");
|
|
15
|
+
/** The device key remains valid only for stopping its exact historical grant after revocation, never for access or execution. */
|
|
16
|
+
function recordDesktopExecutionStop(input, now = Date.now()) {
|
|
17
|
+
const signed = signedDesktopExecutionStopSchema.parse(input), receipt = signed.receipt;
|
|
18
|
+
const device = getDevice(receipt.deviceId);
|
|
19
|
+
if (!device || device.platform !== "desktop" || receipt.gatewayId !== getOrCreateGatewayIdentity().id || !verify("sha256", Buffer.from(desktopExecutionStopSigningPayload(receipt)), {
|
|
20
|
+
key: createPublicKey({
|
|
21
|
+
key: device.publicKeyJwk,
|
|
22
|
+
format: "jwk"
|
|
23
|
+
}),
|
|
24
|
+
dsaEncoding: "ieee-p1363"
|
|
25
|
+
}, Buffer.from(signed.signature, "base64url"))) throw new Error("DESKTOP_STOP_INVALID");
|
|
26
|
+
return runSqliteWriteTransaction((db) => {
|
|
27
|
+
const currentDevice = getDevice(receipt.deviceId);
|
|
28
|
+
if (!currentDevice || currentDevice.platform !== "desktop" || canonicalJson(currentDevice.publicKeyJwk) !== canonicalJson(device.publicKeyJwk)) throw new Error("DESKTOP_STOP_INVALID");
|
|
29
|
+
const event = db.prepare("SELECT grant_json FROM desktop_execution_grant_events WHERE device_id=? AND grant_id=? AND revision=? AND action='granted'").get(receipt.deviceId, receipt.grantId, receipt.authorizationRevision);
|
|
30
|
+
if (!event) throw new Error("DESKTOP_STOP_INVALID");
|
|
31
|
+
if (desktopExecutionGrantSchema.parse(JSON.parse(event.grant_json)).grantId !== receipt.grantId) throw new Error("DESKTOP_STOP_INVALID");
|
|
32
|
+
const json = canonicalJson(signed), grantDigest = digest(event.grant_json);
|
|
33
|
+
const previous = db.prepare("SELECT receipt_json,grant_digest FROM desktop_execution_stops WHERE device_id=? AND grant_id=? AND authorization_revision=?").get(receipt.deviceId, receipt.grantId, receipt.authorizationRevision);
|
|
34
|
+
if (previous && (canonicalJson(signedDesktopExecutionStopSchema.parse(JSON.parse(previous.receipt_json)).receipt) !== canonicalJson(receipt) || previous.grant_digest !== grantDigest) || db.prepare("SELECT 1 FROM desktop_execution_stops WHERE stop_id=? AND (device_id<>? OR grant_id<>? OR authorization_revision<>?)").get(receipt.stopId, receipt.deviceId, receipt.grantId, receipt.authorizationRevision)) throw new Error("DESKTOP_STOP_CONFLICT");
|
|
35
|
+
const row = desktopExecutionRow(db, receipt.deviceId);
|
|
36
|
+
const revokedCurrent = Boolean(row?.active && row.grant_id === receipt.grantId);
|
|
37
|
+
if (revokedCurrent) {
|
|
38
|
+
revokeDesktopExecutionRow(db, receipt.deviceId, now);
|
|
39
|
+
db.prepare("UPDATE devices SET scopes_json=? WHERE device_id=?").run(JSON.stringify(currentDevice.scopes.filter((scope) => scope !== "desktop.execute")), receipt.deviceId);
|
|
40
|
+
}
|
|
41
|
+
if (!previous) db.prepare("INSERT INTO desktop_execution_stops(device_id,grant_id,authorization_revision,stop_id,receipt_json,grant_digest,created_at) VALUES(?,?,?,?,?,?,?)").run(receipt.deviceId, receipt.grantId, receipt.authorizationRevision, receipt.stopId, json, grantDigest, now);
|
|
42
|
+
return {
|
|
43
|
+
stopId: receipt.stopId,
|
|
44
|
+
gatewayId: receipt.gatewayId,
|
|
45
|
+
deviceId: receipt.deviceId,
|
|
46
|
+
grantId: receipt.grantId,
|
|
47
|
+
authorizationRevision: receipt.authorizationRevision,
|
|
48
|
+
stopped: true,
|
|
49
|
+
revokedCurrent
|
|
50
|
+
};
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/** Releases only stale session admission. Unknown operations keep their original state and replay prohibition. */
|
|
54
|
+
function hasVerifiedDesktopExecutionStop(scope) {
|
|
55
|
+
if (scope.gatewayId !== getOrCreateGatewayIdentity().id) return false;
|
|
56
|
+
const row = getSqliteDatabase().prepare(`SELECT s.receipt_json,s.grant_digest,e.grant_json FROM desktop_execution_stops s
|
|
57
|
+
JOIN desktop_execution_grant_events e ON e.device_id=s.device_id AND e.grant_id=s.grant_id AND e.revision=s.authorization_revision AND e.action='granted'
|
|
58
|
+
WHERE s.device_id=? AND s.authorization_revision=?`).get(scope.deviceId, scope.authorizationRevision);
|
|
59
|
+
if (!row || row.grant_digest !== digest(row.grant_json)) return false;
|
|
60
|
+
const { receipt } = signedDesktopExecutionStopSchema.parse(JSON.parse(row.receipt_json));
|
|
61
|
+
const grant = desktopExecutionGrantSchema.parse(JSON.parse(row.grant_json));
|
|
62
|
+
const current = desktopExecutionRow(getSqliteDatabase(), scope.deviceId);
|
|
63
|
+
return receipt.gatewayId === scope.gatewayId && receipt.deviceId === scope.deviceId && receipt.authorizationRevision === scope.authorizationRevision && receipt.grantId === grant.grantId && grant.toolRevisions[scope.tool] === scope.toolRevision && !(current?.active && current.grant_id === receipt.grantId);
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
export { hasVerifiedDesktopExecutionStop, recordDesktopExecutionStop };
|