@xopcai/xopc 0.0.248 → 0.0.250
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/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-etpmyV7S.js → activity-store-DfBjTSo9.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BmKxSM1k.js → agent-avatar-dicebear-BN6FJXkJ.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-C7rZH1A2.js +1 -0
- package/dist/gateway/static/root/assets/agents-CgGaoo4z.js +1 -0
- package/dist/gateway/static/root/assets/{api-B0-hLuZ1.js → api-zxpcJfgj.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-D2gMshuS.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-wMu0jSKx.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-KF1Gnv36.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BnMSgZvR.js → archive-plugin-u6EE3JV8.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CejsQMev.js → attachment-load-DbJurnv-.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-RC8EyoAf.js → automations-page-Ew_e5HDn.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-Ch-ldu35.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DGjppLSG.js → binary-plugins-DtDFNfPM.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CWdP4bUc.js → block-editor-CnAwmabq.js} +44 -44
- package/dist/gateway/static/root/assets/browser-settings-page-DtVhsHJW.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-BQ1Ilw_o.js → browser-workflow-inputs-BX1-uM9L.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CJh4NyxT.js → browser-workflows-page-CcbUOWDF.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel--sXeylhe.js +7 -0
- package/dist/gateway/static/root/assets/channels-settings-AXSBDujZ.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-Ohhee4vm.js → channels-status-swr-CX-yWwLD.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-BOtoKTK3.js → chat-terminal-dock-CryTDNdD.js} +2 -2
- package/dist/gateway/static/root/assets/connectors-page-HBHUWohz.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-DTj1V3Sw.js → cron-expression-ji5aWrjG.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-Yr6OCvGL.js → date-picker-Dro_w3eX.js} +1 -1
- package/dist/gateway/static/root/assets/dependency-picker-Ce19KKnX.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-DbGzggPF.js → desktop-pet-DsSi-3uZ.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-8WQ4woJy.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DgTtk4KC.js → extension-debug-page-CgvEBfLZ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DtQeiP6f.js → extension-page-DkznBbMj.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BOjhchK2.js +1 -0
- package/dist/gateway/static/root/assets/files-BArWTfr7.js +1 -0
- package/dist/gateway/static/root/assets/gateway-config-api-OEruhhX3.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-DXuXtU1w.js → gateway-config-swr-CMNbl0FZ.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-BgH3A0LO.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CzBzglzQ.js → gateway-startup-retry-CR7Xg8As.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-C97naDkO.js +1 -0
- package/dist/gateway/static/root/assets/home-page-BBKKme4G.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-TIgsn04n.js → image-generation-api-C5mn73ca.js} +1 -1
- package/dist/gateway/static/root/assets/index-BcaF-dgQ.js +72 -0
- package/dist/gateway/static/root/assets/index-DAryGvZ7.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-wsWuoa8p.js → keyboard-shortcuts-settings-BYhfzsqe.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DNncc2tn.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CXrbrGo8.js → local-apps-page-vBlknU7C.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-BJFLQY8O.js → locale-store-CF4erhjB.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-CizZInrT.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-BdJZFR7U.js → management-settings-Dnx6mSNe.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-NK3ACVG2.js → markdown-split-DtBtcHWi.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-DTF9v1gg.js → markdown-view-CQvzsE24.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-F0jcUxyl.js → media-plugins-DrMYeHe7.js} +1 -1
- package/dist/gateway/static/root/assets/messages-Cf5hpZE6.js +3 -0
- package/dist/gateway/static/root/assets/mobile-pairing-wizard-AKgGy3Kx.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-Bw3jD9Jf.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-Dpqq7Z-J.js +8 -0
- package/dist/gateway/static/root/assets/page-tabs-CX9T71by.js +1 -0
- package/dist/gateway/static/root/assets/preview-open-alternatives-DvEHoimN.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-CxGGlWA8.js → product-open-page-COcr_NUJ.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BuT6MCTs.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DXWMxOjf.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-CIsNlSBi.js → registry-api-BsRBlji7.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-7rBCUWzZ.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-YkjhiQfA.js → runtime-tools-settings-panel-CQ13P-mS.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-oFGf3G3s.js → schema-form-BUVyTpZj.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-gmEOYNb4.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DYYoJcl7.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-DVY-8_B9.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-C7VWs0IT.js → settings-page-CdiVYyTl.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BhenBnUj.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-t5oz18rh.js → share-preview-page-C88YLKm4.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-Dq7xIj0_.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-MDI9Lz6z.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DLir1nM0.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-DEDTYs2W.js → skills-page.utils-BMZAfS3G.js} +1 -1
- package/dist/gateway/static/root/assets/system-settings-panel-BM8ivYan.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-P0_RldWv.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-O597U8q_.js → theme-store-BOgkc_9D.js} +1 -1
- package/dist/gateway/static/root/assets/tunnel-api-DemxChjo.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-B5eUJ6Zq.js → use-autosave-CV3Ui5hu.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-CxfnoRVn.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CMKSwz4C.js → voice-api-key-field-CUoCi4Sq.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-q7B6fOFB.js → voice-config-api-C-ryeIxj.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-BhDlkCMB.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DZmvLZjb.js → workflow-run-setup-panel-D8CcPc_C.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-Bxn2Dc16.js +5 -0
- package/dist/gateway/static/root/index.html +11 -27
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/user-message-display.js +18 -0
- package/dist/src/agent/agent-instance-gateway.d.ts +3 -3
- package/dist/src/agent/agent-manager.d.ts +13 -13
- package/dist/src/agent/agent-manager.js +76 -42
- package/dist/src/agent/background-review/coordinator.d.ts +2 -4
- package/dist/src/agent/background-review/coordinator.js +5 -30
- package/dist/src/agent/background-review/prompts.d.ts +4 -2
- package/dist/src/agent/background-review/prompts.js +33 -19
- package/dist/src/agent/background-review/run-background-review.d.ts +6 -7
- package/dist/src/agent/background-review/run-background-review.js +47 -41
- package/dist/src/agent/background-review/settings.d.ts +0 -1
- package/dist/src/agent/background-review/settings.js +6 -7
- package/dist/src/agent/context/audit.d.ts +38 -0
- package/dist/src/agent/context/audit.js +123 -0
- package/dist/src/agent/context/coordinator.d.ts +31 -0
- package/dist/src/agent/context/coordinator.js +73 -0
- package/dist/src/agent/context/execution-context.d.ts +13 -0
- package/dist/src/agent/context/execution-context.js +211 -0
- package/dist/src/agent/context/execution-context.types.d.ts +50 -0
- package/dist/src/agent/context/execution-scope.d.ts +5 -1
- package/dist/src/agent/context/execution-scope.js +6 -2
- package/dist/src/agent/context/prepend.d.ts +2 -0
- package/dist/src/agent/context/prepend.js +28 -0
- package/dist/src/agent/context/project-context.d.ts +6 -3
- package/dist/src/agent/context/project-context.js +28 -23
- package/dist/src/agent/embedded/index.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -0
- package/dist/src/agent/embedded/run-turn.js +22 -2
- package/dist/src/agent/embedded/types.d.ts +1 -25
- package/dist/src/agent/external-tools/composio-provider.js +87 -92
- package/dist/src/agent/external-tools/gateway-tools.d.ts +4 -1
- package/dist/src/agent/external-tools/gateway-tools.js +153 -41
- package/dist/src/agent/external-tools/index.d.ts +1 -0
- package/dist/src/agent/external-tools/index.js +2 -1
- package/dist/src/agent/external-tools/memory-provider.d.ts +1 -0
- package/dist/src/agent/external-tools/memory-provider.js +1 -0
- package/dist/src/agent/external-tools/search-error.d.ts +12 -0
- package/dist/src/agent/external-tools/search-error.js +29 -0
- package/dist/src/agent/external-tools/service.d.ts +4 -0
- package/dist/src/agent/external-tools/service.js +22 -2
- package/dist/src/agent/inbound/attachment-pipeline.js +5 -1
- package/dist/src/agent/memory/compaction-policy.js +1 -1
- package/dist/src/agent/memory/compaction-promotion.d.ts +1 -0
- package/dist/src/agent/memory/compaction-promotion.js +52 -79
- package/dist/src/agent/memory/create-memory-manager.js +1 -3
- package/dist/src/agent/memory/index.d.ts +1 -6
- package/dist/src/agent/memory/index.js +3 -6
- package/dist/src/agent/memory/manager.d.ts +0 -16
- package/dist/src/agent/memory/manager.js +11 -40
- package/dist/src/agent/memory/memory-config.d.ts +0 -5
- package/dist/src/agent/memory/memory-config.js +2 -9
- package/dist/src/agent/memory/runtime.d.ts +2 -2
- package/dist/src/agent/memory/runtime.js +9 -19
- package/dist/src/agent/memory/types.d.ts +1 -1
- package/dist/src/agent/orchestration/agent-orchestrator.js +13 -21
- package/dist/src/agent/orchestration/context-overflow.js +1 -0
- package/dist/src/agent/prompt/sections/memory-skills.js +25 -36
- package/dist/src/agent/prompt/sections/tooling.js +10 -4
- package/dist/src/agent/prompt/service-prompt-builder.js +4 -3
- package/dist/src/agent/service/direct-turn-helpers.d.ts +2 -2
- package/dist/src/agent/service/direct-turn-helpers.js +8 -25
- package/dist/src/agent/service/process-direct-streaming.js +8 -7
- package/dist/src/agent/service.js +4 -3
- package/dist/src/agent/tasks/task-judge-service.js +1 -1
- package/dist/src/agent/tools/clarify-tool.d.ts +1 -0
- package/dist/src/agent/tools/delegate-tool.js +5 -2
- package/dist/src/agent/tools/factory.d.ts +1 -0
- package/dist/src/agent/tools/factory.js +68 -21
- package/dist/src/agent/tools/index.d.ts +3 -2
- package/dist/src/agent/tools/index.js +4 -3
- package/dist/src/agent/tools/knowledge-memory-tool.d.ts +15 -0
- package/dist/src/agent/tools/knowledge-memory-tool.js +184 -0
- package/dist/src/agent/tools/{dreaming-tool.d.ts → memory-maintenance-tool.d.ts} +2 -2
- package/dist/src/agent/tools/memory-maintenance-tool.js +31 -0
- package/dist/src/agent/tools/session-search-tool.d.ts +1 -0
- package/dist/src/agent/tools/session-search-tool.js +7 -0
- package/dist/src/agent/tools/user-context-tool.d.ts +10 -0
- package/dist/src/agent/tools/user-context-tool.js +98 -0
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/automations/service/automation-service.d.ts +2 -1
- package/dist/src/automations/service/automation-service.js +6 -2
- package/dist/src/chat-commands/builtins/understanding.js +24 -6
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/schema.d.ts +68 -75
- package/dist/src/config/schema.js +29 -18
- package/dist/src/config/web-patch.d.ts +1 -1
- package/dist/src/connectors/auth-provider-registry.js +1 -1
- package/dist/src/connectors/composio-managed-client.js +6 -2
- package/dist/src/connectors/connected-source-ingestion.js +1 -1
- package/dist/src/connectors/connected-source-understanding.d.ts +1 -3
- package/dist/src/connectors/connected-source-understanding.js +86 -99
- package/dist/src/connectors/connection-candidates.d.ts +11 -0
- package/dist/src/connectors/connection-candidates.js +58 -0
- package/dist/src/connectors/connection-capabilities.d.ts +4 -0
- package/dist/src/connectors/connection-capabilities.js +37 -0
- package/dist/src/connectors/connection-recovery-service.d.ts +43 -0
- package/dist/src/connectors/connection-recovery-service.js +420 -0
- package/dist/src/connectors/health.js +1 -1
- package/dist/src/connectors/learning-coordinator.d.ts +0 -2
- package/dist/src/connectors/learning-coordinator.js +6 -7
- package/dist/src/connectors/principal.d.ts +5 -0
- package/dist/src/connectors/principal.js +18 -0
- package/dist/src/files/file-service.js +4 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +28 -10
- package/dist/src/gateway/agent-builtin-tools.js +30 -9
- package/dist/src/gateway/chat-stream/mapper.js +1 -28
- package/dist/src/gateway/chat-stream/protocol.d.ts +2 -24
- package/dist/src/gateway/clarify-bridge.d.ts +4 -0
- package/dist/src/gateway/clarify-bridge.js +9 -4
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +52 -30
- package/dist/src/gateway/hono/lib/config-payload.js +4 -4
- package/dist/src/gateway/hono/middleware/auth.js +1 -2
- package/dist/src/gateway/hono/routes/capabilities.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.d.ts +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +72 -28
- package/dist/src/gateway/hono/routes/connection-waits.d.ts +3 -0
- package/dist/src/gateway/hono/routes/connection-waits.js +58 -0
- package/dist/src/gateway/hono/routes/connectors.js +24 -18
- package/dist/src/gateway/hono/routes/context-sources.d.ts +4 -0
- package/dist/src/gateway/hono/routes/context-sources.js +159 -0
- package/dist/src/gateway/hono/routes/files.js +23 -2
- package/dist/src/gateway/hono/routes/index.js +4 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +9 -4
- package/dist/src/gateway/hono/routes/mcp.js +1 -1
- package/dist/src/gateway/hono/routes/notes.js +22 -7
- package/dist/src/gateway/hono/routes/projects.js +36 -44
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +15 -1
- package/dist/src/gateway/hono/routes/side-chats.js +13 -2
- package/dist/src/gateway/hono/routes/tasks.js +3 -3
- package/dist/src/gateway/hono/routes/user-model.d.ts +3 -0
- package/dist/src/gateway/hono/routes/user-model.js +480 -0
- package/dist/src/gateway/memory-maintenance-automation-reconciler.d.ts +11 -0
- package/dist/src/gateway/memory-maintenance-automation-reconciler.js +72 -0
- package/dist/src/gateway/security/gateway-scopes.js +2 -0
- package/dist/src/gateway/service/agent-runner.d.ts +9 -1
- package/dist/src/gateway/service/agent-runner.js +25 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +2 -2
- package/dist/src/gateway/service/config-coordinator.js +4 -4
- package/dist/src/gateway/service/run-gateway-agent.d.ts +1 -0
- package/dist/src/gateway/service/run-gateway-agent.js +18 -14
- package/dist/src/gateway/service/session-input-coordinator.d.ts +3 -0
- package/dist/src/gateway/service/session-input-coordinator.js +12 -2
- package/dist/src/gateway/service.d.ts +3 -1
- package/dist/src/gateway/service.js +52 -17
- package/dist/src/gateway/side-chat/manager.d.ts +16 -3
- package/dist/src/gateway/side-chat/manager.js +117 -28
- package/dist/src/gateway/side-chat/run-service.d.ts +2 -0
- package/dist/src/gateway/side-chat/run-service.js +28 -5
- package/dist/src/gateway/side-chat/types.d.ts +9 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/knowledge/connected-knowledge-pipeline.d.ts +0 -2
- package/dist/src/knowledge/connected-knowledge-pipeline.js +46 -217
- package/dist/src/knowledge-memory/domain.d.ts +36 -0
- package/dist/src/knowledge-memory/index.d.ts +2 -0
- package/dist/src/knowledge-memory/index.js +2 -0
- package/dist/src/knowledge-memory/repository.d.ts +48 -0
- package/dist/src/knowledge-memory/repository.js +168 -0
- package/dist/src/memory-maintenance/index.d.ts +2 -0
- package/dist/src/memory-maintenance/index.js +3 -0
- package/dist/src/memory-maintenance/schedule.d.ts +13 -0
- package/dist/src/memory-maintenance/schedule.js +51 -0
- package/dist/src/memory-maintenance/service.d.ts +28 -0
- package/dist/src/memory-maintenance/service.js +216 -0
- package/dist/src/notes/service.d.ts +1 -0
- package/dist/src/notes/service.js +7 -1
- package/dist/src/notes/types.d.ts +16 -0
- package/dist/src/notifications/planner.js +7 -3
- package/dist/src/proactive/actions/service.d.ts +0 -1
- package/dist/src/proactive/actions/service.js +1 -10
- package/dist/src/proactive/execution/context.d.ts +8 -10
- package/dist/src/proactive/execution/context.js +93 -42
- package/dist/src/proactive/execution/insight.d.ts +4 -1
- package/dist/src/proactive/execution/insight.js +5 -2
- package/dist/src/proactive/execution/repository.d.ts +1 -0
- package/dist/src/proactive/execution/repository.js +9 -1
- package/dist/src/proactive/execution/types.d.ts +0 -1
- package/dist/src/proactive/execution/worker.js +7 -5
- package/dist/src/proactive/inbox/repository.js +8 -2
- package/dist/src/proactive/inbox/service.js +2 -2
- package/dist/src/proactive/inbox/types.d.ts +1 -0
- package/dist/src/proactive/inbox/worker.d.ts +1 -0
- package/dist/src/proactive/inbox/worker.js +7 -0
- package/dist/src/proactive/index.d.ts +2 -1
- package/dist/src/proactive/index.js +3 -2
- package/dist/src/proactive/maintenance.d.ts +4 -0
- package/dist/src/proactive/maintenance.js +21 -0
- package/dist/src/proactive/scenarios/repository.d.ts +1 -1
- package/dist/src/proactive/scenarios/repository.js +10 -3
- package/dist/src/proactive/scenarios/types.d.ts +7 -0
- package/dist/src/proactive/service.d.ts +7 -0
- package/dist/src/proactive/service.js +17 -1
- package/dist/src/projects/index.d.ts +1 -1
- package/dist/src/projects/index.js +2 -2
- package/dist/src/projects/knowledge-bind.d.ts +1 -0
- package/dist/src/projects/knowledge-bind.js +15 -0
- package/dist/src/projects/project-loop.d.ts +3 -3
- package/dist/src/projects/project-loop.js +4 -4
- package/dist/src/projects/project-service.d.ts +2 -1
- package/dist/src/projects/project-service.js +3 -2
- package/dist/src/projects/project-store.js +2 -1
- package/dist/src/realtime/runtime.js +1 -0
- package/dist/src/runtime-tools/manager.js +1 -1
- package/dist/src/session/index.js +1 -1
- package/dist/src/session/store.js +5 -2
- package/dist/src/storage/sqlite/collaboration-rule-repository.d.ts +19 -0
- package/dist/src/storage/sqlite/collaboration-rule-repository.js +54 -0
- package/dist/src/storage/sqlite/config-repository.js +1 -1
- package/dist/src/storage/sqlite/connection-wait-repository.d.ts +30 -0
- package/dist/src/storage/sqlite/connection-wait-repository.js +338 -0
- package/dist/src/storage/sqlite/connector-account-repository.js +1 -1
- package/dist/src/storage/sqlite/context-evidence-repository.d.ts +24 -0
- package/dist/src/storage/sqlite/context-evidence-repository.js +52 -0
- package/dist/src/storage/sqlite/index.d.ts +3 -5
- package/dist/src/storage/sqlite/index.js +6 -8
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +0 -19
- package/dist/src/storage/sqlite/knowledge-repository.js +1 -90
- package/dist/src/storage/sqlite/migrations/148_user_model_foundation.sql +554 -0
- package/dist/src/storage/sqlite/migrations/149_separate_source_index_from_memory.sql +18 -0
- package/dist/src/storage/sqlite/migrations/150_session_connection_waits.sql +47 -0
- package/dist/src/storage/sqlite/migrations/151_proactive_scope_cleanup.sql +6 -0
- package/dist/src/storage/sqlite/migrations/152_proactive_scenario_contract.sql +140 -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/notes-repository.d.ts +2 -1
- package/dist/src/storage/sqlite/notes-repository.js +37 -3
- package/dist/src/storage/sqlite/row-mappers.js +2 -2
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-input-repository.d.ts +14 -2
- package/dist/src/storage/sqlite/session-input-repository.js +17 -14
- package/dist/src/storage/sqlite/session-instance-repository.d.ts +2 -0
- package/dist/src/storage/sqlite/session-instance-repository.js +6 -0
- package/dist/src/storage/sqlite/session-repository.d.ts +1 -1
- package/dist/src/storage/sqlite/session-repository.js +7 -6
- package/dist/src/storage/sqlite/transcript-repository.js +3 -2
- package/dist/src/tasks/home-query-service.js +35 -13
- package/dist/src/tasks/index.js +2 -2
- package/dist/src/tasks/project-monitoring-service.d.ts +2 -0
- package/dist/src/tasks/project-monitoring-service.js +4 -1
- package/dist/src/tasks/project-operating-view-service.js +1 -1
- package/dist/src/tasks/task-application-service.js +6 -1
- package/dist/src/tasks/task-context-assembler.js +1 -1
- package/dist/src/tasks/task-context-repository.d.ts +0 -1
- package/dist/src/tasks/task-context-repository.js +1 -1
- package/dist/src/tasks/task-deletion-service.js +1 -1
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tasks/task-read-model-projector.js +1 -1
- package/dist/src/tasks/task-run-coordinator.js +1 -1
- package/dist/src/tasks/task-run-dispatcher.js +1 -1
- package/dist/src/tasks/task-run-repository.js +1 -0
- package/dist/src/tasks/task-signal-service.js +1 -1
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/tool-summary.js +2 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/user-context/access-policy.d.ts +11 -0
- package/dist/src/user-context/access-policy.js +26 -0
- package/dist/src/user-context/changes.d.ts +1 -1
- package/dist/src/user-context/config.d.ts +135 -153
- package/dist/src/user-context/config.js +94 -99
- package/dist/src/user-context/relationship-continuity.d.ts +2 -2
- package/dist/src/user-context/relationship-continuity.js +34 -24
- package/dist/src/user-context/sources/activity-clustering.d.ts +9 -3
- package/dist/src/user-context/sources/index.js +2 -2
- package/dist/src/user-context/sources/repository.d.ts +1 -21
- package/dist/src/user-context/sources/repository.js +1 -183
- package/dist/src/user-context/sources/types.d.ts +0 -23
- package/dist/src/user-model/capture/executor.d.ts +50 -0
- package/dist/src/user-model/capture/executor.js +230 -0
- package/dist/src/user-model/capture/index.d.ts +2 -0
- package/dist/src/user-model/capture/index.js +3 -0
- package/dist/src/user-model/capture/semantic.d.ts +39 -0
- package/dist/src/user-model/capture/semantic.js +263 -0
- package/dist/src/user-model/domain.d.ts +93 -0
- package/dist/src/user-model/domain.js +33 -0
- package/dist/src/user-model/goals.d.ts +62 -0
- package/dist/src/user-model/goals.js +91 -0
- package/dist/src/user-model/importance.d.ts +11 -0
- package/dist/src/user-model/importance.js +17 -0
- package/dist/src/user-model/index.d.ts +5 -0
- package/dist/src/user-model/index.js +6 -0
- package/dist/src/user-model/repository.d.ts +23 -0
- package/dist/src/user-model/repository.js +268 -0
- package/dist/src/user-model/temporal.d.ts +10 -0
- package/dist/src/user-model/temporal.js +44 -0
- package/dist/src/voice/realtime/memory-context.d.ts +7 -2
- package/dist/src/voice/realtime/memory-context.js +39 -51
- package/dist/src/work-discovery/service.d.ts +3 -14
- package/dist/src/work-discovery/service.js +138 -99
- package/dist/src/work-discovery/types.d.ts +3 -3
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/dist/src/workflows/service/workflow-session-bridge.js +12 -20
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CUXApfcE.js +0 -1
- package/dist/gateway/static/root/assets/agents-DNq_GKuc.js +0 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-qfwAgyhQ.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-DqQVUpCC.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-dwIqYmXk.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-SkdcSZ0i.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CKCa6TvG.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DSp--zIZ.js +0 -7
- package/dist/gateway/static/root/assets/channels-settings-CMd2dDrI.js +0 -1
- package/dist/gateway/static/root/assets/cloud-C4-yfnnk.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-udWs5Kdm.js +0 -2
- package/dist/gateway/static/root/assets/dependency-picker-DpN3XZg9.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-DinCToZh.js +0 -1
- package/dist/gateway/static/root/assets/ellipsis-0k4rZLoy.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-DcguCgsH.js +0 -1
- package/dist/gateway/static/root/assets/eye-CABVeTq0.js +0 -1
- package/dist/gateway/static/root/assets/eye-off-DEAzt3g1.js +0 -1
- package/dist/gateway/static/root/assets/files-D6vf3S30.js +0 -1
- package/dist/gateway/static/root/assets/folder-open-CyzJ19I9.js +0 -1
- package/dist/gateway/static/root/assets/form-field-width-DJw_jULe.js +0 -1
- package/dist/gateway/static/root/assets/gateway-config-api-Br7lSf6H.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-CdPoDMuj.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DHk1hawP.js +0 -1
- package/dist/gateway/static/root/assets/home-page-YGipe_W6.js +0 -1
- package/dist/gateway/static/root/assets/index-D5TQQpeb.js +0 -71
- package/dist/gateway/static/root/assets/index-DReBaaTX.css +0 -2
- package/dist/gateway/static/root/assets/interaction-BmQogeqz.js +0 -1
- package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +0 -1
- package/dist/gateway/static/root/assets/link-2-D_ZKYUW7.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CpyvYyrb.js +0 -2
- package/dist/gateway/static/root/assets/local-context-graph-BjUf7fQ9.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-CXKy6E_l.js +0 -2
- package/dist/gateway/static/root/assets/message-square-plus-XP0tGdlV.js +0 -1
- package/dist/gateway/static/root/assets/messages-CHNYp8EQ.js +0 -3
- package/dist/gateway/static/root/assets/minimize-2-DtOGrlpo.js +0 -1
- package/dist/gateway/static/root/assets/mobile-pairing-wizard-3NKCniSp.js +0 -1
- package/dist/gateway/static/root/assets/models-hub-cache-nCfkBN8M.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-DuqLahi6.js +0 -1
- package/dist/gateway/static/root/assets/notes-workbench-C7j9EdQk.js +0 -5
- package/dist/gateway/static/root/assets/oauth-api-8lP_qJpq.js +0 -1
- package/dist/gateway/static/root/assets/oauth-authorization-window-Cdolr2wE.js +0 -1
- package/dist/gateway/static/root/assets/page-tabs-BaEQMYm_.js +0 -1
- package/dist/gateway/static/root/assets/pencil-DmIY3Oa-.js +0 -1
- package/dist/gateway/static/root/assets/preview-open-alternatives-CsNVTKC0.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-CfebYVX0.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-48GvzSVa.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-64xj_s2m.js +0 -1
- package/dist/gateway/static/root/assets/rotate-cw-LIg3Am9S.js +0 -1
- package/dist/gateway/static/root/assets/search-DA7gz22f.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CcwcdRN8.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BaN84CyW.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-DjWzRk4z.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DVVOCNbr.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DUYbYLi7.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BGyD0gB9.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-CjF8DTsN.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-BSYuRgFI.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-YZYSTJH7.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-FKUi9wDL.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-BCyiduKd.js +0 -2
- package/dist/gateway/static/root/assets/work-discovery-overlay-jhT2EzeH.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-DQC0TpMa.js +0 -5
- package/dist/src/agent/memory/builtin-provider.d.ts +0 -37
- package/dist/src/agent/memory/builtin-provider.js +0 -225
- package/dist/src/agent/memory/context/types.d.ts +0 -40
- package/dist/src/agent/memory/understanding/quality.d.ts +0 -8
- package/dist/src/agent/memory/understanding/quality.js +0 -18
- package/dist/src/agent/memory/understanding/service.d.ts +0 -19
- package/dist/src/agent/memory/understanding/service.js +0 -209
- package/dist/src/agent/memory/understanding/types.d.ts +0 -34
- package/dist/src/agent/memory/user-context-coordinator.d.ts +0 -23
- package/dist/src/agent/memory/user-context-coordinator.js +0 -113
- package/dist/src/agent/tools/dreaming-tool.js +0 -37
- package/dist/src/agent/tools/memory-tool.d.ts +0 -9
- package/dist/src/agent/tools/memory-tool.js +0 -119
- package/dist/src/gateway/dreaming-automation-reconciler.d.ts +0 -11
- package/dist/src/gateway/dreaming-automation-reconciler.js +0 -63
- package/dist/src/gateway/hono/routes/understanding-sources.d.ts +0 -21
- package/dist/src/gateway/hono/routes/understanding-sources.js +0 -387
- package/dist/src/gateway/hono/routes/you.d.ts +0 -3
- package/dist/src/gateway/hono/routes/you.js +0 -457
- package/dist/src/projects/memory-bind.d.ts +0 -1
- package/dist/src/projects/memory-bind.js +0 -14
- package/dist/src/storage/sqlite/context-consolidation-repository.d.ts +0 -37
- package/dist/src/storage/sqlite/context-consolidation-repository.js +0 -64
- package/dist/src/storage/sqlite/memory-records-repository.d.ts +0 -217
- package/dist/src/storage/sqlite/memory-records-repository.js +0 -715
- package/dist/src/storage/sqlite/remote-context-repository.d.ts +0 -3
- package/dist/src/storage/sqlite/remote-context-repository.js +0 -40
- package/dist/src/storage/sqlite/understanding-focus-exclusions.d.ts +0 -2
- package/dist/src/storage/sqlite/understanding-focus-exclusions.js +0 -24
- package/dist/src/storage/sqlite/user-context-quality-repository.d.ts +0 -49
- package/dist/src/storage/sqlite/user-context-quality-repository.js +0 -118
- package/dist/src/storage/sqlite/user-context-repository.d.ts +0 -85
- package/dist/src/storage/sqlite/user-context-repository.js +0 -535
- package/dist/src/user-context/automatic-context.d.ts +0 -17
- package/dist/src/user-context/automatic-context.js +0 -85
- package/dist/src/user-context/consolidation.d.ts +0 -27
- package/dist/src/user-context/consolidation.js +0 -187
- package/dist/src/user-context/context-objects.d.ts +0 -17
- package/dist/src/user-context/context-objects.js +0 -99
- package/dist/src/user-context/evaluation/harness.d.ts +0 -13
- package/dist/src/user-context/evaluation/harness.js +0 -31
- package/dist/src/user-context/extraction/executor.d.ts +0 -22
- package/dist/src/user-context/extraction/executor.js +0 -142
- package/dist/src/user-context/extraction/repair.d.ts +0 -19
- package/dist/src/user-context/extraction/repair.js +0 -71
- package/dist/src/user-context/extraction/semantic.d.ts +0 -18
- package/dist/src/user-context/extraction/semantic.js +0 -148
- package/dist/src/user-context/focus-lifecycle.d.ts +0 -2
- package/dist/src/user-context/focus-lifecycle.js +0 -26
- package/dist/src/user-context/manual-understanding.d.ts +0 -12
- package/dist/src/user-context/manual-understanding.js +0 -37
- package/dist/src/user-context/planner.d.ts +0 -17
- package/dist/src/user-context/planner.js +0 -465
- package/dist/src/user-context/relationships/indexer.d.ts +0 -13
- package/dist/src/user-context/relationships/indexer.js +0 -185
- package/dist/src/user-context/relationships/service.d.ts +0 -22
- package/dist/src/user-context/relationships/service.js +0 -50
- package/dist/src/user-context/retriever.d.ts +0 -15
- package/dist/src/user-context/retriever.js +0 -124
- package/dist/src/user-context/scope.d.ts +0 -7
- package/dist/src/user-context/scope.js +0 -9
- package/dist/src/user-context/selection-policy.d.ts +0 -20
- package/dist/src/user-context/selection-policy.js +0 -33
- package/dist/src/user-context/understanding.d.ts +0 -15
- package/dist/src/user-context/understanding.js +0 -24
- package/dist/src/user-context/understandingQuality.d.ts +0 -5
- package/dist/src/user-context/understandingQuality.js +0 -48
- /package/dist/src/agent/{memory/context/types.js → context/execution-context.types.js} +0 -0
- /package/dist/src/{agent/memory/understanding/types.js → knowledge-memory/domain.js} +0 -0
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png?v=20260713-1" />
|
|
12
12
|
<link rel="manifest" href="/site.webmanifest?v=20260713-1" />
|
|
13
13
|
<title>XOPC — Keep what matters moving.</title>
|
|
14
|
-
<script type="module" crossorigin src="/assets/index-
|
|
14
|
+
<script type="module" crossorigin src="/assets/index-BcaF-dgQ.js"></script>
|
|
15
15
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-aKtaBQYM.js">
|
|
16
16
|
<link rel="modulepreload" crossorigin href="/assets/preload-helper-zJ_50EbN.js">
|
|
17
17
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-BOUWij0V.js">
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
<link rel="modulepreload" crossorigin href="/assets/download-Dk-ZjtO6.js">
|
|
26
26
|
<link rel="modulepreload" crossorigin href="/assets/plus-Q2yW6OE7.js">
|
|
27
27
|
<link rel="modulepreload" crossorigin href="/assets/x-B_N4OPjy.js">
|
|
28
|
-
<link rel="modulepreload" crossorigin href="/assets/messages-
|
|
29
|
-
<link rel="modulepreload" crossorigin href="/assets/locale-store-
|
|
28
|
+
<link rel="modulepreload" crossorigin href="/assets/messages-Cf5hpZE6.js">
|
|
29
|
+
<link rel="modulepreload" crossorigin href="/assets/locale-store-CF4erhjB.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="/assets/cn-JdwAhgNB.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="/assets/schemas-BHS7bo06.js">
|
|
32
32
|
<link rel="modulepreload" crossorigin href="/assets/product-delivery-CV4pDOtG.js">
|
|
33
33
|
<link rel="modulepreload" crossorigin href="/assets/copy-to-clipboard-HOJ79TWv.js">
|
|
34
|
-
<link rel="modulepreload" crossorigin href="/assets/markdown-view-
|
|
34
|
+
<link rel="modulepreload" crossorigin href="/assets/markdown-view-CQvzsE24.js">
|
|
35
35
|
<link rel="modulepreload" crossorigin href="/assets/dist-DLmwHyAh.js">
|
|
36
36
|
<link rel="modulepreload" crossorigin href="/assets/vendor-swr-BIWyz7Rc.js">
|
|
37
37
|
<link rel="modulepreload" crossorigin href="/assets/check-DUBLcKHA.js">
|
|
@@ -40,39 +40,23 @@
|
|
|
40
40
|
<link rel="modulepreload" crossorigin href="/assets/settings-shell-layer-context-DCp6ykjQ.js">
|
|
41
41
|
<link rel="modulepreload" crossorigin href="/assets/popover-select-C-Hj-nXR.js">
|
|
42
42
|
<link rel="modulepreload" crossorigin href="/assets/circle-check-C23XjkUj.js">
|
|
43
|
-
<link rel="modulepreload" crossorigin href="/assets/cloud-C4-yfnnk.js">
|
|
44
43
|
<link rel="modulepreload" crossorigin href="/assets/copy-Dv6d4Dvw.js">
|
|
45
|
-
<link rel="modulepreload" crossorigin href="/assets/ellipsis-0k4rZLoy.js">
|
|
46
44
|
<link rel="modulepreload" crossorigin href="/assets/external-link-DjqjBmc3.js">
|
|
47
|
-
<link rel="modulepreload" crossorigin href="/assets/eye-off-DEAzt3g1.js">
|
|
48
|
-
<link rel="modulepreload" crossorigin href="/assets/eye-CABVeTq0.js">
|
|
49
|
-
<link rel="modulepreload" crossorigin href="/assets/folder-open-CyzJ19I9.js">
|
|
50
45
|
<link rel="modulepreload" crossorigin href="/assets/globe-DSSGFWFn.js">
|
|
51
|
-
<link rel="modulepreload" crossorigin href="/assets/link-2-D_ZKYUW7.js">
|
|
52
46
|
<link rel="modulepreload" crossorigin href="/assets/loader-circle-CifKLtgG.js">
|
|
53
|
-
<link rel="modulepreload" crossorigin href="/assets/message-square-plus-XP0tGdlV.js">
|
|
54
|
-
<link rel="modulepreload" crossorigin href="/assets/minimize-2-DtOGrlpo.js">
|
|
55
|
-
<link rel="modulepreload" crossorigin href="/assets/pencil-DmIY3Oa-.js">
|
|
56
|
-
<link rel="modulepreload" crossorigin href="/assets/rotate-cw-LIg3Am9S.js">
|
|
57
|
-
<link rel="modulepreload" crossorigin href="/assets/search-DA7gz22f.js">
|
|
58
47
|
<link rel="modulepreload" crossorigin href="/assets/middleware-Pd0e8Igk.js">
|
|
59
|
-
<link rel="modulepreload" crossorigin href="/assets/files-
|
|
48
|
+
<link rel="modulepreload" crossorigin href="/assets/files-BArWTfr7.js">
|
|
60
49
|
<link rel="modulepreload" crossorigin href="/assets/tool-activity-R8V9l6nk.js">
|
|
61
50
|
<link rel="modulepreload" crossorigin href="/assets/button-CtTvuElV.js">
|
|
62
|
-
<link rel="modulepreload" crossorigin href="/assets/gateway-startup-retry-
|
|
63
|
-
<link rel="modulepreload" crossorigin href="/assets/registry-api-
|
|
51
|
+
<link rel="modulepreload" crossorigin href="/assets/gateway-startup-retry-CR7Xg8As.js">
|
|
52
|
+
<link rel="modulepreload" crossorigin href="/assets/registry-api-BsRBlji7.js">
|
|
64
53
|
<link rel="modulepreload" crossorigin href="/assets/config-reload-event-Bjh2zoKp.js">
|
|
65
|
-
<link rel="modulepreload" crossorigin href="/assets/gateway-config-swr-
|
|
66
|
-
<link rel="modulepreload" crossorigin href="/assets/models-hub-cache-nCfkBN8M.js">
|
|
54
|
+
<link rel="modulepreload" crossorigin href="/assets/gateway-config-swr-CMNbl0FZ.js">
|
|
67
55
|
<link rel="modulepreload" crossorigin href="/assets/electron-env-DH5wF8X8.js">
|
|
68
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
69
|
-
<link rel="modulepreload" crossorigin href="/assets/
|
|
70
|
-
<link rel="modulepreload" crossorigin href="/assets/interaction-BmQogeqz.js">
|
|
71
|
-
<link rel="modulepreload" crossorigin href="/assets/is-masked-secret-DOkL5b_X.js">
|
|
72
|
-
<link rel="modulepreload" crossorigin href="/assets/activity-store-etpmyV7S.js">
|
|
73
|
-
<link rel="modulepreload" crossorigin href="/assets/theme-store-O597U8q_.js">
|
|
56
|
+
<link rel="modulepreload" crossorigin href="/assets/activity-store-DfBjTSo9.js">
|
|
57
|
+
<link rel="modulepreload" crossorigin href="/assets/theme-store-BOgkc_9D.js">
|
|
74
58
|
<link rel="stylesheet" crossorigin href="/assets/markdown-view-Y68dCxuc.css">
|
|
75
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
59
|
+
<link rel="stylesheet" crossorigin href="/assets/index-DAryGvZ7.css">
|
|
76
60
|
</head>
|
|
77
61
|
<body>
|
|
78
62
|
<div id="root"></div>
|
package/dist/package.js
CHANGED
|
@@ -6,6 +6,14 @@ const USER_CONTEXT_TAGS = [
|
|
|
6
6
|
"collaboration-contract",
|
|
7
7
|
"user-context"
|
|
8
8
|
];
|
|
9
|
+
const LEGACY_EXECUTION_CONTEXT_HEADINGS = [
|
|
10
|
+
"Collaboration rules:",
|
|
11
|
+
"Relevant user facts:",
|
|
12
|
+
"Active goals:",
|
|
13
|
+
"Current priorities:",
|
|
14
|
+
"Relevant knowledge:"
|
|
15
|
+
];
|
|
16
|
+
const EMBEDDED_TIMESTAMP_PREFIX_RE = /(?:^|\r?\n)(\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}[^\]]*\]\s*)/u;
|
|
9
17
|
function stripLeadingTaggedBlock(text, tag) {
|
|
10
18
|
const opening = `<${tag}>`;
|
|
11
19
|
if (!text.startsWith(opening)) return null;
|
|
@@ -23,6 +31,15 @@ function stripSourceContextsEnvelope(text) {
|
|
|
23
31
|
const withoutContexts = text.replace(/^\s*<source_contexts>[\s\S]*?<\/source_contexts>\s*/u, "").trimStart();
|
|
24
32
|
return withoutContexts.match(/^<user_message>\r?\n([\s\S]*)\r?\n<\/user_message>\s*$/u)?.[1] ?? withoutContexts;
|
|
25
33
|
}
|
|
34
|
+
/** Remove execution context persisted before it gained a structured envelope. */
|
|
35
|
+
function stripLegacyExecutionContext(text) {
|
|
36
|
+
const trimmed = text.trimStart();
|
|
37
|
+
if (!LEGACY_EXECUTION_CONTEXT_HEADINGS.some((heading) => trimmed.startsWith(heading))) return text;
|
|
38
|
+
const timestamp = trimmed.match(EMBEDDED_TIMESTAMP_PREFIX_RE);
|
|
39
|
+
if (!timestamp || timestamp.index === void 0) return text;
|
|
40
|
+
const timestampStart = timestamp.index + timestamp[0].length - timestamp[1].length;
|
|
41
|
+
return trimmed.slice(timestampStart);
|
|
42
|
+
}
|
|
26
43
|
/**
|
|
27
44
|
* Restore a model-facing user message to its client-facing text.
|
|
28
45
|
* Generated profile/memory blocks require the runtime timestamp anchor, which
|
|
@@ -49,6 +66,7 @@ function stripRuntimeUserMessageEnvelope(text) {
|
|
|
49
66
|
removedUserContext = true;
|
|
50
67
|
}
|
|
51
68
|
if (removedUserContext && !ENVELOPE_TIMESTAMP_PREFIX_RE.test(remaining)) remaining = beforeUserContext;
|
|
69
|
+
remaining = stripLegacyExecutionContext(remaining);
|
|
52
70
|
return remaining.replace(ENVELOPE_TIMESTAMP_PREFIX_RE, "");
|
|
53
71
|
}
|
|
54
72
|
//#endregion
|
|
@@ -44,9 +44,9 @@ export interface AgentInstanceGateway {
|
|
|
44
44
|
/** Last assistant text from the in-memory agent (empty when no agent / no assistant yet). */
|
|
45
45
|
getLastAssistantContent(sessionKey: string): string | null;
|
|
46
46
|
/** Build the bounded, policy-filtered context used for this model turn. */
|
|
47
|
-
prepareUserTurnContext(userMessage: AgentMessage, sessionKey: string, turnId: string): Promise<import('./
|
|
48
|
-
/** Post-turn:
|
|
49
|
-
afterAgentTurn(sessionKey: string, userPlainText: string, turnId: string): Promise<import('
|
|
47
|
+
prepareUserTurnContext(userMessage: AgentMessage, sessionKey: string, turnId: string): Promise<import('./context/coordinator.js').ExecutionContextPlan>;
|
|
48
|
+
/** Post-turn: capture durable structured user context according to policy. */
|
|
49
|
+
afterAgentTurn(sessionKey: string, userPlainText: string, turnId: string): Promise<import('../user-model/capture/index.js').UserModelCaptureResult | undefined>;
|
|
50
50
|
/** Bump the per-session "turns since memory review" counter. */
|
|
51
51
|
beginBackgroundReviewUserTurn(sessionKey: string): void;
|
|
52
52
|
/** Fire-and-forget review (memory + skill nudges) once the main turn finishes. */
|
|
@@ -22,7 +22,7 @@ import type { SessionContext } from './session/session-context.js';
|
|
|
22
22
|
import type { Skill, SkillDiagnostic, SkillMarkdownPreviewPayload, SkillRuntimeStatus } from './skills/types.js';
|
|
23
23
|
import { type SkillHubLockEntry } from './skills/hub-lock.js';
|
|
24
24
|
import type { MemoryManager } from './memory/manager.js';
|
|
25
|
-
import type
|
|
25
|
+
import { type ExecutionContextPlan } from './context/coordinator.js';
|
|
26
26
|
import { type AgentTurnPolicy } from './orchestration/agent-turn-policy.js';
|
|
27
27
|
export interface SkillCatalogEntry {
|
|
28
28
|
directoryId: string;
|
|
@@ -128,6 +128,8 @@ export interface AgentInstance {
|
|
|
128
128
|
/** Capability packs activated by explicit skills or UI entry points in this session. */
|
|
129
129
|
activeCapabilities: Map<string, AgentCapabilitySessionState>;
|
|
130
130
|
activeProjectContext?: string;
|
|
131
|
+
interactionStateVersion?: number;
|
|
132
|
+
userContextAccessVersion: string;
|
|
131
133
|
/** Declared env var names from skill_view; exec_command reads values from process.env at spawn time. */
|
|
132
134
|
skillEnvPassthroughKeys: Set<string>;
|
|
133
135
|
}
|
|
@@ -151,7 +153,7 @@ export declare class AgentManager implements AgentInstanceGateway {
|
|
|
151
153
|
private credentialCache;
|
|
152
154
|
private credentialResolver;
|
|
153
155
|
private workspaceRuntimes;
|
|
154
|
-
private
|
|
156
|
+
private executionContext;
|
|
155
157
|
private backgroundReview;
|
|
156
158
|
private skillFilesystemWatcher;
|
|
157
159
|
private skillDiskRefreshInProgress;
|
|
@@ -196,21 +198,15 @@ export declare class AgentManager implements AgentInstanceGateway {
|
|
|
196
198
|
getMemoryManager(): MemoryManager;
|
|
197
199
|
getMemoryManagerForSession(sessionKey: string): MemoryManager;
|
|
198
200
|
/** Build the bounded, policy-filtered context used for this model turn. */
|
|
199
|
-
prepareUserTurnContext(userMessage: AgentMessage, sessionKey: string, turnId: string): Promise<
|
|
200
|
-
/**
|
|
201
|
-
|
|
202
|
-
* Delegates to {@link UserContextCoordinator}.
|
|
203
|
-
*/
|
|
204
|
-
afterAgentTurn(sessionKey: string, userPlainText: string, turnId: string): Promise<import('./memory/understanding/types.js').UnderstandingReviewResult | undefined>;
|
|
201
|
+
prepareUserTurnContext(userMessage: AgentMessage, sessionKey: string, turnId: string): Promise<ExecutionContextPlan>;
|
|
202
|
+
/** Capture durable structured user context after a completed turn. */
|
|
203
|
+
afterAgentTurn(sessionKey: string, userPlainText: string, turnId: string): Promise<import('../user-model/capture/index.js').UserModelCaptureResult | undefined>;
|
|
205
204
|
/**
|
|
206
205
|
* Call once per user turn before the main embedded agent turn.
|
|
207
206
|
* Delegates to {@link BackgroundReviewCoordinator}.
|
|
208
207
|
*/
|
|
209
208
|
beginBackgroundReviewUserTurn(sessionKey: string): void;
|
|
210
|
-
/**
|
|
211
|
-
* After a successful main turn (after memory sync via `afterAgentTurn`), may run a quiet follow-up for memory/skills.
|
|
212
|
-
* Delegates to {@link BackgroundReviewCoordinator}.
|
|
213
|
-
*/
|
|
209
|
+
/** After a successful main turn, may run a quiet follow-up for context review and skills. */
|
|
214
210
|
scheduleBackgroundReviewAfterUserTurn(sessionKey: string): void;
|
|
215
211
|
/**
|
|
216
212
|
* Expand `/skill:name` user text into the full skill block for the current turn (WebChat, channels).
|
|
@@ -288,12 +284,16 @@ export declare class AgentManager implements AgentInstanceGateway {
|
|
|
288
284
|
refreshCredentials(): Promise<void>;
|
|
289
285
|
private resolveApiKeyWithCache;
|
|
290
286
|
private composeDynamicProjectContext;
|
|
287
|
+
private buildExecutionScopeContext;
|
|
288
|
+
private getInteractionStateVersion;
|
|
289
|
+
private getUserContextAccessVersion;
|
|
290
|
+
private buildExternalMemoryInstructions;
|
|
291
291
|
getCapabilityCatalogForSession(sessionKey?: string): AgentCapabilityCatalogEntry[];
|
|
292
292
|
private createAgentForProfile;
|
|
293
293
|
private buildAgentTurnPolicy;
|
|
294
294
|
private resolveToolPolicy;
|
|
295
295
|
private requestToolConfirmation;
|
|
296
|
-
private
|
|
296
|
+
private refreshDynamicContextIfChanged;
|
|
297
297
|
/**
|
|
298
298
|
* Set model for a specific session
|
|
299
299
|
*/
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { resolveStateDir } from "../config/paths-state.js";
|
|
2
2
|
import { createLogger } from "../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../utils/logger.js";
|
|
4
|
+
import { isXopcDatabaseOpen } from "../storage/sqlite/connection.js";
|
|
5
|
+
import { getInteractionState } from "../storage/sqlite/interaction-state-repository.js";
|
|
4
6
|
import { getSessionMetadata } from "../storage/sqlite/session-repository.js";
|
|
5
|
-
import { getSessionConfig } from "../storage/sqlite/config-repository.js";
|
|
6
7
|
import "../storage/sqlite/index.js";
|
|
7
8
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
8
9
|
import { applyConfigOverrides } from "../config/runtime-overrides.js";
|
|
@@ -30,15 +31,17 @@ import { loadSkillsLock } from "./skills/hub-lock.js";
|
|
|
30
31
|
import { isUnderManagedSkillsDir } from "./skills/managed-store.js";
|
|
31
32
|
import { evictAllEmbeddedSessionRunners, evictEmbeddedSessionRunner } from "./embedded/session-runner.js";
|
|
32
33
|
import { createAgentTurnPolicy } from "./orchestration/agent-turn-policy.js";
|
|
34
|
+
import { resolveUserContextSessionAccess } from "../user-context/access-policy.js";
|
|
33
35
|
import { createAgentCapabilitySessionState, resolveAgentCapabilityCatalog } from "./capabilities/registry.js";
|
|
34
36
|
import "./capabilities/index.js";
|
|
35
37
|
import { sortToolsForPromptCache } from "./tools/cache-stability.js";
|
|
36
38
|
import { AgentToolsFactory } from "./tools/factory.js";
|
|
37
39
|
import "./mcp/bundle-mcp-tools.js";
|
|
38
40
|
import { isMemorySubsystemEnabled } from "./memory/memory-config.js";
|
|
39
|
-
import {
|
|
41
|
+
import { evaluateToolGate } from "./context/execution-context.js";
|
|
42
|
+
import { ExecutionContextCoordinator } from "./context/coordinator.js";
|
|
40
43
|
import { WorkspaceRuntimeRegistry } from "./workspace-runtime/registry.js";
|
|
41
|
-
import {
|
|
44
|
+
import { runTurnUserModelCapture } from "./background-review/run-background-review.js";
|
|
42
45
|
import { BackgroundReviewCoordinator } from "./background-review/coordinator.js";
|
|
43
46
|
import { maybeRequestChannelExecApproval } from "../channels/exec-approval-runtime.js";
|
|
44
47
|
import { SkillFilesystemWatcher } from "./skills/filesystem-watcher.js";
|
|
@@ -105,7 +108,7 @@ var AgentManager = class {
|
|
|
105
108
|
credentialCache = /* @__PURE__ */ new Map();
|
|
106
109
|
credentialResolver;
|
|
107
110
|
workspaceRuntimes;
|
|
108
|
-
|
|
111
|
+
executionContext;
|
|
109
112
|
backgroundReview;
|
|
110
113
|
skillFilesystemWatcher;
|
|
111
114
|
skillDiskRefreshInProgress = false;
|
|
@@ -130,13 +133,11 @@ var AgentManager = class {
|
|
|
130
133
|
this.skillFilesystemWatcher.watchWorkspace(resolvedPath);
|
|
131
134
|
}
|
|
132
135
|
});
|
|
133
|
-
this.
|
|
136
|
+
this.executionContext = new ExecutionContextCoordinator({
|
|
134
137
|
getConfig: () => this.config.config,
|
|
135
|
-
|
|
138
|
+
getAccessForSession: (sessionKey) => resolveUserContextSessionAccess(this.config.config, sessionKey),
|
|
136
139
|
getWorkspaceIdForSession: (sk) => this.getResolvedWorkspaceForSession(sk),
|
|
137
|
-
getProjectIdForSession: (sk) => getSessionMetadata(sk)?.projectId
|
|
138
|
-
getMemoryManagerForSession: (sk) => this.getMemoryManagerForSession(sk),
|
|
139
|
-
getLastAssistantContent: (sk) => this.getLastAssistantContent(sk)
|
|
140
|
+
getProjectIdForSession: (sk) => getSessionMetadata(sk)?.projectId
|
|
140
141
|
});
|
|
141
142
|
this.backgroundReview = new BackgroundReviewCoordinator({ getConfig: () => this.mergedConfig() });
|
|
142
143
|
this.toolsFactory = new AgentToolsFactory(this.buildToolsFactoryDeps());
|
|
@@ -151,8 +152,7 @@ var AgentManager = class {
|
|
|
151
152
|
});
|
|
152
153
|
}
|
|
153
154
|
isUserContextEnabledForSession(sessionKey) {
|
|
154
|
-
|
|
155
|
-
return Boolean(this.config.config?.userContext.enabled && this.config.config.userContext.understanding.enabled && (mode === void 0 || mode === "enabled"));
|
|
155
|
+
return resolveUserContextSessionAccess(this.config.config, sessionKey).userModel;
|
|
156
156
|
}
|
|
157
157
|
computeBaseWorkspacePath() {
|
|
158
158
|
const cfg = this.config.config;
|
|
@@ -289,25 +289,21 @@ var AgentManager = class {
|
|
|
289
289
|
}
|
|
290
290
|
/** Build the bounded, policy-filtered context used for this model turn. */
|
|
291
291
|
prepareUserTurnContext(userMessage, sessionKey, turnId) {
|
|
292
|
-
return this.
|
|
292
|
+
return this.executionContext.prepare(userMessage, sessionKey, turnId);
|
|
293
293
|
}
|
|
294
|
-
/**
|
|
295
|
-
* After a completed turn: sync external providers and queue next-turn prefetch.
|
|
296
|
-
* Delegates to {@link UserContextCoordinator}.
|
|
297
|
-
*/
|
|
294
|
+
/** Capture durable structured user context after a completed turn. */
|
|
298
295
|
async afterAgentTurn(sessionKey, userPlainText, turnId) {
|
|
299
|
-
await this.userContext.afterTurn(sessionKey, userPlainText);
|
|
300
296
|
if (!this.isUserContextEnabledForSession(sessionKey)) return void 0;
|
|
301
297
|
const parsed = parseSessionKey(sessionKey);
|
|
302
298
|
if (parsed && parsed.peerKind !== "direct") return void 0;
|
|
303
299
|
const instance = this.agents.get(sessionKey);
|
|
304
300
|
if (!instance) return void 0;
|
|
305
|
-
return
|
|
301
|
+
return runTurnUserModelCapture({
|
|
306
302
|
sessionKey,
|
|
307
303
|
turnId,
|
|
308
304
|
userText: userPlainText,
|
|
309
305
|
mainAgent: instance.agent,
|
|
310
|
-
|
|
306
|
+
workspaceId: this.getResolvedWorkspaceForSession(sessionKey),
|
|
311
307
|
getConfig: () => this.mergedConfig()
|
|
312
308
|
});
|
|
313
309
|
}
|
|
@@ -319,10 +315,7 @@ var AgentManager = class {
|
|
|
319
315
|
if (!this.agents.get(sessionKey) || !this.isUserContextEnabledForSession(sessionKey)) return;
|
|
320
316
|
this.backgroundReview.beginUserTurn(sessionKey);
|
|
321
317
|
}
|
|
322
|
-
/**
|
|
323
|
-
* After a successful main turn (after memory sync via `afterAgentTurn`), may run a quiet follow-up for memory/skills.
|
|
324
|
-
* Delegates to {@link BackgroundReviewCoordinator}.
|
|
325
|
-
*/
|
|
318
|
+
/** After a successful main turn, may run a quiet follow-up for context review and skills. */
|
|
326
319
|
scheduleBackgroundReviewAfterUserTurn(sessionKey) {
|
|
327
320
|
const inst = this.agents.get(sessionKey);
|
|
328
321
|
if (!inst || !this.isUserContextEnabledForSession(sessionKey)) return;
|
|
@@ -330,7 +323,7 @@ var AgentManager = class {
|
|
|
330
323
|
sessionKey,
|
|
331
324
|
agent: inst.agent,
|
|
332
325
|
lastAssistantText: this.getLastAssistantContent(sessionKey),
|
|
333
|
-
|
|
326
|
+
workspaceId: this.getResolvedWorkspaceForSession(sessionKey)
|
|
334
327
|
});
|
|
335
328
|
}
|
|
336
329
|
/**
|
|
@@ -406,7 +399,7 @@ var AgentManager = class {
|
|
|
406
399
|
const modelRef = instance.effectiveProfile.primaryModelRef?.trim() || this.defaultModel;
|
|
407
400
|
const thinkingLevel = instance.agent.state.thinkingLevel ?? this.config.thinkingLevel ?? "medium";
|
|
408
401
|
return rt.systemPromptBuilder.build(contextFiles, {
|
|
409
|
-
externalMemoryInstructions:
|
|
402
|
+
externalMemoryInstructions: this.buildExternalMemoryInstructions(instance.sessionKey, rt),
|
|
410
403
|
workspaceOverride: resolvedWorkspacePath,
|
|
411
404
|
profileMarkdownPathRoot: resolveAgentProfileDir(cfg, instance.effectiveProfile.agentId),
|
|
412
405
|
customInstructions: instance.effectiveProfile.customInstructions,
|
|
@@ -612,9 +605,9 @@ var AgentManager = class {
|
|
|
612
605
|
const resolvedWorkspacePath = this.getResolvedWorkspaceForSession(instance.sessionKey);
|
|
613
606
|
const rt = this.workspaceRuntimes.getOrCreate(resolvedWorkspacePath, instance.effectiveProfile.agentId);
|
|
614
607
|
const contextFiles = this.resolveContextFilesForSession(instance.sessionKey, instance.effectiveProfile);
|
|
615
|
-
instance.activeProjectContext =
|
|
608
|
+
instance.activeProjectContext = this.buildExecutionScopeContext(instance.sessionKey);
|
|
616
609
|
const newPrompt = rt.systemPromptBuilder.build(contextFiles, {
|
|
617
|
-
externalMemoryInstructions:
|
|
610
|
+
externalMemoryInstructions: this.buildExternalMemoryInstructions(instance.sessionKey, rt),
|
|
618
611
|
workspaceOverride: resolvedWorkspacePath,
|
|
619
612
|
profileMarkdownPathRoot: resolveAgentProfileDir(cfg, instance.effectiveProfile.agentId),
|
|
620
613
|
customInstructions: instance.effectiveProfile.customInstructions,
|
|
@@ -687,9 +680,9 @@ var AgentManager = class {
|
|
|
687
680
|
const resolvedWorkspacePath = this.getResolvedWorkspaceForSession(instance.sessionKey);
|
|
688
681
|
const rt = this.workspaceRuntimes.getOrCreate(resolvedWorkspacePath, instance.effectiveProfile.agentId);
|
|
689
682
|
const contextFiles = this.resolveContextFilesForSession(instance.sessionKey, instance.effectiveProfile);
|
|
690
|
-
instance.activeProjectContext =
|
|
683
|
+
instance.activeProjectContext = this.buildExecutionScopeContext(instance.sessionKey);
|
|
691
684
|
const newPrompt = rt.systemPromptBuilder.rebuild(contextFiles, {
|
|
692
|
-
externalMemoryInstructions:
|
|
685
|
+
externalMemoryInstructions: this.buildExternalMemoryInstructions(instance.sessionKey, rt),
|
|
693
686
|
workspaceOverride: resolvedWorkspacePath,
|
|
694
687
|
profileMarkdownPathRoot: resolveAgentProfileDir(cfg, instance.effectiveProfile.agentId),
|
|
695
688
|
customInstructions: instance.effectiveProfile.customInstructions,
|
|
@@ -714,7 +707,7 @@ var AgentManager = class {
|
|
|
714
707
|
const existing = this.agents.get(sessionKey);
|
|
715
708
|
if (existing) if (existing.resolvedWorkspacePath !== targetPath) this.removeAgent(sessionKey);
|
|
716
709
|
else {
|
|
717
|
-
this.
|
|
710
|
+
this.refreshDynamicContextIfChanged(existing);
|
|
718
711
|
existing.lastUsedAt = Date.now();
|
|
719
712
|
log.debug({ sessionKey }, "Reusing existing agent instance");
|
|
720
713
|
return existing.agent;
|
|
@@ -730,7 +723,7 @@ var AgentManager = class {
|
|
|
730
723
|
err,
|
|
731
724
|
sessionKey
|
|
732
725
|
}, "memory initializeAll failed"));
|
|
733
|
-
const activeProjectContext =
|
|
726
|
+
const activeProjectContext = this.buildExecutionScopeContext(sessionKey);
|
|
734
727
|
const profileModelRef = profile.primaryModelRef?.trim() || this.defaultModel;
|
|
735
728
|
const modelManager = this.config.getModelManager?.();
|
|
736
729
|
const initialModelRef = modelManager?.resolveInitialModelForSession(sessionKey, profileModelRef, profile.fallbacks) ?? profileModelRef;
|
|
@@ -752,6 +745,8 @@ var AgentManager = class {
|
|
|
752
745
|
registeredToolNames,
|
|
753
746
|
activeCapabilities: /* @__PURE__ */ new Map(),
|
|
754
747
|
activeProjectContext,
|
|
748
|
+
interactionStateVersion: this.getInteractionStateVersion(sessionKey),
|
|
749
|
+
userContextAccessVersion: this.getUserContextAccessVersion(sessionKey),
|
|
755
750
|
skillEnvPassthroughKeys: /* @__PURE__ */ new Set()
|
|
756
751
|
});
|
|
757
752
|
log.debug({
|
|
@@ -792,7 +787,7 @@ var AgentManager = class {
|
|
|
792
787
|
instance.agent.abort();
|
|
793
788
|
evictEmbeddedSessionRunner(sessionKey, "agent_removed");
|
|
794
789
|
this.agents.delete(sessionKey);
|
|
795
|
-
this.
|
|
790
|
+
this.executionContext.forgetSession(sessionKey);
|
|
796
791
|
clearBootstrapSnapshot(sessionKey);
|
|
797
792
|
this.config.getModelManager?.().clearSessionProfileDefault(sessionKey);
|
|
798
793
|
log.info({
|
|
@@ -829,9 +824,9 @@ var AgentManager = class {
|
|
|
829
824
|
const contextFiles = this.resolveContextFilesForSession(sessionKey, instance.effectiveProfile);
|
|
830
825
|
const modelRef = instance.effectiveProfile.primaryModelRef?.trim() || this.defaultModel;
|
|
831
826
|
const thinkingLevel = this.config.thinkingLevel ?? "medium";
|
|
832
|
-
const activeProjectContext =
|
|
827
|
+
const activeProjectContext = this.buildExecutionScopeContext(sessionKey);
|
|
833
828
|
instance.agent.state.systemPrompt = rt.systemPromptBuilder.build(contextFiles, {
|
|
834
|
-
externalMemoryInstructions:
|
|
829
|
+
externalMemoryInstructions: this.buildExternalMemoryInstructions(sessionKey, rt),
|
|
835
830
|
workspaceOverride: resolvedWorkspacePath,
|
|
836
831
|
profileMarkdownPathRoot: resolveAgentProfileDir(cfg, instance.effectiveProfile.agentId),
|
|
837
832
|
customInstructions: instance.effectiveProfile.customInstructions,
|
|
@@ -872,7 +867,7 @@ var AgentManager = class {
|
|
|
872
867
|
for (const instance of this.agents.values()) instance.agent.abort();
|
|
873
868
|
this.agents.clear();
|
|
874
869
|
this.runtimeListeners.clear();
|
|
875
|
-
this.
|
|
870
|
+
this.executionContext.clear();
|
|
876
871
|
this.sessionWorkspaceOverrides.clear();
|
|
877
872
|
this.workspaceRuntimes.clearAll();
|
|
878
873
|
log.debug("All agent instances disposed");
|
|
@@ -907,6 +902,22 @@ var AgentManager = class {
|
|
|
907
902
|
composeDynamicProjectContext(...sections) {
|
|
908
903
|
return sections.map((section) => section?.trim()).filter((section) => Boolean(section)).join("\n\n") || void 0;
|
|
909
904
|
}
|
|
905
|
+
buildExecutionScopeContext(sessionKey) {
|
|
906
|
+
const access = resolveUserContextSessionAccess(this.config.config, sessionKey);
|
|
907
|
+
return buildExecutionScopeContextForPrompt(sessionKey, {
|
|
908
|
+
includeKnowledge: access.knowledge,
|
|
909
|
+
knowledgeSources: access.knowledgeSources
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
getInteractionStateVersion(sessionKey) {
|
|
913
|
+
return isXopcDatabaseOpen() ? getInteractionState(sessionKey)?.updatedAt : void 0;
|
|
914
|
+
}
|
|
915
|
+
getUserContextAccessVersion(sessionKey) {
|
|
916
|
+
return JSON.stringify(resolveUserContextSessionAccess(this.config.config, sessionKey));
|
|
917
|
+
}
|
|
918
|
+
buildExternalMemoryInstructions(sessionKey, rt) {
|
|
919
|
+
return resolveUserContextSessionAccess(this.config.config, sessionKey).knowledge ? rt.memoryManager.buildExternalSystemPrompt() : "";
|
|
920
|
+
}
|
|
910
921
|
getCapabilityCatalogForSession(sessionKey) {
|
|
911
922
|
const inst = sessionKey?.trim() ? this.agents.get(sessionKey.trim()) : void 0;
|
|
912
923
|
return this.resolveCapabilityCatalogForInstance(inst);
|
|
@@ -919,6 +930,7 @@ var AgentManager = class {
|
|
|
919
930
|
workspace: resolvedWorkspacePath,
|
|
920
931
|
profileMarkdownRoot: resolveAgentProfileDir(this.config.config, profile.agentId),
|
|
921
932
|
agentId: profile.agentId,
|
|
933
|
+
sessionKey,
|
|
922
934
|
disabledTools: profile.tools.denied,
|
|
923
935
|
getPrimaryModel: () => agent?.state.model ?? model,
|
|
924
936
|
getMemoryManager: () => rt.memoryManager,
|
|
@@ -930,7 +942,7 @@ var AgentManager = class {
|
|
|
930
942
|
agent = new Agent({
|
|
931
943
|
initialState: {
|
|
932
944
|
systemPrompt: rt.systemPromptBuilder.build(contextFiles, {
|
|
933
|
-
externalMemoryInstructions:
|
|
945
|
+
externalMemoryInstructions: this.buildExternalMemoryInstructions(sessionKey, rt),
|
|
934
946
|
workspaceOverride: resolvedWorkspacePath,
|
|
935
947
|
profileMarkdownPathRoot: resolveAgentProfileDir(this.config.config, profile.agentId),
|
|
936
948
|
customInstructions: profile.customInstructions,
|
|
@@ -976,6 +988,23 @@ var AgentManager = class {
|
|
|
976
988
|
},
|
|
977
989
|
authorizeToolCall: async ({ toolCall, args }) => {
|
|
978
990
|
const toolName = toolCall.name;
|
|
991
|
+
const operation = {
|
|
992
|
+
message: "external_send",
|
|
993
|
+
send_media: "external_send",
|
|
994
|
+
exec_command: "command_execute",
|
|
995
|
+
write_file: "filesystem_write",
|
|
996
|
+
apply_patch: "filesystem_write",
|
|
997
|
+
xopc_tool_execute: "external_tool"
|
|
998
|
+
}[toolName] ?? toolName;
|
|
999
|
+
const executionGate = this.executionContext.getCurrent(sessionKey);
|
|
1000
|
+
if (executionGate) {
|
|
1001
|
+
const decision = evaluateToolGate(executionGate, operation);
|
|
1002
|
+
if (!decision.allowed) return {
|
|
1003
|
+
block: true,
|
|
1004
|
+
terminate: true,
|
|
1005
|
+
reason: decision.reason ?? "Blocked by collaboration rule."
|
|
1006
|
+
};
|
|
1007
|
+
}
|
|
979
1008
|
const policy = this.resolveToolPolicy(profile, toolName, args);
|
|
980
1009
|
const detail = JSON.stringify(args ?? {});
|
|
981
1010
|
if (policy?.mode === "ask") {
|
|
@@ -1039,14 +1068,17 @@ var AgentManager = class {
|
|
|
1039
1068
|
const request = this.config.gatewayClarify?.requestClarification;
|
|
1040
1069
|
if (!request) return false;
|
|
1041
1070
|
return await request(sessionKey, {
|
|
1071
|
+
kind: "approval",
|
|
1042
1072
|
question: `Allow ${toolName} to run once?\n${detail.slice(0, 500)}`,
|
|
1043
1073
|
choices: ["Allow once", "Deny"],
|
|
1044
1074
|
default: "Deny"
|
|
1045
1075
|
}).catch(() => "Deny") === "Allow once";
|
|
1046
1076
|
}
|
|
1047
|
-
|
|
1048
|
-
const nextProjectContext =
|
|
1049
|
-
|
|
1077
|
+
refreshDynamicContextIfChanged(instance) {
|
|
1078
|
+
const nextProjectContext = this.buildExecutionScopeContext(instance.sessionKey);
|
|
1079
|
+
const interactionStateVersion = this.getInteractionStateVersion(instance.sessionKey);
|
|
1080
|
+
const userContextAccessVersion = this.getUserContextAccessVersion(instance.sessionKey);
|
|
1081
|
+
if (nextProjectContext === instance.activeProjectContext && interactionStateVersion === instance.interactionStateVersion && userContextAccessVersion === instance.userContextAccessVersion) return;
|
|
1050
1082
|
const cfg = this.config.config;
|
|
1051
1083
|
const resolvedWorkspacePath = this.getResolvedWorkspaceForSession(instance.sessionKey);
|
|
1052
1084
|
const rt = this.workspaceRuntimes.getOrCreate(resolvedWorkspacePath, instance.effectiveProfile.agentId);
|
|
@@ -1054,7 +1086,7 @@ var AgentManager = class {
|
|
|
1054
1086
|
const modelRef = instance.effectiveProfile.primaryModelRef?.trim() || this.defaultModel;
|
|
1055
1087
|
const thinkingLevel = instance.agent.state.thinkingLevel ?? this.config.thinkingLevel ?? "medium";
|
|
1056
1088
|
instance.agent.state.systemPrompt = rt.systemPromptBuilder.build(contextFiles, {
|
|
1057
|
-
externalMemoryInstructions:
|
|
1089
|
+
externalMemoryInstructions: this.buildExternalMemoryInstructions(instance.sessionKey, rt),
|
|
1058
1090
|
workspaceOverride: resolvedWorkspacePath,
|
|
1059
1091
|
profileMarkdownPathRoot: resolveAgentProfileDir(cfg, instance.effectiveProfile.agentId),
|
|
1060
1092
|
customInstructions: instance.effectiveProfile.customInstructions,
|
|
@@ -1067,6 +1099,8 @@ var AgentManager = class {
|
|
|
1067
1099
|
activeProjectContext: nextProjectContext
|
|
1068
1100
|
});
|
|
1069
1101
|
instance.activeProjectContext = nextProjectContext;
|
|
1102
|
+
instance.interactionStateVersion = interactionStateVersion;
|
|
1103
|
+
instance.userContextAccessVersion = userContextAccessVersion;
|
|
1070
1104
|
log.debug({ sessionKey: instance.sessionKey }, "Dynamic agent context changed; system prompt refreshed");
|
|
1071
1105
|
}
|
|
1072
1106
|
/**
|
|
@@ -1090,9 +1124,9 @@ var AgentManager = class {
|
|
|
1090
1124
|
const rt = this.workspaceRuntimes.getOrCreate(resolvedWorkspacePath, instance.effectiveProfile.agentId);
|
|
1091
1125
|
const contextFiles = this.resolveContextFilesForSession(sessionKey, instance.effectiveProfile);
|
|
1092
1126
|
const thinkingLevel = instance.agent.state.thinkingLevel ?? this.config.thinkingLevel ?? "medium";
|
|
1093
|
-
const activeProjectContext =
|
|
1127
|
+
const activeProjectContext = this.buildExecutionScopeContext(sessionKey);
|
|
1094
1128
|
instance.agent.state.systemPrompt = rt.systemPromptBuilder.build(contextFiles, {
|
|
1095
|
-
externalMemoryInstructions:
|
|
1129
|
+
externalMemoryInstructions: this.buildExternalMemoryInstructions(sessionKey, rt),
|
|
1096
1130
|
workspaceOverride: resolvedWorkspacePath,
|
|
1097
1131
|
profileMarkdownPathRoot: resolveAgentProfileDir(cfg, instance.effectiveProfile.agentId),
|
|
1098
1132
|
customInstructions: instance.effectiveProfile.customInstructions,
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import type { Agent } from '@earendil-works/pi-agent-core';
|
|
12
12
|
import type { Config } from '../../config/schema.js';
|
|
13
|
-
import type { WorkspaceRuntime } from '../workspace-runtime/registry.js';
|
|
14
13
|
export interface BackgroundReviewCoordinatorOptions {
|
|
15
14
|
/** Effective config snapshot used to look up review-cadence settings. */
|
|
16
15
|
getConfig: () => Config | undefined;
|
|
@@ -20,7 +19,7 @@ export interface ScheduleReviewContext {
|
|
|
20
19
|
agent: Agent;
|
|
21
20
|
/** Last assistant text — review is skipped when empty. */
|
|
22
21
|
lastAssistantText: string | null;
|
|
23
|
-
|
|
22
|
+
workspaceId: string;
|
|
24
23
|
}
|
|
25
24
|
export declare class BackgroundReviewCoordinator {
|
|
26
25
|
private readonly opts;
|
|
@@ -34,7 +33,7 @@ export declare class BackgroundReviewCoordinator {
|
|
|
34
33
|
/**
|
|
35
34
|
* Fire-and-forget review after the main user turn. Decides whether to run a
|
|
36
35
|
* understanding sweep based on the counter state + last assistant text,
|
|
37
|
-
* and delegates the actual review to {@link
|
|
36
|
+
* and delegates the actual review to {@link runBackgroundUserModelReview}.
|
|
38
37
|
*/
|
|
39
38
|
scheduleAfterUserTurn(ctx: ScheduleReviewContext): void;
|
|
40
39
|
/** Tear down state for a session (called by `AgentManager.removeAgent`). */
|
|
@@ -42,6 +41,5 @@ export declare class BackgroundReviewCoordinator {
|
|
|
42
41
|
/** Clear every counter (`AgentManager.dispose` / hot reload). */
|
|
43
42
|
clear(): void;
|
|
44
43
|
private ensureState;
|
|
45
|
-
private resolveReviewInterval;
|
|
46
44
|
private runReviewIfNeeded;
|
|
47
45
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { summarizeUserUnderstandingQuality } from "../../storage/sqlite/user-context-quality-repository.js";
|
|
4
|
-
import "../../storage/sqlite/index.js";
|
|
5
3
|
import { isAssistantTurnAborted, isAssistantTurnFailed } from "../orchestration/llm-turn-retry.js";
|
|
6
|
-
import { resolveAdaptiveUnderstandingCadence } from "../memory/understanding/quality.js";
|
|
7
4
|
import { resolveBackgroundReviewSettings } from "./settings.js";
|
|
8
|
-
import {
|
|
5
|
+
import { runBackgroundUserModelReview } from "./run-background-review.js";
|
|
9
6
|
//#region src/agent/background-review/coordinator.ts
|
|
10
7
|
init_logger();
|
|
11
8
|
const log = createLogger("BackgroundReviewCoordinator");
|
|
@@ -23,7 +20,7 @@ var BackgroundReviewCoordinator = class {
|
|
|
23
20
|
const cfg = resolveBackgroundReviewSettings(this.opts.getConfig());
|
|
24
21
|
if (!cfg.enabled) return;
|
|
25
22
|
const state = this.ensureState(sessionKey);
|
|
26
|
-
const intervalTurns =
|
|
23
|
+
const intervalTurns = cfg.reviewIntervalTurns;
|
|
27
24
|
state.turnsSinceReview += 1;
|
|
28
25
|
if (state.turnsSinceReview >= intervalTurns) {
|
|
29
26
|
state.pendingReview = true;
|
|
@@ -33,7 +30,7 @@ var BackgroundReviewCoordinator = class {
|
|
|
33
30
|
/**
|
|
34
31
|
* Fire-and-forget review after the main user turn. Decides whether to run a
|
|
35
32
|
* understanding sweep based on the counter state + last assistant text,
|
|
36
|
-
* and delegates the actual review to {@link
|
|
33
|
+
* and delegates the actual review to {@link runBackgroundUserModelReview}.
|
|
37
34
|
*/
|
|
38
35
|
scheduleAfterUserTurn(ctx) {
|
|
39
36
|
this.runReviewIfNeeded(ctx).catch((err) => {
|
|
@@ -61,28 +58,6 @@ var BackgroundReviewCoordinator = class {
|
|
|
61
58
|
this.states.set(sessionKey, state);
|
|
62
59
|
return state;
|
|
63
60
|
}
|
|
64
|
-
resolveReviewInterval(settings, state) {
|
|
65
|
-
if (!settings.adaptiveCadence) return settings.reviewIntervalTurns;
|
|
66
|
-
const now = Date.now();
|
|
67
|
-
if (state.adaptiveIntervalTurns != null && (state.adaptiveIntervalExpiresAt ?? 0) > now) return state.adaptiveIntervalTurns;
|
|
68
|
-
try {
|
|
69
|
-
const metrics = summarizeUserUnderstandingQuality({
|
|
70
|
-
windowDays: 30,
|
|
71
|
-
nowMs: now
|
|
72
|
-
});
|
|
73
|
-
const decision = resolveAdaptiveUnderstandingCadence(settings.reviewIntervalTurns, metrics);
|
|
74
|
-
state.adaptiveIntervalTurns = decision.effectiveIntervalTurns;
|
|
75
|
-
state.adaptiveIntervalExpiresAt = now + 5 * 6e4;
|
|
76
|
-
if (decision.slowed) log.debug({
|
|
77
|
-
baseIntervalTurns: decision.baseIntervalTurns,
|
|
78
|
-
effectiveIntervalTurns: decision.effectiveIntervalTurns,
|
|
79
|
-
reasons: decision.reasons
|
|
80
|
-
}, "User-understanding review cadence slowed by quality signals");
|
|
81
|
-
return decision.effectiveIntervalTurns;
|
|
82
|
-
} catch {
|
|
83
|
-
return settings.reviewIntervalTurns;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
61
|
async runReviewIfNeeded(ctx) {
|
|
87
62
|
const state = this.states.get(ctx.sessionKey);
|
|
88
63
|
if (!state) return;
|
|
@@ -93,11 +68,11 @@ var BackgroundReviewCoordinator = class {
|
|
|
93
68
|
const shouldReview = state.pendingReview;
|
|
94
69
|
state.pendingReview = false;
|
|
95
70
|
if (!shouldReview) return;
|
|
96
|
-
await
|
|
71
|
+
await runBackgroundUserModelReview({
|
|
97
72
|
sessionKey: ctx.sessionKey,
|
|
98
73
|
mainAgent: ctx.agent,
|
|
99
74
|
settings,
|
|
100
|
-
|
|
75
|
+
workspaceId: ctx.workspaceId,
|
|
101
76
|
getConfig: () => this.opts.getConfig()
|
|
102
77
|
});
|
|
103
78
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare function
|
|
1
|
+
export declare const USER_MODEL_INTERPRETER_SYSTEM_PROMPT = "You are xopc's user-model interpreter. You do not chat with the user and cannot write storage. Distinguish explicit memory commands, corrections, forgetting, durable user assertions, durable goals, collaboration rules, and ordinary task requests. Return strict JSON only. Assistant text is never evidence about the user.";
|
|
2
|
+
export declare function buildUserModelInterpreterPrompt(options: {
|
|
3
3
|
mode: 'turn' | 'transcript';
|
|
4
|
+
evidenceTimestamp: string;
|
|
5
|
+
timezone: string;
|
|
4
6
|
availableTargets?: Array<{
|
|
5
7
|
id: string;
|
|
6
8
|
statement: string;
|