import type { SpawnOptions } from "node:child_process"; import type { EventEmitter } from "node:events"; import type { Readable } from "node:stream"; import type { ChorusVoice, PartialVoiceProgress, VoiceResult, SubagentPermissionProfile } from "./types.js"; export { parseSubagentNdjson, type ParsedSubagentOutput, } from "./subagent/ndjson.js"; export type SpawnLike = (command: string, args: string[], options: SpawnOptions) => SubagentChild; export interface SubagentChild extends EventEmitter { stdout: Readable; stderr: Readable; kill: (signal?: NodeJS.Signals | number) => boolean; exitCode: number | null; pid?: number; } export interface SubagentVoiceArgs { voice: ChorusVoice; prompt: string; systemPrompt?: string; voiceIndex?: number; timeoutMs: number; includeSessionHistory?: boolean; cwd?: string; signal: AbortSignal; spawnImpl?: SpawnLike; onProgress?: (update: PartialVoiceProgress) => void; permissionProfile?: SubagentPermissionProfile; disableTools?: boolean; timeoutMode?: "total" | "inactivity"; progressIntervalMs?: number; maxToolCalls?: number; maxTurns?: number; retainRecoveryContext?: boolean; } /** * Executes one voice by spawning `pi --mode json`, streaming progress from NDJSON * events, and terminating the whole process group on timeout or parent abort. */ export declare function runSubagentVoice(args: SubagentVoiceArgs): Promise;