@xopcai/xopc 0.0.465 → 0.0.466
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/dingtalk/src/index.d.ts +8 -0
- package/dist/extensions/dingtalk/src/index.js +159 -0
- package/dist/extensions/dingtalk/xopc.extension.json +131 -0
- package/dist/extensions/discord/src/gateway.d.ts +13 -0
- package/dist/extensions/discord/src/gateway.js +186 -0
- package/dist/extensions/discord/src/index.d.ts +8 -0
- package/dist/extensions/discord/src/index.js +184 -0
- package/dist/extensions/discord/xopc.extension.json +113 -0
- package/dist/extensions/feishu/src/adapters/gateway-setup.js +33 -26
- package/dist/extensions/slack/src/index.d.ts +8 -0
- package/dist/extensions/slack/src/index.js +169 -0
- package/dist/extensions/slack/src/manifest.d.ts +33 -0
- package/dist/extensions/slack/src/manifest.js +32 -0
- package/dist/extensions/slack/xopc.extension.json +124 -0
- package/dist/extensions/telegram/src/adapters/gateway-setup.js +4 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/wecom/src/index.d.ts +8 -0
- package/dist/extensions/wecom/src/index.js +188 -0
- package/dist/extensions/wecom/xopc.extension.json +131 -0
- package/dist/gateway/static/root/assets/{activity-store-B9heFbtJ.js → activity-store-CdEua6PR.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-nzhB7Xjk.js → agent-avatar-dicebear-l8GQ4I9J.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-display-DBzgoHMD.js → agent-avatar-display-BO1bqKlR.js} +2 -2
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-BJrNV93g.js → agent-defaults-settings-panel-Dj_H2kDD.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-DLbTHALG.js → agent-plugin-dialog-BQA2brAU.js} +1 -1
- package/dist/gateway/static/root/assets/agents-C5C5l13A.js +77 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-CqQbYIiY.js → agents-admin-api-DZ1lLnrj.js} +1 -1
- package/dist/gateway/static/root/assets/api-CG-SjNfw.js +1 -0
- package/dist/gateway/static/root/assets/{api-BGodd--L.js → api-DDWYNF7I.js} +1 -1
- package/dist/gateway/static/root/assets/{api-8tNOT72p.js → api-DVXcGKP-.js} +1 -1
- package/dist/gateway/static/root/assets/{app-link-DImAfVs5.js → app-link-BkEO3eBe.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-Q7apF7KE.js → app-management-settings-panel-B5-7E03Z.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-ClVZeUmo.js → appearance-settings-E_BcjEDM.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-BsJJwpKj.js → apps-page-BjB_mjXu.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-Bl_M0WJp.js → archive-plugin-MvSiDvxK.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-api-BOnIc_vw.js → automation-api-24NjW7qG.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-result-state-BwDSJs05.js → automation-result-state-C94Q3OEL.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-run-list-CqlIq4BG.js → automation-run-list-BShRirWV.js} +1 -1
- package/dist/gateway/static/root/assets/automation-task-card-Bgq5Plux.js +2 -0
- package/dist/gateway/static/root/assets/{automations-page-Bimqx5Pc.js → automations-page-_apIsCPT.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-WmcQUi9O.js +9 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DDNKe1Io.js → binary-plugins-C7i5pqkO.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BQ3amsRP.js → block-editor-DAWXPErA.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-settings-page-CHf1_RVl.js → browser-settings-page-DI2PYAPC.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-C5oWMC-Z.js → capabilities-CFWTer_v.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-Cj8vl1ZY.js → capabilities-Dyw8xW90.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-C2RB9fzC.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DuQGhgAl.js +8 -0
- package/dist/gateway/static/root/assets/{capability-navigation-QtHJxxW2.js → capability-navigation-CZbCI5C2.js} +1 -1
- package/dist/gateway/static/root/assets/channels-DiDfjON8.js +1 -0
- package/dist/gateway/static/root/assets/{chat-agents-api-C3JChTsh.js → chat-agents-api-BksS0CNy.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-chart-block-DrtmYOIo.js → chat-chart-block-aZIklMNN.js} +1 -1
- package/dist/gateway/static/root/assets/chat-page-BMZwIVXH.js +71 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-B0D220I-.js → chat-terminal-dock-B4HoRIzf.js} +1 -1
- package/dist/gateway/static/root/assets/{command-palette-api-CkJ6_Yf3.js → command-palette-api-VhBEUFmw.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-handoff-params-GKGdXjMZ.js → composer-handoff-params-DBpzHuNo.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-model-config-control-DQCOWHzJ.js → composer-model-config-control-BhRAbdPW.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-notifications-D__OU_xx.js → composer-notifications-nT-U6jcc.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-payload-handoff-BBTbJ1bO.js → composer-payload-handoff-xEFHDnLo.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-DGRUCkOt.js → computer-settings-page-DXlH96m6.js} +1 -1
- package/dist/gateway/static/root/assets/{connected-providers-grid-BoDipD2g.js → connected-providers-grid-D8vBFsbY.js} +1 -1
- package/dist/gateway/static/root/assets/{connection-usage-guide-B1VUqibv.js → connection-usage-guide-C8jPm7QO.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-bwQ1PekA.js → connector-service-page-B42yWHxS.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-BvYGL65q.js → connectors-api-so2a7xrD.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-BX6Jt6w5.js → connectors-page-yhOZIiUZ.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-ClRDaNBJ.js → date-picker-UEh3JM7r.js} +1 -1
- package/dist/gateway/static/root/assets/{date-time-picker-CA6H47M6.js → date-time-picker-Dci0LfAU.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Bi8Hgf-x.js → desktop-pet-BAU_GuBe.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CQ6qE8lf.js → desktop-pet-settings-CYE2eTTf.js} +1 -1
- package/dist/gateway/static/root/assets/{dev-view-store-UCqQeWa2.js → dev-view-store-C7v4CIlF.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-gC-XZxt2.js → device-pairing-wizard-7NDkYmiZ.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-Y8snl5Xl.js → directory-picker-path-field-DmRZY8kg.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-authoritative-grants-D2abOXTl.js → extension-authoritative-grants-DIeg1mg8.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-OOlRCInL.js → extension-debug-page-D8TAJgZ_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-D_WXBf6a.js → extension-iframe-host-CjfRKtQ4.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-marketplace-api-Bmtm6-L1.js → extension-marketplace-api-V1oFBxVi.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-message-router-xqjjSxcp.js → extension-message-router-DZahH1Hd.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-bpQnyNz-.js → extension-page-DMuHBIHa.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-l7SvHEK1.js → extension-provider-lqJ1zIkA.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BvUtZGLT.js → extension-settings-page-D5IfKVff.js} +1 -1
- package/dist/gateway/static/root/assets/{file-preview-surface-B-r2ZnCV.js → file-preview-surface-B7B9qXm9.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-DOwezeL2.js → gateway-config-swr-Dk3FtNv1.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-Br7dErHY.js → gateway-realtime-DMvo4pAc.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-CJf-qaHZ.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-restart-B3Xro3qd.js → gateway-restart-C2h5R1eP.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-DCnP-HPj.js → gateway-settings-DGPaikv5.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-vteSIhYI.js → gateway-startup-retry-yZn7ShiP.js} +1 -1
- package/dist/gateway/static/root/assets/{global-defaults-api-Bpje9rVk.js → global-defaults-api-gsAa0Kj9.js} +1 -1
- package/dist/gateway/static/root/assets/{home-page-CNEgNWEQ.js → home-page-Dgopm60U.js} +3 -3
- package/dist/gateway/static/root/assets/{image-generation-api-BvpAa3Lj.js → image-generation-api-DPn1SBMH.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-Dx5T5pqw.js → imports-page-Cc48Uq20.js} +1 -1
- package/dist/gateway/static/root/assets/index-BE3XMuQI.js +11 -0
- package/dist/gateway/static/root/assets/index-CY5vdQcc.css +1 -0
- package/dist/gateway/static/root/assets/{install-connector-dialog-Cb4ufypG.js → install-connector-dialog-QkJMw_uW.js} +1 -1
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-BEuXrnv0.js → keyboard-shortcuts-settings-BZXqXuI4.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-CPFIbEbv.js → local-app-workbench-page-wekatwet.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-DxHcRSxc.js → local-apps-page-D-bRvlZY.js} +1 -1
- package/dist/gateway/static/root/assets/{local-session-drafts-Cmc-GCVa.js → local-session-drafts-CZ19DRRK.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-tI9VX7dp.js → locale-store-DIBIYLnI.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-BcibwftP.js → logs-page-CukseY3k.js} +1 -1
- package/dist/gateway/static/root/assets/{management-api-C9tFjLcE.js → management-api-EG5duPec.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-DbnAlXoB.js → management-settings-B7RWHrwo.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-CSpQhSka.js → markdown-view-C30KvTaE.js} +1 -1
- package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-DedbjJbF.js → mcp-conversation-setup-page-BZ1PDTYY.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-BYnP_orq.js → media-plugins-DlMEwcS8.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BDBGlBKh.js +3 -0
- package/dist/gateway/static/root/assets/{model-selector-B4oTiJI6.js → model-selector-COGICRIG.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-cache-DpEClnsE.js → models-hub-cache-aRYHi2dh.js} +1 -1
- package/dist/gateway/static/root/assets/new-chat-navigation-DXYDldT_.js +1 -0
- package/dist/gateway/static/root/assets/{note-detail-panel-D8asMfBm.js → note-detail-panel-yAPC_cZU.js} +3 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-CxXu_Tkh.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-pVC1amyp.js → notes-api-BXevQivV.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CG1_6PLz.js → notes-page-CUMhjKKd.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-api-BsVPwufr.js → oauth-api-enDU_32p.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-provider-connect-Bu20kmPq.js → oauth-provider-connect-C2pfvPOI.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-CDsnNXjS.js → page-context-capture-button-BaSooYGv.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-draft-D6tu8c_9.js → page-context-draft-4-3RtO0q.js} +1 -1
- package/dist/gateway/static/root/assets/page-header-store-C2ydtnXa.js +1 -0
- package/dist/gateway/static/root/assets/{personal-avatar-BboNc6e2.js → personal-avatar-BPQpvC34.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-POCG1_kK.js +1 -0
- package/dist/gateway/static/root/assets/{personal-profile-settings-Cd4QyseL.js → personal-profile-settings-DwMdjQ6H.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-settings-panel-CtBY_Uk1.js → personal-settings-panel-DiNpP_g3.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-dependencies-card-BgH1LluB.js → phone-dependencies-card-DUT-qRLZ.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-connection-DkdKU5Kv.js → phone-model-connection-pvOciDNo.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-picker-0g1z4RPL.js → phone-model-picker-CD97E6C5.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-settings-page-DlIUajBY.js → phone-settings-page-BUZ1dh7s.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-workspace-store-DW2sZtkh.js → phone-workspace-store-BwilERgv.js} +1 -1
- package/dist/gateway/static/root/assets/{plugin-details-dialog-9KUkZk_t.js → plugin-details-dialog-C_uOVmJv.js} +1 -1
- package/dist/gateway/static/root/assets/{preference-select-fields-DH5QZhIc.js → preference-select-fields-BSUgcO7-.js} +1 -1
- package/dist/gateway/static/root/assets/{product-automation-feedback-a1thJ0M9.js → product-automation-feedback-BlwtlUY7.js} +1 -1
- package/dist/gateway/static/root/assets/product-delivery-CnvCn9L-.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-DCzQh7tr.js → product-open-page-Dy6D5exJ.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-C5TLcagj.js → product-preview-content-DEUPAilo.js} +1 -1
- package/dist/gateway/static/root/assets/product-preview-modal-C4TV9RUd.js +2 -0
- package/dist/gateway/static/root/assets/project-detail-page-BjOzJyw1.js +7 -0
- package/dist/gateway/static/root/assets/{project-understanding-CoPBvlqf.js → project-understanding-lOJ5Tz2V.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-k1v8Fry8.js → projects-page-B3aGdPHy.js} +1 -1
- package/dist/gateway/static/root/assets/{providers-api-BSJZyO8n.js → providers-api-C26HgxZY.js} +1 -1
- package/dist/gateway/static/root/assets/{recording-upload-CExCePtr.js → recording-upload-BJkXktA-.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-CqcJj60w.js → registry-api-pQ0eInzG.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-BLFkNl1y.js → remote-access-hub-CjWrYzjf.js} +1 -1
- package/dist/gateway/static/root/assets/{resource-unavailable-B_BXTQa7.js → resource-unavailable-Y9WRHOnz.js} +1 -1
- package/dist/gateway/static/root/assets/{right-workspace-store-OceFhUjM.js → right-workspace-store-DHHyicqQ.js} +1 -1
- package/dist/gateway/static/root/assets/route-preload-DjYsRhY1.js +2 -0
- package/dist/gateway/static/root/assets/{routine-panel-BsE9o9uu.js → routine-panel-DSNsdpy8.js} +2 -2
- package/dist/gateway/static/root/assets/{runtime-tools-api-aAZChVm4.js → runtime-tools-api-BoJQ3u5o.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Bn9HTrK5.js → runtime-tools-settings-panel-DB7cfLrX.js} +1 -1
- package/dist/gateway/static/root/assets/schema-form-DXHzZPMr.js +1 -0
- package/dist/gateway/static/root/assets/send-1f1Ntw6E.js +1 -0
- package/dist/gateway/static/root/assets/{service-recommendation-list-BNIVRGDf.js → service-recommendation-list-_rFmwIwY.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-DdW7Wix2.js → session-api-a6wb0_Gf.js} +1 -1
- package/dist/gateway/static/root/assets/{session-channel-icon-DUJbB-Km.js → session-channel-icon-COynhpeK.js} +1 -1
- package/dist/gateway/static/root/assets/{session-identity-label-DjhlQ6LU.js → session-identity-label-DCIZvqbN.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-D5g6LOU-.js +25 -0
- package/dist/gateway/static/root/assets/{sessions-page-CfhKeUkZ.js → sessions-page-dEupc-3A.js} +1 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-DjyibJZ1.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-section-BOoJfJuB.js → settings-advanced-section-CnGJr2xp.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-mode-store-BMh_BQ9a.js → settings-mode-store-DWRhupcY.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-Bfu4cuQd.js → settings-page-header-wL2jvs-y.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-BnZa1qHH.js → settings-page-layout-BkUQVmyY.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-M6XwzIyu.js → settings-page-u-U9D9qT.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-interaction-page-CVlrVNrm.js → setup-interaction-page-D238tuw-.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-FFyDODEx.js → setup-status-panel-DXvYjIu3.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-Cv-eDEw_.js → share-link-dialog-DFDJyl3N.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-BctH6eFs.js → share-preview-page-BYPdlPIb.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-cLTEcQLE.js → shares-api-CfFiW03g.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-DcetAN8K.js → shares-settings-B85XIDFv.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-api-CgEZJoy9.js → skill-api-CWRhFSkA.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-list-api-BWVr2PL5.js → skill-list-api-CmPp2czp.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-BLhHNvaK.js → skill-reload-api-BGsSq3dj.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-DIjcAvA0.js → skills-page-DqD0FPeH.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-C7LAPaN_.js → system-settings-panel-aw9C86I8.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-BPHt6S1V.js +3 -0
- package/dist/gateway/static/root/assets/{task-result-evidence-BsBn3n_l.js → task-result-evidence-C-zIBpzi.js} +1 -1
- package/dist/gateway/static/root/assets/{terminal-panel-store-DJbLuUku.js → terminal-panel-store-CgPqgrm7.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-QGcjV6pN.js → theme-store-DxF7S6I2.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-BKCiPwYL.js → tracing-settings-page-Dvlunx28.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-S7J5Lpzt.js → tunnel-api-CIte6n0U.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-activity-store-BNVhtJkn.js → understanding-activity-store-C2RHmRo8.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-refresh-store-CM6bUcaJ.js → understanding-refresh-store-CPeQIXS_.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-D-AqzjIx.js → usage-page-DPUjEj39.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-CqZbhhCc.js → use-autosave-xX2KrbXw.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-BfLhIb2_.js → use-composer-attachments-UhypPQH_.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-DufxDues.js → use-file-preview-expanded-BvEF3yHL.js} +3 -3
- package/dist/gateway/static/root/assets/{use-personal-profile-RnjxZnLa.js → use-personal-profile-BJgaheR4.js} +1 -1
- package/dist/gateway/static/root/assets/{use-realtime-voice-w3aHR2dr.js → use-realtime-voice-RQW5KnIN.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-2Ck-ql5c.js → use-workspace-tree-B6QFV5gR.js} +1 -1
- package/dist/gateway/static/root/assets/{user-model-page-CBcGMhrR.js → user-model-page-hKnsTcMk.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-api-key-field-C4rhpgco.js → voice-api-key-field-BeEF7Thh.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-7AHN-ns6.js → voice-config-api-vbBoKnqd.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-input-shortcut-events-BbRrj833.js → voice-input-shortcut-events-CKn6X3qL.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-settings-wamtp0lg.js → voice-settings-BUrk4mwV.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-fVofN7aP.js → work-discovery-overlay-Ddvqu02U.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-DcQG5GWy.js → work-discovery-page-BdBpri6P.js} +1 -1
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-D8Stwszr.js → working-directory-picker-modal-DStgfCzQ.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-api-D3iuTdNK.js → workspace-api-CscTRODe.js} +2 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-CyPjTDSx.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-BXbL5Y1h.js → workspace-file-preview-dialog-BRQIf4sc.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-1gFO_BdL.js → workspace-open-location-menu-CBHFZ2iQ.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-preview-store-adwmi4nx.js → workspace-preview-store-DNLnuHlf.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-DhGh4rm7.js → xopc-cloud-account-card-Cm0Saa8B.js} +1 -1
- package/dist/gateway/static/root/index.html +99 -97
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/index.js +2 -0
- package/dist/packages/gateway-contract/src/product-delivery.js +2 -0
- package/dist/packages/gateway-contract/src/video-generation.js +75 -0
- package/dist/src/agent/embedded/runs.d.ts +1 -0
- package/dist/src/agent/embedded/runs.js +5 -2
- package/dist/src/agent/inbound/attachment-pipeline.d.ts +1 -1
- package/dist/src/agent/inbound/attachment-pipeline.js +16 -10
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +2 -0
- package/dist/src/agent/inbound/turn-dispatcher.js +31 -13
- package/dist/src/agent/messaging/outbound-coordinator.js +1 -0
- package/dist/src/agent/prompt/service-prompt-builder.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.js +12 -1
- package/dist/src/channels/bundled-channel-extensions.d.ts +1 -0
- package/dist/src/channels/bundled-channel-extensions.js +15 -0
- package/dist/src/channels/enterprise/config-surface.d.ts +1 -0
- package/dist/src/channels/enterprise/config-surface.js +19 -0
- package/dist/src/channels/enterprise/plugin.d.ts +39 -0
- package/dist/src/channels/enterprise/plugin.js +219 -0
- package/dist/src/channels/enterprise/setup.d.ts +34 -0
- package/dist/src/channels/enterprise/setup.js +262 -0
- package/dist/src/channels/enterprise/socket.d.ts +12 -0
- package/dist/src/channels/enterprise/socket.js +107 -0
- package/dist/src/channels/lifecycle-supervisor.js +11 -1
- package/dist/src/channels/plugin-types.d.ts +9 -0
- package/dist/src/channels/plugins/types.adapters.d.ts +12 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/extensions/activation-planner.js +8 -2
- package/dist/src/extensions/bundled-extension-activation.js +9 -0
- package/dist/src/gateway/hono/app.js +6 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +2 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +2 -1
- package/dist/src/gateway/hono/routes/channels.js +2 -1
- package/dist/src/gateway/hono/routes/home.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +8 -0
- package/dist/src/gateway/hono/routes/video-generation.d.ts +3 -0
- package/dist/src/gateway/hono/routes/video-generation.js +166 -0
- package/dist/src/gateway/security/gateway-scopes.js +2 -0
- package/dist/src/gateway/service/session-input-coordinator.d.ts +2 -0
- package/dist/src/gateway/service/session-input-coordinator.js +11 -3
- package/dist/src/gateway/service.d.ts +1 -0
- package/dist/src/gateway/service.js +8 -4
- package/dist/src/home-intelligence/host.js +5 -5
- package/dist/src/session/client-history.d.ts +1 -0
- package/dist/src/session/client-history.js +5 -6
- package/dist/src/session/store.js +4 -0
- package/dist/src/storage/sqlite/schema.d.ts +2 -2
- package/dist/src/storage/sqlite/schema.js +7 -7
- package/dist/src/storage/sqlite/schema.sql +31 -0
- package/dist/src/storage/sqlite/session-input-repository.js +5 -2
- package/dist/src/storage/sqlite/transcript-repository.js +12 -0
- package/dist/src/storage/sqlite/upgrades/275_video_generation.sql +28 -0
- package/dist/src/storage/sqlite/upgrades/276_video_provider_selection.sql +11 -0
- package/dist/src/video-generation/artifact.d.ts +5 -0
- package/dist/src/video-generation/artifact.js +91 -0
- package/dist/src/video-generation/provider-types.d.ts +21 -0
- package/dist/src/video-generation/provider-types.js +14 -0
- package/dist/src/video-generation/providers.d.ts +15 -0
- package/dist/src/video-generation/providers.js +72 -0
- package/dist/src/video-generation/repository.d.ts +58 -0
- package/dist/src/video-generation/repository.js +91 -0
- package/dist/src/video-generation/seedance.d.ts +4 -0
- package/dist/src/video-generation/seedance.js +72 -0
- package/dist/src/video-generation/settings.d.ts +5 -0
- package/dist/src/video-generation/settings.js +25 -0
- package/dist/src/video-generation/wan.d.ts +9 -0
- package/dist/src/video-generation/wan.js +59 -0
- package/dist/src/video-generation/worker.d.ts +8 -0
- package/dist/src/video-generation/worker.js +98 -0
- package/package.json +1 -1
- package/dist/gateway/static/root/assets/agents-C2xG8f56.js +0 -77
- package/dist/gateway/static/root/assets/arrow-up-right-T72JbQ1Q.js +0 -1
- package/dist/gateway/static/root/assets/automation-task-card-D3WXVKRs.js +0 -2
- package/dist/gateway/static/root/assets/automations-workspace-2SOvmw-f.js +0 -9
- package/dist/gateway/static/root/assets/capabilities-page-U_hQx5ou.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-k5CcwhXN.js +0 -8
- package/dist/gateway/static/root/assets/channels-BUzno8Pi.js +0 -1
- package/dist/gateway/static/root/assets/chat-page-qnsMsF_s.js +0 -71
- package/dist/gateway/static/root/assets/gateway-realtime-store-OaEqjNTb.js +0 -1
- package/dist/gateway/static/root/assets/index-Cdo4_zon.js +0 -11
- package/dist/gateway/static/root/assets/index-DYTktubl.css +0 -1
- package/dist/gateway/static/root/assets/messages-e5MhDONm.js +0 -3
- package/dist/gateway/static/root/assets/new-chat-navigation-B6NPQ4h4.js +0 -1
- package/dist/gateway/static/root/assets/note-image-lightbox-DcDw5kp4.js +0 -1
- package/dist/gateway/static/root/assets/page-header-store-DeaRqZgV.js +0 -1
- package/dist/gateway/static/root/assets/personal-page-gMRmLCWG.js +0 -1
- package/dist/gateway/static/root/assets/product-delivery-BFfqdKLe.js +0 -1
- package/dist/gateway/static/root/assets/product-preview-modal-D9f-7kcI.js +0 -2
- package/dist/gateway/static/root/assets/project-detail-page-C4Z2HTRZ.js +0 -7
- package/dist/gateway/static/root/assets/route-preload-ClsAFFQc.js +0 -2
- package/dist/gateway/static/root/assets/schema-form-BxBDgLrg.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-XgtApqIh.js +0 -25
- package/dist/gateway/static/root/assets/settings-advanced-gate-BBG8dTIY.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-DmNEMg-l.js +0 -3
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-C-J7vr2o.js +0 -1
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { VIDEO_IMAGE_MAX_BYTES, VIDEO_MODELS, VIDEO_MODEL_REFS, VIDEO_RESOLUTIONS, WAN_VIDEO_MODEL_REF, isVideoDurationSupported } from "../../../../packages/gateway-contract/src/video-generation.js";
|
|
2
|
+
import { init_src } from "../../../../packages/gateway-contract/src/index.js";
|
|
3
|
+
import { readMediaReference } from "../../../media/media-reference.js";
|
|
4
|
+
import { readVideoArtifact } from "../../../video-generation/artifact.js";
|
|
5
|
+
import { getVideoDefaults, getVideoModel, setVideoDefaults, setVideoModel } from "../../../video-generation/settings.js";
|
|
6
|
+
import { enqueueVideoJob, getVideoJob, listVideoJobs } from "../../../video-generation/repository.js";
|
|
7
|
+
import { getConfiguredVideoProviders, getVideoProvider } from "../../../video-generation/providers.js";
|
|
8
|
+
import { resolveScopedMediaReference } from "../../media-access.js";
|
|
9
|
+
import { createHash } from "node:crypto";
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
//#region src/gateway/hono/routes/video-generation.ts
|
|
12
|
+
init_src();
|
|
13
|
+
const settingsPath = "/api/video-generation/settings";
|
|
14
|
+
const modelSchema = z.enum(VIDEO_MODEL_REFS);
|
|
15
|
+
const path = "/api/video-generation/sessions/:conversationId/jobs";
|
|
16
|
+
const requestSchema = z.object({
|
|
17
|
+
id: z.string().uuid(),
|
|
18
|
+
modelRef: modelSchema.default(WAN_VIDEO_MODEL_REF),
|
|
19
|
+
transcriptId: z.string().min(1).max(128),
|
|
20
|
+
prompt: z.string().trim().min(1).max(1e3),
|
|
21
|
+
duration: z.coerce.number().int(),
|
|
22
|
+
ratio: z.enum([
|
|
23
|
+
"16:9",
|
|
24
|
+
"9:16",
|
|
25
|
+
"adaptive"
|
|
26
|
+
]),
|
|
27
|
+
resolution: z.enum(VIDEO_RESOLUTIONS),
|
|
28
|
+
imageUri: z.string().startsWith("media://").max(512).nullable()
|
|
29
|
+
});
|
|
30
|
+
function imageMime(bytes) {
|
|
31
|
+
if (bytes.subarray(0, 8).equals(Buffer.from([
|
|
32
|
+
137,
|
|
33
|
+
80,
|
|
34
|
+
78,
|
|
35
|
+
71,
|
|
36
|
+
13,
|
|
37
|
+
10,
|
|
38
|
+
26,
|
|
39
|
+
10
|
|
40
|
+
]))) return "image/png";
|
|
41
|
+
if (bytes.subarray(0, 3).equals(Buffer.from([
|
|
42
|
+
255,
|
|
43
|
+
216,
|
|
44
|
+
255
|
|
45
|
+
]))) return "image/jpeg";
|
|
46
|
+
if (bytes.toString("ascii", 0, 4) === "RIFF" && bytes.toString("ascii", 8, 12) === "WEBP") return "image/webp";
|
|
47
|
+
}
|
|
48
|
+
async function videoSettings() {
|
|
49
|
+
const configured = await getConfiguredVideoProviders();
|
|
50
|
+
const modelRef = getVideoModel();
|
|
51
|
+
return {
|
|
52
|
+
modelRef,
|
|
53
|
+
defaults: getVideoDefaults(modelRef),
|
|
54
|
+
configured
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function registerVideoGenerationRoutes(app, deps) {
|
|
58
|
+
app.get(settingsPath, async (c) => c.json(await videoSettings()));
|
|
59
|
+
app.put(settingsPath, deps.strictRateLimitMiddleware, async (c) => {
|
|
60
|
+
const parsed = z.object({ modelRef: modelSchema }).safeParse(await c.req.json().catch(() => null));
|
|
61
|
+
if (!parsed.success) return c.json({ error: "Unknown video generation model" }, 400);
|
|
62
|
+
setVideoModel(parsed.data.modelRef);
|
|
63
|
+
return c.json(await videoSettings());
|
|
64
|
+
});
|
|
65
|
+
app.patch(settingsPath, deps.strictRateLimitMiddleware, async (c) => {
|
|
66
|
+
const parsed = z.object({
|
|
67
|
+
modelRef: modelSchema,
|
|
68
|
+
duration: z.number().int(),
|
|
69
|
+
resolution: z.enum(VIDEO_RESOLUTIONS)
|
|
70
|
+
}).safeParse(await c.req.json().catch(() => null));
|
|
71
|
+
if (!parsed.success) return c.json({ error: "Invalid video defaults" }, 400);
|
|
72
|
+
const { modelRef, duration, resolution } = parsed.data;
|
|
73
|
+
const model = VIDEO_MODELS[modelRef];
|
|
74
|
+
if (!isVideoDurationSupported(model, duration) || !model.resolutions.includes(resolution)) return c.json({ error: "The selected model does not support these video defaults" }, 400);
|
|
75
|
+
setVideoDefaults(modelRef, {
|
|
76
|
+
duration,
|
|
77
|
+
resolution
|
|
78
|
+
});
|
|
79
|
+
return c.json(await videoSettings());
|
|
80
|
+
});
|
|
81
|
+
app.get(path, async (c) => {
|
|
82
|
+
const conversationId = c.req.param("conversationId");
|
|
83
|
+
const session = await deps.service.sessionIndexInstance.getSessionMetadata(conversationId);
|
|
84
|
+
if (!session?.transcriptId) return c.json({ error: "Conversation not found" }, 404);
|
|
85
|
+
const modelRef = getVideoModel();
|
|
86
|
+
const configured = Boolean(await getVideoProvider(modelRef).resolveKey().catch(() => void 0));
|
|
87
|
+
return c.json({
|
|
88
|
+
transcriptId: session.transcriptId,
|
|
89
|
+
modelRef,
|
|
90
|
+
configured,
|
|
91
|
+
defaults: getVideoDefaults(modelRef),
|
|
92
|
+
jobs: listVideoJobs(conversationId)
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
app.post(path, deps.strictRateLimitMiddleware, async (c) => {
|
|
96
|
+
const conversationId = c.req.param("conversationId");
|
|
97
|
+
if (!(await deps.service.sessionIndexInstance.getSessionMetadata(conversationId))?.transcriptId) return c.json({ error: "Conversation not found" }, 404);
|
|
98
|
+
const form = await c.req.formData().catch(() => null);
|
|
99
|
+
if (!form) return c.json({ error: "Invalid video request" }, 400);
|
|
100
|
+
const parsed = requestSchema.safeParse({
|
|
101
|
+
id: form.get("id"),
|
|
102
|
+
modelRef: form.get("modelRef") ?? void 0,
|
|
103
|
+
transcriptId: form.get("transcriptId"),
|
|
104
|
+
prompt: form.get("prompt"),
|
|
105
|
+
duration: form.get("duration"),
|
|
106
|
+
ratio: form.get("ratio"),
|
|
107
|
+
resolution: form.get("resolution"),
|
|
108
|
+
imageUri: form.get("imageUri")
|
|
109
|
+
});
|
|
110
|
+
if (!parsed.success) return c.json({ error: "Invalid video settings" }, 400);
|
|
111
|
+
const { imageUri, modelRef, ...request } = parsed.data;
|
|
112
|
+
const upload = form.get("image");
|
|
113
|
+
if (upload !== null && (!(upload instanceof File) || imageUri || !upload.size || upload.size > 5242880)) return c.json({ error: "Provide one PNG, JPEG or WebP image up to 5 MiB" }, 400);
|
|
114
|
+
const model = VIDEO_MODELS[modelRef];
|
|
115
|
+
const hasImage = Boolean(upload || imageUri);
|
|
116
|
+
if (!isVideoDurationSupported(model, request.duration) || !model.resolutions.includes(request.resolution) || hasImage && !model.imageRatios.includes(request.ratio)) return c.json({ error: "The selected model does not support these video settings" }, 400);
|
|
117
|
+
let bytes;
|
|
118
|
+
let imageName = null;
|
|
119
|
+
if (upload instanceof File) {
|
|
120
|
+
bytes = Buffer.from(await upload.arrayBuffer());
|
|
121
|
+
imageName = upload.name.slice(0, 160);
|
|
122
|
+
} else if (imageUri) try {
|
|
123
|
+
const media = await resolveScopedMediaReference(deps.service, imageUri, { conversationId });
|
|
124
|
+
bytes = (await readMediaReference(media.uri, VIDEO_IMAGE_MAX_BYTES)).buffer;
|
|
125
|
+
imageName = media.id;
|
|
126
|
+
} catch {
|
|
127
|
+
return c.json({ error: "Reference image is unavailable in this conversation or exceeds 5 MiB" }, 400);
|
|
128
|
+
}
|
|
129
|
+
const mime = bytes && imageMime(bytes);
|
|
130
|
+
if (bytes && !mime) return c.json({ error: "Reference image must be PNG, JPEG or WebP" }, 400);
|
|
131
|
+
if (bytes && model.provider === "volcengine-ark") {
|
|
132
|
+
const { default: sharp } = await import("sharp");
|
|
133
|
+
const size = await sharp(bytes, { limitInputPixels: 36e6 }).metadata().catch(() => void 0);
|
|
134
|
+
const width = size?.autoOrient.width ?? 0;
|
|
135
|
+
const height = size?.autoOrient.height ?? 0;
|
|
136
|
+
if (width < 300 || height < 300 || width > 6e3 || height > 6e3 || width / height < .4 || width / height > 2.5) return c.json({ error: "Seedance requires a readable image with sides of 300–6000 px and an aspect ratio of 0.4–2.5" }, 400);
|
|
137
|
+
}
|
|
138
|
+
const provider = getVideoProvider(modelRef);
|
|
139
|
+
if (!await provider.resolveKey().catch(() => void 0)) return c.json({ error: `Configure a ${provider.name} API key on the Gateway` }, 503);
|
|
140
|
+
const hash = createHash("sha256").update(JSON.stringify({
|
|
141
|
+
...request,
|
|
142
|
+
imageName
|
|
143
|
+
}));
|
|
144
|
+
if (bytes) hash.update(bytes);
|
|
145
|
+
const result = enqueueVideoJob(conversationId, {
|
|
146
|
+
...request,
|
|
147
|
+
modelRef,
|
|
148
|
+
imageName
|
|
149
|
+
}, hash.digest("hex"), bytes && mime ? {
|
|
150
|
+
bytes,
|
|
151
|
+
mime
|
|
152
|
+
} : void 0);
|
|
153
|
+
if (result.error === "budget_exhausted") return c.json({ error: "The Gateway video generation budget for today has been reached." }, 429);
|
|
154
|
+
if (result.error === "queue_full") return c.json({ error: "The video queue is full. Try again after a task completes." }, 429);
|
|
155
|
+
if (result.error === "model_changed") return c.json({ error: "The video model changed. Review the updated model before submitting." }, 409);
|
|
156
|
+
if (result.error) return c.json({ error: "The conversation or video request changed. Reopen the video form." }, 409);
|
|
157
|
+
return c.json(result.job, 202);
|
|
158
|
+
});
|
|
159
|
+
app.get(`${path}/:jobId/video`, async (c) => {
|
|
160
|
+
const job = getVideoJob(c.req.param("conversationId"), c.req.param("jobId"));
|
|
161
|
+
if (job?.state !== "completed") return c.json({ error: "Video not found" }, 404);
|
|
162
|
+
return readVideoArtifact(job.id, c.req.header("Range"), c.req.query("download") === "1");
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
166
|
+
export { registerVideoGenerationRoutes };
|
|
@@ -44,6 +44,8 @@ function requiredGatewayScope(method, path) {
|
|
|
44
44
|
if (path === "/api/observability" || path.startsWith("/api/observability/")) return "gateway.admin";
|
|
45
45
|
if (path.startsWith("/api/usage")) return "gateway.admin";
|
|
46
46
|
if (path.startsWith("/api/agents") || path.startsWith("/api/models")) return methodScope(method, "agents.read", "gateway.admin");
|
|
47
|
+
if (path === "/api/video-generation/settings") return "gateway.admin";
|
|
48
|
+
if (path.startsWith("/api/video-generation/")) return methodScope(method, "sessions.read", "sessions.write");
|
|
47
49
|
if (path.startsWith("/api/sessions") || path.startsWith("/api/side-chats")) return methodScope(method, "sessions.read", "sessions.write");
|
|
48
50
|
if (path.startsWith("/api/tasks")) return methodScope(method, "tasks.read", "tasks.write");
|
|
49
51
|
if (path === "/api/task-runs" || path.startsWith("/api/task-runs/")) return methodScope(method, "tasks.read", "tasks.write");
|
|
@@ -65,6 +65,8 @@ export declare class SessionInputCoordinator {
|
|
|
65
65
|
attachments?: UserTurnAttachment[];
|
|
66
66
|
sourceContexts?: AgentSourceContext[];
|
|
67
67
|
voiceAgentInstruction?: boolean;
|
|
68
|
+
clientMessageId?: string;
|
|
69
|
+
onHandled?: () => void;
|
|
68
70
|
}) => Promise<boolean>;
|
|
69
71
|
emit: (type: string, payload: unknown) => void;
|
|
70
72
|
});
|
|
@@ -108,7 +108,6 @@ var SessionInputCoordinator = class {
|
|
|
108
108
|
const row = command.inputId ? getSessionInputById(conversationId, command.inputId) : void 0;
|
|
109
109
|
if (!replay && command.action === "steer" && (!row || !canSteerContexts(this.snapshot(conversationId), row.origin, row.contextSnapshots))) throw new SessionInputControlConflict("This input cannot steer the active reply");
|
|
110
110
|
const accepted = acceptSessionInputControl(conversationId, command);
|
|
111
|
-
this.publish(conversationId);
|
|
112
111
|
if (command.action === "steer") {
|
|
113
112
|
if (!accepted.replay && row) try {
|
|
114
113
|
if (!await this.steerInput(row, accepted.runId)) setSessionInputStatus(row.id, "interrupted", {
|
|
@@ -125,6 +124,7 @@ var SessionInputCoordinator = class {
|
|
|
125
124
|
}
|
|
126
125
|
return this.publish(conversationId);
|
|
127
126
|
}
|
|
127
|
+
this.publish(conversationId);
|
|
128
128
|
if (accepted.runId) await this.deps.interrupt?.(conversationId, accepted.runId, "user_stop");
|
|
129
129
|
if ((command.action === "resume" || command.action === "send") && !accepted.replay) this.drain(conversationId);
|
|
130
130
|
return this.publish(conversationId);
|
|
@@ -507,11 +507,19 @@ var SessionInputCoordinator = class {
|
|
|
507
507
|
steerInput(row, runId) {
|
|
508
508
|
const text = steeringText(row.content, row.contextSnapshots);
|
|
509
509
|
const voiceAgentInstruction = isNaturalVoiceDelegation(row);
|
|
510
|
-
|
|
510
|
+
const trackDelivery = row.origin.type === "endpoint";
|
|
511
|
+
if (!trackDelivery && !voiceAgentInstruction && !row.attachments?.length && !row.contextSnapshots?.length) return this.deps.steer(row.conversationId, text, runId);
|
|
511
512
|
return this.deps.steer(row.conversationId, text, runId, {
|
|
512
513
|
attachments: row.attachments,
|
|
513
514
|
sourceContexts: row.contextSnapshots,
|
|
514
|
-
...voiceAgentInstruction ? { voiceAgentInstruction: true } : {}
|
|
515
|
+
...voiceAgentInstruction ? { voiceAgentInstruction: true } : {},
|
|
516
|
+
...trackDelivery ? {
|
|
517
|
+
clientMessageId: row.clientMessageId,
|
|
518
|
+
onHandled: () => {
|
|
519
|
+
const current = getSessionInputById(row.conversationId, row.id);
|
|
520
|
+
if (current?.status === "injecting" && current.targetRunId === runId) setSessionInputStatus(row.id, "completed");
|
|
521
|
+
}
|
|
522
|
+
} : {}
|
|
515
523
|
});
|
|
516
524
|
}
|
|
517
525
|
async drain(conversationId) {
|
|
@@ -222,6 +222,7 @@ export declare class GatewayService {
|
|
|
222
222
|
private loadDeferredExtensions;
|
|
223
223
|
private schedulePostReadySidecars;
|
|
224
224
|
private runPostReadySidecars;
|
|
225
|
+
private readonly videoGenerationWorker;
|
|
225
226
|
start(): Promise<void>;
|
|
226
227
|
private startRuntime;
|
|
227
228
|
/** Called when the HTTP listener is bound (before deferred channel work). */
|
|
@@ -107,10 +107,6 @@ import { DiscussionSealer } from "../discussions/sealer.js";
|
|
|
107
107
|
import "../discussions/index.js";
|
|
108
108
|
import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
|
|
109
109
|
import "../endpoint-tools/index.js";
|
|
110
|
-
import { HomeCapabilityPreflightService } from "../home-intelligence/capability-preflight.js";
|
|
111
|
-
import { HomeAdviceGenerator } from "../home-intelligence/generator.js";
|
|
112
|
-
import { HomeIntelligenceHost } from "../home-intelligence/host.js";
|
|
113
|
-
import { HomeSnapshotBuilder } from "../home-intelligence/snapshot.js";
|
|
114
110
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
115
111
|
import { prepareAutomationAgentSession } from "./automation-agent-session.js";
|
|
116
112
|
import { deliverAutomationCompletion } from "./automation-completion-delivery.js";
|
|
@@ -150,6 +146,7 @@ import { NotificationService } from "../notifications/service.js";
|
|
|
150
146
|
import "../local-apps/index.js";
|
|
151
147
|
import { TaskAllocationDispatcher } from "../tasks/task-allocation-service.js";
|
|
152
148
|
import { TaskResultDeliveryService } from "../tasks/task-result-delivery-service.js";
|
|
149
|
+
import { VideoGenerationWorker } from "../video-generation/worker.js";
|
|
153
150
|
import { scheduleGatewayUpdateCheck } from "../infra/update-startup.js";
|
|
154
151
|
import { resolveChannelConnectDeferSet } from "./resolve-channel-connect-defer.js";
|
|
155
152
|
import { restartGatewayProcessWithFreshPid } from "./respawn.js";
|
|
@@ -174,6 +171,10 @@ import { TaskMainUpdateDecisionService } from "../tasks/task-main-update-decisio
|
|
|
174
171
|
import { selectTaskMainUpdateAttempt, submitAndConfirmTaskMainUpdate } from "../tasks/task-main-update-input.js";
|
|
175
172
|
import { checkAppContextAccess, prepareAppContext } from "./service/app-context-access.js";
|
|
176
173
|
import { applyAutomaticVoiceLanguage, inferProductLanguageFromEnvironment, initializeVoiceDefaults } from "../voice/language-profile.js";
|
|
174
|
+
import { HomeAdviceGenerator } from "../home-intelligence/generator.js";
|
|
175
|
+
import { HomeIntelligenceHost } from "../home-intelligence/host.js";
|
|
176
|
+
import { HomeSnapshotBuilder } from "../home-intelligence/snapshot.js";
|
|
177
|
+
import { HomeCapabilityPreflightService } from "../home-intelligence/capability-preflight.js";
|
|
177
178
|
import crypto from "node:crypto";
|
|
178
179
|
//#region src/gateway/service.ts
|
|
179
180
|
init_session_repository();
|
|
@@ -1346,6 +1347,7 @@ var GatewayService = class {
|
|
|
1346
1347
|
}, `Deferred extension load failed: ${em}`);
|
|
1347
1348
|
}
|
|
1348
1349
|
}
|
|
1350
|
+
videoGenerationWorker = new VideoGenerationWorker();
|
|
1349
1351
|
async start() {
|
|
1350
1352
|
try {
|
|
1351
1353
|
await this.startRuntime();
|
|
@@ -1587,6 +1589,7 @@ var GatewayService = class {
|
|
|
1587
1589
|
await this.notesService.initialize();
|
|
1588
1590
|
this.discussionLiveWorker.start();
|
|
1589
1591
|
this.discussionSealer.start();
|
|
1592
|
+
this.videoGenerationWorker.start();
|
|
1590
1593
|
this.discussionWorker.start();
|
|
1591
1594
|
this.connectorSupervisor = startConnectorSupervisor({
|
|
1592
1595
|
getConfig: () => this.config,
|
|
@@ -1752,6 +1755,7 @@ var GatewayService = class {
|
|
|
1752
1755
|
this.homeIntelligenceHost = null;
|
|
1753
1756
|
this.realtime.close();
|
|
1754
1757
|
this.voiceRealtime.close();
|
|
1758
|
+
await this.videoGenerationWorker.stop();
|
|
1755
1759
|
await this.discussionWorker.stop();
|
|
1756
1760
|
await this.discussionSealer.stop();
|
|
1757
1761
|
await this.discussionLiveWorker.stop();
|
|
@@ -7,14 +7,14 @@ import { TaskRepository, init_task_repository } from "../tasks/task-repository.j
|
|
|
7
7
|
import { appendTranscriptEntry } from "../storage/sqlite/transcript-repository.js";
|
|
8
8
|
import { createConversation, init_conversation_repository } from "../storage/sqlite/conversation-repository.js";
|
|
9
9
|
import { TaskApplicationService } from "../tasks/task-application-service.js";
|
|
10
|
-
import { homePatternKey } from "./strategy.js";
|
|
11
|
-
import { HomeIntelligenceRepository } from "./repository.js";
|
|
12
|
-
import { HomeOpportunityApplicationService } from "./application-service.js";
|
|
13
|
-
import { HomeAdvicePolicy } from "./policy.js";
|
|
14
10
|
import { HomeObservation, ObservationConflictError } from "./observation.js";
|
|
15
11
|
import { HomeFollowUps } from "./follow-ups.js";
|
|
16
|
-
import { HomeAdviceBudgetExceededError, isHomeProseLocalized } from "./generator.js";
|
|
17
12
|
import { observationStarters } from "./observation-starters.js";
|
|
13
|
+
import { HomeAdviceBudgetExceededError, isHomeProseLocalized } from "./generator.js";
|
|
14
|
+
import { homePatternKey } from "./strategy.js";
|
|
15
|
+
import { HomeAdvicePolicy } from "./policy.js";
|
|
16
|
+
import { HomeIntelligenceRepository } from "./repository.js";
|
|
17
|
+
import { HomeOpportunityApplicationService } from "./application-service.js";
|
|
18
18
|
import { buildHomeOpportunityNotification } from "./notification.js";
|
|
19
19
|
import { ObservationRoutines } from "./routines.js";
|
|
20
20
|
import { createHash } from "node:crypto";
|
|
@@ -24,6 +24,7 @@ export interface ClientHistoryMessage {
|
|
|
24
24
|
metadata?: {
|
|
25
25
|
/** Stable client-generated id used to reconcile optimistic sends exactly. */
|
|
26
26
|
clientMessageId?: string;
|
|
27
|
+
steered?: true;
|
|
27
28
|
sourceContexts?: Array<{
|
|
28
29
|
refId?: string;
|
|
29
30
|
kind: 'result' | 'note' | 'task' | 'file' | 'session' | 'browser_tab' | 'browser_page' | 'mcp_resource';
|
|
@@ -35,11 +35,7 @@ function sourceContextDisplayMetadata(metadata) {
|
|
|
35
35
|
const clientMessageId = typeof record.clientMessageId === "string" && record.clientMessageId.trim() ? record.clientMessageId : void 0;
|
|
36
36
|
const rows = record.sourceContexts;
|
|
37
37
|
const userTurnDocument = isUserTurnDocument(record.userTurnDocument) ? record.userTurnDocument : void 0;
|
|
38
|
-
|
|
39
|
-
...clientMessageId ? { clientMessageId } : {},
|
|
40
|
-
...userTurnDocument ? { userTurnDocument } : {}
|
|
41
|
-
} : void 0;
|
|
42
|
-
const sourceContexts = rows.flatMap((value) => {
|
|
38
|
+
const sourceContexts = (Array.isArray(rows) ? rows : []).flatMap((value) => {
|
|
43
39
|
if (!value || typeof value !== "object" || Array.isArray(value)) return [];
|
|
44
40
|
const row = value;
|
|
45
41
|
if (row.kind !== "note" && row.kind !== "task" && row.kind !== "file" && row.kind !== "session" && row.kind !== "browser_tab" && row.kind !== "result" && row.kind !== "browser_page" && row.kind !== "mcp_resource" || typeof row.sourceId !== "string" || typeof row.version !== "string" || typeof row.title !== "string") return [];
|
|
@@ -58,7 +54,10 @@ function sourceContextDisplayMetadata(metadata) {
|
|
|
58
54
|
}];
|
|
59
55
|
});
|
|
60
56
|
return clientMessageId || sourceContexts.length || userTurnDocument ? {
|
|
61
|
-
...clientMessageId ? {
|
|
57
|
+
...clientMessageId ? {
|
|
58
|
+
clientMessageId,
|
|
59
|
+
...record.steered === true ? { steered: true } : {}
|
|
60
|
+
} : {},
|
|
62
61
|
...sourceContexts.length ? { sourceContexts } : {},
|
|
63
62
|
...userTurnDocument ? { userTurnDocument } : {}
|
|
64
63
|
} : void 0;
|
|
@@ -23,6 +23,8 @@ import { resolveCompactionPolicy } from "../agent/memory/compaction-policy.js";
|
|
|
23
23
|
import { IdleCompactionScheduler } from "../agent/memory/idle-compaction-scheduler.js";
|
|
24
24
|
import { readPostCompactionContext } from "../agent/reply/post-compaction-context.js";
|
|
25
25
|
import { promoteCompactionLedger } from "../agent/memory/compaction-promotion.js";
|
|
26
|
+
import { deleteVideoArtifact } from "../video-generation/artifact.js";
|
|
27
|
+
import { listVideoJobIds } from "../video-generation/repository.js";
|
|
26
28
|
import { SlidingWindow } from "../agent/memory/window.js";
|
|
27
29
|
import { isAppendOnlyLlmTranscriptMessage } from "./transcript-stats.js";
|
|
28
30
|
import { compactHistory } from "./compact-history.js";
|
|
@@ -349,8 +351,10 @@ var SessionStore = class {
|
|
|
349
351
|
this.idleCompaction.interrupt(key);
|
|
350
352
|
return this.runStoreMutation(async () => {
|
|
351
353
|
requireXopcDatabase();
|
|
354
|
+
const videoJobs = listVideoJobIds(key);
|
|
352
355
|
const ok = deleteSessionRecord(key);
|
|
353
356
|
if (ok) {
|
|
357
|
+
await Promise.allSettled(videoJobs.map(deleteVideoArtifact));
|
|
354
358
|
this.clearCompactionCheckpoint(key);
|
|
355
359
|
log.info({ key }, "Session deleted");
|
|
356
360
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DatabaseSync } from 'node:sqlite';
|
|
2
2
|
export { SCHEMA_META_SCHEMA_VERSION_KEY, readSchemaVersionForTest, readSchemaVersion, setSchemaVersion, ensureSchemaMetaTable } from './schema-version.js';
|
|
3
|
-
export declare const XOPC_DB_SCHEMA_VERSION =
|
|
4
|
-
export declare const XOPC_DB_BASELINE_SCHEMA_VERSION =
|
|
3
|
+
export declare const XOPC_DB_SCHEMA_VERSION = 276;
|
|
4
|
+
export declare const XOPC_DB_BASELINE_SCHEMA_VERSION = 276;
|
|
5
5
|
export { XOPC_DB_MINIMUM_SCHEMA_VERSION } from './schema-upgrade.js';
|
|
6
6
|
/** Initialize fresh databases directly; upgrade supported installed databases transactionally. */
|
|
7
7
|
export declare function ensureXopcDatabaseSchema(db: DatabaseSync): void;
|
|
@@ -14,18 +14,18 @@ function ensureXopcDatabaseSchema(db) {
|
|
|
14
14
|
const hasMetadata = tables.some((row) => row.name === "schema_meta");
|
|
15
15
|
if (!hasMetadata && tables.length) throw new Error("An unversioned database cannot be initialized");
|
|
16
16
|
const version = hasMetadata ? readSchemaVersion(db) : 0;
|
|
17
|
-
if (version >
|
|
17
|
+
if (version > 276) throw new DatabaseSchemaTooNewError(version, 276);
|
|
18
18
|
if (version > 0 && version < 202) throw new DatabaseSchemaTooOldError(version, 202);
|
|
19
|
-
if (version >= 202 && version <
|
|
20
|
-
upgradeXopcDatabase(db, version,
|
|
19
|
+
if (version >= 202 && version < 276) {
|
|
20
|
+
upgradeXopcDatabase(db, version, 276);
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
if (version ===
|
|
23
|
+
if (version === 276) return;
|
|
24
24
|
if (db.prepare("SELECT name FROM sqlite_master WHERE type = 'table' AND name != 'schema_meta' AND name NOT LIKE 'sqlite_%' LIMIT 1").get()) throw new Error("An unversioned database cannot be initialized");
|
|
25
25
|
db.exec("BEGIN IMMEDIATE");
|
|
26
26
|
try {
|
|
27
27
|
db.exec(readSqliteAsset("schema.sql"));
|
|
28
|
-
setSchemaVersion(db,
|
|
28
|
+
setSchemaVersion(db, 276);
|
|
29
29
|
db.exec("COMMIT");
|
|
30
30
|
} catch (error) {
|
|
31
31
|
db.exec("ROLLBACK");
|
|
@@ -40,8 +40,8 @@ var init_schema = __esmMin((() => {
|
|
|
40
40
|
init_schema_version();
|
|
41
41
|
init_schema_errors();
|
|
42
42
|
init_schema_upgrade();
|
|
43
|
-
XOPC_DB_SCHEMA_VERSION =
|
|
44
|
-
XOPC_DB_BASELINE_SCHEMA_VERSION =
|
|
43
|
+
XOPC_DB_SCHEMA_VERSION = 276;
|
|
44
|
+
XOPC_DB_BASELINE_SCHEMA_VERSION = 276;
|
|
45
45
|
}));
|
|
46
46
|
//#endregion
|
|
47
47
|
init_schema();
|
|
@@ -3707,3 +3707,34 @@ CREATE TABLE home_followup_operations (
|
|
|
3707
3707
|
request_hash TEXT NOT NULL, result_id TEXT NOT NULL,
|
|
3708
3708
|
PRIMARY KEY(owner_id,workspace_id,operation_id)
|
|
3709
3709
|
);
|
|
3710
|
+
CREATE TABLE video_generation_jobs (
|
|
3711
|
+
id TEXT PRIMARY KEY,
|
|
3712
|
+
conversation_id TEXT NOT NULL REFERENCES sessions(conversation_id) ON DELETE CASCADE,
|
|
3713
|
+
transcript_id TEXT NOT NULL REFERENCES transcripts(transcript_id) ON DELETE CASCADE,
|
|
3714
|
+
request_hash TEXT NOT NULL,
|
|
3715
|
+
model_ref TEXT NOT NULL DEFAULT 'dashscope-cn/wan3.0-video',
|
|
3716
|
+
prompt TEXT NOT NULL,
|
|
3717
|
+
duration INTEGER NOT NULL,
|
|
3718
|
+
ratio TEXT NOT NULL,
|
|
3719
|
+
resolution TEXT NOT NULL,
|
|
3720
|
+
image_name TEXT,
|
|
3721
|
+
image_mime TEXT,
|
|
3722
|
+
image_bytes BLOB,
|
|
3723
|
+
state TEXT NOT NULL CHECK (state IN ('queued','submitting','submitted','running','saving','completed','failed','submission_unknown')),
|
|
3724
|
+
provider_task_id TEXT,
|
|
3725
|
+
next_attempt_at INTEGER NOT NULL,
|
|
3726
|
+
lease_token TEXT,
|
|
3727
|
+
lease_until INTEGER,
|
|
3728
|
+
error TEXT,
|
|
3729
|
+
created_at INTEGER NOT NULL
|
|
3730
|
+
);
|
|
3731
|
+
CREATE INDEX video_generation_due ON video_generation_jobs(next_attempt_at)
|
|
3732
|
+
WHERE state IN ('queued','submitting','submitted','running','saving');
|
|
3733
|
+
CREATE INDEX video_generation_conversation ON video_generation_jobs(conversation_id, created_at DESC);
|
|
3734
|
+
|
|
3735
|
+
CREATE TABLE video_generation_provider_budget (
|
|
3736
|
+
provider TEXT NOT NULL,
|
|
3737
|
+
day INTEGER NOT NULL,
|
|
3738
|
+
reserved_fen INTEGER NOT NULL,
|
|
3739
|
+
PRIMARY KEY (provider, day)
|
|
3740
|
+
);
|
|
@@ -206,8 +206,11 @@ function finishSessionInputRun(conversationId, runId, status, error) {
|
|
|
206
206
|
const now = Date.now();
|
|
207
207
|
if (runtime.active_input_id) db.prepare(`UPDATE session_inputs SET status = ?, error = ?,
|
|
208
208
|
version = version + 1, updated_at_ms = ? WHERE id = ?`).run(status, error ?? null, now, runtime.active_input_id);
|
|
209
|
-
db.prepare(`UPDATE session_inputs SET
|
|
210
|
-
|
|
209
|
+
db.prepare(`UPDATE session_inputs SET
|
|
210
|
+
status = CASE WHEN ? AND json_extract(origin_json, '$.type') != 'endpoint' THEN 'completed' ELSE 'interrupted' END,
|
|
211
|
+
error = CASE WHEN ? AND json_extract(origin_json, '$.type') != 'endpoint' THEN NULL ELSE 'Current reply ended before steer delivery was confirmed' END,
|
|
212
|
+
version = version + 1,
|
|
213
|
+
updated_at_ms = ? WHERE conversation_id = ? AND target_run_id = ? AND status = 'injecting'`).run(Number(status === "completed"), Number(status === "completed"), now, conversationId, runId);
|
|
211
214
|
db.prepare(`UPDATE session_input_runtime SET active_run_id = NULL, active_input_id = NULL,
|
|
212
215
|
revision = revision + 1, updated_at_ms = ?
|
|
213
216
|
WHERE conversation_id = ?`).run(now, conversationId);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "./transaction.js";
|
|
2
2
|
import { readCurrentTranscriptId } from "./session-instance-repository.js";
|
|
3
|
+
import { bumpSessionInputRevision, init_session_input_repository } from "./session-input-repository.js";
|
|
3
4
|
import { buildSessionContextForLlm, init_session_context_for_llm, isRuntimeOnlyTranscriptMessage } from "../../session/session-context-for-llm.js";
|
|
4
5
|
import { classifyStoredRow, estimateTokensFromMessages, extractFtsContent, init_row_mappers, transcriptEntryRowToStoredRow } from "./row-mappers.js";
|
|
5
6
|
import { buildFts5SearchQuery, escapeFts5Query, escapeSqlLike, init_fts, sessionHanSearchTerms } from "./fts.js";
|
|
@@ -11,6 +12,7 @@ init_row_mappers();
|
|
|
11
12
|
init_session_repository();
|
|
12
13
|
init_fts();
|
|
13
14
|
init_transaction();
|
|
15
|
+
init_session_input_repository();
|
|
14
16
|
function nextSeq(db, transcriptId) {
|
|
15
17
|
return (db.prepare(`SELECT COALESCE(MAX(seq), 0) AS max_seq FROM transcript_entries WHERE transcript_id = ?`).get(transcriptId).max_seq ?? 0) + 1;
|
|
16
18
|
}
|
|
@@ -60,6 +62,7 @@ function withSessionInputContextMetadata(db, conversationId, row) {
|
|
|
60
62
|
const turnId = typeof message.turnId === "string" ? message.turnId.trim() : "";
|
|
61
63
|
if (!turnId) return row;
|
|
62
64
|
const metadata = message.metadata && typeof message.metadata === "object" && !Array.isArray(message.metadata) ? message.metadata : {};
|
|
65
|
+
if (classified.role === "user" && metadata.steered === true) return row;
|
|
63
66
|
const input = db.prepare(`SELECT client_message_id, context_refs_json, origin_json FROM session_inputs
|
|
64
67
|
WHERE conversation_id = ? AND run_id = ?
|
|
65
68
|
LIMIT 1`).get(conversationId, turnId);
|
|
@@ -117,6 +120,15 @@ function appendTranscriptEntry(conversationId, row, opts) {
|
|
|
117
120
|
row: persistedRow,
|
|
118
121
|
entryId: opts?.entryId
|
|
119
122
|
});
|
|
123
|
+
if (isUserMessageRow(row)) {
|
|
124
|
+
const { metadata, turnId } = row;
|
|
125
|
+
if (metadata?.steered && metadata.clientMessageId && turnId) {
|
|
126
|
+
const now = Date.now();
|
|
127
|
+
if (db.prepare(`UPDATE session_inputs SET status = 'completed', error = NULL,
|
|
128
|
+
version = version + 1, updated_at_ms = ? WHERE conversation_id = ? AND client_message_id = ?
|
|
129
|
+
AND target_run_id = ? AND status = 'injecting' AND (expected_transcript_id IS NULL OR expected_transcript_id = ?)`).run(now, conversationId, metadata.clientMessageId, turnId, transcriptId).changes) bumpSessionInputRevision(db, conversationId);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
120
132
|
if (classifyStoredRow(persistedRow).entryKind === "message") {
|
|
121
133
|
const tokenDelta = opts?.tokenDelta ?? 0;
|
|
122
134
|
const now = Date.now();
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
CREATE TABLE video_generation_jobs (
|
|
2
|
+
id TEXT PRIMARY KEY,
|
|
3
|
+
conversation_id TEXT NOT NULL REFERENCES sessions(conversation_id) ON DELETE CASCADE,
|
|
4
|
+
transcript_id TEXT NOT NULL REFERENCES transcripts(transcript_id) ON DELETE CASCADE,
|
|
5
|
+
request_hash TEXT NOT NULL,
|
|
6
|
+
prompt TEXT NOT NULL,
|
|
7
|
+
duration INTEGER NOT NULL,
|
|
8
|
+
ratio TEXT NOT NULL,
|
|
9
|
+
resolution TEXT NOT NULL,
|
|
10
|
+
image_name TEXT,
|
|
11
|
+
image_mime TEXT,
|
|
12
|
+
image_bytes BLOB,
|
|
13
|
+
state TEXT NOT NULL CHECK (state IN ('queued','submitting','submitted','running','saving','completed','failed','submission_unknown')),
|
|
14
|
+
provider_task_id TEXT,
|
|
15
|
+
next_attempt_at INTEGER NOT NULL,
|
|
16
|
+
lease_token TEXT,
|
|
17
|
+
lease_until INTEGER,
|
|
18
|
+
error TEXT,
|
|
19
|
+
created_at INTEGER NOT NULL
|
|
20
|
+
);
|
|
21
|
+
CREATE INDEX video_generation_due ON video_generation_jobs(next_attempt_at)
|
|
22
|
+
WHERE state IN ('queued','submitting','submitted','running','saving');
|
|
23
|
+
CREATE INDEX video_generation_conversation ON video_generation_jobs(conversation_id, created_at DESC);
|
|
24
|
+
|
|
25
|
+
CREATE TABLE video_generation_budget (
|
|
26
|
+
day INTEGER PRIMARY KEY,
|
|
27
|
+
reserved_fen INTEGER NOT NULL
|
|
28
|
+
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
ALTER TABLE video_generation_jobs ADD COLUMN model_ref TEXT NOT NULL DEFAULT 'dashscope-cn/wan3.0-video';
|
|
2
|
+
|
|
3
|
+
CREATE TABLE video_generation_provider_budget (
|
|
4
|
+
provider TEXT NOT NULL,
|
|
5
|
+
day INTEGER NOT NULL,
|
|
6
|
+
reserved_fen INTEGER NOT NULL,
|
|
7
|
+
PRIMARY KEY (provider, day)
|
|
8
|
+
);
|
|
9
|
+
INSERT INTO video_generation_provider_budget(provider, day, reserved_fen)
|
|
10
|
+
SELECT 'dashscope-cn', day, reserved_fen FROM video_generation_budget;
|
|
11
|
+
DROP TABLE video_generation_budget;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function videoArtifactPath(jobId: string): string;
|
|
2
|
+
export declare function deleteVideoArtifact(jobId: string): Promise<void>;
|
|
3
|
+
export declare function videoArtifactExists(jobId: string): Promise<boolean>;
|
|
4
|
+
export declare function storeVideoArtifact(jobId: string, response: Response): Promise<void>;
|
|
5
|
+
export declare function readVideoArtifact(jobId: string, rangeHeader?: string, download?: boolean): Promise<Response>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { resolveMediaBufferPath } from "../media/store.js";
|
|
2
|
+
import { dirname } from "node:path";
|
|
3
|
+
import { createReadStream, createWriteStream } from "node:fs";
|
|
4
|
+
import { randomUUID } from "node:crypto";
|
|
5
|
+
import { mkdir, open, rename, rm, stat } from "node:fs/promises";
|
|
6
|
+
import { pipeline } from "node:stream/promises";
|
|
7
|
+
import { Readable, Transform } from "node:stream";
|
|
8
|
+
//#region src/video-generation/artifact.ts
|
|
9
|
+
const VIDEO_ARTIFACT_MAX_BYTES = 256 * 1024 * 1024;
|
|
10
|
+
function videoArtifactPath(jobId) {
|
|
11
|
+
return resolveMediaBufferPath(`wan-${jobId}.mp4`, "outbound");
|
|
12
|
+
}
|
|
13
|
+
async function deleteVideoArtifact(jobId) {
|
|
14
|
+
await rm(videoArtifactPath(jobId), { force: true });
|
|
15
|
+
}
|
|
16
|
+
async function videoArtifactExists(jobId) {
|
|
17
|
+
const info = await stat(videoArtifactPath(jobId)).catch(() => null);
|
|
18
|
+
return Boolean(info?.isFile() && info.size > 0 && info.size <= VIDEO_ARTIFACT_MAX_BYTES);
|
|
19
|
+
}
|
|
20
|
+
async function storeVideoArtifact(jobId, response) {
|
|
21
|
+
const path = videoArtifactPath(jobId);
|
|
22
|
+
const temporary = `${path}.${randomUUID()}.part`;
|
|
23
|
+
await mkdir(dirname(path), {
|
|
24
|
+
recursive: true,
|
|
25
|
+
mode: 448
|
|
26
|
+
});
|
|
27
|
+
let size = 0;
|
|
28
|
+
const limit = new Transform({ transform(chunk, _encoding, callback) {
|
|
29
|
+
size += chunk.length;
|
|
30
|
+
if (size > VIDEO_ARTIFACT_MAX_BYTES) return callback(/* @__PURE__ */ new Error("Generated video exceeds the media size limit"));
|
|
31
|
+
callback(null, chunk);
|
|
32
|
+
} });
|
|
33
|
+
try {
|
|
34
|
+
await pipeline(Readable.fromWeb(response.body), limit, createWriteStream(temporary, {
|
|
35
|
+
flags: "wx",
|
|
36
|
+
mode: 384
|
|
37
|
+
}));
|
|
38
|
+
const file = await open(temporary, "r");
|
|
39
|
+
try {
|
|
40
|
+
const header = Buffer.alloc(12);
|
|
41
|
+
const { bytesRead } = await file.read(header);
|
|
42
|
+
if (bytesRead < header.length || header.toString("ascii", 4, 8) !== "ftyp") throw new Error("Video provider returned an invalid MP4");
|
|
43
|
+
await file.sync();
|
|
44
|
+
} finally {
|
|
45
|
+
await file.close();
|
|
46
|
+
}
|
|
47
|
+
await rename(temporary, path);
|
|
48
|
+
} finally {
|
|
49
|
+
await rm(temporary, { force: true });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
async function readVideoArtifact(jobId, rangeHeader, download = false) {
|
|
53
|
+
const path = videoArtifactPath(jobId);
|
|
54
|
+
const info = await stat(path).catch(() => null);
|
|
55
|
+
if (!info?.isFile() || !info.size || info.size > VIDEO_ARTIFACT_MAX_BYTES) return new Response(null, { status: 404 });
|
|
56
|
+
const headers = new Headers({
|
|
57
|
+
"Accept-Ranges": "bytes",
|
|
58
|
+
"Content-Type": "video/mp4",
|
|
59
|
+
"Cache-Control": "private, no-store",
|
|
60
|
+
"X-Content-Type-Options": "nosniff"
|
|
61
|
+
});
|
|
62
|
+
if (download) headers.set("Content-Disposition", "attachment; filename=\"generated-video.mp4\"");
|
|
63
|
+
let start = 0;
|
|
64
|
+
let end = info.size - 1;
|
|
65
|
+
if (rangeHeader) {
|
|
66
|
+
const range = /^bytes=(\d*)-(\d*)$/i.exec(rangeHeader);
|
|
67
|
+
if (range?.[1]) {
|
|
68
|
+
start = Number(range[1]);
|
|
69
|
+
if (range[2]) end = Math.min(end, Number(range[2]));
|
|
70
|
+
} else if (range?.[2] && Number.isSafeInteger(Number(range[2]))) start = Math.max(0, info.size - Number(range[2]));
|
|
71
|
+
else start = info.size;
|
|
72
|
+
if (!Number.isSafeInteger(start) || start > end) {
|
|
73
|
+
headers.set("Content-Range", `bytes */${info.size}`);
|
|
74
|
+
return new Response(null, {
|
|
75
|
+
status: 416,
|
|
76
|
+
headers
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
headers.set("Content-Range", `bytes ${start}-${end}/${info.size}`);
|
|
80
|
+
}
|
|
81
|
+
headers.set("Content-Length", String(end - start + 1));
|
|
82
|
+
return new Response(Readable.toWeb(createReadStream(path, {
|
|
83
|
+
start,
|
|
84
|
+
end
|
|
85
|
+
})), {
|
|
86
|
+
status: rangeHeader ? 206 : 200,
|
|
87
|
+
headers
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { deleteVideoArtifact, readVideoArtifact, storeVideoArtifact, videoArtifactExists, videoArtifactPath };
|