/** * Skill Loader * * Loads and manages skill definitions from YAML/JSON files. * Handles file discovery, parsing, validation, and registration. */ import type { Logger } from '../observability/logger.js'; import type { SkillDefinition, SkillsConfig, SkillValidationResult, SkillMatch } from './types.js'; /** * Loads and manages skill definitions from files. * Provides methods for discovery, parsing, validation, and querying. */ export declare class SkillLoader { private skills; private config; private logger; private cooldownTracker; constructor(config: Partial, logger: Logger); /** * Load all skills from configured search paths. * Searches each path in order and registers found skills. */ loadAll(): Promise; /** * Load skills from a specific directory. * Returns array of successfully loaded skill definitions. * * @param dirPath - Directory path to search * @returns Array of loaded skill definitions */ loadFromDirectory(dirPath: string): Promise; /** * Load a single skill file. * Parses, validates, and registers the skill. * * @param filePath - Path to the skill file * @returns Loaded skill definition or null if failed */ loadSkillFile(filePath: string): Promise; /** * Parse skill definition from file content. * Supports YAML and JSON formats. * * @param content - File content * @param filePath - Path to file (for error messages and format detection) * @returns Parsed skill definition */ parseSkill(content: string, filePath: string): SkillDefinition; /** * Normalize parsed skill object to SkillDefinition. * Applies defaults and type coercion. */ private normalizeSkill; /** * Parse triggers array from raw data. */ private parseTriggers; /** * Parse context mode from raw value. */ private parseContextMode; /** * Validate a skill definition. * Returns validation result with errors and warnings. * * @param skill - Skill definition to validate * @returns Validation result */ validateSkill(skill: SkillDefinition): SkillValidationResult; /** * Register a skill programmatically. * Overwrites existing skill with same name. * * @param skill - Skill definition to register */ register(skill: SkillDefinition): void; /** * Unregister a skill by name. * * @param name - Skill name to unregister * @returns True if skill was found and removed */ unregister(name: string): boolean; /** * Check if a skill exists. * * @param name - Skill name * @returns True if skill is registered */ has(name: string): boolean; /** * Clear all loaded skills. */ clear(): void; /** * Get all loaded skills. * * @returns Array of all skill definitions */ getAllSkills(): SkillDefinition[]; /** * Get skill by name. * * @param name - Skill name * @returns Skill definition or undefined if not found */ getSkill(name: string): SkillDefinition | undefined; /** * Get the file path for a skill. * * @param name - Skill name * @returns Source file path or undefined */ getSkillPath(name: string): string | undefined; /** * Get skills matching trigger conditions. * Returns skills sorted by confidence score (highest first). * * @param context - Trigger context to match against * @returns Array of matching skills with confidence scores */ getMatchingSkills(context: { keywords?: string[]; event?: string; text?: string; }): SkillMatch[]; /** * Reload a specific skill from its source file. * * @param name - Skill name to reload * @returns True if skill was successfully reloaded */ reloadSkill(name: string): Promise; /** * Expand ~ in paths to home directory. */ private expandPath; /** * Check if filename matches skill file patterns. */ private isSkillFile; /** * Match a trigger against the provided context. */ private matchTrigger; } //# sourceMappingURL=skill-loader.d.ts.map