Commit graph

62 commits

Author SHA1 Message Date
Peter Steinberger
e43ef5ad49 implement binary protocol, reduce buffers, fixes an echo race 2025-06-20 20:49:02 +02:00
Peter Steinberger
acadb6d6d8 kill echo, less chaos 2025-06-20 20:16:59 +02:00
Peter Steinberger
8bea2c87f6 better session management 2025-06-20 20:16:46 +02:00
Peter Steinberger
35bc91e0de execute commands through zsh 2025-06-20 20:16:30 +02:00
Peter Steinberger
8b64f2088d For spawned sessions, don't start the PTY immediately 2025-06-20 20:06:25 +02:00
Peter Steinberger
f55e5b731d raise cli version 2025-06-20 20:06:07 +02:00
Peter Steinberger
d0b08622fc remove build step for vt, now a symlink 2025-06-20 20:04:28 +02:00
Peter Steinberger
12ce2cd834 smaller buffer and flush 2025-06-20 20:02:52 +02:00
Peter Steinberger
37b36ab801 fixes a null pointer crash 2025-06-20 20:02:30 +02:00
Peter Steinberger
307e7338a8 linting 2025-06-20 20:02:21 +02:00
Peter Steinberger
a76fbe10e8 go binary now has integrated vt mode (symlinked) 2025-06-20 20:01:51 +02:00
Peter Steinberger
22eb5a2e3f Work on new session logic 2025-06-20 19:22:02 +02:00
Peter Steinberger
35c2908a57 Improve error logging 2025-06-20 19:03:40 +02:00
Peter Steinberger
e7636dd039 revert: remove direct buffer integration feature 2025-06-20 18:54:06 +02:00
Peter Steinberger
bf31a85198 Execute through shell for propper command expansion 2025-06-20 18:32:15 +02:00
Peter Steinberger
b2cbb02bfd add direct buffer feature 2025-06-20 18:31:46 +02:00
Peter Steinberger
9bfa72a668 add filesystem support for file previews 2025-06-20 18:31:28 +02:00
Peter Steinberger
4e55c98f10 add monitor 2025-06-20 17:45:30 +02:00
Peter Steinberger
cfc0c9d505 better feature party with node 2025-06-20 16:35:28 +02:00
Peter Steinberger
6e2cd2abcd fix: Run gofmt on terminal files to fix formatting 2025-06-20 16:29:56 +02:00
Peter Steinberger
709330ccde fix: Add platform-specific terminal constants for cross-platform build
- Create terminal_darwin.go with macOS-specific TIOCGETA/TIOCSETA
- Create terminal_linux.go with Linux-specific TCGETS/TCSETS
- Create terminal_other.go with fallback for other Unix systems
- Update terminal.go to use platform-specific constants
2025-06-20 16:26:41 +02:00
Peter Steinberger
20395d6e09 fix: Fix CI test failures
- Fix hanging TestNewStdinWatcher by not calling Stop() without Start()
- Fix TestSession_Signal and TestSession_KillWithSignal by adding PID values
- Fix isProcessRunning to use syscall.Signal(0) instead of os.Signal(nil)
- Update websocket test to expect new 'Unknown WebSocket endpoint' error message
- Add timeout handling to websocket integration test
2025-06-20 16:21:27 +02:00
Peter Steinberger
08bdc5ecb4 broader support for SetDoNotAllowColumnSet + tests 2025-06-20 16:01:38 +02:00
Peter Steinberger
70f5bf2c18 linting and test fixes 2025-06-20 15:43:06 +02:00
Peter Steinberger
b751dabd36 fix: Run gofmt to fix CI formatting errors
Applied gofmt to fix formatting issues in:
- pkg/api/websocket.go: Remove trailing whitespace
- pkg/session/pty.go: Remove trailing whitespace
2025-06-20 15:23:27 +02:00
Peter Steinberger
bec49c86e1 feat(cli): Improve CLI installation to copy both vt and vibetunnel
- Update CLIInstaller to install both vt script and vibetunnel binary
- Remove duplicate replacement dialog for better UX
- Check versions of both files and use lowest version for updates
- Prioritize finding vibetunnel in same directory as vt script
- Bump vt version to 1.0.6
- Add comprehensive CLI versioning documentation
2025-06-20 15:22:37 +02:00
Peter Steinberger
f96b63c77d Port node implementation details to go 2025-06-20 15:11:26 +02:00
Peter Steinberger
014bbb9e1e Prioritize same path first 2025-06-20 14:24:16 +02:00
Peter Steinberger
d0e92ea932 Tweaks from the rust implementation 2025-06-20 14:19:56 +02:00
Peter Steinberger
f4a21d8459 Ensure CLI installer also installs go binary 2025-06-20 14:11:41 +02:00
Peter Steinberger
eced88b829 remove problematic code for terminal resize? 2025-06-20 13:57:16 +02:00
Peter Steinberger
0b240c3ce9 up version 2025-06-20 13:57:01 +02:00
Peter Steinberger
04438cace2 Add vt help menu 2025-06-20 13:56:53 +02:00
Peter Steinberger
d87f1b6e10 fix: Add vt script to git and remove from .gitignore
The vt script was previously gitignored which caused build failures on fresh checkouts.
This script is required by the Xcode build process during the "Copy VT Script" phase.
2025-06-20 13:50:35 +02:00
Helmut Januschka
afee29f2e3
fix: add missing newlines to platform-specific select files (#36)
- Add proper newlines at end of select_darwin.go and select_linux.go
- Resolves gofmt formatting issues in CI
- Ensures all Go files follow standard formatting conventions
2025-06-20 12:56:14 +02:00
Peter Steinberger
26413645b3 Suppress GNU folding constant warning 2025-06-20 12:54:51 +02:00
Helmut Januschka
766147073b
fix: update Go CI workflow and fix formatting issues (#35)
* fix: update Go CI workflow and fix formatting issues

- Update Go version from 1.21.x to 1.24.x to match go.mod requirements
- Fix Go module cache path to use linux/go.sum instead of **/go.sum
- Run gofmt on all Go files to fix formatting issues
- Fix benchmark files formatting
- Fix linux/pkg/api/server.go formatting

This resolves the GitHub Actions CI failures related to:
- Missing go.sum file (wrong cache path)
- Go version mismatch
- Code formatting violations

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

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

* fix: add platform-specific syscall.Select wrappers for Linux/Darwin compatibility

- Create select_linux.go: handles syscall.Select returning (n int, err error)
- Create select_darwin.go: handles syscall.Select returning (err error)
- Update select.go to use platform-agnostic selectCall function
- Resolves typecheck errors while maintaining compatibility on both platforms

Tested on both macOS and Linux targets successfully.

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-06-20 12:53:31 +02:00
Helmut Januschka
f758426ff4
fix: resolve golangci-lint issues and format Go code (#34)
- Run go fmt on all Go files (10 files formatted)
- Fix 50+ errcheck issues by adding proper error handling
- Fix 3 staticcheck issues (empty branches, error string capitalization)
- Remove 2 unused struct fields
- Install and configure golangci-lint v2.1.6 for Go 1.24 compatibility
- All linting now passes with 0 issues

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

Co-authored-by: Claude <noreply@anthropic.com>
2025-06-20 12:43:59 +02:00
Helmut Januschka
70edaaddd5
feat: add cross-platform process checking with POSIX-first approach (#33)
**Platform-Optimized Strategy:**
- **POSIX Systems** (Linux, macOS, FreeBSD): Use efficient kill(pid, 0)
- **Windows Only**: Use gopsutil.PidExists() when kill() unavailable

**Implementation:**
- Primary: kill(pid, 0) on all POSIX platforms (most efficient)
- Fallback: gopsutil only on Windows (where kill() doesn't exist)
- No unnecessary overhead - each platform uses optimal method

**Benefits:**
- Maximum Performance: POSIX systems use native kill(pid, 0)
- Windows Support: gopsutil provides Windows compatibility
- Minimal Dependencies: gopsutil only loaded when needed
- Platform Optimal: Each OS uses its most efficient method

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

Co-authored-by: Claude <noreply@anthropic.com>
2025-06-20 11:52:31 +02:00
Helmut Januschka
a66620be52
fix: Go server CPU optimization & resize control flag (#32)
* fix: optimize Go server CPU usage from 500%+ to efficient levels

Major performance improvements to resolve excessive CPU consumption:

**Critical Fixes:**
- Remove WebSocket busy loop that caused continuous CPU spinning
- Fix microsecond-level polling (100μs → 10ms) reducing 100x operations
- Replace ps subprocess calls with efficient kill(pid,0) syscalls
- Increase timer intervals (1s → 30s) for session status checks

**Optimizations:**
- Control FIFO polling: 100ms → 1s intervals
- Select timeout: 100ms → 1s to reduce unnecessary wakeups
- Smart status caching: skip checks for already-exited sessions
- Remove unused imports (os/exec, strconv)

**Impact:**
- Eliminates tight loops causing 10,000+ operations per second
- Reduces subprocess overhead from frequent ps command executions
- Changes from polling-based to efficient event-driven architecture
- Expected CPU usage reduction from 500%+ to levels comparable with Node.js version

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

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

* fix: prevent WebSocket channel close panic with sync.Once

- Add sync.Once to prevent double-closing of done channel
- Update handleTextMessage signature to accept close function
- Use closeOnceFunc for safe channel closure across goroutines

Fixes panic: 'close of closed channel' in WebSocket handler

* feat: add --do-not-allow-column-set flag to disable resizing for spawned sessions

**New Flag:**
- `--do-not-allow-column-set` (default: true) - Disables terminal resizing for spawned shells
- Only affects sessions created with `spawn_terminal=true`
- Detached sessions (command-line, API without spawn) always allow resizing

**Implementation:**
- Add `IsSpawned` field to session.Config and session.Info structs
- Track whether session was spawned in terminal vs detached
- Server checks flag + spawn status before allowing resize operations
- Returns descriptive error for blocked resize attempts

**Behavior:**
- Spawned sessions: Resize blocked when flag enabled (default)
- Detached sessions: Always allow resizing regardless of flag
- Existing sessions preserve their resize capabilities

**API Response for blocked resize:**
```json
{
  "success": false,
  "message": "Resizing is disabled for spawned sessions",
  "error": "resize_disabled_for_spawned_sessions"
}
```

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

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

* feat: extend --do-not-allow-column-set flag to block ALL session resizing

**Breaking Change:** Flag now affects both spawned AND detached sessions

**Changes:**
- Remove `sess.IsSpawned()` check in resize handler
- Block resizing for ALL sessions when flag is enabled (default: true)
- Update flag description: "Disable terminal resizing for all sessions (spawned and detached)"
- Update error message: "Terminal resizing is disabled by server configuration"
- Update error code: "resize_disabled_by_server"

**New Behavior:**
- `--do-not-allow-column-set=true` (default): NO resizing for any session type
- `--do-not-allow-column-set=false`: Allow resizing for all session types
- Applies uniformly to both spawned terminal windows and detached CLI sessions

**API Response for blocked resize:**
```json
{
  "success": false,
  "message": "Terminal resizing is disabled by server configuration",
  "error": "resize_disabled_by_server"
}
```

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

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-06-20 11:37:54 +02:00
Helmut Januschka
9792908fe1
Add terminal max width control and fix WebSocket panic (#29)
* feat: add terminal max width option

- Add terminal preferences manager for persistent settings storage
- Add maxCols property to terminal component with width constraint logic
- Add UI toggle button (∞/80) in session header for easy width control
- Default behavior unchanged: unlimited width (takes full container)
- Optional 80-column max width limit when enabled
- Preferences saved to localStorage and restored on page load
- Real-time updates without page refresh

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

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

* feat: enhance terminal width selector with common presets and custom input

- Add common terminal width presets: ∞, 80, 100, 120, 132, 160
- Add custom width input field (20-500 columns)
- Replace simple toggle with dropdown selector UI
- Include helpful descriptions for each preset
- Support keyboard shortcuts (Enter to submit, Escape to cancel)
- Add click-outside-to-close functionality
- Maintain all existing preferences persistence
- Show current width in button label and tooltip

Common widths:
- 80: Classic terminal
- 100: Modern standard
- 120: Wide terminal
- 132: Mainframe width
- 160: Ultra-wide
- Custom: User-defined (20-500)

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

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

* fix: prevent WebSocket send on closed channel panic

Added safeSend helper function with panic recovery to handle race conditions
when multiple goroutines access WebSocket channels. Replaces unsafe channel
sends with graceful error handling.

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

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

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-06-20 09:21:20 +02:00
Helmut Januschka
c6b000a421 docs: add --no-spawn flag documentation
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-20 08:27:19 +02:00
Helmut Januschka
c40608a586 add --no-spawn flag to disable terminal spawning
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-06-20 08:26:13 +02:00
Peter Steinberger
4bbdaa963c add session validation and retry 2025-06-20 07:39:30 +02:00
Peter Steinberger
aa60d9ef7d Validate that essential session files exist 2025-06-20 07:39:04 +02:00
Peter Steinberger
f40c4bc16f move closer to rust server format 2025-06-20 07:17:15 +02:00
Peter Steinberger
bb23cbcc32 feat(ios): Make 'claude' the default command in session creation
- Add 'claude' as the first quick start command
- Set 'claude' as the default command instead of 'zsh'
- Add sparkle icon for Claude command
- Remove 'irb' to make room for Claude in the grid
2025-06-20 05:45:48 +02:00
Peter Steinberger
ed14aee481 fix(ios): Update Connect button to use dark background with accent border
- Change from bright accent fill to dark terminal background
- Add accent color border that gets thicker when active
- Use accent color for text instead of terminal foreground
- Better visual consistency with the dark terminal aesthetic
2025-06-20 05:45:48 +02:00
Peter Steinberger
58fdc049ba copy more rust behavior, fix vt forwarder format 2025-06-20 05:30:13 +02:00
Peter Steinberger
ec5402b86e add connection timeout 2025-06-20 04:08:02 +02:00