@ai-sdk/workflow 1.0.0-beta.9 → 1.0.0-canary.32

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,231 @@
1
1
  # @ai-sdk/workflow
2
2
 
3
+ ## 1.0.0-canary.32
4
+
5
+ ### Patch Changes
6
+
7
+ - 0c4c275: trigger initial canary release
8
+ - Updated dependencies [0c4c275]
9
+ - @ai-sdk/provider-utils@5.0.0-canary.31
10
+ - @ai-sdk/provider@4.0.0-canary.15
11
+ - ai@7.0.0-canary.117
12
+
13
+ ## 1.0.0-beta.31
14
+
15
+ ### Patch Changes
16
+
17
+ - ai@7.0.0-beta.116
18
+
19
+ ## 1.0.0-beta.30
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [08d2129]
24
+ - Updated dependencies [202f107]
25
+ - @ai-sdk/provider-utils@5.0.0-beta.30
26
+ - ai@7.0.0-beta.115
27
+
28
+ ## 1.0.0-beta.29
29
+
30
+ ### Patch Changes
31
+
32
+ - 258c093: chore: ensure consistent import handling and avoid import duplicates or cycles
33
+ - Updated dependencies [43a6750]
34
+ - Updated dependencies [81caa5d]
35
+ - Updated dependencies [1f7db50]
36
+ - Updated dependencies [9bd6512]
37
+ - Updated dependencies [258c093]
38
+ - Updated dependencies [b6783da]
39
+ - Updated dependencies [6147cdf]
40
+ - ai@7.0.0-beta.114
41
+ - @ai-sdk/provider-utils@5.0.0-beta.29
42
+ - @ai-sdk/provider@4.0.0-beta.14
43
+
44
+ ## 1.0.0-beta.28
45
+
46
+ ### Patch Changes
47
+
48
+ - 9f0e36c: trigger release for all packages after provenance setup
49
+ - Updated dependencies [9f0e36c]
50
+ - ai@7.0.0-beta.113
51
+ - @ai-sdk/provider@4.0.0-beta.13
52
+ - @ai-sdk/provider-utils@5.0.0-beta.28
53
+
54
+ ## 1.0.0-beta.27
55
+
56
+ ### Patch Changes
57
+
58
+ - 29d8cf4: feat(ai): rename the core-event types
59
+ - a0ca584: fix (workflow): preserve invalid tool calls as errors instead of emitting synthetic success results
60
+ - Updated dependencies [785fe16]
61
+ - Updated dependencies [5f3749c]
62
+ - Updated dependencies [0a51f7d]
63
+ - Updated dependencies [71d3022]
64
+ - Updated dependencies [67df0a0]
65
+ - Updated dependencies [4181cfe]
66
+ - Updated dependencies [51ce232]
67
+ - Updated dependencies [cf93359]
68
+ - Updated dependencies [befb78c]
69
+ - Updated dependencies [29d8cf4]
70
+ - Updated dependencies [0458559]
71
+ - Updated dependencies [58a2ad7]
72
+ - Updated dependencies [5852c0a]
73
+ - Updated dependencies [37d69b2]
74
+ - Updated dependencies [1043274]
75
+ - Updated dependencies [7f59f04]
76
+ - Updated dependencies [7677c1e]
77
+ - Updated dependencies [116c89f]
78
+ - Updated dependencies [f58f9bc]
79
+ - Updated dependencies [e1bfb9c]
80
+ - Updated dependencies [e87d71b]
81
+ - Updated dependencies [9d486aa]
82
+ - Updated dependencies [9b0bc8a]
83
+ - Updated dependencies [fc92055]
84
+ - Updated dependencies [4e095b0]
85
+ - @ai-sdk/provider-utils@5.0.0-beta.27
86
+ - ai@7.0.0-beta.112
87
+
88
+ ## 1.0.0-beta.26
89
+
90
+ ### Major Changes
91
+
92
+ - 1949571: feat(ai): make experimental_telemetry stable
93
+
94
+ ### Patch Changes
95
+
96
+ - f32c750: refactoring(ai): simplify mergeAbortSignals
97
+ - Updated dependencies [f319fde]
98
+ - Updated dependencies [1949571]
99
+ - Updated dependencies [511902c]
100
+ - Updated dependencies [6542d93]
101
+ - Updated dependencies [2e98477]
102
+ - Updated dependencies [876fd3e]
103
+ - Updated dependencies [f32c750]
104
+ - ai@7.0.0-beta.111
105
+ - @ai-sdk/provider-utils@5.0.0-beta.26
106
+
107
+ ## 1.0.0-beta.25
108
+
109
+ ### Patch Changes
110
+
111
+ - Updated dependencies [72cb801]
112
+ - ai@7.0.0-beta.110
113
+
114
+ ## 1.0.0-beta.24
115
+
116
+ ### Patch Changes
117
+
118
+ - eea8d98: refactoring: rename tool execution events
119
+ - Updated dependencies [ec98264]
120
+ - Updated dependencies [eea8d98]
121
+ - Updated dependencies [75ef93e]
122
+ - ai@7.0.0-beta.109
123
+ - @ai-sdk/provider-utils@5.0.0-beta.25
124
+
125
+ ## 1.0.0-beta.23
126
+
127
+ ### Patch Changes
128
+
129
+ - Updated dependencies [f807e45]
130
+ - @ai-sdk/provider-utils@5.0.0-beta.24
131
+ - ai@7.0.0-beta.108
132
+
133
+ ## 1.0.0-beta.22
134
+
135
+ ### Patch Changes
136
+
137
+ - Updated dependencies [350ea38]
138
+ - @ai-sdk/provider-utils@5.0.0-beta.23
139
+ - ai@7.0.0-beta.107
140
+
141
+ ## 1.0.0-beta.21
142
+
143
+ ### Patch Changes
144
+
145
+ - fbea042: refactor: replace duplicate `filterTools`/`filterToolSet` with shared `experimental_filterActiveTools` from `ai`
146
+
147
+ ## 1.0.0-beta.20
148
+
149
+ ### Patch Changes
150
+
151
+ - ai@7.0.0-beta.106
152
+
153
+ ## 1.0.0-beta.19
154
+
155
+ ### Patch Changes
156
+
157
+ - Updated dependencies [33d099c]
158
+ - ai@7.0.0-beta.105
159
+
160
+ ## 1.0.0-beta.18
161
+
162
+ ### Patch Changes
163
+
164
+ - eba685c: Remove `maxSteps` option from `WorkflowAgent`. Use `stopWhen` with stop conditions like `isStepCount()` instead.
165
+ - Updated dependencies [2a74d43]
166
+ - ai@7.0.0-beta.104
167
+
168
+ ## 1.0.0-beta.17
169
+
170
+ ### Patch Changes
171
+
172
+ - 382d53b: refactoring: rename context to runtimeContext
173
+ - c3d4019: chore(ai): rename 'TelemetrySettings' to 'TelemetryOptions'
174
+ - 083947b: feat(ai): separate toolsContext from context
175
+ - Updated dependencies [382d53b]
176
+ - Updated dependencies [7bf7d7f]
177
+ - Updated dependencies [c3d4019]
178
+ - Updated dependencies [083947b]
179
+ - ai@7.0.0-beta.103
180
+ - @ai-sdk/provider-utils@5.0.0-beta.22
181
+
182
+ ## 1.0.0-beta.16
183
+
184
+ ### Patch Changes
185
+
186
+ - ai@7.0.0-beta.102
187
+
188
+ ## 1.0.0-beta.15
189
+
190
+ ### Patch Changes
191
+
192
+ - Updated dependencies [4873966]
193
+ - ai@7.0.0-beta.101
194
+
195
+ ## 1.0.0-beta.14
196
+
197
+ ### Patch Changes
198
+
199
+ - Updated dependencies [add1126]
200
+ - @ai-sdk/provider-utils@5.0.0-beta.21
201
+ - ai@7.0.0-beta.100
202
+
203
+ ## 1.0.0-beta.13
204
+
205
+ ### Patch Changes
206
+
207
+ - Updated dependencies [2a9c144]
208
+ - ai@7.0.0-beta.99
209
+
210
+ ## 1.0.0-beta.12
211
+
212
+ ### Patch Changes
213
+
214
+ - ai@7.0.0-beta.98
215
+
216
+ ## 1.0.0-beta.11
217
+
218
+ ### Patch Changes
219
+
220
+ - Updated dependencies [208d045]
221
+ - ai@7.0.0-beta.97
222
+
223
+ ## 1.0.0-beta.10
224
+
225
+ ### Patch Changes
226
+
227
+ - ai@7.0.0-beta.96
228
+
3
229
  ## 1.0.0-beta.9
