agents 0.0.0-a215bb2 → 0.0.0-a43b7dd
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.d.ts +10 -10
- package/dist/ai-chat-agent.js +6 -6
- package/dist/{ai-chat-v5-migration-gdyLiTd8.js → ai-chat-v5-migration-DBHGW4Hv.js} +2 -2
- package/dist/{ai-chat-v5-migration-gdyLiTd8.js.map → ai-chat-v5-migration-DBHGW4Hv.js.map} +1 -1
- package/dist/ai-chat-v5-migration.js +1 -1
- package/dist/ai-react.d.ts +9 -9
- package/dist/ai-react.js +1 -1
- package/dist/{ai-types-UZlfLOYP.js → ai-types-B3aQaFv3.js} +2 -2
- package/dist/{ai-types-UZlfLOYP.js.map → ai-types-B3aQaFv3.js.map} +1 -1
- package/dist/{ai-types-BWW4umHY.d.ts → ai-types-D5YoPrBZ.d.ts} +2 -2
- package/dist/ai-types.d.ts +4 -4
- package/dist/ai-types.js +1 -1
- package/dist/{client-CZBVDDoO.js → client-9Ld2_lnt.js} +2 -2
- package/dist/{client-CZBVDDoO.js.map → client-9Ld2_lnt.js.map} +1 -1
- package/dist/{client-DjR-lC16.js → client-BfiZ3HQd.js} +3 -3
- package/dist/{client-DjR-lC16.js.map → client-BfiZ3HQd.js.map} +1 -1
- package/dist/{client-CmMi85Sj.d.ts → client-CbWe9FBd.d.ts} +10 -10
- package/dist/{client-C-nwz-3N.d.ts → client-QsahQRc6.d.ts} +23 -23
- package/dist/client.d.ts +8 -8
- package/dist/client.js +2 -2
- package/dist/codemode/ai.js +5 -5
- package/dist/{do-oauth-client-provider-B2jr6UNq.js → do-oauth-client-provider-CswoD5Lu.js} +2 -2
- package/dist/{do-oauth-client-provider-B2jr6UNq.js.map → do-oauth-client-provider-CswoD5Lu.js.map} +1 -1
- package/dist/{do-oauth-client-provider-CCwGwnrA.d.ts → do-oauth-client-provider-DGc5pP0l.d.ts} +2 -2
- package/dist/{index-CMEWpbHx.d.ts → index-BpQs7AMt.d.ts} +48 -56
- package/dist/{index-W4JUkafc.d.ts → index-DhJCaDWd.d.ts} +7 -3
- package/dist/index.d.ts +36 -36
- package/dist/index.js +5 -5
- package/dist/mcp/client.d.ts +3 -3
- package/dist/mcp/client.js +1 -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 +61 -7
- package/dist/mcp/index.js +395 -7
- package/dist/mcp/index.js.map +1 -1
- package/dist/{mcp-BEwaCsxO.d.ts → mcp-Dw5vDrY8.d.ts} +2 -2
- package/dist/observability/index.d.ts +2 -2
- package/dist/observability/index.js +5 -5
- package/dist/{react-jvtffQuA.d.ts → react-CdVj44qy.d.ts} +28 -26
- package/dist/react.d.ts +9 -9
- package/dist/react.js +1 -1
- package/dist/{serializable-gtr9YMhp.d.ts → serializable-CymX8ovI.d.ts} +8 -3
- package/dist/serializable.d.ts +5 -5
- package/dist/{src-L3cHuAag.js → src-Dz0H9hSU.js} +63 -94
- package/dist/src-Dz0H9hSU.js.map +1 -0
- package/package.json +5 -5
- package/dist/src-L3cHuAag.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MCPObservabilityEvent } from "./mcp-
|
|
2
|
-
import { AgentsOAuthProvider } from "./do-oauth-client-provider-
|
|
1
|
+
import { t as MCPObservabilityEvent } from "./mcp-Dw5vDrY8.js";
|
|
2
|
+
import { t as AgentsOAuthProvider } from "./do-oauth-client-provider-DGc5pP0l.js";
|
|
3
3
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
4
4
|
import {
|
|
5
5
|
CallToolRequest,
|
|
@@ -32,7 +32,7 @@ import { RequestOptions } from "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
|
32
32
|
interface Disposable {
|
|
33
33
|
dispose(): void;
|
|
34
34
|
}
|
|
35
|
-
type Event<T> = (listener: (e: T) => void) => Disposable;
|
|
35
|
+
type Event<T$1> = (listener: (e: T$1) => void) => Disposable;
|
|
36
36
|
//#endregion
|
|
37
37
|
//#region src/mcp/sse-edge.d.ts
|
|
38
38
|
declare class SSEEdgeClientTransport extends SSEClientTransport {
|
|
@@ -65,7 +65,7 @@ declare class StreamableHTTPEdgeClientTransport extends StreamableHTTPClientTran
|
|
|
65
65
|
}
|
|
66
66
|
//#endregion
|
|
67
67
|
//#region src/mcp/types.d.ts
|
|
68
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
68
|
+
type MaybePromise<T$1> = T$1 | Promise<T$1>;
|
|
69
69
|
type BaseTransportType = "sse" | "streamable-http";
|
|
70
70
|
type TransportType = BaseTransportType | "auto";
|
|
71
71
|
interface CORSOptions {
|
|
@@ -168,13 +168,13 @@ declare class MCPClientConnection {
|
|
|
168
168
|
| undefined;
|
|
169
169
|
required?: string[] | undefined;
|
|
170
170
|
};
|
|
171
|
-
description?: string | undefined;
|
|
172
171
|
_meta?:
|
|
173
172
|
| {
|
|
174
173
|
[x: string]: unknown;
|
|
175
174
|
}
|
|
176
175
|
| undefined;
|
|
177
176
|
title?: string | undefined;
|
|
177
|
+
description?: string | undefined;
|
|
178
178
|
icons?:
|
|
179
179
|
| {
|
|
180
180
|
[x: string]: unknown;
|
|
@@ -212,7 +212,6 @@ declare class MCPClientConnection {
|
|
|
212
212
|
[x: string]: unknown;
|
|
213
213
|
name: string;
|
|
214
214
|
uri: string;
|
|
215
|
-
description?: string | undefined;
|
|
216
215
|
_meta?:
|
|
217
216
|
| {
|
|
218
217
|
[x: string]: unknown;
|
|
@@ -220,6 +219,7 @@ declare class MCPClientConnection {
|
|
|
220
219
|
| undefined;
|
|
221
220
|
mimeType?: string | undefined;
|
|
222
221
|
title?: string | undefined;
|
|
222
|
+
description?: string | undefined;
|
|
223
223
|
icons?:
|
|
224
224
|
| {
|
|
225
225
|
[x: string]: unknown;
|
|
@@ -234,7 +234,6 @@ declare class MCPClientConnection {
|
|
|
234
234
|
{
|
|
235
235
|
[x: string]: unknown;
|
|
236
236
|
name: string;
|
|
237
|
-
description?: string | undefined;
|
|
238
237
|
_meta?:
|
|
239
238
|
| {
|
|
240
239
|
[x: string]: unknown;
|
|
@@ -249,6 +248,7 @@ declare class MCPClientConnection {
|
|
|
249
248
|
}[]
|
|
250
249
|
| undefined;
|
|
251
250
|
title?: string | undefined;
|
|
251
|
+
description?: string | undefined;
|
|
252
252
|
icons?:
|
|
253
253
|
| {
|
|
254
254
|
[x: string]: unknown;
|
|
@@ -264,7 +264,6 @@ declare class MCPClientConnection {
|
|
|
264
264
|
[x: string]: unknown;
|
|
265
265
|
name: string;
|
|
266
266
|
uriTemplate: string;
|
|
267
|
-
description?: string | undefined;
|
|
268
267
|
_meta?:
|
|
269
268
|
| {
|
|
270
269
|
[x: string]: unknown;
|
|
@@ -272,6 +271,7 @@ declare class MCPClientConnection {
|
|
|
272
271
|
| undefined;
|
|
273
272
|
mimeType?: string | undefined;
|
|
274
273
|
title?: string | undefined;
|
|
274
|
+
description?: string | undefined;
|
|
275
275
|
icons?:
|
|
276
276
|
| {
|
|
277
277
|
[x: string]: unknown;
|
|
@@ -5292,22 +5292,22 @@ type NamespacedData = {
|
|
|
5292
5292
|
serverId: string;
|
|
5293
5293
|
})[];
|
|
5294
5294
|
};
|
|
5295
|
-
declare function getNamespacedData<T extends keyof NamespacedData>(
|
|
5295
|
+
declare function getNamespacedData<T$1 extends keyof NamespacedData>(
|
|
5296
5296
|
mcpClients: Record<string, MCPClientConnection>,
|
|
5297
|
-
type: T
|
|
5298
|
-
): NamespacedData[T];
|
|
5297
|
+
type: T$1
|
|
5298
|
+
): NamespacedData[T$1];
|
|
5299
5299
|
//#endregion
|
|
5300
5300
|
export {
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5301
|
+
MCPConnectionState as a,
|
|
5302
|
+
ServeOptions as c,
|
|
5303
|
+
SSEEdgeClientTransport as d,
|
|
5304
|
+
getNamespacedData as i,
|
|
5305
|
+
TransportType as l,
|
|
5306
|
+
MCPClientOAuthCallbackConfig as n,
|
|
5307
|
+
BaseTransportType as o,
|
|
5308
|
+
MCPClientOAuthResult as r,
|
|
5309
|
+
MaybePromise as s,
|
|
5310
|
+
MCPClientManager as t,
|
|
5311
|
+
StreamableHTTPEdgeClientTransport as u
|
|
5312
5312
|
};
|
|
5313
|
-
//# sourceMappingURL=client-
|
|
5313
|
+
//# sourceMappingURL=client-QsahQRc6.d.ts.map
|
package/dist/client.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import "./serializable-
|
|
1
|
+
import "./serializable-CymX8ovI.js";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from "./client-
|
|
3
|
+
a as agentFetch,
|
|
4
|
+
i as StreamOptions,
|
|
5
|
+
n as AgentClientFetchOptions,
|
|
6
|
+
o as camelCaseToKebabCase,
|
|
7
|
+
r as AgentClientOptions,
|
|
8
|
+
t as AgentClient
|
|
9
|
+
} from "./client-CbWe9FBd.js";
|
|
10
10
|
export {
|
|
11
11
|
AgentClient,
|
|
12
12
|
AgentClientFetchOptions,
|
package/dist/client.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./ai-types-
|
|
2
|
-
import {
|
|
1
|
+
import "./ai-types-B3aQaFv3.js";
|
|
2
|
+
import { n as agentFetch, r as camelCaseToKebabCase, t as AgentClient } from "./client-BfiZ3HQd.js";
|
|
3
3
|
|
|
4
4
|
export { AgentClient, agentFetch, camelCaseToKebabCase };
|
package/dist/codemode/ai.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "../ai-types-
|
|
2
|
-
import "../client-
|
|
3
|
-
import "../client-
|
|
4
|
-
import "../do-oauth-client-provider-
|
|
5
|
-
import { getAgentByName } from "../src-
|
|
1
|
+
import "../ai-types-B3aQaFv3.js";
|
|
2
|
+
import "../client-BfiZ3HQd.js";
|
|
3
|
+
import "../client-9Ld2_lnt.js";
|
|
4
|
+
import "../do-oauth-client-provider-CswoD5Lu.js";
|
|
5
|
+
import { s as getAgentByName } from "../src-Dz0H9hSU.js";
|
|
6
6
|
import { generateObject, tool } from "ai";
|
|
7
7
|
import { openai } from "@ai-sdk/openai";
|
|
8
8
|
import { z } from "zod/v3";
|
|
@@ -89,5 +89,5 @@ var DurableObjectOAuthClientProvider = class {
|
|
|
89
89
|
};
|
|
90
90
|
|
|
91
91
|
//#endregion
|
|
92
|
-
export { DurableObjectOAuthClientProvider };
|
|
93
|
-
//# sourceMappingURL=do-oauth-client-provider-
|
|
92
|
+
export { DurableObjectOAuthClientProvider as t };
|
|
93
|
+
//# sourceMappingURL=do-oauth-client-provider-CswoD5Lu.js.map
|
package/dist/{do-oauth-client-provider-B2jr6UNq.js.map → do-oauth-client-provider-CswoD5Lu.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"do-oauth-client-provider-
|
|
1
|
+
{"version":3,"file":"do-oauth-client-provider-CswoD5Lu.js","names":["storage: DurableObjectStorage","clientName: string","baseRedirectUrl: string"],"sources":["../src/mcp/do-oauth-client-provider.ts"],"sourcesContent":["import type { OAuthClientProvider } from \"@modelcontextprotocol/sdk/client/auth.js\";\nimport type {\n OAuthClientInformation,\n OAuthClientInformationFull,\n OAuthClientMetadata,\n OAuthTokens\n} from \"@modelcontextprotocol/sdk/shared/auth.js\";\nimport { nanoid } from \"nanoid\";\n\n// A slight extension to the standard OAuthClientProvider interface because `redirectToAuthorization` doesn't give us the interface we need\n// This allows us to track authentication for a specific server and associated dynamic client registration\nexport interface AgentsOAuthProvider extends OAuthClientProvider {\n authUrl: string | undefined;\n clientId: string | undefined;\n serverId: string | undefined;\n}\n\nexport class DurableObjectOAuthClientProvider implements AgentsOAuthProvider {\n private _authUrl_: string | undefined;\n private _serverId_: string | undefined;\n private _clientId_: string | undefined;\n\n constructor(\n public storage: DurableObjectStorage,\n public clientName: string,\n public baseRedirectUrl: string\n ) {}\n\n get clientMetadata(): OAuthClientMetadata {\n return {\n client_name: this.clientName,\n client_uri: this.clientUri,\n grant_types: [\"authorization_code\", \"refresh_token\"],\n redirect_uris: [this.redirectUrl],\n response_types: [\"code\"],\n token_endpoint_auth_method: \"none\"\n };\n }\n\n get clientUri() {\n return new URL(this.redirectUrl).origin;\n }\n\n get redirectUrl() {\n return `${this.baseRedirectUrl}/${this.serverId}`;\n }\n\n get clientId() {\n if (!this._clientId_) {\n throw new Error(\"Trying to access clientId before it was set\");\n }\n return this._clientId_;\n }\n\n set clientId(clientId_: string) {\n this._clientId_ = clientId_;\n }\n\n get serverId() {\n if (!this._serverId_) {\n throw new Error(\"Trying to access serverId before it was set\");\n }\n return this._serverId_;\n }\n\n set serverId(serverId_: string) {\n this._serverId_ = serverId_;\n }\n\n keyPrefix(clientId: string) {\n return `/${this.clientName}/${this.serverId}/${clientId}`;\n }\n\n clientInfoKey(clientId: string) {\n return `${this.keyPrefix(clientId)}/client_info/`;\n }\n\n async clientInformation(): Promise<OAuthClientInformation | undefined> {\n if (!this._clientId_) {\n return undefined;\n }\n return (\n (await this.storage.get<OAuthClientInformation>(\n this.clientInfoKey(this.clientId)\n )) ?? undefined\n );\n }\n\n async saveClientInformation(\n clientInformation: OAuthClientInformationFull\n ): Promise<void> {\n await this.storage.put(\n this.clientInfoKey(clientInformation.client_id),\n clientInformation\n );\n this.clientId = clientInformation.client_id;\n }\n\n tokenKey(clientId: string) {\n return `${this.keyPrefix(clientId)}/token`;\n }\n\n async tokens(): Promise<OAuthTokens | undefined> {\n if (!this._clientId_) {\n return undefined;\n }\n return (\n (await this.storage.get<OAuthTokens>(this.tokenKey(this.clientId))) ??\n undefined\n );\n }\n\n async saveTokens(tokens: OAuthTokens): Promise<void> {\n await this.storage.put(this.tokenKey(this.clientId), tokens);\n }\n\n get authUrl() {\n return this._authUrl_;\n }\n\n /**\n * Because this operates on the server side (but we need browser auth), we send this url back to the user\n * and require user interact to initiate the redirect flow\n */\n async redirectToAuthorization(authUrl: URL): Promise<void> {\n // Generate secure random token for state parameter\n const stateToken = nanoid();\n authUrl.searchParams.set(\"state\", stateToken);\n this._authUrl_ = authUrl.toString();\n }\n\n codeVerifierKey(clientId: string) {\n return `${this.keyPrefix(clientId)}/code_verifier`;\n }\n\n async saveCodeVerifier(verifier: string): Promise<void> {\n const key = this.codeVerifierKey(this.clientId);\n\n // Don't overwrite existing verifier to preserve first PKCE verifier\n const existing = await this.storage.get<string>(key);\n if (existing) {\n return;\n }\n\n await this.storage.put(key, verifier);\n }\n\n async codeVerifier(): Promise<string> {\n const codeVerifier = await this.storage.get<string>(\n this.codeVerifierKey(this.clientId)\n );\n if (!codeVerifier) {\n throw new Error(\"No code verifier found\");\n }\n return codeVerifier;\n }\n}\n"],"mappings":";;;AAiBA,IAAa,mCAAb,MAA6E;CAK3E,YACE,AAAOA,SACP,AAAOC,YACP,AAAOC,iBACP;EAHO;EACA;EACA;;CAGT,IAAI,iBAAsC;AACxC,SAAO;GACL,aAAa,KAAK;GAClB,YAAY,KAAK;GACjB,aAAa,CAAC,sBAAsB,gBAAgB;GACpD,eAAe,CAAC,KAAK,YAAY;GACjC,gBAAgB,CAAC,OAAO;GACxB,4BAA4B;GAC7B;;CAGH,IAAI,YAAY;AACd,SAAO,IAAI,IAAI,KAAK,YAAY,CAAC;;CAGnC,IAAI,cAAc;AAChB,SAAO,GAAG,KAAK,gBAAgB,GAAG,KAAK;;CAGzC,IAAI,WAAW;AACb,MAAI,CAAC,KAAK,WACR,OAAM,IAAI,MAAM,8CAA8C;AAEhE,SAAO,KAAK;;CAGd,IAAI,SAAS,WAAmB;AAC9B,OAAK,aAAa;;CAGpB,IAAI,WAAW;AACb,MAAI,CAAC,KAAK,WACR,OAAM,IAAI,MAAM,8CAA8C;AAEhE,SAAO,KAAK;;CAGd,IAAI,SAAS,WAAmB;AAC9B,OAAK,aAAa;;CAGpB,UAAU,UAAkB;AAC1B,SAAO,IAAI,KAAK,WAAW,GAAG,KAAK,SAAS,GAAG;;CAGjD,cAAc,UAAkB;AAC9B,SAAO,GAAG,KAAK,UAAU,SAAS,CAAC;;CAGrC,MAAM,oBAAiE;AACrE,MAAI,CAAC,KAAK,WACR;AAEF,SACG,MAAM,KAAK,QAAQ,IAClB,KAAK,cAAc,KAAK,SAAS,CAClC,IAAK;;CAIV,MAAM,sBACJ,mBACe;AACf,QAAM,KAAK,QAAQ,IACjB,KAAK,cAAc,kBAAkB,UAAU,EAC/C,kBACD;AACD,OAAK,WAAW,kBAAkB;;CAGpC,SAAS,UAAkB;AACzB,SAAO,GAAG,KAAK,UAAU,SAAS,CAAC;;CAGrC,MAAM,SAA2C;AAC/C,MAAI,CAAC,KAAK,WACR;AAEF,SACG,MAAM,KAAK,QAAQ,IAAiB,KAAK,SAAS,KAAK,SAAS,CAAC,IAClE;;CAIJ,MAAM,WAAW,QAAoC;AACnD,QAAM,KAAK,QAAQ,IAAI,KAAK,SAAS,KAAK,SAAS,EAAE,OAAO;;CAG9D,IAAI,UAAU;AACZ,SAAO,KAAK;;;;;;CAOd,MAAM,wBAAwB,SAA6B;EAEzD,MAAM,aAAa,QAAQ;AAC3B,UAAQ,aAAa,IAAI,SAAS,WAAW;AAC7C,OAAK,YAAY,QAAQ,UAAU;;CAGrC,gBAAgB,UAAkB;AAChC,SAAO,GAAG,KAAK,UAAU,SAAS,CAAC;;CAGrC,MAAM,iBAAiB,UAAiC;EACtD,MAAM,MAAM,KAAK,gBAAgB,KAAK,SAAS;AAI/C,MADiB,MAAM,KAAK,QAAQ,IAAY,IAAI,CAElD;AAGF,QAAM,KAAK,QAAQ,IAAI,KAAK,SAAS;;CAGvC,MAAM,eAAgC;EACpC,MAAM,eAAe,MAAM,KAAK,QAAQ,IACtC,KAAK,gBAAgB,KAAK,SAAS,CACpC;AACD,MAAI,CAAC,aACH,OAAM,IAAI,MAAM,yBAAyB;AAE3C,SAAO"}
|
package/dist/{do-oauth-client-provider-CCwGwnrA.d.ts → do-oauth-client-provider-DGc5pP0l.d.ts}
RENAMED
|
@@ -51,5 +51,5 @@ declare class DurableObjectOAuthClientProvider implements AgentsOAuthProvider {
|
|
|
51
51
|
codeVerifier(): Promise<string>;
|
|
52
52
|
}
|
|
53
53
|
//#endregion
|
|
54
|
-
export {
|
|
55
|
-
//# sourceMappingURL=do-oauth-client-provider-
|
|
54
|
+
export { DurableObjectOAuthClientProvider as n, AgentsOAuthProvider as t };
|
|
55
|
+
//# sourceMappingURL=do-oauth-client-provider-DGc5pP0l.d.ts.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "./client-
|
|
6
|
-
import { Observability } from "./index-
|
|
7
|
-
import { MessageType } from "./ai-types-
|
|
2
|
+
a as MCPConnectionState,
|
|
3
|
+
l as TransportType,
|
|
4
|
+
t as MCPClientManager
|
|
5
|
+
} from "./client-QsahQRc6.js";
|
|
6
|
+
import { t as Observability } from "./index-DhJCaDWd.js";
|
|
7
|
+
import { n as MessageType } from "./ai-types-D5YoPrBZ.js";
|
|
8
8
|
import {
|
|
9
9
|
Connection,
|
|
10
10
|
Connection as Connection$1,
|
|
@@ -87,9 +87,9 @@ declare function callable(
|
|
|
87
87
|
* @param metadata Optional metadata about the callable method
|
|
88
88
|
*/
|
|
89
89
|
declare const unstable_callable: (metadata?: CallableMetadata) => void;
|
|
90
|
-
type QueueItem<T = string> = {
|
|
90
|
+
type QueueItem<T$1 = string> = {
|
|
91
91
|
id: string;
|
|
92
|
-
payload: T;
|
|
92
|
+
payload: T$1;
|
|
93
93
|
callback: keyof Agent<unknown>;
|
|
94
94
|
created_at: number;
|
|
95
95
|
};
|
|
@@ -97,13 +97,13 @@ type QueueItem<T = string> = {
|
|
|
97
97
|
* Represents a scheduled task within an Agent
|
|
98
98
|
* @template T Type of the payload data
|
|
99
99
|
*/
|
|
100
|
-
type Schedule<T = string> = {
|
|
100
|
+
type Schedule<T$1 = string> = {
|
|
101
101
|
/** Unique identifier for the schedule */
|
|
102
102
|
id: string;
|
|
103
103
|
/** Name of the method to be called */
|
|
104
104
|
callback: string;
|
|
105
105
|
/** Data to be passed to the callback */
|
|
106
|
-
payload: T;
|
|
106
|
+
payload: T$1;
|
|
107
107
|
} & (
|
|
108
108
|
| {
|
|
109
109
|
/** Type of schedule for one-time execution at a specific time */
|
|
@@ -152,9 +152,9 @@ type MCPServer = {
|
|
|
152
152
|
capabilities: ServerCapabilities | null;
|
|
153
153
|
};
|
|
154
154
|
declare function getCurrentAgent<
|
|
155
|
-
T extends Agent<unknown, unknown> = Agent<unknown, unknown>
|
|
155
|
+
T$1 extends Agent<unknown, unknown> = Agent<unknown, unknown>
|
|
156
156
|
>(): {
|
|
157
|
-
agent: T | undefined;
|
|
157
|
+
agent: T$1 | undefined;
|
|
158
158
|
connection: Connection | undefined;
|
|
159
159
|
request: Request | undefined;
|
|
160
160
|
email: AgentEmail | undefined;
|
|
@@ -171,6 +171,7 @@ declare class Agent<
|
|
|
171
171
|
> extends Server<Env, Props> {
|
|
172
172
|
private _state;
|
|
173
173
|
private _disposables;
|
|
174
|
+
private _mcpStateRestored;
|
|
174
175
|
private _ParentClass;
|
|
175
176
|
readonly mcp: MCPClientManager;
|
|
176
177
|
/**
|
|
@@ -346,6 +347,7 @@ declare class Agent<
|
|
|
346
347
|
* @returns A map of method names to their metadata
|
|
347
348
|
*/
|
|
348
349
|
private _isCallable;
|
|
350
|
+
private _ensureMcpStateRestored;
|
|
349
351
|
/**
|
|
350
352
|
* Connect to a new MCP Server
|
|
351
353
|
*
|
|
@@ -372,16 +374,6 @@ declare class Agent<
|
|
|
372
374
|
id: string;
|
|
373
375
|
authUrl: string | undefined;
|
|
374
376
|
}>;
|
|
375
|
-
/**
|
|
376
|
-
* Handle potential OAuth callback requests after DO hibernation.
|
|
377
|
-
* Detects OAuth callbacks, restores state from database, and processes the callback.
|
|
378
|
-
* Returns a Response if this was an OAuth callback, otherwise returns undefined.
|
|
379
|
-
*/
|
|
380
|
-
private _handlePotentialOAuthCallback;
|
|
381
|
-
/**
|
|
382
|
-
* Process an OAuth callback request (assumes state is already restored)
|
|
383
|
-
*/
|
|
384
|
-
private _processOAuthCallback;
|
|
385
377
|
private _connectToMcpServerInternal;
|
|
386
378
|
removeMcpServer(id: string): Promise<void>;
|
|
387
379
|
getMcpServers(): MCPServersState;
|
|
@@ -502,17 +494,17 @@ type EmailSendOptions = {
|
|
|
502
494
|
*/
|
|
503
495
|
declare function getAgentByName<
|
|
504
496
|
Env,
|
|
505
|
-
T extends Agent<Env>,
|
|
497
|
+
T$1 extends Agent<Env>,
|
|
506
498
|
Props extends Record<string, unknown> = Record<string, unknown>
|
|
507
499
|
>(
|
|
508
|
-
namespace: AgentNamespace<T>,
|
|
500
|
+
namespace: AgentNamespace<T$1>,
|
|
509
501
|
name: string,
|
|
510
502
|
options?: {
|
|
511
503
|
jurisdiction?: DurableObjectJurisdiction;
|
|
512
504
|
locationHint?: DurableObjectLocationHint;
|
|
513
505
|
props?: Props;
|
|
514
506
|
}
|
|
515
|
-
): Promise<DurableObjectStub<T>>;
|
|
507
|
+
): Promise<DurableObjectStub<T$1>>;
|
|
516
508
|
/**
|
|
517
509
|
* A wrapper for streaming responses in callable methods
|
|
518
510
|
*/
|
|
@@ -534,35 +526,35 @@ declare class StreamingResponse {
|
|
|
534
526
|
}
|
|
535
527
|
//#endregion
|
|
536
528
|
export {
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
QueueItem,
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
529
|
+
unstable_callable as A,
|
|
530
|
+
createAddressBasedEmailResolver as C,
|
|
531
|
+
getCurrentAgent as D,
|
|
532
|
+
getAgentByName as E,
|
|
533
|
+
routeAgentEmail as O,
|
|
534
|
+
callable as S,
|
|
535
|
+
createHeaderBasedEmailResolver as T,
|
|
536
|
+
RPCResponse as _,
|
|
537
|
+
AgentOptions as a,
|
|
538
|
+
StreamingResponse as b,
|
|
539
|
+
ConnectionContext as c,
|
|
540
|
+
EmailSendOptions as d,
|
|
541
|
+
MCPServer as f,
|
|
542
|
+
RPCRequest as g,
|
|
543
|
+
QueueItem as h,
|
|
544
|
+
AgentNamespace as i,
|
|
545
|
+
routeAgentRequest as k,
|
|
546
|
+
EmailResolver as l,
|
|
547
|
+
MCPServersState as m,
|
|
548
|
+
AgentContext as n,
|
|
549
|
+
CallableMetadata as o,
|
|
550
|
+
MCPServerMessage as p,
|
|
551
|
+
AgentEmail as r,
|
|
552
|
+
Connection$1 as s,
|
|
553
|
+
Agent as t,
|
|
554
|
+
EmailRoutingOptions as u,
|
|
555
|
+
Schedule as v,
|
|
556
|
+
createCatchAllEmailResolver as w,
|
|
557
|
+
WSMessage as x,
|
|
558
|
+
StateUpdateMessage as y
|
|
567
559
|
};
|
|
568
|
-
//# sourceMappingURL=index-
|
|
560
|
+
//# sourceMappingURL=index-BpQs7AMt.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseEvent, MCPObservabilityEvent } from "./mcp-
|
|
1
|
+
import { n as BaseEvent, t as MCPObservabilityEvent } from "./mcp-Dw5vDrY8.js";
|
|
2
2
|
|
|
3
3
|
//#region src/observability/agent.d.ts
|
|
4
4
|
|
|
@@ -50,5 +50,9 @@ interface Observability {
|
|
|
50
50
|
*/
|
|
51
51
|
declare const genericObservability: Observability;
|
|
52
52
|
//#endregion
|
|
53
|
-
export {
|
|
54
|
-
|
|
53
|
+
export {
|
|
54
|
+
ObservabilityEvent as n,
|
|
55
|
+
genericObservability as r,
|
|
56
|
+
Observability as t
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=index-DhJCaDWd.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import { TransportType } from "./client-
|
|
2
|
-
import "./mcp-
|
|
3
|
-
import "./do-oauth-client-provider-
|
|
4
|
-
import "./index-
|
|
5
|
-
import "./ai-types-
|
|
1
|
+
import { l as TransportType } from "./client-QsahQRc6.js";
|
|
2
|
+
import "./mcp-Dw5vDrY8.js";
|
|
3
|
+
import "./do-oauth-client-provider-DGc5pP0l.js";
|
|
4
|
+
import "./index-DhJCaDWd.js";
|
|
5
|
+
import "./ai-types-D5YoPrBZ.js";
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
QueueItem,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} from "./index-
|
|
7
|
+
A as unstable_callable,
|
|
8
|
+
C as createAddressBasedEmailResolver,
|
|
9
|
+
D as getCurrentAgent,
|
|
10
|
+
E as getAgentByName,
|
|
11
|
+
O as routeAgentEmail,
|
|
12
|
+
S as callable,
|
|
13
|
+
T as createHeaderBasedEmailResolver,
|
|
14
|
+
_ as RPCResponse,
|
|
15
|
+
a as AgentOptions,
|
|
16
|
+
b as StreamingResponse,
|
|
17
|
+
c as ConnectionContext,
|
|
18
|
+
d as EmailSendOptions,
|
|
19
|
+
f as MCPServer,
|
|
20
|
+
g as RPCRequest,
|
|
21
|
+
h as QueueItem,
|
|
22
|
+
i as AgentNamespace,
|
|
23
|
+
k as routeAgentRequest,
|
|
24
|
+
l as EmailResolver,
|
|
25
|
+
m as MCPServersState,
|
|
26
|
+
n as AgentContext,
|
|
27
|
+
o as CallableMetadata,
|
|
28
|
+
p as MCPServerMessage,
|
|
29
|
+
r as AgentEmail,
|
|
30
|
+
s as Connection,
|
|
31
|
+
t as Agent,
|
|
32
|
+
u as EmailRoutingOptions,
|
|
33
|
+
v as Schedule,
|
|
34
|
+
w as createCatchAllEmailResolver,
|
|
35
|
+
x as WSMessage,
|
|
36
|
+
y as StateUpdateMessage
|
|
37
|
+
} from "./index-BpQs7AMt.js";
|
|
38
38
|
export {
|
|
39
39
|
Agent,
|
|
40
40
|
AgentContext,
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./ai-types-
|
|
2
|
-
import "./client-
|
|
3
|
-
import "./client-
|
|
4
|
-
import "./do-oauth-client-provider-
|
|
5
|
-
import {
|
|
1
|
+
import "./ai-types-B3aQaFv3.js";
|
|
2
|
+
import "./client-BfiZ3HQd.js";
|
|
3
|
+
import "./client-9Ld2_lnt.js";
|
|
4
|
+
import "./do-oauth-client-provider-CswoD5Lu.js";
|
|
5
|
+
import { a as createCatchAllEmailResolver, c as getCurrentAgent, d as unstable_callable, i as createAddressBasedEmailResolver, l as routeAgentEmail, n as StreamingResponse, o as createHeaderBasedEmailResolver, r as callable, s as getAgentByName, t as Agent, u as routeAgentRequest } from "./src-Dz0H9hSU.js";
|
|
6
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,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../mcp-
|
|
3
|
-
import "../do-oauth-client-provider-
|
|
1
|
+
import { i as getNamespacedData, n as MCPClientOAuthCallbackConfig, r as MCPClientOAuthResult, t as MCPClientManager } from "../client-QsahQRc6.js";
|
|
2
|
+
import "../mcp-Dw5vDrY8.js";
|
|
3
|
+
import "../do-oauth-client-provider-DGc5pP0l.js";
|
|
4
4
|
export { MCPClientManager, MCPClientOAuthCallbackConfig, MCPClientOAuthResult, getNamespacedData };
|
package/dist/mcp/client.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as DurableObjectOAuthClientProvider, t as AgentsOAuthProvider } from "../do-oauth-client-provider-DGc5pP0l.js";
|
|
2
2
|
export { AgentsOAuthProvider, DurableObjectOAuthClientProvider };
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,13 +1,67 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../mcp-
|
|
3
|
-
import "../do-oauth-client-provider-
|
|
4
|
-
import "../index-
|
|
5
|
-
import "../ai-types-
|
|
6
|
-
import {
|
|
1
|
+
import { c as ServeOptions, d as SSEEdgeClientTransport, n as MCPClientOAuthCallbackConfig, o as BaseTransportType, r as MCPClientOAuthResult, s as MaybePromise, u as StreamableHTTPEdgeClientTransport } from "../client-QsahQRc6.js";
|
|
2
|
+
import "../mcp-Dw5vDrY8.js";
|
|
3
|
+
import "../do-oauth-client-provider-DGc5pP0l.js";
|
|
4
|
+
import "../index-DhJCaDWd.js";
|
|
5
|
+
import "../ai-types-D5YoPrBZ.js";
|
|
6
|
+
import { c as ConnectionContext, s as Connection, t as Agent } from "../index-BpQs7AMt.js";
|
|
7
7
|
import { ElicitRequest, ElicitRequestSchema, ElicitResult, ElicitResult as ElicitResult$1, JSONRPCMessage } from "@modelcontextprotocol/sdk/types.js";
|
|
8
8
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
9
9
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
10
|
+
import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
|
|
10
11
|
|
|
12
|
+
//#region src/mcp/worker-transport.d.ts
|
|
13
|
+
interface WorkerTransportOptions {
|
|
14
|
+
sessionIdGenerator?: () => string;
|
|
15
|
+
enableJsonResponse?: boolean;
|
|
16
|
+
onsessioninitialized?: (sessionId: string) => void;
|
|
17
|
+
}
|
|
18
|
+
declare class WorkerTransport implements Transport {
|
|
19
|
+
private started;
|
|
20
|
+
private initialized;
|
|
21
|
+
private sessionIdGenerator?;
|
|
22
|
+
private enableJsonResponse;
|
|
23
|
+
private onsessioninitialized?;
|
|
24
|
+
private standaloneSseStreamId;
|
|
25
|
+
private streamMapping;
|
|
26
|
+
private requestToStreamMapping;
|
|
27
|
+
private requestResponseMap;
|
|
28
|
+
sessionId?: string;
|
|
29
|
+
onclose?: () => void;
|
|
30
|
+
onerror?: (error: Error) => void;
|
|
31
|
+
onmessage?: (message: JSONRPCMessage) => void;
|
|
32
|
+
constructor(options?: WorkerTransportOptions);
|
|
33
|
+
start(): Promise<void>;
|
|
34
|
+
handleRequest(request: Request, parsedBody?: unknown): Promise<Response>;
|
|
35
|
+
private handleGetRequest;
|
|
36
|
+
private handlePostRequest;
|
|
37
|
+
private handleDeleteRequest;
|
|
38
|
+
private handleOptionsRequest;
|
|
39
|
+
private handleUnsupportedRequest;
|
|
40
|
+
private validateSession;
|
|
41
|
+
close(): Promise<void>;
|
|
42
|
+
send(message: JSONRPCMessage): Promise<void>;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/mcp/handler.d.ts
|
|
46
|
+
interface CreateMcpHandlerOptions extends WorkerTransportOptions {
|
|
47
|
+
/**
|
|
48
|
+
* The route path that this MCP handler should respond to.
|
|
49
|
+
* If specified, the handler will only process requests that match this route.
|
|
50
|
+
* @default "/mcp"
|
|
51
|
+
*/
|
|
52
|
+
route?: string;
|
|
53
|
+
}
|
|
54
|
+
type OAuthExecutionContext = ExecutionContext & {
|
|
55
|
+
props?: Record<string, unknown>;
|
|
56
|
+
};
|
|
57
|
+
declare function experimental_createMcpHandler(server: McpServer | Server, options?: CreateMcpHandlerOptions): (request: Request, env: unknown, ctx: ExecutionContext) => Promise<Response>;
|
|
58
|
+
//#endregion
|
|
59
|
+
//#region src/mcp/auth-context.d.ts
|
|
60
|
+
interface McpAuthContext {
|
|
61
|
+
props: Record<string, unknown>;
|
|
62
|
+
}
|
|
63
|
+
declare function getMcpAuthContext(): McpAuthContext | undefined;
|
|
64
|
+
//#endregion
|
|
11
65
|
//#region src/mcp/index.d.ts
|
|
12
66
|
declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Record<string, unknown> = Record<string, unknown>> extends Agent<Env, State, Props> {
|
|
13
67
|
private _transport?;
|
|
@@ -71,5 +125,5 @@ declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Re
|
|
|
71
125
|
};
|
|
72
126
|
}
|
|
73
127
|
//#endregion
|
|
74
|
-
export { type ElicitRequest, ElicitRequestSchema, type ElicitResult, type MCPClientOAuthCallbackConfig, type MCPClientOAuthResult, McpAgent, SSEEdgeClientTransport, StreamableHTTPEdgeClientTransport };
|
|
128
|
+
export { type CreateMcpHandlerOptions, type ElicitRequest, ElicitRequestSchema, type ElicitResult, type MCPClientOAuthCallbackConfig, type MCPClientOAuthResult, McpAgent, type McpAuthContext, type OAuthExecutionContext, SSEEdgeClientTransport, StreamableHTTPEdgeClientTransport, WorkerTransport, type WorkerTransportOptions, experimental_createMcpHandler, getMcpAuthContext };
|
|
75
129
|
//# sourceMappingURL=index.d.ts.map
|