agents 0.9.0 → 0.10.1

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 (54) hide show
  1. package/dist/chat/index.d.ts +151 -2
  2. package/dist/chat/index.js +210 -11
  3. package/dist/chat/index.js.map +1 -1
  4. package/dist/{client-BwgM3cRz.js → client-QBjFV5de.js} +161 -49
  5. package/dist/client-QBjFV5de.js.map +1 -0
  6. package/dist/client.d.ts +2 -2
  7. package/dist/{compaction-helpers-BFTBIzpK.js → compaction-helpers-BPE1_ziA.js} +1 -1
  8. package/dist/compaction-helpers-BPE1_ziA.js.map +1 -0
  9. package/dist/compaction-helpers-BdQbZiML.d.ts +441 -0
  10. package/dist/{do-oauth-client-provider-C2jurFjW.d.ts → do-oauth-client-provider-31gqR33H.d.ts} +1 -1
  11. package/dist/{email-DwPlM0bQ.d.ts → email-Cql45SKP.d.ts} +1 -1
  12. package/dist/email.d.ts +2 -2
  13. package/dist/experimental/memory/session/index.d.ts +82 -218
  14. package/dist/experimental/memory/session/index.js +493 -56
  15. package/dist/experimental/memory/session/index.js.map +1 -1
  16. package/dist/experimental/memory/utils/index.d.ts +3 -4
  17. package/dist/experimental/memory/utils/index.js +1 -1
  18. package/dist/experimental/memory/utils/index.js.map +1 -1
  19. package/dist/{index-BtHngIIG.d.ts → index-D2lfljd3.d.ts} +205 -75
  20. package/dist/{index-Ua2Nfvbm.d.ts → index-DDSX-g7W.d.ts} +11 -1
  21. package/dist/index.d.ts +30 -26
  22. package/dist/index.js +2 -3049
  23. package/dist/{internal_context-DT8RxmAN.d.ts → internal_context-DuQZFvWI.d.ts} +1 -1
  24. package/dist/internal_context.d.ts +1 -1
  25. package/dist/mcp/client.d.ts +2 -2
  26. package/dist/mcp/client.js +1 -1
  27. package/dist/mcp/do-oauth-client-provider.d.ts +1 -1
  28. package/dist/mcp/index.d.ts +1 -1
  29. package/dist/mcp/index.js +3 -11
  30. package/dist/mcp/index.js.map +1 -1
  31. package/dist/observability/index.d.ts +1 -1
  32. package/dist/react.d.ts +3 -1
  33. package/dist/react.js +3 -0
  34. package/dist/react.js.map +1 -1
  35. package/dist/{retries-DXMQGhG3.d.ts → retries-B_CN5KM9.d.ts} +1 -1
  36. package/dist/retries.d.ts +1 -1
  37. package/dist/{serializable-8Jt1B04R.d.ts → serializable-DGdO8CDh.d.ts} +1 -1
  38. package/dist/serializable.d.ts +1 -1
  39. package/dist/src-B8NZxxsO.js +3217 -0
  40. package/dist/src-B8NZxxsO.js.map +1 -0
  41. package/dist/{types-C-m0II8i.d.ts → types-B9A8AU7B.d.ts} +1 -1
  42. package/dist/types.d.ts +1 -1
  43. package/dist/{workflow-types-CZNXKj_D.d.ts → workflow-types-XmOkuI7A.d.ts} +1 -1
  44. package/dist/workflow-types.d.ts +1 -1
  45. package/dist/workflows.d.ts +2 -2
  46. package/dist/workflows.js +1 -1
  47. package/package.json +12 -16
  48. package/dist/client-BwgM3cRz.js.map +0 -1
  49. package/dist/compaction-helpers-BFTBIzpK.js.map +0 -1
  50. package/dist/compaction-helpers-DkJreaDR.d.ts +0 -139
  51. package/dist/experimental/forever.d.ts +0 -64
  52. package/dist/experimental/forever.js +0 -338
  53. package/dist/experimental/forever.js.map +0 -1
  54. package/dist/index.js.map +0 -1
