fix(browser): unwrap CDP Runtime.evaluate results for consistency

The CDP bridge server now unwraps Runtime.evaluate results from the
nested CDP format {result: {type, value}} to just the value, matching
Playwright's evaluate return format.

Also bumps hanzo-tools-browser to 0.4.5 and hanzo-mcp to 0.12.9.
This commit is contained in:
2026-03-10 10:38:31 -07:00
parent b61548393e
commit 008b5bd8d2
3 changed files with 14 additions and 4 deletions
+2 -2
View File
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "hanzo-mcp"
version = "0.12.8"
version = "0.12.9"
description = "The Zen of Hanzo MCP: One server to rule them all. The ultimate MCP that orchestrates all others."
readme = "README.md"
requires-python = ">=3.12"
@@ -30,7 +30,7 @@ dependencies = [
"hanzo-tools>=0.3.0",
"hanzo-tools-fs>=0.1.0",
"hanzo-tools-shell>=0.6.1",
"hanzo-tools-browser[playwright]>=0.4.2", # Extension-first routing, Playwright fallback
"hanzo-tools-browser[playwright]>=0.4.5", # Extension-first routing, Playwright fallback
"hanzo-tools-memory>=0.2.0",
"hanzo-tools-todo>=0.1.0",
"hanzo-tools-reasoning>=0.1.0",
@@ -326,12 +326,22 @@ class CDPBridgeServer:
# Wait for response with timeout
response = await asyncio.wait_for(future, timeout=30.0)
# Unwrap CDP-specific result formats for consistency with Playwright
raw_result = response.get("result", {})
if method == "Runtime.evaluate" and isinstance(raw_result, dict):
# CDP returns {result: {type, value}} — extract the value
cdp_result = raw_result.get("result", {})
if isinstance(cdp_result, dict) and "value" in cdp_result:
raw_result = cdp_result["value"]
elif isinstance(cdp_result, dict) and cdp_result.get("type") == "undefined":
raw_result = None
# Return result
return web.json_response(
{
"success": True,
"client_id": target_client.client_id,
"result": response.get("result", {}),
"result": raw_result,
},
headers={"Access-Control-Allow-Origin": "*"},
)
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "hanzo-tools-browser"
version = "0.4.4"
version = "0.4.5"
description = "Browser automation tools with extension-first routing - uses Hanzo browser extension when available, Playwright as fallback"
readme = "README.md"
requires-python = ">=3.12"