import type { Category, Mode } from '../config/categories.js'; import type { OptimizationResult, UserProvidedSource } from './types.js'; export interface OptimizeRequest { prompt: string; category?: Category; platform?: string; mode?: Mode; modeExplicit?: boolean; enrichContext?: boolean; sessionId?: string; filePath?: string; fileLanguage?: string; fileExcerpt?: string; cwd?: string; userLocale?: string; userPinnedInstructions?: string; userPreferredMode?: Mode; includeBundle?: boolean; skipIntentResolution?: boolean; /** * Caller-provided grounding sources (used by the ground_prompt MCP tool). * Each becomes a pinned, top-priority section in the curated grounding. */ userProvidedSources?: UserProvidedSource[]; /** * Override the LLM model for THIS optimize call. When omitted, uses the * env-default LLM_MODEL. Per-stage routing in compose_prompt sets this. * Note: this overrides only the rewrite-step model; the analyzer and * memory-retrieval embedder are unaffected. */ model?: string; /** * Per-call cancellation signal (1.10.0). Propagated to the optimize LLM call * (and the analyzer) so a client cancel aborts work in flight. */ signal?: AbortSignal; } export declare class OptimizationEngine { private searchClient; optimize(request: OptimizeRequest): Promise; /** User hint wins unless analyzer disagreed confidently. */ private resolveCategory; private generateId; /** * Dual semantic retrieval: vector search over facts + past optimizations * + pack chunks. Swallows errors so a memory outage never breaks optimize. */ private retrieveFromMemory; /** * Fire-and-forget persistence into the long-term memory layer. Swallows * errors; every optimization is best-effort. */ private persistToMemoryAsync; } export declare function getOptimizationEngine(): OptimizationEngine;