agents 0.7.3 → 0.7.5

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 (80) hide show
  1. package/dist/ai-chat-agent.js +3 -4
  2. package/dist/ai-chat-agent.js.map +1 -1
  3. package/dist/ai-chat-v5-migration.js +3 -4
  4. package/dist/ai-chat-v5-migration.js.map +1 -1
  5. package/dist/ai-react.js +3 -4
  6. package/dist/ai-react.js.map +1 -1
  7. package/dist/ai-types.js +1 -2
  8. package/dist/ai-types.js.map +1 -1
  9. package/dist/cli/index.js +2 -4
  10. package/dist/cli/index.js.map +1 -1
  11. package/dist/client-CgXIwdcc.js +1442 -0
  12. package/dist/client-CgXIwdcc.js.map +1 -0
  13. package/dist/client.js +1 -2
  14. package/dist/client.js.map +1 -1
  15. package/dist/codemode/ai.js +2 -2
  16. package/dist/do-oauth-client-provider-C2jurFjW.d.ts +78 -0
  17. package/dist/email-U_MG7UET.d.ts +157 -0
  18. package/dist/email.d.ts +16 -146
  19. package/dist/email.js +2 -2
  20. package/dist/email.js.map +1 -1
  21. package/dist/experimental/forever.d.ts +26 -71
  22. package/dist/experimental/forever.js +1 -2
  23. package/dist/experimental/forever.js.map +1 -1
  24. package/dist/experimental/memory/session/index.js +3 -12
  25. package/dist/experimental/memory/session/index.js.map +1 -1
  26. package/dist/experimental/sub-agent.js +1 -2
  27. package/dist/experimental/sub-agent.js.map +1 -1
  28. package/dist/experimental/workspace.d.ts +273 -0
  29. package/dist/experimental/workspace.js +1263 -0
  30. package/dist/experimental/workspace.js.map +1 -0
  31. package/dist/index-BS_jL8MI.d.ts +492 -0
  32. package/dist/index-p1XLNvwQ.d.ts +2719 -0
  33. package/dist/index.d.ts +45 -1320
  34. package/dist/index.js +40 -6
  35. package/dist/index.js.map +1 -1
  36. package/dist/internal_context-DgcmHqS1.d.ts +37 -0
  37. package/dist/internal_context.d.ts +5 -32
  38. package/dist/internal_context.js +1 -2
  39. package/dist/internal_context.js.map +1 -1
  40. package/dist/mcp/client.d.ts +2 -575
  41. package/dist/mcp/client.js +1 -847
  42. package/dist/mcp/do-oauth-client-provider.d.ts +2 -61
  43. package/dist/mcp/do-oauth-client-provider.js +1 -2
  44. package/dist/mcp/do-oauth-client-provider.js.map +1 -1
  45. package/dist/mcp/index.d.ts +2 -95
  46. package/dist/mcp/index.js +2 -9
  47. package/dist/mcp/index.js.map +1 -1
  48. package/dist/mcp/x402.js +1 -2
  49. package/dist/mcp/x402.js.map +1 -1
  50. package/dist/observability/index.d.ts +2 -93
  51. package/dist/observability/index.js +4 -3
  52. package/dist/observability/index.js.map +1 -1
  53. package/dist/react.d.ts +1 -2
  54. package/dist/react.js +1 -2
  55. package/dist/react.js.map +1 -1
  56. package/dist/retries-DXMQGhG3.d.ts +79 -0
  57. package/dist/retries.d.ts +7 -72
  58. package/dist/retries.js +1 -1
  59. package/dist/retries.js.map +1 -1
  60. package/dist/schedule.js +1 -2
  61. package/dist/schedule.js.map +1 -1
  62. package/dist/serializable.js +1 -1
  63. package/dist/types-BB1plA51.d.ts +15 -0
  64. package/dist/types.d.ts +1 -14
  65. package/dist/types.js +1 -1
  66. package/dist/types.js.map +1 -1
  67. package/dist/utils.js +1 -1
  68. package/dist/workflow-types-CZNXKj_D.d.ts +260 -0
  69. package/dist/workflow-types.d.ts +23 -235
  70. package/dist/workflow-types.js +1 -1
  71. package/dist/workflow-types.js.map +1 -1
  72. package/dist/workflows.d.ts +22 -23
  73. package/dist/workflows.js +5 -6
  74. package/dist/workflows.js.map +1 -1
  75. package/package.json +15 -5
  76. package/dist/agent-eZnMHidZ.d.ts +0 -273
  77. package/dist/client-connection-D3Wcd6Q6.js +0 -603
  78. package/dist/client-connection-D3Wcd6Q6.js.map +0 -1
  79. package/dist/client-storage-yDVwzgfF.d.ts +0 -604
  80. package/dist/mcp/client.js.map +0 -1
