@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.
Files changed (316) hide show
  1. package/dist/browser-ext/dist/assets/{page-context-b-rB5vJC.js → page-context-DngcqfGf.js} +130 -9
  2. package/dist/browser-ext/dist/background.js +9 -1
  3. package/dist/browser-ext/dist/sidepanel.html +1 -1
  4. package/dist/browser-ext/dist/sidepanel.js +1 -1
  5. package/dist/browser-ext/manifest.json +1 -1
  6. package/dist/extensions/telegram/xopc.extension.json +1 -1
  7. package/dist/gateway/static/root/assets/{activity-store-CXhhy7_9.js → activity-store-Fl327RND.js} +1 -1
  8. package/dist/gateway/static/root/assets/{agent-avatar-dicebear-_h4GxzUK.js → agent-avatar-dicebear-DL_MfWA8.js} +1 -1
  9. package/dist/gateway/static/root/assets/{agent-avatar-display-B_QEDfMT.js → agent-avatar-display-BTDt883i.js} +2 -2
  10. package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-DWIluCZB.js → agent-defaults-settings-panel-CuiIuR1Q.js} +1 -1
  11. package/dist/gateway/static/root/assets/{agent-plugin-dialog-lCWIS06R.js → agent-plugin-dialog-moOAOJPs.js} +1 -1
  12. package/dist/gateway/static/root/assets/{agents-C-tIn72l.js → agents-B1yM1cWS.js} +3 -3
  13. package/dist/gateway/static/root/assets/{agents-admin-api-DIStX2e1.js → agents-admin-api-D6pZX7nW.js} +1 -1
  14. package/dist/gateway/static/root/assets/{api-C4xrqOKi.js → api-H3OfSCEz.js} +1 -1
  15. package/dist/gateway/static/root/assets/{api-bT-kA268.js → api-np_upIrk.js} +1 -1
  16. package/dist/gateway/static/root/assets/{app-management-settings-panel-Dk75Bmi2.js → app-management-settings-panel-IFKcvOK9.js} +1 -1
  17. package/dist/gateway/static/root/assets/{appearance-settings-DTj1XI4v.js → appearance-settings-Cfb4s0Ik.js} +1 -1
  18. package/dist/gateway/static/root/assets/{apps-page-7iAULaEl.js → apps-page-DMDwnwEi.js} +1 -1
  19. package/dist/gateway/static/root/assets/{archive-plugin-BADrW4yR.js → archive-plugin-DBKvxHvn.js} +1 -1
  20. package/dist/gateway/static/root/assets/{automation-api-CRz5EE_c.js → automation-api-iUvu64Gn.js} +1 -1
  21. package/dist/gateway/static/root/assets/{automation-result-state-D0EHDk4V.js → automation-result-state-EFwxlLpI.js} +1 -1
  22. package/dist/gateway/static/root/assets/{automation-run-list-CnaV2j9R.js → automation-run-list-C66yqC4g.js} +1 -1
  23. package/dist/gateway/static/root/assets/{automation-task-card-DD4yjrI6.js → automation-task-card-DXNh_uKL.js} +1 -1
  24. package/dist/gateway/static/root/assets/{automations-page-DDNx4Gn3.js → automations-page-iCsHbzY_.js} +1 -1
  25. package/dist/gateway/static/root/assets/{automations-workspace-CtidgXTX.js → automations-workspace-DnLrs-fb.js} +2 -2
  26. package/dist/gateway/static/root/assets/{binary-plugins-hpeH8g5V.js → binary-plugins-C5K0CWqt.js} +1 -1
  27. package/dist/gateway/static/root/assets/{block-editor-P_RGb2rE.js → block-editor-3TVEcFpk.js} +1 -1
  28. package/dist/gateway/static/root/assets/{browser-automation-inputs-C3gQlgox.js → browser-automation-inputs-Wuph6STC.js} +1 -1
  29. package/dist/gateway/static/root/assets/{browser-automations-page-CsdyL6q5.js → browser-automations-page-THaENU71.js} +1 -1
  30. package/dist/gateway/static/root/assets/{browser-control-api-Btwz8koK.js → browser-control-api-DeRUE9Io.js} +1 -1
  31. package/dist/gateway/static/root/assets/{browser-settings-page-B-ks3b8r.js → browser-settings-page-CeNb4Kyc.js} +1 -1
  32. package/dist/gateway/static/root/assets/{capabilities-f0YyWX04.js → capabilities-B3cchabB.js} +1 -1
  33. package/dist/gateway/static/root/assets/{capabilities-C4F2D1gH.js → capabilities-CFO_gAma.js} +1 -1
  34. package/dist/gateway/static/root/assets/{capabilities-page-CJm5gNu8.js → capabilities-page-KM3X4Bj-.js} +2 -2
  35. package/dist/gateway/static/root/assets/{capabilities-settings-panel-BMg8DBa0.js → capabilities-settings-panel-CX201jtA.js} +1 -1
  36. package/dist/gateway/static/root/assets/{channels-DYgvP8sO.js → channels-DmF6s5BH.js} +1 -1
  37. package/dist/gateway/static/root/assets/{chat-agents-api-BrsUEl3u.js → chat-agents-api-ipkXPITj.js} +1 -1
  38. package/dist/gateway/static/root/assets/{chat-chart-block-Cq3aoRzV.js → chat-chart-block-KOdy3HcB.js} +1 -1
  39. package/dist/gateway/static/root/assets/{chat-page-dh7ImvX8.js → chat-page-DZy7iw5A.js} +6 -6
  40. package/dist/gateway/static/root/assets/{chat-terminal-dock-2eGZ5qZ7.js → chat-terminal-dock-BouLAS3C.js} +1 -1
  41. package/dist/gateway/static/root/assets/{command-palette-api-BEqdX7Q-.js → command-palette-api-CHEmmKmY.js} +1 -1
  42. package/dist/gateway/static/root/assets/{composer-payload-handoff-BBm3ypBb.js → composer-payload-handoff-DQVtV0L9.js} +1 -1
  43. package/dist/gateway/static/root/assets/{computer-settings-page-DUhsxs4l.js → computer-settings-page-DwEzbr0-.js} +1 -1
  44. package/dist/gateway/static/root/assets/{connected-providers-grid-BsCLGLnw.js → connected-providers-grid-CWdA7VtN.js} +1 -1
  45. package/dist/gateway/static/root/assets/{connection-usage-guide-BgvvHMc4.js → connection-usage-guide-5RmYdXoS.js} +1 -1
  46. package/dist/gateway/static/root/assets/{connector-service-page-C3SmPK1c.js → connector-service-page-TeYvzScr.js} +1 -1
  47. package/dist/gateway/static/root/assets/{connectors-api-Now9xXuA.js → connectors-api-Byw6RD4z.js} +1 -1
  48. package/dist/gateway/static/root/assets/{connectors-page-CTMeC7Pt.js → connectors-page-B4PrSnT8.js} +1 -1
  49. package/dist/gateway/static/root/assets/{date-picker-CBoc2ETg.js → date-picker-BpccZyjF.js} +1 -1
  50. package/dist/gateway/static/root/assets/{desktop-pet-DS2dJydK.js → desktop-pet-DfGMB4GN.js} +1 -1
  51. package/dist/gateway/static/root/assets/{desktop-pet-settings-CzGc9byI.js → desktop-pet-settings-ky__zEoY.js} +1 -1
  52. package/dist/gateway/static/root/assets/{dev-view-store-BXMp1Npf.js → dev-view-store-do-XMWDA.js} +1 -1
  53. package/dist/gateway/static/root/assets/{device-pairing-wizard--SCayxiS.js → device-pairing-wizard-CQNlQGYH.js} +1 -1
  54. package/dist/gateway/static/root/assets/{directory-picker-path-field-P_-tLtwi.js → directory-picker-path-field-DjhHz-4p.js} +1 -1
  55. package/dist/gateway/static/root/assets/{discussion-annotation-sync-D_NJLur2.js → discussion-annotation-sync-CvGsuUi9.js} +1 -1
  56. package/dist/gateway/static/root/assets/{extension-debug-page-CE9KJpjL.js → extension-debug-page-BimrAkDl.js} +1 -1
  57. package/dist/gateway/static/root/assets/{extension-iframe-host-ClbrQvGF.js → extension-iframe-host-7zoDddj6.js} +1 -1
  58. package/dist/gateway/static/root/assets/{extension-marketplace-api-BNNQYLeu.js → extension-marketplace-api-DA-nbL9C.js} +1 -1
  59. package/dist/gateway/static/root/assets/{extension-page-C6qZ9pGs.js → extension-page-wjS2go2N.js} +1 -1
  60. package/dist/gateway/static/root/assets/{extension-provider-KmpUveDY.js → extension-provider-C2L-lGqA.js} +1 -1
  61. package/dist/gateway/static/root/assets/{extension-settings-page-DWKB4ETv.js → extension-settings-page-CTHs7h7H.js} +1 -1
  62. package/dist/gateway/static/root/assets/{file-preview-surface-CEDfehx5.js → file-preview-surface-QUJiCKCs.js} +1 -1
  63. package/dist/gateway/static/root/assets/{gateway-config-swr-CtEdaxOS.js → gateway-config-swr-RHiDzhCY.js} +1 -1
  64. package/dist/gateway/static/root/assets/gateway-realtime-DUlVfng6.js +1 -0
  65. package/dist/gateway/static/root/assets/gateway-realtime-store-C_CDU3to.js +1 -0
  66. package/dist/gateway/static/root/assets/{gateway-restart-srJ9TMC5.js → gateway-restart-L34umMj8.js} +1 -1
  67. package/dist/gateway/static/root/assets/{gateway-settings-DWVxjM9y.js → gateway-settings-DjwPEBcq.js} +1 -1
  68. package/dist/gateway/static/root/assets/{gateway-startup-retry-xpHdw5uq.js → gateway-startup-retry-CgLo6P66.js} +1 -1
  69. package/dist/gateway/static/root/assets/{global-defaults-api-C-ogBDn1.js → global-defaults-api-Cv6QEJBa.js} +1 -1
  70. package/dist/gateway/static/root/assets/{home-page-2Uj--v_o.js → home-page-D9gDR4MB.js} +2 -2
  71. package/dist/gateway/static/root/assets/{image-generation-api-DFGE3Ait.js → image-generation-api-C_GDIILz.js} +1 -1
  72. package/dist/gateway/static/root/assets/{imports-page-BkslHrr5.js → imports-page-CvY8wdNu.js} +1 -1
  73. package/dist/gateway/static/root/assets/{index-BxHzmTJV.js → index-BVyX4V3C.js} +5 -5
  74. package/dist/gateway/static/root/assets/{install-connector-dialog-Fctw32Lx.js → install-connector-dialog-Cnx5oOXv.js} +1 -1
  75. package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DFBpeaA_.js → keyboard-shortcuts-settings-AXisbvQn.js} +1 -1
  76. package/dist/gateway/static/root/assets/{local-app-workbench-page-hJzkUVoK.js → local-app-workbench-page-DxO9ZTU_.js} +1 -1
  77. package/dist/gateway/static/root/assets/{local-apps-page-Bj-nywIv.js → local-apps-page-sas0hMvK.js} +1 -1
  78. package/dist/gateway/static/root/assets/{local-session-drafts-hodTdtvj.js → local-session-drafts-DzHbV0VQ.js} +1 -1
  79. package/dist/gateway/static/root/assets/{locale-store-LhhHA2sK.js → locale-store-BRJAl_Kx.js} +1 -1
  80. package/dist/gateway/static/root/assets/{logs-page-CcM2foZi.js → logs-page-BkuLDfZ4.js} +1 -1
  81. package/dist/gateway/static/root/assets/management-settings-CPPZfnc7.js +1 -0
  82. package/dist/gateway/static/root/assets/{markdown-view-usF9EoMp.js → markdown-view-BRNPKsnn.js} +1 -1
  83. package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-CfHcS8aO.js → mcp-conversation-setup-page-C5gTNa2U.js} +1 -1
  84. package/dist/gateway/static/root/assets/{media-plugins-Kpj3pQ3i.js → media-plugins-BMvgnbE7.js} +1 -1
  85. package/dist/gateway/static/root/assets/messages-Ct1hODNU.js +3 -0
  86. package/dist/gateway/static/root/assets/{model-selector-VVkCmNdS.js → model-selector-kWRDioTb.js} +1 -1
  87. package/dist/gateway/static/root/assets/{models-hub-cache-BfrcizHv.js → models-hub-cache-h2vf54qy.js} +1 -1
  88. package/dist/gateway/static/root/assets/{note-detail-panel-vvlPKLHz.js → note-detail-panel-DcTiI934.js} +3 -3
  89. package/dist/gateway/static/root/assets/note-image-lightbox-Bjefof6e.js +1 -0
  90. package/dist/gateway/static/root/assets/{notes-api-DflS6I2c.js → notes-api-D29fdWyC.js} +1 -1
  91. package/dist/gateway/static/root/assets/{notes-page-DKPHaszO.js → notes-page-CqnQ_UEf.js} +1 -1
  92. package/dist/gateway/static/root/assets/{oauth-api-CZiot_FY.js → oauth-api-C8McgC-r.js} +1 -1
  93. package/dist/gateway/static/root/assets/{oauth-provider-connect-BjLEJ4az.js → oauth-provider-connect-BDTdg0lv.js} +1 -1
  94. package/dist/gateway/static/root/assets/{page-context-capture-button-C3okR3ap.js → page-context-capture-button-Bf0qvNmd.js} +1 -1
  95. package/dist/gateway/static/root/assets/{page-context-draft-DRE6i2wO.js → page-context-draft-Dx0F3tHK.js} +1 -1
  96. package/dist/gateway/static/root/assets/page-header-store-lsAlAXWQ.js +1 -0
  97. package/dist/gateway/static/root/assets/{personal-avatar-TZzkeDZK.js → personal-avatar-CpEFjQ4Q.js} +1 -1
  98. package/dist/gateway/static/root/assets/{personal-page-Cz-KnXHT.js → personal-page-BvjPpwdy.js} +1 -1
  99. package/dist/gateway/static/root/assets/{personal-settings-panel-BilBWHZ1.js → personal-settings-panel-DixKsLRd.js} +1 -1
  100. package/dist/gateway/static/root/assets/{phone-dependencies-card-B_l_JCRy.js → phone-dependencies-card-BfpFV3SG.js} +1 -1
  101. package/dist/gateway/static/root/assets/{phone-model-connection-DmYRqxCF.js → phone-model-connection-Os87SvBE.js} +1 -1
  102. package/dist/gateway/static/root/assets/{phone-model-picker-wK2tRuj0.js → phone-model-picker-8pkA8k_N.js} +1 -1
  103. package/dist/gateway/static/root/assets/{phone-settings-page-DWUZuu3k.js → phone-settings-page-ByERmr61.js} +1 -1
  104. package/dist/gateway/static/root/assets/{phone-workspace-store-CpH233TG.js → phone-workspace-store-DfhWmYic.js} +1 -1
  105. package/dist/gateway/static/root/assets/{plugin-details-dialog-DIQH12Ki.js → plugin-details-dialog-J4PKpTud.js} +1 -1
  106. package/dist/gateway/static/root/assets/{preference-select-fields-DPXt3YyQ.js → preference-select-fields-C-PLFUS9.js} +1 -1
  107. package/dist/gateway/static/root/assets/{product-automation-feedback-BVkkAJkY.js → product-automation-feedback-DLsF8VBW.js} +1 -1
  108. package/dist/gateway/static/root/assets/{product-open-page-D-fwzOTB.js → product-open-page-BP-ssaP8.js} +1 -1
  109. package/dist/gateway/static/root/assets/{product-preview-content-DLnOxTnn.js → product-preview-content-BMI7ZuKU.js} +1 -1
  110. package/dist/gateway/static/root/assets/{product-preview-modal-AeEtUDZQ.js → product-preview-modal-DZ0zi6ZF.js} +2 -2
  111. package/dist/gateway/static/root/assets/{project-detail-page-B7L3Kvhc.js → project-detail-page-CS-NrYi5.js} +1 -1
  112. package/dist/gateway/static/root/assets/{project-understanding-tqZ0etEw.js → project-understanding-C9WWE-3t.js} +1 -1
  113. package/dist/gateway/static/root/assets/{projects-page-D65pw44g.js → projects-page-DVa38OsG.js} +1 -1
  114. package/dist/gateway/static/root/assets/{providers-api-DzeStdCu.js → providers-api-C1KpkGUT.js} +1 -1
  115. package/dist/gateway/static/root/assets/{recording-upload-Id3p5Vyv.js → recording-upload-T5ArHnPJ.js} +1 -1
  116. package/dist/gateway/static/root/assets/{registry-api-B3YqZBhQ.js → registry-api-Cs-R00dn.js} +1 -1
  117. package/dist/gateway/static/root/assets/{remote-access-hub-DxAInmWy.js → remote-access-hub-C6NBt2s-.js} +1 -1
  118. package/dist/gateway/static/root/assets/{resource-unavailable-DH-GGLSM.js → resource-unavailable-BuySLm9q.js} +1 -1
  119. package/dist/gateway/static/root/assets/{route-preload-C22MIvup.js → route-preload-CDMyXjLQ.js} +2 -2
  120. package/dist/gateway/static/root/assets/{runtime-tools-api-8mXDTzc2.js → runtime-tools-api-CvTCMobW.js} +1 -1
  121. package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-S2HxRVlT.js → runtime-tools-settings-panel-DlW9tAnO.js} +1 -1
  122. package/dist/gateway/static/root/assets/{service-recommendation-list-DFqBz8S6.js → service-recommendation-list-Biono7Ua.js} +1 -1
  123. package/dist/gateway/static/root/assets/{session-api-DZ2Ov33K.js → session-api-BNt6b3Xl.js} +1 -1
  124. package/dist/gateway/static/root/assets/{session-manager-DSaoWM1F.js → session-manager-CQNN8D0M.js} +1 -1
  125. package/dist/gateway/static/root/assets/{sessions-page-BpUbNplq.js → sessions-page-3LErqoR9.js} +1 -1
  126. package/dist/gateway/static/root/assets/settings-advanced-gate-SSCcDrIV.js +1 -0
  127. package/dist/gateway/static/root/assets/{settings-advanced-section-TJ8MAroB.js → settings-advanced-section-D4uJuQwW.js} +1 -1
  128. package/dist/gateway/static/root/assets/{settings-mode-store-xhm6JIs-.js → settings-mode-store-CnG8uLvP.js} +1 -1
  129. package/dist/gateway/static/root/assets/{settings-page-B_XKKvWr.js → settings-page-9BthXfuc.js} +1 -1
  130. package/dist/gateway/static/root/assets/{settings-page-header-BEDxq_lT.js → settings-page-header-BXdbhzia.js} +1 -1
  131. package/dist/gateway/static/root/assets/{settings-page-layout-BftgkTYo.js → settings-page-layout-BQvK_gmr.js} +1 -1
  132. package/dist/gateway/static/root/assets/{setup-interaction-page-BtihoIoz.js → setup-interaction-page-D1uhozUt.js} +1 -1
  133. package/dist/gateway/static/root/assets/{setup-status-panel-DehYof2V.js → setup-status-panel-C1o4-hF4.js} +1 -1
  134. package/dist/gateway/static/root/assets/{share-link-dialog-C-mhzvLF.js → share-link-dialog-QTEdYG4I.js} +1 -1
  135. package/dist/gateway/static/root/assets/{share-preview-page-Cnxfv66F.js → share-preview-page-Ba77bFgS.js} +1 -1
  136. package/dist/gateway/static/root/assets/{shares-api-D2HTaQZH.js → shares-api-DayDdoBR.js} +1 -1
  137. package/dist/gateway/static/root/assets/{shares-settings-BLcnCGon.js → shares-settings-67poMpxi.js} +1 -1
  138. package/dist/gateway/static/root/assets/{skill-api-DOISy5q8.js → skill-api-DR3vdsrS.js} +1 -1
  139. package/dist/gateway/static/root/assets/{skill-list-api-LoIlcCDf.js → skill-list-api-D6X3XyTd.js} +1 -1
  140. package/dist/gateway/static/root/assets/{skill-reload-api-qSwB_mAH.js → skill-reload-api-Wu0UkQ13.js} +1 -1
  141. package/dist/gateway/static/root/assets/{skills-page-CJXLVK0U.js → skills-page-FmjOxilb.js} +1 -1
  142. package/dist/gateway/static/root/assets/{system-settings-panel-BT6_yFco.js → system-settings-panel-BLeXSW3w.js} +1 -1
  143. package/dist/gateway/static/root/assets/{task-detail-page-1AFyRTia.js → task-detail-page-B5uwlFwb.js} +1 -1
  144. package/dist/gateway/static/root/assets/{task-result-evidence-CkwEM0In.js → task-result-evidence-m78K4eAp.js} +1 -1
  145. package/dist/gateway/static/root/assets/{terminal-panel-store-BP3dN3md.js → terminal-panel-store-CWpiIbPY.js} +1 -1
  146. package/dist/gateway/static/root/assets/{theme-store-BZ8YC33M.js → theme-store-B9upxkW-.js} +1 -1
  147. package/dist/gateway/static/root/assets/{tracing-settings-page-9YvEnES_.js → tracing-settings-page-CACPSXVV.js} +1 -1
  148. package/dist/gateway/static/root/assets/{tunnel-api-CnPOg1pg.js → tunnel-api-CCC7XSFJ.js} +1 -1
  149. package/dist/gateway/static/root/assets/{understanding-activity-store-3sOhoxX4.js → understanding-activity-store-D7WFQ-t7.js} +1 -1
  150. package/dist/gateway/static/root/assets/{understanding-refresh-store-BBXlbRLa.js → understanding-refresh-store-CvOFPfDi.js} +1 -1
  151. package/dist/gateway/static/root/assets/{usage-page-6LW4yLy1.js → usage-page-P9-7xf1p.js} +1 -1
  152. package/dist/gateway/static/root/assets/{use-autosave-CDy9yziL.js → use-autosave-BNNxl23c.js} +1 -1
  153. package/dist/gateway/static/root/assets/{use-composer-attachments-C4eSyX-C.js → use-composer-attachments-7uMSpyxm.js} +1 -1
  154. package/dist/gateway/static/root/assets/{use-file-preview-expanded-SFqd8k7K.js → use-file-preview-expanded-C-NCuwM3.js} +2 -2
  155. package/dist/gateway/static/root/assets/{use-personal-profile-sQzaa6Dy.js → use-personal-profile-1lm_wDMe.js} +1 -1
  156. package/dist/gateway/static/root/assets/{use-workspace-tree-DKPvcyw1.js → use-workspace-tree-HlkNpRDC.js} +1 -1
  157. package/dist/gateway/static/root/assets/{user-model-page-DYVp7nA6.js → user-model-page-B6XfYtEm.js} +1 -1
  158. package/dist/gateway/static/root/assets/{voice-api-key-field-BKXWXCit.js → voice-api-key-field-CRZS6XEF.js} +1 -1
  159. package/dist/gateway/static/root/assets/{voice-config-api-DNxzs-eF.js → voice-config-api-CrgRaCMk.js} +1 -1
  160. package/dist/gateway/static/root/assets/{voice-input-shortcut-events-3kcfHPrY.js → voice-input-shortcut-events-vjcw6SRC.js} +1 -1
  161. package/dist/gateway/static/root/assets/{voice-transcribe-api-CVVa_x99.js → voice-transcribe-api-CtUoGgGT.js} +1 -1
  162. package/dist/gateway/static/root/assets/{work-discovery-overlay-B4F3MACu.js → work-discovery-overlay-C9tI_qQv.js} +1 -1
  163. package/dist/gateway/static/root/assets/{work-discovery-page-BuKTCGSR.js → work-discovery-page-C-8kE4mx.js} +1 -1
  164. package/dist/gateway/static/root/assets/{working-directory-picker-modal-BiDK93J_.js → working-directory-picker-modal-B5fxn2wG.js} +1 -1
  165. package/dist/gateway/static/root/assets/{workspace-api-S2aJOX7w.js → workspace-api-DP2ozrRe.js} +2 -2
  166. package/dist/gateway/static/root/assets/workspace-editor-agent-store-Dw3xS3sE.js +1 -0
  167. package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-B9f3GN7l.js → workspace-file-preview-dialog-Cp86E6-h.js} +1 -1
  168. package/dist/gateway/static/root/assets/{workspace-open-location-menu-BNjipenH.js → workspace-open-location-menu-CWOgHMmR.js} +1 -1
  169. package/dist/gateway/static/root/assets/{xopc-cloud-account-card-Csye7zKU.js → xopc-cloud-account-card-CIaHnCGw.js} +1 -1
  170. package/dist/gateway/static/root/index.html +80 -80
  171. package/dist/package.js +1 -1
  172. package/dist/packages/browser-control-contract/src/remote.js +237 -0
  173. package/dist/packages/computer-control-contract/src/index.js +12 -2
  174. package/dist/packages/endpoint-tools-client/src/index.js +8 -0
  175. package/dist/packages/endpoint-tools-protocol/src/command.js +83 -0
  176. package/dist/packages/endpoint-tools-protocol/src/execution.js +102 -0
  177. package/dist/packages/endpoint-tools-protocol/src/index.js +61 -7
  178. package/dist/packages/endpoint-tools-protocol/src/operation-status.js +76 -0
  179. package/dist/packages/endpoint-tools-protocol/src/screen.js +28 -0
  180. package/dist/packages/endpoint-tools-protocol/src/terminal.js +173 -0
  181. package/dist/packages/endpoint-tools-protocol/src/workspace.js +143 -0
  182. package/dist/packages/gateway-contract/src/desktop-chat.js +29 -0
  183. package/dist/packages/gateway-contract/src/desktop-execution-stop.js +36 -0
  184. package/dist/packages/gateway-contract/src/desktop-host.js +87 -0
  185. package/dist/packages/gateway-contract/src/device-pairing.js +17 -4
  186. package/dist/packages/gateway-contract/src/gateway-scopes.js +6 -2
  187. package/dist/packages/gateway-contract/src/index.js +6 -0
  188. package/dist/packages/realtime-protocol/src/index.js +15 -2
  189. package/dist/src/agent/context/project-context.d.ts +1 -0
  190. package/dist/src/agent/context/project-context.js +9 -2
  191. package/dist/src/agent/embedded/run-turn.js +5 -2
  192. package/dist/src/agent/external-tools/endpoint-provider.js +76 -4
  193. package/dist/src/agent/memory/context-recovery.d.ts +3 -3
  194. package/dist/src/agent/memory/context-recovery.js +10 -3
  195. package/dist/src/agent/memory/repeated-read-projection.d.ts +9 -0
  196. package/dist/src/agent/memory/repeated-read-projection.js +78 -0
  197. package/dist/src/agent/sandbox/exec-policy.js +2 -0
  198. package/dist/src/agent/sandbox/types.d.ts +1 -0
  199. package/dist/src/agent/service/direct-turn-helpers.js +2 -1
  200. package/dist/src/agent/service/process-direct-streaming.js +4 -2
  201. package/dist/src/agent/source-context/browser-tab.js +1 -0
  202. package/dist/src/agent/source-context/device-environment.js +9 -3
  203. package/dist/src/agent/source-context/index.js +7 -3
  204. package/dist/src/agent/source-context/injector.d.ts +4 -0
  205. package/dist/src/agent/source-context/injector.js +23 -8
  206. package/dist/src/agent/source-context/source-context-projection.d.ts +8 -0
  207. package/dist/src/agent/source-context/source-context-projection.js +127 -0
  208. package/dist/src/agent/source-context/types.js +4 -1
  209. package/dist/src/agent/tools/exec-command.js +3 -2
  210. package/dist/src/agent/tools/factory.d.ts +7 -1
  211. package/dist/src/agent/tools/factory.js +103 -14
  212. package/dist/src/automations/api/dispatcher.d.ts +6 -0
  213. package/dist/src/automations/api/dispatcher.js +17 -0
  214. package/dist/src/automations/api/routes.js +2 -6
  215. package/dist/src/browser/drivers/browser-driver.d.ts +1 -1
  216. package/dist/src/browser/remote/device-driver.d.ts +26 -0
  217. package/dist/src/browser/remote/device-driver.js +247 -0
  218. package/dist/src/browser/remote/device-runtime.d.ts +9 -0
  219. package/dist/src/browser/remote/device-runtime.js +27 -0
  220. package/dist/src/browser/remote/device-target.d.ts +4 -0
  221. package/dist/src/browser/remote/device-target.js +20 -0
  222. package/dist/src/browser/remote/endpoint-transport.d.ts +4 -0
  223. package/dist/src/browser/remote/endpoint-transport.js +48 -0
  224. package/dist/src/browser/runtime/browser-runtime.d.ts +1 -0
  225. package/dist/src/browser/runtime/browser-runtime.js +1 -0
  226. package/dist/src/browser/url-policy.js +19 -6
  227. package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
  228. package/dist/src/cli/commands/platform.js +2 -2
  229. package/dist/src/computer/diagnostics.d.ts +3 -3
  230. package/dist/src/computer/endpoint-transport.d.ts +4 -0
  231. package/dist/src/computer/endpoint-transport.js +54 -0
  232. package/dist/src/computer/evaluation.d.ts +2 -2
  233. package/dist/src/computer/program-runtime.js +14 -2
  234. package/dist/src/computer/runtime.d.ts +1 -0
  235. package/dist/src/computer/runtime.js +31 -11
  236. package/dist/src/computer/task-state.js +3 -1
  237. package/dist/src/endpoint-tools/capability-catalog.js +1 -1
  238. package/dist/src/endpoint-tools/desktop-authority-response.d.ts +19 -0
  239. package/dist/src/endpoint-tools/desktop-authority-response.js +38 -0
  240. package/dist/src/endpoint-tools/desktop-device-frame.d.ts +18 -0
  241. package/dist/src/endpoint-tools/desktop-device-frame.js +94 -0
  242. package/dist/src/endpoint-tools/desktop-execution.d.ts +14 -0
  243. package/dist/src/endpoint-tools/desktop-execution.js +28 -0
  244. package/dist/src/endpoint-tools/desktop-frame.d.ts +12 -0
  245. package/dist/src/endpoint-tools/desktop-frame.js +35 -0
  246. package/dist/src/endpoint-tools/desktop-observation.d.ts +4 -0
  247. package/dist/src/endpoint-tools/desktop-observation.js +20 -0
  248. package/dist/src/endpoint-tools/invocation-service.d.ts +35 -2
  249. package/dist/src/endpoint-tools/invocation-service.js +138 -14
  250. package/dist/src/endpoint-tools/policy.js +27 -2
  251. package/dist/src/endpoint-tools/registry.d.ts +5 -3
  252. package/dist/src/endpoint-tools/registry.js +10 -3
  253. package/dist/src/endpoint-tools/runtime.d.ts +4 -2
  254. package/dist/src/endpoint-tools/runtime.js +9 -3
  255. package/dist/src/endpoint-tools/terminal-broker.d.ts +90 -0
  256. package/dist/src/endpoint-tools/terminal-broker.js +320 -0
  257. package/dist/src/gateway/hono/app.js +7 -4
  258. package/dist/src/gateway/hono/middleware/auth.js +11 -1
  259. package/dist/src/gateway/hono/routes/agent-stream.js +2 -1
  260. package/dist/src/gateway/hono/routes/desktop-chat.d.ts +3 -0
  261. package/dist/src/gateway/hono/routes/desktop-chat.js +30 -0
  262. package/dist/src/gateway/hono/routes/desktop-execution-stop.d.ts +6 -0
  263. package/dist/src/gateway/hono/routes/desktop-execution-stop.js +52 -0
  264. package/dist/src/gateway/hono/routes/desktop-host.d.ts +3 -0
  265. package/dist/src/gateway/hono/routes/desktop-host.js +485 -0
  266. package/dist/src/gateway/hono/routes/devices.d.ts +3 -1
  267. package/dist/src/gateway/hono/routes/devices.js +7 -2
  268. package/dist/src/gateway/hono/routes/endpoint-tools.js +16 -4
  269. package/dist/src/gateway/hono/routes/lazy-bundles.js +21 -0
  270. package/dist/src/gateway/hono/routes/models.js +5 -2
  271. package/dist/src/gateway/hono/routes/session-input-handler.js +2 -1
  272. package/dist/src/gateway/security/gateway-scopes.js +10 -0
  273. package/dist/src/gateway/security/phone-access.js +4 -1
  274. package/dist/src/gateway/service/session-input-coordinator.js +5 -3
  275. package/dist/src/gateway/service.js +5 -4
  276. package/dist/src/gateway/session-context-summary.js +2 -1
  277. package/dist/src/home-intelligence/host.js +2 -2
  278. package/dist/src/providers/presentation.js +1 -1
  279. package/dist/src/realtime/runtime.js +86 -7
  280. package/dist/src/session/session-context-for-llm.js +3 -1
  281. package/dist/src/storage/sqlite/desktop-execution-repository.d.ts +44 -0
  282. package/dist/src/storage/sqlite/desktop-execution-repository.js +76 -0
  283. package/dist/src/storage/sqlite/desktop-execution-state.d.ts +13 -0
  284. package/dist/src/storage/sqlite/desktop-execution-state.js +22 -0
  285. package/dist/src/storage/sqlite/desktop-execution-stop-repository.d.ts +19 -0
  286. package/dist/src/storage/sqlite/desktop-execution-stop-repository.js +66 -0
  287. package/dist/src/storage/sqlite/desktop-operation-repository.d.ts +79 -0
  288. package/dist/src/storage/sqlite/desktop-operation-repository.js +143 -0
  289. package/dist/src/storage/sqlite/device-access-repository.d.ts +12 -0
  290. package/dist/src/storage/sqlite/device-access-repository.js +54 -3
  291. package/dist/src/storage/sqlite/device-pairing-approval.js +4 -4
  292. package/dist/src/storage/sqlite/device-pairing-repository.d.ts +1 -1
  293. package/dist/src/storage/sqlite/endpoint-principal-repository.d.ts +2 -0
  294. package/dist/src/storage/sqlite/endpoint-principal-repository.js +5 -1
  295. package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.d.ts +2 -0
  296. package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.js +8 -3
  297. package/dist/src/storage/sqlite/schema.d.ts +2 -2
  298. package/dist/src/storage/sqlite/schema.js +7 -7
  299. package/dist/src/storage/sqlite/schema.sql +48 -3
  300. package/dist/src/storage/sqlite/upgrades/263_desktop_device_credentials.sql +39 -0
  301. package/dist/src/storage/sqlite/upgrades/264_desktop_observation_grants.sql +5 -0
  302. package/dist/src/storage/sqlite/upgrades/265_desktop_screen_scope.sql +3 -0
  303. package/dist/src/storage/sqlite/upgrades/266_endpoint_operation_audit.sql +3 -0
  304. package/dist/src/storage/sqlite/upgrades/267_desktop_reliable_execution.sql +15 -0
  305. package/dist/src/storage/sqlite/upgrades/268_desktop_operation_reviews.sql +9 -0
  306. package/dist/src/storage/sqlite/upgrades/269_desktop_execution_stops.sql +10 -0
  307. package/dist/src/tasks/task-handoff.js +2 -1
  308. package/package.json +6 -2
  309. package/dist/gateway/static/root/assets/gateway-realtime-SunJUMP3.js +0 -1
  310. package/dist/gateway/static/root/assets/gateway-realtime-store-BywiC4CK.js +0 -1
  311. package/dist/gateway/static/root/assets/management-settings-gwDIT7mY.js +0 -1
  312. package/dist/gateway/static/root/assets/messages-C3xqMM9W.js +0 -3
  313. package/dist/gateway/static/root/assets/note-image-lightbox-BDZGHYaZ.js +0 -1
  314. package/dist/gateway/static/root/assets/page-header-store-BVj8nDdi.js +0 -1
  315. package/dist/gateway/static/root/assets/settings-advanced-gate-CGgt1myW.js +0 -1
  316. package/dist/gateway/static/root/assets/workspace-editor-agent-store-oZKoWMdV.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 === "chrome" || !principal.accessSessionId || !isDeviceAccessSessionActive(device.id, principal.accessSessionId)) throw new PhoneError("PHONE_ACCESS_REVOKED", "Phone access is unavailable for this device", 403);
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?.length || !canSteerContexts(this.snapshot(conversationId), row.origin, row.contextSnapshots))) throw new SessionInputControlConflict("This input cannot steer the active reply");
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") {
@@ -103,10 +103,6 @@ import { DiscussionSealer } from "../discussions/sealer.js";
103
103
  import "../discussions/index.js";
