agents 0.0.0-bcae0ba → 0.0.0-bdbadd3

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 (68) hide show
  1. package/README.md +257 -33
  2. package/dist/ai-chat-agent.d.ts +59 -13
  3. package/dist/ai-chat-agent.js +532 -161
  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 -70
  10. package/dist/ai-react.js +261 -185
  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 -69
  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-skWSTEiU.d.ts +5314 -0
  23. package/dist/client.d.ts +12 -79
  24. package/dist/client.js +3 -137
  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-C1wSj5kj.d.ts +560 -0
  32. package/dist/index-DhJCaDWd.d.ts +58 -0
  33. package/dist/index.d.ts +63 -299
  34. package/dist/index.js +7 -20
  35. package/dist/mcp/client.d.ts +4 -0
  36. package/dist/mcp/client.js +3 -0
  37. package/dist/mcp/do-oauth-client-provider.d.ts +2 -0
  38. package/dist/mcp/do-oauth-client-provider.js +3 -0
  39. package/dist/mcp/index.d.ts +153 -0
  40. package/dist/mcp/index.js +1351 -0
  41. package/dist/mcp/index.js.map +1 -0
  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 -0
  47. package/dist/observability/index.js +7 -0
  48. package/dist/react-xDeKFO3W.d.ts +115 -0
  49. package/dist/react.d.ts +10 -39
  50. package/dist/react.js +185 -93
  51. package/dist/react.js.map +1 -1
  52. package/dist/schedule.d.ts +89 -12
  53. package/dist/schedule.js +46 -23
  54. package/dist/schedule.js.map +1 -1
  55. package/dist/serializable-CymX8ovI.d.ts +39 -0
  56. package/dist/serializable.d.ts +7 -0
  57. package/dist/serializable.js +1 -0
  58. package/dist/src-Dz0H9hSU.js +1200 -0
  59. package/dist/src-Dz0H9hSU.js.map +1 -0
  60. package/package.json +118 -43
  61. package/dist/ai-types.js.map +0 -1
  62. package/dist/chunk-HMLY7DHA.js +0 -16
  63. package/dist/chunk-HMLY7DHA.js.map +0 -1
  64. package/dist/chunk-PDF5WEP4.js +0 -542
  65. package/dist/chunk-PDF5WEP4.js.map +0 -1
  66. package/dist/client.js.map +0 -1
  67. package/dist/index.js.map +0 -1
  68. package/src/index.ts +0 -852
