agents 0.0.0-c5e3a32 → 0.0.0-c69f616
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 +106 -0
- package/dist/ai-chat-agent.d.ts +5 -3
- package/dist/ai-chat-agent.js +2 -2
- package/dist/ai-react.d.ts +5 -3
- package/dist/{chunk-MW5BQ2FW.js → chunk-HY7ZLHJB.js} +146 -17
- package/dist/chunk-HY7ZLHJB.js.map +1 -0
- package/dist/{chunk-EDUDXISR.js → chunk-OJFA7RKX.js} +136 -14
- package/dist/chunk-OJFA7RKX.js.map +1 -0
- package/dist/client-CH-eFIfq.d.ts +4457 -0
- package/dist/{index-DukU3sIa.d.ts → index-BVoermIz.d.ts} +46 -2
- package/dist/index.d.ts +6 -3
- package/dist/index.js +2 -2
- package/dist/mcp/client.d.ts +9 -1053
- package/dist/mcp/client.js +1 -1
- package/dist/mcp/index.d.ts +21 -4
- package/dist/mcp/index.js +132 -7
- package/dist/mcp/index.js.map +1 -1
- package/dist/observability/index.d.ts +5 -3
- package/dist/observability/index.js +2 -2
- package/dist/react.d.ts +5 -3
- package/dist/schedule.d.ts +4 -4
- package/package.json +2 -2
- package/src/index.ts +184 -21
- package/dist/chunk-EDUDXISR.js.map +0 -1
- package/dist/chunk-MW5BQ2FW.js.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { env } from "cloudflare:workers";
|
|
1
2
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
2
3
|
import {
|
|
3
4
|
ServerCapabilities,
|
|
@@ -6,7 +7,7 @@ import {
|
|
|
6
7
|
Resource
|
|
7
8
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
8
9
|
import { Server, Connection, PartyServerOptions } from "partyserver";
|
|
9
|
-
import { MCPClientManager } from "./
|
|
10
|
+
import { M as MCPClientManager } from "./client-CH-eFIfq.js";
|
|
10
11
|
import { Message } from "ai";
|
|
11
12
|
|
|
12
13
|
type BaseEvent<
|
|
@@ -140,6 +141,12 @@ declare function unstable_callable(
|
|
|
140
141
|
target: (this: This, ...args: Args) => Return,
|
|
141
142
|
context: ClassMethodDecoratorContext
|
|
142
143
|
) => (this: This, ...args: Args) => Return;
|
|
144
|
+
type QueueItem<T = string> = {
|
|
145
|
+
id: string;
|
|
146
|
+
payload: T;
|
|
147
|
+
callback: keyof Agent<unknown>;
|
|
148
|
+
created_at: number;
|
|
149
|
+
};
|
|
143
150
|
/**
|
|
144
151
|
* Represents a scheduled task within an Agent
|
|
145
152
|
* @template T Type of the payload data
|
|
@@ -211,7 +218,7 @@ declare function getCurrentAgent<
|
|
|
211
218
|
* @template Env Environment type containing bindings
|
|
212
219
|
* @template State State type to store within the Agent
|
|
213
220
|
*/
|
|
214
|
-
declare class Agent<Env, State = unknown> extends Server<Env> {
|
|
221
|
+
declare class Agent<Env = typeof env, State = unknown> extends Server<Env> {
|
|
215
222
|
private _state;
|
|
216
223
|
private _ParentClass;
|
|
217
224
|
mcp: MCPClientManager;
|
|
@@ -293,6 +300,42 @@ declare class Agent<Env, State = unknown> extends Server<Env> {
|
|
|
293
300
|
* Render content (not implemented in base class)
|
|
294
301
|
*/
|
|
295
302
|
render(): void;
|
|
303
|
+
/**
|
|
304
|
+
* Queue a task to be executed in the future
|
|
305
|
+
* @param payload Payload to pass to the callback
|
|
306
|
+
* @param callback Name of the method to call
|
|
307
|
+
* @returns The ID of the queued task
|
|
308
|
+
*/
|
|
309
|
+
queue<T = unknown>(callback: keyof this, payload: T): Promise<string>;
|
|
310
|
+
private _flushingQueue;
|
|
311
|
+
private _flushQueue;
|
|
312
|
+
/**
|
|
313
|
+
* Dequeue a task by ID
|
|
314
|
+
* @param id ID of the task to dequeue
|
|
315
|
+
*/
|
|
316
|
+
dequeue(id: string): Promise<void>;
|
|
317
|
+
/**
|
|
318
|
+
* Dequeue all tasks
|
|
319
|
+
*/
|
|
320
|
+
dequeueAll(): Promise<void>;
|
|
321
|
+
/**
|
|
322
|
+
* Dequeue all tasks by callback
|
|
323
|
+
* @param callback Name of the callback to dequeue
|
|
324
|
+
*/
|
|
325
|
+
dequeueAllByCallback(callback: string): Promise<void>;
|
|
326
|
+
/**
|
|
327
|
+
* Get a queued task by ID
|
|
328
|
+
* @param id ID of the task to get
|
|
329
|
+
* @returns The task or undefined if not found
|
|
330
|
+
*/
|
|
331
|
+
getQueue(id: string): Promise<QueueItem<string> | undefined>;
|
|
332
|
+
/**
|
|
333
|
+
* Get all queues by key and value
|
|
334
|
+
* @param key Key to filter by
|
|
335
|
+
* @param value Value to filter by
|
|
336
|
+
* @returns Array of matching QueueItem objects
|
|
337
|
+
*/
|
|
338
|
+
getQueues(key: string, value: string): Promise<QueueItem<string>[]>;
|
|
296
339
|
/**
|
|
297
340
|
* Schedule a task to be executed in the future
|
|
298
341
|
* @template T Type of the payload data
|
|
@@ -545,6 +588,7 @@ export {
|
|
|
545
588
|
type EmailResolver as E,
|
|
546
589
|
type MCPServersState as M,
|
|
547
590
|
type ObservabilityEvent as O,
|
|
591
|
+
type QueueItem as Q,
|
|
548
592
|
type RPCRequest as R,
|
|
549
593
|
type StateUpdateMessage as S,
|
|
550
594
|
type AgentContext as a,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import "cloudflare:workers";
|
|
1
2
|
import "@modelcontextprotocol/sdk/client/index.js";
|
|
2
3
|
import "@modelcontextprotocol/sdk/types.js";
|
|
3
4
|
export { Connection, ConnectionContext, WSMessage } from "partyserver";
|
|
4
|
-
import "./
|
|
5
|
+
import "./client-CH-eFIfq.js";
|
|
5
6
|
export {
|
|
6
7
|
A as Agent,
|
|
7
8
|
a as AgentContext,
|
|
@@ -15,6 +16,7 @@ export {
|
|
|
15
16
|
f as MCPServer,
|
|
16
17
|
e as MCPServerMessage,
|
|
17
18
|
M as MCPServersState,
|
|
19
|
+
Q as QueueItem,
|
|
18
20
|
R as RPCRequest,
|
|
19
21
|
c as RPCResponse,
|
|
20
22
|
d as Schedule,
|
|
@@ -28,11 +30,12 @@ export {
|
|
|
28
30
|
o as routeAgentEmail,
|
|
29
31
|
r as routeAgentRequest,
|
|
30
32
|
u as unstable_callable
|
|
31
|
-
} from "./index-
|
|
33
|
+
} from "./index-BVoermIz.js";
|
|
32
34
|
import "zod";
|
|
33
|
-
import "@modelcontextprotocol/sdk/client/sse.js";
|
|
34
35
|
import "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
35
36
|
import "ai";
|
|
37
|
+
import "@modelcontextprotocol/sdk/client/sse.js";
|
|
38
|
+
import "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
36
39
|
import "./mcp/do-oauth-client-provider.js";
|
|
37
40
|
import "@modelcontextprotocol/sdk/client/auth.js";
|
|
38
41
|
import "@modelcontextprotocol/sdk/shared/auth.js";
|
package/dist/index.js
CHANGED
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
routeAgentEmail,
|
|
10
10
|
routeAgentRequest,
|
|
11
11
|
unstable_callable
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-OJFA7RKX.js";
|
|
13
|
+
import "./chunk-HY7ZLHJB.js";
|
|
14
14
|
import "./chunk-PVQZBKN7.js";
|
|
15
15
|
import "./chunk-KUH345EY.js";
|
|
16
16
|
export {
|