import { type IAdminForth } from "adminforth";
import type { AgentSessionStore } from "../persistence/sessionStore.js";
import type { SteerBuffer } from "../domain/steerBuffer.js";
import type { PluginOptions } from "../types.js";
import type { LlmPort } from "./ports.js";
import type { DebugSink, HandleTurnInput, HandleEditTurnInput, PendingInterrupt, RunAndPersistAgentResponseInput, RunAndPersistAgentResponseResult } from "../domain/turnTypes.js";
/**
 * Build the provider-agnostic resume payload for a human-in-the-loop turn.
 * Exported for unit testing; the LLM port wraps it into a LangGraph Command.
 */
export declare function buildResumeValue(input: {
    decision: "approve" | "reject";
    interrupts?: PendingInterrupt[];
    prompt?: string;
}): {
    decisions: ({
        type: "approve";
        message?: undefined;
    } | {
        type: "reject";
        message: string;
    })[];
} | {
    [k: string]: {
        decisions: ({
            type: "approve";
            message?: undefined;
        } | {
            type: "reject";
            message: string;
        })[];
    };
};
export type RunTurnUseCaseDeps = {
    llm: LlmPort;
    sessions: AgentSessionStore;
    /** Per-session buffer of mid-turn steering instructions; cleared when a turn ends unconsumed. */
    steerBuffer: SteerBuffer;
    modes: PluginOptions["modes"];
    getAdminforth: () => IAdminForth;
    getAgentSystemPrompt: () => Promise<string>;
    /** True when a persistent checkpointer is configured (not the in-memory MemorySaver). */
    hasPersistentCheckpointer: boolean;
    /**
     * True when `turnResource.checkpointIdField` is configured — the tip checkpoint id
     * is then recorded per turn, enabling message editing / branching.
     */
    turnCheckpointsEnabled: boolean;
    /** Resource config used for the edit ownership check + turn lookups. */
    sessionResource: PluginOptions["sessionResource"];
    /** Factory for the per-turn debug sink; the concrete impl lives in the llm layer. */
    createDebugSink: () => DebugSink;
};
/**
 * Single entry point for running an agent turn: prepare (start/resume) → build
 * the prompt → stream from the LLM port → consume the typed stream into SSE
 * events → persist the result. Replaces the former AgentTurnService plus the
 * TurnLifecycle/Context/Prompt/Persistence/StreamConsumer + ModeResolver stack.
 */
export declare class RunTurnUseCase {
    private readonly deps;
    private readonly pendingInterrupts;
    constructor(deps: RunTurnUseCaseDeps);
    private resolveMode;
    private buildContext;
    /**
     * Resolve the pending HITL interrupts for a resume. With a persistent checkpointer the
     * checkpoint is authoritative (correct across instances and restarts); with the in-memory
     * MemorySaver the in-process cache is authoritative (single process, cannot be stale).
     */
    private resolvePendingInterrupts;
    /** Verify the session exists and belongs to the requesting admin user. */
    private assertSessionOwnership;
    /**
     * Prepare an edit/branch turn: validate ownership, resolve the fork checkpoint from
     * the previous turn, truncate the conversation after the edited turn, and reuse the
     * edited turn's id for the regenerated response.
     */
    private prepareEditTurn;
    private prepareTurn;
    private buildMessages;
    private handleInterrupt;
    private runAgentTurn;
    runAndPersistAgentResponse(input: RunAndPersistAgentResponseInput): Promise<RunAndPersistAgentResponseResult>;
    handleTurn(input: HandleTurnInput): Promise<RunAndPersistAgentResponseResult>;
    handleEditTurn(input: HandleEditTurnInput): Promise<RunAndPersistAgentResponseResult>;
}
