Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
feat(cli): add SSH tunnel hint and improve remote server UX
cyhhaoa367c7672251
diff --git a/README.md b/README.mdindex 289035303..a49be4e2d 100644--- a/README.md+++ b/README.md@@ -191,18 +191,18 @@ vibe doctor # Diagnose issuesYou need at least one coding agent installed:<details>-<summary><b>Claude Code</b> (Recommended)</summary>+<summary><b>OpenCode</b> (Recommended)</summary>```bash-npm install -g @anthropic-ai/claude-code+curl -fsSL https://opencode.ai/install | bash```</details><details>-<summary><b>OpenCode</b></summary>+<summary><b>Claude Code</b></summary>```bash-curl -fsSL https://opencode.ai/install | bash+npm install -g @anthropic-ai/claude-code```</details>@@ -235,10 +235,10 @@ vibe stop && uv tool uninstall vibe-remote && rm -rf ~/.vibe_remote## Roadmap-- [ ] Discord & Teams support+- [ ] SaaS Mode+- [ ] Vibe Remote Coding Agent (one agent to rule them all)- [ ] File attachments in Slack- [ ] Multi-workspace-- [ ] Cloud relay mode (optional)---@@ -247,6 +247,16 @@ vibe stop && uv tool uninstall vibe-remote && rm -rf ~/.vibe_remote- **[CLI Reference](docs/CLI.md)** — Command-line usage and service lifecycle- **[Slack Setup Guide](docs/SLACK_SETUP.md)** — Detailed setup with screenshots+## Remote Server Tip (SSH)++If you run Vibe Remote on a remote server, keep the Web UI bound to `127.0.0.1:5123` and access it via SSH port forwarding:++```bash+ssh -NL 5123:localhost:5123 user@server-ip+```++See: **[CLI Reference](docs/CLI.md)** (search for "Remote Web UI Access")+---<div align="center">diff --git a/README_ZH.md b/README_ZH.mdindex 6f048f080..f07e595a1 100644--- a/README_ZH.md+++ b/README_ZH.md@@ -191,18 +191,18 @@ vibe doctor # 诊断问题你需要至少安装一个编码 Agent:<details>-<summary><b>Claude Code</b>(推荐)</summary>+<summary><b>OpenCode</b>(推荐)</summary>```bash-npm install -g @anthropic-ai/claude-code+curl -fsSL https://opencode.ai/install | bash```</details><details>-<summary><b>OpenCode</b></summary>+<summary><b>Claude Code</b></summary>```bash-curl -fsSL https://opencode.ai/install | bash+npm install -g @anthropic-ai/claude-code```</details>@@ -235,10 +235,10 @@ vibe stop && uv tool uninstall vibe-remote && rm -rf ~/.vibe_remote## 路线图-- [ ] Discord & Teams 支持+- [ ] SaaS Mode+- [ ] Vibe Remote Coding Agent(一个 Agent 统领全局)- [ ] Slack 文件附件- [ ] 多工作区-- [ ] 云中继模式(可选)---@@ -247,6 +247,16 @@ vibe stop && uv tool uninstall vibe-remote && rm -rf ~/.vibe_remote- **[CLI 参考手册](docs/CLI_ZH.md)** — 命令行使用和服务生命周期- **[Slack 配置指南](docs/SLACK_SETUP_ZH.md)** — 详细配置和截图+## 远端服务器提示(SSH)++如果你把 Vibe Remote 部署在远端服务器上,请保持 Web UI 只监听在 `127.0.0.1:5123`,并通过 SSH 端口转发在本机访问:++```bash+ssh -NL 5123:localhost:5123 user@server-ip+```++详见:**[CLI 参考手册](docs/CLI_ZH.md)**(搜索“远端服务器访问 Web UI”)+---<div align="center">diff --git a/config/v2_config.py b/config/v2_config.pyindex d99c6ff8e..ca06c143b 100644--- a/config/v2_config.py+++ b/config/v2_config.py@@ -87,7 +87,7 @@ class UiConfig:class UpdateConfig:"""Configuration for automatic update checking and installation."""auto_update: bool = True # Auto-install updates when idle- check_interval_minutes: int = 10 # How often to check for updates (0 = disable)+ check_interval_minutes: int = 60 # How often to check for updates (0 = disable)idle_minutes: int = 30 # Minutes of inactivity before auto-updatenotify_slack: bool = True # Send Slack notification when update is availablediff --git a/core/controller.py b/core/controller.pyindex 562f2e991..5416c0a4a 100644--- a/core/controller.py+++ b/core/controller.py@@ -54,8 +54,10 @@ class Controller:# Background task for cleanupself.cleanup_task: Optional[asyncio.Task] = None- # Initialize update checker- self.update_checker = UpdateChecker(self, config.update)+ # Initialize update checker (use default config if not present)+ from config.v2_config import UpdateConfig+ update_config = getattr(config, 'update', None) or UpdateConfig()+ self.update_checker = UpdateChecker(self, update_config)# Restore session mappings on startup (after handlers are initialized)self.session_handler.restore_session_mappings()diff --git a/core/update_checker.py b/core/update_checker.pyindex 7f1b63a0c..9f3838a93 100644--- a/core/update_checker.py+++ b/core/update_checker.py@@ -10,9 +10,6 @@ This module provides:import asyncioimport jsonimport logging-import shutil-import subprocess-import sysimport timeimport urllib.requestfrom dataclasses import dataclass, field@@ -90,6 +87,11 @@ class UpdateChecker:logger.info("Update checker disabled (check_interval_minutes=0)")return+ # Initialize last_activity_at if not set (for idle detection baseline)+ if not self.state.last_activity_at:+ self.state.last_activity_at = time.time()+ self.state.save()+self._running = Trueself._check_task = asyncio.create_task(self._check_loop())logger.info(@@ -109,6 +111,17 @@ class UpdateChecker:self.state.last_activity_at = time.time()self.state.save()+ def _reload_config(self) -> None:+ """Reload UpdateConfig from config file (for hot-reload support)."""+ try:+ config_path = paths.get_config_path()+ if config_path.exists():+ data = json.loads(config_path.read_text(encoding="utf-8"))+ update_data = data.get("update") or {}+ self.config = UpdateConfig(**update_data)+ except Exception as e:+ logger.warning(f"Failed to reload update config: {e}")+async def _check_loop(self) -> None:"""Main loop for periodic update checking."""# Initial delay to let the service fully start@@ -127,6 +140,9 @@ class UpdateChecker:async def _do_check(self) -> None:"""Perform a single update check."""+ # Reload config for hot-reload support (e.g., user toggled auto_update in UI)+ self._reload_config()+version_info = self._get_version_info()self.state.last_check_at = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())@@ -191,12 +207,16 @@ class UpdateChecker:return False# Check for recent activity- if self.state.last_activity_at:- idle_seconds = time.time() - self.state.last_activity_at- idle_minutes = idle_seconds / 60- if idle_minutes < self.config.idle_minutes:- logger.debug(f"Not idle: last activity {idle_minutes:.1f} minutes ago")- return False+ # If no activity recorded yet, consider it NOT idle (just started)+ if not self.state.last_activity_at:+ logger.debug("Not idle: no activity recorded yet (service just started)")+ return False++ idle_seconds = time.time() - self.state.last_activity_at+ idle_minutes = idle_seconds / 60+ if idle_minutes < self.config.idle_minutes:+ logger.debug(f"Not idle: last activity {idle_minutes:.1f} minutes ago")+ return Falsereturn True@@ -292,51 +312,41 @@ class UpdateChecker:except Exception as e:logger.error(f"Failed to send update notification: {e}")- async def _perform_update(self, target_version: str) -> None:+ async def _perform_update(+ self, target_version: str, channel_id: Optional[str] = None, message_ts: Optional[str] = None+ ) -> None:"""Perform the actual update and restart."""logger.info(f"Starting auto-update to version {target_version}")# Write a marker file so we can send confirmation after restart- self._write_update_marker(target_version)+ self._write_update_marker(target_version, channel_id=channel_id, message_ts=message_ts)- # Perform the upgrade- exe_path = sys.executable- is_uv_tool = ".local/share/uv/tools/" in exe_path or "/uv/tools/" in exe_path- uv_path = shutil.which("uv")+ # Use the same upgrade logic as the API/CLI+ from vibe.api import do_upgrade+ result = do_upgrade(auto_restart=True)- if is_uv_tool and uv_path:- cmd = [uv_path, "tool", "upgrade", "vibe-remote"]+ if result["ok"]:+ logger.info(f"Upgrade successful: {result['message']}")else:- cmd = [sys.executable, "-m", "pip", "install", "--upgrade", "vibe-remote"]-- try:- result = subprocess.run(cmd, capture_output=True, text=True, timeout=120)- if result.returncode == 0:- logger.info("Upgrade successful, restarting...")- # Schedule restart- vibe_path = shutil.which("vibe")- if vibe_path:- subprocess.Popen(- f"sleep 2 && {vibe_path}",- shell=True,- stdout=subprocess.DEVNULL,- stderr=subprocess.DEVNULL,- start_new_session=True,- )- else:- logger.error(f"Upgrade failed: {result.stderr}")- self._remove_update_marker()- except Exception as e:- logger.error(f"Upgrade failed: {e}")+ logger.error(f"Upgrade failed: {result['message']}")+ if result.get("output"):+ logger.error(f"Output: {result['output']}")self._remove_update_marker()- def _write_update_marker(self, version: str) -> None:+ def _write_update_marker(+ self, version: str, channel_id: Optional[str] = None, message_ts: Optional[str] = None+ ) -> None:"""Write a marker file to trigger post-update notification."""marker_path = paths.get_state_dir() / "pending_update_notification.json"- marker_path.write_text(json.dumps({+ data = {"version": version,"updated_at": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),- }), encoding="utf-8")+ }+ # Store message coordinates for updating the original message after restart+ if channel_id and message_ts:+ data["channel_id"] = channel_id+ data["message_ts"] = message_ts+ marker_path.write_text(json.dumps(data), encoding="utf-8")def _remove_update_marker(self) -> None:"""Remove the update marker file."""@@ -351,15 +361,41 @@ class UpdateChecker:try:data = json.loads(marker_path.read_text(encoding="utf-8"))- version = data.get("version")+ channel_id = data.get("channel_id")+ message_ts = data.get("message_ts")+ # Use the target version from marker (more reliable than __version__ in edge cases)+ target_version = data.get("version", "unknown")owner_id = await self._get_workspace_owner_id()- if owner_id:- from vibe import __version__- im_client = self.controller.im_client+ im_client = self.controller.im_client++ success_text = f":white_check_mark: Vibe Remote has been updated to `{target_version}`"+ success_blocks = [+ {+ "type": "section",+ "text": {+ "type": "mrkdwn",+ "text": f":white_check_mark: *Vibe Remote Updated Successfully*\n\n"+ f"Now running version `{target_version}`"+ }+ }+ ]++ # If we have original message coordinates, update that message+ if channel_id and message_ts:+ await im_client.web_client.chat_update(+ channel=channel_id,+ ts=message_ts,+ text=success_text,+ blocks=success_blocks+ )+ logger.info(f"Updated original message with post-update notification")+ elif owner_id:+ # Fallback: send a new messageawait im_client.web_client.chat_postMessage(channel=owner_id,- text=f":white_check_mark: Vibe Remote has been updated to `{__version__}`"+ text=success_text,+ blocks=success_blocks)logger.info(f"Sent post-update notification to {owner_id}")except Exception as e:@@ -397,7 +433,10 @@ async def handle_update_button_click(controller: "Controller", payload: Dict[strif hasattr(controller, 'update_checker'):version_info = controller.update_checker._get_version_info()if version_info.get("has_update"):- await controller.update_checker._perform_update(version_info["latest"])+ # Pass message coordinates so we can update it after restart+ await controller.update_checker._perform_update(+ version_info["latest"], channel_id=channel_id, message_ts=message_ts+ )else:await im_client.web_client.chat_update(channel=channel_id,diff --git a/docs/CLI.md b/docs/CLI.mdindex 60d5e0acf..74929159d 100644--- a/docs/CLI.md+++ b/docs/CLI.md@@ -10,6 +10,56 @@ vibe stop # Stop all services## Commands+## Remote Web UI Access (SSH Port Forwarding)++By default, the Web UI binds to `127.0.0.1:5123` on the machine where Vibe Remote is running.++If you deploy Vibe Remote on a remote server, **do not expose the UI port to the public internet**.+Instead, use SSH local port forwarding so the UI is only reachable from your own computer.++### 1) Start Vibe Remote on the server++SSH into your server and start Vibe Remote:++```bash+vibe+```++The server-side UI is still only reachable on the server itself:++- `http://127.0.0.1:5123`++### 2) Forward the UI port to your local machine++On your **local machine** (your laptop/desktop), run:++```bash+ssh -NL 5123:localhost:5123 user@server-ip+```++Then open:++- `http://127.0.0.1:5123`++### Tips++- If `5123` is already in use on your local machine, pick another local port:++```bash+ssh -NL 15123:localhost:5123 user@server-ip+```++and open `http://127.0.0.1:15123`.++- If your SSH server runs on a non-standard port:++```bash+ssh -p 2222 -NL 5123:localhost:5123 user@server-ip+```++- `-N` means "do not run a remote command"; the SSH session is used only for tunneling.++### `vibe`Start or restart Vibe Remote. Opens the web UI in your browser.diff --git a/docs/CLI_ZH.md b/docs/CLI_ZH.mdindex f726a67ff..af10d5161 100644--- a/docs/CLI_ZH.md+++ b/docs/CLI_ZH.md@@ -10,6 +10,56 @@ vibe stop # 停止所有服务## 命令详解+## 远端服务器访问 Web UI(SSH 端口转发)++默认情况下,Web UI 只监听在运行 Vibe Remote 的那台机器的 `127.0.0.1:5123`。++如果你把 Vibe Remote 部署在远端服务器上,**不建议把 UI 端口直接暴露到公网**。+推荐使用 SSH 本地端口转发,把远端的 UI 端口安全地映射到你自己的电脑上访问。++### 1)在服务器上启动 Vibe Remote++先 SSH 登录到服务器并启动:++```bash+vibe+```++此时 UI 仍然只能在服务器本机访问:++- `http://127.0.0.1:5123`++### 2)把 UI 端口转发到本机++在你自己的电脑(本地)执行:++```bash+ssh -NL 5123:localhost:5123 user@server-ip+```++然后在本机浏览器打开:++- `http://127.0.0.1:5123`++### 小贴士++- 如果你本机的 `5123` 端口已被占用,可以换一个本地端口:++```bash+ssh -NL 15123:localhost:5123 user@server-ip+```++然后打开 `http://127.0.0.1:15123`。++- 如果服务器 SSH 端口不是 22:++```bash+ssh -p 2222 -NL 5123:localhost:5123 user@server-ip+```++- `-N` 表示不在远端执行命令,这条 SSH 连接只用于建立隧道。++### `vibe`启动或重启 Vibe Remote。会在浏览器中打开 Web UI。diff --git a/ui/src/components/Wizard.tsx b/ui/src/components/Wizard.tsxindex 27201d378..53fd45551 100644--- a/ui/src/components/Wizard.tsx+++ b/ui/src/components/Wizard.tsx@@ -15,39 +15,56 @@ const buildConfigPayload = (data: any) => ({mode: data.mode || 'self_host',version: 'v2',slack: {+ // Preserve all existing slack fields+ ...data.slack,+ // Override only the fields that setup modifiesbot_token: data.slack?.bot_token || '',app_token: data.slack?.app_token || '',require_mention: data.slack?.require_mention || false,},runtime: {- default_cwd: data.default_cwd || '.',- log_level: 'INFO',+ // Preserve existing runtime config+ ...data.runtime,+ default_cwd: data.default_cwd || data.runtime?.default_cwd || '.',},agents: {default_backend: data.default_backend || 'opencode',opencode: {+ // Preserve existing opencode config+ ...data.agents?.opencode,enabled: data.agents?.opencode?.enabled ?? true,cli_path: data.agents?.opencode?.cli_path || 'opencode',- default_agent: data.opencode_default_agent || null,- default_model: data.opencode_default_model || null,- default_reasoning_effort: data.opencode_default_reasoning_effort || null,+ default_agent: data.opencode_default_agent ?? data.agents?.opencode?.default_agent ?? null,+ default_model: data.opencode_default_model ?? data.agents?.opencode?.default_model ?? null,+ default_reasoning_effort: data.opencode_default_reasoning_effort ?? data.agents?.opencode?.default_reasoning_effort ?? null,},claude: {+ // Preserve existing claude config+ ...data.agents?.claude,enabled: data.agents?.claude?.enabled ?? true,cli_path: data.agents?.claude?.cli_path || 'claude',- default_model: data.claude_default_model || null,+ default_model: data.claude_default_model ?? data.agents?.claude?.default_model ?? null,},codex: {+ // Preserve existing codex config+ ...data.agents?.codex,enabled: data.agents?.codex?.enabled ?? false,cli_path: data.agents?.codex?.cli_path || 'codex',- default_model: data.codex_default_model || null,+ default_model: data.codex_default_model ?? data.agents?.codex?.default_model ?? null,},},+ // Preserve gateway config entirely+ gateway: data.gateway,ui: {+ // Preserve existing ui config+ ...data.ui,setup_host: data.ui?.setup_host || '127.0.0.1',setup_port: data.ui?.setup_port || 5123,- open_browser: true,},+ // Preserve existing update config entirely+ update: data.update,+ // Preserve ack_mode+ ack_mode: data.ack_mode,});const steps = [diff --git a/ui/src/components/steps/Summary.tsx b/ui/src/components/steps/Summary.tsxindex 6e2a3d4b8..74ab088d0 100644--- a/ui/src/components/steps/Summary.tsx+++ b/ui/src/components/steps/Summary.tsx@@ -194,45 +194,59 @@ const buildConfigPayload = (data: any) => {mode: data.mode || 'self_host',version: 'v2',slack: {+ // Preserve all existing slack fields+ ...data.slack,+ // Override only the fields that setup modifiesbot_token: data.slack?.bot_token || '',app_token: data.slack?.app_token || '',require_mention: data.slack?.require_mention || false,},runtime: {- default_cwd: data.default_cwd || '_tmp',- log_level: 'INFO',+ // Preserve existing runtime config+ ...data.runtime,+ default_cwd: data.default_cwd || data.runtime?.default_cwd || '_tmp',},agents: {default_backend: data.default_backend || 'opencode',opencode: {+ // Preserve existing opencode config+ ...agents.opencode,enabled: agents.opencode?.enabled ?? true,cli_path: agents.opencode?.cli_path || 'opencode',- default_agent: data.opencode_default_agent || null,- default_model: data.opencode_default_model || null,- default_reasoning_effort: data.opencode_default_reasoning_effort || null,+ default_agent: data.opencode_default_agent ?? agents.opencode?.default_agent ?? null,+ default_model: data.opencode_default_model ?? agents.opencode?.default_model ?? null,+ default_reasoning_effort: data.opencode_default_reasoning_effort ?? agents.opencode?.default_reasoning_effort ?? null,},claude: {+ // Preserve existing claude config+ ...agents.claude,enabled: agents.claude?.enabled ?? true,cli_path: agents.claude?.cli_path || 'claude',- default_model: data.claude_default_model || null,+ default_model: data.claude_default_model ?? agents.claude?.default_model ?? null,},codex: {+ // Preserve existing codex config+ ...agents.codex,enabled: agents.codex?.enabled ?? false,cli_path: agents.codex?.cli_path || 'codex',- default_model: data.codex_default_model || null,+ default_model: data.codex_default_model ?? agents.codex?.default_model ?? null,},},+ // Preserve gateway config entirely+ gateway: data.gateway,ui: {+ // Preserve existing ui config+ ...data.ui,setup_host: data.ui?.setup_host || '127.0.0.1',setup_port: data.ui?.setup_port || 5123,- open_browser: true,- },- update: {- auto_update: data.update?.auto_update ?? true,- check_interval_minutes: data.update?.check_interval_minutes ?? 10,- idle_minutes: data.update?.idle_minutes ?? 30,- notify_slack: data.update?.notify_slack ?? true,},+ // Preserve existing update config, only override auto_update from UI toggle+ update: data.update ? {+ ...data.update,+ auto_update: data.update.auto_update,+ } : undefined,+ // Preserve ack_mode+ ack_mode: data.ack_mode,};};diff --git a/vibe/api.py b/vibe/api.pyindex fd7450e24..459a2c454 100644--- a/vibe/api.py+++ b/vibe/api.py@@ -368,7 +368,7 @@ def do_upgrade(auto_restart: bool = True) -> dict:if is_uv_tool and uv_path:# Installed via uv tool, upgrade with uv- cmd = [uv_path, "tool", "upgrade", "vibe-remote"]+ cmd = [uv_path, "tool", "install", "vibe-remote", "--upgrade"]else:# Installed via pip or other method, use current Python's pipcmd = [sys.executable, "-m", "pip", "install", "--upgrade", "vibe-remote"]diff --git a/vibe/cli.py b/vibe/cli.pyindex 83dcdff4c..0361a40d2 100644--- a/vibe/cli.py+++ b/vibe/cli.py@@ -40,12 +40,40 @@ def _pid_alive(pid):return False-def _open_browser(url):+def _in_ssh_session() -> bool:+ """Best-effort detection for SSH sessions."""+ return any(os.environ.get(key) for key in ("SSH_CONNECTION", "SSH_CLIENT", "SSH_TTY"))+++def _open_browser(url: str) -> bool:+ """Open a URL in the default browser (best effort).++ Returns True if a launch attempt was made successfully.+ """try:- subprocess.Popen(["open", url])+ import webbrowser++ if webbrowser.open(url):+ return Trueexcept Exception:pass+ # Fallbacks for environments where webbrowser isn't configured.+ try:+ if sys.platform == "darwin":+ subprocess.Popen(["open", url])+ return True+ if os.name == "nt":+ subprocess.Popen(["cmd", "/c", "start", "", url])+ return True+ if sys.platform.startswith("linux"):+ subprocess.Popen(["xdg-open", url])+ return True+ except Exception:+ pass++ return False+def _default_config():return V2Config(@@ -402,8 +430,25 @@ def cmd_vibe():runtime.write_status("running", "pid={}".format(service_pid), service_pid, ui_pid)ui_url = "http://{}:{}".format(config.ui.setup_host, config.ui.setup_port)- if config.ui.open_browser:- _open_browser(ui_url)++ # Always print Web UI access instructions.+ print("Web UI:")+ print(f" {ui_url}")+ print("")+ port = int(config.ui.setup_port)+ print("If you are running Vibe Remote on a remote server, use SSH port forwarding on your local machine:")+ print(f" ssh -NL {port}:localhost:{port} user@server-ip")+ print("")+ print("Then open in your local browser:")+ print(f" http://127.0.0.1:{port}")+ print("")++ # If running over SSH, avoid trying to open a browser on the server.+ if config.ui.open_browser and not _in_ssh_session():+ opened = _open_browser(ui_url)+ if not opened:+ print(f"(Tip) Could not auto-open a browser. Open this URL manually: {ui_url}")+ print("")return 0@@ -583,7 +628,7 @@ def cmd_upgrade():if is_uv_tool and uv_path:# Installed via uv tool, upgrade with uv- cmd = [uv_path, "tool", "upgrade", "vibe-remote"]+ cmd = [uv_path, "tool", "install", "vibe-remote", "--upgrade"]print(f"Using uv: {' '.join(cmd)}")else:# Installed via pip or other method, use current Python's pip