agents 0.0.0-cccbd0f → 0.0.0-cd8b7fd

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 (64) hide show
  1. package/dist/ai-chat-agent.d.ts +23 -14
  2. package/dist/ai-chat-agent.js +40 -26
  3. package/dist/ai-chat-agent.js.map +1 -1
  4. package/dist/{ai-chat-v5-migration-BSiGZmYU.js → ai-chat-v5-migration-DguhuLKF.js} +1 -1
  5. package/dist/{ai-chat-v5-migration-BSiGZmYU.js.map → ai-chat-v5-migration-DguhuLKF.js.map} +1 -1
  6. package/dist/ai-chat-v5-migration.js +1 -1
  7. package/dist/ai-react.d.ts +10 -9
  8. package/dist/ai-react.js +43 -28
  9. package/dist/ai-react.js.map +1 -1
  10. package/dist/{ai-types-CrMqkwc_.js → ai-types-CwgHzwUb.js} +1 -1
  11. package/dist/{ai-types-CrMqkwc_.js.map → ai-types-CwgHzwUb.js.map} +1 -1
  12. package/dist/{ai-types-81H_-Uxh.d.ts → ai-types-D_hTbf25.d.ts} +1 -1
  13. package/dist/ai-types.d.ts +1 -1
  14. package/dist/ai-types.js +1 -1
  15. package/dist/cli/index.d.ts +1 -0
  16. package/dist/{cli.js → cli/index.js} +7 -6
  17. package/dist/cli/index.js.map +1 -0
  18. package/dist/{client-B3SR12TQ.js → client-CcyhkGfN.js} +2 -2
  19. package/dist/{client-B3SR12TQ.js.map → client-CcyhkGfN.js.map} +1 -1
  20. package/dist/{client-BAQA84dr.d.ts → client-ClORm6f0.d.ts} +2 -2
  21. package/dist/client-DfIOsabL.d.ts +834 -0
  22. package/dist/{client-BZ-xTxF5.js → client-QZa2Rq0l.js} +398 -194
  23. package/dist/client-QZa2Rq0l.js.map +1 -0
  24. package/dist/client.d.ts +2 -2
  25. package/dist/client.js +2 -2
  26. package/dist/codemode/ai.js +6 -5
  27. package/dist/codemode/ai.js.map +1 -1
  28. package/dist/context-BkKbAa1R.js +8 -0
  29. package/dist/context-BkKbAa1R.js.map +1 -0
  30. package/dist/context-_sPQqJWv.d.ts +24 -0
  31. package/dist/context.d.ts +6 -0
  32. package/dist/context.js +3 -0
  33. package/dist/do-oauth-client-provider-B-ryFIPr.d.ts +70 -0
  34. package/dist/{do-oauth-client-provider-Cs9QpXYp.js → do-oauth-client-provider-B1fVIshX.js} +71 -9
  35. package/dist/do-oauth-client-provider-B1fVIshX.js.map +1 -0
  36. package/dist/{index-BUle9RiP.d.ts → index-CyDpAVHZ.d.ts} +2 -2
  37. package/dist/{index-D2dnUH0r.d.ts → index-DPJ32qQn.d.ts} +51 -52
  38. package/dist/index.d.ts +34 -34
  39. package/dist/index.js +6 -5
  40. package/dist/mcp/client.d.ts +4 -4
  41. package/dist/mcp/client.js +2 -2
  42. package/dist/mcp/do-oauth-client-provider.d.ts +1 -1
  43. package/dist/mcp/do-oauth-client-provider.js +1 -1
  44. package/dist/mcp/index.d.ts +8 -7
  45. package/dist/mcp/index.js +6 -5
  46. package/dist/mcp/index.js.map +1 -1
  47. package/dist/{mcp-BwPscEiF.d.ts → mcp-CzbSsLfc.d.ts} +1 -1
  48. package/dist/observability/index.d.ts +2 -2
  49. package/dist/observability/index.js +6 -5
  50. package/dist/{react-B_ENAdCe.d.ts → react-MaOSl7Pr.d.ts} +4 -4
  51. package/dist/react.d.ts +10 -9
  52. package/dist/react.js +1 -1
  53. package/dist/{serializable-faDkMCai.d.ts → serializable-C4GLimgv.d.ts} +1 -1
  54. package/dist/serializable.d.ts +1 -1
  55. package/dist/{src-C6rC6ZpH.js → src-BmbDclOA.js} +40 -107
  56. package/dist/src-BmbDclOA.js.map +1 -0
  57. package/package.json +5 -5
  58. package/dist/cli.d.ts +0 -8
  59. package/dist/cli.js.map +0 -1
  60. package/dist/client-BZ-xTxF5.js.map +0 -1
  61. package/dist/client-ctTw3KHG.d.ts +0 -1440
  62. package/dist/do-oauth-client-provider-Cs9QpXYp.js.map +0 -1
  63. package/dist/do-oauth-client-provider-UhQDpDb8.d.ts +0 -134
  64. package/dist/src-C6rC6ZpH.js.map +0 -1
