/**
* Resource Loader
*
* Provides JSON/YAML loading with mtime-aware caching and minimal logging.
* Intended for reuse across gates, frameworks, and prompts to avoid bespoke
* file parsing logic.
*/
import { type YamlFileLoadOptions } from './yaml/index.js';
import type { Logger } from '../logging/index.js';
export type ResourceKind = 'json' | 'yaml';
export interface ResourceLoaderConfig {
logger?: Logger;
}
export interface ResourceLoadOptions {
kind?: ResourceKind | 'auto';
useCache?: boolean;
encoding?: BufferEncoding;
yamlOptions?: Omit<YamlFileLoadOptions, 'required'>;
}
export interface ResourceLoadResult<T> {
success: boolean;
data?: T;
error?: string;
filePath: string;
mtimeMs?: number;
fromCache?: boolean;
}
export declare class ResourceLoader {
private readonly logger;
private readonly cache;
constructor(config?: ResourceLoaderConfig);
load<T>(filePath: string, options?: ResourceLoadOptions): Promise<ResourceLoadResult<T>>;
clearCache(filePath?: string): void;
private resolveKind;
private loadJson;
}