@xopcai/xopc 0.0.426 → 0.0.427
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/telegram/src/adapters/security-adapter.js +1 -1
- package/dist/extensions/telegram/src/pairing-config-resolver.js +1 -1
- package/dist/extensions/telegram/src/plugin.js +2 -2
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/api/api.js +1 -1
- package/dist/extensions/weixin/src/auth/accounts.js +2 -2
- package/dist/extensions/weixin/src/auth/pairing.js +1 -1
- package/dist/extensions/weixin/src/cdn/upload.js +1 -1
- package/dist/extensions/weixin/src/cli/gateway-qr-login.js +1 -1
- package/dist/extensions/weixin/src/cli/qr-login.js +1 -1
- package/dist/extensions/weixin/src/messaging/debug-mode.js +1 -1
- package/dist/extensions/weixin/src/messaging/inbound.js +2 -2
- package/dist/extensions/weixin/src/messaging/process-message.js +3 -3
- package/dist/extensions/weixin/src/messaging/send.js +12 -3
- package/dist/extensions/weixin/src/monitor/monitor.js +1 -1
- package/dist/extensions/weixin/src/outbound-send.js +12 -3
- package/dist/extensions/weixin/src/pairing-config-resolver.js +1 -1
- package/dist/extensions/weixin/src/plugin.js +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D4ClP_DJ.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-m1A8wF9p.js +1 -0
- package/dist/gateway/static/root/assets/agents-B9slUA_1.js +77 -0
- package/dist/gateway/static/root/assets/app-link-DRy3-k7j.js +1 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-C8yc3yHG.js → app-management-settings-panel-XqoIBF2H.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BELgtR3O.js → appearance-settings-9ZtqCASo.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-DUeu_7iC.js +1 -0
- package/dist/gateway/static/root/assets/attachment-load-DrVGNxJm.js +1 -0
- package/dist/gateway/static/root/assets/automation-task-card-Bur78p68.js +3 -0
- package/dist/gateway/static/root/assets/{automations-page-CdIPdwF0.js → automations-page-DMIyWsP0.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-DEkDjxeU.js +9 -0
- package/dist/gateway/static/root/assets/{block-editor-BQtTLe6Q.js → block-editor-CXdlNAmZ.js} +2 -2
- package/dist/gateway/static/root/assets/{browser-automation-inputs-DeraGZ1y.js → browser-automation-inputs-Fxo7HbK6.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-SpPzRNqU.js → browser-automations-page-Dn3LN5wo.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-Cpm9fEPV.js +3 -0
- package/dist/gateway/static/root/assets/{button-CnRSIP6m.js → button-Cc4hUNTt.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-DLMuj21P.js → capabilities-BEvywfF9.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-Bo2qEJhH.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-page-BCzsIzvC.js +2 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Cr67ziwX.js +8 -0
- package/dist/gateway/static/root/assets/{capability-header-actions-CTUCuBlW.js → capability-header-actions-BxMYfQ8y.js} +1 -1
- package/dist/gateway/static/root/assets/channels-CA5z5dGY.js +1 -0
- package/dist/gateway/static/root/assets/{chat-chart-block-DCzUECct.js → chat-chart-block-B39npsXj.js} +1 -1
- package/dist/gateway/static/root/assets/chat-page-D92AWJbh.js +72 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Dl-OTkJI.js → chat-terminal-dock-DjFnElAM.js} +2 -2
- package/dist/gateway/static/root/assets/composer-payload-handoff-BQXlFKf4.js +1 -0
- package/dist/gateway/static/root/assets/{computer-settings-page-B-lGMimW.js → computer-settings-page-MkqyKyf3.js} +1 -1
- package/dist/gateway/static/root/assets/confirm-dialog-D7dQJytv.js +1 -0
- package/dist/gateway/static/root/assets/connected-providers-grid-BSvKP2u-.js +1 -0
- package/dist/gateway/static/root/assets/{connector-service-page-C8InhrMt.js → connector-service-page-DlIl9bLx.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-Vx8-MY0Y.js +1 -0
- package/dist/gateway/static/root/assets/{copy-text-row-CYIv7RfP.js → copy-text-row-CpiRzq4G.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-kqic8j73.js → date-picker-BIfjfOTM.js} +1 -1
- package/dist/gateway/static/root/assets/dependency-picker-XjPB8FJS.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BDS7_tQ_.js → desktop-pet-settings-BDjsFown.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-DH_uJ698.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-Di0h3ws4.js → directory-picker-path-field-DiZXY7jF.js} +1 -1
- package/dist/gateway/static/root/assets/{discussion-annotation-sync-ClKEyXmN.js → discussion-annotation-sync-BXqNuZnx.js} +1 -1
- package/dist/gateway/static/root/assets/dist-BGTk37IG.js +1 -0
- package/dist/gateway/static/root/assets/dist-BuHnPloF.js +1 -0
- package/dist/gateway/static/root/assets/dist-GJ8-1PAx.js +1 -0
- package/dist/gateway/static/root/assets/dist-ZrL34Ps4.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DwB5KMGk.js → extension-debug-page-myQqsol2.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-iframe-host-Cqg1K70e.js → extension-iframe-host-DaL-OcTw.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DyrQtG82.js → extension-page-DvlGhZLa.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-C_uKqJxP.js → extension-provider-fOi6V6Cr.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BAMQHzkX.js → extension-settings-page-DOGlQpkx.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-uAboiElC.js → gateway-settings-Di41peSM.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-B3sgqrl3.js +2 -0
- package/dist/gateway/static/root/assets/{image-generation-api-CQxZSTWA.js → image-generation-api-Ce-IY7Ug.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-C90644id.js → imports-page-W7_cDbxy.js} +1 -1
- package/dist/gateway/static/root/assets/index-D4B6O8B3.js +11 -0
- package/dist/gateway/static/root/assets/index-DGWBJDAM.css +1 -0
- package/dist/gateway/static/root/assets/install-connector-dialog-DWVl9ekV.js +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CbeubKe1.js → keyboard-shortcuts-settings-Doyu0Q9e.js} +1 -1
- package/dist/gateway/static/root/assets/link-2-D_ZKYUW7.js +1 -0
- package/dist/gateway/static/root/assets/local-app-workbench-page-B3h3P6aI.js +1 -0
- package/dist/gateway/static/root/assets/{local-apps-page-C6zFgwkr.js → local-apps-page-D6D2bZGW.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-CpVCvAWE.js → logs-page-qiXos_12.js} +2 -2
- package/dist/gateway/static/root/assets/management-settings-C0WcSdK7.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-DrVAMlwc.js → markdown-view-Ck5s16p9.js} +2 -2
- package/dist/gateway/static/root/assets/mcp-conversation-setup-page-CENs3hGU.js +1 -0
- package/dist/gateway/static/root/assets/model-selector-DCBmsHzj.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-CnuxqWMd.js +5 -0
- package/dist/gateway/static/root/assets/note-image-lightbox-BFKZ7qJr.js +1 -0
- package/dist/gateway/static/root/assets/{notes-api-CUlhTRv0.js → notes-api-8kp0X1x6.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-eoKX85K5.js → notes-page-XMdy-H3H.js} +1 -1
- package/dist/gateway/static/root/assets/{oauth-provider-connect-C8BXow79.js → oauth-provider-connect-CfOK8mPM.js} +1 -1
- package/dist/gateway/static/root/assets/{page-context-capture-button-CBFK41OS.js → page-context-capture-button-CKlKWSJ7.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-CIMMSI25.js +1 -0
- package/dist/gateway/static/root/assets/{personal-settings-panel-DnYapLo7.js → personal-settings-panel-wKdlrfPq.js} +1 -1
- package/dist/gateway/static/root/assets/{phone-dependencies-card-DBiKtzwz.js → phone-dependencies-card-CDhk5277.js} +1 -1
- package/dist/gateway/static/root/assets/phone-model-connection-DZ-ZunPz.js +1 -0
- package/dist/gateway/static/root/assets/{phone-model-picker-BmSxEr7M.js → phone-model-picker-DuZc5jYO.js} +1 -1
- package/dist/gateway/static/root/assets/phone-settings-page-0u0GQl_R.js +1 -0
- package/dist/gateway/static/root/assets/plugin-details-dialog-Bfc-Wmrd.js +1 -0
- package/dist/gateway/static/root/assets/{popover-select-DD8fmrxH.js → popover-select-CEMWIrtY.js} +1 -1
- package/dist/gateway/static/root/assets/{preference-select-fields-Cu_ZC9Up.js → preference-select-fields-BKeHZLXZ.js} +1 -1
- package/dist/gateway/static/root/assets/{product-automation-feedback-Tn2dUJWM.js → product-automation-feedback-BPur0vyo.js} +2 -2
- package/dist/gateway/static/root/assets/{product-open-page-Nf-Oqf1h.js → product-open-page-Bfd7R483.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-D6NwUm3A.js → product-preview-content-Bnq68oVw.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-modal-BfNcGgXA.js → product-preview-modal-BPmTeweh.js} +2 -2
- package/dist/gateway/static/root/assets/project-detail-page-D9nnyvrI.js +7 -0
- package/dist/gateway/static/root/assets/{project-understanding-B1BK7Ixi.js → project-understanding-DLvxAoTT.js} +1 -1
- package/dist/gateway/static/root/assets/projects-page-BGy1pw9a.js +1 -0
- package/dist/gateway/static/root/assets/{recording-upload-RAhaLUcQ.js → recording-upload-CHFJbqW1.js} +1 -1
- package/dist/gateway/static/root/assets/{refresh-button-bU_0NarN.js → refresh-button-DiWdGAaX.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-DWsOWetc.js → remote-access-hub-BVqwnOqO.js} +1 -1
- package/dist/gateway/static/root/assets/route-preload-DI43HQV_.js +2 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BGiXeHF5.js → runtime-tools-settings-panel-ccVBG-bZ.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-BKeP5G7b.js → schema-form-C-jw6Hid.js} +1 -1
- package/dist/gateway/static/root/assets/{secret-input-BQvFXqzz.js → secret-input-Dryrns2s.js} +1 -1
- package/dist/gateway/static/root/assets/{service-recommendation-list-BEnNx0u7.js → service-recommendation-list-CNghOavt.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-Bnq3qpqy.js +23 -0
- package/dist/gateway/static/root/assets/sessions-page-CyBj1Xw2.js +1 -0
- package/dist/gateway/static/root/assets/{settings-advanced-section-CURRjsLK.js → settings-advanced-section-DwpPPxT0.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-GtsbT6as.js → settings-page-Cd8Ermnn.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-header-DBL0_u0Z.js → settings-page-header-BZl4AMiN.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-IAvpbz4A.js → settings-page-layout-onhEgq-K.js} +1 -1
- package/dist/gateway/static/root/assets/setup-interaction-page-Cvvj6JyV.js +1 -0
- package/dist/gateway/static/root/assets/setup-status-panel-D4qgE7QM.js +1 -0
- package/dist/gateway/static/root/assets/share-link-dialog-DA0QuFOD.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-L9KYu8M7.js → share-preview-page-YDpIY4dC.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DUvjOMmA.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-ClyNSh-7.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-CsvcFoaJ.js → system-settings-panel-BN6sUX0H.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-CS9m7Ipo.js +2 -0
- package/dist/gateway/static/root/assets/{task-result-evidence-B8xUiwW3.js → task-result-evidence-DKygspo2.js} +1 -1
- package/dist/gateway/static/root/assets/tracing-settings-page-Bs76WeoF.js +1 -0
- package/dist/gateway/static/root/assets/{tunnel-api-BB7u79ID.js → tunnel-api-B7nx0NQJ.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-Cv4Je5XJ.js → usage-page-anU5gslJ.js} +1 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-DYY3Yz4a.js +2 -0
- package/dist/gateway/static/root/assets/use-file-preview-expanded-CYgWzDnv.js +2 -0
- package/dist/gateway/static/root/assets/{use-workspace-tree-BQEiJzK7.js → use-workspace-tree-Dkg9tUr4.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-DIgPL3tN.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-DCM69u8Y.js → voice-api-key-field-BUes-Jlp.js} +1 -1
- package/dist/gateway/static/root/assets/voice-transcribe-api-Dy4hfftb.js +1 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CVe9UmFl.js → work-discovery-overlay-CFF4cRFl.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-page-CtqkRMN5.js → work-discovery-page-BnYaVH3V.js} +1 -1
- package/dist/gateway/static/root/assets/working-directory-picker-modal-GFwVefVA.js +1 -0
- package/dist/gateway/static/root/assets/{workspace-api-tbifz2zY.js → workspace-api-BdB4NEOh.js} +2 -2
- package/dist/gateway/static/root/assets/{workspace-file-preview-dialog-BubQwQwU.js → workspace-file-preview-dialog-NRL3YRjg.js} +1 -1
- package/dist/gateway/static/root/assets/{workspace-open-location-menu-DZk3MBSa.js → workspace-open-location-menu-Dcij7wvJ.js} +1 -1
- package/dist/gateway/static/root/assets/{xopc-cloud-account-card-CIavPUr3.js → xopc-cloud-account-card-DC9aG7Pl.js} +1 -1
- package/dist/gateway/static/root/index.html +66 -64
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/automations.js +7 -0
- package/dist/packages/gateway-contract/src/capabilities.js +1 -1
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +1 -0
- package/dist/src/agent/child-agent-factory.js +1 -1
- package/dist/src/agent/data-acquisition/service.js +1 -1
- package/dist/src/agent/embedded/configuration-capability-correction.d.ts +3 -0
- package/dist/src/agent/embedded/configuration-capability-correction.js +14 -0
- package/dist/src/agent/embedded/run-for-session.js +20 -5
- package/dist/src/agent/embedded/run-turn.js +13 -1
- package/dist/src/agent/embedded/session-runner.js +6 -3
- package/dist/src/agent/image/generation/openai-images-provider.js +1 -1
- package/dist/src/agent/image/load-image-media.js +1 -1
- package/dist/src/agent/inbound/inbound-loop.js +4 -1
- package/dist/src/agent/independent-execution.js +1 -1
- package/dist/src/agent/mcp/config.js +1 -1
- package/dist/src/agent/mcp/connection-drafts.d.ts +3 -1
- package/dist/src/agent/mcp/connection-drafts.js +3 -2
- package/dist/src/agent/mcp/connection-setup.js +34 -2
- package/dist/src/agent/mcp/conversation-setup.d.ts +163 -0
- package/dist/src/agent/mcp/conversation-setup.js +621 -0
- package/dist/src/agent/mcp/native-mcp.d.ts +1 -0
- package/dist/src/agent/mcp/tool-catalog.d.ts +5 -0
- package/dist/src/agent/mcp/tool-catalog.js +19 -2
- package/dist/src/agent/mcp/weixin-setup-scope.d.ts +12 -0
- package/dist/src/agent/mcp/weixin-setup-scope.js +43 -0
- package/dist/src/agent/prompt/conversational-configuration-guide.js +2 -1
- package/dist/src/agent/prompt/sections/tooling.js +3 -2
- package/dist/src/agent/prompt/service-prompt-builder.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +1 -1
- package/dist/src/agent/service/process-direct-streaming.js +2 -2
- package/dist/src/agent/service.d.ts +2 -0
- package/dist/src/agent/service.js +11 -1
- package/dist/src/agent/service.types.d.ts +1 -0
- package/dist/src/agent/tasks/task-judge-service.js +2 -2
- package/dist/src/agent/tool-manuals/xopc-configuration.d.ts +6 -4
- package/dist/src/agent/tool-manuals/xopc-configuration.js +92 -8
- package/dist/src/agent/tools/automation-tool.d.ts +9 -1
- package/dist/src/agent/tools/automation-tool.js +34 -5
- package/dist/src/agent/tools/create-share-tool.js +1 -1
- package/dist/src/agent/tools/factory.d.ts +3 -0
- package/dist/src/agent/tools/factory.js +34 -23
- package/dist/src/agent/tools/image-generate-tool.js +3 -3
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +5 -4
- package/dist/src/agent/tools/mcp-setup-tool.d.ts +9 -0
- package/dist/src/agent/tools/mcp-setup-tool.js +32 -0
- package/dist/src/agent/tools/personal-task-tool.js +2 -2
- package/dist/src/agent/tools/publish-artifacts.js +1 -1
- package/dist/src/agent/tools/read.js +1 -1
- package/dist/src/agent/tools/skill-install-tool.js +56 -1
- package/dist/src/agent/tools/skill-manage-tool.d.ts +4 -0
- package/dist/src/agent/tools/skill-manage-tool.js +74 -2
- package/dist/src/agent/tools/skills-tools.js +1 -1
- package/dist/src/agent/tools/task-collaboration-tool.js +1 -1
- package/dist/src/agent/tools/tool-manual-tool.d.ts +1 -1
- package/dist/src/agent/tools/tool-manual-tool.js +3 -1
- package/dist/src/agent/tools/toolExposure.js +2 -0
- package/dist/src/agent/tools/write.js +1 -1
- package/dist/src/agent/tools/xopc-use-tool.d.ts +4 -2
- package/dist/src/agent/tools/xopc-use-tool.js +60 -10
- package/dist/src/agent-catalog/service.d.ts +1 -1
- package/dist/src/agent-catalog/service.js +2 -1
- package/dist/src/automations/capabilities/drafts.js +5 -2
- package/dist/src/automations/capabilities/read.js +18 -7
- package/dist/src/automations/capabilities/write.d.ts +111 -52
- package/dist/src/automations/capabilities/write.js +44 -10
- package/dist/src/automations/delivery/delivery-router.d.ts +1 -0
- package/dist/src/automations/delivery/delivery-router.js +7 -1
- package/dist/src/automations/domain/types.d.ts +8 -0
- package/dist/src/automations/domain/validation.d.ts +24 -0
- package/dist/src/automations/domain/validation.js +7 -0
- package/dist/src/automations/draft/automation-draft-validator.d.ts +6 -0
- package/dist/src/automations/index.js +2 -2
- package/dist/src/automations/mcp-source.d.ts +60 -0
- package/dist/src/automations/mcp-source.js +173 -0
- package/dist/src/automations/service/action-executor.js +15 -1
- package/dist/src/automations/service/automation-service.d.ts +5 -0
- package/dist/src/automations/service/automation-service.js +52 -2
- package/dist/src/automations/service/index.js +2 -2
- package/dist/src/browser/setup/repository.d.ts +1 -0
- package/dist/src/browser/setup/repository.js +7 -1
- package/dist/src/browser/setup/service.d.ts +3 -0
- package/dist/src/browser/setup/service.js +41 -18
- package/dist/src/browser/setup/types.d.ts +1 -0
- package/dist/src/channels/attachments/voice-stt-webchat.js +1 -1
- package/dist/src/channels/index.js +1 -1
- package/dist/src/channels/manager.d.ts +1 -0
- package/dist/src/channels/outbound-sender.d.ts +1 -0
- package/dist/src/channels/outbound-sender.js +3 -0
- package/dist/src/channels/pairing/pairing-service.js +1 -1
- package/dist/src/channels/weixin/account-identity.d.ts +2 -0
- package/dist/src/channels/weixin/account-identity.js +15 -0
- package/dist/src/chat-commands/builtins/config.js +1 -1
- package/dist/src/cli/commands/channels.js +2 -2
- package/dist/src/cli/commands/doctor/checks/channel-pairing-pending.js +1 -1
- package/dist/src/cli/commands/mcp.js +1 -1
- package/dist/src/extensions/agent-plugins/credentials.js +1 -1
- package/dist/src/extensions/agent-plugins/setup.d.ts +1 -1
- package/dist/src/extensions/agent-plugins/setup.js +3 -3
- package/dist/src/extensions/api.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/device-routes.js +1 -1
- package/dist/src/gateway/hono/app.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/oauth-async.js +1 -1
- package/dist/src/gateway/hono/routes/channels.js +1 -1
- package/dist/src/gateway/hono/routes/config.js +1 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -1
- package/dist/src/gateway/hono/routes/mcp.js +39 -2
- package/dist/src/gateway/hono/routes/notes.js +2 -2
- package/dist/src/gateway/hono/routes/phone-setup.js +33 -9
- package/dist/src/gateway/hono/routes/projects.js +1 -1
- package/dist/src/gateway/hono/routes/provider-setup.js +1 -1
- package/dist/src/gateway/hono/routes/public-gateway.js +22 -0
- package/dist/src/gateway/hono/routes/session-input-handler.js +1 -1
- package/dist/src/gateway/hono/routes/shares.js +1 -1
- package/dist/src/gateway/hono/routes/site-shares.js +1 -1
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/media-access.js +1 -1
- package/dist/src/gateway/service/agent-runner.d.ts +1 -0
- package/dist/src/gateway/service/agent-runner.js +3 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +1 -1
- package/dist/src/gateway/service/config-coordinator.js +2 -1
- package/dist/src/gateway/service/run-gateway-agent.js +1 -1
- package/dist/src/gateway/service/sessions-api.js +2 -1
- package/dist/src/gateway/service.d.ts +5 -1
- package/dist/src/gateway/service.js +90 -16
- package/dist/src/gateway/session-context-summary.js +1 -1
- package/dist/src/gateway/session-reset-service.d.ts +1 -0
- package/dist/src/gateway/session-reset-service.js +15 -2
- package/dist/src/home-intelligence/host.js +2 -2
- package/dist/src/notes/service.js +1 -1
- package/dist/src/personal-agent/prompts.js +1 -1
- package/dist/src/personal-agent/reply-composer.js +2 -2
- package/dist/src/personal-agent/request-service.js +3 -3
- package/dist/src/personal-agent/service.js +1 -1
- package/dist/src/personal-agent/task-cancel.js +1 -1
- package/dist/src/phone/setup/service.d.ts +14 -4
- package/dist/src/phone/setup/service.js +106 -28
- package/dist/src/projects/index.js +1 -1
- package/dist/src/projects/project-service.js +1 -1
- package/dist/src/runtime-tools/phone-dependencies.d.ts +2 -0
- package/dist/src/runtime-tools/phone-dependencies.js +10 -0
- package/dist/src/share/note-share-service.js +1 -1
- package/dist/src/share/site-proxy.js +1 -1
- package/dist/src/tasks/capabilities/write.js +1 -1
- package/dist/src/tasks/index.js +1 -1
- package/dist/src/tasks/task-allocation-service.js +3 -3
- package/dist/src/tasks/task-application-service.js +2 -2
- package/dist/src/tasks/task-context-assembler.js +1 -1
- package/dist/src/tasks/task-contract-planner.js +1 -1
- package/dist/src/tasks/task-handoff.js +1 -1
- package/dist/src/tasks/task-research-result.js +1 -1
- package/dist/src/tasks/task-run-coordinator.js +2 -2
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/package.json +3 -1
- package/skills/tools/configure-xopc/SKILL.md +10 -3
- package/skills/tools/configure-xopc/references/browser/chrome-extension.md +4 -1
- package/skills/tools/configure-xopc/references/browser/overview.md +2 -2
- package/skills/tools/configure-xopc/references/phone/aliyun.md +3 -2
- package/skills/tools/configure-xopc/references/phone/overview.md +2 -2
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-Dne9A10p.js +0 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-BoHL-b1o.js +0 -1
- package/dist/gateway/static/root/assets/agents-CIiIlVBp.js +0 -77
- package/dist/gateway/static/root/assets/app-link-1j40sJ-z.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-vgS1CHDj.js +0 -1
- package/dist/gateway/static/root/assets/attachment-load-qjPpQzYY.js +0 -1
- package/dist/gateway/static/root/assets/automation-task-card-MnzgyTVA.js +0 -3
- package/dist/gateway/static/root/assets/automations-workspace-C3xZLafX.js +0 -9
- package/dist/gateway/static/root/assets/browser-settings-page-BD1uF_Nb.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-BGE6hiUE.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-page-Bda4mSdf.js +0 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-B2B7no22.js +0 -8
- package/dist/gateway/static/root/assets/channels-NtsjZThx.js +0 -1
- package/dist/gateway/static/root/assets/chat-page-BnOCCAXG.js +0 -72
- package/dist/gateway/static/root/assets/composer-payload-handoff-CQc-VTaL.js +0 -1
- package/dist/gateway/static/root/assets/confirm-dialog-XGclfBqe.js +0 -1
- package/dist/gateway/static/root/assets/connected-providers-grid-CcXe9kz5.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-Ci0L2How.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-cbC6-2Ya.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-_3BJFWVQ.js +0 -1
- package/dist/gateway/static/root/assets/dist-CaUuvp8-.js +0 -1
- package/dist/gateway/static/root/assets/dist-D3lWNSe7.js +0 -1
- package/dist/gateway/static/root/assets/dist-DfWfZ9iu.js +0 -1
- package/dist/gateway/static/root/assets/dist-DusecO_p.js +0 -1
- package/dist/gateway/static/root/assets/home-page-D6pCBY1V.js +0 -2
- package/dist/gateway/static/root/assets/index-Cc41XQid.css +0 -1
- package/dist/gateway/static/root/assets/index-CnOYR6jq.js +0 -11
- package/dist/gateway/static/root/assets/install-connector-dialog-BuNXON0P.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CP-BkbB6.js +0 -1
- package/dist/gateway/static/root/assets/management-settings-I-pXv4ML.js +0 -1
- package/dist/gateway/static/root/assets/model-selector-CXcxc30J.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-CbpLXAVh.js +0 -5
- package/dist/gateway/static/root/assets/note-image-lightbox-cLGiF8oU.js +0 -1
- package/dist/gateway/static/root/assets/personal-page-CXR1Gy0x.js +0 -1
- package/dist/gateway/static/root/assets/phone-settings-page-vg65qilc.js +0 -1
- package/dist/gateway/static/root/assets/plugin-details-dialog-B3Hn2cbx.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-Ch-ZMyTu.js +0 -7
- package/dist/gateway/static/root/assets/projects-page-B7cetxao.js +0 -1
- package/dist/gateway/static/root/assets/route-preload-Zc5Z3fNv.js +0 -2
- package/dist/gateway/static/root/assets/session-manager-ChUtTAoG.js +0 -23
- package/dist/gateway/static/root/assets/sessions-page-Bt52kBvJ.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-A6uMpGRy.js +0 -1
- package/dist/gateway/static/root/assets/share-link-dialog-D1otGSXD.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-Bmfadz8A.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BZklXTX9.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-SjZGW1Dx.js +0 -2
- package/dist/gateway/static/root/assets/tracing-settings-page-MvG4SH64.js +0 -1
- package/dist/gateway/static/root/assets/use-composer-attachments-vDdxHtUb.js +0 -2
- package/dist/gateway/static/root/assets/use-file-preview-expanded-Ce2mgYme.js +0 -2
- package/dist/gateway/static/root/assets/user-model-page-DRSsn4EV.js +0 -2
- package/dist/gateway/static/root/assets/voice-transcribe-api-Bbyj0yGR.js +0 -1
- package/dist/gateway/static/root/assets/working-directory-picker-modal-CDZ1xh3o.js +0 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { getBrowserTabBinding } from "../../storage/sqlite/browser-tab-binding-repository.js";
|
|
4
|
+
import { getSessionMetadata, init_session_read_repository } from "../../storage/sqlite/session-read-repository.js";
|
|
4
5
|
import "../../../packages/browser-control-contract/src/index.js";
|
|
5
|
-
import { createBrowserSetup, findBrowserSetup, readBrowserSetup, saveBrowserSetup } from "./repository.js";
|
|
6
|
+
import { createBrowserSetup, findBrowserSetup, listConversationBrowserSetups, readBrowserSetup, saveBrowserSetup } from "./repository.js";
|
|
6
7
|
import { createHash, randomUUID } from "node:crypto";
|
|
7
8
|
//#region src/browser/setup/service.ts
|
|
9
|
+
init_session_read_repository();
|
|
8
10
|
init_logger();
|
|
9
11
|
const log = createLogger("BrowserSetup");
|
|
10
12
|
const VERSION = "1";
|
|
@@ -20,9 +22,21 @@ const browserConfigRevision = (config) => createHash("sha256").update(JSON.strin
|
|
|
20
22
|
/** Setup writes use host-authorized interactive turns or existing owner grants. */
|
|
21
23
|
var BrowserSetupService = class {
|
|
22
24
|
preparing = /* @__PURE__ */ new Set();
|
|
25
|
+
preparationSettled = /* @__PURE__ */ new Map();
|
|
23
26
|
constructor(deps) {
|
|
24
27
|
this.deps = deps;
|
|
25
28
|
}
|
|
29
|
+
scopeCurrent(setup) {
|
|
30
|
+
const metadata = getSessionMetadata(setup.conversationId);
|
|
31
|
+
return setup.transcriptId ? metadata?.transcriptId === setup.transcriptId && metadata.agentId === setup.agentId : !metadata;
|
|
32
|
+
}
|
|
33
|
+
async cancelConversation(conversationId) {
|
|
34
|
+
const setups = listConversationBrowserSetups(conversationId).map((setup) => this.cancel(setup));
|
|
35
|
+
await Promise.all(setups.map(async (setup) => {
|
|
36
|
+
await this.preparationSettled.get(setup.id);
|
|
37
|
+
await this.release(readBrowserSetup(setup.id));
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
26
40
|
policyRevision(agentId) {
|
|
27
41
|
return this.deps.policyRevision?.(agentId) ?? String(this.deps.canUseBrowser(agentId));
|
|
28
42
|
}
|
|
@@ -47,13 +61,14 @@ var BrowserSetupService = class {
|
|
|
47
61
|
};
|
|
48
62
|
const attempt = setup.attempt ? (({ observation: _observation, ...summary }) => summary)(setup.attempt) : void 0;
|
|
49
63
|
const endpoint = setup.attempt ? this.endpoints().find((e) => e.endpointId === setup.attempt.endpointId) : void 0;
|
|
50
|
-
const changed = setup.configRevision !== browserConfigRevision(this.deps.getConfig()) || Boolean(setup.attempt && (setup.attempt.policyRevision !== this.policyRevision(setup.agentId) || !this.deps.canUseBrowser(setup.agentId) || endpoint && (endpoint.principalId !== setup.attempt.principalId || endpoint.appVersion !== setup.attempt.appVersion)));
|
|
64
|
+
const changed = !this.scopeCurrent(setup) || setup.configRevision !== browserConfigRevision(this.deps.getConfig()) || Boolean(setup.attempt && (setup.attempt.policyRevision !== this.policyRevision(setup.agentId) || !this.deps.canUseBrowser(setup.agentId) || endpoint && (endpoint.principalId !== setup.attempt.principalId || endpoint.appVersion !== setup.attempt.appVersion)));
|
|
51
65
|
return {
|
|
52
66
|
...setup,
|
|
53
67
|
attempt: setup.attempt ? attempt : void 0,
|
|
54
68
|
sceneId: "browser",
|
|
55
69
|
skillName: "configure-xopc",
|
|
56
70
|
resourceVersion: VERSION,
|
|
71
|
+
interactionPath: `/configuration/browser/${setup.id}?conversationId=${encodeURIComponent(setup.conversationId)}`,
|
|
57
72
|
stale: changed,
|
|
58
73
|
toolPermission: this.deps.canUseBrowser(setup.agentId) ? "allowed" : "denied",
|
|
59
74
|
currentDriverKind: this.deps.getConfig().browser.driver.kind,
|
|
@@ -141,6 +156,7 @@ var BrowserSetupService = class {
|
|
|
141
156
|
"open",
|
|
142
157
|
"begin_verification"
|
|
143
158
|
].includes(command)) {
|
|
159
|
+
if (!this.scopeCurrent(setup)) throw new Error("SETUP_SCOPE_CHANGED: Start a new setup in the current conversation.");
|
|
144
160
|
if (!context.canConfigure) throw new Error("SETUP_INTERACTIVE_REQUIRED: Continue in an authorized interactive conversation.");
|
|
145
161
|
if (!Number.isInteger(args.expectedRevision) || args.expectedRevision !== setup.revision) throw new Error("SETUP_CONFLICT: Read the current progress.");
|
|
146
162
|
if (!this.deps.canUseBrowser(context.agentId)) throw new Error("AGENT_BROWSER_DENIED: Review this Agent tool permission in settings.");
|
|
@@ -173,7 +189,7 @@ var BrowserSetupService = class {
|
|
|
173
189
|
}
|
|
174
190
|
approve(setup, principalId, revision) {
|
|
175
191
|
this.revision(setup, revision);
|
|
176
|
-
if (setup.state === "cancelled" || setup.state === "verifying" || setup.state === "completed") throw new Error("SETUP_STATE_CHANGED");
|
|
192
|
+
if (!this.scopeCurrent(setup) || setup.state === "cancelled" || setup.state === "verifying" || setup.state === "completed") throw new Error("SETUP_STATE_CHANGED");
|
|
177
193
|
if (setup.configRevision !== browserConfigRevision(this.deps.getConfig())) throw new Error("CONFIG_CHANGED: Review the current configuration before approving.");
|
|
178
194
|
return saveBrowserSetup({
|
|
179
195
|
...setup,
|
|
@@ -185,7 +201,7 @@ var BrowserSetupService = class {
|
|
|
185
201
|
if (setup.revision !== revision) throw new Error("SETUP_CONFLICT: Read the current progress.");
|
|
186
202
|
}
|
|
187
203
|
async prepare(setup) {
|
|
188
|
-
if (!setup.approvedBy || setup.state === "cancelled" || setup.state === "verifying" || setup.state === "completed") throw new Error("OWNER_APPROVAL_REQUIRED");
|
|
204
|
+
if (!this.scopeCurrent(setup) || !setup.approvedBy || setup.state === "cancelled" || setup.state === "verifying" || setup.state === "completed") throw new Error("OWNER_APPROVAL_REQUIRED");
|
|
189
205
|
if (setup.attempt && !setup.attempt.released) throw new Error("CONTROL_RELEASE_REQUIRED");
|
|
190
206
|
if (this.preparing.has(setup.id)) return readBrowserSetup(setup.id);
|
|
191
207
|
if (["waiting_extension", "ready_for_verification"].includes(setup.state) && !setup.error) return this.recheck(setup);
|
|
@@ -196,17 +212,22 @@ var BrowserSetupService = class {
|
|
|
196
212
|
state: "needs_attention",
|
|
197
213
|
error: "BROWSER_BUSY: Release existing browser sessions and wait for other runs before switching the shared driver."
|
|
198
214
|
}, setup.revision);
|
|
215
|
+
let settled;
|
|
216
|
+
this.preparationSettled.set(setup.id, new Promise((resolve) => {
|
|
217
|
+
settled = resolve;
|
|
218
|
+
}));
|
|
199
219
|
this.preparing.add(setup.id);
|
|
200
|
-
let current =
|
|
201
|
-
...setup,
|
|
202
|
-
state: "preparing",
|
|
203
|
-
error: void 0,
|
|
204
|
-
operation: {
|
|
205
|
-
key: setup.operation?.key ?? randomUUID(),
|
|
206
|
-
startedAt: Date.now()
|
|
207
|
-
}
|
|
208
|
-
}, setup.revision);
|
|
220
|
+
let current = setup;
|
|
209
221
|
try {
|
|
222
|
+
current = saveBrowserSetup({
|
|
223
|
+
...setup,
|
|
224
|
+
state: "preparing",
|
|
225
|
+
error: void 0,
|
|
226
|
+
operation: {
|
|
227
|
+
key: setup.operation?.key ?? randomUUID(),
|
|
228
|
+
startedAt: Date.now()
|
|
229
|
+
}
|
|
230
|
+
}, setup.revision);
|
|
210
231
|
const next = structuredClone(config);
|
|
211
232
|
next.browser.enabled = true;
|
|
212
233
|
next.browser.driver = { kind: "extension" };
|
|
@@ -243,6 +264,8 @@ var BrowserSetupService = class {
|
|
|
243
264
|
}, current.revision);
|
|
244
265
|
} finally {
|
|
245
266
|
this.preparing.delete(setup.id);
|
|
267
|
+
this.preparationSettled.delete(setup.id);
|
|
268
|
+
settled();
|
|
246
269
|
}
|
|
247
270
|
}
|
|
248
271
|
async recheck(setup) {
|
|
@@ -266,12 +289,12 @@ var BrowserSetupService = class {
|
|
|
266
289
|
}, setup.revision);
|
|
267
290
|
}
|
|
268
291
|
async open(setup, action) {
|
|
269
|
-
if (!setup.approvedBy || setup.state === "cancelled") throw new Error("OWNER_APPROVAL_REQUIRED");
|
|
292
|
+
if (!this.scopeCurrent(setup) || !setup.approvedBy || setup.state === "cancelled") throw new Error("OWNER_APPROVAL_REQUIRED");
|
|
270
293
|
return this.deps.open(action);
|
|
271
294
|
}
|
|
272
295
|
begin(setup, endpointId, origin, revision) {
|
|
273
296
|
this.revision(setup, revision);
|
|
274
|
-
if (!setup.approvedBy || setup.state !== "ready_for_verification") throw new Error("SETUP_NOT_READY");
|
|
297
|
+
if (!this.scopeCurrent(setup) || !setup.approvedBy || setup.state !== "ready_for_verification") throw new Error("SETUP_NOT_READY");
|
|
275
298
|
if (setup.configRevision !== browserConfigRevision(this.deps.getConfig())) throw new Error("CONFIG_CHANGED");
|
|
276
299
|
if (setup.attempt && !setup.attempt.released) throw new Error("CONTROL_RELEASE_REQUIRED");
|
|
277
300
|
if (!this.deps.canUseBrowser(setup.agentId)) throw new Error("AGENT_BROWSER_DENIED: Enable browser_use for this Agent and start a refreshed turn.");
|
|
@@ -331,7 +354,7 @@ var BrowserSetupService = class {
|
|
|
331
354
|
const [prefix, setupId, attemptId] = taskKey.split(":");
|
|
332
355
|
if (prefix !== "browser-setup" || !setupId) return false;
|
|
333
356
|
const setup = readBrowserSetup(setupId);
|
|
334
|
-
return Boolean(setup
|
|
357
|
+
return Boolean(setup && this.scopeCurrent(setup) && setup.approvedBy && setup.state === "verifying" && setup.attempt?.id === attemptId && setup.attempt.fixtureUrl === url && Date.now() <= setup.attempt.expiresAt && setup.configRevision === browserConfigRevision(this.deps.getConfig()));
|
|
335
358
|
}
|
|
336
359
|
/** Called only by the real Agent browser tool, before its normal runtime/policy path. */
|
|
337
360
|
beforeAction(conversationId, agentId, input) {
|
|
@@ -344,7 +367,7 @@ var BrowserSetupService = class {
|
|
|
344
367
|
].includes(setup.state)) return void 0;
|
|
345
368
|
const a = setup.attempt;
|
|
346
369
|
if (!(input.action === "close")) {
|
|
347
|
-
if (setup.state !== "verifying") throw new Error("VERIFICATION_STOPPED: Close the verification session first.");
|
|
370
|
+
if (!this.scopeCurrent(setup) || setup.state !== "verifying") throw new Error("VERIFICATION_STOPPED: Close the verification session first.");
|
|
348
371
|
if (Date.now() > a.expiresAt || a.actions >= MAX_ACTIONS) throw new Error("VERIFICATION_BUDGET_EXCEEDED: Close the verification session.");
|
|
349
372
|
if (setup.configRevision !== browserConfigRevision(this.deps.getConfig()) || a.policyRevision !== this.policyRevision(setup.agentId)) throw new Error("CONFIG_CHANGED: Close the verification session.");
|
|
350
373
|
const endpoint = this.endpoints().find((e) => e.endpointId === a.endpointId);
|
|
@@ -381,7 +404,7 @@ var BrowserSetupService = class {
|
|
|
381
404
|
if (input.action === "close" && result.ok && result.receipt.action === "close" && result.receipt.verified) {
|
|
382
405
|
a.released = true;
|
|
383
406
|
delete a.observation;
|
|
384
|
-
const complete = setup.state === "verifying" && setup.configRevision === browserConfigRevision(this.deps.getConfig()) && Date.now() <= a.expiresAt && a.policyRevision === this.policyRevision(setup.agentId) && this.deps.canUseBrowser(setup.agentId) && a.read && a.clicked && a.filled;
|
|
407
|
+
const complete = this.scopeCurrent(setup) && setup.state === "verifying" && setup.configRevision === browserConfigRevision(this.deps.getConfig()) && Date.now() <= a.expiresAt && a.policyRevision === this.policyRevision(setup.agentId) && this.deps.canUseBrowser(setup.agentId) && a.read && a.clicked && a.filled;
|
|
385
408
|
return saveBrowserSetup({
|
|
386
409
|
...setup,
|
|
387
410
|
attempt: a,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { decodeInboundAttachmentBase64, readInboundAttachmentBuffer } from "./inbound-persist.js";
|
|
4
3
|
import { transcribe } from "../../voice/stt/transcribe-core.js";
|
|
5
4
|
import { isSTTAvailable } from "../../voice/stt/availability.js";
|
|
6
5
|
import "../../voice/stt/index.js";
|
|
6
|
+
import { decodeInboundAttachmentBase64, readInboundAttachmentBuffer } from "./inbound-persist.js";
|
|
7
7
|
//#region src/channels/attachments/voice-stt-webchat.ts
|
|
8
8
|
init_logger();
|
|
9
9
|
const STT_MAX_BYTES = 25 * 1024 * 1024;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { parseFrontmatterBlock } from "../markdown/frontmatter.js";
|
|
2
|
+
import { compileAllowlist, evaluateAccess, hasBotMention, removeBotMention, resolveAllowlistMatch, resolveAllowlistMatchSimple, resolveDmPolicy, resolveGroupPolicy } from "./security.js";
|
|
2
3
|
import { getChannelPlugin, getChannelRegistryVersion, listChannelPlugins, syncChannelPluginsFromManager } from "./plugins/registry.js";
|
|
3
4
|
import { findFenceSpanAt, isSafeFenceBreak, parseFenceSpans } from "../markdown/fences.js";
|
|
4
5
|
import { chunkText } from "../markdown/chunk.js";
|
|
5
6
|
import { chunkMarkdownIR, markdownToIR, markdownToIRWithMeta } from "../markdown/ir.js";
|
|
6
|
-
import { compileAllowlist, evaluateAccess, hasBotMention, removeBotMention, resolveAllowlistMatch, resolveAllowlistMatchSimple, resolveDmPolicy, resolveGroupPolicy } from "./security.js";
|
|
7
7
|
import { renderMarkdownWithMarkers } from "../markdown/render.js";
|
|
8
8
|
import { convertMarkdownTables } from "../markdown/tables.js";
|
|
9
9
|
import { buildCodeSpanIndex, createInlineCodeState } from "../markdown/code-spans.js";
|
|
@@ -50,6 +50,7 @@ export declare class ChannelManager {
|
|
|
50
50
|
listDeferConnectChannelIds(cfg: Config): string[];
|
|
51
51
|
send(msg: OutboundMessage, options?: {
|
|
52
52
|
skipPersist?: boolean;
|
|
53
|
+
requireDelivery?: boolean;
|
|
53
54
|
}): Promise<void>;
|
|
54
55
|
replayPendingOutboundMessages(): Promise<void>;
|
|
55
56
|
startStream(channel: string, chatId: string, accountId?: string, opts?: {
|
|
@@ -51,6 +51,7 @@ var ChannelOutboundSender = class {
|
|
|
51
51
|
if (this.hooks) {
|
|
52
52
|
const hookResult = await this.hooks.runMessageSending(processedMsg.chat_id, processedMsg.content ?? "", processedMsg.channel);
|
|
53
53
|
if (!hookResult.send) {
|
|
54
|
+
if (options?.requireDelivery) throw new Error("Channel delivery was blocked by policy.");
|
|
54
55
|
if (queueId) this.persistStore.ack(queueId);
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
@@ -66,6 +67,7 @@ var ChannelOutboundSender = class {
|
|
|
66
67
|
}
|
|
67
68
|
const plugin = this.opts.registry.get(processedMsg.channel);
|
|
68
69
|
if (!plugin?.outbound) {
|
|
70
|
+
if (options?.requireDelivery) throw new Error("The requested channel is unavailable.");
|
|
69
71
|
log.error({ channel: processedMsg.channel }, "Unknown channel or no outbound adapter");
|
|
70
72
|
if (queueId) this.persistStore.ack(queueId);
|
|
71
73
|
return;
|
|
@@ -79,6 +81,7 @@ var ChannelOutboundSender = class {
|
|
|
79
81
|
const err = result && !result.success ? result.error : void 0;
|
|
80
82
|
await this.hooks.runMessageSent(processedMsg.chat_id, processedMsg.content ?? "", result?.success ?? false, err, processedMsg.channel);
|
|
81
83
|
}
|
|
84
|
+
if (options?.requireDelivery && !result?.success) throw new Error("Channel delivery did not succeed.");
|
|
82
85
|
if (!result) {
|
|
83
86
|
if (queueId) this.persistStore.ack(queueId);
|
|
84
87
|
return;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { resolveDmPolicy } from "../security.js";
|
|
2
1
|
import { resolveStandardAllowFromPath, resolveStandardPairingPath } from "./paths.js";
|
|
3
2
|
import { readAllowFromIdsSync, removeAllowFromIdSync } from "./allow-from-file.js";
|
|
4
3
|
import "./pairing-constants.js";
|
|
5
4
|
import { PAIRING_PENDING_TTL_MS, approvePairingBySenderIdSync, approvePairingCodeSync, dismissPairingBySenderIdSync, listPendingPairingRequestsSync } from "./pairing-store.js";
|
|
6
5
|
import { broadcastPairingEvent } from "./pairing-events.js";
|
|
6
|
+
import { resolveDmPolicy } from "../security.js";
|
|
7
7
|
//#region src/channels/pairing/pairing-service.ts
|
|
8
8
|
const pairingResolvers = /* @__PURE__ */ new Map();
|
|
9
9
|
function registerPairingChannelResolver(channel, resolver) {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { loadWeixinAccount } from "../../../extensions/weixin/src/auth/accounts.js";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
//#region src/channels/weixin/account-identity.ts
|
|
4
|
+
/** An opaque login revision; never expose the channel credential or silently rebind a recipient. */
|
|
5
|
+
function weixinAccountIdentityRevision(accountId) {
|
|
6
|
+
const account = loadWeixinAccount(accountId);
|
|
7
|
+
if (!account?.token?.trim()) return;
|
|
8
|
+
return createHash("sha256").update(JSON.stringify([
|
|
9
|
+
account.userId ?? "",
|
|
10
|
+
account.token.trim(),
|
|
11
|
+
account.baseUrl?.trim() || "https://ilinkai.weixin.qq.com"
|
|
12
|
+
])).digest("hex");
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { weixinAccountIdentityRevision };
|
|
@@ -2,11 +2,11 @@ import { createLogger } from "../../utils/logger/index.js";
|
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { init_paths, resolveConfigPath } from "../../config/paths.js";
|
|
4
4
|
import { ConfigSchema, init_schema } from "../../config/schema.js";
|
|
5
|
+
import { resolveAllowlistMatchSimple } from "../../channels/security.js";
|
|
5
6
|
import { commandRegistry } from "../registry.js";
|
|
6
7
|
import { parseConfigValue } from "../config-value.js";
|
|
7
8
|
import { getConfigValueAtPath, parseConfigPath, setConfigValueAtPath, unsetConfigValueAtPath } from "../config-paths.js";
|
|
8
9
|
import { loadConfig, saveConfig } from "../../config/loader.js";
|
|
9
|
-
import { resolveAllowlistMatchSimple } from "../../channels/security.js";
|
|
10
10
|
//#region src/chat-commands/builtins/config.ts
|
|
11
11
|
init_schema();
|
|
12
12
|
init_paths();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { buildChannelCatalogForConfig } from "../../channels/catalog/channel-catalog-service.js";
|
|
2
|
-
import { loadConfig, saveConfig } from "../../config/loader.js";
|
|
3
1
|
import { listChannelPairingState } from "../../channels/pairing/pairing-service.js";
|
|
4
2
|
import { approveChannelPairingFromCli } from "../../channels/pairing/approve-cli.js";
|
|
3
|
+
import { buildChannelCatalogForConfig } from "../../channels/catalog/channel-catalog-service.js";
|
|
4
|
+
import { loadConfig, saveConfig } from "../../config/loader.js";
|
|
5
5
|
import { formatExamples, register } from "../registry.js";
|
|
6
6
|
import { colors } from "../utils/colors.js";
|
|
7
7
|
import { Command } from "commander";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { loadConfig } from "../../../../config/loader.js";
|
|
2
1
|
import { collectPairingPendingIssues } from "../../../../channels/pairing/pairing-service.js";
|
|
2
|
+
import { loadConfig } from "../../../../config/loader.js";
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
4
|
//#region src/cli/commands/doctor/checks/channel-pairing-pending.ts
|
|
5
5
|
function hasEnabledChannel(cfg) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { resolveMcpSetupConfig } from "../../agent/mcp/effective-server.js";
|
|
1
2
|
import { getNativePiAgentDir, prepareNativeMcpConfig } from "../../agent/mcp/native-mcp.js";
|
|
2
3
|
import { loadConfig } from "../../config/loader.js";
|
|
3
|
-
import { resolveMcpSetupConfig } from "../../agent/mcp/effective-server.js";
|
|
4
4
|
import { register } from "../registry.js";
|
|
5
5
|
import { createGatewayHttpClientFromConfig } from "../../mcp/gateway-http-client.js";
|
|
6
6
|
import { createCapabilityMcpServer } from "../../mcp/capability-server.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { init_paths_state, resolveStateDir } from "../../config/paths-state.js";
|
|
2
2
|
import { pluginName, pluginServerId } from "./validation.js";
|
|
3
3
|
import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
|
|
4
|
-
import { createNativeMcpCredentials } from "../../agent/mcp/credential-store.js";
|
|
5
4
|
import { pluginCredentialProviderPrefix } from "./auth.js";
|
|
6
5
|
import { pluginOAuthCredentialId } from "./mcp-adapter.js";
|
|
6
|
+
import { createNativeMcpCredentials } from "../../agent/mcp/credential-store.js";
|
|
7
7
|
import { getNativePiAgentDir } from "../../agent/mcp/native-mcp.js";
|
|
8
8
|
import { join } from "node:path";
|
|
9
9
|
import { existsSync, rmSync } from "node:fs";
|
|
@@ -118,7 +118,7 @@ export declare class PluginSetupService {
|
|
|
118
118
|
id: string;
|
|
119
119
|
name: string;
|
|
120
120
|
}>>>;
|
|
121
|
-
authorization(id: string, owner: string, server: string, config: Config): Promise<import("
|
|
121
|
+
authorization(id: string, owner: string, server: string, config: Config): Promise<import("../../agent/mcp/connection-setup.js").McpAuthorization | import("./cli-authorization.js").PluginCliAuthorization>;
|
|
122
122
|
redirect(id: string, owner: string, server: string, url: string, config: Config): boolean;
|
|
123
123
|
private config;
|
|
124
124
|
startPrepare(id: string, owner: string, revision: number, config: Config, workspace: string, idempotencyKey?: string): PluginSetupJob;
|
|
@@ -5,14 +5,14 @@ import { pluginAuthorizations, pluginPermissionIssueSchema } from "./setup-contr
|
|
|
5
5
|
import { preparePluginResources } from "./resources.js";
|
|
6
6
|
import { pluginName, pluginServerId } from "./validation.js";
|
|
7
7
|
import { AgentPluginStore } from "./store.js";
|
|
8
|
-
import { connectionFingerprint, matchingReusableConnection } from "./connection-reuse.js";
|
|
9
|
-
import { createNativeMcpCredentials } from "../../agent/mcp/credential-store.js";
|
|
10
8
|
import { readPluginAuthBinding, savePluginAuthBinding, savePluginOAuthReference } from "./auth.js";
|
|
11
9
|
import { pluginConfigMissing, readPluginUserConfig, savePluginUserConfig } from "./user-config.js";
|
|
12
10
|
import { materializePluginServers } from "./mcp-adapter.js";
|
|
11
|
+
import { connectionFingerprint, matchingReusableConnection } from "./connection-reuse.js";
|
|
12
|
+
import { createNativeMcpCredentials } from "../../agent/mcp/credential-store.js";
|
|
13
13
|
import { getNativePiAgentDir } from "../../agent/mcp/native-mcp.js";
|
|
14
|
-
import { cancelPluginCliAuthorizations, getPluginCliAuthorization, inspectPluginCliAuthorization, startPluginCliAuthorization } from "./cli-authorization.js";
|
|
15
14
|
import { cancelMcpAuthorization, getMcpAuthorization, probeMcpConnection, startMcpAuthorization, submitMcpRedirect } from "../../agent/mcp/connection-setup.js";
|
|
15
|
+
import { cancelPluginCliAuthorizations, getPluginCliAuthorization, inspectPluginCliAuthorization, startPluginCliAuthorization } from "./cli-authorization.js";
|
|
16
16
|
import { join } from "node:path";
|
|
17
17
|
import { existsSync, readFileSync } from "node:fs";
|
|
18
18
|
import { randomUUID } from "node:crypto";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { getProviderRegistry, init_plugin_registry } from "../providers/plugin-registry.js";
|
|
4
|
-
import { registerMarketplaceAdapter, unregisterMarketplaceAdapter } from "../agent/skills/marketplace/registry.js";
|
|
5
4
|
import { registerMediaUnderstandingProvider } from "../media-understanding/registry.js";
|
|
5
|
+
import { registerMarketplaceAdapter, unregisterMarketplaceAdapter } from "../agent/skills/marketplace/registry.js";
|
|
6
6
|
import { registerSpeechProvider } from "../voice/tts/speech-registry.js";
|
|
7
7
|
import { HOOK_EXECUTION_MODES } from "./types/hooks.js";
|
|
8
8
|
import { commandRegistry } from "../chat-commands/registry.js";
|
|
@@ -277,4 +277,4 @@ export declare const GATEWAY_BUILTIN_TOOLS: readonly [{
|
|
|
277
277
|
readonly zh: "使用已验证的参数执行选定的外部工具。";
|
|
278
278
|
};
|
|
279
279
|
}];
|
|
280
|
-
export declare const GATEWAY_BUILTIN_TOOL_IDS: ("automation" | "find" | "image" | "knowledge_search" | "knowledge_get" | "knowledge_write" | "user_context_search" | "user_context_get" | "user_context_update" | "web_search" | "web_fetch" | "browser_use" | "grep" | "session_search" | "read_file" | "list_dir" | "write_file" | "apply_patch" | "exec_command" | "update_plan" | "todo" | "web_extract" | "clarify" | "xopc_tool_execute" | "tool_manual" | "session_status" | "read_media" | "xopc_tool_search" | "xopc_tool_describe" | "phone_use" | "skill_view" | "skills_list" | "image_generate" | "skill_manage" | "skills_marketplace_search" | "computer_use" | "send_message" | "text_to_speech" | "execute_code" | "send_media" | "create_share" | "memory_maintenance" | "
|
|
280
|
+
export declare const GATEWAY_BUILTIN_TOOL_IDS: ("automation" | "find" | "image" | "knowledge_search" | "knowledge_get" | "knowledge_write" | "user_context_search" | "user_context_get" | "user_context_update" | "web_search" | "web_fetch" | "browser_use" | "grep" | "session_search" | "read_file" | "list_dir" | "write_file" | "apply_patch" | "exec_command" | "update_plan" | "todo" | "web_extract" | "clarify" | "xopc_tool_execute" | "tool_manual" | "session_status" | "read_media" | "xopc_tool_search" | "xopc_tool_describe" | "phone_use" | "skill_view" | "skills_list" | "image_generate" | "skill_manage" | "skills_marketplace_search" | "computer_use" | "send_message" | "text_to_speech" | "execute_code" | "send_media" | "create_share" | "memory_maintenance" | "skill_install" | "delegate_task" | "create_desktop_pet")[];
|
|
@@ -3,8 +3,8 @@ import { AgentCatalogRepository, init_repository } from "../agent-catalog/reposi
|
|
|
3
3
|
import { init_agent_scope, listAgentEntries, resolveAgentProfileDir, resolveAgentWorkspaceDir, resolveDefaultAgentId, resolveUserPath } from "../agent/agent-scope.js";
|
|
4
4
|
import { resolveEffectiveAgentProfile } from "../config/agent-profile.js";
|
|
5
5
|
import { AGENT_PROFILE_MARKDOWN_SYSTEM_FILES, REQUIRED_AGENT_PROFILE_MARKDOWN_FILE_SET } from "../agent/context/workspace.js";
|
|
6
|
-
import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
|
|
7
6
|
import { AgentCatalogService } from "../agent-catalog/service.js";
|
|
7
|
+
import { isPathUnderWorkspace, resolveWorkspaceSafePath } from "./workspace-editor-path.js";
|
|
8
8
|
import { GATEWAY_BUILTIN_TOOL_IDS } from "./agent-builtin-tools.js";
|
|
9
9
|
import { resolve } from "node:path";
|
|
10
10
|
import { mkdir, readFile, realpath, stat, unlink, writeFile } from "node:fs/promises";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getTunnelService } from "../tunnel/tunnel-service.js";
|
|
2
1
|
import { resolveReverseProxyPublicUrl } from "./public-url.js";
|
|
2
|
+
import { getTunnelService } from "../tunnel/tunnel-service.js";
|
|
3
3
|
import { getTailscaleExposureState } from "./tailscale-lifecycle.js";
|
|
4
4
|
import crypto from "node:crypto";
|
|
5
5
|
//#region src/gateway/device-routes.ts
|
|
@@ -3,9 +3,9 @@ import { init_logger } from "../../utils/logger.js";
|
|
|
3
3
|
import { resolveAllowedBrowserOrigins, resolveGatewayServiceListenPort } from "../host.js";
|
|
4
4
|
import { listDevices } from "../../storage/sqlite/device-access-repository.js";
|
|
5
5
|
import { ENDPOINT_MAX_FILE_BYTES, init_src } from "../../../packages/endpoint-tools-protocol/src/index.js";
|
|
6
|
+
import { resolveReverseProxyPublicUrl } from "../public-url.js";
|
|
6
7
|
import { resolveGatewayEffectiveHost } from "../../config/gateway-bind.js";
|
|
7
8
|
import { loadTunnelState } from "../../tunnel/tunnel-state.js";
|
|
8
|
-
import { resolveReverseProxyPublicUrl } from "../public-url.js";
|
|
9
9
|
import { maxSessionInputRequestBodyBytes } from "../chat-limits.js";
|
|
10
10
|
import { BROWSER_EXTENSION_ID } from "../../browser/extension-identity.js";
|
|
11
11
|
import { isLoopbackIpAddress, isTrustedProxyAddress } from "../client-ip.js";
|
|
@@ -7,9 +7,9 @@ import { init_models_json, loadModelsJson } from "../../../config/models-json.js
|
|
|
7
7
|
import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
|
|
8
8
|
import { getProviderRegistry, init_plugin_registry } from "../../../providers/plugin-registry.js";
|
|
9
9
|
import { getAllProviders, init_providers, isProviderConfigured } from "../../../providers/index.js";
|
|
10
|
+
import { normalizeConfiguredMcpServers } from "../../../config/mcp-config-normalize.js";
|
|
10
11
|
import { resolveShareConfig } from "../../../share/share-config.js";
|
|
11
12
|
import { maskTunnelSecretForWeb } from "../../../tunnel/env.js";
|
|
12
|
-
import { normalizeConfiguredMcpServers } from "../../../config/mcp-config-normalize.js";
|
|
13
13
|
import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, getChannelSetupStatus } from "../../../channels/catalog/channel-catalog-service.js";
|
|
14
14
|
import { resolveSessionConfigForWeb, resolveUpdateConfigForWeb } from "../../../config/web-patch.js";
|
|
15
15
|
import { GENERIC_MASKED_SECRET, maskSecretLength } from "./mask-secret-length.js";
|
|
@@ -3,9 +3,9 @@ import { init_logger } from "../../utils/logger.js";
|
|
|
3
3
|
import { isLoopbackHost } from "../host.js";
|
|
4
4
|
import { getOAuthProviderInterfaces, init_registry } from "../../auth/oauth/registry.js";
|
|
5
5
|
import { CredentialResolver, init_credentials } from "../../auth/credentials.js";
|
|
6
|
-
import { resolveReverseProxyPublicUrl } from "../public-url.js";
|
|
7
6
|
import { buildCapabilityPlansForConfig } from "../../capabilities/readiness/from-config.js";
|
|
8
7
|
import "../../capabilities/readiness/index.js";
|
|
8
|
+
import { resolveReverseProxyPublicUrl } from "../public-url.js";
|
|
9
9
|
import { applyXopcCloudCapabilitySetup } from "../xopc-cloud-capability-setup.js";
|
|
10
10
|
import { Hono } from "hono";
|
|
11
11
|
//#region src/gateway/hono/oauth-async.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, getChannelSetupStatus } from "../../../channels/catalog/channel-catalog-service.js";
|
|
2
1
|
import { approveChannelPairing, approveChannelPairingBySender, dismissChannelPairingPending, listChannelPairingState, listChannelPairingSummary, revokeChannelPairingPaired } from "../../../channels/pairing/pairing-service.js";
|
|
2
|
+
import { buildChannelCatalogForConfig, buildChannelCatalogFromSnapshot, getChannelSetupStatus } from "../../../channels/catalog/channel-catalog-service.js";
|
|
3
3
|
//#region src/gateway/hono/routes/channels.ts
|
|
4
4
|
function channelIdParam(raw) {
|
|
5
5
|
return (raw ?? "").trim().toLowerCase();
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { enumerateLanGatewayCandidates } from "../../host.js";
|
|
2
2
|
import { getTunnelService } from "../../../tunnel/tunnel-service.js";
|
|
3
|
+
import { withGatewayConfigWriteLock } from "../lib/config-write-lock.js";
|
|
3
4
|
import { VOICE_SETTING_SCOPES, voiceSettingsRevisions } from "../lib/voice-settings-revisions.js";
|
|
4
5
|
import { buildSafeWebConfigPayload } from "../lib/config-payload.js";
|
|
5
|
-
import { withGatewayConfigWriteLock } from "../lib/config-write-lock.js";
|
|
6
6
|
import { applyChannelsPatch } from "./config-patch/channels.js";
|
|
7
7
|
import { applyGatewayPatch } from "./config-patch/gateway.js";
|
|
8
8
|
import { applyMiscPatch, validateGatewayAfterPatch } from "./config-patch/misc.js";
|
|
@@ -465,7 +465,7 @@ const AUTHENTICATED_LAZY_ROUTE_BUNDLES = [
|
|
|
465
465
|
},
|
|
466
466
|
{
|
|
467
467
|
id: "mcp",
|
|
468
|
-
match: (path) => path === "/api/mcp/servers" || /^\/api\/mcp\/servers\/[^/]+$/.test(path) || path === "/api/mcp/drafts" || /^\/api\/mcp\/drafts\/[^/]+(?:\/(?:probe|commit|tools|auth(?:\/redirect)?))?$/.test(path) || /^\/api\/mcp\/servers\/[^/]+\/(tools|probe|auth)$/.test(path) || /^\/api\/mcp\/auth\/[^/]+(?:\/redirect)?$/.test(path),
|
|
468
|
+
match: (path) => path === "/api/mcp/servers" || /^\/api\/mcp\/servers\/[^/]+$/.test(path) || path === "/api/mcp/drafts" || /^\/api\/mcp\/drafts\/[^/]+(?:\/(?:probe|commit|tools|auth(?:\/redirect)?))?$/.test(path) || /^\/api\/mcp\/servers\/[^/]+\/(tools|probe|auth)$/.test(path) || /^\/api\/mcp\/auth\/[^/]+(?:\/redirect)?$/.test(path) || /^\/api\/mcp\/setup\/[^/]+$/.test(path) || /^\/api\/mcp\/setup\/conversations\/[^/]+$/.test(path),
|
|
469
469
|
load: async () => {
|
|
470
470
|
const { registerMcpRoutes } = await import("./mcp.js");
|
|
471
471
|
return { register: registerMcpRoutes };
|
|
@@ -1,14 +1,51 @@
|
|
|
1
1
|
import { getWorkspacePath } from "../../../config/workspace-path-helpers.js";
|
|
2
2
|
import { isManagedConnectorServer } from "../../../connectors/materialize.js";
|
|
3
|
-
import { loadMergedMcpConfig } from "../../../agent/mcp/config.js";
|
|
4
3
|
import { resolveMcpSetupConfig } from "../../../agent/mcp/effective-server.js";
|
|
4
|
+
import { loadMergedMcpConfig } from "../../../agent/mcp/config.js";
|
|
5
5
|
import { discoverMcpTools } from "../../../agent/mcp/tool-catalog.js";
|
|
6
6
|
import { cancelMcpAuthorization, getMcpAuthorization, probeMcpConnection, startMcpAuthorization, submitMcpRedirect } from "../../../agent/mcp/connection-setup.js";
|
|
7
|
-
import { getGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
8
7
|
import { McpConnectionDrafts, McpDraftError, mcpConfigRevision } from "../../../agent/mcp/connection-drafts.js";
|
|
9
8
|
import { withGatewayConfigWriteLock } from "../lib/config-write-lock.js";
|
|
9
|
+
import { getGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
10
10
|
//#region src/gateway/hono/routes/mcp.ts
|
|
11
11
|
function registerMcpRoutes(app, deps) {
|
|
12
|
+
const secureSetup = (handler) => async (c) => {
|
|
13
|
+
const principal = getGatewayPrincipal(c);
|
|
14
|
+
if (principal.kind !== "owner" || !principal.scopes.includes("gateway.admin")) return c.json({
|
|
15
|
+
ok: false,
|
|
16
|
+
error: "Owner administration is required."
|
|
17
|
+
}, 403);
|
|
18
|
+
c.header("Cache-Control", "no-store");
|
|
19
|
+
try {
|
|
20
|
+
return c.json({
|
|
21
|
+
ok: true,
|
|
22
|
+
payload: await handler(c)
|
|
23
|
+
});
|
|
24
|
+
} catch (error) {
|
|
25
|
+
return c.json({
|
|
26
|
+
ok: false,
|
|
27
|
+
error: error instanceof McpDraftError ? error.message : "MCP setup could not be completed."
|
|
28
|
+
}, error instanceof McpDraftError ? error.status : 500);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
app.get("/api/mcp/setup/conversations/:id", secureSetup(async (c) => deps.service.mcpSetup.currentForConversation(c.req.param("id"))));
|
|
32
|
+
app.get("/api/mcp/setup/:id", secureSetup((c) => deps.service.mcpSetup.interact(c.req.param("id"), "get")));
|
|
33
|
+
app.post("/api/mcp/setup/:id", deps.strictRateLimitMiddleware, secureSetup(async (c) => {
|
|
34
|
+
const body = await c.req.json().catch(() => null);
|
|
35
|
+
if (!body || ![
|
|
36
|
+
"advance",
|
|
37
|
+
"authorize",
|
|
38
|
+
"token",
|
|
39
|
+
"cancel",
|
|
40
|
+
"approve",
|
|
41
|
+
"retry_delivery"
|
|
42
|
+
].includes(body.action) || !Number.isSafeInteger(body.expectedVersion) || Object.keys(body).some((key) => ![
|
|
43
|
+
"action",
|
|
44
|
+
"value",
|
|
45
|
+
"expectedVersion"
|
|
46
|
+
].includes(key)) || body.value !== void 0 && (typeof body.value !== "string" || body.action !== "token")) throw new McpDraftError(400, "Invalid MCP setup action.");
|
|
47
|
+
return deps.service.mcpSetup.interact(c.req.param("id"), body.action, body.value, body.expectedVersion, getGatewayPrincipal(c).principalId);
|
|
48
|
+
}));
|
|
12
49
|
const drafts = new McpConnectionDrafts({
|
|
13
50
|
readConfig: () => deps.service.currentConfig,
|
|
14
51
|
saveConfig: (config, expected) => deps.service.saveConfig(config, expected)
|
|
@@ -4,11 +4,11 @@ import { init_session_key, resolveConversationId } from "../../../routing/sessio
|
|
|
4
4
|
import { agentExists, getDefaultAgentId, init_resolve_route } from "../../../routing/resolve-route.js";
|
|
5
5
|
import { CapabilityError } from "../../../capabilities/runtime/errors.js";
|
|
6
6
|
import "../../../capabilities/runtime/dispatcher.js";
|
|
7
|
+
import { resolveReverseProxyPublicUrl } from "../../public-url.js";
|
|
8
|
+
import { createProductDispatcher } from "../../../capabilities/runtime/product.js";
|
|
7
9
|
import { resolveGatewayEffectiveHost } from "../../../config/gateway-bind.js";
|
|
8
10
|
import { getShareStore } from "../../../share/share-store.js";
|
|
9
11
|
import { resolveShareUrl } from "../../../share/share-url.js";
|
|
10
|
-
import { resolveReverseProxyPublicUrl } from "../../public-url.js";
|
|
11
|
-
import { createProductDispatcher } from "../../../capabilities/runtime/product.js";
|
|
12
12
|
import { getGatewayPrincipal } from "../../security/gateway-principal.js";
|
|
13
13
|
import { capabilityHttpContext, capabilityHttpError } from "../../../capabilities/adapters/http.js";
|
|
14
14
|
import { NoteShareService, NoteShareVersionConflictError } from "../../../share/note-share-service.js";
|