agents 0.0.0-4100b67 → 0.0.0-412321b

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