@xopcai/xopc 0.0.189 → 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 +0 -3
- 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-DTFKTPs8.js → activity-store-DstnJCS5.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DqO25Qe5.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-DWeXfwVU.js → api-BTL9kayv.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BRpV8PXG.js → app-management-settings-panel-DkFeIdBf.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-3ntKM9nQ.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-Df7Ycj_7.js → archive-plugin-Ch2RmLCC.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-UHgfZYtj.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-BJah99wE.js → binary-plugins-D6CqlymH.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DNlY5KqF.js → block-editor-ClL6HEg9.js} +48 -48
- package/dist/gateway/static/root/assets/browser-settings-page-DW99iDmD.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-vyUfdzAd.js → browser-workflow-inputs-BYy48VhN.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-C1cKZjx-.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-BGG2kpJB.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-BUuBEJuP.js → desktop-pet-Cv8rGhYW.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-BGfVIJM3.js → desktop-pet-settings-CIeJdwfV.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-DrQFfHH_.js → directory-picker-path-field-D8jXEiAY.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-CEnIFOX-.js → extension-debug-page-CCZ9u6TZ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CCqHbexs.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-CgUE2Ii1.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-DxhKNiCF.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-DCFdc-HD.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-Bf2VLtXW.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-Ca1RuI13.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-B3Eop1zn.js → management-settings--V_fovKD.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-BGOYjgnM.js → markdown-split-Dt9-in6W.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CT0txyM4.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-DfKgAe78.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-DNrbCgmC.js → page-tabs-C5ge434C.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-BTqViDOR.js → preview-open-alternatives-BFa9DgSV.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-C_2L4_Iu.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-BFLfkDGG.js → schema-form-B84DckWe.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-C9a-EbTZ.js → settings-loading-skeleton-CCtlhoy7.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-DI9qDH5x.js → settings-page-DQmMKf8r.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-layout-D-LWQdI5.js → settings-page-layout-EQIOJa_L.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-CJwmPvgs.js → setup-status-panel-Cwi-SPja.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-BKSMG9r5.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-zsz2HIlZ.js → skills-page.utils-Jhm24i4h.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-IWNDBI1O.js → system-settings-panel-Dpx2ags2.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-CgtK02kP.js → task-detail-page-DLAdxI6e.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-BkJe7UDo.js → theme-store-DnBOcGXi.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-C07LGthO.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-Boue1D46.js → voice-api-key-field-BISTPfq_.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-bbmvCmc8.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-DlHv-GZC.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 +7 -7
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/tool-activity.js +0 -36
- package/dist/packages/realtime-client/src/index.js +105 -48
- package/dist/packages/realtime-protocol/src/index.js +6 -1
- package/dist/src/agent/agent-manager.d.ts +0 -1
- package/dist/src/agent/agent-manager.js +6 -13
- package/dist/src/agent/background-review/coordinator.js +1 -1
- package/dist/src/agent/background-review/run-background-review.js +5 -7
- 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/context/workspace-templates/SOUL.md +1 -1
- 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/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/direct-turn-helpers.js +1 -1
- package/dist/src/agent/service.d.ts +1 -2
- package/dist/src/agent/service.js +4 -17
- package/dist/src/agent/skills/marketplace/adapters/clawhub/adapter.js +1 -1
- 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 +0 -3
- package/dist/src/agent/tools/factory.js +1 -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/validation.d.ts +28 -28
- package/dist/src/automations/draft/automation-draft-validator.d.ts +3 -3
- package/dist/src/chat-commands/builtins/understanding.js +2 -5
- package/dist/src/cli/commands/doctor/checks/database-schema.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/schema.d.ts +24 -117
- package/dist/src/config/schema.js +9 -39
- package/dist/src/connectors/learning-coordinator.js +75 -3
- 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/dreaming-automation-reconciler.d.ts +3 -3
- package/dist/src/gateway/dreaming-automation-reconciler.js +48 -88
- package/dist/src/gateway/hono/lib/config-payload.d.ts +19 -7
- package/dist/src/gateway/hono/lib/config-payload.js +3 -1
- 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/agents.js +1 -33
- 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/index.js +2 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -5
- 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/you.d.ts +0 -22
- package/dist/src/gateway/hono/routes/you.js +234 -1118
- package/dist/src/gateway/service/config-coordinator.d.ts +1 -1
- package/dist/src/gateway/service/run-gateway-agent.js +2 -4
- 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/proactive/execution/context.js +8 -13
- package/dist/src/realtime/broker.d.ts +1 -0
- package/dist/src/realtime/broker.js +19 -2
- package/dist/src/realtime/runtime.js +6 -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/fts.d.ts +2 -0
- package/dist/src/storage/sqlite/fts.js +29 -1
- package/dist/src/storage/sqlite/index.d.ts +4 -6
- package/dist/src/storage/sqlite/index.js +5 -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/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/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/tui/tool-summary.js +1 -7
- package/dist/src/tui/tui-startup-resources.js +1 -2
- 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 -54
- 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/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 +3 -8
- package/dist/gateway/static/root/assets/agents-BvdqdER9.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-nKLsfy6C.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-Dh5bdZiN.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CRJ_nAuh.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DeQR5BZt.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-api-D7tkhDMv.js +0 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-D7uK3q1p.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-Bw6Dniyq.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-BrUTz4uU.js +0 -1
- package/dist/gateway/static/root/assets/connector-logo-8YU53RUT.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-k9tMiOL5.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-B3B1eqnr.js +0 -2
- package/dist/gateway/static/root/assets/extension-settings-page-DEZw_7zN.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-Dg8qCiIp.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-27tRzDEo.js +0 -1
- package/dist/gateway/static/root/assets/home-page-VA511kMr.js +0 -3
- package/dist/gateway/static/root/assets/index-BvR-i-m6.js +0 -216
- package/dist/gateway/static/root/assets/index-zybP34zk.css +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CaJq4-wV.js +0 -2
- package/dist/gateway/static/root/assets/locale-store-DUW5YE3R.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-BLTCg69e.js +0 -2
- package/dist/gateway/static/root/assets/messages-CMjnbdbn.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-Bp1w9UM1.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-CZmbPDQN.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-D5pzqfm5.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CC-XhVGI.js +0 -1
- package/dist/gateway/static/root/assets/segmented-styles-BL8oLBEp.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-B2eTLVDV.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-CRuZ_bl0.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-C4GXGeA4.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-YzSDS4G_.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-CwOo8zZk.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-xd1cgSGN.js +0 -2
- package/dist/gateway/static/root/assets/time-picker-CstQ___Y.js +0 -1
- package/dist/gateway/static/root/assets/use-save-bar-registration-CQYE0l6z.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-BnQAWS_B.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-CAszL1y8.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-DxGzo3-x.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/gateway/hono/routes/memory.d.ts +0 -3
- package/dist/src/gateway/hono/routes/memory.js +0 -460
- 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/user-context/actionableInsights.d.ts +0 -14
- package/dist/src/user-context/actionableInsights.js +0 -34
- 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
|
@@ -43,7 +43,7 @@ export interface GatewayConfigCoordinatorOptions {
|
|
|
43
43
|
getExtensionLoader: () => ExtensionLoader | null;
|
|
44
44
|
/** Re-evaluate browser-extension server attachment after agent defaults change. */
|
|
45
45
|
reconcileBrowserExtensionServer: () => Promise<void>;
|
|
46
|
-
/** Sync built-in
|
|
46
|
+
/** Sync the built-in consolidation automation after userContext.dreaming changes. */
|
|
47
47
|
reconcileDreamingAutomations: () => Promise<void>;
|
|
48
48
|
/** Latest channel status snapshot for the `channels.status` event. */
|
|
49
49
|
getChannelsStatus: () => unknown;
|
|
@@ -6,11 +6,11 @@ import "../../storage/sqlite/index.js";
|
|
|
6
6
|
import { init_session_key, parseSessionKey } from "../../routing/session-key.js";
|
|
7
7
|
import { resolveExecutionContext } from "../../tasks/execution-context.js";
|
|
8
8
|
import { TaskRunCoordinator } from "../../tasks/task-run-coordinator.js";
|
|
9
|
-
import { recordExplicitRelationshipFollowUp } from "../../user-context/relationship-continuity.js";
|
|
10
9
|
import { formatAgentRunErrorForClient } from "../../agent/client-error-format.js";
|
|
11
10
|
import { prependEnvelopeTimestamp } from "../../channels/envelope-timestamp.js";
|
|
12
11
|
import "../chat-limits.js";
|
|
13
12
|
import { resolveWebchatSessionKey } from "../resolve-webchat-session-key.js";
|
|
13
|
+
import { recordExplicitRelationshipFollowUp } from "../../user-context/relationship-continuity.js";
|
|
14
14
|
import { ChatStreamMapper } from "../chat-stream/mapper.js";
|
|
15
15
|
import { coalesceThinkingDeltas } from "../chat-stream/thinking-delta-coalescer.js";
|
|
16
16
|
import crypto from "crypto";
|
|
@@ -49,15 +49,13 @@ async function* runGatewayAgent(deps, message, channel, chatId, origin, attachme
|
|
|
49
49
|
const streamSessionKey = webchatSessionKey ?? chatId;
|
|
50
50
|
if (webchatSessionKey) {
|
|
51
51
|
if (!webchatMetadata) throw new Error("Session metadata is unavailable");
|
|
52
|
-
|
|
53
|
-
if (!parsedSession) throw new Error("Resolved webchat session key is invalid");
|
|
52
|
+
if (!parseSessionKey(webchatSessionKey)) throw new Error("Resolved webchat session key is invalid");
|
|
54
53
|
updateInteractionStateFromMessage({
|
|
55
54
|
sessionKey: webchatSessionKey,
|
|
56
55
|
message
|
|
57
56
|
});
|
|
58
57
|
recordExplicitRelationshipFollowUp({
|
|
59
58
|
sessionKey: webchatSessionKey,
|
|
60
|
-
sourceAgentId: parsedSession.agentId,
|
|
61
59
|
message
|
|
62
60
|
});
|
|
63
61
|
const executionContext = resolveExecutionContext({
|
|
@@ -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
|
|
@@ -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
|
};
|
|
@@ -12,6 +12,7 @@ export interface RealtimeTopicPolicy {
|
|
|
12
12
|
export type RealtimeTopicPolicyResolver = (topic: string) => RealtimeTopicPolicy;
|
|
13
13
|
export interface RealtimeSubscriptionHandle {
|
|
14
14
|
initial: RealtimeDelivery[];
|
|
15
|
+
cursor: number;
|
|
15
16
|
unsubscribe: () => void;
|
|
16
17
|
}
|
|
17
18
|
export declare function defaultRealtimeTopicPolicy(topic: string): RealtimeTopicPolicy;
|
|
@@ -47,8 +47,12 @@ var RealtimeBroker = class {
|
|
|
47
47
|
realtimeTopicSchema.parse(topic);
|
|
48
48
|
const state = this.ensureTopic(topic);
|
|
49
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;
|
|
50
53
|
return {
|
|
51
|
-
initial
|
|
54
|
+
initial,
|
|
55
|
+
cursor: gap ? gap.payload.earliestSeq - 1 : afterSeq === void 0 ? currentSeq : Math.min(afterSeq, currentSeq),
|
|
52
56
|
unsubscribe: () => {
|
|
53
57
|
state.listeners.delete(listener);
|
|
54
58
|
}
|
|
@@ -65,6 +69,18 @@ var RealtimeBroker = class {
|
|
|
65
69
|
}
|
|
66
70
|
replayFrom(topic, state, afterSeq) {
|
|
67
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
|
+
}];
|
|
68
84
|
if (currentSeq <= afterSeq) return [];
|
|
69
85
|
const earliestSeq = state.events[0]?.payload.seq;
|
|
70
86
|
if (earliestSeq === void 0 || afterSeq + 1 < earliestSeq) return [{
|
|
@@ -75,7 +91,8 @@ var RealtimeBroker = class {
|
|
|
75
91
|
payload: {
|
|
76
92
|
topic,
|
|
77
93
|
requestedSeq: afterSeq,
|
|
78
|
-
earliestSeq: earliestSeq ?? currentSeq + 1
|
|
94
|
+
earliestSeq: earliestSeq ?? currentSeq + 1,
|
|
95
|
+
recoverable: earliestSeq !== void 0
|
|
79
96
|
}
|
|
80
97
|
}, ...state.events];
|
|
81
98
|
return state.events.filter((event) => event.payload.seq > afterSeq);
|
|
@@ -128,7 +128,8 @@ var RealtimeRuntime = class {
|
|
|
128
128
|
writer.enqueue(serverMessage("realtime.gap", {
|
|
129
129
|
topic: item.topic,
|
|
130
130
|
requestedSeq: item.afterSeq,
|
|
131
|
-
earliestSeq: 1
|
|
131
|
+
earliestSeq: 1,
|
|
132
|
+
recoverable: false
|
|
132
133
|
}));
|
|
133
134
|
continue;
|
|
134
135
|
}
|
|
@@ -137,6 +138,10 @@ var RealtimeRuntime = class {
|
|
|
137
138
|
writer.enqueue(event);
|
|
138
139
|
});
|
|
139
140
|
subscriptions.set(item.topic, handle);
|
|
141
|
+
writer.enqueue(serverMessage("realtime.subscribed", {
|
|
142
|
+
topic: item.topic,
|
|
143
|
+
cursor: handle.cursor
|
|
144
|
+
}), "critical");
|
|
140
145
|
for (const message of handle.initial) writer.enqueue(message);
|
|
141
146
|
}
|
|
142
147
|
return true;
|
|
@@ -36,7 +36,6 @@ function mergeAccountSourceData(db, connectorId, sourceAccountId, targetAccountI
|
|
|
36
36
|
db.prepare("UPDATE knowledge_source_items SET source_instance_id = ? WHERE source_instance_id = ?").run(targetId, sourceId);
|
|
37
37
|
db.prepare("UPDATE knowledge_sync_runs SET source_instance_id = ? WHERE source_instance_id = ?").run(targetId, sourceId);
|
|
38
38
|
db.prepare("UPDATE knowledge_source_changes SET source_instance_id = ? WHERE source_instance_id = ?").run(targetId, sourceId);
|
|
39
|
-
db.prepare("UPDATE user_claim_evidence SET source_instance_id = ? WHERE source_instance_id = ?").run(targetId, sourceId);
|
|
40
39
|
db.prepare(`
|
|
41
40
|
DELETE FROM knowledge_collection_state AS source
|
|
42
41
|
WHERE source.source_instance_id = ?
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type ContextConsolidationRun = {
|
|
2
|
+
runId: string;
|
|
3
|
+
triggerKind: 'schedule' | 'manual';
|
|
4
|
+
status: 'running' | 'completed' | 'failed';
|
|
5
|
+
reason?: string;
|
|
6
|
+
metrics: Record<string, unknown>;
|
|
7
|
+
startedAt: number;
|
|
8
|
+
completedAt?: number;
|
|
9
|
+
};
|
|
10
|
+
export type ContextConsolidationDecision = {
|
|
11
|
+
id: string;
|
|
12
|
+
runId: string;
|
|
13
|
+
understandingId?: string;
|
|
14
|
+
action: 'needs_review' | 'stale';
|
|
15
|
+
reasonCode: string;
|
|
16
|
+
evidenceCount: number;
|
|
17
|
+
createdAt: number;
|
|
18
|
+
};
|
|
19
|
+
export declare function startContextConsolidationRun(triggerKind: ContextConsolidationRun['triggerKind'], now?: number): ContextConsolidationRun;
|
|
20
|
+
export declare function finishContextConsolidationRun(input: {
|
|
21
|
+
runId: string;
|
|
22
|
+
ok: boolean;
|
|
23
|
+
reason: string;
|
|
24
|
+
metrics: Record<string, unknown>;
|
|
25
|
+
now?: number;
|
|
26
|
+
}): ContextConsolidationRun | undefined;
|
|
27
|
+
export declare function recordContextConsolidationDecision(input: {
|
|
28
|
+
runId: string;
|
|
29
|
+
understandingId: string;
|
|
30
|
+
action: ContextConsolidationDecision['action'];
|
|
31
|
+
reasonCode: string;
|
|
32
|
+
evidenceCount: number;
|
|
33
|
+
now?: number;
|
|
34
|
+
}): ContextConsolidationDecision;
|
|
35
|
+
export declare function getContextConsolidationRun(runId: string): ContextConsolidationRun | undefined;
|
|
36
|
+
export declare function listContextConsolidationRuns(limit?: number): ContextConsolidationRun[];
|
|
37
|
+
export declare function listContextConsolidationDecisions(runId: string): ContextConsolidationDecision[];
|