import type { AssistantMessageEventStream, Context, Message, Model, ProviderHeaders, SimpleStreamOptions, ThinkingLevel } from "@earendil-works/pi-ai/compat";
export declare const SIDE_QUERY_INSTRUCTION: string;
export declare const DEFAULT_ESTABLISHMENT_TIMEOUT_MS = 30000;
export interface SideQueryContextInput {
    systemPrompt: string;
    /** The turn's stable prefix of `systemPrompt`; the side query keeps it so it reads the turn's cache (senpi#4447). */
    systemPromptStablePrefix?: string;
    history: readonly Message[];
    question: string;
    promptContextWindow?: number;
}
export declare function getSideQueryPromptContextWindow(model: Pick<Model<string>, "contextWindow" | "maxTokens">): number;
export declare function buildSideQueryContext(input: SideQueryContextInput): Context;
export interface SideQueryAuth {
    apiKey?: string;
    headers?: ProviderHeaders;
    extraBody?: Record<string, unknown>;
}
export interface SideQueryDeps {
    model: Model<any>;
    auth: SideQueryAuth;
    sessionId: string;
    thinkingLevel?: ThinkingLevel;
    /** Public (untranscribed) stream shape: the session model runtime normalizes the context itself. */
    streamFn?: (model: Model<any>, context: Context, options?: SimpleStreamOptions) => AssistantMessageEventStream;
    establishmentTimeoutMs?: number;
}
export interface SideQueryCallbacks {
    onTextDelta?: (delta: string) => void;
    signal?: AbortSignal;
}
export interface SideQueryResult {
    replyText: string;
}
export declare function runSideQuery(deps: SideQueryDeps, context: Context, callbacks?: SideQueryCallbacks): Promise<SideQueryResult>;
//# sourceMappingURL=side-query.d.ts.map