@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,7 +1,7 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { finishContextExtractionRun } from "../../storage/sqlite/context-extraction-repository.js";
|
|
4
|
-
import {
|
|
4
|
+
import { getSessionMetadata } from "../../storage/sqlite/session-repository.js";
|
|
5
5
|
import { loadCompactionSourceSnapshot } from "../../storage/sqlite/transcript-repository.js";
|
|
6
6
|
import "../../storage/sqlite/index.js";
|
|
7
7
|
import { extractProfileAgentId } from "../../config/agent-profile.js";
|
|
@@ -9,20 +9,22 @@ import { init_sync_provider_auth, resolveProviderApiKeySync } from "../../auth/s
|
|
|
9
9
|
import { getApiKeySync, init_providers, resolveModel } from "../../providers/index.js";
|
|
10
10
|
import { createExtensionAwareStreamFn } from "../../providers/extension-stream-bridge.js";
|
|
11
11
|
import { extractTextContent } from "../context/workspace.js";
|
|
12
|
+
import { listUserAssertions } from "../../user-model/repository.js";
|
|
12
13
|
import { readAgentMessageContent } from "../memory/agent-message-access.js";
|
|
13
14
|
import { isAssistantTurnAborted, isAssistantTurnFailed } from "../orchestration/llm-turn-retry.js";
|
|
14
15
|
import { resolveAgentTurnTimeoutMs, runAgentTurnWithTimeout } from "../orchestration/run-agent-turn-with-timeout.js";
|
|
15
|
-
import { claimRegisteredExtraction } from "../../user-context/extraction/registry.js";
|
|
16
16
|
import { resolveModelIntentRef } from "../../config/agent-model-intents.js";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
17
|
+
import { claimRegisteredExtraction } from "../../user-context/extraction/registry.js";
|
|
18
|
+
import { emptyUserModelCaptureResult, executeUserModelInterpretation } from "../../user-model/capture/executor.js";
|
|
19
|
+
import { parseUserModelInterpretation } from "../../user-model/capture/semantic.js";
|
|
20
|
+
import "../../user-model/capture/index.js";
|
|
21
|
+
import { USER_MODEL_INTERPRETER_SYSTEM_PROMPT, buildUserModelInterpreterPrompt } from "./prompts.js";
|
|
20
22
|
import { Agent } from "@earendil-works/pi-agent-core";
|
|
21
23
|
//#region src/agent/background-review/run-background-review.ts
|
|
22
24
|
init_sync_provider_auth();
|
|
23
25
|
init_providers();
|
|
24
26
|
init_logger();
|
|
25
|
-
const log = createLogger("
|
|
27
|
+
const log = createLogger("UserModelInterpreter");
|
|
26
28
|
function isReviewMessage(value) {
|
|
27
29
|
if (!value || typeof value !== "object") return false;
|
|
28
30
|
const role = value.role;
|
|
@@ -91,7 +93,7 @@ function isLocalModel(model) {
|
|
|
91
93
|
}
|
|
92
94
|
function resolveInterpreterRuntime(params) {
|
|
93
95
|
const config = params.getConfig();
|
|
94
|
-
const processingPolicy = config?.userContext.
|
|
96
|
+
const processingPolicy = config?.userContext.userModel.processingPolicy ?? "remote_allowed";
|
|
95
97
|
let model;
|
|
96
98
|
if (config) {
|
|
97
99
|
const agentId = extractProfileAgentId(params.sessionKey, config);
|
|
@@ -124,7 +126,7 @@ function resolveInterpreterRuntime(params) {
|
|
|
124
126
|
async function interpret(params) {
|
|
125
127
|
const reviewAgent = new Agent({
|
|
126
128
|
initialState: {
|
|
127
|
-
systemPrompt:
|
|
129
|
+
systemPrompt: USER_MODEL_INTERPRETER_SYSTEM_PROMPT,
|
|
128
130
|
model: params.model,
|
|
129
131
|
thinkingLevel: "off",
|
|
130
132
|
tools: [],
|
|
@@ -136,11 +138,14 @@ async function interpret(params) {
|
|
|
136
138
|
reviewAgent.state.messages = params.evidence.map(tagMessage);
|
|
137
139
|
try {
|
|
138
140
|
await runAgentTurnWithTimeout(reviewAgent, async () => {
|
|
141
|
+
const timezone = params.getConfig()?.userContext.userModel.maintenance.timezone ?? Intl.DateTimeFormat().resolvedOptions().timeZone ?? "UTC";
|
|
139
142
|
await reviewAgent.prompt({
|
|
140
143
|
role: "user",
|
|
141
|
-
content:
|
|
144
|
+
content: buildUserModelInterpreterPrompt({
|
|
142
145
|
mode: params.mode,
|
|
143
|
-
availableTargets: params.availableTargets
|
|
146
|
+
availableTargets: params.availableTargets,
|
|
147
|
+
evidenceTimestamp: new Date(params.evidence.at(-1)?.createdAt ?? Date.now()).toISOString(),
|
|
148
|
+
timezone
|
|
144
149
|
}),
|
|
145
150
|
timestamp: Date.now()
|
|
146
151
|
});
|
|
@@ -156,11 +161,11 @@ async function interpret(params) {
|
|
|
156
161
|
return null;
|
|
157
162
|
}
|
|
158
163
|
if (isAssistantTurnAborted(reviewAgent) || isAssistantTurnFailed(reviewAgent)) return null;
|
|
159
|
-
return
|
|
164
|
+
return parseUserModelInterpretation(lastAssistantText(reviewAgent), params.evidence, params.availableTargets.map((item) => item.id));
|
|
160
165
|
}
|
|
161
166
|
async function executeReview(params) {
|
|
162
167
|
const runtime = resolveInterpreterRuntime(params);
|
|
163
|
-
if (!runtime) return
|
|
168
|
+
if (!runtime) return emptyUserModelCaptureResult();
|
|
164
169
|
const extraction = claimRegisteredExtraction({
|
|
165
170
|
extractorId: params.extractorId,
|
|
166
171
|
sourceRef: params.sourceRef,
|
|
@@ -168,7 +173,7 @@ async function executeReview(params) {
|
|
|
168
173
|
processingPolicy: runtime.processingPolicy,
|
|
169
174
|
destination: runtime.destination
|
|
170
175
|
});
|
|
171
|
-
if (!extraction.shouldExecute) return
|
|
176
|
+
if (!extraction.shouldExecute) return emptyUserModelCaptureResult();
|
|
172
177
|
const interpretation = await interpret({
|
|
173
178
|
...params,
|
|
174
179
|
model: runtime.model
|
|
@@ -179,32 +184,36 @@ async function executeReview(params) {
|
|
|
179
184
|
status: "failed",
|
|
180
185
|
errorCode: "model_or_schema_failed"
|
|
181
186
|
});
|
|
182
|
-
return
|
|
187
|
+
return emptyUserModelCaptureResult();
|
|
183
188
|
}
|
|
184
189
|
try {
|
|
185
|
-
const
|
|
190
|
+
const config = params.getConfig();
|
|
191
|
+
const agentId = config ? extractProfileAgentId(params.sessionKey, config) : "main";
|
|
192
|
+
const write = config?.userContext.userModel.writePolicy ?? "deny";
|
|
193
|
+
const result = executeUserModelInterpretation({
|
|
186
194
|
interpretation,
|
|
187
195
|
evidence: params.evidence,
|
|
188
196
|
extractionRunId: extraction.run.id,
|
|
189
197
|
extractorId: params.extractorId,
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
198
|
+
scopeContext: {
|
|
199
|
+
sessionId: params.sessionKey,
|
|
200
|
+
agentId,
|
|
201
|
+
workspaceId: params.workspaceId,
|
|
202
|
+
...getSessionMetadata(params.sessionKey)?.projectId ? { projectId: getSessionMetadata(params.sessionKey).projectId } : {}
|
|
203
|
+
},
|
|
204
|
+
policy: {
|
|
205
|
+
write,
|
|
206
|
+
sensitiveWrite: config?.userContext.userModel.sensitiveWritePolicy ?? "confirm",
|
|
207
|
+
processing: runtime.processingPolicy
|
|
208
|
+
},
|
|
209
|
+
...params.turnId ? { turnId: params.turnId } : {}
|
|
196
210
|
});
|
|
197
211
|
finishContextExtractionRun({
|
|
198
212
|
runId: extraction.run.id,
|
|
199
213
|
status: "completed",
|
|
200
|
-
outputs: result.
|
|
214
|
+
outputs: result.outputs.map((output) => ({
|
|
201
215
|
candidateKey: output.candidateKey,
|
|
202
|
-
|
|
203
|
-
objectType: "understanding",
|
|
204
|
-
objectId: output.objectId
|
|
205
|
-
} : {},
|
|
206
|
-
...output.versionId ? { versionId: output.versionId } : {},
|
|
207
|
-
outcome: output.outcome
|
|
216
|
+
outcome: output.outcome === "deduplicated" ? "deduplicated" : output.outcome === "rejected" ? "rejected" : "created"
|
|
208
217
|
}))
|
|
209
218
|
});
|
|
210
219
|
return result;
|
|
@@ -217,20 +226,17 @@ async function executeReview(params) {
|
|
|
217
226
|
throw err;
|
|
218
227
|
}
|
|
219
228
|
}
|
|
220
|
-
async function
|
|
229
|
+
async function runTurnUserModelCapture(params) {
|
|
221
230
|
const evidence = loadEvidenceMessages(params.sessionKey, params.maxHistoryMessages ?? 12);
|
|
222
|
-
if (!evidence.length) return
|
|
223
|
-
const availableTargets =
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
statement: item.content
|
|
228
|
-
}];
|
|
229
|
-
}) ?? [];
|
|
231
|
+
if (!evidence.length) return emptyUserModelCaptureResult();
|
|
232
|
+
const availableTargets = listUserAssertions({ limit: 200 }).map((item) => ({
|
|
233
|
+
id: item.id,
|
|
234
|
+
statement: item.statement
|
|
235
|
+
}));
|
|
230
236
|
return executeReview({
|
|
231
237
|
sessionKey: params.sessionKey,
|
|
232
238
|
mainAgent: params.mainAgent,
|
|
233
|
-
|
|
239
|
+
workspaceId: params.workspaceId,
|
|
234
240
|
getConfig: params.getConfig,
|
|
235
241
|
evidence,
|
|
236
242
|
mode: "turn",
|
|
@@ -242,7 +248,7 @@ async function runTurnUnderstandingReview(params) {
|
|
|
242
248
|
turnId: params.turnId
|
|
243
249
|
});
|
|
244
250
|
}
|
|
245
|
-
async function
|
|
251
|
+
async function runBackgroundUserModelReview(params) {
|
|
246
252
|
const evidence = loadEvidenceMessages(params.sessionKey, params.settings.maxHistoryMessages);
|
|
247
253
|
if (!evidence.length) return;
|
|
248
254
|
const first = evidence[0];
|
|
@@ -250,7 +256,7 @@ async function runBackgroundReviewTurn(params) {
|
|
|
250
256
|
await executeReview({
|
|
251
257
|
sessionKey: params.sessionKey,
|
|
252
258
|
mainAgent: params.mainAgent,
|
|
253
|
-
|
|
259
|
+
workspaceId: params.workspaceId,
|
|
254
260
|
getConfig: params.getConfig,
|
|
255
261
|
evidence,
|
|
256
262
|
mode: "transcript",
|
|
@@ -262,4 +268,4 @@ async function runBackgroundReviewTurn(params) {
|
|
|
262
268
|
});
|
|
263
269
|
}
|
|
264
270
|
//#endregion
|
|
265
|
-
export {
|
|
271
|
+
export { runBackgroundUserModelReview, runTurnUserModelCapture };
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
//#region src/agent/background-review/settings.ts
|
|
2
2
|
const DEFAULT_SETTINGS = {
|
|
3
3
|
enabled: false,
|
|
4
|
-
adaptiveCadence: true,
|
|
5
4
|
reviewIntervalTurns: 10,
|
|
6
5
|
maxHistoryMessages: 80,
|
|
7
6
|
maxDurationMs: 12e4
|
|
8
7
|
};
|
|
9
8
|
function resolveBackgroundReviewSettings(config) {
|
|
10
9
|
if (!config) return DEFAULT_SETTINGS;
|
|
11
|
-
const
|
|
10
|
+
const userModel = config.userContext.userModel;
|
|
11
|
+
const extraction = userModel.extraction;
|
|
12
12
|
return {
|
|
13
|
-
enabled: config.userContext.enabled &&
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
maxDurationMs: understanding.maxDurationMs
|
|
13
|
+
enabled: config.userContext.enabled && userModel.enabled,
|
|
14
|
+
reviewIntervalTurns: extraction.reviewIntervalTurns,
|
|
15
|
+
maxHistoryMessages: extraction.maxHistoryMessages,
|
|
16
|
+
maxDurationMs: extraction.maxDurationMs
|
|
18
17
|
};
|
|
19
18
|
}
|
|
20
19
|
//#endregion
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { resolveStateDir } from "../../config/paths-state.js";
|
|
2
2
|
import { resolveGlobalSingleton } from "../../utils/global-singleton.js";
|
|
3
3
|
import { init_paths } from "../../config/paths.js";
|
|
4
|
+
import { DurableState } from "../../storage/sqlite/durable-state.js";
|
|
4
5
|
import { isolatedCommand, removeCommandContainer } from "./command-isolation.js";
|
|
5
6
|
import { readWorkspaceRevision } from "../coding/workspace-revision.js";
|
|
6
7
|
import { join } from "node:path";
|
|
7
|
-
import { appendFileSync, mkdirSync,
|
|
8
|
+
import { appendFileSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
8
9
|
import { spawn } from "node:child_process";
|
|
9
10
|
import { createHash, randomUUID } from "node:crypto";
|
|
10
11
|
//#region src/agent/commands/command-registry.ts
|
|
@@ -46,9 +47,10 @@ var CommandRegistry = class {
|
|
|
46
47
|
return join(this.root, createHash("sha256").update(owner).digest("hex"));
|
|
47
48
|
}
|
|
48
49
|
persist(owner, result) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
this.receipts(owner).set(result.id, result);
|
|
51
|
+
}
|
|
52
|
+
receipts(owner) {
|
|
53
|
+
return new DurableState("command-receipts", owner);
|
|
52
54
|
}
|
|
53
55
|
async start(input) {
|
|
54
56
|
input.signal?.throwIfAborted();
|
|
@@ -174,16 +176,15 @@ var CommandRegistry = class {
|
|
|
174
176
|
...current.result,
|
|
175
177
|
durationMs: Date.now() - current.result.createdAtMs
|
|
176
178
|
} : void 0;
|
|
177
|
-
|
|
178
|
-
const result =
|
|
179
|
+
{
|
|
180
|
+
const result = this.receipts(owner).get(id);
|
|
181
|
+
if (!result) return void 0;
|
|
179
182
|
if (result.status === "running") {
|
|
180
183
|
result.status = "interrupted";
|
|
181
184
|
result.stderr += "\nRuntime ownership was lost. Process/container state is unknown; inspect before restarting.";
|
|
182
185
|
this.persist(owner, result);
|
|
183
186
|
}
|
|
184
187
|
return result;
|
|
185
|
-
} catch {
|
|
186
|
-
return;
|
|
187
188
|
}
|
|
188
189
|
}
|
|
189
190
|
async wait(owner, id, waitMs = 3e4, signal) {
|
|
@@ -225,27 +226,16 @@ var CommandRegistry = class {
|
|
|
225
226
|
if (Date.now() - (this.prunedAt.get(owner) ?? 0) < 6e4) return;
|
|
226
227
|
this.prunedAt.set(owner, Date.now());
|
|
227
228
|
const directory = this.directory(owner);
|
|
228
|
-
const completed =
|
|
229
|
-
try {
|
|
230
|
-
const job = JSON.parse(readFileSync(join(directory, file), "utf8"));
|
|
231
|
-
return this.running.has(job.id) || job.status === "running" ? [] : [job];
|
|
232
|
-
} catch {
|
|
233
|
-
return [];
|
|
234
|
-
}
|
|
235
|
-
}).sort((a, b) => b.createdAtMs - a.createdAtMs);
|
|
229
|
+
const completed = this.receipts(owner).values().filter((job) => !this.running.has(job.id) && job.status !== "running").sort((a, b) => b.createdAtMs - a.createdAtMs);
|
|
236
230
|
for (const [index, job] of completed.entries()) {
|
|
237
231
|
if (index < 500 && Date.now() - job.createdAtMs < 10080 * 6e4) continue;
|
|
238
232
|
if (!/^[\da-f-]{36}$/.test(job.id)) continue;
|
|
239
|
-
|
|
233
|
+
this.receipts(owner).delete(job.id);
|
|
240
234
|
rmSync(join(directory, `${job.id}.log`), { force: true });
|
|
241
235
|
}
|
|
242
236
|
}
|
|
243
237
|
list(owner) {
|
|
244
|
-
|
|
245
|
-
return readdirSync(this.directory(owner)).filter((file) => file.endsWith(".json")).map((file) => this.get(owner, file.slice(0, -5))).filter((job) => !!job).sort((a, b) => b.createdAtMs - a.createdAtMs).slice(0, 50);
|
|
246
|
-
} catch {
|
|
247
|
-
return [];
|
|
248
|
-
}
|
|
238
|
+
return this.receipts(owner).entries().map(([id]) => this.get(owner, id)).filter((job) => !!job).sort((a, b) => b.createdAtMs - a.createdAtMs).slice(0, 50);
|
|
249
239
|
}
|
|
250
240
|
};
|
|
251
241
|
function commandRegistry() {
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ExecutionContext } from './execution-context.js';
|
|
2
|
+
export interface ExecutionContextBudget {
|
|
3
|
+
maxAssertions: number;
|
|
4
|
+
maxKnowledge: number;
|
|
5
|
+
maxChars: number;
|
|
6
|
+
}
|
|
7
|
+
export interface ExecutionContextAudit {
|
|
8
|
+
runId: string;
|
|
9
|
+
principalId: string;
|
|
10
|
+
turnId: string;
|
|
11
|
+
sessionId: string;
|
|
12
|
+
queryHash: string;
|
|
13
|
+
asOf: number;
|
|
14
|
+
budget: ExecutionContextBudget;
|
|
15
|
+
metrics: Record<string, number>;
|
|
16
|
+
items: Array<{
|
|
17
|
+
objectType: 'rule' | 'assertion' | 'goal' | 'priority' | 'knowledge';
|
|
18
|
+
objectId: string;
|
|
19
|
+
score?: number;
|
|
20
|
+
reasons: string[];
|
|
21
|
+
included: boolean;
|
|
22
|
+
}>;
|
|
23
|
+
createdAt: number;
|
|
24
|
+
}
|
|
25
|
+
export declare function recordExecutionContext(context: ExecutionContext, input: {
|
|
26
|
+
turnId: string;
|
|
27
|
+
sessionId: string;
|
|
28
|
+
budget: ExecutionContextBudget;
|
|
29
|
+
renderedChars: number;
|
|
30
|
+
}): void;
|
|
31
|
+
export declare function getExecutionContextAudit(turnId: string): ExecutionContextAudit | undefined;
|
|
32
|
+
export declare function recordExecutionContextFeedback(input: {
|
|
33
|
+
turnId: string;
|
|
34
|
+
rating: 'helpful' | 'irrelevant';
|
|
35
|
+
reason?: string;
|
|
36
|
+
}): boolean;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { getSqliteDatabase, runSqliteWriteTransaction } from "../../storage/sqlite/transaction.js";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
//#region src/agent/context/audit.ts
|
|
4
|
+
function recordExecutionContext(context, input) {
|
|
5
|
+
const createdAt = Date.now();
|
|
6
|
+
const items = [
|
|
7
|
+
...context.rules.map((item) => ({
|
|
8
|
+
objectType: "rule",
|
|
9
|
+
objectId: item.id,
|
|
10
|
+
reasons: [`${item.enforcementLevel}_rule`],
|
|
11
|
+
included: true
|
|
12
|
+
})),
|
|
13
|
+
...context.assertions.map((item) => ({
|
|
14
|
+
objectType: "assertion",
|
|
15
|
+
objectId: item.assertion.id,
|
|
16
|
+
score: item.score,
|
|
17
|
+
reasons: item.reasons,
|
|
18
|
+
included: true
|
|
19
|
+
})),
|
|
20
|
+
...context.goals.map((item) => ({
|
|
21
|
+
objectType: "goal",
|
|
22
|
+
objectId: item.id,
|
|
23
|
+
reasons: ["active_goal"],
|
|
24
|
+
included: true
|
|
25
|
+
})),
|
|
26
|
+
...context.priorities.map((item) => ({
|
|
27
|
+
objectType: "priority",
|
|
28
|
+
objectId: item.id,
|
|
29
|
+
score: item.urgency,
|
|
30
|
+
reasons: [`${item.rank}_priority`],
|
|
31
|
+
included: true
|
|
32
|
+
})),
|
|
33
|
+
...context.knowledge.map((item) => ({
|
|
34
|
+
objectType: "knowledge",
|
|
35
|
+
objectId: item.id,
|
|
36
|
+
score: item.importance,
|
|
37
|
+
reasons: ["task_relevant_knowledge"],
|
|
38
|
+
included: true
|
|
39
|
+
}))
|
|
40
|
+
];
|
|
41
|
+
const metrics = {
|
|
42
|
+
rules: context.rules.length,
|
|
43
|
+
assertions: context.assertions.length,
|
|
44
|
+
goals: context.goals.length,
|
|
45
|
+
priorities: context.priorities.length,
|
|
46
|
+
knowledge: context.knowledge.length,
|
|
47
|
+
renderedChars: input.renderedChars
|
|
48
|
+
};
|
|
49
|
+
runSqliteWriteTransaction((db) => {
|
|
50
|
+
if (db.prepare("SELECT 1 FROM execution_context_runs WHERE turn_id = ?").get(input.turnId)) return;
|
|
51
|
+
db.prepare(`INSERT INTO execution_context_runs (
|
|
52
|
+
run_id, principal_id, turn_id, session_id, query_hash, as_of,
|
|
53
|
+
budget_json, metrics_json, created_at
|
|
54
|
+
) VALUES (?, 'local-owner', ?, ?, ?, ?, ?, ?, ?)`).run(context.traceId, input.turnId, input.sessionId, createHash("sha256").update(context.query).digest("hex"), context.asOf, JSON.stringify(input.budget), JSON.stringify(metrics), createdAt);
|
|
55
|
+
const insert = db.prepare(`INSERT INTO execution_context_items (
|
|
56
|
+
run_id, object_type, object_id, score, reasons_json, included, created_at
|
|
57
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?)`);
|
|
58
|
+
for (const item of items) insert.run(context.traceId, item.objectType, item.objectId, item.score ?? null, JSON.stringify(item.reasons), item.included ? 1 : 0, createdAt);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function getExecutionContextAudit(turnId) {
|
|
62
|
+
const db = getSqliteDatabase();
|
|
63
|
+
const run = db.prepare("SELECT * FROM execution_context_runs WHERE turn_id = ?").get(turnId);
|
|
64
|
+
if (!run) return void 0;
|
|
65
|
+
const rows = db.prepare(`SELECT object_type, object_id, score, reasons_json, included
|
|
66
|
+
FROM execution_context_items WHERE run_id = ? ORDER BY rowid`).all(run.run_id);
|
|
67
|
+
return {
|
|
68
|
+
runId: run.run_id,
|
|
69
|
+
principalId: run.principal_id,
|
|
70
|
+
turnId: run.turn_id,
|
|
71
|
+
sessionId: run.session_id,
|
|
72
|
+
queryHash: run.query_hash,
|
|
73
|
+
asOf: run.as_of,
|
|
74
|
+
budget: JSON.parse(run.budget_json),
|
|
75
|
+
metrics: JSON.parse(run.metrics_json),
|
|
76
|
+
items: rows.map((row) => ({
|
|
77
|
+
objectType: row.object_type,
|
|
78
|
+
objectId: row.object_id,
|
|
79
|
+
...row.score === null ? {} : { score: row.score },
|
|
80
|
+
reasons: JSON.parse(row.reasons_json),
|
|
81
|
+
included: row.included === 1
|
|
82
|
+
})),
|
|
83
|
+
createdAt: run.created_at
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
function recordExecutionContextFeedback(input) {
|
|
87
|
+
const now = Date.now();
|
|
88
|
+
const result = getSqliteDatabase().prepare(`INSERT INTO execution_context_feedback (
|
|
89
|
+
turn_id, rating, reason, created_at, updated_at
|
|
90
|
+
) SELECT ?, ?, ?, ?, ? WHERE EXISTS (
|
|
91
|
+
SELECT 1 FROM execution_context_runs WHERE turn_id = ?
|
|
92
|
+
) ON CONFLICT(turn_id) DO UPDATE SET
|
|
93
|
+
rating = excluded.rating, reason = excluded.reason, updated_at = excluded.updated_at`).run(input.turnId, input.rating, input.reason ?? null, now, now, input.turnId);
|
|
94
|
+
return Number(result.changes) > 0;
|
|
95
|
+
}
|
|
96
|
+
//#endregion
|
|
97
|
+
export { getExecutionContextAudit, recordExecutionContext, recordExecutionContextFeedback };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AgentMessage } from '@earendil-works/pi-agent-core';
|
|
2
|
+
import type { Config } from '../../config/schema.js';
|
|
3
|
+
import { type ExecutionContext } from './execution-context.js';
|
|
4
|
+
export interface ExecutionContextPlan {
|
|
5
|
+
traceId: string;
|
|
6
|
+
modelMessage: AgentMessage;
|
|
7
|
+
executionContext?: ExecutionContext;
|
|
8
|
+
estimatedTokens: number;
|
|
9
|
+
contextChars: number;
|
|
10
|
+
contextItemCount: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ExecutionContextCoordinatorOptions {
|
|
13
|
+
getConfig: () => Config | undefined;
|
|
14
|
+
isEnabledForSession: (sessionKey: string) => boolean;
|
|
15
|
+
getWorkspaceIdForSession: (sessionKey: string) => string;
|
|
16
|
+
getProjectIdForSession: (sessionKey: string) => string | undefined;
|
|
17
|
+
}
|
|
18
|
+
export declare class ExecutionContextCoordinator {
|
|
19
|
+
private readonly options;
|
|
20
|
+
private readonly currentBySession;
|
|
21
|
+
constructor(options: ExecutionContextCoordinatorOptions);
|
|
22
|
+
forgetSession(sessionKey: string): void;
|
|
23
|
+
clear(): void;
|
|
24
|
+
getCurrent(sessionKey: string): ExecutionContext | undefined;
|
|
25
|
+
prepare(userMessage: AgentMessage, sessionKey: string, turnId: string): Promise<ExecutionContextPlan>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { init_session_key, parseSessionKey } from "../../routing/session-key.js";
|
|
2
|
+
import { extractProfileAgentId } from "../../config/agent-profile.js";
|
|
3
|
+
import { assembleTaskContext } from "../../tasks/task-context-assembler.js";
|
|
4
|
+
import { recordExecutionContext } from "./audit.js";
|
|
5
|
+
import { prependAgentContext } from "./prepend.js";
|
|
6
|
+
import { extractAgentUserPlainText } from "../memory/user-message-text.js";
|
|
7
|
+
import { buildExecutionContext, renderExecutionContext } from "./execution-context.js";
|
|
8
|
+
//#region src/agent/context/coordinator.ts
|
|
9
|
+
init_session_key();
|
|
10
|
+
function isPrivateSession(sessionKey) {
|
|
11
|
+
const parsed = parseSessionKey(sessionKey);
|
|
12
|
+
return !parsed || parsed.peerKind === "direct";
|
|
13
|
+
}
|
|
14
|
+
var ExecutionContextCoordinator = class {
|
|
15
|
+
currentBySession = /* @__PURE__ */ new Map();
|
|
16
|
+
constructor(options) {
|
|
17
|
+
this.options = options;
|
|
18
|
+
}
|
|
19
|
+
forgetSession(sessionKey) {
|
|
20
|
+
this.currentBySession.delete(sessionKey);
|
|
21
|
+
}
|
|
22
|
+
clear() {
|
|
23
|
+
this.currentBySession.clear();
|
|
24
|
+
}
|
|
25
|
+
getCurrent(sessionKey) {
|
|
26
|
+
return this.currentBySession.get(sessionKey);
|
|
27
|
+
}
|
|
28
|
+
async prepare(userMessage, sessionKey, turnId) {
|
|
29
|
+
const empty = () => ({
|
|
30
|
+
traceId: "",
|
|
31
|
+
modelMessage: userMessage,
|
|
32
|
+
estimatedTokens: 0,
|
|
33
|
+
contextChars: 0,
|
|
34
|
+
contextItemCount: 0
|
|
35
|
+
});
|
|
36
|
+
const config = this.options.getConfig();
|
|
37
|
+
if (!config || !config.userContext.contextPlanning.enabled || !this.options.isEnabledForSession(sessionKey) || !isPrivateSession(sessionKey)) return empty();
|
|
38
|
+
const task = assembleTaskContext(sessionKey, extractAgentUserPlainText(userMessage));
|
|
39
|
+
const context = buildExecutionContext({
|
|
40
|
+
query: task.retrievalQuery,
|
|
41
|
+
agentId: extractProfileAgentId(sessionKey, config),
|
|
42
|
+
workspaceId: this.options.getWorkspaceIdForSession(sessionKey),
|
|
43
|
+
projectId: this.options.getProjectIdForSession(sessionKey),
|
|
44
|
+
sessionId: sessionKey,
|
|
45
|
+
maxAssertions: Math.min(config.userContext.contextPlanning.maxAssertions, task.allocation.maxResults),
|
|
46
|
+
maxKnowledge: Math.min(config.userContext.contextPlanning.maxKnowledge, task.allocation.maxResults)
|
|
47
|
+
});
|
|
48
|
+
this.currentBySession.set(sessionKey, context);
|
|
49
|
+
const rendered = renderExecutionContext(context).slice(0, Math.min(config.userContext.contextPlanning.maxChars, task.allocation.maxChars));
|
|
50
|
+
const contextItemCount = context.rules.length + context.assertions.length + context.goals.length + context.priorities.length + context.knowledge.length;
|
|
51
|
+
recordExecutionContext(context, {
|
|
52
|
+
turnId,
|
|
53
|
+
sessionId: sessionKey,
|
|
54
|
+
budget: {
|
|
55
|
+
maxAssertions: Math.min(config.userContext.contextPlanning.maxAssertions, task.allocation.maxResults),
|
|
56
|
+
maxKnowledge: Math.min(config.userContext.contextPlanning.maxKnowledge, task.allocation.maxResults),
|
|
57
|
+
maxChars: Math.min(config.userContext.contextPlanning.maxChars, task.allocation.maxChars)
|
|
58
|
+
},
|
|
59
|
+
renderedChars: rendered.length
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
traceId: context.traceId,
|
|
63
|
+
modelMessage: prependAgentContext(userMessage, rendered),
|
|
64
|
+
executionContext: context,
|
|
65
|
+
estimatedTokens: Math.ceil(rendered.length / 4),
|
|
66
|
+
contextChars: rendered.length,
|
|
67
|
+
contextItemCount
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
//#endregion
|
|
72
|
+
export { ExecutionContextCoordinator };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type KnowledgeItem, type KnowledgeVisibilityContext } from '../../knowledge-memory/index.js';
|
|
2
|
+
import type { UserAssertion } from '../../user-model/domain.js';
|
|
3
|
+
export type RuleEnforcementLevel = 'prompt' | 'planner' | 'tool_gate';
|
|
4
|
+
export interface ExecutionRule {
|
|
5
|
+
id: string;
|
|
6
|
+
statement: string;
|
|
7
|
+
priority: number;
|
|
8
|
+
enforcementLevel: RuleEnforcementLevel;
|
|
9
|
+
conditions: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
export interface RankedExecutionAssertion {
|
|
12
|
+
assertion: UserAssertion;
|
|
13
|
+
score: number;
|
|
14
|
+
reasons: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface ExecutionGoal {
|
|
17
|
+
id: string;
|
|
18
|
+
title: string;
|
|
19
|
+
desiredOutcome: string;
|
|
20
|
+
status: string;
|
|
21
|
+
declaredImportance?: number;
|
|
22
|
+
targetAt?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface ExecutionPriority {
|
|
25
|
+
id: string;
|
|
26
|
+
targetType: string;
|
|
27
|
+
targetId: string;
|
|
28
|
+
rank: 'primary' | 'secondary' | 'background';
|
|
29
|
+
urgency: number;
|
|
30
|
+
validTo: number;
|
|
31
|
+
}
|
|
32
|
+
export interface ExecutionContext {
|
|
33
|
+
traceId: string;
|
|
34
|
+
asOf: number;
|
|
35
|
+
query: string;
|
|
36
|
+
rules: ExecutionRule[];
|
|
37
|
+
assertions: RankedExecutionAssertion[];
|
|
38
|
+
goals: ExecutionGoal[];
|
|
39
|
+
priorities: ExecutionPriority[];
|
|
40
|
+
knowledge: KnowledgeItem[];
|
|
41
|
+
}
|
|
42
|
+
export interface ExecutionContextRequest extends KnowledgeVisibilityContext {
|
|
43
|
+
query: string;
|
|
44
|
+
asOf?: number;
|
|
45
|
+
maxAssertions?: number;
|
|
46
|
+
maxKnowledge?: number;
|
|
47
|
+
}
|
|
48
|
+
export declare function buildExecutionContext(request: ExecutionContextRequest): ExecutionContext;
|
|
49
|
+
export declare function renderExecutionContext(context: ExecutionContext): string;
|
|
50
|
+
export declare function evaluateToolGate(context: ExecutionContext, operation: string): {
|
|
51
|
+
allowed: boolean;
|
|
52
|
+
rule?: ExecutionRule;
|
|
53
|
+
reason?: string;
|
|
54
|
+
};
|