import { c as WarpGrepContext } from '../types-CtkD4o1_.js';
import '../tools/warp_grep/providers/types.js';
import '../tools/utils/resilience.js';

/**
 * Types for Explore subagent
 */

/** Thoroughness level for exploration */
type ExploreThoroughness = 'quick' | 'medium' | 'thorough';
/** Configuration for creating an Explore subagent */
interface ExploreSubagentConfig {
    /** Morph API key for WarpGrep searches */
    morphApiKey?: string;
    /** Root directory of the repository to search */
    repoRoot: string;
    /** How thorough the exploration should be */
    thoroughness?: ExploreThoroughness;
    /** Maximum number of model turns (defaults based on thoroughness) */
    maxTurns?: number;
    /** Timeout in milliseconds for the entire exploration */
    timeout?: number;
    /** Timeout in milliseconds for waiting for host reply to send_message */
    replyTimeout?: number;
    /** Glob patterns to exclude from search */
    excludes?: string[];
    /** Glob patterns to include in search */
    includes?: string[];
}
/** Result from an exploration */
interface ExploreResult {
    /** Whether the exploration completed successfully */
    success: boolean;
    /** Concise summary of findings (for model consumption) */
    summary: string;
    /** Full code contexts found during exploration (for app consumption) */
    contexts: WarpGrepContext[];
    /** Number of WarpGrep searches performed */
    searchCount: number;
    /** Total duration in milliseconds */
    durationMs: number;
    /** Error message if exploration failed */
    error?: string;
}
/** Progress event for a single exploration step */
interface ExploreStep {
    /** Step number (1-based) */
    step: number;
    /** The search request sent to WarpGrep */
    searchRequest: string;
    /** Number of contexts returned */
    contextsFound: number;
    /** Whether this is the final step */
    isFinal: boolean;
}
/** Message sent between host and subagent */
interface SubagentMessage {
    /** Who sent the message */
    from: 'explore' | 'host';
    /** Message content */
    content: string;
    /** Timestamp */
    timestamp: number;
}
/** Union type for streaming events */
type ExploreEvent = {
    type: 'step';
    step: number;
    searchRequest: string;
    contextsFound: number;
    isFinal: boolean;
} | {
    type: 'message';
    from: 'explore' | 'host';
    content: string;
    timestamp: number;
};
/** Callback for message events */
type MessageHandler = (message: SubagentMessage, reply: (text: string) => void) => void;
/** Callback for step events */
type StepHandler = (step: ExploreStep) => void;
/** Session returned by explore.run() */
interface ExploreSession {
    /** Listen for events */
    on(event: 'message', handler: MessageHandler): ExploreSession;
    on(event: 'step', handler: StepHandler): ExploreSession;
    /** Send a message to the subagent */
    send(text: string): void;
    /** Promise that resolves with the final result */
    result: Promise<ExploreResult>;
}

export type { ExploreEvent, ExploreResult, ExploreSession, ExploreStep, ExploreSubagentConfig, ExploreThoroughness, MessageHandler, StepHandler, SubagentMessage };
