agents 0.7.0 → 0.7.2

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.
@@ -1,6 +1,6 @@
1
1
  import { RetryOptions } from "../retries.js";
2
- import { E as Event, T as Emitter, i as MCPTransportOptions, n as MCPClientConnection, r as MCPConnectionState, t as MCPServerRow, w as TransportType } from "../client-storage-tusTuoSF.js";
3
- import { n as MCPObservabilityEvent } from "../agent-DnmmRjyv.js";
2
+ import { E as Event, T as Emitter, i as MCPTransportOptions, n as MCPClientConnection, r as MCPConnectionState, t as MCPServerRow, w as TransportType } from "../client-storage-BPjfP_is.js";
3
+ import { n as MCPObservabilityEvent } from "../agent-eZnMHidZ.js";
4
4
  import { AgentMcpOAuthProvider } from "./do-oauth-client-provider.js";
5
5
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
6
6
  import { CallToolRequest, CallToolResultSchema, CompatibilityCallToolResultSchema, GetPromptRequest, Prompt, ReadResourceRequest, Resource, ResourceTemplate, Tool } from "@modelcontextprotocol/sdk/types.js";
@@ -1,4 +1,4 @@
1
- import { C as ServeOptions, S as McpClientOptions, _ as WorkerTransportOptions, a as RPCClientTransport, b as BaseTransportType, c as RPCServerTransportOptions, d as createMcpHandler, f as experimental_createMcpHandler, g as WorkerTransport, h as TransportState, l as RPC_DO_PREFIX, m as getMcpAuthContext, o as RPCClientTransportOptions, p as McpAuthContext, s as RPCServerTransport, u as CreateMcpHandlerOptions, v as SSEEdgeClientTransport, x as MaybePromise, y as StreamableHTTPEdgeClientTransport } from "../client-storage-tusTuoSF.js";
1
+ import { C as ServeOptions, S as McpClientOptions, _ as WorkerTransportOptions, a as RPCClientTransport, b as BaseTransportType, c as RPCServerTransportOptions, d as createMcpHandler, f as experimental_createMcpHandler, g as WorkerTransport, h as TransportState, l as RPC_DO_PREFIX, m as getMcpAuthContext, o as RPCClientTransportOptions, p as McpAuthContext, s as RPCServerTransport, u as CreateMcpHandlerOptions, v as SSEEdgeClientTransport, x as MaybePromise, y as StreamableHTTPEdgeClientTransport } from "../client-storage-BPjfP_is.js";
2
2
  import { MCPClientOAuthCallbackConfig, MCPClientOAuthResult, MCPConnectionResult, MCPDiscoverResult, MCPServerOptions } from "./client.js";
3
3
  import { Agent, Connection, ConnectionContext } from "../index.js";
4
4
  import { ElicitRequest, ElicitRequestSchema, ElicitResult, ElicitResult as ElicitResult$1, JSONRPCMessage, MessageExtraInfo } from "@modelcontextprotocol/sdk/types.js";
@@ -1,4 +1,4 @@
1
- import { n as MCPObservabilityEvent, t as AgentObservabilityEvent } from "../agent-DnmmRjyv.js";
1
+ import { n as MCPObservabilityEvent, t as AgentObservabilityEvent } from "../agent-eZnMHidZ.js";
2
2
  import { Channel } from "node:diagnostics_channel";
3
3
 
4
4
  //#region src/observability/index.d.ts
@@ -36,6 +36,7 @@ declare const channels: {
36
36
  readonly lifecycle: Channel<unknown, unknown>;
37
37
  readonly workflow: Channel<unknown, unknown>;
38
38
  readonly mcp: Channel<unknown, unknown>;
39
+ readonly email: Channel<unknown, unknown>;
39
40
  };
