Dashboard › cli › Distillation
f80f014b-6cae-4114-a2c9-a08939e69c1c["lore_tm_v1_IXvqwrG6wkpucFAAXBauQQ3k5hw2wDjL9m5Ahwt5Kl0","lore_tm_v1_lvMRjWgh5l3zZY0spfKL1G7lYH_U4Yoo7MWwZOWLFjU","lore_tm_v1_EyXoumnFfmxbrmpX3vbQp3KZqWp7MSvUGvu-dyy02qM","lore_tm_v1_HtXFSF5YmhCD6LmKG3U5vrbWQyC4ACvEI3DiKp1ld_8"]
packages/cli/node_modules/binpatch/dist/index.js defines MAX_STABLE_CHAIN_DEPTH = 10, MAX_NIGHTLY_CHAIN_DEPTH = 30, SIZE_THRESHOLD_RATIO = 0.6, and PATCH_TAG_PREFIX = "patch-".BinpatchError supports reasons with default messages: network_error → "Failed to fetch update information."; execution_failed → "Applying the update failed."; version_not_found → "The specified version was not found."; offline_cache_miss → "Cannot update offline — no pre-downloaded patch is available.".safeProgress(handler) returns a no-op when no handler exists and catches and suppresses exceptions thrown by the progress handler.resolveAndApply(opts) first attempts cache.load(currentVersion, targetVersion) via tryLoadCachedChain(); cache-load errors become cache misses. A cached chain emits telemetry?.onResolved?.({ source: "cache", chain: cached }) and is applied immediately.resolveAndApply(opts) returns null and calls telemetry?.onOfflineMiss?.() when offline is true and no cached chain was found."no_patches"; the source’s report(reason) callback replaces that reason, and a missing chain calls telemetry?.onUnavailable?.(unavailableReason) exactly once before returning null.resolveAndApply(opts) saves network-resolved chains only when cache && chain.steps; cache.save(chain, chain.steps) is fire-and-forget and suppresses rejection, then telemetry reports { source: "network", chain }.applyChain() computes progress total by summing parsePatchHeader(patch.data).newSize; malformed headers set total = null. It emits apply phase, cumulative apply bytes, apply done, verify phase, and verify done progress events in that order.applyChain() invokes applyPatchChainInMemory(oldPath, chain.patches.map((p) => p.data), destPath, ...), throws Error(\SHA-256 mismatch after patching: got ${sha256}, expected ${chain.expectedSha256}`)on verification failure, and otherwise returns{ sha256, patchBytes: chain.totalSize, chainLength: chain.patches.length }`.REQUEST_TIMEOUT = 1e4, MAX_RETRIES = 1, BLOB_TIMEOUT = 3e4, TAGS_PAGE_SIZE = 100, and OCI_MANIFEST_TYPE = "application/vnd.oci.image.manifest.v1+json".isRetryableError(error) treats TimeoutError, AbortError, and messages containing timeout, econnreset, econnrefused, network, or fetch failed as retryable.${binaryName}.gz; validates via resolveNightlyChain(); reports "malformed_chain" for a missing gzip layer and "network" for BinpatchError, returning null in both cases, while rethrowing non-BinpatchError exceptions.extractStableChain(opts) requires both current and target releases, requires targetIdx < currentIdx, limits chains to MAX_STABLE_CHAIN_DEPTH, requires the target binary SHA-256 and every ${binaryName}.patch asset, and rejects total patch asset size above fullGzSize * SIZE_THRESHOLD_RATIO.extractStableChain(opts) failure reasons are "no_patches", "too_long", "malformed_chain", and "over_budget"; successful output contains reversed patchUrls, expectedSha256, and ordered { fromVersion, toVersion } steps beginning at currentVersion.githubReleaseSource(config) requests ${releasesUrl}?per_page=${MAX_STABLE_CHAIN_DEPTH + 2} with Accept: "application/vnd.github.v3+json" and "User-Agent": userAgent; fetch exceptions and non-OK responses become null.resolveChain() reports "network" when release retrieval or any patch download fails, "no_patches" when the target release is absent, "malformed_chain" when ${binaryName}.gz is absent, and otherwise returns downloaded patches with actual byte-based totalSize, expected SHA-256, and chain steps.null on suppressed arguments, non-TTY stderr, or error and never throws: errors are caught and reported to Sentry.ghcr.io anonymous-token exchange, imports getUserAgent from ./constants.js, can combine timeout and external cancellation through AbortSignal.any([timeoutSignal, externalSignal]), defines GhcrManifestHttpError extends UpgradeError, reads nightly version metadata from the manifest annotation set by oras push --annotation "version=<ver>", and uses TAGS_PAGE_SIZE pagination for ${GHCR_REGISTRY}/v2/${source.ghcrRepo}/tags/list.