4
230
 
5
231
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { LanguageModelV4, SharedV4ProviderOptions, LanguageModelV4CallOptions, LanguageModelV4Prompt, LanguageModelV4StreamPart } from '@ai-sdk/provider';
2
- import { ToolSet, LanguageModel, SystemModelMessage, ToolChoice, StopCondition, LanguageModelResponseMetadata, LanguageModelUsage, FinishReason, ToolCallRepairFunction, StepResult, StreamTextOnStepFinishCallback, ModelMessage, Experimental_LanguageModelStreamPart, UIMessage, UIMessageChunk, ChatTransport, PrepareSendMessagesRequest, PrepareReconnectToStreamRequest, ChatRequestOptions } from 'ai';
2
+ import { ToolSet, LanguageModel, SystemModelMessage, ToolChoice, StopCondition, ActiveTools, LanguageModelResponseMetadata, LanguageModelUsage, FinishReason, ToolCallRepairFunction, StepResult, GenerateTextOnStepFinishCallback, ModelMessage, Experimental_LanguageModelStreamPart, UIMessage, UIMessageChunk, ChatTransport, PrepareSendMessagesRequest, PrepareReconnectToStreamRequest, ChatRequestOptions } from 'ai';
3
3
  export { Experimental_LanguageModelStreamPart as ModelCallStreamPart, Output, ToolCallRepairFunction } from 'ai';
