agents 0.0.0-f5b5854 → 0.0.0-f6c26e4
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 +22 -22
- package/dist/ai-chat-agent.d.ts +47 -4
- package/dist/ai-chat-agent.js +167 -67
- package/dist/ai-chat-agent.js.map +1 -1
- package/dist/ai-react.d.ts +18 -5
- package/dist/ai-react.js +48 -37
- package/dist/ai-react.js.map +1 -1
- package/dist/ai-types.d.ts +5 -0
- package/dist/chunk-5YIRLLUX.js +1264 -0
- package/dist/chunk-5YIRLLUX.js.map +1 -0
- package/dist/chunk-KUH345EY.js +116 -0
- package/dist/chunk-KUH345EY.js.map +1 -0
- package/dist/chunk-MW5BQ2FW.js +469 -0
- package/dist/chunk-MW5BQ2FW.js.map +1 -0
- package/dist/chunk-PVQZBKN7.js +106 -0
- package/dist/chunk-PVQZBKN7.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-BIJvkfYt.d.ts +614 -0
- package/dist/index.d.ts +37 -300
- package/dist/index.js +14 -6
- package/dist/mcp/client.d.ts +313 -21
- package/dist/mcp/client.js +3 -402
- package/dist/mcp/client.js.map +1 -1
- package/dist/mcp/do-oauth-client-provider.d.ts +3 -3
- package/dist/mcp/do-oauth-client-provider.js +3 -103
- package/dist/mcp/do-oauth-client-provider.js.map +1 -1
- package/dist/mcp/index.d.ts +33 -10
- package/dist/mcp/index.js +181 -176
- package/dist/mcp/index.js.map +1 -1
- package/dist/observability/index.d.ts +12 -0
- package/dist/observability/index.js +10 -0
- package/dist/react.d.ts +85 -5
- package/dist/react.js +20 -8
- 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 +76 -65
- package/src/index.ts +1102 -136
- package/dist/chunk-HMLY7DHA.js +0 -16
- package/dist/chunk-XG52S6YY.js +0 -591
- package/dist/chunk-XG52S6YY.js.map +0 -1
- /package/dist/{chunk-HMLY7DHA.js.map → observability/index.js.map} +0 -0
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,15 +1,37 @@
|
|
|
1
|
+
import { MCPClientManager } from './client.js';
|
|
1
2
|
import { DurableObject } from 'cloudflare:workers';
|
|
2
|
-
import {
|
|
3
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
3
4
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
5
|
+
import { Connection, WSMessage } from 'partyserver';
|
|
6
|
+
import 'zod';
|
|
7
|
+
import '@modelcontextprotocol/sdk/client/index.js';
|
|
8
|
+
import '@modelcontextprotocol/sdk/client/sse.js';
|
|
9
|
+
import '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
10
|
+
import '@modelcontextprotocol/sdk/types.js';
|
|
11
|
+
import 'ai';
|
|
12
|
+
import './do-oauth-client-provider.js';
|
|
13
|
+
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
14
|
+
import '@modelcontextprotocol/sdk/shared/auth.js';
|
|
4
15
|
|
|
5
16
|
interface CORSOptions {
|
|
6
17
|
origin?: string;
|
|
7
18
|
methods?: string;
|
|
8
19
|
headers?: string;
|
|
9
20
|
maxAge?: number;
|
|
21
|
+
exposeHeaders?: string;
|
|
10
22
|
}
|
|
23
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
11
24
|
declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Record<string, unknown> = Record<string, unknown>> extends DurableObject<Env> {
|
|
12
|
-
|
|
25
|
+
private _status;
|
|
26
|
+
private _transport?;
|
|
27
|
+
private _transportType;
|
|
28
|
+
private _requestIdToConnectionId;
|
|
29
|
+
/**
|
|
30
|
+
* Since McpAgent's _aren't_ yet real "Agents", let's only expose a couple of the methods
|
|
31
|
+
* to the outer class: initialState/state/setState/onStateUpdate/sql
|
|
32
|
+
*/
|
|
33
|
+
private _agent;
|
|
34
|
+
get mcp(): MCPClientManager;
|
|
13
35
|
protected constructor(ctx: DurableObjectState, env: Env);
|
|
14
36
|
/**
|
|
15
37
|
* Agents API allowlist
|
|
@@ -23,38 +45,39 @@ declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Re
|
|
|
23
45
|
/**
|
|
24
46
|
* McpAgent API
|
|
25
47
|
*/
|
|
26
|
-
abstract server: McpServer
|
|
48
|
+
abstract server: MaybePromise<McpServer | Server>;
|
|
27
49
|
props: Props;
|
|
28
50
|
initRun: boolean;
|
|
29
51
|
abstract init(): Promise<void>;
|
|
30
52
|
_init(props: Props): Promise<void>;
|
|
31
53
|
setInitialized(): Promise<void>;
|
|
32
54
|
isInitialized(): Promise<boolean>;
|
|
55
|
+
private _initialize;
|
|
33
56
|
fetch(request: Request): Promise<Response>;
|
|
34
57
|
getWebSocket(): WebSocket | null;
|
|
35
58
|
getWebSocketForResponseID(id: string): WebSocket | null;
|
|
36
59
|
onMessage(connection: Connection, event: WSMessage): Promise<void>;
|
|
37
|
-
onSSEMcpMessage(
|
|
60
|
+
onSSEMcpMessage(_sessionId: string, request: Request): Promise<Error | null>;
|
|
38
61
|
webSocketMessage(ws: WebSocket, event: ArrayBuffer | string): Promise<void>;
|
|
39
62
|
webSocketError(ws: WebSocket, error: unknown): Promise<void>;
|
|
40
63
|
webSocketClose(ws: WebSocket, code: number, reason: string, wasClean: boolean): Promise<void>;
|
|
41
|
-
static mount(path: string, { binding, corsOptions
|
|
64
|
+
static mount(path: string, { binding, corsOptions }?: {
|
|
42
65
|
binding?: string;
|
|
43
66
|
corsOptions?: CORSOptions;
|
|
44
67
|
}): {
|
|
45
|
-
fetch:
|
|
68
|
+
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
46
69
|
};
|
|
47
|
-
static serveSSE(path: string, { binding, corsOptions
|
|
70
|
+
static serveSSE(path: string, { binding, corsOptions }?: {
|
|
48
71
|
binding?: string;
|
|
49
72
|
corsOptions?: CORSOptions;
|
|
50
73
|
}): {
|
|
51
|
-
fetch:
|
|
74
|
+
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
52
75
|
};
|
|
53
|
-
static serve(path: string, { binding, corsOptions
|
|
76
|
+
static serve(path: string, { binding, corsOptions }?: {
|
|
54
77
|
binding?: string;
|
|
55
78
|
corsOptions?: CORSOptions;
|
|
56
79
|
}): {
|
|
57
|
-
fetch:
|
|
80
|
+
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
58
81
|
};
|
|
59
82
|
}
|
|
60
83
|
|