@xopcai/xopc 0.0.451 → 0.0.455
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/.pnpm/node-pty@1.1.0/node_modules/node-pty/lib/eventEmitter2.js +40 -0
- package/dist/.pnpm/node-pty@1.1.0/node_modules/node-pty/lib/index.js +56 -0
- package/dist/.pnpm/node-pty@1.1.0/node_modules/node-pty/lib/shared/conout.js +16 -0
- package/dist/.pnpm/node-pty@1.1.0/node_modules/node-pty/lib/terminal.js +190 -0
- package/dist/.pnpm/node-pty@1.1.0/node_modules/node-pty/lib/unixTerminal.js +287 -0
- package/dist/.pnpm/node-pty@1.1.0/node_modules/node-pty/lib/utils.js +49 -0
- package/dist/.pnpm/node-pty@1.1.0/node_modules/node-pty/lib/windowsConoutConnection.js +190 -0
- package/dist/.pnpm/node-pty@1.1.0/node_modules/node-pty/lib/windowsPtyAgent.js +265 -0
- package/dist/.pnpm/node-pty@1.1.0/node_modules/node-pty/lib/windowsTerminal.js +178 -0
- package/dist/_virtual/_rolldown/runtime.js +10 -2
- 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-OMq1GnqB.js → activity-store-DYwR1u3f.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CIoE-FJR.js → agent-avatar-dicebear-CsRBprL-.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-display-kPb6idGG.js → agent-avatar-display-DqFYHXCS.js} +2 -2
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-vKUDGEU6.js → agent-defaults-settings-panel-DOAJrMLe.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-x7guoCvz.js → agent-plugin-dialog-vqlN3ORH.js} +1 -1
- package/dist/gateway/static/root/assets/{agents-BbwFcl87.js → agents-BgHlOVRV.js} +3 -3
- package/dist/gateway/static/root/assets/{agents-admin-api-tXB8Aj5K.js → agents-admin-api-CKscfdvA.js} +1 -1
- package/dist/gateway/static/root/assets/api-CHM2c_Ah.js +1 -0
- package/dist/gateway/static/root/assets/{api-ixudT_21.js → api-DPNeNCmR.js} +1 -1
- package/dist/gateway/static/root/assets/{app-link-CdD448kS.js → app-link-DImAfVs5.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-nuDfyfZ5.js → app-management-settings-panel-Bhz6bj1C.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-D4oON26V.js → appearance-settings-BX32aogA.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-BM1BfXzo.js → apps-page-0Yo3jBsQ.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-mKjfC6Sk.js → archive-plugin-Bha8obMe.js} +1 -1
- package/dist/gateway/static/root/assets/arrow-up-right-T72JbQ1Q.js +1 -0
- package/dist/gateway/static/root/assets/{automation-api-C9pjryrT.js → automation-api-mn8ihWJ_.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-result-state-uvg7Bi2x.js → automation-result-state-COzakzak.js} +1 -1
- package/dist/gateway/static/root/assets/automation-run-list-BhtaMpTb.js +1 -0
- package/dist/gateway/static/root/assets/{automation-task-card-CXGC8afU.js → automation-task-card-BY_k6iWp.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CwQg9dfM.js → automations-page-Dt_Z1UTT.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-workspace-DhLgFY2T.js → automations-workspace-BhHgruhH.js} +2 -2
- package/dist/gateway/static/root/assets/{binary-plugins-BNPDM14i.js → binary-plugins-DUbrJFLU.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-De9UqmMT.js → block-editor-DW--pXAc.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-B0VB5umC.js → browser-settings-page-CDh6nxs9.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-Cp-rmFMM.js → capabilities-DKbXv8Ck.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-BtJB4u5C.js → capabilities-kG175Q-7.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-D1wQ2sPI.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BW5jQz5R.js +8 -0
- package/dist/gateway/static/root/assets/capability-navigation-QtHJxxW2.js +1 -0
- package/dist/gateway/static/root/assets/{channels-ZJORx-he.js → channels-BzZp42yO.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-agents-api-CtuEaDG8.js → chat-agents-api-UOdNWZ0_.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-chart-block-ShPQBlNE.js → chat-chart-block-NSy-B0NS.js} +1 -1
- package/dist/gateway/static/root/assets/chat-page-dY6aCCRx.js +71 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CvDRfHAZ.js → chat-terminal-dock-CAaHWS7F.js} +1 -1
- package/dist/gateway/static/root/assets/{command-palette-api-NJTvEF2b.js → command-palette-api-Dkn9bbYd.js} +1 -1
- package/dist/gateway/static/root/assets/composer-model-config-control-BrK8-SNz.js +1 -0
- package/dist/gateway/static/root/assets/{composer-notifications-BkezOy9Q.js → composer-notifications-B-kL3qAA.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-payload-handoff-CEjJusbJ.js → composer-payload-handoff-DBE1mvOS.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-DG8bcw_s.js → computer-settings-page-C9KdEecx.js} +1 -1
- package/dist/gateway/static/root/assets/{confirm-dialog-D7dQJytv.js → confirm-dialog-DrA5mTQp.js} +1 -1
- package/dist/gateway/static/root/assets/connected-providers-grid-D_8v6Qex.js +1 -0
- package/dist/gateway/static/root/assets/{connection-usage-guide-f55PDAbb.js → connection-usage-guide-CiVpcbds.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-Ca09FIBW.js → connector-service-page-B919cKSm.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-dai-YAdK.js → connectors-api-CgsSm-Av.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-CEpfDCLA.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-C70ICT7u.js → date-picker-dx284jQI.js} +1 -1
- package/dist/gateway/static/root/assets/{date-time-picker-Czj5fnsJ.js → date-time-picker-Dj-bhLNP.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Dq3OLpPg.js → desktop-pet-DlTuGzZ2.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-narrative-B7I1II0Z.js → desktop-pet-narrative-cBFIPXzR.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-q4mec6zt.js → desktop-pet-settings-CsmrvoxU.js} +1 -1
- package/dist/gateway/static/root/assets/{dev-view-store-lXnKsRew.js → dev-view-store-BOxbj1ie.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-CbUX0iit.js → device-pairing-wizard-CAqFIFRC.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BRnwhemd.js → directory-picker-path-field-BxEw5OrT.js} +1 -1
- package/dist/gateway/static/root/assets/{discussion-annotation-sync-BnK6Ua7v.js → discussion-annotation-sync-CyntTwIa.js} +1 -1
- package/dist/gateway/static/root/assets/dist-CY7CS_D3.js +1 -0
- package/dist/gateway/static/root/assets/extension-authoritative-grants-C0ReZguU.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-Bp2BrJbB.js → extension-debug-page-Cd3HMUbi.js} +1 -1
- package/dist/gateway/static/root/assets/extension-iframe-host-DiIqM2JO.js +1 -0
- package/dist/gateway/static/root/assets/{extension-marketplace-api-tk93vJL_.js → extension-marketplace-api-CK5CMKTs.js} +1 -1
- package/dist/gateway/static/root/assets/extension-message-router-Dn8JzOdR.js +8 -0
- package/dist/gateway/static/root/assets/extension-page-CLZtAtqm.js +1 -0
- package/dist/gateway/static/root/assets/extension-provider-CbVokTvd.js +1 -0
- package/dist/gateway/static/root/assets/{extension-settings-page-BGcZIeHP.js → extension-settings-page-BM79cwUy.js} +1 -1
- package/dist/gateway/static/root/assets/{file-preview-surface-BK2_4mWy.js → file-preview-surface-z7_HV0WN.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-DsXilOaJ.js → gateway-config-swr-OGhON-s6.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-DopPmAMl.js → gateway-realtime-B9u4uSXW.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-xB7Bq4Zs.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-restart-eozrXTm7.js → gateway-restart-DKAweWmg.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DddUli-p.js → gateway-settings-Dc7qUbG-.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DMQI0ATo.js → gateway-startup-retry-BaaoKBoB.js} +1 -1
- package/dist/gateway/static/root/assets/{global-defaults-api-D7hk1zTj.js → global-defaults-api-BIr3ApRj.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-C8oVgxQg.js → home-page-i_PIrDCU.js} +2 -2
- package/dist/gateway/static/root/assets/{image-generation-api-BCbvDDH_.js → image-generation-api-C7D2IetZ.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-B9LF_2fO.js → imports-page-BjEdZJxZ.js} +1 -1
- package/dist/gateway/static/root/assets/index-Bj5exyow.css +1 -0
- package/dist/gateway/static/root/assets/index-CZI3VGGW.js +11 -0
- package/dist/gateway/static/root/assets/{install-connector-dialog-DT32t-66.js → install-connector-dialog-BsiyYQhx.js} +1 -1
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DDwoBK8g.js → keyboard-shortcuts-settings-CIthQ1lp.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CSCIHvZV.js +1 -0
- package/dist/gateway/static/root/assets/local-apps-DeqzkJiF.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-qzxr3c8Y.js → local-apps-page-EntiM0tz.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-BU3FXj_X.js → local-session-drafts-XurtjR58.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DTUQ0JiK.js → locale-store-cg9cm2EL.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-rmS9VSem.js +2 -0
- package/dist/gateway/static/root/assets/{management-api-C6mCD0mZ.js → management-api-B6jVuJ6W.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-C4BKD-_b.js → management-settings-DdI9gs51.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-DHjn1-ML.js → markdown-view-D1zBWkfB.js} +1 -1
- package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-ClgMvru5.js → mcp-conversation-setup-page-Bn49Ph1n.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-8E2KZQym.js → media-plugins-Cd6hAGDp.js} +1 -1
- package/dist/gateway/static/root/assets/messages-eQ2CYlpG.js +3 -0
- package/dist/gateway/static/root/assets/{model-selector-CJY9LRsl.js → model-selector-CL6WT-jw.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-cache-BTs8jhgq.js → models-hub-cache-s0FMNhq9.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-DiCfpcZd.js → note-detail-panel-anM38aV6.js} +3 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-DfK2KSgu.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-BnaeXy22.js → notes-api-CR75RHd0.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-B_vTBmyx.js → notes-page-BsZmT7Zw.js} +2 -2
- package/dist/gateway/static/root/assets/{oauth-api-BZ67vxsq.js → oauth-api-CvPnQTlH.js} +1 -1
- package/dist/gateway/static/root/assets/oauth-provider-connect-Dk1NeeqD.js +1 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-TpjRHhUt.js → page-context-capture-button-BPtX67hZ.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-draft-BbUpxlgV.js → page-context-draft-Ckb8baxj.js} +1 -1
- package/dist/gateway/static/root/assets/page-header-store-DU4NnGap.js +1 -0
- package/dist/gateway/static/root/assets/personal-avatar-CZSnrSfc.js +1 -0
- package/dist/gateway/static/root/assets/personal-page-BSCNuRMT.js +1 -0
- package/dist/gateway/static/root/assets/personal-profile-settings-DJRDcK2c.js +1 -0
- package/dist/gateway/static/root/assets/personal-settings-panel-C6p25Noq.js +1 -0
- package/dist/gateway/static/root/assets/phone-DdhTnt6X.js +1 -0
- package/dist/gateway/static/root/assets/{phone-dependencies-card-ChRrViSc.js → phone-dependencies-card-DKkFFpqi.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-connection-DmswEWqx.js → phone-model-connection-CRRHq4PQ.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-picker-CvuOhQpk.js → phone-model-picker-CN_I0-46.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-settings-page-2hZ68I47.js → phone-settings-page-CkdSOA7D.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-workspace-store-BMvxfZ3g.js → phone-workspace-store-CC61pIuJ.js} +1 -1
- package/dist/gateway/static/root/assets/{plugin-details-dialog-qvdi41L2.js → plugin-details-dialog-Bqz4jT53.js} +1 -1
- package/dist/gateway/static/root/assets/{preference-select-fields-RDatqlhG.js → preference-select-fields-DHeNbAvn.js} +1 -1
- package/dist/gateway/static/root/assets/{product-automation-feedback-Bj9ZsasT.js → product-automation-feedback-BN2HTA9T.js} +1 -1
- package/dist/gateway/static/root/assets/{product-delivery-DRyD9_Xq.js → product-delivery-BFfqdKLe.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CzXmn2MX.js → product-open-page-B-j4gpLD.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-Beg0t4GW.js → product-preview-content-EqrTk7kU.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-modal-5ulFfVzf.js → product-preview-modal-aurFBFq4.js} +2 -2
- package/dist/gateway/static/root/assets/{project-detail-page-8bnYqXLJ.js → project-detail-page-ibZZ_w51.js} +2 -2
- package/dist/gateway/static/root/assets/{project-understanding-CXf7wjwt.js → project-understanding-HNK9lFVy.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-CyA6fCPg.js → projects-page-CugSyKl5.js} +1 -1
- package/dist/gateway/static/root/assets/providers-api-DUntOOqr.js +1 -0
- package/dist/gateway/static/root/assets/{recording-upload-BZvpuPZT.js → recording-upload-DIwP541B.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-C_8-f85U.js → registry-api-BTd_OgbD.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-Daxdjqs9.js → remote-access-hub-f5mIfsBF.js} +1 -1
- package/dist/gateway/static/root/assets/{resource-unavailable-khPb8zb8.js → resource-unavailable-DtQ2rfu_.js} +1 -1
- package/dist/gateway/static/root/assets/route-preload-anuckzRl.js +2 -0
- package/dist/gateway/static/root/assets/runtime-health-zDkHcOZO.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-api-2YumRxOJ.js → runtime-tools-api-C1iI8EPo.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DH00p-rI.js → runtime-tools-settings-panel-0tdI1z0g.js} +1 -1
- package/dist/gateway/static/root/assets/{service-recommendation-list-wXf_ZlHq.js → service-recommendation-list-DSIe-NRe.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-Dt7vRa-E.js → session-api-CQlEq0MB.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-C7RfUfqI.js +25 -0
- package/dist/gateway/static/root/assets/{sessions-page-CCcpMHIH.js → sessions-page-DdS8U0RV.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DnfH22f_.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-section-DRlQdj_w.js → settings-advanced-section-C6dPu5i1.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-mode-store-BE6t--iO.js → settings-mode-store-BSiiowQa.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-_F2d9-GZ.js → settings-page-DAc5n-mM.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-DG3MQwSF.js → settings-page-header-BSMu5Zq3.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-SuMAUhMb.js → settings-page-layout-B_vMffB1.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-interaction-page-DyDiHKjZ.js → setup-interaction-page-DKXfFdNt.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-CPNFWhrr.js → setup-status-panel-BbAZ9w77.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-wu-minYF.js → share-link-dialog-ztX1WPXG.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-BqbfuQBU.js → share-preview-page-Ds2Ydfg6.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-DwsEzRc6.js → shares-api-CSZqeNL4.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-BxutiB6Y.js → shares-settings-CX3TNAmI.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-C7wPB73H.js → skill-api-CGzAQ-MX.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-list-api-C4AjzhlY.js → skill-list-api-DfUsku-x.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-CqfS9zlG.js → skill-reload-api-Y9qSMnBd.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-8VYadExR.js → skills-page-DnMN50Ot.js} +1 -1
- package/dist/gateway/static/root/assets/sliding-segmented-CgQ3BFdb.js +1 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-BV4GHnns.js → system-settings-panel-DWNkQmme.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-C9IyuxdS.js → task-detail-page-BJok6V1K.js} +3 -3
- package/dist/gateway/static/root/assets/{task-input-card-NtzzVc0e.js → task-input-card-lCMSy6YY.js} +1 -1
- package/dist/gateway/static/root/assets/{terminal-panel-store-DWdJOGMn.js → terminal-panel-store-D8eZPvql.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-FNf-kdMR.js → theme-store-GZQ3pTgy.js} +1 -1
- package/dist/gateway/static/root/assets/tool-friendly-title-DC8_9-Lo.js +2 -0
- package/dist/gateway/static/root/assets/{tracing-settings-page-BRPJuRpc.js → tracing-settings-page-DM3-7Hlw.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-B7NHNrQJ.js → tunnel-api-DOGAIXRR.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-activity-store-bgCeO8bb.js → understanding-activity-store-CuPfe0eQ.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-refresh-store-CEhWIvsQ.js → understanding-refresh-store-Ihz2p9Vg.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-35YfpfVW.js → usage-page-BA9Yrvqu.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-D8Qtt_Tn.js → use-autosave-CO0IPCVg.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-H-tD4Db6.js → use-composer-attachments-CLIrD0mm.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-P-0xmST2.js → use-file-preview-expanded-dhNMHf5b.js} +3 -3
- package/dist/gateway/static/root/assets/{use-personal-profile-Bk2rGWSy.js → use-personal-profile-CVqDWBDS.js} +1 -1
- package/dist/gateway/static/root/assets/use-realtime-voice-DDVVlX1R.js +1 -0
- package/dist/gateway/static/root/assets/{use-workspace-tree-D0_812KH.js → use-workspace-tree-CZej8mhf.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-BxHnOljT.js → user-model-page-1eYattnk.js} +1 -1
- package/dist/gateway/static/root/assets/voice-CDlC6XMH.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BL56KGeq.js → voice-api-key-field-DpwUDAvu.js} +1 -1
- package/dist/gateway/static/root/assets/voice-call-context-BM2A4bLz.js +1 -0
- package/dist/gateway/static/root/assets/voice-config-api-GIuXoHXw.js +1 -0
- package/dist/gateway/static/root/assets/{voice-input-shortcut-events-BK-IvchL.js → voice-input-shortcut-events-Cc30ZcFy.js} +1 -1
- package/dist/gateway/static/root/assets/voice-settings-DA3m5MT0.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DDXae8Yc.js → work-discovery-overlay-yGUkk1NV.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-CxN0abrd.js → work-discovery-page-RN6iuY-0.js} +1 -1
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-D3BUBFa0.js → working-directory-picker-modal-CeXl9w6z.js} +1 -1
- package/dist/gateway/static/root/assets/workspace-api-B1Uirhxf.js +2 -0
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-Nos5ebMv.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-BKmtih6_.js → workspace-file-preview-dialog-D0h2yJ3v.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-BdfKT4O4.js → workspace-open-location-menu-DWGNOIE2.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-BS_lsURY.js → xopc-cloud-account-card-x-XT4bKF.js} +1 -1
- package/dist/gateway/static/root/index.html +104 -100
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/extension-capabilities.js +91 -4
- package/dist/packages/gateway-contract/src/index.js +3 -1
- package/dist/packages/gateway-contract/src/local-app-delegation.js +25 -0
- package/dist/packages/gateway-contract/src/local-apps.js +35 -4
- package/dist/packages/realtime-protocol/src/voice.js +5 -0
- package/dist/src/agent/agent-instance-gateway.d.ts +2 -0
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +12 -3
- package/dist/src/agent/background-review/prompts.js +2 -0
- package/dist/src/agent/background-review/run-background-review.js +13 -7
- package/dist/src/agent/child-agent-factory.js +24 -1
- package/dist/src/agent/commands/command-registry.d.ts +10 -0
- package/dist/src/agent/commands/command-registry.js +37 -16
- package/dist/src/agent/commands/command-transport.d.ts +19 -0
- package/dist/src/agent/commands/command-transport.js +92 -0
- package/dist/src/agent/context/execution-context.js +1 -1
- package/dist/src/agent/context/project-context.js +1 -1
- package/dist/src/agent/embedded/execution-tool-policy.d.ts +1 -0
- package/dist/src/agent/embedded/execution-tool-policy.js +17 -6
- package/dist/src/agent/embedded/index.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +66 -9
- package/dist/src/agent/embedded/run-turn.js +109 -15
- package/dist/src/agent/embedded/runs.d.ts +3 -0
- package/dist/src/agent/embedded/runs.js +21 -1
- package/dist/src/agent/embedded/session-runner.js +2 -2
- package/dist/src/agent/embedded/types.d.ts +2 -0
- package/dist/src/agent/external-tools/endpoint-provider.js +1 -1
- package/dist/src/agent/inbound/attachment-pipeline.js +1 -1
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +1 -0
- package/dist/src/agent/inbound/turn-dispatcher.js +1 -0
- package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
- package/dist/src/agent/orchestration/child-run-monitor.d.ts +35 -0
- package/dist/src/agent/orchestration/child-run-monitor.js +104 -0
- package/dist/src/agent/orchestration/child-run-resume.d.ts +3 -0
- package/dist/src/agent/orchestration/child-run-resume.js +67 -0
- package/dist/src/agent/prompt/system-prompt.js +7 -6
- package/dist/src/agent/prompt/types.d.ts +2 -1
- package/dist/src/agent/prompt/voice-history.d.ts +9 -0
- package/dist/src/agent/prompt/voice-history.js +35 -0
- package/dist/src/agent/prompt/voice-presentation.d.ts +1 -1
- package/dist/src/agent/prompt/voice-presentation.js +1 -0
- package/dist/src/agent/sandbox/native-command.d.ts +15 -0
- package/dist/src/agent/sandbox/native-command.js +65 -0
- package/dist/src/agent/service/btw-query.d.ts +1 -0
- package/dist/src/agent/service/btw-query.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +2 -2
- package/dist/src/agent/service/process-direct-streaming.js +2 -2
- package/dist/src/agent/service.js +3 -3
- package/dist/src/agent/session/interaction-policy.d.ts +21 -0
- package/dist/src/agent/session/interaction-policy.js +58 -0
- package/dist/src/agent/session/session-inspector.js +3 -2
- package/dist/src/agent/tasks/task-judge-service.js +1 -1
- package/dist/src/agent/tools/create-share-tool.js +1 -1
- package/dist/src/agent/tools/exec-command.js +5 -0
- package/dist/src/agent/tools/factory.js +2 -2
- package/dist/src/agent/tools/image-generate-tool.js +5 -1
- package/dist/src/agent/tools/index.js +1 -1
- package/dist/src/agent/tools/list-dir.js +1 -1
- package/dist/src/agent/tools/managed-job-tool.js +16 -1
- package/dist/src/agent/tools/personal-read-tool.js +1 -1
- package/dist/src/agent/tools/personal-request-result-tool.js +1 -1
- package/dist/src/agent/tools/personal-task-tool.js +3 -1
- package/dist/src/agent/tools/publish-artifacts.js +1 -1
- package/dist/src/agent/tools/read.js +1 -1
- package/dist/src/agent/tools/send-media.js +1 -1
- package/dist/src/agent/tools/task-collaboration-tool.js +1 -1
- package/dist/src/agent/tools/task-evidence.js +6 -15
- package/dist/src/agent/tools/task-result-tool.js +1 -1
- package/dist/src/agent/tools/user-context-tool.js +1 -1
- package/dist/src/agent/tools/write.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.js +9 -8
- package/dist/src/agent-config/schema.d.ts +15 -0
- package/dist/src/automations/capabilities/drafts.js +5 -1
- package/dist/src/automations/capabilities/read.js +58 -8
- package/dist/src/automations/capabilities/write.js +53 -0
- package/dist/src/automations/delivery/delivery-router.js +3 -1
- package/dist/src/automations/run-changes.d.ts +2 -0
- package/dist/src/automations/run-changes.js +18 -0
- package/dist/src/automations/service/automation-service.d.ts +2 -9
- package/dist/src/automations/service/automation-service.js +3 -2
- package/dist/src/automations/storage/automation-run-repository.d.ts +5 -0
- package/dist/src/automations/storage/automation-run-repository.js +15 -1
- package/dist/src/capabilities/runtime/dispatcher.d.ts +12 -0
- package/dist/src/capabilities/runtime/dispatcher.js +22 -6
- package/dist/src/capabilities/runtime/product.d.ts +2 -0
- package/dist/src/capabilities/runtime/product.js +28 -6
- package/dist/src/channels/attachments/voice-stt-webchat.js +1 -1
- package/dist/src/chat-commands/types.d.ts +2 -0
- package/dist/src/cli/commands/tui-runner.d.ts +1 -1
- package/dist/src/cli/commands/tui-runner.js +1 -0
- package/dist/src/cli/commands/tui.js +1 -1
- package/dist/src/computer/evaluation-comparison.d.ts +4 -0
- package/dist/src/computer/evaluation-comparison.js +16 -1
- package/dist/src/computer/keyboard.js +1 -1
- package/dist/src/computer/model-adapter.js +18 -14
- package/dist/src/config/schema.d.ts +37 -3
- package/dist/src/config/schema.js +23 -5
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/hono/lib/safe-voice-config.js +4 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +204 -12
- package/dist/src/gateway/hono/routes/lazy-bundles.js +18 -2
- package/dist/src/gateway/hono/routes/local-app-capabilities.js +27 -6
- package/dist/src/gateway/hono/routes/local-app-development.d.ts +3 -0
- package/dist/src/gateway/hono/routes/local-app-development.js +13 -0
- package/dist/src/gateway/hono/routes/local-app-previews.d.ts +3 -0
- package/dist/src/gateway/hono/routes/local-app-previews.js +86 -0
- package/dist/src/gateway/hono/routes/local-app-run-streams.d.ts +4 -0
- package/dist/src/gateway/hono/routes/local-app-run-streams.js +105 -0
- package/dist/src/gateway/hono/routes/local-apps.js +3 -2
- package/dist/src/gateway/hono/routes/projects.js +1 -1
- package/dist/src/gateway/hono/routes/sessions.js +2 -2
- package/dist/src/gateway/hono/routes/shares.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +4 -4
- package/dist/src/gateway/hono/routes/tui.js +308 -0
- package/dist/src/gateway/hono/routes/user-model.js +2 -2
- package/dist/src/gateway/hono/routes/voice.js +4 -3
- package/dist/src/gateway/media-access.js +1 -1
- package/dist/src/gateway/security/gateway-scopes.js +1 -1
- package/dist/src/gateway/security/local-app-delegation-access.d.ts +5 -0
- package/dist/src/gateway/security/local-app-delegation-access.js +22 -0
- package/dist/src/gateway/service/agent-runner.js +1 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +8 -3
- package/dist/src/gateway/service/run-gateway-agent.js +7 -6
- package/dist/src/gateway/service/session-input-coordinator.d.ts +1 -0
- package/dist/src/gateway/service/session-input-coordinator.js +6 -2
- package/dist/src/gateway/service/sessions-api.d.ts +1 -1
- package/dist/src/gateway/service/sessions-api.js +3 -3
- package/dist/src/gateway/service.js +50 -17
- package/dist/src/gateway/session-reset-service.js +1 -1
- package/dist/src/gateway/xopc-cloud-capability-setup.js +1 -1
- package/dist/src/infra/execution-authority.d.ts +12 -0
- package/dist/src/infra/execution-authority.js +27 -0
- package/dist/src/local-apps/access-audit.d.ts +17 -0
- package/dist/src/local-apps/access-audit.js +42 -0
- package/dist/src/local-apps/automation-proposals.d.ts +754 -0
- package/dist/src/local-apps/automation-proposals.js +185 -0
- package/dist/src/local-apps/capabilities/automation-policy.d.ts +7 -0
- package/dist/src/local-apps/capabilities/automation-policy.js +46 -0
- package/dist/src/local-apps/capabilities/contracts.js +25 -0
- package/dist/src/local-apps/capabilities/delegate.d.ts +3 -0
- package/dist/src/local-apps/capabilities/delegate.js +183 -0
- package/dist/src/local-apps/capabilities/projections.d.ts +853 -0
- package/dist/src/local-apps/capabilities/projections.js +186 -0
- package/dist/src/local-apps/capabilities/resource-policy.d.ts +3 -0
- package/dist/src/local-apps/capabilities/resource-policy.js +119 -0
- package/dist/src/local-apps/capabilities/runtime.d.ts +2 -1
- package/dist/src/local-apps/capabilities/runtime.js +109 -39
- package/dist/src/local-apps/execution-authority.d.ts +13 -0
- package/dist/src/local-apps/execution-authority.js +104 -0
- package/dist/src/local-apps/fix-guidance.js +4 -1
- package/dist/src/local-apps/p1-services.d.ts +189 -0
- package/dist/src/local-apps/p1-services.js +620 -0
- package/dist/src/local-apps/preview-fixtures.d.ts +20 -0
- package/dist/src/local-apps/preview-fixtures.js +52 -0
- package/dist/src/local-apps/preview-runtime-bridge.d.ts +1 -1
- package/dist/src/local-apps/preview-runtime-bridge.js +41 -18
- package/dist/src/local-apps/preview-sessions.d.ts +52 -0
- package/dist/src/local-apps/preview-sessions.js +316 -0
- package/dist/src/local-apps/preview-worker.d.ts +1 -0
- package/dist/src/local-apps/preview-worker.js +117 -0
- package/dist/src/local-apps/public-assets.d.ts +2 -0
- package/dist/src/local-apps/public-assets.js +42 -0
- package/dist/src/local-apps/scaffold.js +1 -1
- package/dist/src/local-apps/service.d.ts +128 -5
- package/dist/src/local-apps/service.js +153 -15
- package/dist/src/local-apps/store.d.ts +3 -0
- package/dist/src/local-apps/store.js +42 -16
- package/dist/src/local-apps/types.d.ts +2 -0
- package/dist/src/memory-learning/repository.js +3 -2
- package/dist/src/memory-learning/service.js +4 -13
- package/dist/src/memory-learning/transcript-source.d.ts +9 -0
- package/dist/src/memory-learning/transcript-source.js +31 -0
- package/dist/src/notes/agent-context.js +1 -1
- package/dist/src/notes/capabilities/read.js +11 -2
- package/dist/src/notes/capabilities/write.js +10 -1
- package/dist/src/notes/types.d.ts +2 -0
- package/dist/src/personal-agent/communication.d.ts +2 -1
- package/dist/src/personal-agent/communication.js +3 -1
- package/dist/src/personal-agent/prompt-context.js +15 -23
- package/dist/src/personal-agent/prompts.js +3 -2
- package/dist/src/personal-agent/reply-composer.js +2 -2
- package/dist/src/personal-agent/request-access.js +1 -1
- package/dist/src/personal-agent/request-delivery.js +1 -1
- package/dist/src/personal-agent/request-service.js +2 -2
- package/dist/src/personal-agent/service.js +1 -0
- package/dist/src/personal-agent/task-cancel.js +1 -1
- package/dist/src/phone/contracts.d.ts +1 -1
- package/dist/src/phone/model-adapter.d.ts +1 -1
- package/dist/src/phone/runtime.d.ts +1 -1
- package/dist/src/platform/contracts.d.ts +3 -3
- package/dist/src/process/fork-worker.d.ts +2 -0
- package/dist/src/process/fork-worker.js +7 -0
- package/dist/src/projects/capabilities/read.js +43 -2
- package/dist/src/projects/capabilities/write.js +25 -0
- package/dist/src/projects/project-store.js +12 -1
- package/dist/src/projects/types.d.ts +1 -0
- package/dist/src/realtime/broker.js +1 -1
- package/dist/src/review/review-git.js +14 -1
- package/dist/src/session/client-history.js +12 -1
- package/dist/src/session/session-context-for-llm.js +10 -3
- package/dist/src/session/store.d.ts +1 -0
- package/dist/src/session/store.js +2 -1
- package/dist/src/session/stored-rows-to-file-entries.js +1 -1
- package/dist/src/session/transcript-outline.js +9 -0
- package/dist/src/session/voice-transcript.d.ts +14 -0
- package/dist/src/session/voice-transcript.js +19 -2
- package/dist/src/share/share-store.js +1 -1
- package/dist/src/share/site-share-store.js +1 -1
- package/dist/src/storage/sqlite/notes-repository.js +7 -0
- package/dist/src/storage/sqlite/resource-scope.d.ts +10 -0
- package/dist/src/storage/sqlite/resource-scope.js +31 -0
- package/dist/src/storage/sqlite/transcript-repository.d.ts +3 -0
- package/dist/src/storage/sqlite/transcript-repository.js +43 -7
- package/dist/src/tasks/capabilities/management.js +3 -0
- package/dist/src/tasks/capabilities/read.js +21 -3
- package/dist/src/tasks/capabilities/write.js +11 -2
- package/dist/src/tasks/index.js +1 -1
- package/dist/src/tasks/task-allocation-service.js +1 -1
- package/dist/src/tasks/task-application-service.js +3 -3
- package/dist/src/tasks/task-context-assembler.js +1 -1
- package/dist/src/tasks/task-evidence-tools.d.ts +2 -0
- package/dist/src/tasks/task-evidence-tools.js +22 -0
- package/dist/src/tasks/task-main-update-delivery.js +2 -0
- package/dist/src/tasks/task-repository.d.ts +2 -0
- package/dist/src/tasks/task-repository.js +7 -0
- package/dist/src/tasks/task-research-result.js +8 -21
- package/dist/src/tasks/task-result-delivery-repository.d.ts +6 -0
- package/dist/src/tasks/task-result-delivery-repository.js +26 -0
- package/dist/src/tasks/task-result-delivery-service.js +3 -3
- package/dist/src/tasks/task-run-coordinator.js +1 -1
- package/dist/src/tui/backend-services.d.ts +14 -0
- package/dist/src/tui/backend-services.js +67 -0
- package/dist/src/tui/backends/embedded-backend.d.ts +48 -4
- package/dist/src/tui/backends/embedded-backend.js +248 -42
- package/dist/src/tui/backends/gateway-realtime-backend.d.ts +46 -2
- package/dist/src/tui/backends/gateway-realtime-backend.js +205 -62
- package/dist/src/tui/components/chat-log.d.ts +1 -0
- package/dist/src/tui/components/chat-log.js +11 -5
- package/dist/src/tui/components/scoped-models-selector.js +1 -1
- package/dist/src/tui/components/session-selector.js +1 -1
- package/dist/src/tui/components/text-viewer.d.ts +32 -0
- package/dist/src/tui/components/text-viewer.js +132 -0
- package/dist/src/tui/components/tui-bottom-bar.js +3 -0
- package/dist/src/tui/extension-host/autocomplete.js +9 -1
- package/dist/src/tui/extension-host/runtime.d.ts +1 -0
- package/dist/src/tui/extension-host/runtime.js +1 -0
- package/dist/src/tui/tui-backend.d.ts +36 -3
- package/dist/src/tui/tui-capabilities.d.ts +15 -0
- package/dist/src/tui/tui-capabilities.js +46 -0
- package/dist/src/tui/tui-capability-controls.d.ts +9 -0
- package/dist/src/tui/tui-capability-controls.js +250 -0
- package/dist/src/tui/tui-clarification.d.ts +15 -0
- package/dist/src/tui/tui-clarification.js +91 -0
- package/dist/src/tui/tui-command-formatters.d.ts +0 -4
- package/dist/src/tui/tui-command-formatters.js +3 -43
- package/dist/src/tui/tui-commands.d.ts +4 -4
- package/dist/src/tui/tui-commands.js +219 -127
- package/dist/src/tui/tui-control-commands.d.ts +12 -0
- package/dist/src/tui/tui-control-commands.js +127 -0
- package/dist/src/tui/tui-image-files.d.ts +2 -0
- package/dist/src/tui/tui-image-files.js +47 -0
- package/dist/src/tui/tui-local-shell.d.ts +6 -0
- package/dist/src/tui/tui-local-shell.js +36 -2
- package/dist/src/tui/tui-management.d.ts +114 -0
- package/dist/src/tui/tui-management.js +233 -0
- package/dist/src/tui/tui-picker-overlay.d.ts +1 -6
- package/dist/src/tui/tui-picker-overlay.js +1 -62
- package/dist/src/tui/tui-session-actions.d.ts +1 -0
- package/dist/src/tui/tui-session-actions.js +97 -29
- package/dist/src/tui/tui-settings.js +1 -1
- package/dist/src/tui/tui-side-chat.d.ts +10 -0
- package/dist/src/tui/tui-side-chat.js +56 -0
- package/dist/src/tui/tui-terminal.d.ts +3 -0
- package/dist/src/tui/tui-terminal.js +52 -0
- package/dist/src/tui/tui-types.d.ts +4 -1
- package/dist/src/tui/tui.js +422 -211
- package/dist/src/tui/xopc-tui-keybindings.d.ts +29 -9
- package/dist/src/tui/xopc-tui-keybindings.js +27 -7
- package/dist/src/usage/recorder.js +2 -0
- package/dist/src/usage/scenario-registry.js +5 -0
- package/dist/src/user-model/index.js +3 -3
- package/dist/src/user-model/profile.d.ts +8 -0
- package/dist/src/user-model/profile.js +19 -1
- package/dist/src/voice/platform-settings.d.ts +5 -0
- package/dist/src/voice/platform-settings.js +15 -2
- package/dist/src/voice/platform-streams.d.ts +7 -3
- package/dist/src/voice/platform-streams.js +90 -18
- package/dist/src/voice/realtime/agentBroker.d.ts +12 -1
- package/dist/src/voice/realtime/agentBroker.js +22 -5
- package/dist/src/voice/realtime/agentEngine.js +104 -12
- package/dist/src/voice/realtime/chat-publication.d.ts +24 -0
- package/dist/src/voice/realtime/chat-publication.js +61 -0
- package/dist/src/voice/realtime/conversation-context.d.ts +7 -1
- package/dist/src/voice/realtime/conversation-context.js +54 -16
- package/dist/src/voice/realtime/engine.d.ts +2 -0
- package/dist/src/voice/realtime/identity-grounding.d.ts +8 -0
- package/dist/src/voice/realtime/identity-grounding.js +34 -0
- package/dist/src/voice/realtime/memory-context.js +48 -14
- package/dist/src/voice/realtime/naturalAgentTools.d.ts +90 -0
- package/dist/src/voice/realtime/naturalAgentTools.js +275 -0
- package/dist/src/voice/realtime/omniEngine.d.ts +8 -0
- package/dist/src/voice/realtime/omniEngine.js +239 -13
- package/dist/src/voice/realtime/omniRoute.d.ts +1 -0
- package/dist/src/voice/realtime/omniRoute.js +23 -4
- package/dist/src/voice/realtime/runtime.d.ts +1 -0
- package/dist/src/voice/realtime/runtime.js +116 -22
- package/dist/src/voice/realtime/runtime.types.d.ts +3 -1
- package/dist/src/voice/realtime/speakable-segmenter.d.ts +2 -1
- package/dist/src/voice/realtime/speakable-segmenter.js +7 -2
- package/dist/src/voice/realtime/turnPolicy.d.ts +1 -2
- package/dist/src/voice/realtime/turnPolicy.js +4 -6
- package/dist/src/voice/realtime/user-context.d.ts +14 -0
- package/dist/src/voice/realtime/user-context.js +63 -0
- package/dist/src/voice/tts/providers/xopc-cloud-speech.js +29 -23
- package/dist/src/voice/tts/speak-core.js +1 -0
- package/dist/src/voice/tts/speech-provider-types.d.ts +2 -0
- package/dist/src/work-discovery/service.js +1 -1
- package/package.json +3 -1
- package/skills/engineering/build-xopc-local-app/SKILL.md +5 -1
- package/skills/engineering/build-xopc-local-app/references/app-contract.md +43 -2
- package/dist/gateway/static/root/assets/api-DIKAjDAK.js +0 -1
- package/dist/gateway/static/root/assets/automation-run-list-J-R4-hVm.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-KRaK8LKT.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-aJy-1o5H.js +0 -8
- package/dist/gateway/static/root/assets/chat-page-QmBfel_Z.js +0 -71
- package/dist/gateway/static/root/assets/clipboard-copy-DuJk5WD6.js +0 -1
- package/dist/gateway/static/root/assets/connected-providers-grid-BWVieU6P.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-C8M01Zxs.js +0 -1
- package/dist/gateway/static/root/assets/dist-BGTk37IG.js +0 -1
- package/dist/gateway/static/root/assets/extension-iframe-host-DjXDDmUd.js +0 -1
- package/dist/gateway/static/root/assets/extension-page-CGgneUDY.js +0 -1
- package/dist/gateway/static/root/assets/extension-provider-BktGTwH_.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-ZxMFPH4n.js +0 -1
- package/dist/gateway/static/root/assets/index-CPXKrqLj.js +0 -11
- package/dist/gateway/static/root/assets/index-Dc-3QQaz.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CnckB-RA.js +0 -1
- package/dist/gateway/static/root/assets/local-apps-Ck6kACsY.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-_nIEwZn4.js +0 -2
- package/dist/gateway/static/root/assets/messages-C7ruaWtK.js +0 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-kccIXJo_.js +0 -1
- package/dist/gateway/static/root/assets/oauth-provider-connect-CZP15znW.js +0 -1
- package/dist/gateway/static/root/assets/page-header-store-CFntbsPj.js +0 -1
- package/dist/gateway/static/root/assets/personal-avatar-CVocefDp.js +0 -1
- package/dist/gateway/static/root/assets/personal-page-BjnSgU89.js +0 -1
- package/dist/gateway/static/root/assets/personal-proactivity-DaRnbB1f.js +0 -1
- package/dist/gateway/static/root/assets/personal-settings-panel-CdMHSPCH.js +0 -1
- package/dist/gateway/static/root/assets/providers-api-DE7kdeXc.js +0 -1
- package/dist/gateway/static/root/assets/route-preload-DGMUu3pm.js +0 -2
- package/dist/gateway/static/root/assets/runtime-health-D2TDFLLq.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-5qokJQ6W.js +0 -25
- package/dist/gateway/static/root/assets/settings-advanced-gate-B7-XQiJh.js +0 -1
- package/dist/gateway/static/root/assets/sliding-segmented-D346J92k.js +0 -1
- package/dist/gateway/static/root/assets/tool-friendly-title-YQmN1S2k.js +0 -2
- package/dist/gateway/static/root/assets/use-realtime-voice-BcokfdI0.js +0 -1
- package/dist/gateway/static/root/assets/voice-C607F0pB.js +0 -1
- package/dist/gateway/static/root/assets/voice-call-context-CJ1ZiJWR.js +0 -1
- package/dist/gateway/static/root/assets/voice-config-api-DVFTuHwH.js +0 -1
- package/dist/gateway/static/root/assets/workspace-api-ymncGc6j.js +0 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-BQrMvAkL.js +0 -1
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region src/local-apps/preview-fixtures.ts
|
|
5
|
+
const id = z.string().regex(/^[A-Za-z0-9_-]{1,128}$/);
|
|
6
|
+
const PreviewFixturesSchema = z.strictObject({
|
|
7
|
+
schemaVersion: z.literal(1),
|
|
8
|
+
notes: z.array(z.strictObject({
|
|
9
|
+
id,
|
|
10
|
+
title: z.string().max(1e3),
|
|
11
|
+
markdown: z.string().max(64e3),
|
|
12
|
+
tags: z.array(z.string().max(100)).max(20).default([])
|
|
13
|
+
})).max(50),
|
|
14
|
+
tasks: z.array(z.strictObject({
|
|
15
|
+
id,
|
|
16
|
+
title: z.string().max(500),
|
|
17
|
+
phase: z.enum(["backlog", "ready"]).default("backlog")
|
|
18
|
+
})).max(50)
|
|
19
|
+
}).refine((value) => new Set(value.notes.map((note) => note.id)).size === value.notes.length && new Set(value.tasks.map((task) => task.id)).size === value.tasks.length, "Duplicate fixture ID");
|
|
20
|
+
function readPreviewFixtures(root) {
|
|
21
|
+
const path = join(root, ".xopc", "fixtures.json");
|
|
22
|
+
if (existsSync(path)) {
|
|
23
|
+
const content = readFileSync(path);
|
|
24
|
+
if (content.byteLength > 256e3) throw new Error("Preview fixtures exceed 256 KB");
|
|
25
|
+
return PreviewFixturesSchema.parse(JSON.parse(content.toString("utf8")));
|
|
26
|
+
}
|
|
27
|
+
return PreviewFixturesSchema.parse({
|
|
28
|
+
schemaVersion: 1,
|
|
29
|
+
notes: [{
|
|
30
|
+
id: "sample-note-reading",
|
|
31
|
+
title: "示例:阅读清单 / Reading list",
|
|
32
|
+
markdown: "这是一条示例笔记,不包含真实数据。\n\n- [ ] Read an article",
|
|
33
|
+
tags: ["sample"]
|
|
34
|
+
}, {
|
|
35
|
+
id: "sample-note-review",
|
|
36
|
+
title: "示例:每周复盘 / Weekly review",
|
|
37
|
+
markdown: "## 本周成果\n完成第一个小工具。\n\n## 下周计划\n试用并调整。",
|
|
38
|
+
tags: ["sample"]
|
|
39
|
+
}],
|
|
40
|
+
tasks: [{
|
|
41
|
+
id: "sample-task-plan",
|
|
42
|
+
title: "示例:准备本周计划 / Plan the week",
|
|
43
|
+
phase: "ready"
|
|
44
|
+
}, {
|
|
45
|
+
id: "sample-task-review",
|
|
46
|
+
title: "示例:整理复盘 / Review progress",
|
|
47
|
+
phase: "backlog"
|
|
48
|
+
}]
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { PreviewFixturesSchema, readPreviewFixtures };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { LocalAppAcceptanceConfig } from './acceptance.js';
|
|
2
|
-
export declare const LOCAL_APP_RUNTIME_BRIDGE_SCRIPT = "(() => {\n let hostPort = null;\n const latest = new Map();\n const send = (type, detail) => {\n const message = { source: 'xopc-local-app-preview', version: 1, type, detail };\n latest.set(type, message);\n hostPort?.postMessage(message);\n };\n const connect = (event) => {\n const message = event.data;\n if (event.source !== parent || message?.source !== 'xopc-local-app-host' || message?.version !== 1 || message?.type !== 'connect' || !event.ports[0]) return;\n event.stopImmediatePropagation();\n hostPort?.close();\n hostPort = event.ports[0];\n hostPort.start();\n for (const message of latest.values()) hostPort.postMessage(message);\n };\n addEventListener('message', connect, true);\n const text = (value) => String(value ?? '').slice(0, 500);\n let runtimeFailure = '';\n const visible = (element) => {\n const style = getComputedStyle(element);\n const rect = element.getBoundingClientRect();\n return style.display !== 'none' && style.visibility !== 'hidden' && Number(style.opacity) !== 0 && rect.width > 0 && rect.height > 0;\n };\n const accessibleName = (element) => {\n const labelledBy = text(element.getAttribute('aria-labelledby'));\n const labelledText = labelledBy.split(/\\s+/).map((id) => document.getElementById(id)?.textContent).filter(Boolean).join(' ');\n return text(element.getAttribute('aria-label') || labelledText || element.labels?.[0]?.textContent || element.textContent || element.getAttribute('alt') || element.getAttribute('title') || element.getAttribute('placeholder') || element.getAttribute('name')).trim();\n };\n const target = (id) => Array.from(document.querySelectorAll('[data-xopc-test-id]'))\n .find((element) => element.getAttribute('data-xopc-test-id') === id);\n const settle = async () => {\n await Promise.resolve();\n await Promise.resolve();\n };\n const readCriteria = () => {\n const encoded = document.querySelector('meta[name=\"xopc-local-app-acceptance\"]')?.content;\n if (!encoded) return { schemaVersion: 1, scenarios: [] };\n const base64 = encoded.replace(/-/g, '+').replace(/_/g, '/');\n const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, '=');\n const bytes = Uint8Array.from(atob(padded), (char) => char.charCodeAt(0));\n return JSON.parse(new TextDecoder().decode(bytes));\n };\n addEventListener('error', (event) => {\n runtimeFailure = text(event.message || 'A preview resource failed to load');\n send('error', {\n kind: 'script_error',\n message: runtimeFailure,\n filename: text(event.filename),\n line: Number(event.lineno) || undefined,\n column: Number(event.colno) || undefined,\n });\n }, true);\n addEventListener('unhandledrejection', (event) => {\n runtimeFailure = text(event.reason instanceof Error ? event.reason.message : event.reason);\n send('error', { kind: 'unhandled_rejection', message: runtimeFailure });\n });\n const runAcceptance = () => {\n const checks = [];\n const bodyReady = Boolean(document.body);\n checks.push({ id: 'document', status: bodyReady ? 'passed' : 'failed', message: bodyReady ? 'Preview document loaded' : 'Preview document has no body' });\n const contentNodes = bodyReady ? Array.from(document.body.querySelectorAll('*')).slice(0, 300) : [];\n const hasVisibleContent = contentNodes.some((element) => visible(element) && (text(element.textContent).trim() || /^(IMG|SVG|CANVAS|VIDEO)$/.test(element.tagName)));\n checks.push({ id: 'content', status: hasVisibleContent ? 'passed' : 'failed', message: hasVisibleContent ? 'Visible content rendered' : 'No visible content was rendered' });\n const controls = bodyReady ? Array.from(document.body.querySelectorAll('a[href], button, input, select, textarea, [role=\"button\"], [tabindex]')).filter((element) => visible(element) && !element.disabled && element.getAttribute('aria-disabled') !== 'true') : [];\n const unnamed = controls.filter((element) => !accessibleName(element));\n let interactionStatus = controls.length ? 'passed' : 'skipped';\n let interactionMessage = controls.length ? controls.length + ' interactive control(s) are discoverable' : 'No interactive controls to exercise';\n if (unnamed.length) {\n interactionStatus = 'failed';\n interactionMessage = unnamed.length + ' interactive control(s) need an accessible name';\n } else if (controls.length) {\n const previous = document.activeElement;\n controls[0].focus({ preventScroll: true });\n if (document.activeElement !== controls[0]) {\n interactionStatus = 'failed';\n interactionMessage = 'The first interactive control could not receive focus';\n }\n if (previous && typeof previous.focus === 'function') previous.focus({ preventScroll: true });\n else controls[0].blur();\n }\n checks.push({ id: 'interaction', status: interactionStatus, message: interactionMessage });\n send('acceptance', {\n status: checks.some((check) => check.status === 'failed') ? 'failed' : 'passed',\n checks,\n interactiveCount: controls.length,\n });\n };\n const runCriteria = async () => {\n const params = new URLSearchParams(location.search);\n if (params.get('xopcAcceptance') !== '1') return;\n let config;\n try {\n config = readCriteria();\n } catch (error) {\n send('criteria', { status: 'failed', scenarioCount: 0, scenarios: [{ id: 'config', name: 'Acceptance config', status: 'failed', message: text(error instanceof Error ? error.message : error) }] });\n return;\n }\n const requestedScenario = params.get('xopcScenario');\n const selectedScenarios = requestedScenario\n ? (config.scenarios || []).filter((scenario) => scenario.id === requestedScenario)\n : config.scenarios || [];\n if (requestedScenario && !selectedScenarios.length) {\n send('criteria', { status: 'failed', scenarioCount: 1, scenarios: [{ id: requestedScenario, name: requestedScenario, status: 'failed', message: 'Requested scenario was not found' }] });\n return;\n }\n const scenarios = [];\n for (const scenario of selectedScenarios) {\n let failure = '';\n for (let index = 0; index < scenario.steps.length; index += 1) {\n const step = scenario.steps[index];\n try {\n if (step.action === 'click') {\n const element = target(step.target);\n if (!(element instanceof HTMLElement)) throw new Error('Target \"' + step.target + '\" was not found');\n if ('disabled' in element && element.disabled || element.getAttribute('aria-disabled') === 'true') throw new Error('Target \"' + step.target + '\" is disabled');\n element.click();\n await settle();\n } else if (step.action === 'fill') {\n const element = target(step.target);\n if (!(element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement || element instanceof HTMLSelectElement)) throw new Error('Target \"' + step.target + '\" cannot be filled');\n const prototype = element instanceof HTMLInputElement ? HTMLInputElement.prototype : element instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype;\n const setter = Object.getOwnPropertyDescriptor(prototype, 'value')?.set;\n if (setter) setter.call(element, step.value);\n else element.value = step.value;\n element.dispatchEvent(new Event('input', { bubbles: true }));\n element.dispatchEvent(new Event('change', { bubbles: true }));\n await settle();\n } else if (step.assert === 'text_visible') {\n const found = Array.from(document.body.querySelectorAll('*')).some((element) => visible(element) && text(element.textContent).includes(step.text));\n if (!found) throw new Error('Visible text was not found: \"' + step.text + '\"');\n } else if (step.assert === 'element_exists') {\n if (!target(step.target)) throw new Error('Target \"' + step.target + '\" was not found');\n } else if (step.assert === 'value_equals') {\n const element = target(step.target);\n if (!element || !('value' in element) || element.value !== step.value) throw new Error('Target \"' + step.target + '\" does not have the expected value');\n }\n if (runtimeFailure) throw new Error(runtimeFailure);\n } catch (error) {\n failure = 'Step ' + (index + 1) + ': ' + text(error instanceof Error ? error.message : error);\n break;\n }\n }\n scenarios.push({ id: scenario.id, name: scenario.name, status: failure ? 'failed' : 'passed', message: failure || 'Scenario passed' });\n }\n send('criteria', {\n status: scenarios.some((scenario) => scenario.status === 'failed') ? 'failed' : 'passed',\n scenarioCount: scenarios.length,\n scenarios,\n });\n };\n const loaded = () => {\n send('ready', { readyState: document.readyState });\n void runCriteria();\n if (typeof requestAnimationFrame === 'function') requestAnimationFrame(() => requestAnimationFrame(runAcceptance));\n else setTimeout(runAcceptance, 0);\n };\n if (document.readyState === 'complete') queueMicrotask(loaded);\n else addEventListener('load', loaded, { once: true });\n})();";
|
|
2
|
+
export declare const LOCAL_APP_RUNTIME_BRIDGE_SCRIPT = "(() => {\n let hostPort = null;\n let runId = '';\n let started = false;\n const hosted = new URLSearchParams(location.search).get('xopcHostRun') === '1';\n const latest = new Map();\n const send = (type, detail) => {\n const message = { source: 'xopc-local-app-preview', version: 1, type, detail, ...(runId ? { runId } : {}) };\n latest.set(type, message);\n hostPort?.postMessage(message);\n };\n const connect = (event) => {\n const message = event.data;\n if (event.source !== parent || message?.source !== 'xopc-local-app-host' || message?.version !== 1 || message?.type !== 'connect' || !event.ports[0]) return;\n event.stopImmediatePropagation();\n hostPort?.close();\n hostPort = event.ports[0];\n hostPort.onmessage = (event) => {\n if (event.data?.type === 'tick') checkWaiters();\n if (event.data?.type === 'run' && typeof event.data.runId === 'string' && !started) {\n started = true; runId = event.data.runId;\n void runCriteria().then(runAcceptance);\n }\n };\n hostPort.start();\n for (const message of latest.values()) hostPort.postMessage(message);\n };\n addEventListener('message', connect, true);\n const text = (value) => String(value ?? '').slice(0, 500);\n let runtimeFailure = '';\n const visible = (element) => {\n const style = getComputedStyle(element);\n const rect = element.getBoundingClientRect();\n return style.display !== 'none' && style.visibility !== 'hidden' && Number(style.opacity) !== 0 && rect.width > 0 && rect.height > 0;\n };\n const accessibleName = (element) => {\n const labelledBy = text(element.getAttribute('aria-labelledby'));\n const labelledText = labelledBy.split(/\\s+/).map((id) => document.getElementById(id)?.textContent).filter(Boolean).join(' ');\n return text(element.getAttribute('aria-label') || labelledText || element.labels?.[0]?.textContent || element.textContent || element.getAttribute('alt') || element.getAttribute('title') || element.getAttribute('placeholder') || element.getAttribute('name')).trim();\n };\n const target = (id) => Array.from(document.querySelectorAll('[data-xopc-test-id]'))\n .find((element) => element.getAttribute('data-xopc-test-id') === id);\n const waiters = new Set();\n let deadline = 0;\n const checkWaiters = () => {\n for (const waiter of Array.from(waiters)) {\n try {\n if (runtimeFailure) throw new Error(runtimeFailure);\n const result = waiter.check();\n if (result) { waiters.delete(waiter); waiter.resolve(result); }\n else if (Date.now() >= deadline) { waiters.delete(waiter); waiter.reject(new Error(waiter.message)); }\n } catch (error) { waiters.delete(waiter); waiter.reject(error); }\n }\n };\n new MutationObserver(checkWaiters).observe(document, { subtree: true, childList: true, attributes: true, characterData: true });\n const waitFor = (check, message) => new Promise((resolve, reject) => {\n const waiter = { check, message, resolve, reject };\n waiters.add(waiter); checkWaiters();\n const poll = () => { if (!waiters.has(waiter)) return; checkWaiters(); setTimeout(poll, 25); };\n setTimeout(poll, 25);\n });\n const control = (id) => {\n const element = target(id);\n return element instanceof HTMLElement && visible(element) && !element.disabled && element.getAttribute('aria-disabled') !== 'true' ? element : null;\n };\n const readCriteria = () => {\n const encoded = document.querySelector('meta[name=\"xopc-local-app-acceptance\"]')?.content;\n if (!encoded) return { schemaVersion: 1, scenarios: [] };\n const base64 = encoded.replace(/-/g, '+').replace(/_/g, '/');\n const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, '=');\n const bytes = Uint8Array.from(atob(padded), (char) => char.charCodeAt(0));\n return JSON.parse(new TextDecoder().decode(bytes));\n };\n addEventListener('error', (event) => {\n runtimeFailure = text(event.message || 'A preview resource failed to load');\n send('error', {\n kind: 'script_error',\n message: runtimeFailure,\n filename: text(event.filename),\n line: Number(event.lineno) || undefined,\n column: Number(event.colno) || undefined,\n });\n }, true);\n addEventListener('unhandledrejection', (event) => {\n runtimeFailure = text(event.reason instanceof Error ? event.reason.message : event.reason);\n send('error', { kind: 'unhandled_rejection', message: runtimeFailure });\n });\n const runAcceptance = () => {\n const checks = [];\n const bodyReady = Boolean(document.body);\n checks.push({ id: 'document', status: bodyReady ? 'passed' : 'failed', message: bodyReady ? 'Preview document loaded' : 'Preview document has no body' });\n const contentNodes = bodyReady ? Array.from(document.body.querySelectorAll('*')).slice(0, 300) : [];\n const hasVisibleContent = contentNodes.some((element) => visible(element) && (text(element.textContent).trim() || /^(IMG|SVG|CANVAS|VIDEO)$/.test(element.tagName)));\n checks.push({ id: 'content', status: hasVisibleContent ? 'passed' : 'failed', message: hasVisibleContent ? 'Visible content rendered' : 'No visible content was rendered' });\n const controls = bodyReady ? Array.from(document.body.querySelectorAll('a[href], button, input, select, textarea, [role=\"button\"], [tabindex]')).filter((element) => visible(element) && !element.disabled && element.getAttribute('aria-disabled') !== 'true') : [];\n const unnamed = controls.filter((element) => !accessibleName(element));\n let interactionStatus = controls.length ? 'passed' : 'skipped';\n let interactionMessage = controls.length ? controls.length + ' interactive control(s) are discoverable' : 'No interactive controls to exercise';\n if (unnamed.length) {\n interactionStatus = 'failed';\n interactionMessage = unnamed.length + ' interactive control(s) need an accessible name';\n } else if (controls.length) {\n const previous = document.activeElement;\n controls[0].focus({ preventScroll: true });\n if (document.activeElement !== controls[0]) {\n interactionStatus = 'failed';\n interactionMessage = 'The first interactive control could not receive focus';\n }\n if (previous && typeof previous.focus === 'function') previous.focus({ preventScroll: true });\n else controls[0].blur();\n }\n checks.push({ id: 'interaction', status: interactionStatus, message: interactionMessage });\n send('acceptance', {\n status: checks.some((check) => check.status === 'failed') ? 'failed' : 'passed',\n checks,\n interactiveCount: controls.length,\n });\n };\n const runCriteria = async () => {\n const params = new URLSearchParams(location.search);\n if (params.get('xopcAcceptance') !== '1') return;\n let config;\n try {\n config = readCriteria();\n } catch (error) {\n send('criteria', { status: 'failed', scenarioCount: 0, scenarios: [{ id: 'config', name: 'Acceptance config', status: 'failed', message: text(error instanceof Error ? error.message : error) }] });\n return;\n }\n const requestedScenario = params.get('xopcScenario');\n const selectedScenarios = requestedScenario\n ? (config.scenarios || []).filter((scenario) => scenario.id === requestedScenario)\n : config.scenarios || [];\n if (requestedScenario && !selectedScenarios.length) {\n send('criteria', { status: 'failed', scenarioCount: 1, scenarios: [{ id: requestedScenario, name: requestedScenario, status: 'failed', message: 'Requested scenario was not found' }] });\n return;\n }\n const scenarios = [];\n for (const scenario of selectedScenarios) {\n deadline = Date.now() + 8000;\n let failure = '';\n for (let index = 0; index < scenario.steps.length; index += 1) {\n const step = scenario.steps[index];\n try {\n if (step.action === 'click') {\n const element = await waitFor(() => control(step.target), 'Target \"' + step.target + '\" was not ready');\n element.click();\n } else if (step.action === 'fill') {\n const element = await waitFor(() => control(step.target), 'Target \"' + step.target + '\" was not ready');\n if (!(element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement || element instanceof HTMLSelectElement)) throw new Error('Target \"' + step.target + '\" cannot be filled');\n const prototype = element instanceof HTMLInputElement ? HTMLInputElement.prototype : element instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype;\n const setter = Object.getOwnPropertyDescriptor(prototype, 'value')?.set;\n if (setter) setter.call(element, step.value);\n else element.value = step.value;\n element.dispatchEvent(new Event('input', { bubbles: true }));\n element.dispatchEvent(new Event('change', { bubbles: true }));\n } else if (step.assert === 'text_visible') {\n await waitFor(() => Array.from(document.body.querySelectorAll('*')).some((element) => visible(element) && text(element.textContent).includes(step.text)), 'Visible text was not found: \"' + step.text + '\"');\n } else if (step.assert === 'element_exists') {\n await waitFor(() => target(step.target), 'Target \"' + step.target + '\" was not found');\n } else if (step.assert === 'value_equals') {\n await waitFor(() => { const element = target(step.target); return element && 'value' in element && element.value === step.value; }, 'Target \"' + step.target + '\" does not have the expected value');\n }\n if (runtimeFailure) throw new Error(runtimeFailure);\n } catch (error) {\n failure = 'Step ' + (index + 1) + ': ' + text(error instanceof Error ? error.message : error);\n break;\n }\n }\n scenarios.push({ id: scenario.id, name: scenario.name, status: failure ? 'failed' : 'passed', message: failure || 'Scenario passed' });\n }\n send('criteria', {\n status: scenarios.some((scenario) => scenario.status === 'failed') ? 'failed' : 'passed',\n scenarioCount: scenarios.length,\n scenarios,\n });\n };\n const loaded = () => {\n send('ready', { readyState: document.readyState });\n // Defer past all load listeners. Hosted runs start only after the SDK/data bridge is ready.\n if (!hosted) setTimeout(() => { if (started) return; started = true; void runCriteria().then(runAcceptance); }, 0);\n };\n if (document.readyState === 'complete') queueMicrotask(loaded);\n else addEventListener('load', loaded, { once: true });\n})();";
|
|
3
3
|
export declare const LOCAL_APP_RUNTIME_BRIDGE_HASH: string;
|
|
4
4
|
export declare function injectLocalAppRuntimeBridge(html: string, acceptance?: LocalAppAcceptanceConfig): string;
|
|
@@ -3,9 +3,12 @@ import { createHash } from "node:crypto";
|
|
|
3
3
|
//#region src/local-apps/preview-runtime-bridge.ts
|
|
4
4
|
const LOCAL_APP_RUNTIME_BRIDGE_SCRIPT = `(() => {
|
|
5
5
|
let hostPort = null;
|
|
6
|
+
let runId = '';
|
|
7
|
+
let started = false;
|
|
8
|
+
const hosted = new URLSearchParams(location.search).get('xopcHostRun') === '1';
|
|
6
9
|
const latest = new Map();
|
|
7
10
|
const send = (type, detail) => {
|
|
8
|
-
const message = { source: 'xopc-local-app-preview', version: 1, type, detail };
|
|
11
|
+
const message = { source: 'xopc-local-app-preview', version: 1, type, detail, ...(runId ? { runId } : {}) };
|
|
9
12
|
latest.set(type, message);
|
|
10
13
|
hostPort?.postMessage(message);
|
|
11
14
|
};
|
|
@@ -15,6 +18,13 @@ const LOCAL_APP_RUNTIME_BRIDGE_SCRIPT = `(() => {
|
|
|
15
18
|
event.stopImmediatePropagation();
|
|
16
19
|
hostPort?.close();
|
|
17
20
|
hostPort = event.ports[0];
|
|
21
|
+
hostPort.onmessage = (event) => {
|
|
22
|
+
if (event.data?.type === 'tick') checkWaiters();
|
|
23
|
+
if (event.data?.type === 'run' && typeof event.data.runId === 'string' && !started) {
|
|
24
|
+
started = true; runId = event.data.runId;
|
|
25
|
+
void runCriteria().then(runAcceptance);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
18
28
|
hostPort.start();
|
|
19
29
|
for (const message of latest.values()) hostPort.postMessage(message);
|
|
20
30
|
};
|
|
@@ -33,9 +43,28 @@ const LOCAL_APP_RUNTIME_BRIDGE_SCRIPT = `(() => {
|
|
|
33
43
|
};
|
|
34
44
|
const target = (id) => Array.from(document.querySelectorAll('[data-xopc-test-id]'))
|
|
35
45
|
.find((element) => element.getAttribute('data-xopc-test-id') === id);
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
46
|
+
const waiters = new Set();
|
|
47
|
+
let deadline = 0;
|
|
48
|
+
const checkWaiters = () => {
|
|
49
|
+
for (const waiter of Array.from(waiters)) {
|
|
50
|
+
try {
|
|
51
|
+
if (runtimeFailure) throw new Error(runtimeFailure);
|
|
52
|
+
const result = waiter.check();
|
|
53
|
+
if (result) { waiters.delete(waiter); waiter.resolve(result); }
|
|
54
|
+
else if (Date.now() >= deadline) { waiters.delete(waiter); waiter.reject(new Error(waiter.message)); }
|
|
55
|
+
} catch (error) { waiters.delete(waiter); waiter.reject(error); }
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
new MutationObserver(checkWaiters).observe(document, { subtree: true, childList: true, attributes: true, characterData: true });
|
|
59
|
+
const waitFor = (check, message) => new Promise((resolve, reject) => {
|
|
60
|
+
const waiter = { check, message, resolve, reject };
|
|
61
|
+
waiters.add(waiter); checkWaiters();
|
|
62
|
+
const poll = () => { if (!waiters.has(waiter)) return; checkWaiters(); setTimeout(poll, 25); };
|
|
63
|
+
setTimeout(poll, 25);
|
|
64
|
+
});
|
|
65
|
+
const control = (id) => {
|
|
66
|
+
const element = target(id);
|
|
67
|
+
return element instanceof HTMLElement && visible(element) && !element.disabled && element.getAttribute('aria-disabled') !== 'true' ? element : null;
|
|
39
68
|
};
|
|
40
69
|
const readCriteria = () => {
|
|
41
70
|
const encoded = document.querySelector('meta[name="xopc-local-app-acceptance"]')?.content;
|
|
@@ -110,18 +139,16 @@ const LOCAL_APP_RUNTIME_BRIDGE_SCRIPT = `(() => {
|
|
|
110
139
|
}
|
|
111
140
|
const scenarios = [];
|
|
112
141
|
for (const scenario of selectedScenarios) {
|
|
142
|
+
deadline = Date.now() + 8000;
|
|
113
143
|
let failure = '';
|
|
114
144
|
for (let index = 0; index < scenario.steps.length; index += 1) {
|
|
115
145
|
const step = scenario.steps[index];
|
|
116
146
|
try {
|
|
117
147
|
if (step.action === 'click') {
|
|
118
|
-
const element =
|
|
119
|
-
if (!(element instanceof HTMLElement)) throw new Error('Target "' + step.target + '" was not found');
|
|
120
|
-
if ('disabled' in element && element.disabled || element.getAttribute('aria-disabled') === 'true') throw new Error('Target "' + step.target + '" is disabled');
|
|
148
|
+
const element = await waitFor(() => control(step.target), 'Target "' + step.target + '" was not ready');
|
|
121
149
|
element.click();
|
|
122
|
-
await settle();
|
|
123
150
|
} else if (step.action === 'fill') {
|
|
124
|
-
const element =
|
|
151
|
+
const element = await waitFor(() => control(step.target), 'Target "' + step.target + '" was not ready');
|
|
125
152
|
if (!(element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement || element instanceof HTMLSelectElement)) throw new Error('Target "' + step.target + '" cannot be filled');
|
|
126
153
|
const prototype = element instanceof HTMLInputElement ? HTMLInputElement.prototype : element instanceof HTMLTextAreaElement ? HTMLTextAreaElement.prototype : HTMLSelectElement.prototype;
|
|
127
154
|
const setter = Object.getOwnPropertyDescriptor(prototype, 'value')?.set;
|
|
@@ -129,15 +156,12 @@ const LOCAL_APP_RUNTIME_BRIDGE_SCRIPT = `(() => {
|
|
|
129
156
|
else element.value = step.value;
|
|
130
157
|
element.dispatchEvent(new Event('input', { bubbles: true }));
|
|
131
158
|
element.dispatchEvent(new Event('change', { bubbles: true }));
|
|
132
|
-
await settle();
|
|
133
159
|
} else if (step.assert === 'text_visible') {
|
|
134
|
-
|
|
135
|
-
if (!found) throw new Error('Visible text was not found: "' + step.text + '"');
|
|
160
|
+
await waitFor(() => Array.from(document.body.querySelectorAll('*')).some((element) => visible(element) && text(element.textContent).includes(step.text)), 'Visible text was not found: "' + step.text + '"');
|
|
136
161
|
} else if (step.assert === 'element_exists') {
|
|
137
|
-
|
|
162
|
+
await waitFor(() => target(step.target), 'Target "' + step.target + '" was not found');
|
|
138
163
|
} else if (step.assert === 'value_equals') {
|
|
139
|
-
const element = target(step.target);
|
|
140
|
-
if (!element || !('value' in element) || element.value !== step.value) throw new Error('Target "' + step.target + '" does not have the expected value');
|
|
164
|
+
await waitFor(() => { const element = target(step.target); return element && 'value' in element && element.value === step.value; }, 'Target "' + step.target + '" does not have the expected value');
|
|
141
165
|
}
|
|
142
166
|
if (runtimeFailure) throw new Error(runtimeFailure);
|
|
143
167
|
} catch (error) {
|
|
@@ -155,9 +179,8 @@ const LOCAL_APP_RUNTIME_BRIDGE_SCRIPT = `(() => {
|
|
|
155
179
|
};
|
|
156
180
|
const loaded = () => {
|
|
157
181
|
send('ready', { readyState: document.readyState });
|
|
158
|
-
|
|
159
|
-
if (
|
|
160
|
-
else setTimeout(runAcceptance, 0);
|
|
182
|
+
// Defer past all load listeners. Hosted runs start only after the SDK/data bridge is ready.
|
|
183
|
+
if (!hosted) setTimeout(() => { if (started) return; started = true; void runCriteria().then(runAcceptance); }, 0);
|
|
161
184
|
};
|
|
162
185
|
if (document.readyState === 'complete') queueMicrotask(loaded);
|
|
163
186
|
else addEventListener('load', loaded, { once: true });
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type CapabilityCall, type LocalAppPreviewCreate, type LocalAppPreviewSession, type ExtensionCapabilityBinding } from '@xopcai/gateway-contract';
|
|
2
|
+
import { type CapabilityContext, type CapabilityDispatcher } from '../capabilities/runtime/dispatcher.js';
|
|
3
|
+
export interface PreviewSource {
|
|
4
|
+
appId: string;
|
|
5
|
+
extensionId: string;
|
|
6
|
+
sourceHash: string;
|
|
7
|
+
previewUrl: string;
|
|
8
|
+
root: string;
|
|
9
|
+
permissions: string[];
|
|
10
|
+
bindings: ExtensionCapabilityBinding[];
|
|
11
|
+
scenarioIds: string[];
|
|
12
|
+
}
|
|
13
|
+
/** Preview leases are separate from installed releases and never grant production writes. */
|
|
14
|
+
export declare class LocalAppPreviewSessions {
|
|
15
|
+
private readonly stateRoot;
|
|
16
|
+
private readonly source;
|
|
17
|
+
private readonly assertSource;
|
|
18
|
+
private readonly leases;
|
|
19
|
+
private readonly closingWorkers;
|
|
20
|
+
constructor(stateRoot: () => string, source: (appId: string, sourceHash: string) => PreviewSource, assertSource: (appId: string, sourceHash: string) => void);
|
|
21
|
+
create(appId: string, value: LocalAppPreviewCreate, caller: CapabilityContext): Promise<LocalAppPreviewSession>;
|
|
22
|
+
private current;
|
|
23
|
+
describe(id: string, caller: CapabilityContext, dispatcher: CapabilityDispatcher): {
|
|
24
|
+
session: {
|
|
25
|
+
id: string;
|
|
26
|
+
appId: string;
|
|
27
|
+
extensionId: string;
|
|
28
|
+
sourceHash: string;
|
|
29
|
+
mode: "readonly" | "sample" | "isolated";
|
|
30
|
+
expiresAt: number;
|
|
31
|
+
previewUrl: string;
|
|
32
|
+
permissions: string[];
|
|
33
|
+
bindings: {
|
|
34
|
+
id: "xopc.notes.get" | "xopc.notes.list" | "xopc.tasks.get" | "xopc.tasks.list" | "xopc.notes.create" | "xopc.notes.update" | "xopc.notes.append" | "xopc.agent.delegate" | "xopc.automations.list" | "xopc.automations.get" | "xopc.automations.run" | "xopc.automations.get_run" | "xopc.automations.cancel" | "xopc.automations.simulate" | "xopc.automations.propose" | "xopc.automations.get_proposal" | "xopc.automations.history" | "xopc.automations.run_events" | "xopc.projects.get" | "xopc.projects.list" | "xopc.projects.list_milestones" | "xopc.projects.list_updates" | "xopc.projects.update" | "xopc.projects.create_milestone" | "xopc.projects.update_milestone" | "xopc.projects.create_update" | "xopc.tasks.create" | "xopc.tasks.update" | "xopc.files.read" | "xopc.files.propose_export" | "xopc.connectors.describe" | "xopc.connectors.read" | "xopc.connectors.propose_write" | "xopc.apps.get_request";
|
|
35
|
+
majorVersion: number;
|
|
36
|
+
descriptorDigest: string;
|
|
37
|
+
}[];
|
|
38
|
+
};
|
|
39
|
+
capabilities: import("@xopcai/gateway-contract").CapabilityDescriptor[];
|
|
40
|
+
};
|
|
41
|
+
call(sessionId: string, id: string, call: CapabilityCall, caller: CapabilityContext, dispatcher: CapabilityDispatcher): Promise<{
|
|
42
|
+
status: "succeeded";
|
|
43
|
+
releaseId: string;
|
|
44
|
+
data: unknown;
|
|
45
|
+
}>;
|
|
46
|
+
storage(id: string, caller: CapabilityContext, method: string, key?: string, value?: unknown): unknown;
|
|
47
|
+
remove(id: string, caller: CapabilityContext): void;
|
|
48
|
+
revokeApp(appId: string): void;
|
|
49
|
+
close(): Promise<void>;
|
|
50
|
+
private revoke;
|
|
51
|
+
private rpc;
|
|
52
|
+
}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { createLogger } from "../utils/logger/index.js";
|
|
2
|
+
import { init_logger } from "../utils/logger.js";
|
|
3
|
+
import { LocalAppResourceScopesSchema } from "../../packages/gateway-contract/src/extension-capabilities.js";
|
|
4
|
+
import { LocalAppPreviewCreateSchema } from "../../packages/gateway-contract/src/local-apps.js";
|
|
5
|
+
import { init_src } from "../../packages/gateway-contract/src/index.js";
|
|
6
|
+
import { CapabilityError } from "../capabilities/runtime/errors.js";
|
|
7
|
+
import "../capabilities/runtime/dispatcher.js";
|
|
8
|
+
import { localAppCapabilities } from "./capabilities/runtime.js";
|
|
9
|
+
import { readPreviewFixtures } from "./preview-fixtures.js";
|
|
10
|
+
import { LOCAL_APP_RUNTIME_BRIDGE_HASH } from "./preview-runtime-bridge.js";
|
|
11
|
+
import { forkWorker } from "../process/fork-worker.js";
|
|
12
|
+
import { join } from "node:path";
|
|
13
|
+
import { existsSync, mkdirSync, mkdtempSync, rmSync } from "node:fs";
|
|
14
|
+
import { fileURLToPath } from "node:url";
|
|
15
|
+
import { randomUUID } from "node:crypto";
|
|
16
|
+
//#region src/local-apps/preview-sessions.ts
|
|
17
|
+
init_src();
|
|
18
|
+
init_logger();
|
|
19
|
+
const log = createLogger("LocalApps:Preview");
|
|
20
|
+
const TTL = 15 * 6e4;
|
|
21
|
+
/** Preview leases are separate from installed releases and never grant production writes. */
|
|
22
|
+
var LocalAppPreviewSessions = class {
|
|
23
|
+
leases = /* @__PURE__ */ new Map();
|
|
24
|
+
closingWorkers = /* @__PURE__ */ new Set();
|
|
25
|
+
constructor(stateRoot, source, assertSource) {
|
|
26
|
+
this.stateRoot = stateRoot;
|
|
27
|
+
this.source = source;
|
|
28
|
+
this.assertSource = assertSource;
|
|
29
|
+
}
|
|
30
|
+
async create(appId, value, caller) {
|
|
31
|
+
const input = LocalAppPreviewCreateSchema.parse(value);
|
|
32
|
+
if (caller.signal?.aborted) throw new CapabilityError("CANCELLED", "Preview request cancelled");
|
|
33
|
+
this.assertSource(appId, input.sourceHash);
|
|
34
|
+
for (const lease of [...this.leases.values()]) if (lease.session.appId === appId && lease.session.sourceHash !== input.sourceHash) this.revoke(lease.session.id);
|
|
35
|
+
for (const lease of this.leases.values()) if (lease.session.expiresAt <= Date.now()) this.revoke(lease.session.id);
|
|
36
|
+
if (input.mode !== "readonly" && [...this.leases.values()].filter((lease) => lease.worker).length + this.closingWorkers.size >= 4) {
|
|
37
|
+
const idle = [...this.leases.values()].filter((lease) => lease.worker && lease.owner === caller.principalId && Date.now() - lease.lastUsedAt >= 3e4).sort((a, b) => a.lastUsedAt - b.lastUsedAt)[0];
|
|
38
|
+
if (idle) this.revoke(idle.session.id);
|
|
39
|
+
}
|
|
40
|
+
if (this.leases.size >= 12 || [...this.leases.values()].filter((lease) => lease.owner === caller.principalId).length >= 6) throw new CapabilityError("UNAVAILABLE", "Close another preview before opening a new one");
|
|
41
|
+
const source = this.source(appId, input.sourceHash);
|
|
42
|
+
if (input.scenarioId && (input.mode !== "isolated" || !source.scenarioIds.includes(input.scenarioId))) throw new CapabilityError("INVALID_INPUT", "Unknown isolated acceptance scenario");
|
|
43
|
+
const scopes = LocalAppResourceScopesSchema.parse(input.resourceScopes ?? {});
|
|
44
|
+
if (input.mode === "readonly" && (scopes.notesWrite.mode !== "none" || scopes.tasksWrite.mode !== "none" || scopes.projectsWrite.mode !== "none" || scopes.filesExport || scopes.filesImport || scopes.connectors.mode !== "none" || scopes.agentDelegate || scopes.automationProposals || scopes.automationsRun.mode !== "none")) throw new CapabilityError("FORBIDDEN", "Real preview is read-only");
|
|
45
|
+
if (input.mode !== "readonly" && input.resourceScopes) throw new CapabilityError("INVALID_INPUT", "Synthetic previews do not accept production resource grants");
|
|
46
|
+
const bindings = source.bindings.filter((binding) => binding.id !== "xopc.agent.delegate" && !/xopc\.(files|connectors|apps)\./.test(binding.id) && !binding.id.startsWith("xopc.automations.") && (input.mode !== "readonly" || /\.(get|list|list_milestones|list_updates)$/.test(binding.id)));
|
|
47
|
+
const session = {
|
|
48
|
+
id: randomUUID(),
|
|
49
|
+
appId,
|
|
50
|
+
extensionId: source.extensionId,
|
|
51
|
+
sourceHash: source.sourceHash,
|
|
52
|
+
mode: input.mode,
|
|
53
|
+
expiresAt: Date.now() + TTL,
|
|
54
|
+
previewUrl: `${source.previewUrl}?xopcRuntime=${encodeURIComponent(LOCAL_APP_RUNTIME_BRIDGE_HASH)}`,
|
|
55
|
+
bindings,
|
|
56
|
+
permissions: source.permissions.filter((permission) => [
|
|
57
|
+
"theme",
|
|
58
|
+
"storage",
|
|
59
|
+
"notification"
|
|
60
|
+
].includes(permission)).concat(bindings.map((binding) => `capability:${binding.id}`))
|
|
61
|
+
};
|
|
62
|
+
const timer = setTimeout(() => this.revoke(session.id), TTL);
|
|
63
|
+
timer.unref?.();
|
|
64
|
+
const lease = {
|
|
65
|
+
session,
|
|
66
|
+
scopes,
|
|
67
|
+
owner: caller.principalId,
|
|
68
|
+
lastUsedAt: Date.now(),
|
|
69
|
+
storage: /* @__PURE__ */ new Map(),
|
|
70
|
+
timer,
|
|
71
|
+
queue: Promise.resolve()
|
|
72
|
+
};
|
|
73
|
+
this.leases.set(session.id, lease);
|
|
74
|
+
try {
|
|
75
|
+
if (input.mode !== "readonly") {
|
|
76
|
+
const deadline = Date.now() + 2e3;
|
|
77
|
+
while ([...this.leases.values()].filter((item) => item.worker).length + this.closingWorkers.size >= 4 && this.closingWorkers.size && Date.now() < deadline) await new Promise((resolve) => setTimeout(resolve, 20));
|
|
78
|
+
this.current(session.id, caller);
|
|
79
|
+
if ([...this.leases.values()].filter((item) => item.worker).length + this.closingWorkers.size >= 4) throw new CapabilityError("UNAVAILABLE", "Too many isolated preview workers");
|
|
80
|
+
const root = join(this.stateRoot(), "local-apps", "preview-runs");
|
|
81
|
+
mkdirSync(root, {
|
|
82
|
+
recursive: true,
|
|
83
|
+
mode: 448
|
|
84
|
+
});
|
|
85
|
+
lease.directory = mkdtempSync(join(root, "run-"));
|
|
86
|
+
const built = new URL("./preview-worker.js", import.meta.url);
|
|
87
|
+
const compiled = existsSync(built);
|
|
88
|
+
lease.worker = forkWorker(fileURLToPath(compiled ? built : new URL("./preview-worker.ts", import.meta.url)), {
|
|
89
|
+
cwd: lease.directory,
|
|
90
|
+
execArgv: ["--max-old-space-size=192", ...compiled ? [] : ["--import", import.meta.resolve("tsx")]],
|
|
91
|
+
env: {
|
|
92
|
+
PATH: process.env.PATH,
|
|
93
|
+
XOPC_LOCAL_APP_PREVIEW_WORKER: "1",
|
|
94
|
+
XOPC_STATE_DIR: lease.directory,
|
|
95
|
+
XOPC_WORKSPACE: lease.directory,
|
|
96
|
+
XOPC_SQLITE_ASSET_ROOT: process.env.XOPC_SQLITE_ASSET_ROOT,
|
|
97
|
+
XOPC_LOG_LEVEL: "fatal",
|
|
98
|
+
XOPC_LOG_CONSOLE: "false",
|
|
99
|
+
ELECTRON_RUN_AS_NODE: "1"
|
|
100
|
+
},
|
|
101
|
+
stdio: [
|
|
102
|
+
"ignore",
|
|
103
|
+
"ignore",
|
|
104
|
+
"pipe",
|
|
105
|
+
"ipc"
|
|
106
|
+
],
|
|
107
|
+
serialization: "json"
|
|
108
|
+
});
|
|
109
|
+
let workerStderr = "";
|
|
110
|
+
lease.worker.stderr?.on("data", (chunk) => {
|
|
111
|
+
workerStderr = (workerStderr + chunk.toString()).slice(-4e3);
|
|
112
|
+
});
|
|
113
|
+
lease.worker.unref();
|
|
114
|
+
lease.worker.channel?.unref();
|
|
115
|
+
const directory = lease.directory;
|
|
116
|
+
lease.worker.once("exit", (code, signal) => {
|
|
117
|
+
if (this.leases.has(session.id)) log.error({
|
|
118
|
+
sessionId: session.id,
|
|
119
|
+
code,
|
|
120
|
+
signal,
|
|
121
|
+
workerStderr
|
|
122
|
+
}, "Isolated preview worker exited unexpectedly");
|
|
123
|
+
this.revoke(session.id);
|
|
124
|
+
rmSync(directory, {
|
|
125
|
+
recursive: true,
|
|
126
|
+
force: true
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
await this.rpc(lease, {
|
|
130
|
+
type: "init",
|
|
131
|
+
fixtures: readPreviewFixtures(source.root),
|
|
132
|
+
bindings
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
this.current(session.id, caller);
|
|
136
|
+
return structuredClone(session);
|
|
137
|
+
} catch (error) {
|
|
138
|
+
this.revoke(session.id);
|
|
139
|
+
throw error;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
current(id, caller) {
|
|
143
|
+
const lease = this.leases.get(id);
|
|
144
|
+
if (!lease || lease.owner !== caller.principalId || lease.session.expiresAt <= Date.now()) throw new CapabilityError("FORBIDDEN", "Preview authorization expired or was revoked");
|
|
145
|
+
if (caller.signal?.aborted) throw new CapabilityError("CANCELLED", "Preview request cancelled");
|
|
146
|
+
try {
|
|
147
|
+
this.assertSource(lease.session.appId, lease.session.sourceHash);
|
|
148
|
+
} catch (error) {
|
|
149
|
+
this.revoke(id);
|
|
150
|
+
throw error;
|
|
151
|
+
}
|
|
152
|
+
lease.lastUsedAt = Date.now();
|
|
153
|
+
return lease;
|
|
154
|
+
}
|
|
155
|
+
describe(id, caller, dispatcher) {
|
|
156
|
+
const lease = this.current(id, caller);
|
|
157
|
+
const context = {
|
|
158
|
+
...caller,
|
|
159
|
+
surface: "extension",
|
|
160
|
+
allowedCapabilities: lease.session.bindings.map((binding) => binding.id).filter((capability) => !caller.allowedCapabilities || caller.allowedCapabilities.includes(capability))
|
|
161
|
+
};
|
|
162
|
+
return {
|
|
163
|
+
session: structuredClone(lease.session),
|
|
164
|
+
capabilities: dispatcher.list(context).filter((descriptor) => lease.session.bindings.some((binding) => binding.id === descriptor.id && binding.majorVersion === descriptor.majorVersion && binding.descriptorDigest === descriptor.descriptorDigest))
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
async call(sessionId, id, call, caller, dispatcher) {
|
|
168
|
+
const lease = this.current(sessionId, caller);
|
|
169
|
+
const binding = lease.session.bindings.find((item) => item.id === id);
|
|
170
|
+
if (!binding) throw new CapabilityError("FORBIDDEN", "Capability is not available in this preview");
|
|
171
|
+
if (binding.majorVersion !== call.majorVersion || binding.descriptorDigest !== call.descriptorDigest) throw new CapabilityError("CONTRACT_CHANGED", "Preview contract changed");
|
|
172
|
+
if (lease.session.mode === "readonly") return localAppCapabilities({ getCapabilityAccess: () => {
|
|
173
|
+
this.current(sessionId, caller);
|
|
174
|
+
return {
|
|
175
|
+
releaseId: `preview:${lease.session.sourceHash}`,
|
|
176
|
+
grantRevision: sessionId,
|
|
177
|
+
bindings: lease.session.bindings,
|
|
178
|
+
resourceScopes: lease.scopes
|
|
179
|
+
};
|
|
180
|
+
} }, dispatcher, lease.session.extensionId, lease.session.sourceHash, caller, sessionId).call(id, call);
|
|
181
|
+
const input = await dispatcher.validateInput(id, call.input, {
|
|
182
|
+
...caller,
|
|
183
|
+
surface: "extension",
|
|
184
|
+
allowedCapabilities: lease.session.bindings.map((item) => item.id).filter((item) => !caller.allowedCapabilities || caller.allowedCapabilities.includes(item)),
|
|
185
|
+
assertCurrent: () => {
|
|
186
|
+
caller.assertCurrent?.();
|
|
187
|
+
this.current(sessionId, caller);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
const operation = lease.queue.then(async () => {
|
|
191
|
+
this.current(sessionId, caller);
|
|
192
|
+
const data = await this.rpc(lease, {
|
|
193
|
+
type: "call",
|
|
194
|
+
id,
|
|
195
|
+
call: {
|
|
196
|
+
majorVersion: call.majorVersion,
|
|
197
|
+
descriptorDigest: call.descriptorDigest,
|
|
198
|
+
idempotencyKey: call.idempotencyKey,
|
|
199
|
+
input
|
|
200
|
+
}
|
|
201
|
+
});
|
|
202
|
+
this.current(sessionId, caller);
|
|
203
|
+
return {
|
|
204
|
+
status: "succeeded",
|
|
205
|
+
releaseId: `preview:${lease.session.sourceHash}`,
|
|
206
|
+
data
|
|
207
|
+
};
|
|
208
|
+
});
|
|
209
|
+
lease.queue = operation.catch(() => {});
|
|
210
|
+
return operation;
|
|
211
|
+
}
|
|
212
|
+
storage(id, caller, method, key = "", value) {
|
|
213
|
+
const lease = this.current(id, caller);
|
|
214
|
+
if (!lease.session.permissions.includes("storage")) throw new CapabilityError("FORBIDDEN", "Preview storage is not declared");
|
|
215
|
+
if (key.length > 512 || [
|
|
216
|
+
"__proto__",
|
|
217
|
+
"constructor",
|
|
218
|
+
"prototype"
|
|
219
|
+
].includes(key)) throw new CapabilityError("INVALID_INPUT", "Invalid storage key");
|
|
220
|
+
if (method === "storage.keys") return [...lease.storage.keys()];
|
|
221
|
+
if (method === "storage.get") return lease.storage.get(key);
|
|
222
|
+
if (method === "storage.remove") {
|
|
223
|
+
lease.storage.delete(key);
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
if (method === "storage.set") {
|
|
227
|
+
const candidate = new Map(lease.storage);
|
|
228
|
+
candidate.set(key, value);
|
|
229
|
+
if (Buffer.byteLength(JSON.stringify([...candidate])) > 5e6) throw new CapabilityError("INVALID_INPUT", "Preview storage quota exceeded");
|
|
230
|
+
lease.storage = candidate;
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
throw new CapabilityError("INVALID_INPUT", "Unknown preview storage method");
|
|
234
|
+
}
|
|
235
|
+
remove(id, caller) {
|
|
236
|
+
const lease = this.leases.get(id);
|
|
237
|
+
if (lease && lease.owner !== caller.principalId) throw new CapabilityError("FORBIDDEN", "Preview belongs to another caller");
|
|
238
|
+
this.revoke(id);
|
|
239
|
+
}
|
|
240
|
+
revokeApp(appId) {
|
|
241
|
+
for (const lease of this.leases.values()) if (lease.session.appId === appId) this.revoke(lease.session.id);
|
|
242
|
+
}
|
|
243
|
+
async close() {
|
|
244
|
+
const workers = new Set([...this.leases.values()].map((lease) => lease.worker).filter((worker) => Boolean(worker)));
|
|
245
|
+
for (const worker of this.closingWorkers) workers.add(worker);
|
|
246
|
+
const exits = [...workers].map((worker) => {
|
|
247
|
+
if (!worker.pid || worker.exitCode !== null || worker.signalCode !== null) return Promise.resolve();
|
|
248
|
+
return new Promise((resolve) => worker.once("exit", () => resolve()));
|
|
249
|
+
});
|
|
250
|
+
for (const id of [...this.leases.keys()]) this.revoke(id);
|
|
251
|
+
await Promise.all(exits);
|
|
252
|
+
}
|
|
253
|
+
revoke(id) {
|
|
254
|
+
const lease = this.leases.get(id);
|
|
255
|
+
if (!lease) return;
|
|
256
|
+
this.leases.delete(id);
|
|
257
|
+
clearTimeout(lease.timer);
|
|
258
|
+
lease.storage.clear();
|
|
259
|
+
if (lease.worker?.pid && lease.worker.exitCode === null && lease.worker.signalCode === null) {
|
|
260
|
+
this.closingWorkers.add(lease.worker);
|
|
261
|
+
lease.worker.kill("SIGTERM");
|
|
262
|
+
const timer = setTimeout(() => lease.worker?.kill("SIGKILL"), 1e3);
|
|
263
|
+
timer.unref?.();
|
|
264
|
+
lease.worker.once("exit", () => {
|
|
265
|
+
clearTimeout(timer);
|
|
266
|
+
this.closingWorkers.delete(lease.worker);
|
|
267
|
+
});
|
|
268
|
+
} else if (lease.directory) rmSync(lease.directory, {
|
|
269
|
+
recursive: true,
|
|
270
|
+
force: true
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
rpc(lease, payload) {
|
|
274
|
+
return new Promise((resolve, reject) => {
|
|
275
|
+
const worker = lease.worker;
|
|
276
|
+
const requestId = randomUUID();
|
|
277
|
+
const cleanup = () => {
|
|
278
|
+
clearTimeout(timer);
|
|
279
|
+
worker.off("message", message);
|
|
280
|
+
worker.off("exit", exit);
|
|
281
|
+
worker.off("error", exit);
|
|
282
|
+
};
|
|
283
|
+
const exit = () => {
|
|
284
|
+
cleanup();
|
|
285
|
+
reject(new CapabilityError("UNAVAILABLE", "Isolated preview worker stopped"));
|
|
286
|
+
};
|
|
287
|
+
const message = (result) => {
|
|
288
|
+
if (result.requestId !== requestId) return;
|
|
289
|
+
cleanup();
|
|
290
|
+
if (result.error) {
|
|
291
|
+
if (result.error.diagnostic) log.error({
|
|
292
|
+
sessionId: lease.session.id,
|
|
293
|
+
errorMessage: result.error.diagnostic
|
|
294
|
+
}, "Isolated preview worker failed");
|
|
295
|
+
reject(new CapabilityError(result.error.code, result.error.message));
|
|
296
|
+
} else resolve(result.data);
|
|
297
|
+
};
|
|
298
|
+
const timer = setTimeout(() => {
|
|
299
|
+
cleanup();
|
|
300
|
+
this.revoke(lease.session.id);
|
|
301
|
+
reject(new CapabilityError("UNAVAILABLE", "Isolated preview timed out"));
|
|
302
|
+
}, 1e4);
|
|
303
|
+
worker.on("message", message);
|
|
304
|
+
worker.once("exit", exit);
|
|
305
|
+
worker.once("error", exit);
|
|
306
|
+
worker.send({
|
|
307
|
+
...payload,
|
|
308
|
+
requestId
|
|
309
|
+
}, (error) => {
|
|
310
|
+
if (error) exit();
|
|
311
|
+
});
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
//#endregion
|
|
316
|
+
export { LocalAppPreviewSessions };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|