agents 0.0.0-e4a2352 → 0.0.0-e777fdd

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 (67) hide show
  1. package/README.md +129 -7
  2. package/dist/_esm-LV5FJ3HK.js +3922 -0
  3. package/dist/_esm-LV5FJ3HK.js.map +1 -0
  4. package/dist/ai-chat-agent.d.ts +9 -8
  5. package/dist/ai-chat-agent.js +151 -59
  6. package/dist/ai-chat-agent.js.map +1 -1
  7. package/dist/ai-chat-v5-migration.d.ts +152 -0
  8. package/dist/ai-chat-v5-migration.js +20 -0
  9. package/dist/ai-chat-v5-migration.js.map +1 -0
  10. package/dist/ai-react.d.ts +65 -70
  11. package/dist/ai-react.js +252 -99
  12. package/dist/ai-react.js.map +1 -1
  13. package/dist/ai-types.d.ts +37 -19
  14. package/dist/ai-types.js +7 -0
  15. package/dist/ccip-CMBYN64O.js +15 -0
  16. package/dist/ccip-CMBYN64O.js.map +1 -0
  17. package/dist/chunk-5Y6BEZDY.js +276 -0
  18. package/dist/chunk-5Y6BEZDY.js.map +1 -0
  19. package/dist/chunk-BER7KXUJ.js +18 -0
  20. package/dist/chunk-BER7KXUJ.js.map +1 -0
  21. package/dist/chunk-JJBFIGUC.js +5202 -0
  22. package/dist/chunk-JJBFIGUC.js.map +1 -0
  23. package/dist/chunk-PR4QN5HX.js +43 -0
  24. package/dist/chunk-PR4QN5HX.js.map +1 -0
  25. package/dist/{chunk-HY7ZLHJB.js → chunk-QEPGNUG6.js} +71 -19
  26. package/dist/chunk-QEPGNUG6.js.map +1 -0
  27. package/dist/{chunk-KUH345EY.js → chunk-QEVM4BVL.js} +5 -5
  28. package/dist/chunk-QEVM4BVL.js.map +1 -0
  29. package/dist/{chunk-JXN5WZFQ.js → chunk-RS5OCNEQ.js} +117 -81
  30. package/dist/chunk-RS5OCNEQ.js.map +1 -0
  31. package/dist/chunk-TYAY6AU6.js +159 -0
  32. package/dist/chunk-TYAY6AU6.js.map +1 -0
  33. package/dist/chunk-UJVEAURM.js +150 -0
  34. package/dist/chunk-UJVEAURM.js.map +1 -0
  35. package/dist/{chunk-PVQZBKN7.js → chunk-XFS5ERG3.js} +24 -3
  36. package/dist/chunk-XFS5ERG3.js.map +1 -0
  37. package/dist/{client-DgyzBU_8.d.ts → client-BohGLma8.d.ts} +461 -21
  38. package/dist/client.js +3 -1
  39. package/dist/index.d.ts +562 -32
  40. package/dist/index.js +8 -4
  41. package/dist/mcp/client.d.ts +1 -1
  42. package/dist/mcp/client.js +2 -1
  43. package/dist/mcp/do-oauth-client-provider.d.ts +9 -0
  44. package/dist/mcp/do-oauth-client-provider.js +2 -1
  45. package/dist/mcp/index.d.ts +49 -73
  46. package/dist/mcp/index.js +906 -721
  47. package/dist/mcp/index.js.map +1 -1
  48. package/dist/mcp/x402.d.ts +39 -0
  49. package/dist/mcp/x402.js +3195 -0
  50. package/dist/mcp/x402.js.map +1 -0
  51. package/dist/observability/index.d.ts +46 -14
  52. package/dist/observability/index.js +6 -4
  53. package/dist/react.d.ts +4 -2
  54. package/dist/react.js +8 -5
  55. package/dist/react.js.map +1 -1
  56. package/dist/schedule.d.ts +79 -5
  57. package/dist/schedule.js +17 -2
  58. package/dist/schedule.js.map +1 -1
  59. package/dist/secp256k1-M22GZP2U.js +2193 -0
  60. package/dist/secp256k1-M22GZP2U.js.map +1 -0
  61. package/package.json +24 -8
  62. package/src/index.ts +164 -94
  63. package/dist/chunk-HY7ZLHJB.js.map +0 -1
  64. package/dist/chunk-JXN5WZFQ.js.map +0 -1
  65. package/dist/chunk-KUH345EY.js.map +0 -1
  66. package/dist/chunk-PVQZBKN7.js.map +0 -1
  67. package/dist/index-BCJclX6q.d.ts +0 -615
