agents 0.20.0 → 0.21.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 (87) hide show
  1. package/README.md +50 -12
  2. package/dist/{agent-tool-types-Btk9ETS-.d.ts → agent-tool-types-CzGGB-20.d.ts} +403 -115
  3. package/dist/agent-tool-types.d.ts +1 -1
  4. package/dist/{agent-tools-UuScsJg3.d.ts → agent-tools-zR2d5uij.d.ts} +2 -2
  5. package/dist/agent-tools.d.ts +24 -8
  6. package/dist/agent-tools.js +14 -6
  7. package/dist/agent-tools.js.map +1 -1
  8. package/dist/browser/ai.d.ts +5 -3
  9. package/dist/browser/ai.js +86 -7
  10. package/dist/browser/ai.js.map +1 -1
  11. package/dist/browser/index.d.ts +1 -1
  12. package/dist/browser/index.js +1 -1
  13. package/dist/browser/tanstack-ai.js +13 -1
  14. package/dist/browser/tanstack-ai.js.map +1 -1
  15. package/dist/chat/index.d.ts +31 -2
  16. package/dist/chat/index.js +57 -2
  17. package/dist/chat/index.js.map +1 -1
  18. package/dist/chat/react.d.ts +5 -179
  19. package/dist/chat/react.js +18 -555
  20. package/dist/chat/react.js.map +1 -1
  21. package/dist/chat/transport.d.ts +10 -0
  22. package/dist/chat/transport.js +2 -0
  23. package/dist/chat-sdk/index.d.ts +1 -1
  24. package/dist/client.d.ts +1 -1
  25. package/dist/cloudflare-BduZwmYK.js +204 -0
  26. package/dist/cloudflare-BduZwmYK.js.map +1 -0
  27. package/dist/{connector-v2M1zlZp.d.ts → connector-CkQD4MK3.d.ts} +20 -3
  28. package/dist/{connector-KEJnl6e5.js → connector-CptFKzRh.js} +158 -40
  29. package/dist/connector-CptFKzRh.js.map +1 -0
  30. package/dist/{handler-stateless-8hQN_kC3.js → handler-stateless-CIkKPETH.js} +20 -69
  31. package/dist/handler-stateless-CIkKPETH.js.map +1 -0
  32. package/dist/index.d.ts +21 -11
  33. package/dist/index.js +31 -21
  34. package/dist/index.js.map +1 -1
  35. package/dist/mcp/client.d.ts +20 -20
  36. package/dist/mcp/index.d.ts +35 -35
  37. package/dist/mcp/index.js +32 -98
  38. package/dist/mcp/index.js.map +1 -1
  39. package/dist/mcp/server.js +1 -1
  40. package/dist/observability/ai/index.d.ts +10 -131
  41. package/dist/observability/ai/index.js +209 -444
  42. package/dist/observability/ai/index.js.map +1 -1
  43. package/dist/{wire-types-CU9rLoeS.js → protocol-Dqc2MQxo.js} +2 -46
  44. package/dist/protocol-Dqc2MQxo.js.map +1 -0
  45. package/dist/react.d.ts +1 -1
  46. package/dist/react.js +5 -8
  47. package/dist/react.js.map +1 -1
  48. package/dist/serializable.d.ts +1 -1
  49. package/dist/sub-routing.d.ts +18 -6
  50. package/dist/sub-routing.js +92 -2
  51. package/dist/sub-routing.js.map +1 -1
  52. package/dist/wire-types-CnMt6_HR.js +47 -0
  53. package/dist/wire-types-CnMt6_HR.js.map +1 -0
  54. package/dist/workflow-types.d.ts +25 -25
  55. package/dist/workflow-types.js.map +1 -1
  56. package/dist/workflows.d.ts +22 -22
  57. package/dist/ws-chat-transport-CIoOBbO7.js +561 -0
  58. package/dist/ws-chat-transport-CIoOBbO7.js.map +1 -0
  59. package/dist/ws-chat-transport-UNRIS2xl.d.ts +184 -0
  60. package/docs/adding-to-existing-project.md +4 -2
  61. package/docs/agent-class.md +1 -1
  62. package/docs/agent-tools.md +29 -0
  63. package/docs/browse-the-web.md +16 -1
  64. package/docs/chat-agents.md +3 -1
  65. package/docs/client-sdk.md +12 -8
  66. package/docs/configuration.md +7 -1
  67. package/docs/cross-domain-authentication.md +7 -35
  68. package/docs/email.md +2 -13
  69. package/docs/human-in-the-loop.md +15 -12
  70. package/docs/long-running-agents.md +11 -11
  71. package/docs/mcp-client.md +1 -1
  72. package/docs/mcp-servers.md +7 -1
  73. package/docs/mcp-transports.md +18 -12
  74. package/docs/migration-to-ai-sdk-v5.md +2 -2
  75. package/docs/migration-to-ai-sdk-v6.md +5 -1
  76. package/docs/observability.md +24 -67
  77. package/docs/routing.md +27 -0
  78. package/docs/sub-agents.md +47 -2
  79. package/docs/webhooks.md +109 -136
  80. package/docs/workflows.md +9 -1
  81. package/package.json +19 -10
  82. package/dist/cloudflare-BldFV0Pa.js +0 -117
  83. package/dist/cloudflare-BldFV0Pa.js.map +0 -1
  84. package/dist/connector-KEJnl6e5.js.map +0 -1
  85. package/dist/handler-stateless-8hQN_kC3.js.map +0 -1
  86. package/dist/wire-types-CU9rLoeS.js.map +0 -1
  87. package/dist/workflow-types-Baz_PO5v.d.ts +0 -280
