import type { RDRRManifest } from '../formats/rdrr/types.js'; import type { SourceRuntimeShardSource } from '../formats/source-runtime.js'; import type { SourceStorageContext } from './source-storage-context.js'; export declare const ARTIFACT_FORMAT_RDRR: 'rdrr'; export declare const ARTIFACT_FORMAT_DIRECT_SOURCE: 'direct-source'; export type ArtifactFormat = typeof ARTIFACT_FORMAT_RDRR | typeof ARTIFACT_FORMAT_DIRECT_SOURCE; /** Canonical RDRR path, size, and digest normalization used by storage readers. */ export declare function buildRDRRShardSources(manifest: RDRRManifest): Array<{ index: number; path: string; size: number; hash: string | null; hashAlgorithm: 'sha256' | 'blake3'; }>; export interface CreateArtifactStorageContextOptions { manifest: RDRRManifest; expectedFormat?: ArtifactFormat | null; shardSources?: SourceRuntimeShardSource[] | null; readRange: ( path: string, offset: number, length: number | null ) => Promise; /** Caller-owned range destination for either artifact format; authenticated by the supplied host reader. */ readInto?: (path: string, offset: number, destination: Uint8Array) => Promise; streamRange?: ( path: string, offset: number, length: number, options?: { chunkBytes?: number } ) => AsyncIterable; readText?: (path: string) => Promise | null | undefined>; readBinary?: (path: string) => Promise; close?: (() => Promise) | null; tokenizerJsonPath?: string | null; tokenizerModelPath?: string | null; tensorsJsonPath?: string | null; verifyHashes?: boolean; hashesTrusted?: boolean; /** Direct-source reads are authenticated by the supplied host reader; skips only whole-source scans. */ sourceHashesTrusted?: boolean; verificationBufferBytes?: number; } export interface ArtifactStorageContext extends SourceStorageContext { preflight?: () => Promise; loadAuxiliaryFile: ((path: string) => Promise) | null; /** True when the bytes behind this context were already verified (for example a verified OPFS download). */ hashesTrusted?: boolean; } export interface CreateNodeFileArtifactStorageContextOptions { /** Defaults to true. Pass false explicitly to skip shard digest verification. */ verifyHashes?: boolean; verificationBufferBytes?: number; } export interface CreateHttpArtifactStorageContextOptions { /** Defaults to true. Pass false explicitly to skip shard digest verification. */ verifyHashes?: boolean; verificationBufferBytes?: number; rangeCacheBlockBytes?: number; rangeCacheMaxBytes?: number; rangeCacheMinBytes?: number; } export interface CreateOpfsArtifactStorageContextOptions { opfsRootDir: string; useSyncAccessHandle: boolean; maxConcurrentHandles: number; verifyHashes?: boolean; hashesTrusted?: boolean; } export declare function getArtifactFormat( manifest: RDRRManifest | Record | null | undefined ): ArtifactFormat | null; export declare function createArtifactStorageContext( options: CreateArtifactStorageContextOptions ): ArtifactStorageContext; export declare function createNodeFileArtifactStorageContext( baseUrl: string | null | undefined, manifest: RDRRManifest, options?: CreateNodeFileArtifactStorageContextOptions ): ArtifactStorageContext | null; export declare function createOpfsArtifactStorageContext( modelId: string, manifest: RDRRManifest, options: CreateOpfsArtifactStorageContextOptions ): Promise; export declare function createHttpArtifactStorageContext( baseUrl: string | null | undefined, manifest: RDRRManifest, options?: CreateHttpArtifactStorageContextOptions ): ArtifactStorageContext | null;