agents 0.2.15 → 0.2.16

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 (48) hide show
  1. package/dist/ai-chat-agent.d.ts +10 -10
  2. package/dist/ai-chat-agent.js +6 -6
  3. package/dist/{ai-chat-v5-migration-gdyLiTd8.js → ai-chat-v5-migration-DBHGW4Hv.js} +2 -2
  4. package/dist/{ai-chat-v5-migration-gdyLiTd8.js.map → ai-chat-v5-migration-DBHGW4Hv.js.map} +1 -1
  5. package/dist/ai-chat-v5-migration.js +1 -1
  6. package/dist/ai-react.d.ts +9 -9
  7. package/dist/ai-react.js +1 -1
  8. package/dist/{ai-types-UZlfLOYP.js → ai-types-B3aQaFv3.js} +2 -2
  9. package/dist/{ai-types-UZlfLOYP.js.map → ai-types-B3aQaFv3.js.map} +1 -1
  10. package/dist/{ai-types-BWW4umHY.d.ts → ai-types-D5YoPrBZ.d.ts} +2 -2
  11. package/dist/ai-types.d.ts +4 -4
  12. package/dist/ai-types.js +1 -1
  13. package/dist/{client-DjR-lC16.js → client-BfiZ3HQd.js} +3 -3
  14. package/dist/{client-DjR-lC16.js.map → client-BfiZ3HQd.js.map} +1 -1
  15. package/dist/{client-C-nwz-3N.d.ts → client-C1R7IU9g.d.ts} +24 -24
  16. package/dist/{client-CZBVDDoO.js → client-CIvp_OWw.js} +2 -2
  17. package/dist/{client-CZBVDDoO.js.map → client-CIvp_OWw.js.map} +1 -1
  18. package/dist/{client-CmMi85Sj.d.ts → client-CbWe9FBd.d.ts} +10 -10
  19. package/dist/client.d.ts +8 -8
  20. package/dist/client.js +2 -2
  21. package/dist/codemode/ai.js +5 -5
  22. package/dist/{do-oauth-client-provider-B2jr6UNq.js → do-oauth-client-provider-CswoD5Lu.js} +2 -2
  23. package/dist/{do-oauth-client-provider-B2jr6UNq.js.map → do-oauth-client-provider-CswoD5Lu.js.map} +1 -1
  24. package/dist/{do-oauth-client-provider-CCwGwnrA.d.ts → do-oauth-client-provider-DGc5pP0l.d.ts} +2 -2
  25. package/dist/{index-DWJSBMbz.d.ts → index-CaUf7Wsc.d.ts} +47 -215
  26. package/dist/{index-W4JUkafc.d.ts → index-DhJCaDWd.d.ts} +7 -3
  27. package/dist/index.d.ts +36 -50
  28. package/dist/index.js +6 -6
  29. package/dist/mcp/client.d.ts +3 -3
  30. package/dist/mcp/client.js +1 -1
  31. package/dist/mcp/do-oauth-client-provider.d.ts +1 -1
  32. package/dist/mcp/do-oauth-client-provider.js +1 -1
  33. package/dist/mcp/index.d.ts +129 -7
  34. package/dist/mcp/index.js +1234 -6
  35. package/dist/mcp/index.js.map +1 -0
  36. package/dist/{mcp-BEwaCsxO.d.ts → mcp-Dw5vDrY8.d.ts} +2 -2
  37. package/dist/observability/index.d.ts +2 -2
  38. package/dist/observability/index.js +5 -5
  39. package/dist/{react-GnTP-a01.d.ts → react-BWIluznB.d.ts} +28 -26
  40. package/dist/react.d.ts +9 -9
  41. package/dist/react.js +1 -1
  42. package/dist/{serializable-gtr9YMhp.d.ts → serializable-CymX8ovI.d.ts} +8 -3
  43. package/dist/serializable.d.ts +5 -5
  44. package/dist/src-CTtjSFyX.js +1231 -0
  45. package/dist/src-CTtjSFyX.js.map +1 -0
  46. package/package.json +5 -5
  47. package/dist/src-tpG9NtHy.js +0 -2457
  48. package/dist/src-tpG9NtHy.js.map +0 -1
