import { type ConnectedContextPack, type RetrievalQuery, type SelectedScope } from "@oscharko-dev/keiko-contracts/connected-context";
import { type GroundedEvidenceCitation, type GroundedUncertainty } from "@oscharko-dev/keiko-contracts/bff-wire";
import type { RouteContext, RouteResult } from "./routes.js";
import type { Redactor, UiHandlerDeps } from "./deps.js";
import type { Chat, ChatConnectedScope, ChatMessage } from "./store/index.js";
import { type OrchestratorInput, type OrchestratorOutput } from "./grounded-orchestrator.js";
import { type GroundedRetriever, type MultiSourceAnswerer } from "./grounded-qa-multi-source.js";
import { type ConnectorRetrieve, type FolderRetriever, type HybridAnswerer } from "./grounded-qa-hybrid.js";
import { GROUNDED_SYSTEM_PROMPT } from "./grounded-prompt.js";
export declare function badRequest(message: string): RouteResult;
export declare function internalError(message: string): RouteResult;
export declare function mappedGatewayError(error: unknown, deps: UiHandlerDeps): RouteResult | undefined;
export declare function isValidGroundedPack(pack: ConnectedContextPack): boolean;
export declare function deriveScopeIdFrom(chat: Chat, cs: ChatConnectedScope, index: number): string;
export declare function buildSelectedScopeFrom(chat: Chat, cs: ChatConnectedScope, scopeId: string): SelectedScope;
export declare function buildQuery(content: string, nowMs: () => number): RetrievalQuery;
export declare function ensureNotCancelled(signal: AbortSignal): void;
export declare function packBudgetSummary(pack: ConnectedContextPack): string;
export declare function evidenceLines(pack: ConnectedContextPack, redactor: Redactor): readonly string[];
export declare function uncertaintyLines(pack: ConnectedContextPack, redactor: Redactor): readonly string[];
export { GROUNDED_SYSTEM_PROMPT };
export declare function redactString(redactor: Redactor, value: string): string;
export declare function buildCitations(pack: ConnectedContextPack, redactor: Redactor): readonly GroundedEvidenceCitation[];
export declare function buildUncertainty(pack: ConnectedContextPack, redactor: Redactor): readonly GroundedUncertainty[];
export type GroundedRunner = (input: OrchestratorInput) => Promise<OrchestratorOutput>;
export declare function persistGroundedExchange(deps: UiHandlerDeps, chatId: string, userContent: string, assistantContent: string): readonly [ChatMessage, ChatMessage];
export interface MultiSourceSeam {
    readonly retriever: GroundedRetriever;
    readonly answerer: MultiSourceAnswerer;
}
export interface HybridSeam {
    readonly folderRetriever?: FolderRetriever;
    readonly connectorRetrieve?: ConnectorRetrieve;
    readonly answer?: HybridAnswerer;
}
export declare function handleGroundedAsk(ctx: RouteContext, deps: UiHandlerDeps, runner?: GroundedRunner, multiSource?: MultiSourceSeam, hybrid?: HybridSeam): Promise<RouteResult>;
//# sourceMappingURL=grounded-qa.d.ts.map