@@ -1,10 +1,11 @@
1
+ import { n as AgentEmail } from "./context-_sPQqJWv.js";
1
2
  import {
2
- l as MCPConnectionState,
3
- m as TransportType,
4
- t as MCPClientManager
5
- } from "./client-ctTw3KHG.js";
6
- import { t as Observability } from "./index-BUle9RiP.js";
7
- import { n as MessageType } from "./ai-types-81H_-Uxh.js";
3
+ h as TransportType,
4
+ t as MCPClientManager,
5
+ u as MCPConnectionState
6
+ } from "./client-DfIOsabL.js";
7
+ import { t as Observability } from "./index-CyDpAVHZ.js";
8
+ import { n as MessageType } from "./ai-types-D_hTbf25.js";
8
9
  import {
9
10
  Connection,
10
11
  Connection as Connection$1,
@@ -331,7 +332,7 @@ declare class Agent<
331
332
  /**
332
333
  * Cancel a scheduled task
333
334
  * @param id ID of the task to cancel
334
- * @returns true if the task was cancelled, false otherwise
335
+ * @returns true if the task was cancelled, false if the task was not found
335
336
  */
336
337
  cancelSchedule(id: string): Promise<boolean>;
337
338
  private _scheduleNextAlarm;
@@ -361,7 +362,8 @@ declare class Agent<
361
362
  * @param callbackHost Base host for the agent, used for the redirect URI. If not provided, will be derived from the current request.
362
363
  * @param agentsPrefix agents routing prefix if not using `agents`
363
364
  * @param options MCP client and transport options
364
- * @returns authUrl
365
+ * @returns Server id and state - either "authenticating" with authUrl, or "ready"
366
+ * @throws If connection or discovery fails
365
367
  */
366
368
  addMcpServer(
367
369
  serverName: string,
@@ -375,12 +377,20 @@ declare class Agent<
375
377
  type?: TransportType;
376
378
  };
377
379
  }
378
- ): Promise<{
379
- id: string;
380
- authUrl: string | undefined;
381
- }>;
380
+ ): Promise<
381
+ | {
382
+ id: string;
383
+ state: typeof MCPConnectionState.AUTHENTICATING;
384
+ authUrl: string;
385
+ }
386
+ | {
387
+ id: string;
388
+ state: typeof MCPConnectionState.READY;
389
+ authUrl?: undefined;
390
+ }
391
+ >;
382
392
  removeMcpServer(id: string): Promise<void>;
383
- getMcpServers(): Promise<MCPServersState>;
393
+ getMcpServers(): MCPServersState;
384
394
  private broadcastMcpServers;
