@xopcai/xopc 0.0.188 → 0.0.190
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 -4
- package/README.zh-CN.md +0 -3
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store--QoUGhiS.js → activity-store-DstnJCS5.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B0yweLNQ.js → agent-avatar-dicebear-9vAbkroX.js} +1 -1
- package/dist/gateway/static/root/assets/agents-D1t4SfMQ.js +68 -0
- package/dist/gateway/static/root/assets/{api-5laWqfiE.js → api-BTL9kayv.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BXJ8Jiv_.js → app-management-settings-panel-DkFeIdBf.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DG9n9D1M.js → appearance-settings-Bxs8Fpaj.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-Cgrgu5OW.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-Ceh5qrZf.js → archive-plugin-Ch2RmLCC.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-jFW7uYf7.js → attachment-load-BhMQM_Ky.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-CtJxstKh.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-XDlkI1r4.js → binary-plugins-D6CqlymH.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-kyKc2IhE.js → block-editor-ClL6HEg9.js} +56 -56
- package/dist/gateway/static/root/assets/browser-settings-page-DW99iDmD.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-BJa5Iz_v.js → browser-workflow-inputs-BYy48VhN.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CTQQOsn5.js → browser-workflows-page-zgLibuMH.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CHUrT9EB.js +7 -0
- package/dist/gateway/static/root/assets/capability-presets-api-BB8t4Ja7.js +1 -0
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Cycrv0YV.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-BgIkWq01.js → channel-recipient-api-BThDGiO3.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-V96gPUAU.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-Cz7SAAkm.js +1 -0
- package/dist/gateway/static/root/assets/connectors-api-DS9ED-EL.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-BhlyQoQI.js +2 -0
- package/dist/gateway/static/root/assets/cron-expression-CkgsvhtW.js +2 -0
- package/dist/gateway/static/root/assets/{desktop-pet-CSwd00CV.js → desktop-pet-Cv8rGhYW.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CuNQvHGu.js → desktop-pet-settings-CIeJdwfV.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-ct0n5Rje.js → directory-picker-path-field-D8jXEiAY.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-BeRBuMUU.js → extension-debug-page-CCZ9u6TZ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DbK-Cwao.js → extension-page-CV36ILRG.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-IyQrSILY.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-CC7EvEFp.js → gateway-config-api-D4_r5iJM.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-CYlntpBH.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-B2DmdlwO.js → gateway-startup-retry-EO9mKvzE.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-D4SyWob8.js +1 -0
- package/dist/gateway/static/root/assets/home-page-B2Kagoh8.js +3 -0
- package/dist/gateway/static/root/assets/{image-generation-api-GMTaS6eI.js → image-generation-api-Bu7PyVSh.js} +1 -1
- package/dist/gateway/static/root/assets/index-CYT5DOzr.js +150 -0
- package/dist/gateway/static/root/assets/index-D6e3tPL-.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DhGYddbI.js → keyboard-shortcuts-settings-BMhCuVBZ.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-BHYbFjqy.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CmnrBmWi.js → local-apps-page-ijIe7_y2.js} +1 -1
- package/dist/gateway/static/root/assets/locale-store-deR2zRaE.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-IIn8Tess.js +2 -0
- package/dist/gateway/static/root/assets/management-settings--V_fovKD.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-split-CZaBPOVn.js → markdown-split-Dt9-in6W.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CiKvSgCv.js → media-plugins-B3pj_iO0.js} +1 -1
- package/dist/gateway/static/root/assets/messages-B4XqB8I6.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-Bisbzqlz.js → notes-page-DZ366lIT.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-S2sBVOLw.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-BxlwhAbH.js → page-tabs-C5ge434C.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-RM8wXxfT.js → preview-open-alternatives-BFa9DgSV.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-DdBlibek.js → product-open-page-Dc9CcWdu.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BilzoCJ7.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BoQUyacP.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-DUyUaCRF.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-BDKbpmXv.js → schema-form-B84DckWe.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-Dzxlq1F0.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-TzwlZxU6.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-Dp9itvdy.js +1 -0
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DgIp8_S6.js → settings-loading-skeleton-CCtlhoy7.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-DQmMKf8r.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-layout-97LmwrzC.js → settings-page-layout-EQIOJa_L.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Cwi-SPja.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BH7i3g1S.js → share-preview-page-C4_B2jvf.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-CkyuGlZK.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BJCePQK5.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-BYWLfmJi.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-s-a5WV9j.js → skills-page.utils-Jhm24i4h.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BxjeMT5k.js → system-settings-panel-Dpx2ags2.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-BahycnfW.js → task-detail-page-DLAdxI6e.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-BRxdsmic.js → theme-store-DnBOcGXi.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-39MjwPSq.js → typed-models-lib-DULmTHUB.js} +1 -1
- package/dist/gateway/static/root/assets/use-autosave-BrjVk5VH.js +1 -0
- package/dist/gateway/static/root/assets/user-context-page-9AAFpGAL.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-XU-7sBSg.js → voice-api-key-field-BISTPfq_.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CJqu8UHq.js → work-discovery-overlay-Wr-uF7VA.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BWds95sL.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DXtg8Qxl.js → workflow-run-setup-panel-DHqHP8_6.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-0b4_DFHr.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 +0 -36
- package/dist/packages/realtime-client/src/index.js +256 -0
- package/dist/packages/realtime-protocol/src/index.js +88 -0
- package/dist/src/agent/agent-manager.d.ts +1 -1
- package/dist/src/agent/agent-manager.js +7 -13
- package/dist/src/agent/background-review/coordinator.js +1 -1
- 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 +10 -9
- package/dist/src/agent/bootstrap/bootstrap-cache.d.ts +0 -1
- package/dist/src/agent/bootstrap/bootstrap-cache.js +3 -4
- package/dist/src/agent/bootstrap/bootstrap-files.d.ts +0 -4
- package/dist/src/agent/bootstrap/bootstrap-files.js +3 -4
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -4
- package/dist/src/agent/bootstrap/load-bootstrap-files.d.ts +0 -1
- package/dist/src/agent/bootstrap/load-bootstrap-files.js +1 -14
- package/dist/src/agent/bootstrap/types.d.ts +1 -1
- 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/context/workspace-templates/SOUL.md +1 -1
- 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/gateway-tools.js +1 -1
- package/dist/src/agent/external-tools/index.d.ts +4 -5
- package/dist/src/agent/external-tools/index.js +8 -2
- package/dist/src/agent/external-tools/types.d.ts +8 -1
- package/dist/src/agent/external-tools/types.js +2 -1
- package/dist/src/agent/inbound/inbound-loop.js +4 -0
- 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/memory/builtin-provider.d.ts +2 -4
- package/dist/src/agent/memory/builtin-provider.js +35 -15
- package/dist/src/agent/memory/context/types.d.ts +3 -1
- package/dist/src/agent/memory/create-memory-manager.js +2 -0
- package/dist/src/agent/memory/index.d.ts +1 -1
- package/dist/src/agent/memory/index.js +1 -1
- package/dist/src/agent/memory/manager.d.ts +9 -1
- package/dist/src/agent/memory/manager.js +39 -9
- package/dist/src/agent/memory/memory-config.d.ts +1 -1
- package/dist/src/agent/memory/memory-config.js +1 -1
- package/dist/src/agent/memory/source-origin.js +0 -2
- package/dist/src/agent/memory/types.d.ts +5 -1
- package/dist/src/agent/memory/understanding/service.d.ts +10 -10
- package/dist/src/agent/memory/understanding/service.js +108 -176
- package/dist/src/agent/memory/understanding/types.d.ts +7 -8
- package/dist/src/agent/memory/user-context-coordinator.d.ts +2 -1
- package/dist/src/agent/memory/user-context-coordinator.js +27 -41
- 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/orchestration/agent-orchestrator.js +4 -7
- package/dist/src/agent/prompt/sections/memory-skills.js +4 -4
- package/dist/src/agent/prompt/sections/tooling.js +0 -10
- package/dist/src/agent/prompt/service-prompt-builder.d.ts +0 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +4 -33
- package/dist/src/agent/prompt/system-prompt.js +1 -2
- 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 +2 -2
- 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 +2 -3
- package/dist/src/agent/service.js +10 -21
- package/dist/src/agent/service.types.d.ts +2 -0
- 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/marketplace/adapters/clawhub/adapter.js +1 -1
- 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/dreaming-tool.d.ts +0 -2
- package/dist/src/agent/tools/dreaming-tool.js +13 -38
- package/dist/src/agent/tools/factory.d.ts +4 -3
- package/dist/src/agent/tools/factory.js +2 -10
- package/dist/src/agent/tools/index.d.ts +0 -1
- package/dist/src/agent/tools/index.js +1 -2
- package/dist/src/agent/tools/memory-tool.js +1 -1
- package/dist/src/agent/workspace-runtime/registry.d.ts +3 -5
- package/dist/src/agent/workspace-runtime/registry.js +2 -15
- package/dist/src/agent-manifest/schema.d.ts +17 -17
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/memory-runtime.d.ts +2 -2
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/automations/domain/types.d.ts +2 -1
- package/dist/src/automations/domain/validation.d.ts +29 -29
- package/dist/src/automations/draft/automation-draft-validator.d.ts +3 -3
- package/dist/src/automations/service/action-executor.js +4 -1
- package/dist/src/channels/pairing/pairing-challenge.d.ts +1 -1
- package/dist/src/channels/pairing/pairing-challenge.js +1 -1
- package/dist/src/chat-commands/builtins/understanding.js +2 -5
- 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/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/init.js +3 -22
- package/dist/src/cli/templates.js +1 -1
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/paths.d.ts +0 -5
- package/dist/src/config/paths.js +2 -11
- package/dist/src/config/rules.js +0 -5
- package/dist/src/config/schema.d.ts +27 -122
- package/dist/src/config/schema.js +9 -42
- package/dist/src/config/web-patch.js +0 -1
- package/dist/src/connectors/learning-coordinator.js +75 -3
- 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/types/hooks.d.ts +1 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agent-builtin-tools.js +0 -5
- package/dist/src/gateway/agents-admin.d.ts +0 -7
- package/dist/src/gateway/agents-admin.js +3 -32
- package/dist/src/gateway/chat-stream/protocol.d.ts +0 -1
- package/dist/src/gateway/clarify-bridge.d.ts +5 -4
- package/dist/src/gateway/clarify-bridge.js +3 -4
- package/dist/src/gateway/dreaming-automation-reconciler.d.ts +3 -3
- package/dist/src/gateway/dreaming-automation-reconciler.js +48 -88
- package/dist/src/gateway/heartbeat/service.js +4 -1
- 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 +20 -9
- package/dist/src/gateway/hono/lib/config-payload.js +3 -2
- package/dist/src/gateway/hono/middleware/auth.js +3 -5
- package/dist/src/gateway/hono/oauth-async.d.ts +1 -0
- package/dist/src/gateway/hono/oauth-async.js +17 -2
- package/dist/src/gateway/hono/routes/agent-stream.js +49 -6
- package/dist/src/gateway/hono/routes/agents.js +1 -33
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- 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 +17 -1
- package/dist/src/gateway/hono/routes/connectors.js +13 -12
- 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 +6 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -5
- package/dist/src/gateway/hono/routes/logs.js +0 -4
- 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/status.js +0 -7
- package/dist/src/gateway/hono/routes/understanding-sources.d.ts +3 -0
- package/dist/src/gateway/hono/routes/understanding-sources.js +203 -0
- package/dist/src/gateway/hono/routes/work-discovery.d.ts +2 -0
- package/dist/src/gateway/hono/routes/work-discovery.js +3 -134
- package/dist/src/gateway/hono/routes/workflows.js +1 -1
- package/dist/src/gateway/hono/routes/you.d.ts +0 -31
- package/dist/src/gateway/hono/routes/you.js +230 -1161
- 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 +3 -3
- package/dist/src/gateway/service/run-gateway-agent.d.ts +4 -3
- package/dist/src/gateway/service/run-gateway-agent.js +15 -17
- 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 +43 -26
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/knowledge/connected-knowledge-pipeline.js +1 -1
- package/dist/src/knowledge/connected-understanding-pipeline.d.ts +2 -4
- package/dist/src/knowledge/connected-understanding-pipeline.js +31 -81
- package/dist/src/knowledge/index.js +2 -2
- package/dist/src/knowledge/people-graph.d.ts +22 -25
- package/dist/src/knowledge/people-graph.js +76 -43
- 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/proactive/execution/context.js +8 -13
- package/dist/src/realtime/broker.d.ts +31 -0
- package/dist/src/realtime/broker.js +114 -0
- package/dist/src/realtime/runtime.d.ts +20 -0
- package/dist/src/realtime/runtime.js +263 -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/site-share-config.js +0 -1
- package/dist/src/storage/sqlite/connector-account-repository.js +0 -1
- package/dist/src/storage/sqlite/context-consolidation-repository.d.ts +37 -0
- package/dist/src/storage/sqlite/context-consolidation-repository.js +64 -0
- 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/fts.d.ts +2 -0
- package/dist/src/storage/sqlite/fts.js +29 -1
- package/dist/src/storage/sqlite/index.d.ts +6 -6
- package/dist/src/storage/sqlite/index.js +7 -7
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +9 -2
- package/dist/src/storage/sqlite/knowledge-repository.js +58 -10
- package/dist/src/storage/sqlite/memory-records-repository.d.ts +7 -56
- package/dist/src/storage/sqlite/memory-records-repository.js +68 -218
- 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/113_memory_evidence_single_source.sql +54 -0
- package/dist/src/storage/sqlite/migrations/114_user_context_domain.sql +193 -0
- package/dist/src/storage/sqlite/migrations/115_remove_legacy_user_context.sql +6 -0
- package/dist/src/storage/sqlite/migrations/116_structured_context_consolidation.sql +38 -0
- package/dist/src/storage/sqlite/migrations/117_unified_understanding_sources.sql +110 -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/schema.sql +0 -20
- 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/storage/sqlite/user-context-quality-repository.d.ts +34 -0
- package/dist/src/storage/sqlite/user-context-quality-repository.js +74 -0
- package/dist/src/storage/sqlite/user-context-repository.d.ts +64 -0
- package/dist/src/storage/sqlite/user-context-repository.js +383 -0
- 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.js +1 -7
- 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-startup-resources.js +1 -2
- 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/gateway-lifecycle.d.ts +1 -1
- package/dist/src/tunnel/gateway-lifecycle.js +1 -1
- package/dist/src/user-context/config.d.ts +17 -210
- package/dist/src/user-context/config.js +19 -85
- package/dist/src/user-context/consolidation.d.ts +26 -0
- package/dist/src/user-context/consolidation.js +115 -0
- package/dist/src/user-context/domain.d.ts +75 -0
- package/dist/src/user-context/domain.js +4 -0
- package/dist/src/user-context/manual-understanding.d.ts +7 -14
- package/dist/src/user-context/manual-understanding.js +19 -49
- package/dist/src/{agent/memory/context → user-context}/planner.d.ts +5 -6
- package/dist/src/user-context/planner.js +311 -0
- package/dist/src/user-context/relationship-continuity.d.ts +3 -6
- package/dist/src/user-context/relationship-continuity.js +39 -32
- package/dist/src/user-context/sources/catalog.d.ts +2 -0
- package/dist/src/user-context/sources/catalog.js +149 -0
- package/dist/src/user-context/sources/index.d.ts +3 -0
- package/dist/src/user-context/sources/index.js +3 -0
- package/dist/src/user-context/sources/repository.d.ts +40 -0
- package/dist/src/user-context/sources/repository.js +164 -0
- package/dist/src/user-context/sources/types.d.ts +83 -0
- 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/work-discovery/analyzer.d.ts +4 -3
- package/dist/src/work-discovery/analyzer.js +21 -16
- package/dist/src/work-discovery/incremental-repository.js +42 -40
- package/dist/src/work-discovery/index.js +3 -3
- package/dist/src/work-discovery/service.d.ts +7 -7
- package/dist/src/work-discovery/service.js +241 -190
- package/dist/src/work-discovery/source-repository.js +42 -53
- package/dist/src/work-discovery/types.d.ts +2 -14
- package/package.json +5 -7
- package/dist/gateway/static/root/assets/agents-C6OV-gMm.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-Ci14lDeO.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-Q1xmb4Rh.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-DbowrHXD.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DoZPFdKF.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-api-Dn-7MMEo.js +0 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Bt8Hnx0h.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-Bpsebsru.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-DFmdYRE5.js +0 -1
- package/dist/gateway/static/root/assets/connector-logo-TRr9ybf6.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-Tg5kl22i.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-B3B1eqnr.js +0 -2
- package/dist/gateway/static/root/assets/extension-settings-page-C9ag5tb5.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-9g8uIry9.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-fl1oC_-5.js +0 -1
- package/dist/gateway/static/root/assets/home-page-Bao9jq_z.js +0 -3
- package/dist/gateway/static/root/assets/index-Cl5n1f_U.css +0 -1
- package/dist/gateway/static/root/assets/index-OJgiMh07.js +0 -223
- package/dist/gateway/static/root/assets/local-app-workbench-page-B69NvtvH.js +0 -2
- package/dist/gateway/static/root/assets/locale-store-D6hs74o5.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-Cq3cABqg.js +0 -7
- package/dist/gateway/static/root/assets/messages-D02NNLCZ.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-BOZfJFhE.js +0 -4
- package/dist/gateway/static/root/assets/product-delivery-C8JbSj5Y.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-TSKFb2tN.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-BokeBrTT.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-C56anxCX.js +0 -1
- package/dist/gateway/static/root/assets/segmented-styles-BL8oLBEp.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-C7TQADrD.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BDOPKeAX.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-zxo5ZGOu.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-BUPSIa9P.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BRg766eW.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DhEAviQ_.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Ct7AV8ls.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DoVuprZm.js +0 -2
- package/dist/gateway/static/root/assets/time-picker-BGk_Tbsj.js +0 -1
- package/dist/gateway/static/root/assets/use-save-bar-registration-5aVSjTjO.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-B9K41qmy.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BBVnRHju.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-Bs_tYfst.js +0 -11
- package/dist/src/agent/code-intelligence/binary.d.ts +0 -15
- package/dist/src/agent/code-intelligence/binary.js +0 -372
- package/dist/src/agent/code-intelligence/index.d.ts +0 -4
- package/dist/src/agent/code-intelligence/index.js +0 -4
- package/dist/src/agent/code-intelligence/runtime.d.ts +0 -34
- package/dist/src/agent/code-intelligence/runtime.js +0 -280
- package/dist/src/agent/code-intelligence/tool-gating.d.ts +0 -5
- package/dist/src/agent/code-intelligence/tool-gating.js +0 -6
- package/dist/src/agent/code-intelligence/tools.d.ts +0 -6
- package/dist/src/agent/code-intelligence/tools.js +0 -266
- package/dist/src/agent/code-intelligence/types.d.ts +0 -22
- package/dist/src/agent/memory/context/planner.js +0 -286
- package/dist/src/agent/memory/dreaming/config.d.ts +0 -48
- package/dist/src/agent/memory/dreaming/config.js +0 -98
- package/dist/src/agent/memory/dreaming/constants.d.ts +0 -12
- package/dist/src/agent/memory/dreaming/constants.js +0 -18
- package/dist/src/agent/memory/dreaming/deep-promotion.d.ts +0 -19
- package/dist/src/agent/memory/dreaming/deep-promotion.js +0 -152
- package/dist/src/agent/memory/dreaming/light-sweep.d.ts +0 -16
- package/dist/src/agent/memory/dreaming/light-sweep.js +0 -115
- package/dist/src/agent/memory/dreaming/preview.d.ts +0 -23
- package/dist/src/agent/memory/dreaming/preview.js +0 -52
- package/dist/src/agent/memory/dreaming/promotion-lifecycle.d.ts +0 -16
- package/dist/src/agent/memory/dreaming/promotion-lifecycle.js +0 -44
- package/dist/src/agent/memory/dreaming/rem-patterns.d.ts +0 -19
- package/dist/src/agent/memory/dreaming/rem-patterns.js +0 -150
- package/dist/src/agent/memory/dreaming/runner.d.ts +0 -10
- package/dist/src/agent/memory/dreaming/runner.js +0 -78
- package/dist/src/agent/memory/dreaming/schedule.d.ts +0 -23
- package/dist/src/agent/memory/dreaming/schedule.js +0 -38
- package/dist/src/agent/memory/dreaming/scope.d.ts +0 -11
- package/dist/src/agent/memory/dreaming/scope.js +0 -33
- package/dist/src/agent/memory/dreaming/utils.d.ts +0 -3
- package/dist/src/agent/memory/dreaming/utils.js +0 -31
- package/dist/src/agent/streaming/reasoning-visibility-sse.d.ts +0 -15
- 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/routes/memory.d.ts +0 -3
- package/dist/src/gateway/hono/routes/memory.js +0 -460
- 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/storage/sqlite/dreaming-repository.d.ts +0 -61
- package/dist/src/storage/sqlite/dreaming-repository.js +0 -88
- package/dist/src/storage/sqlite/memory-readiness-repository.d.ts +0 -7
- package/dist/src/storage/sqlite/memory-readiness-repository.js +0 -30
- package/dist/src/storage/sqlite/memory-reference-consent-repository.d.ts +0 -27
- package/dist/src/storage/sqlite/memory-reference-consent-repository.js +0 -107
- package/dist/src/storage/sqlite/user-claims-repository.d.ts +0 -101
- package/dist/src/storage/sqlite/user-claims-repository.js +0 -241
- package/dist/src/storage/sqlite/user-profile-setup-repository.d.ts +0 -3
- package/dist/src/storage/sqlite/user-profile-setup-repository.js +0 -32
- package/dist/src/tui/sse-consumer.d.ts +0 -15
- package/dist/src/tui/sse-consumer.js +0 -73
- package/dist/src/user-context/context-compiler.d.ts +0 -27
- package/dist/src/user-context/context-compiler.js +0 -48
- package/dist/src/user-context/import.d.ts +0 -12
- package/dist/src/user-context/import.js +0 -51
- package/dist/src/user-context/memory-episode-evaluator.d.ts +0 -32
- package/dist/src/user-context/memory-episode-evaluator.js +0 -35
- package/dist/src/user-context/memory-readiness.d.ts +0 -33
- package/dist/src/user-context/memory-readiness.js +0 -41
- package/dist/src/user-context/memory-use-audit.d.ts +0 -10
- package/dist/src/user-context/memory-use-audit.js +0 -26
- package/dist/src/user-context/personal-playbook.d.ts +0 -11
- package/dist/src/user-context/personal-playbook.js +0 -41
- package/dist/src/user-context/profile.d.ts +0 -37
- package/dist/src/user-context/profile.js +0 -163
- package/dist/src/user-context/projection.d.ts +0 -120
- package/dist/src/user-context/projection.js +0 -262
- package/dist/src/user-context/source-recommendations.d.ts +0 -13
- package/dist/src/user-context/source-recommendations.js +0 -85
- /package/dist/src/{agent/code-intelligence → user-context/sources}/types.js +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { GatewayServer, type GatewayServerConfig } from './server.js';
|
|
2
|
-
export { GatewayService, type GatewayChannelStartupPhase1Metrics, type GatewayChannelStartupPhase2Metrics, type GatewayServiceConfig,
|
|
2
|
+
export { GatewayService, type GatewayChannelStartupPhase1Metrics, type GatewayChannelStartupPhase2Metrics, type GatewayServiceConfig, } from './service.js';
|
|
3
3
|
export { acquireGatewayLock, GatewayLockError, type GatewayLockHandle } from './lock.js';
|
|
4
4
|
export { runGatewayLoop, type RunGatewayLoopOptions } from './run-loop.js';
|
|
5
5
|
export { restartGatewayProcessWithFreshPid, type GatewayRespawnResult } from './respawn.js';
|
|
@@ -8,7 +8,6 @@ import { resolveGatewayListenHost, resolveGatewayListenPlan } from "./listen.js"
|
|
|
8
8
|
import { assertGatewayRuntimeConfig } from "./runtime-config.js";
|
|
9
9
|
import { restartGatewayProcessWithFreshPid } from "./respawn.js";
|
|
10
10
|
import { GatewayService } from "./service.js";
|
|
11
|
-
import { createAgentResumeHandler, createEventsSSEHandler, createSendHandler } from "./hono/sse.js";
|
|
12
11
|
import { createHonoApp } from "./hono/app.js";
|
|
13
12
|
import { GatewayServer } from "./server.js";
|
|
14
13
|
import { GatewayLockError, acquireGatewayLock } from "./lock.js";
|
|
@@ -17,4 +16,4 @@ import { checkPortAvailable, forceFreePortAndWait, listPortListeners, parseLsofO
|
|
|
17
16
|
import { apiError, apiOk } from "./protocol.js";
|
|
18
17
|
import "./hono/index.js";
|
|
19
18
|
import { assertSecureGatewayHttpUrl, assertSecureWebSocketUrl, isInsecurePrivateWsAllowed, isSecureWebSocketUrl } from "./ws-security.js";
|
|
20
|
-
export { GatewayLockError, GatewayServer, GatewayService, acquireGatewayLock, apiError, apiOk, assertGatewayAuthConfigured, assertGatewayRuntimeConfig, assertSecureGatewayHttpUrl, assertSecureWebSocketUrl, buckets, buildDefaultCorsOrigins, checkPortAvailable,
|
|
19
|
+
export { GatewayLockError, GatewayServer, GatewayService, acquireGatewayLock, apiError, apiOk, assertGatewayAuthConfigured, assertGatewayRuntimeConfig, assertSecureGatewayHttpUrl, assertSecureWebSocketUrl, buckets, buildDefaultCorsOrigins, checkPortAvailable, createHonoApp, defaultGatewayBindMode, extractToken, forceFreePortAndWait, isAllInterfacesHost, isContainerEnvironment, isGatewayStrictSecurityEnabled, isInsecurePrivateWsAllowed, isLoopbackHost, isSecureWebSocketUrl, listPortListeners, parseLsofOutput, resolveEffectiveGatewayPort, resolveGatewayAuth, resolveGatewayBindHost, resolveGatewayBindHostSync, resolveGatewayBindMode, resolveGatewayEffectiveHost, resolveGatewayListenHost, resolveGatewayListenPlan, resolveGatewayServiceListenPort, restartGatewayProcessWithFreshPid, runGatewayLoop, validateToken };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Gateway protocol types
|
|
2
|
+
* Gateway HTTP protocol types.
|
|
3
3
|
*
|
|
4
4
|
* All client → server communication uses standard HTTP (POST/GET/PATCH/DELETE).
|
|
5
|
-
* Server → client streaming uses SSE (text/event-stream).
|
|
6
5
|
*/
|
|
7
6
|
export interface ApiResponse<T = unknown> {
|
|
8
7
|
ok: boolean;
|
|
@@ -13,11 +12,6 @@ export interface ApiError {
|
|
|
13
12
|
code: string;
|
|
14
13
|
message: string;
|
|
15
14
|
}
|
|
16
|
-
export interface SSEEvent {
|
|
17
|
-
id: string;
|
|
18
|
-
event: string;
|
|
19
|
-
data: unknown;
|
|
20
|
-
}
|
|
21
15
|
export interface GatewayConfig {
|
|
22
16
|
host: string;
|
|
23
17
|
port: number;
|
|
@@ -2,9 +2,9 @@ import { safeEqualSecret } from "./secret-equal.js";
|
|
|
2
2
|
import { KNOWN_WEAK_GATEWAY_TOKEN_PLACEHOLDERS, assertGatewayAuthNotKnownWeak } from "./known-weak-secrets.js";
|
|
3
3
|
import { auditGatewayConfig, collectGatewayConfigFindings, collectGatewaySecurityFindings, collectGatewayStartupGuardFindings } from "./audit.js";
|
|
4
4
|
import { detectSuspiciousPatterns, wrapExternalContent, wrapWebContent } from "./external-content.js";
|
|
5
|
+
import { createPreauthConnectionBudget, getMaxPreauthConnectionsPerIp } from "./preauth-connection-budget.js";
|
|
5
6
|
import { buildGatewayConsoleCspHeader, computeInlineScriptHashes } from "./csp.js";
|
|
6
7
|
import { checkBrowserOrigin } from "./origin-check.js";
|
|
7
8
|
import { ADMIN_SCOPE, DEFAULT_OPERATOR_SCOPES, KNOWN_OPERATOR_SCOPES, READ_SCOPE, WRITE_SCOPE, authorizeRouteScope, authorizeScope, isOperatorScope, parseScopesHeader } from "./operator-scopes.js";
|
|
8
9
|
import { DEFAULT_GATEWAY_HTTP_TOOL_DENY, filterDangerousHttpTools, isDangerousHttpTool } from "./dangerous-tools.js";
|
|
9
|
-
import { createPreauthConnectionBudget, getMaxPreauthConnectionsPerIp } from "./preauth-connection-budget.js";
|
|
10
10
|
export { ADMIN_SCOPE, DEFAULT_GATEWAY_HTTP_TOOL_DENY, DEFAULT_OPERATOR_SCOPES, KNOWN_OPERATOR_SCOPES, KNOWN_WEAK_GATEWAY_TOKEN_PLACEHOLDERS, READ_SCOPE, WRITE_SCOPE, assertGatewayAuthNotKnownWeak, auditGatewayConfig, authorizeRouteScope, authorizeScope, buildGatewayConsoleCspHeader, checkBrowserOrigin, collectGatewayConfigFindings, collectGatewaySecurityFindings, collectGatewayStartupGuardFindings, computeInlineScriptHashes, createPreauthConnectionBudget, detectSuspiciousPatterns, filterDangerousHttpTools, getMaxPreauthConnectionsPerIp, isDangerousHttpTool, isOperatorScope, parseScopesHeader, safeEqualSecret, wrapExternalContent, wrapWebContent };
|
|
@@ -2,7 +2,6 @@ import { resolveGatewayBindHost, resolveGatewayListenHosts } from "../config/gat
|
|
|
2
2
|
import { ensureXopcCliOnPath } from "../infra/path-env.js";
|
|
3
3
|
import { resolveGatewayListenPlan } from "./listen.js";
|
|
4
4
|
import { GatewayService } from "./service.js";
|
|
5
|
-
import { closeAllEventStreams } from "./hono/sse.js";
|
|
6
5
|
import { handleSiteShareUpgrade } from "../share/site-share-router.js";
|
|
7
6
|
import { createHonoApp } from "./hono/app.js";
|
|
8
7
|
import { serve } from "@hono/node-server";
|
|
@@ -57,9 +56,11 @@ var GatewayServer = class {
|
|
|
57
56
|
const attachUpgrade = (server) => {
|
|
58
57
|
server.on("upgrade", (req, socket, head) => {
|
|
59
58
|
try {
|
|
60
|
-
|
|
59
|
+
if (this.service.realtime.handleUpgrade(req, socket, head)) return;
|
|
60
|
+
if (handleSiteShareUpgrade(this.service, req, socket, head)) return;
|
|
61
|
+
socket.destroy();
|
|
61
62
|
} catch (err) {
|
|
62
|
-
console.error("[GatewayServer]
|
|
63
|
+
console.error("[GatewayServer] WebSocket upgrade error:", err);
|
|
63
64
|
try {
|
|
64
65
|
socket.destroy();
|
|
65
66
|
} catch {}
|
|
@@ -95,7 +96,6 @@ var GatewayServer = class {
|
|
|
95
96
|
}
|
|
96
97
|
async stop() {
|
|
97
98
|
console.log("[GatewayServer] Stopping gateway server...");
|
|
98
|
-
closeAllEventStreams();
|
|
99
99
|
const closeServer = async (server) => {
|
|
100
100
|
if (!server) return;
|
|
101
101
|
const forceClose = setTimeout(() => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { TurnOrigin } from '@xopcai/endpoint-tools-protocol';
|
|
1
2
|
/**
|
|
2
3
|
* GatewayAgentRunner — webchat agent invocation and the surrounding control
|
|
3
4
|
* surface (abort, steer, clarify-bridge plumbing, scheduled Task continuations).
|
|
@@ -23,7 +24,7 @@ import type { MessageBus } from '../../infra/bus/index.js';
|
|
|
23
24
|
import type { AgentService } from '../../agent/service.js';
|
|
24
25
|
import type { ChannelManager } from '../../channels/manager.js';
|
|
25
26
|
import type { SessionIndex } from '../../session/index.js';
|
|
26
|
-
import {
|
|
27
|
+
import type { ClarifyStreamEvent } from '../clarify-bridge.js';
|
|
27
28
|
import { ClarifyBridge, type ClarifyBridgeRequest } from '../clarify-bridge.js';
|
|
28
29
|
import type { UserTurnAttachment, UserTurnInput } from '../user-turn-input.js';
|
|
29
30
|
import { SessionInputCoordinator, type SubmitSessionInput } from './session-input-coordinator.js';
|
|
@@ -34,12 +35,13 @@ export interface GatewayAgentRunnerOptions {
|
|
|
34
35
|
getAgentService: () => AgentService;
|
|
35
36
|
getChannelManager: () => ChannelManager;
|
|
36
37
|
getConfig: () => Config;
|
|
37
|
-
/**
|
|
38
|
+
/** Publish low-frequency gateway state changes. */
|
|
38
39
|
emit: (type: string, payload: unknown) => void;
|
|
40
|
+
publishRealtime: (topic: string, event: string, data: unknown) => void;
|
|
41
|
+
completeRealtimeTopic: (topic: string) => void;
|
|
39
42
|
}
|
|
40
43
|
export declare class GatewayAgentRunner {
|
|
41
44
|
private readonly opts;
|
|
42
|
-
readonly runRelay: AgentRunRelay;
|
|
43
45
|
/** Per-run abort for webchat (POST /api/agent/abort or client disconnect). */
|
|
44
46
|
private readonly runAbortControllers;
|
|
45
47
|
private readonly runCompletions;
|
|
@@ -55,7 +57,7 @@ export declare class GatewayAgentRunner {
|
|
|
55
57
|
getClarifyBridge(): ClarifyBridge;
|
|
56
58
|
/** Called from `GatewayService.stop()` so the bridge gets cleaned up. */
|
|
57
59
|
disposeClarifyBridge(): void;
|
|
58
|
-
runAgent(message: string, channel: string, chatId: string, attachments?: UserTurnAttachment[], thinking?: string, runOptions?: {
|
|
60
|
+
runAgent(message: string, channel: string, chatId: string, origin: TurnOrigin, attachments?: UserTurnAttachment[], thinking?: string, runOptions?: {
|
|
59
61
|
signal?: AbortSignal;
|
|
60
62
|
runId?: string;
|
|
61
63
|
}): AsyncGenerator<{
|
|
@@ -89,7 +91,7 @@ export declare class GatewayAgentRunner {
|
|
|
89
91
|
state: import("../../storage/sqlite/session-input-repository.js").SessionInputState;
|
|
90
92
|
};
|
|
91
93
|
recoverSessionInputs(): void;
|
|
92
|
-
/** Abort an in-flight webchat agent run
|
|
94
|
+
/** Abort an in-flight webchat agent run. */
|
|
93
95
|
abortAgentRun(runId: string): Promise<{
|
|
94
96
|
aborted: boolean;
|
|
95
97
|
idle: boolean;
|
|
@@ -103,17 +105,17 @@ export declare class GatewayAgentRunner {
|
|
|
103
105
|
drainScheduledWebchatContinuation(sessionKey: string, message: string): Promise<void>;
|
|
104
106
|
/**
|
|
105
107
|
* Resolve clarify-bridge config for `sessionKey`: who delivers the question
|
|
106
|
-
* (webchat
|
|
108
|
+
* (webchat stream, Telegram message, or both), then start the bridge request.
|
|
107
109
|
* Rejects when neither path is available (e.g. CLI without webchat or TG).
|
|
108
110
|
*
|
|
109
|
-
* `
|
|
110
|
-
* `turnDispatcher.
|
|
111
|
+
* `publishStreamFor(runId)` is the bridge into AgentService's
|
|
112
|
+
* `turnDispatcher.enqueueWebchatStreamEvent`. We take it as a callback so the
|
|
111
113
|
* runner does not import AgentService statically.
|
|
112
114
|
*/
|
|
113
115
|
requestClarification(opts: {
|
|
114
116
|
sessionKey: string;
|
|
115
117
|
request: ClarifyBridgeRequest;
|
|
116
|
-
|
|
118
|
+
publishStreamFor: (runId: string) => (event: ClarifyStreamEvent) => void;
|
|
117
119
|
}): Promise<string>;
|
|
118
120
|
private deliverTelegramClarify;
|
|
119
121
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { AgentRunRelay } from "../agent-run-relay.js";
|
|
4
3
|
import { ClarifyBridge } from "../clarify-bridge.js";
|
|
5
4
|
import { runGatewayAgent } from "./run-gateway-agent.js";
|
|
6
5
|
import { SessionInputCoordinator } from "./session-input-coordinator.js";
|
|
@@ -10,7 +9,6 @@ init_logger();
|
|
|
10
9
|
const log = createLogger("Gateway:AgentRunner");
|
|
11
10
|
var GatewayAgentRunner = class {
|
|
12
11
|
opts;
|
|
13
|
-
runRelay = new AgentRunRelay();
|
|
14
12
|
/** Per-run abort for webchat (POST /api/agent/abort or client disconnect). */
|
|
15
13
|
runAbortControllers = /* @__PURE__ */ new Map();
|
|
16
14
|
runCompletions = /* @__PURE__ */ new Map();
|
|
@@ -24,7 +22,7 @@ var GatewayAgentRunner = class {
|
|
|
24
22
|
this.inputs = new SessionInputCoordinator({
|
|
25
23
|
sessionExists: async (sessionKey) => Boolean(await opts.sessionIndex.getSessionMetadata(sessionKey)),
|
|
26
24
|
execute: async (input) => {
|
|
27
|
-
const generator = this.runAgent(input.content, "webchat", input.sessionKey, input.attachments, input.thinking, { runId: input.runId });
|
|
25
|
+
const generator = this.runAgent(input.content, "webchat", input.sessionKey, input.origin, input.attachments, input.thinking, { runId: input.runId });
|
|
28
26
|
let result;
|
|
29
27
|
while (true) {
|
|
30
28
|
const step = await generator.next();
|
|
@@ -65,7 +63,7 @@ var GatewayAgentRunner = class {
|
|
|
65
63
|
disposeClarifyBridge() {
|
|
66
64
|
this.clarifyBridge.dispose();
|
|
67
65
|
}
|
|
68
|
-
async *runAgent(message, channel, chatId, attachments, thinking, runOptions) {
|
|
66
|
+
async *runAgent(message, channel, chatId, origin, attachments, thinking, runOptions) {
|
|
69
67
|
const trackedRunId = runOptions?.runId;
|
|
70
68
|
if (trackedRunId) {
|
|
71
69
|
let resolve = () => {};
|
|
@@ -78,12 +76,13 @@ var GatewayAgentRunner = class {
|
|
|
78
76
|
config: this.opts.getConfig(),
|
|
79
77
|
agentService: this.opts.getAgentService(),
|
|
80
78
|
bus: this.opts.bus,
|
|
81
|
-
runRelay: this.runRelay,
|
|
82
79
|
runAbortControllers: this.runAbortControllers,
|
|
83
80
|
activeWebchatRunBySession: this.activeWebchatRunBySession,
|
|
84
81
|
sessionIndex: this.opts.sessionIndex,
|
|
85
|
-
emit: this.opts.emit
|
|
86
|
-
|
|
82
|
+
emit: this.opts.emit,
|
|
83
|
+
publishRealtime: this.opts.publishRealtime,
|
|
84
|
+
completeRealtimeTopic: this.opts.completeRealtimeTopic
|
|
85
|
+
}, message, channel, chatId, origin, attachments, thinking, runOptions);
|
|
87
86
|
try {
|
|
88
87
|
let step = await iter.next();
|
|
89
88
|
while (!step.done) {
|
|
@@ -114,13 +113,11 @@ var GatewayAgentRunner = class {
|
|
|
114
113
|
recoverSessionInputs() {
|
|
115
114
|
this.inputs.recover();
|
|
116
115
|
}
|
|
117
|
-
/** Abort an in-flight webchat agent run
|
|
116
|
+
/** Abort an in-flight webchat agent run. */
|
|
118
117
|
async abortAgentRun(runId) {
|
|
119
118
|
this.clarifyBridge.cancelForRun(runId);
|
|
120
119
|
const keysToMark = [];
|
|
121
120
|
for (const [sk, id] of this.activeWebchatRunBySession) if (id === runId) keysToMark.push(sk);
|
|
122
|
-
const relaySk = this.runRelay.getSessionKey(runId);
|
|
123
|
-
if (relaySk && !keysToMark.includes(relaySk)) keysToMark.push(relaySk);
|
|
124
121
|
const c = this.runAbortControllers.get(runId);
|
|
125
122
|
if (!c) return {
|
|
126
123
|
aborted: false,
|
|
@@ -152,7 +149,11 @@ var GatewayAgentRunner = class {
|
|
|
152
149
|
clientMessageId,
|
|
153
150
|
delivery: "next",
|
|
154
151
|
content: userTurn.text,
|
|
155
|
-
attachments: userTurn.attachments
|
|
152
|
+
attachments: userTurn.attachments,
|
|
153
|
+
origin: {
|
|
154
|
+
type: "system",
|
|
155
|
+
source: "workflow"
|
|
156
|
+
}
|
|
156
157
|
});
|
|
157
158
|
if (accepted.ok === false) throw new Error(`Scheduled session input was rejected: ${accepted.code}`);
|
|
158
159
|
await this.inputs.waitForCompletion(sessionKey, clientMessageId);
|
|
@@ -173,17 +174,17 @@ var GatewayAgentRunner = class {
|
|
|
173
174
|
}
|
|
174
175
|
/**
|
|
175
176
|
* Resolve clarify-bridge config for `sessionKey`: who delivers the question
|
|
176
|
-
* (webchat
|
|
177
|
+
* (webchat stream, Telegram message, or both), then start the bridge request.
|
|
177
178
|
* Rejects when neither path is available (e.g. CLI without webchat or TG).
|
|
178
179
|
*
|
|
179
|
-
* `
|
|
180
|
-
* `turnDispatcher.
|
|
180
|
+
* `publishStreamFor(runId)` is the bridge into AgentService's
|
|
181
|
+
* `turnDispatcher.enqueueWebchatStreamEvent`. We take it as a callback so the
|
|
181
182
|
* runner does not import AgentService statically.
|
|
182
183
|
*/
|
|
183
184
|
async requestClarification(opts) {
|
|
184
|
-
const { sessionKey, request,
|
|
185
|
+
const { sessionKey, request, publishStreamFor } = opts;
|
|
185
186
|
const runId = this.activeWebchatRunBySession.get(sessionKey);
|
|
186
|
-
const
|
|
187
|
+
const publishStream = runId ? publishStreamFor(runId) : void 0;
|
|
187
188
|
const deliver = ((await this.opts.sessionIndex.getSessionMetadata(sessionKey).catch(() => null))?.routing)?.source === "telegram" ? async (ctx) => {
|
|
188
189
|
await this.deliverTelegramClarify(ctx);
|
|
189
190
|
} : void 0;
|
|
@@ -191,8 +192,7 @@ var GatewayAgentRunner = class {
|
|
|
191
192
|
return this.clarifyBridge.startRequest({
|
|
192
193
|
sessionKey,
|
|
193
194
|
runId,
|
|
194
|
-
|
|
195
|
-
publishSse,
|
|
195
|
+
publishStream,
|
|
196
196
|
request,
|
|
197
197
|
deliver
|
|
198
198
|
});
|
|
@@ -43,11 +43,11 @@ export interface GatewayConfigCoordinatorOptions {
|
|
|
43
43
|
getExtensionLoader: () => ExtensionLoader | null;
|
|
44
44
|
/** Re-evaluate browser-extension server attachment after agent defaults change. */
|
|
45
45
|
reconcileBrowserExtensionServer: () => Promise<void>;
|
|
46
|
-
/** Sync built-in
|
|
46
|
+
/** Sync the built-in consolidation automation after userContext.dreaming changes. */
|
|
47
47
|
reconcileDreamingAutomations: () => Promise<void>;
|
|
48
|
-
/** Latest channel status snapshot for the `channels.status`
|
|
48
|
+
/** Latest channel status snapshot for the `channels.status` event. */
|
|
49
49
|
getChannelsStatus: () => unknown;
|
|
50
|
-
/**
|
|
50
|
+
/** Realtime emit used for `config.reload` and `channels.status`. */
|
|
51
51
|
emit: (type: string, payload: unknown) => void;
|
|
52
52
|
}
|
|
53
53
|
export declare class GatewayConfigCoordinator {
|
|
@@ -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, {
|
|
@@ -6,11 +6,11 @@ import "../../storage/sqlite/index.js";
|
|
|
6
6
|
import { init_session_key, parseSessionKey } from "../../routing/session-key.js";
|
|
7
7
|
import { resolveExecutionContext } from "../../tasks/execution-context.js";
|
|
8
8
|
import { TaskRunCoordinator } from "../../tasks/task-run-coordinator.js";
|
|
9
|
-
import { recordExplicitRelationshipFollowUp } from "../../user-context/relationship-continuity.js";
|
|
10
9
|
import { formatAgentRunErrorForClient } from "../../agent/client-error-format.js";
|
|
11
10
|
import { prependEnvelopeTimestamp } from "../../channels/envelope-timestamp.js";
|
|
12
11
|
import "../chat-limits.js";
|
|
13
12
|
import { resolveWebchatSessionKey } from "../resolve-webchat-session-key.js";
|
|
13
|
+
import { recordExplicitRelationshipFollowUp } from "../../user-context/relationship-continuity.js";
|
|
14
14
|
import { ChatStreamMapper } from "../chat-stream/mapper.js";
|
|
15
15
|
import { coalesceThinkingDeltas } from "../chat-stream/thinking-delta-coalescer.js";
|
|
16
16
|
import crypto from "crypto";
|
|
@@ -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,21 +44,18 @@ 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;
|
|
51
50
|
if (webchatSessionKey) {
|
|
52
51
|
if (!webchatMetadata) throw new Error("Session metadata is unavailable");
|
|
53
|
-
|
|
54
|
-
if (!parsedSession) throw new Error("Resolved webchat session key is invalid");
|
|
52
|
+
if (!parseSessionKey(webchatSessionKey)) throw new Error("Resolved webchat session key is invalid");
|
|
55
53
|
updateInteractionStateFromMessage({
|
|
56
54
|
sessionKey: webchatSessionKey,
|
|
57
55
|
message
|
|
58
56
|
});
|
|
59
57
|
recordExplicitRelationshipFollowUp({
|
|
60
58
|
sessionKey: webchatSessionKey,
|
|
61
|
-
sourceAgentId: parsedSession.agentId,
|
|
62
59
|
message
|
|
63
60
|
});
|
|
64
61
|
const executionContext = resolveExecutionContext({
|
|
@@ -97,16 +94,17 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
97
94
|
}
|
|
98
95
|
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
96
|
};
|
|
100
|
-
const publishStreamEvent = (event) => channel === "webchat" ? runRelay.publish(runId, event) ?? event : event;
|
|
101
97
|
const emitAndYield = function* (events) {
|
|
102
98
|
for (const event of events) {
|
|
103
99
|
if (taskRun) captureTaskEvent(event);
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
100
|
+
if (channel === "webchat") {
|
|
101
|
+
publishRealtime(`run:${runId}`, event.type, event);
|
|
102
|
+
if (event.type === "run_start") publishRealtime("sessions", "run.started", {
|
|
103
|
+
sessionKey: streamSessionKey,
|
|
104
|
+
runId
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
yield event;
|
|
110
108
|
}
|
|
111
109
|
};
|
|
112
110
|
yield* emitAndYield(mapper.start());
|
|
@@ -130,7 +128,7 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
130
128
|
}
|
|
131
129
|
let streamError;
|
|
132
130
|
try {
|
|
133
|
-
const eventStream = agentService.turnDispatcher.processDirectStreaming(stampedMessage, sessionKey, prepared, thinking, {
|
|
131
|
+
const eventStream = agentService.turnDispatcher.processDirectStreaming(stampedMessage, sessionKey, origin, prepared, thinking, {
|
|
134
132
|
signal: mergedSignal,
|
|
135
133
|
runId
|
|
136
134
|
});
|
|
@@ -143,7 +141,7 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
143
141
|
taskRunStatus = mergedSignal.aborted ? "cancelled" : "succeeded";
|
|
144
142
|
taskRunSummary = endSummary;
|
|
145
143
|
yield* emitAndYield(mapper.end(endStatus, endSummary));
|
|
146
|
-
|
|
144
|
+
completeRealtimeTopic(`run:${runId}`);
|
|
147
145
|
try {
|
|
148
146
|
const metaAfter = await sessionIndex.getSessionMetadata(sessionKey);
|
|
149
147
|
if (metaAfter?.name) emit("session.updated", {
|
|
@@ -171,7 +169,7 @@ async function* runGatewayAgent(deps, message, channel, chatId, attachments, thi
|
|
|
171
169
|
const errorContent = formatAgentRunErrorForClient(streamError);
|
|
172
170
|
yield* emitAndYield(mapper.error(errorContent));
|
|
173
171
|
yield* emitAndYield(mapper.end("error", streamError));
|
|
174
|
-
|
|
172
|
+
completeRealtimeTopic(`run:${runId}`);
|
|
175
173
|
return {
|
|
176
174
|
status: "error",
|
|
177
175
|
summary: streamError
|
|
@@ -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.
|