agents 0.0.0-b25bc37 → 0.0.0-b342dcf

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,22 +1,21 @@
1
1
  import {
2
2
  Agent,
3
3
  StreamingResponse,
4
- WorkflowEntrypoint,
5
4
  getAgentByName,
5
+ getCurrentAgent,
6
6
  routeAgentEmail,
7
7
  routeAgentRequest,
8
- unstable_callable,
9
- unstable_context
10
- } from "./chunk-YMUU7QHV.js";
8
+ unstable_callable
9
+ } from "./chunk-UAKVEVG5.js";
10
+ import "./chunk-WNICV3OI.js";
11
11
  import "./chunk-HMLY7DHA.js";
12
12
  export {
13
13
  Agent,
14
14
  StreamingResponse,
15
- WorkflowEntrypoint,
16
15
  getAgentByName,
16
+ getCurrentAgent,
17
17
  routeAgentEmail,
18
18
  routeAgentRequest,
19
- unstable_callable,
20
- unstable_context
19
+ unstable_callable
21
20
  };
22
21
  //# sourceMappingURL=index.js.map
@@ -1,14 +1,22 @@
1
1
  import * as zod from 'zod';
2
- import { Tool, Prompt, Resource, ResourceTemplate, ServerCapabilities, ClientCapabilities, CallToolRequest, CallToolResultSchema, CompatibilityCallToolResultSchema, ReadResourceRequest, GetPromptRequest } from '@modelcontextprotocol/sdk/types.js';
2
+ import { ClientCapabilities, Tool, Prompt, Resource, ResourceTemplate, ServerCapabilities, CallToolRequest, CallToolResultSchema, CompatibilityCallToolResultSchema, ReadResourceRequest, GetPromptRequest } from '@modelcontextprotocol/sdk/types.js';
3
3
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
4
4
  import { SSEClientTransportOptions } from '@modelcontextprotocol/sdk/client/sse.js';
5
+ import { AgentsOAuthProvider } from './do-oauth-client-provider.js';
5
6
  import { RequestOptions } from '@modelcontextprotocol/sdk/shared/protocol.js';
