feat(read): target any tab for page info and extraction
Testing / test (push) Successful in 40s
Testing / remote-protocol-compat (0.16.0) (push) Successful in 31s
Testing / remote-protocol-compat (0.15.0) (push) Successful in 39s

- Add --tab option to all extract commands and page info
- Thread tab_id through the SDK extract and page namespaces
- Route page.info with a tab_id to tabs.status for cross-tab metadata
- Accept tab_id in the MCP page_info, extract_text, extract_markdown tools
- Forward tabId in the extension page.info and extract.html handlers
- Keep the active tab as default when no tab is given

- Cover tab-scoped reads in API, CLI, and MCP tests
- Bump package and extension version to 0.16.7
- Refresh uv.lock with current dependency versions
This commit is contained in:
2026-08-28 11:19:02 +02:00
parent 6352d9994e
commit 914508e2db
11 changed files with 522 additions and 410 deletions
+14 -3
View File
@@ -299,22 +299,28 @@ class TestExtract:
result = b.extract.markdown()
assert result == "# Title"
mock_send.assert_called_once_with("extract.markdown", {"selector": None}, profile=None, remote=None, key=None)
mock_send.assert_called_once_with("extract.markdown", {"selector": None, "tabId": None}, profile=None, remote=None, key=None)
def test_extract_markdown_selector(self, b, mock_send):
mock_send.return_value = "## Post"
assert b.extract.markdown("article") == "## Post"
mock_send.assert_called_once_with("extract.markdown", {"selector": "article"}, profile=None, remote=None, key=None)
mock_send.assert_called_once_with("extract.markdown", {"selector": "article", "tabId": None}, profile=None, remote=None, key=None)
def test_extract_links(self, b, mock_send):
mock_send.return_value = [{"href": "https://x"}]
assert b.extract.links() == [{"href": "https://x"}]
mock_send.assert_called_once_with("extract.links", {}, profile=None, remote=None, key=None)
mock_send.assert_called_once_with("extract.links", {"tabId": None}, profile=None, remote=None, key=None)
def test_extract_text_none(self, b, mock_send):
mock_send.return_value = None
assert b.extract.text() == ""
mock_send.assert_called_once_with("extract.text", {"tabId": None}, profile=None, remote=None, key=None)
def test_extract_markdown_tab_id(self, b, mock_send):
mock_send.return_value = "# Specific"
assert b.extract.markdown(tab_id=42) == "# Specific"
mock_send.assert_called_once_with("extract.markdown", {"selector": None, "tabId": 42}, profile=None, remote=None, key=None)
# ── Tabs ──────────────────────────────────────────────────────────────────────
@@ -869,6 +875,11 @@ class TestPageStorageCookies:
assert b.page.info() == {"title": "X"}
mock_send.assert_called_once_with("page.info", {}, profile=None, remote=None, key=None)
def test_page_info_tab_id(self, b, mock_send):
mock_send.return_value = {"title": "X"}
assert b.page.info(tab_id=42) == {"title": "X"}
mock_send.assert_called_once_with("tabs.status", {"tabId": 42}, profile=None, remote=None, key=None)
def test_storage_get(self, b, mock_send):
mock_send.return_value = "v"
assert b.storage.get("k") == "v"