agents 0.0.0-bfc9c75 → 0.0.0-bfe9e3d
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/_esm-LV5FJ3HK.js +3922 -0
- package/dist/_esm-LV5FJ3HK.js.map +1 -0
- package/dist/ai-chat-agent.d.ts +2 -1
- package/dist/ai-chat-agent.js +350 -57
- package/dist/ai-chat-agent.js.map +1 -1
- package/dist/ai-chat-v5-migration.js +1 -0
- package/dist/ai-react.d.ts +8 -1
- package/dist/ai-react.js +157 -111
- package/dist/ai-react.js.map +1 -1
- package/dist/ai-types.d.ts +1 -0
- package/dist/ai-types.js +2 -1
- package/dist/ccip-CMBYN64O.js +15 -0
- package/dist/ccip-CMBYN64O.js.map +1 -0
- package/dist/{chunk-YDUDMOL6.js → chunk-254F4GDT.js} +97 -50
- package/dist/chunk-254F4GDT.js.map +1 -0
- package/dist/{chunk-MH46VMM4.js → chunk-3OT2NNEW.js} +396 -67
- package/dist/chunk-3OT2NNEW.js.map +1 -0
- package/dist/chunk-5Y6BEZDY.js +276 -0
- package/dist/chunk-5Y6BEZDY.js.map +1 -0
- package/dist/{chunk-AVYJQSLW.js → chunk-BER7KXUJ.js} +2 -1
- package/dist/chunk-BER7KXUJ.js.map +1 -0
- package/dist/chunk-JJBFIGUC.js +5202 -0
- package/dist/chunk-JJBFIGUC.js.map +1 -0
- package/dist/chunk-PR4QN5HX.js +43 -0
- package/dist/chunk-PR4QN5HX.js.map +1 -0
- package/dist/chunk-TYAY6AU6.js +159 -0
- package/dist/chunk-TYAY6AU6.js.map +1 -0
- package/dist/{chunk-LL2AFX7V.js → chunk-Z44WASMA.js} +7 -2
- package/dist/{chunk-LL2AFX7V.js.map → chunk-Z44WASMA.js.map} +1 -1
- package/dist/{client-CvaJdLQA.d.ts → client-DVoPb3-C.d.ts} +131 -26
- package/dist/client.js +2 -1
- package/dist/codemode/ai.d.ts +25 -0
- package/dist/codemode/ai.js +5112 -0
- package/dist/codemode/ai.js.map +1 -0
- package/dist/index.d.ts +25 -32
- package/dist/index.js +5 -4
- package/dist/mcp/client.d.ts +2 -1
- package/dist/mcp/client.js +2 -1
- package/dist/mcp/do-oauth-client-provider.js +2 -1
- package/dist/mcp/index.d.ts +13 -31
- package/dist/mcp/index.js +233 -163
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/x402.d.ts +39 -0
- package/dist/mcp/x402.js +3195 -0
- package/dist/mcp/x402.js.map +1 -0
- package/dist/mcp-BH1fJeiU.d.ts +58 -0
- package/dist/observability/index.d.ts +12 -24
- package/dist/observability/index.js +5 -4
- package/dist/react.d.ts +10 -6
- package/dist/react.js +101 -3
- package/dist/react.js.map +1 -1
- package/dist/schedule.js +2 -0
- package/dist/schedule.js.map +1 -1
- package/dist/secp256k1-M22GZP2U.js +2193 -0
- package/dist/secp256k1-M22GZP2U.js.map +1 -0
- package/package.json +19 -6
- package/src/index.ts +141 -57
- package/dist/chunk-AVYJQSLW.js.map +0 -1
- package/dist/chunk-MH46VMM4.js.map +0 -1
- package/dist/chunk-YDUDMOL6.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,12 +8,17 @@ import {
|
|
|
8
8
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
9
9
|
import { Server, Connection, PartyServerOptions } from "partyserver";
|
|
10
10
|
export { Connection, ConnectionContext, WSMessage } from "partyserver";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
e as MCPClientManager,
|
|
13
|
+
T as TransportType,
|
|
14
|
+
f as MCPConnectionState
|
|
15
|
+
} from "./client-DVoPb3-C.js";
|
|
12
16
|
import { Observability } from "./observability/index.js";
|
|
13
17
|
import { MessageType } from "./ai-types.js";
|
|
14
18
|
import "zod";
|
|
15
19
|
import "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
16
20
|
import "ai";
|
|
21
|
+
import "./mcp-BH1fJeiU.js";
|
|
17
22
|
import "@modelcontextprotocol/sdk/client/sse.js";
|
|
18
23
|
import "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
19
24
|
import "./mcp/do-oauth-client-provider.js";
|
|
@@ -124,6 +129,7 @@ type Schedule<T = string> = {
|
|
|
124
129
|
cron: string;
|
|
125
130
|
}
|
|
126
131
|
);
|
|
132
|
+
|
|
127
133
|
/**
|
|
128
134
|
* MCP Server state update message from server -> Client
|
|
129
135
|
*/
|
|
@@ -143,7 +149,7 @@ type MCPServer = {
|
|
|
143
149
|
name: string;
|
|
144
150
|
server_url: string;
|
|
145
151
|
auth_url: string | null;
|
|
146
|
-
state:
|
|
152
|
+
state: MCPConnectionState;
|
|
147
153
|
instructions: string | null;
|
|
148
154
|
capabilities: ServerCapabilities | null;
|
|
149
155
|
};
|
|
@@ -166,8 +172,9 @@ declare class Agent<
|
|
|
166
172
|
Props extends Record<string, unknown> = Record<string, unknown>
|
|
167
173
|
> extends Server<Env, Props> {
|
|
168
174
|
private _state;
|
|
175
|
+
private _disposables;
|
|
169
176
|
private _ParentClass;
|
|
170
|
-
mcp: MCPClientManager;
|
|
177
|
+
readonly mcp: MCPClientManager;
|
|
171
178
|
/**
|
|
172
179
|
* Initial state for the Agent
|
|
173
180
|
* Override to provide default state values
|
|
@@ -344,55 +351,40 @@ declare class Agent<
|
|
|
344
351
|
/**
|
|
345
352
|
* Connect to a new MCP Server
|
|
346
353
|
*
|
|
354
|
+
* @param serverName Name of the MCP server
|
|
347
355
|
* @param url MCP Server SSE URL
|
|
348
|
-
* @param callbackHost Base host for the agent, used for the redirect URI.
|
|
356
|
+
* @param callbackHost Base host for the agent, used for the redirect URI. If not provided, will be derived from the current request.
|
|
349
357
|
* @param agentsPrefix agents routing prefix if not using `agents`
|
|
350
|
-
* @param options MCP client and transport
|
|
358
|
+
* @param options MCP client and transport options
|
|
351
359
|
* @returns authUrl
|
|
352
360
|
*/
|
|
353
361
|
addMcpServer(
|
|
354
362
|
serverName: string,
|
|
355
363
|
url: string,
|
|
356
|
-
callbackHost
|
|
364
|
+
callbackHost?: string,
|
|
357
365
|
agentsPrefix?: string,
|
|
358
366
|
options?: {
|
|
359
367
|
client?: ConstructorParameters<typeof Client>[1];
|
|
360
|
-
transport?: {
|
|
361
|
-
headers: HeadersInit;
|
|
362
|
-
};
|
|
363
|
-
}
|
|
364
|
-
): Promise<{
|
|
365
|
-
id: string;
|
|
366
|
-
authUrl: string | undefined;
|
|
367
|
-
}>;
|
|
368
|
-
_connectToMcpServerInternal(
|
|
369
|
-
_serverName: string,
|
|
370
|
-
url: string,
|
|
371
|
-
callbackUrl: string,
|
|
372
|
-
options?: {
|
|
373
|
-
client?: ConstructorParameters<typeof Client>[1];
|
|
374
|
-
/**
|
|
375
|
-
* We don't expose the normal set of transport options because:
|
|
376
|
-
* 1) we can't serialize things like the auth provider or a fetch function into the DB for reconnection purposes
|
|
377
|
-
* 2) We probably want these options to be agnostic to the transport type (SSE vs Streamable)
|
|
378
|
-
*
|
|
379
|
-
* This has the limitation that you can't override fetch, but I think headers should handle nearly all cases needed (i.e. non-standard bearer auth).
|
|
380
|
-
*/
|
|
381
368
|
transport?: {
|
|
382
369
|
headers?: HeadersInit;
|
|
370
|
+
type?: TransportType;
|
|
383
371
|
};
|
|
384
|
-
},
|
|
385
|
-
reconnect?: {
|
|
386
|
-
id: string;
|
|
387
|
-
oauthClientId?: string;
|
|
388
372
|
}
|
|
389
373
|
): Promise<{
|
|
390
374
|
id: string;
|
|
391
375
|
authUrl: string | undefined;
|
|
392
|
-
clientId: string | undefined;
|
|
393
376
|
}>;
|
|
377
|
+
private _connectToMcpServerInternal;
|
|
394
378
|
removeMcpServer(id: string): Promise<void>;
|
|
395
379
|
getMcpServers(): MCPServersState;
|
|
380
|
+
private broadcastMcpServers;
|
|
381
|
+
/**
|
|
382
|
+
* Handle OAuth callback response using MCPClientManager configuration
|
|
383
|
+
* @param result OAuth callback result
|
|
384
|
+
* @param request The original request (needed for base URL)
|
|
385
|
+
* @returns Response for the OAuth callback
|
|
386
|
+
*/
|
|
387
|
+
private handleOAuthCallbackResponse;
|
|
396
388
|
}
|
|
397
389
|
/**
|
|
398
390
|
* Namespace for creating Agent instances
|
|
@@ -552,6 +544,7 @@ export {
|
|
|
552
544
|
type Schedule,
|
|
553
545
|
type StateUpdateMessage,
|
|
554
546
|
StreamingResponse,
|
|
547
|
+
TransportType,
|
|
555
548
|
callable,
|
|
556
549
|
createAddressBasedEmailResolver,
|
|
557
550
|
createCatchAllEmailResolver,
|
package/dist/index.js
CHANGED
|
@@ -10,11 +10,12 @@ import {
|
|
|
10
10
|
routeAgentEmail,
|
|
11
11
|
routeAgentRequest,
|
|
12
12
|
unstable_callable
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-254F4GDT.js";
|
|
14
|
+
import "./chunk-3OT2NNEW.js";
|
|
15
|
+
import "./chunk-Z44WASMA.js";
|
|
16
16
|
import "./chunk-QEVM4BVL.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-BER7KXUJ.js";
|
|
18
|
+
import "./chunk-PR4QN5HX.js";
|
|
18
19
|
export {
|
|
19
20
|
Agent,
|
|
20
21
|
StreamingResponse,
|
package/dist/mcp/client.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import '@modelcontextprotocol/sdk/client/index.js';
|
|
|
3
3
|
import '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
4
4
|
import '@modelcontextprotocol/sdk/types.js';
|
|
5
5
|
import 'ai';
|
|
6
|
-
export {
|
|
6
|
+
export { e as MCPClientManager, d as MCPClientOAuthCallbackConfig, c as MCPClientOAuthResult, g as getNamespacedData } from '../client-DVoPb3-C.js';
|
|
7
|
+
import '../mcp-BH1fJeiU.js';
|
|
7
8
|
import '@modelcontextprotocol/sdk/client/sse.js';
|
|
8
9
|
import '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
9
10
|
import './do-oauth-client-provider.js';
|
package/dist/mcp/client.js
CHANGED
package/dist/mcp/index.d.ts
CHANGED
|
@@ -2,12 +2,14 @@ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
|
2
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
3
|
import { JSONRPCMessage, ElicitResult } from '@modelcontextprotocol/sdk/types.js';
|
|
4
4
|
export { ElicitRequest, ElicitRequestSchema, ElicitResult } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
-
import { Agent
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import { Agent } from '../index.js';
|
|
6
|
+
import { M as MaybePromise, B as BaseTransportType, S as ServeOptions } from '../client-DVoPb3-C.js';
|
|
7
|
+
export { d as MCPClientOAuthCallbackConfig, c as MCPClientOAuthResult, a as SSEEdgeClientTransport, b as StreamableHTTPEdgeClientTransport } from '../client-DVoPb3-C.js';
|
|
8
|
+
import { Connection, ConnectionContext } from 'partyserver';
|
|
8
9
|
import 'cloudflare:workers';
|
|
9
10
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
10
11
|
import '../observability/index.js';
|
|
12
|
+
import '../mcp-BH1fJeiU.js';
|
|
11
13
|
import '../ai-types.js';
|
|
12
14
|
import 'ai';
|
|
13
15
|
import 'zod';
|
|
@@ -18,54 +20,34 @@ import './do-oauth-client-provider.js';
|
|
|
18
20
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
19
21
|
import '@modelcontextprotocol/sdk/shared/auth.js';
|
|
20
22
|
|
|
21
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
22
|
-
type TransportType = "sse" | "streamable-http";
|
|
23
|
-
interface CORSOptions {
|
|
24
|
-
origin?: string;
|
|
25
|
-
methods?: string;
|
|
26
|
-
headers?: string;
|
|
27
|
-
maxAge?: number;
|
|
28
|
-
exposeHeaders?: string;
|
|
29
|
-
}
|
|
30
|
-
interface ServeOptions {
|
|
31
|
-
binding?: string;
|
|
32
|
-
corsOptions?: CORSOptions;
|
|
33
|
-
transport?: TransportType;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
23
|
declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Record<string, unknown> = Record<string, unknown>> extends Agent<Env, State, Props> {
|
|
37
24
|
private _transport?;
|
|
38
|
-
private _requestIdToConnectionId;
|
|
39
|
-
private _standaloneSseConnectionId?;
|
|
40
25
|
props?: Props;
|
|
41
26
|
abstract server: MaybePromise<McpServer | Server>;
|
|
42
27
|
abstract init(): Promise<void>;
|
|
43
|
-
constructor(ctx: AgentContext, env: Env);
|
|
44
28
|
setInitializeRequest(initializeRequest: JSONRPCMessage): Promise<void>;
|
|
45
29
|
getInitializeRequest(): Promise<JSONRPCMessage | undefined>;
|
|
46
30
|
/** Read the transport type for this agent.
|
|
47
31
|
* This relies on the naming scheme being `sse:${sessionId}`
|
|
48
32
|
* or `streamable-http:${sessionId}`.
|
|
49
33
|
*/
|
|
50
|
-
getTransportType():
|
|
51
|
-
/**
|
|
52
|
-
|
|
34
|
+
getTransportType(): BaseTransportType;
|
|
35
|
+
/** Read the sessionId for this agent.
|
|
36
|
+
* This relies on the naming scheme being `sse:${sessionId}`
|
|
37
|
+
* or `streamable-http:${sessionId}`.
|
|
38
|
+
*/
|
|
39
|
+
getSessionId(): string;
|
|
53
40
|
/** Get the unique WebSocket. SSE transport only. */
|
|
54
41
|
private getWebSocket;
|
|
55
|
-
/** Get the corresponding WebSocket for a responseId. Streamable HTTP only. */
|
|
56
|
-
private getWebSocketForResponseID;
|
|
57
42
|
/** Returns a new transport matching the type of the Agent. */
|
|
58
43
|
private initTransport;
|
|
59
44
|
/** Update and store the props */
|
|
60
45
|
updateProps(props?: Props): Promise<void>;
|
|
46
|
+
reinitializeServer(): Promise<void>;
|
|
61
47
|
/** Sets up the MCP transport and server every time the Agent is started.*/
|
|
62
48
|
onStart(props?: Props): Promise<void>;
|
|
63
49
|
/** Validates new WebSocket connections. */
|
|
64
|
-
onConnect(conn: Connection,
|
|
65
|
-
/** Handles MCP Messages for Streamable HTTP. */
|
|
66
|
-
onMessage(connection: Connection, event: WSMessage): Promise<void>;
|
|
67
|
-
/** Remove clients from our cache when they disconnect */
|
|
68
|
-
onClose(conn: Connection, _code: number, _reason: string, _wasClean: boolean): Promise<void>;
|
|
50
|
+
onConnect(conn: Connection, { request: req }: ConnectionContext): Promise<void>;
|
|
69
51
|
/** Handles MCP Messages for the legacy SSE transport. */
|
|
70
52
|
onSSEMcpMessage(_sessionId: string, messageBody: unknown): Promise<Error | null>;
|
|
71
53
|
/** Elicit user input with a message and schema */
|