@ai-sdk/workflow 2.0.32 → 2.0.34
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 +29 -0
- package/dist/chunk-FJHDNS6E.js +362 -0
- package/dist/chunk-FJHDNS6E.js.map +1 -0
- package/dist/client.d.ts +160 -0
- package/dist/client.js +8 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +3 -159
- package/dist/index.js +15 -360
- package/dist/index.js.map +1 -1
- package/package.json +9 -4
- package/src/client.ts +6 -0
- package/src/workflow-agent.ts +14 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/workflow",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.34",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "WorkflowAgent for building AI agents with AI SDK",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
"import": "./dist/index.js",
|
|
25
25
|
"default": "./dist/index.js"
|
|
26
26
|
},
|
|
27
|
+
"./client": {
|
|
28
|
+
"types": "./dist/client.d.ts",
|
|
29
|
+
"import": "./dist/client.js",
|
|
30
|
+
"default": "./dist/client.js"
|
|
31
|
+
},
|
|
27
32
|
"./video": {
|
|
28
33
|
"types": "./dist/video.d.ts",
|
|
29
34
|
"import": "./dist/video.js",
|
|
@@ -31,9 +36,9 @@
|
|
|
31
36
|
}
|
|
32
37
|
},
|
|
33
38
|
"dependencies": {
|
|
34
|
-
"@ai-sdk/provider": "4.0.
|
|
35
|
-
"@ai-sdk/provider-utils": "5.0.
|
|
36
|
-
"ai": "7.0.
|
|
39
|
+
"@ai-sdk/provider": "4.0.16",
|
|
40
|
+
"@ai-sdk/provider-utils": "5.0.42",
|
|
41
|
+
"ai": "7.0.103",
|
|
37
42
|
"ajv": "^8.20.0"
|
|
38
43
|
},
|
|
39
44
|
"devDependencies": {
|
package/src/client.ts
ADDED
package/src/workflow-agent.ts
CHANGED
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
validateApprovedToolApprovals,
|
|
51
51
|
verifyToolApprovalSignature,
|
|
52
52
|
} from 'ai/internal';
|
|
53
|
+
import { getWorkflowMetadata } from 'workflow';
|
|
53
54
|
import { addToolResultsToConversation } from './add-tool-results-to-conversation.js';
|
|
54
55
|
import { createLanguageModelToolResultOutput } from './create-language-model-tool-result-output.js';
|
|
55
56
|
import type {
|
|
@@ -1697,9 +1698,12 @@ export class WorkflowAgent<
|
|
|
1697
1698
|
} as Prompt);
|
|
1698
1699
|
const download = effectiveDownloadFromPrepare;
|
|
1699
1700
|
const sandbox = options.experimental_sandbox ?? this.experimentalSandbox;
|
|
1701
|
+
// Model steps enforce the absolute deadline below. Avoid creating a native
|
|
1702
|
+
// timeout signal in the workflow VM, where timer APIs are unavailable.
|
|
1703
|
+
const abortSignalTimeout = isInWorkflow() ? undefined : options.timeout;
|
|
1700
1704
|
const effectiveAbortSignal = mergeAbortSignals(
|
|
1701
1705
|
options.abortSignal ?? effectiveGenerationSettings.abortSignal,
|
|
1702
|
-
|
|
1706
|
+
abortSignalTimeout,
|
|
1703
1707
|
);
|
|
1704
1708
|
const timeoutAt =
|
|
1705
1709
|
options.timeout == null ? undefined : Date.now() + options.timeout;
|
|
@@ -3190,6 +3194,15 @@ async function writeApprovalToolResults(
|
|
|
3190
3194
|
}
|
|
3191
3195
|
}
|
|
3192
3196
|
|
|
3197
|
+
function isInWorkflow(): boolean {
|
|
3198
|
+
try {
|
|
3199
|
+
getWorkflowMetadata();
|
|
3200
|
+
return true;
|
|
3201
|
+
} catch {
|
|
3202
|
+
return false;
|
|
3203
|
+
}
|
|
3204
|
+
}
|
|
3205
|
+
|
|
3193
3206
|
function aggregateUsage(steps: StepResult<any, any>[]): LanguageModelUsage {
|
|
3194
3207
|
let inputTokens = 0;
|
|
3195
3208
|
let outputTokens = 0;
|