managed-deepagents 0.5.0-dev.80 → 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.
Files changed (192) hide show
  1. package/README.md +6 -5
  2. package/dist/connectors/github/http.d.ts.map +1 -1
  3. package/dist/connectors/github/http.js +11 -1
  4. package/dist/connectors/github/http.js.map +1 -1
  5. package/dist/connectors/github/index.d.ts +5 -5
  6. package/dist/connectors/github/index.d.ts.map +1 -1
  7. package/dist/connectors/github/index.js.map +1 -1
  8. package/dist/connectors/marketplace/catalog.d.ts +96 -0
  9. package/dist/connectors/marketplace/catalog.d.ts.map +1 -0
  10. package/dist/connectors/marketplace/catalog.js +213 -0
  11. package/dist/connectors/marketplace/catalog.js.map +1 -0
  12. package/dist/connectors/marketplace/fleet-mcp.d.ts +62 -0
  13. package/dist/connectors/marketplace/fleet-mcp.d.ts.map +1 -0
  14. package/dist/connectors/marketplace/fleet-mcp.js +215 -0
  15. package/dist/connectors/marketplace/fleet-mcp.js.map +1 -0
  16. package/dist/connectors/marketplace/index.d.ts +31 -0
  17. package/dist/connectors/marketplace/index.d.ts.map +1 -0
  18. package/dist/connectors/marketplace/index.js +39 -0
  19. package/dist/connectors/marketplace/index.js.map +1 -0
  20. package/dist/connectors/marketplace/load.d.ts +15 -0
  21. package/dist/connectors/marketplace/load.d.ts.map +1 -0
  22. package/dist/connectors/marketplace/load.js +265 -0
  23. package/dist/connectors/marketplace/load.js.map +1 -0
  24. package/dist/connectors/slack/http.d.ts.map +1 -1
  25. package/dist/connectors/slack/http.js +16 -2
  26. package/dist/connectors/slack/http.js.map +1 -1
  27. package/dist/connectors/slack/index.d.ts +3 -3
  28. package/dist/connectors/slack/index.d.ts.map +1 -1
  29. package/dist/connectors/slack/index.js.map +1 -1
  30. package/dist/connectors/tool-selection.d.ts +32 -8
  31. package/dist/connectors/tool-selection.d.ts.map +1 -1
  32. package/dist/connectors/tool-selection.js +62 -4
  33. package/dist/connectors/tool-selection.js.map +1 -1
  34. package/dist/connectors/toolserver/catalog.d.ts +241 -43
  35. package/dist/connectors/toolserver/catalog.d.ts.map +1 -1
  36. package/dist/connectors/toolserver/catalog.js +423 -34
  37. package/dist/connectors/toolserver/catalog.js.map +1 -1
  38. package/dist/connectors/toolserver/connectors.d.ts +698 -0
  39. package/dist/connectors/toolserver/connectors.d.ts.map +1 -0
  40. package/dist/connectors/toolserver/connectors.js +13 -0
  41. package/dist/connectors/toolserver/connectors.js.map +1 -0
  42. package/dist/connectors/toolserver/index.d.ts +56 -31
  43. package/dist/connectors/toolserver/index.d.ts.map +1 -1
  44. package/dist/connectors/toolserver/index.js +15 -58
  45. package/dist/connectors/toolserver/index.js.map +1 -1
  46. package/dist/connectors/toolserver/integrations.d.ts +103 -0
  47. package/dist/connectors/toolserver/integrations.d.ts.map +1 -0
  48. package/dist/connectors/toolserver/integrations.js +277 -0
  49. package/dist/connectors/toolserver/integrations.js.map +1 -0
  50. package/dist/connectors/toolserver/load.d.ts +10 -10
  51. package/dist/connectors/toolserver/load.d.ts.map +1 -1
  52. package/dist/connectors/toolserver/load.js +164 -36
  53. package/dist/connectors/toolserver/load.js.map +1 -1
  54. package/dist/identity/actor-subject.d.ts +60 -0
  55. package/dist/identity/actor-subject.d.ts.map +1 -0
  56. package/dist/identity/actor-subject.js +107 -0
  57. package/dist/identity/actor-subject.js.map +1 -0
  58. package/dist/identity/byo-oauth.d.ts +81 -0
  59. package/dist/identity/byo-oauth.d.ts.map +1 -0
  60. package/dist/identity/byo-oauth.js +145 -0
  61. package/dist/identity/byo-oauth.js.map +1 -0
  62. package/dist/identity/connect-inference.d.ts +13 -3
  63. package/dist/identity/connect-inference.d.ts.map +1 -1
  64. package/dist/identity/connect-inference.js +22 -6
  65. package/dist/identity/connect-inference.js.map +1 -1
  66. package/dist/identity/connect-provider-types.d.ts +12 -0
  67. package/dist/identity/connect-provider-types.d.ts.map +1 -1
  68. package/dist/identity/connect-provider.js +20 -4
  69. package/dist/identity/connect-provider.js.map +1 -1
  70. package/dist/identity/fleet-connect-hint.d.ts +39 -0
  71. package/dist/identity/fleet-connect-hint.d.ts.map +1 -0
  72. package/dist/identity/fleet-connect-hint.js +134 -0
  73. package/dist/identity/fleet-connect-hint.js.map +1 -0
  74. package/dist/identity/fleet-connect.d.ts +92 -0
  75. package/dist/identity/fleet-connect.d.ts.map +1 -0
  76. package/dist/identity/fleet-connect.js +256 -0
  77. package/dist/identity/fleet-connect.js.map +1 -0
  78. package/dist/identity/fleet-integration-connect.d.ts +32 -0
  79. package/dist/identity/fleet-integration-connect.d.ts.map +1 -0
  80. package/dist/identity/fleet-integration-connect.js +35 -0
  81. package/dist/identity/fleet-integration-connect.js.map +1 -0
  82. package/dist/identity/fleet.d.ts +56 -0
  83. package/dist/identity/fleet.d.ts.map +1 -0
  84. package/dist/identity/fleet.js +133 -0
  85. package/dist/identity/fleet.js.map +1 -0
  86. package/dist/identity/github/connect-http.d.ts +6 -1
  87. package/dist/identity/github/connect-http.d.ts.map +1 -1
  88. package/dist/identity/github/connect-http.js +22 -11
  89. package/dist/identity/github/connect-http.js.map +1 -1
  90. package/dist/identity/github/oauth.d.ts +2 -5
  91. package/dist/identity/github/oauth.d.ts.map +1 -1
  92. package/dist/identity/github/oauth.js +3 -43
  93. package/dist/identity/github/oauth.js.map +1 -1
  94. package/dist/identity/google/connect-http.d.ts +38 -0
  95. package/dist/identity/google/connect-http.d.ts.map +1 -0
  96. package/dist/identity/google/connect-http.js +59 -0
  97. package/dist/identity/google/connect-http.js.map +1 -0
  98. package/dist/identity/google/index.d.ts +7 -0
  99. package/dist/identity/google/index.d.ts.map +1 -0
  100. package/dist/identity/google/index.js +6 -0
  101. package/dist/identity/google/index.js.map +1 -0
  102. package/dist/identity/google/oauth.d.ts +22 -0
  103. package/dist/identity/google/oauth.d.ts.map +1 -0
  104. package/dist/identity/google/oauth.js +48 -0
  105. package/dist/identity/google/oauth.js.map +1 -0
  106. package/dist/identity/index.d.ts +16 -0
  107. package/dist/identity/index.d.ts.map +1 -1
  108. package/dist/identity/index.js +25 -1
  109. package/dist/identity/index.js.map +1 -1
  110. package/dist/identity/linkedin/connect-http.d.ts +38 -0
  111. package/dist/identity/linkedin/connect-http.d.ts.map +1 -0
  112. package/dist/identity/linkedin/connect-http.js +59 -0
  113. package/dist/identity/linkedin/connect-http.js.map +1 -0
  114. package/dist/identity/linkedin/index.d.ts +7 -0
  115. package/dist/identity/linkedin/index.d.ts.map +1 -0
  116. package/dist/identity/linkedin/index.js +6 -0
  117. package/dist/identity/linkedin/index.js.map +1 -0
  118. package/dist/identity/linkedin/oauth.d.ts +22 -0
  119. package/dist/identity/linkedin/oauth.d.ts.map +1 -0
  120. package/dist/identity/linkedin/oauth.js +47 -0
  121. package/dist/identity/linkedin/oauth.js.map +1 -0
  122. package/dist/identity/marketplace/connect-hint.d.ts +31 -0
  123. package/dist/identity/marketplace/connect-hint.d.ts.map +1 -0
  124. package/dist/identity/marketplace/connect-hint.js +59 -0
  125. package/dist/identity/marketplace/connect-hint.js.map +1 -0
  126. package/dist/identity/marketplace/connect.d.ts +51 -0
  127. package/dist/identity/marketplace/connect.d.ts.map +1 -0
  128. package/dist/identity/marketplace/connect.js +88 -0
  129. package/dist/identity/marketplace/connect.js.map +1 -0
  130. package/dist/identity/marketplace/index.d.ts +9 -0
  131. package/dist/identity/marketplace/index.d.ts.map +1 -0
  132. package/dist/identity/marketplace/index.js +9 -0
  133. package/dist/identity/marketplace/index.js.map +1 -0
  134. package/dist/identity/microsoft/connect-http.d.ts +39 -0
  135. package/dist/identity/microsoft/connect-http.d.ts.map +1 -0
  136. package/dist/identity/microsoft/connect-http.js +60 -0
  137. package/dist/identity/microsoft/connect-http.js.map +1 -0
  138. package/dist/identity/microsoft/index.d.ts +7 -0
  139. package/dist/identity/microsoft/index.d.ts.map +1 -0
  140. package/dist/identity/microsoft/index.js +6 -0
  141. package/dist/identity/microsoft/index.js.map +1 -0
  142. package/dist/identity/microsoft/oauth.d.ts +24 -0
  143. package/dist/identity/microsoft/oauth.d.ts.map +1 -0
  144. package/dist/identity/microsoft/oauth.js +65 -0
  145. package/dist/identity/microsoft/oauth.js.map +1 -0
  146. package/dist/identity/oauth-tickets.d.ts +37 -0
  147. package/dist/identity/oauth-tickets.d.ts.map +1 -0
  148. package/dist/identity/oauth-tickets.js +114 -0
  149. package/dist/identity/oauth-tickets.js.map +1 -0
  150. package/dist/identity/options.d.ts +8 -3
  151. package/dist/identity/options.d.ts.map +1 -1
  152. package/dist/identity/options.js +6 -2
  153. package/dist/identity/options.js.map +1 -1
  154. package/dist/identity/slack/connect-http.d.ts.map +1 -1
  155. package/dist/identity/slack/connect-http.js +3 -3
  156. package/dist/identity/slack/connect-http.js.map +1 -1
  157. package/dist/identity/slack/oauth.d.ts +2 -5
  158. package/dist/identity/slack/oauth.d.ts.map +1 -1
  159. package/dist/identity/slack/oauth.js +3 -43
  160. package/dist/identity/slack/oauth.js.map +1 -1
  161. package/dist/identity/types.d.ts +14 -2
  162. package/dist/identity/types.d.ts.map +1 -1
  163. package/dist/identity/x/connect-http.d.ts +39 -0
  164. package/dist/identity/x/connect-http.d.ts.map +1 -0
  165. package/dist/identity/x/connect-http.js +69 -0
  166. package/dist/identity/x/connect-http.js.map +1 -0
  167. package/dist/identity/x/index.d.ts +6 -0
  168. package/dist/identity/x/index.d.ts.map +1 -0
  169. package/dist/identity/x/index.js +5 -0
  170. package/dist/identity/x/index.js.map +1 -0
  171. package/dist/index.d.ts +4 -1
  172. package/dist/index.d.ts.map +1 -1
  173. package/dist/index.js +1 -0
  174. package/dist/index.js.map +1 -1
  175. package/dist/namespaces.d.ts +254 -24
  176. package/dist/namespaces.d.ts.map +1 -1
  177. package/dist/namespaces.js +65 -32
  178. package/dist/namespaces.js.map +1 -1
  179. package/dist/runtime/credentials.d.ts +2 -2
  180. package/dist/runtime/credentials.js +2 -2
  181. package/dist/runtime/identity-http.d.ts.map +1 -1
  182. package/dist/runtime/identity-http.js +45 -4
  183. package/dist/runtime/identity-http.js.map +1 -1
  184. package/dist/runtime/index.d.ts +13 -123
  185. package/dist/runtime/index.d.ts.map +1 -1
  186. package/dist/runtime/index.js +52 -14
  187. package/dist/runtime/index.js.map +1 -1
  188. package/dist/runtime/recursion-limit.d.ts +22 -0
  189. package/dist/runtime/recursion-limit.d.ts.map +1 -0
  190. package/dist/runtime/recursion-limit.js +46 -0
  191. package/dist/runtime/recursion-limit.js.map +1 -0
  192. package/package.json +8 -7
