@xopcai/xopc 0.0.465 → 0.0.467
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-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-3WGWLdiW.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-CH9gYqIK.js +9 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DDNKe1Io.js → binary-plugins-MFVtTdvy.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-BjaLTd6i.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-BtMkdtxJ.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-BBTtXpDD.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-BJj-uZNl.js +11 -0
- package/dist/gateway/static/root/assets/index-DiWUK4sJ.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-CW5UoTx6.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-D5BtgBxy.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-DyM-3O_9.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-BB4Sv68K.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-BG2nDt98.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-BYqg1BYz.js +2 -0
- package/dist/gateway/static/root/assets/{routine-panel-BsE9o9uu.js → routine-panel-Coh2B0j7.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-M6XwzIyu.js → settings-page-D9A2DdJ_.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/{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-CyCv69rh.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-DgsLOz6h.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-C9GpCJQR.js} +1 -1
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-DufxDues.js → use-file-preview-expanded-Daf-LmiF.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/video-generation-D08uZbsu.js +1 -0
- 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-JSGIA79T.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 +97 -96
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/index.js +4 -0
- package/dist/packages/gateway-contract/src/music-generation.js +6 -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 +2 -1
- package/dist/src/agent/inbound/attachment-pipeline.js +21 -11
- 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/sections/tooling.js +4 -0
- package/dist/src/agent/prompt/service-prompt-builder.js +1 -1
- package/dist/src/agent/tools/factory.js +14 -1
- package/dist/src/agent/tools/music-generation-tool.d.ts +11 -0
- package/dist/src/agent/tools/music-generation-tool.js +70 -0
- package/dist/src/agent/tools/toolExposure.js +2 -0
- package/dist/src/agent/tools/video-draft-tool.d.ts +12 -0
- package/dist/src/agent/tools/video-draft-tool.js +75 -0
- 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 +16 -0
- package/dist/src/gateway/hono/routes/media.js +1 -20
- package/dist/src/gateway/hono/routes/music-generation.d.ts +3 -0
- package/dist/src/gateway/hono/routes/music-generation.js +59 -0
- package/dist/src/gateway/hono/routes/video-generation.d.ts +3 -0
- package/dist/src/gateway/hono/routes/video-generation.js +191 -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 +2 -0
- package/dist/src/gateway/service.js +11 -4
- package/dist/src/home-intelligence/host.js +5 -5
- package/dist/src/media-shared/http/byte-range.d.ts +6 -0
- package/dist/src/media-shared/http/byte-range.js +23 -0
- package/dist/src/music-generation/artifact.d.ts +5 -0
- package/dist/src/music-generation/artifact.js +105 -0
- package/dist/src/music-generation/mureka.d.ts +3 -0
- package/dist/src/music-generation/mureka.js +96 -0
- package/dist/src/music-generation/provider.d.ts +31 -0
- package/dist/src/music-generation/provider.js +4 -0
- package/dist/src/music-generation/providers.d.ts +26 -0
- package/dist/src/music-generation/providers.js +56 -0
- package/dist/src/music-generation/repository.d.ts +50 -0
- package/dist/src/music-generation/repository.js +104 -0
- package/dist/src/music-generation/settings.d.ts +7 -0
- package/dist/src/music-generation/settings.js +24 -0
- package/dist/src/music-generation/worker.d.ts +8 -0
- package/dist/src/music-generation/worker.js +115 -0
- package/dist/src/personal-agent/policy.d.ts +1 -1
- package/dist/src/personal-agent/policy.js +3 -1
- package/dist/src/personal-agent/prompts.js +2 -0
- 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 +10 -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 +62 -0
- package/dist/src/storage/sqlite/session-input-repository.js +5 -2
- package/dist/src/storage/sqlite/transcript-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/transcript-repository.js +20 -1
- 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/storage/sqlite/upgrades/277_music_generation.sql +30 -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/drafts.d.ts +17 -0
- package/dist/src/video-generation/drafts.js +89 -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
|
@@ -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 > 277) throw new DatabaseSchemaTooNewError(version, 277);
|
|
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 < 277) {
|
|
20
|
+
upgradeXopcDatabase(db, version, 277);
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
if (version ===
|
|
23
|
+
if (version === 277) 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, 277);
|
|
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 = 277;
|
|
44
|
+
XOPC_DB_BASELINE_SCHEMA_VERSION = 277;
|
|
45
45
|
}));
|
|
46
46
|
//#endregion
|
|
47
47
|
init_schema();
|
|
@@ -3707,3 +3707,65 @@ 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
|
+
);
|
|
3741
|
+
|
|
3742
|
+
CREATE TABLE music_generation_jobs (
|
|
3743
|
+
id TEXT PRIMARY KEY,
|
|
3744
|
+
conversation_id TEXT NOT NULL REFERENCES sessions(conversation_id) ON DELETE CASCADE,
|
|
3745
|
+
transcript_id TEXT NOT NULL,
|
|
3746
|
+
work_id TEXT NOT NULL,
|
|
3747
|
+
parent_id TEXT,
|
|
3748
|
+
version_number INTEGER NOT NULL,
|
|
3749
|
+
model_ref TEXT NOT NULL,
|
|
3750
|
+
request_hash TEXT NOT NULL,
|
|
3751
|
+
title TEXT NOT NULL,
|
|
3752
|
+
mode TEXT NOT NULL CHECK (mode IN ('song', 'instrumental')),
|
|
3753
|
+
prompt TEXT NOT NULL,
|
|
3754
|
+
lyrics TEXT,
|
|
3755
|
+
state TEXT NOT NULL CHECK (state IN ('queued', 'submitting', 'submitted', 'running', 'saving', 'completed', 'failed', 'submission_unknown')),
|
|
3756
|
+
provider_task_id TEXT,
|
|
3757
|
+
duration_ms INTEGER,
|
|
3758
|
+
error TEXT,
|
|
3759
|
+
next_attempt_at INTEGER NOT NULL,
|
|
3760
|
+
lease_token TEXT,
|
|
3761
|
+
lease_until INTEGER,
|
|
3762
|
+
created_at INTEGER NOT NULL,
|
|
3763
|
+
UNIQUE (work_id, version_number)
|
|
3764
|
+
);
|
|
3765
|
+
CREATE INDEX music_generation_due ON music_generation_jobs(next_attempt_at)
|
|
3766
|
+
WHERE state IN ('queued', 'submitting', 'submitted', 'running', 'saving');
|
|
3767
|
+
CREATE INDEX music_generation_transcript ON music_generation_jobs(conversation_id, transcript_id, created_at DESC);
|
|
3768
|
+
CREATE TABLE music_generation_daily_usage (
|
|
3769
|
+
day INTEGER PRIMARY KEY,
|
|
3770
|
+
count INTEGER NOT NULL
|
|
3771
|
+
);
|
|
@@ -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);
|
|
@@ -38,6 +38,7 @@ export declare function searchSessionTranscript(conversationId: string, query: s
|
|
|
38
38
|
matchMode?: 'keyword' | 'phrase';
|
|
39
39
|
}): SessionTranscriptRecallMatch[];
|
|
40
40
|
export declare function loadTranscriptRowsForSession(conversationId: string): TranscriptStoredRow[];
|
|
41
|
+
export declare function loadRecentUserTranscriptRows(conversationId: string, limit: number): TranscriptStoredRow[];
|
|
41
42
|
export declare function loadTranscriptHistoryRowsForSession(conversationId: string): TranscriptStoredRow[];
|
|
42
43
|
export declare function loadTranscriptRows(transcriptId: string): TranscriptStoredRow[];
|
|
43
44
|
export declare function loadLlmMessagesForSession(conversationId: string): AgentMessage[];
|
|
@@ -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();
|
|
@@ -242,6 +254,13 @@ function loadTranscriptRowsForSession(conversationId) {
|
|
|
242
254
|
if (!transcriptId) return [];
|
|
243
255
|
return loadTranscriptRows(transcriptId);
|
|
244
256
|
}
|
|
257
|
+
function loadRecentUserTranscriptRows(conversationId, limit) {
|
|
258
|
+
const transcriptId = getCurrentTranscriptId(conversationId);
|
|
259
|
+
if (!transcriptId) return [];
|
|
260
|
+
return getSqliteDatabase().prepare(`SELECT entry_id, transcript_id, seq, entry_kind, role, payload_json, created_at
|
|
261
|
+
FROM transcript_entries WHERE transcript_id = ? AND entry_kind = 'message' AND role = 'user'
|
|
262
|
+
ORDER BY seq DESC LIMIT ?`).all(transcriptId, limit).map(transcriptEntryRowToStoredRow);
|
|
263
|
+
}
|
|
245
264
|
function loadTranscriptHistoryRowsForSession(conversationId) {
|
|
246
265
|
if (!getCurrentTranscriptId(conversationId)) return [];
|
|
247
266
|
return getSqliteDatabase().prepare(`SELECT e.entry_id, e.transcript_id, e.seq, e.entry_kind, e.role, e.payload_json, e.created_at
|
|
@@ -480,4 +499,4 @@ function restoreBeforeCompactionBoundary(conversationId, compactionId) {
|
|
|
480
499
|
});
|
|
481
500
|
}
|
|
482
501
|
//#endregion
|
|
483
|
-
export { appendCompactionBoundaryIfUnchanged, appendMediaToAssistantTranscriptEntry, appendTranscriptEntry, archiveFailedModelAttempts, findLatestAssistantTranscriptEntryId, listCompactionBoundaries, loadCompactionSourceSnapshot, loadLlmMessagesForSession, loadTranscriptHistoryRowsForSession, loadTranscriptRows, loadTranscriptRowsForSession, paginateTranscriptMessages, replaceTranscriptRows, restoreBeforeCompactionBoundary, searchSessionTranscript };
|
|
502
|
+
export { appendCompactionBoundaryIfUnchanged, appendMediaToAssistantTranscriptEntry, appendTranscriptEntry, archiveFailedModelAttempts, findLatestAssistantTranscriptEntryId, listCompactionBoundaries, loadCompactionSourceSnapshot, loadLlmMessagesForSession, loadRecentUserTranscriptRows, loadTranscriptHistoryRowsForSession, loadTranscriptRows, loadTranscriptRowsForSession, paginateTranscriptMessages, replaceTranscriptRows, restoreBeforeCompactionBoundary, searchSessionTranscript };
|
|
@@ -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,30 @@
|
|
|
1
|
+
CREATE TABLE music_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,
|
|
5
|
+
work_id TEXT NOT NULL,
|
|
6
|
+
parent_id TEXT,
|
|
7
|
+
version_number INTEGER NOT NULL,
|
|
8
|
+
model_ref TEXT NOT NULL,
|
|
9
|
+
request_hash TEXT NOT NULL,
|
|
10
|
+
title TEXT NOT NULL,
|
|
11
|
+
mode TEXT NOT NULL CHECK (mode IN ('song', 'instrumental')),
|
|
12
|
+
prompt TEXT NOT NULL,
|
|
13
|
+
lyrics TEXT,
|
|
14
|
+
state TEXT NOT NULL CHECK (state IN ('queued', 'submitting', 'submitted', 'running', 'saving', 'completed', 'failed', 'submission_unknown')),
|
|
15
|
+
provider_task_id TEXT,
|
|
16
|
+
duration_ms INTEGER,
|
|
17
|
+
error TEXT,
|
|
18
|
+
next_attempt_at INTEGER NOT NULL,
|
|
19
|
+
lease_token TEXT,
|
|
20
|
+
lease_until INTEGER,
|
|
21
|
+
created_at INTEGER NOT NULL,
|
|
22
|
+
UNIQUE (work_id, version_number)
|
|
23
|
+
);
|
|
24
|
+
CREATE INDEX music_generation_due ON music_generation_jobs(next_attempt_at)
|
|
25
|
+
WHERE state IN ('queued', 'submitting', 'submitted', 'running', 'saving');
|
|
26
|
+
CREATE INDEX music_generation_transcript ON music_generation_jobs(conversation_id, transcript_id, created_at DESC);
|
|
27
|
+
CREATE TABLE music_generation_daily_usage (
|
|
28
|
+
day INTEGER PRIMARY KEY,
|
|
29
|
+
count INTEGER NOT NULL
|
|
30
|
+
);
|
|
@@ -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 };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type VideoGenerationDraft, type VideoRatio, type VideoResolution } from '@xopcai/gateway-contract';
|
|
2
|
+
import type { MediaRef } from '../media/types.js';
|
|
3
|
+
export declare function getVideoDraft(conversationId: string, transcriptId: string): VideoGenerationDraft | undefined;
|
|
4
|
+
export declare function deleteVideoDraft(conversationId: string): void;
|
|
5
|
+
export declare function videoDraftImages(conversationId: string): {
|
|
6
|
+
current: MediaRef[];
|
|
7
|
+
recent: MediaRef[];
|
|
8
|
+
};
|
|
9
|
+
export declare function prepareVideoDraft(conversationId: string, input: {
|
|
10
|
+
action: 'create' | 'update' | 'revise';
|
|
11
|
+
prompt?: string;
|
|
12
|
+
duration?: number;
|
|
13
|
+
ratio?: VideoRatio;
|
|
14
|
+
resolution?: VideoResolution;
|
|
15
|
+
image?: 'current' | 'none';
|
|
16
|
+
imageUri?: string;
|
|
17
|
+
}): VideoGenerationDraft;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { VIDEO_MODELS, estimateVideoCostFen, isVideoDurationSupported } from "../../packages/gateway-contract/src/video-generation.js";
|
|
2
|
+
import { init_src } from "../../packages/gateway-contract/src/index.js";
|
|
3
|
+
import { DurableState } from "../storage/sqlite/durable-state.js";
|
|
4
|
+
import { getCurrentTranscriptId, init_session_repository } from "../storage/sqlite/session-repository.js";
|
|
5
|
+
import { loadRecentUserTranscriptRows } from "../storage/sqlite/transcript-repository.js";
|
|
6
|
+
import { getActiveTranscriptUserMedia } from "../agent/inbound/attachment-pipeline.js";
|
|
7
|
+
import { getVideoDefaults, getVideoModel } from "./settings.js";
|
|
8
|
+
import { getVideoJob } from "./repository.js";
|
|
9
|
+
import { randomUUID } from "node:crypto";
|
|
10
|
+
//#region src/video-generation/drafts.ts
|
|
11
|
+
init_src();
|
|
12
|
+
init_session_repository();
|
|
13
|
+
const drafts = new DurableState("video-generation-drafts");
|
|
14
|
+
const supportedImage = (media) => media.uri.startsWith("media://") && /^image\/(png|jpeg|webp)$/i.test(media.mimeType);
|
|
15
|
+
function getVideoDraft(conversationId, transcriptId) {
|
|
16
|
+
const draft = drafts.get(conversationId);
|
|
17
|
+
return draft?.transcriptId === transcriptId ? draft : void 0;
|
|
18
|
+
}
|
|
19
|
+
function deleteVideoDraft(conversationId) {
|
|
20
|
+
drafts.delete(conversationId);
|
|
21
|
+
}
|
|
22
|
+
function videoDraftImages(conversationId) {
|
|
23
|
+
const turns = loadRecentUserTranscriptRows(conversationId, 20).filter((row) => "role" in row && row.role === "user");
|
|
24
|
+
const current = (getActiveTranscriptUserMedia(conversationId) ?? turns[0]?.media ?? []).filter(supportedImage);
|
|
25
|
+
const images = [...current, ...turns.flatMap((turn) => turn.media ?? []).filter(supportedImage)];
|
|
26
|
+
return {
|
|
27
|
+
current,
|
|
28
|
+
recent: [...new Map(images.map((image) => [image.uri, image])).values()]
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function prepareVideoDraft(conversationId, input) {
|
|
32
|
+
return drafts.update(conversationId, (stored) => {
|
|
33
|
+
const transcriptId = getCurrentTranscriptId(conversationId);
|
|
34
|
+
if (!transcriptId) throw new Error("The conversation is no longer available.");
|
|
35
|
+
const previous = stored?.transcriptId === transcriptId ? stored : void 0;
|
|
36
|
+
const job = previous && getVideoJob(conversationId, previous.id);
|
|
37
|
+
if (input.action === "update" && (!previous || job)) throw new Error("There is no pending draft to update.");
|
|
38
|
+
if (input.action === "revise" && !job) throw new Error("There is no submitted video to use as a starting point.");
|
|
39
|
+
if (input.action === "create" && previous && !job) throw new Error("A video draft is already pending. Update it instead.");
|
|
40
|
+
const base = input.action === "create" ? void 0 : previous;
|
|
41
|
+
const modelRef = getVideoModel();
|
|
42
|
+
const model = VIDEO_MODELS[modelRef];
|
|
43
|
+
const defaults = getVideoDefaults(modelRef);
|
|
44
|
+
const prompt = (input.prompt ?? base?.prompt ?? "").trim();
|
|
45
|
+
if (!prompt || prompt.length > 1e3) throw new Error("Provide a video description of 1–1000 characters.");
|
|
46
|
+
const inherited = base?.modelRef === modelRef ? base : void 0;
|
|
47
|
+
const duration = input.duration ?? inherited?.duration ?? defaults.duration;
|
|
48
|
+
const resolution = input.resolution ?? inherited?.resolution ?? defaults.resolution;
|
|
49
|
+
if (!isVideoDurationSupported(model, duration) || !model.resolutions.includes(resolution)) throw new Error(`${model.name} supports ${model.minDuration}–${model.maxDuration} seconds or auto (-1) and ${model.resolutions.join(", ")}.`);
|
|
50
|
+
let imageUri = base?.imageUri ?? null;
|
|
51
|
+
let imageName = base?.imageName ?? null;
|
|
52
|
+
if (input.image === "none") {
|
|
53
|
+
imageUri = null;
|
|
54
|
+
imageName = null;
|
|
55
|
+
} else if (input.imageUri || input.image === "current" || !base) {
|
|
56
|
+
const images = videoDraftImages(conversationId);
|
|
57
|
+
const current = [...new Map(images.current.map((image) => [image.uri, image])).values()];
|
|
58
|
+
if (!input.imageUri && current.length > 1) throw new Error("Multiple images were attached. Ask which image to use.");
|
|
59
|
+
const image = input.imageUri ? images.recent.find((candidate) => candidate.uri === input.imageUri) : current[0];
|
|
60
|
+
if (!image && (input.imageUri || input.image === "current")) throw new Error("That reference image is unavailable. Ask for an image from this conversation.");
|
|
61
|
+
imageUri = image?.uri ?? null;
|
|
62
|
+
imageName = image?.name ?? null;
|
|
63
|
+
}
|
|
64
|
+
const inheritedRatio = inherited?.ratio;
|
|
65
|
+
const ratio = input.ratio ?? (imageUri ? inheritedRatio && model.imageRatios.includes(inheritedRatio) ? inheritedRatio : model.imageRatios[0] : inheritedRatio === "9:16" ? "9:16" : "16:9");
|
|
66
|
+
if (imageUri && !model.imageRatios.includes(ratio) || !imageUri && ratio === "adaptive") throw new Error(imageUri ? `${model.name} supports these first-frame ratios: ${model.imageRatios.join(", ")}.` : "Choose 16:9 or 9:16 for a text-only video.");
|
|
67
|
+
const updating = input.action === "update";
|
|
68
|
+
const draft = {
|
|
69
|
+
id: updating ? base.id : randomUUID(),
|
|
70
|
+
revision: updating ? base.revision + 1 : 1,
|
|
71
|
+
transcriptId,
|
|
72
|
+
modelRef,
|
|
73
|
+
prompt,
|
|
74
|
+
duration,
|
|
75
|
+
resolution,
|
|
76
|
+
ratio,
|
|
77
|
+
imageUri,
|
|
78
|
+
imageName,
|
|
79
|
+
estimatedCostFen: estimateVideoCostFen(modelRef, duration, resolution),
|
|
80
|
+
createdAt: updating ? base.createdAt : Date.now()
|
|
81
|
+
};
|
|
82
|
+
return {
|
|
83
|
+
value: draft,
|
|
84
|
+
result: draft
|
|
85
|
+
};
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
export { deleteVideoDraft, getVideoDraft, prepareVideoDraft, videoDraftImages };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { VideoGenerationJob, VideoModelRef } from '@xopcai/gateway-contract';
|
|
2
|
+
export type VideoProviderInput = Pick<VideoGenerationJob, 'prompt' | 'duration' | 'ratio' | 'resolution'> & {
|
|
3
|
+
model_ref: VideoModelRef;
|
|
4
|
+
image_bytes: Uint8Array | null;
|
|
5
|
+
image_mime: string | null;
|
|
6
|
+
};
|
|
7
|
+
export type VideoProviderStatus = {
|
|
8
|
+
state: 'submitted' | 'running';
|
|
9
|
+
} | {
|
|
10
|
+
state: 'completed';
|
|
11
|
+
url: string;
|
|
12
|
+
expiresAt?: number;
|
|
13
|
+
} | {
|
|
14
|
+
state: 'failed';
|
|
15
|
+
reason: string;
|
|
16
|
+
};
|
|
17
|
+
export declare class VideoProviderError extends Error {
|
|
18
|
+
readonly rejected: boolean;
|
|
19
|
+
constructor(provider: string, status: number, code?: string);
|
|
20
|
+
}
|
|
21
|
+
export declare function safeVideoErrorCode(code: unknown): string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/video-generation/provider-types.ts
|
|
2
|
+
var VideoProviderError = class extends Error {
|
|
3
|
+
rejected;
|
|
4
|
+
constructor(provider, status, code) {
|
|
5
|
+
const safeCode = code && /^[\w.-]{1,80}$/.test(code) ? ` (${code})` : "";
|
|
6
|
+
super(`${provider} returned HTTP ${status}${safeCode}`);
|
|
7
|
+
this.rejected = status >= 400 && status < 500 && status !== 408 || status === 200 && Boolean(code);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
function safeVideoErrorCode(code) {
|
|
11
|
+
return typeof code === "string" && /^[\w.-]{1,80}$/.test(code) ? ` (${code})` : "";
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { VideoProviderError, safeVideoErrorCode };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type VideoModelRef, type VideoModelDefinition } from '@xopcai/gateway-contract';
|
|
2
|
+
import { type VideoProviderInput, type VideoProviderStatus } from './provider-types.js';
|
|
3
|
+
type ProviderId = VideoModelDefinition['provider'];
|
|
4
|
+
interface VideoProvider {
|
|
5
|
+
name: string;
|
|
6
|
+
taskTtlMs: number;
|
|
7
|
+
resolveKey: () => Promise<string | undefined>;
|
|
8
|
+
submit: (key: string, job: VideoProviderInput) => Promise<string>;
|
|
9
|
+
query: (key: string, taskId: string) => Promise<VideoProviderStatus>;
|
|
10
|
+
downloadHost: RegExp;
|
|
11
|
+
}
|
|
12
|
+
export declare function getVideoProvider(ref: VideoModelRef): VideoProvider;
|
|
13
|
+
export declare function getConfiguredVideoProviders(): Promise<Record<ProviderId, boolean>>;
|
|
14
|
+
export declare function fetchProviderVideo(provider: VideoProvider, url: string): Promise<Response>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { VIDEO_MODELS } from "../../packages/gateway-contract/src/video-generation.js";
|
|
2
|
+
import { init_src } from "../../packages/gateway-contract/src/index.js";
|
|
3
|
+
import { assertSafeUrl } from "../media-shared/http/ssrf-guard.js";
|
|
4
|
+
import { safeVideoErrorCode } from "./provider-types.js";
|
|
5
|
+
import { querySeedanceVideo, resolveSeedanceKey, submitSeedanceVideo } from "./seedance.js";
|
|
6
|
+
import { queryWanVideo, resolveWanKey, submitWanVideo } from "./wan.js";
|
|
7
|
+
//#region src/video-generation/providers.ts
|
|
8
|
+
init_src();
|
|
9
|
+
const dayMs = 1440 * 60 * 1e3;
|
|
10
|
+
const providers = {
|
|
11
|
+
"dashscope-cn": {
|
|
12
|
+
name: "Bailian",
|
|
13
|
+
taskTtlMs: dayMs,
|
|
14
|
+
resolveKey: resolveWanKey,
|
|
15
|
+
submit: submitWanVideo,
|
|
16
|
+
downloadHost: /(^|\.)aliyuncs\.com$/i,
|
|
17
|
+
async query(key, taskId) {
|
|
18
|
+
const result = await queryWanVideo(key, taskId);
|
|
19
|
+
switch (result.task_status) {
|
|
20
|
+
case "PENDING": return { state: "submitted" };
|
|
21
|
+
case "RUNNING": return { state: "running" };
|
|
22
|
+
case "SUCCEEDED":
|
|
23
|
+
if (typeof result.video_url === "string" && result.video_url) return {
|
|
24
|
+
state: "completed",
|
|
25
|
+
url: result.video_url
|
|
26
|
+
};
|
|
27
|
+
break;
|
|
28
|
+
case "FAILED":
|
|
29
|
+
case "CANCELED":
|
|
30
|
+
case "UNKNOWN": return {
|
|
31
|
+
state: "failed",
|
|
32
|
+
reason: `Bailian task ${result.task_status.toLowerCase()}${safeVideoErrorCode(result.code)}.`
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
throw new Error("Bailian returned an incomplete or unrecognized task state");
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"volcengine-ark": {
|
|
39
|
+
name: "Volcengine Ark",
|
|
40
|
+
taskTtlMs: 7 * dayMs,
|
|
41
|
+
resolveKey: resolveSeedanceKey,
|
|
42
|
+
submit: submitSeedanceVideo,
|
|
43
|
+
query: querySeedanceVideo,
|
|
44
|
+
downloadHost: /^[a-z0-9.-]+\.tos-cn-[a-z0-9-]+\.volces\.com$/i
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
function getVideoProvider(ref) {
|
|
48
|
+
return providers[VIDEO_MODELS[ref].provider];
|
|
49
|
+
}
|
|
50
|
+
async function getConfiguredVideoProviders() {
|
|
51
|
+
const [wan, seedance] = await Promise.all([resolveWanKey().catch(() => void 0), resolveSeedanceKey().catch(() => void 0)]);
|
|
52
|
+
return {
|
|
53
|
+
"dashscope-cn": Boolean(wan),
|
|
54
|
+
"volcengine-ark": Boolean(seedance)
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
async function fetchProviderVideo(provider, url) {
|
|
58
|
+
const parsed = new URL(url);
|
|
59
|
+
if (parsed.protocol !== "https:" || parsed.username || parsed.password || parsed.port || !provider.downloadHost.test(parsed.hostname)) throw new Error(`${provider.name} returned an invalid video download host`);
|
|
60
|
+
await assertSafeUrl(parsed);
|
|
61
|
+
const response = await fetch(parsed, {
|
|
62
|
+
redirect: "error",
|
|
63
|
+
signal: AbortSignal.timeout(3e4)
|
|
64
|
+
});
|
|
65
|
+
if (!response.ok || !response.body) {
|
|
66
|
+
await response.body?.cancel();
|
|
67
|
+
throw new Error(`Video download returned HTTP ${response.status}`);
|
|
68
|
+
}
|
|
69
|
+
return response;
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { fetchProviderVideo, getConfiguredVideoProviders, getVideoProvider };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type VideoGenerationJob, type VideoGenerationState } from '@xopcai/gateway-contract';
|
|
2
|
+
type VideoRequest = Pick<VideoGenerationJob, 'id' | 'transcriptId' | 'prompt' | 'duration' | 'ratio' | 'resolution' | 'imageName' | 'modelRef'>;
|
|
3
|
+
interface JobRow {
|
|
4
|
+
id: string;
|
|
5
|
+
conversation_id: string;
|
|
6
|
+
transcript_id: string;
|
|
7
|
+
request_hash: string;
|
|
8
|
+
model_ref: VideoGenerationJob['modelRef'];
|
|
9
|
+
prompt: string;
|
|
10
|
+
duration: number;
|
|
11
|
+
ratio: VideoGenerationJob['ratio'];
|
|
12
|
+
resolution: VideoGenerationJob['resolution'];
|
|
13
|
+
image_name: string | null;
|
|
14
|
+
image_mime: string | null;
|
|
15
|
+
image_bytes: Uint8Array | null;
|
|
16
|
+
state: VideoGenerationState;
|
|
17
|
+
provider_task_id: string | null;
|
|
18
|
+
error: string | null;
|
|
19
|
+
created_at: number;
|
|
20
|
+
}
|
|
21
|
+
export declare function publicVideoJob(row: JobRow): VideoGenerationJob;
|
|
22
|
+
export declare function listVideoJobs(conversationId: string): VideoGenerationJob[];
|
|
23
|
+
export declare function listVideoJobIds(conversationId: string): string[];
|
|
24
|
+
export declare function getVideoJob(conversationId: string, id: string): JobRow | undefined;
|
|
25
|
+
export declare function enqueueVideoJob(conversationId: string, request: VideoRequest, requestHash: string, image?: {
|
|
26
|
+
bytes: Buffer;
|
|
27
|
+
mime: string;
|
|
28
|
+
}): {
|
|
29
|
+
readonly error: "conversation_changed";
|
|
30
|
+
job?: undefined;
|
|
31
|
+
} | {
|
|
32
|
+
job: VideoGenerationJob;
|
|
33
|
+
error?: undefined;
|
|
34
|
+
} | {
|
|
35
|
+
readonly error: "idempotency_conflict";
|
|
36
|
+
job?: undefined;
|
|
37
|
+
} | {
|
|
38
|
+
readonly error: "model_changed";
|
|
39
|
+
job?: undefined;
|
|
40
|
+
} | {
|
|
41
|
+
readonly error: "queue_full";
|
|
42
|
+
job?: undefined;
|
|
43
|
+
} | {
|
|
44
|
+
readonly error: "budget_exhausted";
|
|
45
|
+
job?: undefined;
|
|
46
|
+
};
|
|
47
|
+
export declare function claimVideoJob(now?: number): {
|
|
48
|
+
row: JobRow;
|
|
49
|
+
token: `${string}-${string}-${string}-${string}-${string}`;
|
|
50
|
+
};
|
|
51
|
+
export declare function beginVideoSubmission(id: string, token: string): boolean;
|
|
52
|
+
export declare function updateVideoJob(id: string, token: string, state: VideoGenerationState, options?: {
|
|
53
|
+
providerTaskId?: string;
|
|
54
|
+
delayMs?: number;
|
|
55
|
+
error?: string;
|
|
56
|
+
keepLease?: boolean;
|
|
57
|
+
}): boolean;
|
|
58
|
+
export {};
|