package/dist/index.d.ts CHANGED
@@ -1,36 +1,19 @@
1
- import "cloudflare:workers";
2
- import "@modelcontextprotocol/sdk/client/index.js";
3
- import "@modelcontextprotocol/sdk/types.js";
1
+ import { env } from "cloudflare:workers";
2
+ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
3
+ import {
4
+ ServerCapabilities,
5
+ Tool,
6
+ Prompt,
7
+ Resource
8
+ } from "@modelcontextprotocol/sdk/types.js";
9
+ import { Server, Connection, PartyServerOptions } from "partyserver";
4
10
  export { Connection, ConnectionContext, WSMessage } from "partyserver";
5
- import "./client-DgyzBU_8.js";
6
- export {
7
- A as Agent,
8
- a as AgentContext,
9
- p as AgentEmail,
10
- i as AgentNamespace,
11
- j as AgentOptions,
12
- C as CallableMetadata,
13
- E as EmailResolver,
14
- n as EmailRoutingOptions,
15
- q as EmailSendOptions,
16
- f as MCPServer,
17
- e as MCPServerMessage,
18
- M as MCPServersState,
19
- Q as QueueItem,
20
- R as RPCRequest,
21
- c as RPCResponse,
22
- d as Schedule,
23
- S as StateUpdateMessage,
24
- t as StreamingResponse,
25
- l as createAddressBasedEmailResolver,
26
- m as createCatchAllEmailResolver,
27
- k as createHeaderBasedEmailResolver,
28
- s as getAgentByName,
29
- h as getCurrentAgent,
30
- o as routeAgentEmail,
31
- r as routeAgentRequest,
32
- u as unstable_callable
33
- } from "./index-BCJclX6q.js";
11
+ import {
12
+ c as MCPClientManager,
13
+ T as TransportType
14
+ } from "./client-BohGLma8.js";
15
+ import { Observability } from "./observability/index.js";
16
+ import { MessageType } from "./ai-types.js";
34
17
  import "zod";
35
18
  import "@modelcontextprotocol/sdk/shared/protocol.js";
36
19
  import "ai";
@@ -39,3 +22,550 @@ import "@modelcontextprotocol/sdk/client/streamableHttp.js";
39
22
  import "./mcp/do-oauth-client-provider.js";
40
23
  import "@modelcontextprotocol/sdk/client/auth.js";
41
24
  import "@modelcontextprotocol/sdk/shared/auth.js";