@@ -0,0 +1,37 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+ import { Connection } from "partyserver";
3
+
4
+ //#region src/internal_context.d.ts
5
+ type AgentEmail = {
6
+ from: string;
7
+ to: string;
8
+ getRaw: () => Promise<Uint8Array>;
9
+ headers: Headers;
10
+ rawSize: number;
11
+ setReject: (reason: string) => void;
12
+ forward: (rcptTo: string, headers?: Headers) => Promise<EmailSendResult>;
13
+ reply: (options: {
14
+ from: string;
15
+ to: string;
16
+ raw: string;
17
+ }) => Promise<EmailSendResult> /** @internal Indicates email was routed via createSecureReplyEmailResolver */;
18
+ _secureRouted?: boolean;
19
+ };
20
+ type AgentContextStore = {
21
+ agent: unknown;
22
+ connection: Connection | undefined;
23
+ request: Request | undefined;
24
+ email: AgentEmail | undefined;
25
+ };
26
+ /**
27
+ * @internal — This is an internal implementation detail.
28
+ * Importing or relying on this symbol **will** break your code in a future release.
29
+ */
30
+ declare const __DO_NOT_USE_WILL_BREAK__agentContext: AsyncLocalStorage<AgentContextStore>;
31
+ //#endregion
32
+ export {
33
+ AgentEmail as n,
34
+ __DO_NOT_USE_WILL_BREAK__agentContext as r,
35
+ AgentContextStore as t
36
+ };
37
+ //# sourceMappingURL=internal_context-DgcmHqS1.d.ts.map
@@ -1,33 +1,6 @@
1
- import { AsyncLocalStorage } from "node:async_hooks";
2
- import { Connection } from "partyserver";
3
-
4
- //#region src/internal_context.d.ts
5
- type AgentEmail = {
6
- from: string;
7
- to: string;
8
- getRaw: () => Promise<Uint8Array>;
9
- headers: Headers;
10
- rawSize: number;
11
- setReject: (reason: string) => void;
12
- forward: (rcptTo: string, headers?: Headers) => Promise<EmailSendResult>;
13
- reply: (options: {
14
- from: string;
15
- to: string;
16
- raw: string;
17
- }) => Promise<EmailSendResult> /** @internal Indicates email was routed via createSecureReplyEmailResolver */;
18
- _secureRouted?: boolean;
19
- };
20
- type AgentContextStore = {
21
- agent: unknown;
22
- connection: Connection | undefined;
23
- request: Request | undefined;
24
- email: AgentEmail | undefined;
25
- };
26
- /**
27
- * @internal — This is an internal implementation detail.
28
- * Importing or relying on this symbol **will** break your code in a future release.
29
- */
30
- declare const __DO_NOT_USE_WILL_BREAK__agentContext: AsyncLocalStorage<AgentContextStore>;
31
- //#endregion
1
+ import {
2
+ n as AgentEmail,
3
+ r as __DO_NOT_USE_WILL_BREAK__agentContext,
4
+ t as AgentContextStore
5
+ } from "./internal_context-DgcmHqS1.js";
32
6
  export { AgentContextStore, AgentEmail, __DO_NOT_USE_WILL_BREAK__agentContext };
33
- //# sourceMappingURL=internal_context.d.ts.map
@@ -1,12 +1,11 @@
1
1
  import { AsyncLocalStorage } from "node:async_hooks";
2
-
3
2
  //#region src/internal_context.ts
4
3
  /**
5
4
  * @internal — This is an internal implementation detail.
6
5
  * Importing or relying on this symbol **will** break your code in a future release.
7
6
  */
8
7
  const __DO_NOT_USE_WILL_BREAK__agentContext = new AsyncLocalStorage();
9
-
10
8
  //#endregion
