@ai-sdk/workflow 2.0.7 → 2.0.9
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 +20 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
- package/src/normalize-ui-message-stream.ts +16 -16
- package/src/workflow-agent.ts +10 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @ai-sdk/workflow
|
|
2
2
|
|
|
3
|
+
## 2.0.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b251584: Preserve active text and reasoning parts when another merged UI message stream finishes a step, and align workflow stream normalization with the explicit part end chunks.
|
|
8
|
+
- Updated dependencies [b251584]
|
|
9
|
+
- Updated dependencies [591d25b]
|
|
10
|
+
- Updated dependencies [9de0baf]
|
|
11
|
+
- ai@7.0.79
|
|
12
|
+
- @ai-sdk/provider@4.0.8
|
|
13
|
+
- @ai-sdk/provider-utils@5.0.30
|
|
14
|
+
|
|
15
|
+
## 2.0.8
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- 96970bb: Continue approved `generateText`, `streamText`, and `WorkflowAgent` turns with a model-visible tool error when revalidated tool input is invalid.
|
|
20
|
+
- Updated dependencies [96970bb]
|
|
21
|
+
- ai@7.0.78
|
|
22
|
+
|
|
3
23
|
## 2.0.7
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1188,10 +1188,9 @@ declare class WorkflowChatTransport<UI_MESSAGE extends UIMessage> implements Cha
|
|
|
1188
1188
|
* whole turn. Two properties of the durable streaming model make that error
|
|
1189
1189
|
* reachable:
|
|
1190
1190
|
*
|
|
1191
|
-
* - A workflow run owns a single shared stream
|
|
1192
|
-
*
|
|
1193
|
-
*
|
|
1194
|
-
* `*-start` across a step boundary orphans the rest of that step's content.
|
|
1191
|
+
* - A workflow run owns a single shared stream. Multi-step turns can reuse the
|
|
1192
|
+
* same part id (commonly `"0"`), so a dropped or duplicated `*-start` can
|
|
1193
|
+
* orphan the rest of that part's content.
|
|
1195
1194
|
* - The same stream is read across reconnects, and a stream-producing step can
|
|
1196
1195
|
* run more than once (retry/redelivery, or the concurrent-worker duplication
|
|
1197
1196
|
* tracked in vercel/workflow#2331 and #2039). Either can interleave or
|
|
@@ -1204,11 +1203,12 @@ declare class WorkflowChatTransport<UI_MESSAGE extends UIMessage> implements Cha
|
|
|
1204
1203
|
*
|
|
1205
1204
|
* ## What it does
|
|
1206
1205
|
*
|
|
1207
|
-
* Mirrors the consumer's part-lifetime state machine
|
|
1208
|
-
* -
|
|
1206
|
+
* Mirrors the consumer's explicit-end part-lifetime state machine per part type:
|
|
1207
|
+
* - keeps open parts active across `finish-step`, while allowing ended ids to
|
|
1208
|
+
* be reused by a later step;
|
|
1209
1209
|
* - synthesizes a missing `*-start` when an orphaned `*-delta`/`*-end` arrives;
|
|
1210
1210
|
* - drops a re-delivered `*-start`/`*-delta`/`*-end` for a part already
|
|
1211
|
-
* open or ended
|
|
1211
|
+
* open or ended since the latest step boundary (reconnect/replay overlap).
|
|
1212
1212
|
*
|
|
1213
1213
|
* A well-formed stream passes through unchanged.
|
|
1214
1214
|
*
|
package/dist/index.js
CHANGED
|
@@ -979,7 +979,7 @@ var WorkflowAgent = class {
|
|
|
979
979
|
}
|
|
980
980
|
let revalidationReason;
|
|
981
981
|
try {
|
|
982
|
-
const { deniedToolApprovals: policyDenied } = await validateApprovedToolApprovals({
|
|
982
|
+
const { deniedToolApprovals: policyDenied, invalidToolApprovals } = await validateApprovedToolApprovals({
|
|
983
983
|
approvedToolApprovals: [approval.collected],
|
|
984
984
|
tools: this.tools,
|
|
985
985
|
toolApproval: void 0,
|
|
@@ -987,7 +987,11 @@ var WorkflowAgent = class {
|
|
|
987
987
|
toolsContext: effectiveToolsContext,
|
|
988
988
|
runtimeContext: effectiveRuntimeContext
|
|
989
989
|
});
|
|
990
|
-
if (
|
|
990
|
+
if (invalidToolApprovals.length > 0) {
|
|
991
|
+
revalidationReason = getErrorMessage(
|
|
992
|
+
invalidToolApprovals[0].error
|
|
993
|
+
);
|
|
994
|
+
} else if (policyDenied.length > 0) {
|
|
991
995
|
revalidationReason = (_n = policyDenied[0].approvalResponse.reason) != null ? _n : "Tool approval denied";
|
|
992
996
|
}
|
|
993
997
|
} catch (error) {
|
|
@@ -2346,9 +2350,7 @@ async function* normalizeUIMessageStreamParts(source) {
|
|
|
2346
2350
|
yield chunk;
|
|
2347
2351
|
break;
|
|
2348
2352
|
case "finish-step":
|
|
2349
|
-
text.open.clear();
|
|
2350
2353
|
text.ended.clear();
|
|
2351
|
-
reasoning.open.clear();
|
|
2352
2354
|
reasoning.ended.clear();
|
|
2353
2355
|
yield chunk;
|
|
2354
2356
|
break;
|