@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,7 @@
|
|
|
1
1
|
import { __toCommonJS } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { PACKAGE_VERSION, init_package_version } from "../package-version.js";
|
|
3
3
|
import { getLogDir } from "../utils/logger/config.js";
|
|
4
|
+
import { init_log_stream, subscribeToLogs } from "../utils/logger/log-stream.js";
|
|
4
5
|
import { getRuntimeLogStats } from "../utils/logger/stats.js";
|
|
5
6
|
import { createLogger } from "../utils/logger/index.js";
|
|
6
7
|
import { init_logger } from "../utils/logger.js";
|
|
@@ -52,17 +53,19 @@ import { registerClarifyBridge } from "./clarify-runtime.js";
|
|
|
52
53
|
import { ChannelManager } from "../channels/manager.js";
|
|
53
54
|
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
54
55
|
import "../config/index.js";
|
|
56
|
+
import { startConnectedKnowledgeCoordinator } from "../knowledge/coordinator.js";
|
|
57
|
+
import "../knowledge/index.js";
|
|
58
|
+
import { startConnectorLearningCoordinator } from "../connectors/learning-coordinator.js";
|
|
59
|
+
import { ConnectedSourceChangePublisher } from "../connectors/source-change-publisher.js";
|
|
60
|
+
import { startConnectorSupervisor } from "../connectors/supervisor.js";
|
|
55
61
|
import { DiscussionService } from "../discussions/service.js";
|
|
56
62
|
import { DiscussionOrganizer } from "../discussions/organizer.js";
|
|
57
63
|
import { DiscussionLiveWorker } from "../discussions/live-worker.js";
|
|
58
64
|
import { DiscussionOrganizerWorker } from "../discussions/organizer-worker.js";
|
|
59
65
|
import { DiscussionSealer } from "../discussions/sealer.js";
|
|
60
66
|
import "../discussions/index.js";
|
|
61
|
-
import {
|
|
62
|
-
import "../
|
|
63
|
-
import { startConnectorLearningCoordinator } from "../connectors/learning-coordinator.js";
|
|
64
|
-
import { ConnectedSourceChangePublisher } from "../connectors/source-change-publisher.js";
|
|
65
|
-
import { startConnectorSupervisor } from "../connectors/supervisor.js";
|
|
67
|
+
import { EndpointToolRuntime } from "../endpoint-tools/runtime.js";
|
|
68
|
+
import "../endpoint-tools/index.js";
|
|
66
69
|
import { assertGatewayAuthConfigured, extractToken, resolveGatewayAuth, validateToken } from "./auth.js";
|
|
67
70
|
import { reconcileDreamingAutomations } from "./dreaming-automation-reconciler.js";
|
|
68
71
|
import { NotesStore } from "../notes/store.js";
|
|
@@ -102,7 +105,7 @@ import { GatewaySessionsApi } from "./service/sessions-api.js";
|
|
|
102
105
|
import { GatewayMarketplaceService } from "./service/marketplace-service.js";
|
|
103
106
|
import { GatewayConfigCoordinator } from "./service/config-coordinator.js";
|
|
104
107
|
import { GatewayAgentRunner } from "./service/agent-runner.js";
|
|
105
|
-
import {
|
|
108
|
+
import { RealtimeRuntime } from "../realtime/runtime.js";
|
|
106
109
|
import { GatewayReadiness } from "./startup-readiness.js";
|
|
107
110
|
import { createGatewayStartupTrace } from "./startup-trace.js";
|
|
108
111
|
import { applyAutomaticVoiceLanguage, inferProductLanguageFromEnvironment, initializeVoiceDefaults, prepareConfiguredLocalVoiceModel } from "../voice/language-profile.js";
|
|
@@ -113,6 +116,7 @@ init_channel_catalog_service();
|
|
|
113
116
|
init_schema();
|
|
114
117
|
init_providers();
|
|
115
118
|
init_logger();
|
|
119
|
+
init_log_stream();
|
|
116
120
|
init_paths();
|
|
117
121
|
init_package_version();
|
|
118
122
|
init_resolve_route();
|
|
@@ -144,7 +148,8 @@ var GatewayService = class {
|
|
|
144
148
|
getConfig: () => this.config
|
|
145
149
|
});
|
|
146
150
|
auth;
|
|
147
|
-
|
|
151
|
+
endpointTools = new EndpointToolRuntime();
|
|
152
|
+
realtime = new RealtimeRuntime(this.endpointTools);
|
|
148
153
|
getConfig() {
|
|
149
154
|
return this.config;
|
|
150
155
|
}
|
|
@@ -178,6 +183,7 @@ var GatewayService = class {
|
|
|
178
183
|
connectedKnowledgeCoordinator = null;
|
|
179
184
|
stopAutomationProductEventBridge = null;
|
|
180
185
|
stopSessionTranscriptAutomationEvents = null;
|
|
186
|
+
stopRealtimeLogBridge = null;
|
|
181
187
|
/**
|
|
182
188
|
* Webchat agent invocation surface (`runAgent`, `abortAgentRun`, `steer*`,
|
|
183
189
|
* `submitClarifyResponse`, clarify-bridge dispatch). Owns the
|
|
@@ -220,7 +226,7 @@ var GatewayService = class {
|
|
|
220
226
|
this.proactiveWorker = new ProactiveWorker(new ReadonlyProactiveAgentExecutor(() => this.config));
|
|
221
227
|
this.proactiveTemporalWorker = new ProactiveTemporalWorker(this.proactive);
|
|
222
228
|
this.proactiveInboxWorker = new ProactiveInboxWorker({ deliver: async ({ inboxItem }) => {
|
|
223
|
-
this.
|
|
229
|
+
this.emit("proactive.inbox.created", inboxItem);
|
|
224
230
|
await this.createMobileNotificationService().deliverGatewayEvent("proactive.inbox.created", inboxItem);
|
|
225
231
|
} });
|
|
226
232
|
let bootstrapConfigChanged = initializeVoiceDefaults(this.config, inferProductLanguageFromEnvironment());
|
|
@@ -280,10 +286,10 @@ var GatewayService = class {
|
|
|
280
286
|
this.notesService = new NotesService(new NotesStore());
|
|
281
287
|
this.projects = new ProjectService(void 0, this.proactive);
|
|
282
288
|
const emitDiscussion = (capture) => {
|
|
283
|
-
this.
|
|
289
|
+
this.emit("discussion.updated", capture);
|
|
284
290
|
};
|
|
285
291
|
this.discussions = new DiscussionService(this.notesService, this.projects, (type, payload) => {
|
|
286
|
-
this.
|
|
292
|
+
this.emit(type, payload);
|
|
287
293
|
});
|
|
288
294
|
this.discussionWorker = new DiscussionOrganizerWorker(new DiscussionOrganizer({
|
|
289
295
|
notes: this.notesService,
|
|
@@ -302,7 +308,7 @@ var GatewayService = class {
|
|
|
302
308
|
riskCount: organization.risks.length,
|
|
303
309
|
openQuestionCount: organization.openQuestions.length
|
|
304
310
|
};
|
|
305
|
-
this.
|
|
311
|
+
this.emit("discussion.completed", payload);
|
|
306
312
|
publishAutomationProductEvent({
|
|
307
313
|
type: "discussion.completed",
|
|
308
314
|
source: "discussions",
|
|
@@ -321,7 +327,7 @@ var GatewayService = class {
|
|
|
321
327
|
const transcript = this.discussions.transcript(segment.discussionId);
|
|
322
328
|
capture.then((detail) => {
|
|
323
329
|
if (!detail || !transcript) return;
|
|
324
|
-
this.
|
|
330
|
+
this.emit("discussion.segment.updated", {
|
|
325
331
|
discussionId: segment.discussionId,
|
|
326
332
|
noteId: detail.discussion.noteId,
|
|
327
333
|
transcriptRevision: transcript.revision,
|
|
@@ -351,7 +357,11 @@ var GatewayService = class {
|
|
|
351
357
|
getAgentService: () => this.ensureAgentService(),
|
|
352
358
|
getChannelManager: () => this.channelManager,
|
|
353
359
|
getConfig: () => this.config,
|
|
354
|
-
emit: (type, payload) => this.
|
|
360
|
+
emit: (type, payload) => this.emit(type, payload),
|
|
361
|
+
publishRealtime: (topic, event, data) => {
|
|
362
|
+
this.realtime.broker.publish(topic, event, data);
|
|
363
|
+
},
|
|
364
|
+
completeRealtimeTopic: (topic) => this.realtime.completeTopic(topic)
|
|
355
365
|
});
|
|
356
366
|
this.sessions = new GatewaySessionsApi({
|
|
357
367
|
sessionIndex: this.sessionIndex,
|
|
@@ -422,6 +432,7 @@ var GatewayService = class {
|
|
|
422
432
|
});
|
|
423
433
|
},
|
|
424
434
|
extensionRegistry: this.extensionLoader?.getRegistry(),
|
|
435
|
+
endpointTools: this.endpointTools,
|
|
425
436
|
getAutomationService: () => this.automationService,
|
|
426
437
|
getBrowserRecipeService: () => this.browserRecipes,
|
|
427
438
|
getNotesService: () => this.notesService,
|
|
@@ -444,8 +455,8 @@ var GatewayService = class {
|
|
|
444
455
|
gatewayClarify: { requestClarification: (sessionKey, request) => this.agentRunner.requestClarification({
|
|
445
456
|
sessionKey,
|
|
446
457
|
request,
|
|
447
|
-
|
|
448
|
-
this._agentService.turnDispatcher.
|
|
458
|
+
publishStreamFor: (_runId) => (event) => {
|
|
459
|
+
this._agentService.turnDispatcher.enqueueWebchatStreamEvent(sessionKey, event);
|
|
449
460
|
}
|
|
450
461
|
}) }
|
|
451
462
|
});
|
|
@@ -542,7 +553,10 @@ var GatewayService = class {
|
|
|
542
553
|
return sessionKey;
|
|
543
554
|
},
|
|
544
555
|
runAgent: async (runId, sessionKey, message) => {
|
|
545
|
-
const stream = this.agentRunner.runAgent(message, "webchat", sessionKey,
|
|
556
|
+
const stream = this.agentRunner.runAgent(message, "webchat", sessionKey, {
|
|
557
|
+
type: "system",
|
|
558
|
+
source: "workflow"
|
|
559
|
+
}, void 0, void 0, { runId });
|
|
546
560
|
while (!(await stream.next()).done);
|
|
547
561
|
}
|
|
548
562
|
});
|
|
@@ -694,6 +708,9 @@ var GatewayService = class {
|
|
|
694
708
|
}
|
|
695
709
|
async start() {
|
|
696
710
|
if (this.running) return;
|
|
711
|
+
this.stopRealtimeLogBridge = subscribeToLogs((entry) => {
|
|
712
|
+
this.realtime.broker.publish("logs", "log.entry", entry);
|
|
713
|
+
});
|
|
697
714
|
setPairingBroadcastSink((type, payload) => {
|
|
698
715
|
this.emit(type, payload);
|
|
699
716
|
});
|
|
@@ -966,8 +983,12 @@ var GatewayService = class {
|
|
|
966
983
|
async stop() {
|
|
967
984
|
if (!this.running) return;
|
|
968
985
|
setPairingBroadcastSink(null);
|
|
986
|
+
this.stopRealtimeLogBridge?.();
|
|
987
|
+
this.stopRealtimeLogBridge = null;
|
|
969
988
|
log.debug("Stopping gateway service...");
|
|
970
989
|
this.readiness.markStarting();
|
|
990
|
+
this.endpointTools.close();
|
|
991
|
+
this.realtime.close();
|
|
971
992
|
await this.proactiveWorker.stop();
|
|
972
993
|
await this.discussionWorker.stop();
|
|
973
994
|
await this.discussionSealer.stop();
|
|
@@ -1408,13 +1429,13 @@ var GatewayService = class {
|
|
|
1408
1429
|
}
|
|
1409
1430
|
/** Process a message directly through the agent (for CLI mode). */
|
|
1410
1431
|
async processDirect(content, sessionKey = "agent:main:main") {
|
|
1411
|
-
return this.agentService.turnDispatcher.processDirect(content, sessionKey
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1432
|
+
return this.agentService.turnDispatcher.processDirect(content, sessionKey, {
|
|
1433
|
+
type: "system",
|
|
1434
|
+
source: "internal"
|
|
1435
|
+
});
|
|
1415
1436
|
}
|
|
1416
1437
|
emit(type, payload) {
|
|
1417
|
-
this.
|
|
1438
|
+
this.realtime.broker.publish("gateway", type, payload);
|
|
1418
1439
|
this.createMobileNotificationService().handleGatewayEvent(type, payload);
|
|
1419
1440
|
}
|
|
1420
1441
|
handleAutomationRunCompleted(run) {
|
|
@@ -1424,7 +1445,7 @@ var GatewayService = class {
|
|
|
1424
1445
|
this.stopAutomationProductEventBridge?.();
|
|
1425
1446
|
this.stopSessionTranscriptAutomationEvents?.();
|
|
1426
1447
|
this.stopAutomationProductEventBridge = onAutomationProductEvent((event) => {
|
|
1427
|
-
if (event.type.startsWith("task.")) this.
|
|
1448
|
+
if (event.type.startsWith("task.")) this.emit(event.type, event.payload);
|
|
1428
1449
|
const proactiveEvent = mapProductEventToProactive({
|
|
1429
1450
|
event,
|
|
1430
1451
|
workspaceId: this.currentWorkspacePath,
|
|
@@ -1462,10 +1483,6 @@ var GatewayService = class {
|
|
|
1462
1483
|
});
|
|
1463
1484
|
});
|
|
1464
1485
|
}
|
|
1465
|
-
/** Replay events since `lastEventId` for SSE reconnection. */
|
|
1466
|
-
getEventsSince(sessionId, lastEventId) {
|
|
1467
|
-
return this.sse.getEventsSince(sessionId, lastEventId);
|
|
1468
|
-
}
|
|
1469
1486
|
/**
|
|
1470
1487
|
* Validate authentication token from request headers.
|
|
1471
1488
|
* Returns true if auth is disabled (mode: 'none') or token is valid.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { runPostUpdateExtensionSync } from "../extensions/update.js";
|
|
1
2
|
import "./update-channels.js";
|
|
2
3
|
import { compareSemver, resolveNpmChannelTag } from "./update-check.js";
|
|
3
|
-
import { runPostUpdateExtensionSync } from "../extensions/update.js";
|
|
4
4
|
import { readPackageName, readPackageVersion } from "./package-json.js";
|
|
5
5
|
import { createDefaultCommandRunner, runCommandWithTimeout } from "./run-command.js";
|
|
6
6
|
import { XOPC_PACKAGE_NAME, cleanupGlobalRenameDirs, createGlobalInstallEnv, detectGlobalInstallManagerForRoot, resolveGlobalInstallSpec, resolveGlobalInstallTarget } from "./update-global.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
-
import { getMemoryRecord, upsertMemoryRecord } from "../storage/sqlite/memory-records-repository.js";
|
|
4
3
|
import { attachMemoryEvidence, claimKnowledgeSourceItems, completeKnowledgeSourceItemSynthesis, deleteMemoryEvidenceForRecord, listKnowledgeSourceItems } from "../storage/sqlite/knowledge-repository.js";
|
|
4
|
+
import { getMemoryRecord, upsertMemoryRecord } from "../storage/sqlite/memory-records-repository.js";
|
|
5
5
|
import "../storage/sqlite/index.js";
|
|
6
6
|
import { createHash, randomUUID } from "node:crypto";
|
|
7
7
|
//#region src/knowledge/connected-knowledge-pipeline.ts
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
import type { UnderstandingCandidate, UnderstandingReviewResult } from '../agent/memory/understanding/types.js';
|
|
2
2
|
import type { MemoryManager } from '../agent/memory/manager.js';
|
|
3
|
-
import { resolveUserEntity, type UserClaim, type UserClaimClass } from '../storage/sqlite/index.js';
|
|
4
3
|
import type { KnowledgeSourceItem } from './types.js';
|
|
5
4
|
export type ClaimObservation = {
|
|
6
|
-
class:
|
|
5
|
+
class: 'relationship' | 'project' | 'routine';
|
|
7
6
|
key: string;
|
|
8
7
|
value: Record<string, unknown>;
|
|
9
|
-
subject?: Parameters<typeof resolveUserEntity>[0];
|
|
10
8
|
items: KnowledgeSourceItem[];
|
|
11
9
|
windowDays: number;
|
|
12
10
|
};
|
|
13
11
|
export declare function deriveConnectedClaimObservations(items: KnowledgeSourceItem[]): ClaimObservation[];
|
|
14
|
-
export declare function
|
|
12
|
+
export declare function renderConnectedObservation(observation: ClaimObservation): UnderstandingCandidate;
|
|
15
13
|
export declare class ConnectedUnderstandingPipeline {
|
|
16
14
|
private readonly memoryManager;
|
|
17
15
|
constructor(memoryManager: MemoryManager);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { linkUserClaimMemoryRecord, reinforceUserClaim, resolveUserEntity } from "../storage/sqlite/user-claims-repository.js";
|
|
2
1
|
import { listKnowledgeSourceItems } from "../storage/sqlite/knowledge-repository.js";
|
|
3
2
|
import "../storage/sqlite/index.js";
|
|
4
3
|
//#region src/knowledge/connected-understanding-pipeline.ts
|
|
@@ -43,30 +42,9 @@ function relationshipObservations(items) {
|
|
|
43
42
|
const strongIdentity = (signal.email ?? signal.username)?.toLowerCase();
|
|
44
43
|
if (strongIdentity && owners.has(strongIdentity)) continue;
|
|
45
44
|
const label = signal.name ?? signal.email ?? signal.username;
|
|
46
|
-
const handles = [
|
|
47
|
-
...signal.email ? [{
|
|
48
|
-
type: "email",
|
|
49
|
-
value: signal.email,
|
|
50
|
-
sourceScope: "global",
|
|
51
|
-
verified: true
|
|
52
|
-
}] : [],
|
|
53
|
-
...signal.username ? [{
|
|
54
|
-
type: "provider_user",
|
|
55
|
-
value: signal.username,
|
|
56
|
-
sourceScope: String(item.metadata.toolkit ?? item.sourceInstanceId),
|
|
57
|
-
verified: true
|
|
58
|
-
}] : [],
|
|
59
|
-
...signal.name ? [{
|
|
60
|
-
type: "display_name",
|
|
61
|
-
value: signal.name,
|
|
62
|
-
sourceScope: item.sourceInstanceId,
|
|
63
|
-
verified: false
|
|
64
|
-
}] : []
|
|
65
|
-
];
|
|
66
45
|
const identityKey = signal.email?.toLowerCase() ?? `${String(item.metadata.toolkit ?? item.sourceInstanceId)}:${signal.username?.toLowerCase() ?? signal.name?.toLowerCase()}`;
|
|
67
46
|
const entry = grouped.get(identityKey) ?? {
|
|
68
47
|
label,
|
|
69
|
-
handles,
|
|
70
48
|
events: /* @__PURE__ */ new Map()
|
|
71
49
|
};
|
|
72
50
|
const eventKey = logicalEventKey(item);
|
|
@@ -76,13 +54,8 @@ function relationshipObservations(items) {
|
|
|
76
54
|
}
|
|
77
55
|
return [...grouped.values()].sort((left, right) => right.events.size - left.events.size).slice(0, 8).map((entry) => ({
|
|
78
56
|
class: "relationship",
|
|
79
|
-
key:
|
|
57
|
+
key: `person:${entry.label.toLocaleLowerCase()}`,
|
|
80
58
|
value: { label: entry.label },
|
|
81
|
-
subject: {
|
|
82
|
-
type: "person",
|
|
83
|
-
canonicalLabel: entry.label,
|
|
84
|
-
handles: entry.handles
|
|
85
|
-
},
|
|
86
59
|
items: [...entry.events.values()],
|
|
87
60
|
windowDays: 90
|
|
88
61
|
}));
|
|
@@ -131,18 +104,8 @@ function projectObservations(items) {
|
|
|
131
104
|
const { label: subject, events } = entry;
|
|
132
105
|
return {
|
|
133
106
|
class: "project",
|
|
134
|
-
key:
|
|
107
|
+
key: `project:${subject.toLocaleLowerCase()}`,
|
|
135
108
|
value: { label: subject },
|
|
136
|
-
subject: {
|
|
137
|
-
type: "project",
|
|
138
|
-
canonicalLabel: subject,
|
|
139
|
-
handles: [{
|
|
140
|
-
type: "provider_user",
|
|
141
|
-
value: subject,
|
|
142
|
-
sourceScope: "project",
|
|
143
|
-
verified: true
|
|
144
|
-
}]
|
|
145
|
-
},
|
|
146
109
|
items: [...events.values()],
|
|
147
110
|
windowDays: 60
|
|
148
111
|
};
|
|
@@ -156,34 +119,41 @@ function deriveConnectedClaimObservations(items) {
|
|
|
156
119
|
...projectObservations(active)
|
|
157
120
|
];
|
|
158
121
|
}
|
|
159
|
-
function
|
|
160
|
-
const
|
|
161
|
-
|
|
122
|
+
function confidenceFor(observation) {
|
|
123
|
+
const days = new Set(observation.items.map((item) => item.occurredAt?.slice(0, 10)).filter(Boolean)).size;
|
|
124
|
+
return Math.min(.92, .48 + Math.min(observation.items.length, 8) * .035 + Math.min(days, 5) * .045);
|
|
125
|
+
}
|
|
126
|
+
function isDurableObservation(observation) {
|
|
127
|
+
const days = new Set(observation.items.map((item) => item.occurredAt?.slice(0, 10)).filter(Boolean)).size;
|
|
128
|
+
return observation.items.length >= 3 && days >= (observation.class === "routine" ? 3 : 2);
|
|
129
|
+
}
|
|
130
|
+
function renderConnectedObservation(observation) {
|
|
131
|
+
const label = typeof observation.value.label === "string" ? observation.value.label : "";
|
|
132
|
+
const confidence = confidenceFor(observation);
|
|
133
|
+
if (observation.class === "relationship") return {
|
|
162
134
|
kind: "relationship",
|
|
163
135
|
content: `Frequently collaborates with ${label}.`,
|
|
164
|
-
canonicalKey: `
|
|
165
|
-
confidence
|
|
136
|
+
canonicalKey: `connected:${observation.key}`,
|
|
137
|
+
confidence,
|
|
166
138
|
importance: .65,
|
|
167
139
|
explicitness: "inferred",
|
|
168
140
|
durability: "recurring",
|
|
169
141
|
sensitivity: "personal",
|
|
170
|
-
disclosurePolicy: "ask_before_reference"
|
|
171
|
-
tags: ["connected-source", "structured-claim"]
|
|
142
|
+
disclosurePolicy: "ask_before_reference"
|
|
172
143
|
};
|
|
173
|
-
if (
|
|
144
|
+
if (observation.class === "project") return {
|
|
174
145
|
kind: "project_context",
|
|
175
146
|
content: `Recently contributed repeatedly to ${label}.`,
|
|
176
|
-
canonicalKey: `
|
|
177
|
-
confidence
|
|
147
|
+
canonicalKey: `connected:${observation.key}`,
|
|
148
|
+
confidence,
|
|
178
149
|
importance: .72,
|
|
179
150
|
explicitness: "inferred",
|
|
180
151
|
durability: "recurring",
|
|
181
152
|
sensitivity: "personal",
|
|
182
|
-
disclosurePolicy: "referenceable"
|
|
183
|
-
tags: ["connected-source", "structured-claim"]
|
|
153
|
+
disclosurePolicy: "referenceable"
|
|
184
154
|
};
|
|
185
|
-
const weekday = Number(
|
|
186
|
-
const hour = Number(
|
|
155
|
+
const weekday = Number(observation.value.weekday);
|
|
156
|
+
const hour = Number(observation.value.hour);
|
|
187
157
|
return {
|
|
188
158
|
kind: "routine",
|
|
189
159
|
content: `Often has calendar activity on ${[
|
|
@@ -195,14 +165,13 @@ function renderUserClaim(claim) {
|
|
|
195
165
|
"Friday",
|
|
196
166
|
"Saturday"
|
|
197
167
|
][weekday] ?? "Unknown"} around ${String(hour).padStart(2, "0")}:00 UTC.`,
|
|
198
|
-
canonicalKey: `
|
|
199
|
-
confidence
|
|
168
|
+
canonicalKey: `connected:${observation.key}`,
|
|
169
|
+
confidence,
|
|
200
170
|
importance: .58,
|
|
201
171
|
explicitness: "inferred",
|
|
202
172
|
durability: "recurring",
|
|
203
173
|
sensitivity: "personal",
|
|
204
|
-
disclosurePolicy: "referenceable"
|
|
205
|
-
tags: ["connected-source", "structured-claim"]
|
|
174
|
+
disclosurePolicy: "referenceable"
|
|
206
175
|
};
|
|
207
176
|
}
|
|
208
177
|
var ConnectedUnderstandingPipeline = class {
|
|
@@ -223,29 +192,12 @@ var ConnectedUnderstandingPipeline = class {
|
|
|
223
192
|
createdRecords: []
|
|
224
193
|
};
|
|
225
194
|
for (const observation of observations) {
|
|
226
|
-
|
|
227
|
-
const
|
|
228
|
-
agentId,
|
|
229
|
-
class: observation.class,
|
|
230
|
-
key: subject ? `${observation.key}:${subject.id}` : observation.key,
|
|
231
|
-
subjectEntityId: subject?.id,
|
|
232
|
-
value: observation.value,
|
|
233
|
-
evidence: observation.items.map((item) => ({
|
|
234
|
-
logicalEventKey: logicalEventKey(item),
|
|
235
|
-
sourceItemId: item.id,
|
|
236
|
-
sourceInstanceId: item.sourceInstanceId,
|
|
237
|
-
relation: "supports",
|
|
238
|
-
observedAt: item.occurredAt
|
|
239
|
-
}))
|
|
240
|
-
});
|
|
241
|
-
if (claim.state !== "active") continue;
|
|
242
|
-
const result = await this.memoryManager.applyUnderstandingCandidates([renderUserClaim(claim)], {
|
|
243
|
-
agentId,
|
|
195
|
+
if (!isDurableObservation(observation)) continue;
|
|
196
|
+
const result = await this.memoryManager.applyUnderstandingCandidates([renderConnectedObservation(observation)], {
|
|
244
197
|
sourceItemIds: observation.items.map((item) => item.id).slice(0, 20),
|
|
245
198
|
sourceText: JSON.stringify({
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
activeDays: claim.activeDayCount,
|
|
199
|
+
independentEvidenceCount: observation.items.length,
|
|
200
|
+
activeDays: new Set(observation.items.map((item) => item.occurredAt?.slice(0, 10))).size,
|
|
249
201
|
windowDays: observation.windowDays
|
|
250
202
|
}),
|
|
251
203
|
source: {
|
|
@@ -254,8 +206,6 @@ var ConnectedUnderstandingPipeline = class {
|
|
|
254
206
|
},
|
|
255
207
|
reviewSource: "background"
|
|
256
208
|
});
|
|
257
|
-
const memoryRecordId = result.createdRecords[0]?.id;
|
|
258
|
-
if (memoryRecordId) linkUserClaimMemoryRecord(claim.id, memoryRecordId);
|
|
259
209
|
totals.created += result.created;
|
|
260
210
|
totals.deduplicated += result.deduplicated;
|
|
261
211
|
totals.rejected += result.rejected;
|
|
@@ -265,4 +215,4 @@ var ConnectedUnderstandingPipeline = class {
|
|
|
265
215
|
}
|
|
266
216
|
};
|
|
267
217
|
//#endregion
|
|
268
|
-
export { ConnectedUnderstandingPipeline, deriveConnectedClaimObservations,
|
|
218
|
+
export { ConnectedUnderstandingPipeline, deriveConnectedClaimObservations, renderConnectedObservation };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { KnowledgeIngestionService, SqliteKnowledgeSourceStateStore } from "./ingestion-service.js";
|
|
2
2
|
import { ConnectedKnowledgePipeline } from "./connected-knowledge-pipeline.js";
|
|
3
|
-
import { ConnectedUnderstandingPipeline, deriveConnectedClaimObservations,
|
|
3
|
+
import { ConnectedUnderstandingPipeline, deriveConnectedClaimObservations, renderConnectedObservation } from "./connected-understanding-pipeline.js";
|
|
4
4
|
import { startConnectedKnowledgeCoordinator } from "./coordinator.js";
|
|
5
5
|
import { LocalFolderKnowledgeSourceAdapter } from "./local-folder-adapter.js";
|
|
6
6
|
import { buildConnectedPeopleGraph } from "./people-graph.js";
|
|
7
|
-
export { ConnectedKnowledgePipeline, ConnectedUnderstandingPipeline, KnowledgeIngestionService, LocalFolderKnowledgeSourceAdapter, SqliteKnowledgeSourceStateStore, buildConnectedPeopleGraph, deriveConnectedClaimObservations,
|
|
7
|
+
export { ConnectedKnowledgePipeline, ConnectedUnderstandingPipeline, KnowledgeIngestionService, LocalFolderKnowledgeSourceAdapter, SqliteKnowledgeSourceStateStore, buildConnectedPeopleGraph, deriveConnectedClaimObservations, renderConnectedObservation, startConnectedKnowledgeCoordinator };
|
|
@@ -1,28 +1,25 @@
|
|
|
1
|
-
export type ConnectedPersonNode = {
|
|
2
|
-
id: string;
|
|
3
|
-
label: string;
|
|
4
|
-
names: string[];
|
|
5
|
-
emails: string[];
|
|
6
|
-
usernames: string[];
|
|
7
|
-
roles: string[];
|
|
8
|
-
mentionCount: number;
|
|
9
|
-
lastObservedAt: string;
|
|
10
|
-
};
|
|
11
|
-
export type ConnectedPersonSourceEdge = {
|
|
12
|
-
personId: string;
|
|
13
|
-
sourceInstanceId: string;
|
|
14
|
-
connectorId?: string;
|
|
15
|
-
toolkit?: string;
|
|
16
|
-
mentionCount: number;
|
|
17
|
-
lastObservedAt: string;
|
|
18
|
-
};
|
|
19
|
-
export type ConnectedPeopleGraph = {
|
|
20
|
-
people: ConnectedPersonNode[];
|
|
21
|
-
sourceEdges: ConnectedPersonSourceEdge[];
|
|
22
|
-
scannedItems: number;
|
|
23
|
-
truncated: boolean;
|
|
24
|
-
};
|
|
25
1
|
export declare function buildConnectedPeopleGraph(options?: {
|
|
26
2
|
query?: string;
|
|
27
3
|
limit?: number;
|
|
28
|
-
}):
|
|
4
|
+
}): {
|
|
5
|
+
people: {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
names: string[];
|
|
9
|
+
emails: string[];
|
|
10
|
+
usernames: string[];
|
|
11
|
+
roles: any[];
|
|
12
|
+
mentionCount: number;
|
|
13
|
+
lastObservedAt: string;
|
|
14
|
+
}[];
|
|
15
|
+
sourceEdges: {
|
|
16
|
+
mentionCount: number;
|
|
17
|
+
lastObservedAt: string;
|
|
18
|
+
connectorId?: string;
|
|
19
|
+
toolkit?: string;
|
|
20
|
+
personId: string;
|
|
21
|
+
sourceInstanceId: string;
|
|
22
|
+
}[];
|
|
23
|
+
scannedItems: number;
|
|
24
|
+
truncated: boolean;
|
|
25
|
+
};
|
|
@@ -1,58 +1,91 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { listKnowledgeSourceItems } from "../storage/sqlite/knowledge-repository.js";
|
|
2
2
|
import "../storage/sqlite/index.js";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
3
4
|
//#region src/knowledge/people-graph.ts
|
|
5
|
+
function readString(record, key) {
|
|
6
|
+
const value = record[key];
|
|
7
|
+
return typeof value === "string" && value.trim() ? value.trim().slice(0, 160) : void 0;
|
|
8
|
+
}
|
|
9
|
+
function personKey(name, email, username) {
|
|
10
|
+
return email?.toLocaleLowerCase() ?? username?.toLocaleLowerCase() ?? name?.toLocaleLowerCase();
|
|
11
|
+
}
|
|
4
12
|
function sourceMetadata(sourceInstanceId) {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
13
|
+
const connectorId = sourceInstanceId.startsWith("composio:") ? sourceInstanceId.split(":")[1] : void 0;
|
|
14
|
+
return connectorId ? {
|
|
15
|
+
connectorId,
|
|
16
|
+
toolkit: connectorId.replace(/^composio-/, "")
|
|
17
|
+
} : {};
|
|
11
18
|
}
|
|
12
19
|
function buildConnectedPeopleGraph(options = {}) {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
const items = listKnowledgeSourceItems({
|
|
21
|
+
includeDeleted: false,
|
|
22
|
+
limit: 500
|
|
23
|
+
});
|
|
24
|
+
const people = /* @__PURE__ */ new Map();
|
|
25
|
+
for (const item of items) {
|
|
26
|
+
const entities = Array.isArray(item.metadata.personEntities) ? item.metadata.personEntities : [];
|
|
27
|
+
for (const raw of entities) {
|
|
28
|
+
if (!raw || typeof raw !== "object" || Array.isArray(raw)) continue;
|
|
29
|
+
const record = raw;
|
|
30
|
+
const name = readString(record, "name");
|
|
31
|
+
const email = readString(record, "email");
|
|
32
|
+
const username = readString(record, "username");
|
|
33
|
+
const key = personKey(name, email, username);
|
|
34
|
+
if (!key) continue;
|
|
35
|
+
const observedAt = item.occurredAt ?? new Date(item.updatedAt).toISOString();
|
|
36
|
+
const current = people.get(key) ?? {
|
|
37
|
+
id: createHash("sha256").update(key).digest("hex").slice(0, 20),
|
|
38
|
+
label: name ?? email ?? username,
|
|
39
|
+
names: /* @__PURE__ */ new Set(),
|
|
40
|
+
emails: /* @__PURE__ */ new Set(),
|
|
41
|
+
usernames: /* @__PURE__ */ new Set(),
|
|
42
|
+
sources: /* @__PURE__ */ new Map(),
|
|
43
|
+
mentionCount: 0,
|
|
44
|
+
lastObservedAt: observedAt
|
|
45
|
+
};
|
|
46
|
+
if (name) current.names.add(name);
|
|
47
|
+
if (email) current.emails.add(email);
|
|
48
|
+
if (username) current.usernames.add(username);
|
|
49
|
+
current.mentionCount += 1;
|
|
50
|
+
if (observedAt > current.lastObservedAt) current.lastObservedAt = observedAt;
|
|
51
|
+
const source = current.sources.get(item.sourceInstanceId) ?? {
|
|
52
|
+
count: 0,
|
|
53
|
+
lastObservedAt: observedAt
|
|
54
|
+
};
|
|
55
|
+
source.count += 1;
|
|
56
|
+
if (observedAt > source.lastObservedAt) source.lastObservedAt = observedAt;
|
|
57
|
+
current.sources.set(item.sourceInstanceId, source);
|
|
58
|
+
people.set(key, current);
|
|
59
|
+
}
|
|
19
60
|
}
|
|
20
|
-
const query = options.query?.trim().
|
|
21
|
-
const
|
|
22
|
-
const matching = graph.people.map((entity) => {
|
|
23
|
-
const edges = edgesByPerson.get(entity.id) ?? [];
|
|
24
|
-
const names = [...entity.canonicalLabel.includes("@") ? [] : [entity.canonicalLabel], ...entity.handles.filter((handle) => handle.type === "display_name").map((handle) => handle.value)].filter((value, index, values) => values.findIndex((candidate) => candidate.toLowerCase() === value.toLowerCase()) === index).toSorted();
|
|
25
|
-
const emails = entity.handles.filter((handle) => handle.type === "email").map((handle) => handle.value).toSorted();
|
|
26
|
-
const usernames = entity.handles.filter((handle) => handle.type === "provider_user").map((handle) => handle.value).toSorted();
|
|
27
|
-
return {
|
|
28
|
-
id: entity.id,
|
|
29
|
-
label: entity.canonicalLabel,
|
|
30
|
-
names,
|
|
31
|
-
emails,
|
|
32
|
-
usernames,
|
|
33
|
-
roles: [],
|
|
34
|
-
mentionCount: edges.reduce((sum, edge) => sum + edge.mentionCount, 0),
|
|
35
|
-
lastObservedAt: edges.reduce((latest, edge) => !latest || edge.lastObservedAt > latest ? edge.lastObservedAt : latest, "") || entity.updatedAt
|
|
36
|
-
};
|
|
37
|
-
}).filter((person) => !query || [
|
|
61
|
+
const query = options.query?.trim().toLocaleLowerCase() ?? "";
|
|
62
|
+
const all = [...people.values()].filter((person) => !query || [
|
|
38
63
|
person.label,
|
|
39
64
|
...person.names,
|
|
40
65
|
...person.emails,
|
|
41
66
|
...person.usernames
|
|
42
|
-
].some((value) => value.
|
|
43
|
-
const
|
|
44
|
-
const included = new Set(people.map((person) => person.id));
|
|
67
|
+
].some((value) => value.toLocaleLowerCase().includes(query))).sort((left, right) => right.mentionCount - left.mentionCount);
|
|
68
|
+
const selected = all.slice(0, Math.max(1, Math.min(options.limit ?? 100, 500)));
|
|
45
69
|
return {
|
|
46
|
-
people
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
...
|
|
51
|
-
|
|
52
|
-
|
|
70
|
+
people: selected.map((person) => ({
|
|
71
|
+
id: person.id,
|
|
72
|
+
label: person.label,
|
|
73
|
+
names: [...person.names],
|
|
74
|
+
emails: [...person.emails],
|
|
75
|
+
usernames: [...person.usernames],
|
|
76
|
+
roles: [],
|
|
77
|
+
mentionCount: person.mentionCount,
|
|
78
|
+
lastObservedAt: person.lastObservedAt
|
|
53
79
|
})),
|
|
54
|
-
|
|
55
|
-
|
|
80
|
+
sourceEdges: selected.flatMap((person) => [...person.sources].map(([sourceInstanceId, source]) => ({
|
|
81
|
+
personId: person.id,
|
|
82
|
+
sourceInstanceId,
|
|
83
|
+
...sourceMetadata(sourceInstanceId),
|
|
84
|
+
mentionCount: source.count,
|
|
85
|
+
lastObservedAt: source.lastObservedAt
|
|
86
|
+
}))),
|
|
87
|
+
scannedItems: items.length,
|
|
88
|
+
truncated: all.length > selected.length
|
|
56
89
|
};
|
|
57
90
|
}
|
|
58
91
|
//#endregion
|