/**
 * Turn execution handlers — extracted from StdioServer.
 * Handles: the shared turn pipeline (runTurnPipeline) + thread.user_response (ask-user answers).
 */
import type { PermissionMetadataResolver, ToolCatalog } from "../../runtime/ports/index.js";
import type { ChatMessage, TokenUsage, ToolDefinition, TurnConfig } from "../../agent/types.js";
import type { AgentRpcRequest } from "../../protocol/wire/agent-rpc.js";
interface PendingAskUserRequest {
    resolve(answers: Record<string, string> | null): void;
}
export interface TurnControlHandlerHost {
    activeTurn: AbortController | null;
    permissionChecker?: PermissionMetadataResolver | null;
    toolCatalog?: ToolCatalog;
    pendingAskUser: Map<string, PendingAskUserRequest>;
    configureTurnMedia?(config: Record<string, unknown> | undefined, turnId: string): void;
    log(message: string): void;
    sendResponse(id: string | number, result?: unknown, error?: unknown): void;
}
export declare function hydrateTurnConfigFromModelMetadata(config: TurnConfig): TurnConfig;
export declare function hydrateAttachmentReferenceUrlsForTurn(messages: ChatMessage[]): ChatMessage[];
export declare function activateAttachmentToolsForTurn(toolCatalog: ToolCatalog, messages: ChatMessage[]): string[];
export declare function getFocusedAttachmentToolNamesForTurn(messages: ChatMessage[]): Set<string> | null;
type FocusedAttachmentModelPurpose = "imageUnderstanding" | "videoUnderstanding";
export declare function getFocusedAttachmentUnsupportedContentForTurn(messages: ChatMessage[], purpose: FocusedAttachmentModelPurpose): string | null;
export declare function getFocusedAttachmentModelPurposeForTurn(messages: ChatMessage[]): FocusedAttachmentModelPurpose | null;
export declare function refreshPermissionCheckerToolMeta(permissionChecker: PermissionMetadataResolver | null | undefined, tools: ToolDefinition[]): void;
export declare function handleUserResponse(this: TurnControlHandlerHost, msg: AgentRpcRequest): void;
export interface TurnPipelineInput {
    turnId: string;
    sessionId: string;
    messages: ChatMessage[];
    tools: ToolDefinition[];
    config?: Record<string, unknown>;
    previousTurnId?: string;
}
export interface TurnPipelineResult {
    content: string;
    usage?: TokenUsage;
    /** Turn error (if any), surfaced in-band for the ACP session/prompt response. The
     * turn.error notification is still emitted for streaming UIs. */
    error?: {
        message: string;
        code?: string;
        recoverable?: boolean;
    };
    /** Agent-resolved project id for this turn (forwarded to the ACP session/prompt response). */
    projectId?: string;
    /** Resolved model/provider for this turn (forwarded to the ACP session/prompt response). */
    model?: string;
    provider?: string;
}
/**
 * Shared turn pipeline: project routing, history hydration, system-prompt assembly,
 * agent execution (executeTurnCore), and post-turn persistence/summary/split.
 * Invoked with `.call(host, input)` by the standard-ACP `session/prompt` handler.
 */
export declare function runTurnPipeline(this: any, input: TurnPipelineInput): Promise<TurnPipelineResult>;
export {};
