Each wrapper (`ls`, `cat`, `click`, `type_text`, `grep`, etc.) in `cli_anything/browser/utils/domshell_backend.py` currently calls `asyncio.run(_call_execute(...))` 2–4 times in sequence (anchor → operation → restore for split-and-check wrappers; up to 4 calls for `type_text`'s focus/type sequence). Each call creates and tears down its own event loop.
Recommendation: refactor each wrapper to wrap an `async def _impl(): ...` in a single `asyncio.run(...)` so the loop is created once per wrapper invocation. Behavior unchanged; cleaner foundation for any future async-native API.
Scope:
- 10ish wrappers in `domshell_backend.py`
- No CLI-level changes needed (wrappers remain sync)
- Existing tests should pass without modification
Surfaced by: Copilot R4 on PR #308 commit `5790651` and addressed via R4 cleanup commit `a87647e` deferring this item.
Each wrapper (`ls`, `cat`, `click`, `type_text`, `grep`, etc.) in `cli_anything/browser/utils/domshell_backend.py` currently calls `asyncio.run(_call_execute(...))` 2–4 times in sequence (anchor → operation → restore for split-and-check wrappers; up to 4 calls for `type_text`'s focus/type sequence). Each call creates and tears down its own event loop.
Recommendation: refactor each wrapper to wrap an `async def _impl(): ...` in a single `asyncio.run(...)` so the loop is created once per wrapper invocation. Behavior unchanged; cleaner foundation for any future async-native API.
Scope:
Surfaced by: Copilot R4 on PR #308 commit `5790651` and addressed via R4 cleanup commit `a87647e` deferring this item.