agents 0.0.0-ac74811 → 0.0.0-aed8e18

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 (76) hide show
  1. package/README.md +255 -27
  2. package/dist/ai-chat-agent.d.ts +20 -18
  3. package/dist/ai-chat-agent.js +532 -260
  4. package/dist/ai-chat-agent.js.map +1 -1
  5. package/dist/ai-chat-v5-migration-DBHGW4Hv.js +155 -0
  6. package/dist/ai-chat-v5-migration-DBHGW4Hv.js.map +1 -0
  7. package/dist/ai-chat-v5-migration.d.ts +155 -0
  8. package/dist/ai-chat-v5-migration.js +3 -0
  9. package/dist/ai-react.d.ts +73 -85
  10. package/dist/ai-react.js +261 -199
  11. package/dist/ai-react.js.map +1 -1
  12. package/dist/ai-types-B3aQaFv3.js +20 -0
  13. package/dist/ai-types-B3aQaFv3.js.map +1 -0
  14. package/dist/ai-types-D5YoPrBZ.d.ts +95 -0
  15. package/dist/ai-types.d.ts +6 -74
  16. package/dist/ai-types.js +3 -1
  17. package/dist/client-9Ld2_lnt.js +786 -0
  18. package/dist/client-9Ld2_lnt.js.map +1 -0
  19. package/dist/client-BfiZ3HQd.js +117 -0
  20. package/dist/client-BfiZ3HQd.js.map +1 -0
  21. package/dist/client-CbWe9FBd.d.ts +104 -0
  22. package/dist/client-CtM-Lpn3.d.ts +5314 -0
  23. package/dist/client.d.ts +12 -93
  24. package/dist/client.js +4 -11
  25. package/dist/codemode/ai.d.ts +27 -0
  26. package/dist/codemode/ai.js +151 -0
  27. package/dist/codemode/ai.js.map +1 -0
  28. package/dist/do-oauth-client-provider-CswoD5Lu.js +93 -0
  29. package/dist/do-oauth-client-provider-CswoD5Lu.js.map +1 -0
  30. package/dist/do-oauth-client-provider-DGc5pP0l.d.ts +55 -0
  31. package/dist/{index-CITGJflw.d.ts → index-DgMq4s2H.d.ts} +226 -152
  32. package/dist/index-DhJCaDWd.d.ts +58 -0
  33. package/dist/index.d.ts +69 -30
  34. package/dist/index.js +7 -22
  35. package/dist/mcp/client.d.ts +4 -1055
  36. package/dist/mcp/client.js +3 -9
  37. package/dist/mcp/do-oauth-client-provider.d.ts +2 -41
  38. package/dist/mcp/do-oauth-client-provider.js +3 -7
  39. package/dist/mcp/index.d.ts +146 -81
  40. package/dist/mcp/index.js +1327 -770
  41. package/dist/mcp/index.js.map +1 -1
  42. package/dist/mcp/x402.d.ts +34 -0
  43. package/dist/mcp/x402.js +194 -0
  44. package/dist/mcp/x402.js.map +1 -0
  45. package/dist/mcp-Dw5vDrY8.d.ts +61 -0
  46. package/dist/observability/index.d.ts +3 -12
  47. package/dist/observability/index.js +7 -10
  48. package/dist/react-Cr4RjXOP.d.ts +115 -0
  49. package/dist/react.d.ts +10 -119
  50. package/dist/react.js +183 -110
  51. package/dist/react.js.map +1 -1
  52. package/dist/schedule.d.ts +91 -14
  53. package/dist/schedule.js +46 -21
  54. package/dist/schedule.js.map +1 -1
  55. package/dist/serializable-CymX8ovI.d.ts +39 -0
  56. package/dist/serializable.d.ts +7 -32
  57. package/dist/serializable.js +1 -1
  58. package/dist/src-Dz0H9hSU.js +1200 -0
  59. package/dist/src-Dz0H9hSU.js.map +1 -0
  60. package/package.json +49 -14
  61. package/dist/ai-types.js.map +0 -1
  62. package/dist/chunk-767EASBA.js +0 -106
  63. package/dist/chunk-767EASBA.js.map +0 -1
  64. package/dist/chunk-E3LCYPCB.js +0 -469
  65. package/dist/chunk-E3LCYPCB.js.map +0 -1
  66. package/dist/chunk-JFRK72K3.js +0 -910
  67. package/dist/chunk-JFRK72K3.js.map +0 -1
  68. package/dist/chunk-NKZZ66QY.js +0 -116
  69. package/dist/chunk-NKZZ66QY.js.map +0 -1
  70. package/dist/client.js.map +0 -1
  71. package/dist/index.js.map +0 -1
  72. package/dist/mcp/client.js.map +0 -1
  73. package/dist/mcp/do-oauth-client-provider.js.map +0 -1
  74. package/dist/observability/index.js.map +0 -1
  75. package/dist/serializable.js.map +0 -1
  76. package/src/index.ts +0 -1365
