refactor: reorganize client transport and extension internals

- Split client, native, remote, serve, markdown, and SDK internals into focused packages with direct imports.
- Move local and remote transport framing/protocol helpers behind clearer module boundaries.
- Break up the extension injected DOM logic into a separate content dispatch bundle and dedicated content modules.
- Add explicit client handling for passive remote discovery without noisy PQ warnings.
- Keep behavior covered with updated unit, integration, and extension tests.
This commit is contained in:
2026-06-13 23:31:24 +02:00
parent fd5447cbb9
commit 076914e5b7
88 changed files with 7491 additions and 5228 deletions
+16 -14
View File
@@ -1,24 +1,26 @@
"""Windows namespace: ``b.windows.*``."""
from __future__ import annotations
from browser_cli.sdk.base import Namespace
from browser_cli.sdk.base import Namespace, sdk_command
class WindowsNS(Namespace):
"""List, open, close, and rename browser windows."""
"""List, open, close, and rename browser windows."""
def list(self) -> list[dict]:
"""Return browser windows.
def list(self) -> list[dict]:
"""Return browser windows.
In implicit multi-browser mode each window dict includes a ``browser`` key.
"""
return self._c._multi_list("windows.list", {}, self._c._tag_browser)
In implicit multi-browser mode each window dict includes a ``browser`` key.
"""
return self.multi_list("windows.list", {}, self.tag_browser)
def open(self, url: str | None = None) -> dict:
"""Open a new browser window, optionally on a URL."""
return self._c._cmd("windows.open", {"url": url}) or {}
@sdk_command("windows.open", lambda self, url=None: {"url": url}, default={})
def open(self, url: str | None = None) -> dict:
"""Open a new browser window, optionally on a URL."""
def close(self, window_id: int) -> None:
self._c._cmd("windows.close", {"windowId": window_id})
@sdk_command("windows.close", lambda self, window_id: {"windowId": window_id}, return_result=False)
def close(self, window_id: int) -> None:
"""Close a browser window by ID."""
def rename(self, window_id: int, name: str) -> None:
self._c._cmd("windows.rename", {"windowId": window_id, "name": name})
@sdk_command("windows.rename", lambda self, window_id, name: {"windowId": window_id, "name": name}, return_result=False)
def rename(self, window_id: int, name: str) -> None:
"""Rename a browser window."""