agents 0.11.4 → 0.11.6

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.
Files changed (44) hide show
  1. package/README.md +44 -1
  2. package/dist/browser/ai.js +1 -1
  3. package/dist/browser/index.js +1 -1
  4. package/dist/browser/tanstack-ai.js +1 -1
  5. package/dist/browser/tanstack-ai.js.map +1 -1
  6. package/dist/chat/index.d.ts +169 -23
  7. package/dist/chat/index.js +232 -1
  8. package/dist/chat/index.js.map +1 -1
  9. package/dist/{classPrivateFieldGet2-DAZNVUKb.js → classPrivateFieldGet2-Bqby-AHD.js} +5 -5
  10. package/dist/{client-B_xdiZbn.js → client-D1kFXo80.js} +9 -1
  11. package/dist/{client-B_xdiZbn.js.map → client-D1kFXo80.js.map} +1 -1
  12. package/dist/client.d.ts +1 -1
  13. package/dist/client.js +2 -2
  14. package/dist/client.js.map +1 -1
  15. package/dist/compaction-helpers-C_cN3z55.js.map +1 -1
  16. package/dist/email.js.map +1 -1
  17. package/dist/experimental/memory/session/index.js.map +1 -1
  18. package/dist/{index-D9qo_Inc.d.ts → index-BM7Nk0QD.d.ts} +378 -21
  19. package/dist/index.d.ts +12 -2
  20. package/dist/index.js +329 -30
  21. package/dist/index.js.map +1 -1
  22. package/dist/mcp/client.d.ts +1 -1
  23. package/dist/mcp/client.js +1 -1
  24. package/dist/mcp/do-oauth-client-provider.js.map +1 -1
  25. package/dist/mcp/index.d.ts +1 -1
  26. package/dist/mcp/index.js +1 -1
  27. package/dist/mcp/index.js.map +1 -1
  28. package/dist/mcp/x402.js.map +1 -1
  29. package/dist/react.d.ts +53 -5
  30. package/dist/react.js +47 -7
  31. package/dist/react.js.map +1 -1
  32. package/dist/{retries-JlwH9mnV.d.ts → retries-fLD8cGNf.d.ts} +1 -1
  33. package/dist/retries.d.ts +1 -1
  34. package/dist/{shared-BovR6hRc.js → shared-mfBbxjS1.js} +3 -3
  35. package/dist/{shared-BovR6hRc.js.map → shared-mfBbxjS1.js.map} +1 -1
  36. package/dist/sub-routing.d.ts +14 -0
  37. package/dist/sub-routing.js +171 -0
  38. package/dist/sub-routing.js.map +1 -0
  39. package/dist/utils.d.ts +21 -1
  40. package/dist/utils.js +36 -1
  41. package/dist/utils.js.map +1 -1
  42. package/dist/workflows.d.ts +1 -1
  43. package/dist/workflows.js.map +1 -1
  44. package/package.json +6 -19
@@ -1,5 +1,5 @@
1
1
  import { n as AgentEmail } from "./internal_context-BvuGZieY.js";