package/dist/index.d.ts CHANGED
@@ -1,306 +1,70 @@
1
- import { Server, Connection, PartyServerOptions } from "partyserver";
2
- export { Connection, ConnectionContext, WSMessage } from "partyserver";
3
- import { WorkflowEntrypoint as WorkflowEntrypoint$1 } from "cloudflare:workers";
4
-
5
- /**
6
- * RPC request message from client
7
- */
8
- type RPCRequest = {
9
- type: "rpc";
10
- id: string;
11
- method: string;
12
- args: unknown[];
13
- };
14
- /**
15
- * State update message from client
16
- */
17
- type StateUpdateMessage = {
18
- type: "cf_agent_state";
19
- state: unknown;
20
- };
21
- /**
22
- * RPC response message to client
23
- */
24
- type RPCResponse = {
25
- type: "rpc";
26
- id: string;
27
- } & (
28
- | {
29
- success: true;
30
- result: unknown;
31
- done?: false;
32
- }
33
- | {
34
- success: true;
35
- result: unknown;
36
- done: true;
37
- }
38
- | {
39
- success: false;
40
- error: string;
41
- }
42
- );
43
- /**
44
- * Metadata for a callable method
45
- */
46
- type CallableMetadata = {
47
- /** Optional description of what the method does */
48
- description?: string;
49
- /** Whether the method supports streaming responses */
50
- streaming?: boolean;
51
- };
52
- /**
53
- * Decorator that marks a method as callable by clients
54
- * @param metadata Optional metadata about the callable method
55
- */
56
- declare function unstable_callable(
57
- metadata?: CallableMetadata
58
- ): <This, Args extends unknown[], Return>(
59
- target: (this: This, ...args: Args) => Return,
60
- context: ClassMethodDecoratorContext
61
- ) => (this: This, ...args: Args) => Return;
62
- /**
63
- * A class for creating workflow entry points that can be used with Cloudflare Workers
64
- */
65
- declare class WorkflowEntrypoint extends WorkflowEntrypoint$1 {}
66
- /**
67
- * Represents a scheduled task within an Agent
68
- * @template T Type of the payload data
69
- */
70
- type Schedule<T = string> = {
71
- /** Unique identifier for the schedule */
72
- id: string;
73
- /** Name of the method to be called */
74
- callback: string;
75
- /** Data to be passed to the callback */
76
- payload: T;
77
- } & (
78
- | {
79
- /** Type of schedule for one-time execution at a specific time */
80
- type: "scheduled";
81
- /** Timestamp when the task should execute */
82
- time: number;
83
- }
84
- | {
85
- /** Type of schedule for delayed execution */
86
- type: "delayed";
87
- /** Timestamp when the task should execute */
88
- time: number;
89
- /** Number of seconds to delay execution */
90
- delayInSeconds: number;
91
- }
92
- | {
93
- /** Type of schedule for recurring execution based on cron expression */
94
- type: "cron";
95
- /** Timestamp for the next execution */
96
- time: number;
97
- /** Cron expression defining the schedule */
98
- cron: string;
99
- }
100
- );
101
- /**
102
- * Base class for creating Agent implementations
103
- * @template Env Environment type containing bindings
104
- * @template State State type to store within the Agent
105
- */
106
- declare class Agent<Env, State = unknown> extends Server<Env> {
107
- #private;
108
- /**
109
- * Initial state for the Agent
110
- * Override to provide default state values
111
- */
112
- initialState: State;
113
- /**
114
- * Current state of the Agent
115
- */
116
- get state(): State;
117
- /**
118
- * Agent configuration options
119
- */
120
- static options: {
121
- /** Whether the Agent should hibernate when inactive */
122
- hibernate: boolean;
123
- };
124
- /**
125
- * Execute SQL queries against the Agent's database
126
- * @template T Type of the returned rows
127
- * @param strings SQL query template strings
128
- * @param values Values to be inserted into the query
129
- * @returns Array of query results
130
- */
131
- sql<T = Record<string, string | number | boolean | null>>(
132
- strings: TemplateStringsArray,
133
- ...values: (string | number | boolean | null)[]
134
- ): T[];
135
- constructor(ctx: AgentContext, env: Env);
136
- /**
137
- * Update the Agent's state
138
- * @param state New state to set
139
- */
140
- setState(state: State): void;
141
- /**
142
- * Called when the Agent's state is updated
143
- * @param state Updated state
144
- * @param source Source of the state update ("server" or a client connection)
145
- */
146
- onStateUpdate(state: State | undefined, source: Connection | "server"): void;
147
- /**
148
- * Called when the Agent receives an email
149
- * @param email Email message to process
150
- */
151
- onEmail(email: ForwardableEmailMessage): void;
152
- /**
153
- * Render content (not implemented in base class)
154
- */
155
- render(): void;
156
- /**
157
- * Schedule a task to be executed in the future
158
- * @template T Type of the payload data
159
- * @param when When to execute the task (Date, seconds delay, or cron expression)
160
- * @param callback Name of the method to call
161
- * @param payload Data to pass to the callback
162
- * @returns Schedule object representing the scheduled task
163
- */
164
- schedule<T = string>(
165
- when: Date | string | number,
166
- callback: keyof this,
167
- payload?: T
168
- ): Promise<Schedule<T>>;
169
- /**
170
- * Get a scheduled task by ID
171
- * @template T Type of the payload data
172
- * @param id ID of the scheduled task
173
- * @returns The Schedule object or undefined if not found
174
- */
175
- getSchedule<T = string>(id: string): Promise<Schedule<T> | undefined>;
176
- /**
177
- * Get scheduled tasks matching the given criteria
178
- * @template T Type of the payload data
179
- * @param criteria Criteria to filter schedules
180
- * @returns Array of matching Schedule objects
181
- */
182
- getSchedules<T = string>(criteria?: {
183
- description?: string;
184
- id?: string;
185
- type?: "scheduled" | "delayed" | "cron";
186
- timeRange?: {
187
- start?: Date;
188
- end?: Date;
189
- };
190
- }): Schedule<T>[];
191
- /**
192
- * Cancel a scheduled task
193
- * @param id ID of the task to cancel
194
- * @returns true if the task was cancelled, false otherwise
195
- */
196
- cancelSchedule(id: string): Promise<boolean>;
197
- private scheduleNextAlarm;
198
- /**
199
- * Method called when an alarm fires
200
- * Executes any scheduled tasks that are due
201
- */
202
- alarm(): Promise<void>;
203
- /**
204
- * Destroy the Agent, removing all state and scheduled tasks
205
- */
206
- destroy(): Promise<void>;
207
- /**
208
- * Get all methods marked as callable on this Agent
209
- * @returns A map of method names to their metadata
210
- */
211
- private isCallable;
212
- }
213
- /**
214
- * Namespace for creating Agent instances
215
- * @template Agentic Type of the Agent class
216
- */
217
- type AgentNamespace<Agentic extends Agent<unknown>> =
218
- DurableObjectNamespace<Agentic>;
219
- /**
220
- * Agent's durable context
221
- */
222
- type AgentContext = DurableObjectState;
223
- /**
224
- * Configuration options for Agent routing
225
- */
226
- type AgentOptions<Env> = PartyServerOptions<Env> & {
227
- /**
228
- * Whether to enable CORS for the Agent
229
- */
230
- cors?: boolean | HeadersInit | undefined;
231
- };
232
- /**
233
- * Route a request to the appropriate Agent
234
- * @param request Request to route
235
- * @param env Environment containing Agent bindings
236
- * @param options Routing options
237
- * @returns Response from the Agent or undefined if no route matched
238
- */
239
- declare function routeAgentRequest<Env>(
240
- request: Request,
241
- env: Env,
242
- options?: AgentOptions<Env>
243
- ): Promise<Response | null>;
244
- /**
245
- * Route an email to the appropriate Agent
246
- * @param email Email message to route
247
- * @param env Environment containing Agent bindings
248
- * @param options Routing options
249
- */
250
- declare function routeAgentEmail<Env>(
251
- email: ForwardableEmailMessage,
252
- env: Env,
253
- options?: AgentOptions<Env>
254
- ): Promise<void>;
255
- /**
256
- * Get or create an Agent by name
257
- * @template Env Environment type containing bindings
258
- * @template T Type of the Agent class
259
- * @param namespace Agent namespace
260
- * @param name Name of the Agent instance
261
- * @param options Options for Agent creation
262
- * @returns Promise resolving to an Agent instance stub
263
- */
264
- declare function getAgentByName<Env, T extends Agent<Env>>(
265
- namespace: AgentNamespace<T>,
266
- name: string,
267
- options?: {
268
- jurisdiction?: DurableObjectJurisdiction;
269
- locationHint?: DurableObjectLocationHint;
270
- }
271
- ): Promise<DurableObjectStub<T>>;
272
- /**
273
- * A wrapper for streaming responses in callable methods
274
- */
275
- declare class StreamingResponse {
276
- #private;
277
- constructor(connection: Connection, id: string);
278
- /**
279
- * Send a chunk of data to the client
280
- * @param chunk The data to send
281
- */
282
- send(chunk: unknown): void;
283
- /**
284
- * End the stream and send the final chunk (if any)
285
- * @param finalChunk Optional final chunk of data to send
286
- */
287
- end(finalChunk?: unknown): void;
288
- }
289
-
1
+ import { u as TransportType } from "./client-skWSTEiU.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,
19
+ f as MCPServer,
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-C1wSj5kj.js";
290
38
  export {
291
39
  Agent,
292
- type AgentContext,
293
- type AgentNamespace,
294
- type AgentOptions,
295
- type CallableMetadata,
296
- type RPCRequest,
297
- type RPCResponse,
298
- type Schedule,
299
- type StateUpdateMessage,
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,
300
58
  StreamingResponse,
301
- WorkflowEntrypoint,
59
+ TransportType,
60
+ WSMessage,
61
+ callable,
62
+ createAddressBasedEmailResolver,
63
+ createCatchAllEmailResolver,
64
+ createHeaderBasedEmailResolver,
302
65
  getAgentByName,
66
+ getCurrentAgent,
303
67
  routeAgentEmail,
304
68
  routeAgentRequest,
305
- unstable_callable,
69
+ unstable_callable
306
70
  };
