/** * Message Builder Service * * Constructs system and user messages for LLM prompts. * Extracted from StageExecutor to follow Single Responsibility Principle. * * Responsibilities: * - System message construction with agent profile, prompt, and context * - Output format instruction generation * - Escalation instruction generation * - User message formatting with input resolution */ import { getLogger } from '../output/logger.js'; type Logger = ReturnType; /** * Options for building a system message */ export interface SystemMessageOptions { /** Agent profile/role description */ agentProfile: string; /** Pre-loaded available agents content */ availableAgents?: null | string; /** Learned patterns & decisions from prior sessions */ agentMemory?: null | string; /** Compact codebase map from AST index */ codebaseMap?: null | string; /** Escalation criteria to include */ escalationCriteria?: string[]; /** Expected output property names */ expectedOutputs?: string[]; /** Project guidance content */ projectGuidance?: null | string; /** Project knowledge content */ projectKnowledge?: null | string; /** Task-specific prompt content */ promptContent: string; } /** * Service for building LLM messages */ export declare class MessageBuilderService { private readonly logger; constructor(logger?: Logger); /** * Build system message with all components * * Structure: * 1. Project Guidance - AI behaviour instructions * 2. Agent Profile - Role-specific instructions * 3. Prompt Content - Task-specific instructions * 4. Available Agents - Pre-loaded team references * 5. Project Knowledge - Context for this task * 6. Output Format Instructions - Expected response structure * 7. Escalation Instructions - When to escalate */ buildSystemMessage(options: SystemMessageOptions): string; private appendOptional; private logMessageStats; /** * Build output format instruction to enforce JSON structure */ buildOutputFormatInstruction(expectedOutputs: string[]): string; /** * Build escalation protocol instructions for the LLM */ buildEscalationInstruction(escalationCriteria: string[]): string; /** * Append human-provided guidance (from an escalation "modify" decision) to an * already-built user message, for re-running a stage with corrective direction. */ appendGuidance(userMessage: string, guidance: string): string; /** * Build user message with resolved inputs * Formats file contents in a clear, readable way for the LLM */ buildUserMessage(inputs: Record): string; /** * Separate inputs into regular inputs and file contents */ private separateInputs; /** * Format a regular input value for the message */ private formatRegularInput; } /** * Get the singleton MessageBuilderService instance */ export declare function getMessageBuilderService(): MessageBuilderService; /** * Reset the singleton instance (for testing) */ export declare function resetMessageBuilderService(): void; export {}; //# sourceMappingURL=message-builder.service.d.ts.map