agents 0.0.0-696d33e → 0.0.0-6db2cd6
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 +125 -3
- package/dist/_esm-LV5FJ3HK.js +3922 -0
- package/dist/_esm-LV5FJ3HK.js.map +1 -0
- package/dist/ai-chat-agent.d.ts +1 -1
- package/dist/ai-chat-agent.js +79 -56
- package/dist/ai-chat-agent.js.map +1 -1
- package/dist/ai-chat-v5-migration.js +1 -0
- package/dist/ai-react.d.ts +7 -1
- package/dist/ai-react.js +155 -110
- package/dist/ai-react.js.map +1 -1
- package/dist/ai-types.d.ts +1 -0
- package/dist/ai-types.js +2 -1
- package/dist/ccip-CMBYN64O.js +15 -0
- package/dist/ccip-CMBYN64O.js.map +1 -0
- package/dist/chunk-5Y6BEZDY.js +276 -0
- package/dist/chunk-5Y6BEZDY.js.map +1 -0
- package/dist/{chunk-AVYJQSLW.js → chunk-BER7KXUJ.js} +2 -1
- package/dist/chunk-BER7KXUJ.js.map +1 -0
- package/dist/chunk-JJBFIGUC.js +5202 -0
- package/dist/chunk-JJBFIGUC.js.map +1 -0
- package/dist/{chunk-PNF6ZMUA.js → chunk-KK7D3KRW.js} +9 -5
- package/dist/chunk-KK7D3KRW.js.map +1 -0
- package/dist/chunk-PR4QN5HX.js +43 -0
- package/dist/chunk-PR4QN5HX.js.map +1 -0
- package/dist/{chunk-VYENMKFS.js → chunk-THPMWGLS.js} +4 -3
- package/dist/chunk-THPMWGLS.js.map +1 -0
- package/dist/chunk-TYAY6AU6.js +159 -0
- package/dist/chunk-TYAY6AU6.js.map +1 -0
- package/dist/{client-B9tFv5gX.d.ts → client-CvaJdLQA.d.ts} +413 -5
- package/dist/client.js +2 -1
- package/dist/index.d.ts +12 -3
- package/dist/index.js +4 -3
- package/dist/mcp/client.d.ts +1 -1
- package/dist/mcp/client.js +2 -1
- package/dist/mcp/do-oauth-client-provider.js +1 -0
- package/dist/mcp/index.d.ts +56 -76
- package/dist/mcp/index.js +902 -759
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/x402.d.ts +31 -0
- package/dist/mcp/x402.js +3195 -0
- package/dist/mcp/x402.js.map +1 -0
- package/dist/observability/index.js +4 -3
- package/dist/react.d.ts +1 -1
- package/dist/react.js +2 -1
- package/dist/react.js.map +1 -1
- package/dist/schedule.js +2 -0
- 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 +14 -6
- package/src/index.ts +21 -6
- package/dist/chunk-AVYJQSLW.js.map +0 -1
- package/dist/chunk-PNF6ZMUA.js.map +0 -1
- package/dist/chunk-VYENMKFS.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
9
9
|
import { Server, Connection, PartyServerOptions } from "partyserver";
|
|
10
10
|
export { Connection, ConnectionContext, WSMessage } from "partyserver";
|
|
11
|
-
import { M as MCPClientManager } from "./client-
|
|
11
|
+
import { M as MCPClientManager } from "./client-CvaJdLQA.js";
|
|
12
12
|
import { Observability } from "./observability/index.js";
|
|
13
13
|
import { MessageType } from "./ai-types.js";
|
|
14
14
|
import "zod";
|
|
@@ -160,7 +160,11 @@ declare function getCurrentAgent<
|
|
|
160
160
|
* @template Env Environment type containing bindings
|
|
161
161
|
* @template State State type to store within the Agent
|
|
162
162
|
*/
|
|
163
|
-
declare class Agent<
|
|
163
|
+
declare class Agent<
|
|
164
|
+
Env = typeof env,
|
|
165
|
+
State = unknown,
|
|
166
|
+
Props extends Record<string, unknown> = Record<string, unknown>
|
|
167
|
+
> extends Server<Env, Props> {
|
|
164
168
|
private _state;
|
|
165
169
|
private _ParentClass;
|
|
166
170
|
mcp: MCPClientManager;
|
|
@@ -496,12 +500,17 @@ type EmailSendOptions = {
|
|
|
496
500
|
* @param options Options for Agent creation
|
|
497
501
|
* @returns Promise resolving to an Agent instance stub
|
|
498
502
|
*/
|
|
499
|
-
declare function getAgentByName<
|
|
503
|
+
declare function getAgentByName<
|
|
504
|
+
Env,
|
|
505
|
+
T extends Agent<Env>,
|
|
506
|
+
Props extends Record<string, unknown> = Record<string, unknown>
|
|
507
|
+
>(
|
|
500
508
|
namespace: AgentNamespace<T>,
|
|
501
509
|
name: string,
|
|
502
510
|
options?: {
|
|
503
511
|
jurisdiction?: DurableObjectJurisdiction;
|
|
504
512
|
locationHint?: DurableObjectLocationHint;
|
|
513
|
+
props?: Props;
|
|
505
514
|
}
|
|
506
515
|
): Promise<DurableObjectStub<T>>;
|
|
507
516
|
/**
|
package/dist/index.js
CHANGED
|
@@ -10,11 +10,12 @@ import {
|
|
|
10
10
|
routeAgentEmail,
|
|
11
11
|
routeAgentRequest,
|
|
12
12
|
unstable_callable
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-KK7D3KRW.js";
|
|
14
|
+
import "./chunk-THPMWGLS.js";
|
|
15
15
|
import "./chunk-LL2AFX7V.js";
|
|
16
16
|
import "./chunk-QEVM4BVL.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-BER7KXUJ.js";
|
|
18
|
+
import "./chunk-PR4QN5HX.js";
|
|
18
19
|
export {
|
|
19
20
|
Agent,
|
|
20
21
|
StreamingResponse,
|
package/dist/mcp/client.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import '@modelcontextprotocol/sdk/client/index.js';
|
|
|
3
3
|
import '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
4
4
|
import '@modelcontextprotocol/sdk/types.js';
|
|
5
5
|
import 'ai';
|
|
6
|
-
export { M as MCPClientManager, g as getNamespacedData } from '../client-
|
|
6
|
+
export { M as MCPClientManager, g as getNamespacedData } from '../client-CvaJdLQA.js';
|
|
7
7
|
import '@modelcontextprotocol/sdk/client/sse.js';
|
|
8
8
|
import '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
9
9
|
import './do-oauth-client-provider.js';
|
package/dist/mcp/client.js
CHANGED
package/dist/mcp/index.d.ts
CHANGED
|
@@ -1,21 +1,25 @@
|
|
|
1
|
-
import { M as MCPClientManager } from '../client-B9tFv5gX.js';
|
|
2
|
-
export { S as SSEEdgeClientTransport, a as StreamableHTTPEdgeClientTransport } from '../client-B9tFv5gX.js';
|
|
3
|
-
import { DurableObject } from 'cloudflare:workers';
|
|
4
1
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
5
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
6
|
-
import { ElicitResult } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import { JSONRPCMessage, ElicitResult } from '@modelcontextprotocol/sdk/types.js';
|
|
7
4
|
export { ElicitRequest, ElicitRequestSchema, ElicitResult } from '@modelcontextprotocol/sdk/types.js';
|
|
8
|
-
import {
|
|
9
|
-
|
|
5
|
+
import { Agent } from '../index.js';
|
|
6
|
+
export { S as SSEEdgeClientTransport, a as StreamableHTTPEdgeClientTransport } from '../client-CvaJdLQA.js';
|
|
7
|
+
import { Connection, ConnectionContext } from 'partyserver';
|
|
8
|
+
import 'cloudflare:workers';
|
|
10
9
|
import '@modelcontextprotocol/sdk/client/index.js';
|
|
11
|
-
import '
|
|
10
|
+
import '../observability/index.js';
|
|
11
|
+
import '../ai-types.js';
|
|
12
12
|
import 'ai';
|
|
13
|
+
import 'zod';
|
|
14
|
+
import '@modelcontextprotocol/sdk/shared/protocol.js';
|
|
13
15
|
import '@modelcontextprotocol/sdk/client/sse.js';
|
|
14
16
|
import '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
15
17
|
import './do-oauth-client-provider.js';
|
|
16
18
|
import '@modelcontextprotocol/sdk/client/auth.js';
|
|
17
19
|
import '@modelcontextprotocol/sdk/shared/auth.js';
|
|
18
20
|
|
|
21
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
22
|
+
type TransportType = "sse" | "streamable-http";
|
|
19
23
|
interface CORSOptions {
|
|
20
24
|
origin?: string;
|
|
21
25
|
methods?: string;
|
|
@@ -23,88 +27,64 @@ interface CORSOptions {
|
|
|
23
27
|
maxAge?: number;
|
|
24
28
|
exposeHeaders?: string;
|
|
25
29
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
interface ServeOptions {
|
|
31
|
+
binding?: string;
|
|
32
|
+
corsOptions?: CORSOptions;
|
|
33
|
+
transport?: TransportType;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Record<string, unknown> = Record<string, unknown>> extends Agent<Env, State, Props> {
|
|
29
37
|
private _transport?;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
protected constructor(ctx: DurableObjectState, env: Env);
|
|
39
|
-
/**
|
|
40
|
-
* Agents API allowlist
|
|
38
|
+
props?: Props;
|
|
39
|
+
abstract server: MaybePromise<McpServer | Server>;
|
|
40
|
+
abstract init(): Promise<void>;
|
|
41
|
+
setInitializeRequest(initializeRequest: JSONRPCMessage): Promise<void>;
|
|
42
|
+
getInitializeRequest(): Promise<JSONRPCMessage | undefined>;
|
|
43
|
+
/** Read the transport type for this agent.
|
|
44
|
+
* This relies on the naming scheme being `sse:${sessionId}`
|
|
45
|
+
* or `streamable-http:${sessionId}`.
|
|
41
46
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/**
|
|
47
|
-
* Elicit user input with a message and schema
|
|
47
|
+
getTransportType(): TransportType;
|
|
48
|
+
/** Read the sessionId for this agent.
|
|
49
|
+
* This relies on the naming scheme being `sse:${sessionId}`
|
|
50
|
+
* or `streamable-http:${sessionId}`.
|
|
48
51
|
*/
|
|
52
|
+
getSessionId(): string;
|
|
53
|
+
/** Get the unique WebSocket. SSE transport only. */
|
|
54
|
+
private getWebSocket;
|
|
55
|
+
/** Returns a new transport matching the type of the Agent. */
|
|
56
|
+
private initTransport;
|
|
57
|
+
/** Update and store the props */
|
|
58
|
+
updateProps(props?: Props): Promise<void>;
|
|
59
|
+
reinitializeServer(): Promise<void>;
|
|
60
|
+
/** Sets up the MCP transport and server every time the Agent is started.*/
|
|
61
|
+
onStart(props?: Props): Promise<void>;
|
|
62
|
+
/** Validates new WebSocket connections. */
|
|
63
|
+
onConnect(conn: Connection, { request: req }: ConnectionContext): Promise<void>;
|
|
64
|
+
/** Handles MCP Messages for the legacy SSE transport. */
|
|
65
|
+
onSSEMcpMessage(_sessionId: string, messageBody: unknown): Promise<Error | null>;
|
|
66
|
+
/** Elicit user input with a message and schema */
|
|
49
67
|
elicitInput(params: {
|
|
50
68
|
message: string;
|
|
51
69
|
requestedSchema: unknown;
|
|
52
70
|
}): Promise<ElicitResult>;
|
|
53
|
-
|
|
54
|
-
onStart(): Promise<void>;
|
|
55
|
-
/**
|
|
56
|
-
* McpAgent API
|
|
57
|
-
*/
|
|
58
|
-
abstract server: MaybePromise<McpServer | Server>;
|
|
59
|
-
props: Props;
|
|
60
|
-
initRun: boolean;
|
|
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
|
-
};
|
|
72
|
-
_init(props: Props): Promise<void>;
|
|
73
|
-
setInitialized(): Promise<void>;
|
|
74
|
-
isInitialized(): Promise<boolean>;
|
|
75
|
-
updateProps(props: Props): Promise<void>;
|
|
76
|
-
private _initialize;
|
|
77
|
-
fetch(request: Request): Promise<Response>;
|
|
78
|
-
getWebSocket(): WebSocket | null;
|
|
79
|
-
getWebSocketForResponseID(id: string): WebSocket | null;
|
|
80
|
-
onMessage(connection: Connection, event: WSMessage): Promise<void>;
|
|
81
|
-
/**
|
|
82
|
-
* Wait for elicitation response through storage polling
|
|
83
|
-
*/
|
|
71
|
+
/** Wait for elicitation response through storage polling */
|
|
84
72
|
private _waitForElicitationResponse;
|
|
85
|
-
/**
|
|
86
|
-
* Handle elicitation responses */
|
|
73
|
+
/** Handle elicitation responses */
|
|
87
74
|
private _handleElicitationResponse;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
static mount(path: string, { binding, corsOptions }?: {
|
|
93
|
-
binding?: string;
|
|
94
|
-
corsOptions?: CORSOptions;
|
|
95
|
-
}): {
|
|
75
|
+
/** Return a handler for the given path for this MCP.
|
|
76
|
+
* Defaults to Streamable HTTP transport.
|
|
77
|
+
*/
|
|
78
|
+
static serve(path: string, { binding, corsOptions, transport }?: ServeOptions): {
|
|
96
79
|
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
97
80
|
};
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Legacy api
|
|
83
|
+
**/
|
|
84
|
+
static mount(path: string, opts?: Omit<ServeOptions, "transport">): {
|
|
102
85
|
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
103
86
|
};
|
|
104
|
-
static
|
|
105
|
-
binding?: string;
|
|
106
|
-
corsOptions?: CORSOptions;
|
|
107
|
-
}): {
|
|
87
|
+
static serveSSE(path: string, opts?: Omit<ServeOptions, "transport">): {
|
|
108
88
|
fetch<Env>(this: void, request: Request, env: Env, ctx: ExecutionContext): Promise<Response>;
|
|
109
89
|
};
|
|
110
90
|
}
|