agents 0.2.9 → 0.2.11

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