import type { AgentTool } from "@dreb/agent-core";
import { type Static } from "@sinclair/typebox";
import type { ToolDefinition } from "../extensions/types.js";
import type { ModelRegistry } from "../model-registry.js";
import { type TruncationResult } from "./truncate.js";
interface AgentTypeConfig {
    name: string;
    description: string;
    tools?: string;
    /** Single model ID or ordered fallback list. First resolvable model wins. */
    model?: string | string[];
    systemPrompt: string;
}
export declare function parseAgentFrontmatter(content: string): {
    ok: true;
    config: AgentTypeConfig;
} | {
    ok: false;
    error: string;
};
export interface SubagentResult {
    agent: string;
    task: string;
    model?: string;
    exitCode: number;
    output: string;
    stderr: string;
    errorMessage: string | null;
    /** Path to the persisted session JSONL file, if available */
    sessionFile?: string;
}
/**
 * Find the most recently modified .jsonl file in a session directory.
 * Returns the full path, or undefined if no session file was written
 * (e.g., subagent was killed before the first assistant message).
 */
export declare function discoverSessionFile(sessionDir: string, agentName: string): string | undefined;
/**
 * Resolve a model fallback list against the registry. Tries each model in order,
 * returns the first one that resolves successfully. If all fail, returns the
 * last error. Single strings are treated as a one-element list.
 */
export declare function resolveModelWithFallbacks(models: string | string[], parentProvider: string | undefined, registry: ModelRegistry | undefined): {
    ok: true;
    modelId: string;
    provider?: string;
} | {
    ok: false;
    error: string;
};
export declare function resolveModelStringSingle(modelStr: string, parentProvider: string | undefined, registry: ModelRegistry | undefined): {
    ok: true;
    modelId: string;
    provider?: string;
} | {
    ok: false;
    error: string;
};
export interface BackgroundAgentInfo {
    agentId: string;
    agentType: string;
    taskSummary: string;
    startedAt: number;
    status: "running" | "completed" | "failed";
}
/** Get a snapshot of all tracked background agents (running and recently completed). Returns readonly clones. */
export declare function getBackgroundAgents(): readonly Readonly<BackgroundAgentInfo>[];
/** Get only currently running background agents. Returns readonly clones. */
export declare function getRunningBackgroundAgents(): readonly Readonly<BackgroundAgentInfo>[];
/** Abort all running background agents. */
export declare function abortBackgroundAgents(): void;
/** Remove completed/failed entries older than the given age (ms). Default: 5 minutes. */
export declare function pruneBackgroundAgents(maxAgeMs?: number): void;
export interface SubagentToolOptions {
    /** Called when a background subagent starts. Used by TUI to show status indicators. */
    onBackgroundStart?: (agentId: string, agentType: string, taskSummary: string) => void;
    /** Called when a background subagent completes with its result. `cancelled` is true if the user aborted it. */
    onBackgroundComplete?: (agentId: string, result: SubagentResult, cancelled: boolean) => void;
    /** Parent session's current provider (e.g. "anthropic"). Called at each invocation to get the live value after mid-session model switches. */
    parentProvider?: () => string | undefined;
    /** Model registry for validating model names before spawning child processes. */
    modelRegistry?: ModelRegistry;
}
declare const subagentSchema: import("@sinclair/typebox").TObject<{
    agent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
    task: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
    model: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
    tasks: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
        agent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
        task: import("@sinclair/typebox").TString;
        cwd: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
        model: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
    }>>>;
    chain: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
        agent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
        task: import("@sinclair/typebox").TString;
        cwd: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
        model: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
    }>>>;
    background: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
}>;
export type SubagentToolInput = Static<typeof subagentSchema>;
export interface SubagentToolDetails {
    truncation?: TruncationResult;
    mode: "single" | "parallel" | "chain";
    agentCount: number;
}
export declare function createSubagentToolDefinition(cwd: string, options?: SubagentToolOptions): ToolDefinition<typeof subagentSchema, SubagentToolDetails | undefined>;
export declare function createSubagentTool(cwd: string, options?: SubagentToolOptions): AgentTool<typeof subagentSchema>;
export declare const subagentToolDefinition: ToolDefinition<import("@sinclair/typebox").TObject<{
    agent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
    task: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
    model: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
    tasks: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
        agent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
        task: import("@sinclair/typebox").TString;
        cwd: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
        model: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
    }>>>;
    chain: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
        agent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
        task: import("@sinclair/typebox").TString;
        cwd: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
        model: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
    }>>>;
    background: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
}>, SubagentToolDetails | undefined, any>;
export declare const subagentTool: AgentTool<import("@sinclair/typebox").TObject<{
    agent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
    task: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
    model: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
    tasks: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
        agent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
        task: import("@sinclair/typebox").TString;
        cwd: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
        model: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
    }>>>;
    chain: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
        agent: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
        task: import("@sinclair/typebox").TString;
        cwd: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
        model: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
    }>>>;
    background: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
}>, any>;
export {};
//# sourceMappingURL=subagent.d.ts.map