agents 0.30.1 → 0.31.0
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 +2 -1
- package/dist/{agent-routing-CDbpVjYq.d.ts → agent-routing-wS1TimZ_.d.ts} +64 -603
- package/dist/agent-routing.d.ts +1 -1
- package/dist/agent-tool-types.d.ts +1 -1
- package/dist/{agent-tools-C8DH8Yii.d.ts → agent-tools-Bamxxb6Y.d.ts} +2 -2
- package/dist/agent-tools.d.ts +1 -1
- package/dist/{ai-iXw0uOGj.d.ts → ai-CDn3Abax.d.ts} +30 -4
- package/dist/{ai-sdk-DRPh2rRa.js → ai-sdk-Kon40i0q.js} +2 -36
- package/dist/ai-sdk-Kon40i0q.js.map +1 -0
- package/dist/ai-sdk-hW3vntnk.d.ts +72 -0
- package/dist/browser/ai.d.ts +1 -1
- package/dist/browser/ai.js +16 -3
- package/dist/browser/ai.js.map +1 -1
- package/dist/browser/index.d.ts +64 -16
- package/dist/browser/index.js +4 -4
- package/dist/browser/tools/ai-sdk.d.ts +7 -70
- package/dist/browser/tools/ai-sdk.js +4 -4
- package/dist/browser/tools/ai-sdk.js.map +1 -1
- package/dist/browser/tools/pi.d.ts +9 -15
- package/dist/browser/tools/pi.js +6 -14
- package/dist/browser/tools/pi.js.map +1 -1
- package/dist/browser/tools/tanstack-ai.d.ts +46 -23
- package/dist/browser/tools/tanstack-ai.js +8 -4
- package/dist/browser/tools/tanstack-ai.js.map +1 -1
- package/dist/{browser-DccPw_wW.js → browser-1eUbPvC2.js} +413 -14
- package/dist/browser-1eUbPvC2.js.map +1 -0
- package/dist/{browser-DlXhSAdf.d.ts → browser-D9RNpJuT.d.ts} +254 -20
- package/dist/browser-tool-BhjCcNVE.d.ts +71 -0
- package/dist/browser-tool-lGnvEBLJ.js +497 -0
- package/dist/browser-tool-lGnvEBLJ.js.map +1 -0
- package/dist/capability-id-B3J8Nok_.js +13 -0
- package/dist/capability-id-B3J8Nok_.js.map +1 -0
- package/dist/chat/index.d.ts +2 -2
- package/dist/chat-sdk/index.d.ts +3 -3
- package/dist/chat-sdk/index.js +1 -1
- package/dist/client-4OlMIJx-.js.map +1 -1
- package/dist/{client-BnYbNT3z.js → client-DMWujQJ1.js} +68 -244
- package/dist/client-DMWujQJ1.js.map +1 -0
- package/dist/{client-C27CtRZr.d.ts → client-wn4-yqGz.d.ts} +9 -7
- package/dist/client.d.ts +1 -1
- package/dist/{connector-DAXBOIIi.js → connector-CM-uuxKM.js} +96 -8
- package/dist/connector-CM-uuxKM.js.map +1 -0
- package/dist/{connector-20DJ6p4k.d.ts → connector-DZ71EjE-.d.ts} +109 -9
- package/dist/experimental/webmcp.js +1 -1
- package/dist/{handler-stateless-Bly_nSH3.js → handler-stateless-B5hU3dxK.js} +35 -2
- package/dist/handler-stateless-B5hU3dxK.js.map +1 -0
- package/dist/{handler-stateless-DxYpJ_XF.d.ts → handler-stateless-C90kD5_R.d.ts} +3 -47
- package/dist/harness/container/index.d.ts +15 -15
- package/dist/harness/opencode/index.js.map +1 -1
- package/dist/harness/pi/index.d.ts +4 -3
- package/dist/harness/pi/index.js +31 -10
- package/dist/harness/pi/index.js.map +1 -1
- package/dist/harness/think/index.d.ts +2 -1
- package/dist/{images-xaDv2Fqe.js → images-CfuRCjwq.js} +1 -5
- package/dist/images-CfuRCjwq.js.map +1 -0
- package/dist/{index-DCxk3OSJ.d.ts → index-8k4qsX1T.d.ts} +2 -28
- package/dist/index.d.ts +14 -14
- package/dist/index.js +2 -2
- package/dist/internal-hosts-Kfp5A392.d.ts +230 -0
- package/dist/internal-kmw70xwR.js.map +1 -1
- package/dist/invoker-BC1SZ3q1.js +26 -0
- package/dist/invoker-BC1SZ3q1.js.map +1 -0
- package/dist/invoker-DoLFPJZV.d.ts +21 -0
- package/dist/mcp/client/index.d.ts +15 -1
- package/dist/mcp/client/index.js +2 -2
- package/dist/mcp/client/x402.d.ts +7 -5
- package/dist/mcp/client/x402.js +34 -1
- package/dist/mcp/client/x402.js.map +1 -1
- package/dist/mcp/index.d.ts +561 -27
- package/dist/mcp/index.js +180 -3
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/server/index.d.ts +1 -1
- package/dist/mcp/server/index.js +1 -1
- package/dist/models/ai-sdk/index.d.ts +2 -2
- package/dist/models/ai-sdk/index.js +1 -1
- package/dist/models/opencode/index.d.ts +2 -2
- package/dist/models/opencode/index.js +1 -1
- package/dist/models/pi-ai/index.d.ts +3 -28
- package/dist/models/pi-ai/index.js +31 -16
- package/dist/models/pi-ai/index.js.map +1 -1
- package/dist/protocol-BEgrJYC5.d.ts +29 -29
- package/dist/react.d.ts +2 -2
- package/dist/routing/index.d.ts +1 -1
- package/dist/serializable.d.ts +1 -1
- package/dist/{session-store-yvwq1f9x.js → session-7CDgVE0z.js} +455 -33
- package/dist/session-7CDgVE0z.js.map +1 -0
- package/dist/{session-store-_IK6dV-w.d.ts → session-store-B7Ca-u1t.d.ts} +8 -1
- package/dist/settings-Dk2il2Hf.js.map +1 -1
- package/dist/{src-DfLzdwlK.js → src-BGolXG_H.js} +18 -2
- package/dist/src-BGolXG_H.js.map +1 -0
- package/dist/sub-routing.d.ts +12 -12
- package/dist/tool-CTp72Jb_.d.ts +10 -10
- package/dist/tool-DoVberpN.d.ts +22 -22
- package/dist/tool-helpers-BodWi4gd.js +256 -0
- package/dist/tool-helpers-BodWi4gd.js.map +1 -0
- package/dist/{transport-CPh7YGiw.d.ts → transport-5moD2pW5.d.ts} +1 -43
- package/dist/types-D2naO3rA.d.ts +49 -0
- package/dist/voice/index.d.ts +1 -1
- package/dist/workflow-types.d.ts +1 -1
- package/dist/workflows.d.ts +1 -1
- package/dist/workflows.js +1 -1
- package/docs/browse-the-web.md +247 -413
- package/docs/harnesses/pi.md +27 -27
- package/docs/index.md +4 -4
- package/docs/mcp-client.md +2 -0
- package/docs/mcp-servers.md +25 -6
- package/docs/models-pi-ai.md +9 -11
- package/docs/models.md +1 -8
- package/docs/securing-mcp-servers.md +113 -302
- package/package.json +8 -3
- package/dist/ai-sdk-DRPh2rRa.js.map +0 -1
- package/dist/browser-DccPw_wW.js.map +0 -1
- package/dist/browser-tool-B1mhifin.js +0 -616
- package/dist/browser-tool-B1mhifin.js.map +0 -1
- package/dist/browser-tool-Cxjk5sgG.d.ts +0 -92
- package/dist/client-BnYbNT3z.js.map +0 -1
- package/dist/connector-DAXBOIIi.js.map +0 -1
- package/dist/handler-stateless-Bly_nSH3.js.map +0 -1
- package/dist/images-xaDv2Fqe.js.map +0 -1
- package/dist/invoker-CG0_p_Wq.d.ts +0 -20
- package/dist/invoker-CHMnoxIA.js +0 -57
- package/dist/invoker-CHMnoxIA.js.map +0 -1
- package/dist/session-store-yvwq1f9x.js.map +0 -1
- package/dist/src-DfLzdwlK.js.map +0 -1
- package/dist/tool-helpers-O5BDVEAY.js +0 -58
- package/dist/tool-helpers-O5BDVEAY.js.map +0 -1
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
import { n as CurrentAgentContext } from "./current-agent-CKgT5d1O.js";
|
|
18
18
|
import { t as AgentEmail } from "./internal_context-BlxFEWfn.js";
|
|
19
19
|
import { r as EmailResolver, s as SendEmailOptions } from "./email-7TatiTnl.js";
|
|
20
|
+
import { r as InternalHostMessage } from "./internal-hosts-Kfp5A392.js";
|
|
20
21
|
import {
|
|
21
22
|
n as Observability,
|
|
22
23
|
r as ObservabilityEvent,
|
|
@@ -24,17 +25,11 @@ import {
|
|
|
24
25
|
} from "./index-YSKgfgg9.js";
|
|
25
26
|
import { t as AgentMcpOAuthProvider } from "./do-oauth-client-provider-DfsUcpc3.js";
|
|
26
27
|
import {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
n as StatelessMcpHandler,
|
|
33
|
-
s as BaseTransportType,
|
|
34
|
-
t as CreateStatelessMcpHandlerOptions,
|
|
35
|
-
u as McpClientOptions
|
|
36
|
-
} from "./handler-stateless-DxYpJ_XF.js";
|
|
37
|
-
import { n as LegacyCallToolResultSchema } from "./invoker-CG0_p_Wq.js";
|
|
28
|
+
i as McpClientOptions,
|
|
29
|
+
o as TransportType,
|
|
30
|
+
t as BaseTransportType
|
|
31
|
+
} from "./types-D2naO3rA.js";
|
|
32
|
+
import { t as LegacyCallToolResultSchema } from "./invoker-DoLFPJZV.js";
|
|
38
33
|
import { t as MessageType } from "./types-6Zo2zfoO.js";
|
|
39
34
|
import {
|
|
40
35
|
a as ScheduleCriteria,
|
|
@@ -64,10 +59,8 @@ import {
|
|
|
64
59
|
DiscoverResult,
|
|
65
60
|
ElicitRequest,
|
|
66
61
|
ElicitRequest as ElicitRequest$1,
|
|
67
|
-
ElicitRequest as ElicitRequest$2,
|
|
68
62
|
ElicitResult,
|
|
69
|
-
ElicitResult as ElicitResult$
|
|
70
|
-
ElicitResult as ElicitResult$3,
|
|
63
|
+
ElicitResult as ElicitResult$1,
|
|
71
64
|
GetPromptRequest,
|
|
72
65
|
JSONRPCMessage,
|
|
73
66
|
MessageExtraInfo,
|
|
@@ -86,33 +79,6 @@ import {
|
|
|
86
79
|
Transport,
|
|
87
80
|
TransportSendOptions
|
|
88
81
|
} from "@modelcontextprotocol/client";
|
|
89
|
-
import {
|
|
90
|
-
ElicitRequestSchema,
|
|
91
|
-
ElicitResult as ElicitResult$1,
|
|
92
|
-
InitializeRequestParams,
|
|
93
|
-
JSONRPCMessage as JSONRPCMessage$1,
|
|
94
|
-
MessageExtraInfo as MessageExtraInfo$1,
|
|
95
|
-
RequestId
|
|
96
|
-
} from "@modelcontextprotocol/sdk/types.js";
|
|
97
|
-
import { McpServerFactory } from "@modelcontextprotocol/server";
|
|
98
|
-
import { McpServer as McpServer$1 } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
99
|
-
import { Server as Server$1 } from "@modelcontextprotocol/sdk/server/index.js";
|
|
100
|
-
import {
|
|
101
|
-
EventStore as EventStore$1,
|
|
102
|
-
StreamId as StreamId$1,
|
|
103
|
-
WebStandardStreamableHTTPServerTransport as WebStandardStreamableHTTPServerTransport$1,
|
|
104
|
-
WebStandardStreamableHTTPServerTransportOptions
|
|
105
|
-
} from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
|
|
106
|
-
import {
|
|
107
|
-
Transport as Transport$1,
|
|
108
|
-
TransportSendOptions as TransportSendOptions$1
|
|
109
|
-
} from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
110
|
-
import {
|
|
111
|
-
EventId,
|
|
112
|
-
EventStore,
|
|
113
|
-
StreamId
|
|
114
|
-
} from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
115
|
-
import { AuthInfo } from "@modelcontextprotocol/sdk/server/auth/types.js";
|
|
116
82
|
|
|
117
83
|
//#region src/observability/tracing/tracer.d.ts
|
|
118
84
|
type InvocationScopeOptions = {
|
|
@@ -344,11 +310,13 @@ type Promisify<T> = T extends Promise<unknown> ? T : Promise<T>;
|
|
|
344
310
|
* are excluded — only user-defined methods on the subclass are exposed.
|
|
345
311
|
*/
|
|
346
312
|
type DynamicAgentStub<T extends Agent> = {
|
|
347
|
-
[
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
313
|
+
[
|
|
314
|
+
K in keyof T as K extends keyof Agent
|
|
315
|
+
? never
|
|
316
|
+
: T[K] extends (...args: never[]) => unknown
|
|
317
|
+
? K
|
|
318
|
+
: never
|
|
319
|
+
]: T[K] extends (...args: infer A) => infer R
|
|
352
320
|
? (...args: A) => Promisify<R>
|
|
353
321
|
: never;
|
|
354
322
|
};
|
|
@@ -1023,479 +991,19 @@ declare class DynamicAgents {
|
|
|
1023
991
|
}>;
|
|
1024
992
|
}
|
|
1025
993
|
//#endregion
|
|
1026
|
-
//#region src/
|
|
1027
|
-
interface Disposable {
|
|
1028
|
-
dispose(): void;
|
|
1029
|
-
}
|
|
1030
|
-
type Event<T> = (listener: (e: T) => void) => Disposable;
|
|
1031
|
-
declare class Emitter<T> implements Disposable {
|
|
1032
|
-
private _listeners;
|
|
1033
|
-
readonly event: Event<T>;
|
|
1034
|
-
fire(data: T): void;
|
|
1035
|
-
dispose(): void;
|
|
1036
|
-
}
|
|
1037
|
-
//#endregion
|
|
1038
|
-
//#region src/mcp/client/transports.d.ts
|
|
1039
|
-
/**
|
|
1040
|
-
* @deprecated Use SSEClientTransport from @modelcontextprotocol/client instead. This alias will be removed in the next major version.
|
|
1041
|
-
*/
|
|
1042
|
-
declare class SSEEdgeClientTransport extends SSEClientTransport {
|
|
1043
|
-
constructor(url: URL, options: SSEClientTransportOptions);
|
|
1044
|
-
}
|
|
1045
|
-
/**
|
|
1046
|
-
* @deprecated Use StreamableHTTPClientTransport from @modelcontextprotocol/client instead. This alias will be removed in the next major version.
|
|
1047
|
-
*/
|
|
1048
|
-
declare class StreamableHTTPEdgeClientTransport extends StreamableHTTPClientTransport {
|
|
1049
|
-
constructor(url: URL, options: StreamableHTTPClientTransportOptions);
|
|
1050
|
-
}
|
|
1051
|
-
//#endregion
|
|
1052
|
-
//#region src/mcp/server/worker-transport.d.ts
|
|
1053
|
-
/**
|
|
1054
|
-
* Pluggable storage adapter for persisting `WorkerTransport` state across
|
|
1055
|
-
* Durable Object hibernation / restart cycles.
|
|
1056
|
-
*
|
|
1057
|
-
* A typical implementation reads/writes a single key on `this.ctx.storage`
|
|
1058
|
-
* inside a Durable Object or Agent.
|
|
1059
|
-
*/
|
|
1060
|
-
interface MCPStorageApi {
|
|
1061
|
-
get(): Promise<TransportState | undefined> | TransportState | undefined;
|
|
1062
|
-
set(state: TransportState): Promise<void> | void;
|
|
1063
|
-
}
|
|
1064
|
-
/** Shape of the persisted transport state. */
|
|
1065
|
-
interface TransportState {
|
|
1066
|
-
sessionId?: string;
|
|
1067
|
-
initialized: boolean;
|
|
1068
|
-
initializeParams?: InitializeRequestParams;
|
|
1069
|
-
}
|
|
1070
|
-
interface WorkerTransportOptions extends WebStandardStreamableHTTPServerTransportOptions {
|
|
1071
|
-
/**
|
|
1072
|
-
* CORS options applied to every response and to OPTIONS preflight.
|
|
1073
|
-
* Defaults: `origin: *`, expose `mcp-session-id`, allow the standard MCP
|
|
1074
|
-
* methods/headers, max-age 86400.
|
|
1075
|
-
*/
|
|
1076
|
-
corsOptions?: CORSOptions;
|
|
1077
|
-
/**
|
|
1078
|
-
* Optional storage adapter for persisting transport state across DO
|
|
1079
|
-
* hibernation / restart. Use this to keep an MCP session alive across
|
|
1080
|
-
* Durable Object wake-ups.
|
|
1081
|
-
*/
|
|
1082
|
-
storage?: MCPStorageApi;
|
|
1083
|
-
}
|
|
1084
|
-
declare class WorkerTransport extends WebStandardStreamableHTTPServerTransport$1 {
|
|
1085
|
-
private readonly _corsOptions?;
|
|
1086
|
-
private readonly _storage?;
|
|
1087
|
-
private _stateRestored;
|
|
1088
|
-
private _capturedInitializeParams?;
|
|
1089
|
-
private _userOnSessionInitialized?;
|
|
1090
|
-
private _bridgeInstalled;
|
|
1091
|
-
/**
|
|
1092
|
-
* Request ids whose SSE stream was deliberately torn down via
|
|
1093
|
-
* `closeSSEStream`. The SDK's `send()` throws "No connection established"
|
|
1094
|
-
* when a request id has no stream — a race that surfaces whenever the
|
|
1095
|
-
* server's tool handler resolves *after* the caller closed the stream
|
|
1096
|
-
* (e.g. polling-style early-close, or test fixtures closing mid-flight).
|
|
1097
|
-
* We swallow `send()` for these ids so the rejection doesn't bubble out
|
|
1098
|
-
* of the protocol layer as an unhandled rejection. Mirrors the
|
|
1099
|
-
* silent-noop behaviour of the pre-refactor `WorkerTransport`.
|
|
1100
|
-
*/
|
|
1101
|
-
private readonly _closedRequestIds;
|
|
1102
|
-
constructor(options?: WorkerTransportOptions);
|
|
1103
|
-
/**
|
|
1104
|
-
* Backwards-compatible alias for the SDK's internal `_started` flag.
|
|
1105
|
-
* Several callers and tests check `transport.started` directly.
|
|
1106
|
-
*/
|
|
1107
|
-
get started(): boolean;
|
|
1108
|
-
/**
|
|
1109
|
-
* Top-level request entry point. Handles CORS preflight, restores any
|
|
1110
|
-
* persisted state on first invocation, then delegates to the SDK transport
|
|
1111
|
-
* and finally appends CORS headers to whatever response comes back.
|
|
1112
|
-
*/
|
|
1113
|
-
handleRequest(
|
|
1114
|
-
request: Request,
|
|
1115
|
-
options?: {
|
|
1116
|
-
parsedBody?: unknown;
|
|
1117
|
-
authInfo?: AuthInfo;
|
|
1118
|
-
}
|
|
1119
|
-
): Promise<Response>;
|
|
1120
|
-
/**
|
|
1121
|
-
* The SDK's 405 responses advertise `Allow: GET, POST, DELETE` because
|
|
1122
|
-
* OPTIONS is handled outside the SDK. Since our wrapper *does* handle
|
|
1123
|
-
* OPTIONS, advertise it in `Allow` so clients can probe accurately.
|
|
1124
|
-
*/
|
|
1125
|
-
private normalizeAllowHeader;
|
|
1126
|
-
closeSSEStream(requestId: RequestId): void;
|
|
1127
|
-
close(): Promise<void>;
|
|
1128
|
-
/**
|
|
1129
|
-
* Swallow two classes of message that would otherwise surface as
|
|
1130
|
-
* unhandled rejections from the SDK transport's `send()`:
|
|
1131
|
-
*
|
|
1132
|
-
* 1. Replayed initialize responses (the `RESTORE_REQUEST_ID` sentinel)
|
|
1133
|
-
* — we synthesise these in `restoreState()` to rebuild server
|
|
1134
|
-
* capabilities; there's no real client waiting for the response.
|
|
1135
|
-
* 2. Sends for a request id whose SSE stream has been deliberately
|
|
1136
|
-
* closed via `closeSSEStream`. The protocol layer's tool-handler
|
|
1137
|
-
* promise may settle after the close, and the SDK's `send()` throws
|
|
1138
|
-
* "No connection established" — a race the pre-refactor transport
|
|
1139
|
-
* silently swallowed.
|
|
1140
|
-
*
|
|
1141
|
-
* Everything else is delegated. We use `await super.send(...)` rather
|
|
1142
|
-
* than `return super.send(...)` so any rejection is observed inside this
|
|
1143
|
-
* async frame; without the await, the test runner's
|
|
1144
|
-
* unhandled-rejection tracker can fire before the caller's own `await`
|
|
1145
|
-
* observes it.
|
|
1146
|
-
*/
|
|
1147
|
-
send(
|
|
1148
|
-
message: JSONRPCMessage$1,
|
|
1149
|
-
options?: TransportSendOptions$1
|
|
1150
|
-
): Promise<void>;
|
|
1151
|
-
private getCorsHeaders;
|
|
1152
|
-
private withCorsHeaders;
|
|
1153
|
-
private installOnSessionInitializedBridge;
|
|
1154
|
-
private captureInitializeParams;
|
|
1155
|
-
private restoreState;
|
|
1156
|
-
private saveState;
|
|
1157
|
-
}
|
|
1158
|
-
//#endregion
|
|
1159
|
-
//#region src/mcp/server/handler-legacy.d.ts
|
|
1160
|
-
/** Options for the retained SDK v1, sessionful handler. */
|
|
1161
|
-
interface CreateLegacyMcpHandlerOptions extends WorkerTransportOptions {
|
|
1162
|
-
/** Exact route handled by this handler. @default "/mcp" */
|
|
1163
|
-
route?: string;
|
|
1164
|
-
/** Application props exposed through {@link getMcpAuthContext}. */
|
|
1165
|
-
authContext?: McpAuthContext;
|
|
1166
|
-
/** Pre-created sessionful transport. */
|
|
1167
|
-
transport?: WorkerTransport;
|
|
1168
|
-
}
|
|
1169
|
-
type CreateMcpHandlerOptions$1 = CreateLegacyMcpHandlerOptions;
|
|
1170
|
-
type LegacyMcpHandler = (
|
|
1171
|
-
request: Request,
|
|
1172
|
-
env: unknown,
|
|
1173
|
-
ctx: ExecutionContext
|
|
1174
|
-
) => Promise<Response>;
|
|
1175
|
-
/**
|
|
1176
|
-
* Create a sessionful Legacy MCP handler backed by SDK v1.
|
|
1177
|
-
*
|
|
1178
|
-
* New Stateless servers should use `createMcpHandler` from
|
|
1179
|
-
* `agents/mcp/server` instead.
|
|
1180
|
-
*/
|
|
1181
|
-
declare function createLegacyMcpHandler(
|
|
1182
|
-
server: McpServer$1 | Server$1,
|
|
1183
|
-
options?: CreateLegacyMcpHandlerOptions
|
|
1184
|
-
): LegacyMcpHandler;
|
|
1185
|
-
//#endregion
|
|
1186
|
-
//#region src/mcp/server/handler-compat.d.ts
|
|
1187
|
-
/**
|
|
1188
|
-
* @deprecated Passing an SDK v1 server to createMcpHandler is deprecated and
|
|
1189
|
-
* will be removed in the next major version. Pass an SDK v2 factory to
|
|
1190
|
-
* createMcpHandler. Use createLegacyMcpHandler only to temporarily retain
|
|
1191
|
-
* sessionful SDK v1 behavior while migrating.
|
|
1192
|
-
*/
|
|
1193
|
-
declare function createMcpHandler$1(
|
|
1194
|
-
server: McpServer$1 | Server$1,
|
|
1195
|
-
options?: CreateMcpHandlerOptions$1
|
|
1196
|
-
): LegacyMcpHandler;
|
|
1197
|
-
declare function createMcpHandler$1(
|
|
1198
|
-
factory: McpServerFactory,
|
|
1199
|
-
options?: CreateStatelessMcpHandlerOptions
|
|
1200
|
-
): StatelessMcpHandler;
|
|
1201
|
-
/**
|
|
1202
|
-
* @deprecated Pass an SDK v2 factory to createMcpHandler.
|
|
1203
|
-
* experimental_createMcpHandler will be removed in the next major version.
|
|
1204
|
-
* Use createLegacyMcpHandler only to temporarily retain sessionful SDK v1
|
|
1205
|
-
* behavior while migrating.
|
|
1206
|
-
*/
|
|
1207
|
-
declare function experimental_createMcpHandler(
|
|
1208
|
-
server: McpServer$1 | Server$1,
|
|
1209
|
-
options?: CreateMcpHandlerOptions$1
|
|
1210
|
-
): LegacyMcpHandler;
|
|
1211
|
-
//#endregion
|
|
1212
|
-
//#region src/mcp/server/event-store.d.ts
|
|
1213
|
-
/**
|
|
1214
|
-
* Durable Object–backed {@link EventStore} for SSE resumability.
|
|
1215
|
-
*
|
|
1216
|
-
* Default for `McpAgent`. Override `McpAgent.getEventStore()` to swap
|
|
1217
|
-
* or disable.
|
|
1218
|
-
*
|
|
1219
|
-
* ## Storage layout
|
|
1220
|
-
*
|
|
1221
|
-
* Events are stored under `__mcp_event__:<streamId>:<seqHex>`, where
|
|
1222
|
-
* `<seqHex>` is a 16-char zero-padded counter so events in a stream
|
|
1223
|
-
* sort lexicographically and `getStreamIdForEventId` can recover the
|
|
1224
|
-
* stream from `eventId` without a storage hit.
|
|
1225
|
-
*
|
|
1226
|
-
* ## Lifecycle
|
|
1227
|
-
*
|
|
1228
|
-
* Each POST tool-call stream's events live only until the final
|
|
1229
|
-
* response is delivered. The transport calls {@link clearStream}
|
|
1230
|
-
* immediately after writing the close frame, so storage growth is
|
|
1231
|
-
* bounded by the in-flight POST streams plus the standalone GET
|
|
1232
|
-
* stream. There is no background sweep — quiescent agents do no work,
|
|
1233
|
-
* and the DO itself dies with the session.
|
|
1234
|
-
*
|
|
1235
|
-
* Standalone GET stream events (`_GET_stream`) are *not* cleared
|
|
1236
|
-
* automatically; they accumulate for the lifetime of the DO. Bounded
|
|
1237
|
-
* by session length in practice.
|
|
1238
|
-
*
|
|
1239
|
-
* Trade-off: if the client TCP connection dies *after* the close
|
|
1240
|
-
* frame has been enqueued on the WS but before the bytes reach the
|
|
1241
|
-
* client, the final message is unreplayable. Every earlier event in
|
|
1242
|
-
* the stream is still replayable while the in-flight stream is open.
|
|
1243
|
-
*
|
|
1244
|
-
* ## Stream id constraints
|
|
1245
|
-
*
|
|
1246
|
-
* `streamId` MUST NOT contain `:`. `storeEvent` asserts this so
|
|
1247
|
-
* embedders using custom stream ids fail loudly rather than risk
|
|
1248
|
-
* prefix-scan collisions (e.g. clearing `a` accidentally hitting
|
|
1249
|
-
* `a:b`). Default ids (`connection.id` UUIDs and the literal
|
|
1250
|
-
* `_GET_stream`) already satisfy this.
|
|
1251
|
-
*/
|
|
1252
|
-
declare class DurableObjectEventStore implements EventStore {
|
|
1253
|
-
private static readonly EVENT_KEY_PREFIX;
|
|
1254
|
-
private static readonly SEQ_PAD;
|
|
1255
|
-
/** DO storage caps multi-key delete at 128. */
|
|
1256
|
-
private static readonly DELETE_CHUNK;
|
|
1257
|
-
/** Defensive ceiling on a single replay batch. A live stream's
|
|
1258
|
-
* event count is small (progress notifications + final result);
|
|
1259
|
-
* this is here so a pathological history can't OOM the DO. */
|
|
1260
|
-
private static readonly REPLAY_LIMIT;
|
|
1261
|
-
private readonly storage;
|
|
1262
|
-
/** In-memory seq counters per stream, rehydrated lazily from storage. */
|
|
1263
|
-
private readonly seqByStream;
|
|
1264
|
-
private readonly seqInit;
|
|
1265
|
-
constructor(storage: DurableObjectStorage);
|
|
1266
|
-
storeEvent(streamId: StreamId, message: JSONRPCMessage$1): Promise<EventId>;
|
|
1267
|
-
getStreamIdForEventId(eventId: EventId): Promise<StreamId | undefined>;
|
|
1268
|
-
replayEventsAfter(
|
|
1269
|
-
lastEventId: EventId,
|
|
1270
|
-
{
|
|
1271
|
-
send
|
|
1272
|
-
}: {
|
|
1273
|
-
send: (eventId: EventId, message: JSONRPCMessage$1) => Promise<void>;
|
|
1274
|
-
}
|
|
1275
|
-
): Promise<StreamId>;
|
|
1276
|
-
/**
|
|
1277
|
-
* Drop the event log for a single stream. Called by the transport
|
|
1278
|
-
* immediately after a POST's final response has been written to the
|
|
1279
|
-
* wire — no future `Last-Event-ID` for this stream is expected to
|
|
1280
|
-
* resolve.
|
|
1281
|
-
*
|
|
1282
|
-
* Lists and deletes in chunks of {@link DELETE_CHUNK} (128, the DO
|
|
1283
|
-
* storage cap) so we never load the entire event log into memory.
|
|
1284
|
-
* After deleting, the next `list` call won't see the deleted keys,
|
|
1285
|
-
* so passing `start: <prefix>` again is enough — no cursor bookkeeping.
|
|
1286
|
-
*/
|
|
1287
|
-
clearStream(streamId: StreamId): Promise<void>;
|
|
1288
|
-
private ensureSeqLoaded;
|
|
1289
|
-
}
|
|
1290
|
-
//#endregion
|
|
1291
|
-
//#region src/mcp/server/transport.d.ts
|
|
1292
|
-
/**
|
|
1293
|
-
* An {@link EventStore} that supports dropping all events for a single
|
|
1294
|
-
* stream id. Implemented by {@link DurableObjectEventStore}.
|
|
1295
|
-
*/
|
|
1296
|
-
interface ClearableEventStore extends EventStore$1 {
|
|
1297
|
-
clearStream(streamId: StreamId$1): Promise<void>;
|
|
1298
|
-
}
|
|
1299
|
-
//#endregion
|
|
1300
|
-
//#region src/mcp/server/legacy-agent.d.ts
|
|
994
|
+
//#region src/mcp/rpc.d.ts
|
|
1301
995
|
/**
|
|
1302
|
-
*
|
|
1303
|
-
*
|
|
1304
|
-
*
|
|
1305
|
-
* route until clients transition and sessions drain.
|
|
996
|
+
* Structural shape of a Durable Object that serves MCP over RPC, such as
|
|
997
|
+
* `McpAgent`. Declared structurally so the client side does not pull the
|
|
998
|
+
* legacy server (and `@modelcontextprotocol/sdk`) into its types.
|
|
1306
999
|
*/
|
|
1307
|
-
|
|
1308
|
-
Env extends Cloudflare.Env = Cloudflare.Env,
|
|
1309
|
-
State = unknown,
|
|
1310
|
-
Props extends Record<string, unknown> = Record<string, unknown>
|
|
1311
|
-
> extends Agent<Env, State, Props> {
|
|
1312
|
-
private _transport?;
|
|
1313
|
-
private _pendingElicitations;
|
|
1314
|
-
props?: Props;
|
|
1315
|
-
shouldSendProtocolMessages(
|
|
1316
|
-
_connection: Connection,
|
|
1317
|
-
ctx: ConnectionContext
|
|
1318
|
-
): boolean;
|
|
1319
|
-
abstract server: MaybePromise<McpServer$1 | Server$1>;
|
|
1320
|
-
abstract init(): Promise<void>;
|
|
1321
|
-
setInitializeRequest(initializeRequest: JSONRPCMessage$1): Promise<void>;
|
|
1322
|
-
getInitializeRequest(): Promise<JSONRPCMessage$1 | undefined>;
|
|
1323
|
-
/**
|
|
1324
|
-
* End a streamable HTTP session (`DELETE`). Teardown is deferred to the
|
|
1325
|
-
* agent's alarm (#1625), so the stored initialize request is cleared too:
|
|
1326
|
-
* every route treats a session without one as unknown, which makes requests
|
|
1327
|
-
* carrying the terminated session ID get 404 as the spec requires. Teardown
|
|
1328
|
-
* is scheduled first, so a failure part-way leaves a session the client can
|
|
1329
|
-
* `DELETE` again rather than one that is never cleaned up.
|
|
1330
|
-
*
|
|
1331
|
-
* @internal
|
|
1332
|
-
*/
|
|
1333
|
-
_cf_terminateSession(): Promise<void>;
|
|
1334
|
-
/**
|
|
1335
|
-
* Storage key prefix for the `streamId -> requestIds` mapping used
|
|
1336
|
-
* to support POST stream resumption across WebSocket reconnects.
|
|
1337
|
-
*
|
|
1338
|
-
* @internal
|
|
1339
|
-
*/
|
|
1340
|
-
private static readonly STREAM_REQS_KEY_PREFIX;
|
|
1341
|
-
/** Persist the `requestIds` for a POST stream. @internal */
|
|
1342
|
-
setStreamRequestIds(streamId: string, requestIds: RequestId[]): Promise<void>;
|
|
1343
|
-
/** Read the persisted `requestIds` for a POST stream. @internal */
|
|
1344
|
-
getStreamRequestIds(streamId: string): Promise<RequestId[] | undefined>;
|
|
1345
|
-
/** Drop the persisted `requestIds` for a POST stream. @internal */
|
|
1346
|
-
deleteStreamRequestIds(streamId: string): Promise<void>;
|
|
1347
|
-
/**
|
|
1348
|
-
* Reverse lookup: find which POST stream a given `requestId` belongs
|
|
1349
|
-
* to, and return the stream's full `requestIds` list in the same
|
|
1350
|
-
* pass. Used by the transport when the originating WS has dropped,
|
|
1351
|
-
* so `send()` can still record events for replay and decide whether
|
|
1352
|
-
* the stream is fully responded — mirrors the SDK's
|
|
1353
|
-
* `_requestToStreamMapping` which outlives connection loss.
|
|
1354
|
-
*
|
|
1355
|
-
* Returning `requestIds` alongside `streamId` lets `send()` skip a
|
|
1356
|
-
* second `getStreamRequestIds` read on the same key.
|
|
1357
|
-
*
|
|
1358
|
-
* O(n) in the number of in-flight POST streams — single-digit in
|
|
1359
|
-
* practice since each stream is cleaned up on its final response.
|
|
1360
|
-
* The `limit` is a defensive ceiling so an abandoned-POST leak can't
|
|
1361
|
-
* unbounded-load this scan; if you hit it, something else has gone
|
|
1362
|
-
* wrong and `send()` will throw `No active stream found`.
|
|
1363
|
-
*
|
|
1364
|
-
* @internal
|
|
1365
|
-
*/
|
|
1366
|
-
getStreamForRequestId(requestId: RequestId): Promise<
|
|
1367
|
-
| {
|
|
1368
|
-
streamId: string;
|
|
1369
|
-
requestIds: RequestId[];
|
|
1370
|
-
}
|
|
1371
|
-
| undefined
|
|
1372
|
-
>;
|
|
1373
|
-
/** Read the transport type for this agent.
|
|
1374
|
-
* This relies on the naming scheme being `sse:${sessionId}`,
|
|
1375
|
-
* `streamable-http:${sessionId}`, or `rpc:${sessionId}`.
|
|
1376
|
-
*/
|
|
1377
|
-
getTransportType(): BaseTransportType;
|
|
1378
|
-
/** Read the sessionId for this agent.
|
|
1379
|
-
* This relies on the naming scheme being `sse:${sessionId}`
|
|
1380
|
-
* or `streamable-http:${sessionId}`.
|
|
1381
|
-
*/
|
|
1382
|
-
getSessionId(): string;
|
|
1383
|
-
/** Get the unique WebSocket. SSE transport only. */
|
|
1384
|
-
getWebSocket(): Connection<unknown> | null;
|
|
1385
|
-
/**
|
|
1386
|
-
* Returns options for configuring the RPC server transport.
|
|
1387
|
-
* Override this method to customize RPC transport behavior (e.g., timeout).
|
|
1388
|
-
*
|
|
1389
|
-
* @example
|
|
1390
|
-
* ```typescript
|
|
1391
|
-
* class MyMCP extends McpAgent {
|
|
1392
|
-
* protected getRpcTransportOptions() {
|
|
1393
|
-
* return { timeout: 120000 }; // 2 minutes
|
|
1394
|
-
* }
|
|
1395
|
-
* }
|
|
1396
|
-
* ```
|
|
1397
|
-
*/
|
|
1398
|
-
protected getRpcTransportOptions(): RPCServerTransportOptions;
|
|
1399
|
-
/**
|
|
1400
|
-
* Returns the {@link EventStore} for SSE resumability. Defaults to a
|
|
1401
|
-
* {@link DurableObjectEventStore} backed by this agent's storage,
|
|
1402
|
-
* letting clients reconnect with `Last-Event-ID` after the Cloudflare
|
|
1403
|
-
* edge closes an idle SSE stream (~5 minute watchdog) instead of
|
|
1404
|
-
* relying on a server-side keepalive that would block hibernation.
|
|
1405
|
-
*
|
|
1406
|
-
* Per-stream events are cleared by the transport immediately after
|
|
1407
|
-
* the final response is written to the wire, so there's no
|
|
1408
|
-
* background cleanup — storage cost is bounded by the in-flight
|
|
1409
|
-
* streams alone.
|
|
1410
|
-
*
|
|
1411
|
-
* Override to disable (`return undefined`) or swap implementations.
|
|
1412
|
-
*/
|
|
1413
|
-
protected getEventStore(): EventStore | undefined;
|
|
1414
|
-
/** Returns a new transport matching the type of the Agent. */
|
|
1415
|
-
private initTransport;
|
|
1416
|
-
/** Update and store the props */
|
|
1417
|
-
updateProps(props?: Props): Promise<void>;
|
|
1418
|
-
reinitializeServer(): Promise<void>;
|
|
1419
|
-
/** Sets up the MCP transport and server every time the Agent is started.*/
|
|
1420
|
-
onStart(props?: Props): Promise<void>;
|
|
1421
|
-
/** Validates new WebSocket connections. */
|
|
1422
|
-
onConnect(
|
|
1423
|
-
conn: Connection,
|
|
1424
|
-
{ request: req }: ConnectionContext
|
|
1425
|
-
): Promise<void>;
|
|
1426
|
-
/** Handles MCP Messages for the legacy SSE transport. */
|
|
1427
|
-
onSSEMcpMessage(
|
|
1428
|
-
_sessionId: string,
|
|
1429
|
-
messageBody: unknown,
|
|
1430
|
-
extraInfo?: MessageExtraInfo$1
|
|
1431
|
-
): Promise<Error | null>;
|
|
1432
|
-
/** Elicit user input with a message and schema */
|
|
1433
|
-
elicitInput(
|
|
1434
|
-
params: {
|
|
1435
|
-
message: string;
|
|
1436
|
-
requestedSchema: unknown;
|
|
1437
|
-
},
|
|
1438
|
-
options?: {
|
|
1439
|
-
relatedRequestId?: RequestId;
|
|
1440
|
-
}
|
|
1441
|
-
): Promise<ElicitResult$1>;
|
|
1442
|
-
/** Handle elicitation responses via in-memory resolver */
|
|
1443
|
-
private _handleElicitationResponse;
|
|
1444
|
-
/**
|
|
1445
|
-
* Handle an RPC message for MCP
|
|
1446
|
-
* This method is called by the RPC stub to process MCP messages
|
|
1447
|
-
* @param message The JSON-RPC message(s) to handle
|
|
1448
|
-
* @returns The response message(s) or undefined
|
|
1449
|
-
*/
|
|
1000
|
+
type McpRpcAgent = Agent<Cloudflare.Env, unknown, Record<string, unknown>> & {
|
|
1450
1001
|
handleMcpMessage(
|
|
1451
|
-
message: JSONRPCMessage
|
|
1452
|
-
): Promise<JSONRPCMessage
|
|
1453
|
-
|
|
1454
|
-
* Defaults to Streamable HTTP transport.
|
|
1455
|
-
*/
|
|
1456
|
-
static serve(
|
|
1457
|
-
path: string,
|
|
1458
|
-
{ binding, corsOptions, transport, jurisdiction }?: ServeOptions
|
|
1459
|
-
): {
|
|
1460
|
-
fetch<Env>(
|
|
1461
|
-
this: void,
|
|
1462
|
-
request: Request,
|
|
1463
|
-
env: Env,
|
|
1464
|
-
ctx: ExecutionContext
|
|
1465
|
-
): Promise<Response>;
|
|
1466
|
-
};
|
|
1467
|
-
/**
|
|
1468
|
-
* Legacy api
|
|
1469
|
-
**/
|
|
1470
|
-
static mount(
|
|
1471
|
-
path: string,
|
|
1472
|
-
opts?: Omit<ServeOptions, "transport">
|
|
1473
|
-
): {
|
|
1474
|
-
fetch<Env>(
|
|
1475
|
-
this: void,
|
|
1476
|
-
request: Request,
|
|
1477
|
-
env: Env,
|
|
1478
|
-
ctx: ExecutionContext
|
|
1479
|
-
): Promise<Response>;
|
|
1480
|
-
};
|
|
1481
|
-
static serveSSE(
|
|
1482
|
-
path: string,
|
|
1483
|
-
opts?: Omit<ServeOptions, "transport">
|
|
1484
|
-
): {
|
|
1485
|
-
fetch<Env>(
|
|
1486
|
-
this: void,
|
|
1487
|
-
request: Request,
|
|
1488
|
-
env: Env,
|
|
1489
|
-
ctx: ExecutionContext
|
|
1490
|
-
): Promise<Response>;
|
|
1491
|
-
};
|
|
1492
|
-
}
|
|
1493
|
-
//#endregion
|
|
1494
|
-
//#region src/mcp/rpc.d.ts
|
|
1495
|
-
type JSONRPCMessage$2 = JSONRPCMessage$1;
|
|
1496
|
-
type MessageExtraInfo$2 = MessageExtraInfo$1;
|
|
1002
|
+
message: JSONRPCMessage | JSONRPCMessage[]
|
|
1003
|
+
): Promise<JSONRPCMessage | JSONRPCMessage[] | undefined>;
|
|
1004
|
+
};
|
|
1497
1005
|
declare const RPC_DO_PREFIX = "rpc:";
|
|
1498
|
-
interface RPCClientTransportOptions<T extends
|
|
1006
|
+
interface RPCClientTransportOptions<T extends McpRpcAgent = McpRpcAgent> {
|
|
1499
1007
|
namespace: DurableObjectNamespace<T>;
|
|
1500
1008
|
name: string;
|
|
1501
1009
|
props?: Record<string, unknown>;
|
|
@@ -1511,7 +1019,7 @@ declare class RPCClientTransport implements Transport {
|
|
|
1511
1019
|
onclose?: () => void;
|
|
1512
1020
|
onerror?: (error: Error) => void;
|
|
1513
1021
|
onmessage?: (message: JSONRPCMessage, extra?: MessageExtraInfo) => void;
|
|
1514
|
-
constructor(options: RPCClientTransportOptions<
|
|
1022
|
+
constructor(options: RPCClientTransportOptions<McpRpcAgent>);
|
|
1515
1023
|
setProtocolVersion(version: string): void;
|
|
1516
1024
|
getProtocolVersion(): string | undefined;
|
|
1517
1025
|
start(): Promise<void>;
|
|
@@ -1521,53 +1029,17 @@ declare class RPCClientTransport implements Transport {
|
|
|
1521
1029
|
options?: TransportSendOptions
|
|
1522
1030
|
): Promise<void>;
|
|
1523
1031
|
}
|
|
1524
|
-
|
|
1525
|
-
|
|
1032
|
+
//#endregion
|
|
1033
|
+
//#region src/core/events.d.ts
|
|
1034
|
+
interface Disposable {
|
|
1035
|
+
dispose(): void;
|
|
1526
1036
|
}
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
private
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
sessionId?: string;
|
|
1534
|
-
onclose?: () => void;
|
|
1535
|
-
onerror?: (error: Error) => void;
|
|
1536
|
-
onmessage?: (message: JSONRPCMessage$2, extra?: MessageExtraInfo$2) => void;
|
|
1537
|
-
constructor(options?: RPCServerTransportOptions);
|
|
1538
|
-
setProtocolVersion(version: string): void;
|
|
1539
|
-
getProtocolVersion(): string | undefined;
|
|
1540
|
-
start(): Promise<void>;
|
|
1541
|
-
close(): Promise<void>;
|
|
1542
|
-
private _makeTimeout;
|
|
1543
|
-
private _appendPending;
|
|
1544
|
-
private _completePending;
|
|
1545
|
-
private _completeRequest;
|
|
1546
|
-
private _appendRequest;
|
|
1547
|
-
private _completeContinuation;
|
|
1548
|
-
private _appendContinuation;
|
|
1549
|
-
send(
|
|
1550
|
-
message: JSONRPCMessage$2,
|
|
1551
|
-
options?: TransportSendOptions$1
|
|
1552
|
-
): Promise<void>;
|
|
1553
|
-
/**
|
|
1554
|
-
* @internal Called by McpAgent.handleMcpMessage() — not for external use.
|
|
1555
|
-
*
|
|
1556
|
-
* Wait for the next unmatched send() call that expects a client response or
|
|
1557
|
-
* completes a resumed tool call.
|
|
1558
|
-
*
|
|
1559
|
-
* Used after resolving an elicitation response: the original tool call has
|
|
1560
|
-
* already returned the elicitation request to the RPC client, and the resumed
|
|
1561
|
-
* tool handler will eventually send the final tool result. That final response
|
|
1562
|
-
* has the original tool request id, so there is no active handle() waiter left
|
|
1563
|
-
* for id-based routing; this continuation waiter receives it instead.
|
|
1564
|
-
*/
|
|
1565
|
-
_awaitPendingResponse(): Promise<
|
|
1566
|
-
JSONRPCMessage$2 | JSONRPCMessage$2[] | undefined
|
|
1567
|
-
>;
|
|
1568
|
-
handle(
|
|
1569
|
-
message: JSONRPCMessage$2 | JSONRPCMessage$2[]
|
|
1570
|
-
): Promise<JSONRPCMessage$2 | JSONRPCMessage$2[] | undefined>;
|
|
1037
|
+
type Event<T> = (listener: (e: T) => void) => Disposable;
|
|
1038
|
+
declare class Emitter<T> implements Disposable {
|
|
1039
|
+
private _listeners;
|
|
1040
|
+
readonly event: Event<T>;
|
|
1041
|
+
fire(data: T): void;
|
|
1042
|
+
dispose(): void;
|
|
1571
1043
|
}
|
|
1572
1044
|
//#endregion
|
|
1573
1045
|
//#region src/mcp/client/connection.d.ts
|
|
@@ -2571,7 +2043,7 @@ declare class MCPClientConnection {
|
|
|
2571
2043
|
*/
|
|
2572
2044
|
getTransport(
|
|
2573
2045
|
transportType: BaseTransportType
|
|
2574
|
-
):
|
|
2046
|
+
): RPCClientTransport | StreamableHTTPClientTransport | SSEClientTransport;
|
|
2575
2047
|
private tryConnect;
|
|
2576
2048
|
private _capabilityErrorHandler;
|
|
2577
2049
|
}
|
|
@@ -5089,6 +4561,14 @@ declare class Agent<
|
|
|
5089
4561
|
private _lifecycleRouteAddress;
|
|
5090
4562
|
private _routeLifecycleToRoot;
|
|
5091
4563
|
private _routeLifecycleToTarget;
|
|
4564
|
+
/**
|
|
4565
|
+
* Serves a browser's request to one of its internal hostnames. Browser
|
|
4566
|
+
* Run's `InternalHostRouter` calls this over RPC; it passes the message to
|
|
4567
|
+
* the `Browser` it names, which runs the host's `fetch`. Built in, so an
|
|
4568
|
+
* Agent needs nothing extra for internal hostnames. Not `@callable`, so
|
|
4569
|
+
* clients can't reach it.
|
|
4570
|
+
*/
|
|
4571
|
+
fetchInternalHost(message: InternalHostMessage): Promise<Response>;
|
|
5092
4572
|
/** Single native-RPC aperture for routed Lifecycle capabilities. */
|
|
5093
4573
|
_cf_routeLifecycle(
|
|
5094
4574
|
target: LifecycleRouteAddress | undefined,
|
|
@@ -6654,7 +6134,7 @@ declare class Agent<
|
|
|
6654
6134
|
* await this.addMcpServer("counter", env.MY_MCP);
|
|
6655
6135
|
* await this.addMcpServer("counter", env.MY_MCP, { props: { userId: "123" } });
|
|
6656
6136
|
*/
|
|
6657
|
-
addMcpServer<T extends
|
|
6137
|
+
addMcpServer<T extends McpRpcAgent>(
|
|
6658
6138
|
serverName: string,
|
|
6659
6139
|
binding: DurableObjectNamespace<T>,
|
|
6660
6140
|
options?: AddRpcMcpServerOptions
|
|
@@ -6904,20 +6384,16 @@ declare function getAgentByName<
|
|
|
6904
6384
|
//#endregion
|
|
6905
6385
|
export {
|
|
6906
6386
|
ChatCapableAgentClass as $,
|
|
6907
|
-
|
|
6387
|
+
RPCClientTransportOptions as $t,
|
|
6908
6388
|
getCurrentAgent as A,
|
|
6909
|
-
getSubAgentByName as An,
|
|
6910
6389
|
ElicitRequest$1 as At,
|
|
6911
6390
|
AgentToolFailure as B,
|
|
6912
6391
|
MCPConnectionResult as Bt,
|
|
6913
6392
|
MCPServersState as C,
|
|
6914
|
-
BuildAgentPathOptions as Cn,
|
|
6915
6393
|
WorkflowInfo as Ct,
|
|
6916
6394
|
StartFiberResult as D,
|
|
6917
|
-
buildAgentUrl as Dn,
|
|
6918
6395
|
WorkflowRejectedError as Dt,
|
|
6919
6396
|
StartFiberOptions as E,
|
|
6920
|
-
buildAgentPath as En,
|
|
6921
6397
|
WorkflowQueryCriteria as Et,
|
|
6922
6398
|
AgentToolDisplayMetadata as F,
|
|
6923
6399
|
MCPClientElicitationHandlers as Ft,
|
|
@@ -6934,25 +6410,20 @@ export {
|
|
|
6934
6410
|
AgentToolEventDelivery as L,
|
|
6935
6411
|
MCPClientManagerOptions as Lt,
|
|
6936
6412
|
AGENT_TOOL_MILESTONE_PART as M,
|
|
6937
|
-
routeSubAgentRequest as Mn,
|
|
6938
6413
|
MCPAITool as Mt,
|
|
6939
6414
|
AGENT_TOOL_PROGRESS_PART as N,
|
|
6940
|
-
withInvocationScope as Nn,
|
|
6941
6415
|
MCPAIToolSet as Nt,
|
|
6942
6416
|
StateUpdateMessage as O,
|
|
6943
|
-
buildSubAgentPath as On,
|
|
6944
6417
|
WorkflowStatus as Ot,
|
|
6945
6418
|
AgentToolChildAdapter as P,
|
|
6946
6419
|
MCPClientElicitationHandler as Pt,
|
|
6947
6420
|
AgentToolTerminalStatus as Q,
|
|
6948
|
-
|
|
6421
|
+
RPCClientTransport as Qt,
|
|
6949
6422
|
AgentToolEventMessage as R,
|
|
6950
6423
|
MCPClientOAuthCallbackConfig as Rt,
|
|
6951
6424
|
MCPServerMessage as S,
|
|
6952
|
-
AgentPathStep as Sn,
|
|
6953
6425
|
WorkflowEventPayload as St,
|
|
6954
6426
|
RPCResponse as T,
|
|
6955
|
-
SubAgentPathMatch as Tn,
|
|
6956
6427
|
WorkflowProgressCallback as Tt,
|
|
6957
6428
|
AgentToolMilestone as U,
|
|
6958
6429
|
MCPServerFilter as Ut,
|
|
@@ -6965,84 +6436,74 @@ export {
|
|
|
6965
6436
|
AgentToolRunState as Y,
|
|
6966
6437
|
MCPElicitationHandler as Yt,
|
|
6967
6438
|
AgentToolStoredChunk as Z,
|
|
6968
|
-
|
|
6439
|
+
McpRpcAgent as Zt,
|
|
6969
6440
|
FiberRecoveryContext as _,
|
|
6970
|
-
WorkerTransportOptions as _n,
|
|
6971
6441
|
WorkflowCallbackBase as _t,
|
|
6972
6442
|
routeAgentRequest as a,
|
|
6973
|
-
|
|
6443
|
+
SUB_PREFIX as an,
|
|
6974
6444
|
isPositionlessAgentToolChunk as at,
|
|
6975
6445
|
ListFibersOptions as b,
|
|
6976
|
-
DynamicAgentClass as bn,
|
|
6977
6446
|
WorkflowErrorCallback as bt,
|
|
6978
6447
|
Agent as c,
|
|
6979
|
-
|
|
6448
|
+
buildAgentUrl as cn,
|
|
6980
6449
|
AgentWorkflowOrigin as ct,
|
|
6981
6450
|
AgentStaticOptions as d,
|
|
6982
|
-
|
|
6451
|
+
getSubAgentByName as dn,
|
|
6983
6452
|
AgentWorkflowStep as dt,
|
|
6984
|
-
|
|
6453
|
+
RPC_DO_PREFIX as en,
|
|
6985
6454
|
DetachedAgentToolConfig as et,
|
|
6986
6455
|
DEFAULT_AGENT_STATIC_OPTIONS as f,
|
|
6987
|
-
|
|
6456
|
+
parseSubAgentPath as fn,
|
|
6988
6457
|
ApprovalEventPayload as ft,
|
|
6989
6458
|
FiberInspection as g,
|
|
6990
|
-
WorkerTransport as gn,
|
|
6991
6459
|
WorkflowCallback as gt,
|
|
6992
6460
|
FiberContext as h,
|
|
6993
|
-
TransportState as hn,
|
|
6994
6461
|
WaitForApprovalOptions as ht,
|
|
6995
6462
|
getAgentByName as i,
|
|
6996
|
-
|
|
6463
|
+
BuildAgentPathOptions as in,
|
|
6997
6464
|
isAgentToolLifecycleChunk as it,
|
|
6998
6465
|
routeAgentEmail as j,
|
|
6999
|
-
|
|
7000
|
-
ElicitResult$2 as jt,
|
|
6466
|
+
ElicitResult$1 as jt,
|
|
7001
6467
|
StreamingResponse as k,
|
|
7002
|
-
buildSubAgentPathUnchecked as kn,
|
|
7003
6468
|
WorkflowTrackingRow as kt,
|
|
7004
6469
|
AgentContext as l,
|
|
7005
|
-
|
|
6470
|
+
buildSubAgentPath as ln,
|
|
7006
6471
|
AgentWorkflowParams as lt,
|
|
7007
6472
|
EmailRoutingOptions as m,
|
|
7008
|
-
|
|
6473
|
+
withInvocationScope as mn,
|
|
7009
6474
|
RunWorkflowOptions as mt,
|
|
7010
6475
|
AgentOptions as n,
|
|
7011
|
-
|
|
6476
|
+
DynamicAgentStub as nn,
|
|
7012
6477
|
RunAgentToolOptions as nt,
|
|
7013
6478
|
AddMcpServerOptions as o,
|
|
7014
|
-
|
|
6479
|
+
SubAgentPathMatch as on,
|
|
7015
6480
|
AgentWorkflowEvent as ot,
|
|
7016
6481
|
DeleteFibersOptions as p,
|
|
7017
|
-
|
|
6482
|
+
routeSubAgentRequest as pn,
|
|
7018
6483
|
DefaultProgress as pt,
|
|
7019
6484
|
AgentToolRunInspection as q,
|
|
7020
6485
|
getNamespacedData as qt,
|
|
7021
6486
|
RoutingRetryOptions as r,
|
|
7022
|
-
|
|
6487
|
+
AgentPathStep as rn,
|
|
7023
6488
|
RunAgentToolResult as rt,
|
|
7024
6489
|
AddRpcMcpServerOptions as s,
|
|
7025
|
-
|
|
6490
|
+
buildAgentPath as sn,
|
|
7026
6491
|
AgentWorkflowInternalParams as st,
|
|
7027
6492
|
AgentGetOptions as t,
|
|
7028
|
-
|
|
6493
|
+
DynamicAgentClass as tn,
|
|
7029
6494
|
DetachedRunAgentToolResult as tt,
|
|
7030
6495
|
AgentNamespace as u,
|
|
7031
|
-
|
|
6496
|
+
buildSubAgentPathUnchecked as un,
|
|
7032
6497
|
AgentWorkflowPathStep as ut,
|
|
7033
6498
|
FiberRecoveryResult as v,
|
|
7034
|
-
SSEEdgeClientTransport as vn,
|
|
7035
6499
|
WorkflowCallbackType as vt,
|
|
7036
6500
|
RPCRequest as w,
|
|
7037
|
-
SUB_PREFIX as wn,
|
|
7038
6501
|
WorkflowPage as wt,
|
|
7039
6502
|
MCPServer as x,
|
|
7040
|
-
DynamicAgentStub as xn,
|
|
7041
6503
|
WorkflowEventCallback as xt,
|
|
7042
6504
|
FiberStatus as y,
|
|
7043
|
-
StreamableHTTPEdgeClientTransport as yn,
|
|
7044
6505
|
WorkflowCompleteCallback as yt,
|
|
7045
6506
|
AgentToolEventState as z,
|
|
7046
6507
|
MCPClientOAuthResult as zt
|
|
7047
6508
|
};
|
|
7048
|
-
//# sourceMappingURL=agent-routing-
|
|
6509
|
+
//# sourceMappingURL=agent-routing-wS1TimZ_.d.ts.map
|