agents 0.0.0-f5b5854 → 0.0.0-f6b2319
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 +255 -27
- package/dist/_esm-LV5FJ3HK.js +3922 -0
- package/dist/_esm-LV5FJ3HK.js.map +1 -0
- package/dist/ai-chat-agent.d.ts +55 -8
- package/dist/ai-chat-agent.js +574 -90
- package/dist/ai-chat-agent.js.map +1 -1
- package/dist/ai-chat-v5-migration.d.ts +152 -0
- package/dist/ai-chat-v5-migration.js +20 -0
- package/dist/ai-react.d.ts +78 -67
- package/dist/ai-react.js +273 -109
- package/dist/ai-react.js.map +1 -1
- package/dist/ai-types.d.ts +41 -18
- package/dist/ai-types.js +7 -0
- package/dist/ccip-CMBYN64O.js +15 -0
- package/dist/ccip-CMBYN64O.js.map +1 -0
- package/dist/chunk-254F4GDT.js +1343 -0
- package/dist/chunk-254F4GDT.js.map +1 -0
- package/dist/chunk-3OT2NNEW.js +941 -0
- package/dist/chunk-3OT2NNEW.js.map +1 -0
- package/dist/chunk-5Y6BEZDY.js +276 -0
- package/dist/chunk-5Y6BEZDY.js.map +1 -0
- package/dist/chunk-BER7KXUJ.js +18 -0
- 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-PR4QN5HX.js +43 -0
- package/dist/chunk-PR4QN5HX.js.map +1 -0
- package/dist/chunk-QEVM4BVL.js +116 -0
- package/dist/chunk-QEVM4BVL.js.map +1 -0
- package/dist/chunk-TYAY6AU6.js +159 -0
- package/dist/chunk-TYAY6AU6.js.map +1 -0
- package/dist/chunk-UJVEAURM.js +150 -0
- package/dist/chunk-UJVEAURM.js.map +1 -0
- package/dist/chunk-Z44WASMA.js +114 -0
- package/dist/chunk-Z44WASMA.js.map +1 -0
- package/dist/client-DVoPb3-C.d.ts +5120 -0
- package/dist/client.d.ts +16 -2
- package/dist/client.js +8 -126
- package/dist/client.js.map +1 -1
- package/dist/codemode/ai.d.ts +25 -0
- package/dist/codemode/ai.js +5109 -0
- package/dist/codemode/ai.js.map +1 -0
- package/dist/index.d.ts +277 -22
- package/dist/index.js +18 -6
- package/dist/mcp/client.d.ts +10 -761
- package/dist/mcp/client.js +4 -402
- package/dist/mcp/client.js.map +1 -1
- package/dist/mcp/do-oauth-client-provider.d.ts +4 -3
- package/dist/mcp/do-oauth-client-provider.js +4 -103
- package/dist/mcp/do-oauth-client-provider.js.map +1 -1
- package/dist/mcp/index.d.ts +69 -51
- package/dist/mcp/index.js +982 -661
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/x402.d.ts +39 -0
- package/dist/mcp/x402.js +3195 -0
- package/dist/mcp/x402.js.map +1 -0
- package/dist/mcp-BH1fJeiU.d.ts +58 -0
- package/dist/observability/index.d.ts +34 -0
- package/dist/observability/index.js +12 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/react.d.ts +97 -9
- package/dist/react.js +123 -11
- package/dist/react.js.map +1 -1
- package/dist/schedule.d.ts +81 -7
- package/dist/schedule.js +20 -7
- package/dist/schedule.js.map +1 -1
- package/dist/secp256k1-M22GZP2U.js +2193 -0
- package/dist/secp256k1-M22GZP2U.js.map +1 -0
- package/dist/serializable.d.ts +32 -0
- package/dist/serializable.js +1 -0
- package/dist/serializable.js.map +1 -0
- package/package.json +98 -64
- package/src/index.ts +1271 -152
- 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 → ai-chat-v5-migration.js.map} +0 -0
package/dist/ai-chat-agent.d.ts
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
+
import { UIMessage, StreamTextOnFinishCallback, ToolSet } from "ai";
|
|
1
2
|
import { Agent, AgentContext } from "./index.js";
|
|
2
|
-
import { Message, StreamTextOnFinishCallback, ToolSet } from "ai";
|
|
3
3
|
import { Connection, WSMessage } from "partyserver";
|
|
4
|
-
import "
|
|
4
|
+
import "cloudflare:workers";
|
|
5
|
+
import "@modelcontextprotocol/sdk/client/index.js";
|
|
6
|
+
import "@modelcontextprotocol/sdk/types.js";
|
|
7
|
+
import "./client-DVoPb3-C.js";
|
|
8
|
+
import "zod";
|
|
9
|
+
import "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
10
|
+
import "./mcp-BH1fJeiU.js";
|
|
11
|
+
import "@modelcontextprotocol/sdk/client/sse.js";
|
|
12
|
+
import "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
13
|
+
import "./mcp/do-oauth-client-provider.js";
|
|
14
|
+
import "@modelcontextprotocol/sdk/client/auth.js";
|
|
15
|
+
import "@modelcontextprotocol/sdk/shared/auth.js";
|
|
16
|
+
import "./observability/index.js";
|
|
17
|
+
import "./ai-types.js";
|
|
5
18
|
|
|
6
19
|
/**
|
|
7
20
|
* Extension of Agent with built-in chat capabilities
|
|
@@ -11,29 +24,63 @@ declare class AIChatAgent<Env = unknown, State = unknown> extends Agent<
|
|
|
11
24
|
Env,
|
|
12
25
|
State
|
|
13
26
|
> {
|
|
14
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Map of message `id`s to `AbortController`s
|
|
29
|
+
* useful to propagate request cancellation signals for any external calls made by the agent
|
|
30
|
+
*/
|
|
31
|
+
private _chatMessageAbortControllers;
|
|
15
32
|
/** Array of chat messages for the current conversation */
|
|
16
|
-
messages:
|
|
33
|
+
messages: UIMessage[];
|
|
17
34
|
constructor(ctx: AgentContext, env: Env);
|
|
35
|
+
private _broadcastChatMessage;
|
|
18
36
|
onMessage(connection: Connection, message: WSMessage): Promise<void>;
|
|
19
37
|
onRequest(request: Request): Promise<Response>;
|
|
38
|
+
private _tryCatchChat;
|
|
20
39
|
/**
|
|
21
40
|
* Handle incoming chat messages and generate a response
|
|
22
41
|
* @param onFinish Callback to be called when the response is finished
|
|
42
|
+
* @param options.signal A signal to pass to any child requests which can be used to cancel them
|
|
23
43
|
* @returns Response to send to the client or undefined
|
|
24
44
|
*/
|
|
25
45
|
onChatMessage(
|
|
26
|
-
onFinish: StreamTextOnFinishCallback<ToolSet
|
|
46
|
+
onFinish: StreamTextOnFinishCallback<ToolSet>,
|
|
47
|
+
options?: {
|
|
48
|
+
abortSignal: AbortSignal | undefined;
|
|
49
|
+
}
|
|
27
50
|
): Promise<Response | undefined>;
|
|
28
51
|
/**
|
|
29
|
-
* Save messages on the server side
|
|
52
|
+
* Save messages on the server side
|
|
30
53
|
* @param messages Chat messages to save
|
|
31
54
|
*/
|
|
32
|
-
saveMessages(messages:
|
|
55
|
+
saveMessages(messages: UIMessage[]): Promise<void>;
|
|
33
56
|
persistMessages(
|
|
34
|
-
messages:
|
|
57
|
+
messages: UIMessage[],
|
|
35
58
|
excludeBroadcastIds?: string[]
|
|
36
59
|
): Promise<void>;
|
|
60
|
+
private _reply;
|
|
61
|
+
/**
|
|
62
|
+
* For the given message id, look up its associated AbortController
|
|
63
|
+
* If the AbortController does not exist, create and store one in memory
|
|
64
|
+
*
|
|
65
|
+
* returns the AbortSignal associated with the AbortController
|
|
66
|
+
*/
|
|
67
|
+
private _getAbortSignal;
|
|
68
|
+
/**
|
|
69
|
+
* Remove an abort controller from the cache of pending message responses
|
|
70
|
+
*/
|
|
71
|
+
private _removeAbortController;
|
|
72
|
+
/**
|
|
73
|
+
* Propagate an abort signal for any requests associated with the given message id
|
|
74
|
+
*/
|
|
75
|
+
private _cancelChatRequest;
|
|
76
|
+
/**
|
|
77
|
+
* Abort all pending requests and clear the cache of AbortControllers
|
|
78
|
+
*/
|
|
79
|
+
private _destroyAbortControllers;
|
|
80
|
+
/**
|
|
81
|
+
* When the DO is destroyed, cancel all pending requests
|
|
82
|
+
*/
|
|
83
|
+
destroy(): Promise<void>;
|
|
37
84
|
}
|
|
38
85
|
|
|
39
86
|
export { AIChatAgent };
|