@@ -0,0 +1,277 @@
1
+ /**
2
+ * Fleet OAuth integrations for toolserver connectors that store per-actor
3
+ * tokens in the LangSmith vault.
4
+ *
5
+ * Adding an integration here is the main step for a new Fleet provider of the
6
+ * same kind (Google, Microsoft Graph, LinkedIn, X): toolserver load, Connect
7
+ * inference, scopes, and actor-subject enablement all read this catalog.
8
+ */
9
+ /**
10
+ * Built-in Fleet OAuth integrations.
11
+ *
12
+ * To adopt another provider of the same kind: add a row, wire
13
+ * `connect.<id>()` (usually via {@link createFleetVaultConnectProvider}), and
14
+ * optionally a BYO OAuth adapter. Toolserver subject routing and connect
15
+ * inference pick the integration up automatically.
16
+ */
17
+ export const FLEET_OAUTH_INTEGRATIONS = [
18
+ {
19
+ id: "google",
20
+ connectId: "google",
21
+ displayName: "Google",
22
+ defaultProviderSlug: "google-oauth-provider",
23
+ providerSlugEnv: "MDA_GOOGLE_OAUTH_PROVIDER",
24
+ toolServerSlugs: [
25
+ "gmail",
26
+ "google_bigquery",
27
+ "google_calendar",
28
+ "google_docs",
29
+ "google_drive",
30
+ "google_meet",
31
+ "google_sheets",
32
+ "google_slides",
33
+ ],
34
+ profileScopes: ["openid", "email", "profile"],
35
+ scopesBySlug: {
36
+ gmail: ["https://www.googleapis.com/auth/gmail.modify"],
37
+ google_bigquery: ["https://www.googleapis.com/auth/bigquery"],
38
+ google_calendar: [
39
+ "https://www.googleapis.com/auth/calendar.events",
40
+ "https://www.googleapis.com/auth/calendar.calendarlist.readonly",
41
+ "https://www.googleapis.com/auth/calendar.freebusy",
42
+ ],
43
+ google_docs: ["https://www.googleapis.com/auth/drive.file"],
44
+ google_drive: ["https://www.googleapis.com/auth/drive.file"],
45
+ google_meet: [
46
+ "https://www.googleapis.com/auth/meetings.space.created",
47
+ "https://www.googleapis.com/auth/calendar.events",
48
+ ],
49
+ google_sheets: ["https://www.googleapis.com/auth/drive.file"],
50
+ google_slides: ["https://www.googleapis.com/auth/drive.file"],
51
+ },
52
+ },
53
+ {
54
+ id: "microsoft",
55
+ connectId: "microsoft",
56
+ displayName: "Microsoft",
57
+ defaultProviderSlug: "microsoft-oauth-provider",
58
+ providerSlugEnv: "MDA_MICROSOFT_OAUTH_PROVIDER",
59
+ toolServerSlugs: [
60
+ "outlook",
61
+ "teams",
62
+ "sharepoint",
63
+ "word",
64
+ "excel",
65
+ "powerpoint",
66
+ ],
67
+ // Host may still add `offline_access`.
68
+ profileScopes: [
69
+ "openid",
70
+ "email",
71
+ "profile",
72
+ "https://graph.microsoft.com/User.Read",
73
+ ],
74
+ scopesBySlug: {
75
+ // Omit *.Shared mailbox scopes; authors can pass extra scopes via connect().
76
+ outlook: [
77
+ "https://graph.microsoft.com/Mail.ReadWrite",
78
+ "https://graph.microsoft.com/Mail.Send",
79
+ "https://graph.microsoft.com/Calendars.ReadWrite",
80
+ ],
81
+ teams: [
82
+ "https://graph.microsoft.com/Team.ReadBasic.All",
83
+ "https://graph.microsoft.com/Channel.ReadBasic.All",
84
+ "https://graph.microsoft.com/Channel.Create",
85
+ "https://graph.microsoft.com/ChannelMessage.Send",
86
+ "https://graph.microsoft.com/ChannelMessage.Read.All",
87
+ "https://graph.microsoft.com/Chat.Create",
88
+ "https://graph.microsoft.com/Chat.ReadWrite",
89
+ ],
90
+ sharepoint: [
91
+ "https://graph.microsoft.com/Sites.ReadWrite.All",
92
+ "https://graph.microsoft.com/Files.ReadWrite.All",
93
+ ],
94
+ word: ["https://graph.microsoft.com/Files.ReadWrite.All"],
95
+ excel: ["https://graph.microsoft.com/Files.ReadWrite.All"],
96
+ powerpoint: ["https://graph.microsoft.com/Files.ReadWrite.All"],
97
+ },
98
+ },
99
+ {
100
+ id: "linkedin",
101
+ connectId: "linkedin",
102
+ displayName: "LinkedIn",
103
+ defaultProviderSlug: "linkedin-oauth-provider",
104
+ providerSlugEnv: "MDA_LINKEDIN_OAUTH_PROVIDER",
105
+ toolServerSlugs: ["linkedin"],
106
+ profileScopes: ["openid", "profile", "email"],
107
+ scopesBySlug: {
108
+ linkedin: ["w_member_social"],
109
+ },
110
+ },
111
+ {
112
+ // Fleet reserved BYO slug (workspace registers the X app client). Host
113
+ // handler + Agent Builder use `twitter-oauth-provider` for `x_com`.
114
+ id: "x",
115
+ connectId: "x",
116
+ displayName: "X",
117
+ defaultProviderSlug: "twitter-oauth-provider",
118
+ providerSlugEnv: "MDA_X_OAUTH_PROVIDER",
119
+ toolServerSlugs: ["x_com"],
120
+ profileScopes: ["users.read", "offline.access"],
121
+ scopesBySlug: {
122
+ x_com: [
123
+ "tweet.read",
124
+ "tweet.write",
125
+ "like.read",
126
+ "like.write",
127
+ "list.read",
128
+ "follows.read",
129
+ "follows.write",
130
+ ],
131
+ },
132
+ },
133
+ ];
134
+ const INTEGRATION_BY_ID = new Map(FLEET_OAUTH_INTEGRATIONS.map((integration) => [integration.id, integration]));
135
+ const INTEGRATION_BY_SLUG = new Map();
136
+ for (const integration of FLEET_OAUTH_INTEGRATIONS) {
137
+ for (const slug of integration.toolServerSlugs) {
138
+ INTEGRATION_BY_SLUG.set(slug, integration);
139
+ }
140
+ }
141
+ export function integrationById(id) {
142
+ return INTEGRATION_BY_ID.get(id);
143
+ }
144
+ export function integrationForSlug(slug) {
145
+ return slug ? INTEGRATION_BY_SLUG.get(slug) : undefined;
146
+ }
147
+ export function isFleetOAuthSlug(slug) {
148
+ return integrationForSlug(slug) !== undefined;
149
+ }
150
+ /** Toolserver slugs for `integration` that appear in `kinds`. */
151
+ export function integrationConnectorKinds(integration, kinds) {
152
+ const allowed = new Set(integration.toolServerSlugs);
153
+ const out = [];
154
+ for (const kind of kinds ?? []) {
155
+ if (kind && allowed.has(kind) && !out.includes(kind)) {
156
+ out.push(kind);
157
+ }
158
+ }
159
+ return out;
160
+ }
161
+ export function hasIntegrationToolServerConnector(integration, kinds) {
162
+ return integrationConnectorKinds(integration, kinds).length > 0;
163
+ }
164
+ /**
165
+ * Union of OAuth scopes for the given connector kinds in `integration`.
166
+ *
167
+ * Includes {@link FleetOAuthIntegration.profileScopes} when at least one
168
+ * integration connector is present.
169
+ */
170
+ export function scopesForIntegrationConnectorKinds(integration, kinds) {
171
+ const matched = integrationConnectorKinds(integration, kinds);
172
+ if (matched.length === 0) {
173
+ return [];
174
+ }
175
+ const scopes = new Set(integration.profileScopes ?? []);
176
+ for (const slug of matched) {
177
+ for (const scope of integration.scopesBySlug[slug] ??
178
+ []) {
179
+ scopes.add(scope);
180
+ }
181
+ }
182
+ return [...scopes];
183
+ }
184
+ export function readIntegrationProviderSlug(integration, env = process.env) {
185
+ if (integration.providerSlugEnv) {
186
+ const override = env[integration.providerSlugEnv]?.trim();
187
+ if (override) {
188
+ return override;
189
+ }
190
+ }
191
+ return integration.defaultProviderSlug;
192
+ }
193
+ /** Google integration convenience — same UUID namespace / slug set as before. */
194
+ export const GOOGLE_INTEGRATION = integrationById("google");
195
+ export const GOOGLE_TOOLSERVER_SLUGS = GOOGLE_INTEGRATION.toolServerSlugs;
196
+ export function isGoogleToolServerSlug(slug) {
197
+ return integrationForSlug(slug)?.id === "google";
198
+ }
199
+ export function googleConnectorKinds(kinds) {
200
+ return integrationConnectorKinds(GOOGLE_INTEGRATION, kinds);
201
+ }
202
+ export function googleScopesForConnectorKinds(kinds) {
203
+ return scopesForIntegrationConnectorKinds(GOOGLE_INTEGRATION, kinds);
204
+ }
205
+ export function hasGoogleToolServerConnector(kinds) {
206
+ return hasIntegrationToolServerConnector(GOOGLE_INTEGRATION, kinds);
207
+ }
208
+ /** Env name for the Google Fleet provider slug. */
209
+ export const MDA_GOOGLE_OAUTH_PROVIDER_ENV = "MDA_GOOGLE_OAUTH_PROVIDER";
210
+ export const DEFAULT_GOOGLE_PROVIDER_SLUG = GOOGLE_INTEGRATION.defaultProviderSlug;
211
+ export function readGoogleProviderSlug(env = process.env) {
212
+ return readIntegrationProviderSlug(GOOGLE_INTEGRATION, env);
213
+ }
214
+ /** Microsoft Graph integration convenience helpers. */
215
+ export const MICROSOFT_INTEGRATION = integrationById("microsoft");
216
+ export const MICROSOFT_TOOLSERVER_SLUGS = MICROSOFT_INTEGRATION.toolServerSlugs;
217
+ export function isMicrosoftToolServerSlug(slug) {
218
+ return integrationForSlug(slug)?.id === "microsoft";
219
+ }
220
+ export function microsoftConnectorKinds(kinds) {
221
+ return integrationConnectorKinds(MICROSOFT_INTEGRATION, kinds);
222
+ }
223
+ export function microsoftScopesForConnectorKinds(kinds) {
224
+ return scopesForIntegrationConnectorKinds(MICROSOFT_INTEGRATION, kinds);
225
+ }
226
+ export function hasMicrosoftToolServerConnector(kinds) {
227
+ return hasIntegrationToolServerConnector(MICROSOFT_INTEGRATION, kinds);
228
+ }
229
+ /** Env name for the Microsoft Fleet provider slug. */
230
+ export const MDA_MICROSOFT_OAUTH_PROVIDER_ENV = "MDA_MICROSOFT_OAUTH_PROVIDER";
231
+ export const DEFAULT_MICROSOFT_PROVIDER_SLUG = MICROSOFT_INTEGRATION.defaultProviderSlug;
232
+ export function readMicrosoftProviderSlug(env = process.env) {
233
+ return readIntegrationProviderSlug(MICROSOFT_INTEGRATION, env);
234
+ }
235
+ /** LinkedIn integration convenience helpers. */
236
+ export const LINKEDIN_INTEGRATION = integrationById("linkedin");
237
+ export const LINKEDIN_TOOLSERVER_SLUGS = LINKEDIN_INTEGRATION.toolServerSlugs;
238
+ export function isLinkedInToolServerSlug(slug) {
239
+ return integrationForSlug(slug)?.id === "linkedin";
240
+ }
241
+ export function linkedinConnectorKinds(kinds) {
242
+ return integrationConnectorKinds(LINKEDIN_INTEGRATION, kinds);
243
+ }
244
+ export function linkedinScopesForConnectorKinds(kinds) {
245
+ return scopesForIntegrationConnectorKinds(LINKEDIN_INTEGRATION, kinds);
246
+ }
247
+ export function hasLinkedInToolServerConnector(kinds) {
248
+ return hasIntegrationToolServerConnector(LINKEDIN_INTEGRATION, kinds);
249
+ }
250
+ /** Env name for the LinkedIn Fleet provider slug. */
251
+ export const MDA_LINKEDIN_OAUTH_PROVIDER_ENV = "MDA_LINKEDIN_OAUTH_PROVIDER";
252
+ export const DEFAULT_LINKEDIN_PROVIDER_SLUG = LINKEDIN_INTEGRATION.defaultProviderSlug;
253
+ export function readLinkedInProviderSlug(env = process.env) {
254
+ return readIntegrationProviderSlug(LINKEDIN_INTEGRATION, env);
255
+ }
256
+ /** X (Twitter) integration convenience helpers. */
257
+ export const X_INTEGRATION = integrationById("x");
258
+ export const X_TOOLSERVER_SLUGS = X_INTEGRATION.toolServerSlugs;
259
+ export function isXToolServerSlug(slug) {
260
+ return integrationForSlug(slug)?.id === "x";
261
+ }
262
+ export function xConnectorKinds(kinds) {
263
+ return integrationConnectorKinds(X_INTEGRATION, kinds);
264
+ }
265
+ export function xScopesForConnectorKinds(kinds) {
266
+ return scopesForIntegrationConnectorKinds(X_INTEGRATION, kinds);
267
+ }
268
+ export function hasXToolServerConnector(kinds) {
269
+ return hasIntegrationToolServerConnector(X_INTEGRATION, kinds);
270
+ }
271
+ /** Env name for the X Fleet provider slug. */
272
+ export const MDA_X_OAUTH_PROVIDER_ENV = "MDA_X_OAUTH_PROVIDER";
273
+ export const DEFAULT_X_PROVIDER_SLUG = X_INTEGRATION.defaultProviderSlug;
274
+ export function readXProviderSlug(env = process.env) {
275
+ return readIntegrationProviderSlug(X_INTEGRATION, env);
276
+ }
277
+ //# sourceMappingURL=integrations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"integrations.js","sourceRoot":"","sources":["../../../src/connectors/toolserver/integrations.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AA6BH;;;;;;;GAOG;AACH,MAAM,CAA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AAyB,CAAC,aAAa,EAAE,KAAK,CAAsB,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,wBAAwB,CACtC,KAAkD;IAElD,OAAO,kCAAkC,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,KAAkD;IAElD,OAAO,iCAAiC,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;AACjE,CAAC;AAED,8CAA8C;AAC9C,MAAM,CAAC,MAAM,wBAAwB,GAAG,sBAAsB,CAAC;AAC/D,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAAC,mBAAmB,CAAC;AAEzE,MAAM,UAAU,iBAAiB,CAC/B,GAAG,GAAsB,OAAO,CAAC,GAAG;IAEpC,OAAO,2BAA2B,CAAC,aAAa,EAAE,GAAG,CAAC,CAAC;AACzD,CAAC"}
@@ -16,24 +16,24 @@
16
16
  * describes the deployment rather than the agent: `LANGSMITH_API_KEY`,
