agents 0.0.0-fb969ad → 0.0.0-fbf5181
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 +5 -1
- package/dist/ai-chat-agent.js +20 -19
- package/dist/ai-chat-agent.js.map +1 -1
- package/dist/ai-react.js +17 -14
- package/dist/ai-react.js.map +1 -1
- package/dist/{chunk-X6BBKLSC.js → chunk-XG52S6YY.js} +95 -72
- package/dist/chunk-XG52S6YY.js.map +1 -0
- package/dist/client.js +16 -23
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +8 -8
- package/dist/index.js +5 -5
- package/dist/mcp/client.d.ts +763 -0
- package/dist/mcp/client.js +408 -0
- package/dist/mcp/client.js.map +1 -0
- package/dist/mcp/do-oauth-client-provider.d.ts +41 -0
- package/dist/mcp/do-oauth-client-provider.js +107 -0
- package/dist/mcp/do-oauth-client-provider.js.map +1 -0
- package/dist/mcp/index.d.ts +61 -0
- package/dist/mcp/index.js +778 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/react.js +34 -27
- package/dist/react.js.map +1 -1
- package/package.json +30 -8
- package/src/index.ts +116 -92
- package/dist/chunk-X6BBKLSC.js.map +0 -1
- package/dist/mcp.d.ts +0 -58
- package/dist/mcp.js +0 -945
- package/dist/mcp.js.map +0 -1
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { DurableObject } from 'cloudflare:workers';
|
|
2
|
+
import { Connection, WSMessage } from 'partyserver';
|
|
3
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
+
|
|
5
|
+
interface CORSOptions {
|
|
6
|
+
origin?: string;
|
|
7
|
+
methods?: string;
|
|
8
|
+
headers?: string;
|
|
9
|
+
maxAge?: number;
|
|
10
|
+
}
|
|
11
|
+
declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Record<string, unknown> = Record<string, unknown>> extends DurableObject<Env> {
|
|
12
|
+
#private;
|
|
13
|
+
protected constructor(ctx: DurableObjectState, env: Env);
|
|
14
|
+
/**
|
|
15
|
+
* Agents API allowlist
|
|
16
|
+
*/
|
|
17
|
+
initialState: State;
|
|
18
|
+
get state(): State;
|
|
19
|
+
sql<T = Record<string, string | number | boolean | null>>(strings: TemplateStringsArray, ...values: (string | number | boolean | null)[]): T[];
|
|
20
|
+
setState(state: State): void;
|
|
21
|
+
onStateUpdate(state: State | undefined, source: Connection | "server"): void;
|
|
22
|
+
onStart(): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* McpAgent API
|
|
25
|
+
*/
|
|
26
|
+
abstract server: McpServer;
|
|
27
|
+
props: Props;
|
|
28
|
+
initRun: boolean;
|
|
29
|
+
abstract init(): Promise<void>;
|
|
30
|
+
_init(props: Props): Promise<void>;
|
|
31
|
+
setInitialized(): Promise<void>;
|
|
32
|
+
isInitialized(): Promise<boolean>;
|
|
33
|
+
fetch(request: Request): Promise<Response>;
|
|
34
|
+
getWebSocket(): WebSocket | null;
|
|
35
|
+
getWebSocketForResponseID(id: string): WebSocket | null;
|
|
36
|
+
onMessage(connection: Connection, event: WSMessage): Promise<void>;
|
|
37
|
+
onSSEMcpMessage(sessionId: string, request: Request): Promise<Error | null>;
|
|
38
|
+
webSocketMessage(ws: WebSocket, event: ArrayBuffer | string): Promise<void>;
|
|
39
|
+
webSocketError(ws: WebSocket, error: unknown): Promise<void>;
|
|
40
|
+
webSocketClose(ws: WebSocket, code: number, reason: string, wasClean: boolean): Promise<void>;
|
|
41
|
+
static mount(path: string, { binding, corsOptions, }?: {
|
|
42
|
+
binding?: string;
|
|
43
|
+
corsOptions?: CORSOptions;
|
|
44
|
+
}): {
|
|
45
|
+
fetch: (request: Request, env: Record<string, DurableObjectNamespace<McpAgent>>, ctx: ExecutionContext) => Promise<Response>;
|
|
46
|
+
};
|
|
47
|
+
static serveSSE(path: string, { binding, corsOptions, }?: {
|
|
48
|
+
binding?: string;
|
|
49
|
+
corsOptions?: CORSOptions;
|
|
50
|
+
}): {
|
|
51
|
+
fetch: (request: Request, env: Record<string, DurableObjectNamespace<McpAgent>>, ctx: ExecutionContext) => Promise<Response>;
|
|
52
|
+
};
|
|
53
|
+
static serve(path: string, { binding, corsOptions, }?: {
|
|
54
|
+
binding?: string;
|
|
55
|
+
corsOptions?: CORSOptions;
|
|
56
|
+
}): {
|
|
57
|
+
fetch: (request: Request, env: Record<string, DurableObjectNamespace<McpAgent>>, ctx: ExecutionContext) => Promise<Response>;
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export { McpAgent };
|