@ai-sdk/workflow 2.0.20 → 2.0.22

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,24 @@
1
1
  # @ai-sdk/workflow
2
2
 
3
+ ## 2.0.22
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [802af1e]
8
+ - ai@7.0.91
9
+
10
+ ## 2.0.21
11
+
12
+ ### Patch Changes
13
+
14
+ - 180ce77: fix(workflow): preserve tool behavior across workflow step boundaries
15
+ - 82a16c9: fix(workflow): retain model files and sources in provider order across durable agent results and message history
16
+ - 30306cf: fix(workflow): include executed tool results in completed agent steps
17
+ - 19d8f30: fix(workflow): infer constructor-level structured output in stream results
18
+ - Updated dependencies [6bcc0f8]
19
+ - @ai-sdk/provider-utils@5.0.36
20
+ - ai@7.0.90
21
+
3
22
  ## 2.0.20
4
23
 
5
24
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -39,7 +39,7 @@ type WorkflowAgentOnStepFinishCallback<TTools extends ToolSet = ToolSet, TRuntim
39
39
  /**
40
40
  * Infer the type of the tools of a workflow agent.
41
41
  */
42
- type InferWorkflowAgentTools<WORKFLOW_AGENT> = WORKFLOW_AGENT extends WorkflowAgent<infer TOOLS, any> ? TOOLS : never;
42
+ type InferWorkflowAgentTools<WORKFLOW_AGENT> = WORKFLOW_AGENT extends WorkflowAgent<infer TOOLS, any, any, any> ? TOOLS : never;
43
43
  /**
44
44
  * Infer the UI message type of a workflow agent.
45
45
  */
@@ -65,6 +65,7 @@ interface OutputSpecification<OUTPUT, PARTIAL> {
65
65
  finishReason: FinishReason;
66
66
  }): Promise<OUTPUT>;
67
67
  }
68
+ type DefaultWorkflowAgentOutput<OUTPUT> = 0 extends 1 & OUTPUT ? never : OUTPUT;
68
69
  /**
69
70
  * Provider-specific options type. This is equivalent to SharedV4ProviderOptions from @ai-sdk/provider.
70
71
  */
@@ -313,7 +314,7 @@ type PrepareCallCallback<TTools extends ToolSet = ToolSet, TRuntimeContext exten
313
314
  /**
314
315
  * Configuration options for creating a {@link WorkflowAgent} instance.
315
316
  */
316
- type WorkflowAgentOptions<TTools extends ToolSet = ToolSet, TRuntimeContext extends Context = Context> = GenerationSettings & WorkflowAgentToolsContextParameter<TTools> & {
317
+ type WorkflowAgentOptions<TTools extends ToolSet = ToolSet, TRuntimeContext extends Context = Context, OUTPUT = any, PARTIAL_OUTPUT = any> = GenerationSettings & WorkflowAgentToolsContextParameter<TTools> & {
317
318
  /**
318
319
  * The id of the agent.
319
320
  */
@@ -383,7 +384,7 @@ type WorkflowAgentOptions<TTools extends ToolSet = ToolSet, TRuntimeContext exte
383
384
  *
384
385
  * Per-stream `output` values passed to `stream()` override this default.
385
386
  */
386
- output?: OutputSpecification<any, any>;
387
+ output?: OutputSpecification<OUTPUT, PARTIAL_OUTPUT>;
387
388
  /**
388
389
  * Default function that attempts to repair a tool call that failed to parse.
389
390
  *
@@ -1020,7 +1021,7 @@ interface WorkflowAgentStreamResult<TTools extends ToolSet = ToolSet, OUTPUT = n
1020
1021
  * });
1021
1022
  * ```
1022
1023
  */
1023
- declare class WorkflowAgent<TBaseTools extends ToolSet = ToolSet, TRuntimeContext extends Context = Context> {
1024
+ declare class WorkflowAgent<TBaseTools extends ToolSet = ToolSet, TRuntimeContext extends Context = Context, OUTPUT = any, PARTIAL_OUTPUT = any> {
1024
1025
  /**
1025
1026
  * The id of the agent.
1026
1027
  */
@@ -1052,9 +1053,9 @@ declare class WorkflowAgent<TBaseTools extends ToolSet = ToolSet, TRuntimeContex
1052
1053
  private constructorOnToolExecutionStart?;
1053
1054
  private constructorOnToolExecutionEnd?;
1054
1055
  private prepareCall?;
1055
- constructor(options: WorkflowAgentOptions<TBaseTools, TRuntimeContext>);
1056
+ constructor(options: WorkflowAgentOptions<TBaseTools, TRuntimeContext, OUTPUT, PARTIAL_OUTPUT>);
1056
1057
  generate(): void;
1057
- stream<TTools extends TBaseTools = TBaseTools, OUTPUT = never, PARTIAL_OUTPUT = never>(options: WorkflowAgentStreamOptions<TTools, TRuntimeContext, OUTPUT, PARTIAL_OUTPUT>): Promise<WorkflowAgentStreamResult<TTools, OUTPUT>>;
1058
+ stream<TTools extends TBaseTools = TBaseTools, TOutput = DefaultWorkflowAgentOutput<OUTPUT>, TPartialOutput = DefaultWorkflowAgentOutput<PARTIAL_OUTPUT>>(options: WorkflowAgentStreamOptions<TTools, TRuntimeContext, TOutput, TPartialOutput>): Promise<WorkflowAgentStreamResult<TTools, TOutput>>;
1058
1059
  }
1059
1060
 
1060
1061
  /**