@xopcai/xopc 0.0.248 → 0.0.249
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-B759R_qf.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BmKxSM1k.js → agent-avatar-dicebear-BUu7EnwM.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-C1rXNUAG.js +1 -0
- package/dist/gateway/static/root/assets/agents-DK9HjHO0.js +1 -0
- package/dist/gateway/static/root/assets/{api-B0-hLuZ1.js → api-Cg0v7Lpn.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-C9DkCW_d.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-CFggS95Y.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-jOvT-fzU.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BnMSgZvR.js → archive-plugin-BQrilVVv.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CejsQMev.js → attachment-load-BG0BliqV.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-RC8EyoAf.js → automations-page-Bo4RiTkh.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BKjKTlW8.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DGjppLSG.js → binary-plugins-BCnyNU0C.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CWdP4bUc.js → block-editor-Db8DlVvg.js} +50 -50
- package/dist/gateway/static/root/assets/browser-settings-page-Dzq18pO1.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-BQ1Ilw_o.js → browser-workflow-inputs-C71vfl0b.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CJh4NyxT.js → browser-workflows-page-vvmSYKsO.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DW4SBQf4.js +7 -0
- package/dist/gateway/static/root/assets/channels-settings-57OGuewD.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-Ohhee4vm.js → channels-status-swr-CKyV3jY5.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-BOtoKTK3.js → chat-terminal-dock-B1Xd6OFB.js} +2 -2
- package/dist/gateway/static/root/assets/connectors-page-CT_I3kbR.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-DTj1V3Sw.js → cron-expression-D-F9vjtE.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-Yr6OCvGL.js → date-picker-B2OoYvic.js} +1 -1
- package/dist/gateway/static/root/assets/dependency-picker-BiGx9Sbj.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-DbGzggPF.js → desktop-pet-BNMRqipe.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-DeYbIV7A.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DgTtk4KC.js → extension-debug-page-COyn05ub.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DtQeiP6f.js → extension-page-oH43chS2.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BMO59994.js +1 -0
- package/dist/gateway/static/root/assets/gateway-config-api-cimpViGk.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-DXuXtU1w.js → gateway-config-swr-BGdHwT4e.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-BHJtnSic.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CzBzglzQ.js → gateway-startup-retry-CuaM3b4c.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DNhrZHqx.js +1 -0
- package/dist/gateway/static/root/assets/home-page-BiHwiBnQ.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-TIgsn04n.js → image-generation-api-D7duj7Uj.js} +1 -1
- package/dist/gateway/static/root/assets/index-DGeGmj4k.css +2 -0
- package/dist/gateway/static/root/assets/index-aBs0EfQB.js +72 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-wsWuoa8p.js → keyboard-shortcuts-settings-D8Zw_lYd.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-CpyvYyrb.js → local-app-workbench-page-eBFVWmtH.js} +2 -2
- package/dist/gateway/static/root/assets/{local-apps-page-CXrbrGo8.js → local-apps-page-CvPDPRwb.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-BJFLQY8O.js → locale-store-zEL8bkwx.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-ClvcWlL6.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-BdJZFR7U.js → management-settings-D8moh99U.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-NK3ACVG2.js → markdown-split-D7V3j0vE.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-DTF9v1gg.js → markdown-view-DGRN-8wP.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-F0jcUxyl.js → media-plugins-BLaE5b1Y.js} +1 -1
- package/dist/gateway/static/root/assets/messages-W5P19VTF.js +11 -0
- package/dist/gateway/static/root/assets/mobile-pairing-wizard-DiVDuCxl.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-CEEvR-fV.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-BLqgXNCx.js +8 -0
- package/dist/gateway/static/root/assets/page-tabs-BFMGjA60.js +1 -0
- package/dist/gateway/static/root/assets/preview-open-alternatives-DNEWZN7H.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-CxGGlWA8.js → product-open-page-Co5u7asH.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-CIiFJ5tk.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-B3UF-Pfm.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-CIsNlSBi.js → registry-api-Cg92zSod.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BUtpkJPG.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-YkjhiQfA.js → runtime-tools-settings-panel-C0ByNmlV.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-oFGf3G3s.js → schema-form-Dq_VQpuY.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-UgJmG-V4.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DDCzpdkl.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-CZu6FX4k.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-C7VWs0IT.js → settings-page-S8ekeUZd.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BdVmwXMv.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-t5oz18rh.js → share-preview-page-D2fEidbn.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-BdsqnCYj.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-ghzAQKna.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-AYiPlgZE.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-DEDTYs2W.js → skills-page.utils-DGzl-ib-.js} +1 -1
- package/dist/gateway/static/root/assets/system-settings-panel-5Xd5mIiR.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-BQAUaCDD.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-O597U8q_.js → theme-store-ZVClZKQ0.js} +1 -1
- package/dist/gateway/static/root/assets/tunnel-api-CdZN1Jin.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-B5eUJ6Zq.js → use-autosave-czRI0NBc.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-W3GTm6nA.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CMKSwz4C.js → voice-api-key-field-8YEvA3cU.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-q7B6fOFB.js → voice-config-api-CopF64lY.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-keLtqYYJ.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DZmvLZjb.js → workflow-run-setup-panel-Dy5WgYMO.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-BbAV3h7n.js +5 -0
- package/dist/gateway/static/root/index.html +10 -26
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-instance-gateway.d.ts +2 -2
- package/dist/src/agent/agent-manager.d.ts +4 -4
- package/dist/src/agent/agent-manager.js +31 -15
- 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 +24 -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 +36 -0
- package/dist/src/agent/context/audit.js +97 -0
- package/dist/src/agent/context/coordinator.d.ts +26 -0
- package/dist/src/agent/context/coordinator.js +72 -0
- package/dist/src/agent/context/execution-context.d.ts +54 -0
- package/dist/src/agent/context/execution-context.js +147 -0
- package/dist/src/agent/context/execution-scope.js +1 -1
- 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 +3 -3
- package/dist/src/agent/context/project-context.js +26 -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.js +1 -1
- 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/memory/compaction-policy.js +1 -1
- package/dist/src/agent/memory/compaction-promotion.js +45 -77
- package/dist/src/agent/memory/create-memory-manager.js +1 -3
- package/dist/src/agent/memory/index.d.ts +0 -5
- package/dist/src/agent/memory/index.js +2 -5
- 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.js +1 -1
- 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/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.js +6 -23
- package/dist/src/agent/service/process-direct-streaming.js +5 -3
- 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.js +36 -19
- 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 +9 -0
- package/dist/src/agent/tools/knowledge-memory-tool.js +129 -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/user-context-tool.d.ts +8 -0
- package/dist/src/agent/tools/user-context-tool.js +81 -0
- package/dist/src/agent/tools/xopc-use-tool.js +2 -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 +42 -0
- package/dist/src/connectors/connection-recovery-service.js +396 -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/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 +7 -15
- 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/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 +2 -2
- 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/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 +45 -14
- 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 +35 -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 +45 -0
- package/dist/src/knowledge-memory/repository.js +154 -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/proactive/execution/context.d.ts +2 -2
- package/dist/src/proactive/execution/context.js +16 -11
- package/dist/src/proactive/index.d.ts +1 -1
- package/dist/src/proactive/index.js +2 -2
- 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-store.js +2 -1
- package/dist/src/realtime/runtime.js +1 -0
- package/dist/src/runtime-tools/manager.js +1 -1
- package/dist/src/storage/sqlite/collaboration-rule-repository.d.ts +17 -0
- package/dist/src/storage/sqlite/collaboration-rule-repository.js +54 -0
- 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 +4 -6
- 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/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/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 +16 -13
- package/dist/src/storage/sqlite/session-repository.js +4 -1
- package/dist/src/storage/sqlite/transcript-repository.js +1 -1
- package/dist/src/tasks/index.js +2 -2
- 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/tool-summary.js +2 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- 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 +40 -0
- package/dist/src/user-model/capture/executor.js +134 -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 +21 -0
- package/dist/src/user-model/capture/semantic.js +197 -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 +58 -0
- package/dist/src/user-model/goals.js +89 -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 +1 -1
- 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/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-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/understanding/types.js +0 -1
- 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 → knowledge-memory/domain.js} +0 -0
|
@@ -1,457 +0,0 @@
|
|
|
1
|
-
import { UNDERSTANDING_KINDS } from "../../../user-context/domain.js";
|
|
2
|
-
import { listContextExtractionRuns } from "../../../storage/sqlite/context-extraction-repository.js";
|
|
3
|
-
import { listContextConsolidationRuns } from "../../../storage/sqlite/context-consolidation-repository.js";
|
|
4
|
-
import { createCollaborationRule, createUnderstanding, decideContextConsent, deleteCollaborationRule, deleteUnderstanding, getCollaborationRule, getTurnPersonalization, getUnderstanding, getUserProfile, listCollaborationRules, listUnderstandingEvidence, listUnderstandingStatusEvents, listUnderstandings, recordContextFeedback, rejectUnderstanding, reviseCollaborationRule, reviseUnderstanding, setCollaborationRuleStatus, setUnderstandingStatus, updateUserProfile } from "../../../storage/sqlite/user-context-repository.js";
|
|
5
|
-
import "../../../storage/sqlite/index.js";
|
|
6
|
-
import { getUserFocus, listUserFocuses, updateUserFocus } from "../../../user-context/sources/repository.js";
|
|
7
|
-
import { canonicalUnderstandingKey, findDuplicateUnderstanding } from "../../../user-context/understanding.js";
|
|
8
|
-
import { listContextObjects } from "../../../user-context/context-objects.js";
|
|
9
|
-
import { deleteUserAvatar, readUserAvatar, writeUserAvatar } from "../../../user-context/user-avatar.js";
|
|
10
|
-
import { listUnderstandingFocusExclusions, setUnderstandingFocusExclusion } from "../../../storage/sqlite/understanding-focus-exclusions.js";
|
|
11
|
-
import { repairExtractedContext } from "../../../user-context/extraction/repair.js";
|
|
12
|
-
import { getUserRelationship, listUserRelationships, mergeUserRelationships, patchUserRelationship } from "../../../user-context/relationships/service.js";
|
|
13
|
-
import { USER_PERSON_KINDS } from "../../../user-context/relationships/types.js";
|
|
14
|
-
import { userInfo } from "node:os";
|
|
15
|
-
//#region src/gateway/hono/routes/you.ts
|
|
16
|
-
const UNDERSTANDING_KIND_SET = new Set(UNDERSTANDING_KINDS);
|
|
17
|
-
const UNDERSTANDING_STATUSES = new Set([
|
|
18
|
-
"candidate",
|
|
19
|
-
"active",
|
|
20
|
-
"needs_review",
|
|
21
|
-
"stale",
|
|
22
|
-
"archived",
|
|
23
|
-
"rejected"
|
|
24
|
-
]);
|
|
25
|
-
const RULE_CATEGORIES = new Set([
|
|
26
|
-
"communication",
|
|
27
|
-
"execution",
|
|
28
|
-
"boundary",
|
|
29
|
-
"routine",
|
|
30
|
-
"proactive"
|
|
31
|
-
]);
|
|
32
|
-
const RULE_STATUSES = new Set([
|
|
33
|
-
"active",
|
|
34
|
-
"disabled",
|
|
35
|
-
"archived"
|
|
36
|
-
]);
|
|
37
|
-
const FEEDBACK_RATINGS = new Set([
|
|
38
|
-
"helpful",
|
|
39
|
-
"irrelevant",
|
|
40
|
-
"wrong",
|
|
41
|
-
"stale",
|
|
42
|
-
"sensitive"
|
|
43
|
-
]);
|
|
44
|
-
const CONTEXT_OBJECT_VIEWS = new Set([
|
|
45
|
-
"current",
|
|
46
|
-
"review",
|
|
47
|
-
"history"
|
|
48
|
-
]);
|
|
49
|
-
const USER_PERSON_KIND_SET = new Set(USER_PERSON_KINDS);
|
|
50
|
-
function asRecord(value) {
|
|
51
|
-
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
52
|
-
}
|
|
53
|
-
async function readBody(c) {
|
|
54
|
-
try {
|
|
55
|
-
return asRecord(await c.req.json());
|
|
56
|
-
} catch {
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
function nonEmptyString(value, max = 2e3) {
|
|
61
|
-
if (typeof value !== "string") return void 0;
|
|
62
|
-
const result = value.trim();
|
|
63
|
-
return result && result.length <= max ? result : void 0;
|
|
64
|
-
}
|
|
65
|
-
function scopeFrom(value) {
|
|
66
|
-
const raw = asRecord(value);
|
|
67
|
-
const type = raw?.type;
|
|
68
|
-
if (type !== "global" && type !== "workspace" && type !== "project" && type !== "session") return void 0;
|
|
69
|
-
if (type === "global") return { type };
|
|
70
|
-
const id = nonEmptyString(raw.id, 500);
|
|
71
|
-
return id ? {
|
|
72
|
-
type,
|
|
73
|
-
id
|
|
74
|
-
} : void 0;
|
|
75
|
-
}
|
|
76
|
-
function validTimezone(value) {
|
|
77
|
-
if (!value) return true;
|
|
78
|
-
try {
|
|
79
|
-
new Intl.DateTimeFormat("en", { timeZone: value }).format();
|
|
80
|
-
return true;
|
|
81
|
-
} catch {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
function machineCallName() {
|
|
86
|
-
try {
|
|
87
|
-
const username = userInfo().username.trim();
|
|
88
|
-
return [
|
|
89
|
-
"root",
|
|
90
|
-
"admin",
|
|
91
|
-
"administrator",
|
|
92
|
-
"user"
|
|
93
|
-
].includes(username.toLocaleLowerCase()) ? "" : username.slice(0, 100);
|
|
94
|
-
} catch {
|
|
95
|
-
return "";
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
function registerYouRoutes(authenticated, deps) {
|
|
99
|
-
const write = deps.strictRateLimitMiddleware;
|
|
100
|
-
authenticated.get("/api/you/avatar", async (c) => {
|
|
101
|
-
const result = await readUserAvatar();
|
|
102
|
-
if (result.ok === false) return c.json({ error: result.error }, result.status);
|
|
103
|
-
return new Response(result.data.buffer, {
|
|
104
|
-
status: 200,
|
|
105
|
-
headers: {
|
|
106
|
-
"Content-Type": result.data.contentType,
|
|
107
|
-
"Cache-Control": "private, no-store"
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
authenticated.put("/api/you/avatar", write, async (c) => {
|
|
112
|
-
const body = await readBody(c);
|
|
113
|
-
if (!body) return c.json({ error: "Invalid JSON" }, 400);
|
|
114
|
-
const result = await writeUserAvatar(typeof body.base64 === "string" ? body.base64 : "", typeof body.mimeType === "string" ? body.mimeType : "");
|
|
115
|
-
if (result.ok === false) return c.json({ error: result.error }, result.status);
|
|
116
|
-
return c.json({ ok: true });
|
|
117
|
-
});
|
|
118
|
-
authenticated.delete("/api/you/avatar", write, async (c) => {
|
|
119
|
-
const result = await deleteUserAvatar();
|
|
120
|
-
if (result.ok === false) return c.json({ error: result.error }, result.status);
|
|
121
|
-
return c.json({ ok: true });
|
|
122
|
-
});
|
|
123
|
-
authenticated.get("/api/you", (c) => c.json({
|
|
124
|
-
profile: getUserProfile(),
|
|
125
|
-
understandings: (() => {
|
|
126
|
-
const byUnderstanding = listUnderstandingFocusExclusions();
|
|
127
|
-
return listUnderstandings().map((item) => ({
|
|
128
|
-
...item,
|
|
129
|
-
excludedFocusIds: byUnderstanding.get(item.id) ?? []
|
|
130
|
-
}));
|
|
131
|
-
})(),
|
|
132
|
-
focuses: listUserFocuses(),
|
|
133
|
-
rules: listCollaborationRules(),
|
|
134
|
-
consolidation: { lastRun: listContextConsolidationRuns(1)[0] ?? null }
|
|
135
|
-
}));
|
|
136
|
-
authenticated.get("/api/you/relationships", (c) => {
|
|
137
|
-
const kind = c.req.query("kind");
|
|
138
|
-
if (kind && !USER_PERSON_KIND_SET.has(kind)) return c.json({ error: "Invalid relationship kind" }, 400);
|
|
139
|
-
const requestedLimit = Number(c.req.query("limit") ?? "30");
|
|
140
|
-
if (!Number.isInteger(requestedLimit) || requestedLimit < 1 || requestedLimit > 100) return c.json({ error: "limit must be an integer from 1 to 100" }, 400);
|
|
141
|
-
const cursor = c.req.query("cursor");
|
|
142
|
-
if (cursor && !/^\d+$/.test(cursor)) return c.json({ error: "Invalid cursor" }, 400);
|
|
143
|
-
return c.json(listUserRelationships({
|
|
144
|
-
query: c.req.query("q") ?? "",
|
|
145
|
-
...kind ? { kind } : {},
|
|
146
|
-
...c.req.query("source") ? { sourceInstanceId: c.req.query("source") } : {},
|
|
147
|
-
includeHidden: c.req.query("includeHidden") === "true",
|
|
148
|
-
hiddenOnly: c.req.query("hidden") === "true",
|
|
149
|
-
...cursor ? { cursor } : {},
|
|
150
|
-
limit: requestedLimit
|
|
151
|
-
}));
|
|
152
|
-
});
|
|
153
|
-
authenticated.get("/api/you/relationships/:id", (c) => {
|
|
154
|
-
const person = getUserRelationship(c.req.param("id"));
|
|
155
|
-
return person ? c.json({ person }) : c.json({ error: "Relationship not found" }, 404);
|
|
156
|
-
});
|
|
157
|
-
authenticated.patch("/api/you/relationships/:id", write, async (c) => {
|
|
158
|
-
const body = await readBody(c);
|
|
159
|
-
if (!body) return c.json({ error: "Invalid JSON" }, 400);
|
|
160
|
-
const patch = {};
|
|
161
|
-
if (body.displayName !== void 0) {
|
|
162
|
-
if (body.displayName !== null && (typeof body.displayName !== "string" || body.displayName.trim().length > 160)) return c.json({ error: "displayName must be null or a string of at most 160 characters" }, 400);
|
|
163
|
-
patch.displayName = typeof body.displayName === "string" && body.displayName.trim() ? body.displayName.trim() : null;
|
|
164
|
-
}
|
|
165
|
-
if (body.kind !== void 0) {
|
|
166
|
-
if (body.kind !== null && !USER_PERSON_KIND_SET.has(body.kind)) return c.json({ error: "Invalid relationship kind" }, 400);
|
|
167
|
-
patch.kind = body.kind;
|
|
168
|
-
}
|
|
169
|
-
if (body.hidden !== void 0) {
|
|
170
|
-
if (typeof body.hidden !== "boolean") return c.json({ error: "hidden must be a boolean" }, 400);
|
|
171
|
-
patch.hidden = body.hidden;
|
|
172
|
-
}
|
|
173
|
-
if (!Object.keys(patch).length) return c.json({ error: "No relationship fields provided" }, 400);
|
|
174
|
-
const person = patchUserRelationship(c.req.param("id"), patch);
|
|
175
|
-
return person ? c.json({ person }) : c.json({ error: "Relationship not found" }, 404);
|
|
176
|
-
});
|
|
177
|
-
authenticated.post("/api/you/relationships/merge", write, async (c) => {
|
|
178
|
-
const body = await readBody(c);
|
|
179
|
-
const sourcePersonId = nonEmptyString(body?.sourcePersonId, 200);
|
|
180
|
-
const targetPersonId = nonEmptyString(body?.targetPersonId, 200);
|
|
181
|
-
if (!sourcePersonId || !targetPersonId || sourcePersonId === targetPersonId) return c.json({ error: "Distinct sourcePersonId and targetPersonId are required" }, 400);
|
|
182
|
-
const person = mergeUserRelationships(sourcePersonId, targetPersonId);
|
|
183
|
-
return person ? c.json({ person }) : c.json({ error: "Relationship not found" }, 404);
|
|
184
|
-
});
|
|
185
|
-
authenticated.get("/api/you/context-objects", (c) => {
|
|
186
|
-
const view = c.req.query("view") ?? "current";
|
|
187
|
-
if (!CONTEXT_OBJECT_VIEWS.has(view)) return c.json({ error: "Invalid context object view" }, 400);
|
|
188
|
-
return c.json({ objects: listContextObjects(view) });
|
|
189
|
-
});
|
|
190
|
-
authenticated.get("/api/you/extraction-runs", (c) => c.json({ runs: listContextExtractionRuns({
|
|
191
|
-
...c.req.query("sourceRef") ? { sourceRef: c.req.query("sourceRef") } : {},
|
|
192
|
-
...c.req.query("extractorId") ? { extractorId: c.req.query("extractorId") } : {},
|
|
193
|
-
...c.req.query("extractorVersion") ? { extractorVersion: c.req.query("extractorVersion") } : {},
|
|
194
|
-
limit: 100
|
|
195
|
-
}) }));
|
|
196
|
-
authenticated.post("/api/you/context-repair", write, async (c) => {
|
|
197
|
-
const body = await readBody(c);
|
|
198
|
-
if (!body) return c.json({ error: "Invalid JSON" }, 400);
|
|
199
|
-
const filter = Object.fromEntries([
|
|
200
|
-
"runId",
|
|
201
|
-
"sourceRef",
|
|
202
|
-
"extractorId",
|
|
203
|
-
"extractorVersion",
|
|
204
|
-
"objectVersionId"
|
|
205
|
-
].flatMap((field) => typeof body[field] === "string" && body[field].trim() ? [[field, body[field].trim()]] : []));
|
|
206
|
-
if (!Object.keys(filter).length) return c.json({ error: "At least one repair filter is required" }, 400);
|
|
207
|
-
return c.json({ result: repairExtractedContext(filter) });
|
|
208
|
-
});
|
|
209
|
-
authenticated.post("/api/you/context-objects/batch-review", write, async (c) => {
|
|
210
|
-
const decisions = (await readBody(c))?.decisions;
|
|
211
|
-
if (!Array.isArray(decisions) || decisions.length < 1 || decisions.length > 50) return c.json({ error: "decisions must contain 1-50 items" }, 400);
|
|
212
|
-
const normalized = [];
|
|
213
|
-
const targets = /* @__PURE__ */ new Set();
|
|
214
|
-
for (const value of decisions) {
|
|
215
|
-
const item = asRecord(value);
|
|
216
|
-
const objectType = item?.objectType;
|
|
217
|
-
const objectId = nonEmptyString(item?.objectId, 200);
|
|
218
|
-
const action = item?.action;
|
|
219
|
-
if (objectType !== "focus" && objectType !== "understanding" || !objectId || action !== "accept" && action !== "reject" && action !== "pause") return c.json({ error: "Each decision must contain a valid objectType, objectId, and action" }, 400);
|
|
220
|
-
if (!(objectType === "understanding" ? Boolean(getUnderstanding(objectId)) : listUserFocuses().some((focus) => focus.id === objectId))) return c.json({ error: `Context object not found: ${objectId}` }, 404);
|
|
221
|
-
const target = `${objectType}:${objectId}`;
|
|
222
|
-
if (targets.has(target)) return c.json({ error: `Duplicate context object decision: ${objectId}` }, 400);
|
|
223
|
-
targets.add(target);
|
|
224
|
-
normalized.push({
|
|
225
|
-
objectType,
|
|
226
|
-
objectId,
|
|
227
|
-
action
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
const objects = normalized.map(({ objectType, objectId, action }) => {
|
|
231
|
-
if (objectType === "understanding") return action === "accept" ? setUnderstandingStatus(objectId, "active", {
|
|
232
|
-
explicitness: "explicit",
|
|
233
|
-
confidence: 1,
|
|
234
|
-
actorType: "user",
|
|
235
|
-
source: "context-review"
|
|
236
|
-
}) : action === "reject" ? rejectUnderstanding(objectId, "Rejected during context review", "user") : setUnderstandingStatus(objectId, "needs_review", {
|
|
237
|
-
actorType: "user",
|
|
238
|
-
source: "context-review-later"
|
|
239
|
-
});
|
|
240
|
-
return updateUserFocus(objectId, { status: action === "accept" ? "active" : action === "reject" ? "rejected" : "paused" });
|
|
241
|
-
});
|
|
242
|
-
return c.json({ objects });
|
|
243
|
-
});
|
|
244
|
-
authenticated.get("/api/you/profile", async (c) => {
|
|
245
|
-
const profile = getUserProfile();
|
|
246
|
-
const avatar = await readUserAvatar();
|
|
247
|
-
return c.json({
|
|
248
|
-
profile,
|
|
249
|
-
suggestedCallName: profile.callName || machineCallName(),
|
|
250
|
-
hasAvatar: avatar.ok
|
|
251
|
-
});
|
|
252
|
-
});
|
|
253
|
-
authenticated.patch("/api/you/profile", write, async (c) => {
|
|
254
|
-
const body = await readBody(c);
|
|
255
|
-
if (!body) return c.json({ error: "Invalid JSON" }, 400);
|
|
256
|
-
const patch = {};
|
|
257
|
-
for (const field of [
|
|
258
|
-
"callName",
|
|
259
|
-
"role",
|
|
260
|
-
"primaryGoal",
|
|
261
|
-
"pronouns",
|
|
262
|
-
"timezone",
|
|
263
|
-
"locale"
|
|
264
|
-
]) {
|
|
265
|
-
if (body[field] === void 0) continue;
|
|
266
|
-
const max = field === "primaryGoal" ? 500 : field === "role" ? 300 : 100;
|
|
267
|
-
if (typeof body[field] !== "string" || body[field].length > max) return c.json({ error: `${field} must be a string of at most ${max} characters` }, 400);
|
|
268
|
-
patch[field] = body[field].trim();
|
|
269
|
-
}
|
|
270
|
-
if (body.accessibility !== void 0) {
|
|
271
|
-
const accessibility = asRecord(body.accessibility);
|
|
272
|
-
if (!accessibility) return c.json({ error: "accessibility must be an object" }, 400);
|
|
273
|
-
if (JSON.stringify(accessibility).length > 1e4) return c.json({ error: "accessibility is too large" }, 400);
|
|
274
|
-
patch.accessibility = accessibility;
|
|
275
|
-
}
|
|
276
|
-
if (patch.timezone !== void 0 && !validTimezone(patch.timezone)) return c.json({ error: "timezone must be a valid IANA time zone" }, 400);
|
|
277
|
-
return c.json({ profile: updateUserProfile(patch) });
|
|
278
|
-
});
|
|
279
|
-
authenticated.post("/api/you/understandings", write, async (c) => {
|
|
280
|
-
const body = await readBody(c);
|
|
281
|
-
const statement = nonEmptyString(body?.statement);
|
|
282
|
-
const kind = body?.kind;
|
|
283
|
-
const scope = scopeFrom(body?.scope ?? { type: "global" });
|
|
284
|
-
if (!statement || !UNDERSTANDING_KIND_SET.has(kind) || !scope) return c.json({ error: "Valid statement, kind, and scope are required" }, 400);
|
|
285
|
-
const typedKind = kind;
|
|
286
|
-
const key = canonicalUnderstandingKey(typedKind, statement);
|
|
287
|
-
if (findDuplicateUnderstanding(listUnderstandings(), {
|
|
288
|
-
kind: typedKind,
|
|
289
|
-
statement,
|
|
290
|
-
canonicalKey: key,
|
|
291
|
-
scope
|
|
292
|
-
})) return c.json({ error: "This understanding already exists" }, 409);
|
|
293
|
-
const understanding = createUnderstanding({
|
|
294
|
-
kind: typedKind,
|
|
295
|
-
canonicalKey: key,
|
|
296
|
-
status: "active",
|
|
297
|
-
scope,
|
|
298
|
-
explicitness: "explicit",
|
|
299
|
-
durability: "durable",
|
|
300
|
-
sensitivity: "normal",
|
|
301
|
-
disclosurePolicy: typedKind === "boundary" ? "silent" : "referenceable",
|
|
302
|
-
confidence: 1,
|
|
303
|
-
statement,
|
|
304
|
-
createdBy: "user",
|
|
305
|
-
changeReason: "Created by user"
|
|
306
|
-
});
|
|
307
|
-
return c.json({ understanding }, 201);
|
|
308
|
-
});
|
|
309
|
-
authenticated.on(["PUT", "DELETE"], "/api/you/understandings/:id/focus-exclusions/:focusId", write, (c) => {
|
|
310
|
-
const id = c.req.param("id");
|
|
311
|
-
const focusId = c.req.param("focusId");
|
|
312
|
-
if (!getUnderstanding(id) || !getUserFocus(focusId)) return c.json({ error: "Context object not found" }, 404);
|
|
313
|
-
setUnderstandingFocusExclusion(id, focusId, c.req.method === "PUT");
|
|
314
|
-
return c.json({ ok: true });
|
|
315
|
-
});
|
|
316
|
-
authenticated.get("/api/you/understandings/:id/evidence", (c) => {
|
|
317
|
-
const understanding = getUnderstanding(c.req.param("id"));
|
|
318
|
-
if (!understanding) return c.json({ error: "Understanding not found" }, 404);
|
|
319
|
-
return c.json({
|
|
320
|
-
evidence: listUnderstandingEvidence(understanding.id),
|
|
321
|
-
statusEvents: listUnderstandingStatusEvents(understanding.id)
|
|
322
|
-
});
|
|
323
|
-
});
|
|
324
|
-
authenticated.patch("/api/you/understandings/:id", write, async (c) => {
|
|
325
|
-
const id = c.req.param("id");
|
|
326
|
-
let understanding = getUnderstanding(id);
|
|
327
|
-
if (!understanding) return c.json({ error: "Understanding not found" }, 404);
|
|
328
|
-
const body = await readBody(c);
|
|
329
|
-
if (!body) return c.json({ error: "Invalid JSON" }, 400);
|
|
330
|
-
if (body.statement !== void 0) {
|
|
331
|
-
const statement = nonEmptyString(body.statement);
|
|
332
|
-
if (!statement) return c.json({ error: "statement must be 1-2000 characters" }, 400);
|
|
333
|
-
const key = canonicalUnderstandingKey(understanding.kind, statement);
|
|
334
|
-
if (findDuplicateUnderstanding(listUnderstandings(), {
|
|
335
|
-
kind: understanding.kind,
|
|
336
|
-
statement,
|
|
337
|
-
canonicalKey: key,
|
|
338
|
-
scope: understanding.scope,
|
|
339
|
-
excludeId: id
|
|
340
|
-
})) return c.json({ error: "This understanding already exists" }, 409);
|
|
341
|
-
understanding = reviseUnderstanding(id, statement, {
|
|
342
|
-
canonicalKey: key,
|
|
343
|
-
explicitness: "explicit",
|
|
344
|
-
confidence: 1,
|
|
345
|
-
changeReason: "Edited by user"
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
if (body.status !== void 0) {
|
|
349
|
-
if (!UNDERSTANDING_STATUSES.has(body.status)) return c.json({ error: "Invalid status" }, 400);
|
|
350
|
-
understanding = body.status === "rejected" ? rejectUnderstanding(id, nonEmptyString(body.reason, 500) ?? "Rejected by user", "user") : setUnderstandingStatus(id, body.status, {
|
|
351
|
-
...body.status === "active" ? {
|
|
352
|
-
explicitness: "explicit",
|
|
353
|
-
confidence: 1
|
|
354
|
-
} : {},
|
|
355
|
-
actorType: "user",
|
|
356
|
-
source: "understanding-edit"
|
|
357
|
-
});
|
|
358
|
-
}
|
|
359
|
-
return c.json({ understanding });
|
|
360
|
-
});
|
|
361
|
-
authenticated.delete("/api/you/understandings/:id", write, (c) => deleteUnderstanding(c.req.param("id")) ? c.json({ ok: true }) : c.json({ error: "Understanding not found" }, 404));
|
|
362
|
-
authenticated.post("/api/you/rules", write, async (c) => {
|
|
363
|
-
const body = await readBody(c);
|
|
364
|
-
const statement = nonEmptyString(body?.statement);
|
|
365
|
-
const category = body?.category;
|
|
366
|
-
const scope = scopeFrom(body?.scope ?? { type: "global" });
|
|
367
|
-
if (!statement || !RULE_CATEGORIES.has(category) || !scope) return c.json({ error: "Valid statement, category, and scope are required" }, 400);
|
|
368
|
-
const priority = typeof body?.priority === "number" && Number.isInteger(body.priority) ? Math.max(0, Math.min(100, body.priority)) : 50;
|
|
369
|
-
const conditions = body?.conditions === void 0 ? {} : asRecord(body.conditions);
|
|
370
|
-
if (!conditions) return c.json({ error: "conditions must be an object" }, 400);
|
|
371
|
-
const rule = createCollaborationRule({
|
|
372
|
-
category,
|
|
373
|
-
priority,
|
|
374
|
-
scope,
|
|
375
|
-
conditions,
|
|
376
|
-
statement
|
|
377
|
-
});
|
|
378
|
-
return c.json({ rule }, 201);
|
|
379
|
-
});
|
|
380
|
-
authenticated.patch("/api/you/rules/:id", write, async (c) => {
|
|
381
|
-
const id = c.req.param("id");
|
|
382
|
-
let rule = getCollaborationRule(id);
|
|
383
|
-
if (!rule) return c.json({ error: "Collaboration rule not found" }, 404);
|
|
384
|
-
const body = await readBody(c);
|
|
385
|
-
if (!body) return c.json({ error: "Invalid JSON" }, 400);
|
|
386
|
-
if (body.statement !== void 0) {
|
|
387
|
-
const statement = nonEmptyString(body.statement);
|
|
388
|
-
if (!statement) return c.json({ error: "statement must be 1-2000 characters" }, 400);
|
|
389
|
-
rule = reviseCollaborationRule(id, statement);
|
|
390
|
-
}
|
|
391
|
-
if (body.status !== void 0) {
|
|
392
|
-
if (!RULE_STATUSES.has(body.status)) return c.json({ error: "Invalid status" }, 400);
|
|
393
|
-
rule = setCollaborationRuleStatus(id, body.status);
|
|
394
|
-
}
|
|
395
|
-
return c.json({ rule });
|
|
396
|
-
});
|
|
397
|
-
authenticated.delete("/api/you/rules/:id", write, (c) => deleteCollaborationRule(c.req.param("id")) ? c.json({ ok: true }) : c.json({ error: "Collaboration rule not found" }, 404));
|
|
398
|
-
authenticated.get("/api/you/turns/:turnId/personalization", (c) => {
|
|
399
|
-
const personalization = getTurnPersonalization(c.req.param("turnId"));
|
|
400
|
-
return personalization ? c.json({ personalization }) : c.json({ error: "Personalization run not found" }, 404);
|
|
401
|
-
});
|
|
402
|
-
authenticated.post("/api/you/turns/:turnId/feedback", write, async (c) => {
|
|
403
|
-
const turnId = c.req.param("turnId");
|
|
404
|
-
const run = getTurnPersonalization(turnId);
|
|
405
|
-
if (!run) return c.json({ error: "Personalization run not found" }, 404);
|
|
406
|
-
const body = await readBody(c);
|
|
407
|
-
if (!body || !FEEDBACK_RATINGS.has(String(body.rating))) return c.json({ error: "Invalid feedback rating" }, 400);
|
|
408
|
-
const objectType = body.objectType;
|
|
409
|
-
const objectId = body.objectId;
|
|
410
|
-
if (objectType === void 0 !== (objectId === void 0) || objectType !== void 0 && ![
|
|
411
|
-
"profile",
|
|
412
|
-
"rule",
|
|
413
|
-
"focus",
|
|
414
|
-
"understanding"
|
|
415
|
-
].includes(String(objectType)) || objectId !== void 0 && typeof objectId !== "string") return c.json({ error: "objectType and objectId must be valid and provided together" }, 400);
|
|
416
|
-
if (objectType !== void 0 && !run.items.some((item) => item.objectType === objectType && item.objectId === objectId)) return c.json({ error: "The context object was not part of this turn" }, 400);
|
|
417
|
-
const rating = body.rating;
|
|
418
|
-
recordContextFeedback({
|
|
419
|
-
turnId,
|
|
420
|
-
runId: run.runId,
|
|
421
|
-
rating,
|
|
422
|
-
...objectType ? {
|
|
423
|
-
objectType,
|
|
424
|
-
objectId
|
|
425
|
-
} : {},
|
|
426
|
-
...typeof body.reason === "string" ? { reason: body.reason.slice(0, 500) } : {}
|
|
427
|
-
});
|
|
428
|
-
if (objectType === "understanding" && typeof objectId === "string") {
|
|
429
|
-
if (rating === "wrong") rejectUnderstanding(objectId, "Marked wrong from turn feedback", "user");
|
|
430
|
-
if (rating === "stale") setUnderstandingStatus(objectId, "stale", {
|
|
431
|
-
actorType: "user",
|
|
432
|
-
source: "turn-feedback-stale"
|
|
433
|
-
});
|
|
434
|
-
if (rating === "sensitive") setUnderstandingStatus(objectId, "needs_review", {
|
|
435
|
-
actorType: "user",
|
|
436
|
-
source: "turn-feedback-sensitive"
|
|
437
|
-
});
|
|
438
|
-
}
|
|
439
|
-
if (objectType === "focus" && typeof objectId === "string") {
|
|
440
|
-
if (rating === "wrong") updateUserFocus(objectId, { status: "rejected" });
|
|
441
|
-
if (rating === "stale" || rating === "sensitive") updateUserFocus(objectId, { status: "paused" });
|
|
442
|
-
}
|
|
443
|
-
return c.json({ ok: true });
|
|
444
|
-
});
|
|
445
|
-
authenticated.patch("/api/you/consents/:id", write, async (c) => {
|
|
446
|
-
const decision = (await readBody(c))?.decision;
|
|
447
|
-
if (![
|
|
448
|
-
"once",
|
|
449
|
-
"session",
|
|
450
|
-
"always",
|
|
451
|
-
"deny"
|
|
452
|
-
].includes(String(decision))) return c.json({ error: "Invalid consent decision" }, 400);
|
|
453
|
-
return decideContextConsent(c.req.param("id"), decision) ? c.json({ ok: true }) : c.json({ error: "Consent request not found" }, 404);
|
|
454
|
-
});
|
|
455
|
-
}
|
|
456
|
-
//#endregion
|
|
457
|
-
export { registerYouRoutes };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function bindMemoryRecordToProject(recordId: string, projectId: string): void;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { getSqliteDatabase, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
|
|
2
|
-
//#region src/projects/memory-bind.ts
|
|
3
|
-
function bindMemoryRecordToProject(recordId, projectId) {
|
|
4
|
-
const db = getSqliteDatabase();
|
|
5
|
-
if (!db.prepare(`SELECT 1 FROM projects WHERE project_id = ?`).get(projectId)) throw new Error(`Project not found: ${projectId}`);
|
|
6
|
-
if (!db.prepare(`SELECT 1 FROM memory_records WHERE record_id = ?`).get(recordId)) throw new Error(`Memory record not found: ${recordId}`);
|
|
7
|
-
runSqliteWriteTransaction((tx) => {
|
|
8
|
-
const now = Date.now();
|
|
9
|
-
tx.prepare(`UPDATE memory_records SET project_id = ?, updated_at = ? WHERE record_id = ?`).run(projectId, now, recordId);
|
|
10
|
-
tx.prepare(`UPDATE projects SET last_active_at = ?, updated_at = ? WHERE project_id = ?`).run(now, now, projectId);
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { bindMemoryRecordToProject };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export type ContextConsolidationRun = {
|
|
2
|
-
runId: string;
|
|
3
|
-
triggerKind: 'schedule' | 'manual';
|
|
4
|
-
status: 'running' | 'completed' | 'failed';
|
|
5
|
-
reason?: string;
|
|
6
|
-
metrics: Record<string, unknown>;
|
|
7
|
-
startedAt: number;
|
|
8
|
-
completedAt?: number;
|
|
9
|
-
};
|
|
10
|
-
export type ContextConsolidationDecision = {
|
|
11
|
-
id: string;
|
|
12
|
-
runId: string;
|
|
13
|
-
understandingId?: string;
|
|
14
|
-
action: 'needs_review' | 'stale';
|
|
15
|
-
reasonCode: string;
|
|
16
|
-
evidenceCount: number;
|
|
17
|
-
createdAt: number;
|
|
18
|
-
};
|
|
19
|
-
export declare function startContextConsolidationRun(triggerKind: ContextConsolidationRun['triggerKind'], now?: number): ContextConsolidationRun;
|
|
20
|
-
export declare function finishContextConsolidationRun(input: {
|
|
21
|
-
runId: string;
|
|
22
|
-
ok: boolean;
|
|
23
|
-
reason: string;
|
|
24
|
-
metrics: Record<string, unknown>;
|
|
25
|
-
now?: number;
|
|
26
|
-
}): ContextConsolidationRun | undefined;
|
|
27
|
-
export declare function recordContextConsolidationDecision(input: {
|
|
28
|
-
runId: string;
|
|
29
|
-
understandingId: string;
|
|
30
|
-
action: ContextConsolidationDecision['action'];
|
|
31
|
-
reasonCode: string;
|
|
32
|
-
evidenceCount: number;
|
|
33
|
-
now?: number;
|
|
34
|
-
}): ContextConsolidationDecision;
|
|
35
|
-
export declare function getContextConsolidationRun(runId: string): ContextConsolidationRun | undefined;
|
|
36
|
-
export declare function listContextConsolidationRuns(limit?: number): ContextConsolidationRun[];
|
|
37
|
-
export declare function listContextConsolidationDecisions(runId: string): ContextConsolidationDecision[];
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { getSqliteDatabase } from "./transaction.js";
|
|
2
|
-
import { randomUUID } from "node:crypto";
|
|
3
|
-
//#region src/storage/sqlite/context-consolidation-repository.ts
|
|
4
|
-
function parseJson(value) {
|
|
5
|
-
try {
|
|
6
|
-
const parsed = JSON.parse(value);
|
|
7
|
-
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
|
|
8
|
-
} catch {
|
|
9
|
-
return {};
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
function runFromRow(row) {
|
|
13
|
-
return {
|
|
14
|
-
runId: row.run_id,
|
|
15
|
-
triggerKind: row.trigger_kind,
|
|
16
|
-
status: row.status,
|
|
17
|
-
...row.reason ? { reason: row.reason } : {},
|
|
18
|
-
metrics: parseJson(row.metrics_json),
|
|
19
|
-
startedAt: row.started_at,
|
|
20
|
-
...row.completed_at == null ? {} : { completedAt: row.completed_at }
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function startContextConsolidationRun(triggerKind, now = Date.now()) {
|
|
24
|
-
const runId = randomUUID();
|
|
25
|
-
getSqliteDatabase().prepare(`INSERT INTO context_consolidation_runs (
|
|
26
|
-
run_id, trigger_kind, status, started_at
|
|
27
|
-
) VALUES (?, ?, 'running', ?)`).run(runId, triggerKind, now);
|
|
28
|
-
return getContextConsolidationRun(runId);
|
|
29
|
-
}
|
|
30
|
-
function finishContextConsolidationRun(input) {
|
|
31
|
-
getSqliteDatabase().prepare(`UPDATE context_consolidation_runs
|
|
32
|
-
SET status = ?, reason = ?, metrics_json = ?, completed_at = ? WHERE run_id = ?`).run(input.ok ? "completed" : "failed", input.reason, JSON.stringify(input.metrics), input.now ?? Date.now(), input.runId);
|
|
33
|
-
return getContextConsolidationRun(input.runId);
|
|
34
|
-
}
|
|
35
|
-
function recordContextConsolidationDecision(input) {
|
|
36
|
-
const id = randomUUID();
|
|
37
|
-
getSqliteDatabase().prepare(`INSERT INTO context_consolidation_decisions (
|
|
38
|
-
decision_id, run_id, understanding_id, action, reason_code, evidence_count, created_at
|
|
39
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?)`).run(id, input.runId, input.understandingId, input.action, input.reasonCode, input.evidenceCount, input.now ?? Date.now());
|
|
40
|
-
return listContextConsolidationDecisions(input.runId).find((item) => item.id === id);
|
|
41
|
-
}
|
|
42
|
-
function getContextConsolidationRun(runId) {
|
|
43
|
-
const row = getSqliteDatabase().prepare("SELECT * FROM context_consolidation_runs WHERE run_id = ?").get(runId);
|
|
44
|
-
return row ? runFromRow(row) : void 0;
|
|
45
|
-
}
|
|
46
|
-
function listContextConsolidationRuns(limit = 20) {
|
|
47
|
-
const safeLimit = Math.max(1, Math.min(200, limit));
|
|
48
|
-
return getSqliteDatabase().prepare(`SELECT * FROM context_consolidation_runs
|
|
49
|
-
ORDER BY started_at DESC LIMIT ?`).all(safeLimit).map(runFromRow);
|
|
50
|
-
}
|
|
51
|
-
function listContextConsolidationDecisions(runId) {
|
|
52
|
-
return getSqliteDatabase().prepare(`SELECT * FROM context_consolidation_decisions
|
|
53
|
-
WHERE run_id = ? ORDER BY created_at, decision_id`).all(runId).map((row) => ({
|
|
54
|
-
id: row.decision_id,
|
|
55
|
-
runId: row.run_id,
|
|
56
|
-
...row.understanding_id ? { understandingId: row.understanding_id } : {},
|
|
57
|
-
action: row.action,
|
|
58
|
-
reasonCode: row.reason_code,
|
|
59
|
-
evidenceCount: row.evidence_count,
|
|
60
|
-
createdAt: row.created_at
|
|
61
|
-
}));
|
|
62
|
-
}
|
|
63
|
-
//#endregion
|
|
64
|
-
export { finishContextConsolidationRun, getContextConsolidationRun, listContextConsolidationDecisions, listContextConsolidationRuns, recordContextConsolidationDecision, startContextConsolidationRun };
|