@xopcai/xopc 0.0.308 → 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/_locales/en/messages.json +8 -0
- package/dist/browser-ext/_locales/zh_CN/messages.json +8 -0
- package/dist/browser-ext/dist/assets/{sidepanel-BbSQr-6P.css → sidepanel-DD6GEMvc.css} +16 -0
- package/dist/browser-ext/dist/sidepanel.html +1 -1
- package/dist/browser-ext/dist/sidepanel.js +537 -96
- 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-wgSB2HYK.js → activity-store-DVUTs1fk.js} +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-dUotwUO6.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-VPDIGRSS.js → agents-BiD9STyv.js} +1 -1
- package/dist/gateway/static/root/assets/{api-BKHmTb0w.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-zPz0rOND.js → app-management-settings-panel-C94LAxyt.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-DhvhR43G.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-BQVZMreT.js → archive-plugin-SwWFt5MT.js} +1 -1
- package/dist/gateway/static/root/assets/{attachment-load-CPE-TMPf.js → attachment-load-DdTFml9l.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-C4IAy_zF.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-DgTl7diZ.js → binary-plugins-47UTtDNq.js} +1 -1
- package/dist/gateway/static/root/assets/{block-editor-CcOVA-Gw.js → block-editor-DvzZkMG8.js} +3 -3
- package/dist/gateway/static/root/assets/{browser-automation-inputs-BzkJog8e.js → browser-automation-inputs-C611KRBx.js} +1 -1
- package/dist/gateway/static/root/assets/{browser-automations-page--zKAgj1k.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-BfLd2rIJ.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-BlC1OXX4.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-CF_zYzxX.js → dependency-picker-DCyyFLKp.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-CDwtLR7Z.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-CX5OXxEU.js → extension-debug-page-DA8WJ3-E.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-BytR1PaY.js → extension-page-C2BIB88m.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CkaMJA5F.js → extension-settings-page-kpYo979N.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-config-swr-B6wHa6ZI.js → gateway-config-swr-DUDX42qY.js} +1 -1
- package/dist/gateway/static/root/assets/{gateway-realtime-B53R0CA4.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-DRzGnEV-.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-Ck_pyDom.js → image-generation-api-D2YorS--.js} +1 -1
- package/dist/gateway/static/root/assets/{imports-page-DrtbjL8O.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-BlZh41Xq.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-DbP7wWuh.js → local-apps-page-DOZZBdqj.js} +1 -1
- package/dist/gateway/static/root/assets/{locale-store-msTfRK8P.js → locale-store-DA0Z5jM_.js} +1 -1
- package/dist/gateway/static/root/assets/{logs-page-C0n66FiO.js → logs-page-M8kz26yo.js} +2 -2
- package/dist/gateway/static/root/assets/{management-settings-i6GhxpGV.js → management-settings-JLqHYQvY.js} +1 -1
- package/dist/gateway/static/root/assets/{markdown-view-BInabSKf.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-CnWChQ3Y.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-BWitjb3e.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-gmi5LLwM.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-BSWtko7U.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-CtOjKGWg.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-DkyyDcl2.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-C0JDGN_V.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-Bt1K657Y.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-vq5Ujm03.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-1SZ-HFHX.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-B2pZCcxY.js → voice-api-key-field-D3urfd-n.js} +1 -1
- package/dist/gateway/static/root/assets/{voice-config-api-DgJML_uM.js → voice-config-api-DTyMdGOR.js} +1 -1
- package/dist/gateway/static/root/assets/{work-discovery-overlay-Bptv7bEY.js → work-discovery-overlay-JzM3Ylbs.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BijCrNc4.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/packages/gateway-contract/src/sessions.js +6 -1
- package/dist/src/agent/agent-manager.d.ts +2 -6
- package/dist/src/agent/agent-manager.js +31 -5
- package/dist/src/agent/background-review/run-background-review.js +1 -1
- package/dist/src/agent/child-agent-factory.d.ts +1 -0
- package/dist/src/agent/child-agent-factory.js +18 -4
- package/dist/src/agent/coding/repository-instructions.d.ts +4 -0
- package/dist/src/agent/coding/repository-instructions.js +46 -2
- package/dist/src/agent/commands/command-registry.js +1 -1
- package/dist/src/agent/context/execution-scope.js +1 -1
- package/dist/src/agent/data-acquisition/git.d.ts +17 -0
- package/dist/src/agent/data-acquisition/git.js +100 -0
- package/dist/src/agent/data-acquisition/render.d.ts +7 -0
- package/dist/src/agent/data-acquisition/render.js +79 -0
- package/dist/src/agent/data-acquisition/scheduler.d.ts +12 -0
- package/dist/src/agent/data-acquisition/scheduler.js +53 -0
- package/dist/src/agent/data-acquisition/schema.d.ts +75 -0
- package/dist/src/agent/data-acquisition/schema.js +206 -0
- package/dist/src/agent/data-acquisition/service.d.ts +10 -0
- package/dist/src/agent/data-acquisition/service.js +292 -0
- package/dist/src/agent/data-acquisition/types.d.ts +37 -0
- package/dist/src/agent/data-acquisition/types.js +5 -0
- package/dist/src/agent/embedded/run-turn.js +16 -4
- package/dist/src/agent/embedded/session-runner.d.ts +1 -0
- package/dist/src/agent/embedded/session-runner.js +3 -0
- package/dist/src/agent/embedded/tool-result-truncation.js +11 -0
- package/dist/src/agent/embedded/xopc-tools-bridge.js +2 -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 +15 -4
- package/dist/src/agent/external-tools/gateway-tools.js +10 -3
- package/dist/src/agent/external-tools/index.js +14 -1
- package/dist/src/agent/external-tools/read-policy.d.ts +6 -0
- package/dist/src/agent/external-tools/read-policy.js +21 -0
- package/dist/src/agent/external-tools/service.d.ts +1 -0
- package/dist/src/agent/external-tools/service.js +4 -1
- package/dist/src/agent/external-tools/types.d.ts +3 -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/orchestration/agent-turn-policy.js +25 -10
- package/dist/src/agent/orchestration/delegation-scope.d.ts +9 -0
- package/dist/src/agent/orchestration/delegation-scope.js +11 -0
- package/dist/src/agent/prompt/sections/tooling.js +3 -1
- package/dist/src/agent/prompt/subagent-context.js +4 -2
- package/dist/src/agent/sandbox/fileAccess.d.ts +2 -0
- package/dist/src/agent/sandbox/fileAccess.js +31 -2
- 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/dataBatch.d.ts +4 -0
- package/dist/src/agent/tools/dataBatch.js +50 -0
- package/dist/src/agent/tools/delegate-tool.d.ts +6 -3
- package/dist/src/agent/tools/delegate-tool.js +65 -48
- package/dist/src/agent/tools/delegation-parent-policy.d.ts +7 -0
- package/dist/src/agent/tools/delegation-parent-policy.js +41 -0
- package/dist/src/agent/tools/delegation-policy.d.ts +16 -0
- package/dist/src/agent/tools/delegation-policy.js +93 -0
- package/dist/src/agent/tools/factory.d.ts +4 -0
- package/dist/src/agent/tools/factory.js +45 -5
- package/dist/src/agent/tools/fetch-text.d.ts +7 -0
- package/dist/src/agent/tools/fetch-text.js +86 -0
- package/dist/src/agent/tools/find.js +1 -1
- package/dist/src/agent/tools/grep.js +11 -23
- package/dist/src/agent/tools/index.d.ts +1 -0
- package/dist/src/agent/tools/index.js +2 -1
- package/dist/src/agent/tools/knowledge-memory-tool.js +10 -2
- package/dist/src/agent/tools/read.js +7 -5
- package/dist/src/agent/tools/repository-search.d.ts +12 -2
- package/dist/src/agent/tools/repository-search.js +127 -74
- 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/web.js +19 -28
- 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/agent/workflow/subagent-runner.js +25 -3
- package/dist/src/agent/workflow/workflow-child-tools.js +13 -8
- package/dist/src/agent-config/schema.d.ts +7 -0
- package/dist/src/agent-config/schema.js +2 -0
- 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 +8 -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/agent-builtin-tools.d.ts +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 +2 -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/sessions.js +141 -13
- 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/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.d.ts +1 -0
- package/dist/src/storage/sqlite/index.js +4 -2
- package/dist/src/storage/sqlite/migrations/186_sidebar_layout.sql +16 -0
- 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/sidebar-layout-repository.d.ts +12 -0
- package/dist/src/storage/sqlite/sidebar-layout-repository.js +53 -0
- 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 +5 -3
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-C6LflMXr.js +0 -1
- package/dist/gateway/static/root/assets/api-DFOlahZv.js +0 -1
- package/dist/gateway/static/root/assets/apps-page-Pmslbzzr.js +0 -1
- package/dist/gateway/static/root/assets/automations-workspace-Fx5VUJRu.js +0 -6
- package/dist/gateway/static/root/assets/browser-settings-page-DBms6d35.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-settings-panel-epdDWIZy.js +0 -8
- package/dist/gateway/static/root/assets/channels-settings-B0bsDtmP.js +0 -1
- package/dist/gateway/static/root/assets/channels-status-swr-B2JwuTjG.js +0 -1
- package/dist/gateway/static/root/assets/computer-settings-page-Ckgc0Py-.js +0 -1
- package/dist/gateway/static/root/assets/connectors-page-By33-bF1.js +0 -2
- package/dist/gateway/static/root/assets/cron-expression-CqNE-nf6.js +0 -2
- package/dist/gateway/static/root/assets/date-picker-BS9ZjzYJ.js +0 -1
- package/dist/gateway/static/root/assets/desktop-pet-settings-C0djIc1J.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-CDKj9LQj.js +0 -1
- package/dist/gateway/static/root/assets/external-link-DjqjBmc3.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-store-BLDgrJ30.js +0 -1
- package/dist/gateway/static/root/assets/gateway-settings-_YU-1p0z.js +0 -1
- package/dist/gateway/static/root/assets/globe-DSSGFWFn.js +0 -1
- package/dist/gateway/static/root/assets/heartbeat-settings-CVIvvm4x.js +0 -1
- package/dist/gateway/static/root/assets/home-page-COCHelcL.js +0 -1
- package/dist/gateway/static/root/assets/index-CDfcPiPb.js +0 -79
- package/dist/gateway/static/root/assets/index-CRu1p38D.css +0 -1
- package/dist/gateway/static/root/assets/loader-circle-CifKLtgG.js +0 -1
- package/dist/gateway/static/root/assets/local-app-workbench-page-D7_Raxjw.js +0 -2
- package/dist/gateway/static/root/assets/markdown-view-Y68dCxuc.css +0 -1
- package/dist/gateway/static/root/assets/messages-F74LVAiU.js +0 -3
- package/dist/gateway/static/root/assets/note-detail-panel-C59d8vDW.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-C1GBPrVI.js +0 -8
- package/dist/gateway/static/root/assets/preview-open-alternatives-UaCWCxZv.js +0 -1
- package/dist/gateway/static/root/assets/proactive-page-CtSFJxoM.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-ILTmQ1YN.js +0 -1
- package/dist/gateway/static/root/assets/projects-page-snl4rOQZ.js +0 -1
- package/dist/gateway/static/root/assets/remote-access-hub-BbaAcEN3.js +0 -1
- package/dist/gateway/static/root/assets/sessions-page-DrWL71O8.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-BG0kl4HT.js +0 -1
- package/dist/gateway/static/root/assets/settings-page-DiIyMQ52.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-EPazhoZO.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-g2MdRXSZ.js +0 -1
- package/dist/gateway/static/root/assets/skill-reload-api-B1DPzu98.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-Wd0uYSPG.js +0 -2
- package/dist/gateway/static/root/assets/system-settings-panel-Cz1P-HDH.js +0 -1
- package/dist/gateway/static/root/assets/task-detail-page-BG3A5gPZ.js +0 -1
- package/dist/gateway/static/root/assets/tunnel-api-DQGoFuZO.js +0 -1
- package/dist/gateway/static/root/assets/use-autosave-DVDlBb95.js +0 -1
- package/dist/gateway/static/root/assets/user-model-page-qM5UiTGx.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-DRy1RAYH.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
|
@@ -2,6 +2,7 @@ import { createLogger } from "../../utils/logger/index.js";
|
|
|
2
2
|
import { init_logger } from "../../utils/logger.js";
|
|
3
3
|
import { getClarification, getClarificationResumeInput, isClarificationSuspended } from "../../storage/sqlite/clarification-wait-repository.js";
|
|
4
4
|
import { getConnectionResumeInput, init_connection_wait_repository, isConnectionSuspended } from "../../storage/sqlite/connection-wait-repository.js";
|
|
5
|
+
import { runWithEmbeddedExecutionSession } from "./execution-context.js";
|
|
5
6
|
import { isComputerControlActive, isComputerLeaseTool, stopComputerControl } from "../../computer/control-guard.js";
|
|
6
7
|
import { EmbeddedRunConflictError, abortEmbeddedRun, acquireEmbeddedRunLease, queueEmbeddedSteer } from "./runs.js";
|
|
7
8
|
import { lastAssistantPlainText, subscribeEmbeddedSessionEvents } from "./subscribe-session.js";
|
|
@@ -22,6 +23,7 @@ import { isPromptCacheExpired, recordPromptCacheTouch } from "../../providers/pr
|
|
|
22
23
|
import { markTurnToolResult } from "../memory/turn-provenance.js";
|
|
23
24
|
import { RepositoryInstructions } from "../coding/repository-instructions.js";
|
|
24
25
|
import { RunVerification } from "../coding/run-verification.js";
|
|
26
|
+
import { withDelegationScope } from "../orchestration/delegation-scope.js";
|
|
25
27
|
//#region src/agent/embedded/run-turn.ts
|
|
26
28
|
init_connection_wait_repository();
|
|
27
29
|
init_logger();
|
|
@@ -318,9 +320,16 @@ async function runXopcEmbeddedTurn(params) {
|
|
|
318
320
|
session.agent.afterToolCall = async (context) => {
|
|
319
321
|
connectionStopped ||= isConnectionSuspended(conversationId, runId);
|
|
320
322
|
clarificationStopped ||= isClarificationSuspended(conversationId, runId);
|
|
321
|
-
const scoped = context.toolCall.name === "read_file" ? await instructions.forTool(context.toolCall.name, context.args) : "";
|
|
323
|
+
const scoped = context.toolCall.name === "read_file" ? await instructions.forTool(context.toolCall.name, context.args) : context.toolCall.name === "data_batch" ? await instructions.forDataResult(context.result.content) : "";
|
|
322
324
|
const checked = await verification.afterTool(context);
|
|
323
|
-
if (scoped) checked.result
|
|
325
|
+
if (scoped && context.toolCall.name === "data_batch") checked.result = {
|
|
326
|
+
content: [{
|
|
327
|
+
type: "text",
|
|
328
|
+
text: `${scoped}\n\nNew directory instructions were discovered. Apply them before retrying the affected data queries; this result is not evidence of a complete search.`
|
|
329
|
+
}],
|
|
330
|
+
details: { status: "retry_required" }
|
|
331
|
+
};
|
|
332
|
+
else if (scoped) checked.result.content.unshift({
|
|
324
333
|
type: "text",
|
|
325
334
|
text: scoped
|
|
326
335
|
});
|
|
@@ -347,7 +356,10 @@ async function runXopcEmbeddedTurn(params) {
|
|
|
347
356
|
};
|
|
348
357
|
runAbortSignal.addEventListener("abort", abortListener, { once: true });
|
|
349
358
|
try {
|
|
350
|
-
await runAgentTurnWithTimeout(session.agent,
|
|
359
|
+
await runAgentTurnWithTimeout(session.agent, () => withDelegationScope({
|
|
360
|
+
tools,
|
|
361
|
+
authorizeToolCall: params.turnPolicy ? (context, signal) => runWithEmbeddedExecutionSession(conversationId, () => params.turnPolicy.beforeToolCall(context, signal), runId) : void 0
|
|
362
|
+
}, async () => {
|
|
351
363
|
const connectionResume = getConnectionResumeInput(conversationId, runId);
|
|
352
364
|
const clarificationResume = getClarificationResumeInput(conversationId, runId);
|
|
353
365
|
if (connectionResume) await session.sendCustomMessage({
|
|
@@ -392,7 +404,7 @@ async function runXopcEmbeddedTurn(params) {
|
|
|
392
404
|
}, { triggerTurn: true });
|
|
393
405
|
await session.agent.waitForIdle();
|
|
394
406
|
}
|
|
395
|
-
}, timeoutMs);
|
|
407
|
+
}), timeoutMs);
|
|
396
408
|
if (connectionStopped) runner.piSm.appendCustomEntry("connection_required", {
|
|
397
409
|
runId,
|
|
398
410
|
conversationId
|
|
@@ -23,6 +23,7 @@ function buildEmbeddedRunnerFingerprint(input) {
|
|
|
23
23
|
input.workspaceDir,
|
|
24
24
|
input.modelRef,
|
|
25
25
|
tools,
|
|
26
|
+
[...input.toolContracts].sort().join("\0"),
|
|
26
27
|
input.systemPrompt,
|
|
27
28
|
input.thinkingLevel,
|
|
28
29
|
input.credentialRevision
|
|
@@ -92,6 +93,7 @@ var EmbeddedSessionRunnerPool = class {
|
|
|
92
93
|
workspaceDir: params.workspaceDir,
|
|
93
94
|
modelRef: params.modelRef,
|
|
94
95
|
toolNames: params.tools.map((t) => t.name),
|
|
96
|
+
toolContracts: params.tools.map((tool) => JSON.stringify([tool.name, tool.parameters])),
|
|
95
97
|
systemPrompt: params.systemPrompt,
|
|
96
98
|
thinkingLevel: params.thinkingLevel ?? "medium",
|
|
97
99
|
credentialRevision: providerCredentialRevision(params.model.provider)
|
|
@@ -196,6 +198,7 @@ var EmbeddedSessionRunnerPool = class {
|
|
|
196
198
|
workspaceDir,
|
|
197
199
|
modelRef: params.modelRef,
|
|
198
200
|
toolNames,
|
|
201
|
+
toolContracts: tools.map((tool) => JSON.stringify([tool.name, tool.parameters])),
|
|
199
202
|
systemPrompt,
|
|
200
203
|
thinkingLevel: thinkingLevel ?? "medium",
|
|
201
204
|
credentialRevision: providerCredentialRevision(model.provider)
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { init_string_coerce, normalizeLowercaseStringOrEmpty } from "../../utils/string-coerce.js";
|
|
2
|
+
import { isDataBatchResult, renderDataBatch } from "../data-acquisition/render.js";
|
|
2
3
|
import { formatContextLimitTruncationNotice } from "./tool-result-context-guard.js";
|
|
3
4
|
//#region src/agent/embedded/tool-result-truncation.ts
|
|
4
5
|
init_string_coerce();
|
|
@@ -101,6 +102,16 @@ function truncateToolResultMessage(msg, maxChars, options = {}) {
|
|
|
101
102
|
if (!Array.isArray(content)) return msg;
|
|
102
103
|
const totalTextChars = getToolResultTextLength(msg);
|
|
103
104
|
if (totalTextChars <= maxChars) return msg;
|
|
105
|
+
if (msg.toolName === "data_batch" && content.length === 1 && content[0]?.type === "text") try {
|
|
106
|
+
const batch = JSON.parse(content[0].text);
|
|
107
|
+
if (isDataBatchResult(batch)) return {
|
|
108
|
+
...msg,
|
|
109
|
+
content: [{
|
|
110
|
+
type: "text",
|
|
111
|
+
text: renderDataBatch(batch, maxChars).text
|
|
112
|
+
}]
|
|
113
|
+
};
|
|
114
|
+
} catch {}
|
|
104
115
|
const newContent = content.map((block) => {
|
|
105
116
|
if (!block || typeof block !== "object" || block.type !== "text") return block;
|
|
106
117
|
const textBlock = block;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { withDataToolPermissions } from "../tools/dataBatch.js";
|
|
1
2
|
//#region src/agent/embedded/xopc-tools-bridge.ts
|
|
2
3
|
const APPLY_PATCH_BEGIN_MARKER = "*** Begin Patch";
|
|
3
4
|
const APPLY_PATCH_END_MARKER = "*** End Patch";
|
|
@@ -106,7 +107,7 @@ function xopcToolsToDefinitions(tools) {
|
|
|
106
107
|
const envelopeError = validateApplyPatchEnvelope(params);
|
|
107
108
|
if (envelopeError) return invalidApplyPatchEnvelopeResult(envelopeError);
|
|
108
109
|
}
|
|
109
|
-
return tool.execute(toolCallId, params, signal, onUpdate);
|
|
110
|
+
return withDataToolPermissions(new Set(tools.map((item) => item.name)), () => tool.execute(toolCallId, params, signal, onUpdate));
|
|
110
111
|
}
|
|
111
112
|
};
|
|
112
113
|
});
|
|
@@ -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,22 +6,32 @@ 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();
|
|
22
22
|
init_logger();
|
|
23
23
|
const CONNECTION_ARGUMENT = "xopcAccountId";
|
|
24
24
|
const log = createLogger("ComposioToolProvider");
|
|
25
|
+
const BATCH_READ_ACTIONS = new Set([
|
|
26
|
+
"GMAIL_GET_PROFILE",
|
|
27
|
+
"GMAIL_GET_EMAIL",
|
|
28
|
+
"GMAIL_LIST_LABELS",
|
|
29
|
+
"GOOGLEDRIVE_GET_ABOUT",
|
|
30
|
+
"GOOGLEDRIVE_GET_FILE_METADATA",
|
|
31
|
+
"GITHUB_GET_THE_AUTHENTICATED_USER",
|
|
32
|
+
"GITHUB_GET_A_REPOSITORY",
|
|
33
|
+
"GITHUB_GET_REPOSITORY"
|
|
34
|
+
]);
|
|
25
35
|
function textResult(value) {
|
|
26
36
|
return {
|
|
27
37
|
content: [{
|
|
@@ -213,7 +223,8 @@ var ComposioToolProvider = class {
|
|
|
213
223
|
title: action.actionId,
|
|
214
224
|
summary,
|
|
215
225
|
description: `${summary} Available accounts: ${JSON.stringify(accounts)}. Use xopcAccountId to select one; never guess when the user's intent is ambiguous.`,
|
|
216
|
-
inputSchema: actionInputSchema(action)
|
|
226
|
+
inputSchema: actionInputSchema(action),
|
|
227
|
+
batchRead: accounts.length > 0 && action.scope === "read" && action.curated && BATCH_READ_ACTIONS.has(action.actionId)
|
|
217
228
|
};
|
|
218
229
|
}
|
|
219
230
|
async execute(toolRef, args, approvalId, _context) {
|
|
@@ -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,
|
|
@@ -35,7 +35,8 @@ const ToolExecuteSchema = Type.Object({
|
|
|
35
35
|
toolRef: Type.String({ description: "Exact tool reference returned by xopc_tool_search." }),
|
|
36
36
|
revision: Type.String({ description: "Exact contract revision returned by xopc_tool_describe." }),
|
|
37
37
|
arguments: Type.Optional(Type.Record(Type.String(), Type.Unknown())),
|
|
38
|
-
approvalId: Type.Optional(Type.String({ description: "One-time approval id when execution requested confirmation." }))
|
|
38
|
+
approvalId: Type.Optional(Type.String({ description: "One-time approval id when execution requested confirmation." })),
|
|
39
|
+
readOnly: Type.Optional(Type.Boolean({ description: "Require a host-curated batchRead contract; never permits unapproved operations." }))
|
|
39
40
|
});
|
|
40
41
|
function textResult(value, details = {}) {
|
|
41
42
|
return {
|
|
@@ -51,11 +52,17 @@ function createExternalToolGatewayTools(providers, getContext) {
|
|
|
51
52
|
const searchTool = {
|
|
52
53
|
name: EXTERNAL_TOOL_NAMES.search,
|
|
53
54
|
label: "🔎 External Tool Search",
|
|
54
|
-
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.`,
|
|
55
56
|
parameters: ToolSearchSchema,
|
|
56
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)) : [];
|
|
57
60
|
return textResult({
|
|
58
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
|
+
} } : {},
|
|
59
66
|
connectionCandidates: connectionCandidates(params.query),
|
|
60
67
|
selectedConnections: getContext?.()?.conversationId ? connectionBindings(getContext().conversationId) : [],
|
|
61
68
|
waitingObjective: getContext?.()?.conversationId ? getActiveConnectionWait(getContext().conversationId)?.summary : void 0
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { resolveEffectiveAgentConfigForAgent, resolveEffectiveAgentConfigForSession } from "../../config/agent-profile.js";
|
|
2
|
+
import { CliToolProvider } from "./cliProvider.js";
|
|
1
3
|
import { ComposioToolProvider } from "./composio-provider.js";
|
|
2
4
|
import { ExtensionToolProvider } from "./extension-provider.js";
|
|
3
5
|
import { ExternalToolService } from "./service.js";
|
|
@@ -5,9 +7,15 @@ import { EXTERNAL_TOOL_NAMES, createExternalToolGatewayTools } from "./gateway-t
|
|
|
5
7
|
import { McpToolProvider } from "./mcp-provider.js";
|
|
6
8
|
import { MemoryToolProvider } from "./memory-provider.js";
|
|
7
9
|
import { EndpointToolProvider } from "./endpoint-provider.js";
|
|
10
|
+
import { withExternalReadPolicy } from "./read-policy.js";
|
|
8
11
|
//#region src/agent/external-tools/index.ts
|
|
9
12
|
function createDefaultExternalToolGatewayTools(deps) {
|
|
10
13
|
const providers = [
|
|
14
|
+
new CliToolProvider({
|
|
15
|
+
getConfig: deps.getConfig,
|
|
16
|
+
getCurrentContext: deps.getCurrentContext,
|
|
17
|
+
agentId: deps.agentId
|
|
18
|
+
}),
|
|
11
19
|
new McpToolProvider({
|
|
12
20
|
workspace: deps.workspace,
|
|
13
21
|
getConfig: deps.getConfig,
|
|
@@ -41,7 +49,12 @@ function createDefaultExternalToolGatewayTools(deps) {
|
|
|
41
49
|
runtime: deps.endpointTools,
|
|
42
50
|
getCurrentContext: deps.getCurrentContext
|
|
43
51
|
}));
|
|
44
|
-
return createExternalToolGatewayTools(providers,
|
|
52
|
+
return createExternalToolGatewayTools(providers.map((provider) => withExternalReadPolicy(provider, (toolRef) => {
|
|
53
|
+
const config = deps.getConfig();
|
|
54
|
+
if (!config) return void 0;
|
|
55
|
+
const conversationId = deps.getCurrentContext()?.conversationId;
|
|
56
|
+
return (conversationId ? resolveEffectiveAgentConfigForSession(config, conversationId) : deps.agentId ? resolveEffectiveAgentConfigForAgent(config, deps.agentId) : resolveEffectiveAgentConfigForSession(config, void 0)).config.tools[toolRef];
|
|
57
|
+
})), deps.getCurrentContext);
|
|
45
58
|
}
|
|
46
59
|
//#endregion
|
|
47
60
|
export { EXTERNAL_TOOL_NAMES, ExternalToolService, createDefaultExternalToolGatewayTools };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ExternalToolProvider } from './types.js';
|
|
2
|
+
/** Only local configuration and host-curated contracts may authorize delegated reads. */
|
|
3
|
+
export declare function withExternalReadPolicy(provider: ExternalToolProvider, getPolicy: (toolRef: string) => {
|
|
4
|
+
mode: string;
|
|
5
|
+
readOnly?: boolean;
|
|
6
|
+
} | undefined): ExternalToolProvider;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/agent/external-tools/read-policy.ts
|
|
2
|
+
/** Only local configuration and host-curated contracts may authorize delegated reads. */
|
|
3
|
+
function withExternalReadPolicy(provider, getPolicy) {
|
|
4
|
+
return {
|
|
5
|
+
source: provider.source,
|
|
6
|
+
search: (query) => provider.search(query),
|
|
7
|
+
describe: async (ref) => {
|
|
8
|
+
const descriptor = await provider.describe(ref);
|
|
9
|
+
if (!descriptor) return void 0;
|
|
10
|
+
const policy = getPolicy(ref);
|
|
11
|
+
if (policy?.mode === "deny") return void 0;
|
|
12
|
+
return {
|
|
13
|
+
...descriptor,
|
|
14
|
+
batchRead: policy?.readOnly ?? descriptor.batchRead
|
|
15
|
+
};
|
|
16
|
+
},
|
|
17
|
+
execute: (ref, args, approval, context) => provider.execute(ref, args, approval, context)
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { withExternalReadPolicy };
|
|
@@ -24,6 +24,7 @@ export declare class ExternalToolService {
|
|
|
24
24
|
revision: string;
|
|
25
25
|
arguments?: Record<string, unknown>;
|
|
26
26
|
approvalId?: string;
|
|
27
|
+
readOnly?: boolean;
|
|
27
28
|
context: ExternalToolExecutionContext;
|
|
28
29
|
}): Promise<import("@earendil-works/pi-agent-core").AgentToolResult<Record<string, unknown>>>;
|
|
29
30
|
private providerForRef;
|