/** * What a node can read where it stands: the nodes already ended in its own * sequence and in every enclosing one, `input` and `diff`, and what an enclosing block * lends it: `item` inside a `map`, and inside a loop the loop's own * `previous`, `carry` and `ledger`. * * Lexical, and nothing more: a block's nested nodes are readable inside it * and gone after it, where the block's own output stands in for them. So * nothing inside a sibling block is visible, and there is no way to write an * address that could only be resolved at run time. */ import type { ValueType } from "./type.ts"; /** One level of lexical scope. A child starts with everything its parent could read. */ export declare class Scope { /** What a condition or a deeper address reads, by its first word. */ private readonly names; /** What a bare id reads in `reads:`: a node's output, `input`, `item`. */ private readonly outputs; /** The structural nodes this scope is inside, outermost first, and what each opens. */ private readonly enclosing; private constructor(); /** The root sequence's scope: `input`, and `diff`, the tree's changes as a text. */ static root(input: ValueType): Scope; /** The scope of a sequence inside the structural node `id`. */ inside(id: string, opens?: Partial): Scope; /** Lends `name` to this scope, read whole as it is: `item`. An outer one of the same name is no longer readable. */ lend(name: string, type: ValueType): this; /** Records that the node `id` ended, with an output of type `output`. */ end(id: string, output: ValueType): void; /** Whether `name` is readable here. */ has(name: string): boolean; /** What `name` reads whole in `reads:`, when it is a bare name. */ output(name: string): ValueType | undefined; /** Everything readable here, by first word. */ readable(): Readonly>; /** Whether this scope is inside the structural node `id`. */ encloses(id: string): boolean; /** Whether this scope is inside the structural node `id`, and that node keeps a ledger. */ keepsLedger(id: string): boolean; /** Whether this scope is inside a `copies: true` block, where the tree is a branch's copy. */ inCopies(): boolean; /** * Whether the memory scope `scope` (`flow` for the run) opens outside the * innermost `copies: true` block around this one: its subagent would work * in another tree than this branch's copy. */ outsideCopies(scope: string): boolean; } /** What a structural node opens for its sequences: a ledger, a copy of the tree per branch. */ type Opens = { readonly ledger: boolean; readonly copies: boolean; }; export {}; //# sourceMappingURL=scope.d.ts.map