import type { AgentTool, AgentToolResult, NestedRequest } from "@earendil-works/pi-agent-core";
import type { ToolCallEventResult, ToolResultEventResult } from "../../core/extensions/types.ts";
/** The extensions' tool handlers a call runs around its tool, as a session runs them (`agent-session.ts`). */
export interface LooplessToolHandlers {
    /** `tool_call` handlers; `input` is the validated arguments object, which a handler may rewrite in place. */
    beforeToolCall(event: {
        readonly toolName: string;
        readonly toolCallId: string;
        readonly input: Record<string, unknown>;
        readonly nested?: NestedRequest;
    }): Promise<ToolCallEventResult | undefined>;
    afterToolCall(event: {
        readonly toolName: string;
        readonly toolCallId: string;
        readonly input: Record<string, unknown>;
        readonly result: AgentToolResult<unknown>;
        readonly isError: boolean;
        readonly nested?: NestedRequest;
    }): Promise<ToolResultEventResult | undefined>;
}
/**
 * Runs one tool call the way the agent loop runs a model-issued one (`runToolCall`, agent-loop.ts): argument preparation
 * and schema validation; then, when `handlers` are given, the `tool_call` handlers, where a block, an abort or a handler
 * that throws stops the call before the tool runs (fail-closed, as a session does); the tool; and the `tool_result`
 * handlers. Invalid arguments, a blocked call and a failing tool come back as an `isError` result, never a rejection
 * (senpi#5413).
 */
export declare function runLooplessToolCall(tool: AgentTool, call: {
    readonly toolCallId: string;
    readonly params: unknown;
    readonly signal?: AbortSignal;
    /** The running call's requests back to the loop that owns it (on a hand). */
    readonly nested?: NestedRequest;
}, handlers?: LooplessToolHandlers): Promise<AgentToolResult<unknown>>;
//# sourceMappingURL=loopless-tool-call.d.ts.map