import type { PendingAction } from "./checkpoint-store.js";
import { type CallTargetReading } from "./effective-path-target.js";
import { type SkillGrantSource } from "./skill-grant.js";
import type { ReadLanding } from "../tools/fs/shell-read-identity.js";
import type { ToolCallPathTarget, ToolFamily, ToolHostTarget } from "./tool-face.js";
import { type RosterFaceMember, type RosterIdentityCarrier, type ToolRosterEntry } from "./tool-roster.js";
import type { AssertAllKeysHandled } from "./ask-origin.js";
type ParkedApproval = Extract<PendingAction, {
    kind: "tool_approval";
}>;
/** The readings of a call's path slot a target is bound under ({@link CallTargetReading}'s two directions). */
export declare const APPROVAL_TARGET_ROLES: readonly ["protective", "declared"];
export type ApprovalTargetRole = (typeof APPROVAL_TARGET_ROLES)[number];
/** The row's `targets` member: per role, the location the target RESOLVED to when the card was asked (the canonical
 *  view of that reading), or `null` when the environment was asked and did not answer — an unresolved target binds
 *  "unresolved", so a later resolution is a move. A slot that names several targets (`pathTarget.each`) records the list of
 *  its elements' locations, in slot order. A role the environment was not asked about is absent; a row with no such role
 *  carries none. */
export type ApprovalTargets = {
    readonly [R in ApprovalTargetRole]?: string | null | readonly (string | null)[];
};
/** The row's `targetReads` member: per read candidate the shell read station judged for the parked bytes (its key's
 *  digest), where it landed (its settled targets' digest — a pattern lands on a set). A sibling of `targets`, not a key
 *  inside it: a reader that knows only the path roles reads an unknown key there as damage and spends the approval, where
 *  a member of its own carries its own word and that reader refuses the row unread (`version_newer`). Present exactly when
 *  the station judged the parked bytes — `{}` when it found no read candidate: a candidate appearing by the resume is a
 *  read the card did not cover. */
export type ApprovalTargetReads = {
    readonly [candidate: string]: string;
};
/** The tool member of a row, read WHOLE: the identity the roster row carried (its four members and the mount site), its face and
 *  its declaration's digest, as the park minted them off that row ({@link ROSTER_APPROVAL_BINDING}). The optional members are
 *  absent exactly when the roster row had none (no path target, no URL slot, not the engine's mount). */
export interface ApprovalTool {
    readonly capabilityId: string;
    readonly contractId: string;
    readonly shapeDigest: string;
    readonly implementationRevision: string;
    readonly engineMounted?: true;
    readonly family: ToolFamily;
    readonly pathTarget?: ToolCallPathTarget;
    readonly hostTarget?: ToolHostTarget;
    readonly startedShell?: "zsh";
    readonly declarationDigest: string;
}
export interface ApprovalObject {
    /** The tool member, or the members a whole one would carry that the row lacks or carries out of their shape. */
    readonly tool: ApprovalTool | {
        readonly missing: readonly string[];
    };
    /** The row's two target members as stored — read, validated, by the judge. */
    readonly targets?: unknown;
    readonly targetReads?: unknown;
    readonly grants?: string;
}
/** The view of one parked approval's object. */
export declare function approvalObjectOf(row: ParkedApproval): ApprovalObject;
/** The TARGETS of a reading — the one mint of both members, for the row and for the live call alike: `targets` per role,
 *  the canonical view, or `null` for a view the environment was asked for and did not answer (nothing when no role was read
 *  either way, or no reading was taken); `targetReads` per read candidate the shell read station judged, where it landed
 *  (nothing when the station judged no candidate of these bytes). The park mints them from the gate's readings of the parked
 *  bytes; the execution station reads the bytes that will run the same way. */
export declare function approvalTargetsOf(reading: CallTargetReading | undefined, reads?: readonly ReadLanding[]): {
    targets?: ApprovalTargets;
    targetReads?: ApprovalTargetReads;
};
/** Where a resume judges the object: before the claim (the decided bytes), before the session is touched (the live
 *  tool), right before the execution (the tool as mounted then — a host's re-dial can replace it between the two — and the
 *  bytes that will run, after every station that can rewrite them). */
