agents 0.0.0-c3e8618 → 0.0.0-c4c9271
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/dist/ai-chat-agent.d.ts +73 -23
- package/dist/ai-chat-agent.js +230 -0
- package/dist/ai-chat-agent.js.map +1 -0
- package/dist/ai-react.d.ts +85 -44
- package/dist/ai-react.js +203 -0
- package/dist/ai-react.js.map +1 -0
- package/dist/ai-types.d.ts +65 -40
- package/dist/ai-types.js +1 -0
- package/dist/ai-types.js.map +1 -0
- package/dist/chunk-6RPGDIE2.js +786 -0
- package/dist/chunk-6RPGDIE2.js.map +1 -0
- package/dist/chunk-BZXOAZUX.js +106 -0
- package/dist/chunk-BZXOAZUX.js.map +1 -0
- package/dist/chunk-OYJXQRRH.js +465 -0
- package/dist/chunk-OYJXQRRH.js.map +1 -0
- package/dist/chunk-VCSB47AK.js +116 -0
- package/dist/chunk-VCSB47AK.js.map +1 -0
- package/dist/client.d.ts +71 -37
- package/dist/client.js +11 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +331 -179
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/client.d.ts +142 -34
- package/dist/mcp/client.js +9 -0
- package/dist/mcp/client.js.map +1 -0
- package/dist/mcp/do-oauth-client-provider.d.ts +41 -0
- package/dist/mcp/do-oauth-client-provider.js +7 -0
- package/dist/mcp/do-oauth-client-provider.js.map +1 -0
- package/dist/mcp/index.d.ts +50 -7
- package/dist/mcp/index.js +782 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/react.d.ts +104 -15
- package/dist/react.js +116 -0
- package/dist/react.js.map +1 -0
- package/dist/schedule.d.ts +30 -20
- package/dist/schedule.js +71 -0
- package/dist/schedule.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 +28 -5
- package/src/index.ts +396 -60
package/dist/index.d.ts
CHANGED
|
@@ -1,202 +1,321 @@
|
|
|
1
|
-
import { Server, Connection, PartyServerOptions } from
|
|
2
|
-
export { Connection, ConnectionContext, WSMessage } from
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { Server, Connection, PartyServerOptions } from "partyserver";
|
|
2
|
+
export { Connection, ConnectionContext, WSMessage } from "partyserver";
|
|
3
|
+
import {
|
|
4
|
+
ServerCapabilities,
|
|
5
|
+
Tool,
|
|
6
|
+
Prompt,
|
|
7
|
+
Resource,
|
|
8
|
+
} from "@modelcontextprotocol/sdk/types.js";
|
|
9
|
+
import { MCPClientManager } from "./mcp/client.js";
|
|
10
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
11
|
+
import "zod";
|
|
12
|
+
import "@modelcontextprotocol/sdk/client/sse.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 "@modelcontextprotocol/sdk/shared/protocol.js";
|
|
17
|
+
import "ai";
|
|
5
18
|
|
|
6
19
|
/**
|
|
7
20
|
* RPC request message from client
|
|
8
21
|
*/
|
|
9
22
|
type RPCRequest = {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
23
|
+
type: "rpc";
|
|
24
|
+
id: string;
|
|
25
|
+
method: string;
|
|
26
|
+
args: unknown[];
|
|
14
27
|
};
|
|
15
28
|
/**
|
|
16
29
|
* State update message from client
|
|
17
30
|
*/
|
|
18
31
|
type StateUpdateMessage = {
|
|
19
|
-
|
|
20
|
-
|
|
32
|
+
type: "cf_agent_state";
|
|
33
|
+
state: unknown;
|
|
21
34
|
};
|
|
22
35
|
/**
|
|
23
36
|
* RPC response message to client
|
|
24
37
|
*/
|
|
25
38
|
type RPCResponse = {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} & (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
type: "rpc";
|
|
40
|
+
id: string;
|
|
41
|
+
} & (
|
|
42
|
+
| {
|
|
43
|
+
success: true;
|
|
44
|
+
result: unknown;
|
|
45
|
+
done?: false;
|
|
46
|
+
}
|
|
47
|
+
| {
|
|
48
|
+
success: true;
|
|
49
|
+
result: unknown;
|
|
50
|
+
done: true;
|
|
51
|
+
}
|
|
52
|
+
| {
|
|
53
|
+
success: false;
|
|
54
|
+
error: string;
|
|
55
|
+
}
|
|
56
|
+
);
|
|
40
57
|
/**
|
|
41
58
|
* Metadata for a callable method
|
|
42
59
|
*/
|
|
43
60
|
type CallableMetadata = {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
61
|
+
/** Optional description of what the method does */
|
|
62
|
+
description?: string;
|
|
63
|
+
/** Whether the method supports streaming responses */
|
|
64
|
+
streaming?: boolean;
|
|
48
65
|
};
|
|
49
66
|
/**
|
|
50
67
|
* Decorator that marks a method as callable by clients
|
|
51
68
|
* @param metadata Optional metadata about the callable method
|
|
52
69
|
*/
|
|
53
|
-
declare function unstable_callable(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
70
|
+
declare function unstable_callable(
|
|
71
|
+
metadata?: CallableMetadata
|
|
72
|
+
): <This, Args extends unknown[], Return>(
|
|
73
|
+
target: (this: This, ...args: Args) => Return,
|
|
74
|
+
context: ClassMethodDecoratorContext
|
|
75
|
+
) => (this: This, ...args: Args) => Return;
|
|
59
76
|
/**
|
|
60
77
|
* Represents a scheduled task within an Agent
|
|
61
78
|
* @template T Type of the payload data
|
|
62
79
|
*/
|
|
63
80
|
type Schedule<T = string> = {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
} & (
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
81
|
+
/** Unique identifier for the schedule */
|
|
82
|
+
id: string;
|
|
83
|
+
/** Name of the method to be called */
|
|
84
|
+
callback: string;
|
|
85
|
+
/** Data to be passed to the callback */
|
|
86
|
+
payload: T;
|
|
87
|
+
} & (
|
|
88
|
+
| {
|
|
89
|
+
/** Type of schedule for one-time execution at a specific time */
|
|
90
|
+
type: "scheduled";
|
|
91
|
+
/** Timestamp when the task should execute */
|
|
92
|
+
time: number;
|
|
93
|
+
}
|
|
94
|
+
| {
|
|
95
|
+
/** Type of schedule for delayed execution */
|
|
96
|
+
type: "delayed";
|
|
97
|
+
/** Timestamp when the task should execute */
|
|
98
|
+
time: number;
|
|
99
|
+
/** Number of seconds to delay execution */
|
|
100
|
+
delayInSeconds: number;
|
|
101
|
+
}
|
|
102
|
+
| {
|
|
103
|
+
/** Type of schedule for recurring execution based on cron expression */
|
|
104
|
+
type: "cron";
|
|
105
|
+
/** Timestamp for the next execution */
|
|
106
|
+
time: number;
|
|
107
|
+
/** Cron expression defining the schedule */
|
|
108
|
+
cron: string;
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
/**
|
|
112
|
+
* MCP Server state update message from server -> Client
|
|
113
|
+
*/
|
|
114
|
+
type MCPServerMessage = {
|
|
115
|
+
type: "cf_agent_mcp_servers";
|
|
116
|
+
mcp: MCPServersState;
|
|
117
|
+
};
|
|
118
|
+
type MCPServersState = {
|
|
119
|
+
servers: {
|
|
120
|
+
[id: string]: MCPServer;
|
|
121
|
+
};
|
|
122
|
+
tools: Tool[];
|
|
123
|
+
prompts: Prompt[];
|
|
124
|
+
resources: Resource[];
|
|
125
|
+
};
|
|
126
|
+
type MCPServer = {
|
|
127
|
+
name: string;
|
|
128
|
+
server_url: string;
|
|
129
|
+
auth_url: string | null;
|
|
130
|
+
state: "authenticating" | "connecting" | "ready" | "discovering" | "failed";
|
|
131
|
+
instructions: string | null;
|
|
132
|
+
capabilities: ServerCapabilities | null;
|
|
133
|
+
};
|
|
134
|
+
declare function getCurrentAgent<
|
|
135
|
+
T extends Agent<unknown, unknown> = Agent<unknown, unknown>,
|
|
136
|
+
>(): {
|
|
137
|
+
agent: T | undefined;
|
|
138
|
+
connection: Connection | undefined;
|
|
139
|
+
request: Request<unknown, CfProperties<unknown>> | undefined;
|
|
140
|
+
};
|
|
95
141
|
/**
|
|
96
142
|
* Base class for creating Agent implementations
|
|
97
143
|
* @template Env Environment type containing bindings
|
|
98
144
|
* @template State State type to store within the Agent
|
|
99
145
|
*/
|
|
100
146
|
declare class Agent<Env, State = unknown> extends Server<Env> {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
147
|
+
private _state;
|
|
148
|
+
private _ParentClass;
|
|
149
|
+
mcp: MCPClientManager;
|
|
150
|
+
/**
|
|
151
|
+
* Initial state for the Agent
|
|
152
|
+
* Override to provide default state values
|
|
153
|
+
*/
|
|
154
|
+
initialState: State;
|
|
155
|
+
/**
|
|
156
|
+
* Current state of the Agent
|
|
157
|
+
*/
|
|
158
|
+
get state(): State;
|
|
159
|
+
/**
|
|
160
|
+
* Agent configuration options
|
|
161
|
+
*/
|
|
162
|
+
static options: {
|
|
163
|
+
/** Whether the Agent should hibernate when inactive */
|
|
164
|
+
hibernate: boolean;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* Execute SQL queries against the Agent's database
|
|
168
|
+
* @template T Type of the returned rows
|
|
169
|
+
* @param strings SQL query template strings
|
|
170
|
+
* @param values Values to be inserted into the query
|
|
171
|
+
* @returns Array of query results
|
|
172
|
+
*/
|
|
173
|
+
sql<T = Record<string, string | number | boolean | null>>(
|
|
174
|
+
strings: TemplateStringsArray,
|
|
175
|
+
...values: (string | number | boolean | null)[]
|
|
176
|
+
): T[];
|
|
177
|
+
constructor(ctx: AgentContext, env: Env);
|
|
178
|
+
private _setStateInternal;
|
|
179
|
+
/**
|
|
180
|
+
* Update the Agent's state
|
|
181
|
+
* @param state New state to set
|
|
182
|
+
*/
|
|
183
|
+
setState(state: State): void;
|
|
184
|
+
/**
|
|
185
|
+
* Called when the Agent's state is updated
|
|
186
|
+
* @param state Updated state
|
|
187
|
+
* @param source Source of the state update ("server" or a client connection)
|
|
188
|
+
*/
|
|
189
|
+
onStateUpdate(state: State | undefined, source: Connection | "server"): void;
|
|
190
|
+
/**
|
|
191
|
+
* Called when the Agent receives an email
|
|
192
|
+
* @param email Email message to process
|
|
193
|
+
*/
|
|
194
|
+
onEmail(email: ForwardableEmailMessage): Promise<void>;
|
|
195
|
+
private _tryCatch;
|
|
196
|
+
onError(connection: Connection, error: unknown): void | Promise<void>;
|
|
197
|
+
onError(error: unknown): void | Promise<void>;
|
|
198
|
+
/**
|
|
199
|
+
* Render content (not implemented in base class)
|
|
200
|
+
*/
|
|
201
|
+
render(): void;
|
|
202
|
+
/**
|
|
203
|
+
* Schedule a task to be executed in the future
|
|
204
|
+
* @template T Type of the payload data
|
|
205
|
+
* @param when When to execute the task (Date, seconds delay, or cron expression)
|
|
206
|
+
* @param callback Name of the method to call
|
|
207
|
+
* @param payload Data to pass to the callback
|
|
208
|
+
* @returns Schedule object representing the scheduled task
|
|
209
|
+
*/
|
|
210
|
+
schedule<T = string>(
|
|
211
|
+
when: Date | string | number,
|
|
212
|
+
callback: keyof this,
|
|
213
|
+
payload?: T
|
|
214
|
+
): Promise<Schedule<T>>;
|
|
215
|
+
/**
|
|
216
|
+
* Get a scheduled task by ID
|
|
217
|
+
* @template T Type of the payload data
|
|
218
|
+
* @param id ID of the scheduled task
|
|
219
|
+
* @returns The Schedule object or undefined if not found
|
|
220
|
+
*/
|
|
221
|
+
getSchedule<T = string>(id: string): Promise<Schedule<T> | undefined>;
|
|
222
|
+
/**
|
|
223
|
+
* Get scheduled tasks matching the given criteria
|
|
224
|
+
* @template T Type of the payload data
|
|
225
|
+
* @param criteria Criteria to filter schedules
|
|
226
|
+
* @returns Array of matching Schedule objects
|
|
227
|
+
*/
|
|
228
|
+
getSchedules<T = string>(criteria?: {
|
|
229
|
+
id?: string;
|
|
230
|
+
type?: "scheduled" | "delayed" | "cron";
|
|
231
|
+
timeRange?: {
|
|
232
|
+
start?: Date;
|
|
233
|
+
end?: Date;
|
|
117
234
|
};
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
235
|
+
}): Schedule<T>[];
|
|
236
|
+
/**
|
|
237
|
+
* Cancel a scheduled task
|
|
238
|
+
* @param id ID of the task to cancel
|
|
239
|
+
* @returns true if the task was cancelled, false otherwise
|
|
240
|
+
*/
|
|
241
|
+
cancelSchedule(id: string): Promise<boolean>;
|
|
242
|
+
private _scheduleNextAlarm;
|
|
243
|
+
/**
|
|
244
|
+
* Method called when an alarm fires.
|
|
245
|
+
* Executes any scheduled tasks that are due.
|
|
246
|
+
*
|
|
247
|
+
* @remarks
|
|
248
|
+
* To schedule a task, please use the `this.schedule` method instead.
|
|
249
|
+
* See {@link https://developers.cloudflare.com/agents/api-reference/schedule-tasks/}
|
|
250
|
+
*/
|
|
251
|
+
readonly alarm: () => Promise<void>;
|
|
252
|
+
/**
|
|
253
|
+
* Destroy the Agent, removing all state and scheduled tasks
|
|
254
|
+
*/
|
|
255
|
+
destroy(): Promise<void>;
|
|
256
|
+
/**
|
|
257
|
+
* Get all methods marked as callable on this Agent
|
|
258
|
+
* @returns A map of method names to their metadata
|
|
259
|
+
*/
|
|
260
|
+
private _isCallable;
|
|
261
|
+
/**
|
|
262
|
+
* Connect to a new MCP Server
|
|
263
|
+
*
|
|
264
|
+
* @param url MCP Server SSE URL
|
|
265
|
+
* @param callbackHost Base host for the agent, used for the redirect URI.
|
|
266
|
+
* @param agentsPrefix agents routing prefix if not using `agents`
|
|
267
|
+
* @param options MCP client and transport (header) options
|
|
268
|
+
* @returns authUrl
|
|
269
|
+
*/
|
|
270
|
+
addMcpServer(
|
|
271
|
+
serverName: string,
|
|
272
|
+
url: string,
|
|
273
|
+
callbackHost: string,
|
|
274
|
+
agentsPrefix?: string,
|
|
275
|
+
options?: {
|
|
276
|
+
client?: ConstructorParameters<typeof Client>[1];
|
|
277
|
+
transport?: {
|
|
278
|
+
headers: HeadersInit;
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
): Promise<{
|
|
282
|
+
id: string;
|
|
283
|
+
authUrl: string | undefined;
|
|
284
|
+
}>;
|
|
285
|
+
_connectToMcpServerInternal(
|
|
286
|
+
serverName: string,
|
|
287
|
+
url: string,
|
|
288
|
+
callbackUrl: string,
|
|
289
|
+
options?: {
|
|
290
|
+
client?: ConstructorParameters<typeof Client>[1];
|
|
291
|
+
/**
|
|
292
|
+
* We don't expose the normal set of transport options because:
|
|
293
|
+
* 1) we can't serialize things like the auth provider or a fetch function into the DB for reconnection purposes
|
|
294
|
+
* 2) We probably want these options to be agnostic to the transport type (SSE vs Streamable)
|
|
295
|
+
*
|
|
296
|
+
* This has the limitation that you can't override fetch, but I think headers should handle nearly all cases needed (i.e. non-standard bearer auth).
|
|
297
|
+
*/
|
|
298
|
+
transport?: {
|
|
299
|
+
headers?: HeadersInit;
|
|
300
|
+
};
|
|
301
|
+
},
|
|
302
|
+
reconnect?: {
|
|
303
|
+
id: string;
|
|
304
|
+
oauthClientId?: string;
|
|
305
|
+
}
|
|
306
|
+
): Promise<{
|
|
307
|
+
id: string;
|
|
308
|
+
authUrl: string | undefined;
|
|
309
|
+
}>;
|
|
310
|
+
removeMcpServer(id: string): Promise<void>;
|
|
311
|
+
getMcpServers(): MCPServersState;
|
|
194
312
|
}
|
|
195
313
|
/**
|
|
196
314
|
* Namespace for creating Agent instances
|
|
197
315
|
* @template Agentic Type of the Agent class
|
|
198
316
|
*/
|
|
199
|
-
type AgentNamespace<Agentic extends Agent<unknown>> =
|
|
317
|
+
type AgentNamespace<Agentic extends Agent<unknown>> =
|
|
318
|
+
DurableObjectNamespace<Agentic>;
|
|
200
319
|
/**
|
|
201
320
|
* Agent's durable context
|
|
202
321
|
*/
|
|
@@ -205,10 +324,10 @@ type AgentContext = DurableObjectState;
|
|
|
205
324
|
* Configuration options for Agent routing
|
|
206
325
|
*/
|
|
207
326
|
type AgentOptions<Env> = PartyServerOptions<Env> & {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
327
|
+
/**
|
|
328
|
+
* Whether to enable CORS for the Agent
|
|
329
|
+
*/
|
|
330
|
+
cors?: boolean | HeadersInit | undefined;
|
|
212
331
|
};
|
|
213
332
|
/**
|
|
214
333
|
* Route a request to the appropriate Agent
|
|
@@ -217,14 +336,22 @@ type AgentOptions<Env> = PartyServerOptions<Env> & {
|
|
|
217
336
|
* @param options Routing options
|
|
218
337
|
* @returns Response from the Agent or undefined if no route matched
|
|
219
338
|
*/
|
|
220
|
-
declare function routeAgentRequest<Env>(
|
|
339
|
+
declare function routeAgentRequest<Env>(
|
|
340
|
+
request: Request,
|
|
341
|
+
env: Env,
|
|
342
|
+
options?: AgentOptions<Env>
|
|
343
|
+
): Promise<Response | null>;
|
|
221
344
|
/**
|
|
222
345
|
* Route an email to the appropriate Agent
|
|
223
346
|
* @param email Email message to route
|
|
224
347
|
* @param env Environment containing Agent bindings
|
|
225
348
|
* @param options Routing options
|
|
226
349
|
*/
|
|
227
|
-
declare function routeAgentEmail<Env>(
|
|
350
|
+
declare function routeAgentEmail<Env>(
|
|
351
|
+
email: ForwardableEmailMessage,
|
|
352
|
+
env: Env,
|
|
353
|
+
options?: AgentOptions<Env>
|
|
354
|
+
): Promise<void>;
|
|
228
355
|
/**
|
|
229
356
|
* Get or create an Agent by name
|
|
230
357
|
* @template Env Environment type containing bindings
|
|
@@ -234,26 +361,51 @@ declare function routeAgentEmail<Env>(email: ForwardableEmailMessage, env: Env,
|
|
|
234
361
|
* @param options Options for Agent creation
|
|
235
362
|
* @returns Promise resolving to an Agent instance stub
|
|
236
363
|
*/
|
|
237
|
-
declare function getAgentByName<Env, T extends Agent<Env>>(
|
|
364
|
+
declare function getAgentByName<Env, T extends Agent<Env>>(
|
|
365
|
+
namespace: AgentNamespace<T>,
|
|
366
|
+
name: string,
|
|
367
|
+
options?: {
|
|
238
368
|
jurisdiction?: DurableObjectJurisdiction;
|
|
239
369
|
locationHint?: DurableObjectLocationHint;
|
|
240
|
-
}
|
|
370
|
+
}
|
|
371
|
+
): Promise<DurableObjectStub<T>>;
|
|
241
372
|
/**
|
|
242
373
|
* A wrapper for streaming responses in callable methods
|
|
243
374
|
*/
|
|
244
375
|
declare class StreamingResponse {
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
376
|
+
private _connection;
|
|
377
|
+
private _id;
|
|
378
|
+
private _closed;
|
|
379
|
+
constructor(connection: Connection, id: string);
|
|
380
|
+
/**
|
|
381
|
+
* Send a chunk of data to the client
|
|
382
|
+
* @param chunk The data to send
|
|
383
|
+
*/
|
|
384
|
+
send(chunk: unknown): void;
|
|
385
|
+
/**
|
|
386
|
+
* End the stream and send the final chunk (if any)
|
|
387
|
+
* @param finalChunk Optional final chunk of data to send
|
|
388
|
+
*/
|
|
389
|
+
end(finalChunk?: unknown): void;
|
|
257
390
|
}
|
|
258
391
|
|
|
259
|
-
export {
|
|
392
|
+
export {
|
|
393
|
+
Agent,
|
|
394
|
+
type AgentContext,
|
|
395
|
+
type AgentNamespace,
|
|
396
|
+
type AgentOptions,
|
|
397
|
+
type CallableMetadata,
|
|
398
|
+
type MCPServer,
|
|
399
|
+
type MCPServerMessage,
|
|
400
|
+
type MCPServersState,
|
|
401
|
+
type RPCRequest,
|
|
402
|
+
type RPCResponse,
|
|
403
|
+
type Schedule,
|
|
404
|
+
type StateUpdateMessage,
|
|
405
|
+
StreamingResponse,
|
|
406
|
+
getAgentByName,
|
|
407
|
+
getCurrentAgent,
|
|
408
|
+
routeAgentEmail,
|
|
409
|
+
routeAgentRequest,
|
|
410
|
+
unstable_callable,
|
|
411
|
+
};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Agent,
|
|
3
|
+
StreamingResponse,
|
|
4
|
+
getAgentByName,
|
|
5
|
+
getCurrentAgent,
|
|
6
|
+
routeAgentEmail,
|
|
7
|
+
routeAgentRequest,
|
|
8
|
+
unstable_callable
|
|
9
|
+
} from "./chunk-6RPGDIE2.js";
|
|
10
|
+
import "./chunk-OYJXQRRH.js";
|
|
11
|
+
import "./chunk-BZXOAZUX.js";
|
|
12
|
+
import "./chunk-VCSB47AK.js";
|
|
13
|
+
export {
|
|
14
|
+
Agent,
|
|
15
|
+
StreamingResponse,
|
|
16
|
+
getAgentByName,
|
|
17
|
+
getCurrentAgent,
|
|
18
|
+
routeAgentEmail,
|
|
19
|
+
routeAgentRequest,
|
|
20
|
+
unstable_callable
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|