@@ -1,13 +1,10 @@
1
1
  import {
2
- BaseTransportType,
3
- MCPClientManager,
4
- MCPConnectionState,
5
- MaybePromise,
6
- ServeOptions,
7
- TransportType
8
- } from "./client-C-nwz-3N.js";
9
- import { Observability } from "./index-W4JUkafc.js";
10
- import { MessageType } from "./ai-types-BWW4umHY.js";
2
+ a as MCPConnectionState,
3
+ l as TransportType,
4
+ t as MCPClientManager
5
+ } from "./client-C1R7IU9g.js";
6
+ import { t as Observability } from "./index-DhJCaDWd.js";
7
+ import { n as MessageType } from "./ai-types-D5YoPrBZ.js";
11
8
  import {
12
9
  Connection,
13
10
  Connection as Connection$1,
@@ -18,169 +15,15 @@ import {
18
15
  } from "partyserver";
19
16
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
20
17
  import {
21
- ElicitRequest as ElicitRequest$1,
22
- ElicitRequestSchema as ElicitRequestSchema$1,
23
- ElicitResult,
24
- ElicitResult as ElicitResult$1,
25
- JSONRPCMessage,
26
18
  Prompt,
27
19
  Resource,
28
20
  ServerCapabilities,
29
21
  Tool
30
22
  } from "@modelcontextprotocol/sdk/types.js";
31
23
  import { env } from "cloudflare:workers";
32
- import { Server as Server$1 } from "@modelcontextprotocol/sdk/server/index.js";
33
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
34
- import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
35
24
 
36
- //#region src/mcp/worker-transport.d.ts
37
- interface WorkerTransportOptions {
38
- sessionIdGenerator?: () => string;
39
- enableJsonResponse?: boolean;
40
- onsessioninitialized?: (sessionId: string) => void;
41
- }
42
- declare class WorkerTransport implements Transport {
43
- private started;
44
- private initialized;
45
- private sessionIdGenerator?;
46
- private enableJsonResponse;
47
- private onsessioninitialized?;
48
- private standaloneSseStreamId;
49
- private streamMapping;
50
- private requestToStreamMapping;
51
- private requestResponseMap;
52
- sessionId?: string;
53
- onclose?: () => void;
54
- onerror?: (error: Error) => void;
55
- onmessage?: (message: JSONRPCMessage) => void;
56
- constructor(options?: WorkerTransportOptions);
57
- start(): Promise<void>;
58
- handleRequest(request: Request, parsedBody?: unknown): Promise<Response>;
59
- private handleGetRequest;
60
- private handlePostRequest;
61
- private handleDeleteRequest;
62
- private handleOptionsRequest;
63
- private handleUnsupportedRequest;
64
- private validateSession;
65
- close(): Promise<void>;
66
- send(message: JSONRPCMessage): Promise<void>;
67
- }
68
- //#endregion
69
- //#region src/mcp/handler.d.ts
70
- interface CreateMcpHandlerOptions extends WorkerTransportOptions {
71
- /**
72
- * The route path that this MCP handler should respond to.
73
- * If specified, the handler will only process requests that match this route.
74
- * @default "/mcp"
75
- */
76
- route?: string;
77
- }
78
- type OAuthExecutionContext = ExecutionContext & {
79
- props?: Record<string, unknown>;
80
- };
81
- declare function experimental_createMcpHandler(
82
- server: McpServer | Server$1,
83
- options?: CreateMcpHandlerOptions
84
- ): (request: Request, env: unknown, ctx: ExecutionContext) => Promise<Response>;
85
- //#endregion
86
- //#region src/mcp/auth-context.d.ts
87
- interface McpAuthContext {
88
- props: Record<string, unknown>;
89
- }
90
- declare function getMcpAuthContext(): McpAuthContext | undefined;
91
- //#endregion
92
- //#region src/mcp/index.d.ts
93
- declare abstract class McpAgent<
94
- Env = unknown,
95
- State = unknown,
96
- Props extends Record<string, unknown> = Record<string, unknown>
97
- > extends Agent<Env, State, Props> {
98
- private _transport?;
99
- props?: Props;
100
- abstract server: MaybePromise<McpServer | Server$1>;
101
- abstract init(): Promise<void>;
102
- setInitializeRequest(initializeRequest: JSONRPCMessage): Promise<void>;
103
- getInitializeRequest(): Promise<JSONRPCMessage | undefined>;
104
- /** Read the transport type for this agent.
105
- * This relies on the naming scheme being `sse:${sessionId}`
106
- * or `streamable-http:${sessionId}`.
107
- */
108
- getTransportType(): BaseTransportType;
109
- /** Read the sessionId for this agent.
110
- * This relies on the naming scheme being `sse:${sessionId}`
111
- * or `streamable-http:${sessionId}`.
112
- */
113
- getSessionId(): string;
114
- /** Get the unique WebSocket. SSE transport only. */
115
- private getWebSocket;
116
- /** Returns a new transport matching the type of the Agent. */
117
- private initTransport;
118
- /** Update and store the props */
119
- updateProps(props?: Props): Promise<void>;
120
- reinitializeServer(): Promise<void>;
121
- /** Sets up the MCP transport and server every time the Agent is started.*/
122
- onStart(props?: Props): Promise<void>;
123
- /** Validates new WebSocket connections. */
124
- onConnect(
125
- conn: Connection$1,
126
- { request: req }: ConnectionContext
127
- ): Promise<void>;
128
- /** Handles MCP Messages for the legacy SSE transport. */
129
- onSSEMcpMessage(
130
- _sessionId: string,
131
- messageBody: unknown
132
- ): Promise<Error | null>;
133
- /** Elicit user input with a message and schema */
134
- elicitInput(params: {
135
- message: string;
136
- requestedSchema: unknown;
137
- }): Promise<ElicitResult>;
138
- /** Wait for elicitation response through storage polling */
139
- private _waitForElicitationResponse;
140
- /** Handle elicitation responses */
141
- private _handleElicitationResponse;
142
- /** Return a handler for the given path for this MCP.
143
- * Defaults to Streamable HTTP transport.
144
- */
145
- static serve(
146
- path: string,
147
- { binding, corsOptions, transport }?: ServeOptions
148
- ): {
149
- fetch<Env>(
150
- this: void,
151
- request: Request,
152
- env: Env,
153
- ctx: ExecutionContext
154
- ): Promise<Response>;
155
- };
156
- /**
157
- * Legacy api
158
- **/
159
- static mount(
160
- path: string,
161
- opts?: Omit<ServeOptions, "transport">
162
- ): {
163
- fetch<Env>(
164
- this: void,
165
- request: Request,
166
- env: Env,
167
- ctx: ExecutionContext
168
- ): Promise<Response>;
169
- };
170
- static serveSSE(
171
- path: string,
172
- opts?: Omit<ServeOptions, "transport">
173
- ): {
174
- fetch<Env>(
175
- this: void,
176
- request: Request,
177
- env: Env,
178
- ctx: ExecutionContext
179
- ): Promise<Response>;
180
- };
181
- }
182
- //#endregion
183
25
  //#region src/index.d.ts
26
+
184
27
  /**
185
28
  * RPC request message from client
186
29
  */
@@ -244,9 +87,9 @@ declare function callable(
244
87
  * @param metadata Optional metadata about the callable method
245
88
  */
246
89
  declare const unstable_callable: (metadata?: CallableMetadata) => void;
247
- type QueueItem<T = string> = {
90
+ type QueueItem<T$1 = string> = {
248
91
  id: string;
249
- payload: T;
92
+ payload: T$1;
250
93
  callback: keyof Agent<unknown>;
251
94
  created_at: number;
252
95
  };
@@ -254,13 +97,13 @@ type QueueItem<T = string> = {
254
97
  * Represents a scheduled task within an Agent
255
98
  * @template T Type of the payload data
256
99
  */
257
- type Schedule<T = string> = {
100
+ type Schedule<T$1 = string> = {
258
101
  /** Unique identifier for the schedule */
259
102
  id: string;
260
103
  /** Name of the method to be called */
261
104
  callback: string;
262
105
  /** Data to be passed to the callback */
263
- payload: T;
106
+ payload: T$1;
264
107
  } & (
265
108
  | {
266
109
  /** Type of schedule for one-time execution at a specific time */
@@ -309,9 +152,9 @@ type MCPServer = {
309
152
  capabilities: ServerCapabilities | null;
310
153
  };
311
154
  declare function getCurrentAgent<
312
- T extends Agent<unknown, unknown> = Agent<unknown, unknown>
155
+ T$1 extends Agent<unknown, unknown> = Agent<unknown, unknown>
313
156
  >(): {
314
- agent: T | undefined;
157
+ agent: T$1 | undefined;
315
158
  connection: Connection | undefined;
316
159
  request: Request | undefined;
317
160
  email: AgentEmail | undefined;
@@ -659,17 +502,17 @@ type EmailSendOptions = {
659
502
  */
660
503
  declare function getAgentByName<
661
504
  Env,
662
- T extends Agent<Env>,
505
+ T$1 extends Agent<Env>,
663
506
  Props extends Record<string, unknown> = Record<string, unknown>
664
507
  >(
665
- namespace: AgentNamespace<T>,
508
+ namespace: AgentNamespace<T$1>,
666
509
  name: string,
667
510
  options?: {
668
511
  jurisdiction?: DurableObjectJurisdiction;
669
512
  locationHint?: DurableObjectLocationHint;
670
513
  props?: Props;
671
514
  }
672
- ): Promise<DurableObjectStub<T>>;
515
+ ): Promise<DurableObjectStub<T$1>>;
673
516
  /**
674
517
  * A wrapper for streaming responses in callable methods
675
518
  */
@@ -691,46 +534,35 @@ declare class StreamingResponse {
691
534
  }
692
535
  //#endregion
693
536
  export {
694
- Agent,
695
- AgentContext,
696
- AgentEmail,
697
- AgentNamespace,
698
- AgentOptions,
699
- CallableMetadata,
700
- type Connection$1 as Connection,
701
- type ConnectionContext,
702
- type CreateMcpHandlerOptions,
703
- type ElicitRequest$1 as ElicitRequest,
704
- ElicitRequestSchema$1 as ElicitRequestSchema,
705
- type ElicitResult$1 as ElicitResult,
706
- EmailResolver,
707
- EmailRoutingOptions,
708
- EmailSendOptions,
709
- MCPServer,
710
- MCPServerMessage,
711
- MCPServersState,
712
- McpAgent,
713
- type McpAuthContext,
714
- type OAuthExecutionContext,
715
- QueueItem,
716
- RPCRequest,
717
- RPCResponse,
718
- Schedule,
719
- StateUpdateMessage,
720
- StreamingResponse,
721
- type WSMessage,
722
- WorkerTransport,
723
- type WorkerTransportOptions,
724
- callable,
725
- createAddressBasedEmailResolver,
726
- createCatchAllEmailResolver,
727
- createHeaderBasedEmailResolver,
728
- experimental_createMcpHandler,
729
- getAgentByName,
730
- getCurrentAgent,
731
- getMcpAuthContext,
732
- routeAgentEmail,
733
- routeAgentRequest,
734
- unstable_callable
537
+ unstable_callable as A,
538
+ createAddressBasedEmailResolver as C,
539
+ getCurrentAgent as D,
540
+ getAgentByName as E,
541
+ routeAgentEmail as O,
542
+ callable as S,
543
+ createHeaderBasedEmailResolver as T,
544
+ RPCResponse as _,
545
+ AgentOptions as a,
546
+ StreamingResponse as b,
547
+ ConnectionContext as c,
548
+ EmailSendOptions as d,
549
+ MCPServer as f,
550
+ RPCRequest as g,
551
+ QueueItem as h,
552
+ AgentNamespace as i,
553
+ routeAgentRequest as k,
554
+ EmailResolver as l,
555
+ MCPServersState as m,
556
+ AgentContext as n,
557
+ CallableMetadata as o,
558
+ MCPServerMessage as p,
559
+ AgentEmail as r,
560
+ Connection$1 as s,
561
+ Agent as t,
562
+ EmailRoutingOptions as u,
563
+ Schedule as v,
564
+ createCatchAllEmailResolver as w,
565
+ WSMessage as x,
566
+ StateUpdateMessage as y
735
567
  };
736
- //# sourceMappingURL=index-DWJSBMbz.d.ts.map
568
+ //# sourceMappingURL=index-CaUf7Wsc.d.ts.map
@@ -1,4 +1,4 @@
1
- import { BaseEvent, MCPObservabilityEvent } from "./mcp-BEwaCsxO.js";
1
+ import { n as BaseEvent, t as MCPObservabilityEvent } from "./mcp-Dw5vDrY8.js";
2
2
 
3
3
  //#region src/observability/agent.d.ts
4
4
 
@@ -50,5 +50,9 @@ interface Observability {
50
50
  */
51
51
  declare const genericObservability: Observability;
52
52
  //#endregion
53
- export { Observability, ObservabilityEvent, genericObservability };
54
- //# sourceMappingURL=index-W4JUkafc.d.ts.map
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,47 +1,40 @@
1
- import { TransportType } from "./client-C-nwz-3N.js";
2
- import "./mcp-BEwaCsxO.js";
3
- import "./do-oauth-client-provider-CCwGwnrA.js";
4
- import "./index-W4JUkafc.js";
5
- import "./ai-types-BWW4umHY.js";
1
+ import { l as TransportType } from "./client-C1R7IU9g.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
6
  import {
7
- Agent,
8
- AgentContext,
9
- AgentEmail,
10
- AgentNamespace,
11
- AgentOptions,
12
- CallableMetadata,
13
- Connection,
14
- ConnectionContext,
15
- CreateMcpHandlerOptions,
16
- EmailResolver,
17
- EmailRoutingOptions,
18
- EmailSendOptions,
19
- MCPServer,
20
- MCPServerMessage,
21
- MCPServersState,
22
- McpAuthContext,
23
- OAuthExecutionContext,
24
- QueueItem,
25
- RPCRequest,
26
- RPCResponse,
27
- Schedule,
28
- StateUpdateMessage,
29
- StreamingResponse,
30
- WSMessage,
31
- WorkerTransport,
32
- WorkerTransportOptions,
33
- callable,
34
- createAddressBasedEmailResolver,
35
- createCatchAllEmailResolver,
36
- createHeaderBasedEmailResolver,
37
- experimental_createMcpHandler,
38
- getAgentByName,
39
- getCurrentAgent,
40
- getMcpAuthContext,
41
- routeAgentEmail,
42
- routeAgentRequest,
43
- unstable_callable
44
- } from "./index-DWJSBMbz.js";
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-CaUf7Wsc.js";
45
38
  export {
46
39
  Agent,
47
40
  AgentContext,
@@ -51,15 +44,12 @@ export {
51
44
  CallableMetadata,
52
45
  Connection,
53
46
  ConnectionContext,
54
- CreateMcpHandlerOptions,
55
47
  EmailResolver,
56
48
  EmailRoutingOptions,
57
49
  EmailSendOptions,
58
50
  MCPServer,
59
51
  MCPServerMessage,
60
52
  MCPServersState,
61
- McpAuthContext,
62
- OAuthExecutionContext,
63
53
  QueueItem,
64
54
  RPCRequest,
65
55
  RPCResponse,
@@ -68,16 +58,12 @@ export {
68
58
  StreamingResponse,
69
59
  TransportType,
70
60
  WSMessage,
71
- WorkerTransport,
72
- WorkerTransportOptions,
73
61
  callable,
74
62
  createAddressBasedEmailResolver,
75
63
  createCatchAllEmailResolver,
76
64
  createHeaderBasedEmailResolver,
77
- experimental_createMcpHandler,
78
65
  getAgentByName,
79
66
  getCurrentAgent,
80
- getMcpAuthContext,
81
67
  routeAgentEmail,
82
68
  routeAgentRequest,
83
69
  unstable_callable
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import "./ai-types-UZlfLOYP.js";
2
- import "./client-DjR-lC16.js";
3
- import "./client-CZBVDDoO.js";
4
- import "./do-oauth-client-provider-B2jr6UNq.js";
5
- import { Agent, StreamingResponse, WorkerTransport, callable, createAddressBasedEmailResolver, createCatchAllEmailResolver, createHeaderBasedEmailResolver, experimental_createMcpHandler, getAgentByName, getCurrentAgent, getMcpAuthContext, routeAgentEmail, routeAgentRequest, unstable_callable } from "./src-tpG9NtHy.js";
1
+ import "./ai-types-B3aQaFv3.js";
2
+ import "./client-BfiZ3HQd.js";
3
+ import "./client-CIvp_OWw.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-CTtjSFyX.js";
6
6
 
7
- export { Agent, StreamingResponse, WorkerTransport, callable, createAddressBasedEmailResolver, createCatchAllEmailResolver, createHeaderBasedEmailResolver, experimental_createMcpHandler, getAgentByName, getCurrentAgent, getMcpAuthContext, routeAgentEmail, routeAgentRequest, unstable_callable };
7
+ export { Agent, StreamingResponse, callable, createAddressBasedEmailResolver, createCatchAllEmailResolver, createHeaderBasedEmailResolver, getAgentByName, getCurrentAgent, routeAgentEmail, routeAgentRequest, unstable_callable };
@@ -1,4 +1,4 @@
1
- import { MCPClientManager, MCPClientOAuthCallbackConfig, MCPClientOAuthResult, getNamespacedData } from "../client-C-nwz-3N.js";
2
- import "../mcp-BEwaCsxO.js";
3
- import "../do-oauth-client-provider-CCwGwnrA.js";
1
+ import { i as getNamespacedData, n as MCPClientOAuthCallbackConfig, r as MCPClientOAuthResult, t as MCPClientManager } from "../client-C1R7IU9g.js";
2
+ import "../mcp-Dw5vDrY8.js";
3
+ import "../do-oauth-client-provider-DGc5pP0l.js";
4
4
  export { MCPClientManager, MCPClientOAuthCallbackConfig, MCPClientOAuthResult, getNamespacedData };
@@ -1,3 +1,3 @@
1
- import { MCPClientManager, getNamespacedData } from "../client-CZBVDDoO.js";
1
+ import { n as getNamespacedData, t as MCPClientManager } from "../client-CIvp_OWw.js";
2
2
 
3
3
  export { MCPClientManager, getNamespacedData };
@@ -1,2 +1,2 @@
1
- import { AgentsOAuthProvider, DurableObjectOAuthClientProvider } from "../do-oauth-client-provider-CCwGwnrA.js";
1
+ import { n as DurableObjectOAuthClientProvider, t as AgentsOAuthProvider } from "../do-oauth-client-provider-DGc5pP0l.js";
2
2
  export { AgentsOAuthProvider, DurableObjectOAuthClientProvider };
@@ -1,3 +1,3 @@
1
- import { DurableObjectOAuthClientProvider } from "../do-oauth-client-provider-B2jr6UNq.js";
1
+ import { t as DurableObjectOAuthClientProvider } from "../do-oauth-client-provider-CswoD5Lu.js";
2
2
 
3
3
  export { DurableObjectOAuthClientProvider };
@@ -1,7 +1,129 @@
1
- import { MCPClientOAuthCallbackConfig, MCPClientOAuthResult, SSEEdgeClientTransport, StreamableHTTPEdgeClientTransport } from "../client-C-nwz-3N.js";
2
- import "../mcp-BEwaCsxO.js";
3
- import "../do-oauth-client-provider-CCwGwnrA.js";
4
- import "../index-W4JUkafc.js";
5
- import "../ai-types-BWW4umHY.js";
6
- import { CreateMcpHandlerOptions, ElicitRequest, ElicitRequestSchema, ElicitResult, McpAgent, McpAuthContext, OAuthExecutionContext, WorkerTransport, WorkerTransportOptions, experimental_createMcpHandler, getMcpAuthContext } from "../index-DWJSBMbz.js";
7
- export { CreateMcpHandlerOptions, ElicitRequest, ElicitRequestSchema, ElicitResult, MCPClientOAuthCallbackConfig, MCPClientOAuthResult, McpAgent, McpAuthContext, OAuthExecutionContext, SSEEdgeClientTransport, StreamableHTTPEdgeClientTransport, WorkerTransport, WorkerTransportOptions, experimental_createMcpHandler, getMcpAuthContext };
1
+ import { c as ServeOptions, d as SSEEdgeClientTransport, n as MCPClientOAuthCallbackConfig, o as BaseTransportType, r as MCPClientOAuthResult, s as MaybePromise, u as StreamableHTTPEdgeClientTransport } from "../client-C1R7IU9g.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-CaUf7Wsc.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
+ }
18
+ declare class WorkerTransport implements Transport {
19
+ private started;
20
+ private initialized;
21
+ private sessionIdGenerator?;
22
+ private enableJsonResponse;
23
+ private onsessioninitialized?;
24
+ private standaloneSseStreamId;
25
+ private streamMapping;
26
+ private requestToStreamMapping;
27
+ private requestResponseMap;
28
+ sessionId?: string;
29
+ onclose?: () => void;
30
+ onerror?: (error: Error) => void;
31
+ onmessage?: (message: JSONRPCMessage) => void;
32
+ constructor(options?: WorkerTransportOptions);
33
+ start(): Promise<void>;
34
+ handleRequest(request: Request, parsedBody?: unknown): Promise<Response>;
35
+ private handleGetRequest;
36
+ private handlePostRequest;
37
+ private handleDeleteRequest;
38
+ private handleOptionsRequest;
39
+ private handleUnsupportedRequest;
40
+ private validateSession;
41
+ close(): Promise<void>;
42
+ send(message: JSONRPCMessage): Promise<void>;
43
+ }
44
+ //#endregion
45
+ //#region src/mcp/handler.d.ts
46
+ interface CreateMcpHandlerOptions extends WorkerTransportOptions {
47
+ /**
48
+ * The route path that this MCP handler should respond to.
49
+ * If specified, the handler will only process requests that match this route.
50
+ * @default "/mcp"
51
+ */
52
+ route?: string;
53
+ }
54
+ type OAuthExecutionContext = ExecutionContext & {
55
+ props?: Record<string, unknown>;
56
+ };
57
+ declare function experimental_createMcpHandler(server: McpServer | Server, options?: CreateMcpHandlerOptions): (request: Request, env: unknown, ctx: ExecutionContext) => Promise<Response>;
58
+ //#endregion
59
+ //#region src/mcp/auth-context.d.ts
60
+ interface McpAuthContext {
61
+ props: Record<string, unknown>;
62
+ }
63
+ declare function getMcpAuthContext(): McpAuthContext | undefined;
64
+ //#endregion
65
+ //#region src/mcp/index.d.ts
66
+ declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Record<string, unknown> = Record<string, unknown>> extends Agent<Env, State, Props> {
67
+ private _transport?;
68
+ props?: Props;
69
+ abstract server: MaybePromise<McpServer | Server>;
70
+ abstract init(): Promise<void>;
71
+ setInitializeRequest(initializeRequest: JSONRPCMessage): Promise<void>;
72
+ getInitializeRequest(): Promise<JSONRPCMessage | undefined>;
73
+ /** Read the transport type for this agent.
74
+ * This relies on the naming scheme being `sse:${sessionId}`
75
+ * or `streamable-http:${sessionId}`.
76
+ */
77
+ getTransportType(): BaseTransportType;
78
+ /** Read the sessionId for this agent.
79
+ * This relies on the naming scheme being `sse:${sessionId}`
80
+ * or `streamable-http:${sessionId}`.
81
+ */
82
+ getSessionId(): string;
83
+ /** Get the unique WebSocket. SSE transport only. */
84
+ private getWebSocket;
85
+ /** Returns a new transport matching the type of the Agent. */
86
+ private initTransport;
87
+ /** Update and store the props */
88
+ updateProps(props?: Props): Promise<void>;
89
+ reinitializeServer(): Promise<void>;
90
+ /** Sets up the MCP transport and server every time the Agent is started.*/
91
+ onStart(props?: Props): Promise<void>;
92
+ /** Validates new WebSocket connections. */
93
+ onConnect(conn: Connection, {
94
+ request: req
95
+ }: ConnectionContext): Promise<void>;
96
+ /** Handles MCP Messages for the legacy SSE transport. */
97
+ onSSEMcpMessage(_sessionId: string, messageBody: unknown): Promise<Error | null>;
98
+ /** Elicit user input with a message and schema */
99
+ elicitInput(params: {
100
+ message: string;
101
+ requestedSchema: unknown;
102
+ }): Promise<ElicitResult$1>;
103
+ /** Wait for elicitation response through storage polling */
104
+ private _waitForElicitationResponse;
105
+ /** Handle elicitation responses */
106
+ private _handleElicitationResponse;
107
+ /** Return a handler for the given path for this MCP.
108
+ * Defaults to Streamable HTTP transport.
109
+ */
110
+ static serve(path: string, {
111
+ binding,
112
+ corsOptions,
113
+ transport
114
+ }?: ServeOptions): {
115
+ fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
116
+ };
117
+ /**
118
+ * Legacy api
119
+ **/
120
+ static mount(path: string, opts?: Omit<ServeOptions, "transport">): {
121
+ fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
122
+ };
123
+ static serveSSE(path: string, opts?: Omit<ServeOptions, "transport">): {
124
+ fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
125
+ };
126
+ }
127
+ //#endregion
128
+ export { type CreateMcpHandlerOptions, type ElicitRequest, ElicitRequestSchema, type ElicitResult, type MCPClientOAuthCallbackConfig, type MCPClientOAuthResult, McpAgent, type McpAuthContext, type OAuthExecutionContext, SSEEdgeClientTransport, StreamableHTTPEdgeClientTransport, WorkerTransport, type WorkerTransportOptions, experimental_createMcpHandler, getMcpAuthContext };
129
+ //# sourceMappingURL=index.d.ts.map