Skip to content

The agent that grows with you

refactor(plugins/google_meet): find_spec probes, simpler join/speaker control flow, compact spawn record

Teknium85c62d7e2e0c
diff --git a/plugins/disk-cleanup/disk_cleanup.py b/plugins/disk-cleanup/disk_cleanup.py
index 60b48f4e7a4..05e95f6db11 100755
--- a/plugins/disk-cleanup/disk_cleanup.py
+++ b/plugins/disk-cleanup/disk_cleanup.py
@@ -157,7 +157,6 @@ def track(path_str: str, category: str, silent: bool = False) -> bool:
tracked = load_tracked()
if any(item["path"] == str(path) for item in tracked):
return False
-
tracked.append({"path": str(path), "timestamp": datetime.now(timezone.utc).isoformat(),
"category": category, "size": size})
save_tracked(tracked)
@@ -310,7 +309,6 @@ def status() -> Dict[str, Any]:
c = cats.setdefault(item["category"], {"count": 0, "size": 0})
c["count"] += 1
c["size"] += item["size"]
-
existing = sorted(((i["path"], i["size"], i["category"]) for i in tracked
if Path(i["path"]).exists()), key=lambda x: x[1], reverse=True)
return {"categories": cats, "top10": existing[:10], "total_tracked": len(tracked)}
diff --git a/plugins/google_meet/cli.py b/plugins/google_meet/cli.py
index 3c317fdaf1d..dcf511dc0ca 100644
--- a/plugins/google_meet/cli.py
+++ b/plugins/google_meet/cli.py
@@ -10,6 +10,7 @@
from __future__ import annotations
import argparse
+import importlib.util
import json
import platform
import shutil
@@ -104,13 +105,9 @@ def _cmd_setup() -> int:
system_ok = system in {"Linux", "Darwin"}
print(f" platform : {system} [{'ok' if system_ok else 'unsupported'}]")
- try:
- import playwright # noqa: F401
- pw_ok = True
- print(" playwright : installed")
- except ImportError:
- pw_ok = False
- print(" playwright : NOT installed — run: pip install playwright")
+ pw_ok = importlib.util.find_spec("playwright") is not None
+ print(" playwright : installed" if pw_ok
+ else " playwright : NOT installed — run: pip install playwright")
chromium_ok = False
chromium_msg = "unknown"
diff --git a/plugins/google_meet/meet_bot.py b/plugins/google_meet/meet_bot.py
index c84ef0e8df3..d763e7e9da8 100644
--- a/plugins/google_meet/meet_bot.py
+++ b/plugins/google_meet/meet_bot.py
@@ -103,8 +103,7 @@ class _BotState:
write_json_atomic(self.status_path, data)
def set(self, **kwargs) -> None:
- for k, v in kwargs.items():
- setattr(self, k, v)
+ self.__dict__.update(kwargs)
self._flush()
@@ -377,11 +376,11 @@ def _join(page, cfg: _BotConfig, state: _BotState) -> None:
continue
try:
btn.click(timeout=3_000)
- if label == "Ask to join":
- state.set(lobby_waiting=True)
- break
except Exception:
continue
+ if label == "Ask to join":
+ state.set(lobby_waiting=True)
+ break
def _drain_loop(page, cfg: _BotConfig, state: _BotState, rt: dict, stop_flag: dict) -> None:
diff --git a/plugins/google_meet/process_manager.py b/plugins/google_meet/process_manager.py
index 5a3d880aa52..977b6cce788 100644
--- a/plugins/google_meet/process_manager.py
+++ b/plugins/google_meet/process_manager.py
@@ -104,15 +104,11 @@ def start(url: str, *, out_dir: Optional[Path] = None, headed: bool = False,
log_path = out / "bot.log"
# Detach: stdout/stderr → log file, new session so parent signals don't propagate.
with open(log_path, "ab", buffering=0) as log_fh:
- proc = subprocess.Popen(
- [sys.executable, "-m", "plugins.google_meet.meet_bot"],
- stdin=subprocess.DEVNULL, stdout=log_fh, stderr=subprocess.STDOUT,
- env=env, start_new_session=True, close_fds=True)
-
- record = {
- "pid": proc.pid, "meeting_id": meeting_id, "out_dir": str(out), "url": url,
- "started_at": time.time(), "session_id": session_id, "log_path": str(log_path), "mode": mode,
- }
+ proc = subprocess.Popen([sys.executable, "-m", "plugins.google_meet.meet_bot"], stdin=subprocess.DEVNULL,
+ stdout=log_fh, stderr=subprocess.STDOUT, env=env, start_new_session=True,
+ close_fds=True)
+ record = {"pid": proc.pid, "meeting_id": meeting_id, "out_dir": str(out), "url": url,
+ "started_at": time.time(), "session_id": session_id, "log_path": str(log_path), "mode": mode}
_write_active(record)
return {"ok": True, **record}
diff --git a/plugins/google_meet/realtime/openai_client.py b/plugins/google_meet/realtime/openai_client.py
index 820b3919b45..bd9cc5c5e39 100644
--- a/plugins/google_meet/realtime/openai_client.py
+++ b/plugins/google_meet/realtime/openai_client.py
@@ -201,13 +201,12 @@ class RealtimeSpeaker:
# One entry per iteration: the queue may grow while we speak.
head = entries[0]
text = (head.get("text") or "").strip()
+ result = {"ok": True, "bytes_written": 0, "duration_ms": 0.0}
if text:
try:
result = self.session.speak(text)
except Exception as exc:
result = {"ok": False, "error": str(exc)}
- else:
- result = {"ok": True, "bytes_written": 0, "duration_ms": 0.0}
self._append_processed(head, result)
# Re-read (new entries may have arrived), then drop the head by position or id.