@xopcai/xopc 0.0.187 → 0.0.189
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/README.md +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/demo-memory/src/index.js +1 -0
- package/dist/extensions/feishu/src/streaming/streaming-adapter.js +1 -3
- package/dist/extensions/telegram/src/adapters/streaming-adapter.js +0 -2
- package/dist/extensions/telegram/src/draft-stream.d.ts +0 -4
- package/dist/extensions/telegram/src/draft-stream.js +1 -53
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-WlR2zEvA.js → activity-store-DTFKTPs8.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-RedDszrG.js → agent-avatar-dicebear-DqO25Qe5.js} +1 -1
- package/dist/gateway/static/root/assets/agents-BvdqdER9.js +2 -0
- package/dist/gateway/static/root/assets/{api-tVOllncq.js → api-DWeXfwVU.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-C9hKBzaF.js → app-management-settings-panel-BRpV8PXG.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-5cQvq7hd.js → appearance-settings-3ntKM9nQ.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-nKLsfy6C.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-Ct-shK4n.js → archive-plugin-Df7Ycj_7.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CpPj3m-q.js → attachment-load-UHgfZYtj.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-Dh5bdZiN.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-BpSXZBle.js → binary-plugins-BJah99wE.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-B8hR2tXc.js → block-editor-DNlY5KqF.js} +46 -46
- package/dist/gateway/static/root/assets/browser-settings-page-CRJ_nAuh.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-D_LAXUrh.js → browser-workflow-inputs-vyUfdzAd.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CPAs7-6s.js → browser-workflows-page-C1cKZjx-.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DeQR5BZt.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-CKklVY2p.js → capability-presets-api-D7tkhDMv.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-D7uK3q1p.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-WWN-nbFL.js → channel-recipient-api-BGG2kpJB.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-Bw6Dniyq.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-BrUTz4uU.js +1 -0
- package/dist/gateway/static/root/assets/{connector-logo-CdNkVFdB.js → connector-logo-8YU53RUT.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-k9tMiOL5.js +2 -0
- package/dist/gateway/static/root/assets/{desktop-pet-Bm_IEAf3.js → desktop-pet-BUuBEJuP.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-C0Ve04-G.js → desktop-pet-settings-BGfVIJM3.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-B2cvhvAI.js → directory-picker-path-field-DrQFfHH_.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-DNashgGu.js → extension-debug-page-CEnIFOX-.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Bvo-5htX.js → extension-page-CCqHbexs.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BBESdISV.js → extension-settings-page-DEZw_7zN.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-ClQvokMo.js → gateway-config-api-CgUE2Ii1.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-Dg8qCiIp.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CntXJF6W.js → gateway-startup-retry-DxhKNiCF.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-CWKcZuvc.js → heartbeat-settings-27tRzDEo.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-VA511kMr.js +3 -0
- package/dist/gateway/static/root/assets/{image-generation-api-DjSAQwGy.js → image-generation-api-DCFdc-HD.js} +1 -1
- package/dist/gateway/static/root/assets/index-BvR-i-m6.js +216 -0
- package/dist/gateway/static/root/assets/index-zybP34zk.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-ahKHpjoW.js → keyboard-shortcuts-settings-Bf2VLtXW.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CaJq4-wV.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-B6GKdgza.js → local-apps-page-Ca1RuI13.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Bff30u5V.js → locale-store-DUW5YE3R.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-BLTCg69e.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-B3Eop1zn.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-split-BeNMJm_i.js → markdown-split-BGOYjgnM.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-Bdzrj_-6.js → media-plugins-CT0txyM4.js} +1 -1
- package/dist/gateway/static/root/assets/messages-CMjnbdbn.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-MYIi-9S9.js → notes-page-DfKgAe78.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-Bp1w9UM1.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-3t88bbGx.js → page-tabs-DNrbCgmC.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-Cf_BWbeE.js → preview-open-alternatives-BTqViDOR.js} +1 -1
- package/dist/gateway/static/root/assets/product-delivery-tRr-7IxY.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-CKq73c98.js → product-open-page-C_2L4_Iu.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-CZmbPDQN.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-D5pzqfm5.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-CC-XhVGI.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-NqOm-OG1.js → schema-form-BFLfkDGG.js} +1 -1
- package/dist/gateway/static/root/assets/{schemas-C6onAggk.js → schemas-zIBW3wiV.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-B2eTLVDV.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-CRuZ_bl0.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-DYAS8p8z.js → settings-form-section-C4GXGeA4.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DZFhxihA.js → settings-loading-skeleton-C9a-EbTZ.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-DI9qDH5x.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-layout-DfFfkdED.js → settings-page-layout-D-LWQdI5.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CJwmPvgs.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-CYtrQaZN.js → share-preview-page-BKSMG9r5.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-YzSDS4G_.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-CwOo8zZk.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-xd1cgSGN.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-BBXirAjc.js → skills-page.utils-zsz2HIlZ.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-DLf5YvFl.js → system-settings-panel-IWNDBI1O.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-DFGkuYfl.js → task-detail-page-CgtK02kP.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-y7e_tvYi.js → theme-store-BkJe7UDo.js} +1 -1
- package/dist/gateway/static/root/assets/time-picker-CstQ___Y.js +1 -0
- package/dist/gateway/static/root/assets/{typed-models-lib-DR12j_dr.js → typed-models-lib-C07LGthO.js} +1 -1
- package/dist/gateway/static/root/assets/{use-save-bar-registration-BsvcJgZl.js → use-save-bar-registration-CQYE0l6z.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-BnQAWS_B.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-DKADXFWD.js → voice-api-key-field-Boue1D46.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BC1nExf8.js → work-discovery-overlay-bbmvCmc8.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-CAszL1y8.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-C8X5W-8k.js → workflow-run-setup-panel-DlHv-GZC.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-DxGzo3-x.js +11 -0
- package/dist/gateway/static/root/index.html +9 -9
- package/dist/package.js +1 -1
- package/dist/packages/endpoint-tools-protocol/src/index.js +184 -0
- package/dist/packages/gateway-contract/src/tool-activity.js +223 -0
- package/dist/packages/realtime-client/src/index.js +199 -0
- package/dist/packages/realtime-protocol/src/index.js +83 -0
- package/dist/src/agent/agent-manager.d.ts +1 -0
- package/dist/src/agent/agent-manager.js +3 -8
- package/dist/src/agent/background-review/prompts.d.ts +1 -1
- package/dist/src/agent/background-review/prompts.js +3 -1
- package/dist/src/agent/background-review/run-background-review.d.ts +2 -0
- package/dist/src/agent/background-review/run-background-review.js +5 -2
- package/dist/src/agent/client-error-format.d.ts +1 -1
- package/dist/src/agent/client-error-format.js +1 -1
- package/dist/src/agent/code-intelligence/binary.js +1 -1
- package/dist/src/agent/embedded/run-for-session.d.ts +0 -2
- package/dist/src/agent/embedded/run-for-session.js +99 -112
- package/dist/src/agent/external-tools/composio-provider.d.ts +29 -0
- package/dist/src/agent/external-tools/composio-provider.js +307 -0
- package/dist/src/agent/external-tools/endpoint-provider.d.ts +17 -0
- package/dist/src/agent/external-tools/endpoint-provider.js +93 -0
- package/dist/src/agent/external-tools/extension-provider.d.ts +20 -0
- package/dist/src/agent/external-tools/extension-provider.js +68 -0
- package/dist/src/agent/external-tools/gateway-tools.d.ts +8 -0
- package/dist/src/agent/external-tools/gateway-tools.js +89 -0
- package/dist/src/agent/external-tools/index.d.ts +23 -0
- package/dist/src/agent/external-tools/index.js +46 -0
- package/dist/src/agent/external-tools/mcp-provider.d.ts +29 -0
- package/dist/src/agent/external-tools/mcp-provider.js +118 -0
- package/dist/src/agent/external-tools/memory-provider.d.ts +21 -0
- package/dist/src/agent/external-tools/memory-provider.js +56 -0
- package/dist/src/agent/external-tools/refs.d.ts +5 -0
- package/dist/src/agent/external-tools/refs.js +18 -0
- package/dist/src/agent/external-tools/service.d.ts +26 -0
- package/dist/src/agent/external-tools/service.js +117 -0
- package/dist/src/agent/external-tools/types.d.ts +35 -0
- package/dist/src/agent/external-tools/types.js +10 -0
- package/dist/src/agent/inbound/inbound-loop.d.ts +0 -2
- package/dist/src/agent/inbound/inbound-loop.js +4 -3
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +9 -8
- package/dist/src/agent/inbound/turn-dispatcher.js +13 -11
- package/dist/src/agent/mcp/{bundle-mcp-materialize.d.ts → bundle-mcp-gateway.d.ts} +1 -19
- package/dist/src/agent/mcp/bundle-mcp-gateway.js +60 -0
- package/dist/src/agent/mcp/bundle-mcp-names.d.ts +0 -8
- package/dist/src/agent/mcp/bundle-mcp-names.js +2 -29
- package/dist/src/agent/mcp/bundle-mcp-policy.d.ts +4 -7
- package/dist/src/agent/mcp/bundle-mcp-policy.js +6 -20
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +2 -2
- package/dist/src/agent/mcp/bundle-mcp-tools.d.ts +1 -2
- package/dist/src/agent/mcp/bundle-mcp-tools.js +1 -2
- package/dist/src/agent/mcp/bundle-mcp-types.d.ts +0 -5
- package/dist/src/agent/mcp/index.d.ts +0 -2
- package/dist/src/agent/mcp/index.js +2 -5
- package/dist/src/agent/mcp/mcp-stdio-transport.js +1 -1
- package/dist/src/agent/mcp/mcp-transport.js +1 -1
- package/dist/src/agent/memory/context/planner.d.ts +1 -0
- package/dist/src/agent/memory/context/planner.js +22 -7
- package/dist/src/agent/memory/manager.d.ts +4 -1
- package/dist/src/agent/memory/manager.js +5 -2
- package/dist/src/agent/memory/types.d.ts +2 -0
- package/dist/src/agent/messaging/command-handler.d.ts +2 -2
- package/dist/src/agent/messaging/command-handler.js +3 -3
- package/dist/src/agent/messaging/stream-manager.d.ts +2 -14
- package/dist/src/agent/messaging/stream-manager.js +0 -12
- package/dist/src/agent/orchestration/agent-event-handler.d.ts +1 -3
- package/dist/src/agent/orchestration/agent-event-handler.js +0 -36
- package/dist/src/agent/orchestration/agent-orchestrator.d.ts +0 -5
- package/dist/src/agent/orchestration/agent-orchestrator.js +0 -5
- package/dist/src/agent/prompt/sections/behavior.js +6 -4
- package/dist/src/agent/service/async-queue.d.ts +1 -1
- package/dist/src/agent/service/async-queue.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.d.ts +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +1 -1
- package/dist/src/agent/service/process-direct-one-shot.d.ts +3 -1
- package/dist/src/agent/service/process-direct-one-shot.js +1 -1
- package/dist/src/agent/service/process-direct-streaming.d.ts +7 -5
- package/dist/src/agent/service/process-direct-streaming.js +5 -5
- package/dist/src/agent/service.d.ts +1 -4
- package/dist/src/agent/service.js +6 -32
- package/dist/src/agent/service.types.d.ts +2 -3
- package/dist/src/agent/session/index.d.ts +1 -1
- package/dist/src/agent/session/session-context.d.ts +2 -0
- package/dist/src/agent/session/session-context.js +4 -0
- package/dist/src/agent/session/session-state-bag.d.ts +4 -4
- package/dist/src/agent/session/session-state-bag.js +1 -1
- package/dist/src/agent/skills/hub-pull.js +1 -1
- package/dist/src/agent/starter-agents.js +2 -2
- package/dist/src/agent/streaming/reasoning-visibility.d.ts +6 -0
- package/dist/src/agent/streaming/{reasoning-visibility-sse.js → reasoning-visibility.js} +3 -6
- package/dist/src/agent/tools/delegate-tool.js +5 -1
- package/dist/src/agent/tools/executor.js +1 -1
- package/dist/src/agent/tools/factory.d.ts +6 -1
- package/dist/src/agent/tools/factory.js +17 -22
- package/dist/src/agent/tools/index.d.ts +0 -1
- package/dist/src/agent/tools/index.js +1 -2
- package/dist/src/agent/workflow/workflow-child-tools.js +7 -1
- package/dist/src/automations/domain/types.d.ts +2 -1
- package/dist/src/automations/domain/validation.d.ts +1 -1
- package/dist/src/automations/service/action-executor.js +4 -1
- package/dist/src/browser/providers/cloakbrowser.js +1 -1
- package/dist/src/channels/channel-domain.d.ts +0 -4
- package/dist/src/channels/pairing/pairing-challenge.d.ts +1 -1
- package/dist/src/channels/pairing/pairing-challenge.js +1 -1
- package/dist/src/channels/plugin-types.d.ts +0 -2
- package/dist/src/cli/commands/agent/stream-renderer.js +4 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/rules.js +0 -5
- package/dist/src/config/schema.d.ts +3 -5
- package/dist/src/config/schema.js +0 -3
- package/dist/src/config/web-patch.js +0 -1
- package/dist/src/connectors/health.js +1 -1
- package/dist/src/endpoint-tools/auth.d.ts +20 -0
- package/dist/src/endpoint-tools/auth.js +51 -0
- package/dist/src/endpoint-tools/index.d.ts +5 -0
- package/dist/src/endpoint-tools/index.js +6 -0
- package/dist/src/endpoint-tools/invocation-service.d.ts +68 -0
- package/dist/src/endpoint-tools/invocation-service.js +190 -0
- package/dist/src/endpoint-tools/policy.d.ts +10 -0
- package/dist/src/endpoint-tools/policy.js +18 -0
- package/dist/src/endpoint-tools/registry.d.ts +45 -0
- package/dist/src/endpoint-tools/registry.js +121 -0
- package/dist/src/endpoint-tools/runtime.d.ts +23 -0
- package/dist/src/endpoint-tools/runtime.js +86 -0
- package/dist/src/endpoint-tools/upload-service.d.ts +41 -0
- package/dist/src/endpoint-tools/upload-service.js +103 -0
- package/dist/src/extensions/extension-registry-impl.d.ts +3 -1
- package/dist/src/extensions/extension-registry-impl.js +7 -1
- package/dist/src/extensions/loader.js +1 -1
- package/dist/src/extensions/types/core.d.ts +2 -1
- package/dist/src/extensions/types/hooks.d.ts +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agent-builtin-tools.js +5 -2
- package/dist/src/gateway/chat-stream/mapper.js +16 -1
- package/dist/src/gateway/chat-stream/protocol.d.ts +4 -1
- package/dist/src/gateway/clarify-bridge.d.ts +5 -4
- package/dist/src/gateway/clarify-bridge.js +3 -4
- package/dist/src/gateway/file-reference-errors.d.ts +6 -0
- package/dist/src/gateway/file-reference-errors.js +21 -0
- package/dist/src/gateway/heartbeat/service.js +5 -2
- package/dist/src/gateway/hono/app.js +1 -5
- package/dist/src/gateway/hono/index.d.ts +0 -1
- package/dist/src/gateway/hono/index.js +1 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +1 -2
- package/dist/src/gateway/hono/lib/config-payload.js +1 -2
- package/dist/src/gateway/hono/middleware/auth.js +3 -5
- package/dist/src/gateway/hono/routes/agent-stream.js +49 -6
- package/dist/src/gateway/hono/routes/config-patch/gateway.d.ts +2 -2
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +0 -19
- package/dist/src/gateway/hono/routes/config-patch/misc.js +1 -1
- package/dist/src/gateway/hono/routes/deps.d.ts +0 -2
- package/dist/src/gateway/hono/routes/endpoint-tools.d.ts +3 -0
- package/dist/src/gateway/hono/routes/endpoint-tools.js +196 -0
- package/dist/src/gateway/hono/routes/index.js +4 -0
- package/dist/src/gateway/hono/routes/logs.js +0 -4
- package/dist/src/gateway/hono/routes/mcp.js +1 -1
- package/dist/src/gateway/hono/routes/projects.js +34 -13
- package/dist/src/gateway/hono/routes/public-gateway.js +2 -2
- package/dist/src/gateway/hono/routes/realtime.d.ts +3 -0
- package/dist/src/gateway/hono/routes/realtime.js +35 -0
- package/dist/src/gateway/hono/routes/workspace.js +34 -13
- package/dist/src/gateway/hono/routes/you.d.ts +0 -9
- package/dist/src/gateway/hono/routes/you.js +81 -128
- package/dist/src/gateway/index.d.ts +1 -1
- package/dist/src/gateway/index.js +1 -2
- package/dist/src/gateway/protocol.d.ts +1 -7
- package/dist/src/gateway/security/index.js +1 -1
- package/dist/src/gateway/security/operator-scopes.js +1 -1
- package/dist/src/gateway/server.js +4 -4
- package/dist/src/gateway/service/agent-runner.d.ts +11 -9
- package/dist/src/gateway/service/agent-runner.js +18 -18
- package/dist/src/gateway/service/config-coordinator.d.ts +2 -2
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service/run-gateway-agent.d.ts +4 -3
- package/dist/src/gateway/service/run-gateway-agent.js +17 -14
- package/dist/src/gateway/service/session-input-coordinator.d.ts +3 -0
- package/dist/src/gateway/service/session-input-coordinator.js +4 -2
- package/dist/src/gateway/service/types.d.ts +0 -5
- package/dist/src/gateway/service.d.ts +7 -6
- package/dist/src/gateway/service.js +39 -22
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/mcp/channel-bridge.d.ts +6 -9
- package/dist/src/mcp/channel-bridge.js +48 -76
- package/dist/src/mcp/channel-server.js +2 -6
- package/dist/src/realtime/broker.d.ts +30 -0
- package/dist/src/realtime/broker.js +97 -0
- package/dist/src/realtime/runtime.d.ts +20 -0
- package/dist/src/realtime/runtime.js +258 -0
- package/dist/src/realtime/tickets.d.ts +15 -0
- package/dist/src/realtime/tickets.js +38 -0
- package/dist/src/realtime/writer.d.ts +15 -0
- package/dist/src/realtime/writer.js +78 -0
- package/dist/src/share/share-config.js +0 -1
- package/dist/src/share/share-zip.js +1 -1
- package/dist/src/share/site-share-config.js +0 -1
- package/dist/src/storage/sqlite/endpoint-principal-repository.d.ts +17 -0
- package/dist/src/storage/sqlite/endpoint-principal-repository.js +54 -0
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.d.ts +25 -0
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.js +42 -0
- package/dist/src/storage/sqlite/index.d.ts +2 -0
- package/dist/src/storage/sqlite/index.js +3 -1
- package/dist/src/storage/sqlite/memory-records-repository.js +3 -1
- package/dist/src/storage/sqlite/migrations/108_repair_user_memory_provider.sql +18 -0
- package/dist/src/storage/sqlite/migrations/109_endpoint_principals.sql +14 -0
- package/dist/src/storage/sqlite/migrations/110_session_input_origin.sql +43 -0
- package/dist/src/storage/sqlite/migrations/111_endpoint_tool_invocations.sql +18 -0
- package/dist/src/storage/sqlite/migrations/112_endpoint_instance_bindings.sql +8 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-input-repository.d.ts +3 -0
- package/dist/src/storage/sqlite/session-input-repository.js +5 -3
- package/dist/src/tasks/home-query-service.d.ts +1 -1
- package/dist/src/tui/backends/embedded-backend.js +5 -2
- package/dist/src/tui/backends/{gateway-sse-backend.d.ts → gateway-realtime-backend.d.ts} +13 -10
- package/dist/src/tui/backends/{gateway-sse-backend.js → gateway-realtime-backend.js} +114 -151
- package/dist/src/tui/tool-summary.d.ts +1 -2
- package/dist/src/tui/tool-summary.js +2 -18
- package/dist/src/tui/tui-agent-events.d.ts +0 -1
- package/dist/src/tui/tui-agent-events.js +2 -15
- package/dist/src/tui/tui-backend.d.ts +4 -4
- package/dist/src/tui/tui-run-state.js +0 -4
- package/dist/src/tui/tui-types.d.ts +2 -9
- package/dist/src/tui/tui-types.js +0 -1
- package/dist/src/tui/tui.js +5 -5
- package/dist/src/tunnel/frpc-binary.js +1 -1
- package/dist/src/tunnel/gateway-lifecycle.d.ts +1 -1
- package/dist/src/tunnel/gateway-lifecycle.js +1 -1
- package/dist/src/user-context/actionableInsights.d.ts +14 -0
- package/dist/src/user-context/actionableInsights.js +34 -0
- package/dist/src/user-context/manual-understanding.js +6 -1
- package/dist/src/user-context/projection.d.ts +2 -1
- package/dist/src/user-context/projection.js +2 -1
- package/dist/src/user-context/understandingQuality.d.ts +5 -0
- package/dist/src/user-context/understandingQuality.js +44 -0
- package/dist/src/utils/logger/log-stream.d.ts +3 -10
- package/dist/src/utils/logger/log-stream.js +2 -73
- package/dist/src/utils/logger/pino-record.d.ts +1 -1
- package/dist/src/utils/logger/streams.js +1 -1
- package/dist/src/voice/local/model-files.js +1 -1
- package/dist/src/work-discovery/service.js +1 -1
- package/package.json +6 -3
- package/dist/gateway/static/root/assets/agents-Df9mTa-K.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-Bd3tN-k2.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-w6K9GZQ7.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-jb5Hf-hm.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BjUe4raq.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DiWIMYRr.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-D8IkjMuX.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-CySs1GQX.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-BT2ahw52.js +0 -2
- package/dist/gateway/static/root/assets/gateway-settings-CIRs2QVy.js +0 -1
- package/dist/gateway/static/root/assets/home-page-C59f8UJw.js +0 -3
- package/dist/gateway/static/root/assets/index-D-YfWVyS.css +0 -1
- package/dist/gateway/static/root/assets/index-vi5KlR5_.js +0 -222
- package/dist/gateway/static/root/assets/local-app-workbench-page-DRB4UQBE.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-CNp4XiBN.js +0 -7
- package/dist/gateway/static/root/assets/messages-CPxz48hr.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-DqSkeDXX.js +0 -4
- package/dist/gateway/static/root/assets/product-delivery-C8JbSj5Y.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-BrbHs4Wp.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-B80rtkj6.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-_Q3GEznb.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-55dJOUVg.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CSFCZj14.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-BSIiMLi-.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-q_yE6-H1.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-gYkRX9Ik.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BoNBMKW6.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-GZHKDFSb.js +0 -2
- package/dist/gateway/static/root/assets/time-picker-5sHEZ5w5.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-q5dr8JFG.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-fNvSg40M.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-YJBKmPYK.js +0 -11
- package/dist/src/agent/feedback/feedback-coordinator.d.ts +0 -73
- package/dist/src/agent/feedback/feedback-coordinator.js +0 -156
- package/dist/src/agent/feedback/index.d.ts +0 -4
- package/dist/src/agent/feedback/index.js +0 -2
- package/dist/src/agent/lifecycle/progress.d.ts +0 -90
- package/dist/src/agent/lifecycle/progress.js +0 -339
- package/dist/src/agent/mcp/bundle-mcp-materialize.js +0 -183
- package/dist/src/agent/mcp/mcp-tool-meta.d.ts +0 -8
- package/dist/src/agent/mcp/mcp-tool-meta.js +0 -13
- package/dist/src/agent/mcp/resolve-embedded-mcp-tools.d.ts +0 -14
- package/dist/src/agent/mcp/resolve-embedded-mcp-tools.js +0 -48
- package/dist/src/agent/streaming/reasoning-visibility-sse.d.ts +0 -15
- package/dist/src/agent/tools/composio-tool.d.ts +0 -21
- package/dist/src/agent/tools/composio-tool.js +0 -261
- package/dist/src/gateway/agent-run-relay.d.ts +0 -19
- package/dist/src/gateway/agent-run-relay.js +0 -169
- package/dist/src/gateway/hono/sse.d.ts +0 -53
- package/dist/src/gateway/hono/sse.js +0 -207
- package/dist/src/gateway/service/sse-hub.d.ts +0 -10
- package/dist/src/gateway/service/sse-hub.js +0 -53
- package/dist/src/tui/sse-consumer.d.ts +0 -15
- package/dist/src/tui/sse-consumer.js +0 -73
|
@@ -1,25 +1,26 @@
|
|
|
1
|
+
import type { TurnOrigin } from '@xopcai/endpoint-tools-protocol';
|
|
1
2
|
import type { AgentService } from '../../agent/service.js';
|
|
2
3
|
import type { Config } from '../../config/schema.js';
|
|
3
4
|
import type { MessageBus } from '../../infra/bus/index.js';
|
|
4
5
|
import type { SessionIndex } from '../../session/index.js';
|
|
5
6
|
import type { ChatStreamEvent } from '../chat-stream/protocol.js';
|
|
6
|
-
import type { AgentRunRelay } from '../agent-run-relay.js';
|
|
7
7
|
import type { UserTurnAttachment } from '../user-turn-input.js';
|
|
8
8
|
export type RunGatewayAgentYield = ChatStreamEvent;
|
|
9
9
|
export type RunGatewayAgentDeps = {
|
|
10
10
|
config: Config;
|
|
11
11
|
agentService: AgentService;
|
|
12
12
|
bus: MessageBus;
|
|
13
|
-
runRelay: AgentRunRelay;
|
|
14
13
|
runAbortControllers: Map<string, AbortController>;
|
|
15
14
|
activeWebchatRunBySession: Map<string, string>;
|
|
16
15
|
sessionIndex: SessionIndex;
|
|
17
16
|
emit: (type: string, payload: unknown) => void;
|
|
17
|
+
publishRealtime: (topic: string, event: string, data: unknown) => void;
|
|
18
|
+
completeRealtimeTopic: (topic: string) => void;
|
|
18
19
|
};
|
|
19
20
|
/**
|
|
20
21
|
* @param runOptions.signal — When set (e.g. client disconnect), aborts in-flight generation and persists partial output.
|
|
21
22
|
*/
|
|
22
|
-
export declare function runGatewayAgent(deps: RunGatewayAgentDeps, message: string, channel: string, chatId: string, attachments?: UserTurnAttachment[], thinking?: string, runOptions?: {
|
|
23
|
+
export declare function runGatewayAgent(deps: RunGatewayAgentDeps, message: string, channel: string, chatId: string, origin: TurnOrigin, attachments?: UserTurnAttachment[], thinking?: string, runOptions?: {
|
|
23
24
|
signal?: AbortSignal;
|
|
24
25
|
runId?: string;
|
|
25
26
|
}): AsyncGenerator<RunGatewayAgentYield, {
|
|
@@ -21,14 +21,14 @@ const log = createLogger("Gateway:Service");
|
|
|
21
21
|
/**
|
|
22
22
|
* @param runOptions.signal — When set (e.g. client disconnect), aborts in-flight generation and persists partial output.
|
|
23
23
|
*/
|
|
24
|
-
async function* runGatewayAgent(deps, message, channel, chatId, attachments, thinking, runOptions) {
|
|
24
|
+
async function* runGatewayAgent(deps, message, channel, chatId, origin, attachments, thinking, runOptions) {
|
|
25
25
|
const cappedAttachments = attachments && attachments.length > 10 ? attachments.slice(0, 10) : attachments;
|
|
26
26
|
if (attachments && cappedAttachments && attachments.length > cappedAttachments.length) log.debug({
|
|
27
27
|
dropped: attachments.length - cappedAttachments.length,
|
|
28
28
|
max: 10
|
|
29
29
|
}, "Attachments capped for webchat");
|
|
30
30
|
const runId = runOptions?.runId ?? crypto.randomUUID();
|
|
31
|
-
const { agentService, bus,
|
|
31
|
+
const { agentService, bus, runAbortControllers, activeWebchatRunBySession, sessionIndex: sessionIndexFromDeps, emit, publishRealtime, completeRealtimeTopic } = deps;
|
|
32
32
|
const sessionIndex = sessionIndexFromDeps;
|
|
33
33
|
let taskRun;
|
|
34
34
|
let taskRunStatus = "failed";
|
|
@@ -44,7 +44,6 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
44
44
|
if (!meta) throw new Error("Session not found; create sessions via POST /api/sessions");
|
|
45
45
|
webchatSessionId = meta?.sessionId;
|
|
46
46
|
webchatMetadata = meta;
|
|
47
|
-
runRelay.ensureRun(runId, webchatSessionKey);
|
|
48
47
|
runAbortControllers.set(runId, new AbortController());
|
|
49
48
|
}
|
|
50
49
|
const streamSessionKey = webchatSessionKey ?? chatId;
|
|
@@ -97,16 +96,17 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
97
96
|
}
|
|
98
97
|
if (event.type === "command_completed" && event.payload.exitCode === 0 && /(^|\s)(test|vitest|jest|pytest|lint|typecheck|build)(\s|$|:)/i.test(event.payload.command)) taskRun?.captureCommand(event.payload.command, event.payload.durationMs);
|
|
99
98
|
};
|
|
100
|
-
const publishStreamEvent = (event) => channel === "webchat" ? runRelay.publish(runId, event) ?? event : event;
|
|
101
99
|
const emitAndYield = function* (events) {
|
|
102
100
|
for (const event of events) {
|
|
103
101
|
if (taskRun) captureTaskEvent(event);
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
102
|
+
if (channel === "webchat") {
|
|
103
|
+
publishRealtime(`run:${runId}`, event.type, event);
|
|
104
|
+
if (event.type === "run_start") publishRealtime("sessions", "run.started", {
|
|
105
|
+
sessionKey: streamSessionKey,
|
|
106
|
+
runId
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
yield event;
|
|
110
110
|
}
|
|
111
111
|
};
|
|
112
112
|
yield* emitAndYield(mapper.start());
|
|
@@ -130,7 +130,7 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
130
130
|
}
|
|
131
131
|
let streamError;
|
|
132
132
|
try {
|
|
133
|
-
const eventStream = agentService.turnDispatcher.processDirectStreaming(stampedMessage, sessionKey, prepared, thinking, {
|
|
133
|
+
const eventStream = agentService.turnDispatcher.processDirectStreaming(stampedMessage, sessionKey, origin, prepared, thinking, {
|
|
134
134
|
signal: mergedSignal,
|
|
135
135
|
runId
|
|
136
136
|
});
|
|
@@ -143,7 +143,7 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
143
143
|
taskRunStatus = mergedSignal.aborted ? "cancelled" : "succeeded";
|
|
144
144
|
taskRunSummary = endSummary;
|
|
145
145
|
yield* emitAndYield(mapper.end(endStatus, endSummary));
|
|
146
|
-
|
|
146
|
+
completeRealtimeTopic(`run:${runId}`);
|
|
147
147
|
try {
|
|
148
148
|
const metaAfter = await sessionIndex.getSessionMetadata(sessionKey);
|
|
149
149
|
if (metaAfter?.name) emit("session.updated", {
|
|
@@ -171,7 +171,7 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
171
171
|
const errorContent = formatAgentRunErrorForClient(streamError);
|
|
172
172
|
yield* emitAndYield(mapper.error(errorContent));
|
|
173
173
|
yield* emitAndYield(mapper.end("error", streamError));
|
|
174
|
-
|
|
174
|
+
completeRealtimeTopic(`run:${runId}`);
|
|
175
175
|
return {
|
|
176
176
|
status: "error",
|
|
177
177
|
summary: streamError
|
|
@@ -242,7 +242,10 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
242
242
|
runId,
|
|
243
243
|
sessionKey: streamSessionKey,
|
|
244
244
|
timestamp: Date.now(),
|
|
245
|
-
payload: {
|
|
245
|
+
payload: {
|
|
246
|
+
messageId,
|
|
247
|
+
presentation: "answer"
|
|
248
|
+
}
|
|
246
249
|
}]);
|
|
247
250
|
yield* emitAndYield(mapper.end("success", "Message processed"));
|
|
248
251
|
taskRunStatus = "succeeded";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TurnOrigin } from '@xopcai/endpoint-tools-protocol';
|
|
1
2
|
import type { UserTurnAttachment } from '../user-turn-input.js';
|
|
2
3
|
import { type SessionInputDelivery, type SessionInputState } from '../../storage/sqlite/index.js';
|
|
3
4
|
export type SubmitSessionInput = {
|
|
@@ -7,6 +8,7 @@ export type SubmitSessionInput = {
|
|
|
7
8
|
content: string;
|
|
8
9
|
attachments?: UserTurnAttachment[];
|
|
9
10
|
thinking?: string;
|
|
11
|
+
origin: TurnOrigin;
|
|
10
12
|
};
|
|
11
13
|
export declare class SessionInputCoordinator {
|
|
12
14
|
private readonly deps;
|
|
@@ -20,6 +22,7 @@ export declare class SessionInputCoordinator {
|
|
|
20
22
|
content: string;
|
|
21
23
|
attachments?: UserTurnAttachment[];
|
|
22
24
|
thinking?: string;
|
|
25
|
+
origin: TurnOrigin;
|
|
23
26
|
}) => Promise<{
|
|
24
27
|
status: string;
|
|
25
28
|
summary: string;
|
|
@@ -65,7 +65,7 @@ var SessionInputCoordinator = class {
|
|
|
65
65
|
};
|
|
66
66
|
const attachments = await this.deps.prepareAttachments(sessionKey, input.attachments);
|
|
67
67
|
const runtime = this.snapshot(sessionKey);
|
|
68
|
-
const canSteer = input.delivery === "steer" && runtime.activeRunId !== void 0 && !attachments?.length;
|
|
68
|
+
const canSteer = input.origin.type !== "endpoint" && input.delivery === "steer" && runtime.activeRunId !== void 0 && !attachments?.length;
|
|
69
69
|
const effectiveDelivery = canSteer ? "steer" : "next";
|
|
70
70
|
const row = insertSessionInput({
|
|
71
71
|
id: crypto.randomUUID(),
|
|
@@ -77,6 +77,7 @@ var SessionInputCoordinator = class {
|
|
|
77
77
|
content,
|
|
78
78
|
attachments,
|
|
79
79
|
thinking: input.thinking,
|
|
80
|
+
origin: input.origin,
|
|
80
81
|
targetRunId: canSteer ? runtime.activeRunId : void 0
|
|
81
82
|
});
|
|
82
83
|
if (canSteer) {
|
|
@@ -121,7 +122,8 @@ var SessionInputCoordinator = class {
|
|
|
121
122
|
sessionKey,
|
|
122
123
|
content: input.content,
|
|
123
124
|
attachments: input.attachments,
|
|
124
|
-
thinking: input.thinking
|
|
125
|
+
thinking: input.thinking,
|
|
126
|
+
origin: input.origin
|
|
125
127
|
});
|
|
126
128
|
} catch (error) {
|
|
127
129
|
result = {
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import type { GatewayBindMode } from '../../config/schema.js';
|
|
2
|
-
export interface ServiceEvent {
|
|
3
|
-
id: string;
|
|
4
|
-
type: string;
|
|
5
|
-
payload: unknown;
|
|
6
|
-
}
|
|
7
2
|
/** Phase-1 channel timings (init + optional defer plan + start + inline replay). Emitted as structured logs. */
|
|
8
3
|
export interface GatewayChannelStartupPhase1Metrics {
|
|
9
4
|
deferChannelConnectUntilAfterHttp: boolean;
|
|
@@ -16,11 +16,13 @@ import { listInsights, ProactiveEventService, ProactiveInboxService, ProactiveIn
|
|
|
16
16
|
import { GatewaySessionsApi } from './service/sessions-api.js';
|
|
17
17
|
import { GatewayMarketplaceService } from './service/marketplace-service.js';
|
|
18
18
|
import { GatewayAgentRunner } from './service/agent-runner.js';
|
|
19
|
-
import
|
|
19
|
+
import { RealtimeRuntime } from '../realtime/runtime.js';
|
|
20
|
+
import type { GatewayServiceConfig } from './service/types.js';
|
|
20
21
|
import { type GatewayReadinessSnapshot } from './startup-readiness.js';
|
|
21
22
|
import { type ConnectorLearningCoordinator } from '../connectors/learning-coordinator.js';
|
|
22
23
|
import { type ProductLanguage } from '../voice/language-profile.js';
|
|
23
|
-
|
|
24
|
+
import { EndpointToolRuntime } from '../endpoint-tools/index.js';
|
|
25
|
+
export type { GatewayChannelStartupPhase1Metrics, GatewayChannelStartupPhase2Metrics, GatewayServiceConfig, } from './service/types.js';
|
|
24
26
|
export declare class GatewayService {
|
|
25
27
|
private serviceConfig;
|
|
26
28
|
private bus;
|
|
@@ -45,7 +47,8 @@ export declare class GatewayService {
|
|
|
45
47
|
private readonly configCoordinator;
|
|
46
48
|
private readonly modelCatalogSync;
|
|
47
49
|
private auth;
|
|
48
|
-
|
|
50
|
+
readonly endpointTools: EndpointToolRuntime;
|
|
51
|
+
readonly realtime: RealtimeRuntime;
|
|
49
52
|
getConfig(): Config;
|
|
50
53
|
getModelCatalogSync(): ModelCatalogSyncService;
|
|
51
54
|
get browserRecipes(): BrowserRecipeService;
|
|
@@ -69,6 +72,7 @@ export declare class GatewayService {
|
|
|
69
72
|
private connectedKnowledgeCoordinator;
|
|
70
73
|
private stopAutomationProductEventBridge;
|
|
71
74
|
private stopSessionTranscriptAutomationEvents;
|
|
75
|
+
private stopRealtimeLogBridge;
|
|
72
76
|
/**
|
|
73
77
|
* Webchat agent invocation surface (`runAgent`, `abortAgentRun`, `steer*`,
|
|
74
78
|
* `submitClarifyResponse`, clarify-bridge dispatch). Owns the
|
|
@@ -303,12 +307,9 @@ export declare class GatewayService {
|
|
|
303
307
|
private collectWorkflowAgentIds;
|
|
304
308
|
/** Process a message directly through the agent (for CLI mode). */
|
|
305
309
|
processDirect(content: string, sessionKey?: string): Promise<string>;
|
|
306
|
-
subscribe(sessionId: string, listener: (event: ServiceEvent) => Promise<void> | void): () => void;
|
|
307
310
|
emit(type: string, payload: unknown): void;
|
|
308
311
|
private handleAutomationRunCompleted;
|
|
309
312
|
private startAutomationProductEventBridge;
|
|
310
|
-
/** Replay events since `lastEventId` for SSE reconnection. */
|
|
311
|
-
getEventsSince(sessionId: string, lastEventId: string): ServiceEvent[];
|
|
312
313
|
/**
|
|
313
314
|
* Validate authentication token from request headers.
|
|
314
315
|
* Returns true if auth is disabled (mode: 'none') or token is valid.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __toCommonJS } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { PACKAGE_VERSION, init_package_version } from "../package-version.js";
|
|
3
3
|
import { getLogDir } from "../utils/logger/config.js";
|
|
4
|
+
import { init_log_stream, subscribeToLogs } from "../utils/logger/log-stream.js";
|
|
4
5
|
import { getRuntimeLogStats } from "../utils/logger/stats.js";
|
|
5
6
|
import { createLogger } from "../utils/logger/index.js";
|
|
6
7
|
import { init_logger } from "../utils/logger.js";
|
|
@@ -18,6 +19,7 @@ import { loadConfig, saveConfig } from "../config/loader.js";
|
|
|
18
19
|
import { prewarmModelRegistry } from "../providers/model-registry.js";
|
|
19
20
|
import { init_providers, providers_exports } from "../providers/index.js";
|
|
20
21
|
import { TaskRepository } from "../tasks/task-repository.js";
|
|
22
|
+
import { disposeAllSessionMcpRuntimes } from "../agent/mcp/bundle-mcp-runtime.js";
|
|
21
23
|
import { resolveEffectiveGatewayPort } from "./host.js";
|
|
22
24
|
import { AutomationService } from "../automations/service/automation-service.js";
|
|
23
25
|
import { onAutomationProductEvent, publishAutomationProductEvent } from "../automations/product-events.js";
|
|
@@ -36,7 +38,6 @@ import { TaskOutboxDispatcher } from "../tasks/task-outbox-dispatcher.js";
|
|
|
36
38
|
import { TaskRunDispatcher } from "../tasks/task-run-dispatcher.js";
|
|
37
39
|
import { TaskSignalService } from "../tasks/task-signal-service.js";
|
|
38
40
|
import "../tasks/index.js";
|
|
39
|
-
import { disposeAllSessionMcpRuntimes } from "../agent/mcp/bundle-mcp-runtime.js";
|
|
40
41
|
import "../agent/mcp/bundle-mcp-tools.js";
|
|
41
42
|
import { onSessionTranscriptUpdate } from "../session/transcript-events.js";
|
|
42
43
|
import { SessionIndex } from "../session/manager.js";
|
|
@@ -63,6 +64,8 @@ import { DiscussionLiveWorker } from "../discussions/live-worker.js";
|
|
|
63
64
|
import { DiscussionOrganizerWorker } from "../discussions/organizer-worker.js";
|
|
64
65
|
import { DiscussionSealer } from "../discussions/sealer.js";
|
|
65
66
|
import "../discussions/index.js";
|
|
67
|
+
import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
|
|
68
|
+
import "../endpoint-tools/index.js";
|
|
66
69
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
67
70
|
import { reconcileDreamingAutomations } from "./dreaming-automation-reconciler.js";
|
|
68
71
|
import { NotesStore } from "../notes/store.js";
|
|
@@ -102,7 +105,7 @@ import { GatewaySessionsApi } from "./service/sessions-api.js";
|
|
|
102
105
|
import { GatewayMarketplaceService } from "./service/marketplace-service.js";
|
|
103
106
|
import { GatewayConfigCoordinator } from "./service/config-coordinator.js";
|
|
104
107
|
import { GatewayAgentRunner } from "./service/agent-runner.js";
|
|
105
|
-
import {
|
|
108
|
+
import { RealtimeRuntime } from "../realtime/runtime.js";
|
|
106
109
|
import { GatewayReadiness } from "./startup-readiness.js";
|
|
107
110
|
import { createGatewayStartupTrace } from "./startup-trace.js";
|
|
108
111
|
import { applyAutomaticVoiceLanguage, inferProductLanguageFromEnvironment, initializeVoiceDefaults, prepareConfiguredLocalVoiceModel } from "../voice/language-profile.js";
|
|
@@ -113,6 +116,7 @@ init_channel_catalog_service();
|
|
|
113
116
|
init_schema();
|
|
114
117
|
init_providers();
|
|
115
118
|
init_logger();
|
|
119
|
+
init_log_stream();
|
|
116
120
|
init_paths();
|
|
117
121
|
init_package_version();
|
|
118
122
|
init_resolve_route();
|
|
@@ -144,7 +148,8 @@ var GatewayService = class {
|
|
|
144
148
|
getConfig: () => this.config
|
|
145
149
|
});
|
|
146
150
|
auth;
|
|
147
|
-
|
|
151
|
+
endpointTools = new EndpointToolRuntime();
|
|
152
|
+
realtime = new RealtimeRuntime(this.endpointTools);
|
|
148
153
|
getConfig() {
|
|
149
154
|
return this.config;
|
|
150
155
|
}
|
|
@@ -178,6 +183,7 @@ var GatewayService = class {
|
|
|
178
183
|
connectedKnowledgeCoordinator = null;
|
|
179
184
|
stopAutomationProductEventBridge = null;
|
|
180
185
|
stopSessionTranscriptAutomationEvents = null;
|
|
186
|
+
stopRealtimeLogBridge = null;
|
|
181
187
|
/**
|
|
182
188
|
* Webchat agent invocation surface (`runAgent`, `abortAgentRun`, `steer*`,
|
|
183
189
|
* `submitClarifyResponse`, clarify-bridge dispatch). Owns the
|
|
@@ -220,7 +226,7 @@ var GatewayService = class {
|
|
|
220
226
|
this.proactiveWorker = new ProactiveWorker(new ReadonlyProactiveAgentExecutor(() => this.config));
|
|
221
227
|
this.proactiveTemporalWorker = new ProactiveTemporalWorker(this.proactive);
|
|
222
228
|
this.proactiveInboxWorker = new ProactiveInboxWorker({ deliver: async ({ inboxItem }) => {
|
|
223
|
-
this.
|
|
229
|
+
this.emit("proactive.inbox.created", inboxItem);
|
|
224
230
|
await this.createMobileNotificationService().deliverGatewayEvent("proactive.inbox.created", inboxItem);
|
|
225
231
|
} });
|
|
226
232
|
let bootstrapConfigChanged = initializeVoiceDefaults(this.config, inferProductLanguageFromEnvironment());
|
|
@@ -280,10 +286,10 @@ var GatewayService = class {
|
|
|
280
286
|
this.notesService = new NotesService(new NotesStore());
|
|
281
287
|
this.projects = new ProjectService(void 0, this.proactive);
|
|
282
288
|
const emitDiscussion = (capture) => {
|
|
283
|
-
this.
|
|
289
|
+
this.emit("discussion.updated", capture);
|
|
284
290
|
};
|
|
285
291
|
this.discussions = new DiscussionService(this.notesService, this.projects, (type, payload) => {
|
|
286
|
-
this.
|
|
292
|
+
this.emit(type, payload);
|
|
287
293
|
});
|
|
288
294
|
this.discussionWorker = new DiscussionOrganizerWorker(new DiscussionOrganizer({
|
|
289
295
|
notes: this.notesService,
|
|
@@ -302,7 +308,7 @@ var GatewayService = class {
|
|
|
302
308
|
riskCount: organization.risks.length,
|
|
303
309
|
openQuestionCount: organization.openQuestions.length
|
|
304
310
|
};
|
|
305
|
-
this.
|
|
311
|
+
this.emit("discussion.completed", payload);
|
|
306
312
|
publishAutomationProductEvent({
|
|
307
313
|
type: "discussion.completed",
|
|
308
314
|
source: "discussions",
|
|
@@ -321,7 +327,7 @@ var GatewayService = class {
|
|
|
321
327
|
const transcript = this.discussions.transcript(segment.discussionId);
|
|
322
328
|
capture.then((detail) => {
|
|
323
329
|
if (!detail || !transcript) return;
|
|
324
|
-
this.
|
|
330
|
+
this.emit("discussion.segment.updated", {
|
|
325
331
|
discussionId: segment.discussionId,
|
|
326
332
|
noteId: detail.discussion.noteId,
|
|
327
333
|
transcriptRevision: transcript.revision,
|
|
@@ -351,7 +357,11 @@ var GatewayService = class {
|
|
|
351
357
|
getAgentService: () => this.ensureAgentService(),
|
|
352
358
|
getChannelManager: () => this.channelManager,
|
|
353
359
|
getConfig: () => this.config,
|
|
354
|
-
emit: (type, payload) => this.
|
|
360
|
+
emit: (type, payload) => this.emit(type, payload),
|
|
361
|
+
publishRealtime: (topic, event, data) => {
|
|
362
|
+
this.realtime.broker.publish(topic, event, data);
|
|
363
|
+
},
|
|
364
|
+
completeRealtimeTopic: (topic) => this.realtime.completeTopic(topic)
|
|
355
365
|
});
|
|
356
366
|
this.sessions = new GatewaySessionsApi({
|
|
357
367
|
sessionIndex: this.sessionIndex,
|
|
@@ -422,6 +432,7 @@ var GatewayService = class {
|
|
|
422
432
|
});
|
|
423
433
|
},
|
|
424
434
|
extensionRegistry: this.extensionLoader?.getRegistry(),
|
|
435
|
+
endpointTools: this.endpointTools,
|
|
425
436
|
getAutomationService: () => this.automationService,
|
|
426
437
|
getBrowserRecipeService: () => this.browserRecipes,
|
|
427
438
|
getNotesService: () => this.notesService,
|
|
@@ -444,8 +455,8 @@ var GatewayService = class {
|
|
|
444
455
|
gatewayClarify: { requestClarification: (sessionKey, request) => this.agentRunner.requestClarification({
|
|
445
456
|
sessionKey,
|
|
446
457
|
request,
|
|
447
|
-
|
|
448
|
-
this._agentService.turnDispatcher.
|
|
458
|
+
publishStreamFor: (_runId) => (event) => {
|
|
459
|
+
this._agentService.turnDispatcher.enqueueWebchatStreamEvent(sessionKey, event);
|
|
449
460
|
}
|
|
450
461
|
}) }
|
|
451
462
|
});
|
|
@@ -542,7 +553,10 @@ var GatewayService = class {
|
|
|
542
553
|
return sessionKey;
|
|
543
554
|
},
|
|
544
555
|
runAgent: async (runId, sessionKey, message) => {
|
|
545
|
-
const stream = this.agentRunner.runAgent(message, "webchat", sessionKey,
|
|
556
|
+
const stream = this.agentRunner.runAgent(message, "webchat", sessionKey, {
|
|
557
|
+
type: "system",
|
|
558
|
+
source: "workflow"
|
|
559
|
+
}, void 0, void 0, { runId });
|
|
546
560
|
while (!(await stream.next()).done);
|
|
547
561
|
}
|
|
548
562
|
});
|
|
@@ -694,6 +708,9 @@ var GatewayService = class {
|
|
|
694
708
|
}
|
|
695
709
|
async start() {
|
|
696
710
|
if (this.running) return;
|
|
711
|
+
this.stopRealtimeLogBridge = subscribeToLogs((entry) => {
|
|
712
|
+
this.realtime.broker.publish("logs", "log.entry", entry);
|
|
713
|
+
});
|
|
697
714
|
setPairingBroadcastSink((type, payload) => {
|
|
698
715
|
this.emit(type, payload);
|
|
699
716
|
});
|
|
@@ -966,8 +983,12 @@ var GatewayService = class {
|
|
|
966
983
|
async stop() {
|
|
967
984
|
if (!this.running) return;
|
|
968
985
|
setPairingBroadcastSink(null);
|
|
986
|
+
this.stopRealtimeLogBridge?.();
|
|
987
|
+
this.stopRealtimeLogBridge = null;
|
|
969
988
|
log.debug("Stopping gateway service...");
|
|
970
989
|
this.readiness.markStarting();
|
|
990
|
+
this.endpointTools.close();
|
|
991
|
+
this.realtime.close();
|
|
971
992
|
await this.proactiveWorker.stop();
|
|
972
993
|
await this.discussionWorker.stop();
|
|
973
994
|
await this.discussionSealer.stop();
|
|
@@ -1408,13 +1429,13 @@ var GatewayService = class {
|
|
|
1408
1429
|
}
|
|
1409
1430
|
/** Process a message directly through the agent (for CLI mode). */
|
|
1410
1431
|
async processDirect(content, sessionKey = "agent:main:main") {
|
|
1411
|
-
return this.agentService.turnDispatcher.processDirect(content, sessionKey
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1432
|
+
return this.agentService.turnDispatcher.processDirect(content, sessionKey, {
|
|
1433
|
+
type: "system",
|
|
1434
|
+
source: "internal"
|
|
1435
|
+
});
|
|
1415
1436
|
}
|
|
1416
1437
|
emit(type, payload) {
|
|
1417
|
-
this.
|
|
1438
|
+
this.realtime.broker.publish("gateway", type, payload);
|
|
1418
1439
|
this.createMobileNotificationService().handleGatewayEvent(type, payload);
|
|
1419
1440
|
}
|
|
1420
1441
|
handleAutomationRunCompleted(run) {
|
|
@@ -1424,7 +1445,7 @@ var GatewayService = class {
|
|
|
1424
1445
|
this.stopAutomationProductEventBridge?.();
|
|
1425
1446
|
this.stopSessionTranscriptAutomationEvents?.();
|
|
1426
1447
|
this.stopAutomationProductEventBridge = onAutomationProductEvent((event) => {
|
|
1427
|
-
if (event.type.startsWith("task.")) this.
|
|
1448
|
+
if (event.type.startsWith("task.")) this.emit(event.type, event.payload);
|
|
1428
1449
|
const proactiveEvent = mapProductEventToProactive({
|
|
1429
1450
|
event,
|
|
1430
1451
|
workspaceId: this.currentWorkspacePath,
|
|
@@ -1462,10 +1483,6 @@ var GatewayService = class {
|
|
|
1462
1483
|
});
|
|
1463
1484
|
});
|
|
1464
1485
|
}
|
|
1465
|
-
/** Replay events since `lastEventId` for SSE reconnection. */
|
|
1466
|
-
getEventsSince(sessionId, lastEventId) {
|
|
1467
|
-
return this.sse.getEventsSince(sessionId, lastEventId);
|
|
1468
|
-
}
|
|
1469
1486
|
/**
|
|
1470
1487
|
* Validate authentication token from request headers.
|
|
1471
1488
|
* Returns true if auth is disabled (mode: 'none') or token is valid.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, shouldSilence, stripHeartbeatToken } from "./tokens.js";
|
|
2
|
-
import { appendCronEventLines } from "./event-prompt.js";
|
|
3
2
|
import { isWithinActiveHours } from "./active-hours.js";
|
|
4
3
|
import { isHeartbeatContentEmpty } from "./content-check.js";
|
|
4
|
+
import { appendCronEventLines } from "./event-prompt.js";
|
|
5
5
|
import { createHeartbeatWake } from "./wake.js";
|
|
6
6
|
export { DEFAULT_ACK_MAX_CHARS, HEARTBEAT_OK, NO_REPLY, appendCronEventLines, createHeartbeatWake, isHeartbeatContentEmpty, isWithinActiveHours, shouldSilence, stripHeartbeatToken };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Config } from '../config/schema.js';
|
|
2
|
-
import type { ApprovalDecision, ApprovalKind,
|
|
3
|
-
import {
|
|
2
|
+
import type { ApprovalDecision, ApprovalKind, ConversationDescriptor, PendingApproval, QueueEvent, WaitFilter } from './channel-shared.js';
|
|
3
|
+
import type { GatewayCredential } from '../gateway/credential.js';
|
|
4
4
|
export declare class XopcChannelBridge {
|
|
5
5
|
private readonly cfg;
|
|
6
6
|
private readonly params;
|
|
@@ -9,19 +9,16 @@ export declare class XopcChannelBridge {
|
|
|
9
9
|
private readonly pendingApprovals;
|
|
10
10
|
private cursor;
|
|
11
11
|
private closed;
|
|
12
|
-
private
|
|
12
|
+
private readonly realtimeClientId;
|
|
13
|
+
private realtime;
|
|
13
14
|
constructor(cfg: Config, params: {
|
|
14
15
|
gatewayUrl?: string;
|
|
15
16
|
gatewayCredential?: GatewayCredential;
|
|
16
|
-
claudeChannelMode: ClaudeChannelMode;
|
|
17
|
-
verbose: boolean;
|
|
18
17
|
});
|
|
19
|
-
setServer(_server: unknown): void;
|
|
20
18
|
start(): Promise<void>;
|
|
21
19
|
close(): Promise<void>;
|
|
22
|
-
private
|
|
23
|
-
private
|
|
24
|
-
private handleSseChunk;
|
|
20
|
+
private connectRealtime;
|
|
21
|
+
private handleRealtimeEvent;
|
|
25
22
|
private enqueueFromBroadcast;
|
|
26
23
|
private pushEvent;
|
|
27
24
|
listConversations(args: {
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { init_loader, loadConfig } from "../config/loader.js";
|
|
4
|
-
import {
|
|
5
|
-
import { loadUndiciRuntimeDeps } from "../infra/undici-fetch.js";
|
|
4
|
+
import { RealtimeClient } from "../../packages/realtime-client/src/index.js";
|
|
6
5
|
import { toConversation } from "./channel-shared.js";
|
|
7
6
|
import { createGatewayHttpClientFromConfig, resolveGatewayHttpBaseUrl } from "./gateway-http-client.js";
|
|
7
|
+
import { createRequire } from "node:module";
|
|
8
8
|
import crypto from "node:crypto";
|
|
9
9
|
//#region src/mcp/channel-bridge.ts
|
|
10
10
|
init_loader();
|
|
11
11
|
init_logger();
|
|
12
12
|
const log = createLogger("Mcp:Bridge");
|
|
13
|
+
const { WebSocket } = createRequire(import.meta.url)("ws");
|
|
13
14
|
const QUEUE_LIMIT = 1e3;
|
|
14
15
|
var XopcChannelBridge = class {
|
|
15
16
|
client = null;
|
|
@@ -17,12 +18,12 @@ var XopcChannelBridge = class {
|
|
|
17
18
|
pendingApprovals = /* @__PURE__ */ new Map();
|
|
18
19
|
cursor = 0;
|
|
19
20
|
closed = false;
|
|
20
|
-
|
|
21
|
+
realtimeClientId = `mcp-${crypto.randomUUID()}`;
|
|
22
|
+
realtime = null;
|
|
21
23
|
constructor(cfg, params) {
|
|
22
24
|
this.cfg = cfg;
|
|
23
25
|
this.params = params;
|
|
24
26
|
}
|
|
25
|
-
setServer(_server) {}
|
|
26
27
|
async start() {
|
|
27
28
|
log.info({ phase: "mcp.bridge.connect" }, "MCP channel bridge starting");
|
|
28
29
|
this.client = createGatewayHttpClientFromConfig({
|
|
@@ -30,7 +31,7 @@ var XopcChannelBridge = class {
|
|
|
30
31
|
gatewayUrl: this.params.gatewayUrl,
|
|
31
32
|
gatewayCredential: this.params.gatewayCredential
|
|
32
33
|
});
|
|
33
|
-
this.
|
|
34
|
+
this.connectRealtime();
|
|
34
35
|
}
|
|
35
36
|
async close() {
|
|
36
37
|
log.info({
|
|
@@ -38,84 +39,55 @@ var XopcChannelBridge = class {
|
|
|
38
39
|
queueSize: this.queue.length
|
|
39
40
|
}, "MCP channel bridge closing");
|
|
40
41
|
this.closed = true;
|
|
41
|
-
this.
|
|
42
|
-
this.
|
|
42
|
+
this.realtime?.disconnect();
|
|
43
|
+
this.realtime = null;
|
|
43
44
|
this.queue.length = 0;
|
|
44
45
|
this.pendingApprovals.clear();
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
+
connectRealtime() {
|
|
47
48
|
if (this.closed) return;
|
|
48
|
-
this.eventsAbort?.abort();
|
|
49
|
-
const abort = new AbortController();
|
|
50
|
-
this.eventsAbort = abort;
|
|
51
49
|
const baseUrl = resolveGatewayHttpBaseUrl(this.cfg, this.params.gatewayUrl);
|
|
52
|
-
this.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
50
|
+
this.realtime?.disconnect();
|
|
51
|
+
this.realtime = new RealtimeClient({
|
|
52
|
+
clientId: this.realtimeClientId,
|
|
53
|
+
clientKind: "mcp",
|
|
54
|
+
getWebSocketUrl: () => {
|
|
55
|
+
const url = new URL(baseUrl);
|
|
56
|
+
url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
|
|
57
|
+
url.pathname = "/api/realtime/v1/ws";
|
|
58
|
+
url.search = "";
|
|
59
|
+
url.hash = "";
|
|
60
|
+
return url.toString();
|
|
61
|
+
},
|
|
62
|
+
issueTicket: async () => {
|
|
63
|
+
const response = await this.client.postJson("/api/realtime/tickets", {
|
|
64
|
+
clientId: this.realtimeClientId,
|
|
65
|
+
clientKind: "mcp"
|
|
66
|
+
});
|
|
67
|
+
if (!response.payload?.ticket) throw new Error(response.error?.message ?? "Realtime ticket response is invalid");
|
|
68
|
+
return response.payload.ticket;
|
|
69
|
+
},
|
|
70
|
+
createWebSocket: (url) => new WebSocket(url),
|
|
71
|
+
onEvent: (event) => this.handleRealtimeEvent(event),
|
|
72
|
+
onStateChange: (state, error) => {
|
|
73
|
+
if (state === "error") log.warn({
|
|
74
|
+
errorMessage: error,
|
|
75
|
+
phase: "mcp.bridge.realtime",
|
|
69
76
|
baseUrl
|
|
70
|
-
}, `Gateway
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
const reader = res.body.getReader();
|
|
74
|
-
const decoder = new TextDecoder();
|
|
75
|
-
let buffer = "";
|
|
76
|
-
while (!this.closed && !signal.aborted) {
|
|
77
|
-
const { done, value } = await reader.read();
|
|
78
|
-
if (done) break;
|
|
79
|
-
buffer += decoder.decode(value, { stream: true });
|
|
80
|
-
let splitAt = buffer.indexOf("\n\n");
|
|
81
|
-
while (splitAt >= 0) {
|
|
82
|
-
this.handleSseChunk(buffer.slice(0, splitAt));
|
|
83
|
-
buffer = buffer.slice(splitAt + 2);
|
|
84
|
-
splitAt = buffer.indexOf("\n\n");
|
|
85
|
-
}
|
|
77
|
+
}, `Gateway realtime connection failed: ${error ?? "unknown error"}`);
|
|
86
78
|
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
handleSseChunk(chunk) {
|
|
102
|
-
let eventName = "message";
|
|
103
|
-
let data = "";
|
|
104
|
-
for (const line of chunk.split("\n")) if (line.startsWith("event:")) eventName = line.slice(6).trim();
|
|
105
|
-
else if (line.startsWith("data:")) data += line.slice(5).trim();
|
|
106
|
-
if (!data) return;
|
|
107
|
-
try {
|
|
108
|
-
const parsed = JSON.parse(data);
|
|
109
|
-
this.enqueueFromBroadcast({
|
|
110
|
-
type: eventName,
|
|
111
|
-
...parsed
|
|
112
|
-
});
|
|
113
|
-
} catch {
|
|
114
|
-
this.enqueueFromBroadcast({
|
|
115
|
-
type: eventName,
|
|
116
|
-
raw: data
|
|
117
|
-
});
|
|
118
|
-
}
|
|
79
|
+
});
|
|
80
|
+
this.realtime.subscribe("gateway");
|
|
81
|
+
this.realtime.subscribe("sessions");
|
|
82
|
+
this.realtime.connect();
|
|
83
|
+
}
|
|
84
|
+
handleRealtimeEvent(event) {
|
|
85
|
+
if (event.topic !== "gateway" && event.topic !== "sessions") return;
|
|
86
|
+
const data = event.data && typeof event.data === "object" && !Array.isArray(event.data) ? event.data : { raw: event.data };
|
|
87
|
+
this.enqueueFromBroadcast({
|
|
88
|
+
...data,
|
|
89
|
+
type: event.event
|
|
90
|
+
});
|
|
119
91
|
}
|
|
120
92
|
enqueueFromBroadcast(data) {
|
|
121
93
|
const type = String(data.type ?? data.event ?? "");
|