import type { PermissionMode, ToolExecuteContext, ToolSpec } from "./types.js";
/** The first-party plan-review tool's name (design/80 D-B; CC `ExitPlanMode` parity). Reserved when
 *  `TaskSpec.enablePlanMode` is set. */
export declare const PRESENT_PLAN_TOOL_NAME = "ExitPlanMode";
/** design/108 — the first-party "enter plan mode" tool's name (CC `EnterPlanMode` parity). Mounted (alongside
 *  `present_plan`) when `TaskSpec.enablePlanMode` is set, so the model can self-impose read-only plan mode. */
export declare const ENTER_PLAN_MODE_TOOL_NAME = "EnterPlanMode";
/**
 * What the plan-entry tool reads of its leg: the two facts the posture table's planning rows are picked by
 * (`PostureLegFacts` in `auto-mode-directive.ts`) — `isChildLeg`, this leg runs as a delegated child; and the leg's mounted
 * tools, asked at each call, from which "the plan-exit tool is on the roster" is read the table's way (the wire name or an alias a
 * call resolves). Absent seat ⇒ a leg with neither fact: a top-level leg with the exit tool (a library-direct mount).
 */
export interface PlanEntrySeat {
    readonly isChildLeg: boolean;
    readonly mountedTools: () => ReadonlyArray<{
        readonly name: string;
        readonly aliases?: readonly string[];
    }>;
}
/**
 * design/108 — the first-party `enter_plan_mode` tool (CC `EnterPlanMode` parity). A THIN composition over the
 * general `ctx.enterPlanMode()` primitive: the model calls it to self-impose read-only plan mode for the rest of
 * THIS run. `effect:"read"` (it grants nothing — it RESTRICTS). `executionMode:"sequential"` so that in a batch
 * like `[enter_plan_mode, edit_file]` the whole batch runs sequentially (agent-loop `hasSequentialToolCall`),
 * making enter execute (set the flag) BEFORE the sibling edit is prepared+gated — closing the same-batch window.
 * Exit is via `present_plan` (→ plan_review → human approve-resume), not by this tool.
 */
export declare function createEnterPlanModeTool(enterPlanMode: () => Promise<void> | void, seat?: PlanEntrySeat): ToolSpec;
/** The plan file a leg declared (`TaskSpec.planFile`), as the plan-exit tool's file arm reads it: the declared spelling (the
 *  card's `filePath`), the same path as the seat tells it to the model (`shown` — `planFileShown`, one line, verbatim, at
 *  most 4096 characters: the seat refuses any other), and the seat's one reader of what the file holds (`readPlanFile`,
 *  advertised-writable-dirs.ts). Type-only import: this module is below the seat and must not load it. */
export interface PlanFileSource {
    readonly path: string;
    readonly shown: string;
    readonly read: (signal?: AbortSignal) => Promise<import("./runner/advertised-writable-dirs.js").PlanFileReading>;
}
/**
 * What the plan-exit tool reads of its leg, at each call: `mode`, the leg's declared permission mode now (the word a parked
 * row records), and `enterPlanModeMounted`, whether `EnterPlanMode` is on the same roster (the refusal names it only where the
 * model can call it).
 */
export interface PlanExitSeat {
    readonly mode: () => PermissionMode;
    readonly enterPlanModeMounted: boolean;
}
/**
 * What the engine's plan-pause request primitive takes: the requester's own `reason`, and `requestedByCallId` — the id of
 * the call that asks, which the ENGINE binds from that call's own context through {@link reviewRequestFor} (both arms of the
 * first-party tool and a caller tool's per-call `ctx.requestReview` alike), never a tool-supplied argument. Parked on the
 * `plan_review` row as provenance: which call presented the plan awaiting a decision.
 */
export interface ReviewRequest {
    reason?: string;
    requestedByCallId?: string;
}
/**
 * A request a run holds until its next clean turn boundary: a {@link ReviewRequest}, plus what the requesting call's FINAL
 * result showed, recorded by {@link notePresentedPlan} where that call's end is projected — `presented`, the plan text its
 * card carried (the park mint digests it once onto the row), or `withdrawn`, the reason it showed a reviewer nothing (the
 * mint then refuses the pause and says why). No requester hands either in.
 */
