@xopcai/xopc 0.0.463 → 0.0.465
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/dist/sidepanel.js +5 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/src/adapters/cli-login.js +23 -49
- package/dist/extensions/feishu/src/adapters/gateway-setup.d.ts +3 -0
- package/dist/extensions/feishu/src/adapters/gateway-setup.js +180 -128
- package/dist/extensions/feishu/src/adapters/onboard-cli.d.ts +1 -1
- package/dist/extensions/feishu/src/adapters/onboard-cli.js +27 -15
- package/dist/extensions/feishu/src/auth/app-registration.d.ts +1 -0
- package/dist/extensions/feishu/src/auth/app-registration.js +12 -9
- package/dist/extensions/feishu/src/outbound/outbound-adapter.js +40 -16
- package/dist/extensions/feishu/src/plugin.d.ts +2 -0
- package/dist/extensions/feishu/src/plugin.js +37 -23
- package/dist/extensions/feishu/src/status/status-adapter.d.ts +1 -1
- package/dist/extensions/feishu/src/status/status-adapter.js +8 -5
- package/dist/extensions/feishu/src/streaming/streaming-adapter.js +97 -69
- package/dist/extensions/feishu/src/transport/client/bot-info.d.ts +10 -0
- package/dist/extensions/feishu/src/transport/client/bot-info.js +34 -0
- package/dist/extensions/feishu/src/transport/client/client.d.ts +7 -1
- package/dist/extensions/feishu/src/transport/client/client.js +6 -5
- package/dist/extensions/feishu/src/transport/client/install-sdk.d.ts +2 -0
- package/dist/extensions/feishu/src/transport/client/install-sdk.js +77 -0
- package/dist/extensions/feishu/src/transport/client/lark-sdk.d.ts +2 -0
- package/dist/extensions/feishu/src/transport/client/lark-sdk.js +27 -3
- package/dist/extensions/feishu/src/transport/client/sdk-catalog.d.ts +1 -0
- package/dist/extensions/feishu/src/transport/client/sdk-catalog.js +317 -0
- package/dist/extensions/feishu/src/transport/reliability/inbound-pipeline.d.ts +1 -1
- package/dist/extensions/feishu/src/transport/reliability/inbound-pipeline.js +13 -5
- package/dist/extensions/feishu/src/transport/reliability/message-ingress.d.ts +21 -0
- package/dist/extensions/feishu/src/transport/reliability/message-ingress.js +313 -0
- package/dist/extensions/feishu/src/transport/socket-mode/monitor.d.ts +1 -0
- package/dist/extensions/feishu/src/transport/socket-mode/monitor.js +56 -171
- package/dist/extensions/feishu/src/transport/webhook/monitor.d.ts +1 -0
- package/dist/extensions/feishu/src/transport/webhook/monitor.js +10 -102
- package/dist/extensions/telegram/src/account-manager.d.ts +1 -0
- package/dist/extensions/telegram/src/account-manager.js +3 -0
- package/dist/extensions/telegram/src/adapters/debounce-keys.js +7 -2
- package/dist/extensions/telegram/src/adapters/gateway-setup.js +113 -63
- package/dist/extensions/telegram/src/adapters/streaming-adapter.js +8 -4
- package/dist/extensions/telegram/src/doctor.js +1 -1
- package/dist/extensions/telegram/src/inbound-coalescer.d.ts +8 -6
- package/dist/extensions/telegram/src/inbound-coalescer.js +47 -88
- package/dist/extensions/telegram/src/inbound-processor.js +5 -1
- package/dist/extensions/telegram/src/outbound-sender.js +16 -23
- package/dist/extensions/telegram/src/plugin.js +80 -57
- package/dist/extensions/telegram/src/polling-session.d.ts +3 -6
- package/dist/extensions/telegram/src/polling-session.js +107 -94
- package/dist/extensions/telegram/src/rich-message.d.ts +4 -0
- package/dist/extensions/telegram/src/rich-message.js +23 -0
- package/dist/extensions/telegram/src/timeout-abort.d.ts +1 -1
- package/dist/extensions/telegram/src/timeout-abort.js +9 -3
- package/dist/extensions/telegram/src/update-offset-store.d.ts +1 -0
- package/dist/extensions/telegram/src/update-offset-store.js +6 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/api/api.d.ts +1 -0
- package/dist/extensions/weixin/src/api/api.js +12 -6
- package/dist/extensions/weixin/src/api/types.d.ts +5 -2
- package/dist/extensions/weixin/src/auth/login-qr.d.ts +7 -1
- package/dist/extensions/weixin/src/auth/login-qr.js +48 -13
- package/dist/extensions/weixin/src/cdn/pic-decrypt.d.ts +2 -2
- package/dist/extensions/weixin/src/cdn/pic-decrypt.js +37 -25
- package/dist/extensions/weixin/src/cli/gateway-qr-login.d.ts +8 -0
- package/dist/extensions/weixin/src/cli/gateway-qr-login.js +45 -6
- package/dist/extensions/weixin/src/cli/qr-login.d.ts +1 -1
- package/dist/extensions/weixin/src/cli/qr-login.js +9 -3
- package/dist/extensions/weixin/src/media/media-download.d.ts +1 -0
- package/dist/extensions/weixin/src/media/media-download.js +4 -5
- package/dist/extensions/weixin/src/messaging/process-message.d.ts +2 -0
- package/dist/extensions/weixin/src/messaging/process-message.js +90 -65
- package/dist/extensions/weixin/src/messaging/quote-cache.d.ts +10 -0
- package/dist/extensions/weixin/src/messaging/quote-cache.js +46 -0
- package/dist/extensions/weixin/src/monitor/monitor.d.ts +3 -3
- package/dist/extensions/weixin/src/monitor/monitor.js +108 -104
- package/dist/extensions/weixin/src/plugin.d.ts +5 -1
- package/dist/extensions/weixin/src/plugin.js +138 -42
- package/dist/gateway/static/root/assets/{activity-store-CQHh48Zf.js → activity-store-B9heFbtJ.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-CAz-Ke6Q.js → agent-avatar-dicebear-nzhB7Xjk.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-display-loBdGw_i.js → agent-avatar-display-DBzgoHMD.js} +2 -2
- package/dist/gateway/static/root/assets/{agent-defaults-settings-panel-By2Q-6JS.js → agent-defaults-settings-panel-BJrNV93g.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-plugin-dialog-C_rlXuEe.js → agent-plugin-dialog-DLbTHALG.js} +1 -1
- package/dist/gateway/static/root/assets/agents-C2xG8f56.js +77 -0
- package/dist/gateway/static/root/assets/{agents-admin-api-D0N09mqJ.js → agents-admin-api-CqQbYIiY.js} +1 -1
- package/dist/gateway/static/root/assets/{api-B1J5ajiP.js → api-8tNOT72p.js} +1 -1
- package/dist/gateway/static/root/assets/{api-B4FJ51EC.js → api-BGodd--L.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BHlUDZOG.js → app-management-settings-panel-Q7apF7KE.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-Du5JLyV1.js → appearance-settings-ClVZeUmo.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-D1qzENN_.js → apps-page-BsJJwpKj.js} +1 -1
- package/dist/gateway/static/root/assets/{archive-plugin-BAvglLfu.js → archive-plugin-Bl_M0WJp.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-api-DxBmyzp0.js → automation-api-BOnIc_vw.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-result-state-CAsqgMNR.js → automation-result-state-BwDSJs05.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-run-list-BmYeWB_N.js → automation-run-list-CqlIq4BG.js} +1 -1
- package/dist/gateway/static/root/assets/{automation-task-card-CJbIHRxN.js → automation-task-card-D3WXVKRs.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-HYFnPiNG.js → automations-page-Bimqx5Pc.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-2SOvmw-f.js +9 -0
- package/dist/gateway/static/root/assets/{binary-plugins-D2bFqG6K.js → binary-plugins-DDNKe1Io.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DrZyRQQ0.js → block-editor-BQ3amsRP.js} +5 -5
- package/dist/gateway/static/root/assets/{browser-settings-page-CGcgZOWh.js → browser-settings-page-CHf1_RVl.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-hSb-qEgL.js → capabilities-C5oWMC-Z.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-Dr-vvMez.js → capabilities-Cj8vl1ZY.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-U_hQx5ou.js +2 -0
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-B08mjrGB.js → capabilities-settings-panel-k5CcwhXN.js} +1 -1
- package/dist/gateway/static/root/assets/channels-BUzno8Pi.js +1 -0
- package/dist/gateway/static/root/assets/chat-agents-api-C3JChTsh.js +1 -0
- package/dist/gateway/static/root/assets/{chat-chart-block-ClCZyIi0.js → chat-chart-block-DrtmYOIo.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-page-CalELOKj.js → chat-page-qnsMsF_s.js} +29 -29
- package/dist/gateway/static/root/assets/{chat-terminal-dock-eneTvxV3.js → chat-terminal-dock-B0D220I-.js} +1 -1
- package/dist/gateway/static/root/assets/{command-palette-api-CP0F6sIm.js → command-palette-api-CkJ6_Yf3.js} +1 -1
- package/dist/gateway/static/root/assets/composer-handoff-params-GKGdXjMZ.js +1 -0
- package/dist/gateway/static/root/assets/{composer-model-config-control-DAagrRx_.js → composer-model-config-control-DQCOWHzJ.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-notifications-CqV6Xj-H.js → composer-notifications-D__OU_xx.js} +1 -1
- package/dist/gateway/static/root/assets/{composer-payload-handoff-Dc43dgSg.js → composer-payload-handoff-BBTbJ1bO.js} +1 -1
- package/dist/gateway/static/root/assets/{computer-settings-page-f-vcEpeF.js → computer-settings-page-DGRUCkOt.js} +1 -1
- package/dist/gateway/static/root/assets/{connected-providers-grid-CZ-FXxaW.js → connected-providers-grid-BoDipD2g.js} +1 -1
- package/dist/gateway/static/root/assets/{connection-usage-guide-Cibh2lrV.js → connection-usage-guide-B1VUqibv.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-Btz68iy8.js → connector-service-page-bwQ1PekA.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-api-CTuVWwBf.js → connectors-api-BvYGL65q.js} +1 -1
- package/dist/gateway/static/root/assets/{connectors-page-B9mpz_Rt.js → connectors-page-BX6Jt6w5.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-XnE3iFhG.js → date-picker-ClRDaNBJ.js} +1 -1
- package/dist/gateway/static/root/assets/{date-time-picker-VGKm0HVn.js → date-time-picker-CA6H47M6.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CBm3DySQ.js → desktop-pet-Bi8Hgf-x.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-6O77QXGo.js → desktop-pet-settings-CQ6qE8lf.js} +1 -1
- package/dist/gateway/static/root/assets/{dev-view-store-B8fGILny.js → dev-view-store-UCqQeWa2.js} +1 -1
- package/dist/gateway/static/root/assets/{device-pairing-wizard-qtUvtdDT.js → device-pairing-wizard-gC-XZxt2.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-ByDqf5fE.js → directory-picker-path-field-Y8snl5Xl.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-authoritative-grants-BfL8dMBf.js → extension-authoritative-grants-D2abOXTl.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-Bn_5xu_M.js → extension-debug-page-OOlRCInL.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-Vs6USa0c.js → extension-iframe-host-D_WXBf6a.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-marketplace-api-BIzkukYp.js → extension-marketplace-api-Bmtm6-L1.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-message-router-GIekDj_w.js → extension-message-router-xqjjSxcp.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-C_3bIjSB.js → extension-page-bpQnyNz-.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-D-LolObs.js → extension-provider-l7SvHEK1.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BvUtZGLT.js +1 -0
- package/dist/gateway/static/root/assets/{file-preview-surface-i5UOFnQF.js → file-preview-surface-B-r2ZnCV.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-1Rk0LeEM.js → gateway-config-swr-DOwezeL2.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-DIs1pjkQ.js → gateway-realtime-Br7dErHY.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-OaEqjNTb.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-restart-DTmlcJps.js → gateway-restart-B3Xro3qd.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-ClcCloqQ.js → gateway-settings-DCnP-HPj.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-D6WPS0RW.js → gateway-startup-retry-vteSIhYI.js} +1 -1
- package/dist/gateway/static/root/assets/{global-defaults-api-BpDMnJe7.js → global-defaults-api-Bpje9rVk.js} +1 -1
- package/dist/gateway/static/root/assets/grip-horizontal-CqVA8V1e.js +1 -0
- package/dist/gateway/static/root/assets/home-page-CNEgNWEQ.js +8 -0
- package/dist/gateway/static/root/assets/{image-generation-api-sbtx4NiC.js → image-generation-api-BvpAa3Lj.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-CBlaxUhl.js → imports-page-Dx5T5pqw.js} +1 -1
- package/dist/gateway/static/root/assets/index-Cdo4_zon.js +11 -0
- package/dist/gateway/static/root/assets/index-DYTktubl.css +1 -0
- package/dist/gateway/static/root/assets/{install-connector-dialog-DxSv1wS2.js → install-connector-dialog-Cb4ufypG.js} +1 -1
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CnAV96nr.js → keyboard-shortcuts-settings-BEuXrnv0.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-CfnixDO3.js → local-app-workbench-page-CPFIbEbv.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BI3Be5qo.js → local-apps-page-DxHcRSxc.js} +1 -1
- package/dist/gateway/static/root/assets/local-session-drafts-Cmc-GCVa.js +4 -0
- package/dist/gateway/static/root/assets/{locale-store-Dy1EByeG.js → locale-store-tI9VX7dp.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CMW34T31.js → logs-page-BcibwftP.js} +1 -1
- package/dist/gateway/static/root/assets/{management-api-B5w5DdXH.js → management-api-C9tFjLcE.js} +1 -1
- package/dist/gateway/static/root/assets/{management-settings-DfcMIqbQ.js → management-settings-DbnAlXoB.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-CNJaAdNN.js → markdown-view-CSpQhSka.js} +1 -1
- package/dist/gateway/static/root/assets/{mcp-conversation-setup-page-DCIEL5bA.js → mcp-conversation-setup-page-DedbjJbF.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-DGhWjPIU.js → media-plugins-BYnP_orq.js} +1 -1
- package/dist/gateway/static/root/assets/{messages-BAnhwALN.js → messages-e5MhDONm.js} +2 -2
- package/dist/gateway/static/root/assets/{model-selector-C-CqPBao.js → model-selector-B4oTiJI6.js} +1 -1
- package/dist/gateway/static/root/assets/{models-hub-cache-Bgh3Gfgl.js → models-hub-cache-DpEClnsE.js} +1 -1
- package/dist/gateway/static/root/assets/{note-detail-panel-DsXb1qjW.js → note-detail-panel-D8asMfBm.js} +3 -3
- package/dist/gateway/static/root/assets/note-image-lightbox-DcDw5kp4.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-BOIM9Q_D.js → notes-api-pVC1amyp.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-BTpiOw67.js → notes-page-CG1_6PLz.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-api-B560CHeD.js → oauth-api-BsVPwufr.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-provider-connect-D63M8Iv7.js → oauth-provider-connect-Bu20kmPq.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-B_Vdo2Ai.js → page-context-capture-button-CDsnNXjS.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-draft-Cr5GqS2D.js → page-context-draft-D6tu8c_9.js} +1 -1
- package/dist/gateway/static/root/assets/page-header-store-DeaRqZgV.js +1 -0
- package/dist/gateway/static/root/assets/panels-top-left-BKvp2Dag.js +1 -0
- package/dist/gateway/static/root/assets/{personal-avatar-BMRVyTrE.js → personal-avatar-BboNc6e2.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-page-I3IGVSJh.js → personal-page-gMRmLCWG.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-profile-settings-C4CxmQLQ.js → personal-profile-settings-Cd4QyseL.js} +1 -1
- package/dist/gateway/static/root/assets/{personal-settings-panel-CnxI2TL0.js → personal-settings-panel-CtBY_Uk1.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-dependencies-card-flTci8mm.js → phone-dependencies-card-BgH1LluB.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-connection-Vi_Swyv6.js → phone-model-connection-DkdKU5Kv.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-model-picker-BOv3mb_F.js → phone-model-picker-0g1z4RPL.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-settings-page-vD0bTcHj.js → phone-settings-page-DlIUajBY.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-workspace-store-Ltrevdsx.js → phone-workspace-store-DW2sZtkh.js} +1 -1
- package/dist/gateway/static/root/assets/{plugin-details-dialog-F08k_k2u.js → plugin-details-dialog-9KUkZk_t.js} +1 -1
- package/dist/gateway/static/root/assets/{preference-select-fields-D1pZekPs.js → preference-select-fields-DH5QZhIc.js} +1 -1
- package/dist/gateway/static/root/assets/{product-automation-feedback-CGso8wGv.js → product-automation-feedback-a1thJ0M9.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-BO8lUvw3.js → product-open-page-DCzQh7tr.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-Dgtb4LF7.js → product-preview-content-C5TLcagj.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-modal-C35EWUps.js → product-preview-modal-D9f-7kcI.js} +2 -2
- package/dist/gateway/static/root/assets/{project-detail-page-Dy46uSEt.js → project-detail-page-C4Z2HTRZ.js} +2 -2
- package/dist/gateway/static/root/assets/{project-understanding-Cg8WbBNB.js → project-understanding-CoPBvlqf.js} +1 -1
- package/dist/gateway/static/root/assets/{projects-page-C6Pt6OdT.js → projects-page-k1v8Fry8.js} +1 -1
- package/dist/gateway/static/root/assets/{providers-api-Nytkkop9.js → providers-api-BSJZyO8n.js} +1 -1
- package/dist/gateway/static/root/assets/{recording-upload-CFX7CANT.js → recording-upload-CExCePtr.js} +1 -1
- package/dist/gateway/static/root/assets/{registry-api-DuDIthjL.js → registry-api-CqcJj60w.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-DePwafOK.js → remote-access-hub-BLFkNl1y.js} +1 -1
- package/dist/gateway/static/root/assets/{resource-unavailable-BRKhKJA0.js → resource-unavailable-B_BXTQa7.js} +1 -1
- package/dist/gateway/static/root/assets/{right-workspace-store-HPw7Gw0n.js → right-workspace-store-OceFhUjM.js} +1 -1
- package/dist/gateway/static/root/assets/route-preload-ClsAFFQc.js +2 -0
- package/dist/gateway/static/root/assets/{routine-panel-KH1VaEdC.js → routine-panel-BsE9o9uu.js} +2 -2
- package/dist/gateway/static/root/assets/{runtime-tools-api-Dd8a07eo.js → runtime-tools-api-aAZChVm4.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CvHQoqHu.js → runtime-tools-settings-panel-Bn9HTrK5.js} +1 -1
- package/dist/gateway/static/root/assets/schema-form-BxBDgLrg.js +1 -0
- package/dist/gateway/static/root/assets/{service-recommendation-list-BmRtbJz2.js → service-recommendation-list-BNIVRGDf.js} +1 -1
- package/dist/gateway/static/root/assets/{session-api-BFiIYodK.js → session-api-DdW7Wix2.js} +1 -1
- package/dist/gateway/static/root/assets/session-channel-icon-DUJbB-Km.js +1 -0
- package/dist/gateway/static/root/assets/{session-identity-label-D5SAi0Uh.js → session-identity-label-DjhlQ6LU.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-XgtApqIh.js +25 -0
- package/dist/gateway/static/root/assets/sessions-page-CfhKeUkZ.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-BBG8dTIY.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-section-B-H1gYOs.js → settings-advanced-section-BOoJfJuB.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-mode-store-YH60sibB.js → settings-mode-store-BMh_BQ9a.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-C39lKVRv.js → settings-page-M6XwzIyu.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-DEZZ8D0S.js → settings-page-header-Bfu4cuQd.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-De2j64Lo.js → settings-page-layout-BnZa1qHH.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-interaction-page-Dh6BPwv0.js → setup-interaction-page-CVlrVNrm.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-DGAAczL-.js → setup-status-panel-FFyDODEx.js} +1 -1
- package/dist/gateway/static/root/assets/{share-link-dialog-C1t_HB6f.js → share-link-dialog-Cv-eDEw_.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-Cqy-7-rd.js → share-preview-page-BctH6eFs.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-api-Dm07CnXw.js → shares-api-cLTEcQLE.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DcetAN8K.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-BV8oFqeE.js → skill-api-CgEZJoy9.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-list-api-1o_YRCu9.js → skill-list-api-BWVr2PL5.js} +1 -1
- package/dist/gateway/static/root/assets/{skill-reload-api-fGsO9Y86.js → skill-reload-api-BLhHNvaK.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page-DReUQ4Ug.js → skills-page-DIjcAvA0.js} +1 -1
- package/dist/gateway/static/root/assets/sliding-segmented-DagP0myu.js +1 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-CUI6QHEP.js → system-settings-panel-C7LAPaN_.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-D1dNWTnP.js → task-detail-page-DmNEMg-l.js} +1 -1
- package/dist/gateway/static/root/assets/{task-result-evidence-CW_tN93T.js → task-result-evidence-BsBn3n_l.js} +1 -1
- package/dist/gateway/static/root/assets/{terminal-panel-store-Du53Upr2.js → terminal-panel-store-DJbLuUku.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-BaWep_o7.js → theme-store-QGcjV6pN.js} +1 -1
- package/dist/gateway/static/root/assets/{tracing-settings-page-CnciBMVH.js → tracing-settings-page-BKCiPwYL.js} +1 -1
- package/dist/gateway/static/root/assets/{tunnel-api-Iz7JCBt3.js → tunnel-api-S7J5Lpzt.js} +1 -1
- package/dist/gateway/static/root/assets/{understanding-activity-store-BFc8PamJ.js → understanding-activity-store-BNVhtJkn.js} +1 -1
- package/dist/gateway/static/root/assets/understanding-refresh-store-CM6bUcaJ.js +1 -0
- package/dist/gateway/static/root/assets/undo-2-6IMTwK4M.js +1 -0
- package/dist/gateway/static/root/assets/{unlink-BEuthaaq.js → unlink-NsCMuCT1.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-DL2fmeOh.js → usage-page-D-AqzjIx.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-N_SjHXTw.js → use-autosave-CqZbhhCc.js} +1 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-BfLhIb2_.js +2 -0
- package/dist/gateway/static/root/assets/{use-file-preview-expanded-D0IBFhM9.js → use-file-preview-expanded-DufxDues.js} +3 -3
- package/dist/gateway/static/root/assets/{use-personal-profile-C1vqD9yV.js → use-personal-profile-RnjxZnLa.js} +1 -1
- package/dist/gateway/static/root/assets/{use-realtime-voice-B5IsKrRW.js → use-realtime-voice-w3aHR2dr.js} +1 -1
- package/dist/gateway/static/root/assets/{use-workspace-tree-7X2ydgS8.js → use-workspace-tree-2Ck-ql5c.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-CBcGMhrR.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-B_GApUQP.js → voice-api-key-field-C4rhpgco.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-DhJ3l8fk.js → voice-config-api-7AHN-ns6.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-input-shortcut-events-CEeFBhp3.js → voice-input-shortcut-events-BbRrj833.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-settings-57pwZeKD.js → voice-settings-wamtp0lg.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BJ15p4rH.js → work-discovery-overlay-fVofN7aP.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-8XciWNs5.js → work-discovery-page-DcQG5GWy.js} +1 -1
- package/dist/gateway/static/root/assets/{working-directory-picker-modal-BGZduAXV.js → working-directory-picker-modal-D8Stwszr.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-api-Dd_UDfeo.js → workspace-api-D3iuTdNK.js} +2 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-C-J7vr2o.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-Clj9hMj5.js → workspace-file-preview-dialog-BXbL5Y1h.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-CvZxU9de.js → workspace-open-location-menu-1gFO_BdL.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-preview-store-imhtuEIP.js → workspace-preview-store-adwmi4nx.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-Q_jezTUy.js → xopc-cloud-account-card-DhGh4rm7.js} +1 -1
- package/dist/gateway/static/root/index.html +97 -93
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/session-input-command.js +5 -0
- package/dist/src/agent/inbound/inbound-loop.js +14 -0
- package/dist/src/agent/messaging/outbound-coordinator.js +1 -1
- package/dist/src/agent/prompt/response-language.js +9 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +3 -0
- package/dist/src/channels/connection-probe.d.ts +23 -0
- package/dist/src/channels/connection-probe.js +98 -0
- package/dist/src/channels/manager.d.ts +2 -0
- package/dist/src/channels/manager.js +5 -0
- package/dist/src/channels/message-journal.d.ts +25 -0
- package/dist/src/channels/message-journal.js +79 -0
- package/dist/src/channels/outbound-sender.d.ts +8 -0
- package/dist/src/channels/outbound-sender.js +60 -1
- package/dist/src/channels/plugins/types.adapters.d.ts +4 -0
- package/dist/src/channels/verified-inbound.js +20 -14
- package/dist/src/cli/commands/gateway/lifecycle.js +2 -2
- package/dist/src/cli/commands/update.js +1 -1
- package/dist/src/config/schema.d.ts +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -1
- package/dist/src/gateway/hono/middleware/auth.js +1 -1
- package/dist/src/gateway/hono/routes/channels.js +23 -10
- package/dist/src/gateway/hono/routes/connectors.js +1 -1
- package/dist/src/gateway/hono/routes/desktop-host.js +1 -1
- package/dist/src/gateway/hono/routes/imports.js +1 -1
- package/dist/src/gateway/hono/routes/personal-agent.js +3 -3
- package/dist/src/gateway/hono/routes/update.js +2 -2
- package/dist/src/gateway/hono/routes/user-model.js +48 -20
- package/dist/src/gateway/index.js +1 -1
- package/dist/src/gateway/run-loop.js +2 -2
- package/dist/src/gateway/service/agent-runner.js +1 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +1 -1
- package/dist/src/gateway/service/run-gateway-agent.js +1 -1
- package/dist/src/gateway/service.js +8 -8
- package/dist/src/i18n/response-language.d.ts +1 -1
- package/dist/src/infra/bus/index.d.ts +1 -1
- package/dist/src/infra/bus/queue.d.ts +16 -3
- package/dist/src/infra/bus/queue.js +74 -3
- package/dist/src/infra/debounce.d.ts +1 -0
- package/dist/src/infra/debounce.js +40 -35
- package/dist/src/infra/gateway-processes.js +1 -1
- package/dist/src/infra/update-restart.js +2 -2
- package/dist/src/infra/update-runner.js +2 -2
- package/dist/src/infra/update-startup.js +1 -1
- package/dist/src/knowledge-memory/index.js +2 -2
- package/dist/src/knowledge-memory/repository.d.ts +9 -0
- package/dist/src/knowledge-memory/repository.js +12 -2
- package/dist/src/notifications/service.js +2 -2
- package/dist/src/phone/stream-gateway.js +1 -1
- package/dist/src/runtime-tools/types.d.ts +1 -1
- package/dist/src/storage/sqlite/session-creation-repository.js +6 -1
- package/dist/src/user-context/config.d.ts +1 -1
- package/package.json +4 -5
- package/dist/extensions/demo-memory/src/index.d.ts +0 -6
- package/dist/extensions/demo-memory/src/index.js +0 -146
- package/dist/extensions/demo-memory/xopc.extension.json +0 -15
- package/dist/gateway/static/root/assets/agents-DC0lHtl5.js +0 -77
- package/dist/gateway/static/root/assets/automations-workspace-JCQ1IXFk.js +0 -9
- package/dist/gateway/static/root/assets/capabilities-page-kPv2dOzf.js +0 -2
- package/dist/gateway/static/root/assets/channels-B--IHNs4.js +0 -1
- package/dist/gateway/static/root/assets/chat-agents-api-CjlzCSmC.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BV51dk16.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-sx7B8kdC.js +0 -1
- package/dist/gateway/static/root/assets/home-page-DefKShSW.js +0 -8
- package/dist/gateway/static/root/assets/index-CChzK_5b.css +0 -1
- package/dist/gateway/static/root/assets/index-DUo6H0PC.js +0 -11
- package/dist/gateway/static/root/assets/local-session-drafts-BIBHRkpM.js +0 -4
- package/dist/gateway/static/root/assets/note-image-lightbox-D6mvMSKr.js +0 -1
- package/dist/gateway/static/root/assets/page-header-store-Bm8oxpFR.js +0 -1
- package/dist/gateway/static/root/assets/route-preload-ChTaYgpA.js +0 -2
- package/dist/gateway/static/root/assets/schema-form-C9TYGa0_.js +0 -1
- package/dist/gateway/static/root/assets/session-channel-icon-BzkFo-Ci.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-63NaXb1s.js +0 -25
- package/dist/gateway/static/root/assets/sessions-page-DQEq_VJS.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Cvx7DnU8.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BDr50uTV.js +0 -1
- package/dist/gateway/static/root/assets/sliding-segmented-CgQ3BFdb.js +0 -1
- package/dist/gateway/static/root/assets/understanding-refresh-store-CdEfR40A.js +0 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-Xn6eUus2.js +0 -2
- package/dist/gateway/static/root/assets/user-model-page-D2FHjLi7.js +0 -2
- package/dist/gateway/static/root/assets/workspace-editor-agent-store-DVPJcbuE.js +0 -1
|
@@ -55,8 +55,13 @@ var InboundLoop = class {
|
|
|
55
55
|
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
56
56
|
continue;
|
|
57
57
|
}
|
|
58
|
+
let began = false;
|
|
59
|
+
let completed = false;
|
|
58
60
|
try {
|
|
61
|
+
began = this.cfg.bus.beginInboundProcessing?.(msg) ?? true;
|
|
62
|
+
if (!began) continue;
|
|
59
63
|
await this.handleInboundMessage(msg);
|
|
64
|
+
completed = true;
|
|
60
65
|
} catch (error) {
|
|
61
66
|
const em = error instanceof Error ? error.message : String(error);
|
|
62
67
|
this.log.error({
|
|
@@ -66,6 +71,15 @@ var InboundLoop = class {
|
|
|
66
71
|
channel: msg.channel,
|
|
67
72
|
chatId: msg.chat_id
|
|
68
73
|
}, `Inbound message handler failed: ${em}`);
|
|
74
|
+
} finally {
|
|
75
|
+
if (began) try {
|
|
76
|
+
this.cfg.bus.finishInboundProcessing?.(msg, completed);
|
|
77
|
+
} catch (err) {
|
|
78
|
+
this.log.error({
|
|
79
|
+
err,
|
|
80
|
+
channel: msg.channel
|
|
81
|
+
}, "Could not record inbound processing outcome");
|
|
82
|
+
}
|
|
69
83
|
}
|
|
70
84
|
}
|
|
71
85
|
await this.cfg.hookHandler.trigger("session_end", {
|
|
@@ -87,7 +87,7 @@ var OutboundCoordinator = class {
|
|
|
87
87
|
sessionWebhook: msg.metadata?.sessionWebhook,
|
|
88
88
|
conversationId: msg.metadata?.conversationId
|
|
89
89
|
}
|
|
90
|
-
});
|
|
90
|
+
}, msg);
|
|
91
91
|
}
|
|
92
92
|
/** Run extension completion hooks and independently review an attached Task. */
|
|
93
93
|
async emitSessionTurnComplete(payload) {
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import { isXopcDatabaseOpen } from "../../storage/sqlite/connection.js";
|
|
2
2
|
import { TaskRepository, init_task_repository } from "../../tasks/task-repository.js";
|
|
3
|
+
import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
|
|
3
4
|
import { getSessionConfig } from "../../storage/sqlite/config-repository.js";
|
|
4
5
|
import "../../storage/sqlite/index.js";
|
|
5
6
|
import { init_response_language, resolveResponseLanguage } from "../../i18n/response-language.js";
|
|
7
|
+
import { getUserProfileSnapshot } from "../../user-model/profile.js";
|
|
6
8
|
import { resolveTaskLocale } from "../../tasks/task-language.js";
|
|
7
9
|
import { TaskConversationRepository } from "../../tasks/task-conversation-repository.js";
|
|
8
10
|
//#region src/agent/prompt/response-language.ts
|
|
9
11
|
init_response_language();
|
|
10
12
|
init_task_repository();
|
|
11
13
|
function resolveResponseLanguageForSession(config, conversationId) {
|
|
12
|
-
const
|
|
14
|
+
const userPreference = config?.userContext?.preferences?.responseLanguage ?? "auto";
|
|
15
|
+
const sessionPreference = conversationId && isXopcDatabaseOpen() ? getSessionConfig(conversationId)?.responseLanguage : void 0;
|
|
16
|
+
if (!sessionPreference && conversationId && isXopcDatabaseOpen() && getSessionMetadata(conversationId)?.customData?.agentSetup === true) {
|
|
17
|
+
const locale = getUserProfileSnapshot().locale?.toLowerCase().split("-")[0];
|
|
18
|
+
return locale === "zh" ? "zh-CN" : locale === "en" ? "en" : userPreference;
|
|
19
|
+
}
|
|
20
|
+
const language = resolveResponseLanguage(userPreference, sessionPreference);
|
|
13
21
|
if (language !== "auto" || !conversationId || !isXopcDatabaseOpen()) return language;
|
|
14
22
|
const taskId = new TaskConversationRepository().resolveActiveExecutionSession(conversationId)?.taskId;
|
|
15
23
|
const task = taskId ? new TaskRepository().get(taskId) : void 0;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { isXopcDatabaseOpen } from "../../storage/sqlite/connection.js";
|
|
4
|
+
import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
|
|
4
5
|
import { buildInteractionStatePrompt } from "../../user-context/interaction-state.js";
|
|
5
6
|
import { getInteractionState } from "../../storage/sqlite/interaction-state-repository.js";
|
|
6
7
|
import { DEFAULT_USER_TRUST_LEVEL } from "../../user-context/trust-policy.js";
|
|
@@ -43,6 +44,7 @@ var SystemPromptBuilder = class {
|
|
|
43
44
|
textToSpeechTool: ttsMerged.enabled && reg.includes("text_to_speech")
|
|
44
45
|
});
|
|
45
46
|
const responseLanguage = resolveResponseLanguageForSession(this.config, options.conversationId);
|
|
47
|
+
const agentSetup = options.conversationId && isXopcDatabaseOpen() && getSessionMetadata(options.conversationId)?.customData?.agentSetup === true;
|
|
46
48
|
const resolved = resolveSystemPromptBuildParams(this.config, {
|
|
47
49
|
workspaceDir: ws,
|
|
48
50
|
conversationId: options.conversationId,
|
|
@@ -54,6 +56,7 @@ var SystemPromptBuilder = class {
|
|
|
54
56
|
extraSystemPrompt: [
|
|
55
57
|
options.extraSystemPrompt,
|
|
56
58
|
getConversationalConfigurationGuide(reg),
|
|
59
|
+
agentSetup ? "In this agent setup conversation, follow Response Language for every question and reply. A language requested for the new Agent configures that Agent only. Keep the current conversation language unless the user asks to switch it." : void 0,
|
|
57
60
|
interactionPrompt
|
|
58
61
|
].filter(Boolean).join("\n\n"),
|
|
59
62
|
activeProjectContext: options.activeProjectContext,
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ChannelRuntimeActionPayload } from './plugins/types.adapters.js';
|
|
2
|
+
export declare function startChannelConnectionProbe(params: {
|
|
3
|
+
channel: string;
|
|
4
|
+
accountId: string;
|
|
5
|
+
ownerId?: string;
|
|
6
|
+
identity?: string;
|
|
7
|
+
confirmOwner?: boolean;
|
|
8
|
+
botUsername?: string;
|
|
9
|
+
configChanged?: boolean;
|
|
10
|
+
zh: boolean;
|
|
11
|
+
}): ChannelRuntimeActionPayload;
|
|
12
|
+
export declare function getChannelConnectionProbe(channel: string, accountId: string, id: string, zh: boolean): ChannelRuntimeActionPayload;
|
|
13
|
+
export declare function cancelChannelConnectionProbe(channel: string, accountId: string, id: string): void;
|
|
14
|
+
export declare function getChannelConnectionClaimant(channel: string, accountId: string, id: string, identity: string): string | undefined;
|
|
15
|
+
export declare function confirmChannelConnectionProbe(channel: string, accountId: string, id: string): void;
|
|
16
|
+
export declare function handleChannelConnectionProbe(params: {
|
|
17
|
+
channel: string;
|
|
18
|
+
accountId: string;
|
|
19
|
+
senderId: string;
|
|
20
|
+
identity?: string;
|
|
21
|
+
text: string;
|
|
22
|
+
reply: (text: string) => Promise<unknown>;
|
|
23
|
+
}): Promise<boolean>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
//#region src/channels/connection-probe.ts
|
|
3
|
+
const LIFETIME_MS = 5 * 6e4;
|
|
4
|
+
const probes = /* @__PURE__ */ new Map();
|
|
5
|
+
const probeKey = (channel, accountId) => JSON.stringify([channel, accountId]);
|
|
6
|
+
function startChannelConnectionProbe(params) {
|
|
7
|
+
const { channel, accountId, ownerId, identity, botUsername, zh } = params;
|
|
8
|
+
const id = randomUUID();
|
|
9
|
+
const code = `xopc_${randomUUID().replaceAll("-", "")}`;
|
|
10
|
+
const key = probeKey(channel, accountId);
|
|
11
|
+
const probe = {
|
|
12
|
+
id,
|
|
13
|
+
code,
|
|
14
|
+
expiresAt: Date.now() + LIFETIME_MS,
|
|
15
|
+
ownerId,
|
|
16
|
+
identity,
|
|
17
|
+
confirmOwner: params.confirmOwner ?? false,
|
|
18
|
+
sending: false,
|
|
19
|
+
verified: false
|
|
20
|
+
};
|
|
21
|
+
probes.set(key, probe);
|
|
22
|
+
setTimeout(() => {
|
|
23
|
+
if (probes.get(key) === probe) probes.delete(key);
|
|
24
|
+
}, LIFETIME_MS).unref();
|
|
25
|
+
const link = botUsername ? `https://t.me/${encodeURIComponent(botUsername)}?start=${code}` : void 0;
|
|
26
|
+
return {
|
|
27
|
+
type: "qr",
|
|
28
|
+
conversationId: id,
|
|
29
|
+
accountId,
|
|
30
|
+
...link ? { qrPayload: link } : { verificationCode: code },
|
|
31
|
+
statusAction: "setup.verify.status",
|
|
32
|
+
cancelAction: "setup.verify.cancel",
|
|
33
|
+
pollIntervalMs: 1500,
|
|
34
|
+
expiresInSec: LIFETIME_MS / 1e3,
|
|
35
|
+
configChanged: params.configChanged,
|
|
36
|
+
message: link ? zh ? "凭据已验证。在 Telegram 打开机器人并点击开始。" : "Credentials verified. Open the bot in Telegram and tap Start." : zh ? "已授权。请在机器人私聊中发送下方验证码。" : "Authorized. Send the code below in a private chat with the bot."
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
function getChannelConnectionProbe(channel, accountId, id, zh) {
|
|
40
|
+
const probe = findProbe(channel, accountId, id);
|
|
41
|
+
if (!probe) return {
|
|
42
|
+
type: "poll",
|
|
43
|
+
phase: "unknown",
|
|
44
|
+
ok: false,
|
|
45
|
+
message: zh ? "验证已结束,请重新连接。" : "Verification ended. Connect again to retry."
|
|
46
|
+
};
|
|
47
|
+
if (probe.verified) return {
|
|
48
|
+
type: "poll",
|
|
49
|
+
phase: "done",
|
|
50
|
+
ok: true,
|
|
51
|
+
message: zh ? "已连接,双向收发已验证。" : "Connected. Message delivery verified in both directions."
|
|
52
|
+
};
|
|
53
|
+
if (probe.claimant && probe.confirmOwner) return {
|
|
54
|
+
type: "poll",
|
|
55
|
+
phase: "done",
|
|
56
|
+
confirmAction: "setup.verify.confirm",
|
|
57
|
+
conversationId: id,
|
|
58
|
+
accountId,
|
|
59
|
+
message: zh ? `Telegram 已收到验证回复。请确认用户 ${probe.claimant}。` : `Telegram received the test reply. Confirm user ${probe.claimant}.`
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
type: "poll",
|
|
63
|
+
phase: "pending",
|
|
64
|
+
message: zh ? "等待机器人收到验证消息并回复。" : "Waiting for the bot to receive the test message and reply."
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function findProbe(channel, accountId, id) {
|
|
68
|
+
const probe = probes.get(probeKey(channel, accountId));
|
|
69
|
+
if (probe?.id === id && probe.expiresAt > Date.now()) return probe;
|
|
70
|
+
}
|
|
71
|
+
function cancelChannelConnectionProbe(channel, accountId, id) {
|
|
72
|
+
if (findProbe(channel, accountId, id)) probes.delete(probeKey(channel, accountId));
|
|
73
|
+
}
|
|
74
|
+
function getChannelConnectionClaimant(channel, accountId, id, identity) {
|
|
75
|
+
const probe = findProbe(channel, accountId, id);
|
|
76
|
+
if (probe?.confirmOwner && probe.identity === identity) return probe.claimant;
|
|
77
|
+
}
|
|
78
|
+
function confirmChannelConnectionProbe(channel, accountId, id) {
|
|
79
|
+
const probe = findProbe(channel, accountId, id);
|
|
80
|
+
if (probe?.claimant) probe.verified = true;
|
|
81
|
+
}
|
|
82
|
+
async function handleChannelConnectionProbe(params) {
|
|
83
|
+
const probe = probes.get(probeKey(params.channel, params.accountId));
|
|
84
|
+
const code = params.text.trim().replace(/^\/start(?:@[\w_]+)?\s+/, "");
|
|
85
|
+
if (!/^xopc_[a-f0-9]{32}$/.test(code)) return false;
|
|
86
|
+
if (!probe || probe.code !== code || probe.expiresAt <= Date.now() || probe.identity && params.identity !== probe.identity || probe.ownerId && params.senderId !== probe.ownerId || probe.sending || probe.claimant || probe.verified) return true;
|
|
87
|
+
probe.sending = true;
|
|
88
|
+
try {
|
|
89
|
+
await params.reply("xopc ✓");
|
|
90
|
+
probe.claimant = params.senderId;
|
|
91
|
+
probe.verified = !probe.confirmOwner;
|
|
92
|
+
} finally {
|
|
93
|
+
probe.sending = false;
|
|
94
|
+
}
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
export { cancelChannelConnectionProbe, confirmChannelConnectionProbe, getChannelConnectionClaimant, getChannelConnectionProbe, handleChannelConnectionProbe, startChannelConnectionProbe };
|
|
@@ -21,6 +21,7 @@ import { ChannelHealthMonitor, type ChannelHealthState } from './health-monitor.
|
|
|
21
21
|
import { type OutboundChannelHooks } from './outbound-sender.js';
|
|
22
22
|
export type { OutboundChannelHooks } from './outbound-sender.js';
|
|
23
23
|
export declare class ChannelManager {
|
|
24
|
+
private readonly bus;
|
|
24
25
|
private config;
|
|
25
26
|
private readonly registry;
|
|
26
27
|
private readonly healthMonitor;
|
|
@@ -52,6 +53,7 @@ export declare class ChannelManager {
|
|
|
52
53
|
skipPersist?: boolean;
|
|
53
54
|
requireDelivery?: boolean;
|
|
54
55
|
}): Promise<void>;
|
|
56
|
+
sendQueuedOutboundMessage(message: OutboundMessage): Promise<void>;
|
|
55
57
|
replayPendingOutboundMessages(): Promise<void>;
|
|
56
58
|
startStream(channel: string, chatId: string, accountId?: string, opts?: {
|
|
57
59
|
threadId?: string;
|
|
@@ -17,6 +17,7 @@ var ChannelManager = class {
|
|
|
17
17
|
outbound;
|
|
18
18
|
sessionModelHooks;
|
|
19
19
|
constructor(config, bus) {
|
|
20
|
+
this.bus = bus;
|
|
20
21
|
this.config = config;
|
|
21
22
|
this.heartbeat = new ChannelHeartbeatScheduler({
|
|
22
23
|
getConfig: () => this.config,
|
|
@@ -47,6 +48,7 @@ var ChannelManager = class {
|
|
|
47
48
|
}
|
|
48
49
|
enableOutboundPersistence(agentId) {
|
|
49
50
|
this.outbound.enablePersistence(agentId);
|
|
51
|
+
this.bus.setOutboundReplyPersistence?.((message, delivery) => this.outbound.persistReply(message, delivery));
|
|
50
52
|
}
|
|
51
53
|
registerPlugin(plugin) {
|
|
52
54
|
this.registry.register(plugin);
|
|
@@ -89,6 +91,9 @@ var ChannelManager = class {
|
|
|
89
91
|
send(msg, options) {
|
|
90
92
|
return this.outbound.send(msg, options);
|
|
91
93
|
}
|
|
94
|
+
sendQueuedOutboundMessage(message) {
|
|
95
|
+
return this.outbound.sendQueued(message);
|
|
96
|
+
}
|
|
92
97
|
replayPendingOutboundMessages() {
|
|
93
98
|
return this.outbound.replayPending();
|
|
94
99
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
type JournalEntry<T> = {
|
|
2
|
+
id: string;
|
|
3
|
+
payload: T;
|
|
4
|
+
};
|
|
5
|
+
/** Persists channel messages, their dispatch receipts, and optional platform cursors. */
|
|
6
|
+
export declare class ChannelMessageJournal<T, Cursor> {
|
|
7
|
+
private readonly scope;
|
|
8
|
+
private readonly cursors;
|
|
9
|
+
private readonly queue;
|
|
10
|
+
private lastPrunedAt;
|
|
11
|
+
constructor(channel: string, scope: string);
|
|
12
|
+
cursor(): Cursor | undefined;
|
|
13
|
+
accept(entries: JournalEntry<T>[], cursor?: Cursor): string[];
|
|
14
|
+
pending(limit?: number): Array<JournalEntry<T> & {
|
|
15
|
+
enqueuedAt: number;
|
|
16
|
+
}>;
|
|
17
|
+
begin(id: string, replayable?: boolean): boolean;
|
|
18
|
+
finish(id: string, outcome: 'completed' | 'interrupted'): void;
|
|
19
|
+
finishBatch(entries: ReadonlyArray<{
|
|
20
|
+
id: string;
|
|
21
|
+
outcome: 'completed' | 'interrupted';
|
|
22
|
+
}>): void;
|
|
23
|
+
recoverInterrupted(): number;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { init_connection, requireXopcDatabase } from "../storage/sqlite/connection.js";
|
|
2
|
+
import { init_transaction, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
|
|
3
|
+
import { DurableState } from "../storage/sqlite/durable-state.js";
|
|
4
|
+
//#region src/channels/message-journal.ts
|
|
5
|
+
init_connection();
|
|
6
|
+
init_transaction();
|
|
7
|
+
const MAX_PENDING = 500;
|
|
8
|
+
const MAX_PENDING_BYTES = 16 * 1024 * 1024;
|
|
9
|
+
const RECEIPT_RETENTION_MS = 10080 * 6e4;
|
|
10
|
+
/** Persists channel messages, their dispatch receipts, and optional platform cursors. */
|
|
11
|
+
var ChannelMessageJournal = class {
|
|
12
|
+
cursors;
|
|
13
|
+
queue;
|
|
14
|
+
lastPrunedAt = 0;
|
|
15
|
+
constructor(channel, scope) {
|
|
16
|
+
this.scope = scope;
|
|
17
|
+
this.queue = `channel-journal:${channel}`;
|
|
18
|
+
this.cursors = new DurableState(this.queue);
|
|
19
|
+
}
|
|
20
|
+
cursor() {
|
|
21
|
+
return this.cursors.get(this.scope);
|
|
22
|
+
}
|
|
23
|
+
accept(entries, cursor) {
|
|
24
|
+
requireXopcDatabase();
|
|
25
|
+
return runSqliteWriteTransaction((db) => {
|
|
26
|
+
const insert = db.prepare(`INSERT INTO durable_messages(queue, scope, id, payload, enqueued_at)
|
|
27
|
+
VALUES (?, ?, ?, ?, ?) ON CONFLICT(queue, scope, id) DO NOTHING`);
|
|
28
|
+
const now = Date.now();
|
|
29
|
+
if (now - this.lastPrunedAt > 60 * 6e4) {
|
|
30
|
+
db.prepare(`DELETE FROM durable_messages WHERE queue = ? AND scope = ? AND processed_at <= ?`).run(this.queue, this.scope, now - RECEIPT_RETENTION_MS);
|
|
31
|
+
this.lastPrunedAt = now;
|
|
32
|
+
}
|
|
33
|
+
const inserted = [];
|
|
34
|
+
for (const entry of entries) if (insert.run(this.queue, this.scope, entry.id, JSON.stringify(entry.payload), now).changes > 0) inserted.push(entry.id);
|
|
35
|
+
if (entries.length) {
|
|
36
|
+
const pending = db.prepare(`SELECT count(*) AS count, coalesce(sum(length(CAST(payload AS BLOB))), 0) AS bytes
|
|
37
|
+
FROM durable_messages WHERE queue = ? AND scope = ? AND processed_at IS NULL`).get(this.queue, this.scope);
|
|
38
|
+
if (pending.count > MAX_PENDING || pending.bytes > MAX_PENDING_BYTES) throw new Error("Channel inbox capacity exceeded");
|
|
39
|
+
}
|
|
40
|
+
if (cursor !== void 0) this.cursors.set(this.scope, cursor);
|
|
41
|
+
return inserted;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
pending(limit = 100) {
|
|
45
|
+
return requireXopcDatabase().db.prepare(`SELECT id, payload, enqueued_at FROM durable_messages
|
|
46
|
+
WHERE queue = ? AND scope = ? AND processed_at IS NULL AND lease_token IS NULL
|
|
47
|
+
ORDER BY sequence LIMIT ?`).all(this.queue, this.scope, limit).map((row) => ({
|
|
48
|
+
id: row.id,
|
|
49
|
+
payload: JSON.parse(row.payload),
|
|
50
|
+
enqueuedAt: row.enqueued_at
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
begin(id, replayable = false) {
|
|
54
|
+
return requireXopcDatabase().db.prepare(`UPDATE durable_messages SET lease_token = ?
|
|
55
|
+
WHERE queue = ? AND scope = ? AND id = ? AND processed_at IS NULL AND lease_token IS NULL`).run(replayable ? "preparing" : "dispatching", this.queue, this.scope, id).changes > 0;
|
|
56
|
+
}
|
|
57
|
+
finish(id, outcome) {
|
|
58
|
+
requireXopcDatabase().db.prepare(`UPDATE durable_messages
|
|
59
|
+
SET processed_at = ?, lease_token = ?, payload = '{}'
|
|
60
|
+
WHERE queue = ? AND scope = ? AND id = ? AND processed_at IS NULL AND lease_token IN ('dispatching', 'preparing')`).run(Date.now(), outcome, this.queue, this.scope, id);
|
|
61
|
+
}
|
|
62
|
+
finishBatch(entries) {
|
|
63
|
+
if (!entries.length) return;
|
|
64
|
+
runSqliteWriteTransaction(() => {
|
|
65
|
+
for (const { id, outcome } of entries) this.finish(id, outcome);
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
recoverInterrupted() {
|
|
69
|
+
const db = requireXopcDatabase().db;
|
|
70
|
+
db.prepare(`UPDATE durable_messages SET lease_token = NULL
|
|
71
|
+
WHERE queue = ? AND scope = ? AND processed_at IS NULL AND lease_token = 'preparing'`).run(this.queue, this.scope);
|
|
72
|
+
const count = db.prepare(`UPDATE durable_messages SET processed_at = ?, lease_token = 'interrupted', payload = '{}'
|
|
73
|
+
WHERE queue = ? AND scope = ? AND processed_at IS NULL AND lease_token = 'dispatching'`).run(Date.now(), this.queue, this.scope).changes;
|
|
74
|
+
db.prepare(`DELETE FROM durable_messages WHERE queue = ? AND scope = ? AND processed_at <= ?`).run(this.queue, this.scope, Date.now() - RECEIPT_RETENTION_MS);
|
|
75
|
+
return Number(count);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
//#endregion
|
|
79
|
+
export { ChannelMessageJournal };
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* the highest-traffic path in the channel layer; centralising it makes its
|
|
15
15
|
* error semantics easier to reason about.
|
|
16
16
|
*/
|
|
17
|
+
import type { InboundDelivery } from '../infra/bus/index.js';
|
|
17
18
|
import type { Config } from '../config/schema.js';
|
|
18
19
|
import type { OutboundMessage } from './transport-types.js';
|
|
19
20
|
import type { ChannelPluginRegistry } from './plugin-registry.js';
|
|
@@ -35,9 +36,16 @@ export declare class ChannelOutboundSender {
|
|
|
35
36
|
private readonly opts;
|
|
36
37
|
private hooks?;
|
|
37
38
|
private persistStore?;
|
|
39
|
+
private replyJournal?;
|
|
40
|
+
private replyRecoveryDone;
|
|
41
|
+
private readonly replyReceipts;
|
|
38
42
|
constructor(opts: ChannelOutboundSenderOptions);
|
|
39
43
|
setHooks(hooks: OutboundChannelHooks): void;
|
|
40
44
|
enablePersistence(agentId: string): void;
|
|
45
|
+
persistReply(message: OutboundMessage, delivery: InboundDelivery): boolean;
|
|
46
|
+
sendQueued(message: OutboundMessage): Promise<void>;
|
|
47
|
+
private dispatchReply;
|
|
48
|
+
private recoverInterruptedReplies;
|
|
41
49
|
/**
|
|
42
50
|
* Redeliver every queued outbound item (called after channels are started).
|
|
43
51
|
* Best-effort — may duplicate if the prior send succeeded but ack did not
|
|
@@ -2,6 +2,7 @@ import { createLogger } from "../utils/logger/index.js";
|
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { mergeTtsConfigFromAppConfig } from "../voice/tts/merge-config.js";
|
|
4
4
|
import { maybeApplyTtsToPayload } from "../voice/tts/payload.js";
|
|
5
|
+
import { ChannelMessageJournal } from "./message-journal.js";
|
|
5
6
|
import "./internal-outbound.js";
|
|
6
7
|
import { deliverOutboundMessage } from "./outbound/deliver.js";
|
|
7
8
|
import { OutboundPersistStore } from "./outbound/persist-store.js";
|
|
@@ -12,6 +13,9 @@ var ChannelOutboundSender = class {
|
|
|
12
13
|
opts;
|
|
13
14
|
hooks;
|
|
14
15
|
persistStore;
|
|
16
|
+
replyJournal;
|
|
17
|
+
replyRecoveryDone = false;
|
|
18
|
+
replyReceipts = /* @__PURE__ */ new WeakMap();
|
|
15
19
|
constructor(opts) {
|
|
16
20
|
this.opts = opts;
|
|
17
21
|
}
|
|
@@ -20,6 +24,56 @@ var ChannelOutboundSender = class {
|
|
|
20
24
|
}
|
|
21
25
|
enablePersistence(agentId) {
|
|
22
26
|
this.persistStore = new OutboundPersistStore(agentId);
|
|
27
|
+
this.replyJournal = new ChannelMessageJournal("agent-reply", agentId);
|
|
28
|
+
this.replyRecoveryDone = false;
|
|
29
|
+
}
|
|
30
|
+
persistReply(message, delivery) {
|
|
31
|
+
if (!this.replyJournal) return true;
|
|
32
|
+
this.recoverInterruptedReplies();
|
|
33
|
+
const id = JSON.stringify([
|
|
34
|
+
message.channel,
|
|
35
|
+
delivery.scope,
|
|
36
|
+
delivery.id
|
|
37
|
+
]);
|
|
38
|
+
const accepted = this.replyJournal.accept([{
|
|
39
|
+
id,
|
|
40
|
+
payload: message
|
|
41
|
+
}]).length > 0;
|
|
42
|
+
if (accepted) this.replyReceipts.set(message, id);
|
|
43
|
+
return accepted;
|
|
44
|
+
}
|
|
45
|
+
async sendQueued(message) {
|
|
46
|
+
const id = this.replyReceipts.get(message);
|
|
47
|
+
if (!id || !this.replyJournal) {
|
|
48
|
+
await this.send(message);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.replyReceipts.delete(message);
|
|
52
|
+
await this.dispatchReply(id, message);
|
|
53
|
+
}
|
|
54
|
+
async dispatchReply(id, message) {
|
|
55
|
+
const journal = this.replyJournal;
|
|
56
|
+
if (!journal?.begin(id)) return;
|
|
57
|
+
try {
|
|
58
|
+
await this.send(message, {
|
|
59
|
+
skipPersist: true,
|
|
60
|
+
requireDelivery: true
|
|
61
|
+
});
|
|
62
|
+
} catch {
|
|
63
|
+
journal.finish(id, "interrupted");
|
|
64
|
+
log.warn({
|
|
65
|
+
channel: message.channel,
|
|
66
|
+
deliveryId: id
|
|
67
|
+
}, "Channel reply delivery could not be confirmed");
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
journal.finish(id, "completed");
|
|
71
|
+
}
|
|
72
|
+
recoverInterruptedReplies() {
|
|
73
|
+
if (!this.replyJournal || this.replyRecoveryDone) return;
|
|
74
|
+
const interrupted = this.replyJournal.recoverInterrupted();
|
|
75
|
+
this.replyRecoveryDone = true;
|
|
76
|
+
if (interrupted) log.warn({ interrupted }, "Channel replies interrupted during delivery");
|
|
23
77
|
}
|
|
24
78
|
/**
|
|
25
79
|
* Redeliver every queued outbound item (called after channels are started).
|
|
@@ -27,6 +81,11 @@ var ChannelOutboundSender = class {
|
|
|
27
81
|
* land on disk.
|
|
28
82
|
*/
|
|
29
83
|
async replayPending() {
|
|
84
|
+
const journal = this.replyJournal;
|
|
85
|
+
if (journal) {
|
|
86
|
+
this.recoverInterruptedReplies();
|
|
87
|
+
for (const { id, payload } of journal.pending(500)) await this.dispatchReply(id, payload);
|
|
88
|
+
}
|
|
30
89
|
if (!this.persistStore) return;
|
|
31
90
|
const pending = [...this.persistStore.peek()];
|
|
32
91
|
for (const p of pending) try {
|
|
@@ -103,7 +162,7 @@ var ChannelOutboundSender = class {
|
|
|
103
162
|
chatId: processedMsg.chat_id,
|
|
104
163
|
err
|
|
105
164
|
}, "Outbound send threw");
|
|
106
|
-
if (!queueId) throw err;
|
|
165
|
+
if (!queueId || options?.requireDelivery) throw err;
|
|
107
166
|
}
|
|
108
167
|
}
|
|
109
168
|
async applyTtsIfNeeded(msg) {
|
|
@@ -178,6 +178,10 @@ export interface ChannelRuntimeActionResult {
|
|
|
178
178
|
message?: string;
|
|
179
179
|
/** Internal gateway-side config replacement; never returned to the browser. */
|
|
180
180
|
nextConfig?: Config;
|
|
181
|
+
/** Called by the gateway only after the proposed config is saved. */
|
|
182
|
+
onConfigSaved?: () => ChannelRuntimeActionPayload | void | Promise<ChannelRuntimeActionPayload | void>;
|
|
183
|
+
/** Persist channel-owned credentials after the config compare-and-swap check. */
|
|
184
|
+
beforeConfigSaved?: () => void;
|
|
181
185
|
}
|
|
182
186
|
/** Gateway/CLI control-plane actions declared by extension manifests. */
|
|
183
187
|
export interface ChannelRuntimeActionAdapter {
|
|
@@ -2,21 +2,27 @@
|
|
|
2
2
|
const verified = /* @__PURE__ */ new WeakMap();
|
|
3
3
|
/** Only channel lifecycle code gives a plugin access to this ingress. Ordinary bus publishers cannot mark a message. */
|
|
4
4
|
function verifiedChannelBus(bus, channel) {
|
|
5
|
+
function verify(message, acceptedAt = Date.now()) {
|
|
6
|
+
const meta = message.metadata;
|
|
7
|
+
if (message.channel === channel && channel !== "system" && channel !== "webchat" && channel !== "cli" && typeof meta?.accountId === "string" && typeof meta.messageId === "string" && meta.messageId.length > 0 && typeof meta.isGroup === "boolean" && !meta.isCommand && !meta.isReaction && message.chat_id && message.sender_id) verified.set(message, {
|
|
8
|
+
subject: {
|
|
9
|
+
kind: "channel",
|
|
10
|
+
channel,
|
|
11
|
+
accountId: meta.accountId,
|
|
12
|
+
chatId: message.chat_id,
|
|
13
|
+
senderId: message.sender_id,
|
|
14
|
+
...typeof meta.threadId === "string" && meta.threadId ? { threadId: meta.threadId } : {}
|
|
15
|
+
},
|
|
16
|
+
acceptedAt
|
|
17
|
+
});
|
|
18
|
+
}
|
|
5
19
|
return new Proxy(bus, { get(target, property) {
|
|
6
|
-
if (property === "publishInbound") return (message) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
accountId: meta.accountId,
|
|
13
|
-
chatId: message.chat_id,
|
|
14
|
-
senderId: message.sender_id,
|
|
15
|
-
...typeof meta.threadId === "string" && meta.threadId ? { threadId: meta.threadId } : {}
|
|
16
|
-
},
|
|
17
|
-
acceptedAt: Date.now()
|
|
18
|
-
});
|
|
19
|
-
return target.publishInbound(message);
|
|
20
|
+
if (property === "publishInbound") return (message, delivery) => {
|
|
21
|
+
verify(message);
|
|
22
|
+
return target.publishInbound(message, message.channel === channel ? delivery : void 0, verify);
|
|
23
|
+
};
|
|
24
|
+
if (property === "restoreDurableInbound") return (requestedChannel, scope) => {
|
|
25
|
+
if (requestedChannel === channel) target.restoreDurableInbound(channel, scope, verify);
|
|
20
26
|
};
|
|
21
27
|
const value = Reflect.get(target, property, target);
|
|
22
28
|
return typeof value === "function" ? value.bind(target) : value;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { init_paths, resolveConfigPath } from "../../../config/paths.js";
|
|
2
2
|
import { loadConfig } from "../../../config/loader.js";
|
|
3
3
|
import "../../../config/index.js";
|
|
4
|
-
import { resolveGatewayService } from "../../../daemon/service.js";
|
|
5
4
|
import { isRestartEnabled } from "../../../config/commands.flags.js";
|
|
6
|
-
import {
|
|
5
|
+
import { resolveGatewayService } from "../../../daemon/service.js";
|
|
7
6
|
import { authorizeGatewaySigusr1Restart, writeGatewayRestartIntentSync } from "../../../infra/restart.js";
|
|
7
|
+
import { findVerifiedGatewayListenerPidsOnPortSync, formatGatewayPidList, signalVerifiedGatewayPidSync } from "../../../infra/gateway-processes.js";
|
|
8
8
|
import { runServiceRestart, runServiceStop } from "./lifecycle-core.js";
|
|
9
9
|
import { DEFAULT_RESTART_HEALTH_ATTEMPTS, renderGatewayPortHealthDiagnostics, waitForGatewayHealthyListener } from "./restart-health.js";
|
|
10
10
|
import { parsePortFromArgs, renderGatewayServiceStartHints, resolveGatewayPortFromConfig } from "./shared.js";
|
|
@@ -2,9 +2,9 @@ import { PACKAGE_VERSION, init_package_version } from "../../package-version.js"
|
|
|
2
2
|
import { loadConfig } from "../../config/loader.js";
|
|
3
3
|
import { formatExamples, register } from "../registry.js";
|
|
4
4
|
import "../../config/index.js";
|
|
5
|
+
import { acquireUpdateLock } from "../../infra/update-lock.js";
|
|
5
6
|
import { normalizeUpdateChannel } from "../../infra/update-channels.js";
|
|
6
7
|
import { compareSemver, resolveNpmChannelTag } from "../../infra/update-check.js";
|
|
7
|
-
import { acquireUpdateLock } from "../../infra/update-lock.js";
|
|
8
8
|
import { formatUpdateApiResult, resolveUpdateInstallSurface, runGatewayUpdateWithPostSteps } from "../../infra/update-runner.js";
|
|
9
9
|
import { Command } from "commander";
|
|
10
10
|
//#region src/cli/commands/update.ts
|
|
@@ -1403,8 +1403,8 @@ export declare const ConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
1403
1403
|
preferences: z.ZodDefault<z.ZodObject<{
|
|
1404
1404
|
responseLanguage: z.ZodDefault<z.ZodEnum<{
|
|
1405
1405
|
en: "en";
|
|
1406
|
-
auto: "auto";
|
|
1407
1406
|
"zh-CN": "zh-CN";
|
|
1407
|
+
auto: "auto";
|
|
1408
1408
|
}>>;
|
|
1409
1409
|
}, z.core.$strict>>;
|
|
1410
1410
|
userModel: z.ZodDefault<z.ZodObject<{
|
|
@@ -227,7 +227,7 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
227
227
|
};
|
|
228
228
|
userContext: {
|
|
229
229
|
preferences: {
|
|
230
|
-
responseLanguage: "en" | "
|
|
230
|
+
responseLanguage: "en" | "zh-CN" | "auto";
|
|
231
231
|
};
|
|
232
232
|
userModel: {
|
|
233
233
|
enabled: boolean;
|
|
@@ -8,9 +8,9 @@ import "../../rate-limit/index.js";
|
|
|
8
8
|
import { authenticateDeviceAccessToken, getDevice } from "../../../storage/sqlite/device-access-repository.js";
|
|
9
9
|
import { getOrCreateGatewayIdentity } from "../../../storage/sqlite/gateway-identity-repository.js";
|
|
10
10
|
import { getDesktopExecutionGrant } from "../../../storage/sqlite/desktop-execution-repository.js";
|
|
11
|
-
import { PROOF_HEADER, acquireProofBodyBudget, consumeRequestNonce, parseRequestProof, proofDigest, requestProofMessage, verifyRequestProofSignature } from "../../security/device-request-proof.js";
|
|
12
11
|
import { safeEqualSecret } from "../../security/secret-equal.js";
|
|
13
12
|
import { resolveClientIpFromRequest } from "../../client-ip.js";
|
|
13
|
+
import { PROOF_HEADER, acquireProofBodyBudget, consumeRequestNonce, parseRequestProof, proofDigest, requestProofMessage, verifyRequestProofSignature } from "../../security/device-request-proof.js";
|
|
14
14
|
import { authenticateBrowserSession } from "../../../storage/sqlite/browser-session-repository.js";
|
|
15
15
|
import { isChromeExtensionOrigin } from "../../security/origin-check.js";
|
|
16
16
|
import { browserCookieRequestAllowed, readBrowserSessionCookie, writeBrowserSessionCookie } from "../../security/browser-session.js";
|
|
@@ -99,8 +99,9 @@ function registerChannelRoutes(authenticated, deps) {
|
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
if (plugin.runtimeActions) {
|
|
102
|
+
const currentConfig = service.currentConfig;
|
|
102
103
|
const result = await plugin.runtimeActions.runAction({
|
|
103
|
-
cfg:
|
|
104
|
+
cfg: currentConfig,
|
|
104
105
|
locale: localeFromRequest(c),
|
|
105
106
|
actionId: action,
|
|
106
107
|
accountId,
|
|
@@ -113,19 +114,31 @@ function registerChannelRoutes(authenticated, deps) {
|
|
|
113
114
|
message: result.message ?? "Channel action failed"
|
|
114
115
|
}
|
|
115
116
|
}, 400);
|
|
117
|
+
let payload = result.payload;
|
|
116
118
|
if (result.nextConfig) {
|
|
117
|
-
const saved = await service.saveConfig(result.nextConfig);
|
|
118
|
-
if (!saved.saved)
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
119
|
+
const saved = await service.saveConfig(result.nextConfig, currentConfig, result.beforeConfigSaved);
|
|
120
|
+
if (!saved.saved) {
|
|
121
|
+
if (saved.conflict) return c.json({
|
|
122
|
+
ok: false,
|
|
123
|
+
error: {
|
|
124
|
+
code: "CHANNEL_CONFIG_CHANGED",
|
|
125
|
+
message: "Channel settings changed. Reload and retry."
|
|
126
|
+
}
|
|
127
|
+
}, 409);
|
|
128
|
+
return c.json({
|
|
129
|
+
ok: false,
|
|
130
|
+
error: {
|
|
131
|
+
code: "CHANNEL_ACTION_FAILED",
|
|
132
|
+
message: saved.error ?? "Failed to save channel config"
|
|
133
|
+
}
|
|
134
|
+
}, 500);
|
|
135
|
+
}
|
|
136
|
+
const afterSave = await result.onConfigSaved?.();
|
|
137
|
+
if (afterSave) payload = afterSave;
|
|
125
138
|
} else if (actionPayloadChangedConfig(result.payload)) await service.reloadConfig();
|
|
126
139
|
return c.json({
|
|
127
140
|
ok: true,
|
|
128
|
-
payload:
|
|
141
|
+
payload: payload ?? {}
|
|
129
142
|
});
|
|
130
143
|
}
|
|
131
144
|
return c.json({
|