@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
|
@@ -11,6 +11,7 @@ var ExtensionRegistryImpl = class {
|
|
|
11
11
|
services = /* @__PURE__ */ new Map();
|
|
12
12
|
gatewayMethods = /* @__PURE__ */ new Map();
|
|
13
13
|
tools = /* @__PURE__ */ new Map();
|
|
14
|
+
toolExtensionIds = /* @__PURE__ */ new Map();
|
|
14
15
|
channelPlugins = [];
|
|
15
16
|
cliRegistrations = [];
|
|
16
17
|
reloadRegistrations = [];
|
|
@@ -64,12 +65,14 @@ var ExtensionRegistryImpl = class {
|
|
|
64
65
|
getGatewayMethod(method) {
|
|
65
66
|
return this.gatewayMethods.get(method);
|
|
66
67
|
}
|
|
67
|
-
addTool(tool) {
|
|
68
|
+
addTool(tool, extensionId) {
|
|
68
69
|
if (this.tools.has(tool.name)) log.warn({ tool: tool.name }, `Tool already registered, overwriting`);
|
|
69
70
|
this.tools.set(tool.name, tool);
|
|
71
|
+
this.toolExtensionIds.set(tool.name, extensionId);
|
|
70
72
|
}
|
|
71
73
|
removeTool(name) {
|
|
72
74
|
this.tools.delete(name);
|
|
75
|
+
this.toolExtensionIds.delete(name);
|
|
73
76
|
}
|
|
74
77
|
getTools() {
|
|
75
78
|
return this.tools;
|
|
@@ -77,6 +80,9 @@ var ExtensionRegistryImpl = class {
|
|
|
77
80
|
getTool(name) {
|
|
78
81
|
return this.tools.get(name);
|
|
79
82
|
}
|
|
83
|
+
getToolExtensionId(name) {
|
|
84
|
+
return this.toolExtensionIds.get(name);
|
|
85
|
+
}
|
|
80
86
|
getAllTools() {
|
|
81
87
|
return Array.from(this.tools.values());
|
|
82
88
|
}
|
|
@@ -441,7 +441,7 @@ var ExtensionLoader = class {
|
|
|
441
441
|
source: config.source
|
|
442
442
|
});
|
|
443
443
|
const extensionTools = api._getTools();
|
|
444
|
-
for (const tool of extensionTools.values()) this.registry.addTool(tool);
|
|
444
|
+
for (const tool of extensionTools.values()) this.registry.addTool(tool, config.id);
|
|
445
445
|
this.extensionInstances.set(config.id, api);
|
|
446
446
|
this.cache.set(cacheKey, api);
|
|
447
447
|
this.diagnostics.info(config.id, `Loaded extension: ${manifest.name}`);
|
|
@@ -237,9 +237,10 @@ export interface ExtensionService {
|
|
|
237
237
|
stop?: () => void | Promise<void>;
|
|
238
238
|
}
|
|
239
239
|
export interface ExtensionRegistry {
|
|
240
|
-
addTool(tool: AgentTool): void;
|
|
240
|
+
addTool(tool: AgentTool, extensionId: string): void;
|
|
241
241
|
getTools(): Map<string, AgentTool>;
|
|
242
242
|
getTool(name: string): AgentTool | undefined;
|
|
243
|
+
getToolExtensionId(name: string): string | undefined;
|
|
243
244
|
getAllTools(): AgentTool[];
|
|
244
245
|
getCommand(name: string): ExtensionCommand | undefined;
|
|
245
246
|
addCliRegistration(reg: ExtensionCliRegistration): void;
|
|
@@ -246,7 +246,7 @@ export interface WebchatTurnCompleteEvent extends HookContext {
|
|
|
246
246
|
inboundUserText: string;
|
|
247
247
|
/** Last assistant visible text after persistence (may be empty). */
|
|
248
248
|
assistantPlainText: string;
|
|
249
|
-
/** User aborted the
|
|
249
|
+
/** User aborted the realtime run. */
|
|
250
250
|
aborted: boolean;
|
|
251
251
|
/** Set when the direct stream threw before normal completion. */
|
|
252
252
|
streamError?: string;
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* Built-in agent tool `name` values for gateway admin UI (disable toggles).
|
|
3
3
|
* Extension tools are not listed; users can still add arbitrary strings in config.
|
|
4
4
|
*/
|
|
5
|
-
export declare const GATEWAY_BUILTIN_TOOL_IDS: readonly ["code_search", "code_read_symbol", "code_trace", "code_impact", "code_architecture", "read_file", "write_file", "apply_patch", "list_dir", "grep", "find", "exec_command", "update_plan", "session_status", "dreaming", "tool_manual", "clarify", "todo", "skills_list", "skill_view", "skill_manage", "skills_marketplace_search", "skill_install", "web_search", "web_fetch", "web_extract", "send_message", "send_media", "read_media", "create_share", "text_to_speech", "memory_search", "memory_get", "session_search", "automation", "workflow", "delegate_task", "execute_code", "image", "image_generate", "create_desktop_pet", "browser_use", "
|
|
5
|
+
export declare const GATEWAY_BUILTIN_TOOL_IDS: readonly ["code_search", "code_read_symbol", "code_trace", "code_impact", "code_architecture", "read_file", "write_file", "apply_patch", "list_dir", "grep", "find", "exec_command", "update_plan", "session_status", "dreaming", "tool_manual", "clarify", "todo", "skills_list", "skill_view", "skill_manage", "skills_marketplace_search", "skill_install", "web_search", "web_fetch", "web_extract", "send_message", "send_media", "read_media", "create_share", "text_to_speech", "memory_search", "memory_get", "session_search", "automation", "workflow", "delegate_task", "execute_code", "image", "image_generate", "create_desktop_pet", "browser_use", "xopc_tool_search", "xopc_tool_describe", "xopc_tool_execute"];
|
|
6
6
|
export type GatewayBuiltinToolId = (typeof GATEWAY_BUILTIN_TOOL_IDS)[number];
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { EXTERNAL_TOOL_NAMES } from "../agent/external-tools/gateway-tools.js";
|
|
2
|
+
import "../agent/external-tools/index.js";
|
|
1
3
|
//#region src/gateway/agent-builtin-tools.ts
|
|
2
4
|
/**
|
|
3
5
|
* Built-in agent tool `name` values for gateway admin UI (disable toggles).
|
|
@@ -46,8 +48,9 @@ const GATEWAY_BUILTIN_TOOL_IDS = [
|
|
|
46
48
|
"image_generate",
|
|
47
49
|
"create_desktop_pet",
|
|
48
50
|
"browser_use",
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
EXTERNAL_TOOL_NAMES.search,
|
|
52
|
+
EXTERNAL_TOOL_NAMES.describe,
|
|
53
|
+
EXTERNAL_TOOL_NAMES.execute
|
|
51
54
|
];
|
|
52
55
|
//#endregion
|
|
53
56
|
export { GATEWAY_BUILTIN_TOOL_IDS };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { resolveToolActivity } from "../../../packages/gateway-contract/src/tool-activity.js";
|
|
1
2
|
import { createPetFeedback } from "./pet-feedback.js";
|
|
2
3
|
//#region src/gateway/chat-stream/mapper.ts
|
|
3
4
|
let lastTaskPlanRevision = 0;
|
|
@@ -252,6 +253,7 @@ var ChatStreamMapper = class {
|
|
|
252
253
|
}
|
|
253
254
|
events.push(this.make("assistant_message_end", {
|
|
254
255
|
messageId,
|
|
256
|
+
presentation: hasToolCall(message) ? "narration" : "answer",
|
|
255
257
|
usage: extractUsage(message)
|
|
256
258
|
}));
|
|
257
259
|
this.lastAssistantMessageId = messageId;
|
|
@@ -270,7 +272,8 @@ var ChatStreamMapper = class {
|
|
|
270
272
|
messageId,
|
|
271
273
|
toolCallId,
|
|
272
274
|
toolName,
|
|
273
|
-
args: event.args
|
|
275
|
+
args: event.args,
|
|
276
|
+
activity: resolveToolActivity(toolName, "running")
|
|
274
277
|
})];
|
|
275
278
|
if (toolName === "exec_command") {
|
|
276
279
|
const args = asRecord(event.args);
|
|
@@ -324,6 +327,7 @@ var ChatStreamMapper = class {
|
|
|
324
327
|
toolCallId,
|
|
325
328
|
toolName,
|
|
326
329
|
status: event.isError ? "error" : "success",
|
|
330
|
+
activity: resolveToolActivity(toolName, event.isError ? "failed" : "completed", result),
|
|
327
331
|
result,
|
|
328
332
|
errorMessage: event.isError ? result?.text : void 0
|
|
329
333
|
})];
|
|
@@ -431,6 +435,17 @@ function userMessageFromEvent(event) {
|
|
|
431
435
|
function extractTextFromMessage(message) {
|
|
432
436
|
return extractText(message.content);
|
|
433
437
|
}
|
|
438
|
+
function hasToolCall(message) {
|
|
439
|
+
const raw = message;
|
|
440
|
+
if (Array.isArray(raw.toolCalls) && raw.toolCalls.length > 0) return true;
|
|
441
|
+
if (Array.isArray(raw.tool_calls) && raw.tool_calls.length > 0) return true;
|
|
442
|
+
if (!Array.isArray(raw.content)) return false;
|
|
443
|
+
return raw.content.some((block) => {
|
|
444
|
+
if (!block || typeof block !== "object") return false;
|
|
445
|
+
const type = block.type;
|
|
446
|
+
return type === "toolCall" || type === "tool_call" || type === "tool_use";
|
|
447
|
+
});
|
|
448
|
+
}
|
|
434
449
|
function extractReview(message) {
|
|
435
450
|
const metadata = message.metadata;
|
|
436
451
|
const metadataReview = asRecord(metadata)?.review;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ToolActivity } from '@xopcai/gateway-contract';
|
|
1
2
|
export type ChatStreamStatus = 'success' | 'error' | 'cancelled';
|
|
2
3
|
export type PetFeedbackTaskState = 'working' | 'waiting' | 'success' | 'error';
|
|
3
4
|
export type PetFeedbackSensitivity = 'public' | 'private';
|
|
@@ -23,7 +24,6 @@ export type PetFeedback = {
|
|
|
23
24
|
};
|
|
24
25
|
export interface ChatStreamEnvelope<TType extends string, TPayload> {
|
|
25
26
|
type: TType;
|
|
26
|
-
seq?: number;
|
|
27
27
|
runId: string;
|
|
28
28
|
sessionKey: string;
|
|
29
29
|
timestamp: number;
|
|
@@ -58,6 +58,7 @@ export type ToolStartEvent = ChatStreamEnvelope<'tool_start', {
|
|
|
58
58
|
toolCallId: string;
|
|
59
59
|
toolName: string;
|
|
60
60
|
args?: unknown;
|
|
61
|
+
activity: ToolActivity;
|
|
61
62
|
}>;
|
|
62
63
|
export type ToolUpdateEvent = ChatStreamEnvelope<'tool_update', {
|
|
63
64
|
messageId: string;
|
|
@@ -71,6 +72,7 @@ export type ToolEndEvent = ChatStreamEnvelope<'tool_end', {
|
|
|
71
72
|
toolCallId: string;
|
|
72
73
|
toolName: string;
|
|
73
74
|
status: ChatStreamStatus;
|
|
75
|
+
activity: ToolActivity;
|
|
74
76
|
result?: {
|
|
75
77
|
content?: unknown[];
|
|
76
78
|
details?: unknown;
|
|
@@ -163,6 +165,7 @@ export type ReviewEvent = ChatStreamEnvelope<'review', {
|
|
|
163
165
|
}>;
|
|
164
166
|
export type AssistantMessageEndEvent = ChatStreamEnvelope<'assistant_message_end', {
|
|
165
167
|
messageId: string;
|
|
168
|
+
presentation: 'narration' | 'answer';
|
|
166
169
|
usage?: {
|
|
167
170
|
inputTokens?: number;
|
|
168
171
|
outputTokens?: number;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
export type ClarifyStreamEvent = {
|
|
2
|
+
type: string;
|
|
3
|
+
} & Record<string, unknown>;
|
|
2
4
|
/** User inactivity window before pending clarification is rejected (web/Telegram, etc.). */
|
|
3
5
|
export declare const CLARIFY_USER_RESPONSE_TIMEOUT_MS: number;
|
|
4
6
|
export interface ClarifyBridgeRequest {
|
|
@@ -8,10 +10,9 @@ export interface ClarifyBridgeRequest {
|
|
|
8
10
|
}
|
|
9
11
|
export interface StartClarifyRequestOptions {
|
|
10
12
|
sessionKey: string;
|
|
11
|
-
/** Present for in-flight webchat runs
|
|
13
|
+
/** Present for in-flight webchat runs. */
|
|
12
14
|
runId?: string;
|
|
13
|
-
|
|
14
|
-
publishSse?: (event: RelayEvent) => void;
|
|
15
|
+
publishStream?: (event: ClarifyStreamEvent) => void;
|
|
15
16
|
request: ClarifyBridgeRequest;
|
|
16
17
|
/** e.g. Telegram inline keyboard + prompt message */
|
|
17
18
|
deliver?: (ctx: {
|
|
@@ -14,7 +14,7 @@ var ClarifyBridge = class {
|
|
|
14
14
|
/** sessionKey → requestId when waiting for a free-text reply (no multiple-choice). */
|
|
15
15
|
pendingFreeTextBySession = /* @__PURE__ */ new Map();
|
|
16
16
|
startRequest(opts) {
|
|
17
|
-
const { sessionKey, runId,
|
|
17
|
+
const { sessionKey, runId, publishStream, request, deliver } = opts;
|
|
18
18
|
const requestId = crypto.randomUUID();
|
|
19
19
|
const hasChoices = Array.isArray(request.choices) && request.choices.length >= 2;
|
|
20
20
|
const needsFreeText = !hasChoices;
|
|
@@ -44,14 +44,13 @@ var ClarifyBridge = class {
|
|
|
44
44
|
default: request.default,
|
|
45
45
|
petFeedback: createPetFeedback("clarify")
|
|
46
46
|
};
|
|
47
|
-
if (runId) relay.publish(runId, payload);
|
|
48
47
|
try {
|
|
49
|
-
|
|
48
|
+
if (runId) publishStream?.(payload);
|
|
50
49
|
} catch (err) {
|
|
51
50
|
log.warn({
|
|
52
51
|
err,
|
|
53
52
|
requestId
|
|
54
|
-
}, "
|
|
53
|
+
}, "Clarify stream publication failed");
|
|
55
54
|
}
|
|
56
55
|
if (deliver) deliver({
|
|
57
56
|
sessionKey,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/gateway/file-reference-errors.ts
|
|
2
|
+
function classifyFileReferenceFsError(err) {
|
|
3
|
+
const code = err?.code;
|
|
4
|
+
if (code === "ENOENT" || code === "ENOTDIR") return {
|
|
5
|
+
code: "FILE_NOT_FOUND",
|
|
6
|
+
message: "File not found",
|
|
7
|
+
status: 404
|
|
8
|
+
};
|
|
9
|
+
if (code === "EACCES" || code === "EPERM") return {
|
|
10
|
+
code: "FILE_ACCESS_DENIED",
|
|
11
|
+
message: "Gateway does not have permission to access this file",
|
|
12
|
+
status: 403
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
code: "FILE_ACCESS_FAILED",
|
|
16
|
+
message: "Gateway could not access this file",
|
|
17
|
+
status: 500
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { classifyFileReferenceFsError };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { shouldSilence, stripHeartbeatToken } from "../../heartbeat/tokens.js";
|
|
4
|
-
import { appendCronEventLines } from "../../heartbeat/event-prompt.js";
|
|
5
4
|
import { isWithinActiveHours } from "../../heartbeat/active-hours.js";
|
|
6
5
|
import { isHeartbeatContentEmpty } from "../../heartbeat/content-check.js";
|
|
6
|
+
import { appendCronEventLines } from "../../heartbeat/event-prompt.js";
|
|
7
7
|
import { createHeartbeatWake } from "../../heartbeat/wake.js";
|
|
8
8
|
import { resolveHeartbeatMdPath } from "../workspace-heartbeat-path.js";
|
|
9
9
|
import { readFile } from "fs/promises";
|
|
@@ -138,7 +138,10 @@ var HeartbeatService = class {
|
|
|
138
138
|
}
|
|
139
139
|
let reply;
|
|
140
140
|
try {
|
|
141
|
-
reply = await this.deps.agentService.turnDispatcher.processDirect(prompt, sessionKey
|
|
141
|
+
reply = await this.deps.agentService.turnDispatcher.processDirect(prompt, sessionKey, {
|
|
142
|
+
type: "system",
|
|
143
|
+
source: "heartbeat"
|
|
144
|
+
});
|
|
142
145
|
} catch (error) {
|
|
143
146
|
log.error({ err: error }, "Heartbeat: agent call failed");
|
|
144
147
|
return;
|
|
@@ -223,11 +223,7 @@ function createHonoApp(config) {
|
|
|
223
223
|
trustedProxies: service.currentConfig.gateway?.trustedProxies,
|
|
224
224
|
allowRealIpFallback: service.currentConfig.gateway?.allowRealIpFallback === true
|
|
225
225
|
}) }),
|
|
226
|
-
channelRateLimitMiddleware
|
|
227
|
-
sseConfig: {
|
|
228
|
-
service,
|
|
229
|
-
maxSseConnections: service.currentConfig.gateway.maxSseConnections
|
|
230
|
-
}
|
|
226
|
+
channelRateLimitMiddleware
|
|
231
227
|
});
|
|
232
228
|
const prewarm = prewarmStaticUiCache();
|
|
233
229
|
if (prewarm.loaded > 0) log.debug({
|
|
@@ -209,7 +209,7 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
209
209
|
/** Masked `cfg.providers` for capability keys (image / STT / etc.). */
|
|
210
210
|
providersConfig: Record<string, import("./safe-providers-config.js").SafeProviderAuthEntry>;
|
|
211
211
|
gateway: {
|
|
212
|
-
bind: "
|
|
212
|
+
bind: "custom" | "auto" | "loopback" | "lan" | "tailnet";
|
|
213
213
|
customBindHost: string;
|
|
214
214
|
port: number;
|
|
215
215
|
corsOrigins: string[];
|
|
@@ -255,7 +255,6 @@ export declare function buildSafeWebConfigPayload(service: GatewayService, optio
|
|
|
255
255
|
webchat: {
|
|
256
256
|
activityDetailDefault: "stream" | "on" | "off";
|
|
257
257
|
};
|
|
258
|
-
maxSseConnections: number;
|
|
259
258
|
channelConnectDeferMode: "explicit" | "off" | "auto";
|
|
260
259
|
channelConnectDeferIds: string[];
|
|
261
260
|
channelConnectDeferSkipIds: string[];
|
|
@@ -6,9 +6,9 @@ import { init_models_json, loadModelsJson } from "../../../config/models-json.js
|
|
|
6
6
|
import { CredentialResolver, init_credentials } from "../../../auth/credentials.js";
|
|
7
7
|
import { getProviderRegistry, init_plugin_registry } from "../../../providers/plugin-registry.js";
|
|
8
8
|
import { getAllProviders, init_providers, isProviderConfigured } from "../../../providers/index.js";
|
|
9
|
+
import { normalizeConfiguredMcpServers } from "../../../config/mcp-config-normalize.js";
|
|
9
10
|
import { resolveShareConfig } from "../../../share/share-config.js";
|
|
10
11
|
import { maskTunnelSecretForWeb } from "../../../tunnel/env.js";
|
|
11
|
-
import { normalizeConfiguredMcpServers } from "../../../config/mcp-config-normalize.js";
|
|
12
12
|
import { resolveSessionConfigForWeb, resolveUpdateConfigForWeb } from "../../../config/web-patch.js";
|
|
13
13
|
import { GENERIC_MASKED_SECRET, maskSecretLength } from "./mask-secret-length.js";
|
|
14
14
|
import { safeToolsWebForGet } from "../../config-tools-web.js";
|
|
@@ -166,7 +166,6 @@ async function buildSafeWebConfigPayload(service, options = {}) {
|
|
|
166
166
|
activeHours: config.gateway?.heartbeat?.activeHours
|
|
167
167
|
},
|
|
168
168
|
webchat: { activityDetailDefault: config.gateway?.webchat?.activityDetailDefault ?? "on" },
|
|
169
|
-
maxSseConnections: typeof config.gateway?.maxSseConnections === "number" ? config.gateway.maxSseConnections : 100,
|
|
170
169
|
channelConnectDeferMode: config.gateway?.channelConnectDeferMode ?? "auto",
|
|
171
170
|
channelConnectDeferIds: Array.isArray(config.gateway?.channelConnectDeferIds) ? config.gateway.channelConnectDeferIds : [],
|
|
172
171
|
channelConnectDeferSkipIds: Array.isArray(config.gateway?.channelConnectDeferSkipIds) ? config.gateway.channelConnectDeferSkipIds : [],
|
|
@@ -29,18 +29,16 @@ function extractTokenFromHeader(authHeader) {
|
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* SECURITY: query-string tokens leak into server logs, Referer headers, and
|
|
32
|
-
* browser history. We accept them only
|
|
33
|
-
* be set
|
|
34
|
-
*
|
|
32
|
+
* browser history. We accept them only for agent avatar `<img>` loads, where an
|
|
33
|
+
* Authorization header cannot be set. Realtime WebSocket authentication uses a
|
|
34
|
+
* one-time ticket acquired over authenticated HTTP.
|
|
35
35
|
*/
|
|
36
36
|
function extractTokenFromQuery(url) {
|
|
37
37
|
return new URL(url).searchParams.get("token");
|
|
38
38
|
}
|
|
39
|
-
const QUERY_TOKEN_ALLOWED_PATHS = new Set(["/api/events", "/api/ws"]);
|
|
40
39
|
const AGENT_AVATAR_GET_PATH = /^\/api\/agents\/[^/]+\/avatar$/;
|
|
41
40
|
/** Exported for gateway security tests. */
|
|
42
41
|
function isQueryTokenAllowedPath(path, method) {
|
|
43
|
-
if (QUERY_TOKEN_ALLOWED_PATHS.has(path) || path.startsWith("/api/events")) return true;
|
|
44
42
|
if (method === "GET" && AGENT_AVATAR_GET_PATH.test(path)) return true;
|
|
45
43
|
return false;
|
|
46
44
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
+
import { endpointTurnClaimSchema } from "../../../../packages/endpoint-tools-protocol/src/index.js";
|
|
1
2
|
import { validateWebchatAttachments, validateWebchatContent } from "../../chat-limits.js";
|
|
2
|
-
import { createAgentResumeHandler, createEventsSSEHandler, createSendHandler } from "../sse.js";
|
|
3
3
|
//#region src/gateway/hono/routes/agent-stream.ts
|
|
4
4
|
function registerAgentStreamRoutes(authenticated, deps) {
|
|
5
|
-
const { service, chatRateLimitMiddleware
|
|
6
|
-
authenticated.post("/api/agent/resume", chatRateLimitMiddleware, createAgentResumeHandler(sseConfig));
|
|
5
|
+
const { service, chatRateLimitMiddleware } = deps;
|
|
7
6
|
authenticated.post("/api/agent/abort", chatRateLimitMiddleware, async (c) => {
|
|
8
7
|
const body = await c.req.json().catch(() => null);
|
|
9
8
|
const runId = body && typeof body === "object" && typeof body.runId === "string" ? body.runId.trim() : "";
|
|
@@ -70,13 +69,32 @@ function registerAgentStreamRoutes(authenticated, deps) {
|
|
|
70
69
|
message: "Missing delivery"
|
|
71
70
|
}
|
|
72
71
|
}, 400);
|
|
72
|
+
const origin = endpointTurnClaimSchema.safeParse(body.origin);
|
|
73
|
+
if (!origin.success) return c.json({
|
|
74
|
+
ok: false,
|
|
75
|
+
error: {
|
|
76
|
+
code: "BAD_REQUEST",
|
|
77
|
+
message: "Invalid endpoint origin"
|
|
78
|
+
}
|
|
79
|
+
}, 400);
|
|
80
|
+
if (!service.endpointTools.registry.verifyTurnClaim(origin.data.endpointId, origin.data.token)) return c.json({
|
|
81
|
+
ok: false,
|
|
82
|
+
error: {
|
|
83
|
+
code: "INVALID_ENDPOINT",
|
|
84
|
+
message: "Endpoint connection is not active"
|
|
85
|
+
}
|
|
86
|
+
}, 401);
|
|
73
87
|
const result = await service.submitSessionInput({
|
|
74
88
|
sessionKey,
|
|
75
89
|
clientMessageId: typeof body.clientMessageId === "string" ? body.clientMessageId : "",
|
|
76
90
|
delivery,
|
|
77
91
|
content,
|
|
78
92
|
attachments,
|
|
79
|
-
thinking: typeof body.thinking === "string" ? body.thinking : void 0
|
|
93
|
+
thinking: typeof body.thinking === "string" ? body.thinking : void 0,
|
|
94
|
+
origin: {
|
|
95
|
+
type: "endpoint",
|
|
96
|
+
endpointId: origin.data.endpointId
|
|
97
|
+
}
|
|
80
98
|
});
|
|
81
99
|
if (result.ok === false) return c.json({
|
|
82
100
|
ok: false,
|
|
@@ -195,8 +213,33 @@ function registerAgentStreamRoutes(authenticated, deps) {
|
|
|
195
213
|
payload: { received: true }
|
|
196
214
|
});
|
|
197
215
|
});
|
|
198
|
-
authenticated.post("/api/send", chatRateLimitMiddleware,
|
|
199
|
-
|
|
216
|
+
authenticated.post("/api/send", chatRateLimitMiddleware, async (c) => {
|
|
217
|
+
const body = await c.req.json().catch(() => null);
|
|
218
|
+
const channel = typeof body?.channel === "string" ? body.channel : "";
|
|
219
|
+
const chatId = typeof body?.chatId === "string" ? body.chatId : "";
|
|
220
|
+
const content = typeof body?.content === "string" ? body.content : "";
|
|
221
|
+
if (!channel || !chatId || !content) return c.json({
|
|
222
|
+
ok: false,
|
|
223
|
+
error: {
|
|
224
|
+
code: "BAD_REQUEST",
|
|
225
|
+
message: "Missing required fields: channel, chatId, content"
|
|
226
|
+
}
|
|
227
|
+
}, 400);
|
|
228
|
+
try {
|
|
229
|
+
return c.json({
|
|
230
|
+
ok: true,
|
|
231
|
+
payload: await service.sendMessage(channel, chatId, content)
|
|
232
|
+
});
|
|
233
|
+
} catch (error) {
|
|
234
|
+
return c.json({
|
|
235
|
+
ok: false,
|
|
236
|
+
error: {
|
|
237
|
+
code: "INTERNAL_ERROR",
|
|
238
|
+
message: error instanceof Error ? error.message : "Unknown error"
|
|
239
|
+
}
|
|
240
|
+
}, 500);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
200
243
|
}
|
|
201
244
|
//#endregion
|
|
202
245
|
export { registerAgentStreamRoutes };
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* Covers heartbeat, bind/customBindHost/port, tailscale, auth (mode + token +
|
|
5
5
|
* password + rateLimit + trustedProxy), trustedProxies, allowRealIpFallback,
|
|
6
6
|
* dangerouslyAllowHostHeaderOriginFallback, security, share, siteShare, publicUrl, webchat,
|
|
7
|
-
* corsOrigins
|
|
7
|
+
* corsOrigins and channelConnectDefer{Mode,Ids,SkipIds}.
|
|
8
8
|
*
|
|
9
9
|
* Validation policy: each subsection that can reject rejects with a 400 and a
|
|
10
10
|
* specific `message`. The dispatcher converts these into `c.json(...)`.
|
|
11
11
|
*
|
|
12
12
|
* Initial-state branches use the same literal defaults the inline code did
|
|
13
|
-
* (loopback + port 18790 + 1800s heartbeat +
|
|
13
|
+
* (loopback + port 18790 + 1800s heartbeat + empty CORS) so
|
|
14
14
|
* a brand-new install gets a working gateway after the first PATCH.
|
|
15
15
|
*/
|
|
16
16
|
import type { Config } from '../../../../config/schema.js';
|
|
@@ -20,7 +20,6 @@ function ensureGateway(config) {
|
|
|
20
20
|
intervalMs: 18e5,
|
|
21
21
|
includeSystemPromptSection: false
|
|
22
22
|
},
|
|
23
|
-
maxSseConnections: 100,
|
|
24
23
|
corsOrigins: []
|
|
25
24
|
};
|
|
26
25
|
return config.gateway;
|
|
@@ -98,7 +97,6 @@ function applyGatewayPatch(config, body) {
|
|
|
98
97
|
intervalMs: 18e5,
|
|
99
98
|
includeSystemPromptSection: false
|
|
100
99
|
},
|
|
101
|
-
maxSseConnections: 100,
|
|
102
100
|
corsOrigins: []
|
|
103
101
|
};
|
|
104
102
|
else config.gateway.bind = bind;
|
|
@@ -123,7 +121,6 @@ function applyGatewayPatch(config, body) {
|
|
|
123
121
|
intervalMs: 18e5,
|
|
124
122
|
includeSystemPromptSection: false
|
|
125
123
|
},
|
|
126
|
-
maxSseConnections: 100,
|
|
127
124
|
corsOrigins: []
|
|
128
125
|
};
|
|
129
126
|
else config.gateway.port = Math.floor(body.gateway.port);
|
|
@@ -139,7 +136,6 @@ function applyGatewayPatch(config, body) {
|
|
|
139
136
|
intervalMs: 18e5,
|
|
140
137
|
includeSystemPromptSection: false
|
|
141
138
|
},
|
|
142
|
-
maxSseConnections: 100,
|
|
143
139
|
corsOrigins: []
|
|
144
140
|
};
|
|
145
141
|
config.gateway.tailscale = { ...config.gateway.tailscale ?? {
|
|
@@ -251,21 +247,6 @@ function applyGatewayPatch(config, body) {
|
|
|
251
247
|
const gw = ensureGateway(config);
|
|
252
248
|
gw.corsOrigins = body.gateway.corsOrigins.filter((x) => typeof x === "string" && x.trim().length > 0).map((x) => x.trim());
|
|
253
249
|
}
|
|
254
|
-
if (body.gateway?.maxSseConnections !== void 0) {
|
|
255
|
-
if (typeof body.gateway.maxSseConnections !== "number" || !Number.isFinite(body.gateway.maxSseConnections) || body.gateway.maxSseConnections < 1) return patchError("gateway.maxSseConnections must be a positive integer");
|
|
256
|
-
if (!config.gateway) config.gateway = {
|
|
257
|
-
bind: "loopback",
|
|
258
|
-
port: 18790,
|
|
259
|
-
heartbeat: {
|
|
260
|
-
enabled: true,
|
|
261
|
-
intervalMs: 18e5,
|
|
262
|
-
includeSystemPromptSection: false
|
|
263
|
-
},
|
|
264
|
-
maxSseConnections: Math.floor(body.gateway.maxSseConnections),
|
|
265
|
-
corsOrigins: []
|
|
266
|
-
};
|
|
267
|
-
else config.gateway.maxSseConnections = Math.floor(body.gateway.maxSseConnections);
|
|
268
|
-
}
|
|
269
250
|
if (body.gateway?.channelConnectDeferMode !== void 0) {
|
|
270
251
|
const mode = body.gateway.channelConnectDeferMode;
|
|
271
252
|
if (mode !== "auto" && mode !== "off" && mode !== "explicit") return patchError("gateway.channelConnectDeferMode must be auto, off, or explicit");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ContextCompactionPolicySchema, init_config } from "../../../../user-context/config.js";
|
|
2
2
|
import { BindingsConfigSchema, BrowserConfigSchema, McpConfigSchema, VoiceConfigSchema, init_schema } from "../../../../config/schema.js";
|
|
3
3
|
import { CredentialResolver, init_credentials } from "../../../../auth/credentials.js";
|
|
4
|
+
import { canonicalizeConfiguredMcpServer } from "../../../../config/mcp-config-normalize.js";
|
|
4
5
|
import { setTuiDefaultAgentConfig } from "../../../../commands/agents.config.js";
|
|
5
6
|
import { mergeTunnelConfigPatch } from "../../../../tunnel/tunnel-config.js";
|
|
6
|
-
import { canonicalizeConfiguredMcpServer } from "../../../../config/mcp-config-normalize.js";
|
|
7
7
|
import { mergeGatewaySkillsMarketplacePatch, mergeSessionConfigPatch, mergeUpdateConfigPatch } from "../../../../config/web-patch.js";
|
|
8
8
|
import { assertGatewayAuthConfigured, resolveGatewayAuth } from "../../../auth.js";
|
|
9
9
|
import { isMaskedSecretPatchValue } from "../../lib/mask-secret-length.js";
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import type { MiddlewareHandler } from 'hono';
|
|
2
2
|
import type { GatewayService } from '../../service.js';
|
|
3
|
-
import type { SSEHandlerConfig } from '../sse.js';
|
|
4
3
|
export interface AuthenticatedRouteDeps {
|
|
5
4
|
service: GatewayService;
|
|
6
5
|
strictRateLimitMiddleware: MiddlewareHandler;
|
|
7
6
|
chatRateLimitMiddleware: MiddlewareHandler;
|
|
8
7
|
xopcCloudPollRateLimitMiddleware: MiddlewareHandler;
|
|
9
8
|
channelRateLimitMiddleware?: MiddlewareHandler;
|
|
10
|
-
sseConfig: SSEHandlerConfig;
|
|
11
9
|
}
|