UNPKG

claude-playwright

Version:

Seamless integration between Claude Code and Playwright MCP for efficient browser automation and testing

115 lines 3.17 kB
export interface SessionData { name: string; createdAt: number; expiresAt: number; storageState: any; browserProfile?: string; metadata?: { url?: string; userAgent?: string; viewport?: { width: number; height: number; }; }; } export interface SessionListItem { name: string; created: string; expires: string; expired: boolean; browserProfile?: string; } export declare class SessionManager { private sessionsDir; private profilesDir; private configPath; constructor(workingDir?: string); /** * Get session configuration */ getSessionConfig(): Promise<any>; /** * Save a browser session with 8-hour expiry */ saveSession(name: string, storageState: any, options?: { browserProfile?: string; metadata?: SessionData['metadata']; }): Promise<string>; /** * Load a stored session and check expiry */ loadSession(name: string): Promise<any>; /** * Get full session data including metadata */ getSessionData(name: string): Promise<SessionData>; /** * List all sessions with their status */ listSessions(): Promise<SessionListItem[]>; /** * Clear expired sessions */ clearExpiredSessions(): Promise<number>; /** * Delete a specific session */ deleteSession(name: string): Promise<boolean>; /** * Check if session exists and is valid */ isSessionValid(name: string): Promise<boolean>; /** * Update session expiry (extend for another 8 hours) */ extendSession(name: string): Promise<boolean>; /** * Auto-extend session if it expires in less than 2 hours */ autoExtendSession(name: string): Promise<boolean>; /** * Check session health and provide recommendations */ checkSessionHealth(name: string): Promise<{ isValid: boolean; hoursRemaining: number; recommendation: string; needsExtension: boolean; }>; /** * Batch check health of all sessions */ checkAllSessionsHealth(): Promise<Array<{ name: string; isValid: boolean; hoursRemaining: number; recommendation: string; needsExtension: boolean; }>>; /** * Find the latest valid session for auto-loading (MCP integration) */ findLatestValidSession(): Promise<SessionData | null>; /** * Get the currently active session name from active-session.json */ getActiveSession(): Promise<string | null>; /** * Switch to a different session by updating active-session.json */ switchSession(sessionName: string): Promise<boolean>; /** * Get MCP-compatible session data with environment variables */ getMCPSessionData(sessionName?: string): Promise<any>; /** * Auto-save session during MCP usage */ autoSaveSession(storageState: any, metadata?: any): Promise<string | null>; /** * Clean up old auto-backup sessions */ private cleanupOldAutoBackups; } //# sourceMappingURL=session-manager.d.ts.map