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(i18n): localize vibe doctor output (#1721)
Call Whiteb6fddccb1d5d
diff --git a/core/tmux_runtime.py b/core/tmux_runtime.pyindex b719363f2..1a097b27e 100644--- a/core/tmux_runtime.py+++ b/core/tmux_runtime.py@@ -55,6 +55,7 @@ _TMUX_SPEC = ManagedRuntimeSpec(replace_invalid_target_on_repair=True,include_manifest_digest_in_install_fingerprint=True,)+TMUX_BINARY_PREPARATION_FAILURE_REASONS = frozenset({"xattr_failed"})class TmuxRuntimeManager(ManagedRuntimeManager):@@ -84,6 +85,11 @@ class TmuxRuntimeManager(ManagedRuntimeManager):offline=env_flag_enabled("VIBE_TMUX_OFFLINE") if offline is None else offline,)+ def install_failure_reasons(self) -> frozenset[str]:+ """Return every failure identity emitted by the tmux installer."""++ return self._base_install_failure_reasons() | TMUX_BINARY_PREPARATION_FAILURE_REASONS+def _parse_manifest(self, payload: bytes, *, loaded_from: str) -> ManagedRuntimeManifest | None:"""Read released schema-1 manifests that predate binary digests."""diff --git a/tests/test_doctor_i18n.py b/tests/test_doctor_i18n.pynew file mode 100644index 000000000..1dbf5df54--- /dev/null+++ b/tests/test_doctor_i18n.py@@ -0,0 +1,706 @@+"""Structural and behavioral guards for the complete ``vibe doctor`` surface."""++from __future__ import annotations++import ast+import json+import re+from datetime import datetime, timezone+from pathlib import Path++import pytest++from core.install_integrity import IntegrityResult+from core.tmux_runtime import TmuxRuntimeManager+from vibe import cli+from vibe.i18n import get_supported_languages, t+from vibe.restart_supervisor import RestartState+++REPO_ROOT = Path(__file__).resolve().parents[1]+I18N_DIR = REPO_ROOT / "vibe" / "i18n"+DOCTOR_SOURCE = REPO_ROOT / "vibe" / "cli.py"+RESTART_SOURCE = REPO_ROOT / "vibe" / "restart_supervisor.py"+++def _flatten(value: object, prefix: str = "") -> dict[str, str]:+ if not isinstance(value, dict):+ return {prefix: str(value)}+ flattened: dict[str, str] = {}+ for key, child in value.items():+ path = f"{prefix}.{key}" if prefix else str(key)+ flattened.update(_flatten(child, path))+ return flattened+++def _doctor_bundle(language: str) -> dict[str, str]:+ payload = json.loads((I18N_DIR / f"{language}.json").read_text(encoding="utf-8"))+ return _flatten(payload["doctor"], "doctor")+++def _is_i18n_expression(node: ast.AST, *, allow_none: bool = False) -> bool:+ if isinstance(node, ast.Call):+ return isinstance(node.func, ast.Name) and node.func.id == "i18n_t"+ if isinstance(node, ast.IfExp):+ return _is_i18n_expression(node.body) and _is_i18n_expression(+ node.orelse,+ allow_none=allow_none,+ )+ return allow_none and isinstance(node, ast.Constant) and node.value is None+++def _assert_doctor_namespace(node: ast.AST) -> None:+ if isinstance(node, ast.IfExp):+ _assert_doctor_namespace(node.body)+ _assert_doctor_namespace(node.orelse)+ return+ if not isinstance(node, ast.Call) or not isinstance(node.func, ast.Name):+ return+ if node.func.id != "i18n_t" or not node.args:+ return+ key = node.args[0]+ if isinstance(key, ast.Constant) and isinstance(key.value, str):+ assert key.value.startswith("doctor."), f"Doctor copy escaped its namespace: {key.value}"+++def test_doctor_calls_route_every_user_visible_argument_through_i18n() -> None:+ """The rule is structural so a new call cannot silently add English copy."""++ source = DOCTOR_SOURCE.read_text(encoding="utf-8")+ tree = ast.parse(source, filename=str(DOCTOR_SOURCE))+ for node in ast.walk(tree):+ if not isinstance(node, ast.Call) or not isinstance(node.func, ast.Name):+ continue+ if node.func.id == "_add_doctor_item":+ assert len(node.args) >= 3+ assert _is_i18n_expression(node.args[2]), f"message at line {node.lineno} is not i18n_t"+ _assert_doctor_namespace(node.args[2])+ if len(node.args) >= 4:+ assert _is_i18n_expression(node.args[3], allow_none=True), (+ f"action at line {node.lineno} is not i18n_t"+ )+ _assert_doctor_namespace(node.args[3])+ elif node.func.id == "_doctor_repair_result":+ assert len(node.args) >= 3+ assert _is_i18n_expression(node.args[2]), (+ f"repair message at line {node.lineno} is not i18n_t"+ )+ _assert_doctor_namespace(node.args[2])+++def test_doctor_bundles_have_identical_keys_and_interpolation() -> None:+ en = _doctor_bundle("en")+ zh = _doctor_bundle("zh")+ assert set(en) == set(zh)++ placeholder = re.compile(r"\{([a-zA-Z_][a-zA-Z0-9_]*)\}")+ for key, english in en.items():+ names = set(placeholder.findall(english))+ for language in get_supported_languages():+ rendered = t(key, language, **{name: f"sample-{name}" for name in names})+ assert rendered != key+ assert not placeholder.search(rendered), f"unresolved placeholder in {language}:{key}"+++def test_doctor_finite_vocabulary_has_one_projection_owner() -> None:+ assert set(cli.DOCTOR_DISPLAY_PROJECTIONS) == {+ "tunnel_state",+ "tunnel_grade",+ "tunnel_protocol",+ "download_kind",+ "repair_reason",+ "repair_suffix",+ "restart_state",+ "show_runtime_provider",+ }+ for projection in cli.DOCTOR_DISPLAY_PROJECTIONS.values():+ assert projection+ assert all(key.startswith("doctor.") for key in projection.values())++ assert cli._doctor_display_value("future-state", "tunnel_state", "zh") == "未知"+ assert cli._doctor_display_value("future-kind", "download_kind", "zh") == "未知"+++def test_restart_state_owner_drives_producer_retention_display_and_tests(+ monkeypatch: pytest.MonkeyPatch,+ tmp_path: Path,+) -> None:+ projection = cli.DOCTOR_DISPLAY_PROJECTIONS["restart_state"]+ assert set(projection) == {state.value for state in RestartState}++ status_path = tmp_path / "restart.json"+ status_path.write_text("{}", encoding="utf-8")+ monkeypatch.setattr(cli.time, "time", lambda: status_path.stat().st_mtime + 3600)+ for state in RestartState:+ expected_stale = state.retention is not None+ assert cli._restart_status_is_stale({"state": state.value}, status_path) is expected_stale+ for language in ("en", "zh"):+ assert cli._doctor_display_value(state.value, "restart_state", language) == t(+ projection[state.value], language+ )+++def test_restart_producer_cannot_bypass_owned_state_vocabulary() -> None:+ tree = ast.parse(RESTART_SOURCE.read_text(encoding="utf-8"), filename=str(RESTART_SOURCE))+ bypasses: list[int] = []+ for node in ast.walk(tree):+ if isinstance(node, ast.Dict):+ for key, value in zip(node.keys, node.values):+ if (+ isinstance(key, ast.Constant)+ and key.value == "state"+ and isinstance(value, ast.Constant)+ and isinstance(value.value, str)+ ):+ bypasses.append(value.lineno)+ elif isinstance(node, ast.keyword) and node.arg == "state":+ if isinstance(node.value, ast.Constant) and isinstance(node.value.value, str):+ bypasses.append(node.value.lineno)+ elif isinstance(node, ast.Assign) and isinstance(node.value, ast.Constant):+ for target in node.targets:+ if (+ isinstance(target, ast.Subscript)+ and isinstance(target.slice, ast.Constant)+ and target.slice.value == "state"+ and isinstance(node.value.value, str)+ ):+ bypasses.append(node.value.lineno)+ assert not bypasses, f"restart state literal bypassed RestartState at lines {bypasses}"+++def test_tmux_failure_reasons_are_producer_owned_and_doctor_projected(tmp_path: Path) -> None:+ manager = TmuxRuntimeManager(runtime_dir=tmp_path / "tmux")+ reasons = manager.install_failure_reasons()+ assert "tmux_install_missing_binary" in reasons+ assert "xattr_failed" in reasons++ for reason in reasons:+ key = cli._doctor_managed_reason_key(reason)+ assert key is not None, f"Doctor has no display projection for {reason}"+ for language in ("en", "zh"):+ detail = cli._doctor_managed_failure_detail("tmux", {"reason": reason}, language)+ assert detail+ assert reason not in detail+++ ("reason", "english_marker", "chinese_marker"),+ [+ (+ "tmux_install_missing_binary",+ "archive did not contain its binary",+ "归档不包含其二进制文件",+ ),+ (+ "xattr_failed",+ "metadata could not be updated",+ "无法更新 tmux 二进制元数据",+ ),+ ],+)+def test_tmux_actual_failure_spellings_render_in_both_languages(+ reason: str,+ english_marker: str,+ chinese_marker: str,+) -> None:+ result = {"ok": False, "reason": reason}++ english = cli._doctor_managed_failure_detail("tmux", result, "en")+ chinese = cli._doctor_managed_failure_detail("tmux", result, "zh")++ assert english_marker in english+ assert chinese_marker in chinese+ assert reason not in english+ assert reason not in chinese+ assert result["reason"] == reason+++ ("language", "integrity", "message_marker", "action_marker"),+ [+ ("en", IntegrityResult(ok=True, checked_files=7), "files are intact (7 checked)", None),+ ("zh", IntegrityResult(ok=True, checked_files=7), "文件完整(已检查 7 个)", None),+ (+ "en",+ IntegrityResult(ok=False, checked_files=7, failures=("bad/path.py",)),+ "integrity check failed: bad/path.py",+ "Rerun the Avibe installer",+ ),+ (+ "zh",+ IntegrityResult(ok=False, checked_files=7, failures=("bad/path.py",)),+ "完整性检查失败:bad/path.py",+ "重新运行 Avibe 安装器",+ ),+ ],+)+def test_package_integrity_doctor_items_are_localized(+ monkeypatch: pytest.MonkeyPatch,+ tmp_path: Path,+ language: str,+ integrity: IntegrityResult,+ message_marker: str,+ action_marker: str | None,+) -> None:+ site_packages = tmp_path / "site-packages"+ (site_packages / "avibe_os-1.0.dist-info").mkdir(parents=True)+ active_vibe = (Path.home() / ".local" / "bin" / "vibe").resolve()+ monkeypatch.setattr(cli, "_configured_cli_language", lambda: language)+ monkeypatch.setattr(cli, "_path_entries_for_executable", lambda _name: [active_vibe])+ monkeypatch.setattr(cli, "_uv_tool_site_packages_for_vibe", lambda _path: [site_packages])+ monkeypatch.setattr(cli, "_is_uv_tool_editable", lambda _path: False)+ monkeypatch.setattr(cli, "_current_sqlite_revision", lambda: None)+ monkeypatch.setattr(cli, "verify_site_packages", lambda _path: integrity)++ item = next(+ item+ for item in cli._local_cli_installation_items()+ if item.get("code") == "installation.package_integrity"+ )++ assert item["status"] == ("pass" if integrity.ok else "fail")+ assert message_marker in item["message"]+ if action_marker is None:+ assert "action" not in item+ else:+ assert action_marker in item["action"]+++ ("language", "state_marker", "field_markers"),+ [+ ("en", "state=error", ("error=disk full", "trigger=upgrade", "job_id=job-1", "log=/tmp/restart.log")),+ ("zh", "状态=错误", ("错误=disk full", "触发来源=upgrade", "任务 ID=job-1", "日志=/tmp/restart.log")),+ ],+)+def test_restart_failure_summary_localizes_labels_and_preserves_raw_payload(+ monkeypatch: pytest.MonkeyPatch,+ tmp_path: Path,+ language: str,+ state_marker: str,+ field_markers: tuple[str, ...],+) -> None:+ payload = {+ "ok": False,+ "state": RestartState.ERROR.value,+ "error": "disk\nfull",+ "trigger": "upgrade",+ "job_id": "job-1",+ "log_path": "/tmp/restart.log",+ }+ original = dict(payload)+ status_path = tmp_path / "restart.json"+ status_path.write_text("{}", encoding="utf-8")+ monkeypatch.setattr(cli, "_configured_cli_language", lambda: language)+ monkeypatch.setattr(cli.runtime, "get_restart_status_path", lambda: status_path)+ monkeypatch.setattr(cli.runtime, "read_json", lambda _path: payload)+ monkeypatch.setattr(cli.runtime, "verified_service_running", lambda: False)++ item = cli._restart_state_items()[0]++ assert item["code"] == "runtime.restart_failed"+ assert state_marker in item["message"]+ assert all(marker in item["message"] for marker in field_markers)+ assert payload == original+ if language == "zh":+ assert "state=error" not in item["message"]++[email protected](("language", "missing_marker"), [("en", "missing"), ("zh", "缺失")])+def test_service_pid_sentinel_is_localized_only_at_rendering_boundary(+ monkeypatch: pytest.MonkeyPatch,+ tmp_path: Path,+ language: str,+ missing_marker: str,+) -> None:+ monkeypatch.setattr(cli, "_configured_cli_language", lambda: language)+ monkeypatch.setattr(cli.paths, "get_runtime_pid_path", lambda: tmp_path / "absent.pid")+ monkeypatch.setattr(cli.runtime, "resolve_service_owner_pid", lambda **_kwargs: 4242)+ monkeypatch.setattr(cli.runtime, "service_lock_holder_pid", lambda: 4242)+ monkeypatch.setattr(cli.runtime, "read_status", lambda: {"service_pid": None})++ items = cli._service_lifecycle_items(detect_extra_processes=False)++ mismatch_codes = {+ "runtime.service_pidfile_mismatch",+ "runtime.status_pid_mismatch",+ }+ mismatches = [item for item in items if item.get("code") in mismatch_codes]+ assert {item["code"] for item in mismatches} == mismatch_codes+ assert all(missing_marker in item["message"] for item in mismatches)+ if language == "zh":+ assert all("missing" not in item["message"] for item in mismatches)+++ ("language", "attempt_marker"),+ [("en", "after 3 attempts"), ("zh", "经过 3 次尝试")],+)+def test_dependency_attempt_copy_reports_total_attempts(language: str, attempt_marker: str) -> None:+ item = t(+ "doctor.item.dependencyHttpErrorRetried",+ language,+ label="tmux",+ status=503,+ attempts=3,+ url="https://example.test/tmux.tgz",+ )+ repair = t("doctor.repair.dependencyDownloadNetwork", language, attempts=3)++ assert attempt_marker in item+ assert ("3 attempts" if language == "en" else "3 次尝试") in repair+ if language == "zh":+ assert "重试 3 次" not in item+ assert "已重试 3 次" not in repair+++def test_restart_recovery_action_preserves_branch_semantics_in_both_languages() -> None:+ english = t("doctor.action.restartFailed", "en")+ chinese = t("doctor.action.restartFailed", "zh")++ assert "stops a process holding no lock and brings the service up" in english+ assert "if the failed process holds the lock itself, and then repeat the start above" in english+ assert "停止未持有锁的进程并启动服务" in chinese+ assert "若失败进程持有锁,则运行 `vibe stop`,然后重试上述启动命令" in chinese+++def test_doctor_dependency_status_stays_machine_data_and_out_of_sentence(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ monkeypatch.setattr(+ cli.api,+ "dependencies_status",+ lambda **_kwargs: {+ "deps": [+ {"id": "askill", "required": True, "installed": False, "status": "missing"},+ {"id": "avault", "required": True, "installed": False, "status": "error"},+ {+ "id": "tmux",+ "required": False,+ "installed": False,+ "status": "upgrade_required",+ },+ ]+ },+ )+ monkeypatch.setattr(cli.api, "askill_auto_install_supported", lambda: True)+ monkeypatch.setattr(cli, "_configured_cli_language", lambda: "zh")++ items = cli._managed_dependencies_doctor_items(deep=False)++ expected = {+ "dependencies.askill.not_ready": "missing",+ "dependencies.avault.not_ready": "error",+ "dependencies.tmux.not_ready": "upgrade_required",+ }+ for code, raw_status in expected.items():+ item = next(item for item in items if item.get("code") == code)+ assert item["dependency_status"] == raw_status+ assert raw_status not in item["message"]+ assert all("尚未就绪" in item["message"] for item in items if item.get("code") in expected)+++ ("probe_reason", "label_marker", "english_label"),+ [+ ("runtime_manifest_download_failed", "Show Runtime 清单", "Show Runtime manifest"),+ ("runtime_archive_download_failed", "Show Runtime 归档", "Show Runtime archive"),+ ],+)+def test_show_runtime_download_labels_are_localized(+ monkeypatch: pytest.MonkeyPatch,+ probe_reason: str,+ label_marker: str,+ english_label: str,+) -> None:+ from types import SimpleNamespace++ manager = SimpleNamespace(+ status=lambda: {+ "provider": "manifest-cache",+ "platform": "darwin-arm64",+ "manifest": {"runtime_version": "test"},+ "archive": {"name": "show-runtime.tgz"},+ "explicit_command": None,+ "node_available": True,+ },+ probe_archive_reachability=lambda: {+ "ok": False,+ "checked": True,+ "reason": probe_reason,+ "download_error": {"kind": "http", "http_status": 503, "attempts": 2},+ },+ archive_cache_status=lambda: None,+ )+ monkeypatch.setattr("core.show_runtime.ShowRuntimeManager", lambda **kwargs: manager)+ monkeypatch.setattr(cli, "_configured_cli_language", lambda: "zh")++ items = cli._show_runtime_doctor_items(deep=True)+ message = "\n".join(item["message"] for item in items)+ assert label_marker in message+ assert english_label not in message+++def test_doctor_uses_real_chinese_path_and_stable_code(monkeypatch: pytest.MonkeyPatch) -> None:+ monkeypatch.setenv(cli.paths.AVIBE_HOME_ENV, "/tmp/avibe-doctor-home")+ rendered: dict[str, list[dict]] = {}+ for language in ("en", "zh"):+ monkeypatch.setattr(cli, "_configured_cli_language", lambda language=language: language)+ rendered[language] = cli._home_migration_items()++ items = rendered["zh"]++ assert items[0]["code"] == "runtime.explicit_home"+ assert "已显式设置" in items[0]["message"]+ assert "runtime.explicit_home" not in items[0]["message"]+ assert [item["code"] for item in rendered["en"]] == [item["code"] for item in rendered["zh"]]+++def test_doctor_localizes_nested_repair_details_and_missing_payload_values(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ monkeypatch.setattr(cli, "_configured_cli_language", lambda: "zh")++ repaired = cli._repair_managed_dependency(+ "avault",+ lambda force: {+ "ok": True,+ "changed": True,+ "version": "0.1.6",+ "message": "English installer completed",+ },+ )+ assert "English installer completed" not in repaired["message"]+ assert "0.1.6" in repaired["message"]+ assert "修复完成" in repaired["message"]++ failures = [+ (+ "askill",+ {+ "ok": False,+ "reason": "askill_auto_install_unsupported",+ "required_tools": ["curl", "bash"],+ "message": "askill auto-install needs curl + bash",+ },+ "自动安装需要",+ ),+ (+ "avault",+ {+ "ok": False,+ "reason": "avault_checksum_mismatch",+ "expected_sha256": "expected",+ "actual_sha256": "actual",+ "message": "checksum verification failed",+ },+ "校验和验证失败",+ ),+ ]+ for target, result, marker in failures:+ failed = cli._repair_managed_dependency(target, lambda force, result=result: result)+ assert marker in failed["message"]+ assert result["reason"] not in failed["message"]++ download = cli._repair_managed_dependency(+ "git-runtime",+ lambda force: {+ "ok": False,+ "reason": "git_archive_download_failed",+ "download_error": {"kind": "dns", "attempts": 3},+ "message": "raw download copy",+ },+ )+ assert "DNS 查询失败" in download["message"]+ assert "dns" not in download["message"]+ unknown_download = cli._repair_managed_dependency(+ "tmux",+ lambda force: {+ "ok": False,+ "reason": "tmux_archive_download_failed",+ "download_error": {"kind": "future-kind", "attempts": 1},+ },+ )+ assert "future-kind" not in unknown_download["message"]++ items: list[dict] = []+ cli._add_dependency_download_failure(+ items,+ {"kind": "timeout", "attempts": 2},+ label="avault",+ code_prefix="dependencies.avault.download",+ repair_target=None,+ )+ assert "the selected dependency URL" not in items[0]["message"]+ assert "所选依赖 URL" in items[0]["message"]+ assert items[0]["download_kind"] == "timeout"++ from types import SimpleNamespace++ manager = SimpleNamespace(+ status=lambda: {+ "provider": "manifest-cache",+ "platform": None,+ "manifest": {"runtime_version": "test"},+ "archive": None,+ "explicit_command": None,+ "node_available": False,+ },+ archive_cache_status=lambda: None,+ )+ monkeypatch.setattr("core.show_runtime.ShowRuntimeManager", lambda **kwargs: manager)+ runtime_items = cli._show_runtime_doctor_items()+ messages = "\n".join(item["message"] for item in runtime_items)+ assert "this platform" not in messages+ assert "当前平台" in messages+++ ("shape", "expected_key"),+ [+ ("requests_unavailable", "tunnelQualityRequestsUnavailable"),+ ("latency", "tunnelQualityLatency"),+ ("rtt_unavailable", "tunnelQualityRttUnavailable"),+ ("rtt", "tunnelQualityRtt"),+ ],+)+def test_doctor_tunnel_quality_projects_every_finite_value(+ monkeypatch: pytest.MonkeyPatch,+ tmp_path: Path,+ shape: str,+ expected_key: str,+) -> None:+ config = cli.V2Config.default()+ config.language = "zh"+ config.remote_access.vibe_cloud.enabled = True+ config_path = tmp_path / "config.json"+ config_path.write_text("{}", encoding="utf-8")+ monkeypatch.setattr(cli.paths, "get_config_path", lambda: config_path)+ monkeypatch.setattr(cli.paths, "get_runtime_doctor_path", lambda: tmp_path / "doctor.json")+ monkeypatch.setattr(cli.V2Config, "load", lambda *_args, **_kwargs: config)+ monkeypatch.setattr(cli, "_home_migration_items", lambda: [])+ monkeypatch.setattr(cli, "_service_lifecycle_items", lambda **_kwargs: [])+ monkeypatch.setattr(cli, "_service_install_family_items", lambda **_kwargs: [])+ monkeypatch.setattr(cli, "_restart_state_items", lambda: [])+ monkeypatch.setattr(cli, "_runtime_architecture_items", lambda: [])+ monkeypatch.setattr(cli, "_show_git_checkpoint_items", lambda: [])+ monkeypatch.setattr(cli, "_managed_dependencies_doctor_items", lambda **_kwargs: [])+ monkeypatch.setattr(cli, "_show_runtime_doctor_items", lambda **_kwargs: [])+ monkeypatch.setattr(cli, "_local_cli_installation_items", lambda: [])+ monkeypatch.setattr(cli.api, "detect_cli", lambda *_args, **_kwargs: {})+ monkeypatch.setattr(+ cli.paths,+ "get_logs_dir",+ lambda: tmp_path / "logs",+ )+ monkeypatch.setattr(+ "vibe.remote_access.status",+ lambda _config: {+ "running": True,+ "tunnel_quality": {+ "state": "degraded",+ "grade": "poor",+ "protocol": "quic",+ "sampled_at": datetime.now(timezone.utc).isoformat(),+ **(+ {+ "request_path": {+ "status": "unavailable",+ "confidence": "high",+ "success_count": 0,+ "sample_count": 4,+ }+ }+ if shape == "requests_unavailable"+ else {+ "request_path": {+ "status": "ok",+ "confidence": "high",+ "success_count": 4,+ "sample_count": 4,+ "latency_ms": {"p95": 100, "p99": 200},+ "slow_request_rate": {"over_1000_ms": 0.25},+ }+ }+ if shape == "latency"+ else {"rtt_ms": {"median": 10, "max": 20}}+ if shape == "rtt"+ else {}+ ),+ },+ },+ )+ monkeypatch.setattr(+ "vibe.remote_access.tunnel_quality.request_path_has_usable_latency",+ lambda request_path: bool(request_path and request_path.get("latency_ms")),+ )+ monkeypatch.setattr(cli, "_configured_cli_language", lambda: "zh")++ result = cli._doctor()+ remote_group = next(group for group in result["groups"] if group["name"] == t("doctor.group.remoteAccess", "zh"))+ shape_marker = {+ "tunnelQualityRequestsUnavailable": "远程请求不可用",+ "tunnelQualityLatency": "远程请求 P95",+ "tunnelQualityRttUnavailable": "没有边缘 RTT",+ "tunnelQualityRtt": "边缘 RTT 中位数",+ }[expected_key]+ item = next(item for item in remote_group["items"] if shape_marker in item["message"])+ assert "降级" in item["message"]+ assert item["tunnel_state"] == "degraded"+ assert item["tunnel_grade"] == "poor"+ assert item["tunnel_protocol"] == "quic"+ if expected_key != "tunnelQualityRttUnavailable":+ assert "较差" in item["message"]+ if expected_key != "tunnelQualityRtt":+ assert "QUIC" in item["message"]+++ ("value_type", "values"),+ [+ ("state", ("healthy", "degraded", "recovering", "unknown")),+ ("grade", ("good", "fair", "poor", "critical", "unknown")),+ ("protocol", ("quic", "http2", "unknown")),+ ],+)+def test_doctor_tunnel_display_projection_covers_producer_enums(+ value_type: str,+ values: tuple[str, ...],+) -> None:+ expected = {+ "state": ("健康", "降级", "恢复中", "未知"),+ "grade": ("良好", "一般", "较差", "严重", "未知"),+ "protocol": ("QUIC", "HTTP/2", "未知"),+ }[value_type]+ for raw_value, localized_value in zip(values, expected):+ assert cli._doctor_tunnel_display_value(raw_value, value_type, "zh") == localized_value+++def test_managed_repair_failure_contract_has_structured_identity(+ monkeypatch: pytest.MonkeyPatch,+ tmp_path: Path,+) -> None:+ monkeypatch.setattr(cli.api, "resolve_cli_path", lambda _binary: None)+ monkeypatch.setattr(cli.api, "_configured_avault_cli_path", lambda: "avault")+ monkeypatch.setattr("platform.system", lambda: "FreeBSD")+ monkeypatch.setattr("platform.machine", lambda: "riscv64")+ producer_failures = {+ "askill": cli.api.install_askill(),+ "avault": cli.api.install_avault(),+ }+ from core.git_runtime import GitRuntimeManager+ producer_failures.update(+ {+ "tmux": TmuxRuntimeManager(runtime_dir=tmp_path / "tmux")._failure(+ "tmux_archive_unavailable"+ ),+ "git-runtime": GitRuntimeManager(runtime_dir=tmp_path / "git")._failure("git_archive_unavailable"),+ }+ )+ for target, result in producer_failures.items():+ assert result.get("ok") is False+ assert result.get("reason") or result.get("download_error")+ repaired = cli._repair_managed_dependency(target, lambda force, result=result: result)+ assert repaired["status"] == "failed"+ assert repaired["reason"] == result["reason"]+ assert "message" in repaired and repaired["message"]diff --git a/tests/test_local_deps.py b/tests/test_local_deps.pyindex 2b87f29ff..0f035059a 100644--- a/tests/test_local_deps.py+++ b/tests/test_local_deps.py@@ -193,6 +193,49 @@ def test_askill_install_command_does_not_persist_agent_cli_path(monkeypatch):assert config_loads == []+def test_shared_install_runner_failures_have_structured_identity(monkeypatch):+ class FailedPopen:+ returncode = 17++ def __init__(self, *args, **kwargs):+ pass++ def communicate(self, timeout=None):+ return "", "installer stderr"++ monkeypatch.setattr(api.subprocess, "Popen", FailedPopen)+ failed = api._run_install_command("askill", ["bash"], lambda value: value)+ assert failed["reason"] == "askill_install_failed"+ assert failed["exit_code"] == 17++ class ErrorPopen:+ def __init__(self, *args, **kwargs):+ raise OSError("runner unavailable")++ monkeypatch.setattr(api.subprocess, "Popen", ErrorPopen)+ errored = api._run_install_command("askill", ["bash"], lambda value: value)+ assert errored["reason"] == "askill_install_error"+ assert errored["error"] == "runner unavailable"++ class TimedOutPopen:+ returncode = 0++ def __init__(self, *args, **kwargs):+ self.calls = 0++ def communicate(self, timeout=None):+ self.calls += 1+ if self.calls == 1:+ raise api.subprocess.TimeoutExpired(["bash"], timeout)+ return "partial", ""++ monkeypatch.setattr(api.subprocess, "Popen", TimedOutPopen)+ monkeypatch.setattr(api, "signal_process_tree", lambda *args, **kwargs: None)+ timed_out = api._run_install_command("askill", ["bash"], lambda value: value)+ assert timed_out["reason"] == "askill_install_timeout"+ assert timed_out["timeout_seconds"] == 300++def test_install_askill_unsupported_without_curl(monkeypatch):# No curl/bash (e.g. Windows): no broken npm fallback — a clear manual# message pointing at askill.sh, and _run_install_command is never invoked.@@ -201,6 +244,8 @@ def test_install_askill_unsupported_without_curl(monkeypatch):out = api.install_askill()assert out["ok"] is Falseassert "askill.sh" in out["message"]+ assert out["reason"] == "askill_auto_install_unsupported"+ assert out["required_tools"] == ["curl", "bash"]def test_install_askill_unsupported_on_windows_even_with_tools(monkeypatch):@@ -212,6 +257,7 @@ def test_install_askill_unsupported_on_windows_even_with_tools(monkeypatch):assert out["ok"] is Falseassert "askill.sh" in out["message"]+ assert out["reason"] == "askill_auto_install_unsupported"def test_ensure_askill_idempotent_when_present(monkeypatch):@@ -244,6 +290,8 @@ def test_ensure_askill_install_not_discoverable_is_failure(monkeypatch):monkeypatch.setattr(api, "install_askill", lambda: {"ok": True})out = api.ensure_askill_installed()assert out["ok"] is False and out["installed"] is False and out["path"] is None+ assert out["reason"] == "askill_install_path_missing"+ assert out["expected_path"] == "askill"def test_ensure_askill_force_reinstalls_even_when_present(monkeypatch):@@ -324,6 +372,8 @@ def test_install_avault_unsupported_platform_is_clear_failure(monkeypatch):assert out["ok"] is Falseassert "no avault build for FreeBSD-riscv64" in out["message"]+ assert out["reason"] == "avault_platform_unsupported"+ assert out["platform"] == "FreeBSD-riscv64"def test_install_avault_force_keeps_existing_binary_on_unsupported_platform(monkeypatch):@@ -431,9 +481,30 @@ def test_install_avault_checksum_mismatch_installs_nothing(monkeypatch):installed = api.Path.home() / ".local" / "bin" / "avault"assert out["ok"] is Falseassert "checksum" in out["message"]+ assert out["reason"] == "avault_checksum_mismatch"+ assert out["expected_sha256"] == "0" * 64+ assert len(out["actual_sha256"]) == 64assert not installed.exists()+def test_install_avault_generic_failure_has_structured_identity(monkeypatch):+ monkeypatch.setattr(api, "_configured_avault_cli_path", lambda: "avault")+ monkeypatch.setattr(api, "resolve_cli_path", lambda _binary: None)+ monkeypatch.setattr("platform.system", lambda: "Darwin")+ monkeypatch.setattr("platform.machine", lambda: "arm64")+ monkeypatch.setattr(+ api,+ "_download_avault_release_file",+ lambda _url: (_ for _ in ()).throw(ValueError("invalid manifest")),+ )++ out = api.install_avault()++ assert out["ok"] is False+ assert out["reason"] == "avault_install_failed"+ assert out["error"] == "invalid manifest"++def test_install_avault_is_idempotent_when_present(monkeypatch):monkeypatch.setattr(api, "_configured_avault_cli_path", lambda: "avault")monkeypatch.setattr(api.shutil, "which", lambda _binary: None)diff --git a/vibe/api.py b/vibe/api.pyindex 9f7d540ef..7f3475ead 100644--- a/vibe/api.py+++ b/vibe/api.py@@ -7260,7 +7260,13 @@ def _run_install_command(stdout, stderr = process.communicate(timeout=10)output = (stdout or "") + ("\n" + stderr if stderr else "")output = truncate_output(output.strip())- return {"ok": False, "message": f"{mode.capitalize()} timed out", "output": output or None}+ return {+ "ok": False,+ "message": f"{mode.capitalize()} timed out",+ "reason": f"{name}_{mode}_timeout",+ "timeout_seconds": 300,+ "output": output or None,+ }result = subprocess.CompletedProcess(cmd, process.returncode, stdout, stderr)output = result.stdout + ("\n" + result.stderr if result.stderr else "")output = truncate_output(output.strip())@@ -7332,11 +7338,19 @@ def _run_install_command(return {"ok": False,"message": f"{mode.capitalize()} failed (exit code {result.returncode})",+ "reason": f"{name}_{mode}_failed",+ "exit_code": result.returncode,"output": output,}except Exception as e:logger.error("Agent %s %s error: %s", name, mode, e)- return {"ok": False, "message": str(e), "output": None}+ return {+ "ok": False,+ "message": str(e),+ "reason": f"{name}_{mode}_error",+ "error": str(e),+ "output": None,+ }# =============================================================================@@ -7458,9 +7472,14 @@ def install_askill() -> dict:# No npm fallback: askill is distributed via the askill.sh installer, not a# public npm package, so a curl/bash-less host (e.g. Windows) must install# it manually rather than hit a guaranteed-failing `npm i -g`.+ import platform+return {"ok": False,"message": "askill auto-install needs curl + bash (macOS/Linux). Install it manually from https://askill.sh.",+ "reason": "askill_auto_install_unsupported",+ "required_tools": ["curl", "bash"],+ "platform": platform.system() or "unknown","output": None,}@@ -7492,6 +7511,8 @@ def ensure_askill_installed(force: bool = False) -> dict:result["path"] = resolvedif result.get("ok") and not installed:result["ok"] = False+ result["reason"] = "askill_install_path_missing"+ result["expected_path"] = "askill"result["message"] = (result.get("message") or "askill installed but was not found on PATH; restart the service or check PATH.")@@ -7679,6 +7700,8 @@ def install_avault(force: bool = False) -> dict:return {"ok": False,"message": backend_t("dependencies.avault.noBuild", platform=platform_label),+ "reason": "avault_platform_unsupported",+ "platform": platform_label,"output": None,"path": None,}@@ -7701,6 +7724,11 @@ def install_avault(force: bool = False) -> dict:return {"ok": False,"message": backend_t("dependencies.avault.checksumMismatch"),+ "reason": "avault_checksum_mismatch",+ "expected_sha256": expected_sha256,+ "actual_sha256": actual_sha256,+ "platform": target,+ "url": archive_url,"output": f"expected {expected_sha256}, got {actual_sha256}","path": None,}@@ -7732,6 +7760,9 @@ def install_avault(force: bool = False) -> dict:result = {"ok": False,"message": backend_t("dependencies.avault.installFailed", error=str(exc)),+ "reason": "avault_install_failed",+ "error": str(exc),+ "platform": platform_label,"output": None,"path": None,}@@ -7811,6 +7842,8 @@ def ensure_avault_installed(force: bool = False) -> dict:result["path"] = resolvedif result.get("ok") and not installed:result["ok"] = False+ result["reason"] = "avault_install_path_missing"+ result["expected_path"] = "avault"result["message"] = (result.get("message") or backend_t("dependencies.avault.installedNotFound"))diff --git a/vibe/cli.py b/vibe/cli.pyindex 03cbfa28e..dee077add 100644--- a/vibe/cli.py+++ b/vibe/cli.py@@ -63,7 +63,7 @@ from core.watches import ()from vibe import __version__, api, runtimefrom vibe.i18n import normalize_language, t as i18n_t-from vibe.restart_supervisor import schedule_restart+from vibe.restart_supervisor import RestartState, schedule_restartfrom vibe.screenshot import ScreenshotError, capture_screenshotfrom vibe.upgrade import (CURRENT_VIBE_EXECUTABLE_ENV,@@ -133,16 +133,99 @@ DOCTOR_REPAIR_TARGETS = ()DOCTOR_DEFAULT_REPAIR_TARGETS = DOCTOR_REPAIR_TARGETS[:4]DOCTOR_DEPENDENCY_REPAIR_TARGETS = frozenset(DOCTOR_REPAIR_TARGETS[4:])-DOCTOR_REPAIR_DRY_RUN_MESSAGES = {- "home-migration": "Would migrate ~/.vibe_remote to ~/.avibe when safe, or recreate the legacy compatibility symlink.",- "stale-install-runtime": "Would stop a running legacy vibe-remote service and start the current Avibe service.",- "duplicate-service-processes": "Would stop extra Avibe service processes outside the service lock.",- "stale-restart-state": "Would remove stale restart metadata and refresh runtime status.",- "askill": "Would install or refresh askill with the official installer.",- "avault": "Would install or refresh the manifest-pinned avault release.",- "git-runtime": "Would install or refresh the manifest-pinned Git Runtime.",- "show-runtime": "Would prepare the manifest-pinned Show Runtime archive when it is missing or invalid.",- "tmux": "Would install or refresh the manifest-pinned tmux runtime.",+DOCTOR_REPAIR_DRY_RUN_I18N_KEYS = {+ "home-migration": "doctor.repair.dryHomeMigration",+ "stale-install-runtime": "doctor.repair.dryStaleInstall",+ "duplicate-service-processes": "doctor.repair.dryDuplicateProcesses",+ "stale-restart-state": "doctor.repair.dryStaleRestart",+ "askill": "doctor.repair.dryAskill",+ "avault": "doctor.repair.dryAvault",+ "git-runtime": "doctor.repair.dryGitRuntime",+ "show-runtime": "doctor.repair.dryShowRuntime",+ "tmux": "doctor.repair.dryTmux",+}++DOCTOR_DISPLAY_PROJECTIONS = {+ "tunnel_state": {+ "healthy": "doctor.value.tunnelStateHealthy",+ "degraded": "doctor.value.tunnelStateDegraded",+ "recovering": "doctor.value.tunnelStateRecovering",+ "unknown": "doctor.value.tunnelStateUnknown",+ },+ "tunnel_grade": {+ "good": "doctor.value.tunnelGradeGood",+ "fair": "doctor.value.tunnelGradeFair",+ "poor": "doctor.value.tunnelGradePoor",+ "critical": "doctor.value.tunnelGradeCritical",+ "unknown": "doctor.value.tunnelGradeUnknown",+ },+ "tunnel_protocol": {+ "quic": "doctor.value.tunnelProtocolQuic",+ "http2": "doctor.value.tunnelProtocolHttp2",+ "unknown": "doctor.value.tunnelProtocolUnknown",+ },+ "download_kind": {+ "http": "doctor.repair.dependencyDownloadHttp",+ "dns": "doctor.repair.dependencyDownloadDns",+ "tls": "doctor.repair.dependencyDownloadTls",+ "timeout": "doctor.repair.dependencyDownloadTimeout",+ "network": "doctor.repair.dependencyDownloadNetwork",+ "permission": "doctor.repair.dependencyDownloadPermission",+ "disk": "doctor.repair.dependencyDownloadDisk",+ "io": "doctor.repair.dependencyDownloadIo",+ },+ "repair_reason": {+ "askill_auto_install_unsupported": "doctor.repair.askillAutoInstallUnsupported",+ "askill_install_path_missing": "doctor.repair.askillInstallPathMissing",+ "askill_install_timeout": "doctor.repair.installTimeout",+ "askill_install_failed": "doctor.repair.installCommandFailed",+ "askill_install_error": "doctor.repair.installError",+ "avault_platform_unsupported": "doctor.repair.avaultPlatformUnsupported",+ "avault_checksum_mismatch": "doctor.repair.avaultChecksumMismatch",+ "avault_install_path_missing": "doctor.repair.avaultInstallPathMissing",+ "avault_install_failed": "doctor.repair.avaultInstallFailed",+ "avault_download_failed": "doctor.repair.dependencyArchiveDownloadFailed",+ "avault_p2_release_unavailable": "doctor.repair.avaultReleaseUnavailable",+ "git_runtime_unpublished": "doctor.repair.dependencyManifestUnavailable",+ },+ "repair_suffix": {+ "install_already_running": "doctor.repair.dependencyAlreadyRunning",+ "platform_unsupported": "doctor.repair.dependencyPlatformUnsupported",+ "manifest_missing": "doctor.repair.dependencyManifestMissing",+ "manifest_invalid": "doctor.repair.dependencyManifestInvalid",+ "manifest_unavailable": "doctor.repair.dependencyManifestUnavailable",+ "manifest_unavailable_offline": "doctor.repair.dependencyManifestUnavailable",+ "manifest_download_failed": "doctor.repair.dependencyManifestDownloadFailed",+ "manifest_url_unsupported": "doctor.repair.dependencyManifestUnavailable",+ "archive_unavailable": "doctor.repair.dependencyArchiveUnavailable",+ "archive_unavailable_offline": "doctor.repair.dependencyArchiveUnavailable",+ "archive_url_unsupported": "doctor.repair.dependencyArchiveUnavailable",+ "archive_download_failed": "doctor.repair.dependencyArchiveDownloadFailed",+ "archive_checksum_mismatch": "doctor.repair.dependencyArchiveVerificationFailed",+ "archive_size_mismatch": "doctor.repair.dependencyArchiveVerificationFailed",+ "binary_checksum_mismatch": "doctor.repair.dependencyBinaryVerificationFailed",+ "binary_not_runnable": "doctor.repair.dependencyBinaryNotRunnable",+ "binary_prepare_failed": "doctor.repair.dependencyBinaryPrepareFailed",+ "install_missing_binary": "doctor.repair.dependencyInstallMissingBinary",+ "install_failed": "doctor.repair.installError",+ "install_lock_failed": "doctor.repair.dependencyInstallLockFailed",+ "install_claim_failed": "doctor.repair.dependencyInstallClaimFailed",+ "install_target_changed": "doctor.repair.dependencyInstallTargetChanged",+ "pointer_write_failed": "doctor.repair.dependencyPointerWriteFailed",+ "codesign_missing": "doctor.repair.dependencyCodeSignMissing",+ "codesign_failed": "doctor.repair.dependencyCodeSignFailed",+ "codesign_verify_failed": "doctor.repair.dependencyCodeSignFailed",+ "xattr_failed": "doctor.repair.dependencyMetadataFailed",+ },+ "restart_state": {+ state.value: f"doctor.value.restartState{state.name.title()}" for state in RestartState+ },+ "show_runtime_provider": {+ "manifest-cache": "doctor.value.showRuntimeProviderManifest",+ "archive": "doctor.value.showRuntimeProviderArchive",+ "npm": "doctor.value.showRuntimeProviderNpm",+ "unknown": "doctor.value.showRuntimeProviderUnknown",+ },}DEFAULT_VAULT_APPROVAL_WAIT_SECONDS = 9 * 60@@ -1019,47 +1102,48 @@ def _architecture_token(text: str | None) -> str | None:def _runtime_architecture_items() -> list[dict[str, str]]:items: list[dict[str, str]] = []+ language = _configured_cli_language()+ unknown_value = i18n_t("doctor.value.unknown", language)is_apple_silicon = _is_apple_silicon_host()- host_arch = "Apple Silicon" if is_apple_silicon else platform.machine() or "unknown"- python_arch = platform.machine() or "unknown"+ host_arch = "Apple Silicon" if is_apple_silicon else platform.machine() or unknown_value+ python_arch = platform.machine() or unknown_valuepython_status = "warn" if is_apple_silicon and _architecture_token(python_arch) == "x86_64" else "pass"- python_item = {- "status": python_status,- "message": f"Python runtime architecture: {python_arch} ({sys.executable})",- }+ _add_doctor_item(+ items,+ python_status,+ i18n_t("doctor.item.pythonArchitecture", language, architecture=python_arch, executable=sys.executable),+ )if python_status == "warn":- python_item["action"] = "Reinstall Avibe with native arm64 uv/Python"- items.append(python_item)+ items[-1]["action"] = i18n_t("doctor.action.nativeArmPython", language)uv_path = shutil.which("uv")if uv_path:uv_arch_output = _binary_architecture(uv_path)uv_arch = _architecture_token(uv_arch_output) or "unknown"+ uv_display_arch = unknown_value if uv_arch == "unknown" else uv_archuv_status = "warn" if is_apple_silicon and uv_arch in {"x86_64", "unknown"} else "pass"- uv_item = {- "status": uv_status,- "message": f"uv architecture: {uv_arch} ({uv_path})",- }+ _add_doctor_item(+ items,+ uv_status,+ i18n_t("doctor.item.uvArchitecture", language, architecture=uv_display_arch, path=uv_path),+ )if is_apple_silicon and uv_arch == "x86_64":- uv_item["action"] = "Install native arm64 uv, then reinstall Avibe"+ items[-1]["action"] = i18n_t("doctor.action.nativeArmUv", language)elif is_apple_silicon and uv_arch == "unknown":- uv_item["action"] = "Check whether this uv wrapper launches native arm64 uv"- items.append(uv_item)+ items[-1]["action"] = i18n_t("doctor.action.nativeUvWrapper", language)else:- items.append(- {- "status": "warn",- "message": "uv command not found on PATH",- "action": "Install uv or add its bin directory to PATH",- }+ _add_doctor_item(+ items,+ "warn",+ i18n_t("doctor.item.uvMissing", language),+ i18n_t("doctor.action.uvMissing", language),)- items.append(- {- "status": "pass",- "message": f"Host architecture: {host_arch}",- }+ _add_doctor_item(+ items,+ "pass",+ i18n_t("doctor.item.hostArchitecture", language, architecture=host_arch),)return items@@ -1079,12 +1163,17 @@ def _path_points_to(path: Path, target: Path) -> bool:def _home_migration_items() -> list[dict]:items: list[dict] = []+ language = _configured_cli_language()explicit_home = os.environ.get(paths.AVIBE_HOME_ENV)if explicit_home:_add_doctor_item(items,"pass",- f"AVIBE_HOME is set explicitly: {Path(explicit_home).expanduser()}",+ i18n_t(+ "doctor.item.explicitHome",+ language,+ path=Path(explicit_home).expanduser(),+ ),code="runtime.explicit_home",)return items@@ -1098,7 +1187,7 @@ def _home_migration_items() -> list[dict]:_add_doctor_item(items,"pass",- f"Default runtime home is ready to initialize at {avibe_home}",+ i18n_t("doctor.item.homeReady", language, path=avibe_home),code="runtime.home_ready",)return items@@ -1108,15 +1197,20 @@ def _home_migration_items() -> list[dict]:_add_doctor_item(items,"pass",- f"Legacy home compatibility symlink is healthy: {legacy_home} -> {avibe_home}",+ i18n_t(+ "doctor.item.legacyHomeLinkHealthy",+ language,+ legacy_path=legacy_home,+ active_path=avibe_home,+ ),code="runtime.legacy_home_link_ok",)elif not legacy_present:_add_doctor_item(items,"warn",- f"Legacy home compatibility path is missing: {legacy_home}",- "Run `vibe doctor repair home-migration` to create the compatibility symlink.",+ i18n_t("doctor.item.legacyHomeLinkMissing", language, path=legacy_home),+ i18n_t("doctor.action.homeMigrationCreateLink", language),code="runtime.legacy_home_link_missing",repair_target="home-migration",repair_risk="low",@@ -1125,8 +1219,8 @@ def _home_migration_items() -> list[dict]:_add_doctor_item(items,"warn",- f"Legacy home symlink does not point to the active home: {legacy_home}",- "Run `vibe doctor repair home-migration` to recreate the compatibility symlink.",+ i18n_t("doctor.item.legacyHomeLinkWrong", language, path=legacy_home),+ i18n_t("doctor.action.homeMigrationRecreateLink", language),code="runtime.legacy_home_link_wrong",repair_target="home-migration",repair_risk="low",@@ -1135,8 +1229,13 @@ def _home_migration_items() -> list[dict]:_add_doctor_item(items,"fail",- f"Both {avibe_home} and {legacy_home} are real directories",- "Back up and merge the two homes manually before running repair.",+ i18n_t(+ "doctor.item.homeConflict",+ language,+ active_path=avibe_home,+ legacy_path=legacy_home,+ ),+ i18n_t("doctor.action.homeConflict", language),code="runtime.home_conflict",)return items@@ -1145,8 +1244,8 @@ def _home_migration_items() -> list[dict]:_add_doctor_item(items,"warn",- f"Legacy home symlink exists but canonical {avibe_home} is missing",- "Inspect the symlink target before repair; Avibe will not guess which state to keep.",+ i18n_t("doctor.item.legacyHomeWithoutCanonical", language, active_path=avibe_home),+ i18n_t("doctor.action.legacyHomeWithoutCanonical", language),code="runtime.legacy_home_symlink_without_canonical",)return items@@ -1154,8 +1253,8 @@ def _home_migration_items() -> list[dict]:_add_doctor_item(items,"warn",- f"Runtime home still uses the legacy path: {legacy_home}",- "Run `vibe doctor repair home-migration` to move it to ~/.avibe and keep a back-symlink.",+ i18n_t("doctor.item.legacyHomeUnmigrated", language, path=legacy_home),+ i18n_t("doctor.action.homeMigration", language),code="runtime.legacy_home_unmigrated",repair_target="home-migration",repair_risk="low",@@ -1200,6 +1299,7 @@ def _current_cli_install_family() -> str | None:def _service_install_family_items(*, detect_extra_processes: bool = True) -> list[dict]:items: list[dict] = []+ language = _configured_cli_language()current_family = _current_cli_install_family()owner_pid = runtime.resolve_service_owner_pid(include_starting=False)service_pids = [pid for pid in [owner_pid] if pid]@@ -1217,28 +1317,43 @@ def _service_install_family_items(*, detect_extra_processes: bool = True) -> lis_add_doctor_item(items,"warn",- "Running service process still comes from the legacy vibe-remote installation: "- f"pids={','.join(map(str, stale_pids))}",- "Run `vibe doctor repair stale-install-runtime` to stop the stale service and start the current Avibe install.",+ i18n_t(+ "doctor.item.staleInstallProcess",+ language,+ pids=",".join(map(str, stale_pids)),+ ),+ i18n_t("doctor.action.staleInstallRuntime", language),code="runtime.stale_install_process",repair_target="stale-install-runtime",repair_risk="medium",)elif owner_pid and current_family:- _add_doctor_item(items, "pass", f"No legacy install mismatch detected for running service: pid={owner_pid}")+ _add_doctor_item(+ items,+ "pass",+ i18n_t("doctor.item.installMismatchNone", language, pid=owner_pid),+ )elif owner_pid:- _add_doctor_item(items, "pass", f"Current CLI install family is not a uv tool install; skipped install mismatch check: pid={owner_pid}")+ _add_doctor_item(+ items,+ "pass",+ i18n_t("doctor.item.installMismatchSkipped", language, pid=owner_pid),+ )else:- _add_doctor_item(items, "pass", "No running service install mismatch detected")+ _add_doctor_item(items, "pass", i18n_t("doctor.item.installMismatchAbsent", language))return itemsdef _restart_status_is_stale(payload: dict, path: Path) -> bool:- state = payload.get("state")- if state in {"scheduled", "running"}:+ try:+ state = RestartState(payload.get("state"))+ except (TypeError, ValueError):+ return False++ if state.retention == "seed":return not restart_record_is_pending(payload, path, grace_seconds=DOCTOR_RESTART_SEED_GRACE_SECONDS)- if state in {"succeeded", "failed", "error", "cancelled"}:+ if state.retention == "result":try:age = time.time() - path.stat().st_mtimeexcept OSError:@@ -1247,7 +1362,7 @@ def _restart_status_is_stale(payload: dict, path: Path) -> bool:return False-def _restart_failure_summary(payload: dict) -> str:+def _restart_failure_summary(payload: dict, language: str) -> str:"""Describe a recorded restart failure on the single line doctor prints.Why it failed is the entire value of the item, so the recorded error is@@ -1255,22 +1370,35 @@ def _restart_failure_summary(payload: dict) -> str:because the report prints one line per item."""+ raw_state = payload.get("state") or RestartState.UNKNOWN.valuepairs = (- ("state", payload.get("state") or "unknown"),- ("error", " ".join(str(payload.get("error") or "").split())),- ("trigger", payload.get("trigger")),- ("job_id", payload.get("job_id")),- ("log", payload.get("log_path")),+ (+ "doctor.value.restartSummaryState",+ _doctor_display_value(raw_state, "restart_state", language),+ ),+ (+ "doctor.value.restartSummaryError",+ " ".join(str(payload.get("error") or "").split()),+ ),+ ("doctor.value.restartSummaryTrigger", payload.get("trigger")),+ ("doctor.value.restartSummaryJobId", payload.get("job_id")),+ ("doctor.value.restartSummaryLog", payload.get("log_path")),)- return " ".join(f"{name}={value}" for name, value in pairs if value)+ return " ".join(i18n_t(key, language, value=value) for key, value in pairs if value)def _restart_state_items() -> list[dict]:items: list[dict] = []+ language = _configured_cli_language()restart_path = runtime.get_restart_status_path()payload = runtime.read_json(restart_path) or {}if not payload:- _add_doctor_item(items, "pass", "No restart metadata is present", code="runtime.restart_state_absent")+ _add_doctor_item(+ items,+ "pass",+ i18n_t("doctor.item.restartStateAbsent", language),+ code="runtime.restart_state_absent",+ )return items# Both clauses are read now, from what is on disk and what is running now.@@ -1335,12 +1463,12 @@ def _restart_state_items() -> list[dict]:_add_doctor_item(items,"fail",- f"Last restart failed and no service is running: {_restart_failure_summary(payload)}",- "Read the restart log named above for the cause, then run `vibe start`. If that reports a "- "service already running, the failed generation is still occupying this instance: run "- "`vibe doctor repair duplicate-service-processes`, which stops a process holding no lock and "- "brings the service up, or `vibe stop` if the failed process holds the lock itself, and then "- "repeat the start above.",+ i18n_t(+ "doctor.item.restartFailed",+ language,+ summary=_restart_failure_summary(payload, language),+ ),+ i18n_t("doctor.action.restartFailed", language),code="runtime.restart_failed",)return items@@ -1350,20 +1478,36 @@ def _restart_state_items() -> list[dict]:_add_doctor_item(items,"warn",- f"Stale restart metadata is present: state={state}",- "Run `vibe doctor repair stale-restart-state` to clear the stale restart marker and refresh status.",+ i18n_t(+ "doctor.item.staleRestartState",+ language,+ state=_doctor_display_value(state, "restart_state", language),+ ),+ i18n_t("doctor.action.staleRestartState", language),code="runtime.stale_restart_state",repair_target="stale-restart-state",repair_risk="low",+ restart_state=state,)else:state = payload.get("state") or "unknown"- _add_doctor_item(items, "pass", f"Restart metadata is current: state={state}")+ _add_doctor_item(+ items,+ "pass",+ i18n_t(+ "doctor.item.restartStateCurrent",+ language,+ state=_doctor_display_value(state, "restart_state", language),+ ),+ restart_state=state,+ )return itemsdef _service_lifecycle_items(*, detect_extra_processes: bool = True) -> list[dict]:items: list[dict] = []+ language = _configured_cli_language()+ missing_value = i18n_t("doctor.value.missing", language)pid_path = paths.get_runtime_pid_path()recorded_pid: int | None = Nonetry:@@ -1377,43 +1521,63 @@ def _service_lifecycle_items(*, detect_extra_processes: bool = True) -> list[dicstatus_pid = status.get("service_pid")if owner_pid:- _add_doctor_item(items, "pass", f"Service lock owner: pid={owner_pid}", code="runtime.service_lock_owner")+ _add_doctor_item(+ items,+ "pass",+ i18n_t("doctor.item.serviceLockOwner", language, pid=owner_pid),+ code="runtime.service_lock_owner",+ )elif lock_holder_pid:_add_doctor_item(items,"warn",- f"Service lock is held by pid={lock_holder_pid}, but the owner could not be verified",- "Run `vibe status` and inspect service logs before starting another service.",+ i18n_t("doctor.item.serviceLockUnverified", language, pid=lock_holder_pid),+ i18n_t("doctor.action.serviceLockUnverified", language),code="runtime.unverified_service_lock",)else:- _add_doctor_item(items, "pass", "Service lock is free", code="runtime.service_lock_free")+ _add_doctor_item(+ items,+ "pass",+ i18n_t("doctor.item.serviceLockFree", language),+ code="runtime.service_lock_free",+ )if owner_pid and recorded_pid != owner_pid:_add_doctor_item(items,"warn",- f"Service pid file does not match the lock owner: pidfile={recorded_pid or 'missing'} lock_owner={owner_pid}",- "Run `vibe restart` once the current work is idle so Avibe can rewrite runtime ownership files.",+ i18n_t(+ "doctor.item.servicePidfileMismatch",+ language,+ pidfile=recorded_pid or missing_value,+ owner=owner_pid,+ ),+ i18n_t("doctor.action.servicePidfileMismatch", language),code="runtime.service_pidfile_mismatch",)elif recorded_pid:- _add_doctor_item(items, "pass", f"Service pid file points to pid={recorded_pid}")+ _add_doctor_item(items, "pass", i18n_t("doctor.item.servicePidfile", language, pid=recorded_pid))else:- _add_doctor_item(items, "pass", "Service pid file is absent")+ _add_doctor_item(items, "pass", i18n_t("doctor.item.servicePidfileAbsent", language))if owner_pid and status_pid != owner_pid:_add_doctor_item(items,"warn",- f"Runtime status service_pid does not match the lock owner: status={status_pid or 'missing'} lock_owner={owner_pid}",- "Refresh status; if it remains stale, restart Avibe when safe.",+ i18n_t(+ "doctor.item.statusPidMismatch",+ language,+ status=status_pid or missing_value,+ owner=owner_pid,+ ),+ i18n_t("doctor.action.statusPidMismatch", language),code="runtime.status_pid_mismatch",)elif status_pid:- _add_doctor_item(items, "pass", f"Runtime status service_pid: {status_pid}")+ _add_doctor_item(items, "pass", i18n_t("doctor.item.statusPid", language, pid=status_pid))else:- _add_doctor_item(items, "pass", "Runtime status service_pid is absent")+ _add_doctor_item(items, "pass", i18n_t("doctor.item.statusPidAbsent", language))if detect_extra_processes:extra_service_pids = runtime.extra_service_process_pids(owner_pid=owner_pid)@@ -1426,8 +1590,12 @@ def _service_lifecycle_items(*, detect_extra_processes: bool = True) -> list[dic_add_doctor_item(items,"warn",- f"Extra Avibe service process detected outside the service lock: pids={','.join(map(str, extra_service_pids))}",- "Run `vibe doctor repair duplicate-service-processes` to stop extra service processes.",+ i18n_t(+ "doctor.item.extraServiceProcess",+ language,+ pids=",".join(map(str, extra_service_pids)),+ ),+ i18n_t("doctor.action.duplicateServiceProcesses", language),code="runtime.extra_service_process",repair_target="duplicate-service-processes",repair_risk="medium",@@ -1436,18 +1604,22 @@ def _service_lifecycle_items(*, detect_extra_processes: bool = True) -> list[dic_add_doctor_item(items,"warn",- f"Possible extra Avibe service process could not be matched to AVIBE_HOME: pids={','.join(map(str, unverified_service_pids))}",- "Inspect the process environment before starting another service.",+ i18n_t(+ "doctor.item.unverifiedServiceProcess",+ language,+ pids=",".join(map(str, unverified_service_pids)),+ ),+ i18n_t("doctor.action.unverifiedServiceProcess", language),code="runtime.unverified_service_process",)else:- _add_doctor_item(items, "pass", "No extra Avibe service process detected")+ _add_doctor_item(items, "pass", i18n_t("doctor.item.noExtraServiceProcess", language))else:_add_doctor_item(items,"pass",- "Deep service process scan skipped in fast diagnostics",- "Run deep diagnostics to check duplicate service processes.",+ i18n_t("doctor.item.deepScanSkipped", language),+ i18n_t("doctor.action.deepScanSkipped", language),code="runtime.deep_service_process_scan_skipped",)@@ -1471,7 +1643,7 @@ def _show_git_checkpoint_items() -> list[dict]:return [{"status": "warn",- "message": "Show Page checkpointing is degraded because Git is unavailable",+ "message": i18n_t("doctor.item.showGitUnavailable", _configured_cli_language()),"code": "runtime.show_git_unavailable",}]@@ -10789,69 +10961,114 @@ def _add_dependency_download_failure(retry_action: str | None = None,failure_status: str = "fail",) -> None:+ language = _configured_cli_language()error = error or {}kind = str(error.get("kind") or "unknown")- url = str(error.get("url") or "the selected dependency URL")+ url = str(error.get("url") or i18n_t("doctor.value.selectedDependencyUrl", language))attempts = int(error.get("attempts") or 1)- attempt_text = f" after {attempts} attempts" if attempts > 1 else ""- retry_action = retry_action or f"Run `vibe doctor repair {repair_target}`."+ retry_action = retry_action or (+ i18n_t("doctor.action.repairCommand", _configured_cli_language(), target=repair_target)+ if repair_target+ else i18n_t("doctor.action.askillManual", _configured_cli_language())+ )if kind == "http" and error.get("http_status") == 404:_add_doctor_item(items,failure_status,- f"{label} release asset is missing (HTTP 404): {url}",- "Verify the exact URL from another network. If the release asset is absent, upgrade or reinstall Avibe; "- "if it works elsewhere, fix the proxy or security gateway.",+ i18n_t("doctor.item.dependencyHttp404", language, label=label, url=url),+ i18n_t("doctor.action.dependencyHttp404", language),code=f"{code_prefix}_http_404",+ download_kind=kind,)elif kind == "http":status = error.get("http_status") or "error"_add_doctor_item(items,failure_status,- f"{label} request returned HTTP {status}{attempt_text}: {url}",- f"Check the exact release asset and any proxy response. {retry_action}",+ i18n_t(+ "doctor.item.dependencyHttpErrorRetried"+ if attempts > 1+ else "doctor.item.dependencyHttpError",+ language,+ label=label,+ status=status,+ attempts=attempts,+ url=url,+ ),+ i18n_t("doctor.action.dependencyHttpError", language, retry=retry_action),code=f"{code_prefix}_http_error",+ download_kind=kind,)elif kind == "dns":_add_doctor_item(items,failure_status,- f"{label} host DNS lookup failed{attempt_text}: {error.get('host') or url}",- f"Fix DNS access to the dependency host. {retry_action}",+ i18n_t(+ "doctor.item.dependencyDnsFailedRetried"+ if attempts > 1+ else "doctor.item.dependencyDnsFailed",+ language,+ label=label,+ attempts=attempts,+ host=error.get("host") or url,+ ),+ i18n_t("doctor.action.dependencyDnsFailed", language, retry=retry_action),code=f"{code_prefix}_dns_failed",+ download_kind=kind,)elif kind == "tls":_add_doctor_item(items,failure_status,- f"{label} TLS verification failed: {url}",- "Fix the host CA or HTTPS inspection proxy for the Avibe service, then retry the repair.",+ i18n_t("doctor.item.dependencyTlsFailed", language, label=label, url=url),+ i18n_t("doctor.action.dependencyTlsFailed", language),code=f"{code_prefix}_tls_failed",+ download_kind=kind,)elif kind in {"timeout", "network"}:_add_doctor_item(items,failure_status,- f"{label} network request failed{attempt_text}: {url}",- f"Allow HTTPS access to the dependency host. {retry_action}",+ i18n_t(+ "doctor.item.dependencyNetworkFailedRetried"+ if attempts > 1+ else "doctor.item.dependencyNetworkFailed",+ language,+ label=label,+ attempts=attempts,+ url=url,+ ),+ i18n_t("doctor.action.dependencyNetworkFailed", language, retry=retry_action),code=f"{code_prefix}_{kind}_failed",+ download_kind=kind,)elif kind in {"permission", "disk", "io"}:_add_doctor_item(items,failure_status,- f"{label} could not be stored: {error.get('message') or kind}",- "Fix the runtime cache permissions or available disk space, then retry the repair.",+ i18n_t(+ "doctor.item.dependencyStoreFailed",+ language,+ label=label,+ reason=error.get("message") or i18n_t("doctor.value.unknownError", language),+ ),+ i18n_t("doctor.action.dependencyStoreFailed", language),code=f"{code_prefix}_{kind}_failed",+ download_kind=kind,)else:_add_doctor_item(items,failure_status,- f"{label} is unreachable: {error.get('message') or url}",- "Inspect the Avibe log for the matching download exception, then retry the repair.",+ i18n_t(+ "doctor.item.dependencyUnreachable",+ language,+ label=label,+ reason=error.get("message") or url,+ ),+ i18n_t("doctor.action.dependencyUnreachable", language),code=f"{code_prefix}_unreachable",+ download_kind=kind,)@@ -10872,6 +11089,7 @@ def _managed_dependencies_doctor_items(*, deep: bool = False) -> list[dict]:"tmux": "tmux",}items: list[dict] = []+ language = _configured_cli_language()try:dependencies = list(api.dependencies_status(offline=True).get("deps") or [])from core.git_runtime import git_runtime_status@@ -10896,8 +11114,8 @@ def _managed_dependencies_doctor_items(*, deep: bool = False) -> list[dict]:_add_doctor_item(items,"fail",- f"Managed dependency status could not be inspected: {exc}",- "Inspect the Avibe log and rerun Doctor.",+ i18n_t("doctor.item.dependencyStatusFailed", language, reason=exc),+ i18n_t("doctor.action.dependencyStatusFailed", language),code="dependencies.status_failed",)return items@@ -10911,19 +11129,23 @@ def _managed_dependencies_doctor_items(*, deep: bool = False) -> list[dict]:ready = bool(dependency.get("installed")) and status == "ready"version = dependency.get("version")if ready:- suffix = f" {version}" if version else ""if dependency_id == "git-runtime" and dependency.get("source") == "system":_add_doctor_item(items,"pass",- "Git is ready via the system runtime",+ i18n_t("doctor.item.gitSystemReady", language),code="dependencies.git-runtime.system_ready",)else:_add_doctor_item(items,"pass",- f"{label}{suffix} is ready",+ i18n_t(+ "doctor.item.dependencyReadyVersioned" if version else "doctor.item.dependencyReady",+ language,+ label=label,+ version=version,+ ),code=f"dependencies.{dependency_id}.ready",)continue@@ -10934,8 +11156,8 @@ def _managed_dependencies_doctor_items(*, deep: bool = False) -> list[dict]:_add_doctor_item(items,severity,- f"{label} is missing or unsupported",- "Install a supported Node.js release (^20.19.0 or >=22.12.0).",+ i18n_t("doctor.item.nodeNotReady", language, label=label),+ i18n_t("doctor.action.nodeNotReady", language),code="dependencies.node.not_ready",)continue@@ -10945,8 +11167,8 @@ def _managed_dependencies_doctor_items(*, deep: bool = False) -> list[dict]:_add_doctor_item(items,severity,- f"{label} is not published for this platform",- "Use a system dependency where supported, or run Avibe on a platform with a published runtime.",+ i18n_t("doctor.item.dependencyPlatformUnsupported", language, label=label),+ i18n_t("doctor.action.dependencyPlatformUnsupported", language),code=f"dependencies.{dependency_id}.platform_unsupported",)continue@@ -10955,9 +11177,9 @@ def _managed_dependencies_doctor_items(*, deep: bool = False) -> list[dict]:if dependency_id == "askill" and not api.askill_auto_install_supported():repair_target = Noneretry_action = (- f"Run `vibe doctor repair {repair_target}`."+ i18n_t("doctor.action.repairCommand", language, target=repair_target)if repair_target- else "Install askill manually from https://askill.sh."+ else i18n_t("doctor.action.askillManual", language))probe = Noneif deep and dependency_id == "tmux":@@ -10974,8 +11196,13 @@ def _managed_dependencies_doctor_items(*, deep: bool = False) -> list[dict]:_add_doctor_item(items,severity,- f"{label} archive URL uses an unsupported scheme: {probe.get('url') or 'unknown'}",- "Configure the dependency manifest with an HTTPS or file URL.",+ i18n_t(+ "doctor.item.dependencyArchiveUrlUnsupported",+ language,+ label=label,+ url=probe.get("url") or i18n_t("doctor.value.unknown", language),+ ),+ i18n_t("doctor.action.dependencyArchiveUrlUnsupported", language),code=f"dependencies.{dependency_id}.archive_url_unsupported",)continue@@ -10983,11 +11210,12 @@ def _managed_dependencies_doctor_items(*, deep: bool = False) -> list[dict]:_add_doctor_item(items,severity,- f"{label} is not ready ({status})",- retry_action,+ i18n_t("doctor.item.dependencyNotReady", language, label=label),+ i18n_t("doctor.action.dependencyNotReady", language, retry=retry_action),code=f"dependencies.{dependency_id}.not_ready",repair_target=repair_target,repair_risk="low",+ dependency_status=status,)if not deep:continue@@ -11012,15 +11240,15 @@ def _managed_dependencies_doctor_items(*, deep: bool = False) -> list[dict]:_add_doctor_item(items,"pass",- f"{label} download endpoint is reachable: {probe.get('url')}",+ i18n_t("doctor.item.dependencyReachable", language, label=label, url=probe.get("url")),code=f"dependencies.{dependency_id}.reachable",)elif not probe.get("checked") and probe.get("reason") == "dependency_probe_unsupported":_add_doctor_item(items,"warn",- f"{label} server does not support a body-free probe",- retry_action,+ i18n_t("doctor.item.dependencyProbeUnsupported", language, label=label),+ i18n_t("doctor.action.dependencyProbeUnsupported", language, retry=retry_action),code=f"dependencies.{dependency_id}.probe_unsupported",)elif probe.get("download_error"):@@ -11037,9 +11265,14 @@ def _managed_dependencies_doctor_items(*, deep: bool = False) -> list[dict]:_add_doctor_item(items,severity,- f"{label} archive could not be resolved ({probe.get('reason') or 'unknown'})",- "Inspect the dependency manifest and platform mapping before retrying.",+ i18n_t(+ "doctor.item.dependencyProbeUnavailable",+ language,+ label=label,+ ),+ i18n_t("doctor.action.dependencyProbeUnavailable", language),code=f"dependencies.{dependency_id}.probe_unavailable",+ probe_reason=probe.get("reason"),)return items@@ -11053,6 +11286,7 @@ def _show_runtime_doctor_items(*, deep: bool = False) -> list[dict]:from core.show_runtime import ShowRuntimeManageritems: list[dict] = []+ doctor_language = _configured_cli_language()try:manager = ShowRuntimeManager(offline=True if not deep else None)status = manager.status()@@ -11060,8 +11294,8 @@ def _show_runtime_doctor_items(*, deep: bool = False) -> list[dict]:_add_doctor_item(items,"fail",- f"Show Runtime status could not be inspected: {exc}",- "Inspect the Avibe log and reinstall the current Avibe release if package data is missing.",+ i18n_t("doctor.item.showRuntimeStatusFailed", doctor_language, reason=exc),+ i18n_t("doctor.action.showRuntimeStatusFailed", doctor_language),code="show_runtime.status_failed",)return items@@ -11070,58 +11304,65 @@ def _show_runtime_doctor_items(*, deep: bool = False) -> list[dict]:archive_cache = manager.archive_cache_status()except Exception: # noqa: BLE001archive_cache = None- doctor_language = _configured_cli_language()archive_skipped_reason = str((archive_cache or {}).get("skipped_reason") or "")if archive_cache and archive_skipped_reason == "archive_inspection_failed":_add_doctor_item(items,"warn",- i18n_t("runtime.doctor.archiveCacheSkipped", doctor_language, reason=archive_skipped_reason),- i18n_t("runtime.doctor.archiveCacheSkippedInspectionAction", doctor_language),+ i18n_t("doctor.item.archiveCacheSkipped", doctor_language),+ i18n_t("doctor.action.archiveCacheSkippedInspection", doctor_language),code="show_runtime.archive_cache_skipped",+ archive_cache_skip_reason=archive_skipped_reason,)elif archive_cache and archive_skipped_reason:_add_doctor_item(items,"warn",- i18n_t("runtime.doctor.archiveCacheSkipped", doctor_language, reason=archive_skipped_reason),- i18n_t("runtime.doctor.archiveCacheSkippedAction", doctor_language),+ i18n_t("doctor.item.archiveCacheSkipped", doctor_language),+ i18n_t("doctor.action.archiveCacheSkipped", doctor_language),code="show_runtime.archive_cache_skipped",+ archive_cache_skip_reason=archive_skipped_reason,)elif archive_cache and int(archive_cache.get("candidate_count") or 0) > 0:_add_doctor_item(items,"warn",i18n_t(- "runtime.doctor.archiveCacheReclaimable",+ "doctor.item.archiveCacheReclaimable",doctor_language,count=int(archive_cache.get("candidate_count") or 0),size=_format_byte_size(int(archive_cache.get("candidate_bytes") or 0)),),- i18n_t("runtime.doctor.archiveCacheReclaimableAction", doctor_language),+ i18n_t("doctor.action.archiveCacheReclaimable", doctor_language),code="show_runtime.archive_cache_reclaimable",)elif archive_cache is not None:_add_doctor_item(items,"pass",- i18n_t("runtime.doctor.archiveCacheClean", _configured_cli_language()),+ i18n_t("doctor.item.archiveCacheClean", doctor_language),code="show_runtime.archive_cache_clean",)install = _show_runtime_install(status)installed = install.get("state") == "installed"provider = str(status.get("provider") or "unknown")+ display_provider = _doctor_display_value(provider, "show_runtime_provider", doctor_language)+ current_platform = status.get("platform") or i18n_t("doctor.value.currentPlatform", doctor_language)explicit_command = status.get("explicit_command")if explicit_command:if installed:- _add_doctor_item(items, "pass", f"Show Runtime explicit command is available: {explicit_command}")+ _add_doctor_item(+ items,+ "pass",+ i18n_t("doctor.item.explicitCommandAvailable", doctor_language, command=explicit_command),+ )else:_add_doctor_item(items,"fail",- f"Show Runtime explicit command is missing: {explicit_command}",- "Fix or remove VIBE_SHOW_RUNTIME_BIN, then rerun Doctor.",+ i18n_t("doctor.item.explicitCommandMissing", doctor_language, command=explicit_command),+ i18n_t("doctor.action.explicitCommandMissing", doctor_language),code="show_runtime.explicit_command_missing",)return items@@ -11143,8 +11384,8 @@ def _show_runtime_doctor_items(*, deep: bool = False) -> list[dict]:_add_doctor_item(items,"fail",- "The packaged Show Runtime manifest is missing or invalid",- "Upgrade or reinstall Avibe from an official wheel that includes the pinned runtime manifest.",+ i18n_t("doctor.item.manifestMissing", doctor_language),+ i18n_t("doctor.action.manifestMissing", doctor_language),code="show_runtime.manifest_missing",)elif not archive:@@ -11152,15 +11393,24 @@ def _show_runtime_doctor_items(*, deep: bool = False) -> list[dict]:_add_doctor_item(items,"fail",- f"The Show Runtime manifest has no archive for {status.get('platform') or 'this platform'}",- "Install Avibe on a supported platform or upgrade to a release that publishes this platform archive.",+ i18n_t(+ "doctor.item.manifestPlatformUnsupported",+ doctor_language,+ platform=current_platform,+ ),+ i18n_t("doctor.action.manifestPlatformUnsupported", doctor_language),code="show_runtime.platform_unsupported",)else:_add_doctor_item(items,"pass",- f"Show Runtime manifest pins {archive.get('name')} from {archive_url}",+ i18n_t(+ "doctor.item.manifestReady",+ doctor_language,+ name=archive.get("name"),+ url=archive_url,+ ),code="show_runtime.manifest_ready",)elif provider == "archive":@@ -11169,60 +11419,69 @@ def _show_runtime_doctor_items(*, deep: bool = False) -> list[dict]:_add_doctor_item(items,"fail",- f"Show Runtime selected the legacy unpinned archive URL: {archive_url}",- "Reinstall the official Avibe package or remove VIBE_SHOW_RUNTIME_SOURCE/ARCHIVE overrides. "- "The upstream source repository does not publish release assets.",+ i18n_t("doctor.item.legacyArchiveProvider", doctor_language, url=archive_url),+ i18n_t("doctor.action.legacyArchiveProvider", doctor_language),code="show_runtime.legacy_archive_provider",)else:_add_doctor_item(items,"warn",- "Show Runtime uses an explicit unpinned archive provider",- "Prefer the manifest-cache provider for official installations.",+ i18n_t("doctor.item.unpinnedArchiveProvider", doctor_language),+ i18n_t("doctor.action.unpinnedArchiveProvider", doctor_language),code="show_runtime.unpinned_archive_provider",)elif provider == "npm":_add_doctor_item(items,"warn",- f"Show Runtime uses the {provider} development provider",- "Use manifest-cache for official installations; keep this override only for development.",+ i18n_t("doctor.item.developmentProvider", doctor_language, provider=display_provider),+ i18n_t("doctor.action.developmentProvider", doctor_language),code="show_runtime.development_provider",+ show_runtime_provider=provider,)else:provider_repairable = False_add_doctor_item(items,"fail",- f"Show Runtime provider is unsupported: {provider}",- i18n_t("runtime.doctor.providerUnsupportedAction", doctor_language),+ i18n_t("doctor.item.providerUnsupported", doctor_language, provider=display_provider),+ i18n_t("doctor.action.providerUnsupported", doctor_language),code="show_runtime.provider_unsupported",+ show_runtime_provider=provider,)if installed:_add_doctor_item(items,"pass",- f"Show Runtime is installed for {status.get('platform') or 'this platform'}",+ i18n_t(+ "doctor.item.showRuntimeInstalled",+ doctor_language,+ platform=current_platform,+ ),code="show_runtime.installed",)return itemsshow_runtime_repairable = provider_repairable and node_available and node_supported and archive_scheme_supportedshow_runtime_retry_action = (- "Run `vibe doctor repair show-runtime`."+ i18n_t("doctor.action.showRuntimeRepair", doctor_language)if show_runtime_repairable- else "Resolve the provider, platform, Node.js, or archive URL issue above, then rerun Doctor."+ else i18n_t("doctor.action.showRuntimeRetry", doctor_language))_add_doctor_item(items,"fail",- f"Show Runtime is not ready for {status.get('platform') or 'this platform'}",+ i18n_t(+ "doctor.item.showRuntimeNotReady",+ doctor_language,+ platform=current_platform,+ ),(- "Run `vibe doctor repair show-runtime`; use `vibe doctor --deep` first when download access is uncertain."+ i18n_t("doctor.action.showRuntimeRepair", doctor_language)if show_runtime_repairable- else show_runtime_retry_action+ else i18n_t("doctor.action.showRuntimeRetry", doctor_language)),code="show_runtime.not_ready",repair_target="show-runtime" if show_runtime_repairable else None,@@ -11235,8 +11494,8 @@ def _show_runtime_doctor_items(*, deep: bool = False) -> list[dict]:_add_doctor_item(items,"pass",- "Show Runtime archive reachability was not checked in fast diagnostics",- "Run `vibe doctor --deep` to distinguish HTTP, DNS, TLS, and timeout failures without downloading the archive.",+ i18n_t("doctor.item.archiveProbeSkipped", doctor_language),+ i18n_t("doctor.action.archiveProbeSkipped", doctor_language),code="show_runtime.archive_probe_skipped",)return items@@ -11248,15 +11507,15 @@ def _show_runtime_doctor_items(*, deep: bool = False) -> list[dict]:_add_doctor_item(items,"pass",- f"Show Runtime archive is reachable: {target}",+ i18n_t("doctor.item.archiveReachable", doctor_language, target=target),code="show_runtime.archive_reachable",)elif probe_reason == "runtime_archive_probe_unsupported":_add_doctor_item(items,"warn",- "Show Runtime archive server does not support a body-free reachability probe",- show_runtime_retry_action,+ i18n_t("doctor.item.archiveProbeUnsupported", doctor_language),+ i18n_t("doctor.action.archiveProbeUnsupported", doctor_language, retry=show_runtime_retry_action),code="show_runtime.archive_probe_unsupported",)elif probe.get("download_error"):@@ -11264,7 +11523,10 @@ def _show_runtime_doctor_items(*, deep: bool = False) -> list[dict]:_add_dependency_download_failure(items,probe.get("download_error"),- label="Show Runtime manifest" if is_manifest_failure else "Show Runtime archive",+ label=i18n_t(+ "doctor.value.showRuntimeManifest" if is_manifest_failure else "doctor.value.showRuntimeArchive",+ doctor_language,+ ),code_prefix="show_runtime.manifest" if is_manifest_failure else "show_runtime.archive",repair_target="show-runtime" if show_runtime_repairable else None,retry_action=show_runtime_retry_action,@@ -11273,33 +11535,50 @@ def _show_runtime_doctor_items(*, deep: bool = False) -> list[dict]:_add_doctor_item(items,"fail",- f"Show Runtime archive URL scheme is unsupported: {probe.get('url') or (archive or {}).get('url')}",- "Use an HTTPS or file URL for the archive, then rerun deep Doctor.",+ i18n_t(+ "doctor.item.archiveUrlUnsupported",+ doctor_language,+ url=probe.get("url") or (archive or {}).get("url"),+ ),+ i18n_t("doctor.action.archiveUrlUnsupported", doctor_language),code="show_runtime.archive_url_unsupported",)elif probe_reason.startswith("runtime_manifest_"):_add_doctor_item(items,"fail",- f"Show Runtime manifest could not be loaded: {probe_reason}",- "Inspect the configured or packaged Runtime manifest, then reinstall the current Avibe release if needed.",+ i18n_t("doctor.item.manifestUnavailable", doctor_language),+ i18n_t("doctor.action.manifestUnavailable", doctor_language),code="show_runtime.manifest_unavailable",+ probe_reason=probe_reason,)elif probe_reason == "runtime_platform_unsupported":_add_doctor_item(items,"fail",- f"Show Runtime manifest has no archive for {status.get('platform') or 'this platform'}",- "Install an Avibe release that publishes a Runtime archive for this platform.",+ i18n_t(+ "doctor.item.manifestPlatformUnsupported",+ doctor_language,+ platform=current_platform,+ ),+ i18n_t("doctor.action.showRuntimePlatformUnsupported", doctor_language),code="show_runtime.platform_unsupported",)else:_add_doctor_item(items,"fail",- f"Show Runtime archive check failed: {probe_reason or 'unknown error'}",- f"Inspect the selected archive path or URL. {show_runtime_retry_action}",+ i18n_t(+ "doctor.item.archiveCheckFailed",+ doctor_language,+ ),+ i18n_t(+ "doctor.action.archiveCheckFailed",+ doctor_language,+ retry=show_runtime_retry_action,+ ),code="show_runtime.archive_check_failed",+ probe_reason=probe_reason,)return items@@ -11317,33 +11596,32 @@ def _doctor(*, deep: bool = False):"""groups = []summary = {"pass": 0, "warn": 0, "fail": 0}+ language = _configured_cli_language()home_items = _home_migration_items()for item in home_items:status = item.get("status")if status in summary:summary[status] += 1- groups.append({"name": "Runtime Home", "items": home_items})+ groups.append({"name": i18n_t("doctor.group.runtimeHome", language), "items": home_items})# 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}",- }+ _add_doctor_item(+ config_items,+ "pass",+ i18n_t("doctor.item.configFound", language, path=config_path),)summary["pass"] += 1else:- config_items.append(- {- "status": "fail",- "message": "Configuration file not found",- "action": "Run 'vibe' to create initial configuration",- }+ _add_doctor_item(+ config_items,+ "fail",+ i18n_t("doctor.item.configMissing", language),+ i18n_t("doctor.action.configMissing", language),)summary["fail"] += 1@@ -11353,40 +11631,42 @@ def _doctor(*, deep: bool = False):if config.load_warnings:recovery_notice = api.config_recovery_notice(config)if recovery_notice:- recovery_language = getattr(config, "language", "en") or "en"+ recovery_language = getattr(config, "language", language) or language_add_doctor_item(config_items,"warn",- recovery_notice,- i18n_t("error.configRecovery.action", recovery_language),+ i18n_t("doctor.item.configRecovery", recovery_language),+ i18n_t("doctor.action.configRecovery", recovery_language),code="config.recovery",)summary["warn"] += 1else:- config_items.append(- {- "status": "pass",- "message": "Configuration loaded successfully",- }+ _add_doctor_item(+ config_items,+ "pass",+ i18n_t("doctor.item.configLoaded", language),)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",- }+ _add_doctor_item(+ config_items,+ "fail",+ i18n_t("doctor.item.configLoadFailed", language, reason=exc),+ i18n_t("doctor.action.configLoadFailed", language),)summary["fail"] += 1- groups.append({"name": "Configuration", "items": config_items})+ groups.append({"name": i18n_t("doctor.group.configuration", language), "items": config_items})remote_access_items = []if config is None:- _add_doctor_item(remote_access_items, "warn", "Cannot check Remote Access: configuration not loaded")+ _add_doctor_item(+ remote_access_items,+ "warn",+ i18n_t("doctor.item.remoteConfigMissing", language),+ )elif not config.remote_access.vibe_cloud.enabled:- _add_doctor_item(remote_access_items, "pass", "Remote Access is disabled")+ _add_doctor_item(remote_access_items, "pass", i18n_t("doctor.item.remoteDisabled", language))else:from vibe import remote_access@@ -11395,23 +11675,32 @@ def _doctor(*, deep: bool = False):_add_doctor_item(remote_access_items,"fail",- "Remote Access connector is not running",- "Start Remote Access from Settings or run `vibe remote start`.",+ i18n_t("doctor.item.remoteNotRunning", language),+ i18n_t("doctor.action.remoteNotRunning", language),)else:- _add_doctor_item(remote_access_items, "pass", "Remote Access connector is running")+ _add_doctor_item(remote_access_items, "pass", i18n_t("doctor.item.remoteRunning", language))quality = remote_status.get("tunnel_quality")if not isinstance(quality, dict):_add_doctor_item(remote_access_items,"warn",- "Tunnel quality is not available yet",- "Wait up to 45 seconds for the first metrics samples.",+ i18n_t("doctor.item.tunnelQualityUnavailable", language),+ i18n_t("doctor.action.tunnelQualityUnavailable", language),)else:state = str(quality.get("state") or "unknown")grade = str(quality.get("grade") or "unknown")+ protocol = str(quality.get("protocol") or "unknown")+ display_state = _doctor_tunnel_display_value(state, "state", language)+ display_grade = _doctor_tunnel_display_value(grade, "grade", language)+ display_protocol = _doctor_tunnel_display_value(protocol, "protocol", language)+ quality_details = {+ "tunnel_state": state,+ "tunnel_grade": grade,+ "tunnel_protocol": protocol,+ }try:sampled_at = datetime.fromisoformat(str(quality.get("sampled_at") or "").replace("Z", "+00:00"))quality_stale = time.time() - sampled_at.timestamp() > 150@@ -11421,8 +11710,8 @@ def _doctor(*, deep: bool = False):_add_doctor_item(remote_access_items,"warn",- "Tunnel quality sample is stale",- "Wait up to 45 seconds for fresh metrics or inspect the Remote Access logs.",+ i18n_t("doctor.item.tunnelQualityStale", language),+ i18n_t("doctor.action.tunnelQualityStale", language),)else:rtt = quality.get("rtt_ms") if isinstance(quality.get("rtt_ms"), dict) else None@@ -11444,120 +11733,134 @@ def _doctor(*, deep: bool = False):or int(request_path.get("success_count") or 0) == 0))+ quality_status = "pass" if state == "healthy" and grade in {"good", "fair", "unknown"} else "warn"+ if request_path_unavailable or (+ state == "degraded" and int(quality.get("ha_connections") or 0) == 0+ ):+ quality_status = "fail"if request_path_unavailable:- quality_message = (- f"Tunnel quality: {state}/{grade}; remote requests unavailable, "- f"{int(request_path.get('success_count') or 0)}/"- f"{int(request_path.get('sample_count') or 0)} succeeded; "- f"connector {quality.get('protocol') or 'unknown'}"+ _add_doctor_item(+ remote_access_items,+ quality_status,+ i18n_t(+ "doctor.item.tunnelQualityRequestsUnavailable",+ language,+ state=display_state,+ grade=display_grade,+ succeeded=int(request_path.get("success_count") or 0),+ samples=int(request_path.get("sample_count") or 0),+ protocol=display_protocol,+ ),+ i18n_t("doctor.action.tunnelQualityWarn", language)+ if quality_status == "warn"+ else None,+ **quality_details,)elif request_latency is not None:slow_rate = request_path.get("slow_request_rate") or {}- quality_message = (- f"Tunnel quality: {state}/{grade}; remote requests P95 "- f"{request_latency.get('p95')} ms, P99 {request_latency.get('p99')} ms, "- f"{round(float(slow_rate.get('over_1000_ms') or 0) * 100)}% above 1 second; "- f"connector {quality.get('protocol') or 'unknown'}"+ _add_doctor_item(+ remote_access_items,+ quality_status,+ i18n_t(+ "doctor.item.tunnelQualityLatency",+ language,+ state=display_state,+ grade=display_grade,+ p95=request_latency.get("p95"),+ p99=request_latency.get("p99"),+ slow_rate=round(float(slow_rate.get("over_1000_ms") or 0) * 100),+ protocol=display_protocol,+ ),+ i18n_t("doctor.action.tunnelQualityWarn", language)+ if quality_status == "warn"+ else None,+ **quality_details,)elif rtt is None:- quality_message = (- f"Tunnel quality: {state}; edge RTT unavailable for "- f"{quality.get('protocol') or 'unknown'} transport"+ _add_doctor_item(+ remote_access_items,+ quality_status,+ i18n_t(+ "doctor.item.tunnelQualityRttUnavailable",+ language,+ state=display_state,+ protocol=display_protocol,+ ),+ i18n_t("doctor.action.tunnelQualityWarn", language)+ if quality_status == "warn"+ else None,+ **quality_details,)else:- quality_message = (- f"Tunnel quality: {state}/{grade}; edge RTT median {rtt.get('median')} ms, "- f"maximum {rtt.get('max')} ms"+ _add_doctor_item(+ remote_access_items,+ quality_status,+ i18n_t(+ "doctor.item.tunnelQualityRtt",+ language,+ state=display_state,+ grade=display_grade,+ median=rtt.get("median"),+ maximum=rtt.get("max"),+ ),+ i18n_t("doctor.action.tunnelQualityWarn", language)+ if quality_status == "warn"+ else None,+ **quality_details,)- quality_status = "pass" if state == "healthy" and grade in {"good", "fair", "unknown"} else "warn"- if request_path_unavailable or (- state == "degraded" and int(quality.get("ha_connections") or 0) == 0- ):- quality_status = "fail"- _add_doctor_item(- remote_access_items,- quality_status,- quality_message,- "Avibe will evaluate a second Connector automatically when degradation persists."- if quality_status == "warn"- else None,- )for item in remote_access_items:item_status = item.get("status")if item_status in summary:summary[item_status] += 1- groups.append({"name": "Remote Access", "items": remote_access_items})+ groups.append({"name": i18n_t("doctor.group.remoteAccess", language), "items": remote_access_items})# Slack Groupslack_items = []if config:try:config.slack.validate()- slack_items.append(- {- "status": "pass",- "message": "Slack token format is valid",- }- )+ _add_doctor_item(slack_items, "pass", i18n_t("doctor.item.slackTokenValid", language))summary["pass"] += 1# Check if tokens are actually setif config.slack.bot_token:- slack_items.append(- {- "status": "pass",- "message": "Bot token is configured",- }- )+ _add_doctor_item(slack_items, "pass", i18n_t("doctor.item.slackBotConfigured", language))summary["pass"] += 1else:- slack_items.append(- {- "status": "warn",- "message": "Bot token is not configured",- "action": "Add your Slack bot token in the setup wizard",- }+ _add_doctor_item(+ slack_items,+ "warn",+ i18n_t("doctor.item.slackBotMissing", language),+ i18n_t("doctor.action.slackBotMissing", language),)summary["warn"] += 1if config.slack.app_token:- slack_items.append(- {- "status": "pass",- "message": "App token is configured (Socket Mode)",- }- )+ _add_doctor_item(slack_items, "pass", i18n_t("doctor.item.slackAppConfigured", language))summary["pass"] += 1else:- slack_items.append(- {- "status": "warn",- "message": "App token is not configured",- "action": "Add your Slack app token for Socket Mode",- }+ _add_doctor_item(+ slack_items,+ "warn",+ i18n_t("doctor.item.slackAppMissing", language),+ i18n_t("doctor.action.slackAppMissing", language),)summary["warn"] += 1except Exception as exc:- slack_items.append(- {- "status": "fail",- "message": f"Slack token validation failed: {exc}",- "action": "Check your Slack tokens in the setup wizard",- }+ _add_doctor_item(+ slack_items,+ "fail",+ i18n_t("doctor.item.slackValidationFailed", language, reason=exc),+ i18n_t("doctor.action.slackValidationFailed", language),)summary["fail"] += 1else:- slack_items.append(- {- "status": "fail",- "message": "Cannot check Slack: configuration not loaded",- }- )+ _add_doctor_item(slack_items, "fail", i18n_t("doctor.item.slackConfigMissing", language))summary["fail"] += 1- groups.append({"name": "Slack", "items": slack_items})+ groups.append({"name": i18n_t("doctor.group.slack", language), "items": slack_items})# Agent Backends Groupagent_items = []@@ -11567,29 +11870,22 @@ def _doctor(*, deep: bool = False):cli_path = config.agents.opencode.cli_pathfound_path = api.detect_cli(cli_path).get("path") if cli_path else Noneif found_path:- agent_items.append(- {- "status": "pass",- "message": f"OpenCode CLI found: {found_path}",- }+ _add_doctor_item(+ agent_items,+ "pass",+ i18n_t("doctor.item.agentCliFound", language, agent="OpenCode", path=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",- }+ _add_doctor_item(+ agent_items,+ "warn",+ i18n_t("doctor.item.agentCliMissing", language, agent="OpenCode", path=cli_path),+ i18n_t("doctor.action.agentCliMissing", language, agent="OpenCode"),)summary["warn"] += 1else:- agent_items.append(- {- "status": "pass",- "message": "OpenCode: disabled",- }- )+ _add_doctor_item(agent_items, "pass", i18n_t("doctor.item.agentDisabled", language, agent="OpenCode"))summary["pass"] += 1# Claude@@ -11598,29 +11894,22 @@ def _doctor(*, deep: bool = False):found_path = api.detect_cli(cli_path).get("path") if cli_path else Noneif found_path:- agent_items.append(- {- "status": "pass",- "message": f"Claude CLI found: {found_path}",- }+ _add_doctor_item(+ agent_items,+ "pass",+ i18n_t("doctor.item.agentCliFound", language, agent="Claude", path=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",- }+ _add_doctor_item(+ agent_items,+ "warn",+ i18n_t("doctor.item.agentCliMissing", language, agent="Claude", path=cli_path),+ i18n_t("doctor.action.agentCliMissing", language, agent="Claude"),)summary["warn"] += 1else:- agent_items.append(- {- "status": "pass",- "message": "Claude: disabled",- }- )+ _add_doctor_item(agent_items, "pass", i18n_t("doctor.item.agentDisabled", language, agent="Claude"))summary["pass"] += 1# Codex@@ -11628,29 +11917,22 @@ def _doctor(*, deep: bool = False):cli_path = config.agents.codex.cli_pathfound_path = api.detect_cli(cli_path).get("path") if cli_path else Noneif found_path:- agent_items.append(- {- "status": "pass",- "message": f"Codex CLI found: {found_path}",- }+ _add_doctor_item(+ agent_items,+ "pass",+ i18n_t("doctor.item.agentCliFound", language, agent="Codex", path=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",- }+ _add_doctor_item(+ agent_items,+ "warn",+ i18n_t("doctor.item.agentCliMissing", language, agent="Codex", path=cli_path),+ i18n_t("doctor.action.agentCliMissing", language, agent="Codex"),)summary["warn"] += 1else:- agent_items.append(- {- "status": "pass",- "message": "Codex: disabled",- }- )+ _add_doctor_item(agent_items, "pass", i18n_t("doctor.item.agentDisabled", language, agent="Codex"))summary["pass"] += 1# Default Agent check@@ -11665,71 +11947,52 @@ def _doctor(*, deep: bool = False):finally:if store is not None:store.close()- agent_items.append(- {- "status": "pass",- "message": f"Default Agent: {default_agent_name or 'not configured'}",- }+ _add_doctor_item(+ agent_items,+ "pass",+ i18n_t(+ "doctor.item.defaultAgent",+ language,+ agent=default_agent_name or i18n_t("doctor.value.notConfigured", language),+ ),)summary["pass"] += 1else:- agent_items.append(- {- "status": "fail",- "message": "Cannot check agents: configuration not loaded",- }- )+ _add_doctor_item(agent_items, "fail", i18n_t("doctor.item.agentConfigMissing", language))summary["fail"] += 1- groups.append({"name": "Agent Backends", "items": agent_items})+ groups.append({"name": i18n_t("doctor.group.agentBackends", language), "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}",- }- )+ _add_doctor_item(runtime_items, "pass", i18n_t("doctor.item.workingDirectory", language, path=cwd))summary["pass"] += 1else:- runtime_items.append(- {- "status": "warn",- "message": f"Working directory does not exist: {cwd}",- "action": "Update default_cwd in settings",- }+ _add_doctor_item(+ runtime_items,+ "warn",+ i18n_t("doctor.item.workingDirectoryMissing", language, path=cwd),+ i18n_t("doctor.action.workingDirectoryMissing", language),)summary["warn"] += 1- runtime_items.append(- {- "status": "pass",- "message": f"Log level: {config.runtime.log_level}",- }+ _add_doctor_item(+ runtime_items,+ "pass",+ i18n_t("doctor.item.logLevel", language, 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}",- }- )+ _add_doctor_item(runtime_items, "pass", i18n_t("doctor.item.logFile", language, path=log_path))summary["pass"] += 1else:- runtime_items.append(- {- "status": "pass",- "message": "Log file will be created on first run",- }- )+ _add_doctor_item(runtime_items, "pass", i18n_t("doctor.item.logFilePending", language))summary["pass"] += 1for item in [@@ -11744,7 +12007,7 @@ def _doctor(*, deep: bool = False):if status in summary:summary[status] += 1- groups.append({"name": "Runtime", "items": runtime_items})+ groups.append({"name": i18n_t("doctor.group.runtime", language), "items": runtime_items})dependency_items = [*_managed_dependencies_doctor_items(deep=deep),@@ -11754,14 +12017,14 @@ def _doctor(*, deep: bool = False):status = item.get("status")if status in summary:summary[status] += 1- groups.append({"name": "Dependencies", "items": dependency_items})+ groups.append({"name": i18n_t("doctor.group.dependencies", language), "items": dependency_items})local_cli_items = _local_cli_installation_items()for item in local_cli_items:status = item.get("status")if status in summary:summary[status] += 1- groups.append({"name": "Local CLI Installation", "items": local_cli_items})+ groups.append({"name": i18n_t("doctor.group.localCliInstallation", language), "items": local_cli_items})# Calculate overall statusok = summary["fail"] == 0@@ -11786,6 +12049,7 @@ def _add_doctor_item(code: str | None = None,repair_target: str | None = None,repair_risk: str | None = None,+ **details: object,) -> None:item = {"status": status, "message": message}if code:@@ -11799,6 +12063,7 @@ def _add_doctor_item("command": f"vibe doctor repair {repair_target}","risk": repair_risk or "medium",}+ item.update({key: value for key, value in details.items() if value is not None})items.append(item)@@ -11965,6 +12230,7 @@ def _current_sqlite_revision() -> str | None:def _local_cli_installation_items() -> list[dict]:items: list[dict] = []+ language = _configured_cli_language()vibe_paths = _path_entries_for_executable("vibe")preferred_vibe = (Path.home() / ".local" / "bin" / "vibe").expanduser()@@ -11973,8 +12239,8 @@ def _local_cli_installation_items() -> list[dict]:_add_doctor_item(items,"warn",- "No vibe executable found on PATH",- "Install Avibe with uv tool or add the intended vibe executable to PATH.",+ i18n_t("doctor.item.cliMissing", language),+ i18n_t("doctor.action.cliMissing", language),)else:first_vibe = vibe_paths[0]@@ -11987,19 +12253,24 @@ def _local_cli_installation_items() -> list[dict]:_add_doctor_item(items,"warn",- f"PATH resolves vibe to {first_vibe} before {preferred_resolved}",- "Put ~/.local/bin before system Python bin directories when using the uv tool installation.",+ i18n_t(+ "doctor.item.cliPathPrecedence",+ language,+ active=first_vibe,+ preferred=preferred_resolved,+ ),+ i18n_t("doctor.action.cliPathPrecedence", language),)else:- _add_doctor_item(items, "pass", f"PATH resolves vibe to {first_vibe}")+ _add_doctor_item(items, "pass", i18n_t("doctor.item.cliPath", language, path=first_vibe))site_packages_dirs = _uv_tool_site_packages_for_vibe(active_vibe_path) if active_vibe_path is not None else []if not site_packages_dirs:_add_doctor_item(items,"warn",- "Active vibe executable is not the uv tool installation",- "uv tool package-integrity checks are skipped for this executable.",+ i18n_t("doctor.item.cliNotUvTool", language),+ i18n_t("doctor.action.cliNotUvTool", language),)return items@@ -12009,11 +12280,15 @@ def _local_cli_installation_items() -> list[dict]:_add_doctor_item(items,"fail",- f"uv tool installation is editable: {site_packages}",- "Reinstall Avibe from a normal wheel. Do not use 'uv tool install --editable .' for the live local CLI.",+ i18n_t("doctor.item.cliEditable", language, path=site_packages),+ i18n_t("doctor.action.cliEditable", language),)else:- _add_doctor_item(items, "pass", f"uv tool installation is not editable: {site_packages}")+ _add_doctor_item(+ items,+ "pass",+ i18n_t("doctor.item.cliNotEditable", language, path=site_packages),+ )# A successful package-manager exit only proves that its metadata was# written. RECORD is the wheel-level evidence that every installed@@ -12025,15 +12300,31 @@ def _local_cli_installation_items() -> list[dict]:_add_doctor_item(items,"pass",- f"Python package files are intact: {integrity.detail}",+ i18n_t(+ "doctor.item.packageIntegrityOk",+ language,+ count=integrity.checked_files,+ ),code="installation.package_integrity",)else:+ failure_detail = ", ".join(integrity.failures[:5]) or i18n_t(+ "doctor.value.unknownError",+ language,+ )+ remaining = max(0, len(integrity.failures) - 5)_add_doctor_item(items,"fail",- f"Python package integrity check failed: {integrity.detail}",- "Rerun the Avibe installer to replace the active environment with a verified wheel.",+ i18n_t(+ "doctor.item.packageIntegrityFailedMore"+ if remaining+ else "doctor.item.packageIntegrityFailed",+ language,+ detail=failure_detail,+ count=remaining,+ ),+ i18n_t("doctor.action.packageIntegrityFailed", language),code="installation.package_integrity",)@@ -12043,39 +12334,111 @@ def _local_cli_installation_items() -> list[dict]:_add_doctor_item(items,"fail",- f"Packaged Alembic scripts are missing under {alembic_dir}",- "Reinstall from a wheel that includes storage/alembic. Editable uv tool installs can miss this package data.",+ i18n_t("doctor.item.alembicMissing", language, path=alembic_dir),+ i18n_t("doctor.action.alembicMissing", language),)continuerevisions = _available_alembic_revisions(versions_dir)recognized_revisions.update(revisions)if revisions:- _add_doctor_item(items, "pass", f"Packaged Alembic scripts found: {versions_dir}")+ _add_doctor_item(+ items,+ "pass",+ i18n_t("doctor.item.alembicFound", language, path=versions_dir),+ )else:_add_doctor_item(items,"fail",- f"No Alembic revision files found under {versions_dir}",- "Reinstall from a wheel that includes storage/alembic/versions.",+ i18n_t("doctor.item.alembicRevisionsMissing", language, path=versions_dir),+ i18n_t("doctor.action.alembicRevisionsMissing", language),)sqlite_revision = _current_sqlite_revision()if sqlite_revision is None:- _add_doctor_item(items, "pass", "SQLite schema revision is not initialized yet")+ _add_doctor_item(items, "pass", i18n_t("doctor.item.sqliteRevisionAbsent", language))elif sqlite_revision in recognized_revisions:- _add_doctor_item(items, "pass", f"SQLite schema revision is recognized by this CLI: {sqlite_revision}")+ _add_doctor_item(+ items,+ "pass",+ i18n_t("doctor.item.sqliteRevisionKnown", language, revision=sqlite_revision),+ )else:_add_doctor_item(items,"fail",- f"SQLite schema revision is newer than or unknown to this CLI: {sqlite_revision}",- "Install an Avibe wheel built from code that contains this migration revision.",+ i18n_t("doctor.item.sqliteRevisionUnknown", language, revision=sqlite_revision),+ i18n_t("doctor.action.sqliteRevisionUnknown", language),)return items+def _doctor_tunnel_display_value(value: object, value_type: str, language: str) -> str:+ return _doctor_display_value(value, f"tunnel_{value_type}", language)+++def _doctor_display_value(value: object, category: str, language: str) -> str:+ """Project finite Doctor vocabulary at the human-rendering boundary."""++ raw_value = str(value or "unknown")+ key = DOCTOR_DISPLAY_PROJECTIONS.get(category, {}).get(raw_value)+ return i18n_t(key, language) if key else i18n_t("doctor.value.unknown", language)+++def _doctor_managed_reason_key(reason: str) -> str | None:+ projections = DOCTOR_DISPLAY_PROJECTIONS+ key = projections["repair_reason"].get(reason)+ if key:+ return key+ for suffix, suffix_key in sorted(+ projections["repair_suffix"].items(),+ key=lambda entry: len(entry[0]),+ reverse=True,+ ):+ if reason == suffix or reason.endswith(f"_{suffix}"):+ return suffix_key+ return None+++def _doctor_managed_failure_detail(target: str, result: dict, language: str) -> str:+ download_error = result.get("download_error") if isinstance(result.get("download_error"), dict) else None+ if download_error:+ kind = str(download_error.get("kind") or "")+ key = DOCTOR_DISPLAY_PROJECTIONS["download_kind"].get(kind)+ attempts = int(download_error.get("attempts") or 1)+ if key == "doctor.repair.dependencyDownloadHttp":+ return i18n_t(+ key,+ language,+ status=download_error.get("http_status") or i18n_t("doctor.value.unknown", language),+ attempts=attempts,+ )+ if key:+ return i18n_t(key, language, attempts=attempts)+ return i18n_t("doctor.repair.dependencyDownloadUnknown", language)++ reason = str(result.get("reason") or "")+ key = _doctor_managed_reason_key(reason)+ error = result.get("error") or i18n_t("doctor.value.unknownError", language)+ kwargs = {"target": target, "error": error}+ if reason == "askill_auto_install_unsupported":+ kwargs["tools"] = "+".join(str(tool) for tool in result.get("required_tools") or ("curl", "bash"))+ elif reason == "avault_platform_unsupported":+ kwargs["platform"] = result.get("platform") or i18n_t("doctor.value.unknown", language)+ elif reason == "avault_checksum_mismatch":+ kwargs["expected_sha256"] = result.get("expected_sha256") or i18n_t("doctor.value.unknown", language)+ kwargs["actual_sha256"] = result.get("actual_sha256") or i18n_t("doctor.value.unknown", language)+ elif reason in {"askill_install_timeout"}:+ kwargs["timeout_seconds"] = result.get("timeout_seconds") or 300+ elif reason == "askill_install_failed" or reason.endswith("_install_failed"):+ kwargs["exit_code"] = result.get("exit_code") or i18n_t("doctor.value.unknown", language)+ if key:+ return i18n_t(key, language, **kwargs)+ return i18n_t("doctor.repair.dependencyFailedDefault", language)++def _doctor_repair_result(target: str, status: str, message: str, **details) -> dict:payload = {"target": target, "status": status, "message": message}payload.update({key: value for key, value in details.items() if value is not None})@@ -12125,7 +12488,13 @@ def _write_refreshed_runtime_status() -> None:runtime.write_status(resolved.state, resolved.detail, resolved.service_pid, status.get("ui_pid"))-def _start_service_after_repair(target: str, success_message: str, failure_message: str, *, stopped_pids: list[int]) -> dict:+def _start_service_after_repair(+ target: str,+ success_key: str,+ failure_key: str,+ *,+ stopped_pids: list[int],+) -> dict:from core.memory.ui_access import generate_ui_read_secret# This repair stopped the old service and starts a replacement, so it is the@@ -12136,6 +12505,7 @@ def _start_service_after_repair(target: str, success_message: str, failure_messa# old one. Mint a secret for the process being started and realign the UI.memory_ui_secret = generate_ui_read_secret()live_ui_pid = _live_ui_server_pid()+ language = _configured_cli_language()try:new_pid = runtime.start_service(memory_ui_secret=memory_ui_secret)except Exception as exc:@@ -12143,7 +12513,7 @@ def _start_service_after_repair(target: str, success_message: str, failure_messareturn _doctor_repair_result(target,"failed",- f"{failure_message}: {exc}",+ i18n_t(failure_key, language, reason=exc),stopped_pids=stopped_pids,)ui_pid = runtime.read_status().get("ui_pid")@@ -12169,7 +12539,7 @@ def _start_service_after_repair(target: str, success_message: str, failure_messareturn _doctor_repair_result(target,"repaired",- success_message,+ i18n_t(success_key, language),stopped_pids=stopped_pids,service_pid=new_pid,)@@ -12182,8 +12552,13 @@ def _runtime_home_exists_for_repair() -> bool:def _repair_home_migration(*, dry_run: bool = False) -> dict:target = "home-migration"+ language = _configured_cli_language()if os.environ.get(paths.AVIBE_HOME_ENV):- return _doctor_repair_result(target, "skipped", "AVIBE_HOME is explicit; default home migration does not apply.")+ return _doctor_repair_result(+ target,+ "skipped",+ i18n_t("doctor.repair.homeExplicit", language),+ )avibe_home = Path.home() / paths.AVIBE_HOME_DIRNAMElegacy_home = Path.home() / paths.LEGACY_HOME_DIRNAME@@ -12191,31 +12566,31 @@ def _repair_home_migration(*, dry_run: bool = False) -> dict:legacy_present = legacy_home.exists() or legacy_home.is_symlink()if not avibe_present and not legacy_present:- return _doctor_repair_result(target, "skipped", "No runtime home exists yet; nothing needs migration.")+ return _doctor_repair_result(target, "skipped", i18n_t("doctor.repair.homeNoRuntime", language))if avibe_present and legacy_present and not legacy_home.is_symlink():return _doctor_repair_result(target,"failed",- "Both ~/.avibe and ~/.vibe_remote are real directories; manual merge is required.",+ i18n_t("doctor.repair.homeConflict", language),)if not avibe_present and legacy_home.is_symlink():return _doctor_repair_result(target,"failed",- "Legacy home is a symlink but ~/.avibe is missing; inspect the symlink target manually.",+ i18n_t("doctor.repair.homeSymlinkMissingCanonical", language),)if avibe_present and legacy_home.is_symlink() and _path_points_to(legacy_home, avibe_home):- return _doctor_repair_result(target, "skipped", "Runtime home migration is already healthy.")+ return _doctor_repair_result(target, "skipped", i18n_t("doctor.repair.homeHealthy", language))if dry_run:if not avibe_present and legacy_present and not legacy_home.is_symlink():- return _doctor_repair_result(target, "planned", "Would move ~/.vibe_remote to ~/.avibe and create a back-symlink.")+ return _doctor_repair_result(target, "planned", i18n_t("doctor.repair.homeDryMove", language))if avibe_present:- return _doctor_repair_result(target, "planned", "Would recreate the ~/.vibe_remote compatibility symlink.")- return _doctor_repair_result(target, "skipped", "No runtime home migration is needed.")+ return _doctor_repair_result(target, "planned", i18n_t("doctor.repair.homeDryLink", language))+ return _doctor_repair_result(target, "skipped", i18n_t("doctor.repair.homeNoNeed", language))if avibe_present:if legacy_home.is_symlink() or not legacy_present:@@ -12223,54 +12598,68 @@ def _repair_home_migration(*, dry_run: bool = False) -> dict:try:legacy_home.symlink_to(avibe_home, target_is_directory=True)except OSError as exc:- return _doctor_repair_result(target, "failed", f"Failed to create compatibility symlink: {exc}")- return _doctor_repair_result(target, "repaired", "Created ~/.vibe_remote compatibility symlink.")- return _doctor_repair_result(target, "skipped", "No runtime home migration is needed.")+ return _doctor_repair_result(+ target,+ "failed",+ i18n_t("doctor.repair.homeLinkFailed", language, reason=exc),+ )+ return _doctor_repair_result(target, "repaired", i18n_t("doctor.repair.homeLinkCreated", language))+ return _doctor_repair_result(target, "skipped", i18n_t("doctor.repair.homeNoNeed", language))migrated_home = paths.migrate_default_home()if not _path_points_to(migrated_home, avibe_home):- return _doctor_repair_result(target, "failed", f"Default home remains at {migrated_home}; migration did not complete.")+ return _doctor_repair_result(+ target,+ "failed",+ i18n_t("doctor.repair.homeMigrationIncomplete", language, path=migrated_home),+ )if not _path_points_to(legacy_home, avibe_home):return _doctor_repair_result(target,"failed",- "Migrated ~/.vibe_remote to ~/.avibe, but failed to create the compatibility symlink.",+ i18n_t("doctor.repair.homeMigrationLinkFailed", language),)paths.ensure_data_dirs()- return _doctor_repair_result(target, "repaired", "Migrated ~/.vibe_remote to ~/.avibe.")+ return _doctor_repair_result(target, "repaired", i18n_t("doctor.repair.homeMigrated", language))def _repair_stale_restart_state(*, dry_run: bool = False) -> dict:target = "stale-restart-state"+ language = _configured_cli_language()restart_path = runtime.get_restart_status_path()payload = runtime.read_json(restart_path) or {}if not payload:- return _doctor_repair_result(target, "skipped", "No restart metadata is present.")+ return _doctor_repair_result(target, "skipped", i18n_t("doctor.repair.restartAbsent", language))if not _restart_status_is_stale(payload, restart_path):- return _doctor_repair_result(target, "skipped", "Restart metadata is still current.")+ return _doctor_repair_result(target, "skipped", i18n_t("doctor.repair.restartCurrent", language))if dry_run:- return _doctor_repair_result(target, "planned", "Would remove stale restart metadata and refresh runtime status.")+ return _doctor_repair_result(target, "planned", i18n_t("doctor.repair.restartDryRun", language))restart_path.unlink(missing_ok=True)_write_refreshed_runtime_status()- return _doctor_repair_result(target, "repaired", "Removed stale restart metadata and refreshed runtime status.")+ return _doctor_repair_result(target, "repaired", i18n_t("doctor.repair.restartRepaired", language))def _repair_duplicate_service_processes(*, dry_run: bool = False) -> dict:target = "duplicate-service-processes"+ language = _configured_cli_language()if runtime.service_instance_lock_attached_to_process():- return _doctor_repair_result(target, "failed", "Run this repair from the CLI, not from inside the service process.")+ return _doctor_repair_result(target, "failed", i18n_t("doctor.repair.cliOnly", language))if not _runtime_home_exists_for_repair():- return _doctor_repair_result(target, "skipped", "No runtime home exists yet; no service process state needs repair.")+ return _doctor_repair_result(target, "skipped", i18n_t("doctor.repair.noRuntimeProcessState", language))owner_pid = runtime.resolve_service_owner_pid(include_starting=False)extra_pids = runtime.extra_service_process_pids(owner_pid=owner_pid)if not extra_pids:- return _doctor_repair_result(target, "skipped", "No extra Avibe service process was detected.")+ return _doctor_repair_result(target, "skipped", i18n_t("doctor.repair.noExtraProcess", language))if dry_run:return _doctor_repair_result(target,"planned",- f"Would stop extra Avibe service process(es): {','.join(map(str, extra_pids))}.",+ i18n_t(+ "doctor.repair.extraProcessDryRun",+ language,+ pids=",".join(map(str, extra_pids)),+ ),pids=extra_pids,)@@ -12285,8 +12674,8 @@ def _repair_duplicate_service_processes(*, dry_run: bool = False) -> dict:if not owner_pid and stopped and not failed:return _start_service_after_repair(target,- "Stopped lockless service process(es) and started a clean service.",- "Stopped lockless service process(es), but failed to start a clean service",+ "doctor.repair.duplicateStoppedStarted",+ "doctor.repair.duplicateStoppedStartFailed",stopped_pids=stopped,)@@ -12295,19 +12684,25 @@ def _repair_duplicate_service_processes(*, dry_run: bool = False) -> dict:return _doctor_repair_result(target,"failed",- "Some extra service processes could not be stopped.",+ i18n_t("doctor.repair.extraProcessPartial", language),stopped_pids=stopped,failed_pids=failed,)- return _doctor_repair_result(target, "repaired", "Stopped extra Avibe service process(es).", stopped_pids=stopped)+ return _doctor_repair_result(+ target,+ "repaired",+ i18n_t("doctor.repair.extraProcessStopped", language),+ stopped_pids=stopped,+ )def _repair_stale_install_runtime(*, dry_run: bool = False) -> dict:target = "stale-install-runtime"+ language = _configured_cli_language()if runtime.service_instance_lock_attached_to_process():- return _doctor_repair_result(target, "failed", "Run this repair from the CLI, not from inside the service process.")+ return _doctor_repair_result(target, "failed", i18n_t("doctor.repair.cliOnly", language))if not _runtime_home_exists_for_repair():- return _doctor_repair_result(target, "skipped", "No runtime home exists yet; no service process state needs repair.")+ return _doctor_repair_result(target, "skipped", i18n_t("doctor.repair.noRuntimeProcessState", language))current_family = _current_cli_install_family()owner_pid = runtime.resolve_service_owner_pid(include_starting=False)@@ -12322,12 +12717,12 @@ def _repair_stale_install_runtime(*, dry_run: bool = False) -> dict:elif family == PACKAGE_NAME:current_pids.append(pid)if not stale_pids:- return _doctor_repair_result(target, "skipped", "No legacy vibe-remote service process was detected.")+ return _doctor_repair_result(target, "skipped", i18n_t("doctor.repair.noLegacyProcess", language))if dry_run:return _doctor_repair_result(target,"planned",- f"Would stop legacy service process(es) and start current Avibe: {','.join(map(str, stale_pids))}.",+ i18n_t("doctor.repair.staleInstallDryRun", language, pids=",".join(map(str, stale_pids))),pids=stale_pids,)@@ -12344,7 +12739,7 @@ def _repair_stale_install_runtime(*, dry_run: bool = False) -> dict:return _doctor_repair_result(target,"failed",- "Some legacy vibe-remote service processes could not be stopped.",+ i18n_t("doctor.repair.staleInstallPartial", language),stopped_pids=stopped,failed_pids=failed,)@@ -12354,39 +12749,79 @@ def _repair_stale_install_runtime(*, dry_run: bool = False) -> dict:return _doctor_repair_result(target,"repaired",- "Stopped legacy vibe-remote service process(es).",+ i18n_t("doctor.repair.staleInstallStopped", language),stopped_pids=stopped,)return _start_service_after_repair(target,- "Stopped legacy vibe-remote service process and started the current Avibe service.",- "Stopped legacy vibe-remote service process, but failed to start the current Avibe service",+ "doctor.repair.staleInstallStoppedStarted",+ "doctor.repair.staleInstallStoppedStartFailed",stopped_pids=stopped,)def _repair_managed_dependency(target: str, installer, *, dry_run: bool = False) -> dict:+ language = _configured_cli_language()if dry_run:- return _doctor_repair_result(target, "planned", DOCTOR_REPAIR_DRY_RUN_MESSAGES[target])+ return _doctor_repair_result(+ target,+ "planned",+ i18n_t(DOCTOR_REPAIR_DRY_RUN_I18N_KEYS[target], language),+ )try:result = installer(force=True)except Exception as exc: # noqa: BLE001- return _doctor_repair_result(target, "failed", f"{target} repair failed: {exc}")+ return _doctor_repair_result(+ target,+ "failed",+ i18n_t(+ "doctor.repair.dependencyResultFailed",+ language,+ target=target,+ detail=i18n_t("doctor.repair.dependencyException", language, target=target, error=exc),+ ),+ reason=f"{target}_repair_exception",+ error=str(exc),+ )+ if not isinstance(result, dict):+ result = {+ "ok": False,+ "reason": f"{target}_invalid_result",+ "error": i18n_t("doctor.value.unknownError", language),+ }if result.get("ok"):+ version = result.get("version")+ detail = (+ i18n_t("doctor.repair.dependencyVersion", language, version=version)+ if version+ else i18n_t("doctor.repair.dependencyReadyDefault", language)+ )return _doctor_repair_result(target,"repaired" if result.get("changed", True) else "skipped",- str(result.get("message") or f"{target} is ready."),+ i18n_t(+ "doctor.repair.dependencyReady",+ language,+ target=target,+ detail=detail,+ ),path=result.get("path"),- version=result.get("version"),+ version=version,)+ download_error = result.get("download_error") if isinstance(result.get("download_error"), dict) else None+ detail = _doctor_managed_failure_detail(target, result, language)return _doctor_repair_result(target,"failed",- str(result.get("message") or result.get("reason") or f"{target} repair failed"),+ i18n_t(+ "doctor.repair.dependencyResultFailed",+ language,+ target=target,+ detail=detail,+ ),reason=result.get("reason"),- download_error=result.get("download_error"),+ download_error=download_error,output=result.get("output"),)@@ -12415,8 +12850,13 @@ def _repair_show_runtime(*, dry_run: bool = False) -> dict:from core.show_runtime import ShowRuntimeManagertarget = "show-runtime"+ language = _configured_cli_language()if dry_run:- return _doctor_repair_result(target, "planned", DOCTOR_REPAIR_DRY_RUN_MESSAGES[target])+ return _doctor_repair_result(+ target,+ "planned",+ i18n_t(DOCTOR_REPAIR_DRY_RUN_I18N_KEYS[target], language),+ )manager = ShowRuntimeManager()before = manager.status()@@ -12448,14 +12888,13 @@ def _repair_show_runtime(*, dry_run: bool = False) -> dict:return _ShowRuntimeStartability.startable()return _ShowRuntimeStartability.not_startable(result.reason or "runtime_start_failed")- language = _configured_cli_language()if before_installed:startability = verify_startability(before.get("command"))if startability.state is _ShowRuntimeStartabilityState.UNDETERMINED:return _doctor_repair_result(target,"failed",- i18n_t("runtime.doctor.repairVerificationFailed", language, detail=startability.detail),+ i18n_t("doctor.repair.showRuntimeVerificationFailed", language, detail=startability.detail),provider=before.get("provider"),platform=before.get("platform"),install_dir=before_install_dir,@@ -12467,7 +12906,7 @@ def _repair_show_runtime(*, dry_run: bool = False) -> dict:return _doctor_repair_result(target,"skipped",- i18n_t("runtime.doctor.repairHealthy", language),+ i18n_t("doctor.repair.showRuntimeHealthy", language),provider=before.get("provider"),platform=before.get("platform"),install_dir=before_install_dir,@@ -12479,7 +12918,7 @@ def _repair_show_runtime(*, dry_run: bool = False) -> dict:return _doctor_repair_result(target,"failed",- i18n_t("runtime.doctor.repairExplicitCommandFailed", language, reason=reason),+ i18n_t("doctor.repair.showRuntimeExplicitFailed", language, reason=reason),provider=before.get("provider"),platform=before.get("platform"),install_dir=before_install_dir,@@ -12497,7 +12936,7 @@ def _repair_show_runtime(*, dry_run: bool = False) -> dict:return _doctor_repair_result(target,"failed",- i18n_t("runtime.doctor.repairLegacyArchiveUnavailable", language),+ i18n_t("doctor.repair.showRuntimeLegacyUnavailable", language),provider=before.get("provider"),archive_url=archive_url,)@@ -12515,9 +12954,9 @@ def _repair_show_runtime(*, dry_run: bool = False) -> dict:"repaired",i18n_t((- "runtime.doctor.repairReinstalled"+ "doctor.repair.showRuntimeReinstalled"if before_installed- else "runtime.doctor.repairInstalled"+ else "doctor.repair.showRuntimeInstalled"),language,),@@ -12532,9 +12971,9 @@ def _repair_show_runtime(*, dry_run: bool = False) -> dict:"failed",i18n_t((- "runtime.doctor.repairReinstallStartFailed"+ "doctor.repair.showRuntimeReinstallStartFailed"if before_installed- else "runtime.doctor.repairInstallStartFailed"+ else "doctor.repair.showRuntimeInstallStartFailed"),language,reason=reason,@@ -12548,7 +12987,7 @@ def _repair_show_runtime(*, dry_run: bool = False) -> dict:return _doctor_repair_result(target,"failed",- i18n_t("runtime.doctor.repairPostVerificationFailed", language, detail=startability.detail),+ i18n_t("doctor.repair.showRuntimePostVerificationFailed", language, detail=startability.detail),provider=result.get("provider"),platform=result.get("platform"),install_dir=install_dir,@@ -12565,11 +13004,10 @@ def _repair_show_runtime(*, dry_run: bool = False) -> dict:detail = f"{detail}: {download_error['url']}"else:detail = reason- message = i18n_t("runtime.doctor.repairPrepareFailed", language, detail=detail)return _doctor_repair_result(target,"failed",- message,+ i18n_t("doctor.repair.showRuntimePrepareFailed", language, detail=detail),provider=result.get("provider"),platform=result.get("platform"),install_dir=install_dir,@@ -12580,6 +13018,7 @@ def _repair_show_runtime(*, dry_run: bool = False) -> dict:def _repair_doctor_targets(targets: list[str], *, dry_run: bool = False, deep: bool = False) -> dict:+ language = _configured_cli_language()requested_targets = targets or list(DOCTOR_DEFAULT_REPAIR_TARGETS)unknown = [target for target in requested_targets if target not in DOCTOR_REPAIR_TARGETS]if unknown:@@ -12591,7 +13030,12 @@ def _repair_doctor_targets(targets: list[str], *, dry_run: bool = False, deep: b_doctor_repair_result(target,"failed",- f"Unknown repair target. Known targets: {', '.join(DOCTOR_REPAIR_TARGETS)}.",+ i18n_t(+ "doctor.repair.unknownTarget",+ language,+ target=target,+ known_targets=", ".join(DOCTOR_REPAIR_TARGETS),+ ),)for target in unknown],@@ -12606,7 +13050,7 @@ def _repair_doctor_targets(targets: list[str], *, dry_run: bool = False, deep: b_doctor_repair_result(target,"planned",- DOCTOR_REPAIR_DRY_RUN_MESSAGES[target],+ i18n_t(DOCTOR_REPAIR_DRY_RUN_I18N_KEYS[target], language),)for target in requested_targets],@@ -12640,7 +13084,13 @@ def _confirm_doctor_repair(targets: list[str]) -> bool:if not sys.stdin.isatty():return Falsetarget_text = ", ".join(targets or DOCTOR_DEFAULT_REPAIR_TARGETS)- answer = input(f"Repair Avibe doctor target(s): {target_text}? Type 'yes' to continue: ")+ answer = input(+ i18n_t(+ "doctor.repairConfirm",+ _configured_cli_language(),+ targets=target_text,+ )+ )return answer.strip().lower() == "yes"@@ -14276,9 +14726,10 @@ def _doctor_repair_requested(args) -> bool:def _print_doctor_repair_result(result: dict) -> None:- title = "Avibe Doctor Repair"+ language = _configured_cli_language()+ title = i18n_t("doctor.repairTitle", language)if result.get("dry_run"):- title = f"{title} (dry run)"+ title += i18n_t("doctor.dryRunSuffix", language)print(f"\n {title}")print(" " + "=" * 40)for item in result.get("results", []):@@ -14298,7 +14749,7 @@ def cmd_doctor(args=None):targets = list(getattr(args, "doctor_repair_targets", []) or [])dry_run = bool(getattr(args, "dry_run", False))if not dry_run and not getattr(args, "yes", False) and not _confirm_doctor_repair(targets):- print("Doctor repair was not run. Pass --yes to confirm non-interactively.", file=sys.stderr)+ print(i18n_t("doctor.repairNotRun", _configured_cli_language()), file=sys.stderr)return 2result = _repair_doctor_targets(targets,@@ -14312,7 +14763,8 @@ def cmd_doctor(args=None):result = _doctor(deep=deep)# Terminal-friendly output- print("\n Avibe Diagnostics")+ language = _configured_cli_language()+ print(f"\n {i18n_t('doctor.title', language)}")print(" " + "=" * 40)for group in result.get("groups", []):@@ -14334,9 +14786,9 @@ def cmd_doctor(args=None):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"+ f" \033[32m{i18n_t('doctor.summary.passed', language, count=summary.get('pass', 0))}\033[0m "+ f"\033[33m{i18n_t('doctor.summary.warnings', language, count=summary.get('warn', 0))}\033[0m "+ f"\033[31m{i18n_t('doctor.summary.failed', language, count=summary.get('fail', 0))}\033[0m")print()diff --git a/vibe/i18n/en.json b/vibe/i18n/en.jsonindex e65609b01..fbea52a59 100644--- a/vibe/i18n/en.json+++ b/vibe/i18n/en.json@@ -1012,6 +1012,366 @@"repairLegacyArchiveUnavailable": "The packaged Show Runtime manifest is unavailable and the legacy upstream archive URL has no release asset. Upgrade or reinstall the official Avibe package, or remove stale runtime source overrides."}},+ "doctor": {+ "title": "Avibe Diagnostics",+ "repairTitle": "Avibe Doctor Repair",+ "dryRunSuffix": " (dry run)",+ "repairConfirm": "Repair Avibe doctor target(s): {targets}? Type 'yes' to continue: ",+ "repairNotRun": "Doctor repair was not run. Pass --yes to confirm non-interactively.",+ "summary": {+ "passed": "{count} passed",+ "warnings": "{count} warnings",+ "failed": "{count} failed"+ },+ "value": {+ "notConfigured": "not configured",+ "unknown": "unknown",+ "unknownError": "unknown error",+ "missing": "missing",+ "currentPlatform": "this platform",+ "selectedDependencyUrl": "the selected dependency URL",+ "tunnelStateHealthy": "healthy",+ "tunnelStateDegraded": "degraded",+ "tunnelStateRecovering": "recovering",+ "tunnelStateUnknown": "unknown",+ "tunnelGradeGood": "good",+ "tunnelGradeFair": "fair",+ "tunnelGradePoor": "poor",+ "tunnelGradeCritical": "critical",+ "tunnelGradeUnknown": "unknown",+ "tunnelProtocolQuic": "QUIC",+ "tunnelProtocolHttp2": "HTTP/2",+ "tunnelProtocolUnknown": "unknown",+ "restartStateRunning": "running",+ "restartStateScheduled": "scheduled",+ "restartStateSucceeded": "succeeded",+ "restartStateFailed": "failed",+ "restartStateError": "error",+ "restartStateCancelled": "cancelled",+ "restartStateSkipped": "skipped",+ "restartStateUnknown": "unknown",+ "restartSummaryState": "state={value}",+ "restartSummaryError": "error={value}",+ "restartSummaryTrigger": "trigger={value}",+ "restartSummaryJobId": "job_id={value}",+ "restartSummaryLog": "log={value}",+ "showRuntimeManifest": "Show Runtime manifest",+ "showRuntimeArchive": "Show Runtime archive",+ "showRuntimeProviderManifest": "manifest-cache",+ "showRuntimeProviderArchive": "archive",+ "showRuntimeProviderNpm": "npm",+ "showRuntimeProviderUnknown": "unknown"+ },+ "group": {+ "runtimeHome": "Runtime Home",+ "configuration": "Configuration",+ "remoteAccess": "Remote Access",+ "slack": "Slack",+ "agentBackends": "Agent Backends",+ "runtime": "Runtime",+ "dependencies": "Dependencies",+ "localCliInstallation": "Local CLI Installation"+ },+ "item": {+ "pythonArchitecture": "Python runtime architecture: {architecture} ({executable})",+ "uvArchitecture": "uv architecture: {architecture} ({path})",+ "uvMissing": "uv command not found on PATH",+ "hostArchitecture": "Host architecture: {architecture}",+ "explicitHome": "AVIBE_HOME is set explicitly: {path}",+ "homeReady": "Default runtime home is ready to initialize at {path}",+ "legacyHomeLinkHealthy": "Legacy home compatibility symlink is healthy: {legacy_path} -> {active_path}",+ "legacyHomeLinkMissing": "Legacy home compatibility path is missing: {path}",+ "legacyHomeLinkWrong": "Legacy home symlink does not point to the active home: {path}",+ "homeConflict": "Both {active_path} and {legacy_path} are real directories",+ "legacyHomeWithoutCanonical": "Legacy home symlink exists but canonical {active_path} is missing",+ "legacyHomeUnmigrated": "Runtime home still uses the legacy path: {path}",+ "staleInstallProcess": "Running service process still comes from the legacy vibe-remote installation: pids={pids}",+ "installMismatchNone": "No legacy install mismatch detected for running service: pid={pid}",+ "installMismatchSkipped": "Current CLI install family is not a uv tool install; skipped install mismatch check: pid={pid}",+ "installMismatchAbsent": "No running service install mismatch detected",+ "restartStateAbsent": "No restart metadata is present",+ "restartFailed": "Last restart failed and no service is running: {summary}",+ "staleRestartState": "Stale restart metadata is present: state={state}",+ "restartStateCurrent": "Restart metadata is current: state={state}",+ "serviceLockOwner": "Service lock owner: pid={pid}",+ "serviceLockUnverified": "Service lock is held by pid={pid}, but the owner could not be verified",+ "serviceLockFree": "Service lock is free",+ "servicePidfileMismatch": "Service pid file does not match the lock owner: pidfile={pidfile} lock_owner={owner}",+ "servicePidfile": "Service pid file points to pid={pid}",+ "servicePidfileAbsent": "Service pid file is absent",+ "statusPidMismatch": "Runtime status service_pid does not match the lock owner: status={status} lock_owner={owner}",+ "statusPid": "Runtime status service_pid: {pid}",+ "statusPidAbsent": "Runtime status service_pid is absent",+ "extraServiceProcess": "Extra Avibe service process detected outside the service lock: pids={pids}",+ "unverifiedServiceProcess": "Possible extra Avibe service process could not be matched to AVIBE_HOME: pids={pids}",+ "noExtraServiceProcess": "No extra Avibe service process detected",+ "deepScanSkipped": "Deep service process scan skipped in fast diagnostics",+ "showGitUnavailable": "Show Page checkpointing is degraded because Git is unavailable",+ "dependencyHttp404": "{label} release asset is missing (HTTP 404): {url}",+ "dependencyHttpError": "{label} request returned HTTP {status}: {url}",+ "dependencyHttpErrorRetried": "{label} request returned HTTP {status} after {attempts} attempts: {url}",+ "dependencyDnsFailed": "{label} host DNS lookup failed: {host}",+ "dependencyDnsFailedRetried": "{label} host DNS lookup failed after {attempts} attempts: {host}",+ "dependencyTlsFailed": "{label} TLS verification failed: {url}",+ "dependencyNetworkFailed": "{label} network request failed: {url}",+ "dependencyNetworkFailedRetried": "{label} network request failed after {attempts} attempts: {url}",+ "dependencyStoreFailed": "{label} could not be stored: {reason}",+ "dependencyUnreachable": "{label} is unreachable: {reason}",+ "dependencyStatusFailed": "Managed dependency status could not be inspected: {reason}",+ "gitSystemReady": "Git is ready via the system runtime",+ "dependencyReady": "{label} is ready",+ "dependencyReadyVersioned": "{label} {version} is ready",+ "nodeNotReady": "{label} is missing or unsupported",+ "dependencyPlatformUnsupported": "{label} is not published for this platform",+ "dependencyArchiveUrlUnsupported": "{label} archive URL uses an unsupported scheme: {url}",+ "dependencyNotReady": "{label} is not ready",+ "dependencyReachable": "{label} download endpoint is reachable: {url}",+ "dependencyProbeUnsupported": "{label} server does not support a body-free probe",+ "dependencyProbeUnavailable": "{label} archive could not be resolved",+ "showRuntimeStatusFailed": "Show Runtime status could not be inspected: {reason}",+ "archiveCacheSkipped": "Show Runtime archive cache was not inspected; it may still hold reclaimable archives.",+ "archiveCacheReclaimable": "Show Runtime archive cache holds {count} reclaimable archive(s) ({size}); the current and rollback archives are kept.",+ "archiveCacheClean": "Show Runtime archive cache has no reclaimable archives",+ "explicitCommandAvailable": "Show Runtime explicit command is available: {command}",+ "explicitCommandMissing": "Show Runtime explicit command is missing: {command}",+ "manifestMissing": "The packaged Show Runtime manifest is missing or invalid",+ "manifestPlatformUnsupported": "The Show Runtime manifest has no archive for {platform}",+ "manifestReady": "Show Runtime manifest pins {name} from {url}",+ "legacyArchiveProvider": "Show Runtime selected the legacy unpinned archive URL: {url}",+ "unpinnedArchiveProvider": "Show Runtime uses an explicit unpinned archive provider",+ "developmentProvider": "Show Runtime uses the {provider} development provider",+ "providerUnsupported": "Show Runtime provider is unsupported: {provider}",+ "showRuntimeInstalled": "Show Runtime is installed for {platform}",+ "showRuntimeNotReady": "Show Runtime is not ready for {platform}",+ "archiveProbeSkipped": "Show Runtime archive reachability was not checked in fast diagnostics",+ "archiveReachable": "Show Runtime archive is reachable: {target}",+ "archiveProbeUnsupported": "Show Runtime archive server does not support a body-free reachability probe",+ "archiveUrlUnsupported": "Show Runtime archive URL scheme is unsupported: {url}",+ "manifestUnavailable": "Show Runtime manifest could not be loaded",+ "archiveCheckFailed": "Show Runtime archive check failed",+ "configFound": "Configuration file found: {path}",+ "configRecovery": "Config was loaded with recovery warnings; repair the backed-up config before changing backend credentials",+ "configMissing": "Configuration file not found",+ "configLoaded": "Configuration loaded successfully",+ "configLoadFailed": "Failed to load configuration: {reason}",+ "remoteConfigMissing": "Cannot check Remote Access: configuration not loaded",+ "remoteDisabled": "Remote Access is disabled",+ "remoteNotRunning": "Remote Access connector is not running",+ "remoteRunning": "Remote Access connector is running",+ "tunnelQualityUnavailable": "Tunnel quality is not available yet",+ "tunnelQualityStale": "Tunnel quality sample is stale",+ "tunnelQualityRequestsUnavailable": "Tunnel quality: {state}/{grade}; remote requests unavailable, {succeeded}/{samples} succeeded; connector {protocol}",+ "tunnelQualityLatency": "Tunnel quality: {state}/{grade}; remote requests P95 {p95} ms, P99 {p99} ms, {slow_rate}% above 1 second; connector {protocol}",+ "tunnelQualityRttUnavailable": "Tunnel quality: {state}; edge RTT unavailable for {protocol} transport",+ "tunnelQualityRtt": "Tunnel quality: {state}/{grade}; edge RTT median {median} ms, maximum {maximum} ms",+ "slackTokenValid": "Slack token format is valid",+ "slackBotConfigured": "Bot token is configured",+ "slackBotMissing": "Bot token is not configured",+ "slackAppConfigured": "App token is configured (Socket Mode)",+ "slackAppMissing": "App token is not configured",+ "slackValidationFailed": "Slack token validation failed: {reason}",+ "slackConfigMissing": "Cannot check Slack: configuration not loaded",+ "agentCliFound": "{agent} CLI found: {path}",+ "agentCliMissing": "{agent} CLI not found: {path}",+ "agentDisabled": "{agent}: disabled",+ "defaultAgent": "Default Agent: {agent}",+ "agentConfigMissing": "Cannot check agents: configuration not loaded",+ "workingDirectory": "Working directory: {path}",+ "workingDirectoryMissing": "Working directory does not exist: {path}",+ "logLevel": "Log level: {level}",+ "logFile": "Log file: {path}",+ "logFilePending": "Log file will be created on first run",+ "cliMissing": "No vibe executable found on PATH",+ "cliPathPrecedence": "PATH resolves vibe to {active} before {preferred}",+ "cliPath": "PATH resolves vibe to {path}",+ "cliNotUvTool": "Active vibe executable is not the uv tool installation",+ "cliEditable": "uv tool installation is editable: {path}",+ "cliNotEditable": "uv tool installation is not editable: {path}",+ "packageIntegrityOk": "Python package files are intact ({count} checked)",+ "packageIntegrityFailed": "Python package integrity check failed: {detail}",+ "packageIntegrityFailedMore": "Python package integrity check failed: {detail}, and {count} more",+ "alembicMissing": "Packaged Alembic scripts are missing under {path}",+ "alembicFound": "Packaged Alembic scripts found: {path}",+ "alembicRevisionsMissing": "No Alembic revision files found under {path}",+ "sqliteRevisionAbsent": "SQLite schema revision is not initialized yet",+ "sqliteRevisionKnown": "SQLite schema revision is recognized by this CLI: {revision}",+ "sqliteRevisionUnknown": "SQLite schema revision is newer than or unknown to this CLI: {revision}"+ },+ "action": {+ "nativeArmPython": "Reinstall Avibe with native arm64 uv/Python",+ "nativeArmUv": "Install native arm64 uv, then reinstall Avibe",+ "nativeUvWrapper": "Check whether this uv wrapper launches native arm64 uv",+ "uvMissing": "Install uv or add its bin directory to PATH",+ "homeMigrationCreateLink": "Run `vibe doctor repair home-migration` to create the compatibility symlink.",+ "homeMigrationRecreateLink": "Run `vibe doctor repair home-migration` to recreate the compatibility symlink.",+ "homeConflict": "Back up and merge the two homes manually before running repair.",+ "legacyHomeWithoutCanonical": "Inspect the symlink target before repair; Avibe will not guess which state to keep.",+ "homeMigration": "Run `vibe doctor repair home-migration` to move it to ~/.avibe and keep a back-symlink.",+ "staleInstallRuntime": "Run `vibe doctor repair stale-install-runtime` to stop the stale service and start the current Avibe install.",+ "restartFailed": "Read the restart log named above for the cause, then run `vibe start`. If that reports a service already running, the failed generation is still occupying this instance: run `vibe doctor repair duplicate-service-processes`, which stops a process holding no lock and brings the service up, or `vibe stop` if the failed process holds the lock itself, and then repeat the start above.",+ "staleRestartState": "Run `vibe doctor repair stale-restart-state` to clear the stale restart marker and refresh status.",+ "serviceLockUnverified": "Run `vibe status` and inspect service logs before starting another service.",+ "servicePidfileMismatch": "Run `vibe restart` once the current work is idle so Avibe can rewrite runtime ownership files.",+ "statusPidMismatch": "Refresh status; if it remains stale, restart Avibe when safe.",+ "duplicateServiceProcesses": "Run `vibe doctor repair duplicate-service-processes` to stop extra service processes.",+ "unverifiedServiceProcess": "Inspect the process environment before starting another service.",+ "deepScanSkipped": "Run deep diagnostics to check duplicate service processes.",+ "dependencyHttp404": "Verify the exact URL from another network. If the release asset is absent, upgrade or reinstall Avibe; if it works elsewhere, fix the proxy or security gateway.",+ "dependencyHttpError": "Check the exact release asset and any proxy response. {retry}",+ "dependencyDnsFailed": "Fix DNS access to the dependency host. {retry}",+ "dependencyTlsFailed": "Fix the host CA or HTTPS inspection proxy for the Avibe service, then retry the repair.",+ "dependencyNetworkFailed": "Allow HTTPS access to the dependency host. {retry}",+ "dependencyStoreFailed": "Fix the runtime cache permissions or available disk space, then retry the repair.",+ "dependencyUnreachable": "Inspect the Avibe log for the matching download exception, then retry the repair.",+ "dependencyStatusFailed": "Inspect the Avibe log and rerun Doctor.",+ "nodeNotReady": "Install a supported Node.js release (^20.19.0 or >=22.12.0).",+ "dependencyPlatformUnsupported": "Use a system dependency where supported, or run Avibe on a platform with a published runtime.",+ "dependencyArchiveUrlUnsupported": "Configure the dependency manifest with an HTTPS or file URL.",+ "dependencyNotReady": "{retry}",+ "dependencyProbeUnsupported": "{retry}",+ "dependencyProbeUnavailable": "Inspect the dependency manifest and platform mapping before retrying.",+ "repairCommand": "Run `vibe doctor repair {target}`.",+ "askillManual": "Install askill manually from https://askill.sh.",+ "showRuntimeStatusFailed": "Inspect the Avibe log and reinstall the current Avibe release if package data is missing.",+ "archiveCacheSkipped": "Wait for the running install or clean to finish, then rerun Doctor.",+ "archiveCacheSkippedInspection": "Check runtime directory permissions and the Avibe log; retry Doctor once fixed.",+ "archiveCacheReclaimable": "Run `vibe runtime clean --dry-run` to preview, then `vibe runtime clean` to reclaim.",+ "explicitCommandMissing": "Fix or remove VIBE_SHOW_RUNTIME_BIN, then rerun Doctor.",+ "manifestMissing": "Upgrade or reinstall Avibe from an official wheel that includes the pinned runtime manifest.",+ "manifestPlatformUnsupported": "Install Avibe on a supported platform or upgrade to a release that publishes this platform archive.",+ "legacyArchiveProvider": "Reinstall the official Avibe package or remove VIBE_SHOW_RUNTIME_SOURCE/ARCHIVE overrides. The upstream source repository does not publish release assets.",+ "unpinnedArchiveProvider": "Prefer the manifest-cache provider for official installations.",+ "developmentProvider": "Use manifest-cache for official installations; keep this override only for development.",+ "providerUnsupported": "Remove VIBE_SHOW_RUNTIME_SOURCE to use the packaged runtime, or set VIBE_SHOW_RUNTIME_BIN to a runtime you built.",+ "showRuntimeRepair": "Run `vibe doctor repair show-runtime`; use `vibe doctor --deep` first when download access is uncertain.",+ "showRuntimeRetry": "Resolve the provider, platform, Node.js, or archive URL issue above, then rerun Doctor.",+ "archiveProbeSkipped": "Run `vibe doctor --deep` to distinguish HTTP, DNS, TLS, and timeout failures without downloading the archive.",+ "archiveProbeUnsupported": "{retry}",+ "archiveUrlUnsupported": "Use an HTTPS or file URL for the archive, then rerun deep Doctor.",+ "manifestUnavailable": "Inspect the configured or packaged Runtime manifest, then reinstall the current Avibe release if needed.",+ "showRuntimePlatformUnsupported": "Install an Avibe release that publishes a Runtime archive for this platform.",+ "archiveCheckFailed": "Inspect the selected archive path or URL. {retry}",+ "configMissing": "Run 'vibe' to create initial configuration",+ "configRecovery": "Review the preserved config backup and repair it before changing settings.",+ "configLoadFailed": "Check config.json syntax or delete and reconfigure",+ "remoteNotRunning": "Start Remote Access from Settings or run `vibe remote start`.",+ "tunnelQualityUnavailable": "Wait up to 45 seconds for the first metrics samples.",+ "tunnelQualityStale": "Wait up to 45 seconds for fresh metrics or inspect the Remote Access logs.",+ "tunnelQualityWarn": "Avibe will evaluate a second Connector automatically when degradation persists.",+ "slackBotMissing": "Add your Slack bot token in the setup wizard",+ "slackAppMissing": "Add your Slack app token for Socket Mode",+ "slackValidationFailed": "Check your Slack tokens in the setup wizard",+ "agentCliMissing": "Install {agent} or update CLI path",+ "workingDirectoryMissing": "Update default_cwd in settings",+ "cliMissing": "Install Avibe with uv tool or add the intended vibe executable to PATH.",+ "cliPathPrecedence": "Put ~/.local/bin before system Python bin directories when using the uv tool installation.",+ "cliNotUvTool": "uv tool package-integrity checks are skipped for this executable.",+ "cliEditable": "Reinstall Avibe from a normal wheel. Do not use 'uv tool install --editable .' for the live local CLI.",+ "packageIntegrityFailed": "Rerun the Avibe installer to replace the active environment with a verified wheel.",+ "alembicMissing": "Reinstall from a wheel that includes storage/alembic. Editable uv tool installs can miss this package data.",+ "alembicRevisionsMissing": "Reinstall from a wheel that includes storage/alembic/versions.",+ "sqliteRevisionUnknown": "Install an Avibe wheel built from code that contains this migration revision."+ },+ "repair": {+ "homeExplicit": "AVIBE_HOME is explicit; default home migration does not apply.",+ "homeNoRuntime": "No runtime home exists yet; nothing needs migration.",+ "homeConflict": "Both ~/.avibe and ~/.vibe_remote are real directories; manual merge is required.",+ "homeSymlinkMissingCanonical": "Legacy home is a symlink but ~/.avibe is missing; inspect the symlink target manually.",+ "homeHealthy": "Runtime home migration is already healthy.",+ "homeDryMove": "Would move ~/.vibe_remote to ~/.avibe and create a back-symlink.",+ "homeDryLink": "Would recreate the ~/.vibe_remote compatibility symlink.",+ "homeNoNeed": "No runtime home migration is needed.",+ "homeLinkFailed": "Failed to create compatibility symlink: {reason}",+ "homeLinkCreated": "Created ~/.vibe_remote compatibility symlink.",+ "homeMigrationIncomplete": "Default home remains at {path}; migration did not complete.",+ "homeMigrationLinkFailed": "Migrated ~/.vibe_remote to ~/.avibe, but failed to create the compatibility symlink.",+ "homeMigrated": "Migrated ~/.vibe_remote to ~/.avibe.",+ "restartAbsent": "No restart metadata is present.",+ "restartCurrent": "Restart metadata is still current.",+ "restartDryRun": "Would remove stale restart metadata and refresh runtime status.",+ "restartRepaired": "Removed stale restart metadata and refreshed runtime status.",+ "cliOnly": "Run this repair from the CLI, not from inside the service process.",+ "noRuntimeProcessState": "No runtime home exists yet; no service process state needs repair.",+ "noExtraProcess": "No extra Avibe service process was detected.",+ "extraProcessDryRun": "Would stop extra Avibe service process(es): {pids}.",+ "extraProcessPartial": "Some extra service processes could not be stopped.",+ "extraProcessStopped": "Stopped extra Avibe service process(es).",+ "noLegacyProcess": "No legacy vibe-remote service process was detected.",+ "staleInstallDryRun": "Would stop legacy service process(es) and start current Avibe: {pids}.",+ "staleInstallPartial": "Some legacy vibe-remote service processes could not be stopped.",+ "staleInstallStopped": "Stopped legacy vibe-remote service process(es).",+ "duplicateStoppedStarted": "Stopped lockless service process(es) and started a clean service.",+ "duplicateStoppedStartFailed": "Stopped lockless service process(es), but failed to start a clean service: {reason}",+ "staleInstallStoppedStarted": "Stopped legacy vibe-remote service process and started the current Avibe service.",+ "staleInstallStoppedStartFailed": "Stopped legacy vibe-remote service process, but failed to start the current Avibe service: {reason}",+ "dependencyFailed": "{target} repair failed: {reason}",+ "dependencyReady": "{target} repair completed: {detail}",+ "dependencyVersion": "Installed version {version}.",+ "dependencyReadyDefault": "Dependency is ready.",+ "dependencyResultFailed": "{target} repair failed: {detail}",+ "dependencyException": "{target} installer failed: {error}",+ "dependencyDownloadHttp": "Dependency download returned HTTP {status} after {attempts} attempts.",+ "dependencyDownloadDns": "Dependency host DNS lookup failed after {attempts} attempts.",+ "dependencyDownloadTls": "Dependency TLS verification failed.",+ "dependencyDownloadTimeout": "Dependency download timed out after {attempts} attempts.",+ "dependencyDownloadNetwork": "Dependency network request failed after {attempts} attempts.",+ "dependencyDownloadPermission": "Permission was denied while storing the dependency.",+ "dependencyDownloadDisk": "There is not enough disk space to store the dependency.",+ "dependencyDownloadIo": "Dependency file access failed.",+ "dependencyDownloadUnknown": "Dependency download failed.",+ "askillAutoInstallUnsupported": "askill auto-install requires {tools}. Install it manually.",+ "askillInstallPathMissing": "askill installer completed, but askill was not found on PATH.",+ "installTimeout": "The {target} installer timed out after {timeout_seconds} seconds.",+ "installCommandFailed": "The {target} installer exited with code {exit_code}.",+ "installError": "The {target} installer failed: {error}.",+ "avaultPlatformUnsupported": "No avault build is published for {platform}.",+ "avaultChecksumMismatch": "avault archive checksum verification failed (expected {expected_sha256}, got {actual_sha256}).",+ "avaultInstallPathMissing": "avault installer completed, but avault was not found on PATH.",+ "avaultInstallFailed": "avault installation failed: {error}.",+ "avaultReleaseUnavailable": "The required avault release is unavailable.",+ "dependencyAlreadyRunning": "Another {target} installation is already running; try again shortly.",+ "dependencyPlatformUnsupported": "No {target} build is published for this platform.",+ "dependencyManifestMissing": "The {target} manifest is missing.",+ "dependencyManifestInvalid": "The {target} manifest is invalid.",+ "dependencyManifestUnavailable": "The {target} manifest is unavailable.",+ "dependencyManifestDownloadFailed": "The {target} manifest could not be downloaded.",+ "dependencyArchiveUnavailable": "The {target} archive is unavailable.",+ "dependencyArchiveDownloadFailed": "The {target} archive could not be downloaded.",+ "dependencyArchiveVerificationFailed": "The {target} archive failed verification.",+ "dependencyBinaryVerificationFailed": "The {target} binary failed checksum verification.",+ "dependencyBinaryNotRunnable": "The {target} binary is not runnable.",+ "dependencyBinaryPrepareFailed": "The {target} binary could not be prepared.",+ "dependencyInstallMissingBinary": "The {target} archive did not contain its binary.",+ "dependencyInstallLockFailed": "The {target} installation lock could not be acquired: {error}.",+ "dependencyInstallClaimFailed": "The {target} installation claim could not be recorded: {error}.",+ "dependencyInstallTargetChanged": "The {target} installation target changed while repairing.",+ "dependencyPointerWriteFailed": "The {target} installation pointer could not be updated.",+ "dependencyCodeSignMissing": "The {target} binary could not be code-signed because codesign is unavailable.",+ "dependencyCodeSignFailed": "The {target} binary could not be code-signed.",+ "dependencyMetadataFailed": "The {target} binary metadata could not be updated.",+ "dependencyFailedDefault": "Repair failed.",+ "showRuntimeVerificationFailed": "Show Runtime startability could not be verified, so no reinstall was attempted: {detail}",+ "showRuntimeHealthy": "Show Runtime starts successfully; no repair is needed.",+ "showRuntimeExplicitFailed": "The Show Runtime command from VIBE_SHOW_RUNTIME_BIN could not start: {reason}. Fix or remove the override, then rerun Doctor.",+ "showRuntimeLegacyUnavailable": "The packaged Show Runtime manifest is unavailable and the legacy upstream archive URL has no release asset. Upgrade or reinstall the official Avibe package, or remove stale runtime source overrides.",+ "showRuntimeInstalled": "Installed and started Show Runtime.",+ "showRuntimeReinstalled": "Reinstalled and started Show Runtime.",+ "showRuntimeInstallStartFailed": "Show Runtime was installed but could not start: {reason}",+ "showRuntimeReinstallStartFailed": "Show Runtime was reinstalled but could not start: {reason}",+ "showRuntimePostVerificationFailed": "Show Runtime preparation completed, but startability could not be verified: {detail}",+ "showRuntimePrepareFailed": "Show Runtime preparation failed: {detail}",+ "unknownTarget": "Unknown repair target {target}. Known targets: {known_targets}.",+ "dryHomeMigration": "Would migrate ~/.vibe_remote to ~/.avibe when safe, or recreate the legacy compatibility symlink.",+ "dryStaleInstall": "Would stop a running legacy vibe-remote service and start the current Avibe service.",+ "dryDuplicateProcesses": "Would stop extra Avibe service processes outside the service lock.",+ "dryStaleRestart": "Would remove stale restart metadata and refresh runtime status.",+ "dryAskill": "Would install or refresh askill with the official installer.",+ "dryAvault": "Would install or refresh the manifest-pinned avault release.",+ "dryGitRuntime": "Would install or refresh the manifest-pinned Git Runtime.",+ "dryShowRuntime": "Would prepare the manifest-pinned Show Runtime archive when it is missing or invalid.",+ "dryTmux": "Would install or refresh the manifest-pinned tmux runtime."+ }+ },"data": {"helpCommand": "Inspect Avibe data, and run explicit trace-retention maintenance","helpDescription": "Inspect local Avibe SQLite state with guarded read-only SQL, or run explicit maintenance: `query` is read-only, while `retention --run` deletes old internal trace events and may compact the database.",diff --git a/vibe/i18n/zh.json b/vibe/i18n/zh.jsonindex 9f090e269..eb68e6818 100644--- a/vibe/i18n/zh.json+++ b/vibe/i18n/zh.json@@ -1012,6 +1012,366 @@"repairLegacyArchiveUnavailable": "\u6253\u5305\u7684 Show Runtime \u6e05\u5355\u4e0d\u53ef\u7528\uff0c\u65e7\u7248\u4e0a\u6e38\u5f52\u6863\u5730\u5740\u4e5f\u6ca1\u6709\u53d1\u5e03\u8d44\u4ea7\u3002\u8bf7\u5347\u7ea7\u6216\u91cd\u65b0\u5b89\u88c5\u5b98\u65b9 Avibe \u8f6f\u4ef6\u5305\uff0c\u6216\u79fb\u9664\u8fc7\u671f\u7684 runtime \u6765\u6e90\u8986\u76d6\u914d\u7f6e\u3002"}},+ "doctor": {+ "title": "Avibe 诊断",+ "repairTitle": "Avibe Doctor 修复",+ "dryRunSuffix": "(演练)",+ "repairConfirm": "修复 Avibe Doctor 目标({targets})?输入 'yes' 继续:",+ "repairNotRun": "未执行 Doctor 修复。请传入 --yes 以非交互方式确认。",+ "summary": {+ "passed": "{count} 项通过",+ "warnings": "{count} 项警告",+ "failed": "{count} 项失败"+ },+ "value": {+ "notConfigured": "未配置",+ "unknown": "未知",+ "unknownError": "未知错误",+ "missing": "缺失",+ "currentPlatform": "当前平台",+ "selectedDependencyUrl": "所选依赖 URL",+ "tunnelStateHealthy": "健康",+ "tunnelStateDegraded": "降级",+ "tunnelStateRecovering": "恢复中",+ "tunnelStateUnknown": "未知",+ "tunnelGradeGood": "良好",+ "tunnelGradeFair": "一般",+ "tunnelGradePoor": "较差",+ "tunnelGradeCritical": "严重",+ "tunnelGradeUnknown": "未知",+ "tunnelProtocolQuic": "QUIC",+ "tunnelProtocolHttp2": "HTTP/2",+ "tunnelProtocolUnknown": "未知",+ "restartStateRunning": "运行中",+ "restartStateScheduled": "已计划",+ "restartStateSucceeded": "成功",+ "restartStateFailed": "失败",+ "restartStateError": "错误",+ "restartStateCancelled": "已取消",+ "restartStateSkipped": "已跳过",+ "restartStateUnknown": "未知",+ "restartSummaryState": "状态={value}",+ "restartSummaryError": "错误={value}",+ "restartSummaryTrigger": "触发来源={value}",+ "restartSummaryJobId": "任务 ID={value}",+ "restartSummaryLog": "日志={value}",+ "showRuntimeManifest": "Show Runtime 清单",+ "showRuntimeArchive": "Show Runtime 归档",+ "showRuntimeProviderManifest": "manifest-cache",+ "showRuntimeProviderArchive": "archive",+ "showRuntimeProviderNpm": "npm",+ "showRuntimeProviderUnknown": "未知"+ },+ "group": {+ "runtimeHome": "运行时目录",+ "configuration": "配置",+ "remoteAccess": "远程访问",+ "slack": "Slack",+ "agentBackends": "Agent 后端",+ "runtime": "运行时",+ "dependencies": "依赖",+ "localCliInstallation": "本地 CLI 安装"+ },+ "item": {+ "pythonArchitecture": "Python 运行时架构:{architecture}({executable})",+ "uvArchitecture": "uv 架构:{architecture}({path})",+ "uvMissing": "PATH 中找不到 uv 命令",+ "hostArchitecture": "主机架构:{architecture}",+ "explicitHome": "已显式设置 AVIBE_HOME:{path}",+ "homeReady": "默认运行时目录已准备初始化:{path}",+ "legacyHomeLinkHealthy": "旧目录兼容符号链接正常:{legacy_path} -> {active_path}",+ "legacyHomeLinkMissing": "缺少旧目录兼容路径:{path}",+ "legacyHomeLinkWrong": "旧目录符号链接未指向当前目录:{path}",+ "homeConflict": "{active_path} 与 {legacy_path} 都是实际目录",+ "legacyHomeWithoutCanonical": "旧目录符号链接存在,但规范目录 {active_path} 缺失",+ "legacyHomeUnmigrated": "运行时目录仍使用旧路径:{path}",+ "staleInstallProcess": "运行中的服务进程仍来自旧版 vibe-remote 安装:pids={pids}",+ "installMismatchNone": "运行中的服务未发现旧版安装不匹配:pid={pid}",+ "installMismatchSkipped": "当前 CLI 不是 uv tool 安装,已跳过安装不匹配检查:pid={pid}",+ "installMismatchAbsent": "未发现运行中服务的安装不匹配",+ "restartStateAbsent": "没有重启元数据",+ "restartFailed": "上次重启失败且当前没有服务运行:{summary}",+ "staleRestartState": "存在过期重启元数据:state={state}",+ "restartStateCurrent": "重启元数据仍然有效:state={state}",+ "serviceLockOwner": "服务锁持有者:pid={pid}",+ "serviceLockUnverified": "服务锁由 pid={pid} 持有,但无法验证持有者",+ "serviceLockFree": "服务锁空闲",+ "servicePidfileMismatch": "服务 pid 文件与锁持有者不一致:pidfile={pidfile} lock_owner={owner}",+ "servicePidfile": "服务 pid 文件指向 pid={pid}",+ "servicePidfileAbsent": "服务 pid 文件不存在",+ "statusPidMismatch": "运行时状态 service_pid 与锁持有者不一致:status={status} lock_owner={owner}",+ "statusPid": "运行时状态 service_pid:{pid}",+ "statusPidAbsent": "运行时状态中没有 service_pid",+ "extraServiceProcess": "服务锁外发现额外 Avibe 服务进程:pids={pids}",+ "unverifiedServiceProcess": "发现可能的额外 Avibe 服务进程,无法匹配 AVIBE_HOME:pids={pids}",+ "noExtraServiceProcess": "未发现额外 Avibe 服务进程",+ "deepScanSkipped": "快速诊断已跳过深度服务进程扫描",+ "showGitUnavailable": "Git 不可用,Show Page 检查点功能已降级",+ "dependencyHttp404": "{label} 发布资源不存在(HTTP 404):{url}",+ "dependencyHttpError": "{label} 请求返回 HTTP {status}:{url}",+ "dependencyHttpErrorRetried": "{label} 请求经过 {attempts} 次尝试后返回 HTTP {status}:{url}",+ "dependencyDnsFailed": "{label} 主机 DNS 查询失败:{host}",+ "dependencyDnsFailedRetried": "{label} 主机经过 {attempts} 次尝试后 DNS 查询失败:{host}",+ "dependencyTlsFailed": "{label} TLS 校验失败:{url}",+ "dependencyNetworkFailed": "{label} 网络请求失败:{url}",+ "dependencyNetworkFailedRetried": "{label} 网络请求经过 {attempts} 次尝试后失败:{url}",+ "dependencyStoreFailed": "无法保存 {label}:{reason}",+ "dependencyUnreachable": "无法访问 {label}:{reason}",+ "dependencyStatusFailed": "无法检查托管依赖状态:{reason}",+ "gitSystemReady": "Git 已通过系统运行时就绪",+ "dependencyReady": "{label} 已就绪",+ "dependencyReadyVersioned": "{label} {version} 已就绪",+ "nodeNotReady": "{label} 缺失或不受支持",+ "dependencyPlatformUnsupported": "该平台未发布 {label}",+ "dependencyArchiveUrlUnsupported": "{label} 归档 URL 使用不支持的协议:{url}",+ "dependencyNotReady": "{label} 尚未就绪",+ "dependencyReachable": "{label} 下载端点可访问:{url}",+ "dependencyProbeUnsupported": "{label} 服务不支持无请求体探测",+ "dependencyProbeUnavailable": "无法解析 {label} 归档",+ "showRuntimeStatusFailed": "无法检查 Show Runtime 状态:{reason}",+ "archiveCacheSkipped": "未检查 Show Runtime 归档缓存,其中可能仍有可回收归档。",+ "archiveCacheReclaimable": "Show Runtime 归档缓存有 {count} 个可回收归档({size}),当前与回滚归档会保留。",+ "archiveCacheClean": "Show Runtime 归档缓存没有可回收归档",+ "explicitCommandAvailable": "Show Runtime 显式命令可用:{command}",+ "explicitCommandMissing": "Show Runtime 显式命令缺失:{command}",+ "manifestMissing": "打包的 Show Runtime 清单缺失或无效",+ "manifestPlatformUnsupported": "Show Runtime 清单没有适用于 {platform} 的归档",+ "manifestReady": "Show Runtime 清单固定使用 {name}:{url}",+ "legacyArchiveProvider": "Show Runtime 选择了旧版未固定归档 URL:{url}",+ "unpinnedArchiveProvider": "Show Runtime 使用了显式的未固定归档提供方",+ "developmentProvider": "Show Runtime 使用 {provider} 开发提供方",+ "providerUnsupported": "不支持的 Show Runtime 提供方:{provider}",+ "showRuntimeInstalled": "Show Runtime 已为 {platform} 安装",+ "showRuntimeNotReady": "Show Runtime 尚未为 {platform} 准备好",+ "archiveProbeSkipped": "快速诊断未检查 Show Runtime 归档可达性",+ "archiveReachable": "Show Runtime 归档可访问:{target}",+ "archiveProbeUnsupported": "Show Runtime 归档服务器不支持无请求体可达性探测",+ "archiveUrlUnsupported": "Show Runtime 归档 URL 协议不受支持:{url}",+ "manifestUnavailable": "无法加载 Show Runtime 清单",+ "archiveCheckFailed": "Show Runtime 归档检查失败",+ "configFound": "找到配置文件:{path}",+ "configRecovery": "配置加载时出现恢复警告;请先修复备份的配置,再修改后端凭据",+ "configMissing": "找不到配置文件",+ "configLoaded": "配置加载成功",+ "configLoadFailed": "配置加载失败:{reason}",+ "remoteConfigMissing": "无法检查远程访问:配置尚未加载",+ "remoteDisabled": "远程访问已禁用",+ "remoteNotRunning": "远程访问连接器未运行",+ "remoteRunning": "远程访问连接器正在运行",+ "tunnelQualityUnavailable": "隧道质量暂不可用",+ "tunnelQualityStale": "隧道质量采样已过期",+ "tunnelQualityRequestsUnavailable": "隧道质量:{state}/{grade};远程请求不可用,{succeeded}/{samples} 成功;连接器 {protocol}",+ "tunnelQualityLatency": "隧道质量:{state}/{grade};远程请求 P95 {p95} ms、P99 {p99} ms,高于 1 秒的请求占 {slow_rate}%;连接器 {protocol}",+ "tunnelQualityRttUnavailable": "隧道质量:{state};{protocol} 传输没有边缘 RTT 数据",+ "tunnelQualityRtt": "隧道质量:{state}/{grade};边缘 RTT 中位数 {median} ms,最大 {maximum} ms",+ "slackTokenValid": "Slack token 格式有效",+ "slackBotConfigured": "Bot token 已配置",+ "slackBotMissing": "Bot token 未配置",+ "slackAppConfigured": "App token 已配置(Socket Mode)",+ "slackAppMissing": "App token 未配置",+ "slackValidationFailed": "Slack token 校验失败:{reason}",+ "slackConfigMissing": "无法检查 Slack:配置尚未加载",+ "agentCliFound": "找到 {agent} CLI:{path}",+ "agentCliMissing": "找不到 {agent} CLI:{path}",+ "agentDisabled": "{agent}:已禁用",+ "defaultAgent": "默认 Agent:{agent}",+ "agentConfigMissing": "无法检查 Agent:配置尚未加载",+ "workingDirectory": "工作目录:{path}",+ "workingDirectoryMissing": "工作目录不存在:{path}",+ "logLevel": "日志级别:{level}",+ "logFile": "日志文件:{path}",+ "logFilePending": "日志文件将在首次运行时创建",+ "cliMissing": "PATH 中找不到 vibe 可执行文件",+ "cliPathPrecedence": "PATH 先解析到 {active},而不是 {preferred}",+ "cliPath": "PATH 解析到 vibe:{path}",+ "cliNotUvTool": "当前 vibe 可执行文件不是 uv tool 安装",+ "cliEditable": "uv tool 安装是 editable:{path}",+ "cliNotEditable": "uv tool 安装不是 editable:{path}",+ "packageIntegrityOk": "Python 包文件完整(已检查 {count} 个)",+ "packageIntegrityFailed": "Python 包完整性检查失败:{detail}",+ "packageIntegrityFailedMore": "Python 包完整性检查失败:{detail},另有 {count} 项",+ "alembicMissing": "{path} 下缺少打包的 Alembic 脚本",+ "alembicFound": "找到打包的 Alembic 脚本:{path}",+ "alembicRevisionsMissing": "{path} 下没有 Alembic revision 文件",+ "sqliteRevisionAbsent": "SQLite schema revision 尚未初始化",+ "sqliteRevisionKnown": "此 CLI 已识别 SQLite schema revision:{revision}",+ "sqliteRevisionUnknown": "SQLite schema revision 比此 CLI 更新或未知:{revision}"+ },+ "action": {+ "nativeArmPython": "使用原生 arm64 uv/Python 重新安装 Avibe",+ "nativeArmUv": "安装原生 arm64 uv,然后重新安装 Avibe",+ "nativeUvWrapper": "检查此 uv wrapper 是否启动原生 arm64 uv",+ "uvMissing": "安装 uv,或将其 bin 目录加入 PATH",+ "homeMigrationCreateLink": "运行 `vibe doctor repair home-migration` 创建兼容符号链接。",+ "homeMigrationRecreateLink": "运行 `vibe doctor repair home-migration` 重新创建兼容符号链接。",+ "homeConflict": "在运行修复前手动备份并合并两个目录。",+ "legacyHomeWithoutCanonical": "修复前检查符号链接目标;Avibe 不会猜测应保留哪份状态。",+ "homeMigration": "运行 `vibe doctor repair home-migration` 将其迁移到 ~/.avibe 并保留反向符号链接。",+ "staleInstallRuntime": "运行 `vibe doctor repair stale-install-runtime` 停止过期服务并启动当前 Avibe 安装。",+ "restartFailed": "读取上面列出的重启日志了解原因,然后运行 `vibe start`。如果提示服务已运行,说明失败的 generation 仍占用此实例:运行 `vibe doctor repair duplicate-service-processes`(它会停止未持有锁的进程并启动服务);若失败进程持有锁,则运行 `vibe stop`,然后重试上述启动命令。",+ "staleRestartState": "运行 `vibe doctor repair stale-restart-state` 清除过期重启标记并刷新状态。",+ "serviceLockUnverified": "运行 `vibe status` 并检查服务日志,确认后再启动其他服务。",+ "servicePidfileMismatch": "等当前工作空闲后运行 `vibe restart`,让 Avibe 重写运行时所有权文件。",+ "statusPidMismatch": "刷新状态;如果仍然过期,请在安全时机重启 Avibe。",+ "duplicateServiceProcesses": "运行 `vibe doctor repair duplicate-service-processes` 停止额外服务进程。",+ "unverifiedServiceProcess": "启动其他服务前检查进程环境。",+ "deepScanSkipped": "运行深度诊断检查重复服务进程。",+ "dependencyHttp404": "从另一网络核对准确 URL。若发布资源确实不存在,请升级或重新安装 Avibe;若其他网络可用,请修复代理或安全网关。",+ "dependencyHttpError": "检查准确的发布资源和代理响应。{retry}",+ "dependencyDnsFailed": "修复依赖主机的 DNS 访问。{retry}",+ "dependencyTlsFailed": "修复 Avibe 服务的主机 CA 或 HTTPS 检查代理,然后重试修复。",+ "dependencyNetworkFailed": "允许访问依赖主机的 HTTPS。{retry}",+ "dependencyStoreFailed": "修复运行时缓存权限或可用磁盘空间,然后重试修复。",+ "dependencyUnreachable": "检查 Avibe 日志中的对应下载异常,然后重试修复。",+ "dependencyStatusFailed": "检查 Avibe 日志并重新运行 Doctor。",+ "nodeNotReady": "安装受支持的 Node.js 版本(^20.19.0 或 >=22.12.0)。",+ "dependencyPlatformUnsupported": "在支持的情况下使用系统依赖,或在发布该运行时的平台上运行 Avibe。",+ "dependencyArchiveUrlUnsupported": "将依赖清单配置为 HTTPS 或 file URL。",+ "dependencyNotReady": "{retry}",+ "dependencyProbeUnsupported": "{retry}",+ "dependencyProbeUnavailable": "重试前检查依赖清单和平台映射。",+ "repairCommand": "运行 `vibe doctor repair {target}`。",+ "askillManual": "从 https://askill.sh 手动安装 askill。",+ "showRuntimeStatusFailed": "检查 Avibe 日志;如果缺少包数据,请重新安装当前 Avibe 版本。",+ "archiveCacheSkipped": "等待正在进行的安装或清理结束后,重新运行 Doctor。",+ "archiveCacheSkippedInspection": "检查运行目录权限和 Avibe 日志;修复后重试 Doctor。",+ "archiveCacheReclaimable": "先运行 `vibe runtime clean --dry-run` 预览,再运行 `vibe runtime clean` 回收空间。",+ "explicitCommandMissing": "修复或移除 VIBE_SHOW_RUNTIME_BIN,然后重新运行 Doctor。",+ "manifestMissing": "从包含固定运行时清单的官方 wheel 升级或重新安装 Avibe。",+ "manifestPlatformUnsupported": "在受支持的平台安装 Avibe,或升级到发布该平台归档的版本。",+ "legacyArchiveProvider": "重新安装官方 Avibe 软件包,或移除 VIBE_SHOW_RUNTIME_SOURCE/ARCHIVE 覆盖。上游源代码仓库不发布 release 资源。",+ "unpinnedArchiveProvider": "官方安装优先使用 manifest-cache 提供方。",+ "developmentProvider": "官方安装使用 manifest-cache;仅在开发时保留此覆盖。",+ "providerUnsupported": "请移除 VIBE_SHOW_RUNTIME_SOURCE 以使用随 Avibe 发布的运行时,或将 VIBE_SHOW_RUNTIME_BIN 指向你自行构建的运行时。",+ "showRuntimeRepair": "运行 `vibe doctor repair show-runtime`;下载访问不确定时先使用 `vibe doctor --deep`。",+ "showRuntimeRetry": "先解决上面的提供方、平台、Node.js 或归档 URL 问题,然后重新运行 Doctor。",+ "archiveProbeSkipped": "运行 `vibe doctor --deep`,在不下载归档的情况下区分 HTTP、DNS、TLS 和超时失败。",+ "archiveProbeUnsupported": "{retry}",+ "archiveUrlUnsupported": "为归档使用 HTTPS 或 file URL,然后重新运行深度 Doctor。",+ "manifestUnavailable": "检查配置或打包的 Runtime 清单;必要时重新安装当前 Avibe 版本。",+ "showRuntimePlatformUnsupported": "安装发布该平台 Runtime 归档的 Avibe 版本。",+ "archiveCheckFailed": "检查所选归档路径或 URL。{retry}",+ "configMissing": "运行 'vibe' 创建初始配置",+ "configRecovery": "请检查保留的配置备份并修复后,再修改设置。",+ "configLoadFailed": "检查 config.json 语法,或删除后重新配置",+ "remoteNotRunning": "在设置中启动远程访问,或运行 `vibe remote start`。",+ "tunnelQualityUnavailable": "等待最多 45 秒获取首批指标采样。",+ "tunnelQualityStale": "等待最多 45 秒获取新指标,或检查远程访问日志。",+ "tunnelQualityWarn": "如果降级持续,Avibe 会自动评估第二个 Connector。",+ "slackBotMissing": "在设置向导中添加 Slack bot token",+ "slackAppMissing": "添加 Slack app token 以启用 Socket Mode",+ "slackValidationFailed": "在设置向导中检查 Slack token",+ "agentCliMissing": "安装 {agent} 或更新 CLI 路径",+ "workingDirectoryMissing": "在设置中更新 default_cwd",+ "cliMissing": "使用 uv tool 安装 Avibe,或将预期的 vibe 可执行文件加入 PATH。",+ "cliPathPrecedence": "使用 uv tool 安装时,将 ~/.local/bin 放在系统 Python bin 目录之前。",+ "cliNotUvTool": "此可执行文件将跳过 uv tool 包完整性检查。",+ "cliEditable": "从普通 wheel 重新安装 Avibe。运行中的本地 CLI 不要使用 'uv tool install --editable .'。",+ "packageIntegrityFailed": "重新运行 Avibe 安装器,以经过验证的 wheel 替换当前环境。",+ "alembicMissing": "从包含 storage/alembic 的 wheel 重新安装。editable uv tool 安装可能缺少此包数据。",+ "alembicRevisionsMissing": "从包含 storage/alembic/versions 的 wheel 重新安装。",+ "sqliteRevisionUnknown": "安装包含此 migration revision 代码的 Avibe wheel。"+ },+ "repair": {+ "homeExplicit": "AVIBE_HOME 已显式设置;不适用默认目录迁移。",+ "homeNoRuntime": "尚不存在运行时目录,无需迁移。",+ "homeConflict": "~/.avibe 与 ~/.vibe_remote 都是实际目录;需要手动合并。",+ "homeSymlinkMissingCanonical": "旧目录是符号链接但 ~/.avibe 缺失;请手动检查链接目标。",+ "homeHealthy": "运行时目录迁移状态正常。",+ "homeDryMove": "将把 ~/.vibe_remote 移到 ~/.avibe 并创建反向符号链接。",+ "homeDryLink": "将重新创建 ~/.vibe_remote 兼容符号链接。",+ "homeNoNeed": "无需迁移运行时目录。",+ "homeLinkFailed": "创建兼容符号链接失败:{reason}",+ "homeLinkCreated": "已创建 ~/.vibe_remote 兼容符号链接。",+ "homeMigrationIncomplete": "默认目录仍位于 {path};迁移未完成。",+ "homeMigrationLinkFailed": "已将 ~/.vibe_remote 迁移到 ~/.avibe,但创建兼容符号链接失败。",+ "homeMigrated": "已将 ~/.vibe_remote 迁移到 ~/.avibe。",+ "restartAbsent": "没有重启元数据。",+ "restartCurrent": "重启元数据仍然有效。",+ "restartDryRun": "将移除过期重启元数据并刷新运行时状态。",+ "restartRepaired": "已移除过期重启元数据并刷新运行时状态。",+ "cliOnly": "请从 CLI 执行此修复,不要在服务进程内部执行。",+ "noRuntimeProcessState": "尚不存在运行时目录,无需修复服务进程状态。",+ "noExtraProcess": "未发现额外 Avibe 服务进程。",+ "extraProcessDryRun": "将停止额外 Avibe 服务进程:{pids}。",+ "extraProcessPartial": "部分额外服务进程无法停止。",+ "extraProcessStopped": "已停止额外 Avibe 服务进程。",+ "noLegacyProcess": "未发现旧版 vibe-remote 服务进程。",+ "staleInstallDryRun": "将停止旧版服务进程并启动当前 Avibe:{pids}。",+ "staleInstallPartial": "部分旧版 vibe-remote 服务进程无法停止。",+ "staleInstallStopped": "已停止旧版 vibe-remote 服务进程。",+ "duplicateStoppedStarted": "已停止无锁服务进程并启动干净的服务。",+ "duplicateStoppedStartFailed": "已停止无锁服务进程,但启动干净服务失败:{reason}",+ "staleInstallStoppedStarted": "已停止旧版 vibe-remote 服务进程并启动当前 Avibe 服务。",+ "staleInstallStoppedStartFailed": "已停止旧版 vibe-remote 服务进程,但启动当前 Avibe 服务失败:{reason}",+ "dependencyFailed": "{target} 修复失败:{reason}",+ "dependencyReady": "{target} 修复完成:{detail}",+ "dependencyVersion": "已安装版本 {version}。",+ "dependencyReadyDefault": "依赖已就绪。",+ "dependencyResultFailed": "{target} 修复失败:{detail}",+ "dependencyException": "{target} 安装器失败:{error}",+ "dependencyDownloadHttp": "依赖下载经过 {attempts} 次尝试后返回 HTTP {status}。",+ "dependencyDownloadDns": "依赖主机经过 {attempts} 次尝试后 DNS 查询失败。",+ "dependencyDownloadTls": "依赖下载的 TLS 校验失败。",+ "dependencyDownloadTimeout": "依赖下载经过 {attempts} 次尝试后超时。",+ "dependencyDownloadNetwork": "依赖网络请求经过 {attempts} 次尝试后失败。",+ "dependencyDownloadPermission": "保存依赖时没有权限。",+ "dependencyDownloadDisk": "磁盘空间不足,无法保存依赖。",+ "dependencyDownloadIo": "访问依赖文件失败。",+ "dependencyDownloadUnknown": "依赖下载失败。",+ "askillAutoInstallUnsupported": "askill 自动安装需要 {tools},请手动安装。",+ "askillInstallPathMissing": "askill 安装器已完成,但在 PATH 中找不到 askill。",+ "installTimeout": "{target} 安装器在 {timeout_seconds} 秒后超时。",+ "installCommandFailed": "{target} 安装器以退出码 {exit_code} 结束。",+ "installError": "{target} 安装器失败:{error}。",+ "avaultPlatformUnsupported": "没有为 {platform} 发布 avault 构建版本。",+ "avaultChecksumMismatch": "avault 归档校验和验证失败(期望 {expected_sha256},实际 {actual_sha256})。",+ "avaultInstallPathMissing": "avault 安装器已完成,但在 PATH 中找不到 avault。",+ "avaultInstallFailed": "avault 安装失败:{error}。",+ "avaultReleaseUnavailable": "所需的 avault 发布版本不可用。",+ "dependencyAlreadyRunning": "另一个 {target} 安装任务正在运行,请稍后重试。",+ "dependencyPlatformUnsupported": "没有为当前平台发布 {target} 构建版本。",+ "dependencyManifestMissing": "缺少 {target} 清单。",+ "dependencyManifestInvalid": "{target} 清单无效。",+ "dependencyManifestUnavailable": "{target} 清单不可用。",+ "dependencyManifestDownloadFailed": "无法下载 {target} 清单。",+ "dependencyArchiveUnavailable": "{target} 归档不可用。",+ "dependencyArchiveDownloadFailed": "无法下载 {target} 归档。",+ "dependencyArchiveVerificationFailed": "{target} 归档验证失败。",+ "dependencyBinaryVerificationFailed": "{target} 二进制校验和验证失败。",+ "dependencyBinaryNotRunnable": "{target} 二进制无法运行。",+ "dependencyBinaryPrepareFailed": "无法准备 {target} 二进制。",+ "dependencyInstallMissingBinary": "{target} 归档不包含其二进制文件。",+ "dependencyInstallLockFailed": "无法获取 {target} 安装锁:{error}。",+ "dependencyInstallClaimFailed": "无法记录 {target} 安装声明:{error}。",+ "dependencyInstallTargetChanged": "修复期间 {target} 安装目标发生变化。",+ "dependencyPointerWriteFailed": "无法更新 {target} 安装指针。",+ "dependencyCodeSignMissing": "无法为 {target} 二进制签名,因为 codesign 不可用。",+ "dependencyCodeSignFailed": "无法为 {target} 二进制签名。",+ "dependencyMetadataFailed": "无法更新 {target} 二进制元数据。",+ "dependencyFailedDefault": "修复失败。",+ "showRuntimeVerificationFailed": "无法验证 Show Runtime 是否可启动,因此未尝试重新安装:{detail}",+ "showRuntimeHealthy": "Show Runtime 可以正常启动,无需修复。",+ "showRuntimeExplicitFailed": "VIBE_SHOW_RUNTIME_BIN 指定的 Show Runtime 命令无法启动:{reason}。请修复或移除该覆盖后重新运行 Doctor。",+ "showRuntimeLegacyUnavailable": "打包的 Show Runtime 清单不可用,旧版上游归档 URL 也没有发布资源。请升级或重新安装官方 Avibe 软件包,或移除过期的 runtime 来源覆盖。",+ "showRuntimeInstalled": "已安装并启动 Show Runtime。",+ "showRuntimeReinstalled": "已重新安装并启动 Show Runtime。",+ "showRuntimeInstallStartFailed": "Show Runtime 已安装,但无法启动:{reason}",+ "showRuntimeReinstallStartFailed": "Show Runtime 已重新安装,但仍无法启动:{reason}",+ "showRuntimePostVerificationFailed": "Show Runtime 准备完成,但无法验证是否可启动:{detail}",+ "showRuntimePrepareFailed": "Show Runtime 准备失败:{detail}",+ "unknownTarget": "未知修复目标 {target}。已知目标:{known_targets}。",+ "dryHomeMigration": "将在安全时把 ~/.vibe_remote 迁移到 ~/.avibe,或重新创建旧版兼容符号链接。",+ "dryStaleInstall": "将停止运行中的旧版 vibe-remote 服务并启动当前 Avibe 服务。",+ "dryDuplicateProcesses": "将停止服务锁外的额外 Avibe 服务进程。",+ "dryStaleRestart": "将移除过期重启元数据并刷新运行时状态。",+ "dryAskill": "将使用官方安装器安装或刷新 askill。",+ "dryAvault": "将安装或刷新清单固定的 avault 版本。",+ "dryGitRuntime": "将安装或刷新清单固定的 Git Runtime。",+ "dryShowRuntime": "当清单固定的 Show Runtime 归档缺失或无效时准备它。",+ "dryTmux": "将安装或刷新清单固定的 tmux runtime。"+ }+ },"data": {"helpCommand": "\u67e5\u770b Avibe \u6570\u636e,\u6216\u6267\u884c\u663e\u5f0f\u7684 trace \u4fdd\u7559\u7ef4\u62a4","helpDescription": "\u901a\u8fc7\u53d7\u4fdd\u62a4\u7684\u53ea\u8bfb SQL \u67e5\u770b\u672c\u5730 Avibe SQLite \u72b6\u6001,\u6216\u6267\u884c\u663e\u5f0f\u7ef4\u62a4:`query` \u4e3a\u53ea\u8bfb;`retention --run` \u4f1a\u5220\u9664\u65e7\u7684\u5185\u90e8 trace \u4e8b\u4ef6\u5e76\u53ef\u80fd\u538b\u5b9e\u6570\u636e\u5e93\u3002",diff --git a/vibe/restart_supervisor.py b/vibe/restart_supervisor.pyindex 20ddce234..3e14499e6 100644--- a/vibe/restart_supervisor.py+++ b/vibe/restart_supervisor.py@@ -29,6 +29,7 @@ from vibe.build_identity import get_build_identityfrom vibe.upgrade import (LEGACY_PACKAGE_NAME,PACKAGE_NAME,+ RestartState,RollbackTarget,activate_launcher_target,atomic_uv_install_root,@@ -412,7 +413,7 @@ def _fail(payload: dict, error: str, log, return_code: int, *, started_at: floatdurations = dict(payload.get("stage_durations") or {})durations["restart_total_seconds"] = _rounded_seconds(time.monotonic() - started_at)payload["stage_durations"] = durations- payload.update(ok=False, state="failed", error=error)+ payload.update(ok=False, state=RestartState.FAILED.value, error=error)_write_status(payload)log.write(f"{_now_iso()} {error}\n")log.flush()@@ -635,7 +636,11 @@ def _roll_back_failed_upgrade(restore_stable_launcher = bool(vibe_path and _launcher_generation(Path(vibe_path).expanduser(), atomic_uv_install_root()) is not None)- rollback: dict = {"target_version": version, "state": "running", "started_at": _now_iso()}+ rollback: dict = {+ "target_version": version,+ "state": RestartState.RUNNING.value,+ "started_at": _now_iso(),+ }record(rollback)write(f"rolling back to {version}: no service is running after the failed restart")@@ -656,7 +661,7 @@ def _roll_back_failed_upgrade(# launching what was reinstalled -- so a rollback that continued here# would report success for the version it was rolling back from.rollback.update(- state="failed",+ state=RestartState.FAILED.value,error=f"the failed generation is still running; not rolling back to {version}",)record(rollback)@@ -675,7 +680,10 @@ def _roll_back_failed_upgrade(try:plan = build_upgrade_plan(vibe_path=vibe_path, version=version, package_name=rollback_to.package)except Exception as exc:- rollback.update(state="failed", error=f"cannot build a pinned install for {version}: {exc}")+ rollback.update(+ state=RestartState.FAILED.value,+ error=f"cannot build a pinned install for {version}: {exc}",+ )record(rollback)return rollback@@ -692,7 +700,10 @@ def _roll_back_failed_upgrade()except Exception as exc:rollback["install"] = {"method": plan.method, "ok": False, "error": str(exc)}- rollback.update(state="failed", error=f"installing {version} failed: {exc}")+ rollback.update(+ state=RestartState.FAILED.value,+ error=f"installing {version} failed: {exc}",+ )record(rollback)return rollbackif result.returncode != 0:@@ -701,7 +712,10 @@ def _roll_back_failed_upgrade(# resolver output.detail = (result.stderr or result.stdout or "").strip()[-2000:]rollback["install"] = {"method": plan.method, "ok": False, "error": detail or f"exit code {result.returncode}"}- rollback.update(state="failed", error=f"installing {version} failed with exit code {result.returncode}")+ rollback.update(+ state=RestartState.FAILED.value,+ error=f"installing {version} failed with exit code {result.returncode}",+ )record(rollback)write(f"pinned install of {version} failed: {detail}")return rollback@@ -714,7 +728,10 @@ def _roll_back_failed_upgrade(with atomic_upgrade_lock():activate_launcher_target(vibe_path, rollback_cli_launcher)except Exception as exc: # noqa: BLE001- rollback.update(state="failed", error=f"restoring the active launcher failed: {exc}")+ rollback.update(+ state=RestartState.FAILED.value,+ error=f"restoring the active launcher failed: {exc}",+ )record(rollback)return rollbackrollback["launcher"] = {"restored": True, "path": str(rollback_cli_launcher)}@@ -724,7 +741,10 @@ def _roll_back_failed_upgrade(rollback["database"] = _restore_database_for_rollback(backup_watermark, write)except Exception as exc:rollback["database"] = {"restored": False, "error": str(exc)}- rollback.update(state="failed", error=f"restoring the database failed: {exc}")+ rollback.update(+ state=RestartState.FAILED.value,+ error=f"restoring the database failed: {exc}",+ )record(rollback)return rollbackrecord(rollback)@@ -732,13 +752,16 @@ def _roll_back_failed_upgrade(try:started = _start_runtime_processes(start_ui=start_ui, launcher=rollback_to.launcher)except Exception as exc:- rollback.update(state="failed", error=f"starting {version} failed: {exc}")+ rollback.update(+ state=RestartState.FAILED.value,+ error=f"starting {version} failed: {exc}",+ )record(rollback)return rollbackready_pid = runtime.wait_for_service_ready(started.service_pid, timeout=runtime.SERVICE_SLOW_START_TIMEOUT_SECONDS)if ready_pid is None:rollback.update(- state="failed",+ state=RestartState.FAILED.value,service_pid=started.service_pid,error=f"{version} started but service pid {started.service_pid} did not finish starting",)@@ -760,7 +783,7 @@ def _roll_back_failed_upgrade(runtime.write_status("running", f"pid={ready_pid}", ready_pid, _live_ui_pid(started.ui_pid))if ui_serving is False:rollback.update(- state="failed",+ state=RestartState.FAILED.value,service_pid=ready_pid,error=(f"rolled back to {version} and the service is running as pid {ready_pid}, "@@ -770,7 +793,7 @@ def _roll_back_failed_upgrade(record(rollback)write(f"rolled back to {version} but the Web UI did not come back; service pid={ready_pid}")return rollback- rollback.update(state="succeeded", service_pid=ready_pid, error=None)+ rollback.update(state=RestartState.SUCCEEDED.value, service_pid=ready_pid, error=None)record(rollback)write(f"rolled back to {version}; service pid={ready_pid}")return rollback@@ -873,11 +896,21 @@ def _run_restart_job(# A rollback that raises must not swallow the failure that# caused it: the original error is what the operator needs,# and the rollback's own is recorded beside it.- record_rollback({"target_version": rollback_to.version, "state": "failed", "error": str(exc)})+ record_rollback(+ {+ "target_version": rollback_to.version,+ "state": RestartState.FAILED.value,+ "error": str(exc),+ }+ )write(f"rollback to {rollback_to.version} raised: {exc}")elif rollback_to:record_rollback(- {"target_version": rollback_to.version, "state": "skipped", "reason": "service_running"}+ {+ "target_version": rollback_to.version,+ "state": RestartState.SKIPPED.value,+ "reason": "service_running",+ })return _fail(payload, error, log, return_code, started_at=started_at)@@ -892,7 +925,11 @@ def _run_restart_job(# seeds with the spawned subprocess pid (this process is that pid)."supervisor_pid": os.getpid(),"supervisor_started_at": runtime.process_create_time(os.getpid()),- "state": "scheduled" if delay_seconds > 0 else "running",+ "state": (+ RestartState.SCHEDULED.value+ if delay_seconds > 0+ else RestartState.RUNNING.value+ ),"trigger": trigger,"delay_seconds": delay_seconds,"scope": scope,@@ -922,7 +959,7 @@ def _run_restart_job(delay_started_at = time.monotonic()time.sleep(delay_seconds)mark_duration("delay_seconds_actual", delay_started_at)- payload["state"] = "running"+ payload["state"] = RestartState.RUNNING.value_write_status(payload)write("restart job started after delay")restart_started_at = time.monotonic()@@ -1013,7 +1050,7 @@ def _run_restart_job(runtime.write_status("running", f"pid={new_pid}", new_pid, _live_ui_pid(recorded_ui_pid))mark_duration("restart_total_seconds", restart_started_at)- payload.update(ok=True, state="succeeded", new_pid=new_pid, error=None)+ payload.update(ok=True, state=RestartState.SUCCEEDED.value, new_pid=new_pid, error=None)_write_status(payload)write(f"restart job succeeded new_pid={new_pid}")@@ -1185,7 +1222,7 @@ def _schedule_restart_locked(payload = {"ok": None,"job_id": job_id,- "state": "scheduled",+ "state": RestartState.SCHEDULED.value,"trigger": trigger,"scope": scope,"delay_seconds": delay_seconds,@@ -1220,7 +1257,11 @@ def _schedule_restart_locked(# (bad cached vibe path, missing executable, permission/log-open error) no# child will ever overwrite it, leaving a permanently pending restart in# `vibe status`. Mark it failed before propagating.- payload.update(ok=False, state="failed", error=f"failed to spawn restart supervisor: {exc}")+ payload.update(+ ok=False,+ state=RestartState.FAILED.value,+ error=f"failed to spawn restart supervisor: {exc}",+ )_write_status(payload)_prune_restart_logs()raisediff --git a/vibe/upgrade.py b/vibe/upgrade.pyindex f3e96c971..20c42a634 100644--- a/vibe/upgrade.py+++ b/vibe/upgrade.py@@ -15,6 +15,7 @@ import timeimport urllib.requestfrom collections.abc import Mappingfrom dataclasses import dataclass+from enum import Enumfrom pathlib import Pathfrom typing import NamedTuple, castfrom uuid import uuid4@@ -76,6 +77,25 @@ _PRE_ORDER = {}+class RestartState(str, Enum):+ """Closed restart-state vocabulary and its retention policy."""++ def __new__(cls, value: str, retention: str | None):+ member = str.__new__(cls, value)+ member._value_ = value+ member.retention = retention+ return member++ SCHEDULED = ("scheduled", "seed")+ RUNNING = ("running", "seed")+ SUCCEEDED = ("succeeded", "result")+ FAILED = ("failed", "result")+ ERROR = ("error", "result")+ CANCELLED = ("cancelled", "result")+ SKIPPED = ("skipped", "result")+ UNKNOWN = ("unknown", None)++@dataclass(frozen=True)class UpgradePlan:"""A command that installs a version of avibe, and what it will replace.@@ -146,7 +166,11 @@ def restart_record_is_pending() -> bool:"""Apply the restart ownership policy to one persisted status record."""- if payload.get("state") not in {"scheduled", "running"}:+ try:+ state = RestartState(payload.get("state"))+ except (TypeError, ValueError):+ return False+ if state.retention != "seed":return Falsesupervisor_pid = payload.get("supervisor_pid")if isinstance(supervisor_pid, int) and supervisor_pid > 0 and runtime_mod.pid_alive(supervisor_pid):