@xopcai/xopc 0.0.369 → 0.0.370
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -174
- package/README.zh-CN.md +59 -174
- package/dist/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/esm/_md.js +131 -0
- package/dist/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/esm/_u64.js +30 -0
- package/dist/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/esm/sha2.js +252 -0
- package/dist/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/esm/sha256.js +16 -0
- package/dist/.pnpm/@noble_hashes@1.8.0/node_modules/@noble/hashes/esm/utils.js +66 -0
- package/dist/browser-ext/dist/sidepanel.js +21 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/extensions/telegram/xopc.extension.json +1 -1
- package/dist/gateway/static/root/assets/{agent-avatar-dicebear-Stj17S9u.js → agent-avatar-dicebear-C61i1QbX.js} +1 -1
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-0fCR1DHx.js +1 -0
- package/dist/gateway/static/root/assets/agent-plugin-dialog-Di99mUTT.js +1 -0
- package/dist/gateway/static/root/assets/agents-BRZZmYH_.js +66 -0
- package/dist/gateway/static/root/assets/{app-management-settings-panel-pJFe6M6c.js → app-management-settings-panel-noqqxkds.js} +1 -1
- package/dist/gateway/static/root/assets/{appearance-settings-BrxSpBWa.js → appearance-settings-DG8QN0gR.js} +1 -1
- package/dist/gateway/static/root/assets/{apps-page-DegSl5Lh.js → apps-page-CgiyzFYo.js} +1 -1
- package/dist/gateway/static/root/assets/{automations-page-BZQ_VHjp.js → automations-page-CgAcRFDS.js} +1 -1
- package/dist/gateway/static/root/assets/automations-workspace-BIkxIpab.js +6 -0
- package/dist/gateway/static/root/assets/{block-editor-3XjFv3kK.js → block-editor-B1VE-jAe.js} +3 -3
- package/dist/gateway/static/root/assets/browser-automations-page-CIjyMS6f.js +3 -0
- package/dist/gateway/static/root/assets/{browser-settings-page-ch2_bQF0.js → browser-settings-page-BMAivBfp.js} +2 -2
- package/dist/gateway/static/root/assets/{capabilities-DO-vfNKI.js → capabilities-CY4SiHcP.js} +1 -1
- package/dist/gateway/static/root/assets/{capabilities-B48r0DDa.js → capabilities-gjQtMhKu.js} +1 -1
- package/dist/gateway/static/root/assets/capabilities-page-DRdcfo68.js +2 -0
- package/dist/gateway/static/root/assets/{capabilities-settings-panel-NckMsJ5N.js → capabilities-settings-panel-ZuL6pWjM.js} +4 -4
- package/dist/gateway/static/root/assets/{capability-header-actions-CY8KCO9j.js → capability-header-actions-D0GC1FEv.js} +1 -1
- package/dist/gateway/static/root/assets/{channels-CHOS2CGa.js → channels-CgE22Pzd.js} +1 -1
- package/dist/gateway/static/root/assets/{chat-terminal-dock-Bwknnb4c.js → chat-terminal-dock-CEjh1utz.js} +2 -2
- package/dist/gateway/static/root/assets/{computer-settings-page-B2xeFCSt.js → computer-settings-page-vFHJAmQr.js} +1 -1
- package/dist/gateway/static/root/assets/{connector-service-page-C83DnAqK.js → connector-service-page-DTrwZ4kV.js} +1 -1
- package/dist/gateway/static/root/assets/connectors-page-DRcMiTWu.js +1 -0
- package/dist/gateway/static/root/assets/copy-text-row-C1gaJwlZ.js +1 -0
- package/dist/gateway/static/root/assets/{date-picker-Bq9GR-DU.js → date-picker-NfGIPSYY.js} +1 -1
- package/dist/gateway/static/root/assets/dependency-picker-CqguveUi.js +1 -0
- package/dist/gateway/static/root/assets/{desktop-pet-BwsbQw8V.js → desktop-pet-CTx1zkJm.js} +1 -1
- package/dist/gateway/static/root/assets/{desktop-pet-settings-sL9i44pP.js → desktop-pet-settings-BRDS3EGc.js} +1 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-Du4Ciuyw.js +1 -0
- package/dist/gateway/static/root/assets/{directory-picker-path-field-BFlDmsS5.js → directory-picker-path-field-CjstlxFl.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-debug-page-7Z1Tp7-w.js → extension-debug-page-BfAtjhoK.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-page-uGqvb8QX.js → extension-page-BJmudejr.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-provider-xlSyz4Z6.js → extension-provider-Br6LXyIj.js} +1 -1
- package/dist/gateway/static/root/assets/{extension-settings-page-CKHgrjOs.js → extension-settings-page-UvmHniyz.js} +1 -1
- package/dist/gateway/static/root/assets/{fallback-models-BwQg0G1D.js → fallback-models-euw9MGdt.js} +1 -1
- package/dist/gateway/static/root/assets/gateway-realtime-F6D4A7N5.js +1 -0
- package/dist/gateway/static/root/assets/{gateway-settings-BAQnSEMJ.js → gateway-settings-C7roPHh1.js} +1 -1
- package/dist/gateway/static/root/assets/home-page-BGNCTtM3.js +2 -0
- package/dist/gateway/static/root/assets/{imports-page-re1_Nh64.js → imports-page-DxCoT0VV.js} +1 -1
- package/dist/gateway/static/root/assets/index-BGBkIIzM.css +1 -0
- package/dist/gateway/static/root/assets/index-FCEE325-.js +106 -0
- package/dist/gateway/static/root/assets/{keyboard-shortcuts-settings-B_xja9LN.js → keyboard-shortcuts-settings-CnLln9Ds.js} +1 -1
- package/dist/gateway/static/root/assets/{local-app-workbench-page-CErdCrPX.js → local-app-workbench-page-yXRkSrEj.js} +1 -1
- package/dist/gateway/static/root/assets/{local-apps-page-BPL2RXdK.js → local-apps-page-D46buzTk.js} +1 -1
- package/dist/gateway/static/root/assets/local-session-drafts-pox8evDV.js +1 -0
- package/dist/gateway/static/root/assets/logs-page-DmcCHnH0.js +2 -0
- package/dist/gateway/static/root/assets/management-settings-khN1ThNL.js +1 -0
- package/dist/gateway/static/root/assets/note-detail-panel-C_t58yha.js +5 -0
- package/dist/gateway/static/root/assets/notes-page-BJ0QS6xx.js +8 -0
- package/dist/gateway/static/root/assets/{page-context-capture-button-tf77xIz3.js → page-context-capture-button-DfRODHv1.js} +1 -1
- package/dist/gateway/static/root/assets/personal-page-CiiXwwQE.js +1 -0
- package/dist/gateway/static/root/assets/{product-open-page-Dc3Y-Y7J.js → product-open-page-_Bp6HRmm.js} +1 -1
- package/dist/gateway/static/root/assets/{product-preview-content-MG_hmVA3.js → product-preview-content-BUdiO0Ct.js} +1 -1
- package/dist/gateway/static/root/assets/project-detail-page-Clb-fXYk.js +1 -0
- package/dist/gateway/static/root/assets/{projects-page-MllfNLGA.js → projects-page-D9JEEqhh.js} +1 -1
- package/dist/gateway/static/root/assets/{remote-access-hub-Bs-C70el.js → remote-access-hub-CmyTq3_l.js} +1 -1
- package/dist/gateway/static/root/assets/{runtime-tools-settings-panel-DpJ5jNzR.js → runtime-tools-settings-panel-B1_inj8L.js} +1 -1
- package/dist/gateway/static/root/assets/{scenes-page-Dpxamkw6.js → scenes-page-CUNAZN2_.js} +2 -2
- package/dist/gateway/static/root/assets/{schema-form-DUeyQ1zh.js → schema-form-CfT-9UVw.js} +1 -1
- package/dist/gateway/static/root/assets/{send-session-input-Dgn4BRk_.js → send-session-input-BW40VHiL.js} +1 -1
- package/dist/gateway/static/root/assets/session-manager-BqlvrjPE.js +16 -0
- package/dist/gateway/static/root/assets/sessions-page-CXZKScvu.js +1 -0
- package/dist/gateway/static/root/assets/settings-advanced-gate-B2vKXmzg.js +1 -0
- package/dist/gateway/static/root/assets/{settings-page-DouHuBXt.js → settings-page-1h3vyueg.js} +1 -1
- package/dist/gateway/static/root/assets/setup-status-panel-Cqc7UlZy.js +1 -0
- package/dist/gateway/static/root/assets/{share-link-dialog-DJTabLAM.js → share-link-dialog-HCHM8qnf.js} +1 -1
- package/dist/gateway/static/root/assets/{share-preview-page-jw7h4t_B.js → share-preview-page-Ce6FNWt1.js} +1 -1
- package/dist/gateway/static/root/assets/shares-settings-Dh5jisCK.js +1 -0
- package/dist/gateway/static/root/assets/{skill-api-CfyX_0zN.js → skill-api-deDZeQS8.js} +1 -1
- package/dist/gateway/static/root/assets/skills-page-DZozl9U_.js +2 -0
- package/dist/gateway/static/root/assets/{system-settings-panel-DWf256TE.js → system-settings-panel-CtzyMxqq.js} +1 -1
- package/dist/gateway/static/root/assets/{task-detail-page-DE6N1ZQe.js → task-detail-page-5f_V0h-p.js} +2 -2
- package/dist/gateway/static/root/assets/{tunnel-api-BBm9esrY.js → tunnel-api-vMtlbJ-m.js} +1 -1
- package/dist/gateway/static/root/assets/{usage-page-C93x89uW.js → usage-page-B1-BCW8U.js} +1 -1
- package/dist/gateway/static/root/assets/{use-composer-attachments-C7Gaaai1.js → use-composer-attachments-DJya1hIL.js} +1 -1
- package/dist/gateway/static/root/assets/use-file-preview-expanded-C5ONO7sF.js +2 -0
- package/dist/gateway/static/root/assets/user-model-page-D4BSq9HJ.js +2 -0
- package/dist/gateway/static/root/assets/{work-discovery-overlay-Bs2MKiTv.js → work-discovery-overlay-CjiNYJV5.js} +1 -1
- package/dist/gateway/static/root/assets/{workflow-run-setup-panel-BR_U_snV.js → workflow-run-setup-panel-DJOetXvm.js} +2 -2
- package/dist/gateway/static/root/assets/workflows-page-CcAPFh2R.js +6 -0
- package/dist/gateway/static/root/assets/{workspace-api-Si2o3inw.js → workspace-api-WhbMvdBE.js} +2 -2
- package/dist/gateway/static/root/index.html +18 -20
- package/dist/package.js +1 -1
- package/dist/packages/endpoint-tools-client/src/index.js +189 -0
- package/dist/packages/endpoint-tools-protocol/src/bridge.js +105 -0
- package/dist/packages/endpoint-tools-protocol/src/index.js +93 -2
- package/dist/packages/endpoint-tools-protocol/src/location.js +109 -0
- package/dist/packages/gateway-contract/src/session-input-command.js +30 -5
- package/dist/src/agent/agent-manager.js +22 -26
- package/dist/src/agent/embedded/codemode-extension.d.ts +7 -0
- package/dist/src/agent/embedded/codemode-extension.js +232 -0
- package/dist/src/agent/embedded/codemode-output.d.ts +2 -0
- package/dist/src/agent/embedded/codemode-output.js +34 -0
- package/dist/src/agent/embedded/external-tool-discovery.d.ts +6 -0
- package/dist/src/agent/embedded/external-tool-discovery.js +60 -0
- package/dist/src/agent/embedded/model-runtime.js +5 -2
- package/dist/src/agent/embedded/run-for-session.js +10 -1
- package/dist/src/agent/embedded/run-turn.js +10 -3
- package/dist/src/agent/embedded/session-runner.d.ts +9 -1
- package/dist/src/agent/embedded/session-runner.js +111 -23
- package/dist/src/agent/embedded/session-tool-result-guard.d.ts +2 -0
- package/dist/src/agent/embedded/session-tool-result-guard.js +17 -0
- package/dist/src/agent/embedded/subscribe-session.js +14 -4
- package/dist/src/agent/embedded/tool-metadata.d.ts +15 -0
- package/dist/src/agent/embedded/tool-metadata.js +38 -0
- package/dist/src/agent/embedded/tool-search-extension.d.ts +5 -0
- package/dist/src/agent/embedded/tool-search-extension.js +31 -0
- package/dist/src/agent/embedded/types.d.ts +7 -0
- package/dist/src/agent/embedded/xopc-tools-bridge.js +6 -0
- package/dist/src/agent/external-tools/endpoint-provider.d.ts +1 -1
- package/dist/src/agent/external-tools/endpoint-provider.js +148 -56
- package/dist/src/agent/external-tools/extension-provider.js +8 -1
- package/dist/src/agent/external-tools/gateway-tools.d.ts +1 -1
- package/dist/src/agent/external-tools/gateway-tools.js +45 -22
- package/dist/src/agent/external-tools/index.js +46 -14
- package/dist/src/agent/external-tools/memory-provider.js +8 -1
- package/dist/src/agent/external-tools/read-policy.js +2 -1
- package/dist/src/agent/external-tools/service.d.ts +2 -0
- package/dist/src/agent/external-tools/service.js +25 -3
- package/dist/src/agent/external-tools/tool-registry.d.ts +14 -0
- package/dist/src/agent/external-tools/tool-registry.js +14 -0
- package/dist/src/agent/external-tools/types.d.ts +8 -1
- package/dist/src/agent/external-tools/types.js +0 -1
- package/dist/src/agent/mcp/config.d.ts +18 -0
- package/dist/src/agent/mcp/{bundle-mcp-config.js → config.js} +8 -25
- package/dist/src/agent/mcp/native-mcp.d.ts +6 -0
- package/dist/src/agent/mcp/native-mcp.js +73 -0
- package/dist/src/agent/service.js +2 -5
- package/dist/src/agent/skills/installer.js +1 -1
- package/dist/src/agent/skills/skill-manager.js +1 -1
- package/dist/src/agent/skills/skill-sources.js +1 -1
- package/dist/src/agent/source-context/index.d.ts +0 -1
- package/dist/src/agent/source-context/index.js +1 -2
- package/dist/src/agent/source-context/injector.js +1 -0
- package/dist/src/agent/source-context/types.d.ts +2 -2
- package/dist/src/agent/source-context/types.js +1 -1
- package/dist/src/agent/tools/cli-clarify.js +1 -1
- package/dist/src/agent/tools/codemode-permissions.d.ts +4 -0
- package/dist/src/agent/tools/codemode-permissions.js +23 -0
- package/dist/src/agent/tools/dataBatch.js +3 -1
- package/dist/src/agent/tools/delegation-parent-policy.js +1 -4
- package/dist/src/agent/tools/factory.js +4 -3
- package/dist/src/agent/transcript/provider-capabilities.js +0 -1
- package/dist/src/agent/transcript/transcript-policy.js +1 -2
- package/dist/src/agent-config/schema.d.ts +28 -0
- package/dist/src/agent-config/schema.js +7 -0
- package/dist/src/auth/credentials.js +7 -20
- package/dist/src/auth/model-credential-store.js +11 -4
- package/dist/src/auth/oauth/index.d.ts +1 -1
- package/dist/src/auth/oauth/index.js +3 -3
- package/dist/src/auth/oauth/openai.d.ts +2 -0
- package/dist/src/auth/oauth/openai.js +90 -0
- package/dist/src/auth/oauth/registry.js +3 -3
- package/dist/src/auth/oauth/types.d.ts +1 -0
- package/dist/src/auth/oauth/xopc-cloud.js +1 -1
- package/dist/src/auth/sync-provider-auth.js +5 -0
- package/dist/src/chat-commands/builtins/model.js +2 -2
- package/dist/src/cli/command-manifest.js +1 -1
- package/dist/src/cli/commands/doctor/checks/database-schema.js +1 -1
- package/dist/src/cli/commands/extension-agent-plugin.js +0 -19
- package/dist/src/cli/commands/mcp.js +36 -2
- package/dist/src/cli/commands/models.js +1 -1
- package/dist/src/cli/utils/oauth-login.js +2 -2
- package/dist/src/config/index.js +3 -3
- package/dist/src/config/mcp-config-normalize.d.ts +0 -3
- package/dist/src/config/mcp-config-normalize.js +2 -22
- package/dist/src/config/models-json.d.ts +0 -5
- package/dist/src/config/models-json.js +13 -4
- package/dist/src/config/paths.d.ts +0 -1
- package/dist/src/config/paths.js +1 -4
- package/dist/src/config/schema.d.ts +130 -36
- package/dist/src/config/schema.js +52 -35
- package/dist/src/connectors/auth-provider-registry.d.ts +1 -1
- package/dist/src/connectors/auth-provider-registry.js +1 -21
- package/dist/src/connectors/china-catalog.js +5 -5
- package/dist/src/connectors/connection-recovery-service.d.ts +1 -6
- package/dist/src/connectors/connection-recovery-service.js +3 -105
- package/dist/src/connectors/health.d.ts +1 -2
- package/dist/src/connectors/health.js +2 -101
- package/dist/src/connectors/types.d.ts +1 -1
- package/dist/src/endpoint-tools/binding-service.d.ts +2 -0
- package/dist/src/endpoint-tools/binding-service.js +14 -2
- package/dist/src/endpoint-tools/bridge-host.d.ts +15 -0
- package/dist/src/endpoint-tools/bridge-host.js +166 -0
- package/dist/src/endpoint-tools/bridge.d.ts +27 -0
- package/dist/src/endpoint-tools/bridge.js +88 -0
- package/dist/src/endpoint-tools/capability-catalog.d.ts +2 -0
- package/dist/src/endpoint-tools/capability-catalog.js +8 -0
- package/dist/src/endpoint-tools/grant-service.d.ts +69 -0
- package/dist/src/endpoint-tools/grant-service.js +113 -0
- package/dist/src/endpoint-tools/index.js +1 -1
- package/dist/src/endpoint-tools/invocation-service.js +6 -2
- package/dist/src/endpoint-tools/location-task.d.ts +22 -0
- package/dist/src/endpoint-tools/location-task.js +114 -0
- package/dist/src/endpoint-tools/policy.js +16 -1
- package/dist/src/endpoint-tools/registry.d.ts +2 -0
- package/dist/src/endpoint-tools/registry.js +9 -0
- package/dist/src/endpoint-tools/result-projector.d.ts +15 -0
- package/dist/src/endpoint-tools/result-projector.js +31 -0
- package/dist/src/endpoint-tools/runtime.d.ts +2 -0
- package/dist/src/endpoint-tools/runtime.js +15 -2
- package/dist/src/endpoint-tools/target-resolver.d.ts +12 -0
- package/dist/src/endpoint-tools/target-resolver.js +27 -0
- package/dist/src/endpoint-tools/turn-context.d.ts +6 -0
- package/dist/src/endpoint-tools/turn-context.js +29 -0
- package/dist/src/extensions/agent-plugins/auth.d.ts +0 -2
- package/dist/src/extensions/agent-plugins/auth.js +2 -19
- package/dist/src/extensions/agent-plugins/credentials.js +3 -19
- package/dist/src/extensions/agent-plugins/inventory.d.ts +2 -2
- package/dist/src/extensions/agent-plugins/mcp-adapter.js +1 -5
- package/dist/src/extensions/agent-plugins/source-http-fetch.d.ts +2 -0
- package/dist/src/{agent/mcp/plugin-http-fetch.js → extensions/agent-plugins/source-http-fetch.js} +7 -7
- package/dist/src/extensions/agent-plugins/sources.js +2 -2
- package/dist/src/extensions/agent-plugins/store.js +1 -3
- package/dist/src/extensions/agent-plugins/validation.d.ts +0 -4
- package/dist/src/extensions/agent-plugins/validation.js +13 -20
- package/dist/src/gateway/agents-admin.d.ts +5 -0
- package/dist/src/gateway/agents-admin.js +56 -1
- package/dist/src/gateway/chat-stream/mapper.js +9 -0
- package/dist/src/gateway/chat-stream/protocol.d.ts +4 -4
- package/dist/src/gateway/hono/lib/config-payload.d.ts +9 -4
- package/dist/src/gateway/hono/lib/config-payload.js +2 -5
- package/dist/src/gateway/hono/oauth-async.js +9 -2
- package/dist/src/gateway/hono/routes/agent-plugins.js +4 -9
- package/dist/src/gateway/hono/routes/agents.js +4 -3
- package/dist/src/gateway/hono/routes/connection-waits.js +2 -5
- package/dist/src/gateway/hono/routes/connectors.js +5 -60
- package/dist/src/gateway/hono/routes/device-authorizations.d.ts +3 -0
- package/dist/src/gateway/hono/routes/device-authorizations.js +74 -0
- package/dist/src/gateway/hono/routes/endpoint-compatibility.js +7 -0
- package/dist/src/gateway/hono/routes/endpoint-tools.d.ts +1 -0
- package/dist/src/gateway/hono/routes/endpoint-tools.js +53 -3
- package/dist/src/gateway/hono/routes/lazy-bundles.js +17 -1
- package/dist/src/gateway/hono/routes/mcp.d.ts +1 -1
- package/dist/src/gateway/hono/routes/mcp.js +11 -237
- package/dist/src/gateway/hono/routes/session-command-handler.js +11 -1
- package/dist/src/gateway/hono/routes/session-input-handler.d.ts +8 -2
- package/dist/src/gateway/hono/routes/session-input-handler.js +25 -1
- package/dist/src/gateway/service/config-coordinator.js +2 -5
- package/dist/src/gateway/service/marketplace-service.js +2 -2
- package/dist/src/gateway/service/run-gateway-agent.js +13 -5
- package/dist/src/gateway/service/session-input-coordinator.d.ts +1 -1
- package/dist/src/gateway/service/session-input-coordinator.js +29 -9
- package/dist/src/gateway/service/sessions-api.js +0 -6
- package/dist/src/gateway/service.js +3 -12
- package/dist/src/gateway/session-reset-service.js +0 -6
- package/dist/src/imports/compatibility.js +12 -10
- package/dist/src/mcp/channel-bridge.js +1 -1
- package/dist/src/providers/env-keys.js +1 -1
- package/dist/src/providers/index.js +26 -24
- package/dist/src/providers/model-call.d.ts +0 -2
- package/dist/src/providers/model-call.js +2 -6
- package/dist/src/providers/model-registry.js +4 -2
- package/dist/src/providers/model-supplements.d.ts +3 -3
- package/dist/src/providers/model-supplements.js +6 -27
- package/dist/src/providers/presentation.js +3 -8
- package/dist/src/providers/prompt-cache-plan.js +1 -1
- package/dist/src/providers/provider-auth-service.d.ts +1 -1
- package/dist/src/providers/provider-auth-service.js +7 -2
- package/dist/src/providers/provider-policy.d.ts +3 -0
- package/dist/src/providers/provider-policy.js +14 -0
- package/dist/src/providers/register-runtime-providers.js +6 -1
- package/dist/src/realtime/runtime.js +1 -1
- package/dist/src/session/store.js +7 -1
- package/dist/src/session/transcript-events.d.ts +5 -0
- package/dist/src/session/transcript-events.js +1 -0
- package/dist/src/session/types.d.ts +2 -0
- package/dist/src/storage/sqlite/device-grant-audit-repository.d.ts +11 -0
- package/dist/src/storage/sqlite/device-grant-audit-repository.js +10 -0
- package/dist/src/storage/sqlite/endpoint-device-settings-repository.d.ts +7 -0
- package/dist/src/storage/sqlite/endpoint-device-settings-repository.js +17 -0
- package/dist/src/storage/sqlite/migrations/240_device_settings.sql +5 -0
- package/dist/src/storage/sqlite/migrations/241_device_grant_audit.sql +13 -0
- package/dist/src/storage/sqlite/migrations/runner.d.ts +1 -1
- package/dist/src/storage/sqlite/migrations/runner.js +3 -3
- package/dist/src/storage/sqlite/schema.js +1 -1
- package/dist/src/storage/sqlite/session-input-repository.d.ts +1 -0
- package/dist/src/storage/sqlite/session-input-repository.js +5 -1
- package/dist/src/tui/backends/gateway-realtime-backend.js +1 -1
- package/dist/src/tui/xopc-tui-keybindings.d.ts +4 -4
- package/package.json +19 -8
- package/dist/gateway/static/root/assets/agent-defaults-settings-panel-CCRfvuov.js +0 -1
- package/dist/gateway/static/root/assets/agent-plugin-dialog-CRlzd8El.js +0 -1
- package/dist/gateway/static/root/assets/agents-_ug2LCQb.js +0 -66
- package/dist/gateway/static/root/assets/automations-workspace-BQywN6nG.js +0 -6
- package/dist/gateway/static/root/assets/browser-automations-page-yiEuG1v7.js +0 -3
- package/dist/gateway/static/root/assets/capabilities-page-BEnFt_dj.js +0 -2
- package/dist/gateway/static/root/assets/connectors-page-D6wTmWA6.js +0 -2
- package/dist/gateway/static/root/assets/copy-text-row-BHDs3cBa.js +0 -1
- package/dist/gateway/static/root/assets/dependency-picker-BTERkA9X.js +0 -1
- package/dist/gateway/static/root/assets/device-pairing-wizard-DI2bqaKO.js +0 -1
- package/dist/gateway/static/root/assets/dist-Che_jiQF.js +0 -1
- package/dist/gateway/static/root/assets/gateway-realtime-DDWymi-o.js +0 -1
- package/dist/gateway/static/root/assets/home-page-BZDjvwet.js +0 -2
- package/dist/gateway/static/root/assets/index-BB1z8QxA.js +0 -106
- package/dist/gateway/static/root/assets/index-D9R6tU7r.css +0 -1
- package/dist/gateway/static/root/assets/link-2-D_ZKYUW7.js +0 -1
- package/dist/gateway/static/root/assets/local-session-drafts-DRPsDCj1.js +0 -1
- package/dist/gateway/static/root/assets/logs-page-DL-BM0xq.js +0 -2
- package/dist/gateway/static/root/assets/management-settings-BOVRHhXk.js +0 -1
- package/dist/gateway/static/root/assets/note-detail-panel-DJJK2yL4.js +0 -5
- package/dist/gateway/static/root/assets/notes-page-oCxO7ZTv.js +0 -8
- package/dist/gateway/static/root/assets/personal-page-DOk9gUK5.js +0 -1
- package/dist/gateway/static/root/assets/project-detail-page-3uAzbW4T.js +0 -1
- package/dist/gateway/static/root/assets/session-manager-LInoZ_Yi.js +0 -16
- package/dist/gateway/static/root/assets/sessions-page-BCVlNHtq.js +0 -1
- package/dist/gateway/static/root/assets/settings-advanced-gate-Bz-ue9fZ.js +0 -1
- package/dist/gateway/static/root/assets/setup-status-panel-B5BoZ-1y.js +0 -1
- package/dist/gateway/static/root/assets/shares-settings-BlnlzGjH.js +0 -1
- package/dist/gateway/static/root/assets/skills-page-DjdTeYzm.js +0 -2
- package/dist/gateway/static/root/assets/use-file-preview-expanded-Db2VYg1b.js +0 -2
- package/dist/gateway/static/root/assets/user-model-page-B74LkVbp.js +0 -2
- package/dist/gateway/static/root/assets/workflows-page-Crk4SxtC.js +0 -6
- package/dist/src/agent/embedded/system-prompt-override.d.ts +0 -2
- package/dist/src/agent/embedded/system-prompt-override.js +0 -21
- package/dist/src/agent/external-tools/mcp-provider.d.ts +0 -32
- package/dist/src/agent/external-tools/mcp-provider.js +0 -208
- package/dist/src/agent/mcp/bundle-mcp-config.d.ts +0 -20
- package/dist/src/agent/mcp/bundle-mcp-gateway.d.ts +0 -79
- package/dist/src/agent/mcp/bundle-mcp-gateway.js +0 -93
- package/dist/src/agent/mcp/bundle-mcp-names.d.ts +0 -1
- package/dist/src/agent/mcp/bundle-mcp-names.js +0 -25
- package/dist/src/agent/mcp/bundle-mcp-policy.d.ts +0 -1
- package/dist/src/agent/mcp/bundle-mcp-policy.js +0 -6
- package/dist/src/agent/mcp/bundle-mcp-runtime.d.ts +0 -46
- package/dist/src/agent/mcp/bundle-mcp-runtime.js +0 -571
- package/dist/src/agent/mcp/bundle-mcp-tools.d.ts +0 -2
- package/dist/src/agent/mcp/bundle-mcp-tools.js +0 -2
- package/dist/src/agent/mcp/bundle-mcp-types.d.ts +0 -76
- package/dist/src/agent/mcp/bundle-mcp-types.js +0 -1
- package/dist/src/agent/mcp/embedded-mcp.d.ts +0 -10
- package/dist/src/agent/mcp/embedded-mcp.js +0 -14
- package/dist/src/agent/mcp/index.d.ts +0 -5
- package/dist/src/agent/mcp/index.js +0 -12
- package/dist/src/agent/mcp/mcp-config-shared.d.ts +0 -8
- package/dist/src/agent/mcp/mcp-config-shared.js +0 -39
- package/dist/src/agent/mcp/mcp-http.d.ts +0 -23
- package/dist/src/agent/mcp/mcp-http.js +0 -67
- package/dist/src/agent/mcp/mcp-resource-id.d.ts +0 -6
- package/dist/src/agent/mcp/mcp-resource-id.js +0 -19
- package/dist/src/agent/mcp/mcp-stdio-transport.d.ts +0 -26
- package/dist/src/agent/mcp/mcp-stdio-transport.js +0 -120
- package/dist/src/agent/mcp/mcp-stdio.d.ts +0 -18
- package/dist/src/agent/mcp/mcp-stdio.js +0 -35
- package/dist/src/agent/mcp/mcp-transport-config.d.ts +0 -28
- package/dist/src/agent/mcp/mcp-transport-config.js +0 -91
- package/dist/src/agent/mcp/mcp-transport.d.ts +0 -17
- package/dist/src/agent/mcp/mcp-transport.js +0 -141
- package/dist/src/agent/mcp/oauth/index.d.ts +0 -6
- package/dist/src/agent/mcp/oauth/index.js +0 -6
- package/dist/src/agent/mcp/oauth/mcp-oauth-errors.d.ts +0 -5
- package/dist/src/agent/mcp/oauth/mcp-oauth-errors.js +0 -14
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.d.ts +0 -30
- package/dist/src/agent/mcp/oauth/mcp-oauth-manager.js +0 -276
- package/dist/src/agent/mcp/oauth/mcp-oauth-provider.d.ts +0 -33
- package/dist/src/agent/mcp/oauth/mcp-oauth-provider.js +0 -103
- package/dist/src/agent/mcp/oauth/mcp-oauth-session.d.ts +0 -31
- package/dist/src/agent/mcp/oauth/mcp-oauth-session.js +0 -181
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.d.ts +0 -12
- package/dist/src/agent/mcp/oauth/mcp-oauth-store.js +0 -91
- package/dist/src/agent/mcp/oauth/mcp-oauth-types.d.ts +0 -22
- package/dist/src/agent/mcp/oauth/mcp-oauth-types.js +0 -1
- package/dist/src/agent/mcp/plugin-http-fetch.d.ts +0 -2
- package/dist/src/agent/source-context/mcp-resource-context.d.ts +0 -8
- package/dist/src/agent/source-context/mcp-resource-context.js +0 -30
- package/dist/src/auth/oauth/openai-codex.d.ts +0 -9
- package/dist/src/auth/oauth/openai-codex.js +0 -414
- package/dist/src/connectors/plugin-mcp-recovery.d.ts +0 -28
- package/dist/src/connectors/plugin-mcp-recovery.js +0 -90
- package/dist/src/extensions/agent-plugins/connection.d.ts +0 -8
- package/dist/src/extensions/agent-plugins/connection.js +0 -41
- package/dist/src/extensions/agent-plugins/health.d.ts +0 -4
- package/dist/src/extensions/agent-plugins/health.js +0 -48
- package/dist/src/extensions/agent-plugins/plugin-oauth-scope.d.ts +0 -1
- package/dist/src/extensions/agent-plugins/plugin-oauth-scope.js +0 -8
|
@@ -22,7 +22,6 @@ import { resolveConnectionCandidate } from "./connection-candidates.js";
|
|
|
22
22
|
import { cancelPersonalRequest, resolvePersonalRequestConnection } from "../personal-agent/request-service.js";
|
|
23
23
|
import { persistConfigMutation } from "../config/config-mutation.js";
|
|
24
24
|
import { drainPersonalRequestContinuations, drainPersonalRequestResults } from "../personal-agent/request-delivery.js";
|
|
25
|
-
import { HostPluginMcpRecovery } from "./plugin-mcp-recovery.js";
|
|
26
25
|
import { randomUUID } from "node:crypto";
|
|
27
26
|
//#region src/connectors/connection-recovery-service.ts
|
|
28
27
|
init_transaction();
|
|
@@ -95,9 +94,6 @@ var ConnectionRecoveryService = class {
|
|
|
95
94
|
get adapter() {
|
|
96
95
|
return this.deps.adapter ?? new ComposioSessionsAdapter();
|
|
97
96
|
}
|
|
98
|
-
get pluginMcp() {
|
|
99
|
-
return this.deps.pluginMcp ?? new HostPluginMcpRecovery(this.deps.getConfig);
|
|
100
|
-
}
|
|
101
97
|
snapshot(conversationId) {
|
|
102
98
|
if (!connectorPrincipalForSession(conversationId).isLocalOwner) throw new Error("This connection belongs to another principal.");
|
|
103
99
|
const transcriptId = readCurrentTranscriptId(getSqliteDatabase(), conversationId);
|
|
@@ -111,18 +107,6 @@ var ConnectionRecoveryService = class {
|
|
|
111
107
|
}
|
|
112
108
|
view(wait, verifiedIds) {
|
|
113
109
|
const needs = wait.needs.map((need) => {
|
|
114
|
-
if (need.target.type === "plugin-mcp") {
|
|
115
|
-
const availability = this.pluginMcp.availability(need.target);
|
|
116
|
-
const phase = !availability.available || need.connectionId && need.capabilityError ? "blocked" : need.connectionId === need.target.serverId ? "ready" : need.attempt && need.attempt.expiresAt > Date.now() ? "authorizing" : need.unavailable ? "reconnect" : "connect";
|
|
117
|
-
return {
|
|
118
|
-
...need,
|
|
119
|
-
authorizationMode: "desktop",
|
|
120
|
-
phase,
|
|
121
|
-
accounts: [],
|
|
122
|
-
alternatives: [],
|
|
123
|
-
...availability.reason || need.capabilityError ? { reason: availability.reason ?? need.capabilityError } : {}
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
110
|
if (need.target.type === "store-connector") {
|
|
127
111
|
const target = need.target;
|
|
128
112
|
const instance = listConnectorInstances(this.deps.getConfig()).find((item) => item.connectorId === target.connectorId);
|
|
@@ -238,7 +222,7 @@ var ConnectionRecoveryService = class {
|
|
|
238
222
|
}))
|
|
239
223
|
}, verified).needs;
|
|
240
224
|
return Promise.all(wait.needs.map(async (need) => {
|
|
241
|
-
if (need.target.type === "
|
|
225
|
+
if (need.target.type === "store-connector") return need;
|
|
242
226
|
if (views.find((view) => view.key === need.key)?.phase !== "ready") return {
|
|
243
227
|
...need,
|
|
244
228
|
capabilityError: void 0
|
|
@@ -314,38 +298,6 @@ var ConnectionRecoveryService = class {
|
|
|
314
298
|
}
|
|
315
299
|
return fresh;
|
|
316
300
|
}
|
|
317
|
-
async syncPluginMcpNeeds(wait) {
|
|
318
|
-
return Promise.all(wait.needs.map(async (need) => {
|
|
319
|
-
if (need.target.type !== "plugin-mcp") return need;
|
|
320
|
-
const status = await this.pluginMcp.status(need.target);
|
|
321
|
-
if (status.status === "connected") {
|
|
322
|
-
const verified = await this.pluginMcp.verify(need.target);
|
|
323
|
-
return {
|
|
324
|
-
...need,
|
|
325
|
-
connectionId: need.target.serverId,
|
|
326
|
-
unavailable: false,
|
|
327
|
-
attempt: void 0,
|
|
328
|
-
capabilityError: verified.ready ? void 0 : verified.error ?? "The connected MCP tools are unavailable."
|
|
329
|
-
};
|
|
330
|
-
}
|
|
331
|
-
if (status.status === "authorizing") return {
|
|
332
|
-
...need,
|
|
333
|
-
connectionId: void 0,
|
|
334
|
-
unavailable: false,
|
|
335
|
-
attempt: {
|
|
336
|
-
id: status.session?.id ?? need.attempt?.id ?? randomUUID(),
|
|
337
|
-
expiresAt: status.session?.expiresAt ?? Date.now() + ATTEMPT_TTL
|
|
338
|
-
}
|
|
339
|
-
};
|
|
340
|
-
return {
|
|
341
|
-
...need,
|
|
342
|
-
connectionId: void 0,
|
|
343
|
-
unavailable: true,
|
|
344
|
-
attempt: void 0,
|
|
345
|
-
capabilityError: status.status === "error" ? status.session?.error : void 0
|
|
346
|
-
};
|
|
347
|
-
}));
|
|
348
|
-
}
|
|
349
301
|
async preflight(input) {
|
|
350
302
|
if (input.kind !== "connection_resume") return true;
|
|
351
303
|
const wait = input.payload ? getConnectionWait(input.payload.waitId) : void 0;
|
|
@@ -354,11 +306,10 @@ var ConnectionRecoveryService = class {
|
|
|
354
306
|
try {
|
|
355
307
|
const fresh = await this.syncConnections(wait);
|
|
356
308
|
const verified = new Set(fresh.filter((item) => item.status === "active").map((item) => item.id));
|
|
357
|
-
wait.needs =
|
|
358
|
-
wait.needs = wait.needs.map((need) => need.target.type === "plugin-mcp" ? need : {
|
|
309
|
+
wait.needs = wait.needs.map((need) => ({
|
|
359
310
|
...need,
|
|
360
311
|
unavailable: !fresh.some((item) => item.id === need.connectionId && item.status === "active")
|
|
361
|
-
});
|
|
312
|
+
}));
|
|
362
313
|
wait.needs = await this.checkCapabilities(wait, verified);
|
|
363
314
|
const ready = this.view(wait, verified).needs.every((need) => need.phase === "ready");
|
|
364
315
|
if (getConnectionWait(wait.id)?.version !== wait.version) return false;
|
|
@@ -466,48 +417,6 @@ var ConnectionRecoveryService = class {
|
|
|
466
417
|
const need = wait.needs.find((need) => need.key === action.needKey);
|
|
467
418
|
if (!need) throw new Error("Unknown connection requirement.");
|
|
468
419
|
if (this.view(wait).needs.find((item) => item.key === need.key)?.phase === "blocked") throw new Error("Connector policy blocks this connection.");
|
|
469
|
-
if (need.target.type === "plugin-mcp") {
|
|
470
|
-
const serverId = need.target.serverId;
|
|
471
|
-
const attemptId = randomUUID();
|
|
472
|
-
wait = updateConnectionWait({
|
|
473
|
-
...wait,
|
|
474
|
-
intent: {
|
|
475
|
-
objectiveRevision: wait.objectiveRevision,
|
|
476
|
-
validUntil: Date.now() + INTENT_TTL
|
|
477
|
-
},
|
|
478
|
-
needs: wait.needs.map((item) => item.key === need.key ? {
|
|
479
|
-
...item,
|
|
480
|
-
unavailable: false,
|
|
481
|
-
capabilityError: void 0,
|
|
482
|
-
attempt: {
|
|
483
|
-
id: attemptId,
|
|
484
|
-
expiresAt: Date.now() + ATTEMPT_TTL
|
|
485
|
-
}
|
|
486
|
-
} : item)
|
|
487
|
-
}, wait.version);
|
|
488
|
-
publishConnectionWait(conversationId);
|
|
489
|
-
const auth = await this.pluginMcp.start(need.target);
|
|
490
|
-
const latest = getConnectionWait(wait.id);
|
|
491
|
-
if (!latest || latest.version !== wait.version || latest.status !== "open") throw new Error("WAIT_CHANGED");
|
|
492
|
-
wait = updateConnectionWait({
|
|
493
|
-
...wait,
|
|
494
|
-
needs: wait.needs.map((item) => item.key === need.key ? {
|
|
495
|
-
...item,
|
|
496
|
-
attempt: auth.status === "authorizing" ? {
|
|
497
|
-
id: auth.session?.id ?? attemptId,
|
|
498
|
-
expiresAt: auth.session?.expiresAt ?? Date.now() + ATTEMPT_TTL
|
|
499
|
-
} : void 0,
|
|
500
|
-
connectionId: auth.status === "connected" ? serverId : void 0,
|
|
501
|
-
unavailable: auth.status === "error",
|
|
502
|
-
capabilityError: auth.status === "error" ? auth.session?.error : void 0
|
|
503
|
-
} : item)
|
|
504
|
-
}, wait.version);
|
|
505
|
-
publishConnectionWait(conversationId);
|
|
506
|
-
return {
|
|
507
|
-
snapshot: this.snapshot(conversationId),
|
|
508
|
-
authorizationUrl: auth.session?.authorizationUrl
|
|
509
|
-
};
|
|
510
|
-
}
|
|
511
420
|
const id = need.target.connectorId;
|
|
512
421
|
const instance = listConnectorInstances(this.deps.getConfig()).find((item) => item.connectorId === id);
|
|
513
422
|
const definition = (instance ? getInstalledConnectorDefinition(this.deps.getConfig(), instance.instanceId) : void 0) ?? getConnectorDefinition(id);
|
|
@@ -578,18 +487,11 @@ var ConnectionRecoveryService = class {
|
|
|
578
487
|
authorizationUrl: auth.connectUrl
|
|
579
488
|
};
|
|
580
489
|
} else {
|
|
581
|
-
if (action.action === "submit_callback") {
|
|
582
|
-
const need = wait.needs.find((need) => need.key === action.needKey);
|
|
583
|
-
if (!need || need.target.type !== "plugin-mcp") throw new Error("OAuth callback is unavailable.");
|
|
584
|
-
if (!action.callbackUrl || action.callbackUrl.length > 16384) throw new Error("Expected the complete OAuth callback URL.");
|
|
585
|
-
await this.pluginMcp.submitCallback(need.target, action.callbackUrl);
|
|
586
|
-
}
|
|
587
490
|
const fresh = await this.syncConnections(wait);
|
|
588
491
|
const verified = new Set(fresh.filter((item) => item.status === "active").map((item) => item.id));
|
|
589
492
|
const latest = getConnectionWait(wait.id);
|
|
590
493
|
if (!latest || latest.version !== wait.version || latest.status !== "open") throw new Error("WAIT_CHANGED");
|
|
591
494
|
let needs = wait.needs.map((need) => {
|
|
592
|
-
if (need.target.type === "plugin-mcp") return need;
|
|
593
495
|
if (need.target.type === "store-connector") {
|
|
594
496
|
const selected = this.view({
|
|
595
497
|
...wait,
|
|
@@ -617,10 +519,6 @@ var ConnectionRecoveryService = class {
|
|
|
617
519
|
unavailable: !fresh.some((item) => item.connectorId === id && item.status === "active" && (!need.connectionId || item.id === need.connectionId) && (!need.accountId || item.accountId === need.accountId))
|
|
618
520
|
};
|
|
619
521
|
});
|
|
620
|
-
needs = await this.syncPluginMcpNeeds({
|
|
621
|
-
...wait,
|
|
622
|
-
needs
|
|
623
|
-
});
|
|
624
522
|
if (action.action === "select_account") {
|
|
625
523
|
const need = needs.find((item) => item.key === action.needKey);
|
|
626
524
|
if (!need || need.target.type !== "connector") throw new Error("Account selection is unavailable.");
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { Config } from '../config/schema.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type { ConnectorHealthResult } from './types.js';
|
|
3
3
|
export declare function testConnectorInstance(config: Config, serverId: string): Promise<ConnectorHealthResult>;
|
|
4
|
-
export declare function previewConnectorDefinition(config: Config, definition: ConnectorDefinition, input?: ConnectorInstallInput): Promise<ConnectorHealthResult>;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { init_connector_repository, listConnectorConnections } from "../storage/sqlite/connector-repository.js";
|
|
2
2
|
import { currentAccountConnections } from "./account-access.js";
|
|
3
|
-
import { materializeConnectorMcpServer } from "./materialize.js";
|
|
4
3
|
import { getConnectorInstance } from "./instances.js";
|
|
5
4
|
import { describeCliAction, verifyCliConnection } from "./cli/runtime.js";
|
|
6
|
-
import { getWorkspacePath } from "../config/workspace-path-helpers.js";
|
|
7
|
-
import { listBundleMcpServerCapabilitiesForGateway } from "../agent/mcp/bundle-mcp-gateway.js";
|
|
8
5
|
//#region src/connectors/health.ts
|
|
9
6
|
init_connector_repository();
|
|
10
7
|
function classifyConnectorHealthError(error) {
|
|
@@ -17,12 +14,6 @@ function classifyConnectorHealthError(error) {
|
|
|
17
14
|
if (/spawn|command|start|connect/i.test(message)) return "startup_failed";
|
|
18
15
|
return "unknown_error";
|
|
19
16
|
}
|
|
20
|
-
function healthActionForStatus(status) {
|
|
21
|
-
if (status === "missing_secret") return "Reconnect the connector and provide the required secret.";
|
|
22
|
-
if (status === "timeout" || status === "network_failed") return "Check network access and retry the connector health check.";
|
|
23
|
-
if (status === "startup_failed") return "Verify the connector runtime dependency is installed and reachable.";
|
|
24
|
-
if (status === "unauthorized") return "Reconnect the connector or refresh its credentials.";
|
|
25
|
-
}
|
|
26
17
|
async function testConnectorInstance(config, serverId) {
|
|
27
18
|
const instance = getConnectorInstance(config, serverId);
|
|
28
19
|
if (!instance) return {
|
|
@@ -97,97 +88,7 @@ async function testConnectorInstance(config, serverId) {
|
|
|
97
88
|
};
|
|
98
89
|
}
|
|
99
90
|
}
|
|
100
|
-
|
|
101
|
-
try {
|
|
102
|
-
const capabilities = await listBundleMcpServerCapabilitiesForGateway({
|
|
103
|
-
workspaceDir,
|
|
104
|
-
cfg: config,
|
|
105
|
-
serverId
|
|
106
|
-
});
|
|
107
|
-
return {
|
|
108
|
-
serverId,
|
|
109
|
-
ok: true,
|
|
110
|
-
status: "ok",
|
|
111
|
-
toolCount: capabilities.toolCount,
|
|
112
|
-
resourceCount: capabilities.resourceCount,
|
|
113
|
-
promptCount: capabilities.promptCount,
|
|
114
|
-
tools: capabilities.tools,
|
|
115
|
-
resources: capabilities.resources,
|
|
116
|
-
prompts: capabilities.prompts
|
|
117
|
-
};
|
|
118
|
-
} catch (error) {
|
|
119
|
-
const status = classifyConnectorHealthError(error);
|
|
120
|
-
return {
|
|
121
|
-
serverId,
|
|
122
|
-
ok: false,
|
|
123
|
-
status,
|
|
124
|
-
toolCount: 0,
|
|
125
|
-
resourceCount: 0,
|
|
126
|
-
promptCount: 0,
|
|
127
|
-
tools: [],
|
|
128
|
-
resources: [],
|
|
129
|
-
prompts: [],
|
|
130
|
-
error: error instanceof Error ? error.message : String(error),
|
|
131
|
-
action: healthActionForStatus(status)
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
async function previewConnectorDefinition(config, definition, input = {}) {
|
|
136
|
-
if (definition.runtime.type !== "mcp") return {
|
|
137
|
-
serverId: definition.id,
|
|
138
|
-
ok: false,
|
|
139
|
-
status: "unknown_error",
|
|
140
|
-
toolCount: 0,
|
|
141
|
-
resourceCount: 0,
|
|
142
|
-
promptCount: 0,
|
|
143
|
-
tools: [],
|
|
144
|
-
resources: [],
|
|
145
|
-
prompts: [],
|
|
146
|
-
error: `Connector type "${definition.runtime.type}" does not support MCP capability preview.`
|
|
147
|
-
};
|
|
148
|
-
try {
|
|
149
|
-
const { serverId, server } = materializeConnectorMcpServer(definition, input);
|
|
150
|
-
const capabilities = await listBundleMcpServerCapabilitiesForGateway({
|
|
151
|
-
workspaceDir: getWorkspacePath(config) || "./workspace",
|
|
152
|
-
cfg: {
|
|
153
|
-
...config,
|
|
154
|
-
mcp: {
|
|
155
|
-
...config.mcp ?? {},
|
|
156
|
-
servers: {
|
|
157
|
-
...config.mcp?.servers ?? {},
|
|
158
|
-
[serverId]: server
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
serverId
|
|
163
|
-
});
|
|
164
|
-
return {
|
|
165
|
-
serverId,
|
|
166
|
-
ok: true,
|
|
167
|
-
status: "ok",
|
|
168
|
-
toolCount: capabilities.toolCount,
|
|
169
|
-
resourceCount: capabilities.resourceCount,
|
|
170
|
-
promptCount: capabilities.promptCount,
|
|
171
|
-
tools: capabilities.tools,
|
|
172
|
-
resources: capabilities.resources,
|
|
173
|
-
prompts: capabilities.prompts
|
|
174
|
-
};
|
|
175
|
-
} catch (error) {
|
|
176
|
-
const status = classifyConnectorHealthError(error);
|
|
177
|
-
return {
|
|
178
|
-
serverId: definition.id,
|
|
179
|
-
ok: false,
|
|
180
|
-
status,
|
|
181
|
-
toolCount: 0,
|
|
182
|
-
resourceCount: 0,
|
|
183
|
-
promptCount: 0,
|
|
184
|
-
tools: [],
|
|
185
|
-
resources: [],
|
|
186
|
-
prompts: [],
|
|
187
|
-
error: error instanceof Error ? error.message : String(error),
|
|
188
|
-
action: healthActionForStatus(status)
|
|
189
|
-
};
|
|
190
|
-
}
|
|
91
|
+
throw new Error("MCP diagnostics are provided by xopc mcp list.");
|
|
191
92
|
}
|
|
192
93
|
//#endregion
|
|
193
|
-
export {
|
|
94
|
+
export { testConnectorInstance };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type ConnectorKind = 'mcp' | 'cli' | 'http' | 'browser' | 'extension' | 'builtin' | 'composio' | 'memorySource';
|
|
2
2
|
export type ConnectorCategory = 'code' | 'docs' | 'browser' | 'data' | 'automation' | 'custom';
|
|
3
|
-
export type ConnectorCapability = 'tools' | 'resources' | 'prompts' | 'context' | 'channel' | 'events' | 'ui' | 'memory_source' | 'workflows' | 'auth.apiKey' | 'auth.oauth' | 'runtime.mcp.stdio' | 'runtime.mcp.
|
|
3
|
+
export type ConnectorCapability = 'tools' | 'resources' | 'prompts' | 'context' | 'channel' | 'events' | 'ui' | 'memory_source' | 'workflows' | 'auth.apiKey' | 'auth.oauth' | 'runtime.mcp.stdio' | 'runtime.mcp.streamableHttp';
|
|
4
4
|
export type ConnectorAuthMode = 'none' | 'apiKey' | 'oauth' | 'cli';
|
|
5
5
|
export type ConnectorAuthDefinition = {
|
|
6
6
|
mode: 'cli';
|
|
@@ -13,6 +13,8 @@ export interface EndpointSessionBindingStore {
|
|
|
13
13
|
export declare class EndpointBindingService {
|
|
14
14
|
private readonly registry;
|
|
15
15
|
private readonly store;
|
|
16
|
+
private readonly changeListeners;
|
|
17
|
+
onChange(listener: (conversationId: string) => void): () => void;
|
|
16
18
|
constructor(registry: EndpointRegistry, store?: EndpointSessionBindingStore);
|
|
17
19
|
bind(conversationId: string, endpointId: string, now?: number): EndpointSessionBinding;
|
|
18
20
|
get(conversationId: string): EndpointSessionBinding | undefined;
|
|
@@ -11,6 +11,13 @@ function memoryStore() {
|
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
13
|
var EndpointBindingService = class {
|
|
14
|
+
changeListeners = /* @__PURE__ */ new Set();
|
|
15
|
+
onChange(listener) {
|
|
16
|
+
this.changeListeners.add(listener);
|
|
17
|
+
return () => {
|
|
18
|
+
this.changeListeners.delete(listener);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
14
21
|
constructor(registry, store = memoryStore()) {
|
|
15
22
|
this.registry = registry;
|
|
16
23
|
this.store = store;
|
|
@@ -23,7 +30,9 @@ var EndpointBindingService = class {
|
|
|
23
30
|
endpointId,
|
|
24
31
|
boundAt: now
|
|
25
32
|
};
|
|
26
|
-
|
|
33
|
+
const stored = this.store.set(binding);
|
|
34
|
+
for (const listener of this.changeListeners) listener(normalizedConversationId);
|
|
35
|
+
return stored;
|
|
27
36
|
}
|
|
28
37
|
get(conversationId) {
|
|
29
38
|
return this.store.get(this.normalizeConversationId(conversationId));
|
|
@@ -33,7 +42,10 @@ var EndpointBindingService = class {
|
|
|
33
42
|
return binding ? this.registry.get(binding.endpointId) : void 0;
|
|
34
43
|
}
|
|
35
44
|
unbind(conversationId) {
|
|
36
|
-
|
|
45
|
+
const normalized = this.normalizeConversationId(conversationId);
|
|
46
|
+
const removed = this.store.delete(normalized);
|
|
47
|
+
if (removed) for (const listener of this.changeListeners) listener(normalized);
|
|
48
|
+
return removed;
|
|
37
49
|
}
|
|
38
50
|
normalizeConversationId(conversationId) {
|
|
39
51
|
const normalized = conversationId.trim();
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type EndpointToolRegistry } from '@xopcai/endpoint-tools-client';
|
|
2
|
+
export interface DeviceBridgeHostOptions {
|
|
3
|
+
gatewayUrl: string;
|
|
4
|
+
token: string;
|
|
5
|
+
identityPath: string;
|
|
6
|
+
registry: EndpointToolRegistry;
|
|
7
|
+
displayName?: string;
|
|
8
|
+
onStateChange?: (state: string) => void;
|
|
9
|
+
}
|
|
10
|
+
/** Connects a Node hardware adapter through the existing signed Endpoint v2 transport. */
|
|
11
|
+
export declare function connectDeviceBridge(options: DeviceBridgeHostOptions): Promise<{
|
|
12
|
+
endpointId: string;
|
|
13
|
+
principalId: string;
|
|
14
|
+
close: () => void;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { endpointHelloSigningPayload, init_src } from "../../packages/endpoint-tools-protocol/src/index.js";
|
|
2
|
+
import { EndpointToolHostController } from "../../packages/endpoint-tools-client/src/index.js";
|
|
3
|
+
import { RealtimeClient } from "../../packages/realtime-client/src/index.js";
|
|
4
|
+
import { dirname } from "node:path";
|
|
5
|
+
import { generateKeyPairSync, randomUUID, sign } from "node:crypto";
|
|
6
|
+
import { mkdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
7
|
+
import WebSocket from "ws";
|
|
8
|
+
//#region src/endpoint-tools/bridge-host.ts
|
|
9
|
+
init_src();
|
|
10
|
+
async function loadIdentity(path) {
|
|
11
|
+
try {
|
|
12
|
+
const info = await stat(path);
|
|
13
|
+
if (!info.isFile() || process.platform !== "win32" && (info.mode & 63) !== 0) throw new Error("Bridge identity must be a private file (mode 0600)");
|
|
14
|
+
const identity = JSON.parse(await readFile(path, "utf8"));
|
|
15
|
+
if (!identity.principalId || !identity.publicKey || !identity.privateKey) throw new Error("Invalid Bridge identity file");
|
|
16
|
+
return identity;
|
|
17
|
+
} catch (error) {
|
|
18
|
+
if (error.code !== "ENOENT") throw error;
|
|
19
|
+
const pair = generateKeyPairSync("ec", { namedCurve: "prime256v1" });
|
|
20
|
+
const identity = {
|
|
21
|
+
principalId: randomUUID(),
|
|
22
|
+
publicKey: pair.publicKey.export({
|
|
23
|
+
type: "spki",
|
|
24
|
+
format: "der"
|
|
25
|
+
}).toString("base64url"),
|
|
26
|
+
privateKey: pair.privateKey.export({
|
|
27
|
+
type: "pkcs8",
|
|
28
|
+
format: "pem"
|
|
29
|
+
}).toString()
|
|
30
|
+
};
|
|
31
|
+
await mkdir(dirname(path), {
|
|
32
|
+
recursive: true,
|
|
33
|
+
mode: 448
|
|
34
|
+
});
|
|
35
|
+
await writeFile(path, JSON.stringify(identity), {
|
|
36
|
+
mode: 384,
|
|
37
|
+
flag: "wx"
|
|
38
|
+
});
|
|
39
|
+
return identity;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** Connects a Node hardware adapter through the existing signed Endpoint v2 transport. */
|
|
43
|
+
async function connectDeviceBridge(options) {
|
|
44
|
+
const url = new URL(options.gatewayUrl);
|
|
45
|
+
if (url.username || url.password || url.search || url.hash || url.pathname !== "/") throw new Error("Use a Gateway origin URL without credentials or path");
|
|
46
|
+
if (url.protocol !== "https:" && !(url.protocol === "http:" && [
|
|
47
|
+
"localhost",
|
|
48
|
+
"127.0.0.1",
|
|
49
|
+
"[::1]"
|
|
50
|
+
].includes(url.hostname))) throw new Error("Remote Bridge connections require HTTPS");
|
|
51
|
+
const lifetime = new AbortController();
|
|
52
|
+
const request = async (path, body, signal) => {
|
|
53
|
+
const response = await fetch(new URL(path, url), {
|
|
54
|
+
method: body === void 0 ? "GET" : "POST",
|
|
55
|
+
headers: {
|
|
56
|
+
Authorization: `Bearer ${options.token}`,
|
|
57
|
+
"Content-Type": "application/json"
|
|
58
|
+
},
|
|
59
|
+
...body === void 0 ? {} : { body: JSON.stringify(body) },
|
|
60
|
+
redirect: "error",
|
|
61
|
+
signal: AbortSignal.any([lifetime.signal, signal ?? AbortSignal.timeout(1e4)])
|
|
62
|
+
});
|
|
63
|
+
if (!response.ok) throw new Error(`Bridge Gateway request failed: HTTP ${response.status}`);
|
|
64
|
+
const result = await response.json();
|
|
65
|
+
if (!result.ok) throw new Error("Bridge Gateway request was rejected");
|
|
66
|
+
return result.payload;
|
|
67
|
+
};
|
|
68
|
+
if ((await request("/api/endpoint-tools/compatibility")).hardwareBridgeV1 !== true) throw new Error("Gateway does not support hardwareBridgeV1");
|
|
69
|
+
const identity = await loadIdentity(options.identityPath);
|
|
70
|
+
const endpointId = `${identity.principalId}:bridge`;
|
|
71
|
+
const displayName = options.displayName ?? "xopc Device Bridge";
|
|
72
|
+
if (!displayName.trim() || displayName.length > 80) throw new Error("Bridge name must contain 1–80 characters");
|
|
73
|
+
const register = () => request("/api/endpoint-tools/principals", {
|
|
74
|
+
principalId: identity.principalId,
|
|
75
|
+
publicKey: identity.publicKey,
|
|
76
|
+
kind: "desktop",
|
|
77
|
+
platform: process.platform,
|
|
78
|
+
displayName
|
|
79
|
+
});
|
|
80
|
+
await register();
|
|
81
|
+
const controller = new EndpointToolHostController({
|
|
82
|
+
registry: options.registry,
|
|
83
|
+
getAvailability: () => "background",
|
|
84
|
+
createMessageId: randomUUID,
|
|
85
|
+
confirm: async () => false,
|
|
86
|
+
uploadFile: async () => {
|
|
87
|
+
throw new Error("Bridge sensors cannot upload files");
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
const clientId = randomUUID();
|
|
91
|
+
const websocketUrl = new URL("/api/realtime/v1/ws", url);
|
|
92
|
+
websocketUrl.protocol = url.protocol === "https:" ? "wss:" : "ws:";
|
|
93
|
+
const client = new RealtimeClient({
|
|
94
|
+
clientId,
|
|
95
|
+
clientKind: "desktop",
|
|
96
|
+
createMessageId: randomUUID,
|
|
97
|
+
getWebSocketUrl: () => websocketUrl.href,
|
|
98
|
+
issueTicket: (signal) => request("/api/realtime/tickets", {
|
|
99
|
+
clientId,
|
|
100
|
+
clientKind: "desktop",
|
|
101
|
+
protocolVersion: 2
|
|
102
|
+
}, signal),
|
|
103
|
+
createWebSocket: (address) => new WebSocket(address),
|
|
104
|
+
onStateChange: (state) => options.onStateChange?.(state)
|
|
105
|
+
});
|
|
106
|
+
const close = () => {
|
|
107
|
+
lifetime.abort();
|
|
108
|
+
client.disconnect();
|
|
109
|
+
controller.disconnect();
|
|
110
|
+
};
|
|
111
|
+
let resolveReady;
|
|
112
|
+
const ready = new Promise((resolve) => {
|
|
113
|
+
resolveReady = resolve;
|
|
114
|
+
});
|
|
115
|
+
client.setEndpoint({
|
|
116
|
+
createHello: async () => {
|
|
117
|
+
await register();
|
|
118
|
+
const hello = {
|
|
119
|
+
principalId: identity.principalId,
|
|
120
|
+
endpointId,
|
|
121
|
+
connectionInstanceId: randomUUID(),
|
|
122
|
+
displayName,
|
|
123
|
+
kind: "desktop",
|
|
124
|
+
platform: process.platform,
|
|
125
|
+
appVersion: "1",
|
|
126
|
+
availability: "background",
|
|
127
|
+
nonce: randomUUID(),
|
|
128
|
+
signedAt: Date.now(),
|
|
129
|
+
signature: "pending",
|
|
130
|
+
tools: options.registry.descriptors()
|
|
131
|
+
};
|
|
132
|
+
hello.signature = sign("sha256", Buffer.from(endpointHelloSigningPayload(hello)), {
|
|
133
|
+
key: identity.privateKey,
|
|
134
|
+
dsaEncoding: "ieee-p1363"
|
|
135
|
+
}).toString("base64url");
|
|
136
|
+
return hello;
|
|
137
|
+
},
|
|
138
|
+
onReady: () => {
|
|
139
|
+
controller.connect((message) => client.sendEndpointMessage(message));
|
|
140
|
+
resolveReady();
|
|
141
|
+
},
|
|
142
|
+
onMessage: (message) => {
|
|
143
|
+
controller.handleMessage(message);
|
|
144
|
+
},
|
|
145
|
+
onDisconnected: () => controller.disconnect()
|
|
146
|
+
});
|
|
147
|
+
client.connect();
|
|
148
|
+
let timeout;
|
|
149
|
+
try {
|
|
150
|
+
await Promise.race([ready, new Promise((_resolve, reject) => {
|
|
151
|
+
timeout = setTimeout(() => reject(/* @__PURE__ */ new Error("Bridge endpoint did not become ready")), 15e3);
|
|
152
|
+
})]);
|
|
153
|
+
} catch (error) {
|
|
154
|
+
close();
|
|
155
|
+
throw error;
|
|
156
|
+
} finally {
|
|
157
|
+
clearTimeout(timeout);
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
endpointId,
|
|
161
|
+
principalId: identity.principalId,
|
|
162
|
+
close
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
166
|
+
export { connectDeviceBridge };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { EndpointToolRegistry } from '@xopcai/endpoint-tools-client';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
declare const resourceSchema: z.ZodObject<{
|
|
4
|
+
resourceId: z.ZodString;
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
measurement: z.ZodEnum<{
|
|
7
|
+
temperature: "temperature";
|
|
8
|
+
humidity: "humidity";
|
|
9
|
+
}>;
|
|
10
|
+
unit: z.ZodEnum<{
|
|
11
|
+
celsius: "celsius";
|
|
12
|
+
percent: "percent";
|
|
13
|
+
}>;
|
|
14
|
+
simulated: z.ZodBoolean;
|
|
15
|
+
}, z.core.$strict>;
|
|
16
|
+
export type BridgeResource = z.infer<typeof resourceSchema>;
|
|
17
|
+
export interface BridgeSensorAdapter {
|
|
18
|
+
resource: BridgeResource;
|
|
19
|
+
read(signal: AbortSignal): Promise<{
|
|
20
|
+
value: number | null;
|
|
21
|
+
capturedAt: number;
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
24
|
+
/** Drivers return one sample; transport, identity, cancellation and policy remain host-owned. */
|
|
25
|
+
export declare function createDeviceBridge(adapters: readonly BridgeSensorAdapter[], now?: () => number): EndpointToolRegistry;
|
|
26
|
+
export declare function simulatedEnvironmentSensors(now?: () => number): BridgeSensorAdapter[];
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { bridgeDescriptor } from "../../packages/endpoint-tools-protocol/src/bridge.js";
|
|
2
|
+
import { init_src } from "../../packages/endpoint-tools-protocol/src/index.js";
|
|
3
|
+
import { EndpointToolRegistry } from "../../packages/endpoint-tools-client/src/index.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
//#region src/endpoint-tools/bridge.ts
|
|
6
|
+
init_src();
|
|
7
|
+
const resourceSchema = z.object({
|
|
8
|
+
resourceId: z.string().regex(/^[a-zA-Z0-9._:-]{1,128}$/),
|
|
9
|
+
name: z.string().min(1).max(80),
|
|
10
|
+
measurement: z.enum(["temperature", "humidity"]),
|
|
11
|
+
unit: z.enum(["celsius", "percent"]),
|
|
12
|
+
simulated: z.boolean()
|
|
13
|
+
}).strict().refine((item) => item.unit === (item.measurement === "temperature" ? "celsius" : "percent"), "Unit does not match measurement");
|
|
14
|
+
/** Drivers return one sample; transport, identity, cancellation and policy remain host-owned. */
|
|
15
|
+
function createDeviceBridge(adapters, now = Date.now) {
|
|
16
|
+
if (adapters.length > 100) throw new Error("Bridge supports at most 100 resources");
|
|
17
|
+
const resources = /* @__PURE__ */ new Map();
|
|
18
|
+
for (const adapter of adapters) {
|
|
19
|
+
const resource = resourceSchema.parse(adapter.resource);
|
|
20
|
+
if (resources.has(resource.resourceId)) throw new Error("Duplicate Bridge resource ID");
|
|
21
|
+
resources.set(resource.resourceId, {
|
|
22
|
+
resource,
|
|
23
|
+
read: adapter.read.bind(adapter)
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return new EndpointToolRegistry([{
|
|
27
|
+
descriptor: bridgeDescriptor("list_resources"),
|
|
28
|
+
execute: async (args) => {
|
|
29
|
+
z.object({}).strict().parse(args);
|
|
30
|
+
return { content: [{
|
|
31
|
+
type: "json",
|
|
32
|
+
value: [...resources.values()].map((item) => ({ ...item.resource }))
|
|
33
|
+
}] };
|
|
34
|
+
}
|
|
35
|
+
}, {
|
|
36
|
+
descriptor: bridgeDescriptor("read_sensor"),
|
|
37
|
+
execute: async (args, context) => {
|
|
38
|
+
const { resourceId } = z.object({ resourceId: z.string() }).strict().parse(args);
|
|
39
|
+
const adapter = resources.get(resourceId);
|
|
40
|
+
if (!adapter) throw new TypeError("Unknown Bridge resource");
|
|
41
|
+
context.signal.throwIfAborted();
|
|
42
|
+
const sample = await adapter.read(context.signal);
|
|
43
|
+
context.signal.throwIfAborted();
|
|
44
|
+
const time = now();
|
|
45
|
+
if (!Number.isSafeInteger(sample.capturedAt) || sample.capturedAt > time + 6e4 || sample.capturedAt < time - 3e4) throw new TypeError("Bridge sample has an invalid or stale timestamp");
|
|
46
|
+
const { value } = sample;
|
|
47
|
+
const range = adapter.resource.measurement === "humidity" ? [0, 100] : [-100, 200];
|
|
48
|
+
if (value !== null && (!Number.isFinite(value) || value < range[0] || value > range[1])) throw new TypeError("Invalid Bridge sample value");
|
|
49
|
+
return { content: [{
|
|
50
|
+
type: "json",
|
|
51
|
+
value: {
|
|
52
|
+
...adapter.resource,
|
|
53
|
+
value,
|
|
54
|
+
capturedAt: sample.capturedAt
|
|
55
|
+
}
|
|
56
|
+
}] };
|
|
57
|
+
}
|
|
58
|
+
}]);
|
|
59
|
+
}
|
|
60
|
+
function simulatedEnvironmentSensors(now = Date.now) {
|
|
61
|
+
return [{
|
|
62
|
+
resource: {
|
|
63
|
+
resourceId: "sim.room.temperature",
|
|
64
|
+
name: "Simulated room temperature",
|
|
65
|
+
measurement: "temperature",
|
|
66
|
+
unit: "celsius",
|
|
67
|
+
simulated: true
|
|
68
|
+
},
|
|
69
|
+
read: async () => ({
|
|
70
|
+
value: 23.5,
|
|
71
|
+
capturedAt: now()
|
|
72
|
+
})
|
|
73
|
+
}, {
|
|
74
|
+
resource: {
|
|
75
|
+
resourceId: "sim.room.humidity",
|
|
76
|
+
name: "Simulated room humidity",
|
|
77
|
+
measurement: "humidity",
|
|
78
|
+
unit: "percent",
|
|
79
|
+
simulated: true
|
|
80
|
+
},
|
|
81
|
+
read: async () => ({
|
|
82
|
+
value: 45,
|
|
83
|
+
capturedAt: now()
|
|
84
|
+
})
|
|
85
|
+
}];
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
export { createDeviceBridge, simulatedEnvironmentSensors };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region src/endpoint-tools/capability-catalog.ts
|
|
2
|
+
/** Server-owned targeting rules; device descriptors cannot change these defaults. */
|
|
3
|
+
function deviceCapabilityTarget(toolName) {
|
|
4
|
+
if (/^(mobile|desktop|web|browser)\.device\./.test(toolName) || toolName === "web.page.get_selection") return "turn_origin";
|
|
5
|
+
return "session_bound";
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { deviceCapabilityTarget };
|