agents 0.0.0-956c772 → 0.0.0-96a8138

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-HD4VEHBA.js";
10
+ import "./chunk-Q5ZBHY4Z.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,19 @@ 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;
136
+ /**
137
+ * Closes all connections to MCP servers
138
+ */
139
+ closeAllConnections(): Promise<void[]>;
140
+ /**
141
+ * Closes a connection to an MCP server
142
+ * @param id The id of the connection to close
143
+ */
144
+ closeConnection(id: string): Promise<void>;
130
145
  /**
131
146
  * @returns namespaced list of prompts
132
147
  */
@@ -144,9 +159,9 @@ declare class MCPClientManager {
144
159
  */
145
160
  callTool(params: CallToolRequest["params"] & {
146
161
  serverId: string;
147
- }, resultSchema: typeof CallToolResultSchema | typeof CompatibilityCallToolResultSchema, options: RequestOptions): Promise<zod.objectOutputType<zod.objectUtil.extendShape<{
162
+ }, resultSchema?: typeof CallToolResultSchema | typeof CompatibilityCallToolResultSchema, options?: RequestOptions): Promise<zod.objectOutputType<{
148
163
  _meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
149
- }, {
164
+ } & {
150
165
  content: zod.ZodArray<zod.ZodUnion<[zod.ZodObject<{
151
166
  type: zod.ZodLiteral<"text">;
152
167
  text: zod.ZodString;
@@ -168,6 +183,18 @@ declare class MCPClientManager {
168
183
  type: zod.ZodLiteral<"image">;
169
184
  data: zod.ZodString;
170
185
  mimeType: zod.ZodString;
186
+ }, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
187
+ type: zod.ZodLiteral<"audio">;
188
+ data: zod.ZodString;
189
+ mimeType: zod.ZodString;
190
+ }, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
191
+ type: zod.ZodLiteral<"audio">;
192
+ data: zod.ZodString;
193
+ mimeType: zod.ZodString;
194
+ }, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
195
+ type: zod.ZodLiteral<"audio">;
196
+ data: zod.ZodString;
197
+ mimeType: zod.ZodString;
171
198
  }, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
172
199
  type: zod.ZodLiteral<"resource">;
173
200
  resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
@@ -269,19 +296,19 @@ declare class MCPClientManager {
269
296
  }>, zod.ZodTypeAny, "passthrough">>]>;
270
297
  }, zod.ZodTypeAny, "passthrough">>]>, "many">;
271
298
  isError: zod.ZodOptional<zod.ZodDefault<zod.ZodBoolean>>;
272
- }>, zod.ZodTypeAny, "passthrough"> | zod.objectOutputType<zod.objectUtil.extendShape<{
299
+ }, zod.ZodTypeAny, "passthrough"> | zod.objectOutputType<{
273
300
  _meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
274
- }, {
301
+ } & {
275
302
  toolResult: zod.ZodUnknown;
276
- }>, zod.ZodTypeAny, "passthrough">>;
303
+ }, zod.ZodTypeAny, "passthrough">>;
277
304
  /**
278
305
  * Namespaced version of readResource
279
306
  */
280
307
  readResource(params: ReadResourceRequest["params"] & {
281
308
  serverId: string;
282
- }, options: RequestOptions): Promise<zod.objectOutputType<zod.objectUtil.extendShape<{
309
+ }, options: RequestOptions): Promise<zod.objectOutputType<{
283
310
  _meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
284
- }, {
311
+ } & {
285
312
  contents: zod.ZodArray<zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
286
313
  uri: zod.ZodString;
287
314
  mimeType: zod.ZodOptional<zod.ZodString>;
@@ -313,15 +340,15 @@ declare class MCPClientManager {
313
340
  }, {
314
341
  blob: zod.ZodString;
315
342
  }>, zod.ZodTypeAny, "passthrough">>]>, "many">;
