agents 0.0.0-b8377c1 → 0.0.0-b916d85
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 +127 -22
- package/dist/ai-chat-agent.d.ts +52 -4
- package/dist/ai-chat-agent.js +177 -77
- package/dist/ai-chat-agent.js.map +1 -1
- package/dist/ai-react.d.ts +20 -5
- package/dist/ai-react.js +49 -42
- package/dist/ai-react.js.map +1 -1
- package/dist/ai-types.d.ts +5 -0
- package/dist/chunk-3IQQY2UH.js +1270 -0
- package/dist/chunk-3IQQY2UH.js.map +1 -0
- package/dist/chunk-KUH345EY.js +116 -0
- package/dist/chunk-KUH345EY.js.map +1 -0
- package/dist/chunk-PVQZBKN7.js +106 -0
- package/dist/chunk-PVQZBKN7.js.map +1 -0
- package/dist/chunk-UNG3FXYX.js +525 -0
- package/dist/chunk-UNG3FXYX.js.map +1 -0
- package/dist/client.d.ts +16 -2
- package/dist/client.js +6 -126
- package/dist/client.js.map +1 -1
- package/dist/index-CLW1aEBr.d.ts +615 -0
- package/dist/index.d.ts +39 -306
- package/dist/index.js +14 -8
- package/dist/mcp/client.d.ts +382 -42
- package/dist/mcp/client.js +3 -465
- package/dist/mcp/client.js.map +1 -1
- package/dist/mcp/do-oauth-client-provider.d.ts +41 -0
- package/dist/mcp/do-oauth-client-provider.js +7 -0
- package/dist/mcp/index.d.ts +69 -7
- package/dist/mcp/index.js +608 -159
- package/dist/mcp/index.js.map +1 -1
- package/dist/observability/index.d.ts +14 -0
- package/dist/observability/index.js +10 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/react.d.ts +87 -5
- package/dist/react.js +37 -25
- package/dist/react.js.map +1 -1
- package/dist/schedule.d.ts +6 -6
- package/dist/schedule.js +4 -6
- package/dist/schedule.js.map +1 -1
- package/dist/serializable.d.ts +32 -0
- package/dist/serializable.js +1 -0
- package/dist/serializable.js.map +1 -0
- package/package.json +78 -53
- package/src/index.ts +1121 -145
- package/dist/chunk-HMLY7DHA.js +0 -16
- package/dist/chunk-YMUU7QHV.js +0 -595
- package/dist/chunk-YMUU7QHV.js.map +0 -1
- /package/dist/{chunk-HMLY7DHA.js.map → mcp/do-oauth-client-provider.js.map} +0 -0
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,15 +1,60 @@
|
|
|
1
|
+
import { MCPClientManager } from './client.js';
|
|
1
2
|
import { DurableObject } from 'cloudflare:workers';
|
|
3
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
4
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
-
import { Connection } from 'partyserver';
|
|
5
|
+
import { Connection, WSMessage } from 'partyserver';
|
|
6
|
+
import { SSEClientTransport, SSEClientTransportOptions } from '@modelcontextprotocol/sdk/client/sse.js';
|
|
7
|
+
import { StreamableHTTPClientTransport, StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
8
|
+
import 'zod';
|
|
9
|
+
import '@modelcontextprotocol/sdk/client/index.js';
|
|
10
|
+
import '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
11
|
+
import '@modelcontextprotocol/sdk/types.js';
|
|
12
|
+
import 'ai';
|
|
13
|
+
import './do-oauth-client-provider.js';
|
|
14
|
+
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
15
|
+
import '@modelcontextprotocol/sdk/shared/auth.js';
|
|
16
|
+
|
|
17
|
+
declare class SSEEdgeClientTransport extends SSEClientTransport {
|
|
18
|
+
private authProvider;
|
|
19
|
+
/**
|
|
20
|
+
* Creates a new EdgeSSEClientTransport, which overrides fetch to be compatible with the CF workers environment
|
|
21
|
+
*/
|
|
22
|
+
constructor(url: URL, options: SSEClientTransportOptions);
|
|
23
|
+
authHeaders(): Promise<{
|
|
24
|
+
Authorization: string;
|
|
25
|
+
} | undefined>;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
declare class StreamableHTTPEdgeClientTransport extends StreamableHTTPClientTransport {
|
|
29
|
+
private authProvider;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a new StreamableHTTPEdgeClientTransport, which overrides fetch to be compatible with the CF workers environment
|
|
32
|
+
*/
|
|
33
|
+
constructor(url: URL, options: StreamableHTTPClientTransportOptions);
|
|
34
|
+
authHeaders(): Promise<{
|
|
35
|
+
Authorization: string;
|
|
36
|
+
} | undefined>;
|
|
37
|
+
}
|
|
4
38
|
|
|
5
39
|
interface CORSOptions {
|
|
6
40
|
origin?: string;
|
|
7
41
|
methods?: string;
|
|
8
42
|
headers?: string;
|
|
9
43
|
maxAge?: number;
|
|
44
|
+
exposeHeaders?: string;
|
|
10
45
|
}
|
|
46
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
11
47
|
declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Record<string, unknown> = Record<string, unknown>> extends DurableObject<Env> {
|
|
12
|
-
|
|
48
|
+
private _status;
|
|
49
|
+
private _transport?;
|
|
50
|
+
private _transportType;
|
|
51
|
+
private _requestIdToConnectionId;
|
|
52
|
+
/**
|
|
53
|
+
* Since McpAgent's _aren't_ yet real "Agents", let's only expose a couple of the methods
|
|
54
|
+
* to the outer class: initialState/state/setState/onStateUpdate/sql
|
|
55
|
+
*/
|
|
56
|
+
private _agent;
|
|
57
|
+
get mcp(): MCPClientManager;
|
|
13
58
|
protected constructor(ctx: DurableObjectState, env: Env);
|
|
14
59
|
/**
|
|
15
60
|
* Agents API allowlist
|
|
@@ -23,23 +68,40 @@ declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Re
|
|
|
23
68
|
/**
|
|
24
69
|
* McpAgent API
|
|
25
70
|
*/
|
|
26
|
-
abstract server: McpServer
|
|
71
|
+
abstract server: MaybePromise<McpServer | Server>;
|
|
27
72
|
props: Props;
|
|
28
73
|
initRun: boolean;
|
|
29
74
|
abstract init(): Promise<void>;
|
|
30
75
|
_init(props: Props): Promise<void>;
|
|
76
|
+
setInitialized(): Promise<void>;
|
|
77
|
+
isInitialized(): Promise<boolean>;
|
|
78
|
+
private _initialize;
|
|
31
79
|
fetch(request: Request): Promise<Response>;
|
|
32
80
|
getWebSocket(): WebSocket | null;
|
|
33
|
-
|
|
81
|
+
getWebSocketForResponseID(id: string): WebSocket | null;
|
|
82
|
+
onMessage(connection: Connection, event: WSMessage): Promise<void>;
|
|
83
|
+
onSSEMcpMessage(_sessionId: string, request: Request): Promise<Error | null>;
|
|
34
84
|
webSocketMessage(ws: WebSocket, event: ArrayBuffer | string): Promise<void>;
|
|
35
85
|
webSocketError(ws: WebSocket, error: unknown): Promise<void>;
|
|
36
86
|
webSocketClose(ws: WebSocket, code: number, reason: string, wasClean: boolean): Promise<void>;
|
|
37
|
-
static mount(path: string, { binding, corsOptions
|
|
87
|
+
static mount(path: string, { binding, corsOptions }?: {
|
|
88
|
+
binding?: string;
|
|
89
|
+
corsOptions?: CORSOptions;
|
|
90
|
+
}): {
|
|
91
|
+
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
92
|
+
};
|
|
93
|
+
static serveSSE(path: string, { binding, corsOptions }?: {
|
|
94
|
+
binding?: string;
|
|
95
|
+
corsOptions?: CORSOptions;
|
|
96
|
+
}): {
|
|
97
|
+
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
98
|
+
};
|
|
99
|
+
static serve(path: string, { binding, corsOptions }?: {
|
|
38
100
|
binding?: string;
|
|
39
101
|
corsOptions?: CORSOptions;
|
|
40
102
|
}): {
|
|
41
|
-
fetch:
|
|
103
|
+
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
42
104
|
};
|
|
43
105
|
}
|
|
44
106
|
|
|
45
|
-
export { McpAgent };
|
|
107
|
+
export { McpAgent, SSEEdgeClientTransport, StreamableHTTPEdgeClientTransport };
|