@verentis/cli 1.0.6 → 1.0.7
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 +13 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2443,14 +2443,14 @@ function hasRasterSignature(path, bytes) {
|
|
|
2443
2443
|
var AGENT_UI_FORMATS = ["openui"];
|
|
2444
2444
|
var AGENT_MODEL_CHOICES = ["fixed", "open"];
|
|
2445
2445
|
var AGENT_CAPABILITIES = ["network", "execution"];
|
|
2446
|
-
var AGENT_FILE_ACCESS_KEYS = ["path", "mode", "reason"];
|
|
2446
|
+
var AGENT_FILE_ACCESS_KEYS = ["path", "mode", "execute", "reason"];
|
|
2447
2447
|
var isRecord4 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
2448
2448
|
var isNonEmptyString = (value) => typeof value === "string" && value.trim().length > 0;
|
|
2449
2449
|
function validateAgentSpec(kind, spec) {
|
|
2450
2450
|
if (findPackageType(kind)?.resourceKind !== "Agent" || !isRecord4(spec)) return [];
|
|
2451
2451
|
return [
|
|
2452
2452
|
...stringListErrors(spec.permissions, "spec.permissions", "a list of permission names (scopes)"),
|
|
2453
|
-
...fileAccessErrors(spec["file-access"]),
|
|
2453
|
+
...fileAccessErrors(spec["file-access"], spec.permissions),
|
|
2454
2454
|
...uiErrors(spec.ui),
|
|
2455
2455
|
...modelErrors(spec.model),
|
|
2456
2456
|
...capabilityErrors(spec.capabilities),
|
|
@@ -2493,14 +2493,20 @@ function stringListErrors(value, label, expected, unique = false) {
|
|
|
2493
2493
|
});
|
|
2494
2494
|
return errors;
|
|
2495
2495
|
}
|
|
2496
|
-
function fileAccessErrors(value) {
|
|
2496
|
+
function fileAccessErrors(value, permissions) {
|
|
2497
2497
|
if (!Array.isArray(value)) return [];
|
|
2498
|
+
const canRun = Array.isArray(permissions) && permissions.some((p) => typeof p === "string" && p.trim() === "execution.run");
|
|
2498
2499
|
const errors = [];
|
|
2499
2500
|
value.forEach((entry, index) => {
|
|
2500
2501
|
if (!isRecord4(entry)) return;
|
|
2501
2502
|
const at = `spec.file-access[${index}]`;
|
|
2502
2503
|
for (const key of Object.keys(entry).filter((key2) => !AGENT_FILE_ACCESS_KEYS.includes(key2))) {
|
|
2503
|
-
errors.push(`${at}.${key} is not supported for Agent manifests (declare path, mode and reason).`);
|
|
2504
|
+
errors.push(`${at}.${key} is not supported for Agent manifests (declare path, mode, execute and reason).`);
|
|
2505
|
+
}
|
|
2506
|
+
if (entry.execute !== void 0 && typeof entry.execute !== "boolean") {
|
|
2507
|
+
errors.push(`${at}.execute must be true or false.`);
|
|
2508
|
+
} else if (entry.execute === true && !canRun) {
|
|
2509
|
+
errors.push(`${at}.execute requires spec.permissions to declare execution.run (running programs stored in the folder).`);
|
|
2504
2510
|
}
|
|
2505
2511
|
if (entry.reason === void 0 || typeof entry.reason === "string" && !entry.reason.trim()) {
|
|
2506
2512
|
errors.push(`${at}.reason is required: say why the agent needs this folder (shown when the agent is installed).`);
|
|
@@ -5824,7 +5830,7 @@ function dependencyPackages(spec) {
|
|
|
5824
5830
|
function bundledConsentWarnings(agents, spec) {
|
|
5825
5831
|
const warnings = [];
|
|
5826
5832
|
const scopes = new Set(Array.isArray(spec.permissions) ? spec.permissions.filter((p) => typeof p === "string") : []);
|
|
5827
|
-
const grants = (Array.isArray(spec["file-access"]) ? spec["file-access"] : []).filter(isRecord5).filter((g2) => typeof g2.path === "string" && g2.path.startsWith("/") && (g2.mode === "read" || g2.mode === "write")).map((g2) => ({ path: trimSlash(g2.path), mode: g2.mode }));
|
|
5833
|
+
const grants = (Array.isArray(spec["file-access"]) ? spec["file-access"] : []).filter(isRecord5).filter((g2) => typeof g2.path === "string" && g2.path.startsWith("/") && (g2.mode === "read" || g2.mode === "write")).map((g2) => ({ path: trimSlash(g2.path), mode: g2.mode, execute: g2.execute === true }));
|
|
5828
5834
|
for (const agent of agents) {
|
|
5829
5835
|
const permissions = Array.isArray(agent.spec.permissions) ? agent.spec.permissions.filter((p) => typeof p === "string") : [];
|
|
5830
5836
|
const missing = permissions.filter((p) => !scopes.has(p));
|
|
@@ -5841,6 +5847,8 @@ function bundledConsentWarnings(agents, spec) {
|
|
|
5841
5847
|
const covered = grants.some((g2) => (path === g2.path || path.startsWith(`${g2.path}/`) || g2.path === "") && (g2.mode === "write" || entry.mode !== "write"));
|
|
5842
5848
|
if (!covered) {
|
|
5843
5849
|
warnings.push(`${agent.label}: spec.file-access '${entry.path}' (${String(entry.mode)}) isn't covered by the package's spec.file-access; a bundled agent only gets what the package is consented.`);
|
|
5850
|
+
} else if (entry.execute === true && !grants.some((g2) => g2.execute && (path === g2.path || path.startsWith(`${g2.path}/`) || g2.path === ""))) {
|
|
5851
|
+
warnings.push(`${agent.label}: spec.file-access '${entry.path}' asks to execute, which no package spec.file-access entry with execute: true covers; a bundled agent only gets what the package is consented.`);
|
|
5844
5852
|
}
|
|
5845
5853
|
}
|
|
5846
5854
|
}
|