11
9
  export { __DO_NOT_USE_WILL_BREAK__agentContext };
10
+
12
11
  //# sourceMappingURL=internal_context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal_context.js","names":[],"sources":["../src/internal_context.ts"],"sourcesContent":["import { AsyncLocalStorage } from \"node:async_hooks\";\nimport type { Connection } from \"partyserver\";\n\nexport type AgentEmail = {\n from: string;\n to: string;\n getRaw: () => Promise<Uint8Array>;\n headers: Headers;\n rawSize: number;\n setReject: (reason: string) => void;\n forward: (rcptTo: string, headers?: Headers) => Promise<EmailSendResult>;\n reply: (options: {\n from: string;\n to: string;\n raw: string;\n }) => Promise<EmailSendResult>;\n /** @internal Indicates email was routed via createSecureReplyEmailResolver */\n _secureRouted?: boolean;\n};\n\nexport type AgentContextStore = {\n // Using unknown to avoid circular dependency with Agent\n agent: unknown;\n connection: Connection | undefined;\n request: Request | undefined;\n email: AgentEmail | undefined;\n};\n\n/**\n * @internal — This is an internal implementation detail.\n * Importing or relying on this symbol **will** break your code in a future release.\n */\nexport const __DO_NOT_USE_WILL_BREAK__agentContext =\n new AsyncLocalStorage<AgentContextStore>();\n"],"mappings":";;;;;;;AAgCA,MAAa,wCACX,IAAI,mBAAsC"}
