vt
commandvt
commandvt
command or selects New Session from the UI.ServerManager
verifies that the Bun server is running and starts it if needed.POST /api/sessions
request triggers TerminalManager.createTerminal()
on the server.PtyManager.spawn()
allocates a new PTY process and stores session metadata./api/sessions/:id/ws
and begin streaming using the binary buffer protocol.BufferAggregator
forwards the input to the PTY process.vt
launches ServerManager
.BunServer
spawns the Bun-based HTTP/WebSocket server process./api/health
to verify the server is alive.ServerManager
gracefully shuts down or restarts the process.0.0.0.0
for remote access.NgrokService
or Tailscale can expose a secure public URL.DashboardKeychain
.mac/VibeTunnel/Core/Services/ServerManager.swift
Responsibilities:
@Observable
for SwiftUI integration@MainActor
ensures UI thread safetymac/VibeTunnel/Core/Services/BunServer.swift
Responsibilities:
mac/VibeTunnel/Core/Services/SessionMonitor.swift
Responsibilities:
mac/VibeTunnel/Core/Services/TerminalManager.swift
Responsibilities:
mac/VibeTunnel/Core/Services/NgrokService.swift
Responsibilities:
web/src/server/
directory
Architecture:
The server is built as a standalone Bun executable that embeds:
server.ts
- HTTP server initialization and lifecycleapp.ts
- Express application setup and middlewarefwd.ts
- Main entry point for terminal forwardingpty/pty-manager.ts
- Native PTY process managementpty/session-manager.ts
- Terminal session lifecycleservices/terminal-manager.ts
- High-level terminal operationsservices/buffer-aggregator.ts
- Binary buffer optimizationroutes/sessions.ts
- REST API endpointsweb/src/client/
directory
Core Technologies:
ios/VibeTunnel/
directory
Purpose: Native iOS companion app for mobile terminal access
VibeTunnelApp.swift
- Main app entry and lifecycleBufferWebSocketClient.swift
- WebSocket client with binary protocolTerminalView.swift
- Native terminal renderingTerminalHostingView.swift
- UIKit bridge for terminal displaySessionService.swift
- Session management API client--enable-ssh-keys
)--no-auth
)--allow-local-bypass
)--local-auth-token
web/SECURITY.md
for detailed security implicationsweb/src/server/middleware/auth.ts
web/src/server/middleware/auth.ts:24-87
web/src/server/middleware/auth.ts:25-48
web/src/server/pty/types.ts
):
vt
command is installed as a wrapper script that automatically prepends ‘fwd’ to commands when using the Bun server.
Script Location: /usr/local/bin/vt
/usr/local/bin/vibetunnel
Commands:
vibetunnel serve
- Start server (used internally)vibetunnel fwd [command]
- Forward terminal sessionvibetunnel version
- Show version information--claude
, --claude-yolo
)http://localhost:4020
(default)
Authentication: Optional HTTP Basic Auth
/api/sessions/:id/ws
Binary Buffer Protocol: Messages use custom format for efficiency
web/src/server/services/buffer-aggregator.ts
):
web/src/client/components/vibe-terminal-buffer.ts
):
ios/VibeTunnel/Services/BufferWebSocketClient.swift
):
UserDefaults.standard
Key Settings:
mac/VibeTunnel/VibeTunnel.entitlements
):
.critical
- Core functionality.networking
- Network operations.concurrency
- Async operations.security
- Security features