/** * QuickMeta Background - Optional detailed analysis in background * * Enables fire-and-forget meta-analysis that doesn't block the user. * Now supports both QuickMeta (legacy) and SemanticPhaseMeta (LLM-based). */ import type { Phase } from '../../types/pattern.js'; import type { PhaseMetrics } from '../../types/quickmeta.js'; import type { SemanticPhaseMeta } from '../../types/semantic-meta.js'; /** * Configuration for background meta-analysis */ export interface BackgroundAnalysisConfig { /** Whether to run full analysis after Phase 4 */ enabled: boolean; /** Minimum session duration (ms) to trigger analysis */ minDurationMs: number; /** Callback when analysis is ready (for notification) */ onComplete?: (sessionId: string, reportPath: string) => void; } /** * Check if background analysis should be triggered */ export declare function shouldTriggerBackgroundAnalysis(sessionId: string, totalDurationMs: number, config?: BackgroundAnalysisConfig): { shouldTrigger: boolean; reason: string; }; /** * Build prompt for background meta-analyzer * Includes all QuickMeta from the session for full analysis */ export declare function buildBackgroundAnalysisPrompt(sessionId: string): Promise; /** * Get total session duration from QuickMeta */ export declare function getSessionDuration(sessionId: string): Promise; /** * Summarize QuickMeta for quick reference */ export declare function getQuickMetaSummary(sessionId: string): Promise<{ phases: number; totalPatterns: number; totalDecisions: number; totalRisks: number; unresolvedRisks: number; totalDuration: number; }>; /** * Format QuickMeta as markdown for review */ export declare function formatQuickMetaAsMarkdown(sessionId: string): Promise; /** * Build prompt for phase-meta-extractor agent * * Creates a detailed prompt for LLM-based semantic extraction of phase insights. * The LLM analyzes the raw phase output and extracts structured metadata. * * @param phase - The phase being analyzed * @param phaseOutput - Raw output from the phase (agent responses, tool calls, etc.) * @param sessionId - Session identifier * @param metrics - Phase execution metrics * @returns Formatted prompt for the phase-meta-extractor agent */ export declare function buildPhaseMetaPrompt(phase: Phase, phaseOutput: string, sessionId: string, metrics: PhaseMetrics): string; /** * Get phases that come before the target phase * * Used to determine which phase metas to load for injection into the current phase. * * @param targetPhase - The phase that will receive prior context * @returns Array of phases that precede targetPhase */ export declare function getPriorPhases(targetPhase: Phase): Phase[]; /** * Format prior phase metas for injection into next phase prompt * * Aggregates semantic metadata from completed phases and formats it for injection * into the next phase's agent prompt. This provides cross-phase context. * * @param metas - Array of semantic phase metas from prior phases * @param targetPhase - The phase that will receive this context * @returns Formatted XML-like string for injection */ export declare function formatMetaInjection(metas: SemanticPhaseMeta[], targetPhase: Phase): string; /** * Wait for background semantic metas to be generated with timeout * * Polls the filesystem for semantic phase meta files until all expected phases * have their metas generated, or timeout is reached. Used in Phase 4 to wait * for all background meta extraction to complete before aggregation. * * @param sessionId - Session identifier * @param timeout - Maximum time to wait in milliseconds (default: 30000ms) * @returns Promise resolving to phase metas (null if not found) */ export declare function waitForBackgroundMetas(sessionId: string, timeout?: number): Promise>; //# sourceMappingURL=background.d.ts.map