17
17
  * `LANGSMITH_ENDPOINT` / `LANGCHAIN_ENDPOINT`, `LANGCHAIN_WORKSPACE_ID`.
18
18
  *
19
- * `MDA_TOOLSERVER_AGENT_ID` is the exception that should not need to exist. The
20
- * gateway resolves credentials for the user behind the key, and a deployment key
21
- * that resolves to no user has no subject at all so until the gateway can
22
- * recognize a deployment from its own key, such a deployment has to name the
23
- * LangSmith agent whose shared connection it borrows. It is an env var and not a
24
- * connector option because it is a fact about where the deployment runs, and
25
- * because it disappears once the gateway does that itself.
19
+ * `MDA_TOOLSERVER_AGENT_ID` is the shared (Pattern C) subject. When a Fleet
20
+ * OAuth integration's actor-subject mode is on (inferred from connectors or
21
+ * `connect.<integration>()`), those tools resolve `agent_id` at invoke time from
22
+ * `runtime.identity.user.id` via {@link agentIdFromActor}.
26
23
  */
27
24
  import type { ToolServerConnectorConfig, ToolServerSlug } from "./index.js";
28
25
  /**
29
26
  * Load (and cache) the tools of one declared tool server integration.
30
27
  *
31
- * `connector` carries the gateway options and is what the cache is keyed by: a
32
- * declaration lives as long as the process, and two of them never share a key.
28
+ * `connector` carries the gateway options and is what the schema cache is keyed
29
+ * by. Returned tools may re-resolve `agent_id` on each invoke when a Fleet
30
+ * integration's actor-subject mode is enabled.
33
31
  */
