Commit graph

33 commits

Author SHA1 Message Date
Peter Steinberger
7e697d6774
Delete old sessions when VibeTunnel version changes (#254) 2025-07-07 00:05:26 +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
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
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
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
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
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
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
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
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
Peter Steinberger
9101613351 server: Allow empty username to restore b2 behaviour. Fixes #59 2025-06-23 16:55:26 +02:00
Peter Steinberger
c7e0675d5c Support bind for server 2025-06-23 14:58:11 +02:00
Armin Ronacher
0ac9f81b90 Added push notifications for bells 2025-06-23 13:51:49 +02:00
Mario Zechner
302063327e feat: Add unified logging infrastructure with web viewer
- Implement client-side logger that mirrors server interface
- Add /api/logs endpoints for client log submission and retrieval
- Create real-time log viewer component at /logs with filtering
- Update all client files to use new logging system
- Add responsive design for log viewer (mobile/desktop layouts)
- Implement smart auto-scroll that preserves reading position
- Add Mac-style auto-hiding scrollbars
- Configure Express to serve .html files with clean URLs
- Update spec.md with logging infrastructure documentation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-23 00:05:43 +02:00
Mario Zechner
04cfe992ee refactor: Apply unified logging style guide to all server files
- Remove all colors from error/warn logs per style guide
- Add appropriate colors to logger.log calls (green=success, yellow=warning, blue=info, gray=metadata)
- Remove all prefixes like [STREAM], ERROR:, WARNING:
- Ensure all messages start lowercase (except acronyms) with no periods
- Add missing essential logs for lifecycle events and state changes
- Add debug logs for troubleshooting and performance monitoring
- Ensure all error logs include the error object
- Add proper logging to previously silent catch blocks
- Enhance context in logs with relevant IDs, counts, and durations

The logging now provides comprehensive visibility into:
- Server initialization and shutdown sequences
- Session lifecycle (creation, usage, termination)
- Connection events and client tracking
- Authentication attempts and security events
- File system operations and Git performance
- Remote server health checks and HQ communication
- Process management across platforms
- Resource cleanup and performance metrics

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 23:10:51 +02:00
Mario Zechner
f6df526f6b feat: Add structured logging system with unified style
- Implement centralized logger utility with file and console output
- Add debug mode support via --debug flag
- Initialize logger at startup for server, fwd, and cli
- Replace all console.log/error calls with structured logger
- Add logging style guide for consistent messaging
- Include proper shutdown handling with closeLogger()

The logger provides:
- Timestamped color-coded console output
- Module identification in all logs
- File logging to ~/.vibetunnel/log.txt
- Debug logs toggled via --debug flag

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 22:40:00 +02:00
Peter Steinberger
a49ecbc1a7 fix: Fix CI issues - iOS build/test and TypeScript linting
- Fix iOS CI to use correct workspace and scheme names
- Update iOS test script to use workspace instead of project
- Fix all TypeScript 'any' type warnings by adding proper types
- Update build destination format for Xcode 16 compatibility
2025-06-22 17:09:59 +02:00
Peter Steinberger
180caf7e81 Add logic to use custom node compiler 2025-06-22 11:53:15 +02:00
Mario Zechner
e912b65c9e Fix Node.js detection in build-bun-executable.sh for Xcode builds
Add common Node.js installation paths to PATH including Homebrew, NVM, n, and MacPorts locations. This matches the approach used in build-web-frontend.sh and ensures the script can find Node.js when running in Xcode's restricted environment.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 04:04:52 +02:00
Peter Steinberger
34fc38d13f aff fs route 2025-06-21 18:08:06 +02:00
Mario Zechner
d4b8748b22 Reorganize server structure for clarity
- Rename index.ts to cli.ts as single entry point
- Merge app.ts and shutdown-state.ts into server.ts
- Update all imports and references to use new structure
- Update e2e tests and dev script to spawn via cli.ts
- Remove execution code from server.ts (only cli.ts executes)
- Clean up tsconfig.client.json exclude path

This creates a cleaner separation where cli.ts is the only entry
point that decides whether to run server or forward mode.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-21 16:44:56 +02:00
Peter Steinberger
db8f4ffbeb Add first iteration of file browser 2025-06-21 16:11:35 +02:00
Peter Steinberger
a5b0354139 Burn everything with fire that is not node or swift. 2025-06-21 14:39:44 +02:00
Mario Zechner
8d5fd5457c Bun native build, unified entry point for native build. 2025-06-21 01:33:22 +02:00
Renamed from web/src/server/index.ts (Browse further)