@xopcai/xopc 0.0.188 → 0.0.190
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/README.md +1 -4
- package/README.zh-CN.md +0 -3
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store--QoUGhiS.js → activity-store-DstnJCS5.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-B0yweLNQ.js → agent-avatar-dicebear-9vAbkroX.js} +1 -1
- package/dist/gateway/static/root/assets/agents-D1t4SfMQ.js +68 -0
- package/dist/gateway/static/root/assets/{api-5laWqfiE.js → api-BTL9kayv.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BXJ8Jiv_.js → app-management-settings-panel-DkFeIdBf.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DG9n9D1M.js → appearance-settings-Bxs8Fpaj.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-Cgrgu5OW.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-Ceh5qrZf.js → archive-plugin-Ch2RmLCC.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-jFW7uYf7.js → attachment-load-BhMQM_Ky.js} +1 -1
- package/dist/gateway/static/root/assets/automations-page-CtJxstKh.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-XDlkI1r4.js → binary-plugins-D6CqlymH.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-kyKc2IhE.js → block-editor-ClL6HEg9.js} +56 -56
- package/dist/gateway/static/root/assets/browser-settings-page-DW99iDmD.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-BJa5Iz_v.js → browser-workflow-inputs-BYy48VhN.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CTQQOsn5.js → browser-workflows-page-zgLibuMH.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-CHUrT9EB.js +7 -0
- package/dist/gateway/static/root/assets/capability-presets-api-BB8t4Ja7.js +1 -0
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Cycrv0YV.js +1 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-BgIkWq01.js → channel-recipient-api-BThDGiO3.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-V96gPUAU.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-Cz7SAAkm.js +1 -0
- package/dist/gateway/static/root/assets/connectors-api-DS9ED-EL.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-BhlyQoQI.js +2 -0
- package/dist/gateway/static/root/assets/cron-expression-CkgsvhtW.js +2 -0
- package/dist/gateway/static/root/assets/{desktop-pet-CSwd00CV.js → desktop-pet-Cv8rGhYW.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-CuNQvHGu.js → desktop-pet-settings-CIeJdwfV.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-ct0n5Rje.js → directory-picker-path-field-D8jXEiAY.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-BeRBuMUU.js → extension-debug-page-CCZ9u6TZ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DbK-Cwao.js → extension-page-CV36ILRG.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-IyQrSILY.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-api-CC7EvEFp.js → gateway-config-api-D4_r5iJM.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-CYlntpBH.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-B2DmdlwO.js → gateway-startup-retry-EO9mKvzE.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-D4SyWob8.js +1 -0
- package/dist/gateway/static/root/assets/home-page-B2Kagoh8.js +3 -0
- package/dist/gateway/static/root/assets/{image-generation-api-GMTaS6eI.js → image-generation-api-Bu7PyVSh.js} +1 -1
- package/dist/gateway/static/root/assets/index-CYT5DOzr.js +150 -0
- package/dist/gateway/static/root/assets/index-D6e3tPL-.css +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-DhGYddbI.js → keyboard-shortcuts-settings-BMhCuVBZ.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-BHYbFjqy.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CmnrBmWi.js → local-apps-page-ijIe7_y2.js} +1 -1
- package/dist/gateway/static/root/assets/locale-store-deR2zRaE.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-IIn8Tess.js +2 -0
- package/dist/gateway/static/root/assets/management-settings--V_fovKD.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-split-CZaBPOVn.js → markdown-split-Dt9-in6W.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CiKvSgCv.js → media-plugins-B3pj_iO0.js} +1 -1
- package/dist/gateway/static/root/assets/messages-B4XqB8I6.js +3 -0
- package/dist/gateway/static/root/assets/{notes-page-Bisbzqlz.js → notes-page-DZ366lIT.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-S2sBVOLw.js +4 -0
- package/dist/gateway/static/root/assets/{page-tabs-BxlwhAbH.js → page-tabs-C5ge434C.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-RM8wXxfT.js → preview-open-alternatives-BFa9DgSV.js} +1 -1
- package/dist/gateway/static/root/assets/product-delivery-tRr-7IxY.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-DdBlibek.js → product-open-page-Dc9CcWdu.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BilzoCJ7.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BoQUyacP.js +1 -0
- package/dist/gateway/static/root/assets/remote-access-hub-DUyUaCRF.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-BDKbpmXv.js → schema-form-B84DckWe.js} +1 -1
- package/dist/gateway/static/root/assets/{schemas-C6onAggk.js → schemas-zIBW3wiV.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-Dzxlq1F0.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-TzwlZxU6.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-Dp9itvdy.js +1 -0
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-DgIp8_S6.js → settings-loading-skeleton-CCtlhoy7.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-DQmMKf8r.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-layout-97LmwrzC.js → settings-page-layout-EQIOJa_L.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Cwi-SPja.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-BH7i3g1S.js → share-preview-page-C4_B2jvf.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-CkyuGlZK.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-BJCePQK5.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-BYWLfmJi.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-s-a5WV9j.js → skills-page.utils-Jhm24i4h.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-BxjeMT5k.js → system-settings-panel-Dpx2ags2.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-BahycnfW.js → task-detail-page-DLAdxI6e.js} +1 -1
- package/dist/gateway/static/root/assets/{theme-store-BRxdsmic.js → theme-store-DnBOcGXi.js} +1 -1
- package/dist/gateway/static/root/assets/{typed-models-lib-39MjwPSq.js → typed-models-lib-DULmTHUB.js} +1 -1
- package/dist/gateway/static/root/assets/use-autosave-BrjVk5VH.js +1 -0
- package/dist/gateway/static/root/assets/user-context-page-9AAFpGAL.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-XU-7sBSg.js → voice-api-key-field-BISTPfq_.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-CJqu8UHq.js → work-discovery-overlay-Wr-uF7VA.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BWds95sL.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DXtg8Qxl.js → workflow-run-setup-panel-DHqHP8_6.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-0b4_DFHr.js +11 -0
- package/dist/gateway/static/root/index.html +9 -9
- package/dist/package.js +1 -1
- package/dist/packages/endpoint-tools-protocol/src/index.js +184 -0
- package/dist/packages/gateway-contract/src/tool-activity.js +0 -36
- package/dist/packages/realtime-client/src/index.js +256 -0
- package/dist/packages/realtime-protocol/src/index.js +88 -0
- package/dist/src/agent/agent-manager.d.ts +1 -1
- package/dist/src/agent/agent-manager.js +7 -13
- package/dist/src/agent/background-review/coordinator.js +1 -1
- package/dist/src/agent/background-review/prompts.d.ts +1 -1
- package/dist/src/agent/background-review/prompts.js +3 -1
- package/dist/src/agent/background-review/run-background-review.d.ts +2 -0
- package/dist/src/agent/background-review/run-background-review.js +10 -9
- package/dist/src/agent/bootstrap/bootstrap-cache.d.ts +0 -1
- package/dist/src/agent/bootstrap/bootstrap-cache.js +3 -4
- package/dist/src/agent/bootstrap/bootstrap-files.d.ts +0 -4
- package/dist/src/agent/bootstrap/bootstrap-files.js +3 -4
- package/dist/src/agent/bootstrap/filter-bootstrap-files.js +1 -4
- package/dist/src/agent/bootstrap/load-bootstrap-files.d.ts +0 -1
- package/dist/src/agent/bootstrap/load-bootstrap-files.js +1 -14
- package/dist/src/agent/bootstrap/types.d.ts +1 -1
- package/dist/src/agent/client-error-format.d.ts +1 -1
- package/dist/src/agent/client-error-format.js +1 -1
- package/dist/src/agent/context/workspace-templates/SOUL.md +1 -1
- package/dist/src/agent/external-tools/endpoint-provider.d.ts +17 -0
- package/dist/src/agent/external-tools/endpoint-provider.js +93 -0
- package/dist/src/agent/external-tools/gateway-tools.js +1 -1
- package/dist/src/agent/external-tools/index.d.ts +4 -5
- package/dist/src/agent/external-tools/index.js +8 -2
- package/dist/src/agent/external-tools/types.d.ts +8 -1
- package/dist/src/agent/external-tools/types.js +2 -1
- package/dist/src/agent/inbound/inbound-loop.js +4 -0
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +9 -8
- package/dist/src/agent/inbound/turn-dispatcher.js +13 -11
- package/dist/src/agent/memory/builtin-provider.d.ts +2 -4
- package/dist/src/agent/memory/builtin-provider.js +35 -15
- package/dist/src/agent/memory/context/types.d.ts +3 -1
- package/dist/src/agent/memory/create-memory-manager.js +2 -0
- package/dist/src/agent/memory/index.d.ts +1 -1
- package/dist/src/agent/memory/index.js +1 -1
- package/dist/src/agent/memory/manager.d.ts +9 -1
- package/dist/src/agent/memory/manager.js +39 -9
- package/dist/src/agent/memory/memory-config.d.ts +1 -1
- package/dist/src/agent/memory/memory-config.js +1 -1
- package/dist/src/agent/memory/source-origin.js +0 -2
- package/dist/src/agent/memory/types.d.ts +5 -1
- package/dist/src/agent/memory/understanding/service.d.ts +10 -10
- package/dist/src/agent/memory/understanding/service.js +108 -176
- package/dist/src/agent/memory/understanding/types.d.ts +7 -8
- package/dist/src/agent/memory/user-context-coordinator.d.ts +2 -1
- package/dist/src/agent/memory/user-context-coordinator.js +27 -41
- package/dist/src/agent/messaging/command-handler.d.ts +2 -2
- package/dist/src/agent/messaging/command-handler.js +3 -3
- package/dist/src/agent/orchestration/agent-orchestrator.js +4 -7
- package/dist/src/agent/prompt/sections/memory-skills.js +4 -4
- package/dist/src/agent/prompt/sections/tooling.js +0 -10
- package/dist/src/agent/prompt/service-prompt-builder.d.ts +0 -1
- package/dist/src/agent/prompt/service-prompt-builder.js +4 -33
- package/dist/src/agent/prompt/system-prompt.js +1 -2
- package/dist/src/agent/service/async-queue.d.ts +1 -1
- package/dist/src/agent/service/async-queue.js +1 -1
- package/dist/src/agent/service/direct-turn-helpers.d.ts +1 -1
- package/dist/src/agent/service/direct-turn-helpers.js +2 -2
- package/dist/src/agent/service/process-direct-one-shot.d.ts +3 -1
- package/dist/src/agent/service/process-direct-one-shot.js +1 -1
- package/dist/src/agent/service/process-direct-streaming.d.ts +7 -5
- package/dist/src/agent/service/process-direct-streaming.js +5 -5
- package/dist/src/agent/service.d.ts +2 -3
- package/dist/src/agent/service.js +10 -21
- package/dist/src/agent/service.types.d.ts +2 -0
- package/dist/src/agent/session/index.d.ts +1 -1
- package/dist/src/agent/session/session-context.d.ts +2 -0
- package/dist/src/agent/session/session-context.js +4 -0
- package/dist/src/agent/session/session-state-bag.d.ts +4 -4
- package/dist/src/agent/session/session-state-bag.js +1 -1
- package/dist/src/agent/skills/marketplace/adapters/clawhub/adapter.js +1 -1
- package/dist/src/agent/streaming/reasoning-visibility.d.ts +6 -0
- package/dist/src/agent/streaming/{reasoning-visibility-sse.js → reasoning-visibility.js} +3 -6
- package/dist/src/agent/tools/dreaming-tool.d.ts +0 -2
- package/dist/src/agent/tools/dreaming-tool.js +13 -38
- package/dist/src/agent/tools/factory.d.ts +4 -3
- package/dist/src/agent/tools/factory.js +2 -10
- package/dist/src/agent/tools/index.d.ts +0 -1
- package/dist/src/agent/tools/index.js +1 -2
- package/dist/src/agent/tools/memory-tool.js +1 -1
- package/dist/src/agent/workspace-runtime/registry.d.ts +3 -5
- package/dist/src/agent/workspace-runtime/registry.js +2 -15
- package/dist/src/agent-manifest/schema.d.ts +17 -17
- package/dist/src/agent-runtime/index.js +1 -1
- package/dist/src/agent-runtime/memory-runtime.d.ts +2 -2
- package/dist/src/agent-runtime/runtime-profile.js +1 -1
- package/dist/src/automations/domain/types.d.ts +2 -1
- package/dist/src/automations/domain/validation.d.ts +29 -29
- package/dist/src/automations/draft/automation-draft-validator.d.ts +3 -3
- package/dist/src/automations/service/action-executor.js +4 -1
- package/dist/src/channels/pairing/pairing-challenge.d.ts +1 -1
- package/dist/src/channels/pairing/pairing-challenge.js +1 -1
- package/dist/src/chat-commands/builtins/understanding.js +2 -5
- package/dist/src/cli/commands/agent/stream-renderer.js +4 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +1 -1
- package/dist/src/cli/commands/init.js +3 -22
- package/dist/src/cli/templates.js +1 -1
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/paths.d.ts +0 -5
- package/dist/src/config/paths.js +2 -11
- package/dist/src/config/rules.js +0 -5
- package/dist/src/config/schema.d.ts +27 -122
- package/dist/src/config/schema.js +9 -42
- package/dist/src/config/web-patch.js +0 -1
- package/dist/src/connectors/learning-coordinator.js +75 -3
- package/dist/src/endpoint-tools/auth.d.ts +20 -0
- package/dist/src/endpoint-tools/auth.js +51 -0
- package/dist/src/endpoint-tools/index.d.ts +5 -0
- package/dist/src/endpoint-tools/index.js +6 -0
- package/dist/src/endpoint-tools/invocation-service.d.ts +68 -0
- package/dist/src/endpoint-tools/invocation-service.js +190 -0
- package/dist/src/endpoint-tools/policy.d.ts +10 -0
- package/dist/src/endpoint-tools/policy.js +18 -0
- package/dist/src/endpoint-tools/registry.d.ts +45 -0
- package/dist/src/endpoint-tools/registry.js +121 -0
- package/dist/src/endpoint-tools/runtime.d.ts +23 -0
- package/dist/src/endpoint-tools/runtime.js +86 -0
- package/dist/src/endpoint-tools/upload-service.d.ts +41 -0
- package/dist/src/endpoint-tools/upload-service.js +103 -0
- package/dist/src/extensions/types/hooks.d.ts +1 -1
- package/dist/src/extensions/update.js +1 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +1 -1
- package/dist/src/gateway/agent-builtin-tools.js +0 -5
- package/dist/src/gateway/agents-admin.d.ts +0 -7
- package/dist/src/gateway/agents-admin.js +3 -32
- package/dist/src/gateway/chat-stream/protocol.d.ts +0 -1
- package/dist/src/gateway/clarify-bridge.d.ts +5 -4
- package/dist/src/gateway/clarify-bridge.js +3 -4
- package/dist/src/gateway/dreaming-automation-reconciler.d.ts +3 -3
- package/dist/src/gateway/dreaming-automation-reconciler.js +48 -88
- package/dist/src/gateway/heartbeat/service.js +4 -1
- package/dist/src/gateway/hono/app.js +1 -5
- package/dist/src/gateway/hono/index.d.ts +0 -1
- package/dist/src/gateway/hono/index.js +1 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +20 -9
- package/dist/src/gateway/hono/lib/config-payload.js +3 -2
- package/dist/src/gateway/hono/middleware/auth.js +3 -5
- package/dist/src/gateway/hono/oauth-async.d.ts +1 -0
- package/dist/src/gateway/hono/oauth-async.js +17 -2
- package/dist/src/gateway/hono/routes/agent-stream.js +49 -6
- package/dist/src/gateway/hono/routes/agents.js +1 -33
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/gateway.d.ts +2 -2
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +0 -19
- package/dist/src/gateway/hono/routes/config-patch/misc.js +17 -1
- package/dist/src/gateway/hono/routes/connectors.js +13 -12
- package/dist/src/gateway/hono/routes/deps.d.ts +0 -2
- package/dist/src/gateway/hono/routes/endpoint-tools.d.ts +3 -0
- package/dist/src/gateway/hono/routes/endpoint-tools.js +196 -0
- package/dist/src/gateway/hono/routes/index.js +6 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +1 -5
- package/dist/src/gateway/hono/routes/logs.js +0 -4
- package/dist/src/gateway/hono/routes/public-gateway.js +2 -2
- package/dist/src/gateway/hono/routes/realtime.d.ts +3 -0
- package/dist/src/gateway/hono/routes/realtime.js +35 -0
- package/dist/src/gateway/hono/routes/status.js +0 -7
- package/dist/src/gateway/hono/routes/understanding-sources.d.ts +3 -0
- package/dist/src/gateway/hono/routes/understanding-sources.js +203 -0
- package/dist/src/gateway/hono/routes/work-discovery.d.ts +2 -0
- package/dist/src/gateway/hono/routes/work-discovery.js +3 -134
- package/dist/src/gateway/hono/routes/workflows.js +1 -1
- package/dist/src/gateway/hono/routes/you.d.ts +0 -31
- package/dist/src/gateway/hono/routes/you.js +230 -1161
- package/dist/src/gateway/index.d.ts +1 -1
- package/dist/src/gateway/index.js +1 -2
- package/dist/src/gateway/protocol.d.ts +1 -7
- package/dist/src/gateway/security/index.js +1 -1
- package/dist/src/gateway/security/operator-scopes.js +1 -1
- package/dist/src/gateway/server.js +4 -4
- package/dist/src/gateway/service/agent-runner.d.ts +11 -9
- package/dist/src/gateway/service/agent-runner.js +18 -18
- package/dist/src/gateway/service/config-coordinator.d.ts +3 -3
- package/dist/src/gateway/service/run-gateway-agent.d.ts +4 -3
- package/dist/src/gateway/service/run-gateway-agent.js +15 -17
- package/dist/src/gateway/service/session-input-coordinator.d.ts +3 -0
- package/dist/src/gateway/service/session-input-coordinator.js +4 -2
- package/dist/src/gateway/service/types.d.ts +0 -5
- package/dist/src/gateway/service.d.ts +7 -6
- package/dist/src/gateway/service.js +43 -26
- package/dist/src/infra/update-runner.js +1 -1
- package/dist/src/knowledge/connected-knowledge-pipeline.js +1 -1
- package/dist/src/knowledge/connected-understanding-pipeline.d.ts +2 -4
- package/dist/src/knowledge/connected-understanding-pipeline.js +31 -81
- package/dist/src/knowledge/index.js +2 -2
- package/dist/src/knowledge/people-graph.d.ts +22 -25
- package/dist/src/knowledge/people-graph.js +76 -43
- package/dist/src/mcp/channel-bridge.d.ts +6 -9
- package/dist/src/mcp/channel-bridge.js +48 -76
- package/dist/src/mcp/channel-server.js +2 -6
- package/dist/src/proactive/execution/context.js +8 -13
- package/dist/src/realtime/broker.d.ts +31 -0
- package/dist/src/realtime/broker.js +114 -0
- package/dist/src/realtime/runtime.d.ts +20 -0
- package/dist/src/realtime/runtime.js +263 -0
- package/dist/src/realtime/tickets.d.ts +15 -0
- package/dist/src/realtime/tickets.js +38 -0
- package/dist/src/realtime/writer.d.ts +15 -0
- package/dist/src/realtime/writer.js +78 -0
- package/dist/src/share/share-config.js +0 -1
- package/dist/src/share/site-share-config.js +0 -1
- package/dist/src/storage/sqlite/connector-account-repository.js +0 -1
- package/dist/src/storage/sqlite/context-consolidation-repository.d.ts +37 -0
- package/dist/src/storage/sqlite/context-consolidation-repository.js +64 -0
- package/dist/src/storage/sqlite/endpoint-principal-repository.d.ts +17 -0
- package/dist/src/storage/sqlite/endpoint-principal-repository.js +54 -0
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.d.ts +25 -0
- package/dist/src/storage/sqlite/endpoint-tool-invocation-repository.js +42 -0
- package/dist/src/storage/sqlite/fts.d.ts +2 -0
- package/dist/src/storage/sqlite/fts.js +29 -1
- package/dist/src/storage/sqlite/index.d.ts +6 -6
- package/dist/src/storage/sqlite/index.js +7 -7
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +9 -2
- package/dist/src/storage/sqlite/knowledge-repository.js +58 -10
- package/dist/src/storage/sqlite/memory-records-repository.d.ts +7 -56
- package/dist/src/storage/sqlite/memory-records-repository.js +68 -218
- package/dist/src/storage/sqlite/migrations/109_endpoint_principals.sql +14 -0
- package/dist/src/storage/sqlite/migrations/110_session_input_origin.sql +43 -0
- package/dist/src/storage/sqlite/migrations/111_endpoint_tool_invocations.sql +18 -0
- package/dist/src/storage/sqlite/migrations/112_endpoint_instance_bindings.sql +8 -0
- package/dist/src/storage/sqlite/migrations/113_memory_evidence_single_source.sql +54 -0
- package/dist/src/storage/sqlite/migrations/114_user_context_domain.sql +193 -0
- package/dist/src/storage/sqlite/migrations/115_remove_legacy_user_context.sql +6 -0
- package/dist/src/storage/sqlite/migrations/116_structured_context_consolidation.sql +38 -0
- package/dist/src/storage/sqlite/migrations/117_unified_understanding_sources.sql +110 -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/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +0 -20
- package/dist/src/storage/sqlite/session-input-repository.d.ts +3 -0
- package/dist/src/storage/sqlite/session-input-repository.js +5 -3
- package/dist/src/storage/sqlite/user-context-quality-repository.d.ts +34 -0
- package/dist/src/storage/sqlite/user-context-quality-repository.js +74 -0
- package/dist/src/storage/sqlite/user-context-repository.d.ts +64 -0
- package/dist/src/storage/sqlite/user-context-repository.js +383 -0
- package/dist/src/tasks/home-query-service.d.ts +1 -1
- package/dist/src/tui/backends/embedded-backend.js +5 -2
- package/dist/src/tui/backends/{gateway-sse-backend.d.ts → gateway-realtime-backend.d.ts} +13 -10
- package/dist/src/tui/backends/{gateway-sse-backend.js → gateway-realtime-backend.js} +114 -151
- package/dist/src/tui/tool-summary.js +1 -7
- package/dist/src/tui/tui-agent-events.d.ts +0 -1
- package/dist/src/tui/tui-agent-events.js +2 -15
- package/dist/src/tui/tui-backend.d.ts +4 -4
- package/dist/src/tui/tui-run-state.js +0 -4
- package/dist/src/tui/tui-startup-resources.js +1 -2
- package/dist/src/tui/tui-types.d.ts +2 -9
- package/dist/src/tui/tui-types.js +0 -1
- package/dist/src/tui/tui.js +5 -5
- package/dist/src/tunnel/gateway-lifecycle.d.ts +1 -1
- package/dist/src/tunnel/gateway-lifecycle.js +1 -1
- package/dist/src/user-context/config.d.ts +17 -210
- package/dist/src/user-context/config.js +19 -85
- package/dist/src/user-context/consolidation.d.ts +26 -0
- package/dist/src/user-context/consolidation.js +115 -0
- package/dist/src/user-context/domain.d.ts +75 -0
- package/dist/src/user-context/domain.js +4 -0
- package/dist/src/user-context/manual-understanding.d.ts +7 -14
- package/dist/src/user-context/manual-understanding.js +19 -49
- package/dist/src/{agent/memory/context → user-context}/planner.d.ts +5 -6
- package/dist/src/user-context/planner.js +311 -0
- package/dist/src/user-context/relationship-continuity.d.ts +3 -6
- package/dist/src/user-context/relationship-continuity.js +39 -32
- package/dist/src/user-context/sources/catalog.d.ts +2 -0
- package/dist/src/user-context/sources/catalog.js +149 -0
- package/dist/src/user-context/sources/index.d.ts +3 -0
- package/dist/src/user-context/sources/index.js +3 -0
- package/dist/src/user-context/sources/repository.d.ts +40 -0
- package/dist/src/user-context/sources/repository.js +164 -0
- package/dist/src/user-context/sources/types.d.ts +83 -0
- package/dist/src/user-context/understandingQuality.d.ts +5 -0
- package/dist/src/user-context/understandingQuality.js +44 -0
- package/dist/src/utils/logger/log-stream.d.ts +3 -10
- package/dist/src/utils/logger/log-stream.js +2 -73
- package/dist/src/utils/logger/pino-record.d.ts +1 -1
- package/dist/src/utils/logger/streams.js +1 -1
- package/dist/src/work-discovery/analyzer.d.ts +4 -3
- package/dist/src/work-discovery/analyzer.js +21 -16
- package/dist/src/work-discovery/incremental-repository.js +42 -40
- package/dist/src/work-discovery/index.js +3 -3
- package/dist/src/work-discovery/service.d.ts +7 -7
- package/dist/src/work-discovery/service.js +241 -190
- package/dist/src/work-discovery/source-repository.js +42 -53
- package/dist/src/work-discovery/types.d.ts +2 -14
- package/package.json +5 -7
- package/dist/gateway/static/root/assets/agents-C6OV-gMm.js +0 -2
- package/dist/gateway/static/root/assets/apps-page-Ci14lDeO.js +0 -1
- package/dist/gateway/static/root/assets/automations-page-Q1xmb4Rh.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-DbowrHXD.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DoZPFdKF.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-api-Dn-7MMEo.js +0 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Bt8Hnx0h.js +0 -1
- package/dist/gateway/static/root/assets/channels-settings-Bpsebsru.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-DFmdYRE5.js +0 -1
- package/dist/gateway/static/root/assets/connector-logo-TRr9ybf6.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-Tg5kl22i.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-B3B1eqnr.js +0 -2
- package/dist/gateway/static/root/assets/extension-settings-page-C9ag5tb5.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-9g8uIry9.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-fl1oC_-5.js +0 -1
- package/dist/gateway/static/root/assets/home-page-Bao9jq_z.js +0 -3
- package/dist/gateway/static/root/assets/index-Cl5n1f_U.css +0 -1
- package/dist/gateway/static/root/assets/index-OJgiMh07.js +0 -223
- package/dist/gateway/static/root/assets/local-app-workbench-page-B69NvtvH.js +0 -2
- package/dist/gateway/static/root/assets/locale-store-D6hs74o5.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-Cq3cABqg.js +0 -7
- package/dist/gateway/static/root/assets/messages-D02NNLCZ.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-BOZfJFhE.js +0 -4
- package/dist/gateway/static/root/assets/product-delivery-C8JbSj5Y.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-TSKFb2tN.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-BokeBrTT.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-C56anxCX.js +0 -1
- package/dist/gateway/static/root/assets/segmented-styles-BL8oLBEp.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-C7TQADrD.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BDOPKeAX.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-zxo5ZGOu.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-BUPSIa9P.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BRg766eW.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DhEAviQ_.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-Ct7AV8ls.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DoVuprZm.js +0 -2
- package/dist/gateway/static/root/assets/time-picker-BGk_Tbsj.js +0 -1
- package/dist/gateway/static/root/assets/use-save-bar-registration-5aVSjTjO.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-B9K41qmy.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-page-BBVnRHju.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-Bs_tYfst.js +0 -11
- package/dist/src/agent/code-intelligence/binary.d.ts +0 -15
- package/dist/src/agent/code-intelligence/binary.js +0 -372
- package/dist/src/agent/code-intelligence/index.d.ts +0 -4
- package/dist/src/agent/code-intelligence/index.js +0 -4
- package/dist/src/agent/code-intelligence/runtime.d.ts +0 -34
- package/dist/src/agent/code-intelligence/runtime.js +0 -280
- package/dist/src/agent/code-intelligence/tool-gating.d.ts +0 -5
- package/dist/src/agent/code-intelligence/tool-gating.js +0 -6
- package/dist/src/agent/code-intelligence/tools.d.ts +0 -6
- package/dist/src/agent/code-intelligence/tools.js +0 -266
- package/dist/src/agent/code-intelligence/types.d.ts +0 -22
- package/dist/src/agent/memory/context/planner.js +0 -286
- package/dist/src/agent/memory/dreaming/config.d.ts +0 -48
- package/dist/src/agent/memory/dreaming/config.js +0 -98
- package/dist/src/agent/memory/dreaming/constants.d.ts +0 -12
- package/dist/src/agent/memory/dreaming/constants.js +0 -18
- package/dist/src/agent/memory/dreaming/deep-promotion.d.ts +0 -19
- package/dist/src/agent/memory/dreaming/deep-promotion.js +0 -152
- package/dist/src/agent/memory/dreaming/light-sweep.d.ts +0 -16
- package/dist/src/agent/memory/dreaming/light-sweep.js +0 -115
- package/dist/src/agent/memory/dreaming/preview.d.ts +0 -23
- package/dist/src/agent/memory/dreaming/preview.js +0 -52
- package/dist/src/agent/memory/dreaming/promotion-lifecycle.d.ts +0 -16
- package/dist/src/agent/memory/dreaming/promotion-lifecycle.js +0 -44
- package/dist/src/agent/memory/dreaming/rem-patterns.d.ts +0 -19
- package/dist/src/agent/memory/dreaming/rem-patterns.js +0 -150
- package/dist/src/agent/memory/dreaming/runner.d.ts +0 -10
- package/dist/src/agent/memory/dreaming/runner.js +0 -78
- package/dist/src/agent/memory/dreaming/schedule.d.ts +0 -23
- package/dist/src/agent/memory/dreaming/schedule.js +0 -38
- package/dist/src/agent/memory/dreaming/scope.d.ts +0 -11
- package/dist/src/agent/memory/dreaming/scope.js +0 -33
- package/dist/src/agent/memory/dreaming/utils.d.ts +0 -3
- package/dist/src/agent/memory/dreaming/utils.js +0 -31
- package/dist/src/agent/streaming/reasoning-visibility-sse.d.ts +0 -15
- package/dist/src/gateway/agent-run-relay.d.ts +0 -19
- package/dist/src/gateway/agent-run-relay.js +0 -169
- package/dist/src/gateway/hono/routes/memory.d.ts +0 -3
- package/dist/src/gateway/hono/routes/memory.js +0 -460
- package/dist/src/gateway/hono/sse.d.ts +0 -53
- package/dist/src/gateway/hono/sse.js +0 -207
- package/dist/src/gateway/service/sse-hub.d.ts +0 -10
- package/dist/src/gateway/service/sse-hub.js +0 -53
- package/dist/src/storage/sqlite/dreaming-repository.d.ts +0 -61
- package/dist/src/storage/sqlite/dreaming-repository.js +0 -88
- package/dist/src/storage/sqlite/memory-readiness-repository.d.ts +0 -7
- package/dist/src/storage/sqlite/memory-readiness-repository.js +0 -30
- package/dist/src/storage/sqlite/memory-reference-consent-repository.d.ts +0 -27
- package/dist/src/storage/sqlite/memory-reference-consent-repository.js +0 -107
- package/dist/src/storage/sqlite/user-claims-repository.d.ts +0 -101
- package/dist/src/storage/sqlite/user-claims-repository.js +0 -241
- package/dist/src/storage/sqlite/user-profile-setup-repository.d.ts +0 -3
- package/dist/src/storage/sqlite/user-profile-setup-repository.js +0 -32
- package/dist/src/tui/sse-consumer.d.ts +0 -15
- package/dist/src/tui/sse-consumer.js +0 -73
- package/dist/src/user-context/context-compiler.d.ts +0 -27
- package/dist/src/user-context/context-compiler.js +0 -48
- package/dist/src/user-context/import.d.ts +0 -12
- package/dist/src/user-context/import.js +0 -51
- package/dist/src/user-context/memory-episode-evaluator.d.ts +0 -32
- package/dist/src/user-context/memory-episode-evaluator.js +0 -35
- package/dist/src/user-context/memory-readiness.d.ts +0 -33
- package/dist/src/user-context/memory-readiness.js +0 -41
- package/dist/src/user-context/memory-use-audit.d.ts +0 -10
- package/dist/src/user-context/memory-use-audit.js +0 -26
- package/dist/src/user-context/personal-playbook.d.ts +0 -11
- package/dist/src/user-context/personal-playbook.js +0 -41
- package/dist/src/user-context/profile.d.ts +0 -37
- package/dist/src/user-context/profile.js +0 -163
- package/dist/src/user-context/projection.d.ts +0 -120
- package/dist/src/user-context/projection.js +0 -262
- package/dist/src/user-context/source-recommendations.d.ts +0 -13
- package/dist/src/user-context/source-recommendations.js +0 -85
- /package/dist/src/{agent/code-intelligence → user-context/sources}/types.js +0 -0
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { init_logger } from "../../../utils/logger.js";
|
|
3
|
-
import { appendMemoryTraceEvent, markMemoryRecordsConflicted } from "../../../storage/sqlite/memory-records-repository.js";
|
|
4
|
-
import { attachMemoryEvidence, upsertKnowledgeSourceItems } from "../../../storage/sqlite/knowledge-repository.js";
|
|
1
|
+
import { createContextEvidence, createUnderstanding, isUnderstandingSuppressed, linkUnderstandingEvidence, listUnderstandings, setUnderstandingStatus } from "../../../storage/sqlite/user-context-repository.js";
|
|
5
2
|
import "../../../storage/sqlite/index.js";
|
|
6
|
-
import { nextMemoryReviewAt } from "../lifecycle.js";
|
|
7
3
|
import { extractExplicitUnderstandingCorrectionContent } from "./correction.js";
|
|
8
4
|
import { inferMemorySensitivity, redactSensitiveMemoryText } from "../sensitivity.js";
|
|
9
|
-
import { createHash
|
|
5
|
+
import { createHash } from "node:crypto";
|
|
10
6
|
//#region src/agent/memory/understanding/service.ts
|
|
11
|
-
init_logger();
|
|
12
|
-
const log = createLogger("UserUnderstanding");
|
|
13
7
|
const MAX_CANDIDATE_CHARS = 600;
|
|
14
8
|
const EXPLICIT_PATTERNS = [
|
|
15
9
|
/\b(?:please\s+)?remember(?:\s+that)?\s+(.+)/i,
|
|
@@ -18,27 +12,27 @@ const EXPLICIT_PATTERNS = [
|
|
|
18
12
|
/以后(?:都)?(?:请)?[::\s]*(.+)/,
|
|
19
13
|
/下次(?:请)?[::\s]*(.+)/
|
|
20
14
|
];
|
|
15
|
+
const SENSITIVITY_RANK = {
|
|
16
|
+
normal: 0,
|
|
17
|
+
personal: 1,
|
|
18
|
+
secret: 2,
|
|
19
|
+
regulated: 3
|
|
20
|
+
};
|
|
21
|
+
function effectiveSensitivity(declared, content) {
|
|
22
|
+
const inferred = inferMemorySensitivity(content);
|
|
23
|
+
return SENSITIVITY_RANK[inferred] > SENSITIVITY_RANK[declared] ? inferred : declared;
|
|
24
|
+
}
|
|
21
25
|
function normalizeContent(raw) {
|
|
22
26
|
return raw.replace(/^["'“”‘’\s]+|["'“”‘’\s]+$/g, "").replace(/\s+/g, " ").trim().slice(0, MAX_CANDIDATE_CHARS);
|
|
23
27
|
}
|
|
24
28
|
function inferKind(content) {
|
|
25
29
|
if (/\b(don't|do not|never|avoid)\b/i.test(content) || /不要|别再|禁止|底线/.test(content)) return "boundary";
|
|
26
30
|
if (/\b(prefer|preference|like)\b/i.test(content) || /喜欢|偏好|习惯/.test(content)) return "preference";
|
|
27
|
-
if (/\b(tool|command|pnpm|npm|git|ripgrep|rg)\b/i.test(content) || /工具|命令/.test(content)) return "tool_preference";
|
|
28
31
|
if (/\b(project|repo|codebase|workspace)\b/i.test(content) || /项目|仓库|代码库/.test(content)) return "project_context";
|
|
29
|
-
if (/\b(goal|plan|
|
|
30
|
-
if (/\b(next time|lesson|failed|error)\b/i.test(content) ||
|
|
31
|
-
return "
|
|
32
|
-
|
|
33
|
-
const SENSITIVITY_RANK = {
|
|
34
|
-
normal: 0,
|
|
35
|
-
personal: 1,
|
|
36
|
-
regulated: 2,
|
|
37
|
-
secret: 3
|
|
38
|
-
};
|
|
39
|
-
function stricterSensitivity(content, declared) {
|
|
40
|
-
const inferred = inferMemorySensitivity(content);
|
|
41
|
-
return SENSITIVITY_RANK[inferred] > SENSITIVITY_RANK[declared] ? inferred : declared;
|
|
32
|
+
if (/\b(goal|plan|deadline)\b/i.test(content) || /目标|计划|截止/.test(content)) return "long_term_goal";
|
|
33
|
+
if (/\b(next time|lesson|failed|error)\b/i.test(content) || /教训|失败|错误/.test(content)) return "task_lesson";
|
|
34
|
+
if (/习惯|每周|每天|usually|routine/i.test(content)) return "routine";
|
|
35
|
+
return "current_state";
|
|
42
36
|
}
|
|
43
37
|
function canonicalKey(kind, content) {
|
|
44
38
|
const normalized = content.toLocaleLowerCase().replace(/[^\p{L}\p{N}]+/gu, " ").trim();
|
|
@@ -46,192 +40,130 @@ function canonicalKey(kind, content) {
|
|
|
46
40
|
}
|
|
47
41
|
function extractExplicitUnderstandingCandidates(userContent) {
|
|
48
42
|
const correction = extractExplicitUnderstandingCorrectionContent(userContent);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return [];
|
|
43
|
+
const matched = correction ?? userContent.split(/\r?\n/).map((line) => line.trim()).filter(Boolean).flatMap((line) => EXPLICIT_PATTERNS.map((pattern) => pattern.exec(line)?.[1] ?? "")).map(normalizeContent).find((content) => content.length >= 8);
|
|
44
|
+
if (!matched) return [];
|
|
45
|
+
const content = normalizeContent(matched);
|
|
46
|
+
const kind = inferKind(content);
|
|
47
|
+
return [{
|
|
48
|
+
kind,
|
|
49
|
+
content,
|
|
50
|
+
canonicalKey: canonicalKey(kind, content),
|
|
51
|
+
confidence: correction ? .98 : .95,
|
|
52
|
+
importance: kind === "boundary" ? .9 : .8,
|
|
53
|
+
explicitness: "explicit",
|
|
54
|
+
durability: "durable",
|
|
55
|
+
sensitivity: inferMemorySensitivity(content),
|
|
56
|
+
disclosurePolicy: kind === "boundary" ? "silent" : "referenceable"
|
|
57
|
+
}];
|
|
58
|
+
}
|
|
59
|
+
function scopeForCandidate(candidate, context) {
|
|
60
|
+
if (candidate.durability === "ephemeral" && context.sessionKey) return {
|
|
61
|
+
type: "session",
|
|
62
|
+
id: context.sessionKey
|
|
63
|
+
};
|
|
64
|
+
if (candidate.kind === "project_context" && context.projectId) return {
|
|
65
|
+
type: "project",
|
|
66
|
+
id: context.projectId
|
|
67
|
+
};
|
|
68
|
+
if ((candidate.kind === "project_context" || candidate.kind === "task_lesson") && context.workspaceId) return {
|
|
69
|
+
type: "workspace",
|
|
70
|
+
id: context.workspaceId
|
|
71
|
+
};
|
|
72
|
+
return { type: "global" };
|
|
73
|
+
}
|
|
74
|
+
function sameScope(left, right) {
|
|
75
|
+
return left.type === right.type && left.id === right.id;
|
|
83
76
|
}
|
|
84
77
|
var UserUnderstandingService = class {
|
|
85
|
-
constructor(options) {
|
|
86
|
-
this.options = options;
|
|
87
|
-
}
|
|
88
78
|
async reviewTurn(params) {
|
|
79
|
+
params.assistantContent;
|
|
89
80
|
const candidates = extractExplicitUnderstandingCandidates(params.userContent);
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
retentionClass: "bounded",
|
|
105
|
-
synthesisStatus: "pending"
|
|
106
|
-
}]).items[0]?.id;
|
|
81
|
+
if (candidates.length === 0) return {
|
|
82
|
+
proposed: 0,
|
|
83
|
+
created: 0,
|
|
84
|
+
deduplicated: 0,
|
|
85
|
+
rejected: 0,
|
|
86
|
+
createdRecords: []
|
|
87
|
+
};
|
|
88
|
+
const evidence = createContextEvidence({
|
|
89
|
+
sourceType: "conversation",
|
|
90
|
+
sourceRef: params.sessionKey ? `session:${params.sessionKey}:turn:${params.turnId ?? "unknown"}` : `turn:${params.turnId ?? "unknown"}`,
|
|
91
|
+
redactedExcerpt: redactSensitiveMemoryText(params.userContent).slice(0, MAX_CANDIDATE_CHARS),
|
|
92
|
+
trustLevel: "owner",
|
|
93
|
+
observedAt: Date.now()
|
|
94
|
+
});
|
|
107
95
|
return {
|
|
108
96
|
...await this.applyCandidates(candidates, {
|
|
109
|
-
agentId: params.agentId,
|
|
110
97
|
sessionKey: params.sessionKey,
|
|
111
|
-
|
|
112
|
-
|
|
98
|
+
workspaceId: params.workspaceId,
|
|
99
|
+
projectId: params.projectId,
|
|
100
|
+
evidenceIds: [evidence.id],
|
|
113
101
|
reviewSource: "turn",
|
|
114
102
|
supersedesRecordIds: params.correctionTargetRecordIds
|
|
115
103
|
}),
|
|
116
|
-
sourceItemId
|
|
104
|
+
sourceItemId: evidence.id
|
|
117
105
|
};
|
|
118
106
|
}
|
|
119
107
|
async applyCandidates(candidates, context) {
|
|
120
|
-
const startedAt = Date.now();
|
|
121
108
|
let created = 0;
|
|
122
109
|
let deduplicated = 0;
|
|
123
110
|
let rejected = 0;
|
|
124
|
-
const recordIds = [];
|
|
125
111
|
const createdRecords = [];
|
|
126
|
-
const
|
|
127
|
-
const
|
|
128
|
-
|
|
112
|
+
const correctionTarget = context.supersedesRecordIds?.length === 1 ? context.supersedesRecordIds[0] : void 0;
|
|
113
|
+
const evidenceIds = [...new Set(context.evidenceIds ?? [])];
|
|
114
|
+
const sourceItemIds = [context.sourceItemId, ...context.sourceItemIds ?? []].filter((value) => Boolean(value));
|
|
115
|
+
for (const sourceItemId of [...new Set(sourceItemIds)]) {
|
|
116
|
+
const evidence = createContextEvidence({
|
|
117
|
+
sourceType: context.source?.provider ? "connector" : "runtime",
|
|
118
|
+
...context.source?.sourceInstanceId ? { sourceInstanceId: context.source.sourceInstanceId } : {},
|
|
119
|
+
sourceRef: sourceItemId,
|
|
120
|
+
...context.sourceText ? { redactedExcerpt: redactSensitiveMemoryText(context.sourceText).slice(0, MAX_CANDIDATE_CHARS) } : {},
|
|
121
|
+
trustLevel: context.source?.provider ? "untrusted" : "trusted",
|
|
122
|
+
observedAt: Date.now()
|
|
123
|
+
});
|
|
124
|
+
evidenceIds.push(evidence.id);
|
|
125
|
+
}
|
|
129
126
|
for (const candidate of candidates.slice(0, 10)) {
|
|
130
127
|
const content = normalizeContent(candidate.content);
|
|
131
|
-
const sensitivity =
|
|
132
|
-
|
|
128
|
+
const sensitivity = effectiveSensitivity(candidate.sensitivity, content);
|
|
129
|
+
const scope = scopeForCandidate(candidate, context);
|
|
130
|
+
const key = candidate.canonicalKey ?? canonicalKey(candidate.kind, content);
|
|
131
|
+
if (content.length < 4 || candidate.confidence < .55 || sensitivity === "secret" || sensitivity === "regulated" || isUnderstandingSuppressed(key, scope)) {
|
|
133
132
|
rejected += 1;
|
|
134
133
|
continue;
|
|
135
134
|
}
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
const existing = await this.options.list(key);
|
|
140
|
-
const sourceItemIds = [...new Set([...context.sourceItemId ? [context.sourceItemId] : [], ...context.sourceItemIds ?? []])];
|
|
141
|
-
const evidence = (sourceItemIds.length ? sourceItemIds : [void 0]).map((sourceItemId) => ({
|
|
142
|
-
...sourceItemId ? { sourceItemId } : {},
|
|
143
|
-
relation: "supports",
|
|
144
|
-
...context.sessionKey ? { sessionKey: context.sessionKey } : {},
|
|
145
|
-
...evidenceText ? { sourceText: evidenceText } : {},
|
|
146
|
-
observedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
147
|
-
confidence: candidate.confidence
|
|
148
|
-
}));
|
|
149
|
-
if (existing[0]) {
|
|
135
|
+
const duplicate = listUnderstandings().find((item) => item.canonicalKey === key && item.status !== "rejected" && item.status !== "archived" && sameScope(item.scope, scope));
|
|
136
|
+
if (duplicate) {
|
|
137
|
+
for (const evidenceId of evidenceIds) linkUnderstandingEvidence(duplicate.versionId, evidenceId, "supports", candidate.confidence);
|
|
150
138
|
deduplicated += 1;
|
|
151
|
-
recordIds.push(existing[0].id);
|
|
152
|
-
for (const sourceItemId of sourceItemIds) attachMemoryEvidence({
|
|
153
|
-
recordId: existing[0].id,
|
|
154
|
-
sourceItemId,
|
|
155
|
-
relation: "supports",
|
|
156
|
-
excerpt: evidenceText,
|
|
157
|
-
confidence: candidate.confidence
|
|
158
|
-
});
|
|
159
139
|
continue;
|
|
160
140
|
}
|
|
161
|
-
const
|
|
141
|
+
const isExplicit = candidate.explicitness === "explicit";
|
|
142
|
+
const record = createUnderstanding({
|
|
162
143
|
kind: candidate.kind,
|
|
163
|
-
content,
|
|
164
144
|
canonicalKey: key,
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
sessionKey: context.sessionKey
|
|
168
|
-
} : void 0,
|
|
169
|
-
tags: [...new Set(["user-understanding", ...candidate.tags ?? []])],
|
|
170
|
-
source: context.source ?? { provider: "user-understanding" },
|
|
171
|
-
confidence: candidate.confidence,
|
|
172
|
-
status: "candidate",
|
|
173
|
-
sensitivity,
|
|
145
|
+
status: isExplicit ? "active" : "candidate",
|
|
146
|
+
scope,
|
|
174
147
|
explicitness: candidate.explicitness,
|
|
175
148
|
durability: candidate.durability,
|
|
176
|
-
|
|
149
|
+
sensitivity,
|
|
177
150
|
disclosurePolicy: candidate.disclosurePolicy,
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
185
|
-
supersedesRecordId,
|
|
186
|
-
conflictGroupId
|
|
151
|
+
confidence: candidate.confidence,
|
|
152
|
+
statement: content,
|
|
153
|
+
createdBy: context.reviewSource === "background" ? "consolidation" : "runtime",
|
|
154
|
+
changeReason: context.reviewSource === "background" ? "background synthesis" : "explicit user statement",
|
|
155
|
+
...candidate.validFrom ? { validFrom: Date.parse(candidate.validFrom) } : {},
|
|
156
|
+
...candidate.validTo ? { validTo: Date.parse(candidate.validTo) } : {},
|
|
157
|
+
...correctionTarget ? { supersedesId: correctionTarget } : {}
|
|
187
158
|
});
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
kind: write.record.kind
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
for (const sourceItemId of write.record ? sourceItemIds : []) attachMemoryEvidence({
|
|
199
|
-
recordId: write.record.id,
|
|
200
|
-
sourceItemId,
|
|
201
|
-
relation: "supports",
|
|
202
|
-
excerpt: evidenceText,
|
|
203
|
-
confidence: candidate.confidence
|
|
204
|
-
});
|
|
205
|
-
} else {
|
|
206
|
-
rejected += 1;
|
|
207
|
-
log.debug({
|
|
208
|
-
errorMessage: write.error,
|
|
209
|
-
canonicalKey: key
|
|
210
|
-
}, "Understanding candidate was not stored");
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
try {
|
|
214
|
-
appendMemoryTraceEvent({
|
|
215
|
-
sessionKey: context.sessionKey,
|
|
216
|
-
phase: "understanding",
|
|
217
|
-
providerId: "user-understanding",
|
|
218
|
-
request: {
|
|
219
|
-
...context.agentId ? { agentId: context.agentId } : {},
|
|
220
|
-
source: context.reviewSource ?? "turn",
|
|
221
|
-
proposed: candidates.length,
|
|
222
|
-
created,
|
|
223
|
-
deduplicated,
|
|
224
|
-
rejected
|
|
225
|
-
},
|
|
226
|
-
resultCount: created,
|
|
227
|
-
selectedRecordIds: recordIds,
|
|
228
|
-
durationMs: Date.now() - startedAt
|
|
159
|
+
for (const evidenceId of evidenceIds) linkUnderstandingEvidence(record.versionId, evidenceId, "supports", candidate.confidence);
|
|
160
|
+
if (correctionTarget && isExplicit) setUnderstandingStatus(correctionTarget, "archived");
|
|
161
|
+
created += 1;
|
|
162
|
+
createdRecords.push({
|
|
163
|
+
id: record.id,
|
|
164
|
+
content: record.statement,
|
|
165
|
+
kind: record.kind
|
|
229
166
|
});
|
|
230
|
-
} catch (err) {
|
|
231
|
-
log.debug({
|
|
232
|
-
err,
|
|
233
|
-
sessionKey: context.sessionKey
|
|
234
|
-
}, "Understanding quality trace append failed");
|
|
235
167
|
}
|
|
236
168
|
return {
|
|
237
169
|
proposed: candidates.length,
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { UnderstandingKind, UserUnderstanding } from '../../../user-context/domain.js';
|
|
2
2
|
export interface UnderstandingCandidate {
|
|
3
|
-
kind:
|
|
3
|
+
kind: UnderstandingKind;
|
|
4
4
|
content: string;
|
|
5
5
|
canonicalKey?: string;
|
|
6
6
|
confidence: number;
|
|
7
7
|
importance: number;
|
|
8
|
-
explicitness:
|
|
9
|
-
durability:
|
|
10
|
-
sensitivity:
|
|
11
|
-
disclosurePolicy:
|
|
12
|
-
tags?: string[];
|
|
8
|
+
explicitness: UserUnderstanding['explicitness'];
|
|
9
|
+
durability: UserUnderstanding['durability'];
|
|
10
|
+
sensitivity: UserUnderstanding['sensitivity'];
|
|
11
|
+
disclosurePolicy: UserUnderstanding['disclosurePolicy'];
|
|
13
12
|
validFrom?: string;
|
|
14
13
|
validTo?: string;
|
|
15
14
|
}
|
|
@@ -22,6 +21,6 @@ export interface UnderstandingReviewResult {
|
|
|
22
21
|
createdRecords: Array<{
|
|
23
22
|
id: string;
|
|
24
23
|
content: string;
|
|
25
|
-
kind:
|
|
24
|
+
kind: UnderstandingKind;
|
|
26
25
|
}>;
|
|
27
26
|
}
|
|
@@ -6,6 +6,8 @@ export interface UserContextCoordinatorOptions {
|
|
|
6
6
|
getConfig: () => Config | undefined;
|
|
7
7
|
isEnabledForSession: (sessionKey: string) => boolean;
|
|
8
8
|
getAgentIdForSession: (sessionKey: string) => string;
|
|
9
|
+
getWorkspaceIdForSession?: (sessionKey: string) => string;
|
|
10
|
+
getProjectIdForSession?: (sessionKey: string) => string | undefined;
|
|
9
11
|
getMemoryManagerForSession: (sessionKey: string) => MemoryManager;
|
|
10
12
|
getLastAssistantContent: (sessionKey: string) => string | null;
|
|
11
13
|
}
|
|
@@ -15,7 +17,6 @@ export declare class UserContextCoordinator {
|
|
|
15
17
|
private readonly lastTurnId;
|
|
16
18
|
private readonly correctionTargets;
|
|
17
19
|
private readonly planner;
|
|
18
|
-
private readonly contextCompiler;
|
|
19
20
|
constructor(options: UserContextCoordinatorOptions);
|
|
20
21
|
forgetSession(sessionKey: string): void;
|
|
21
22
|
clear(): void;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import {
|
|
3
|
+
import { getTurnPersonalization, recordContextFeedback, setUnderstandingStatus } from "../../storage/sqlite/user-context-repository.js";
|
|
4
4
|
import "../../storage/sqlite/index.js";
|
|
5
|
+
import { init_session_key, parseSessionKey } from "../../routing/session-key.js";
|
|
5
6
|
import { assembleTaskContext } from "../../tasks/task-context-assembler.js";
|
|
6
7
|
import { shouldPlanUserContextThisTurn } from "./memory-config.js";
|
|
7
|
-
import {
|
|
8
|
-
import { UserContextPlanner } from "./context/planner.js";
|
|
8
|
+
import { UserContextPlanner } from "../../user-context/planner.js";
|
|
9
9
|
import { isExplicitUnderstandingCorrection } from "./understanding/correction.js";
|
|
10
10
|
import { extractAgentUserPlainText } from "./user-message-text.js";
|
|
11
11
|
//#region src/agent/memory/user-context-coordinator.ts
|
|
12
|
+
init_session_key();
|
|
12
13
|
init_logger();
|
|
13
14
|
const log = createLogger("UserContextCoordinator");
|
|
14
15
|
var UserContextCoordinator = class {
|
|
@@ -16,7 +17,6 @@ var UserContextCoordinator = class {
|
|
|
16
17
|
lastTurnId = /* @__PURE__ */ new Map();
|
|
17
18
|
correctionTargets = /* @__PURE__ */ new Map();
|
|
18
19
|
planner = new UserContextPlanner();
|
|
19
|
-
contextCompiler = new ContextCompiler();
|
|
20
20
|
constructor(options) {
|
|
21
21
|
this.options = options;
|
|
22
22
|
}
|
|
@@ -49,26 +49,22 @@ var UserContextCoordinator = class {
|
|
|
49
49
|
this.correctionTargets.delete(sessionKey);
|
|
50
50
|
let excludedRecordIds;
|
|
51
51
|
if (previousTurnId && isExplicitUnderstandingCorrection(userQuery)) try {
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
rating: "incorrect",
|
|
69
|
-
reasonCode: "detected_explicit_user_correction"
|
|
70
|
-
}]
|
|
71
|
-
});
|
|
52
|
+
const personalization = getTurnPersonalization(previousTurnId);
|
|
53
|
+
const selectedIds = personalization?.items.filter((item) => item.objectType === "understanding" && item.decision === "selected").map((item) => item.objectId) ?? [];
|
|
54
|
+
if (personalization && selectedIds.length) {
|
|
55
|
+
for (const recordId of selectedIds) {
|
|
56
|
+
recordContextFeedback({
|
|
57
|
+
turnId: previousTurnId,
|
|
58
|
+
runId: personalization.runId,
|
|
59
|
+
objectType: "understanding",
|
|
60
|
+
objectId: recordId,
|
|
61
|
+
rating: "wrong",
|
|
62
|
+
reason: "detected_explicit_user_correction"
|
|
63
|
+
});
|
|
64
|
+
setUnderstandingStatus(recordId, "needs_review");
|
|
65
|
+
}
|
|
66
|
+
this.correctionTargets.set(sessionKey, selectedIds);
|
|
67
|
+
excludedRecordIds = selectedIds;
|
|
72
68
|
}
|
|
73
69
|
} catch (err) {
|
|
74
70
|
log.debug({
|
|
@@ -79,30 +75,17 @@ var UserContextCoordinator = class {
|
|
|
79
75
|
const turn = (this.userTurn.get(sessionKey) ?? 0) + 1;
|
|
80
76
|
this.userTurn.set(sessionKey, turn);
|
|
81
77
|
if (!shouldPlanUserContextThisTurn(config, turn)) return empty();
|
|
82
|
-
|
|
83
|
-
memoryManager: this.options.getMemoryManagerForSession(sessionKey),
|
|
84
|
-
agentId: this.options.getAgentIdForSession(sessionKey),
|
|
78
|
+
return this.planner.plan({
|
|
85
79
|
sessionKey,
|
|
80
|
+
channel: parseSessionKey(sessionKey)?.source,
|
|
81
|
+
workspaceId: this.options.getWorkspaceIdForSession?.(sessionKey) ?? "",
|
|
82
|
+
projectId: this.options.getProjectIdForSession?.(sessionKey),
|
|
86
83
|
turnId,
|
|
87
84
|
query,
|
|
88
85
|
userMessage,
|
|
89
86
|
excludedRecordIds,
|
|
90
87
|
allocation: taskContext.allocation
|
|
91
88
|
});
|
|
92
|
-
if (plan.traceId) try {
|
|
93
|
-
this.contextCompiler.capture({
|
|
94
|
-
sessionKey,
|
|
95
|
-
query,
|
|
96
|
-
plan
|
|
97
|
-
});
|
|
98
|
-
} catch (err) {
|
|
99
|
-
log.debug({
|
|
100
|
-
err,
|
|
101
|
-
sessionKey,
|
|
102
|
-
traceId: plan.traceId
|
|
103
|
-
}, "Context snapshot was not persisted");
|
|
104
|
-
}
|
|
105
|
-
return plan;
|
|
106
89
|
}
|
|
107
90
|
async afterTurn(sessionKey, userPlainText) {
|
|
108
91
|
if (!this.options.isEnabledForSession(sessionKey)) return void 0;
|
|
@@ -114,6 +97,9 @@ var UserContextCoordinator = class {
|
|
|
114
97
|
const review = await memoryManager.captureTurnUnderstanding(userPlainText, assistantContent, {
|
|
115
98
|
agentId: this.options.getAgentIdForSession(sessionKey),
|
|
116
99
|
sessionId: sessionKey,
|
|
100
|
+
turnId: this.lastTurnId.get(sessionKey),
|
|
101
|
+
workspaceId: this.options.getWorkspaceIdForSession?.(sessionKey),
|
|
102
|
+
projectId: this.options.getProjectIdForSession?.(sessionKey),
|
|
117
103
|
correctionTargetRecordIds
|
|
118
104
|
});
|
|
119
105
|
memoryManager.syncProvidersForTurn(userPlainText, assistantContent, { sessionId: sessionKey });
|
|
@@ -75,7 +75,7 @@ export declare class CommandHandler {
|
|
|
75
75
|
updateAgentConfig(config: Config): void;
|
|
76
76
|
/**
|
|
77
77
|
* Build the unified command context shared by all execute paths.
|
|
78
|
-
* When `recorder` is set, every reply text is also captured (for
|
|
78
|
+
* When `recorder` is set, every reply text is also captured (for realtime / CLI aggregation).
|
|
79
79
|
*/
|
|
80
80
|
private buildCommandContext;
|
|
81
81
|
/**
|
|
@@ -83,7 +83,7 @@ export declare class CommandHandler {
|
|
|
83
83
|
*/
|
|
84
84
|
executeCommand(commandName: string, args: string, context: CommandContext): Promise<boolean>;
|
|
85
85
|
/**
|
|
86
|
-
* Run command and return all user-visible text (ctx.reply + result.content) for
|
|
86
|
+
* Run command and return all user-visible text (ctx.reply + result.content) for realtime/CLI.
|
|
87
87
|
* Same bus side effects as {@link executeCommand}.
|
|
88
88
|
*/
|
|
89
89
|
executeCommandAndAggregateReply(commandName: string, args: string, context: CommandContext, options?: {
|
|
@@ -8,7 +8,7 @@ import "../../chat-commands/index.js";
|
|
|
8
8
|
init_providers();
|
|
9
9
|
init_logger();
|
|
10
10
|
const log = createLogger("CommandHandler");
|
|
11
|
-
/** Gateway console direct stream uses
|
|
11
|
+
/** Gateway console direct stream uses realtime events; there is no ChannelPlugin outbound for `webchat`. */
|
|
12
12
|
function shouldSkipBusOutboundForChannel(channel) {
|
|
13
13
|
return channel === "webchat";
|
|
14
14
|
}
|
|
@@ -53,7 +53,7 @@ var CommandHandler = class {
|
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* Build the unified command context shared by all execute paths.
|
|
56
|
-
* When `recorder` is set, every reply text is also captured (for
|
|
56
|
+
* When `recorder` is set, every reply text is also captured (for realtime / CLI aggregation).
|
|
57
57
|
*/
|
|
58
58
|
buildCommandContext(context, recorder, emitEvent) {
|
|
59
59
|
const skipBusOutbound = shouldSkipBusOutboundForChannel(context.channel);
|
|
@@ -162,7 +162,7 @@ var CommandHandler = class {
|
|
|
162
162
|
return true;
|
|
163
163
|
}
|
|
164
164
|
/**
|
|
165
|
-
* Run command and return all user-visible text (ctx.reply + result.content) for
|
|
165
|
+
* Run command and return all user-visible text (ctx.reply + result.content) for realtime/CLI.
|
|
166
166
|
* Same bus side effects as {@link executeCommand}.
|
|
167
167
|
*/
|
|
168
168
|
async executeCommandAndAggregateReply(commandName, args, context, options) {
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import "
|
|
3
|
+
import { runContextConsolidation } from "../../user-context/consolidation.js";
|
|
4
4
|
import { persistInboundAttachments } from "../../channels/attachments/inbound-persist.js";
|
|
5
5
|
import { buildTranscriptUserMessage, clearPendingTranscriptUserMessage, hydrateUserTurnForLlm, setPendingTranscriptUserMessage } from "../inbound/attachment-pipeline.js";
|
|
6
6
|
import { extractAgentUserPlainText } from "../memory/user-message-text.js";
|
|
7
7
|
import { resolveEffectiveThinkingLevel } from "../../session/thinking-resolve.js";
|
|
8
8
|
import { abortEmbeddedRun } from "../embedded/runs.js";
|
|
9
9
|
import { runEmbeddedTurnForSession } from "../embedded/run-for-session.js";
|
|
10
|
-
import { runDreamingPhase } from "../memory/dreaming/runner.js";
|
|
11
10
|
import { randomUUID } from "node:crypto";
|
|
12
11
|
//#region src/agent/orchestration/agent-orchestrator.ts
|
|
13
12
|
/**
|
|
@@ -51,16 +50,14 @@ var AgentOrchestrator = class {
|
|
|
51
50
|
log.debug({ sessionKey }, "Processing message through agent orchestrator");
|
|
52
51
|
await this.sessionHydrator.workspace(sessionKey);
|
|
53
52
|
if (typeof msg.content === "string" && (sessionKey.startsWith("cron:") || sessionKey.includes(":cron:") || sessionKey.includes(":automation:") || context.channel === "cron" || context.channel === "automation")) {
|
|
54
|
-
|
|
55
|
-
if (content.includes("__xopc_memory_dreaming_sweep__") || content.includes("__xopc_memory_dreaming_light_sweep__") || content.includes("__xopc_memory_dreaming_rem_sweep__")) {
|
|
53
|
+
if (msg.content.includes("__xopc_user_context_consolidation__")) {
|
|
56
54
|
const cfg = this.getConfig?.();
|
|
57
55
|
if (!cfg) {
|
|
58
|
-
log.warn({ sessionKey }, "
|
|
56
|
+
log.warn({ sessionKey }, "User context review skipped: config unavailable");
|
|
59
57
|
return;
|
|
60
58
|
}
|
|
61
|
-
await
|
|
59
|
+
await runContextConsolidation({
|
|
62
60
|
config: cfg,
|
|
63
|
-
phase: content.includes("__xopc_memory_dreaming_light_sweep__") ? "light" : content.includes("__xopc_memory_dreaming_rem_sweep__") ? "rem" : "deep",
|
|
64
61
|
triggerKind: "schedule"
|
|
65
62
|
});
|
|
66
63
|
return;
|
|
@@ -5,7 +5,7 @@ function buildMemorySection(params) {
|
|
|
5
5
|
const citationsMode = params.citationsMode ?? "on";
|
|
6
6
|
const citationInstruction = citationsMode === "off" ? "Citations are disabled: do not mention file paths or line numbers in replies." : citationsMode === "source-only" ? "Citations: mention the memory record id when it helps." : "Citations: include the memory record id when it helps the user verify recalled context.";
|
|
7
7
|
const toolLines = [];
|
|
8
|
-
if (params.availableTools.has("memory_search")) toolLines.push("1. Run `memory_search` to search
|
|
8
|
+
if (params.availableTools.has("memory_search")) toolLines.push("1. Run `memory_search` to search workspace and connected-source memory records");
|
|
9
9
|
if (params.availableTools.has("session_search")) toolLines.push(`${toolLines.length + 1}. For **other chat sessions** / cross-session history, use \`session_search\` with keywords (or omit \`query\` to list recent sessions)`);
|
|
10
10
|
if (params.availableTools.has("memory_get")) toolLines.push(`${toolLines.length + 1}. Use \`memory_get\` only for record ids returned by \`memory_search\``);
|
|
11
11
|
toolLines.push(`${toolLines.length + 1}. If low confidence after search, say you checked`);
|
|
@@ -14,7 +14,7 @@ function buildMemorySection(params) {
|
|
|
14
14
|
"",
|
|
15
15
|
citationInstruction,
|
|
16
16
|
"",
|
|
17
|
-
"
|
|
17
|
+
"Relevant user understanding is selected separately and injected above.",
|
|
18
18
|
"",
|
|
19
19
|
"Before answering anything about prior work, decisions, dates, people, preferences, or todos:",
|
|
20
20
|
...toolLines,
|
|
@@ -22,11 +22,11 @@ function buildMemorySection(params) {
|
|
|
22
22
|
"### Memory Sources",
|
|
23
23
|
"",
|
|
24
24
|
"- **Session history:** use `session_search` when available for other chats and prior turns.",
|
|
25
|
-
"- **
|
|
25
|
+
"- **Workspace memory:** cite only record ids returned by `memory_search` / `memory_get`.",
|
|
26
26
|
"",
|
|
27
27
|
"### Writing to Memory",
|
|
28
28
|
"",
|
|
29
|
-
"- **Declarative vs procedural:**
|
|
29
|
+
"- **Declarative vs procedural:** user preferences belong to structured user understanding; reusable task procedures belong to skills.",
|
|
30
30
|
"- Explicit \"remember this\" statements are captured as durable structured understanding after the turn.",
|
|
31
31
|
"- Do not invent, cite, or promise memory record ids that were not returned by a memory tool.",
|
|
32
32
|
"- **Text > Brain**"
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
//#region src/agent/prompt/sections/tooling.ts
|
|
2
2
|
const CORE_TOOL_ORDER = [
|
|
3
|
-
"code_search",
|
|
4
|
-
"code_read_symbol",
|
|
5
|
-
"code_trace",
|
|
6
|
-
"code_impact",
|
|
7
|
-
"code_architecture",
|
|
8
3
|
"read_file",
|
|
9
4
|
"write_file",
|
|
10
5
|
"apply_patch",
|
|
@@ -41,11 +36,6 @@ const CORE_TOOL_ORDER = [
|
|
|
41
36
|
"execute_code"
|
|
42
37
|
];
|
|
43
38
|
const CORE_TOOL_SUMMARIES = {
|
|
44
|
-
code_search: "Find definitions, implementations, routes, types, and structurally important symbols",
|
|
45
|
-
code_read_symbol: "Read exact source for a graph symbol before editing",
|
|
46
|
-
code_trace: "Trace callers, callees, data flow, and cross-service paths",
|
|
47
|
-
code_impact: "Map git changes to affected symbols and blast radius",
|
|
48
|
-
code_architecture: "Map packages, boundaries, layers, entry points, hotspots, and clusters",
|
|
49
39
|
read_file: "Read targeted file contents before editing",
|
|
50
40
|
write_file: "Create new files or intentional complete rewrites; prefer apply_patch for code changes",
|
|
51
41
|
apply_patch: "Apply source edits with patches that begin exactly with *** Begin Patch and end exactly with *** End Patch",
|