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
test(opencode): harden JSONC config coverage
cyh688a6594f599
diff --git a/tests/test_opencode_server.py b/tests/test_opencode_server.pyindex 2ceb5d92c..c727e6b13 100644--- a/tests/test_opencode_server.py+++ b/tests/test_opencode_server.py@@ -8,16 +8,29 @@ from unittest.mock import patchsys.path.insert(0, str(Path(__file__).resolve().parents[1]))-aiohttp_stub = types.ModuleType("aiohttp")-aiohttp_stub.ClientSession = object-aiohttp_stub.ClientTimeout = object-sys.modules.setdefault("aiohttp", aiohttp_stub)-MODULE_PATH = Path(__file__).resolve().parents[1] / "modules" / "agents" / "opencode" / "server.py"-SPEC = importlib.util.spec_from_file_location("opencode_server_for_test", MODULE_PATH)-assert SPEC and SPEC.loader-SERVER_MODULE = importlib.util.module_from_spec(SPEC)-SPEC.loader.exec_module(SERVER_MODULE)+++def _load_server_module():+ aiohttp_stub = types.ModuleType("aiohttp")+ aiohttp_stub.ClientSession = object+ aiohttp_stub.ClientTimeout = object+ previous_aiohttp = sys.modules.get("aiohttp")+ sys.modules["aiohttp"] = aiohttp_stub+ try:+ spec = importlib.util.spec_from_file_location("opencode_server_for_test", MODULE_PATH)+ assert spec and spec.loader+ module = importlib.util.module_from_spec(spec)+ spec.loader.exec_module(module)+ return module+ finally:+ if previous_aiohttp is None:+ sys.modules.pop("aiohttp", None)+ else:+ sys.modules["aiohttp"] = previous_aiohttp+++SERVER_MODULE = _load_server_module()OpenCodeServerManager = SERVER_MODULE.OpenCodeServerManagerdiff --git a/tests/test_ui_api.py b/tests/test_ui_api.pyindex eaf152338..c69425720 100644--- a/tests/test_ui_api.py+++ b/tests/test_ui_api.py@@ -1,5 +1,7 @@import json+import pytest+from vibe import apifrom vibe.opencode_config import parse_jsonc_object@@ -235,6 +237,30 @@ def test_setup_opencode_permission_accepts_jsonc_config(monkeypatch, tmp_path):}+def test_setup_opencode_permission_preserves_existing_permission_node(monkeypatch, tmp_path):+ config_path = tmp_path / ".config" / "opencode" / "opencode.json"+ config_path.parent.mkdir(parents=True, exist_ok=True)+ original = json.dumps(+ {+ "model": "openai/gpt-5",+ "permission": "allow",+ },+ indent=2,+ ) + "\n"+ config_path.write_text(original, encoding="utf-8")++ monkeypatch.setattr(api.Path, "home", lambda: tmp_path)++ result = api.setup_opencode_permission()++ assert result == {+ "ok": True,+ "message": "Permission already set",+ "config_path": str(config_path),+ }+ assert config_path.read_text(encoding="utf-8") == original++def test_setup_opencode_permission_does_not_overwrite_invalid_existing_config(monkeypatch, tmp_path):config_path = tmp_path / ".config" / "opencode" / "opencode.json"config_path.parent.mkdir(parents=True, exist_ok=True)@@ -338,3 +364,15 @@ def test_parse_jsonc_object_accepts_inline_block_comments_before_values():}},}+++def test_parse_jsonc_object_rejects_invalid_jsonc():+ with pytest.raises(json.JSONDecodeError):+ parse_jsonc_object(+ """{+ "model": "openai/gpt-5",+ "agent": {+ "build":+ }+}"""+ )