export type CachePolicy = "local" | "session"; export type CacheRef = `${string}:${CachePolicy}` | string; export type CacheBlob = Uint8Array | string | AsyncIterable; export interface CacheStoreContext { rootDir: string; asyncDir: string; storeName: string; policy: CachePolicy; runId: string; taskId: string; signal?: AbortSignal; } export interface CacheStoreEntry { key: string; sizeBytes?: number; createdAt?: string; lastUsedAt?: string; } export interface CachePruneOptions { prefix?: string; maxAgeMs?: number; maxSizeBytes?: number; } export interface CachePruneResult { removed: number; bytesRemoved?: number; } export interface CacheStoreAdapter { readonly name?: string; get(key: string, context: CacheStoreContext): Promise; put(key: string, value: CacheBlob, context: CacheStoreContext): Promise; touch?(key: string, context: CacheStoreContext): Promise; delete?(key: string, context: CacheStoreContext): Promise; list?(prefix: string, context: CacheStoreContext): AsyncIterable; prune?(options: CachePruneOptions, context: CacheStoreContext): Promise; } export type CacheStoreErrorCode = "ASYNC_PIPELINE_CACHE_UNAVAILABLE" | "ASYNC_PIPELINE_CACHE_CORRUPT" | "ASYNC_PIPELINE_CACHE_UNSUPPORTED" | "ASYNC_PIPELINE_CACHE_PERMISSION"; export declare class CacheStoreError extends Error { code: CacheStoreErrorCode; retryable?: boolean; constructor(code: CacheStoreErrorCode, message: string, options?: { retryable?: boolean; cause?: unknown; }); } export interface CacheStoreDefinition { kind: "cache-store"; type: "memory" | "file" | "custom"; root?: string; adapter?: CacheStoreAdapter; config?: Record; } export interface CacheUseOptions { ttlMs?: number; key?: unknown; } export interface CacheDirective { kind: "async-pipeline.directive.cache"; ref: CacheRef; options?: CacheUseOptions; } export interface CacheRegistryInput { default?: CacheRef; stores?: Record; } export interface CacheRegistryDefinition { kind: "cache-registry"; default: CacheRef; stores: Record; use(ref?: CacheRef, options?: CacheUseOptions): CacheDirective; } export interface ParsedCacheRef { ref: CacheRef; store: string; policy: CachePolicy; } export declare function memoryCache(): CacheStoreDefinition; export declare function fileCache(options?: { root?: string; }): CacheStoreDefinition; export declare function customCache(config?: Record & { adapter?: CacheStoreAdapter; }): CacheStoreDefinition; export declare function redisCache(config?: Record): CacheStoreDefinition; export declare function defineCache(input?: CacheRegistryInput | Record): CacheRegistryDefinition; export declare function defaultPipelineCache(): CacheRegistryDefinition; export declare function defaultRuntimeCache(): CacheRegistryDefinition; export declare const cache: CacheRegistryDefinition; export declare function parseCacheRef(ref: CacheRef): ParsedCacheRef; export declare function isCacheDirective(value: unknown): value is CacheDirective; export declare function assertCacheStore(registry: CacheRegistryDefinition, ref: ParsedCacheRef): void; export declare function mergeWithDefaultCacheStores(registry: CacheRegistryDefinition): CacheRegistryDefinition; export declare function defaultCachePolicyForStore(store: string): CachePolicy; //# sourceMappingURL=cache.d.ts.map