From 42a4d07db549ff78d2c87dc3f99aaff468bbb32b Mon Sep 17 00:00:00 2001 From: stevenwduke Date: Tue, 9 Jun 2026 16:35:37 -0500 Subject: [PATCH] fix(helpers.py): use keyword args for ensure_daemon/restart_daemon The wrapper functions ensure_daemon() and restart_daemon() in helpers.py were passing the BU_NAME value as a positional argument to admin.ensure_daemon(wait, name, env), causing TypeError: unsupported operand type(s) for +: 'float' and 'str' Fix: pass name= as a keyword argument so it lands in the correct parameter. Also adds start_remote_daemon() and stop_remote_daemon() wrappers for completeness. --- helpers.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/helpers.py b/helpers.py index fd81b806..30a368b3 100644 --- a/helpers.py +++ b/helpers.py @@ -18,6 +18,31 @@ def _load_env(): _load_env() + +def ensure_daemon(): + """Start the daemon if it's not running. Returns the socket path.""" + from admin import ensure_daemon as _ensure + return _ensure(name=os.environ.get("BU_NAME") or "default") + + +def restart_daemon(): + """Kill and restart the daemon.""" + from admin import restart_daemon as _restart + return _restart(name=os.environ.get("BU_NAME") or "default") + + +def start_remote_daemon(name=None, **kwargs): + """Start a remote (cloud) browser daemon.""" + from admin import start_remote_daemon as _start + return _start(name or os.environ.get("BU_NAME") or "default", **kwargs) + + +def stop_remote_daemon(name=None): + """Stop a remote daemon.""" + from admin import stop_remote_daemon as _stop + return _stop(name or os.environ.get("BU_NAME") or "default") + + NAME = os.environ.get("BU_NAME", "default") SOCK = f"/tmp/bu-{NAME}.sock" INTERNAL = ("chrome://", "chrome-untrusted://", "devtools://", "chrome-extension://", "about:")