📦 deps(thirdparty): update snapshots
This commit is contained in:
@@ -35,7 +35,7 @@ function loadOfflineIdentity(root) {
|
||||
if (`${canonicalJson(manifest)}\n` !== text || manifest.schemaVersion !== 1 || manifest.digestVersion !== 1
|
||||
|| manifest.package !== CATALOG_PACKAGE || typeof manifest.packageVersion !== "string"
|
||||
|| !/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/.test(manifest.packageVersion)
|
||||
|| manifest.metadataSchemaVersion !== versions.metadataSchemaVersion || !Array.isArray(manifest.assets)) {
|
||||
|| manifest.catalogSchemaVersion !== versions.catalogSchemaVersion || !Array.isArray(manifest.assets)) {
|
||||
throw new Error("Offline catalog manifest is invalid or incompatible");
|
||||
}
|
||||
const assets = manifest.assets.map((asset) => {
|
||||
@@ -43,57 +43,24 @@ function loadOfflineIdentity(root) {
|
||||
return { path: asset.path, size: bytes.length, sha256: sha256(bytes) };
|
||||
}).sort((left, right) => compareStrings(left.path, right.path));
|
||||
const digest = sha256(canonicalJson({ digestVersion: 1, assets }));
|
||||
if (digest !== manifest.catalogDigest || manifest.skillCount !== 1965) throw new Error("Offline catalog identity mismatch");
|
||||
const indexAsset = manifest.assets.find((asset) => asset.path === CONTENT_INDEX);
|
||||
if (!indexAsset) throw new Error("Offline catalog content index is missing");
|
||||
const contentIndex = JSON.parse(readVerifiedAsset(root, indexAsset));
|
||||
return { digest, manifest, contentIndex };
|
||||
}
|
||||
|
||||
function judgment(value, evidence = []) {
|
||||
if (value === null || value === undefined || value === "unknown") {
|
||||
return { status: "unknown", value: null, evidence: [] };
|
||||
const indexedSkillCount = Object.keys(contentIndex?.entries || {}).length;
|
||||
if (digest !== manifest.catalogDigest || !Number.isSafeInteger(manifest.skillCount)
|
||||
|| manifest.skillCount <= 0 || manifest.skillCount !== indexedSkillCount) {
|
||||
throw new Error("Offline catalog identity mismatch");
|
||||
}
|
||||
return { status: "known", value, evidence };
|
||||
}
|
||||
|
||||
function notApplicable(evidence = []) {
|
||||
return { status: "notApplicable", value: null, evidence };
|
||||
}
|
||||
|
||||
function reviewedJudgment(reviewed, field, evidence, fallback = null) {
|
||||
const value = reviewed[field];
|
||||
if (!value) return fallback || judgment(null);
|
||||
if (value.status === "known") return judgment(value.value, evidence);
|
||||
if (value.status === "notApplicable") return notApplicable(evidence);
|
||||
return judgment(null);
|
||||
return { digest, manifest, contentIndex };
|
||||
}
|
||||
|
||||
function loadBundledCatalog(options = {}) {
|
||||
const root = path.resolve(options.root || path.resolve(__dirname, "../../.."));
|
||||
const offline = loadOfflineIdentity(root);
|
||||
const catalogPath = options.catalogPath || path.join(root, "data", "catalog.json");
|
||||
const compatibilityPath = options.compatibilityPath || path.join(root, "data", "plugin-compatibility.json");
|
||||
const raw = JSON.parse(fs.readFileSync(catalogPath, "utf8"));
|
||||
const compatibility = JSON.parse(fs.readFileSync(compatibilityPath, "utf8"));
|
||||
const overrides = JSON.parse(fs.readFileSync(path.join(root, "tools/lib/aas-v1/metadata-overrides.v1.json"), "utf8"));
|
||||
const compatibilityById = new Map((compatibility.skills || []).map((entry) => [entry.id, entry]));
|
||||
const skills = (raw.skills || []).map((entry) => {
|
||||
const canonicalId = entry.canonical_id || entry.id;
|
||||
const plugin = compatibilityById.get(entry.id) || {};
|
||||
const reviewed = overrides.skills[canonicalId] || {};
|
||||
const evidence = Array.isArray(reviewed.evidence) ? reviewed.evidence : [];
|
||||
const capabilities = sortedUnique(reviewed.capabilities || []);
|
||||
const capabilityJudgment = reviewed.reviewDecision === "not-supported"
|
||||
? notApplicable(evidence)
|
||||
: (capabilities.length ? judgment(capabilities, evidence) : judgment(null));
|
||||
const targets = Object.fromEntries(["codex", "claude"].map((host) => {
|
||||
if (reviewed.targets?.[host]) return [host, reviewedJudgment(reviewed.targets, host, evidence)];
|
||||
if (plugin.targets?.[host] === "blocked") {
|
||||
return [host, judgment("blocked", [{ type: "compatibility-finding", path: `plugin.blocked_reasons.${host}` }])];
|
||||
}
|
||||
return [host, judgment(null)];
|
||||
}));
|
||||
const contentRef = offline.contentIndex.entries?.[canonicalId];
|
||||
if (!contentRef || !Number.isSafeInteger(contentRef.offset) || !Number.isSafeInteger(contentRef.length)
|
||||
|| !/^sha256-[a-f0-9]{64}$/.test(contentRef.sha256)) {
|
||||
@@ -115,25 +82,6 @@ function loadBundledCatalog(options = {}) {
|
||||
...(entry.tags || []),
|
||||
...(entry.triggers || []),
|
||||
])),
|
||||
recommendationTokens: sortedUnique(tokenize([
|
||||
entry.description,
|
||||
entry.category,
|
||||
...(entry.tags || []),
|
||||
...(entry.triggers || []),
|
||||
])),
|
||||
metadata: {
|
||||
capabilities: capabilityJudgment,
|
||||
risk: reviewedJudgment(reviewed, "risk", evidence, judgment(entry.risk, [{ type: "catalog-field", path: "risk" }])),
|
||||
source: reviewedJudgment(reviewed, "source", evidence),
|
||||
license: judgment(entry.license, entry.license ? [{ type: "catalog-field", path: "license" }] : []),
|
||||
targets,
|
||||
setup: reviewedJudgment(reviewed, "setup", evidence),
|
||||
dependencies: reviewedJudgment(reviewed, "dependencies", evidence),
|
||||
conflicts: reviewedJudgment(reviewed, "conflicts", evidence),
|
||||
validation: reviewedJudgment(reviewed, "validation", evidence),
|
||||
tests: reviewedJudgment(reviewed, "tests", evidence),
|
||||
reviews: reviewedJudgment(reviewed, "reviews", evidence),
|
||||
},
|
||||
untrustedContentPath: entry.path || null,
|
||||
untrustedContentRef: {
|
||||
assetPath: "data/aas-v1/skill-content.v1.ndjson",
|
||||
@@ -158,9 +106,9 @@ function syntheticCatalog(skills, identity = {}) {
|
||||
schemaVersion: 1,
|
||||
package: identity.package || "synthetic-aas-catalog",
|
||||
version: identity.version || "1.0.0",
|
||||
digest: sha256(canonicalJson({ metadataSchemaVersion: versions.metadataSchemaVersion, skills: normalized })),
|
||||
digest: sha256(canonicalJson({ catalogSchemaVersion: versions.catalogSchemaVersion, skills: normalized })),
|
||||
skills: normalized,
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = { judgment, notApplicable, reviewedJudgment, loadBundledCatalog, syntheticCatalog };
|
||||
module.exports = { loadBundledCatalog, syntheticCatalog };
|
||||
|
||||
Reference in New Issue
Block a user