/**
 * Per-attempt mutable state bag for the agent run.
 *
 * PostToolUse on Write/Edit records modified files.
 * StatusReporter.onStatus records the last status message.
 * PreCompact serializes this bag to disk so a post-compaction UserPromptSubmit
 * hook can hydrate the agent with the context that compaction just dropped.
 *
 * Kept in its own module so hooks, wizard-tools, and tests can all touch it
 * without a cyclic import through agent-interface.
 */
import { z } from 'zod';
declare const SerializedAgentStateSchema: z.ZodObject<{
    schemaVersion: z.ZodLiteral<"amplitude-wizard-agent-state/1">;
    runId: z.ZodNullable<z.ZodString>;
    attemptId: z.ZodNullable<z.ZodString>;
    modifiedFiles: z.ZodArray<z.ZodString>;
    lastStatus: z.ZodNullable<z.ZodObject<{
        code: z.ZodString;
        detail: z.ZodString;
    }, z.core.$strip>>;
    compactionCount: z.ZodNumber;
    persistedAt: z.ZodNumber;
}, z.core.$strip>;
/** Serialized shape written to disk on PreCompact. */
export type SerializedAgentState = z.infer<typeof SerializedAgentStateSchema>;
/**
 * Per-attempt agent recovery bag. Tracks which files the agent has written,
 * the last structured status it reported, and how many compactions have
 * happened this attempt. Serializes to a deterministic tmpdir path so a
 * post-compaction hook can read the snapshot back.
 */
export declare class AgentState {
    private readonly modifiedFiles;
    private lastStatus;
    private compactionCount;
    private attemptId;
    /**
     * Discovery facts captured from prior in-attempt tool calls so a retry
     * doesn't redo the same exploration. Keyed by short stable names. Values
     * are short human-readable summaries already trimmed for prompt context.
     * Populated incrementally as tool results stream in (see
     * `recordToolResultDiscovery` below); read on retry to build the
     * `<retry-recovery>` hint prepended to the next attempt's user prompt.
     *
     * Bounded to a few entries — these are only the pre-discovery tools that
     * dominate the cold-start tail (package-manager / env-key probes / which
     * skill was loaded). Don't dump full Read/Glob outputs here; the hint
     * is meant to skip a tool call, not replay an entire conversation.
     */
    private readonly discoveries;
    /**
     * Tool calls observed in the current attempt — small bounded counter
     * keyed by tool name. Used to surface "you already tried X N times" in
     * the retry hint so the model doesn't loop on a tool that's failing.
     */
    private readonly toolUseCounts;
    setAttemptId(attemptId: string): void;
    recordModifiedFile(filePath: string): void;
    recordStatus(code: string, detail: string): void;
    recordCompaction(): void;
    recordToolUse(toolName: string): void;
    /**
     * Stash a one-line summary of a discovery-shaped tool result so the next
     * attempt (after a transient retry) can skip the corresponding probe.
     *
     * Caller is responsible for trimming the summary — anything longer than
     * ~200 chars gets dropped to keep the retry-hint block small. Empty /
     * unknown summaries are a no-op (better to omit a fact than ship a
     * misleading one to the next attempt).
     */
    recordDiscovery(key: string, summary: string): void;
    getDiscoveries(): ReadonlyMap<string, string>;
    snapshot(): SerializedAgentState;
    /** Persist the current state to the cache-root path for this attempt. */
    persist(): string | null;
    snapshotPath(): string;
    reset(): void;
    clearModifiedFiles(): void;
    clearLastStatus(): void;
    clearDiscoveries(): void;
}
/**
 * Render a compact retry-recovery note to prepend to the next attempt's
 * user prompt. Mirrors `buildRecoveryNote` (post-compaction) but is keyed
 * to wizard-level retries triggered by transient gateway errors. The
 * agent restarts with a fresh conversation; without this hint, it
 * redoes detect_package_manager / check_env_keys / Skill loads and
 * — much worse — re-writes files the prior attempt already created
 * (potentially with different content), since a fresh SDK conversation
 * has no idea anything was written.
 *
 * Sections (each rendered only when it has content):
 *   1. discoveries — facts probed by prior tool calls (skip the probes)
 *   2. modifiedFiles — files already on disk (Read before re-writing)
 *   3. lastStatus — the spinner message the user last saw
 *
 * Returns an empty string when none of the sections have content — the
 * caller can unconditionally concatenate.
 */
export declare function buildRetryHint(state: AgentState): string;
/**
 * Read a previously-persisted snapshot. Returns null on any failure so the
 * caller can fall back to a cold start. Uses zod validation to ensure all
 * required fields are present and correctly typed.
 */
export declare function loadSnapshot(path: string): SerializedAgentState | null;
/**
 * Load + delete a snapshot in one step so restoration fires only once per
 * compaction cycle. Non-throwing.
 */
export declare function consumeSnapshot(path: string): SerializedAgentState | null;
/**
 * Render a compact recovery note to prepend to a user prompt after
 * compaction. Keeps the block short so it doesn't eat context budget —
 * only the signals an LLM actually needs to re-orient.
 */
export declare function buildRecoveryNote(snap: SerializedAgentState): string;
export {};