34
32
  export declare function loadToolServerTools(slug: ToolServerSlug, label: string, connector: ToolServerConnectorConfig & object): Promise<unknown[]>;
35
33
  /** Drop a connector's cached tools. Test-only. */
36
34
  export declare function clearToolServerToolsCacheForTests(connector: object): void;
35
+ /** Drop per-subject invoke caches. Test-only. */
36
+ export declare function clearToolServerSubjectCacheForTests(): void;
37
37
  /**
38
38
  * Build the integration's gateway URL.
39
39
  *
@@ -42,7 +42,7 @@ export declare function clearToolServerToolsCacheForTests(connector: object): vo
42
42
  * makes the base the whole prefix — `https://api.smith.langchain.com`, or
43
43
  * `https://langsmith.acme.com/api` self-hosted — not a host to graft onto.
44
44
  */
45
- export declare function gatewayUrl(slug: ToolServerSlug, label: string): string;
45
+ export declare function gatewayUrl(slug: ToolServerSlug, label: string, agentId?: string | null): string;
46
46
  /**
47
47
  * Authenticate the call to the gateway.
48
48
  *
@@ -1 +1 @@
1
- {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../src/connectors/toolserver/load.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAKH,OAAO,KAAK,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAkB5E;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,yBAAyB,GAAG,MAAM,GAC5C,OAAO,CAAC,OAAO,EAAE,CAAC,CAmBpB;AAED,kDAAkD;AAClD,wBAAgB,iCAAiC,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAEzE;AA+BD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAoBtE;AAUD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAepE"}
1
+ {"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../../src/connectors/toolserver/load.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAcH,OAAO,KAAK,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAuB5E;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,yBAAyB,GAAG,MAAM,GAC5C,OAAO,CAAC,OAAO,EAAE,CAAC,CAepB;AAED,kDAAkD;AAClD,wBAAgB,iCAAiC,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAEzE;AAED,iDAAiD;AACjD,wBAAgB,mCAAmC,IAAI,IAAI,CAK1D;AA0ND;;;;;;;GAOG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,cAAc,EACpB,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GACtB,MAAM,CAqBR;AAUD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAepE"}
@@ -16,68 +16,82 @@
16
16
  * describes the deployment rather than the agent: `LANGSMITH_API_KEY`,
17
17
  * `LANGSMITH_ENDPOINT` / `LANGCHAIN_ENDPOINT`, `LANGCHAIN_WORKSPACE_ID`.
18
18
  *
19
- * `MDA_TOOLSERVER_AGENT_ID` is the exception that should not need to exist. The
20
- * gateway resolves credentials for the user behind the key, and a deployment key
21
- * that resolves to no user has no subject at all so until the gateway can
22
- * recognize a deployment from its own key, such a deployment has to name the
23
- * LangSmith agent whose shared connection it borrows. It is an env var and not a
24
- * connector option because it is a fact about where the deployment runs, and
25
- * because it disappears once the gateway does that itself.
19
+ * `MDA_TOOLSERVER_AGENT_ID` is the shared (Pattern C) subject. When a Fleet
20
+ * OAuth integration's actor-subject mode is on (inferred from connectors or
21
+ * `connect.<integration>()`), those tools resolve `agent_id` at invoke time from
22
+ * `runtime.identity.user.id` via {@link agentIdFromActor}.
26
23
  */