@@ -1,87 +1,28 @@
1
+ import {
2
+ a as MCPConnectionState,
3
+ t as MCPClientManager,
4
+ u as TransportType
5
+ } from "./client-CtM-Lpn3.js";
6
+ import { t as Observability } from "./index-DhJCaDWd.js";
7
+ import { n as MessageType } from "./ai-types-D5YoPrBZ.js";
8
+ import {
9
+ Connection,
10
+ Connection as Connection$1,
11
+ ConnectionContext,
12
+ PartyServerOptions,
13
+ Server,
14
+ WSMessage
15
+ } from "partyserver";
1
16
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
2
17
  import {
3
- ServerCapabilities,
4
- Tool,
5
18
  Prompt,
6
19
  Resource,
20
+ ServerCapabilities,
21
+ Tool
7
22
  } from "@modelcontextprotocol/sdk/types.js";
8
- import { Server, Connection, PartyServerOptions } from "partyserver";
9
- import { MCPClientManager } from "./mcp/client.js";
10
- import { Message } from "ai";
23
+ import { env } from "cloudflare:workers";
11
24
 
12
- type BaseEvent<
13
- T extends string,
14
- Payload extends Record<string, unknown> = {},
15
- > = {
16
- type: T;
17
- /**
18
- * The unique identifier for the event
19
- */
20
- id: string;
21
- /**
22
- * The message to display in the logs for this event, should the implementation choose to display
23
- * a human-readable message.
24
- */
25
- displayMessage: string;
26
- /**
27
- * The payload of the event
28
- */
29
- payload: Payload;
30
- /**
31
- * The timestamp of the event in milliseconds since epoch
32
- */
33
- timestamp: number;
34
- };
35
- /**
36
- * The type of events that can be emitted by an Agent
37
- */
38
- type ObservabilityEvent =
39
- | BaseEvent<
40
- "state:update",
41
- {
42
- state: unknown;
43
- previousState: unknown;
44
- }
45
- >
46
- | BaseEvent<
47
- "rpc",
48
- {
49
- method: string;
50
- args: unknown[];
51
- streaming?: boolean;
52
- success: boolean;
53
- }
54
- >
55
- | BaseEvent<
56
- "message:request" | "message:response",
57
- {
58
- message: Message[];
59
- }
60
- >
61
- | BaseEvent<"message:clear">
62
- | BaseEvent<
63
- "schedule:create" | "schedule:execute" | "schedule:cancel",
64
- Schedule<unknown>
65
- >
66
- | BaseEvent<"destroy">
67
- | BaseEvent<
68
- "connect",
69
- {
70
- connectionId: string;
71
- }
72
- >;
73
- interface Observability {
74
- /**
75
- * Emit an event for the Agent's observability implementation to handle.
76
- * @param event - The event to emit
77
- * @param ctx - The execution context of the invocation
78
- */
79
- emit(event: ObservabilityEvent, ctx: DurableObjectState): void;
80
- }
81
- /**
82
- * A generic observability implementation that logs events to the console.
83
- */
84
- declare const genericObservability: Observability;
25
+ //#region src/index.d.ts
85
26
 
86
27
  /**
87
28
  * RPC request message from client
@@ -96,14 +37,14 @@ type RPCRequest = {
96
37
  * State update message from client
97
38
  */
98
39
  type StateUpdateMessage = {
99
- type: "cf_agent_state";
40
+ type: MessageType.CF_AGENT_STATE;
100
41
  state: unknown;
101
42
  };
102
43
  /**
103
44
  * RPC response message to client
104
45
  */
