- Show login modal when user is not authenticated
- Add handleLogin, showLoginModal, closeLoginModal functions
- Add login modal HTML with username/password form
- Add CSS styles for modal
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Show actual server error message when project creation fails
- Add console logging to debug project creation
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Bug fixes:
- Add missing showLoadingOverlay/hideLoadingOverlay functions to ide.js
(previously only existed in sessions-landing.js, causing continueSessionInChat to fail)
- Add loading overlay CSS styles to main style.css
- Fix Projects button URL: /projects -> /claude/ide?view=projects
- Add ?view= URL parameter handling in ide.js initialization
- Add missing Native mode button to chat view (now has 3 modes: Chat, Native, Terminal)
These fixes resolve:
1. "Continue in Chat" button not working in sessions view
2. Projects button in landing page nav taking to wrong URL
3. Missing "Native" mode button (user referred to as "Full Stack mode")
4. Loading overlay not displaying in IDE
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The WebSocket closes immediately with code 1006 due to nginx/proxy
issues. This implementation completely bypasses WebSocket for
terminal output by using HTTP polling instead.
Architecture:
- Server buffers PTY output in memory (outputBuffer array)
- Frontend polls every 100ms via GET /terminals/:id/output?since=N
- Output entries have monotonically increasing index
- Old output is automatically cleaned up after 5 minutes
- Commands sent via HTTP POST (already implemented)
Changes:
- terminal-service.js: Added bufferOutput(), getTerminalOutput()
- terminal.js: Added startPolling(), stopPolling(), sendTerminalResize()
- server.js: Added GET /terminals/:id/output and POST /terminals/:id/resize
- No WebSocket needed for output display (keeps legacy compatibility)
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The WebSocket send mechanism fails with close code 1006 when client
tries to send data to server. Server never receives the message,
indicating a network/proxy layer issue that couldn't be fixed through
code changes or nginx configuration.
Solution: Bypass WebSocket send entirely by using HTTP POST to send
commands directly to the PTY.
Changes:
- Added sendTerminalInput() method to terminal-service.js that writes
directly to PTY, bypassing WebSocket
- Added POST endpoint /claude/api/terminals/:id/input to server.js
- Modified launchCommand() in terminal.js to use fetch() with HTTP
POST instead of WebSocket.send()
The WebSocket receive direction still works (server→client for output
display), only send direction (client→server for commands) is bypassed.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Changes:
1. Added map for proper WebSocket upgrade handling
2. Changed Connection header from literal 'upgrade' to variable
3. Added proxy_send_timeout 7d to prevent premature connection closure
4. Disabled proxy_buffering and proxy_request_buffering for WebSocket
5. Added proxy_request_buffering off for better WebSocket performance
These changes should fix the WebSocket closure issue that was preventing
commands from being sent to the terminal.
The WebSocket was closing exactly 100ms after switchToTerminal completed,
which correlated with the setTimeout(fitAddon.fit(), 100) call.
Hypothesis: The fitAddon.fit() call or the 100ms delay is causing
the WebSocket to close through an unknown mechanism (possibly triggering
browser GC, event loop blocking, or some resource cleanup).
Changes:
- Removed 100ms stabilization delay in launchCommand
- Disabled fitAddon.fit() call in switchToTerminal
This should prevent the WebSocket closure and allow commands to be sent.
The issue was that switchToTerminal() was not being awaited, so
launchCommand() was called while switchToTerminal() was still
executing. This caused a race condition where the WebSocket
closed before the command could be sent.
By awaiting switchToTerminal(), we ensure the terminal is fully
switched before attempting to send any commands.
- Log when switchToTerminal is called and if terminal is in map
- Log fitAddon.fit() execution with error handling
- Log when switchToTerminal completes
This will help identify if switchToTerminal is causing the WebSocket closure
- Log PTY PID and shell when spawned
- Log all PTY output data
- Log PTY exit events with exit code and signal
- Log when WebSocket cannot send PTY data
This will help identify if the PTY is exiting immediately
or if there's an issue with the PTY process.
- Added 100ms delay before sending command to ensure WebSocket stability
- Added detailed WebSocket state logging (CONNECTING, OPEN, CLOSING, CLOSED)
- Added bufferedAmount check to wait for pending sends
- Wrapped ws.send() in try-catch for better error reporting
- Split terminal and ws existence checks for clearer debugging
- Added debug panel in terminal view that shows all terminal activity
- Added debugLog() method to TerminalManager for consistent logging
- Updated connectTerminal, handleTerminalMessage, launchCommand, createTerminal, initializeXTerm with detailed logging
- Enhanced backend logging for WebSocket messages and close codes
- Logs now show both to console and visual debug panel
This should help diagnose the terminal command execution issue without
requiring browser console access.
- Add sessions table to database with projectId and deletedAt columns
- Create POST /api/sessions/:id/move endpoint to reassign sessions
- Update DELETE /api/projects/:id to cascade soft-delete to sessions
- Support moving sessions between projects or to unassigned state
- Handle both active (in-memory) and historical sessions
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>