import type { SnapshotStore } from "@pk-nerdsaver-ai/hashline";
import type { AgentTool } from "@pk-nerdsaver-ai/pi-agent-core";
import { type Component, Container, type NativeScrollbackLiveRegion, type TUI } from "@pk-nerdsaver-ai/pi-tui";
/**
 * Transcript-side probe telling a block whether it is still inside the live
 * (repaintable) region. Implemented by `TranscriptContainer`; injected rather
 * than imported so the component stays decoupled from the transcript.
 */
export interface TranscriptLiveRegionProbe {
    isBlockInLiveRegion(component: Component): boolean;
}
export interface ToolExecutionOptions {
    snapshots?: SnapshotStore;
    showImages?: boolean;
    editFuzzyThreshold?: number;
    editAllowFuzzy?: boolean;
    /** Live-region probe used to settle detached task progress once the block
     * leaves the repaintable transcript region. */
    liveRegion?: TranscriptLiveRegionProbe;
}
export interface ToolExecutionHandle {
    updateArgs(args: any, toolCallId?: string): void;
    updateResult(result: {
        content: Array<{
            type: string;
            text?: string;
            data?: string;
            mimeType?: string;
        }>;
        details?: any;
        isError?: boolean;
    }, isPartial?: boolean, toolCallId?: string): void;
    setArgsComplete(toolCallId?: string): void;
    setExpanded(expanded: boolean): void;
}
/** Drive pending-tool redraws at 30fps for live tool headers and displaceable
 * poll blocks. The TUI throttles at the same cadence, and static frames diff to
 * a no-op redraw at ~zero cost. */
export declare const SPINNER_RENDER_INTERVAL_MS: number;
/** Advance the spinner glyph at its classic ~12.5fps step, decoupled from the
 * render cadence (mirrors `Loader`). */
export declare const SPINNER_GLYPH_ADVANCE_MS = 80;
/** Phase-locked spinner glyph index shared by every live tool block so parallel
 * spinners advance in lockstep instead of each tracking its own start time. */
export declare function sharedSpinnerFrame(frameCount: number, now?: number): number;
/**
 * Component that renders a tool call with its result (updateable)
 */
export declare class ToolExecutionComponent extends Container implements NativeScrollbackLiveRegion {
    #private;
    constructor(toolName: string, args: any, options: ToolExecutionOptions | undefined, tool: AgentTool | undefined, ui: TUI, cwd?: string, _toolCallId?: string);
    updateArgs(args: any, _toolCallId?: string): void;
    /**
     * Signal that args are complete (tool is about to execute).
     * This triggers an immediate final diff computation for edit-like tools.
     */
    setArgsComplete(_toolCallId?: string): void;
    /**
     * Await the streaming diff recompute kicked off by the most recent
     * `updateArgs`/`setArgsComplete`. The recompute reads the file and re-runs the
     * whole-file Myers diff off the render path, signalling completion only via a
     * throttled `requestRender`. Tests await this to sample a *settled* preview
     * deterministically instead of racing the spinner's render ticks.
     */
    whenPreviewSettled(): Promise<void>;
    updateResult(result: {
        content: Array<{
            type: string;
            text?: string;
            data?: string;
            mimeType?: string;
        }>;
        details?: any;
        isError?: boolean;
    }, isPartial?: boolean, _toolCallId?: string): void;
    /**
     * Standalone harnesses may mount a tool component directly under `TUI`
     * instead of inside `TranscriptContainer`. In that shape the component must
     * report its own live-region seam for provisional previews, or the core
     * renderer treats it like shell output and commits tail-window edit/eval/bash
     * previews to immutable native scrollback before the result replaces them.
     */
    getNativeScrollbackLiveRegionStart(): number | undefined;
    /**
     * Whether this block has reached a terminal state for transcript freezing.
     * Reports `false` while it can still visually change so the
     * {@link TranscriptContainer} keeps it inside the repaintable live region:
     * a foreground tool awaiting its result, or one streaming partial output.
     * A final (non-partial) result, a background-async tool the agent has moved
     * past, or an explicit {@link seal} flips it to `true`.
     */
    isTranscriptBlockFinalized(): boolean;
    /**
     * Whether this still-live block's settled rows may enter native scrollback
     * (see `FinalizableBlock.isTranscriptBlockCommitStable`). Renderers classify
     * pending views by durability instead of by tool name: a provisional view is
     * allowed to be useful on screen, but finalization may replace or re-anchor
     * it wholesale, so committing any of its rows would strand stale preview
     * bytes in immutable scrollback. Non-provisional views stream rows whose
     * committed prefix survives the remaining transitions.
     */
    isTranscriptBlockCommitStable(): boolean;
    /**
     * Mark the tool terminal even though no result arrived (the turn aborted or
     * abandoned it) and stop animating, so it can freeze and stops pinning the
     * transcript live region.
     */
    seal(): void;
    /**
     * Whether this block is a waiting `job` poll (every watched job still
     * running) that has not been sealed. Such a block never finalized, so none
     * of its rows entered native scrollback (the ticking spinner keeps the
     * stable-prefix ratchet at zero) and the whole block can be removed when a
     * follow-up `job` call supersedes it.
     */
    isDisplaceableBlock(): boolean;
    /**
     * Stop spinner animation and cleanup resources.
     */
    stopAnimation(): void;
    setExpanded(expanded: boolean): void;
    setShowImages(show: boolean): void;
    invalidate(): void;
}