6
- import { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js';
7
+ import { ToolSet } from 'ai';
8
+ import '@modelcontextprotocol/sdk/client/auth.js';
9
+ import '@modelcontextprotocol/sdk/shared/auth.js';
7
10
 
8
11
  declare class MCPClientConnection {
9
12
  url: URL;
10
- private info;
11
- private options;
13
+ options: {
14
+ transport: SSEClientTransportOptions & {
15
+ authProvider?: AgentsOAuthProvider;
16
+ };
17
+ client: ConstructorParameters<typeof Client>[1];
18
+ capabilities: ClientCapabilities;
19
+ };
12
20
  client: Client;
13
21
  connectionState: "authenticating" | "connecting" | "ready" | "discovering" | "failed";
14
22
  instructions?: string;
@@ -18,7 +26,9 @@ declare class MCPClientConnection {
18
26
  resourceTemplates: ResourceTemplate[];
19
27
  serverCapabilities: ServerCapabilities | undefined;
20
28
  constructor(url: URL, info: ConstructorParameters<typeof Client>[0], options?: {
21
- transport: SSEClientTransportOptions;
29
+ transport: SSEClientTransportOptions & {
30
+ authProvider?: AgentsOAuthProvider;
31
+ };
22
32
  client: ConstructorParameters<typeof Client>[1];
23
33
  capabilities: ClientCapabilities;
24
34
  });
@@ -50,10 +60,10 @@ declare class MCPClientConnection {
50
60
  }[]>;
51
61
  fetchResources(): Promise<{
52
62
  [x: string]: unknown;
53
- name: string;
54
63
  uri: string;
55
- description?: string | undefined;
64
+ name: string;
56
65
  mimeType?: string | undefined;
66
+ description?: string | undefined;
57
67
  }[]>;
58
68
  fetchPrompts(): Promise<{
59
69
  [x: string]: unknown;
@@ -70,33 +80,25 @@ declare class MCPClientConnection {
70
80
  [x: string]: unknown;
71
81
  name: string;
72
82
  uriTemplate: string;
73
- description?: string | undefined;
74
83
  mimeType?: string | undefined;
84
+ description?: string | undefined;
75
85
  }[]>;
76
86
  }
77
87
 
78
- interface AgentsOAuthProvider extends OAuthClientProvider {
79
- authUrl: string | undefined;
80
- clientId: string | undefined;
81
- }
82
-
83
88
  /**
84
89
  * Utility class that aggregates multiple MCP clients into one
85
90
  */
86
91
  declare class MCPClientManager {
87
92
  private name;
88
93
  private version;
89
- private auth?;
90
94
  mcpConnections: Record<string, MCPClientConnection>;
95
+ private callbackUrls;
91
96
  /**
92
97
  * @param name Name of the MCP client
93
98
  * @param version Version of the MCP Client
94
99
  * @param auth Auth paramters if being used to create a DurableObjectOAuthClientProvider
95
100
  */
96
- constructor(name: string, version: string, auth?: {
97
- baseCallbackUri: string;
98
- storage: DurableObjectStorage;
99
- } | undefined);
101
+ constructor(name: string, version: string);
100
102
  /**
101
103
  * Connect to and register an MCP server
102
104
  *
@@ -104,14 +106,14 @@ declare class MCPClientManager {
104
106
  * @param clientConfig Client config
105
107
  * @param capabilities Client capabilities (i.e. if the client supports roots/sampling)
106
108
  */
107
- connect(url: string, opts?: {
109
+ connect(url: string, options?: {
108
110
  reconnect?: {
109
111
  id: string;
110
112
  oauthClientId?: string;
111
113
  oauthCode?: string;
112
114
  };
113
115
  transport?: SSEClientTransportOptions & {
114
- authProvider: AgentsOAuthProvider;
116
+ authProvider?: AgentsOAuthProvider;
115
117
  };
116
118
  client?: ConstructorParameters<typeof Client>[1];
117
119
  capabilities?: ClientCapabilities;
@@ -127,6 +129,10 @@ declare class MCPClientManager {
127
129
  * @returns namespaced list of tools
128
130
  */
129
131
  listTools(): NamespacedData["tools"];
132
+ /**
133
+ * @returns a set of tools that you can use with the AI SDK
134
+ */
135
+ unstable_getAITools(): ToolSet;
130
136
  /**
131
137
  * @returns namespaced list of prompts
132
138
  */
@@ -144,9 +150,9 @@ declare class MCPClientManager {
144
150
  */
145
151
  callTool(params: CallToolRequest["params"] & {
146
152
  serverId: string;
147
- }, resultSchema: typeof CallToolResultSchema | typeof CompatibilityCallToolResultSchema, options: RequestOptions): Promise<zod.objectOutputType<zod.objectUtil.extendShape<{
153
+ }, resultSchema?: typeof CallToolResultSchema | typeof CompatibilityCallToolResultSchema, options?: RequestOptions): Promise<zod.objectOutputType<{
148
154
  _meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
149
- }, {
155
+ } & {
150
156
  content: zod.ZodArray<zod.ZodUnion<[zod.ZodObject<{
151
157
  type: zod.ZodLiteral<"text">;
152
158
  text: zod.ZodString;
@@ -168,6 +174,18 @@ declare class MCPClientManager {
168
174
  type: zod.ZodLiteral<"image">;
169
175
  data: zod.ZodString;
170
176
  mimeType: zod.ZodString;
177
+ }, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
178
+ type: zod.ZodLiteral<"audio">;
179
+ data: zod.ZodString;
180
+ mimeType: zod.ZodString;
181
+ }, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
182
+ type: zod.ZodLiteral<"audio">;
183
+ data: zod.ZodString;
184
+ mimeType: zod.ZodString;
185
+ }, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
186
+ type: zod.ZodLiteral<"audio">;
187
+ data: zod.ZodString;
188
+ mimeType: zod.ZodString;
171
189
  }, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
172
190
  type: zod.ZodLiteral<"resource">;
173
191
  resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
@@ -269,19 +287,19 @@ declare class MCPClientManager {
269
287
  }>, zod.ZodTypeAny, "passthrough">>]>;
270
288
  }, zod.ZodTypeAny, "passthrough">>]>, "many">;
271
289
  isError: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
272
- }>, zod.ZodTypeAny, "passthrough"> | zod.objectOutputType<zod.objectUtil.extendShape<{
290
+ }, zod.ZodTypeAny, "passthrough"> | zod.objectOutputType<{
273
291
  _meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
274
- }, {
292
+ } & {
275
293
  toolResult: zod.ZodUnknown;
276
- }>, zod.ZodTypeAny, "passthrough">>;
294
+ }, zod.ZodTypeAny, "passthrough">>;
277
295
  /**
278
296
  * Namespaced version of readResource
279
297
  */
280
298
  readResource(params: ReadResourceRequest["params"] & {
281
299
  serverId: string;
282
- }, options: RequestOptions): Promise<zod.objectOutputType<zod.objectUtil.extendShape<{
300
+ }, options: RequestOptions): Promise<zod.objectOutputType<{
283
301
  _meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
284
- }, {
302
+ } & {
285
303
  contents: zod.ZodArray<zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
286
304
  uri: zod.ZodString;
287
305
  mimeType: zod.ZodOptional<zod.ZodString>;
@@ -313,15 +331,15 @@ declare class MCPClientManager {
313
331
  }, {
314
332
  blob: zod.ZodString;
315
333
  }>, zod.ZodTypeAny, "passthrough">>]>, "many">;
316
- }>, zod.ZodTypeAny, "passthrough">>;
334
+ }, zod.ZodTypeAny, "passthrough">>;
317
335
  /**
318
336
  * Namespaced version of getPrompt
319
337
  */
320
338
  getPrompt(params: GetPromptRequest["params"] & {
321
339
  serverId: string;
322
- }, options: RequestOptions): Promise<zod.objectOutputType<zod.objectUtil.extendShape<{
340
+ }, options: RequestOptions): Promise<zod.objectOutputType<{
323
341
  _meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
324
- }, {
342
+ } & {
325
343
  description: zod.ZodOptional<zod.ZodString>;
326
344
  messages: zod.ZodArray<zod.ZodObject<{
327
345
  role: zod.ZodEnum<["user", "assistant"]>;
@@ -346,6 +364,18 @@ declare class MCPClientManager {
346
364
  type: zod.ZodLiteral<"image">;
347
365
  data: zod.ZodString;
348
366
  mimeType: zod.ZodString;
367
+ }, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
368
+ type: zod.ZodLiteral<"audio">;
369
+ data: zod.ZodString;
370
+ mimeType: zod.ZodString;
371
+ }, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
372
+ type: zod.ZodLiteral<"audio">;
373
+ data: zod.ZodString;
374
+ mimeType: zod.ZodString;
375
+ }, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
376
+ type: zod.ZodLiteral<"audio">;
377
+ data: zod.ZodString;
378
+ mimeType: zod.ZodString;
349
379
  }, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
