/**
 * Auto-research handler — sends an auto-research task through the existing
 * AgentBridge (backend proxy) instead of spawning a separate spectral process.
 *
 * This ensures auto-research uses the same model and API keys as the active
 * session — no separate subprocess, no missing API key errors.
 *
 * Flow:
 *   1. Build the auto-research task prompt
 *   2. Ensure session subscriber exists (borrows handleClientMessage pattern)
 *   3. Emit auto_research_start via relay
 *   4. Send task via manager.prompt() — goes through backend proxy with session's model
 *   5. Attach a watcher subscriber to detect turn completion
 *   6. On agent_end, scan for generated extensions and emit auto_research_complete
 *   7. On error, emit auto_research_error
 */
import type { SessionStore } from "../server/storage.js";
import type { SessionStreamManager, Subscriber } from "../server/session-stream.js";
import type { RelayClient } from "./client.js";
/** Input shape consumed by `handleAutoResearch`. */
export interface AutoResearchInput {
    projectId: string;
    sessionId: string;
}
/** Dependencies injected by the dispatcher. */
export interface AutoResearchDeps {
    store: SessionStore;
    manager: SessionStreamManager;
    relay: Pick<RelayClient, "send">;
    /** Subscriber map shared with handleClientMessage — ensures the session
     *  already has a wire subscriber before we prompt. */
    subscribers: Map<string, Subscriber>;
    /** Project working directory (cwd from serve.ts). Used for file scanning. */
    cwd: string;
    /** Optional logger. Defaults to console.error. */
    logger?: {
        error: (...args: unknown[]) => void;
    };
}
/**
 * An extension discovered or generated by auto-research.
 * Mirrors the shape in `ServerEvent["auto_research_complete"]["extensions"]`.
 */
export interface AutoResearchExtension {
    name: string;
    path: string;
    description: string;
    usesLLM?: boolean;
    fileCount?: number;
}
/**
 * Execute auto-research for a project through the existing AgentBridge.
 *
 * Caller (dispatcher) is fire-and-forget — this function is `void` and
 * all errors are surfaced as `auto_research_error` events on the wire
 * rather than thrown.
 *
 * This replaces the old subprocess-spawning approach. Instead of launching
 * a separate spectral process (which lacks backend proxy credentials), we send
 * the auto-research task through the session's existing AgentBridge. The agent
 * uses the session's model, backend proxy, and all available tools.
 */
export declare function handleAutoResearch(input: AutoResearchInput, deps: AutoResearchDeps): void;
//# sourceMappingURL=auto-research.d.ts.map