/** * Session Manager * * Manages persistent sessions across apps. */ import type { Session } from "@agentick/core"; import type { AppRegistry, AppInfo } from "./app-registry.js"; import type { SessionState } from "./types.js"; interface ManagedSession { state: SessionState; coreSession: Session | null; appInfo: AppInfo; /** The session name without app prefix - used when creating App sessions */ sessionName: string; } /** * SessionManager configuration */ export interface SessionManagerConfig { /** Gateway ID for DevTools events */ gatewayId: string; } export declare class SessionManager { private sessions; private registry; private gatewayId; private devToolsSequence; constructor(registry: AppRegistry, config?: SessionManagerConfig); /** * Normalize a session key to the canonical format (appId:sessionName). * This ensures consistent lookups regardless of input format. */ private normalizeKey; /** * Emit a DevTools session event */ private emitDevToolsEvent; /** * Get or create a session */ getOrCreate(sessionKey: string, clientId?: string): Promise; /** * Get an existing session */ get(sessionKey: string): ManagedSession | undefined; /** * Check if a session exists */ has(sessionKey: string): boolean; /** * Close a session */ close(sessionKey: string): Promise; /** * Close all active sessions. Called during gateway shutdown to ensure * component trees unmount and sandbox teardown runs (kills TigerFS, etc.). */ closeAll(): Promise; /** * Reset a session (clear history but keep session) */ reset(sessionKey: string): Promise; /** * Get all session IDs */ ids(): string[]; /** * Get all sessions */ all(): ManagedSession[]; /** * Get sessions for a specific app */ forApp(appId: string): ManagedSession[]; /** * Get session count */ get size(): number; /** * Add a subscriber to a session. * Creates the session if it doesn't exist (ensures subscription is never lost). */ subscribe(sessionKey: string, clientId: string): Promise; /** * Remove a subscriber from a session */ unsubscribe(sessionKey: string, clientId: string): void; /** * Remove a client from all subscriptions */ unsubscribeAll(clientId: string): void; /** * Get subscribers for a session */ getSubscribers(sessionKey: string): Set; /** * Update message count for a session */ incrementMessageCount(sessionKey: string, clientId?: string): void; /** * Set session active state */ setActive(sessionKey: string, isActive: boolean): void; } export {}; //# sourceMappingURL=session-manager.d.ts.map