package/dist/index.js CHANGED
@@ -1,20 +1,7 @@
1
- import {
2
- Agent,
3
- StreamingResponse,
4
- WorkflowEntrypoint,
5
- getAgentByName,
6
- routeAgentEmail,
7
- routeAgentRequest,
8
- unstable_callable
9
- } from "./chunk-PDF5WEP4.js";
10
- import "./chunk-HMLY7DHA.js";
11
- export {
12
- Agent,
13
- StreamingResponse,
14
- WorkflowEntrypoint,
15
- getAgentByName,
16
- routeAgentEmail,
17
- routeAgentRequest,
18
- unstable_callable
19
- };
20
- //# sourceMappingURL=index.js.map
1
+ import "./ai-types-B3aQaFv3.js";
2
+ import "./client-BfiZ3HQd.js";
3
+ import "./client-9Ld2_lnt.js";
4
+ import "./do-oauth-client-provider-CswoD5Lu.js";
5
+ import { a as createCatchAllEmailResolver, c as getCurrentAgent, d as unstable_callable, i as createAddressBasedEmailResolver, l as routeAgentEmail, n as StreamingResponse, o as createHeaderBasedEmailResolver, r as callable, s as getAgentByName, t as Agent, u as routeAgentRequest } from "./src-Dz0H9hSU.js";
6
+
7
+ export { Agent, StreamingResponse, callable, createAddressBasedEmailResolver, createCatchAllEmailResolver, createHeaderBasedEmailResolver, getAgentByName, getCurrentAgent, routeAgentEmail, routeAgentRequest, unstable_callable };
@@ -0,0 +1,4 @@
1
+ import { i as getNamespacedData, n as MCPClientOAuthCallbackConfig, r as MCPClientOAuthResult, t as MCPClientManager } from "../client-skWSTEiU.js";
2
+ import "../mcp-Dw5vDrY8.js";
3
+ import "../do-oauth-client-provider-DGc5pP0l.js";
4
+ export { MCPClientManager, MCPClientOAuthCallbackConfig, MCPClientOAuthResult, getNamespacedData };
@@ -0,0 +1,3 @@
1
+ import { n as getNamespacedData, t as MCPClientManager } from "../client-9Ld2_lnt.js";
2
+
3
+ export { MCPClientManager, getNamespacedData };
@@ -0,0 +1,2 @@
1
+ import { n as DurableObjectOAuthClientProvider, t as AgentsOAuthProvider } from "../do-oauth-client-provider-DGc5pP0l.js";
2
+ export { AgentsOAuthProvider, DurableObjectOAuthClientProvider };
@@ -0,0 +1,3 @@
1
+ import { t as DurableObjectOAuthClientProvider } from "../do-oauth-client-provider-CswoD5Lu.js";
2
+
3
+ export { DurableObjectOAuthClientProvider };
@@ -0,0 +1,153 @@
1
+ import { c as MaybePromise, d as StreamableHTTPEdgeClientTransport, f as SSEEdgeClientTransport, l as ServeOptions, n as MCPClientOAuthCallbackConfig, o as BaseTransportType, r as MCPClientOAuthResult, s as CORSOptions } from "../client-skWSTEiU.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 { c as ConnectionContext, s as Connection, t as Agent } from "../index-C1wSj5kj.js";
7
+ import { ElicitRequest, ElicitRequestSchema, ElicitResult, ElicitResult as ElicitResult$1, JSONRPCMessage } from "@modelcontextprotocol/sdk/types.js";
8
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
9
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
10
+ import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
11
+
12
+ //#region src/mcp/worker-transport.d.ts
13
+ interface WorkerTransportOptions {
14
+ sessionIdGenerator?: () => string;
15
+ enableJsonResponse?: boolean;
16
+ onsessioninitialized?: (sessionId: string) => void;
17
+ corsOptions?: CORSOptions;
18
+ }
19
+ declare class WorkerTransport implements Transport {
20
+ private started;
21
+ private initialized;
22
+ private sessionIdGenerator?;
23
+ private enableJsonResponse;
24
+ private onsessioninitialized?;
25
+ private standaloneSseStreamId;
26
+ private streamMapping;
27
+ private requestToStreamMapping;
28
+ private requestResponseMap;
29
+ private corsOptions?;
30
+ private protocolVersion?;
31
+ sessionId?: string;
32
+ onclose?: () => void;
33
+ onerror?: (error: Error) => void;
34
+ onmessage?: (message: JSONRPCMessage) => void;
35
+ constructor(options?: WorkerTransportOptions);
36
+ start(): Promise<void>;
37
+ private validateProtocolVersion;
38
+ private getHeaders;
39
+ handleRequest(request: Request, parsedBody?: unknown): Promise<Response>;
40
+ private handleGetRequest;
41
+ private handlePostRequest;
42
+ private handleDeleteRequest;
43
+ private handleOptionsRequest;
44
+ private handleUnsupportedRequest;
45
+ private validateSession;
46
+ close(): Promise<void>;
47
+ send(message: JSONRPCMessage): Promise<void>;
48
+ }
49
+ //#endregion
50
+ //#region src/mcp/handler.d.ts
51
+ interface CreateMcpHandlerOptions extends WorkerTransportOptions {
52
+ /**
53
+ * The route path that this MCP handler should respond to.
54
+ * If specified, the handler will only process requests that match this route.
55
+ * @default "/mcp"
56
+ */
57
+ route?: string;
58
+ /**
59
+ * CORS configuration options for handling cross-origin requests.
60
+ * These options are passed to the WorkerTransport which handles adding
61
+ * CORS headers to all responses.
62
+ *
63
+ * Default values are:
64
+ * - origin: "*"
65
+ * - headers: "Content-Type, Accept, Authorization, mcp-session-id, MCP-Protocol-Version"
66
+ * - methods: "GET, POST, DELETE, OPTIONS"
67
+ * - exposeHeaders: "mcp-session-id"
68
+ * - maxAge: 86400
69
+ *
70
+ * Provided options will overwrite the defaults.
71
+ */
72
+ corsOptions?: CORSOptions;
73
+ }
74
+ type OAuthExecutionContext = ExecutionContext & {
75
+ props?: Record<string, unknown>;
76
+ };
77
+ declare function createMcpHandler(server: McpServer | Server, options?: CreateMcpHandlerOptions): (request: Request, env: unknown, ctx: ExecutionContext) => Promise<Response>;
78
+ /**
79
+ * @deprecated This has been renamed to createMcpHandler, and experimental_createMcpHandler will be removed in the next major version
80
+ */
81
+ declare function experimental_createMcpHandler(server: McpServer | Server, options?: CreateMcpHandlerOptions): (request: Request, env: unknown, ctx: ExecutionContext) => Promise<Response>;
82
+ //#endregion
83
+ //#region src/mcp/auth-context.d.ts
84
+ interface McpAuthContext {
85
+ props: Record<string, unknown>;
86
+ }
87
+ declare function getMcpAuthContext(): McpAuthContext | undefined;
88
+ //#endregion
89
+ //#region src/mcp/index.d.ts
90
+ declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Record<string, unknown> = Record<string, unknown>> extends Agent<Env, State, Props> {
91
+ private _transport?;
92
+ props?: Props;
93
+ abstract server: MaybePromise<McpServer | Server>;
94
+ abstract init(): Promise<void>;
95
+ setInitializeRequest(initializeRequest: JSONRPCMessage): Promise<void>;
96
+ getInitializeRequest(): Promise<JSONRPCMessage | undefined>;
97
+ /** Read the transport type for this agent.
98
+ * This relies on the naming scheme being `sse:${sessionId}`
99
+ * or `streamable-http:${sessionId}`.
100
+ */
101
+ getTransportType(): BaseTransportType;
102
+ /** Read the sessionId for this agent.
103
+ * This relies on the naming scheme being `sse:${sessionId}`
104
+ * or `streamable-http:${sessionId}`.
105
+ */
106
+ getSessionId(): string;
107
+ /** Get the unique WebSocket. SSE transport only. */
108
+ private getWebSocket;
109
+ /** Returns a new transport matching the type of the Agent. */
110
+ private initTransport;
111
+ /** Update and store the props */
112
+ updateProps(props?: Props): Promise<void>;
113
+ reinitializeServer(): Promise<void>;
114
+ /** Sets up the MCP transport and server every time the Agent is started.*/
115
+ onStart(props?: Props): Promise<void>;
116
+ /** Validates new WebSocket connections. */
117
+ onConnect(conn: Connection, {
118
+ request: req
119
+ }: ConnectionContext): Promise<void>;
120
+ /** Handles MCP Messages for the legacy SSE transport. */
121
+ onSSEMcpMessage(_sessionId: string, messageBody: unknown): Promise<Error | null>;
122
+ /** Elicit user input with a message and schema */
123
+ elicitInput(params: {
124
+ message: string;
125
+ requestedSchema: unknown;
126
+ }): Promise<ElicitResult$1>;
127
+ /** Wait for elicitation response through storage polling */
128
+ private _waitForElicitationResponse;
129
+ /** Handle elicitation responses */
130
+ private _handleElicitationResponse;
131
+ /** Return a handler for the given path for this MCP.
132
+ * Defaults to Streamable HTTP transport.
133
+ */
134
+ static serve(path: string, {
135
+ binding,
136
+ corsOptions,
137
+ transport
138
+ }?: ServeOptions): {
139
+ fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
140
+ };
141
+ /**
142
+ * Legacy api
143
+ **/
144
+ static mount(path: string, opts?: Omit<ServeOptions, "transport">): {
145
+ fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
146
+ };
147
+ static serveSSE(path: string, opts?: Omit<ServeOptions, "transport">): {
148
+ fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
149
+ };
150
+ }
151
+ //#endregion
152
+ export { type CreateMcpHandlerOptions, type ElicitRequest, ElicitRequestSchema, type ElicitResult, type MCPClientOAuthCallbackConfig, type MCPClientOAuthResult, McpAgent, type McpAuthContext, type OAuthExecutionContext, SSEEdgeClientTransport, StreamableHTTPEdgeClientTransport, WorkerTransport, type WorkerTransportOptions, createMcpHandler, experimental_createMcpHandler, getMcpAuthContext };
153
+ //# sourceMappingURL=index.d.ts.map