/**
 * The READ station of the file tools (Read / Grep / Glob) — the read face's twin of the shell read station, one gate
 * input shape ({@link ShellReadCheck}) so the gate, the approved-edit re-judge and the resumed leg's belt read both:
 * before approval, where the call's declared path target lands is resolved exactly as the tool will resolve it
 * (`resolveKey` over the same spelling, base, roots, deny table and containment face), and a target OUTSIDE the read
 * roots is the question the shell station's decision table gives this station's seat (`SHELL_READ_DECISION.outside_roots
 * .file_tool`, the ORDINARY ask — a person answers it, a persisted path allow or the auto-mode classifier may, a
 * permission mode arbitrates it — and the `rejudge` cell after an approved edit), with the directory whose grant clears it
 * on the card. The deny table and every other refusal stay the tool's own (the table's other `file_tool` cells): this
 * station judges containment only, after the deny judgment. On a leg that refuses reads outside its directories
 * ({@link outsideReadDisposition} `refusal`) the station is the refusal instead: what the tool would refuse, it refuses at
 * the gate, ahead of every question, in the tool's own words and card — and in the leg's words ({@link READ_BLOCK_REMEDY})
 * for a read outside the roots.
 *
 * A call whose out-of-root read the gate put to a question is ADMITTED for that one target when the gate applies the
 * verdict ({@link ShellReadVerdict.admit}): the tool reads it once ({@link FileReadStation.admitted}), on the canonical
 * key the station judged — a target that resolves elsewhere by then is refused by the tool's own fence, and a verdict
 * the gate never received (its wait elapsed, the judgment threw) admits nothing.
 */
import type { ExecutionEnv } from "../../internal/harness-types.js";
import type { ToolCallPathTarget } from "../../core/tool-face.js";
import type { JudgedRead } from "../../core/judged-read.js";
import type { ContainmentFace } from "./containment-face.js";
import { type ReadDenyMatcher } from "./read-deny.js";
import { type ReadStationCall, type ShellReadCheck } from "./shell-read-check.js";
/**
 * How a leg answers a file tool's read outside its roots — ONE judgment over the two declarations that bear on it:
 * `refusal` (the leg refuses reads outside its declared directories, `TaskSpec.blockReadsOutsideRoots`: the station refuses
 * at the gate, before the gate's own questions — save a host policy that asks its approver inside its own `check`, which has
 * asked by then, and the leg's approver re-asked about an approved edit that moves an in-root read outside), `tool_fence`
 * (the read-only mount: the file tools' own fence refuses, the station judges none of them; a DECLARED read, which has no fence
 * of its own, is refused at the gate wherever the Read tool's fence would refuse it), or
 * `question` (the station puts it to whoever answers). The station's arm is chosen off this answer alone.
 */
export type OutsideReadDisposition = "question" | "refusal" | "tool_fence";
export declare function outsideReadDisposition(leg: {
    readonly readOnlyMount: boolean;
    readonly readBlock: boolean;
}): OutsideReadDisposition;
/** The remedy a refusal of a read outside the directories names on a leg that refuses such reads — ONE sentence for every
 *  place that says it: the station's refusal, and (in place of the escape hint) the file tools' own fence and the Artifact
 *  tool's local read, for a read that never passes the station. It names the declaration and the one way out its reader has
 *  (the directory added to the task's own); never another tool, and never the declaration's removal. */
