agents 0.7.7 → 0.7.9
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/experimental/forever.d.ts +1 -1
- package/dist/{index-DBW341gU.d.ts → index-B6xYRT3K.d.ts} +21 -3
- package/dist/{index-BS_jL8MI.d.ts → index-D9AuAMOt.d.ts} +2 -96
- package/dist/index.d.ts +1 -1
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/client.d.ts +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/observability/index.d.ts +1 -1
- package/dist/observability/index.js +1 -3
- package/dist/observability/index.js.map +1 -1
- package/dist/react.d.ts +1 -1
- package/dist/workflows.d.ts +1 -1
- package/package.json +2 -12
- package/dist/experimental/workspace.d.ts +0 -273
- package/dist/experimental/workspace.js +0 -1265
- package/dist/experimental/workspace.js.map +0 -1
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
n as Observability,
|
|
6
6
|
r as ObservabilityEvent,
|
|
7
7
|
s as MCPObservabilityEvent
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-D9AuAMOt.js";
|
|
9
9
|
import { t as AgentMcpOAuthProvider } from "./do-oauth-client-provider-C2jurFjW.js";
|
|
10
10
|
import {
|
|
11
11
|
_ as WorkflowPage,
|
|
@@ -707,7 +707,7 @@ declare class MCPClientConnection {
|
|
|
707
707
|
*/
|
|
708
708
|
getTransport(
|
|
709
709
|
transportType: BaseTransportType
|
|
710
|
-
):
|
|
710
|
+
): RPCClientTransport | SSEClientTransport | StreamableHTTPClientTransport;
|
|
711
711
|
private tryConnect;
|
|
712
712
|
private _capabilityErrorHandler;
|
|
713
713
|
}
|
|
@@ -1672,6 +1672,24 @@ declare class Agent<
|
|
|
1672
1672
|
* Override to provide default state values
|
|
1673
1673
|
*/
|
|
1674
1674
|
initialState: State;
|
|
1675
|
+
/**
|
|
1676
|
+
* Stable key for Workers AI session affinity (prefix-cache optimization).
|
|
1677
|
+
*
|
|
1678
|
+
* Uses the Durable Object ID, which is globally unique across all agent
|
|
1679
|
+
* classes and stable for the lifetime of the instance. Pass this value as
|
|
1680
|
+
* the `sessionAffinity` option when creating a Workers AI model so that
|
|
1681
|
+
* requests from the same agent instance are routed to the same backend
|
|
1682
|
+
* replica, improving KV-prefix-cache hit rates across conversation turns.
|
|
1683
|
+
*
|
|
1684
|
+
* @example
|
|
1685
|
+
* ```typescript
|
|
1686
|
+
* const workersai = createWorkersAI({ binding: this.env.AI });
|
|
1687
|
+
* const model = workersai("@cf/meta/llama-3.3-70b-instruct-fp8-fast", {
|
|
1688
|
+
* sessionAffinity: this.sessionAffinity,
|
|
1689
|
+
* });
|
|
1690
|
+
* ```
|
|
1691
|
+
*/
|
|
1692
|
+
get sessionAffinity(): string;
|
|
1675
1693
|
/**
|
|
1676
1694
|
* Current state of the Agent
|
|
1677
1695
|
*/
|
|
@@ -2837,4 +2855,4 @@ export {
|
|
|
2837
2855
|
Schedule as y,
|
|
2838
2856
|
MCPServerOptions as z
|
|
2839
2857
|
};
|
|
2840
|
-
//# sourceMappingURL=index-
|
|
2858
|
+
//# sourceMappingURL=index-B6xYRT3K.d.ts.map
|
|
@@ -271,98 +271,11 @@ type AgentObservabilityEvent =
|
|
|
271
271
|
}
|
|
272
272
|
>;
|
|
273
273
|
//#endregion
|
|
274
|
-
//#region src/observability/workspace.d.ts
|
|
275
|
-
/**
|
|
276
|
-
* Workspace-specific observability events.
|
|
277
|
-
* These track file operations, directory changes, and bash execution
|
|
278
|
-
* within a Workspace instance.
|
|
279
|
-
*/
|
|
280
|
-
type WorkspaceObservabilityEvent =
|
|
281
|
-
| BaseEvent<
|
|
282
|
-
"workspace:read",
|
|
283
|
-
{
|
|
284
|
-
namespace: string;
|
|
285
|
-
path: string;
|
|
286
|
-
storage: "inline" | "r2";
|
|
287
|
-
}
|
|
288
|
-
>
|
|
289
|
-
| BaseEvent<
|
|
290
|
-
"workspace:write",
|
|
291
|
-
{
|
|
292
|
-
namespace: string;
|
|
293
|
-
path: string;
|
|
294
|
-
size: number;
|
|
295
|
-
storage: "inline" | "r2";
|
|
296
|
-
update: boolean;
|
|
297
|
-
}
|
|
298
|
-
>
|
|
299
|
-
| BaseEvent<
|
|
300
|
-
"workspace:delete",
|
|
301
|
-
{
|
|
302
|
-
namespace: string;
|
|
303
|
-
path: string;
|
|
304
|
-
}
|
|
305
|
-
>
|
|
306
|
-
| BaseEvent<
|
|
307
|
-
"workspace:mkdir",
|
|
308
|
-
{
|
|
309
|
-
namespace: string;
|
|
310
|
-
path: string;
|
|
311
|
-
recursive: boolean;
|
|
312
|
-
}
|
|
313
|
-
>
|
|
314
|
-
| BaseEvent<
|
|
315
|
-
"workspace:rm",
|
|
316
|
-
{
|
|
317
|
-
namespace: string;
|
|
318
|
-
path: string;
|
|
319
|
-
recursive: boolean;
|
|
320
|
-
}
|
|
321
|
-
>
|
|
322
|
-
| BaseEvent<
|
|
323
|
-
"workspace:cp",
|
|
324
|
-
{
|
|
325
|
-
namespace: string;
|
|
326
|
-
src: string;
|
|
327
|
-
dest: string;
|
|
328
|
-
recursive: boolean;
|
|
329
|
-
}
|
|
330
|
-
>
|
|
331
|
-
| BaseEvent<
|
|
332
|
-
"workspace:mv",
|
|
333
|
-
{
|
|
334
|
-
namespace: string;
|
|
335
|
-
src: string;
|
|
336
|
-
dest: string;
|
|
337
|
-
}
|
|
338
|
-
>
|
|
339
|
-
| BaseEvent<
|
|
340
|
-
"workspace:bash",
|
|
341
|
-
{
|
|
342
|
-
namespace: string;
|
|
343
|
-
command: string;
|
|
344
|
-
exitCode: number;
|
|
345
|
-
durationMs: number;
|
|
346
|
-
}
|
|
347
|
-
>
|
|
348
|
-
| BaseEvent<
|
|
349
|
-
"workspace:error",
|
|
350
|
-
{
|
|
351
|
-
namespace: string;
|
|
352
|
-
operation: string;
|
|
353
|
-
path: string;
|
|
354
|
-
error: string;
|
|
355
|
-
}
|
|
356
|
-
>;
|
|
357
|
-
//#endregion
|
|
358
274
|
//#region src/observability/index.d.ts
|
|
359
275
|
/**
|
|
360
276
|
* Union of all observability event types from different domains
|
|
361
277
|
*/
|
|
362
|
-
type ObservabilityEvent =
|
|
363
|
-
| AgentObservabilityEvent
|
|
364
|
-
| MCPObservabilityEvent
|
|
365
|
-
| WorkspaceObservabilityEvent;
|
|
278
|
+
type ObservabilityEvent = AgentObservabilityEvent | MCPObservabilityEvent;
|
|
366
279
|
interface Observability {
|
|
367
280
|
/**
|
|
368
281
|
* Emit an event for the Agent's observability implementation to handle.
|
|
@@ -394,7 +307,6 @@ declare const channels: {
|
|
|
394
307
|
readonly workflow: Channel<unknown, unknown>;
|
|
395
308
|
readonly mcp: Channel<unknown, unknown>;
|
|
396
309
|
readonly email: Channel<unknown, unknown>;
|
|
397
|
-
readonly workspace: Channel<unknown, unknown>;
|
|
398
310
|
};
|
|
399
311
|
/**
|
|
400
312
|
* The default observability implementation.
|
|
@@ -455,12 +367,6 @@ type ChannelEventMap = {
|
|
|
455
367
|
type: `email:${string}`;
|
|
456
368
|
}
|
|
457
369
|
>;
|
|
458
|
-
workspace: Extract<
|
|
459
|
-
ObservabilityEvent,
|
|
460
|
-
{
|
|
461
|
-
type: `workspace:${string}`;
|
|
462
|
-
}
|
|
463
|
-
>;
|
|
464
370
|
};
|
|
465
371
|
/**
|
|
466
372
|
* Subscribe to a typed observability channel.
|
|
@@ -489,4 +395,4 @@ export {
|
|
|
489
395
|
MCPObservabilityEvent as s,
|
|
490
396
|
ChannelEventMap as t
|
|
491
397
|
};
|
|
492
|
-
//# sourceMappingURL=index-
|
|
398
|
+
//# sourceMappingURL=index-D9AuAMOt.d.ts.map
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -212,6 +212,26 @@ function withAgentContext(method) {
|
|
|
212
212
|
* @template State State type to store within the Agent
|
|
213
213
|
*/
|
|
214
214
|
var Agent = class Agent extends Server {
|
|
215
|
+
/**
|
|
216
|
+
* Stable key for Workers AI session affinity (prefix-cache optimization).
|
|
217
|
+
*
|
|
218
|
+
* Uses the Durable Object ID, which is globally unique across all agent
|
|
219
|
+
* classes and stable for the lifetime of the instance. Pass this value as
|
|
220
|
+
* the `sessionAffinity` option when creating a Workers AI model so that
|
|
221
|
+
* requests from the same agent instance are routed to the same backend
|
|
222
|
+
* replica, improving KV-prefix-cache hit rates across conversation turns.
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```typescript
|
|
226
|
+
* const workersai = createWorkersAI({ binding: this.env.AI });
|
|
227
|
+
* const model = workersai("@cf/meta/llama-3.3-70b-instruct-fp8-fast", {
|
|
228
|
+
* sessionAffinity: this.sessionAffinity,
|
|
229
|
+
* });
|
|
230
|
+
* ```
|
|
231
|
+
*/
|
|
232
|
+
get sessionAffinity() {
|
|
233
|
+
return this.ctx.id.toString();
|
|
234
|
+
}
|
|
215
235
|
/**
|
|
216
236
|
* Current state of the Agent
|
|
217
237
|
*/
|