@@ -1,2 +1,2 @@
1
- import { n as getMcpAuthContext, t as createStatelessMcpHandler } from "../handler-stateless-8hQN_kC3.js";
1
+ import { n as getMcpAuthContext, t as createStatelessMcpHandler } from "../handler-stateless-CIkKPETH.js";
2
2
  export { createStatelessMcpHandler as createMcpHandler, getMcpAuthContext };
@@ -4,130 +4,17 @@ type AISDKStorageOptions = {
4
4
  readonly storeMessages?: boolean;
5
5
  readonly storeTools?: boolean;
6
6
  };
7
- /** Instrumentation options for the AI SDK v6 adapter. */
7
+ /** Instrumentation options for the AI SDK v6 and v7 wrapper. */
8
8
  type AISDKInstrumentationOptions = AISDKStorageOptions & {
9
- /** AI SDK v6 `experimental_context` keys to emit as scalar attributes. */ readonly includeRuntimeContext?: readonly string[];
10
- };
11
- //#endregion
12
- //#region src/observability/ai/v7/types.d.ts
13
- /** Common AI SDK v7 telemetry callback options this adapter reads. */
14
- type AISDKV7TelemetryOptions = {
15
- readonly functionId?: string | undefined;
16
- };
17
- /** AI SDK v7 operation lifecycle event shape consumed by this adapter. */
18
- type AISDKV7OperationEvent = AISDKV7TelemetryOptions & {
19
- readonly callId: string;
20
- readonly finishReason?: unknown;
21
- readonly frequencyPenalty?: unknown;
22
- readonly maxOutputTokens?: unknown;
23
- readonly maxTokens?: unknown;
24
- readonly messages?: unknown;
25
- readonly modelId?: string | undefined;
26
- readonly object?: unknown;
27
- readonly operationId?: string | undefined;
28
- readonly presencePenalty?: unknown;
29
- readonly prompt?: unknown;
30
- readonly provider?: string | undefined;
31
- readonly response?: unknown;
32
- readonly responseId?: unknown;
33
- readonly responseModel?: unknown;
34
- readonly runtimeContext?: unknown;
35
- readonly seed?: unknown;
36
- readonly temperature?: unknown;
37
- readonly text?: unknown;
38
- readonly toolCalls?: unknown;
39
- readonly toolsContext?: unknown;
40
- readonly topK?: unknown;
41
- readonly topP?: unknown;
42
- readonly totalUsage?: unknown;
43
- readonly usage?: unknown;
44
- };
45
- /** AI SDK v7 language-model lifecycle event shape consumed by this adapter. */
46
- type AISDKV7LanguageModelCallEvent = AISDKV7TelemetryOptions & {
47
- readonly callId: string;
48
- readonly content?: unknown;
49
- readonly finishReason?: unknown;
50
- readonly frequencyPenalty?: unknown;
51
- readonly headers?: unknown;
52
- readonly maxOutputTokens?: unknown;
53
- readonly maxTokens?: unknown;
54
- readonly messages?: unknown;
55
- readonly modelId?: string | undefined;
56
- readonly performance?: unknown;
57
- readonly presencePenalty?: unknown;
58
- readonly prompt?: unknown;
59
- readonly provider?: string | undefined;
60
- readonly providerMetadata?: unknown;
61
- readonly response?: unknown;
62
- readonly responseHeaders?: unknown;
63
- readonly responseId?: unknown;
64
- readonly responseModel?: unknown;
65
- readonly seed?: unknown;
66
- readonly temperature?: unknown;
67
- readonly topK?: unknown;
68
- readonly topP?: unknown;
69
- readonly totalUsage?: unknown;
70
- readonly usage?: unknown;
71
- };
72
- /** AI SDK v7 tool-call identity shape consumed by this adapter. */
73
- type AISDKV7ToolCall = {
74
- readonly input?: unknown;
75
- readonly toolCallId?: string | undefined;
76
- readonly toolName?: string | undefined;
77
- };
78
- /** AI SDK v7 tool-output event shape consumed by this adapter. */
79
- type AISDKV7ToolOutput = {
80
- readonly error?: unknown;
81
- readonly output?: unknown;
82
- readonly type?: string | undefined;
83
- };
84
- /** AI SDK v7 tool lifecycle event shape consumed by this adapter. */
85
- type AISDKV7ToolExecutionEvent = AISDKV7TelemetryOptions & {
86
- readonly callId: string;
87
- readonly toolCall: AISDKV7ToolCall;
88
- readonly toolContext?: unknown;
89
- readonly toolOutput?: AISDKV7ToolOutput | undefined;
90
- };
91
- /** AI SDK v7 abort event shape consumed by this adapter. */
92
- type AISDKV7AbortEvent = {
93
- readonly callId: string;
94
- readonly reason?: unknown;
95
- };
96
- /** AI SDK v7 model-call execution hook shape consumed by this adapter. */
97
- type AISDKV7ExecuteLanguageModelOptions<T> = {
98
- readonly callId: string;
99
- readonly execute: () => PromiseLike<T>;
100
- };
101
- /** AI SDK v7 tool execution hook shape consumed by this adapter. */
102
- type AISDKV7ExecuteToolOptions<T> = {
103
- readonly callId: string;
104
- readonly execute: () => PromiseLike<T>;
105
- readonly toolCallId: string;
106
- };
107
- /** Structural AI SDK v7 telemetry object returned by this package. */
108
- type AISDKV7Telemetry = {
109
- readonly executeLanguageModelCall?: <T>(
110
- options: AISDKV7ExecuteLanguageModelOptions<T>
111
- ) => PromiseLike<T>;
112
- readonly executeTool?: <T>(
113
- options: AISDKV7ExecuteToolOptions<T>
114
- ) => PromiseLike<T>;
115
- readonly onAbort?: (event: AISDKV7AbortEvent) => void | PromiseLike<void>;
116
- readonly onEnd?: (event: AISDKV7OperationEvent) => void | PromiseLike<void>;
117
- readonly onError?: (event: unknown) => void | PromiseLike<void>;
118
- readonly onLanguageModelCallEnd?: (
119
- event: AISDKV7LanguageModelCallEvent
120
- ) => void | PromiseLike<void>;
121
- readonly onLanguageModelCallStart?: (
122
- event: AISDKV7LanguageModelCallEvent
123
- ) => void | PromiseLike<void>;
124
- readonly onStart?: (event: AISDKV7OperationEvent) => void | PromiseLike<void>;
125
- readonly onToolExecutionEnd?: (
126
- event: AISDKV7ToolExecutionEvent
127
- ) => void | PromiseLike<void>;
128
- readonly onToolExecutionStart?: (
129
- event: AISDKV7ToolExecutionEvent
130
- ) => void | PromiseLike<void>;
9
+ /**
10
+ * Context keys to emit as `cloudflare.agents.runtime_context.{key}`, set
11
+ * once for the wrapper rather than per call.
12
+ *
13
+ * Distinct from the AI SDK's own per-call `telemetry.includeRuntimeContext`,
14
+ * which shares the name but selects keys that map onto the canonical
15
+ * `cloudflare.agents.turn.*` / `cloudflare.agents.metadata.*` attributes.
16
+ */
17
+ readonly includeRuntimeContext?: readonly string[];
131
18
  };
132
19
  //#endregion
133
20
  //#region src/observability/ai/index.d.ts
@@ -138,18 +25,10 @@ declare function wrapAISDK<T extends Record<string, unknown>>(
138
25
  ai: T,
139
26
  options?: AISDKInstrumentationOptions
140
27
  ): T;
141
- /**
142
- * Creates an AI SDK v7 telemetry adapter for use with `registerTelemetry` or
143
- * per-call telemetry configuration.
144
- */
145
- declare function createAISDKTelemetry(
146
- options?: AISDKStorageOptions
147
- ): AISDKV7Telemetry;
148
28
  //#endregion
149
29
  export {
150
30
  type AISDKInstrumentationOptions,
151
31
  type AISDKStorageOptions,
152
- createAISDKTelemetry,
153
32
  wrapAISDK
154
33
  };
155
34
  //# sourceMappingURL=index.d.ts.map