import { AgencyConfig } from "../config.js"; import { AgencyProgram } from "../index.js"; import { type InstallKind } from "./installLocation.js"; import { readFile, type CompileOptions } from "../compiler/buildSession.js"; export declare function compiledOutputRegisterUrl(): string; export declare function compiledOutputNodeArgs(): string[]; export declare function agencyLangResolvesFrom(dir: string): boolean; export declare function compileWarning(kind: InstallKind, outputContext: string, resolvesFrom?: (dir: string) => boolean): string | null; export declare function loadConfig(configPath?: string, verbose?: boolean): 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 resetCompilationCache(): void; /** * Compile a set of entry files under ONE union closure, like the * directory branch of `compile()` does. Callers with many entry points * (the test runner's precompile pass) use this instead of per-file * `compile()` calls, which would rebuild the closure once per entry. * * Unlike the CLI directory branch, closure errors THROW * (`CompileClosureError`) instead of exiting, so programmatic callers * can attach context. Parse/typecheck failures inside per-file * `compile()` keep their existing exit behavior. */ export declare function compileMany(config: AgencyConfig, files: string[], options?: { quiet?: boolean; allowTestImports?: boolean; }): void; /** * Compile an .agency file (or directory of them) to JavaScript. Thin * delegate over the default BuildSession — all pipeline logic and caching * state live in lib/compiler/buildSession.ts. */ export declare function compile(config: AgencyConfig, inputFile: string, _outputFile?: string, options?: CompileOptions): string | null; 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, resumeFile?: string, runPolicy?: { policyJson: string; interactive: boolean; }, budget?: { maxCost?: string; maxTime?: string; }): void;