diff --git a/database.sqlite-shm b/database.sqlite-shm index c0912ec1..f1e34f49 100644 Binary files a/database.sqlite-shm and b/database.sqlite-shm differ diff --git a/database.sqlite-wal b/database.sqlite-wal index 5626bb95..beca9853 100644 Binary files a/database.sqlite-wal and b/database.sqlite-wal differ diff --git a/public/claude-ide/terminal.js b/public/claude-ide/terminal.js index 00a2c86f..2b8ff915 100644 --- a/public/claude-ide/terminal.js +++ b/public/claude-ide/terminal.js @@ -701,9 +701,8 @@ class TerminalManager { this.debugLog('CMD', `Terminal ${terminalId} is ready!`); - // Small delay to ensure WebSocket is stable after switching terminals - this.debugLog('CMD', `Waiting 100ms for WebSocket to stabilize...`); - await new Promise(resolve => setTimeout(resolve, 100)); + // NO DELAY - send command immediately to avoid WebSocket closure + this.debugLog('CMD', `Sending command immediately without delay...`); const terminal = this.terminals.get(terminalId); if (!terminal) { @@ -728,13 +727,7 @@ class TerminalManager { return; } - // Check if WebSocket has any buffered amount (indicating pending sends) - if (terminal.ws.bufferedAmount > 0) { - this.debugLog('CMD', `WebSocket has ${terminal.ws.bufferedAmount} bytes buffered, waiting...`); - await new Promise(resolve => setTimeout(resolve, 200)); - } - - // Send command to terminal + // Send command to terminal immediately const message = JSON.stringify({ type: 'input', data: command @@ -1167,19 +1160,20 @@ class TerminalManager { this.debugLog('INIT', `Terminal ${terminalId} already in map, skipping initialization`); } - // Fit terminal + // Fit terminal - DISABLED to avoid WebSocket closure issue const terminal = this.terminals.get(terminalId); if (terminal && terminal.fitAddon) { - this.debugLog('INIT', `Calling fitAddon.fit() for ${terminalId} in 100ms...`); - setTimeout(() => { - this.debugLog('INIT', `Executing fitAddon.fit() for ${terminalId}`); - try { - terminal.fitAddon.fit(); - this.debugLog('INIT', `fitAddon.fit() completed for ${terminalId}`); - } catch (error) { - this.debugLog('ERROR', `fitAddon.fit() failed for ${terminalId}`, { error: error.message }); - } - }, 100); + this.debugLog('INIT', `Skipping fitAddon.fit() for ${terminalId} to avoid WebSocket closure`); + // TODO: Investigate why fitAddon.fit() causes WebSocket to close + // setTimeout(() => { + // this.debugLog('INIT', `Executing fitAddon.fit() for ${terminalId}`); + // try { + // terminal.fitAddon.fit(); + // this.debugLog('INIT', `fitAddon.fit() completed for ${terminalId}`); + // } catch (error) { + // this.debugLog('ERROR', `fitAddon.fit() failed for ${terminalId}`, { error: error.message }); + // } + // }, 100); } else { this.debugLog('INIT', `No fitAddon for terminal ${terminalId} (terminal=${!!terminal}, fitAddon=${!!terminal?.fitAddon})`); }