agents 0.22.0 → 0.23.0
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 +20 -1
- package/dist/{agent-routing-CnkaHb-v.d.ts → agent-routing-DE5zmCQ8.d.ts} +1038 -394
- package/dist/agent-routing.d.ts +1 -1
- package/dist/agent-tool-types.d.ts +26 -26
- package/dist/{agent-tools-C0XJqWzB.d.ts → agent-tools-DtXMTDGM.d.ts} +7 -7
- package/dist/agent-tools.d.ts +21 -21
- package/dist/browser/ai.js +4 -1
- package/dist/browser/ai.js.map +1 -1
- package/dist/browser/tanstack-ai.js.map +1 -1
- package/dist/callable-decorator-DP__HhBA.d.ts +72 -0
- package/dist/callable-decorator.d.ts +18 -0
- package/dist/callable-decorator.js +71 -0
- package/dist/callable-decorator.js.map +1 -0
- package/dist/capability-BjSKYpzg.js.map +1 -1
- package/dist/capability-runner-Be_-PLR1.d.ts +459 -0
- package/dist/channel-Bnm4S7T2.d.ts +491 -0
- package/dist/channels/ai-sdk.d.ts +46 -0
- package/dist/channels/ai-sdk.js +120 -0
- package/dist/channels/ai-sdk.js.map +1 -0
- package/dist/channels/email.d.ts +95 -0
- package/dist/channels/email.js +323 -0
- package/dist/channels/email.js.map +1 -0
- package/dist/channels/index.d.ts +233 -0
- package/dist/channels/index.js +608 -0
- package/dist/channels/index.js.map +1 -0
- package/dist/channels/slack.d.ts +140 -0
- package/dist/channels/slack.js +614 -0
- package/dist/channels/slack.js.map +1 -0
- package/dist/channels/tanstack-ai.d.ts +39 -0
- package/dist/channels/tanstack-ai.js +17 -0
- package/dist/channels/tanstack-ai.js.map +1 -0
- package/dist/channels/telegram.d.ts +106 -0
- package/dist/channels/telegram.js +427 -0
- package/dist/channels/telegram.js.map +1 -0
- package/dist/channels/voice.d.ts +45 -0
- package/dist/channels/voice.js +122 -0
- package/dist/channels/voice.js.map +1 -0
- package/dist/chat/index.d.ts +2325 -2019
- package/dist/chat/index.js +888 -518
- package/dist/chat/index.js.map +1 -1
- package/dist/chat-sdk/index.d.ts +7 -7
- package/dist/chat-sdk/index.js +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/context/index.d.ts +216 -0
- package/dist/context/index.js +454 -0
- package/dist/context/index.js.map +1 -0
- package/dist/{current-agent-CuMErtly.d.ts → current-agent-Da_C9a3b.d.ts} +90 -107
- package/dist/current-agent-DhoDkSnH.js.map +1 -1
- package/dist/{diagnostics-CaBjfz4J.js → diagnostics-BzvaX2UT.js} +5 -1
- package/dist/diagnostics-BzvaX2UT.js.map +1 -0
- package/dist/diagnostics-C4jcz3VK.js +360 -0
- package/dist/diagnostics-C4jcz3VK.js.map +1 -0
- package/dist/index-BB0kqhIz.d.ts +101 -0
- package/dist/index-BVVgDSdq.d.ts +1 -0
- package/dist/index-XDkuQ7zm.d.ts +89 -0
- package/dist/{index-DcSAZKsB.d.ts → index-YSKgfgg9.d.ts} +3 -1
- package/dist/index.d.ts +91 -82
- package/dist/index.js +3 -2
- package/dist/ingress-BfetZbMO.js +83 -0
- package/dist/ingress-BfetZbMO.js.map +1 -0
- package/dist/internal-CYlgHl1l.js +59 -0
- package/dist/internal-CYlgHl1l.js.map +1 -0
- package/dist/internal_context.d.ts +1 -1
- package/dist/lifecycle/index.d.ts +35 -17
- package/dist/lifecycle/index.js +1 -1
- package/dist/lifecycle-CMRGjZdw.js +1299 -0
- package/dist/lifecycle-CMRGjZdw.js.map +1 -0
- package/dist/mcp/client/index.d.ts +20 -20
- package/dist/mcp/index.d.ts +35 -35
- package/dist/mcp/index.js +1 -1
- package/dist/observability/index.d.ts +1 -1
- package/dist/observability/index.js +1 -1
- package/dist/react.d.ts +4 -4
- package/dist/{retries-CAvxtG9d.d.ts → retries-D9Ds-1lz.d.ts} +17 -6
- package/dist/retries.d.ts +8 -6
- package/dist/retries.js +13 -1
- package/dist/retries.js.map +1 -1
- package/dist/routing/index.d.ts +137 -0
- package/dist/routing/index.js +244 -0
- package/dist/routing/index.js.map +1 -0
- package/dist/sanitize-D9TujEK8.js +79 -0
- package/dist/sanitize-D9TujEK8.js.map +1 -0
- package/dist/scheduler-DD9NdYbF.js +665 -0
- package/dist/scheduler-DD9NdYbF.js.map +1 -0
- package/dist/{scheduler-DQoTGoAW.d.ts → scheduler-Dwh85ZGl.d.ts} +21 -22
- package/dist/schedules/index.d.ts +1 -1
- package/dist/schedules/index.js +1 -1
- package/dist/sentence-chunker-BAidJ4DA.d.ts +68 -0
- package/dist/serializable.d.ts +1 -1
- package/dist/sessions/index.d.ts +441 -0
- package/dist/sessions/index.js +2063 -0
- package/dist/sessions/index.js.map +1 -0
- package/dist/skills/index.d.ts +99 -0
- package/dist/skills/index.js +254 -5
- package/dist/skills/index.js.map +1 -1
- package/dist/{src-5W6JNKVb.js → src-DlSHshb2.js} +1460 -1110
- package/dist/src-DlSHshb2.js.map +1 -0
- package/dist/streams/index.d.ts +120 -0
- package/dist/streams/index.js +107 -0
- package/dist/streams/index.js.map +1 -0
- package/dist/streams-D6tJ0NN9.d.ts +370 -0
- package/dist/streams-DZKgAj9b.js +709 -0
- package/dist/streams-DZKgAj9b.js.map +1 -0
- package/dist/sub-routing.d.ts +12 -12
- package/dist/surface-bZZJqBka.js +17 -0
- package/dist/surface-bZZJqBka.js.map +1 -0
- package/dist/tasks/index.d.ts +64 -0
- package/dist/tasks/index.js +2 -0
- package/dist/tasks-BRJ5zgya.d.ts +517 -0
- package/dist/tasks-ylZgBjhj.js +1656 -0
- package/dist/tasks-ylZgBjhj.js.map +1 -0
- package/dist/text-segment-joiner-BtAFQSA_.js +57 -0
- package/dist/text-segment-joiner-BtAFQSA_.js.map +1 -0
- package/dist/text-stream-CpdiKrJB.js +272 -0
- package/dist/text-stream-CpdiKrJB.js.map +1 -0
- package/dist/tokens-nHAKcN6M.js +52 -0
- package/dist/tokens-nHAKcN6M.js.map +1 -0
- package/dist/tool-schema-CBjGPrsQ.js +31 -0
- package/dist/tool-schema-CBjGPrsQ.js.map +1 -0
- package/dist/types-B7LojTe4.d.ts +202 -0
- package/dist/types-_Faxb570.d.ts +439 -0
- package/dist/voice/client.d.ts +226 -0
- package/dist/voice/client.js +932 -0
- package/dist/voice/client.js.map +1 -0
- package/dist/voice/errors.d.ts +43 -0
- package/dist/voice/errors.js +41 -0
- package/dist/voice/errors.js.map +1 -0
- package/dist/voice/index.d.ts +271 -0
- package/dist/voice/index.js +1812 -0
- package/dist/voice/index.js.map +1 -0
- package/dist/voice/react.d.ts +167 -0
- package/dist/voice/react.js +234 -0
- package/dist/voice/react.js.map +1 -0
- package/dist/voice/sfu.d.ts +71 -0
- package/dist/voice/sfu.js +157 -0
- package/dist/voice/sfu.js.map +1 -0
- package/dist/voice/text.d.ts +6 -0
- package/dist/voice/text.js +2 -0
- package/dist/voice/types.d.ts +58 -0
- package/dist/voice/types.js +18 -0
- package/dist/voice/types.js.map +1 -0
- package/dist/voice/workers-ai.d.ts +136 -0
- package/dist/voice/workers-ai.js +568 -0
- package/dist/voice/workers-ai.js.map +1 -0
- package/dist/websockets/index.d.ts +192 -0
- package/dist/websockets/index.js +2 -0
- package/dist/websockets-DUfRHPRq.js +502 -0
- package/dist/websockets-DUfRHPRq.js.map +1 -0
- package/dist/workflow-types.d.ts +25 -25
- package/dist/workflows.d.ts +21 -21
- package/dist/workflows.js +1 -1
- package/docs/agent-class.md +2 -2
- package/docs/agent-tools.md +2 -1
- package/docs/channels.md +323 -0
- package/docs/chat-agents.md +6 -13
- package/docs/context.md +131 -0
- package/docs/index.md +15 -12
- package/docs/lifecycle.md +102 -55
- package/docs/long-running-agents.md +2 -2
- package/docs/mcp-servers.md +5 -1
- package/docs/resumable-streaming.md +1 -1
- package/docs/routing.md +105 -0
- package/docs/sessions.md +237 -871
- package/docs/streams.md +213 -0
- package/docs/sub-agents.md +184 -124
- package/docs/tasks.md +246 -0
- package/docs/voice.md +745 -0
- package/package.json +115 -13
- package/dist/capability-runner-CvHGZqUu.d.ts +0 -150
- package/dist/compaction-helpers-iiKMr2TQ.js +0 -340
- package/dist/compaction-helpers-iiKMr2TQ.js.map +0 -1
- package/dist/compaction-helpers-wUz6M3us.d.ts +0 -621
- package/dist/diagnostics-CaBjfz4J.js.map +0 -1
- package/dist/durable-object-lifecycle-D6nNQJJd.js +0 -862
- package/dist/durable-object-lifecycle-D6nNQJJd.js.map +0 -1
- package/dist/experimental/memory/session/index.d.ts +0 -671
- package/dist/experimental/memory/session/index.js +0 -2379
- package/dist/experimental/memory/session/index.js.map +0 -1
- package/dist/experimental/memory/utils/index.d.ts +0 -96
- package/dist/experimental/memory/utils/index.js +0 -79
- package/dist/experimental/memory/utils/index.js.map +0 -1
- package/dist/scheduler-CR9RHGos.js +0 -857
- package/dist/scheduler-CR9RHGos.js.map +0 -1
- package/dist/src-5W6JNKVb.js.map +0 -1
- package/dist/tool-output-truncation-CNnnGZQ3.js +0 -98
- package/dist/tool-output-truncation-CNnnGZQ3.js.map +0 -1
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
_ as LifecycleJobOutcome,
|
|
3
|
+
b as Connection,
|
|
4
|
+
g as LifecycleJobContext,
|
|
5
|
+
o as MemoryLimitContext,
|
|
4
6
|
s as LifecycleCapability,
|
|
5
|
-
t as
|
|
6
|
-
|
|
7
|
+
t as CapabilityRequestContext,
|
|
8
|
+
u as LifecycleRouteAddress,
|
|
9
|
+
w as WSMessage,
|
|
10
|
+
x as ConnectionContext
|
|
11
|
+
} from "./capability-runner-Be_-PLR1.js";
|
|
12
|
+
import { t as RetryOptions } from "./retries-D9Ds-1lz.js";
|
|
7
13
|
import {
|
|
8
|
-
c as
|
|
9
|
-
l as Connection,
|
|
14
|
+
c as LifecycleRouteEnvelope,
|
|
10
15
|
n as CurrentAgentContext,
|
|
11
|
-
o as Lifecycle
|
|
12
|
-
|
|
13
|
-
u as ConnectionContext
|
|
14
|
-
} from "./current-agent-CuMErtly.js";
|
|
16
|
+
o as Lifecycle
|
|
17
|
+
} from "./current-agent-Da_C9a3b.js";
|
|
15
18
|
import { t as AgentEmail } from "./internal_context-BlxFEWfn.js";
|
|
16
19
|
import { r as EmailResolver, s as SendEmailOptions } from "./email-7TatiTnl.js";
|
|
17
|
-
import { t as RetryOptions } from "./retries-CAvxtG9d.js";
|
|
18
20
|
import {
|
|
19
21
|
n as Observability,
|
|
20
22
|
r as ObservabilityEvent,
|
|
21
23
|
s as MCPObservabilityEvent
|
|
22
|
-
} from "./index-
|
|
24
|
+
} from "./index-YSKgfgg9.js";
|
|
23
25
|
import { t as AgentMcpOAuthProvider } from "./do-oauth-client-provider-Tmf1vgKz.js";
|
|
24
26
|
import {
|
|
25
27
|
a as McpAuthContext,
|
|
@@ -37,8 +39,12 @@ import { t as MessageType } from "./types-6Zo2zfoO.js";
|
|
|
37
39
|
import {
|
|
38
40
|
a as ScheduleCriteria,
|
|
39
41
|
i as Schedule,
|
|
42
|
+
o as ScheduleOptions,
|
|
40
43
|
t as Scheduler
|
|
41
|
-
} from "./scheduler-
|
|
44
|
+
} from "./scheduler-Dwh85ZGl.js";
|
|
45
|
+
import { l as TaskHandlers, r as Tasks } from "./tasks-BRJ5zgya.js";
|
|
46
|
+
import { t as CallableMetadata } from "./callable-decorator-DP__HhBA.js";
|
|
47
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
42
48
|
import {
|
|
43
49
|
DurableObject,
|
|
44
50
|
RpcTarget,
|
|
@@ -286,9 +292,731 @@ declare function routeSubAgentRequest(
|
|
|
286
292
|
*/
|
|
287
293
|
declare function getSubAgentByName<T extends Agent>(
|
|
288
294
|
parent: unknown,
|
|
289
|
-
cls:
|
|
295
|
+
cls: DynamicAgentClass<T>,
|
|
290
296
|
name: string
|
|
291
|
-
): Promise<
|
|
297
|
+
): Promise<DynamicAgentStub<T>>;
|
|
298
|
+
//#endregion
|
|
299
|
+
//#region src/dynamic-agents/types.d.ts
|
|
300
|
+
type DynamicAgentConnectionMeta = {
|
|
301
|
+
id: string;
|
|
302
|
+
uri: string | null;
|
|
303
|
+
tags: string[];
|
|
304
|
+
state: unknown;
|
|
305
|
+
requestHeaders?: [string, string][];
|
|
306
|
+
};
|
|
307
|
+
type DynamicAgentConnectionBridgeLike = {
|
|
308
|
+
send(message: string | ArrayBuffer | ArrayBufferView): void | Promise<void>;
|
|
309
|
+
close(code?: number, reason?: string): void | Promise<void>;
|
|
310
|
+
setState(state: unknown): unknown | Promise<unknown>;
|
|
311
|
+
broadcast(
|
|
312
|
+
ownerPath: ReadonlyArray<{
|
|
313
|
+
className: string;
|
|
314
|
+
name: string;
|
|
315
|
+
}>,
|
|
316
|
+
message: string | ArrayBuffer | ArrayBufferView,
|
|
317
|
+
without?: string[]
|
|
318
|
+
): void | Promise<void>;
|
|
319
|
+
};
|
|
320
|
+
type DynamicAgentConnectionOperationName = "send" | "setState" | "close";
|
|
321
|
+
/**
|
|
322
|
+
* Constructor type for a dynamic agent (facet-backed child) class.
|
|
323
|
+
* Used by {@link Agent.dynamicAgents} to reference the child class
|
|
324
|
+
* via `ctx.exports`.
|
|
325
|
+
*
|
|
326
|
+
* The class name (`cls.name`) must match the export name in the
|
|
327
|
+
* worker entry point — re-exports under a different name
|
|
328
|
+
* (e.g. `export { Foo as Bar }`) are not supported.
|
|
329
|
+
*/
|
|
330
|
+
type DynamicAgentClass<T extends Agent = Agent> = {
|
|
331
|
+
new (ctx: DurableObjectState, env: never): T;
|
|
332
|
+
};
|
|
333
|
+
/**
|
|
334
|
+
* Wraps `T` in a `Promise` unless it already is one.
|
|
335
|
+
*/
|
|
336
|
+
type Promisify<T> = T extends Promise<unknown> ? T : Promise<T>;
|
|
337
|
+
/**
|
|
338
|
+
* A typed RPC stub for a dynamic agent. Exposes all public instance
|
|
339
|
+
* methods as callable RPC methods with Promise-wrapped return types.
|
|
340
|
+
*
|
|
341
|
+
* Methods owned by `Agent`, its lifecycle, or `DurableObject` internals
|
|
342
|
+
* are excluded — only user-defined methods on the subclass are exposed.
|
|
343
|
+
*/
|
|
344
|
+
type DynamicAgentStub<T extends Agent> = {
|
|
345
|
+
[K in keyof T as K extends keyof Agent
|
|
346
|
+
? never
|
|
347
|
+
: T[K] extends (...args: never[]) => unknown
|
|
348
|
+
? K
|
|
349
|
+
: never]: T[K] extends (...args: infer A) => infer R
|
|
350
|
+
? (...args: A) => Promisify<R>
|
|
351
|
+
: never;
|
|
352
|
+
};
|
|
353
|
+
type FacetRunStorageRow = {
|
|
354
|
+
owner_path: string;
|
|
355
|
+
owner_path_key: string;
|
|
356
|
+
run_id: string;
|
|
357
|
+
created_at: number;
|
|
358
|
+
};
|
|
359
|
+
/**
|
|
360
|
+
* Internal RPC surface exposed by the root agent for facets to
|
|
361
|
+
* delegate alarm-owning operations (schedules + facet teardown).
|
|
362
|
+
* @internal
|
|
363
|
+
*/
|
|
364
|
+
type RootFacetRpcSurface = {
|
|
365
|
+
_cf_routeLifecycle(
|
|
366
|
+
target: LifecycleRouteAddress | undefined,
|
|
367
|
+
envelope: LifecycleRouteEnvelope
|
|
368
|
+
): Promise<unknown>;
|
|
369
|
+
_cf_cleanupFacetPrefix(
|
|
370
|
+
ownerPath: ReadonlyArray<AgentPathStep>
|
|
371
|
+
): Promise<void>;
|
|
372
|
+
_cf_destroyDescendantFacet(
|
|
373
|
+
targetPath: ReadonlyArray<AgentPathStep>
|
|
374
|
+
): Promise<void>;
|
|
375
|
+
_cf_acquireFacetKeepAlive(
|
|
376
|
+
ownerPath: ReadonlyArray<AgentPathStep>
|
|
377
|
+
): Promise<string>;
|
|
378
|
+
_cf_releaseFacetKeepAlive(token: string): Promise<void>;
|
|
379
|
+
_cf_registerFacetRun(
|
|
380
|
+
ownerPath: ReadonlyArray<AgentPathStep>,
|
|
381
|
+
runId: string
|
|
382
|
+
): Promise<void>;
|
|
383
|
+
_cf_unregisterFacetRun(
|
|
384
|
+
ownerPath: ReadonlyArray<AgentPathStep>,
|
|
385
|
+
runId: string
|
|
386
|
+
): Promise<void>;
|
|
387
|
+
_cf_broadcastToSubAgent(
|
|
388
|
+
ownerPath: ReadonlyArray<AgentPathStep>,
|
|
389
|
+
message: string | ArrayBuffer | ArrayBufferView,
|
|
390
|
+
without?: string[]
|
|
391
|
+
): Promise<void>;
|
|
392
|
+
_cf_subAgentConnectionMetas(
|
|
393
|
+
ownerPath: ReadonlyArray<AgentPathStep>
|
|
394
|
+
): Promise<DynamicAgentConnectionMeta[]>;
|
|
395
|
+
_cf_sendToSubAgentConnection(
|
|
396
|
+
connectionId: string,
|
|
397
|
+
message: string | ArrayBuffer | ArrayBufferView
|
|
398
|
+
): Promise<void>;
|
|
399
|
+
_cf_closeSubAgentConnection(
|
|
400
|
+
connectionId: string,
|
|
401
|
+
code?: number,
|
|
402
|
+
reason?: string
|
|
403
|
+
): Promise<void>;
|
|
404
|
+
_cf_setSubAgentConnectionState(
|
|
405
|
+
connectionId: string,
|
|
406
|
+
state: unknown
|
|
407
|
+
): Promise<unknown>;
|
|
408
|
+
};
|
|
409
|
+
//#endregion
|
|
410
|
+
//#region src/dynamic-agents/bridges.d.ts
|
|
411
|
+
/**
|
|
412
|
+
* Parent-side bridge handed to a facet over RPC: wraps a live root-owned
|
|
413
|
+
* `Connection` so the facet can send/close/setState on it, and carries
|
|
414
|
+
* the root's broadcast entry point for facet-scoped broadcasts.
|
|
415
|
+
*/
|
|
416
|
+
declare class DynamicAgentConnectionBridge
|
|
417
|
+
extends RpcTarget
|
|
418
|
+
implements DynamicAgentConnectionBridgeLike
|
|
419
|
+
{
|
|
420
|
+
#private;
|
|
421
|
+
constructor(
|
|
422
|
+
connection: Connection,
|
|
423
|
+
broadcast?: (
|
|
424
|
+
ownerPath: ReadonlyArray<{
|
|
425
|
+
className: string;
|
|
426
|
+
name: string;
|
|
427
|
+
}>,
|
|
428
|
+
message: string | ArrayBuffer | ArrayBufferView,
|
|
429
|
+
without?: string[]
|
|
430
|
+
) => void | Promise<void>
|
|
431
|
+
);
|
|
432
|
+
send(message: string | ArrayBuffer | ArrayBufferView): void;
|
|
433
|
+
close(code?: number, reason?: string): void;
|
|
434
|
+
setState(state: unknown): unknown;
|
|
435
|
+
broadcast(
|
|
436
|
+
ownerPath: ReadonlyArray<{
|
|
437
|
+
className: string;
|
|
438
|
+
name: string;
|
|
439
|
+
}>,
|
|
440
|
+
message: string | ArrayBuffer | ArrayBufferView,
|
|
441
|
+
without?: string[]
|
|
442
|
+
): void | Promise<void>;
|
|
443
|
+
}
|
|
444
|
+
//#endregion
|
|
445
|
+
//#region src/dynamic-agents/identity.d.ts
|
|
446
|
+
declare const SUB_AGENT_IDENTITY_VERSION_LEGACY = "legacy";
|
|
447
|
+
declare const SUB_AGENT_IDENTITY_VERSION_PATH_V2 = "path-v2";
|
|
448
|
+
type SubAgentIdentityVersion =
|
|
449
|
+
| typeof SUB_AGENT_IDENTITY_VERSION_LEGACY
|
|
450
|
+
| typeof SUB_AGENT_IDENTITY_VERSION_PATH_V2;
|
|
451
|
+
//#endregion
|
|
452
|
+
//#region src/dynamic-agents/registry.d.ts
|
|
453
|
+
/**
|
|
454
|
+
* SQL access the registry needs from its owning Agent: the tagged
|
|
455
|
+
* template helper plus raw DDL execution (for additive column
|
|
456
|
+
* migrations whose errors must be inspected).
|
|
457
|
+
*/
|
|
458
|
+
type DynamicAgentRegistrySqlHost = {
|
|
459
|
+
sql<T = Record<string, string | number | boolean | null>>(
|
|
460
|
+
strings: TemplateStringsArray,
|
|
461
|
+
...values: (string | number | boolean | null)[]
|
|
462
|
+
): T[];
|
|
463
|
+
execRawSql(sql: string): void;
|
|
464
|
+
};
|
|
465
|
+
/**
|
|
466
|
+
* The parent-side registry of spawned dynamic agents (facets), stored
|
|
467
|
+
* in the parent's own SQLite. Backs `hasSubAgent` / `listSubAgents`
|
|
468
|
+
* and the identity-versioning decision (legacy bare-name facets vs
|
|
469
|
+
* path-scoped v2 identities).
|
|
470
|
+
*
|
|
471
|
+
* Table and column names are storage-frozen — never rename them.
|
|
472
|
+
*/
|
|
473
|
+
declare class DynamicAgentRegistry {
|
|
474
|
+
#private;
|
|
475
|
+
constructor(host: DynamicAgentRegistrySqlHost);
|
|
476
|
+
ensure(): void;
|
|
477
|
+
record(
|
|
478
|
+
className: string,
|
|
479
|
+
name: string,
|
|
480
|
+
identity: {
|
|
481
|
+
version: SubAgentIdentityVersion;
|
|
482
|
+
name: string;
|
|
483
|
+
}
|
|
484
|
+
): void;
|
|
485
|
+
row(
|
|
486
|
+
className: string,
|
|
487
|
+
name: string
|
|
488
|
+
): {
|
|
489
|
+
identity_version: string | null;
|
|
490
|
+
identity_name: string | null;
|
|
491
|
+
} | null;
|
|
492
|
+
identity(
|
|
493
|
+
className: string,
|
|
494
|
+
name: string,
|
|
495
|
+
childPath: ReadonlyArray<AgentPathStep>
|
|
496
|
+
): Promise<{
|
|
497
|
+
version: SubAgentIdentityVersion;
|
|
498
|
+
name: string;
|
|
499
|
+
existing: boolean;
|
|
500
|
+
}>;
|
|
501
|
+
forget(className: string, name: string): void;
|
|
502
|
+
has(className: string, name: string): boolean;
|
|
503
|
+
list(className?: string): Array<{
|
|
504
|
+
className: string;
|
|
505
|
+
name: string;
|
|
506
|
+
createdAt: number;
|
|
507
|
+
}>;
|
|
508
|
+
}
|
|
509
|
+
//#endregion
|
|
510
|
+
//#region src/dynamic-agents/host.d.ts
|
|
511
|
+
/**
|
|
512
|
+
* The Agent internals the dynamic-agents (facet) machinery reaches
|
|
513
|
+
* into. Agent implements this structurally and passes itself at
|
|
514
|
+
* construction — the interface exists to make the coupling explicit
|
|
515
|
+
* and reviewable, and is the seam a later capability refactor would
|
|
516
|
+
* shrink.
|
|
517
|
+
*
|
|
518
|
+
* Members named `_cf_*` are cross-facet RPC entry points that must
|
|
519
|
+
* stay on the Agent prototype; the module calls back into them when
|
|
520
|
+
* traversal continues on another agent instance.
|
|
521
|
+
*
|
|
522
|
+
* @internal
|
|
523
|
+
*/
|
|
524
|
+
interface DynamicAgentHostPort {
|
|
525
|
+
readonly ctx: DurableObjectState;
|
|
526
|
+
readonly lifecycle: {
|
|
527
|
+
route(envelope: LifecycleRouteEnvelope): Promise<unknown>;
|
|
528
|
+
readonly name: string;
|
|
529
|
+
};
|
|
530
|
+
sql<T = Record<string, string | number | boolean | null>>(
|
|
531
|
+
strings: TemplateStringsArray,
|
|
532
|
+
...values: (string | number | boolean | null)[]
|
|
533
|
+
): T[];
|
|
534
|
+
/** Facet identity — written by `initAsFacet` and startup restore. */
|
|
535
|
+
_isFacet: boolean;
|
|
536
|
+
_facetName?: string;
|
|
537
|
+
_parentPath: ReadonlyArray<AgentPathStep>;
|
|
538
|
+
readonly name: string;
|
|
539
|
+
readonly _ParentClass: {
|
|
540
|
+
readonly name: string;
|
|
541
|
+
};
|
|
542
|
+
readonly selfPath: AgentPathStep[];
|
|
543
|
+
_keepAliveRefs: number;
|
|
544
|
+
_isSameAgentPathPrefix(
|
|
545
|
+
prefix: ReadonlyArray<AgentPathStep>,
|
|
546
|
+
path: ReadonlyArray<AgentPathStep>
|
|
547
|
+
): boolean;
|
|
548
|
+
hasSubAgent(className: string, name: string): boolean;
|
|
549
|
+
_cf_resolveSubAgent(className: string, name: string): Promise<unknown>;
|
|
550
|
+
_cf_cleanupFacetPrefix(
|
|
551
|
+
ownerPath: ReadonlyArray<AgentPathStep>
|
|
552
|
+
): Promise<void>;
|
|
553
|
+
_cf_routeLifecycle(
|
|
554
|
+
target: LifecycleRouteAddress | undefined,
|
|
555
|
+
envelope: LifecycleRouteEnvelope
|
|
556
|
+
): Promise<unknown>;
|
|
557
|
+
_syncHostJobs(): Promise<void>;
|
|
558
|
+
readonly scheduler: {
|
|
559
|
+
__DO_NOT_USE_WILL_BREAK__cleanupRoutePrefix(prefix: string): Promise<void>;
|
|
560
|
+
};
|
|
561
|
+
readonly tasks: {
|
|
562
|
+
__DO_NOT_USE_WILL_BREAK__cleanupRoutePrefix(prefix: string): Promise<void>;
|
|
563
|
+
};
|
|
564
|
+
/** Local (non-facet-index) durable fiber recovery pass. */
|
|
565
|
+
_checkRunFibers(): Promise<void>;
|
|
566
|
+
/** Overridable RPC entry points — call via the host so subclass overrides intercept. */
|
|
567
|
+
_cf_broadcastToSubAgent(
|
|
568
|
+
ownerPath: ReadonlyArray<AgentPathStep>,
|
|
569
|
+
message: string | ArrayBuffer | ArrayBufferView,
|
|
570
|
+
without?: string[]
|
|
571
|
+
): Promise<void>;
|
|
572
|
+
_cf_checkRunFibersForFacet(
|
|
573
|
+
ownerPath: ReadonlyArray<AgentPathStep>
|
|
574
|
+
): Promise<number>;
|
|
575
|
+
/** Ensure constructor-time async initialization has completed. */
|
|
576
|
+
__unsafe_ensureInitialized(): Promise<void>;
|
|
577
|
+
/**
|
|
578
|
+
* Run `body` in a fresh invocation scope with no native request/
|
|
579
|
+
* connection context attached, so a child-facet RPC never sees
|
|
580
|
+
* parent-owned I/O handles.
|
|
581
|
+
*/
|
|
582
|
+
_runFacetInitInvocation<T>(body: () => Promise<T>): Promise<T>;
|
|
583
|
+
readonly _webSockets: {
|
|
584
|
+
getConnection<TState = unknown>(id: string): Connection<TState> | undefined;
|
|
585
|
+
getConnections<TState = unknown>(
|
|
586
|
+
tag?: string
|
|
587
|
+
): Iterable<Connection<TState>>;
|
|
588
|
+
};
|
|
589
|
+
_ensureConnectionWrapped(connection: Connection): void;
|
|
590
|
+
_unsafe_getConnectionFlag(connection: Connection, key: string): unknown;
|
|
591
|
+
_unsafe_setConnectionFlag(
|
|
592
|
+
connection: Connection,
|
|
593
|
+
key: string,
|
|
594
|
+
value: unknown
|
|
595
|
+
): void;
|
|
596
|
+
readonly _rawStateAccessors: {
|
|
597
|
+
get(connection: Connection):
|
|
598
|
+
| {
|
|
599
|
+
getRaw(): unknown;
|
|
600
|
+
}
|
|
601
|
+
| undefined;
|
|
602
|
+
};
|
|
603
|
+
shouldConnectionBeReadonly(
|
|
604
|
+
connection: Connection,
|
|
605
|
+
context: {
|
|
606
|
+
request: Request;
|
|
607
|
+
}
|
|
608
|
+
): boolean;
|
|
609
|
+
setConnectionReadonly(connection: Connection, readonly: boolean): void;
|
|
610
|
+
shouldSendProtocolMessages(
|
|
611
|
+
connection: Connection,
|
|
612
|
+
context: {
|
|
613
|
+
request: Request;
|
|
614
|
+
}
|
|
615
|
+
): boolean;
|
|
616
|
+
_setConnectionNoProtocol(connection: Connection): void;
|
|
617
|
+
getConnectionTags(
|
|
618
|
+
connection: Connection,
|
|
619
|
+
context: {
|
|
620
|
+
request: Request;
|
|
621
|
+
}
|
|
622
|
+
): Promise<string[]> | string[];
|
|
623
|
+
onConnect(
|
|
624
|
+
connection: Connection,
|
|
625
|
+
context: {
|
|
626
|
+
request: Request;
|
|
627
|
+
}
|
|
628
|
+
): unknown | Promise<unknown>;
|
|
629
|
+
onMessage(
|
|
630
|
+
connection: Connection,
|
|
631
|
+
message: WSMessage
|
|
632
|
+
): unknown | Promise<unknown>;
|
|
633
|
+
onClose(
|
|
634
|
+
connection: Connection,
|
|
635
|
+
code: number,
|
|
636
|
+
reason: string,
|
|
637
|
+
wasClean: boolean
|
|
638
|
+
): unknown | Promise<unknown>;
|
|
639
|
+
onBeforeSubAgent(
|
|
640
|
+
request: Request,
|
|
641
|
+
child: {
|
|
642
|
+
className: string;
|
|
643
|
+
name: string;
|
|
644
|
+
}
|
|
645
|
+
): Promise<Request | Response | void>;
|
|
646
|
+
}
|
|
647
|
+
//#endregion
|
|
648
|
+
//#region src/dynamic-agents/dynamic-agents.d.ts
|
|
649
|
+
/**
|
|
650
|
+
* The facet-backed dynamic-agent machinery, extracted from the Agent
|
|
651
|
+
* class. One instance per Agent, installed as a Lifecycle capability
|
|
652
|
+
* (`capabilityId: "dynamic-agents"`); the host port documents exactly
|
|
653
|
+
* which Agent internals it touches.
|
|
654
|
+
*
|
|
655
|
+
* The capability claims no runner hooks — four integration points are
|
|
656
|
+
* deliberately wired directly through the Agent composition root
|
|
657
|
+
* instead, because the runner's dispatch contract cannot express them:
|
|
658
|
+
* the `/sub/` upgrade path rewrites the request and *continues* into
|
|
659
|
+
* `lifecycle.fetch` (onRequest can only claim), forwarded WS frames run
|
|
660
|
+
* inside the host's onMessage wrapper *after* the WebSockets capability
|
|
661
|
+
* has claimed the wake, this module *implements* the lifecycle route
|
|
662
|
+
* transport rather than consuming it, and facet-context restore has
|
|
663
|
+
* load-bearing startup ordering inside the host's startup span.
|
|
664
|
+
*
|
|
665
|
+
* Nothing here renames any wire- or storage-visible identifier: the
|
|
666
|
+
* `cf_agents_facet_runs` table, `_cf_*` RPC method names, and route
|
|
667
|
+
* key formats are frozen.
|
|
668
|
+
*
|
|
669
|
+
* @internal
|
|
670
|
+
*/
|
|
671
|
+
declare class DynamicAgentsInternal extends LifecycleCapability {
|
|
672
|
+
#private;
|
|
673
|
+
/** The parent-side registry of spawned dynamic agents. */
|
|
674
|
+
readonly registry: DynamicAgentRegistry;
|
|
675
|
+
constructor(host: DynamicAgentHostPort);
|
|
676
|
+
runRowsForPrefix(
|
|
677
|
+
ownerPath: ReadonlyArray<AgentPathStep>
|
|
678
|
+
): FacetRunStorageRow[];
|
|
679
|
+
deleteRunRowsForPrefix(ownerPath: ReadonlyArray<AgentPathStep>): void;
|
|
680
|
+
lifecycleRouteAddress(): LifecycleRouteAddress | undefined;
|
|
681
|
+
routeLifecycleToRoot(envelope: LifecycleRouteEnvelope): Promise<unknown>;
|
|
682
|
+
routeLifecycleToTarget(
|
|
683
|
+
target: LifecycleRouteAddress,
|
|
684
|
+
envelope: LifecycleRouteEnvelope
|
|
685
|
+
): Promise<unknown>;
|
|
686
|
+
/** Body of the single native-RPC aperture for routed Lifecycle capabilities. */
|
|
687
|
+
routeLifecycle(
|
|
688
|
+
target: LifecycleRouteAddress | undefined,
|
|
689
|
+
envelope: LifecycleRouteEnvelope
|
|
690
|
+
): Promise<unknown>;
|
|
691
|
+
rootAlarmOwner(): Promise<RootFacetRpcSurface>;
|
|
692
|
+
rootResolvesToSelf(): boolean;
|
|
693
|
+
/**
|
|
694
|
+
* Clean root-owned bookkeeping for a sub-tree of facets: bulk-cancel
|
|
695
|
+
* schedules and routed Task wake mirrors under the owner-path prefix,
|
|
696
|
+
* and delete root-side facet fiber recovery leases for the same sub-tree.
|
|
697
|
+
*/
|
|
698
|
+
cleanupPrefix(ownerPath: ReadonlyArray<AgentPathStep>): Promise<void>;
|
|
699
|
+
/**
|
|
700
|
+
* Acquire a root-owned keepAlive ref on behalf of a descendant facet.
|
|
701
|
+
*/
|
|
702
|
+
acquireKeepAlive(ownerPath: ReadonlyArray<AgentPathStep>): Promise<string>;
|
|
703
|
+
/**
|
|
704
|
+
* Release a root-owned keepAlive ref previously acquired for a facet.
|
|
705
|
+
* Idempotent so disposer calls can safely race or run twice.
|
|
706
|
+
*/
|
|
707
|
+
releaseKeepAlive(token: string): Promise<void>;
|
|
708
|
+
/**
|
|
709
|
+
* Register a facet's durable run row in the root-side index so root
|
|
710
|
+
* alarm housekeeping can dispatch recovery checks into idle facets.
|
|
711
|
+
*/
|
|
712
|
+
registerRun(
|
|
713
|
+
ownerPath: ReadonlyArray<AgentPathStep>,
|
|
714
|
+
runId: string
|
|
715
|
+
): Promise<void>;
|
|
716
|
+
/**
|
|
717
|
+
* Root-side scan for durable fibers owned by descendant facets.
|
|
718
|
+
* `cf_agents_facet_runs` is only an index; actual snapshots and
|
|
719
|
+
* recovery hooks live in each facet's own `cf_agents_runs` table.
|
|
720
|
+
*/
|
|
721
|
+
checkRunFibers(): Promise<void>;
|
|
722
|
+
/**
|
|
723
|
+
* Dispatch a runFiber recovery check into the facet identified by
|
|
724
|
+
* `ownerPath`. Returns the number of remaining local `cf_agents_runs`
|
|
725
|
+
* rows on the target facet after recovery.
|
|
726
|
+
*/
|
|
727
|
+
checkRunFibersAtPath(
|
|
728
|
+
ownerPath: ReadonlyArray<AgentPathStep>
|
|
729
|
+
): Promise<number>;
|
|
730
|
+
/**
|
|
731
|
+
* Invoke an RPC method on the host Agent or a descendant facet
|
|
732
|
+
* identified by a root-first path. Used by AgentWorkflow to route
|
|
733
|
+
* callbacks and `this.agent` calls back to the exact sub-agent that
|
|
734
|
+
* started a workflow.
|
|
735
|
+
*/
|
|
736
|
+
invokeAgentPath(
|
|
737
|
+
targetPath: ReadonlyArray<AgentPathStep>,
|
|
738
|
+
method: string,
|
|
739
|
+
args: unknown[]
|
|
740
|
+
): Promise<unknown>;
|
|
741
|
+
/**
|
|
742
|
+
* Recursively destroy a descendant facet identified by `targetPath`.
|
|
743
|
+
* Walks down from `selfPath` until reaching the target's immediate
|
|
744
|
+
* parent, where it cancels the target's parent-owned schedules (and
|
|
745
|
+
* any descendants), removes the target from the registry, and calls
|
|
746
|
+
* `ctx.facets.delete` to wipe the target's storage.
|
|
747
|
+
*/
|
|
748
|
+
destroyDescendant(targetPath: ReadonlyArray<AgentPathStep>): Promise<void>;
|
|
749
|
+
/**
|
|
750
|
+
* Shared facet resolution — takes a CamelCase class name string
|
|
751
|
+
* (matching `ctx.exports`) rather than a class reference. Both
|
|
752
|
+
* `subAgent(cls, name)` and `_cf_invokeSubAgent(className, ...)`
|
|
753
|
+
* funnel through here so registry bookkeeping and the
|
|
754
|
+
* `_cf_initAsFacet` handshake are consistent.
|
|
755
|
+
*/
|
|
756
|
+
resolve(className: string, name: string): Promise<unknown>;
|
|
757
|
+
/**
|
|
758
|
+
* Forcefully abort a running facet. Transitively aborts the child's
|
|
759
|
+
* own children; storage is preserved.
|
|
760
|
+
*/
|
|
761
|
+
abort(className: string, name: string, reason?: unknown): void;
|
|
762
|
+
/**
|
|
763
|
+
* Delete a facet: abort it if running, then permanently wipe its
|
|
764
|
+
* storage. Transitively deletes the child's own children.
|
|
765
|
+
*/
|
|
766
|
+
delete(className: string, name: string): Promise<void>;
|
|
767
|
+
/** Drop all facet-side virtual connections (test/rehydration hook). */
|
|
768
|
+
clearVirtualConnections(): void;
|
|
769
|
+
/** Facet-side lookup of a virtual connection by id. */
|
|
770
|
+
getVirtualConnection(id: string): Connection | undefined;
|
|
771
|
+
/** Facet-side iteration over virtual connections, optionally by tag. */
|
|
772
|
+
getVirtualConnections(tag?: string): Iterable<Connection>;
|
|
773
|
+
activeBridge(
|
|
774
|
+
connectionId?: string
|
|
775
|
+
): DynamicAgentConnectionBridgeLike | undefined;
|
|
776
|
+
/**
|
|
777
|
+
* Route a virtual sub-agent connection operation through its live frame
|
|
778
|
+
* bridge, or through the durable root Agent after that frame completes.
|
|
779
|
+
* All operations share one per-connection queue. Facet broadcasts wait for
|
|
780
|
+
* older queued operations; failures do not block later work.
|
|
781
|
+
*/
|
|
782
|
+
routeConnectionOperation(
|
|
783
|
+
connectionId: string,
|
|
784
|
+
operationName: DynamicAgentConnectionOperationName,
|
|
785
|
+
operation: (bridge: DynamicAgentConnectionBridgeLike) => unknown
|
|
786
|
+
): void;
|
|
787
|
+
/**
|
|
788
|
+
* Route a facet broadcast after every older connection operation.
|
|
789
|
+
*
|
|
790
|
+
* This barrier is intentionally one-way: facet startup can broadcast before
|
|
791
|
+
* a child connection has finished initializing its tags and protocol flags.
|
|
792
|
+
* Making those later connection operations wait would let the next frame
|
|
793
|
+
* observe stale root-owned metadata.
|
|
794
|
+
*/
|
|
795
|
+
routeBroadcast(
|
|
796
|
+
ownerPath: ReadonlyArray<AgentPathStep>,
|
|
797
|
+
message: string | ArrayBuffer | ArrayBufferView,
|
|
798
|
+
without?: string[],
|
|
799
|
+
upstreamBridge?: DynamicAgentConnectionBridgeLike
|
|
800
|
+
): Promise<void>;
|
|
801
|
+
broadcastToParent(
|
|
802
|
+
message: string | ArrayBuffer | ArrayBufferView,
|
|
803
|
+
without?: string[]
|
|
804
|
+
): Promise<void>;
|
|
805
|
+
broadcastToPath(
|
|
806
|
+
ownerPath: ReadonlyArray<AgentPathStep>,
|
|
807
|
+
message: string | ArrayBuffer | ArrayBufferView,
|
|
808
|
+
without?: string[]
|
|
809
|
+
): Promise<void>;
|
|
810
|
+
connectionMetas(
|
|
811
|
+
ownerPath: ReadonlyArray<AgentPathStep>
|
|
812
|
+
): Promise<DynamicAgentConnectionMeta[]>;
|
|
813
|
+
sendToConnection(
|
|
814
|
+
connectionId: string,
|
|
815
|
+
message: string | ArrayBuffer | ArrayBufferView
|
|
816
|
+
): Promise<void>;
|
|
817
|
+
closeConnection(
|
|
818
|
+
connectionId: string,
|
|
819
|
+
code?: number,
|
|
820
|
+
reason?: string
|
|
821
|
+
): Promise<void>;
|
|
822
|
+
setConnectionState(connectionId: string, state: unknown): Promise<unknown>;
|
|
823
|
+
connectionTargetPath(
|
|
824
|
+
connection: Connection
|
|
825
|
+
): ReadonlyArray<AgentPathStep> | null;
|
|
826
|
+
isSameAgentPath(
|
|
827
|
+
a: ReadonlyArray<AgentPathStep>,
|
|
828
|
+
b: ReadonlyArray<AgentPathStep>
|
|
829
|
+
): boolean;
|
|
830
|
+
connectionHasChildTarget(connection: Connection): boolean;
|
|
831
|
+
connectionTargetsChild(connection: Connection): boolean;
|
|
832
|
+
requestTargetsChild(request: Request): boolean;
|
|
833
|
+
forwardWebSocketConnect(
|
|
834
|
+
connection: Connection,
|
|
835
|
+
request: Request,
|
|
836
|
+
options: {
|
|
837
|
+
gate: boolean;
|
|
838
|
+
}
|
|
839
|
+
): Promise<boolean>;
|
|
840
|
+
forwardWebSocketMessage(
|
|
841
|
+
connection: Connection,
|
|
842
|
+
message: WSMessage,
|
|
843
|
+
replyBridge?: DynamicAgentConnectionBridge
|
|
844
|
+
): Promise<boolean>;
|
|
845
|
+
forwardWebSocketClose(
|
|
846
|
+
connection: Connection,
|
|
847
|
+
code: number,
|
|
848
|
+
reason: string,
|
|
849
|
+
wasClean: boolean
|
|
850
|
+
): Promise<boolean>;
|
|
851
|
+
handleWebSocketConnect(
|
|
852
|
+
bridge: DynamicAgentConnectionBridge,
|
|
853
|
+
meta: DynamicAgentConnectionMeta
|
|
854
|
+
): Promise<void>;
|
|
855
|
+
handleWebSocketMessage(
|
|
856
|
+
message: WSMessage,
|
|
857
|
+
bridge: DynamicAgentConnectionBridge,
|
|
858
|
+
meta: DynamicAgentConnectionMeta,
|
|
859
|
+
replyBridge?: DynamicAgentConnectionBridge
|
|
860
|
+
): Promise<void>;
|
|
861
|
+
handleWebSocketClose(
|
|
862
|
+
code: number,
|
|
863
|
+
reason: string,
|
|
864
|
+
wasClean: boolean,
|
|
865
|
+
bridge: DynamicAgentConnectionBridge,
|
|
866
|
+
meta: DynamicAgentConnectionMeta
|
|
867
|
+
): Promise<void>;
|
|
868
|
+
runWithBridge<T>(
|
|
869
|
+
bridge: DynamicAgentConnectionBridgeLike,
|
|
870
|
+
connectionId: string,
|
|
871
|
+
fn: () => Promise<T> | T
|
|
872
|
+
): Promise<T>;
|
|
873
|
+
createBridgeConnection(meta: DynamicAgentConnectionMeta): Connection;
|
|
874
|
+
storeVirtualConnection(connection: Connection): void;
|
|
875
|
+
/**
|
|
876
|
+
* Restore the facet identity persisted by `init` (wake after
|
|
877
|
+
* hibernation), then best-effort hydrate the virtual connections
|
|
878
|
+
* from the root's WebSocket state.
|
|
879
|
+
*/
|
|
880
|
+
restoreFacetContext(): Promise<void>;
|
|
881
|
+
hydrateConnectionsFromRoot(): Promise<void>;
|
|
882
|
+
getRawConnectionState(connection: Connection): unknown;
|
|
883
|
+
getForwardedState(connection: Connection): unknown;
|
|
884
|
+
/**
|
|
885
|
+
* Resolve the facet Fetcher for the match and forward the request to
|
|
886
|
+
* it with `/sub/{class}/{name}` stripped.
|
|
887
|
+
*/
|
|
888
|
+
forward(
|
|
889
|
+
req: Request,
|
|
890
|
+
match: {
|
|
891
|
+
childClass: string;
|
|
892
|
+
childName: string;
|
|
893
|
+
remainingPath: string;
|
|
894
|
+
}
|
|
895
|
+
): Promise<Response>;
|
|
896
|
+
/**
|
|
897
|
+
* Bridge used by `getSubAgentByName`: resolve the facet and dispatch
|
|
898
|
+
* one RPC method. Stateless — no cached references.
|
|
899
|
+
*/
|
|
900
|
+
invoke(
|
|
901
|
+
className: string,
|
|
902
|
+
name: string,
|
|
903
|
+
method: string,
|
|
904
|
+
args: unknown[]
|
|
905
|
+
): Promise<unknown>;
|
|
906
|
+
/**
|
|
907
|
+
* Bridge used by `parentAgent()` when the requested parent is itself
|
|
908
|
+
* a facet (and therefore has no top-level env namespace). The root
|
|
909
|
+
* receives the full root-first target path, then each hop delegates
|
|
910
|
+
* to the next facet using that facet's own `ctx.facets`.
|
|
911
|
+
*/
|
|
912
|
+
invokePath(
|
|
913
|
+
path: ReadonlyArray<{
|
|
914
|
+
className: string;
|
|
915
|
+
name: string;
|
|
916
|
+
}>,
|
|
917
|
+
method: string,
|
|
918
|
+
args: unknown[]
|
|
919
|
+
): Promise<unknown>;
|
|
920
|
+
invokeStubMethod(
|
|
921
|
+
stub: unknown,
|
|
922
|
+
className: string,
|
|
923
|
+
method: string,
|
|
924
|
+
args: unknown[]
|
|
925
|
+
): Promise<unknown>;
|
|
926
|
+
/**
|
|
927
|
+
* Initialize the host agent as a facet in a single RPC. Runs entirely
|
|
928
|
+
* inside the child's isolate, so every storage write and `onStart()`
|
|
929
|
+
* I/O is owned by the child DO.
|
|
930
|
+
*/
|
|
931
|
+
init(
|
|
932
|
+
name: string,
|
|
933
|
+
parentPath?: ReadonlyArray<{
|
|
934
|
+
className: string;
|
|
935
|
+
name: string;
|
|
936
|
+
}>,
|
|
937
|
+
identityName?: string
|
|
938
|
+
): Promise<void>;
|
|
939
|
+
/** Remove a completed facet fiber from the root-side index. */
|
|
940
|
+
unregisterRun(
|
|
941
|
+
ownerPath: ReadonlyArray<AgentPathStep>,
|
|
942
|
+
runId: string
|
|
943
|
+
): Promise<void>;
|
|
944
|
+
}
|
|
945
|
+
//#endregion
|
|
946
|
+
//#region src/dynamic-agents/api.d.ts
|
|
947
|
+
/**
|
|
948
|
+
* The public dynamic-agents capability surface, reached via
|
|
949
|
+
* `this.dynamicAgents` on an Agent.
|
|
950
|
+
*
|
|
951
|
+
* A dynamic agent is a facet-backed child: it runs in its own isolate
|
|
952
|
+
* with its own SQLite database, colocated with — and supervised by —
|
|
953
|
+
* its parent Agent. Use dynamic agents for code whose class or
|
|
954
|
+
* lifecycle the parent owns (dynamically-loaded/generated code,
|
|
955
|
+
* per-run tool agents, sandboxed components). For independent peers
|
|
956
|
+
* such as one-DO-per-chat, use `getAgentByName` instead.
|
|
957
|
+
*
|
|
958
|
+
* @experimental The API surface may change before stabilizing.
|
|
959
|
+
*/
|
|
960
|
+
declare class DynamicAgents {
|
|
961
|
+
#private;
|
|
962
|
+
/** @internal Constructed by Agent; do not instantiate directly. */
|
|
963
|
+
constructor(internal: DynamicAgentsInternal);
|
|
964
|
+
/**
|
|
965
|
+
* Get (creating or waking if needed) the dynamic agent of the given
|
|
966
|
+
* class and name, as a typed RPC stub. Idempotent — repeated calls
|
|
967
|
+
* with the same class and name return the same child.
|
|
968
|
+
*
|
|
969
|
+
* @experimental
|
|
970
|
+
*/
|
|
971
|
+
get<T extends Agent>(
|
|
972
|
+
cls: DynamicAgentClass<T>,
|
|
973
|
+
name: string
|
|
974
|
+
): Promise<DynamicAgentStub<T>>;
|
|
975
|
+
/**
|
|
976
|
+
* Forcefully abort a running dynamic agent. The child stops
|
|
977
|
+
* executing immediately and restarts on the next {@link get} call;
|
|
978
|
+
* its storage is preserved. Transitively aborts the child's own
|
|
979
|
+
* children. Pending RPC calls receive the reason as an error.
|
|
980
|
+
*
|
|
981
|
+
* @experimental
|
|
982
|
+
*/
|
|
983
|
+
abort(cls: DynamicAgentClass, name: string, reason?: unknown): void;
|
|
984
|
+
/**
|
|
985
|
+
* Delete a dynamic agent: abort it if running, then permanently wipe
|
|
986
|
+
* its storage. Transitively deletes the child's own children.
|
|
987
|
+
*
|
|
988
|
+
* @experimental
|
|
989
|
+
*/
|
|
990
|
+
delete(cls: DynamicAgentClass, name: string): Promise<void>;
|
|
991
|
+
/**
|
|
992
|
+
* Whether this agent has previously spawned (and not deleted) a
|
|
993
|
+
* dynamic agent of the given class and name. Backed by an
|
|
994
|
+
* auto-maintained SQLite registry in the parent's storage.
|
|
995
|
+
*
|
|
996
|
+
* @experimental
|
|
997
|
+
*/
|
|
998
|
+
has<T extends Agent>(cls: DynamicAgentClass<T>, name: string): boolean;
|
|
999
|
+
has(className: string, name: string): boolean;
|
|
1000
|
+
/**
|
|
1001
|
+
* List known dynamic agents, optionally filtered by class. Reflects
|
|
1002
|
+
* the registry rows written by {@link get} and removed by
|
|
1003
|
+
* {@link delete}.
|
|
1004
|
+
*
|
|
1005
|
+
* @experimental
|
|
1006
|
+
*/
|
|
1007
|
+
list<T extends Agent>(
|
|
1008
|
+
cls: DynamicAgentClass<T>
|
|
1009
|
+
): Array<{
|
|
1010
|
+
className: string;
|
|
1011
|
+
name: string;
|
|
1012
|
+
createdAt: number;
|
|
1013
|
+
}>;
|
|
1014
|
+
list(className?: string): Array<{
|
|
1015
|
+
className: string;
|
|
1016
|
+
name: string;
|
|
1017
|
+
createdAt: number;
|
|
1018
|
+
}>;
|
|
1019
|
+
}
|
|
292
1020
|
//#endregion
|
|
293
1021
|
//#region src/core/events.d.ts
|
|
294
1022
|
interface Disposable {
|
|
@@ -3162,7 +3890,7 @@ type RunAgentToolResult<Output = unknown> = {
|
|
|
3162
3890
|
*/
|
|
3163
3891
|
childStillRunning?: boolean;
|
|
3164
3892
|
};
|
|
3165
|
-
type ChatCapableAgentClass<T extends Agent = Agent> =
|
|
3893
|
+
type ChatCapableAgentClass<T extends Agent = Agent> = DynamicAgentClass<T>;
|
|
3166
3894
|
type AgentToolRunInspection<Output = unknown> = {
|
|
3167
3895
|
runId: string;
|
|
3168
3896
|
status: Exclude<AgentToolRunStatus, "interrupted">;
|
|
@@ -3355,114 +4083,6 @@ type RPCResponse = {
|
|
|
3355
4083
|
error: string;
|
|
3356
4084
|
}
|
|
3357
4085
|
);
|
|
3358
|
-
/**
|
|
3359
|
-
* Metadata for a callable method
|
|
3360
|
-
*/
|
|
3361
|
-
type CallableMetadata = {
|
|
3362
|
-
/** Optional description of what the method does */ description?: string /** Whether the method supports streaming responses */;
|
|
3363
|
-
streaming?: boolean;
|
|
3364
|
-
};
|
|
3365
|
-
type SubAgentConnectionMeta = {
|
|
3366
|
-
id: string;
|
|
3367
|
-
uri: string | null;
|
|
3368
|
-
tags: string[];
|
|
3369
|
-
state: unknown;
|
|
3370
|
-
requestHeaders?: [string, string][];
|
|
3371
|
-
};
|
|
3372
|
-
type SubAgentConnectionBridgeLike = {
|
|
3373
|
-
send(message: string | ArrayBuffer | ArrayBufferView): void | Promise<void>;
|
|
3374
|
-
close(code?: number, reason?: string): void | Promise<void>;
|
|
3375
|
-
setState(state: unknown): unknown | Promise<unknown>;
|
|
3376
|
-
broadcast(
|
|
3377
|
-
ownerPath: ReadonlyArray<{
|
|
3378
|
-
className: string;
|
|
3379
|
-
name: string;
|
|
3380
|
-
}>,
|
|
3381
|
-
message: string | ArrayBuffer | ArrayBufferView,
|
|
3382
|
-
without?: string[]
|
|
3383
|
-
): void | Promise<void>;
|
|
3384
|
-
};
|
|
3385
|
-
declare class SubAgentConnectionBridge
|
|
3386
|
-
extends RpcTarget
|
|
3387
|
-
implements SubAgentConnectionBridgeLike
|
|
3388
|
-
{
|
|
3389
|
-
#private;
|
|
3390
|
-
constructor(
|
|
3391
|
-
connection: Connection,
|
|
3392
|
-
broadcast?: (
|
|
3393
|
-
ownerPath: ReadonlyArray<{
|
|
3394
|
-
className: string;
|
|
3395
|
-
name: string;
|
|
3396
|
-
}>,
|
|
3397
|
-
message: string | ArrayBuffer | ArrayBufferView,
|
|
3398
|
-
without?: string[]
|
|
3399
|
-
) => void | Promise<void>
|
|
3400
|
-
);
|
|
3401
|
-
send(message: string | ArrayBuffer | ArrayBufferView): void;
|
|
3402
|
-
close(code?: number, reason?: string): void;
|
|
3403
|
-
setState(state: unknown): unknown;
|
|
3404
|
-
broadcast(
|
|
3405
|
-
ownerPath: ReadonlyArray<{
|
|
3406
|
-
className: string;
|
|
3407
|
-
name: string;
|
|
3408
|
-
}>,
|
|
3409
|
-
message: string | ArrayBuffer | ArrayBufferView,
|
|
3410
|
-
without?: string[]
|
|
3411
|
-
): void | Promise<void>;
|
|
3412
|
-
}
|
|
3413
|
-
/**
|
|
3414
|
-
* Constructor type for a sub-agent class.
|
|
3415
|
-
* Used by {@link Agent.subAgent} to reference the child class
|
|
3416
|
-
* via `ctx.exports`.
|
|
3417
|
-
*
|
|
3418
|
-
* The class name (`cls.name`) must match the export name in the
|
|
3419
|
-
* worker entry point — re-exports under a different name
|
|
3420
|
-
* (e.g. `export { Foo as Bar }`) are not supported.
|
|
3421
|
-
*/
|
|
3422
|
-
type SubAgentClass<T extends Agent = Agent> = {
|
|
3423
|
-
new (ctx: DurableObjectState, env: never): T;
|
|
3424
|
-
};
|
|
3425
|
-
/**
|
|
3426
|
-
* Wraps `T` in a `Promise` unless it already is one.
|
|
3427
|
-
*/
|
|
3428
|
-
type Promisify<T> = T extends Promise<unknown> ? T : Promise<T>;
|
|
3429
|
-
/**
|
|
3430
|
-
* A typed RPC stub for a sub-agent. Exposes all public instance methods
|
|
3431
|
-
* as callable RPC methods with Promise-wrapped return types.
|
|
3432
|
-
*
|
|
3433
|
-
* Methods owned by `Agent`, its lifecycle, or `DurableObject` internals
|
|
3434
|
-
* are excluded — only user-defined methods on the subclass are exposed.
|
|
3435
|
-
*/
|
|
3436
|
-
type SubAgentStub<T extends Agent> = {
|
|
3437
|
-
[K in keyof T as K extends keyof Agent
|
|
3438
|
-
? never
|
|
3439
|
-
: T[K] extends (...args: never[]) => unknown
|
|
3440
|
-
? K
|
|
3441
|
-
: never]: T[K] extends (...args: infer A) => infer R
|
|
3442
|
-
? (...args: A) => Promisify<R>
|
|
3443
|
-
: never;
|
|
3444
|
-
};
|
|
3445
|
-
/**
|
|
3446
|
-
* Decorator that marks a method as callable by clients
|
|
3447
|
-
* @param metadata Optional metadata about the callable method
|
|
3448
|
-
*/
|
|
3449
|
-
declare function callable(
|
|
3450
|
-
metadata?: CallableMetadata
|
|
3451
|
-
): <This, Args extends unknown[], Return>(
|
|
3452
|
-
target: (this: This, ...args: Args) => Return,
|
|
3453
|
-
_context: ClassMethodDecoratorContext
|
|
3454
|
-
) => (this: This, ...args: Args) => Return;
|
|
3455
|
-
/**
|
|
3456
|
-
* Decorator that marks a method as callable by clients
|
|
3457
|
-
* @deprecated this has been renamed to callable, and unstable_callable will be removed in the next major version
|
|
3458
|
-
* @param metadata Optional metadata about the callable method
|
|
3459
|
-
*/
|
|
3460
|
-
declare const unstable_callable: (
|
|
3461
|
-
metadata?: CallableMetadata
|
|
3462
|
-
) => <This, Args extends unknown[], Return>(
|
|
3463
|
-
target: (this: This, ...args: Args) => Return,
|
|
3464
|
-
_context: ClassMethodDecoratorContext
|
|
3465
|
-
) => (this: This, ...args: Args) => Return;
|
|
3466
4086
|
type QueueItem<T = string> = {
|
|
3467
4087
|
id: string;
|
|
3468
4088
|
payload: T;
|
|
@@ -3859,6 +4479,17 @@ declare class Agent<
|
|
|
3859
4479
|
* @experimental The API surface may change before stabilizing.
|
|
3860
4480
|
*/
|
|
3861
4481
|
readonly lifecycle: Lifecycle<Env, Props>;
|
|
4482
|
+
/**
|
|
4483
|
+
* WebSocket connection subsystem. Constructed as a field initializer
|
|
4484
|
+
* so it exists before the constructor installs it; the handler arrows
|
|
4485
|
+
* defer to `this.*`, so they always hit the framework-wrapped hooks.
|
|
4486
|
+
* Those wrappers still open their own invocation scope even though
|
|
4487
|
+
* the capability's dispatch already entered one via the host invoker
|
|
4488
|
+
* — the inner wrap is kept because the wrapped hooks are also invoked
|
|
4489
|
+
* from paths that do not pass through the capability (facet bridging,
|
|
4490
|
+
* direct calls).
|
|
4491
|
+
*/
|
|
4492
|
+
private readonly _webSockets;
|
|
3862
4493
|
/** Run user initialization after lifecycle components have started. */
|
|
3863
4494
|
onStart(_props?: Props): void | Promise<void>;
|
|
3864
4495
|
/** Handle an HTTP request not claimed by a lifecycle component. */
|
|
@@ -3903,10 +4534,6 @@ declare class Agent<
|
|
|
3903
4534
|
/** True when this agent runs as a facet (sub-agent) inside a parent. */
|
|
3904
4535
|
private _isFacet;
|
|
3905
4536
|
private _protocolBroadcastExcludeIds;
|
|
3906
|
-
private _cf_subAgentBridgeContext;
|
|
3907
|
-
private _cf_virtualSubAgentConnections;
|
|
3908
|
-
private _cf_subAgentConnectionOperationTails;
|
|
3909
|
-
private _cf_subAgentBroadcastOperationTail?;
|
|
3910
4537
|
/**
|
|
3911
4538
|
* User-facing facet name. For legacy facets this is the same as
|
|
3912
4539
|
* `ctx.id.name`; path-scoped facets use an internal routing id and
|
|
@@ -3924,20 +4551,39 @@ declare class Agent<
|
|
|
3924
4551
|
/** Warn-once guard: `chatRecovery` reassigned during onStart() (too late for wake recovery). */
|
|
3925
4552
|
private _warnedChatRecoveryInOnStart;
|
|
3926
4553
|
/**
|
|
3927
|
-
* Number of active keepAlive() callers. When > 0, `
|
|
4554
|
+
* Number of active keepAlive() callers. When > 0, `_syncHostJobs()`
|
|
3928
4555
|
* caps the next alarm at `keepAliveIntervalMs` so the DO stays alive.
|
|
3929
4556
|
* Purely in-memory — lost on eviction, which is correct because the
|
|
3930
4557
|
* in-memory work keepAlive was protecting is also lost.
|
|
3931
4558
|
* @internal
|
|
3932
4559
|
*/
|
|
3933
4560
|
_keepAliveRefs: number;
|
|
4561
|
+
/** @internal The extracted dynamic-agent (facet) machinery. */
|
|
4562
|
+
private _dynamicAgentsInstance;
|
|
4563
|
+
/** @internal */
|
|
4564
|
+
private get _dynamicAgents();
|
|
4565
|
+
/** @internal */
|
|
4566
|
+
private _dynamicAgentsApi;
|
|
3934
4567
|
/**
|
|
3935
|
-
*
|
|
3936
|
-
*
|
|
3937
|
-
*
|
|
3938
|
-
*
|
|
4568
|
+
* The dynamic-agents capability: facet-backed child agents that run
|
|
4569
|
+
* in their own isolate with their own SQLite database, colocated
|
|
4570
|
+
* with — and supervised by — this agent.
|
|
4571
|
+
*
|
|
4572
|
+
* Use dynamic agents for code whose class or lifecycle this agent
|
|
4573
|
+
* owns: dynamically-loaded or AI-generated code, per-run tool
|
|
4574
|
+
* agents, sandboxed components. For independent peers (for example
|
|
4575
|
+
* one Durable Object per chat), use `getAgentByName` instead.
|
|
4576
|
+
*
|
|
4577
|
+
* ```ts
|
|
4578
|
+
* const child = await this.dynamicAgents.get(Researcher, id);
|
|
4579
|
+
* await child.doWork();
|
|
4580
|
+
* this.dynamicAgents.abort(Researcher, id, reason);
|
|
4581
|
+
* await this.dynamicAgents.delete(Researcher, id);
|
|
4582
|
+
* ```
|
|
4583
|
+
*
|
|
4584
|
+
* @experimental The API surface may change before stabilizing.
|
|
3939
4585
|
*/
|
|
3940
|
-
|
|
4586
|
+
get dynamicAgents(): DynamicAgents;
|
|
3941
4587
|
/** @internal In-memory set of fiber IDs running in this process. */
|
|
3942
4588
|
private _runFiberActiveFibers;
|
|
3943
4589
|
/** @internal In-memory abort controllers for managed running fibers. */
|
|
@@ -3970,6 +4616,32 @@ declare class Agent<
|
|
|
3970
4616
|
* cancelSchedule() methods are the stable surface.
|
|
3971
4617
|
*/
|
|
3972
4618
|
readonly scheduler: Scheduler;
|
|
4619
|
+
/**
|
|
4620
|
+
* Durable replayable execution capability installed into this Agent's
|
|
4621
|
+
* Lifecycle. Declare definitions on the overridable
|
|
4622
|
+
* {@link taskDefinitions} property and start runs with
|
|
4623
|
+
* `this.tasks.run(name, input, options)`.
|
|
4624
|
+
*
|
|
4625
|
+
* @experimental The API surface may change before stabilizing.
|
|
4626
|
+
*/
|
|
4627
|
+
readonly tasks: Tasks;
|
|
4628
|
+
/**
|
|
4629
|
+
* Named Task definitions for this Agent, resolved lazily on every
|
|
4630
|
+
* dispatch. Declare as a field so the map is rebuilt on every Durable
|
|
4631
|
+
* Object wake — that is what lets in-flight runs resolve their persisted
|
|
4632
|
+
* definition names after a restart:
|
|
4633
|
+
*
|
|
4634
|
+
* ```ts
|
|
4635
|
+
* readonly taskDefinitions = {
|
|
4636
|
+
* "build-report@v1": async (input: ReportInput, step: TaskStep) => {
|
|
4637
|
+
* // ...
|
|
4638
|
+
* }
|
|
4639
|
+
* } satisfies TaskHandlers;
|
|
4640
|
+
* ```
|
|
4641
|
+
*
|
|
4642
|
+
* @experimental The API surface may change before stabilizing.
|
|
4643
|
+
*/
|
|
4644
|
+
readonly taskDefinitions?: TaskHandlers;
|
|
3973
4645
|
readonly mcp: MCPClientManager;
|
|
3974
4646
|
/**
|
|
3975
4647
|
* Initial state for the Agent
|
|
@@ -4345,8 +5017,6 @@ declare class Agent<
|
|
|
4345
5017
|
* @returns Array of matching QueueItem objects
|
|
4346
5018
|
*/
|
|
4347
5019
|
getQueues(key: string, value: string): QueueItem<string>[];
|
|
4348
|
-
private _facetRunRowsForPrefix;
|
|
4349
|
-
private _deleteFacetRunRowsForPrefix;
|
|
4350
5020
|
private _lifecycleRouteAddress;
|
|
4351
5021
|
private _routeLifecycleToRoot;
|
|
4352
5022
|
private _routeLifecycleToTarget;
|
|
@@ -4356,7 +5026,6 @@ declare class Agent<
|
|
|
4356
5026
|
envelope: LifecycleRouteEnvelope
|
|
4357
5027
|
): Promise<unknown>;
|
|
4358
5028
|
private _rootAlarmOwner;
|
|
4359
|
-
private _cf_rootResolvesToSelf;
|
|
4360
5029
|
/**
|
|
4361
5030
|
* Clean root-owned bookkeeping for a sub-tree of facets. This
|
|
4362
5031
|
* bulk-cancels schedules whose `owner_path` starts with the given
|
|
@@ -4372,8 +5041,8 @@ declare class Agent<
|
|
|
4372
5041
|
): Promise<void>;
|
|
4373
5042
|
/**
|
|
4374
5043
|
* Acquire a root-owned keepAlive ref on behalf of a descendant facet.
|
|
4375
|
-
* Facets
|
|
4376
|
-
* alarm, so this lets facet work use the root alarm heartbeat.
|
|
5044
|
+
* Facets run in separate colocated isolates but cannot set their own
|
|
5045
|
+
* physical alarm, so this lets facet work use the root alarm heartbeat.
|
|
4377
5046
|
* @internal
|
|
4378
5047
|
*/
|
|
4379
5048
|
_cf_acquireFacetKeepAlive(
|
|
@@ -4429,10 +5098,7 @@ declare class Agent<
|
|
|
4429
5098
|
when: Date | string | number,
|
|
4430
5099
|
callback: keyof this,
|
|
4431
5100
|
payload?: T,
|
|
4432
|
-
options?:
|
|
4433
|
-
retry?: RetryOptions;
|
|
4434
|
-
idempotent?: boolean;
|
|
4435
|
-
}
|
|
5101
|
+
options?: ScheduleOptions
|
|
4436
5102
|
): Promise<Schedule<T>>;
|
|
4437
5103
|
/**
|
|
4438
5104
|
* Schedule a task to run repeatedly at a fixed interval.
|
|
@@ -4636,6 +5302,20 @@ declare class Agent<
|
|
|
4636
5302
|
* Throws if called outside a `runFiber` callback.
|
|
4637
5303
|
*/
|
|
4638
5304
|
stash(data: unknown): void;
|
|
5305
|
+
/**
|
|
5306
|
+
* Run `fn` inside the fiber stash context so `this.stash()` keeps working
|
|
5307
|
+
* for turns executing on the `tasks` capability exactly as it does inside
|
|
5308
|
+
* legacy `runFiber()` closures.
|
|
5309
|
+
* @internal
|
|
5310
|
+
*/
|
|
5311
|
+
protected _withFiberStash<T>(
|
|
5312
|
+
context: {
|
|
5313
|
+
id: string;
|
|
5314
|
+
signal: AbortSignal;
|
|
5315
|
+
stash: (data: unknown) => void;
|
|
5316
|
+
},
|
|
5317
|
+
fn: () => Promise<T>
|
|
5318
|
+
): Promise<T>;
|
|
4639
5319
|
/**
|
|
4640
5320
|
* Called when an interrupted fiber is detected after restart.
|
|
4641
5321
|
* Override to implement recovery (re-invoke work, notify clients, etc.).
|
|
@@ -4710,80 +5390,71 @@ declare class Agent<
|
|
|
4710
5390
|
* executing in memory, which already hold a keepAlive ref) or managed
|
|
4711
5391
|
* ledger fibers stuck in a non-terminal state with no live run row.
|
|
4712
5392
|
*
|
|
4713
|
-
* Used by `
|
|
5393
|
+
* Used by `_syncHostJobs` to arm a follow-up alarm so multi-pass
|
|
4714
5394
|
* recovery (e.g. after a scan-deadline yield, or while retrying a throwing
|
|
4715
5395
|
* recovery hook) resumes instead of starving.
|
|
4716
5396
|
* @internal
|
|
4717
5397
|
*/
|
|
4718
5398
|
private _hasPendingFiberRecovery;
|
|
4719
|
-
private _rearmAlarm;
|
|
4720
|
-
/**
|
|
4721
|
-
* Contribute Agent-owned alarm work that has not yet been extracted into its
|
|
4722
|
-
* own capability. Scheduler contributes independently.
|
|
4723
|
-
* @internal
|
|
4724
|
-
*/
|
|
4725
|
-
getNextAlarm(): Promise<AlarmContribution>;
|
|
4726
|
-
/** @internal Transitional alarm contribution for Agent subclasses. */
|
|
4727
|
-
protected _getExtensionAlarm(): number | null | Promise<number | null>;
|
|
4728
|
-
/** Lifecycle alarm callback; Agent housekeeping runs after user alarm work. */
|
|
4729
|
-
onAlarm(): void;
|
|
4730
5399
|
/**
|
|
4731
|
-
*
|
|
5400
|
+
* Synchronize Agent-owned host jobs with current durable state.
|
|
4732
5401
|
*
|
|
4733
|
-
*
|
|
4734
|
-
*
|
|
5402
|
+
* Replaces the old pull-based `getNextAlarm()` contribution: keep-alive
|
|
5403
|
+
* refs hold a `cf:keep-alive` job, and fiber-recovery / facet-run state
|
|
5404
|
+
* holds a `cf:housekeeping` job. Every state change that used to trigger
|
|
5405
|
+
* an alarm recalculation now re-pushes or cancels these jobs; queue
|
|
5406
|
+
* mutations re-arm the physical alarm automatically.
|
|
5407
|
+
* @internal
|
|
4735
5408
|
*/
|
|
4736
|
-
|
|
4737
|
-
/** Run the Lifecycle alarm phase inside Agent's OOM circuit breaker. */
|
|
4738
|
-
private _cf_runAlarmBody;
|
|
5409
|
+
private _syncHostJobs;
|
|
4739
5410
|
/**
|
|
4740
|
-
*
|
|
5411
|
+
* The next wake fiber-recovery or facet-run housekeeping needs, or `null`
|
|
5412
|
+
* when neither has pending durable state.
|
|
4741
5413
|
*/
|
|
4742
|
-
private
|
|
5414
|
+
private _nextHousekeepingWakeMs;
|
|
5415
|
+
/** Lifecycle alarm callback; Agent housekeeping runs after user alarm work. */
|
|
5416
|
+
onAlarm(): void;
|
|
4743
5417
|
/**
|
|
4744
|
-
*
|
|
4745
|
-
*
|
|
4746
|
-
*
|
|
4747
|
-
* so the circuit breaker can surgically back them off / purge them WITHOUT
|
|
4748
|
-
* disturbing unrelated scheduled tasks. See {@link _cf_handleAlarmMemoryLimitReset}.
|
|
5418
|
+
* Drive one Agent-owned host job from the Lifecycle queue.
|
|
5419
|
+
* @internal Dispatched by Lifecycle's alarm event loop; extensions add
|
|
5420
|
+
* job fns through {@link _onHostJob}.
|
|
4749
5421
|
*/
|
|
4750
|
-
|
|
5422
|
+
onJob(
|
|
5423
|
+
context: LifecycleJobContext
|
|
5424
|
+
): LifecycleJobOutcome | void | Promise<LifecycleJobOutcome | void>;
|
|
4751
5425
|
/**
|
|
4752
|
-
*
|
|
4753
|
-
*
|
|
4754
|
-
* budget (#1825). Runs at the outermost alarm frame (post-unwind, so writes
|
|
4755
|
-
* can land). Default: no-op. Chat hosts override to fire `onExhausted` + the
|
|
4756
|
-
* terminal banner and persist the sealed incident.
|
|
5426
|
+
* @internal Dispatch one host job fn. Agent extensions (Think) override
|
|
5427
|
+
* this to add fns and delegate unknown ones to `super`.
|
|
4757
5428
|
*/
|
|
4758
|
-
protected
|
|
5429
|
+
protected _onHostJob(
|
|
5430
|
+
fn: string,
|
|
5431
|
+
_context: LifecycleJobContext
|
|
5432
|
+
): LifecycleJobOutcome | void | Promise<LifecycleJobOutcome | void>;
|
|
4759
5433
|
/**
|
|
4760
|
-
*
|
|
4761
|
-
*
|
|
4762
|
-
*
|
|
4763
|
-
*
|
|
4764
|
-
*
|
|
5434
|
+
* Apply host policy after the alarm memory-limit breaker records a strike.
|
|
5435
|
+
*
|
|
5436
|
+
* New chat hosts override this hook directly. The sealed-only fallback keeps
|
|
5437
|
+
* `agents` 0.23 compatible with already-published chat packages whose peer
|
|
5438
|
+
* ranges accept it but which implement only the former
|
|
5439
|
+
* `_cf_sealMemoryLimitedRecovery` template method. Queue membership remains
|
|
5440
|
+
* job-row policy; this invokes terminalization only and can be removed once
|
|
5441
|
+
* old chat releases no longer accept the current `agents` range.
|
|
5442
|
+
*
|
|
5443
|
+
* @internal
|
|
4765
5444
|
*/
|
|
4766
|
-
|
|
5445
|
+
protected onAlarmMemoryLimit(context: MemoryLimitContext): Promise<void>;
|
|
4767
5446
|
/**
|
|
4768
|
-
*
|
|
4769
|
-
* (#1825). The in-DO recovery budgets (`chatRecovery.maxOomRetries` /
|
|
4770
|
-
* `maxRecoveryWork`) only engage if their code runs AND its writes land; a
|
|
4771
|
-
* severe OOM can defeat both — thrown before the budget runs (boot hydration),
|
|
4772
|
-
* or its own small writes also OOM under memory pressure. In that case the
|
|
4773
|
-
* error reaches {@link alarm} and, unhandled, the platform auto-retries the
|
|
4774
|
-
* alarm indefinitely (re-running the doomed, billable turn each cycle).
|
|
5447
|
+
* Run Lifecycle's alarm event loop after the pending-destroy preamble.
|
|
4775
5448
|
*
|
|
4776
|
-
*
|
|
4777
|
-
*
|
|
4778
|
-
*
|
|
4779
|
-
*
|
|
4780
|
-
*
|
|
4781
|
-
*
|
|
4782
|
-
*
|
|
4783
|
-
* swallowing (not re-throwing) still halts the platform's auto-retry, and a
|
|
4784
|
-
* later wake re-arms legitimate schedules.
|
|
5449
|
+
* The alarm memory-limit circuit breaker (#1825) lives inside
|
|
5450
|
+
* `Lifecycle.alarm()`; capabilities and hosts opt into extra domain
|
|
5451
|
+
* policy via their `onMemoryLimit` / `onAlarmMemoryLimit` hooks and the
|
|
5452
|
+
* `recoveryLoop` schedule option.
|
|
5453
|
+
*
|
|
5454
|
+
* @remarks Use `this.schedule()` for named Agent callbacks. Reusable durable
|
|
5455
|
+
* work belongs in a capability that pushes jobs and implements `onJob()`.
|
|
4785
5456
|
*/
|
|
4786
|
-
|
|
5457
|
+
alarm(): Promise<void>;
|
|
4787
5458
|
/**
|
|
4788
5459
|
* Intercept incoming HTTP/WS requests whose URL contains a
|
|
4789
5460
|
* `/sub/{child-class}/{child-name}` marker and forward them to
|
|
@@ -4792,9 +5463,9 @@ declare class Agent<
|
|
|
4792
5463
|
* Response, the framework resolves the facet and hands the
|
|
4793
5464
|
* request off.
|
|
4794
5465
|
*
|
|
4795
|
-
*
|
|
4796
|
-
*
|
|
4797
|
-
*
|
|
5466
|
+
* The parent owns an upgraded WebSocket for its lifetime. Subsequent
|
|
5467
|
+
* frames wake the root parent, which forwards them to the child over
|
|
5468
|
+
* RPC and routes replies back to the native socket.
|
|
4798
5469
|
*
|
|
4799
5470
|
* @experimental The API surface may change before stabilizing.
|
|
4800
5471
|
*/
|
|
@@ -4805,25 +5476,6 @@ declare class Agent<
|
|
|
4805
5476
|
): void;
|
|
4806
5477
|
getConnection<TState = unknown>(id: string): Connection<TState> | undefined;
|
|
4807
5478
|
getConnections<TState = unknown>(tag?: string): Iterable<Connection<TState>>;
|
|
4808
|
-
private _cf_activeSubAgentBridge;
|
|
4809
|
-
/**
|
|
4810
|
-
* Route a virtual sub-agent connection operation through its live frame
|
|
4811
|
-
* bridge, or through the durable root Agent after that frame completes.
|
|
4812
|
-
* All operations share one per-connection queue. Facet broadcasts wait for
|
|
4813
|
-
* older queued operations; failures do not block later work.
|
|
4814
|
-
*/
|
|
4815
|
-
private _cf_routeSubAgentConnectionOperation;
|
|
4816
|
-
/**
|
|
4817
|
-
* Route a facet broadcast after every older connection operation.
|
|
4818
|
-
*
|
|
4819
|
-
* This barrier is intentionally one-way: facet startup can broadcast before
|
|
4820
|
-
* a child connection has finished initializing its tags and protocol flags.
|
|
4821
|
-
* Making those later connection operations wait would let the next frame
|
|
4822
|
-
* observe stale root-owned metadata.
|
|
4823
|
-
*/
|
|
4824
|
-
private _cf_routeSubAgentBroadcast;
|
|
4825
|
-
private _cf_reportSubAgentConnectionOperationFailure;
|
|
4826
|
-
private _cf_broadcastToParentSubAgent;
|
|
4827
5479
|
_cf_broadcastToSubAgent(
|
|
4828
5480
|
ownerPath: ReadonlyArray<AgentPathStep>,
|
|
4829
5481
|
message: string | ArrayBuffer | ArrayBufferView,
|
|
@@ -4831,7 +5483,7 @@ declare class Agent<
|
|
|
4831
5483
|
): Promise<void>;
|
|
4832
5484
|
_cf_subAgentConnectionMetas(
|
|
4833
5485
|
ownerPath: ReadonlyArray<AgentPathStep>
|
|
4834
|
-
): Promise<
|
|
5486
|
+
): Promise<DynamicAgentConnectionMeta[]>;
|
|
4835
5487
|
_cf_sendToSubAgentConnection(
|
|
4836
5488
|
connectionId: string,
|
|
4837
5489
|
message: string | ArrayBuffer | ArrayBufferView
|
|
@@ -4845,11 +5497,6 @@ declare class Agent<
|
|
|
4845
5497
|
connectionId: string,
|
|
4846
5498
|
state: unknown
|
|
4847
5499
|
): Promise<unknown>;
|
|
4848
|
-
private _cf_subAgentConnectionMetaForPath;
|
|
4849
|
-
private _cf_subAgentTargetPath;
|
|
4850
|
-
private _cf_subAgentPathFromOuterUri;
|
|
4851
|
-
private _isSameAgentPath;
|
|
4852
|
-
private _cf_connectionHasSubAgentTarget;
|
|
4853
5500
|
protected _cf_connectionTargetsSubAgent(connection: Connection): boolean;
|
|
4854
5501
|
/**
|
|
4855
5502
|
* Returns true when the current request is addressed to a child facet of
|
|
@@ -4861,33 +5508,26 @@ declare class Agent<
|
|
|
4861
5508
|
*/
|
|
4862
5509
|
protected _cf_requestTargetsSubAgent(request: Request): boolean;
|
|
4863
5510
|
private _cf_forwardSubAgentWebSocketConnect;
|
|
4864
|
-
private _cf_createSubAgentConnectionBridge;
|
|
4865
5511
|
private _cf_forwardSubAgentWebSocketMessage;
|
|
4866
5512
|
private _cf_forwardSubAgentWebSocketClose;
|
|
4867
|
-
private _cf_resolveSubAgentConnection;
|
|
4868
5513
|
_cf_handleSubAgentWebSocketConnect(
|
|
4869
|
-
bridge:
|
|
4870
|
-
meta:
|
|
5514
|
+
bridge: DynamicAgentConnectionBridge,
|
|
5515
|
+
meta: DynamicAgentConnectionMeta
|
|
4871
5516
|
): Promise<void>;
|
|
4872
5517
|
_cf_handleSubAgentWebSocketMessage(
|
|
4873
5518
|
message: WSMessage,
|
|
4874
|
-
bridge:
|
|
4875
|
-
meta:
|
|
4876
|
-
replyBridge?:
|
|
5519
|
+
bridge: DynamicAgentConnectionBridge,
|
|
5520
|
+
meta: DynamicAgentConnectionMeta,
|
|
5521
|
+
replyBridge?: DynamicAgentConnectionBridge
|
|
4877
5522
|
): Promise<void>;
|
|
4878
5523
|
_cf_handleSubAgentWebSocketClose(
|
|
4879
5524
|
code: number,
|
|
4880
5525
|
reason: string,
|
|
4881
5526
|
wasClean: boolean,
|
|
4882
|
-
bridge:
|
|
4883
|
-
meta:
|
|
5527
|
+
bridge: DynamicAgentConnectionBridge,
|
|
5528
|
+
meta: DynamicAgentConnectionMeta
|
|
4884
5529
|
): Promise<void>;
|
|
4885
|
-
private _cf_runWithSubAgentBridge;
|
|
4886
|
-
private _cf_createSubAgentBridgeConnection;
|
|
4887
|
-
private _cf_storeVirtualSubAgentConnection;
|
|
4888
5530
|
protected _cf_hydrateSubAgentConnectionsFromRoot(): Promise<void>;
|
|
4889
|
-
private _cf_getRawConnectionState;
|
|
4890
|
-
private _cf_getForwardedSubAgentState;
|
|
4891
5531
|
/**
|
|
4892
5532
|
* Parent-side middleware hook. Fires before a request is
|
|
4893
5533
|
* forwarded into a facet sub-agent. Mirrors `onBeforeConnect` /
|
|
@@ -4923,7 +5563,7 @@ declare class Agent<
|
|
|
4923
5563
|
* class Inbox extends Agent {
|
|
4924
5564
|
* override async onBeforeSubAgent(req, { className, name }) {
|
|
4925
5565
|
* // Strict registry gate
|
|
4926
|
-
* if (!this.
|
|
5566
|
+
* if (!this.dynamicAgents.has(className, name)) {
|
|
4927
5567
|
* return new Response("Not found", { status: 404 });
|
|
4928
5568
|
* }
|
|
4929
5569
|
* }
|
|
@@ -4973,7 +5613,6 @@ declare class Agent<
|
|
|
4973
5613
|
method: string,
|
|
4974
5614
|
args: unknown[]
|
|
4975
5615
|
): Promise<unknown>;
|
|
4976
|
-
private _cf_invokeStubMethod;
|
|
4977
5616
|
/**
|
|
4978
5617
|
* Initialize this agent as a facet in a single RPC.
|
|
4979
5618
|
*
|
|
@@ -5080,7 +5719,7 @@ declare class Agent<
|
|
|
5080
5719
|
* ```
|
|
5081
5720
|
*/
|
|
5082
5721
|
parentAgent<T extends Agent>(
|
|
5083
|
-
cls:
|
|
5722
|
+
cls: DynamicAgentClass<T>
|
|
5084
5723
|
): Promise<DurableObjectStub<T>>;
|
|
5085
5724
|
private _cf_getTopLevelNamespaceByClassName;
|
|
5086
5725
|
private _cf_asDurableObjectNamespace;
|
|
@@ -5105,11 +5744,13 @@ declare class Agent<
|
|
|
5105
5744
|
* const searcher = await this.subAgent(SearchAgent, "main-search");
|
|
5106
5745
|
* const results = await searcher.search("cloudflare agents");
|
|
5107
5746
|
* ```
|
|
5747
|
+
*
|
|
5748
|
+
* @deprecated Use {@link Agent.dynamicAgents | this.dynamicAgents.get()} instead.
|
|
5108
5749
|
*/
|
|
5109
5750
|
subAgent<T extends Agent>(
|
|
5110
|
-
cls:
|
|
5751
|
+
cls: DynamicAgentClass<T>,
|
|
5111
5752
|
name: string
|
|
5112
|
-
): Promise<
|
|
5753
|
+
): Promise<DynamicAgentStub<T>>;
|
|
5113
5754
|
/** Maximum number of non-terminal agent-tool runs this parent may own at once. */
|
|
5114
5755
|
maxConcurrentAgentTools: number;
|
|
5115
5756
|
onAgentToolStart(_run: AgentToolRunInfo): Promise<void>;
|
|
@@ -5244,7 +5885,7 @@ declare class Agent<
|
|
|
5244
5885
|
*/
|
|
5245
5886
|
_cfDetachedReconcileTick(payload?: DetachedReconcilePayload): Promise<void>;
|
|
5246
5887
|
hasAgentToolRun<T extends Agent>(
|
|
5247
|
-
cls:
|
|
5888
|
+
cls: DynamicAgentClass<T>,
|
|
5248
5889
|
runId: string
|
|
5249
5890
|
): boolean;
|
|
5250
5891
|
hasAgentToolRun(agentType: string, runId: string): boolean;
|
|
@@ -5398,6 +6039,13 @@ declare class Agent<
|
|
|
5398
6039
|
* @internal
|
|
5399
6040
|
*/
|
|
5400
6041
|
private _cf_resolveSubAgent;
|
|
6042
|
+
/**
|
|
6043
|
+
* Run `body` in a fresh invocation scope with no native request/
|
|
6044
|
+
* connection context attached, so a child-facet RPC never sees
|
|
6045
|
+
* parent-owned I/O handles.
|
|
6046
|
+
* @internal
|
|
6047
|
+
*/
|
|
6048
|
+
private _runFacetInitInvocation;
|
|
5401
6049
|
/**
|
|
5402
6050
|
* Forcefully abort a running sub-agent. The child stops executing
|
|
5403
6051
|
* immediately and will be restarted on next {@link subAgent} call.
|
|
@@ -5409,8 +6057,10 @@ declare class Agent<
|
|
|
5409
6057
|
* @param cls The Agent subclass used when creating the child
|
|
5410
6058
|
* @param name Name of the child to abort
|
|
5411
6059
|
* @param reason Error thrown to pending/future RPC callers
|
|
6060
|
+
*
|
|
6061
|
+
* @deprecated Use {@link Agent.dynamicAgents | this.dynamicAgents.abort()} instead.
|
|
5412
6062
|
*/
|
|
5413
|
-
abortSubAgent(cls:
|
|
6063
|
+
abortSubAgent(cls: DynamicAgentClass, name: string, reason?: unknown): void;
|
|
5414
6064
|
/**
|
|
5415
6065
|
* Delete a sub-agent: abort it if running, then permanently wipe its
|
|
5416
6066
|
* storage. Transitively deletes the child's own children.
|
|
@@ -5419,20 +6069,10 @@ declare class Agent<
|
|
|
5419
6069
|
*
|
|
5420
6070
|
* @param cls The Agent subclass used when creating the child
|
|
5421
6071
|
* @param name Name of the child to delete
|
|
6072
|
+
*
|
|
6073
|
+
* @deprecated Use {@link Agent.dynamicAgents | this.dynamicAgents.delete()} instead.
|
|
5422
6074
|
*/
|
|
5423
|
-
deleteSubAgent(cls:
|
|
5424
|
-
/** @internal */
|
|
5425
|
-
private _subAgentRegistryReady;
|
|
5426
|
-
private _addColumnIfNotExists;
|
|
5427
|
-
/** @internal */
|
|
5428
|
-
private _ensureSubAgentRegistry;
|
|
5429
|
-
/** @internal */
|
|
5430
|
-
private _recordSubAgent;
|
|
5431
|
-
/** @internal */
|
|
5432
|
-
private _subAgentRegistryRow;
|
|
5433
|
-
private _cf_subAgentIdentity;
|
|
5434
|
-
/** @internal */
|
|
5435
|
-
private _forgetSubAgent;
|
|
6075
|
+
deleteSubAgent(cls: DynamicAgentClass, name: string): Promise<void>;
|
|
5436
6076
|
/**
|
|
5437
6077
|
* Whether this agent has previously spawned (and not deleted) a
|
|
5438
6078
|
* sub-agent of the given class and name. Backed by an
|
|
@@ -5451,8 +6091,13 @@ declare class Agent<
|
|
|
5451
6091
|
* }
|
|
5452
6092
|
* }
|
|
5453
6093
|
* ```
|
|
6094
|
+
*
|
|
6095
|
+
* @deprecated Use {@link Agent.dynamicAgents | this.dynamicAgents.has()} instead.
|
|
5454
6096
|
*/
|
|
5455
|
-
hasSubAgent<T extends Agent>(
|
|
6097
|
+
hasSubAgent<T extends Agent>(
|
|
6098
|
+
cls: DynamicAgentClass<T>,
|
|
6099
|
+
name: string
|
|
6100
|
+
): boolean;
|
|
5456
6101
|
hasSubAgent(className: string, name: string): boolean;
|
|
5457
6102
|
/**
|
|
5458
6103
|
* List known sub-agents, optionally filtered by class. Reflects
|
|
@@ -5460,9 +6105,11 @@ declare class Agent<
|
|
|
5460
6105
|
* {@link deleteSubAgent}.
|
|
5461
6106
|
*
|
|
5462
6107
|
* @experimental The API surface may change before stabilizing.
|
|
6108
|
+
*
|
|
6109
|
+
* @deprecated Use {@link Agent.dynamicAgents | this.dynamicAgents.list()} instead.
|
|
5463
6110
|
*/
|
|
5464
6111
|
listSubAgents<T extends Agent>(
|
|
5465
|
-
cls:
|
|
6112
|
+
cls: DynamicAgentClass<T>
|
|
5466
6113
|
): Array<{
|
|
5467
6114
|
className: string;
|
|
5468
6115
|
name: string;
|
|
@@ -6168,147 +6815,144 @@ declare function getAgentByName<
|
|
|
6168
6815
|
): Promise<DurableObjectStub<T>>;
|
|
6169
6816
|
//#endregion
|
|
6170
6817
|
export {
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6187
|
-
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
|
|
6195
|
-
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6199
|
-
|
|
6200
|
-
|
|
6201
|
-
|
|
6202
|
-
|
|
6203
|
-
|
|
6204
|
-
|
|
6205
|
-
|
|
6206
|
-
|
|
6207
|
-
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
6219
|
-
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6224
|
-
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
|
|
6230
|
-
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6235
|
-
FiberInspection as _,
|
|
6236
|
-
MCPStorageApi as _n,
|
|
6237
|
-
RunWorkflowOptions as _t,
|
|
6818
|
+
ChatCapableAgentClass as $,
|
|
6819
|
+
RPC_DO_PREFIX as $t,
|
|
6820
|
+
StreamingResponse as A,
|
|
6821
|
+
routeSubAgentRequest as An,
|
|
6822
|
+
MCPAITool as At,
|
|
6823
|
+
AgentToolFailure as B,
|
|
6824
|
+
MCPOAuthCallbackResult as Bt,
|
|
6825
|
+
MCPServersState as C,
|
|
6826
|
+
SubAgentPathMatch as Cn,
|
|
6827
|
+
WorkflowProgressCallback as Ct,
|
|
6828
|
+
StartFiberOptions as D,
|
|
6829
|
+
buildSubAgentPathUnchecked as Dn,
|
|
6830
|
+
WorkflowTrackingRow as Dt,
|
|
6831
|
+
RPCResponse as E,
|
|
6832
|
+
buildSubAgentPath as En,
|
|
6833
|
+
WorkflowStatus as Et,
|
|
6834
|
+
AgentToolChildAdapter as F,
|
|
6835
|
+
MCPClientManagerOptions as Ft,
|
|
6836
|
+
AgentToolProgressSnapshot as G,
|
|
6837
|
+
getNamespacedData as Gt,
|
|
6838
|
+
AgentToolLifecycleResult as H,
|
|
6839
|
+
MCPServerOptions as Ht,
|
|
6840
|
+
AgentToolDisplayMetadata as I,
|
|
6841
|
+
MCPClientOAuthCallbackConfig as It,
|
|
6842
|
+
AgentToolRunPart as J,
|
|
6843
|
+
MCPElicitationHandlers as Jt,
|
|
6844
|
+
AgentToolRunInfo as K,
|
|
6845
|
+
normalizeServerId as Kt,
|
|
6846
|
+
AgentToolEvent as L,
|
|
6847
|
+
MCPClientOAuthResult as Lt,
|
|
6848
|
+
routeAgentEmail as M,
|
|
6849
|
+
MCPClientElicitationHandler as Mt,
|
|
6850
|
+
AGENT_TOOL_MILESTONE_PART as N,
|
|
6851
|
+
MCPClientElicitationHandlers as Nt,
|
|
6852
|
+
StartFiberResult as O,
|
|
6853
|
+
getSubAgentByName as On,
|
|
6854
|
+
ElicitRequest$1 as Ot,
|
|
6855
|
+
AGENT_TOOL_PROGRESS_PART as P,
|
|
6856
|
+
MCPClientManager as Pt,
|
|
6857
|
+
AgentToolTerminalStatus as Q,
|
|
6858
|
+
RPCServerTransportOptions as Qt,
|
|
6859
|
+
AgentToolEventMessage as R,
|
|
6860
|
+
MCPConnectionResult as Rt,
|
|
6861
|
+
MCPServerMessage as S,
|
|
6862
|
+
SUB_PREFIX as Sn,
|
|
6863
|
+
WorkflowPage as St,
|
|
6864
|
+
RPCRequest as T,
|
|
6865
|
+
buildAgentUrl as Tn,
|
|
6866
|
+
WorkflowRejectedError as Tt,
|
|
6867
|
+
AgentToolMilestone as U,
|
|
6868
|
+
MCP_SERVER_ID_MAX_LENGTH as Ut,
|
|
6869
|
+
AgentToolInterruptedReason as V,
|
|
6870
|
+
MCPServerFilter as Vt,
|
|
6871
|
+
AgentToolProgress as W,
|
|
6872
|
+
RegisterServerOptions as Wt,
|
|
6873
|
+
AgentToolRunStatus as X,
|
|
6874
|
+
RPCClientTransportOptions as Xt,
|
|
6875
|
+
AgentToolRunState as Y,
|
|
6876
|
+
RPCClientTransport as Yt,
|
|
6877
|
+
AgentToolStoredChunk as Z,
|
|
6878
|
+
RPCServerTransport as Zt,
|
|
6879
|
+
FiberRecoveryContext as _,
|
|
6880
|
+
StreamableHTTPEdgeClientTransport as _n,
|
|
6881
|
+
WorkflowCompleteCallback as _t,
|
|
6238
6882
|
routeAgentRequest as a,
|
|
6239
|
-
|
|
6240
|
-
|
|
6241
|
-
|
|
6242
|
-
|
|
6243
|
-
|
|
6883
|
+
DurableObjectEventStore as an,
|
|
6884
|
+
AgentWorkflowInternalParams as at,
|
|
6885
|
+
ListFibersOptions as b,
|
|
6886
|
+
AgentPathStep as bn,
|
|
6887
|
+
WorkflowEventPayload as bt,
|
|
6244
6888
|
Agent as c,
|
|
6245
|
-
|
|
6246
|
-
|
|
6889
|
+
CreateLegacyMcpHandlerOptions as cn,
|
|
6890
|
+
AgentWorkflowPathStep as ct,
|
|
6247
6891
|
AgentStaticOptions as d,
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6892
|
+
createLegacyMcpHandler as dn,
|
|
6893
|
+
DefaultProgress as dt,
|
|
6894
|
+
ElicitRequest$2 as en,
|
|
6895
|
+
DetachedAgentToolConfig as et,
|
|
6896
|
+
DEFAULT_AGENT_STATIC_OPTIONS as f,
|
|
6897
|
+
MCPStorageApi as fn,
|
|
6898
|
+
RunWorkflowOptions as ft,
|
|
6899
|
+
FiberInspection as g,
|
|
6900
|
+
SSEEdgeClientTransport as gn,
|
|
6901
|
+
WorkflowCallbackType as gt,
|
|
6902
|
+
FiberContext as h,
|
|
6903
|
+
WorkerTransportOptions as hn,
|
|
6904
|
+
WorkflowCallbackBase as ht,
|
|
6261
6905
|
getAgentByName as i,
|
|
6262
|
-
|
|
6263
|
-
|
|
6264
|
-
|
|
6265
|
-
|
|
6266
|
-
|
|
6267
|
-
|
|
6268
|
-
|
|
6269
|
-
|
|
6906
|
+
ClearableEventStore as in,
|
|
6907
|
+
AgentWorkflowEvent as it,
|
|
6908
|
+
getCurrentAgent as j,
|
|
6909
|
+
withInvocationScope as jn,
|
|
6910
|
+
MCPAIToolSet as jt,
|
|
6911
|
+
StateUpdateMessage as k,
|
|
6912
|
+
parseSubAgentPath as kn,
|
|
6913
|
+
ElicitResult$2 as kt,
|
|
6270
6914
|
AgentContext as l,
|
|
6271
|
-
|
|
6272
|
-
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6915
|
+
CreateMcpHandlerOptions$1 as ln,
|
|
6916
|
+
AgentWorkflowStep as lt,
|
|
6917
|
+
EmailRoutingOptions as m,
|
|
6918
|
+
WorkerTransport as mn,
|
|
6919
|
+
WorkflowCallback as mt,
|
|
6276
6920
|
AgentOptions as n,
|
|
6277
|
-
|
|
6278
|
-
|
|
6921
|
+
ElicitResult$3 as nn,
|
|
6922
|
+
RunAgentToolOptions as nt,
|
|
6279
6923
|
AddMcpServerOptions as o,
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6286
|
-
|
|
6924
|
+
createMcpHandler$1 as on,
|
|
6925
|
+
AgentWorkflowOrigin as ot,
|
|
6926
|
+
DeleteFibersOptions as p,
|
|
6927
|
+
TransportState as pn,
|
|
6928
|
+
WaitForApprovalOptions as pt,
|
|
6929
|
+
AgentToolRunInspection as q,
|
|
6930
|
+
MCPElicitationHandler as qt,
|
|
6287
6931
|
RoutingRetryOptions as r,
|
|
6288
|
-
|
|
6289
|
-
|
|
6932
|
+
McpAgent as rn,
|
|
6933
|
+
RunAgentToolResult as rt,
|
|
6290
6934
|
AddRpcMcpServerOptions as s,
|
|
6291
|
-
|
|
6292
|
-
|
|
6935
|
+
experimental_createMcpHandler as sn,
|
|
6936
|
+
AgentWorkflowParams as st,
|
|
6293
6937
|
AgentGetOptions as t,
|
|
6294
|
-
|
|
6295
|
-
|
|
6938
|
+
ElicitRequestSchema as tn,
|
|
6939
|
+
DetachedRunAgentToolResult as tt,
|
|
6296
6940
|
AgentNamespace as u,
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6941
|
+
LegacyMcpHandler as un,
|
|
6942
|
+
ApprovalEventPayload as ut,
|
|
6943
|
+
FiberRecoveryResult as v,
|
|
6944
|
+
DynamicAgentClass as vn,
|
|
6945
|
+
WorkflowErrorCallback as vt,
|
|
6946
|
+
QueueItem as w,
|
|
6947
|
+
buildAgentPath as wn,
|
|
6948
|
+
WorkflowQueryCriteria as wt,
|
|
6949
|
+
MCPServer as x,
|
|
6950
|
+
BuildAgentPathOptions as xn,
|
|
6951
|
+
WorkflowInfo as xt,
|
|
6952
|
+
FiberStatus as y,
|
|
6953
|
+
DynamicAgentStub as yn,
|
|
6954
|
+
WorkflowEventCallback as yt,
|
|
6955
|
+
AgentToolEventState as z,
|
|
6956
|
+
MCPDiscoverResult as zt
|
|
6313
6957
|
};
|
|
6314
|
-
//# sourceMappingURL=agent-routing-
|
|
6958
|
+
//# sourceMappingURL=agent-routing-DE5zmCQ8.d.ts.map
|