/**
 * base.ts — Shared spawn helpers and signal-handling for all invokers.
 *
 * Provides:
 *   - spawnAgent()     — spawn a child process with a 5s SIGTERM→SIGKILL grace.
 *   - buildEnv()       — safe env inheritance + NEXUS_PARENT_DISPATCH marker.
 *   - cancelHandle()   — shared cancel implementation.
 *   - NESTED_LOOP_ENV  — the env-var name that guards against recursive dispatch.
 */
import { type ChildProcess } from 'node:child_process';
import type { DispatchRequest } from './types.js';
export declare const NESTED_LOOP_ENV = "NEXUS_PARENT_DISPATCH";
export declare function buildEnv(req: DispatchRequest): NodeJS.ProcessEnv;
export interface SpawnedAgent {
    process: ChildProcess;
    pid: number;
    cancel(): Promise<void>;
}
export declare function spawnAgent(cmd: string, args: string[], opts: {
    cwd: string;
    env: NodeJS.ProcessEnv;
    timeoutMs: number;
}): SpawnedAgent;
export declare function readLines(stream: NodeJS.ReadableStream): AsyncGenerator<string>;
