The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(bot-screen): CLI `screen install` runs through the shared installer
teknium16efd5b4749af
diff --git a/hermes_cli/subcommands/computer_use_screen.py b/hermes_cli/subcommands/computer_use_screen.pyindex 236c6c3f5a0..5e76b521f99 100644--- a/hermes_cli/subcommands/computer_use_screen.py+++ b/hermes_cli/subcommands/computer_use_screen.py@@ -4,8 +4,8 @@ headless Linux gateway host, viewable from Hermes Desktop. ``status`` / ``start`from __future__ import annotations+import getpassimport json-import subprocessimport sys@@ -54,7 +54,7 @@ def _screen_stop(args) -> int:def _screen_install(args) -> int:- from tools.bot_desktop import runtime+ from tools.bot_desktop import install, runtimeif not runtime.is_supported_host():print("Bot Desktop screens run on Linux gateway hosts only.")return 1@@ -71,10 +71,16 @@ def _screen_install(args) -> int:answer = input("Proceed? [Y/n] ").strip().lower()if answer not in ("", "y", "yes"):return 1- rc = subprocess.run(cmd, shell=True, stdin=None).returncode # windows-footgun: ok — Linux-only, apt/dnf/pacman+ # Same runner as the Desktop pane's Install button: one per-profile slot, list-form spawn, sudo password+ # via stdin (-S) and never on the command line.+ try:+ rc = install.install_packages(ask_password=lambda: getpass.getpass("[sudo] password: "), on_line=print)+ except install.InstallBusy as exc:+ print(f"Bot Desktop: {exc}")+ return 1if rc != 0:print(f"Bot Desktop: installer exited {rc}")- return rc+ return rc or 1missing = runtime.missing_binaries()if missing:print("Bot Desktop: still missing " + ", ".join(missing))diff --git a/tests/hermes_cli/test_computer_use_screen_install.py b/tests/hermes_cli/test_computer_use_screen_install.pynew file mode 100644index 00000000000..a0199600801--- /dev/null+++ b/tests/hermes_cli/test_computer_use_screen_install.py@@ -0,0 +1,29 @@+"""`hermes computer-use screen install` shares the Desktop pane's installer (one lock, list-form spawn)."""++from __future__ import annotations++import argparse+import subprocess++from hermes_cli.subcommands.computer_use_screen import build_screen_parser+from tools.bot_desktop import install, runtime+++def test_cli_install_goes_through_the_shared_installer(monkeypatch):+ monkeypatch.setattr(runtime, "is_supported_host", lambda: True)+ monkeypatch.setattr(runtime, "missing_binaries", lambda: ["Xvnc"])+ monkeypatch.setattr(runtime, "install_command", lambda: "sudo apt-get install -y tigervnc-standalone-server")+ monkeypatch.setattr(subprocess, "run", lambda *a, **k: (_ for _ in ()).throw(AssertionError("shell install spawned")))+ calls = []++ def fake_install(*, ask_password, on_line, **kw):+ calls.append((callable(ask_password), callable(on_line)))+ return 0++ monkeypatch.setattr(install, "install_packages", fake_install)+ monkeypatch.setattr(runtime, "missing_binaries", lambda: ["Xvnc"] if not calls else [])+ parser = argparse.ArgumentParser()+ build_screen_parser(parser.add_subparsers(), lambda sub, help_text: sub.add_argument("--json", action="store_true"))+ args = parser.parse_args(["screen", "install", "-y"])+ assert args.screen_func(args) == 0+ assert calls == [(True, True)]