@xopcai/xopc 0.0.227 → 0.0.229
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-BevwE16n.js → activity-store-M0nAY5XB.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BggVQrEZ.js → agent-avatar-dicebear-CsFAJTIN.js} +1 -1
- package/dist/gateway/static/root/assets/agents-DA4b6_0C.js +68 -0
- package/dist/gateway/static/root/assets/{api-Bx_BpIt8.js → api-BywYxpaS.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-BtKP9n2r.js → app-management-settings-panel-7KcMWuah.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BoH2NAUX.js → appearance-settings-Cqlw7Fif.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-CsnhdGZ2.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-DnceUyxm.js → archive-plugin-7_DXaMTP.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-Bh8_9gkr.js → attachment-load-q4pDpqkF.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-ZKeAAVxD.js → automations-page-BuTqjKGX.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-CD0E2ThS.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-Cy9er6w-.js → binary-plugins-DUce1Bsc.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Cc0wWvNX.js → block-editor-D8Ejp-QR.js} +3 -3
- package/dist/gateway/static/root/assets/browser-settings-page-CY1k3MMd.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-BS7rpLLl.js → browser-workflow-inputs-8NC2qDRF.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-BdBVUZXm.js → browser-workflows-page-BDvZbR9v.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-D1VfotHQ.js +7 -0
- package/dist/gateway/static/root/assets/{capability-presets-api-D1Lqz0Tt.js → capability-presets-api-o0y9WgAI.js} +1 -1
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-DXHqRLpU.js +3 -0
- package/dist/gateway/static/root/assets/{channel-recipient-api-CGuEl-l2.js → channel-recipient-api-C5ABr73b.js} +1 -1
- package/dist/gateway/static/root/assets/channels-settings-DrFL57M_.js +1 -0
- package/dist/gateway/static/root/assets/channels-status-swr-38FsOnR0.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-CdX_7aQh.js → chat-terminal-dock-h1CKexNz.js} +2 -2
- package/dist/gateway/static/root/assets/connectors-page-DUAyfFCF.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-BnSQc4Ek.js → cron-expression-DlaQQOId.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-BbuG7zQ_.js → date-picker-8R1sXJKb.js} +1 -1
- package/dist/gateway/static/root/assets/{dependency-picker-snZeqOmG.js → dependency-picker-CWur0821.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-DJQ8JoR1.js → desktop-pet-Knl-zNDU.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-B9txsRtv.js → desktop-pet-settings-CAQMLVtd.js} +1 -1
- package/dist/gateway/static/root/assets/{directory-picker-path-field-D7WKWkNB.js → directory-picker-path-field-Caaz4Rw5.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-D_7cOCj2.js → extension-debug-page-B965Mc15.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-Bwu47iUb.js → extension-page-C0UnkBi5.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-Dwg4dSZM.js → extension-settings-page-BUSIAZCR.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-api-jURUSte_.js → gateway-config-api-DkH0eEgy.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-6SQXF1yR.js → gateway-config-swr-BWGjnmDl.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-settings-UklJOMLX.js → gateway-settings-BBgLDm6I.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DqWaxyvZ.js → gateway-startup-retry-B_zrtccP.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-Djs_nduD.js → heartbeat-settings-BtEHVXWD.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-5SU2TNJj.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-Bxmt6LEr.js → image-generation-api-YKP2me5Z.js} +1 -1
- package/dist/gateway/static/root/assets/index-BNWhgmjs.js +70 -0
- package/dist/gateway/static/root/assets/index-D_hrEKXM.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-ByVsCH3d.js → keyboard-shortcuts-settings-CsRz8NrS.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DYPEUgpP.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-D19R-xsz.js → local-apps-page-CTBNUG4a.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-Ci1Qi0Q-.js → locale-store-CXhjfe4q.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-B0P7rG2B.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-G0y7zmfY.js → management-settings-YqUAEwQo.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-B69d2HWt.js → markdown-split-dxpSCXb8.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-DD_PgVue.css → markdown-view-CLzTdVLW.css} +1 -1
- package/dist/gateway/static/root/assets/markdown-view-DvM5PWEH.js +201 -0
- package/dist/gateway/static/root/assets/{media-plugins-6TWEQgN_.js → media-plugins-CJ00i1Lg.js} +1 -1
- package/dist/gateway/static/root/assets/messages-BMdD0LWk.js +3 -0
- package/dist/gateway/static/root/assets/{notes-api-DLsnnZCS.js → notes-api-BFsOGYkd.js} +1 -1
- package/dist/gateway/static/root/assets/{notes-page-CkRJJKDm.js → notes-page-DEnbnkIt.js} +1 -1
- package/dist/gateway/static/root/assets/notes-workbench-DmVYu_Oc.js +4 -0
- package/dist/gateway/static/root/assets/{product-open-page-HxArIvoN.js → product-open-page-BHxo9U95.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DV2nGmsq.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-BNIFwFfc.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-lEar5FOV.js → registry-api-BFZrVYfy.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-DLXqKiA_.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-Bf03UNGD.js → runtime-tools-settings-panel-BpQ2GI-0.js} +1 -1
- package/dist/gateway/static/root/assets/{schema-form-CIXMBgx5.js → schema-form-HE1G26Lx.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-DWaXf_25.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-JFCbnCL2.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-DgdB26mE.js → settings-form-section-CXAn0Xhy.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-loading-skeleton-efk5W6lG.js → settings-loading-skeleton-DsFu7Bcv.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-BHVf4gEP.js → settings-page-C4iib9nO.js} +1 -1
- package/dist/gateway/static/root/assets/{setup-status-panel-WK0dGNMv.js → setup-status-panel-BA83Wr1d.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-Cod-w2qm.js → share-preview-page-BOGl3s6M.js} +1 -1
- package/dist/gateway/static/root/assets/{shares-settings-CUqQ31gt.js → shares-settings-Q2MdGaBi.js} +1 -1
- package/dist/gateway/static/root/assets/skill-reload-api-cFtfVeFU.js +1 -0
- package/dist/gateway/static/root/assets/{skills-page-DwCcipqK.js → skills-page-CdaFtNw9.js} +1 -1
- package/dist/gateway/static/root/assets/{skills-page.utils-3WSbtl3S.js → skills-page.utils-DYaAddUL.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-C5VxqC_s.js → system-settings-panel-Co7gilRd.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-5B1pswu8.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-Dd89g_ki.js → theme-store-DOdCjyuw.js} +1 -1
- package/dist/gateway/static/root/assets/{use-autosave-CeV8VJh2.js → use-autosave-DnnZtMpA.js} +1 -1
- package/dist/gateway/static/root/assets/user-context-page-Dr1FKjXv.js +1 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-EmJ-8aZu.js → voice-api-key-field-wetUpi3i.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-zsk6E3Mi.js → work-discovery-overlay-tbTWASJJ.js} +1 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-Dy0fDs8w.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-IVP3GSkI.js +5 -0
- package/dist/gateway/static/root/index.html +12 -12
- package/dist/gateway/static/root/notification-sw.js +1 -1
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/notifications.js +56 -0
- package/dist/packages/gateway-contract/src/turn-outcome.js +114 -0
- package/dist/src/agent/agent-instance-gateway.d.ts +1 -1
- package/dist/src/agent/agent-manager.d.ts +1 -1
- package/dist/src/agent/agent-manager.js +18 -3
- package/dist/src/agent/background-review/prompts.d.ts +8 -2
- package/dist/src/agent/background-review/prompts.js +25 -12
- package/dist/src/agent/background-review/run-background-review.d.ts +7 -2
- package/dist/src/agent/background-review/run-background-review.js +175 -160
- package/dist/src/agent/lifecycle/timeout-wrapper.d.ts +1 -0
- package/dist/src/agent/lifecycle/timeout-wrapper.js +7 -6
- package/dist/src/agent/mcp/mcp-transport-config.d.ts +1 -1
- package/dist/src/agent/mcp/mcp-transport-config.js +1 -1
- package/dist/src/agent/memory/index.d.ts +1 -1
- package/dist/src/agent/memory/index.js +2 -2
- package/dist/src/agent/memory/manager.d.ts +1 -11
- package/dist/src/agent/memory/manager.js +0 -16
- package/dist/src/agent/memory/understanding/service.d.ts +0 -11
- package/dist/src/agent/memory/understanding/service.js +7 -173
- package/dist/src/agent/memory/user-context-coordinator.d.ts +1 -3
- package/dist/src/agent/memory/user-context-coordinator.js +3 -66
- package/dist/src/agent/orchestration/agent-orchestrator.js +1 -1
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.d.ts +2 -2
- package/dist/src/agent/orchestration/run-agent-turn-with-timeout.js +4 -4
- package/dist/src/agent/service/direct-turn-helpers.js +1 -1
- package/dist/src/agent/tools/create-share-tool.js +14 -1
- package/dist/src/agent/tools/exec-command.js +3 -3
- package/dist/src/agent/tools/execute-code-tool.js +1 -1
- package/dist/src/agent/tools/executor.js +2 -2
- package/dist/src/agent/tools/image-generate-tool.js +12 -0
- package/dist/src/agent/tools/send-media.js +11 -0
- package/dist/src/agent/tools/xopc-use-tool.js +1 -1
- package/dist/src/cli/command-loaders.js +1 -0
- package/dist/src/cli/command-manifest.js +4 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/history.d.ts +1 -0
- package/dist/src/cli/commands/history.js +50 -0
- package/dist/src/config/agent-profile.js +1 -1
- package/dist/src/config/schema.d.ts +4 -0
- package/dist/src/config/schema.js +1 -0
- package/dist/src/connectors/connected-source-understanding.js +35 -21
- package/dist/src/connectors/learning-coordinator.js +1 -42
- package/dist/src/gateway/agents-admin.js +1 -1
- package/dist/src/gateway/chat-stream/mapper.d.ts +2 -0
- package/dist/src/gateway/chat-stream/mapper.js +5 -0
- package/dist/src/gateway/chat-stream/protocol.d.ts +3 -2
- package/dist/src/gateway/chat-stream/turn-outcome-collector.d.ts +16 -0
- package/dist/src/gateway/chat-stream/turn-outcome-collector.js +111 -0
- package/dist/src/gateway/hono/lib/static-ui.js +7 -5
- package/dist/src/gateway/hono/routes/index.js +2 -0
- package/dist/src/gateway/hono/routes/mobile.js +18 -40
- package/dist/src/gateway/hono/routes/notifications.d.ts +3 -0
- package/dist/src/gateway/hono/routes/notifications.js +45 -0
- package/dist/src/gateway/hono/routes/sessions.js +31 -0
- package/dist/src/gateway/hono/routes/tasks.js +1 -1
- package/dist/src/gateway/hono/routes/understanding-sources.js +4 -1
- package/dist/src/gateway/hono/routes/you.js +29 -11
- package/dist/src/gateway/service/agent-runner.js +6 -2
- package/dist/src/gateway/service/run-gateway-agent.js +58 -2
- package/dist/src/gateway/service/sessions-api.d.ts +6 -0
- package/dist/src/gateway/service/sessions-api.js +60 -3
- package/dist/src/gateway/service.d.ts +2 -2
- package/dist/src/gateway/service.js +8 -7
- package/dist/src/history/ctx/exporter.d.ts +14 -0
- package/dist/src/history/ctx/exporter.js +99 -0
- package/dist/src/history/ctx/format.d.ts +25 -0
- package/dist/src/history/ctx/format.js +282 -0
- package/dist/src/knowledge/index.d.ts +0 -1
- package/dist/src/knowledge/index.js +1 -2
- package/dist/src/media/session-references.d.ts +6 -0
- package/dist/src/media/session-references.js +24 -3
- package/dist/src/notifications/device-store.d.ts +16 -0
- package/dist/src/notifications/device-store.js +96 -0
- package/dist/src/notifications/planner.d.ts +6 -0
- package/dist/src/notifications/planner.js +160 -0
- package/dist/src/notifications/service.d.ts +18 -0
- package/dist/src/notifications/service.js +184 -0
- package/dist/src/notifications/store.d.ts +53 -0
- package/dist/src/notifications/store.js +184 -0
- package/dist/src/notifications/types.d.ts +29 -0
- package/dist/src/notifications/types.js +14 -0
- package/dist/src/session/client-history.d.ts +3 -1
- package/dist/src/session/client-history.js +13 -0
- package/dist/src/session/index.d.ts +1 -1
- package/dist/src/session/manager.d.ts +1 -0
- package/dist/src/session/manager.js +6 -0
- package/dist/src/session/store.d.ts +15 -0
- package/dist/src/session/store.js +58 -0
- package/dist/src/storage/sqlite/index.d.ts +2 -2
- package/dist/src/storage/sqlite/index.js +3 -3
- package/dist/src/storage/sqlite/migrations/136_product_notifications.sql +79 -0
- package/dist/src/storage/sqlite/migrations/137_understanding_status_audit.sql +71 -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 +5 -0
- package/dist/src/storage/sqlite/session-input-repository.js +9 -1
- package/dist/src/storage/sqlite/user-context-repository.d.ts +16 -4
- package/dist/src/storage/sqlite/user-context-repository.js +56 -12
- package/dist/src/tasks/index.js +2 -2
- package/dist/src/tasks/task-application-service.js +42 -6
- package/dist/src/tasks/task-change-events.d.ts +9 -0
- package/dist/src/tasks/task-change-events.js +17 -1
- package/dist/src/tasks/task-outbox-dispatcher.js +5 -1
- package/dist/src/tasks/task-run-dispatcher.js +4 -2
- package/dist/src/tasks/task-run-repository.js +13 -0
- package/dist/src/user-context/config.d.ts +8 -0
- package/dist/src/user-context/config.js +3 -0
- package/dist/src/user-context/consolidation.js +16 -4
- package/dist/src/user-context/extraction/executor.d.ts +22 -0
- package/dist/src/user-context/extraction/executor.js +142 -0
- package/dist/src/user-context/extraction/registry.d.ts +1 -1
- package/dist/src/user-context/extraction/registry.js +5 -34
- package/dist/src/user-context/extraction/repair.js +4 -1
- package/dist/src/user-context/extraction/semantic.d.ts +18 -0
- package/dist/src/user-context/extraction/semantic.js +148 -0
- package/dist/src/user-context/understandingQuality.js +4 -0
- package/dist/src/work-discovery/analyzer.js +9 -4
- package/dist/src/work-discovery/service.d.ts +1 -0
- package/dist/src/work-discovery/service.js +5 -4
- package/dist/src/work-discovery/types.d.ts +1 -0
- package/package.json +14 -8
- package/dist/gateway/static/root/assets/agents-TJpjRHnr.js +0 -68
- package/dist/gateway/static/root/assets/apps-page-CZ4Da51l.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-2Y00PvJU.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CbJD27_j.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Dv8y6OuP.js +0 -7
- package/dist/gateway/static/root/assets/capability-presets-settings-panel-TZmjzWzt.js +0 -3
- package/dist/gateway/static/root/assets/channels-settings-g-68dutA.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-D7KsAeWh.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DXA0rAvQ.js +0 -2
- package/dist/gateway/static/root/assets/home-page-i6bXCHdo.js +0 -1
- package/dist/gateway/static/root/assets/index-BBBE89vm.css +0 -2
- package/dist/gateway/static/root/assets/index-BsD5wygl.js +0 -74
- package/dist/gateway/static/root/assets/local-app-workbench-page-BCKEDMlP.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-Cy9YQK7j.js +0 -2
- package/dist/gateway/static/root/assets/markdown-view-CBM-v2ph.js +0 -69
- package/dist/gateway/static/root/assets/mermaid-render-BbqDc_LQ.js +0 -134
- package/dist/gateway/static/root/assets/messages-CtOJwGW3.js +0 -3
- package/dist/gateway/static/root/assets/notes-workbench-B10T3hGX.js +0 -4
- package/dist/gateway/static/root/assets/project-detail-page-DsqRlgsy.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-Bu2PN8OK.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CXACdJ2f.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CS2knWDT.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-ByFGk0q_.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DweAPjI8.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-DEj-BFMP.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-f7yh7aD5.js +0 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-CBAYvm3G.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-BN0JmHrG.js +0 -5
- package/dist/src/agent/memory/understanding/correction.d.ts +0 -3
- package/dist/src/agent/memory/understanding/correction.js +0 -39
- package/dist/src/knowledge/connected-understanding-pipeline.d.ts +0 -17
- package/dist/src/knowledge/connected-understanding-pipeline.js +0 -278
- package/dist/src/mobile/notification-service.d.ts +0 -9
- package/dist/src/mobile/notification-service.js +0 -156
- package/dist/src/mobile/notification-store.d.ts +0 -28
- package/dist/src/mobile/notification-store.js +0 -132
- package/dist/src/mobile/notification-types.d.ts +0 -37
- package/dist/src/mobile/notification-types.js +0 -9
|
@@ -1,54 +1,60 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
-
import { UNDERSTANDING_KINDS } from "../../user-context/domain.js";
|
|
4
3
|
import { finishContextExtractionRun } from "../../storage/sqlite/context-extraction-repository.js";
|
|
5
|
-
import {
|
|
6
|
-
import { getSessionMetadata } from "../../storage/sqlite/session-repository.js";
|
|
4
|
+
import { getTurnPersonalization } from "../../storage/sqlite/user-context-repository.js";
|
|
7
5
|
import { loadCompactionSourceSnapshot } from "../../storage/sqlite/transcript-repository.js";
|
|
8
6
|
import "../../storage/sqlite/index.js";
|
|
7
|
+
import { extractProfileAgentId } from "../../config/agent-profile.js";
|
|
9
8
|
import { init_sync_provider_auth, resolveProviderApiKeySync } from "../../auth/sync-provider-auth.js";
|
|
10
|
-
import { getApiKeySync, init_providers } from "../../providers/index.js";
|
|
9
|
+
import { getApiKeySync, init_providers, resolveModel } from "../../providers/index.js";
|
|
11
10
|
import { createExtensionAwareStreamFn } from "../../providers/extension-stream-bridge.js";
|
|
12
11
|
import { extractTextContent } from "../context/workspace.js";
|
|
13
12
|
import { readAgentMessageContent } from "../memory/agent-message-access.js";
|
|
14
13
|
import { resolveAgentTurnTimeoutMs, runAgentTurnWithTimeout } from "../orchestration/run-agent-turn-with-timeout.js";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
14
|
+
import { resolveTypedModelRef } from "../../config/agent-typed-models.js";
|
|
15
|
+
import { claimRegisteredExtraction } from "../../user-context/extraction/registry.js";
|
|
17
16
|
import { isAssistantTurnAborted, isAssistantTurnFailed } from "../orchestration/llm-turn-retry.js";
|
|
18
|
-
import {
|
|
17
|
+
import { emptyUnderstandingReview, executeUnderstandingInterpretation } from "../../user-context/extraction/executor.js";
|
|
18
|
+
import { parseSemanticUnderstanding } from "../../user-context/extraction/semantic.js";
|
|
19
|
+
import { UNDERSTANDING_INTERPRETER_SYSTEM_PROMPT, buildUnderstandingInterpreterPrompt } from "./prompts.js";
|
|
19
20
|
import { Agent } from "@earendil-works/pi-agent-core";
|
|
20
21
|
//#region src/agent/background-review/run-background-review.ts
|
|
21
22
|
init_sync_provider_auth();
|
|
22
23
|
init_providers();
|
|
23
24
|
init_logger();
|
|
24
|
-
const log = createLogger("
|
|
25
|
+
const log = createLogger("UnderstandingInterpreter");
|
|
25
26
|
function isReviewMessage(value) {
|
|
26
27
|
if (!value || typeof value !== "object") return false;
|
|
27
28
|
const role = value.role;
|
|
28
29
|
return role === "user" || role === "assistant";
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
function messageText(message) {
|
|
32
|
+
const content = readAgentMessageContent(message);
|
|
33
|
+
if (typeof content === "string") return content;
|
|
34
|
+
return Array.isArray(content) ? extractTextContent(content) : "";
|
|
35
|
+
}
|
|
36
|
+
function tagMessage(entry) {
|
|
37
|
+
const copy = JSON.parse(JSON.stringify(entry.message));
|
|
38
|
+
const tag = `[evidence_ref:${entry.ref}] [role:${entry.role}]\n`;
|
|
39
|
+
const content = readAgentMessageContent(copy);
|
|
40
|
+
if (typeof content === "string") return {
|
|
35
41
|
...copy,
|
|
36
|
-
content: `${tag}${
|
|
42
|
+
content: `${tag}${content}`
|
|
37
43
|
};
|
|
38
|
-
if (Array.isArray(
|
|
39
|
-
const
|
|
40
|
-
const first =
|
|
41
|
-
if (first?.type === "text")
|
|
44
|
+
if (Array.isArray(content)) {
|
|
45
|
+
const parts = [...content];
|
|
46
|
+
const first = parts[0];
|
|
47
|
+
if (first?.type === "text") parts[0] = {
|
|
42
48
|
...first,
|
|
43
49
|
text: `${tag}${first.text ?? ""}`
|
|
44
50
|
};
|
|
45
|
-
else
|
|
51
|
+
else parts.unshift({
|
|
46
52
|
type: "text",
|
|
47
53
|
text: tag
|
|
48
54
|
});
|
|
49
55
|
return {
|
|
50
56
|
...copy,
|
|
51
|
-
content
|
|
57
|
+
content: parts
|
|
52
58
|
};
|
|
53
59
|
}
|
|
54
60
|
return copy;
|
|
@@ -56,89 +62,75 @@ function tagMessage(message, entryId) {
|
|
|
56
62
|
function loadEvidenceMessages(sessionKey, max) {
|
|
57
63
|
const snapshot = loadCompactionSourceSnapshot(sessionKey);
|
|
58
64
|
if (!snapshot) return [];
|
|
59
|
-
return snapshot.entries.filter((entry) => isReviewMessage(entry.row)).slice(-max).map((entry) =>
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
65
|
+
return snapshot.entries.filter((entry) => isReviewMessage(entry.row)).slice(-max).map((entry) => {
|
|
66
|
+
const message = entry.row;
|
|
67
|
+
return {
|
|
68
|
+
ref: entry.entryId,
|
|
69
|
+
role: message.role,
|
|
70
|
+
text: messageText(message),
|
|
71
|
+
createdAt: entry.createdAt,
|
|
72
|
+
message
|
|
73
|
+
};
|
|
74
|
+
});
|
|
64
75
|
}
|
|
65
|
-
const ALLOWED_UNDERSTANDING_KINDS = new Set(UNDERSTANDING_KINDS);
|
|
66
|
-
const ALLOWED_SENSITIVITIES = new Set([
|
|
67
|
-
"normal",
|
|
68
|
-
"personal",
|
|
69
|
-
"secret",
|
|
70
|
-
"regulated"
|
|
71
|
-
]);
|
|
72
76
|
function lastAssistantText(agent) {
|
|
73
|
-
for (let i = agent.state.messages.length - 1; i >= 0; i
|
|
77
|
+
for (let i = agent.state.messages.length - 1; i >= 0; i -= 1) {
|
|
74
78
|
const message = agent.state.messages[i];
|
|
75
|
-
if (message.role
|
|
76
|
-
return Array.isArray(message.content) ? extractTextContent(message.content) : String(message.content);
|
|
79
|
+
if (message.role === "assistant") return messageText(message);
|
|
77
80
|
}
|
|
78
81
|
return "";
|
|
79
82
|
}
|
|
80
|
-
function
|
|
81
|
-
|
|
82
|
-
const start = raw.indexOf("{");
|
|
83
|
-
const end = raw.lastIndexOf("}");
|
|
84
|
-
const candidateJson = fenced ?? (start >= 0 && end > start ? raw.slice(start, end + 1) : raw);
|
|
83
|
+
function isLocalModel(model) {
|
|
84
|
+
if (["ollama", "lmstudio"].includes(model.provider)) return true;
|
|
85
85
|
try {
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
const output = [];
|
|
89
|
-
for (const value of parsed.candidates.slice(0, 8)) {
|
|
90
|
-
if (!value || typeof value !== "object") continue;
|
|
91
|
-
const item = value;
|
|
92
|
-
if (!ALLOWED_UNDERSTANDING_KINDS.has(item.kind)) continue;
|
|
93
|
-
if (typeof item.content !== "string" || item.content.trim().length < 4) continue;
|
|
94
|
-
const kind = item.kind;
|
|
95
|
-
if (!isDurableUnderstandingCandidate(kind, item.content)) continue;
|
|
96
|
-
const confidence = typeof item.confidence === "number" ? item.confidence : .65;
|
|
97
|
-
const importance = typeof item.importance === "number" ? item.importance : .5;
|
|
98
|
-
const durability = item.durability === "ephemeral" || item.durability === "recurring" ? item.durability : "durable";
|
|
99
|
-
const sensitivity = ALLOWED_SENSITIVITIES.has(item.sensitivity) ? item.sensitivity : "personal";
|
|
100
|
-
const disclosurePolicy = item.disclosurePolicy === "silent" || item.disclosurePolicy === "ask_before_reference" ? item.disclosurePolicy : "referenceable";
|
|
101
|
-
const evidenceRefs = Array.isArray(item.evidenceRefs) ? [...new Set(item.evidenceRefs.filter((value) => typeof value === "string" && value.trim().length > 0))] : [];
|
|
102
|
-
output.push({
|
|
103
|
-
kind,
|
|
104
|
-
content: item.content.trim(),
|
|
105
|
-
confidence: Math.max(0, Math.min(1, confidence)),
|
|
106
|
-
importance: Math.max(0, Math.min(1, importance)),
|
|
107
|
-
explicitness: "inferred",
|
|
108
|
-
durability,
|
|
109
|
-
sensitivity,
|
|
110
|
-
disclosurePolicy,
|
|
111
|
-
evidenceRefs
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
return output;
|
|
86
|
+
const hostname = new URL(model.baseUrl).hostname;
|
|
87
|
+
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1";
|
|
115
88
|
} catch {
|
|
116
|
-
return
|
|
89
|
+
return false;
|
|
117
90
|
}
|
|
118
91
|
}
|
|
119
|
-
function
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
92
|
+
function resolveInterpreterRuntime(params) {
|
|
93
|
+
const config = params.getConfig();
|
|
94
|
+
const processingPolicy = config?.userContext.understanding.processingPolicy ?? "remote_allowed";
|
|
95
|
+
let model;
|
|
96
|
+
if (config) {
|
|
97
|
+
const agentId = extractProfileAgentId(params.sessionKey, config);
|
|
98
|
+
for (const role of ["understanding", "small"]) {
|
|
99
|
+
const ref = resolveTypedModelRef(config, agentId, role);
|
|
100
|
+
if (!ref) continue;
|
|
101
|
+
try {
|
|
102
|
+
model = resolveModel(ref);
|
|
103
|
+
break;
|
|
104
|
+
} catch (err) {
|
|
105
|
+
log.debug({
|
|
106
|
+
err,
|
|
107
|
+
agentId,
|
|
108
|
+
role,
|
|
109
|
+
modelRef: ref
|
|
110
|
+
}, "Configured understanding model could not be resolved");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
128
113
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
114
|
+
model ??= params.mainAgent.state.model;
|
|
115
|
+
if (processingPolicy === "local_only" && !isLocalModel(model)) {
|
|
116
|
+
log.debug({
|
|
117
|
+
sessionKey: params.sessionKey,
|
|
118
|
+
provider: model.provider,
|
|
119
|
+
modelId: model.id
|
|
120
|
+
}, "Understanding interpretation skipped because no local model is configured");
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
model,
|
|
125
|
+
processingPolicy,
|
|
126
|
+
destination: isLocalModel(model) ? "local_model" : "remote_model"
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
async function interpret(params) {
|
|
138
130
|
const reviewAgent = new Agent({
|
|
139
131
|
initialState: {
|
|
140
|
-
systemPrompt:
|
|
141
|
-
model:
|
|
132
|
+
systemPrompt: UNDERSTANDING_INTERPRETER_SYSTEM_PROMPT,
|
|
133
|
+
model: params.model,
|
|
142
134
|
thinkingLevel: "off",
|
|
143
135
|
tools: [],
|
|
144
136
|
messages: []
|
|
@@ -146,79 +138,71 @@ async function runUnderstandingReview(params) {
|
|
|
146
138
|
streamFn: createExtensionAwareStreamFn(),
|
|
147
139
|
getApiKey: (provider) => resolveProviderApiKeySync(provider) ?? getApiKeySync(provider) ?? ""
|
|
148
140
|
});
|
|
149
|
-
reviewAgent.state.messages =
|
|
150
|
-
const timeoutMs = Math.min(settings.maxDurationMs, resolveAgentTurnTimeoutMs(getConfig()));
|
|
141
|
+
reviewAgent.state.messages = params.evidence.map(tagMessage);
|
|
151
142
|
try {
|
|
152
143
|
await runAgentTurnWithTimeout(reviewAgent, async () => {
|
|
153
144
|
await reviewAgent.prompt({
|
|
154
145
|
role: "user",
|
|
155
|
-
content:
|
|
146
|
+
content: buildUnderstandingInterpreterPrompt({
|
|
147
|
+
mode: params.mode,
|
|
148
|
+
availableTargets: params.availableTargets
|
|
149
|
+
}),
|
|
156
150
|
timestamp: Date.now()
|
|
157
151
|
});
|
|
158
152
|
await reviewAgent.waitForIdle();
|
|
159
|
-
}, timeoutMs);
|
|
153
|
+
}, Math.min(params.timeoutMs, resolveAgentTurnTimeoutMs(params.getConfig())));
|
|
160
154
|
} catch (err) {
|
|
161
155
|
log.warn({
|
|
162
156
|
err,
|
|
163
|
-
sessionKey
|
|
164
|
-
}, "User-understanding
|
|
157
|
+
sessionKey: params.sessionKey
|
|
158
|
+
}, "User-understanding interpretation failed or timed out");
|
|
165
159
|
reviewAgent.abort();
|
|
166
160
|
await reviewAgent.waitForIdle().catch(() => {});
|
|
167
|
-
|
|
168
|
-
runId: extraction.run.id,
|
|
169
|
-
status: "failed",
|
|
170
|
-
errorCode: "model_failed"
|
|
171
|
-
});
|
|
172
|
-
return;
|
|
161
|
+
return null;
|
|
173
162
|
}
|
|
174
|
-
if (isAssistantTurnAborted(reviewAgent) || isAssistantTurnFailed(reviewAgent))
|
|
163
|
+
if (isAssistantTurnAborted(reviewAgent) || isAssistantTurnFailed(reviewAgent)) return null;
|
|
164
|
+
return parseSemanticUnderstanding(lastAssistantText(reviewAgent), params.evidence, params.availableTargets.map((item) => item.id));
|
|
165
|
+
}
|
|
166
|
+
async function executeReview(params) {
|
|
167
|
+
const runtime = resolveInterpreterRuntime(params);
|
|
168
|
+
if (!runtime) return emptyUnderstandingReview();
|
|
169
|
+
const extraction = claimRegisteredExtraction({
|
|
170
|
+
extractorId: params.extractorId,
|
|
171
|
+
sourceRef: params.sourceRef,
|
|
172
|
+
contentForHash: params.contentForHash,
|
|
173
|
+
processingPolicy: runtime.processingPolicy,
|
|
174
|
+
destination: runtime.destination
|
|
175
|
+
});
|
|
176
|
+
if (!extraction.shouldExecute) return emptyUnderstandingReview();
|
|
177
|
+
const interpretation = await interpret({
|
|
178
|
+
...params,
|
|
179
|
+
model: runtime.model
|
|
180
|
+
});
|
|
181
|
+
if (!interpretation) {
|
|
175
182
|
finishContextExtractionRun({
|
|
176
183
|
runId: extraction.run.id,
|
|
177
184
|
status: "failed",
|
|
178
|
-
errorCode: "
|
|
185
|
+
errorCode: "model_or_schema_failed"
|
|
179
186
|
});
|
|
180
|
-
return;
|
|
187
|
+
return emptyUnderstandingReview();
|
|
181
188
|
}
|
|
182
|
-
const candidates = parseBackgroundCandidates(lastAssistantText(reviewAgent));
|
|
183
|
-
let applied = 0;
|
|
184
189
|
try {
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
sourceType: "conversation",
|
|
202
|
-
sourceRef: `session:${sessionKey}:entry:${entry.entryId}`,
|
|
203
|
-
sourceRunId: extraction.run.id,
|
|
204
|
-
sessionId: sessionKey,
|
|
205
|
-
messageId: entry.entryId,
|
|
206
|
-
contentHash: extractionInputHash(JSON.stringify(entry.message)),
|
|
207
|
-
retentionPolicy: "derived_only",
|
|
208
|
-
processingPolicy: "remote_allowed",
|
|
209
|
-
extractorId: "transcript-synthesis",
|
|
210
|
-
extractorVersion: "1",
|
|
211
|
-
trustLevel: "owner",
|
|
212
|
-
observedAt: entry.createdAt
|
|
213
|
-
}).id);
|
|
214
|
-
const result = await memoryManager.applyUnderstandingCandidates([candidate], {
|
|
215
|
-
sessionKey,
|
|
216
|
-
...projectId ? { projectId } : {},
|
|
217
|
-
evidenceIds,
|
|
218
|
-
reviewSource: "background",
|
|
219
|
-
extractionRunId: extraction.run.id
|
|
220
|
-
});
|
|
221
|
-
outputs.push(...(result.writeOutputs ?? []).map((output) => ({
|
|
190
|
+
const result = await executeUnderstandingInterpretation({
|
|
191
|
+
interpretation,
|
|
192
|
+
evidence: params.evidence,
|
|
193
|
+
extractionRunId: extraction.run.id,
|
|
194
|
+
extractorId: params.extractorId,
|
|
195
|
+
sessionKey: params.sessionKey,
|
|
196
|
+
...params.turnId ? { turnId: params.turnId } : {},
|
|
197
|
+
memoryManager: params.memoryManager,
|
|
198
|
+
getConfig: params.getConfig,
|
|
199
|
+
reviewSource: params.mode === "turn" ? "turn" : "background",
|
|
200
|
+
processingPolicy: runtime.processingPolicy
|
|
201
|
+
});
|
|
202
|
+
finishContextExtractionRun({
|
|
203
|
+
runId: extraction.run.id,
|
|
204
|
+
status: "completed",
|
|
205
|
+
outputs: result.writeOutputs?.map((output) => ({
|
|
222
206
|
candidateKey: output.candidateKey,
|
|
223
207
|
...output.objectId ? {
|
|
224
208
|
objectType: "understanding",
|
|
@@ -226,30 +210,61 @@ async function runUnderstandingReview(params) {
|
|
|
226
210
|
} : {},
|
|
227
211
|
...output.versionId ? { versionId: output.versionId } : {},
|
|
228
212
|
outcome: output.outcome
|
|
229
|
-
}))
|
|
230
|
-
applied += 1;
|
|
231
|
-
}
|
|
232
|
-
finishContextExtractionRun({
|
|
233
|
-
runId: extraction.run.id,
|
|
234
|
-
status: "completed",
|
|
235
|
-
outputs
|
|
213
|
+
}))
|
|
236
214
|
});
|
|
237
|
-
|
|
215
|
+
return result;
|
|
216
|
+
} catch (err) {
|
|
238
217
|
finishContextExtractionRun({
|
|
239
218
|
runId: extraction.run.id,
|
|
240
219
|
status: "failed",
|
|
241
220
|
errorCode: "write_failed"
|
|
242
221
|
});
|
|
243
|
-
throw
|
|
222
|
+
throw err;
|
|
244
223
|
}
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
224
|
+
}
|
|
225
|
+
async function runTurnUnderstandingReview(params) {
|
|
226
|
+
const evidence = loadEvidenceMessages(params.sessionKey, params.maxHistoryMessages ?? 12);
|
|
227
|
+
if (!evidence.length) return emptyUnderstandingReview();
|
|
228
|
+
const availableTargets = getTurnPersonalization(params.turnId)?.items.flatMap((item) => {
|
|
229
|
+
if (item.objectType !== "understanding" || item.decision !== "selected") return [];
|
|
230
|
+
return [{
|
|
231
|
+
id: item.objectId,
|
|
232
|
+
statement: item.content
|
|
233
|
+
}];
|
|
234
|
+
}) ?? [];
|
|
235
|
+
return executeReview({
|
|
236
|
+
sessionKey: params.sessionKey,
|
|
237
|
+
mainAgent: params.mainAgent,
|
|
238
|
+
memoryManager: params.memoryManager,
|
|
239
|
+
getConfig: params.getConfig,
|
|
240
|
+
evidence,
|
|
241
|
+
mode: "turn",
|
|
242
|
+
extractorId: "turn-semantics",
|
|
243
|
+
sourceRef: `session:${params.sessionKey}:turn:${params.turnId}`,
|
|
244
|
+
contentForHash: params.userText,
|
|
245
|
+
availableTargets,
|
|
246
|
+
timeoutMs: 3e4,
|
|
247
|
+
turnId: params.turnId
|
|
248
|
+
});
|
|
250
249
|
}
|
|
251
250
|
async function runBackgroundReviewTurn(params) {
|
|
252
|
-
|
|
251
|
+
const evidence = loadEvidenceMessages(params.sessionKey, params.settings.maxHistoryMessages);
|
|
252
|
+
if (!evidence.length) return;
|
|
253
|
+
const first = evidence[0];
|
|
254
|
+
const last = evidence[evidence.length - 1];
|
|
255
|
+
await executeReview({
|
|
256
|
+
sessionKey: params.sessionKey,
|
|
257
|
+
mainAgent: params.mainAgent,
|
|
258
|
+
memoryManager: params.memoryManager,
|
|
259
|
+
getConfig: params.getConfig,
|
|
260
|
+
evidence,
|
|
261
|
+
mode: "transcript",
|
|
262
|
+
extractorId: "transcript-synthesis",
|
|
263
|
+
sourceRef: `session:${params.sessionKey}:window:${first.ref}:${last.ref}`,
|
|
264
|
+
contentForHash: evidence.map((entry) => entry.ref).join("\n"),
|
|
265
|
+
availableTargets: [],
|
|
266
|
+
timeoutMs: params.settings.maxDurationMs
|
|
267
|
+
});
|
|
253
268
|
}
|
|
254
269
|
//#endregion
|
|
255
|
-
export {
|
|
270
|
+
export { runBackgroundReviewTurn, runTurnUnderstandingReview };
|
|
@@ -14,6 +14,7 @@ export interface TimeoutConfig {
|
|
|
14
14
|
networkTimeoutMs: number;
|
|
15
15
|
gracefulShutdownMs: number;
|
|
16
16
|
}
|
|
17
|
+
export declare const DEFAULT_TOOL_EXECUTION_TIMEOUT_MS: number;
|
|
17
18
|
declare const DEFAULT_CONFIG: TimeoutConfig;
|
|
18
19
|
export interface TimeoutResult<T> {
|
|
19
20
|
success: boolean;
|
|
@@ -3,12 +3,13 @@ import { init_logger } from "../../utils/logger.js";
|
|
|
3
3
|
//#region src/agent/lifecycle/timeout-wrapper.ts
|
|
4
4
|
init_logger();
|
|
5
5
|
const log = createLogger("TimeoutWrapper");
|
|
6
|
+
const DEFAULT_TOOL_EXECUTION_TIMEOUT_MS = 1800 * 1e3;
|
|
6
7
|
const DEFAULT_CONFIG = {
|
|
7
|
-
defaultTimeoutMs:
|
|
8
|
-
shellTimeoutMs:
|
|
9
|
-
readTimeoutMs:
|
|
10
|
-
writeTimeoutMs:
|
|
11
|
-
networkTimeoutMs:
|
|
8
|
+
defaultTimeoutMs: DEFAULT_TOOL_EXECUTION_TIMEOUT_MS,
|
|
9
|
+
shellTimeoutMs: DEFAULT_TOOL_EXECUTION_TIMEOUT_MS,
|
|
10
|
+
readTimeoutMs: DEFAULT_TOOL_EXECUTION_TIMEOUT_MS,
|
|
11
|
+
writeTimeoutMs: DEFAULT_TOOL_EXECUTION_TIMEOUT_MS,
|
|
12
|
+
networkTimeoutMs: DEFAULT_TOOL_EXECUTION_TIMEOUT_MS,
|
|
12
13
|
gracefulShutdownMs: 5e3
|
|
13
14
|
};
|
|
14
15
|
/**
|
|
@@ -254,4 +255,4 @@ var TimeoutManager = class {
|
|
|
254
255
|
}
|
|
255
256
|
};
|
|
256
257
|
//#endregion
|
|
257
|
-
export { DEFAULT_CONFIG as DEFAULT_TIMEOUT_CONFIG, TimeoutError, TimeoutManager, executeWithTimeout, executeWithTimeoutResult, withTimeout };
|
|
258
|
+
export { DEFAULT_CONFIG as DEFAULT_TIMEOUT_CONFIG, DEFAULT_TOOL_EXECUTION_TIMEOUT_MS, TimeoutError, TimeoutManager, executeWithTimeout, executeWithTimeoutResult, withTimeout };
|
|
@@ -23,6 +23,6 @@ export type ResolvedHttpMcpTransportConfig = ResolvedBaseMcpTransportConfig & {
|
|
|
23
23
|
};
|
|
24
24
|
};
|
|
25
25
|
export type ResolvedMcpTransportConfig = ResolvedStdioMcpTransportConfig | ResolvedHttpMcpTransportConfig;
|
|
26
|
-
export declare const DEFAULT_MCP_REQUEST_TIMEOUT_MS
|
|
26
|
+
export declare const DEFAULT_MCP_REQUEST_TIMEOUT_MS: number;
|
|
27
27
|
export declare function resolveMcpTransportConfig(serverName: string, rawServer: unknown): ResolvedMcpTransportConfig | null;
|
|
28
28
|
export {};
|
|
@@ -10,7 +10,7 @@ init_logger();
|
|
|
10
10
|
init_string_coerce();
|
|
11
11
|
const log = createLogger("Mcp:Bundle");
|
|
12
12
|
const DEFAULT_CONNECTION_TIMEOUT_MS = 3e4;
|
|
13
|
-
const DEFAULT_MCP_REQUEST_TIMEOUT_MS =
|
|
13
|
+
const DEFAULT_MCP_REQUEST_TIMEOUT_MS = 1800 * 1e3;
|
|
14
14
|
function getConnectionTimeoutMs(rawServer) {
|
|
15
15
|
if (rawServer && typeof rawServer === "object" && typeof rawServer.connectionTimeoutMs === "number" && rawServer.connectionTimeoutMs > 0) return rawServer.connectionTimeoutMs;
|
|
16
16
|
return DEFAULT_CONNECTION_TIMEOUT_MS;
|
|
@@ -5,7 +5,7 @@ export type { UserContextPlan } from './context/types.js';
|
|
|
5
5
|
export { createMemoryManagerFromConfig } from './create-memory-manager.js';
|
|
6
6
|
export { isMemorySubsystemEnabled, shouldPlanUserContextThisTurn, } from './memory-config.js';
|
|
7
7
|
export { MemoryManager } from './manager.js';
|
|
8
|
-
export { UserUnderstandingService
|
|
8
|
+
export { UserUnderstandingService } from './understanding/service.js';
|
|
9
9
|
export type { UnderstandingCandidate, UnderstandingReviewResult } from './understanding/types.js';
|
|
10
10
|
export { discoverMemoryPlugins } from './plugin-discovery.js';
|
|
11
11
|
export type { MemoryPluginMetadata } from './plugin-discovery.js';
|
|
@@ -3,9 +3,9 @@ import { buildUserContextBlock, sanitizeUserContextFenceEscapes } from "./contex
|
|
|
3
3
|
import { UserContextPlanner } from "../../user-context/planner.js";
|
|
4
4
|
import { extractAgentUserPlainText } from "./user-message-text.js";
|
|
5
5
|
import { BuiltinMemoryProvider } from "./builtin-provider.js";
|
|
6
|
-
import { UserUnderstandingService
|
|
6
|
+
import { UserUnderstandingService } from "./understanding/service.js";
|
|
7
7
|
import { MemoryManager } from "./manager.js";
|
|
8
8
|
import { discoverMemoryPlugins } from "./plugin-discovery.js";
|
|
9
9
|
import { createMemoryManagerFromConfig } from "./create-memory-manager.js";
|
|
10
10
|
import { StubMemoryProvider } from "./stub-memory-provider.js";
|
|
11
|
-
export { BuiltinMemoryProvider, MemoryManager, StubMemoryProvider, UserContextPlanner, UserUnderstandingService, buildUserContextBlock, createMemoryManagerFromConfig, discoverMemoryPlugins, extractAgentUserPlainText,
|
|
11
|
+
export { BuiltinMemoryProvider, MemoryManager, StubMemoryProvider, UserContextPlanner, UserUnderstandingService, buildUserContextBlock, createMemoryManagerFromConfig, discoverMemoryPlugins, extractAgentUserPlainText, isMemorySubsystemEnabled, sanitizeUserContextFenceEscapes, shouldPlanUserContextThisTurn };
|
|
@@ -39,17 +39,6 @@ export declare class MemoryManager {
|
|
|
39
39
|
queuePrefetchAll(query: string, options?: {
|
|
40
40
|
sessionId?: string;
|
|
41
41
|
}): void;
|
|
42
|
-
syncAll(userContent: string, assistantContent: string, options?: {
|
|
43
|
-
sessionId?: string;
|
|
44
|
-
}): Promise<void>;
|
|
45
|
-
captureTurnUnderstanding(userContent: string, assistantContent: string, options?: {
|
|
46
|
-
agentId?: string;
|
|
47
|
-
sessionId?: string;
|
|
48
|
-
turnId?: string;
|
|
49
|
-
workspaceId?: string;
|
|
50
|
-
projectId?: string;
|
|
51
|
-
correctionTargetRecordIds?: string[];
|
|
52
|
-
}): Promise<import('./understanding/types.js').UnderstandingReviewResult>;
|
|
53
42
|
syncProvidersForTurn(userContent: string, assistantContent: string, options?: {
|
|
54
43
|
sessionId?: string;
|
|
55
44
|
turnId?: string;
|
|
@@ -67,6 +56,7 @@ export declare class MemoryManager {
|
|
|
67
56
|
source?: MemoryRecord['source'];
|
|
68
57
|
reviewSource?: 'turn' | 'background';
|
|
69
58
|
extractionRunId?: string;
|
|
59
|
+
supersedesRecordIds?: string[];
|
|
70
60
|
}): Promise<import('./understanding/types.js').UnderstandingReviewResult>;
|
|
71
61
|
getExternalToolEntries(): Array<{
|
|
72
62
|
providerId: string;
|
|
@@ -81,22 +81,6 @@ var MemoryManager = class {
|
|
|
81
81
|
}, "queuePrefetch failed (non-fatal)");
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
async syncAll(userContent, assistantContent, options) {
|
|
85
|
-
await this.captureTurnUnderstanding(userContent, assistantContent, options);
|
|
86
|
-
await this.syncProvidersForTurn(userContent, assistantContent, options);
|
|
87
|
-
}
|
|
88
|
-
async captureTurnUnderstanding(userContent, assistantContent, options) {
|
|
89
|
-
const sessionContext = options?.sessionId ? this.sessionContexts.get(options.sessionId) : void 0;
|
|
90
|
-
return await this.understanding.reviewTurn({
|
|
91
|
-
userContent,
|
|
92
|
-
assistantContent,
|
|
93
|
-
sessionKey: options?.sessionId,
|
|
94
|
-
turnId: options?.turnId,
|
|
95
|
-
workspaceId: options?.workspaceId ?? sessionContext?.workspace ?? sessionContext?.agentWorkspace,
|
|
96
|
-
projectId: options?.projectId,
|
|
97
|
-
correctionTargetRecordIds: options?.correctionTargetRecordIds
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
84
|
async syncProvidersForTurn(userContent, assistantContent, options) {
|
|
101
85
|
const provenance = options?.provenance;
|
|
102
86
|
const event = {
|
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
import type { UnderstandingCandidate, UnderstandingReviewResult } from './types.js';
|
|
2
|
-
export declare function extractExplicitUnderstandingCandidates(userContent: string): UnderstandingCandidate[];
|
|
3
|
-
export declare function extractHighSignalUnderstandingCandidates(userContent: string): UnderstandingCandidate[];
|
|
4
2
|
export declare class UserUnderstandingService {
|
|
5
|
-
reviewTurn(params: {
|
|
6
|
-
userContent: string;
|
|
7
|
-
assistantContent: string;
|
|
8
|
-
sessionKey?: string;
|
|
9
|
-
turnId?: string;
|
|
10
|
-
workspaceId?: string;
|
|
11
|
-
projectId?: string;
|
|
12
|
-
correctionTargetRecordIds?: string[];
|
|
13
|
-
}): Promise<UnderstandingReviewResult>;
|
|
14
3
|
applyCandidates(candidates: UnderstandingCandidate[], context: {
|
|
15
4
|
sessionKey?: string;
|
|
16
5
|
workspaceId?: string;
|