@ai-sdk/workflow 2.0.9 → 2.0.13
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 +37 -0
- package/README.md +25 -0
- package/dist/chunk-UAWBPTDW.js +51 -0
- package/dist/chunk-UAWBPTDW.js.map +1 -0
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/video.d.ts +24 -0
- package/dist/video.js +80 -0
- package/dist/video.js.map +1 -0
- package/package.json +8 -3
- package/src/generate-video.ts +120 -0
- package/src/serializable-schema.ts +12 -4
- package/src/test/serializable-video-model.ts +87 -0
- package/src/test/video-generation-workflow.ts +11 -0
- package/src/video.ts +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @ai-sdk/workflow
|
|
2
2
|
|
|
3
|
+
## 2.0.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [8dd86a9]
|
|
8
|
+
- Updated dependencies [fda13b3]
|
|
9
|
+
- Updated dependencies [957146c]
|
|
10
|
+
- Updated dependencies [ce6849a]
|
|
11
|
+
- ai@7.0.83
|
|
12
|
+
|
|
13
|
+
## 2.0.12
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies [3e125ba]
|
|
18
|
+
- ai@7.0.82
|
|
19
|
+
- @ai-sdk/provider-utils@5.0.32
|
|
20
|
+
|
|
21
|
+
## 2.0.11
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- aed8ff3: Add durable video generation that waits for a Workflow webhook and returns provider video data without downloading hosted URLs.
|
|
26
|
+
- ai@7.0.81
|
|
27
|
+
|
|
28
|
+
## 2.0.10
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- e21bde7: Preserve function tool input examples and provider options across workflow step boundaries.
|
|
33
|
+
- Updated dependencies [a9782e1]
|
|
34
|
+
- Updated dependencies [35841f5]
|
|
35
|
+
- Updated dependencies [d2f3353]
|
|
36
|
+
- Updated dependencies [eed7950]
|
|
37
|
+
- @ai-sdk/provider-utils@5.0.31
|
|
38
|
+
- ai@7.0.80
|
|
39
|
+
|
|
3
40
|
## 2.0.9
|
|
4
41
|
|
|
5
42
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -42,6 +42,30 @@ console.log('Final messages:', result.messages);
|
|
|
42
42
|
console.log('Steps:', result.steps);
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
+
### Durable video generation
|
|
46
|
+
|
|
47
|
+
`experimental_generateVideo` starts asynchronous video generation, suspends the
|
|
48
|
+
workflow until a provider webhook arrives, and returns the provider's video
|
|
49
|
+
data without downloading hosted URLs.
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { experimental_generateVideo as generateVideo } from '@ai-sdk/workflow/video';
|
|
53
|
+
|
|
54
|
+
export async function videoWorkflow(prompt: string) {
|
|
55
|
+
'use workflow';
|
|
56
|
+
|
|
57
|
+
const result = await generateVideo({
|
|
58
|
+
model: 'klingai/kling-v3.0-t2v',
|
|
59
|
+
prompt,
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
return result.videos;
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The workflow can persist, copy, or process each returned video URL in a
|
|
67
|
+
separate step without serializing the video bytes through the workflow.
|
|
68
|
+
|
|
45
69
|
## Features
|
|
46
70
|
|
|
47
71
|
- **Streaming Support**: Stream responses in real-time
|
|
@@ -52,6 +76,7 @@ console.log('Steps:', result.steps);
|
|
|
52
76
|
- **Step Callbacks**: Hook into each step of the agent loop
|
|
53
77
|
- **Provider-Executed Tools**: Support for provider-executed tools
|
|
54
78
|
- **Abort Support**: Cancel operations with AbortSignal
|
|
79
|
+
- **Durable Video Generation**: Suspend on video webhooks without polling or automatically downloading hosted videos
|
|
55
80
|
|
|
56
81
|
## API
|
|
57
82
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : /* @__PURE__ */ Symbol.for("Symbol." + name);
|
|
2
|
+
var __typeError = (msg) => {
|
|
3
|
+
throw TypeError(msg);
|
|
4
|
+
};
|
|
5
|
+
var __using = (stack, value, async) => {
|
|
6
|
+
if (value != null) {
|
|
7
|
+
if (typeof value !== "object" && typeof value !== "function") __typeError("Object expected");
|
|
8
|
+
var dispose, inner;
|
|
9
|
+
if (async) dispose = value[__knownSymbol("asyncDispose")];
|
|
10
|
+
if (dispose === void 0) {
|
|
11
|
+
dispose = value[__knownSymbol("dispose")];
|
|
12
|
+
if (async) inner = dispose;
|
|
13
|
+
}
|
|
14
|
+
if (typeof dispose !== "function") __typeError("Object not disposable");
|
|
15
|
+
if (inner) dispose = function() {
|
|
16
|
+
try {
|
|
17
|
+
inner.call(this);
|
|
18
|
+
} catch (e) {
|
|
19
|
+
return Promise.reject(e);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
stack.push([async, dispose, value]);
|
|
23
|
+
} else if (async) {
|
|
24
|
+
stack.push([async]);
|
|
25
|
+
}
|
|
26
|
+
return value;
|
|
27
|
+
};
|
|
28
|
+
var __callDispose = (stack, error, hasError) => {
|
|
29
|
+
var E = typeof SuppressedError === "function" ? SuppressedError : function(e, s, m, _) {
|
|
30
|
+
return _ = Error(m), _.name = "SuppressedError", _.error = e, _.suppressed = s, _;
|
|
31
|
+
};
|
|
32
|
+
var fail = (e) => error = hasError ? new E(e, error, "An error was suppressed during disposal") : (hasError = true, e);
|
|
33
|
+
var next = (it) => {
|
|
34
|
+
while (it = stack.pop()) {
|
|
35
|
+
try {
|
|
36
|
+
var result = it[1] && it[1].call(it[2]);
|
|
37
|
+
if (it[0]) return Promise.resolve(result).then(next, (e) => (fail(e), next()));
|
|
38
|
+
} catch (e) {
|
|
39
|
+
fail(e);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
if (hasError) throw error;
|
|
43
|
+
};
|
|
44
|
+
return next();
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export {
|
|
48
|
+
__using,
|
|
49
|
+
__callDispose
|
|
50
|
+
};
|
|
51
|
+
//# sourceMappingURL=chunk-UAWBPTDW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "./chunk-UAWBPTDW.js";
|
|
2
|
+
|
|
1
3
|
// src/workflow-agent.ts
|
|
2
4
|
import {
|
|
3
5
|
getErrorMessage,
|
|
@@ -102,7 +104,9 @@ function serializeToolSet(tools, {
|
|
|
102
104
|
toolsContext,
|
|
103
105
|
experimental_sandbox: sandbox
|
|
104
106
|
}),
|
|
105
|
-
inputSchema: asSchema(t.inputSchema).jsonSchema
|
|
107
|
+
inputSchema: asSchema(t.inputSchema).jsonSchema,
|
|
108
|
+
inputExamples: t.inputExamples,
|
|
109
|
+
providerOptions: t.providerOptions
|
|
106
110
|
};
|
|
107
111
|
if (t.type === "provider") {
|
|
108
112
|
def.type = "provider";
|
|
@@ -138,7 +142,8 @@ function resolveSerializableTools(tools) {
|
|
|
138
142
|
id: t.id,
|
|
139
143
|
args: (_a = t.args) != null ? _a : {},
|
|
140
144
|
isProviderExecuted: (_b = t.isProviderExecuted) != null ? _b : false,
|
|
141
|
-
inputSchema: jsonSchema(t.inputSchema)
|
|
145
|
+
inputSchema: jsonSchema(t.inputSchema),
|
|
146
|
+
providerOptions: t.providerOptions
|
|
142
147
|
})
|
|
143
148
|
];
|
|
144
149
|
}
|
|
@@ -147,6 +152,8 @@ function resolveSerializableTools(tools) {
|
|
|
147
152
|
name,
|
|
148
153
|
tool({
|
|
149
154
|
description: t.description,
|
|
155
|
+
inputExamples: t.inputExamples,
|
|
156
|
+
providerOptions: t.providerOptions,
|
|
150
157
|
inputSchema: jsonSchema(t.inputSchema, {
|
|
151
158
|
validate: (value) => {
|
|
152
159
|
if (validateFn(value)) {
|