/** * Session Picker Component * Show modal on startup to select existing session or create new * * Features: * - Session picker modal on startup * - Recent sessions list * - Sessions grouped by project * - Create new session * - Session forking support */ class SessionPicker { constructor() { this.modal = null; this.sessions = []; this.initialized = false; } async initialize() { if (this.initialized) return; // Check URL params first const urlParams = new URLSearchParams(window.location.search); const sessionId = urlParams.get('session'); const project = urlParams.get('project'); if (sessionId) { // Load specific session console.log('[SessionPicker] Loading session from URL:', sessionId); await this.loadSession(sessionId); this.initialized = true; return; } if (project) { // Create or load session for project console.log('[SessionPicker] Project context:', project); await this.ensureSessionForProject(project); this.initialized = true; return; } // No session or project - show picker await this.showPicker(); this.initialized = true; } async showPicker() { // Create modal this.modal = document.createElement('div'); this.modal.className = 'session-picker-modal'; this.modal.innerHTML = `
Create a new session to get started
${error.message}
Create a new project to organize your sessions
${error.message}