24
+ import { DynamicStructuredTool } from "@langchain/core/tools";
27
25
  import { MultiServerMCPClient } from "@langchain/mcp-adapters";
26
+ import { agentIdFromActor, isActorSubjectSlugEnabled, } from "../../identity/actor-subject.js";
27
+ import { rewriteFleetToolError } from "../../identity/fleet-connect-hint.js";
28
+ import { managedRuntimeOverrides } from "../../runtime/managed-tools.js";
28
29
  import { selectTools } from "../tool-selection.js";
30
+ import { integrationForSlug } from "./integrations.js";
29
31
  /** LangSmith's public API, used when no endpoint is configured. */
30
32
  const DEFAULT_API_URL = "https://api.smith.langchain.com";
31
33
  /**
32
- * Tools loaded per declared connector, cached for the life of the process.
33
- *
34
- * The compiled entry rebuilds the agent graph on every invocation, but an
35
- * integration's tool surface is stable for the life of the deployment — so each
36
- * connector connects and lists once and every later run reuses the result.
37
- * Keyed by the connector object so two declarations (Gmail and Linear, say)
38
- * never share an entry, and storing the in-flight promise dedupes concurrent
39
- * first runs. A rejected load is evicted, so a transient connection error can be
40
- * retried on the next run while a misconfigured declaration keeps reporting it.
34
+ * Schema tools loaded per declared connector (listTools), cached for the life
35
+ * of the process. Invoke-time MCP clients are keyed separately by agent_id.
36
+ */
37
+ const schemaCache = new WeakMap();
38
+ /**
39
+ * Per-connector, per-agentId MCP tool lists for invoke-time subject routing.
40
+ * Keyed by connector object so distinct declarations (include/exclude/timeout)
41
+ * never share a tool list.
41
42
  */