316
- }>, zod.ZodTypeAny, "passthrough">>;
343
+ }, zod.ZodTypeAny, "passthrough">>;
317
344
  /**
318
345
  * Namespaced version of getPrompt
319
346
  */
320
347
  getPrompt(params: GetPromptRequest["params"] & {
321
348
  serverId: string;
322
- }, options: RequestOptions): Promise<zod.objectOutputType<zod.objectUtil.extendShape<{
349
+ }, options: RequestOptions): Promise<zod.objectOutputType<{
323
350
  _meta: zod.ZodOptional<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>;
324
- }, {
351
+ } & {
325
352
  description: zod.ZodOptional<zod.ZodString>;
326
353
  messages: zod.ZodArray<zod.ZodObject<{
327
354
  role: zod.ZodEnum<["user", "assistant"]>;
@@ -346,6 +373,18 @@ declare class MCPClientManager {
346
373
  type: zod.ZodLiteral<"image">;
347
374
  data: zod.ZodString;
348
375
  mimeType: zod.ZodString;
376
+ }, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
377
+ type: zod.ZodLiteral<"audio">;
378
+ data: zod.ZodString;
379
+ mimeType: zod.ZodString;
380
+ }, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
381
+ type: zod.ZodLiteral<"audio">;
382
+ data: zod.ZodString;
383
+ mimeType: zod.ZodString;
384
+ }, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
385
+ type: zod.ZodLiteral<"audio">;
386
+ data: zod.ZodString;
387
+ mimeType: zod.ZodString;
349
388
  }, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
350
389
  type: zod.ZodLiteral<"resource">;
351
390
  resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
@@ -469,6 +508,18 @@ declare class MCPClientManager {
469
508
  type: zod.ZodLiteral<"image">;
470
509
  data: zod.ZodString;
471
510
  mimeType: zod.ZodString;
511
+ }, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
512
+ type: zod.ZodLiteral<"audio">;
513
+ data: zod.ZodString;
514
+ mimeType: zod.ZodString;
515
+ }, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
516
+ type: zod.ZodLiteral<"audio">;
517
+ data: zod.ZodString;
518
+ mimeType: zod.ZodString;
519
+ }, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
520
+ type: zod.ZodLiteral<"audio">;
521
+ data: zod.ZodString;
522
+ mimeType: zod.ZodString;
472
523
  }, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
473
524
  type: zod.ZodLiteral<"resource">;
474
525
  resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
@@ -592,6 +643,18 @@ declare class MCPClientManager {
592
643
  type: zod.ZodLiteral<"image">;
593
644
  data: zod.ZodString;
594
645
  mimeType: zod.ZodString;
646
+ }, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
647
+ type: zod.ZodLiteral<"audio">;
648
+ data: zod.ZodString;
649
+ mimeType: zod.ZodString;
650
+ }, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{
651
+ type: zod.ZodLiteral<"audio">;
652
+ data: zod.ZodString;
653
+ mimeType: zod.ZodString;
654
+ }, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{
655
+ type: zod.ZodLiteral<"audio">;
656
+ data: zod.ZodString;
657
+ mimeType: zod.ZodString;
595
658
  }, zod.ZodTypeAny, "passthrough">>, zod.ZodObject<{
596
659
  type: zod.ZodLiteral<"resource">;
597
660
  resource: zod.ZodUnion<[zod.ZodObject<zod.objectUtil.extendShape<{
@@ -693,7 +756,7 @@ declare class MCPClientManager {
693
756
  }>, zod.ZodTypeAny, "passthrough">>]>;
694
757
  }, zod.ZodTypeAny, "passthrough">>]>;
695
758
  }, zod.ZodTypeAny, "passthrough">>, "many">;
696
- }>, zod.ZodTypeAny, "passthrough">>;
759
+ }, zod.ZodTypeAny, "passthrough">>;
697
760
  }
698
761
  type NamespacedData = {
699
762
  tools: (Tool & {