@xopcai/xopc 0.0.248 → 0.0.250
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-etpmyV7S.js → activity-store-DfBjTSo9.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-BmKxSM1k.js → agent-avatar-dicebear-BN6FJXkJ.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-C7rZH1A2.js +1 -0
- package/dist/gateway/static/root/assets/agents-CgGaoo4z.js +1 -0
- package/dist/gateway/static/root/assets/{api-B0-hLuZ1.js → api-zxpcJfgj.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-D2gMshuS.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-wMu0jSKx.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-KF1Gnv36.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BnMSgZvR.js → archive-plugin-u6EE3JV8.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CejsQMev.js → attachment-load-DbJurnv-.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-RC8EyoAf.js → automations-page-Ew_e5HDn.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-Ch-ldu35.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-DGjppLSG.js → binary-plugins-DtDFNfPM.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CWdP4bUc.js → block-editor-CnAwmabq.js} +44 -44
- package/dist/gateway/static/root/assets/browser-settings-page-DtVhsHJW.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-BQ1Ilw_o.js → browser-workflow-inputs-BX1-uM9L.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-CJh4NyxT.js → browser-workflows-page-CcbUOWDF.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel--sXeylhe.js +7 -0
- package/dist/gateway/static/root/assets/channels-settings-AXSBDujZ.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-Ohhee4vm.js → channels-status-swr-CX-yWwLD.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-BOtoKTK3.js → chat-terminal-dock-CryTDNdD.js} +2 -2
- package/dist/gateway/static/root/assets/connectors-page-HBHUWohz.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-DTj1V3Sw.js → cron-expression-ji5aWrjG.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-Yr6OCvGL.js → date-picker-Dro_w3eX.js} +1 -1
- package/dist/gateway/static/root/assets/dependency-picker-Ce19KKnX.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-DbGzggPF.js → desktop-pet-DsSi-3uZ.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-8WQ4woJy.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DgTtk4KC.js → extension-debug-page-CgvEBfLZ.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DtQeiP6f.js → extension-page-DkznBbMj.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BOjhchK2.js +1 -0
- package/dist/gateway/static/root/assets/files-BArWTfr7.js +1 -0
- package/dist/gateway/static/root/assets/gateway-config-api-OEruhhX3.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-DXuXtU1w.js → gateway-config-swr-CMNbl0FZ.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-BgH3A0LO.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CzBzglzQ.js → gateway-startup-retry-CR7Xg8As.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-C97naDkO.js +1 -0
- package/dist/gateway/static/root/assets/home-page-BBKKme4G.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-TIgsn04n.js → image-generation-api-C5mn73ca.js} +1 -1
- package/dist/gateway/static/root/assets/index-BcaF-dgQ.js +72 -0
- package/dist/gateway/static/root/assets/index-DAryGvZ7.css +2 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-wsWuoa8p.js → keyboard-shortcuts-settings-BYhfzsqe.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-DNncc2tn.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CXrbrGo8.js → local-apps-page-vBlknU7C.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-BJFLQY8O.js → locale-store-CF4erhjB.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-CizZInrT.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-BdJZFR7U.js → management-settings-Dnx6mSNe.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-NK3ACVG2.js → markdown-split-DtBtcHWi.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-DTF9v1gg.js → markdown-view-CQvzsE24.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-F0jcUxyl.js → media-plugins-DrMYeHe7.js} +1 -1
- package/dist/gateway/static/root/assets/messages-Cf5hpZE6.js +3 -0
- package/dist/gateway/static/root/assets/mobile-pairing-wizard-AKgGy3Kx.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-Bw3jD9Jf.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-Dpqq7Z-J.js +8 -0
- package/dist/gateway/static/root/assets/page-tabs-CX9T71by.js +1 -0
- package/dist/gateway/static/root/assets/preview-open-alternatives-DvEHoimN.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-CxGGlWA8.js → product-open-page-COcr_NUJ.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BuT6MCTs.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DXWMxOjf.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-CIsNlSBi.js → registry-api-BsRBlji7.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-7rBCUWzZ.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-YkjhiQfA.js → runtime-tools-settings-panel-CQ13P-mS.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-oFGf3G3s.js → schema-form-BUVyTpZj.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-gmEOYNb4.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DYYoJcl7.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-DVY-8_B9.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-C7VWs0IT.js → settings-page-CdiVYyTl.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BhenBnUj.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-t5oz18rh.js → share-preview-page-C88YLKm4.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-Dq7xIj0_.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-MDI9Lz6z.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-DLir1nM0.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-DEDTYs2W.js → skills-page.utils-BMZAfS3G.js} +1 -1
- package/dist/gateway/static/root/assets/system-settings-panel-BM8ivYan.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-P0_RldWv.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-O597U8q_.js → theme-store-BOgkc_9D.js} +1 -1
- package/dist/gateway/static/root/assets/tunnel-api-DemxChjo.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-B5eUJ6Zq.js → use-autosave-CV3Ui5hu.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-CxfnoRVn.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CMKSwz4C.js → voice-api-key-field-CUoCi4Sq.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-q7B6fOFB.js → voice-config-api-C-ryeIxj.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-BhDlkCMB.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DZmvLZjb.js → workflow-run-setup-panel-D8CcPc_C.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-Bxn2Dc16.js +5 -0
- package/dist/gateway/static/root/index.html +11 -27
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/user-message-display.js +18 -0
- package/dist/src/agent/agent-instance-gateway.d.ts +3 -3
- package/dist/src/agent/agent-manager.d.ts +13 -13
- package/dist/src/agent/agent-manager.js +76 -42
- package/dist/src/agent/background-review/coordinator.d.ts +2 -4
- package/dist/src/agent/background-review/coordinator.js +5 -30
- package/dist/src/agent/background-review/prompts.d.ts +4 -2
- package/dist/src/agent/background-review/prompts.js +33 -19
- package/dist/src/agent/background-review/run-background-review.d.ts +6 -7
- package/dist/src/agent/background-review/run-background-review.js +47 -41
- package/dist/src/agent/background-review/settings.d.ts +0 -1
- package/dist/src/agent/background-review/settings.js +6 -7
- package/dist/src/agent/context/audit.d.ts +38 -0
- package/dist/src/agent/context/audit.js +123 -0
- package/dist/src/agent/context/coordinator.d.ts +31 -0
- package/dist/src/agent/context/coordinator.js +73 -0
- package/dist/src/agent/context/execution-context.d.ts +13 -0
- package/dist/src/agent/context/execution-context.js +211 -0
- package/dist/src/agent/context/execution-context.types.d.ts +50 -0
- package/dist/src/agent/context/execution-scope.d.ts +5 -1
- package/dist/src/agent/context/execution-scope.js +6 -2
- package/dist/src/agent/context/prepend.d.ts +2 -0
- package/dist/src/agent/context/prepend.js +28 -0
- package/dist/src/agent/context/project-context.d.ts +6 -3
- package/dist/src/agent/context/project-context.js +28 -23
- package/dist/src/agent/embedded/index.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -0
- package/dist/src/agent/embedded/run-turn.js +22 -2
- package/dist/src/agent/embedded/types.d.ts +1 -25
- package/dist/src/agent/external-tools/composio-provider.js +87 -92
- package/dist/src/agent/external-tools/gateway-tools.d.ts +4 -1
- package/dist/src/agent/external-tools/gateway-tools.js +153 -41
- package/dist/src/agent/external-tools/index.d.ts +1 -0
- package/dist/src/agent/external-tools/index.js +2 -1
- package/dist/src/agent/external-tools/memory-provider.d.ts +1 -0
- package/dist/src/agent/external-tools/memory-provider.js +1 -0
- package/dist/src/agent/external-tools/search-error.d.ts +12 -0
- package/dist/src/agent/external-tools/search-error.js +29 -0
- package/dist/src/agent/external-tools/service.d.ts +4 -0
- package/dist/src/agent/external-tools/service.js +22 -2
- package/dist/src/agent/inbound/attachment-pipeline.js +5 -1
- package/dist/src/agent/memory/compaction-policy.js +1 -1
- package/dist/src/agent/memory/compaction-promotion.d.ts +1 -0
- package/dist/src/agent/memory/compaction-promotion.js +52 -79
- package/dist/src/agent/memory/create-memory-manager.js +1 -3
- package/dist/src/agent/memory/index.d.ts +1 -6
- package/dist/src/agent/memory/index.js +3 -6
- package/dist/src/agent/memory/manager.d.ts +0 -16
- package/dist/src/agent/memory/manager.js +11 -40
- package/dist/src/agent/memory/memory-config.d.ts +0 -5
- package/dist/src/agent/memory/memory-config.js +2 -9
- package/dist/src/agent/memory/runtime.d.ts +2 -2
- package/dist/src/agent/memory/runtime.js +9 -19
- package/dist/src/agent/memory/types.d.ts +1 -1
- package/dist/src/agent/orchestration/agent-orchestrator.js +13 -21
- package/dist/src/agent/orchestration/context-overflow.js +1 -0
- package/dist/src/agent/prompt/sections/memory-skills.js +25 -36
- package/dist/src/agent/prompt/sections/tooling.js +10 -4
- package/dist/src/agent/prompt/service-prompt-builder.js +4 -3
- package/dist/src/agent/service/direct-turn-helpers.d.ts +2 -2
- package/dist/src/agent/service/direct-turn-helpers.js +8 -25
- package/dist/src/agent/service/process-direct-streaming.js +8 -7
- package/dist/src/agent/service.js +4 -3
- package/dist/src/agent/tasks/task-judge-service.js +1 -1
- package/dist/src/agent/tools/clarify-tool.d.ts +1 -0
- package/dist/src/agent/tools/delegate-tool.js +5 -2
- package/dist/src/agent/tools/factory.d.ts +1 -0
- package/dist/src/agent/tools/factory.js +68 -21
- package/dist/src/agent/tools/index.d.ts +3 -2
- package/dist/src/agent/tools/index.js +4 -3
- package/dist/src/agent/tools/knowledge-memory-tool.d.ts +15 -0
- package/dist/src/agent/tools/knowledge-memory-tool.js +184 -0
- package/dist/src/agent/tools/{dreaming-tool.d.ts → memory-maintenance-tool.d.ts} +2 -2
- package/dist/src/agent/tools/memory-maintenance-tool.js +31 -0
- package/dist/src/agent/tools/session-search-tool.d.ts +1 -0
- package/dist/src/agent/tools/session-search-tool.js +7 -0
- package/dist/src/agent/tools/user-context-tool.d.ts +10 -0
- package/dist/src/agent/tools/user-context-tool.js +98 -0
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/automations/service/automation-service.d.ts +2 -1
- package/dist/src/automations/service/automation-service.js +6 -2
- package/dist/src/chat-commands/builtins/understanding.js +24 -6
- package/dist/src/cli/commands/connectors.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/schema.d.ts +68 -75
- package/dist/src/config/schema.js +29 -18
- package/dist/src/config/web-patch.d.ts +1 -1
- package/dist/src/connectors/auth-provider-registry.js +1 -1
- package/dist/src/connectors/composio-managed-client.js +6 -2
- package/dist/src/connectors/connected-source-ingestion.js +1 -1
- package/dist/src/connectors/connected-source-understanding.d.ts +1 -3
- package/dist/src/connectors/connected-source-understanding.js +86 -99
- package/dist/src/connectors/connection-candidates.d.ts +11 -0
- package/dist/src/connectors/connection-candidates.js +58 -0
- package/dist/src/connectors/connection-capabilities.d.ts +4 -0
- package/dist/src/connectors/connection-capabilities.js +37 -0
- package/dist/src/connectors/connection-recovery-service.d.ts +43 -0
- package/dist/src/connectors/connection-recovery-service.js +420 -0
- package/dist/src/connectors/health.js +1 -1
- package/dist/src/connectors/learning-coordinator.d.ts +0 -2
- package/dist/src/connectors/learning-coordinator.js +6 -7
- package/dist/src/connectors/principal.d.ts +5 -0
- package/dist/src/connectors/principal.js +18 -0
- package/dist/src/files/file-service.js +4 -1
- package/dist/src/gateway/agent-builtin-tools.d.ts +28 -10
- package/dist/src/gateway/agent-builtin-tools.js +30 -9
- package/dist/src/gateway/chat-stream/mapper.js +1 -28
- package/dist/src/gateway/chat-stream/protocol.d.ts +2 -24
- package/dist/src/gateway/clarify-bridge.d.ts +4 -0
- package/dist/src/gateway/clarify-bridge.js +9 -4
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +52 -30
- package/dist/src/gateway/hono/lib/config-payload.js +4 -4
- package/dist/src/gateway/hono/middleware/auth.js +1 -2
- package/dist/src/gateway/hono/routes/capabilities.js +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.d.ts +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +72 -28
- package/dist/src/gateway/hono/routes/connection-waits.d.ts +3 -0
- package/dist/src/gateway/hono/routes/connection-waits.js +58 -0
- package/dist/src/gateway/hono/routes/connectors.js +24 -18
- package/dist/src/gateway/hono/routes/context-sources.d.ts +4 -0
- package/dist/src/gateway/hono/routes/context-sources.js +159 -0
- package/dist/src/gateway/hono/routes/files.js +23 -2
- package/dist/src/gateway/hono/routes/index.js +4 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +9 -4
- package/dist/src/gateway/hono/routes/mcp.js +1 -1
- package/dist/src/gateway/hono/routes/notes.js +22 -7
- package/dist/src/gateway/hono/routes/projects.js +36 -44
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +15 -1
- package/dist/src/gateway/hono/routes/side-chats.js +13 -2
- package/dist/src/gateway/hono/routes/tasks.js +3 -3
- package/dist/src/gateway/hono/routes/user-model.d.ts +3 -0
- package/dist/src/gateway/hono/routes/user-model.js +480 -0
- package/dist/src/gateway/memory-maintenance-automation-reconciler.d.ts +11 -0
- package/dist/src/gateway/memory-maintenance-automation-reconciler.js +72 -0
- package/dist/src/gateway/security/gateway-scopes.js +2 -0
- package/dist/src/gateway/service/agent-runner.d.ts +9 -1
- package/dist/src/gateway/service/agent-runner.js +25 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +2 -2
- package/dist/src/gateway/service/config-coordinator.js +4 -4
- package/dist/src/gateway/service/run-gateway-agent.d.ts +1 -0
- package/dist/src/gateway/service/run-gateway-agent.js +18 -14
- package/dist/src/gateway/service/session-input-coordinator.d.ts +3 -0
- package/dist/src/gateway/service/session-input-coordinator.js +12 -2
- package/dist/src/gateway/service.d.ts +3 -1
- package/dist/src/gateway/service.js +52 -17
- package/dist/src/gateway/side-chat/manager.d.ts +16 -3
- package/dist/src/gateway/side-chat/manager.js +117 -28
- package/dist/src/gateway/side-chat/run-service.d.ts +2 -0
- package/dist/src/gateway/side-chat/run-service.js +28 -5
- package/dist/src/gateway/side-chat/types.d.ts +9 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/knowledge/connected-knowledge-pipeline.d.ts +0 -2
- package/dist/src/knowledge/connected-knowledge-pipeline.js +46 -217
- package/dist/src/knowledge-memory/domain.d.ts +36 -0
- package/dist/src/knowledge-memory/index.d.ts +2 -0
- package/dist/src/knowledge-memory/index.js +2 -0
- package/dist/src/knowledge-memory/repository.d.ts +48 -0
- package/dist/src/knowledge-memory/repository.js +168 -0
- package/dist/src/memory-maintenance/index.d.ts +2 -0
- package/dist/src/memory-maintenance/index.js +3 -0
- package/dist/src/memory-maintenance/schedule.d.ts +13 -0
- package/dist/src/memory-maintenance/schedule.js +51 -0
- package/dist/src/memory-maintenance/service.d.ts +28 -0
- package/dist/src/memory-maintenance/service.js +216 -0
- package/dist/src/notes/service.d.ts +1 -0
- package/dist/src/notes/service.js +7 -1
- package/dist/src/notes/types.d.ts +16 -0
- package/dist/src/notifications/planner.js +7 -3
- package/dist/src/proactive/actions/service.d.ts +0 -1
- package/dist/src/proactive/actions/service.js +1 -10
- package/dist/src/proactive/execution/context.d.ts +8 -10
- package/dist/src/proactive/execution/context.js +93 -42
- package/dist/src/proactive/execution/insight.d.ts +4 -1
- package/dist/src/proactive/execution/insight.js +5 -2
- package/dist/src/proactive/execution/repository.d.ts +1 -0
- package/dist/src/proactive/execution/repository.js +9 -1
- package/dist/src/proactive/execution/types.d.ts +0 -1
- package/dist/src/proactive/execution/worker.js +7 -5
- package/dist/src/proactive/inbox/repository.js +8 -2
- package/dist/src/proactive/inbox/service.js +2 -2
- package/dist/src/proactive/inbox/types.d.ts +1 -0
- package/dist/src/proactive/inbox/worker.d.ts +1 -0
- package/dist/src/proactive/inbox/worker.js +7 -0
- package/dist/src/proactive/index.d.ts +2 -1
- package/dist/src/proactive/index.js +3 -2
- package/dist/src/proactive/maintenance.d.ts +4 -0
- package/dist/src/proactive/maintenance.js +21 -0
- package/dist/src/proactive/scenarios/repository.d.ts +1 -1
- package/dist/src/proactive/scenarios/repository.js +10 -3
- package/dist/src/proactive/scenarios/types.d.ts +7 -0
- package/dist/src/proactive/service.d.ts +7 -0
- package/dist/src/proactive/service.js +17 -1
- package/dist/src/projects/index.d.ts +1 -1
- package/dist/src/projects/index.js +2 -2
- package/dist/src/projects/knowledge-bind.d.ts +1 -0
- package/dist/src/projects/knowledge-bind.js +15 -0
- package/dist/src/projects/project-loop.d.ts +3 -3
- package/dist/src/projects/project-loop.js +4 -4
- package/dist/src/projects/project-service.d.ts +2 -1
- package/dist/src/projects/project-service.js +3 -2
- package/dist/src/projects/project-store.js +2 -1
- package/dist/src/realtime/runtime.js +1 -0
- package/dist/src/runtime-tools/manager.js +1 -1
- package/dist/src/session/index.js +1 -1
- package/dist/src/session/store.js +5 -2
- package/dist/src/storage/sqlite/collaboration-rule-repository.d.ts +19 -0
- package/dist/src/storage/sqlite/collaboration-rule-repository.js +54 -0
- package/dist/src/storage/sqlite/config-repository.js +1 -1
- package/dist/src/storage/sqlite/connection-wait-repository.d.ts +30 -0
- package/dist/src/storage/sqlite/connection-wait-repository.js +338 -0
- package/dist/src/storage/sqlite/connector-account-repository.js +1 -1
- package/dist/src/storage/sqlite/context-evidence-repository.d.ts +24 -0
- package/dist/src/storage/sqlite/context-evidence-repository.js +52 -0
- package/dist/src/storage/sqlite/index.d.ts +3 -5
- package/dist/src/storage/sqlite/index.js +6 -8
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +0 -19
- package/dist/src/storage/sqlite/knowledge-repository.js +1 -90
- package/dist/src/storage/sqlite/migrations/148_user_model_foundation.sql +554 -0
- package/dist/src/storage/sqlite/migrations/149_separate_source_index_from_memory.sql +18 -0
- package/dist/src/storage/sqlite/migrations/150_session_connection_waits.sql +47 -0
- package/dist/src/storage/sqlite/migrations/151_proactive_scope_cleanup.sql +6 -0
- package/dist/src/storage/sqlite/migrations/152_proactive_scenario_contract.sql +140 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/notes-repository.d.ts +2 -1
- package/dist/src/storage/sqlite/notes-repository.js +37 -3
- package/dist/src/storage/sqlite/row-mappers.js +2 -2
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-input-repository.d.ts +14 -2
- package/dist/src/storage/sqlite/session-input-repository.js +17 -14
- package/dist/src/storage/sqlite/session-instance-repository.d.ts +2 -0
- package/dist/src/storage/sqlite/session-instance-repository.js +6 -0
- package/dist/src/storage/sqlite/session-repository.d.ts +1 -1
- package/dist/src/storage/sqlite/session-repository.js +7 -6
- package/dist/src/storage/sqlite/transcript-repository.js +3 -2
- package/dist/src/tasks/home-query-service.js +35 -13
- package/dist/src/tasks/index.js +2 -2
- package/dist/src/tasks/project-monitoring-service.d.ts +2 -0
- package/dist/src/tasks/project-monitoring-service.js +4 -1
- package/dist/src/tasks/project-operating-view-service.js +1 -1
- package/dist/src/tasks/task-application-service.js +6 -1
- package/dist/src/tasks/task-context-assembler.js +1 -1
- package/dist/src/tasks/task-context-repository.d.ts +0 -1
- package/dist/src/tasks/task-context-repository.js +1 -1
- package/dist/src/tasks/task-deletion-service.js +1 -1
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tasks/task-read-model-projector.js +1 -1
- package/dist/src/tasks/task-run-coordinator.js +1 -1
- package/dist/src/tasks/task-run-dispatcher.js +1 -1
- package/dist/src/tasks/task-run-repository.js +1 -0
- package/dist/src/tasks/task-signal-service.js +1 -1
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/tool-summary.js +2 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/user-context/access-policy.d.ts +11 -0
- package/dist/src/user-context/access-policy.js +26 -0
- package/dist/src/user-context/changes.d.ts +1 -1
- package/dist/src/user-context/config.d.ts +135 -153
- package/dist/src/user-context/config.js +94 -99
- package/dist/src/user-context/relationship-continuity.d.ts +2 -2
- package/dist/src/user-context/relationship-continuity.js +34 -24
- package/dist/src/user-context/sources/activity-clustering.d.ts +9 -3
- package/dist/src/user-context/sources/index.js +2 -2
- package/dist/src/user-context/sources/repository.d.ts +1 -21
- package/dist/src/user-context/sources/repository.js +1 -183
- package/dist/src/user-context/sources/types.d.ts +0 -23
- package/dist/src/user-model/capture/executor.d.ts +50 -0
- package/dist/src/user-model/capture/executor.js +230 -0
- package/dist/src/user-model/capture/index.d.ts +2 -0
- package/dist/src/user-model/capture/index.js +3 -0
- package/dist/src/user-model/capture/semantic.d.ts +39 -0
- package/dist/src/user-model/capture/semantic.js +263 -0
- package/dist/src/user-model/domain.d.ts +93 -0
- package/dist/src/user-model/domain.js +33 -0
- package/dist/src/user-model/goals.d.ts +62 -0
- package/dist/src/user-model/goals.js +91 -0
- package/dist/src/user-model/importance.d.ts +11 -0
- package/dist/src/user-model/importance.js +17 -0
- package/dist/src/user-model/index.d.ts +5 -0
- package/dist/src/user-model/index.js +6 -0
- package/dist/src/user-model/repository.d.ts +23 -0
- package/dist/src/user-model/repository.js +268 -0
- package/dist/src/user-model/temporal.d.ts +10 -0
- package/dist/src/user-model/temporal.js +44 -0
- package/dist/src/voice/realtime/memory-context.d.ts +7 -2
- package/dist/src/voice/realtime/memory-context.js +39 -51
- package/dist/src/work-discovery/service.d.ts +3 -14
- package/dist/src/work-discovery/service.js +138 -99
- package/dist/src/work-discovery/types.d.ts +3 -3
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/dist/src/workflows/service/workflow-session-bridge.js +12 -20
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CUXApfcE.js +0 -1
- package/dist/gateway/static/root/assets/agents-DNq_GKuc.js +0 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-qfwAgyhQ.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-DqQVUpCC.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-dwIqYmXk.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-SkdcSZ0i.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CKCa6TvG.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DSp--zIZ.js +0 -7
- package/dist/gateway/static/root/assets/channels-settings-CMd2dDrI.js +0 -1
- package/dist/gateway/static/root/assets/cloud-C4-yfnnk.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-udWs5Kdm.js +0 -2
- package/dist/gateway/static/root/assets/dependency-picker-DpN3XZg9.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-DinCToZh.js +0 -1
- package/dist/gateway/static/root/assets/ellipsis-0k4rZLoy.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-DcguCgsH.js +0 -1
- package/dist/gateway/static/root/assets/eye-CABVeTq0.js +0 -1
- package/dist/gateway/static/root/assets/eye-off-DEAzt3g1.js +0 -1
- package/dist/gateway/static/root/assets/files-D6vf3S30.js +0 -1
- package/dist/gateway/static/root/assets/folder-open-CyzJ19I9.js +0 -1
- package/dist/gateway/static/root/assets/form-field-width-DJw_jULe.js +0 -1
- package/dist/gateway/static/root/assets/gateway-config-api-Br7lSf6H.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-CdPoDMuj.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DHk1hawP.js +0 -1
- package/dist/gateway/static/root/assets/home-page-YGipe_W6.js +0 -1
- package/dist/gateway/static/root/assets/index-D5TQQpeb.js +0 -71
- package/dist/gateway/static/root/assets/index-DReBaaTX.css +0 -2
- package/dist/gateway/static/root/assets/interaction-BmQogeqz.js +0 -1
- package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +0 -1
- package/dist/gateway/static/root/assets/link-2-D_ZKYUW7.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CpyvYyrb.js +0 -2
- package/dist/gateway/static/root/assets/local-context-graph-BjUf7fQ9.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-CXKy6E_l.js +0 -2
- package/dist/gateway/static/root/assets/message-square-plus-XP0tGdlV.js +0 -1
- package/dist/gateway/static/root/assets/messages-CHNYp8EQ.js +0 -3
- package/dist/gateway/static/root/assets/minimize-2-DtOGrlpo.js +0 -1
- package/dist/gateway/static/root/assets/mobile-pairing-wizard-3NKCniSp.js +0 -1
- package/dist/gateway/static/root/assets/models-hub-cache-nCfkBN8M.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-DuqLahi6.js +0 -1
- package/dist/gateway/static/root/assets/notes-workbench-C7j9EdQk.js +0 -5
- package/dist/gateway/static/root/assets/oauth-api-8lP_qJpq.js +0 -1
- package/dist/gateway/static/root/assets/oauth-authorization-window-Cdolr2wE.js +0 -1
- package/dist/gateway/static/root/assets/page-tabs-BaEQMYm_.js +0 -1
- package/dist/gateway/static/root/assets/pencil-DmIY3Oa-.js +0 -1
- package/dist/gateway/static/root/assets/preview-open-alternatives-CsNVTKC0.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-CfebYVX0.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-48GvzSVa.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-64xj_s2m.js +0 -1
- package/dist/gateway/static/root/assets/rotate-cw-LIg3Am9S.js +0 -1
- package/dist/gateway/static/root/assets/search-DA7gz22f.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CcwcdRN8.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BaN84CyW.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-DjWzRk4z.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-DVVOCNbr.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DUYbYLi7.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BGyD0gB9.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-CjF8DTsN.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-BSYuRgFI.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-YZYSTJH7.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-FKUi9wDL.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-BCyiduKd.js +0 -2
- package/dist/gateway/static/root/assets/work-discovery-overlay-jhT2EzeH.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-DQC0TpMa.js +0 -5
- package/dist/src/agent/memory/builtin-provider.d.ts +0 -37
- package/dist/src/agent/memory/builtin-provider.js +0 -225
- package/dist/src/agent/memory/context/types.d.ts +0 -40
- package/dist/src/agent/memory/understanding/quality.d.ts +0 -8
- package/dist/src/agent/memory/understanding/quality.js +0 -18
- package/dist/src/agent/memory/understanding/service.d.ts +0 -19
- package/dist/src/agent/memory/understanding/service.js +0 -209
- package/dist/src/agent/memory/understanding/types.d.ts +0 -34
- package/dist/src/agent/memory/user-context-coordinator.d.ts +0 -23
- package/dist/src/agent/memory/user-context-coordinator.js +0 -113
- package/dist/src/agent/tools/dreaming-tool.js +0 -37
- package/dist/src/agent/tools/memory-tool.d.ts +0 -9
- package/dist/src/agent/tools/memory-tool.js +0 -119
- package/dist/src/gateway/dreaming-automation-reconciler.d.ts +0 -11
- package/dist/src/gateway/dreaming-automation-reconciler.js +0 -63
- package/dist/src/gateway/hono/routes/understanding-sources.d.ts +0 -21
- package/dist/src/gateway/hono/routes/understanding-sources.js +0 -387
- package/dist/src/gateway/hono/routes/you.d.ts +0 -3
- package/dist/src/gateway/hono/routes/you.js +0 -457
- package/dist/src/projects/memory-bind.d.ts +0 -1
- package/dist/src/projects/memory-bind.js +0 -14
- package/dist/src/storage/sqlite/context-consolidation-repository.d.ts +0 -37
- package/dist/src/storage/sqlite/context-consolidation-repository.js +0 -64
- package/dist/src/storage/sqlite/memory-records-repository.d.ts +0 -217
- package/dist/src/storage/sqlite/memory-records-repository.js +0 -715
- package/dist/src/storage/sqlite/remote-context-repository.d.ts +0 -3
- package/dist/src/storage/sqlite/remote-context-repository.js +0 -40
- package/dist/src/storage/sqlite/understanding-focus-exclusions.d.ts +0 -2
- package/dist/src/storage/sqlite/understanding-focus-exclusions.js +0 -24
- package/dist/src/storage/sqlite/user-context-quality-repository.d.ts +0 -49
- package/dist/src/storage/sqlite/user-context-quality-repository.js +0 -118
- package/dist/src/storage/sqlite/user-context-repository.d.ts +0 -85
- package/dist/src/storage/sqlite/user-context-repository.js +0 -535
- package/dist/src/user-context/automatic-context.d.ts +0 -17
- package/dist/src/user-context/automatic-context.js +0 -85
- package/dist/src/user-context/consolidation.d.ts +0 -27
- package/dist/src/user-context/consolidation.js +0 -187
- package/dist/src/user-context/context-objects.d.ts +0 -17
- package/dist/src/user-context/context-objects.js +0 -99
- package/dist/src/user-context/evaluation/harness.d.ts +0 -13
- package/dist/src/user-context/evaluation/harness.js +0 -31
- package/dist/src/user-context/extraction/executor.d.ts +0 -22
- package/dist/src/user-context/extraction/executor.js +0 -142
- package/dist/src/user-context/extraction/repair.d.ts +0 -19
- package/dist/src/user-context/extraction/repair.js +0 -71
- package/dist/src/user-context/extraction/semantic.d.ts +0 -18
- package/dist/src/user-context/extraction/semantic.js +0 -148
- package/dist/src/user-context/focus-lifecycle.d.ts +0 -2
- package/dist/src/user-context/focus-lifecycle.js +0 -26
- package/dist/src/user-context/manual-understanding.d.ts +0 -12
- package/dist/src/user-context/manual-understanding.js +0 -37
- package/dist/src/user-context/planner.d.ts +0 -17
- package/dist/src/user-context/planner.js +0 -465
- package/dist/src/user-context/relationships/indexer.d.ts +0 -13
- package/dist/src/user-context/relationships/indexer.js +0 -185
- package/dist/src/user-context/relationships/service.d.ts +0 -22
- package/dist/src/user-context/relationships/service.js +0 -50
- package/dist/src/user-context/retriever.d.ts +0 -15
- package/dist/src/user-context/retriever.js +0 -124
- package/dist/src/user-context/scope.d.ts +0 -7
- package/dist/src/user-context/scope.js +0 -9
- package/dist/src/user-context/selection-policy.d.ts +0 -20
- package/dist/src/user-context/selection-policy.js +0 -33
- package/dist/src/user-context/understanding.d.ts +0 -15
- package/dist/src/user-context/understanding.js +0 -24
- package/dist/src/user-context/understandingQuality.d.ts +0 -5
- package/dist/src/user-context/understandingQuality.js +0 -48
- /package/dist/src/agent/{memory/context/types.js → context/execution-context.types.js} +0 -0
- /package/dist/src/{agent/memory/understanding/types.js → knowledge-memory/domain.js} +0 -0
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
import { createLogger } from "../utils/logger/index.js";
|
|
2
|
+
import { init_logger } from "../utils/logger.js";
|
|
3
|
+
import { getSqliteDatabase } from "../storage/sqlite/transaction.js";
|
|
4
|
+
import { readCurrentSessionId } from "../storage/sqlite/session-instance-repository.js";
|
|
5
|
+
import { getSessionInputState } from "../storage/sqlite/session-input-repository.js";
|
|
6
|
+
import { cancelConnectionObjective, getActiveConnectionWait, getConnectionWait, listConnectionWaitsToCheck, publishConnectionWait, queueConnectionResolution, updateConnectionWait } from "../storage/sqlite/connection-wait-repository.js";
|
|
7
|
+
import "../storage/sqlite/session-repository.js";
|
|
8
|
+
import { getConnectorInstallation, listConnectorConnections, upsertConnectorInstallation } from "../storage/sqlite/connector-repository.js";
|
|
9
|
+
import { getConnectorAccount } from "../storage/sqlite/connector-account-repository.js";
|
|
10
|
+
import { ComposioSessionsAdapter } from "./composio-sessions.js";
|
|
11
|
+
import { getConfiguredComposioAuthConfigs, isComposioActionAllowedByCatalog, scopeForComposioAction } from "./composio.js";
|
|
12
|
+
import { getConnectorDefinition } from "./catalog.js";
|
|
13
|
+
import { capabilityActions, isToolInputSchema, missingConnectionCapabilities } from "./connection-capabilities.js";
|
|
14
|
+
import { connectorPrincipalForSession } from "./principal.js";
|
|
15
|
+
import { resolveConnectionCandidate } from "./connection-candidates.js";
|
|
16
|
+
import { listConnectorInstances } from "./instances.js";
|
|
17
|
+
import { installConnector } from "./install.js";
|
|
18
|
+
import { persistConfigMutation } from "../config/config-mutation.js";
|
|
19
|
+
import { randomUUID } from "node:crypto";
|
|
20
|
+
//#region src/connectors/connection-recovery-service.ts
|
|
21
|
+
init_logger();
|
|
22
|
+
const log = createLogger("Connectors:Recovery");
|
|
23
|
+
const SCOPE_ORDER = {
|
|
24
|
+
read: 1,
|
|
25
|
+
write: 2,
|
|
26
|
+
admin: 3
|
|
27
|
+
};
|
|
28
|
+
const INTENT_TTL = 30 * 6e4;
|
|
29
|
+
const ATTEMPT_TTL = 10 * 6e4;
|
|
30
|
+
/** Authorization lives at click time. Chat history contains only immutable explanations. */
|
|
31
|
+
var ConnectionRecoveryService = class {
|
|
32
|
+
busy = /* @__PURE__ */ new Set();
|
|
33
|
+
timer;
|
|
34
|
+
polling = false;
|
|
35
|
+
start() {
|
|
36
|
+
if (this.timer) return;
|
|
37
|
+
this.timer = setInterval(() => {
|
|
38
|
+
this.poll();
|
|
39
|
+
}, 5e3);
|
|
40
|
+
this.timer.unref();
|
|
41
|
+
this.poll();
|
|
42
|
+
}
|
|
43
|
+
stop() {
|
|
44
|
+
clearInterval(this.timer);
|
|
45
|
+
this.timer = void 0;
|
|
46
|
+
}
|
|
47
|
+
async poll() {
|
|
48
|
+
if (this.polling) return;
|
|
49
|
+
this.polling = true;
|
|
50
|
+
try {
|
|
51
|
+
for (const wait of listConnectionWaitsToCheck()) {
|
|
52
|
+
if (this.busy.has(wait.sessionKey)) continue;
|
|
53
|
+
await this.act(wait.sessionKey, {
|
|
54
|
+
waitId: wait.id,
|
|
55
|
+
expectedSessionId: wait.sessionId,
|
|
56
|
+
expectedVersion: wait.version,
|
|
57
|
+
idempotencyKey: randomUUID(),
|
|
58
|
+
action: "check"
|
|
59
|
+
}).catch(() => {});
|
|
60
|
+
}
|
|
61
|
+
} finally {
|
|
62
|
+
this.polling = false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
constructor(deps) {
|
|
66
|
+
this.deps = deps;
|
|
67
|
+
}
|
|
68
|
+
get adapter() {
|
|
69
|
+
return this.deps.adapter ?? new ComposioSessionsAdapter();
|
|
70
|
+
}
|
|
71
|
+
snapshot(sessionKey) {
|
|
72
|
+
if (!connectorPrincipalForSession(sessionKey).isLocalOwner) throw new Error("This connection belongs to another principal.");
|
|
73
|
+
const sessionId = readCurrentSessionId(getSqliteDatabase(), sessionKey);
|
|
74
|
+
if (!sessionId) throw new Error("SESSION_CHANGED");
|
|
75
|
+
const wait = getActiveConnectionWait(sessionKey);
|
|
76
|
+
return {
|
|
77
|
+
sessionId,
|
|
78
|
+
revision: getSessionInputState(sessionKey).revision,
|
|
79
|
+
wait: wait ? this.view(wait) : null
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
view(wait, verifiedIds) {
|
|
83
|
+
const needs = wait.needs.map((need) => {
|
|
84
|
+
const instance = listConnectorInstances(this.deps.getConfig()).find((instance) => instance.connectorId === need.connectorId);
|
|
85
|
+
const installation = getConnectorInstallation(`${need.connectorId}-${wait.principalId}`);
|
|
86
|
+
const scopeBlocked = Math.max(1, ...need.capabilities.filter((capability) => /^[A-Z]+_/.test(capability)).map((capability) => SCOPE_ORDER[scopeForComposioAction(capability).scope])) > SCOPE_ORDER[installation?.maxScope ?? "read"];
|
|
87
|
+
const blocked = scopeBlocked || instance?.enabled === false || installation?.enabled === false || Boolean(installation?.allowedAgentIds.length && !installation.allowedAgentIds.includes(wait.agentId));
|
|
88
|
+
const all = listConnectorConnections({
|
|
89
|
+
principalId: wait.principalId,
|
|
90
|
+
connectorId: need.connectorId
|
|
91
|
+
});
|
|
92
|
+
const eligible = all.filter((connection) => connection.status === "active" && (!verifiedIds || verifiedIds.has(connection.id)) && (!need.accountId || connection.accountId === need.accountId) && (!installation?.selectedConnectionIds.length || installation.selectedConnectionIds.includes(connection.id)));
|
|
93
|
+
const byAccount = /* @__PURE__ */ new Map();
|
|
94
|
+
for (const connection of eligible) {
|
|
95
|
+
const key = connection.accountId ?? connection.id;
|
|
96
|
+
const previous = byAccount.get(key);
|
|
97
|
+
const preferredId = need.connectionId ?? eligible.find((item) => item.providerConnectionId === need.attempt?.connectionId)?.id ?? (connection.accountId ? getConnectorAccount(connection.accountId)?.currentConnectionId : void 0);
|
|
98
|
+
if (!previous || connection.id === preferredId || previous.id !== preferredId && connection.updatedAt > previous.updatedAt) byAccount.set(key, connection);
|
|
99
|
+
}
|
|
100
|
+
const active = [...byAccount.values()];
|
|
101
|
+
const selected = !verifiedIds && need.unavailable ? void 0 : need.attempt ? active.find((connection) => connection.providerConnectionId === need.attempt?.connectionId) : need.connectionId ? active.find((connection) => connection.id === need.connectionId) : active.length === 1 && !need.accountSelector ? active[0] : void 0;
|
|
102
|
+
const phase = blocked || selected && need.capabilityError ? "blocked" : selected ? "ready" : active.length > 1 || need.accountSelector && active.length > 0 && !need.connectionId ? "choose_account" : need.attempt && need.attempt.expiresAt > Date.now() ? "authorizing" : need.unavailable || all.some((connection) => [
|
|
103
|
+
"expired",
|
|
104
|
+
"revoked",
|
|
105
|
+
"failed"
|
|
106
|
+
].includes(connection.status)) ? "reconnect" : "connect";
|
|
107
|
+
const alternatives = ["composio-gmail", "composio-outlook"].includes(need.connectorId) ? ["composio-gmail", "composio-outlook"].filter((id) => id !== need.connectorId).map((id) => ({
|
|
108
|
+
candidateRef: id,
|
|
109
|
+
label: getConnectorDefinition(id)?.displayName ?? id
|
|
110
|
+
})) : [];
|
|
111
|
+
return {
|
|
112
|
+
...need,
|
|
113
|
+
alternatives,
|
|
114
|
+
connectionId: selected?.id ?? need.connectionId,
|
|
115
|
+
phase,
|
|
116
|
+
accounts: active.map((connection) => ({
|
|
117
|
+
id: connection.id,
|
|
118
|
+
label: connection.alias ?? String(connection.identity.email ?? connection.identity.name ?? connection.id)
|
|
119
|
+
})),
|
|
120
|
+
...need.capabilityError && selected ? { reason: need.capabilityError } : {},
|
|
121
|
+
...blocked ? { reason: scopeBlocked ? "This action needs broader permissions. Review connector permissions in settings." : "This app is disabled or unavailable to the current agent. Review connector settings." } : {}
|
|
122
|
+
};
|
|
123
|
+
});
|
|
124
|
+
const ready = needs.every((need) => need.phase === "ready");
|
|
125
|
+
const review = wait.reviewRequired || Date.now() - wait.createdAt > INTENT_TTL && !wait.scopeConfirmedAt;
|
|
126
|
+
const { intent: _intent, checkpoint: _checkpoint, ...visible } = wait;
|
|
127
|
+
return {
|
|
128
|
+
...visible,
|
|
129
|
+
needs,
|
|
130
|
+
timeRange: wait.checkpoint.timeRange,
|
|
131
|
+
phase: wait.status === "queued" ? "queued" : ready ? review ? "review_scope" : "ready" : "needs_connection"
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
async ensureInstallation(wait, connectorId) {
|
|
135
|
+
const config = this.deps.getConfig();
|
|
136
|
+
const instance = listConnectorInstances(config).find((item) => item.connectorId === connectorId);
|
|
137
|
+
const installationId = `${connectorId}-${wait.principalId}`;
|
|
138
|
+
const installation = getConnectorInstallation(installationId);
|
|
139
|
+
if (instance?.enabled === false || installation?.enabled === false || installation?.allowedAgentIds.length && !installation.allowedAgentIds.includes(wait.agentId)) throw new Error("Connector policy blocks this connection.");
|
|
140
|
+
if (!instance) await persistConfigMutation({
|
|
141
|
+
config,
|
|
142
|
+
mutate: () => installConnector(config, connectorId, {}),
|
|
143
|
+
save: () => this.deps.saveConfig(config)
|
|
144
|
+
});
|
|
145
|
+
if (!installation) upsertConnectorInstallation({
|
|
146
|
+
id: installationId,
|
|
147
|
+
connectorId,
|
|
148
|
+
principalId: wait.principalId,
|
|
149
|
+
enabled: true,
|
|
150
|
+
allowedAgentIds: [],
|
|
151
|
+
maxScope: "read",
|
|
152
|
+
confirmationPolicy: "writes",
|
|
153
|
+
selectedConnectionIds: []
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
async checkCapabilities(wait, verified) {
|
|
157
|
+
const views = this.view({
|
|
158
|
+
...wait,
|
|
159
|
+
needs: wait.needs.map((need) => ({
|
|
160
|
+
...need,
|
|
161
|
+
capabilityError: void 0
|
|
162
|
+
}))
|
|
163
|
+
}, verified).needs;
|
|
164
|
+
return Promise.all(wait.needs.map(async (need) => {
|
|
165
|
+
if (views.find((view) => view.key === need.key)?.phase !== "ready") return {
|
|
166
|
+
...need,
|
|
167
|
+
capabilityError: void 0
|
|
168
|
+
};
|
|
169
|
+
try {
|
|
170
|
+
if (!listConnectorInstances(this.deps.getConfig()).some((instance) => instance.connectorId === need.connectorId && instance.enabled)) throw new Error("Connector setup is unavailable");
|
|
171
|
+
const definition = getConnectorDefinition(need.connectorId);
|
|
172
|
+
if (definition?.runtime.type !== "composio" || definition.runtime.role !== "toolkit") throw new Error("Unsupported connector");
|
|
173
|
+
const toolkit = definition.runtime.toolkit;
|
|
174
|
+
const result = await (await this.adapter.createSession({
|
|
175
|
+
principalId: wait.principalId,
|
|
176
|
+
toolkits: [toolkit],
|
|
177
|
+
authConfigs: getConfiguredComposioAuthConfigs(this.deps.getConfig(), [toolkit])
|
|
178
|
+
})).search({
|
|
179
|
+
query: `${toolkit} ${need.capabilities.join(" ")} ${capabilityActions(need).flat().join(" ")}`,
|
|
180
|
+
toolkits: [toolkit]
|
|
181
|
+
});
|
|
182
|
+
const schemas = result && typeof result === "object" ? result.toolSchemas : void 0;
|
|
183
|
+
const missing = missingConnectionCapabilities(need, new Set(Object.entries(schemas && typeof schemas === "object" ? schemas : {}).filter(([action, value]) => value && typeof value === "object" && isToolInputSchema(value.inputSchema) && isComposioActionAllowedByCatalog(action)).map(([action]) => action)));
|
|
184
|
+
if (missing.length) log.warn({
|
|
185
|
+
sessionKey: wait.sessionKey,
|
|
186
|
+
connectorId: need.connectorId,
|
|
187
|
+
missingCapabilities: missing
|
|
188
|
+
}, "Connected app lacks required tool contracts");
|
|
189
|
+
return {
|
|
190
|
+
...need,
|
|
191
|
+
capabilityError: missing.length ? `${need.label} is connected, but the required tools are unavailable. Retry the tool check; reconnecting will not fix this.` : void 0
|
|
192
|
+
};
|
|
193
|
+
} catch (err) {
|
|
194
|
+
log.warn({
|
|
195
|
+
err,
|
|
196
|
+
sessionKey: wait.sessionKey,
|
|
197
|
+
connectorId: need.connectorId
|
|
198
|
+
}, "Connected app capability check failed");
|
|
199
|
+
return {
|
|
200
|
+
...need,
|
|
201
|
+
capabilityError: `${need.label} is connected, but its tools could not be checked. Retry the tool check.`
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
}));
|
|
205
|
+
}
|
|
206
|
+
async preflight(input) {
|
|
207
|
+
if (input.kind !== "connection_resume") return true;
|
|
208
|
+
const wait = input.payload ? getConnectionWait(input.payload.waitId) : void 0;
|
|
209
|
+
if (!wait || wait.status !== "queued" || wait.queuedInputId !== input.id || wait.sessionId !== readCurrentSessionId(getSqliteDatabase(), input.sessionKey)) return false;
|
|
210
|
+
if (wait.resolution === "skipped") return true;
|
|
211
|
+
try {
|
|
212
|
+
const fresh = await this.adapter.syncConnections({ principalId: wait.principalId });
|
|
213
|
+
const verified = new Set(fresh.filter((item) => item.status === "active").map((item) => item.id));
|
|
214
|
+
wait.needs = await this.checkCapabilities(wait, verified);
|
|
215
|
+
const ready = this.view(wait, verified).needs.every((need) => need.phase === "ready");
|
|
216
|
+
wait.needs = wait.needs.map((need) => ({
|
|
217
|
+
...need,
|
|
218
|
+
unavailable: !fresh.some((item) => item.id === need.connectionId && item.status === "active")
|
|
219
|
+
}));
|
|
220
|
+
if (getConnectionWait(wait.id)?.version !== wait.version) return false;
|
|
221
|
+
if (ready && wait.intent && wait.intent.validUntil > Date.now() && wait.intent.objectiveRevision === wait.objectiveRevision) return true;
|
|
222
|
+
} catch {}
|
|
223
|
+
if (getConnectionWait(wait.id)?.version === wait.version) {
|
|
224
|
+
updateConnectionWait({
|
|
225
|
+
...wait,
|
|
226
|
+
status: "open",
|
|
227
|
+
intent: void 0,
|
|
228
|
+
queuedInputId: void 0,
|
|
229
|
+
objectiveRevision: wait.objectiveRevision + 1
|
|
230
|
+
}, wait.version);
|
|
231
|
+
publishConnectionWait(input.sessionKey);
|
|
232
|
+
}
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
235
|
+
async act(sessionKey, action) {
|
|
236
|
+
const ownsLock = !this.busy.has(sessionKey);
|
|
237
|
+
if (!ownsLock && ![
|
|
238
|
+
"cancel",
|
|
239
|
+
"skip",
|
|
240
|
+
"replace_source"
|
|
241
|
+
].includes(action.action)) throw new Error("WAIT_CHANGED");
|
|
242
|
+
if (ownsLock) this.busy.add(sessionKey);
|
|
243
|
+
try {
|
|
244
|
+
const snapshot = this.snapshot(sessionKey);
|
|
245
|
+
let wait = getConnectionWait(action.waitId);
|
|
246
|
+
if (!wait || wait.sessionKey !== sessionKey || wait.principalId !== "local-owner" || wait.sessionId !== action.expectedSessionId || snapshot.sessionId !== action.expectedSessionId) throw new Error("SESSION_CHANGED");
|
|
247
|
+
if (wait.lastAction?.key === action.idempotencyKey && wait.lastAction.action === action.action) return { snapshot };
|
|
248
|
+
if (wait.status !== "open" || wait.version !== action.expectedVersion) throw new Error("WAIT_CHANGED");
|
|
249
|
+
wait = {
|
|
250
|
+
...wait,
|
|
251
|
+
lastAction: {
|
|
252
|
+
key: action.idempotencyKey,
|
|
253
|
+
action: action.action
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
if (action.action === "cancel") cancelConnectionObjective(sessionKey);
|
|
257
|
+
else if (action.action === "replace_source") {
|
|
258
|
+
const need = wait.needs.find((need) => need.key === action.needKey);
|
|
259
|
+
if (!need || !this.view(wait).needs.find((item) => item.key === need.key)?.alternatives?.some((item) => item.candidateRef === action.candidateRef)) throw new Error("Unsupported replacement.");
|
|
260
|
+
const replacement = resolveConnectionCandidate(action.candidateRef);
|
|
261
|
+
updateConnectionWait({
|
|
262
|
+
...wait,
|
|
263
|
+
summary: `${wait.summary}\nUse ${replacement.label} instead of ${need.label}, as confirmed by the user.`,
|
|
264
|
+
needs: wait.needs.map((item) => item.key === need.key ? replacement : item),
|
|
265
|
+
objectiveRevision: wait.objectiveRevision + 1,
|
|
266
|
+
intent: void 0
|
|
267
|
+
}, wait.version);
|
|
268
|
+
} else if (action.action === "skip") {
|
|
269
|
+
queueConnectionResolution({
|
|
270
|
+
...wait,
|
|
271
|
+
intent: void 0
|
|
272
|
+
}, "skipped");
|
|
273
|
+
this.deps.drain(sessionKey);
|
|
274
|
+
} else if (action.action === "connect") {
|
|
275
|
+
const need = wait.needs.find((need) => need.key === action.needKey);
|
|
276
|
+
if (!need) throw new Error("Unknown connection requirement.");
|
|
277
|
+
if (this.view(wait).needs.find((item) => item.key === need.key)?.phase === "blocked") throw new Error("Connector policy blocks this connection.");
|
|
278
|
+
const definition = getConnectorDefinition(need.connectorId);
|
|
279
|
+
if (definition?.runtime.type !== "composio" || definition.runtime.role !== "toolkit") throw new Error("Unsupported connector.");
|
|
280
|
+
const attemptId = randomUUID();
|
|
281
|
+
wait = updateConnectionWait({
|
|
282
|
+
...wait,
|
|
283
|
+
intent: {
|
|
284
|
+
objectiveRevision: wait.objectiveRevision,
|
|
285
|
+
validUntil: Date.now() + INTENT_TTL
|
|
286
|
+
},
|
|
287
|
+
needs: wait.needs.map((item) => item.key === need.key ? {
|
|
288
|
+
...item,
|
|
289
|
+
attempt: {
|
|
290
|
+
id: attemptId,
|
|
291
|
+
expiresAt: Date.now() + ATTEMPT_TTL
|
|
292
|
+
}
|
|
293
|
+
} : item)
|
|
294
|
+
}, wait.version);
|
|
295
|
+
publishConnectionWait(sessionKey);
|
|
296
|
+
const config = this.deps.getConfig();
|
|
297
|
+
await this.ensureInstallation(wait, need.connectorId);
|
|
298
|
+
const installationId = `${need.connectorId}-${wait.principalId}`;
|
|
299
|
+
const auth = await this.adapter.authorize({
|
|
300
|
+
principalId: wait.principalId,
|
|
301
|
+
toolkit: definition.runtime.toolkit,
|
|
302
|
+
installationId,
|
|
303
|
+
authConfigId: getConfiguredComposioAuthConfigs(config, [definition.runtime.toolkit])?.[definition.runtime.toolkit]
|
|
304
|
+
});
|
|
305
|
+
const latest = getConnectionWait(wait.id);
|
|
306
|
+
if (!latest || latest.version !== wait.version || latest.status !== "open") throw new Error("WAIT_CHANGED");
|
|
307
|
+
updateConnectionWait({
|
|
308
|
+
...wait,
|
|
309
|
+
needs: wait.needs.map((item) => item.key === need.key ? {
|
|
310
|
+
...item,
|
|
311
|
+
attempt: {
|
|
312
|
+
id: attemptId,
|
|
313
|
+
connectionId: auth.connectionId,
|
|
314
|
+
expiresAt: Date.now() + ATTEMPT_TTL
|
|
315
|
+
}
|
|
316
|
+
} : item)
|
|
317
|
+
}, wait.version);
|
|
318
|
+
publishConnectionWait(sessionKey);
|
|
319
|
+
log.info({
|
|
320
|
+
sessionKey,
|
|
321
|
+
waitId: wait.id,
|
|
322
|
+
objectiveRevision: wait.objectiveRevision,
|
|
323
|
+
phase: "authorization_started"
|
|
324
|
+
}, "Connection authorization started");
|
|
325
|
+
return {
|
|
326
|
+
snapshot: this.snapshot(sessionKey),
|
|
327
|
+
authorizationUrl: auth.connectUrl
|
|
328
|
+
};
|
|
329
|
+
} else {
|
|
330
|
+
const fresh = await this.adapter.syncConnections({ principalId: wait.principalId });
|
|
331
|
+
const verified = new Set(fresh.filter((item) => item.status === "active").map((item) => item.id));
|
|
332
|
+
const latest = getConnectionWait(wait.id);
|
|
333
|
+
if (!latest || latest.version !== wait.version || latest.status !== "open") throw new Error("WAIT_CHANGED");
|
|
334
|
+
let needs = wait.needs.map((need) => {
|
|
335
|
+
const authorized = fresh.find((item) => item.providerConnectionId === need.attempt?.connectionId && item.status === "active");
|
|
336
|
+
return authorized ? {
|
|
337
|
+
...need,
|
|
338
|
+
unavailable: false,
|
|
339
|
+
...need.accountSelector && !need.accountId ? {} : {
|
|
340
|
+
connectionId: authorized.id,
|
|
341
|
+
accountId: authorized.accountId
|
|
342
|
+
},
|
|
343
|
+
attempt: void 0
|
|
344
|
+
} : {
|
|
345
|
+
...need,
|
|
346
|
+
unavailable: !fresh.some((item) => item.connectorId === need.connectorId && item.status === "active" && (!need.connectionId || item.id === need.connectionId) && (!need.accountId || item.accountId === need.accountId))
|
|
347
|
+
};
|
|
348
|
+
});
|
|
349
|
+
if (action.action === "select_account") {
|
|
350
|
+
const need = needs.find((item) => item.key === action.needKey);
|
|
351
|
+
const connection = fresh.find((item) => item.id === action.accountId && item.connectorId === need?.connectorId && item.status === "active");
|
|
352
|
+
if (!need || !connection || !this.view(wait, verified).needs.find((item) => item.key === need.key)?.accounts.some((item) => item.id === connection.id)) throw new Error("Account is unavailable.");
|
|
353
|
+
needs = needs.map((item) => item.key === need.key ? {
|
|
354
|
+
...item,
|
|
355
|
+
connectionId: connection.id,
|
|
356
|
+
accountId: connection.accountId,
|
|
357
|
+
unavailable: false,
|
|
358
|
+
attempt: void 0
|
|
359
|
+
} : item);
|
|
360
|
+
}
|
|
361
|
+
for (const selected of this.view({
|
|
362
|
+
...wait,
|
|
363
|
+
needs
|
|
364
|
+
}, verified).needs) if (selected.phase === "ready" || selected.capabilityError && selected.connectionId) await this.ensureInstallation(wait, selected.connectorId);
|
|
365
|
+
needs = await this.checkCapabilities({
|
|
366
|
+
...wait,
|
|
367
|
+
needs
|
|
368
|
+
}, verified);
|
|
369
|
+
if (getConnectionWait(wait.id)?.version !== wait.version) throw new Error("WAIT_CHANGED");
|
|
370
|
+
const explicitContinue = action.action === "continue" || action.action === "confirm_scope";
|
|
371
|
+
wait = updateConnectionWait({
|
|
372
|
+
...wait,
|
|
373
|
+
needs,
|
|
374
|
+
...action.action === "confirm_scope" ? {
|
|
375
|
+
scopeConfirmedAt: Date.now(),
|
|
376
|
+
reviewRequired: false
|
|
377
|
+
} : {},
|
|
378
|
+
...needs.some((need) => need.capabilityError) ? { intent: void 0 } : explicitContinue ? { intent: {
|
|
379
|
+
objectiveRevision: wait.objectiveRevision,
|
|
380
|
+
validUntil: Date.now() + INTENT_TTL
|
|
381
|
+
} } : {}
|
|
382
|
+
}, wait.version);
|
|
383
|
+
const view = this.view(wait, verified);
|
|
384
|
+
if (view.phase === "ready" && wait.intent?.objectiveRevision === wait.objectiveRevision && wait.intent.validUntil > Date.now()) {
|
|
385
|
+
wait = queueConnectionResolution({
|
|
386
|
+
...wait,
|
|
387
|
+
needs: view.needs.map(({ phase: _phase, accounts: _accounts, reason: _reason, alternatives: _alternatives, ...need }) => need)
|
|
388
|
+
}, "continued");
|
|
389
|
+
log.info({
|
|
390
|
+
sessionKey,
|
|
391
|
+
waitId: wait.id,
|
|
392
|
+
objectiveRevision: wait.objectiveRevision,
|
|
393
|
+
phase: "resume_queued"
|
|
394
|
+
}, "Connection continuation queued");
|
|
395
|
+
this.deps.drain(sessionKey);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
publishConnectionWait(sessionKey);
|
|
399
|
+
return { snapshot: this.snapshot(sessionKey) };
|
|
400
|
+
} catch (error) {
|
|
401
|
+
const wait = getActiveConnectionWait(sessionKey);
|
|
402
|
+
if (action.action === "connect" && wait?.status === "open" && wait.lastAction?.key === action.idempotencyKey) {
|
|
403
|
+
updateConnectionWait({
|
|
404
|
+
...wait,
|
|
405
|
+
intent: void 0,
|
|
406
|
+
needs: wait.needs.map((need) => need.key === action.needKey ? {
|
|
407
|
+
...need,
|
|
408
|
+
attempt: void 0
|
|
409
|
+
} : need)
|
|
410
|
+
}, wait.version);
|
|
411
|
+
publishConnectionWait(sessionKey);
|
|
412
|
+
}
|
|
413
|
+
throw error;
|
|
414
|
+
} finally {
|
|
415
|
+
if (ownsLock) this.busy.delete(sessionKey);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
};
|
|
419
|
+
//#endregion
|
|
420
|
+
export { ConnectionRecoveryService };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
2
1
|
import { materializeConnectorMcpServer } from "./materialize.js";
|
|
3
2
|
import { getConnectorInstance } from "./instances.js";
|
|
3
|
+
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
4
4
|
import { listBundleMcpServerCapabilitiesForGateway } from "../agent/mcp/bundle-mcp-gateway.js";
|
|
5
5
|
//#region src/connectors/health.ts
|
|
6
6
|
function classifyConnectorHealthError(error) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Config } from '../config/schema.js';
|
|
2
|
-
import type { MemoryManager } from '../agent/memory/manager.js';
|
|
3
2
|
import { type ConnectorLearningJob } from '../storage/sqlite/index.js';
|
|
4
3
|
import { ComposioSessionsAdapter } from './composio-sessions.js';
|
|
5
4
|
export type ConnectorLearningCoordinator = {
|
|
@@ -17,7 +16,6 @@ export type ConnectorLearningCoordinator = {
|
|
|
17
16
|
export declare function startConnectorLearningCoordinator(options: {
|
|
18
17
|
getConfig: () => Config;
|
|
19
18
|
resolveAgentId: () => string;
|
|
20
|
-
getMemoryManager: () => MemoryManager;
|
|
21
19
|
emit?: (type: string, payload: unknown) => void;
|
|
22
20
|
intervalMs?: number;
|
|
23
21
|
initialDelayMs?: number;
|
|
@@ -9,13 +9,13 @@ import { connectorIdentityKey, normalizeConnectorIdentity } from "./connector-id
|
|
|
9
9
|
import { ComposioSessionsAdapter } from "./composio-sessions.js";
|
|
10
10
|
import { buildConnectorLearningArguments, getConnectorLearningPlan } from "./learning-recipes.js";
|
|
11
11
|
import { getConnectorDefinition } from "./catalog.js";
|
|
12
|
-
import { createUnderstandingSourceRun, getUnderstandingSourceGrant, listUnderstandingSourceRuns, updateUnderstandingSourceGrantCheckpoint, updateUnderstandingSourceRun, upsertUnderstandingSourceGrant } from "../user-context/sources/repository.js";
|
|
13
12
|
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
14
13
|
import { ConnectedKnowledgePipeline } from "../knowledge/connected-knowledge-pipeline.js";
|
|
15
14
|
import "../knowledge/index.js";
|
|
16
15
|
import { ingestComposioConnectedSource } from "./connected-source-ingestion.js";
|
|
17
16
|
import { deriveConnectedSourceUnderstanding } from "./connected-source-understanding.js";
|
|
18
17
|
import { listConnectedContentCandidates, readConnectedContent } from "./content-enrichment.js";
|
|
18
|
+
import { createUnderstandingSourceRun, getUnderstandingSourceGrant, listUnderstandingSourceRuns, updateUnderstandingSourceGrantCheckpoint, updateUnderstandingSourceRun, upsertUnderstandingSourceGrant } from "../user-context/sources/repository.js";
|
|
19
19
|
//#region src/connectors/learning-coordinator.ts
|
|
20
20
|
init_logger();
|
|
21
21
|
const log = createLogger("ConnectorLearning");
|
|
@@ -59,7 +59,7 @@ function ensureUnderstandingSourceRun(job, toolkit, displayName) {
|
|
|
59
59
|
});
|
|
60
60
|
}
|
|
61
61
|
function learningEnabled(config) {
|
|
62
|
-
return config.userContext.enabled && config.userContext.
|
|
62
|
+
return config.userContext.enabled && config.userContext.userModel.enabled;
|
|
63
63
|
}
|
|
64
64
|
function startConnectorLearningCoordinator(options) {
|
|
65
65
|
const intervalMs = Math.max(2e3, Math.min(options.intervalMs ?? 1e4, 6e4));
|
|
@@ -209,7 +209,7 @@ function startConnectorLearningCoordinator(options) {
|
|
|
209
209
|
publish(updateConnectorLearningJob(job.id, { phase: "deriving" }));
|
|
210
210
|
let semantic = {
|
|
211
211
|
created: 0,
|
|
212
|
-
|
|
212
|
+
knowledgeCount: 0,
|
|
213
213
|
status: "completed"
|
|
214
214
|
};
|
|
215
215
|
try {
|
|
@@ -218,14 +218,13 @@ function startConnectorLearningCoordinator(options) {
|
|
|
218
218
|
agentId: job.agentId,
|
|
219
219
|
sourceInstanceId: job.sourceInstanceId,
|
|
220
220
|
sourceRunId: sourceRun.id,
|
|
221
|
-
processingPolicy: getUnderstandingSourceGrant(sourceRun.grantId)?.processingPolicy ?? "local_only"
|
|
222
|
-
memoryManager: options.getMemoryManager()
|
|
221
|
+
processingPolicy: getUnderstandingSourceGrant(sourceRun.grantId)?.processingPolicy ?? "local_only"
|
|
223
222
|
});
|
|
224
223
|
} catch (error) {
|
|
225
224
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
226
225
|
semantic = {
|
|
227
226
|
created: 0,
|
|
228
|
-
|
|
227
|
+
knowledgeCount: 0,
|
|
229
228
|
status: "failed",
|
|
230
229
|
error: CONNECTED_SOURCE_ANALYSIS_FAILED
|
|
231
230
|
};
|
|
@@ -235,7 +234,7 @@ function startConnectorLearningCoordinator(options) {
|
|
|
235
234
|
connectorId: job.connectorId
|
|
236
235
|
}, `Connected source semantic analysis failed: ${errorMessage}`);
|
|
237
236
|
}
|
|
238
|
-
const candidatesCreated = semantic.created + semantic.
|
|
237
|
+
const candidatesCreated = semantic.created + semantic.knowledgeCount;
|
|
239
238
|
const incomplete = enrichmentErrors.length > 0 || semantic.status !== "completed";
|
|
240
239
|
const completed = updateConnectorLearningJob(job.id, {
|
|
241
240
|
status: "completed",
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { init_session_key, parseSessionKey } from "../routing/session-key.js";
|
|
2
|
+
//#region src/connectors/principal.ts
|
|
3
|
+
init_session_key();
|
|
4
|
+
function connectorPrincipalForSession(sessionKey) {
|
|
5
|
+
const parsed = parseSessionKey(sessionKey);
|
|
6
|
+
if (!parsed || parsed.source === "cli" || parsed.source === "webchat") return {
|
|
7
|
+
principalId: "local-owner",
|
|
8
|
+
agentId: parsed?.agentId,
|
|
9
|
+
isLocalOwner: true
|
|
10
|
+
};
|
|
11
|
+
return {
|
|
12
|
+
principalId: `channel:${parsed.source}:${parsed.accountId}:${parsed.peerKind}:${parsed.peerId}`,
|
|
13
|
+
agentId: parsed.agentId,
|
|
14
|
+
isLocalOwner: false
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { connectorPrincipalForSession };
|
|
@@ -91,7 +91,10 @@ function capabilities(name, directory, writable) {
|
|
|
91
91
|
const extension = name.includes(".") ? name.split(".").pop().toLowerCase() : "";
|
|
92
92
|
const result = ["download", "share"];
|
|
93
93
|
if (MIME_TYPES[extension] || TEXT_EXTENSIONS.has(extension)) result.unshift("preview");
|
|
94
|
-
if (writable
|
|
94
|
+
if (writable) {
|
|
95
|
+
if (TEXT_EXTENSIONS.has(extension)) result.push("edit");
|
|
96
|
+
result.push("delete");
|
|
97
|
+
}
|
|
95
98
|
return result;
|
|
96
99
|
}
|
|
97
100
|
function fileSpaceId(root) {
|
|
@@ -61,10 +61,10 @@ export declare const GATEWAY_BUILTIN_TOOLS: readonly [{
|
|
|
61
61
|
readonly zh: "查看当前会话状态和用量。";
|
|
62
62
|
};
|
|
63
63
|
}, {
|
|
64
|
-
readonly id: "
|
|
64
|
+
readonly id: "memory_maintenance";
|
|
65
65
|
readonly description: {
|
|
66
|
-
readonly en: "
|
|
67
|
-
readonly zh: "
|
|
66
|
+
readonly en: "Inspect deterministic memory maintenance.";
|
|
67
|
+
readonly zh: "查看确定性的记忆整理任务。";
|
|
68
68
|
};
|
|
69
69
|
}, {
|
|
70
70
|
readonly id: "tool_manual";
|
|
@@ -163,16 +163,34 @@ export declare const GATEWAY_BUILTIN_TOOLS: readonly [{
|
|
|
163
163
|
readonly zh: "将文本转换为语音音频。";
|
|
164
164
|
};
|
|
165
165
|
}, {
|
|
166
|
-
readonly id: "
|
|
166
|
+
readonly id: "user_context_search";
|
|
167
167
|
readonly description: {
|
|
168
|
-
readonly en: "Search
|
|
169
|
-
readonly zh: "
|
|
168
|
+
readonly en: "Search typed user facts and preferences.";
|
|
169
|
+
readonly zh: "搜索结构化的用户事实与偏好。";
|
|
170
170
|
};
|
|
171
171
|
}, {
|
|
172
|
-
readonly id: "
|
|
172
|
+
readonly id: "user_context_get";
|
|
173
173
|
readonly description: {
|
|
174
|
-
readonly en: "Read a
|
|
175
|
-
readonly zh: "
|
|
174
|
+
readonly en: "Read a typed user assertion.";
|
|
175
|
+
readonly zh: "读取一条结构化用户事实。";
|
|
176
|
+
};
|
|
177
|
+
}, {
|
|
178
|
+
readonly id: "knowledge_search";
|
|
179
|
+
readonly description: {
|
|
180
|
+
readonly en: "Search scoped project and workspace knowledge.";
|
|
181
|
+
readonly zh: "搜索有作用域的项目与工作区知识。";
|
|
182
|
+
};
|
|
183
|
+
}, {
|
|
184
|
+
readonly id: "knowledge_get";
|
|
185
|
+
readonly description: {
|
|
186
|
+
readonly en: "Read a scoped knowledge item.";
|
|
187
|
+
readonly zh: "读取一条有作用域的知识。";
|
|
188
|
+
};
|
|
189
|
+
}, {
|
|
190
|
+
readonly id: "knowledge_write";
|
|
191
|
+
readonly description: {
|
|
192
|
+
readonly en: "Store a reviewable knowledge candidate.";
|
|
193
|
+
readonly zh: "保存一条可审查的知识候选。";
|
|
176
194
|
};
|
|
177
195
|
}, {
|
|
178
196
|
readonly id: "session_search";
|
|
@@ -247,4 +265,4 @@ export declare const GATEWAY_BUILTIN_TOOLS: readonly [{
|
|
|
247
265
|
readonly zh: "使用已验证的参数执行选定的外部工具。";
|
|
248
266
|
};
|
|
249
267
|
}];
|
|
250
|
-
export declare const GATEWAY_BUILTIN_TOOL_IDS: ("automation" | "workflow" | "find" | "image" | "
|
|
268
|
+
export declare const GATEWAY_BUILTIN_TOOL_IDS: ("automation" | "workflow" | "find" | "image" | "web_search" | "web_fetch" | "browser_use" | "grep" | "session_search" | "read_file" | "list_dir" | "write_file" | "apply_patch" | "exec_command" | "update_plan" | "todo" | "clarify" | "web_extract" | "image_generate" | "skills_list" | "skill_view" | "skill_manage" | "skills_marketplace_search" | "xopc_tool_search" | "xopc_tool_describe" | "xopc_tool_execute" | "user_context_search" | "user_context_get" | "knowledge_search" | "knowledge_get" | "knowledge_write" | "send_message" | "send_media" | "read_media" | "create_share" | "session_status" | "memory_maintenance" | "tool_manual" | "delegate_task" | "skill_install" | "text_to_speech" | "execute_code" | "create_desktop_pet")[];
|
|
@@ -67,10 +67,10 @@ const GATEWAY_BUILTIN_TOOLS = [
|
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
69
|
{
|
|
70
|
-
id: "
|
|
70
|
+
id: "memory_maintenance",
|
|
71
71
|
description: {
|
|
72
|
-
en: "
|
|
73
|
-
zh: "
|
|
72
|
+
en: "Inspect deterministic memory maintenance.",
|
|
73
|
+
zh: "查看确定性的记忆整理任务。"
|
|
74
74
|
}
|
|
75
75
|
},
|
|
76
76
|
{
|
|
@@ -186,17 +186,38 @@ const GATEWAY_BUILTIN_TOOLS = [
|
|
|
186
186
|
}
|
|
187
187
|
},
|
|
188
188
|
{
|
|
189
|
-
id: "
|
|
189
|
+
id: "user_context_search",
|
|
190
190
|
description: {
|
|
191
|
-
en: "Search
|
|
192
|
-
zh: "
|
|
191
|
+
en: "Search typed user facts and preferences.",
|
|
192
|
+
zh: "搜索结构化的用户事实与偏好。"
|
|
193
193
|
}
|
|
194
194
|
},
|
|
195
195
|
{
|
|
196
|
-
id: "
|
|
196
|
+
id: "user_context_get",
|
|
197
197
|
description: {
|
|
198
|
-
en: "Read a
|
|
199
|
-
zh: "
|
|
198
|
+
en: "Read a typed user assertion.",
|
|
199
|
+
zh: "读取一条结构化用户事实。"
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
id: "knowledge_search",
|
|
204
|
+
description: {
|
|
205
|
+
en: "Search scoped project and workspace knowledge.",
|
|
206
|
+
zh: "搜索有作用域的项目与工作区知识。"
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
id: "knowledge_get",
|
|
211
|
+
description: {
|
|
212
|
+
en: "Read a scoped knowledge item.",
|
|
213
|
+
zh: "读取一条有作用域的知识。"
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
id: "knowledge_write",
|
|
218
|
+
description: {
|
|
219
|
+
en: "Store a reviewable knowledge candidate.",
|
|
220
|
+
zh: "保存一条可审查的知识候选。"
|
|
200
221
|
}
|
|
201
222
|
},
|
|
202
223
|
{
|