@xopcai/xopc 0.0.247 → 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/src/update-offset-store.js +17 -54
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/auth/accounts.js +3 -5
- package/dist/extensions/weixin/src/monitor/monitor.js +3 -5
- package/dist/extensions/weixin/src/storage/sync-buf.d.ts +3 -6
- package/dist/extensions/weixin/src/storage/sync-buf.js +9 -22
- package/dist/gateway/static/root/assets/{activity-store-BlxqErph.js → activity-store-B759R_qf.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DmaFeojS.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-BbXzyQMj.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-DD2SweEH.js → archive-plugin-BQrilVVv.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BG82bNBQ.js → attachment-load-BG0BliqV.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CqBZ89He.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-B6LKm5Zv.js → binary-plugins-BCnyNU0C.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BJKvGVXd.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-BAAc151l.js → browser-workflow-inputs-C71vfl0b.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-DoE4Uuns.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-CCBCtLDg.js → channels-status-swr-CKyV3jY5.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-BsRWnz7M.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-DdCgsH2c.js → cron-expression-D-F9vjtE.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-dt37Lt8e.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-Nw_Pgkk3.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-BHSst0WN.js → extension-debug-page-COyn05ub.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DXbL4cQZ.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-826dipyU.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-DyvcAIMm.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-D7cyfks6.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-EY4cu-6W.js → keyboard-shortcuts-settings-D8Zw_lYd.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-eBFVWmtH.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-Dh7OxX0S.js → local-apps-page-CvPDPRwb.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CBoCuIMx.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-ZjiL3A-S.js → management-settings-D8moh99U.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-B4BxkTpU.js → markdown-split-D7V3j0vE.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-BXsHghJd.js → markdown-view-DGRN-8wP.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-D15XBiEo.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-CAJeUXeU.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-BhGKnvLP.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-BhKcyEId.js → runtime-tools-settings-panel-C0ByNmlV.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-L0s7RWCi.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-CTKoztlF.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-CiiLLz5A.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-CwRekJSJ.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-hybK3oC9.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-DX5YZ3Nn.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-ocnZbAyi.js → voice-api-key-field-8YEvA3cU.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-CBbiF1T3.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-DaErGvxO.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/commands/command-registry.d.ts +1 -0
- package/dist/src/agent/commands/command-registry.js +12 -22
- 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/ipc/inbox.d.ts +8 -31
- package/dist/src/agent/ipc/inbox.js +64 -133
- 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-one-shot.js +15 -10
- 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/agent/workflow/catalog.d.ts +1 -8
- package/dist/src/agent/workflow/catalog.js +44 -102
- package/dist/src/agent/workflow/index.d.ts +1 -1
- package/dist/src/agent/workflow/index.js +2 -2
- package/dist/src/automations/domain/types.d.ts +1 -0
- package/dist/src/automations/service/action-executor.js +2 -2
- package/dist/src/automations/service/automation-service.js +2 -2
- package/dist/src/channels/manager.d.ts +1 -1
- package/dist/src/channels/manager.js +2 -2
- package/dist/src/channels/outbound/persist-store.d.ts +2 -8
- package/dist/src/channels/outbound/persist-store.js +11 -38
- package/dist/src/channels/outbound-sender.d.ts +1 -1
- package/dist/src/channels/outbound-sender.js +2 -2
- package/dist/src/chat-commands/builtins/understanding.js +24 -6
- 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 +31 -20
- package/dist/src/config/web-patch.d.ts +1 -1
- package/dist/src/connectors/composio-managed-client.js +6 -2
- package/dist/src/connectors/composio-triggers.d.ts +2 -2
- package/dist/src/connectors/composio-triggers.js +8 -15
- 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/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/automation-agent-session.js +3 -0
- 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/lib/extension-store.js +8 -25
- package/dist/src/gateway/hono/middleware/auth.js +1 -2
- 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 +4 -12
- 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/notes.js +22 -7
- package/dist/src/gateway/hono/routes/projects.js +37 -45
- 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/hono/routes/workflows.js +2 -2
- 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 +49 -19
- 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/index.d.ts +1 -1
- package/dist/src/notes/index.js +2 -2
- package/dist/src/notes/paths.d.ts +0 -3
- package/dist/src/notes/paths.js +1 -10
- package/dist/src/notes/service.d.ts +1 -1
- package/dist/src/notes/service.js +7 -4
- package/dist/src/notes/store.d.ts +0 -2
- package/dist/src/notes/store.js +33 -80
- 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/share/hosted-session-share.d.ts +1 -4
- package/dist/src/share/hosted-session-share.js +14 -47
- package/dist/src/share/share-auto.d.ts +1 -1
- package/dist/src/share/share-auto.js +2 -2
- package/dist/src/share/share-store.d.ts +2 -7
- package/dist/src/share/share-store.js +153 -195
- package/dist/src/share/share-types.d.ts +0 -4
- package/dist/src/share/site-share-store.d.ts +3 -8
- package/dist/src/share/site-share-store.js +94 -153
- package/dist/src/share/site-share-types.d.ts +0 -4
- 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/connection.d.ts +1 -2
- package/dist/src/storage/sqlite/connection.js +50 -47
- 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/durable-queue.d.ts +16 -0
- package/dist/src/storage/sqlite/durable-queue.js +52 -0
- package/dist/src/storage/sqlite/durable-state.d.ts +16 -0
- package/dist/src/storage/sqlite/durable-state.js +43 -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/146_understanding_focus_exclusions.sql +9 -0
- package/dist/src/storage/sqlite/migrations/147_durable_application_state.sql +39 -0
- 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-scoped-models.js +9 -6
- 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/agentEngine.js +63 -18
- package/dist/src/voice/realtime/conversationTurn.d.ts +20 -0
- package/dist/src/voice/realtime/conversationTurn.js +83 -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/voice/realtime/omniEngine.js +72 -18
- 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/authoring/workflow-draft-store.d.ts +1 -5
- package/dist/src/workflows/authoring/workflow-draft-store.js +23 -43
- package/dist/src/workflows/index.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/dist/src/workflows/service/workflow-session-bridge.js +12 -20
- package/dist/src/workflows/store/event-store.d.ts +1 -2
- package/dist/src/workflows/store/event-store.js +19 -64
- package/dist/src/workflows/store/paths.d.ts +0 -2
- package/dist/src/workflows/store/paths.js +1 -7
- package/dist/src/workflows/store/run-store.d.ts +0 -1
- package/dist/src/workflows/store/run-store.js +1 -24
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-eG49pM-z.js +0 -1
- package/dist/gateway/static/root/assets/agents-CZwf1mgZ.js +0 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-BODskFTb.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-DeaVvaYZ.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-BZG3BK7f.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-CB7Yl2_B.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-Bu42Ljfw.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Cg7zCxEH.js +0 -7
- package/dist/gateway/static/root/assets/channels-settings-EDTZ8P3y.js +0 -1
- package/dist/gateway/static/root/assets/cloud-C4-yfnnk.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-kh7PEkSS.js +0 -2
- package/dist/gateway/static/root/assets/dependency-picker-oi7cdv2C.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-D9OO-exo.js +0 -1
- package/dist/gateway/static/root/assets/ellipsis-0k4rZLoy.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-FTD7nE8v.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-c-8ENciH.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-BxvyTRl0.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-C1S2Ccui.js +0 -1
- package/dist/gateway/static/root/assets/home-page-Bqx-SMWV.js +0 -1
- package/dist/gateway/static/root/assets/index-Cif1_3Jx.js +0 -71
- package/dist/gateway/static/root/assets/index-Dbh5SXyV.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-sDdw7Y3Q.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-DUsxXdDp.js +0 -2
- package/dist/gateway/static/root/assets/message-square-plus-XP0tGdlV.js +0 -1
- package/dist/gateway/static/root/assets/messages-BbdwoxVo.js +0 -3
- package/dist/gateway/static/root/assets/minimize-2-DtOGrlpo.js +0 -1
- package/dist/gateway/static/root/assets/mobile-pairing-wizard-Dv87XewB.js +0 -1
- package/dist/gateway/static/root/assets/models-hub-cache-88f4fzYS.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-DOe0lOcQ.js +0 -1
- package/dist/gateway/static/root/assets/notes-workbench-Cy0oYbWP.js +0 -4
- package/dist/gateway/static/root/assets/oauth-api-BjSUDIgq.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-fgD1xc4O.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-CiTiEcOc.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Dc0GrNSp.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-BPOW3yaM.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Bz4s9BBY.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-rllj-j7k.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DMj7onCX.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DRB366nS.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-cBT9jCof.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-Byrk4DQy.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-CheX3zmK.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-jKzujxFU.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-CWy3Pqtk.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-DE4_YpDn.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-y4O9-BTf.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 -443
- 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/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,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,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;
|
|
@@ -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 };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { getSqliteDatabase, runSqliteWriteTransaction } from "./transaction.js";
|
|
2
|
+
import { cancelConnectionObjective } from "./connection-wait-repository.js";
|
|
2
3
|
import { notifyUserContextChange } from "../../user-context/changes.js";
|
|
3
|
-
import { buildFts5SearchQuery } from "./fts.js";
|
|
4
4
|
import { validateSessionId } from "../../session/session-id.js";
|
|
5
5
|
import { buildDefaultSessionMetadata } from "./session-metadata.js";
|
|
6
6
|
import { buildGlobalSessionStats, metadataToSessionInsert, sessionRowToMetadata } from "./row-mappers.js";
|
|
7
|
+
import { buildFts5SearchQuery } from "./fts.js";
|
|
7
8
|
import { randomUUID } from "node:crypto";
|
|
8
9
|
//#region src/storage/sqlite/session-repository.ts
|
|
9
10
|
const SESSION_COLUMNS = `
|
|
@@ -254,6 +255,7 @@ function resetSessionRecord(sessionKey, cwd) {
|
|
|
254
255
|
return runSqliteWriteTransaction((db) => {
|
|
255
256
|
const existing = readSessionRow(db, sessionKey);
|
|
256
257
|
if (!existing) return null;
|
|
258
|
+
cancelConnectionObjective(sessionKey);
|
|
257
259
|
const previousSessionId = existing.session_id;
|
|
258
260
|
const now = Date.now();
|
|
259
261
|
db.prepare(`UPDATE transcripts SET status = 'archived', archive_reason = 'reset', archived_at = ?
|
|
@@ -286,6 +288,7 @@ function deleteSessionRecord(sessionKey) {
|
|
|
286
288
|
const now = Date.now();
|
|
287
289
|
db.prepare(`UPDATE transcripts SET status = 'archived', archive_reason = 'delete', archived_at = ?
|
|
288
290
|
WHERE session_id = ?`).run(now, existing.session_id);
|
|
291
|
+
cancelConnectionObjective(sessionKey);
|
|
289
292
|
db.prepare(`DELETE FROM sessions WHERE session_key = ?`).run(sessionKey);
|
|
290
293
|
return true;
|
|
291
294
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getSqliteDatabase, runSqliteWriteTransaction } from "./transaction.js";
|
|
2
|
-
import { escapeFts5Query } from "./fts.js";
|
|
3
2
|
import { buildSessionContextForLlm, isRuntimeOnlyTranscriptMessage } from "../../session/session-context-for-llm.js";
|
|
4
3
|
import { classifyStoredRow, estimateTokensFromMessages, extractFtsContent, transcriptEntryRowToStoredRow } from "./row-mappers.js";
|
|
4
|
+
import { escapeFts5Query } from "./fts.js";
|
|
5
5
|
import { getCurrentSessionId, readCurrentSessionId } from "./session-repository.js";
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
7
7
|
//#region src/storage/sqlite/transcript-repository.ts
|
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";
|
|
@@ -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";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getSqliteDatabase, runSqliteWriteTransaction } from "../storage/sqlite/transaction.js";
|
|
2
|
-
import { TaskRepository } from "./task-repository.js";
|
|
3
2
|
import { enqueueTaskAttentionRequiredEvent, enqueueTaskChangedEvent } from "./task-change-events.js";
|
|
4
3
|
import { TaskRunRepository } from "./task-run-repository.js";
|
|
4
|
+
import { TaskRepository } from "./task-repository.js";
|
|
5
5
|
import { TaskReadModelProjector } from "./task-read-model-projector.js";
|
|
6
6
|
import { TaskContextRepository } from "./task-context-repository.js";
|
|
7
7
|
import { TaskDependencyService } from "./task-dependency-service.js";
|
|
@@ -252,6 +252,11 @@ var TaskApplicationService = class {
|
|
|
252
252
|
reason: "not_found",
|
|
253
253
|
model
|
|
254
254
|
};
|
|
255
|
+
else if (wait.condition.type === "connection") result = {
|
|
256
|
+
ok: false,
|
|
257
|
+
reason: "invalid_transition",
|
|
258
|
+
model
|
|
259
|
+
};
|
|
255
260
|
else {
|
|
256
261
|
this.#runs.resolveWait({
|
|
257
262
|
waitId: wait.id,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isXopcDatabaseOpen } from "../storage/sqlite/connection.js";
|
|
2
|
+
import { TaskRunRepository } from "./task-run-repository.js";
|
|
2
3
|
import "../storage/sqlite/index.js";
|
|
3
4
|
import { TaskRepository } from "./task-repository.js";
|
|
4
5
|
import { TaskConversationRepository } from "./task-conversation-repository.js";
|
|
5
|
-
import { TaskRunRepository } from "./task-run-repository.js";
|
|
6
6
|
import { TaskContextRepository } from "./task-context-repository.js";
|
|
7
7
|
//#region src/tasks/task-context-assembler.ts
|
|
8
8
|
const STANDARD = {
|
|
@@ -6,7 +6,6 @@ export declare class TaskContextRepository {
|
|
|
6
6
|
query: string;
|
|
7
7
|
selectedItems?: unknown[];
|
|
8
8
|
rejectedItems?: unknown[];
|
|
9
|
-
consentRequests?: unknown[];
|
|
10
9
|
relationshipPolicy?: Record<string, unknown>;
|
|
11
10
|
authorizationSnapshot?: Record<string, unknown>;
|
|
12
11
|
sessionKey?: string;
|
|
@@ -38,7 +38,7 @@ var TaskContextRepository = class {
|
|
|
38
38
|
selected_items_json, rejected_items_json, consent_requests_json,
|
|
39
39
|
relationship_policy_json, estimated_tokens, allocation_json,
|
|
40
40
|
authorization_snapshot_json, content_hash, created_at
|
|
41
|
-
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(id, traceId, input.ownerKind, input.ownerId, input.sessionKey ?? null, input.query, JSON.stringify(input.selectedItems ?? []), JSON.stringify(input.rejectedItems ?? []),
|
|
41
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`).run(id, traceId, input.ownerKind, input.ownerId, input.sessionKey ?? null, input.query, JSON.stringify(input.selectedItems ?? []), JSON.stringify(input.rejectedItems ?? []), "[]", JSON.stringify(input.relationshipPolicy ?? {}), input.estimatedTokens ?? 0, input.allocation ? JSON.stringify(input.allocation) : null, JSON.stringify(input.authorizationSnapshot ?? {}), input.contentHash ?? null, input.now ?? Date.now());
|
|
42
42
|
return {
|
|
43
43
|
id,
|
|
44
44
|
traceId
|
|
@@ -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
|
//#region src/tasks/task-deletion-service.ts
|
|
4
4
|
var TaskDeletionService = class {
|
|
5
5
|
constructor(tasks = new TaskRepository(), runs = new TaskRunRepository()) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
+
import { TaskRunRepository } from "./task-run-repository.js";
|
|
3
4
|
import { init_agent_scope, listAgentEntries, normalizeAgentId } from "../agent/agent-scope.js";
|
|
4
5
|
import { buildSessionKey, init_session_key, sanitizeSegment } from "../routing/session-key.js";
|
|
5
6
|
import { TaskRepository } from "./task-repository.js";
|
|
6
7
|
import { TaskConversationRepository } from "./task-conversation-repository.js";
|
|
7
|
-
import { TaskRunRepository } from "./task-run-repository.js";
|
|
8
8
|
import { TaskContextRepository } from "./task-context-repository.js";
|
|
9
9
|
//#region src/tasks/task-handoff-service.ts
|
|
10
10
|
init_agent_scope();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getSqliteDatabase } from "../storage/sqlite/transaction.js";
|
|
2
|
-
import { TaskRepository } from "./task-repository.js";
|
|
3
2
|
import { TaskRunRepository } from "./task-run-repository.js";
|
|
3
|
+
import { TaskRepository } from "./task-repository.js";
|
|
4
4
|
//#region src/tasks/task-read-model-projector.ts
|
|
5
5
|
var TaskReadModelProjector = class {
|
|
6
6
|
#tasks = new TaskRepository();
|
|
@@ -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 { TaskContextRepository } from "./task-context-repository.js";
|
|
4
4
|
import { TaskApplicationService } from "./task-application-service.js";
|
|
5
5
|
//#region src/tasks/task-run-coordinator.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
-
import { TaskRepository } from "./task-repository.js";
|
|
4
3
|
import { TaskRunRepository } from "./task-run-repository.js";
|
|
4
|
+
import { TaskRepository } from "./task-repository.js";
|
|
5
5
|
import { TaskApplicationService } from "./task-application-service.js";
|
|
6
6
|
//#region src/tasks/task-run-dispatcher.ts
|
|
7
7
|
init_logger();
|
|
@@ -137,6 +137,7 @@ var TaskRunRepository = class {
|
|
|
137
137
|
WHERE wait.task_run_id = task_runs.run_id AND wait.status = 'active'
|
|
138
138
|
))
|
|
139
139
|
)
|
|
140
|
+
AND NOT EXISTS (SELECT 1 FROM session_inputs input WHERE input.task_run_id = task_runs.run_id AND input.status IN ('queued','running'))
|
|
140
141
|
AND (? IS NULL OR executor_kind = ?)
|
|
141
142
|
AND COALESCE(scheduled_at, 0) <= ?
|
|
142
143
|
AND (lease_expires_at IS NULL OR lease_expires_at <= ?)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getSqliteDatabase } from "../storage/sqlite/transaction.js";
|
|
2
2
|
import { TaskExecutorSelectionSchema } from "../../packages/gateway-contract/src/tasks.js";
|
|
3
|
-
import { TaskRepository } from "./task-repository.js";
|
|
4
3
|
import { TaskRunRepository } from "./task-run-repository.js";
|
|
4
|
+
import { TaskRepository } from "./task-repository.js";
|
|
5
5
|
import { TaskApplicationService } from "./task-application-service.js";
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
7
7
|
//#region src/tasks/task-signal-service.ts
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { init_paths_state, resolveStateDir } from "../config/paths-state.js";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
4
|
//#region src/tui/tui-scoped-models.ts
|
|
5
|
-
|
|
5
|
+
init_paths_state();
|
|
6
|
+
function storePath() {
|
|
7
|
+
return join(resolveStateDir(), "tui-scoped-models.json");
|
|
8
|
+
}
|
|
6
9
|
function normalizeWorkspaceKey(cwd) {
|
|
7
10
|
return cwd.replace(/\\/g, "/").replace(/\/+$/, "") || "/";
|
|
8
11
|
}
|
|
9
12
|
function readStore() {
|
|
10
13
|
try {
|
|
11
|
-
if (!existsSync(
|
|
12
|
-
const raw = readFileSync(
|
|
14
|
+
if (!existsSync(storePath())) return {};
|
|
15
|
+
const raw = readFileSync(storePath(), "utf8");
|
|
13
16
|
const parsed = JSON.parse(raw);
|
|
14
17
|
return parsed && typeof parsed === "object" ? parsed : {};
|
|
15
18
|
} catch {
|
|
@@ -17,9 +20,9 @@ function readStore() {
|
|
|
17
20
|
}
|
|
18
21
|
}
|
|
19
22
|
function writeStore(data) {
|
|
20
|
-
const dir =
|
|
23
|
+
const dir = resolveStateDir();
|
|
21
24
|
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
|
22
|
-
writeFileSync(
|
|
25
|
+
writeFileSync(storePath(), `${JSON.stringify(data, null, 2)}\n`, "utf8");
|
|
23
26
|
}
|
|
24
27
|
/** Load scoped model refs for Ctrl+P cycling (`null` = all models). */
|
|
25
28
|
function loadScopedModelRefs(cwd = process.cwd()) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface UserContextChange {
|
|
2
|
-
kind: '
|
|
2
|
+
kind: 'policy' | 'session' | 'session-reset';
|
|
3
3
|
id?: string;
|
|
4
4
|
}
|
|
5
5
|
export declare function onUserContextChange(listener: (change: UserContextChange) => void): () => void;
|