Dashboard › cli › Distillation
60e54167-0e0b-4620-bc58-0d07ec20dc7f["lore_tm_v1_o8P9QQ3i-PbCyVReUkbs1ZIh0RWPT2dU6upLL3j8z7c","lore_tm_v1_cOlGq5qrz2ku02Xm7E9Yyd60diBG2_3Y5f86nCrlUrg","lore_tm_v1_Gxr89TXnExxVEmxmd1lXo1Q6rujdb6H8XIXA6bLn5DQ","lore_tm_v1_mv585wiol4R7GlHnp-jxSYk4dTHEt51GG0mg6wT-5VA"]
packages/cli/src/lib/patch-cache.ts is exactly 43 lines. It imports join from node:path, imports makeCache, PatchCache, and PatchChain from binpatch, and imports getConfigDir from ./db/index.js.packages/cli/src/lib/patch-cache.ts re-exports the ChainMeta and PatchStepMeta types plus chainFileName and patchFileName from binpatch; the value re-export has // biome-ignore lint/performance/noBarrelFile: preserve the existing cache API.packages/cli/src/lib/patch-cache.ts, cache(): PatchCache creates a fresh cache using makeCache(join(getConfigDir(), "patch-cache")).savePatchesToCache() in packages/cli/src/lib/patch-cache.ts accepts chain: Pick<PatchChain, "patches" | "expectedSha256"> and steps: { fromVersion: string; toVersion: string }[], then delegates to cache().save(chain, steps).loadCachedChain(currentVersion, targetVersion) in packages/cli/src/lib/patch-cache.ts delegates to cache().load(), returns null for a cache miss, and converts every loaded patch’s data to new Uint8Array(patch.data) before returning the result.binpatch@0.4.2/node_modules/binpatch/dist/index.js found exactly 34 matches related to SHA-256, OCI/blob downloading, redirects, and patch URLs. Notable symbols include OciClient, downloadBlob(), downloadBlobBuffer(), getPatchTargetSha256(), ghcrSource(), SHA256_DIGEST_PATTERN, extractSha256(), and githubReleaseSource().OciClient.downloadBlob(token, digest, signal) sends Authorization: Bearer ${token} to the registry, handles the registry’s 3xx blob redirect manually, requires a Location header, and follows the redirect without forwarding the authentication header; the same blob timeout applies to redirected storage such as Azure Blob.Registry blob redirect (${blobResponse.status}) had no Location header when a redirect lacks Location, and Blob storage download failed: HTTP ${redirectResponse.status} when redirected storage returns a non-OK response.getPatchTargetSha256(manifest, binaryName) reads manifest.annotations?.[\sha256-${binaryName}`] ?? null; chain extraction treats a missing target SHA-256 as { failure: "malformed_chain" }`.githubReleaseSource(config), downloadPatch(url, signal) performs an instrumented "download-patch" fetch with the configured User-Agent and abort signal, returns null for thrown fetch errors or non-OK responses, and otherwise returns new Uint8Array(await response.arrayBuffer()).githubReleaseSource(config).resolveChain(currentVersion, targetVersion, signal, report) fetches recent releases first; if fetching returns null, it reports "network" and returns null.tag_name === targetVersion; if absent it reports "no_patches". It then requires a target asset named ${binaryName}.gz; if absent it reports "malformed_chain".extractStableChain({ releases, currentVersion, targetVersion, binaryName, fullGzSize: gzAsset.size }); an isStableChainFailure() result is reported using its exact chainInfo.failure and causes a null return.Promise.all(chainInfo.patchUrls.map((url) => downloadPatch(url, signal))). Any failed patch download reports "network" and returns null; success produces { patches, totalSize, expectedSha256: chainInfo.expectedSha256, steps: chainInfo.steps }, where each patch is { data, size: data.byteLength } and totalSize is the exact sum of downloaded byte lengths.binpatch@0.4.2/node_modules/binpatch/dist/index.js is exactly 1,320 lines and exports BinpatchError, MAX_NIGHTLY_CHAIN_DEPTH, MAX_OUTPUT_SIZE, MAX_STABLE_CHAIN_DEPTH, OciClient, PATCH_TAG_PREFIX, SIZE_THRESHOLD_RATIO, addDiffChunk, applyPatch, applyPatchChainInMemory, applyPatchToMemory, chainFileName, extractSha256, extractStableChain, filterAndSortChainTags, getPatchFromVersion, getPatchTargetSha256, getStableTargetSha256, ghcrSource, githubReleaseSource, makeCache, offtin, parsePatchHeader, patchFileName, resolveAndApply, safeProgress, and validateChainStep.