agents 0.0.0-19a3a25 → 0.0.0-1a3d226
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.
- package/README.md +126 -3
- package/dist/ai-chat-agent.d.ts +229 -22
- package/dist/ai-chat-agent.js +692 -106
- package/dist/ai-chat-agent.js.map +1 -1
- package/dist/ai-chat-v5-migration.js +154 -2
- package/dist/ai-chat-v5-migration.js.map +1 -0
- package/dist/ai-react.d.ts +141 -16
- package/dist/ai-react.js +381 -68
- package/dist/ai-react.js.map +1 -1
- package/dist/{ai-types-D5YoPrBZ.d.ts → ai-types-0OnT3FHg.d.ts} +40 -8
- package/dist/{ai-types-B3aQaFv3.js → ai-types-DEtF_8Km.js} +9 -1
- package/dist/ai-types-DEtF_8Km.js.map +1 -0
- package/dist/ai-types.d.ts +1 -1
- package/dist/ai-types.js +1 -1
- package/dist/cli/index.d.ts +1 -0
- package/dist/{cli.js → cli/index.js} +7 -6
- package/dist/cli/index.js.map +1 -0
- package/dist/client-BINtT7y-.d.ts +834 -0
- package/dist/{client-CbWe9FBd.d.ts → client-CdM5I962.d.ts} +2 -2
- package/dist/{client-BfiZ3HQd.js → client-DjTPRM8-.js} +2 -2
- package/dist/{client-BfiZ3HQd.js.map → client-DjTPRM8-.js.map} +1 -1
- package/dist/client-QZa2Rq0l.js +1105 -0
- package/dist/client-QZa2Rq0l.js.map +1 -0
- package/dist/client.d.ts +1 -2
- package/dist/client.js +1 -2
- package/dist/codemode/ai.js +6 -6
- package/dist/codemode/ai.js.map +1 -1
- package/dist/context-BkKbAa1R.js +8 -0
- package/dist/context-BkKbAa1R.js.map +1 -0
- package/dist/context-DcbQ8o7k.d.ts +24 -0
- package/dist/context.d.ts +6 -0
- package/dist/context.js +3 -0
- package/dist/{do-oauth-client-provider-DGc5pP0l.d.ts → do-oauth-client-provider--To1Tsjj.d.ts} +20 -5
- package/dist/{do-oauth-client-provider-CswoD5Lu.js → do-oauth-client-provider-B1fVIshX.js} +70 -8
- package/dist/do-oauth-client-provider-B1fVIshX.js.map +1 -0
- package/dist/{index-CuqiHyhT.d.ts → index-CfZ2mfMI.d.ts} +80 -64
- package/dist/{index-DhJCaDWd.d.ts → index-DLuxm_9W.d.ts} +2 -2
- package/dist/index.d.ts +31 -34
- package/dist/index.js +5 -5
- package/dist/mcp/client.d.ts +2 -4
- package/dist/mcp/client.js +2 -1
- package/dist/mcp/do-oauth-client-provider.d.ts +1 -1
- package/dist/mcp/do-oauth-client-provider.js +1 -1
- package/dist/mcp/index.d.ts +23 -16
- package/dist/mcp/index.js +71 -69
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/x402.js +10 -6
- package/dist/mcp/x402.js.map +1 -1
- package/dist/{mcp-Dw5vDrY8.d.ts → mcp-CPSfGUgd.d.ts} +1 -1
- package/dist/observability/index.d.ts +1 -2
- package/dist/observability/index.js +5 -5
- package/dist/react.d.ts +134 -10
- package/dist/react.js +57 -57
- package/dist/react.js.map +1 -1
- package/dist/schedule.d.ts +18 -72
- package/dist/{serializable-CymX8ovI.d.ts → serializable-Crsj26mx.d.ts} +1 -1
- package/dist/serializable.d.ts +1 -1
- package/dist/{src-CwIW7tU2.js → src-BZDh910Z.js} +104 -139
- package/dist/src-BZDh910Z.js.map +1 -0
- package/package.json +31 -16
- package/dist/ai-chat-v5-migration-DBHGW4Hv.js +0 -155
- package/dist/ai-chat-v5-migration-DBHGW4Hv.js.map +0 -1
- package/dist/ai-types-B3aQaFv3.js.map +0 -1
- package/dist/cli.d.ts +0 -8
- package/dist/cli.js.map +0 -1
- package/dist/client-BnO9jNtu.d.ts +0 -5283
- package/dist/client-DZhjV_XA.js +0 -719
- package/dist/client-DZhjV_XA.js.map +0 -1
- package/dist/do-oauth-client-provider-CswoD5Lu.js.map +0 -1
- package/dist/react-Cx9uE2Jd.d.ts +0 -113
- package/dist/src-CwIW7tU2.js.map +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { n as AgentEmail } from "./context-DcbQ8o7k.js";
|
|
1
2
|
import {
|
|
2
|
-
|
|
3
|
+
h as TransportType,
|
|
3
4
|
t as MCPClientManager,
|
|
4
|
-
u as
|
|
5
|
-
} from "./client-
|
|
6
|
-
import { t as Observability } from "./index-
|
|
7
|
-
import { n as MessageType } from "./ai-types-
|
|
5
|
+
u as MCPConnectionState
|
|
6
|
+
} from "./client-BINtT7y-.js";
|
|
7
|
+
import { t as Observability } from "./index-DLuxm_9W.js";
|
|
8
|
+
import { n as MessageType } from "./ai-types-0OnT3FHg.js";
|
|
8
9
|
import {
|
|
9
10
|
Connection,
|
|
10
11
|
Connection as Connection$1,
|
|
@@ -20,7 +21,6 @@ import {
|
|
|
20
21
|
ServerCapabilities,
|
|
21
22
|
Tool
|
|
22
23
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
23
|
-
import { env } from "cloudflare:workers";
|
|
24
24
|
|
|
25
25
|
//#region src/index.d.ts
|
|
26
26
|
|
|
@@ -90,7 +90,7 @@ declare const unstable_callable: (metadata?: CallableMetadata) => void;
|
|
|
90
90
|
type QueueItem<T = string> = {
|
|
91
91
|
id: string;
|
|
92
92
|
payload: T;
|
|
93
|
-
callback: keyof Agent<
|
|
93
|
+
callback: keyof Agent<Cloudflare.Env>;
|
|
94
94
|
created_at: number;
|
|
95
95
|
};
|
|
96
96
|
/**
|
|
@@ -139,9 +139,15 @@ type MCPServersState = {
|
|
|
139
139
|
servers: {
|
|
140
140
|
[id: string]: MCPServer;
|
|
141
141
|
};
|
|
142
|
-
tools: Tool
|
|
143
|
-
|
|
144
|
-
|
|
142
|
+
tools: (Tool & {
|
|
143
|
+
serverId: string;
|
|
144
|
+
})[];
|
|
145
|
+
prompts: (Prompt & {
|
|
146
|
+
serverId: string;
|
|
147
|
+
})[];
|
|
148
|
+
resources: (Resource & {
|
|
149
|
+
serverId: string;
|
|
150
|
+
})[];
|
|
145
151
|
};
|
|
146
152
|
type MCPServer = {
|
|
147
153
|
name: string;
|
|
@@ -152,7 +158,7 @@ type MCPServer = {
|
|
|
152
158
|
capabilities: ServerCapabilities | null;
|
|
153
159
|
};
|
|
154
160
|
declare function getCurrentAgent<
|
|
155
|
-
T extends Agent<
|
|
161
|
+
T extends Agent<Cloudflare.Env> = Agent<Cloudflare.Env>
|
|
156
162
|
>(): {
|
|
157
163
|
agent: T | undefined;
|
|
158
164
|
connection: Connection | undefined;
|
|
@@ -165,13 +171,13 @@ declare function getCurrentAgent<
|
|
|
165
171
|
* @template State State type to store within the Agent
|
|
166
172
|
*/
|
|
167
173
|
declare class Agent<
|
|
168
|
-
Env =
|
|
174
|
+
Env extends Cloudflare.Env = Cloudflare.Env,
|
|
169
175
|
State = unknown,
|
|
170
176
|
Props extends Record<string, unknown> = Record<string, unknown>
|
|
171
177
|
> extends Server<Env, Props> {
|
|
172
178
|
private _state;
|
|
173
179
|
private _disposables;
|
|
174
|
-
private
|
|
180
|
+
private _destroyed;
|
|
175
181
|
private _ParentClass;
|
|
176
182
|
readonly mcp: MCPClientManager;
|
|
177
183
|
/**
|
|
@@ -325,7 +331,7 @@ declare class Agent<
|
|
|
325
331
|
/**
|
|
326
332
|
* Cancel a scheduled task
|
|
327
333
|
* @param id ID of the task to cancel
|
|
328
|
-
* @returns true if the task was cancelled, false
|
|
334
|
+
* @returns true if the task was cancelled, false if the task was not found
|
|
329
335
|
*/
|
|
330
336
|
cancelSchedule(id: string): Promise<boolean>;
|
|
331
337
|
private _scheduleNextAlarm;
|
|
@@ -347,7 +353,6 @@ declare class Agent<
|
|
|
347
353
|
* @returns A map of method names to their metadata
|
|
348
354
|
*/
|
|
349
355
|
private _isCallable;
|
|
350
|
-
private _ensureMcpStateRestored;
|
|
351
356
|
/**
|
|
352
357
|
* Connect to a new MCP Server
|
|
353
358
|
*
|
|
@@ -356,7 +361,8 @@ declare class Agent<
|
|
|
356
361
|
* @param callbackHost Base host for the agent, used for the redirect URI. If not provided, will be derived from the current request.
|
|
357
362
|
* @param agentsPrefix agents routing prefix if not using `agents`
|
|
358
363
|
* @param options MCP client and transport options
|
|
359
|
-
* @returns authUrl
|
|
364
|
+
* @returns Server id and state - either "authenticating" with authUrl, or "ready"
|
|
365
|
+
* @throws If connection or discovery fails
|
|
360
366
|
*/
|
|
361
367
|
addMcpServer(
|
|
362
368
|
serverName: string,
|
|
@@ -370,14 +376,35 @@ declare class Agent<
|
|
|
370
376
|
type?: TransportType;
|
|
371
377
|
};
|
|
372
378
|
}
|
|
373
|
-
): Promise<
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
379
|
+
): Promise<
|
|
380
|
+
| {
|
|
381
|
+
id: string;
|
|
382
|
+
state: typeof MCPConnectionState.AUTHENTICATING;
|
|
383
|
+
authUrl: string;
|
|
384
|
+
}
|
|
385
|
+
| {
|
|
386
|
+
id: string;
|
|
387
|
+
state: typeof MCPConnectionState.READY;
|
|
388
|
+
authUrl?: undefined;
|
|
389
|
+
}
|
|
390
|
+
>;
|
|
378
391
|
removeMcpServer(id: string): Promise<void>;
|
|
379
392
|
getMcpServers(): MCPServersState;
|
|
380
393
|
private broadcastMcpServers;
|
|
394
|
+
/**
|
|
395
|
+
* Handle MCP OAuth callback request if it's an OAuth callback.
|
|
396
|
+
*
|
|
397
|
+
* This method encapsulates the entire OAuth callback flow:
|
|
398
|
+
* 1. Checks if the request is an MCP OAuth callback
|
|
399
|
+
* 2. Processes the OAuth code exchange
|
|
400
|
+
* 3. Establishes the connection if successful
|
|
401
|
+
* 4. Broadcasts MCP server state updates
|
|
402
|
+
* 5. Returns the appropriate HTTP response
|
|
403
|
+
*
|
|
404
|
+
* @param request The incoming HTTP request
|
|
405
|
+
* @returns Response if this was an OAuth callback, null otherwise
|
|
406
|
+
*/
|
|
407
|
+
private handleMcpOAuthCallback;
|
|
381
408
|
/**
|
|
382
409
|
* Handle OAuth callback response using MCPClientManager configuration
|
|
383
410
|
* @param result OAuth callback result
|
|
@@ -390,7 +417,7 @@ declare class Agent<
|
|
|
390
417
|
* Namespace for creating Agent instances
|
|
391
418
|
* @template Agentic Type of the Agent class
|
|
392
419
|
*/
|
|
393
|
-
type AgentNamespace<Agentic extends Agent<
|
|
420
|
+
type AgentNamespace<Agentic extends Agent<Cloudflare.Env>> =
|
|
394
421
|
DurableObjectNamespace<Agentic>;
|
|
395
422
|
/**
|
|
396
423
|
* Agent's durable context
|
|
@@ -457,21 +484,11 @@ type EmailRoutingOptions<Env> = AgentOptions<Env> & {
|
|
|
457
484
|
* @param options The options for routing the email
|
|
458
485
|
* @returns A promise that resolves when the email has been routed
|
|
459
486
|
*/
|
|
460
|
-
declare function routeAgentEmail<Env>(
|
|
487
|
+
declare function routeAgentEmail<Env extends Cloudflare.Env = Cloudflare.Env>(
|
|
461
488
|
email: ForwardableEmailMessage,
|
|
462
489
|
env: Env,
|
|
463
490
|
options: EmailRoutingOptions<Env>
|
|
464
491
|
): Promise<void>;
|
|
465
|
-
type AgentEmail = {
|
|
466
|
-
from: string;
|
|
467
|
-
to: string;
|
|
468
|
-
getRaw: () => Promise<Uint8Array>;
|
|
469
|
-
headers: Headers;
|
|
470
|
-
rawSize: number;
|
|
471
|
-
setReject: (reason: string) => void;
|
|
472
|
-
forward: (rcptTo: string, headers?: Headers) => Promise<void>;
|
|
473
|
-
reply: (options: { from: string; to: string; raw: string }) => Promise<void>;
|
|
474
|
-
};
|
|
475
492
|
type EmailSendOptions = {
|
|
476
493
|
to: string;
|
|
477
494
|
subject: string;
|
|
@@ -493,8 +510,8 @@ type EmailSendOptions = {
|
|
|
493
510
|
* @returns Promise resolving to an Agent instance stub
|
|
494
511
|
*/
|
|
495
512
|
declare function getAgentByName<
|
|
496
|
-
Env,
|
|
497
|
-
T extends Agent<Env>,
|
|
513
|
+
Env extends Cloudflare.Env = Cloudflare.Env,
|
|
514
|
+
T extends Agent<Env> = Agent<Env>,
|
|
498
515
|
Props extends Record<string, unknown> = Record<string, unknown>
|
|
499
516
|
>(
|
|
500
517
|
namespace: AgentNamespace<T>,
|
|
@@ -526,35 +543,34 @@ declare class StreamingResponse {
|
|
|
526
543
|
}
|
|
527
544
|
//#endregion
|
|
528
545
|
export {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
getCurrentAgent as
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
RPCRequest as
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
MCPServersState as m,
|
|
546
|
+
createCatchAllEmailResolver as C,
|
|
547
|
+
routeAgentEmail as D,
|
|
548
|
+
getCurrentAgent as E,
|
|
549
|
+
routeAgentRequest as O,
|
|
550
|
+
createAddressBasedEmailResolver as S,
|
|
551
|
+
getAgentByName as T,
|
|
552
|
+
Schedule as _,
|
|
553
|
+
CallableMetadata as a,
|
|
554
|
+
WSMessage as b,
|
|
555
|
+
EmailResolver as c,
|
|
556
|
+
MCPServer as d,
|
|
557
|
+
MCPServerMessage as f,
|
|
558
|
+
RPCResponse as g,
|
|
559
|
+
RPCRequest as h,
|
|
560
|
+
AgentOptions as i,
|
|
561
|
+
unstable_callable as k,
|
|
562
|
+
EmailRoutingOptions as l,
|
|
563
|
+
QueueItem as m,
|
|
548
564
|
AgentContext as n,
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
565
|
+
Connection$1 as o,
|
|
566
|
+
MCPServersState as p,
|
|
567
|
+
AgentNamespace as r,
|
|
568
|
+
ConnectionContext as s,
|
|
553
569
|
Agent as t,
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
570
|
+
EmailSendOptions as u,
|
|
571
|
+
StateUpdateMessage as v,
|
|
572
|
+
createHeaderBasedEmailResolver as w,
|
|
573
|
+
callable as x,
|
|
574
|
+
StreamingResponse as y
|
|
559
575
|
};
|
|
560
|
-
//# sourceMappingURL=index-
|
|
576
|
+
//# sourceMappingURL=index-CfZ2mfMI.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as BaseEvent, t as MCPObservabilityEvent } from "./mcp-
|
|
1
|
+
import { n as BaseEvent, t as MCPObservabilityEvent } from "./mcp-CPSfGUgd.js";
|
|
2
2
|
|
|
3
3
|
//#region src/observability/agent.d.ts
|
|
4
4
|
|
|
@@ -55,4 +55,4 @@ export {
|
|
|
55
55
|
genericObservability as r,
|
|
56
56
|
Observability as t
|
|
57
57
|
};
|
|
58
|
-
//# sourceMappingURL=index-
|
|
58
|
+
//# sourceMappingURL=index-DLuxm_9W.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,40 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "./
|
|
3
|
-
import "./
|
|
4
|
-
import "./index-DhJCaDWd.js";
|
|
5
|
-
import "./ai-types-D5YoPrBZ.js";
|
|
1
|
+
import { n as AgentEmail } from "./context-DcbQ8o7k.js";
|
|
2
|
+
import { h as TransportType } from "./client-BINtT7y-.js";
|
|
3
|
+
import "./ai-types-0OnT3FHg.js";
|
|
6
4
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
m as MCPServersState,
|
|
5
|
+
C as createCatchAllEmailResolver,
|
|
6
|
+
D as routeAgentEmail,
|
|
7
|
+
E as getCurrentAgent,
|
|
8
|
+
O as routeAgentRequest,
|
|
9
|
+
S as createAddressBasedEmailResolver,
|
|
10
|
+
T as getAgentByName,
|
|
11
|
+
_ as Schedule,
|
|
12
|
+
a as CallableMetadata,
|
|
13
|
+
b as WSMessage,
|
|
14
|
+
c as EmailResolver,
|
|
15
|
+
d as MCPServer,
|
|
16
|
+
f as MCPServerMessage,
|
|
17
|
+
g as RPCResponse,
|
|
18
|
+
h as RPCRequest,
|
|
19
|
+
i as AgentOptions,
|
|
20
|
+
k as unstable_callable,
|
|
21
|
+
l as EmailRoutingOptions,
|
|
22
|
+
m as QueueItem,
|
|
26
23
|
n as AgentContext,
|
|
27
|
-
o as
|
|
28
|
-
p as
|
|
29
|
-
r as
|
|
30
|
-
s as
|
|
24
|
+
o as Connection,
|
|
25
|
+
p as MCPServersState,
|
|
26
|
+
r as AgentNamespace,
|
|
27
|
+
s as ConnectionContext,
|
|
31
28
|
t as Agent,
|
|
32
|
-
u as
|
|
33
|
-
v as
|
|
34
|
-
w as
|
|
35
|
-
x as
|
|
36
|
-
y as
|
|
37
|
-
} from "./index-
|
|
29
|
+
u as EmailSendOptions,
|
|
30
|
+
v as StateUpdateMessage,
|
|
31
|
+
w as createHeaderBasedEmailResolver,
|
|
32
|
+
x as callable,
|
|
33
|
+
y as StreamingResponse
|
|
34
|
+
} from "./index-CfZ2mfMI.js";
|
|
38
35
|
export {
|
|
39
36
|
Agent,
|
|
40
37
|
AgentContext,
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./
|
|
2
|
-
import "./client-
|
|
3
|
-
import "./client-
|
|
4
|
-
import "./do-oauth-client-provider-
|
|
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-
|
|
1
|
+
import "./context-BkKbAa1R.js";
|
|
2
|
+
import "./client-DjTPRM8-.js";
|
|
3
|
+
import "./client-QZa2Rq0l.js";
|
|
4
|
+
import "./do-oauth-client-provider-B1fVIshX.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-BZDh910Z.js";
|
|
6
6
|
|
|
7
7
|
export { Agent, StreamingResponse, callable, createAddressBasedEmailResolver, createCatchAllEmailResolver, createHeaderBasedEmailResolver, getAgentByName, getCurrentAgent, routeAgentEmail, routeAgentRequest, unstable_callable };
|
package/dist/mcp/client.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import { i as getNamespacedData, n as
|
|
2
|
-
|
|
3
|
-
import "../do-oauth-client-provider-DGc5pP0l.js";
|
|
4
|
-
export { MCPClientManager, MCPClientOAuthCallbackConfig, MCPClientOAuthResult, getNamespacedData };
|
|
1
|
+
import { a as MCPConnectionResult, c as RegisterServerOptions, i as MCPClientOAuthResult, l as getNamespacedData, n as MCPClientManagerOptions, o as MCPDiscoverResult, r as MCPClientOAuthCallbackConfig, s as MCPServerOptions, t as MCPClientManager } from "../client-BINtT7y-.js";
|
|
2
|
+
export { MCPClientManager, MCPClientManagerOptions, MCPClientOAuthCallbackConfig, MCPClientOAuthResult, MCPConnectionResult, MCPDiscoverResult, MCPServerOptions, RegisterServerOptions, getNamespacedData };
|
package/dist/mcp/client.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { n as getNamespacedData, t as MCPClientManager } from "../client-
|
|
1
|
+
import { n as getNamespacedData, t as MCPClientManager } from "../client-QZa2Rq0l.js";
|
|
2
|
+
import "../do-oauth-client-provider-B1fVIshX.js";
|
|
2
3
|
|
|
3
4
|
export { MCPClientManager, getNamespacedData };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as DurableObjectOAuthClientProvider, t as AgentsOAuthProvider } from "../do-oauth-client-provider
|
|
1
|
+
import { n as DurableObjectOAuthClientProvider, t as AgentsOAuthProvider } from "../do-oauth-client-provider--To1Tsjj.js";
|
|
2
2
|
export { AgentsOAuthProvider, DurableObjectOAuthClientProvider };
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import "../
|
|
3
|
-
import "../
|
|
4
|
-
import "../index-
|
|
5
|
-
import "../ai-types-D5YoPrBZ.js";
|
|
6
|
-
import { c as ConnectionContext, s as Connection, t as Agent } from "../index-CuqiHyhT.js";
|
|
1
|
+
import "../context-DcbQ8o7k.js";
|
|
2
|
+
import { a as MCPConnectionResult, d as BaseTransportType, f as CORSOptions, i as MCPClientOAuthResult, m as ServeOptions, o as MCPDiscoverResult, p as MaybePromise, r as MCPClientOAuthCallbackConfig, s as MCPServerOptions } from "../client-BINtT7y-.js";
|
|
3
|
+
import "../ai-types-0OnT3FHg.js";
|
|
4
|
+
import { o as Connection, s as ConnectionContext, t as Agent } from "../index-CfZ2mfMI.js";
|
|
7
5
|
import { SSEClientTransport, SSEClientTransportOptions } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
8
6
|
import { StreamableHTTPClientTransport, StreamableHTTPClientTransportOptions } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
9
7
|
import { ElicitRequest, ElicitRequestSchema, ElicitResult, ElicitResult as ElicitResult$1, JSONRPCMessage, MessageExtraInfo } from "@modelcontextprotocol/sdk/types.js";
|
|
10
8
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
11
9
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
12
|
-
import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
10
|
+
import { Transport, TransportSendOptions } from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
13
11
|
|
|
14
12
|
//#region src/mcp/client-transports.d.ts
|
|
15
13
|
/**
|
|
@@ -26,8 +24,6 @@ declare class StreamableHTTPEdgeClientTransport extends StreamableHTTPClientTran
|
|
|
26
24
|
}
|
|
27
25
|
//#endregion
|
|
28
26
|
//#region src/mcp/worker-transport.d.ts
|
|
29
|
-
declare const SUPPORTED_PROTOCOL_VERSIONS: readonly ["2025-03-26", "2025-06-18"];
|
|
30
|
-
type ProtocolVersion = (typeof SUPPORTED_PROTOCOL_VERSIONS)[number];
|
|
31
27
|
interface MCPStorageApi {
|
|
32
28
|
get(): Promise<TransportState | undefined> | TransportState | undefined;
|
|
33
29
|
set(state: TransportState): Promise<void> | void;
|
|
@@ -35,7 +31,6 @@ interface MCPStorageApi {
|
|
|
35
31
|
interface TransportState {
|
|
36
32
|
sessionId?: string;
|
|
37
33
|
initialized: boolean;
|
|
38
|
-
protocolVersion?: ProtocolVersion;
|
|
39
34
|
}
|
|
40
35
|
interface WorkerTransportOptions {
|
|
41
36
|
sessionIdGenerator?: () => string;
|
|
@@ -63,7 +58,6 @@ declare class WorkerTransport implements Transport {
|
|
|
63
58
|
private requestToStreamMapping;
|
|
64
59
|
private requestResponseMap;
|
|
65
60
|
private corsOptions?;
|
|
66
|
-
private protocolVersion?;
|
|
67
61
|
private storage?;
|
|
68
62
|
private stateRestored;
|
|
69
63
|
sessionId?: string;
|
|
@@ -81,6 +75,19 @@ declare class WorkerTransport implements Transport {
|
|
|
81
75
|
*/
|
|
82
76
|
private saveState;
|
|
83
77
|
start(): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Validates the MCP-Protocol-Version header on incoming requests.
|
|
80
|
+
*
|
|
81
|
+
* This performs a simple check: if a version header is present, it must be
|
|
82
|
+
* in the SUPPORTED_PROTOCOL_VERSIONS list. We do not track the negotiated
|
|
83
|
+
* version or enforce version consistency across requests - the SDK handles
|
|
84
|
+
* version negotiation during initialization, and we simply reject any
|
|
85
|
+
* explicitly unsupported versions.
|
|
86
|
+
*
|
|
87
|
+
* - Header present and supported: Accept
|
|
88
|
+
* - Header present and unsupported: 400 Bad Request
|
|
89
|
+
* - Header missing: Accept (version validation is optional)
|
|
90
|
+
*/
|
|
84
91
|
private validateProtocolVersion;
|
|
85
92
|
private getHeaders;
|
|
86
93
|
handleRequest(request: Request, parsedBody?: unknown): Promise<Response>;
|
|
@@ -91,7 +98,7 @@ declare class WorkerTransport implements Transport {
|
|
|
91
98
|
private handleUnsupportedRequest;
|
|
92
99
|
private validateSession;
|
|
93
100
|
close(): Promise<void>;
|
|
94
|
-
send(message: JSONRPCMessage): Promise<void>;
|
|
101
|
+
send(message: JSONRPCMessage, options?: TransportSendOptions): Promise<void>;
|
|
95
102
|
}
|
|
96
103
|
//#endregion
|
|
97
104
|
//#region src/mcp/auth-context.d.ts
|
|
@@ -126,7 +133,7 @@ declare function createMcpHandler(server: McpServer | Server, options?: CreateMc
|
|
|
126
133
|
declare function experimental_createMcpHandler(server: McpServer | Server, options?: CreateMcpHandlerOptions): (request: Request, env: unknown, ctx: ExecutionContext) => Promise<Response>;
|
|
127
134
|
//#endregion
|
|
128
135
|
//#region src/mcp/index.d.ts
|
|
129
|
-
declare abstract class McpAgent<Env =
|
|
136
|
+
declare abstract class McpAgent<Env extends Cloudflare.Env = Cloudflare.Env, State = unknown, Props extends Record<string, unknown> = Record<string, unknown>> extends Agent<Env, State, Props> {
|
|
130
137
|
private _transport?;
|
|
131
138
|
props?: Props;
|
|
132
139
|
abstract server: MaybePromise<McpServer | Server>;
|
|
@@ -144,7 +151,7 @@ declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Re
|
|
|
144
151
|
*/
|
|
145
152
|
getSessionId(): string;
|
|
146
153
|
/** Get the unique WebSocket. SSE transport only. */
|
|
147
|
-
|
|
154
|
+
getWebSocket(): Connection<unknown> | null;
|
|
148
155
|
/** Returns a new transport matching the type of the Agent. */
|
|
149
156
|
private initTransport;
|
|
150
157
|
/** Update and store the props */
|
|
@@ -157,7 +164,7 @@ declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Re
|
|
|
157
164
|
request: req
|
|
158
165
|
}: ConnectionContext): Promise<void>;
|
|
159
166
|
/** Handles MCP Messages for the legacy SSE transport. */
|
|
160
|
-
onSSEMcpMessage(_sessionId: string, messageBody: unknown): Promise<Error | null>;
|
|
167
|
+
onSSEMcpMessage(_sessionId: string, messageBody: unknown, extraInfo?: MessageExtraInfo): Promise<Error | null>;
|
|
161
168
|
/** Elicit user input with a message and schema */
|
|
162
169
|
elicitInput(params: {
|
|
163
170
|
message: string;
|
|
@@ -189,5 +196,5 @@ declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Re
|
|
|
189
196
|
};
|
|
190
197
|
}
|
|
191
198
|
//#endregion
|
|
192
|
-
export { type CreateMcpHandlerOptions, type ElicitRequest, ElicitRequestSchema, type ElicitResult, type MCPClientOAuthCallbackConfig, type MCPClientOAuthResult, McpAgent, type McpAuthContext, SSEEdgeClientTransport, StreamableHTTPEdgeClientTransport, type TransportState, WorkerTransport, type WorkerTransportOptions, createMcpHandler, experimental_createMcpHandler, getMcpAuthContext };
|
|
199
|
+
export { type CreateMcpHandlerOptions, type ElicitRequest, ElicitRequestSchema, type ElicitResult, type MCPClientOAuthCallbackConfig, type MCPClientOAuthResult, type MCPConnectionResult, type MCPDiscoverResult, type MCPServerOptions, McpAgent, type McpAuthContext, SSEEdgeClientTransport, StreamableHTTPEdgeClientTransport, type TransportState, WorkerTransport, type WorkerTransportOptions, createMcpHandler, experimental_createMcpHandler, getMcpAuthContext };
|
|
193
200
|
//# sourceMappingURL=index.d.ts.map
|