40
41
  /**
41
42
  * The default observability implementation.
@@ -61,7 +62,7 @@ type ChannelEventMap = {
61
62
  type: `schedule:${string}` | `queue:${string}`;
62
63
  }>;
63
64
  lifecycle: Extract<ObservabilityEvent, {
64
- type: "connect" | "destroy";
65
+ type: "connect" | "disconnect" | "destroy";
65
66
  }>;
66
67
  workflow: Extract<ObservabilityEvent, {
67
68
  type: `workflow:${string}`;
@@ -69,6 +70,9 @@ type ChannelEventMap = {
69
70
  mcp: Extract<ObservabilityEvent, {
70
71
  type: `mcp:${string}`;
71
72
  }>;
73
+ email: Extract<ObservabilityEvent, {
74
+ type: `email:${string}`;
75
+ }>;
72
76
  };
73
77
  /**
74
78
  * Subscribe to a typed observability channel.
@@ -23,7 +23,8 @@ const channels = {
23
23
  schedule: channel("agents:schedule"),
24
24
  lifecycle: channel("agents:lifecycle"),
25
25
  workflow: channel("agents:workflow"),
26
- mcp: channel("agents:mcp")
26
+ mcp: channel("agents:mcp"),
27
+ email: channel("agents:email")
27
28
  };
28
29
  /**
29
30
  * Map event type prefixes to their diagnostics channel.
@@ -35,6 +36,7 @@ function getChannel(type) {
35
36
  if (type.startsWith("message:") || type.startsWith("tool:")) return channels.message;
36
37
  if (type === "rpc" || type.startsWith("rpc:")) return channels.rpc;
37
38
  if (type.startsWith("state:")) return channels.state;
39
+ if (type.startsWith("email:")) return channels.email;
38
40
  return channels.lifecycle;
39
41
  }
40
42
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["dcUnsubscribe"],"sources":["../../src/observability/index.ts"],"sourcesContent":["import {\n channel,\n subscribe as dcSubscribe,\n unsubscribe as dcUnsubscribe,\n type Channel\n} from \"node:diagnostics_channel\";\nimport type { AgentObservabilityEvent } from \"./agent\";\nimport type { MCPObservabilityEvent } from \"./mcp\";\n\n/**\n * Union of all observability event types from different domains\n */\nexport type ObservabilityEvent =\n | AgentObservabilityEvent\n | MCPObservabilityEvent;\n\nexport interface Observability {\n /**\n * Emit an event for the Agent's observability implementation to handle.\n * @param event - The event to emit\n */\n emit(event: ObservabilityEvent): void;\n}\n\n/**\n * Diagnostics channels for agent observability.\n *\n * Events are published to named channels using the Node.js diagnostics_channel API.\n * By default, publishing to a channel with no subscribers is a no-op (zero overhead).\n *\n * To observe events, subscribe to the channels you care about:\n * ```ts\n * import { subscribe } from \"node:diagnostics_channel\";\n * subscribe(\"agents:rpc\", (event) => console.log(event));\n * ```\n *\n * In production, all published messages are automatically forwarded to\n * Tail Workers via `event.diagnosticsChannelEvents` — no subscription needed.\n */\nexport const channels = {\n state: channel(\"agents:state\"),\n rpc: channel(\"agents:rpc\"),\n message: channel(\"agents:message\"),\n schedule: channel(\"agents:schedule\"),\n lifecycle: channel(\"agents:lifecycle\"),\n workflow: channel(\"agents:workflow\"),\n mcp: channel(\"agents:mcp\")\n} as const;\n\n/**\n * Map event type prefixes to their diagnostics channel.\n */\nfunction getChannel(type: string): Channel {\n if (type.startsWith(\"mcp:\")) return channels.mcp;\n if (type.startsWith(\"workflow:\")) return channels.workflow;\n if (type.startsWith(\"schedule:\") || type.startsWith(\"queue:\"))\n return channels.schedule;\n if (type.startsWith(\"message:\") || type.startsWith(\"tool:\"))\n return channels.message;\n if (type === \"rpc\" || type.startsWith(\"rpc:\")) return channels.rpc;\n if (type.startsWith(\"state:\")) return channels.state;\n // connect, destroy\n return channels.lifecycle;\n}\n\n/**\n * The default observability implementation.\n *\n * Publishes events to diagnostics_channel. Events are silent unless\n * a subscriber is registered or a Tail Worker is attached.\n */\nexport const genericObservability: Observability = {\n emit(event) {\n getChannel(event.type).publish(event);\n }\n};\n\n/**\n * Maps each channel key to the observability events it carries.\n */\nexport type ChannelEventMap = {\n state: Extract<ObservabilityEvent, { type: `state:${string}` }>;\n rpc: Extract<ObservabilityEvent, { type: \"rpc\" | `rpc:${string}` }>;\n message: Extract<\n ObservabilityEvent,\n { type: `message:${string}` | `tool:${string}` }\n >;\n schedule: Extract<\n ObservabilityEvent,\n { type: `schedule:${string}` | `queue:${string}` }\n >;\n lifecycle: Extract<ObservabilityEvent, { type: \"connect\" | \"destroy\" }>;\n workflow: Extract<ObservabilityEvent, { type: `workflow:${string}` }>;\n mcp: Extract<ObservabilityEvent, { type: `mcp:${string}` }>;\n};\n\n/**\n * Subscribe to a typed observability channel.\n *\n * ```ts\n * import { subscribe } from \"agents/observability\";\n *\n * const unsub = subscribe(\"rpc\", (event) => {\n * console.log(event.payload.method); // fully typed\n * });\n * ```\n *\n * @returns A function that unsubscribes the callback.\n */\nexport function subscribe<K extends keyof ChannelEventMap>(\n channelKey: K,\n callback: (event: ChannelEventMap[K]) => void\n): () => void {\n const name = `agents:${channelKey}`;\n const handler = (message: unknown, _name: string | symbol) =>\n callback(message as ChannelEventMap[K]);\n dcSubscribe(name, handler);\n return () => dcUnsubscribe(name, handler);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuCA,MAAa,WAAW;CACtB,OAAO,QAAQ,eAAe;CAC9B,KAAK,QAAQ,aAAa;CAC1B,SAAS,QAAQ,iBAAiB;CAClC,UAAU,QAAQ,kBAAkB;CACpC,WAAW,QAAQ,mBAAmB;CACtC,UAAU,QAAQ,kBAAkB;CACpC,KAAK,QAAQ,aAAa;CAC3B;;;;AAKD,SAAS,WAAW,MAAuB;AACzC,KAAI,KAAK,WAAW,OAAO,CAAE,QAAO,SAAS;AAC7C,KAAI,KAAK,WAAW,YAAY,CAAE,QAAO,SAAS;AAClD,KAAI,KAAK,WAAW,YAAY,IAAI,KAAK,WAAW,SAAS,CAC3D,QAAO,SAAS;AAClB,KAAI,KAAK,WAAW,WAAW,IAAI,KAAK,WAAW,QAAQ,CACzD,QAAO,SAAS;AAClB,KAAI,SAAS,SAAS,KAAK,WAAW,OAAO,CAAE,QAAO,SAAS;AAC/D,KAAI,KAAK,WAAW,SAAS,CAAE,QAAO,SAAS;AAE/C,QAAO,SAAS;;;;;;;;AASlB,MAAa,uBAAsC,EACjD,KAAK,OAAO;AACV,YAAW,MAAM,KAAK,CAAC,QAAQ,MAAM;GAExC;;;;;;;;;;;;;;AAkCD,SAAgB,UACd,YACA,UACY;CACZ,MAAM,OAAO,UAAU;CACvB,MAAM,WAAW,SAAkB,UACjC,SAAS,QAA8B;AACzC,aAAY,MAAM,QAAQ;AAC1B,cAAaA,YAAc,MAAM,QAAQ"}
1
+ {"version":3,"file":"index.js","names":["dcUnsubscribe"],"sources":["../../src/observability/index.ts"],"sourcesContent":["import {\n channel,\n subscribe as dcSubscribe,\n unsubscribe as dcUnsubscribe,\n type Channel\n} from \"node:diagnostics_channel\";\nimport type { AgentObservabilityEvent } from \"./agent\";\nimport type { MCPObservabilityEvent } from \"./mcp\";\n\n/**\n * Union of all observability event types from different domains\n */\nexport type ObservabilityEvent =\n | AgentObservabilityEvent\n | MCPObservabilityEvent;\n\nexport interface Observability {\n /**\n * Emit an event for the Agent's observability implementation to handle.\n * @param event - The event to emit\n */\n emit(event: ObservabilityEvent): void;\n}\n\n/**\n * Diagnostics channels for agent observability.\n *\n * Events are published to named channels using the Node.js diagnostics_channel API.\n * By default, publishing to a channel with no subscribers is a no-op (zero overhead).\n *\n * To observe events, subscribe to the channels you care about:\n * ```ts\n * import { subscribe } from \"node:diagnostics_channel\";\n * subscribe(\"agents:rpc\", (event) => console.log(event));\n * ```\n *\n * In production, all published messages are automatically forwarded to\n * Tail Workers via `event.diagnosticsChannelEvents` — no subscription needed.\n */\nexport const channels = {\n state: channel(\"agents:state\"),\n rpc: channel(\"agents:rpc\"),\n message: channel(\"agents:message\"),\n schedule: channel(\"agents:schedule\"),\n lifecycle: channel(\"agents:lifecycle\"),\n workflow: channel(\"agents:workflow\"),\n mcp: channel(\"agents:mcp\"),\n email: channel(\"agents:email\")\n} as const;\n\n/**\n * Map event type prefixes to their diagnostics channel.\n */\nfunction getChannel(type: string): Channel {\n if (type.startsWith(\"mcp:\")) return channels.mcp;\n if (type.startsWith(\"workflow:\")) return channels.workflow;\n if (type.startsWith(\"schedule:\") || type.startsWith(\"queue:\"))\n return channels.schedule;\n if (type.startsWith(\"message:\") || type.startsWith(\"tool:\"))\n return channels.message;\n if (type === \"rpc\" || type.startsWith(\"rpc:\")) return channels.rpc;\n if (type.startsWith(\"state:\")) return channels.state;\n if (type.startsWith(\"email:\")) return channels.email;\n // connect, disconnect, destroy\n return channels.lifecycle;\n}\n\n/**\n * The default observability implementation.\n *\n * Publishes events to diagnostics_channel. Events are silent unless\n * a subscriber is registered or a Tail Worker is attached.\n */\nexport const genericObservability: Observability = {\n emit(event) {\n getChannel(event.type).publish(event);\n }\n};\n\n/**\n * Maps each channel key to the observability events it carries.\n */\nexport type ChannelEventMap = {\n state: Extract<ObservabilityEvent, { type: `state:${string}` }>;\n rpc: Extract<ObservabilityEvent, { type: \"rpc\" | `rpc:${string}` }>;\n message: Extract<\n ObservabilityEvent,\n { type: `message:${string}` | `tool:${string}` }\n >;\n schedule: Extract<\n ObservabilityEvent,\n { type: `schedule:${string}` | `queue:${string}` }\n >;\n lifecycle: Extract<\n ObservabilityEvent,\n { type: \"connect\" | \"disconnect\" | \"destroy\" }\n >;\n workflow: Extract<ObservabilityEvent, { type: `workflow:${string}` }>;\n mcp: Extract<ObservabilityEvent, { type: `mcp:${string}` }>;\n email: Extract<ObservabilityEvent, { type: `email:${string}` }>;\n};\n\n/**\n * Subscribe to a typed observability channel.\n *\n * ```ts\n * import { subscribe } from \"agents/observability\";\n *\n * const unsub = subscribe(\"rpc\", (event) => {\n * console.log(event.payload.method); // fully typed\n * });\n * ```\n *\n * @returns A function that unsubscribes the callback.\n */\nexport function subscribe<K extends keyof ChannelEventMap>(\n channelKey: K,\n callback: (event: ChannelEventMap[K]) => void\n): () => void {\n const name = `agents:${channelKey}`;\n const handler = (message: unknown, _name: string | symbol) =>\n callback(message as ChannelEventMap[K]);\n dcSubscribe(name, handler);\n return () => dcUnsubscribe(name, handler);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAuCA,MAAa,WAAW;CACtB,OAAO,QAAQ,eAAe;CAC9B,KAAK,QAAQ,aAAa;CAC1B,SAAS,QAAQ,iBAAiB;CAClC,UAAU,QAAQ,kBAAkB;CACpC,WAAW,QAAQ,mBAAmB;CACtC,UAAU,QAAQ,kBAAkB;CACpC,KAAK,QAAQ,aAAa;CAC1B,OAAO,QAAQ,eAAe;CAC/B;;;;AAKD,SAAS,WAAW,MAAuB;AACzC,KAAI,KAAK,WAAW,OAAO,CAAE,QAAO,SAAS;AAC7C,KAAI,KAAK,WAAW,YAAY,CAAE,QAAO,SAAS;AAClD,KAAI,KAAK,WAAW,YAAY,IAAI,KAAK,WAAW,SAAS,CAC3D,QAAO,SAAS;AAClB,KAAI,KAAK,WAAW,WAAW,IAAI,KAAK,WAAW,QAAQ,CACzD,QAAO,SAAS;AAClB,KAAI,SAAS,SAAS,KAAK,WAAW,OAAO,CAAE,QAAO,SAAS;AAC/D,KAAI,KAAK,WAAW,SAAS,CAAE,QAAO,SAAS;AAC/C,KAAI,KAAK,WAAW,SAAS,CAAE,QAAO,SAAS;AAE/C,QAAO,SAAS;;;;;;;;AASlB,MAAa,uBAAsC,EACjD,KAAK,OAAO;AACV,YAAW,MAAM,KAAK,CAAC,QAAQ,MAAM;GAExC;;;;;;;;;;;;;;AAsCD,SAAgB,UACd,YACA,UACY;CACZ,MAAM,OAAO,UAAU;CACvB,MAAM,WAAW,SAAkB,UACjC,SAAS,QAA8B;AACzC,aAAY,MAAM,QAAQ;AAC1B,cAAaA,YAAc,MAAM,QAAQ"}
package/dist/react.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Method, RPCMethod } from "./serializable.js";
2
2
  import { StreamOptions } from "./client.js";
3
- import "./client-storage-tusTuoSF.js";
3
+ import "./client-storage-BPjfP_is.js";
4
4
  import { Agent, MCPServersState } from "./index.js";
5
5
  import { PartySocket } from "partysocket";
6
6
  import { usePartySocket } from "partysocket/react";
@@ -1,4 +1,4 @@
1
- import "./client-storage-tusTuoSF.js";
1
+ import "./client-storage-BPjfP_is.js";
2
2
  import {
3
3
  AgentWorkflowEvent,
4
4
  AgentWorkflowParams,
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "durable objects"
10
10
  ],
11
11
  "type": "module",
12
- "version": "0.7.0",
12
+ "version": "0.7.2",
13
13
  "license": "MIT",
14
14
  "repository": {
15
15
  "directory": "packages/agents",
@@ -51,7 +51,7 @@
51
51
  "peerDependencies": {
52
52
  "@ai-sdk/openai": "^3.0.0",
53
53
  "@ai-sdk/react": "^3.0.0",
54
- "@cloudflare/ai-chat": "^0.1.6",
54
+ "@cloudflare/ai-chat": "^0.1.7",
55
55
  "@cloudflare/codemode": "^0.1.2",
56
56
  "@x402/core": "^2.0.0",
57
57
  "@x402/evm": "^2.0.0",