@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
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
ALTER TABLE proactive_scenarios
|
|
2
|
+
ADD COLUMN context_provider_ids_json TEXT NOT NULL DEFAULT '["event_batch"]';
|
|
3
|
+
ALTER TABLE proactive_scenarios
|
|
4
|
+
ADD COLUMN min_confidence REAL NOT NULL DEFAULT 0.65
|
|
5
|
+
CHECK (min_confidence >= 0 AND min_confidence <= 1);
|
|
6
|
+
ALTER TABLE proactive_scenarios
|
|
7
|
+
ADD COLUMN min_value_score REAL NOT NULL DEFAULT 0.6
|
|
8
|
+
CHECK (min_value_score >= 0 AND min_value_score <= 1);
|
|
9
|
+
ALTER TABLE proactive_scenarios
|
|
10
|
+
ADD COLUMN cooldown_seconds INTEGER NOT NULL DEFAULT 604800
|
|
11
|
+
CHECK (cooldown_seconds >= 0);
|
|
12
|
+
ALTER TABLE proactive_scenarios
|
|
13
|
+
ADD COLUMN max_runs_per_day INTEGER NOT NULL DEFAULT 30
|
|
14
|
+
CHECK (max_runs_per_day > 0);
|
|
15
|
+
|
|
16
|
+
UPDATE proactive_scenarios
|
|
17
|
+
SET context_provider_ids_json = '["event_batch","connected_source","internal_objects","user_model","project_state"]'
|
|
18
|
+
WHERE scenario_key IN ('project_delivery_risk', 'blocked_work');
|
|
19
|
+
|
|
20
|
+
UPDATE proactive_scenarios
|
|
21
|
+
SET context_provider_ids_json = '["event_batch","user_model","automation_state","project_state"]',
|
|
22
|
+
cooldown_seconds = 86400,
|
|
23
|
+
max_runs_per_day = 20
|
|
24
|
+
WHERE scenario_key = 'automation_failure_impact';
|
|
25
|
+
|
|
26
|
+
UPDATE proactive_scenarios
|
|
27
|
+
SET context_provider_ids_json = '["event_batch","connected_source","user_model","meeting_workspace"]',
|
|
28
|
+
cooldown_seconds = 86400,
|
|
29
|
+
max_runs_per_day = 20
|
|
30
|
+
WHERE scenario_key = 'meeting_preparation';
|
|
31
|
+
|
|
32
|
+
UPDATE proactive_scenarios
|
|
33
|
+
SET context_provider_ids_json = '["event_batch","user_model","discussion"]',
|
|
34
|
+
cooldown_seconds = 86400,
|
|
35
|
+
max_runs_per_day = 20
|
|
36
|
+
WHERE scenario_key = 'discussion_follow_up';
|
|
37
|
+
|
|
38
|
+
CREATE TABLE proactive_scenario_versions (
|
|
39
|
+
scenario_key TEXT NOT NULL,
|
|
40
|
+
version INTEGER NOT NULL CHECK (version > 0),
|
|
41
|
+
title TEXT NOT NULL,
|
|
42
|
+
description TEXT NOT NULL,
|
|
43
|
+
base_prompt TEXT NOT NULL,
|
|
44
|
+
base_template_version INTEGER NOT NULL CHECK (base_template_version > 0),
|
|
45
|
+
event_types_json TEXT NOT NULL,
|
|
46
|
+
condition_json TEXT,
|
|
47
|
+
aggregation TEXT NOT NULL CHECK (aggregation IN ('subject', 'project', 'workspace')),
|
|
48
|
+
debounce_seconds INTEGER NOT NULL CHECK (debounce_seconds >= 0),
|
|
49
|
+
max_window_seconds INTEGER NOT NULL CHECK (max_window_seconds > 0),
|
|
50
|
+
context_provider_ids_json TEXT NOT NULL,
|
|
51
|
+
min_confidence REAL NOT NULL CHECK (min_confidence >= 0 AND min_confidence <= 1),
|
|
52
|
+
min_value_score REAL NOT NULL CHECK (min_value_score >= 0 AND min_value_score <= 1),
|
|
53
|
+
cooldown_seconds INTEGER NOT NULL CHECK (cooldown_seconds >= 0),
|
|
54
|
+
max_runs_per_day INTEGER NOT NULL CHECK (max_runs_per_day > 0),
|
|
55
|
+
created_at TEXT NOT NULL,
|
|
56
|
+
PRIMARY KEY (scenario_key, version),
|
|
57
|
+
FOREIGN KEY (scenario_key) REFERENCES proactive_scenarios(scenario_key) ON DELETE CASCADE
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
INSERT INTO proactive_scenario_versions (
|
|
61
|
+
scenario_key, version, title, description, base_prompt, base_template_version,
|
|
62
|
+
event_types_json, condition_json, aggregation, debounce_seconds,
|
|
63
|
+
max_window_seconds, context_provider_ids_json, min_confidence,
|
|
64
|
+
min_value_score, cooldown_seconds, max_runs_per_day, created_at
|
|
65
|
+
)
|
|
66
|
+
SELECT
|
|
67
|
+
scenario_key, version, title, description, base_prompt, base_template_version,
|
|
68
|
+
event_types_json, condition_json, aggregation, debounce_seconds,
|
|
69
|
+
max_window_seconds, context_provider_ids_json, min_confidence,
|
|
70
|
+
min_value_score, cooldown_seconds, max_runs_per_day, updated_at
|
|
71
|
+
FROM proactive_scenarios;
|
|
72
|
+
|
|
73
|
+
CREATE TRIGGER proactive_scenario_version_after_insert
|
|
74
|
+
AFTER INSERT ON proactive_scenarios
|
|
75
|
+
BEGIN
|
|
76
|
+
INSERT INTO proactive_scenario_versions (
|
|
77
|
+
scenario_key, version, title, description, base_prompt, base_template_version,
|
|
78
|
+
event_types_json, condition_json, aggregation, debounce_seconds,
|
|
79
|
+
max_window_seconds, context_provider_ids_json, min_confidence,
|
|
80
|
+
min_value_score, cooldown_seconds, max_runs_per_day, created_at
|
|
81
|
+
) VALUES (
|
|
82
|
+
NEW.scenario_key, NEW.version, NEW.title, NEW.description, NEW.base_prompt,
|
|
83
|
+
NEW.base_template_version, NEW.event_types_json, NEW.condition_json,
|
|
84
|
+
NEW.aggregation, NEW.debounce_seconds, NEW.max_window_seconds,
|
|
85
|
+
NEW.context_provider_ids_json, NEW.min_confidence, NEW.min_value_score,
|
|
86
|
+
NEW.cooldown_seconds, NEW.max_runs_per_day, NEW.updated_at
|
|
87
|
+
);
|
|
88
|
+
END;
|
|
89
|
+
|
|
90
|
+
CREATE TRIGGER proactive_scenario_contract_update_guard
|
|
91
|
+
BEFORE UPDATE ON proactive_scenarios
|
|
92
|
+
WHEN NEW.version = OLD.version AND (
|
|
93
|
+
NEW.title IS NOT OLD.title
|
|
94
|
+
OR NEW.description IS NOT OLD.description
|
|
95
|
+
OR NEW.base_prompt IS NOT OLD.base_prompt
|
|
96
|
+
OR NEW.base_template_version IS NOT OLD.base_template_version
|
|
97
|
+
OR NEW.event_types_json IS NOT OLD.event_types_json
|
|
98
|
+
OR NEW.condition_json IS NOT OLD.condition_json
|
|
99
|
+
OR NEW.aggregation IS NOT OLD.aggregation
|
|
100
|
+
OR NEW.debounce_seconds IS NOT OLD.debounce_seconds
|
|
101
|
+
OR NEW.max_window_seconds IS NOT OLD.max_window_seconds
|
|
102
|
+
OR NEW.context_provider_ids_json IS NOT OLD.context_provider_ids_json
|
|
103
|
+
OR NEW.min_confidence IS NOT OLD.min_confidence
|
|
104
|
+
OR NEW.min_value_score IS NOT OLD.min_value_score
|
|
105
|
+
OR NEW.cooldown_seconds IS NOT OLD.cooldown_seconds
|
|
106
|
+
OR NEW.max_runs_per_day IS NOT OLD.max_runs_per_day
|
|
107
|
+
)
|
|
108
|
+
BEGIN
|
|
109
|
+
SELECT RAISE(ABORT, 'proactive scenario contract changes require a new version');
|
|
110
|
+
END;
|
|
111
|
+
|
|
112
|
+
CREATE TRIGGER proactive_scenario_version_after_update
|
|
113
|
+
AFTER UPDATE OF version ON proactive_scenarios
|
|
114
|
+
WHEN NEW.version <> OLD.version
|
|
115
|
+
BEGIN
|
|
116
|
+
INSERT INTO proactive_scenario_versions (
|
|
117
|
+
scenario_key, version, title, description, base_prompt, base_template_version,
|
|
118
|
+
event_types_json, condition_json, aggregation, debounce_seconds,
|
|
119
|
+
max_window_seconds, context_provider_ids_json, min_confidence,
|
|
120
|
+
min_value_score, cooldown_seconds, max_runs_per_day, created_at
|
|
121
|
+
) VALUES (
|
|
122
|
+
NEW.scenario_key, NEW.version, NEW.title, NEW.description, NEW.base_prompt,
|
|
123
|
+
NEW.base_template_version, NEW.event_types_json, NEW.condition_json,
|
|
124
|
+
NEW.aggregation, NEW.debounce_seconds, NEW.max_window_seconds,
|
|
125
|
+
NEW.context_provider_ids_json, NEW.min_confidence, NEW.min_value_score,
|
|
126
|
+
NEW.cooldown_seconds, NEW.max_runs_per_day, NEW.updated_at
|
|
127
|
+
);
|
|
128
|
+
END;
|
|
129
|
+
|
|
130
|
+
CREATE TRIGGER proactive_scenario_versions_immutable_update
|
|
131
|
+
BEFORE UPDATE ON proactive_scenario_versions
|
|
132
|
+
BEGIN
|
|
133
|
+
SELECT RAISE(ABORT, 'proactive scenario versions are immutable');
|
|
134
|
+
END;
|
|
135
|
+
|
|
136
|
+
CREATE TRIGGER proactive_scenario_versions_immutable_delete
|
|
137
|
+
BEFORE DELETE ON proactive_scenario_versions
|
|
138
|
+
BEGIN
|
|
139
|
+
SELECT RAISE(ABORT, 'proactive scenario versions are immutable');
|
|
140
|
+
END;
|
|
@@ -3,7 +3,7 @@ import type { ApplyMigrationsOptions } from './types.js';
|
|
|
3
3
|
/** Baseline schema version applied from schema.sql on first open. */
|
|
4
4
|
export declare const XOPC_DB_BASELINE_SCHEMA_VERSION = 11;
|
|
5
5
|
/** Latest schema version this release supports (increment when adding migrations). */
|
|
6
|
-
export declare const XOPC_DB_SCHEMA_VERSION =
|
|
6
|
+
export declare const XOPC_DB_SCHEMA_VERSION = 152;
|
|
7
7
|
export declare function resolveMigrationsDir(override?: string): string;
|
|
8
8
|
/**
|
|
9
9
|
* Apply sequential SQL migrations from (currentVersion + 1) through targetVersion.
|
|
@@ -12,7 +12,7 @@ const log = createLogger("Sqlite:Migrations");
|
|
|
12
12
|
/** Baseline schema version applied from schema.sql on first open. */
|
|
13
13
|
const XOPC_DB_BASELINE_SCHEMA_VERSION = 11;
|
|
14
14
|
/** Latest schema version this release supports (increment when adding migrations). */
|
|
15
|
-
const XOPC_DB_SCHEMA_VERSION =
|
|
15
|
+
const XOPC_DB_SCHEMA_VERSION = 152;
|
|
16
16
|
const MODULE_DIR = dirname(fileURLToPath(import.meta.url));
|
|
17
17
|
function backupBeforeTaskCutover(db, databasePath) {
|
|
18
18
|
db.exec("PRAGMA wal_checkpoint(FULL)");
|
|
@@ -57,7 +57,7 @@ function applySingleMigration(db, migration) {
|
|
|
57
57
|
* Each step runs in its own transaction and updates schema_meta on success.
|
|
58
58
|
*/
|
|
59
59
|
function applyPendingMigrations(db, options = {}) {
|
|
60
|
-
const targetVersion = options.targetVersion ??
|
|
60
|
+
const targetVersion = options.targetVersion ?? 152;
|
|
61
61
|
let currentVersion = readSchemaVersion(db);
|
|
62
62
|
if (currentVersion > targetVersion) throw new DatabaseSchemaTooNewError(currentVersion, targetVersion);
|
|
63
63
|
if (currentVersion >= targetVersion) return currentVersion;
|
|
@@ -94,7 +94,7 @@ function applyPendingMigrations(db, options = {}) {
|
|
|
94
94
|
}
|
|
95
95
|
/** Inspect schema version without mutating the database. */
|
|
96
96
|
function inspectSchemaMigrationStatus(db, options = {}) {
|
|
97
|
-
const appVersion = options.targetVersion ??
|
|
97
|
+
const appVersion = options.targetVersion ?? 152;
|
|
98
98
|
const dbVersion = readSchemaVersion(db);
|
|
99
99
|
if (dbVersion > appVersion) return {
|
|
100
100
|
dbVersion,
|
|
@@ -19,7 +19,7 @@ const log = createLogger('Sqlite:Migrations');
|
|
|
19
19
|
export const XOPC_DB_BASELINE_SCHEMA_VERSION = 11;
|
|
20
20
|
|
|
21
21
|
/** Latest schema version this release supports (increment when adding migrations). */
|
|
22
|
-
export const XOPC_DB_SCHEMA_VERSION =
|
|
22
|
+
export const XOPC_DB_SCHEMA_VERSION = 152;
|
|
23
23
|
|
|
24
24
|
const MODULE_DIR = dirname(fileURLToPath(import.meta.url));
|
|
25
25
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Note, NoteIndexEntry, NotesListQuery } from '../../notes/types.js';
|
|
1
|
+
import type { Note, NoteIndexEntry, NoteProjectSummary, NotesListQuery } from '../../notes/types.js';
|
|
2
2
|
export declare function upsertNoteRecord(note: Note): void;
|
|
3
3
|
export declare function getNoteRecord(noteId: string): Note | null;
|
|
4
4
|
export declare function deleteNoteRecord(noteId: string): boolean;
|
|
@@ -9,3 +9,4 @@ export declare function listNoteRecords(query?: NotesListQuery): {
|
|
|
9
9
|
offset: number;
|
|
10
10
|
hasMore: boolean;
|
|
11
11
|
};
|
|
12
|
+
export declare function listNoteProjectSummaries(): NoteProjectSummary[];
|
|
@@ -41,7 +41,9 @@ function rowToIndexEntry(row) {
|
|
|
41
41
|
headingCount: row.heading_count ?? void 0,
|
|
42
42
|
taskCount: row.task_count ?? void 0,
|
|
43
43
|
uncheckedTaskCount: row.unchecked_task_count ?? void 0,
|
|
44
|
-
linkCount: row.link_count ?? void 0
|
|
44
|
+
linkCount: row.link_count ?? void 0,
|
|
45
|
+
projects: row.projects_json ? JSON.parse(row.projects_json) : [],
|
|
46
|
+
lastEditTrigger: row.last_edit_trigger ?? void 0
|
|
45
47
|
};
|
|
46
48
|
}
|
|
47
49
|
function noteSearchContent(note) {
|
|
@@ -186,11 +188,25 @@ function listNoteRecords(query = {}) {
|
|
|
186
188
|
)`);
|
|
187
189
|
params.push(query.projectId);
|
|
188
190
|
}
|
|
191
|
+
if (query.unassigned) conditions.push(`NOT EXISTS (
|
|
192
|
+
SELECT 1 FROM object_links l JOIN projects p ON p.project_id = l.to_id
|
|
193
|
+
WHERE l.relation = 'belongs_to' AND l.from_kind = 'note'
|
|
194
|
+
AND l.from_id = notes.note_id AND l.to_kind = 'project'
|
|
195
|
+
)`);
|
|
196
|
+
if (query.agentEdited) conditions.push(`json_extract(payload_json, '$.lastEditTrigger') = 'ai_edit'`);
|
|
189
197
|
const where = conditions.length > 0 ? `WHERE ${conditions.join(" AND ")}` : "";
|
|
190
198
|
const rows = db.prepare(`SELECT note_id, title, kind, status, payload_json, created_at, updated_at,
|
|
191
199
|
pinned, tags_json, snippet, cover_attachment_id, voice_attachment_id,
|
|
192
200
|
voice_duration_sec, attachment_names_json, group_id, last_opened_at,
|
|
193
|
-
task_done, task_due_at, heading_count, task_count, unchecked_task_count, link_count
|
|
201
|
+
task_done, task_due_at, heading_count, task_count, unchecked_task_count, link_count,
|
|
202
|
+
json_extract(payload_json, '$.lastEditTrigger') AS last_edit_trigger,
|
|
203
|
+
(SELECT json_group_array(json_object('id', project_id, 'name', name)) FROM (
|
|
204
|
+
SELECT DISTINCT p.project_id, p.name FROM object_links l
|
|
205
|
+
JOIN projects p ON p.project_id = l.to_id
|
|
206
|
+
WHERE l.from_kind = 'note' AND l.from_id = notes.note_id
|
|
207
|
+
AND l.to_kind = 'project' AND l.relation = 'belongs_to'
|
|
208
|
+
ORDER BY p.name, p.project_id
|
|
209
|
+
)) AS projects_json
|
|
194
210
|
FROM notes ${where}`).all(...params);
|
|
195
211
|
let entries = rows.map(rowToIndexEntry);
|
|
196
212
|
if (query.tag) entries = entries.filter((entry) => entry.tags?.includes(query.tag));
|
|
@@ -222,5 +238,23 @@ function listNoteRecords(query = {}) {
|
|
|
222
238
|
hasMore: offset + items.length < total
|
|
223
239
|
};
|
|
224
240
|
}
|
|
241
|
+
function listNoteProjectSummaries() {
|
|
242
|
+
return getSqliteDatabase().prepare(`
|
|
243
|
+
SELECT p.project_id, p.name, p.description,
|
|
244
|
+
COUNT(DISTINCT n.note_id) AS note_count, MAX(n.updated_at) AS note_updated_at
|
|
245
|
+
FROM projects p
|
|
246
|
+
LEFT JOIN object_links l ON l.to_kind = 'project' AND l.to_id = p.project_id
|
|
247
|
+
AND l.from_kind = 'note' AND l.relation = 'belongs_to'
|
|
248
|
+
LEFT JOIN notes n ON n.note_id = l.from_id AND n.status != 'trashed'
|
|
249
|
+
GROUP BY p.project_id
|
|
250
|
+
ORDER BY (p.pinned_at IS NOT NULL) DESC, MAX(n.updated_at) DESC, p.updated_at DESC, p.project_id
|
|
251
|
+
`).all().map((row) => ({
|
|
252
|
+
id: row.project_id,
|
|
253
|
+
name: row.name,
|
|
254
|
+
description: row.description ?? void 0,
|
|
255
|
+
noteCount: row.note_count,
|
|
256
|
+
updatedAt: row.note_updated_at ?? void 0
|
|
257
|
+
}));
|
|
258
|
+
}
|
|
225
259
|
//#endregion
|
|
226
|
-
export { deleteNoteRecord, getNoteRecord, listNoteRecords, upsertNoteRecord };
|
|
260
|
+
export { deleteNoteRecord, getNoteRecord, listNoteProjectSummaries, listNoteRecords, upsertNoteRecord };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "../../session/types.js";
|
|
2
|
-
import { buildDefaultSessionMetadata } from "./session-metadata.js";
|
|
3
1
|
import { isTranscriptContextEntry } from "../../session/session-context-for-llm.js";
|
|
2
|
+
import "../../session/types.js";
|
|
4
3
|
import { init_agent_session_key, resolveAgentIdFromSessionKey } from "../../routing/agent-session-key.js";
|
|
4
|
+
import { buildDefaultSessionMetadata } from "./session-metadata.js";
|
|
5
5
|
//#region src/storage/sqlite/row-mappers.ts
|
|
6
6
|
init_agent_session_key();
|
|
7
7
|
function parseJson(raw) {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { getSqliteDatabase } from './transaction.js';
|
|
1
2
|
import { type TurnOrigin } from '@xopcai/endpoint-tools-protocol';
|
|
2
3
|
import type { AgentSourceContext, SourceContextRefSummary } from '../../agent/source-context/types.js';
|
|
3
4
|
export type SessionInputDelivery = 'next' | 'steer';
|
|
4
|
-
export type SessionInputStatus = 'queued' | 'running' | 'injecting' | 'completed' | 'cancelled' | 'failed' | 'interrupted';
|
|
5
|
+
export type SessionInputStatus = 'queued' | 'running' | 'injecting' | 'completed' | 'cancelled' | 'failed' | 'interrupted' | 'suspended';
|
|
5
6
|
export type SessionInput = {
|
|
6
7
|
id: string;
|
|
7
8
|
sessionKey: string;
|
|
@@ -11,6 +12,13 @@ export type SessionInput = {
|
|
|
11
12
|
effectiveDelivery: SessionInputDelivery;
|
|
12
13
|
status: SessionInputStatus;
|
|
13
14
|
content: string;
|
|
15
|
+
taskRunId?: string;
|
|
16
|
+
kind: 'message' | 'connection_resume';
|
|
17
|
+
payload?: {
|
|
18
|
+
waitId: string;
|
|
19
|
+
objectiveRevision: number;
|
|
20
|
+
resolution: 'continued' | 'skipped';
|
|
21
|
+
};
|
|
14
22
|
attachments?: unknown[];
|
|
15
23
|
contextRefs?: SourceContextRefSummary[];
|
|
16
24
|
contextSnapshots?: AgentSourceContext[];
|
|
@@ -31,6 +39,7 @@ export type SessionInputState = {
|
|
|
31
39
|
activeInputId?: string;
|
|
32
40
|
inputs: SessionInput[];
|
|
33
41
|
};
|
|
42
|
+
export declare function bumpSessionInputRevision(db: ReturnType<typeof getSqliteDatabase>, sessionKey: string): number;
|
|
34
43
|
export declare function getSessionInputState(sessionKey: string): SessionInputState;
|
|
35
44
|
/** Durable active webchat runs claimed by the session-input coordinator. */
|
|
36
45
|
export declare function listActiveSessionInputRuns(): Array<{
|
|
@@ -52,6 +61,9 @@ export declare function insertSessionInput(input: {
|
|
|
52
61
|
status: 'queued' | 'injecting';
|
|
53
62
|
content: string;
|
|
54
63
|
attachments?: unknown[];
|
|
64
|
+
taskRunId?: string;
|
|
65
|
+
kind?: SessionInput['kind'];
|
|
66
|
+
payload?: SessionInput['payload'];
|
|
55
67
|
contextRefs?: SourceContextRefSummary[];
|
|
56
68
|
contextSnapshots?: AgentSourceContext[];
|
|
57
69
|
thinking?: string;
|
|
@@ -59,7 +71,7 @@ export declare function insertSessionInput(input: {
|
|
|
59
71
|
targetRunId?: string;
|
|
60
72
|
}): SessionInput;
|
|
61
73
|
export declare function claimNextSessionInput(sessionKey: string, runId: string): SessionInput | undefined;
|
|
62
|
-
export declare function finishSessionInputRun(sessionKey: string, runId: string, status: 'completed' | 'failed' | 'cancelled', error?: string): boolean;
|
|
74
|
+
export declare function finishSessionInputRun(sessionKey: string, runId: string, status: 'completed' | 'failed' | 'cancelled' | 'suspended', error?: string): boolean;
|
|
63
75
|
export declare function setSessionInputStatus(id: string, status: SessionInputStatus, patch?: {
|
|
64
76
|
effectiveDelivery?: SessionInputDelivery;
|
|
65
77
|
targetRunId?: string | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getSqliteDatabase, runSqliteWriteTransaction } from "./transaction.js";
|
|
2
|
-
import { readCurrentSessionId } from "./session-repository.js";
|
|
2
|
+
import { readCurrentSessionId } from "./session-instance-repository.js";
|
|
3
3
|
import { turnOriginSchema } from "../../../packages/endpoint-tools-protocol/src/index.js";
|
|
4
4
|
//#region src/storage/sqlite/session-input-repository.ts
|
|
5
5
|
function mapInput(row) {
|
|
@@ -12,6 +12,9 @@ function mapInput(row) {
|
|
|
12
12
|
effectiveDelivery: row.effective_delivery,
|
|
13
13
|
status: row.status,
|
|
14
14
|
content: row.content,
|
|
15
|
+
kind: row.kind,
|
|
16
|
+
taskRunId: row.task_run_id ?? void 0,
|
|
17
|
+
payload: row.payload_json ? JSON.parse(row.payload_json) : void 0,
|
|
15
18
|
attachments: row.attachments_json ? JSON.parse(row.attachments_json) : void 0,
|
|
16
19
|
contextRefs: row.context_refs_json ? JSON.parse(row.context_refs_json) : void 0,
|
|
17
20
|
contextSnapshots: row.context_snapshots_json ? JSON.parse(row.context_snapshots_json) : void 0,
|
|
@@ -28,14 +31,14 @@ function mapInput(row) {
|
|
|
28
31
|
}
|
|
29
32
|
const SELECT_INPUTS = `SELECT id, session_key, client_message_id, expected_session_id, requested_delivery,
|
|
30
33
|
effective_delivery, status, content, attachments_json, context_refs_json, context_snapshots_json,
|
|
31
|
-
thinking, origin_json, position,
|
|
34
|
+
thinking, origin_json, position, kind, payload_json, task_run_id,
|
|
32
35
|
target_run_id, run_id, version, error, created_at_ms, updated_at_ms
|
|
33
36
|
FROM session_inputs`;
|
|
34
37
|
function ensureRuntime(db, sessionKey) {
|
|
35
38
|
db.prepare(`INSERT INTO session_input_runtime(session_key, revision, updated_at_ms)
|
|
36
39
|
VALUES (?, 0, ?) ON CONFLICT(session_key) DO NOTHING`).run(sessionKey, Date.now());
|
|
37
40
|
}
|
|
38
|
-
function
|
|
41
|
+
function bumpSessionInputRevision(db, sessionKey) {
|
|
39
42
|
ensureRuntime(db, sessionKey);
|
|
40
43
|
db.prepare(`UPDATE session_input_runtime SET revision = revision + 1, updated_at_ms = ?
|
|
41
44
|
WHERE session_key = ?`).run(Date.now(), sessionKey);
|
|
@@ -52,7 +55,7 @@ function getSessionInputState(sessionKey) {
|
|
|
52
55
|
revision: runtime?.revision ?? 0,
|
|
53
56
|
activeRunId: runtime?.active_run_id ?? void 0,
|
|
54
57
|
activeInputId: runtime?.active_input_id ?? void 0,
|
|
55
|
-
inputs: rows.map((row) => {
|
|
58
|
+
inputs: rows.filter((row) => row.kind === "message").map((row) => {
|
|
56
59
|
const { contextSnapshots: _contextSnapshots, ...input } = mapInput(row);
|
|
57
60
|
return input;
|
|
58
61
|
})
|
|
@@ -90,9 +93,9 @@ function insertSessionInput(input) {
|
|
|
90
93
|
db.prepare(`INSERT INTO session_inputs(id, session_key, client_message_id, expected_session_id,
|
|
91
94
|
requested_delivery, effective_delivery, status, content, attachments_json,
|
|
92
95
|
context_refs_json, context_snapshots_json, thinking, origin_json, position,
|
|
93
|
-
target_run_id, version, created_at_ms, updated_at_ms)
|
|
94
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?)`).run(input.id, input.sessionKey, input.clientMessageId, input.expectedSessionId ?? null, input.requestedDelivery, input.effectiveDelivery, input.status, input.content, input.attachments ? JSON.stringify(input.attachments) : null, input.contextRefs ? JSON.stringify(input.contextRefs) : null, input.contextSnapshots ? JSON.stringify(input.contextSnapshots) : null, input.thinking ?? null, JSON.stringify(input.origin), max.value + 1, input.targetRunId ?? null, now, now);
|
|
95
|
-
|
|
96
|
+
target_run_id, version, created_at_ms, updated_at_ms, kind, payload_json, task_run_id)
|
|
97
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?, ?, ?, ?, ?)`).run(input.id, input.sessionKey, input.clientMessageId, input.expectedSessionId ?? null, input.requestedDelivery, input.effectiveDelivery, input.status, input.content, input.attachments ? JSON.stringify(input.attachments) : null, input.contextRefs ? JSON.stringify(input.contextRefs) : null, input.contextSnapshots ? JSON.stringify(input.contextSnapshots) : null, input.thinking ?? null, JSON.stringify(input.origin), max.value + 1, input.targetRunId ?? null, now, now, input.kind ?? "message", input.payload ? JSON.stringify(input.payload) : null, input.taskRunId ?? null);
|
|
98
|
+
bumpSessionInputRevision(db, input.sessionKey);
|
|
96
99
|
return mapInput(db.prepare(`${SELECT_INPUTS} WHERE id = ?`).get(input.id));
|
|
97
100
|
});
|
|
98
101
|
}
|
|
@@ -102,7 +105,7 @@ function claimNextSessionInput(sessionKey, runId) {
|
|
|
102
105
|
if (db.prepare(`SELECT active_run_id FROM session_input_runtime WHERE session_key = ?`).get(sessionKey).active_run_id) return void 0;
|
|
103
106
|
if (db.prepare(`UPDATE session_inputs SET status = 'interrupted', error = 'Session changed before delivery',
|
|
104
107
|
version = version + 1, updated_at_ms = ? WHERE session_key = ? AND status = 'queued'
|
|
105
|
-
AND expected_session_id IS NOT NULL AND expected_session_id IS NOT ?`).run(Date.now(), sessionKey, readCurrentSessionId(db, sessionKey)).changes)
|
|
108
|
+
AND expected_session_id IS NOT NULL AND expected_session_id IS NOT ?`).run(Date.now(), sessionKey, readCurrentSessionId(db, sessionKey)).changes) bumpSessionInputRevision(db, sessionKey);
|
|
106
109
|
const row = db.prepare(`${SELECT_INPUTS} WHERE session_key = ? AND effective_delivery = 'next'
|
|
107
110
|
AND status = 'queued' ORDER BY position, created_at_ms, id LIMIT 1`).get(sessionKey);
|
|
108
111
|
if (!row) return void 0;
|
|
@@ -135,14 +138,14 @@ function setSessionInputStatus(id, status, patch) {
|
|
|
135
138
|
if (!row) return false;
|
|
136
139
|
db.prepare(`UPDATE session_inputs SET status = ?, effective_delivery = ?, target_run_id = ?,
|
|
137
140
|
error = ?, version = version + 1, updated_at_ms = ? WHERE id = ?`).run(status, patch?.effectiveDelivery ?? row.effective_delivery, patch?.targetRunId !== void 0 ? patch.targetRunId : row.target_run_id, patch?.error ?? row.error, Date.now(), id);
|
|
138
|
-
|
|
141
|
+
bumpSessionInputRevision(db, row.session_key);
|
|
139
142
|
return true;
|
|
140
143
|
});
|
|
141
144
|
}
|
|
142
145
|
function mutateQueuedSessionInput(input) {
|
|
143
146
|
return runSqliteWriteTransaction((db) => {
|
|
144
147
|
const row = db.prepare(`${SELECT_INPUTS} WHERE id = ? AND session_key = ?`).get(input.id, input.sessionKey);
|
|
145
|
-
if (!row || row.status !== "queued" || row.version !== input.version) return false;
|
|
148
|
+
if (!row || row.kind !== "message" || row.status !== "queued" || row.version !== input.version) return false;
|
|
146
149
|
const now = Date.now();
|
|
147
150
|
if (input.position !== void 0) {
|
|
148
151
|
const ordered = db.prepare(`${SELECT_INPUTS} WHERE session_key = ? AND status = 'queued' ORDER BY position, created_at_ms, id`).all(input.sessionKey).filter((item) => item.id !== input.id);
|
|
@@ -152,16 +155,16 @@ function mutateQueuedSessionInput(input) {
|
|
|
152
155
|
} else db.prepare(`UPDATE session_inputs SET content = ?, attachments_json = ?, context_refs_json = ?,
|
|
153
156
|
context_snapshots_json = ?, thinking = ?, version = version + 1,
|
|
154
157
|
updated_at_ms = ? WHERE id = ?`).run(input.content ?? row.content, input.attachments ? JSON.stringify(input.attachments) : row.attachments_json, input.contextRefs ? JSON.stringify(input.contextRefs) : row.context_refs_json, input.contextSnapshots ? JSON.stringify(input.contextSnapshots) : row.context_snapshots_json, input.thinking ?? row.thinking, now, input.id);
|
|
155
|
-
|
|
158
|
+
bumpSessionInputRevision(db, input.sessionKey);
|
|
156
159
|
return true;
|
|
157
160
|
});
|
|
158
161
|
}
|
|
159
162
|
function cancelQueuedSessionInput(sessionKey, id, version) {
|
|
160
163
|
return runSqliteWriteTransaction((db) => {
|
|
161
164
|
const result = db.prepare(`UPDATE session_inputs SET status = 'cancelled', version = version + 1,
|
|
162
|
-
updated_at_ms = ? WHERE id = ? AND session_key = ? AND version = ? AND status IN ('queued','interrupted')`).run(Date.now(), id, sessionKey, version);
|
|
165
|
+
updated_at_ms = ? WHERE id = ? AND session_key = ? AND version = ? AND kind = 'message' AND status IN ('queued','interrupted')`).run(Date.now(), id, sessionKey, version);
|
|
163
166
|
if (Number(result.changes) === 0) return false;
|
|
164
|
-
|
|
167
|
+
bumpSessionInputRevision(db, sessionKey);
|
|
165
168
|
return true;
|
|
166
169
|
});
|
|
167
170
|
}
|
|
@@ -177,4 +180,4 @@ function recoverSessionInputState() {
|
|
|
177
180
|
});
|
|
178
181
|
}
|
|
179
182
|
//#endregion
|
|
180
|
-
export { SessionInstanceChangedError, cancelQueuedSessionInput, claimNextSessionInput, findSessionInput, finishSessionInputRun, getSessionInputById, getSessionInputState, insertSessionInput, listActiveSessionInputRuns, mutateQueuedSessionInput, recoverSessionInputState, setSessionInputStatus };
|
|
183
|
+
export { SessionInstanceChangedError, bumpSessionInputRevision, cancelQueuedSessionInput, claimNextSessionInput, findSessionInput, finishSessionInputRun, getSessionInputById, getSessionInputState, insertSessionInput, listActiveSessionInputRuns, mutateQueuedSessionInput, recoverSessionInputState, setSessionInputStatus };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region src/storage/sqlite/session-instance-repository.ts
|
|
2
|
+
function readCurrentSessionId(db, sessionKey) {
|
|
3
|
+
return db.prepare(`SELECT session_id FROM sessions WHERE session_key = ?`).get(sessionKey)?.session_id ?? null;
|
|
4
|
+
}
|
|
5
|
+
//#endregion
|
|
6
|
+
export { readCurrentSessionId };
|
|
@@ -4,7 +4,7 @@ import { type SessionMetadataSeed } from './session-metadata.js';
|
|
|
4
4
|
import { buildGlobalSessionStats } from './row-mappers.js';
|
|
5
5
|
export declare function ensureSessionInTransaction(db: DatabaseSync, sessionKey: string, cwd: string, seed?: SessionMetadataSeed): SessionMetadata;
|
|
6
6
|
export declare function ensureSessionRecord(sessionKey: string, cwd: string, seed?: SessionMetadataSeed): SessionMetadata;
|
|
7
|
-
export
|
|
7
|
+
export { readCurrentSessionId } from './session-instance-repository.js';
|
|
8
8
|
export declare function getSessionMetadata(sessionKey: string): SessionMetadata | null;
|
|
9
9
|
export declare function getCurrentSessionId(sessionKey: string): string | null;
|
|
10
10
|
export declare function listSessionMetadata(query?: SessionListQuery): PaginatedResult<SessionMetadata>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { getSqliteDatabase, runSqliteWriteTransaction } from "./transaction.js";
|
|
2
|
-
import {
|
|
3
|
-
import { buildFts5SearchQuery } from "./fts.js";
|
|
4
|
-
import { validateSessionId } from "../../session/session-id.js";
|
|
2
|
+
import { readCurrentSessionId } from "./session-instance-repository.js";
|
|
5
3
|
import { buildDefaultSessionMetadata } from "./session-metadata.js";
|
|
6
4
|
import { buildGlobalSessionStats, metadataToSessionInsert, sessionRowToMetadata } from "./row-mappers.js";
|
|
5
|
+
import { cancelConnectionObjective } from "./connection-wait-repository.js";
|
|
6
|
+
import { notifyUserContextChange } from "../../user-context/changes.js";
|
|
7
|
+
import { validateSessionId } from "../../session/session-id.js";
|
|
8
|
+
import { buildFts5SearchQuery } from "./fts.js";
|
|
7
9
|
import { randomUUID } from "node:crypto";
|
|
8
10
|
//#region src/storage/sqlite/session-repository.ts
|
|
9
11
|
const SESSION_COLUMNS = `
|
|
@@ -63,9 +65,6 @@ function ensureSessionInTransaction(db, sessionKey, cwd, seed) {
|
|
|
63
65
|
function ensureSessionRecord(sessionKey, cwd, seed) {
|
|
64
66
|
return runSqliteWriteTransaction((db) => ensureSessionInTransaction(db, sessionKey, cwd, seed));
|
|
65
67
|
}
|
|
66
|
-
function readCurrentSessionId(db, sessionKey) {
|
|
67
|
-
return db.prepare(`SELECT session_id FROM sessions WHERE session_key = ?`).get(sessionKey)?.session_id ?? null;
|
|
68
|
-
}
|
|
69
68
|
function getSessionMetadata(sessionKey) {
|
|
70
69
|
const row = readSessionRow(getSqliteDatabase(), sessionKey);
|
|
71
70
|
if (!row) return null;
|
|
@@ -254,6 +253,7 @@ function resetSessionRecord(sessionKey, cwd) {
|
|
|
254
253
|
return runSqliteWriteTransaction((db) => {
|
|
255
254
|
const existing = readSessionRow(db, sessionKey);
|
|
256
255
|
if (!existing) return null;
|
|
256
|
+
cancelConnectionObjective(sessionKey);
|
|
257
257
|
const previousSessionId = existing.session_id;
|
|
258
258
|
const now = Date.now();
|
|
259
259
|
db.prepare(`UPDATE transcripts SET status = 'archived', archive_reason = 'reset', archived_at = ?
|
|
@@ -286,6 +286,7 @@ function deleteSessionRecord(sessionKey) {
|
|
|
286
286
|
const now = Date.now();
|
|
287
287
|
db.prepare(`UPDATE transcripts SET status = 'archived', archive_reason = 'delete', archived_at = ?
|
|
288
288
|
WHERE session_id = ?`).run(now, existing.session_id);
|
|
289
|
+
cancelConnectionObjective(sessionKey);
|
|
289
290
|
db.prepare(`DELETE FROM sessions WHERE session_key = ?`).run(sessionKey);
|
|
290
291
|
return true;
|
|
291
292
|
});
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { getSqliteDatabase, runSqliteWriteTransaction } from "./transaction.js";
|
|
2
|
-
import {
|
|
2
|
+
import { readCurrentSessionId } from "./session-instance-repository.js";
|
|
3
3
|
import { buildSessionContextForLlm, isRuntimeOnlyTranscriptMessage } from "../../session/session-context-for-llm.js";
|
|
4
4
|
import { classifyStoredRow, estimateTokensFromMessages, extractFtsContent, transcriptEntryRowToStoredRow } from "./row-mappers.js";
|
|
5
|
-
import {
|
|
5
|
+
import { escapeFts5Query } from "./fts.js";
|
|
6
|
+
import { getCurrentSessionId } from "./session-repository.js";
|
|
6
7
|
import { randomUUID } from "node:crypto";
|
|
7
8
|
//#region src/storage/sqlite/transcript-repository.ts
|
|
8
9
|
function nextSeq(db, sessionId) {
|
|
@@ -334,7 +334,7 @@ var HomeQueryService = class {
|
|
|
334
334
|
kind: "agent_judgment",
|
|
335
335
|
title: item.insight.title,
|
|
336
336
|
detail: item.insight.summary,
|
|
337
|
-
reason: item.insight.disposition === "request_approval" ? "approval_required" : "decision_needed",
|
|
337
|
+
reason: item.insight.disposition === "request_approval" ? "approval_required" : item.insight.attentionKind === "decision" ? "decision_needed" : "insight_available",
|
|
338
338
|
urgency: item.insight.urgency === "critical" || item.insight.urgency === "high" ? "now" : "soon",
|
|
339
339
|
href: `/?judgment=${encodeURIComponent(item.id)}`,
|
|
340
340
|
updatedAt: Date.parse(item.updatedAt),
|
|
@@ -346,6 +346,8 @@ var HomeQueryService = class {
|
|
|
346
346
|
recommendation: item.insight.recommendation,
|
|
347
347
|
confidence: item.insight.confidence,
|
|
348
348
|
valueScore: item.insight.valueScore,
|
|
349
|
+
evidenceIds: item.insight.evidenceIds,
|
|
350
|
+
attentionKind: item.insight.attentionKind,
|
|
349
351
|
disposition: item.insight.disposition,
|
|
350
352
|
dispositionReason: item.insight.dispositionReason,
|
|
351
353
|
...item.insight.actionStatus ? { actionStatus: item.insight.actionStatus } : {},
|
|
@@ -398,19 +400,39 @@ var HomeQueryService = class {
|
|
|
398
400
|
});
|
|
399
401
|
const decisions = governed.decisions;
|
|
400
402
|
const attention = governed.attention;
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
scheduled: upcomingAutomations,
|
|
412
|
-
nowMs
|
|
403
|
+
const interactiveDecisions = decisions.filter((item) => item.kind !== "agent_judgment" || item.judgment?.attentionKind === "decision");
|
|
404
|
+
const proactiveInformation = decisions.filter((item) => item.kind === "agent_judgment" && item.judgment?.attentionKind !== "decision");
|
|
405
|
+
const workbench = buildHomeWorkbench({
|
|
406
|
+
locale,
|
|
407
|
+
decisions: interactiveDecisions,
|
|
408
|
+
attention,
|
|
409
|
+
activeWorkflowRuns,
|
|
410
|
+
runningTasks: tasks.filter((task) => {
|
|
411
|
+
const state = this.#projector.project(task).operationalState;
|
|
412
|
+
return state === "queued" || state === "running" || state === "verifying";
|
|
413
413
|
}),
|
|
414
|
+
scheduled: upcomingAutomations,
|
|
415
|
+
nowMs
|
|
416
|
+
});
|
|
417
|
+
const informationItems = proactiveInformation.map((item) => ({
|
|
418
|
+
id: item.id,
|
|
419
|
+
kind: "insight",
|
|
420
|
+
title: item.title,
|
|
421
|
+
summary: item.detail ?? item.judgment.recommendation,
|
|
422
|
+
recommendation: item.judgment.recommendation,
|
|
423
|
+
updatedAt: item.updatedAt,
|
|
424
|
+
openAction: {
|
|
425
|
+
type: "review_judgment",
|
|
426
|
+
label: locale?.startsWith("zh") ? "查看" : "Review",
|
|
427
|
+
itemId: item.judgment.inboxItemId
|
|
428
|
+
},
|
|
429
|
+
secondaryActions: []
|
|
430
|
+
}));
|
|
431
|
+
const background = [...informationItems, ...workbench.background].sort((left, right) => right.updatedAt - left.updatedAt).slice(0, 3);
|
|
432
|
+
return {
|
|
433
|
+
...workbench,
|
|
434
|
+
background,
|
|
435
|
+
backgroundCount: workbench.backgroundCount + informationItems.length,
|
|
414
436
|
runningConversations,
|
|
415
437
|
decisions,
|
|
416
438
|
attentionPolicy: governed.policy
|
package/dist/src/tasks/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { TaskRepository } from "./task-repository.js";
|
|
2
|
-
import { TaskConversationConflictError, TaskConversationRepository } from "./task-conversation-repository.js";
|
|
3
1
|
import { enqueueTaskAttentionRequiredEvent, enqueueTaskChanged, enqueueTaskChangedEvent } from "./task-change-events.js";
|
|
4
2
|
import { TaskRunRepository } from "./task-run-repository.js";
|
|
3
|
+
import { TaskRepository } from "./task-repository.js";
|
|
4
|
+
import { TaskConversationConflictError, TaskConversationRepository } from "./task-conversation-repository.js";
|
|
5
5
|
import { TaskReadModelProjector } from "./task-read-model-projector.js";
|
|
6
6
|
import { resolveExecutionContext } from "./execution-context.js";
|
|
7
7
|
import { AttentionGovernor } from "./attention-governor.js";
|
|
@@ -18,6 +18,8 @@ export declare function isInQuietHours(quietHours: QuietHours | undefined, now?:
|
|
|
18
18
|
export declare function nextQuietHoursEnd(quietHours: QuietHours | undefined, now?: Date): Date | undefined;
|
|
19
19
|
export declare class ProjectMonitoringService {
|
|
20
20
|
#private;
|
|
21
|
+
private readonly workspaceId;
|
|
22
|
+
constructor(workspaceId?: string);
|
|
21
23
|
get(projectId: string): ProjectMonitoringPolicy;
|
|
22
24
|
configure(input: {
|
|
23
25
|
projectId: string;
|
|
@@ -61,6 +61,9 @@ function nextQuietHoursEnd(quietHours, now = /* @__PURE__ */ new Date()) {
|
|
|
61
61
|
}
|
|
62
62
|
var ProjectMonitoringService = class {
|
|
63
63
|
#scenarios = new ProactiveScenarioService();
|
|
64
|
+
constructor(workspaceId = "default") {
|
|
65
|
+
this.workspaceId = workspaceId;
|
|
66
|
+
}
|
|
64
67
|
get(projectId) {
|
|
65
68
|
const row = getSqliteDatabase().prepare("SELECT * FROM project_monitoring_policies WHERE project_id = ?").get(projectId);
|
|
66
69
|
const scenarios = this.#scenarios.subscriptions().filter((item) => item.scopeKind === "project" && item.scopeId === projectId && item.enabled).map((item) => item.scenarioKey).sort();
|
|
@@ -100,7 +103,7 @@ var ProjectMonitoringService = class {
|
|
|
100
103
|
if (!selected.has(scenario) && !existingSubscriptions.has(scenario)) continue;
|
|
101
104
|
this.#scenarios.subscribe({
|
|
102
105
|
scenarioKey: scenario,
|
|
103
|
-
workspaceId:
|
|
106
|
+
workspaceId: this.workspaceId,
|
|
104
107
|
scopeKind: "project",
|
|
105
108
|
scopeId: input.projectId,
|
|
106
109
|
enabled: selected.has(scenario)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TaskRepository } from "./task-repository.js";
|
|
2
1
|
import { TaskRunRepository } from "./task-run-repository.js";
|
|
2
|
+
import { TaskRepository } from "./task-repository.js";
|
|
3
3
|
import { TaskReadModelProjector } from "./task-read-model-projector.js";
|
|
4
4
|
import { TaskDependencyService } from "./task-dependency-service.js";
|
|
5
5
|
import { ProjectMonitoringService } from "./project-monitoring-service.js";
|