import type { AgentTool, AgentToolContext, AgentToolResult, AgentToolUpdateCallback } from "@oh-my-pi/pi-agent-core"; import type { Component } from "@oh-my-pi/pi-tui"; import * as z from "zod/v4"; import type { RenderResultOptions } from "../extensibility/custom-tools/types"; import type { Theme } from "../modes/theme/theme"; import type { ToolSession } from "."; declare const resolveSchema: z.ZodObject<{ action: z.ZodEnum<{ apply: "apply"; discard: "discard"; }>; reason: z.ZodString; extra: z.ZodOptional>; }, z.core.$strip>; type ResolveParams = z.infer; export interface ResolveToolDetails { action: "apply" | "discard"; reason: string; extra?: Record; sourceToolName?: string; label?: string; sourceResultDetails?: unknown; } /** * Queue a resolve-protocol handler on the tool-choice queue. Forces the next * LLM call to invoke the hidden `resolve` tool, wraps the caller's apply/reject * callbacks into an onInvoked closure that matches the resolve schema, and * steers a preview reminder so the model understands why. * * 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): Promise>; reject?(reason: string, extra?: Record): Promise | undefined>; }): void; /** * 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): Promise>; reject?(reason: string, extra?: Record): Promise | 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>; export declare class ResolveTool implements AgentTool { private readonly session; readonly name = "resolve"; readonly label = "Resolve"; readonly hidden = true; readonly description: string; readonly parameters: z.ZodObject<{ action: z.ZodEnum<{ apply: "apply"; discard: "discard"; }>; reason: z.ZodString; extra: z.ZodOptional>; }, z.core.$strip>; readonly strict = true; readonly intent: (args: Partial) => string; constructor(session: ToolSession); execute(_toolCallId: string, params: ResolveParams, signal?: AbortSignal, _onUpdate?: AgentToolUpdateCallback, _context?: AgentToolContext): Promise>; } 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 {};