@ai-sdk/workflow 2.0.19 → 2.0.20
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 +6 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/workflow-agent.ts +16 -10
package/package.json
CHANGED
package/src/workflow-agent.ts
CHANGED
|
@@ -49,7 +49,10 @@ import {
|
|
|
49
49
|
verifyToolApprovalSignature,
|
|
50
50
|
} from 'ai/internal';
|
|
51
51
|
import { createLanguageModelToolResultOutput } from './create-language-model-tool-result-output.js';
|
|
52
|
-
import type {
|
|
52
|
+
import type {
|
|
53
|
+
ModelCallStreamPart,
|
|
54
|
+
ModelStopCondition,
|
|
55
|
+
} from './do-stream-step.js';
|
|
53
56
|
import { streamTextIterator } from './stream-text-iterator.js';
|
|
54
57
|
|
|
55
58
|
// Re-export for consumers
|
|
@@ -401,8 +404,8 @@ export interface PrepareCallOptions<
|
|
|
401
404
|
instructions?: Instructions;
|
|
402
405
|
toolChoice?: ToolChoice<TTools>;
|
|
403
406
|
stopWhen?:
|
|
404
|
-
| StopCondition<NoInfer<
|
|
405
|
-
| Array<StopCondition<NoInfer<
|
|
407
|
+
| StopCondition<NoInfer<TTools>, TRuntimeContext>
|
|
408
|
+
| Array<StopCondition<NoInfer<TTools>, TRuntimeContext>>;
|
|
406
409
|
activeTools?: ActiveTools<NoInfer<TTools>>;
|
|
407
410
|
experimental_download?: DownloadFunction;
|
|
408
411
|
telemetry?: TelemetryOptions<TRuntimeContext, TTools>;
|
|
@@ -513,8 +516,8 @@ export type WorkflowAgentOptions<
|
|
|
513
516
|
* Per-stream `stopWhen` values passed to `stream()` override this default.
|
|
514
517
|
*/
|
|
515
518
|
stopWhen?:
|
|
516
|
-
| StopCondition<NoInfer<
|
|
517
|
-
| Array<StopCondition<NoInfer<
|
|
519
|
+
| StopCondition<NoInfer<TTools>, TRuntimeContext>
|
|
520
|
+
| Array<StopCondition<NoInfer<TTools>, TRuntimeContext>>;
|
|
518
521
|
|
|
519
522
|
/**
|
|
520
523
|
* Default set of active tools that limits which tools the model can call,
|
|
@@ -937,8 +940,8 @@ export type WorkflowAgentStreamOptions<
|
|
|
937
940
|
* When the condition is an array, any of the conditions can be met to stop the generation.
|
|
938
941
|
*/
|
|
939
942
|
stopWhen?:
|
|
940
|
-
| StopCondition<NoInfer<
|
|
941
|
-
| Array<StopCondition<NoInfer<
|
|
943
|
+
| StopCondition<NoInfer<TTools>, TRuntimeContext>
|
|
944
|
+
| Array<StopCondition<NoInfer<TTools>, TRuntimeContext>>;
|
|
942
945
|
|
|
943
946
|
/**
|
|
944
947
|
* The tool choice strategy. Default: 'auto'.
|
|
@@ -1331,8 +1334,8 @@ export class WorkflowAgent<
|
|
|
1331
1334
|
private runtimeContext?: TRuntimeContext;
|
|
1332
1335
|
private toolsContext?: InferToolSetContext<TBaseTools>;
|
|
1333
1336
|
private stopWhen?:
|
|
1334
|
-
| StopCondition<
|
|
1335
|
-
| Array<StopCondition<
|
|
1337
|
+
| StopCondition<TBaseTools, TRuntimeContext>
|
|
1338
|
+
| Array<StopCondition<TBaseTools, TRuntimeContext>>;
|
|
1336
1339
|
private activeTools?: ActiveTools<TBaseTools>;
|
|
1337
1340
|
private output?: OutputSpecification<any, any>;
|
|
1338
1341
|
private repairToolCall?: ToolCallRepairFunction<TBaseTools>;
|
|
@@ -2160,7 +2163,10 @@ export class WorkflowAgent<
|
|
|
2160
2163
|
prompt: modelPrompt,
|
|
2161
2164
|
initialInstructions: effectiveInstructions,
|
|
2162
2165
|
initialMessages: prompt.messages,
|
|
2163
|
-
stopConditions: effectiveStopWhenFromPrepare
|
|
2166
|
+
stopConditions: effectiveStopWhenFromPrepare as
|
|
2167
|
+
| ModelStopCondition
|
|
2168
|
+
| ModelStopCondition[]
|
|
2169
|
+
| undefined,
|
|
2164
2170
|
onStepEnd: mergedOnStepEnd as any,
|
|
2165
2171
|
onStepStart: mergedOnStepStart as any,
|
|
2166
2172
|
prepareStep: (options.prepareStep ??
|