@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
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { chunkText } from "../../../src/markdown/chunk.js";
|
|
2
|
+
import { defineChannelPluginEntry } from "../../../src/extensions/sdk/channel-entry.js";
|
|
3
|
+
import { fetchJson, record, string } from "../../../src/channels/enterprise/socket.js";
|
|
4
|
+
import { createEnterpriseChannel } from "../../../src/channels/enterprise/plugin.js";
|
|
5
|
+
import { runDiscordGateway, snowflake } from "./gateway.js";
|
|
6
|
+
import { createHash } from "node:crypto";
|
|
7
|
+
import { setTimeout } from "node:timers/promises";
|
|
8
|
+
//#region extensions/discord/src/index.ts
|
|
9
|
+
const api = "https://discord.com/api/v10";
|
|
10
|
+
async function verifyBot(credentials, signal) {
|
|
11
|
+
const user = record(await fetchJson(`${api}/users/@me`, {
|
|
12
|
+
headers: { authorization: `Bot ${credentials.id}` },
|
|
13
|
+
signal
|
|
14
|
+
}));
|
|
15
|
+
const id = string(user.id);
|
|
16
|
+
if (user.bot !== true || !snowflake.test(id) || credentials.identity && credentials.identity.split(":")[0] !== id) throw new Error("Discord did not confirm the configured bot identity");
|
|
17
|
+
return id;
|
|
18
|
+
}
|
|
19
|
+
async function verifySetup(credentials) {
|
|
20
|
+
const [botId, application] = await Promise.all([verifyBot(credentials), fetchJson(`${api}/applications/@me`, { headers: { authorization: `Bot ${credentials.id}` } })]);
|
|
21
|
+
const applicationId = string(record(application).id);
|
|
22
|
+
if (!snowflake.test(applicationId)) throw new Error("Discord did not confirm the bot application");
|
|
23
|
+
return `${botId}:${applicationId}`;
|
|
24
|
+
}
|
|
25
|
+
const setupLink = (locale, identity) => {
|
|
26
|
+
const zh = locale?.toLowerCase().startsWith("zh");
|
|
27
|
+
const applicationId = identity?.split(":")[1];
|
|
28
|
+
if (applicationId && snowflake.test(applicationId)) {
|
|
29
|
+
const url = new URL("https://discord.com/oauth2/authorize");
|
|
30
|
+
url.search = new URLSearchParams({
|
|
31
|
+
client_id: applicationId,
|
|
32
|
+
scope: "bot",
|
|
33
|
+
permissions: String(1n << 10n | 1n << 11n | 1n << 16n | 1n << 38n)
|
|
34
|
+
}).toString();
|
|
35
|
+
return {
|
|
36
|
+
url: url.href,
|
|
37
|
+
label: zh ? "邀请机器人加入服务器" : "Invite bot to a server",
|
|
38
|
+
message: zh ? "Bot Token 已验证并保存。私聊机器人即可配对。" : "Bot Token verified and saved. Send the bot a DM to pair."
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
url: "https://discord.com/developers/applications",
|
|
43
|
+
label: zh ? "打开 Discord 开发者后台" : "Open Discord Developer Portal",
|
|
44
|
+
message: zh ? "创建应用后,在 Bot 页面获取 Bot Token。" : "Create an application and copy its token from the Bot page."
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
function parseMessage(message, botId) {
|
|
48
|
+
const author = record(message.author);
|
|
49
|
+
const senderId = string(author.id);
|
|
50
|
+
const messageId = string(message.id);
|
|
51
|
+
const channelId = string(message.channel_id);
|
|
52
|
+
const guild = string(message.guild_id);
|
|
53
|
+
if (author.bot === true || author.system === true || message.webhook_id || senderId === botId || ![
|
|
54
|
+
senderId,
|
|
55
|
+
messageId,
|
|
56
|
+
channelId
|
|
57
|
+
].every((id) => snowflake.test(id)) || message.type !== 0 && message.type !== 19) return;
|
|
58
|
+
if (guild && (!snowflake.test(guild) || !Array.isArray(message.mentions) || !message.mentions.some((mention) => record(mention).id === botId))) return;
|
|
59
|
+
const text = string(message.content).replaceAll(`<@${botId}>`, "").replaceAll(`<@!${botId}>`, "").trim();
|
|
60
|
+
if (!text) return;
|
|
61
|
+
return {
|
|
62
|
+
senderId,
|
|
63
|
+
messageId,
|
|
64
|
+
text,
|
|
65
|
+
replyId: messageId,
|
|
66
|
+
...guild ? { groupId: channelId } : { directChatId: channelId }
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
function discordTransport(credentials, receive) {
|
|
70
|
+
const headers = {
|
|
71
|
+
authorization: `Bot ${credentials.id}`,
|
|
72
|
+
"content-type": "application/json"
|
|
73
|
+
};
|
|
74
|
+
let signal;
|
|
75
|
+
let botCheck;
|
|
76
|
+
function ensureBot(signal) {
|
|
77
|
+
botCheck ??= verifyBot(credentials, signal).catch((error) => {
|
|
78
|
+
botCheck = void 0;
|
|
79
|
+
throw error;
|
|
80
|
+
});
|
|
81
|
+
return botCheck;
|
|
82
|
+
}
|
|
83
|
+
async function sendChunk(target, body) {
|
|
84
|
+
const post = () => fetch(`${api}/channels/${target}/messages`, {
|
|
85
|
+
method: "POST",
|
|
86
|
+
headers,
|
|
87
|
+
body: JSON.stringify(body),
|
|
88
|
+
redirect: "error",
|
|
89
|
+
signal: signal ? AbortSignal.any([signal, AbortSignal.timeout(1e4)]) : AbortSignal.timeout(1e4)
|
|
90
|
+
});
|
|
91
|
+
let response = await post();
|
|
92
|
+
if (response.status === 429) {
|
|
93
|
+
const retryAfter = Number(response.headers.get("retry-after"));
|
|
94
|
+
await response.body?.cancel();
|
|
95
|
+
if (retryAfter > 0 && retryAfter <= 10) {
|
|
96
|
+
await setTimeout(retryAfter * 1e3, void 0, { signal });
|
|
97
|
+
response = await post();
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (!response.ok) {
|
|
101
|
+
await response.body?.cancel();
|
|
102
|
+
throw new Error(`Discord message delivery failed (${response.status})`);
|
|
103
|
+
}
|
|
104
|
+
const id = string(record(await response.json()).id);
|
|
105
|
+
if (!snowflake.test(id)) throw new Error("Discord did not confirm message delivery");
|
|
106
|
+
return id;
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
async send(target, _group, text, replyId) {
|
|
110
|
+
if (!snowflake.test(target) || replyId && !snowflake.test(replyId)) throw new Error("Invalid Discord message target");
|
|
111
|
+
const chunks = chunkText(text, 1900);
|
|
112
|
+
if (!chunks.length) throw new Error("Discord message is empty");
|
|
113
|
+
await ensureBot(signal);
|
|
114
|
+
let sent = "";
|
|
115
|
+
for (const [index, content] of chunks.entries()) {
|
|
116
|
+
const nonce = replyId ? createHash("sha256").update(JSON.stringify([
|
|
117
|
+
target,
|
|
118
|
+
replyId,
|
|
119
|
+
index,
|
|
120
|
+
content
|
|
121
|
+
])).digest("hex").slice(0, 24) : void 0;
|
|
122
|
+
sent = await sendChunk(target, {
|
|
123
|
+
content,
|
|
124
|
+
allowed_mentions: {
|
|
125
|
+
parse: [],
|
|
126
|
+
replied_user: false
|
|
127
|
+
},
|
|
128
|
+
...replyId && index === 0 ? { message_reference: {
|
|
129
|
+
message_id: replyId,
|
|
130
|
+
fail_if_not_exists: false
|
|
131
|
+
} } : {},
|
|
132
|
+
...nonce ? {
|
|
133
|
+
nonce,
|
|
134
|
+
enforce_nonce: true
|
|
135
|
+
} : {}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return sent;
|
|
139
|
+
},
|
|
140
|
+
run(abort, online, onFailure) {
|
|
141
|
+
signal = abort;
|
|
142
|
+
return runDiscordGateway({
|
|
143
|
+
token: credentials.id,
|
|
144
|
+
signal: abort,
|
|
145
|
+
online,
|
|
146
|
+
onFailure,
|
|
147
|
+
async authenticate(currentSignal) {
|
|
148
|
+
const [botId, endpoint] = await Promise.all([ensureBot(currentSignal), fetchJson(`${api}/gateway/bot`, {
|
|
149
|
+
headers,
|
|
150
|
+
signal: currentSignal
|
|
151
|
+
})]);
|
|
152
|
+
return {
|
|
153
|
+
botId,
|
|
154
|
+
gateway: record(endpoint).url
|
|
155
|
+
};
|
|
156
|
+
},
|
|
157
|
+
async receive(raw, botId) {
|
|
158
|
+
const message = parseMessage(raw, botId);
|
|
159
|
+
if (message) await receive(message);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
const discordPlugin = createEnterpriseChannel({
|
|
166
|
+
id: "discord",
|
|
167
|
+
label: "Discord",
|
|
168
|
+
order: 70,
|
|
169
|
+
credentialFields: ["botToken"],
|
|
170
|
+
credentialLabels: ["Bot Token"],
|
|
171
|
+
credentialIdIsSecret: true,
|
|
172
|
+
threads: true,
|
|
173
|
+
sendWhileDisconnected: true,
|
|
174
|
+
setupLink,
|
|
175
|
+
verify: verifySetup,
|
|
176
|
+
transport: discordTransport
|
|
177
|
+
});
|
|
178
|
+
var src_default = defineChannelPluginEntry({
|
|
179
|
+
id: "discord",
|
|
180
|
+
name: "Discord",
|
|
181
|
+
plugin: discordPlugin
|
|
182
|
+
});
|
|
183
|
+
//#endregion
|
|
184
|
+
export { src_default as default, discordPlugin };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "discord",
|
|
3
|
+
"name": "Discord",
|
|
4
|
+
"description": "Discord bot messaging over Gateway",
|
|
5
|
+
"version": "0.1.0",
|
|
6
|
+
"kind": "channel",
|
|
7
|
+
"main": "src/index.js",
|
|
8
|
+
"channels": [
|
|
9
|
+
"discord"
|
|
10
|
+
],
|
|
11
|
+
"engines": {
|
|
12
|
+
"xopc": ">=0.0.465"
|
|
13
|
+
},
|
|
14
|
+
"contracts": {
|
|
15
|
+
"channels": [
|
|
16
|
+
"discord"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"channelContributions": {
|
|
20
|
+
"discord": {
|
|
21
|
+
"label": "Discord",
|
|
22
|
+
"description": "Discord bot messaging over Gateway",
|
|
23
|
+
"order": 70,
|
|
24
|
+
"configPath": "channels.discord",
|
|
25
|
+
"docsPath": "/channels/discord",
|
|
26
|
+
"capabilities": {
|
|
27
|
+
"login": true,
|
|
28
|
+
"pairing": true,
|
|
29
|
+
"threads": true
|
|
30
|
+
},
|
|
31
|
+
"configSchema": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"additionalProperties": false,
|
|
34
|
+
"properties": {
|
|
35
|
+
"enabled": {
|
|
36
|
+
"type": "boolean",
|
|
37
|
+
"default": false
|
|
38
|
+
},
|
|
39
|
+
"dmPolicy": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"enum": [
|
|
42
|
+
"pairing",
|
|
43
|
+
"allowlist",
|
|
44
|
+
"open",
|
|
45
|
+
"disabled"
|
|
46
|
+
],
|
|
47
|
+
"default": "pairing"
|
|
48
|
+
},
|
|
49
|
+
"allowFrom": {
|
|
50
|
+
"type": "array",
|
|
51
|
+
"items": {
|
|
52
|
+
"type": "string"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"groupPolicy": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"enum": [
|
|
58
|
+
"allowlist",
|
|
59
|
+
"open",
|
|
60
|
+
"disabled"
|
|
61
|
+
],
|
|
62
|
+
"default": "allowlist"
|
|
63
|
+
},
|
|
64
|
+
"groupAllowFrom": {
|
|
65
|
+
"type": "array",
|
|
66
|
+
"items": {
|
|
67
|
+
"type": "string"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"botToken": {
|
|
71
|
+
"type": "string",
|
|
72
|
+
"title": "Bot Token",
|
|
73
|
+
"format": "password",
|
|
74
|
+
"pattern": "^\\S+$",
|
|
75
|
+
"x-hidden": true
|
|
76
|
+
},
|
|
77
|
+
"credentialIdentity": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"pattern": "^\\d{17,20}:\\d{17,20}$",
|
|
80
|
+
"x-hidden": true
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"required": [
|
|
84
|
+
"botToken"
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
"uiHints": {
|
|
88
|
+
"botToken": {
|
|
89
|
+
"sensitive": true
|
|
90
|
+
},
|
|
91
|
+
"groupAllowFrom": {
|
|
92
|
+
"label": "Allowed channel senders"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"actions": {
|
|
96
|
+
"setup.manual": {
|
|
97
|
+
"label": "Configure Discord",
|
|
98
|
+
"result": "form"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"i18n": {
|
|
102
|
+
"zh": {
|
|
103
|
+
"description": "通过 Gateway 连接 Discord 机器人",
|
|
104
|
+
"actions": {
|
|
105
|
+
"setup.manual": {
|
|
106
|
+
"label": "配置 Discord"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -76,6 +76,34 @@ function setupVerification(result, accountId, zh, info) {
|
|
|
76
76
|
...!info.ok ? { setupHint: zh ? "若找不到机器人,请在开放平台检查机器人能力、长连接事件订阅、发布和管理员审批。" : "If the bot is unavailable, check bot access, long-connection subscriptions, publication and administrator approval." } : {}
|
|
77
77
|
};
|
|
78
78
|
}
|
|
79
|
+
function manualSetupForm(domain, message) {
|
|
80
|
+
return {
|
|
81
|
+
type: "form",
|
|
82
|
+
submitAction: "setup.manual",
|
|
83
|
+
message,
|
|
84
|
+
schema: {
|
|
85
|
+
type: "object",
|
|
86
|
+
properties: {
|
|
87
|
+
appId: {
|
|
88
|
+
type: "string",
|
|
89
|
+
title: "App ID"
|
|
90
|
+
},
|
|
91
|
+
appSecret: {
|
|
92
|
+
type: "string",
|
|
93
|
+
title: "App Secret",
|
|
94
|
+
format: "password"
|
|
95
|
+
},
|
|
96
|
+
domain: {
|
|
97
|
+
type: "string",
|
|
98
|
+
enum: ["feishu", "lark"],
|
|
99
|
+
default: domain
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
required: ["appId", "appSecret"]
|
|
103
|
+
},
|
|
104
|
+
values: { domain }
|
|
105
|
+
};
|
|
106
|
+
}
|
|
79
107
|
const feishuGatewaySetupActions = { async runAction({ cfg, actionId, input, locale, accountId: requestedAccountId }) {
|
|
80
108
|
const zh = isZh(locale);
|
|
81
109
|
const raw = readInput(input);
|
|
@@ -100,6 +128,10 @@ const feishuGatewaySetupActions = { async runAction({ cfg, actionId, input, loca
|
|
|
100
128
|
payload: { type: "ok" }
|
|
101
129
|
};
|
|
102
130
|
}
|
|
131
|
+
if (actionId === "setup.manual" && raw.appId === void 0 && raw.appSecret === void 0) return {
|
|
132
|
+
ok: true,
|
|
133
|
+
payload: manualSetupForm(domain)
|
|
134
|
+
};
|
|
103
135
|
if (actionId === "setup.start" || actionId === "setup.manual") try {
|
|
104
136
|
await ensureFeishuLarkSdk();
|
|
105
137
|
} catch {
|
|
@@ -111,32 +143,7 @@ const feishuGatewaySetupActions = { async runAction({ cfg, actionId, input, loca
|
|
|
111
143
|
if (actionId === "setup.start") {
|
|
112
144
|
if (!await initAppRegistration(domain)) return {
|
|
113
145
|
ok: true,
|
|
114
|
-
payload:
|
|
115
|
-
type: "form",
|
|
116
|
-
submitAction: "setup.manual",
|
|
117
|
-
message: zh ? "扫码创建暂不可用,请填写应用凭据。" : "Scan-to-create is unavailable. Enter app credentials.",
|
|
118
|
-
schema: {
|
|
119
|
-
type: "object",
|
|
120
|
-
properties: {
|
|
121
|
-
appId: {
|
|
122
|
-
type: "string",
|
|
123
|
-
title: "App ID"
|
|
124
|
-
},
|
|
125
|
-
appSecret: {
|
|
126
|
-
type: "string",
|
|
127
|
-
title: "App Secret",
|
|
128
|
-
format: "password"
|
|
129
|
-
},
|
|
130
|
-
domain: {
|
|
131
|
-
type: "string",
|
|
132
|
-
enum: ["feishu", "lark"],
|
|
133
|
-
default: domain
|
|
134
|
-
}
|
|
135
|
-
},
|
|
136
|
-
required: ["appId", "appSecret"]
|
|
137
|
-
},
|
|
138
|
-
values: { domain }
|
|
139
|
-
}
|
|
146
|
+
payload: manualSetupForm(domain, zh ? "扫码创建暂不可用,请填写应用凭据。" : "Scan-to-create is unavailable. Enter app credentials.")
|
|
140
147
|
};
|
|
141
148
|
const begin = await beginAppRegistration(domain);
|
|
142
149
|
const conversationId = randomUUID();
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const slackPlugin: import("../../../src/channels/plugin-types.js").ChannelPlugin<any>;
|
|
2
|
+
declare const _default: {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
register(api: import("../../../src/extensions/index.js").ExtensionApi): void;
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { defineChannelPluginEntry } from "../../../src/extensions/sdk/channel-entry.js";
|
|
2
|
+
import { postJson, record, runChannelSocket, string } from "../../../src/channels/enterprise/socket.js";
|
|
3
|
+
import { createEnterpriseChannel } from "../../../src/channels/enterprise/plugin.js";
|
|
4
|
+
import { slackAppManifest } from "./manifest.js";
|
|
5
|
+
//#region extensions/slack/src/index.ts
|
|
6
|
+
const slackId = /^[A-Z][A-Z0-9]+$/;
|
|
7
|
+
const timestamp = /^\d+\.\d+$/;
|
|
8
|
+
async function slackCall(method, token, body, signal) {
|
|
9
|
+
const result = record(await postJson(`https://slack.com/api/${method}`, body, signal, { authorization: `Bearer ${token}` }));
|
|
10
|
+
if (result.ok !== true) {
|
|
11
|
+
const code = string(result.error);
|
|
12
|
+
throw new Error(`Slack ${method} failed (${/^[a-z_]+$/.test(code) ? code : "invalid_response"})`);
|
|
13
|
+
}
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
async function authenticateBot(token, signal) {
|
|
17
|
+
if (!/^(?:xoxe\.)?xoxb-\S+$/.test(token)) throw new Error("A Slack Bot Token is required");
|
|
18
|
+
const response = await slackCall("auth.test", token, {}, signal);
|
|
19
|
+
const teamId = string(response.team_id);
|
|
20
|
+
const userId = string(response.user_id);
|
|
21
|
+
const botId = string(response.bot_id);
|
|
22
|
+
if (![
|
|
23
|
+
teamId,
|
|
24
|
+
userId,
|
|
25
|
+
botId
|
|
26
|
+
].every((id) => slackId.test(id))) throw new Error("Slack did not identify a workspace bot");
|
|
27
|
+
return {
|
|
28
|
+
teamId,
|
|
29
|
+
userId,
|
|
30
|
+
botId
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
async function openSocket(token, signal) {
|
|
34
|
+
if (!/^(?:xoxe\.)?xapp-\S+$/.test(token)) throw new Error("A Slack App Token is required");
|
|
35
|
+
const result = await slackCall("apps.connections.open", token, {}, signal);
|
|
36
|
+
const url = new URL(string(result.url));
|
|
37
|
+
if (url.protocol !== "wss:" || !url.hostname.endsWith(".slack.com") || url.username || url.password) throw new Error("Slack returned an invalid Socket Mode URL");
|
|
38
|
+
return url.href;
|
|
39
|
+
}
|
|
40
|
+
const identityKey = ({ teamId, userId }) => `${teamId}:${userId}`;
|
|
41
|
+
async function verify(credentials) {
|
|
42
|
+
const [bot] = await Promise.all([authenticateBot(credentials.id), openSocket(credentials.secret)]);
|
|
43
|
+
return identityKey(bot);
|
|
44
|
+
}
|
|
45
|
+
function readEvent(payload, bot, appId) {
|
|
46
|
+
if (!appId || payload.type !== "event_callback" || payload.api_app_id !== appId || payload.team_id !== bot.teamId || !Array.isArray(payload.authorizations) || !payload.authorizations.some((entry) => {
|
|
47
|
+
const auth = record(entry);
|
|
48
|
+
return auth.is_bot === true && auth.team_id === bot.teamId && auth.user_id === bot.userId;
|
|
49
|
+
})) return;
|
|
50
|
+
const event = record(payload.event);
|
|
51
|
+
const senderId = string(event.user);
|
|
52
|
+
const channelId = string(event.channel);
|
|
53
|
+
const ts = string(event.ts);
|
|
54
|
+
const thread = string(event.thread_ts);
|
|
55
|
+
if (event.bot_id || event.subtype || senderId === bot.userId || !slackId.test(senderId) || !slackId.test(channelId) || !timestamp.test(ts) || thread && !timestamp.test(thread)) return;
|
|
56
|
+
const direct = event.type === "message" && event.channel_type === "im";
|
|
57
|
+
const mention = `<@${bot.userId}>`;
|
|
58
|
+
const text = string(event.text);
|
|
59
|
+
if (!direct && (event.type !== "app_mention" || !text.includes(mention))) return;
|
|
60
|
+
const content = text.replaceAll(mention, "").trim();
|
|
61
|
+
if (!content) return;
|
|
62
|
+
return {
|
|
63
|
+
senderId,
|
|
64
|
+
channelId,
|
|
65
|
+
text: content,
|
|
66
|
+
messageId: `${channelId}:${ts}`,
|
|
67
|
+
groupId: direct ? void 0 : channelId,
|
|
68
|
+
directChatId: direct ? channelId : void 0,
|
|
69
|
+
threadId: thread || (direct ? void 0 : ts)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function slackTransport(credentials, receive) {
|
|
73
|
+
let bot;
|
|
74
|
+
const send = async (target, _group, text, threadId) => {
|
|
75
|
+
if (!slackId.test(target) || threadId && !timestamp.test(threadId)) throw new Error("Invalid Slack message target");
|
|
76
|
+
const ts = string((await slackCall("chat.postMessage", credentials.id, {
|
|
77
|
+
channel: target,
|
|
78
|
+
text,
|
|
79
|
+
mrkdwn: false,
|
|
80
|
+
unfurl_links: false,
|
|
81
|
+
unfurl_media: false,
|
|
82
|
+
...threadId ? { thread_ts: threadId } : {}
|
|
83
|
+
})).ts);
|
|
84
|
+
if (!timestamp.test(ts)) throw new Error("Slack did not confirm message delivery");
|
|
85
|
+
return ts;
|
|
86
|
+
};
|
|
87
|
+
return {
|
|
88
|
+
send,
|
|
89
|
+
run(signal, online, onFailure) {
|
|
90
|
+
return runChannelSocket(signal, async () => {
|
|
91
|
+
const identity = bot ??= await authenticateBot(credentials.id, signal);
|
|
92
|
+
if (credentials.identity && credentials.identity !== identityKey(identity)) throw new Error("Slack workspace or bot changed; reconfigure the channel");
|
|
93
|
+
const endpoint = await openSocket(credentials.secret, signal);
|
|
94
|
+
let appId = "";
|
|
95
|
+
let onHello;
|
|
96
|
+
return {
|
|
97
|
+
endpoint,
|
|
98
|
+
async authenticate(socket) {
|
|
99
|
+
if (appId) return;
|
|
100
|
+
await new Promise((resolve, reject) => {
|
|
101
|
+
const timeout = setTimeout(() => finish(/* @__PURE__ */ new Error("Slack did not send a Socket Mode hello")), 5e3);
|
|
102
|
+
const closed = () => finish(/* @__PURE__ */ new Error("Slack closed before Socket Mode hello"));
|
|
103
|
+
function finish(error) {
|
|
104
|
+
clearTimeout(timeout);
|
|
105
|
+
socket.off("close", closed);
|
|
106
|
+
onHello = void 0;
|
|
107
|
+
if (error) reject(error);
|
|
108
|
+
else resolve();
|
|
109
|
+
}
|
|
110
|
+
onHello = () => finish();
|
|
111
|
+
socket.once("close", closed);
|
|
112
|
+
if (socket.readyState !== socket.OPEN) closed();
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
async receive(value, socket) {
|
|
116
|
+
const frame = record(value);
|
|
117
|
+
if (frame.type === "hello") {
|
|
118
|
+
const id = string(record(frame.connection_info).app_id);
|
|
119
|
+
if (!slackId.test(id) || appId && appId !== id) throw new Error("Invalid Slack Socket Mode hello");
|
|
120
|
+
appId = id;
|
|
121
|
+
onHello?.();
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (frame.type === "disconnect") {
|
|
125
|
+
socket.terminate();
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
const envelopeId = string(frame.envelope_id);
|
|
129
|
+
if (!envelopeId) return;
|
|
130
|
+
const event = frame.type === "events_api" ? readEvent(record(frame.payload), identity, appId) : void 0;
|
|
131
|
+
if (event) await receive({
|
|
132
|
+
...event,
|
|
133
|
+
reply: async (text) => {
|
|
134
|
+
send(event.channelId, false, text, event.threadId).catch(() => onFailure("Slack pairing prompt could not be delivered"));
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
if (socket.readyState === socket.OPEN) socket.send(JSON.stringify({ envelope_id: envelopeId }));
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
}, online, onFailure);
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
const slackPlugin = createEnterpriseChannel({
|
|
145
|
+
id: "slack",
|
|
146
|
+
label: "Slack",
|
|
147
|
+
order: 60,
|
|
148
|
+
credentialFields: ["botToken", "appToken"],
|
|
149
|
+
credentialLabels: ["Bot Token (xoxb-)", "App Token (xapp-)"],
|
|
150
|
+
credentialIdIsSecret: true,
|
|
151
|
+
threads: true,
|
|
152
|
+
setupTemplate: {
|
|
153
|
+
content: JSON.stringify(slackAppManifest, null, 2),
|
|
154
|
+
url: "https://api.slack.com/apps",
|
|
155
|
+
instructions: {
|
|
156
|
+
zh: "在 Slack 中使用 App Manifest 创建应用并安装到工作区,再填写 Bot Token 和具有 connections:write 权限的 App Token。",
|
|
157
|
+
en: "Create a Slack app from the App Manifest and install it to your workspace. Enter the Bot Token and an App Token with connections:write."
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
verify,
|
|
161
|
+
transport: slackTransport
|
|
162
|
+
});
|
|
163
|
+
var src_default = defineChannelPluginEntry({
|
|
164
|
+
id: "slack",
|
|
165
|
+
name: "Slack",
|
|
166
|
+
plugin: slackPlugin
|
|
167
|
+
});
|
|
168
|
+
//#endregion
|
|
169
|
+
export { src_default as default, slackPlugin };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** Minimum permissions for direct messages and explicit channel mentions. */
|
|
2
|
+
export declare const slackAppManifest: {
|
|
3
|
+
_metadata: {
|
|
4
|
+
major_version: number;
|
|
5
|
+
};
|
|
6
|
+
display_information: {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
};
|
|
10
|
+
features: {
|
|
11
|
+
bot_user: {
|
|
12
|
+
display_name: string;
|
|
13
|
+
always_online: boolean;
|
|
14
|
+
};
|
|
15
|
+
app_home: {
|
|
16
|
+
messages_tab_enabled: boolean;
|
|
17
|
+
messages_tab_read_only_enabled: boolean;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
oauth_config: {
|
|
21
|
+
scopes: {
|
|
22
|
+
bot: string[];
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
settings: {
|
|
26
|
+
event_subscriptions: {
|
|
27
|
+
bot_events: string[];
|
|
28
|
+
};
|
|
29
|
+
org_deploy_enabled: boolean;
|
|
30
|
+
socket_mode_enabled: boolean;
|
|
31
|
+
token_rotation_enabled: boolean;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region extensions/slack/src/manifest.ts
|
|
2
|
+
/** Minimum permissions for direct messages and explicit channel mentions. */
|
|
3
|
+
const slackAppManifest = {
|
|
4
|
+
_metadata: { major_version: 1 },
|
|
5
|
+
display_information: {
|
|
6
|
+
name: "xopc",
|
|
7
|
+
description: "Chat with your xopc Agent in Slack"
|
|
8
|
+
},
|
|
9
|
+
features: {
|
|
10
|
+
bot_user: {
|
|
11
|
+
display_name: "xopc",
|
|
12
|
+
always_online: false
|
|
13
|
+
},
|
|
14
|
+
app_home: {
|
|
15
|
+
messages_tab_enabled: true,
|
|
16
|
+
messages_tab_read_only_enabled: false
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
oauth_config: { scopes: { bot: [
|
|
20
|
+
"app_mentions:read",
|
|
21
|
+
"chat:write",
|
|
22
|
+
"im:history"
|
|
23
|
+
] } },
|
|
24
|
+
settings: {
|
|
25
|
+
event_subscriptions: { bot_events: ["app_mention", "message.im"] },
|
|
26
|
+
org_deploy_enabled: false,
|
|
27
|
+
socket_mode_enabled: true,
|
|
28
|
+
token_rotation_enabled: false
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { slackAppManifest };
|