import type { AgentControllerEvent } from '@mastra/core/agent-controller'; /** The slice of a live session this registry needs: its id, its run, its parked tools, and who it works for. */ export interface LiveSession { readonly identity: { getId(): string; }; readonly run: { isRunning(): boolean; }; readonly state: { get(): Readonly<{ factoryOrgId?: string; factoryProjectId?: string; }>; }; readonly displayState: { get(): { pendingSuspensions: ReadonlyMap; }; }; subscribe(listener: (event: AgentControllerEvent) => void): () => void; } interface SessionNotifier { onSessionCreated(listener: (session: LiveSession) => void): () => void; onSessionDeleted(listener: (session: LiveSession) => void): () => void; } /** The tool a session has waited on longest, and since when (epoch ms). */ export interface ParkedRun { toolName: string; suspendedAt: number; } /** * The sessions this process has materialized, by session id. * * Membership comes from the controller's notifications rather than * `getSessionByResource`, which hands back the pending creation — awaiting it * from a request blocks for as long as the session takes to materialize its * sandbox, minutes on a cold clone. Notifications only fire once a session * exists, so a read never waits. * * Whether a session is *running* or *parked* is read from the session itself, * never tracked here: no missed run event can leave the answer stuck. Only the * moment each suspension arrived is kept, since the session does not date them. */ export declare class LiveSessions { #private; constructor(controller: SessionNotifier); /** Whether the session has an agent run in flight right now. */ isRunning(sessionId: string): boolean; /** The tool the session is parked on, oldest first, or nothing when no answer is owed. */ parked(sessionId: string): ParkedRun | undefined; /** Every parked session of a project, so the inbox reads no card when nothing waits. */ parkedIn(factoryProjectId: string): Array<{ sessionId: string; run: ParkedRun; }>; /** Fires when a session parks, is answered, or finishes a turn: whoever shows parked runs re-reads. */ onParkedChanged(listener: (session: LiveSession) => void): () => void; } export {}; //# sourceMappingURL=live-sessions.d.ts.map