@enactprotocol/cli 1.2.4 → 1.2.6
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/index.js +63 -7
- package/dist/index.js.bak +63 -7
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -226388,6 +226388,49 @@ class DaggerExecutionProvider extends ExecutionProvider {
|
|
|
226388
226388
|
});
|
|
226389
226389
|
});
|
|
226390
226390
|
}
|
|
226391
|
+
async setupDirectoryMount(client, container, mountSpec) {
|
|
226392
|
+
try {
|
|
226393
|
+
let localPath2;
|
|
226394
|
+
let containerPath;
|
|
226395
|
+
const colonIndex = mountSpec.indexOf(":");
|
|
226396
|
+
if (colonIndex > 0) {
|
|
226397
|
+
const potentialDriveLetter = mountSpec.substring(0, colonIndex);
|
|
226398
|
+
const isWindowsDrive = potentialDriveLetter.length === 1 && /[A-Za-z]/.test(potentialDriveLetter);
|
|
226399
|
+
if (isWindowsDrive) {
|
|
226400
|
+
const nextColonIndex = mountSpec.indexOf(":", colonIndex + 1);
|
|
226401
|
+
if (nextColonIndex > 0) {
|
|
226402
|
+
localPath2 = mountSpec.substring(0, nextColonIndex);
|
|
226403
|
+
containerPath = mountSpec.substring(nextColonIndex + 1);
|
|
226404
|
+
} else {
|
|
226405
|
+
localPath2 = mountSpec;
|
|
226406
|
+
containerPath = "/workspace/src";
|
|
226407
|
+
}
|
|
226408
|
+
} else {
|
|
226409
|
+
localPath2 = mountSpec.substring(0, colonIndex);
|
|
226410
|
+
containerPath = mountSpec.substring(colonIndex + 1);
|
|
226411
|
+
}
|
|
226412
|
+
} else if (colonIndex === 0) {
|
|
226413
|
+
localPath2 = "";
|
|
226414
|
+
containerPath = mountSpec.substring(1);
|
|
226415
|
+
} else {
|
|
226416
|
+
localPath2 = mountSpec;
|
|
226417
|
+
containerPath = "/workspace/src";
|
|
226418
|
+
}
|
|
226419
|
+
const path8 = __require("path");
|
|
226420
|
+
const resolvedLocalPath = path8.resolve(localPath2);
|
|
226421
|
+
const fs5 = __require("fs");
|
|
226422
|
+
if (!fs5.existsSync(resolvedLocalPath)) {
|
|
226423
|
+
throw new Error(`Mount source directory does not exist: ${resolvedLocalPath}`);
|
|
226424
|
+
}
|
|
226425
|
+
const hostDirectory = client.host().directory(resolvedLocalPath);
|
|
226426
|
+
container = container.withMountedDirectory(containerPath, hostDirectory);
|
|
226427
|
+
logger_default.debug(`\uD83D\uDCC2 Mounted ${resolvedLocalPath} -> ${containerPath}`);
|
|
226428
|
+
return container;
|
|
226429
|
+
} catch (error2) {
|
|
226430
|
+
logger_default.error(`Failed to setup directory mount: ${error2}`);
|
|
226431
|
+
throw error2;
|
|
226432
|
+
}
|
|
226433
|
+
}
|
|
226391
226434
|
async setupContainer(client, environment, inputs, tool) {
|
|
226392
226435
|
const containerImage = tool?.from || this.options.baseImage;
|
|
226393
226436
|
logger_default.debug(`\uD83D\uDE80 Setting up container with image: ${containerImage}${tool?.from ? " (from tool.from)" : " (default baseImage)"}`);
|
|
@@ -226395,6 +226438,9 @@ class DaggerExecutionProvider extends ExecutionProvider {
|
|
|
226395
226438
|
logger_default.debug("\uD83D\uDCE6 Base container created");
|
|
226396
226439
|
container = container.withWorkdir(this.options.workdir);
|
|
226397
226440
|
logger_default.debug(`\uD83D\uDCC1 Working directory set to: ${this.options.workdir}`);
|
|
226441
|
+
if (environment.mount) {
|
|
226442
|
+
container = await this.setupDirectoryMount(client, container, environment.mount);
|
|
226443
|
+
}
|
|
226398
226444
|
for (const [key, value] of Object.entries(environment.vars)) {
|
|
226399
226445
|
container = container.withEnvVariable(key, String(value));
|
|
226400
226446
|
}
|
|
@@ -229670,7 +229716,10 @@ class EnactCore {
|
|
|
229670
229716
|
throw new Error(`Tool ${tool.name} does not have any signatures`);
|
|
229671
229717
|
}
|
|
229672
229718
|
const documentForVerification = {
|
|
229673
|
-
command: tool.command
|
|
229719
|
+
command: tool.command,
|
|
229720
|
+
description: tool.description,
|
|
229721
|
+
from: tool.from,
|
|
229722
|
+
name: tool.name
|
|
229674
229723
|
};
|
|
229675
229724
|
const referenceSignature = {
|
|
229676
229725
|
signature: tool.signatures[0].value,
|
|
@@ -229678,12 +229727,11 @@ class EnactCore {
|
|
|
229678
229727
|
algorithm: tool.signatures[0].algorithm,
|
|
229679
229728
|
timestamp: new Date(tool.signatures[0].created).getTime()
|
|
229680
229729
|
};
|
|
229681
|
-
const canonicalDoc = SigningService.getCanonicalDocument(documentForVerification, { includeFields: ["command"] });
|
|
229730
|
+
const canonicalDoc = SigningService.getCanonicalDocument(documentForVerification, { includeFields: ["command", "description", "from", "name"] });
|
|
229682
229731
|
const docString = JSON.stringify(canonicalDoc);
|
|
229683
229732
|
const messageHash = CryptoUtils.hash(docString);
|
|
229684
229733
|
const directVerify = CryptoUtils.verify(referenceSignature.publicKey, messageHash, referenceSignature.signature);
|
|
229685
|
-
const isValid = SigningService.verifyDocument(documentForVerification, referenceSignature, { includeFields: ["command"] });
|
|
229686
|
-
console.log("Final verification result:", isValid);
|
|
229734
|
+
const isValid = SigningService.verifyDocument(documentForVerification, referenceSignature, { includeFields: ["command", "description", "from", "name"] });
|
|
229687
229735
|
if (!isValid) {
|
|
229688
229736
|
throw new Error(`Tool ${tool.name} has invalid signatures`);
|
|
229689
229737
|
}
|
|
@@ -229713,7 +229761,8 @@ class EnactCore {
|
|
|
229713
229761
|
vars: { ...envVars, ...validatedInputs },
|
|
229714
229762
|
resources: {
|
|
229715
229763
|
timeout: options.timeout || tool.timeout || this.options.defaultTimeout
|
|
229716
|
-
}
|
|
229764
|
+
},
|
|
229765
|
+
mount: options.mount
|
|
229717
229766
|
});
|
|
229718
229767
|
} catch (error2) {
|
|
229719
229768
|
return {
|
|
@@ -230237,6 +230286,7 @@ Options:
|
|
|
230237
230286
|
--timeout <time> Override tool timeout (Go duration format: 30s, 5m, 1h)
|
|
230238
230287
|
--dry Show command that would be executed without running it
|
|
230239
230288
|
--verbose, -v Show detailed execution information
|
|
230289
|
+
--mount <path> Mount local directory to container (format: "local:container")
|
|
230240
230290
|
--dangerously-skip-verification Skip all signature verification (DANGEROUS - not recommended for production)
|
|
230241
230291
|
--verify-policy Verification policy: permissive, enterprise, paranoid (default: permissive)
|
|
230242
230292
|
|
|
@@ -230249,6 +230299,7 @@ Examples:
|
|
|
230249
230299
|
enact exec enact/text/slugify --input "Hello World"
|
|
230250
230300
|
enact exec org/ai/review --params '{"file": "README.md"}' --verify-policy enterprise
|
|
230251
230301
|
enact exec ./my-tool.yaml --input "test data"
|
|
230302
|
+
enact exec kgroves/tools/prettier --mount ./src:/workspace/src
|
|
230252
230303
|
enact exec untrusted/tool --dangerously-skip-verification # DANGEROUS, not recommended
|
|
230253
230304
|
`);
|
|
230254
230305
|
return;
|
|
@@ -230443,7 +230494,8 @@ Environment variables:`));
|
|
|
230443
230494
|
timeout: options.timeout,
|
|
230444
230495
|
dryRun: options.dry,
|
|
230445
230496
|
verbose: options.verbose,
|
|
230446
|
-
isLocalFile
|
|
230497
|
+
isLocalFile,
|
|
230498
|
+
mount: options.mount
|
|
230447
230499
|
};
|
|
230448
230500
|
try {
|
|
230449
230501
|
console.error(import_picocolors13.default.cyan(`
|
|
@@ -231099,6 +231151,9 @@ var { values, positionals } = parseArgs({
|
|
|
231099
231151
|
},
|
|
231100
231152
|
client: {
|
|
231101
231153
|
type: "string"
|
|
231154
|
+
},
|
|
231155
|
+
mount: {
|
|
231156
|
+
type: "string"
|
|
231102
231157
|
}
|
|
231103
231158
|
},
|
|
231104
231159
|
allowPositionals: true,
|
|
@@ -231169,7 +231224,8 @@ async function main() {
|
|
|
231169
231224
|
timeout: values.timeout,
|
|
231170
231225
|
dry: values.dry,
|
|
231171
231226
|
verbose: values.verbose,
|
|
231172
|
-
dangerouslySkipVerification: values["dangerously-skip-verification"]
|
|
231227
|
+
dangerouslySkipVerification: values["dangerously-skip-verification"],
|
|
231228
|
+
mount: values.mount
|
|
231173
231229
|
});
|
|
231174
231230
|
break;
|
|
231175
231231
|
case "get":
|
package/dist/index.js.bak
CHANGED
|
@@ -226387,6 +226387,49 @@ class DaggerExecutionProvider extends ExecutionProvider {
|
|
|
226387
226387
|
});
|
|
226388
226388
|
});
|
|
226389
226389
|
}
|
|
226390
|
+
async setupDirectoryMount(client, container, mountSpec) {
|
|
226391
|
+
try {
|
|
226392
|
+
let localPath2;
|
|
226393
|
+
let containerPath;
|
|
226394
|
+
const colonIndex = mountSpec.indexOf(":");
|
|
226395
|
+
if (colonIndex > 0) {
|
|
226396
|
+
const potentialDriveLetter = mountSpec.substring(0, colonIndex);
|
|
226397
|
+
const isWindowsDrive = potentialDriveLetter.length === 1 && /[A-Za-z]/.test(potentialDriveLetter);
|
|
226398
|
+
if (isWindowsDrive) {
|
|
226399
|
+
const nextColonIndex = mountSpec.indexOf(":", colonIndex + 1);
|
|
226400
|
+
if (nextColonIndex > 0) {
|
|
226401
|
+
localPath2 = mountSpec.substring(0, nextColonIndex);
|
|
226402
|
+
containerPath = mountSpec.substring(nextColonIndex + 1);
|
|
226403
|
+
} else {
|
|
226404
|
+
localPath2 = mountSpec;
|
|
226405
|
+
containerPath = "/workspace/src";
|
|
226406
|
+
}
|
|
226407
|
+
} else {
|
|
226408
|
+
localPath2 = mountSpec.substring(0, colonIndex);
|
|
226409
|
+
containerPath = mountSpec.substring(colonIndex + 1);
|
|
226410
|
+
}
|
|
226411
|
+
} else if (colonIndex === 0) {
|
|
226412
|
+
localPath2 = "";
|
|
226413
|
+
containerPath = mountSpec.substring(1);
|
|
226414
|
+
} else {
|
|
226415
|
+
localPath2 = mountSpec;
|
|
226416
|
+
containerPath = "/workspace/src";
|
|
226417
|
+
}
|
|
226418
|
+
const path8 = __require("path");
|
|
226419
|
+
const resolvedLocalPath = path8.resolve(localPath2);
|
|
226420
|
+
const fs5 = __require("fs");
|
|
226421
|
+
if (!fs5.existsSync(resolvedLocalPath)) {
|
|
226422
|
+
throw new Error(`Mount source directory does not exist: ${resolvedLocalPath}`);
|
|
226423
|
+
}
|
|
226424
|
+
const hostDirectory = client.host().directory(resolvedLocalPath);
|
|
226425
|
+
container = container.withMountedDirectory(containerPath, hostDirectory);
|
|
226426
|
+
logger_default.debug(`\uD83D\uDCC2 Mounted ${resolvedLocalPath} -> ${containerPath}`);
|
|
226427
|
+
return container;
|
|
226428
|
+
} catch (error2) {
|
|
226429
|
+
logger_default.error(`Failed to setup directory mount: ${error2}`);
|
|
226430
|
+
throw error2;
|
|
226431
|
+
}
|
|
226432
|
+
}
|
|
226390
226433
|
async setupContainer(client, environment, inputs, tool) {
|
|
226391
226434
|
const containerImage = tool?.from || this.options.baseImage;
|
|
226392
226435
|
logger_default.debug(`\uD83D\uDE80 Setting up container with image: ${containerImage}${tool?.from ? " (from tool.from)" : " (default baseImage)"}`);
|
|
@@ -226394,6 +226437,9 @@ class DaggerExecutionProvider extends ExecutionProvider {
|
|
|
226394
226437
|
logger_default.debug("\uD83D\uDCE6 Base container created");
|
|
226395
226438
|
container = container.withWorkdir(this.options.workdir);
|
|
226396
226439
|
logger_default.debug(`\uD83D\uDCC1 Working directory set to: ${this.options.workdir}`);
|
|
226440
|
+
if (environment.mount) {
|
|
226441
|
+
container = await this.setupDirectoryMount(client, container, environment.mount);
|
|
226442
|
+
}
|
|
226397
226443
|
for (const [key, value] of Object.entries(environment.vars)) {
|
|
226398
226444
|
container = container.withEnvVariable(key, String(value));
|
|
226399
226445
|
}
|
|
@@ -229669,7 +229715,10 @@ class EnactCore {
|
|
|
229669
229715
|
throw new Error(`Tool ${tool.name} does not have any signatures`);
|
|
229670
229716
|
}
|
|
229671
229717
|
const documentForVerification = {
|
|
229672
|
-
command: tool.command
|
|
229718
|
+
command: tool.command,
|
|
229719
|
+
description: tool.description,
|
|
229720
|
+
from: tool.from,
|
|
229721
|
+
name: tool.name
|
|
229673
229722
|
};
|
|
229674
229723
|
const referenceSignature = {
|
|
229675
229724
|
signature: tool.signatures[0].value,
|
|
@@ -229677,12 +229726,11 @@ class EnactCore {
|
|
|
229677
229726
|
algorithm: tool.signatures[0].algorithm,
|
|
229678
229727
|
timestamp: new Date(tool.signatures[0].created).getTime()
|
|
229679
229728
|
};
|
|
229680
|
-
const canonicalDoc = SigningService.getCanonicalDocument(documentForVerification, { includeFields: ["command"] });
|
|
229729
|
+
const canonicalDoc = SigningService.getCanonicalDocument(documentForVerification, { includeFields: ["command", "description", "from", "name"] });
|
|
229681
229730
|
const docString = JSON.stringify(canonicalDoc);
|
|
229682
229731
|
const messageHash = CryptoUtils.hash(docString);
|
|
229683
229732
|
const directVerify = CryptoUtils.verify(referenceSignature.publicKey, messageHash, referenceSignature.signature);
|
|
229684
|
-
const isValid = SigningService.verifyDocument(documentForVerification, referenceSignature, { includeFields: ["command"] });
|
|
229685
|
-
console.log("Final verification result:", isValid);
|
|
229733
|
+
const isValid = SigningService.verifyDocument(documentForVerification, referenceSignature, { includeFields: ["command", "description", "from", "name"] });
|
|
229686
229734
|
if (!isValid) {
|
|
229687
229735
|
throw new Error(`Tool ${tool.name} has invalid signatures`);
|
|
229688
229736
|
}
|
|
@@ -229712,7 +229760,8 @@ class EnactCore {
|
|
|
229712
229760
|
vars: { ...envVars, ...validatedInputs },
|
|
229713
229761
|
resources: {
|
|
229714
229762
|
timeout: options.timeout || tool.timeout || this.options.defaultTimeout
|
|
229715
|
-
}
|
|
229763
|
+
},
|
|
229764
|
+
mount: options.mount
|
|
229716
229765
|
});
|
|
229717
229766
|
} catch (error2) {
|
|
229718
229767
|
return {
|
|
@@ -230236,6 +230285,7 @@ Options:
|
|
|
230236
230285
|
--timeout <time> Override tool timeout (Go duration format: 30s, 5m, 1h)
|
|
230237
230286
|
--dry Show command that would be executed without running it
|
|
230238
230287
|
--verbose, -v Show detailed execution information
|
|
230288
|
+
--mount <path> Mount local directory to container (format: "local:container")
|
|
230239
230289
|
--dangerously-skip-verification Skip all signature verification (DANGEROUS - not recommended for production)
|
|
230240
230290
|
--verify-policy Verification policy: permissive, enterprise, paranoid (default: permissive)
|
|
230241
230291
|
|
|
@@ -230248,6 +230298,7 @@ Examples:
|
|
|
230248
230298
|
enact exec enact/text/slugify --input "Hello World"
|
|
230249
230299
|
enact exec org/ai/review --params '{"file": "README.md"}' --verify-policy enterprise
|
|
230250
230300
|
enact exec ./my-tool.yaml --input "test data"
|
|
230301
|
+
enact exec kgroves/tools/prettier --mount ./src:/workspace/src
|
|
230251
230302
|
enact exec untrusted/tool --dangerously-skip-verification # DANGEROUS, not recommended
|
|
230252
230303
|
`);
|
|
230253
230304
|
return;
|
|
@@ -230442,7 +230493,8 @@ Environment variables:`));
|
|
|
230442
230493
|
timeout: options.timeout,
|
|
230443
230494
|
dryRun: options.dry,
|
|
230444
230495
|
verbose: options.verbose,
|
|
230445
|
-
isLocalFile
|
|
230496
|
+
isLocalFile,
|
|
230497
|
+
mount: options.mount
|
|
230446
230498
|
};
|
|
230447
230499
|
try {
|
|
230448
230500
|
console.error(import_picocolors13.default.cyan(`
|
|
@@ -231098,6 +231150,9 @@ var { values, positionals } = parseArgs({
|
|
|
231098
231150
|
},
|
|
231099
231151
|
client: {
|
|
231100
231152
|
type: "string"
|
|
231153
|
+
},
|
|
231154
|
+
mount: {
|
|
231155
|
+
type: "string"
|
|
231101
231156
|
}
|
|
231102
231157
|
},
|
|
231103
231158
|
allowPositionals: true,
|
|
@@ -231168,7 +231223,8 @@ async function main() {
|
|
|
231168
231223
|
timeout: values.timeout,
|
|
231169
231224
|
dry: values.dry,
|
|
231170
231225
|
verbose: values.verbose,
|
|
231171
|
-
dangerouslySkipVerification: values["dangerously-skip-verification"]
|
|
231226
|
+
dangerouslySkipVerification: values["dangerously-skip-verification"],
|
|
231227
|
+
mount: values.mount
|
|
231172
231228
|
});
|
|
231173
231229
|
break;
|
|
231174
231230
|
case "get":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enactprotocol/cli",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.6",
|
|
4
4
|
"description": "Official CLI for the Enact Protocol - package, secure, and discover AI tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"node": ">=18.0.0"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@enactprotocol/shared": "1.2.
|
|
45
|
+
"@enactprotocol/shared": "1.2.6",
|
|
46
46
|
"@clack/core": "^0.4.2",
|
|
47
47
|
"@clack/prompts": "^0.10.1",
|
|
48
48
|
"picocolors": "^1.1.1"
|