104
104
  import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
105
105
  import "../endpoint-tools/index.js";
106
- import { HomeCapabilityPreflightService } from "../home-intelligence/capability-preflight.js";
107
- import { HomeAdviceGenerator } from "../home-intelligence/generator.js";
108
- import { HomeIntelligenceHost } from "../home-intelligence/host.js";
109
- import { HomeSnapshotBuilder } from "../home-intelligence/snapshot.js";
110
106
  import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
111
107
  import { prepareAutomationAgentSession } from "./automation-agent-session.js";
112
108
  import { deliverAutomationCompletion } from "./automation-completion-delivery.js";
@@ -170,6 +166,10 @@ import { TaskMainUpdateDecisionService } from "../tasks/task-main-update-decisio
170
166
  import { selectTaskMainUpdateAttempt, submitAndConfirmTaskMainUpdate } from "../tasks/task-main-update-input.js";
171
167
  import { checkAppContextAccess, prepareAppContext } from "./service/app-context-access.js";
172
168
  import { applyAutomaticVoiceLanguage, inferProductLanguageFromEnvironment, initializeVoiceDefaults } from "../voice/language-profile.js";
169
+ import { HomeAdviceGenerator } from "../home-intelligence/generator.js";
170
+ import { HomeIntelligenceHost } from "../home-intelligence/host.js";
171
+ import { HomeSnapshotBuilder } from "../home-intelligence/snapshot.js";
172
+ import { HomeCapabilityPreflightService } from "../home-intelligence/capability-preflight.js";
173
173
  import crypto from "node:crypto";
