/**
 * A COMMAND'S ENVIRONMENT — what the program a segment runs holds in a variable, read the way bash hands it over: the segment's
 * own prefix assignments ({@link withCommandEnvironment}, #5097) and, for a child shell, every other variable as this shell
 * exports it there ({@link childEnvironment}, #5096). The plan reads both (a nested text's start); the working-directory walk
 * reads the first (`HOME=/ cd`, `CDPATH=/ cd usr`).
 */
import type { LexedWord } from "../../shell/lex.js";
import { type BindingTable, type NameReader } from "./shell-read-bindings.js";
import type { Received } from "./shell-read-start.js";
/** The names at a segment with the command's own prefix assignments in force (`HOME=/ cd`), and which names those are. */
export interface CommandTable extends BindingTable {
    readonly commandSets: ReadonlySet<string>;
}
/** The table a `cd` / `pushd` — or a child shell — reads a name from at a segment: the segment's own, with each prefix assignment
 *  in front of the program (`HOME=/ cd`, `CDPATH=/ cd usr`) holding its value there — it is in the program's environment. A
 *  prefix value naming an earlier prefix's name (`HOME=/ CDPATH=$HOME cd usr`) reads it as bash 5 does (the earlier assignment
 *  applied) and as bash 3.2 does (the value before the command): both.
 *
 *  A value holds only where the shell gives the program that value. It does not where the name may hold another: an expansion of
 *  the command's other words — performed before its assignments — or of a later assignment may assign the name, or a name the
 *  value reads (`T=${X-a} cmd "${X=/}"`, `T= X=${T:=/} cmd`): unknown; an attribute a declaration gave it changes what is stored
 *  (an integer, a case change): unknown; a read-only name refuses the assignment and keeps what it held, and the command runs
 *  with that — where the `readonly` may have run (a subshell, a branch), either value. A name an expansion of the command's
 *  words assigns holds what that leaves: unknown. A `NAME=value` operand a launcher's own assignment grammar takes (`env X=y`,
 *  `sudo X=y`: `ProgramPosition.launcherAssignments`) is no assignment the shell makes — the launcher sets it from a value the
 *  engine does not read here: unknown. Any other word behind a launcher (an option's value, `time -f X=y`; an operand it owes)
 *  sets no name. `others`: the command's redirection targets, expanded before its assignments too. */
export declare function withCommandEnvironment(table: BindingTable, argv: readonly LexedWord[], others?: readonly Pick<LexedWord, "pieces">[]): CommandTable;
/** What the plan knows about a text's variables that a child shell's start reads. */
export interface ShellEnvironmentFacts {
    /** Is the variable in the environment this shell started with (`PlanStart.received`)? */
    readonly received: (name: string) => Received;
    /** Per segment: the variables it exports (`export`, `declare -x`; `allexport` for `set -a`; `all` for a name the text does not
     *  settle). */
    readonly exportsAt: readonly (ReadonlySet<string> | "all" | "allexport" | undefined)[];
    /** May segment `at` run before segment `si`, in its shell (`BindingThread.segmentPrecedes`)? */
    readonly precedes: (at: number, si: number) => boolean;
    /** Does segment `at` certainly run before segment `si` does, in its shell (`BindingThread.segmentCertainlyBefore`)? */
    readonly certainlyBefore: (at: number, si: number) => boolean;
    /** Does segment `at` bind the name (or every name)? */
    readonly binds: (at: number, name: string) => boolean;
    /** What a variable holds where the text starts — `bound`: the text binds it somewhere (its value there is not the start's). */
    readonly startValue: (name: string, bound: boolean) => ReturnType<NameReader>;
    readonly boundAnywhere: (name: string) => boolean;
}
/** What a child shell started at a segment receives in the variables its own command environment does not set. */
export declare function childEnvironment(facts: ShellEnvironmentFacts): {
    /** Is the variable exported where segment `si` starts a child: `yes` — it was in this shell's environment, or a segment that
     *  certainly runs before `si` in its shell exported it (`set -a`: and a segment after it, certainly before `si`, assigned it);
     *  `maybe` — such a segment may have; `no` — none may, and the environment's declared names do not hold it. */
    readonly exportedAt: (name: string, si: number) => Received;
    /** What the child holds: what this shell holds there (the ordered table) where the variable is exported, the value it starts
     *  with where it is not — either one where the environment's names are not declared. A launcher that may change the
     *  environment (`env -i`, `sudo`; `env === "all"`) hands on a name this text binds anywhere as unknown. */
    readonly handedOn: (table: BindingTable, name: string, si: number, env: ReadonlySet<string> | "all") => ReturnType<NameReader>;
};
