Commit graph

100 commits

Author SHA1 Message Date
Peter Steinberger
c05d91e1b2 Fix mobile header truncation and dynamic home directory display
- Replace hardcoded home directory with dynamic detection using os.homedir()
- Add server-side path formatting using existing abbreviatePath utility
- Add displayWorkingDir field to Session interface
- Fix mobile header overflow with proper width constraints
- Update clickable-path component to accept pre-formatted display paths

This fixes both the regression where ~ substitution was broken and the
mobile header pushing content off-screen when session paths are long.

Fixes #96
2025-06-28 15:22:05 +02:00
Mario Zechner
2ffb0a3a62 Fix race conditions in PTY output handling with WriteQueue
Implement WriteQueue to serialize all async write operations and handle backpressure:
- Add shared WriteQueue utility class for serializing async operations
- Move write queue inside AsciinemaWriter to handle all write methods
- Add backpressure handling using stream 'drain' events
- Ensure all AsciinemaWriter methods (writeHeader, writeRawJson) use queue
- Add drain() method to wait for pending writes on close
- Store stdout queue reference in PtySession for cleanup on process exit

This prevents race conditions where concurrent fs.fsync calls could interleave,
causing out-of-order disk flushes and potential data corruption.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-27 22:21:05 +02:00
Helmut Januschka
98e922fd44
Fix shell alias expansion timing issue (GitHub #101) (#103)
Fixed the 'command not found' error for shell aliases like claude command.

Root Cause:
Previously, commands were executed as:
  /bin/zsh -c 'source ~/.zshrc 2>/dev/null || true; claude'

Shell alias expansion happens at parse time, before the source command runs,
so aliases defined in .zshrc were not available during command parsing.

Solution:
Use interactive mode with login shell flags:
  /bin/zsh -i -l -c 'claude'

The -i flag enables interactive mode (loads aliases)
The -l flag makes it a login shell (sources RC files)
This ensures aliases are properly loaded and expanded before command execution.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Claude <noreply@anthropic.com>
2025-06-27 21:05:58 +02:00
Helmut Januschka
fc162ad55c
Prevent recursive VibeTunnel sessions (GitHub #95) (#104)
* Prevent recursive VibeTunnel sessions (GitHub #95)

Added detection and prevention of nested VibeTunnel sessions to avoid
recursive 'vt' command execution.

Changes:
- Set INSIDE_VIBETUNNEL and VIBETUNNEL_SESSION environment variables when creating PTY sessions
- Added check in vt script to detect if already inside a VibeTunnel session
- Shows helpful error message when recursive session is attempted

This prevents the confusing behavior where users could run 'vt' inside a
VibeTunnel session, creating nested terminal instances. Now users get a
clear error message explaining they're already in a VibeTunnel session.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Improve recursive session prevention based on PR feedback

- Consolidate to single environment variable VIBETUNNEL_SESSION_ID
- Add session ID for debugging purposes as requested
- Show session ID in error message for better user feedback
- Remove redundant environment variables (INSIDE_VIBETUNNEL, VIBETUNNEL_SESSION)

This addresses feedback from PR #104 to use a single, more informative
environment variable that serves both purposes: preventing recursion
and providing debugging information.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-06-27 21:05:36 +02:00
Helmut Januschka
9aaac17150
Add Shift+Tab support for Claude Code planning mode (GitHub #100) (#105)
* Add Shift+Tab support for Claude Code planning mode (GitHub #100)

Added proper Shift+Tab key sequence handling to enable Claude Code mode switching.

Changes:
- Added 'shift_tab' to SpecialKey type definition
- Updated input-manager.ts to detect Shift+Tab combination (e.shiftKey)
- Updated direct-keyboard-manager.ts for mobile Shift+Tab support
- Added shift_tab mapping to PTY manager (sends \x1b[Z escape sequence)

This allows users to press Shift+Tab in VibeTunnel to switch between Claude Code
modes (autoaccept, planning, regular) as expected.

Technical Details:
- Shift+Tab sends the standard terminal escape sequence \x1b[Z (CSI Z)
- Both desktop and mobile input handlers now support the key combination
- Maintains backward compatibility with regular Tab functionality

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix Shift+Tab not being sent as special key

Added 'shift_tab' to the special keys list in input-manager.ts so it gets
sent as {"key": "shift_tab"} instead of {"text": "shift_tab"}.

This was the missing piece - the frontend was correctly detecting Shift+Tab
but then sending it as text instead of a special key, so the server couldn't
map it to the \x1b[Z escape sequence.

Now Shift+Tab will properly send {"key": "shift_tab"} in the API request.

* Fix failing CI test in session-list.test.ts

Updated test expectation to check for 'compactMode' instead of
non-existent 'showCreateModal' property. This was a stale test
that was unrelated to the Shift+Tab changes but was blocking CI.

All tests now pass.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-06-27 21:00:09 +02:00
Armin Ronacher
47ee08c652 Fix out of order writes 2025-06-27 14:59:35 +02:00
Peter Steinberger
c70330bcfd
Migrate to Microsoft node-pty v1.1.0-beta34 (#87) 2025-06-26 23:10:05 +02:00
Helmut Januschka
5a4b939564
Fix URL link detection for wrapped URLs on mobile terminals (#85)
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2025-06-26 22:37:49 +02:00
Manuel Maly
328e000715
Split session view file (#89)
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2025-06-26 21:15:07 +02:00
Mario Zechner
50c48f6533 Fix backpressure handling to prevent hanging on large paste operations
- Add backpressure handling for process.stdout.write() in PTY output forwarding
  - Pause PTY output when stdout buffer is full
  - Resume on drain event to prevent CPU spinning
- Add backpressure logging for socket writes in sendInput()
- Add backpressure logging for file stream writes in AsciinemaWriter
- Remove unused bell detection code (was already commented out)

These changes prevent the hanging issue when pasting large amounts of text
by properly handling stream backpressure instead of blindly writing data.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-25 21:02:29 +02:00
Mario Zechner
ec64433632 Add Claude debugger patch and disable bell character handling
- Add claude-patch.ts to enable debugging Claude Code with Node.js --inspect flag
- Temporarily disable bell character handling in pty-manager.ts due to VS Code terminal hanging issue
- Fix TypeScript linter errors across test files (replace any types with proper interfaces)

The bell character handling was causing VS Code terminals to hang when pasting certain content.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-25 20:05:41 +02:00
Peter Steinberger
58e85de2ea test tweaks 2025-06-25 12:22:13 +02:00
Peter Steinberger
60d4556a58 Add new terminal quick keyboard 2025-06-25 12:22:13 +02:00
Armin Ronacher
a0886456d2 Fix auth check 2025-06-25 11:49:15 +02:00
Peter Steinberger
f8624e6298 Symlinks should be followable in Browse dialog Fixes #61 2025-06-25 05:01:20 +02:00
Peter Steinberger
a527806eb5 add patch marker for reprucible iOS builds 2025-06-25 04:08:00 +02:00
Peter Steinberger
0f48273070 lint 2025-06-25 02:47:10 +02:00
Peter Steinberger
052e6e3cd8 logging 2025-06-25 02:34:31 +02:00
Peter Steinberger
5f053f55be formatting 2025-06-25 02:34:20 +02:00
Peter Steinberger
7473a2e1c1 improved logging 2025-06-25 02:33:06 +02:00
Peter Steinberger
6b71cd79f0 fix: update tests to work with --no-auth flag and fix buffer size expectations
- Updated all e2e tests to use --no-auth flag instead of username/password
- Fixed terminal buffer test to handle little-endian encoding correctly
- Fixed buffer size expectations to handle optimized empty terminals
- Fixed logs test to allow reasonable size after clearing
- Added --no-hq-auth flag to bypass HQ authentication for testing
2025-06-25 02:11:18 +02:00
Peter Steinberger
b22d8995dd
Add comprehensive server tests and switch to Biome linter (#73) 2025-06-24 18:51:38 +02:00
Mario Zechner
45f217e143 Improve latency of both process.stdout and asciinema stdout writes. 2025-06-24 17:47:16 +02:00
Mario Zechner
f339e69f9a Add terminal size reset feature and fix source maps (#72)
- Add POST /api/sessions/:sessionId/reset-size endpoint to reset terminal size when clients disconnect
- Implement reset-size control pipe command in PTY manager
- Update session-view component to call reset-size on unmount
- Add terminal resize event listener in fwd.ts to track terminal size changes
- Fix source maps configuration for development mode:
  - Set inline source maps with embedded sources in esbuild config
  - Add source map settings to TypeScript configs
  - Set NODE_ENV to development for dev builds

This ensures external terminals resize back to their actual size when the last web client disconnects.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-24 16:12:44 +02:00
Mario Zechner
d37f813b83 Fix alias resolution and improve cross-platform support
- Fixed alias regex to handle both 'alias name=value' and 'name=value' formats
- Added platform-specific shell execution with proper flags for Windows/Unix
- Skip alias resolution on Windows (not supported)
- Use expanded alias value instead of running the alias name
- PowerShell uses -NoProfile -Command, cmd.exe uses /C, Unix shells use -c/-i
2025-06-24 14:36:10 +02:00
Mario Zechner
1470da3129 Merge branch 'origin/exec-which' and simplify command resolution
- Unified all command resolution logic in ProcessUtils.resolveCommand()
- Simplified alias handling to use interactive shell execution
- Fixed alias execution by using 'zsh -i -c' for proper alias loading
- Removed duplicate resolution code from pty-manager
- Commands are now resolved in order: PATH -> aliases -> shell builtins
2025-06-24 14:13:09 +02:00
Mario Zechner
e6e3173244 NPM distribution prep work and minor fixes in session-view/fwd logging. 2025-06-24 13:36:42 +02:00
Peter Steinberger
ac57f77806 Revert "remove authToken; that would prevent localhost from entering pw-less"
This reverts commit f59147dbc1.
2025-06-24 09:37:02 +02:00
Peter Steinberger
cd33c8f378 Revert "bypass localhost / route"
This reverts commit ef9a757608.
2025-06-24 09:37:02 +02:00
Peter Steinberger
ef9a757608 bypass localhost / route 2025-06-24 03:46:24 +02:00
Mario Zechner
17cffe7424 Fix SSE stream closing (green cursor of death) 2025-06-24 03:45:25 +02:00
Peter Steinberger
f59147dbc1 remove authToken; that would prevent localhost from entering pw-less 2025-06-24 03:38:41 +02:00
Peter Steinberger
801438d867 Add local bypass feature 2025-06-24 03:26:04 +02:00
Peter Steinberger
5b7fdac0c2 Revert "really ensures terminals close even for claude"
This reverts commit fd0abeeeee.
2025-06-24 03:20:13 +02:00
Mario Zechner
10e4f97924 Fix auth logging, fix PAM native loading outside SEA builds 2025-06-24 02:10:15 +02:00
Peter Steinberger
4e1d3a9a98 Revert "log should also authenticate, no?"
This reverts commit 62c6052faf.
2025-06-24 02:09:29 +02:00
Mario Zechner
498eb4f3fc Unfuck tsconfigs + VS Code + eslint + tsc, fix type errors 2025-06-24 01:51:46 +02:00
Peter Steinberger
62c6052faf log should also authenticate, no? 2025-06-24 01:47:45 +02:00
Mario Zechner
73dd60870e Fix SEA build wrt PAM 2025-06-24 01:38:21 +02:00
Peter Steinberger
b363355543 recompile native authenticate_pam for custom node 2025-06-24 01:16:38 +02:00
Peter Steinberger
fd0abeeeee really ensures terminals close even for claude 2025-06-24 01:01:04 +02:00
Peter Steinberger
3d28de87c4 don't use interactive shells for commands, make terminal close 2025-06-24 01:01:04 +02:00
Mario Zechner
bb17f4adcd Async fsync, so writes from PTY to host terminal are fast again. 2025-06-24 00:52:45 +02:00
Helmut Januschka
e9b395b726
Implement comprehensive user authentication with SSH key management (#43)
* Implement comprehensive user authentication system

- Add SSH-first authentication with password fallback
- Implement JWT token-based session management (24h expiry)
- Create browser-based SSH agent with key storage and signing
- Add challenge-response SSH authentication protocol
- Integrate PAM for system password authentication
- Build comprehensive authentication UI components
- Add SSH key manager for key generation and management
- Update middleware to support JWT tokens alongside existing auth
- Maintain backwards compatibility with existing HQ/remote auth
2025-06-24 00:31:13 +02:00
Armin Ronacher
77dc0993c4 Try to detect what triggers the bell 2025-06-23 23:54:48 +02:00
Peter Steinberger
9dd5c2a3af server: small test fixes 2025-06-23 17:28:22 +02:00
Peter Steinberger
3351cc08c2 fixes linter issues 2025-06-23 16:55:53 +02:00
Peter Steinberger
9101613351 server: Allow empty username to restore b2 behaviour. Fixes #59 2025-06-23 16:55:26 +02:00
Peter Steinberger
ed9ea0e373 TS fixes 2025-06-23 15:28:20 +02:00
Peter Steinberger
03cb7b4774 fix remaining ts issues 2025-06-23 15:22:47 +02:00