import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback, CustomMessage } from "@oh-my-pi/pi-agent-core";
import type { Component } from "@oh-my-pi/pi-tui";
import type { RenderResultOptions } from "../extensibility/custom-tools/types.js";
import type { Theme } from "../modes/theme/theme.js";
import type { ToolSession } from "./index.js";
declare const resolveSchema: import("arktype/internal/variants/object.ts").ObjectType<{
    action: "apply" | "discard";
    reason: string;
    extra?: Record<string, unknown> | undefined;
}, {}>;
type ResolveParams = typeof resolveSchema.infer;
export interface ResolveToolDetails {
    action: "apply" | "discard";
    reason: string;
    extra?: Record<string, unknown>;
    sourceToolName?: string;
    label?: string;
    sourceResultDetails?: unknown;
}
/**
 * Register a non-forcing resolve-protocol handler for a staged preview. Wraps the
 * caller's apply/reject into an onInvoked closure (matching the resolve schema) and
 * stores it on the tool-choice queue's pending-invoker registry under a UNIQUE id.
 * The `resolve` tool dispatches to it; the agent-loop's SoftToolRequirement
 * lifecycle injects the preview reminder and escalates to a forced `resolve` only
 * if the model declines — so a compliant turn pays ZERO tool_choice change (no
 * prompt-cache messages-cache invalidation).
 *
 * This is the canonical entry point for any tool that wants preview/apply
 * semantics. No session-level abstraction is needed: callers pass their
 * apply/reject functions directly.
 */
export declare function queueResolveHandler(session: ToolSession, options: {
    label: string;
    sourceToolName: string;
    apply(reason: string, extra?: Record<string, unknown>): Promise<AgentToolResult<unknown>>;
    reject?(reason: string, extra?: Record<string, unknown>): Promise<AgentToolResult<unknown> | undefined>;
}): void;
/**
 * The canonical preview reminder. The resolve mechanism owns the wording; the
 * agent-loop delivers it via the session's `SoftToolRequirement.reminder` (injected
 * once per pending-preview head) instead of a host-side steer, so it lands as a
 * stable mid-history append and never churns the cached prefix.
 */
export declare function buildResolveReminderMessage(sourceToolName: string): CustomMessage;
/**
 * Shared invocation runner used by both queued (in-flight) handlers and
 * standing handlers (e.g. plan-mode approval). Discriminates on action,
 * routes through the caller's apply/reject, and wraps the resulting tool
 * payload with `ResolveToolDetails` so the renderer and event-controller
 * see a consistent shape.
 */
export declare function runResolveInvocation(params: ResolveParams, options: {
    sourceToolName: string;
    label: string;
    apply(reason: string, extra?: Record<string, unknown>): Promise<AgentToolResult<unknown>>;
    reject?(reason: string, extra?: Record<string, unknown>): Promise<AgentToolResult<unknown> | undefined>;
    /** Invoked synchronously when `apply()` throws, before the error is rethrown.
     *  The queued caller uses this to re-push the resolve directive so the
     *  pending preview survives a failed apply (e.g. overlapping ast_edit
     *  replacements) and the model can `discard` or fix-and-retry. */
    onApplyError?(error: unknown): void;
}): Promise<AgentToolResult<ResolveToolDetails>>;
export declare class ResolveTool implements AgentTool<typeof resolveSchema, ResolveToolDetails> {
    private readonly session;
    readonly name = "resolve";
    readonly approval: "read";
    readonly label = "Resolve";
    readonly hidden = true;
    readonly description: string;
    readonly parameters: import("arktype/internal/variants/object.ts").ObjectType<{
        action: "apply" | "discard";
        reason: string;
        extra?: Record<string, unknown> | undefined;
    }, {}>;
    readonly strict = true;
    readonly intent: (args: Partial<ResolveParams>) => string;
    constructor(session: ToolSession);
    execute(_toolCallId: string, params: ResolveParams, signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback<ResolveToolDetails>, _context?: AgentToolContext): Promise<AgentToolResult<ResolveToolDetails>>;
}
export declare const resolveToolRenderer: {
    renderCall(args: ResolveParams, _options: RenderResultOptions, uiTheme: Theme): Component;
    renderResult(result: {
        content: Array<{
            type: string;
            text?: string;
        }>;
        details?: ResolveToolDetails;
        isError?: boolean;
    }, _options: RenderResultOptions, uiTheme: Theme): Component;
    inline: boolean;
    mergeCallAndResult: boolean;
};
export {};
