@vertesia/workflow 0.80.0-dev.20251121 → 0.80.0
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/README.md +55 -14
- package/lib/cjs/activities/executeInteraction.js +22 -18
- package/lib/cjs/activities/executeInteraction.js.map +1 -1
- package/lib/cjs/dsl/setup/ActivityContext.js +0 -1
- package/lib/cjs/dsl/setup/ActivityContext.js.map +1 -1
- package/lib/cjs/utils/storage.js +0 -1
- package/lib/cjs/utils/storage.js.map +1 -1
- package/lib/esm/activities/executeInteraction.js +20 -16
- package/lib/esm/activities/executeInteraction.js.map +1 -1
- package/lib/esm/dsl/setup/ActivityContext.js +0 -1
- package/lib/esm/dsl/setup/ActivityContext.js.map +1 -1
- package/lib/esm/utils/storage.js +0 -1
- package/lib/esm/utils/storage.js.map +1 -1
- package/lib/types/activities/executeInteraction.d.ts.map +1 -1
- package/lib/types/dsl/setup/ActivityContext.d.ts.map +1 -1
- package/lib/types/utils/storage.d.ts.map +1 -1
- package/lib/workflows-bundle.js +12277 -12230
- package/package.json +16 -6
- package/src/activities/executeInteraction.ts +29 -24
- package/src/dsl/setup/ActivityContext.ts +0 -2
- package/src/utils/storage.ts +0 -1
- package/lib/tsconfig.tsbuildinfo +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vertesia/workflow",
|
|
3
|
-
"version": "0.80.0
|
|
3
|
+
"version": "0.80.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Vertesia workflow DSL",
|
|
6
6
|
"main": "./lib/esm/index.js",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"tmp": "^0.2.4",
|
|
45
45
|
"tmp-promise": "^3.0.3",
|
|
46
46
|
"yaml": "^2.6.0",
|
|
47
|
-
"@
|
|
48
|
-
"@vertesia/
|
|
49
|
-
"@vertesia/
|
|
50
|
-
"@vertesia/client": "0.80.0
|
|
51
|
-
"@
|
|
47
|
+
"@llumiverse/common": "0.23.0",
|
|
48
|
+
"@vertesia/common": "0.80.0",
|
|
49
|
+
"@vertesia/client": "0.80.0",
|
|
50
|
+
"@vertesia/api-fetch-client": "0.80.0",
|
|
51
|
+
"@vertesia/memory": "0.80.0"
|
|
52
52
|
},
|
|
53
53
|
"ts_dual_module": {
|
|
54
54
|
"outDir": "lib",
|
|
@@ -105,6 +105,16 @@
|
|
|
105
105
|
"url": "https://github.com/vertesia/composableai.git",
|
|
106
106
|
"directory": "packages/workflow"
|
|
107
107
|
},
|
|
108
|
+
"keywords": [
|
|
109
|
+
"vertesia",
|
|
110
|
+
"workflow",
|
|
111
|
+
"dsl",
|
|
112
|
+
"temporalio",
|
|
113
|
+
"llm",
|
|
114
|
+
"ai",
|
|
115
|
+
"agents",
|
|
116
|
+
"typescript"
|
|
117
|
+
],
|
|
108
118
|
"types": "./lib/types/index.d.ts",
|
|
109
119
|
"typesVersions": {
|
|
110
120
|
"*": {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CompletionResult,
|
|
1
|
+
import { CompletionResult, ModelOptions } from "@llumiverse/common";
|
|
2
2
|
import { activityInfo, log } from "@temporalio/activity";
|
|
3
3
|
import { VertesiaClient } from "@vertesia/client";
|
|
4
4
|
import { NodeStreamSource } from "@vertesia/client/node";
|
|
@@ -159,32 +159,37 @@ export async function executeInteraction(payload: DSLActivityExecutionPayload<Ex
|
|
|
159
159
|
let completionResult: CompletionResult[] = res.result;
|
|
160
160
|
|
|
161
161
|
// Handle image uploads if the result contains base64 images
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
const imageResults = completionResult.filter(r => r.type === "image");
|
|
163
|
+
if (imageResults.length > 0) {
|
|
164
164
|
const uploadedImages = await Promise.all(
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
165
|
+
completionResult.map(async (item, index) => {
|
|
166
|
+
if (item.type === "image") {
|
|
167
|
+
const image = item.value;
|
|
168
|
+
// Extract base64 data and create buffer
|
|
169
|
+
const base64Data = image.replace(/^data:image\/[a-z]+;base64,/, "");
|
|
170
|
+
const buffer = Buffer.from(base64Data, 'base64');
|
|
171
|
+
|
|
172
|
+
// Generate filename
|
|
173
|
+
const { runId } = activityInfo().workflowExecution;
|
|
174
|
+
const { activityId } = activityInfo();
|
|
175
|
+
const filename = `generated-image-${runId}-${activityId}-${index}.png`;
|
|
176
|
+
|
|
177
|
+
// Create a readable stream from the buffer
|
|
178
|
+
const stream = Readable.from(buffer);
|
|
179
|
+
|
|
180
|
+
const source = new NodeStreamSource(
|
|
181
|
+
stream,
|
|
182
|
+
filename,
|
|
183
|
+
"image/png",
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
const file = await client.files.uploadFile(source);
|
|
187
|
+
return { type: "image", value: file } as CompletionResult;
|
|
188
|
+
}
|
|
189
|
+
return item;
|
|
185
190
|
})
|
|
186
191
|
);
|
|
187
|
-
completionResult = uploadedImages
|
|
192
|
+
completionResult = uploadedImages;
|
|
188
193
|
}
|
|
189
194
|
|
|
190
195
|
return projectResult(payload, params, res, {
|
|
@@ -166,8 +166,6 @@ export async function setupActivity<ParamsT extends Record<string, any>>(
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
const params = vars.resolve() as ParamsT;
|
|
169
|
-
log.info(`Activity ${payload.activity.name} setup complete`);
|
|
170
|
-
|
|
171
169
|
return new ActivityContext<ParamsT>(payload, client, params);
|
|
172
170
|
}
|
|
173
171
|
|
package/src/utils/storage.ts
CHANGED
|
@@ -34,7 +34,6 @@ export async function saveAgentArtifact(
|
|
|
34
34
|
|
|
35
35
|
//create the file path and append extension if needed
|
|
36
36
|
const filePath = agentStoragePath(runId) + "/" + name + (ext && !name.endsWith(ext) ? "." + ext : "");
|
|
37
|
-
log.info(`Storing agent artifact ${filePath} for run ${runId}`);
|
|
38
37
|
|
|
39
38
|
try {
|
|
40
39
|
const source = new NodeStreamSource(fileContent, `${runId}-${basename(filePath)}`, mimeType, filePath);
|