import { SmrtCollection } from '@happyvertical/smrt-core'; import { ChatParticipantCollection } from '../collections/ChatParticipantCollection.js'; import { ChatRoom } from '../models/ChatRoom.js'; import { ChatRoomType } from '../types.js'; /** * Deterministic, order-independent room id for a 1:1 DM between two profiles * within a tenant (S5 #1392, DM race hardening). * * Concurrent {@link ChatRoomCollection.findOrCreateDM} calls for the same pair * compute the SAME id, so the underlying upsert (which conflicts on `id` for new * objects) collapses the racing inserts onto one row instead of creating * duplicate DM rooms. The id is a deterministic UUIDv5-shaped value derived from * the tenant and the sorted profile pair. */ export declare function canonicalDmRoomId(tenantId: string, profileId1: string, profileId2: string): string; export declare class ChatRoomCollection extends SmrtCollection { static readonly _itemClass: typeof ChatRoom; findByType(roomType: ChatRoomType): Promise; findPublic(): Promise; findDMs(): Promise; findAgentRooms(): Promise; /** * Search rooms by name/description/topic. * * Filtering and limiting are pushed into SQL via `LIKE` instead of loading * the entire tenant room set and filtering in JS (S5 #1392, DoS hardening). * The WHERE API does not support OR, so we issue one bounded query per * searchable column and merge the results, capping the total returned. */ search(query: string, options?: { limit?: number; }): Promise; /** * Find an existing 1:1 DM room between two profiles, or create one. * * DM identity is derived from the authoritative `chat_participants` join * (server-controlled) rather than client-mutable room metadata (S5 #1392). * Callers are responsible for attaching both profiles as participants after * creation; {@link ChatService.getOrCreateDM} does this. */ findOrCreateDM(profileId1: string, profileId2: string, tenantId: string, participants: ChatParticipantCollection): Promise; } //# sourceMappingURL=ChatRoomCollection.d.ts.map