agents 0.8.7 → 0.10.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.
Files changed (50) hide show
  1. package/dist/chat/index.d.ts +603 -0
  2. package/dist/chat/index.js +1285 -0
  3. package/dist/chat/index.js.map +1 -0
  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-BFTBIzpK.js.map → compaction-helpers-BPE1_ziA.js.map} +1 -1
  9. package/dist/{compaction-helpers-DkJreaDR.d.ts → compaction-helpers-CHNQeyRm.d.ts} +1 -1
  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 +298 -73
  14. package/dist/experimental/memory/session/index.js +754 -66
  15. package/dist/experimental/memory/session/index.js.map +1 -1
  16. package/dist/experimental/memory/utils/index.d.ts +1 -1
  17. package/dist/experimental/memory/utils/index.js +1 -1
  18. package/dist/{index-C-6EMK-E.d.ts → index-BPkkIqMn.d.ts} +209 -76
  19. package/dist/{index-Ua2Nfvbm.d.ts → index-DDSX-g7W.d.ts} +11 -1
  20. package/dist/index.d.ts +30 -26
  21. package/dist/index.js +2 -3049
  22. package/dist/{internal_context-DT8RxmAN.d.ts → internal_context-DuQZFvWI.d.ts} +1 -1
  23. package/dist/internal_context.d.ts +1 -1
  24. package/dist/mcp/client.d.ts +2 -2
  25. package/dist/mcp/client.js +1 -1
  26. package/dist/mcp/do-oauth-client-provider.d.ts +1 -1
  27. package/dist/mcp/index.d.ts +1 -1
  28. package/dist/mcp/index.js +2 -2
  29. package/dist/observability/index.d.ts +1 -1
  30. package/dist/react.d.ts +3 -1
  31. package/dist/react.js +3 -0
  32. package/dist/react.js.map +1 -1
  33. package/dist/{retries-DXMQGhG3.d.ts → retries-B_CN5KM9.d.ts} +1 -1
  34. package/dist/retries.d.ts +1 -1
  35. package/dist/{serializable-8Jt1B04R.d.ts → serializable-DGdO8CDh.d.ts} +1 -1
  36. package/dist/serializable.d.ts +1 -1
  37. package/dist/src-B8NZxxsO.js +3217 -0
  38. package/dist/src-B8NZxxsO.js.map +1 -0
  39. package/dist/{types-C-m0II8i.d.ts → types-B9A8AU7B.d.ts} +1 -1
  40. package/dist/types.d.ts +1 -1
  41. package/dist/{workflow-types-CZNXKj_D.d.ts → workflow-types-XmOkuI7A.d.ts} +1 -1
  42. package/dist/workflow-types.d.ts +1 -1
  43. package/dist/workflows.d.ts +2 -2
  44. package/dist/workflows.js +1 -1
  45. package/package.json +20 -18
  46. package/dist/client-BwgM3cRz.js.map +0 -1
  47. package/dist/experimental/forever.d.ts +0 -64
  48. package/dist/experimental/forever.js +0 -338
  49. package/dist/experimental/forever.js.map +0 -1
  50. 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,
@@ -55,8 +56,8 @@ import {
55
56
  ServerCapabilities,
56
57
  Tool
57
58
  } from "@modelcontextprotocol/sdk/types.js";
58
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
59
59
  import { ToolSet } from "ai";
60
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
60
61
  import { RequestOptions } from "@modelcontextprotocol/sdk/shared/protocol.js";
