import { execFile } from "child_process"; export declare const execFileAsync: typeof execFile.__promisify__; import { AgencyProgram, GraphNodeDefinition } from "../types.js"; import { AgencyConfig } from "../config.js"; import type { LLMMock, ScopedLLMMocks } from "../runtime/deterministicClient.js"; import type { FetchMock } from "../runtime/fetchMock.js"; export declare function parseTarget(target: string): { filename: string; nodeName: string; }; export declare function promptForTarget(): Promise<{ filename: string; nodeName: string; }>; export declare function pickANode(nodes: GraphNodeDefinition[]): Promise; export declare function promptForArgs(selectedNode: GraphNodeDefinition): Promise<{ hasArgs: boolean; argsString: string; }>; export type InterruptHandler = { action: "approve" | "reject" | "modify" | "resolve"; modifiedArgs?: Record; resolvedValue?: any; expectedMessage?: string; }; /** * Resolve the compiled .js file for an .agency file from a distDir. * Throws if the compiled file doesn't exist. */ export declare function resolveCompiledFile(distDir: string, agencyFile: string): string; type ExecuteNodeArgs = { config: AgencyConfig; agencyFile: string; nodeName: string; hasArgs: boolean; argsString: string; interruptHandlers?: InterruptHandler[]; timeoutMs?: number; signal?: AbortSignal; llmMocks?: LLMMock[] | ScopedLLMMocks; useTestLLMProvider?: boolean; fakeClock?: boolean; argv?: string[]; scratchDir?: string; maxBufferBytes?: number; quietCompile?: boolean; preferCompiled?: boolean; fetchMocks?: FetchMock[]; allowTestImports?: boolean; }; export type RunAgencyNodeArgs = { config: AgencyConfig; agencyFile: string; nodeName: string; hasArgs: boolean; argsString: string; interruptHandlers?: InterruptHandler[]; timeoutMs?: number; signal?: AbortSignal; argv?: string[]; scratchDir?: string; maxBufferBytes?: number; quietCompile?: boolean; /** Extra env merged over process.env for the spawned subprocess. */ env?: Record; /** * Reuse a precompiled `.js` sitting next to the `.agency` source instead of * recompiling, when one exists. Bundled agents (judges, proposers) ship such * a sibling in `dist`, so repeated invocations (e.g. per optimize iteration) * skip the redundant compile. No-op when running from uncompiled source. */ preferCompiled?: boolean; /** Test-harness only: honor `import test { … }` when compiling. Inert on * the distDir/preferCompiled branches (nothing is compiled there). */ allowTestImports?: boolean; }; /** * General-purpose runner: compile/resolve the agent, render the evaluate * script, spawn `node`, and parse the results. No test-LLM coupling — callers * pass any extra `env` (e.g. the deterministic-LLM mocks computed by * `executeNodeAsync`). */ export declare function runAgencyNode({ config, agencyFile, nodeName, hasArgs, argsString, interruptHandlers, timeoutMs, signal, argv, scratchDir, maxBufferBytes, quietCompile, env, preferCompiled, allowTestImports, }: RunAgencyNodeArgs): Promise<{ data: any; stdout: string; stderr: string; }>; /** * Test/eval wrapper over {@link runAgencyNode}: activates the deterministic LLM * client by setting AGENCY_LLM_MOCKS whenever the suite-wide * AGENCY_USE_TEST_LLM_PROVIDER env var is set OR the per-call * `useTestLLMProvider` flag is true, then delegates. Existing callers keep * their behavior. Setting the env var to "[]" when no mocks are provided still * activates the deterministic client so any llm() call fails cleanly instead of * falling through to the real OpenAI client. */ export declare function executeNodeAsync({ llmMocks, useTestLLMProvider, fetchMocks, fakeClock, ...rest }: ExecuteNodeArgs): Promise<{ data: any; stdout: string; stderr: string; }>; export declare function safeUnlink(filePath: string): void; export declare function executeNode(args: ExecuteNodeArgs): { data: any; [key: string]: any; }; export { formatTypeHint, formatTypeHintTs, TS_PRIMITIVE_ALIASES, } from "../utils/formatType.js"; type ExecuteJudgeArgs = { actualOutput: string; expectedOutput: string; judgePrompt: string; interruptHandlers?: InterruptHandler[]; }; export declare function executeJudgeAsync(agencyFileBaseName: string, { actualOutput, expectedOutput, judgePrompt, interruptHandlers, }: ExecuteJudgeArgs): Promise<{ score: number; reasoning: string; stdout: string; stderr: string; }>; export declare function findRecursively(dirName: string, ext?: string, searched?: string[], ignoreDirs?: string[]): Generator<{ path: string; }>; export declare function getImportsRecursively(filename: string, visited?: Set): string[]; export declare function getImports(program: AgencyProgram): string[]; export type AnyImport = { path: string; kind: "module" | "node"; }; export declare function getAllImports(program: AgencyProgram): AnyImport[];