export declare const READ_BLOCK_REMEDY = "This task refuses reads outside its directories (blockReadsOutsideRoots); ask the user to add the directory to the task's directories.";
export interface FileReadStation {
    readonly check: ShellReadCheck;
    /** The station's membership by NAME: the engine's file tools whose catalog read target it judges. A call under no such name
     *  whose face declares a read target is a member too ({@link declaredReadOf}), judged on its own declaration. */
    readonly tools: ReadonlySet<string>;
    /** Did the gate put THIS call's read of `canonicalKey` outside the roots to a question it then let through? Consumed
     *  on a match: the admission covers one read of one target. */
    readonly admitted: (toolCallId: string | undefined, canonicalKey: string) => boolean;
    /** The judged-read port of a call the station judged as a declared read (`ToolExecuteContext.judgedReads`); `undefined` when it
     *  judged no such call under this id. */
    readonly judgedReadsOf: (toolCallId: string) => readonly JudgedRead[] | undefined;
    /** Is this call the station's member by its face's declaration ({@link declaredReadOf})? */
    readonly declares: (call: ReadStationCall) => boolean;
}
/**
 * The read target a call DECLARES on its own face, when the call is under no name of the engine's file tools: a tool the engine
 * does not catalog (a caller's, an MCP server's under its `toolFaces`) that states `pathTarget.access: "read"`. Such a call is the
 * file read station's member on that declaration; nothing but the station's judgment stands between the model's path and the
 * tool, so the station refuses at the gate every target the read would refuse, and the tool reads through the port the station
 * hands it. The slot is the declarer's whatever names the tool answers to (`declaredReadSlotOf`). `undefined` ⇒ not a declared read
 * (a tool the engine mounted keeps its catalog slot and its own refusals).
 */
export declare function declaredReadOf(call: ReadStationCall): ToolCallPathTarget | undefined;
export interface FileReadStationOptions {
    readonly env: ExecutionEnv;
    readonly rootCanonical: string;
    /** The extra read roots, read per call (a grant widens the live set). */
    readonly roots: () => readonly string[];
    readonly readDeny?: ReadDenyMatcher;
    readonly readFace?: ContainmentFace;
    readonly homeDir?: string;
    /** The file tools the station judges by name (their catalog path target is the one judged): those the leg mounts, or none
     *  where their own fence answers (the read-only band). A declared read is judged whatever this set holds. */
    readonly tools: ReadonlySet<string>;
    /** A target no answer may admit (the store-isolation rule's judgment, `rootAdmittingArtifactStore`): it is left to
     *  the tool's own refusal, no question is raised for it. */
    readonly excluded?: (canonicalKey: string) => boolean;
    /** A target the tools' own fence admits without the roots (the engine's background output file,
     *  `backgroundOutputReadExemption`): no question is put for it. */
    readonly exempt?: (canonicalKey: string) => boolean;
    /** The station's arm ({@link outsideReadDisposition}): `question` (absent) puts an out-of-root read to a question;
     *  `refusal` refuses at the gate every read the tool would refuse itself — outside the roots, on a deny row, a target it
     *  cannot resolve, the artifact store — with the resolution's own card, admits nothing, and refuses when it cannot judge;
     *  `tool_fence` refuses each target of a declared read the Read tool's own fence would refuse (its sentence). */
    readonly outsideReads?: OutsideReadDisposition;
}
export declare function createFileReadStation(opts: FileReadStationOptions): FileReadStation;
/** A read station as the gate input composes it: its check, its membership by name, and — for the file read station — whether a
 *  call under none of those names is its member by what its face declares. */
export interface ReadStationMember {
    readonly check: ShellReadCheck;
    readonly tools: ReadonlySet<string>;
    readonly declares?: (call: ReadStationCall) => boolean;
}
/** Is `call` a member of any of `stations` — by one of its names, or by its face's declaration? */
export declare function readStationsHold(stations: ReadonlyArray<ReadStationMember>, call: ReadStationCall): boolean;
/** One gate input over the leg's read stations: a call whose own face declares a read target ({@link declaredReadOf}) is judged
 *  by the file read station, whatever names it answers to; any other call by the station whose membership holds the first of its
 *  names any station holds (the spelling first). */
export declare function composeReadChecks(stations: ReadonlyArray<ReadStationMember>): ShellReadCheck | undefined;
/**
 * The read check of a leg that mounts no file read station (no execution environment, or its hands are off): a call whose face
 * declares a read and whose tool does not read through the judged-read port (`ported` answers by the tool's wire name — an MCP
 * tool, whose server opens the path by name with nothing after the gate) is refused and never dispatched, on a fresh leg and on a
 * resumed one alike; every other call is not its member. A tool that reads through the port is handed `no_read_station` instead.
 */
export declare function unjudgedReadsMember(ported: (toolName: string) => boolean): ReadStationMember;
