Skip to content

The agent that grows with you

refactor(plugins/google_meet): collapse duplicate prints/guards, merge cli imports, join string literals

Tekniumc0dcee19e955
diff --git a/plugins/cron_providers/chronos/__init__.py b/plugins/cron_providers/chronos/__init__.py
index 764540ac285..ea8c291c9cd 100644
--- a/plugins/cron_providers/chronos/__init__.py
+++ b/plugins/cron_providers/chronos/__init__.py
@@ -68,7 +68,7 @@ class ChronosCronScheduler(CronScheduler):
logger.warning("Chronos start() reconcile failed: %s", e)
def stop(self) -> None:
- return None
+ pass
def on_jobs_changed(self) -> None:
try:
diff --git a/plugins/disk-cleanup/disk_cleanup.py b/plugins/disk-cleanup/disk_cleanup.py
index 0ec670fe359..60b48f4e7a4 100755
--- a/plugins/disk-cleanup/disk_cleanup.py
+++ b/plugins/disk-cleanup/disk_cleanup.py
@@ -285,8 +285,7 @@ def _sweep_empty_dirs(hermes_home: Path) -> int:
Iterative post-order so parents emptied by child removal are caught."""
removed = 0
stack: List[Tuple[Path, bool]] = [
- (top, False) for top in _subdirs(hermes_home, _EMPTY_DIR_PROTECTED_TOP_LEVEL | _EMPTY_DIR_SWEEP_PRUNE_DIRS)
- ]
+ (top, False) for top in _subdirs(hermes_home, _EMPTY_DIR_PROTECTED_TOP_LEVEL | _EMPTY_DIR_SWEEP_PRUNE_DIRS)]
while stack:
dirpath, visited = stack.pop()
if visited:
diff --git a/plugins/google_meet/__init__.py b/plugins/google_meet/__init__.py
index 19e12cd55bc..4489702594a 100644
--- a/plugins/google_meet/__init__.py
+++ b/plugins/google_meet/__init__.py
@@ -12,8 +12,7 @@ import logging
import platform
from plugins.google_meet import process_manager as pm
-from plugins.google_meet.cli import register_cli as _register_meet_cli
-from plugins.google_meet.cli import meet_command as _meet_command
+from plugins.google_meet.cli import meet_command as _meet_command, register_cli as _register_meet_cli
from plugins.google_meet.tools import (
MEET_JOIN_SCHEMA, MEET_LEAVE_SCHEMA, MEET_SAY_SCHEMA, MEET_STATUS_SCHEMA, MEET_TRANSCRIPT_SCHEMA,
check_meet_requirements, handle_meet_join, handle_meet_leave, handle_meet_say, handle_meet_status,
diff --git a/plugins/google_meet/cli.py b/plugins/google_meet/cli.py
index f10ee898dec..c4740bfedc5 100644
--- a/plugins/google_meet/cli.py
+++ b/plugins/google_meet/cli.py
@@ -106,8 +106,7 @@ def meet_command(args: argparse.Namespace) -> int:
def _cmd_setup() -> int:
- print("google_meet preflight")
- print("---------------------")
+ print("google_meet preflight\n---------------------")
system = platform.system()
system_ok = system in {"Linux", "Darwin"}
@@ -170,8 +169,7 @@ def _cmd_install(*, realtime: bool, assume_yes: bool) -> int:
if subprocess.run(cmd, check=False).returncode != 0:
print(fail_msg)
- print("google_meet install")
- print("-------------------")
+ print("google_meet install\n-------------------")
pip_pkgs = ["playwright", "websockets"]
print(f"\n[1/3] pip install: {' '.join(pip_pkgs)}")
@@ -187,9 +185,8 @@ def _cmd_install(*, realtime: bool, assume_yes: bool) -> int:
print("\n[2/3] python -m playwright install chromium")
try:
- res = subprocess.run(
- [sys.executable, "-m", "playwright", "install", "chromium"], check=False, stdin=subprocess.DEVNULL
- )
+ res = subprocess.run([sys.executable, "-m", "playwright", "install", "chromium"], check=False,
+ stdin=subprocess.DEVNULL)
if res.returncode != 0:
print(" playwright install failed (may already be installed)")
except Exception as e:
@@ -208,14 +205,12 @@ def _cmd_install(*, realtime: bool, assume_yes: bool) -> int:
["sudo", "apt-get", "install", "-y", "pulseaudio-utils"],
" apt install failed — install pulseaudio-utils manually")
elif system == "Darwin":
- have_bh = False
try:
- out = subprocess.check_output(
+ have_bh = "BlackHole" in subprocess.check_output(
["system_profiler", "SPAudioDataType"], text=True, encoding='utf-8', errors='replace',
stdin=subprocess.DEVNULL)
- have_bh = "BlackHole" in out
except Exception:
- pass
+ have_bh = False
needs = ([] if have_bh else ["blackhole-2ch"]) + ([] if shutil.which("ffmpeg") else ["ffmpeg"])
if not needs:
print(" BlackHole and ffmpeg already installed.")
@@ -245,9 +240,7 @@ def _cmd_auth() -> int:
path = _auth_state_path()
path.parent.mkdir(parents=True, exist_ok=True)
-
- print("opening Chromium — sign in to Google, then return here and press Enter.")
- print(f"saving storage state to: {path}")
+ print(f"opening Chromium — sign in to Google, then return here and press Enter.\nsaving storage state to: {path}")
try:
with sync_playwright() as pw:
browser = pw.chromium.launch(headless=False)
diff --git a/plugins/google_meet/node/cli.py b/plugins/google_meet/node/cli.py
index 56e1d222e58..950f7f65056 100644
--- a/plugins/google_meet/node/cli.py
+++ b/plugins/google_meet/node/cli.py
@@ -84,8 +84,6 @@ def _cmd_ping(args: argparse.Namespace, reg: NodeRegistry) -> int:
except Exception as exc: # noqa: BLE001 — surface any connection error
print(json.dumps({"ok": False, "error": str(exc)}))
return 1
- if not isinstance(result, dict):
- result = {"result": result}
print(json.dumps({"ok": True, "node": args.name, **result}))
return 0
diff --git a/plugins/google_meet/node/server.py b/plugins/google_meet/node/server.py
index b38fda7b4ae..7211bc39384 100644
--- a/plugins/google_meet/node/server.py
+++ b/plugins/google_meet/node/server.py
@@ -40,8 +40,8 @@ def _rpc_say(payload: Dict[str, Any], pm) -> Dict[str, Any]:
active = pm._read_active()
enqueued = False
if active and active.get("out_dir"):
- queue = Path(active["out_dir"]) / "say_queue.jsonl"
try:
+ queue = Path(active["out_dir"]) / "say_queue.jsonl"
queue.parent.mkdir(parents=True, exist_ok=True)
with queue.open("a", encoding="utf-8") as fh:
fh.write(json.dumps({"text": text, "ts": time.time()}) + "\n")
diff --git a/plugins/google_meet/process_manager.py b/plugins/google_meet/process_manager.py
index a2634839260..5a3d880aa52 100644
--- a/plugins/google_meet/process_manager.py
+++ b/plugins/google_meet/process_manager.py
@@ -123,15 +123,9 @@ def status() -> Dict[str, Any]:
if not active:
return dict(_NO_ACTIVE)
pid = int(active.get("pid", 0))
- return {
- "ok": True,
- "alive": _pid_alive(pid),
- "pid": pid,
- "meetingId": active.get("meeting_id"),
- "url": active.get("url"),
- "startedAt": active.get("started_at"),
- "outDir": active.get("out_dir"),
- **(read_json(Path(active.get("out_dir", "")) / "status.json") or {})}
+ return {"ok": True, "alive": _pid_alive(pid), "pid": pid, "meetingId": active.get("meeting_id"),
+ "url": active.get("url"), "startedAt": active.get("started_at"), "outDir": active.get("out_dir"),
+ **(read_json(Path(active.get("out_dir", "")) / "status.json") or {})}
def transcript(last: Optional[int] = None) -> Dict[str, Any]:
@@ -160,8 +154,8 @@ def enqueue_say(text: str) -> Dict[str, Any]:
if not active:
return dict(_NO_ACTIVE)
if active.get("mode") != "realtime":
- return {"ok": False, "reason": "active meeting is in transcribe mode — pass mode='realtime' "
- "to meet_join to enable agent speech"}
+ return {"ok": False, "reason": ("active meeting is in transcribe mode — pass mode='realtime' "
+ "to meet_join to enable agent speech")}
out_dir = Path(active.get("out_dir", ""))
if not out_dir.is_dir():
@@ -171,8 +165,7 @@ def enqueue_say(text: str) -> Dict[str, Any]:
entry = {"id": uuid.uuid4().hex[:12], "text": text}
with queue_path.open("a", encoding="utf-8") as f:
f.write(json.dumps(entry) + "\n")
- return {"ok": True, "meetingId": active.get("meeting_id"), "enqueued_id": entry["id"],
- "queue_path": str(queue_path)}
+ return {"ok": True, "meetingId": active.get("meeting_id"), "enqueued_id": entry["id"], "queue_path": str(queue_path)}
def stop(*, reason: str = "requested") -> Dict[str, Any]:
@@ -183,7 +176,6 @@ def stop(*, reason: str = "requested") -> Dict[str, Any]:
pid = int(active.get("pid", 0))
out_dir = active.get("out_dir")
-
if _pid_alive(pid):
_kill(pid, signal.SIGTERM)
for _ in range(20):
diff --git a/plugins/google_meet/tools.py b/plugins/google_meet/tools.py
index a2d97467fc0..cf42207e240 100644
--- a/plugins/google_meet/tools.py
+++ b/plugins/google_meet/tools.py
@@ -107,8 +107,7 @@ MEET_TRANSCRIPT_SCHEMA: Dict[str, Any] = {
"name": "meet_transcript",
"description": (
"Read the scraped transcript for the active Meet session. Returns "
- "full transcript unless 'last' is set, in which case returns the last "
- "N lines only."
+ "full transcript unless 'last' is set, in which case returns the last N lines only."
),
"parameters": {
"type": "object",
@@ -117,8 +116,7 @@ MEET_TRANSCRIPT_SCHEMA: Dict[str, Any] = {
"type": "integer",
"description": (
"Optional: return only the last N caption lines. Useful "
- "for polling during a meeting without re-reading the "
- "whole transcript."
+ "for polling during a meeting without re-reading the whole transcript."
),
"minimum": 1,
},