export interface PendingReview extends ReviewRequest {
    presented?: string;
    /** Why the request was withdrawn at its own call's end: the call ended in error (its result failed or was withheld), or its
     *  plan card did not ride the frame (over the frame's bound, or with no plan string). Engine-internal: no wire face reads it. */
    withdrawn?: "ended_in_error" | "plan_not_carried";
}
/**
 * The leg's review-request cell: `pending`, the request the turn boundary hands to the park mint — the batch's FIRST request
 * that may still show a plan — and `later`, the batch's other requests in the order they were made. A withdrawn `pending`
 * yields to the first of `later` not withdrawn ({@link notePresentedPlan}); the boundary consumes both.
 */
export interface ReviewRequestCell {
    pending?: PendingReview;
    later?: PendingReview[];
}
/** The clause the park mint's refusal says for a withdrawn request (its one sentence family: `plan_review park skipped: …`). */
export declare function reviewWithdrawalClause(why: NonNullable<PendingReview["withdrawn"]>): string;
/**
 * The one binding of a plan-pause request to the call that asks: the requester's `reason` and the id of THIS call (the
 * engine-minted `ctx.toolCallId`), so no tool can name another call as the requester. A revive context's id is minted for the
 * revival and names no transcript call, and an empty id names none: neither is attributed. Nothing else crosses.
 */
export declare function reviewRequestFor(ctx: Pick<ToolExecuteContext, "toolCallId" | "reviveClaim"> | undefined, reason: string | undefined): ReviewRequest;
/**
 * Settle the pending request at its OWN call's end, by what that call's `tool_end` CARRIED — the leg's projection of the final
 * result, after every post-execution station (a hook that withheld the result has already emptied it and marked the error).
 * A person is asked only about a plan the card in front of them holds:
 *  · the frame carried a plan card ⇒ its `plan` is recorded (`presented`) and the pause carries its digest;
 *  · the call ended in error, or the result held a plan card the frame did not carry (left off for its size, or with no plan
 *    string) ⇒ the request is withdrawn (`withdrawn`): it showed a reviewer nothing, so no pause is minted for it;
 *  · the result held no plan card at all ⇒ nothing is recorded: a caller tool's own content is what it shows, and the pause
 *    carries no digest.
 * Only the requests this call made, only once: another call's end never settles them. The batch's first request that may
 * still show a plan stands in front — a withdrawn `pending` yields to the first of `later` not withdrawn, so a second plan
 * whose call was told the run is pausing is the one put to the person; when every request is withdrawn, the first stays, and
 * the mint says its reason. The card says what was SHOWN, whoever asked: a caller tool's card reads the same way.
 */
export declare function notePresentedPlan(cell: ReviewRequestCell, toolCallId: string, result: unknown, card: unknown, isError: boolean): void;
/**
 * design/80 D-B — the first-party `present_plan` tool (CC `ExitPlanMode` parity). A THIN composition over the
 * general `ctx.requestReview()` primitive: the model calls it with a plan; the tool returns the plan as its
 * content (so it reaches the reviewer via the transcript — the plan is NOT stored on the gate, design/76 §9),
 * and signals the engine to pause with a `plan_review` checkpoint at the next safe turn boundary. The tool has
 * NO side effect (`effect:"read"`); the actual pause/mint is the engine's, gated on a wired `checkpointStore`.
 * `requestReview` is the prepare-task closure (the same primitive `ctx.requestReview` exposes to caller tools).
 * `suspendGap` is the run's one "no suspend target" fact (absent: the park has a target, or the pause is not this run's to make);
 * where it is set the tool answers that the run is NOT pausing instead of saying it is: the per-task execution env is in neither
 * suspend target (the clause {@link import("./remote-env.js").suspendTargetGapOf} names — the one reading the park itself refuses
 * on), so the plan was not submitted, the run goes on, and no approval will come. The request is still made, so the engine's own
 * refusal stands on the deployment's error face as before. `seat` is the leg the tool reads at each call ({@link PlanExitSeat}):
 * outside plan mode both arms refuse before anything else, and no request is made.
 */
export declare function createPresentPlanTool(requestReview: (opts?: ReviewRequest) => void, seat: PlanExitSeat, planFile?: PlanFileSource, suspendGap?: string): ToolSpec;
