agents 0.23.0 → 0.24.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/dist/{agent-routing-DE5zmCQ8.d.ts → agent-routing-B2XLNMxq.d.ts} +196 -189
- package/dist/agent-routing.d.ts +1 -1
- package/dist/agent-tool-types.d.ts +26 -26
- package/dist/{agent-tools-DtXMTDGM.d.ts → agent-tools-Dj5Mzlw7.d.ts} +7 -7
- package/dist/agent-tools.d.ts +21 -21
- package/dist/{capability-BjSKYpzg.js → capability-B4WbF81e.js} +2 -1
- package/dist/capability-B4WbF81e.js.map +1 -0
- package/dist/{capability-runner-Be_-PLR1.d.ts → capability-runner-BUBa6Ake.d.ts} +40 -15
- package/dist/chat/index.d.ts +14 -11
- package/dist/chat/index.js +11 -7
- package/dist/chat/index.js.map +1 -1
- package/dist/chat-sdk/index.d.ts +3 -3
- package/dist/chat-sdk/index.js +1 -1
- package/dist/client-BxdkCuVy.d.ts +411 -0
- package/dist/client-C9DAjZIY.js +518 -0
- package/dist/client-C9DAjZIY.js.map +1 -0
- package/dist/{client-jagG8a9_.js → client-fyQrLGkD.js} +2 -2
- package/dist/{client-jagG8a9_.js.map → client-fyQrLGkD.js.map} +1 -1
- package/dist/client.d.ts +27 -283
- package/dist/client.js +2 -274
- package/dist/current-agent-C4w86kcN.d.ts +93 -0
- package/dist/{current-agent-Da_C9a3b.d.ts → durable-object-lifecycle-ei7M7lqB.d.ts} +13 -122
- package/dist/index-Dlgtd3Mj.d.ts +78 -0
- package/dist/index.d.ts +59 -59
- package/dist/index.js +2 -2
- package/dist/internal_context.d.ts +1 -1
- package/dist/lifecycle/index.d.ts +19 -17
- package/dist/lifecycle/index.js +2 -2
- package/dist/{lifecycle-CMRGjZdw.js → lifecycle-Mm_jQh7r.js} +36 -21
- package/dist/lifecycle-Mm_jQh7r.js.map +1 -0
- package/dist/mcp/client/index.d.ts +20 -20
- package/dist/mcp/client/index.js +1 -1
- package/dist/mcp/index.d.ts +35 -35
- package/dist/mcp/index.js +2 -2
- package/dist/queue/index.d.ts +123 -0
- package/dist/queue/index.js +2 -0
- package/dist/queue-BC9F5cUo.js +406 -0
- package/dist/queue-BC9F5cUo.js.map +1 -0
- package/dist/react.d.ts +33 -15
- package/dist/react.js +31 -8
- package/dist/react.js.map +1 -1
- package/dist/{retries-D9Ds-1lz.d.ts → retries-D9B2UCq3.d.ts} +9 -3
- package/dist/retries.d.ts +5 -3
- package/dist/retries.js +9 -1
- package/dist/retries.js.map +1 -1
- package/dist/routing/index.d.ts +2 -2
- package/dist/routing/index.js +1 -1
- package/dist/{scheduler-Dwh85ZGl.d.ts → scheduler-BGq6M5Kd.d.ts} +6 -6
- package/dist/{scheduler-DD9NdYbF.js → scheduler-D_KHqxBa.js} +4 -11
- package/dist/scheduler-D_KHqxBa.js.map +1 -0
- package/dist/schedules/index.d.ts +1 -1
- package/dist/schedules/index.js +1 -1
- package/dist/serializable.d.ts +1 -1
- package/dist/sessions/index.d.ts +1 -1
- package/dist/sessions/index.js +1 -1
- package/dist/{src-DlSHshb2.js → src-BNU3ZiJM.js} +126 -393
- package/dist/src-BNU3ZiJM.js.map +1 -0
- package/dist/state/index.d.ts +6 -0
- package/dist/state/index.js +137 -0
- package/dist/state/index.js.map +1 -0
- package/dist/streams/index.d.ts +1 -1
- package/dist/streams/index.js +1 -1
- package/dist/{streams-D6tJ0NN9.d.ts → streams-BcE8JP2X.d.ts} +2 -2
- package/dist/{streams-DZKgAj9b.js → streams-CCPRV6dt.js} +2 -2
- package/dist/{streams-DZKgAj9b.js.map → streams-CCPRV6dt.js.map} +1 -1
- package/dist/sub-routing.d.ts +12 -12
- package/dist/tasks/index.d.ts +1 -1
- package/dist/tasks/index.js +1 -1
- package/dist/{tasks-ylZgBjhj.js → tasks-D4nLqVSI.js} +3 -3
- package/dist/{tasks-ylZgBjhj.js.map → tasks-D4nLqVSI.js.map} +1 -1
- package/dist/{tasks-BRJ5zgya.d.ts → tasks-V2lCT8ZV.d.ts} +5 -5
- package/dist/transport-protocol-BxyngQ_R.js +25 -0
- package/dist/transport-protocol-BxyngQ_R.js.map +1 -0
- package/dist/transport-protocol-ZTew5Wso.d.ts +27 -0
- package/dist/types-DCD6BNZH.d.ts +70 -0
- package/dist/voice/index.d.ts +2 -2
- package/dist/websockets/index.d.ts +178 -69
- package/dist/websockets/index.js +3 -2
- package/dist/websockets-D7IzWbZb.js +1005 -0
- package/dist/websockets-D7IzWbZb.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/client-sdk.md +30 -0
- package/docs/index.md +1 -1
- package/docs/lifecycle.md +97 -22
- package/docs/queue.md +135 -241
- package/docs/retries.md +1 -1
- package/docs/sub-agents.md +3 -3
- package/package.json +12 -2
- package/dist/capability-BjSKYpzg.js.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/lifecycle-CMRGjZdw.js.map +0 -1
- package/dist/scheduler-DD9NdYbF.js.map +0 -1
- package/dist/src-DlSHshb2.js.map +0 -1
- package/dist/websockets-DUfRHPRq.js +0 -502
- package/dist/websockets-DUfRHPRq.js.map +0 -1
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
S as ConnectionContext,
|
|
3
|
+
T as WSMessage,
|
|
4
|
+
_ as LifecycleJobContext,
|
|
5
5
|
o as MemoryLimitContext,
|
|
6
6
|
s as LifecycleCapability,
|
|
7
7
|
t as CapabilityRequestContext,
|
|
8
8
|
u as LifecycleRouteAddress,
|
|
9
|
-
|
|
10
|
-
x as
|
|
11
|
-
} from "./capability-runner-
|
|
12
|
-
import { t as RetryOptions } from "./retries-
|
|
9
|
+
v as LifecycleJobOutcome,
|
|
10
|
+
x as Connection
|
|
11
|
+
} from "./capability-runner-BUBa6Ake.js";
|
|
12
|
+
import { t as RetryOptions } from "./retries-D9B2UCq3.js";
|
|
13
13
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} from "./current-agent-
|
|
14
|
+
r as LifecycleRouteEnvelope,
|
|
15
|
+
t as Lifecycle
|
|
16
|
+
} from "./durable-object-lifecycle-ei7M7lqB.js";
|
|
17
|
+
import { n as CurrentAgentContext } from "./current-agent-C4w86kcN.js";
|
|
18
18
|
import { t as AgentEmail } from "./internal_context-BlxFEWfn.js";
|
|
19
19
|
import { r as EmailResolver, s as SendEmailOptions } from "./email-7TatiTnl.js";
|
|
20
20
|
import {
|
|
@@ -41,8 +41,10 @@ import {
|
|
|
41
41
|
i as Schedule,
|
|
42
42
|
o as ScheduleOptions,
|
|
43
43
|
t as Scheduler
|
|
44
|
-
} from "./scheduler-
|
|
45
|
-
import {
|
|
44
|
+
} from "./scheduler-BGq6M5Kd.js";
|
|
45
|
+
import { i as QueueItem } from "./types-DCD6BNZH.js";
|
|
46
|
+
import { l as TaskHandlers, r as Tasks } from "./tasks-V2lCT8ZV.js";
|
|
47
|
+
import { t as State } from "./index-Dlgtd3Mj.js";
|
|
46
48
|
import { t as CallableMetadata } from "./callable-decorator-DP__HhBA.js";
|
|
47
49
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
48
50
|
import {
|
|
@@ -561,6 +563,9 @@ interface DynamicAgentHostPort {
|
|
|
561
563
|
readonly tasks: {
|
|
562
564
|
__DO_NOT_USE_WILL_BREAK__cleanupRoutePrefix(prefix: string): Promise<void>;
|
|
563
565
|
};
|
|
566
|
+
readonly _queue: {
|
|
567
|
+
__DO_NOT_USE_WILL_BREAK__cleanupRoutePrefix(prefix: string): Promise<void>;
|
|
568
|
+
};
|
|
564
569
|
/** Local (non-facet-index) durable fiber recovery pass. */
|
|
565
570
|
_checkRunFibers(): Promise<void>;
|
|
566
571
|
/** Overridable RPC entry points — call via the host so subclass overrides intercept. */
|
|
@@ -586,20 +591,12 @@ interface DynamicAgentHostPort {
|
|
|
586
591
|
tag?: string
|
|
587
592
|
): Iterable<Connection<TState>>;
|
|
588
593
|
};
|
|
589
|
-
_ensureConnectionWrapped(connection: Connection): void;
|
|
590
594
|
_unsafe_getConnectionFlag(connection: Connection, key: string): unknown;
|
|
591
595
|
_unsafe_setConnectionFlag(
|
|
592
596
|
connection: Connection,
|
|
593
597
|
key: string,
|
|
594
598
|
value: unknown
|
|
595
599
|
): void;
|
|
596
|
-
readonly _rawStateAccessors: {
|
|
597
|
-
get(connection: Connection):
|
|
598
|
-
| {
|
|
599
|
-
getRaw(): unknown;
|
|
600
|
-
}
|
|
601
|
-
| undefined;
|
|
602
|
-
};
|
|
603
600
|
shouldConnectionBeReadonly(
|
|
604
601
|
connection: Connection,
|
|
605
602
|
context: {
|
|
@@ -613,7 +610,6 @@ interface DynamicAgentHostPort {
|
|
|
613
610
|
request: Request;
|
|
614
611
|
}
|
|
615
612
|
): boolean;
|
|
616
|
-
_setConnectionNoProtocol(connection: Connection): void;
|
|
617
613
|
getConnectionTags(
|
|
618
614
|
connection: Connection,
|
|
619
615
|
context: {
|
|
@@ -692,8 +688,9 @@ declare class DynamicAgentsInternal extends LifecycleCapability {
|
|
|
692
688
|
rootResolvesToSelf(): boolean;
|
|
693
689
|
/**
|
|
694
690
|
* Clean root-owned bookkeeping for a sub-tree of facets: bulk-cancel
|
|
695
|
-
* schedules and routed Task wake mirrors under the
|
|
696
|
-
* and delete root-side facet fiber recovery leases for
|
|
691
|
+
* schedules, queue items, and routed Task wake mirrors under the
|
|
692
|
+
* owner-path prefix, and delete root-side facet fiber recovery leases for
|
|
693
|
+
* the same sub-tree.
|
|
697
694
|
*/
|
|
698
695
|
cleanupPrefix(ownerPath: ReadonlyArray<AgentPathStep>): Promise<void>;
|
|
699
696
|
/**
|
|
@@ -4083,13 +4080,6 @@ type RPCResponse = {
|
|
|
4083
4080
|
error: string;
|
|
4084
4081
|
}
|
|
4085
4082
|
);
|
|
4086
|
-
type QueueItem<T = string> = {
|
|
4087
|
-
id: string;
|
|
4088
|
-
payload: T;
|
|
4089
|
-
callback: keyof Agent<Cloudflare.Env>;
|
|
4090
|
-
created_at: number;
|
|
4091
|
-
retry?: RetryOptions;
|
|
4092
|
-
};
|
|
4093
4083
|
type DetachedReconcilePayload = {
|
|
4094
4084
|
cadenceIndex?: number;
|
|
4095
4085
|
};
|
|
@@ -4466,11 +4456,11 @@ type WorkflowName<E> = WorkflowBinding<E> | (string & {});
|
|
|
4466
4456
|
/**
|
|
4467
4457
|
* Base class for creating Agent implementations
|
|
4468
4458
|
* @template Env Environment type containing bindings
|
|
4469
|
-
* @template
|
|
4459
|
+
* @template TState State type to store within the Agent
|
|
4470
4460
|
*/
|
|
4471
4461
|
declare class Agent<
|
|
4472
4462
|
Env extends Cloudflare.Env = Cloudflare.Env,
|
|
4473
|
-
|
|
4463
|
+
TState = unknown,
|
|
4474
4464
|
Props extends Record<string, unknown> = Record<string, unknown>
|
|
4475
4465
|
> extends DurableObject<Env> {
|
|
4476
4466
|
/**
|
|
@@ -4489,6 +4479,16 @@ declare class Agent<
|
|
|
4489
4479
|
* from paths that do not pass through the capability (facet bridging,
|
|
4490
4480
|
* direct calls).
|
|
4491
4481
|
*/
|
|
4482
|
+
/**
|
|
4483
|
+
* Durable state: the `cf_agents_state` row, lazy load, validated persistence.
|
|
4484
|
+
* `initialState` stays on Agent (a subclass field, initialized after this
|
|
4485
|
+
* one) and is seeded by the `state` getter. Typed `<unknown>` rather than
|
|
4486
|
+
* `<TState>` because `TState` appears in both `get()` and `set()` positions,
|
|
4487
|
+
* which would make `Agent`'s own `TState` parameter invariant and break
|
|
4488
|
+
* `Subclass -> Agent<Env, unknown>` assignability; the typed boundary is
|
|
4489
|
+
* re-established in `state` / `setState`.
|
|
4490
|
+
*/
|
|
4491
|
+
readonly _state: State<unknown>;
|
|
4492
4492
|
private readonly _webSockets;
|
|
4493
4493
|
/** Run user initialization after lifecycle components have started. */
|
|
4494
4494
|
onStart(_props?: Props): void | Promise<void>;
|
|
@@ -4515,7 +4515,6 @@ declare class Agent<
|
|
|
4515
4515
|
): string[] | Promise<string[]>;
|
|
4516
4516
|
/** @internal Ensure lifecycle startup before a native RPC implementation. */
|
|
4517
4517
|
__unsafe_ensureInitialized(props?: Props): Promise<void>;
|
|
4518
|
-
private _state;
|
|
4519
4518
|
private _disposables;
|
|
4520
4519
|
private _destroyed;
|
|
4521
4520
|
/**
|
|
@@ -4523,7 +4522,6 @@ declare class Agent<
|
|
|
4523
4522
|
* Used by internal flag methods (readonly, no-protocol) to read/write
|
|
4524
4523
|
* _cf_-prefixed keys without going through the user-facing state/setState.
|
|
4525
4524
|
*/
|
|
4526
|
-
private _rawStateAccessors;
|
|
4527
4525
|
/**
|
|
4528
4526
|
* Cached persistence-hook dispatch mode, computed once in the constructor.
|
|
4529
4527
|
* - "new" → call onStateChanged
|
|
@@ -4616,6 +4614,12 @@ declare class Agent<
|
|
|
4616
4614
|
* cancelSchedule() methods are the stable surface.
|
|
4617
4615
|
*/
|
|
4618
4616
|
readonly scheduler: Scheduler;
|
|
4617
|
+
/**
|
|
4618
|
+
* Durable background-work capability installed into this Agent's
|
|
4619
|
+
* Lifecycle. Agent's queue()/dequeue()/dequeueAll()/dequeueAllByCallback()/
|
|
4620
|
+
* getQueue()/getQueues() methods are its surface.
|
|
4621
|
+
*/
|
|
4622
|
+
private readonly _queue;
|
|
4619
4623
|
/**
|
|
4620
4624
|
* Durable replayable execution capability installed into this Agent's
|
|
4621
4625
|
* Lifecycle. Declare definitions on the overridable
|
|
@@ -4647,7 +4651,7 @@ declare class Agent<
|
|
|
4647
4651
|
* Initial state for the Agent
|
|
4648
4652
|
* Override to provide default state values
|
|
4649
4653
|
*/
|
|
4650
|
-
initialState:
|
|
4654
|
+
initialState: TState;
|
|
4651
4655
|
/**
|
|
4652
4656
|
* Stable key for Workers AI session affinity (prefix-cache optimization).
|
|
4653
4657
|
*
|
|
@@ -4667,9 +4671,12 @@ declare class Agent<
|
|
|
4667
4671
|
*/
|
|
4668
4672
|
get sessionAffinity(): string;
|
|
4669
4673
|
/**
|
|
4670
|
-
* Current state of the Agent
|
|
4674
|
+
* Current state of the Agent.
|
|
4675
|
+
*
|
|
4676
|
+
* Delegates to the State capability, which owns lazy load and the
|
|
4677
|
+
* in-memory cache; Agent seeds `initialState` on first access.
|
|
4671
4678
|
*/
|
|
4672
|
-
get state():
|
|
4679
|
+
get state(): TState;
|
|
4673
4680
|
/**
|
|
4674
4681
|
* Agent configuration options.
|
|
4675
4682
|
* Override in subclasses - only specify what you want to change.
|
|
@@ -4722,6 +4729,14 @@ declare class Agent<
|
|
|
4722
4729
|
* local dev and the constructor only runs once per DO instance).
|
|
4723
4730
|
*/
|
|
4724
4731
|
protected _ensureSchema(): void;
|
|
4732
|
+
/**
|
|
4733
|
+
* Read the Agent's schema version from its KV key. A DO created before the
|
|
4734
|
+
* State capability owned `cf_agents_state` has the version as a row in that
|
|
4735
|
+
* table instead: read it once, move it to the key, and delete the row so the
|
|
4736
|
+
* table is left with a single owner. Synchronous (`storage.kv`) because the
|
|
4737
|
+
* constructor gates DDL on it.
|
|
4738
|
+
*/
|
|
4739
|
+
private _readSchemaVersion;
|
|
4725
4740
|
constructor(ctx: AgentContext, env: Env);
|
|
4726
4741
|
private _restoreAgentFacetContext;
|
|
4727
4742
|
/**
|
|
@@ -4736,26 +4751,20 @@ declare class Agent<
|
|
|
4736
4751
|
* @param excludeIds Additional connection IDs to exclude (e.g. the source)
|
|
4737
4752
|
*/
|
|
4738
4753
|
private _broadcastProtocol;
|
|
4739
|
-
|
|
4754
|
+
/**
|
|
4755
|
+
* React to a persisted state change from the State capability.
|
|
4756
|
+
*
|
|
4757
|
+
* Reproduces the pre-migration steps 3-4: broadcast the new state to
|
|
4758
|
+
* protocol-enabled connections (excluding the originating connection) and
|
|
4759
|
+
* run the notification hook off the invocation tail.
|
|
4760
|
+
*/
|
|
4761
|
+
private _handleStateChanged;
|
|
4740
4762
|
/**
|
|
4741
4763
|
* Update the Agent's state
|
|
4742
4764
|
* @param state New state to set
|
|
4743
4765
|
* @throws Error if called from a readonly connection context
|
|
4744
4766
|
*/
|
|
4745
|
-
setState(state:
|
|
4746
|
-
/**
|
|
4747
|
-
* Wraps connection.state and connection.setState so that internal
|
|
4748
|
-
* _cf_-prefixed flags (readonly, no-protocol) are hidden from user code
|
|
4749
|
-
* and cannot be accidentally overwritten.
|
|
4750
|
-
*
|
|
4751
|
-
* Idempotent — safe to call multiple times on the same connection.
|
|
4752
|
-
* After hibernation, the _rawStateAccessors WeakMap is empty but the
|
|
4753
|
-
* connection's state getter still reads from the persisted WebSocket
|
|
4754
|
-
* attachment. Calling this method re-captures the raw getter so that
|
|
4755
|
-
* predicate methods (isConnectionReadonly, isConnectionProtocolEnabled)
|
|
4756
|
-
* work correctly post-hibernation.
|
|
4757
|
-
*/
|
|
4758
|
-
private _ensureConnectionWrapped;
|
|
4767
|
+
setState(state: TState): void;
|
|
4759
4768
|
/**
|
|
4760
4769
|
* Mark a connection as readonly or readwrite
|
|
4761
4770
|
* @param connection The connection to mark
|
|
@@ -4789,8 +4798,8 @@ declare class Agent<
|
|
|
4789
4798
|
*
|
|
4790
4799
|
* Write an internal `_cf_`-prefixed flag to the raw connection state,
|
|
4791
4800
|
* bypassing the user-facing state wrapper. The key must be registered
|
|
4792
|
-
*
|
|
4793
|
-
* and hidden from `connection.state`.
|
|
4801
|
+
* with `registerInternalConnectionKeys` so it is preserved across user
|
|
4802
|
+
* `setState` calls and hidden from `connection.state`.
|
|
4794
4803
|
*
|
|
4795
4804
|
* @internal
|
|
4796
4805
|
*/
|
|
@@ -4840,18 +4849,13 @@ declare class Agent<
|
|
|
4840
4849
|
* @returns True if the connection receives protocol messages
|
|
4841
4850
|
*/
|
|
4842
4851
|
isConnectionProtocolEnabled(connection: Connection): boolean;
|
|
4843
|
-
/**
|
|
4844
|
-
* Mark a connection as having protocol messages disabled.
|
|
4845
|
-
* Called internally when shouldSendProtocolMessages returns false.
|
|
4846
|
-
*/
|
|
4847
|
-
private _setConnectionNoProtocol;
|
|
4848
4852
|
/**
|
|
4849
4853
|
* Called before the Agent's state is persisted and broadcast.
|
|
4850
4854
|
* Override to validate or reject an update by throwing an error.
|
|
4851
4855
|
*
|
|
4852
4856
|
* IMPORTANT: This hook must be synchronous.
|
|
4853
4857
|
*/
|
|
4854
|
-
validateStateChange(_nextState:
|
|
4858
|
+
validateStateChange(_nextState: TState, _source: Connection | "server"): void;
|
|
4855
4859
|
/**
|
|
4856
4860
|
* Called after the Agent's state has been persisted and broadcast to all clients.
|
|
4857
4861
|
* This is a notification hook — errors here are routed to onError and do not
|
|
@@ -4861,7 +4865,7 @@ declare class Agent<
|
|
|
4861
4865
|
* @param source Source of the state update ("server" or a client connection)
|
|
4862
4866
|
*/
|
|
4863
4867
|
onStateChanged(
|
|
4864
|
-
_state:
|
|
4868
|
+
_state: TState | undefined,
|
|
4865
4869
|
_source: Connection | "server"
|
|
4866
4870
|
): void;
|
|
4867
4871
|
/**
|
|
@@ -4876,7 +4880,7 @@ declare class Agent<
|
|
|
4876
4880
|
* @param source Source of the state update ("server" or a client connection)
|
|
4877
4881
|
*/
|
|
4878
4882
|
onStateUpdate(
|
|
4879
|
-
_state:
|
|
4883
|
+
_state: TState | undefined,
|
|
4880
4884
|
_source: Connection | "server"
|
|
4881
4885
|
): void;
|
|
4882
4886
|
/**
|
|
@@ -4974,11 +4978,16 @@ declare class Agent<
|
|
|
4974
4978
|
}
|
|
4975
4979
|
): Promise<T>;
|
|
4976
4980
|
/**
|
|
4977
|
-
* Queue a task to
|
|
4981
|
+
* Queue a task to run in the background.
|
|
4982
|
+
*
|
|
4983
|
+
* The item is durable: it runs from the Lifecycle alarm event loop after
|
|
4984
|
+
* this call returns, in push order, one at a time, with retries per
|
|
4985
|
+
* `options.retry`, and survives the Durable Object leaving memory.
|
|
4978
4986
|
* @param callback Name of the method to call
|
|
4979
4987
|
* @param payload Payload to pass to the callback
|
|
4980
4988
|
* @param options Options for the queued task
|
|
4981
4989
|
* @param options.retry Retry options for the callback execution
|
|
4990
|
+
* @param options.id Stable id; a push with an existing id replaces that item
|
|
4982
4991
|
* @returns The ID of the queued task
|
|
4983
4992
|
*/
|
|
4984
4993
|
queue<T = unknown>(
|
|
@@ -4986,37 +4995,36 @@ declare class Agent<
|
|
|
4986
4995
|
payload: T,
|
|
4987
4996
|
options?: {
|
|
4988
4997
|
retry?: RetryOptions;
|
|
4998
|
+
id?: string;
|
|
4989
4999
|
}
|
|
4990
5000
|
): Promise<string>;
|
|
4991
|
-
private _flushingQueue;
|
|
4992
|
-
private _flushQueue;
|
|
4993
5001
|
/**
|
|
4994
5002
|
* Dequeue a task by ID
|
|
4995
5003
|
* @param id ID of the task to dequeue
|
|
4996
5004
|
*/
|
|
4997
|
-
dequeue(id: string):
|
|
5005
|
+
dequeue(id: string): Promise<boolean>;
|
|
4998
5006
|
/**
|
|
4999
5007
|
* Dequeue all tasks
|
|
5000
5008
|
*/
|
|
5001
|
-
dequeueAll():
|
|
5009
|
+
dequeueAll(): Promise<number>;
|
|
5002
5010
|
/**
|
|
5003
5011
|
* Dequeue all tasks by callback
|
|
5004
5012
|
* @param callback Name of the callback to dequeue
|
|
5005
5013
|
*/
|
|
5006
|
-
dequeueAllByCallback(callback: string):
|
|
5014
|
+
dequeueAllByCallback(callback: string): Promise<number>;
|
|
5007
5015
|
/**
|
|
5008
5016
|
* Get a queued task by ID
|
|
5009
5017
|
* @param id ID of the task to get
|
|
5010
5018
|
* @returns The task or undefined if not found
|
|
5011
5019
|
*/
|
|
5012
|
-
getQueue(id: string): QueueItem<
|
|
5020
|
+
getQueue<T = unknown>(id: string): Promise<QueueItem<T> | undefined>;
|
|
5013
5021
|
/**
|
|
5014
|
-
* Get all
|
|
5022
|
+
* Get all queued tasks whose payload has `key` equal to `value`
|
|
5015
5023
|
* @param key Key to filter by
|
|
5016
5024
|
* @param value Value to filter by
|
|
5017
5025
|
* @returns Array of matching QueueItem objects
|
|
5018
5026
|
*/
|
|
5019
|
-
getQueues(key: string, value: string): QueueItem<
|
|
5027
|
+
getQueues<T = unknown>(key: string, value: string): Promise<QueueItem<T>[]>;
|
|
5020
5028
|
private _lifecycleRouteAddress;
|
|
5021
5029
|
private _routeLifecycleToRoot;
|
|
5022
5030
|
private _routeLifecycleToTarget;
|
|
@@ -6815,144 +6823,143 @@ declare function getAgentByName<
|
|
|
6815
6823
|
): Promise<DurableObjectStub<T>>;
|
|
6816
6824
|
//#endregion
|
|
6817
6825
|
export {
|
|
6818
|
-
|
|
6819
|
-
|
|
6820
|
-
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
|
|
6826
|
+
DetachedAgentToolConfig as $,
|
|
6827
|
+
ElicitRequest$2 as $t,
|
|
6828
|
+
getCurrentAgent as A,
|
|
6829
|
+
withInvocationScope as An,
|
|
6830
|
+
MCPAIToolSet as At,
|
|
6831
|
+
AgentToolInterruptedReason as B,
|
|
6832
|
+
MCPServerFilter as Bt,
|
|
6825
6833
|
MCPServersState as C,
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
|
|
6830
|
-
|
|
6831
|
-
|
|
6832
|
-
|
|
6833
|
-
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
|
|
6848
|
-
|
|
6849
|
-
|
|
6850
|
-
|
|
6851
|
-
|
|
6852
|
-
|
|
6853
|
-
|
|
6854
|
-
|
|
6855
|
-
|
|
6856
|
-
|
|
6857
|
-
|
|
6858
|
-
|
|
6859
|
-
|
|
6860
|
-
|
|
6834
|
+
buildAgentPath as Cn,
|
|
6835
|
+
WorkflowQueryCriteria as Ct,
|
|
6836
|
+
StartFiberResult as D,
|
|
6837
|
+
getSubAgentByName as Dn,
|
|
6838
|
+
ElicitRequest$1 as Dt,
|
|
6839
|
+
StartFiberOptions as E,
|
|
6840
|
+
buildSubAgentPathUnchecked as En,
|
|
6841
|
+
WorkflowTrackingRow as Et,
|
|
6842
|
+
AgentToolDisplayMetadata as F,
|
|
6843
|
+
MCPClientOAuthCallbackConfig as Ft,
|
|
6844
|
+
AgentToolRunInfo as G,
|
|
6845
|
+
normalizeServerId as Gt,
|
|
6846
|
+
AgentToolMilestone as H,
|
|
6847
|
+
MCP_SERVER_ID_MAX_LENGTH as Ht,
|
|
6848
|
+
AgentToolEvent as I,
|
|
6849
|
+
MCPClientOAuthResult as It,
|
|
6850
|
+
AgentToolRunState as J,
|
|
6851
|
+
RPCClientTransport as Jt,
|
|
6852
|
+
AgentToolRunInspection as K,
|
|
6853
|
+
MCPElicitationHandler as Kt,
|
|
6854
|
+
AgentToolEventMessage as L,
|
|
6855
|
+
MCPConnectionResult as Lt,
|
|
6856
|
+
AGENT_TOOL_MILESTONE_PART as M,
|
|
6857
|
+
MCPClientElicitationHandlers as Mt,
|
|
6858
|
+
AGENT_TOOL_PROGRESS_PART as N,
|
|
6859
|
+
MCPClientManager as Nt,
|
|
6860
|
+
StateUpdateMessage as O,
|
|
6861
|
+
parseSubAgentPath as On,
|
|
6862
|
+
ElicitResult$2 as Ot,
|
|
6863
|
+
AgentToolChildAdapter as P,
|
|
6864
|
+
MCPClientManagerOptions as Pt,
|
|
6865
|
+
ChatCapableAgentClass as Q,
|
|
6866
|
+
RPC_DO_PREFIX as Qt,
|
|
6867
|
+
AgentToolEventState as R,
|
|
6868
|
+
MCPDiscoverResult as Rt,
|
|
6861
6869
|
MCPServerMessage as S,
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6870
|
+
SubAgentPathMatch as Sn,
|
|
6871
|
+
WorkflowProgressCallback as St,
|
|
6872
|
+
RPCResponse as T,
|
|
6873
|
+
buildSubAgentPath as Tn,
|
|
6874
|
+
WorkflowStatus as Tt,
|
|
6875
|
+
AgentToolProgress as U,
|
|
6876
|
+
RegisterServerOptions as Ut,
|
|
6877
|
+
AgentToolLifecycleResult as V,
|
|
6878
|
+
MCPServerOptions as Vt,
|
|
6879
|
+
AgentToolProgressSnapshot as W,
|
|
6880
|
+
getNamespacedData as Wt,
|
|
6881
|
+
AgentToolStoredChunk as X,
|
|
6882
|
+
RPCServerTransport as Xt,
|
|
6883
|
+
AgentToolRunStatus as Y,
|
|
6884
|
+
RPCClientTransportOptions as Yt,
|
|
6885
|
+
AgentToolTerminalStatus as Z,
|
|
6886
|
+
RPCServerTransportOptions as Zt,
|
|
6879
6887
|
FiberRecoveryContext as _,
|
|
6880
|
-
|
|
6881
|
-
|
|
6888
|
+
DynamicAgentClass as _n,
|
|
6889
|
+
WorkflowErrorCallback as _t,
|
|
6882
6890
|
routeAgentRequest as a,
|
|
6883
|
-
|
|
6884
|
-
|
|
6891
|
+
createMcpHandler$1 as an,
|
|
6892
|
+
AgentWorkflowOrigin as at,
|
|
6885
6893
|
ListFibersOptions as b,
|
|
6886
|
-
|
|
6887
|
-
|
|
6894
|
+
BuildAgentPathOptions as bn,
|
|
6895
|
+
WorkflowInfo as bt,
|
|
6888
6896
|
Agent as c,
|
|
6889
|
-
|
|
6890
|
-
|
|
6897
|
+
CreateMcpHandlerOptions$1 as cn,
|
|
6898
|
+
AgentWorkflowStep as ct,
|
|
6891
6899
|
AgentStaticOptions as d,
|
|
6892
|
-
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6900
|
+
MCPStorageApi as dn,
|
|
6901
|
+
RunWorkflowOptions as dt,
|
|
6902
|
+
ElicitRequestSchema as en,
|
|
6903
|
+
DetachedRunAgentToolResult as et,
|
|
6896
6904
|
DEFAULT_AGENT_STATIC_OPTIONS as f,
|
|
6897
|
-
|
|
6898
|
-
|
|
6905
|
+
TransportState as fn,
|
|
6906
|
+
WaitForApprovalOptions as ft,
|
|
6899
6907
|
FiberInspection as g,
|
|
6900
|
-
|
|
6901
|
-
|
|
6908
|
+
StreamableHTTPEdgeClientTransport as gn,
|
|
6909
|
+
WorkflowCompleteCallback as gt,
|
|
6902
6910
|
FiberContext as h,
|
|
6903
|
-
|
|
6904
|
-
|
|
6911
|
+
SSEEdgeClientTransport as hn,
|
|
6912
|
+
WorkflowCallbackType as ht,
|
|
6905
6913
|
getAgentByName as i,
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
ElicitResult$2 as kt,
|
|
6914
|
+
DurableObjectEventStore as in,
|
|
6915
|
+
AgentWorkflowInternalParams as it,
|
|
6916
|
+
routeAgentEmail as j,
|
|
6917
|
+
MCPClientElicitationHandler as jt,
|
|
6918
|
+
StreamingResponse as k,
|
|
6919
|
+
routeSubAgentRequest as kn,
|
|
6920
|
+
MCPAITool as kt,
|
|
6914
6921
|
AgentContext as l,
|
|
6915
|
-
|
|
6916
|
-
|
|
6922
|
+
LegacyMcpHandler as ln,
|
|
6923
|
+
ApprovalEventPayload as lt,
|
|
6917
6924
|
EmailRoutingOptions as m,
|
|
6918
|
-
|
|
6919
|
-
|
|
6925
|
+
WorkerTransportOptions as mn,
|
|
6926
|
+
WorkflowCallbackBase as mt,
|
|
6920
6927
|
AgentOptions as n,
|
|
6921
|
-
|
|
6922
|
-
|
|
6928
|
+
McpAgent as nn,
|
|
6929
|
+
RunAgentToolResult as nt,
|
|
6923
6930
|
AddMcpServerOptions as o,
|
|
6924
|
-
|
|
6925
|
-
|
|
6931
|
+
experimental_createMcpHandler as on,
|
|
6932
|
+
AgentWorkflowParams as ot,
|
|
6926
6933
|
DeleteFibersOptions as p,
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6934
|
+
WorkerTransport as pn,
|
|
6935
|
+
WorkflowCallback as pt,
|
|
6936
|
+
AgentToolRunPart as q,
|
|
6937
|
+
MCPElicitationHandlers as qt,
|
|
6931
6938
|
RoutingRetryOptions as r,
|
|
6932
|
-
|
|
6933
|
-
|
|
6939
|
+
ClearableEventStore as rn,
|
|
6940
|
+
AgentWorkflowEvent as rt,
|
|
6934
6941
|
AddRpcMcpServerOptions as s,
|
|
6935
|
-
|
|
6936
|
-
|
|
6942
|
+
CreateLegacyMcpHandlerOptions as sn,
|
|
6943
|
+
AgentWorkflowPathStep as st,
|
|
6937
6944
|
AgentGetOptions as t,
|
|
6938
|
-
|
|
6939
|
-
|
|
6945
|
+
ElicitResult$3 as tn,
|
|
6946
|
+
RunAgentToolOptions as tt,
|
|
6940
6947
|
AgentNamespace as u,
|
|
6941
|
-
|
|
6942
|
-
|
|
6948
|
+
createLegacyMcpHandler as un,
|
|
6949
|
+
DefaultProgress as ut,
|
|
6943
6950
|
FiberRecoveryResult as v,
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
|
|
6951
|
+
DynamicAgentStub as vn,
|
|
6952
|
+
WorkflowEventCallback as vt,
|
|
6953
|
+
RPCRequest as w,
|
|
6954
|
+
buildAgentUrl as wn,
|
|
6955
|
+
WorkflowRejectedError as wt,
|
|
6949
6956
|
MCPServer as x,
|
|
6950
|
-
|
|
6951
|
-
|
|
6957
|
+
SUB_PREFIX as xn,
|
|
6958
|
+
WorkflowPage as xt,
|
|
6952
6959
|
FiberStatus as y,
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
6960
|
+
AgentPathStep as yn,
|
|
6961
|
+
WorkflowEventPayload as yt,
|
|
6962
|
+
AgentToolFailure as z,
|
|
6963
|
+
MCPOAuthCallbackResult as zt
|
|
6957
6964
|
};
|
|
6958
|
-
//# sourceMappingURL=agent-routing-
|
|
6965
|
+
//# sourceMappingURL=agent-routing-B2XLNMxq.d.ts.map
|
package/dist/agent-routing.d.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import {
|
|
2
|
-
$ as
|
|
3
|
-
B as
|
|
4
|
-
F as
|
|
5
|
-
G as
|
|
6
|
-
H as
|
|
7
|
-
I as
|
|
8
|
-
J as
|
|
9
|
-
K as
|
|
10
|
-
L as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
tt as
|
|
26
|
-
z as
|
|
27
|
-
} from "./agent-routing-
|
|
2
|
+
$ as DetachedAgentToolConfig,
|
|
3
|
+
B as AgentToolInterruptedReason,
|
|
4
|
+
F as AgentToolDisplayMetadata,
|
|
5
|
+
G as AgentToolRunInfo,
|
|
6
|
+
H as AgentToolMilestone,
|
|
7
|
+
I as AgentToolEvent,
|
|
8
|
+
J as AgentToolRunState,
|
|
9
|
+
K as AgentToolRunInspection,
|
|
10
|
+
L as AgentToolEventMessage,
|
|
11
|
+
M as AGENT_TOOL_MILESTONE_PART,
|
|
12
|
+
N as AGENT_TOOL_PROGRESS_PART,
|
|
13
|
+
P as AgentToolChildAdapter,
|
|
14
|
+
Q as ChatCapableAgentClass,
|
|
15
|
+
R as AgentToolEventState,
|
|
16
|
+
U as AgentToolProgress,
|
|
17
|
+
V as AgentToolLifecycleResult,
|
|
18
|
+
W as AgentToolProgressSnapshot,
|
|
19
|
+
X as AgentToolStoredChunk,
|
|
20
|
+
Y as AgentToolRunStatus,
|
|
21
|
+
Z as AgentToolTerminalStatus,
|
|
22
|
+
et as DetachedRunAgentToolResult,
|
|
23
|
+
nt as RunAgentToolResult,
|
|
24
|
+
q as AgentToolRunPart,
|
|
25
|
+
tt as RunAgentToolOptions,
|
|
26
|
+
z as AgentToolFailure
|
|
27
|
+
} from "./agent-routing-B2XLNMxq.js";
|
|
28
28
|
export {
|
|
29
29
|
AGENT_TOOL_MILESTONE_PART,
|
|
30
30
|
AGENT_TOOL_PROGRESS_PART,
|