/** * ground_prompt — explicit retrieval-augmented variant of optimize_prompt. * * The user passes a prompt PLUS one or more grounding sources (text bodies * with labels). The engine pins those sources at the very top of the * grounding context — above project rules, above pinned instructions — * and runs the normal optimize flow on top. The result includes a * `usedSources` array confirming which sources actually made it into the * curated grounding (so callers can verify nothing was dropped). * * Differences vs. optimize_prompt + userPinnedInstructions: * - Multiple labeled sources, each tracked independently in trace + result. * - Strict mode: zero sources → error, not silent degradation. * - Source bodies are capped at 4000 chars each so a single huge paste * can't blow the entire grounding budget. */ import type { OptimizationResult, UserProvidedSource } from '../optimization/types.js'; import type { Category, Mode } from '../config/categories.js'; export interface GroundInputs { prompt: string; sources: UserProvidedSource[]; category?: Category; platform?: string; mode?: Mode; modeExplicit?: boolean; cwd?: string; filePath?: string; fileLanguage?: string; fileExcerpt?: string; sessionId?: string; userLocale?: string; userPinnedInstructions?: string; enrichContext?: boolean; skipIntentResolution?: boolean; includeBundle?: boolean; /** Per-call LLM model override (forwarded to the underlying optimize call). */ model?: string; /** Per-call cancellation signal (1.10.0) — forwarded to the optimize call. */ signal?: AbortSignal; } export interface GroundResult extends OptimizationResult { /** * The labels of the sources the curator actually selected (every source * is pinned, so this should normally equal the input — but if a source * was empty after trimming, it'll be omitted here). */ usedSources: Array<{ index: number; label: string; kind?: string; }>; /** Sources that came in but produced empty bodies after sanitization. */ droppedSources: Array<{ index: number; label: string; reason: string; }>; } export declare function groundPrompt(inputs: GroundInputs): Promise;