@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,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 {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
|
|
2
|
+
import { VIDEO_MODELS, estimateVideoCostFen } from "../../packages/gateway-contract/src/video-generation.js";
|
|
3
|
+
import { init_src } from "../../packages/gateway-contract/src/index.js";
|
|
4
|
+
import { getVideoModel } from "./settings.js";
|
|
5
|
+
import { randomUUID } from "node:crypto";
|
|
6
|
+
//#region src/video-generation/repository.ts
|
|
7
|
+
init_src();
|
|
8
|
+
init_transaction();
|
|
9
|
+
function publicVideoJob(row) {
|
|
10
|
+
return {
|
|
11
|
+
id: row.id,
|
|
12
|
+
transcriptId: row.transcript_id,
|
|
13
|
+
modelRef: row.model_ref,
|
|
14
|
+
prompt: row.prompt,
|
|
15
|
+
duration: row.duration,
|
|
16
|
+
ratio: row.ratio,
|
|
17
|
+
resolution: row.resolution,
|
|
18
|
+
imageName: row.image_name,
|
|
19
|
+
state: row.state,
|
|
20
|
+
error: row.error,
|
|
21
|
+
createdAt: row.created_at
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function listVideoJobs(conversationId) {
|
|
25
|
+
return getSqliteDatabase().prepare(`SELECT id, transcript_id, model_ref, prompt, duration, ratio, resolution,
|
|
26
|
+
image_name, state, error, created_at FROM video_generation_jobs WHERE conversation_id = ?
|
|
27
|
+
ORDER BY created_at DESC, rowid DESC`).all(conversationId).map(publicVideoJob);
|
|
28
|
+
}
|
|
29
|
+
function listVideoJobIds(conversationId) {
|
|
30
|
+
return getSqliteDatabase().prepare("SELECT id FROM video_generation_jobs WHERE conversation_id = ?").all(conversationId).map((row) => String(row.id));
|
|
31
|
+
}
|
|
32
|
+
function getVideoJob(conversationId, id) {
|
|
33
|
+
return getSqliteDatabase().prepare("SELECT * FROM video_generation_jobs WHERE conversation_id = ? AND id = ?").get(conversationId, id);
|
|
34
|
+
}
|
|
35
|
+
function enqueueVideoJob(conversationId, request, requestHash, image) {
|
|
36
|
+
return runSqliteWriteTransaction((db) => {
|
|
37
|
+
if (db.prepare("SELECT active_transcript_id FROM sessions WHERE conversation_id = ?").get(conversationId)?.active_transcript_id !== request.transcriptId) return { error: "conversation_changed" };
|
|
38
|
+
const existing = db.prepare("SELECT * FROM video_generation_jobs WHERE id = ?").get(request.id);
|
|
39
|
+
if (existing) return existing.conversation_id === conversationId && existing.request_hash === requestHash && existing.model_ref === request.modelRef ? { job: publicVideoJob(existing) } : { error: "idempotency_conflict" };
|
|
40
|
+
if (getVideoModel() !== request.modelRef) return { error: "model_changed" };
|
|
41
|
+
const active = db.prepare(`SELECT count(*) AS count FROM video_generation_jobs
|
|
42
|
+
WHERE state IN ('queued','submitting','submitted','running','saving')`).get();
|
|
43
|
+
if (Number(active?.count) >= 3) return { error: "queue_full" };
|
|
44
|
+
const now = Date.now();
|
|
45
|
+
const day = Math.floor(now / 864e5);
|
|
46
|
+
const provider = VIDEO_MODELS[request.modelRef].provider;
|
|
47
|
+
const configuredBudget = (provider === "dashscope-cn" ? process.env.XOPC_WAN_DAILY_BUDGET_CNY : process.env.XOPC_SEEDANCE_DAILY_BUDGET_CNY)?.trim();
|
|
48
|
+
const budget = configuredBudget ? Number(configuredBudget) : NaN;
|
|
49
|
+
const budgetFen = Number.isFinite(budget) && budget >= 0 ? Math.floor(budget * 100) : Infinity;
|
|
50
|
+
const costFen = estimateVideoCostFen(request.modelRef, request.duration, request.resolution);
|
|
51
|
+
if (Number(db.prepare("SELECT reserved_fen FROM video_generation_provider_budget WHERE provider = ? AND day = ?").get(provider, day)?.reserved_fen ?? 0) + costFen > budgetFen) return { error: "budget_exhausted" };
|
|
52
|
+
db.prepare(`INSERT INTO video_generation_provider_budget (provider, day, reserved_fen) VALUES (?, ?, ?)
|
|
53
|
+
ON CONFLICT(provider, day) DO UPDATE SET reserved_fen = reserved_fen + excluded.reserved_fen`).run(provider, day, costFen);
|
|
54
|
+
db.prepare(`INSERT INTO video_generation_jobs (id, conversation_id, transcript_id, request_hash, model_ref,
|
|
55
|
+
prompt, duration, ratio, resolution, image_name, image_mime, image_bytes, state, next_attempt_at, created_at)
|
|
56
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'queued', ?, ?)`).run(request.id, conversationId, request.transcriptId, requestHash, request.modelRef, request.prompt, request.duration, request.ratio, request.resolution, request.imageName, image?.mime ?? null, image?.bytes ?? null, now, now);
|
|
57
|
+
return { job: publicVideoJob(getVideoJob(conversationId, request.id)) };
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
function claimVideoJob(now = Date.now()) {
|
|
61
|
+
return runSqliteWriteTransaction((db) => {
|
|
62
|
+
db.prepare(`UPDATE video_generation_jobs SET state = 'submission_unknown', image_bytes = NULL,
|
|
63
|
+
error = 'The provider may have accepted the request. Check its console before generating again.',
|
|
64
|
+
lease_token = NULL, lease_until = NULL WHERE state = 'submitting' AND lease_until <= ?`).run(now);
|
|
65
|
+
const row = db.prepare(`SELECT * FROM video_generation_jobs
|
|
66
|
+
WHERE state IN ('queued','submitted','running','saving') AND next_attempt_at <= ?
|
|
67
|
+
AND (lease_until IS NULL OR lease_until <= ?) ORDER BY next_attempt_at, rowid LIMIT 1`).get(now, now);
|
|
68
|
+
if (!row) return null;
|
|
69
|
+
const token = randomUUID();
|
|
70
|
+
db.prepare("UPDATE video_generation_jobs SET lease_token = ?, lease_until = ? WHERE id = ?").run(token, now + 6e4, row.id);
|
|
71
|
+
return {
|
|
72
|
+
row,
|
|
73
|
+
token
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
function beginVideoSubmission(id, token) {
|
|
78
|
+
return getSqliteDatabase().prepare(`UPDATE video_generation_jobs SET state = 'submitting'
|
|
79
|
+
WHERE id = ? AND lease_token = ? AND lease_until > ? AND state = 'queued'`).run(id, token, Date.now()).changes === 1;
|
|
80
|
+
}
|
|
81
|
+
function updateVideoJob(id, token, state, options = {}) {
|
|
82
|
+
const now = Date.now();
|
|
83
|
+
return getSqliteDatabase().prepare(`UPDATE video_generation_jobs SET state = ?, error = ?,
|
|
84
|
+
provider_task_id = COALESCE(?, provider_task_id), next_attempt_at = ?,
|
|
85
|
+
lease_token = CASE WHEN ? THEN lease_token ELSE NULL END,
|
|
86
|
+
lease_until = CASE WHEN ? THEN lease_until ELSE NULL END,
|
|
87
|
+
image_bytes = CASE WHEN ? = 'queued' THEN image_bytes ELSE NULL END
|
|
88
|
+
WHERE id = ? AND lease_token = ? AND lease_until > ?`).run(state, options.error ?? null, options.providerTaskId ?? null, now + (options.delayMs ?? 0), Number(options.keepLease ?? false), Number(options.keepLease ?? false), state, id, token, now).changes === 1;
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { beginVideoSubmission, claimVideoJob, enqueueVideoJob, getVideoJob, listVideoJobIds, listVideoJobs, publicVideoJob, updateVideoJob };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type VideoProviderInput, type VideoProviderStatus } from './provider-types.js';
|
|
2
|
+
export declare function resolveSeedanceKey(): Promise<string | undefined>;
|
|
3
|
+
export declare function submitSeedanceVideo(key: string, job: VideoProviderInput): Promise<string>;
|
|
4
|
+
export declare function querySeedanceVideo(key: string, taskId: string): Promise<VideoProviderStatus>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { getApiKey, init_providers } from "../providers/index.js";
|
|
2
|
+
import { VideoProviderError, safeVideoErrorCode } from "./provider-types.js";
|
|
3
|
+
//#region src/video-generation/seedance.ts
|
|
4
|
+
init_providers();
|
|
5
|
+
const ARK_TASKS = "https://ark.cn-beijing.volces.com/api/v3/contents/generations/tasks";
|
|
6
|
+
async function resolveSeedanceKey() {
|
|
7
|
+
const key = await getApiKey("volcengine-ark");
|
|
8
|
+
return key && key !== "extension-managed" ? key : void 0;
|
|
9
|
+
}
|
|
10
|
+
async function requestArk(key, taskId, body) {
|
|
11
|
+
const response = await fetch(taskId ? `${ARK_TASKS}/${encodeURIComponent(taskId)}` : ARK_TASKS, {
|
|
12
|
+
method: body ? "POST" : "GET",
|
|
13
|
+
headers: {
|
|
14
|
+
Authorization: `Bearer ${key}`,
|
|
15
|
+
...body ? { "Content-Type": "application/json" } : {}
|
|
16
|
+
},
|
|
17
|
+
body: body && JSON.stringify(body),
|
|
18
|
+
redirect: "error",
|
|
19
|
+
signal: AbortSignal.timeout(2e4)
|
|
20
|
+
});
|
|
21
|
+
const result = await response.json().catch(() => void 0);
|
|
22
|
+
if (!response.ok) throw new VideoProviderError("Volcengine Ark", response.status, result?.error?.code);
|
|
23
|
+
if (!result || typeof result !== "object") throw new Error("Ark did not return a task result");
|
|
24
|
+
return result;
|
|
25
|
+
}
|
|
26
|
+
async function submitSeedanceVideo(key, job) {
|
|
27
|
+
const result = await requestArk(key, void 0, {
|
|
28
|
+
model: job.model_ref.split("/")[1],
|
|
29
|
+
content: [{
|
|
30
|
+
type: "text",
|
|
31
|
+
text: job.prompt
|
|
32
|
+
}, ...job.image_bytes ? [{
|
|
33
|
+
type: "image_url",
|
|
34
|
+
role: "first_frame",
|
|
35
|
+
image_url: { url: `data:${job.image_mime};base64,${Buffer.from(job.image_bytes).toString("base64")}` }
|
|
36
|
+
}] : []],
|
|
37
|
+
ratio: job.ratio,
|
|
38
|
+
duration: job.duration,
|
|
39
|
+
resolution: job.resolution.toLowerCase(),
|
|
40
|
+
generate_audio: false,
|
|
41
|
+
watermark: true
|
|
42
|
+
});
|
|
43
|
+
if (typeof result.id !== "string" || !/^[\w-]{1,128}$/.test(result.id)) throw new Error("Ark did not return a valid task ID");
|
|
44
|
+
return result.id;
|
|
45
|
+
}
|
|
46
|
+
async function querySeedanceVideo(key, taskId) {
|
|
47
|
+
const result = await requestArk(key, taskId);
|
|
48
|
+
switch (result.status) {
|
|
49
|
+
case "queued": return { state: "submitted" };
|
|
50
|
+
case "running": return { state: "running" };
|
|
51
|
+
case "succeeded":
|
|
52
|
+
if (typeof result.content?.video_url === "string" && result.content.video_url) {
|
|
53
|
+
const updatedAt = result.updated_at;
|
|
54
|
+
const expiresAt = typeof updatedAt === "number" && Number.isFinite(updatedAt) && updatedAt > 0 ? (updatedAt + 86400) * 1e3 : void 0;
|
|
55
|
+
return {
|
|
56
|
+
state: "completed",
|
|
57
|
+
url: result.content.video_url,
|
|
58
|
+
...expiresAt ? { expiresAt } : {}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
break;
|
|
62
|
+
case "failed":
|
|
63
|
+
case "cancelled":
|
|
64
|
+
case "expired": return {
|
|
65
|
+
state: "failed",
|
|
66
|
+
reason: `Volcengine Ark task ${result.status}${safeVideoErrorCode(result.error?.code)}.`
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
throw new Error("Ark returned an incomplete or unrecognized task state");
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { querySeedanceVideo, resolveSeedanceKey, submitSeedanceVideo };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type VideoGenerationDefaults, type VideoModelRef } from '@xopcai/gateway-contract';
|
|
2
|
+
export declare function getVideoModel(): VideoModelRef;
|
|
3
|
+
export declare function setVideoModel(modelRef: VideoModelRef): void;
|
|
4
|
+
export declare function getVideoDefaults(modelRef: VideoModelRef): VideoGenerationDefaults;
|
|
5
|
+
export declare function setVideoDefaults(modelRef: VideoModelRef, value: VideoGenerationDefaults): void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { VIDEO_MODEL_REFS, WAN_VIDEO_MODEL_REF } 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
|
+
//#region src/video-generation/settings.ts
|
|
5
|
+
init_src();
|
|
6
|
+
const settings = new DurableState("video-generation");
|
|
7
|
+
const defaults = new DurableState("video-generation-defaults");
|
|
8
|
+
function getVideoModel() {
|
|
9
|
+
const selected = settings.get("model");
|
|
10
|
+
return selected && VIDEO_MODEL_REFS.includes(selected) ? selected : WAN_VIDEO_MODEL_REF;
|
|
11
|
+
}
|
|
12
|
+
function setVideoModel(modelRef) {
|
|
13
|
+
settings.set("model", modelRef);
|
|
14
|
+
}
|
|
15
|
+
function getVideoDefaults(modelRef) {
|
|
16
|
+
return defaults.get(modelRef) ?? {
|
|
17
|
+
duration: 5,
|
|
18
|
+
resolution: "720P"
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function setVideoDefaults(modelRef, value) {
|
|
22
|
+
defaults.set(modelRef, value);
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { getVideoDefaults, getVideoModel, setVideoDefaults, setVideoModel };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type VideoProviderInput } from './provider-types.js';
|
|
2
|
+
export declare function resolveWanKey(): Promise<string | undefined>;
|
|
3
|
+
export declare function submitWanVideo(key: string, job: VideoProviderInput): Promise<string>;
|
|
4
|
+
export declare function queryWanVideo(key: string, id: string): Promise<{
|
|
5
|
+
task_id?: string;
|
|
6
|
+
task_status?: string;
|
|
7
|
+
video_url?: string;
|
|
8
|
+
code?: string;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { getApiKey, init_providers } from "../providers/index.js";
|
|
2
|
+
import { VideoProviderError } from "./provider-types.js";
|
|
3
|
+
//#region src/video-generation/wan.ts
|
|
4
|
+
init_providers();
|
|
5
|
+
async function resolveWanKey() {
|
|
6
|
+
const key = await getApiKey("dashscope-cn");
|
|
7
|
+
return key && key !== "extension-managed" ? key : void 0;
|
|
8
|
+
}
|
|
9
|
+
function wanEndpoint() {
|
|
10
|
+
const workspace = process.env.XOPC_WAN_WORKSPACE_ID?.trim();
|
|
11
|
+
if (!workspace) return "https://dashscope.aliyuncs.com";
|
|
12
|
+
if (!/^[a-z0-9-]{1,63}$/i.test(workspace)) throw new Error("Invalid XOPC_WAN_WORKSPACE_ID");
|
|
13
|
+
return `https://${workspace}.cn-beijing.maas.aliyuncs.com`;
|
|
14
|
+
}
|
|
15
|
+
async function requestWan(path, key, body) {
|
|
16
|
+
const response = await fetch(new URL(path, wanEndpoint()), {
|
|
17
|
+
method: body ? "POST" : "GET",
|
|
18
|
+
headers: {
|
|
19
|
+
Authorization: `Bearer ${key}`,
|
|
20
|
+
...body ? {
|
|
21
|
+
"Content-Type": "application/json",
|
|
22
|
+
"X-DashScope-Async": "enable"
|
|
23
|
+
} : {}
|
|
24
|
+
},
|
|
25
|
+
body: body && JSON.stringify(body),
|
|
26
|
+
redirect: "error",
|
|
27
|
+
signal: AbortSignal.timeout(2e4)
|
|
28
|
+
});
|
|
29
|
+
const result = await response.json().catch(() => void 0);
|
|
30
|
+
if (!response.ok || result?.code) throw new VideoProviderError("Bailian", response.status, result?.code);
|
|
31
|
+
if (!result?.output) throw new Error("Bailian did not return a task result");
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
async function submitWanVideo(key, job) {
|
|
35
|
+
const id = (await requestWan("/api/v1/services/aigc/video-generation/video-synthesis", key, {
|
|
36
|
+
model: job.model_ref.split("/")[1],
|
|
37
|
+
input: {
|
|
38
|
+
prompt: job.prompt,
|
|
39
|
+
...job.image_bytes ? { media: [{
|
|
40
|
+
type: "first_frame",
|
|
41
|
+
url: `data:${job.image_mime};base64,${Buffer.from(job.image_bytes).toString("base64")}`
|
|
42
|
+
}] } : {}
|
|
43
|
+
},
|
|
44
|
+
parameters: {
|
|
45
|
+
duration: job.duration,
|
|
46
|
+
ratio: job.ratio,
|
|
47
|
+
resolution: job.resolution,
|
|
48
|
+
audio: false,
|
|
49
|
+
watermark: true
|
|
50
|
+
}
|
|
51
|
+
})).output?.task_id;
|
|
52
|
+
if (typeof id !== "string" || !/^[\w-]{1,128}$/.test(id)) throw new Error("Bailian did not return a valid task ID");
|
|
53
|
+
return id;
|
|
54
|
+
}
|
|
55
|
+
async function queryWanVideo(key, id) {
|
|
56
|
+
return (await requestWan(`/api/v1/tasks/${encodeURIComponent(id)}`, key)).output;
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { queryWanVideo, resolveWanKey, submitWanVideo };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { createLogger } from "../utils/logger/index.js";
|
|
2
|
+
import { init_logger } from "../utils/logger.js";
|
|
3
|
+
import { deleteVideoArtifact, storeVideoArtifact, videoArtifactExists } from "./artifact.js";
|
|
4
|
+
import { beginVideoSubmission, claimVideoJob, getVideoJob, updateVideoJob } from "./repository.js";
|
|
5
|
+
import { VideoProviderError } from "./provider-types.js";
|
|
6
|
+
import { fetchProviderVideo, getVideoProvider } from "./providers.js";
|
|
7
|
+
//#region src/video-generation/worker.ts
|
|
8
|
+
init_logger();
|
|
9
|
+
const log = createLogger("VideoGeneration");
|
|
10
|
+
const POLL_MS = 15e3;
|
|
11
|
+
const RETRY_MS = 3e4;
|
|
12
|
+
var VideoGenerationWorker = class {
|
|
13
|
+
timer;
|
|
14
|
+
work;
|
|
15
|
+
start() {
|
|
16
|
+
if (this.timer) return;
|
|
17
|
+
this.timer = setInterval(() => this.tick(), 1e3);
|
|
18
|
+
this.timer.unref();
|
|
19
|
+
this.tick();
|
|
20
|
+
}
|
|
21
|
+
async stop() {
|
|
22
|
+
clearInterval(this.timer);
|
|
23
|
+
this.timer = void 0;
|
|
24
|
+
await this.work;
|
|
25
|
+
}
|
|
26
|
+
tick() {
|
|
27
|
+
if (this.work) return;
|
|
28
|
+
this.work = this.runNext().catch((err) => log.error({ err }, "Video worker iteration failed")).finally(() => {
|
|
29
|
+
this.work = void 0;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
async runNext() {
|
|
33
|
+
const claimed = claimVideoJob();
|
|
34
|
+
if (!claimed) return;
|
|
35
|
+
const { row, token } = claimed;
|
|
36
|
+
const id = row.id;
|
|
37
|
+
const provider = getVideoProvider(row.model_ref);
|
|
38
|
+
if (row.state === "saving" && await videoArtifactExists(id)) {
|
|
39
|
+
updateVideoJob(id, token, "completed");
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (Date.now() - row.created_at >= provider.taskTtlMs) {
|
|
43
|
+
updateVideoJob(id, token, "failed", { error: `The ${provider.name} task or download expired.` });
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const key = await provider.resolveKey().catch(() => void 0);
|
|
47
|
+
if (!key) {
|
|
48
|
+
updateVideoJob(id, token, row.state, {
|
|
49
|
+
delayMs: RETRY_MS,
|
|
50
|
+
error: `Configure a ${provider.name} API key to resume.`
|
|
51
|
+
});
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
if (row.state === "queued") {
|
|
55
|
+
if (!beginVideoSubmission(id, token)) return;
|
|
56
|
+
try {
|
|
57
|
+
updateVideoJob(id, token, "submitted", {
|
|
58
|
+
providerTaskId: await provider.submit(key, row),
|
|
59
|
+
delayMs: POLL_MS
|
|
60
|
+
});
|
|
61
|
+
} catch (error) {
|
|
62
|
+
if (error instanceof VideoProviderError && error.rejected) updateVideoJob(id, token, "failed", { error: error.message });
|
|
63
|
+
else updateVideoJob(id, token, "submission_unknown", { error: `${provider.name} may have accepted the request. Check its console before generating again.` });
|
|
64
|
+
}
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
let saving = row.state === "saving";
|
|
68
|
+
try {
|
|
69
|
+
const result = await provider.query(key, row.provider_task_id);
|
|
70
|
+
switch (result.state) {
|
|
71
|
+
case "submitted":
|
|
72
|
+
case "running":
|
|
73
|
+
updateVideoJob(id, token, result.state, { delayMs: POLL_MS });
|
|
74
|
+
return;
|
|
75
|
+
case "completed":
|
|
76
|
+
if (result.expiresAt && result.expiresAt <= Date.now()) {
|
|
77
|
+
updateVideoJob(id, token, "failed", { error: `The ${provider.name} download link expired.` });
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (!updateVideoJob(id, token, "saving", { keepLease: true })) return;
|
|
81
|
+
saving = true;
|
|
82
|
+
await storeVideoArtifact(id, await fetchProviderVideo(provider, result.url));
|
|
83
|
+
if (!updateVideoJob(id, token, "completed") && !getVideoJob(row.conversation_id, id)) await deleteVideoArtifact(id);
|
|
84
|
+
return;
|
|
85
|
+
case "failed":
|
|
86
|
+
updateVideoJob(id, token, "failed", { error: result.reason });
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
} catch {
|
|
90
|
+
updateVideoJob(id, token, saving ? "saving" : row.state, {
|
|
91
|
+
delayMs: RETRY_MS,
|
|
92
|
+
error: saving ? "Video download failed. Retrying." : `${provider.name} status check failed. Retrying.`
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
//#endregion
|
|
98
|
+
export { VideoGenerationWorker };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xopcai/xopc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.466",
|
|
4
4
|
"description": "An open-source AI assistant for work and everyday life. Remembers context and helps you get things done. Local-first, on a computer you choose.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/src/index.js",
|