350
380
  type: zod.ZodLiteral<"resource">;
351
381
  resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
@@ -469,6 +499,18 @@ declare class MCPClientManager {
469
499
  type: zod.ZodLiteral<"image">;
470
500
  data: zod.ZodString;
471
501
  mimeType: zod.ZodString;
502
+ }, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
503
+ type: zod.ZodLiteral<"audio">;
504
+ data: zod.ZodString;
505
+ mimeType: zod.ZodString;
506
+ }, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
507
+ type: zod.ZodLiteral<"audio">;
508
+ data: zod.ZodString;
509
+ mimeType: zod.ZodString;
510
+ }, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
511
+ type: zod.ZodLiteral<"audio">;
512
+ data: zod.ZodString;
513
+ mimeType: zod.ZodString;
472
514
  }, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
473
515
  type: zod.ZodLiteral<"resource">;
474
516
  resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
@@ -592,6 +634,18 @@ declare class MCPClientManager {
592
634
  type: zod.ZodLiteral<"image">;
593
635
  data: zod.ZodString;
594
636
  mimeType: zod.ZodString;
637
+ }, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
638
+ type: zod.ZodLiteral<"audio">;
639
+ data: zod.ZodString;
640
+ mimeType: zod.ZodString;
641
+ }, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
642
+ type: zod.ZodLiteral<"audio">;
643
+ data: zod.ZodString;
644
+ mimeType: zod.ZodString;
645
+ }, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
646
+ type: zod.ZodLiteral<"audio">;
647
+ data: zod.ZodString;
648
+ mimeType: zod.ZodString;
595
649
  }, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
596
650
  type: zod.ZodLiteral<"resource">;
597
651
  resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
@@ -693,7 +747,7 @@ declare class MCPClientManager {
693
747
  }>, zod.ZodTypeAny, "passthrough">>]>;
694
748
  }, zod.ZodTypeAny, "passthrough">>]>;
695
749
  }, zod.ZodTypeAny, "passthrough">>, "many">;
696
- }>, zod.ZodTypeAny, "passthrough">>;
750
+ }, zod.ZodTypeAny, "passthrough">>;
697
751
  }
698
752
  type NamespacedData = {
699
753
  tools: (Tool & {