/**
 * Stall classification subsystem — determines what a "stalled" task agent
 * session is doing (finished, waiting for input, still working, or errored).
 *
 * Extracted as standalone functions that receive dependencies as parameters,
 * making them easy to test without coupling to PTYService.
 *
 * @module services/stall-classifier
 */
import { type IAgentRuntime } from "@elizaos/core";
import { type StallClassification } from "pty-manager";
import type { AgentMetricsTracker } from "./agent-metrics.ts";
import type { DecisionHistoryEntry, TaskContextSummary } from "./swarm-coordinator-prompts.ts";
/** Everything the classifier needs, passed in from PTYService. */
export interface StallClassifierContext {
    sessionId: string;
    recentOutput: string;
    agentType: string;
    buffers: Map<string, string[]>;
    traceEntries: Array<string | Record<string, unknown>>;
    runtime: IAgentRuntime;
    manager: {
        get(id: string): {
            startedAt?: string | Date;
        } | null | undefined;
    } | null;
    metricsTracker: AgentMetricsTracker;
    /** Write debug snapshots to ~/.eliza/debug/ on stall (default: false) */
    debugSnapshots?: boolean;
    /** Most recent text input sent into the session, used to ignore echoed prompts. */
    lastSentInput?: string;
    log: (msg: string) => void;
}
/**
 * Build the LLM system prompt used to classify stalled output.
 */
export declare function buildStallClassificationPrompt(agentType: string, sessionId: string, output: string): string;
/**
 * Write a debug snapshot to ~/.eliza/debug/ for offline stall analysis.
 */
export declare function writeStallSnapshot(sessionId: string, agentType: string, recentOutput: string, effectiveOutput: string, buffers: Map<string, string[]>, traceEntries: Array<string | Record<string, unknown>>, log: (msg: string) => void): Promise<void>;
/**
 * Main stall classification logic. Determines what a stalled session is doing
 * by checking the buffer, building a prompt, and asking the LLM.
 */
export declare function classifyStallOutput(ctx: StallClassifierContext): Promise<StallClassification | null>;
/** Context for the combined classify-and-decide call. */
export interface CoordinatorClassifyContext extends StallClassifierContext {
    taskContext: TaskContextSummary;
    decisionHistory?: DecisionHistoryEntry[];
}
/**
 * Build a combined prompt that classifies the stall AND decides how to respond,
 * merging stall classification with coordinator decision guidelines.
 *
 * Used for coordinator-managed sessions in autonomous mode to eliminate the
 * redundant second LLM call in the coordinator's handleBlocked path.
 */
export declare function buildCombinedClassifyDecidePrompt(agentType: string, sessionId: string, output: string, taskContext: TaskContextSummary, decisionHistory: DecisionHistoryEntry[]): string;
/**
 * Combined classify-and-decide for coordinator-managed autonomous sessions.
 *
 * Performs classification AND coordinator-quality response decision in a single
 * LLM call. The suggestedResponse is kept intact (not stripped), so pty-manager
 * auto-responds and the coordinator receives autoResponded: true — skipping
 * the second LLM call in handleBlocked().
 */
export declare function classifyAndDecideForCoordinator(ctx: CoordinatorClassifyContext): Promise<StallClassification | null>;
//# sourceMappingURL=stall-classifier.d.ts.map