42
- const cache = new WeakMap();
43
+ const subjectToolsCache = new WeakMap();
44
+ /** Strong refs so {@link clearToolServerSubjectCacheForTests} can drop entries. */
45
+ const subjectToolsCacheConnectors = new Set();
43
46
  /**
44
47
  * Load (and cache) the tools of one declared tool server integration.
45
48
  *
46
- * `connector` carries the gateway options and is what the cache is keyed by: a
47
- * declaration lives as long as the process, and two of them never share a key.
49
+ * `connector` carries the gateway options and is what the schema cache is keyed
50
+ * by. Returned tools may re-resolve `agent_id` on each invoke when a Fleet
51
+ * integration's actor-subject mode is enabled.
48
52
  */
49
53
  export function loadToolServerTools(slug, label, connector) {
50
- // An empty allowlist selects no tools, so there is nothing to list. Returning
51
- // before connecting is what lets a project declare an integration for
52
- // something other than its tools — `connectors.github` cloning a repository —
53
- // without the workspace having that integration connected.
54
54
  if (connector.includeTools?.length === 0) {
55
55
  return Promise.resolve([]);
56
56
  }
57
- const cached = cache.get(connector);
57
+ const cached = schemaCache.get(connector);
58
58
  if (cached) {
59
59
  return cached;
60
60
  }
61
61
  const loading = connectAndLoadTools(slug, label, connector).catch((error) => {
62
- cache.delete(connector);
62
+ schemaCache.delete(connector);
63
63
  throw error;
64
64
  });
65
- cache.set(connector, loading);
65
+ schemaCache.set(connector, loading);
66
66
  return loading;
67
67
  }
