import { DownloadOptions, UploadOptions } from './options.js'; export type { DownloadOptions, UploadOptions }; export declare class ValidationError extends Error { constructor(message: string); } export declare class ReserveCacheError extends Error { constructor(message: string); } /** * Stable prefix the receiver writes into the cache reservation response when * the issuer downgraded the cache token to read-only (for example, because * the run was triggered by an untrusted event). saveCacheV1 / saveCacheV2 * dispatch on this prefix to re-classify the failure as a * CacheWriteDeniedError so consumers (and the outer catch arm) can * distinguish a policy denial from other reservation failures. */ export declare const CACHE_WRITE_DENIED_PREFIX = "cache write denied:"; /** * Raised when the cache backend refuses to reserve a writable cache entry * because the JWT issued for this run was scoped read-only (for example, the * run was triggered by an event the repository administrator classified as * untrusted). The receiver-supplied detail message always begins with * `cache write denied:` (the full error message includes additional context * like the cache key). * * Extends ReserveCacheError for source-compatibility: existing * `instanceof ReserveCacheError` checks and `typedError.name === * ReserveCacheError.name` paths keep working, while consumers that want to * distinguish the policy case can match on this subclass. */ export declare class CacheWriteDeniedError extends ReserveCacheError { constructor(message: string); } export declare class FinalizeCacheError extends Error { constructor(message: string); } /** * isFeatureAvailable to check the presence of Actions cache service * * @returns boolean return true if Actions cache service feature is available, otherwise false */ export declare function isFeatureAvailable(): boolean; /** * Restores cache from keys * * @param paths a list of file paths to restore from the cache * @param primaryKey an explicit key for restoring the cache. Lookup is done with prefix matching. * @param restoreKeys an optional ordered list of keys to use for restoring the cache if no cache hit occurred for primaryKey * @param downloadOptions cache download options * @param enableCrossOsArchive an optional boolean enabled to restore on windows any cache created on any platform * @returns string returns the key for the cache hit, otherwise returns undefined */ export declare function restoreCache(paths: string[], primaryKey: string, restoreKeys?: string[], options?: DownloadOptions, enableCrossOsArchive?: boolean): Promise; /** * Saves a list of files with the specified key * * @param paths a list of file paths to be cached * @param key an explicit key for restoring the cache * @param enableCrossOsArchive an optional boolean enabled to save cache on windows which could be restored on any platform * @param options cache upload options * @returns number returns cacheId if the cache was saved successfully and throws an error if save fails */ export declare function saveCache(paths: string[], key: string, options?: UploadOptions, enableCrossOsArchive?: boolean): Promise;