61
62
  import {
62
63
  Transport,
@@ -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;
@@ -629,6 +633,7 @@ declare class MCPClientConnection {
629
633
  name: string;
630
634
  description?: string | undefined;
631
635
  mimeType?: string | undefined;
636
+ size?: number | undefined;
632
637
  annotations?:
633
638
  | {
634
639
  audience?: ("user" | "assistant")[] | undefined;
@@ -713,6 +718,10 @@ declare class MCPClientConnection {
713
718
  * Automatically uses the Agent's built-in elicitation handling if available
714
719
  */
715
720
  handleElicitationRequest(_request: ElicitRequest): Promise<ElicitResult>;
721
+ private isResumedStreamableHttpSession;
722
+ get sessionId(): string | undefined;
723
+ private getTransportName;
724
+ close(): Promise<void>;
716
725
  /**
717
726
  * Get the transport for the client
718
727
  * @param transportType - The transport type to get
@@ -720,7 +729,7 @@ declare class MCPClientConnection {
720
729
  */
721
730
  getTransport(
722
731
  transportType: BaseTransportType
723
- ): StreamableHTTPClientTransport | SSEClientTransport | RPCClientTransport;
732
+ ): RPCClientTransport | SSEClientTransport | StreamableHTTPClientTransport;
724
733
  private tryConnect;
725
734
  private _capabilityErrorHandler;
726
735
  }
@@ -749,6 +758,7 @@ type MCPServerOptions = {
749
758
  transport?: {
750
759
  headers?: HeadersInit;
751
760
  type?: TransportType;
761
+ sessionId?: string;
752
762
  } /** Retry options for connection and reconnection attempts */;
753
763
  retry?: RetryOptions;
754
764
  };
@@ -827,6 +837,19 @@ type MCPClientManagerOptions = {
827
837
  storage: DurableObjectStorage;
828
838
  createAuthProvider?: (callbackUrl: string) => AgentMcpOAuthProvider;
829
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
+ };
830
853
  /**
831
854
  * Utility class that aggregates multiple MCP clients into one
832
855
  */
@@ -864,11 +887,13 @@ declare class MCPClientManager {
864
887
  private saveServerToStorage;
865
888
  private removeServerFromStorage;
866
889
  private getServersFromStorage;
890
+ private filterConnections;
867
891
  /**
868
892
  * Get the retry options for a server from stored server_options
869
893
  */
870
894
  private getServerRetryOptions;
871
895
  private clearServerAuthUrl;
896
+ private updateStoredSessionId;
872
897
  private failConnection;
873
898
  /**
874
899
  * Create an auth provider for a server
@@ -1022,18 +1047,21 @@ declare class MCPClientManager {
1022
1047
  */
1023
1048
  getOAuthCallbackConfig(): MCPClientOAuthCallbackConfig | undefined;
1024
1049
  /**
1050
+ * @param filter - Optional filter to scope results to specific servers
1025
1051
  * @returns namespaced list of tools
1026
1052
  */
1027
- listTools(): NamespacedData["tools"];
1053
+ listTools(filter?: MCPServerFilter): NamespacedData["tools"];
1028
1054
  /**
1055
+ * @param filter - Optional filter to scope results to specific servers
1029
1056
  * @returns a set of tools that you can use with the AI SDK
1030
1057
  */
1031
- getAITools(): ToolSet;
1058
+ getAITools(filter?: MCPServerFilter): ToolSet;
1032
1059
  /**
1033
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
1034
1062
  * @returns a set of tools that you can use with the AI SDK
1035
1063
  */
1036
- unstable_getAITools(): ToolSet;
1064
+ unstable_getAITools(filter?: MCPServerFilter): ToolSet;
1037
1065
  /**
1038
1066
  * Closes all active in-memory connections to MCP servers.
1039
1067
  *
@@ -1044,6 +1072,7 @@ declare class MCPClientManager {
1044
1072
  * Use removeServer() instead if you want to fully clean up a server
1045
1073
  * (closes connection AND removes from storage).
1046
1074
  */
1075
+ private cleanupClosedConnection;
1047
1076
  closeAllConnections(): Promise<void>;
1048
1077
  /**
1049
1078
  * Closes a connection to an MCP server
@@ -1063,17 +1092,22 @@ declare class MCPClientManager {
1063
1092
  */
1064
1093
  dispose(): Promise<void>;
1065
1094
  /**
1095
+ * @param filter - Optional filter to scope results to specific servers
1066
1096
  * @returns namespaced list of prompts
1067
1097
  */
1068
- listPrompts(): NamespacedData["prompts"];
1098
+ listPrompts(filter?: MCPServerFilter): NamespacedData["prompts"];
1069
1099
  /**
1070
- * @returns namespaced list of tools
1100
+ * @param filter - Optional filter to scope results to specific servers
1101
+ * @returns namespaced list of resources
1071
1102
  */
1072
- listResources(): NamespacedData["resources"];
1103
+ listResources(filter?: MCPServerFilter): NamespacedData["resources"];
1073
1104
  /**
1105
+ * @param filter - Optional filter to scope results to specific servers
1074
1106
  * @returns namespaced list of resource templates
1075
1107
  */
1076
- listResourceTemplates(): NamespacedData["resourceTemplates"];
1108
+ listResourceTemplates(
1109
+ filter?: MCPServerFilter
1110
+ ): NamespacedData["resourceTemplates"];
1077
1111
  /**
1078
1112
  * Namespaced version of callTool
1079
1113
  */
@@ -1157,6 +1191,7 @@ declare class MCPClientManager {
1157
1191
  type: "resource_link";
1158
1192
  description?: string | undefined;
1159
1193
  mimeType?: string | undefined;
1194
+ size?: number | undefined;
1160
1195
  annotations?:
1161
1196
  | {
1162
1197
  audience?: ("user" | "assistant")[] | undefined;
@@ -1327,6 +1362,7 @@ declare class MCPClientManager {
1327
1362
  type: "resource_link";
1328
1363
  description?: string | undefined;
1329
1364
  mimeType?: string | undefined;
1365
+ size?: number | undefined;
1330
1366
  annotations?:
1331
1367
  | {
1332
1368
  audience?: ("user" | "assistant")[] | undefined;
@@ -1527,6 +1563,27 @@ type Schedule<T = string> = {
1527
1563
  intervalSeconds: number;
1528
1564
  }
1529
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
+ };
1530
1587
  /**
1531
1588
  * MCP Server state update message from server -> Client
1532
1589
  */
@@ -1596,7 +1653,12 @@ declare const DEFAULT_AGENT_STATIC_OPTIONS: {
1596
1653
  * and force-reset. Increase this if you have callbacks that legitimately
1597
1654
  * take longer than 30 seconds.
1598
1655
  */
1599
- 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() */;
1600
1662
  retry: {
1601
1663
  maxAttempts: number;
1602
1664
  baseDelayMs: number;
@@ -1613,6 +1675,12 @@ interface AgentStaticOptions {
1613
1675
  hibernate?: boolean;
1614
1676
  sendIdentityOnConnect?: boolean;
1615
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;
1616
1684
  /** Default retry options for schedule(), queue(), and this.retry(). */
1617
1685
  retry?: RetryOptions;
1618
1686
  }
@@ -1671,12 +1739,16 @@ declare class Agent<
1671
1739
  private _warnedScheduleInOnStart;
1672
1740
  /**
1673
1741
  * Number of active keepAlive() callers. When > 0, `_scheduleNextAlarm()`
1674
- * 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.
1675
1743
  * Purely in-memory — lost on eviction, which is correct because the
1676
1744
  * in-memory work keepAlive was protecting is also lost.
1677
1745
  * @internal
1678
1746
  */
1679
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;
1680
1752
  private _ParentClass;
1681
1753
  readonly mcp: MCPClientManager;
1682
1754
  /**
@@ -1913,9 +1985,16 @@ declare class Agent<
1913
1985
  /**
1914
1986
  * Called when the Agent receives an email via routeAgentEmail()
1915
1987
  * Override this method to handle incoming emails
1916
- * @param email Email message to process
1988
+ * @param payload Internal wire format — plain data + RpcTarget bridge
1917
1989
  */
1918
- _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>;
1919
1998
  /**
1920
1999
  * Reply to an email
1921
2000
  * @param email The email to reply to
@@ -2113,8 +2192,9 @@ declare class Agent<
2113
2192
  *
2114
2193
  * Use this when you have long-running work and need to prevent the
2115
2194
  * DO from going idle (eviction after ~70-140s of inactivity).
2116
- * The heartbeat fires every 30 seconds via the alarm system, without
2117
- * 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 }`.
2118
2198
  *
2119
2199
  * @example
2120
2200
  * ```ts
@@ -2145,11 +2225,48 @@ declare class Agent<
2145
2225
  */
2146
2226
  keepAliveWhile<T>(fn: () => Promise<T>): Promise<T>;
2147
2227
  /**
2148
- * Hook invoked on every alarm cycle, after schedule processing.
2149
- * Override in subclasses (e.g. the fiber mixin) to run
2150
- * 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.
2151
2262
  * @internal
2152
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 */
2153
2270
  _onAlarmHousekeeping(): Promise<void>;
2154
2271
  private _scheduleNextAlarm;
2155
2272
  /**
@@ -2735,6 +2852,19 @@ type EmailRoutingOptions<Env> = AgentOptions<Env> & {
2735
2852
  */
2736
2853
  onNoRoute?: (email: ForwardableEmailMessage) => void | Promise<void>;
2737
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
+ }
2738
2868
  /**
2739
2869
  * Route an email to the appropriate Agent
2740
2870
  * @param email The email to route
@@ -2802,67 +2932,70 @@ declare class StreamingResponse {
2802
2932
  }
2803
2933
  //#endregion
2804
2934
  export {
2805
- experimental_createMcpHandler as $,
2806
- routeAgentRequest as A,
2807
- RegisterServerOptions as B,
2808
- SubAgentClass as C,
2809
- getAgentByName as D,
2810
- callable as E,
2811
- MCPClientOAuthResult as F,
2812
- RPCServerTransportOptions as G,
2813
- RPCClientTransport as H,
2814
- MCPConnectionResult as I,
2815
- ElicitRequestSchema$1 as J,
2816
- RPC_DO_PREFIX as K,
2817
- MCPDiscoverResult as L,
2818
- MCPClientManager as M,
2819
- MCPClientManagerOptions as N,
2820
- getCurrentAgent as O,
2821
- MCPClientOAuthCallbackConfig as P,
2822
- createMcpHandler as Q,
2823
- MCPOAuthCallbackResult as R,
2824
- StreamingResponse as S,
2825
- WSMessage as T,
2826
- RPCClientTransportOptions as U,
2827
- getNamespacedData as V,
2828
- RPCServerTransport as W,
2829
- McpAgent as X,
2830
- ElicitResult$1 as Y,
2831
- CreateMcpHandlerOptions as Z,
2832
- 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 _,
2833
2963
  AgentNamespace as a,
2834
- SSEEdgeClientTransport as at,
2835
- SqlError as b,
2964
+ TransportState as at,
2965
+ RPCResponse as b,
2836
2966
  CallableMetadata as c,
2837
- TransportType as ct,
2967
+ SSEEdgeClientTransport as ct,
2838
2968
  DEFAULT_AGENT_STATIC_OPTIONS as d,
2839
- McpAuthContext as et,
2969
+ TransportType as dt,
2970
+ CreateMcpHandlerOptions as et,
2840
2971
  EmailRoutingOptions as f,
2841
- QueueItem as g,
2842
- MCPServersState as h,
2972
+ MCPServerMessage as g,
2973
+ MCPServer as h,
2843
2974
  AgentContext as i,
2844
- WorkerTransportOptions as it,
2845
- unstable_callable as j,
2846
- routeAgentEmail as k,
2975
+ getMcpAuthContext as it,
2976
+ routeAgentEmail as j,
2977
+ getAgentByName as k,
2847
2978
  Connection$1 as l,
2848
- MCPServerMessage as m,
2979
+ StreamableHTTPEdgeClientTransport as lt,
2980
+ FiberRecoveryContext as m,
2849
2981
  AddRpcMcpServerOptions as n,
2850
- TransportState as nt,
2982
+ experimental_createMcpHandler as nt,
2851
2983
  AgentOptions as o,
2852
- StreamableHTTPEdgeClientTransport as ot,
2853
- MCPServer as p,
2854
- ElicitRequest$1 as q,
2984
+ WorkerTransport as ot,
2985
+ FiberContext as p,
2986
+ RPCServerTransport as q,
2855
2987
  Agent as r,
2856
- WorkerTransport as rt,
2988
+ McpAuthContext as rt,
2857
2989
  AgentStaticOptions as s,
2858
- McpClientOptions as st,
2990
+ WorkerTransportOptions as st,
2859
2991
  AddMcpServerOptions as t,
2860
- getMcpAuthContext as tt,
2992
+ createMcpHandler as tt,
2861
2993
  ConnectionContext$1 as u,
2862
- RPCResponse as v,
2863
- SubAgentStub as w,
2864
- StateUpdateMessage as x,
2865
- Schedule as y,
2866
- 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
2867
3000
  };
2868
- //# sourceMappingURL=index-C-6EMK-E.d.ts.map
3001
+ //# sourceMappingURL=index-BPkkIqMn.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-C-6EMK-E.js";
34
+ v as QueueItem,
35
+ w as StreamingResponse,
36
+ x as Schedule,
37
+ y as RPCRequest
38
+ } from "./index-BPkkIqMn.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,