agents 0.0.0-b63b4a6 → 0.0.0-b6af48a
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 +130 -7
- package/dist/_esm-LV5FJ3HK.js +3922 -0
- package/dist/_esm-LV5FJ3HK.js.map +1 -0
- package/dist/ai-chat-agent.d.ts +11 -8
- package/dist/ai-chat-agent.js +485 -66
- 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 +66 -70
- package/dist/ai-react.js +246 -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-DBXG3DYU.js → chunk-2Y6KNRNP.js} +188 -115
- package/dist/chunk-2Y6KNRNP.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-PVQZBKN7.js → chunk-C2OEBJZ2.js} +14 -7
- package/dist/chunk-C2OEBJZ2.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-KUH345EY.js → chunk-QEVM4BVL.js} +5 -5
- package/dist/chunk-QEVM4BVL.js.map +1 -0
- package/dist/chunk-QUOGV3WN.js +949 -0
- package/dist/chunk-QUOGV3WN.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/client-C8tswVoM.d.ts +5248 -0
- package/dist/client.js +3 -1
- package/dist/codemode/ai.d.ts +25 -0
- package/dist/codemode/ai.js +5200 -0
- package/dist/codemode/ai.js.map +1 -0
- package/dist/index.d.ts +548 -32
- package/dist/index.js +8 -4
- package/dist/mcp/client.d.ts +10 -1057
- package/dist/mcp/client.js +2 -1
- package/dist/mcp/do-oauth-client-provider.d.ts +1 -0
- package/dist/mcp/do-oauth-client-provider.js +2 -1
- package/dist/mcp/index.d.ts +53 -96
- package/dist/mcp/index.js +925 -718
- 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 +34 -14
- package/dist/observability/index.js +6 -4
- package/dist/react.d.ts +13 -7
- package/dist/react.js +107 -7
- package/dist/react.js.map +1 -1
- package/dist/schedule.d.ts +79 -5
- 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 +38 -10
- package/src/index.ts +272 -136
- package/dist/chunk-DBXG3DYU.js.map +0 -1
- package/dist/chunk-KUH345EY.js.map +0 -1
- package/dist/chunk-PVQZBKN7.js.map +0 -1
- package/dist/chunk-UYXBO2TX.js +0 -566
- package/dist/chunk-UYXBO2TX.js.map +0 -1
- package/dist/index-CLW1aEBr.d.ts +0 -615
package/dist/mcp/client.js
CHANGED
|
@@ -15,6 +15,7 @@ declare class DurableObjectOAuthClientProvider implements AgentsOAuthProvider {
|
|
|
15
15
|
private _clientId_;
|
|
16
16
|
constructor(storage: DurableObjectStorage, clientName: string, baseRedirectUrl: string);
|
|
17
17
|
get clientMetadata(): OAuthClientMetadata;
|
|
18
|
+
get clientUri(): string;
|
|
18
19
|
get redirectUrl(): string;
|
|
19
20
|
get clientId(): string;
|
|
20
21
|
set clientId(clientId_: string);
|
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,122 +1,79 @@
|
|
|
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 { ElicitResult } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import { JSONRPCMessage, ElicitResult } from '@modelcontextprotocol/sdk/types.js';
|
|
6
4
|
export { ElicitRequest, ElicitRequestSchema, ElicitResult } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import '
|
|
5
|
+
import { Agent } from '../index.js';
|
|
6
|
+
import { M as MaybePromise, B as BaseTransportType, S as ServeOptions } from '../client-C8tswVoM.js';
|
|
7
|
+
export { d as MCPClientOAuthCallbackConfig, c as MCPClientOAuthResult, a as SSEEdgeClientTransport, b as StreamableHTTPEdgeClientTransport } from '../client-C8tswVoM.js';
|
|
8
|
+
import { Connection, ConnectionContext } from 'partyserver';
|
|
9
|
+
import 'cloudflare:workers';
|
|
11
10
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
12
|
-
import '
|
|
11
|
+
import '../observability/index.js';
|
|
12
|
+
import '../mcp-BH1fJeiU.js';
|
|
13
|
+
import '../ai-types.js';
|
|
13
14
|
import 'ai';
|
|
15
|
+
import 'zod';
|
|
16
|
+
import '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
17
|
+
import '@modelcontextprotocol/sdk/client/sse.js';
|
|
18
|
+
import '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
14
19
|
import './do-oauth-client-provider.js';
|
|
15
20
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
16
21
|
import '@modelcontextprotocol/sdk/shared/auth.js';
|
|
17
22
|
|
|
18
|
-
declare class
|
|
19
|
-
private authProvider;
|
|
20
|
-
/**
|
|
21
|
-
* Creates a new EdgeSSEClientTransport, which overrides fetch to be compatible with the CF workers environment
|
|
22
|
-
*/
|
|
23
|
-
constructor(url: URL, options: SSEClientTransportOptions);
|
|
24
|
-
authHeaders(): Promise<{
|
|
25
|
-
Authorization: string;
|
|
26
|
-
} | undefined>;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
declare class StreamableHTTPEdgeClientTransport extends StreamableHTTPClientTransport {
|
|
30
|
-
private authProvider;
|
|
31
|
-
/**
|
|
32
|
-
* Creates a new StreamableHTTPEdgeClientTransport, which overrides fetch to be compatible with the CF workers environment
|
|
33
|
-
*/
|
|
34
|
-
constructor(url: URL, options: StreamableHTTPClientTransportOptions);
|
|
35
|
-
authHeaders(): Promise<{
|
|
36
|
-
Authorization: string;
|
|
37
|
-
} | undefined>;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
interface CORSOptions {
|
|
41
|
-
origin?: string;
|
|
42
|
-
methods?: string;
|
|
43
|
-
headers?: string;
|
|
44
|
-
maxAge?: number;
|
|
45
|
-
exposeHeaders?: string;
|
|
46
|
-
}
|
|
47
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
48
|
-
declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Record<string, unknown> = Record<string, unknown>> extends DurableObject<Env> {
|
|
49
|
-
private _status;
|
|
23
|
+
declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Record<string, unknown> = Record<string, unknown>> extends Agent<Env, State, Props> {
|
|
50
24
|
private _transport?;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
25
|
+
props?: Props;
|
|
26
|
+
abstract server: MaybePromise<McpServer | Server>;
|
|
27
|
+
abstract init(): Promise<void>;
|
|
28
|
+
setInitializeRequest(initializeRequest: JSONRPCMessage): Promise<void>;
|
|
29
|
+
getInitializeRequest(): Promise<JSONRPCMessage | undefined>;
|
|
30
|
+
/** Read the transport type for this agent.
|
|
31
|
+
* This relies on the naming scheme being `sse:${sessionId}`
|
|
32
|
+
* or `streamable-http:${sessionId}`.
|
|
56
33
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
* Agents API allowlist
|
|
62
|
-
*/
|
|
63
|
-
initialState: State;
|
|
64
|
-
get state(): State;
|
|
65
|
-
sql<T = Record<string, string | number | boolean | null>>(strings: TemplateStringsArray, ...values: (string | number | boolean | null)[]): T[];
|
|
66
|
-
setState(state: State): void;
|
|
67
|
-
/**
|
|
68
|
-
* Elicit user input with a message and schema
|
|
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}`.
|
|
69
38
|
*/
|
|
39
|
+
getSessionId(): string;
|
|
40
|
+
/** Get the unique WebSocket. SSE transport only. */
|
|
41
|
+
private getWebSocket;
|
|
42
|
+
/** Returns a new transport matching the type of the Agent. */
|
|
43
|
+
private initTransport;
|
|
44
|
+
/** Update and store the props */
|
|
45
|
+
updateProps(props?: Props): Promise<void>;
|
|
46
|
+
reinitializeServer(): Promise<void>;
|
|
47
|
+
/** Sets up the MCP transport and server every time the Agent is started.*/
|
|
48
|
+
onStart(props?: Props): Promise<void>;
|
|
49
|
+
/** Validates new WebSocket connections. */
|
|
50
|
+
onConnect(conn: Connection, { request: req }: ConnectionContext): Promise<void>;
|
|
51
|
+
/** Handles MCP Messages for the legacy SSE transport. */
|
|
52
|
+
onSSEMcpMessage(_sessionId: string, messageBody: unknown): Promise<Error | null>;
|
|
53
|
+
/** Elicit user input with a message and schema */
|
|
70
54
|
elicitInput(params: {
|
|
71
55
|
message: string;
|
|
72
56
|
requestedSchema: unknown;
|
|
73
57
|
}): Promise<ElicitResult>;
|
|
74
|
-
|
|
75
|
-
onStart(): Promise<void>;
|
|
76
|
-
/**
|
|
77
|
-
* McpAgent API
|
|
78
|
-
*/
|
|
79
|
-
abstract server: MaybePromise<McpServer | Server>;
|
|
80
|
-
props: Props;
|
|
81
|
-
initRun: boolean;
|
|
82
|
-
abstract init(): Promise<void>;
|
|
83
|
-
_init(props: Props): Promise<void>;
|
|
84
|
-
setInitialized(): Promise<void>;
|
|
85
|
-
isInitialized(): Promise<boolean>;
|
|
86
|
-
private _initialize;
|
|
87
|
-
fetch(request: Request): Promise<Response>;
|
|
88
|
-
getWebSocket(): WebSocket | null;
|
|
89
|
-
getWebSocketForResponseID(id: string): WebSocket | null;
|
|
90
|
-
onMessage(connection: Connection, event: WSMessage): Promise<void>;
|
|
91
|
-
/**
|
|
92
|
-
* Wait for elicitation response through storage polling
|
|
93
|
-
*/
|
|
58
|
+
/** Wait for elicitation response through storage polling */
|
|
94
59
|
private _waitForElicitationResponse;
|
|
95
|
-
/**
|
|
96
|
-
* Handle elicitation responses */
|
|
60
|
+
/** Handle elicitation responses */
|
|
97
61
|
private _handleElicitationResponse;
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
static mount(path: string, { binding, corsOptions }?: {
|
|
103
|
-
binding?: string;
|
|
104
|
-
corsOptions?: CORSOptions;
|
|
105
|
-
}): {
|
|
62
|
+
/** Return a handler for the given path for this MCP.
|
|
63
|
+
* Defaults to Streamable HTTP transport.
|
|
64
|
+
*/
|
|
65
|
+
static serve(path: string, { binding, corsOptions, transport }?: ServeOptions): {
|
|
106
66
|
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
107
67
|
};
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Legacy api
|
|
70
|
+
**/
|
|
71
|
+
static mount(path: string, opts?: Omit<ServeOptions, "transport">): {
|
|
112
72
|
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
113
73
|
};
|
|
114
|
-
static
|
|
115
|
-
binding?: string;
|
|
116
|
-
corsOptions?: CORSOptions;
|
|
117
|
-
}): {
|
|
74
|
+
static serveSSE(path: string, opts?: Omit<ServeOptions, "transport">): {
|
|
118
75
|
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
119
76
|
};
|
|
120
77
|
}
|
|
121
78
|
|
|
122
|
-
export { McpAgent
|
|
79
|
+
export { McpAgent };
|