agents 0.0.0-e48e5f9 → 0.0.0-e777fdd
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 +234 -6
- package/dist/_esm-LV5FJ3HK.js +3922 -0
- package/dist/_esm-LV5FJ3HK.js.map +1 -0
- package/dist/ai-chat-agent.d.ts +12 -9
- package/dist/ai-chat-agent.js +151 -59
- package/dist/ai-chat-agent.js.map +1 -1
- package/dist/ai-chat-v5-migration.d.ts +152 -0
- package/dist/ai-chat-v5-migration.js +20 -0
- package/dist/ai-chat-v5-migration.js.map +1 -0
- package/dist/ai-react.d.ts +68 -71
- package/dist/ai-react.js +252 -99
- package/dist/ai-react.js.map +1 -1
- package/dist/ai-types.d.ts +37 -19
- package/dist/ai-types.js +7 -0
- package/dist/ccip-CMBYN64O.js +15 -0
- package/dist/ccip-CMBYN64O.js.map +1 -0
- package/dist/chunk-5Y6BEZDY.js +276 -0
- package/dist/chunk-5Y6BEZDY.js.map +1 -0
- package/dist/chunk-BER7KXUJ.js +18 -0
- 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-MW5BQ2FW.js → chunk-QEPGNUG6.js} +213 -32
- package/dist/chunk-QEPGNUG6.js.map +1 -0
- package/dist/{chunk-KUH345EY.js → chunk-QEVM4BVL.js} +5 -5
- package/dist/chunk-QEVM4BVL.js.map +1 -0
- package/dist/{chunk-5YIRLLUX.js → chunk-RS5OCNEQ.js} +169 -110
- package/dist/chunk-RS5OCNEQ.js.map +1 -0
- package/dist/chunk-TYAY6AU6.js +159 -0
- package/dist/chunk-TYAY6AU6.js.map +1 -0
- package/dist/chunk-UJVEAURM.js +150 -0
- package/dist/chunk-UJVEAURM.js.map +1 -0
- package/dist/{chunk-PVQZBKN7.js → chunk-XFS5ERG3.js} +24 -3
- package/dist/chunk-XFS5ERG3.js.map +1 -0
- package/dist/client-BohGLma8.d.ts +5041 -0
- package/dist/client.js +3 -1
- package/dist/index.d.ts +564 -32
- package/dist/index.js +8 -4
- package/dist/mcp/client.d.ts +9 -1053
- package/dist/mcp/client.js +2 -1
- package/dist/mcp/do-oauth-client-provider.d.ts +9 -0
- package/dist/mcp/do-oauth-client-provider.js +2 -1
- package/dist/mcp/index.d.ts +57 -63
- package/dist/mcp/index.js +954 -638
- 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/observability/index.d.ts +46 -12
- package/dist/observability/index.js +6 -4
- package/dist/react.d.ts +7 -3
- package/dist/react.js +8 -5
- package/dist/react.js.map +1 -1
- package/dist/schedule.d.ts +83 -9
- package/dist/schedule.js +17 -2
- 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 +25 -9
- package/src/index.ts +240 -131
- package/dist/chunk-5YIRLLUX.js.map +0 -1
- package/dist/chunk-KUH345EY.js.map +0 -1
- package/dist/chunk-MW5BQ2FW.js.map +0 -1
- package/dist/chunk-PVQZBKN7.js.map +0 -1
- package/dist/index-BIJvkfYt.d.ts +0 -614
package/dist/mcp/client.js
CHANGED
|
@@ -5,6 +5,9 @@ interface AgentsOAuthProvider extends OAuthClientProvider {
|
|
|
5
5
|
authUrl: string | undefined;
|
|
6
6
|
clientId: string | undefined;
|
|
7
7
|
serverId: string | undefined;
|
|
8
|
+
saveOAuthTransport(transportType: string): Promise<void>;
|
|
9
|
+
getOAuthTransport(): Promise<string | undefined>;
|
|
10
|
+
clearOAuthTransport(): Promise<void>;
|
|
8
11
|
}
|
|
9
12
|
declare class DurableObjectOAuthClientProvider implements AgentsOAuthProvider {
|
|
10
13
|
storage: DurableObjectStorage;
|
|
@@ -15,6 +18,7 @@ declare class DurableObjectOAuthClientProvider implements AgentsOAuthProvider {
|
|
|
15
18
|
private _clientId_;
|
|
16
19
|
constructor(storage: DurableObjectStorage, clientName: string, baseRedirectUrl: string);
|
|
17
20
|
get clientMetadata(): OAuthClientMetadata;
|
|
21
|
+
get clientUri(): string;
|
|
18
22
|
get redirectUrl(): string;
|
|
19
23
|
get clientId(): string;
|
|
20
24
|
set clientId(clientId_: string);
|
|
@@ -36,6 +40,11 @@ declare class DurableObjectOAuthClientProvider implements AgentsOAuthProvider {
|
|
|
36
40
|
codeVerifierKey(clientId: string): string;
|
|
37
41
|
saveCodeVerifier(verifier: string): Promise<void>;
|
|
38
42
|
codeVerifier(): Promise<string>;
|
|
43
|
+
/** Transport tracking for OAuth flow */
|
|
44
|
+
oauthTransportKey(): string;
|
|
45
|
+
saveOAuthTransport(transportType: string): Promise<void>;
|
|
46
|
+
getOAuthTransport(): Promise<string | undefined>;
|
|
47
|
+
clearOAuthTransport(): Promise<void>;
|
|
39
48
|
}
|
|
40
49
|
|
|
41
50
|
export { type AgentsOAuthProvider, DurableObjectOAuthClientProvider };
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,82 +1,76 @@
|
|
|
1
|
-
import { MCPClientManager } from './client.js';
|
|
2
|
-
import { DurableObject } from 'cloudflare:workers';
|
|
3
1
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
4
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
|
-
import {
|
|
6
|
-
|
|
3
|
+
import { JSONRPCMessage, ElicitResult } from '@modelcontextprotocol/sdk/types.js';
|
|
4
|
+
export { ElicitRequest, ElicitRequestSchema, ElicitResult } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
import { Agent } from '../index.js';
|
|
6
|
+
import { M as MaybePromise, B as BaseTransportType, S as ServeOptions } from '../client-BohGLma8.js';
|
|
7
|
+
export { a as SSEEdgeClientTransport, b as StreamableHTTPEdgeClientTransport } from '../client-BohGLma8.js';
|
|
8
|
+
import { Connection, ConnectionContext } from 'partyserver';
|
|
9
|
+
import 'cloudflare:workers';
|
|
7
10
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
8
|
-
import '
|
|
9
|
-
import '
|
|
10
|
-
import '@modelcontextprotocol/sdk/types.js';
|
|
11
|
+
import '../observability/index.js';
|
|
12
|
+
import '../ai-types.js';
|
|
11
13
|
import 'ai';
|
|
14
|
+
import 'zod';
|
|
15
|
+
import '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
16
|
+
import '@modelcontextprotocol/sdk/client/sse.js';
|
|
17
|
+
import '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
12
18
|
import './do-oauth-client-provider.js';
|
|
13
19
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
14
20
|
import '@modelcontextprotocol/sdk/shared/auth.js';
|
|
15
21
|
|
|
16
|
-
|
|
17
|
-
origin?: string;
|
|
18
|
-
methods?: string;
|
|
19
|
-
headers?: string;
|
|
20
|
-
maxAge?: number;
|
|
21
|
-
exposeHeaders?: string;
|
|
22
|
-
}
|
|
23
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
24
|
-
declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Record<string, unknown> = Record<string, unknown>> extends DurableObject<Env> {
|
|
25
|
-
private _status;
|
|
22
|
+
declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Record<string, unknown> = Record<string, unknown>> extends Agent<Env, State, Props> {
|
|
26
23
|
private _transport?;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
24
|
+
props?: Props;
|
|
25
|
+
abstract server: MaybePromise<McpServer | Server>;
|
|
26
|
+
abstract init(): Promise<void>;
|
|
27
|
+
setInitializeRequest(initializeRequest: JSONRPCMessage): Promise<void>;
|
|
28
|
+
getInitializeRequest(): Promise<JSONRPCMessage | undefined>;
|
|
29
|
+
/** Read the transport type for this agent.
|
|
30
|
+
* This relies on the naming scheme being `sse:${sessionId}`
|
|
31
|
+
* or `streamable-http:${sessionId}`.
|
|
32
32
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
* Agents API allowlist
|
|
33
|
+
getTransportType(): BaseTransportType;
|
|
34
|
+
/** Read the sessionId for this agent.
|
|
35
|
+
* This relies on the naming scheme being `sse:${sessionId}`
|
|
36
|
+
* or `streamable-http:${sessionId}`.
|
|
38
37
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
getSessionId(): string;
|
|
39
|
+
/** Get the unique WebSocket. SSE transport only. */
|
|
40
|
+
private getWebSocket;
|
|
41
|
+
/** Returns a new transport matching the type of the Agent. */
|
|
42
|
+
private initTransport;
|
|
43
|
+
/** Update and store the props */
|
|
44
|
+
updateProps(props?: Props): Promise<void>;
|
|
45
|
+
reinitializeServer(): Promise<void>;
|
|
46
|
+
/** Sets up the MCP transport and server every time the Agent is started.*/
|
|
47
|
+
onStart(props?: Props): Promise<void>;
|
|
48
|
+
/** Validates new WebSocket connections. */
|
|
49
|
+
onConnect(conn: Connection, { request: req }: ConnectionContext): Promise<void>;
|
|
50
|
+
/** Handles MCP Messages for the legacy SSE transport. */
|
|
51
|
+
onSSEMcpMessage(_sessionId: string, messageBody: unknown): Promise<Error | null>;
|
|
52
|
+
/** Elicit user input with a message and schema */
|
|
53
|
+
elicitInput(params: {
|
|
54
|
+
message: string;
|
|
55
|
+
requestedSchema: unknown;
|
|
56
|
+
}): Promise<ElicitResult>;
|
|
57
|
+
/** Wait for elicitation response through storage polling */
|
|
58
|
+
private _waitForElicitationResponse;
|
|
59
|
+
/** Handle elicitation responses */
|
|
60
|
+
private _handleElicitationResponse;
|
|
61
|
+
/** Return a handler for the given path for this MCP.
|
|
62
|
+
* Defaults to Streamable HTTP transport.
|
|
47
63
|
*/
|
|
48
|
-
|
|
49
|
-
props: Props;
|
|
50
|
-
initRun: boolean;
|
|
51
|
-
abstract init(): Promise<void>;
|
|
52
|
-
_init(props: Props): Promise<void>;
|
|
53
|
-
setInitialized(): Promise<void>;
|
|
54
|
-
isInitialized(): Promise<boolean>;
|
|
55
|
-
private _initialize;
|
|
56
|
-
fetch(request: Request): Promise<Response>;
|
|
57
|
-
getWebSocket(): WebSocket | null;
|
|
58
|
-
getWebSocketForResponseID(id: string): WebSocket | null;
|
|
59
|
-
onMessage(connection: Connection, event: WSMessage): Promise<void>;
|
|
60
|
-
onSSEMcpMessage(_sessionId: string, request: Request): Promise<Error | null>;
|
|
61
|
-
webSocketMessage(ws: WebSocket, event: ArrayBuffer | string): Promise<void>;
|
|
62
|
-
webSocketError(ws: WebSocket, error: unknown): Promise<void>;
|
|
63
|
-
webSocketClose(ws: WebSocket, code: number, reason: string, wasClean: boolean): Promise<void>;
|
|
64
|
-
static mount(path: string, { binding, corsOptions }?: {
|
|
65
|
-
binding?: string;
|
|
66
|
-
corsOptions?: CORSOptions;
|
|
67
|
-
}): {
|
|
64
|
+
static serve(path: string, { binding, corsOptions, transport }?: ServeOptions): {
|
|
68
65
|
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
69
66
|
};
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
/**
|
|
68
|
+
* Legacy api
|
|
69
|
+
**/
|
|
70
|
+
static mount(path: string, opts?: Omit<ServeOptions, "transport">): {
|
|
74
71
|
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
75
72
|
};
|
|
76
|
-
static
|
|
77
|
-
binding?: string;
|
|
78
|
-
corsOptions?: CORSOptions;
|
|
79
|
-
}): {
|
|
73
|
+
static serveSSE(path: string, opts?: Omit<ServeOptions, "transport">): {
|
|
80
74
|
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
81
75
|
};
|
|
82
76
|
}
|