import type { Provider, ThinkingLevel } from "@kenkaiiii/gg-ai";
import type { AgentDefinition } from "./agents.js";
export type SubAgentState = "starting" | "running" | "completed" | "failed" | "interrupted" | "closed";
export interface SubAgentSnapshot {
    agent_id: string;
    task_name: string;
    state: SubAgentState;
    started_at: number;
    updated_at: number;
    elapsed_ms: number;
    current_activity?: string;
    turn_count: number;
    tool_use_count: number;
    token_usage: {
        input: number;
        output: number;
    };
    output?: string;
    error?: string;
}
export interface SubAgentManagerOptions {
    cwd: string;
    agents: AgentDefinition[];
    getProvider: () => Provider;
    getModel: () => string;
    getThinkingLevel: () => ThinkingLevel | undefined;
    getCacheKey?: () => string | undefined;
    getBaseUrl?: () => string | undefined;
    onState?: (snapshot: SubAgentSnapshot) => void;
    workerEntry?: string;
    idleTimeoutMs?: number;
}
export declare class SubAgentManager {
    private readonly options;
    private readonly workers;
    private readonly snapshots;
    private readonly listeners;
    private shuttingDown;
    constructor(options: SubAgentManagerOptions);
    spawn(taskName: string, task: string, agentName?: string): Promise<SubAgentSnapshot>;
    sendMessage(agentId: string, message: string): Promise<number>;
    followup(agentId: string, task: string): Promise<SubAgentSnapshot>;
    interrupt(agentId: string): Promise<SubAgentSnapshot>;
    subscribe(listener: (snapshot: SubAgentSnapshot) => void): () => void;
    list(): SubAgentSnapshot[];
    wait(agentIds?: string[], condition?: "any" | "all", timeoutMs?: number): Promise<{
        timed_out: boolean;
        agents: SubAgentSnapshot[];
    }>;
    interruptAll(): Promise<void>;
    shutdownAll(): Promise<void>;
    /** Synchronous process-exit fallback: terminate detached process groups immediately. */
    shutdownAllNow(): void;
    private attach;
    private handleFrame;
    private request;
    private waitForChange;
    private publish;
    private snapshot;
    private elapsed;
    private activeCount;
    private isActive;
    private isTerminal;
    private requireWorker;
    private assertAvailable;
    private createId;
    private scheduleIdleReap;
    private reapExcessIdle;
    private fail;
    private close;
    private kill;
}
//# sourceMappingURL=subagent-manager.d.ts.map