@xyne/workflow-sdk 3.2.51 → 3.2.53
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/dist/agents/agent-step.d.ts +2 -2
- package/dist/agents/contract.d.ts +2 -2
- package/dist/agents/host-agent-step.d.ts +3 -3
- package/dist/connectors/builtin/steps/code.step.d.ts +64 -0
- package/dist/connectors/builtin/steps/code.step.d.ts.map +1 -1
- package/dist/connectors/builtin/steps/code.step.js +55 -4
- package/dist/connectors/builtin/steps/code.step.js.map +1 -1
- package/package.json +1 -1
|
@@ -209,13 +209,13 @@ export declare class AgentStep extends BaseActionStep<typeof AgentStepConfigSche
|
|
|
209
209
|
inputTokens: number;
|
|
210
210
|
outputTokens: number;
|
|
211
211
|
};
|
|
212
|
-
response: string | Record<string, unknown>;
|
|
213
212
|
attachments: {
|
|
214
213
|
name: string;
|
|
215
214
|
mimeType: string;
|
|
216
215
|
data: string;
|
|
217
216
|
size?: number | undefined;
|
|
218
217
|
}[];
|
|
218
|
+
response: string | Record<string, unknown>;
|
|
219
219
|
toolCalls: {
|
|
220
220
|
name: string;
|
|
221
221
|
args: Record<string, unknown>;
|
|
@@ -228,13 +228,13 @@ export declare class AgentStep extends BaseActionStep<typeof AgentStepConfigSche
|
|
|
228
228
|
inputTokens: number;
|
|
229
229
|
outputTokens: number;
|
|
230
230
|
};
|
|
231
|
-
response: string | Record<string, unknown>;
|
|
232
231
|
attachments: {
|
|
233
232
|
name: string;
|
|
234
233
|
mimeType: string;
|
|
235
234
|
data: string;
|
|
236
235
|
size?: number | undefined;
|
|
237
236
|
}[];
|
|
237
|
+
response: string | Record<string, unknown>;
|
|
238
238
|
toolCalls: {
|
|
239
239
|
name: string;
|
|
240
240
|
args: Record<string, unknown>;
|
|
@@ -138,13 +138,13 @@ export declare const AgentResultSchema: z.ZodObject<{
|
|
|
138
138
|
inputTokens: number;
|
|
139
139
|
outputTokens: number;
|
|
140
140
|
};
|
|
141
|
-
response: string | Record<string, unknown>;
|
|
142
141
|
attachments: {
|
|
143
142
|
name: string;
|
|
144
143
|
mimeType: string;
|
|
145
144
|
data: string;
|
|
146
145
|
size?: number | undefined;
|
|
147
146
|
}[];
|
|
147
|
+
response: string | Record<string, unknown>;
|
|
148
148
|
toolCalls: {
|
|
149
149
|
name: string;
|
|
150
150
|
args: Record<string, unknown>;
|
|
@@ -157,13 +157,13 @@ export declare const AgentResultSchema: z.ZodObject<{
|
|
|
157
157
|
inputTokens: number;
|
|
158
158
|
outputTokens: number;
|
|
159
159
|
};
|
|
160
|
-
response: string | Record<string, unknown>;
|
|
161
160
|
attachments: {
|
|
162
161
|
name: string;
|
|
163
162
|
mimeType: string;
|
|
164
163
|
data: string;
|
|
165
164
|
size?: number | undefined;
|
|
166
165
|
}[];
|
|
166
|
+
response: string | Record<string, unknown>;
|
|
167
167
|
toolCalls: {
|
|
168
168
|
name: string;
|
|
169
169
|
args: Record<string, unknown>;
|
|
@@ -83,13 +83,13 @@ declare const HostAgentBaseSchema: z.ZodObject<{
|
|
|
83
83
|
task: string;
|
|
84
84
|
outputSchema?: string | Record<string, unknown> | undefined;
|
|
85
85
|
timeoutMs?: number | undefined;
|
|
86
|
-
mode?: "sync" | "async" | undefined;
|
|
87
86
|
attachments?: string | {
|
|
88
87
|
name: string;
|
|
89
88
|
mimeType: string;
|
|
90
89
|
data: string;
|
|
91
90
|
size?: number | undefined;
|
|
92
91
|
}[] | undefined;
|
|
92
|
+
mode?: "sync" | "async" | undefined;
|
|
93
93
|
waitForReply?: boolean | undefined;
|
|
94
94
|
outputType?: "string" | "json" | undefined;
|
|
95
95
|
cite?: boolean | undefined;
|
|
@@ -170,13 +170,13 @@ export declare class HostAgentStep<TProviderConfig extends z.AnyZodObject = z.An
|
|
|
170
170
|
inputTokens: number;
|
|
171
171
|
outputTokens: number;
|
|
172
172
|
};
|
|
173
|
-
response: string | Record<string, unknown>;
|
|
174
173
|
attachments: {
|
|
175
174
|
name: string;
|
|
176
175
|
mimeType: string;
|
|
177
176
|
data: string;
|
|
178
177
|
size?: number | undefined;
|
|
179
178
|
}[];
|
|
179
|
+
response: string | Record<string, unknown>;
|
|
180
180
|
toolCalls: {
|
|
181
181
|
name: string;
|
|
182
182
|
args: Record<string, unknown>;
|
|
@@ -189,13 +189,13 @@ export declare class HostAgentStep<TProviderConfig extends z.AnyZodObject = z.An
|
|
|
189
189
|
inputTokens: number;
|
|
190
190
|
outputTokens: number;
|
|
191
191
|
};
|
|
192
|
-
response: string | Record<string, unknown>;
|
|
193
192
|
attachments: {
|
|
194
193
|
name: string;
|
|
195
194
|
mimeType: string;
|
|
196
195
|
data: string;
|
|
197
196
|
size?: number | undefined;
|
|
198
197
|
}[];
|
|
198
|
+
response: string | Record<string, unknown>;
|
|
199
199
|
toolCalls: {
|
|
200
200
|
name: string;
|
|
201
201
|
args: Record<string, unknown>;
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
import { z } from 'zod';
|
|
18
18
|
import { BaseActionStep } from '../../../steps/base-step.js';
|
|
19
19
|
import type { StepExecutionContext } from '../../../steps/base-step.js';
|
|
20
|
+
import type { Attachment } from '../../../common/attachment.js';
|
|
20
21
|
import { BuiltinStepType } from '../../../types/known-types.js';
|
|
21
22
|
import type { StepCategory } from '../../../types/categories.js';
|
|
22
23
|
export declare const CodeStepConfigSchema: z.ZodObject<{
|
|
@@ -32,13 +33,37 @@ export declare const CodeStepConfigSchema: z.ZodObject<{
|
|
|
32
33
|
type: "string" | "number" | "boolean" | "object" | "array";
|
|
33
34
|
name: string;
|
|
34
35
|
}>, "many">>;
|
|
36
|
+
attachments: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodObject<{
|
|
37
|
+
name: z.ZodString;
|
|
38
|
+
mimeType: z.ZodString;
|
|
39
|
+
data: z.ZodString;
|
|
40
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
name: string;
|
|
43
|
+
mimeType: string;
|
|
44
|
+
data: string;
|
|
45
|
+
size?: number | undefined;
|
|
46
|
+
}, {
|
|
47
|
+
name: string;
|
|
48
|
+
mimeType: string;
|
|
49
|
+
data: string;
|
|
50
|
+
size?: number | undefined;
|
|
51
|
+
}>, "many">, z.ZodString]>>;
|
|
52
|
+
collectOutputFiles: z.ZodDefault<z.ZodBoolean>;
|
|
35
53
|
}, "strip", z.ZodTypeAny, {
|
|
36
54
|
code: string;
|
|
37
55
|
timeoutMs: number;
|
|
56
|
+
collectOutputFiles: boolean;
|
|
38
57
|
outputFields?: {
|
|
39
58
|
type: "string" | "number" | "boolean" | "object" | "array";
|
|
40
59
|
name: string;
|
|
41
60
|
}[] | undefined;
|
|
61
|
+
attachments?: string | {
|
|
62
|
+
name: string;
|
|
63
|
+
mimeType: string;
|
|
64
|
+
data: string;
|
|
65
|
+
size?: number | undefined;
|
|
66
|
+
}[] | undefined;
|
|
42
67
|
}, {
|
|
43
68
|
code: string;
|
|
44
69
|
timeoutMs?: number | undefined;
|
|
@@ -46,10 +71,18 @@ export declare const CodeStepConfigSchema: z.ZodObject<{
|
|
|
46
71
|
type: "string" | "number" | "boolean" | "object" | "array";
|
|
47
72
|
name: string;
|
|
48
73
|
}[] | undefined;
|
|
74
|
+
attachments?: string | {
|
|
75
|
+
name: string;
|
|
76
|
+
mimeType: string;
|
|
77
|
+
data: string;
|
|
78
|
+
size?: number | undefined;
|
|
79
|
+
}[] | undefined;
|
|
80
|
+
collectOutputFiles?: boolean | undefined;
|
|
49
81
|
}>;
|
|
50
82
|
export type CodeStepConfig = z.infer<typeof CodeStepConfigSchema>;
|
|
51
83
|
export interface CodeStepOutput extends Record<string, unknown> {
|
|
52
84
|
result: unknown;
|
|
85
|
+
files?: Attachment[];
|
|
53
86
|
}
|
|
54
87
|
export declare class CodeStep extends BaseActionStep<typeof CodeStepConfigSchema, CodeStepOutput> {
|
|
55
88
|
readonly type = BuiltinStepType.CODE;
|
|
@@ -68,13 +101,37 @@ export declare class CodeStep extends BaseActionStep<typeof CodeStepConfigSchema
|
|
|
68
101
|
type: "string" | "number" | "boolean" | "object" | "array";
|
|
69
102
|
name: string;
|
|
70
103
|
}>, "many">>;
|
|
104
|
+
attachments: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodObject<{
|
|
105
|
+
name: z.ZodString;
|
|
106
|
+
mimeType: z.ZodString;
|
|
107
|
+
data: z.ZodString;
|
|
108
|
+
size: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
}, "strip", z.ZodTypeAny, {
|
|
110
|
+
name: string;
|
|
111
|
+
mimeType: string;
|
|
112
|
+
data: string;
|
|
113
|
+
size?: number | undefined;
|
|
114
|
+
}, {
|
|
115
|
+
name: string;
|
|
116
|
+
mimeType: string;
|
|
117
|
+
data: string;
|
|
118
|
+
size?: number | undefined;
|
|
119
|
+
}>, "many">, z.ZodString]>>;
|
|
120
|
+
collectOutputFiles: z.ZodDefault<z.ZodBoolean>;
|
|
71
121
|
}, "strip", z.ZodTypeAny, {
|
|
72
122
|
code: string;
|
|
73
123
|
timeoutMs: number;
|
|
124
|
+
collectOutputFiles: boolean;
|
|
74
125
|
outputFields?: {
|
|
75
126
|
type: "string" | "number" | "boolean" | "object" | "array";
|
|
76
127
|
name: string;
|
|
77
128
|
}[] | undefined;
|
|
129
|
+
attachments?: string | {
|
|
130
|
+
name: string;
|
|
131
|
+
mimeType: string;
|
|
132
|
+
data: string;
|
|
133
|
+
size?: number | undefined;
|
|
134
|
+
}[] | undefined;
|
|
78
135
|
}, {
|
|
79
136
|
code: string;
|
|
80
137
|
timeoutMs?: number | undefined;
|
|
@@ -82,6 +139,13 @@ export declare class CodeStep extends BaseActionStep<typeof CodeStepConfigSchema
|
|
|
82
139
|
type: "string" | "number" | "boolean" | "object" | "array";
|
|
83
140
|
name: string;
|
|
84
141
|
}[] | undefined;
|
|
142
|
+
attachments?: string | {
|
|
143
|
+
name: string;
|
|
144
|
+
mimeType: string;
|
|
145
|
+
data: string;
|
|
146
|
+
size?: number | undefined;
|
|
147
|
+
}[] | undefined;
|
|
148
|
+
collectOutputFiles?: boolean | undefined;
|
|
85
149
|
}>;
|
|
86
150
|
readonly outputSchema: z.ZodObject<{
|
|
87
151
|
result: z.ZodUnknown;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.step.d.ts","sourceRoot":"","sources":["../../../../src/connectors/builtin/steps/code.step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGxE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AASjE,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"code.step.d.ts","sourceRoot":"","sources":["../../../../src/connectors/builtin/steps/code.step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGxE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAGhE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AASjE,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAS/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAIlE,MAAM,WAAW,cAAe,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC7D,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;CACtB;AAiFD,qBAAa,QAAS,SAAQ,cAAc,CAC1C,OAAO,oBAAoB,EAC3B,cAAc,CACf;IACC,SAAkB,IAAI,wBAAwB;IAC9C,SAAkB,IAAI,UAAU;IAChC,SAAkB,WAAW,uCAAuC;IACpE,SAAkB,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAwB;IACtD,SAAkB,YAAY;;;;;;OAAwB;IACtD,SAAkB,QAAQ,EAAE,YAAY,CAAU;IAClD,SAAkB,IAAI,UAAU;IAEvB,oBAAoB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAYlF,uBAAuB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAqB3E,OAAO,CACpB,MAAM,EAAE,cAAc,EACtB,GAAG,EAAE,oBAAoB,GACxB,OAAO,CAAC,cAAc,CAAC;CAmG3B"}
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
import { z } from 'zod';
|
|
18
18
|
import { BaseActionStep } from '../../../steps/base-step.js';
|
|
19
19
|
import { bindSandboxSession } from '../../../sandbox/types.js';
|
|
20
|
+
import { ATTACHMENT_ARRAY_JSON_SCHEMA, AttachmentSchema, markAttachmentFields } from '../../../common/attachment.js';
|
|
21
|
+
import { variableRef } from '../../../types/workflow-config.js';
|
|
20
22
|
import { BuiltinStepType } from '../../../types/known-types.js';
|
|
21
23
|
// ─── Config ───
|
|
22
24
|
const OutputFieldSchema = z.object({
|
|
@@ -27,10 +29,30 @@ export const CodeStepConfigSchema = z.object({
|
|
|
27
29
|
code: z.string().min(1).describe('JavaScript code to execute. Must return a value. Has access to $input (previous step output) and $context (workflow context)'),
|
|
28
30
|
timeoutMs: z.number().int().positive().default(5000).describe('Maximum execution time in milliseconds'),
|
|
29
31
|
outputFields: z.array(OutputFieldSchema).optional().describe('Declared output fields — describes the shape of the return value for downstream steps'),
|
|
32
|
+
attachments: variableRef(z.array(AttachmentSchema).describe('Documents mounted into the sandbox at /mnt/files, readable from code via $files. Bind to a ref, e.g. {{trigger.contract}}')).optional(),
|
|
33
|
+
collectOutputFiles: z.boolean().default(false)
|
|
34
|
+
.describe('Store files written to /mnt/output as workflow documents, exposed as `files`'),
|
|
30
35
|
});
|
|
31
36
|
const CodeStepOutputSchema = z.object({
|
|
32
37
|
result: z.unknown(),
|
|
33
38
|
});
|
|
39
|
+
// ─── Mounting bound documents ───
|
|
40
|
+
const MOUNT_DIR = '/mnt/files';
|
|
41
|
+
function planMounts(attachments) {
|
|
42
|
+
return attachments.map((attachment) => ({
|
|
43
|
+
attachment,
|
|
44
|
+
name: attachment.name,
|
|
45
|
+
path: `${MOUNT_DIR}/${attachment.name}`,
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
function describeMount(m) {
|
|
49
|
+
return {
|
|
50
|
+
name: m.name,
|
|
51
|
+
mimeType: m.attachment.mimeType,
|
|
52
|
+
path: m.path,
|
|
53
|
+
...(m.attachment.size !== undefined ? { size: m.attachment.size } : {}),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
34
56
|
// Sentinel delimiting the JSON return value on stdout. The program appends it
|
|
35
57
|
// last, after any user console output, so `lastIndexOf` recovers the result
|
|
36
58
|
// even if the user logged text that resembles the marker.
|
|
@@ -40,12 +62,14 @@ const RESULT_MARKER = '__XYNE_CODE_RESULT__';
|
|
|
40
62
|
// $input/$context are embedded via JSON.parse of a JSON-encoded string so no
|
|
41
63
|
// input value can break out into code. User code is written to a file (never a
|
|
42
64
|
// shell argument), so it needs no escaping.
|
|
43
|
-
function buildProgram(code, $input, $context, timeoutMs) {
|
|
65
|
+
function buildProgram(code, $input, $context, timeoutMs, $files) {
|
|
44
66
|
const inputLit = JSON.stringify(JSON.stringify($input));
|
|
45
67
|
const contextLit = JSON.stringify(JSON.stringify($context));
|
|
68
|
+
const filesLit = JSON.stringify(JSON.stringify($files));
|
|
46
69
|
return [
|
|
47
70
|
`const $input = JSON.parse(${inputLit});`,
|
|
48
71
|
`const $context = JSON.parse(${contextLit});`,
|
|
72
|
+
`const $files = JSON.parse(${filesLit});`,
|
|
49
73
|
`const __timer = setTimeout(() => { process.stderr.write("Code step timed out after ${timeoutMs}ms"); process.exit(1); }, ${timeoutMs});`,
|
|
50
74
|
`if (__timer.unref) __timer.unref();`,
|
|
51
75
|
`Promise.resolve().then(async () => {`,
|
|
@@ -80,12 +104,16 @@ export class CodeStep extends BaseActionStep {
|
|
|
80
104
|
if (props?.['outputFields']) {
|
|
81
105
|
props['outputFields'] = { ...props['outputFields'], format: 'output-fields' };
|
|
82
106
|
}
|
|
107
|
+
markAttachmentFields(jsonSchema, ['attachments']);
|
|
83
108
|
return jsonSchema;
|
|
84
109
|
}
|
|
85
110
|
resolveOutputJsonSchema(config) {
|
|
111
|
+
const fileProps = config['collectOutputFiles']
|
|
112
|
+
? { files: ATTACHMENT_ARRAY_JSON_SCHEMA }
|
|
113
|
+
: {};
|
|
86
114
|
const fields = config['outputFields'];
|
|
87
115
|
if (!fields || fields.length === 0) {
|
|
88
|
-
return { type: 'object', properties: { result: {} } };
|
|
116
|
+
return { type: 'object', properties: { result: {}, ...fileProps } };
|
|
89
117
|
}
|
|
90
118
|
const resultProps = {};
|
|
91
119
|
for (const f of fields) {
|
|
@@ -95,6 +123,7 @@ export class CodeStep extends BaseActionStep {
|
|
|
95
123
|
type: 'object',
|
|
96
124
|
properties: {
|
|
97
125
|
result: { type: 'object', properties: resultProps },
|
|
126
|
+
...fileProps,
|
|
98
127
|
},
|
|
99
128
|
};
|
|
100
129
|
}
|
|
@@ -115,12 +144,27 @@ export class CodeStep extends BaseActionStep {
|
|
|
115
144
|
+ 'back to in-process execution. Configure a sandbox backend (e.g. '
|
|
116
145
|
+ 'SANDBOX_BACKEND / E2B_API_KEY) to enable CODE steps.');
|
|
117
146
|
}
|
|
118
|
-
const program = buildProgram(config.code, $input, $context, config.timeoutMs);
|
|
119
147
|
const scriptPath = `/tmp/xyne-code-${ctx.runtime.executionId}-${ctx.runtime.stepId}.cjs`;
|
|
120
148
|
const scope = ctx.runtime.attributes;
|
|
149
|
+
const bound = Array.isArray(config.attachments) ? config.attachments : [];
|
|
150
|
+
const mounts = planMounts(bound);
|
|
151
|
+
const storage = ctx.storage;
|
|
152
|
+
if (mounts.length > 0 && !storage) {
|
|
153
|
+
throw new Error('Code step execution failed: documents are bound to this step but no '
|
|
154
|
+
+ 'StorageAdapter is configured, so their bytes cannot be read. '
|
|
155
|
+
+ 'Configure a storage backend to mount documents into the sandbox.');
|
|
156
|
+
}
|
|
121
157
|
const handle = await ctx.sandbox.create(scope ? { scope } : {});
|
|
122
158
|
try {
|
|
123
159
|
const session = bindSandboxSession(ctx.sandbox, handle);
|
|
160
|
+
if (mounts.length > 0 && storage) {
|
|
161
|
+
await session.writeFiles(await Promise.all(mounts.map(async (m) => ({
|
|
162
|
+
path: m.path,
|
|
163
|
+
bytes: await storage.read(m.attachment, scope),
|
|
164
|
+
}))));
|
|
165
|
+
ctx.log.info(`mounted ${String(mounts.length)} document(s) at ${MOUNT_DIR}: ${mounts.map((m) => m.name).join(', ')}`);
|
|
166
|
+
}
|
|
167
|
+
const program = buildProgram(config.code, $input, $context, config.timeoutMs, mounts.map(describeMount));
|
|
124
168
|
await session.writeFiles([
|
|
125
169
|
{ path: scriptPath, bytes: new TextEncoder().encode(program) },
|
|
126
170
|
]);
|
|
@@ -140,7 +184,14 @@ export class CodeStep extends BaseActionStep {
|
|
|
140
184
|
ctx.log.info(logged);
|
|
141
185
|
const payload = res.stdout.slice(markerAt + RESULT_MARKER.length).trim();
|
|
142
186
|
const result = JSON.parse(payload);
|
|
143
|
-
|
|
187
|
+
const files = config.collectOutputFiles && storage
|
|
188
|
+
? await Promise.all(res.artifacts.map((a) => storage.store(scope, {
|
|
189
|
+
name: a.path.split('/').pop() ?? 'output',
|
|
190
|
+
mimeType: a.mimeType,
|
|
191
|
+
bytes: a.bytes,
|
|
192
|
+
})))
|
|
193
|
+
: [];
|
|
194
|
+
return { result, ...(config.collectOutputFiles ? { files } : {}) };
|
|
144
195
|
}
|
|
145
196
|
finally {
|
|
146
197
|
await ctx.sandbox.destroy(handle).catch(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code.step.js","sourceRoot":"","sources":["../../../../src/connectors/builtin/steps/code.step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"code.step.js","sourceRoot":"","sources":["../../../../src/connectors/builtin/steps/code.step.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,4BAA4B,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErH,OAAO,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAEhE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAGhE,iBAAiB;AAEjB,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACjC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC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