@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,6 +1,6 @@
|
|
|
1
1
|
import type { Config } from '../config/schema.js';
|
|
2
|
-
import type { ApprovalDecision, ApprovalKind,
|
|
3
|
-
import {
|
|
2
|
+
import type { ApprovalDecision, ApprovalKind, ConversationDescriptor, PendingApproval, QueueEvent, WaitFilter } from './channel-shared.js';
|
|
3
|
+
import type { GatewayCredential } from '../gateway/credential.js';
|
|
4
4
|
export declare class XopcChannelBridge {
|
|
5
5
|
private readonly cfg;
|
|
6
6
|
private readonly params;
|
|
@@ -9,19 +9,16 @@ export declare class XopcChannelBridge {
|
|
|
9
9
|
private readonly pendingApprovals;
|
|
10
10
|
private cursor;
|
|
11
11
|
private closed;
|
|
12
|
-
private
|
|
12
|
+
private readonly realtimeClientId;
|
|
13
|
+
private realtime;
|
|
13
14
|
constructor(cfg: Config, params: {
|
|
14
15
|
gatewayUrl?: string;
|
|
15
16
|
gatewayCredential?: GatewayCredential;
|
|
16
|
-
claudeChannelMode: ClaudeChannelMode;
|
|
17
|
-
verbose: boolean;
|
|
18
17
|
});
|
|
19
|
-
setServer(_server: unknown): void;
|
|
20
18
|
start(): Promise<void>;
|
|
21
19
|
close(): Promise<void>;
|
|
22
|
-
private
|
|
23
|
-
private
|
|
24
|
-
private handleSseChunk;
|
|
20
|
+
private connectRealtime;
|
|
21
|
+
private handleRealtimeEvent;
|
|
25
22
|
private enqueueFromBroadcast;
|
|
26
23
|
private pushEvent;
|
|
27
24
|
listConversations(args: {
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { init_loader, loadConfig } from "../config/loader.js";
|
|
4
|
-
import {
|
|
5
|
-
import { loadUndiciRuntimeDeps } from "../infra/undici-fetch.js";
|
|
4
|
+
import { RealtimeClient } from "../../packages/realtime-client/src/index.js";
|
|
6
5
|
import { toConversation } from "./channel-shared.js";
|
|
7
6
|
import { createGatewayHttpClientFromConfig, resolveGatewayHttpBaseUrl } from "./gateway-http-client.js";
|
|
7
|
+
import { createRequire } from "node:module";
|
|
8
8
|
import crypto from "node:crypto";
|
|
9
9
|
//#region src/mcp/channel-bridge.ts
|
|
10
10
|
init_loader();
|
|
11
11
|
init_logger();
|
|
12
12
|
const log = createLogger("Mcp:Bridge");
|
|
13
|
+
const { WebSocket } = createRequire(import.meta.url)("ws");
|
|
13
14
|
const QUEUE_LIMIT = 1e3;
|
|
14
15
|
var XopcChannelBridge = class {
|
|
15
16
|
client = null;
|
|
@@ -17,12 +18,12 @@ var XopcChannelBridge = class {
|
|
|
17
18
|
pendingApprovals = /* @__PURE__ */ new Map();
|
|
18
19
|
cursor = 0;
|
|
19
20
|
closed = false;
|
|
20
|
-
|
|
21
|
+
realtimeClientId = `mcp-${crypto.randomUUID()}`;
|
|
22
|
+
realtime = null;
|
|
21
23
|
constructor(cfg, params) {
|
|
22
24
|
this.cfg = cfg;
|
|
23
25
|
this.params = params;
|
|
24
26
|
}
|
|
25
|
-
setServer(_server) {}
|
|
26
27
|
async start() {
|
|
27
28
|
log.info({ phase: "mcp.bridge.connect" }, "MCP channel bridge starting");
|
|
28
29
|
this.client = createGatewayHttpClientFromConfig({
|
|
@@ -30,7 +31,7 @@ var XopcChannelBridge = class {
|
|
|
30
31
|
gatewayUrl: this.params.gatewayUrl,
|
|
31
32
|
gatewayCredential: this.params.gatewayCredential
|
|
32
33
|
});
|
|
33
|
-
this.
|
|
34
|
+
this.connectRealtime();
|
|
34
35
|
}
|
|
35
36
|
async close() {
|
|
36
37
|
log.info({
|
|
@@ -38,84 +39,55 @@ var XopcChannelBridge = class {
|
|
|
38
39
|
queueSize: this.queue.length
|
|
39
40
|
}, "MCP channel bridge closing");
|
|
40
41
|
this.closed = true;
|
|
41
|
-
this.
|
|
42
|
-
this.
|
|
42
|
+
this.realtime?.disconnect();
|
|
43
|
+
this.realtime = null;
|
|
43
44
|
this.queue.length = 0;
|
|
44
45
|
this.pendingApprovals.clear();
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
+
connectRealtime() {
|
|
47
48
|
if (this.closed) return;
|
|
48
|
-
this.eventsAbort?.abort();
|
|
49
|
-
const abort = new AbortController();
|
|
50
|
-
this.eventsAbort = abort;
|
|
51
49
|
const baseUrl = resolveGatewayHttpBaseUrl(this.cfg, this.params.gatewayUrl);
|
|
52
|
-
this.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
50
|
+
this.realtime?.disconnect();
|
|
51
|
+
this.realtime = new RealtimeClient({
|
|
52
|
+
clientId: this.realtimeClientId,
|
|
53
|
+
clientKind: "mcp",
|
|
54
|
+
getWebSocketUrl: () => {
|
|
55
|
+
const url = new URL(baseUrl);
|
|
56
|
+
url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
|
|
57
|
+
url.pathname = "/api/realtime/v1/ws";
|
|
58
|
+
url.search = "";
|
|
59
|
+
url.hash = "";
|
|
60
|
+
return url.toString();
|
|
61
|
+
},
|
|
62
|
+
issueTicket: async () => {
|
|
63
|
+
const response = await this.client.postJson("/api/realtime/tickets", {
|
|
64
|
+
clientId: this.realtimeClientId,
|
|
65
|
+
clientKind: "mcp"
|
|
66
|
+
});
|
|
67
|
+
if (!response.payload?.ticket) throw new Error(response.error?.message ?? "Realtime ticket response is invalid");
|
|
68
|
+
return response.payload.ticket;
|
|
69
|
+
},
|
|
70
|
+
createWebSocket: (url) => new WebSocket(url),
|
|
71
|
+
onEvent: (event) => this.handleRealtimeEvent(event),
|
|
72
|
+
onStateChange: (state, error) => {
|
|
73
|
+
if (state === "error") log.warn({
|
|
74
|
+
errorMessage: error,
|
|
75
|
+
phase: "mcp.bridge.realtime",
|
|
69
76
|
baseUrl
|
|
70
|
-
}, `Gateway
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
const reader = res.body.getReader();
|
|
74
|
-
const decoder = new TextDecoder();
|
|
75
|
-
let buffer = "";
|
|
76
|
-
while (!this.closed && !signal.aborted) {
|
|
77
|
-
const { done, value } = await reader.read();
|
|
78
|
-
if (done) break;
|
|
79
|
-
buffer += decoder.decode(value, { stream: true });
|
|
80
|
-
let splitAt = buffer.indexOf("\n\n");
|
|
81
|
-
while (splitAt >= 0) {
|
|
82
|
-
this.handleSseChunk(buffer.slice(0, splitAt));
|
|
83
|
-
buffer = buffer.slice(splitAt + 2);
|
|
84
|
-
splitAt = buffer.indexOf("\n\n");
|
|
85
|
-
}
|
|
77
|
+
}, `Gateway realtime connection failed: ${error ?? "unknown error"}`);
|
|
86
78
|
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
handleSseChunk(chunk) {
|
|
102
|
-
let eventName = "message";
|
|
103
|
-
let data = "";
|
|
104
|
-
for (const line of chunk.split("\n")) if (line.startsWith("event:")) eventName = line.slice(6).trim();
|
|
105
|
-
else if (line.startsWith("data:")) data += line.slice(5).trim();
|
|
106
|
-
if (!data) return;
|
|
107
|
-
try {
|
|
108
|
-
const parsed = JSON.parse(data);
|
|
109
|
-
this.enqueueFromBroadcast({
|
|
110
|
-
type: eventName,
|
|
111
|
-
...parsed
|
|
112
|
-
});
|
|
113
|
-
} catch {
|
|
114
|
-
this.enqueueFromBroadcast({
|
|
115
|
-
type: eventName,
|
|
116
|
-
raw: data
|
|
117
|
-
});
|
|
118
|
-
}
|
|
79
|
+
});
|
|
80
|
+
this.realtime.subscribe("gateway");
|
|
81
|
+
this.realtime.subscribe("sessions");
|
|
82
|
+
this.realtime.connect();
|
|
83
|
+
}
|
|
84
|
+
handleRealtimeEvent(event) {
|
|
85
|
+
if (event.topic !== "gateway" && event.topic !== "sessions") return;
|
|
86
|
+
const data = event.data && typeof event.data === "object" && !Array.isArray(event.data) ? event.data : { raw: event.data };
|
|
87
|
+
this.enqueueFromBroadcast({
|
|
88
|
+
...data,
|
|
89
|
+
type: event.event
|
|
90
|
+
});
|
|
119
91
|
}
|
|
120
92
|
enqueueFromBroadcast(data) {
|
|
121
93
|
const type = String(data.type ?? data.event ?? "");
|
|
@@ -10,19 +10,15 @@ init_loader();
|
|
|
10
10
|
init_package_version();
|
|
11
11
|
async function createXopcChannelMcpServer(opts = {}) {
|
|
12
12
|
const cfg = opts.config ?? loadConfig();
|
|
13
|
-
const
|
|
14
|
-
const capabilities = getChannelMcpCapabilities(claudeChannelMode);
|
|
13
|
+
const capabilities = getChannelMcpCapabilities(opts.claudeChannelMode ?? "auto");
|
|
15
14
|
const server = new McpServer({
|
|
16
15
|
name: "xopc",
|
|
17
16
|
version: PACKAGE_VERSION
|
|
18
17
|
}, capabilities ? { capabilities } : void 0);
|
|
19
18
|
const bridge = new XopcChannelBridge(cfg, {
|
|
20
19
|
gatewayUrl: opts.gatewayUrl,
|
|
21
|
-
gatewayCredential: opts.gatewayCredential
|
|
22
|
-
claudeChannelMode,
|
|
23
|
-
verbose: opts.verbose ?? false
|
|
20
|
+
gatewayCredential: opts.gatewayCredential
|
|
24
21
|
});
|
|
25
|
-
bridge.setServer(server);
|
|
26
22
|
server.server.setNotificationHandler(ClaudePermissionRequestSchema, async ({ params }) => {
|
|
27
23
|
await bridge.handleClaudePermissionRequest({
|
|
28
24
|
requestId: params.request_id,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getSqliteDatabase } from "../../storage/sqlite/transaction.js";
|
|
2
|
-
import {
|
|
2
|
+
import { listUnderstandings } from "../../storage/sqlite/user-context-repository.js";
|
|
3
3
|
import { getKnowledgeSourceItem } from "../../storage/sqlite/knowledge-repository.js";
|
|
4
4
|
import { getConnectorSyncPolicyForConnection } from "../../storage/sqlite/connector-sync-policy-repository.js";
|
|
5
5
|
import { wrapExternalContent } from "../../gateway/security/external-content.js";
|
|
@@ -162,25 +162,20 @@ var UserUnderstandingContextProvider = class {
|
|
|
162
162
|
async collect(input) {
|
|
163
163
|
const scope = eventRows(input.eventIds).at(-1);
|
|
164
164
|
if (!scope) return emptyContext();
|
|
165
|
-
const records =
|
|
166
|
-
workspaceId: scope.workspace_id,
|
|
167
|
-
...scope.project_id ? { visibleToProjectId: scope.project_id } : { unscopedProjectOnly: true },
|
|
168
|
-
status: "active",
|
|
169
|
-
limit: 20
|
|
170
|
-
}).filter((record) => {
|
|
165
|
+
const records = listUnderstandings(["active"]).filter((record) => {
|
|
171
166
|
const now = Date.now();
|
|
172
|
-
|
|
173
|
-
|
|
167
|
+
const scopeMatches = record.scope.type === "global" || record.scope.type === "workspace" && record.scope.id === scope.workspace_id || record.scope.type === "project" && record.scope.id === scope.project_id;
|
|
168
|
+
return record.disclosurePolicy === "referenceable" && record.sensitivity !== "secret" && record.sensitivity !== "regulated" && scopeMatches && (!record.validFrom || record.validFrom <= now) && (!record.validTo || record.validTo >= now) && (!record.expiresAt || record.expiresAt >= now) && !record.conflictGroupId && (record.explicitness === "explicit" || record.confidence >= .7);
|
|
169
|
+
}).slice(0, 20);
|
|
174
170
|
return {
|
|
175
171
|
content: { records: records.map((record) => ({
|
|
176
|
-
evidenceId: `
|
|
172
|
+
evidenceId: `understanding:${record.id}`,
|
|
177
173
|
kind: record.kind,
|
|
178
|
-
content: boundedText(record.
|
|
174
|
+
content: boundedText(record.statement, 1e3),
|
|
179
175
|
confidence: record.confidence,
|
|
180
|
-
importance: record.importance,
|
|
181
176
|
updatedAt: record.updatedAt
|
|
182
177
|
})) },
|
|
183
|
-
evidenceIds: records.map((record) => `
|
|
178
|
+
evidenceIds: records.map((record) => `understanding:${record.id}`)
|
|
184
179
|
};
|
|
185
180
|
}
|
|
186
181
|
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type ServerRealtimeMessage } from '@xopcai/realtime-protocol';
|
|
2
|
+
export type RealtimeEvent = Extract<ServerRealtimeMessage, {
|
|
3
|
+
kind: 'realtime.event';
|
|
4
|
+
}>;
|
|
5
|
+
export type RealtimeGap = Extract<ServerRealtimeMessage, {
|
|
6
|
+
kind: 'realtime.gap';
|
|
7
|
+
}>;
|
|
8
|
+
export type RealtimeDelivery = RealtimeEvent | RealtimeGap;
|
|
9
|
+
export interface RealtimeTopicPolicy {
|
|
10
|
+
replayCapacity: number;
|
|
11
|
+
}
|
|
12
|
+
export type RealtimeTopicPolicyResolver = (topic: string) => RealtimeTopicPolicy;
|
|
13
|
+
export interface RealtimeSubscriptionHandle {
|
|
14
|
+
initial: RealtimeDelivery[];
|
|
15
|
+
cursor: number;
|
|
16
|
+
unsubscribe: () => void;
|
|
17
|
+
}
|
|
18
|
+
export declare function defaultRealtimeTopicPolicy(topic: string): RealtimeTopicPolicy;
|
|
19
|
+
export declare class RealtimeBroker {
|
|
20
|
+
private readonly resolvePolicy;
|
|
21
|
+
private readonly onListenerError;
|
|
22
|
+
private readonly topics;
|
|
23
|
+
constructor(resolvePolicy?: RealtimeTopicPolicyResolver, onListenerError?: (error: unknown, topic: string) => void);
|
|
24
|
+
publish(topic: string, event: string, data: unknown, now?: number): RealtimeEvent;
|
|
25
|
+
subscribe(topic: string, afterSeq: number | undefined, listener: (event: RealtimeEvent) => void): RealtimeSubscriptionHandle;
|
|
26
|
+
removeTopic(topic: string): void;
|
|
27
|
+
currentSequence(topic: string): number;
|
|
28
|
+
hasTopic(topic: string): boolean;
|
|
29
|
+
private replayFrom;
|
|
30
|
+
private ensureTopic;
|
|
31
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { realtimeEventNameSchema, realtimeTopicSchema } from "../../packages/realtime-protocol/src/index.js";
|
|
2
|
+
import crypto from "node:crypto";
|
|
3
|
+
//#region src/realtime/broker.ts
|
|
4
|
+
const DEFAULT_TOPIC_POLICY = { replayCapacity: 0 };
|
|
5
|
+
function defaultRealtimeTopicPolicy(topic) {
|
|
6
|
+
if (topic.startsWith("run:")) return { replayCapacity: 8e3 };
|
|
7
|
+
if (topic.startsWith("session:")) return { replayCapacity: 200 };
|
|
8
|
+
if (topic === "logs") return { replayCapacity: 500 };
|
|
9
|
+
if (topic === "gateway" || topic === "sessions") return { replayCapacity: 1e3 };
|
|
10
|
+
return DEFAULT_TOPIC_POLICY;
|
|
11
|
+
}
|
|
12
|
+
var RealtimeBroker = class {
|
|
13
|
+
topics = /* @__PURE__ */ new Map();
|
|
14
|
+
constructor(resolvePolicy = defaultRealtimeTopicPolicy, onListenerError = () => {}) {
|
|
15
|
+
this.resolvePolicy = resolvePolicy;
|
|
16
|
+
this.onListenerError = onListenerError;
|
|
17
|
+
}
|
|
18
|
+
publish(topic, event, data, now = Date.now()) {
|
|
19
|
+
realtimeTopicSchema.parse(topic);
|
|
20
|
+
realtimeEventNameSchema.parse(event);
|
|
21
|
+
const state = this.ensureTopic(topic);
|
|
22
|
+
const message = {
|
|
23
|
+
protocolVersion: 1,
|
|
24
|
+
messageId: crypto.randomUUID(),
|
|
25
|
+
kind: "realtime.event",
|
|
26
|
+
sentAt: now,
|
|
27
|
+
payload: {
|
|
28
|
+
topic,
|
|
29
|
+
seq: state.nextSeq++,
|
|
30
|
+
event,
|
|
31
|
+
data
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const capacity = this.resolvePolicy(topic).replayCapacity;
|
|
35
|
+
if (capacity > 0) {
|
|
36
|
+
state.events.push(message);
|
|
37
|
+
if (state.events.length > capacity) state.events.splice(0, state.events.length - capacity);
|
|
38
|
+
}
|
|
39
|
+
for (const listener of state.listeners) try {
|
|
40
|
+
listener(message);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
this.onListenerError(error, topic);
|
|
43
|
+
}
|
|
44
|
+
return message;
|
|
45
|
+
}
|
|
46
|
+
subscribe(topic, afterSeq, listener) {
|
|
47
|
+
realtimeTopicSchema.parse(topic);
|
|
48
|
+
const state = this.ensureTopic(topic);
|
|
49
|
+
state.listeners.add(listener);
|
|
50
|
+
const initial = afterSeq === void 0 ? [] : this.replayFrom(topic, state, afterSeq);
|
|
51
|
+
const gap = initial[0]?.kind === "realtime.gap" ? initial[0] : void 0;
|
|
52
|
+
const currentSeq = state.nextSeq - 1;
|
|
53
|
+
return {
|
|
54
|
+
initial,
|
|
55
|
+
cursor: gap ? gap.payload.earliestSeq - 1 : afterSeq === void 0 ? currentSeq : Math.min(afterSeq, currentSeq),
|
|
56
|
+
unsubscribe: () => {
|
|
57
|
+
state.listeners.delete(listener);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
removeTopic(topic) {
|
|
62
|
+
this.topics.delete(topic);
|
|
63
|
+
}
|
|
64
|
+
currentSequence(topic) {
|
|
65
|
+
return (this.topics.get(topic)?.nextSeq ?? 1) - 1;
|
|
66
|
+
}
|
|
67
|
+
hasTopic(topic) {
|
|
68
|
+
return this.topics.has(topic);
|
|
69
|
+
}
|
|
70
|
+
replayFrom(topic, state, afterSeq) {
|
|
71
|
+
const currentSeq = state.nextSeq - 1;
|
|
72
|
+
if (afterSeq > currentSeq) return [{
|
|
73
|
+
protocolVersion: 1,
|
|
74
|
+
messageId: crypto.randomUUID(),
|
|
75
|
+
kind: "realtime.gap",
|
|
76
|
+
sentAt: Date.now(),
|
|
77
|
+
payload: {
|
|
78
|
+
topic,
|
|
79
|
+
requestedSeq: afterSeq,
|
|
80
|
+
earliestSeq: state.events[0]?.payload.seq ?? 1,
|
|
81
|
+
recoverable: false
|
|
82
|
+
}
|
|
83
|
+
}];
|
|
84
|
+
if (currentSeq <= afterSeq) return [];
|
|
85
|
+
const earliestSeq = state.events[0]?.payload.seq;
|
|
86
|
+
if (earliestSeq === void 0 || afterSeq + 1 < earliestSeq) return [{
|
|
87
|
+
protocolVersion: 1,
|
|
88
|
+
messageId: crypto.randomUUID(),
|
|
89
|
+
kind: "realtime.gap",
|
|
90
|
+
sentAt: Date.now(),
|
|
91
|
+
payload: {
|
|
92
|
+
topic,
|
|
93
|
+
requestedSeq: afterSeq,
|
|
94
|
+
earliestSeq: earliestSeq ?? currentSeq + 1,
|
|
95
|
+
recoverable: earliestSeq !== void 0
|
|
96
|
+
}
|
|
97
|
+
}, ...state.events];
|
|
98
|
+
return state.events.filter((event) => event.payload.seq > afterSeq);
|
|
99
|
+
}
|
|
100
|
+
ensureTopic(topic) {
|
|
101
|
+
let state = this.topics.get(topic);
|
|
102
|
+
if (!state) {
|
|
103
|
+
state = {
|
|
104
|
+
nextSeq: 1,
|
|
105
|
+
events: [],
|
|
106
|
+
listeners: /* @__PURE__ */ new Set()
|
|
107
|
+
};
|
|
108
|
+
this.topics.set(topic, state);
|
|
109
|
+
}
|
|
110
|
+
return state;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
//#endregion
|
|
114
|
+
export { RealtimeBroker, defaultRealtimeTopicPolicy };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { IncomingMessage } from 'node:http';
|
|
2
|
+
import type { Socket } from 'node:net';
|
|
3
|
+
import type { EndpointToolRuntime } from '../endpoint-tools/runtime.js';
|
|
4
|
+
import { RealtimeBroker } from './broker.js';
|
|
5
|
+
import { RealtimeTicketStore } from './tickets.js';
|
|
6
|
+
export declare class RealtimeRuntime {
|
|
7
|
+
private readonly endpointTools?;
|
|
8
|
+
readonly broker: RealtimeBroker;
|
|
9
|
+
readonly tickets: RealtimeTicketStore;
|
|
10
|
+
private readonly preauthBudget;
|
|
11
|
+
private readonly wss;
|
|
12
|
+
private readonly topicCleanupTimers;
|
|
13
|
+
private closed;
|
|
14
|
+
constructor(endpointTools?: EndpointToolRuntime);
|
|
15
|
+
handleUpgrade(req: IncomingMessage, socket: Socket, head: Buffer): boolean;
|
|
16
|
+
close(): void;
|
|
17
|
+
completeTopic(topic: string, ttlMs?: number): void;
|
|
18
|
+
private handleConnection;
|
|
19
|
+
private rawDataToText;
|
|
20
|
+
}
|