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.

fix(computer): complete deferred P2 contracts (#2449)

Max33890f8e764d
diff --git a/core/computer_cli.py b/core/computer_cli.py
index 7d14f7cba..d1bb80623 100644
--- a/core/computer_cli.py
+++ b/core/computer_cli.py
@@ -181,6 +181,43 @@ _COMPUTER_ERROR_I18N_KEYS = {
"window_target_required": "computer.cli.error.windowTargetRequired",
}
+_COMPUTER_STATUS_I18N_KEYS = {
+ "off": "computer.cli.status.off",
+ "needs_permission": "computer.cli.status.needsPermission",
+ "needs_runtime": "computer.cli.status.needsRuntime",
+ "starting": "computer.cli.status.starting",
+ "error": "computer.cli.status.error",
+ "stopped": "computer.cli.status.stopped",
+ "unavailable": "computer.cli.status.unavailable",
+}
+
+_COMPUTER_REASON_I18N_KEYS = {
+ "never_enabled": "computer.cli.reason.neverEnabled",
+ "toggle_off": "computer.cli.reason.toggleOff",
+ "accessibility": "computer.cli.reason.accessibility",
+ "screen_recording": "computer.cli.reason.screenRecording",
+ "runtime_unavailable": "computer.cli.reason.runtimeUnavailable",
+ "runtime_too_old": "computer.cli.reason.runtimeTooOld",
+ "state_unwritable": "computer.cli.reason.stateUnwritable",
+ "assets_invalid": "computer.cli.reason.assetsInvalid",
+ "spawn_failed": "computer.cli.reason.spawnFailed",
+ "daemon_exited": "computer.cli.reason.daemonExited",
+ "health_timeout": "computer.cli.reason.healthTimeout",
+ "bundle_identity": "computer.cli.reason.bundleIdentity",
+ "ax_capability": "computer.cli.reason.axCapability",
+ "capture_failed": "computer.cli.reason.captureFailed",
+ "driver_health_failed": "computer.cli.reason.driverHealthFailed",
+ "endpoint_busy": "computer.cli.reason.endpointBusy",
+ "endpoint_unremovable": "computer.cli.reason.endpointUnremovable",
+ "socket_unreachable": "computer.cli.reason.socketUnreachable",
+ "socket_path_too_long": "computer.cli.reason.socketPathTooLong",
+ "invalid_state_file": "computer.cli.reason.invalidStateFile",
+ "snapshot_invalid": "computer.cli.reason.snapshotInvalid",
+ "shell_not_running": "computer.cli.reason.shellNotRunning",
+ "daemon_unreachable": "computer.cli.reason.daemonUnreachable",
+ "daemon_generation_changed": "computer.cli.reason.daemonGenerationChanged",
+}
+
def translate_computer_error(
error: Mapping[str, Any],
@@ -197,6 +234,33 @@ def translate_computer_error(
params = error.get("params")
if code == "unknown_tool" and isinstance(params, Mapping):
return translate(key, tool=str(params.get("tool") or ""))
+ if code == "computer_use_unavailable" and isinstance(params, Mapping):
+ status_code = str(params.get("status") or "unknown")
+ reason_value = params.get("reason")
+ reason_code = (
+ str(reason_value)
+ if isinstance(reason_value, str) and reason_value
+ else "none"
+ )
+ status_key = _COMPUTER_STATUS_I18N_KEYS.get(
+ status_code,
+ "computer.cli.status.unknown",
+ )
+ reason_key = _COMPUTER_REASON_I18N_KEYS.get(
+ reason_code,
+ (
+ "computer.cli.reason.none"
+ if reason_code == "none"
+ else "computer.cli.reason.unknown"
+ ),
+ )
+ return translate(
+ key,
+ statusCode=status_code,
+ status=translate(status_key, code=status_code),
+ reasonCode=reason_code,
+ reason=translate(reason_key, code=reason_code),
+ )
return translate(key)
diff --git a/docs/plans/desktop-computer-use.md b/docs/plans/desktop-computer-use.md
index 08159dd20..409f653fa 100644
--- a/docs/plans/desktop-computer-use.md
+++ b/docs/plans/desktop-computer-use.md
@@ -76,6 +76,38 @@ start from a mergeable Slice 1 head; this plan does not authorize launching
apps, touching TCC, using credentials, restarting Runtime, or performing live
acceptance.
+## 2026-10-11 P2 follow-up contract
+
+The invariant is that the shipped Session-keyed Computer Use path stays
+truthful at every existing boundary: retiring an Avibe Session releases only a
+lease still owned by that Session without starting or reviving a driver
+session; CLI and Workbench status copy describe the structured state that can
+actually be used; screenshot errors remain errors before any output write; and
+every packaged Skill example is accepted by the CLI and the pinned driver
+schema.
+
+The changed boundaries are limited to:
+
+- `ComputerUseServer` retirement and the existing desktop lease manager;
+- localized CLI rendering of `computer_use_unavailable` status and reason;
+- the Workbench status API and component copy when Controller IPC is unhealthy;
+- the packaged `computer-use` Skill examples and their parser/schema contract.
+
+Owning tests cover an inactive-proxy lease through the real retirement path,
+preservation of a replacement holder, localized human and unchanged JSON error
+output, API-to-component Controller-unavailable rendering, structured errors
+before both screenshot output paths, and every command and flag shown by the
+packaged Skill against the pinned allowed driver schema.
+
+Preserved behavior includes same-user local trust, Session-keyed state and
+archive admission fencing, exact transport ownership, lease TTL and heartbeat,
+ambiguous forwarded-action handling, observe-first and exact-window checks,
+focus and foreground restrictions, native toggle/lifecycle ownership, all
+backend CLI parity, no managed backend MCP, no always-on prompt, and the
+already-corrected no-Turn-capability documentation. This follow-up adds no
+authority mechanism, per-Turn teardown, credential, Route B behavior, GUI/TCC
+operation, service restart, installation, release, or publication.
+
## Route A: raw single-click selector (2026-10-10)
Status: implementation lane, based on remote master
diff --git a/skills/computer-use/SKILL.md b/skills/computer-use/SKILL.md
index 6193cacc0..725c71091 100644
--- a/skills/computer-use/SKILL.md
+++ b/skills/computer-use/SKILL.md
@@ -21,7 +21,7 @@ vibe computer hotkey --arg keys='["cmd","c"]' --arg pid=123 --arg window_id=456
vibe computer scroll --arg direction=down --arg pid=123 --arg window_id=456
vibe computer drag --arg from_x=10 --arg from_y=10 --arg to_x=100 --arg to_y=100 --arg pid=123 --arg window_id=456
vibe computer set-value --arg pid=123 --arg value=enabled --arg element_token=el_1
-vibe computer clipboard read
+vibe computer clipboard read --arg include_text=true
vibe computer clipboard write --arg text="copied text"
vibe computer launch --arg bundle_id=com.example.App
vibe computer quit --arg pid=123
@@ -82,7 +82,8 @@ retrying automatically:
- `error`: the desktop application reported a terminal setup or driver error.
- `unavailable`: the state file, shell, or driver endpoint is unavailable.
- `desktop_busy`: another Avibe Session holds the desktop lease.
-- `observe_first`: the exact target has not been observed in this Turn.
+- `observe_first`: the exact target has not been observed in the current
+ Session lease epoch.
- `foreground_forbidden` or `focus_shortcut_forbidden`: the safety policy
rejected the requested input.
diff --git a/tests/test_computer_cli.py b/tests/test_computer_cli.py
index fdb5e8776..f70453879 100644
--- a/tests/test_computer_cli.py
+++ b/tests/test_computer_cli.py
@@ -3,6 +3,8 @@ from __future__ import annotations
import asyncio
import base64
import json
+import re
+import shlex
import socket
import tempfile
from pathlib import Path
@@ -10,10 +12,12 @@ from types import SimpleNamespace
from unittest.mock import patch
import httpx
+from jsonschema import Draft7Validator
import pytest
from core import internal_server, session_turns
from core.computer_cli import (
+ COMPUTER_CLI_TOOLS,
build_driver_arguments,
format_human_result,
prepare_arguments_for_output,
@@ -85,6 +89,72 @@ def test_parser_covers_the_allowlisted_driver_operations_without_session_id() ->
parser.parse_args(["computer", "click", "--session-id", "manual"])
+def test_packaged_skill_examples_parse_and_match_the_pinned_driver_schema() -> None:
+ skill = Path("skills/computer-use/SKILL.md").read_text(encoding="utf-8")
+ commands = [
+ line.strip()
+ for line in skill.splitlines()
+ if line.strip().startswith("vibe computer ")
+ ]
+ snapshot = json.loads(
+ Path("desktop/cua-driver/tools-v0.31.0.json").read_text(encoding="utf-8")
+ )
+ schemas = {
+ tool["name"]: tool["inputSchema"]
+ for tool in snapshot["tools"]
+ if tool["name"] in COMPUTER_CLI_TOOLS.values()
+ }
+ parser = cli.build_parser()
+ covered_tools: set[str] = set()
+
+ for command in commands:
+ argv = shlex.split(command)
+ assert argv[:2] == ["vibe", "computer"]
+ args = parser.parse_args(argv[1:])
+ if args.computer_command == "observe":
+ path = ("observe", args.computer_observe_command)
+ elif args.computer_command == "clipboard":
+ path = ("clipboard", args.computer_clipboard_command)
+ else:
+ path = (args.computer_command,)
+ tool = tool_for_command(path)
+ arguments = build_driver_arguments(args.args_json, args.arg)
+ arguments = prepare_arguments_for_output(tool, arguments, args.output)
+ errors = sorted(
+ Draft7Validator(schemas[tool]).iter_errors(arguments),
+ key=lambda error: tuple(error.path),
+ )
+ assert not errors, f"{command}: {[error.message for error in errors]}"
+ covered_tools.add(tool)
+
+ assert covered_tools == set(COMPUTER_CLI_TOOLS.values())
+ assert len(commands) == len(COMPUTER_CLI_TOOLS)
+ assert re.findall(
+ r"vibe computer clipboard read[^\n]*",
+ skill,
+ ) == ["vibe computer clipboard read --arg include_text=true"]
+
+ documented_flags = set(re.findall(r"(?<![\w-])--[a-z][a-z-]*", skill))
+ assert documented_flags == {
+ "--arg",
+ "--args-json",
+ "--json",
+ "--output",
+ }
+ parser.parse_args(
+ [
+ "computer",
+ "observe",
+ "windows",
+ "--args-json",
+ '{"on_screen_only":true}',
+ "--json",
+ ]
+ )
+ with pytest.raises(SystemExit):
+ parser.parse_args(["computer", "observe", "apps", "--session-id", "manual"])
+
+
def test_computer_help_uses_the_configured_backend_locale(
monkeypatch: pytest.MonkeyPatch,
) -> None:
@@ -182,23 +252,64 @@ def test_cmd_computer_binds_the_caller_session_and_prints_structured_result(
assert payload["result"]["content"][0]["type"] == "text"
+ ("argv", "expected_tool", "expected_arguments"),
+ [
+ (
+ ["observe", "window", "--arg", "pid=7", "--arg", "window_id=9"],
+ "get_window_state",
+ {"pid": 7, "window_id": 9},
+ ),
+ (
+ [
+ "zoom",
+ "--arg",
+ "pid=7",
+ "--arg",
+ "window_id=9",
+ "--arg",
+ "x1=0",
+ "--arg",
+ "y1=0",
+ "--arg",
+ "x2=100",
+ "--arg",
+ "y2=100",
+ ],
+ "zoom",
+ {
+ "pid": 7,
+ "window_id": 9,
+ "x1": 0,
+ "y1": 0,
+ "x2": 100,
+ "y2": 100,
+ },
+ ),
+ ],
+)
def test_cmd_computer_reports_driver_error_before_writing_screenshot(
monkeypatch: pytest.MonkeyPatch,
capsys,
tmp_path: Path,
+ argv: list[str],
+ expected_tool: str,
+ expected_arguments: dict,
) -> None:
monkeypatch.setenv("AVIBE_SESSION_ID", "ses-cli")
monkeypatch.setattr(cli, "_configured_cli_language", lambda: "zh")
+ output_path = tmp_path / f"{expected_tool}.png"
def fake_computer_use_sync(**kwargs):
- assert kwargs["arguments"]["screenshot_out_file"] == str(
- (tmp_path / "missing.png").resolve()
- )
+ assert kwargs["tool"] == expected_tool
+ if expected_tool == "get_window_state":
+ expected_arguments["screenshot_out_file"] = str(output_path.resolve())
+ assert kwargs["arguments"] == expected_arguments
return {
"status_code": 200,
"body": {
"ok": False,
- "tool": "get_window_state",
+ "tool": expected_tool,
"result": {
"isError": True,
"content": [
@@ -221,20 +332,99 @@ def test_cmd_computer_reports_driver_error_before_writing_screenshot(
with patch("vibe.internal_client.computer_use_sync", fake_computer_use_sync):
args = cli.build_parser().parse_args(
- [
- "computer",
- "observe",
- "window",
- "--output",
- str(tmp_path / "missing.png"),
- ]
+ ["computer", *argv, "--output", str(output_path)]
)
assert cli.cmd_computer(args) == 1
output = capsys.readouterr().out
assert "桌面正被另一个 Avibe Session 使用" in output
assert "desktop is held" not in output
- assert not (tmp_path / "missing.png").exists()
+ assert not output_path.exists()
+
+
+ ("status", "reason", "zh_status", "zh_reason"),
+ [
+ ("off", "toggle_off", "未开启", "原生电脑操作开关已关闭"),
+ (
+ "needs_permission",
+ "screen_recording",
+ "需要系统权限",
+ "缺少屏幕录制权限",
+ ),
+ ("starting", None, "桌面驱动正在启动", "未提供原因"),
+ ],
+)
+def test_human_unavailable_error_localizes_structured_status_and_reason(
+ status: str,
+ reason: str | None,
+ zh_status: str,
+ zh_reason: str,
+) -> None:
+ result = {
+ "isError": True,
+ "content": [
+ {
+ "type": "text",
+ "text": json.dumps(
+ {
+ "code": "computer_use_unavailable",
+ "params": {"status": status, "reason": reason},
+ }
+ ),
+ }
+ ],
+ }
+
+ output = format_human_result(
+ "list_apps",
+ result,
+ translate=lambda key, **kwargs: i18n_t(key, "zh", **kwargs),
+ )
+
+ assert f"状态={status}:{zh_status}" in output
+ assert zh_reason in output
+ assert "Computer use is not ready" not in output
+ assert "permission is required" not in output
+
+
+def test_json_unavailable_error_keeps_code_and_params(
+ monkeypatch: pytest.MonkeyPatch,
+ capsys,
+) -> None:
+ monkeypatch.setenv("AVIBE_SESSION_ID", "ses-cli")
+ body = {
+ "ok": False,
+ "tool": "list_apps",
+ "result": {
+ "isError": True,
+ "content": [
+ {
+ "type": "text",
+ "text": json.dumps(
+ {
+ "code": "computer_use_unavailable",
+ "params": {
+ "status": "needs_permission",
+ "reason": "screen_recording",
+ },
+ }
+ ),
+ }
+ ],
+ },
+ }
+
+ with patch(
+ "vibe.internal_client.computer_use_sync",
+ lambda **_kwargs: {"status_code": 200, "body": body},
+ ):
+ args = cli.build_parser().parse_args(
+ ["computer", "observe", "apps", "--json"]
+ )
+ assert cli.cmd_computer(args) == 1
+
+ assert json.loads(capsys.readouterr().out) == body
def test_cmd_computer_localizes_controller_error_in_zh(
diff --git a/tests/test_computer_server.py b/tests/test_computer_server.py
index fe9d9d55c..3b8e9fe76 100644
--- a/tests/test_computer_server.py
+++ b/tests/test_computer_server.py
@@ -549,24 +549,30 @@ async def test_failed_explicit_end_keeps_session_observations_and_real_lease(
@pytest.mark.asyncio
-async def test_retire_session_releases_state_and_an_orphaned_lease(
+async def test_retire_session_releases_an_inactive_proxy_owned_lease_without_starting_driver(
tmp_path: Path,
) -> None:
state_path, state = _state(tmp_path)
leases = DesktopLeaseManager(tmp_path)
- upstream = FakeUpstream()
+ starts = 0
+
+ async def upstream_factory(_state):
+ nonlocal starts
+ starts += 1
+ return FakeUpstream()
+
server = ComputerUseServer(
state_path=state_path,
status_reader=lambda: ComputerUseStatus("ready", None, state),
- upstream_factory=lambda _state: asyncio.sleep(0, result=upstream),
+ upstream_factory=upstream_factory,
lease_manager=leases,
)
- await server.call_tool("list_apps", {"session": "ses-a"})
- upstream.tool_errors.add("end_session")
+ leases.acquire("ses-a", state.daemon_key, lambda: state.daemon_key)
retired = await server.retire_session("ses-a")
- assert retired["isError"] is True
+ assert retired["isError"] is False
+ assert starts == 0
assert "ses-a" not in server._sessions
assert "ses-a" not in server._session_locks
assert leases.acquire(
@@ -576,6 +582,46 @@ async def test_retire_session_releases_state_and_an_orphaned_lease(
).lease.holder == "ses-b"
+async def test_retire_session_preserves_a_replacement_lease_holder(
+ tmp_path: Path,
+) -> None:
+ state_path, first_state = _state(tmp_path)
+ leases = DesktopLeaseManager(tmp_path)
+ server = ComputerUseServer(
+ state_path=state_path,
+ status_reader=lambda: ComputerUseStatus("ready", None, first_state),
+ upstream_factory=lambda _state: pytest.fail("retirement started a driver"),
+ lease_manager=leases,
+ )
+
+ leases.acquire(
+ "ses-retired",
+ first_state.daemon_key,
+ lambda: first_state.daemon_key,
+ )
+ replacement_key = (first_state.instance_id, first_state.generation + 1)
+ replacement = leases.acquire(
+ "ses-replacement",
+ replacement_key,
+ lambda: replacement_key,
+ ).lease
+
+ retired = await server.retire_session("ses-retired")
+
+ assert retired["isError"] is False
+ assert leases.refresh(replacement) is True
+ with pytest.raises(
+ ComputerServerError,
+ match="Desktop computer use is held by another Avibe Session",
+ ):
+ leases.acquire(
+ "ses-other",
+ replacement_key,
+ lambda: replacement_key,
+ )
+
+
@pytest.mark.asyncio
async def test_explicit_start_forwards_options_and_normalized_session(
tmp_path: Path,
diff --git a/tests/test_desktop_computer_capabilities.py b/tests/test_desktop_computer_capabilities.py
index 3aeba94d4..66f216bba 100644
--- a/tests/test_desktop_computer_capabilities.py
+++ b/tests/test_desktop_computer_capabilities.py
@@ -199,6 +199,49 @@ def test_workbench_status_supports_shell_started_runtime_from_the_same_state_sou
assert response.headers["Cache-Control"] == "no-store"
+ ("controller_identity", "expected_status", "expected_reason"),
+ [
+ ({"service": "vibe-remote-internal"}, "ready", None),
+ (None, "unavailable", "controller_unavailable"),
+ ],
+)
+def test_workbench_ready_status_reflects_controller_ipc_health(
+ monkeypatch,
+ controller_identity,
+ expected_status,
+ expected_reason,
+) -> None:
+ monkeypatch.setattr(ui_server, "desktop_computer_use_shell_is_live", lambda: True)
+ monkeypatch.setattr(
+ ui_server,
+ "effective_computer_use_status",
+ lambda: ComputerUseStatus("ready", None),
+ )
+
+ async def controller_health():
+ return controller_identity
+
+ monkeypatch.setattr(
+ internal_client,
+ "health_identity",
+ controller_health,
+ )
+
+ response = app.test_client().get(
+ "/api/desktop/computer-use/status",
+ base_url="http://127.0.0.1:5123",
+ )
+
+ assert response.status_code == 200
+ assert response.get_json() == {
+ "supported": True,
+ "status": expected_status,
+ "reason": expected_reason,
+ }
+ assert response.headers["Cache-Control"] == "no-store"
+
+
def test_workbench_status_hides_computer_use_without_live_native_shell(
monkeypatch,
) -> None:
diff --git a/ui/src/components/workbench/ComputerUseStatusLine.test.tsx b/ui/src/components/workbench/ComputerUseStatusLine.test.tsx
index 6d9372236..00e052221 100644
--- a/ui/src/components/workbench/ComputerUseStatusLine.test.tsx
+++ b/ui/src/components/workbench/ComputerUseStatusLine.test.tsx
@@ -84,6 +84,7 @@ describe('computerUseStatusCopy', () => {
['snapshot_invalid', 'snapshotInvalidDetail'],
['shell_not_running', 'shellNotRunningDetail'],
['daemon_unreachable', 'daemonUnreachableDetail'],
+ ['controller_unavailable', 'controllerUnavailableDetail'],
])('maps unavailable reason %s to dedicated localized remediation', (reason, key) => {
const detail = computerUseStatusCopy(
{ status: 'unavailable', reason },
@@ -103,6 +104,11 @@ describe('computerUseStatusCopy', () => {
(key) => key,
).detail).toBe('workbench.home.computerUse.unavailableDetail');
});
+
+ it('keeps Controller-unavailable remediation aligned in both locales', () => {
+ expect(en.workbench.home.computerUse.controllerUnavailableDetail).toContain('Controller');
+ expect(zh.workbench.home.computerUse.controllerUnavailableDetail).toContain('Controller');
+ });
});
describe('ComputerUseStatusLine', () => {
@@ -142,4 +148,26 @@ describe('ComputerUseStatusLine', () => {
});
expect(screen.queryByTestId('computer-use-status')).toBeNull();
});
+
+ it('renders Controller IPC failure as unavailable instead of ready', async () => {
+ apiFetch.mockResolvedValue({
+ ok: true,
+ json: async () => ({
+ supported: true,
+ status: 'unavailable',
+ reason: 'controller_unavailable',
+ }),
+ });
+
+ render(<ComputerUseStatusLine />);
+
+ await waitFor(() => {
+ expect(screen.getByTestId('computer-use-status')).toBeTruthy();
+ });
+ expect(screen.getByTestId('computer-use-status').getAttribute('data-computer-use-status')).toBe(
+ 'unavailable',
+ );
+ expect(screen.getByText('workbench.home.computerUse.controllerUnavailableDetail')).toBeTruthy();
+ expect(screen.queryByText('workbench.home.computerUse.readyDetail')).toBeNull();
+ });
});
diff --git a/ui/src/components/workbench/computerUseStatusCopy.ts b/ui/src/components/workbench/computerUseStatusCopy.ts
index e223a21fc..0eea73360 100644
--- a/ui/src/components/workbench/computerUseStatusCopy.ts
+++ b/ui/src/components/workbench/computerUseStatusCopy.ts
@@ -36,6 +36,7 @@ export type ComputerUseCopyKey =
| 'workbench.home.computerUse.snapshotInvalidDetail'
| 'workbench.home.computerUse.shellNotRunningDetail'
| 'workbench.home.computerUse.daemonUnreachableDetail'
+ | 'workbench.home.computerUse.controllerUnavailableDetail'
| 'workbench.home.computerUse.off'
| 'workbench.home.computerUse.offDetail';
@@ -62,6 +63,7 @@ const unavailableDetailKeys: Record<string, ComputerUseCopyKey> = {
snapshot_invalid: 'workbench.home.computerUse.snapshotInvalidDetail',
shell_not_running: 'workbench.home.computerUse.shellNotRunningDetail',
daemon_unreachable: 'workbench.home.computerUse.daemonUnreachableDetail',
+ controller_unavailable: 'workbench.home.computerUse.controllerUnavailableDetail',
};
export const computerUseStatusCopy = (
diff --git a/ui/src/i18n/en.json b/ui/src/i18n/en.json
index 5dae5a305..817588d3e 100644
--- a/ui/src/i18n/en.json
+++ b/ui/src/i18n/en.json
@@ -2966,6 +2966,7 @@
"snapshotInvalidDetail": "The verified Computer Use tool snapshot is missing or changed. Update or reinstall the Avibe desktop app.",
"shellNotRunningDetail": "Open or reopen the Avibe desktop app to make Computer Use available.",
"daemonUnreachableDetail": "The desktop driver is not reachable. Turn Computer Use off and on; reopen Avibe if it repeats.",
+ "controllerUnavailableDetail": "The Avibe Controller is not reachable. Wait for the service to recover before using the Computer Use CLI.",
"socketPathTooLongDetail": "macOS could not create the managed driver socket. Update or reinstall the Avibe desktop app."
},
"continueOnPhone": "Continue on your phone",
diff --git a/ui/src/i18n/zh.json b/ui/src/i18n/zh.json
index a13511d76..f2b9cb728 100644
--- a/ui/src/i18n/zh.json
+++ b/ui/src/i18n/zh.json
@@ -2966,6 +2966,7 @@
"snapshotInvalidDetail": "已验证的电脑操作工具快照缺失或发生变化。请更新或重新安装 Avibe 桌面应用。",
"shellNotRunningDetail": "请打开或重新打开 Avibe 桌面应用,以使用电脑操作。",
"daemonUnreachableDetail": "桌面驱动当前无法连接。请关闭并重新开启电脑操作;如果问题重复出现,请重新打开 Avibe。",
+ "controllerUnavailableDetail": "当前无法连接 Avibe Controller。请等待服务恢复后再使用电脑操作 CLI。",
"socketPathTooLongDetail": "macOS 无法创建受管理的驱动端点。请更新或重新安装 Avibe 桌面应用。"
},
"continueOnPhone": "在手机 APP 上继续",
diff --git a/vibe/i18n/en.json b/vibe/i18n/en.json
index 80913b38b..2a483dc3d 100644
--- a/vibe/i18n/en.json
+++ b/vibe/i18n/en.json
@@ -874,7 +874,7 @@
"invalidResponse": "Computer Use service returned an invalid response.",
"requestRejected": "Computer Use request was rejected.",
"activeTurnRequired": "Computer Use requires the caller's active Avibe Turn.",
- "computerUseUnavailable": "Computer Use is currently unavailable.",
+ "computerUseUnavailable": "Computer Use is currently unavailable (status={statusCode}: {status}; reason={reasonCode}: {reason}).",
"desktopBusy": "The desktop is busy with another Avibe Session.",
"desktopLeaseLost": "The desktop lease was lost before Computer Use completed.",
"focusShortcutForbidden": "This focus shortcut is not allowed. Use launch with a URL instead.",
@@ -892,6 +892,44 @@
"upstreamUnavailable": "The Computer Use driver is unavailable. Observe again before retrying.",
"windowTargetRequired": "Input must target an exact observed window or element."
},
+ "status": {
+ "off": "off",
+ "needsPermission": "permission is required",
+ "needsRuntime": "the Avibe service is not ready",
+ "starting": "the desktop driver is starting",
+ "error": "the desktop driver reported an error",
+ "stopped": "the desktop shell stopped",
+ "unavailable": "the desktop state is unavailable",
+ "unknown": "unknown status ({code})"
+ },
+ "reason": {
+ "neverEnabled": "Computer Use has never been enabled",
+ "toggleOff": "the native Computer Use toggle is off",
+ "accessibility": "Accessibility permission is missing",
+ "screenRecording": "Screen Recording permission is missing",
+ "runtimeUnavailable": "the Avibe service is restarting or unavailable",
+ "runtimeTooOld": "the Avibe service does not support this Computer Use contract",
+ "stateUnwritable": "the native state could not be saved",
+ "assetsInvalid": "the managed driver assets failed verification",
+ "spawnFailed": "the managed driver could not start",
+ "daemonExited": "the managed driver exited",
+ "healthTimeout": "the managed driver health check timed out",
+ "bundleIdentity": "the managed driver could not verify the Avibe app",
+ "axCapability": "the managed driver cannot use Accessibility",
+ "captureFailed": "the managed driver cannot capture the screen",
+ "driverHealthFailed": "the managed driver health check failed",
+ "endpointBusy": "another desktop shell owns the driver endpoint",
+ "endpointUnremovable": "the old driver endpoint could not be replaced",
+ "socketUnreachable": "the managed driver socket is unreachable",
+ "socketPathTooLong": "the managed driver socket path is too long",
+ "invalidStateFile": "the native Computer Use state is invalid",
+ "snapshotInvalid": "the verified tool snapshot is missing or changed",
+ "shellNotRunning": "the Avibe desktop shell is not running",
+ "daemonUnreachable": "the managed driver is unreachable",
+ "daemonGenerationChanged": "the managed driver changed during admission",
+ "none": "no reason was reported",
+ "unknown": "unknown reason ({code})"
+ },
"hint": {
"invalidArguments": "Check the command syntax and run `vibe computer --help` for the Computer Use contract.",
"missingCallerSession": "Run this command from an Avibe Agent Turn. The command binds to its Session automatically and has no --session-id option.",
diff --git a/vibe/i18n/zh.json b/vibe/i18n/zh.json
index 1ddf358a7..bb5461af3 100644
--- a/vibe/i18n/zh.json
+++ b/vibe/i18n/zh.json
@@ -874,7 +874,7 @@
"invalidResponse": "Computer Use 服务返回了无效响应。",
"requestRejected": "Computer Use 请求被拒绝。",
"activeTurnRequired": "Computer Use 要求调用方当前有活动的 Avibe Turn。",
- "computerUseUnavailable": "Computer Use 当前不可用。",
+ "computerUseUnavailable": "Computer Use 当前不可用(状态={statusCode}:{status};原因={reasonCode}:{reason})。",
"desktopBusy": "桌面正被另一个 Avibe Session 使用。",
"desktopLeaseLost": "Computer Use 完成前桌面租约已丢失。",
"focusShortcutForbidden": "不允许使用可能切换焦点的快捷键,请改用带 URL 的 launch。",
@@ -892,6 +892,44 @@
"upstreamUnavailable": "Computer Use driver 不可用,请重新观察后再重试。",
"windowTargetRequired": "输入必须针对已观察的精确窗口或元素。"
},
+ "status": {
+ "off": "未开启",
+ "needsPermission": "需要系统权限",
+ "needsRuntime": "Avibe 服务尚未就绪",
+ "starting": "桌面驱动正在启动",
+ "error": "桌面驱动报告错误",
+ "stopped": "桌面应用已停止",
+ "unavailable": "桌面状态不可用",
+ "unknown": "未知状态({code})"
+ },
+ "reason": {
+ "neverEnabled": "从未开启过电脑操作",
+ "toggleOff": "原生电脑操作开关已关闭",
+ "accessibility": "缺少辅助功能权限",
+ "screenRecording": "缺少屏幕录制权限",
+ "runtimeUnavailable": "Avibe 服务正在重启或不可用",
+ "runtimeTooOld": "Avibe 服务不支持当前电脑操作协议",
+ "stateUnwritable": "无法保存原生状态",
+ "assetsInvalid": "受管理的驱动资源验证失败",
+ "spawnFailed": "受管理的驱动无法启动",
+ "daemonExited": "受管理的驱动已退出",
+ "healthTimeout": "受管理的驱动健康检查超时",
+ "bundleIdentity": "受管理的驱动无法验证 Avibe 应用",
+ "axCapability": "受管理的驱动无法使用辅助功能",
+ "captureFailed": "受管理的驱动无法捕获屏幕",
+ "driverHealthFailed": "受管理的驱动健康检查失败",
+ "endpointBusy": "另一个桌面进程正在占用驱动端点",
+ "endpointUnremovable": "无法替换旧的驱动端点",
+ "socketUnreachable": "无法连接受管理的驱动端点",
+ "socketPathTooLong": "受管理的驱动端点路径过长",
+ "invalidStateFile": "原生电脑操作状态无效",
+ "snapshotInvalid": "已验证的工具快照缺失或发生变化",
+ "shellNotRunning": "Avibe 桌面应用未运行",
+ "daemonUnreachable": "无法连接受管理的驱动",
+ "daemonGenerationChanged": "请求准入期间受管理的驱动发生变化",
+ "none": "未提供原因",
+ "unknown": "未知原因({code})"
+ },
"hint": {
"invalidArguments": "请检查命令语法,并运行 `vibe computer --help` 查看 Computer Use 约定。",
"missingCallerSession": "请在 Avibe Agent Turn 中运行此命令。命令会自动绑定当前 Session,不支持 --session-id。",
diff --git a/vibe/ui_server.py b/vibe/ui_server.py
index 145000487..78fe439de 100644
--- a/vibe/ui_server.py
+++ b/vibe/ui_server.py
@@ -52,6 +52,7 @@ from vibe.ui_compat import (
from config import paths
from config.v2_config import CONFIG_LOCK, V2Config
from core.computer_use import (
+ ComputerUseStatus,
desktop_computer_use_shell_is_live,
effective_computer_use_status,
)
@@ -3382,6 +3383,8 @@ async def desktop_capabilities():
async def desktop_computer_use_status():
"""Read the shell/daemon status from the shared desktop state contract."""
+ from vibe import internal_client
+
if not _desktop_computer_use_supported():
response_payload = jsonify(
{
@@ -3394,6 +3397,8 @@ async def desktop_computer_use_status():
return response_payload
status = await asyncio.to_thread(effective_computer_use_status)
+ if status.status == "ready" and await internal_client.health_identity() is None:
+ status = ComputerUseStatus("unavailable", "controller_unavailable")
response_payload = jsonify(
{
"supported": True,