@xopcai/xopc 0.0.309 → 0.0.311
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{activity-store-XKNYlFUI.js → activity-store-DVUTs1fk.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-1S2TFECE.js → agent-avatar-dicebear-zKINl7UH.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-D2ePZKdY.js +1 -0
- package/dist/gateway/static/root/assets/{agents-CPqUMtCL.js → agents-BiD9STyv.js} +1 -1
- package/dist/gateway/static/root/assets/{api-BEUEE4f2.js → api-_aHQA8bd.js} +1 -1
- package/dist/gateway/static/root/assets/{app-link-BiBXVEvp.js → app-link-wamYbNUl.js} +1 -1
- package/dist/gateway/static/root/assets/{app-management-settings-panel-CgVBSqzu.js → app-management-settings-panel-C94LAxyt.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-CoWdCokb.js → appearance-settings-CP01zHvC.js} +1 -1
- package/dist/gateway/static/root/assets/apps-page-B7DmSJQj.js +1 -0
- package/dist/gateway/static/root/assets/{archive-plugin-C3ZA6LRS.js → archive-plugin-SwWFt5MT.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CdgS6_zy.js → attachment-load-DdTFml9l.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BtHL2hpg.js → automations-page-Kmr5WVFp.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-bkijiu-Y.js +7 -0
- package/dist/gateway/static/root/assets/{binary-plugins-CiDhtq_H.js → binary-plugins-47UTtDNq.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-Br00T83w.js → block-editor-DvzZkMG8.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-D2tILykA.js → browser-automation-inputs-C611KRBx.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page-BVuEmryB.js → browser-automations-page-DrUKNL9X.js} +2 -2
- package/dist/gateway/static/root/assets/browser-settings-page-Dhf_MWCf.js +3 -0
- package/dist/gateway/static/root/assets/capabilities-settings-panel-BCubrDf8.js +8 -0
- package/dist/gateway/static/root/assets/channels-settings-e4T1DEfN.js +1 -0
- package/dist/gateway/static/root/assets/{chat-terminal-dock-JsMtzDao.js → chat-terminal-dock-Bg_m7HUE.js} +2 -2
- package/dist/gateway/static/root/assets/{chunk-KS7C4IRE-Cq1tE_3b.js → chunk-KS7C4IRE-BMYIfy9x.js} +2 -2
- package/dist/gateway/static/root/assets/computer-settings-page-CosCmVsT.js +1 -0
- package/dist/gateway/static/root/assets/{connector-service-page-DZFNUTiN.js → connector-service-page-BL-hSR7_.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-C0WWxnxJ.js +2 -0
- package/dist/gateway/static/root/assets/date-picker-DqYFVasF.js +1 -0
- package/dist/gateway/static/root/assets/{dependency-picker-B-BcuG1y.js → dependency-picker-DCyyFLKp.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CdBBhhdY.js → desktop-pet-CFnnpRA_.js} +1 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-U5wWRH4c.js +1 -0
- package/dist/gateway/static/root/assets/device-pairing-wizard-BhHxvFO1.js +1 -0
- package/dist/gateway/static/root/assets/{extension-debug-page-BFp5eKtY.js → extension-debug-page-DA8WJ3-E.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-DL3vyyH6.js → extension-page-C2BIB88m.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-BXtvdAsY.js → extension-settings-page-kpYo979N.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-xAOGtenO.js → gateway-config-swr-DUDX42qY.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-BuaTsMSi.js → gateway-realtime-CGOW0-b4.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-D4um_sV7.js +1 -0
- package/dist/gateway/static/root/assets/gateway-settings-CE9t1yTa.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-startup-retry-BwDxKHd4.js → gateway-startup-retry-Cf8OxlvY.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-C7Ezx8Du.js +1 -0
- package/dist/gateway/static/root/assets/{image-generation-api-wGMeI_yW.js → image-generation-api-D2YorS--.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-zexFT5Rq.js → imports-page-NPk698vI.js} +1 -1
- package/dist/gateway/static/root/assets/index-1wIKA-kM.css +1 -0
- package/dist/gateway/static/root/assets/index-DxYitLp8.js +79 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-CutG9zLh.js → keyboard-shortcuts-settings-BhreF0_O.js} +1 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CPmynb3x.js +2 -0
- package/dist/gateway/static/root/assets/{local-apps-page-CJy6I7Dt.js → local-apps-page-DOZZBdqj.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-DPZ79W1-.js → locale-store-DA0Z5jM_.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-egGcPHNi.js → logs-page-M8kz26yo.js} +2 -2
- package/dist/gateway/static/root/assets/{management-settings-BQhIOELc.js → management-settings-JLqHYQvY.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-p2P5hP1U.js → markdown-view-BDpcjR_Z.js} +1 -1
- package/dist/gateway/static/root/assets/markdown-view-DSjfHfaW.css +1 -0
- package/dist/gateway/static/root/assets/{media-plugins-CsBylqlN.js → media-plugins-B75SWUJd.js} +1 -1
- package/dist/gateway/static/root/assets/messages-4BtQKYlM.js +3 -0
- package/dist/gateway/static/root/assets/note-detail-panel-B_Ft0M32.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-C32mxSD-.js +8 -0
- package/dist/gateway/static/root/assets/{page-tabs-ChQ4jJFs.js → page-tabs-CMlQUzT6.js} +1 -1
- package/dist/gateway/static/root/assets/{popover-select-9i-ZtHXL.js → popover-select-B-GDnZO9.js} +1 -1
- package/dist/gateway/static/root/assets/preview-open-alternatives-cZ2hszQT.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-BADxWEdP.js → product-open-page-CPoSbglF.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-DYttWua0.js +1 -0
- package/dist/gateway/static/root/assets/projects-page-D46drWbl.js +1 -0
- package/dist/gateway/static/root/assets/{registry-api-B_e_nZSN.js → registry-api-C0DCx3wv.js} +1 -1
- package/dist/gateway/static/root/assets/remote-access-hub-C9n9Nuhi.js +1 -0
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-D-pwiIyp.js → runtime-tools-settings-panel-bMLWRApp.js} +2 -2
- package/dist/gateway/static/root/assets/scenes-page-Dw3hmHAr.js +1 -0
- package/dist/gateway/static/root/assets/{schema-form-IWmb05DX.js → schema-form-UVJV_7AS.js} +1 -1
- package/dist/gateway/static/root/assets/sessions-page-C8P6ff91.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-whpUsAy3.js +1 -0
- package/dist/gateway/static/root/assets/{settings-form-section-B0veRBZs.js → settings-form-section-BqzOqonM.js} +1 -1
- package/dist/gateway/static/root/assets/settings-page-DQ9RJ8-b.js +1 -0
- package/dist/gateway/static/root/assets/settings-page-layout-D3Spald3.js +1 -0
- package/dist/gateway/static/root/assets/{settings-shell-layer-context-DCp6ykjQ.js → settings-shell-layer-context-BTQUDoJ2.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-C8u601m8.js +1 -0
- package/dist/gateway/static/root/assets/{share-preview-page-CirpgkfD.js → share-preview-page-BcgYzA7y.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-Bv-2rZ8e.js +1 -0
- package/dist/gateway/static/root/assets/skill-reload-api-LM-cgWUS.js +1 -0
- package/dist/gateway/static/root/assets/skills-page-ggmb7rCW.js +2 -0
- package/dist/gateway/static/root/assets/{skills-page.utils-B42mpWKV.js → skills-page.utils-ADABzrtk.js} +1 -1
- package/dist/gateway/static/root/assets/system-settings-panel-DfkcW_Za.js +1 -0
- package/dist/gateway/static/root/assets/task-detail-page-DC4yqDFd.js +1 -0
- package/dist/gateway/static/root/assets/{theme-store-BFbj_2Tu.js → theme-store-CegIlB8d.js} +1 -1
- package/dist/gateway/static/root/assets/tunnel-api-CTuwTdMm.js +1 -0
- package/dist/gateway/static/root/assets/use-autosave-5ZDd9XKh.js +1 -0
- package/dist/gateway/static/root/assets/user-model-page-BFKFhdZ0.js +2 -0
- package/dist/gateway/static/root/assets/{voice-api-key-field-BZbKQ8HT.js → voice-api-key-field-D3urfd-n.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-SKCeQLrH.js → voice-config-api-DTyMdGOR.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-BRVTTXNG.js → work-discovery-overlay-JzM3Ylbs.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-D2kuwv5e.js → workflow-run-setup-panel-Bn2CtRdB.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-BiCmt98A.js +6 -0
- package/dist/gateway/static/root/connector-icons/SOURCES.md +0 -2
- package/dist/gateway/static/root/index.html +17 -20
- package/dist/gateway/static/root/notification-sw.js +1 -1
- package/dist/package.js +1 -1
- package/dist/packages/gateway-contract/src/notifications.js +12 -11
- package/dist/packages/gateway-contract/src/proactive.js +6 -6
- package/dist/packages/gateway-contract/src/project-monitoring.js +4 -4
- package/dist/packages/gateway-contract/src/project-operating.js +1 -4
- package/dist/src/agent/agent-manager.d.ts +2 -6
- package/dist/src/agent/agent-manager.js +2 -1
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/commands/command-registry.js +1 -1
- package/dist/src/agent/context/execution-scope.js +1 -1
- package/dist/src/agent/external-tools/cliProvider.d.ts +47 -0
- package/dist/src/agent/external-tools/cliProvider.js +317 -0
- package/dist/src/agent/external-tools/composio-provider.js +3 -3
- package/dist/src/agent/external-tools/gateway-tools.js +8 -2
- package/dist/src/agent/external-tools/index.js +6 -0
- package/dist/src/agent/external-tools/service.js +1 -1
- package/dist/src/agent/external-tools/types.d.ts +1 -1
- package/dist/src/agent/external-tools/types.js +1 -0
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +1 -1
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +1 -1
- package/dist/src/agent/memory/turn-provenance.js +2 -1
- package/dist/src/agent/service/parse-outbound-session-key.js +1 -1
- package/dist/src/agent/service.js +1 -0
- package/dist/src/agent/service.types.d.ts +2 -0
- package/dist/src/agent/tools/factory.d.ts +2 -0
- package/dist/src/agent/tools/factory.js +3 -2
- package/dist/src/agent/tools/search/providers/xopc-cloud.d.ts +20 -0
- package/dist/src/agent/tools/search/providers/xopc-cloud.js +56 -0
- package/dist/src/agent/tools/search/registry.d.ts +4 -2
- package/dist/src/agent/tools/search/registry.js +5 -3
- package/dist/src/agent/tools/xopc-use-tool.d.ts +4 -2
- package/dist/src/agent/tools/xopc-use-tool.js +46 -43
- package/dist/src/automations/service/automation-service.d.ts +0 -4
- package/dist/src/automations/service/automation-service.js +0 -31
- package/dist/src/capabilities/store-connector.js +46 -0
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/project.js +1 -1
- package/dist/src/config/schema.d.ts +4 -4
- package/dist/src/config/schema.js +2 -12
- package/dist/src/config/web-patch.js +0 -5
- package/dist/src/connectors/account-selection.d.ts +14 -0
- package/dist/src/connectors/account-selection.js +26 -0
- package/dist/src/connectors/china-catalog.js +93 -226
- package/dist/src/connectors/cli/adapterRegistry.d.ts +4 -0
- package/dist/src/connectors/cli/adapterRegistry.js +26 -0
- package/dist/src/connectors/cli/adapters/lark.d.ts +2 -0
- package/dist/src/connectors/cli/adapters/lark.js +143 -0
- package/dist/src/connectors/cli/adapters/larkShortcuts.d.ts +3 -0
- package/dist/src/connectors/cli/adapters/larkShortcuts.js +64 -0
- package/dist/src/connectors/cli/adapters/wecom.d.ts +2 -0
- package/dist/src/connectors/cli/adapters/wecom.js +97 -0
- package/dist/src/connectors/cli/adapters/wps365/bundle.js +575 -0
- package/dist/src/connectors/cli/adapters/wps365.d.ts +2 -0
- package/dist/src/connectors/cli/adapters/wps365.js +115 -0
- package/dist/src/connectors/cli/assets.d.ts +3 -0
- package/dist/src/connectors/cli/assets.js +44 -0
- package/dist/src/connectors/cli/authorization.d.ts +16 -0
- package/dist/src/connectors/cli/authorization.js +184 -0
- package/dist/src/connectors/cli/distributions.d.ts +4 -0
- package/dist/src/connectors/cli/distributions.js +69 -0
- package/dist/src/connectors/cli/installer.d.ts +5 -0
- package/dist/src/connectors/cli/installer.js +102 -0
- package/dist/src/connectors/cli/lifecycle.d.ts +1 -0
- package/dist/src/connectors/cli/lifecycle.js +19 -0
- package/dist/src/connectors/cli/process.d.ts +18 -0
- package/dist/src/connectors/cli/process.js +100 -0
- package/dist/src/connectors/cli/protocol.d.ts +10 -0
- package/dist/src/connectors/cli/protocol.js +63 -0
- package/dist/src/connectors/cli/runtime.d.ts +10 -0
- package/dist/src/connectors/cli/runtime.js +93 -0
- package/dist/src/connectors/cli/store.d.ts +35 -0
- package/dist/src/connectors/cli/store.js +121 -0
- package/dist/src/connectors/cli/types.d.ts +73 -0
- package/dist/src/connectors/composio-backends.js +1 -1
- package/dist/src/connectors/composio-sessions.d.ts +1 -0
- package/dist/src/connectors/composio-sessions.js +8 -3
- package/dist/src/connectors/composio.js +1 -1
- package/dist/src/connectors/connection-candidates.js +22 -3
- package/dist/src/connectors/connection-recovery-service.d.ts +1 -0
- package/dist/src/connectors/connection-recovery-service.js +53 -8
- package/dist/src/connectors/health.js +52 -0
- package/dist/src/connectors/instances.js +5 -1
- package/dist/src/connectors/lifecycle.js +2 -0
- package/dist/src/connectors/principal.js +2 -1
- package/dist/src/connectors/runtime-adapter-registry.js +31 -0
- package/dist/src/connectors/types.d.ts +13 -1
- package/dist/src/connectors/usage.js +1 -1
- package/dist/src/connectors/workflow-preflight.js +8 -4
- package/dist/src/extensions/install.js +1 -1
- package/dist/src/gateway/hono/app.d.ts +2 -0
- package/dist/src/gateway/hono/app.js +4 -2
- package/dist/src/gateway/hono/lib/config-payload.d.ts +0 -15
- package/dist/src/gateway/hono/lib/config-payload.js +0 -11
- package/dist/src/gateway/hono/routes/cli-connectors.d.ts +3 -0
- package/dist/src/gateway/hono/routes/cli-connectors.js +219 -0
- package/dist/src/gateway/hono/routes/config-patch/gateway.d.ts +2 -2
- package/dist/src/gateway/hono/routes/config-patch/gateway.js +0 -59
- package/dist/src/gateway/hono/routes/config.js +0 -16
- package/dist/src/gateway/hono/routes/connectors.js +21 -22
- package/dist/src/gateway/hono/routes/deps.d.ts +2 -0
- package/dist/src/gateway/hono/routes/lazy-bundles.js +4 -17
- package/dist/src/gateway/hono/routes/projects.js +1 -1
- package/dist/src/gateway/hono/routes/public-gateway.js +0 -1
- package/dist/src/gateway/hono/routes/scenes.d.ts +3 -0
- package/dist/src/gateway/hono/routes/scenes.js +142 -0
- package/dist/src/gateway/hono/routes/tasks.js +0 -46
- package/dist/src/gateway/hono/routes/user-model.js +54 -1
- package/dist/src/gateway/scenes/browserNotifications.d.ts +4 -0
- package/dist/src/gateway/scenes/browserNotifications.js +54 -0
- package/dist/src/gateway/scenes/host.d.ts +34 -0
- package/dist/src/gateway/scenes/host.js +129 -0
- package/dist/src/gateway/scenes/mailContext.d.ts +32 -0
- package/dist/src/gateway/scenes/mailContext.js +235 -0
- package/dist/src/gateway/security/gateway-scopes.js +0 -4
- package/dist/src/gateway/security/index.js +1 -1
- package/dist/src/gateway/service/config-coordinator.d.ts +1 -10
- package/dist/src/gateway/service/config-coordinator.js +0 -16
- package/dist/src/gateway/service/run-gateway-agent.js +1 -1
- package/dist/src/gateway/service.d.ts +4 -25
- package/dist/src/gateway/service.js +44 -99
- package/dist/src/gateway/session-context-summary.js +2 -1
- package/dist/src/heartbeat/index.js +1 -1
- package/dist/src/infra/unhandled-rejections.js +1 -1
- package/dist/src/migrations/runner.js +1 -4
- package/dist/src/notifications/browser-endpoint.d.ts +2 -0
- package/dist/src/notifications/browser-endpoint.js +13 -0
- package/dist/src/notifications/browserSubscriptions.d.ts +20 -0
- package/dist/src/notifications/browserSubscriptions.js +59 -0
- package/dist/src/notifications/browserTransport.d.ts +9 -0
- package/dist/src/notifications/browserTransport.js +64 -0
- package/dist/src/notifications/dispatch.d.ts +46 -0
- package/dist/src/notifications/dispatch.js +109 -0
- package/dist/src/notifications/domain-delivery.d.ts +21 -0
- package/dist/src/notifications/planner.js +0 -36
- package/dist/src/notifications/quietHours.d.ts +6 -0
- package/dist/src/notifications/quietHours.js +23 -0
- package/dist/src/notifications/resultOutbox.d.ts +23 -0
- package/dist/src/notifications/resultOutbox.js +49 -0
- package/dist/src/notifications/service.d.ts +18 -4
- package/dist/src/notifications/service.js +42 -61
- package/dist/src/notifications/store.d.ts +2 -1
- package/dist/src/notifications/store.js +7 -8
- package/dist/src/projects/project-service.d.ts +1 -4
- package/dist/src/projects/project-service.js +2 -30
- package/dist/src/projects/workspace.js +1 -1
- package/dist/src/providers/model-catalog-persistence.js +19 -1
- package/dist/src/providers/model-catalog-store.js +1 -0
- package/dist/src/providers/model-catalog-types.d.ts +17 -0
- package/dist/src/providers/xopc-cloud-model-source.js +27 -0
- package/dist/src/scenes/agentExecutor.d.ts +8 -0
- package/dist/src/scenes/agentExecutor.js +63 -0
- package/dist/src/scenes/contracts.d.ts +118 -0
- package/dist/src/scenes/contracts.js +145 -0
- package/dist/src/scenes/execution.d.ts +56 -0
- package/dist/src/scenes/execution.js +168 -0
- package/dist/src/scenes/httpServices.d.ts +34 -0
- package/dist/src/scenes/inbox.d.ts +16 -0
- package/dist/src/scenes/inbox.js +68 -0
- package/dist/src/scenes/mailContext.d.ts +20 -0
- package/dist/src/scenes/mailContext.js +106 -0
- package/dist/src/scenes/mailObservations.d.ts +20 -0
- package/dist/src/scenes/mailObservations.js +107 -0
- package/dist/src/scenes/maintenance.d.ts +3 -0
- package/dist/src/scenes/maintenance.js +24 -0
- package/dist/src/scenes/metrics.d.ts +35 -0
- package/dist/src/scenes/metrics.js +94 -0
- package/dist/src/scenes/notificationEligibility.d.ts +17 -0
- package/dist/src/scenes/notificationEligibility.js +72 -0
- package/dist/src/scenes/notificationPublication.d.ts +7 -0
- package/dist/src/scenes/notificationPublication.js +43 -0
- package/dist/src/scenes/preferences.d.ts +40 -0
- package/dist/src/scenes/preferences.js +108 -0
- package/dist/src/scenes/readiness.d.ts +7 -0
- package/dist/src/scenes/readiness.js +20 -0
- package/dist/src/scenes/repository.d.ts +174 -0
- package/dist/src/scenes/repository.js +740 -0
- package/dist/src/scenes/resultNotifications.d.ts +17 -0
- package/dist/src/scenes/resultNotifications.js +204 -0
- package/dist/src/scenes/runtime.d.ts +25 -0
- package/dist/src/scenes/runtime.js +101 -0
- package/dist/src/scenes/schedule.d.ts +9 -0
- package/dist/src/scenes/schedule.js +45 -0
- package/dist/src/scenes/service.d.ts +29 -0
- package/dist/src/scenes/service.js +116 -0
- package/dist/src/scenes/templates.d.ts +64 -0
- package/dist/src/scenes/templates.js +76 -0
- package/dist/src/scenes/userNotes.d.ts +10 -0
- package/dist/src/scenes/userNotes.js +34 -0
- package/dist/src/session/resolve-session.js +2 -1
- package/dist/src/session/store.js +2 -1
- package/dist/src/share/share-config.js +0 -5
- package/dist/src/share/site-share-config.js +0 -5
- package/dist/src/storage/sqlite/connection-wait-repository.js +20 -7
- package/dist/src/storage/sqlite/connection.js +1 -1
- package/dist/src/storage/sqlite/connector-account-repository.js +1 -0
- package/dist/src/storage/sqlite/connector-sync-policy-repository.d.ts +0 -4
- package/dist/src/storage/sqlite/connector-sync-policy-repository.js +3 -17
- package/dist/src/storage/sqlite/conversation-repository.js +2 -1
- package/dist/src/storage/sqlite/index.js +2 -1
- package/dist/src/storage/sqlite/migrations/187_cli_connectors.sql +34 -0
- package/dist/src/storage/sqlite/migrations/188_scene_storage.sql +2 -0
- package/dist/src/storage/sqlite/migrations/189_scene_source_health.sql +8 -0
- package/dist/src/storage/sqlite/migrations/conversation-backup.d.ts +2 -0
- package/dist/src/storage/sqlite/migrations/conversation-backup.js +7 -3
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +20 -44
- package/dist/src/storage/sqlite/migrations/scene-reset.d.ts +5 -0
- package/dist/src/storage/sqlite/migrations/scene-reset.js +40 -0
- package/dist/src/storage/sqlite/scenes-schema.d.ts +8 -0
- package/dist/src/storage/sqlite/scenes-schema.js +61 -0
- package/dist/src/storage/sqlite/schema.js +4 -10
- package/dist/src/storage/sqlite/schemas/notifications.sql +65 -0
- package/dist/src/storage/sqlite/schemas/scenes.sql +212 -0
- package/dist/src/storage/sqlite/session-read-repository.d.ts +8 -0
- package/dist/src/storage/sqlite/session-read-repository.js +35 -0
- package/dist/src/storage/sqlite/session-repository.d.ts +1 -1
- package/dist/src/storage/sqlite/session-repository.js +2 -25
- package/dist/src/storage/sqlite/sql-assets.d.ts +2 -0
- package/dist/src/storage/sqlite/sql-assets.js +18 -0
- package/dist/src/storage/sqlite/transaction.d.ts +2 -0
- package/dist/src/storage/sqlite/transaction.js +20 -1
- package/dist/src/tasks/home-query-service.d.ts +0 -2
- package/dist/src/tasks/home-query-service.js +13 -43
- package/dist/src/tasks/index.d.ts +0 -1
- package/dist/src/tasks/index.js +4 -5
- package/dist/src/tasks/project-operating-view-service.js +1 -4
- package/dist/src/tui/backends/embedded-backend.js +1 -1
- package/dist/src/tui/tui-commands.js +1 -1
- package/dist/src/user-model/goals.d.ts +10 -0
- package/dist/src/user-model/goals.js +29 -1
- package/dist/src/user-model/index.js +2 -2
- package/dist/src/voice/realtime/memory-context.js +2 -1
- package/dist/src/workflows/service/workflow-run-service.js +1 -1
- package/package.json +4 -2
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-f0-YFMUz.js +0 -1
- package/dist/gateway/static/root/assets/api-CN4id43t.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-CexHOcWg.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-onJPfmO6.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-BgVTyPFY.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-Dra8wj1S.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-CkxiMDJ4.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-Dtder4G_.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-DHerePwo.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-cl9ZrV4D.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-DAhdv_Xv.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-PacO1m3a.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-Gy03NgMI.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-aV25nKag.js +0 -1
- package/dist/gateway/static/root/assets/external-link-DjqjBmc3.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BG95uGVW.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-Dcr2Ikeh.js +0 -1
- package/dist/gateway/static/root/assets/globe-DSSGFWFn.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-DOy3alvT.js +0 -1
- package/dist/gateway/static/root/assets/home-page-CDm3dGVy.js +0 -1
- package/dist/gateway/static/root/assets/index-D-vczw_0.css +0 -1
- package/dist/gateway/static/root/assets/index-DJo4DimT.js +0 -79
- package/dist/gateway/static/root/assets/loader-circle-CifKLtgG.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-CwLvTwjn.js +0 -2
- package/dist/gateway/static/root/assets/markdown-view-Y68dCxuc.css +0 -1
- package/dist/gateway/static/root/assets/messages-BiYTyLJr.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-c2k5Uz6X.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-BLQWJMhf.js +0 -8
- package/dist/gateway/static/root/assets/preview-open-alternatives-9B5W7nVE.js +0 -1
- package/dist/gateway/static/root/assets/proactive-page-iOjI0d_e.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-BcxbQn2M.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-BuSvld0O.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-CFS8LQKW.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-DZjc__ok.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-C1SM5B93.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-CxRWyWYe.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-layout-X1x-2Cp9.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-D9Rl7Tec.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-CwCThBs0.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-DG6VGbOX.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-BdRJ2vnL.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-DXIZpAvU.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-QXo9LJly.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-Db2guRdW.js +0 -1
- package/dist/gateway/static/root/assets/use-autosave-DDY9qoXZ.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-CzPmMkaO.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-CQXtiYtq.js +0 -6
- package/dist/gateway/static/root/connector-icons/wps-calendar.svg +0 -14
- package/dist/gateway/static/root/connector-icons/wps-mail.svg +0 -7
- package/dist/src/connectors/source-change-publisher.d.ts +0 -17
- package/dist/src/connectors/source-change-publisher.js +0 -151
- package/dist/src/gateway/heartbeat/check-store.d.ts +0 -18
- package/dist/src/gateway/heartbeat/check-store.js +0 -74
- package/dist/src/gateway/heartbeat/index.d.ts +0 -1
- package/dist/src/gateway/heartbeat/index.js +0 -2
- package/dist/src/gateway/heartbeat/service.d.ts +0 -55
- package/dist/src/gateway/heartbeat/service.js +0 -228
- package/dist/src/gateway/hono/routes/proactive-control.d.ts +0 -3
- package/dist/src/gateway/hono/routes/proactive-control.js +0 -135
- package/dist/src/gateway/hono/routes/proactive.d.ts +0 -4
- package/dist/src/gateway/hono/routes/proactive.js +0 -164
- package/dist/src/gateway/hono/routes/workspace.d.ts +0 -3
- package/dist/src/gateway/hono/routes/workspace.js +0 -62
- package/dist/src/gateway/workspace-heartbeat-path.d.ts +0 -3
- package/dist/src/gateway/workspace-heartbeat-path.js +0 -14
- package/dist/src/migrations/conversation-routing-config.d.ts +0 -2
- package/dist/src/migrations/conversation-routing-config.js +0 -42
- package/dist/src/notifications/proactive-channel.d.ts +0 -8
- package/dist/src/notifications/proactive-channel.js +0 -60
- package/dist/src/notifications/proactive-policy.d.ts +0 -3
- package/dist/src/notifications/proactive-policy.js +0 -35
- package/dist/src/notifications/web-push.d.ts +0 -19
- package/dist/src/notifications/web-push.js +0 -185
- package/dist/src/proactive/actions/service.d.ts +0 -1
- package/dist/src/proactive/actions/service.js +0 -82
- package/dist/src/proactive/events/envelope.d.ts +0 -2
- package/dist/src/proactive/events/envelope.js +0 -54
- package/dist/src/proactive/events/product-event-bridge.d.ts +0 -7
- package/dist/src/proactive/events/product-event-bridge.js +0 -87
- package/dist/src/proactive/events/publisher.d.ts +0 -4
- package/dist/src/proactive/events/repository.d.ts +0 -9
- package/dist/src/proactive/events/repository.js +0 -63
- package/dist/src/proactive/events/types.d.ts +0 -44
- package/dist/src/proactive/events/types.js +0 -15
- package/dist/src/proactive/execution/agent-executor.d.ts +0 -21
- package/dist/src/proactive/execution/agent-executor.js +0 -125
- package/dist/src/proactive/execution/authorization.d.ts +0 -7
- package/dist/src/proactive/execution/authorization.js +0 -71
- package/dist/src/proactive/execution/context.d.ts +0 -49
- package/dist/src/proactive/execution/context.js +0 -408
- package/dist/src/proactive/execution/insight.d.ts +0 -14
- package/dist/src/proactive/execution/insight.js +0 -132
- package/dist/src/proactive/execution/repository.d.ts +0 -28
- package/dist/src/proactive/execution/repository.js +0 -211
- package/dist/src/proactive/execution/types.d.ts +0 -80
- package/dist/src/proactive/execution/worker.d.ts +0 -15
- package/dist/src/proactive/execution/worker.js +0 -146
- package/dist/src/proactive/experience.d.ts +0 -89
- package/dist/src/proactive/experience.js +0 -195
- package/dist/src/proactive/follow-ups.d.ts +0 -128
- package/dist/src/proactive/follow-ups.js +0 -182
- package/dist/src/proactive/inbox/cards.d.ts +0 -21
- package/dist/src/proactive/inbox/cards.js +0 -276
- package/dist/src/proactive/inbox/delivery.d.ts +0 -6
- package/dist/src/proactive/inbox/delivery.js +0 -54
- package/dist/src/proactive/inbox/digest.d.ts +0 -8
- package/dist/src/proactive/inbox/digest.js +0 -123
- package/dist/src/proactive/inbox/lifecycle.d.ts +0 -4
- package/dist/src/proactive/inbox/lifecycle.js +0 -62
- package/dist/src/proactive/inbox/notification-policy.d.ts +0 -1
- package/dist/src/proactive/inbox/notification-policy.js +0 -25
- package/dist/src/proactive/inbox/repository.d.ts +0 -25
- package/dist/src/proactive/inbox/repository.js +0 -244
- package/dist/src/proactive/inbox/service.d.ts +0 -23
- package/dist/src/proactive/inbox/service.js +0 -46
- package/dist/src/proactive/inbox/types.d.ts +0 -64
- package/dist/src/proactive/inbox/worker.d.ts +0 -13
- package/dist/src/proactive/inbox/worker.js +0 -71
- package/dist/src/proactive/index.d.ts +0 -20
- package/dist/src/proactive/index.js +0 -14
- package/dist/src/proactive/mail-thread.d.ts +0 -13
- package/dist/src/proactive/mail-thread.js +0 -55
- package/dist/src/proactive/maintenance.d.ts +0 -4
- package/dist/src/proactive/maintenance.js +0 -28
- package/dist/src/proactive/metrics.d.ts +0 -10
- package/dist/src/proactive/metrics.js +0 -28
- package/dist/src/proactive/policy/presence.d.ts +0 -2
- package/dist/src/proactive/policy/presence.js +0 -30
- package/dist/src/proactive/policy/service.d.ts +0 -54
- package/dist/src/proactive/policy/service.js +0 -123
- package/dist/src/proactive/routing/batch-repository.d.ts +0 -27
- package/dist/src/proactive/routing/batch-repository.js +0 -57
- package/dist/src/proactive/routing/matcher.d.ts +0 -5
- package/dist/src/proactive/routing/matcher.js +0 -57
- package/dist/src/proactive/routing/types.d.ts +0 -44
- package/dist/src/proactive/routing/types.js +0 -1
- package/dist/src/proactive/scenarios/control.d.ts +0 -52
- package/dist/src/proactive/scenarios/control.js +0 -75
- package/dist/src/proactive/scenarios/prompt-composer.d.ts +0 -14
- package/dist/src/proactive/scenarios/prompt-composer.js +0 -26
- package/dist/src/proactive/scenarios/repository.d.ts +0 -23
- package/dist/src/proactive/scenarios/repository.js +0 -174
- package/dist/src/proactive/scenarios/service.d.ts +0 -15
- package/dist/src/proactive/scenarios/service.js +0 -26
- package/dist/src/proactive/scenarios/types.d.ts +0 -43
- package/dist/src/proactive/scenarios/types.js +0 -1
- package/dist/src/proactive/service.d.ts +0 -25
- package/dist/src/proactive/service.js +0 -78
- package/dist/src/proactive/source-freshness.d.ts +0 -8
- package/dist/src/proactive/source-freshness.js +0 -28
- package/dist/src/proactive/status.d.ts +0 -2
- package/dist/src/proactive/status.js +0 -22
- package/dist/src/proactive/temporal/schedule.d.ts +0 -3
- package/dist/src/proactive/temporal/schedule.js +0 -68
- package/dist/src/proactive/temporal/worker.d.ts +0 -17
- package/dist/src/proactive/temporal/worker.js +0 -129
- package/dist/src/tasks/project-monitoring-service.d.ts +0 -32
- package/dist/src/tasks/project-monitoring-service.js +0 -118
- /package/dist/src/{proactive/execution → connectors/cli}/types.js +0 -0
- /package/dist/src/{proactive/events/publisher.js → notifications/domain-delivery.js} +0 -0
- /package/dist/src/{proactive/inbox/types.js → scenes/httpServices.js} +0 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { init_paths_state, resolveStateDir } from "../../config/paths-state.js";
|
|
2
|
+
import { spawnProcess } from "../../process/run-process.js";
|
|
3
|
+
import { prepareCliAssets } from "./assets.js";
|
|
4
|
+
import { isAbsolute, join, relative, sep } from "node:path";
|
|
5
|
+
import { mkdir, realpath, stat } from "node:fs/promises";
|
|
6
|
+
//#region src/connectors/cli/process.ts
|
|
7
|
+
init_paths_state();
|
|
8
|
+
const running = /* @__PURE__ */ new Map();
|
|
9
|
+
function cancelCliContext(contextId) {
|
|
10
|
+
for (const handle of running.get(contextId) ?? []) handle.terminate("cancelled");
|
|
11
|
+
}
|
|
12
|
+
function cliRoot() {
|
|
13
|
+
return join(resolveStateDir(), "connectors", "cli");
|
|
14
|
+
}
|
|
15
|
+
function cliContextPath(id) {
|
|
16
|
+
if (!/^[a-zA-Z0-9_-]{1,128}$/.test(id)) throw new Error("Invalid CLI context ID.");
|
|
17
|
+
return join(cliRoot(), "contexts", id);
|
|
18
|
+
}
|
|
19
|
+
function cliEnvironment(adapter, contextPath) {
|
|
20
|
+
const env = {};
|
|
21
|
+
for (const name of [
|
|
22
|
+
"PATH",
|
|
23
|
+
"SystemRoot",
|
|
24
|
+
"WINDIR",
|
|
25
|
+
"TMPDIR",
|
|
26
|
+
"TEMP",
|
|
27
|
+
"TMP",
|
|
28
|
+
"HTTPS_PROXY",
|
|
29
|
+
"HTTP_PROXY",
|
|
30
|
+
"NO_PROXY",
|
|
31
|
+
"LANG"
|
|
32
|
+
]) if (process.env[name]) env[name] = process.env[name];
|
|
33
|
+
for (const [name, value] of Object.entries(adapter.environment ?? {})) {
|
|
34
|
+
if (!/^[A-Z][A-Z0-9_]*$/.test(name) || [
|
|
35
|
+
"HOME",
|
|
36
|
+
"USERPROFILE",
|
|
37
|
+
"PATH",
|
|
38
|
+
"NODE_OPTIONS",
|
|
39
|
+
"LD_PRELOAD",
|
|
40
|
+
"DYLD_INSERT_LIBRARIES",
|
|
41
|
+
adapter.configEnvironment,
|
|
42
|
+
adapter.dataEnvironment
|
|
43
|
+
].includes(name)) throw new Error("Reserved CLI environment variable.");
|
|
44
|
+
env[name] = value;
|
|
45
|
+
}
|
|
46
|
+
env[adapter.configEnvironment] = join(contextPath, "config");
|
|
47
|
+
if (adapter.dataEnvironment) env[adapter.dataEnvironment] = join(contextPath, "data");
|
|
48
|
+
env.HOME = join(contextPath, "home");
|
|
49
|
+
env.USERPROFILE = env.HOME;
|
|
50
|
+
env.NO_COLOR = "1";
|
|
51
|
+
return env;
|
|
52
|
+
}
|
|
53
|
+
async function startCliProcess(options) {
|
|
54
|
+
if (!isAbsolute(options.executable)) throw new Error("CLI executable must be an absolute path.");
|
|
55
|
+
const contextPath = cliContextPath(options.contextId);
|
|
56
|
+
for (const folder of [
|
|
57
|
+
"",
|
|
58
|
+
"config",
|
|
59
|
+
"data",
|
|
60
|
+
"home",
|
|
61
|
+
"files"
|
|
62
|
+
]) await mkdir(join(contextPath, folder), {
|
|
63
|
+
recursive: true,
|
|
64
|
+
mode: 448
|
|
65
|
+
});
|
|
66
|
+
await prepareCliAssets(options.adapter, join(contextPath, "config"));
|
|
67
|
+
options.signal?.throwIfAborted();
|
|
68
|
+
options.beforeSpawn?.();
|
|
69
|
+
const handle = spawnProcess({
|
|
70
|
+
program: options.executable,
|
|
71
|
+
args: options.args,
|
|
72
|
+
cwd: join(contextPath, "files"),
|
|
73
|
+
env: cliEnvironment(options.adapter, contextPath),
|
|
74
|
+
shell: false,
|
|
75
|
+
terminationPolicy: "tree",
|
|
76
|
+
timeoutMs: options.timeoutMs ?? 6e4,
|
|
77
|
+
maxOutputBytes: options.maxOutputBytes ?? 1024 * 1024,
|
|
78
|
+
signal: options.signal,
|
|
79
|
+
onOutput: options.onOutput
|
|
80
|
+
});
|
|
81
|
+
const active = running.get(options.contextId) ?? /* @__PURE__ */ new Set();
|
|
82
|
+
running.set(options.contextId, active);
|
|
83
|
+
active.add(handle);
|
|
84
|
+
handle.completion.finally(() => {
|
|
85
|
+
active.delete(handle);
|
|
86
|
+
if (!active.size) running.delete(options.contextId);
|
|
87
|
+
}).catch(() => void 0);
|
|
88
|
+
return handle;
|
|
89
|
+
}
|
|
90
|
+
async function resolveCliArtifact(contextId, filePath) {
|
|
91
|
+
const root = await realpath(join(cliContextPath(contextId), "files"));
|
|
92
|
+
const resolved = await realpath(filePath);
|
|
93
|
+
const child = relative(root, resolved);
|
|
94
|
+
if (!child || child === ".." || child.startsWith(`..${sep}`) || isAbsolute(child)) throw new Error("CLI artifact is outside its context.");
|
|
95
|
+
const info = await stat(resolved);
|
|
96
|
+
if (!info.isFile() || info.size > 25 * 1024 * 1024) throw new Error("Invalid CLI artifact.");
|
|
97
|
+
return resolved;
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
export { cancelCliContext, cliContextPath, cliEnvironment, cliRoot, resolveCliArtifact, startCliProcess };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ProcessResult } from '../../process/process-spec.js';
|
|
2
|
+
import type { CliAction, CliAdapter, CliResult, JsonObject } from './types.js';
|
|
3
|
+
export declare class CliProtocolError extends Error {
|
|
4
|
+
}
|
|
5
|
+
export declare function object(value: unknown): JsonObject;
|
|
6
|
+
export declare function parseJson(text: string): unknown;
|
|
7
|
+
export declare function actionRevision(value: unknown): string;
|
|
8
|
+
export declare function validateActionInput(action: CliAction, input: JsonObject): void;
|
|
9
|
+
export declare function normalizeCliResult(adapter: Pick<CliAdapter, 'decodeResult'>, output: ProcessResult, scope: CliAction['scope']): CliResult;
|
|
10
|
+
export declare function closedSchema(value: unknown): JsonObject;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import Ajv from "ajv";
|
|
3
|
+
//#region src/connectors/cli/protocol.ts
|
|
4
|
+
const ajv = new Ajv({
|
|
5
|
+
strict: false,
|
|
6
|
+
allErrors: true,
|
|
7
|
+
validateFormats: false,
|
|
8
|
+
ownProperties: true
|
|
9
|
+
});
|
|
10
|
+
var CliProtocolError = class extends Error {};
|
|
11
|
+
function object(value) {
|
|
12
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new CliProtocolError("Expected a JSON object.");
|
|
13
|
+
return value;
|
|
14
|
+
}
|
|
15
|
+
function parseJson(text) {
|
|
16
|
+
return JSON.parse(text);
|
|
17
|
+
}
|
|
18
|
+
function actionRevision(value) {
|
|
19
|
+
return createHash("sha256").update(JSON.stringify(value)).digest("hex");
|
|
20
|
+
}
|
|
21
|
+
function validateActionInput(action, input) {
|
|
22
|
+
const validate = ajv.compile(action.inputSchema);
|
|
23
|
+
if (!validate(input)) throw new Error(`Invalid action input: ${ajv.errorsText(validate.errors)}`);
|
|
24
|
+
}
|
|
25
|
+
function normalizeCliResult(adapter, output, scope) {
|
|
26
|
+
const uncertain = scope !== "read" && !output.spawnErrorCode;
|
|
27
|
+
if (output.timedOut || output.aborted || output.spawnErrorCode || output.outputTruncated) {
|
|
28
|
+
const kind = output.timedOut ? "timeout" : output.aborted ? "cancelled" : output.spawnErrorCode ? "startup" : "protocol";
|
|
29
|
+
return {
|
|
30
|
+
outcome: uncertain ? "unknown" : "failed",
|
|
31
|
+
error: {
|
|
32
|
+
kind,
|
|
33
|
+
message: `CLI execution ${kind}.`
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
try {
|
|
38
|
+
const data = adapter.decodeResult(output);
|
|
39
|
+
if (output.exitCode !== 0) throw new Error("CLI exited unsuccessfully.");
|
|
40
|
+
return {
|
|
41
|
+
outcome: "success",
|
|
42
|
+
data
|
|
43
|
+
};
|
|
44
|
+
} catch (error) {
|
|
45
|
+
const protocolError = error instanceof SyntaxError || error instanceof CliProtocolError;
|
|
46
|
+
return {
|
|
47
|
+
outcome: uncertain && (protocolError || output.signal !== null) ? "unknown" : "failed",
|
|
48
|
+
error: {
|
|
49
|
+
kind: protocolError ? "protocol" : "provider",
|
|
50
|
+
message: error instanceof Error ? error.message : "CLI failed."
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function closedSchema(value) {
|
|
56
|
+
const schema = structuredClone(object(value));
|
|
57
|
+
if (schema.type !== "object") throw new Error("Action input must be an object schema.");
|
|
58
|
+
schema.additionalProperties = false;
|
|
59
|
+
ajv.compile(schema);
|
|
60
|
+
return schema;
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { CliProtocolError, actionRevision, closedSchema, normalizeCliResult, object, parseJson, validateActionInput };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Config } from '../../config/schema.js';
|
|
2
|
+
import type { ConnectorConnection } from '../types.js';
|
|
3
|
+
import type { CliAction, JsonObject } from './types.js';
|
|
4
|
+
export declare function describeCliAction(config: Config, instanceId: string, connection: ConnectorConnection, actionId: string): Promise<CliAction>;
|
|
5
|
+
export declare function verifyCliConnection(config: Config, instanceId: string, connection: ConnectorConnection, signal?: AbortSignal): Promise<{
|
|
6
|
+
adapter: import("./types.js").CliAdapter;
|
|
7
|
+
executable: string;
|
|
8
|
+
identity: import("./types.js").CliIdentity;
|
|
9
|
+
}>;
|
|
10
|
+
export declare function executeCliAction(config: Config, instanceId: string, connection: ConnectorConnection, action: CliAction, input: JsonObject, signal?: AbortSignal, beforeExecute?: () => void): Promise<import("./types.js").CliResult>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { getConnectorAccount, init_connector_account_repository } from "../../storage/sqlite/connector-account-repository.js";
|
|
2
|
+
import { startCliProcess } from "./process.js";
|
|
3
|
+
import { normalizeCliResult, parseJson, validateActionInput } from "./protocol.js";
|
|
4
|
+
import { verifyInstalledCli } from "./installer.js";
|
|
5
|
+
import { requireCliInstance } from "./authorization.js";
|
|
6
|
+
//#region src/connectors/cli/runtime.ts
|
|
7
|
+
init_connector_account_repository();
|
|
8
|
+
const contracts = /* @__PURE__ */ new Map();
|
|
9
|
+
async function describeCliAction(config, instanceId, connection, actionId) {
|
|
10
|
+
const adapter = requireCliInstance(config, instanceId);
|
|
11
|
+
if (!adapter.curatedActions[actionId]) throw new Error("CLI action is not enabled.");
|
|
12
|
+
if (connection.provider !== "cli" || connection.metadata.runtimeInstanceId !== instanceId || connection.status !== "active") throw new Error("CLI connection is not available.");
|
|
13
|
+
const staticAction = adapter.staticActions?.[actionId];
|
|
14
|
+
if (staticAction) return staticAction;
|
|
15
|
+
const key = JSON.stringify([
|
|
16
|
+
instanceId,
|
|
17
|
+
connection.id,
|
|
18
|
+
connection.updatedAt,
|
|
19
|
+
adapter.version,
|
|
20
|
+
adapter.binaryVersion,
|
|
21
|
+
actionId
|
|
22
|
+
]);
|
|
23
|
+
const cached = contracts.get(key);
|
|
24
|
+
if (cached && cached.expiresAt > Date.now()) return cached.action;
|
|
25
|
+
const output = await (await startCliProcess({
|
|
26
|
+
adapter,
|
|
27
|
+
executable: await verifyInstalledCli(adapter),
|
|
28
|
+
contextId: String(connection.metadata.contextId),
|
|
29
|
+
args: adapter.schemaArgs(actionId)
|
|
30
|
+
})).completion;
|
|
31
|
+
if (output.exitCode !== 0 || output.outputTruncated) throw new Error("Could not retrieve CLI action schema.");
|
|
32
|
+
const action = adapter.decodeSchema(actionId, parseJson(output.stdout));
|
|
33
|
+
if (contracts.size >= 256) contracts.clear();
|
|
34
|
+
contracts.set(key, {
|
|
35
|
+
action,
|
|
36
|
+
expiresAt: Date.now() + 6e4
|
|
37
|
+
});
|
|
38
|
+
return action;
|
|
39
|
+
}
|
|
40
|
+
async function verifyCliConnection(config, instanceId, connection, signal) {
|
|
41
|
+
const adapter = requireCliInstance(config, instanceId);
|
|
42
|
+
if (connection.provider !== "cli" || connection.status !== "active" || connection.metadata.runtimeInstanceId !== instanceId) throw new Error("CLI connection is unavailable.");
|
|
43
|
+
const executable = await verifyInstalledCli(adapter);
|
|
44
|
+
const output = await (await startCliProcess({
|
|
45
|
+
adapter,
|
|
46
|
+
executable,
|
|
47
|
+
contextId: String(connection.metadata.contextId),
|
|
48
|
+
args: adapter.statusArgs,
|
|
49
|
+
signal
|
|
50
|
+
})).completion;
|
|
51
|
+
if (output.timedOut || output.aborted || output.outputTruncated) throw new Error("CLI identity verification failed.");
|
|
52
|
+
const identity = adapter.decodeIdentity(output);
|
|
53
|
+
if (identity.key !== getConnectorAccount(connection.accountId)?.identityKey) throw new Error("CLI identity changed. Reauthorize the selected account.");
|
|
54
|
+
return {
|
|
55
|
+
adapter,
|
|
56
|
+
executable,
|
|
57
|
+
identity
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const queues = /* @__PURE__ */ new Map();
|
|
61
|
+
async function executeCliAction(config, instanceId, connection, action, input, signal, beforeExecute) {
|
|
62
|
+
const contextId = String(connection.metadata.contextId);
|
|
63
|
+
const previous = queues.get(contextId) ?? Promise.resolve();
|
|
64
|
+
let release;
|
|
65
|
+
const pending = new Promise((resolve) => {
|
|
66
|
+
release = resolve;
|
|
67
|
+
});
|
|
68
|
+
queues.set(contextId, pending);
|
|
69
|
+
await previous;
|
|
70
|
+
try {
|
|
71
|
+
signal?.throwIfAborted();
|
|
72
|
+
validateActionInput(action, input);
|
|
73
|
+
const { adapter, executable, identity } = await verifyCliConnection(config, instanceId, connection, signal);
|
|
74
|
+
if (action.requiredScopes.some((scope) => !identity.scopes.includes(scope)) || action.anyScopes?.length && !action.anyScopes.some((scope) => identity.scopes.includes(scope))) throw new Error("CLI account is missing required scopes.");
|
|
75
|
+
if (adapter.curatedActions[action.id] !== action.scope) throw new Error("CLI action contract changed.");
|
|
76
|
+
return normalizeCliResult(adapter, await (await startCliProcess({
|
|
77
|
+
adapter,
|
|
78
|
+
executable,
|
|
79
|
+
contextId,
|
|
80
|
+
args: adapter.actionArgs(action, input),
|
|
81
|
+
signal,
|
|
82
|
+
beforeSpawn: () => {
|
|
83
|
+
requireCliInstance(config, instanceId);
|
|
84
|
+
beforeExecute?.();
|
|
85
|
+
}
|
|
86
|
+
})).completion, action.scope);
|
|
87
|
+
} finally {
|
|
88
|
+
release();
|
|
89
|
+
if (queues.get(contextId) === pending) queues.delete(contextId);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
93
|
+
export { describeCliAction, executeCliAction, verifyCliConnection };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { CliChallenge, CliIdentity } from './types.js';
|
|
2
|
+
export declare const cliOwnerId: string;
|
|
3
|
+
export type CliAuthorization = {
|
|
4
|
+
id: string;
|
|
5
|
+
instance_id: string;
|
|
6
|
+
connector_id: string;
|
|
7
|
+
principal_id: string;
|
|
8
|
+
expected_account_id: string | null;
|
|
9
|
+
context_id: string;
|
|
10
|
+
phase: 'preparing' | 'awaiting_user' | 'verifying' | 'succeeded' | 'failed' | 'expired' | 'cancelled';
|
|
11
|
+
challenge_json: string | null;
|
|
12
|
+
error: string | null;
|
|
13
|
+
account_id: string | null;
|
|
14
|
+
owner_id: string;
|
|
15
|
+
expires_at: number;
|
|
16
|
+
updated_at: number;
|
|
17
|
+
};
|
|
18
|
+
export declare function readCliAuthorization(id: string, principalId?: string): CliAuthorization | undefined;
|
|
19
|
+
export declare function createCliAuthorization(instanceId: string, connectorId: string, expectedAccountId?: string): CliAuthorization;
|
|
20
|
+
export declare function updateCliAuthorization(id: string, input: {
|
|
21
|
+
phase: CliAuthorization['phase'];
|
|
22
|
+
challenge?: CliChallenge;
|
|
23
|
+
error?: string;
|
|
24
|
+
accountId?: string;
|
|
25
|
+
}): boolean;
|
|
26
|
+
export declare function commitCliIdentity(attempt: CliAuthorization, identity: CliIdentity): string;
|
|
27
|
+
export declare function cliAuthorizationView(row: CliAuthorization): {
|
|
28
|
+
id: string;
|
|
29
|
+
status: "failed" | "succeeded" | "expired" | "cancelled" | "verifying" | "awaiting_user" | "preparing";
|
|
30
|
+
challenge: CliChallenge;
|
|
31
|
+
error: string;
|
|
32
|
+
accountId: string;
|
|
33
|
+
expiresAt: number;
|
|
34
|
+
};
|
|
35
|
+
export declare function recoverCliExecutions(): void;
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "../../storage/sqlite/transaction.js";
|
|
2
|
+
import { getConnectorAccount, init_connector_account_repository } from "../../storage/sqlite/connector-account-repository.js";
|
|
3
|
+
import { init_connector_repository, upsertConnectorConnection } from "../../storage/sqlite/connector-repository.js";
|
|
4
|
+
import { randomUUID } from "node:crypto";
|
|
5
|
+
//#region src/connectors/cli/store.ts
|
|
6
|
+
init_transaction();
|
|
7
|
+
init_connector_account_repository();
|
|
8
|
+
init_connector_repository();
|
|
9
|
+
const cliOwnerId = `${process.pid}:${randomUUID()}`;
|
|
10
|
+
function ownerAlive(ownerId) {
|
|
11
|
+
if (ownerId === cliOwnerId) return true;
|
|
12
|
+
const pid = Number(ownerId.split(":")[0]);
|
|
13
|
+
if (!Number.isSafeInteger(pid) || pid <= 0) return false;
|
|
14
|
+
try {
|
|
15
|
+
process.kill(pid, 0);
|
|
16
|
+
return true;
|
|
17
|
+
} catch (error) {
|
|
18
|
+
return error.code === "EPERM";
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function readCliAuthorization(id, principalId = "local-owner") {
|
|
22
|
+
const row = getSqliteDatabase().prepare("SELECT * FROM connector_cli_authorizations WHERE id = ? AND principal_id = ?").get(id, principalId);
|
|
23
|
+
if (row && [
|
|
24
|
+
"preparing",
|
|
25
|
+
"awaiting_user",
|
|
26
|
+
"verifying"
|
|
27
|
+
].includes(row.phase) && (row.expires_at <= Date.now() || !ownerAlive(row.owner_id))) {
|
|
28
|
+
const phase = row.expires_at <= Date.now() ? "expired" : "failed";
|
|
29
|
+
updateCliAuthorization(row.id, {
|
|
30
|
+
phase,
|
|
31
|
+
error: phase === "expired" ? "Authorization expired." : "Gateway restarted. Start authorization again."
|
|
32
|
+
});
|
|
33
|
+
return {
|
|
34
|
+
...row,
|
|
35
|
+
phase,
|
|
36
|
+
challenge_json: null,
|
|
37
|
+
error: "Start authorization again."
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return row;
|
|
41
|
+
}
|
|
42
|
+
function createCliAuthorization(instanceId, connectorId, expectedAccountId) {
|
|
43
|
+
const db = getSqliteDatabase();
|
|
44
|
+
const pending = db.prepare("SELECT id FROM connector_cli_authorizations WHERE instance_id = ? AND principal_id = 'local-owner' AND phase IN ('preparing','awaiting_user','verifying')").get(instanceId);
|
|
45
|
+
if (pending) {
|
|
46
|
+
const current = readCliAuthorization(pending.id);
|
|
47
|
+
if (current && [
|
|
48
|
+
"preparing",
|
|
49
|
+
"awaiting_user",
|
|
50
|
+
"verifying"
|
|
51
|
+
].includes(current.phase)) throw new Error("Authorization is already in progress.");
|
|
52
|
+
}
|
|
53
|
+
if (expectedAccountId) {
|
|
54
|
+
const account = getConnectorAccount(expectedAccountId);
|
|
55
|
+
if (!account || account.principalId !== "local-owner" || account.connectorId !== connectorId || account.runtimeInstanceId !== instanceId) throw new Error("Account not found.");
|
|
56
|
+
}
|
|
57
|
+
const id = randomUUID();
|
|
58
|
+
db.prepare(`INSERT INTO connector_cli_authorizations
|
|
59
|
+
(id, instance_id, connector_id, principal_id, expected_account_id, context_id, phase, owner_id, expires_at, updated_at)
|
|
60
|
+
VALUES (?, ?, ?, 'local-owner', ?, ?, 'preparing', ?, ?, ?)`).run(id, instanceId, connectorId, expectedAccountId ?? null, id, cliOwnerId, Date.now() + 10 * 6e4, Date.now());
|
|
61
|
+
return readCliAuthorization(id);
|
|
62
|
+
}
|
|
63
|
+
function updateCliAuthorization(id, input) {
|
|
64
|
+
return getSqliteDatabase().prepare(`UPDATE connector_cli_authorizations SET phase = ?, challenge_json = ?, error = ?, account_id = COALESCE(?, account_id), updated_at = ?
|
|
65
|
+
WHERE id = ? AND phase IN ('preparing','awaiting_user','verifying')`).run(input.phase, input.challenge ? JSON.stringify(input.challenge) : null, input.error ?? null, input.accountId ?? null, Date.now(), id).changes > 0;
|
|
66
|
+
}
|
|
67
|
+
function commitCliIdentity(attempt, identity) {
|
|
68
|
+
return runSqliteWriteTransaction((db) => {
|
|
69
|
+
const current = readCliAuthorization(attempt.id);
|
|
70
|
+
if (!current || current.phase !== "verifying") throw new Error("Authorization is no longer active.");
|
|
71
|
+
const previous = attempt.expected_account_id ? getConnectorAccount(attempt.expected_account_id) : void 0;
|
|
72
|
+
if (attempt.expected_account_id && (!previous || previous.principalId !== attempt.principal_id || previous.runtimeInstanceId !== attempt.instance_id)) throw new Error("Selected account is no longer available.");
|
|
73
|
+
if (previous && previous.identityKey !== identity.key) throw new Error("Authorized identity does not match the selected account.");
|
|
74
|
+
const match = db.prepare("SELECT id FROM connector_accounts WHERE principal_id = ? AND runtime_instance_id = ? AND identity_key = ?").get(attempt.principal_id, attempt.instance_id, identity.key);
|
|
75
|
+
const accountId = previous?.id ?? match?.id ?? randomUUID();
|
|
76
|
+
const connectionId = randomUUID();
|
|
77
|
+
upsertConnectorConnection({
|
|
78
|
+
id: connectionId,
|
|
79
|
+
accountId,
|
|
80
|
+
installationId: `${attempt.connector_id}-local-owner`,
|
|
81
|
+
connectorId: attempt.connector_id,
|
|
82
|
+
provider: "cli",
|
|
83
|
+
principalId: attempt.principal_id,
|
|
84
|
+
providerConnectionId: attempt.context_id,
|
|
85
|
+
identity: identity.identity,
|
|
86
|
+
status: "active",
|
|
87
|
+
isDefault: false,
|
|
88
|
+
connectedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
89
|
+
metadata: {
|
|
90
|
+
runtimeInstanceId: attempt.instance_id,
|
|
91
|
+
contextId: attempt.context_id,
|
|
92
|
+
scopes: identity.scopes
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
db.prepare(`UPDATE connector_accounts SET runtime_instance_id = ?, identity_key = ?, identity_json = ?,
|
|
96
|
+
enabled = 1, label = COALESCE(label, ?), current_connection_id = ?, updated_at = ? WHERE id = ?`).run(attempt.instance_id, identity.key, JSON.stringify(identity.identity), identity.label, connectionId, (/* @__PURE__ */ new Date()).toISOString(), accountId);
|
|
97
|
+
db.prepare("UPDATE connector_connections SET status = 'disabled' WHERE account_id = ? AND id <> ? AND provider = 'cli'").run(accountId, connectionId);
|
|
98
|
+
updateCliAuthorization(attempt.id, {
|
|
99
|
+
phase: "succeeded",
|
|
100
|
+
accountId
|
|
101
|
+
});
|
|
102
|
+
return accountId;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function cliAuthorizationView(row) {
|
|
106
|
+
return {
|
|
107
|
+
id: row.id,
|
|
108
|
+
status: row.phase,
|
|
109
|
+
challenge: row.challenge_json ? JSON.parse(row.challenge_json) : void 0,
|
|
110
|
+
error: row.error ?? void 0,
|
|
111
|
+
accountId: row.account_id ?? void 0,
|
|
112
|
+
expiresAt: row.expires_at
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
function recoverCliExecutions() {
|
|
116
|
+
const db = getSqliteDatabase();
|
|
117
|
+
const owners = db.prepare("SELECT DISTINCT owner_id FROM connector_cli_executions WHERE status = 'running' AND owner_id <> ?").all(cliOwnerId);
|
|
118
|
+
for (const owner of owners) if (!ownerAlive(owner.owner_id)) db.prepare("UPDATE connector_cli_executions SET status = 'unknown', error_kind = 'interrupted', finished_at = ? WHERE status = 'running' AND owner_id = ?").run(Date.now(), owner.owner_id);
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
export { cliAuthorizationView, cliOwnerId, commitCliIdentity, createCliAuthorization, readCliAuthorization, recoverCliExecutions, updateCliAuthorization };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { ProcessResult } from '../../process/process-spec.js';
|
|
2
|
+
import type { ConnectorScope } from '../types.js';
|
|
3
|
+
export type JsonObject = Record<string, unknown>;
|
|
4
|
+
export type CliAction = {
|
|
5
|
+
id: string;
|
|
6
|
+
description: string;
|
|
7
|
+
inputSchema: JsonObject;
|
|
8
|
+
scope: ConnectorScope;
|
|
9
|
+
requiredScopes: string[];
|
|
10
|
+
anyScopes?: string[];
|
|
11
|
+
revision: string;
|
|
12
|
+
};
|
|
13
|
+
export type CliIdentity = {
|
|
14
|
+
key: string;
|
|
15
|
+
label: string;
|
|
16
|
+
scopes: string[];
|
|
17
|
+
identity: JsonObject;
|
|
18
|
+
};
|
|
19
|
+
export type CliChallenge = ({
|
|
20
|
+
type: 'open_url';
|
|
21
|
+
url: string;
|
|
22
|
+
} | {
|
|
23
|
+
type: 'qr_code';
|
|
24
|
+
artifactId: string;
|
|
25
|
+
}) & {
|
|
26
|
+
step: number;
|
|
27
|
+
totalSteps: number;
|
|
28
|
+
};
|
|
29
|
+
export type CliResult = {
|
|
30
|
+
outcome: 'success' | 'failed' | 'unknown';
|
|
31
|
+
data?: unknown;
|
|
32
|
+
error?: {
|
|
33
|
+
kind: 'protocol' | 'provider' | 'timeout' | 'cancelled' | 'startup' | 'unauthorized';
|
|
34
|
+
message: string;
|
|
35
|
+
code?: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
export type CliDistribution = {
|
|
39
|
+
url: string;
|
|
40
|
+
integrity: string;
|
|
41
|
+
archiveEntry: string;
|
|
42
|
+
};
|
|
43
|
+
export type CliAdapter = {
|
|
44
|
+
id: string;
|
|
45
|
+
version: string;
|
|
46
|
+
binaryVersion: string;
|
|
47
|
+
executable: string;
|
|
48
|
+
distributions: Record<string, CliDistribution>;
|
|
49
|
+
configEnvironment: string;
|
|
50
|
+
environment?: Readonly<Record<string, string>>;
|
|
51
|
+
configAssets?: ReadonlyArray<{
|
|
52
|
+
path: string;
|
|
53
|
+
content: string;
|
|
54
|
+
sha256: string;
|
|
55
|
+
}>;
|
|
56
|
+
dataEnvironment?: string;
|
|
57
|
+
curatedActions: Record<string, ConnectorScope>;
|
|
58
|
+
staticActions?: Record<string, CliAction>;
|
|
59
|
+
schemaArgs(actionId: string): string[];
|
|
60
|
+
decodeSchema(actionId: string, value: unknown): CliAction;
|
|
61
|
+
actionArgs(action: CliAction, input: JsonObject): string[];
|
|
62
|
+
decodeResult(output: ProcessResult): unknown;
|
|
63
|
+
statusArgs: string[];
|
|
64
|
+
decodeIdentity(output: ProcessResult): CliIdentity;
|
|
65
|
+
authorizationSteps: Array<{
|
|
66
|
+
args: string[];
|
|
67
|
+
challenge: 'url' | 'qr';
|
|
68
|
+
initialOnly?: boolean;
|
|
69
|
+
decodeResult?: (output: ProcessResult) => void;
|
|
70
|
+
urlHosts?: string[];
|
|
71
|
+
urlField?: string;
|
|
72
|
+
}>;
|
|
73
|
+
};
|
|
@@ -47,7 +47,7 @@ async function ensureComposioBackend(resolver = new CredentialResolver()) {
|
|
|
47
47
|
credentialRef: storedKey ? "connector-composio-api-key" : envRef,
|
|
48
48
|
credentialSource: !storedKey && envRef ? "environment" : "stored"
|
|
49
49
|
});
|
|
50
|
-
getSqliteDatabase().prepare("UPDATE connector_accounts SET backend_id = ? WHERE backend_id IS NULL").run(backend.id);
|
|
50
|
+
getSqliteDatabase().prepare("UPDATE connector_accounts SET backend_id = ? WHERE backend_id IS NULL AND runtime_instance_id IS NULL").run(backend.id);
|
|
51
51
|
activateComposioBackend(backend.id);
|
|
52
52
|
return getComposioBackend(backend.id);
|
|
53
53
|
}
|
|
@@ -59,6 +59,7 @@ export declare class ComposioSessionsAdapter {
|
|
|
59
59
|
revokeConnection(connection: ConnectorConnection): Promise<void>;
|
|
60
60
|
refreshConnection(connection: ConnectorConnection): Promise<ConnectorConnection>;
|
|
61
61
|
executeWithPolicy(input: {
|
|
62
|
+
signal?: AbortSignal;
|
|
62
63
|
context: ComposioSessionContext;
|
|
63
64
|
installation: ConnectorInstallationPolicy;
|
|
64
65
|
connection?: ConnectorConnection;
|
|
@@ -4,11 +4,11 @@ import { getSqliteDatabase, init_transaction } from "../storage/sqlite/transacti
|
|
|
4
4
|
import { getConnectorAccount, init_connector_account_repository, reconcileConnectorAccount } from "../storage/sqlite/connector-account-repository.js";
|
|
5
5
|
import { appendConnectorExecutionAudit, getConnectorConnection, getConnectorInstallation, init_connector_repository, listConnectorConnections, upsertConnectorConnection } from "../storage/sqlite/connector-repository.js";
|
|
6
6
|
import { CredentialResolver, init_credentials } from "../auth/credentials.js";
|
|
7
|
+
import { canAccessConnectorAccount } from "./account-access.js";
|
|
7
8
|
import { ensureComposioBackend, getComposioBackend, listComposioBackends, resolveBackendKey } from "./composio-backends.js";
|
|
8
9
|
import { saveAuthorizationAttempt } from "./authorization-attempts.js";
|
|
9
10
|
import { connectorIdentityKey, mergeConnectorIdentity } from "./connector-identity.js";
|
|
10
11
|
import { evaluateConnectorExecutionPolicy } from "./policy.js";
|
|
11
|
-
import { canAccessConnectorAccount } from "./account-access.js";
|
|
12
12
|
import { createHash } from "node:crypto";
|
|
13
13
|
//#region src/connectors/composio-sessions.ts
|
|
14
14
|
init_credentials();
|
|
@@ -393,6 +393,7 @@ var ComposioSessionsAdapter = class {
|
|
|
393
393
|
return synced.find((candidate) => candidate.id === connection.id) ?? synced.find((candidate) => candidate.providerConnectionId === connection.providerConnectionId) ?? connection;
|
|
394
394
|
}
|
|
395
395
|
async executeWithPolicy(input) {
|
|
396
|
+
input.signal?.throwIfAborted();
|
|
396
397
|
if (!input.connection || input.connection.status !== "active" || !canAccessConnectorAccount(input.connection, input.installation, input.agentId)) return {
|
|
397
398
|
decision: "denied",
|
|
398
399
|
reason: "Account is unavailable to this agent."
|
|
@@ -430,13 +431,16 @@ var ComposioSessionsAdapter = class {
|
|
|
430
431
|
const providerPrincipalId = input.connection?.metadata.providerPrincipalId;
|
|
431
432
|
const connectionAuthConfigId = input.connection?.metadata.authConfigId;
|
|
432
433
|
if (input.connection && (typeof providerPrincipalId !== "string" || !providerPrincipalId.trim())) throw new Error("Connected account is missing its provider identity. Reconnect the account and try again.");
|
|
433
|
-
const
|
|
434
|
+
const session = await this.createSession({
|
|
434
435
|
...input.context,
|
|
435
436
|
backendId: input.connection?.accountId ? getConnectorAccount(input.connection.accountId)?.backendId : input.context.backendId,
|
|
436
437
|
connectedAccounts,
|
|
437
438
|
...toolkit && typeof connectionAuthConfigId === "string" && connectionAuthConfigId.trim() ? { authConfigs: { [toolkit]: connectionAuthConfigId.trim() } } : { authConfigs: void 0 },
|
|
438
439
|
...typeof providerPrincipalId === "string" ? { providerPrincipalId } : {}
|
|
439
|
-
})
|
|
440
|
+
});
|
|
441
|
+
input.signal?.throwIfAborted();
|
|
442
|
+
const result = await session.execute(input.action.actionId, input.args ?? {}, input.connection ? { account: input.connection.providerConnectionId } : void 0);
|
|
443
|
+
input.signal?.throwIfAborted();
|
|
440
444
|
appendConnectorExecutionAudit({
|
|
441
445
|
installationId: input.installation.id,
|
|
442
446
|
connectionId: input.connection?.id,
|
|
@@ -455,6 +459,7 @@ var ComposioSessionsAdapter = class {
|
|
|
455
459
|
result
|
|
456
460
|
};
|
|
457
461
|
} catch (err) {
|
|
462
|
+
input.signal?.throwIfAborted();
|
|
458
463
|
const errorCode = err && typeof err === "object" && "code" in err ? String(err.code) : void 0;
|
|
459
464
|
appendConnectorExecutionAudit({
|
|
460
465
|
installationId: input.installation.id,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { getConnectorAccount, init_connector_account_repository, refreshConnectorAccountCurrent, updateConnectorAccount } from "../storage/sqlite/connector-account-repository.js";
|
|
2
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 { canAccessConnectorAccount, currentAccountConnections } from "./account-access.js";
|
|
4
5
|
import { activateComposioBackend, addComposioBackend, ensureComposioBackend, getComposioBackend, listComposioBackends, markComposioBackendVerified, resolveBackendKey } from "./composio-backends.js";
|
|
5
6
|
import { connectorIdentityKey } from "./connector-identity.js";
|
|
6
|
-
import { canAccessConnectorAccount, currentAccountConnections } from "./account-access.js";
|
|
7
7
|
import { ComposioSessionsAdapter, assertComposioAccessConfigured } from "./composio-sessions.js";
|
|
8
8
|
import { getConnectorLearningPlan } from "./learning-recipes.js";
|
|
9
9
|
import { COMPOSIO_AGENT_READY_TOOLKITS, COMPOSIO_TOOLKIT_DISPLAY_NAMES, connectorDefinitionFromComposioToolkit } from "./composio-catalog.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getCliAdapter } from "./cli/adapterRegistry.js";
|
|
2
|
+
import { getConnectorDefinition, listConnectorCatalog } from "./catalog.js";
|
|
2
3
|
//#region src/connectors/connection-candidates.ts
|
|
3
4
|
const CANDIDATES = [
|
|
4
5
|
{
|
|
@@ -33,7 +34,18 @@ const CANDIDATES = [
|
|
|
33
34
|
}
|
|
34
35
|
];
|
|
35
36
|
function connectionCandidates(query) {
|
|
36
|
-
return
|
|
37
|
+
return [...listConnectorCatalog().filter((definition) => definition.runtime.type === "cli" && [
|
|
38
|
+
definition.id,
|
|
39
|
+
definition.displayName,
|
|
40
|
+
...definition.tags ?? []
|
|
41
|
+
].some((term) => term.toLowerCase().includes(query.toLowerCase().trim()) || query.toLowerCase().includes(term.toLowerCase()))).map((definition) => {
|
|
42
|
+
const candidate = resolveConnectionCandidate(definition.id);
|
|
43
|
+
return {
|
|
44
|
+
candidateRef: definition.id,
|
|
45
|
+
label: candidate.label,
|
|
46
|
+
capabilities: candidate.capabilities
|
|
47
|
+
};
|
|
48
|
+
}), ...CANDIDATES.filter((item) => item.pattern.test(query)).flatMap((item) => {
|
|
37
49
|
const connectorId = `composio-${item.toolkit}`;
|
|
38
50
|
const definition = getConnectorDefinition(connectorId);
|
|
39
51
|
return definition ? [{
|
|
@@ -41,9 +53,16 @@ function connectionCandidates(query) {
|
|
|
41
53
|
label: definition.displayName,
|
|
42
54
|
capabilities: item.capabilities
|
|
43
55
|
}] : [];
|
|
44
|
-
});
|
|
56
|
+
})];
|
|
45
57
|
}
|
|
46
58
|
function resolveConnectionCandidate(ref) {
|
|
59
|
+
const cli = getConnectorDefinition(ref);
|
|
60
|
+
if (cli?.runtime.type === "cli") return {
|
|
61
|
+
key: `${ref}:default`,
|
|
62
|
+
connectorId: ref,
|
|
63
|
+
label: cli.displayName,
|
|
64
|
+
capabilities: Object.entries(getCliAdapter(cli.runtime.adapterId).curatedActions).filter(([, scope]) => scope === "read").map(([id]) => id)
|
|
65
|
+
};
|
|
47
66
|
const item = CANDIDATES.find((item) => `composio-${item.toolkit}` === ref);
|
|
48
67
|
const definition = item ? getConnectorDefinition(ref) : void 0;
|
|
49
68
|
if (!item || !definition) throw new Error("Unknown connection candidate. Search for a supported app first.");
|
|
@@ -35,6 +35,7 @@ export declare class ConnectionRecoveryService {
|
|
|
35
35
|
private view;
|
|
36
36
|
private ensureInstallation;
|
|
37
37
|
private checkCapabilities;
|
|
38
|
+
private syncConnections;
|
|
38
39
|
preflight(input: SessionInput): Promise<boolean>;
|
|
39
40
|
act(conversationId: string, action: ConnectionAction): Promise<{
|
|
40
41
|
snapshot: ConnectionWaitSnapshot;
|