export type StagedAgent = { runFile: string; cleanup: () => void; }; /** * Compile the bundled agent with an explicit config, in isolation. * * The obvious alternative — compiling in place — would overwrite the shipped * `agent.js` (the compiler writes beside the source, recursively for Agency * imports), after which the NEXT unconfigured run would take the precompiled * fast path and silently inherit this config. It would also write * `.agency-build` manifest state next to the source, which fails outright on * a read-only npm install. So: copy the agent source tree to a fresh temp * directory (preserving relative imports), normalize the copy to writable * (cpSync preserves modes, and a read-only install produces read-only copies * the compiler could not overwrite), strip `outDir` (a user config must not * receive launcher artifacts), and compile with freshness "always" — the * no-manifest policy — plus quiet. * * Lifecycle: the config is validated BEFORE the temp dir exists, so a * malformed or missing explicit config can neither leak a tree nor silently * become an empty configured build. After creation, a process-exit hook * guarantees removal even if compilation calls process.exit() (the compiler * does, on parse and type failures). `cleanup` is idempotent and unregisters * that hook. Deletion is guarded: only a directory directly under the chosen * temp root with the `agency-agent-` prefix is ever removed (the repo's * `safeDeleteDirectory` deliberately refuses OS temp paths, so this guard is * purpose-built). */ export declare function stageConfiguredAgent(configPath: string, agentDir: string, options?: { tempRoot?: string; }): StagedAgent;