/** * Stall classification subsystem — determines what a "stalled" coding 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.js"; import type { TaskContextSummary, DecisionHistoryEntry } from "./swarm-coordinator-prompts.js"; /** Everything the classifier needs, passed in from PTYService. */ export interface StallClassifierContext { sessionId: string; recentOutput: string; agentType: string; buffers: Map; traceEntries: Array>; runtime: IAgentRuntime; manager: { get(id: string): { startedAt?: string | Date; } | null | undefined; } | null; metricsTracker: AgentMetricsTracker; /** Write debug snapshots to ~/.milady/debug/ on stall (default: false) */ debugSnapshots?: boolean; 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 ~/.milady/debug/ for offline stall analysis. */ export declare function writeStallSnapshot(sessionId: string, agentType: string, recentOutput: string, effectiveOutput: string, buffers: Map, traceEntries: Array>, log: (msg: string) => void): Promise; /** * 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; /** 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; //# sourceMappingURL=stall-classifier.d.ts.map