174
174
  //#region src/gateway/service.ts
175
175
  init_session_repository();
@@ -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();
@@ -1,10 +1,10 @@
1
1
  import { createLogger } from "../utils/logger/index.js";
2
2
  import { init_logger } from "../utils/logger.js";
3
+ import { HomeAdviceBudgetExceededError, isHomeProseLocalized } from "./generator.js";
3
4
  import { homePatternKey } from "./strategy.js";
5
+ import { HomeAdvicePolicy } from "./policy.js";
4
6
  import { HomeIntelligenceRepository } from "./repository.js";
5
7
  import { HomeOpportunityApplicationService } from "./application-service.js";
6
- import { HomeAdvicePolicy } from "./policy.js";
7
- import { HomeAdviceBudgetExceededError, isHomeProseLocalized } from "./generator.js";
8
8
  import { buildHomeOpportunityNotification } from "./notification.js";
9
9
  import { createHash } from "node:crypto";
10
10
  //#region src/home-intelligence/host.ts
@@ -268,7 +268,7 @@ function sortModelsForPicker(models) {
268
268
  });
269
269
  }
270
270
  function getRecommendedModelsForProvider(provider, limit = 4) {
271
- const fromRegistry = sortModelsForPicker(getModelsByProvider(provider)).filter((model) => !isDedicatedPhoneModel(model) && !isDedicatedComputerModel(model) && isRecommendedModel(provider, model.id)).slice(0, limit).map(modelToCatalogView);
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
- writer.enqueue(serverMessage("endpoint.message", JSON.parse(data)), "critical");
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
- this.endpointTools.handleMessage(endpointId, connectionId, message.payload);
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 };