@ai-sdk/workflow 2.0.72 → 2.0.73
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 +11 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +157 -24
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/build-model-step-result.ts +6 -1
- package/src/do-generate-step.ts +15 -1
- package/src/do-stream-step.ts +28 -2
- package/src/model-call-iterator.ts +219 -4
- package/src/model-call-telemetry.ts +3 -3
- package/src/model-call.ts +14 -0
- package/src/serializable-schema.ts +18 -6
- package/src/test/telemetry-workflows.ts +30 -4
- package/src/to-ui-message-chunk.ts +3 -0
- package/src/workflow-agent.ts +17 -2
package/src/workflow-agent.ts
CHANGED
|
@@ -2843,6 +2843,8 @@ export class WorkflowAgent<
|
|
|
2843
2843
|
);
|
|
2844
2844
|
const approvalRequests = await Promise.all(
|
|
2845
2845
|
approvalToolCalls.map(async tc => {
|
|
2846
|
+
const { inputSchemaInput, ...toolCallWithoutInputSchemaInput } =
|
|
2847
|
+
tc;
|
|
2846
2848
|
const approvalId = `approval-${tc.toolCallId}`;
|
|
2847
2849
|
const signature =
|
|
2848
2850
|
effectiveToolApprovalSecret == null
|
|
@@ -2857,15 +2859,23 @@ export class WorkflowAgent<
|
|
|
2857
2859
|
return {
|
|
2858
2860
|
type: 'tool-approval-request' as const,
|
|
2859
2861
|
approvalId,
|
|
2862
|
+
...(inputSchemaInput !== undefined
|
|
2863
|
+
? { inputSchemaInput }
|
|
2864
|
+
: {}),
|
|
2860
2865
|
toolCall: {
|
|
2861
|
-
...
|
|
2866
|
+
...toolCallWithoutInputSchemaInput,
|
|
2862
2867
|
type: 'tool-call' as const,
|
|
2863
2868
|
} as StepResult<ToolSet>['toolCalls'][number],
|
|
2864
2869
|
...(signature != null ? { signature } : {}),
|
|
2865
2870
|
};
|
|
2866
2871
|
}),
|
|
2867
2872
|
);
|
|
2868
|
-
step?.content.push(
|
|
2873
|
+
step?.content.push(
|
|
2874
|
+
...approvalRequests.map(
|
|
2875
|
+
({ inputSchemaInput: _inputSchemaInput, ...request }) =>
|
|
2876
|
+
request,
|
|
2877
|
+
),
|
|
2878
|
+
);
|
|
2869
2879
|
const approvalMessages = approvalRequests.map(
|
|
2870
2880
|
({ toolCall, ...request }) => ({
|
|
2871
2881
|
...request,
|
|
@@ -3313,6 +3323,7 @@ async function writeApprovalRequests(
|
|
|
3313
3323
|
approvalId: string;
|
|
3314
3324
|
toolCallId: string;
|
|
3315
3325
|
signature?: string;
|
|
3326
|
+
inputSchemaInput?: unknown;
|
|
3316
3327
|
}>,
|
|
3317
3328
|
) {
|
|
3318
3329
|
'use step';
|
|
@@ -3324,6 +3335,9 @@ async function writeApprovalRequests(
|
|
|
3324
3335
|
approvalId: request.approvalId,
|
|
3325
3336
|
toolCallId: request.toolCallId,
|
|
3326
3337
|
...(request.signature != null ? { signature: request.signature } : {}),
|
|
3338
|
+
...(request.inputSchemaInput !== undefined
|
|
3339
|
+
? { inputSchemaInput: request.inputSchemaInput }
|
|
3340
|
+
: {}),
|
|
3327
3341
|
});
|
|
3328
3342
|
}
|
|
3329
3343
|
} finally {
|
|
@@ -3736,6 +3750,7 @@ function addApprovalRequestsToMessages(
|
|
|
3736
3750
|
approvalId: string;
|
|
3737
3751
|
toolCallId: string;
|
|
3738
3752
|
signature?: string;
|
|
3753
|
+
inputSchemaInput?: unknown;
|
|
3739
3754
|
}>,
|
|
3740
3755
|
): ModelMessage[] {
|
|
3741
3756
|
if (requests.length === 0) return messages;
|