385
395
  /**
386
396
  * Handle MCP OAuth callback request if it's an OAuth callback.
@@ -480,16 +490,6 @@ declare function routeAgentEmail<Env>(
480
490
  env: Env,
481
491
  options: EmailRoutingOptions<Env>
482
492
  ): Promise<void>;
483
- type AgentEmail = {
484
- from: string;
485
- to: string;
486
- getRaw: () => Promise<Uint8Array>;
487
- headers: Headers;
488
- rawSize: number;
489
- setReject: (reason: string) => void;
490
- forward: (rcptTo: string, headers?: Headers) => Promise<void>;
491
- reply: (options: { from: string; to: string; raw: string }) => Promise<void>;
492
- };
493
493
  type EmailSendOptions = {
494
494
  to: string;
495
495
  subject: string;
@@ -544,35 +544,34 @@ declare class StreamingResponse {
544
544
  }
545
545
  //#endregion
546
546
  export {
547
- unstable_callable as A,
548
- createAddressBasedEmailResolver as C,
549
- getCurrentAgent as D,
550
- getAgentByName as E,
551
- routeAgentEmail as O,
552
- callable as S,
553
- createHeaderBasedEmailResolver as T,
554
- RPCResponse as _,
555
- AgentOptions as a,
556
- StreamingResponse as b,
557
- ConnectionContext as c,
558
- EmailSendOptions as d,
559
- MCPServer as f,
560
- RPCRequest as g,
561
- QueueItem as h,
562
- AgentNamespace as i,
563
- routeAgentRequest as k,
564
- EmailResolver as l,
565
- MCPServersState as m,
547
+ createCatchAllEmailResolver as C,
548
+ routeAgentEmail as D,
549
+ getCurrentAgent as E,
550
+ routeAgentRequest as O,
551
+ createAddressBasedEmailResolver as S,
552
+ getAgentByName as T,
553
+ Schedule as _,
554
+ CallableMetadata as a,
555
+ WSMessage as b,
556
+ EmailResolver as c,
557
+ MCPServer as d,
558
+ MCPServerMessage as f,
559
+ RPCResponse as g,
560
+ RPCRequest as h,
561
+ AgentOptions as i,
562
+ unstable_callable as k,
563
+ EmailRoutingOptions as l,
564
+ QueueItem as m,
566
565
  AgentContext as n,
567
- CallableMetadata as o,
568
- MCPServerMessage as p,
569
- AgentEmail as r,
570
- Connection$1 as s,
566
+ Connection$1 as o,
567
+ MCPServersState as p,
568
+ AgentNamespace as r,
569
+ ConnectionContext as s,
571
570
  Agent as t,
572
- EmailRoutingOptions as u,
573
- Schedule as v,
574
- createCatchAllEmailResolver as w,
575
- WSMessage as x,
576
- StateUpdateMessage as y
571
+ EmailSendOptions as u,
572
+ StateUpdateMessage as v,
573
+ createHeaderBasedEmailResolver as w,
574
+ callable as x,
575
+ StreamingResponse as y
577
576
  };
578
- //# sourceMappingURL=index-D2dnUH0r.d.ts.map
577
+ //# sourceMappingURL=index-DPJ32qQn.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,40 +1,40 @@
1
- import { m as TransportType } from "./client-ctTw3KHG.js";
2
- import "./mcp-BwPscEiF.js";
3
- import "./do-oauth-client-provider-UhQDpDb8.js";
4
- import "./index-BUle9RiP.js";
5
- import "./ai-types-81H_-Uxh.js";
1
+ import { n as AgentEmail } from "./context-_sPQqJWv.js";
2
+ import { h as TransportType } from "./client-DfIOsabL.js";
3
+ import "./mcp-CzbSsLfc.js";
4
+ import "./do-oauth-client-provider-B-ryFIPr.js";
5
+ import "./index-CyDpAVHZ.js";
6
+ import "./ai-types-D_hTbf25.js";
6
7
  import {
7
- A as unstable_callable,
8
- C as createAddressBasedEmailResolver,
9
- D as getCurrentAgent,
10
- E as getAgentByName,
11
- O as routeAgentEmail,
12
- S as callable,
13
- T as createHeaderBasedEmailResolver,
14
- _ as RPCResponse,
15
- a as AgentOptions,
16
- b as StreamingResponse,
17
- c as ConnectionContext,
18
- d as EmailSendOptions,
19
- f as MCPServer,
20
- g as RPCRequest,
21
- h as QueueItem,
22
- i as AgentNamespace,
23
- k as routeAgentRequest,
24
- l as EmailResolver,
25
- m as MCPServersState,
8
+ C as createCatchAllEmailResolver,
9
+ D as routeAgentEmail,
10
+ E as getCurrentAgent,
11
+ O as routeAgentRequest,
12
+ S as createAddressBasedEmailResolver,
13
+ T as getAgentByName,
14
+ _ as Schedule,
15
+ a as CallableMetadata,
16
+ b as WSMessage,
17
+ c as EmailResolver,
18
+ d as MCPServer,
19
+ f as MCPServerMessage,
20
+ g as RPCResponse,
21
+ h as RPCRequest,
22
+ i as AgentOptions,
23
+ k as unstable_callable,
24
+ l as EmailRoutingOptions,
25
+ m as QueueItem,
26
26
  n as AgentContext,
27
- o as CallableMetadata,
28
- p as MCPServerMessage,
29
- r as AgentEmail,
30
- s as Connection,
27
+ o as Connection,
28
+ p as MCPServersState,
29
+ r as AgentNamespace,
30
+ s as ConnectionContext,
31
31
  t as Agent,
32
- u as EmailRoutingOptions,
33
- v as Schedule,
34
- w as createCatchAllEmailResolver,
35
- x as WSMessage,
36
- y as StateUpdateMessage
37
- } from "./index-D2dnUH0r.js";
32
+ u as EmailSendOptions,
33
+ v as StateUpdateMessage,
34
+ w as createHeaderBasedEmailResolver,
35
+ x as callable,
36
+ y as StreamingResponse
37
+ } from "./index-DPJ32qQn.js";
38
38
  export {
39
39
  Agent,
40
40
  AgentContext,
package/dist/index.js CHANGED
@@ -1,7 +1,8 @@
1
- import "./ai-types-CrMqkwc_.js";
2
- import "./client-B3SR12TQ.js";
3
- import "./client-BZ-xTxF5.js";
4
- import "./do-oauth-client-provider-Cs9QpXYp.js";
5
- import { a as createCatchAllEmailResolver, c as getCurrentAgent, d as unstable_callable, i as createAddressBasedEmailResolver, l as routeAgentEmail, n as StreamingResponse, o as createHeaderBasedEmailResolver, r as callable, s as getAgentByName, t as Agent, u as routeAgentRequest } from "./src-C6rC6ZpH.js";
1
+ import "./context-BkKbAa1R.js";
2
+ import "./ai-types-CwgHzwUb.js";
3
+ import "./client-CcyhkGfN.js";
4
+ import "./client-QZa2Rq0l.js";
5
+ import "./do-oauth-client-provider-B1fVIshX.js";
6
+ import { a as createCatchAllEmailResolver, c as getCurrentAgent, d as unstable_callable, i as createAddressBasedEmailResolver, l as routeAgentEmail, n as StreamingResponse, o as createHeaderBasedEmailResolver, r as callable, s as getAgentByName, t as Agent, u as routeAgentRequest } from "./src-BmbDclOA.js";
6
7
 
7
8
  export { Agent, StreamingResponse, callable, createAddressBasedEmailResolver, createCatchAllEmailResolver, createHeaderBasedEmailResolver, getAgentByName, getCurrentAgent, routeAgentEmail, routeAgentRequest, unstable_callable };
@@ -1,4 +1,4 @@
1
- import { a as MCPConnectionResult, c as getNamespacedData, i as MCPClientOAuthResult, n as MCPClientManagerOptions, o as MCPServerOptions, r as MCPClientOAuthCallbackConfig, s as RegisterServerOptions, t as MCPClientManager } from "../client-ctTw3KHG.js";
2
- import "../mcp-BwPscEiF.js";
3
- import "../do-oauth-client-provider-UhQDpDb8.js";
4
- export { MCPClientManager, MCPClientManagerOptions, MCPClientOAuthCallbackConfig, MCPClientOAuthResult, MCPConnectionResult, MCPServerOptions, RegisterServerOptions, getNamespacedData };
1
+ import { a as MCPConnectionResult, c as RegisterServerOptions, i as MCPClientOAuthResult, l as getNamespacedData, n as MCPClientManagerOptions, o as MCPDiscoverResult, r as MCPClientOAuthCallbackConfig, s as MCPServerOptions, t as MCPClientManager } from "../client-DfIOsabL.js";
2
+ import "../mcp-CzbSsLfc.js";
3
+ import "../do-oauth-client-provider-B-ryFIPr.js";
4
+ export { MCPClientManager, MCPClientManagerOptions, MCPClientOAuthCallbackConfig, MCPClientOAuthResult, MCPConnectionResult, MCPDiscoverResult, MCPServerOptions, RegisterServerOptions, getNamespacedData };
@@ -1,4 +1,4 @@
1
- import { n as getNamespacedData, t as MCPClientManager } from "../client-BZ-xTxF5.js";
2
- import "../do-oauth-client-provider-Cs9QpXYp.js";
1
+ import { n as getNamespacedData, t as MCPClientManager } from "../client-QZa2Rq0l.js";
2
+ import "../do-oauth-client-provider-B1fVIshX.js";
3
3
 
4
4
  export { MCPClientManager, getNamespacedData };
@@ -1,2 +1,2 @@
1
- import { n as DurableObjectOAuthClientProvider, t as AgentsOAuthProvider } from "../do-oauth-client-provider-UhQDpDb8.js";
1
+ import { n as DurableObjectOAuthClientProvider, t as AgentsOAuthProvider } from "../do-oauth-client-provider-B-ryFIPr.js";
2
2
  export { AgentsOAuthProvider, DurableObjectOAuthClientProvider };
@@ -1,3 +1,3 @@
1
- import { t as DurableObjectOAuthClientProvider } from "../do-oauth-client-provider-Cs9QpXYp.js";
1
+ import { t as DurableObjectOAuthClientProvider } from "../do-oauth-client-provider-B1fVIshX.js";
2
2
 
3
3
  export { DurableObjectOAuthClientProvider };
@@ -1,9 +1,10 @@
1
- import { a as MCPConnectionResult, d as CORSOptions, f as MaybePromise, i as MCPClientOAuthResult, o as MCPServerOptions, p as ServeOptions, r as MCPClientOAuthCallbackConfig, u as BaseTransportType } from "../client-ctTw3KHG.js";
2
- import "../mcp-BwPscEiF.js";
3
- import "../do-oauth-client-provider-UhQDpDb8.js";
4
- import "../index-BUle9RiP.js";
5
- import "../ai-types-81H_-Uxh.js";
6
- import { c as ConnectionContext, s as Connection, t as Agent } from "../index-D2dnUH0r.js";
1
+ import "../context-_sPQqJWv.js";
2
+ import { a as MCPConnectionResult, d as BaseTransportType, f as CORSOptions, i as MCPClientOAuthResult, m as ServeOptions, o as MCPDiscoverResult, p as MaybePromise, r as MCPClientOAuthCallbackConfig, s as MCPServerOptions } from "../client-DfIOsabL.js";
3
+ import "../mcp-CzbSsLfc.js";
4
+ import "../do-oauth-client-provider-B-ryFIPr.js";
5
+ import "../index-CyDpAVHZ.js";
6
+ import "../ai-types-D_hTbf25.js";
7
+ import { o as Connection, s as ConnectionContext, t as Agent } from "../index-DPJ32qQn.js";
7
8
  import { SSEClientTransport, SSEClientTransportOptions } from "@modelcontextprotocol/sdk/client/sse.js";
8
9
  import { StreamableHTTPClientTransport, StreamableHTTPClientTransportOptions } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
9
10
  import { ElicitRequest, ElicitRequestSchema, ElicitResult, ElicitResult as ElicitResult$1, JSONRPCMessage, MessageExtraInfo } from "@modelcontextprotocol/sdk/types.js";
@@ -189,5 +190,5 @@ declare abstract class McpAgent<Env = unknown, State = unknown, Props extends Re
189
190
  };
190
191
  }
191
192
  //#endregion
192
- export { type CreateMcpHandlerOptions, type ElicitRequest, ElicitRequestSchema, type ElicitResult, type MCPClientOAuthCallbackConfig, type MCPClientOAuthResult, type MCPConnectionResult, type MCPServerOptions, McpAgent, type McpAuthContext, SSEEdgeClientTransport, StreamableHTTPEdgeClientTransport, type TransportState, WorkerTransport, type WorkerTransportOptions, createMcpHandler, experimental_createMcpHandler, getMcpAuthContext };
193
+ export { type CreateMcpHandlerOptions, type ElicitRequest, ElicitRequestSchema, type ElicitResult, type MCPClientOAuthCallbackConfig, type MCPClientOAuthResult, type MCPConnectionResult, type MCPDiscoverResult, type MCPServerOptions, McpAgent, type McpAuthContext, SSEEdgeClientTransport, StreamableHTTPEdgeClientTransport, type TransportState, WorkerTransport, type WorkerTransportOptions, createMcpHandler, experimental_createMcpHandler, getMcpAuthContext };
193
194
  //# sourceMappingURL=index.d.ts.map
package/dist/mcp/index.js CHANGED
@@ -1,8 +1,9 @@
1
- import { t as MessageType } from "../ai-types-CrMqkwc_.js";
2
- import "../client-B3SR12TQ.js";
3
- import "../client-BZ-xTxF5.js";
4
- import "../do-oauth-client-provider-Cs9QpXYp.js";
5
- import { c as getCurrentAgent, s as getAgentByName, t as Agent } from "../src-C6rC6ZpH.js";
1
+ import "../context-BkKbAa1R.js";
2
+ import { t as MessageType } from "../ai-types-CwgHzwUb.js";
3
+ import "../client-CcyhkGfN.js";
4
+ import "../client-QZa2Rq0l.js";
5
+ import "../do-oauth-client-provider-B1fVIshX.js";
6
+ import { c as getCurrentAgent, s as getAgentByName, t as Agent } from "../src-BmbDclOA.js";
6
7
  import { AsyncLocalStorage } from "node:async_hooks";
7
8
  import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
8
9
  import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";