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(ui): add directory browser for channel working directory selection
cyhhao873341db98a7
diff --git a/ui/src/components/steps/ChannelList.tsx b/ui/src/components/steps/ChannelList.tsxindex fa8da34cc..444229343 100644--- a/ui/src/components/steps/ChannelList.tsx+++ b/ui/src/components/steps/ChannelList.tsx@@ -1,9 +1,10 @@import React, { useEffect, useState } from 'react';-import { Hash, CheckSquare, Square, RefreshCw, HelpCircle, Globe } from 'lucide-react';+import { Hash, CheckSquare, Square, RefreshCw, HelpCircle, Globe, FolderOpen } from 'lucide-react';import { useTranslation } from 'react-i18next';import { useApi } from '../../context/ApiContext';import { useToast } from '../../context/ToastContext';import { Combobox } from '../ui/combobox';+import { DirectoryBrowser } from '../ui/directory-browser';import clsx from 'clsx';/** Input that only commits value on blur */@@ -65,6 +66,8 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onBconst [selectedModels, setSelectedModels] = useState<Record<string, string>>({});const [guilds, setGuilds] = useState<any[]>([]);const [selectedGuild, setSelectedGuild] = useState<string>(data.discord?.guild_allowlist?.[0] || '');+ // Directory browser state — tracks which channel's cwd picker is open+ const [browsingCwdFor, setBrowsingCwdFor] = useState<string | null>(null);useEffect(() => {if (!isPage) {@@ -240,7 +243,7 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onBuseEffect(() => {if (!channels.length) return;- const defaultCwd = config.runtime?.default_cwd || '.';+ const defaultCwd = config.runtime?.default_cwd || '~/work';const defaultBackend = config.agents?.default_backend || 'opencode';const neededOpenCodeCwds = new Set<string>();@@ -358,6 +361,7 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB}, [channels, configs]);return (+ <><div className={clsx('flex flex-col h-full', isPage ? 'max-w-5xl mx-auto' : '')}><div className="flex justify-between items-center mb-6"><div>@@ -491,13 +495,23 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB<div className="grid grid-cols-1 md:grid-cols-3 gap-3"><div className="space-y-1"><label className="text-xs font-medium text-muted uppercase">{t('channelList.workingDirectory')}</label>- <BlurInput- type="text"- placeholder={config.runtime?.default_cwd || t('channelList.useGlobalDefault')}- value={channelConfig.custom_cwd}- onCommit={(v) => updateConfig(channel.id, { custom_cwd: v })}- className="w-full bg-bg border border-border rounded px-3 py-2 text-sm focus:outline-none focus:border-accent text-text placeholder:text-muted/50 font-mono"- />+ <div className="flex gap-1.5">+ <BlurInput+ type="text"+ placeholder={config.runtime?.default_cwd || t('channelList.useGlobalDefault')}+ value={channelConfig.custom_cwd}+ onCommit={(v) => updateConfig(channel.id, { custom_cwd: v })}+ className="flex-1 bg-bg border border-border rounded px-3 py-2 text-sm focus:outline-none focus:border-accent text-text placeholder:text-muted/50 font-mono"+ />+ <button+ type="button"+ onClick={() => setBrowsingCwdFor(channel.id)}+ title={t('directoryBrowser.title')}+ className="px-2 py-2 bg-neutral-100 hover:bg-neutral-200 border border-border rounded text-muted hover:text-text transition-colors shrink-0"+ >+ <FolderOpen size={14} />+ </button>+ </div></div><div className="space-y-1"><label className="text-xs font-medium text-muted uppercase">{t('channelList.backend')}</label>@@ -789,5 +803,18 @@ export const ChannelList: React.FC<ChannelListProps> = ({ data = {}, onNext, onB</div>)}</div>++ {/* Directory browser modal */}+ {browsingCwdFor && (+ <DirectoryBrowser+ initialPath={configs[browsingCwdFor]?.custom_cwd || config.runtime?.default_cwd || '~/work'}+ onSelect={(path) => {+ updateConfig(browsingCwdFor, { custom_cwd: path });+ setBrowsingCwdFor(null);+ }}+ onClose={() => setBrowsingCwdFor(null)}+ />+ )}+ </>);};diff --git a/ui/src/components/ui/directory-browser.tsx b/ui/src/components/ui/directory-browser.tsxnew file mode 100644index 000000000..e93193f67--- /dev/null+++ b/ui/src/components/ui/directory-browser.tsx@@ -0,0 +1,156 @@+import React, { useEffect, useState, useCallback } from 'react';+import { Folder, FolderOpen, ChevronRight, ArrowUp, X, Check, RefreshCw } from 'lucide-react';+import { useTranslation } from 'react-i18next';+import { useApi } from '../../context/ApiContext';+import clsx from 'clsx';++interface DirectoryBrowserProps {+ /** Initial path to show when opening */+ initialPath?: string;+ /** Called when user confirms selection */+ onSelect: (path: string) => void;+ /** Called when user cancels / closes */+ onClose: () => void;+}++export const DirectoryBrowser: React.FC<DirectoryBrowserProps> = ({+ initialPath,+ onSelect,+ onClose,+}) => {+ const { t } = useTranslation();+ const api = useApi();++ const [currentPath, setCurrentPath] = useState('');+ const [parent, setParent] = useState<string | null>(null);+ const [dirs, setDirs] = useState<{ name: string; path: string }[]>([]);+ const [loading, setLoading] = useState(false);+ const [error, setError] = useState<string | null>(null);++ const browse = useCallback(+ async (path: string) => {+ setLoading(true);+ setError(null);+ try {+ const result = await api.browseDirectory(path);+ if (result.ok) {+ setCurrentPath(result.path ?? path);+ setParent(result.parent ?? null);+ setDirs(result.dirs ?? []);+ } else {+ setError(result.error ?? 'Unknown error');+ }+ } catch (e: any) {+ setError(e.message ?? String(e));+ } finally {+ setLoading(false);+ }+ },+ [api],+ );++ useEffect(() => {+ browse(initialPath || '~');+ }, []);++ // Build breadcrumb segments from currentPath+ const breadcrumbs = currentPath+ ? currentPath.split('/').reduce<{ label: string; path: string }[]>((acc, seg, i) => {+ if (i === 0 && seg === '') {+ acc.push({ label: '/', path: '/' });+ } else if (seg) {+ const prev = acc.length ? acc[acc.length - 1].path : '';+ const full = prev === '/' ? `/${seg}` : `${prev}/${seg}`;+ acc.push({ label: seg, path: full });+ }+ return acc;+ }, [])+ : [];++ return (+ <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/40" onClick={onClose}>+ <div+ className="bg-panel border border-border rounded-xl shadow-xl w-full max-w-lg max-h-[70vh] flex flex-col"+ onClick={(e) => e.stopPropagation()}+ >+ {/* Header */}+ <div className="flex items-center justify-between px-4 py-3 border-b border-border">+ <h3 className="font-semibold text-text text-sm">{t('directoryBrowser.title')}</h3>+ <button onClick={onClose} className="text-muted hover:text-text transition-colors">+ <X size={16} />+ </button>+ </div>++ {/* Breadcrumb */}+ <div className="px-4 py-2 border-b border-border flex items-center gap-1 text-xs overflow-x-auto min-h-[32px]">+ {breadcrumbs.map((crumb, i) => (+ <React.Fragment key={crumb.path}>+ {i > 0 && <ChevronRight size={10} className="text-muted shrink-0" />}+ <button+ onClick={() => browse(crumb.path)}+ className={clsx(+ 'shrink-0 px-1 py-0.5 rounded hover:bg-neutral-100 transition-colors font-mono',+ i === breadcrumbs.length - 1 ? 'text-accent font-medium' : 'text-muted',+ )}+ >+ {crumb.label}+ </button>+ </React.Fragment>+ ))}+ {loading && <RefreshCw size={12} className="animate-spin text-muted ml-auto shrink-0" />}+ </div>++ {/* Directory list */}+ <div className="flex-1 overflow-y-auto px-2 py-1 min-h-[200px]">+ {error && (+ <div className="px-3 py-2 text-sm text-danger">{error}</div>+ )}++ {/* Parent directory */}+ {parent && (+ <button+ onClick={() => browse(parent)}+ className="flex items-center gap-2 w-full px-3 py-1.5 rounded-lg hover:bg-neutral-100 transition-colors text-sm text-muted"+ >+ <ArrowUp size={14} />+ <span>..</span>+ </button>+ )}++ {/* Sub-directories */}+ {dirs.map((dir) => (+ <button+ key={dir.path}+ onClick={() => browse(dir.path)}+ className="flex items-center gap-2 w-full px-3 py-1.5 rounded-lg hover:bg-neutral-100 transition-colors text-sm text-text group"+ >+ <Folder size={14} className="text-amber-500 group-hover:hidden shrink-0" />+ <FolderOpen size={14} className="text-amber-500 hidden group-hover:block shrink-0" />+ <span className="truncate text-left">{dir.name}</span>+ </button>+ ))}++ {!loading && !error && dirs.length === 0 && (+ <div className="px-3 py-4 text-sm text-muted text-center italic">+ {t('directoryBrowser.empty')}+ </div>+ )}+ </div>++ {/* Footer — current path + confirm */}+ <div className="px-4 py-3 border-t border-border flex items-center gap-2">+ <code className="flex-1 text-xs font-mono text-text bg-bg border border-border rounded px-2 py-1.5 truncate">+ {currentPath}+ </code>+ <button+ onClick={() => onSelect(currentPath)}+ className="flex items-center gap-1.5 px-4 py-1.5 bg-accent hover:bg-accent/90 text-white rounded-lg text-sm font-medium transition-colors shrink-0"+ >+ <Check size={14} />+ {t('directoryBrowser.select')}+ </button>+ </div>+ </div>+ </div>+ );+};diff --git a/ui/src/context/ApiContext.tsx b/ui/src/context/ApiContext.tsxindex 5a6c284a3..84babf0c4 100644--- a/ui/src/context/ApiContext.tsx+++ b/ui/src/context/ApiContext.tsx@@ -27,6 +27,7 @@ export type ApiContextType = {getLogs: (lines?: number) => Promise<{ logs: LogEntry[]; total: number }>;getVersion: () => Promise<VersionInfo>;doUpgrade: () => Promise<UpgradeResult>;+ browseDirectory: (path: string) => Promise<{ ok: boolean; path?: string; parent?: string | null; dirs?: { name: string; path: string }[]; error?: string }>;};export type LogEntry = {@@ -141,6 +142,7 @@ export const ApiProvider: React.FC<{ children: React.ReactNode }> = ({ childrengetLogs: (lines = 500) => postJson('/logs', { lines }),getVersion: () => getJson('/version'),doUpgrade: () => postJson('/upgrade', {}),+ browseDirectory: (path) => postJson('/browse', { path }),};return <ApiContext.Provider value={value}>{children}</ApiContext.Provider>;diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.jsonindex a21bb1977..9495986f7 100644--- a/ui/src/i18n/en.json+++ b/ui/src/i18n/en.json@@ -409,5 +409,10 @@"switchLanguage": "Language","en": "English","zh": "Chinese"+ },+ "directoryBrowser": {+ "title": "Browse Directory",+ "select": "Select",+ "empty": "No subdirectories"}}diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.jsonindex 7f9278c09..b59bf94b0 100644--- a/ui/src/i18n/zh.json+++ b/ui/src/i18n/zh.json@@ -409,5 +409,10 @@"switchLanguage": "语言","en": "English","zh": "中文"+ },+ "directoryBrowser": {+ "title": "浏览目录",+ "select": "选择",+ "empty": "没有子目录"}}diff --git a/vibe/api.py b/vibe/api.pyindex 1ff5204dd..ed404f148 100644--- a/vibe/api.py+++ b/vibe/api.py@@ -25,6 +25,42 @@ logger = logging.getLogger(__name__)_OPENCODE_OPTIONS_CACHE: dict[str, dict] = {}_OPENCODE_OPTIONS_TTL_SECONDS = 30.0+# Directories to hide in the browse_directory listing+_HIDDEN_DIR_PREFIXES = (".", "__")+++def browse_directory(path: str) -> dict:+ """List sub-directories of *path* for the directory browser UI.++ Returns ``{"ok": True, "path": <abs>, "parent": <abs|None>, "dirs": [...]}``+ where each entry in *dirs* is ``{"name": ..., "path": ...}``.+ """+ try:+ expanded = os.path.expanduser(path or "~")+ abs_path = os.path.abspath(expanded)++ if not os.path.isdir(abs_path):+ return {"ok": False, "error": f"Not a directory: {abs_path}"}++ parent = os.path.dirname(abs_path) if abs_path != "/" else None++ entries: list[dict[str, str]] = []+ try:+ names = sorted(os.listdir(abs_path), key=str.lower)+ except PermissionError:+ return {"ok": True, "path": abs_path, "parent": parent, "dirs": []}++ for name in names:+ if any(name.startswith(p) for p in _HIDDEN_DIR_PREFIXES):+ continue+ full = os.path.join(abs_path, name)+ if os.path.isdir(full):+ entries.append({"name": name, "path": full})++ return {"ok": True, "path": abs_path, "parent": parent, "dirs": entries}+ except Exception as exc:+ return {"ok": False, "error": str(exc)}+def load_config() -> V2Config:return V2Config.load()diff --git a/vibe/cli.py b/vibe/cli.pyindex c881fcea9..d4ad3a227 100644--- a/vibe/cli.py+++ b/vibe/cli.py@@ -83,7 +83,7 @@ def _default_config():mode="self_host",version="v2",slack=SlackConfig(bot_token="", app_token=""),- runtime=RuntimeConfig(default_cwd=str(Path.cwd())),+ runtime=RuntimeConfig(default_cwd=str(Path.home() / "work")),agents=AgentsConfig(default_backend="opencode",opencode=OpenCodeConfig(enabled=True, cli_path="opencode"),@@ -157,7 +157,7 @@ def _render_status():def _doctor():"""Run diagnostic checks and return results in UI-compatible format.-+Returns:{"groups": [{"name": "...", "items": [{"status": "pass|warn|fail", "message": "...", "action": "..."}]}],@@ -167,99 +167,121 @@ def _doctor():"""groups = []summary = {"pass": 0, "warn": 0, "fail": 0}-+# Configuration Groupconfig_items = []config_path = paths.get_config_path()-+if config_path.exists():- config_items.append({- "status": "pass",- "message": f"Configuration file found: {config_path}",- })+ config_items.append(+ {+ "status": "pass",+ "message": f"Configuration file found: {config_path}",+ }+ )summary["pass"] += 1else:- config_items.append({- "status": "fail",- "message": "Configuration file not found",- "action": "Run 'vibe' to create initial configuration",- })+ config_items.append(+ {+ "status": "fail",+ "message": "Configuration file not found",+ "action": "Run 'vibe' to create initial configuration",+ }+ )summary["fail"] += 1-+config = Nonetry:config = V2Config.load(config_path)- config_items.append({- "status": "pass",- "message": "Configuration loaded successfully",- })+ config_items.append(+ {+ "status": "pass",+ "message": "Configuration loaded successfully",+ }+ )summary["pass"] += 1except Exception as exc:- config_items.append({- "status": "fail",- "message": f"Failed to load configuration: {exc}",- "action": "Check config.json syntax or delete and reconfigure",- })+ config_items.append(+ {+ "status": "fail",+ "message": f"Failed to load configuration: {exc}",+ "action": "Check config.json syntax or delete and reconfigure",+ }+ )summary["fail"] += 1-+groups.append({"name": "Configuration", "items": config_items})-+# Slack Groupslack_items = []if config:try:config.slack.validate()- slack_items.append({- "status": "pass",- "message": "Slack token format is valid",- })+ slack_items.append(+ {+ "status": "pass",+ "message": "Slack token format is valid",+ }+ )summary["pass"] += 1-+# Check if tokens are actually setif config.slack.bot_token:- slack_items.append({- "status": "pass",- "message": "Bot token is configured",- })+ slack_items.append(+ {+ "status": "pass",+ "message": "Bot token is configured",+ }+ )summary["pass"] += 1else:- slack_items.append({- "status": "warn",- "message": "Bot token is not configured",- "action": "Add your Slack bot token in the setup wizard",- })+ slack_items.append(+ {+ "status": "warn",+ "message": "Bot token is not configured",+ "action": "Add your Slack bot token in the setup wizard",+ }+ )summary["warn"] += 1-+if config.slack.app_token:- slack_items.append({- "status": "pass",- "message": "App token is configured (Socket Mode)",- })+ slack_items.append(+ {+ "status": "pass",+ "message": "App token is configured (Socket Mode)",+ }+ )summary["pass"] += 1else:- slack_items.append({- "status": "warn",- "message": "App token is not configured",- "action": "Add your Slack app token for Socket Mode",- })+ slack_items.append(+ {+ "status": "warn",+ "message": "App token is not configured",+ "action": "Add your Slack app token for Socket Mode",+ }+ )summary["warn"] += 1-+except Exception as exc:- slack_items.append({- "status": "fail",- "message": f"Slack token validation failed: {exc}",- "action": "Check your Slack tokens in the setup wizard",- })+ slack_items.append(+ {+ "status": "fail",+ "message": f"Slack token validation failed: {exc}",+ "action": "Check your Slack tokens in the setup wizard",+ }+ )summary["fail"] += 1else:- slack_items.append({- "status": "fail",- "message": "Cannot check Slack: configuration not loaded",- })+ slack_items.append(+ {+ "status": "fail",+ "message": "Cannot check Slack: configuration not loaded",+ }+ )summary["fail"] += 1-+groups.append({"name": "Slack", "items": slack_items})-+# Agent Backends Groupagent_items = []if config:@@ -267,154 +289,188 @@ def _doctor():if config.agents.opencode.enabled:cli_path = config.agents.opencode.cli_pathimport shutil+found_path = shutil.which(cli_path) if cli_path else Noneif found_path:- agent_items.append({- "status": "pass",- "message": f"OpenCode CLI found: {found_path}",- })+ agent_items.append(+ {+ "status": "pass",+ "message": f"OpenCode CLI found: {found_path}",+ }+ )summary["pass"] += 1else:- agent_items.append({- "status": "warn",- "message": f"OpenCode CLI not found: {cli_path}",- "action": "Install OpenCode or update CLI path",- })+ agent_items.append(+ {+ "status": "warn",+ "message": f"OpenCode CLI not found: {cli_path}",+ "action": "Install OpenCode or update CLI path",+ }+ )summary["warn"] += 1else:- agent_items.append({- "status": "pass",- "message": "OpenCode: disabled",- })+ agent_items.append(+ {+ "status": "pass",+ "message": "OpenCode: disabled",+ }+ )summary["pass"] += 1-+# Claudeif config.agents.claude.enabled:cli_path = config.agents.claude.cli_pathimport shutil+# Check preferred location firstpreferred = Path.home() / ".claude" / "local" / "claude"if preferred.exists() and os.access(preferred, os.X_OK):found_path = str(preferred)else:found_path = shutil.which(cli_path) if cli_path else None-+if found_path:- agent_items.append({- "status": "pass",- "message": f"Claude CLI found: {found_path}",- })+ agent_items.append(+ {+ "status": "pass",+ "message": f"Claude CLI found: {found_path}",+ }+ )summary["pass"] += 1else:- agent_items.append({- "status": "warn",- "message": f"Claude CLI not found: {cli_path}",- "action": "Install Claude Code or update CLI path",- })+ agent_items.append(+ {+ "status": "warn",+ "message": f"Claude CLI not found: {cli_path}",+ "action": "Install Claude Code or update CLI path",+ }+ )summary["warn"] += 1else:- agent_items.append({- "status": "pass",- "message": "Claude: disabled",- })+ agent_items.append(+ {+ "status": "pass",+ "message": "Claude: disabled",+ }+ )summary["pass"] += 1-+# Codexif config.agents.codex.enabled:cli_path = config.agents.codex.cli_pathimport shutil+found_path = shutil.which(cli_path) if cli_path else Noneif found_path:- agent_items.append({- "status": "pass",- "message": f"Codex CLI found: {found_path}",- })+ agent_items.append(+ {+ "status": "pass",+ "message": f"Codex CLI found: {found_path}",+ }+ )summary["pass"] += 1else:- agent_items.append({- "status": "warn",- "message": f"Codex CLI not found: {cli_path}",- "action": "Install Codex or update CLI path",- })+ agent_items.append(+ {+ "status": "warn",+ "message": f"Codex CLI not found: {cli_path}",+ "action": "Install Codex or update CLI path",+ }+ )summary["warn"] += 1else:- agent_items.append({- "status": "pass",- "message": "Codex: disabled",- })+ agent_items.append(+ {+ "status": "pass",+ "message": "Codex: disabled",+ }+ )summary["pass"] += 1-+# Default backend checkdefault_backend = config.agents.default_backend- agent_items.append({- "status": "pass",- "message": f"Default backend: {default_backend}",- })+ agent_items.append(+ {+ "status": "pass",+ "message": f"Default backend: {default_backend}",+ }+ )summary["pass"] += 1else:- agent_items.append({- "status": "fail",- "message": "Cannot check agents: configuration not loaded",- })+ agent_items.append(+ {+ "status": "fail",+ "message": "Cannot check agents: configuration not loaded",+ }+ )summary["fail"] += 1-+groups.append({"name": "Agent Backends", "items": agent_items})-+# Runtime Groupruntime_items = []if config:cwd = config.runtime.default_cwdif cwd and os.path.isdir(cwd):- runtime_items.append({- "status": "pass",- "message": f"Working directory: {cwd}",- })+ runtime_items.append(+ {+ "status": "pass",+ "message": f"Working directory: {cwd}",+ }+ )summary["pass"] += 1else:- runtime_items.append({- "status": "warn",- "message": f"Working directory does not exist: {cwd}",- "action": "Update default_cwd in settings",- })+ runtime_items.append(+ {+ "status": "warn",+ "message": f"Working directory does not exist: {cwd}",+ "action": "Update default_cwd in settings",+ }+ )summary["warn"] += 1-- runtime_items.append({- "status": "pass",- "message": f"Log level: {config.runtime.log_level}",- })++ runtime_items.append(+ {+ "status": "pass",+ "message": f"Log level: {config.runtime.log_level}",+ }+ )summary["pass"] += 1-+# Check log filelog_path = paths.get_logs_dir() / "vibe_remote.log"if log_path.exists():- runtime_items.append({- "status": "pass",- "message": f"Log file: {log_path}",- })+ runtime_items.append(+ {+ "status": "pass",+ "message": f"Log file: {log_path}",+ }+ )summary["pass"] += 1else:- runtime_items.append({- "status": "pass",- "message": "Log file will be created on first run",- })+ runtime_items.append(+ {+ "status": "pass",+ "message": "Log file will be created on first run",+ }+ )summary["pass"] += 1-+groups.append({"name": "Runtime", "items": runtime_items})-+# Calculate overall statusok = summary["fail"] == 0-+result = {"groups": groups,"summary": summary,"ok": ok,}-+_write_json(paths.get_runtime_doctor_path(), result)return result-def cmd_vibe():paths.ensure_data_dirs()config = _ensure_config()@@ -456,27 +512,27 @@ def cmd_vibe():return 0-def _stop_opencode_server():"""Terminate the OpenCode server if running."""pid_file = paths.get_logs_dir() / "opencode_server.json"if not pid_file.exists():return False-+try:info = json.loads(pid_file.read_text(encoding="utf-8"))except Exception as e:logger.debug("Failed to parse OpenCode PID file: %s", e)return False-+pid = info.get("pid") if isinstance(info, dict) else Noneif not isinstance(pid, int) or not _pid_alive(pid):pid_file.unlink(missing_ok=True)return False-+# Verify it's actually an opencode serve processtry:import subprocess+result = subprocess.run(["ps", "-p", str(pid), "-o", "command="],capture_output=True,@@ -488,7 +544,7 @@ def _stop_opencode_server():except Exception as e:logger.debug("Failed to verify OpenCode process (pid=%s): %s", pid, e)return False-+try:os.kill(pid, signal.SIGTERM)pid_file.unlink(missing_ok=True)@@ -501,11 +557,11 @@ def _stop_opencode_server():def cmd_stop():runtime.stop_service()runtime.stop_ui()-+# Also terminate OpenCode server on full stopif _stop_opencode_server():print("OpenCode server stopped")-+_write_status("stopped")return 0@@ -517,11 +573,11 @@ def cmd_status():def cmd_doctor():result = _doctor()-+# Terminal-friendly outputprint("\n Vibe Remote Diagnostics")print(" " + "=" * 40)-+for group in result.get("groups", []):print(f"\n {group['name']}")print(" " + "-" * 30)@@ -533,18 +589,20 @@ def cmd_doctor():icon = "\033[33m!\033[0m" # Yellow warningelse:icon = "\033[31m✗\033[0m" # Red X-+print(f" {icon} {item['message']}")if item.get("action"):print(f" → {item['action']}")-+summary = result.get("summary", {})print("\n " + "-" * 30)- print(f" \033[32m{summary.get('pass', 0)} passed\033[0m "- f"\033[33m{summary.get('warn', 0)} warnings\033[0m "- f"\033[31m{summary.get('fail', 0)} failed\033[0m")+ print(+ f" \033[32m{summary.get('pass', 0)} passed\033[0m "+ f"\033[33m{summary.get('warn', 0)} warnings\033[0m "+ f"\033[31m{summary.get('fail', 0)} failed\033[0m"+ )print()-+return 0 if result["ok"] else 1@@ -556,13 +614,13 @@ def cmd_version():def get_latest_version() -> dict:"""Fetch latest version info from PyPI.-+Returns:{"current": str, "latest": str, "has_update": bool, "error": str|None}"""current = __version__result = {"current": current, "latest": None, "has_update": False, "error": None}-+try:url = "https://pypi.org/pypi/vibe-remote/json"req = urllib.request.Request(url, headers={"User-Agent": "vibe-remote"})@@ -570,7 +628,7 @@ def get_latest_version() -> dict:data = json.loads(resp.read().decode("utf-8"))latest = data.get("info", {}).get("version", "")result["latest"] = latest-+# Simple version comparison (works for semver)if latest and latest != current:# Compare version tuples@@ -583,7 +641,7 @@ def get_latest_version() -> dict:result["has_update"] = latest != currentexcept Exception as e:result["error"] = str(e)-+return result@@ -591,19 +649,19 @@ def cmd_check_update():"""Check for available updates."""print(f"Current version: {__version__}")print("Checking for updates...")-+info = get_latest_version()-+if info["error"]:print(f"\033[33mFailed to check for updates: {info['error']}\033[0m")return 1-+if info["has_update"]:print(f"\033[32mNew version available: {info['latest']}\033[0m")print(f"\nRun '\033[1mvibe upgrade\033[0m' to update.")else:print("\033[32mYou are using the latest version.\033[0m")-+return 0@@ -611,9 +669,9 @@ def cmd_upgrade():"""Upgrade vibe-remote to the latest version."""print(f"Current version: {__version__}")print("Checking for updates...")-+info = get_latest_version()-+if info["error"]:print(f"\033[33mFailed to check for updates: {info['error']}\033[0m")print("Attempting upgrade anyway...")@@ -622,16 +680,16 @@ def cmd_upgrade():return 0else:print(f"New version available: {info['latest']}")-+print("\nUpgrading...")-+# Determine upgrade method based on how vibe was installed# Check if running from uv tool environmentexe_path = sys.executableis_uv_tool = ".local/share/uv/tools/" in exe_path or "/uv/tools/" in exe_path-+uv_path = shutil.which("uv")-+if is_uv_tool and uv_path:# Installed via uv tool, upgrade with uvcmd = [uv_path, "tool", "install", "vibe-remote", "--upgrade"]@@ -640,7 +698,7 @@ def cmd_upgrade():# Installed via pip or other method, use current Python's pipcmd = [sys.executable, "-m", "pip", "install", "--upgrade", "vibe-remote"]print(f"Using pip: {' '.join(cmd)}")-+try:result = subprocess.run(cmd, capture_output=True, text=True)if result.returncode == 0:diff --git a/vibe/runtime.py b/vibe/runtime.pyindex 9b2de001d..6806ed3e9 100644--- a/vibe/runtime.py+++ b/vibe/runtime.py@@ -86,7 +86,7 @@ def default_config():mode="self_host",version="v2",slack=SlackConfig(bot_token="", app_token=""),- runtime=RuntimeConfig(default_cwd=str(Path.cwd())),+ runtime=RuntimeConfig(default_cwd=str(Path.home() / "work")),agents=AgentsConfig(default_backend="opencode",opencode=OpenCodeConfig(enabled=True, cli_path="opencode"),diff --git a/vibe/ui_server.py b/vibe/ui_server.pyindex 0a6b6c4b1..297489b9d 100644--- a/vibe/ui_server.py+++ b/vibe/ui_server.py@@ -472,6 +472,15 @@ def agent_install(name):return jsonify(result)[email protected]("/browse", methods=["POST"])+def browse_directory():+ """List sub-directories of a given path for the directory picker UI."""+ from vibe import api++ payload = request.json or {}+ return jsonify(api.browse_directory(payload.get("path", "~")))++# =============================================================================# Static Files (SPA)# =============================================================================