import { AgencyConfig } from "../config/config.js"; import { type ConfigTarget } from "../config/target.js"; import { AgencyProgram } from "../index.js"; import type { ResumeCarrier } from "./resumeCarrier.js"; import { type InstallKind } from "./installLocation.js"; import { readFile } from "../compiler/buildSession.js"; export declare function compiledOutputRegisterUrl(): string; export declare function compiledOutputNodeArgs(): string[]; /** Extra V8 flags for running UNTRUSTED compiled output (`--agency-only`). * `--disallow-code-generation-from-strings` makes `eval` and the `Function` * constructor throw, closing the route the compile-time bind-check cannot * see: a property key built at runtime that reaches `Function`, as in * `m[a + b]` where `a + b` is `"constructor"`. Layer 2; see * docs/dev/security/roadmap.md A1. Empty for trusted runs. */ export declare function sandboxRuntimeNodeArgs(agencyOnly: boolean): string[]; export declare function agencyLangResolvesFrom(dir: string): boolean; export declare function compileWarning(kind: InstallKind, outputContext: string, resolvesFrom?: (dir: string) => boolean): string | null; /** Load config from `target`, exiting on an invalid file. Diagnostics go to * stderr so they never corrupt a command's machine-read stdout. */ export declare function loadConfig(target?: ConfigTarget, verbose?: boolean): AgencyConfig; /** * `base` with the config files in a test fixture's directory merged over it. * A fixture may opt into features. It cannot cancel a refusal the user asked * for on the command line, so the CLI intent is applied again after the merge. */ export declare function mergeFixtureConfig(base: AgencyConfig, dir: string): AgencyConfig; export declare function readStdin(): Promise; export type InputSource = { kind: "file"; path: string; } | { kind: "stdin"; }; /** * Turn raw CLI arguments into an ordered list of input sources. * - no arguments -> a single stdin source * - "-" -> a stdin source (mixable with files/dirs) * - a directory -> every .agency file under it (recursive) * - a file -> that file * - a missing path -> prints an error and exits 1 * - a second stdin -> prints an error and exits 1 (stdin is read-once) * * Returns null (after printing a notice to stderr) when arguments were given * but no .agency files were found, so the caller can exit cleanly instead of * hanging on stdin. The notice goes to stderr, not stdout, so it never * corrupts a command's machine-consumed output (e.g. `diagnostics` JSON). */ export declare function resolveInputSources(inputs: string[]): InputSource[] | null; export declare function readSource(src: InputSource): Promise; /** * Resolve `inputs` to sources, then read and hand each to `handle`. Returns * early (no-op) when `resolveInputSources` returns null (arguments given but * no .agency files found). This is the shared "iterate every input" scaffold * for commands that process each source independently. typecheck does NOT use * it — it needs the whole resolved list up front to seed one SymbolTable. */ export declare function forEachSource(inputs: string[], handle: (contents: string, src: InputSource) => void | Promise): Promise; export declare function parse(contents: string, config: AgencyConfig, applyTemplate?: boolean, lower?: boolean): AgencyProgram; export { readFile }; export declare function format(contents: string, config?: AgencyConfig): Promise; export declare function formatFile(inputFile: string, inPlace?: boolean, config?: AgencyConfig): Promise; export declare function run(config: AgencyConfig, inputFile: string, outputFile?: string, resume?: ResumeCarrier, runPolicy?: { policyJson: string; interactive: boolean; }, budget?: { maxCost?: string; maxTime?: string; }, /** Forwarded to the compiled program's argv (positions 2+), for the program * itself to read — `std::args` is how. They are NOT mapped onto the entry * node's parameters, which receive `undefined` on this path. */ nodeArgs?: string[], /** `--capture-workdir `: after the run, write its statelog, code and a * snapshot of the working directory as the run directory `//`. */ capture?: { runDir: string; }, compileMode?: { agencyOnly: boolean; }, /** The node to start, from `agency run file.agency:node`. Unset means `main`. */ entryNode?: string): void; /** * The config overrides `agency run` hands its child. Inherited overrides are * kept (an eval harness hands this process its statelog path the same way), * but two things always win over them: the capture statelog when * `--capture-workdir` asked for one (the child MUST write there, or there is * nothing to fold in), and the identity of THIS file (a trace must never name * another program, whatever `log.code` a parent or stale shell left behind). */ export declare function runChildOverrides(args: { inherited: Partial; captureStatelogFile?: string; inputFile: string; }): Partial;