@verentis/cli 1.0.2 → 1.0.4
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 +17 -0
- package/dist/index.js +98 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -151,6 +151,21 @@ verentis pack samples/agent --publisher verentis --no-sign # local test only:
|
|
|
151
151
|
The Application sample shows `spec.tools` bindings for an app backend and an app-owned MCP
|
|
152
152
|
server. The Tool sample shows an external MCP server fixture with a credential reference.
|
|
153
153
|
|
|
154
|
+
Agent manifests (`agent.v1`) may request what the agent's own identity needs; an admin consents to it
|
|
155
|
+
when the agent is installed, and a run may only do what both the person running it and the agent may do:
|
|
156
|
+
|
|
157
|
+
```yaml
|
|
158
|
+
spec:
|
|
159
|
+
permissions: [file.read] # scopes, consented like an Application's spec.permissions
|
|
160
|
+
file-access: # at most 64; path absolute or relative to the manifest folder
|
|
161
|
+
- { path: /shared/reference, mode: read, reason: Cite the shared reference material }
|
|
162
|
+
ui: [openui] # may answer with OpenUI interfaces
|
|
163
|
+
model: { profile: standard, choice: open, allowed: [standard, reasoning] } # allowed only with choice: open
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
`verentis validate` and `pack` require a `reason` on every agent `file-access` entry and reject the removed
|
|
167
|
+
`spec.capabilities.files` (use `spec.file-access`); `spec.capabilities.network` and `.execution` remain.
|
|
168
|
+
|
|
154
169
|
## Workspace policy manifests
|
|
155
170
|
|
|
156
171
|
Policy manifests (`kind: Policy`) are not marketplace packages; `verentis validate` accepts them
|
|
@@ -527,6 +542,8 @@ categories) lives in the signed manifest — change it and publish a new version
|
|
|
527
542
|
|
|
528
543
|
`verentis install` replaces an existing installation of the same package in the workspace branch in place, like the
|
|
529
544
|
marketplace install dialog. This upgrades or reinstalls an installed package and retries a `Failed` installation.
|
|
545
|
+
Installing or replacing an Application or an Agent records the manifest consent on its installation, so the CLI
|
|
546
|
+
also requests `installation.read` and `app.read` for that call.
|
|
530
547
|
|
|
531
548
|
### Publisher publishing from GitHub Actions
|
|
532
549
|
|
package/dist/index.js
CHANGED
|
@@ -1379,6 +1379,10 @@ var findPackageType = (type) => packageTypes().find(type);
|
|
|
1379
1379
|
var canonicalPackageType = (type) => packageTypes().canonical(type);
|
|
1380
1380
|
var packageTypeProfile = (type) => packageTypes().find(type)?.profile;
|
|
1381
1381
|
var isApplicationProfile = (type) => packageTypeProfile(type) === "application";
|
|
1382
|
+
var recordsInstallationConsent = (type) => {
|
|
1383
|
+
const descriptor = findPackageType(type);
|
|
1384
|
+
return descriptor?.profile === "application" || descriptor?.resourceKind === "Agent";
|
|
1385
|
+
};
|
|
1382
1386
|
async function refreshPackageTypes(apiUrl, options = {}) {
|
|
1383
1387
|
if (process.env.VERENTIS_PACKAGE_TYPES_CACHE === "0") return false;
|
|
1384
1388
|
try {
|
|
@@ -1476,6 +1480,7 @@ function collectIconFields(manifest) {
|
|
|
1476
1480
|
}
|
|
1477
1481
|
bindings(spec["mime-types"], ["spec", "mime-types"]);
|
|
1478
1482
|
bindings(spec["file-types"], ["spec", "file-types"]);
|
|
1483
|
+
bindings(spec.creatables, ["spec", "creatables"]);
|
|
1479
1484
|
return fields;
|
|
1480
1485
|
}
|
|
1481
1486
|
async function resolveManifestIcons(manifest, manifestDir) {
|
|
@@ -1945,6 +1950,88 @@ function hasRasterSignature(path, bytes) {
|
|
|
1945
1950
|
return false;
|
|
1946
1951
|
}
|
|
1947
1952
|
|
|
1953
|
+
// src/vpkg/agent.ts
|
|
1954
|
+
var AGENT_UI_FORMATS = ["openui"];
|
|
1955
|
+
var AGENT_MODEL_CHOICES = ["fixed", "open"];
|
|
1956
|
+
var AGENT_CAPABILITIES = ["network", "execution"];
|
|
1957
|
+
var AGENT_FILE_ACCESS_KEYS = ["path", "mode", "reason"];
|
|
1958
|
+
var isRecord4 = (value) => !!value && typeof value === "object" && !Array.isArray(value);
|
|
1959
|
+
var isNonEmptyString = (value) => typeof value === "string" && value.trim().length > 0;
|
|
1960
|
+
function validateAgentSpec(kind, spec) {
|
|
1961
|
+
if (findPackageType(kind)?.resourceKind !== "Agent" || !isRecord4(spec)) return [];
|
|
1962
|
+
return [
|
|
1963
|
+
...stringListErrors(spec.permissions, "spec.permissions", "a list of permission names (scopes)"),
|
|
1964
|
+
...fileAccessErrors(spec["file-access"]),
|
|
1965
|
+
...uiErrors(spec.ui),
|
|
1966
|
+
...modelErrors(spec.model),
|
|
1967
|
+
...capabilityErrors(spec.capabilities)
|
|
1968
|
+
];
|
|
1969
|
+
}
|
|
1970
|
+
function stringListErrors(value, label, expected, unique = false) {
|
|
1971
|
+
if (value === void 0) return [];
|
|
1972
|
+
if (!Array.isArray(value)) return [`${label} must be ${expected}.`];
|
|
1973
|
+
const errors = [];
|
|
1974
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1975
|
+
value.forEach((item, index) => {
|
|
1976
|
+
if (!isNonEmptyString(item)) errors.push(`${label}[${index}] must be a non-empty string.`);
|
|
1977
|
+
else if (unique && seen.has(item)) errors.push(`${label} contains duplicate '${item}'.`);
|
|
1978
|
+
else seen.add(item);
|
|
1979
|
+
});
|
|
1980
|
+
return errors;
|
|
1981
|
+
}
|
|
1982
|
+
function fileAccessErrors(value) {
|
|
1983
|
+
if (!Array.isArray(value)) return [];
|
|
1984
|
+
const errors = [];
|
|
1985
|
+
value.forEach((entry, index) => {
|
|
1986
|
+
if (!isRecord4(entry)) return;
|
|
1987
|
+
const at = `spec.file-access[${index}]`;
|
|
1988
|
+
for (const key of Object.keys(entry).filter((key2) => !AGENT_FILE_ACCESS_KEYS.includes(key2))) {
|
|
1989
|
+
errors.push(`${at}.${key} is not supported for Agent manifests (declare path, mode and reason).`);
|
|
1990
|
+
}
|
|
1991
|
+
if (entry.reason === void 0 || typeof entry.reason === "string" && !entry.reason.trim()) {
|
|
1992
|
+
errors.push(`${at}.reason is required: say why the agent needs this folder (shown when the agent is installed).`);
|
|
1993
|
+
}
|
|
1994
|
+
});
|
|
1995
|
+
return errors;
|
|
1996
|
+
}
|
|
1997
|
+
function uiErrors(value) {
|
|
1998
|
+
if (value === void 0) return [];
|
|
1999
|
+
const expected = AGENT_UI_FORMATS.join(", ");
|
|
2000
|
+
if (!Array.isArray(value)) return [`spec.ui must be a list of interface formats (${expected}).`];
|
|
2001
|
+
const errors = [];
|
|
2002
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2003
|
+
value.forEach((item, index) => {
|
|
2004
|
+
if (!AGENT_UI_FORMATS.includes(item)) {
|
|
2005
|
+
errors.push(`spec.ui[${index}] '${String(item)}' is not supported (expected ${expected}).`);
|
|
2006
|
+
} else if (seen.has(item)) {
|
|
2007
|
+
errors.push(`spec.ui contains duplicate '${String(item)}'.`);
|
|
2008
|
+
}
|
|
2009
|
+
seen.add(item);
|
|
2010
|
+
});
|
|
2011
|
+
return errors;
|
|
2012
|
+
}
|
|
2013
|
+
function modelErrors(value) {
|
|
2014
|
+
if (value === void 0 || isNonEmptyString(value)) return [];
|
|
2015
|
+
if (!isRecord4(value)) return ["spec.model must be a model profile name or a mapping with profile."];
|
|
2016
|
+
const errors = [];
|
|
2017
|
+
const choice = value.choice ?? "fixed";
|
|
2018
|
+
if (!AGENT_MODEL_CHOICES.includes(choice)) {
|
|
2019
|
+
errors.push(`spec.model.choice must be ${AGENT_MODEL_CHOICES.map((c) => `'${c}'`).join(" or ")}.`);
|
|
2020
|
+
}
|
|
2021
|
+
if (value.allowed !== void 0) {
|
|
2022
|
+
if (choice !== "open") errors.push("spec.model.allowed is only valid with spec.model.choice: open.");
|
|
2023
|
+
errors.push(...stringListErrors(value.allowed, "spec.model.allowed", "a list of model profile names", true));
|
|
2024
|
+
}
|
|
2025
|
+
return errors;
|
|
2026
|
+
}
|
|
2027
|
+
function capabilityErrors(value) {
|
|
2028
|
+
if (value === void 0) return [];
|
|
2029
|
+
if (!isRecord4(value)) {
|
|
2030
|
+
return ["spec.capabilities must be a mapping (network, execution) for Agent manifests; declare folders in spec.file-access."];
|
|
2031
|
+
}
|
|
2032
|
+
return Object.keys(value).filter((key) => !AGENT_CAPABILITIES.includes(key)).map((key) => key === "files" ? "spec.capabilities.files is no longer supported; declare the folders the agent works in under spec.file-access ([{ path, mode: read|write, reason }]), consented when the agent is installed." : `spec.capabilities.${key} is not supported (expected ${AGENT_CAPABILITIES.join(" or ")}).`);
|
|
2033
|
+
}
|
|
2034
|
+
|
|
1948
2035
|
// src/vpkg/manifest.ts
|
|
1949
2036
|
var METADATA_ID_REQUIRED_MESSAGE = "metadata.id is required";
|
|
1950
2037
|
var LEGACY_PACKAGE_ID_MESSAGE = "metadata.package-id is no longer supported; use metadata.id";
|
|
@@ -2020,7 +2107,8 @@ function validatePackageManifestRules(kind, manifest) {
|
|
|
2020
2107
|
...validateMetadataTags(manifest.metadata?.tags),
|
|
2021
2108
|
...validateTypeSpecFields(kind, manifest.spec),
|
|
2022
2109
|
...validateTypeManifest(kind, manifest),
|
|
2023
|
-
...validateAgentAvatarManifest(kind, manifest.spec)
|
|
2110
|
+
...validateAgentAvatarManifest(kind, manifest.spec),
|
|
2111
|
+
...validateAgentSpec(kind, manifest.spec)
|
|
2024
2112
|
];
|
|
2025
2113
|
}
|
|
2026
2114
|
function validateLaunchManifestKind(kind, spec) {
|
|
@@ -2638,6 +2726,7 @@ function validateManifest(manifest) {
|
|
|
2638
2726
|
if (descriptor?.resourceKind === "Tool") validateToolManifest(spec, issues);
|
|
2639
2727
|
if (isPolicy) validatePolicyManifest(spec, issues);
|
|
2640
2728
|
for (const message of validateAgentAvatarManifest(kind, spec)) error(message);
|
|
2729
|
+
for (const message of validateAgentSpec(kind, spec)) error(message);
|
|
2641
2730
|
validateInstallDirectives(spec.install, issues);
|
|
2642
2731
|
validateSettingDeclarations(descriptor?.profile === "engine", spec, issues);
|
|
2643
2732
|
for (const message of validateMarketplaceSection(manifest.marketplace)) error(message);
|
|
@@ -2764,7 +2853,7 @@ function validateBindingIcons(bindings, path, issues) {
|
|
|
2764
2853
|
});
|
|
2765
2854
|
}
|
|
2766
2855
|
function validateOptionalIcon(value, path, issues) {
|
|
2767
|
-
if (value !== void 0 && !
|
|
2856
|
+
if (value !== void 0 && !isNonEmptyString2(value)) {
|
|
2768
2857
|
issues.push({ level: "error", message: `${path} must be a non-empty string` });
|
|
2769
2858
|
}
|
|
2770
2859
|
}
|
|
@@ -2800,7 +2889,7 @@ function validateApplicationLaunch(spec, issues) {
|
|
|
2800
2889
|
error("spec.launch.enabled requires spec.entry or spec.launch.entry-point");
|
|
2801
2890
|
}
|
|
2802
2891
|
}
|
|
2803
|
-
function
|
|
2892
|
+
function isNonEmptyString2(value) {
|
|
2804
2893
|
return typeof value === "string" && value.trim().length > 0;
|
|
2805
2894
|
}
|
|
2806
2895
|
function resolvesIframeEntry(baseEntry, routeOrEntry) {
|
|
@@ -2808,7 +2897,7 @@ function resolvesIframeEntry(baseEntry, routeOrEntry) {
|
|
|
2808
2897
|
return isAbsoluteHttpUrl(baseEntry);
|
|
2809
2898
|
}
|
|
2810
2899
|
function isAbsoluteHttpUrl(value) {
|
|
2811
|
-
if (!
|
|
2900
|
+
if (!isNonEmptyString2(value)) return false;
|
|
2812
2901
|
try {
|
|
2813
2902
|
const url = new URL(value);
|
|
2814
2903
|
return url.protocol === "http:" || url.protocol === "https:";
|
|
@@ -5384,11 +5473,11 @@ async function pack(options) {
|
|
|
5384
5473
|
manifest = typeValidator?.expandForPack ? typeValidator.expandForPack(manifest) : manifest;
|
|
5385
5474
|
const normalizedSpec = normalizeDependencies(manifest.spec);
|
|
5386
5475
|
if (normalizedSpec !== manifest.spec) manifest = { ...manifest, spec: normalizedSpec };
|
|
5387
|
-
const
|
|
5476
|
+
const fileAccessErrors2 = validateFileAccess(manifest.spec?.["file-access"], "spec.file-access", MAX_PACKAGE_FILE_ACCESS);
|
|
5388
5477
|
const scriptAccess = await collectScriptFileAccess(projectDir, manifest.spec);
|
|
5389
|
-
|
|
5390
|
-
if (
|
|
5391
|
-
${
|
|
5478
|
+
fileAccessErrors2.push(...scriptAccess.errors);
|
|
5479
|
+
if (fileAccessErrors2.length > 0) throw new Error(`Invalid file-access:
|
|
5480
|
+
${fileAccessErrors2.join("\n ")}`);
|
|
5392
5481
|
const accessSpec = mergeFileAccess(manifest.spec, scriptAccess.entries);
|
|
5393
5482
|
if (accessSpec !== manifest.spec) manifest = { ...manifest, spec: accessSpec };
|
|
5394
5483
|
const packageAccessErrors = validateFileAccess(manifest.spec?.["file-access"], "spec.file-access", MAX_PACKAGE_FILE_ACCESS);
|
|
@@ -6323,7 +6412,7 @@ function registerRegistry(program2) {
|
|
|
6323
6412
|
);
|
|
6324
6413
|
const existing = pageItems(page).find((installation) => installation.status !== "Uninstalled");
|
|
6325
6414
|
const nodeScopes = [NODE.nodeCreate, NODE.fileRead];
|
|
6326
|
-
const consentScopes =
|
|
6415
|
+
const consentScopes = recordsInstallationConsent(pkg.type ?? pkg.kind) ? [SCOPES.installationRead, SCOPES.resourceReadAll, SCOPES.resourceUpdate] : [];
|
|
6327
6416
|
if (existing) {
|
|
6328
6417
|
if (options.path && existing.installPath !== options.path.replace(/^\/+|\/+$/g, "")) {
|
|
6329
6418
|
throw new Error(`${ref} is already installed at '${existing.installPath}'. Uninstall it before moving it.`);
|