agents 0.0.0-de168a2 → 0.0.0-df52d4b
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 +128 -22
- package/dist/ai-chat-agent.d.ts +49 -4
- package/dist/ai-chat-agent.js +158 -68
- package/dist/ai-chat-agent.js.map +1 -1
- package/dist/ai-react.d.ts +21 -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-DQJFYHG3.js +1290 -0
- package/dist/chunk-DQJFYHG3.js.map +1 -0
- package/dist/chunk-EM3J4KV7.js +598 -0
- package/dist/chunk-EM3J4KV7.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/client-DgyzBU_8.d.ts +4601 -0
- package/dist/client.d.ts +16 -2
- package/dist/client.js +6 -126
- package/dist/client.js.map +1 -1
- package/dist/index.d.ts +263 -18
- package/dist/index.js +14 -6
- package/dist/mcp/client.d.ts +9 -761
- 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 +73 -6
- package/dist/mcp/index.js +768 -162
- package/dist/mcp/index.js.map +1 -1
- package/dist/observability/index.d.ts +46 -0
- package/dist/observability/index.js +10 -0
- package/dist/react.d.ts +88 -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 +79 -56
- package/src/index.ts +1147 -139
- 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,40 @@
|
|
|
1
|
+
import { M as MCPClientManager } from '../client-DgyzBU_8.js';
|
|
2
|
+
export { S as SSEEdgeClientTransport, a as StreamableHTTPEdgeClientTransport } from '../client-DgyzBU_8.js';
|
|
1
3
|
import { DurableObject } from 'cloudflare:workers';
|
|
4
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
5
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
3
|
-
import {
|
|
6
|
+
import { ElicitResult } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
+
export { ElicitRequest, ElicitRequestSchema, ElicitResult } from '@modelcontextprotocol/sdk/types.js';
|
|
8
|
+
import { Connection, WSMessage } from 'partyserver';
|
|
9
|
+
import 'zod';
|
|
10
|
+
import '@modelcontextprotocol/sdk/client/index.js';
|
|
11
|
+
import '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
12
|
+
import 'ai';
|
|
13
|
+
import '@modelcontextprotocol/sdk/client/sse.js';
|
|
14
|
+
import '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
15
|
+
import './do-oauth-client-provider.js';
|
|
16
|
+
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
17
|
+
import '@modelcontextprotocol/sdk/shared/auth.js';
|
|
4
18
|
|
|
5
19
|
interface CORSOptions {
|
|
6
20
|
origin?: string;
|
|
7
21
|
methods?: string;
|
|
8
22
|
headers?: string;
|
|
9
23
|
maxAge?: number;
|
|
24
|
+
exposeHeaders?: string;
|
|
10
25
|
}
|
|
26
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
11
27
|
declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Record<string, unknown> = Record<string, unknown>> extends DurableObject<Env> {
|
|
12
|
-
|
|
28
|
+
private _status;
|
|
29
|
+
private _transport?;
|
|
30
|
+
private _transportType;
|
|
31
|
+
private _requestIdToConnectionId;
|
|
32
|
+
/**
|
|
33
|
+
* Since McpAgent's _aren't_ yet real "Agents", let's only expose a couple of the methods
|
|
34
|
+
* to the outer class: initialState/state/setState/onStateUpdate/sql
|
|
35
|
+
*/
|
|
36
|
+
private _agent;
|
|
37
|
+
get mcp(): MCPClientManager;
|
|
13
38
|
protected constructor(ctx: DurableObjectState, env: Env);
|
|
14
39
|
/**
|
|
15
40
|
* Agents API allowlist
|
|
@@ -18,27 +43,69 @@ declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Re
|
|
|
18
43
|
get state(): State;
|
|
19
44
|
sql<T = Record<string, string | number | boolean | null>>(strings: TemplateStringsArray, ...values: (string | number | boolean | null)[]): T[];
|
|
20
45
|
setState(state: State): void;
|
|
46
|
+
/**
|
|
47
|
+
* Elicit user input with a message and schema
|
|
48
|
+
*/
|
|
49
|
+
elicitInput(params: {
|
|
50
|
+
message: string;
|
|
51
|
+
requestedSchema: unknown;
|
|
52
|
+
}): Promise<ElicitResult>;
|
|
21
53
|
onStateUpdate(state: State | undefined, source: Connection | "server"): void;
|
|
22
54
|
onStart(): Promise<void>;
|
|
23
55
|
/**
|
|
24
56
|
* McpAgent API
|
|
25
57
|
*/
|
|
26
|
-
abstract server: McpServer
|
|
58
|
+
abstract server: MaybePromise<McpServer | Server>;
|
|
27
59
|
props: Props;
|
|
28
60
|
initRun: boolean;
|
|
29
61
|
abstract init(): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Handle errors that occur during initialization or operation.
|
|
64
|
+
* Override this method to provide custom error handling.
|
|
65
|
+
* @param error - The error that occurred
|
|
66
|
+
* @returns An error response object with status code and message
|
|
67
|
+
*/
|
|
68
|
+
onError(error: Error): {
|
|
69
|
+
status: number;
|
|
70
|
+
message: string;
|
|
71
|
+
};
|
|
30
72
|
_init(props: Props): Promise<void>;
|
|
73
|
+
setInitialized(): Promise<void>;
|
|
74
|
+
isInitialized(): Promise<boolean>;
|
|
75
|
+
updateProps(props: Props): Promise<void>;
|
|
76
|
+
private _initialize;
|
|
31
77
|
fetch(request: Request): Promise<Response>;
|
|
32
78
|
getWebSocket(): WebSocket | null;
|
|
33
|
-
|
|
79
|
+
getWebSocketForResponseID(id: string): WebSocket | null;
|
|
80
|
+
onMessage(connection: Connection, event: WSMessage): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* Wait for elicitation response through storage polling
|
|
83
|
+
*/
|
|
84
|
+
private _waitForElicitationResponse;
|
|
85
|
+
/**
|
|
86
|
+
* Handle elicitation responses */
|
|
87
|
+
private _handleElicitationResponse;
|
|
88
|
+
onSSEMcpMessage(_sessionId: string, messageBody: unknown): Promise<Error | null>;
|
|
34
89
|
webSocketMessage(ws: WebSocket, event: ArrayBuffer | string): Promise<void>;
|
|
35
90
|
webSocketError(ws: WebSocket, error: unknown): Promise<void>;
|
|
36
91
|
webSocketClose(ws: WebSocket, code: number, reason: string, wasClean: boolean): Promise<void>;
|
|
37
|
-
static mount(path: string, { binding, corsOptions
|
|
92
|
+
static mount(path: string, { binding, corsOptions }?: {
|
|
93
|
+
binding?: string;
|
|
94
|
+
corsOptions?: CORSOptions;
|
|
95
|
+
}): {
|
|
96
|
+
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
97
|
+
};
|
|
98
|
+
static serveSSE(path: string, { binding, corsOptions }?: {
|
|
99
|
+
binding?: string;
|
|
100
|
+
corsOptions?: CORSOptions;
|
|
101
|
+
}): {
|
|
102
|
+
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
103
|
+
};
|
|
104
|
+
static serve(path: string, { binding, corsOptions }?: {
|
|
38
105
|
binding?: string;
|
|
39
106
|
corsOptions?: CORSOptions;
|
|
40
107
|
}): {
|
|
41
|
-
fetch:
|
|
108
|
+
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
42
109
|
};
|
|
43
110
|
}
|
|
44
111
|
|