agents 0.7.4 → 0.7.5
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/dist/ai-chat-agent.js +3 -4
- package/dist/ai-chat-agent.js.map +1 -1
- package/dist/ai-chat-v5-migration.js +3 -4
- package/dist/ai-chat-v5-migration.js.map +1 -1
- package/dist/ai-react.js +3 -4
- package/dist/ai-react.js.map +1 -1
- package/dist/ai-types.js +1 -2
- package/dist/ai-types.js.map +1 -1
- package/dist/cli/index.js +2 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/client-CgXIwdcc.js +1442 -0
- package/dist/client-CgXIwdcc.js.map +1 -0
- package/dist/client.js +1 -2
- package/dist/client.js.map +1 -1
- package/dist/codemode/ai.js +2 -2
- package/dist/do-oauth-client-provider-C2jurFjW.d.ts +78 -0
- package/dist/email-U_MG7UET.d.ts +157 -0
- package/dist/email.d.ts +16 -146
- package/dist/email.js +2 -2
- package/dist/email.js.map +1 -1
- package/dist/experimental/forever.d.ts +26 -71
- package/dist/experimental/forever.js +1 -2
- package/dist/experimental/forever.js.map +1 -1
- package/dist/experimental/memory/session/index.js +3 -12
- package/dist/experimental/memory/session/index.js.map +1 -1
- package/dist/experimental/sub-agent.js +1 -2
- package/dist/experimental/sub-agent.js.map +1 -1
- package/dist/experimental/workspace.d.ts +273 -0
- package/dist/experimental/workspace.js +1263 -0
- package/dist/experimental/workspace.js.map +1 -0
- package/dist/index-BS_jL8MI.d.ts +492 -0
- package/dist/index-p1XLNvwQ.d.ts +2719 -0
- package/dist/index.d.ts +45 -1320
- package/dist/index.js +3 -5
- package/dist/index.js.map +1 -1
- package/dist/internal_context-DgcmHqS1.d.ts +37 -0
- package/dist/internal_context.d.ts +5 -32
- package/dist/internal_context.js +1 -2
- package/dist/internal_context.js.map +1 -1
- package/dist/mcp/client.d.ts +2 -575
- package/dist/mcp/client.js +1 -847
- package/dist/mcp/do-oauth-client-provider.d.ts +2 -61
- package/dist/mcp/do-oauth-client-provider.js +1 -2
- package/dist/mcp/do-oauth-client-provider.js.map +1 -1
- package/dist/mcp/index.d.ts +2 -95
- package/dist/mcp/index.js +2 -9
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/x402.js +1 -2
- package/dist/mcp/x402.js.map +1 -1
- package/dist/observability/index.d.ts +2 -93
- package/dist/observability/index.js +4 -3
- package/dist/observability/index.js.map +1 -1
- package/dist/react.d.ts +1 -2
- package/dist/react.js +1 -2
- package/dist/react.js.map +1 -1
- package/dist/retries-DXMQGhG3.d.ts +79 -0
- package/dist/retries.d.ts +7 -72
- package/dist/retries.js +1 -1
- package/dist/retries.js.map +1 -1
- package/dist/schedule.js +1 -2
- package/dist/schedule.js.map +1 -1
- package/dist/serializable.js +1 -1
- package/dist/types-BB1plA51.d.ts +15 -0
- package/dist/types.d.ts +1 -14
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/workflow-types-CZNXKj_D.d.ts +260 -0
- package/dist/workflow-types.d.ts +23 -235
- package/dist/workflow-types.js +1 -1
- package/dist/workflow-types.js.map +1 -1
- package/dist/workflows.d.ts +22 -23
- package/dist/workflows.js +5 -6
- package/dist/workflows.js.map +1 -1
- package/package.json +15 -5
- package/dist/agent-eZnMHidZ.d.ts +0 -273
- package/dist/client-connection-D3Wcd6Q6.js +0 -603
- package/dist/client-connection-D3Wcd6Q6.js.map +0 -1
- package/dist/client-storage-BPjfP_is.d.ts +0 -604
- package/dist/mcp/client.js.map +0 -1
|
@@ -1,604 +0,0 @@
|
|
|
1
|
-
import { n as MCPObservabilityEvent } from "./agent-eZnMHidZ.js";
|
|
2
|
-
import { AgentMcpOAuthProvider } from "./mcp/do-oauth-client-provider.js";
|
|
3
|
-
import { McpAgent } from "./mcp/index.js";
|
|
4
|
-
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
5
|
-
import {
|
|
6
|
-
SSEClientTransport,
|
|
7
|
-
SSEClientTransportOptions
|
|
8
|
-
} from "@modelcontextprotocol/sdk/client/sse.js";
|
|
9
|
-
import {
|
|
10
|
-
StreamableHTTPClientTransport,
|
|
11
|
-
StreamableHTTPClientTransportOptions
|
|
12
|
-
} from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
13
|
-
import {
|
|
14
|
-
ElicitRequest,
|
|
15
|
-
ElicitResult,
|
|
16
|
-
InitializeRequestParams,
|
|
17
|
-
JSONRPCMessage,
|
|
18
|
-
MessageExtraInfo,
|
|
19
|
-
Prompt,
|
|
20
|
-
RequestId,
|
|
21
|
-
Resource,
|
|
22
|
-
ResourceTemplate,
|
|
23
|
-
ServerCapabilities,
|
|
24
|
-
Tool
|
|
25
|
-
} from "@modelcontextprotocol/sdk/types.js";
|
|
26
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
27
|
-
import {
|
|
28
|
-
Transport,
|
|
29
|
-
TransportSendOptions
|
|
30
|
-
} from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
31
|
-
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
32
|
-
import { Client as Client$1 } from "@modelcontextprotocol/sdk/client";
|
|
33
|
-
import { EventStore } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
34
|
-
|
|
35
|
-
//#region src/core/events.d.ts
|
|
36
|
-
interface Disposable {
|
|
37
|
-
dispose(): void;
|
|
38
|
-
}
|
|
39
|
-
type Event<T> = (listener: (e: T) => void) => Disposable;
|
|
40
|
-
declare class Emitter<T> implements Disposable {
|
|
41
|
-
private _listeners;
|
|
42
|
-
readonly event: Event<T>;
|
|
43
|
-
fire(data: T): void;
|
|
44
|
-
dispose(): void;
|
|
45
|
-
}
|
|
46
|
-
//#endregion
|
|
47
|
-
//#region src/mcp/types.d.ts
|
|
48
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
49
|
-
type HttpTransportType = "sse" | "streamable-http";
|
|
50
|
-
type BaseTransportType = HttpTransportType | "rpc";
|
|
51
|
-
type TransportType = BaseTransportType | "auto";
|
|
52
|
-
interface CORSOptions {
|
|
53
|
-
origin?: string;
|
|
54
|
-
methods?: string;
|
|
55
|
-
headers?: string;
|
|
56
|
-
maxAge?: number;
|
|
57
|
-
exposeHeaders?: string;
|
|
58
|
-
}
|
|
59
|
-
interface ServeOptions {
|
|
60
|
-
binding?: string;
|
|
61
|
-
corsOptions?: CORSOptions;
|
|
62
|
-
transport?: BaseTransportType;
|
|
63
|
-
jurisdiction?: DurableObjectJurisdiction;
|
|
64
|
-
}
|
|
65
|
-
type McpClientOptions = ConstructorParameters<typeof Client$1>[1];
|
|
66
|
-
//#endregion
|
|
67
|
-
//#region src/mcp/client-transports.d.ts
|
|
68
|
-
/**
|
|
69
|
-
* @deprecated Use SSEClientTransport from @modelcontextprotocol/sdk/client/sse.js instead. This alias will be removed in the next major version.
|
|
70
|
-
*/
|
|
71
|
-
declare class SSEEdgeClientTransport extends SSEClientTransport {
|
|
72
|
-
constructor(url: URL, options: SSEClientTransportOptions);
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* @deprecated Use StreamableHTTPClientTransport from @modelcontextprotocol/sdk/client/streamableHttp.js instead. This alias will be removed in the next major version.
|
|
76
|
-
*/
|
|
77
|
-
declare class StreamableHTTPEdgeClientTransport extends StreamableHTTPClientTransport {
|
|
78
|
-
constructor(url: URL, options: StreamableHTTPClientTransportOptions);
|
|
79
|
-
}
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region src/mcp/worker-transport.d.ts
|
|
82
|
-
interface MCPStorageApi {
|
|
83
|
-
get(): Promise<TransportState | undefined> | TransportState | undefined;
|
|
84
|
-
set(state: TransportState): Promise<void> | void;
|
|
85
|
-
}
|
|
86
|
-
interface TransportState {
|
|
87
|
-
sessionId?: string;
|
|
88
|
-
initialized: boolean;
|
|
89
|
-
initializeParams?: InitializeRequestParams;
|
|
90
|
-
}
|
|
91
|
-
interface WorkerTransportOptions {
|
|
92
|
-
/**
|
|
93
|
-
* Function that generates a session ID for the transport.
|
|
94
|
-
* The session ID SHOULD be globally unique and cryptographically secure.
|
|
95
|
-
* Return undefined to disable session management (stateless mode).
|
|
96
|
-
*/
|
|
97
|
-
sessionIdGenerator?: () => string;
|
|
98
|
-
/**
|
|
99
|
-
* Enable traditional Request/Response mode, this will disable streaming.
|
|
100
|
-
*/
|
|
101
|
-
enableJsonResponse?: boolean;
|
|
102
|
-
/**
|
|
103
|
-
* Callback fired when a new session is initialized.
|
|
104
|
-
*/
|
|
105
|
-
onsessioninitialized?: (sessionId: string) => void;
|
|
106
|
-
/**
|
|
107
|
-
* Callback fired when a session is closed via DELETE request.
|
|
108
|
-
*/
|
|
109
|
-
onsessionclosed?: (sessionId: string) => void;
|
|
110
|
-
corsOptions?: CORSOptions;
|
|
111
|
-
/**
|
|
112
|
-
* Optional storage api for persisting transport state.
|
|
113
|
-
* Use this to store session state in Durable Object/Agent storage
|
|
114
|
-
* so it survives hibernation/restart.
|
|
115
|
-
*/
|
|
116
|
-
storage?: MCPStorageApi;
|
|
117
|
-
/**
|
|
118
|
-
* Event store for resumability support.
|
|
119
|
-
* If provided, enables clients to reconnect and resume messages using Last-Event-ID.
|
|
120
|
-
*/
|
|
121
|
-
eventStore?: EventStore;
|
|
122
|
-
/**
|
|
123
|
-
* Retry interval in milliseconds to suggest to clients in SSE retry field.
|
|
124
|
-
* Controls client reconnection timing for polling behavior.
|
|
125
|
-
*/
|
|
126
|
-
retryInterval?: number;
|
|
127
|
-
}
|
|
128
|
-
declare class WorkerTransport implements Transport {
|
|
129
|
-
started: boolean;
|
|
130
|
-
private initialized;
|
|
131
|
-
private sessionIdGenerator?;
|
|
132
|
-
private enableJsonResponse;
|
|
133
|
-
private onsessioninitialized?;
|
|
134
|
-
private onsessionclosed?;
|
|
135
|
-
private standaloneSseStreamId;
|
|
136
|
-
private streamMapping;
|
|
137
|
-
private requestToStreamMapping;
|
|
138
|
-
private requestResponseMap;
|
|
139
|
-
private corsOptions?;
|
|
140
|
-
private storage?;
|
|
141
|
-
private stateRestored;
|
|
142
|
-
private eventStore?;
|
|
143
|
-
private retryInterval?;
|
|
144
|
-
private initializeParams?;
|
|
145
|
-
sessionId?: string;
|
|
146
|
-
onclose?: () => void;
|
|
147
|
-
onerror?: (error: Error) => void;
|
|
148
|
-
onmessage?: (message: JSONRPCMessage, extra?: MessageExtraInfo) => void;
|
|
149
|
-
constructor(options?: WorkerTransportOptions);
|
|
150
|
-
/**
|
|
151
|
-
* Restore transport state from persistent storage.
|
|
152
|
-
* This is automatically called on start.
|
|
153
|
-
*/
|
|
154
|
-
private restoreState;
|
|
155
|
-
/**
|
|
156
|
-
* Persist current transport state to storage.
|
|
157
|
-
*/
|
|
158
|
-
private saveState;
|
|
159
|
-
start(): Promise<void>;
|
|
160
|
-
/**
|
|
161
|
-
* Validates the MCP-Protocol-Version header on incoming requests.
|
|
162
|
-
*
|
|
163
|
-
* This performs a simple check: if a version header is present, it must be
|
|
164
|
-
* in the SUPPORTED_PROTOCOL_VERSIONS list. We do not track the negotiated
|
|
165
|
-
* version or enforce version consistency across requests - the SDK handles
|
|
166
|
-
* version negotiation during initialization, and we simply reject any
|
|
167
|
-
* explicitly unsupported versions.
|
|
168
|
-
*
|
|
169
|
-
* - Header present and supported: Accept
|
|
170
|
-
* - Header present and unsupported: 400 Bad Request
|
|
171
|
-
* - Header missing: Accept (version validation is optional)
|
|
172
|
-
*/
|
|
173
|
-
private validateProtocolVersion;
|
|
174
|
-
private getHeaders;
|
|
175
|
-
handleRequest(request: Request, parsedBody?: unknown): Promise<Response>;
|
|
176
|
-
private handleGetRequest;
|
|
177
|
-
private handlePostRequest;
|
|
178
|
-
private handleDeleteRequest;
|
|
179
|
-
private handleOptionsRequest;
|
|
180
|
-
private handleUnsupportedRequest;
|
|
181
|
-
private validateSession;
|
|
182
|
-
close(): Promise<void>;
|
|
183
|
-
/**
|
|
184
|
-
* Close an SSE stream for a specific request, triggering client reconnection.
|
|
185
|
-
* Use this to implement polling behavior during long-running operations -
|
|
186
|
-
* client will reconnect after the retry interval specified in the priming event.
|
|
187
|
-
*/
|
|
188
|
-
closeSSEStream(requestId: RequestId): void;
|
|
189
|
-
send(message: JSONRPCMessage, options?: TransportSendOptions): Promise<void>;
|
|
190
|
-
}
|
|
191
|
-
//#endregion
|
|
192
|
-
//#region src/mcp/auth-context.d.ts
|
|
193
|
-
interface McpAuthContext {
|
|
194
|
-
props: Record<string, unknown>;
|
|
195
|
-
}
|
|
196
|
-
declare function getMcpAuthContext(): McpAuthContext | undefined;
|
|
197
|
-
//#endregion
|
|
198
|
-
//#region src/mcp/handler.d.ts
|
|
199
|
-
interface CreateMcpHandlerOptions extends WorkerTransportOptions {
|
|
200
|
-
/**
|
|
201
|
-
* The route path that this MCP handler should respond to.
|
|
202
|
-
* If specified, the handler will only process requests that match this route.
|
|
203
|
-
* @default "/mcp"
|
|
204
|
-
*/
|
|
205
|
-
route?: string;
|
|
206
|
-
/**
|
|
207
|
-
* An optional auth context to use for handling MCP requests.
|
|
208
|
-
* If not provided, the handler will look for props in the execution context.
|
|
209
|
-
*/
|
|
210
|
-
authContext?: McpAuthContext;
|
|
211
|
-
/**
|
|
212
|
-
* An optional transport to use for handling MCP requests.
|
|
213
|
-
* If not provided, a WorkerTransport will be created with the provided WorkerTransportOptions.
|
|
214
|
-
*/
|
|
215
|
-
transport?: WorkerTransport;
|
|
216
|
-
}
|
|
217
|
-
declare function createMcpHandler(
|
|
218
|
-
server: McpServer | Server,
|
|
219
|
-
options?: CreateMcpHandlerOptions
|
|
220
|
-
): (request: Request, env: unknown, ctx: ExecutionContext) => Promise<Response>;
|
|
221
|
-
/**
|
|
222
|
-
* @deprecated This has been renamed to createMcpHandler, and experimental_createMcpHandler will be removed in the next major version
|
|
223
|
-
*/
|
|
224
|
-
declare function experimental_createMcpHandler(
|
|
225
|
-
server: McpServer | Server,
|
|
226
|
-
options?: CreateMcpHandlerOptions
|
|
227
|
-
): (request: Request, env: unknown, ctx: ExecutionContext) => Promise<Response>;
|
|
228
|
-
//#endregion
|
|
229
|
-
//#region src/mcp/rpc.d.ts
|
|
230
|
-
declare const RPC_DO_PREFIX = "rpc:";
|
|
231
|
-
interface RPCClientTransportOptions<T extends McpAgent = McpAgent> {
|
|
232
|
-
namespace: DurableObjectNamespace<T>;
|
|
233
|
-
name: string;
|
|
234
|
-
props?: Record<string, unknown>;
|
|
235
|
-
}
|
|
236
|
-
declare class RPCClientTransport implements Transport {
|
|
237
|
-
private _namespace;
|
|
238
|
-
private _name;
|
|
239
|
-
private _props?;
|
|
240
|
-
private _stub?;
|
|
241
|
-
private _started;
|
|
242
|
-
private _protocolVersion?;
|
|
243
|
-
sessionId?: string;
|
|
244
|
-
onclose?: () => void;
|
|
245
|
-
onerror?: (error: Error) => void;
|
|
246
|
-
onmessage?: (message: JSONRPCMessage, extra?: MessageExtraInfo) => void;
|
|
247
|
-
constructor(options: RPCClientTransportOptions<McpAgent>);
|
|
248
|
-
setProtocolVersion(version: string): void;
|
|
249
|
-
getProtocolVersion(): string | undefined;
|
|
250
|
-
start(): Promise<void>;
|
|
251
|
-
close(): Promise<void>;
|
|
252
|
-
send(
|
|
253
|
-
message: JSONRPCMessage | JSONRPCMessage[],
|
|
254
|
-
options?: TransportSendOptions
|
|
255
|
-
): Promise<void>;
|
|
256
|
-
}
|
|
257
|
-
interface RPCServerTransportOptions {
|
|
258
|
-
timeout?: number;
|
|
259
|
-
}
|
|
260
|
-
declare class RPCServerTransport implements Transport {
|
|
261
|
-
private _started;
|
|
262
|
-
private _pendingResponse;
|
|
263
|
-
private _responseResolver;
|
|
264
|
-
private _protocolVersion?;
|
|
265
|
-
private _timeout;
|
|
266
|
-
sessionId?: string;
|
|
267
|
-
onclose?: () => void;
|
|
268
|
-
onerror?: (error: Error) => void;
|
|
269
|
-
onmessage?: (message: JSONRPCMessage, extra?: MessageExtraInfo) => void;
|
|
270
|
-
constructor(options?: RPCServerTransportOptions);
|
|
271
|
-
setProtocolVersion(version: string): void;
|
|
272
|
-
getProtocolVersion(): string | undefined;
|
|
273
|
-
start(): Promise<void>;
|
|
274
|
-
close(): Promise<void>;
|
|
275
|
-
send(message: JSONRPCMessage, _options?: TransportSendOptions): Promise<void>;
|
|
276
|
-
handle(
|
|
277
|
-
message: JSONRPCMessage | JSONRPCMessage[]
|
|
278
|
-
): Promise<JSONRPCMessage | JSONRPCMessage[] | undefined>;
|
|
279
|
-
}
|
|
280
|
-
//#endregion
|
|
281
|
-
//#region src/mcp/client-connection.d.ts
|
|
282
|
-
/**
|
|
283
|
-
* Connection state machine for MCP client connections.
|
|
284
|
-
*
|
|
285
|
-
* State transitions:
|
|
286
|
-
* - Non-OAuth: init() → CONNECTING → DISCOVERING → READY
|
|
287
|
-
* - OAuth: init() → AUTHENTICATING → (callback) → CONNECTING → DISCOVERING → READY
|
|
288
|
-
* - Any state can transition to FAILED on error
|
|
289
|
-
*/
|
|
290
|
-
declare const MCPConnectionState: {
|
|
291
|
-
/** Waiting for OAuth authorization to complete */ readonly AUTHENTICATING: "authenticating" /** Establishing transport connection to MCP server */;
|
|
292
|
-
readonly CONNECTING: "connecting" /** Transport connection established */;
|
|
293
|
-
readonly CONNECTED: "connected" /** Discovering server capabilities (tools, resources, prompts) */;
|
|
294
|
-
readonly DISCOVERING: "discovering" /** Fully connected and ready to use */;
|
|
295
|
-
readonly READY: "ready" /** Connection failed at some point */;
|
|
296
|
-
readonly FAILED: "failed";
|
|
297
|
-
};
|
|
298
|
-
/**
|
|
299
|
-
* Connection state type for MCP client connections.
|
|
300
|
-
*/
|
|
301
|
-
type MCPConnectionState =
|
|
302
|
-
(typeof MCPConnectionState)[keyof typeof MCPConnectionState];
|
|
303
|
-
/**
|
|
304
|
-
* Transport options for MCP client connections.
|
|
305
|
-
* Combines transport-specific options with auth provider and type selection.
|
|
306
|
-
*/
|
|
307
|
-
type MCPTransportOptions = (
|
|
308
|
-
| SSEClientTransportOptions
|
|
309
|
-
| StreamableHTTPClientTransportOptions
|
|
310
|
-
| RPCClientTransportOptions
|
|
311
|
-
) & {
|
|
312
|
-
authProvider?: AgentMcpOAuthProvider;
|
|
313
|
-
type?: TransportType;
|
|
314
|
-
};
|
|
315
|
-
/**
|
|
316
|
-
* Result of a discovery operation.
|
|
317
|
-
* success indicates whether discovery completed successfully.
|
|
318
|
-
* error is present when success is false.
|
|
319
|
-
*/
|
|
320
|
-
type MCPDiscoveryResult = {
|
|
321
|
-
success: boolean;
|
|
322
|
-
error?: string;
|
|
323
|
-
};
|
|
324
|
-
declare class MCPClientConnection {
|
|
325
|
-
url: URL;
|
|
326
|
-
options: {
|
|
327
|
-
transport: MCPTransportOptions;
|
|
328
|
-
client: McpClientOptions;
|
|
329
|
-
};
|
|
330
|
-
client: Client;
|
|
331
|
-
connectionState: MCPConnectionState;
|
|
332
|
-
connectionError: string | null;
|
|
333
|
-
lastConnectedTransport: BaseTransportType | undefined;
|
|
334
|
-
instructions?: string;
|
|
335
|
-
tools: Tool[];
|
|
336
|
-
prompts: Prompt[];
|
|
337
|
-
resources: Resource[];
|
|
338
|
-
resourceTemplates: ResourceTemplate[];
|
|
339
|
-
serverCapabilities: ServerCapabilities | undefined;
|
|
340
|
-
/** Tracks in-flight discovery to allow cancellation */
|
|
341
|
-
private _discoveryAbortController;
|
|
342
|
-
private readonly _onObservabilityEvent;
|
|
343
|
-
readonly onObservabilityEvent: Event<MCPObservabilityEvent>;
|
|
344
|
-
constructor(
|
|
345
|
-
url: URL,
|
|
346
|
-
info: ConstructorParameters<typeof Client>[0],
|
|
347
|
-
options?: {
|
|
348
|
-
transport: MCPTransportOptions;
|
|
349
|
-
client: McpClientOptions;
|
|
350
|
-
}
|
|
351
|
-
);
|
|
352
|
-
/**
|
|
353
|
-
* Initialize a client connection, if authentication is required, the connection will be in the AUTHENTICATING state
|
|
354
|
-
* Sets connection state based on the result and emits observability events
|
|
355
|
-
*
|
|
356
|
-
* @returns Error message if connection failed, undefined otherwise
|
|
357
|
-
*/
|
|
358
|
-
init(): Promise<string | undefined>;
|
|
359
|
-
/**
|
|
360
|
-
* Finish OAuth by probing transports based on configured type.
|
|
361
|
-
* - Explicit: finish on that transport
|
|
362
|
-
* - Auto: try streamable-http, then sse on 404/405/Not Implemented
|
|
363
|
-
*/
|
|
364
|
-
private finishAuthProbe;
|
|
365
|
-
/**
|
|
366
|
-
* Complete OAuth authorization
|
|
367
|
-
*/
|
|
368
|
-
completeAuthorization(code: string): Promise<void>;
|
|
369
|
-
/**
|
|
370
|
-
* Discover server capabilities and register tools, resources, prompts, and templates.
|
|
371
|
-
* This method does the work but does not manage connection state - that's handled by discover().
|
|
372
|
-
*/
|
|
373
|
-
discoverAndRegister(): Promise<void>;
|
|
374
|
-
/**
|
|
375
|
-
* Discover server capabilities with timeout and cancellation support.
|
|
376
|
-
* If called while a previous discovery is in-flight, the previous discovery will be aborted.
|
|
377
|
-
*
|
|
378
|
-
* @param options Optional configuration
|
|
379
|
-
* @param options.timeoutMs Timeout in milliseconds (default: 15000)
|
|
380
|
-
* @returns Result indicating success/failure with optional error message
|
|
381
|
-
*/
|
|
382
|
-
discover(options?: { timeoutMs?: number }): Promise<MCPDiscoveryResult>;
|
|
383
|
-
/**
|
|
384
|
-
* Cancel any in-flight discovery operation.
|
|
385
|
-
* Called when closing the connection.
|
|
386
|
-
*/
|
|
387
|
-
cancelDiscovery(): void;
|
|
388
|
-
/**
|
|
389
|
-
* Notification handler registration for tools
|
|
390
|
-
* Should only be called if serverCapabilities.tools exists
|
|
391
|
-
*/
|
|
392
|
-
registerTools(): Promise<Tool[]>;
|
|
393
|
-
/**
|
|
394
|
-
* Notification handler registration for resources
|
|
395
|
-
* Should only be called if serverCapabilities.resources exists
|
|
396
|
-
*/
|
|
397
|
-
registerResources(): Promise<Resource[]>;
|
|
398
|
-
/**
|
|
399
|
-
* Notification handler registration for prompts
|
|
400
|
-
* Should only be called if serverCapabilities.prompts exists
|
|
401
|
-
*/
|
|
402
|
-
registerPrompts(): Promise<Prompt[]>;
|
|
403
|
-
registerResourceTemplates(): Promise<ResourceTemplate[]>;
|
|
404
|
-
fetchTools(): Promise<
|
|
405
|
-
{
|
|
406
|
-
inputSchema: {
|
|
407
|
-
[x: string]: unknown;
|
|
408
|
-
type: "object";
|
|
409
|
-
properties?:
|
|
410
|
-
| {
|
|
411
|
-
[x: string]: object;
|
|
412
|
-
}
|
|
413
|
-
| undefined;
|
|
414
|
-
required?: string[] | undefined;
|
|
415
|
-
};
|
|
416
|
-
name: string;
|
|
417
|
-
description?: string | undefined;
|
|
418
|
-
outputSchema?:
|
|
419
|
-
| {
|
|
420
|
-
[x: string]: unknown;
|
|
421
|
-
type: "object";
|
|
422
|
-
properties?:
|
|
423
|
-
| {
|
|
424
|
-
[x: string]: object;
|
|
425
|
-
}
|
|
426
|
-
| undefined;
|
|
427
|
-
required?: string[] | undefined;
|
|
428
|
-
}
|
|
429
|
-
| undefined;
|
|
430
|
-
annotations?:
|
|
431
|
-
| {
|
|
432
|
-
title?: string | undefined;
|
|
433
|
-
readOnlyHint?: boolean | undefined;
|
|
434
|
-
destructiveHint?: boolean | undefined;
|
|
435
|
-
idempotentHint?: boolean | undefined;
|
|
436
|
-
openWorldHint?: boolean | undefined;
|
|
437
|
-
}
|
|
438
|
-
| undefined;
|
|
439
|
-
execution?:
|
|
440
|
-
| {
|
|
441
|
-
taskSupport?: "optional" | "required" | "forbidden" | undefined;
|
|
442
|
-
}
|
|
443
|
-
| undefined;
|
|
444
|
-
_meta?:
|
|
445
|
-
| {
|
|
446
|
-
[x: string]: unknown;
|
|
447
|
-
}
|
|
448
|
-
| undefined;
|
|
449
|
-
icons?:
|
|
450
|
-
| {
|
|
451
|
-
src: string;
|
|
452
|
-
mimeType?: string | undefined;
|
|
453
|
-
sizes?: string[] | undefined;
|
|
454
|
-
theme?: "light" | "dark" | undefined;
|
|
455
|
-
}[]
|
|
456
|
-
| undefined;
|
|
457
|
-
title?: string | undefined;
|
|
458
|
-
}[]
|
|
459
|
-
>;
|
|
460
|
-
fetchResources(): Promise<
|
|
461
|
-
{
|
|
462
|
-
uri: string;
|
|
463
|
-
name: string;
|
|
464
|
-
description?: string | undefined;
|
|
465
|
-
mimeType?: string | undefined;
|
|
466
|
-
annotations?:
|
|
467
|
-
| {
|
|
468
|
-
audience?: ("user" | "assistant")[] | undefined;
|
|
469
|
-
priority?: number | undefined;
|
|
470
|
-
lastModified?: string | undefined;
|
|
471
|
-
}
|
|
472
|
-
| undefined;
|
|
473
|
-
_meta?:
|
|
474
|
-
| {
|
|
475
|
-
[x: string]: unknown;
|
|
476
|
-
}
|
|
477
|
-
| undefined;
|
|
478
|
-
icons?:
|
|
479
|
-
| {
|
|
480
|
-
src: string;
|
|
481
|
-
mimeType?: string | undefined;
|
|
482
|
-
sizes?: string[] | undefined;
|
|
483
|
-
theme?: "light" | "dark" | undefined;
|
|
484
|
-
}[]
|
|
485
|
-
| undefined;
|
|
486
|
-
title?: string | undefined;
|
|
487
|
-
}[]
|
|
488
|
-
>;
|
|
489
|
-
fetchPrompts(): Promise<
|
|
490
|
-
{
|
|
491
|
-
name: string;
|
|
492
|
-
description?: string | undefined;
|
|
493
|
-
arguments?:
|
|
494
|
-
| {
|
|
495
|
-
name: string;
|
|
496
|
-
description?: string | undefined;
|
|
497
|
-
required?: boolean | undefined;
|
|
498
|
-
}[]
|
|
499
|
-
| undefined;
|
|
500
|
-
_meta?:
|
|
501
|
-
| {
|
|
502
|
-
[x: string]: unknown;
|
|
503
|
-
}
|
|
504
|
-
| undefined;
|
|
505
|
-
icons?:
|
|
506
|
-
| {
|
|
507
|
-
src: string;
|
|
508
|
-
mimeType?: string | undefined;
|
|
509
|
-
sizes?: string[] | undefined;
|
|
510
|
-
theme?: "light" | "dark" | undefined;
|
|
511
|
-
}[]
|
|
512
|
-
| undefined;
|
|
513
|
-
title?: string | undefined;
|
|
514
|
-
}[]
|
|
515
|
-
>;
|
|
516
|
-
fetchResourceTemplates(): Promise<
|
|
517
|
-
{
|
|
518
|
-
uriTemplate: string;
|
|
519
|
-
name: string;
|
|
520
|
-
description?: string | undefined;
|
|
521
|
-
mimeType?: string | undefined;
|
|
522
|
-
annotations?:
|
|
523
|
-
| {
|
|
524
|
-
audience?: ("user" | "assistant")[] | undefined;
|
|
525
|
-
priority?: number | undefined;
|
|
526
|
-
lastModified?: string | undefined;
|
|
527
|
-
}
|
|
528
|
-
| undefined;
|
|
529
|
-
_meta?:
|
|
530
|
-
| {
|
|
531
|
-
[x: string]: unknown;
|
|
532
|
-
}
|
|
533
|
-
| undefined;
|
|
534
|
-
icons?:
|
|
535
|
-
| {
|
|
536
|
-
src: string;
|
|
537
|
-
mimeType?: string | undefined;
|
|
538
|
-
sizes?: string[] | undefined;
|
|
539
|
-
theme?: "light" | "dark" | undefined;
|
|
540
|
-
}[]
|
|
541
|
-
| undefined;
|
|
542
|
-
title?: string | undefined;
|
|
543
|
-
}[]
|
|
544
|
-
>;
|
|
545
|
-
/**
|
|
546
|
-
* Handle elicitation request from server
|
|
547
|
-
* Automatically uses the Agent's built-in elicitation handling if available
|
|
548
|
-
*/
|
|
549
|
-
handleElicitationRequest(_request: ElicitRequest): Promise<ElicitResult>;
|
|
550
|
-
/**
|
|
551
|
-
* Get the transport for the client
|
|
552
|
-
* @param transportType - The transport type to get
|
|
553
|
-
* @returns The transport for the client
|
|
554
|
-
*/
|
|
555
|
-
getTransport(
|
|
556
|
-
transportType: BaseTransportType
|
|
557
|
-
): StreamableHTTPClientTransport | SSEClientTransport | RPCClientTransport;
|
|
558
|
-
private tryConnect;
|
|
559
|
-
private _capabilityErrorHandler;
|
|
560
|
-
}
|
|
561
|
-
//#endregion
|
|
562
|
-
//#region src/mcp/client-storage.d.ts
|
|
563
|
-
/**
|
|
564
|
-
* Represents a row in the cf_agents_mcp_servers table
|
|
565
|
-
*/
|
|
566
|
-
type MCPServerRow = {
|
|
567
|
-
id: string;
|
|
568
|
-
name: string;
|
|
569
|
-
server_url: string;
|
|
570
|
-
client_id: string | null;
|
|
571
|
-
auth_url: string | null;
|
|
572
|
-
callback_url: string;
|
|
573
|
-
server_options: string | null;
|
|
574
|
-
};
|
|
575
|
-
//#endregion
|
|
576
|
-
export {
|
|
577
|
-
ServeOptions as C,
|
|
578
|
-
Event as E,
|
|
579
|
-
McpClientOptions as S,
|
|
580
|
-
Emitter as T,
|
|
581
|
-
WorkerTransportOptions as _,
|
|
582
|
-
RPCClientTransport as a,
|
|
583
|
-
BaseTransportType as b,
|
|
584
|
-
RPCServerTransportOptions as c,
|
|
585
|
-
createMcpHandler as d,
|
|
586
|
-
experimental_createMcpHandler as f,
|
|
587
|
-
WorkerTransport as g,
|
|
588
|
-
TransportState as h,
|
|
589
|
-
MCPTransportOptions as i,
|
|
590
|
-
RPC_DO_PREFIX as l,
|
|
591
|
-
getMcpAuthContext as m,
|
|
592
|
-
MCPClientConnection as n,
|
|
593
|
-
RPCClientTransportOptions as o,
|
|
594
|
-
McpAuthContext as p,
|
|
595
|
-
MCPConnectionState as r,
|
|
596
|
-
RPCServerTransport as s,
|
|
597
|
-
MCPServerRow as t,
|
|
598
|
-
CreateMcpHandlerOptions as u,
|
|
599
|
-
SSEEdgeClientTransport as v,
|
|
600
|
-
TransportType as w,
|
|
601
|
-
MaybePromise as x,
|
|
602
|
-
StreamableHTTPEdgeClientTransport as y
|
|
603
|
-
};
|
|
604
|
-
//# sourceMappingURL=client-storage-BPjfP_is.d.ts.map
|