@xopcai/xopc 0.0.303 → 0.0.307
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/README.zh-CN.md +4 -4
- package/dist/browser-ext/dist/assets/{auth-B_9ZuGDx.js → auth-C3yV1y_l.js} +67 -22
- package/dist/browser-ext/dist/background.js +4 -4
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +3 -3
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/feishu/xopc.extension.json +0 -3
- package/dist/extensions/telegram/xopc.extension.json +1 -4
- package/dist/extensions/weixin/xopc.extension.json +0 -3
- package/dist/gateway/static/root/assets/{activity-store-DCi5rh4e.js → activity-store-wgSB2HYK.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Ch3DzUvP.js → agent-avatar-dicebear-CZeQo09T.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-BPsRb9Ck.js +1 -0
- package/dist/gateway/static/root/assets/{agents-DXHD-ST3.js → agents-BlrHMbRx.js} +1 -1
- package/dist/gateway/static/root/assets/{api-CAV9PN9i.js → api-BKHmTb0w.js} +1 -1
- package/dist/gateway/static/root/assets/api-DFOlahZv.js +1 -0
- package/dist/gateway/static/root/assets/app-management-settings-panel-Bzw4fQP8.js +1 -0
- package/dist/gateway/static/root/assets/appearance-settings-8GZpUXva.js +1 -0
- package/dist/gateway/static/root/assets/apps-page-BkQQtIxH.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-BKGzaVvM.js → archive-plugin-CQ2NaoHb.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-8bARdLnp.js → attachment-load-BFi1H7yJ.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BAEenyzx.js → automations-page-CDBXcii_.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-CUpiTTiY.js +6 -0
- package/dist/gateway/static/root/assets/{binary-plugins-Cv3GS9Eo.js → binary-plugins-D07eWmOx.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-D4ZIVQbk.css → block-editor-BdOTO0Yo.css} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-DUeb92LG.js → block-editor-CtVnjyYU.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-BGT0xoTv.js → browser-automation-inputs-BzkJog8e.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-D1O22WIf.js → browser-automations-page-DyrSbDdG.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-CqTxLpil.js +3 -0
- package/dist/gateway/static/root/assets/button-CS04eWY9.js +1 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BZ_-pnS6.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-DAD9qE3J.js +1 -0
- package/dist/gateway/static/root/assets/{channels-status-swr-C_icwbWj.js → channels-status-swr-B2JwuTjG.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-D-JYPVYl.js → chat-terminal-dock-B62SZdAo.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-Bcfp948A.js → computer-settings-page-ClSresNq.js} +1 -1
- package/dist/gateway/static/root/assets/connector-service-page-CPqVmNvx.js +1 -0
- package/dist/gateway/static/root/assets/connectors-page-BUQyg3CW.js +2 -0
- package/dist/gateway/static/root/assets/cron-expression-CTMi_tql.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-B71AJK50.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-UtoUm57Q.js → dependency-picker-DlyGK-kA.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-Bryx7gRM.js → desktop-pet-DGkbTE8_.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-BY8r9j66.js +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard-DzRrgd59.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-DQlFTVBx.js → extension-debug-page-L8Mm1n3A.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BSsqRDXh.js → extension-page-CFc4vSNU.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-DbVZv9ve.js → extension-settings-page-B5zWyHr3.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-D5AM8cyQ.js → gateway-config-swr-B6wHa6ZI.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-B53R0CA4.js +1 -0
- package/dist/gateway/static/root/assets/gateway-realtime-store-BLDgrJ30.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-D7qmTH4R.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-CSJWdnFs.js → gateway-startup-retry-DRzGnEV-.js} +1 -1
- package/dist/gateway/static/root/assets/{heartbeat-settings-Cxowc29b.js → heartbeat-settings-Glsl3X5b.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-s9hDQ8Hc.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-BNh604hw.js → image-generation-api-Ck_pyDom.js} +1 -1
- package/dist/gateway/static/root/assets/imports-page-ByBX7ome.js +1 -0
- package/dist/gateway/static/root/assets/index-RBCkv8a_.js +79 -0
- package/dist/gateway/static/root/assets/index-cFU4S35z.css +1 -0
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-C45RlO8a.js +1 -0
- package/dist/gateway/static/root/assets/local-app-workbench-page-DP0x2jpR.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CXPaPDGm.js → local-apps-page-C_AQc2bI.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DLK05Y1a.js → locale-store-msTfRK8P.js} +1 -1
- package/dist/gateway/static/root/assets/logs-page-DvM8Pyok.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-D1uwSutV.js +1 -0
- package/dist/gateway/static/root/assets/{markdown-view-B8maDRWh.js → markdown-view-BInabSKf.js} +2 -2
- package/dist/gateway/static/root/assets/{media-plugins-tSJ0CvcX.js → media-plugins-C4mhf13f.js} +1 -1
- package/dist/gateway/static/root/assets/messages-F74LVAiU.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-D35sErp2.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-8jCDklDn.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-CQx6H-GS.js → page-tabs-1go_BtX1.js} +1 -1
- package/dist/gateway/static/root/assets/{popover-select-DldSX8GX.js → popover-select-9i-ZtHXL.js} +1 -1
- package/dist/gateway/static/root/assets/{preview-open-alternatives-A3-bVtdy.js → preview-open-alternatives-DmoSC0j1.js} +1 -1
- package/dist/gateway/static/root/assets/{proactive-page-D46cR3sf.js → proactive-page-xAjKTIID.js} +1 -1
- package/dist/gateway/static/root/assets/{product-open-page-CujZXOea.js → product-open-page-gmi5LLwM.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-BUMQHy_N.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-DT-Mt7XR.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-BMFL4vis.js → registry-api-BSWtko7U.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Clz3byir.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-CR0qvq9C.js → runtime-tools-settings-panel-ClkOoxDl.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-BUD9lLEE.js → schema-form-BuEmLiaU.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-tQRwktKm.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-DqWg9XS5.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-BZPCUH6a.js → settings-form-section-Dor39QON.js} +1 -1
- package/dist/gateway/static/root/assets/{settings-page-XoHmqIdm.js → settings-page-Xj-yvIc8.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-BB_sMB7P.js +1 -0
- package/dist/gateway/static/root/assets/share-preview-page-BFWZoXdm.js +2 -0
- package/dist/gateway/static/root/assets/shares-settings-oDALm4b6.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-DmwelnfK.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-BE9JXz4U.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-CH-quGxZ.js → skills-page.utils-Ii8qeXhs.js} +1 -1
- package/dist/gateway/static/root/assets/{system-settings-panel-CGC7eBso.js → system-settings-panel-Di6OSO-0.js} +1 -1
- package/dist/gateway/static/root/assets/task-detail-page-D1AWszc7.js +1 -0
- package/dist/gateway/static/root/assets/theme-store-1SZ-HFHX.js +1 -0
- package/dist/gateway/static/root/assets/tunnel-api-DDOlOYlj.js +1 -0
- package/dist/gateway/static/root/assets/{use-autosave-BydB6x2K.js → use-autosave-CQ8uWNnB.js} +1 -1
- package/dist/gateway/static/root/assets/user-model-page-C00i4ea0.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-CPUDBcag.js → voice-api-key-field-COTzshjL.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-bZqN8-UF.js → voice-config-api-DgJML_uM.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-D_FmJbGH.js → work-discovery-overlay-_URrXbi4.js} +1 -1
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-CALs-1nd.js +3 -0
- package/dist/gateway/static/root/assets/workflows-page-BUiBjz6m.js +6 -0
- package/dist/gateway/static/root/channel-icons/feishu.svg +6 -12
- package/dist/gateway/static/root/connector-icons/SOURCES.md +12 -0
- package/dist/gateway/static/root/connector-icons/dingtalk-mark.svg +1 -0
- package/dist/gateway/static/root/connector-icons/tencent-meeting-mark.svg +37 -0
- package/dist/gateway/static/root/connector-icons/wps-calendar.svg +14 -0
- package/dist/gateway/static/root/connector-icons/wps-docs.svg +14 -0
- package/dist/gateway/static/root/connector-icons/wps-mail.svg +7 -0
- package/dist/gateway/static/root/index.html +14 -12
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/device-pairing.js +100 -7
- package/dist/packages/gateway-contract/src/gateway-scopes.js +53 -0
- package/dist/packages/gateway-contract/src/index.js +2 -0
- package/dist/packages/realtime-client/src/index.js +14 -2
- package/dist/packages/realtime-protocol/src/index.js +18 -14
- package/dist/src/agent/agent-instance-gateway.d.ts +2 -0
- package/dist/src/agent/agent-manager.d.ts +2 -0
- package/dist/src/agent/agent-manager.js +40 -12
- package/dist/src/agent/agent-scope.d.ts +4 -1
- package/dist/src/agent/agent-scope.js +19 -3
- package/dist/src/agent/commands/command-isolation.js +11 -9
- package/dist/src/agent/commands/command-registry.js +18 -33
- package/dist/src/agent/context/audit.js +12 -2
- package/dist/src/agent/context/coordinator.d.ts +13 -3
- package/dist/src/agent/context/coordinator.js +27 -11
- package/dist/src/agent/context/execution-context.js +42 -22
- package/dist/src/agent/context/execution-context.types.d.ts +4 -2
- package/dist/src/agent/context/execution-scope.d.ts +2 -2
- package/dist/src/agent/context/execution-scope.js +1 -1
- package/dist/src/agent/context/project-context.d.ts +2 -2
- package/dist/src/agent/context/project-context.js +3 -3
- package/dist/src/agent/embedded/run-for-session.d.ts +1 -0
- package/dist/src/agent/embedded/run-for-session.js +7 -1
- package/dist/src/agent/external-tools/composio-provider.js +83 -20
- package/dist/src/agent/external-tools/gateway-tools.js +2 -1
- package/dist/src/agent/inbound/attachment-pipeline.d.ts +2 -0
- package/dist/src/agent/inbound/attachment-pipeline.js +3 -3
- package/dist/src/agent/inbound/inbound-loop.js +1 -0
- package/dist/src/agent/inbound/turn-dispatcher.js +3 -3
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
- package/dist/src/agent/mcp/mcp-stdio-transport.js +5 -2
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +1 -1
- package/dist/src/agent/memory/compaction-promotion.js +7 -2
- package/dist/src/agent/memory/create-memory-manager.js +1 -0
- package/dist/src/agent/memory/manager.d.ts +6 -0
- package/dist/src/agent/memory/manager.js +74 -39
- package/dist/src/agent/memory/runtime.d.ts +3 -3
- package/dist/src/agent/memory/runtime.js +11 -4
- package/dist/src/agent/orchestration/agent-orchestrator.js +4 -1
- package/dist/src/agent/prompt/cache-boundary.d.ts +2 -0
- package/dist/src/agent/prompt/cache-boundary.js +10 -1
- package/dist/src/agent/service/build-direct-message-content.d.ts +1 -0
- package/dist/src/agent/service/build-direct-message-content.js +2 -1
- package/dist/src/agent/service/direct-turn-helpers.js +3 -2
- package/dist/src/agent/service/process-direct-streaming.d.ts +3 -1
- package/dist/src/agent/service/process-direct-streaming.js +3 -2
- package/dist/src/agent/service/webchat-tts.d.ts +0 -4
- package/dist/src/agent/service/webchat-tts.js +20 -19
- package/dist/src/agent/tools/factory.js +3 -3
- package/dist/src/agent/tools/knowledge-memory-tool.d.ts +2 -2
- package/dist/src/agent/tools/knowledge-memory-tool.js +7 -7
- package/dist/src/browser/native-messaging-host.js +2 -2
- package/dist/src/channels/attachments/voice-stt-webchat.d.ts +3 -0
- package/dist/src/channels/attachments/voice-stt-webchat.js +22 -9
- package/dist/src/cli/commands/agent.js +2 -0
- package/dist/src/cli/commands/config.js +8 -9
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/extension-marketplace.js +69 -44
- package/dist/src/cli/commands/extension-pack.js +0 -2
- package/dist/src/cli/commands/extension.js +4 -25
- package/dist/src/cli/commands/gateway/lifecycle.js +1 -1
- package/dist/src/cli/commands/onboard/gateway.js +2 -1
- package/dist/src/cli/utils/init-workspace-core.js +5 -2
- package/dist/src/config/index.js +2 -2
- package/dist/src/config/loader.d.ts +1 -0
- package/dist/src/config/loader.js +14 -1
- package/dist/src/config/schema.d.ts +22 -3
- package/dist/src/config/schema.js +13 -3
- package/dist/src/connectors/account-access.d.ts +4 -0
- package/dist/src/connectors/account-access.js +23 -0
- package/dist/src/connectors/approval-resume.d.ts +4 -0
- package/dist/src/connectors/approval-resume.js +23 -0
- package/dist/src/connectors/auth-provider-registry.d.ts +1 -0
- package/dist/src/connectors/auth-provider-registry.js +2 -1
- package/dist/src/connectors/authorization-attempts.d.ts +21 -0
- package/dist/src/connectors/authorization-attempts.js +33 -0
- package/dist/src/connectors/builtin-catalog.js +1 -3
- package/dist/src/connectors/catalog.js +2 -1
- package/dist/src/connectors/china-catalog.d.ts +2 -0
- package/dist/src/connectors/china-catalog.js +430 -0
- package/dist/src/connectors/composio-backends.d.ts +26 -0
- package/dist/src/connectors/composio-backends.js +65 -0
- package/dist/src/connectors/composio-catalog.js +2 -1
- package/dist/src/connectors/composio-managed-client.js +3 -1
- package/dist/src/connectors/composio-managed-events.js +5 -2
- package/dist/src/connectors/composio-session-types.d.ts +2 -0
- package/dist/src/connectors/composio-sessions.d.ts +11 -2
- package/dist/src/connectors/composio-sessions.js +137 -35
- package/dist/src/connectors/composio-triggers.js +4 -2
- package/dist/src/connectors/composio.d.ts +11 -8
- package/dist/src/connectors/composio.js +68 -84
- package/dist/src/connectors/connected-source-ingestion.js +4 -3
- package/dist/src/connectors/connection-recovery-service.js +25 -13
- package/dist/src/connectors/connector-identity.d.ts +2 -0
- package/dist/src/connectors/connector-identity.js +18 -5
- package/dist/src/connectors/content-enrichment.js +1 -1
- package/dist/src/connectors/instances.js +1 -7
- package/dist/src/connectors/learning-coordinator.js +4 -3
- package/dist/src/connectors/materialize.js +14 -1
- package/dist/src/connectors/policy.d.ts +1 -1
- package/dist/src/connectors/policy.js +1 -1
- package/dist/src/connectors/principal.js +24 -3
- package/dist/src/connectors/providers.d.ts +1 -0
- package/dist/src/connectors/providers.js +14 -2
- package/dist/src/connectors/runtime-adapter-registry.js +4 -9
- package/dist/src/connectors/secret-store.d.ts +4 -1
- package/dist/src/connectors/secret-store.js +7 -3
- package/dist/src/connectors/source-change-publisher.js +4 -2
- package/dist/src/connectors/types.d.ts +16 -11
- package/dist/src/connectors/workflow-preflight.d.ts +2 -1
- package/dist/src/connectors/workflow-preflight.js +20 -3
- package/dist/src/execution-environments/local-worktree-manager.js +17 -15
- package/dist/src/execution-environments/store.js +4 -2
- package/dist/src/execution-environments/types.d.ts +3 -0
- package/dist/src/execution-environments/types.js +2 -1
- package/dist/src/execution-environments/worktree-safety.d.ts +8 -0
- package/dist/src/execution-environments/worktree-safety.js +43 -0
- package/dist/src/extensions/activation-planner.d.ts +1 -1
- package/dist/src/extensions/activation-planner.js +1 -1
- package/dist/src/extensions/api-version.d.ts +4 -0
- package/dist/src/extensions/api-version.js +15 -0
- package/dist/src/extensions/api.d.ts +3 -9
- package/dist/src/extensions/api.js +26 -32
- package/dist/src/extensions/config-validation.d.ts +8 -0
- package/dist/src/extensions/config-validation.js +25 -0
- package/dist/src/extensions/extension-registry-impl.d.ts +20 -9
- package/dist/src/extensions/extension-registry-impl.js +79 -11
- package/dist/src/extensions/hooks.d.ts +1 -1
- package/dist/src/extensions/index.d.ts +2 -1
- package/dist/src/extensions/install-transaction.d.ts +2 -0
- package/dist/src/extensions/install-transaction.js +32 -21
- package/dist/src/extensions/install.js +18 -1
- package/dist/src/extensions/loader.d.ts +5 -5
- package/dist/src/extensions/loader.js +109 -47
- package/dist/src/extensions/lockfile.d.ts +3 -5
- package/dist/src/extensions/lockfile.js +41 -14
- package/dist/src/extensions/normalize-manifest.js +6 -60
- package/dist/src/extensions/sdk/index.d.ts +3 -2
- package/dist/src/extensions/sdk/index.js +2 -2
- package/dist/src/extensions/sdk/testing.js +0 -4
- package/dist/src/extensions/security.js +5 -7
- package/dist/src/extensions/types/core.d.ts +0 -5
- package/dist/src/extensions/types/index.d.ts +1 -1
- package/dist/src/extensions/types/manifest.d.ts +1 -25
- package/dist/src/extensions/types/providers.d.ts +1 -1
- package/dist/src/extensions/types/registration.d.ts +0 -12
- package/dist/src/extensions/update.js +71 -30
- package/dist/src/gateway/heartbeat/service.js +2 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +3 -1
- package/dist/src/gateway/hono/routes/auth-registry-extensions.js +47 -10
- package/dist/src/gateway/hono/routes/connectors.js +208 -17
- package/dist/src/gateway/hono/routes/context-sources.js +1 -1
- package/dist/src/gateway/hono/routes/devices.js +10 -7
- package/dist/src/gateway/hono/routes/endpoint-compatibility.js +6 -0
- package/dist/src/gateway/hono/routes/extension-gateway.js +0 -33
- package/dist/src/gateway/hono/routes/home.js +4 -1
- package/dist/src/gateway/hono/routes/lazy-bundles.js +0 -1
- package/dist/src/gateway/hono/routes/mcp.js +1 -1
- package/dist/src/gateway/hono/routes/realtime.js +30 -8
- package/dist/src/gateway/hono/routes/user-model.js +25 -6
- package/dist/src/gateway/index.js +4 -1
- package/dist/src/gateway/lock.d.ts +2 -0
- package/dist/src/gateway/lock.js +31 -14
- package/dist/src/gateway/run-loop.js +2 -1
- package/dist/src/gateway/security/gateway-scopes.d.ts +2 -5
- package/dist/src/gateway/security/gateway-scopes.js +3 -45
- package/dist/src/gateway/security/index.js +2 -1
- package/dist/src/gateway/service.js +11 -7
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/imports/importService.d.ts +1 -1
- package/dist/src/imports/inventory.js +16 -2
- package/dist/src/imports/productImport.js +5 -5
- package/dist/src/imports/types.d.ts +3 -3
- package/dist/src/infra/exec.d.ts +2 -2
- package/dist/src/infra/exec.js +32 -27
- package/dist/src/infra/run-command.js +15 -50
- package/dist/src/infra/update-restart.js +1 -1
- package/dist/src/knowledge/connected-knowledge-pipeline.js +13 -3
- package/dist/src/knowledge-memory/domain.d.ts +17 -1
- package/dist/src/knowledge-memory/index.js +2 -2
- package/dist/src/knowledge-memory/repository.d.ts +26 -4
- package/dist/src/knowledge-memory/repository.js +171 -36
- package/dist/src/mcp/channel-bridge.js +7 -3
- package/dist/src/media-understanding/registry.js +6 -1
- package/dist/src/migrations/knowledge-memory-read-policy-config.d.ts +2 -0
- package/dist/src/migrations/knowledge-memory-read-policy-config.js +48 -0
- package/dist/src/migrations/runner.js +2 -1
- package/dist/src/proactive/follow-ups.js +2 -1
- package/dist/src/process/bounded-output.d.ts +10 -0
- package/dist/src/process/bounded-output.js +41 -0
- package/dist/src/process/kill-tree.d.ts +6 -17
- package/dist/src/process/kill-tree.js +43 -75
- package/dist/src/process/process-spec.d.ts +39 -0
- package/dist/src/process/process-spec.js +13 -0
- package/dist/src/process/run-process.d.ts +4 -0
- package/dist/src/process/run-process.js +97 -0
- package/dist/src/providers/plugin-registry.d.ts +1 -1
- package/dist/src/providers/plugin-registry.js +6 -0
- package/dist/src/realtime/runtime.js +3 -1
- package/dist/src/session/store.js +1 -1
- package/dist/src/storage/sqlite/connection-wait-repository.d.ts +3 -0
- package/dist/src/storage/sqlite/connection-wait-repository.js +63 -2
- package/dist/src/storage/sqlite/connector-account-repository.d.ts +6 -0
- package/dist/src/storage/sqlite/connector-account-repository.js +35 -7
- package/dist/src/storage/sqlite/connector-repository.js +15 -10
- package/dist/src/storage/sqlite/connector-sync-policy-repository.js +1 -1
- package/dist/src/storage/sqlite/device-pairing-approval.js +1 -1
- package/dist/src/storage/sqlite/index.d.ts +1 -1
- package/dist/src/storage/sqlite/index.js +6 -4
- package/dist/src/storage/sqlite/migrations/180_execution_environment_ownership.sql +7 -0
- package/dist/src/storage/sqlite/migrations/181_knowledge_item_status_events.sql +12 -0
- package/dist/src/storage/sqlite/migrations/182_connector_account_policies.sql +92 -0
- package/dist/src/storage/sqlite/migrations/183_connector_backend_consistency.sql +20 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +7 -7
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/schema.sql +13 -0
- package/dist/src/storage/sqlite/transcript-repository.d.ts +4 -0
- package/dist/src/storage/sqlite/transcript-repository.js +36 -1
- package/dist/src/tasks/home-query-service.js +3 -3
- package/dist/src/tui/backends/embedded-backend.d.ts +24 -8
- package/dist/src/tui/backends/embedded-backend.js +114 -10
- package/dist/src/tui/backends/gateway-realtime-backend.d.ts +18 -0
- package/dist/src/tui/backends/gateway-realtime-backend.js +31 -4
- package/dist/src/tui/components/assistant-message.d.ts +4 -1
- package/dist/src/tui/components/assistant-message.js +10 -2
- package/dist/src/tui/components/cell-render-mode.d.ts +4 -0
- package/dist/src/tui/components/cell-render-mode.js +1 -0
- package/dist/src/tui/components/chat-log.d.ts +17 -4
- package/dist/src/tui/components/chat-log.js +68 -50
- package/dist/src/tui/components/custom-editor.d.ts +2 -2
- package/dist/src/tui/components/custom-editor.js +5 -1
- package/dist/src/tui/components/pending-input-preview.d.ts +9 -0
- package/dist/src/tui/components/pending-input-preview.js +33 -0
- package/dist/src/tui/components/semantic-cell.d.ts +17 -0
- package/dist/src/tui/components/semantic-cell.js +29 -0
- package/dist/src/tui/components/tool-execution.d.ts +5 -1
- package/dist/src/tui/components/tool-execution.js +33 -10
- package/dist/src/tui/components/transcript-overlay.d.ts +29 -0
- package/dist/src/tui/components/transcript-overlay.js +114 -0
- package/dist/src/tui/components/tui-bottom-bar.js +3 -1
- package/dist/src/tui/components/user-message.d.ts +5 -1
- package/dist/src/tui/components/user-message.js +12 -1
- package/dist/src/tui/extension-host/load-extensions.d.ts +1 -1
- package/dist/src/tui/extension-host/runtime-context.js +2 -1
- package/dist/src/tui/extension-host/runtime.d.ts +1 -1
- package/dist/src/tui/format-tui-hotkeys.js +8 -1
- package/dist/src/tui/tui-agent-events.js +31 -0
- package/dist/src/tui/tui-backend.d.ts +23 -11
- package/dist/src/tui/tui-backend.js +1 -9
- package/dist/src/tui/tui-chat-input-state.d.ts +25 -0
- package/dist/src/tui/tui-chat-input-state.js +36 -0
- package/dist/src/tui/tui-command-formatters.js +2 -1
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/tui/tui-startup-resources.js +1 -1
- package/dist/src/tui/tui-types.d.ts +2 -1
- package/dist/src/tui/tui-types.js +2 -1
- package/dist/src/tui/tui.js +122 -30
- package/dist/src/tui/xopc-tui-keybindings.d.ts +23 -3
- package/dist/src/tui/xopc-tui-keybindings.js +22 -2
- package/dist/src/user-context/access-policy.d.ts +2 -2
- package/dist/src/user-context/access-policy.js +10 -2
- package/dist/src/user-context/config.d.ts +23 -6
- package/dist/src/user-context/config.js +54 -7
- package/dist/src/voice/platform-streams.js +11 -1
- package/dist/src/voice/realtime/omniEngine.js +13 -1
- package/dist/src/voice/realtime/runtime.js +2 -1
- package/dist/src/voice/tts/audio.js +1 -1
- package/dist/src/voice/tts/speech-registry.js +6 -1
- package/dist/src/workflows/domain/definition.d.ts +1 -0
- package/dist/src/workflows/domain/validation.js +1 -1
- package/dist/src/workflows/service/workflow-run-service.js +14 -0
- package/dist/src/workflows/service/workflow-session-bridge.d.ts +1 -0
- package/dist/src/workflows/service/workflow-session-bridge.js +1 -0
- package/package.json +5 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-4oGrNj3m.js +0 -1
- package/dist/gateway/static/root/assets/api-fPapljyb.js +0 -1
- package/dist/gateway/static/root/assets/app-management-settings-panel-CdXnNtTg.js +0 -1
- package/dist/gateway/static/root/assets/appearance-settings-izNAyDhW.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-BQb3RCga.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-5vTl4x0h.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-CH9prS-f.js +0 -3
- package/dist/gateway/static/root/assets/button-CGlRPNzi.js +0 -1
- package/dist/gateway/static/root/assets/capabilities-settings-panel-DMURlZbj.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-CFBS3Yqy.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-DI1c3BMz.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-BJMBFKCh.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-BFRIn5y9.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-DFsyEJUr.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-C3TQVPRy.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-DUqVsB3X.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CLkumXdN.js +0 -1
- package/dist/gateway/static/root/assets/imports-page-DXNfRmk9.js +0 -1
- package/dist/gateway/static/root/assets/index-BLRIcVQa.css +0 -1
- package/dist/gateway/static/root/assets/index-gheM453N.js +0 -79
- package/dist/gateway/static/root/assets/keyboard-shortcuts-settings-5Hcec8Xf.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-BDg1-fcw.js +0 -2
- package/dist/gateway/static/root/assets/logs-page-BWZc5jwO.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-COa3PhMs.js +0 -1
- package/dist/gateway/static/root/assets/messages-C9h8SImu.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-D_YGzNcR.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-D1f2oI2-.js +0 -8
- package/dist/gateway/static/root/assets/project-detail-page-CRlD_Rwv.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-mmX0SavY.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-Cqr3K6T5.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-CPkvbdJP.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Cu0DAbeH.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-D8fQF1jZ.js +0 -1
- package/dist/gateway/static/root/assets/share-preview-page-BgHqwTuT.js +0 -2
- package/dist/gateway/static/root/assets/shares-settings-Id4vRHzI.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-BB2Fj_di.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BAwF4LpS.js +0 -2
- package/dist/gateway/static/root/assets/task-detail-page-BVjw812D.js +0 -1
- package/dist/gateway/static/root/assets/theme-store-KfFEGMlp.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-Do98Xk05.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-Nv68a4ak.js +0 -2
- package/dist/gateway/static/root/assets/workflow-run-setup-panel-1lZ_btki.js +0 -3
- package/dist/gateway/static/root/assets/workflows-page-DFOhccm3.js +0 -6
- package/dist/src/extensions/when-context.d.ts +0 -6
- package/dist/src/extensions/when-context.js +0 -26
- package/dist/src/extensions/when-expression.d.ts +0 -11
- package/dist/src/extensions/when-expression.js +0 -213
|
@@ -1,23 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getConnectorAccount, init_connector_account_repository, refreshConnectorAccountCurrent, updateConnectorAccount } from "../storage/sqlite/connector-account-repository.js";
|
|
2
|
+
import { getConnectorConnection, getConnectorInstallation, init_connector_repository, listConnectorConnections, upsertConnectorActionMetadata, upsertConnectorConnection, upsertConnectorInstallation } from "../storage/sqlite/connector-repository.js";
|
|
3
3
|
import { CredentialResolver, init_credentials } from "../auth/credentials.js";
|
|
4
|
+
import { activateComposioBackend, addComposioBackend, ensureComposioBackend, getComposioBackend, listComposioBackends, markComposioBackendVerified, resolveBackendKey } from "./composio-backends.js";
|
|
4
5
|
import { connectorIdentityKey } from "./connector-identity.js";
|
|
6
|
+
import { canAccessConnectorAccount, currentAccountConnections } from "./account-access.js";
|
|
5
7
|
import { ComposioSessionsAdapter, assertComposioAccessConfigured } from "./composio-sessions.js";
|
|
8
|
+
import { getConnectorLearningPlan } from "./learning-recipes.js";
|
|
6
9
|
import { COMPOSIO_AGENT_READY_TOOLKITS, COMPOSIO_TOOLKIT_DISPLAY_NAMES, connectorDefinitionFromComposioToolkit } from "./composio-catalog.js";
|
|
7
|
-
import {
|
|
10
|
+
import { randomUUID } from "node:crypto";
|
|
8
11
|
//#region src/connectors/composio.ts
|
|
9
12
|
init_credentials();
|
|
13
|
+
init_connector_account_repository();
|
|
14
|
+
init_connector_repository();
|
|
10
15
|
function toComposioConnection(connection) {
|
|
11
16
|
const toolkit = toolkitFromConnectionMetadata(connection);
|
|
12
17
|
const account = connection.accountId ? getConnectorAccount(connection.accountId) : void 0;
|
|
13
18
|
return {
|
|
19
|
+
supportsLearning: Boolean(getConnectorLearningPlan(toolkit)),
|
|
14
20
|
id: connection.id,
|
|
15
21
|
accountId: connection.accountId,
|
|
22
|
+
backendLabel: account?.backendId ? getComposioBackend(account.backendId)?.label : void 0,
|
|
23
|
+
accountEnabled: account?.enabled ?? false,
|
|
24
|
+
allowedAgentIds: account?.allowedAgentIds ?? null,
|
|
16
25
|
providerConnectionId: connection.providerConnectionId,
|
|
17
26
|
toolkit,
|
|
18
27
|
status: connection.status,
|
|
19
|
-
alias: connection.alias,
|
|
20
|
-
isDefault: connection.isDefault,
|
|
28
|
+
alias: account?.label ?? connection.alias,
|
|
21
29
|
isCurrentAuthorization: account?.currentConnectionId === connection.id,
|
|
22
30
|
accountEmail: typeof connection.identity.email === "string" ? connection.identity.email : void 0,
|
|
23
31
|
workspace: typeof connection.identity.workspace === "string" ? connection.identity.workspace : void 0,
|
|
@@ -29,7 +37,6 @@ function toComposioConnection(connection) {
|
|
|
29
37
|
lastError: connection.lastError
|
|
30
38
|
};
|
|
31
39
|
}
|
|
32
|
-
const COMPOSIO_API_KEY_PROVIDER = "connector-composio-api-key";
|
|
33
40
|
const COMPOSIO_SCOPE_ORDER = {
|
|
34
41
|
read: 1,
|
|
35
42
|
write: 2,
|
|
@@ -296,47 +303,7 @@ function canUseComposioAction(config, slug) {
|
|
|
296
303
|
scope: action.scope
|
|
297
304
|
};
|
|
298
305
|
}
|
|
299
|
-
const COMPOSIO_CONNECTORS = [{
|
|
300
|
-
id: "composio-api-key",
|
|
301
|
-
version: "1.0.0",
|
|
302
|
-
displayName: "Composio API Key",
|
|
303
|
-
description: "Store a Composio API key for direct-mode toolkit connectors.",
|
|
304
|
-
category: "automation",
|
|
305
|
-
kind: "composio",
|
|
306
|
-
source: "builtin",
|
|
307
|
-
branding: {
|
|
308
|
-
logoUrl: "/connector-icons/composio.svg",
|
|
309
|
-
source: "composio-catalog"
|
|
310
|
-
},
|
|
311
|
-
verificationLevel: "verified",
|
|
312
|
-
capabilities: [
|
|
313
|
-
"auth.apiKey",
|
|
314
|
-
"tools",
|
|
315
|
-
"events",
|
|
316
|
-
"workflows"
|
|
317
|
-
],
|
|
318
|
-
tags: [
|
|
319
|
-
"composio",
|
|
320
|
-
"oauth",
|
|
321
|
-
"integrations"
|
|
322
|
-
],
|
|
323
|
-
auth: { mode: "apiKey" },
|
|
324
|
-
setup: { secrets: [{
|
|
325
|
-
key: "COMPOSIO_API_KEY",
|
|
326
|
-
label: "Composio API key",
|
|
327
|
-
required: true
|
|
328
|
-
}] },
|
|
329
|
-
runtime: {
|
|
330
|
-
type: "composio",
|
|
331
|
-
toolkit: "composio",
|
|
332
|
-
role: "credential"
|
|
333
|
-
},
|
|
334
|
-
integrationStrategy: {
|
|
335
|
-
lane: "composio",
|
|
336
|
-
workload: "long_tail",
|
|
337
|
-
preferred: true
|
|
338
|
-
}
|
|
339
|
-
}, ...COMPOSIO_AGENT_READY_TOOLKITS.map((toolkit) => {
|
|
306
|
+
const COMPOSIO_CONNECTORS = [...COMPOSIO_AGENT_READY_TOOLKITS.map((toolkit) => {
|
|
340
307
|
return {
|
|
341
308
|
...connectorDefinitionFromComposioToolkit({
|
|
342
309
|
slug: toolkit,
|
|
@@ -348,29 +315,52 @@ const COMPOSIO_CONNECTORS = [{
|
|
|
348
315
|
source: "builtin"
|
|
349
316
|
};
|
|
350
317
|
})];
|
|
351
|
-
async function
|
|
352
|
-
const raw = input.secrets?.COMPOSIO_API_KEY;
|
|
353
|
-
const resolved = typeof raw === "string" && raw.trim().startsWith("secret://") ? consumeConnectorSetupSecretRef(raw) : raw;
|
|
354
|
-
if (typeof resolved !== "string" || !resolved.trim()) throw new Error("Composio API key is required.");
|
|
355
|
-
await resolver.saveApiKey(COMPOSIO_API_KEY_PROVIDER, resolved.trim(), { profileName: "default" });
|
|
356
|
-
}
|
|
357
|
-
async function configureComposioApiKey(apiKey, resolver = new CredentialResolver()) {
|
|
318
|
+
async function configureComposioApiKey(apiKey, resolver = new CredentialResolver(), replaceBackendId) {
|
|
358
319
|
const normalized = apiKey.trim();
|
|
359
320
|
if (!normalized) throw new Error("Composio API key is required.");
|
|
360
321
|
if (normalized.length > 4096) throw new Error("Composio API key is too long.");
|
|
361
|
-
|
|
362
|
-
await
|
|
322
|
+
const adapter = new ComposioSessionsAdapter({ apiKey: normalized });
|
|
323
|
+
await adapter.listToolkitCatalog({ principalId: LOCAL_OWNER_PRINCIPAL });
|
|
324
|
+
await ensureComposioBackend(resolver);
|
|
325
|
+
if (replaceBackendId) {
|
|
326
|
+
const backend = getComposioBackend(replaceBackendId);
|
|
327
|
+
if (!backend || backend.mode !== "byok" || !backend.credential_ref) throw new Error("Unknown Composio project.");
|
|
328
|
+
if (backend.credential_source === "environment") throw new Error("Update this key in the gateway environment, or add a locally stored project.");
|
|
329
|
+
await adapter.verifyConnections(listConnectorConnections({ principalId: LOCAL_OWNER_PRINCIPAL }).filter((connection) => getConnectorAccount(connection.accountId)?.backendId === backend.id && connection.status !== "revoked"));
|
|
330
|
+
await resolver.saveApiKey(backend.credential_ref, normalized, { profileName: "default" });
|
|
331
|
+
markComposioBackendVerified(backend.id);
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
for (const backend of listComposioBackends()) if (backend.mode === "byok" && await resolveBackendKey(backend, resolver) === normalized) {
|
|
335
|
+
activateComposioBackend(backend.id);
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
const id = randomUUID();
|
|
339
|
+
const credentialRef = `connector-composio-${id}`;
|
|
340
|
+
await resolver.saveApiKey(credentialRef, normalized, { profileName: "default" });
|
|
341
|
+
addComposioBackend({
|
|
342
|
+
id,
|
|
343
|
+
mode: "byok",
|
|
344
|
+
label: `Composio · ${id.slice(0, 6)}`,
|
|
345
|
+
credentialRef
|
|
346
|
+
});
|
|
347
|
+
markComposioBackendVerified(id);
|
|
348
|
+
activateComposioBackend(id);
|
|
363
349
|
}
|
|
364
350
|
async function listComposioConnections(resolver = new CredentialResolver()) {
|
|
365
|
-
|
|
351
|
+
const adapter = new ComposioSessionsAdapter({ resolver });
|
|
352
|
+
const verified = new Set((await adapter.syncConnections({ principalId: LOCAL_OWNER_PRINCIPAL })).map((connection) => connection.id));
|
|
366
353
|
const connections = listConnectorConnections({ principalId: LOCAL_OWNER_PRINCIPAL }).filter((connection) => connection.provider === "composio");
|
|
367
354
|
for (const accountId of new Set(connections.flatMap((connection) => connection.accountId ? [connection.accountId] : []))) refreshConnectorAccountCurrent(accountId);
|
|
368
|
-
return connections.map(toComposioConnection)
|
|
355
|
+
return connections.map((connection) => toComposioConnection(verified.has(connection.id) || connection.status !== "active" ? connection : {
|
|
356
|
+
...connection,
|
|
357
|
+
status: "unknown"
|
|
358
|
+
}));
|
|
369
359
|
}
|
|
370
360
|
async function inspectComposioConnectorHealth(toolkit, resolver = new CredentialResolver()) {
|
|
371
361
|
const normalizedToolkit = normalizeToolkit(toolkit);
|
|
372
362
|
try {
|
|
373
|
-
await assertComposioAccessConfigured(resolver);
|
|
363
|
+
if (!listConnectorConnections({ principalId: LOCAL_OWNER_PRINCIPAL }).length) await assertComposioAccessConfigured(resolver);
|
|
374
364
|
const connections = (await listComposioConnections(resolver)).filter((connection) => connection.toolkit.toLowerCase() === normalizedToolkit);
|
|
375
365
|
const byAccount = /* @__PURE__ */ new Map();
|
|
376
366
|
for (const connection of connections) {
|
|
@@ -422,7 +412,11 @@ async function inspectComposioConnectorHealth(toolkit, resolver = new Credential
|
|
|
422
412
|
}
|
|
423
413
|
}
|
|
424
414
|
async function getComposioToolkitAuthState(toolkit, resolver = new CredentialResolver()) {
|
|
425
|
-
|
|
415
|
+
const backend = await ensureComposioBackend(resolver);
|
|
416
|
+
return {
|
|
417
|
+
...await new ComposioSessionsAdapter({ resolver }).getToolkitAuthState(normalizeToolkit(toolkit)),
|
|
418
|
+
mode: backend.mode
|
|
419
|
+
};
|
|
426
420
|
}
|
|
427
421
|
function classifyComposioHealthError(error) {
|
|
428
422
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -464,7 +458,7 @@ function getComposioInstallationPolicy(config, toolkit) {
|
|
|
464
458
|
allowedAgentIds: existing?.allowedAgentIds ?? [],
|
|
465
459
|
maxScope: getComposioToolkitScope(config, normalizedToolkit),
|
|
466
460
|
confirmationPolicy: existing?.confirmationPolicy ?? "writes",
|
|
467
|
-
|
|
461
|
+
selectedAccountIds: existing?.selectedAccountIds ?? null,
|
|
468
462
|
createdAt: existing?.createdAt
|
|
469
463
|
});
|
|
470
464
|
}
|
|
@@ -474,16 +468,16 @@ function updateComposioInstallationPolicy(config, toolkit, patch) {
|
|
|
474
468
|
...current,
|
|
475
469
|
allowedAgentIds: patch.allowedAgentIds ?? current.allowedAgentIds,
|
|
476
470
|
confirmationPolicy: patch.confirmationPolicy ?? current.confirmationPolicy,
|
|
477
|
-
|
|
471
|
+
selectedAccountIds: patch.selectedAccountIds === void 0 ? current.selectedAccountIds : patch.selectedAccountIds
|
|
478
472
|
});
|
|
479
473
|
}
|
|
480
474
|
function updateComposioConnection(id, patch) {
|
|
481
475
|
const connection = getConnectorConnection(id);
|
|
482
476
|
if (!connection || connection.provider !== "composio" || connection.principalId !== LOCAL_OWNER_PRINCIPAL) throw new Error("Composio connection not found.");
|
|
477
|
+
if (connection.accountId && patch.alias !== void 0) updateConnectorAccount(connection.accountId, { label: patch.alias });
|
|
483
478
|
upsertConnectorConnection({
|
|
484
479
|
...connection,
|
|
485
|
-
alias: patch.alias === void 0 ? connection.alias : patch.alias.trim() || void 0
|
|
486
|
-
isDefault: patch.isDefault ?? connection.isDefault
|
|
480
|
+
alias: patch.alias === void 0 ? connection.alias : patch.alias.trim() || void 0
|
|
487
481
|
});
|
|
488
482
|
return toComposioConnection(getConnectorConnection(id));
|
|
489
483
|
}
|
|
@@ -509,6 +503,7 @@ async function startComposioAuthorize(connectorId, toolkit, resolver = new Crede
|
|
|
509
503
|
if (!authorization.connectUrl) throw new Error("Composio authorize did not return a connect URL.");
|
|
510
504
|
return {
|
|
511
505
|
toolkit: authorization.toolkit,
|
|
506
|
+
attemptId: authorization.attemptId,
|
|
512
507
|
connectUrl: authorization.connectUrl,
|
|
513
508
|
connectionId: authorization.connectionId
|
|
514
509
|
};
|
|
@@ -558,24 +553,13 @@ async function executeComposioTool(params, resolver = new CredentialResolver())
|
|
|
558
553
|
if (allowed.ok === false) throw new Error(allowed.reason);
|
|
559
554
|
if (!allowed.toolkit) throw new Error(`Unknown Composio toolkit for action: ${params.slug}`);
|
|
560
555
|
const connectorId = `composio-${allowed.toolkit}`;
|
|
561
|
-
const installation =
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
confirmationPolicy: "writes",
|
|
569
|
-
selectedConnectionIds: []
|
|
570
|
-
});
|
|
571
|
-
const connection = listConnectorConnections({
|
|
572
|
-
principalId: LOCAL_OWNER_PRINCIPAL,
|
|
573
|
-
connectorId
|
|
574
|
-
}).find((candidate) => candidate.status === "active" && candidate.isDefault) ?? listConnectorConnections({
|
|
575
|
-
principalId: LOCAL_OWNER_PRINCIPAL,
|
|
576
|
-
connectorId
|
|
577
|
-
}).find((candidate) => candidate.status === "active");
|
|
578
|
-
const result = await new ComposioSessionsAdapter({ resolver }).executeWithPolicy({
|
|
556
|
+
const installation = getConnectorInstallation(`${connectorId}-${LOCAL_OWNER_PRINCIPAL}`);
|
|
557
|
+
if (!installation) throw new Error("Connector policy is unavailable.");
|
|
558
|
+
const adapter = new ComposioSessionsAdapter({ resolver });
|
|
559
|
+
const connections = currentAccountConnections((await adapter.syncConnections({ principalId: LOCAL_OWNER_PRINCIPAL })).filter((candidate) => canAccessConnectorAccount(candidate, installation)));
|
|
560
|
+
const connection = params.accountId ? connections.find((candidate) => candidate.accountId === params.accountId) : connections.length === 1 ? connections[0] : void 0;
|
|
561
|
+
if (!connection) throw new Error("Select an available account explicitly.");
|
|
562
|
+
const result = await adapter.executeWithPolicy({
|
|
579
563
|
context: {
|
|
580
564
|
principalId: LOCAL_OWNER_PRINCIPAL,
|
|
581
565
|
toolkits: [allowed.toolkit],
|
|
@@ -592,10 +576,10 @@ async function executeComposioTool(params, resolver = new CredentialResolver())
|
|
|
592
576
|
cachedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
593
577
|
},
|
|
594
578
|
args: params.arguments && typeof params.arguments === "object" && !Array.isArray(params.arguments) ? params.arguments : {},
|
|
595
|
-
confirmed:
|
|
579
|
+
confirmed: false
|
|
596
580
|
});
|
|
597
581
|
if (result.decision !== "allowed") throw new Error(result.reason);
|
|
598
582
|
return result.result;
|
|
599
583
|
}
|
|
600
584
|
//#endregion
|
|
601
|
-
export { COMPOSIO_CONNECTORS, canUseComposioAction, configureComposioApiKey, executeComposioTool, getComposioInstallationPolicy, getComposioToolkitAuthState, getComposioToolkitScope, getConfiguredComposioAuthConfigs, inspectComposioConnectorHealth, isComposioActionAllowedByCatalog, listComposioConnections, listComposioTools, refreshComposioConnection, revokeComposioConnection,
|
|
585
|
+
export { COMPOSIO_CONNECTORS, canUseComposioAction, configureComposioApiKey, executeComposioTool, getComposioInstallationPolicy, getComposioToolkitAuthState, getComposioToolkitScope, getConfiguredComposioAuthConfigs, inspectComposioConnectorHealth, isComposioActionAllowedByCatalog, listComposioConnections, listComposioTools, refreshComposioConnection, revokeComposioConnection, scopeForComposioAction, setComposioToolkitScope, startComposioAuthorize, toolkitFromComposioSlug, updateComposioConnection, updateComposioInstallationPolicy };
|
|
@@ -2,6 +2,7 @@ import { createLogger } from "../utils/logger/index.js";
|
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { getConnectorInstallation, listConnectorConnections } from "../storage/sqlite/connector-repository.js";
|
|
4
4
|
import "../storage/sqlite/index.js";
|
|
5
|
+
import { canAccessConnectorAccount, currentAccountConnections } from "./account-access.js";
|
|
5
6
|
import { ComposioSessionsAdapter } from "./composio-sessions.js";
|
|
6
7
|
import { decodeConnectedSourceCursor, encodeConnectedSourceCursor } from "./connected-source-cursor.js";
|
|
7
8
|
import { scopeForComposioAction } from "./composio.js";
|
|
@@ -288,11 +289,11 @@ async function ingestComposioConnectedSource(input) {
|
|
|
288
289
|
const installation = getConnectorInstallation(`${connectorId}-local-owner`);
|
|
289
290
|
if (!installation?.enabled) throw new Error("Connector installation is not enabled.");
|
|
290
291
|
if (installation.allowedAgentIds.length && !installation.allowedAgentIds.includes(input.agentId)) throw new Error("This agent is not allowed to sync from the connector.");
|
|
291
|
-
const activeConnections = listConnectorConnections({
|
|
292
|
+
const activeConnections = currentAccountConnections(listConnectorConnections({
|
|
292
293
|
principalId: "local-owner",
|
|
293
294
|
connectorId
|
|
294
|
-
}).filter((connection) => connection
|
|
295
|
-
const connection = input.connectionId ? activeConnections.find((candidate) => candidate.id === input.connectionId) : activeConnections.
|
|
295
|
+
}).filter((connection) => canAccessConnectorAccount(connection, installation, input.agentId)));
|
|
296
|
+
const connection = input.connectionId ? activeConnections.find((candidate) => candidate.id === input.connectionId) : activeConnections.length === 1 ? activeConnections[0] : void 0;
|
|
296
297
|
if (!connection) throw new Error("No active connector account is available for connected source ingestion.");
|
|
297
298
|
if (!connection.accountId) throw new Error("The connector authorization is not assigned to an account.");
|
|
298
299
|
const adapter = input.adapter ?? new ComposioSessionsAdapter();
|
|
@@ -3,17 +3,18 @@ import { init_logger } from "../utils/logger.js";
|
|
|
3
3
|
import { getSqliteDatabase, init_transaction } from "../storage/sqlite/transaction.js";
|
|
4
4
|
import { readCurrentTranscriptId } from "../storage/sqlite/session-instance-repository.js";
|
|
5
5
|
import { getSessionInputState, init_session_input_repository } from "../storage/sqlite/session-input-repository.js";
|
|
6
|
+
import { getConnectorAccount, init_connector_account_repository } from "../storage/sqlite/connector-account-repository.js";
|
|
7
|
+
import { getConnectorConnection, getConnectorInstallation, init_connector_repository, listConnectorConnections, upsertConnectorInstallation } from "../storage/sqlite/connector-repository.js";
|
|
6
8
|
import { cancelConnectionObjective, getActiveConnectionWait, getConnectionWait, init_connection_wait_repository, listConnectionWaitsToCheck, publishConnectionWait, queueConnectionResolution, updateConnectionWait } from "../storage/sqlite/connection-wait-repository.js";
|
|
7
9
|
import { init_session_repository } from "../storage/sqlite/session-repository.js";
|
|
8
|
-
import {
|
|
9
|
-
import { getConnectorAccount } from "../storage/sqlite/connector-account-repository.js";
|
|
10
|
+
import { canAccessConnectorAccount, currentAccountConnections } from "./account-access.js";
|
|
10
11
|
import { ComposioSessionsAdapter } from "./composio-sessions.js";
|
|
11
12
|
import { getConfiguredComposioAuthConfigs, isComposioActionAllowedByCatalog, scopeForComposioAction } from "./composio.js";
|
|
12
13
|
import { getConnectorDefinition } from "./catalog.js";
|
|
14
|
+
import { listConnectorInstances } from "./instances.js";
|
|
13
15
|
import { capabilityActions, isToolInputSchema, missingConnectionCapabilities } from "./connection-capabilities.js";
|
|
14
16
|
import { connectorPrincipalForSession } from "./principal.js";
|
|
15
17
|
import { resolveConnectionCandidate } from "./connection-candidates.js";
|
|
16
|
-
import { listConnectorInstances } from "./instances.js";
|
|
17
18
|
import { installConnector } from "./install.js";
|
|
18
19
|
import { persistConfigMutation } from "../config/config-mutation.js";
|
|
19
20
|
import { randomUUID } from "node:crypto";
|
|
@@ -22,6 +23,8 @@ init_transaction();
|
|
|
22
23
|
init_session_repository();
|
|
23
24
|
init_session_input_repository();
|
|
24
25
|
init_connection_wait_repository();
|
|
26
|
+
init_connector_repository();
|
|
27
|
+
init_connector_account_repository();
|
|
25
28
|
init_logger();
|
|
26
29
|
const log = createLogger("Connectors:Recovery");
|
|
27
30
|
const SCOPE_ORDER = {
|
|
@@ -88,12 +91,13 @@ var ConnectionRecoveryService = class {
|
|
|
88
91
|
const instance = listConnectorInstances(this.deps.getConfig()).find((instance) => instance.connectorId === need.connectorId);
|
|
89
92
|
const installation = getConnectorInstallation(`${need.connectorId}-${wait.principalId}`);
|
|
90
93
|
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"];
|
|
91
|
-
const blocked = scopeBlocked || instance?.enabled === false || installation?.enabled === false || Boolean(installation?.allowedAgentIds.length && !installation.allowedAgentIds.includes(wait.agentId));
|
|
92
94
|
const all = listConnectorConnections({
|
|
93
95
|
principalId: wait.principalId,
|
|
94
96
|
connectorId: need.connectorId
|
|
95
97
|
});
|
|
96
|
-
const
|
|
98
|
+
const requested = need.accountId ? all.find((connection) => connection.accountId === need.accountId) : void 0;
|
|
99
|
+
const blocked = scopeBlocked || instance?.enabled === false || installation?.enabled === false || installation?.selectedAccountIds?.length === 0 || Boolean(installation && requested && !canAccessConnectorAccount(requested, installation, wait.agentId)) || Boolean(installation?.allowedAgentIds.length && !installation.allowedAgentIds.includes(wait.agentId));
|
|
100
|
+
const eligible = all.filter((connection) => connection.status === "active" && (!installation || canAccessConnectorAccount(connection, installation, wait.agentId)) && (!verifiedIds || verifiedIds.has(connection.id)) && (!need.accountId || connection.accountId === need.accountId) && (installation?.selectedAccountIds == null || Boolean(connection.accountId && installation.selectedAccountIds.includes(connection.accountId))));
|
|
97
101
|
const byAccount = /* @__PURE__ */ new Map();
|
|
98
102
|
for (const connection of eligible) {
|
|
99
103
|
const key = connection.accountId ?? connection.id;
|
|
@@ -102,7 +106,7 @@ var ConnectionRecoveryService = class {
|
|
|
102
106
|
if (!previous || connection.id === preferredId || previous.id !== preferredId && connection.updatedAt > previous.updatedAt) byAccount.set(key, connection);
|
|
103
107
|
}
|
|
104
108
|
const active = [...byAccount.values()];
|
|
105
|
-
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;
|
|
109
|
+
const selected = !verifiedIds && need.unavailable ? void 0 : need.attempt ? active.find((connection) => connection.providerConnectionId === need.attempt?.connectionId) : need.accountId ? active.find((connection) => connection.accountId === need.accountId) : need.connectionId ? active.find((connection) => connection.id === need.connectionId) : active.length === 1 && !need.accountSelector ? active[0] : void 0;
|
|
106
110
|
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) => [
|
|
107
111
|
"expired",
|
|
108
112
|
"revoked",
|
|
@@ -115,11 +119,12 @@ var ConnectionRecoveryService = class {
|
|
|
115
119
|
return {
|
|
116
120
|
...need,
|
|
117
121
|
alternatives,
|
|
122
|
+
accountId: selected?.accountId ?? need.accountId,
|
|
118
123
|
connectionId: selected?.id ?? need.connectionId,
|
|
119
124
|
phase,
|
|
120
125
|
accounts: active.map((connection) => ({
|
|
121
|
-
id: connection.
|
|
122
|
-
label: connection.
|
|
126
|
+
id: connection.accountId,
|
|
127
|
+
label: [getConnectorAccount(connection.accountId)?.label, connection.identity.email ?? connection.identity.name ?? connection.accountId].filter(Boolean).join(" · ")
|
|
123
128
|
})),
|
|
124
129
|
...need.capabilityError && selected ? { reason: need.capabilityError } : {},
|
|
125
130
|
...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." } : {}
|
|
@@ -154,7 +159,7 @@ var ConnectionRecoveryService = class {
|
|
|
154
159
|
allowedAgentIds: [],
|
|
155
160
|
maxScope: "read",
|
|
156
161
|
confirmationPolicy: "writes",
|
|
157
|
-
|
|
162
|
+
selectedAccountIds: null
|
|
158
163
|
});
|
|
159
164
|
}
|
|
160
165
|
async checkCapabilities(wait, verified) {
|
|
@@ -175,10 +180,15 @@ var ConnectionRecoveryService = class {
|
|
|
175
180
|
const definition = getConnectorDefinition(need.connectorId);
|
|
176
181
|
if (definition?.runtime.type !== "composio" || definition.runtime.role !== "toolkit") throw new Error("Unsupported connector");
|
|
177
182
|
const toolkit = definition.runtime.toolkit;
|
|
183
|
+
const selected = views.find((view) => view.key === need.key);
|
|
184
|
+
const connection = selected?.connectionId ? getConnectorConnection(selected.connectionId) : void 0;
|
|
178
185
|
const result = await (await this.adapter.createSession({
|
|
179
186
|
principalId: wait.principalId,
|
|
180
187
|
toolkits: [toolkit],
|
|
181
|
-
|
|
188
|
+
backendId: selected?.accountId ? getConnectorAccount(selected.accountId)?.backendId : void 0,
|
|
189
|
+
...typeof connection?.metadata.providerPrincipalId === "string" ? { providerPrincipalId: connection.metadata.providerPrincipalId } : {},
|
|
190
|
+
...connection ? { connectedAccounts: { [toolkit]: [connection.providerConnectionId] } } : {},
|
|
191
|
+
authConfigs: typeof connection?.metadata.authConfigId === "string" ? { [toolkit]: connection.metadata.authConfigId } : void 0
|
|
182
192
|
})).search({
|
|
183
193
|
query: `${toolkit} ${need.capabilities.join(" ")} ${capabilityActions(need).flat().join(" ")}`,
|
|
184
194
|
toolkits: [toolkit]
|
|
@@ -303,6 +313,8 @@ var ConnectionRecoveryService = class {
|
|
|
303
313
|
const auth = await this.adapter.authorize({
|
|
304
314
|
principalId: wait.principalId,
|
|
305
315
|
toolkit: definition.runtime.toolkit,
|
|
316
|
+
expectedAccountId: need.accountId,
|
|
317
|
+
backendId: need.accountId ? getConnectorAccount(need.accountId)?.backendId : void 0,
|
|
306
318
|
installationId,
|
|
307
319
|
authConfigId: getConfiguredComposioAuthConfigs(config, [definition.runtime.toolkit])?.[definition.runtime.toolkit]
|
|
308
320
|
});
|
|
@@ -336,7 +348,7 @@ var ConnectionRecoveryService = class {
|
|
|
336
348
|
const latest = getConnectionWait(wait.id);
|
|
337
349
|
if (!latest || latest.version !== wait.version || latest.status !== "open") throw new Error("WAIT_CHANGED");
|
|
338
350
|
let needs = wait.needs.map((need) => {
|
|
339
|
-
const authorized = fresh.find((item) => item.providerConnectionId === need.attempt?.connectionId && item.status === "active");
|
|
351
|
+
const authorized = fresh.find((item) => item.providerConnectionId === need.attempt?.connectionId && item.status === "active" && item.connectorId === need.connectorId && (!need.accountId || item.accountId === need.accountId));
|
|
340
352
|
return authorized ? {
|
|
341
353
|
...need,
|
|
342
354
|
unavailable: false,
|
|
@@ -352,8 +364,8 @@ var ConnectionRecoveryService = class {
|
|
|
352
364
|
});
|
|
353
365
|
if (action.action === "select_account") {
|
|
354
366
|
const need = needs.find((item) => item.key === action.needKey);
|
|
355
|
-
const connection = fresh.find((item) => item.
|
|
356
|
-
if (!need || !connection || !this.view(wait, verified).needs.find((item) => item.key === need.key)?.accounts.some((item) => item.id === connection.
|
|
367
|
+
const connection = currentAccountConnections(fresh).find((item) => item.accountId === action.accountId && item.connectorId === need?.connectorId);
|
|
368
|
+
if (!need || !connection || !this.view(wait, verified).needs.find((item) => item.key === need.key)?.accounts.some((item) => item.id === connection.accountId)) throw new Error("Account is unavailable.");
|
|
357
369
|
needs = needs.map((item) => item.key === need.key ? {
|
|
358
370
|
...item,
|
|
359
371
|
connectionId: connection.id,
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ConnectorConnection } from './types.js';
|
|
2
|
+
/** Only verified display fields may enter model context or account summaries. */
|
|
3
|
+
export declare function connectorIdentitySummary(identity: Record<string, unknown>): Record<string, string>;
|
|
2
4
|
export declare function normalizeConnectorIdentity(toolkit: string, result: unknown): ConnectorConnection['identity'];
|
|
3
5
|
export declare function connectorIdentityKey(toolkit: string, identity: Record<string, unknown>): string | undefined;
|
|
4
6
|
export declare function mergeConnectorIdentity(toolkit: string, current: Record<string, unknown>, incoming: Record<string, unknown>): Record<string, unknown>;
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
//#region src/connectors/connector-identity.ts
|
|
2
|
+
/** Only verified display fields may enter model context or account summaries. */
|
|
3
|
+
function connectorIdentitySummary(identity) {
|
|
4
|
+
return Object.fromEntries([
|
|
5
|
+
"email",
|
|
6
|
+
"username",
|
|
7
|
+
"displayName",
|
|
8
|
+
"workspace",
|
|
9
|
+
"workspaceId",
|
|
10
|
+
"userId",
|
|
11
|
+
"enterpriseId",
|
|
12
|
+
"botUserId"
|
|
13
|
+
].flatMap((key) => typeof identity[key] === "string" && identity[key].trim() ? [[key, identity[key].slice(0, 320)]] : []));
|
|
14
|
+
}
|
|
2
15
|
function object(value) {
|
|
3
16
|
if (!value || typeof value !== "object" || Array.isArray(value)) return {};
|
|
4
17
|
return value;
|
|
@@ -85,16 +98,16 @@ function mergeConnectorIdentity(toolkit, current, incoming) {
|
|
|
85
98
|
"googledrive",
|
|
86
99
|
"github",
|
|
87
100
|
"slack"
|
|
88
|
-
].includes(normalizedToolkit)) return {
|
|
101
|
+
].includes(normalizedToolkit)) return connectorIdentitySummary({
|
|
89
102
|
...current,
|
|
90
103
|
...incoming
|
|
91
|
-
};
|
|
104
|
+
});
|
|
92
105
|
const normalized = Object.fromEntries(Object.entries(normalizeConnectorIdentity(normalizedToolkit, incoming)).filter(([, value]) => value !== void 0 && value !== null && value !== ""));
|
|
93
|
-
return {
|
|
106
|
+
return connectorIdentitySummary({
|
|
94
107
|
...current,
|
|
95
108
|
...incoming,
|
|
96
109
|
...normalized
|
|
97
|
-
};
|
|
110
|
+
});
|
|
98
111
|
}
|
|
99
112
|
//#endregion
|
|
100
|
-
export { connectorIdentityKey, mergeConnectorIdentity, normalizeConnectorIdentity };
|
|
113
|
+
export { connectorIdentityKey, connectorIdentitySummary, mergeConnectorIdentity, normalizeConnectorIdentity };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getKnowledgeSourceItem, listKnowledgeSourceItems, upsertKnowledgeSourceItems } from "../storage/sqlite/knowledge-repository.js";
|
|
2
1
|
import { getConnectorConnection, getConnectorInstallation } from "../storage/sqlite/connector-repository.js";
|
|
2
|
+
import { getKnowledgeSourceItem, listKnowledgeSourceItems, upsertKnowledgeSourceItems } from "../storage/sqlite/knowledge-repository.js";
|
|
3
3
|
import "../storage/sqlite/index.js";
|
|
4
4
|
import { ComposioSessionsAdapter } from "./composio-sessions.js";
|
|
5
5
|
import { ConnectedKnowledgePipeline } from "../knowledge/connected-knowledge-pipeline.js";
|
|
@@ -27,7 +27,7 @@ function connectorInstanceFromRecord(instanceId, record) {
|
|
|
27
27
|
const definition = connectorDefinitionFromManagedMarker(markerRecord) ?? getConnectorDefinition(connectorId);
|
|
28
28
|
const runtime = record.runtime && typeof record.runtime === "object" && !Array.isArray(record.runtime) ? record.runtime : {};
|
|
29
29
|
const runtimeType = runtime.type;
|
|
30
|
-
if (runtimeType !== "composio" && runtimeType !== "
|
|
30
|
+
if (runtimeType !== "composio" && runtimeType !== "memorySource") return [];
|
|
31
31
|
if (runtimeType === "composio" && (typeof runtime.toolkit !== "string" || runtime.role !== "credential" && runtime.role !== "toolkit")) return [];
|
|
32
32
|
const enabled = markerRecord.enabled !== false;
|
|
33
33
|
return [{
|
|
@@ -47,12 +47,6 @@ function connectorInstanceFromRecord(instanceId, record) {
|
|
|
47
47
|
id: instanceId,
|
|
48
48
|
toolkit: runtime.toolkit,
|
|
49
49
|
role: runtime.role
|
|
50
|
-
} : runtimeType === "channel" ? {
|
|
51
|
-
type: "channel",
|
|
52
|
-
id: instanceId
|
|
53
|
-
} : runtimeType === "nativeTool" ? {
|
|
54
|
-
type: "nativeTool",
|
|
55
|
-
id: instanceId
|
|
56
50
|
} : {
|
|
57
51
|
type: "memorySource",
|
|
58
52
|
id: instanceId
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createLogger } from "../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../utils/logger.js";
|
|
3
3
|
import { claimNextConnectorLearningJob, enqueueConnectorLearningJob, listConnectorLearningJobs, recoverStaleConnectorLearningJobs, setConnectorLearningPaused, updateConnectorLearningJob } from "../storage/sqlite/connector-learning-repository.js";
|
|
4
|
-
import { getConnectorInstallation, listConnectorConnections, upsertConnectorConnection } from "../storage/sqlite/connector-repository.js";
|
|
5
4
|
import { getConnectorAccount, reconcileConnectorAccount } from "../storage/sqlite/connector-account-repository.js";
|
|
5
|
+
import { getConnectorInstallation, listConnectorConnections, upsertConnectorConnection } from "../storage/sqlite/connector-repository.js";
|
|
6
6
|
import { getConnectorSyncPolicyForConnection } from "../storage/sqlite/connector-sync-policy-repository.js";
|
|
7
7
|
import "../storage/sqlite/index.js";
|
|
8
8
|
import { connectorIdentityKey, normalizeConnectorIdentity } from "./connector-identity.js";
|
|
@@ -74,8 +74,9 @@ function startConnectorLearningCoordinator(options) {
|
|
|
74
74
|
const connection = listConnectorConnections().find((item) => item.id === connectionId && item.status === "active");
|
|
75
75
|
if (!connection) return null;
|
|
76
76
|
if (!connection.accountId) throw new Error(`Connector account is missing for connection ${connection.id}.`);
|
|
77
|
+
if (!getConnectorAccount(connection.accountId)?.enabled) return null;
|
|
77
78
|
const syncPolicy = getConnectorSyncPolicyForConnection(connection.id);
|
|
78
|
-
if (request.reason !== "manual" && syncPolicy?.scanEnabled
|
|
79
|
+
if (request.reason !== "manual" && syncPolicy?.scanEnabled !== true) return null;
|
|
79
80
|
const definition = getConnectorDefinition(connection.connectorId);
|
|
80
81
|
if (definition?.runtime.type !== "composio" || definition.runtime.role !== "toolkit") return null;
|
|
81
82
|
if (!getConnectorLearningPlan(definition.runtime.toolkit)) return null;
|
|
@@ -275,7 +276,7 @@ function startConnectorLearningCoordinator(options) {
|
|
|
275
276
|
...retention
|
|
276
277
|
}, "Connected source retention pruned");
|
|
277
278
|
const syncPolicy = getConnectorSyncPolicyForConnection(job.connectionId);
|
|
278
|
-
if (syncPolicy?.scanEnabled
|
|
279
|
+
if (syncPolicy?.scanEnabled !== true) return;
|
|
279
280
|
const intervalMinutes = syncPolicy?.intervalMinutes ?? plan.intervalMinutes;
|
|
280
281
|
const nextRunAt = Date.now() + intervalMinutes * 6e4;
|
|
281
282
|
enqueueConnection(getConnectorAccount(job.accountId)?.currentConnectionId ?? job.connectionId, {
|
|
@@ -4,6 +4,7 @@ import { createConnectorSecretReference } from "./secret-store.js";
|
|
|
4
4
|
init_schema();
|
|
5
5
|
const SERVER_ID_PATTERN = /^[a-z][a-z0-9_-]{0,63}$/;
|
|
6
6
|
const TEMPLATE_PATTERN = /^\{\{(secrets|config)\.([A-Za-z0-9_.-]+)\}\}$/;
|
|
7
|
+
const EMBEDDED_SECRET_PATTERN = /\{\{secrets\.([A-Za-z0-9_.-]+)\}\}/g;
|
|
7
8
|
function assertValidConnectorServerId(serverId) {
|
|
8
9
|
if (!SERVER_ID_PATTERN.test(serverId)) throw new Error("Connector server name must start with a lowercase letter and only contain lowercase letters, numbers, dashes, and underscores.");
|
|
9
10
|
}
|
|
@@ -14,7 +15,19 @@ function readInputValue(definition, input, scope, key) {
|
|
|
14
15
|
function resolveTemplateValue(value, definition, input) {
|
|
15
16
|
if (typeof value !== "string") return value;
|
|
16
17
|
const match = TEMPLATE_PATTERN.exec(value.trim());
|
|
17
|
-
if (!match)
|
|
18
|
+
if (!match) {
|
|
19
|
+
const matches = [...value.matchAll(EMBEDDED_SECRET_PATTERN)];
|
|
20
|
+
if (matches.length === 0) return value;
|
|
21
|
+
if (matches.length > 1) throw new Error("Connector template values may contain at most one embedded secret.");
|
|
22
|
+
const embedded = matches[0];
|
|
23
|
+
const token = embedded[0];
|
|
24
|
+
const fieldKey = embedded[1];
|
|
25
|
+
const offset = embedded.index ?? 0;
|
|
26
|
+
return createConnectorSecretReference(definition.id, fieldKey, {
|
|
27
|
+
prefix: value.slice(0, offset),
|
|
28
|
+
suffix: value.slice(offset + token.length)
|
|
29
|
+
});
|
|
30
|
+
}
|
|
18
31
|
return readInputValue(definition, input, match[1], match[2]);
|
|
19
32
|
}
|
|
20
33
|
function materializeTemplate(value, definition, input) {
|
|
@@ -8,6 +8,6 @@ export declare function evaluateConnectorExecutionPolicy(input: {
|
|
|
8
8
|
installation: ConnectorInstallationPolicy;
|
|
9
9
|
action: Pick<ConnectorActionMetadata, 'scope' | 'curated'>;
|
|
10
10
|
agentId?: string;
|
|
11
|
-
|
|
11
|
+
accountId?: string;
|
|
12
12
|
confirmed?: boolean;
|
|
13
13
|
}): ConnectorPolicyEvaluation;
|
|
@@ -21,7 +21,7 @@ function evaluateConnectorExecutionPolicy(input) {
|
|
|
21
21
|
decision: "denied",
|
|
22
22
|
reason: "Agent is not allowed to use this connector."
|
|
23
23
|
};
|
|
24
|
-
if (installation.
|
|
24
|
+
if (installation.selectedAccountIds !== null && (!input.accountId || !installation.selectedAccountIds.includes(input.accountId))) return {
|
|
25
25
|
decision: "denied",
|
|
26
26
|
reason: "Connection is not allowed by this connector policy."
|
|
27
27
|
};
|
|
@@ -1,17 +1,38 @@
|
|
|
1
|
+
import { getSessionMetadata, init_session_repository } from "../storage/sqlite/session-repository.js";
|
|
1
2
|
import { getConversationRouting } from "../storage/sqlite/conversation-repository.js";
|
|
2
3
|
import { init_session_key } from "../routing/session-key.js";
|
|
3
4
|
//#region src/connectors/principal.ts
|
|
4
5
|
init_session_key();
|
|
6
|
+
init_session_repository();
|
|
5
7
|
function connectorPrincipalForSession(conversationId) {
|
|
6
|
-
|
|
8
|
+
let parsed = getConversationRouting(conversationId);
|
|
9
|
+
const agentId = parsed?.agentId;
|
|
10
|
+
const visited = /* @__PURE__ */ new Set();
|
|
11
|
+
while (conversationId && parsed?.source === "workflow" && !visited.has(conversationId) && visited.size < 8) {
|
|
12
|
+
visited.add(conversationId);
|
|
13
|
+
const metadata = getSessionMetadata(conversationId);
|
|
14
|
+
const parent = metadata?.parentConversationId ?? metadata?.customData?.parentConversationId;
|
|
15
|
+
if (typeof parent !== "string") {
|
|
16
|
+
if (metadata?.sessionType === "workflow-run") return {
|
|
17
|
+
principalId: "local-owner",
|
|
18
|
+
agentId,
|
|
19
|
+
isLocalOwner: true
|
|
20
|
+
};
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
const parentRouting = getConversationRouting(parent);
|
|
24
|
+
if (!parentRouting) break;
|
|
25
|
+
conversationId = parent;
|
|
26
|
+
parsed = parentRouting;
|
|
27
|
+
}
|
|
7
28
|
if (!parsed || parsed.source === "cli" || parsed.source === "webchat") return {
|
|
8
29
|
principalId: "local-owner",
|
|
9
|
-
agentId
|
|
30
|
+
agentId,
|
|
10
31
|
isLocalOwner: true
|
|
11
32
|
};
|
|
12
33
|
return {
|
|
13
34
|
principalId: `channel:${parsed.source}:${parsed.accountId}:${parsed.peerKind}:${parsed.peerId}`,
|
|
14
|
-
agentId
|
|
35
|
+
agentId,
|
|
15
36
|
isLocalOwner: false
|
|
16
37
|
};
|
|
17
38
|
}
|
|
@@ -6,5 +6,6 @@ export type ConnectorProvider = {
|
|
|
6
6
|
};
|
|
7
7
|
export declare const builtinConnectorProvider: ConnectorProvider;
|
|
8
8
|
export declare const composioConnectorProvider: ConnectorProvider;
|
|
9
|
+
export declare const chinaConnectorProvider: ConnectorProvider;
|
|
9
10
|
export declare function listConnectorProviders(): ConnectorProvider[];
|
|
10
11
|
export declare function listConnectorProviderDefinitions(): ConnectorDefinition[];
|