import { EmbeddedManifest } from './manifest.js'; declare const DEFAULT_TIMEOUT_MS = 30000; declare const SIDECAR_FILENAME = ".last_deploy_cid"; type FetchOutcome = { source: "embedded"; manifest: EmbeddedManifest; attempts: number; bytesDownloaded?: number; } | { source: "heuristic_fallback"; reason: string; attempts: number; bytesDownloaded?: number; } | { source: "none"; }; interface FetchOptions { gateway?: string; gateways?: string[]; timeoutMs?: number; domain?: string; buildDir?: string; /** * Injectable chain client for the chain-storage tier. When provided, * fetchPreviousManifest attempts to read the previous manifest directly * from the bulletin chain via bitswap_v1_get, before falling through to * the IPFS gateway. Accepts any object exposing `_request(method, params)`. * * The bitswap_v1_get request shape `(cid: string) => unknown` is confirmed * present on the bulletin chain (per #456 live E2E). The **response payload * shape** (hex string vs Uint8Array vs other) is NOT yet exercised in a * round-trip test — normalizeBitswapBytes handles the known candidates * defensively, but a live verification against a stored CID is still needed. * The PR flags this explicitly. */ chainClient?: { _request: (method: string, params: unknown[]) => Promise; }; } type TierOutcome = "timeout" | "network_error" | `http_${number}` | "body_read_error" | "car_truncated" | "manifest_not_in_slice" | "car_parse_error" | "manifest_missing" | "manifest_parse_error" | "success"; declare function getCacheDir(): string | null; declare function readPersistentLocalManifest(domain: string | undefined, prevContenthash: string): FetchOutcome | null; declare function writePersistentLocalManifest(domain: string, storageCid: string, manifestJson: string): void; declare const CHAIN_TIER_TIMEOUT_MS = 5000; declare function normalizeBitswapBytes(response: unknown): Uint8Array; declare function fetchManifestFromChain(client: { _request: (method: string, params: unknown[]) => Promise; }, rootCid: string, timeoutMs: number): Promise; declare function fetchPreviousManifest(prevContenthash: string | null, options?: FetchOptions): Promise; declare function extractManifestFromCar(carBytes: Uint8Array): Promise; declare function walkDagToManifest(blocks: Map, rootCid: string): Promise; export { CHAIN_TIER_TIMEOUT_MS, DEFAULT_TIMEOUT_MS, type FetchOptions, type FetchOutcome, SIDECAR_FILENAME, type TierOutcome, extractManifestFromCar, fetchManifestFromChain, fetchPreviousManifest, getCacheDir, normalizeBitswapBytes, readPersistentLocalManifest, walkDagToManifest, writePersistentLocalManifest };