Skip to content

armgit / avibe

Public Imported from GitHub
0

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.

refactor(routes): migrate all legacy non-/api/* routes to /api/*

cyhbc94fc677076
diff --git a/tests/e2e/test_api.py b/tests/e2e/test_api.py
index fc8d209d4..5025adea9 100644
--- a/tests/e2e/test_api.py
+++ b/tests/e2e/test_api.py
@@ -25,7 +25,7 @@ class TestConfigAPI:
def test_post_config_creates(self, api_url):
"""POST /config with valid payload should save and return config."""
- status, data = _client(api_url).post_json("/config", _VALID_CONFIG)
+ status, data = _client(api_url).post_json("/api/config", _VALID_CONFIG)
assert status == 200
assert data["mode"] == "self_host"
assert data["runtime"]["default_cwd"] == "/tmp/test"
@@ -33,8 +33,8 @@ class TestConfigAPI:
def test_post_then_get_config(self, api_url):
"""GET /config should return config after it's been created via POST."""
client = _client(api_url)
- client.post_json("/config", _VALID_CONFIG)
- status, data = client.get_json("/config")
+ client.post_json("/api/config", _VALID_CONFIG)
+ status, data = client.get_json("/api/config")
assert status == 200
assert "mode" in data
assert "version" in data
@@ -42,7 +42,7 @@ class TestConfigAPI:
def test_post_config_updates_cwd(self, api_url):
"""POST /config should update specific fields."""
payload = {**_VALID_CONFIG, "runtime": {"default_cwd": "/tmp/e2e_updated"}}
- status, data = _client(api_url).post_json("/config", payload)
+ status, data = _client(api_url).post_json("/api/config", payload)
assert status == 200
assert data["runtime"]["default_cwd"] == "/tmp/e2e_updated"
@@ -67,7 +67,7 @@ class TestDoctorAPI:
"""Doctor diagnostic endpoint."""
def test_doctor_post(self, api_url):
- status, data = _client(api_url).post_json("/doctor")
+ status, data = _client(api_url).post_json("/api/doctor")
assert status == 200
assert "groups" in data
assert "summary" in data
@@ -77,9 +77,9 @@ class TestDoctorAPI:
"""GET /doctor should return cached results after POST /doctor."""
# First run doctor
client = _client(api_url)
- client.post_json("/doctor")
+ client.post_json("/api/doctor")
# Then fetch cached result
- status, data = client.get_json("/doctor")
+ status, data = client.get_json("/api/doctor")
assert status == 200
# Should have groups from the last run
assert "groups" in data
@@ -89,7 +89,7 @@ class TestSlackManifest:
"""Slack manifest endpoint."""
def test_get_manifest(self, api_url):
- status, data = _client(api_url).get_json("/slack/manifest")
+ status, data = _client(api_url).get_json("/api/slack/manifest")
assert status == 200
# Manifest is returned wrapped: {"manifest": "...", "ok": True}
assert data.get("ok") is True
@@ -100,7 +100,7 @@ class TestBrowseAPI:
"""Directory browsing endpoint."""
def test_browse_root(self, api_url):
- status, data = _client(api_url).post_json("/browse", {"path": "/"})
+ status, data = _client(api_url).post_json("/api/browse", {"path": "/"})
assert status == 200
# Should return directory listing info
assert "path" in data or "entries" in data or "dirs" in data
@@ -111,6 +111,6 @@ class TestCLIDetect:
def test_detect_python(self, api_url):
"""Python should be detectable inside the container."""
- status, data = _client(api_url).get_json("/cli/detect?binary=python3")
+ status, data = _client(api_url).get_json("/api/cli/detect?binary=python3")
assert status == 200
assert "found" in data or "path" in data
diff --git a/tests/e2e/test_settings.py b/tests/e2e/test_settings.py
index 480705d6d..be625ad3f 100644
--- a/tests/e2e/test_settings.py
+++ b/tests/e2e/test_settings.py
@@ -12,7 +12,7 @@ class TestSettingsAPI:
def test_get_settings_returns_json(self, api_url):
"""GET /settings should return current settings."""
- status, data = _client(api_url).get_json("/settings")
+ status, data = _client(api_url).get_json("/api/settings")
assert status == 200
assert isinstance(data, dict)
@@ -28,11 +28,11 @@ class TestSettingsAPI:
}
}
}
- status, data = client.post_json("/settings", payload)
+ status, data = client.post_json("/api/settings", payload)
assert status == 200
# Verify the channel persisted
- status, data = client.get_json("/settings")
+ status, data = client.get_json("/api/settings")
assert status == 200
channels = data.get("channels", {})
assert "C_TEST_E2E" in channels
@@ -44,7 +44,7 @@ class TestLogsAPI:
def test_logs_returns_structure(self, api_url):
"""POST /logs should return log lines and total count."""
- status, data = _client(api_url).post_json("/logs", {"lines": 10})
+ status, data = _client(api_url).post_json("/api/logs", {"lines": 10})
assert status == 200
assert "source" in data
assert "logs" in data
diff --git a/tests/e2e/test_users_and_bind.py b/tests/e2e/test_users_and_bind.py
index f23ab120a..65452691f 100644
--- a/tests/e2e/test_users_and_bind.py
+++ b/tests/e2e/test_users_and_bind.py
@@ -178,25 +178,25 @@ class TestAgentModelsAPI:
def test_claude_agents_endpoint_exists(self, api_url):
"""GET /claude/agents should return JSON (ok or error)."""
- status, data = _client(api_url).get_json("/claude/agents")
+ status, data = _client(api_url).get_json("/api/claude/agents")
assert status == 200
# May be {"ok": true, "agents": [...]} or {"ok": false, "error": "..."}
assert isinstance(data, dict)
def test_claude_models_endpoint_exists(self, api_url):
"""GET /claude/models should return JSON."""
- status, data = _client(api_url).get_json("/claude/models")
+ status, data = _client(api_url).get_json("/api/claude/models")
assert status == 200
assert isinstance(data, dict)
def test_codex_models_endpoint_exists(self, api_url):
"""GET /codex/models should return JSON."""
- status, data = _client(api_url).get_json("/codex/models")
+ status, data = _client(api_url).get_json("/api/codex/models")
assert status == 200
assert isinstance(data, dict)
def test_codex_agents_endpoint_exists(self, api_url):
"""GET /codex/agents should return JSON."""
- status, data = _client(api_url).get_json("/codex/agents")
+ status, data = _client(api_url).get_json("/api/codex/agents")
assert status == 200
assert isinstance(data, dict)
diff --git a/tests/test_im_base_auth.py b/tests/test_im_base_auth.py
index b252abf27..f528342fc 100644
--- a/tests/test_im_base_auth.py
+++ b/tests/test_im_base_auth.py
@@ -69,7 +69,7 @@ class _SettingsManager:
def test_extract_command_action():
- assert BaseIMClient.extract_command_action("/settings") == "settings"
+ assert BaseIMClient.extract_command_action("/api/settings") == "settings"
assert BaseIMClient.extract_command_action("/setcwd /tmp") == "set_cwd"
assert BaseIMClient.extract_command_action("/set_cwd /tmp") == "set_cwd"
assert BaseIMClient.extract_command_action("bind code") == ""
@@ -79,7 +79,7 @@ def test_extract_command_action():
def test_parse_text_command():
- assert BaseIMClient.parse_text_command("/settings") == ("settings", "")
+ assert BaseIMClient.parse_text_command("/api/settings") == ("settings", "")
assert BaseIMClient.parse_text_command("/setcwd /tmp") == ("set_cwd", "/tmp")
assert BaseIMClient.parse_text_command("/set_cwd /tmp") == ("set_cwd", "/tmp")
assert BaseIMClient.parse_text_command("bind code") is None
diff --git a/tests/test_ui_remote_access_auth.py b/tests/test_ui_remote_access_auth.py
index cc3acc7c8..3783f90cc 100644
--- a/tests/test_ui_remote_access_auth.py
+++ b/tests/test_ui_remote_access_auth.py
@@ -140,7 +140,7 @@ def test_remote_config_get_without_session_returns_login_required(monkeypatch, t
_save_config(tmp_path)
response = app.test_client().get(
- "/config",
+ "/api/config",
base_url="https://alex.avibe.bot",
environ_base=_remote_peer(),
follow_redirects=False,
@@ -526,7 +526,7 @@ def test_remote_host_does_not_renew_cookie_on_rejected_post(monkeypatch, tmp_pat
# will reject this with 403 inside the same request lifecycle that already
# set g.remote_session_renew in enforce_remote_access_cookie.
response = client.post(
- "/config",
+ "/api/config",
json={"remote_access": {"vibe_cloud": {"enabled": False}}},
base_url="https://alex.avibe.bot",
)
@@ -744,7 +744,7 @@ def test_config_post_rotates_session_secret_when_remote_access_is_disabled(monke
monkeypatch.setattr(remote_access, "reconcile", lambda: {"ok": True, "stopped": True})
response = client.post(
- "/config",
+ "/api/config",
json={"remote_access": {"vibe_cloud": {"enabled": False}}},
headers=csrf_headers(client, "http://127.0.0.1:5123"),
base_url="http://127.0.0.1:5123",
@@ -766,7 +766,7 @@ def test_config_post_skips_reconcile_when_remote_access_is_unchanged(monkeypatch
monkeypatch.setattr(remote_access, "reconcile", lambda: reconcile_calls.append(True) or {"ok": True})
response = client.post(
- "/config",
+ "/api/config",
json=api.config_to_payload(config),
headers=csrf_headers(client, "http://127.0.0.1:5123"),
base_url="http://127.0.0.1:5123",
@@ -785,7 +785,7 @@ def test_config_post_returns_saved_config_when_remote_reconcile_fails(monkeypatc
monkeypatch.setattr(remote_access, "reconcile", lambda: {"ok": False, "error": "cloudflared_stop_failed"})
response = client.post(
- "/config",
+ "/api/config",
json={"remote_access": {"vibe_cloud": {"enabled": False}}},
headers=csrf_headers(client, "http://127.0.0.1:5123"),
base_url="http://127.0.0.1:5123",
@@ -813,7 +813,7 @@ def test_config_post_reconciles_after_releasing_config_lock(monkeypatch, tmp_pat
monkeypatch.setattr(remote_access, "reconcile", reconcile)
response = client.post(
- "/config",
+ "/api/config",
json={"remote_access": {"vibe_cloud": {"enabled": False}}},
headers=csrf_headers(client, "http://127.0.0.1:5123"),
base_url="http://127.0.0.1:5123",
@@ -836,7 +836,7 @@ def test_config_post_reconciles_from_fresh_config(monkeypatch, tmp_path):
monkeypatch.setattr(remote_access, "reconcile", reconcile)
response = client.post(
- "/config",
+ "/api/config",
json={"remote_access": {"vibe_cloud": {"enabled": False}}},
headers=csrf_headers(client, "http://127.0.0.1:5123"),
base_url="http://127.0.0.1:5123",
@@ -1787,7 +1787,7 @@ def test_settings_get_redirects_browser_navigation_to_spa(monkeypatch, tmp_path)
_save_config(tmp_path)
response = app.test_client().get(
- "/settings",
+ "/api/settings",
base_url="http://127.0.0.1:5123",
headers={"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"},
follow_redirects=False,
@@ -1805,7 +1805,7 @@ def test_settings_get_returns_json_for_fetch_callers(monkeypatch, tmp_path):
_save_config(tmp_path)
response = app.test_client().get(
- "/settings",
+ "/api/settings",
base_url="http://127.0.0.1:5123",
headers={"Accept": "*/*"},
)
diff --git a/tests/test_ui_server_fastapi.py b/tests/test_ui_server_fastapi.py
index a9beb962d..2e24bb641 100644
--- a/tests/test_ui_server_fastapi.py
+++ b/tests/test_ui_server_fastapi.py
@@ -115,7 +115,7 @@ def test_wechat_qr_poll_marks_bind_hint_without_scheduling_send(monkeypatch):
client = app.test_client()
response = client.post(
- "/wechat/qr_login/poll",
+ "/api/wechat/qr_login/poll",
json={"session_key": "qr-session"},
headers=csrf_headers(client),
)
diff --git a/tests/test_ui_server_install.py b/tests/test_ui_server_install.py
index 2c3d3c53d..4e0dc24af 100644
--- a/tests/test_ui_server_install.py
+++ b/tests/test_ui_server_install.py
@@ -32,7 +32,7 @@ def test_install_agent_allows_same_origin_request(monkeypatch, tmp_path):
client = app.test_client()
response = client.post(
- "/agent/claude/install",
+ "/api/agent/claude/install",
headers=csrf_headers(client, "http://192.168.2.3:15131"),
base_url="http://192.168.2.3:15131",
)
@@ -51,7 +51,7 @@ def test_install_agent_rejects_cross_origin_request(monkeypatch, tmp_path):
headers = csrf_headers(client, "http://192.168.2.3:15131")
headers["Origin"] = "http://evil.example"
response = client.post(
- "/agent/claude/install",
+ "/api/agent/claude/install",
headers=headers,
base_url="http://192.168.2.3:15131",
)
@@ -66,7 +66,7 @@ def test_install_agent_rejects_missing_csrf_token(monkeypatch, tmp_path):
client = app.test_client()
response = client.post(
- "/agent/codex/install",
+ "/api/agent/codex/install",
headers={"Origin": "http://127.0.0.1:15131"},
base_url="http://127.0.0.1:15131",
)
@@ -81,7 +81,7 @@ def test_install_agent_rejects_missing_origin(monkeypatch, tmp_path):
client = app.test_client()
response = client.post(
- "/agent/codex/install",
+ "/api/agent/codex/install",
headers={"X-Vibe-CSRF-Token": csrf_headers(client)["X-Vibe-CSRF-Token"]},
)
@@ -106,7 +106,7 @@ def test_install_agent_status_allows_poll(monkeypatch, tmp_path):
client = app.test_client()
response = client.get(
- "/agent/claude/install/job-1",
+ "/api/agent/claude/install/job-1",
headers=csrf_headers(client, "http://192.168.2.3:15131"),
base_url="http://192.168.2.3:15131",
)
diff --git a/tests/test_ui_server_logs.py b/tests/test_ui_server_logs.py
index dda7bd52e..c17da1c5b 100644
--- a/tests/test_ui_server_logs.py
+++ b/tests/test_ui_server_logs.py
@@ -27,7 +27,7 @@ def test_logs_endpoint_returns_multiple_sources(monkeypatch, tmp_path):
(paths.get_runtime_dir() / "ui_stderr.log").write_text("UI boot failed\nTraceback line\n", encoding="utf-8")
client = app.test_client()
- response = client.post("/logs", json={"lines": 20, "source": "ui_stderr"}, headers=csrf_headers(client))
+ response = client.post("/api/logs", json={"lines": 20, "source": "ui_stderr"}, headers=csrf_headers(client))
assert response.status_code == 200
payload = response.get_json()
@@ -72,7 +72,7 @@ def test_logs_endpoint_returns_aggregated_all_view(monkeypatch, tmp_path):
_set_mtime(ui_stderr_log, "2026-03-25 15:51:19")
client = app.test_client()
- response = client.post("/logs", json={"lines": 20, "source": "all"}, headers=csrf_headers(client))
+ response = client.post("/api/logs", json={"lines": 20, "source": "all"}, headers=csrf_headers(client))
assert response.status_code == 200
payload = response.get_json()
@@ -122,7 +122,7 @@ def test_logs_endpoint_caps_aggregated_all_view_to_requested_lines(monkeypatch,
)
client = app.test_client()
- response = client.post("/logs", json={"lines": 2, "source": "all"}, headers=csrf_headers(client))
+ response = client.post("/api/logs", json={"lines": 2, "source": "all"}, headers=csrf_headers(client))
assert response.status_code == 200
payload = response.get_json()
@@ -148,7 +148,7 @@ def test_logs_endpoint_keeps_traceback_exception_summary_with_error_entry(monkey
)
client = app.test_client()
- response = client.post("/logs", json={"lines": 20, "source": "service"}, headers=csrf_headers(client))
+ response = client.post("/api/logs", json={"lines": 20, "source": "service"}, headers=csrf_headers(client))
assert response.status_code == 200
payload = response.get_json()
@@ -178,7 +178,7 @@ def test_logs_endpoint_preserves_recent_unstructured_logs_in_all_view(monkeypatc
_set_mtime(ui_stderr_log, "2026-03-25 15:51:19")
client = app.test_client()
- response = client.post("/logs", json={"lines": 2, "source": "all"}, headers=csrf_headers(client))
+ response = client.post("/api/logs", json={"lines": 2, "source": "all"}, headers=csrf_headers(client))
assert response.status_code == 200
payload = response.get_json()
@@ -200,7 +200,7 @@ def test_logs_endpoint_falls_back_to_service_for_unknown_source(monkeypatch, tmp
)
client = app.test_client()
- response = client.post("/logs", json={"lines": 20, "source": "unknown"}, headers=csrf_headers(client))
+ response = client.post("/api/logs", json={"lines": 20, "source": "unknown"}, headers=csrf_headers(client))
assert response.status_code == 200
payload = response.get_json()
@@ -241,7 +241,7 @@ def test_control_start_reuses_running_service_without_stop(monkeypatch, tmp_path
monkeypatch.setattr(runtime, "start_service", lambda: calls.append("start_service") or 12345)
client = app.test_client()
- response = client.post("/control", json={"action": "start"}, headers=csrf_headers(client))
+ response = client.post("/api/control", json={"action": "start"}, headers=csrf_headers(client))
assert response.status_code == 200
assert calls == ["ensure_config", "start_service"]
@@ -261,7 +261,7 @@ def test_control_stop_uses_locked_service_stop(monkeypatch, tmp_path):
monkeypatch.setattr(runtime, "stop_process", lambda pid_path: calls.append(("stop_process", pid_path)) or True)
client = app.test_client()
- response = client.post("/control", json={"action": "stop"}, headers=csrf_headers(client))
+ response = client.post("/api/control", json={"action": "stop"}, headers=csrf_headers(client))
assert response.status_code == 200
assert calls == ["stop_service"]
@@ -284,7 +284,7 @@ def test_control_restart_schedules_restart_job(monkeypatch, tmp_path):
)
client = app.test_client()
- response = client.post("/control", json={"action": "restart"}, headers=csrf_headers(client))
+ response = client.post("/api/control", json={"action": "restart"}, headers=csrf_headers(client))
assert response.status_code == 200
payload = response.get_json()
diff --git a/tests/test_ui_server_mutation_protection.py b/tests/test_ui_server_mutation_protection.py
index c70f265f4..7d2117523 100644
--- a/tests/test_ui_server_mutation_protection.py
+++ b/tests/test_ui_server_mutation_protection.py
@@ -32,7 +32,7 @@ def test_config_post_rejects_cross_origin(monkeypatch, tmp_path):
headers["Origin"] = "http://evil.example"
response = client.post(
- "/config",
+ "/api/config",
json={"mode": "self_host"},
headers=headers,
base_url="http://127.0.0.1:15131",
@@ -46,7 +46,7 @@ def test_config_post_rejects_missing_csrf_token(monkeypatch, tmp_path):
monkeypatch.setenv("VIBE_REMOTE_HOME", str(tmp_path))
client = app.test_client()
response = client.post(
- "/config",
+ "/api/config",
json={"mode": "self_host"},
headers={"Origin": "http://127.0.0.1:15131"},
base_url="http://127.0.0.1:15131",
@@ -62,7 +62,7 @@ def test_config_post_rejects_malformed_json(monkeypatch, tmp_path):
headers = csrf_headers(client, "http://127.0.0.1:15131")
response = client.post(
- "/config",
+ "/api/config",
content="{",
headers={**headers, "Content-Type": "application/json"},
base_url="http://127.0.0.1:15131",
@@ -84,7 +84,7 @@ def test_config_post_rejects_host_mismatch_before_parsing_malformed_json(monkeyp
headers = csrf_headers(client, "http://127.0.0.1:15131")
response = client.post(
- "/config",
+ "/api/config",
content="{",
headers={**headers, "Content-Type": "application/json"},
base_url="https://old-alex.avibe.bot",
@@ -107,7 +107,7 @@ def test_config_post_accepts_vendor_json_content_type(monkeypatch, tmp_path):
headers = csrf_headers(client, "http://127.0.0.1:15131")
response = client.post(
- "/config",
+ "/api/config",
content='{"mode":"self_host"}',
headers={**headers, "Content-Type": "application/vnd.api+json"},
base_url="http://127.0.0.1:15131",
@@ -133,7 +133,7 @@ def test_config_post_allows_forwarded_origin(monkeypatch, tmp_path):
headers["X-Forwarded-Host"] = "vibe.example"
response = client.post(
- "/config",
+ "/api/config",
json={
"mode": "self_host",
"runtime": {"default_cwd": "/tmp/test"},
diff --git a/tests/test_ui_server_reload.py b/tests/test_ui_server_reload.py
index cc81cf83c..ca3ed61d3 100644
--- a/tests/test_ui_server_reload.py
+++ b/tests/test_ui_server_reload.py
@@ -59,7 +59,7 @@ def test_ui_reload_overrides_bind_host_when_tunnel_enabled(monkeypatch):
client = app.test_client()
response = client.post(
- "/ui/reload",
+ "/api/ui/reload",
json={"host": "100.97.103.112", "port": 5123},
headers=csrf_headers(client, "http://127.0.0.1:5123"),
base_url="http://127.0.0.1:5123",
@@ -84,7 +84,7 @@ def test_ui_reload_rejects_non_string_host(monkeypatch):
client = app.test_client()
response = client.post(
- "/ui/reload",
+ "/api/ui/reload",
json={"host": 123, "port": 5123},
headers=csrf_headers(client, "http://127.0.0.1:5123"),
base_url="http://127.0.0.1:5123",
@@ -110,7 +110,7 @@ def test_ui_reload_uses_requested_host_when_tunnel_disabled(monkeypatch):
client = app.test_client()
response = client.post(
- "/ui/reload",
+ "/api/ui/reload",
json={"host": "192.168.1.5", "port": 6000},
headers=csrf_headers(client, "http://127.0.0.1:5123"),
base_url="http://127.0.0.1:5123",
diff --git a/ui/src/components/settings/SettingsDiagnosticsPage.tsx b/ui/src/components/settings/SettingsDiagnosticsPage.tsx
index 44d4f1087..386bc1bc7 100644
--- a/ui/src/components/settings/SettingsDiagnosticsPage.tsx
+++ b/ui/src/components/settings/SettingsDiagnosticsPage.tsx
@@ -13,7 +13,7 @@ export const SettingsDiagnosticsPage: React.FC = () => {
title={t('settings.diagnosticsTitle')}
subtitle={t('settings.diagnosticsSubtitle')}
>
- <DoctorPanel isPage logsPath="/logs" titleKey="settings.diagnosticsDoctorTitle" />
+ <DoctorPanel isPage logsPath="/api/logs" titleKey="settings.diagnosticsDoctorTitle" />
</SettingsPageShell>
);
};
diff --git a/ui/src/components/settings/SettingsServicePage.tsx b/ui/src/components/settings/SettingsServicePage.tsx
index ee1892af6..23f69b3f7 100644
--- a/ui/src/components/settings/SettingsServicePage.tsx
+++ b/ui/src/components/settings/SettingsServicePage.tsx
@@ -50,7 +50,7 @@ export const SettingsServicePage: React.FC = () => {
setup_port: config.ui?.setup_port || 5123,
};
await api.saveConfig({ ui: { ...(config.ui || {}), ...uiPayload } });
- await apiFetch('/ui/reload', {
+ await apiFetch('/api/ui/reload', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ host: uiPayload.setup_host, port: uiPayload.setup_port }),
diff --git a/ui/src/context/ApiContext.tsx b/ui/src/context/ApiContext.tsx
index a0bcec6a6..5aeed226b 100644
--- a/ui/src/context/ApiContext.tsx
+++ b/ui/src/context/ApiContext.tsx
@@ -769,7 +769,7 @@ export const ApiProvider: React.FC<{ children: React.ReactNode }> = ({ children
const sleep = (ms: number) => new Promise((resolve) => window.setTimeout(resolve, ms));
const startAndPollAgentInstall = async (name: string): Promise<InstallResult> => {
- const started = await postJson(`/agent/${encodeURIComponent(name)}/install`, {});
+ const started = await postJson(`/api/agent/${encodeURIComponent(name)}/install`, {});
const jobId = typeof started?.job_id === 'string' ? started.job_id : null;
if (!jobId) return started;
@@ -778,7 +778,7 @@ export const ApiProvider: React.FC<{ children: React.ReactNode }> = ({ children
while (Date.now() < deadline) {
await sleep(1000);
last = await getJson(
- `/agent/${encodeURIComponent(name)}/install/${encodeURIComponent(jobId)}`,
+ `/api/agent/${encodeURIComponent(name)}/install/${encodeURIComponent(jobId)}`,
);
if (last?.status === 'succeeded' || last?.status === 'failed') {
return last;
@@ -817,11 +817,11 @@ export const ApiProvider: React.FC<{ children: React.ReactNode }> = ({ children
// is correct (cached error messages would otherwise stay in the
// old language).
const value: ApiContextType = useMemo(() => ({
- getConfig: () => getJson('/config'),
- getPlatformCatalog: () => getJson('/platforms'),
- saveConfig: (payload) => postJson('/config', payload),
- getSettings: (platform) => getJson(platform ? `/settings?platform=${encodeURIComponent(platform)}` : '/settings'),
- saveSettings: (payload, platform) => postJson('/settings', platform ? { ...payload, platform } : payload),
+ getConfig: () => getJson('/api/config'),
+ getPlatformCatalog: () => getJson('/api/platforms'),
+ saveConfig: (payload) => postJson('/api/config', payload),
+ getSettings: (platform) => getJson(platform ? `/api/settings?platform=${encodeURIComponent(platform)}` : '/api/settings'),
+ saveSettings: (payload, platform) => postJson('/api/settings', platform ? { ...payload, platform } : payload),
getUsers: (platform) => getJson(platform ? `/api/users?platform=${encodeURIComponent(platform)}` : '/api/users'),
saveUsers: (payload, platform) => postJson('/api/users', platform ? { ...payload, platform } : payload),
toggleAdmin: (userId, isAdmin, platform) => postJson(`/api/users/${encodeURIComponent(userId)}/admin`, platform ? { is_admin: isAdmin, platform } : { is_admin: isAdmin }),
@@ -832,86 +832,86 @@ export const ApiProvider: React.FC<{ children: React.ReactNode }> = ({ children
getFirstBindCode: () => getJson('/api/setup/first-bind-code'),
detectCli: (binary) => getJson(`/cli/detect?binary=${encodeURIComponent(binary)}`),
installAgent: (name) => startAndPollAgentInstall(name),
- getBackendRuntime: (name) => getJson(`/backend/${encodeURIComponent(name)}/runtime`),
- restartBackend: (name) => postJson(`/backend/${encodeURIComponent(name)}/restart`, {}),
- getCodexAuth: () => getJson('/backend/codex/auth'),
- saveCodexAuth: (payload) => postJson('/backend/codex/auth', payload),
- getClaudeAuth: () => getJson('/backend/claude/auth'),
- saveClaudeAuth: (payload) => postJson('/backend/claude/auth', payload),
+ getBackendRuntime: (name) => getJson(`/api/backend/${encodeURIComponent(name)}/runtime`),
+ restartBackend: (name) => postJson(`/api/backend/${encodeURIComponent(name)}/restart`, {}),
+ getCodexAuth: () => getJson('/api/backend/codex/auth'),
+ saveCodexAuth: (payload) => postJson('/api/backend/codex/auth', payload),
+ getClaudeAuth: () => getJson('/api/backend/claude/auth'),
+ saveClaudeAuth: (payload) => postJson('/api/backend/claude/auth', payload),
startOAuthWeb: (backend, forceReset = true) =>
- postJson(`/backend/${encodeURIComponent(backend)}/auth/oauth/start`, {
+ postJson(`/api/backend/${encodeURIComponent(backend)}/auth/oauth/start`, {
force_reset: forceReset,
}),
startOAuthWebForOpencodeProvider: (providerId, forceReset = true) =>
postJson(
- `/backend/opencode/provider/${encodeURIComponent(providerId)}/auth/oauth/start`,
+ `/api/backend/opencode/provider/${encodeURIComponent(providerId)}/auth/oauth/start`,
{ force_reset: forceReset },
),
getOAuthWebStatus: (backend, flowId) =>
getJson(
- `/backend/${encodeURIComponent(backend)}/auth/oauth/status/${encodeURIComponent(flowId)}`,
+ `/api/backend/${encodeURIComponent(backend)}/auth/oauth/status/${encodeURIComponent(flowId)}`,
),
submitOAuthWebCode: (backend, flowId, code) =>
- postJson(`/backend/${encodeURIComponent(backend)}/auth/oauth/submit-code`, {
+ postJson(`/api/backend/${encodeURIComponent(backend)}/auth/oauth/submit-code`, {
flow_id: flowId,
code,
}),
cancelOAuthWeb: (backend, flowId) =>
- postJson(`/backend/${encodeURIComponent(backend)}/auth/oauth/cancel`, {
+ postJson(`/api/backend/${encodeURIComponent(backend)}/auth/oauth/cancel`, {
flow_id: flowId,
}),
removeBackendAuth: (backend) =>
- postJson(`/backend/${encodeURIComponent(backend)}/auth/oauth/remove`, {}),
+ postJson(`/api/backend/${encodeURIComponent(backend)}/auth/oauth/remove`, {}),
removeBackendApiKey: (backend) =>
- postJson(`/backend/${encodeURIComponent(backend)}/auth/api-key/remove`, {}),
+ postJson(`/api/backend/${encodeURIComponent(backend)}/auth/api-key/remove`, {}),
testBackendAuth: (backend, options) =>
- postJson(`/backend/${encodeURIComponent(backend)}/auth/test`, {
+ postJson(`/api/backend/${encodeURIComponent(backend)}/auth/test`, {
...(options?.model ? { model: options.model } : {}),
}),
testOpencodeProvider: (providerId, options) =>
- postJson(`/backend/opencode/provider/${encodeURIComponent(providerId)}/test`, {
+ postJson(`/api/backend/opencode/provider/${encodeURIComponent(providerId)}/test`, {
...(options?.model ? { model: options.model } : {}),
}),
- getOpencodeProviders: () => getJson('/backend/opencode/providers'),
+ getOpencodeProviders: () => getJson('/api/backend/opencode/providers'),
setOpencodeProviderAuth: (providerId, apiKey, baseUrl) =>
// Forward ``base_url`` only when the caller passed something
// (including an explicit empty string for "clear"); omitting it
// entirely tells the server to leave the stored value untouched,
// which is the right default for callers that don't care about
// the base-URL override.
- postJson(`/backend/opencode/provider/${encodeURIComponent(providerId)}/auth`, {
+ postJson(`/api/backend/opencode/provider/${encodeURIComponent(providerId)}/auth`, {
api_key: apiKey,
...(baseUrl !== undefined ? { base_url: baseUrl } : {}),
}),
deleteOpencodeProviderAuth: (providerId) =>
- deleteJson(`/backend/opencode/provider/${encodeURIComponent(providerId)}/auth`),
+ deleteJson(`/api/backend/opencode/provider/${encodeURIComponent(providerId)}/auth`),
setOpencodeDefaultProvider: (providerId) =>
- postJson('/backend/opencode/default-provider', { provider_id: providerId }),
- slackAuthTest: (botToken, proxyUrl) => postJson('/slack/auth_test', { bot_token: botToken, proxy_url: proxyUrl || undefined }),
- slackChannels: (botToken, browseAll, force) => postJson('/slack/channels', { bot_token: botToken, browse_all: browseAll || false, force: force || false }),
- slackManifest: () => getJson('/slack/manifest'),
- discordAuthTest: (botToken, proxyUrl) => postJson('/discord/auth_test', { bot_token: botToken, proxy_url: proxyUrl || undefined }),
- discordGuilds: (botToken) => postJson('/discord/guilds', { bot_token: botToken }),
- discordChannels: (botToken, guildId, force) => postJson('/discord/channels', { bot_token: botToken, guild_id: guildId, force: force || false }),
- telegramAuthTest: (botToken, proxyUrl) => postJson('/telegram/auth_test', { bot_token: botToken, proxy_url: proxyUrl || undefined }),
- telegramChats: (includePrivate) => postJson('/telegram/chats', { include_private: includePrivate || false }),
- larkAuthTest: (appId, appSecret, domain, proxyUrl) => postJson('/lark/auth_test', { app_id: appId, app_secret: appSecret, domain: domain || 'feishu', proxy_url: proxyUrl || undefined }),
- larkChats: (appId, appSecret, domain, force) => postJson('/lark/chats', { app_id: appId, app_secret: appSecret, domain: domain || 'feishu', force: force || false }),
- larkTempWsStart: (appId, appSecret, domain) => postJson('/lark/temp_ws/start', { app_id: appId, app_secret: appSecret, domain: domain || 'feishu' }),
- larkTempWsStop: () => postJson('/lark/temp_ws/stop', {}),
- wechatStartLogin: () => postJson('/wechat/qr_login/start', {}),
- wechatPollLogin: (sessionKey) => postJson('/wechat/qr_login/poll', { session_key: sessionKey }),
- doctor: () => postJson('/doctor', {}),
- opencodeOptions: (cwd) => postJson('/opencode/options', { cwd }),
- opencodeSetupPermission: () => postJson('/opencode/setup-permission', {}),
- claudeAgents: (cwd) => cwd ? getJson(`/claude/agents?cwd=${encodeURIComponent(cwd)}`) : getJson('/claude/agents'),
- claudeModels: () => getJson('/claude/models'),
- codexAgents: (cwd) => cwd ? getJson(`/codex/agents?cwd=${encodeURIComponent(cwd)}`) : getJson('/codex/agents'),
- codexModels: () => getJson('/codex/models'),
- getLogs: (lines = 500, source) => postJson('/logs', source ? { lines, source } : { lines }),
- getVersion: () => getJson('/version'),
- doUpgrade: () => postJson('/upgrade', {}),
- browseDirectory: (path, showHidden) => postJson('/browse', { path, show_hidden: showHidden || false }),
+ postJson('/api/backend/opencode/default-provider', { provider_id: providerId }),
+ slackAuthTest: (botToken, proxyUrl) => postJson('/api/slack/auth_test', { bot_token: botToken, proxy_url: proxyUrl || undefined }),
+ slackChannels: (botToken, browseAll, force) => postJson('/api/slack/channels', { bot_token: botToken, browse_all: browseAll || false, force: force || false }),
+ slackManifest: () => getJson('/api/slack/manifest'),
+ discordAuthTest: (botToken, proxyUrl) => postJson('/api/discord/auth_test', { bot_token: botToken, proxy_url: proxyUrl || undefined }),
+ discordGuilds: (botToken) => postJson('/api/discord/guilds', { bot_token: botToken }),
+ discordChannels: (botToken, guildId, force) => postJson('/api/discord/channels', { bot_token: botToken, guild_id: guildId, force: force || false }),
+ telegramAuthTest: (botToken, proxyUrl) => postJson('/api/telegram/auth_test', { bot_token: botToken, proxy_url: proxyUrl || undefined }),
+ telegramChats: (includePrivate) => postJson('/api/telegram/chats', { include_private: includePrivate || false }),
+ larkAuthTest: (appId, appSecret, domain, proxyUrl) => postJson('/api/lark/auth_test', { app_id: appId, app_secret: appSecret, domain: domain || 'feishu', proxy_url: proxyUrl || undefined }),
+ larkChats: (appId, appSecret, domain, force) => postJson('/api/lark/chats', { app_id: appId, app_secret: appSecret, domain: domain || 'feishu', force: force || false }),
+ larkTempWsStart: (appId, appSecret, domain) => postJson('/api/lark/temp_ws/start', { app_id: appId, app_secret: appSecret, domain: domain || 'feishu' }),
+ larkTempWsStop: () => postJson('/api/lark/temp_ws/stop', {}),
+ wechatStartLogin: () => postJson('/api/wechat/qr_login/start', {}),
+ wechatPollLogin: (sessionKey) => postJson('/api/wechat/qr_login/poll', { session_key: sessionKey }),
+ doctor: () => postJson('/api/doctor', {}),
+ opencodeOptions: (cwd) => postJson('/api/opencode/options', { cwd }),
+ opencodeSetupPermission: () => postJson('/api/opencode/setup-permission', {}),
+ claudeAgents: (cwd) => cwd ? getJson(`/api/claude/agents?cwd=${encodeURIComponent(cwd)}`) : getJson('/api/claude/agents'),
+ claudeModels: () => getJson('/api/claude/models'),
+ codexAgents: (cwd) => cwd ? getJson(`/api/codex/agents?cwd=${encodeURIComponent(cwd)}`) : getJson('/api/codex/agents'),
+ codexModels: () => getJson('/api/codex/models'),
+ getLogs: (lines = 500, source) => postJson('/api/logs', source ? { lines, source } : { lines }),
+ getVersion: () => getJson('/api/version'),
+ doUpgrade: () => postJson('/api/upgrade', {}),
+ browseDirectory: (path, showHidden) => postJson('/api/browse', { path, show_hidden: showHidden || false }),
browseMkdir: (path) => postJson('/api/browse/mkdir', { path }),
listProjects: (includeArchived) =>
getJson(`/api/projects${includeArchived ? '?include_archived=1' : ''}`),
@@ -1085,10 +1085,10 @@ export const ApiProvider: React.FC<{ children: React.ReactNode }> = ({ children
source.onerror = (err) => handlers.onError?.(err);
return () => source.close();
},
- remoteAccessStatus: () => getJson('/remote-access/status'),
- pairVibeCloudRemoteAccess: (payload) => postJson('/remote-access/vibe-cloud/pair', payload),
- startRemoteAccess: () => postJson('/remote-access/start', {}),
- stopRemoteAccess: () => postJson('/remote-access/stop', {}),
+ remoteAccessStatus: () => getJson('/api/remote-access/status'),
+ pairVibeCloudRemoteAccess: (payload) => postJson('/api/remote-access/vibe-cloud/pair', payload),
+ startRemoteAccess: () => postJson('/api/remote-access/start', {}),
+ stopRemoteAccess: () => postJson('/api/remote-access/stop', {}),
getAuthSession: () => getJson('/api/session'),
signOut: () => postJson('/auth/logout', {}),
// eslint-disable-next-line react-hooks/exhaustive-deps
diff --git a/ui/src/context/StatusContext.tsx b/ui/src/context/StatusContext.tsx
index f350cc72f..8549d8a38 100644
--- a/ui/src/context/StatusContext.tsx
+++ b/ui/src/context/StatusContext.tsx
@@ -45,7 +45,7 @@ export const StatusProvider: React.FC<{ children: React.ReactNode }> = ({ childr
const control = async (action: string, payload: any = {}) => {
try {
- const res = await apiFetch('/control', {
+ const res = await apiFetch('/api/control', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ action, ...payload }),
diff --git a/vibe/ui_server.py b/vibe/ui_server.py
index 5a8201437..7da7f07d7 100644
--- a/vibe/ui_server.py
+++ b/vibe/ui_server.py
@@ -1260,7 +1260,7 @@ async def websocket_echo(websocket: WebSocket):
return
[email protected]("/doctor", methods=["GET"])
[email protected]("/api/doctor", methods=["GET"])
def doctor_get():
payload = {}
doctor_path = paths.get_runtime_doctor_path()
@@ -1269,7 +1269,7 @@ def doctor_get():
return jsonify(payload)
[email protected]("/config", methods=["GET"])
[email protected]("/api/config", methods=["GET"])
def config_get():
from vibe import api
@@ -1277,14 +1277,14 @@ def config_get():
return jsonify(api.config_to_payload(config))
[email protected]("/platforms", methods=["GET"])
[email protected]("/api/platforms", methods=["GET"])
def platforms_get():
from vibe import api
return jsonify(api.get_platform_catalog())
[email protected]("/agent-backends", methods=["GET"])
[email protected]("/api/agent-backends", methods=["GET"])
def agent_backends_get():
from vibe import api
@@ -1395,16 +1395,8 @@ def vibe_agent_delete(name):
return _vibe_agent_error_response(exc)
[email protected]("/settings", methods=["GET"])
[email protected]("/api/settings", methods=["GET"])
def settings_get():
- # /settings doubles as a backend JSON API and a user-facing URL the SPA
- # owns (it lives under /settings/<page>). Browser navigations send
- # Accept: text/html..., while fetch() callers from the SPA send Accept:
- # */* (no explicit text/html), so we can distinguish the two and redirect
- # bookmarked / hard-refreshed browser hits to the canonical settings page
- # instead of serving raw JSON.
- if "text/html" in request.headers.get("Accept", ""):
- return redirect("/admin/settings/service")
from vibe import api
return jsonify(api.get_settings(request.args.get("platform") or None))
@@ -1425,7 +1417,7 @@ def csrf_token_get():
return response
[email protected]("/cli/detect")
[email protected]("/api/cli/detect")
def cli_detect():
from vibe import api
@@ -1433,14 +1425,14 @@ def cli_detect():
return jsonify(api.detect_cli(binary))
[email protected]("/slack/manifest")
[email protected]("/api/slack/manifest")
def slack_manifest():
from vibe import api
return jsonify(api.get_slack_manifest())
[email protected]("/version")
[email protected]("/api/version")
def version():
from vibe import api
@@ -1452,7 +1444,7 @@ def version():
# =============================================================================
[email protected]("/control", methods=["POST"])
[email protected]("/api/control", methods=["POST"])
def control():
from vibe import runtime
from vibe.cli import _stop_opencode_server
@@ -1481,7 +1473,7 @@ def control():
return jsonify({"ok": True, "action": action, "status": runtime.read_status()})
[email protected]("/config", methods=["POST"])
[email protected]("/api/config", methods=["POST"])
def config_post():
from vibe import api
from vibe import remote_access
@@ -1504,14 +1496,14 @@ def config_post():
return jsonify(response_payload)
[email protected]("/remote-access/status", methods=["GET"])
[email protected]("/api/remote-access/status", methods=["GET"])
def remote_access_status():
from vibe import remote_access
return jsonify(remote_access.status())
[email protected]("/remote-access/vibe-cloud/pair", methods=["POST"])
[email protected]("/api/remote-access/vibe-cloud/pair", methods=["POST"])
def remote_access_vibe_cloud_pair():
from vibe import remote_access
@@ -1524,7 +1516,7 @@ def remote_access_vibe_cloud_pair():
return jsonify(result), 200 if result.get("ok") else 400
[email protected]("/remote-access/start", methods=["POST"])
[email protected]("/api/remote-access/start", methods=["POST"])
def remote_access_start():
from vibe import remote_access
@@ -1532,7 +1524,7 @@ def remote_access_start():
return jsonify(result), 200 if result.get("ok") else 400
[email protected]("/remote-access/stop", methods=["POST"])
[email protected]("/api/remote-access/stop", methods=["POST"])
def remote_access_stop():
from vibe import remote_access
@@ -1625,7 +1617,7 @@ def remote_access_logout():
return response
[email protected]("/ui/reload", methods=["POST"])
[email protected]("/api/ui/reload", methods=["POST"])
def ui_reload():
from vibe import runtime
@@ -1699,7 +1691,7 @@ def ui_reload():
return jsonify({"ok": True, "host": host, "port": port})
[email protected]("/settings", methods=["POST"])
[email protected]("/api/settings", methods=["POST"])
def settings_post():
from vibe import api
@@ -1707,7 +1699,7 @@ def settings_post():
return jsonify(api.save_settings(payload))
[email protected]("/slack/auth_test", methods=["POST"])
[email protected]("/api/slack/auth_test", methods=["POST"])
def slack_auth_test():
from vibe import api
@@ -1719,7 +1711,7 @@ def slack_auth_test():
return jsonify(result)
[email protected]("/slack/channels", methods=["POST"])
[email protected]("/api/slack/channels", methods=["POST"])
def slack_channels():
from vibe import api
@@ -1733,7 +1725,7 @@ def slack_channels():
)
[email protected]("/discord/auth_test", methods=["POST"])
[email protected]("/api/discord/auth_test", methods=["POST"])
async def discord_auth_test():
from vibe import api
@@ -1745,7 +1737,7 @@ async def discord_auth_test():
return jsonify(result)
[email protected]("/discord/guilds", methods=["POST"])
[email protected]("/api/discord/guilds", methods=["POST"])
async def discord_guilds():
from vibe import api
@@ -1753,7 +1745,7 @@ async def discord_guilds():
return jsonify(await api.discord_list_guilds_async(payload.get("bot_token", "")))
[email protected]("/discord/channels", methods=["POST"])
[email protected]("/api/discord/channels", methods=["POST"])
def discord_channels():
from vibe import api
@@ -1767,7 +1759,7 @@ def discord_channels():
)
[email protected]("/telegram/auth_test", methods=["POST"])
[email protected]("/api/telegram/auth_test", methods=["POST"])
async def telegram_auth_test():
from vibe import api
@@ -1779,7 +1771,7 @@ async def telegram_auth_test():
return jsonify(result)
[email protected]("/telegram/chats", methods=["POST"])
[email protected]("/api/telegram/chats", methods=["POST"])
def telegram_chats():
from vibe import api
@@ -1787,7 +1779,7 @@ def telegram_chats():
return jsonify(api.telegram_list_chats(include_private=payload.get("include_private", False)))
[email protected]("/lark/auth_test", methods=["POST"])
[email protected]("/api/lark/auth_test", methods=["POST"])
async def lark_auth_test():
from vibe import api
@@ -1801,7 +1793,7 @@ async def lark_auth_test():
return jsonify(result)
[email protected]("/lark/chats", methods=["POST"])
[email protected]("/api/lark/chats", methods=["POST"])
def lark_chats():
from vibe import api
@@ -1816,7 +1808,7 @@ def lark_chats():
)
[email protected]("/lark/temp_ws/start", methods=["POST"])
[email protected]("/api/lark/temp_ws/start", methods=["POST"])
def lark_temp_ws_start():
from vibe import api
@@ -1828,7 +1820,7 @@ def lark_temp_ws_start():
)
[email protected]("/lark/temp_ws/stop", methods=["POST"])
[email protected]("/api/lark/temp_ws/stop", methods=["POST"])
def lark_temp_ws_stop():
from vibe import api
@@ -1848,7 +1840,7 @@ def _get_wechat_auth():
return _wechat_auth_manager
[email protected]("/wechat/qr_login/start", methods=["POST"])
[email protected]("/api/wechat/qr_login/start", methods=["POST"])
async def wechat_qr_login_start():
"""Start WeChat QR code login flow."""
auth = _get_wechat_auth()
@@ -1861,7 +1853,7 @@ async def wechat_qr_login_start():
return jsonify(result)
[email protected]("/wechat/qr_login/poll", methods=["POST"])
[email protected]("/api/wechat/qr_login/poll", methods=["POST"])
async def wechat_qr_login_poll():
"""Poll WeChat QR code login status."""
payload = request.json or {}
@@ -1909,7 +1901,7 @@ async def wechat_qr_login_poll():
return jsonify(result)
[email protected]("/doctor", methods=["POST"])
[email protected]("/api/doctor", methods=["POST"])
def doctor_post():
from vibe.cli import _doctor
@@ -1917,7 +1909,7 @@ def doctor_post():
return jsonify(result)
[email protected]("/logs", methods=["POST"])
[email protected]("/api/logs", methods=["POST"])
def logs():
payload = request.json or {}
try:
@@ -1972,7 +1964,7 @@ def logs():
return jsonify({"error": str(e)}), 500
[email protected]("/opencode/options", methods=["POST"])
[email protected]("/api/opencode/options", methods=["POST"])
async def opencode_options():
from vibe import api
@@ -1981,7 +1973,7 @@ async def opencode_options():
return jsonify(result)
[email protected]("/upgrade", methods=["POST"])
[email protected]("/api/upgrade", methods=["POST"])
def upgrade():
from vibe import api
@@ -1989,14 +1981,14 @@ def upgrade():
return jsonify(result)
[email protected]("/opencode/setup-permission", methods=["POST"])
[email protected]("/api/opencode/setup-permission", methods=["POST"])
def opencode_setup_permission():
from vibe import api
return jsonify(api.setup_opencode_permission())
[email protected]("/claude/agents", methods=["GET"])
[email protected]("/api/claude/agents", methods=["GET"])
def claude_agents():
from vibe import api
@@ -2012,7 +2004,7 @@ def claude_agents():
return jsonify(api.claude_agents(cwd))
[email protected]("/codex/agents", methods=["GET"])
[email protected]("/api/codex/agents", methods=["GET"])
def codex_agents():
from vibe import api
@@ -2027,21 +2019,21 @@ def codex_agents():
return jsonify(api.codex_agents(cwd))
[email protected]("/claude/models", methods=["GET"])
[email protected]("/api/claude/models", methods=["GET"])
def claude_models():
from vibe import api
return jsonify(api.claude_models())
[email protected]("/codex/models", methods=["GET"])
[email protected]("/api/codex/models", methods=["GET"])
def codex_models():
from vibe import api
return jsonify(api.codex_models())
[email protected]("/agent/<name>/install", methods=["POST"])
[email protected]("/api/agent/<name>/install", methods=["POST"])
def agent_install(name):
"""Install an agent CLI tool (opencode, claude, codex)."""
if name not in _ALLOWED_BACKENDS:
@@ -2053,7 +2045,7 @@ def agent_install(name):
return jsonify(result)
[email protected]("/agent/<name>/install/<job_id>", methods=["GET"])
[email protected]("/api/agent/<name>/install/<job_id>", methods=["GET"])
def agent_install_status(name, job_id):
"""Poll a background agent CLI install/upgrade job."""
if name not in _ALLOWED_BACKENDS:
@@ -2069,7 +2061,7 @@ def agent_install_status(name, job_id):
_ALLOWED_BACKENDS = set(AGENT_BACKENDS)
[email protected]("/backend/<name>/runtime")
[email protected]("/api/backend/<name>/runtime")
def backend_runtime(name):
"""Return lifecycle info (version, update, process status) for a backend."""
if name not in _ALLOWED_BACKENDS:
@@ -2080,7 +2072,7 @@ def backend_runtime(name):
return jsonify(api.get_backend_runtime(name))
[email protected]("/backend/<name>/restart", methods=["POST"])
[email protected]("/api/backend/<name>/restart", methods=["POST"])
def backend_restart(name):
"""Refresh a backend's runtime state after settings change."""
if not supports_runtime_refresh(name):
@@ -2091,7 +2083,7 @@ def backend_restart(name):
return jsonify(api.restart_backend(name))
[email protected]("/backend/codex/auth", methods=["GET"])
[email protected]("/api/backend/codex/auth", methods=["GET"])
def backend_codex_auth_get():
"""Read the user-facing Codex auth state (masked secrets)."""
from vibe import api
@@ -2099,7 +2091,7 @@ def backend_codex_auth_get():
return jsonify(api.get_codex_auth())
[email protected]("/backend/codex/auth", methods=["POST"])
[email protected]("/api/backend/codex/auth", methods=["POST"])
def backend_codex_auth_post():
"""Persist Codex auth and reload the app-server.
@@ -2111,7 +2103,7 @@ def backend_codex_auth_post():
return jsonify(api.save_codex_auth(payload))
[email protected]("/backend/claude/auth", methods=["GET"])
[email protected]("/api/backend/claude/auth", methods=["GET"])
def backend_claude_auth_get():
"""Read the user-facing Claude auth state (masked secrets)."""
from vibe import api
@@ -2119,7 +2111,7 @@ def backend_claude_auth_get():
return jsonify(api.get_claude_auth())
[email protected]("/backend/claude/auth", methods=["POST"])
[email protected]("/api/backend/claude/auth", methods=["POST"])
def backend_claude_auth_post():
"""Persist Claude auth into V2Config.
@@ -2133,7 +2125,7 @@ def backend_claude_auth_post():
return jsonify(api.save_claude_auth(payload))
[email protected]("/backend/<backend>/auth/oauth/start", methods=["POST"])
[email protected]("/api/backend/<backend>/auth/oauth/start", methods=["POST"])
async def backend_oauth_web_start(backend: str):
"""Kick off a Settings → Backends OAuth flow for Claude or Codex.
@@ -2148,7 +2140,7 @@ async def backend_oauth_web_start(backend: str):
return jsonify(await api.start_oauth_web_async(backend, force_reset=force_reset))
[email protected]("/backend/<backend>/auth/oauth/status/<flow_id>", methods=["GET"])
[email protected]("/api/backend/<backend>/auth/oauth/status/<flow_id>", methods=["GET"])
def backend_oauth_web_status(backend: str, flow_id: str):
"""Poll an in-flight Settings OAuth flow."""
from vibe import api
@@ -2157,7 +2149,7 @@ def backend_oauth_web_status(backend: str, flow_id: str):
return jsonify(api.get_oauth_web_status(flow_id))
[email protected]("/backend/<backend>/auth/oauth/submit-code", methods=["POST"])
[email protected]("/api/backend/<backend>/auth/oauth/submit-code", methods=["POST"])
async def backend_oauth_web_submit_code(backend: str):
"""Submit the Claude OAuth callback code (Codex device-auth ignores this)."""
from vibe import api
@@ -2169,7 +2161,7 @@ async def backend_oauth_web_submit_code(backend: str):
return jsonify(await api.submit_oauth_web_code_async(flow_id, code))
[email protected]("/backend/<backend>/auth/oauth/cancel", methods=["POST"])
[email protected]("/api/backend/<backend>/auth/oauth/cancel", methods=["POST"])
async def backend_oauth_web_cancel(backend: str):
"""Cancel an in-flight Settings OAuth flow."""
from vibe import api
@@ -2180,7 +2172,7 @@ async def backend_oauth_web_cancel(backend: str):
return jsonify(await api.cancel_oauth_web_async(flow_id))
[email protected]("/backend/<backend>/auth/oauth/remove", methods=["POST"])
[email protected]("/api/backend/<backend>/auth/oauth/remove", methods=["POST"])
async def backend_oauth_web_remove(backend: str):
"""Clear stored credentials for a Claude/Codex backend."""
from vibe import api
@@ -2188,7 +2180,7 @@ async def backend_oauth_web_remove(backend: str):
return jsonify(await api.remove_backend_auth_async(backend))
[email protected]("/backend/<backend>/auth/api-key/remove", methods=["POST"])
[email protected]("/api/backend/<backend>/auth/api-key/remove", methods=["POST"])
def backend_auth_api_key_remove(backend: str):
"""Clear the stored API key (V2Config + Codex auth.json) without
touching OAuth credentials. Per-backend symmetry of OpenCode's
@@ -2198,7 +2190,7 @@ def backend_auth_api_key_remove(backend: str):
return jsonify(api.remove_backend_api_key(backend))
[email protected]("/backend/<backend>/auth/test", methods=["POST"])
[email protected]("/api/backend/<backend>/auth/test", methods=["POST"])
async def backend_auth_test(backend: str):
"""Send a single-token probe through the backend CLI to verify auth."""
from vibe import api
@@ -2209,7 +2201,7 @@ async def backend_auth_test(backend: str):
return jsonify(await api.test_backend_auth_async(backend, model=model))
[email protected]("/backend/opencode/providers", methods=["GET"])
[email protected]("/api/backend/opencode/providers", methods=["GET"])
async def backend_opencode_providers():
"""Return the merged OpenCode provider catalog for the Settings UI.
@@ -2240,7 +2232,7 @@ async def backend_opencode_provider_oauth_start(provider_id: str):
return jsonify(await api.start_oauth_web_async("opencode", force_reset=force_reset, provider_id=provider_id))
[email protected]("/backend/opencode/provider/<provider_id>/auth", methods=["POST"])
[email protected]("/api/backend/opencode/provider/<provider_id>/auth", methods=["POST"])
async def backend_opencode_provider_auth_post(provider_id: str):
"""Persist an API key for a single OpenCode provider.
@@ -2253,7 +2245,7 @@ async def backend_opencode_provider_auth_post(provider_id: str):
return jsonify(await api.save_opencode_provider_auth_async(provider_id, payload))
[email protected]("/backend/opencode/provider/<provider_id>/auth", methods=["DELETE"])
[email protected]("/api/backend/opencode/provider/<provider_id>/auth", methods=["DELETE"])
async def backend_opencode_provider_auth_delete(provider_id: str):
"""Drop the stored API key for a single OpenCode provider."""
from vibe import api
@@ -2261,7 +2253,7 @@ async def backend_opencode_provider_auth_delete(provider_id: str):
return jsonify(await api.delete_opencode_provider_auth_async(provider_id))
[email protected]("/backend/opencode/provider/<provider_id>/test", methods=["POST"])
[email protected]("/api/backend/opencode/provider/<provider_id>/test", methods=["POST"])
async def backend_opencode_provider_test(provider_id: str):
"""Run a per-provider connectivity probe through OpenCode's HTTP API.
@@ -2276,7 +2268,7 @@ async def backend_opencode_provider_test(provider_id: str):
return jsonify(await api.test_opencode_provider_async(provider_id, model=model))
[email protected]("/backend/opencode/default-provider", methods=["POST"])
[email protected]("/api/backend/opencode/default-provider", methods=["POST"])
def backend_opencode_default_provider():
"""Persist the user's default OpenCode provider into V2Config.
@@ -2289,7 +2281,7 @@ def backend_opencode_default_provider():
return jsonify(api.set_opencode_default_provider(payload))
[email protected]("/browse", methods=["POST"])
[email protected]("/api/browse", methods=["POST"])
def browse_directory():
"""List sub-directories of a given path for the directory picker UI."""
from vibe import api