import type { CallStack } from '../../shell/call_stack.ts'; import { type ElementOps, type TSNodeLike } from '../../shell/types.ts'; import type { SessionView } from '../../ops/types.ts'; import type { Session } from '../session/session.ts'; export type ExpandChild = (node: TSNodeLike) => Promise; /** * Resolve one variable name to its value. * * `strict` honors `set -u`: an unset plain name or positional raises; * the defaulting operators (`:-` family) pass false because they handle * unset themselves. Specials (`@ * # ? $ ! 0`) never raise, matching * bash >= 4.4. */ export declare function lookupVar(name: string, session: Session, callStack: CallStack | null, strict?: boolean): string; export declare function isMultiwordAt(node: TSNodeLike): boolean; export declare function expandArrayAt(node: TSNodeLike, session: Session, callStack: CallStack | null, expandChild: ExpandChild): Promise; export declare function arrayIndex(idxText: string, env: Record, elements?: ElementOps | null): number; /** * One expansion-time write, through the session plane's door. * * `${X:=d}`, `${a[i]:=d}` and `$((X=5))` are assignments the shell * performs while expanding a word rather than while running a command, * and they used to land on the raw session env. That made a `preSession` * rule one `${X:=d}` away from irrelevant: a deployment refusing `AWS_*` * still had `${AWS_PROFILE:=prod}` write it. They go through the door * now, so one rule covers every spelling. * * Without a door (a unit test outside a workspace) the write lands * directly, with the hidden half still applied: skipping that would let * the write-back clobber a value the host's wiring reads. * * The element mechanics are `assignElement`'s: a bare name (null key) * over an array takes the write at element 0 and keeps its other * elements (`a=(1 2 3)` then `$((a=5))` leaves `5 2 3`), an associative * one writes the literal key "0", and a subscripted target arrives with * its key already canonical. Throws ExitSignal when the name is hidden, * a preSession rule refuses, the subscript is bad, or the name carries * `-i` and the text does not evaluate (the line dies with status 1, the * shape `${var:?}` uses); ReadonlyVariableError when the name is * readonly, the same refusal a plain assignment raises through the door. */ export declare function expansionWrite(session: Session, view: SessionView | undefined, name: string, key: string | null, value: string): Promise; export declare function expandBraces(node: TSNodeLike, session: Session, callStack: CallStack | null, expandChild: ExpandChild, view?: SessionView): Promise; //# sourceMappingURL=variable.d.ts.map