/** * 会话管理模块 * 管理用户与 OpenCode 之间的会话生命周期 */ import type { BotDatabase, SessionChat } from '../database'; import type { FeishuClient, MessageEvent } from '../feishu/client'; import type { OpencodeWrapper } from '../opencode/client'; import { type QuestionInfo } from '../feishu/question-card'; export interface SessionManagerConfig { defaultProjectPath: string; adminUserIds: string[]; allowAllUsers: boolean; } interface PendingQuestion { requestId: string; messageId: string; questions: QuestionInfo[]; chatId: string; } export declare class SessionManager { private db; private feishuClient; private opencodeClient; private config; private activeSessions; private messageQueue; private pendingQuestions; constructor(db: BotDatabase, feishuClient: FeishuClient, opencodeClient: OpencodeWrapper, config: SessionManagerConfig); handleMessage(event: MessageEvent): Promise; private queueMessage; private processMessage; private setSessionChatTitle; private handleOpencodeEvent; private formatPart; private handleQuestionAsked; private handleQuestionTextAnswer; handleQuestionAnswer(chatId: string, requestId: string, questionIndex: number, answerLabel: string, messageId?: string): Promise; getPendingQuestion(chatId: string): PendingQuestion | undefined; private parsePostContent; private getOrCreateSession; private cleanupSession; private isUserAuthorized; private sendUnauthorizedMessage; createNewSession(chatId: string): Promise; switchProject(chatId: string, projectPath: string): Promise; abortCurrentSession(chatId: string): Promise; isAdmin(userId: string): boolean; getActiveSessionCount(): number; getDefaultProjectPath(): string; handleMessageRecall(userMessageId: string): Promise<{ aborted: boolean; botMessagesDeleted: number; }>; cleanupChatData(chatId: string): void; getOrCreateUserSession(userId: string): Promise; createNewUserSession(userId: string): Promise; getUserSessionInfo(userId: string): Promise<{ sessionId: string; projectPath: string; isActive: boolean; } | null>; switchUserProject(userId: string, projectPath: string): Promise; createSessionChat(userId: string, projectPath: string): Promise<{ chatId: string; sessionId: string; } | null>; cleanupSessionChat(chatId: string): Promise; handleUserLeftSessionChat(chatId: string): Promise; getSessionChat(chatId: string): SessionChat | null; getUserSessionChats(userId: string): SessionChat[]; cleanup(): void; } export declare function createSessionManager(db: BotDatabase, feishuClient: FeishuClient, opencodeClient: OpencodeWrapper, config: SessionManagerConfig): SessionManager; export {}; //# sourceMappingURL=manager.d.ts.map