25
+
26
+ /**
27
+ * RPC request message from client
28
+ */
29
+ type RPCRequest = {
30
+ type: "rpc";
31
+ id: string;
32
+ method: string;
33
+ args: unknown[];
34
+ };
35
+ /**
36
+ * State update message from client
37
+ */
38
+ type StateUpdateMessage = {
39
+ type: MessageType.CF_AGENT_STATE;
40
+ state: unknown;
41
+ };
42
+ /**
43
+ * RPC response message to client
44
+ */
45
+ type RPCResponse = {
46
+ type: MessageType.RPC;
47
+ id: string;
48
+ } & (
49
+ | {
50
+ success: true;
51
+ result: unknown;
52
+ done?: false;
53
+ }
54
+ | {
55
+ success: true;
56
+ result: unknown;
57
+ done: true;
58
+ }
59
+ | {
60
+ success: false;
61
+ error: string;
62
+ }
63
+ );
64
+ /**
65
+ * Metadata for a callable method
66
+ */
67
+ type CallableMetadata = {
68
+ /** Optional description of what the method does */
69
+ description?: string;
70
+ /** Whether the method supports streaming responses */
71
+ streaming?: boolean;
72
+ };
73
+ /**
74
+ * Decorator that marks a method as callable by clients
75
+ * @param metadata Optional metadata about the callable method
76
+ */
77
+ declare function callable(
78
+ metadata?: CallableMetadata
79
+ ): <This, Args extends unknown[], Return>(
80
+ target: (this: This, ...args: Args) => Return,
81
+ context: ClassMethodDecoratorContext
82
+ ) => (this: This, ...args: Args) => Return;
83
+ /**
84
+ * Decorator that marks a method as callable by clients
85
+ * @deprecated this has been renamed to callable, and unstable_callable will be removed in the next major version
86
+ * @param metadata Optional metadata about the callable method
87
+ */
88
+ declare const unstable_callable: (metadata?: CallableMetadata) => void;
89
+ type QueueItem<T = string> = {
90
+ id: string;
91
+ payload: T;
92
+ callback: keyof Agent<unknown>;
93
+ created_at: number;
94
+ };
95
+ /**
96
+ * Represents a scheduled task within an Agent
97
+ * @template T Type of the payload data
98
+ */
99
+ type Schedule<T = string> = {
100
+ /** Unique identifier for the schedule */
101
+ id: string;
102
+ /** Name of the method to be called */
103
+ callback: string;
104
+ /** Data to be passed to the callback */
105
+ payload: T;
106
+ } & (
107
+ | {
108
+ /** Type of schedule for one-time execution at a specific time */
109
+ type: "scheduled";
110
+ /** Timestamp when the task should execute */
111
+ time: number;
112
+ }
113
+ | {
114
+ /** Type of schedule for delayed execution */
115
+ type: "delayed";
116
+ /** Timestamp when the task should execute */
117
+ time: number;
118
+ /** Number of seconds to delay execution */
119
+ delayInSeconds: number;
120
+ }
121
+ | {
122
+ /** Type of schedule for recurring execution based on cron expression */
123
+ type: "cron";
124
+ /** Timestamp for the next execution */
125
+ time: number;
126
+ /** Cron expression defining the schedule */
127
+ cron: string;
128
+ }
129
+ );
130
+
131
+ /**
132
+ * MCP Server state update message from server -> Client
133
+ */
134
+ type MCPServerMessage = {
135
+ type: MessageType.CF_AGENT_MCP_SERVERS;
136
+ mcp: MCPServersState;
137
+ };
138
+ type MCPServersState = {
139
+ servers: {
140
+ [id: string]: MCPServer;
141
+ };
142
+ tools: Tool[];
143
+ prompts: Prompt[];
144
+ resources: Resource[];
145
+ };
146
+ type MCPServer = {
147
+ name: string;
148
+ server_url: string;
149
+ auth_url: string | null;
150
+ state: "authenticating" | "connecting" | "ready" | "discovering" | "failed";
151
+ instructions: string | null;
152
+ capabilities: ServerCapabilities | null;
153
+ };
154
+ declare function getCurrentAgent<
155
+ T extends Agent<unknown, unknown> = Agent<unknown, unknown>
156
+ >(): {
157
+ agent: T | undefined;
158
+ connection: Connection | undefined;
159
+ request: Request | undefined;
160
+ email: AgentEmail | undefined;
161
+ };
162
+ /**
163
+ * Base class for creating Agent implementations
164
+ * @template Env Environment type containing bindings
165
+ * @template State State type to store within the Agent
166
+ */
167
+ declare class Agent<
168
+ Env = typeof env,
169
+ State = unknown,
170
+ Props extends Record<string, unknown> = Record<string, unknown>
171
+ > extends Server<Env, Props> {
172
+ private _state;
173
+ private _ParentClass;
174
+ readonly mcp: MCPClientManager;
175
+ /**
176
+ * Initial state for the Agent
177
+ * Override to provide default state values
178
+ */
179
+ initialState: State;
180
+ /**
181
+ * Current state of the Agent
182
+ */
183
+ get state(): State;
184
+ /**
185
+ * Agent configuration options
186
+ */
187
+ static options: {
188
+ /** Whether the Agent should hibernate when inactive */
189
+ hibernate: boolean;
190
+ };
191
+ /**
192
+ * The observability implementation to use for the Agent
193
+ */
194
+ observability?: Observability;
195
+ /**
196
+ * Execute SQL queries against the Agent's database
197
+ * @template T Type of the returned rows
198
+ * @param strings SQL query template strings
199
+ * @param values Values to be inserted into the query
200
+ * @returns Array of query results
201
+ */
202
+ sql<T = Record<string, string | number | boolean | null>>(
203
+ strings: TemplateStringsArray,
204
+ ...values: (string | number | boolean | null)[]
205
+ ): T[];
206
+ constructor(ctx: AgentContext, env: Env);
207
+ private _setStateInternal;
208
+ /**
209
+ * Update the Agent's state
210
+ * @param state New state to set
211
+ */
212
+ setState(state: State): void;
213
+ /**
214
+ * Called when the Agent's state is updated
215
+ * @param state Updated state
216
+ * @param source Source of the state update ("server" or a client connection)
217
+ */
218
+ onStateUpdate(state: State | undefined, source: Connection | "server"): void;
219
+ /**
220
+ * Called when the Agent receives an email via routeAgentEmail()
221
+ * Override this method to handle incoming emails
222
+ * @param email Email message to process
223
+ */
224
+ _onEmail(email: AgentEmail): Promise<void>;
225
+ /**
226
+ * Reply to an email
227
+ * @param email The email to reply to
228
+ * @param options Options for the reply
229
+ * @returns void
230
+ */
231
+ replyToEmail(
232
+ email: AgentEmail,
233
+ options: {
234
+ fromName: string;
235
+ subject?: string | undefined;
236
+ body: string;
237
+ contentType?: string;
238
+ headers?: Record<string, string>;
239
+ }
240
+ ): Promise<void>;
241
+ private _tryCatch;
242
+ /**
243
+ * Automatically wrap custom methods with agent context
244
+ * This ensures getCurrentAgent() works in all custom methods without decorators
245
+ */
246
+ private _autoWrapCustomMethods;
247
+ onError(connection: Connection, error: unknown): void | Promise<void>;
248
+ onError(error: unknown): void | Promise<void>;
249
+ /**
250
+ * Render content (not implemented in base class)
251
+ */
252
+ render(): void;
253
+ /**
254
+ * Queue a task to be executed in the future
255
+ * @param payload Payload to pass to the callback
256
+ * @param callback Name of the method to call
257
+ * @returns The ID of the queued task
258
+ */
259
+ queue<T = unknown>(callback: keyof this, payload: T): Promise<string>;
260
+ private _flushingQueue;
261
+ private _flushQueue;
262
+ /**
263
+ * Dequeue a task by ID
264
+ * @param id ID of the task to dequeue
265
+ */
266
+ dequeue(id: string): Promise<void>;
267
+ /**
268
+ * Dequeue all tasks
269
+ */
270
+ dequeueAll(): Promise<void>;
271
+ /**
272
+ * Dequeue all tasks by callback
273
+ * @param callback Name of the callback to dequeue
274
+ */
275
+ dequeueAllByCallback(callback: string): Promise<void>;
276
+ /**
277
+ * Get a queued task by ID
278
+ * @param id ID of the task to get
279
+ * @returns The task or undefined if not found
280
+ */
281
+ getQueue(id: string): Promise<QueueItem<string> | undefined>;
282
+ /**
283
+ * Get all queues by key and value
284
+ * @param key Key to filter by
285
+ * @param value Value to filter by
286
+ * @returns Array of matching QueueItem objects
287
+ */
288
+ getQueues(key: string, value: string): Promise<QueueItem<string>[]>;
289
+ /**
290
+ * Schedule a task to be executed in the future
291
+ * @template T Type of the payload data
292
+ * @param when When to execute the task (Date, seconds delay, or cron expression)
293
+ * @param callback Name of the method to call
294
+ * @param payload Data to pass to the callback
295
+ * @returns Schedule object representing the scheduled task
296
+ */
297
+ schedule<T = string>(
298
+ when: Date | string | number,
299
+ callback: keyof this,
300
+ payload?: T
301
+ ): Promise<Schedule<T>>;
302
+ /**
303
+ * Get a scheduled task by ID
304
+ * @template T Type of the payload data
305
+ * @param id ID of the scheduled task
306
+ * @returns The Schedule object or undefined if not found
307
+ */
308
+ getSchedule<T = string>(id: string): Promise<Schedule<T> | undefined>;
309
+ /**
310
+ * Get scheduled tasks matching the given criteria
311
+ * @template T Type of the payload data
312
+ * @param criteria Criteria to filter schedules
313
+ * @returns Array of matching Schedule objects
314
+ */
315
+ getSchedules<T = string>(criteria?: {
316
+ id?: string;
317
+ type?: "scheduled" | "delayed" | "cron";
318
+ timeRange?: {
319
+ start?: Date;
320
+ end?: Date;
321
+ };
322
+ }): Schedule<T>[];
323
+ /**
324
+ * Cancel a scheduled task
325
+ * @param id ID of the task to cancel
326
+ * @returns true if the task was cancelled, false otherwise
327
+ */
328
+ cancelSchedule(id: string): Promise<boolean>;
329
+ private _scheduleNextAlarm;
330
+ /**
331
+ * Method called when an alarm fires.
332
+ * Executes any scheduled tasks that are due.
333
+ *
334
+ * @remarks
335
+ * To schedule a task, please use the `this.schedule` method instead.
336
+ * See {@link https://developers.cloudflare.com/agents/api-reference/schedule-tasks/}
337
+ */
338
+ readonly alarm: () => Promise<void>;
339
+ /**
340
+ * Destroy the Agent, removing all state and scheduled tasks
341
+ */
342
+ destroy(): Promise<void>;
343
+ /**
344
+ * Get all methods marked as callable on this Agent
345
+ * @returns A map of method names to their metadata
346
+ */
347
+ private _isCallable;
348
+ /**
349
+ * Connect to a new MCP Server
350
+ *
351
+ * @param serverName Name of the MCP server
352
+ * @param url MCP Server SSE URL
353
+ * @param callbackHost Base host for the agent, used for the redirect URI. If not provided, will be derived from the current request.
354
+ * @param agentsPrefix agents routing prefix if not using `agents`
355
+ * @param options MCP client and transport (header) options
356
+ * @returns authUrl
357
+ */
358
+ addMcpServer(
359
+ serverName: string,
360
+ url: string,
361
+ callbackHost?: string,
362
+ agentsPrefix?: string,
363
+ options?: {
364
+ client?: ConstructorParameters<typeof Client>[1];
365
+ transport?: {
366
+ headers: HeadersInit;
367
+ };
368
+ }
369
+ ): Promise<{
370
+ id: string;
371
+ authUrl: string | undefined;
372
+ }>;
373
+ _connectToMcpServerInternal(
374
+ _serverName: string,
375
+ url: string,
376
+ callbackUrl: string,
377
+ options?: {
378
+ client?: ConstructorParameters<typeof Client>[1];
379
+ /**
380
+ * We don't expose the normal set of transport options because:
381
+ * 1) we can't serialize things like the auth provider or a fetch function into the DB for reconnection purposes
382
+ * 2) We probably want these options to be agnostic to the transport type (SSE vs Streamable)
383
+ *
384
+ * This has the limitation that you can't override fetch, but I think headers should handle nearly all cases needed (i.e. non-standard bearer auth).
385
+ */
386
+ transport?: {
387
+ headers?: HeadersInit;
388
+ type?: TransportType;
389
+ };
390
+ },
391
+ reconnect?: {
392
+ id: string;
393
+ oauthClientId?: string;
394
+ }
395
+ ): Promise<{
396
+ id: string;
397
+ authUrl: string | undefined;
398
+ clientId: string | undefined;
399
+ }>;
400
+ removeMcpServer(id: string): Promise<void>;
401
+ getMcpServers(): MCPServersState;
402
+ }
403
+ /**
404
+ * Namespace for creating Agent instances
405
+ * @template Agentic Type of the Agent class
406
+ */
407
+ type AgentNamespace<Agentic extends Agent<unknown>> =
408
+ DurableObjectNamespace<Agentic>;
409
+ /**
410
+ * Agent's durable context
411
+ */
412
+ type AgentContext = DurableObjectState;
413
+ /**
414
+ * Configuration options for Agent routing
415
+ */
416
+ type AgentOptions<Env> = PartyServerOptions<Env> & {
417
+ /**
418
+ * Whether to enable CORS for the Agent
419
+ */
420
+ cors?: boolean | HeadersInit | undefined;
421
+ };
422
+ /**
423
+ * Route a request to the appropriate Agent
424
+ * @param request Request to route
425
+ * @param env Environment containing Agent bindings
426
+ * @param options Routing options
427
+ * @returns Response from the Agent or undefined if no route matched
428
+ */
429
+ declare function routeAgentRequest<Env>(
430
+ request: Request,
431
+ env: Env,
432
+ options?: AgentOptions<Env>
433
+ ): Promise<Response | null>;
434
+ type EmailResolver<Env> = (
435
+ email: ForwardableEmailMessage,
436
+ env: Env
437
+ ) => Promise<{
438
+ agentName: string;
439
+ agentId: string;
440
+ } | null>;
441
+ /**
442
+ * Create a resolver that uses the message-id header to determine the agent to route the email to
443
+ * @returns A function that resolves the agent to route the email to
444
+ */
445
+ declare function createHeaderBasedEmailResolver<Env>(): EmailResolver<Env>;
446
+ /**
447
+ * Create a resolver that uses the email address to determine the agent to route the email to
448
+ * @param defaultAgentName The default agent name to use if the email address does not contain a sub-address
449
+ * @returns A function that resolves the agent to route the email to
450
+ */
451
+ declare function createAddressBasedEmailResolver<Env>(
452
+ defaultAgentName: string
453
+ ): EmailResolver<Env>;
454
+ /**
455
+ * Create a resolver that uses the agentName and agentId to determine the agent to route the email to
456
+ * @param agentName The name of the agent to route the email to
457
+ * @param agentId The id of the agent to route the email to
458
+ * @returns A function that resolves the agent to route the email to
459
+ */
460
+ declare function createCatchAllEmailResolver<Env>(
461
+ agentName: string,
462
+ agentId: string
463
+ ): EmailResolver<Env>;
464
+ type EmailRoutingOptions<Env> = AgentOptions<Env> & {
465
+ resolver: EmailResolver<Env>;
466
+ };
467
+ /**
468
+ * Route an email to the appropriate Agent
469
+ * @param email The email to route
470
+ * @param env The environment containing the Agent bindings
471
+ * @param options The options for routing the email
472
+ * @returns A promise that resolves when the email has been routed
473
+ */
474
+ declare function routeAgentEmail<Env>(
475
+ email: ForwardableEmailMessage,
476
+ env: Env,
477
+ options: EmailRoutingOptions<Env>
478
+ ): Promise<void>;
479
+ type AgentEmail = {
480
+ from: string;
481
+ to: string;
482
+ getRaw: () => Promise<Uint8Array>;
483
+ headers: Headers;
484
+ rawSize: number;
485
+ setReject: (reason: string) => void;
486
+ forward: (rcptTo: string, headers?: Headers) => Promise<void>;
487
+ reply: (options: { from: string; to: string; raw: string }) => Promise<void>;
488
+ };
489
+ type EmailSendOptions = {
490
+ to: string;
491
+ subject: string;
492
+ body: string;
493
+ contentType?: string;
494
+ headers?: Record<string, string>;
495
+ includeRoutingHeaders?: boolean;
496
+ agentName?: string;
497
+ agentId?: string;
498
+ domain?: string;
499
+ };
500
+ /**
501
+ * Get or create an Agent by name
502
+ * @template Env Environment type containing bindings
503
+ * @template T Type of the Agent class
504
+ * @param namespace Agent namespace
505
+ * @param name Name of the Agent instance
506
+ * @param options Options for Agent creation
507
+ * @returns Promise resolving to an Agent instance stub
508
+ */
509
+ declare function getAgentByName<
510
+ Env,
511
+ T extends Agent<Env>,
512
+ Props extends Record<string, unknown> = Record<string, unknown>
513
+ >(
514
+ namespace: AgentNamespace<T>,
515
+ name: string,
516
+ options?: {
517
+ jurisdiction?: DurableObjectJurisdiction;
518
+ locationHint?: DurableObjectLocationHint;
519
+ props?: Props;
520
+ }
521
+ ): Promise<DurableObjectStub<T>>;
522
+ /**
523
+ * A wrapper for streaming responses in callable methods
524
+ */
525
+ declare class StreamingResponse {
526
+ private _connection;
527
+ private _id;
528
+ private _closed;
529
+ constructor(connection: Connection, id: string);
530
+ /**
531
+ * Send a chunk of data to the client
532
+ * @param chunk The data to send
533
+ */
534
+ send(chunk: unknown): void;
535
+ /**
536
+ * End the stream and send the final chunk (if any)
537
+ * @param finalChunk Optional final chunk of data to send
538
+ */
539
+ end(finalChunk?: unknown): void;
540
+ }
541
+
542
+ export {
543
+ Agent,
544
+ type AgentContext,
545
+ type AgentEmail,
546
+ type AgentNamespace,
547
+ type AgentOptions,
548
+ type CallableMetadata,
549
+ type EmailResolver,
550
+ type EmailRoutingOptions,
551
+ type EmailSendOptions,
552
+ type MCPServer,
553
+ type MCPServerMessage,
554
+ type MCPServersState,
555
+ type QueueItem,
556
+ type RPCRequest,
557
+ type RPCResponse,
558
+ type Schedule,
559
+ type StateUpdateMessage,
560
+ StreamingResponse,
561
+ TransportType,
562
+ callable,
563
+ createAddressBasedEmailResolver,
564
+ createCatchAllEmailResolver,
565
+ createHeaderBasedEmailResolver,
566
+ getAgentByName,
567
+ getCurrentAgent,
568
+ routeAgentEmail,
569
+ routeAgentRequest,
570
+ unstable_callable
571
+ };
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  Agent,
3
3
  StreamingResponse,
