/**
 * Conversation rewind — reconstruct a prefix of a Trace as an initialMessages
 * array suitable for `AgentLoopConfig.initialMessages`.
 *
 * Use case (T6b session time-travel & branch):
 *   `preste rewind --from <trace.json> --to-step N --then "<new task>"`
 *   starts a fresh run whose conversation begins with the original run's
 *   steps[0..N-1] (assistant outputs + tool results) and then receives a
 *   new user message.
 *
 * This is a "fork-style" replay — it does NOT attempt byte-identical
 * deterministic re-execution (see `src/replay/replay.ts` `replayFrom` for
 * that audit-grade path). It only reconstructs the message log so a new
 * autonomous run can take the same agent down a different branch.
 *
 * Policy gating:
 *   - "include" / "redact"  — `storedOutput` is present; replay possible.
 *   - "hmac" / "hash-only"  — payloads not stored; replay refused with a
 *                              `TraceReplayError` naming the offending step.
 *
 * Step type mapping:
 *   - llm_call          → assistant message (storedOutput rendered as text)
 *   - tool_call         → tool message (storedOutput rendered, toolName attached)
 *   - guard_check       → skipped (no conversation effect)
 *   - phase_transition  → skipped
 *   - hitl_gate         → skipped (handled by the loop's HITL machinery at runtime)
 *
 * @module trace/rewind
 */
import type { Trace } from "./schema.js";
/**
 * Thrown when a Trace prefix cannot be reconstructed — bad bounds or a
 * step whose payload policy redacts both input and output.
 */
export declare class TraceReplayError extends Error {
    constructor(msg: string);
}
/**
 * A reconstructed message — shape-compatible with
 * `AgentLoopConfig.initialMessages[number]`.
 *
 * `user` appears only as the leading "original task" message when
 * `ReconstructOptions.originalUserMessage` is provided; the remaining
 * reconstructed messages are always `assistant` or `tool`.
 */
export interface ReplayMessage {
    role: "user" | "assistant" | "tool";
    content: string;
    toolName?: string;
}
/** Options for `reconstructInitialMessages`. */
export interface ReconstructOptions {
    /**
     * Number of steps from the start of the trace to replay.
     * 0 returns an empty array (or just the original user message if set).
     * Must be in `[0, trace.steps.length]`.
     */
    toStep: number;
    /**
     * Optional: the original user task string (typically `trace.config.task`).
     * When set, it is prepended as a `{ role: "user", content }` message so the
     * model sees the original framing before the reconstructed assistant /
     * tool turns. Empty / whitespace-only strings are ignored.
     */
    originalUserMessage?: string;
}
/**
 * Reconstruct an `initialMessages` array from the first `toStep` steps
 * of a Trace. Bails early on policies that don't store payloads.
 */
export declare function reconstructInitialMessages(trace: Trace, opts: ReconstructOptions): ReplayMessage[];
//# sourceMappingURL=rewind.d.ts.map