@xopcai/xopc 0.0.218 → 0.0.220
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-DF2dYXG1.js → activity-store-DeKZ36Jy.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Dw9rF5o1.js → agent-avatar-dicebear-D0hZfdkn.js} +1 -1
- package/dist/gateway/static/root/assets/agents-Bu0NfWuh.js +68 -0
- package/dist/gateway/static/root/assets/{api-_H0Bam-t.js → api-yLnYUedB.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-C2kZNEHz.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-DQ7H35sN.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-Tty2xaUG.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-DZCOhXch.js → archive-plugin-CBArbTPH.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-Bjb0FH2B.js → attachment-load-oc6DRj4G.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-D4N3ZDhu.js → automations-page-CHPEUpz8.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-9uYkHmdI.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-uXPt0s47.js → binary-plugins-BRBd0X7_.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-gukkIEro.js → block-editor-ZgM-Z4Qv.js} +47 -47
- package/dist/gateway/static/root/assets/browser-settings-page-BT3mEm00.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-DAhdS-XZ.js → browser-workflow-inputs-DxD74a4c.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-LKjYzXS_.js → browser-workflows-page-Dpc7NqZf.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DHlfRj4M.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-BBUkH833.js → capability-presets-api-B9ID97j6.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-D2FkREUX.js +3 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-E5mo8M3a.js → channel-recipient-api-DCNn6MWL.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-D4YcKMtf.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-B8XWrzKM.js +1 -0
- package/dist/gateway/static/root/assets/chat-terminal-dock-MvNpjcUs.js +36 -0
- package/dist/gateway/static/root/assets/connectors-page-Bd6K9bDk.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-BGNuaqvI.js → cron-expression-BSXX9uY0.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-k7mkklMU.js → date-picker-CiHNkkIS.js} +1 -1
- package/dist/gateway/static/root/assets/dependency-picker-DQyh2ZXE.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-p9EZyGzV.js → desktop-pet-DnAHU-zA.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-DUdhIBBB.js +1 -0
- package/dist/gateway/static/root/assets/directory-picker-path-field-B3gFQt8x.js +1 -0
- package/dist/gateway/static/root/assets/ellipsis-0k4rZLoy.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-Cd4BMKm_.js → extension-debug-page-Lq-gRApw.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-CzEGCkOa.js → extension-page-D0ROxJmY.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-B2tS6mFy.js +1 -0
- package/dist/gateway/static/root/assets/eye-CABVeTq0.js +1 -0
- package/dist/gateway/static/root/assets/eye-off-DEAzt3g1.js +1 -0
- package/dist/gateway/static/root/assets/file-code-corner-byQA1VfD.js +1 -0
- package/dist/gateway/static/root/assets/form-field-width-DJw_jULe.js +1 -0
- package/dist/gateway/static/root/assets/gateway-config-api-DJqWfVi6.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-DNrttVr2.js → gateway-config-swr-CnwF9Vso.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-B3thenPX.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-B1vD3vRb.js → gateway-startup-retry-DdJJZR8M.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-C_g-ZGSE.js +1 -0
- package/dist/gateway/static/root/assets/home-page-Cgwx66kc.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-BTR0Wk_k.js → image-generation-api-Dtt9M5qz.js} +1 -1
- package/dist/gateway/static/root/assets/index-Cf0qTkBK.css +2 -0
- package/dist/gateway/static/root/assets/index-V9g9-SWT.js +108 -0
- package/dist/gateway/static/root/assets/interaction-BmQogeqz.js +1 -0
- package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +1 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CYlS4RGA.js → keyboard-shortcuts-settings-cJqkmQdP.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CmjLMdly.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CNppYVew.js → local-apps-page-BiuP2pkl.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-gf9Bg2gb.js → locale-store-D3Q2yEAb.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-BTlxGPho.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-IYk9xLgt.js → management-settings-Z1gJUwP_.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-D8e6pRMH.js → markdown-split-DuOmpGgE.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-D0fiJjBQ.js → markdown-view-WYArkdrc.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-CCq6TtEf.js → media-plugins-DKPh3Mud.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BQHpB4VI.js +3 -0
- package/dist/gateway/static/root/assets/{notes-api-BBtWnlUU.js → notes-api-DMEon7Zv.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-BKe1xa3U.js → notes-page-BG4gV8WG.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-D3LMBO2X.js +4 -0
- package/dist/gateway/static/root/assets/page-tabs-BaEQMYm_.js +1 -0
- package/dist/gateway/static/root/assets/preview-open-alternatives-CsNVTKC0.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-DXe5iWI6.js → product-open-page-BjJf4QOB.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-C59tYJG-.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-Di7W-Fg8.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-xj5gOva_.js → registry-api-DRyvynb5.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BYOKveWT.js +1 -0
- package/dist/gateway/static/root/assets/rotate-cw-LIg3Am9S.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BJTvmBCA.js → runtime-tools-settings-panel-DC6t_-db.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-DvGBa_7R.js → schema-form-DSTWtpjp.js} +1 -1
- package/dist/gateway/static/root/assets/search-DA7gz22f.js +1 -0
- package/dist/gateway/static/root/assets/sessions-page-CJMNQsxK.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-FJxZw08y.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-ZzEMNLYS.js +1 -0
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-sbef7GTm.js → settings-loading-skeleton-D7-bkbcW.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BNGxxXZe.js → settings-page-PaTpLbmi.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Bnpim6NY.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-C1523ij3.js → share-preview-page-Cxcw0ksa.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-DBqmV7ZY.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-UgLQaWoz.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-Dby4iAYe.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-Ditgz7Vo.js → skills-page.utils-nlzJ5Y1V.js} +1 -1
- package/dist/gateway/static/root/assets/system-settings-panel-vOsgnzDl.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-CRy8Wl5g.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-DgSjes3O.js → theme-store-CvnEHGyP.js} +1 -1
- package/dist/gateway/static/root/assets/typed-models-lib-q5-Vfqd8.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-Bp_qFZkl.js → use-autosave-BTNZHulv.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-BT8F4mh5.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-hbzDfErG.js → voice-api-key-field-DDJ2-3Tx.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-DZVib-04.js → work-discovery-overlay-DV_qiKSD.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-C2RKay1p.js → workflow-run-setup-panel--AcvRw1w.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-CwvskVvU.js +5 -0
- package/dist/gateway/static/root/index.html +21 -12
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/new-session.js +99 -0
- package/dist/packages/gateway-contract/src/tasks.js +5 -0
- package/dist/packages/gateway-contract/src/user-message-display.js +55 -0
- package/dist/src/agent/agent-manager.js +5 -4
- package/dist/src/agent/background-review/prompts.d.ts +1 -1
- package/dist/src/agent/background-review/prompts.js +2 -2
- package/dist/src/agent/background-review/run-background-review.js +144 -16
- package/dist/src/agent/embedded/model-runtime.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -1
- package/dist/src/agent/image/tool-model-config.js +1 -1
- package/dist/src/agent/inbound/turn-dispatcher.d.ts +3 -1
- package/dist/src/agent/inbound/turn-dispatcher.js +2 -1
- package/dist/src/agent/ipc/inbox.js +1 -1
- package/dist/src/agent/memory/context/types.d.ts +1 -1
- package/dist/src/agent/memory/manager.d.ts +2 -1
- package/dist/src/agent/memory/manager.js +2 -6
- package/dist/src/agent/memory/understanding/service.d.ts +1 -0
- package/dist/src/agent/memory/understanding/service.js +179 -36
- package/dist/src/agent/memory/understanding/types.d.ts +6 -0
- package/dist/src/agent/messaging/command-handler.d.ts +2 -0
- package/dist/src/agent/messaging/command-handler.js +3 -1
- package/dist/src/agent/service/direct-turn-helpers.d.ts +3 -0
- package/dist/src/agent/service/direct-turn-helpers.js +13 -3
- package/dist/src/agent/service/process-direct-streaming.d.ts +2 -1
- package/dist/src/agent/service/process-direct-streaming.js +12 -11
- package/dist/src/agent/service.js +2 -2
- package/dist/src/agent/session/session-config-service.d.ts +1 -0
- package/dist/src/agent/session/session-config-service.js +11 -0
- package/dist/src/agent/session/session-inspector.d.ts +1 -0
- package/dist/src/agent/session/session-inspector.js +2 -1
- package/dist/src/agent/skills/hub-lock.js +1 -1
- package/dist/src/agent/source-context/budget.d.ts +3 -0
- package/dist/src/agent/source-context/budget.js +21 -0
- package/dist/src/agent/source-context/index.js +3 -3
- package/dist/src/agent/source-context/injector.d.ts +2 -2
- package/dist/src/agent/source-context/injector.js +19 -9
- package/dist/src/agent/source-context/types.d.ts +16 -0
- package/dist/src/agent/source-context/types.js +25 -1
- package/dist/src/agent/tasks/task-judge-service.js +3 -3
- package/dist/src/agent/tool-manuals/xopc-use.d.ts +1 -1
- package/dist/src/agent/tool-manuals/xopc-use.js +19 -2
- package/dist/src/agent/tools/xopc-use-tool.js +62 -2
- package/dist/src/ai-assist/text-assist.js +1 -1
- package/dist/src/auth/credentials.js +2 -2
- package/dist/src/auth/profiles/store.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +2 -2
- package/dist/src/browser/backend-from-config.d.ts +8 -0
- package/dist/src/browser/backend-from-config.js +16 -1
- package/dist/src/browser/providers/browser-ext-install.d.ts +3 -2
- package/dist/src/browser/providers/browser-ext-install.js +5 -3
- package/dist/src/chat-commands/builtins/review.js +11 -2
- package/dist/src/chat-commands/builtins/understanding.js +11 -4
- package/dist/src/chat-commands/types.d.ts +4 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/doctor/checks/provider-auth.js +1 -1
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/config/index.js +4 -4
- package/dist/src/config/loader.js +1 -1
- package/dist/src/config/models-json.d.ts +20 -20
- package/dist/src/config/models-json.js +1 -1
- package/dist/src/connectors/connected-source-understanding.d.ts +1 -0
- package/dist/src/connectors/connected-source-understanding.js +87 -38
- package/dist/src/connectors/learning-coordinator.js +68 -13
- package/dist/src/extensions/lockfile.js +1 -1
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/chat-stream/mapper.js +18 -0
- package/dist/src/gateway/file-path-classifier.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.js +1 -1
- package/dist/src/gateway/hono/routes/agent-stream.js +12 -2
- package/dist/src/gateway/hono/routes/commands-skills.js +1 -0
- package/dist/src/gateway/hono/routes/models.js +1 -1
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +46 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +23 -3
- package/dist/src/gateway/hono/routes/sessions.js +17 -20
- package/dist/src/gateway/hono/routes/tasks.js +25 -0
- package/dist/src/gateway/hono/routes/understanding-sources.d.ts +18 -0
- package/dist/src/gateway/hono/routes/understanding-sources.js +165 -36
- package/dist/src/gateway/hono/routes/work-discovery.js +13 -3
- package/dist/src/gateway/hono/routes/workflows.js +2 -2
- package/dist/src/gateway/hono/routes/you.js +71 -4
- package/dist/src/gateway/service/agent-runner.d.ts +11 -2
- package/dist/src/gateway/service/agent-runner.js +27 -1
- package/dist/src/gateway/service/config-coordinator.js +1 -1
- package/dist/src/gateway/service/run-gateway-agent.d.ts +2 -0
- package/dist/src/gateway/service/run-gateway-agent.js +15 -9
- package/dist/src/gateway/service/session-input-coordinator.d.ts +8 -2
- package/dist/src/gateway/service/session-input-coordinator.js +62 -3
- package/dist/src/gateway/service/sessions-api.d.ts +10 -0
- package/dist/src/gateway/service/sessions-api.js +3 -0
- package/dist/src/gateway/service.d.ts +3 -2
- package/dist/src/gateway/service.js +27 -16
- package/dist/src/gateway/user-turn-input.d.ts +2 -0
- package/dist/src/gateway/xopc-cloud-capability-setup.d.ts +3 -2
- package/dist/src/gateway/xopc-cloud-capability-setup.js +16 -3
- package/dist/src/knowledge/connected-knowledge-pipeline.d.ts +6 -0
- package/dist/src/knowledge/connected-knowledge-pipeline.js +35 -4
- package/dist/src/knowledge/connected-understanding-pipeline.d.ts +1 -1
- package/dist/src/knowledge/connected-understanding-pipeline.js +4 -2
- package/dist/src/providers/auth-runtime/resolve-auth.js +1 -1
- package/dist/src/providers/index.js +2 -2
- package/dist/src/providers/model-registry.js +1 -1
- package/dist/src/providers/register-runtime-providers.js +1 -1
- package/dist/src/retrieval/queryProfile.d.ts +3 -0
- package/dist/src/retrieval/queryProfile.js +20 -2
- package/dist/src/session/client-history.d.ts +11 -0
- package/dist/src/session/client-history.js +24 -2
- package/dist/src/session/config-types.d.ts +1 -1
- package/dist/src/session/session-title.js +2 -3
- package/dist/src/session/store.js +1 -0
- package/dist/src/session/transcript-outline.js +5 -2
- package/dist/src/session/types.d.ts +1 -0
- package/dist/src/session/user-message-display.d.ts +4 -0
- package/dist/src/session/user-message-display.js +22 -0
- package/dist/src/storage/sqlite/context-extraction-repository.d.ts +57 -0
- package/dist/src/storage/sqlite/context-extraction-repository.js +119 -0
- package/dist/src/storage/sqlite/context-relation-repository.d.ts +50 -0
- package/dist/src/storage/sqlite/context-relation-repository.js +97 -0
- package/dist/src/storage/sqlite/index.d.ts +6 -4
- package/dist/src/storage/sqlite/index.js +7 -5
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +5 -1
- package/dist/src/storage/sqlite/knowledge-repository.js +16 -1
- package/dist/src/storage/sqlite/memory-records-repository.d.ts +2 -0
- package/dist/src/storage/sqlite/memory-records-repository.js +21 -1
- package/dist/src/storage/sqlite/migrations/126_focus_context_governance.sql +72 -0
- package/dist/src/storage/sqlite/migrations/127_context_object_origin.sql +36 -0
- package/dist/src/storage/sqlite/migrations/128_context_extraction.sql +73 -0
- package/dist/src/storage/sqlite/migrations/129_focus_versions.sql +51 -0
- package/dist/src/storage/sqlite/migrations/130_context_evidence_provenance.sql +18 -0
- package/dist/src/storage/sqlite/migrations/131_session_input_contexts.sql +2 -0
- package/dist/src/storage/sqlite/migrations/132_transcript_source_context_metadata.sql +34 -0
- package/dist/src/storage/sqlite/migrations/133_archive_legacy_work_discovery_profile_facts.sql +11 -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/session-input-repository.d.ts +8 -0
- package/dist/src/storage/sqlite/session-input-repository.js +19 -7
- package/dist/src/storage/sqlite/session-repository.js +2 -2
- package/dist/src/storage/sqlite/session-turn-replace-repository.d.ts +3 -0
- package/dist/src/storage/sqlite/session-turn-replace-repository.js +3 -2
- package/dist/src/storage/sqlite/transcript-repository.js +29 -3
- package/dist/src/storage/sqlite/user-context-repository.d.ts +4 -1
- package/dist/src/storage/sqlite/user-context-repository.js +65 -29
- package/dist/src/tasks/home-query-service.d.ts +14 -0
- package/dist/src/tasks/home-query-service.js +19 -2
- package/dist/src/tasks/index.d.ts +1 -0
- package/dist/src/tasks/index.js +2 -1
- package/dist/src/tasks/task-deletion-service.d.ts +21 -0
- package/dist/src/tasks/task-deletion-service.js +35 -0
- package/dist/src/tasks/task-repository.js +22 -1
- package/dist/src/tui/backends/embedded-backend.js +5 -3
- package/dist/src/tui/backends/gateway-realtime-backend.js +5 -3
- package/dist/src/tui/chat-history.js +2 -1
- package/dist/src/tui/tui-agent-events.js +4 -2
- package/dist/src/tui/tui-commands.d.ts +1 -0
- package/dist/src/tui/tui-commands.js +8 -3
- package/dist/src/tui/tui-empty-session-cleanup.d.ts +0 -1
- package/dist/src/tui/tui-empty-session-cleanup.js +1 -11
- package/dist/src/tui/tui-new-session-preferences.d.ts +10 -0
- package/dist/src/tui/tui-new-session-preferences.js +32 -0
- package/dist/src/tui/tui-session-actions.d.ts +1 -0
- package/dist/src/tui/tui-session-actions.js +2 -1
- package/dist/src/tui/tui-settings.d.ts +2 -0
- package/dist/src/tui/tui-settings.js +4 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui-types.d.ts +1 -0
- package/dist/src/tui/tui.js +58 -5
- package/dist/src/tunnel/frpc-process.js +3 -0
- package/dist/src/tunnel/tunnel-service.d.ts +2 -0
- package/dist/src/tunnel/tunnel-service.js +40 -28
- package/dist/src/user-context/consolidation.d.ts +1 -0
- package/dist/src/user-context/consolidation.js +62 -2
- package/dist/src/user-context/context-objects.d.ts +17 -0
- package/dist/src/user-context/context-objects.js +99 -0
- package/dist/src/user-context/domain.d.ts +13 -1
- package/dist/src/user-context/evaluation/harness.d.ts +13 -0
- package/dist/src/user-context/evaluation/harness.js +31 -0
- package/dist/src/user-context/extraction/registry.d.ts +26 -0
- package/dist/src/user-context/extraction/registry.js +113 -0
- package/dist/src/user-context/extraction/repair.d.ts +19 -0
- package/dist/src/user-context/extraction/repair.js +68 -0
- package/dist/src/user-context/focus-lifecycle.d.ts +2 -0
- package/dist/src/user-context/focus-lifecycle.js +26 -0
- package/dist/src/user-context/planner.js +252 -62
- package/dist/src/user-context/retriever.js +69 -9
- package/dist/src/user-context/sources/index.js +2 -2
- package/dist/src/user-context/sources/processing-policy.d.ts +2 -0
- package/dist/src/user-context/sources/processing-policy.js +7 -0
- package/dist/src/user-context/sources/repository.d.ts +23 -4
- package/dist/src/user-context/sources/repository.js +122 -12
- package/dist/src/user-context/sources/types.d.ts +10 -1
- package/dist/src/user-context/understanding.js +1 -1
- package/dist/src/work-discovery/analyzer.js +6 -4
- package/dist/src/work-discovery/index.js +2 -2
- package/dist/src/work-discovery/service.d.ts +12 -3
- package/dist/src/work-discovery/service.js +183 -86
- package/dist/src/work-discovery/source-repository.d.ts +1 -0
- package/dist/src/work-discovery/source-repository.js +10 -4
- package/dist/src/work-discovery/types.d.ts +2 -1
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agents-Dj86bHkl.js +0 -68
- package/dist/gateway/static/root/assets/app-management-settings-panel-D-M6GN-8.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-XDhmzdIc.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-sfO835uz.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-PptuZgoo.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-BoCmzMFV.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DhkJsU8Z.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-Dm7T61fE.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-dG6UFVqt.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-DgJxfNyK.js +0 -1
- package/dist/gateway/static/root/assets/chat-terminal-dock-CT5yoSMD.js +0 -36
- package/dist/gateway/static/root/assets/connectors-page-BC6Ft9SU.js +0 -2
- package/dist/gateway/static/root/assets/dependency-picker-DZVSgLXH.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-Bw4cCFzI.js +0 -1
- package/dist/gateway/static/root/assets/directory-picker-path-field-Cbst7IXR.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-C1PAKSy2.js +0 -1
- package/dist/gateway/static/root/assets/gateway-config-api-Bch9vO6t.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DkDxZFGG.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DXNMxy5b.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CYcpVFNT.js +0 -1
- package/dist/gateway/static/root/assets/index-Dgb1R07E.css +0 -2
- package/dist/gateway/static/root/assets/index-DlOYwVFK.js +0 -108
- package/dist/gateway/static/root/assets/local-app-workbench-page-BFrgPwGE.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-CPweLw3k.js +0 -2
- package/dist/gateway/static/root/assets/messages-B9WQcZ1V.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-wieRAd1y.js +0 -4
- package/dist/gateway/static/root/assets/page-tabs-Bsluqyfb.js +0 -1
- package/dist/gateway/static/root/assets/preview-open-alternatives-BrpTWv44.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-Cww6V7HJ.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-D0LKhCCw.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Sf4Pde6Z.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-S5gvgfu5.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-B3XvdEy8.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-CiGFtdD8.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-CGU_Mxjr.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-k0UQ8WxO.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DQ1GvL1w.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-OuHd9GcN.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-CERqCsz2.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-BnRNL2sn.js +0 -1
- package/dist/gateway/static/root/assets/typed-models-lib-abEJNkCO.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-Cnkaiky5.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-B_VlcKiK.js +0 -5
|
@@ -11,11 +11,17 @@ export type KnowledgeSynthesisBatchResult = {
|
|
|
11
11
|
failed: number;
|
|
12
12
|
recordIds: string[];
|
|
13
13
|
};
|
|
14
|
+
export type ConnectedKnowledgePruneResult = {
|
|
15
|
+
rawDeleted: number;
|
|
16
|
+
derivedDeleted: number;
|
|
17
|
+
};
|
|
14
18
|
export declare class ConnectedKnowledgePipeline {
|
|
15
19
|
private readonly options;
|
|
16
20
|
private readonly workerId;
|
|
17
21
|
private readonly batchSize;
|
|
18
22
|
constructor(options: ConnectedKnowledgePipelineOptions);
|
|
19
23
|
processPending(sourceInstanceId?: string): Promise<KnowledgeSynthesisBatchResult>;
|
|
24
|
+
/** Remove bounded raw items and every content-bearing memory derived only from them. */
|
|
25
|
+
pruneBoundedRetention(sourceInstanceId: string, olderThanMs: number): ConnectedKnowledgePruneResult;
|
|
20
26
|
private rebuildDailySummary;
|
|
21
27
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
|
-
import { attachMemoryEvidence, claimKnowledgeSourceItems, completeKnowledgeSourceItemSynthesis, deleteMemoryEvidenceForRecord, listKnowledgeSourceItems } from "../storage/sqlite/knowledge-repository.js";
|
|
4
|
-
import { getMemoryRecord, upsertMemoryRecord } from "../storage/sqlite/memory-records-repository.js";
|
|
3
|
+
import { attachMemoryEvidence, claimKnowledgeSourceItems, completeKnowledgeSourceItemSynthesis, deleteMemoryEvidenceForRecord, listKnowledgeSourceItems, pruneBoundedKnowledgeSourceItems } from "../storage/sqlite/knowledge-repository.js";
|
|
4
|
+
import { deleteMemoryRecord, getMemoryRecord, upsertMemoryRecord } from "../storage/sqlite/memory-records-repository.js";
|
|
5
5
|
import "../storage/sqlite/index.js";
|
|
6
6
|
import { createHash, randomUUID } from "node:crypto";
|
|
7
7
|
//#region src/knowledge/connected-knowledge-pipeline.ts
|
|
@@ -180,13 +180,43 @@ var ConnectedKnowledgePipeline = class {
|
|
|
180
180
|
}
|
|
181
181
|
return result;
|
|
182
182
|
}
|
|
183
|
-
|
|
183
|
+
/** Remove bounded raw items and every content-bearing memory derived only from them. */
|
|
184
|
+
pruneBoundedRetention(sourceInstanceId, olderThanMs) {
|
|
185
|
+
const expired = [];
|
|
186
|
+
for (let offset = 0;; offset += 500) {
|
|
187
|
+
const page = listKnowledgeSourceItems({
|
|
188
|
+
sourceInstanceId,
|
|
189
|
+
retentionClass: "bounded",
|
|
190
|
+
retentionBeforeMs: olderThanMs,
|
|
191
|
+
includeDeleted: true,
|
|
192
|
+
limit: 500,
|
|
193
|
+
offset
|
|
194
|
+
});
|
|
195
|
+
expired.push(...page);
|
|
196
|
+
if (page.length < 500) break;
|
|
197
|
+
}
|
|
198
|
+
if (!expired.length) return {
|
|
199
|
+
rawDeleted: 0,
|
|
200
|
+
derivedDeleted: 0
|
|
201
|
+
};
|
|
202
|
+
const affectedDays = new Set(expired.map(dayFor));
|
|
203
|
+
let derivedDeleted = 0;
|
|
204
|
+
for (const item of expired) if (deleteMemoryRecord(knowledgeRecordId(item.id))) derivedDeleted += 1;
|
|
205
|
+
const rawDeleted = pruneBoundedKnowledgeSourceItems(sourceInstanceId, olderThanMs);
|
|
206
|
+
for (const day of affectedDays) if (this.rebuildDailySummary(sourceInstanceId, day, true)) derivedDeleted += 1;
|
|
207
|
+
return {
|
|
208
|
+
rawDeleted,
|
|
209
|
+
derivedDeleted
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
rebuildDailySummary(sourceInstanceId, day, deleteWhenEmpty = false) {
|
|
184
213
|
const items = listKnowledgeSourceItems({
|
|
185
214
|
sourceInstanceId,
|
|
186
215
|
limit: 500
|
|
187
216
|
}).filter((item) => dayFor(item) === day && item.synthesisStatus === "completed").slice(0, MAX_SUMMARY_ITEMS);
|
|
188
217
|
if (items.length === 0) {
|
|
189
218
|
const existing = getMemoryRecord(summaryRecordId(sourceInstanceId, day));
|
|
219
|
+
if (existing && deleteWhenEmpty) return deleteMemoryRecord(existing.id);
|
|
190
220
|
if (existing) upsertMemoryRecord({
|
|
191
221
|
id: existing.id,
|
|
192
222
|
providerId: "connected-knowledge",
|
|
@@ -210,7 +240,7 @@ var ConnectedKnowledgePipeline = class {
|
|
|
210
240
|
expiresAt: existing.expiresAt,
|
|
211
241
|
canonicalKey: existing.canonicalKey
|
|
212
242
|
});
|
|
213
|
-
return;
|
|
243
|
+
return false;
|
|
214
244
|
}
|
|
215
245
|
const sourceProvider = providerId(items[0]);
|
|
216
246
|
const lines = [`# ${sourceProvider} updates for ${day}`, ""];
|
|
@@ -263,6 +293,7 @@ var ConnectedKnowledgePipeline = class {
|
|
|
263
293
|
confidence: .72,
|
|
264
294
|
observedAt: item.occurredAt ?? item.sourceUpdatedAt
|
|
265
295
|
});
|
|
296
|
+
return false;
|
|
266
297
|
}
|
|
267
298
|
};
|
|
268
299
|
//#endregion
|
|
@@ -13,5 +13,5 @@ export declare function renderConnectedObservation(observation: ClaimObservation
|
|
|
13
13
|
export declare class ConnectedUnderstandingPipeline {
|
|
14
14
|
private readonly memoryManager;
|
|
15
15
|
constructor(memoryManager: MemoryManager);
|
|
16
|
-
process(agentId: string): Promise<UnderstandingReviewResult>;
|
|
16
|
+
process(agentId: string, extractionRunId: string): Promise<UnderstandingReviewResult>;
|
|
17
17
|
}
|
|
@@ -226,7 +226,7 @@ var ConnectedUnderstandingPipeline = class {
|
|
|
226
226
|
constructor(memoryManager) {
|
|
227
227
|
this.memoryManager = memoryManager;
|
|
228
228
|
}
|
|
229
|
-
async process(agentId) {
|
|
229
|
+
async process(agentId, extractionRunId) {
|
|
230
230
|
const observations = deriveConnectedClaimObservations(listKnowledgeSourceItems({
|
|
231
231
|
agentId,
|
|
232
232
|
includeDeleted: false,
|
|
@@ -253,12 +253,14 @@ var ConnectedUnderstandingPipeline = class {
|
|
|
253
253
|
provider: "connected-sources",
|
|
254
254
|
...sourceInstanceIds.length === 1 ? { sourceInstanceId: sourceInstanceIds[0] } : {}
|
|
255
255
|
},
|
|
256
|
-
reviewSource: "background"
|
|
256
|
+
reviewSource: "background",
|
|
257
|
+
extractionRunId
|
|
257
258
|
});
|
|
258
259
|
totals.created += result.created;
|
|
259
260
|
totals.deduplicated += result.deduplicated;
|
|
260
261
|
totals.rejected += result.rejected;
|
|
261
262
|
totals.createdRecords.push(...result.createdRecords);
|
|
263
|
+
totals.writeOutputs = [...totals.writeOutputs ?? [], ...result.writeOutputs ?? []];
|
|
262
264
|
}
|
|
263
265
|
return totals;
|
|
264
266
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getApiKeyFromEnv, init_env_keys } from "../env-keys.js";
|
|
2
1
|
import { init_sync_provider_auth, resolveProviderApiKeyForAgentSync } from "../../auth/sync-provider-auth.js";
|
|
2
|
+
import { getApiKeyFromEnv, init_env_keys } from "../env-keys.js";
|
|
3
3
|
import { getDefaultAuthProfileStore } from "./auth-profile-store.js";
|
|
4
4
|
//#region src/providers/auth-runtime/resolve-auth.ts
|
|
5
5
|
init_env_keys();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { __esmMin, __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
3
|
+
import { getOAuthProviderIds, init_registry } from "../auth/oauth/registry.js";
|
|
4
|
+
import { hasProviderAuthOnDiskSync, init_sync_provider_auth } from "../auth/sync-provider-auth.js";
|
|
3
5
|
import { PROVIDER_ENV_MAP, getApiKeyFromEnv, init_env_keys } from "./env-keys.js";
|
|
4
6
|
import { init_model_ref, splitProviderModelRef } from "./model-ref.js";
|
|
5
7
|
import { ModelRegistry, getModelRegistry, init_model_registry, prewarmModelRegistry, resetModelRegistry } from "./model-registry.js";
|
|
6
|
-
import { getOAuthProviderIds, init_registry } from "../auth/oauth/registry.js";
|
|
7
8
|
import { CredentialResolver, hasCredentials, init_credentials } from "../auth/credentials.js";
|
|
8
|
-
import { hasProviderAuthOnDiskSync, init_sync_provider_auth } from "../auth/sync-provider-auth.js";
|
|
9
9
|
import { EXTENSION_PROVIDER_BASE_URL, init_constants } from "./constants.js";
|
|
10
10
|
import { applyOfficialModelMetadataCorrections, getSupplementalModels, init_model_supplements } from "./model-supplements.js";
|
|
11
11
|
import { getProviderRegistry, init_plugin_registry } from "./plugin-registry.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { createLogger } from "../utils/logger/index.js";
|
|
3
3
|
import { init_logger } from "../utils/logger.js";
|
|
4
|
-
import { init_resolve_config_value, resolveConfigValue, resolveHeaders } from "../config/resolve-config-value.js";
|
|
5
4
|
import { resolveModelsJsonPath } from "../config/paths.js";
|
|
5
|
+
import { init_resolve_config_value, resolveConfigValue, resolveHeaders } from "../config/resolve-config-value.js";
|
|
6
6
|
import { getDefaultModelValues, init_models_json, validateModelsConfig } from "../config/models-json.js";
|
|
7
7
|
import { getApiKeyFromEnv, init_env_keys } from "./env-keys.js";
|
|
8
8
|
import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __esmMin } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
|
|
3
2
|
import { getOAuthProviderDefinition, init_registry } from "../auth/oauth/registry.js";
|
|
3
|
+
import { getModelCatalogStore, init_model_catalog_store } from "./model-catalog-store.js";
|
|
4
4
|
import { XOPC_CLOUD_PROVIDER_ID, init_xopc_cloud_config, resolveXopcModelRouterUrl } from "./xopc-cloud-config.js";
|
|
5
5
|
//#region src/providers/register-runtime-providers.ts
|
|
6
6
|
function registerRuntimeProvider(modelRuntime, source) {
|
|
@@ -6,11 +6,14 @@ export interface RetrievalScope {
|
|
|
6
6
|
}
|
|
7
7
|
export interface RetrievalQueryProfile {
|
|
8
8
|
normalized: string;
|
|
9
|
+
expanded: string;
|
|
9
10
|
terms: string[];
|
|
10
11
|
cjkBigrams: string[];
|
|
11
12
|
identifiers: string[];
|
|
12
13
|
intentKinds: string[];
|
|
13
14
|
timeHints: RetrievalTimeHint[];
|
|
15
|
+
selfReview: boolean;
|
|
14
16
|
scope: RetrievalScope;
|
|
15
17
|
}
|
|
18
|
+
export declare function isSelfReviewQuery(query: string): boolean;
|
|
16
19
|
export declare function buildRetrievalQueryProfile(query: string, scope?: RetrievalScope): RetrievalQueryProfile;
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import { extractCjkBigrams, extractLexicalTerms, extractRetrievalIdentifiers, normalizeRetrievalText } from "./textFeatures.js";
|
|
2
2
|
//#region src/retrieval/queryProfile.ts
|
|
3
|
+
const SELF_REVIEW_PATTERNS = [
|
|
4
|
+
/(?:你|xopc).{0,10}(?:了解|知道|认识|记得).{0,8}(?:我|用户)/i,
|
|
5
|
+
/介绍.{0,8}(?:你.{0,6})?(?:了解|知道|认识|记得).{0,4}的?我/i,
|
|
6
|
+
/\bwhat\s+(?:do\s+)?you\s+(?:know|remember)\s+about\s+me\b/i,
|
|
7
|
+
/\b(?:describe|introduce)\s+me\s+(?:from|based on)\s+(?:what|everything)\s+you\s+(?:know|remember)\b/i
|
|
8
|
+
];
|
|
9
|
+
function isSelfReviewQuery(query) {
|
|
10
|
+
return SELF_REVIEW_PATTERNS.some((pattern) => pattern.test(query.normalize("NFKC")));
|
|
11
|
+
}
|
|
3
12
|
const INTENT_RULES = [
|
|
4
13
|
{
|
|
5
14
|
kinds: ["boundary"],
|
|
@@ -48,19 +57,28 @@ const TIME_RULES = [
|
|
|
48
57
|
pattern: /\b(?:future|next|later|upcoming)\b|未来|下次|之后|即将/i
|
|
49
58
|
}
|
|
50
59
|
];
|
|
60
|
+
const TIME_EXPANSIONS = {
|
|
61
|
+
current: "now current active today 现在 当前 今天",
|
|
62
|
+
recent: "recent recently latest 近期 最近 最新",
|
|
63
|
+
historical: "previous before history past 之前 以前 历史 上次",
|
|
64
|
+
future: "future next later upcoming 未来 下次 之后 即将"
|
|
65
|
+
};
|
|
51
66
|
function buildRetrievalQueryProfile(query, scope = {}) {
|
|
52
67
|
const normalized = normalizeRetrievalText(query);
|
|
53
68
|
const intentKinds = INTENT_RULES.filter((rule) => rule.pattern.test(normalized)).flatMap((rule) => rule.kinds);
|
|
54
69
|
const timeHints = TIME_RULES.filter((rule) => rule.pattern.test(normalized)).map((rule) => rule.hint);
|
|
70
|
+
const uniqueTimeHints = [...new Set(timeHints)];
|
|
55
71
|
return {
|
|
56
72
|
normalized,
|
|
73
|
+
expanded: [normalized, ...uniqueTimeHints.map((hint) => TIME_EXPANSIONS[hint])].join(" ").trim(),
|
|
57
74
|
terms: extractLexicalTerms(normalized),
|
|
58
75
|
cjkBigrams: extractCjkBigrams(normalized),
|
|
59
76
|
identifiers: extractRetrievalIdentifiers(normalized),
|
|
60
77
|
intentKinds: [...new Set(intentKinds)],
|
|
61
|
-
timeHints:
|
|
78
|
+
timeHints: uniqueTimeHints,
|
|
79
|
+
selfReview: isSelfReviewQuery(normalized),
|
|
62
80
|
scope: { ...scope }
|
|
63
81
|
};
|
|
64
82
|
}
|
|
65
83
|
//#endregion
|
|
66
|
-
export { buildRetrievalQueryProfile };
|
|
84
|
+
export { buildRetrievalQueryProfile, isSelfReviewQuery };
|
|
@@ -11,6 +11,17 @@ export interface ClientHistoryMessage {
|
|
|
11
11
|
/** Persisted inbound attachment metadata used by chat clients to reload media. */
|
|
12
12
|
media?: Message['media'];
|
|
13
13
|
timestamp?: number;
|
|
14
|
+
/** Whitelisted display metadata; never includes source snapshot text. */
|
|
15
|
+
metadata?: {
|
|
16
|
+
sourceContexts: Array<{
|
|
17
|
+
kind: 'note';
|
|
18
|
+
sourceId: string;
|
|
19
|
+
version: string;
|
|
20
|
+
title: string;
|
|
21
|
+
tokenEstimate?: number;
|
|
22
|
+
truncated?: boolean;
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
14
25
|
kind?: 'message' | 'compaction' | 'context' | 'bash' | 'custom' | 'branch';
|
|
15
26
|
tokensBefore?: number;
|
|
16
27
|
tokensAfter?: number;
|
|
@@ -1,5 +1,25 @@
|
|
|
1
|
+
import { stripRuntimeContextFromUserMessage } from "./user-message-display.js";
|
|
1
2
|
import { buildTranscriptOutline } from "./transcript-outline.js";
|
|
2
3
|
//#region src/session/client-history.ts
|
|
4
|
+
function sourceContextDisplayMetadata(metadata) {
|
|
5
|
+
if (!metadata || typeof metadata !== "object" || Array.isArray(metadata)) return void 0;
|
|
6
|
+
const rows = metadata.sourceContexts;
|
|
7
|
+
if (!Array.isArray(rows)) return void 0;
|
|
8
|
+
const sourceContexts = rows.flatMap((value) => {
|
|
9
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return [];
|
|
10
|
+
const row = value;
|
|
11
|
+
if (row.kind !== "note" || typeof row.sourceId !== "string" || typeof row.version !== "string" || typeof row.title !== "string") return [];
|
|
12
|
+
return [{
|
|
13
|
+
kind: "note",
|
|
14
|
+
sourceId: row.sourceId,
|
|
15
|
+
version: row.version,
|
|
16
|
+
title: row.title,
|
|
17
|
+
...typeof row.tokenEstimate === "number" ? { tokenEstimate: row.tokenEstimate } : {},
|
|
18
|
+
...row.truncated === true ? { truncated: true } : {}
|
|
19
|
+
}];
|
|
20
|
+
});
|
|
21
|
+
return sourceContexts.length ? { sourceContexts } : void 0;
|
|
22
|
+
}
|
|
3
23
|
function flattenMessageContent(content) {
|
|
4
24
|
if (typeof content === "string") return content;
|
|
5
25
|
if (!Array.isArray(content)) return "";
|
|
@@ -111,8 +131,9 @@ function messagesToClientHistory(messages, opts) {
|
|
|
111
131
|
out.push({
|
|
112
132
|
role: m.role,
|
|
113
133
|
...typeof m.turnId === "string" ? { turnId: m.turnId } : {},
|
|
114
|
-
content: text,
|
|
134
|
+
content: m.role === "user" ? stripRuntimeContextFromUserMessage(text) : text,
|
|
115
135
|
...m.media?.length ? { media: m.media } : {},
|
|
136
|
+
...sourceContextDisplayMetadata(m.metadata) ? { metadata: sourceContextDisplayMetadata(m.metadata) } : {},
|
|
116
137
|
timestamp: parseTimestamp(m.timestamp)
|
|
117
138
|
});
|
|
118
139
|
continue;
|
|
@@ -413,8 +434,9 @@ function transcriptRowsToClientHistory(rows, opts) {
|
|
|
413
434
|
...messageRow.turnId ? { turnId: messageRow.turnId } : {},
|
|
414
435
|
role: messageRow.role,
|
|
415
436
|
kind: "message",
|
|
416
|
-
content: flattenMessageContent(messageRow.content ?? ""),
|
|
437
|
+
content: messageRow.role === "user" ? stripRuntimeContextFromUserMessage(flattenMessageContent(messageRow.content ?? "")) : flattenMessageContent(messageRow.content ?? ""),
|
|
417
438
|
...messageRow.media?.length ? { media: messageRow.media } : {},
|
|
439
|
+
...sourceContextDisplayMetadata(messageRow.metadata) ? { metadata: sourceContextDisplayMetadata(messageRow.metadata) } : {},
|
|
418
440
|
...displayIndex !== void 0 ? { displayIndex } : {},
|
|
419
441
|
timestamp: parseTimestampValue(messageRow.timestamp)
|
|
420
442
|
});
|
|
@@ -13,6 +13,6 @@ export interface SessionAgentConfig {
|
|
|
13
13
|
providerOverride?: string;
|
|
14
14
|
workingDirectoryOverride?: string;
|
|
15
15
|
responseLanguage?: ResponseLanguage;
|
|
16
|
-
userContextMode?: 'enabled' | 'off';
|
|
16
|
+
userContextMode?: 'enabled' | 'off' | 'temporary';
|
|
17
17
|
updatedAt?: number;
|
|
18
18
|
}
|
|
@@ -5,8 +5,7 @@ import { init_session_key, parseSessionKey } from "../routing/session-key.js";
|
|
|
5
5
|
import { init_providers, resolveModel } from "../providers/index.js";
|
|
6
6
|
import { completeWithResolvedCredentials } from "../providers/model-call.js";
|
|
7
7
|
import { readAgentMessageContent } from "../agent/memory/agent-message-access.js";
|
|
8
|
-
import {
|
|
9
|
-
import { stripEnvelopeTimestampPrefix } from "../channels/envelope-timestamp.js";
|
|
8
|
+
import { stripRuntimeContextFromUserMessage } from "./user-message-display.js";
|
|
10
9
|
//#region src/session/session-title.ts
|
|
11
10
|
init_session_key();
|
|
12
11
|
init_providers();
|
|
@@ -56,7 +55,7 @@ function stripSkillCommandForTitle(text) {
|
|
|
56
55
|
return match[2]?.trim() || match[1]?.trim() || text;
|
|
57
56
|
}
|
|
58
57
|
function normalizeUserTextForTitle(raw) {
|
|
59
|
-
return stripSkillCommandForTitle(stripExpandedSkillBlockForTitle(stripMediaClaimChecks(
|
|
58
|
+
return stripSkillCommandForTitle(stripExpandedSkillBlockForTitle(stripMediaClaimChecks(stripRuntimeContextFromUserMessage(raw)))).trim();
|
|
60
59
|
}
|
|
61
60
|
/** First assistant message that has visible text (skips tool-only assistant rows). */
|
|
62
61
|
function firstAssistantText(messages) {
|
|
@@ -725,6 +725,7 @@ var SessionStore = class {
|
|
|
725
725
|
name: m.name
|
|
726
726
|
};
|
|
727
727
|
if (Array.isArray(m.media) && m.media.length > 0) row.media = m.media;
|
|
728
|
+
if (m.metadata && typeof m.metadata === "object") row.metadata = m.metadata;
|
|
728
729
|
const rawUsage = m.usage;
|
|
729
730
|
if (rawUsage && typeof rawUsage === "object") {
|
|
730
731
|
const inputTokens = typeof rawUsage.input === "number" ? rawUsage.input : void 0;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isTranscriptBashExecutionEntry, isTranscriptContextEntry, isTranscriptCustomMessageEntry, isTranscriptLabelEntry, isTranscriptMetadataEntry, isTranscriptSummaryMessageEntry } from "./session-context-for-llm.js";
|
|
2
|
+
import { stripRuntimeContextFromUserMessage } from "./user-message-display.js";
|
|
2
3
|
//#region src/session/transcript-outline.ts
|
|
3
4
|
function asRecord(value) {
|
|
4
5
|
return value && typeof value === "object" ? value : null;
|
|
@@ -170,7 +171,8 @@ function rowPreview(row) {
|
|
|
170
171
|
}
|
|
171
172
|
const record = asRecord(row);
|
|
172
173
|
if (record?.type === "compaction") return truncateText(stringValue(record.summary) ?? "compaction checkpoint");
|
|
173
|
-
const
|
|
174
|
+
const content = contentText(record?.content);
|
|
175
|
+
const preview = truncateText(record?.role === "user" ? stripRuntimeContextFromUserMessage(content) : content);
|
|
174
176
|
if (record?.role === "assistant" && !preview) {
|
|
175
177
|
if (record.stopReason === "aborted") return "(aborted)";
|
|
176
178
|
const errorMessage = stringValue(record.errorMessage);
|
|
@@ -194,7 +196,8 @@ function rowContentText(row) {
|
|
|
194
196
|
if (isTranscriptSummaryMessageEntry(row)) return row.summary;
|
|
195
197
|
const record = asRecord(row);
|
|
196
198
|
if (record?.type === "compaction") return stringValue(record.summary);
|
|
197
|
-
const
|
|
199
|
+
const rawText = contentText(record?.content);
|
|
200
|
+
const text = (record?.role === "user" ? stripRuntimeContextFromUserMessage(rawText) : rawText).trim();
|
|
198
201
|
return text ? text : void 0;
|
|
199
202
|
}
|
|
200
203
|
function roleForTimeline(role) {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Client-facing form of a persisted model-facing user message. */
|
|
2
|
+
export declare function stripRuntimeContextFromUserMessage(text: string): string;
|
|
3
|
+
/** Preserve structured content while cleaning every user text block. */
|
|
4
|
+
export declare function stripRuntimeContextFromUserContent(content: string | unknown[]): string | unknown[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { stripRuntimeUserMessageEnvelope } from "../../packages/gateway-contract/src/user-message-display.js";
|
|
2
|
+
import { stripSessionStartupContextFromUserText } from "../agent/reply/startup-context.js";
|
|
3
|
+
//#region src/session/user-message-display.ts
|
|
4
|
+
/** Client-facing form of a persisted model-facing user message. */
|
|
5
|
+
function stripRuntimeContextFromUserMessage(text) {
|
|
6
|
+
return stripRuntimeUserMessageEnvelope(stripSessionStartupContextFromUserText(text));
|
|
7
|
+
}
|
|
8
|
+
/** Preserve structured content while cleaning every user text block. */
|
|
9
|
+
function stripRuntimeContextFromUserContent(content) {
|
|
10
|
+
if (typeof content === "string") return stripRuntimeContextFromUserMessage(content);
|
|
11
|
+
return content.map((block) => {
|
|
12
|
+
if (!block || typeof block !== "object") return block;
|
|
13
|
+
const row = block;
|
|
14
|
+
if (row.type !== "text" || typeof row.text !== "string") return block;
|
|
15
|
+
return {
|
|
16
|
+
...row,
|
|
17
|
+
text: stripRuntimeContextFromUserMessage(row.text)
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { stripRuntimeContextFromUserContent, stripRuntimeContextFromUserMessage };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export type ContextExtractionStatus = 'running' | 'completed' | 'skipped' | 'failed';
|
|
2
|
+
export type ContextObjectType = 'profile' | 'rule' | 'focus' | 'understanding';
|
|
3
|
+
export type ContextExtractionRun = {
|
|
4
|
+
id: string;
|
|
5
|
+
principalId: string;
|
|
6
|
+
sourceRef: string;
|
|
7
|
+
extractorId: string;
|
|
8
|
+
extractorVersion: string;
|
|
9
|
+
processingPolicy: 'local_only' | 'remote_allowed';
|
|
10
|
+
destination: 'deterministic' | 'local_model' | 'remote_model';
|
|
11
|
+
inputHash: string;
|
|
12
|
+
status: ContextExtractionStatus;
|
|
13
|
+
errorCode?: string;
|
|
14
|
+
startedAt: number;
|
|
15
|
+
completedAt?: number;
|
|
16
|
+
};
|
|
17
|
+
export type ContextExtractionOutput = {
|
|
18
|
+
id: string;
|
|
19
|
+
runId: string;
|
|
20
|
+
ordinal: number;
|
|
21
|
+
candidateKey: string;
|
|
22
|
+
objectType?: ContextObjectType;
|
|
23
|
+
objectId?: string;
|
|
24
|
+
versionId?: string;
|
|
25
|
+
outcome: 'created' | 'deduplicated' | 'rejected';
|
|
26
|
+
createdAt: number;
|
|
27
|
+
};
|
|
28
|
+
export declare function claimContextExtractionRun(input: {
|
|
29
|
+
sourceRef: string;
|
|
30
|
+
extractorId: string;
|
|
31
|
+
extractorVersion: string;
|
|
32
|
+
processingPolicy: ContextExtractionRun['processingPolicy'];
|
|
33
|
+
destination: ContextExtractionRun['destination'];
|
|
34
|
+
inputHash: string;
|
|
35
|
+
principalId?: string;
|
|
36
|
+
nowMs?: number;
|
|
37
|
+
}): {
|
|
38
|
+
run: ContextExtractionRun;
|
|
39
|
+
shouldExecute: boolean;
|
|
40
|
+
};
|
|
41
|
+
export declare function finishContextExtractionRun(input: {
|
|
42
|
+
runId: string;
|
|
43
|
+
status: Exclude<ContextExtractionStatus, 'running'>;
|
|
44
|
+
errorCode?: string;
|
|
45
|
+
outputs?: Array<Omit<ContextExtractionOutput, 'id' | 'runId' | 'ordinal' | 'createdAt'>>;
|
|
46
|
+
nowMs?: number;
|
|
47
|
+
}): ContextExtractionRun | null;
|
|
48
|
+
export declare function listContextExtractionRuns(filter?: {
|
|
49
|
+
sourceRef?: string;
|
|
50
|
+
extractorId?: string;
|
|
51
|
+
extractorVersion?: string;
|
|
52
|
+
status?: ContextExtractionStatus;
|
|
53
|
+
limit?: number;
|
|
54
|
+
}): ContextExtractionRun[];
|
|
55
|
+
export declare function getContextExtractionRun(id: string): ContextExtractionRun | null;
|
|
56
|
+
export declare function listContextExtractionOutputs(runId: string): ContextExtractionOutput[];
|
|
57
|
+
export declare function hasIndependentExtractionOutput(runIds: string[], objectType: ContextObjectType, objectId: string): boolean;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { getSqliteDatabase, runSqliteWriteTransaction } from "./transaction.js";
|
|
2
|
+
import "../../user-context/domain.js";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
4
|
+
//#region src/storage/sqlite/context-extraction-repository.ts
|
|
5
|
+
function runFromRow(row) {
|
|
6
|
+
return {
|
|
7
|
+
id: row.extraction_run_id,
|
|
8
|
+
principalId: row.principal_id,
|
|
9
|
+
sourceRef: row.source_ref,
|
|
10
|
+
extractorId: row.extractor_id,
|
|
11
|
+
extractorVersion: row.extractor_version,
|
|
12
|
+
processingPolicy: row.processing_policy,
|
|
13
|
+
destination: row.destination,
|
|
14
|
+
inputHash: row.input_hash,
|
|
15
|
+
status: row.status,
|
|
16
|
+
...row.error_code ? { errorCode: row.error_code } : {},
|
|
17
|
+
startedAt: row.started_at,
|
|
18
|
+
...row.completed_at == null ? {} : { completedAt: row.completed_at }
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function outputFromRow(row) {
|
|
22
|
+
return {
|
|
23
|
+
id: row.output_id,
|
|
24
|
+
runId: row.extraction_run_id,
|
|
25
|
+
ordinal: row.ordinal,
|
|
26
|
+
candidateKey: row.candidate_key,
|
|
27
|
+
...row.object_type ? { objectType: row.object_type } : {},
|
|
28
|
+
...row.object_id ? { objectId: row.object_id } : {},
|
|
29
|
+
...row.version_id ? { versionId: row.version_id } : {},
|
|
30
|
+
outcome: row.outcome,
|
|
31
|
+
createdAt: row.created_at
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function claimContextExtractionRun(input) {
|
|
35
|
+
const principalId = input.principalId ?? "local-owner";
|
|
36
|
+
const now = input.nowMs ?? Date.now();
|
|
37
|
+
return runSqliteWriteTransaction((db) => {
|
|
38
|
+
const existing = db.prepare(`SELECT * FROM context_extraction_runs
|
|
39
|
+
WHERE principal_id = ? AND source_ref = ? AND extractor_id = ? AND extractor_version = ?`).get(principalId, input.sourceRef, input.extractorId, input.extractorVersion);
|
|
40
|
+
if (existing) {
|
|
41
|
+
if (existing.input_hash !== input.inputHash) throw new Error("Extraction source changed without a new source reference");
|
|
42
|
+
if (existing.status !== "failed") return {
|
|
43
|
+
run: runFromRow(existing),
|
|
44
|
+
shouldExecute: false
|
|
45
|
+
};
|
|
46
|
+
db.prepare(`UPDATE context_extraction_runs
|
|
47
|
+
SET status = 'running', error_code = NULL, started_at = ?, completed_at = NULL
|
|
48
|
+
WHERE extraction_run_id = ?`).run(now, existing.extraction_run_id);
|
|
49
|
+
return {
|
|
50
|
+
run: runFromRow(db.prepare("SELECT * FROM context_extraction_runs WHERE extraction_run_id = ?").get(existing.extraction_run_id)),
|
|
51
|
+
shouldExecute: true
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
const id = randomUUID();
|
|
55
|
+
db.prepare(`INSERT INTO context_extraction_runs (
|
|
56
|
+
extraction_run_id, principal_id, source_ref, extractor_id, extractor_version,
|
|
57
|
+
processing_policy, destination, input_hash, status, started_at
|
|
58
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, 'running', ?)`).run(id, principalId, input.sourceRef, input.extractorId, input.extractorVersion, input.processingPolicy, input.destination, input.inputHash, now);
|
|
59
|
+
return {
|
|
60
|
+
run: runFromRow(db.prepare("SELECT * FROM context_extraction_runs WHERE extraction_run_id = ?").get(id)),
|
|
61
|
+
shouldExecute: true
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
function finishContextExtractionRun(input) {
|
|
66
|
+
const now = input.nowMs ?? Date.now();
|
|
67
|
+
return runSqliteWriteTransaction((db) => {
|
|
68
|
+
if (!db.prepare(`UPDATE context_extraction_runs SET status = ?, error_code = ?, completed_at = ?
|
|
69
|
+
WHERE extraction_run_id = ?`).run(input.status, input.errorCode ?? null, now, input.runId).changes) return null;
|
|
70
|
+
db.prepare("DELETE FROM context_extraction_outputs WHERE extraction_run_id = ?").run(input.runId);
|
|
71
|
+
const insert = db.prepare(`INSERT INTO context_extraction_outputs (
|
|
72
|
+
output_id, extraction_run_id, ordinal, candidate_key, object_type, object_id,
|
|
73
|
+
version_id, outcome, created_at
|
|
74
|
+
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`);
|
|
75
|
+
for (const [ordinal, output] of (input.outputs ?? []).entries()) insert.run(randomUUID(), input.runId, ordinal, output.candidateKey, output.objectType ?? null, output.objectId ?? null, output.versionId ?? null, output.outcome, now);
|
|
76
|
+
return runFromRow(db.prepare("SELECT * FROM context_extraction_runs WHERE extraction_run_id = ?").get(input.runId));
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function listContextExtractionRuns(filter = {}) {
|
|
80
|
+
const clauses = [];
|
|
81
|
+
const values = [];
|
|
82
|
+
if (filter.sourceRef) {
|
|
83
|
+
clauses.push("source_ref = ?");
|
|
84
|
+
values.push(filter.sourceRef);
|
|
85
|
+
}
|
|
86
|
+
if (filter.extractorId) {
|
|
87
|
+
clauses.push("extractor_id = ?");
|
|
88
|
+
values.push(filter.extractorId);
|
|
89
|
+
}
|
|
90
|
+
if (filter.extractorVersion) {
|
|
91
|
+
clauses.push("extractor_version = ?");
|
|
92
|
+
values.push(filter.extractorVersion);
|
|
93
|
+
}
|
|
94
|
+
if (filter.status) {
|
|
95
|
+
clauses.push("status = ?");
|
|
96
|
+
values.push(filter.status);
|
|
97
|
+
}
|
|
98
|
+
values.push(Math.max(1, Math.min(500, filter.limit ?? 100)));
|
|
99
|
+
return getSqliteDatabase().prepare(`SELECT * FROM context_extraction_runs
|
|
100
|
+
${clauses.length ? `WHERE ${clauses.join(" AND ")}` : ""} ORDER BY started_at DESC LIMIT ?`).all(...values).map(runFromRow);
|
|
101
|
+
}
|
|
102
|
+
function getContextExtractionRun(id) {
|
|
103
|
+
const row = getSqliteDatabase().prepare("SELECT * FROM context_extraction_runs WHERE extraction_run_id = ?").get(id);
|
|
104
|
+
return row ? runFromRow(row) : null;
|
|
105
|
+
}
|
|
106
|
+
function listContextExtractionOutputs(runId) {
|
|
107
|
+
return getSqliteDatabase().prepare(`SELECT * FROM context_extraction_outputs
|
|
108
|
+
WHERE extraction_run_id = ? ORDER BY ordinal`).all(runId).map(outputFromRow);
|
|
109
|
+
}
|
|
110
|
+
function hasIndependentExtractionOutput(runIds, objectType, objectId) {
|
|
111
|
+
if (!runIds.length) return false;
|
|
112
|
+
const placeholders = runIds.map(() => "?").join(", ");
|
|
113
|
+
return Boolean(getSqliteDatabase().prepare(`SELECT 1 FROM context_extraction_outputs o
|
|
114
|
+
JOIN context_extraction_runs r ON r.extraction_run_id = o.extraction_run_id
|
|
115
|
+
WHERE o.extraction_run_id NOT IN (${placeholders}) AND o.object_type = ? AND o.object_id = ?
|
|
116
|
+
AND r.status = 'completed' LIMIT 1`).get(...runIds, objectType, objectId));
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
export { claimContextExtractionRun, finishContextExtractionRun, getContextExtractionRun, hasIndependentExtractionOutput, listContextExtractionOutputs, listContextExtractionRuns };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ContextObjectType } from './context-extraction-repository.js';
|
|
2
|
+
export type ContextObjectRelation = {
|
|
3
|
+
id: string;
|
|
4
|
+
subjectType: ContextObjectType;
|
|
5
|
+
subjectId: string;
|
|
6
|
+
subjectVersionId?: string;
|
|
7
|
+
predicate: 'supersedes' | 'supports' | 'contradicts' | 'related_to';
|
|
8
|
+
objectType: ContextObjectType;
|
|
9
|
+
objectId: string;
|
|
10
|
+
objectVersionId?: string;
|
|
11
|
+
factual: boolean;
|
|
12
|
+
extractionRunId?: string;
|
|
13
|
+
createdAt: number;
|
|
14
|
+
};
|
|
15
|
+
export type ContextTemporalAssertion = {
|
|
16
|
+
id: string;
|
|
17
|
+
objectType: 'focus' | 'understanding';
|
|
18
|
+
objectId: string;
|
|
19
|
+
objectVersionId?: string;
|
|
20
|
+
assertionType: 'current_state' | 'routine' | 'relationship' | 'project_status';
|
|
21
|
+
value: Record<string, unknown>;
|
|
22
|
+
confidence: number;
|
|
23
|
+
validFrom?: number;
|
|
24
|
+
validTo?: number;
|
|
25
|
+
status: 'candidate' | 'active' | 'closed' | 'rejected';
|
|
26
|
+
extractionRunId?: string;
|
|
27
|
+
createdAt: number;
|
|
28
|
+
updatedAt: number;
|
|
29
|
+
};
|
|
30
|
+
export declare function linkContextObjects(input: Omit<ContextObjectRelation, 'id' | 'createdAt'> & {
|
|
31
|
+
nowMs?: number;
|
|
32
|
+
}): ContextObjectRelation;
|
|
33
|
+
export declare function listContextObjectRelations(input?: {
|
|
34
|
+
objectType?: ContextObjectType;
|
|
35
|
+
objectId?: string;
|
|
36
|
+
extractionRunId?: string;
|
|
37
|
+
}): ContextObjectRelation[];
|
|
38
|
+
export declare function createTemporalAssertion(input: Omit<ContextTemporalAssertion, 'id' | 'createdAt' | 'updatedAt'> & {
|
|
39
|
+
nowMs?: number;
|
|
40
|
+
}): ContextTemporalAssertion;
|
|
41
|
+
export declare function closeTemporalAssertions(input: {
|
|
42
|
+
objectType: ContextTemporalAssertion['objectType'];
|
|
43
|
+
objectId: string;
|
|
44
|
+
validTo?: number;
|
|
45
|
+
}): number;
|
|
46
|
+
export declare function listTemporalAssertions(input?: {
|
|
47
|
+
objectType?: ContextTemporalAssertion['objectType'];
|
|
48
|
+
objectId?: string;
|
|
49
|
+
status?: ContextTemporalAssertion['status'];
|
|
50
|
+
}): ContextTemporalAssertion[];
|