@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region packages/gateway-contract/src/proactive.ts
|
|
4
|
-
var ProactiveLevelSchema, ProactiveTimezoneSchema, ProactivePreferencesSchema,
|
|
4
|
+
var ProactiveLevelSchema, ProactiveTimezoneSchema, ProactivePreferencesSchema, ProactiveSubscriptionSettingsSchema, ProactiveArtifactSchema, ProactiveTaskDraftSchema;
|
|
5
5
|
var init_proactive = __esmMin((() => {
|
|
6
6
|
ProactiveLevelSchema = z.enum([
|
|
7
7
|
"quiet",
|
|
@@ -46,7 +46,7 @@ var init_proactive = __esmMin((() => {
|
|
|
46
46
|
notificationsMuted: z.boolean().default(false),
|
|
47
47
|
revision: z.number().int().nonnegative().default(0)
|
|
48
48
|
});
|
|
49
|
-
|
|
49
|
+
z.object({
|
|
50
50
|
level: ProactivePreferencesSchema.shape.level.removeDefault().optional(),
|
|
51
51
|
timezone: ProactivePreferencesSchema.shape.timezone.removeDefault().optional(),
|
|
52
52
|
quietStartHour: ProactivePreferencesSchema.shape.quietStartHour.removeDefault().optional(),
|
|
@@ -74,13 +74,13 @@ var init_proactive = __esmMin((() => {
|
|
|
74
74
|
scanIntervalMinutes: z.number().int().min(15).max(10080).nullable().default(null),
|
|
75
75
|
userInstructions: z.string().max(12e3).default("")
|
|
76
76
|
});
|
|
77
|
-
|
|
77
|
+
ProactiveSubscriptionSettingsSchema.extend({
|
|
78
78
|
scenarioKey: z.string().min(1).max(100),
|
|
79
79
|
scopeKind: z.enum(["workspace", "project"]),
|
|
80
80
|
scopeId: z.string().min(1).max(200),
|
|
81
81
|
enabled: z.boolean().default(true)
|
|
82
82
|
}).strict();
|
|
83
|
-
|
|
83
|
+
z.object({
|
|
84
84
|
level: ProactiveSubscriptionSettingsSchema.shape.level.removeDefault().optional(),
|
|
85
85
|
delivery: ProactiveSubscriptionSettingsSchema.shape.delivery.removeDefault().optional(),
|
|
86
86
|
completedAt: ProactiveSubscriptionSettingsSchema.shape.completedAt.removeDefault().optional(),
|
|
@@ -102,7 +102,7 @@ var init_proactive = __esmMin((() => {
|
|
|
102
102
|
title: z.string().trim().min(1).max(160),
|
|
103
103
|
objective: z.string().trim().min(1).max(1200)
|
|
104
104
|
}).strict();
|
|
105
|
-
|
|
105
|
+
z.object({
|
|
106
106
|
actionId: z.enum([
|
|
107
107
|
"read",
|
|
108
108
|
"resolve",
|
|
@@ -133,4 +133,4 @@ var init_proactive = __esmMin((() => {
|
|
|
133
133
|
}));
|
|
134
134
|
//#endregion
|
|
135
135
|
init_proactive();
|
|
136
|
-
export { ProactiveArtifactSchema,
|
|
136
|
+
export { ProactiveArtifactSchema, ProactiveLevelSchema, ProactivePreferencesSchema, ProactiveSubscriptionSettingsSchema, ProactiveTaskDraftSchema, ProactiveTimezoneSchema, init_proactive };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region packages/gateway-contract/src/project-monitoring.ts
|
|
4
|
-
var MonitoringModeSchema, QuietHoursSchema
|
|
4
|
+
var MonitoringModeSchema, QuietHoursSchema;
|
|
5
5
|
var init_project_monitoring = __esmMin((() => {
|
|
6
6
|
MonitoringModeSchema = z.enum([
|
|
7
7
|
"observe",
|
|
@@ -13,7 +13,7 @@ var init_project_monitoring = __esmMin((() => {
|
|
|
13
13
|
endHour: z.number().int().min(0).max(23),
|
|
14
14
|
timezone: z.string().min(1)
|
|
15
15
|
});
|
|
16
|
-
|
|
16
|
+
z.object({
|
|
17
17
|
projectId: z.string(),
|
|
18
18
|
mode: MonitoringModeSchema,
|
|
19
19
|
quietHours: QuietHoursSchema.optional(),
|
|
@@ -23,7 +23,7 @@ var init_project_monitoring = __esmMin((() => {
|
|
|
23
23
|
configured: z.boolean(),
|
|
24
24
|
updatedAt: z.number().optional()
|
|
25
25
|
});
|
|
26
|
-
|
|
26
|
+
z.object({
|
|
27
27
|
mode: MonitoringModeSchema.optional(),
|
|
28
28
|
quietHours: QuietHoursSchema.nullable().optional(),
|
|
29
29
|
allowedActions: z.array(z.string()).optional(),
|
|
@@ -33,4 +33,4 @@ var init_project_monitoring = __esmMin((() => {
|
|
|
33
33
|
}));
|
|
34
34
|
//#endregion
|
|
35
35
|
init_project_monitoring();
|
|
36
|
-
export { MonitoringModeSchema,
|
|
36
|
+
export { MonitoringModeSchema, QuietHoursSchema, init_project_monitoring };
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { __esmMin } from "../../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { TaskAttentionItemSchema, TaskOperationalStateSchema, TaskPhaseSchema, TaskResolutionSchema } from "./task-lifecycle.js";
|
|
3
3
|
import { TaskDependencySummarySchema, TaskPrioritySchema, TaskRunReceiptSchema, init_tasks } from "./tasks.js";
|
|
4
|
-
import { ProjectMonitoringPolicySchema, init_project_monitoring } from "./project-monitoring.js";
|
|
5
4
|
import { z } from "zod";
|
|
6
5
|
//#region packages/gateway-contract/src/project-operating.ts
|
|
7
6
|
var ProjectSummarySchema, ProjectTaskDependencyEdgeSchema, ProjectTaskCardSchema;
|
|
8
7
|
var init_project_operating = __esmMin((() => {
|
|
9
8
|
init_tasks();
|
|
10
|
-
init_project_monitoring();
|
|
11
9
|
ProjectSummarySchema = z.object({
|
|
12
10
|
id: z.string(),
|
|
13
11
|
name: z.string(),
|
|
@@ -91,8 +89,7 @@ var init_project_operating = __esmMin((() => {
|
|
|
91
89
|
]),
|
|
92
90
|
summary: z.string(),
|
|
93
91
|
recommendedAction: z.string().optional()
|
|
94
|
-
})
|
|
95
|
-
monitoring: ProjectMonitoringPolicySchema
|
|
92
|
+
})
|
|
96
93
|
});
|
|
97
94
|
}));
|
|
98
95
|
//#endregion
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* Agent Manager - Manages Agent instances per session
|
|
3
|
-
*
|
|
4
|
-
* Each session gets its own Agent instance for true isolation
|
|
5
|
-
* and concurrent processing across sessions.
|
|
6
|
-
*/
|
|
1
|
+
import type { SceneAccess } from '../scenes/httpServices.js';
|
|
7
2
|
import { Agent, type AgentMessage, type AgentEvent, type ThinkingLevel } from '@earendil-works/pi-agent-core';
|
|
8
3
|
import type { AgentInstanceGateway } from './agent-instance-gateway.js';
|
|
9
4
|
import { type Config } from '../config/schema.js';
|
|
@@ -95,6 +90,7 @@ export interface AgentManagerConfig {
|
|
|
95
90
|
};
|
|
96
91
|
/** Gateway: exposes AutomationService for the `automation` tool. */
|
|
97
92
|
getAutomationService?: () => AutomationService | undefined;
|
|
93
|
+
getSceneAccess?: () => SceneAccess | undefined;
|
|
98
94
|
getBrowserAutomationService?: () => import('../browser/automations/index.js').BrowserAutomationService | undefined;
|
|
99
95
|
emitBrowserEvent?: (type: string, payload: unknown) => void;
|
|
100
96
|
/** Gateway: exposes first-class xopc product objects for the `xopc_use` tool. */
|
|
@@ -4,7 +4,7 @@ import { init_logger } from "../utils/logger.js";
|
|
|
4
4
|
import { isXopcDatabaseOpen } from "../storage/sqlite/connection.js";
|
|
5
5
|
import { consumeClarificationApproval } from "../storage/sqlite/clarification-wait-repository.js";
|
|
6
6
|
import { getInteractionState } from "../storage/sqlite/interaction-state-repository.js";
|
|
7
|
-
import { getSessionMetadata } from "../storage/sqlite/session-repository.js";
|
|
7
|
+
import { getSessionMetadata } from "../storage/sqlite/session-read-repository.js";
|
|
8
8
|
import "../storage/sqlite/index.js";
|
|
9
9
|
import { getAgentDefaultModelRef, init_schema } from "../config/schema.js";
|
|
10
10
|
import { applyConfigOverrides } from "../config/runtime-overrides.js";
|
|
@@ -262,6 +262,7 @@ var AgentManager = class {
|
|
|
262
262
|
getSessionStore: this.config.getSessionStore,
|
|
263
263
|
gatewayClarify: this.config.gatewayClarify,
|
|
264
264
|
getAutomationService: this.config.getAutomationService,
|
|
265
|
+
getSceneAccess: this.config.getSceneAccess,
|
|
265
266
|
getBrowserAutomationService: this.config.getBrowserAutomationService,
|
|
266
267
|
emitBrowserEvent: this.config.emitBrowserEvent,
|
|
267
268
|
getNotesService: this.config.getNotesService,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { finishContextExtractionRun } from "../../storage/sqlite/context-extraction-repository.js";
|
|
4
|
-
import { getSessionMetadata } from "../../storage/sqlite/session-repository.js";
|
|
4
|
+
import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
|
|
5
5
|
import { loadCompactionSourceSnapshot } from "../../storage/sqlite/transcript-repository.js";
|
|
6
6
|
import "../../storage/sqlite/index.js";
|
|
7
7
|
import { extractProfileAgentId } from "../../config/agent-profile.js";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { resolveStateDir } from "../../config/paths-state.js";
|
|
2
2
|
import { init_global_singleton, resolveGlobalSingleton } from "../../utils/global-singleton.js";
|
|
3
3
|
import { init_paths } from "../../config/paths.js";
|
|
4
|
-
import { DurableState } from "../../storage/sqlite/durable-state.js";
|
|
5
4
|
import { spawnProcess } from "../../process/run-process.js";
|
|
5
|
+
import { DurableState } from "../../storage/sqlite/durable-state.js";
|
|
6
6
|
import { isolatedCommand, removeCommandContainer } from "./command-isolation.js";
|
|
7
7
|
import { readWorkspaceRevision } from "../coding/workspace-revision.js";
|
|
8
8
|
import { join } from "node:path";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isXopcDatabaseOpen } from "../../storage/sqlite/connection.js";
|
|
2
|
-
import { getSessionMetadata } from "../../storage/sqlite/session-repository.js";
|
|
2
|
+
import { getSessionMetadata } from "../../storage/sqlite/session-read-repository.js";
|
|
3
3
|
import "../../storage/sqlite/index.js";
|
|
4
4
|
import { sanitizeForPromptLiteral } from "../prompt/sanitize-for-prompt.js";
|
|
5
5
|
import { TaskRepository } from "../../tasks/task-repository.js";
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Config } from '../../config/schema.js';
|
|
2
|
+
import type { ExternalToolProvider, ExternalToolExecutionContext, ExternalToolTurnContext } from './types.js';
|
|
3
|
+
export declare class CliToolProvider implements ExternalToolProvider {
|
|
4
|
+
private readonly deps;
|
|
5
|
+
readonly source: "cli";
|
|
6
|
+
constructor(deps: {
|
|
7
|
+
getConfig: () => Config | undefined;
|
|
8
|
+
getCurrentContext: () => ExternalToolTurnContext | null;
|
|
9
|
+
agentId?: string;
|
|
10
|
+
});
|
|
11
|
+
private available;
|
|
12
|
+
search(query: string): Promise<{
|
|
13
|
+
toolRef: string;
|
|
14
|
+
source: "cli";
|
|
15
|
+
namespace: string;
|
|
16
|
+
title: string;
|
|
17
|
+
summary: string;
|
|
18
|
+
}[]>;
|
|
19
|
+
describe(toolRef: string): Promise<{
|
|
20
|
+
toolRef: string;
|
|
21
|
+
source: "cli";
|
|
22
|
+
namespace: string;
|
|
23
|
+
title: string;
|
|
24
|
+
summary: string;
|
|
25
|
+
description: string;
|
|
26
|
+
batchRead: boolean;
|
|
27
|
+
inputSchema: {
|
|
28
|
+
properties: {
|
|
29
|
+
xopcAccountId: {
|
|
30
|
+
type: string;
|
|
31
|
+
description: string;
|
|
32
|
+
};
|
|
33
|
+
xopcExportResult: {
|
|
34
|
+
type: string;
|
|
35
|
+
description: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
}>;
|
|
40
|
+
execute(toolRef: string, args: Record<string, unknown>, approvalId: string | undefined, context: ExternalToolExecutionContext): Promise<{
|
|
41
|
+
content: {
|
|
42
|
+
type: "text";
|
|
43
|
+
text: string;
|
|
44
|
+
}[];
|
|
45
|
+
details: {};
|
|
46
|
+
}>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { isXopcDatabaseOpen } from "../../storage/sqlite/connection.js";
|
|
2
|
+
import { getSqliteDatabase, init_transaction, runSqliteWriteTransaction } from "../../storage/sqlite/transaction.js";
|
|
3
|
+
import { getSessionInputState, init_session_input_repository } from "../../storage/sqlite/session-input-repository.js";
|
|
4
|
+
import { getConnectorAccount, init_connector_account_repository } from "../../storage/sqlite/connector-account-repository.js";
|
|
5
|
+
import { appendConnectorExecutionAudit, consumeConnectorApproval, createConnectorApproval, getConnectorApproval, getConnectorConnection, getConnectorInstallation, init_connector_repository } from "../../storage/sqlite/connector-repository.js";
|
|
6
|
+
import { connectorObjectiveScope, init_connection_wait_repository, publishConnectionWait, requireSessionConnection } from "../../storage/sqlite/connection-wait-repository.js";
|
|
7
|
+
import "../../storage/sqlite/index.js";
|
|
8
|
+
import { connectorArgumentsHash, connectorArgumentsPreview } from "../../connectors/approval.js";
|
|
9
|
+
import { selectConnectorAccount } from "../../connectors/account-selection.js";
|
|
10
|
+
import { cliContextPath } from "../../connectors/cli/process.js";
|
|
11
|
+
import { validateActionInput } from "../../connectors/cli/protocol.js";
|
|
12
|
+
import { getCliAdapter } from "../../connectors/cli/adapterRegistry.js";
|
|
13
|
+
import { evaluateConnectorExecutionPolicy } from "../../connectors/policy.js";
|
|
14
|
+
import { listConnectorInstances } from "../../connectors/instances.js";
|
|
15
|
+
import { cliOwnerId, recoverCliExecutions } from "../../connectors/cli/store.js";
|
|
16
|
+
import { describeCliAction, executeCliAction } from "../../connectors/cli/runtime.js";
|
|
17
|
+
import { connectorPrincipalForSession } from "../../connectors/principal.js";
|
|
18
|
+
import { externalToolRef, parseExternalToolRef } from "./refs.js";
|
|
19
|
+
import { join } from "node:path";
|
|
20
|
+
import { randomUUID } from "node:crypto";
|
|
21
|
+
import { writeFile } from "node:fs/promises";
|
|
22
|
+
//#region src/agent/external-tools/cliProvider.ts
|
|
23
|
+
init_connector_account_repository();
|
|
24
|
+
init_connector_repository();
|
|
25
|
+
init_connection_wait_repository();
|
|
26
|
+
init_session_input_repository();
|
|
27
|
+
init_transaction();
|
|
28
|
+
const result = (value) => ({
|
|
29
|
+
content: [{
|
|
30
|
+
type: "text",
|
|
31
|
+
text: JSON.stringify(value)
|
|
32
|
+
}],
|
|
33
|
+
details: {}
|
|
34
|
+
});
|
|
35
|
+
var CliToolProvider = class {
|
|
36
|
+
source = "cli";
|
|
37
|
+
constructor(deps) {
|
|
38
|
+
this.deps = deps;
|
|
39
|
+
}
|
|
40
|
+
available() {
|
|
41
|
+
const config = this.deps.getConfig();
|
|
42
|
+
if (!config || !isXopcDatabaseOpen()) return [];
|
|
43
|
+
recoverCliExecutions();
|
|
44
|
+
const principal = connectorPrincipalForSession(this.deps.getCurrentContext()?.conversationId);
|
|
45
|
+
return listConnectorInstances(config).flatMap((instance) => {
|
|
46
|
+
if (instance.materialized.type !== "cli" || !instance.enabled) return [];
|
|
47
|
+
const policy = getConnectorInstallation(`${instance.connectorId}-${principal.principalId}`);
|
|
48
|
+
const agentId = this.deps.agentId ?? principal.agentId;
|
|
49
|
+
if (!policy?.enabled || policy.allowedAgentIds.length && (!agentId || !policy.allowedAgentIds.includes(agentId))) return [];
|
|
50
|
+
return [{
|
|
51
|
+
config,
|
|
52
|
+
instance,
|
|
53
|
+
policy,
|
|
54
|
+
principal,
|
|
55
|
+
agentId,
|
|
56
|
+
adapter: getCliAdapter(instance.materialized.adapterId)
|
|
57
|
+
}];
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
async search(query) {
|
|
61
|
+
const words = query.toLowerCase().split(/\s+/).filter(Boolean);
|
|
62
|
+
return this.available().flatMap((item) => {
|
|
63
|
+
const accounts = selectConnectorAccount({
|
|
64
|
+
installation: item.policy,
|
|
65
|
+
agentId: item.agentId,
|
|
66
|
+
accept: (c) => c.provider === "cli" && c.metadata.runtimeInstanceId === item.instance.instanceId
|
|
67
|
+
}).candidates;
|
|
68
|
+
if (!accounts.length) return [];
|
|
69
|
+
return Object.entries(item.adapter.curatedActions).filter(([id, scope]) => {
|
|
70
|
+
const text = `${item.instance.displayName} ${item.instance.connectorId} ${item.adapter.id} ${id}`.toLowerCase();
|
|
71
|
+
return (!words.length || words.some((word) => text.includes(word))) && evaluateConnectorExecutionPolicy({
|
|
72
|
+
installation: item.policy,
|
|
73
|
+
action: {
|
|
74
|
+
scope,
|
|
75
|
+
curated: true
|
|
76
|
+
},
|
|
77
|
+
agentId: item.agentId,
|
|
78
|
+
accountId: accounts[0].accountId,
|
|
79
|
+
confirmed: true
|
|
80
|
+
}).decision === "allowed";
|
|
81
|
+
}).map(([id]) => ({
|
|
82
|
+
toolRef: externalToolRef("cli", item.instance.instanceId, id),
|
|
83
|
+
source: this.source,
|
|
84
|
+
namespace: item.instance.connectorId,
|
|
85
|
+
title: id,
|
|
86
|
+
summary: `${item.instance.displayName}: ${id}`
|
|
87
|
+
}));
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
async describe(toolRef) {
|
|
91
|
+
const parsed = parseExternalToolRef(toolRef, this.source);
|
|
92
|
+
const item = this.available().find((value) => value.instance.instanceId === parsed?.namespace);
|
|
93
|
+
if (!item || !parsed) return void 0;
|
|
94
|
+
const selected = selectConnectorAccount({
|
|
95
|
+
installation: item.policy,
|
|
96
|
+
agentId: item.agentId,
|
|
97
|
+
accept: (c) => c.provider === "cli" && c.metadata.runtimeInstanceId === item.instance.instanceId
|
|
98
|
+
});
|
|
99
|
+
const connection = selected.connection ?? selected.candidates[0];
|
|
100
|
+
if (!connection) return void 0;
|
|
101
|
+
const action = await describeCliAction(item.config, item.instance.instanceId, connection, parsed.toolName);
|
|
102
|
+
if (evaluateConnectorExecutionPolicy({
|
|
103
|
+
installation: item.policy,
|
|
104
|
+
action: {
|
|
105
|
+
scope: action.scope,
|
|
106
|
+
curated: true
|
|
107
|
+
},
|
|
108
|
+
agentId: item.agentId,
|
|
109
|
+
accountId: connection.accountId,
|
|
110
|
+
confirmed: true
|
|
111
|
+
}).decision !== "allowed") return void 0;
|
|
112
|
+
return {
|
|
113
|
+
toolRef,
|
|
114
|
+
source: this.source,
|
|
115
|
+
namespace: item.instance.connectorId,
|
|
116
|
+
title: action.id,
|
|
117
|
+
summary: action.description,
|
|
118
|
+
description: action.description,
|
|
119
|
+
batchRead: action.scope === "read",
|
|
120
|
+
inputSchema: {
|
|
121
|
+
...action.inputSchema,
|
|
122
|
+
properties: {
|
|
123
|
+
...action.inputSchema.properties,
|
|
124
|
+
xopcAccountId: {
|
|
125
|
+
type: "string",
|
|
126
|
+
description: "Stable account ID; required when multiple accounts are available."
|
|
127
|
+
},
|
|
128
|
+
xopcExportResult: {
|
|
129
|
+
type: "boolean",
|
|
130
|
+
description: "Save the successful result as a JSON artifact in this account context."
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
async execute(toolRef, args, approvalId, context) {
|
|
137
|
+
const parsed = parseExternalToolRef(toolRef, this.source);
|
|
138
|
+
const item = this.available().find((value) => value.instance.instanceId === parsed?.namespace);
|
|
139
|
+
if (!item || !parsed) throw new Error("CLI connector is unavailable.");
|
|
140
|
+
const conversationId = this.deps.getCurrentContext()?.conversationId;
|
|
141
|
+
const selected = selectConnectorAccount({
|
|
142
|
+
installation: item.policy,
|
|
143
|
+
agentId: item.agentId,
|
|
144
|
+
conversationId,
|
|
145
|
+
requestedAccountId: typeof args.xopcAccountId === "string" ? args.xopcAccountId : void 0,
|
|
146
|
+
accept: (c) => c.provider === "cli" && c.metadata.runtimeInstanceId === item.instance.instanceId
|
|
147
|
+
});
|
|
148
|
+
const connection = selected.connection;
|
|
149
|
+
if (!connection) return result({
|
|
150
|
+
status: "account_selection_required",
|
|
151
|
+
accounts: selected.candidates.map((c) => ({
|
|
152
|
+
id: c.accountId,
|
|
153
|
+
identity: c.identity
|
|
154
|
+
})),
|
|
155
|
+
instruction: "Select a connected account using xopcAccountId. Never substitute another account."
|
|
156
|
+
});
|
|
157
|
+
const action = await describeCliAction(item.config, item.instance.instanceId, connection, parsed.toolName);
|
|
158
|
+
if (args.xopcExportResult !== void 0 && typeof args.xopcExportResult !== "boolean") throw new Error("Invalid export option.");
|
|
159
|
+
const exportResult = args.xopcExportResult === true;
|
|
160
|
+
const input = { ...args };
|
|
161
|
+
delete input.xopcAccountId;
|
|
162
|
+
delete input.xopcExportResult;
|
|
163
|
+
validateActionInput(action, input);
|
|
164
|
+
const scopes = Array.isArray(connection.metadata.scopes) ? connection.metadata.scopes : [];
|
|
165
|
+
if (action.requiredScopes.some((scope) => !scopes.includes(scope))) throw new Error("CLI account is missing required scopes. Reauthorize this account.");
|
|
166
|
+
const argumentsHash = () => connectorArgumentsHash({
|
|
167
|
+
args: input,
|
|
168
|
+
exportResult,
|
|
169
|
+
instanceId: item.instance.instanceId,
|
|
170
|
+
accountId: connection.accountId,
|
|
171
|
+
connectionId: connection.id,
|
|
172
|
+
actionRevision: action.revision,
|
|
173
|
+
binaryVersion: item.adapter.binaryVersion,
|
|
174
|
+
adapterVersion: item.adapter.version,
|
|
175
|
+
principalId: item.principal.principalId,
|
|
176
|
+
agentId: item.agentId,
|
|
177
|
+
conversationId,
|
|
178
|
+
objective: conversationId ? connectorObjectiveScope(conversationId) : void 0
|
|
179
|
+
});
|
|
180
|
+
const decision = evaluateConnectorExecutionPolicy({
|
|
181
|
+
installation: item.policy,
|
|
182
|
+
action: {
|
|
183
|
+
scope: action.scope,
|
|
184
|
+
curated: true
|
|
185
|
+
},
|
|
186
|
+
agentId: item.agentId,
|
|
187
|
+
accountId: connection.accountId,
|
|
188
|
+
confirmed: Boolean(approvalId)
|
|
189
|
+
});
|
|
190
|
+
if (decision.decision === "denied") throw new Error(decision.reason);
|
|
191
|
+
if (decision.decision === "confirmation_required") {
|
|
192
|
+
const wait = conversationId && getSessionInputState(conversationId).activeInputId ? requireSessionConnection({
|
|
193
|
+
conversationId,
|
|
194
|
+
principalId: item.principal.principalId,
|
|
195
|
+
agentId: item.agentId ?? "main",
|
|
196
|
+
summary: `Confirm ${action.id}`,
|
|
197
|
+
needs: [{
|
|
198
|
+
key: `${item.instance.connectorId}:${connection.accountId}`,
|
|
199
|
+
connectorId: item.instance.connectorId,
|
|
200
|
+
accountId: connection.accountId,
|
|
201
|
+
connectionId: connection.id,
|
|
202
|
+
label: item.instance.displayName,
|
|
203
|
+
capabilities: [action.id]
|
|
204
|
+
}]
|
|
205
|
+
}) : void 0;
|
|
206
|
+
const approval = createConnectorApproval({
|
|
207
|
+
principalId: item.principal.principalId,
|
|
208
|
+
connectorId: item.instance.connectorId,
|
|
209
|
+
connectionId: connection.id,
|
|
210
|
+
agentId: item.agentId,
|
|
211
|
+
conversationId,
|
|
212
|
+
waitId: wait?.waitId,
|
|
213
|
+
actionId: action.id,
|
|
214
|
+
scope: action.scope,
|
|
215
|
+
argumentsHash: argumentsHash(),
|
|
216
|
+
argumentsPreview: {
|
|
217
|
+
account: {
|
|
218
|
+
id: connection.accountId,
|
|
219
|
+
identity: connection.identity
|
|
220
|
+
},
|
|
221
|
+
arguments: connectorArgumentsPreview(input)
|
|
222
|
+
},
|
|
223
|
+
expiresAt: new Date(Date.now() + 6e5).toISOString()
|
|
224
|
+
});
|
|
225
|
+
if (wait && conversationId) publishConnectionWait(conversationId);
|
|
226
|
+
return result({
|
|
227
|
+
status: "confirmation_required",
|
|
228
|
+
approvalId: approval.id,
|
|
229
|
+
argumentsPreview: approval.argumentsPreview,
|
|
230
|
+
instruction: "Approve this exact action in xopc, then retry with unchanged arguments and approvalId."
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
const executionId = randomUUID();
|
|
234
|
+
let authorized = false;
|
|
235
|
+
const beforeExecute = () => {
|
|
236
|
+
runSqliteWriteTransaction((db) => {
|
|
237
|
+
const hash = argumentsHash();
|
|
238
|
+
const freshPolicy = getConnectorInstallation(item.policy.id);
|
|
239
|
+
const freshConnection = getConnectorConnection(connection.id);
|
|
240
|
+
if (!freshPolicy || freshConnection?.status !== "active" || getConnectorAccount(connection.accountId)?.currentConnectionId !== connection.id || !selectConnectorAccount({
|
|
241
|
+
installation: freshPolicy,
|
|
242
|
+
agentId: item.agentId,
|
|
243
|
+
conversationId,
|
|
244
|
+
requestedAccountId: connection.accountId
|
|
245
|
+
}).connection || evaluateConnectorExecutionPolicy({
|
|
246
|
+
installation: freshPolicy,
|
|
247
|
+
action: {
|
|
248
|
+
scope: action.scope,
|
|
249
|
+
curated: true
|
|
250
|
+
},
|
|
251
|
+
accountId: connection.accountId,
|
|
252
|
+
agentId: item.agentId,
|
|
253
|
+
confirmed: Boolean(approvalId)
|
|
254
|
+
}).decision !== "allowed") throw new Error("Connector permission changed.");
|
|
255
|
+
if (approvalId) {
|
|
256
|
+
const approval = getConnectorApproval(approvalId);
|
|
257
|
+
if (!approval || approval.argumentsHash !== hash || !consumeConnectorApproval(approvalId, hash)) throw new Error("Approval is invalid, expired or already consumed.");
|
|
258
|
+
}
|
|
259
|
+
db.prepare(`INSERT INTO connector_cli_executions (id,instance_id,account_id,connection_id,action_id,revision,arguments_hash,status,owner_id,started_at)
|
|
260
|
+
VALUES (?,?,?,?,?,?,?,'running',?,?)`).run(executionId, item.instance.instanceId, connection.accountId, connection.id, action.id, action.revision, hash, cliOwnerId, Date.now());
|
|
261
|
+
});
|
|
262
|
+
authorized = true;
|
|
263
|
+
};
|
|
264
|
+
const started = Date.now();
|
|
265
|
+
let output;
|
|
266
|
+
try {
|
|
267
|
+
output = await executeCliAction(item.config, item.instance.instanceId, connection, action, input, context.signal, beforeExecute);
|
|
268
|
+
} catch (error) {
|
|
269
|
+
output = {
|
|
270
|
+
outcome: authorized && action.scope !== "read" ? "unknown" : "failed",
|
|
271
|
+
error: {
|
|
272
|
+
kind: "runtime",
|
|
273
|
+
message: error instanceof Error ? error.message : "CLI failed."
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
getSqliteDatabase().prepare("UPDATE connector_cli_executions SET status = ?, error_kind = ?, finished_at = ? WHERE id = ?").run(output.outcome, output.error?.kind ?? null, Date.now(), executionId);
|
|
278
|
+
appendConnectorExecutionAudit({
|
|
279
|
+
installationId: item.policy.id,
|
|
280
|
+
connectionId: connection.id,
|
|
281
|
+
connectorId: item.instance.connectorId,
|
|
282
|
+
principalId: item.principal.principalId,
|
|
283
|
+
agentId: item.agentId,
|
|
284
|
+
conversationId,
|
|
285
|
+
actionId: action.id,
|
|
286
|
+
scope: action.scope,
|
|
287
|
+
decision: authorized ? "allowed" : "denied",
|
|
288
|
+
resultStatus: output.outcome === "success" ? "success" : "error",
|
|
289
|
+
errorCode: output.outcome === "unknown" ? "outcome_unknown" : output.error?.kind,
|
|
290
|
+
durationMs: Date.now() - started
|
|
291
|
+
});
|
|
292
|
+
let artifact;
|
|
293
|
+
if (exportResult && output.outcome === "success") try {
|
|
294
|
+
await writeFile(join(cliContextPath(String(connection.metadata.contextId)), "files", `${executionId}.json`), JSON.stringify(output.data ?? null, null, 2), {
|
|
295
|
+
mode: 384,
|
|
296
|
+
flag: "wx"
|
|
297
|
+
});
|
|
298
|
+
artifact = `/api/connectors/executions/${executionId}/artifact`;
|
|
299
|
+
} catch {
|
|
300
|
+
return result({
|
|
301
|
+
executionId,
|
|
302
|
+
accountId: connection.accountId,
|
|
303
|
+
...output,
|
|
304
|
+
artifactError: "The action succeeded, but its JSON export could not be saved. Do not repeat the action to retry export."
|
|
305
|
+
});
|
|
306
|
+
}
|
|
307
|
+
return result({
|
|
308
|
+
...authorized ? { executionId } : {},
|
|
309
|
+
artifact,
|
|
310
|
+
accountId: connection.accountId,
|
|
311
|
+
...output,
|
|
312
|
+
...output.outcome === "unknown" ? { instruction: "The write may have succeeded. Inspect the provider using a read action; do not retry automatically." } : {}
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
//#endregion
|
|
317
|
+
export { CliToolProvider };
|
|
@@ -6,16 +6,16 @@ import { consumeConnectorApproval, createConnectorApproval, getConnectorApproval
|
|
|
6
6
|
import { bindObjectiveAccount, connectionBinding, connectionBindings, connectorObjectiveScope, init_connection_wait_repository, publishConnectionWait, requireSessionConnection } from "../../storage/sqlite/connection-wait-repository.js";
|
|
7
7
|
import "../../storage/sqlite/index.js";
|
|
8
8
|
import { connectorArgumentsHash, connectorArgumentsPreview } from "../../connectors/approval.js";
|
|
9
|
-
import { connectorIdentitySummary } from "../../connectors/connector-identity.js";
|
|
10
9
|
import { canAccessConnectorAccount, currentAccountConnections } from "../../connectors/account-access.js";
|
|
10
|
+
import { connectorIdentitySummary } from "../../connectors/connector-identity.js";
|
|
11
11
|
import { ComposioSessionsAdapter } from "../../connectors/composio-sessions.js";
|
|
12
12
|
import { getComposioToolkitScope, getConfiguredComposioAuthConfigs, isComposioActionAllowedByCatalog, scopeForComposioAction } from "../../connectors/composio.js";
|
|
13
13
|
import { getConnectorDefinition } from "../../connectors/catalog.js";
|
|
14
14
|
import { listConnectorInstances } from "../../connectors/instances.js";
|
|
15
|
-
import { isToolInputSchema } from "../../connectors/connection-capabilities.js";
|
|
16
15
|
import { connectorPrincipalForSession } from "../../connectors/principal.js";
|
|
17
|
-
import { ExternalToolSearchError } from "./search-error.js";
|
|
18
16
|
import { externalToolRef, parseExternalToolRef } from "./refs.js";
|
|
17
|
+
import { isToolInputSchema } from "../../connectors/connection-capabilities.js";
|
|
18
|
+
import { ExternalToolSearchError } from "./search-error.js";
|
|
19
19
|
//#region src/agent/external-tools/composio-provider.ts
|
|
20
20
|
init_session_input_repository();
|
|
21
21
|
init_connection_wait_repository();
|
|
@@ -19,7 +19,7 @@ const ToolSearchSchema = Type.Object({
|
|
|
19
19
|
query: Type.String({ description: "Describe the capability or task you need." }),
|
|
20
20
|
sources: Type.Optional(Type.Array(Type.Union(EXTERNAL_TOOL_SOURCES.map((source) => Type.Literal(source))), {
|
|
21
21
|
maxItems: EXTERNAL_TOOL_SOURCES.length,
|
|
22
|
-
description: "
|
|
22
|
+
description: "Omit to search all sources (recommended). Set only to intentionally restrict providers. Feishu/Lark, WeCom and WPS 365 connectors use cli."
|
|
23
23
|
})),
|
|
24
24
|
limit: Type.Optional(Type.Integer({
|
|
25
25
|
minimum: 1,
|
|
@@ -52,11 +52,17 @@ function createExternalToolGatewayTools(providers, getContext) {
|
|
|
52
52
|
const searchTool = {
|
|
53
53
|
name: EXTERNAL_TOOL_NAMES.search,
|
|
54
54
|
label: "🔎 External Tool Search",
|
|
55
|
-
description:
|
|
55
|
+
description: `Search external tools from these sources: ${EXTERNAL_TOOL_SOURCES.join(", ")}. CLI connectors include Feishu/Lark, WeCom and WPS 365. Omit sources unless intentionally restricting the search; do not guess a source list. Use concise English capability keywords, e.g. "wecom doc.search". Returns compact references only; call xopc_tool_describe before execution. If a source-filtered search finds no relevant tools, retry without sources before concluding a capability is unavailable or requesting a connection.`,
|
|
56
56
|
parameters: ToolSearchSchema,
|
|
57
57
|
async execute(_toolCallId, params) {
|
|
58
|
+
const selectedSources = new Set(params.sources ?? []);
|
|
59
|
+
const excludedSources = selectedSources.size ? EXTERNAL_TOOL_SOURCES.filter((source) => !selectedSources.has(source)) : [];
|
|
58
60
|
return textResult({
|
|
59
61
|
...await service.search(params),
|
|
62
|
+
...excludedSources.length ? { searchScope: {
|
|
63
|
+
excludedSources,
|
|
64
|
+
instruction: "This search excluded these sources. Results from other apps do not establish that the requested app is unavailable. Retry without sources before declaring a capability unavailable or requesting authorization. Feishu/Lark, WeCom and WPS 365 connectors use cli."
|
|
65
|
+
} } : {},
|
|
60
66
|
connectionCandidates: connectionCandidates(params.query),
|
|
61
67
|
selectedConnections: getContext?.()?.conversationId ? connectionBindings(getContext().conversationId) : [],
|
|
62
68
|
waitingObjective: getContext?.()?.conversationId ? getActiveConnectionWait(getContext().conversationId)?.summary : void 0
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { resolveEffectiveAgentConfigForAgent, resolveEffectiveAgentConfigForSession } from "../../config/agent-profile.js";
|
|
2
|
+
import { CliToolProvider } from "./cliProvider.js";
|
|
2
3
|
import { ComposioToolProvider } from "./composio-provider.js";
|
|
3
4
|
import { ExtensionToolProvider } from "./extension-provider.js";
|
|
4
5
|
import { ExternalToolService } from "./service.js";
|
|
@@ -10,6 +11,11 @@ import { withExternalReadPolicy } from "./read-policy.js";
|
|
|
10
11
|
//#region src/agent/external-tools/index.ts
|
|
11
12
|
function createDefaultExternalToolGatewayTools(deps) {
|
|
12
13
|
const providers = [
|
|
14
|
+
new CliToolProvider({
|
|
15
|
+
getConfig: deps.getConfig,
|
|
16
|
+
getCurrentContext: deps.getCurrentContext,
|
|
17
|
+
agentId: deps.agentId
|
|
18
|
+
}),
|
|
13
19
|
new McpToolProvider({
|
|
14
20
|
workspace: deps.workspace,
|
|
15
21
|
getConfig: deps.getConfig,
|
|
@@ -120,7 +120,7 @@ var ExternalToolService = class {
|
|
|
120
120
|
if (params.readOnly && current.batchRead !== true) throw new Error("This external operation is not approved for batch reads");
|
|
121
121
|
if (current.revision !== params.revision) throw new Error(`Tool contract changed. Describe ${params.toolRef} again before executing it.`);
|
|
122
122
|
const args = params.arguments ?? {};
|
|
123
|
-
if (params.readOnly && provider.source === "composio" && (typeof args.xopcAccountId !== "string" || !args.xopcAccountId)) throw new Error("Batch connector reads require an explicit xopcAccountId");
|
|
123
|
+
if (params.readOnly && (provider.source === "composio" || provider.source === "cli") && (typeof args.xopcAccountId !== "string" || !args.xopcAccountId)) throw new Error("Batch connector reads require an explicit xopcAccountId");
|
|
124
124
|
let validate;
|
|
125
125
|
try {
|
|
126
126
|
validate = this.ajv.compile(current.inputSchema);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AgentToolResult, AgentToolUpdateCallback } from '@earendil-works/pi-agent-core';
|
|
2
2
|
import type { TurnOrigin } from '@xopcai/endpoint-tools-protocol';
|
|
3
|
-
export declare const EXTERNAL_TOOL_SOURCES: readonly ["mcp", "composio", "extension", "memory", "endpoint"];
|
|
3
|
+
export declare const EXTERNAL_TOOL_SOURCES: readonly ["cli", "mcp", "composio", "extension", "memory", "endpoint"];
|
|
4
4
|
export type ExternalToolSource = (typeof EXTERNAL_TOOL_SOURCES)[number];
|
|
5
5
|
export interface ExternalToolSearchHit {
|
|
6
6
|
toolRef: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { init_global_singleton, resolveGlobalSingleton } from "../../utils/global-singleton.js";
|
|
2
1
|
import { createLogger } from "../../utils/logger/index.js";
|
|
3
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
|
+
import { init_global_singleton, resolveGlobalSingleton } from "../../utils/global-singleton.js";
|
|
4
4
|
import { init_string_coerce, normalizeOptionalString } from "../../utils/string-coerce.js";
|
|
5
5
|
import { resolveConnectorSecretReferences } from "../../connectors/secret-store.js";
|
|
6
6
|
import { redactSensitiveUrlLikeString } from "../../utils/redact-sensitive-url.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { init_global_singleton, resolveGlobalSingleton } from "../../../utils/global-singleton.js";
|
|
2
1
|
import { createLogger } from "../../../utils/logger/index.js";
|
|
3
2
|
import { init_logger } from "../../../utils/logger.js";
|
|
3
|
+
import { init_global_singleton, resolveGlobalSingleton } from "../../../utils/global-singleton.js";
|
|
4
4
|
import { resolveConnectorSecretReferences } from "../../../connectors/secret-store.js";
|
|
5
5
|
import { redactSensitiveUrlLikeString } from "../../../utils/redact-sensitive-url.js";
|
|
6
6
|
import { resolveMcpTransportConfig } from "../mcp-transport-config.js";
|