📦 deps(thirdparty): update snapshots
This commit is contained in:
@@ -679,10 +679,9 @@ class McpServer {
|
||||
if (!Object.hasOwn(request, "id") || !isPlainObject(request.params)) {
|
||||
return this.rpcError(id, -32600, "Invalid Request");
|
||||
}
|
||||
if (request.params.protocolVersion !== core.protocolVersion) {
|
||||
return this.rpcError(id, -32602, "Unsupported protocol version", {
|
||||
code: "AAS_MCP_PROTOCOL_VERSION_INCOMPATIBLE",
|
||||
expected: core.protocolVersion,
|
||||
if (typeof request.params.protocolVersion !== "string" || request.params.protocolVersion.trim().length === 0) {
|
||||
return this.rpcError(id, -32602, "Invalid protocolVersion", {
|
||||
code: "AAS_MCP_PROTOCOL_VERSION_INVALID",
|
||||
});
|
||||
}
|
||||
this.initializeAccepted = true;
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
const { spawnSync } = require("child_process");
|
||||
|
||||
const FULL_SHA_PATTERN = /^[0-9a-f]{40}$/u;
|
||||
|
||||
function runCommand(command, args, cwd, options = {}) {
|
||||
const result = spawnSync(command, args, {
|
||||
cwd,
|
||||
encoding: "utf8",
|
||||
input: options.input,
|
||||
stdio: ["pipe", "pipe", "pipe"],
|
||||
});
|
||||
if (result.error) throw result.error;
|
||||
if (typeof result.status !== "number" || result.status !== 0) {
|
||||
throw new Error(result.stderr.trim() || `${command} ${args.join(" ")} failed with status ${result.status}`);
|
||||
}
|
||||
return result.stdout.trim();
|
||||
}
|
||||
|
||||
function resolveBlobSizes(projectRoot, records, options = {}) {
|
||||
const execute = options.runCommand || runCommand;
|
||||
const objectIds = [...new Set(records.flatMap((record) => [record.old_oid, record.new_oid]))]
|
||||
.filter((oid) => FULL_SHA_PATTERN.test(String(oid || "")) && !/^0+$/u.test(oid));
|
||||
if (!objectIds.length) {
|
||||
throw new Error("Raw Git diff did not contain any materialized blob object IDs.");
|
||||
}
|
||||
|
||||
const stdout = execute(
|
||||
"git",
|
||||
["cat-file", "--batch-check=%(objectname) %(objecttype) %(objectsize)"],
|
||||
projectRoot,
|
||||
{ capture: true, input: `${objectIds.join("\n")}\n` },
|
||||
);
|
||||
const sizes = new Map();
|
||||
for (const line of String(stdout || "").split(/\r?\n/u).filter(Boolean)) {
|
||||
const match = line.match(/^(?<oid>[0-9a-f]{40}) (?<type>\S+) (?<size>\d+)$/u);
|
||||
if (!match?.groups || !objectIds.includes(match.groups.oid)) {
|
||||
throw new Error(`Unexpected git cat-file response: ${line}`);
|
||||
}
|
||||
if (match.groups.type !== "blob") {
|
||||
throw new Error(`Object ${match.groups.oid} is ${match.groups.type}, not a blob.`);
|
||||
}
|
||||
const size = Number(match.groups.size);
|
||||
if (!Number.isSafeInteger(size) || size < 0) {
|
||||
throw new Error(`Object ${match.groups.oid} has an invalid size.`);
|
||||
}
|
||||
sizes.set(match.groups.oid, size);
|
||||
}
|
||||
for (const oid of objectIds) {
|
||||
if (!sizes.has(oid)) {
|
||||
throw new Error(`git cat-file did not return metadata for ${oid}.`);
|
||||
}
|
||||
}
|
||||
return sizes;
|
||||
}
|
||||
|
||||
module.exports = { resolveBlobSizes };
|
||||
@@ -317,6 +317,60 @@ function classifyChangeRecords(records, options = {}) {
|
||||
};
|
||||
}
|
||||
|
||||
function classifyShadowImpact(records, contract) {
|
||||
if (!Array.isArray(records) || records.length === 0) {
|
||||
return { profile: "unknown", reasons: ["missing_change_records"] };
|
||||
}
|
||||
|
||||
const changedPaths = [];
|
||||
const reasons = [];
|
||||
for (const [index, record] of records.entries()) {
|
||||
const expectedSides = CHANGE_STATUS_SIDES[String(record?.status || "")];
|
||||
if (!expectedSides) {
|
||||
reasons.push(`record_${index}:unknown_status`);
|
||||
continue;
|
||||
}
|
||||
for (const side of ["old", "new"]) {
|
||||
if (!expectedSides[side]) continue;
|
||||
const filePath = record?.[`${side}_path`];
|
||||
const validation = validateRawRepoPath(filePath);
|
||||
if (!validation.safe) {
|
||||
reasons.push(...validation.reasons.map((reason) => `record_${index}:${side}_${reason}`));
|
||||
continue;
|
||||
}
|
||||
changedPaths.push(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
if (reasons.length > 0 || changedPaths.length === 0) {
|
||||
return {
|
||||
profile: "unknown",
|
||||
reasons: [...new Set(reasons.length > 0 ? reasons : ["missing_changed_paths"])],
|
||||
};
|
||||
}
|
||||
|
||||
const uniquePaths = [...new Set(changedPaths)];
|
||||
const pathPolicies = uniquePaths.map((filePath) => classifyPathPolicy(filePath));
|
||||
if (pathPolicies.every((policy) => ["canonical_skill", "skill_support"].includes(policy.kind))) {
|
||||
return { profile: "narrow-skill", reasons: [] };
|
||||
}
|
||||
if (pathPolicies.every((policy) => policy.kind === "documentation")) {
|
||||
return { profile: "narrow-docs", reasons: [] };
|
||||
}
|
||||
|
||||
const classification = classifyChangedFiles(uniquePaths, contract);
|
||||
const hasKnownFullImpact = classification.categories.length > 0
|
||||
|| uniquePaths.some((filePath) => isDerivedFile(filePath, contract));
|
||||
if (hasKnownFullImpact) {
|
||||
return {
|
||||
profile: "full",
|
||||
reasons: ["mixed_or_broad_change"],
|
||||
};
|
||||
}
|
||||
|
||||
return { profile: "unknown", reasons: ["unclassified_path"] };
|
||||
}
|
||||
|
||||
function matchesContractEntry(filePath, entry) {
|
||||
const normalizedPath = normalizeRepoPath(filePath);
|
||||
const normalizedEntry = normalizeRepoPath(entry);
|
||||
@@ -481,6 +535,7 @@ module.exports = {
|
||||
classifyChangeRecords,
|
||||
classifyChangedFiles,
|
||||
classifyPathPolicy,
|
||||
classifyShadowImpact,
|
||||
extractChangelogSection,
|
||||
getDirectDerivedChanges,
|
||||
getManagedFiles,
|
||||
|
||||
Reference in New Issue
Block a user