/** * Question Registry - Manages pending questions from the agent's ask_user tool. * * When the agent asks a question via ask_user, this registry: * - Stores the question with Promise callbacks for resolution * - Updates TaskState with pending question * - Provides answer submission with validation * - Handles timeouts (30 min default) * - Sends MCP notifications when questions arrive */ import type { PendingQuestion } from '../types.js'; /** User input response shape. */ interface UserInputResponse { answer: string; wasFreeform: boolean; } type QuestionNotificationCallback = (taskId: string, question: PendingQuestion) => void; declare class QuestionRegistry { private bindings; private notificationCallback?; /** * Set callback for MCP notifications when questions arrive. */ onQuestionAsked(callback: QuestionNotificationCallback): void; /** * Register a pending question and return a Promise that resolves when answered. * This is called when a session asks for user input. */ register(taskId: string, sessionId: string, question: string, choices?: string[], allowFreeform?: boolean): Promise; /** * Submit an answer for a pending question. * Validates the answer format and resolves the Promise. */ submitAnswer(taskId: string, answer: string): { success: boolean; error?: string; resolvedAnswer?: string; wasFreeform?: boolean; }; /** * Parse and validate an answer. * Supports: "1", "2", "3" (choice index), "CUSTOM: text", or direct text. */ private parseAnswer; /** * Handle question timeout. */ private handleTimeout; /** * Clear a pending question for a task. */ clearQuestion(taskId: string, reason?: string): void; /** * Get the pending question for a task. */ getQuestion(taskId: string): PendingQuestion | undefined; /** * Check if a task has a pending question. */ hasPendingQuestion(taskId: string): boolean; /** * Get all tasks with pending questions. */ getAllPendingQuestions(): Map; /** * Clean up all pending questions (e.g., on server shutdown). */ cleanup(): void; /** * Get statistics. */ getStats(): { pendingCount: number; oldestQuestionAge?: number; }; } export declare const questionRegistry: QuestionRegistry; export {}; //# sourceMappingURL=question-registry.d.ts.map