export type ApprovalStation = "claim" | "session" | "execution";
export type ApprovalMember = "tool" | "targets" | "grants";
/** THE table: the members each station judges. */
export declare const APPROVAL_STATION_MEMBERS: {
    readonly [S in ApprovalStation]: readonly ApprovalMember[];
};
/** What a station does with a mismatch: refuse with the row still pending (before the claim), reopen it for the
 *  original tool, or veto the call (not run, approval spent). */
export type ApprovalDisposition = "refuse_pending" | "reopen" | "veto";
export interface ApprovalMismatch {
    readonly member: ApprovalMember;
    readonly disposition: ApprovalDisposition;
    /** The machine word: the reopen codes, `resume.target_moved` on a moved face, declaration or target (the vetoed call's
     *  `tool_end.errorCode`), the claim's refusal codes; absent on a grants veto. */
    readonly code?: "resume.tool_unavailable" | "resume.tool_contract_mismatch" | "resume.target_moved" | "checkpoint.invalid_outcome" | "checkpoint.unsupported_version";
    readonly message: string;
}
/** What the station holds of the live call. */
export interface LiveApprovalObject {
    /** session / execution: the live roster row the leg would run the call as — `undefined` when the tool is not mounted. */
    readonly tool?: ToolRosterEntry | undefined;
    /** claim / execution: the bytes the station judges, the skills this resume serves and the Skill tool's wire name. */
    readonly args?: unknown;
    readonly skills?: readonly SkillGrantSource[];
    readonly skillToolName?: string;
    /** execution: the reading of the bytes that will run, taken at this station (`undefined`: none could be taken). */
    readonly targetReading?: CallTargetReading | undefined;
    /** execution: where this leg's shell read station found those bytes' reads land (`undefined`: it holds no judgment of them). */
    readonly reads?: readonly ReadLanding[] | undefined;
    /** execution: where this leg's file read station judged a declared read's targets land, in slot order — the keys its port opens.
     *  When present the targets member is judged on THEM (one reading for the admission and the comparison), not on `targetReading`. */
    readonly landings?: readonly string[] | undefined;
    /** execution: the bytes the decision rewrote the call to, as the tool reads them; absent when it rewrote nothing. When
     *  the row's binding does not cover them ({@link licenseCovers}, the one judge of "are these the approved bytes") the
     *  person approved bytes whose target the row never recorded, and the targets member is not judged. */
    readonly decided?: unknown;
}
declare const IDENTITY_MEMBERS: readonly ["capabilityId", "contractId", "shapeDigest", "implementationRevision", "engineMounted"];
declare const FACE_MEMBERS: readonly ["family", "pathTarget", "hostTarget", "startedShell"];
/** The two lists the judge compares are exactly the classification's (`ROSTER_APPROVAL_BINDING`): an identity carrier or a face
 *  member the table adds or drops is a compile error here until the judge reads it so (a roster key moved between classes while the
 *  carrier set stays the same — `name` beside `capabilityId` — is not). */
export type IdentityMembersAreTheTables = AssertAllKeysHandled<Exclude<RosterIdentityCarrier, (typeof IDENTITY_MEMBERS)[number]> | Exclude<(typeof IDENTITY_MEMBERS)[number], RosterIdentityCarrier>>;
export type FaceMembersAreTheTables = AssertAllKeysHandled<Exclude<RosterFaceMember, (typeof FACE_MEMBERS)[number]> | Exclude<(typeof FACE_MEMBERS)[number], RosterFaceMember>>;
/**
 * THE judge of a parked approval at one station: `"match"`, or the first member the table names for the station that
 * the live call does not match, with its disposition. Absence is read per member: a tool member is whole or binds no tool
 * (refused before the claim, never read by name or by default); a grants
 * member is judged whenever the call would activate a skill (a row with no digest cannot cover one); a targets member
 * is judged unless the decision rewrote the bytes to ones the row's binding does not cover, and one that is not a whole
 * role → location record is damage.
 */
export declare function judgeApprovalObject(row: ParkedApproval, live: LiveApprovalObject, station: ApprovalStation): "match" | ApprovalMismatch;
export {};