105
46
  type RPCResponse = {
106
- type: "rpc";
47
+ type: MessageType.RPC;
107
48
  id: string;
108
49
  } & (
109
50
  | {
@@ -134,23 +75,35 @@ type CallableMetadata = {
134
75
  * Decorator that marks a method as callable by clients
135
76
  * @param metadata Optional metadata about the callable method
136
77
  */
137
- declare function unstable_callable(
78
+ declare function callable(
138
79
  metadata?: CallableMetadata
139
80
  ): <This, Args extends unknown[], Return>(
140
81
  target: (this: This, ...args: Args) => Return,
141
82
  context: ClassMethodDecoratorContext
142
83
  ) => (this: This, ...args: Args) => Return;
84
+ /**
85
+ * Decorator that marks a method as callable by clients
86
+ * @deprecated this has been renamed to callable, and unstable_callable will be removed in the next major version
87
+ * @param metadata Optional metadata about the callable method
88
+ */
89
+ declare const unstable_callable: (metadata?: CallableMetadata) => void;
90
+ type QueueItem<T$1 = string> = {
91
+ id: string;
92
+ payload: T$1;
93
+ callback: keyof Agent<unknown>;
94
+ created_at: number;
95
+ };
143
96
  /**
144
97
  * Represents a scheduled task within an Agent
145
98
  * @template T Type of the payload data
146
99
  */
147
- type Schedule<T = string> = {
100
+ type Schedule<T$1 = string> = {
148
101
  /** Unique identifier for the schedule */
149
102
  id: string;
150
103
  /** Name of the method to be called */
151
104
  callback: string;
152
105
  /** Data to be passed to the callback */
153
- payload: T;
106
+ payload: T$1;
154
107
  } & (
155
108
  | {
156
109
  /** Type of schedule for one-time execution at a specific time */
@@ -179,7 +132,7 @@ type Schedule<T = string> = {
179
132
  * MCP Server state update message from server -> Client
180
133
  */
181
134
  type MCPServerMessage = {
182
- type: "cf_agent_mcp_servers";
135
+ type: MessageType.CF_AGENT_MCP_SERVERS;
183
136
  mcp: MCPServersState;
184
137
  };
185
138
  type MCPServersState = {
@@ -194,26 +147,33 @@ type MCPServer = {
194
147
  name: string;
195
148
  server_url: string;
196
149
  auth_url: string | null;
197
- state: "authenticating" | "connecting" | "ready" | "discovering" | "failed";
150
+ state: MCPConnectionState;
198
151
  instructions: string | null;
199
152
  capabilities: ServerCapabilities | null;
200
153
  };
201
154
  declare function getCurrentAgent<
202
- T extends Agent<unknown, unknown> = Agent<unknown, unknown>,
155
+ T$1 extends Agent<unknown, unknown> = Agent<unknown, unknown>
203
156
  >(): {
204
- agent: T | undefined;
157
+ agent: T$1 | undefined;
205
158
  connection: Connection | undefined;
206
- request: Request<unknown, CfProperties<unknown>> | undefined;
159
+ request: Request | undefined;
160
+ email: AgentEmail | undefined;
207
161
  };
208
162
  /**
209
163
  * Base class for creating Agent implementations
210
164
  * @template Env Environment type containing bindings
211
165
  * @template State State type to store within the Agent
212
166
  */
213
- declare class Agent<Env, State = unknown> extends Server<Env> {
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> {
214
172
  private _state;
173
+ private _disposables;
174
+ private _mcpStateRestored;
215
175
  private _ParentClass;
216
- mcp: MCPClientManager;
176
+ readonly mcp: MCPClientManager;
217
177
  /**
218
178
  * Initial state for the Agent
219
179
  * Override to provide default state values
@@ -259,17 +219,75 @@ declare class Agent<Env, State = unknown> extends Server<Env> {
259
219
  */
260
220
  onStateUpdate(state: State | undefined, source: Connection | "server"): void;
261
221
  /**
262
- * Called when the Agent receives an email
222
+ * Called when the Agent receives an email via routeAgentEmail()
223
+ * Override this method to handle incoming emails
263
224
  * @param email Email message to process
264
225
  */
265
- onEmail(email: ForwardableEmailMessage): Promise<void>;
226
+ _onEmail(email: AgentEmail): Promise<void>;
227
+ /**
228
+ * Reply to an email
229
+ * @param email The email to reply to
230
+ * @param options Options for the reply
231
+ * @returns void
232
+ */
233
+ replyToEmail(
234
+ email: AgentEmail,
235
+ options: {
236
+ fromName: string;
237
+ subject?: string | undefined;
238
+ body: string;
239
+ contentType?: string;
240
+ headers?: Record<string, string>;
241
+ }
242
+ ): Promise<void>;
266
243
  private _tryCatch;
244
+ /**
245
+ * Automatically wrap custom methods with agent context
246
+ * This ensures getCurrentAgent() works in all custom methods without decorators
247
+ */
248
+ private _autoWrapCustomMethods;
267
249
  onError(connection: Connection, error: unknown): void | Promise<void>;
268
250
  onError(error: unknown): void | Promise<void>;
269
251
  /**
270
252
  * Render content (not implemented in base class)
271
253
  */
272
254
  render(): void;
255
+ /**
256
+ * Queue a task to be executed in the future
257
+ * @param payload Payload to pass to the callback
258
+ * @param callback Name of the method to call
259
+ * @returns The ID of the queued task
260
+ */
261
+ queue<T = unknown>(callback: keyof this, payload: T): Promise<string>;
262
+ private _flushingQueue;
263
+ private _flushQueue;
264
+ /**
265
+ * Dequeue a task by ID
266
+ * @param id ID of the task to dequeue
267
+ */
268
+ dequeue(id: string): Promise<void>;
269
+ /**
270
+ * Dequeue all tasks
271
+ */
272
+ dequeueAll(): Promise<void>;
273
+ /**
274
+ * Dequeue all tasks by callback
275
+ * @param callback Name of the callback to dequeue
276
+ */
277
+ dequeueAllByCallback(callback: string): Promise<void>;
278
+ /**
279
+ * Get a queued task by ID
280
+ * @param id ID of the task to get
281
+ * @returns The task or undefined if not found
282
+ */
283
+ getQueue(id: string): Promise<QueueItem<string> | undefined>;
284
+ /**
285
+ * Get all queues by key and value
286
+ * @param key Key to filter by
287
+ * @param value Value to filter by
288
+ * @returns Array of matching QueueItem objects
289
+ */
290
+ getQueues(key: string, value: string): Promise<QueueItem<string>[]>;
273
291
  /**
274
292
  * Schedule a task to be executed in the future
275
293
  * @template T Type of the payload data
@@ -329,58 +347,44 @@ declare class Agent<Env, State = unknown> extends Server<Env> {
329
347
  * @returns A map of method names to their metadata
330
348
  */
331
349
  private _isCallable;
350
+ private _ensureMcpStateRestored;
332
351
  /**
333
352
  * Connect to a new MCP Server
334
353
  *
354
+ * @param serverName Name of the MCP server
335
355
  * @param url MCP Server SSE URL
336
- * @param callbackHost Base host for the agent, used for the redirect URI.
356
+ * @param callbackHost Base host for the agent, used for the redirect URI. If not provided, will be derived from the current request.
337
357
  * @param agentsPrefix agents routing prefix if not using `agents`
338
- * @param options MCP client and transport (header) options
358
+ * @param options MCP client and transport options
339
359
  * @returns authUrl
340
360
  */
341
361
  addMcpServer(
342
362
  serverName: string,
343
363
  url: string,
344
- callbackHost: string,
364
+ callbackHost?: string,
345
365
  agentsPrefix?: string,
346
366
  options?: {
347
367
  client?: ConstructorParameters<typeof Client>[1];
348
- transport?: {
349
- headers: HeadersInit;
350
- };
351
- }
352
- ): Promise<{
353
- id: string;
354
- authUrl: string | undefined;
355
- }>;
356
- _connectToMcpServerInternal(
357
- _serverName: string,
358
- url: string,
359
- callbackUrl: string,
360
- options?: {
361
- client?: ConstructorParameters<typeof Client>[1];
362
- /**
363
- * We don't expose the normal set of transport options because:
364
- * 1) we can't serialize things like the auth provider or a fetch function into the DB for reconnection purposes
365
- * 2) We probably want these options to be agnostic to the transport type (SSE vs Streamable)
366
- *
367
- * 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).
368
- */
369
368
  transport?: {
370
369
  headers?: HeadersInit;
370
+ type?: TransportType;
371
371
  };
372
- },
373
- reconnect?: {
374
- id: string;
375
- oauthClientId?: string;
376
372
  }
377
373
  ): Promise<{
378
374
  id: string;
379
375
  authUrl: string | undefined;
380
- clientId: string | undefined;
381
376
  }>;
377
+ private _connectToMcpServerInternal;
382
378
  removeMcpServer(id: string): Promise<void>;
383
379
  getMcpServers(): MCPServersState;
380
+ private broadcastMcpServers;
381
+ /**
382
+ * Handle OAuth callback response using MCPClientManager configuration
383
+ * @param result OAuth callback result
384
+ * @param request The original request (needed for base URL)
385
+ * @returns Response for the OAuth callback
386
+ */
387
+ private handleOAuthCallbackResponse;
384
388
  }
385
389
  /**
386
390
  * Namespace for creating Agent instances
@@ -413,17 +417,72 @@ declare function routeAgentRequest<Env>(
413
417
  env: Env,
414
418
  options?: AgentOptions<Env>
415
419
  ): Promise<Response | null>;
420
+ type EmailResolver<Env> = (
421
+ email: ForwardableEmailMessage,
422
+ env: Env
423
+ ) => Promise<{
424
+ agentName: string;
425
+ agentId: string;
426
+ } | null>;
427
+ /**
428
+ * Create a resolver that uses the message-id header to determine the agent to route the email to
429
+ * @returns A function that resolves the agent to route the email to
430
+ */
431
+ declare function createHeaderBasedEmailResolver<Env>(): EmailResolver<Env>;
432
+ /**
433
+ * Create a resolver that uses the email address to determine the agent to route the email to
434
+ * @param defaultAgentName The default agent name to use if the email address does not contain a sub-address
435
+ * @returns A function that resolves the agent to route the email to
436
+ */
437
+ declare function createAddressBasedEmailResolver<Env>(
438
+ defaultAgentName: string
439
+ ): EmailResolver<Env>;
440
+ /**
441
+ * Create a resolver that uses the agentName and agentId to determine the agent to route the email to
442
+ * @param agentName The name of the agent to route the email to
443
+ * @param agentId The id of the agent to route the email to
444
+ * @returns A function that resolves the agent to route the email to
445
+ */
446
+ declare function createCatchAllEmailResolver<Env>(
447
+ agentName: string,
448
+ agentId: string
449
+ ): EmailResolver<Env>;
450
+ type EmailRoutingOptions<Env> = AgentOptions<Env> & {
451
+ resolver: EmailResolver<Env>;
452
+ };
416
453
  /**
417
454
  * Route an email to the appropriate Agent
418
- * @param email Email message to route
419
- * @param env Environment containing Agent bindings
420
- * @param options Routing options
455
+ * @param email The email to route
456
+ * @param env The environment containing the Agent bindings
457
+ * @param options The options for routing the email
458
+ * @returns A promise that resolves when the email has been routed
421
459
  */
422
460
  declare function routeAgentEmail<Env>(
423
- _email: ForwardableEmailMessage,
424
- _env: Env,
425
- _options?: AgentOptions<Env>
461
+ email: ForwardableEmailMessage,
462
+ env: Env,
463
+ options: EmailRoutingOptions<Env>
426
464
  ): Promise<void>;
465
+ type AgentEmail = {
466
+ from: string;
467
+ to: string;
468
+ getRaw: () => Promise<Uint8Array>;
469
+ headers: Headers;
470
+ rawSize: number;
471
+ setReject: (reason: string) => void;
472
+ forward: (rcptTo: string, headers?: Headers) => Promise<void>;
473
+ reply: (options: { from: string; to: string; raw: string }) => Promise<void>;
474
+ };
475
+ type EmailSendOptions = {
476
+ to: string;
477
+ subject: string;
478
+ body: string;
479
+ contentType?: string;
480
+ headers?: Record<string, string>;
481
+ includeRoutingHeaders?: boolean;
482
+ agentName?: string;
483
+ agentId?: string;
484
+ domain?: string;
485
+ };
427
486
  /**
428
487
  * Get or create an Agent by name
429
488
  * @template Env Environment type containing bindings
@@ -433,14 +492,19 @@ declare function routeAgentEmail<Env>(
433
492
  * @param options Options for Agent creation
434
493
  * @returns Promise resolving to an Agent instance stub
435
494
  */
436
- declare function getAgentByName<Env, T extends Agent<Env>>(
437
- namespace: AgentNamespace<T>,
495
+ declare function getAgentByName<
496
+ Env,
497
+ T$1 extends Agent<Env>,
498
+ Props extends Record<string, unknown> = Record<string, unknown>
499
+ >(
500
+ namespace: AgentNamespace<T$1>,
438
501
  name: string,
439
502
  options?: {
440
503
  jurisdiction?: DurableObjectJurisdiction;
441
504
  locationHint?: DurableObjectLocationHint;
505
+ props?: Props;
442
506
  }
443
- ): Promise<DurableObjectStub<T>>;
507
+ ): Promise<DurableObjectStub<T$1>>;
444
508
  /**
445
509
  * A wrapper for streaming responses in callable methods
446
510
  */
@@ -460,27 +524,37 @@ declare class StreamingResponse {
460
524
  */
461
525
  end(finalChunk?: unknown): void;
462
526
  }
463
-
527
+ //#endregion
464
528
  export {
465
- Agent as A,
466
- type CallableMetadata as C,
467
- type MCPServersState as M,
468
- type ObservabilityEvent as O,
469
- type RPCRequest as R,
470
- type StateUpdateMessage as S,
471
- type AgentContext as a,
472
- type Observability as b,
473
- type RPCResponse as c,
474
- type Schedule as d,
475
- type MCPServerMessage as e,
476
- type MCPServer as f,
477
- genericObservability as g,
478
- getCurrentAgent as h,
479
- type AgentNamespace as i,
480
- type AgentOptions as j,
481
- routeAgentEmail as k,
482
- getAgentByName as l,
483
- StreamingResponse as m,
484
- routeAgentRequest as r,
485
- unstable_callable as u,
529
+ unstable_callable as A,
530
+ createAddressBasedEmailResolver as C,
531
+ getCurrentAgent as D,
532
+ getAgentByName as E,
533
+ routeAgentEmail as O,
534
+ callable as S,
535
+ createHeaderBasedEmailResolver as T,
536
+ RPCResponse as _,
537
+ AgentOptions as a,
538
+ StreamingResponse as b,
539
+ ConnectionContext as c,
540
+ EmailSendOptions as d,
541
+ MCPServer as f,
542
+ RPCRequest as g,
543
+ QueueItem as h,
544
+ AgentNamespace as i,
545
+ routeAgentRequest as k,
546
+ EmailResolver as l,
547
+ MCPServersState as m,
548
+ AgentContext as n,
549
+ CallableMetadata as o,
550
+ MCPServerMessage as p,
551
+ AgentEmail as r,
552
+ Connection$1 as s,
553
+ Agent as t,
554
+ EmailRoutingOptions as u,
555
+ Schedule as v,
556
+ createCatchAllEmailResolver as w,
557
+ WSMessage as x,
558
+ StateUpdateMessage as y
486
559
  };
560
+ //# sourceMappingURL=index-DgMq4s2H.d.ts.map
@@ -0,0 +1,58 @@
1
+ import { n as BaseEvent, t as MCPObservabilityEvent } from "./mcp-Dw5vDrY8.js";
2
+
3
+ //#region src/observability/agent.d.ts
4
+
5
+ /**
6
+ * Agent-specific observability events
7
+ * These track the lifecycle and operations of an Agent
8
+ */
9
+ type AgentObservabilityEvent =
10
+ | BaseEvent<"state:update", {}>
11
+ | BaseEvent<
12
+ "rpc",
13
+ {
14
+ method: string;
15
+ streaming?: boolean;
16
+ }
17
+ >
18
+ | BaseEvent<"message:request" | "message:response", {}>
19
+ | BaseEvent<"message:clear">
20
+ | BaseEvent<
21
+ "schedule:create" | "schedule:execute" | "schedule:cancel",
22
+ {
23
+ callback: string;
24
+ id: string;
25
+ }
26
+ >
27
+ | BaseEvent<"destroy">
28
+ | BaseEvent<
29
+ "connect",
30
+ {
31
+ connectionId: string;
32
+ }
33
+ >;
34
+ //#endregion
35
+ //#region src/observability/index.d.ts
36
+ /**
37
+ * Union of all observability event types from different domains
38
+ */
39
+ type ObservabilityEvent = AgentObservabilityEvent | MCPObservabilityEvent;
40
+ interface Observability {
41
+ /**
42
+ * Emit an event for the Agent's observability implementation to handle.
43
+ * @param event - The event to emit
44
+ * @param ctx - The execution context of the invocation (optional)
45
+ */
46
+ emit(event: ObservabilityEvent, ctx?: DurableObjectState): void;
47
+ }
48
+ /**
49
+ * A generic observability implementation that logs events to the console.
50
+ */
51
+ declare const genericObservability: Observability;
52
+ //#endregion
53
+ export {
54
+ ObservabilityEvent as n,
55
+ genericObservability as r,
56
+ Observability as t
57
+ };
58
+ //# sourceMappingURL=index-DhJCaDWd.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,31 +1,70 @@
1
- import "@modelcontextprotocol/sdk/client/index.js";
2
- import "@modelcontextprotocol/sdk/types.js";
3
- export { Connection, ConnectionContext, WSMessage } from "partyserver";
4
- import "./mcp/client.js";
5
- export {
6
- A as Agent,
7
- a as AgentContext,
8
- i as AgentNamespace,
9
- j as AgentOptions,
10
- C as CallableMetadata,
1
+ import { u as TransportType } from "./client-CtM-Lpn3.js";
2
+ import "./mcp-Dw5vDrY8.js";
3
+ import "./do-oauth-client-provider-DGc5pP0l.js";
4
+ import "./index-DhJCaDWd.js";
5
+ import "./ai-types-D5YoPrBZ.js";
6
+ import {
7
+ A as unstable_callable,
8
+ C as createAddressBasedEmailResolver,
9
+ D as getCurrentAgent,
10
+ E as getAgentByName,
11
+ O as routeAgentEmail,
12
+ S as callable,
13
+ T as createHeaderBasedEmailResolver,
14
+ _ as RPCResponse,
15
+ a as AgentOptions,
16
+ b as StreamingResponse,
17
+ c as ConnectionContext,
18
+ d as EmailSendOptions,
11
19
  f as MCPServer,
12
- e as MCPServerMessage,
13
- M as MCPServersState,
14
- R as RPCRequest,
15
- c as RPCResponse,
16
- d as Schedule,
17
- S as StateUpdateMessage,
18
- m as StreamingResponse,
19
- l as getAgentByName,
20
- h as getCurrentAgent,
21
- k as routeAgentEmail,
22
- r as routeAgentRequest,
23
- u as unstable_callable,
24
- } from "./index-CITGJflw.js";
25
- import "zod";
26
- import "@modelcontextprotocol/sdk/client/sse.js";
27
- import "@modelcontextprotocol/sdk/shared/protocol.js";
28
- import "ai";
29
- import "./mcp/do-oauth-client-provider.js";
30
- import "@modelcontextprotocol/sdk/client/auth.js";
31
- import "@modelcontextprotocol/sdk/shared/auth.js";
20
+ g as RPCRequest,
21
+ h as QueueItem,
22
+ i as AgentNamespace,
23
+ k as routeAgentRequest,
24
+ l as EmailResolver,
25
+ m as MCPServersState,
26
+ n as AgentContext,
27
+ o as CallableMetadata,
28
+ p as MCPServerMessage,
29
+ r as AgentEmail,
30
+ s as Connection,
31
+ t as Agent,
32
+ u as EmailRoutingOptions,
33
+ v as Schedule,
34
+ w as createCatchAllEmailResolver,
35
+ x as WSMessage,
36
+ y as StateUpdateMessage
37
+ } from "./index-DgMq4s2H.js";
38
+ export {
39
+ Agent,
40
+ AgentContext,
41
+ AgentEmail,
42
+ AgentNamespace,
43
+ AgentOptions,
44
+ CallableMetadata,
45
+ Connection,
46
+ ConnectionContext,
47
+ EmailResolver,
48
+ EmailRoutingOptions,
49
+ EmailSendOptions,
50
+ MCPServer,
51
+ MCPServerMessage,
52
+ MCPServersState,
53
+ QueueItem,
54
+ RPCRequest,
55
+ RPCResponse,
56
+ Schedule,
57
+ StateUpdateMessage,
58
+ StreamingResponse,
59
+ TransportType,
60
+ WSMessage,
61
+ callable,
62
+ createAddressBasedEmailResolver,
63
+ createCatchAllEmailResolver,
64
+ createHeaderBasedEmailResolver,
65
+ getAgentByName,
66
+ getCurrentAgent,
67
+ routeAgentEmail,
68
+ routeAgentRequest,
69
+ unstable_callable
70
+ };