/** * Content-addressed digest of a worker manifest. * * The digest is what `(deploymentName, buildId)` consistency, registration * acknowledgement, and persisted execution provenance all compare, so a * collision would let two different workers pass for one another. That rules * out the repository's FNV-1a helpers, which are documented as cache-key * quality, and calls for SHA-256 — the same choice, and the same * bounded-input-then-hash shape, as the worker replay signature. * * The digest carries its algorithm as a prefix so a future change is a * readable difference rather than a silent reinterpretation of 64 hex * characters. * * @module worker/manifest/digest */ import type { WorkerManifest } from './types.ts'; /** * Algorithm tag prefixed to every manifest digest this version produces. * * Carrying the algorithm in the value means a future change reads as a * difference rather than as a silent reinterpretation of the same hex. * * @example * ```ts * import { WORKER_MANIFEST_DIGEST_ALGORITHM } from '@lostgradient/weft'; * * const digest = 'sha256:41d0e2'; * console.log(digest.startsWith(`${WORKER_MANIFEST_DIGEST_ALGORITHM}:`)); // true * ``` */ export declare const WORKER_MANIFEST_DIGEST_ALGORITHM = "sha256"; /** * Digest canonical manifest bytes. * * Separate from {@link computeWorkerManifestDigest} so a caller that already * holds the canonical serialization — the manifest parser returns one — does * not serialize the manifest twice. * * @example * ```ts * import { canonicalWorkerManifestJson, digestCanonicalWorkerManifest } from '@lostgradient/weft'; * * const canonical = canonicalWorkerManifestJson({ * manifestVersion: 1, * protocolVersion: 2, * sdkVersion: '0.18.0', * runtime: { name: 'bun', version: '1.3.14' }, * deployment: { name: 'billing', buildId: 'b3', artifactDigest: 'sha256:41d0' }, * workflows: {}, * capabilities: {}, * }); * * console.log((await digestCanonicalWorkerManifest(canonical)).startsWith('sha256:')); * ``` */ export declare function digestCanonicalWorkerManifest(canonicalJson: string): Promise; /** * Compute the content-addressed digest of a worker manifest. * * Determined entirely by canonical content, so two manifests that differ only * in key order digest identically, and any difference the host cares about * changes the digest. * * @example * ```ts * import { computeWorkerManifestDigest, WORKER_MANIFEST_VERSION } from '@lostgradient/weft'; * * const digest = await computeWorkerManifestDigest({ * manifestVersion: WORKER_MANIFEST_VERSION, * protocolVersion: 2, * sdkVersion: '0.18.0', * runtime: { name: 'bun', version: '1.3.14' }, * deployment: { name: 'billing', buildId: 'b3', artifactDigest: 'sha256:41d0' }, * workflows: {}, * capabilities: {}, * }); * * console.log(digest.startsWith('sha256:')); // true * ``` */ export declare function computeWorkerManifestDigest(manifest: WorkerManifest): Promise;