Commit graph

149 commits

Author SHA1 Message Date
Peter Steinberger
7e697d6774
Delete old sessions when VibeTunnel version changes (#254) 2025-07-07 00:05:26 +01:00
Peter Steinberger
9db8fd284b Fix shell configuration files not being loaded
- Ensure bash, zsh, and fish spawn as login shells to read config files
- Add -i and -l flags for bash/zsh, --interactive and --login for fish
- Avoid duplicate flags if already present
- Add user feedback when starting shells in login mode

Fixes #251
2025-07-06 23:30:41 +01:00
Peter Steinberger
7f7b4b682b
Fix terminal flow control to prevent xterm.js buffer overflow (#223) 2025-07-06 12:45:31 +01:00
Armin Ronacher
36337cfd7a Fix linter 2025-07-06 11:25:27 +01:00
Armin Ronacher
6fd74b6282 Move screencap out of /api to fix auth issues 2025-07-06 11:25:27 +01:00
Helmut Januschka
f3b2022d48
Integrate screencap functionality for remote screen sharing (#209)
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2025-07-06 03:31:34 +01:00
Igor Tarasenko
9fad6301a0
feat: Add Bonjour/mDNS service discovery for iOS app (#226)
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2025-07-05 11:34:36 +01:00
Peter Steinberger
0c67a89622 feat: expand Playwright test coverage with comprehensive test suite
- Add 50+ new Playwright tests covering key features
- Implement test helpers for session management and data cleanup
- Add page objects for better test maintainability
- Improve test stability with better selectors and wait strategies
- Fix flaky tests with proper timing and synchronization
- Add comprehensive coverage for:
  - Session creation and management
  - Terminal interactions
  - File browser operations
  - Keyboard shortcuts
  - Authentication flows
  - Activity monitoring
  - Search functionality
  - UI responsiveness
- Update test infrastructure for better CI/CD integration
- Fix linting issues and improve code quality

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-04 05:08:34 +01:00
Peter Steinberger
ba372b09de
feat(tauri): Implement full feature parity with Mac app (#213) 2025-07-04 04:52:00 +01:00
Peter Steinberger
d3d0ce9dde
Add magic wand button to inject prompts into Claude sessions (#210) 2025-07-03 23:57:30 +01:00
Peter Steinberger
14b7dc1992
feat: implement parallel test execution with improved stability (#205)
Co-authored-by: Claude <noreply@anthropic.com>
2025-07-03 16:40:03 +01:00
Peter Steinberger
45d8f97a30
Improve release scripts and add git app integration (#208) 2025-07-03 12:40:09 +01:00
Billy Irwin
b74de48ddd ```
fix: prevent file browser flashing and reduce log verbosity

- Split visibility and session change handling to avoid redundant directory loads
- Only reload directory when component becomes visible or session changes while visible
- Change directory browse success log from info to debug level to reduce noise
- Fixes issue where file browser would flash/reload unnecessarily on prop changes
```
2025-07-03 00:32:01 +01:00
Peter Steinberger
2a937eac4a
Make popover window sticky during new session creation (#194) 2025-07-02 16:49:34 +01:00
Peter Steinberger
ad05e0267d Fix title injection race conditions
- Add titleInjectionInProgress flag to prevent concurrent injections
- Update lastWriteTimestamp immediately before enqueueing to prevent quiet period violations
- Clear pendingTitleToInject only after successful write completion
- Compare titles before clearing to avoid losing newer updates
- Stop injection timer only when no pending titles remain
- Use try-finally to ensure in-progress flag is always cleared

This prevents both lost title updates and quiet period violations that could
occur when titles were cleared prematurely or timestamps updated too late.
2025-07-02 07:28:48 +01:00
Peter Steinberger
d112c5300f
Remove titleDebouncer and fix stdout write ordering issues (#190) 2025-07-02 07:06:55 +01:00
Mario Zechner
43ef2d962d Optimize TitleSequenceFilter by compiling regexes once as static properties 2025-07-02 05:12:43 +01:00
Mario Zechner
f322d746af Updated spec.md 2025-07-02 05:12:43 +01:00
Peter Steinberger
920d96207b Fix logger double initialization causing log file deletion
- Modified initLogger() to return early if already initialized
- Removed explicit false parameter in server.ts to preserve debug mode from CLI
- Fixes test failure where log file was being deleted after first write
2025-07-02 00:00:53 +01:00
Peter Steinberger
a8dd9af10a Reduce terminal title update frequency to once per second
- Change periodic activity update interval from 500ms to 1000ms
- Ensure all title updates go through debouncer (including session name changes)
- Prevents excessive terminal updates while maintaining responsiveness
2025-07-02 00:00:53 +01:00
Peter Steinberger
c2f0b79cec Fix logs API test by including lastModified in all responses
- Add lastModified: null when log file doesn't exist
- Ensures consistent API response structure
2025-07-02 00:00:53 +01:00
Peter Steinberger
a6488b5ad9 Improve session display and button state management
- Fix menu bar button highlighting using state instead of highlight()
- Extract process name from command path for cleaner display
- Show session name next to command with dash separator
- Fix corner radius on new session dialog
- Make Create button darker green for better visibility
- Update editing to properly handle session names
2025-07-02 00:00:53 +01:00
Peter Steinberger
b452251a47
Improve Mac menu bar UI with better form styling and animations (#179) 2025-07-01 17:46:46 +01:00
Peter Steinberger
cf7ada95e3 fix: Remove incorrect stdin cleanup code
- Remove stdin handler cleanup that was contradicting the comment
- Remove unused stdinHandler and stdinDataListener from PtySession interface
- Stdin is handled via IPC socket, not process.stdin listeners
2025-07-01 13:41:09 +01:00
Peter Steinberger
31d7faec7f refactor: Improve PTY manager resource cleanup and performance
- Add stdin cleanup handlers for process.stdin listeners
- Implement event listener tracking to prevent memory leaks
- Add lazy watcher initialization for session.json monitoring
- Add explicit isExternalTerminal flag for better terminal detection
- Optimize activity file writing to only write on state changes
- Track last written activity state to avoid unnecessary disk I/O
2025-07-01 13:41:09 +01:00
Peter Steinberger
dd4e06f249 fix: Improve timer management and error handling in PTY manager
- Fix timer management in setupSessionJsonWatcher to properly assign timer before setTimeout
- Improve IPC socket error handling to throw error instead of silently returning
- Socket path length validation now fails fast with clear error message
2025-07-01 13:41:09 +01:00
Peter Steinberger
4e5f100074 fix: Remove orphaned test files for non-existent modules
- Delete safe-pty-writer.test.ts and stream-analyzer.test.ts
- These tests were importing modules that no longer exist
- Fixes CI test failures
2025-07-01 13:41:09 +01:00
Peter Steinberger
3b99312fdb fix: Improve heartbeat handling and session.json debounce cleanup
- Echo heartbeat messages back to clients for better connection monitoring
- Properly clear debounce timer references to prevent memory leaks
- Pass client socket to message handler for proper heartbeat responses
2025-07-01 13:41:09 +01:00
Peter Steinberger
646b478075 fix: Add security validation and sanitization for session titles
- Validate session ID format to prevent injection attacks
- Sanitize title input: limit to 256 chars, filter control characters
- Prevent potential security issues with malformed session titles
2025-07-01 13:41:09 +01:00
Peter Steinberger
92aac0ccfc fix: Integrate SafePTYWriter and fix stdin/IPC socket bugs
- Integrated SafePTYWriter and PTYStreamAnalyzer from PR #171 to prevent terminal corruption
- Fixed stdin listener duplication bug - stdin is now handled via IPC socket only
- Fixed IPC socket handler to properly handle both stdin data and control commands using framed message protocol
- Updated socket paths from 'i.sock' to unified 'ipc.sock'
- Added comprehensive tests for SafePTYWriter and PTYStreamAnalyzer
- Removed global process.stdin listeners to prevent duplication across sessions
2025-07-01 13:41:09 +01:00
Peter Steinberger
4699764db4 fix: Remove control pipe code and align with socket-based IPC from main
- Remove controlPipePath and controlWatcher from types
- Remove setupControlPipe method entirely
- Update sendControlMessage to use socket-based IPC
- Remove control pipe cleanup code
- Keep stdin forwarding memory leak fix

The control pipe system was replaced by socket-based IPC in main.
This commit removes the old control pipe code that was accidentally
reintroduced during the rebase.
2025-07-01 13:41:09 +01:00
Peter Steinberger
c5c89fc60f fix: Resolve memory leak in stdin forwarding and TypeScript errors
- Fix memory leak where stdin listeners were never removed
- Store stdin listener reference for proper cleanup
- Add missing controlPipePath property to session types
- Update session manager to include controlPipePath in paths
- Each session now properly tracks and cleans up its stdin listener

This fixes both the CI failures and the reported bug where input
was duplicated across all forwardToStdout sessions.
2025-07-01 13:41:09 +01:00
Peter Steinberger
b515d70de7 fix: Properly track session.json debounce timer for cleanup
- Update session.sessionJsonDebounceTimer when creating new timers
- Clear timer reference after callback execution
- Remove incorrect initial null assignment
- Fixes memory leak where timers continued after session cleanup

The bug occurred because the timer ID was only stored in a local variable,
preventing proper cleanup during session termination.
2025-07-01 13:41:09 +01:00
Peter Steinberger
bb272ce821 refactor: Simplify vt title implementation using fwd --update-title
- Add --update-title flag to fwd.ts for cleaner session title updates
- Replace complex bash/jq/python/sed logic with single fwd.ts call
- Leverage existing SessionManager for type-safe JSON handling
- Improve error handling and messaging
- Reorganize vt script to locate app path before processing commands

This eliminates the fragile bash JSON manipulation in favor of a
robust TypeScript implementation that reuses existing infrastructure.
2025-07-01 13:41:09 +01:00
Peter Steinberger
3fb5b463e8 fix: Security and reliability improvements for vt title
- Fix command injection vulnerability by using jq --arg for safe parameter passing
- Add Python fallback for systems without jq for safe JSON manipulation
- Improve sed fallback with proper escaping (last resort)
- Add debouncing (100ms) to file watcher to prevent rapid updates
- Add error handling for file watcher failures
- Clean up debounce timer on session cleanup
- Fix issue where lastSessionName wasn't properly tracked

Security fix prevents arbitrary command execution through malicious title strings.
Debouncing prevents performance issues from rapid file changes.
2025-07-01 13:41:09 +01:00
Peter Steinberger
a2d80f1fa3 test: Add comprehensive tests for vt title functionality
- Add error handling for 'vt title' when used outside a session
- Create unit tests for session.json watcher in PtyManager
- Add integration tests for vt title command with edge cases
- Test all 4 title modes (none, filter, static, dynamic)
- Test special characters, concurrent updates, and error scenarios
- Ensure proper cleanup of file watchers on session exit
2025-07-01 13:41:09 +01:00
Peter Steinberger
122253f947 feat: Add vt title command for dynamic session naming
- Add 'vt title' command that updates session names from within terminal sessions
- Implement file watcher in PtyManager to detect session.json changes
- Integrate title updates with all 4 title modes (none, filter, static, dynamic)
- Updates terminal titles in real-time when session name changes
- Works by directly editing session.json using the VIBETUNNEL_SESSION_ID env var

This allows users to easily set descriptive names for their terminal sessions,
making it easier to manage multiple VibeTunnel windows.
2025-07-01 13:41:09 +01:00
Peter Steinberger
6196c55ded
Display Claude status in Mac menubar (#160) 2025-07-01 11:21:28 +01:00
Jeff Hurray
28913cd490
Fix port argument passthrough for web dev (#163) 2025-07-01 06:50:20 +01:00
Helmut Januschka
8d85c26a84
feat: Add image upload functionality with camera/gallery picker (#140)
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2025-07-01 06:47:08 +01:00
Peter Steinberger
4bdb21da41
chore: bump version to 1.0.0-beta.6 build 152 (#161)
Co-authored-by: Peter Steinberger <steipete@gmail.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2025-07-01 05:54:43 +01:00
Mario Zechner
40d2cd1998
feat: add asciinema stream pruning for clear sequences (#155)
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2025-07-01 05:01:59 +01:00
Peter Steinberger
86492c4cea
feat: optimize prompt pattern detection with unified regexes (#147) 2025-06-30 09:47:15 +01:00
Peter Steinberger
8bc6e81549
feat: add comprehensive terminal title management (#124) 2025-06-30 04:15:09 +01:00
Peter Steinberger
f1c0554644
Add Playwright E2E test framework (#120) 2025-06-30 02:51:21 +01:00
Helmut Januschka
824c9134d5
Implement ultra-low-latency WebSocket input system (#115)
* Implement ultra-low-latency WebSocket input system

This change eliminates input lag on slow networks by replacing HTTP requests
with a fire-and-forget WebSocket system for terminal input transmission.

Key optimizations:
- Raw text transmission (no JSON overhead): 1 byte vs 87+ bytes per keystroke
- Fire-and-forget input (no ACK blocking): eliminates 20-50ms roundtrip latency
- Single persistent connection per session: zero connection overhead
- Direct PTY write path: fastest possible server processing
- Graceful HTTP fallback: maintains full backward compatibility

Performance improvements:
- 99% bandwidth reduction per keystroke
- 90% latency reduction on slow networks
- Zero blocking waits for rapid typing
- Eliminates HTTP/1.1 connection overhead

Files changed:
- Add: src/client/services/websocket-input-client.ts (WebSocket client)
- Add: src/server/routes/websocket-input.ts (WebSocket input handler)
- Modify: src/client/components/session-view/input-manager.ts (WebSocket integration)
- Modify: src/server/server.ts (WebSocket routing for /ws/input endpoint)

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

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

* Add socket_input URL parameter feature flag

Adds ?socket_input=true/false URL parameter to control WebSocket input behavior:
- socket_input=true (default): Enable WebSocket input with HTTP fallback
- socket_input=false: Force HTTP-only input mode (disable WebSocket)

This feature flag enables:
- A/B testing between WebSocket and HTTP input performance
- Debugging WebSocket connection issues
- Gradual rollout control
- Easy fallback mechanism for production issues

Examples:
- http://localhost:4020/?socket_input=true&session=abc123 (WebSocket enabled)
- http://localhost:4020/?socket_input=false&session=abc123 (HTTP only)

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

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

* Fix WebSocket input key mapping for special keys

The server was receiving key names like "enter" and writing them literally
as text instead of interpreting them as actual key presses.

Added proper key mapping:
- "enter" → '\r' (carriage return)
- "escape" → '\x1b' (ESC key)
- "backspace" → '\x7f' (DEL)
- "tab" → '\t' (TAB)
- "arrow_up" → '\x1b[A' (VT100 up arrow)
- "arrow_down" → '\x1b[B' (VT100 down arrow)
- "arrow_left"/"arrow_right" → '\x1b[D'/'\x1b[C' (VT100 arrows)
- Function keys F1-F12 → proper VT100 sequences
- Regular text → sent as-is

Now "enter" actually triggers ENTER key instead of typing "enter" text.

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

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

* Reuse existing key mapping logic instead of duplicating

Instead of duplicating the key mapping logic (enter → \r, etc.), now properly
reuse the existing PtyManager.sendInput() method which already handles:

- Key mapping via convertSpecialKey() method
- SessionInput type validation
- Special key vs regular text determination
- Error handling and session management

This ensures consistency between HTTP /input and WebSocket /ws/input endpoints
and avoids maintaining duplicate key mapping tables.

Benefits:
- Single source of truth for key mappings
- Consistent behavior across input methods
- Proper type safety with SessionInput/SpecialKey types
- Reuses existing error handling and validation

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

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

* Fix special key detection in pasted text using null-byte markers

Problem: Pasting text like "i am entering the world" would incorrectly
interpret "enter" as the ENTER key instead of literal text.

Solution: Use null-byte markers to distinguish special keys from literal text:
- Special keys: "\x00enter\x00" → ENTER key press
- Regular text: "enter" → literal text "enter"
- Pasted text: "i am entering the world" → literal text

This maintains the raw text protocol while solving the ambiguity:
- Single keystroke "enter" → "\x00enter\x00" → ENTER key
- Pasted word "enter" → "enter" → literal text "enter"
- Multi-word paste → always literal text

Benefits:
- Preserves ultra-minimal bandwidth (just 2 null bytes overhead)
- Maintains raw text protocol (no JSON)
- Solves paste ambiguity correctly
- Null bytes rarely appear in normal text input

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

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

* Fix paste text ambiguity and control sequence handling

- Modified sendInputText to always treat pasted content as literal text
- Added sendControlSequence method for control characters like Ctrl+R
- Updated direct keyboard manager to use sendControlSequence for control chars
- This ensures pasted text containing words like "enter", "backspace" is sent as literal text
- Control sequences like Ctrl+R (\x12) are properly transmitted via WebSocket with null-byte escaping

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

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

* Add debug logging for WebSocket input transmission

- Added detailed logging on client side to show what's being sent
- Added server side logging to show what's being received
- This will help debug the enter key transmission issue

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

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

* Add comprehensive input logging to track key processing

- Added logging in WebSocket handler to show parsed input
- Added logging in PtyManager to show key conversion and output
- This will show the complete flow: received key -> parsed input -> converted output

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

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

* Add DEBUG environment variable for enabling debug logging

- Added DEBUG=true environment variable option alongside --debug flag
- Makes it easier to enable debug logging during development

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

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

* Fix WebSocket input handling for HQ mode and mobile keyboards

- Add WebSocket proxy support for remote sessions in HQ mode
- Fix mobile keyboard special key handling to use sendInput() instead of sendInputText()
- Make InputManager.sendInput() public for use by mobile components
- Update DirectKeyboardManager to correctly send special keys from custom keyboard
- Handle WebSocket data type conversion for native WebSocket API compatibility

This ensures special keys are properly wrapped with null bytes (\x00) when sent
via WebSocket, and enables low-latency input for remote sessions in HQ mode.

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

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

* refactor: eliminate code duplication in input-manager and fix TypeScript typing

- Extract common WebSocket/HTTP fallback logic into sendInputInternal()
- Reduce ~155 lines of duplicate code across sendInput, sendInputText, and sendControlSequence methods
- Add proper WebSocketRequest interface to replace any type usage
- Fix linting issues in server.ts WebSocket handling

* up

* Add comprehensive tests for WebSocket input handler

- Test special key handling with null-byte wrapped keys (\x00enter\x00)
- Test text containing key names ('i enter the world') treated as literal text
- Test HQ mode remote session proxying vs local PTY handling
- Test edge cases: empty messages, malformed keys, binary data, Unicode
- Test error handling and connection lifecycle
- Remove duplicate special key validation logic
- Delegate key conversion to ptyManager for consistency

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

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

* Fix TypeScript linting issues in WebSocket input handler tests

- Replace all 'any' types with proper type definitions
- Add MockEventListener type for test event handlers
- Use 'unknown' instead of 'any' for type assertions
- Remove unused SessionInput import
- Fix formatting issues per Biome requirements

All 20 WebSocket input handler tests now pass with proper TypeScript types.

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

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2025-06-29 22:55:13 +02:00
Chris Reynolds
13b98308c9
fix: remove double shell-wrapping for aliases in vt script (#132) 2025-06-29 21:52:52 +01:00
Peter Steinberger
38b7846605
Fix terminal width overflow causing flickering in native terminals (#123) 2025-06-29 11:43:29 +01:00
Peter Steinberger
d0c42107f3 Switch to client-side path formatting with regex
- Remove all server-side path formatting logic
- Implement simple regex-based client-side formatting
- Support macOS, Linux, Windows, and root user paths
- Simpler implementation with no API changes needed
- Better separation of concerns (UI formatting in UI layer)
2025-06-28 15:22:05 +02:00
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