@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
|
@@ -49,30 +49,23 @@ export declare const UserMemoryConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
49
49
|
session: "session";
|
|
50
50
|
workspace: "workspace";
|
|
51
51
|
understanding: "understanding";
|
|
52
|
-
userProfile: "userProfile";
|
|
53
52
|
agentProfile: "agentProfile";
|
|
54
|
-
connectedSources: "connectedSources";
|
|
55
53
|
}>>>;
|
|
56
54
|
writePolicy: z.ZodOptional<z.ZodObject<{
|
|
57
|
-
userProfile: z.ZodOptional<z.ZodEnum<{
|
|
58
|
-
allow: "allow";
|
|
59
|
-
confirm: "confirm";
|
|
60
|
-
deny: "deny";
|
|
61
|
-
}>>;
|
|
62
55
|
agentProfile: z.ZodOptional<z.ZodEnum<{
|
|
63
56
|
allow: "allow";
|
|
64
|
-
confirm: "confirm";
|
|
65
57
|
deny: "deny";
|
|
58
|
+
confirm: "confirm";
|
|
66
59
|
}>>;
|
|
67
60
|
understanding: z.ZodOptional<z.ZodEnum<{
|
|
68
61
|
allow: "allow";
|
|
69
|
-
confirm: "confirm";
|
|
70
62
|
deny: "deny";
|
|
63
|
+
confirm: "confirm";
|
|
71
64
|
}>>;
|
|
72
65
|
workspace: z.ZodOptional<z.ZodEnum<{
|
|
73
66
|
allow: "allow";
|
|
74
|
-
confirm: "confirm";
|
|
75
67
|
deny: "deny";
|
|
68
|
+
confirm: "confirm";
|
|
76
69
|
}>>;
|
|
77
70
|
}, z.core.$strict>>;
|
|
78
71
|
retention: z.ZodOptional<z.ZodObject<{
|
|
@@ -108,8 +101,8 @@ export declare const UserUnderstandingConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
108
101
|
export declare const UserContextPrivacySchema: z.ZodDefault<z.ZodObject<{
|
|
109
102
|
sensitiveWritePolicy: z.ZodDefault<z.ZodEnum<{
|
|
110
103
|
allow: "allow";
|
|
111
|
-
confirm: "confirm";
|
|
112
104
|
deny: "deny";
|
|
105
|
+
confirm: "confirm";
|
|
113
106
|
}>>;
|
|
114
107
|
}, z.core.$strict>>;
|
|
115
108
|
export declare const UserContextProviderRoutingSchema: z.ZodDefault<z.ZodObject<{
|
|
@@ -131,140 +124,17 @@ export declare const UserContextProviderRoutingSchema: z.ZodDefault<z.ZodObject<
|
|
|
131
124
|
allowedProviderIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
132
125
|
autoWriteKinds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
133
126
|
}, z.core.$strict>>;
|
|
134
|
-
export declare const DreamingScheduleSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
135
|
-
kind: z.ZodLiteral<"interval">;
|
|
136
|
-
everyHours: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<6>, z.ZodLiteral<8>, z.ZodLiteral<12>, z.ZodLiteral<24>]>;
|
|
137
|
-
minute: z.ZodNumber;
|
|
138
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
139
|
-
kind: z.ZodLiteral<"daily">;
|
|
140
|
-
time: z.ZodString;
|
|
141
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
142
|
-
kind: z.ZodLiteral<"weekly">;
|
|
143
|
-
weekday: z.ZodNumber;
|
|
144
|
-
time: z.ZodString;
|
|
145
|
-
}, z.core.$strict>], "kind">;
|
|
146
|
-
export declare const DreamingSettingsSchema: z.ZodObject<{
|
|
147
|
-
mode: z.ZodEnum<{
|
|
148
|
-
off: "off";
|
|
149
|
-
observe: "observe";
|
|
150
|
-
review: "review";
|
|
151
|
-
automatic: "automatic";
|
|
152
|
-
}>;
|
|
153
|
-
timezone: z.ZodString;
|
|
154
|
-
phases: z.ZodObject<{
|
|
155
|
-
light: z.ZodObject<{
|
|
156
|
-
enabled: z.ZodBoolean;
|
|
157
|
-
schedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
158
|
-
kind: z.ZodLiteral<"interval">;
|
|
159
|
-
everyHours: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<6>, z.ZodLiteral<8>, z.ZodLiteral<12>, z.ZodLiteral<24>]>;
|
|
160
|
-
minute: z.ZodNumber;
|
|
161
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
162
|
-
kind: z.ZodLiteral<"daily">;
|
|
163
|
-
time: z.ZodString;
|
|
164
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
165
|
-
kind: z.ZodLiteral<"weekly">;
|
|
166
|
-
weekday: z.ZodNumber;
|
|
167
|
-
time: z.ZodString;
|
|
168
|
-
}, z.core.$strict>], "kind">;
|
|
169
|
-
}, z.core.$strict>;
|
|
170
|
-
deep: z.ZodObject<{
|
|
171
|
-
enabled: z.ZodBoolean;
|
|
172
|
-
schedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
173
|
-
kind: z.ZodLiteral<"interval">;
|
|
174
|
-
everyHours: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<6>, z.ZodLiteral<8>, z.ZodLiteral<12>, z.ZodLiteral<24>]>;
|
|
175
|
-
minute: z.ZodNumber;
|
|
176
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
177
|
-
kind: z.ZodLiteral<"daily">;
|
|
178
|
-
time: z.ZodString;
|
|
179
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
180
|
-
kind: z.ZodLiteral<"weekly">;
|
|
181
|
-
weekday: z.ZodNumber;
|
|
182
|
-
time: z.ZodString;
|
|
183
|
-
}, z.core.$strict>], "kind">;
|
|
184
|
-
}, z.core.$strict>;
|
|
185
|
-
rem: z.ZodObject<{
|
|
186
|
-
enabled: z.ZodBoolean;
|
|
187
|
-
schedule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
188
|
-
kind: z.ZodLiteral<"interval">;
|
|
189
|
-
everyHours: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<6>, z.ZodLiteral<8>, z.ZodLiteral<12>, z.ZodLiteral<24>]>;
|
|
190
|
-
minute: z.ZodNumber;
|
|
191
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
192
|
-
kind: z.ZodLiteral<"daily">;
|
|
193
|
-
time: z.ZodString;
|
|
194
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
195
|
-
kind: z.ZodLiteral<"weekly">;
|
|
196
|
-
weekday: z.ZodNumber;
|
|
197
|
-
time: z.ZodString;
|
|
198
|
-
}, z.core.$strict>], "kind">;
|
|
199
|
-
}, z.core.$strict>;
|
|
200
|
-
}, z.core.$strict>;
|
|
201
|
-
}, z.core.$strict>;
|
|
202
127
|
export declare const UserContextDreamingSchema: z.ZodDefault<z.ZodObject<{
|
|
203
128
|
mode: z.ZodDefault<z.ZodEnum<{
|
|
204
129
|
off: "off";
|
|
205
|
-
observe: "observe";
|
|
206
130
|
review: "review";
|
|
207
|
-
automatic: "automatic";
|
|
208
131
|
}>>;
|
|
209
132
|
timezone: z.ZodOptional<z.ZodString>;
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
213
|
-
schedule: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
214
|
-
kind: z.ZodLiteral<"interval">;
|
|
215
|
-
everyHours: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<6>, z.ZodLiteral<8>, z.ZodLiteral<12>, z.ZodLiteral<24>]>;
|
|
216
|
-
minute: z.ZodNumber;
|
|
217
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
218
|
-
kind: z.ZodLiteral<"daily">;
|
|
219
|
-
time: z.ZodString;
|
|
220
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
221
|
-
kind: z.ZodLiteral<"weekly">;
|
|
222
|
-
weekday: z.ZodNumber;
|
|
223
|
-
time: z.ZodString;
|
|
224
|
-
}, z.core.$strict>], "kind">>;
|
|
225
|
-
lookbackDays: z.ZodOptional<z.ZodNumber>;
|
|
226
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
227
|
-
}, z.core.$strict>>;
|
|
228
|
-
deep: z.ZodOptional<z.ZodObject<{
|
|
229
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
230
|
-
schedule: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
231
|
-
kind: z.ZodLiteral<"interval">;
|
|
232
|
-
everyHours: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<6>, z.ZodLiteral<8>, z.ZodLiteral<12>, z.ZodLiteral<24>]>;
|
|
233
|
-
minute: z.ZodNumber;
|
|
234
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
235
|
-
kind: z.ZodLiteral<"daily">;
|
|
236
|
-
time: z.ZodString;
|
|
237
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
238
|
-
kind: z.ZodLiteral<"weekly">;
|
|
239
|
-
weekday: z.ZodNumber;
|
|
240
|
-
time: z.ZodString;
|
|
241
|
-
}, z.core.$strict>], "kind">>;
|
|
242
|
-
minScore: z.ZodOptional<z.ZodNumber>;
|
|
243
|
-
minRecallCount: z.ZodOptional<z.ZodNumber>;
|
|
244
|
-
minUniqueQueries: z.ZodOptional<z.ZodNumber>;
|
|
245
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
246
|
-
recencyHalfLifeDays: z.ZodOptional<z.ZodNumber>;
|
|
247
|
-
maxAgeDays: z.ZodOptional<z.ZodNumber>;
|
|
248
|
-
}, z.core.$strict>>;
|
|
249
|
-
rem: z.ZodOptional<z.ZodObject<{
|
|
250
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
251
|
-
schedule: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
252
|
-
kind: z.ZodLiteral<"interval">;
|
|
253
|
-
everyHours: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<6>, z.ZodLiteral<8>, z.ZodLiteral<12>, z.ZodLiteral<24>]>;
|
|
254
|
-
minute: z.ZodNumber;
|
|
255
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
256
|
-
kind: z.ZodLiteral<"daily">;
|
|
257
|
-
time: z.ZodString;
|
|
258
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
259
|
-
kind: z.ZodLiteral<"weekly">;
|
|
260
|
-
weekday: z.ZodNumber;
|
|
261
|
-
time: z.ZodString;
|
|
262
|
-
}, z.core.$strict>], "kind">>;
|
|
263
|
-
lookbackDays: z.ZodOptional<z.ZodNumber>;
|
|
264
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
265
|
-
minPatternStrength: z.ZodOptional<z.ZodNumber>;
|
|
266
|
-
}, z.core.$strict>>;
|
|
133
|
+
schedule: z.ZodDefault<z.ZodObject<{
|
|
134
|
+
time: z.ZodDefault<z.ZodString>;
|
|
267
135
|
}, z.core.$strict>>;
|
|
136
|
+
minEvidenceSources: z.ZodDefault<z.ZodNumber>;
|
|
137
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
268
138
|
}, z.core.$strict>>;
|
|
269
139
|
export declare const UserContextConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
270
140
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -286,30 +156,23 @@ export declare const UserContextConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
286
156
|
session: "session";
|
|
287
157
|
workspace: "workspace";
|
|
288
158
|
understanding: "understanding";
|
|
289
|
-
userProfile: "userProfile";
|
|
290
159
|
agentProfile: "agentProfile";
|
|
291
|
-
connectedSources: "connectedSources";
|
|
292
160
|
}>>>;
|
|
293
161
|
writePolicy: z.ZodOptional<z.ZodObject<{
|
|
294
|
-
userProfile: z.ZodOptional<z.ZodEnum<{
|
|
295
|
-
allow: "allow";
|
|
296
|
-
confirm: "confirm";
|
|
297
|
-
deny: "deny";
|
|
298
|
-
}>>;
|
|
299
162
|
agentProfile: z.ZodOptional<z.ZodEnum<{
|
|
300
163
|
allow: "allow";
|
|
301
|
-
confirm: "confirm";
|
|
302
164
|
deny: "deny";
|
|
165
|
+
confirm: "confirm";
|
|
303
166
|
}>>;
|
|
304
167
|
understanding: z.ZodOptional<z.ZodEnum<{
|
|
305
168
|
allow: "allow";
|
|
306
|
-
confirm: "confirm";
|
|
307
169
|
deny: "deny";
|
|
170
|
+
confirm: "confirm";
|
|
308
171
|
}>>;
|
|
309
172
|
workspace: z.ZodOptional<z.ZodEnum<{
|
|
310
173
|
allow: "allow";
|
|
311
|
-
confirm: "confirm";
|
|
312
174
|
deny: "deny";
|
|
175
|
+
confirm: "confirm";
|
|
313
176
|
}>>;
|
|
314
177
|
}, z.core.$strict>>;
|
|
315
178
|
retention: z.ZodOptional<z.ZodObject<{
|
|
@@ -345,8 +208,8 @@ export declare const UserContextConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
345
208
|
privacy: z.ZodDefault<z.ZodObject<{
|
|
346
209
|
sensitiveWritePolicy: z.ZodDefault<z.ZodEnum<{
|
|
347
210
|
allow: "allow";
|
|
348
|
-
confirm: "confirm";
|
|
349
211
|
deny: "deny";
|
|
212
|
+
confirm: "confirm";
|
|
350
213
|
}>>;
|
|
351
214
|
}, z.core.$strict>>;
|
|
352
215
|
providerRouting: z.ZodDefault<z.ZodObject<{
|
|
@@ -371,71 +234,15 @@ export declare const UserContextConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
|
371
234
|
dreaming: z.ZodDefault<z.ZodObject<{
|
|
372
235
|
mode: z.ZodDefault<z.ZodEnum<{
|
|
373
236
|
off: "off";
|
|
374
|
-
observe: "observe";
|
|
375
237
|
review: "review";
|
|
376
|
-
automatic: "automatic";
|
|
377
238
|
}>>;
|
|
378
239
|
timezone: z.ZodOptional<z.ZodString>;
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
382
|
-
schedule: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
383
|
-
kind: z.ZodLiteral<"interval">;
|
|
384
|
-
everyHours: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<6>, z.ZodLiteral<8>, z.ZodLiteral<12>, z.ZodLiteral<24>]>;
|
|
385
|
-
minute: z.ZodNumber;
|
|
386
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
387
|
-
kind: z.ZodLiteral<"daily">;
|
|
388
|
-
time: z.ZodString;
|
|
389
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
390
|
-
kind: z.ZodLiteral<"weekly">;
|
|
391
|
-
weekday: z.ZodNumber;
|
|
392
|
-
time: z.ZodString;
|
|
393
|
-
}, z.core.$strict>], "kind">>;
|
|
394
|
-
lookbackDays: z.ZodOptional<z.ZodNumber>;
|
|
395
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
396
|
-
}, z.core.$strict>>;
|
|
397
|
-
deep: z.ZodOptional<z.ZodObject<{
|
|
398
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
399
|
-
schedule: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
400
|
-
kind: z.ZodLiteral<"interval">;
|
|
401
|
-
everyHours: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<6>, z.ZodLiteral<8>, z.ZodLiteral<12>, z.ZodLiteral<24>]>;
|
|
402
|
-
minute: z.ZodNumber;
|
|
403
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
404
|
-
kind: z.ZodLiteral<"daily">;
|
|
405
|
-
time: z.ZodString;
|
|
406
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
407
|
-
kind: z.ZodLiteral<"weekly">;
|
|
408
|
-
weekday: z.ZodNumber;
|
|
409
|
-
time: z.ZodString;
|
|
410
|
-
}, z.core.$strict>], "kind">>;
|
|
411
|
-
minScore: z.ZodOptional<z.ZodNumber>;
|
|
412
|
-
minRecallCount: z.ZodOptional<z.ZodNumber>;
|
|
413
|
-
minUniqueQueries: z.ZodOptional<z.ZodNumber>;
|
|
414
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
415
|
-
recencyHalfLifeDays: z.ZodOptional<z.ZodNumber>;
|
|
416
|
-
maxAgeDays: z.ZodOptional<z.ZodNumber>;
|
|
417
|
-
}, z.core.$strict>>;
|
|
418
|
-
rem: z.ZodOptional<z.ZodObject<{
|
|
419
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
420
|
-
schedule: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
421
|
-
kind: z.ZodLiteral<"interval">;
|
|
422
|
-
everyHours: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>, z.ZodLiteral<6>, z.ZodLiteral<8>, z.ZodLiteral<12>, z.ZodLiteral<24>]>;
|
|
423
|
-
minute: z.ZodNumber;
|
|
424
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
425
|
-
kind: z.ZodLiteral<"daily">;
|
|
426
|
-
time: z.ZodString;
|
|
427
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
428
|
-
kind: z.ZodLiteral<"weekly">;
|
|
429
|
-
weekday: z.ZodNumber;
|
|
430
|
-
time: z.ZodString;
|
|
431
|
-
}, z.core.$strict>], "kind">>;
|
|
432
|
-
lookbackDays: z.ZodOptional<z.ZodNumber>;
|
|
433
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
434
|
-
minPatternStrength: z.ZodOptional<z.ZodNumber>;
|
|
435
|
-
}, z.core.$strict>>;
|
|
240
|
+
schedule: z.ZodDefault<z.ZodObject<{
|
|
241
|
+
time: z.ZodDefault<z.ZodString>;
|
|
436
242
|
}, z.core.$strict>>;
|
|
243
|
+
minEvidenceSources: z.ZodDefault<z.ZodNumber>;
|
|
244
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
437
245
|
}, z.core.$strict>>;
|
|
438
246
|
}, z.core.$strict>>;
|
|
439
247
|
export type UserContextConfig = z.infer<typeof UserContextConfigSchema>;
|
|
440
|
-
export type
|
|
441
|
-
export type DreamingSettings = z.infer<typeof DreamingSettingsSchema>;
|
|
248
|
+
export type UserContextDreaming = z.infer<typeof UserContextDreamingSchema>;
|
|
@@ -10,7 +10,7 @@ function isValidTimeZone(value) {
|
|
|
10
10
|
return false;
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
var UserMemoryModeSchema, DEFAULT_CONTEXT_COMPACTION_POLICY, ContextCompactionPolicySchema, UserMemoryConfigSchema, UserUnderstandingConfigSchema, UserContextPrivacySchema, UserContextProviderRoutingSchema,
|
|
13
|
+
var UserMemoryModeSchema, DEFAULT_CONTEXT_COMPACTION_POLICY, ContextCompactionPolicySchema, UserMemoryConfigSchema, UserUnderstandingConfigSchema, UserContextPrivacySchema, UserContextProviderRoutingSchema, DreamingTimeSchema, UserContextDreamingSchema, UserContextConfigSchema;
|
|
14
14
|
var init_config = __esmMin((() => {
|
|
15
15
|
init_response_language();
|
|
16
16
|
UserMemoryModeSchema = z.enum([
|
|
@@ -56,18 +56,11 @@ var init_config = __esmMin((() => {
|
|
|
56
56
|
mode: UserMemoryModeSchema.default("off"),
|
|
57
57
|
sources: z.array(z.enum([
|
|
58
58
|
"session",
|
|
59
|
-
"userProfile",
|
|
60
59
|
"agentProfile",
|
|
61
60
|
"understanding",
|
|
62
|
-
"workspace"
|
|
63
|
-
"connectedSources"
|
|
61
|
+
"workspace"
|
|
64
62
|
])).default(["session"]),
|
|
65
63
|
writePolicy: z.object({
|
|
66
|
-
userProfile: z.enum([
|
|
67
|
-
"deny",
|
|
68
|
-
"confirm",
|
|
69
|
-
"allow"
|
|
70
|
-
]).optional(),
|
|
71
64
|
agentProfile: z.enum([
|
|
72
65
|
"deny",
|
|
73
66
|
"confirm",
|
|
@@ -135,83 +128,19 @@ var init_config = __esmMin((() => {
|
|
|
135
128
|
writeStrategy: "local-first",
|
|
136
129
|
allowExternalWrites: false
|
|
137
130
|
});
|
|
138
|
-
DreamingIntervalHoursSchema = z.union([
|
|
139
|
-
z.literal(1),
|
|
140
|
-
z.literal(2),
|
|
141
|
-
z.literal(3),
|
|
142
|
-
z.literal(4),
|
|
143
|
-
z.literal(6),
|
|
144
|
-
z.literal(8),
|
|
145
|
-
z.literal(12),
|
|
146
|
-
z.literal(24)
|
|
147
|
-
]);
|
|
148
131
|
DreamingTimeSchema = z.string().regex(/^([01]\d|2[0-3]):[0-5]\d$/, "Expected time in HH:mm format");
|
|
149
|
-
DreamingScheduleSchema = z.discriminatedUnion("kind", [
|
|
150
|
-
z.object({
|
|
151
|
-
kind: z.literal("interval"),
|
|
152
|
-
everyHours: DreamingIntervalHoursSchema,
|
|
153
|
-
minute: z.number().int().min(0).max(59)
|
|
154
|
-
}).strict(),
|
|
155
|
-
z.object({
|
|
156
|
-
kind: z.literal("daily"),
|
|
157
|
-
time: DreamingTimeSchema
|
|
158
|
-
}).strict(),
|
|
159
|
-
z.object({
|
|
160
|
-
kind: z.literal("weekly"),
|
|
161
|
-
weekday: z.number().int().min(0).max(6),
|
|
162
|
-
time: DreamingTimeSchema
|
|
163
|
-
}).strict()
|
|
164
|
-
]);
|
|
165
|
-
DreamingEditablePhaseSchema = z.object({
|
|
166
|
-
enabled: z.boolean(),
|
|
167
|
-
schedule: DreamingScheduleSchema
|
|
168
|
-
}).strict();
|
|
169
|
-
DreamingSettingsSchema = z.object({
|
|
170
|
-
mode: z.enum([
|
|
171
|
-
"off",
|
|
172
|
-
"observe",
|
|
173
|
-
"review",
|
|
174
|
-
"automatic"
|
|
175
|
-
]),
|
|
176
|
-
timezone: z.string().min(1).refine(isValidTimeZone, "Invalid IANA timezone"),
|
|
177
|
-
phases: z.object({
|
|
178
|
-
light: DreamingEditablePhaseSchema,
|
|
179
|
-
deep: DreamingEditablePhaseSchema,
|
|
180
|
-
rem: DreamingEditablePhaseSchema
|
|
181
|
-
}).strict()
|
|
182
|
-
}).strict();
|
|
183
|
-
DreamingPhaseSchema = z.object({
|
|
184
|
-
enabled: z.boolean().optional(),
|
|
185
|
-
schedule: DreamingScheduleSchema.optional()
|
|
186
|
-
}).strict();
|
|
187
132
|
UserContextDreamingSchema = z.object({
|
|
188
|
-
mode: z.enum([
|
|
189
|
-
"off",
|
|
190
|
-
"observe",
|
|
191
|
-
"review",
|
|
192
|
-
"automatic"
|
|
193
|
-
]).default("off"),
|
|
133
|
+
mode: z.enum(["off", "review"]).default("review"),
|
|
194
134
|
timezone: z.string().min(1).refine(isValidTimeZone, "Invalid IANA timezone").optional(),
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
limit: z.number().int().nonnegative().optional(),
|
|
205
|
-
recencyHalfLifeDays: z.number().positive().optional(),
|
|
206
|
-
maxAgeDays: z.number().positive().optional()
|
|
207
|
-
}).strict().optional(),
|
|
208
|
-
rem: DreamingPhaseSchema.extend({
|
|
209
|
-
lookbackDays: z.number().int().positive().optional(),
|
|
210
|
-
limit: z.number().int().nonnegative().optional(),
|
|
211
|
-
minPatternStrength: z.number().min(0).max(1).optional()
|
|
212
|
-
}).strict().optional()
|
|
213
|
-
}).strict().optional()
|
|
214
|
-
}).strict().default({ mode: "off" });
|
|
135
|
+
schedule: z.object({ time: DreamingTimeSchema.default("03:00") }).strict().default({ time: "03:00" }),
|
|
136
|
+
minEvidenceSources: z.number().int().min(2).max(10).default(2),
|
|
137
|
+
limit: z.number().int().positive().max(2e3).default(500)
|
|
138
|
+
}).strict().default({
|
|
139
|
+
mode: "review",
|
|
140
|
+
schedule: { time: "03:00" },
|
|
141
|
+
minEvidenceSources: 2,
|
|
142
|
+
limit: 500
|
|
143
|
+
});
|
|
215
144
|
UserContextConfigSchema = z.object({
|
|
216
145
|
enabled: z.boolean().default(true),
|
|
217
146
|
preferences: z.object({ responseLanguage: ResponseLanguageSchema.default("auto") }).strict().default({ responseLanguage: "auto" }),
|
|
@@ -241,9 +170,14 @@ var init_config = __esmMin((() => {
|
|
|
241
170
|
writeStrategy: "local-first",
|
|
242
171
|
allowExternalWrites: false
|
|
243
172
|
},
|
|
244
|
-
dreaming: {
|
|
173
|
+
dreaming: {
|
|
174
|
+
mode: "review",
|
|
175
|
+
schedule: { time: "03:00" },
|
|
176
|
+
minEvidenceSources: 2,
|
|
177
|
+
limit: 500
|
|
178
|
+
}
|
|
245
179
|
});
|
|
246
180
|
}));
|
|
247
181
|
//#endregion
|
|
248
182
|
init_config();
|
|
249
|
-
export { ContextCompactionPolicySchema, DEFAULT_CONTEXT_COMPACTION_POLICY,
|
|
183
|
+
export { ContextCompactionPolicySchema, DEFAULT_CONTEXT_COMPACTION_POLICY, UserContextConfigSchema, UserContextDreamingSchema, UserContextPrivacySchema, UserContextProviderRoutingSchema, UserMemoryConfigSchema, UserMemoryModeSchema, UserUnderstandingConfigSchema, init_config };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Config } from '../config/schema.js';
|
|
2
|
+
import { type ContextConsolidationRun } from '../storage/sqlite/index.js';
|
|
3
|
+
export declare const USER_CONTEXT_CONSOLIDATION_TOKEN = "__xopc_user_context_consolidation__";
|
|
4
|
+
export declare const USER_CONTEXT_CONSOLIDATION_AUTOMATION_ID = "system-user-context-consolidation";
|
|
5
|
+
type ConsolidationMetrics = {
|
|
6
|
+
scanned: number;
|
|
7
|
+
needsReview: number;
|
|
8
|
+
stale: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function resolveContextConsolidationConfig(config: Config): {
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
timezone: string;
|
|
13
|
+
time: string;
|
|
14
|
+
minEvidenceSources: number;
|
|
15
|
+
limit: number;
|
|
16
|
+
};
|
|
17
|
+
export declare function compileContextConsolidationCron(time: string): string;
|
|
18
|
+
export declare function runContextConsolidation(input: {
|
|
19
|
+
config: Config;
|
|
20
|
+
triggerKind: 'schedule' | 'manual';
|
|
21
|
+
now?: number;
|
|
22
|
+
}): Promise<{
|
|
23
|
+
run: ContextConsolidationRun;
|
|
24
|
+
metrics: ConsolidationMetrics;
|
|
25
|
+
}>;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { finishContextConsolidationRun, recordContextConsolidationDecision, startContextConsolidationRun } from "../storage/sqlite/context-consolidation-repository.js";
|
|
2
|
+
import { listUnderstandingEvidence, listUnderstandings, setUnderstandingStatus } from "../storage/sqlite/user-context-repository.js";
|
|
3
|
+
import "../storage/sqlite/index.js";
|
|
4
|
+
//#region src/user-context/consolidation.ts
|
|
5
|
+
const USER_CONTEXT_CONSOLIDATION_TOKEN = "__xopc_user_context_consolidation__";
|
|
6
|
+
const USER_CONTEXT_CONSOLIDATION_AUTOMATION_ID = "system-user-context-consolidation";
|
|
7
|
+
function distinctEvidenceCount(understandingId, relation) {
|
|
8
|
+
return new Set(listUnderstandingEvidence(understandingId, relation).map((evidence) => `${evidence.sourceType}:${evidence.sourceInstanceId ?? ""}:${evidence.sourceRef}`)).size;
|
|
9
|
+
}
|
|
10
|
+
function resolveContextConsolidationConfig(config) {
|
|
11
|
+
const dreaming = config.userContext.dreaming;
|
|
12
|
+
return {
|
|
13
|
+
enabled: config.userContext.enabled && dreaming.mode === "review",
|
|
14
|
+
timezone: dreaming.timezone ?? Intl.DateTimeFormat().resolvedOptions().timeZone ?? "UTC",
|
|
15
|
+
time: dreaming.schedule.time,
|
|
16
|
+
minEvidenceSources: dreaming.minEvidenceSources,
|
|
17
|
+
limit: dreaming.limit
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function compileContextConsolidationCron(time) {
|
|
21
|
+
const [hour, minute] = time.split(":").map(Number);
|
|
22
|
+
return `${minute} ${hour} * * *`;
|
|
23
|
+
}
|
|
24
|
+
async function runContextConsolidation(input) {
|
|
25
|
+
const resolved = resolveContextConsolidationConfig(input.config);
|
|
26
|
+
if (input.triggerKind === "schedule" && !resolved.enabled) throw new Error("User context consolidation is off");
|
|
27
|
+
const now = input.now ?? Date.now();
|
|
28
|
+
const run = startContextConsolidationRun(input.triggerKind, now);
|
|
29
|
+
const metrics = {
|
|
30
|
+
scanned: 0,
|
|
31
|
+
needsReview: 0,
|
|
32
|
+
stale: 0
|
|
33
|
+
};
|
|
34
|
+
try {
|
|
35
|
+
const understandings = listUnderstandings(["candidate", "active"]).slice(0, resolved.limit);
|
|
36
|
+
for (const understanding of understandings) {
|
|
37
|
+
metrics.scanned += 1;
|
|
38
|
+
const evidenceCount = distinctEvidenceCount(understanding.id, "supports");
|
|
39
|
+
const contradictionCount = distinctEvidenceCount(understanding.id, "contradicts");
|
|
40
|
+
if (understanding.validTo != null && understanding.validTo <= now || understanding.expiresAt != null && understanding.expiresAt <= now) {
|
|
41
|
+
setUnderstandingStatus(understanding.id, "stale");
|
|
42
|
+
recordContextConsolidationDecision({
|
|
43
|
+
runId: run.runId,
|
|
44
|
+
understandingId: understanding.id,
|
|
45
|
+
action: "stale",
|
|
46
|
+
reasonCode: "validity_expired",
|
|
47
|
+
evidenceCount,
|
|
48
|
+
now
|
|
49
|
+
});
|
|
50
|
+
metrics.stale += 1;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (contradictionCount > 0) {
|
|
54
|
+
setUnderstandingStatus(understanding.id, "needs_review");
|
|
55
|
+
recordContextConsolidationDecision({
|
|
56
|
+
runId: run.runId,
|
|
57
|
+
understandingId: understanding.id,
|
|
58
|
+
action: "needs_review",
|
|
59
|
+
reasonCode: "contradictory_evidence",
|
|
60
|
+
evidenceCount: contradictionCount,
|
|
61
|
+
now
|
|
62
|
+
});
|
|
63
|
+
metrics.needsReview += 1;
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
66
|
+
if (understanding.status === "active" && understanding.reviewAt != null && understanding.reviewAt <= now) {
|
|
67
|
+
setUnderstandingStatus(understanding.id, "needs_review");
|
|
68
|
+
recordContextConsolidationDecision({
|
|
69
|
+
runId: run.runId,
|
|
70
|
+
understandingId: understanding.id,
|
|
71
|
+
action: "needs_review",
|
|
72
|
+
reasonCode: "review_due",
|
|
73
|
+
evidenceCount,
|
|
74
|
+
now
|
|
75
|
+
});
|
|
76
|
+
metrics.needsReview += 1;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
if (understanding.status === "candidate" && evidenceCount >= resolved.minEvidenceSources) {
|
|
80
|
+
setUnderstandingStatus(understanding.id, "needs_review");
|
|
81
|
+
recordContextConsolidationDecision({
|
|
82
|
+
runId: run.runId,
|
|
83
|
+
understandingId: understanding.id,
|
|
84
|
+
action: "needs_review",
|
|
85
|
+
reasonCode: "independent_evidence_threshold",
|
|
86
|
+
evidenceCount,
|
|
87
|
+
now
|
|
88
|
+
});
|
|
89
|
+
metrics.needsReview += 1;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
run: finishContextConsolidationRun({
|
|
94
|
+
runId: run.runId,
|
|
95
|
+
ok: true,
|
|
96
|
+
reason: "completed",
|
|
97
|
+
metrics,
|
|
98
|
+
now
|
|
99
|
+
}) ?? run,
|
|
100
|
+
metrics
|
|
101
|
+
};
|
|
102
|
+
} catch (error) {
|
|
103
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
104
|
+
finishContextConsolidationRun({
|
|
105
|
+
runId: run.runId,
|
|
106
|
+
ok: false,
|
|
107
|
+
reason,
|
|
108
|
+
metrics,
|
|
109
|
+
now
|
|
110
|
+
});
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
//#endregion
|
|
115
|
+
export { USER_CONTEXT_CONSOLIDATION_AUTOMATION_ID, USER_CONTEXT_CONSOLIDATION_TOKEN, compileContextConsolidationCron, resolveContextConsolidationConfig, runContextConsolidation };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export declare const USER_CONTEXT_PRINCIPAL_ID = "local-owner";
|
|
2
|
+
export type UserProfile = {
|
|
3
|
+
callName: string;
|
|
4
|
+
role: string;
|
|
5
|
+
primaryGoal: string;
|
|
6
|
+
pronouns: string;
|
|
7
|
+
timezone: string;
|
|
8
|
+
locale: string;
|
|
9
|
+
accessibility: Record<string, unknown>;
|
|
10
|
+
createdAt: number;
|
|
11
|
+
updatedAt: number;
|
|
12
|
+
};
|
|
13
|
+
export type UserContextScope = {
|
|
14
|
+
type: 'global' | 'workspace' | 'project' | 'session';
|
|
15
|
+
id?: string;
|
|
16
|
+
};
|
|
17
|
+
export type UnderstandingKind = 'preference' | 'boundary' | 'relationship' | 'routine' | 'current_state' | 'long_term_goal' | 'project_context' | 'task_lesson' | 'derived_insight';
|
|
18
|
+
export type UnderstandingStatus = 'candidate' | 'active' | 'needs_review' | 'stale' | 'archived' | 'rejected';
|
|
19
|
+
export type UserUnderstanding = {
|
|
20
|
+
id: string;
|
|
21
|
+
kind: UnderstandingKind;
|
|
22
|
+
canonicalKey: string;
|
|
23
|
+
status: UnderstandingStatus;
|
|
24
|
+
scope: UserContextScope;
|
|
25
|
+
explicitness: 'explicit' | 'observed' | 'inferred';
|
|
26
|
+
durability: 'ephemeral' | 'durable' | 'recurring';
|
|
27
|
+
sensitivity: 'normal' | 'personal' | 'secret' | 'regulated';
|
|
28
|
+
disclosurePolicy: 'silent' | 'referenceable' | 'ask_before_reference';
|
|
29
|
+
confidence: number;
|
|
30
|
+
statement: string;
|
|
31
|
+
payload: Record<string, unknown>;
|
|
32
|
+
versionId: string;
|
|
33
|
+
validFrom?: number;
|
|
34
|
+
validTo?: number;
|
|
35
|
+
expiresAt?: number;
|
|
36
|
+
reviewAt?: number;
|
|
37
|
+
conflictGroupId?: string;
|
|
38
|
+
supersedesId?: string;
|
|
39
|
+
createdAt: number;
|
|
40
|
+
updatedAt: number;
|
|
41
|
+
};
|
|
42
|
+
export type CollaborationRule = {
|
|
43
|
+
id: string;
|
|
44
|
+
category: 'communication' | 'execution' | 'boundary' | 'routine' | 'proactive';
|
|
45
|
+
status: 'active' | 'disabled' | 'archived';
|
|
46
|
+
priority: number;
|
|
47
|
+
scope: UserContextScope;
|
|
48
|
+
conditions: Record<string, unknown>;
|
|
49
|
+
statement: string;
|
|
50
|
+
revisionId: string;
|
|
51
|
+
createdAt: number;
|
|
52
|
+
updatedAt: number;
|
|
53
|
+
};
|
|
54
|
+
export type PersonalizationItem = {
|
|
55
|
+
objectType: 'profile' | 'rule' | 'understanding';
|
|
56
|
+
objectId: string;
|
|
57
|
+
versionId?: string;
|
|
58
|
+
decision: 'selected' | 'irrelevant' | 'expired' | 'scope_mismatch' | 'sensitive' | 'needs_consent' | 'budget_exceeded' | 'conflicted' | 'disabled';
|
|
59
|
+
reason: string;
|
|
60
|
+
content: string;
|
|
61
|
+
sourceLabel: string;
|
|
62
|
+
rank?: number;
|
|
63
|
+
score?: number;
|
|
64
|
+
injectedChars: number;
|
|
65
|
+
};
|
|
66
|
+
export type ContextEvidence = {
|
|
67
|
+
id: string;
|
|
68
|
+
sourceType: 'conversation' | 'connector' | 'user' | 'runtime';
|
|
69
|
+
sourceInstanceId?: string;
|
|
70
|
+
sourceRef: string;
|
|
71
|
+
redactedExcerpt?: string;
|
|
72
|
+
trustLevel: 'owner' | 'trusted' | 'untrusted';
|
|
73
|
+
observedAt: number;
|
|
74
|
+
createdAt: number;
|
|
75
|
+
};
|