INNER CODE UNIT · TypeScript
inputNarrowed
runvendo/vendo · packages/vendo/src/actions/sync/index.ts:122
export function inputNarrowed(previous: ExtractedTool, next: ExtractedTool): boolean {
// The JUDGE'S FILL is not a narrowing. A tool whose input nobody could read
// carried a fail-closed placeholder; the run that infers it replaces that
// placeholder wholesale, which trips every rule below. Reporting that as
// breaking makes `vendoSync({ strict: true })` THROW on the judge's own
// work. Only inference is exempt: a blind input turning `declared` means the
// host added a real validator, which IS a breaking change worth reporting.
if (schemaIsBlind(previous.inputSchemaSource) && next.inputSchemaSource === "inferred") return false;
const oldSchema = objectValue(previous.inputSchema);
const newSchema = objectValue(next.inputSchema);
const oldRequired = new Set(arrayValue(oldSchema.required).filter((value): value is string => typeof value === "string"));
const newRequired = arrayValue(newSchema.required).filter((value): value is string => typeof value === "string");
if (newRequired.some((name) => !oldRequired.has(name))) return true;
const oldProperties = objectValue(oldSchema.properties);
const newProperties = objectValue(newSchema.properties);
for (const [name, oldRawProperty] of Object.entries(oldProperties)) {