import type { NormalizedQuestion, QuestionSelection } from "../question/types.js"; import { TelegramBotClient, type TelegramIncomingMessage } from "./bot.js"; import type { TelegramConnectorConfig } from "./config.js"; export type TelegramCompletionKind = "complete" | "error"; export type TelegramSessionEndpoint = { sessionId: string; cwd: string; getTitle(): string; isIdle(): boolean; sendUserMessage(text: string): void; dispatchNewSession(requestId: string): void; }; type BotLike = Pick; type BotFactory = (botToken: string, chatId: string) => BotLike; export declare class TelegramConnectorCoordinator { private readonly createBot; private readonly reportError; private readonly sessions; private readonly completionRoutes; private readonly pendingQuestions; private readonly newSessionRequests; private readonly newSessionSources; private bot; private botKey; private focusSessionId; private stopTimer; constructor(createBot?: BotFactory, reportError?: (message: string) => void); attachSession(endpoint: TelegramSessionEndpoint, config: TelegramConnectorConfig): void; detachSession(sessionId: string, endpoint?: TelegramSessionEndpoint): void; notifyCompletion(sessionId: string, kind: TelegramCompletionKind, summary?: string): Promise; askQuestions(sessionId: string, questions: NormalizedQuestion[], signal?: AbortSignal): Promise; createNewSessionRequest(sourceSessionId: string, task: string): string | undefined; consumeNewSessionRequest(requestId: string, sourceSessionId: string): string | undefined; finishNewSessionRequest(sourceSessionId: string): void; announceNewSession(sessionId: string): Promise; sendStatus(): Promise; sendHelp(): Promise; sendNotice(text: string): Promise; handleIncoming(message: TelegramIncomingMessage): Promise; stop(): void; private ensureBot; private waitForQuestionReply; private resolvePendingQuestion; private cancelPendingQuestion; private rememberCompletionRoute; private hasPendingQuestionFor; private pruneExpiredNewSessionRequests; private scheduleStop; private clearStopTimer; } type ParsedTelegramCommand = { kind: "new"; task: string; } | { kind: "help"; } | { kind: "status"; } | { kind: "message"; text: string; }; export declare function parseTelegramCommand(text: string): ParsedTelegramCommand; export declare function parseQuestionAnswer(question: NormalizedQuestion, answer: string): QuestionSelection | undefined; export declare function getTelegramConnectorCoordinator(): TelegramConnectorCoordinator; export declare function resetTelegramConnectorCoordinatorForTests(): void; export {};