/**
 * Cursor exec-channel → local tool bridge.
 *
 * Cursor's agent protocol executes tools server-drivenly: mid-stream, the
 * server sends exec frames and blocks until the client answers in band. The
 * `cursor-agent` API dispatches those frames onto this bridge, which maps
 * each frame's args onto the session's real tools (`read`, `bash`, `edit`,
 * `write`, `grep`, `find`, `ls`, plus MCP/extension tools by name) and runs
 * each one as a one-call batch on the prepared pipeline model-issued calls
 * run on — so validation, approvals, sandboxing, truncation, rendering and
 * the execution witness stay identical (#5780).
 *
 * The arg translations here MUST mirror the display blocks the API
 * synthesizes (`synthesizeCursorExecToolCall` call sites): the transcript
 * shows one operation, so a different one must not run.
 */
import { type AgentEvent, type AgentTool, type AgentToolResult, type BatchStoreFactory, type ExecutionPipelineWitness, type ExecutionScope } from "@earendil-works/pi-agent-core";
import { type CursorExecHandlers } from "@earendil-works/pi-ai";
import type { ToolCallEvent, ToolCallEventResult } from "./extensions/types.ts";
export interface CursorExecBridgeOptions {
    /**
     * Resolve an executable tool by name. Backed by the session's full tool
     * registry (builtin + extension tools), not only the active set: Cursor
     * drives its native tools (read/bash/grep/ls/write) over the exec channel
     * regardless of which tools the request advertised.
     */
    getTool: (name: string) => AgentTool | undefined;
    /**
     * Surface tool lifecycle events to the host UI. Bridge-run calls run
     * mid-stream, outside the loop's own tool batch, so without these the live
     * tool card for a synthesized call never resolves.
     */
    emitEvent: (event: AgentEvent, runSignal: AbortSignal) => Promise<void>;
    /** Same tool_result hook the local tool loop emits; plan-touch trackers listen here. */
    emitToolResult?: (event: {
        toolName: string;
        toolCallId: string;
        args: unknown;
        result: AgentToolResult<unknown>;
        isError: boolean;
    }) => Promise<void>;
    /** Called once a call that reached the prepared pipeline ended, on every path: run, blocked, aborted or thrown. */
    settleToolCall?: (toolCallId: string) => void;
    /** Run the session's vetoable extension preflight before tool execution. */
    preflightToolCall?: (event: ToolCallEvent) => Promise<ToolCallEventResult | undefined>;
    /** Abort signal for in-flight bridge executions (the active run's signal). */
    getAbortSignal: () => AbortSignal | undefined;
    /** The per-batch store the prepared pipeline runs each call on (the agent's `batchStoreFactory`). */
    openBatchStore: BatchStoreFactory;
    /** The session's execution scope, as the loop passes it to its own batches. */
    getExecutionScope: () => ExecutionScope;
    /** The agent's `onExecutionPipeline` sink: one receipt per call, like a model-issued call. */
    recordWitness?: (witness: ExecutionPipelineWitness) => Promise<void> | void;
}
/**
 * Build the exec handlers passed to the `cursor-agent` API through the agent
 * loop config. Handlers return bare `ToolResultMessage`s; the API derives the
 * wire protobuf answer from them and pairs the transcript result.
 *
 * Deliberately absent handlers (the API answers with a typed refusal):
 * - `delete`: senpi has no delete tool and the bridge must not mutate the
 *   filesystem outside the tool/approval path.
 * - `diagnostics`: no LSP tool in this fork.
 * - `mcpApprovalPreflight`: approval decisions cannot be resolved without an
 *   interactive prompt, so smart-mode probes are conservatively refused.
 */
export declare function createCursorExecBridge(options: CursorExecBridgeOptions): CursorExecHandlers;
//# sourceMappingURL=cursor-exec-bridge.d.ts.map