/** * IM 活跃/归档会话元数据(ai_sessions),与 chat_messages 消息正文分离。 */ import type { AISessionStatus } from './session.js'; export interface IMSessionRecord { id?: number; session_id: string; session_key: string; platform: string; endpoint_id: string; scene_id: string; scene_type: string; model: string; status: AISessionStatus; created_at: number; updated_at: number; } export interface CreateIMSessionInput { session_key: string; platform: string; endpoint_id: string; scene_id: string; scene_type: string; model?: string; } export interface IMSessionStoreConfig { sessionIdleArchiveMs?: number; } interface DbModel { select(...fields: string[]): { where(condition: Record): Promise; }; create(data: Record): Promise; update(data: Record): { where(condition: Record): Promise; }; } export declare function createSessionEpochId(sessionKey: string): string; export declare class IMSessionStore { private readonly model; private readonly config; constructor(model: DbModel, config?: IMSessionStoreConfig); findActive(sessionKey: string): Promise; getOrCreateActive(input: CreateIMSessionInput): Promise; touch(sessionId: string): Promise; archiveByKey(sessionKey: string): Promise; archiveIdleForKey(sessionKey: string): Promise; hasAnySession(sessionKey: string): Promise; } export declare class MemoryIMSessionStore { private sessions; private static readonly MAX_ENTRIES; private static readonly ARCHIVED_TTL_MS; private prune; findActive(sessionKey: string): Promise; getOrCreateActive(input: CreateIMSessionInput): Promise; touch(sessionId: string): Promise; archiveByKey(sessionKey: string): Promise; archiveIdleForKey(_sessionKey: string): Promise; hasAnySession(sessionKey: string): Promise; } export {}; //# sourceMappingURL=im-session-store.d.ts.map