diff --git a/src/web/public/app.js b/src/web/public/app.js index 4952d29d..788b0939 100644 --- a/src/web/public/app.js +++ b/src/web/public/app.js @@ -13,6 +13,7 @@ class ClaudemanApp { this.respawnTimers = {}; // Track timed respawn timers this.terminalBuffers = new Map(); // Store terminal content per session this.editingSessionId = null; // Session being edited in options modal + this.pendingCloseSessionId = null; // Session pending close confirmation // Terminal write batching this.pendingWrites = ''; @@ -472,7 +473,7 @@ class ClaudemanApp { ${this.escapeHtml(name)} ${hasRunningTasks ? `${taskStats.running}` : ''} ⚙ - × + × `; } @@ -568,6 +569,35 @@ class ClaudemanApp { } } + // Request confirmation before closing a session + requestCloseSession(sessionId) { + const session = this.sessions.get(sessionId); + if (!session) return; + + this.pendingCloseSessionId = sessionId; + + // Show session name in confirmation dialog + const name = this.getSessionName(session); + const sessionNameEl = document.getElementById('closeConfirmSessionName'); + sessionNameEl.textContent = name; + + document.getElementById('closeConfirmModal').classList.add('active'); + } + + cancelCloseSession() { + this.pendingCloseSessionId = null; + document.getElementById('closeConfirmModal').classList.remove('active'); + } + + async confirmCloseSession() { + const sessionId = this.pendingCloseSessionId; + this.cancelCloseSession(); + + if (sessionId) { + await this.closeSession(sessionId); + } + } + nextSession() { const ids = Array.from(this.sessions.keys()); if (ids.length <= 1) return; @@ -1379,6 +1409,7 @@ class ClaudemanApp { closeAllPanels() { this.closeSessionOptions(); this.closeAppSettings(); + this.cancelCloseSession(); document.getElementById('respawnPanel').classList.remove('open'); document.getElementById('newSessionPanel').classList.remove('open'); document.getElementById('taskPanel').classList.remove('open'); diff --git a/src/web/public/index.html b/src/web/public/index.html index 9b2066a7..dfa2a5ab 100644 --- a/src/web/public/index.html +++ b/src/web/public/index.html @@ -273,6 +273,25 @@ + + +