/** * Versionless dossier name → resolved version mapping with TTL. * * Pinned versions (name@1.2.3) are content-addressable and never go stale. * Versionless names (name) are the only thing that ages, so the TTL belongs * on resolution, not on cached content bytes. * * Resolution cache lives at ~/.dossier/cache/.resolution/.json, one * tiny file per dossier with { resolved_version, resolved_at, source_registry }. * * On registry failure, falls back to the highest-semver version already in * ~/.dossier/cache// and prints a loud stderr warning so the staleness * is never silent. */ export declare const DEFAULT_RESOLUTION_TTL_SECONDS = 300; export declare const CACHE_DIR: string; export declare const RESOLUTION_DIR: string; export interface ResolutionRecord { resolved_version: string; resolved_at: string; source_registry?: string; } export type ResolutionSource = 'cache' | 'registry' | 'stale-cache'; export interface ResolvedVersion { version: string; source: ResolutionSource; registry?: string; /** Present only when source === 'stale-cache' — explains why we did not reach the registry. */ warning?: string; } export interface ResolveOptions { /** Skip the resolution cache and force a registry call. */ fresh?: boolean; /** Override the TTL for this call. 0 forces a registry call. */ maxAgeSeconds?: number; } export declare function writeResolution(dossierName: string, record: ResolutionRecord): void; /** Highest-semver version currently cached on disk for this name, or null. */ export declare function highestCachedSemver(dossierName: string): string | null; /** * Resolve a versionless dossier name to a concrete version. * * Flow: * 1. If !fresh and a resolution file exists and is within TTL → return cached resolution. * 2. Otherwise call the registry. On success → write resolution file → return. * 3. On registry failure → fall back to highest-semver cached version with a * loud stderr warning. If nothing is cached, rethrow. * * Callers should pass an already-stripped name (without @version suffix). For * pinned versions, skip this resolver entirely. */ export declare function resolveCachedVersion(dossierName: string, opts?: ResolveOptions): Promise; /** Exposed for the `cache resolutions` subcommand. */ export declare function listResolutions(): Array<{ name: string; record: ResolutionRecord; }>; /** Exposed for tests and the `cache clean` flow — remove all resolution files. */ export declare function clearResolutions(): void; /** * Path to a cached dossier's content file (without checking existence). * Centralises the `//.ds.md` layout used by * run/create/install-skill/pull so layout changes happen in one place. */ export declare function cachedContentPath(dossierName: string, version: string): string; /** * Return cached dossier content as a string, or null if not cached. * Single source of truth for the `existsSync(contentFile) ? read : miss` * block that previously lived in run.ts, create.ts, and install-skill.ts. */ export declare function readCachedContent(dossierName: string, version: string): string | null; /** * Write a dossier's content + .meta.json to the cache. * * The .meta.json shape (`cached_at` + `version` + `source_registry`) is the * one read by `cache list` / `cache clean` and was previously duplicated * verbatim in run.ts, create.ts, install-skill.ts, and pull.ts. * * Best-effort by default (errors swallowed, matching create.ts/install-skill.ts). * Pass `throwOnError: true` for callers that want to surface write failures * (pull.ts wants this — a failed download cache write is a hard failure). */ export declare function writeCachedContent(dossierName: string, version: string, content: string, sourceRegistry: string | undefined, opts?: { throwOnError?: boolean; }): void; /** * Parse a `--max-age ` CLI option into a number, or return undefined * when unset. Throws when the value is provided but not a valid number. * Used by run/create/install-skill which all expose the same flag. */ export declare function parseMaxAgeOption(raw: string | undefined): number | undefined; //# sourceMappingURL=cache-resolver.d.ts.map