UNPKG

packfs-core

Version:

Semantic filesystem operations for LLM agent frameworks with natural language understanding. See LLM_AGENT_GUIDE.md for copy-paste examples.

62 lines 2.11 kB
/** * Base compression strategy interface for PackFS * Part of the proposed compression system for @yarnpkg/fslib */ export interface CompressionHints { readonly mimeType: string; readonly accessFrequency: number; readonly fileSize: number; readonly isHot: boolean; readonly ecosystem?: 'react' | 'vue' | 'angular' | 'node' | 'unknown'; } export interface CompressedChunk { readonly data: Buffer; readonly algorithm: string; readonly originalSize: number; readonly compressedSize: number; readonly dictionary?: string; readonly metadata: Record<string, any>; } export interface CompressionStats { readonly ratio: number; readonly compressionTime: number; readonly decompressionTime: number; readonly memoryUsage: number; } export declare abstract class CompressionStrategy { abstract readonly name: string; abstract readonly priority: 'speed' | 'balanced' | 'size'; abstract readonly supportsStreaming: boolean; /** * Compress data with provided hints */ abstract compress(data: Buffer, hints: CompressionHints): Promise<CompressedChunk>; /** * Decompress a compressed chunk */ abstract decompress(chunk: CompressedChunk): Promise<Buffer>; /** * Create a streaming decompressor (if supported) */ abstract createDecompressor(chunk: CompressedChunk): NodeJS.ReadableStream | null; /** * Estimate compression ratio without actually compressing */ abstract estimateRatio(data: Buffer, hints: CompressionHints): number; /** * Check if this strategy is optimal for the given data */ abstract shouldUse(data: Buffer, hints: CompressionHints): boolean; } /** * Registry for compression strategies */ export declare class StrategyRegistry { private strategies; register(strategy: CompressionStrategy): void; get(name: string): CompressionStrategy | undefined; getOptimal(data: Buffer, hints: CompressionHints): CompressionStrategy; private getPriorityScore; private getDefault; } //# sourceMappingURL=CompressionStrategy.d.ts.map