import { SmrtCollection } from '@happyvertical/smrt-core'; import { AgentSession } from '../models/AgentSession.js'; export declare class AgentSessionCollection extends SmrtCollection { static readonly _itemClass: typeof AgentSession; findActiveByParticipant(participantProfileId: string): Promise; /** * Resolve the active agent session for an (agent, participant) pair within a * tenant (S5 #1392). * * `tenantId` is REQUIRED and always bound into the WHERE clause — including the * `null` (untenanted) case — so the lookup can never silently drop its tenant * predicate and resolve a session from another tenant. AgentSession uses * optional tenancy, so `null` is a legitimate, explicitly-bound scope rather * than "any tenant". * * When `sessionKey` is supplied the result is additionally narrowed to the * session whose stored {@link AgentSession.getSessionKey} matches EXACTLY * (S5 #1392). This binds session identity to a conversation subject (e.g. a * content id) so a session opened for one subject is never reused for another; * `sessionContext` is a JSON blob so the discriminator is matched in memory * after the tenant-bound SQL filter. */ findActiveSession(agentId: string, participantProfileId: string, tenantId: string | null, sessionKey?: string | null): Promise; findOrCreate(params: { agentId: string; participantProfileId: string; tenantId: string | null; allowedTools?: string[]; chatRoomId?: string | null; systemPrompt?: string; /** * Optional subject-scoping key (S5 #1392). When set, an existing active * session is reused only if its stored session key matches, and the created * session records the key so future lookups stay subject-scoped. */ sessionKey?: string | null; }): Promise; findByAgent(agentId: string): Promise; /** * Expire active sessions whose last activity predates `olderThan`. * * Caller-scoping (S5 #1392): pass `scope` to restrict the sweep to a single * tenant and/or agent. Without a scope this expires stale sessions across the * whole (tenant-filtered) collection — only safe for trusted maintenance * callers, never for a per-tenant request handler. * * The candidate set is narrowed in SQL (status + activity timestamp) rather * than loading every active session into memory and filtering in JS * (DoS hardening). `lastMessageAt < olderThan` is applied server-side; rows * that never recorded a message fall back to `created_at`. */ expireStale(olderThan: Date, scope?: { tenantId?: string | null; agentId?: string; }): Promise; } //# sourceMappingURL=AgentSessionCollection.d.ts.map