@enactprotocol/execution 2.2.2 → 2.3.1
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/docker-provider.d.ts +87 -0
- package/dist/docker-provider.d.ts.map +1 -0
- package/dist/docker-provider.js +406 -0
- package/dist/docker-provider.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/local-provider.d.ts +95 -0
- package/dist/local-provider.d.ts.map +1 -0
- package/dist/local-provider.js +369 -0
- package/dist/local-provider.js.map +1 -0
- package/dist/provider.d.ts +24 -1
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +305 -20
- package/dist/provider.js.map +1 -1
- package/dist/remote-provider.d.ts +43 -0
- package/dist/remote-provider.d.ts.map +1 -0
- package/dist/remote-provider.js +154 -0
- package/dist/remote-provider.js.map +1 -0
- package/dist/router.d.ts +62 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +109 -0
- package/dist/router.js.map +1 -0
- package/package.json +2 -2
- package/src/docker-provider.ts +575 -0
- package/src/index.ts +32 -1
- package/src/local-provider.ts +513 -0
- package/src/provider.ts +409 -28
- package/src/remote-provider.ts +231 -0
- package/src/router.ts +143 -0
- package/tests/docker-provider.test.ts +207 -0
- package/tests/local-provider.test.ts +256 -0
- package/tests/remote-provider.test.ts +206 -0
- package/tests/router.test.ts +272 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Docker Execution Provider
|
|
3
|
+
*
|
|
4
|
+
* Executes commands inside Docker/Podman/nerdctl containers using direct CLI invocation.
|
|
5
|
+
* Simpler than the Dagger provider — no SDK dependency, just spawns `docker run`.
|
|
6
|
+
*/
|
|
7
|
+
import type { Action, ActionsManifest, ToolManifest } from "@enactprotocol/shared";
|
|
8
|
+
import type { ContainerRuntime, EngineHealth, ExecutionInput, ExecutionOptions, ExecutionProvider, ExecutionResult } from "@enactprotocol/shared";
|
|
9
|
+
/**
|
|
10
|
+
* Configuration for the Docker execution provider
|
|
11
|
+
*/
|
|
12
|
+
export interface DockerProviderConfig {
|
|
13
|
+
/** Default timeout in milliseconds */
|
|
14
|
+
defaultTimeout?: number;
|
|
15
|
+
/** Enable verbose logging */
|
|
16
|
+
verbose?: boolean;
|
|
17
|
+
/** Preferred container runtime (auto-detected if not set) */
|
|
18
|
+
preferredRuntime?: ContainerRuntime;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Provider for executing commands inside Docker/Podman containers
|
|
22
|
+
*
|
|
23
|
+
* Uses direct CLI invocation (`docker run`, `podman run`, etc.)
|
|
24
|
+
* for simpler, dependency-free container execution.
|
|
25
|
+
*/
|
|
26
|
+
export declare class DockerExecutionProvider implements ExecutionProvider {
|
|
27
|
+
readonly name = "docker";
|
|
28
|
+
private defaultTimeout;
|
|
29
|
+
private verbose;
|
|
30
|
+
private runtime;
|
|
31
|
+
constructor(config?: DockerProviderConfig);
|
|
32
|
+
initialize(): Promise<void>;
|
|
33
|
+
isAvailable(): Promise<boolean>;
|
|
34
|
+
getHealth(): Promise<EngineHealth>;
|
|
35
|
+
shutdown(): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Execute a tool using its manifest.command
|
|
38
|
+
*/
|
|
39
|
+
execute(manifest: ToolManifest, input: ExecutionInput, options?: ExecutionOptions): Promise<ExecutionResult>;
|
|
40
|
+
/**
|
|
41
|
+
* Execute a raw command in a container
|
|
42
|
+
*/
|
|
43
|
+
exec(manifest: ToolManifest, command: string, options?: ExecutionOptions): Promise<ExecutionResult>;
|
|
44
|
+
/**
|
|
45
|
+
* Execute an action from ACTIONS.yaml
|
|
46
|
+
*/
|
|
47
|
+
executeAction(manifest: ToolManifest, actionsManifest: ActionsManifest, actionName: string, action: Action, input: ExecutionInput, options?: ExecutionOptions): Promise<ExecutionResult>;
|
|
48
|
+
/**
|
|
49
|
+
* Resolve the source directory from execution options.
|
|
50
|
+
* Checks mountDirs for a /workspace mount first, then falls back to workdir or cwd.
|
|
51
|
+
*/
|
|
52
|
+
private resolveSourceDir;
|
|
53
|
+
private generateExecutionId;
|
|
54
|
+
private parseTimeout;
|
|
55
|
+
/**
|
|
56
|
+
* Resolve the container image to use.
|
|
57
|
+
* If the skill directory has a Containerfile/Dockerfile, build it.
|
|
58
|
+
* Otherwise use manifest.from or a default image.
|
|
59
|
+
*/
|
|
60
|
+
private resolveImage;
|
|
61
|
+
/**
|
|
62
|
+
* Build a container image from a Containerfile/Dockerfile
|
|
63
|
+
*/
|
|
64
|
+
private buildImage;
|
|
65
|
+
/**
|
|
66
|
+
* Build docker run args for a shell command string (used by execute and build)
|
|
67
|
+
*/
|
|
68
|
+
private buildRunArgs;
|
|
69
|
+
/**
|
|
70
|
+
* Build docker run args for an array-form command (used by executeAction)
|
|
71
|
+
*/
|
|
72
|
+
private buildExecArgs;
|
|
73
|
+
/**
|
|
74
|
+
* Run a container and capture output
|
|
75
|
+
*/
|
|
76
|
+
private runContainer;
|
|
77
|
+
/**
|
|
78
|
+
* Spawn a process and capture its output
|
|
79
|
+
*/
|
|
80
|
+
private spawnProcess;
|
|
81
|
+
private createErrorResult;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Create a Docker execution provider
|
|
85
|
+
*/
|
|
86
|
+
export declare function createDockerProvider(config?: DockerProviderConfig): DockerExecutionProvider;
|
|
87
|
+
//# sourceMappingURL=docker-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docker-provider.d.ts","sourceRoot":"","sources":["../src/docker-provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAQnF,OAAO,KAAK,EACV,gBAAgB,EAChB,YAAY,EAEZ,cAAc,EAEd,gBAAgB,EA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;OAEG;YACW,UAAU;IAaxB;;OAEG;IACH,OAAO,CAAC,YAAY;IAoBpB;;OAEG;IACH,OAAO,CAAC,aAAa;IAkBrB;;OAEG;IACH,OAAO,CAAC,YAAY;IAUpB;;OAEG;IACH,OAAO,CAAC,YAAY;IA4CpB,OAAO,CAAC,iBAAiB;CAuB1B;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,GAAE,oBAAyB,GAAG,uBAAuB,CAE/F"}
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Docker Execution Provider
|
|
3
|
+
*
|
|
4
|
+
* Executes commands inside Docker/Podman/nerdctl containers using direct CLI invocation.
|
|
5
|
+
* Simpler than the Dagger provider — no SDK dependency, just spawns `docker run`.
|
|
6
|
+
*/
|
|
7
|
+
import { spawn } from "node:child_process";
|
|
8
|
+
import { createHash } from "node:crypto";
|
|
9
|
+
import { existsSync } from "node:fs";
|
|
10
|
+
import { join, resolve } from "node:path";
|
|
11
|
+
import { applyDefaults, detectRuntime, getEffectiveInputSchema, prepareActionCommand, validateInputs, } from "@enactprotocol/shared";
|
|
12
|
+
/**
|
|
13
|
+
* Provider for executing commands inside Docker/Podman containers
|
|
14
|
+
*
|
|
15
|
+
* Uses direct CLI invocation (`docker run`, `podman run`, etc.)
|
|
16
|
+
* for simpler, dependency-free container execution.
|
|
17
|
+
*/
|
|
18
|
+
export class DockerExecutionProvider {
|
|
19
|
+
name = "docker";
|
|
20
|
+
defaultTimeout;
|
|
21
|
+
verbose;
|
|
22
|
+
runtime = null;
|
|
23
|
+
constructor(config = {}) {
|
|
24
|
+
this.defaultTimeout = config.defaultTimeout ?? 300000; // 5 minutes
|
|
25
|
+
this.verbose = config.verbose ?? false;
|
|
26
|
+
if (config.preferredRuntime) {
|
|
27
|
+
this.runtime = config.preferredRuntime;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
async initialize() {
|
|
31
|
+
if (!this.runtime) {
|
|
32
|
+
const detection = detectRuntime();
|
|
33
|
+
if (detection.found && detection.runtime) {
|
|
34
|
+
this.runtime = detection.runtime;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async isAvailable() {
|
|
39
|
+
const detection = detectRuntime();
|
|
40
|
+
return detection.found;
|
|
41
|
+
}
|
|
42
|
+
async getHealth() {
|
|
43
|
+
const detection = detectRuntime();
|
|
44
|
+
return {
|
|
45
|
+
healthy: detection.found,
|
|
46
|
+
runtime: this.runtime ?? "docker",
|
|
47
|
+
consecutiveFailures: 0,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
async shutdown() {
|
|
51
|
+
// Nothing to clean up
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Execute a tool using its manifest.command
|
|
55
|
+
*/
|
|
56
|
+
async execute(manifest, input, options = {}) {
|
|
57
|
+
const startTime = new Date();
|
|
58
|
+
const executionId = this.generateExecutionId();
|
|
59
|
+
if (!manifest.command) {
|
|
60
|
+
return this.createErrorResult(manifest.name, executionId, startTime, "COMMAND_ERROR", "No command specified in manifest");
|
|
61
|
+
}
|
|
62
|
+
if (!this.runtime) {
|
|
63
|
+
return this.createErrorResult(manifest.name, executionId, startTime, "CONTAINER_ERROR", "No container runtime available");
|
|
64
|
+
}
|
|
65
|
+
const sourceDir = this.resolveSourceDir(options);
|
|
66
|
+
const timeoutMs = this.parseTimeout(options.timeout ?? manifest.timeout);
|
|
67
|
+
const image = await this.resolveImage(manifest, sourceDir);
|
|
68
|
+
// Merge params as env vars so ${param} shell substitution works in the container
|
|
69
|
+
const env = { ...input.envOverrides };
|
|
70
|
+
for (const [key, value] of Object.entries(input.params)) {
|
|
71
|
+
if (value !== undefined && value !== null) {
|
|
72
|
+
env[key] = String(value);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
// Run build commands if specified (e.g., manifest.build or hooks.build)
|
|
77
|
+
if (manifest.build) {
|
|
78
|
+
const buildCommands = Array.isArray(manifest.build) ? manifest.build : [manifest.build];
|
|
79
|
+
for (const cmd of buildCommands) {
|
|
80
|
+
const buildArgs = this.buildRunArgs(image, sourceDir, env, cmd);
|
|
81
|
+
const buildOutput = await this.runContainer(buildArgs, 600000); // 10 min build timeout
|
|
82
|
+
if (buildOutput.exitCode !== 0) {
|
|
83
|
+
return this.createErrorResult(manifest.name, executionId, startTime, "BUILD_ERROR", `Build failed (exit ${buildOutput.exitCode}): ${buildOutput.stderr}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const dockerArgs = this.buildRunArgs(image, sourceDir, env, manifest.command);
|
|
88
|
+
const output = await this.runContainer(dockerArgs, timeoutMs);
|
|
89
|
+
const endTime = new Date();
|
|
90
|
+
const metadata = {
|
|
91
|
+
toolName: manifest.name,
|
|
92
|
+
containerImage: image,
|
|
93
|
+
startTime,
|
|
94
|
+
endTime,
|
|
95
|
+
durationMs: endTime.getTime() - startTime.getTime(),
|
|
96
|
+
cached: false,
|
|
97
|
+
executionId,
|
|
98
|
+
};
|
|
99
|
+
if (output.exitCode !== 0) {
|
|
100
|
+
return {
|
|
101
|
+
success: false,
|
|
102
|
+
output,
|
|
103
|
+
metadata,
|
|
104
|
+
error: {
|
|
105
|
+
code: "COMMAND_ERROR",
|
|
106
|
+
message: `Command exited with code ${output.exitCode}`,
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return { success: true, output, metadata };
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
114
|
+
const code = message === "TIMEOUT" ? "TIMEOUT" : "CONTAINER_ERROR";
|
|
115
|
+
return this.createErrorResult(manifest.name, executionId, startTime, code, message);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Execute a raw command in a container
|
|
120
|
+
*/
|
|
121
|
+
async exec(manifest, command, options = {}) {
|
|
122
|
+
return this.execute({ ...manifest, command }, { params: {} }, options);
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Execute an action from ACTIONS.yaml
|
|
126
|
+
*/
|
|
127
|
+
async executeAction(manifest, actionsManifest, actionName, action, input, options = {}) {
|
|
128
|
+
const startTime = new Date();
|
|
129
|
+
const executionId = this.generateExecutionId();
|
|
130
|
+
const toolLabel = `${manifest.name}:${actionName}`;
|
|
131
|
+
if (!this.runtime) {
|
|
132
|
+
return this.createErrorResult(toolLabel, executionId, startTime, "CONTAINER_ERROR", "No container runtime available");
|
|
133
|
+
}
|
|
134
|
+
// Validate inputs
|
|
135
|
+
const effectiveSchema = getEffectiveInputSchema(action);
|
|
136
|
+
const validation = validateInputs(input.params, effectiveSchema);
|
|
137
|
+
if (!validation.valid) {
|
|
138
|
+
const errorMessages = validation.errors.map((e) => `${e.path}: ${e.message}`);
|
|
139
|
+
return this.createErrorResult(toolLabel, executionId, startTime, "VALIDATION_ERROR", `Input validation failed: ${errorMessages.join(", ")}`);
|
|
140
|
+
}
|
|
141
|
+
const params = applyDefaults(input.params, effectiveSchema);
|
|
142
|
+
// Prepare command
|
|
143
|
+
let commandArray;
|
|
144
|
+
try {
|
|
145
|
+
if (typeof action.command === "string") {
|
|
146
|
+
commandArray = action.command.split(/\s+/).filter((s) => s.length > 0);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
commandArray = prepareActionCommand(action.command, params, effectiveSchema);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
154
|
+
return this.createErrorResult(toolLabel, executionId, startTime, "COMMAND_ERROR", `Failed to prepare action command: ${message}`);
|
|
155
|
+
}
|
|
156
|
+
if (commandArray.length === 0) {
|
|
157
|
+
return this.createErrorResult(toolLabel, executionId, startTime, "COMMAND_ERROR", "Action command is empty");
|
|
158
|
+
}
|
|
159
|
+
const sourceDir = this.resolveSourceDir(options);
|
|
160
|
+
const timeoutMs = this.parseTimeout(options.timeout ?? manifest.timeout);
|
|
161
|
+
const image = await this.resolveImage(manifest, sourceDir);
|
|
162
|
+
// Build environment
|
|
163
|
+
const env = { ...input.envOverrides };
|
|
164
|
+
if (actionsManifest.env) {
|
|
165
|
+
for (const [key, envVar] of Object.entries(actionsManifest.env)) {
|
|
166
|
+
if (envVar.default && !env[key]) {
|
|
167
|
+
env[key] = envVar.default;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
try {
|
|
172
|
+
// Run build if needed
|
|
173
|
+
if (actionsManifest.build) {
|
|
174
|
+
const buildCommands = Array.isArray(actionsManifest.build)
|
|
175
|
+
? actionsManifest.build
|
|
176
|
+
: [actionsManifest.build];
|
|
177
|
+
for (const cmd of buildCommands) {
|
|
178
|
+
const buildArgs = this.buildRunArgs(image, sourceDir, env, cmd);
|
|
179
|
+
const buildOutput = await this.runContainer(buildArgs, 600000); // 10 min build timeout
|
|
180
|
+
if (buildOutput.exitCode !== 0) {
|
|
181
|
+
return this.createErrorResult(toolLabel, executionId, startTime, "BUILD_ERROR", `Build failed (exit ${buildOutput.exitCode}): ${buildOutput.stderr}`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
// Execute action
|
|
186
|
+
const dockerArgs = this.buildExecArgs(image, sourceDir, env, commandArray);
|
|
187
|
+
const output = await this.runContainer(dockerArgs, timeoutMs);
|
|
188
|
+
const endTime = new Date();
|
|
189
|
+
const metadata = {
|
|
190
|
+
toolName: toolLabel,
|
|
191
|
+
containerImage: image,
|
|
192
|
+
startTime,
|
|
193
|
+
endTime,
|
|
194
|
+
durationMs: endTime.getTime() - startTime.getTime(),
|
|
195
|
+
cached: false,
|
|
196
|
+
executionId,
|
|
197
|
+
};
|
|
198
|
+
if (manifest.version) {
|
|
199
|
+
metadata.toolVersion = manifest.version;
|
|
200
|
+
}
|
|
201
|
+
if (output.exitCode !== 0) {
|
|
202
|
+
return {
|
|
203
|
+
success: false,
|
|
204
|
+
output,
|
|
205
|
+
metadata,
|
|
206
|
+
error: {
|
|
207
|
+
code: "COMMAND_ERROR",
|
|
208
|
+
message: `Action "${actionName}" exited with code ${output.exitCode}`,
|
|
209
|
+
...(output.stderr && { details: { stderr: output.stderr } }),
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
// Try to parse JSON output
|
|
214
|
+
if (action.outputSchema && output.stdout) {
|
|
215
|
+
try {
|
|
216
|
+
output.parsed = JSON.parse(output.stdout);
|
|
217
|
+
}
|
|
218
|
+
catch {
|
|
219
|
+
// Not JSON — leave as string
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return { success: true, output, metadata };
|
|
223
|
+
}
|
|
224
|
+
catch (error) {
|
|
225
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
226
|
+
let code = "CONTAINER_ERROR";
|
|
227
|
+
if (message.includes("build"))
|
|
228
|
+
code = "BUILD_ERROR";
|
|
229
|
+
else if (message === "TIMEOUT")
|
|
230
|
+
code = "TIMEOUT";
|
|
231
|
+
return this.createErrorResult(toolLabel, executionId, startTime, code, message);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
// ---------------------------------------------------------------------------
|
|
235
|
+
// Private helpers
|
|
236
|
+
// ---------------------------------------------------------------------------
|
|
237
|
+
/**
|
|
238
|
+
* Resolve the source directory from execution options.
|
|
239
|
+
* Checks mountDirs for a /workspace mount first, then falls back to workdir or cwd.
|
|
240
|
+
*/
|
|
241
|
+
resolveSourceDir(options) {
|
|
242
|
+
if (options.mountDirs) {
|
|
243
|
+
for (const [hostPath, containerPath] of Object.entries(options.mountDirs)) {
|
|
244
|
+
if (containerPath === "/workspace")
|
|
245
|
+
return hostPath;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
return options.workdir ?? process.cwd();
|
|
249
|
+
}
|
|
250
|
+
generateExecutionId() {
|
|
251
|
+
return `docker-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
252
|
+
}
|
|
253
|
+
parseTimeout(timeout) {
|
|
254
|
+
if (!timeout)
|
|
255
|
+
return this.defaultTimeout;
|
|
256
|
+
const match = timeout.match(/^(\d+)(ms|s|m|h)?$/);
|
|
257
|
+
if (!match)
|
|
258
|
+
return this.defaultTimeout;
|
|
259
|
+
const value = Number.parseInt(match[1] ?? "300000", 10);
|
|
260
|
+
switch (match[2] ?? "ms") {
|
|
261
|
+
case "ms":
|
|
262
|
+
return value;
|
|
263
|
+
case "s":
|
|
264
|
+
return value * 1000;
|
|
265
|
+
case "m":
|
|
266
|
+
return value * 60000;
|
|
267
|
+
case "h":
|
|
268
|
+
return value * 3600000;
|
|
269
|
+
default:
|
|
270
|
+
return value;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Resolve the container image to use.
|
|
275
|
+
* If the skill directory has a Containerfile/Dockerfile, build it.
|
|
276
|
+
* Otherwise use manifest.from or a default image.
|
|
277
|
+
*/
|
|
278
|
+
async resolveImage(manifest, sourceDir) {
|
|
279
|
+
const containerfile = existsSync(join(sourceDir, "Containerfile"))
|
|
280
|
+
? "Containerfile"
|
|
281
|
+
: existsSync(join(sourceDir, "Dockerfile"))
|
|
282
|
+
? "Dockerfile"
|
|
283
|
+
: null;
|
|
284
|
+
if (containerfile) {
|
|
285
|
+
const hash = createHash("sha256")
|
|
286
|
+
.update(`${manifest.name}:${sourceDir}`)
|
|
287
|
+
.digest("hex")
|
|
288
|
+
.slice(0, 12);
|
|
289
|
+
const tag = `enact-${hash}`;
|
|
290
|
+
if (this.verbose) {
|
|
291
|
+
console.error(`[docker] Building image ${tag} from ${containerfile}`);
|
|
292
|
+
}
|
|
293
|
+
await this.buildImage(sourceDir, containerfile, tag);
|
|
294
|
+
return tag;
|
|
295
|
+
}
|
|
296
|
+
// Use manifest.from if available, otherwise default
|
|
297
|
+
return manifest.from ?? "alpine:latest";
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Build a container image from a Containerfile/Dockerfile
|
|
301
|
+
*/
|
|
302
|
+
async buildImage(contextDir, file, tag) {
|
|
303
|
+
const runtime = this.runtime;
|
|
304
|
+
const args = ["build", "-t", tag, "-f", join(contextDir, file), contextDir];
|
|
305
|
+
const output = await this.spawnProcess(runtime, args, 600000); // 10 min build timeout
|
|
306
|
+
if (output.exitCode !== 0) {
|
|
307
|
+
throw new Error(`BUILD_ERROR: Image build failed (exit ${output.exitCode}): ${output.stderr}`);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Build docker run args for a shell command string (used by execute and build)
|
|
312
|
+
*/
|
|
313
|
+
buildRunArgs(image, sourceDir, env, command) {
|
|
314
|
+
const args = ["run", "--rm", "-w", "/workspace"];
|
|
315
|
+
// Mount source directory
|
|
316
|
+
args.push("-v", `${resolve(sourceDir)}:/workspace`);
|
|
317
|
+
// Environment variables
|
|
318
|
+
for (const [key, value] of Object.entries(env)) {
|
|
319
|
+
args.push("-e", `${key}=${value}`);
|
|
320
|
+
}
|
|
321
|
+
args.push(image, "sh", "-c", command);
|
|
322
|
+
return args;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Build docker run args for an array-form command (used by executeAction)
|
|
326
|
+
*/
|
|
327
|
+
buildExecArgs(image, sourceDir, env, commandArray) {
|
|
328
|
+
const args = ["run", "--rm", "-w", "/workspace"];
|
|
329
|
+
args.push("-v", `${resolve(sourceDir)}:/workspace`);
|
|
330
|
+
for (const [key, value] of Object.entries(env)) {
|
|
331
|
+
args.push("-e", `${key}=${value}`);
|
|
332
|
+
}
|
|
333
|
+
args.push(image, ...commandArray);
|
|
334
|
+
return args;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Run a container and capture output
|
|
338
|
+
*/
|
|
339
|
+
runContainer(dockerArgs, timeoutMs) {
|
|
340
|
+
const runtime = this.runtime;
|
|
341
|
+
if (this.verbose) {
|
|
342
|
+
console.error(`[docker] ${runtime} ${dockerArgs.join(" ")}`);
|
|
343
|
+
}
|
|
344
|
+
return this.spawnProcess(runtime, dockerArgs, timeoutMs);
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Spawn a process and capture its output
|
|
348
|
+
*/
|
|
349
|
+
spawnProcess(command, args, timeoutMs) {
|
|
350
|
+
return new Promise((resolve, reject) => {
|
|
351
|
+
const child = spawn(command, args, {
|
|
352
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
353
|
+
});
|
|
354
|
+
let stdout = "";
|
|
355
|
+
let stderr = "";
|
|
356
|
+
let timedOut = false;
|
|
357
|
+
const timer = setTimeout(() => {
|
|
358
|
+
timedOut = true;
|
|
359
|
+
child.kill("SIGTERM");
|
|
360
|
+
setTimeout(() => child.kill("SIGKILL"), 5000);
|
|
361
|
+
}, timeoutMs);
|
|
362
|
+
child.stdout?.on("data", (data) => {
|
|
363
|
+
stdout += data.toString();
|
|
364
|
+
});
|
|
365
|
+
child.stderr?.on("data", (data) => {
|
|
366
|
+
stderr += data.toString();
|
|
367
|
+
});
|
|
368
|
+
child.on("error", (error) => {
|
|
369
|
+
clearTimeout(timer);
|
|
370
|
+
reject(error);
|
|
371
|
+
});
|
|
372
|
+
child.on("close", (exitCode) => {
|
|
373
|
+
clearTimeout(timer);
|
|
374
|
+
if (timedOut) {
|
|
375
|
+
reject(new Error("TIMEOUT"));
|
|
376
|
+
return;
|
|
377
|
+
}
|
|
378
|
+
resolve({ stdout, stderr, exitCode: exitCode ?? 1 });
|
|
379
|
+
});
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
createErrorResult(toolName, executionId, startTime, code, message) {
|
|
383
|
+
const endTime = new Date();
|
|
384
|
+
return {
|
|
385
|
+
success: false,
|
|
386
|
+
output: { stdout: "", stderr: message, exitCode: 1 },
|
|
387
|
+
metadata: {
|
|
388
|
+
toolName,
|
|
389
|
+
containerImage: "docker",
|
|
390
|
+
startTime,
|
|
391
|
+
endTime,
|
|
392
|
+
durationMs: endTime.getTime() - startTime.getTime(),
|
|
393
|
+
cached: false,
|
|
394
|
+
executionId,
|
|
395
|
+
},
|
|
396
|
+
error: { code, message },
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Create a Docker execution provider
|
|
402
|
+
*/
|
|
403
|
+
export function createDockerProvider(config = {}) {
|
|
404
|
+
return new DockerExecutionProvider(config);
|
|
405
|
+
}
|
|
406
|
+
//# sourceMappingURL=docker-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docker-provider.js","sourceRoot":"","sources":["../src/docker-provider.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EACL,aAAa,EACb,aAAa,EACb,uBAAuB,EACvB,oBAAoB,EACpB,cAAc,GACf,MAAM,uBAAuB,CAAC;AAyB/B;;;;;GAKG;AACH,MAAM,OAAO,uBAAuB;IACzB,IAAI,GAAG,QAAQ,CAAC;IACjB,cAAc,CAAS;IACvB,OAAO,CAAU;IACjB,OAAO,GAA4B,IAAI,CAAC;IAEhD,YAAY,SAA+B,EAAE;QAC3C,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,IAAI,MAAM,CAAC,CAAC,YAAY;QACnE,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,KAAK,CAAC;QACvC,IAAI,MAAM,CAAC,gBAAgB,EAAE,CAAC;YAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,gBAAgB,CAAC;QACzC,CAAC;IACH,CAAC;IAED,KAAK,CAAC,UAAU;QACd,IAAI,CAAC,IAAI,CAAC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AwB,EACxB,OAAe;QAEf,MAAM,OAAO,GAAG,IAAI,IAAI,EAAE,CAAC;QAC3B,OAAO;YACL,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE;YACpD,QAAQ,EAAE;gBACR,QAAQ;gBACR,cAAc,EAAE,QAAQ;gBACxB,SAAS;gBACT,OAAO;gBACP,UAAU,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,OAAO,EAAE;gBACnD,MAAM,EAAE,KAAK;gBACb,WAAW;aACZ;YACD,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;SACzB,CAAC;IACJ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,SAA+B,EAAE;IACpE,OAAO,IAAI,uBAAuB,CAAC,MAAM,CAAC,CAAC;AAC7C,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @enactprotocol/execution
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Pluggable execution backends for Enact tools.
|
|
5
5
|
* This package contains Node.js-only code and should NOT be imported in browser environments.
|
|
6
6
|
*/
|
|
7
7
|
export declare const VERSION = "0.1.0";
|
|
8
8
|
export type { ExecutionInput, FileInput, ExecutionOutput, ExecutionResult, ExecutionMetadata, ExecutionError, ExecutionErrorCode, ExecutionOptions, RetryConfig, ContainerRuntime, RuntimeDetection, RuntimeStatus, EngineHealth, EngineState, ExecutionProvider, DryRunResult, } from "@enactprotocol/shared";
|
|
9
9
|
export { DaggerExecutionProvider, createExecutionProvider, executeToolWithDagger, type DaggerProviderConfig, } from "./provider.js";
|
|
10
|
+
export { LocalExecutionProvider, createLocalProvider, hasContainerfile, selectExecutionMode, type LocalProviderConfig, } from "./local-provider.js";
|
|
11
|
+
export { DockerExecutionProvider, createDockerProvider, type DockerProviderConfig, } from "./docker-provider.js";
|
|
12
|
+
export { RemoteExecutionProvider, createRemoteProvider, type RemoteProviderConfig, } from "./remote-provider.js";
|
|
13
|
+
export { ExecutionRouter, createRouter, type ExecutionRoutingConfig, type ProviderSelectionOptions, } from "./router.js";
|
|
10
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,YAAY,EACV,cAAc,EACd,SAAS,EACT,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,YAAY,GACb,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACrB,KAAK,oBAAoB,GAC1B,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,UAAU,CAAC;AAG/B,YAAY,EACV,cAAc,EACd,SAAS,EACT,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,YAAY,GACb,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,EACrB,KAAK,oBAAoB,GAC1B,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,KAAK,oBAAoB,GAC1B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,KAAK,oBAAoB,GAC1B,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EACL,eAAe,EACf,YAAY,EACZ,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,GAC9B,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @enactprotocol/execution
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* Pluggable execution backends for Enact tools.
|
|
5
5
|
* This package contains Node.js-only code and should NOT be imported in browser environments.
|
|
6
6
|
*/
|
|
7
7
|
export const VERSION = "0.1.0";
|
|
8
8
|
// Dagger execution provider (Node.js only)
|
|
9
9
|
export { DaggerExecutionProvider, createExecutionProvider, executeToolWithDagger, } from "./provider.js";
|
|
10
|
+
// Local execution provider (no containerization)
|
|
11
|
+
export { LocalExecutionProvider, createLocalProvider, hasContainerfile, selectExecutionMode, } from "./local-provider.js";
|
|
12
|
+
// Docker execution provider (direct CLI, no Dagger SDK)
|
|
13
|
+
export { DockerExecutionProvider, createDockerProvider, } from "./docker-provider.js";
|
|
14
|
+
// Remote execution provider (delegates to remote endpoint)
|
|
15
|
+
export { RemoteExecutionProvider, createRemoteProvider, } from "./remote-provider.js";
|
|
16
|
+
// Execution router (config-driven backend selection)
|
|
17
|
+
export { ExecutionRouter, createRouter, } from "./router.js";
|
|
10
18
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAsB/B,2CAA2C;AAC3C,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,GAEtB,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAsB/B,2CAA2C;AAC3C,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,qBAAqB,GAEtB,MAAM,eAAe,CAAC;AAEvB,iDAAiD;AACjD,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,gBAAgB,EAChB,mBAAmB,GAEpB,MAAM,qBAAqB,CAAC;AAE7B,wDAAwD;AACxD,OAAO,EACL,uBAAuB,EACvB,oBAAoB,GAErB,MAAM,sBAAsB,CAAC;AAE9B,2DAA2D;AAC3D,OAAO,EACL,uBAAuB,EACvB,oBAAoB,GAErB,MAAM,sBAAsB,CAAC;AAE9B,qDAAqD;AACrD,OAAO,EACL,eAAe,EACf,YAAY,GAGb,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local Execution Provider
|
|
3
|
+
*
|
|
4
|
+
* Executes commands directly on the host system without containerization.
|
|
5
|
+
* This is faster but provides no isolation or sandboxing.
|
|
6
|
+
*/
|
|
7
|
+
import type { Action, ActionsManifest, ToolManifest } from "@enactprotocol/shared";
|
|
8
|
+
import type { EngineHealth, ExecutionInput, ExecutionOptions, ExecutionProvider, ExecutionResult } from "@enactprotocol/shared";
|
|
9
|
+
/**
|
|
10
|
+
* Configuration for the local execution provider
|
|
11
|
+
*/
|
|
12
|
+
export interface LocalProviderConfig {
|
|
13
|
+
/** Default timeout in milliseconds */
|
|
14
|
+
defaultTimeout?: number;
|
|
15
|
+
/** Enable verbose logging */
|
|
16
|
+
verbose?: boolean;
|
|
17
|
+
/** Working directory for execution (defaults to skill directory) */
|
|
18
|
+
workdir?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Provider for executing commands directly on the host system
|
|
22
|
+
*
|
|
23
|
+
* WARNING: This provider offers no sandboxing or isolation.
|
|
24
|
+
* Commands have full access to the filesystem and network.
|
|
25
|
+
*/
|
|
26
|
+
export declare class LocalExecutionProvider implements ExecutionProvider {
|
|
27
|
+
readonly name = "local";
|
|
28
|
+
private defaultTimeout;
|
|
29
|
+
private workdir;
|
|
30
|
+
constructor(config?: LocalProviderConfig);
|
|
31
|
+
/**
|
|
32
|
+
* Initialize the provider
|
|
33
|
+
*/
|
|
34
|
+
initialize(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Check if the provider is available (always true for local)
|
|
37
|
+
*/
|
|
38
|
+
isAvailable(): Promise<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* Get provider health status
|
|
41
|
+
*/
|
|
42
|
+
getHealth(): Promise<EngineHealth>;
|
|
43
|
+
/**
|
|
44
|
+
* Generate a unique execution ID
|
|
45
|
+
*/
|
|
46
|
+
private generateExecutionId;
|
|
47
|
+
/**
|
|
48
|
+
* Parse a timeout string to milliseconds
|
|
49
|
+
*/
|
|
50
|
+
private parseTimeout;
|
|
51
|
+
/**
|
|
52
|
+
* Create an error result
|
|
53
|
+
*/
|
|
54
|
+
private createErrorResult;
|
|
55
|
+
/**
|
|
56
|
+
* Run build commands if specified
|
|
57
|
+
*/
|
|
58
|
+
private runBuild;
|
|
59
|
+
/**
|
|
60
|
+
* Run a command and return the output
|
|
61
|
+
*/
|
|
62
|
+
private runCommand;
|
|
63
|
+
/**
|
|
64
|
+
* Execute a tool (for compatibility - uses manifest.command)
|
|
65
|
+
*/
|
|
66
|
+
execute(manifest: ToolManifest, input: ExecutionInput, options?: ExecutionOptions): Promise<ExecutionResult>;
|
|
67
|
+
/**
|
|
68
|
+
* Execute a raw command
|
|
69
|
+
*/
|
|
70
|
+
exec(manifest: ToolManifest, command: string, options?: ExecutionOptions): Promise<ExecutionResult>;
|
|
71
|
+
/**
|
|
72
|
+
* Execute an action from ACTIONS.yaml
|
|
73
|
+
*/
|
|
74
|
+
executeAction(manifest: ToolManifest, actionsManifest: ActionsManifest, actionName: string, action: Action, input: ExecutionInput, options?: ExecutionOptions): Promise<ExecutionResult>;
|
|
75
|
+
/**
|
|
76
|
+
* Shutdown the provider (no-op for local)
|
|
77
|
+
*/
|
|
78
|
+
shutdown(): Promise<void>;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Check if a directory has a Containerfile or Dockerfile
|
|
82
|
+
*/
|
|
83
|
+
export declare function hasContainerfile(dir: string): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Determine the execution mode based on skill directory and options
|
|
86
|
+
*/
|
|
87
|
+
export declare function selectExecutionMode(skillDir: string, options: {
|
|
88
|
+
local?: boolean;
|
|
89
|
+
container?: boolean;
|
|
90
|
+
}): "local" | "container";
|
|
91
|
+
/**
|
|
92
|
+
* Create a local execution provider
|
|
93
|
+
*/
|
|
94
|
+
export declare function createLocalProvider(config?: LocalProviderConfig): LocalExecutionProvider;
|
|
95
|
+
//# sourceMappingURL=local-provider.d.ts.map
|