Commit graph

283 commits

Author SHA1 Message Date
Mario Zechner
3a3b5e44e9 feat: Add unified logger utility with file and console output
- Create logger factory with explicit module names (no stack traces)
- Support log/warn/error/debug levels with clean method names
- Write to ~/.vibetunnel/log.txt with automatic cleanup on startup
- Add colored console output with timestamps and module names
- Support debug mode via flag or environment variable

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 22:04:11 +02:00
Mario Zechner
1c007a2181 fix: Track cursor visibility state in terminal renderer
Applications like Claude CLI use ANSI escape sequences to hide the cursor
(\x1b[?25l) and render their own cursor with inverse text. The terminal
component now tracks cursor visibility by parsing these sequences in the
write() method and respects the visibility state when rendering.

- Added cursorVisible state that defaults to true
- Parse \x1b[?25l (hide) and \x1b[?25h (show) sequences in write()
- Only render cursor when both on cursor line AND cursor is visible

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 21:23:38 +02:00
Mario Zechner
1bb15097a4 refactor: Remove unused stream-notifier system
The direct notification system wasn't being used since hasListeners()
was checking before any listeners were set up. All sessions were using
file watching anyway. Simplified the code by removing the unused
notification system and keeping only the optimized file watching.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 21:09:57 +02:00
Mario Zechner
312786230b refactor: Remove unnecessary header construction in StreamWatcher
AsciinemaWriter always writes a header, so we can trust it exists.
Removed all the default header construction logic and headerSent tracking.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 21:00:41 +02:00
Mario Zechner
d7e811412a refactor: Simplify file watching - remove unnecessary OptimizedFileWatcher
- Integrate stat checking directly into StreamWatcher
- Remove platform-specific code paths that all used fs.watch anyway
- Keep the actual optimization: checking file stats to avoid spurious events
- Simpler, cleaner code with the same benefits

The real improvements remain:
1. Direct notifications for in-process sessions
2. Stat checking to verify actual file changes
3. Only processing when file size increases

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 20:57:46 +02:00
Mario Zechner
daa1db3392 Merge branch 'websocket-stream' 2025-06-22 20:46:27 +02:00
Mario Zechner
983f6282c5 Remove latency test scripts 2025-06-22 20:45:02 +02:00
Mario Zechner
c43a549ed8 fix: Simplify notification logic - use direct or file, never both
- Check upfront if we have listeners for direct notifications
- Use EITHER direct notifications OR file watcher, not both
- This eliminates any possibility of duplicate broadcasts
- Server sessions get instant updates via direct notifications
- Forwarded sessions use optimized file watcher

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 20:41:13 +02:00
Armin Ronacher
dad9e7a248 Standardize on VibeTunnel 2025-06-22 20:38:22 +02:00
Armin Ronacher
36f47c4581 Clauded up some SVG icons 2025-06-22 20:37:49 +02:00
Mario Zechner
52feefddf2 fix: Prevent duplicate notifications and improve latency
- Only use file watcher if no direct notifications are available
- Remove unnecessary deduplication logic
- Clean up logging for direct notifications
- Wait 100ms to detect if we're getting direct notifications before
  starting file watcher (for cross-process scenarios)

This should eliminate duplicate broadcasts and improve latency for
server-created sessions while maintaining compatibility with fwd.ts

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 20:36:30 +02:00
Mario Zechner
76512c19c4 fix: Prevent double input processing in server sessions
The issue was that sendInput() was processing input twice:
1. Writing directly to PTY + asciinema for in-memory sessions
2. Then continuing to socket path which would write again

Added early return after in-memory session processing to avoid
the socket path when we already have a direct PTY reference.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 20:29:49 +02:00
Armin Ronacher
8a3807d4ce Claude fixed resizing 2025-06-22 20:24:36 +02:00
Mario Zechner
a84e43dadc fix: Prevent duplicate broadcasts in StreamWatcher
Add deduplication logic to prevent the same line from being broadcast
twice when both direct notification and file watcher fire. Uses a
simple hash and 50ms time window to detect duplicates.

This fixes the double input issue in server-created sessions.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 20:21:03 +02:00
Mario Zechner
fbc8954d39 feat: Optimize file watching for lower latency streaming
- Add platform-specific optimized file watcher
  - Linux: inotify with rapid polling after changes
  - macOS: FSEvents + periodic checks to overcome batching
  - Windows: ReadDirectoryChangesW with debouncing
- Add direct in-process notifications via StreamNotifier
  - Bypasses file watching for same-process sessions
  - Near-instant latency for server-created sessions
- Update StreamWatcher to use both mechanisms
  - Primary: Direct notifications (microsecond latency)
  - Fallback: Optimized file watching (for fwd.ts)
- Add latency and stress test scripts

This should significantly reduce streaming latency, especially
for sessions created by the server process.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 20:18:57 +02:00
Armin Ronacher
975e50c052 Claude fixed resizing 2025-06-22 20:13:02 +02:00
Mario Zechner
aa846cceea feat: Add version info to fwd.ts startup logs
- Display version number inline with session started message
- Show build date and git commit in session info
- Import version details from version.ts

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 18:50:49 +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
932beff906 Work on custom node installer 2025-06-22 16:46:08 +02:00
Armin Ronacher
f1288417b1 Added real icon to web ui 2025-06-22 16:10:27 +02:00
Armin Ronacher
b03a9d50d6 Last resize wins 2025-06-22 15:23:24 +02:00
Armin Ronacher
46805a971a Allow real terminal to resize 2025-06-22 15:07:25 +02:00
Mario Zechner
862fc86c72 fix: eliminate lag in forwarded sessions by forcing immediate disk sync
- Add fs.fsyncSync after each asciinema event write to trigger file watchers immediately
- Keep socket connections alive with setKeepAlive for better performance
- Add response flushing in SSE streams to prevent buffering
- Fix the ~100ms input lag that was affecting forwarded sessions vs server-created sessions

The lag was caused by buffered writes not immediately triggering file system watchers.
Forwarded sessions now feel as responsive as server-created sessions.

🤖 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 14:56:40 +02:00
Peter Steinberger
8e527c3c97 improve custom node docs 2025-06-22 14:46:34 +02:00
Mario Zechner
b8405b1ff5 fix: remove debug logging from cli.ts
Remove verbose module loading debug logs that were cluttering the output
when running fwd command.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 14:21:34 +02:00
Mario Zechner
4a5052f425 refactor: improve PTY manager cleanup and fwd.ts architecture
- Remove global exit handlers from PTY manager, add clean shutdown() method
- Use file watching approach for control pipes on all platforms (no FIFO)
- Simplify fwd.ts - control pipe and stdin forwarding handled by PTY manager
- Add forwardToStdout and onExit options to createSession
- Add proper TypeScript types to PtySession interface (no more "as any")
- Clean up logging throughout, keep only essential messages
- Add colorful output with chalk for session start/end messages
- Fix hanging process issue by properly unreferencing file watchers
- Update spec.md to reflect architectural changes

This makes the shutdown process predictable and fixes the hanging echo command issue.

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-22 14:16:06 +02:00
Peter Steinberger
7e69ea1409 Add comments for native version mismatch 2025-06-22 13:45:19 +02:00
Peter Steinberger
1d2d6cee3c bugfix: clean session was not working in all cases 2025-06-22 13:44:39 +02:00
Peter Steinberger
180caf7e81 Add logic to use custom node compiler 2025-06-22 11:53:15 +02:00
Peter Steinberger
dbe280a68e add custom node folder to ignore 2025-06-22 11:53:00 +02:00
Peter Steinberger
2206176429 fix: Fix Node.js test race condition in CI
Changed the test command from 'echo' to 'sh -c "echo...; sleep 2"'
to prevent the session from exiting immediately before input can be sent.
This fixes the timing issue that occurs on faster CI runners.
2025-06-22 08:13:38 +02:00
Peter Steinberger
4876b472b5 fix: Use verbose test reporter in CI for better debugging
Added test:ci script with verbose reporter to help diagnose test
failures in CI environment. Also set CI environment variable.
2025-06-22 07:38:29 +02:00
Peter Steinberger
163e1b6f03 fix: Add CI-specific build script to skip native executable build
The Node.js CI build was failing because it tried to build the native
executable which requires postject and other tools that may not be
available in all CI environments. Created a separate build:ci script
that skips the native build step for CI.
2025-06-22 07:34:59 +02:00
Peter Steinberger
8145ccf14e fix server throwing when cleaning exited 2025-06-22 07:01:34 +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
bef58a61d9 add postject 2025-06-22 01:13:23 +02:00
Peter Steinberger
367d907ef1 We should never skip this 2025-06-22 01:13:16 +02:00
Mario Zechner
18a28992df Add comprehensive frontend component documentation
- Document all frontend components with JSDoc headers describing their purpose and events
- Add @fires and @listens tags for all component events with detailed parameter descriptions
- Update spec.md with complete Component Event Architecture section
- Add shared terminal-text-formatter.ts for consistent text formatting between client/server
- Implement event-driven activity detection replacing polling-based approach
- Add content-changed event to vibe-terminal-buffer for activity monitoring
- Remove ESC prompt detection in favor of general activity detection
- Add plain text endpoint with optional style formatting (/api/sessions/:id/text?styles)

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-21 23:14:30 +02:00
Mario Zechner
908c2d0375 Fix help text flickering in session list
- Only show loading state on initial load, not on periodic refreshes
- Prevents "Loading sessions..." from briefly appearing every 3 seconds
- Help text now remains stable after first load

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-21 22:20:23 +02:00
Mario Zechner
212be407a2 Fix terminal spawn fallback for socket connection failures
- Move spawn_terminal logic after remote forwarding to properly handle remotes
- Add spawn_terminal parameter to remote forwarding requests
- Handle ECONNREFUSED when socket exists but no listener is active
- Gracefully fall back to normal PTY spawn in all failure cases

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-21 22:02:27 +02:00
Mario Zechner
f0fd625243 Update docs to reflect Node.js SEA instead of Bun
- Update spec.md build system section with Node.js SEA details
- Update README.md production build section to clarify SEA executable
- Both files now correctly reflect the transition from Bun to Node.js

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-21 21:49:12 +02:00
Mario Zechner
5ede1a50e0 Clean-up cli.ts 2025-06-21 21:29:15 +02:00
Mario Zechner
c7153769a8 Bun deleted, Nodejs is new king. Xcode not yet updated. 2025-06-21 21:21:11 +02:00
Mario Zechner
8e62137820 Node SEA build WIP 2025-06-21 20:54:57 +02:00
Peter Steinberger
e82c633a9a make file browser work without session 2025-06-21 19:06:19 +02:00
Peter Steinberger
16bc60b379 style and fix file browser 2025-06-21 18:58:42 +02:00
Peter Steinberger
d820a4b147 handle session id passing + better error messages 2025-06-21 18:55:34 +02:00
Peter Steinberger
34fc38d13f aff fs route 2025-06-21 18:08:06 +02:00
Peter Steinberger
5ee5cbb5ec Make scripts ugly but resilient 2025-06-21 18:08:00 +02:00
Peter Steinberger
4083c8132a add missing message type in frontend 2025-06-21 17:16:21 +02:00