managed-deepagents 0.5.0-dev.79 → 0.5.0-dev.81
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 +56 -13
- package/dist/channels/assistant-text.js +1 -1
- package/dist/channels/assistant-text.js.map +1 -1
- package/dist/channels/binding.d.ts.map +1 -1
- package/dist/channels/binding.js +3 -1
- package/dist/channels/binding.js.map +1 -1
- package/dist/channels/index.d.ts +6 -8
- package/dist/channels/index.d.ts.map +1 -1
- package/dist/channels/index.js +5 -5
- package/dist/channels/index.js.map +1 -1
- package/dist/channels/manifest.d.ts +36 -3
- package/dist/channels/manifest.d.ts.map +1 -1
- package/dist/channels/messaging-registry.d.ts +17 -0
- package/dist/channels/messaging-registry.d.ts.map +1 -0
- package/dist/channels/messaging-registry.js +44 -0
- package/dist/channels/messaging-registry.js.map +1 -0
- package/dist/channels/registry.d.ts +4 -3
- package/dist/channels/registry.d.ts.map +1 -1
- package/dist/channels/registry.js +6 -5
- package/dist/channels/registry.js.map +1 -1
- package/dist/channels/schedule-delivery.d.ts +4 -1
- package/dist/channels/schedule-delivery.d.ts.map +1 -1
- package/dist/channels/schedule-delivery.js +4 -2
- package/dist/channels/schedule-delivery.js.map +1 -1
- package/dist/connectors/github/adapter-core.d.ts +15 -0
- package/dist/connectors/github/adapter-core.d.ts.map +1 -0
- package/dist/connectors/github/adapter-core.js +52 -0
- package/dist/connectors/github/adapter-core.js.map +1 -0
- package/dist/{channels → connectors}/github/define.d.ts +28 -58
- package/dist/connectors/github/define.d.ts.map +1 -0
- package/dist/connectors/github/define.js +72 -0
- package/dist/connectors/github/define.js.map +1 -0
- package/dist/{channels → connectors}/github/http.d.ts +4 -4
- package/dist/connectors/github/http.d.ts.map +1 -0
- package/dist/{channels → connectors}/github/http.js +24 -25
- package/dist/connectors/github/http.js.map +1 -0
- package/dist/connectors/github/index.d.ts +59 -16
- package/dist/connectors/github/index.d.ts.map +1 -1
- package/dist/connectors/github/index.js +159 -73
- package/dist/connectors/github/index.js.map +1 -1
- package/dist/connectors/github/match.d.ts +20 -0
- package/dist/connectors/github/match.d.ts.map +1 -0
- package/dist/connectors/github/match.js +41 -0
- package/dist/connectors/github/match.js.map +1 -0
- package/dist/{channels → connectors}/github/normalize.d.ts +1 -1
- package/dist/connectors/github/normalize.d.ts.map +1 -0
- package/dist/{channels → connectors}/github/normalize.js +2 -2
- package/dist/connectors/github/normalize.js.map +1 -0
- package/dist/connectors/github/sandbox.d.ts.map +1 -1
- package/dist/connectors/github/sandbox.js +30 -23
- package/dist/connectors/github/sandbox.js.map +1 -1
- package/dist/connectors/github/source-thread.d.ts.map +1 -0
- package/dist/connectors/github/source-thread.js.map +1 -0
- package/dist/{channels → connectors}/github/transport.d.ts +7 -1
- package/dist/connectors/github/transport.d.ts.map +1 -0
- package/dist/{channels → connectors}/github/transport.js +18 -4
- package/dist/connectors/github/transport.js.map +1 -0
- package/dist/connectors/langsmith/index.d.ts +29 -17
- package/dist/connectors/langsmith/index.d.ts.map +1 -1
- package/dist/connectors/langsmith/index.js +34 -29
- package/dist/connectors/langsmith/index.js.map +1 -1
- package/dist/connectors/langsmith/routes.d.ts +4 -15
- package/dist/connectors/langsmith/routes.d.ts.map +1 -1
- package/dist/connectors/langsmith/routes.js +63 -72
- package/dist/connectors/langsmith/routes.js.map +1 -1
- package/dist/connectors/marketplace/catalog.d.ts +96 -0
- package/dist/connectors/marketplace/catalog.d.ts.map +1 -0
- package/dist/connectors/marketplace/catalog.js +213 -0
- package/dist/connectors/marketplace/catalog.js.map +1 -0
- package/dist/connectors/marketplace/fleet-mcp.d.ts +62 -0
- package/dist/connectors/marketplace/fleet-mcp.d.ts.map +1 -0
- package/dist/connectors/marketplace/fleet-mcp.js +215 -0
- package/dist/connectors/marketplace/fleet-mcp.js.map +1 -0
- package/dist/connectors/marketplace/index.d.ts +31 -0
- package/dist/connectors/marketplace/index.d.ts.map +1 -0
- package/dist/connectors/marketplace/index.js +39 -0
- package/dist/connectors/marketplace/index.js.map +1 -0
- package/dist/connectors/marketplace/load.d.ts +15 -0
- package/dist/connectors/marketplace/load.d.ts.map +1 -0
- package/dist/connectors/marketplace/load.js +265 -0
- package/dist/connectors/marketplace/load.js.map +1 -0
- package/dist/connectors/mcp/index.d.ts +13 -20
- package/dist/connectors/mcp/index.d.ts.map +1 -1
- package/dist/connectors/mcp/index.js +92 -112
- package/dist/connectors/mcp/index.js.map +1 -1
- package/dist/connectors/mcp/load.d.ts.map +1 -1
- package/dist/connectors/mcp/load.js +16 -40
- package/dist/connectors/mcp/load.js.map +1 -1
- package/dist/{channels → connectors}/slack/adapter-core.d.ts +1 -1
- package/dist/connectors/slack/adapter-core.d.ts.map +1 -0
- package/dist/connectors/slack/adapter-core.js.map +1 -0
- package/dist/{channels → connectors}/slack/adapter.d.ts +3 -4
- package/dist/connectors/slack/adapter.d.ts.map +1 -0
- package/dist/{channels → connectors}/slack/adapter.js +1 -1
- package/dist/connectors/slack/adapter.js.map +1 -0
- package/dist/{channels → connectors}/slack/http.d.ts +6 -40
- package/dist/connectors/slack/http.d.ts.map +1 -0
- package/dist/{channels → connectors}/slack/http.js +38 -127
- package/dist/connectors/slack/http.js.map +1 -0
- package/dist/connectors/slack/index.d.ts +108 -0
- package/dist/connectors/slack/index.d.ts.map +1 -0
- package/dist/connectors/slack/index.js +191 -0
- package/dist/connectors/slack/index.js.map +1 -0
- package/dist/{channels → connectors}/slack/normalize.d.ts +5 -5
- package/dist/connectors/slack/normalize.d.ts.map +1 -0
- package/dist/{channels → connectors}/slack/normalize.js +21 -20
- package/dist/connectors/slack/normalize.js.map +1 -0
- package/dist/connectors/slack/source-thread.d.ts.map +1 -0
- package/dist/connectors/slack/source-thread.js.map +1 -0
- package/dist/{channels → connectors}/slack/transport.d.ts +1 -1
- package/dist/connectors/slack/transport.d.ts.map +1 -0
- package/dist/{channels → connectors}/slack/transport.js +4 -3
- package/dist/connectors/slack/transport.js.map +1 -0
- package/dist/connectors/tool-selection.d.ts +55 -0
- package/dist/connectors/tool-selection.d.ts.map +1 -0
- package/dist/connectors/tool-selection.js +112 -0
- package/dist/connectors/tool-selection.js.map +1 -0
- package/dist/connectors/toolserver/catalog.d.ts +332 -0
- package/dist/connectors/toolserver/catalog.d.ts.map +1 -0
- package/dist/connectors/toolserver/catalog.js +463 -0
- package/dist/connectors/toolserver/catalog.js.map +1 -0
- package/dist/connectors/toolserver/connectors.d.ts +698 -0
- package/dist/connectors/toolserver/connectors.d.ts.map +1 -0
- package/dist/connectors/toolserver/connectors.js +13 -0
- package/dist/connectors/toolserver/connectors.js.map +1 -0
- package/dist/connectors/toolserver/index.d.ts +144 -0
- package/dist/connectors/toolserver/index.d.ts.map +1 -0
- package/dist/connectors/toolserver/index.js +107 -0
- package/dist/connectors/toolserver/index.js.map +1 -0
- package/dist/connectors/toolserver/integrations.d.ts +103 -0
- package/dist/connectors/toolserver/integrations.d.ts.map +1 -0
- package/dist/connectors/toolserver/integrations.js +277 -0
- package/dist/connectors/toolserver/integrations.js.map +1 -0
- package/dist/connectors/toolserver/load.d.ts +55 -0
- package/dist/connectors/toolserver/load.d.ts.map +1 -0
- package/dist/connectors/toolserver/load.js +290 -0
- package/dist/connectors/toolserver/load.js.map +1 -0
- package/dist/extension.d.ts +77 -0
- package/dist/extension.d.ts.map +1 -0
- package/dist/extension.js +127 -0
- package/dist/extension.js.map +1 -0
- package/dist/identity/actor-subject.d.ts +60 -0
- package/dist/identity/actor-subject.d.ts.map +1 -0
- package/dist/identity/actor-subject.js +107 -0
- package/dist/identity/actor-subject.js.map +1 -0
- package/dist/identity/byo-oauth.d.ts +81 -0
- package/dist/identity/byo-oauth.d.ts.map +1 -0
- package/dist/identity/byo-oauth.js +145 -0
- package/dist/identity/byo-oauth.js.map +1 -0
- package/dist/identity/claims.d.ts +18 -0
- package/dist/identity/claims.d.ts.map +1 -0
- package/dist/identity/claims.js +37 -0
- package/dist/identity/claims.js.map +1 -0
- package/dist/identity/connect-inference.d.ts +38 -0
- package/dist/identity/connect-inference.d.ts.map +1 -0
- package/dist/identity/connect-inference.js +55 -0
- package/dist/identity/connect-inference.js.map +1 -0
- package/dist/identity/connect-provider-types.d.ts +35 -6
- package/dist/identity/connect-provider-types.d.ts.map +1 -1
- package/dist/identity/connect-provider-types.js +3 -1
- package/dist/identity/connect-provider-types.js.map +1 -1
- package/dist/identity/connect-provider.d.ts +9 -4
- package/dist/identity/connect-provider.d.ts.map +1 -1
- package/dist/identity/connect-provider.js +38 -12
- package/dist/identity/connect-provider.js.map +1 -1
- package/dist/identity/credential-resolvers.d.ts +33 -0
- package/dist/identity/credential-resolvers.d.ts.map +1 -0
- package/dist/identity/credential-resolvers.js +62 -0
- package/dist/identity/credential-resolvers.js.map +1 -0
- package/dist/identity/fleet-connect-hint.d.ts +39 -0
- package/dist/identity/fleet-connect-hint.d.ts.map +1 -0
- package/dist/identity/fleet-connect-hint.js +134 -0
- package/dist/identity/fleet-connect-hint.js.map +1 -0
- package/dist/identity/fleet-connect.d.ts +92 -0
- package/dist/identity/fleet-connect.d.ts.map +1 -0
- package/dist/identity/fleet-connect.js +256 -0
- package/dist/identity/fleet-connect.js.map +1 -0
- package/dist/identity/fleet-integration-connect.d.ts +32 -0
- package/dist/identity/fleet-integration-connect.d.ts.map +1 -0
- package/dist/identity/fleet-integration-connect.js +35 -0
- package/dist/identity/fleet-integration-connect.js.map +1 -0
- package/dist/identity/fleet.d.ts +56 -0
- package/dist/identity/fleet.d.ts.map +1 -0
- package/dist/identity/fleet.js +133 -0
- package/dist/identity/fleet.js.map +1 -0
- package/dist/identity/github/connect-http.d.ts +9 -4
- package/dist/identity/github/connect-http.d.ts.map +1 -1
- package/dist/identity/github/connect-http.js +34 -15
- package/dist/identity/github/connect-http.js.map +1 -1
- package/dist/identity/github/credentials-store.d.ts +10 -10
- package/dist/identity/github/credentials-store.d.ts.map +1 -1
- package/dist/identity/github/credentials-store.js +40 -43
- package/dist/identity/github/credentials-store.js.map +1 -1
- package/dist/identity/github/credentials.d.ts +16 -13
- package/dist/identity/github/credentials.d.ts.map +1 -1
- package/dist/identity/github/credentials.js +43 -23
- package/dist/identity/github/credentials.js.map +1 -1
- package/dist/identity/github/index.d.ts +2 -3
- package/dist/identity/github/index.d.ts.map +1 -1
- package/dist/identity/github/index.js +1 -2
- package/dist/identity/github/index.js.map +1 -1
- package/dist/identity/github/oauth.d.ts +3 -6
- package/dist/identity/github/oauth.d.ts.map +1 -1
- package/dist/identity/github/oauth.js +9 -48
- package/dist/identity/github/oauth.js.map +1 -1
- package/dist/identity/google/connect-http.d.ts +38 -0
- package/dist/identity/google/connect-http.d.ts.map +1 -0
- package/dist/identity/google/connect-http.js +59 -0
- package/dist/identity/google/connect-http.js.map +1 -0
- package/dist/identity/google/index.d.ts +7 -0
- package/dist/identity/google/index.d.ts.map +1 -0
- package/dist/identity/google/index.js +6 -0
- package/dist/identity/google/index.js.map +1 -0
- package/dist/identity/google/oauth.d.ts +22 -0
- package/dist/identity/google/oauth.d.ts.map +1 -0
- package/dist/identity/google/oauth.js +48 -0
- package/dist/identity/google/oauth.js.map +1 -0
- package/dist/identity/index.d.ts +51 -29
- package/dist/identity/index.d.ts.map +1 -1
- package/dist/identity/index.js +122 -131
- package/dist/identity/index.js.map +1 -1
- package/dist/identity/linkedin/connect-http.d.ts +38 -0
- package/dist/identity/linkedin/connect-http.d.ts.map +1 -0
- package/dist/identity/linkedin/connect-http.js +59 -0
- package/dist/identity/linkedin/connect-http.js.map +1 -0
- package/dist/identity/linkedin/index.d.ts +7 -0
- package/dist/identity/linkedin/index.d.ts.map +1 -0
- package/dist/identity/linkedin/index.js +6 -0
- package/dist/identity/linkedin/index.js.map +1 -0
- package/dist/identity/linkedin/oauth.d.ts +22 -0
- package/dist/identity/linkedin/oauth.d.ts.map +1 -0
- package/dist/identity/linkedin/oauth.js +47 -0
- package/dist/identity/linkedin/oauth.js.map +1 -0
- package/dist/identity/loopback.d.ts +27 -2
- package/dist/identity/loopback.d.ts.map +1 -1
- package/dist/identity/loopback.js +61 -8
- package/dist/identity/loopback.js.map +1 -1
- package/dist/identity/marketplace/connect-hint.d.ts +31 -0
- package/dist/identity/marketplace/connect-hint.d.ts.map +1 -0
- package/dist/identity/marketplace/connect-hint.js +59 -0
- package/dist/identity/marketplace/connect-hint.js.map +1 -0
- package/dist/identity/marketplace/connect.d.ts +51 -0
- package/dist/identity/marketplace/connect.d.ts.map +1 -0
- package/dist/identity/marketplace/connect.js +88 -0
- package/dist/identity/marketplace/connect.js.map +1 -0
- package/dist/identity/marketplace/index.d.ts +9 -0
- package/dist/identity/marketplace/index.d.ts.map +1 -0
- package/dist/identity/marketplace/index.js +9 -0
- package/dist/identity/marketplace/index.js.map +1 -0
- package/dist/identity/microsoft/connect-http.d.ts +39 -0
- package/dist/identity/microsoft/connect-http.d.ts.map +1 -0
- package/dist/identity/microsoft/connect-http.js +60 -0
- package/dist/identity/microsoft/connect-http.js.map +1 -0
- package/dist/identity/microsoft/index.d.ts +7 -0
- package/dist/identity/microsoft/index.d.ts.map +1 -0
- package/dist/identity/microsoft/index.js +6 -0
- package/dist/identity/microsoft/index.js.map +1 -0
- package/dist/identity/microsoft/oauth.d.ts +24 -0
- package/dist/identity/microsoft/oauth.d.ts.map +1 -0
- package/dist/identity/microsoft/oauth.js +65 -0
- package/dist/identity/microsoft/oauth.js.map +1 -0
- package/dist/identity/oauth-tickets.d.ts +37 -0
- package/dist/identity/oauth-tickets.d.ts.map +1 -0
- package/dist/identity/oauth-tickets.js +114 -0
- package/dist/identity/oauth-tickets.js.map +1 -0
- package/dist/identity/options.d.ts +95 -0
- package/dist/identity/options.d.ts.map +1 -0
- package/dist/identity/options.js +175 -0
- package/dist/identity/options.js.map +1 -0
- package/dist/identity/slack/connect-http.d.ts +3 -3
- package/dist/identity/slack/connect-http.d.ts.map +1 -1
- package/dist/identity/slack/connect-http.js +23 -15
- package/dist/identity/slack/connect-http.js.map +1 -1
- package/dist/identity/slack/index.d.ts +1 -2
- package/dist/identity/slack/index.d.ts.map +1 -1
- package/dist/identity/slack/index.js +1 -2
- package/dist/identity/slack/index.js.map +1 -1
- package/dist/identity/slack/links.d.ts +15 -15
- package/dist/identity/slack/links.d.ts.map +1 -1
- package/dist/identity/slack/links.js +50 -53
- package/dist/identity/slack/links.js.map +1 -1
- package/dist/identity/slack/oauth.d.ts +2 -5
- package/dist/identity/slack/oauth.d.ts.map +1 -1
- package/dist/identity/slack/oauth.js +8 -63
- package/dist/identity/slack/oauth.js.map +1 -1
- package/dist/identity/supabase.js +9 -9
- package/dist/identity/supabase.js.map +1 -1
- package/dist/identity/types.d.ts +96 -38
- package/dist/identity/types.d.ts.map +1 -1
- package/dist/identity/x/connect-http.d.ts +39 -0
- package/dist/identity/x/connect-http.d.ts.map +1 -0
- package/dist/identity/x/connect-http.js +69 -0
- package/dist/identity/x/connect-http.js.map +1 -0
- package/dist/identity/x/index.d.ts +6 -0
- package/dist/identity/x/index.d.ts.map +1 -0
- package/dist/identity/x/index.js +5 -0
- package/dist/identity/x/index.js.map +1 -0
- package/dist/index.d.ts +14 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -12
- package/dist/index.js.map +1 -1
- package/dist/ingress/index.d.ts +54 -0
- package/dist/ingress/index.d.ts.map +1 -0
- package/dist/ingress/index.js +128 -0
- package/dist/ingress/index.js.map +1 -0
- package/dist/namespaces.d.ts +306 -0
- package/dist/namespaces.d.ts.map +1 -0
- package/dist/namespaces.js +127 -0
- package/dist/namespaces.js.map +1 -0
- package/dist/runtime/auth.d.ts +18 -14
- package/dist/runtime/auth.d.ts.map +1 -1
- package/dist/runtime/auth.js +88 -68
- package/dist/runtime/auth.js.map +1 -1
- package/dist/runtime/backend.d.ts +1 -1
- package/dist/runtime/backend.d.ts.map +1 -1
- package/dist/runtime/connector.d.ts +66 -23
- package/dist/runtime/connector.d.ts.map +1 -1
- package/dist/runtime/connector.js +63 -27
- package/dist/runtime/connector.js.map +1 -1
- package/dist/runtime/cors.d.ts +2 -3
- package/dist/runtime/cors.d.ts.map +1 -1
- package/dist/runtime/cors.js +2 -7
- package/dist/runtime/cors.js.map +1 -1
- package/dist/runtime/credentials.d.ts +2 -2
- package/dist/runtime/credentials.d.ts.map +1 -1
- package/dist/runtime/credentials.js +41 -16
- package/dist/runtime/credentials.js.map +1 -1
- package/dist/runtime/http.d.ts +47 -0
- package/dist/runtime/http.d.ts.map +1 -0
- package/dist/runtime/http.js +54 -0
- package/dist/runtime/http.js.map +1 -0
- package/dist/runtime/identity-http.d.ts +6 -16
- package/dist/runtime/identity-http.d.ts.map +1 -1
- package/dist/runtime/identity-http.js +112 -54
- package/dist/runtime/identity-http.js.map +1 -1
- package/dist/runtime/identity-runtime.d.ts +18 -17
- package/dist/runtime/identity-runtime.d.ts.map +1 -1
- package/dist/runtime/identity-runtime.js +55 -39
- package/dist/runtime/identity-runtime.js.map +1 -1
- package/dist/runtime/index.d.ts +85 -222
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +73 -34
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/memory/index.d.ts +1 -0
- package/dist/runtime/memory/index.d.ts.map +1 -1
- package/dist/runtime/memory/index.js +1 -0
- package/dist/runtime/memory/index.js.map +1 -1
- package/dist/runtime/memory/lazy-context-backend.d.ts +66 -0
- package/dist/runtime/memory/lazy-context-backend.d.ts.map +1 -0
- package/dist/runtime/memory/lazy-context-backend.js +154 -0
- package/dist/runtime/memory/lazy-context-backend.js.map +1 -0
- package/dist/runtime/memory/user-repo.js +3 -3
- package/dist/runtime/memory/user-repo.js.map +1 -1
- package/dist/runtime/recursion-limit.d.ts +22 -0
- package/dist/runtime/recursion-limit.d.ts.map +1 -0
- package/dist/runtime/recursion-limit.js +46 -0
- package/dist/runtime/recursion-limit.js.map +1 -0
- package/dist/runtime/sandbox-manager.d.ts +33 -0
- package/dist/runtime/sandbox-manager.d.ts.map +1 -1
- package/dist/runtime/sandbox-manager.js +173 -9
- package/dist/runtime/sandbox-manager.js.map +1 -1
- package/dist/runtime/sandbox-stream-retry.d.ts +16 -0
- package/dist/runtime/sandbox-stream-retry.d.ts.map +1 -0
- package/dist/runtime/sandbox-stream-retry.js +61 -0
- package/dist/runtime/sandbox-stream-retry.js.map +1 -0
- package/dist/runtime/setup-script.d.ts.map +1 -1
- package/dist/runtime/setup-script.js +4 -2
- package/dist/runtime/setup-script.js.map +1 -1
- package/dist/runtime/validated-token.d.ts +1 -1
- package/dist/runtime/validated-token.d.ts.map +1 -1
- package/dist/runtime/validated-token.js +75 -33
- package/dist/runtime/validated-token.js.map +1 -1
- package/dist/sandbox.d.ts +19 -22
- package/dist/sandbox.d.ts.map +1 -1
- package/dist/sandbox.js +20 -34
- package/dist/sandbox.js.map +1 -1
- package/dist/schedules.js +8 -9
- package/dist/schedules.js.map +1 -1
- package/package.json +19 -28
- package/dist/channels/collect.d.ts +0 -26
- package/dist/channels/collect.d.ts.map +0 -1
- package/dist/channels/collect.js +0 -42
- package/dist/channels/collect.js.map +0 -1
- package/dist/channels/github/adapter-core.d.ts +0 -6
- package/dist/channels/github/adapter-core.d.ts.map +0 -1
- package/dist/channels/github/adapter-core.js +0 -27
- package/dist/channels/github/adapter-core.js.map +0 -1
- package/dist/channels/github/adapter.d.ts +0 -16
- package/dist/channels/github/adapter.d.ts.map +0 -1
- package/dist/channels/github/adapter.js +0 -52
- package/dist/channels/github/adapter.js.map +0 -1
- package/dist/channels/github/define.d.ts.map +0 -1
- package/dist/channels/github/define.js +0 -166
- package/dist/channels/github/define.js.map +0 -1
- package/dist/channels/github/http.d.ts.map +0 -1
- package/dist/channels/github/http.js.map +0 -1
- package/dist/channels/github/index.d.ts +0 -12
- package/dist/channels/github/index.d.ts.map +0 -1
- package/dist/channels/github/index.js +0 -10
- package/dist/channels/github/index.js.map +0 -1
- package/dist/channels/github/normalize.d.ts.map +0 -1
- package/dist/channels/github/normalize.js.map +0 -1
- package/dist/channels/github/source-thread.d.ts.map +0 -1
- package/dist/channels/github/source-thread.js.map +0 -1
- package/dist/channels/github/transport.d.ts.map +0 -1
- package/dist/channels/github/transport.js.map +0 -1
- package/dist/channels/plugin.d.ts +0 -61
- package/dist/channels/plugin.d.ts.map +0 -1
- package/dist/channels/plugin.js +0 -80
- package/dist/channels/plugin.js.map +0 -1
- package/dist/channels/slack/adapter-core.d.ts.map +0 -1
- package/dist/channels/slack/adapter-core.js.map +0 -1
- package/dist/channels/slack/adapter.d.ts.map +0 -1
- package/dist/channels/slack/adapter.js.map +0 -1
- package/dist/channels/slack/define.d.ts +0 -74
- package/dist/channels/slack/define.d.ts.map +0 -1
- package/dist/channels/slack/define.js +0 -160
- package/dist/channels/slack/define.js.map +0 -1
- package/dist/channels/slack/http.d.ts.map +0 -1
- package/dist/channels/slack/http.js.map +0 -1
- package/dist/channels/slack/index.d.ts +0 -18
- package/dist/channels/slack/index.d.ts.map +0 -1
- package/dist/channels/slack/index.js +0 -13
- package/dist/channels/slack/index.js.map +0 -1
- package/dist/channels/slack/normalize.d.ts.map +0 -1
- package/dist/channels/slack/normalize.js.map +0 -1
- package/dist/channels/slack/source-thread.d.ts.map +0 -1
- package/dist/channels/slack/source-thread.js.map +0 -1
- package/dist/channels/slack/transport.d.ts.map +0 -1
- package/dist/channels/slack/transport.js.map +0 -1
- /package/dist/{channels → connectors}/github/source-thread.d.ts +0 -0
- /package/dist/{channels → connectors}/github/source-thread.js +0 -0
- /package/dist/{channels → connectors}/slack/adapter-core.js +0 -0
- /package/dist/{channels → connectors}/slack/source-thread.d.ts +0 -0
- /package/dist/{channels → connectors}/slack/source-thread.js +0 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Load marketplace MCP tools through LangSmith's `POST /api/v1/mcp/proxy`.
|
|
3
|
+
*
|
|
4
|
+
* Unlike toolserver (bare Streamable HTTP to `/v1/toolserver/servers/{slug}/mcp`),
|
|
5
|
+
* marketplace invoke uses an HTTP-over-JSON envelope. Credentials never leave
|
|
6
|
+
* the vault — the proxy mints a bearer for `agent_id` / `ls_user_id`.
|
|
7
|
+
*/
|
|
8
|
+
import { DynamicStructuredTool } from "@langchain/core/tools";
|
|
9
|
+
import { z } from "zod";
|
|
10
|
+
import { agentIdFromActor, isActorSubjectIntegrationEnabled, } from "../../identity/actor-subject.js";
|
|
11
|
+
import { rewriteFleetToolError } from "../../identity/fleet-connect-hint.js";
|
|
12
|
+
import { resolveFleetApiUrl, resolveFleetHeaders, } from "../../identity/fleet.js";
|
|
13
|
+
import { marketplaceAsFleetHint } from "../../identity/marketplace/index.js";
|
|
14
|
+
import { managedRuntimeOverrides } from "../../runtime/managed-tools.js";
|
|
15
|
+
import { fetchWithTimeout, PROVIDER_HTTP_TIMEOUT_MS, } from "../../runtime/http.js";
|
|
16
|
+
import { selectTools, } from "../tool-selection.js";
|
|
17
|
+
import { parseMcpProxyResponseBody, resolveMarketplaceMcpServer, resolveSmithBackendV1Url, } from "./fleet-mcp.js";
|
|
18
|
+
const schemaCache = new WeakMap();
|
|
19
|
+
const subjectToolsCache = new WeakMap();
|
|
20
|
+
const subjectToolsCacheConnectors = new Set();
|
|
21
|
+
/** Load (and cache) tools for one marketplace connector declaration. */
|
|
22
|
+
export function loadMarketplaceTools(integration, label, connector) {
|
|
23
|
+
if (connector.includeTools?.length === 0) {
|
|
24
|
+
return Promise.resolve([]);
|
|
25
|
+
}
|
|
26
|
+
const cached = schemaCache.get(connector);
|
|
27
|
+
if (cached) {
|
|
28
|
+
return cached;
|
|
29
|
+
}
|
|
30
|
+
const loading = connectAndLoadTools(integration, label, connector)
|
|
31
|
+
.then((tools) => {
|
|
32
|
+
// Empty pre-connect fallbacks must not stick forever — a later load may
|
|
33
|
+
// discover tools once the workspace/actor connection exists.
|
|
34
|
+
if (tools.length === 0) {
|
|
35
|
+
schemaCache.delete(connector);
|
|
36
|
+
}
|
|
37
|
+
return tools;
|
|
38
|
+
})
|
|
39
|
+
.catch((error) => {
|
|
40
|
+
schemaCache.delete(connector);
|
|
41
|
+
throw error;
|
|
42
|
+
});
|
|
43
|
+
schemaCache.set(connector, loading);
|
|
44
|
+
return loading;
|
|
45
|
+
}
|
|
46
|
+
export function clearMarketplaceToolsCacheForTests(connector) {
|
|
47
|
+
schemaCache.delete(connector);
|
|
48
|
+
}
|
|
49
|
+
export function clearMarketplaceSubjectCacheForTests() {
|
|
50
|
+
for (const connector of subjectToolsCacheConnectors) {
|
|
51
|
+
subjectToolsCache.delete(connector);
|
|
52
|
+
}
|
|
53
|
+
subjectToolsCacheConnectors.clear();
|
|
54
|
+
}
|
|
55
|
+
async function connectAndLoadTools(integration, label, config) {
|
|
56
|
+
const listAgentId = trimmed(process.env.MDA_TOOLSERVER_AGENT_ID);
|
|
57
|
+
const tools = await loadToolsForAgentId(integration, label, config, listAgentId);
|
|
58
|
+
if (isActorSubjectIntegrationEnabled(integration.id)) {
|
|
59
|
+
return tools.map((tool) => wrapToolWithDynamicAgentId(tool, integration, label, config));
|
|
60
|
+
}
|
|
61
|
+
return tools;
|
|
62
|
+
}
|
|
63
|
+
async function loadToolsForAgentId(integration, label, config, agentId) {
|
|
64
|
+
const server = await resolveMarketplaceMcpServer({
|
|
65
|
+
mcpUrl: integration.mcpUrl,
|
|
66
|
+
});
|
|
67
|
+
const providerId = server.oauth_provider_id.trim();
|
|
68
|
+
const listed = await listProxyTools({
|
|
69
|
+
integration,
|
|
70
|
+
oauthProviderId: providerId,
|
|
71
|
+
agentId,
|
|
72
|
+
label,
|
|
73
|
+
});
|
|
74
|
+
const tools = listed.map((entry) => buildProxyTool(entry, integration, providerId, config, agentId, label));
|
|
75
|
+
return selectTools(label, config, tools);
|
|
76
|
+
}
|
|
77
|
+
async function listProxyTools(options) {
|
|
78
|
+
const env = process.env;
|
|
79
|
+
const base = resolveFleetApiUrl(env);
|
|
80
|
+
const headers = resolveFleetHeaders(options.label, env);
|
|
81
|
+
const params = new URLSearchParams({
|
|
82
|
+
url: options.integration.mcpUrl,
|
|
83
|
+
oauth_provider_id: options.oauthProviderId,
|
|
84
|
+
});
|
|
85
|
+
if (options.agentId) {
|
|
86
|
+
params.set("agent_id", options.agentId);
|
|
87
|
+
}
|
|
88
|
+
const toolsUrl = new URL(resolveSmithBackendV1Url(base, "mcp/tools"));
|
|
89
|
+
toolsUrl.search = params.toString();
|
|
90
|
+
const response = await fetchWithTimeout(toolsUrl.toString(), { method: "GET", headers }, PROVIDER_HTTP_TIMEOUT_MS, fetch);
|
|
91
|
+
if (response.status === 428 || response.status === 401) {
|
|
92
|
+
// No subject / connection yet — expose catalog names so the agent can still
|
|
93
|
+
// be authored; invoke will fail with a connect hint once identity is present.
|
|
94
|
+
return options.integration.tools.map((name) => ({
|
|
95
|
+
name,
|
|
96
|
+
description: `${name} (connect required)`,
|
|
97
|
+
inputSchema: {
|
|
98
|
+
type: "object",
|
|
99
|
+
properties: {},
|
|
100
|
+
additionalProperties: true,
|
|
101
|
+
},
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
if (!response.ok) {
|
|
105
|
+
const text = await response.text().catch(() => "");
|
|
106
|
+
throw new Error(`${options.label}: list marketplace tools failed (${response.status}): ${text || response.statusText}`);
|
|
107
|
+
}
|
|
108
|
+
const json = (await response.json());
|
|
109
|
+
return (json.tools ?? []).filter((tool) => typeof tool?.name === "string" && tool.name.length > 0);
|
|
110
|
+
}
|
|
111
|
+
function buildProxyTool(entry, integration, providerId, config, fixedAgentId, label) {
|
|
112
|
+
const schema = jsonSchemaToZod(entry.inputSchema);
|
|
113
|
+
return new DynamicStructuredTool({
|
|
114
|
+
name: entry.name,
|
|
115
|
+
description: entry.description ?? entry.name,
|
|
116
|
+
schema,
|
|
117
|
+
func: async (input, _runManager, runtime) => {
|
|
118
|
+
const runtimeConfig = runtime;
|
|
119
|
+
const agentId = resolveInvokeAgentId(runtimeConfig, integration.id) ?? fixedAgentId;
|
|
120
|
+
try {
|
|
121
|
+
return await callProxyTool({
|
|
122
|
+
url: integration.mcpUrl,
|
|
123
|
+
oauthProviderId: providerId,
|
|
124
|
+
agentId,
|
|
125
|
+
toolName: entry.name,
|
|
126
|
+
args: input,
|
|
127
|
+
label,
|
|
128
|
+
timeoutMs: config.defaultToolTimeout,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
throw rewriteFleetToolError(error, marketplaceAsFleetHint(integration, providerId));
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function wrapToolWithDynamicAgentId(tool, integration, label, config) {
|
|
138
|
+
const base = tool;
|
|
139
|
+
if (typeof base.name !== "string" || !base.name) {
|
|
140
|
+
throw new Error(`${label}: expected a LangChain tool with a string name for actor-subject wrapping`);
|
|
141
|
+
}
|
|
142
|
+
return new DynamicStructuredTool({
|
|
143
|
+
name: base.name,
|
|
144
|
+
description: base.description ?? "",
|
|
145
|
+
schema: base.schema,
|
|
146
|
+
func: async (input, runManager, runtime) => {
|
|
147
|
+
const runtimeConfig = runtime;
|
|
148
|
+
const agentId = resolveInvokeAgentId(runtimeConfig, integration.id);
|
|
149
|
+
const subjectTools = await toolsForSubject(integration, label, config, agentId);
|
|
150
|
+
const match = subjectTools.find((t) => t &&
|
|
151
|
+
typeof t === "object" &&
|
|
152
|
+
"name" in t &&
|
|
153
|
+
t.name === base.name);
|
|
154
|
+
if (!match) {
|
|
155
|
+
throw new Error(`${label}: tool "${base.name}" not found for agent subject`);
|
|
156
|
+
}
|
|
157
|
+
if (typeof match.func === "function") {
|
|
158
|
+
return await match.func(input, runManager, runtimeConfig);
|
|
159
|
+
}
|
|
160
|
+
if (typeof match.invoke === "function") {
|
|
161
|
+
return await match.invoke(input, runtimeConfig);
|
|
162
|
+
}
|
|
163
|
+
throw new Error(`${label}: tool "${base.name}" for agent subject is not invokable`);
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function toolsForSubject(integration, label, config, agentId) {
|
|
168
|
+
const connectorKey = config;
|
|
169
|
+
let byAgent = subjectToolsCache.get(connectorKey);
|
|
170
|
+
if (!byAgent) {
|
|
171
|
+
byAgent = new Map();
|
|
172
|
+
subjectToolsCache.set(connectorKey, byAgent);
|
|
173
|
+
subjectToolsCacheConnectors.add(connectorKey);
|
|
174
|
+
}
|
|
175
|
+
const key = agentId ?? "";
|
|
176
|
+
const cached = byAgent.get(key);
|
|
177
|
+
if (cached) {
|
|
178
|
+
return cached;
|
|
179
|
+
}
|
|
180
|
+
const loading = loadToolsForAgentId(integration, label, config, agentId).catch((error) => {
|
|
181
|
+
byAgent.delete(key);
|
|
182
|
+
throw error;
|
|
183
|
+
});
|
|
184
|
+
byAgent.set(key, loading);
|
|
185
|
+
return loading;
|
|
186
|
+
}
|
|
187
|
+
function resolveInvokeAgentId(runtime, integrationId) {
|
|
188
|
+
if (isActorSubjectIntegrationEnabled(integrationId)) {
|
|
189
|
+
const identity = managedRuntimeOverrides(runtime).identity;
|
|
190
|
+
const userId = identity?.user?.id;
|
|
191
|
+
if (userId) {
|
|
192
|
+
return agentIdFromActor(userId);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return trimmed(process.env.MDA_TOOLSERVER_AGENT_ID);
|
|
196
|
+
}
|
|
197
|
+
async function callProxyTool(options) {
|
|
198
|
+
if (!options.agentId) {
|
|
199
|
+
throw new Error(`${options.label}: marketplace tool "${options.toolName}" needs an agent subject ` +
|
|
200
|
+
`(Connect-with-${options.label.replace(/^connectors\./, "")} or MDA_TOOLSERVER_AGENT_ID)`);
|
|
201
|
+
}
|
|
202
|
+
const env = process.env;
|
|
203
|
+
const base = resolveFleetApiUrl(env);
|
|
204
|
+
const headers = resolveFleetHeaders(options.label, env);
|
|
205
|
+
// Envelope timeout is seconds (smith-backend). Keep the local fetch budget
|
|
206
|
+
// at least as long, plus a small transport allowance — otherwise
|
|
207
|
+
// `defaultToolTimeout` above PROVIDER_HTTP_TIMEOUT_MS is silently truncated.
|
|
208
|
+
const timeoutMs = Math.min(Math.max(options.timeoutMs ?? 120_000, 1_000), 120_000);
|
|
209
|
+
const timeoutSeconds = timeoutMs / 1000;
|
|
210
|
+
const httpTimeoutMs = timeoutMs + 5_000;
|
|
211
|
+
// Forwarded to the vendor MCP by smith-backend's proxy. Notion (and other
|
|
212
|
+
// Streamable HTTP servers) reject requests that omit text/event-stream.
|
|
213
|
+
const mcpHeaders = {
|
|
214
|
+
"Content-Type": "application/json",
|
|
215
|
+
Accept: "application/json, text/event-stream",
|
|
216
|
+
"MCP-Protocol-Version": "2025-11-25",
|
|
217
|
+
};
|
|
218
|
+
const body = {
|
|
219
|
+
url: options.url,
|
|
220
|
+
method: "POST",
|
|
221
|
+
oauth_provider_id: options.oauthProviderId,
|
|
222
|
+
agent_id: options.agentId,
|
|
223
|
+
timeout: timeoutSeconds,
|
|
224
|
+
headers: mcpHeaders,
|
|
225
|
+
body: {
|
|
226
|
+
jsonrpc: "2.0",
|
|
227
|
+
id: 1,
|
|
228
|
+
method: "tools/call",
|
|
229
|
+
params: {
|
|
230
|
+
name: options.toolName,
|
|
231
|
+
arguments: options.args && typeof options.args === "object" ? options.args : {},
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
};
|
|
235
|
+
const response = await fetchWithTimeout(resolveSmithBackendV1Url(base, "mcp/proxy"), {
|
|
236
|
+
method: "POST",
|
|
237
|
+
headers,
|
|
238
|
+
body: JSON.stringify(body),
|
|
239
|
+
}, httpTimeoutMs, fetch);
|
|
240
|
+
const text = await response.text().catch(() => "");
|
|
241
|
+
if (!response.ok) {
|
|
242
|
+
throw new Error(`${options.label}: marketplace tool "${options.toolName}" failed (${response.status}): ${text || response.statusText}`);
|
|
243
|
+
}
|
|
244
|
+
return parseMcpProxyResponseBody(text);
|
|
245
|
+
}
|
|
246
|
+
/** Best-effort JSON Schema → Zod object (additionalProperties open). */
|
|
247
|
+
function jsonSchemaToZod(inputSchema) {
|
|
248
|
+
if (!inputSchema || typeof inputSchema !== "object") {
|
|
249
|
+
return z.record(z.string(), z.unknown());
|
|
250
|
+
}
|
|
251
|
+
const properties = inputSchema.properties;
|
|
252
|
+
if (!properties || typeof properties !== "object") {
|
|
253
|
+
return z.record(z.string(), z.unknown());
|
|
254
|
+
}
|
|
255
|
+
const shape = {};
|
|
256
|
+
for (const key of Object.keys(properties)) {
|
|
257
|
+
shape[key] = z.unknown().optional();
|
|
258
|
+
}
|
|
259
|
+
return z.looseObject(shape);
|
|
260
|
+
}
|
|
261
|
+
function trimmed(value) {
|
|
262
|
+
const v = value?.trim();
|
|
263
|
+
return v ? v : undefined;
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=load.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.js","sourceRoot":"","sources":["../../../src/connectors/marketplace/load.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,gBAAgB,EAChB,gCAAgC,GACjC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EACL,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,WAAW,GAEZ,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,yBAAyB,EACzB,2BAA2B,EAC3B,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,GAAG,IAAI,OAAO,EAA8B,CAAC;AAC9D,MAAM,iBAAiB,GAAG,IAAI,OAAO,EAGlC,CAAC;AACJ,MAAM,2BAA2B,GAAG,IAAI,GAAG,EAAU,CAAC;AAItD,wEAAw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Q,EAAE,CAAC;QACpD,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAC3C,CAAC;IACD,MAAM,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC;IAC1C,IAAI,CAAC,UAAU,IAAI,OAAO,UAAU,KAAK,QAAQ,EAAE,CAAC;QAClD,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAC3C,CAAC;IACD,MAAM,KAAK,GAAiC,EAAE,CAAC;IAC/C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,UAAqC,CAAC,EAAE,CAAC;QACrE,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC;IACtC,CAAC;IACD,OAAO,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,OAAO,CAAC,KAAyB;IACxC,MAAM,CAAC,GAAG,KAAK,EAAE,IAAI,EAAE,CAAC;IACxB,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3B,CAAC"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The managed `connectors/` declaration primitive.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* Agent at runtime — the author never imports the MCP client or calls
|
|
10
|
-
* `getTools()`.
|
|
4
|
+
* A Managed Deep Agent declares the remote MCP servers whose tools it wants in
|
|
5
|
+
* `connectors/mcp.ts` with `connectors.mcp(...)`. MDA discovers that
|
|
6
|
+
* declaration, creates the `@langchain/mcp-adapters` client, loads the tools,
|
|
7
|
+
* and adds them to the Deep Agent at runtime — the author never imports the MCP
|
|
8
|
+
* client or calls `getTools()`.
|
|
11
9
|
*
|
|
12
10
|
* Only remote MCP servers over HTTP/SSE are supported. Stdio MCP servers are
|
|
13
11
|
* intentionally out of scope: they introduce process management, packaging, and
|
|
@@ -20,12 +18,9 @@
|
|
|
20
18
|
* @example
|
|
21
19
|
* ```ts
|
|
22
20
|
* // connectors/mcp.ts
|
|
23
|
-
* import {
|
|
21
|
+
* import { connectors } from "managed-deepagents";
|
|
24
22
|
*
|
|
25
|
-
* export const
|
|
26
|
-
* useStandardContentBlocks: true,
|
|
27
|
-
* prefixToolNameWithServerName: true,
|
|
28
|
-
* throwOnLoadError: true,
|
|
23
|
+
* export const connector = connectors.mcp({
|
|
29
24
|
* mcpServers: {
|
|
30
25
|
* docs: {
|
|
31
26
|
* transport: "http",
|
|
@@ -35,7 +30,7 @@
|
|
|
35
30
|
* });
|
|
36
31
|
* ```
|
|
37
32
|
*/
|
|
38
|
-
import {
|
|
33
|
+
import type { Connector } from "../../runtime/connector.js";
|
|
39
34
|
/** Per-server MCP tool selection. Names are raw, unprefixed MCP tool names. */
|
|
40
35
|
export interface McpToolSelectionConfig {
|
|
41
36
|
/**
|
|
@@ -81,7 +76,7 @@ export interface SseMcpServerConfig extends RemoteMcpServerBaseConfig {
|
|
|
81
76
|
}
|
|
82
77
|
/** A remote MCP server connection. Stdio servers are intentionally excluded. */
|
|
83
78
|
export type RemoteMcpServerConfig = HttpMcpServerConfig | SseMcpServerConfig;
|
|
84
|
-
/** Configuration accepted by
|
|
79
|
+
/** Configuration accepted by `connectors.mcp`. */
|
|
85
80
|
export interface McpServersConfig {
|
|
86
81
|
/**
|
|
87
82
|
* MCP servers to connect to. Each key is the logical server name MDA uses
|
|
@@ -124,11 +119,9 @@ export interface McpServersDefinition extends McpServersConfig, Connector {
|
|
|
124
119
|
* Declare the MCP servers whose tools should be loaded and added to the managed
|
|
125
120
|
* Deep Agent at runtime.
|
|
126
121
|
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
* `"sse"`). Stdio servers and invalid tool selectors are rejected with a clear
|
|
131
|
-
* error.
|
|
122
|
+
* The tools hook runs at agent-graph construction time (inside the managed
|
|
123
|
+
* runtime), so the MCP client loader is imported lazily — authoring-only
|
|
124
|
+
* installs never pull in `@langchain/mcp-adapters`.
|
|
132
125
|
*/
|
|
133
|
-
export declare
|
|
126
|
+
export declare const mcpConnector: (config: McpServersConfig) => McpServersDefinition;
|
|
134
127
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/connectors/mcp/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/connectors/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAE5D,+EAA+E;AAC/E,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB;AAED,4DAA4D;AAC5D,MAAM,WAAW,yBAA0B,SAAQ,sBAAsB;IACvE,6CAA6C;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,sEAAsE;IACtE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,2EAA2E;IAC3E,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,6CAA6C;AAC7C,MAAM,WAAW,mBAAoB,SAAQ,yBAAyB;IACpE,0DAA0D;IAC1D,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,wCAAwC;AACxC,MAAM,WAAW,kBAAmB,SAAQ,yBAAyB;IACnE,oDAAoD;IACpD,SAAS,EAAE,KAAK,CAAC;IACjB,iDAAiD;IACjD,SAAS,CAAC,EAAE;QACV,OAAO,EAAE,OAAO,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;CACH;AAED,gFAAgF;AAChF,MAAM,MAAM,qBAAqB,GAAG,mBAAmB,GAAG,kBAAkB,CAAC;AAE7E,kDAAkD;AAClD,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;IAClD;;;;OAIG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;OAGG;IACH,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAqB,SAAQ,gBAAgB,EAAE,SAAS;IACvE,qDAAqD;IACrD,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;CAC9B;AAyFD;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,oBASrD,CAAC"}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The managed `connectors/` declaration primitive.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* Agent at runtime — the author never imports the MCP client or calls
|
|
10
|
-
* `getTools()`.
|
|
4
|
+
* A Managed Deep Agent declares the remote MCP servers whose tools it wants in
|
|
5
|
+
* `connectors/mcp.ts` with `connectors.mcp(...)`. MDA discovers that
|
|
6
|
+
* declaration, creates the `@langchain/mcp-adapters` client, loads the tools,
|
|
7
|
+
* and adds them to the Deep Agent at runtime — the author never imports the MCP
|
|
8
|
+
* client or calls `getTools()`.
|
|
11
9
|
*
|
|
12
10
|
* Only remote MCP servers over HTTP/SSE are supported. Stdio MCP servers are
|
|
13
11
|
* intentionally out of scope: they introduce process management, packaging, and
|
|
@@ -20,12 +18,9 @@
|
|
|
20
18
|
* @example
|
|
21
19
|
* ```ts
|
|
22
20
|
* // connectors/mcp.ts
|
|
23
|
-
* import {
|
|
21
|
+
* import { connectors } from "managed-deepagents";
|
|
24
22
|
*
|
|
25
|
-
* export const
|
|
26
|
-
* useStandardContentBlocks: true,
|
|
27
|
-
* prefixToolNameWithServerName: true,
|
|
28
|
-
* throwOnLoadError: true,
|
|
23
|
+
* export const connector = connectors.mcp({
|
|
29
24
|
* mcpServers: {
|
|
30
25
|
* docs: {
|
|
31
26
|
* transport: "http",
|
|
@@ -35,109 +30,94 @@
|
|
|
35
30
|
* });
|
|
36
31
|
* ```
|
|
37
32
|
*/
|
|
38
|
-
import {
|
|
33
|
+
import { z } from "zod";
|
|
34
|
+
import { defineExtension } from "../../extension.js";
|
|
35
|
+
/** Stdio servers are out of scope; the message points at the alternatives. */
|
|
36
|
+
const STDIO_REJECTION = "uses a stdio transport, which is not supported. Managed Deep Agents " +
|
|
37
|
+
"support remote MCP servers over HTTP/SSE only; expose the server over HTTP " +
|
|
38
|
+
"or write a normal authored tool instead.";
|
|
39
|
+
/** Raw MCP tool names, before the managed `{server}__` prefix is applied. */
|
|
40
|
+
const toolNames = z
|
|
41
|
+
.array(z
|
|
42
|
+
.string("must be a non-empty tool name")
|
|
43
|
+
.refine((name) => name.trim().length > 0, "must be a non-empty tool name"))
|
|
44
|
+
.check((ctx) => {
|
|
45
|
+
const seen = new Set();
|
|
46
|
+
for (const name of ctx.value) {
|
|
47
|
+
if (seen.has(name)) {
|
|
48
|
+
ctx.issues.push({
|
|
49
|
+
code: "custom",
|
|
50
|
+
input: ctx.value,
|
|
51
|
+
message: `contains duplicate tool name "${name}"`,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
seen.add(name);
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
.optional();
|
|
58
|
+
const remoteMcpServer = z
|
|
59
|
+
.looseObject({
|
|
60
|
+
// Present only to reject it: a `command` is how a stdio server is spelled.
|
|
61
|
+
command: z.never({ error: STDIO_REJECTION }).optional(),
|
|
62
|
+
transport: z.enum(["http", "sse"], {
|
|
63
|
+
error: (issue) => issue.input === "stdio"
|
|
64
|
+
? STDIO_REJECTION
|
|
65
|
+
: 'must declare a remote transport ("http" or "sse")',
|
|
66
|
+
}),
|
|
67
|
+
url: z
|
|
68
|
+
.string("must be a non-empty URL")
|
|
69
|
+
.refine((url) => url.trim().length > 0, "must be a non-empty URL"),
|
|
70
|
+
headers: z.record(z.string(), z.string()).optional(),
|
|
71
|
+
defaultToolTimeout: z.number().optional(),
|
|
72
|
+
includeTools: toolNames,
|
|
73
|
+
excludeTools: toolNames,
|
|
74
|
+
})
|
|
75
|
+
.check((ctx) => {
|
|
76
|
+
const { includeTools, excludeTools } = ctx.value;
|
|
77
|
+
const overlap = (includeTools ?? []).filter((name) => (excludeTools ?? []).includes(name));
|
|
78
|
+
if (overlap.length > 0) {
|
|
79
|
+
ctx.issues.push({
|
|
80
|
+
code: "custom",
|
|
81
|
+
input: ctx.value,
|
|
82
|
+
message: "selects tool(s) in both `includeTools` and `excludeTools`: " +
|
|
83
|
+
`${[...overlap].sort().join(", ")}`,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
});
|
|
39
87
|
/**
|
|
40
|
-
*
|
|
41
|
-
* Deep Agent at runtime.
|
|
88
|
+
* The MCP connector's arguments.
|
|
42
89
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* `
|
|
47
|
-
* error.
|
|
90
|
+
* Shape, types, and tool-name lists are the schema's job; the rules that need
|
|
91
|
+
* more than one field — a stdio server, a tool selected and deselected at once
|
|
92
|
+
* — are checks with hand-written messages. Server configs stay loose because
|
|
93
|
+
* `@langchain/mcp-adapters` accepts more per-transport options than MDA models.
|
|
48
94
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
throw new Error("defineMcpServers(...) requires at least one entry in `mcpServers`.");
|
|
61
|
-
}
|
|
62
|
-
for (const [name, server] of entries) {
|
|
63
|
-
validateRemoteServer(name, server);
|
|
64
|
-
}
|
|
65
|
-
const definition = { kind: "mcp_servers", ...config };
|
|
66
|
-
// Brand it as a connector without exposing the symbol as an enumerable field.
|
|
67
|
-
Object.defineProperty(definition, CONNECTOR_BRAND, {
|
|
68
|
-
value: true,
|
|
69
|
-
enumerable: false,
|
|
70
|
-
});
|
|
71
|
-
// The tools hook runs at agent-graph construction time (inside the managed
|
|
72
|
-
// runtime), so the MCP client loader is imported lazily — authoring-only
|
|
73
|
-
// installs never pull in `@langchain/mcp-adapters`.
|
|
74
|
-
Object.defineProperty(definition, "tools", {
|
|
75
|
-
value: async () => {
|
|
76
|
-
const { loadManagedMcpTools } = await import("./load.js");
|
|
77
|
-
return loadManagedMcpTools(definition);
|
|
78
|
-
},
|
|
79
|
-
enumerable: false,
|
|
80
|
-
});
|
|
81
|
-
return definition;
|
|
82
|
-
}
|
|
83
|
-
/** Allowed remote transports. Stdio is intentionally unsupported in v0. */
|
|
84
|
-
const REMOTE_TRANSPORTS = new Set(["http", "sse"]);
|
|
95
|
+
const mcpServersConfig = z.object({
|
|
96
|
+
mcpServers: z
|
|
97
|
+
.record(z.string(), remoteMcpServer, {
|
|
98
|
+
error: "must be an object mapping server names to remote MCP server configs",
|
|
99
|
+
})
|
|
100
|
+
.refine((servers) => Object.keys(servers).length > 0, "requires at least one entry"),
|
|
101
|
+
prefixToolNameWithServerName: z.boolean().optional(),
|
|
102
|
+
throwOnLoadError: z.boolean().optional(),
|
|
103
|
+
useStandardContentBlocks: z.boolean().optional(),
|
|
104
|
+
onConnectionError: z.literal("throw").optional(),
|
|
105
|
+
});
|
|
85
106
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
107
|
+
* Declare the MCP servers whose tools should be loaded and added to the managed
|
|
108
|
+
* Deep Agent at runtime.
|
|
109
|
+
*
|
|
110
|
+
* The tools hook runs at agent-graph construction time (inside the managed
|
|
111
|
+
* runtime), so the MCP client loader is imported lazily — authoring-only
|
|
112
|
+
* installs never pull in `@langchain/mcp-adapters`.
|
|
88
113
|
*/
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
"Managed Deep Agents support remote MCP servers over HTTP/SSE only; " +
|
|
99
|
-
"expose the server over HTTP or write a normal authored tool instead.");
|
|
100
|
-
}
|
|
101
|
-
const transport = config.transport;
|
|
102
|
-
if (typeof transport !== "string" || !REMOTE_TRANSPORTS.has(transport)) {
|
|
103
|
-
throw new Error(`MCP server "${name}" must declare a remote transport ` +
|
|
104
|
-
`("http" or "sse"); got ${JSON.stringify(transport)}.`);
|
|
105
|
-
}
|
|
106
|
-
if (typeof config.url !== "string" || config.url.trim().length === 0) {
|
|
107
|
-
throw new Error(`MCP server "${name}" must declare a non-empty \`url\`.`);
|
|
108
|
-
}
|
|
109
|
-
validateToolSelection(name, config);
|
|
110
|
-
}
|
|
111
|
-
function validateToolSelection(name, config) {
|
|
112
|
-
const includeTools = validateToolNameList(name, "includeTools", config.includeTools);
|
|
113
|
-
const excludeTools = validateToolNameList(name, "excludeTools", config.excludeTools);
|
|
114
|
-
if (!includeTools || !excludeTools) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
const included = new Set(includeTools);
|
|
118
|
-
const conflicts = excludeTools.filter((toolName) => included.has(toolName));
|
|
119
|
-
if (conflicts.length > 0) {
|
|
120
|
-
throw new Error(`MCP server "${name}" selects tool(s) in both \`includeTools\` and ` +
|
|
121
|
-
`\`excludeTools\`: ${conflicts.sort().join(", ")}.`);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
function validateToolNameList(serverName, field, value) {
|
|
125
|
-
if (value === undefined) {
|
|
126
|
-
return undefined;
|
|
127
|
-
}
|
|
128
|
-
if (!Array.isArray(value)) {
|
|
129
|
-
throw new Error(`MCP server "${serverName}" \`${field}\` must be an array of strings.`);
|
|
130
|
-
}
|
|
131
|
-
const seen = new Set();
|
|
132
|
-
for (const [index, item] of value.entries()) {
|
|
133
|
-
if (typeof item !== "string" || item.trim().length === 0) {
|
|
134
|
-
throw new Error(`MCP server "${serverName}" \`${field}\` entry ${index} must be a non-empty string.`);
|
|
135
|
-
}
|
|
136
|
-
if (seen.has(item)) {
|
|
137
|
-
throw new Error(`MCP server "${serverName}" \`${field}\` contains duplicate tool name "${item}".`);
|
|
138
|
-
}
|
|
139
|
-
seen.add(item);
|
|
140
|
-
}
|
|
141
|
-
return value;
|
|
142
|
-
}
|
|
114
|
+
export const mcpConnector = defineExtension("connector", {
|
|
115
|
+
kind: "mcp_servers",
|
|
116
|
+
label: "connectors.mcp",
|
|
117
|
+
args: mcpServersConfig,
|
|
118
|
+
async tools(_ctx, self) {
|
|
119
|
+
const { loadManagedMcpTools } = await import("./load.js");
|
|
120
|
+
return loadManagedMcpTools(self);
|
|
121
|
+
},
|
|
122
|
+
});
|
|
143
123
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/connectors/mcp/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/connectors/mcp/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB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AAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,EAC5C,6BAA6B,CAC9B;IACH,4BAA4B,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACpD,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IACxC,wBAAwB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAChD,iBAAiB,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE;CACjD,CAAC,CAAC;AAEL;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GACvB,eAAe,CAAC,WAAW,EAAE;IAC3B,IAAI,EAAE,aAAa;IACnB,KAAK,EAAE,gBAAgB;IACvB,IAAI,EAAE,gBAAgB;IACtB,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI;QACpB,MAAM,EAAE,mBAAmB,EAAE,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC;QAC1D,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../src/connectors/mcp/load.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../src/connectors/mcp/load.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAA0B,MAAM,YAAY,CAAC;AAa/E;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,oBAAoB,GAC/B,OAAO,CAAC,OAAO,EAAE,CAAC,CAQpB;AAED,yDAAyD;AACzD,wBAAgB,iCAAiC,IAAI,IAAI,CAExD"}
|