@@ -1,11 +1,11 @@
1
- import { n as AgentEmail } from "./internal_context-DT8RxmAN.js";
2
- import { t as RetryOptions } from "./retries-DXMQGhG3.js";
1
+ import { n as AgentEmail } from "./internal_context-DuQZFvWI.js";
2
+ import { t as RetryOptions } from "./retries-B_CN5KM9.js";
3
3
  import {
4
4
  n as Observability,
5
5
  r as ObservabilityEvent,
6
6
  s as MCPObservabilityEvent
7
- } from "./index-Ua2Nfvbm.js";
8
- import { t as AgentMcpOAuthProvider } from "./do-oauth-client-provider-C2jurFjW.js";
7
+ } from "./index-DDSX-g7W.js";
8
+ import { t as AgentMcpOAuthProvider } from "./do-oauth-client-provider-31gqR33H.js";
9
9
  import {
10
10
  _ as WorkflowPage,
11
11
  g as WorkflowInfo,
@@ -13,9 +13,10 @@ import {
13
13
  l as WorkflowCallback,
14
14
  s as RunWorkflowOptions,
15
15
  y as WorkflowQueryCriteria
16
- } from "./workflow-types-CZNXKj_D.js";
17
- import { t as MessageType } from "./types-C-m0II8i.js";
18
- import { r as EmailResolver } from "./email-DwPlM0bQ.js";
16
+ } from "./workflow-types-XmOkuI7A.js";
17
+ import { t as MessageType } from "./types-B9A8AU7B.js";
18
+ import { r as EmailResolver } from "./email-Cql45SKP.js";
19
+ import { RpcTarget } from "cloudflare:workers";
19
20
  import {
20
21
  Connection,
21
22
  Connection as Connection$1,
@@ -499,10 +500,13 @@ declare class MCPClientConnection {
499
500
  lastConnectedTransport: BaseTransportType | undefined;
500
501
  instructions?: string;
501
502
  tools: Tool[];
503
+ private _transport?;
502
504
  prompts: Prompt[];
503
505
  resources: Resource[];
504
506
  resourceTemplates: ResourceTemplate[];
505
507
  serverCapabilities: ServerCapabilities | undefined;
508
+ /** True when resuming a streamable-http session without cached capabilities */
509
+ private _probingCapabilities;
506
510
  /** Tracks in-flight discovery to allow cancellation */
507
511
  private _discoveryAbortController;
508
512
  private readonly _onObservabilityEvent;
@@ -714,6 +718,10 @@ declare class MCPClientConnection {
714
718
  * Automatically uses the Agent's built-in elicitation handling if available
715
719
  */
716
720
  handleElicitationRequest(_request: ElicitRequest): Promise<ElicitResult>;
721
+ private isResumedStreamableHttpSession;
722
+ get sessionId(): string | undefined;
723
+ private getTransportName;
724
+ close(): Promise<void>;
717
725
  /**
718
726
  * Get the transport for the client
719
727
  * @param transportType - The transport type to get
@@ -721,7 +729,7 @@ declare class MCPClientConnection {
721
729
  */
722
730
  getTransport(
723
731
  transportType: BaseTransportType
724
- ): RPCClientTransport | SSEClientTransport | StreamableHTTPClientTransport;
732
+ ): StreamableHTTPClientTransport | SSEClientTransport | RPCClientTransport;
725
733
  private tryConnect;
726
734
  private _capabilityErrorHandler;
727
735
  }
@@ -750,6 +758,7 @@ type MCPServerOptions = {
750
758
  transport?: {
751
759
  headers?: HeadersInit;
752
760
  type?: TransportType;
761
+ sessionId?: string;
753
762
  } /** Retry options for connection and reconnection attempts */;
754
763
  retry?: RetryOptions;
755
764
  };
@@ -828,6 +837,19 @@ type MCPClientManagerOptions = {
828
837
  storage: DurableObjectStorage;
829
838
  createAuthProvider?: (callbackUrl: string) => AgentMcpOAuthProvider;
830
839
  };
840
+ /**
841
+ * Filter options for scoping tools, prompts, resources, and resource templates
842
+ * to a subset of connected MCP servers. All specified criteria are AND'd together.
843
+ */
844
+ type MCPServerFilter = {
845
+ /** Include only connections matching this server ID (or IDs). */ serverId?:
846
+ | string
847
+ | string[] /** Include only connections whose stored name matches (or is in) this value. */;
848
+ serverName?:
849
+ | string
850
+ | string[] /** Include only connections currently in this state (or states). */;
851
+ state?: MCPConnectionState | MCPConnectionState[];
852
+ };
831
853
  /**
832
854
  * Utility class that aggregates multiple MCP clients into one
833
855
  */
@@ -865,11 +887,13 @@ declare class MCPClientManager {
865
887
  private saveServerToStorage;
866
888
  private removeServerFromStorage;
867
889
  private getServersFromStorage;
890
+ private filterConnections;
868
891
  /**
869
892
  * Get the retry options for a server from stored server_options
870
893
  */
871
894
  private getServerRetryOptions;
872
895
  private clearServerAuthUrl;
896
+ private updateStoredSessionId;
873
897
  private failConnection;
874
898
  /**
875
899
  * Create an auth provider for a server
@@ -1023,18 +1047,21 @@ declare class MCPClientManager {
1023
1047
  */
1024
1048
  getOAuthCallbackConfig(): MCPClientOAuthCallbackConfig | undefined;
1025
1049
  /**
1050
+ * @param filter - Optional filter to scope results to specific servers
1026
1051
  * @returns namespaced list of tools
1027
1052
  */
1028
- listTools(): NamespacedData["tools"];
1053
+ listTools(filter?: MCPServerFilter): NamespacedData["tools"];
1029
1054
  /**
1055
+ * @param filter - Optional filter to scope results to specific servers
1030
1056
  * @returns a set of tools that you can use with the AI SDK
1031
1057
  */
1032
- getAITools(): ToolSet;
1058
+ getAITools(filter?: MCPServerFilter): ToolSet;
1033
1059
  /**
1034
1060
  * @deprecated this has been renamed to getAITools(), and unstable_getAITools will be removed in the next major version
1061
+ * @param filter - Optional filter to scope results to specific servers
1035
1062
  * @returns a set of tools that you can use with the AI SDK
1036
1063
  */
1037
- unstable_getAITools(): ToolSet;
1064
+ unstable_getAITools(filter?: MCPServerFilter): ToolSet;
1038
1065
  /**
1039
1066
  * Closes all active in-memory connections to MCP servers.
1040
1067
  *
@@ -1045,6 +1072,7 @@ declare class MCPClientManager {
1045
1072
  * Use removeServer() instead if you want to fully clean up a server
1046
1073
  * (closes connection AND removes from storage).
1047
1074
  */
1075
+ private cleanupClosedConnection;
1048
1076
  closeAllConnections(): Promise<void>;
1049
1077
  /**
1050
1078
  * Closes a connection to an MCP server
@@ -1064,17 +1092,22 @@ declare class MCPClientManager {
1064
1092
  */
1065
1093
  dispose(): Promise<void>;
1066
1094
  /**
1095
+ * @param filter - Optional filter to scope results to specific servers
1067
1096
  * @returns namespaced list of prompts
1068
1097
  */
1069
- listPrompts(): NamespacedData["prompts"];
1098
+ listPrompts(filter?: MCPServerFilter): NamespacedData["prompts"];
1070
1099
  /**
1071
- * @returns namespaced list of tools
1100
+ * @param filter - Optional filter to scope results to specific servers
1101
+ * @returns namespaced list of resources
1072
1102
  */
1073
- listResources(): NamespacedData["resources"];
1103
+ listResources(filter?: MCPServerFilter): NamespacedData["resources"];
1074
1104
  /**
1105
+ * @param filter - Optional filter to scope results to specific servers
1075
1106
  * @returns namespaced list of resource templates
1076
1107
  */
1077
- listResourceTemplates(): NamespacedData["resourceTemplates"];
1108
+ listResourceTemplates(
1109
+ filter?: MCPServerFilter
1110
+ ): NamespacedData["resourceTemplates"];
1078
1111
  /**
1079
1112
  * Namespaced version of callTool
1080
1113
  */
@@ -1530,6 +1563,27 @@ type Schedule<T = string> = {
1530
1563
  intervalSeconds: number;
1531
1564
  }
1532
1565
  );
1566
+ /**
1567
+ * Context passed to the `runFiber` callback. Provides checkpoint
1568
+ * and identity for durable execution.
1569
+ */
1570
+ type FiberContext = {
1571
+ /** Unique identifier for this fiber execution. */ id: string /** Checkpoint data during execution. Synchronous SQLite write. */;
1572
+ stash(
1573
+ data: unknown
1574
+ ): void /** Last checkpoint data (null on first run, populated on recovery re-invocation). */;
1575
+ snapshot: unknown | null;
1576
+ };
1577
+ /**
1578
+ * Context passed to the `onFiberRecovered` hook when an interrupted
1579
+ * fiber is detected after DO restart.
1580
+ */
1581
+ type FiberRecoveryContext = {
1582
+ /** Fiber ID. */ id: string /** Name passed to `runFiber`. */;
1583
+ name: string /** Last checkpoint data from `stash()`, or null if never stashed. */;
1584
+ snapshot: unknown | null;
1585
+ [key: string]: unknown;
1586
+ };
1533
1587
  /**
1534
1588
  * MCP Server state update message from server -> Client
1535
1589
  */
@@ -1599,7 +1653,12 @@ declare const DEFAULT_AGENT_STATIC_OPTIONS: {
1599
1653
  * and force-reset. Increase this if you have callbacks that legitimately
1600
1654
  * take longer than 30 seconds.
1601
1655
  */
1602
- hungScheduleTimeoutSeconds: number /** Default retry options for schedule(), queue(), and this.retry() */;
1656
+ hungScheduleTimeoutSeconds: number;
1657
+ /**
1658
+ * Interval in milliseconds for keepAlive() alarm heartbeats.
1659
+ * Lower values mean faster recovery after eviction but more frequent alarms.
1660
+ */
1661
+ keepAliveIntervalMs: number /** Default retry options for schedule(), queue(), and this.retry() */;
1603
1662
  retry: {
1604
1663
  maxAttempts: number;
1605
1664
  baseDelayMs: number;
@@ -1616,6 +1675,12 @@ interface AgentStaticOptions {
1616
1675
  hibernate?: boolean;
1617
1676
  sendIdentityOnConnect?: boolean;
1618
1677
  hungScheduleTimeoutSeconds?: number;
1678
+ /**
1679
+ * Interval in milliseconds for keepAlive() alarm heartbeats.
1680
+ * Default: 30000 (30 seconds). Lower values mean faster recovery
1681
+ * after eviction but more frequent alarms.
1682
+ */
1683
+ keepAliveIntervalMs?: number;
1619
1684
  /** Default retry options for schedule(), queue(), and this.retry(). */
1620
1685
  retry?: RetryOptions;
1621
1686
  }
@@ -1674,12 +1739,16 @@ declare class Agent<
1674
1739
  private _warnedScheduleInOnStart;
1675
1740
  /**
1676
1741
  * Number of active keepAlive() callers. When > 0, `_scheduleNextAlarm()`
1677
- * caps the next alarm at KEEP_ALIVE_INTERVAL_MS so the DO stays alive.
1742
+ * caps the next alarm at `keepAliveIntervalMs` so the DO stays alive.
1678
1743
  * Purely in-memory — lost on eviction, which is correct because the
1679
1744
  * in-memory work keepAlive was protecting is also lost.
1680
1745
  * @internal
1681
1746
  */
1682
1747
  _keepAliveRefs: number;
1748
+ /** @internal In-memory set of fiber IDs running in this process. */
1749
+ private _runFiberActiveFibers;
1750
+ /** @internal Prevents re-entrant recovery from overlapping alarm ticks. */
1751
+ private _runFiberRecoveryInProgress;
1683
1752
  private _ParentClass;
1684
1753
  readonly mcp: MCPClientManager;
1685
1754
  /**
@@ -1916,9 +1985,16 @@ declare class Agent<
1916
1985
  /**
1917
1986
  * Called when the Agent receives an email via routeAgentEmail()
1918
1987
  * Override this method to handle incoming emails
1919
- * @param email Email message to process
1988
+ * @param payload Internal wire format — plain data + RpcTarget bridge
1920
1989
  */
1921
- _onEmail(email: AgentEmail): Promise<void>;
1990
+ _onEmail(payload: {
1991
+ from: string;
1992
+ to: string;
1993
+ headers: Headers;
1994
+ rawSize: number;
1995
+ _secureRouted?: boolean;
1996
+ _bridge: EmailBridge;
1997
+ }): Promise<void>;
1922
1998
  /**
1923
1999
  * Reply to an email
1924
2000
  * @param email The email to reply to
@@ -2116,8 +2192,9 @@ declare class Agent<
2116
2192
  *
2117
2193
  * Use this when you have long-running work and need to prevent the
2118
2194
  * DO from going idle (eviction after ~70-140s of inactivity).
2119
- * The heartbeat fires every 30 seconds via the alarm system, without
2120
- * creating schedule rows or emitting observability events.
2195
+ * The heartbeat fires every `keepAliveIntervalMs` (default 30s) via the
2196
+ * alarm system, without creating schedule rows or emitting observability
2197
+ * events. Configure via `static options = { keepAliveIntervalMs: 5000 }`.
2121
2198
  *
2122
2199
  * @example
2123
2200
  * ```ts
@@ -2148,11 +2225,48 @@ declare class Agent<
2148
2225
  */
2149
2226
  keepAliveWhile<T>(fn: () => Promise<T>): Promise<T>;
2150
2227
  /**
2151
- * Hook invoked on every alarm cycle, after schedule processing.
2152
- * Override in subclasses (e.g. the fiber mixin) to run
2153
- * housekeeping such as detecting fibers interrupted by eviction.
2228
+ * Run a function as a durable fiber. The fiber is registered in SQLite
2229
+ * before execution, checkpointable during execution via `ctx.stash()`,
2230
+ * and recoverable after eviction via `onFiberRecovered`.
2231
+ *
2232
+ * - Row created in `cf_agents_runs` at start, deleted on completion
2233
+ * - `keepAlive()` held for the duration — prevents idle eviction
2234
+ * - Inline (await result) or fire-and-forget (`void this.runFiber(...)`)
2235
+ *
2236
+ * @param name Informational name for debugging and recovery filtering
2237
+ * @param fn Async function to execute. Receives a FiberContext with stash/snapshot.
2238
+ * @returns The return value of fn
2239
+ */
2240
+ runFiber<T>(name: string, fn: (ctx: FiberContext) => Promise<T>): Promise<T>;
2241
+ /**
2242
+ * Checkpoint data for the currently executing fiber.
2243
+ * Uses AsyncLocalStorage to identify the correct fiber,
2244
+ * so it works correctly even with concurrent fibers.
2245
+ *
2246
+ * Throws if called outside a `runFiber` callback.
2247
+ */
2248
+ stash(data: unknown): void;
2249
+ /**
2250
+ * Called when an interrupted fiber is detected after restart.
2251
+ * Override to implement recovery (re-invoke work, notify clients, etc.).
2252
+ *
2253
+ * Internal framework fibers are filtered by `_handleInternalFiberRecovery`
2254
+ * before this hook runs — users only see their own fibers.
2255
+ *
2256
+ * Default: logs a warning.
2257
+ */
2258
+ onFiberRecovered(_ctx: FiberRecoveryContext): Promise<void>;
2259
+ /**
2260
+ * Override point for subclasses to handle internal (framework) fibers
2261
+ * before the user's recovery hook fires. Return `true` if handled.
2154
2262
  * @internal
2155
2263
  */
2264
+ protected _handleInternalFiberRecovery(
2265
+ _ctx: FiberRecoveryContext
2266
+ ): Promise<boolean>;
2267
+ /** @internal Detect fibers left by a dead process (runFiber system). */
2268
+ private _checkRunFibers;
2269
+ /** @internal */
2156
2270
  _onAlarmHousekeeping(): Promise<void>;
2157
2271
  private _scheduleNextAlarm;
2158
2272
  /**
@@ -2738,6 +2852,19 @@ type EmailRoutingOptions<Env> = AgentOptions<Env> & {
2738
2852
  */
2739
2853
  onNoRoute?: (email: ForwardableEmailMessage) => void | Promise<void>;
2740
2854
  };
2855
+ declare class EmailBridge extends RpcTarget {
2856
+ #private;
2857
+ constructor(email: ForwardableEmailMessage);
2858
+ getRaw(): Promise<Uint8Array>;
2859
+ setReject(reason: string): void;
2860
+ forward(rcptTo: string, headers?: Headers): Promise<EmailSendResult>;
2861
+ reply(options: {
2862
+ from: string;
2863
+ to: string;
2864
+ raw: string;
2865
+ }): Promise<EmailSendResult>;
2866
+ [Symbol.dispose](): void;
2867
+ }
2741
2868
  /**
2742
2869
  * Route an email to the appropriate Agent
2743
2870
  * @param email The email to route
@@ -2805,67 +2932,70 @@ declare class StreamingResponse {
2805
2932
  }
2806
2933
  //#endregion
2807
2934
  export {
2808
- experimental_createMcpHandler as $,
2809
- routeAgentRequest as A,
2810
- RegisterServerOptions as B,
2811
- SubAgentClass as C,
2812
- getAgentByName as D,
2813
- callable as E,
2814
- MCPClientOAuthResult as F,
2815
- RPCServerTransportOptions as G,
2816
- RPCClientTransport as H,
2817
- MCPConnectionResult as I,
2818
- ElicitRequestSchema$1 as J,
2819
- RPC_DO_PREFIX as K,
2820
- MCPDiscoverResult as L,
2821
- MCPClientManager as M,
2822
- MCPClientManagerOptions as N,
2823
- getCurrentAgent as O,
2824
- MCPClientOAuthCallbackConfig as P,
2825
- createMcpHandler as Q,
2826
- MCPOAuthCallbackResult as R,
2827
- StreamingResponse as S,
2828
- WSMessage as T,
2829
- RPCClientTransportOptions as U,
2830
- getNamespacedData as V,
2831
- RPCServerTransport as W,
2832
- McpAgent as X,
2833
- ElicitResult$1 as Y,
2834
- CreateMcpHandlerOptions as Z,
2835
- RPCRequest as _,
2935
+ McpAgent as $,
2936
+ getCurrentAgent as A,
2937
+ MCPOAuthCallbackResult as B,
2938
+ StateUpdateMessage as C,
2939
+ WSMessage as D,
2940
+ SubAgentStub as E,
2941
+ MCPClientManagerOptions as F,
2942
+ RPCClientTransport as G,
2943
+ MCPServerOptions as H,
2944
+ MCPClientOAuthCallbackConfig as I,
2945
+ RPCServerTransportOptions as J,
2946
+ RPCClientTransportOptions as K,
2947
+ MCPClientOAuthResult as L,
2948
+ routeAgentRequest as M,
2949
+ unstable_callable as N,
2950
+ callable as O,
2951
+ MCPClientManager as P,
2952
+ ElicitResult$1 as Q,
2953
+ MCPConnectionResult as R,
2954
+ SqlError as S,
2955
+ SubAgentClass as T,
2956
+ RegisterServerOptions as U,
2957
+ MCPServerFilter as V,
2958
+ getNamespacedData as W,
2959
+ ElicitRequest$1 as X,
2960
+ RPC_DO_PREFIX as Y,
2961
+ ElicitRequestSchema$1 as Z,
2962
+ MCPServersState as _,
2836
2963
  AgentNamespace as a,
2837
- SSEEdgeClientTransport as at,
2838
- SqlError as b,
2964
+ TransportState as at,
2965
+ RPCResponse as b,
2839
2966
  CallableMetadata as c,
2840
- TransportType as ct,
2967
+ SSEEdgeClientTransport as ct,
2841
2968
  DEFAULT_AGENT_STATIC_OPTIONS as d,
2842
- McpAuthContext as et,
2969
+ TransportType as dt,
2970
+ CreateMcpHandlerOptions as et,
2843
2971
  EmailRoutingOptions as f,
2844
- QueueItem as g,
2845
- MCPServersState as h,
2972
+ MCPServerMessage as g,
2973
+ MCPServer as h,
2846
2974
  AgentContext as i,
2847
- WorkerTransportOptions as it,
2848
- unstable_callable as j,
2849
- routeAgentEmail as k,
2975
+ getMcpAuthContext as it,
2976
+ routeAgentEmail as j,
2977
+ getAgentByName as k,
2850
2978
  Connection$1 as l,
2851
- MCPServerMessage as m,
2979
+ StreamableHTTPEdgeClientTransport as lt,
2980
+ FiberRecoveryContext as m,
2852
2981
  AddRpcMcpServerOptions as n,
2853
- TransportState as nt,
2982
+ experimental_createMcpHandler as nt,
2854
2983
  AgentOptions as o,
2855
- StreamableHTTPEdgeClientTransport as ot,
2856
- MCPServer as p,
2857
- ElicitRequest$1 as q,
2984
+ WorkerTransport as ot,
2985
+ FiberContext as p,
2986
+ RPCServerTransport as q,
2858
2987
  Agent as r,
2859
- WorkerTransport as rt,
2988
+ McpAuthContext as rt,
2860
2989
  AgentStaticOptions as s,
2861
- McpClientOptions as st,
2990
+ WorkerTransportOptions as st,
2862
2991
  AddMcpServerOptions as t,
2863
- getMcpAuthContext as tt,
2992
+ createMcpHandler as tt,
2864
2993
  ConnectionContext$1 as u,
2865
- RPCResponse as v,
2866
- SubAgentStub as w,
2867
- StateUpdateMessage as x,
2868
- Schedule as y,
2869
- MCPServerOptions as z
2994
+ McpClientOptions as ut,
2995
+ QueueItem as v,
2996
+ StreamingResponse as w,
2997
+ Schedule as x,
2998
+ RPCRequest as y,
2999
+ MCPDiscoverResult as z
2870
3000
  };
2871
- //# sourceMappingURL=index-BtHngIIG.d.ts.map
3001
+ //# sourceMappingURL=index-D2lfljd3.d.ts.map
@@ -67,6 +67,16 @@ type MCPObservabilityEvent =
67
67
  error?: string;
68
68
  capability?: string;
69
69
  }
70
+ >
71
+ | BaseEvent<
72
+ "mcp:client:close",
73
+ {
74
+ url: string;
75
+ transport?: string;
76
+ state: string;
77
+ error?: string;
78
+ phase?: "terminate-session" | "client-close";
79
+ }
70
80
  >;
71
81
  //#endregion
72
82
  //#region src/observability/agent.d.ts
@@ -403,4 +413,4 @@ export {
403
413
  MCPObservabilityEvent as s,
404
414
  ChannelEventMap as t
405
415
  };
406
- //# sourceMappingURL=index-Ua2Nfvbm.d.ts.map
416
+ //# sourceMappingURL=index-DDSX-g7W.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,46 +1,48 @@
1
- import { r as __DO_NOT_USE_WILL_BREAK__agentContext } from "./internal_context-DT8RxmAN.js";
2
- import { t as RetryOptions } from "./retries-DXMQGhG3.js";
1
+ import { r as __DO_NOT_USE_WILL_BREAK__agentContext } from "./internal_context-DuQZFvWI.js";
2
+ import { t as RetryOptions } from "./retries-B_CN5KM9.js";
3
3
  import {
4
- A as routeAgentRequest,
5
- C as SubAgentClass,
6
- D as getAgentByName,
7
- E as callable,
8
- O as getCurrentAgent,
9
- S as StreamingResponse,
10
- T as WSMessage,
11
- _ as RPCRequest,
4
+ A as getCurrentAgent,
5
+ C as StateUpdateMessage,
6
+ D as WSMessage,
7
+ E as SubAgentStub,
8
+ M as routeAgentRequest,
9
+ N as unstable_callable,
10
+ O as callable,
11
+ S as SqlError,
12
+ T as SubAgentClass,
13
+ _ as MCPServersState,
12
14
  a as AgentNamespace,
13
- b as SqlError,
15
+ b as RPCResponse,
14
16
  c as CallableMetadata,
15
- ct as TransportType,
16
17
  d as DEFAULT_AGENT_STATIC_OPTIONS,
18
+ dt as TransportType,
17
19
  f as EmailRoutingOptions,
18
- g as QueueItem,
19
- h as MCPServersState,
20
+ g as MCPServerMessage,
21
+ h as MCPServer,
20
22
  i as AgentContext,
21
- j as unstable_callable,
22
- k as routeAgentEmail,
23
+ j as routeAgentEmail,
24
+ k as getAgentByName,
23
25
  l as Connection,
24
- m as MCPServerMessage,
26
+ m as FiberRecoveryContext,
25
27
  n as AddRpcMcpServerOptions,
26
28
  o as AgentOptions,
27
- p as MCPServer,
29
+ p as FiberContext,
28
30
  r as Agent,
29
31
  s as AgentStaticOptions,
30
32
  t as AddMcpServerOptions,
31
33
  u as ConnectionContext,
32
- v as RPCResponse,
33
- w as SubAgentStub,
34
- x as StateUpdateMessage,
35
- y as Schedule
36
- } from "./index-BtHngIIG.js";
34
+ v as QueueItem,
35
+ w as StreamingResponse,
36
+ x as Schedule,
37
+ y as RPCRequest
38
+ } from "./index-D2lfljd3.js";
37
39
  import {
38
40
  n as AgentsOAuthProvider,
39
41
  r as DurableObjectOAuthClientProvider,
40
42
  t as AgentMcpOAuthProvider
41
- } from "./do-oauth-client-provider-C2jurFjW.js";
42
- import { t as MessageType } from "./types-C-m0II8i.js";
43
- import { l as createHeaderBasedEmailResolver } from "./email-DwPlM0bQ.js";
43
+ } from "./do-oauth-client-provider-31gqR33H.js";
44
+ import { t as MessageType } from "./types-B9A8AU7B.js";
45
+ import { l as createHeaderBasedEmailResolver } from "./email-Cql45SKP.js";
44
46
  export {
45
47
  AddMcpServerOptions,
46
48
  AddRpcMcpServerOptions,
@@ -57,6 +59,8 @@ export {
57
59
  DEFAULT_AGENT_STATIC_OPTIONS,
58
60
  DurableObjectOAuthClientProvider,
59
61
  EmailRoutingOptions,
62
+ FiberContext,
63
+ FiberRecoveryContext,
60
64
  MCPServer,
61
65
  MCPServerMessage,
62
66
  MCPServersState,