4
+ callable,
4
5
  createAddressBasedEmailResolver,
5
6
  createCatchAllEmailResolver,
6
7
  createHeaderBasedEmailResolver,
@@ -9,13 +10,16 @@ import {
9
10
  routeAgentEmail,
10
11
  routeAgentRequest,
11
12
  unstable_callable
12
- } from "./chunk-JXN5WZFQ.js";
13
- import "./chunk-HY7ZLHJB.js";
14
- import "./chunk-PVQZBKN7.js";
15
- import "./chunk-KUH345EY.js";
13
+ } from "./chunk-RS5OCNEQ.js";
14
+ import "./chunk-QEPGNUG6.js";
15
+ import "./chunk-XFS5ERG3.js";
16
+ import "./chunk-QEVM4BVL.js";
17
+ import "./chunk-BER7KXUJ.js";
18
+ import "./chunk-PR4QN5HX.js";
16
19
  export {
17
20
  Agent,
18
21
  StreamingResponse,
22
+ callable,
19
23
  createAddressBasedEmailResolver,
20
24
  createCatchAllEmailResolver,
21
25
  createHeaderBasedEmailResolver,
@@ -3,7 +3,7 @@ import '@modelcontextprotocol/sdk/client/index.js';
3
3
  import '@modelcontextprotocol/sdk/shared/protocol.js';
4
4
  import '@modelcontextprotocol/sdk/types.js';
5
5
  import 'ai';
6
- export { M as MCPClientManager, g as getNamespacedData } from '../client-DgyzBU_8.js';
6
+ export { c as MCPClientManager, g as getNamespacedData } from '../client-BohGLma8.js';
7
7
  import '@modelcontextprotocol/sdk/client/sse.js';
8
8
  import '@modelcontextprotocol/sdk/client/streamableHttp.js';
9
9
  import './do-oauth-client-provider.js';
@@ -1,7 +1,8 @@
1
1
  import {
2
2
  MCPClientManager,
3
3
  getNamespacedData
4
- } from "../chunk-HY7ZLHJB.js";
4
+ } from "../chunk-QEPGNUG6.js";
5
+ import "../chunk-PR4QN5HX.js";
5
6
  export {
6
7
  MCPClientManager,
7
8
  getNamespacedData
@@ -5,6 +5,9 @@ interface AgentsOAuthProvider extends OAuthClientProvider {
5
5
  authUrl: string | undefined;
6
6
  clientId: string | undefined;
7
7
  serverId: string | undefined;
8
+ saveOAuthTransport(transportType: string): Promise<void>;
9
+ getOAuthTransport(): Promise<string | undefined>;
10
+ clearOAuthTransport(): Promise<void>;
8
11
  }
9
12
  declare class DurableObjectOAuthClientProvider implements AgentsOAuthProvider {
10
13
  storage: DurableObjectStorage;
@@ -15,6 +18,7 @@ declare class DurableObjectOAuthClientProvider implements AgentsOAuthProvider {
15
18
  private _clientId_;
16
19
  constructor(storage: DurableObjectStorage, clientName: string, baseRedirectUrl: string);
17
20
  get clientMetadata(): OAuthClientMetadata;
21
+ get clientUri(): string;
18
22
  get redirectUrl(): string;
19
23
  get clientId(): string;
20
24
  set clientId(clientId_: string);
@@ -36,6 +40,11 @@ declare class DurableObjectOAuthClientProvider implements AgentsOAuthProvider {
36
40
  codeVerifierKey(clientId: string): string;
37
41
  saveCodeVerifier(verifier: string): Promise<void>;
38
42
  codeVerifier(): Promise<string>;
43
+ /** Transport tracking for OAuth flow */
44
+ oauthTransportKey(): string;
45
+ saveOAuthTransport(transportType: string): Promise<void>;
46
+ getOAuthTransport(): Promise<string | undefined>;
47
+ clearOAuthTransport(): Promise<void>;
39
48
  }
40
49
 
41
50
  export { type AgentsOAuthProvider, DurableObjectOAuthClientProvider };
@@ -1,6 +1,7 @@
1
1
  import {
2
2
  DurableObjectOAuthClientProvider
3
- } from "../chunk-PVQZBKN7.js";
3
+ } from "../chunk-XFS5ERG3.js";
4
+ import "../chunk-PR4QN5HX.js";
4
5
  export {
5
6
  DurableObjectOAuthClientProvider
6
7
  };