/** * Shared utilities for skill-gen modules. * * Extracted from signal-collector.ts, drift-detector.ts, and suggestion-engine.ts * to eliminate duplication. All public functions are error-isolated (catch + warn). * * @module core/skill-gen/utils */ import { z } from 'zod'; import type { SignalStore } from './types.js'; export declare const TOKEN_BUDGET = 50000; export declare const MAX_EVIDENCE = 20; export declare const MAX_STRING_LENGTH = 200; export declare const SignalEntrySchema: z.ZodObject<{ id: z.ZodString; pattern: z.ZodString; category: z.ZodString; description: z.ZodString; incrementIds: z.ZodArray; firstSeen: z.ZodString; lastSeen: z.ZodString; confidence: z.ZodNumber; evidence: z.ZodArray; suggested: z.ZodBoolean; declined: z.ZodBoolean; generated: z.ZodBoolean; uniqueSourceFiles: z.ZodOptional>; }, z.core.$strip>; export declare const SignalStoreSchema: z.ZodObject<{ version: z.ZodString; signals: z.ZodArray; firstSeen: z.ZodString; lastSeen: z.ZodString; confidence: z.ZodNumber; evidence: z.ZodArray; suggested: z.ZodBoolean; declined: z.ZodBoolean; generated: z.ZodBoolean; uniqueSourceFiles: z.ZodOptional>; }, z.core.$strip>>; }, z.core.$strip>; /** * Recursively collect markdown files from a directory. * Returns empty array if directory doesn't exist or is unreadable. */ export declare function collectMarkdownFiles(dir: string): Promise; /** * Load signal store from disk with Zod validation and corruption recovery. * Returns empty store on missing/corrupted/invalid files with a logged warning. */ export declare function loadSignalStore(filePath: string): Promise; /** * Save signal store to disk, creating parent directories as needed. */ export declare function saveSignalStore(filePath: string, store: SignalStore): Promise; /** * Strip control characters and truncate to maxLength. */ export declare function sanitizeString(input: string, maxLength?: number): string; /** * Estimate token count using the rough heuristic: ceil(chars / 4). */ export declare function estimateTokenCount(text: string): number; /** * Cap evidence array at max entries using FIFO eviction (oldest removed first). */ export declare function capEvidence(evidence: string[], max?: number): string[]; //# sourceMappingURL=utils.d.ts.map