1
+ {"version":3,"file":"internal_context.js","names":[],"sources":["../src/internal_context.ts"],"sourcesContent":["import { AsyncLocalStorage } from \"node:async_hooks\";\nimport type { Connection } from \"partyserver\";\n\nexport type AgentEmail = {\n from: string;\n to: string;\n getRaw: () => Promise<Uint8Array>;\n headers: Headers;\n rawSize: number;\n setReject: (reason: string) => void;\n forward: (rcptTo: string, headers?: Headers) => Promise<EmailSendResult>;\n reply: (options: {\n from: string;\n to: string;\n raw: string;\n }) => Promise<EmailSendResult>;\n /** @internal Indicates email was routed via createSecureReplyEmailResolver */\n _secureRouted?: boolean;\n};\n\nexport type AgentContextStore = {\n // Using unknown to avoid circular dependency with Agent\n agent: unknown;\n connection: Connection | undefined;\n request: Request | undefined;\n email: AgentEmail | undefined;\n};\n\n/**\n * @internal — This is an internal implementation detail.\n * Importing or relying on this symbol **will** break your code in a future release.\n */\nexport const __DO_NOT_USE_WILL_BREAK__agentContext =\n new AsyncLocalStorage<AgentContextStore>();\n"],"mappings":";;;;;;AAgCA,MAAa,wCACX,IAAI,mBAAsC"}
@@ -1,575 +1,2 @@
1
- import { RetryOptions } from "../retries.js";
2
- import { E as Event, T as Emitter, i as MCPTransportOptions, n as MCPClientConnection, r as MCPConnectionState, t as MCPServerRow, w as TransportType } from "../client-storage-yDVwzgfF.js";
3
- import { n as MCPObservabilityEvent } from "../agent-eZnMHidZ.js";
4
- import { AgentMcpOAuthProvider } from "./do-oauth-client-provider.js";
5
- import { Client } from "@modelcontextprotocol/sdk/client/index.js";
6
- import { CallToolRequest, CallToolResultSchema, CompatibilityCallToolResultSchema, GetPromptRequest, Prompt, ReadResourceRequest, Resource, ResourceTemplate, Tool } from "@modelcontextprotocol/sdk/types.js";
7
- import * as ai from "ai";
8
- import { ToolSet } from "ai";
9
- import { RequestOptions } from "@modelcontextprotocol/sdk/shared/protocol.js";
10
-
11
- //#region src/mcp/client.d.ts
12
- /**
13
- * Options that can be stored in the server_options column
14
- * This is what gets JSON.stringify'd and stored in the database
15
- */
16
- type MCPServerOptions = {
17
- client?: ConstructorParameters<typeof Client>[1];
18
- transport?: {
19
- headers?: HeadersInit;
20
- type?: TransportType;
21
- }; /** Retry options for connection and reconnection attempts */
22
- retry?: RetryOptions;
23
- };
24
- /**
25
- * Result of an OAuth callback request
26
- */
27
- type MCPOAuthCallbackResult = {
28
- serverId: string;
29
- authSuccess: true;
30
- authError?: undefined;
31
- } | {
32
- serverId?: string;
33
- authSuccess: false;
34
- authError: string;
35
- };
36
- /**
37
- * Options for registering an MCP server
38
- */
39
- type RegisterServerOptions = {
40
- url: string;
41
- name: string;
42
- callbackUrl?: string;
43
- client?: ConstructorParameters<typeof Client>[1];
44
- transport?: MCPTransportOptions;
45
- authUrl?: string;
46
- clientId?: string; /** Retry options for connection and reconnection attempts */
47
- retry?: RetryOptions;
48
- };
49
- /**
50
- * Result of attempting to connect to an MCP server.
51
- * Discriminated union ensures error is present only on failure.
52
- */
53
- type MCPConnectionResult = {
54
- state: typeof MCPConnectionState.FAILED;
55
- error: string;
56
- } | {
57
- state: typeof MCPConnectionState.AUTHENTICATING;
58
- authUrl: string;
59
- clientId?: string;
60
- } | {
61
- state: typeof MCPConnectionState.CONNECTED;
62
- };
63
- /**
64
- * Result of discovering server capabilities.
65
- * success indicates whether discovery completed successfully.
66
- * state is the current connection state at time of return.
67
- * error is present when success is false.
68
- */
69
- type MCPDiscoverResult = {
70
- success: boolean;
71
- state: MCPConnectionState;
72
- error?: string;
73
- };
74
- type MCPClientOAuthCallbackConfig = {
75
- successRedirect?: string;
76
- errorRedirect?: string;
77
- customHandler?: (result: MCPClientOAuthResult) => Response;
78
- };
79
- type MCPClientOAuthResult = {
80
- serverId: string;
81
- authSuccess: true;
82
- authError?: undefined;
83
- } | {
84
- serverId?: string;
85
- authSuccess: false; /** May contain untrusted content from external OAuth providers. Escape appropriately for your output context. */
86
- authError: string;
87
- };
88
- type MCPClientManagerOptions = {
89
- storage: DurableObjectStorage;
90
- createAuthProvider?: (callbackUrl: string) => AgentMcpOAuthProvider;
91
- };
92
- /**
93
- * Utility class that aggregates multiple MCP clients into one
94
- */
95
- declare class MCPClientManager {
96
- private _name;
97
- private _version;
98
- mcpConnections: Record<string, MCPClientConnection>;
99
- private _didWarnAboutUnstableGetAITools;
100
- private _oauthCallbackConfig?;
101
- private _connectionDisposables;
102
- private _storage;
103
- private _createAuthProviderFn?;
104
- private _isRestored;
105
- private _pendingConnections;
106
- /** @internal Protected for testing purposes. */
107
- protected readonly _onObservabilityEvent: Emitter<MCPObservabilityEvent>;
108
- readonly onObservabilityEvent: Event<MCPObservabilityEvent>;
109
- private readonly _onServerStateChanged;
110
- /**
111
- * Event that fires whenever any MCP server state changes (registered, connected, removed, etc.)
112
- * This is useful for broadcasting server state to clients.
113
- */
114
- readonly onServerStateChanged: Event<void>;
115
- /**
116
- * @param _name Name of the MCP client
117
- * @param _version Version of the MCP Client
118
- * @param options Storage adapter for persisting MCP server state
119
- */
120
- constructor(_name: string, _version: string, options: MCPClientManagerOptions);
121
- private sql;
122
- private saveServerToStorage;
123
- private removeServerFromStorage;
124
- private getServersFromStorage;
125
- /**
126
- * Get the retry options for a server from stored server_options
127
- */
128
- private getServerRetryOptions;
129
- private clearServerAuthUrl;
130
- private failConnection;
131
- jsonSchema: typeof ai.jsonSchema | undefined;
132
- /**
133
- * Create an auth provider for a server
134
- * @internal
135
- */
136
- private createAuthProvider;
137
- /**
138
- * Get saved RPC servers from storage (servers with rpc:// URLs).
139
- * These are restored separately by the Agent class since they need env bindings.
140
- */
141
- getRpcServersFromStorage(): MCPServerRow[];
142
- /**
143
- * Save an RPC server to storage for hibernation recovery.
144
- * The bindingName is stored in server_options so the Agent can look up
145
- * the namespace from env during restore.
146
- */
147
- saveRpcServerToStorage(id: string, name: string, normalizedName: string, bindingName: string, props?: Record<string, unknown>): void;
148
- /**
149
- * Restore MCP server connections from storage
150
- * This method is called on Agent initialization to restore previously connected servers.
151
- * RPC servers (rpc:// URLs) are skipped here -- they are restored by the Agent class
152
- * which has access to env bindings.
153
- *
154
- * @param clientName Name to use for OAuth client (typically the agent instance name)
155
- */
156
- restoreConnectionsFromStorage(clientName: string): Promise<void>;
157
- /**
158
- * Track a pending connection promise for a server.
159
- * The promise is removed from the map when it settles.
160
- */
161
- private _trackConnection;
162
- /**
163
- * Wait for all in-flight connection and discovery operations to settle.
164
- * This is useful when you need MCP tools to be available before proceeding,
165
- * e.g. before calling getAITools() after the agent wakes from hibernation.
166
- *
167
- * Returns once every pending connection has either connected and discovered,
168
- * failed, or timed out. Never rejects.
169
- *
170
- * @param options.timeout - Maximum time in milliseconds to wait.
171
- * `0` returns immediately without waiting.
172
- * `undefined` (default) waits indefinitely.
173
- */
174
- waitForConnections(options?: {
175
- timeout?: number;
176
- }): Promise<void>;
177
- /**
178
- * Internal method to restore a single server connection and discovery
179
- */
180
- private _restoreServer;
181
- /**
182
- * Connect to and register an MCP server
183
- *
184
- * @deprecated This method is maintained for backward compatibility.
185
- * For new code, use registerServer() and connectToServer() separately.
186
- *
187
- * @param url Server URL
188
- * @param options Connection options
189
- * @returns Object with server ID, auth URL (if OAuth), and client ID (if OAuth)
190
- */
191
- connect(url: string, options?: {
192
- reconnect?: {
193
- id: string;
194
- oauthClientId?: string;
195
- oauthCode?: string;
196
- };
197
- transport?: MCPTransportOptions;
198
- client?: ConstructorParameters<typeof Client>[1];
199
- }): Promise<{
200
- id: string;
201
- authUrl?: string;
202
- clientId?: string;
203
- }>;
204
- /**
205
- * Create an in-memory connection object and set up observability
206
- * Does NOT save to storage - use registerServer() for that
207
- * @returns The connection object (existing or newly created)
208
- */
209
- private createConnection;
210
- /**
211
- * Register an MCP server connection without connecting
212
- * Creates the connection object, sets up observability, and saves to storage
213
- *
214
- * @param id Server ID
215
- * @param options Registration options including URL, name, callback URL, and connection config
216
- * @returns Server ID
217
- */
218
- registerServer(id: string, options: RegisterServerOptions): Promise<string>;
219
- /**
220
- * Connect to an already registered MCP server and initialize the connection.
221
- *
222
- * For OAuth servers, returns `{ state: "authenticating", authUrl, clientId? }`.
223
- * The user must complete the OAuth flow via the authUrl, which triggers a
224
- * callback handled by `handleCallbackRequest()`.
225
- *
226
- * For non-OAuth servers, establishes the transport connection and returns
227
- * `{ state: "connected" }`. Call `discoverIfConnected()` afterwards to
228
- * discover capabilities and transition to "ready" state.
229
- *
230
- * @param id Server ID (must be registered first via registerServer())
231
- * @returns Connection result with current state and OAuth info (if applicable)
232
- */
233
- connectToServer(id: string): Promise<MCPConnectionResult>;
234
- private extractServerIdFromState;
235
- isCallbackRequest(req: Request): boolean;
236
- private validateCallbackRequest;
237
- handleCallbackRequest(req: Request): Promise<MCPOAuthCallbackResult>;
238
- /**
239
- * Discover server capabilities if connection is in CONNECTED or READY state.
240
- * Transitions to DISCOVERING then READY (or CONNECTED on error).
241
- * Can be called to refresh server capabilities (e.g., from a UI refresh button).
242
- *
243
- * If called while a previous discovery is in-flight for the same server,
244
- * the previous discovery will be aborted.
245
- *
246
- * @param serverId The server ID to discover
247
- * @param options Optional configuration
248
- * @param options.timeoutMs Timeout in milliseconds (default: 30000)
249
- * @returns Result with current state and optional error, or undefined if connection not found
250
- */
251
- discoverIfConnected(serverId: string, options?: {
252
- timeoutMs?: number;
253
- }): Promise<MCPDiscoverResult | undefined>;
254
- /**
255
- * Establish connection in the background after OAuth completion.
256
- * This method connects to the server and discovers its capabilities.
257
- * The connection is automatically tracked so that `waitForConnections()`
258
- * will include it.
259
- * @param serverId The server ID to establish connection for
260
- */
261
- establishConnection(serverId: string): Promise<void>;
262
- private _doEstablishConnection;
263
- /**
264
- * Configure OAuth callback handling
265
- * @param config OAuth callback configuration
266
- */
267
- configureOAuthCallback(config: MCPClientOAuthCallbackConfig): void;
268
- /**
269
- * Get the current OAuth callback configuration
270
- * @returns The current OAuth callback configuration
271
- */
272
- getOAuthCallbackConfig(): MCPClientOAuthCallbackConfig | undefined;
273
- /**
274
- * @returns namespaced list of tools
275
- */
276
- listTools(): NamespacedData["tools"];
277
- /**
278
- * Lazy-loads the jsonSchema function from the AI SDK.
279
- *
280
- * This defers importing the "ai" package until it's actually needed, which helps reduce
281
- * initial bundle size and startup time. The jsonSchema function is required for converting
282
- * MCP tools into AI SDK tool definitions via getAITools().
283
- *
284
- * @internal This method is for internal use only. It's automatically called before operations
285
- * that need jsonSchema (like getAITools() or OAuth flows). External consumers should not need
286
- * to call this directly.
287
- */
288
- ensureJsonSchema(): Promise<void>;
289
- /**
290
- * @returns a set of tools that you can use with the AI SDK
291
- */
292
- getAITools(): ToolSet;
293
- /**
294
- * @deprecated this has been renamed to getAITools(), and unstable_getAITools will be removed in the next major version
295
- * @returns a set of tools that you can use with the AI SDK
296
- */
297
- unstable_getAITools(): ToolSet;
298
- /**
299
- * Closes all active in-memory connections to MCP servers.
300
- *
301
- * Note: This only closes the transport connections - it does NOT remove
302
- * servers from storage. Servers will still be listed and their callback
303
- * URLs will still match incoming OAuth requests.
304
- *
305
- * Use removeServer() instead if you want to fully clean up a server
306
- * (closes connection AND removes from storage).
307
- */
308
- closeAllConnections(): Promise<void>;
309
- /**
310
- * Closes a connection to an MCP server
311
- * @param id The id of the connection to close
312
- */
313
- closeConnection(id: string): Promise<void>;
314
- /**
315
- * Remove an MCP server - closes connection if active and removes from storage.
316
- */
317
- removeServer(serverId: string): Promise<void>;
318
- /**
319
- * List all MCP servers from storage
320
- */
321
- listServers(): MCPServerRow[];
322
- /**
323
- * Dispose the manager and all resources.
324
- */
325
- dispose(): Promise<void>;
326
- /**
327
- * @returns namespaced list of prompts
328
- */
329
- listPrompts(): NamespacedData["prompts"];
330
- /**
331
- * @returns namespaced list of tools
332
- */
333
- listResources(): NamespacedData["resources"];
334
- /**
335
- * @returns namespaced list of resource templates
336
- */
337
- listResourceTemplates(): NamespacedData["resourceTemplates"];
338
- /**
339
- * Namespaced version of callTool
340
- */
341
- callTool(params: CallToolRequest["params"] & {
342
- serverId: string;
343
- }, resultSchema?: typeof CallToolResultSchema | typeof CompatibilityCallToolResultSchema, options?: RequestOptions): Promise<{
344
- [x: string]: unknown;
345
- content: ({
346
- type: "text";
347
- text: string;
348
- annotations?: {
349
- audience?: ("user" | "assistant")[] | undefined;
350
- priority?: number | undefined;
351
- lastModified?: string | undefined;
352
- } | undefined;
353
- _meta?: Record<string, unknown> | undefined;
354
- } | {
355
- type: "image";
356
- data: string;
357
- mimeType: string;
358
- annotations?: {
359
- audience?: ("user" | "assistant")[] | undefined;
360
- priority?: number | undefined;
361
- lastModified?: string | undefined;
362
- } | undefined;
363
- _meta?: Record<string, unknown> | undefined;
364
- } | {
365
- type: "audio";
366
- data: string;
367
- mimeType: string;
368
- annotations?: {
369
- audience?: ("user" | "assistant")[] | undefined;
370
- priority?: number | undefined;
371
- lastModified?: string | undefined;
372
- } | undefined;
373
- _meta
374
- /**
375
- * We need to delay loading ai sdk, because putting it in module scope is
376
- * causing issues with startup time.
377
- * The only place it's used is in getAITools, which only matters after
378
- * .connect() is called on at least one server.
379
- * So it's safe to delay loading it until .connect() is called.
380
- */?: Record<string, unknown> | undefined;
381
- } | {
382
- type: "resource";
383
- resource: {
384
- uri: string;
385
- text: string;
386
- mimeType?: string | undefined;
387
- _meta?: Record<string, unknown> | undefined;
388
- } | {
389
- uri: string;
390
- blob: string;
391
- mimeType?: string | undefined;
392
- _meta?: Record<string, unknown> | undefined;
393
- };
394
- annotations?: {
395
- audience?: ("user" | "assistant")[] | undefined;
396
- priority?: number | undefined;
397
- lastModified?: string | undefined;
398
- } | undefined;
399
- _meta?: Record<string, unknown> | undefined;
400
- } | {
401
- uri: string;
402
- name: string;
403
- type: "resource_link";
404
- description?: string | undefined;
405
- mimeType?: string | undefined;
406
- annotations?: {
407
- audience?: ("user" | "assistant")[] | undefined;
408
- priority?: number | undefined;
409
- lastModified?: string | undefined;
410
- } | undefined;
411
- _meta?: {
412
- [x: string]: unknown;
413
- } | undefined;
414
- icons?: {
415
- src: string;
416
- mimeType?: string | undefined;
417
- sizes?: string[] | undefined;
418
- theme?: "light" | "dark" | undefined;
419
- }[] | undefined;
420
- title?: string | undefined;
421
- })[];
422
- _meta?: {
423
- [x: string]: unknown;
424
- progressToken?: string | number | undefined;
425
- "io.modelcontextprotocol/related-task"?: {
426
- taskId: string;
427
- } | undefined;
428
- } | undefined;
429
- structuredContent?: Record<string, unknown> | undefined;
430
- isError?: boolean | undefined;
431
- } | {
432
- [x: string]: unknown;
433
- toolResult: unknown;
434
- _meta?: {
435
- [x: string]: unknown;
436
- progressToken?: string | number | undefined;
437
- "io.modelcontextprotocol/related-task"?: {
438
- taskId: string;
439
- } | undefined;
440
- } | undefined;
441
- }>;
442
- /**
443
- * Namespaced version of readResource
444
- */
445
- readResource(params: ReadResourceRequest["params"] & {
446
- serverId: string;
447
- }, options: RequestOptions): Promise<{
448
- [x: string]: unknown;
449
- contents: ({
450
- uri: string;
451
- text: string;
452
- mimeType?: string | undefined;
453
- _meta?: Record<string, unknown> | undefined;
454
- } | {
455
- uri: string;
456
- blob: string;
457
- mimeType?: string | undefined;
458
- _meta?: Record<string, unknown> | undefined;
459
- })[];
460
- _meta?: {
461
- [x: string]: unknown;
462
- progressToken?: string | number | undefined;
463
- "io.modelcontextprotocol/related-task"?: {
464
- taskId: string;
465
- } | undefined;
466
- } | undefined;
467
- }>;
468
- /**
469
- * Namespaced version of getPrompt
470
- */
471
- getPrompt(params: GetPromptRequest["params"] & {
472
- serverId: string;
473
- }, options: RequestOptions): Promise<{
474
- [x: string]: unknown;
475
- messages: {
476
- role: "user" | "assistant";
477
- content: {
478
- type: "text";
479
- text: string;
480
- annotations?: {
481
- audience?: ("user" | "assistant")[] | undefined;
482
- priority?: number | undefined;
483
- lastModified?: string | undefined;
484
- } | undefined;
485
- _meta?: Record<string, unknown> | undefined;
486
- } | {
487
- type: "image";
488
- data: string;
489
- mimeType: string;
490
- annotations?: {
491
- audience?: ("user" | "assistant")[] | undefined;
492
- priority?: number | undefined;
493
- lastModified?: string | undefined;
494
- } | undefined;
495
- _meta?: Record<string, unknown> | undefined;
496
- } | {
497
- type: "audio";
498
- data: string;
499
- mimeType: string;
500
- annotations?: {
501
- audience?: ("user" | "assistant")[] | undefined;
502
- priority?: number | undefined;
503
- lastModified?: string | undefined;
504
- } | undefined;
505
- _meta?: Record<string, unknown> | undefined;
506
- } | {
507
- type: "resource";
508
- resource: {
509
- uri: string;
510
- text: string;
511
- mimeType?: string | undefined;
512
- _meta?: Record<string, unknown> | undefined;
513
- } | {
514
- uri: string;
515
- blob: string;
516
- mimeType?: string | undefined;
517
- _meta?: Record<string, unknown> | undefined;
518
- };
519
- annotations?: {
520
- audience?: ("user" | "assistant")[] | undefined;
521
- priority?: number | undefined;
522
- lastModified?: string | undefined;
523
- } | undefined;
524
- _meta?: Record<string, unknown> | undefined;
525
- } | {
526
- uri: string;
527
- name: string;
528
- type: "resource_link";
529
- description?: string | undefined;
530
- mimeType?: string | undefined;
531
- annotations?: {
532
- audience?: ("user" | "assistant")[] | undefined;
533
- priority?: number | undefined;
534
- lastModified?: string | undefined;
535
- } | undefined;
536
- _meta?: {
537
- [x: string]: unknown;
538
- } | undefined;
539
- icons?: {
540
- src: string;
541
- mimeType?: string | undefined;
542
- sizes?: string[] | undefined;
543
- theme?: "light" | "dark" | undefined;
544
- }[] | undefined;
545
- title?: string | undefined;
546
- };
547
- }[];
548
- _meta?: {
549
- [x: string]: unknown;
550
- progressToken?: string | number | undefined;
551
- "io.modelcontextprotocol/related-task"?: {
552
- taskId: string;
553
- } | undefined;
554
- } | undefined;
555
- description?: string | undefined;
556
- }>;
557
- }
558
- type NamespacedData = {
559
- tools: (Tool & {
560
- serverId: string;
561
- })[];
562
- prompts: (Prompt & {
563
- serverId: string;
564
- })[];
565
- resources: (Resource & {
566
- serverId: string;
567
- })[];
568
- resourceTemplates: (ResourceTemplate & {
569
- serverId: string;
570
- })[];
571
- };
572
- declare function getNamespacedData<T extends keyof NamespacedData>(mcpClients: Record<string, MCPClientConnection>, type: T): NamespacedData[T];
573
- //#endregion
574
- export { MCPClientManager, MCPClientManagerOptions, MCPClientOAuthCallbackConfig, MCPClientOAuthResult, MCPConnectionResult, MCPDiscoverResult, MCPOAuthCallbackResult, MCPServerOptions, RegisterServerOptions, getNamespacedData };
575
- //# sourceMappingURL=client.d.ts.map
1
+ import { A as MCPClientManager, F as MCPDiscoverResult, I as MCPOAuthCallbackResult, L as MCPServerOptions, M as MCPClientOAuthCallbackConfig, N as MCPClientOAuthResult, P as MCPConnectionResult, R as RegisterServerOptions, j as MCPClientManagerOptions, z as getNamespacedData } from "../index-p1XLNvwQ.js";
2
+ export { MCPClientManager, MCPClientManagerOptions, MCPClientOAuthCallbackConfig, MCPClientOAuthResult, MCPConnectionResult, MCPDiscoverResult, MCPOAuthCallbackResult, MCPServerOptions, RegisterServerOptions, getNamespacedData };