import type { Code } from "../../runtime/template/code.js"; import type { AgencyConfig } from "../../config.js"; import type { Splice } from "../../types/splice.js"; import type { SpliceResult } from "./types.js"; import type { ImportSource } from "./eligibility.js"; /** * Run one generator and bring back the `Code` value it produced. * * The parent blocks on the child. The compile pipeline is synchronous and * expansion happens inside it, so `execFileSync` is the only way to reach * an async child from here. * * The child also gives us the limits. A generator that loops forever * becomes an error message instead of a hung compiler. */ /** Wall clock. A generator does AST manipulation; 30s is enormous for that. */ export declare const WALL_CLOCK_MS = 30000; /** V8 heap ceiling in megabytes, matching `runCode`'s default. */ export declare const MEMORY_MB = 512; /** * The editor's wall clock, much shorter than the build's. * * `execFileSync` blocks, and the language server is single-threaded with * no way to cancel, so a runaway generator freezes the editor for the * whole limit. Thirty seconds of a dead editor is not a tradeoff worth * making for a generator that was going to fail anyway. */ export declare const EDITOR_WALL_CLOCK_MS = 3000; /** Limits are overridable so a test can prove the timeout works without * waiting 30 seconds for it. */ export type RunGeneratorOptions = { config?: AgencyConfig; wallClockMs?: number; memoryMb?: number; /** Where each name the splice arguments use comes from. Resolved and * checked by the expansion pass; the specifiers are rewritten here, * because only this file knows where the runner ends up. */ argumentSources?: ImportSource[]; }; export declare function runGenerator(splice: Splice, generator: { modulePath: string; exportedName: string; }, cwd: string, options?: RunGeneratorOptions): SpliceResult;