@ai-sdk/workflow 1.0.30 → 1.0.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 +19 -0
- package/dist/index.js +20 -12
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/stream-text-iterator.ts +26 -15
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/workflow",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.32",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "WorkflowAgent for building AI agents with AI SDK",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"ajv": "^8.20.0",
|
|
30
30
|
"@ai-sdk/provider": "4.0.3",
|
|
31
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
32
|
-
"ai": "7.0.
|
|
31
|
+
"@ai-sdk/provider-utils": "5.0.11",
|
|
32
|
+
"ai": "7.0.32"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@types/node": "22.19.19",
|
|
@@ -2,6 +2,7 @@ import type {
|
|
|
2
2
|
LanguageModelV4CallOptions,
|
|
3
3
|
LanguageModelV4Prompt,
|
|
4
4
|
LanguageModelV4ToolResultPart,
|
|
5
|
+
SharedV4ProviderOptions,
|
|
5
6
|
} from '@ai-sdk/provider';
|
|
6
7
|
import type { Context } from '@ai-sdk/provider-utils';
|
|
7
8
|
import {
|
|
@@ -391,27 +392,37 @@ export async function* streamTextIterator({
|
|
|
391
392
|
if (finishReason === 'tool-calls') {
|
|
392
393
|
lastStepWasToolCalls = true;
|
|
393
394
|
|
|
394
|
-
|
|
395
|
+
const textContent = step.content.filter(
|
|
396
|
+
item => item.type === 'text',
|
|
397
|
+
) as Array<{ type: 'text'; text: string }>;
|
|
398
|
+
|
|
399
|
+
// Add assistant message with text and tool calls to the conversation
|
|
395
400
|
// Note: providerMetadata from the tool call is mapped to providerOptions
|
|
396
401
|
// in the prompt format, following the AI SDK convention. This is critical
|
|
397
402
|
// for providers like Gemini that require thoughtSignature to be preserved
|
|
398
403
|
// across multi-turn tool calls. Some fields are sanitized before mapping.
|
|
399
404
|
conversationPrompt.push({
|
|
400
405
|
role: 'assistant',
|
|
401
|
-
content:
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
406
|
+
content: [
|
|
407
|
+
...textContent,
|
|
408
|
+
...toolCalls.map(toolCall => {
|
|
409
|
+
const sanitizedMetadata = sanitizeProviderMetadataForToolCall(
|
|
410
|
+
toolCall.providerMetadata,
|
|
411
|
+
);
|
|
412
|
+
return {
|
|
413
|
+
type: 'tool-call' as const,
|
|
414
|
+
toolCallId: toolCall.toolCallId,
|
|
415
|
+
toolName: toolCall.toolName,
|
|
416
|
+
input: toolCall.input,
|
|
417
|
+
...(sanitizedMetadata != null
|
|
418
|
+
? {
|
|
419
|
+
providerOptions:
|
|
420
|
+
sanitizedMetadata as SharedV4ProviderOptions,
|
|
421
|
+
}
|
|
422
|
+
: {}),
|
|
423
|
+
};
|
|
424
|
+
}),
|
|
425
|
+
],
|
|
415
426
|
});
|
|
416
427
|
|
|
417
428
|
// Yield the tool calls along with the current conversation messages
|