2
- import { t as RetryOptions } from "./retries-JlwH9mnV.js";
2
+ import { t as RetryOptions } from "./retries-fLD8cGNf.js";
3
3
  import {
4
4
  n as Observability,
5
5
  r as ObservabilityEvent,
@@ -67,6 +67,122 @@ import { Server as Server$1 } from "@modelcontextprotocol/sdk/server/index.js";
67
67
  import { Client as Client$1 } from "@modelcontextprotocol/sdk/client";
68
68
  import { EventStore } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
69
69
 
70
+ //#region src/sub-routing.d.ts
71
+ /**
72
+ * URL segment marking a parent↔child boundary.
73
+ *
74
+ * Exposed as a constant so callers can build URLs symbolically, but
75
+ * not configurable — the routing layer matches on the literal `sub`
76
+ * token everywhere (parent fetch, client, helpers).
77
+ */
78
+ declare const SUB_PREFIX = "sub";
79
+ interface SubAgentPathMatch {
80
+ /** CamelCase class name of the child, as it appears in `ctx.exports`. */
81
+ childClass: string;
82
+ /** URL-decoded child name. */
83
+ childName: string;
84
+ /**
85
+ * Request path to forward to the child, with the
86
+ * `/sub/{class}/{name}` segment stripped. Always begins with `/`;
87
+ * may itself contain further `/sub/...` markers when a
88
+ * recursively nested sub-agent is being routed.
89
+ */
90
+ remainingPath: string;
91
+ }
92
+ /**
93
+ * Parse a URL and extract the first `/sub/{class}/{name}` segment,
94
+ * if any. Recursive nesting is handled naturally: callers parse one
95
+ * level at a time; the child then parses its own URL (which still
96
+ * contains any deeper `/sub/...` markers).
97
+ *
98
+ * Names are URL-decoded. Classes are kebab-to-CamelCase converted
99
+ * via a best-effort match against a provided lookup — pass
100
+ * `ctx.exports` keys to get exact CamelCase; pass `undefined` for
101
+ * a tolerant conversion without validation.
102
+ *
103
+ * Returns `null` when the URL doesn't contain the marker at a
104
+ * recognized position, or when the marker has no following
105
+ * class+name pair.
106
+ */
107
+ declare function parseSubAgentPath(
108
+ url: string,
109
+ options?: {
110
+ /** CamelCase class names to match against (usually `ctx.exports` keys). */ knownClasses?: readonly string[];
111
+ }
112
+ ): SubAgentPathMatch | null;
113
+ /**
114
+ * Route a request into a sub-agent via its parent DO.
115
+ *
116
+ * Use this in a custom fetch handler when your URL shape doesn't
117
+ * match the `/agents/{class}/{name}` default — you identify and
118
+ * fetch the parent yourself, then let this helper parse the
119
+ * `/sub/{child}/...` tail and forward it.
120
+ *
121
+ * Runs `onBeforeSubAgent` on the parent DO (authorization / request
122
+ * mutation / short-circuit response).
123
+ *
124
+ * For the default `/agents/...` URL shape, use `routeAgentRequest`
125
+ * instead — it handles the parent lookup and this dispatch in one
126
+ * call.
127
+ *
128
+ * @example
129
+ * ```ts
130
+ * export default {
131
+ * async fetch(req, env) {
132
+ * const { parentName, rest } = myCustomParse(req.url);
133
+ * const parent = await getAgentByName(env.Inbox, parentName);
134
+ * return routeSubAgentRequest(req, parent, { fromPath: rest });
135
+ * }
136
+ * };
137
+ * ```
138
+ *
139
+ * @experimental The API surface may change before stabilizing.
140
+ */
141
+ declare function routeSubAgentRequest(
142
+ req: Request,
143
+ parent: unknown,
144
+ options?: {
145
+ /**
146
+ * Path to route on. Defaults to `req.url`'s pathname. Useful
147
+ * when your outer URL is custom (e.g. `/api/v1/...`) and you
148
+ * want to route the sub-agent tail without rewriting the
149
+ * Request first.
150
+ */
151
+ fromPath?: string;
152
+ }
153
+ ): Promise<Response>;
154
+ /**
155
+ * Get a typed RPC stub for a sub-agent from outside the parent DO.
156
+ *
157
+ * The returned stub proxies method calls through the parent via a
158
+ * stateless per-call bridge (caller → parent → facet), so each
159
+ * method invocation costs one extra RPC hop. Works across parent
160
+ * hibernation — no cached references to go stale.
161
+ *
162
+ * Limitations:
163
+ * - RPC methods only. `.fetch()` is not supported (will throw).
164
+ * Use `routeSubAgentRequest` for external HTTP/WS.
165
+ * - Arguments and return values must be structured-cloneable,
166
+ * same as any DO RPC call.
167
+ * - Does not run `onBeforeSubAgent` on the parent — analogous to
168
+ * `getAgentByName` not running `onBeforeConnect`. The caller is
169
+ * assumed to have performed whatever access checks are needed.
170
+ *
171
+ * @example
172
+ * ```ts
173
+ * const inbox = await getAgentByName(env.MyInbox, userId);
174
+ * const chat = await getSubAgentByName(inbox, MyChat, chatId);
175
+ * await chat.addMessage({ role: "user", content: "hi" });
176
+ * ```
177
+ *
178
+ * @experimental The API surface may change before stabilizing.
179
+ */
180
+ declare function getSubAgentByName<T extends Agent>(
181
+ parent: unknown,
182
+ cls: SubAgentClass<T>,
183
+ name: string
184
+ ): Promise<SubAgentStub<T>>;
185
+ //#endregion
70
186
  //#region src/core/events.d.ts
71
187
  interface Disposable {
72
188
  dispose(): void;
@@ -729,7 +845,7 @@ declare class MCPClientConnection {
729
845
  */
730
846
  getTransport(
731
847
  transportType: BaseTransportType
732
- ): RPCClientTransport | SSEClientTransport | StreamableHTTPClientTransport;
848
+ ): StreamableHTTPClientTransport | SSEClientTransport | RPCClientTransport;
733
849
  private tryConnect;
734
850
  private _capabilityErrorHandler;
735
851
  }
@@ -1796,6 +1912,13 @@ declare class Agent<
1796
1912
  private _persistenceHookMode;
1797
1913
  /** True when this agent runs as a facet (sub-agent) inside a parent. */
1798
1914
  private _isFacet;
1915
+ /**
1916
+ * Ancestor chain, root-first. Empty for top-level DOs; populated at
1917
+ * facet init time from the parent's own `selfPath`. Exposed publicly
1918
+ * via the `parentPath` getter.
1919
+ * @internal
1920
+ */
1921
+ private _parentPath;
1799
1922
  /** True while user's onStart() is executing. Used to warn about non-idempotent schedule() calls. */
1800
1923
  private _insideOnStart;
1801
1924
  /** Tracks callbacks already warned about during this onStart() to avoid log spam. */
@@ -1903,18 +2026,6 @@ declare class Agent<
1903
2026
  * @param excludeIds Additional connection IDs to exclude (e.g. the source)
1904
2027
  */
1905
2028
  private _broadcastProtocol;
1906
- /**
1907
- * When running as a facet, the parent DO owns the WebSocket registry
1908
- * (`ctx.getWebSockets()`). Iterating from the child isolate throws
1909
- * "Cannot perform I/O on behalf of a different Durable Object".
1910
- * Downstream callers (e.g. chat-streaming paths) invoke
1911
- * `this.broadcast()` directly, bypassing `_broadcastProtocol`'s
1912
- * guard, so override at the base to catch every path.
1913
- */
1914
- broadcast(
1915
- msg: string | ArrayBuffer | ArrayBufferView,
1916
- without?: string[]
1917
- ): void;
1918
2029
  private _setStateInternal;
1919
2030
  /**
1920
2031
  * Update the Agent's state
@@ -2293,6 +2404,12 @@ declare class Agent<
2293
2404
  * alarm system, without creating schedule rows or emitting observability
2294
2405
  * events. Configure via `static options = { keepAliveIntervalMs: 5000 }`.
2295
2406
  *
2407
+ * No-op on facets. Facets share the parent's isolate and don't
2408
+ * need a separate alarm heartbeat — the parent's own activity,
2409
+ * any open WebSocket to the facet, and any in-flight Promise
2410
+ * already keep the shared machine alive for the duration of
2411
+ * real work.
2412
+ *
2296
2413
  * @example
2297
2414
  * ```ts
2298
2415
  * const dispose = await this.keepAlive();
@@ -2378,13 +2495,100 @@ declare class Agent<
2378
2495
  * Executes any scheduled tasks that are due.
2379
2496
  *
2380
2497
  * Calls super.alarm() first to ensure PartyServer's #ensureInitialized()
2381
- * runs, which hydrates this.name from storage and calls onStart() if needed.
2498
+ * runs, which resolves this.name from ctx.id.name (including for
2499
+ * facets, which are spawned with an explicit id so they have their
2500
+ * own ctx.id.name; pre-2026-03-15 alarms fall back to the legacy
2501
+ * __ps_name storage record) and calls onStart() if needed.
2382
2502
  *
2383
2503
  * @remarks
2384
2504
  * To schedule a task, please use the `this.schedule` method instead.
2385
2505
  * See {@link https://developers.cloudflare.com/agents/api-reference/schedule-tasks/}
2386
2506
  */
2387
2507
  alarm(): Promise<void>;
2508
+ /**
2509
+ * Intercept incoming HTTP/WS requests whose URL contains a
2510
+ * `/sub/{child-class}/{child-name}` marker and forward them to
2511
+ * the facet. The `onBeforeSubAgent` hook fires first (authorize,
2512
+ * mutate, or short-circuit). If the hook doesn't return a
2513
+ * Response, the framework resolves the facet and hands the
2514
+ * request off.
2515
+ *
2516
+ * After a WebSocket upgrade completes, subsequent frames route
2517
+ * directly to the child — the parent is only on the path for the
2518
+ * initial request.
2519
+ *
2520
+ * @experimental The API surface may change before stabilizing.
2521
+ */
2522
+ fetch(request: Request): Promise<Response>;
2523
+ /**
2524
+ * Parent-side middleware hook. Fires before a request is
2525
+ * forwarded into a facet sub-agent. Mirrors `onBeforeConnect` /
2526
+ * `onBeforeRequest`.
2527
+ *
2528
+ * - return `void` (default) → forward the original request
2529
+ * - return `Request` → forward this (modified) request
2530
+ * - return `Response` → return this response to the
2531
+ * client; do not wake the child
2532
+ *
2533
+ * Default implementation: return void (permissive).
2534
+ *
2535
+ * The hook receives the **original** request with its URL intact —
2536
+ * including the `/sub/{class}/{name}` segment. The routing
2537
+ * decision for which facet to wake is fixed at parse time, so if
2538
+ * you return a modified `Request`, its headers, body, method, and
2539
+ * query string flow through to the child, but the **pathname**
2540
+ * the child sees is always the tail after `/sub/{class}/{name}`.
2541
+ * Customize via headers/body rather than URL-rewriting.
2542
+ *
2543
+ * WebSocket upgrade requests flow through this hook the same way as
2544
+ * plain HTTP. If you return a mutated `Request`, make sure it still
2545
+ * carries the original `Upgrade: websocket` and `Sec-WebSocket-*`
2546
+ * headers — the simplest safe recipe is to clone the incoming
2547
+ * request's headers (via `new Headers(req.headers)`) and only add
2548
+ * or replace entries, rather than constructing a fresh `Headers`
2549
+ * object from scratch.
2550
+ *
2551
+ * @experimental The API surface may change before stabilizing.
2552
+ *
2553
+ * @example
2554
+ * ```ts
2555
+ * class Inbox extends Agent {
2556
+ * override async onBeforeSubAgent(req, { className, name }) {
2557
+ * // Strict registry gate
2558
+ * if (!this.hasSubAgent(className, name)) {
2559
+ * return new Response("Not found", { status: 404 });
2560
+ * }
2561
+ * }
2562
+ * }
2563
+ * ```
2564
+ */
2565
+ onBeforeSubAgent(
2566
+ _request: Request,
2567
+ _child: {
2568
+ className: string;
2569
+ name: string;
2570
+ }
2571
+ ): Promise<Request | Response | void>;
2572
+ /**
2573
+ * Resolve the facet Fetcher for the match and forward the
2574
+ * request to it with `/sub/{class}/{name}` stripped.
2575
+ *
2576
+ * @internal
2577
+ */
2578
+ private _cf_forwardToFacet;
2579
+ /**
2580
+ * Bridge method used by `getSubAgentByName`. Resolves the facet
2581
+ * on each call (idempotent via `subAgent`) and dispatches one
2582
+ * RPC method. Stateless — no cached references.
2583
+ *
2584
+ * @internal
2585
+ */
2586
+ _cf_invokeSubAgent(
2587
+ className: string,
2588
+ name: string,
2589
+ method: string,
2590
+ args: unknown[]
2591
+ ): Promise<unknown>;
2388
2592
  /**
2389
2593
  * Initialize this agent as a facet in a single RPC.
2390
2594
  *
@@ -2395,14 +2599,104 @@ declare class Agent<
2395
2599
  * parent and triggered "Cannot perform I/O on behalf of a different
2396
2600
  * Durable Object" on the child.
2397
2601
  *
2398
- * Order matters: set `_isFacet` BEFORE triggering initialization, so
2399
- * the first `onStart()` run (which calls `broadcastMcpServers`) sees
2400
- * the flag and skips broadcasts that would touch the parent DO's
2401
- * WebSocket registry.
2602
+ * We set `_isFacet` eagerly (before `__unsafe_ensureInitialized`
2603
+ * runs `onStart()`) so any code that legitimately branches on it
2604
+ * e.g. skipping parent-owned alarms in schedule guards sees
2605
+ * the flag during the first `onStart()` run. Broadcast paths no
2606
+ * longer special-case facets, since facets can be directly
2607
+ * addressed via sub-agent routing and have their own WebSocket
2608
+ * connections.
2609
+ *
2610
+ * The facet's name (and `this.name` getter) is handled entirely by
2611
+ * partyserver via `ctx.id.name`, which is populated because the
2612
+ * parent passed an explicit `id: parentNs.idFromName(name)` to
2613
+ * `ctx.facets.get()` — see {@link _cf_resolveSubAgent}. No
2614
+ * `setName()` call or `__ps_name` storage write is needed; the
2615
+ * facet's name survives cold wake automatically because the
2616
+ * factory re-runs and `idFromName` is deterministic.
2402
2617
  *
2403
2618
  * @internal Called by {@link subAgent}.
2404
2619
  */
2405
- _cf_initAsFacet(name: string): Promise<void>;
2620
+ _cf_initAsFacet(
2621
+ name: string,
2622
+ parentPath?: ReadonlyArray<{
2623
+ className: string;
2624
+ name: string;
2625
+ }>
2626
+ ): Promise<void>;
2627
+ /**
2628
+ * Ancestor chain for this agent, root-first. Empty for top-level
2629
+ * DOs. Populated at facet init time; survives hibernation.
2630
+ *
2631
+ * @example
2632
+ * ```ts
2633
+ * class Chat extends Agent {
2634
+ * onStart() {
2635
+ * console.log("chat started under:", this.parentPath);
2636
+ * // → [{ className: "Tenant", name: "acme" }, { className: "Inbox", name: "alice" }]
2637
+ * }
2638
+ * }
2639
+ * ```
2640
+ *
2641
+ * @experimental The API surface may change before stabilizing.
2642
+ */
2643
+ get parentPath(): ReadonlyArray<{
2644
+ className: string;
2645
+ name: string;
2646
+ }>;
2647
+ /**
2648
+ * Ancestor chain + self, root-first. Convenient for logging.
2649
+ *
2650
+ * @experimental The API surface may change before stabilizing.
2651
+ */
2652
+ get selfPath(): ReadonlyArray<{
2653
+ className: string;
2654
+ name: string;
2655
+ }>;
2656
+ /**
2657
+ * Resolve a typed RPC stub for this facet's **immediate** parent
2658
+ * agent.
2659
+ *
2660
+ * Symmetric with `subAgent(Cls, name)`: while `subAgent` opens a
2661
+ * stub from parent to child, `parentAgent` opens one from child
2662
+ * to parent. Pass the direct parent's class reference — the
2663
+ * framework verifies it matches the last entry of
2664
+ * `this.parentPath` at runtime, then looks up `env[Cls.name]` to
2665
+ * find the namespace binding.
2666
+ *
2667
+ * `this.parentPath` is root-first, so the direct parent is the
2668
+ * **last** entry: `this.parentPath.at(-1)`. For grandparents and
2669
+ * further ancestors, iterate `this.parentPath` and use
2670
+ * `getAgentByName(env.X, this.parentPath[i].name)` directly.
2671
+ *
2672
+ * Assumes the standard "binding name matches class name" convention.
2673
+ * If your `wrangler.jsonc` binds the parent under a different name
2674
+ * (e.g. `{ class_name: "Inbox", name: "MY_INBOX" }`), call
2675
+ * `getAgentByName(env.MY_INBOX, this.parentPath.at(-1)!.name)`
2676
+ * directly instead.
2677
+ *
2678
+ * @experimental The API surface may change before stabilizing.
2679
+ *
2680
+ * @throws If this agent is not a facet (no parent).
2681
+ * @throws If `Cls.name` doesn't match the recorded direct-parent
2682
+ * class (guards against accidentally reaching the wrong
2683
+ * DO, especially in nested Root → Mid → Leaf chains).
2684
+ * @throws If no env binding named `Cls.name` is found.
2685
+ *
2686
+ * @example
2687
+ * ```ts
2688
+ * class Chat extends AIChatAgent<Env> {
2689
+ * async onChatMessage(...) {
2690
+ * const inbox = await this.parentAgent(Inbox);
2691
+ * const memory = await inbox.getSharedMemory("facts");
2692
+ * // ...
2693
+ * }
2694
+ * }
2695
+ * ```
2696
+ */
2697
+ parentAgent<T extends Agent>(
2698
+ cls: SubAgentClass<T>
2699
+ ): Promise<DurableObjectStub<T>>;
2406
2700
  /**
2407
2701
  * Get or create a named sub-agent — a child Durable Object (facet)
2408
2702
  * with its own isolated SQLite storage running on the same machine.
@@ -2427,6 +2721,16 @@ declare class Agent<
2427
2721
  cls: SubAgentClass<T>,
2428
2722
  name: string
2429
2723
  ): Promise<SubAgentStub<T>>;
2724
+ /**
2725
+ * Shared facet resolution — takes a CamelCase class name string
2726
+ * (matching `ctx.exports`) rather than a class reference. Both
2727
+ * `subAgent(cls, name)` and `_cf_invokeSubAgent(className, ...)`
2728
+ * funnel through here so registry bookkeeping and the
2729
+ * `_cf_initAsFacet` handshake are consistent.
2730
+ *
2731
+ * @internal
2732
+ */
2733
+ private _cf_resolveSubAgent;
2430
2734
  /**
2431
2735
  * Forcefully abort a running sub-agent. The child stops executing
2432
2736
  * immediately and will be restarted on next {@link subAgent} call.
@@ -2450,6 +2754,54 @@ declare class Agent<
2450
2754
  * @param name Name of the child to delete
2451
2755
  */
2452
2756
  deleteSubAgent(cls: SubAgentClass, name: string): void;
2757
+ /** @internal */
2758
+ private _subAgentRegistryReady;
2759
+ /** @internal */
2760
+ private _ensureSubAgentRegistry;
2761
+ /** @internal */
2762
+ private _recordSubAgent;
2763
+ /** @internal */
2764
+ private _forgetSubAgent;
2765
+ /**
2766
+ * Whether this agent has previously spawned (and not deleted) a
2767
+ * sub-agent of the given class and name. Backed by an
2768
+ * auto-maintained SQLite registry in the parent's storage.
2769
+ *
2770
+ * Intended for strict-registry access patterns in
2771
+ * `onBeforeSubAgent` or similar gating logic.
2772
+ *
2773
+ * @experimental The API surface may change before stabilizing.
2774
+ *
2775
+ * @example
2776
+ * ```ts
2777
+ * async onBeforeSubAgent(req, { className, name }) {
2778
+ * if (!this.hasSubAgent(className, name)) {
2779
+ * return new Response("Not found", { status: 404 });
2780
+ * }
2781
+ * }
2782
+ * ```
2783
+ */
2784
+ hasSubAgent<T extends Agent>(cls: SubAgentClass<T>, name: string): boolean;
2785
+ hasSubAgent(className: string, name: string): boolean;
2786
+ /**
2787
+ * List known sub-agents, optionally filtered by class. Reflects
2788
+ * the registry rows written by {@link subAgent} and removed by
2789
+ * {@link deleteSubAgent}.
2790
+ *
2791
+ * @experimental The API surface may change before stabilizing.
2792
+ */
2793
+ listSubAgents<T extends Agent>(
2794
+ cls: SubAgentClass<T>
2795
+ ): Array<{
2796
+ className: string;
2797
+ name: string;
2798
+ createdAt: number;
2799
+ }>;
2800
+ listSubAgents(className?: string): Array<{
2801
+ className: string;
2802
+ name: string;
2803
+ createdAt: number;
2804
+ }>;
2453
2805
  /**
2454
2806
  * Destroy the Agent, removing all state and scheduled tasks
2455
2807
  */
@@ -3068,6 +3420,7 @@ export {
3068
3420
  RPCServerTransport as Y,
3069
3421
  RPC_DO_PREFIX as Z,
3070
3422
  MCPServerMessage as _,
3423
+ parseSubAgentPath as _t,
3071
3424
  AgentNamespace as a,
3072
3425
  McpAuthContext as at,
3073
3426
  RPCRequest as b,
@@ -3079,7 +3432,9 @@ export {
3079
3432
  EmailRoutingOptions as f,
3080
3433
  McpClientOptions as ft,
3081
3434
  MCPServer as g,
3435
+ getSubAgentByName as gt,
3082
3436
  FiberRecoveryContext as h,
3437
+ SubAgentPathMatch as ht,
3083
3438
  AgentContext as i,
3084
3439
  experimental_createMcpHandler as it,
3085
3440
  getAgentByName as j,
@@ -3087,6 +3442,7 @@ export {
3087
3442
  Connection$1 as l,
3088
3443
  WorkerTransportOptions as lt,
3089
3444
  FiberContext as m,
3445
+ SUB_PREFIX as mt,
3090
3446
  AddRpcMcpServerOptions as n,
3091
3447
  CreateMcpHandlerOptions as nt,
3092
3448
  AgentOptions as o,
@@ -3103,9 +3459,10 @@ export {
3103
3459
  ConnectionContext$1 as u,
3104
3460
  SSEEdgeClientTransport as ut,
3105
3461
  MCPServersState as v,
3462
+ routeSubAgentRequest as vt,
3106
3463
  SqlError as w,
3107
3464
  RPCResponse as x,
3108
3465
  QueueItem as y,
3109
3466
  MCPClientOAuthResult as z
3110
3467
  };
3111
- //# sourceMappingURL=index-D9qo_Inc.d.ts.map
3468
+ //# sourceMappingURL=index-BM7Nk0QD.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  import { r as __DO_NOT_USE_WILL_BREAK__agentContext } from "./internal_context-BvuGZieY.js";
2
- import { t as RetryOptions } from "./retries-JlwH9mnV.js";
3
2
  import {
4
3
  A as callable,
5
4
  C as SendEmailOptions,
@@ -13,18 +12,22 @@ import {
13
12
  S as Schedule,
14
13
  T as StateUpdateMessage,
15
14
  _ as MCPServerMessage,
15
+ _t as parseSubAgentPath,
16
16
  a as AgentNamespace,
17
17
  b as RPCRequest,
18
18
  c as CallableMetadata,
19
19
  d as DEFAULT_AGENT_STATIC_OPTIONS,
20
20
  f as EmailRoutingOptions,
21
21
  g as MCPServer,
22
+ gt as getSubAgentByName,
22
23
  h as FiberRecoveryContext,
24
+ ht as SubAgentPathMatch,
23
25
  i as AgentContext,
24
26
  j as getAgentByName,
25
27
  k as WSMessage,
26
28
  l as Connection,
27
29
  m as FiberContext,
30
+ mt as SUB_PREFIX,
28
31
  n as AddRpcMcpServerOptions,
29
32
  o as AgentOptions,
30
33
  p as EmailSendBinding,
@@ -34,10 +37,12 @@ import {
34
37
  t as AddMcpServerOptions,
35
38
  u as ConnectionContext,
36
39
  v as MCPServersState,
40
+ vt as routeSubAgentRequest,
37
41
  w as SqlError,
38
42
  x as RPCResponse,
39
43
  y as QueueItem
40
- } from "./index-D9qo_Inc.js";
44
+ } from "./index-BM7Nk0QD.js";
45
+ import { t as RetryOptions } from "./retries-fLD8cGNf.js";
41
46
  import {
42
47
  n as AgentsOAuthProvider,
43
48
  r as DurableObjectOAuthClientProvider,
@@ -72,12 +77,14 @@ export {
72
77
  RPCRequest,
73
78
  RPCResponse,
74
79
  RetryOptions,
80
+ SUB_PREFIX,
75
81
  Schedule,
76
82
  SendEmailOptions,
77
83
  SqlError,
78
84
  StateUpdateMessage,
79
85
  StreamingResponse,
80
86
  SubAgentClass,
87
+ SubAgentPathMatch,
81
88
  SubAgentStub,
82
89
  TransportType,
83
90
  WSMessage,
@@ -86,7 +93,10 @@ export {
86
93
  createHeaderBasedEmailResolver,
87
94
  getAgentByName,
88
95
  getCurrentAgent,
96
+ getSubAgentByName,
97
+ parseSubAgentPath,
89
98
  routeAgentEmail,
90
99
  routeAgentRequest,
100
+ routeSubAgentRequest,
91
101
  unstable_callable
92
102
  };