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
fix: update both config paths for OpenCode permission setup
yh cb13d6ef6b3dd
diff --git a/ui/src/context/ApiContext.tsx b/ui/src/context/ApiContext.tsxindex 29759d115..7daabc55f 100644--- a/ui/src/context/ApiContext.tsx+++ b/ui/src/context/ApiContext.tsx@@ -12,7 +12,7 @@ export type ApiContextType = {slackManifest: () => Promise<{ ok: boolean; manifest?: string; manifest_compact?: string; error?: string }>;doctor: () => Promise<any>;opencodeOptions: (cwd: string) => Promise<any>;- opencodeSetupPermission: () => Promise<{ ok: boolean; message: string; config_path: string }>;+ opencodeSetupPermission: () => Promise<{ ok: boolean; message: string; config_paths: string[] }>;getLogs: (lines?: number) => Promise<{ logs: LogEntry[]; total: number }>;getVersion: () => Promise<VersionInfo>;doUpgrade: () => Promise<UpgradeResult>;diff --git a/vibe/api.py b/vibe/api.pyindex 17d6b52a9..bbb2fd7ef 100644--- a/vibe/api.py+++ b/vibe/api.py@@ -435,53 +435,57 @@ def do_upgrade(auto_restart: bool = True) -> dict:def setup_opencode_permission() -> dict:- """Set OpenCode permission to 'allow' in config file.+ """Set OpenCode permission to 'allow' in config files.- Always uses ~/.opencode/opencode.json as per OpenCode documentation.+ Updates both ~/.opencode/opencode.json (OpenCode official) and+ ~/.config/opencode/opencode.json (XDG standard) to ensure compatibility.Returns:- {"ok": bool, "message": str, "config_path": str}+ {"ok": bool, "message": str, "config_paths": list[str]}"""from pathlib import Path- config_path = Path.home() / ".opencode" / "opencode.json"+ paths_to_update = [+ Path.home() / ".opencode" / "opencode.json",+ Path.home() / ".config" / "opencode" / "opencode.json",+ ]+ updated_paths = []+ errors = []- try:- config_path.parent.mkdir(parents=True, exist_ok=True)-- config = {}- if config_path.exists():- content = config_path.read_text(encoding="utf-8").strip()- if content:- config = json.loads(content)- if not isinstance(config, dict):- return {- "ok": False,- "message": "Config is not a JSON object",- "config_path": str(config_path),- }-- if config.get("permission") == "allow":- return {- "ok": True,- "message": "Permission already set",- "config_path": str(config_path),- }+ for config_path in paths_to_update:+ try:+ config_path.parent.mkdir(parents=True, exist_ok=True)++ config = {}+ if config_path.exists():+ content = config_path.read_text(encoding="utf-8").strip()+ if content:+ config = json.loads(content)+ if not isinstance(config, dict):+ errors.append(f"{config_path}: not a JSON object")+ continue++ if config.get("permission") != "allow":+ config["permission"] = "allow"+ config_path.write_text(+ json.dumps(config, indent=2) + "\n", encoding="utf-8"+ )- config["permission"] = "allow"- config_path.write_text(json.dumps(config, indent=2) + "\n", encoding="utf-8")+ updated_paths.append(str(config_path))+ except json.JSONDecodeError as e:+ errors.append(f"{config_path}: invalid JSON - {e}")+ except Exception as e:+ errors.append(f"{config_path}: {e}")- return {- "ok": True,- "message": "Permission set to 'allow'",- "config_path": str(config_path),- }- except json.JSONDecodeError as e:+ if not updated_paths:return {"ok": False,- "message": f"Invalid JSON: {e}",- "config_path": str(config_path),+ "message": f"Failed to update any config: {'; '.join(errors)}",+ "config_paths": [],}- except Exception as e:- logger.error(f"Failed to setup OpenCode permission: {e}")- return {"ok": False, "message": str(e), "config_path": str(config_path)}++ message = f"Permission set in {len(updated_paths)} config(s)"+ if errors:+ message += f" (warnings: {'; '.join(errors)})"++ return {"ok": True, "message": message, "config_paths": updated_paths}