4
4
 
5
5
  /**
@@ -15,10 +15,10 @@ type CompatibleLanguageModel = LanguageModelV4;
15
15
 
16
16
  /**
17
17
  * Callback function to be called after each step completes.
18
- * Alias for the AI SDK's StreamTextOnStepFinishCallback, using
18
+ * Alias for the AI SDK's GenerateTextOnStepFinishCallback, using
19
19
  * WorkflowAgent-consistent naming.
20
20
  */
21
- type WorkflowAgentOnStepFinishCallback<TTools extends ToolSet = ToolSet> = StreamTextOnStepFinishCallback<TTools, any>;
21
+ type WorkflowAgentOnStepFinishCallback<TTools extends ToolSet = ToolSet> = GenerateTextOnStepFinishCallback<TTools, any>;
22
22
  /**
23
23
  * Infer the type of the tools of a workflow agent.
24
24
  */
@@ -55,7 +55,7 @@ type ProviderOptions = SharedV4ProviderOptions;
55
55
  /**
56
56
  * Telemetry settings for observability.
57
57
  */
58
- interface TelemetrySettings {
58
+ interface TelemetryOptions {
59
59
  /**
60
60
  * Enable or disable telemetry. Defaults to true.
61
61
  */
@@ -252,7 +252,11 @@ interface PrepareCallOptions<TTools extends ToolSet = ToolSet> extends Partial<G
252
252
  tools: TTools;
253
253
  instructions?: string | SystemModelMessage | Array<SystemModelMessage>;
254
254
  toolChoice?: ToolChoice<TTools>;
255
- experimental_telemetry?: TelemetrySettings;
255
+ telemetry?: TelemetryOptions;
256
+ /**
257
+ * @deprecated Use `telemetry` instead. This alias will be removed in a future major release.
258
+ */
259
+ experimental_telemetry?: TelemetryOptions;
256
260
  experimental_context?: unknown;
257
261
  messages: ModelMessage[];
258
262
  }
@@ -303,9 +307,15 @@ interface WorkflowAgentOptions<TTools extends ToolSet = ToolSet> extends Generat
303
307
  */
304
308
  toolChoice?: ToolChoice<TTools>;
305
309
  /**
306
- * Optional telemetry configuration (experimental).
310
+ * Optional telemetry configuration.
311
+ */
312
+ telemetry?: TelemetryOptions;
313
+ /**
314
+ * Optional telemetry configuration.
315
+ *
316
+ * @deprecated Use `telemetry` instead. This alias will be removed in a future major release.
307
317
  */
308
- experimental_telemetry?: TelemetrySettings;
318
+ experimental_telemetry?: TelemetryOptions;
309
319
  /**
310
320
  * Default context that is passed into tool execution for every stream call on this agent.
311
321
  *
@@ -327,7 +337,7 @@ interface WorkflowAgentOptions<TTools extends ToolSet = ToolSet> extends Generat
327
337
  *
328
338
  * Per-stream `activeTools` values passed to `stream()` override this default.
329
339
  */
330
- activeTools?: Array<keyof NoInfer<TTools>>;
340
+ activeTools?: ActiveTools<NoInfer<TTools>>;
331
341
  /**
332
342
  * Default output specification for structured outputs.
333
343
  * Use `Output.object({ schema })` for structured output or `Output.text()` for text output.
@@ -374,11 +384,11 @@ interface WorkflowAgentOptions<TTools extends ToolSet = ToolSet> extends Generat
374
384
  /**
375
385
  * Callback called before a tool's execute function runs.
376
386
  */
377
- experimental_onToolCallStart?: WorkflowAgentOnToolCallStartCallback;
387
+ experimental_onToolExecutionStart?: WorkflowAgentOnToolExecutionStartCallback;
378
388
  /**
379
389
  * Callback called after a tool execution completes.
380
390
  */
381
- experimental_onToolCallFinish?: WorkflowAgentOnToolCallFinishCallback;
391
+ experimental_onToolExecutionEnd?: WorkflowAgentOnToolExecutionEndCallback;
382
392
  /**
383
393
  * Prepare the parameters for the stream call.
384
394
  * Called once before the agent loop starts. Use this to transform
@@ -460,7 +470,7 @@ type WorkflowAgentOnStepStartCallback<TTools extends ToolSet = ToolSet> = (event
460
470
  /**
461
471
  * Callback that is called before a tool's execute function runs.
462
472
  */
463
- type WorkflowAgentOnToolCallStartCallback = (event: {
473
+ type WorkflowAgentOnToolExecutionStartCallback = (event: {
464
474
  /** The tool call being executed */
465
475
  readonly toolCall: ToolCall;
466
476
  /** The current step number (0-based) */
@@ -471,7 +481,7 @@ type WorkflowAgentOnToolCallStartCallback = (event: {
471
481
  * Uses a discriminated union pattern: check `success` to determine
472
482
  * whether `output` or `error` is available.
473
483
  */
474
- type WorkflowAgentOnToolCallFinishCallback = (event: {
484
+ type WorkflowAgentOnToolExecutionEndCallback = (event: {
475
485
  /** The tool call that was executed */
476
486
  readonly toolCall: ToolCall;
477
487
  /** The current step number (0-based) */
@@ -558,12 +568,6 @@ type WorkflowAgentStreamOptions<TTools extends ToolSet = ToolSet, OUTPUT = never
558
568
  * When the condition is an array, any of the conditions can be met to stop the generation.
559
569
  */
560
570
  stopWhen?: StopCondition<NoInfer<ToolSet>, any> | Array<StopCondition<NoInfer<ToolSet>, any>>;
561
- /**
562
- * Maximum number of sequential LLM calls (steps), e.g. when you use tool calls.
563
- * A maximum number can be set to prevent infinite loops in the case of misconfigured tools.
564
- * By default, it's unlimited (the agent loops until completion).
565
- */
566
- maxSteps?: number;
567
571
  /**
568
572
  * The tool choice strategy. Default: 'auto'.
569
573
  * Overrides the toolChoice from the constructor if provided.
@@ -573,11 +577,17 @@ type WorkflowAgentStreamOptions<TTools extends ToolSet = ToolSet, OUTPUT = never
573
577
  * Limits the tools that are available for the model to call without
574
578
  * changing the tool call and result types in the result.
575
579
  */
576
- activeTools?: Array<keyof NoInfer<TTools>>;
580
+ activeTools?: ActiveTools<NoInfer<TTools>>;
577
581
  /**
578
- * Optional telemetry configuration (experimental).
582
+ * Optional telemetry configuration.
583
+ */
584
+ telemetry?: TelemetryOptions;
585
+ /**
586
+ * Optional telemetry configuration.
587
+ *
588
+ * @deprecated Use `telemetry` instead. This alias will be removed in a future major release.
579
589
  */
580
- experimental_telemetry?: TelemetrySettings;
590
+ experimental_telemetry?: TelemetryOptions;
581
591
  /**
582
592
  * Context that is passed into tool execution.
583
593
  * Experimental (can break in patch releases).
@@ -659,11 +669,11 @@ type WorkflowAgentStreamOptions<TTools extends ToolSet = ToolSet, OUTPUT = never
659
669
  /**
660
670
  * Callback called before a tool's execute function runs.
661
671
  */
662
- experimental_onToolCallStart?: WorkflowAgentOnToolCallStartCallback;
672
+ experimental_onToolExecutionStart?: WorkflowAgentOnToolExecutionStartCallback;
663
673
  /**
664
674
  * Callback called after a tool execution completes.
665
675
  */
666
- experimental_onToolCallFinish?: WorkflowAgentOnToolCallFinishCallback;
676
+ experimental_onToolExecutionEnd?: WorkflowAgentOnToolExecutionEndCallback;
667
677
  /**
668
678
  * Callback function called before each step in the agent loop.
669
679
  * Use this to modify settings, manage context, or inject messages dynamically.
@@ -823,8 +833,8 @@ declare class WorkflowAgent<TBaseTools extends ToolSet = ToolSet> {
823
833
  private constructorOnFinish?;
824
834
  private constructorOnStart?;
825
835
  private constructorOnStepStart?;
826
- private constructorOnToolCallStart?;
827
- private constructorOnToolCallFinish?;
836
+ private constructorOnToolExecutionStart?;
837
+ private constructorOnToolExecutionEnd?;
828
838
  private prepareCall?;
829
839
  constructor(options: WorkflowAgentOptions<TBaseTools>);
830
840
  generate(): void;
@@ -997,4 +1007,4 @@ declare class WorkflowChatTransport<UI_MESSAGE extends UIMessage> implements Cha
997
1007
  private onFinish;
998
1008
  }
999
1009
 
1000
- export { type CompatibleLanguageModel, type DownloadFunction, type GenerationSettings, type InferWorkflowAgentTools, type InferWorkflowAgentUIMessage, type OutputSpecification, type PrepareCallCallback, type PrepareCallOptions, type PrepareCallResult, type PrepareStepCallback, type PrepareStepInfo, type PrepareStepResult, type ProviderOptions, type ReconnectToStreamOptions, type SendMessagesOptions, type StreamTextTransform, type TelemetrySettings, WorkflowAgent, type WorkflowAgentOnAbortCallback, type WorkflowAgentOnErrorCallback, type WorkflowAgentOnFinishCallback, type WorkflowAgentOnStartCallback, type WorkflowAgentOnStepFinishCallback, type WorkflowAgentOnStepStartCallback, type WorkflowAgentOnToolCallFinishCallback, type WorkflowAgentOnToolCallStartCallback, type WorkflowAgentOptions, type WorkflowAgentStreamOptions, type WorkflowAgentStreamResult, WorkflowChatTransport, type WorkflowChatTransportOptions, createModelCallToUIChunkTransform, toUIMessageChunk };
1010
+ export { type CompatibleLanguageModel, type DownloadFunction, type GenerationSettings, type InferWorkflowAgentTools, type InferWorkflowAgentUIMessage, type OutputSpecification, type PrepareCallCallback, type PrepareCallOptions, type PrepareCallResult, type PrepareStepCallback, type PrepareStepInfo, type PrepareStepResult, type ProviderOptions, type ReconnectToStreamOptions, type SendMessagesOptions, type StreamTextTransform, type TelemetryOptions, WorkflowAgent, type WorkflowAgentOnAbortCallback, type WorkflowAgentOnErrorCallback, type WorkflowAgentOnFinishCallback, type WorkflowAgentOnStartCallback, type WorkflowAgentOnStepFinishCallback, type WorkflowAgentOnStepStartCallback, type WorkflowAgentOnToolExecutionEndCallback, type WorkflowAgentOnToolExecutionStartCallback, type WorkflowAgentOptions, type WorkflowAgentStreamOptions, type WorkflowAgentStreamResult, WorkflowChatTransport, type WorkflowChatTransportOptions, createModelCallToUIChunkTransform, toUIMessageChunk };