/** * Skills System Types * * Type definitions for the Hari Seldon skills system. * Skills are hot-reloadable, YAML/JSON-defined capabilities that can be * triggered automatically or invoked manually. */ /** * Skill definition loaded from YAML/JSON files. * Defines a reusable capability with trigger conditions and execution settings. */ export interface SkillDefinition { /** Unique skill name (must be unique across all loaded skills) */ name: string; /** Human-readable display name */ displayName?: string; /** Description of what this skill does */ description: string; /** Semantic version (e.g., "1.0.0") */ version?: string; /** Author name or contact */ author?: string; /** Keywords for discovery and matching */ keywords?: string[]; /** Trigger conditions for auto-invocation */ triggers?: SkillTrigger[]; /** Agent role to use for execution */ role?: string; /** Provider override (bypasses role's default provider) */ provider?: string; /** Model override (bypasses role's default model) */ model?: string; /** System prompt for this skill (appended to role's system prompt) */ systemPrompt?: string; /** Context handling mode */ context?: SkillContextMode; /** Tools available to this skill (whitelist) */ allowedTools?: string[]; /** Whether this is an internal skill (not user-invocable) */ internal?: boolean; /** Whether this skill is enabled */ enabled?: boolean; /** File path where skill was loaded from */ sourcePath?: string; /** Last modified time of source file */ lastModified?: Date; } /** * Context handling mode for skill execution. * - 'inherit': Share context with parent (modifications persist) * - 'fork': Copy context (modifications don't affect parent) * - 'isolated': Fresh context (no parent data) */ export type SkillContextMode = 'inherit' | 'fork' | 'isolated'; /** * Trigger condition for auto-invoking skills. * Skills can be triggered by keywords, patterns, events, or combinations. */ export interface SkillTrigger { /** Keywords that activate this skill (matched against input text) */ keywords?: string[]; /** Regular expression patterns to match (against input text or context) */ patterns?: string[]; /** Events that trigger this skill (e.g., 'post-edit', 'file-created') */ events?: string[]; /** Minimum confidence score required (0-1, for fuzzy matching) */ confidence?: number; /** Cooldown between triggers in milliseconds (prevent rapid re-firing) */ cooldownMs?: number; } /** * Execution context for a skill. * Contains session state, variables, and optional parent context. */ export interface SkillContext { /** Unique session identifier */ sessionId: string; /** Current task ID (if executing within a task) */ taskId?: string; /** Current worktree path (if executing in a worktree) */ worktreePath?: string; /** Parent context (for forked skills) */ parentContext?: SkillContext; /** Variables available to skill (template substitution) */ variables: Record; /** Conversation messages/history */ messages?: unknown[]; /** Metadata attached to this context */ metadata?: Record; } /** * Result from executing a skill. */ export interface SkillResult { /** Whether skill executed successfully */ success: boolean; /** Output from skill execution */ output?: unknown; /** Error if execution failed */ error?: Error; /** Context modifications (for 'inherit' context mode) */ contextModifications?: Record; /** Duration in milliseconds */ durationMs?: number; } /** * Configuration for the skills system. * Can be defined in config.yaml under the 'skills' key. */ export interface SkillsConfig { /** Enable skills system globally */ enabled: boolean; /** Paths to search for skill definition files */ searchPaths: string[]; /** Watch for file changes and hot-reload */ watchForChanges: boolean; /** File patterns to load (glob patterns) */ filePatterns: string[]; /** Default context mode for skills */ defaultContextMode: SkillContextMode; } /** * Default skills configuration. */ export declare const DEFAULT_SKILLS_CONFIG: SkillsConfig; /** * Events emitted by the skills system. */ export interface SkillManagerEvents { /** Emitted when a skill is loaded */ 'skill:loaded': { skill: SkillDefinition; }; /** Emitted when a skill is unloaded */ 'skill:unloaded': { name: string; }; /** Emitted when a skill is reloaded (updated) */ 'skill:reloaded': { skill: SkillDefinition; action: 'added' | 'updated' | 'removed'; }; /** Emitted before a skill is executed */ 'skill:before': { skill: SkillDefinition; context: SkillContext; }; /** Emitted after a skill completes */ 'skill:after': { skill: SkillDefinition; result: SkillResult; }; /** Emitted when a skill fails */ 'skill:error': { skill: SkillDefinition; error: Error; }; } /** * Result of matching skills to input/context. */ export interface SkillMatch { /** Matched skill definition */ skill: SkillDefinition; /** Confidence score (0-1) */ confidence: number; /** Which trigger matched */ matchedTrigger?: SkillTrigger; /** Matching keywords (if keyword trigger) */ matchedKeywords?: string[]; /** Matching pattern (if pattern trigger) */ matchedPattern?: string; /** Matching event (if event trigger) */ matchedEvent?: string; } /** * Validation error for skill definitions. */ export interface SkillValidationError { /** Field that failed validation */ field: string; /** Error message */ message: string; /** Severity level */ severity: 'error' | 'warning'; } /** * Result of validating a skill definition. */ export interface SkillValidationResult { /** Whether the skill is valid */ valid: boolean; /** Validation errors */ errors: SkillValidationError[]; /** Validation warnings */ warnings: SkillValidationError[]; } //# sourceMappingURL=types.d.ts.map