import { type CacheStats } from './prompt-cache.js'; import type { PromptContext } from './types.js'; /** * Configuration options for PromptService */ export interface PromptServiceConfig { /** Base directory for prompts (defaults to ~/.llxprt/prompts) */ baseDir?: string; /** Maximum cache size in MB (defaults to 100) */ maxCacheSizeMB?: number; /** Enable compression for loaded files (defaults to true) */ compressionEnabled?: boolean; /** Enable debug mode for verbose logging */ debugMode?: boolean; } /** * Result of configuration validation */ export interface ValidationResult { isValid: boolean; errors: string[]; warnings: string[]; } /** * Main API that coordinates all prompt components */ export declare class PromptService { private baseDir; private cache; private resolver; private loader; private templateEngine; private installer; private defaultContent; private initialized; private config; private preloadedFiles; private _detectedEnvironment; private installerNotices; private logger; /** * Creates a new PromptService instance * @param config Optional configuration settings */ constructor(config?: PromptServiceConfig); /** * Initialize the service, installing defaults and preloading files * @throws Error if initialization fails */ initialize(): Promise; /** * Consume any installer notices generated during initialization. * Returns the notices and clears the internal queue. */ consumeInstallerNotices(): string[]; /** * Get assembled prompt for the given context * @param context Runtime context with provider, model, tools, and environment * @param userMemory Optional user-specific content to include as context * @param coreMemory Optional core (system) memory to include as system directives * @returns Assembled prompt string * @throws Error if context is invalid or core prompt is missing */ getPrompt(context: PromptContext, userMemory?: string | null, coreMemory?: string | null): Promise; /** * Appends core memory (system directives) and user memory (context) to * the base assembled prompt. Core memory is placed directly after the base * prompt as system-level content. User memory follows with a `---` separator. */ private appendMemoryContent; /** * Load a specific prompt file by relative path * @param relativePath Path relative to the prompts directory (e.g., 'services/loop-detection.md') * @returns The prompt content * @throws Error if file cannot be loaded */ loadPrompt(relativePath: string): Promise; /** * Clear the prompt cache */ clearCache(): void; /** * Get cache statistics * @returns Cache statistics including size, count, and hit rate */ getCacheStats(): CacheStats & { totalEntries: number; hitRate: number; }; /** * Reload all files from disk and clear cache * @throws Error if reloading fails */ reloadFiles(): Promise; /** * Validate a context configuration * @param context Context to validate * @returns Validation result with errors and warnings */ validateConfiguration(context: PromptContext): ValidationResult; /** * Get list of available tool prompts * @returns Array of tool names in PascalCase */ getAvailableTools(): Promise; /** * Helper method to expand tilde in paths */ private expandPath; /** * Helper method to load and process a file with template substitution */ private loadAndProcess; /** * Helper method to get all prompt files recursively */ private getAllPromptFiles; /** * Helper method to estimate tokens in text */ private estimateTokens; }