68
68
  /** Drop a connector's cached tools. Test-only. */
69
69
  export function clearToolServerToolsCacheForTests(connector) {
70
- cache.delete(connector);
70
+ schemaCache.delete(connector);
71
+ }
72
+ /** Drop per-subject invoke caches. Test-only. */
73
+ export function clearToolServerSubjectCacheForTests() {
74
+ for (const connector of subjectToolsCacheConnectors) {
75
+ subjectToolsCache.delete(connector);
76
+ }
77
+ subjectToolsCacheConnectors.clear();
71
78
  }
72
79
  async function connectAndLoadTools(slug, label, config) {
80
+ // List tools without a dynamic actor subject; tool schemas are provider-wide.
81
+ const listAgentId = trimmed(process.env.MDA_TOOLSERVER_AGENT_ID);
82
+ const tools = await loadToolsForAgentId(slug, label, config, listAgentId);
83
+ if (isActorSubjectSlugEnabled(slug)) {
84
+ return tools.map((tool) => wrapToolWithDynamicAgentId(tool, slug, label, config));
85
+ }
86
+ return tools;
87
+ }
88
+ async function loadToolsForAgentId(slug, label, config, agentId) {
73
89
  const client = new MultiServerMCPClient({
74
90
  mcpServers: {
75
91
  [slug]: {
76
92
  transport: "http",
77
- url: gatewayUrl(slug, label),
93
+ url: gatewayUrl(slug, label, agentId),
78
94
  headers: gatewayHeaders(label),
79
- // The gateway only answers POST, so there is no SSE endpoint to fall
80
- // back to; a failure here is a real failure worth surfacing.
81
95
  automaticSSEFallback: false,
82
96
  ...(config.defaultToolTimeout === undefined
83
97
  ? {}
@@ -92,6 +106,120 @@ async function connectAndLoadTools(slug, label, config) {
92
106
  const tools = await client.getTools(slug);
93
107
  return selectTools(label, config, tools);
94
108
  }
109
+ /**
110
+ * Rebuild an MCP tool so each invoke re-resolves `agent_id` from the caller.
111
+ *
112
+ * Copies the DynamicStructuredTool constructor fields from the schema-load tool
113
+ * (name/description/schema/responseFormat/metadata/…) and replaces `func` with
114
+ * subject routing. Throws when the adapter returns something that is not a
115
+ * LangChain structured tool — silent pass-through would skip actor routing.
116
+ */
117
+ function wrapToolWithDynamicAgentId(tool, slug, label, config) {
118
+ const base = tool;
119
+ if (typeof base.name !== "string" || !base.name) {
120
+ throw new Error(`${label}: expected a LangChain tool with a string name for ` +
121
+ `actor-subject wrapping; got ${describeUnexpectedTool(tool)}`);
122
+ }
123
+ const toolName = base.name;
124
+ if (typeof base.invoke !== "function") {
125
+ throw new Error(`${label}: expected tool "${toolName}" to expose invoke() for ` +
126
+ `actor-subject wrapping; got ${describeUnexpectedTool(tool)}`);
127
+ }
128
+ if (base.schema == null) {
129
+ throw new Error(`${label}: expected tool "${toolName}" to expose a schema for ` +
130
+ "actor-subject wrapping");
131
+ }
132
+ return new DynamicStructuredTool({
133
+ name: toolName,
134
+ description: typeof base.description === "string" ? base.description : "",
135
+ schema: base.schema,
136
+ ...(base.responseFormat !== undefined
137
+ ? { responseFormat: base.responseFormat }
138
+ : {}),
139
+ ...(base.returnDirect !== undefined
140
+ ? { returnDirect: base.returnDirect }
141
+ : {}),
142
+ ...(base.verboseParsingErrors !== undefined
143
+ ? { verboseParsingErrors: base.verboseParsingErrors }
144
+ : {}),
145
+ ...(base.metadata !== undefined ? { metadata: base.metadata } : {}),
146
+ ...(base.extras !== undefined ? { extras: base.extras } : {}),
147
+ ...(base.defaultConfig !== undefined
148
+ ? { defaultConfig: base.defaultConfig }
149
+ : {}),
150
+ func: async (input, runManager, runtime) => {
151
+ const runtimeConfig = runtime;
152
+ const agentId = resolveInvokeAgentId(runtimeConfig, slug);
153
+ try {
154
+ const subjectTools = await toolsForSubject(slug, label, config, agentId);
155
+ const match = subjectTools.find((t) => t &&
156
+ typeof t === "object" &&
157
+ "name" in t &&
158
+ t.name === toolName);
159
+ if (!match) {
160
+ throw new Error(`${label}: tool "${toolName}" not found for agent subject`);
161
+ }
162
+ // Call `func` (not `invoke`) so the outer DynamicStructuredTool still
163
+ // owns responseFormat formatting — nested invoke() would already have
164
+ // unwrapped content_and_artifact into a string/ToolMessage.
165
+ if (typeof match.func === "function") {
166
+ return await match.func(input, runManager, runtimeConfig);
167
+ }
168
+ if (typeof match.invoke === "function") {
169
+ return await match.invoke(input, runtimeConfig);
170
+ }
171
+ throw new Error(`${label}: tool "${toolName}" for agent subject is not invokable`);
172
+ }
173
+ catch (error) {
174
+ const integration = integrationForSlug(slug);
175
+ throw integration ? rewriteFleetToolError(error, integration) : error;
176
+ }
177
+ },
178
+ });
179
+ }
180
+ function describeUnexpectedTool(tool) {
181
+ if (tool == null) {
182
+ return String(tool);
183
+ }
184
+ if (typeof tool !== "object") {
185
+ return typeof tool;
186
+ }
187
+ const ctor = tool.constructor?.name;
188
+ if (ctor && ctor !== "Object") {
189
+ return ctor;
190
+ }
191
+ return "object without a usable LangChain tool shape";
192
+ }
193
+ function resolveInvokeAgentId(runtime, slug) {
194
+ if (isActorSubjectSlugEnabled(slug)) {
195
+ const identity = managedRuntimeOverrides(runtime).identity;
196
+ const userId = identity?.user?.id;
197
+ if (userId) {
198
+ return agentIdFromActor(userId);
199
+ }
200
+ }
201
+ return trimmed(process.env.MDA_TOOLSERVER_AGENT_ID);
202
+ }
203
+ function toolsForSubject(slug, label, config, agentId) {
204
+ const connectorKey = config;
205
+ let byAgent = subjectToolsCache.get(connectorKey);
206
+ if (!byAgent) {
207
+ byAgent = new Map();
208
+ subjectToolsCache.set(connectorKey, byAgent);
209
+ subjectToolsCacheConnectors.add(connectorKey);
210
+ }
211
+ const key = agentId ?? "";
212
+ const cached = byAgent.get(key);
213
+ if (cached) {
214
+ return cached;
215
+ }
216
+ const loading = loadToolsForAgentId(slug, label, config, agentId).catch((error) => {
217
+ byAgent.delete(key);
218
+ throw error;
219
+ });
220
+ byAgent.set(key, loading);
221
+ return loading;
222
+ }
95
223
  /**
96
224
  * Build the integration's gateway URL.
97
225
  *
@@ -100,11 +228,9 @@ async function connectAndLoadTools(slug, label, config) {
100
228
  * makes the base the whole prefix — `https://api.smith.langchain.com`, or
101
229
  * `https://langsmith.acme.com/api` self-hosted — not a host to graft onto.
102
230
  */
103
- export function gatewayUrl(slug, label) {
231
+ export function gatewayUrl(slug, label, agentId) {
104
232
  const base = envApiUrl() ?? DEFAULT_API_URL;
105
233
  const origin = parseApiBase(base);
106
- // A base with no host parses in some shapes (`http:/host`) but is not an API
107
- // to connect to, so it is rejected alongside the ones that fail to parse.
108
234
  if (!origin?.host) {
109
235
  throw new Error(`${label}(...) could not build a tool server URL from "${base}". Set ` +
110
236
  "LANGSMITH_ENDPOINT to your LangSmith API base URL, e.g. " +
@@ -112,9 +238,11 @@ export function gatewayUrl(slug, label) {
112
238
  }
113
239
  const prefix = origin.pathname.replace(/\/+$/, "");
114
240
  const url = new URL(`${prefix}/v1/toolserver/servers/${slug}/mcp`, origin);
115
- const agentId = trimmed(process.env.MDA_TOOLSERVER_AGENT_ID);
116
- if (agentId) {
117
- url.searchParams.set("agent_id", agentId);
241
+ const resolved = agentId === undefined
242
+ ? trimmed(process.env.MDA_TOOLSERVER_AGENT_ID)
243
+ : trimmed(agentId ?? undefined);
244
+ if (resolved) {
245
+ url.searchParams.set("agent_id", resolved);
118
246
  }
119
247
  return url.toString();
120
248
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