INNER CODE UNIT · TypeScript
MAX_PATCH_SOURCE_BYTES
totec448-spec/chat-on-steroids · src/main/codex/apply-patch/index.ts:46
export const MAX_PATCH_SOURCE_BYTES = 16 * 1024 * 1024;
async function ensurePatchSourceWithinBudget(path: string, allowMissing = false): Promise<void> {
try {
const metadata = await getMetadata(path);
if (metadata.isFile && metadata.size > MAX_PATCH_SOURCE_BYTES) {
throw invalidInput(`file is too large to patch safely: limit is ${MAX_PATCH_SOURCE_BYTES} bytes`);
}
} catch (error) {
if (allowMissing && errorCode(error) === 'ENOENT') return;
throw error;
}
}
/**
* Verification-time file target check.
*
* The runtime is intentionally sequential and can therefore leave earlier hunks committed when a