@xopcai/xopc 0.0.247 → 0.0.249
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/src/update-offset-store.js +17 -54
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/extensions/weixin/src/auth/accounts.js +3 -5
- package/dist/extensions/weixin/src/monitor/monitor.js +3 -5
- package/dist/extensions/weixin/src/storage/sync-buf.d.ts +3 -6
- package/dist/extensions/weixin/src/storage/sync-buf.js +9 -22
- package/dist/gateway/static/root/assets/{activity-store-BlxqErph.js → activity-store-B759R_qf.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-DmaFeojS.js → agent-avatar-dicebear-BUu7EnwM.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-C1rXNUAG.js +1 -0
- package/dist/gateway/static/root/assets/agents-DK9HjHO0.js +1 -0
- package/dist/gateway/static/root/assets/{api-BbXzyQMj.js → api-Cg0v7Lpn.js} +1 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-C9DkCW_d.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-CFggS95Y.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-jOvT-fzU.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-DD2SweEH.js → archive-plugin-BQrilVVv.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-BG82bNBQ.js → attachment-load-BG0BliqV.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-CqBZ89He.js → automations-page-Bo4RiTkh.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BKjKTlW8.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-B6LKm5Zv.js → binary-plugins-BCnyNU0C.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-BJKvGVXd.js → block-editor-Db8DlVvg.js} +50 -50
- package/dist/gateway/static/root/assets/browser-settings-page-Dzq18pO1.js +8 -0
- package/dist/gateway/static/root/assets/{browser-workflow-inputs-BAAc151l.js → browser-workflow-inputs-C71vfl0b.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-workflows-page-DoE4Uuns.js → browser-workflows-page-vvmSYKsO.js} +2 -2
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DW4SBQf4.js +7 -0
- package/dist/gateway/static/root/assets/channels-settings-57OGuewD.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-CCBCtLDg.js → channels-status-swr-CKyV3jY5.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-BsRWnz7M.js → chat-terminal-dock-B1Xd6OFB.js} +2 -2
- package/dist/gateway/static/root/assets/connectors-page-CT_I3kbR.js +2 -0
- package/dist/gateway/static/root/assets/{cron-expression-DdCgsH2c.js → cron-expression-D-F9vjtE.js} +1 -1
- package/dist/gateway/static/root/assets/{date-picker-dt37Lt8e.js → date-picker-B2OoYvic.js} +1 -1
- package/dist/gateway/static/root/assets/dependency-picker-BiGx9Sbj.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-Nw_Pgkk3.js → desktop-pet-BNMRqipe.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-DeYbIV7A.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-BHSst0WN.js → extension-debug-page-COyn05ub.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DXbL4cQZ.js → extension-page-oH43chS2.js} +1 -1
- package/dist/gateway/static/root/assets/extension-settings-page-BMO59994.js +1 -0
- package/dist/gateway/static/root/assets/gateway-config-api-cimpViGk.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-config-swr-826dipyU.js → gateway-config-swr-BGdHwT4e.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-settings-BHJtnSic.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-DyvcAIMm.js → gateway-startup-retry-CuaM3b4c.js} +1 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DNhrZHqx.js +1 -0
- package/dist/gateway/static/root/assets/home-page-BiHwiBnQ.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-D7cyfks6.js → image-generation-api-D7duj7Uj.js} +1 -1
- package/dist/gateway/static/root/assets/index-DGeGmj4k.css +2 -0
- package/dist/gateway/static/root/assets/index-aBs0EfQB.js +72 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-EY4cu-6W.js → keyboard-shortcuts-settings-D8Zw_lYd.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-eBFVWmtH.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-Dh7OxX0S.js → local-apps-page-CvPDPRwb.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-CBoCuIMx.js → locale-store-zEL8bkwx.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-ClvcWlL6.js +2 -0
- package/dist/gateway/static/root/assets/{management-settings-ZjiL3A-S.js → management-settings-D8moh99U.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-split-B4BxkTpU.js → markdown-split-D7V3j0vE.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-BXsHghJd.js → markdown-view-DGRN-8wP.js} +1 -1
- package/dist/gateway/static/root/assets/{media-plugins-D15XBiEo.js → media-plugins-BLaE5b1Y.js} +1 -1
- package/dist/gateway/static/root/assets/messages-W5P19VTF.js +11 -0
- package/dist/gateway/static/root/assets/mobile-pairing-wizard-DiVDuCxl.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-CEEvR-fV.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-BLqgXNCx.js +8 -0
- package/dist/gateway/static/root/assets/page-tabs-BFMGjA60.js +1 -0
- package/dist/gateway/static/root/assets/preview-open-alternatives-DNEWZN7H.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-CAJeUXeU.js → product-open-page-Co5u7asH.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-CIiFJ5tk.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-B3UF-Pfm.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BhGKnvLP.js → registry-api-Cg92zSod.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BUtpkJPG.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-BhKcyEId.js → runtime-tools-settings-panel-C0ByNmlV.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-L0s7RWCi.js → schema-form-Dq_VQpuY.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-UgJmG-V4.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DDCzpdkl.js +1 -0
- package/dist/gateway/static/root/assets/settings-form-section-CZu6FX4k.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-CTKoztlF.js → settings-page-S8ekeUZd.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BdVmwXMv.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-CiiLLz5A.js → share-preview-page-D2fEidbn.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-BdsqnCYj.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-ghzAQKna.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-AYiPlgZE.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-CwRekJSJ.js → skills-page.utils-DGzl-ib-.js} +1 -1
- package/dist/gateway/static/root/assets/system-settings-panel-5Xd5mIiR.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-BQAUaCDD.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-hybK3oC9.js → theme-store-ZVClZKQ0.js} +1 -1
- package/dist/gateway/static/root/assets/tunnel-api-CdZN1Jin.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-DX5YZ3Nn.js → use-autosave-czRI0NBc.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-W3GTm6nA.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-ocnZbAyi.js → voice-api-key-field-8YEvA3cU.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-CBbiF1T3.js → voice-config-api-CopF64lY.js} +1 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-keLtqYYJ.js +1 -0
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-DaErGvxO.js → workflow-run-setup-panel-Dy5WgYMO.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-BbAV3h7n.js +5 -0
- package/dist/gateway/static/root/index.html +10 -26
- package/dist/package.js +1 -1
- package/dist/src/agent/agent-instance-gateway.d.ts +2 -2
- package/dist/src/agent/agent-manager.d.ts +4 -4
- package/dist/src/agent/agent-manager.js +31 -15
- package/dist/src/agent/background-review/coordinator.d.ts +2 -4
- package/dist/src/agent/background-review/coordinator.js +5 -30
- package/dist/src/agent/background-review/prompts.d.ts +4 -2
- package/dist/src/agent/background-review/prompts.js +24 -19
- package/dist/src/agent/background-review/run-background-review.d.ts +6 -7
- package/dist/src/agent/background-review/run-background-review.js +47 -41
- package/dist/src/agent/background-review/settings.d.ts +0 -1
- package/dist/src/agent/background-review/settings.js +6 -7
- package/dist/src/agent/commands/command-registry.d.ts +1 -0
- package/dist/src/agent/commands/command-registry.js +12 -22
- package/dist/src/agent/context/audit.d.ts +36 -0
- package/dist/src/agent/context/audit.js +97 -0
- package/dist/src/agent/context/coordinator.d.ts +26 -0
- package/dist/src/agent/context/coordinator.js +72 -0
- package/dist/src/agent/context/execution-context.d.ts +54 -0
- package/dist/src/agent/context/execution-context.js +147 -0
- package/dist/src/agent/context/execution-scope.js +1 -1
- package/dist/src/agent/context/prepend.d.ts +2 -0
- package/dist/src/agent/context/prepend.js +28 -0
- package/dist/src/agent/context/project-context.d.ts +3 -3
- package/dist/src/agent/context/project-context.js +26 -23
- package/dist/src/agent/embedded/index.js +1 -1
- package/dist/src/agent/embedded/run-for-session.js +1 -0
- package/dist/src/agent/embedded/run-turn.js +22 -2
- package/dist/src/agent/embedded/types.d.ts +1 -25
- package/dist/src/agent/external-tools/composio-provider.js +87 -92
- package/dist/src/agent/external-tools/gateway-tools.d.ts +4 -1
- package/dist/src/agent/external-tools/gateway-tools.js +153 -41
- package/dist/src/agent/external-tools/index.js +1 -1
- package/dist/src/agent/external-tools/search-error.d.ts +12 -0
- package/dist/src/agent/external-tools/search-error.js +29 -0
- package/dist/src/agent/external-tools/service.d.ts +4 -0
- package/dist/src/agent/external-tools/service.js +22 -2
- package/dist/src/agent/ipc/inbox.d.ts +8 -31
- package/dist/src/agent/ipc/inbox.js +64 -133
- package/dist/src/agent/memory/compaction-policy.js +1 -1
- package/dist/src/agent/memory/compaction-promotion.js +45 -77
- package/dist/src/agent/memory/create-memory-manager.js +1 -3
- package/dist/src/agent/memory/index.d.ts +0 -5
- package/dist/src/agent/memory/index.js +2 -5
- package/dist/src/agent/memory/manager.d.ts +0 -16
- package/dist/src/agent/memory/manager.js +11 -40
- package/dist/src/agent/memory/memory-config.js +1 -1
- package/dist/src/agent/memory/runtime.d.ts +2 -2
- package/dist/src/agent/memory/runtime.js +9 -19
- package/dist/src/agent/memory/types.d.ts +1 -1
- package/dist/src/agent/orchestration/agent-orchestrator.js +13 -21
- package/dist/src/agent/prompt/sections/memory-skills.js +25 -36
- package/dist/src/agent/prompt/sections/tooling.js +10 -4
- package/dist/src/agent/prompt/service-prompt-builder.js +4 -3
- package/dist/src/agent/service/direct-turn-helpers.js +6 -23
- package/dist/src/agent/service/process-direct-one-shot.js +15 -10
- package/dist/src/agent/service/process-direct-streaming.js +5 -3
- package/dist/src/agent/service.js +4 -3
- package/dist/src/agent/tasks/task-judge-service.js +1 -1
- package/dist/src/agent/tools/clarify-tool.d.ts +1 -0
- package/dist/src/agent/tools/delegate-tool.js +5 -2
- package/dist/src/agent/tools/factory.js +36 -19
- package/dist/src/agent/tools/index.d.ts +3 -2
- package/dist/src/agent/tools/index.js +4 -3
- package/dist/src/agent/tools/knowledge-memory-tool.d.ts +9 -0
- package/dist/src/agent/tools/knowledge-memory-tool.js +129 -0
- package/dist/src/agent/tools/{dreaming-tool.d.ts → memory-maintenance-tool.d.ts} +2 -2
- package/dist/src/agent/tools/memory-maintenance-tool.js +31 -0
- package/dist/src/agent/tools/user-context-tool.d.ts +8 -0
- package/dist/src/agent/tools/user-context-tool.js +81 -0
- package/dist/src/agent/tools/xopc-use-tool.js +2 -2
- package/dist/src/agent/workflow/catalog.d.ts +1 -8
- package/dist/src/agent/workflow/catalog.js +44 -102
- package/dist/src/agent/workflow/index.d.ts +1 -1
- package/dist/src/agent/workflow/index.js +2 -2
- package/dist/src/automations/domain/types.d.ts +1 -0
- package/dist/src/automations/service/action-executor.js +2 -2
- package/dist/src/automations/service/automation-service.js +2 -2
- package/dist/src/channels/manager.d.ts +1 -1
- package/dist/src/channels/manager.js +2 -2
- package/dist/src/channels/outbound/persist-store.d.ts +2 -8
- package/dist/src/channels/outbound/persist-store.js +11 -38
- package/dist/src/channels/outbound-sender.d.ts +1 -1
- package/dist/src/channels/outbound-sender.js +2 -2
- package/dist/src/chat-commands/builtins/understanding.js +24 -6
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/config/schema.d.ts +68 -75
- package/dist/src/config/schema.js +31 -20
- package/dist/src/config/web-patch.d.ts +1 -1
- package/dist/src/connectors/composio-managed-client.js +6 -2
- package/dist/src/connectors/composio-triggers.d.ts +2 -2
- package/dist/src/connectors/composio-triggers.js +8 -15
- package/dist/src/connectors/connected-source-understanding.d.ts +1 -3
- package/dist/src/connectors/connected-source-understanding.js +86 -99
- package/dist/src/connectors/connection-candidates.d.ts +11 -0
- package/dist/src/connectors/connection-candidates.js +58 -0
- package/dist/src/connectors/connection-capabilities.d.ts +4 -0
- package/dist/src/connectors/connection-capabilities.js +37 -0
- package/dist/src/connectors/connection-recovery-service.d.ts +42 -0
- package/dist/src/connectors/connection-recovery-service.js +396 -0
- package/dist/src/connectors/learning-coordinator.d.ts +0 -2
- package/dist/src/connectors/learning-coordinator.js +6 -7
- package/dist/src/connectors/principal.d.ts +5 -0
- package/dist/src/connectors/principal.js +18 -0
- package/dist/src/gateway/agent-builtin-tools.d.ts +28 -10
- package/dist/src/gateway/agent-builtin-tools.js +30 -9
- package/dist/src/gateway/automation-agent-session.js +3 -0
- package/dist/src/gateway/chat-stream/mapper.js +1 -28
- package/dist/src/gateway/chat-stream/protocol.d.ts +2 -24
- package/dist/src/gateway/clarify-bridge.d.ts +4 -0
- package/dist/src/gateway/clarify-bridge.js +9 -4
- package/dist/src/gateway/heartbeat/service.js +1 -1
- package/dist/src/gateway/hono/lib/config-payload.d.ts +52 -30
- package/dist/src/gateway/hono/lib/config-payload.js +4 -4
- package/dist/src/gateway/hono/lib/extension-store.js +8 -25
- package/dist/src/gateway/hono/middleware/auth.js +1 -2
- package/dist/src/gateway/hono/routes/config-patch/misc.d.ts +1 -1
- package/dist/src/gateway/hono/routes/config-patch/misc.js +72 -28
- package/dist/src/gateway/hono/routes/connection-waits.d.ts +3 -0
- package/dist/src/gateway/hono/routes/connection-waits.js +58 -0
- package/dist/src/gateway/hono/routes/connectors.js +4 -12
- package/dist/src/gateway/hono/routes/context-sources.d.ts +4 -0
- package/dist/src/gateway/hono/routes/context-sources.js +159 -0
- package/dist/src/gateway/hono/routes/index.js +4 -2
- package/dist/src/gateway/hono/routes/lazy-bundles.js +9 -4
- package/dist/src/gateway/hono/routes/notes.js +22 -7
- package/dist/src/gateway/hono/routes/projects.js +37 -45
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +15 -1
- package/dist/src/gateway/hono/routes/side-chats.js +13 -2
- package/dist/src/gateway/hono/routes/tasks.js +2 -2
- package/dist/src/gateway/hono/routes/user-model.d.ts +3 -0
- package/dist/src/gateway/hono/routes/user-model.js +480 -0
- package/dist/src/gateway/hono/routes/workflows.js +2 -2
- package/dist/src/gateway/memory-maintenance-automation-reconciler.d.ts +11 -0
- package/dist/src/gateway/memory-maintenance-automation-reconciler.js +72 -0
- package/dist/src/gateway/service/agent-runner.d.ts +9 -1
- package/dist/src/gateway/service/agent-runner.js +25 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +2 -2
- package/dist/src/gateway/service/config-coordinator.js +4 -4
- package/dist/src/gateway/service/run-gateway-agent.d.ts +1 -0
- package/dist/src/gateway/service/run-gateway-agent.js +18 -14
- package/dist/src/gateway/service/session-input-coordinator.d.ts +3 -0
- package/dist/src/gateway/service/session-input-coordinator.js +12 -2
- package/dist/src/gateway/service.d.ts +3 -1
- package/dist/src/gateway/service.js +49 -19
- package/dist/src/gateway/side-chat/manager.d.ts +16 -3
- package/dist/src/gateway/side-chat/manager.js +117 -28
- package/dist/src/gateway/side-chat/run-service.d.ts +2 -0
- package/dist/src/gateway/side-chat/run-service.js +28 -5
- package/dist/src/gateway/side-chat/types.d.ts +9 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/knowledge/connected-knowledge-pipeline.d.ts +0 -2
- package/dist/src/knowledge/connected-knowledge-pipeline.js +46 -217
- package/dist/src/knowledge-memory/domain.d.ts +35 -0
- package/dist/src/knowledge-memory/index.d.ts +2 -0
- package/dist/src/knowledge-memory/index.js +2 -0
- package/dist/src/knowledge-memory/repository.d.ts +45 -0
- package/dist/src/knowledge-memory/repository.js +154 -0
- package/dist/src/memory-maintenance/index.d.ts +2 -0
- package/dist/src/memory-maintenance/index.js +3 -0
- package/dist/src/memory-maintenance/schedule.d.ts +13 -0
- package/dist/src/memory-maintenance/schedule.js +51 -0
- package/dist/src/memory-maintenance/service.d.ts +28 -0
- package/dist/src/memory-maintenance/service.js +216 -0
- package/dist/src/notes/index.d.ts +1 -1
- package/dist/src/notes/index.js +2 -2
- package/dist/src/notes/paths.d.ts +0 -3
- package/dist/src/notes/paths.js +1 -10
- package/dist/src/notes/service.d.ts +1 -1
- package/dist/src/notes/service.js +7 -4
- package/dist/src/notes/store.d.ts +0 -2
- package/dist/src/notes/store.js +33 -80
- package/dist/src/notes/types.d.ts +16 -0
- package/dist/src/proactive/execution/context.d.ts +2 -2
- package/dist/src/proactive/execution/context.js +16 -11
- package/dist/src/proactive/index.d.ts +1 -1
- package/dist/src/proactive/index.js +2 -2
- package/dist/src/projects/index.d.ts +1 -1
- package/dist/src/projects/index.js +2 -2
- package/dist/src/projects/knowledge-bind.d.ts +1 -0
- package/dist/src/projects/knowledge-bind.js +15 -0
- package/dist/src/projects/project-loop.d.ts +3 -3
- package/dist/src/projects/project-loop.js +4 -4
- package/dist/src/projects/project-store.js +2 -1
- package/dist/src/realtime/runtime.js +1 -0
- package/dist/src/runtime-tools/manager.js +1 -1
- package/dist/src/share/hosted-session-share.d.ts +1 -4
- package/dist/src/share/hosted-session-share.js +14 -47
- package/dist/src/share/share-auto.d.ts +1 -1
- package/dist/src/share/share-auto.js +2 -2
- package/dist/src/share/share-store.d.ts +2 -7
- package/dist/src/share/share-store.js +153 -195
- package/dist/src/share/share-types.d.ts +0 -4
- package/dist/src/share/site-share-store.d.ts +3 -8
- package/dist/src/share/site-share-store.js +94 -153
- package/dist/src/share/site-share-types.d.ts +0 -4
- package/dist/src/storage/sqlite/collaboration-rule-repository.d.ts +17 -0
- package/dist/src/storage/sqlite/collaboration-rule-repository.js +54 -0
- package/dist/src/storage/sqlite/connection-wait-repository.d.ts +30 -0
- package/dist/src/storage/sqlite/connection-wait-repository.js +338 -0
- package/dist/src/storage/sqlite/connection.d.ts +1 -2
- package/dist/src/storage/sqlite/connection.js +50 -47
- package/dist/src/storage/sqlite/connector-account-repository.js +1 -1
- package/dist/src/storage/sqlite/context-evidence-repository.d.ts +24 -0
- package/dist/src/storage/sqlite/context-evidence-repository.js +52 -0
- package/dist/src/storage/sqlite/durable-queue.d.ts +16 -0
- package/dist/src/storage/sqlite/durable-queue.js +52 -0
- package/dist/src/storage/sqlite/durable-state.d.ts +16 -0
- package/dist/src/storage/sqlite/durable-state.js +43 -0
- package/dist/src/storage/sqlite/index.d.ts +3 -5
- package/dist/src/storage/sqlite/index.js +4 -6
- package/dist/src/storage/sqlite/knowledge-repository.d.ts +0 -19
- package/dist/src/storage/sqlite/knowledge-repository.js +1 -90
- package/dist/src/storage/sqlite/migrations/146_understanding_focus_exclusions.sql +9 -0
- package/dist/src/storage/sqlite/migrations/147_durable_application_state.sql +39 -0
- package/dist/src/storage/sqlite/migrations/148_user_model_foundation.sql +554 -0
- package/dist/src/storage/sqlite/migrations/149_separate_source_index_from_memory.sql +18 -0
- package/dist/src/storage/sqlite/migrations/150_session_connection_waits.sql +47 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/migrations/runner.ts +1 -1
- package/dist/src/storage/sqlite/notes-repository.d.ts +2 -1
- package/dist/src/storage/sqlite/notes-repository.js +37 -3
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-input-repository.d.ts +14 -2
- package/dist/src/storage/sqlite/session-input-repository.js +16 -13
- package/dist/src/storage/sqlite/session-repository.js +4 -1
- package/dist/src/storage/sqlite/transcript-repository.js +1 -1
- package/dist/src/tasks/index.js +2 -2
- package/dist/src/tasks/project-operating-view-service.js +1 -1
- package/dist/src/tasks/task-application-service.js +6 -1
- package/dist/src/tasks/task-context-assembler.js +1 -1
- package/dist/src/tasks/task-context-repository.d.ts +0 -1
- package/dist/src/tasks/task-context-repository.js +1 -1
- package/dist/src/tasks/task-deletion-service.js +1 -1
- package/dist/src/tasks/task-handoff-service.js +1 -1
- package/dist/src/tasks/task-read-model-projector.js +1 -1
- package/dist/src/tasks/task-run-coordinator.js +1 -1
- package/dist/src/tasks/task-run-dispatcher.js +1 -1
- package/dist/src/tasks/task-run-repository.js +1 -0
- package/dist/src/tasks/task-signal-service.js +1 -1
- package/dist/src/tui/tool-summary.js +2 -1
- package/dist/src/tui/tui-scoped-models.js +9 -6
- package/dist/src/user-context/changes.d.ts +1 -1
- package/dist/src/user-context/config.d.ts +135 -153
- package/dist/src/user-context/config.js +94 -99
- package/dist/src/user-context/relationship-continuity.d.ts +2 -2
- package/dist/src/user-context/relationship-continuity.js +34 -24
- package/dist/src/user-context/sources/activity-clustering.d.ts +9 -3
- package/dist/src/user-context/sources/index.js +2 -2
- package/dist/src/user-context/sources/repository.d.ts +1 -21
- package/dist/src/user-context/sources/repository.js +1 -183
- package/dist/src/user-context/sources/types.d.ts +0 -23
- package/dist/src/user-model/capture/executor.d.ts +40 -0
- package/dist/src/user-model/capture/executor.js +134 -0
- package/dist/src/user-model/capture/index.d.ts +2 -0
- package/dist/src/user-model/capture/index.js +3 -0
- package/dist/src/user-model/capture/semantic.d.ts +21 -0
- package/dist/src/user-model/capture/semantic.js +197 -0
- package/dist/src/user-model/domain.d.ts +93 -0
- package/dist/src/user-model/domain.js +33 -0
- package/dist/src/user-model/goals.d.ts +58 -0
- package/dist/src/user-model/goals.js +89 -0
- package/dist/src/user-model/importance.d.ts +11 -0
- package/dist/src/user-model/importance.js +17 -0
- package/dist/src/user-model/index.d.ts +5 -0
- package/dist/src/user-model/index.js +6 -0
- package/dist/src/user-model/repository.d.ts +23 -0
- package/dist/src/user-model/repository.js +268 -0
- package/dist/src/user-model/temporal.d.ts +10 -0
- package/dist/src/user-model/temporal.js +44 -0
- package/dist/src/voice/realtime/agentEngine.js +63 -18
- package/dist/src/voice/realtime/conversationTurn.d.ts +20 -0
- package/dist/src/voice/realtime/conversationTurn.js +83 -0
- package/dist/src/voice/realtime/memory-context.d.ts +7 -2
- package/dist/src/voice/realtime/memory-context.js +39 -51
- package/dist/src/voice/realtime/omniEngine.js +72 -18
- package/dist/src/work-discovery/service.d.ts +3 -14
- package/dist/src/work-discovery/service.js +138 -99
- package/dist/src/work-discovery/types.d.ts +3 -3
- package/dist/src/workflows/authoring/workflow-draft-store.d.ts +1 -5
- package/dist/src/workflows/authoring/workflow-draft-store.js +23 -43
- package/dist/src/workflows/index.js +2 -2
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/dist/src/workflows/service/workflow-session-bridge.js +12 -20
- package/dist/src/workflows/store/event-store.d.ts +1 -2
- package/dist/src/workflows/store/event-store.js +19 -64
- package/dist/src/workflows/store/paths.d.ts +0 -2
- package/dist/src/workflows/store/paths.js +1 -7
- package/dist/src/workflows/store/run-store.d.ts +0 -1
- package/dist/src/workflows/store/run-store.js +1 -24
- package/package.json +3 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-eG49pM-z.js +0 -1
- package/dist/gateway/static/root/assets/agents-CZwf1mgZ.js +0 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-BODskFTb.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-DeaVvaYZ.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-BZG3BK7f.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-CB7Yl2_B.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-Bu42Ljfw.js +0 -8
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Cg7zCxEH.js +0 -7
- package/dist/gateway/static/root/assets/channels-settings-EDTZ8P3y.js +0 -1
- package/dist/gateway/static/root/assets/cloud-C4-yfnnk.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-kh7PEkSS.js +0 -2
- package/dist/gateway/static/root/assets/dependency-picker-oi7cdv2C.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-D9OO-exo.js +0 -1
- package/dist/gateway/static/root/assets/ellipsis-0k4rZLoy.js +0 -1
- package/dist/gateway/static/root/assets/extension-settings-page-FTD7nE8v.js +0 -1
- package/dist/gateway/static/root/assets/eye-CABVeTq0.js +0 -1
- package/dist/gateway/static/root/assets/eye-off-DEAzt3g1.js +0 -1
- package/dist/gateway/static/root/assets/folder-open-CyzJ19I9.js +0 -1
- package/dist/gateway/static/root/assets/form-field-width-DJw_jULe.js +0 -1
- package/dist/gateway/static/root/assets/gateway-config-api-c-8ENciH.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-BxvyTRl0.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-C1S2Ccui.js +0 -1
- package/dist/gateway/static/root/assets/home-page-Bqx-SMWV.js +0 -1
- package/dist/gateway/static/root/assets/index-Cif1_3Jx.js +0 -71
- package/dist/gateway/static/root/assets/index-Dbh5SXyV.css +0 -2
- package/dist/gateway/static/root/assets/interaction-BmQogeqz.js +0 -1
- package/dist/gateway/static/root/assets/is-masked-secret-DOkL5b_X.js +0 -1
- package/dist/gateway/static/root/assets/link-2-D_ZKYUW7.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-sDdw7Y3Q.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-DUsxXdDp.js +0 -2
- package/dist/gateway/static/root/assets/message-square-plus-XP0tGdlV.js +0 -1
- package/dist/gateway/static/root/assets/messages-BbdwoxVo.js +0 -3
- package/dist/gateway/static/root/assets/minimize-2-DtOGrlpo.js +0 -1
- package/dist/gateway/static/root/assets/mobile-pairing-wizard-Dv87XewB.js +0 -1
- package/dist/gateway/static/root/assets/models-hub-cache-88f4fzYS.js +0 -1
- package/dist/gateway/static/root/assets/notes-page-DOe0lOcQ.js +0 -1
- package/dist/gateway/static/root/assets/notes-workbench-Cy0oYbWP.js +0 -4
- package/dist/gateway/static/root/assets/oauth-api-BjSUDIgq.js +0 -1
- package/dist/gateway/static/root/assets/oauth-authorization-window-Cdolr2wE.js +0 -1
- package/dist/gateway/static/root/assets/page-tabs-BaEQMYm_.js +0 -1
- package/dist/gateway/static/root/assets/pencil-DmIY3Oa-.js +0 -1
- package/dist/gateway/static/root/assets/preview-open-alternatives-CsNVTKC0.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-fgD1xc4O.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-CiTiEcOc.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Dc0GrNSp.js +0 -1
- package/dist/gateway/static/root/assets/rotate-cw-LIg3Am9S.js +0 -1
- package/dist/gateway/static/root/assets/search-DA7gz22f.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-BPOW3yaM.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Bz4s9BBY.js +0 -1
- package/dist/gateway/static/root/assets/settings-form-section-DjWzRk4z.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-rllj-j7k.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-DMj7onCX.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DRB366nS.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-cBT9jCof.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-Byrk4DQy.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-CheX3zmK.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-jKzujxFU.js +0 -1
- package/dist/gateway/static/root/assets/user-context-page-CWy3Pqtk.js +0 -1
- package/dist/gateway/static/root/assets/work-discovery-overlay-DE4_YpDn.js +0 -1
- package/dist/gateway/static/root/assets/workflows-page-y4O9-BTf.js +0 -5
- package/dist/src/agent/memory/builtin-provider.d.ts +0 -37
- package/dist/src/agent/memory/builtin-provider.js +0 -225
- package/dist/src/agent/memory/context/types.d.ts +0 -40
- package/dist/src/agent/memory/understanding/quality.d.ts +0 -8
- package/dist/src/agent/memory/understanding/quality.js +0 -18
- package/dist/src/agent/memory/understanding/service.d.ts +0 -19
- package/dist/src/agent/memory/understanding/service.js +0 -209
- package/dist/src/agent/memory/understanding/types.d.ts +0 -34
- package/dist/src/agent/memory/understanding/types.js +0 -1
- package/dist/src/agent/memory/user-context-coordinator.d.ts +0 -23
- package/dist/src/agent/memory/user-context-coordinator.js +0 -113
- package/dist/src/agent/tools/dreaming-tool.js +0 -37
- package/dist/src/agent/tools/memory-tool.d.ts +0 -9
- package/dist/src/agent/tools/memory-tool.js +0 -119
- package/dist/src/gateway/dreaming-automation-reconciler.d.ts +0 -11
- package/dist/src/gateway/dreaming-automation-reconciler.js +0 -63
- package/dist/src/gateway/hono/routes/understanding-sources.d.ts +0 -21
- package/dist/src/gateway/hono/routes/understanding-sources.js +0 -387
- package/dist/src/gateway/hono/routes/you.d.ts +0 -3
- package/dist/src/gateway/hono/routes/you.js +0 -443
- package/dist/src/projects/memory-bind.d.ts +0 -1
- package/dist/src/projects/memory-bind.js +0 -14
- package/dist/src/storage/sqlite/context-consolidation-repository.d.ts +0 -37
- package/dist/src/storage/sqlite/context-consolidation-repository.js +0 -64
- package/dist/src/storage/sqlite/memory-records-repository.d.ts +0 -217
- package/dist/src/storage/sqlite/memory-records-repository.js +0 -715
- package/dist/src/storage/sqlite/remote-context-repository.d.ts +0 -3
- package/dist/src/storage/sqlite/remote-context-repository.js +0 -40
- package/dist/src/storage/sqlite/user-context-quality-repository.d.ts +0 -49
- package/dist/src/storage/sqlite/user-context-quality-repository.js +0 -118
- package/dist/src/storage/sqlite/user-context-repository.d.ts +0 -85
- package/dist/src/storage/sqlite/user-context-repository.js +0 -535
- package/dist/src/user-context/automatic-context.d.ts +0 -17
- package/dist/src/user-context/automatic-context.js +0 -85
- package/dist/src/user-context/consolidation.d.ts +0 -27
- package/dist/src/user-context/consolidation.js +0 -187
- package/dist/src/user-context/context-objects.d.ts +0 -17
- package/dist/src/user-context/context-objects.js +0 -99
- package/dist/src/user-context/evaluation/harness.d.ts +0 -13
- package/dist/src/user-context/evaluation/harness.js +0 -31
- package/dist/src/user-context/extraction/executor.d.ts +0 -22
- package/dist/src/user-context/extraction/executor.js +0 -142
- package/dist/src/user-context/extraction/repair.d.ts +0 -19
- package/dist/src/user-context/extraction/repair.js +0 -71
- package/dist/src/user-context/extraction/semantic.d.ts +0 -18
- package/dist/src/user-context/extraction/semantic.js +0 -148
- package/dist/src/user-context/focus-lifecycle.d.ts +0 -2
- package/dist/src/user-context/focus-lifecycle.js +0 -26
- package/dist/src/user-context/manual-understanding.d.ts +0 -12
- package/dist/src/user-context/manual-understanding.js +0 -37
- package/dist/src/user-context/planner.d.ts +0 -17
- package/dist/src/user-context/planner.js +0 -465
- package/dist/src/user-context/relationships/indexer.d.ts +0 -13
- package/dist/src/user-context/relationships/indexer.js +0 -185
- package/dist/src/user-context/relationships/service.d.ts +0 -22
- package/dist/src/user-context/relationships/service.js +0 -50
- package/dist/src/user-context/retriever.d.ts +0 -15
- package/dist/src/user-context/retriever.js +0 -124
- package/dist/src/user-context/scope.d.ts +0 -7
- package/dist/src/user-context/scope.js +0 -9
- package/dist/src/user-context/selection-policy.d.ts +0 -20
- package/dist/src/user-context/selection-policy.js +0 -33
- package/dist/src/user-context/understanding.d.ts +0 -15
- package/dist/src/user-context/understanding.js +0 -24
- package/dist/src/user-context/understandingQuality.d.ts +0 -5
- package/dist/src/user-context/understandingQuality.js +0 -48
- /package/dist/src/{agent/memory/context/types.js → knowledge-memory/domain.js} +0 -0
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { connectionBinding, connectionBindings, publishConnectionWait, requireSessionConnection } from "../../storage/sqlite/connection-wait-repository.js";
|
|
1
2
|
import { consumeConnectorApproval, createConnectorApproval, getConnectorApproval, getConnectorInstallation, listConnectorActionMetadata, listConnectorConnections, listConnectorInstallations, upsertConnectorActionMetadata, upsertConnectorInstallation } from "../../storage/sqlite/connector-repository.js";
|
|
2
3
|
import "../../storage/sqlite/index.js";
|
|
3
|
-
import { init_session_key, parseSessionKey } from "../../routing/session-key.js";
|
|
4
4
|
import { connectorArgumentsHash, connectorArgumentsPreview } from "../../connectors/approval.js";
|
|
5
5
|
import { ComposioSessionsAdapter } from "../../connectors/composio-sessions.js";
|
|
6
6
|
import { getComposioToolkitScope, getConfiguredComposioAuthConfigs, isComposioActionAllowedByCatalog, scopeForComposioAction } from "../../connectors/composio.js";
|
|
7
7
|
import { getConnectorDefinition } from "../../connectors/catalog.js";
|
|
8
|
+
import { isToolInputSchema } from "../../connectors/connection-capabilities.js";
|
|
9
|
+
import { connectorPrincipalForSession } from "../../connectors/principal.js";
|
|
10
|
+
import { ExternalToolSearchError } from "./search-error.js";
|
|
8
11
|
import { externalToolRef, parseExternalToolRef } from "./refs.js";
|
|
9
12
|
//#region src/agent/external-tools/composio-provider.ts
|
|
10
|
-
init_session_key();
|
|
11
|
-
const CONNECT_ACTION = "$connect";
|
|
12
13
|
const CONNECTION_ARGUMENT = "xopcConnectionId";
|
|
13
14
|
function textResult(value) {
|
|
14
15
|
return {
|
|
@@ -19,19 +20,6 @@ function textResult(value) {
|
|
|
19
20
|
details: {}
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
|
-
function connectorPrincipalForSession(sessionKey) {
|
|
23
|
-
const parsed = parseSessionKey(sessionKey);
|
|
24
|
-
if (!parsed || parsed.source === "cli" || parsed.source === "webchat") return {
|
|
25
|
-
principalId: "local-owner",
|
|
26
|
-
agentId: parsed?.agentId,
|
|
27
|
-
isLocalOwner: true
|
|
28
|
-
};
|
|
29
|
-
return {
|
|
30
|
-
principalId: `channel:${parsed.source}:${parsed.accountId}:${parsed.peerKind}:${parsed.peerId}`,
|
|
31
|
-
agentId: parsed.agentId,
|
|
32
|
-
isLocalOwner: false
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
23
|
function installedConfigToolkits(config) {
|
|
36
24
|
return Object.values(config?.connectors?.instances ?? {}).flatMap((record) => {
|
|
37
25
|
if (!record || typeof record !== "object" || Array.isArray(record)) return [];
|
|
@@ -65,9 +53,9 @@ function syncLocalOwnerInstallations(config) {
|
|
|
65
53
|
id,
|
|
66
54
|
connectorId,
|
|
67
55
|
principalId: "local-owner",
|
|
68
|
-
enabled: true,
|
|
56
|
+
enabled: existing?.enabled ?? true,
|
|
69
57
|
allowedAgentIds: existing?.allowedAgentIds ?? [],
|
|
70
|
-
maxScope: getComposioToolkitScope(config, toolkit),
|
|
58
|
+
maxScope: existing?.maxScope ?? getComposioToolkitScope(config, toolkit),
|
|
71
59
|
confirmationPolicy: existing?.confirmationPolicy ?? "writes",
|
|
72
60
|
selectedConnectionIds: existing?.selectedConnectionIds ?? [],
|
|
73
61
|
createdAt: existing?.createdAt
|
|
@@ -102,7 +90,8 @@ function schemaSummary(value, fallback) {
|
|
|
102
90
|
return fallback;
|
|
103
91
|
}
|
|
104
92
|
function actionInputSchema(action) {
|
|
105
|
-
|
|
93
|
+
if (!isToolInputSchema(action.inputSchema)) throw new Error(`Exact input contract is unavailable for ${action.actionId}`);
|
|
94
|
+
const schema = action.inputSchema;
|
|
106
95
|
const properties = schema.properties && typeof schema.properties === "object" && !Array.isArray(schema.properties) ? schema.properties : {};
|
|
107
96
|
return {
|
|
108
97
|
...schema,
|
|
@@ -127,31 +116,31 @@ var ComposioToolProvider = class {
|
|
|
127
116
|
const available = this.availableInstallations();
|
|
128
117
|
const toolkits = available.installations.map(toolkitFromInstallation);
|
|
129
118
|
if (toolkits.length === 0) return [];
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
119
|
+
let phase = "create_session";
|
|
120
|
+
let result;
|
|
121
|
+
try {
|
|
122
|
+
const session = await this.adapter.createSession({
|
|
123
|
+
principalId: available.principalId,
|
|
124
|
+
toolkits,
|
|
125
|
+
authConfigs: getConfiguredComposioAuthConfigs(this.deps.getConfig(), toolkits)
|
|
126
|
+
});
|
|
127
|
+
phase = "search";
|
|
128
|
+
result = await session.search({
|
|
129
|
+
query,
|
|
130
|
+
toolkits
|
|
131
|
+
});
|
|
132
|
+
} catch (cause) {
|
|
133
|
+
throw new ExternalToolSearchError(phase, toolkits, cause);
|
|
134
|
+
}
|
|
138
135
|
const schemas = result && typeof result === "object" && !Array.isArray(result) ? result.toolSchemas : void 0;
|
|
139
|
-
const hits =
|
|
140
|
-
const toolkit = toolkitFromInstallation(installation);
|
|
141
|
-
return {
|
|
142
|
-
toolRef: externalToolRef(this.source, installation.id, CONNECT_ACTION),
|
|
143
|
-
source: this.source,
|
|
144
|
-
namespace: toolkit,
|
|
145
|
-
title: `Connect ${toolkit}`,
|
|
146
|
-
summary: `Authorize an account for the installed ${toolkit} app.`
|
|
147
|
-
};
|
|
148
|
-
});
|
|
136
|
+
const hits = [];
|
|
149
137
|
if (!schemas || typeof schemas !== "object" || Array.isArray(schemas)) return hits;
|
|
150
138
|
for (const [actionId, schema] of Object.entries(schemas)) {
|
|
151
139
|
const toolkit = toolkitForAction(actionId, toolkits);
|
|
152
140
|
if (!toolkit || !isComposioActionAllowedByCatalog(actionId)) continue;
|
|
153
141
|
const installation = available.installations.find((candidate) => toolkitFromInstallation(candidate) === toolkit);
|
|
154
142
|
if (!installation) continue;
|
|
143
|
+
if (!isToolInputSchema(schema && typeof schema === "object" ? schema.inputSchema : void 0)) continue;
|
|
155
144
|
upsertConnectorActionMetadata(contractFromSearch(installation.connectorId, toolkit, actionId, schema));
|
|
156
145
|
hits.push({
|
|
157
146
|
toolRef: externalToolRef(this.source, installation.id, actionId),
|
|
@@ -167,27 +156,8 @@ var ComposioToolProvider = class {
|
|
|
167
156
|
const resolved = this.resolve(toolRef);
|
|
168
157
|
if (!resolved) return void 0;
|
|
169
158
|
const toolkit = toolkitFromInstallation(resolved.installation);
|
|
170
|
-
if (resolved.actionId === CONNECT_ACTION) {
|
|
171
|
-
const summary = `Authorize an account for the installed ${toolkit} app.`;
|
|
172
|
-
return {
|
|
173
|
-
toolRef,
|
|
174
|
-
source: this.source,
|
|
175
|
-
namespace: toolkit,
|
|
176
|
-
title: `Connect ${toolkit}`,
|
|
177
|
-
summary,
|
|
178
|
-
description: `${summary} Never claim the connection succeeded until it is checked again.`,
|
|
179
|
-
inputSchema: {
|
|
180
|
-
type: "object",
|
|
181
|
-
properties: { alias: {
|
|
182
|
-
type: "string",
|
|
183
|
-
description: "Optional account label."
|
|
184
|
-
} },
|
|
185
|
-
additionalProperties: false
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
159
|
const action = listConnectorActionMetadata(resolved.installation.connectorId).find((candidate) => candidate.actionId === resolved.actionId);
|
|
190
|
-
if (!action
|
|
160
|
+
if (!action || !isToolInputSchema(action.inputSchema) || !isComposioActionAllowedByCatalog(action.actionId)) return void 0;
|
|
191
161
|
const summary = `Run ${action.actionId} in ${toolkit}.`;
|
|
192
162
|
return {
|
|
193
163
|
toolRef,
|
|
@@ -210,31 +180,47 @@ var ComposioToolProvider = class {
|
|
|
210
180
|
executionArgs = hook.params ?? args;
|
|
211
181
|
}
|
|
212
182
|
const toolkit = toolkitFromInstallation(resolved.installation);
|
|
213
|
-
if (resolved.actionId === CONNECT_ACTION) {
|
|
214
|
-
const authorization = await this.adapter.authorize({
|
|
215
|
-
principalId: available.principalId,
|
|
216
|
-
toolkit,
|
|
217
|
-
authConfigId: installedConfigToolkits(this.deps.getConfig()).find((item) => item.connectorId === resolved.installation.connectorId)?.authConfigId,
|
|
218
|
-
installationId: resolved.installation.id,
|
|
219
|
-
alias: typeof executionArgs.alias === "string" ? executionArgs.alias : void 0
|
|
220
|
-
});
|
|
221
|
-
return textResult({
|
|
222
|
-
status: authorization.status,
|
|
223
|
-
toolkit,
|
|
224
|
-
authorizationUrl: authorization.connectUrl,
|
|
225
|
-
connectionId: authorization.connectionId,
|
|
226
|
-
instruction: "Ask the user to open the authorization URL. Check the connection again after they finish."
|
|
227
|
-
});
|
|
228
|
-
}
|
|
229
183
|
const action = listConnectorActionMetadata(resolved.installation.connectorId).find((candidate) => candidate.actionId === resolved.actionId);
|
|
230
|
-
if (!action
|
|
231
|
-
await this.adapter.syncConnections({ principalId: available.principalId })
|
|
184
|
+
if (!action || !isToolInputSchema(action.inputSchema) || !isComposioActionAllowedByCatalog(resolved.actionId)) return textResult("The exact action contract is unavailable. Search and describe the tool again.");
|
|
185
|
+
let fresh = await this.adapter.syncConnections({ principalId: available.principalId });
|
|
186
|
+
const binding = available.context ? connectionBinding(available.context.sessionKey, resolved.installation.connectorId) : void 0;
|
|
187
|
+
const expired = fresh.find((item) => item.connectorId === resolved.installation.connectorId && item.status === "expired" && item.id === binding);
|
|
188
|
+
if (expired) {
|
|
189
|
+
const refreshed = await this.adapter.refreshConnection(expired);
|
|
190
|
+
fresh = fresh.map((item) => item.id === refreshed.id ? refreshed : item);
|
|
191
|
+
}
|
|
232
192
|
const connections = listConnectorConnections({
|
|
233
193
|
principalId: available.principalId,
|
|
234
194
|
connectorId: resolved.installation.connectorId
|
|
235
|
-
}).filter((connection) => connection.status === "active");
|
|
236
|
-
const requestedConnection = typeof executionArgs[CONNECTION_ARGUMENT] === "string" ? executionArgs[CONNECTION_ARGUMENT] : void 0;
|
|
237
|
-
const
|
|
195
|
+
}).filter((connection) => connection.status === "active" && fresh.some((item) => item.id === connection.id) && (!resolved.installation.selectedConnectionIds.length || resolved.installation.selectedConnectionIds.includes(connection.id)));
|
|
196
|
+
const requestedConnection = typeof executionArgs[CONNECTION_ARGUMENT] === "string" ? executionArgs[CONNECTION_ARGUMENT] : available.context ? connectionBinding(available.context.sessionKey, resolved.installation.connectorId) : void 0;
|
|
197
|
+
const bindings = available.context ? connectionBindings(available.context.sessionKey).filter((need) => need.connectorId === resolved.installation.connectorId) : [];
|
|
198
|
+
if (bindings.length > 1 && !requestedConnection) return textResult({
|
|
199
|
+
status: "account_selection_required",
|
|
200
|
+
accounts: bindings,
|
|
201
|
+
instruction: "Choose the account for this operation using xopcConnectionId."
|
|
202
|
+
});
|
|
203
|
+
if (bindings.length && requestedConnection && !bindings.some((need) => need.connectionId === requestedConnection)) return textResult("This account was not selected for the current objective.");
|
|
204
|
+
const connection = requestedConnection ? connections.find((candidate) => candidate.id === requestedConnection) : connections.length === 1 ? connections[0] : void 0;
|
|
205
|
+
const requestConnection = () => {
|
|
206
|
+
if (!available.context) return textResult({ status: "connection_required" });
|
|
207
|
+
const result = requireSessionConnection({
|
|
208
|
+
sessionKey: available.context.sessionKey,
|
|
209
|
+
principalId: available.principalId,
|
|
210
|
+
agentId: available.agentId ?? "main",
|
|
211
|
+
summary: `Continue ${action.actionId} using ${toolkit}`,
|
|
212
|
+
needs: [{
|
|
213
|
+
key: `${resolved.installation.connectorId}:default`,
|
|
214
|
+
connectorId: resolved.installation.connectorId,
|
|
215
|
+
connectionId: requestedConnection,
|
|
216
|
+
label: getConnectorDefinition(resolved.installation.connectorId)?.displayName ?? toolkit,
|
|
217
|
+
capabilities: [action.actionId]
|
|
218
|
+
}]
|
|
219
|
+
});
|
|
220
|
+
publishConnectionWait(available.context.sessionKey);
|
|
221
|
+
return textResult(result);
|
|
222
|
+
};
|
|
223
|
+
if (!connection) return requestConnection();
|
|
238
224
|
const actionArgs = { ...executionArgs };
|
|
239
225
|
delete actionArgs[CONNECTION_ARGUMENT];
|
|
240
226
|
const argsHash = connectorArgumentsHash(actionArgs);
|
|
@@ -245,20 +231,29 @@ var ComposioToolProvider = class {
|
|
|
245
231
|
confirmed = Boolean(consumeConnectorApproval(approvalId, argsHash));
|
|
246
232
|
if (!confirmed) return textResult("The connector approval is not approved, has expired, or was already used.");
|
|
247
233
|
}
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
234
|
+
let result;
|
|
235
|
+
try {
|
|
236
|
+
result = await this.adapter.executeWithPolicy({
|
|
237
|
+
context: {
|
|
238
|
+
principalId: available.principalId,
|
|
239
|
+
toolkits: [toolkit],
|
|
240
|
+
authConfigs: getConfiguredComposioAuthConfigs(this.deps.getConfig(), [toolkit])
|
|
241
|
+
},
|
|
242
|
+
installation: resolved.installation,
|
|
243
|
+
connection,
|
|
244
|
+
action,
|
|
245
|
+
args: actionArgs,
|
|
246
|
+
agentId: available.agentId,
|
|
247
|
+
sessionKey: available.context?.sessionKey,
|
|
248
|
+
confirmed
|
|
249
|
+
});
|
|
250
|
+
} catch (error) {
|
|
251
|
+
if (action.scope === "read") {
|
|
252
|
+
const checked = await this.adapter.syncConnections({ principalId: available.principalId }).catch(() => void 0);
|
|
253
|
+
if (checked && !checked.some((item) => item.id === connection.id && item.status === "active")) return requestConnection();
|
|
254
|
+
}
|
|
255
|
+
throw error;
|
|
256
|
+
}
|
|
262
257
|
if (result.decision === "confirmation_required") {
|
|
263
258
|
const approval = createConnectorApproval({
|
|
264
259
|
principalId: available.principalId,
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { AgentTool } from '@earendil-works/pi-agent-core';
|
|
2
|
+
import type { ExternalToolTurnContext } from './types.js';
|
|
2
3
|
import { type ExternalToolProvider } from './types.js';
|
|
3
4
|
export declare const EXTERNAL_TOOL_NAMES: {
|
|
4
5
|
readonly search: "xopc_tool_search";
|
|
5
6
|
readonly describe: "xopc_tool_describe";
|
|
6
7
|
readonly execute: "xopc_tool_execute";
|
|
8
|
+
readonly requireConnection: "xopc_require_connection";
|
|
9
|
+
readonly updateConnectionObjective: "xopc_update_connection_objective";
|
|
7
10
|
};
|
|
8
|
-
export declare function createExternalToolGatewayTools(providers: ExternalToolProvider[]): AgentTool[];
|
|
11
|
+
export declare function createExternalToolGatewayTools(providers: ExternalToolProvider[], getContext?: () => ExternalToolTurnContext | null): AgentTool[];
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import { connectionBindings, getActiveConnectionWait, publishConnectionWait, requireSessionConnection, reviseCurrentConnectionObjective } from "../../storage/sqlite/connection-wait-repository.js";
|
|
2
|
+
import { listConnectorConnections } from "../../storage/sqlite/connector-repository.js";
|
|
3
|
+
import { connectorPrincipalForSession } from "../../connectors/principal.js";
|
|
4
|
+
import { connectionCandidates, resolveConnectionCandidate } from "../../connectors/connection-candidates.js";
|
|
1
5
|
import { ExternalToolService } from "./service.js";
|
|
2
6
|
import { EXTERNAL_TOOL_SOURCES } from "./types.js";
|
|
3
7
|
import { Type } from "@sinclair/typebox";
|
|
@@ -5,7 +9,9 @@ import { Type } from "@sinclair/typebox";
|
|
|
5
9
|
const EXTERNAL_TOOL_NAMES = {
|
|
6
10
|
search: "xopc_tool_search",
|
|
7
11
|
describe: "xopc_tool_describe",
|
|
8
|
-
execute: "xopc_tool_execute"
|
|
12
|
+
execute: "xopc_tool_execute",
|
|
13
|
+
requireConnection: "xopc_require_connection",
|
|
14
|
+
updateConnectionObjective: "xopc_update_connection_objective"
|
|
9
15
|
};
|
|
10
16
|
const ToolSearchSchema = Type.Object({
|
|
11
17
|
query: Type.String({ description: "Describe the capability or task you need." }),
|
|
@@ -38,49 +44,155 @@ function textResult(value, details = {}) {
|
|
|
38
44
|
details
|
|
39
45
|
};
|
|
40
46
|
}
|
|
41
|
-
function createExternalToolGatewayTools(providers) {
|
|
47
|
+
function createExternalToolGatewayTools(providers, getContext) {
|
|
42
48
|
const service = new ExternalToolService(providers);
|
|
49
|
+
const searchTool = {
|
|
50
|
+
name: EXTERNAL_TOOL_NAMES.search,
|
|
51
|
+
label: "🔎 External Tool Search",
|
|
52
|
+
description: "Search MCP, connected-app, extension, remote-memory, and current-endpoint tools. Use concise English capability keywords. Returns compact references only; call xopc_tool_describe before execution.",
|
|
53
|
+
parameters: ToolSearchSchema,
|
|
54
|
+
async execute(_toolCallId, params) {
|
|
55
|
+
return textResult({
|
|
56
|
+
...await service.search(params),
|
|
57
|
+
connectionCandidates: connectionCandidates(params.query),
|
|
58
|
+
selectedConnections: getContext?.()?.sessionKey ? connectionBindings(getContext().sessionKey) : [],
|
|
59
|
+
waitingObjective: getContext?.()?.sessionKey ? getActiveConnectionWait(getContext().sessionKey)?.summary : void 0
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
const describeTool = {
|
|
64
|
+
name: EXTERNAL_TOOL_NAMES.describe,
|
|
65
|
+
label: "📋 External Tool Contract",
|
|
66
|
+
description: "Load exact contracts for up to three external tools returned by xopc_tool_search.",
|
|
67
|
+
parameters: ToolDescribeSchema,
|
|
68
|
+
async execute(_toolCallId, params) {
|
|
69
|
+
const result = await service.describe(params.toolRefs);
|
|
70
|
+
return textResult({
|
|
71
|
+
...result,
|
|
72
|
+
...result.notFound.length ? { instruction: "These exact tool contracts are unavailable. Do not execute them, invent revisions, or reconnect the account. Use a different available tool or explain the capability failure." } : {}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
const executeTool = {
|
|
77
|
+
name: EXTERNAL_TOOL_NAMES.execute,
|
|
78
|
+
label: "▶️ External Tool Execute",
|
|
79
|
+
description: "Execute one external tool using its exact reference, contract revision, and validated arguments.",
|
|
80
|
+
parameters: ToolExecuteSchema,
|
|
81
|
+
async execute(toolCallId, params, signal, onUpdate) {
|
|
82
|
+
const result = await service.execute({
|
|
83
|
+
...params,
|
|
84
|
+
context: {
|
|
85
|
+
toolCallId,
|
|
86
|
+
signal,
|
|
87
|
+
onUpdate
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
return {
|
|
91
|
+
...result,
|
|
92
|
+
details: {
|
|
93
|
+
...result.details ?? {},
|
|
94
|
+
delegatedToolRef: params.toolRef,
|
|
95
|
+
delegatedToolRevision: params.revision
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const requireSchema = Type.Object({
|
|
101
|
+
requirements: Type.Array(Type.Object({
|
|
102
|
+
candidateRef: Type.String(),
|
|
103
|
+
accountId: Type.Optional(Type.String()),
|
|
104
|
+
accountSelector: Type.Optional(Type.String({ maxLength: 100 }))
|
|
105
|
+
}), {
|
|
106
|
+
minItems: 1,
|
|
107
|
+
maxItems: 5
|
|
108
|
+
}),
|
|
109
|
+
purpose: Type.String({
|
|
110
|
+
minLength: 1,
|
|
111
|
+
maxLength: 1e3
|
|
112
|
+
}),
|
|
113
|
+
checkpoint: Type.Object({
|
|
114
|
+
completedSteps: Type.Array(Type.String({ maxLength: 500 }), { maxItems: 20 }),
|
|
115
|
+
pendingSteps: Type.Array(Type.String({ maxLength: 500 }), {
|
|
116
|
+
minItems: 1,
|
|
117
|
+
maxItems: 20
|
|
118
|
+
}),
|
|
119
|
+
timeRange: Type.Optional(Type.Object({
|
|
120
|
+
from: Type.String(),
|
|
121
|
+
to: Type.String(),
|
|
122
|
+
timezone: Type.String(),
|
|
123
|
+
expression: Type.String()
|
|
124
|
+
}))
|
|
125
|
+
}, { description: "Preserve completed work, remaining work, and absolute dates resolved from the original request. Never include credentials." })
|
|
126
|
+
});
|
|
127
|
+
const requireTool = {
|
|
128
|
+
name: EXTERNAL_TOOL_NAMES.requireConnection,
|
|
129
|
+
label: "Connect app",
|
|
130
|
+
parameters: requireSchema,
|
|
131
|
+
description: "Request the connections returned as connectionCandidates by xopc_tool_search. Explain the need once before calling. This pauses the current objective and displays one action area above the input. Never return OAuth URLs or repeat a skipped request. If another objective is waiting, ask the user to continue or cancel it first.",
|
|
132
|
+
async execute(_id, params) {
|
|
133
|
+
const context = getContext?.();
|
|
134
|
+
if (!context) throw new Error("No active conversation.");
|
|
135
|
+
const range = params.checkpoint.timeRange;
|
|
136
|
+
if (range && (!Number.isFinite(Date.parse(range.from)) || !Number.isFinite(Date.parse(range.to)) || Date.parse(range.from) >= Date.parse(range.to))) throw new Error("Provide a valid absolute time range.");
|
|
137
|
+
if (range) new Intl.DateTimeFormat("en", { timeZone: range.timezone }).format();
|
|
138
|
+
const principal = connectorPrincipalForSession(context.sessionKey);
|
|
139
|
+
if (!principal.isLocalOwner) throw new Error("Connection recovery is available in the owner chat.");
|
|
140
|
+
const selected = connectionBindings(context.sessionKey);
|
|
141
|
+
if (params.requirements.every((item) => selected.some((need) => need.connectorId === item.candidateRef && need.connectionId && (!item.accountId || item.accountId === need.accountId) && (!item.accountSelector || item.accountSelector === need.accountSelector) && listConnectorConnections({
|
|
142
|
+
principalId: principal.principalId,
|
|
143
|
+
connectorId: need.connectorId
|
|
144
|
+
}).some((connection) => connection.id === need.connectionId && connection.status === "active")))) return textResult({
|
|
145
|
+
status: "already_connected",
|
|
146
|
+
selectedConnections: selected,
|
|
147
|
+
instruction: "These accounts were already checked for this objective. Missing tool contracts are a tool availability problem. Do not request authorization again or invent a revision. Explain the unavailable capability and stop retrying the same tools."
|
|
148
|
+
});
|
|
149
|
+
const result = requireSessionConnection({
|
|
150
|
+
sessionKey: context.sessionKey,
|
|
151
|
+
principalId: principal.principalId,
|
|
152
|
+
agentId: principal.agentId ?? "main",
|
|
153
|
+
summary: params.purpose,
|
|
154
|
+
checkpoint: params.checkpoint,
|
|
155
|
+
needs: params.requirements.map((item) => {
|
|
156
|
+
const need = resolveConnectionCandidate(item.candidateRef);
|
|
157
|
+
if (item.accountId && !listConnectorConnections({
|
|
158
|
+
principalId: principal.principalId,
|
|
159
|
+
connectorId: need.connectorId
|
|
160
|
+
}).some((connection) => connection.accountId === item.accountId)) throw new Error("Unknown account for this app.");
|
|
161
|
+
return {
|
|
162
|
+
...need,
|
|
163
|
+
accountId: item.accountId,
|
|
164
|
+
accountSelector: item.accountSelector,
|
|
165
|
+
key: `${need.connectorId}:${item.accountId ?? item.accountSelector ?? "default"}`
|
|
166
|
+
};
|
|
167
|
+
})
|
|
168
|
+
});
|
|
169
|
+
publishConnectionWait(context.sessionKey);
|
|
170
|
+
return textResult(result);
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
const reviseSchema = Type.Object({
|
|
174
|
+
action: Type.Union([Type.Literal("update"), Type.Literal("cancel")]),
|
|
175
|
+
objective: Type.Optional(Type.String({
|
|
176
|
+
minLength: 1,
|
|
177
|
+
maxLength: 4e3
|
|
178
|
+
}))
|
|
179
|
+
});
|
|
43
180
|
return [
|
|
181
|
+
searchTool,
|
|
182
|
+
describeTool,
|
|
183
|
+
executeTool,
|
|
184
|
+
requireTool,
|
|
44
185
|
{
|
|
45
|
-
name: EXTERNAL_TOOL_NAMES.
|
|
46
|
-
label: "
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
async execute(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
label: "📋 External Tool Contract",
|
|
56
|
-
description: "Load exact contracts for up to three external tools returned by xopc_tool_search.",
|
|
57
|
-
parameters: ToolDescribeSchema,
|
|
58
|
-
async execute(_toolCallId, params) {
|
|
59
|
-
return textResult(await service.describe(params.toolRefs));
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
name: EXTERNAL_TOOL_NAMES.execute,
|
|
64
|
-
label: "▶️ External Tool Execute",
|
|
65
|
-
description: "Execute one external tool using its exact reference, contract revision, and validated arguments.",
|
|
66
|
-
parameters: ToolExecuteSchema,
|
|
67
|
-
async execute(toolCallId, params, signal, onUpdate) {
|
|
68
|
-
const result = await service.execute({
|
|
69
|
-
...params,
|
|
70
|
-
context: {
|
|
71
|
-
toolCallId,
|
|
72
|
-
signal,
|
|
73
|
-
onUpdate
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
return {
|
|
77
|
-
...result,
|
|
78
|
-
details: {
|
|
79
|
-
...result.details ?? {},
|
|
80
|
-
delegatedToolRef: params.toolRef,
|
|
81
|
-
delegatedToolRevision: params.revision
|
|
82
|
-
}
|
|
83
|
-
};
|
|
186
|
+
name: EXTERNAL_TOOL_NAMES.updateConnectionObjective,
|
|
187
|
+
label: "Update waiting objective",
|
|
188
|
+
parameters: reviseSchema,
|
|
189
|
+
description: "Use when the user supplements or explicitly cancels the objective waiting for a connection. Update with the complete revised objective including the requested time range. For unrelated work leave the waiting objective unchanged. Cancellation does not disconnect the account.",
|
|
190
|
+
async execute(_id, params) {
|
|
191
|
+
const context = getContext?.();
|
|
192
|
+
if (!context) throw new Error("No active conversation.");
|
|
193
|
+
if (params.action === "update" && !params.objective) throw new Error("The revised objective is required.");
|
|
194
|
+
reviseCurrentConnectionObjective(context.sessionKey, params.action === "update" ? params.objective : void 0);
|
|
195
|
+
return textResult({ status: params.action === "update" ? "updated" : "cancelled" });
|
|
84
196
|
}
|
|
85
197
|
}
|
|
86
198
|
];
|
|
@@ -40,7 +40,7 @@ function createDefaultExternalToolGatewayTools(deps) {
|
|
|
40
40
|
runtime: deps.endpointTools,
|
|
41
41
|
getCurrentContext: deps.getCurrentContext
|
|
42
42
|
}));
|
|
43
|
-
return createExternalToolGatewayTools(providers);
|
|
43
|
+
return createExternalToolGatewayTools(providers, deps.getCurrentContext);
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|
|
46
46
|
export { EXTERNAL_TOOL_NAMES, ExternalToolService, createDefaultExternalToolGatewayTools };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class ExternalToolSearchError extends Error {
|
|
2
|
+
readonly phase: 'create_session' | 'search';
|
|
3
|
+
readonly toolkits: string[];
|
|
4
|
+
constructor(phase: 'create_session' | 'search', toolkits: string[], cause: unknown);
|
|
5
|
+
}
|
|
6
|
+
/** Expose diagnostic metadata without returning provider payloads or credentials to the model. */
|
|
7
|
+
export declare function searchFailureDetails(error: unknown): {
|
|
8
|
+
phase: string;
|
|
9
|
+
toolkits?: string[];
|
|
10
|
+
code?: string | number;
|
|
11
|
+
status?: number;
|
|
12
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
//#region src/agent/external-tools/search-error.ts
|
|
2
|
+
var ExternalToolSearchError = class extends Error {
|
|
3
|
+
constructor(phase, toolkits, cause) {
|
|
4
|
+
super(`Composio tool discovery failed during ${phase}`, { cause });
|
|
5
|
+
this.phase = phase;
|
|
6
|
+
this.toolkits = toolkits;
|
|
7
|
+
this.name = "ExternalToolSearchError";
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
/** Expose diagnostic metadata without returning provider payloads or credentials to the model. */
|
|
11
|
+
function searchFailureDetails(error) {
|
|
12
|
+
const details = error instanceof ExternalToolSearchError ? {
|
|
13
|
+
phase: error.phase,
|
|
14
|
+
toolkits: error.toolkits
|
|
15
|
+
} : { phase: "search" };
|
|
16
|
+
const visited = /* @__PURE__ */ new Set();
|
|
17
|
+
let current = error;
|
|
18
|
+
while (current && typeof current === "object" && !visited.has(current)) {
|
|
19
|
+
visited.add(current);
|
|
20
|
+
const row = current;
|
|
21
|
+
if (details.code === void 0 && (typeof row.code === "number" || typeof row.code === "string" && /^[a-zA-Z0-9_.-]{1,100}$/.test(row.code))) details.code = row.code;
|
|
22
|
+
const status = row.status ?? row.statusCode;
|
|
23
|
+
if (details.status === void 0 && typeof status === "number") details.status = status;
|
|
24
|
+
current = row.cause;
|
|
25
|
+
}
|
|
26
|
+
return details;
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { ExternalToolSearchError, searchFailureDetails };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { searchFailureDetails } from './search-error.js';
|
|
1
2
|
import type { ExternalToolExecutionContext, ExternalToolProvider, ExternalToolSearchHit, ExternalToolSource, VersionedExternalToolDescriptor } from './types.js';
|
|
2
3
|
export declare class ExternalToolService {
|
|
3
4
|
private readonly providerBySource;
|
|
@@ -10,6 +11,9 @@ export declare class ExternalToolService {
|
|
|
10
11
|
}): Promise<{
|
|
11
12
|
tools: ExternalToolSearchHit[];
|
|
12
13
|
unavailableSources: ExternalToolSource[];
|
|
14
|
+
sourceErrors?: Array<ReturnType<typeof searchFailureDetails> & {
|
|
15
|
+
source: ExternalToolSource;
|
|
16
|
+
}>;
|
|
13
17
|
}>;
|
|
14
18
|
describe(toolRefs: string[]): Promise<{
|
|
15
19
|
tools: VersionedExternalToolDescriptor[];
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import { createLogger } from "../../utils/logger/index.js";
|
|
2
|
+
import { init_logger } from "../../utils/logger.js";
|
|
3
|
+
import { searchFailureDetails } from "./search-error.js";
|
|
1
4
|
import crypto from "node:crypto";
|
|
2
5
|
import Ajv2020 from "ajv/dist/2020.js";
|
|
3
6
|
//#region src/agent/external-tools/service.ts
|
|
7
|
+
init_logger();
|
|
8
|
+
const log = createLogger("ExternalToolService");
|
|
4
9
|
const DEFAULT_SEARCH_LIMIT = 8;
|
|
5
10
|
const MAX_SEARCH_LIMIT = 20;
|
|
6
11
|
const MAX_DESCRIBE_COUNT = 3;
|
|
@@ -49,11 +54,25 @@ var ExternalToolService = class {
|
|
|
49
54
|
hits: await provider.search(params.query)
|
|
50
55
|
})));
|
|
51
56
|
const unavailableSources = [];
|
|
57
|
+
const sourceErrors = [];
|
|
52
58
|
const hits = [];
|
|
53
59
|
for (const [index, result] of settled.entries()) if (result.status === "fulfilled") hits.push(...result.value.hits);
|
|
54
60
|
else {
|
|
55
61
|
const provider = selected[index];
|
|
56
|
-
if (provider)
|
|
62
|
+
if (provider) {
|
|
63
|
+
unavailableSources.push(provider.source);
|
|
64
|
+
const details = {
|
|
65
|
+
source: provider.source,
|
|
66
|
+
...searchFailureDetails(result.reason)
|
|
67
|
+
};
|
|
68
|
+
sourceErrors.push(details);
|
|
69
|
+
const errorMessage = result.reason instanceof Error ? result.reason.message : String(result.reason);
|
|
70
|
+
log.warn({
|
|
71
|
+
...details,
|
|
72
|
+
err: result.reason instanceof Error ? result.reason : void 0,
|
|
73
|
+
errorMessage
|
|
74
|
+
}, `External tool search failed for ${provider.source}: ${errorMessage}`);
|
|
75
|
+
}
|
|
57
76
|
}
|
|
58
77
|
const limit = Math.min(MAX_SEARCH_LIMIT, Math.max(1, params.limit ?? DEFAULT_SEARCH_LIMIT));
|
|
59
78
|
return {
|
|
@@ -67,7 +86,8 @@ var ExternalToolService = class {
|
|
|
67
86
|
title: hit.title,
|
|
68
87
|
summary: hit.summary.slice(0, 300)
|
|
69
88
|
})),
|
|
70
|
-
unavailableSources
|
|
89
|
+
unavailableSources,
|
|
90
|
+
...sourceErrors.length ? { sourceErrors } : {}
|
|
71
91
|
};
|
|
72
92
|
}
|
|
73
93
|
async describe(toolRefs) {
|
|
@@ -1,41 +1,18 @@
|
|
|
1
1
|
import type { Config } from '../../config/schema.js';
|
|
2
2
|
import type { AgentIPCMessage } from './types.js';
|
|
3
|
+
/** SQLite queue with acknowledgement after processing and renewable claims. */
|
|
3
4
|
export declare class AgentInbox {
|
|
4
|
-
private readonly
|
|
5
|
-
private
|
|
6
|
-
private
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*/
|
|
11
|
-
static forAgent(config: Config, agentId: string): AgentInbox;
|
|
12
|
-
/**
|
|
13
|
-
* Enqueue a message
|
|
14
|
-
*/
|
|
5
|
+
private readonly queue;
|
|
6
|
+
private timer?;
|
|
7
|
+
private processing;
|
|
8
|
+
private stopped;
|
|
9
|
+
constructor(agentId: string);
|
|
10
|
+
static forAgent(_config: Config, agentId: string): AgentInbox;
|
|
15
11
|
enqueue(message: AgentIPCMessage): Promise<void>;
|
|
16
|
-
/**
|
|
17
|
-
* Dequeue the oldest pending message
|
|
18
|
-
*/
|
|
19
|
-
dequeue(): Promise<AgentIPCMessage | null>;
|
|
20
|
-
/**
|
|
21
|
-
* Peek at pending messages without removing them
|
|
22
|
-
*/
|
|
23
12
|
peek(limit?: number): Promise<AgentIPCMessage[]>;
|
|
24
|
-
/**
|
|
25
|
-
* Count pending messages
|
|
26
|
-
*/
|
|
27
13
|
count(): Promise<number>;
|
|
28
|
-
|
|
29
|
-
* Watch for new messages
|
|
30
|
-
*/
|
|
14
|
+
clearProcessed(olderThanMs?: number): Promise<number>;
|
|
31
15
|
watch(handler: (msg: AgentIPCMessage) => Promise<void>): Promise<() => void>;
|
|
32
|
-
/**
|
|
33
|
-
* Stop watching
|
|
34
|
-
*/
|
|
35
16
|
stopWatching(): void;
|
|
36
|
-
/**
|
|
37
|
-
* Clear all processed messages
|
|
38
|
-
*/
|
|
39
|
-
clearProcessed(olderThanMs?: number): Promise<number>;
|
|
40
17
|
private processPending;
|
|
41
18
|
}
|