Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions scripts/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@

# Auto-extracted from noreply emails + manual overrides
AUTHOR_MAP = {
"jeevesassistant00@gmail.com": "jeeves-assistant", # PR #50771 (computer-use CuaDriver vision capture routing)
"21178861+ScotterMonk@users.noreply.github.com": "ScotterMonk", # PR #50145 salvage (cron output truncation: adapter-aware chunking, #50126)
"rrandqua@gmail.com": "TutkuEroglu", # PR #50481 salvage (AGENTS.md stale token-lock adapter path)
"f@trycua.com": "f-trycua", # PR #50507 salvage (cross-platform computer_use; supersedes #44221/#30660)
Expand Down
44 changes: 44 additions & 0 deletions tests/tools/test_computer_use.py
Original file line number Diff line number Diff line change
Expand Up @@ -2139,6 +2139,50 @@ def fake_call_tool(name, args):
# Markdown surface doesn't carry bounds — lossy by design.
assert cap.elements[0].bounds == (0, 0, 0, 0)

def test_vision_capture_uses_get_window_state_not_removed_screenshot_tool(self):
"""cua-driver 0.6.x returns vision screenshots from
get_window_state(capture_mode="vision"); the old standalone
screenshot tool is no longer available."""
from tools.computer_use.cua_backend import CuaDriverBackend

backend = CuaDriverBackend()
backend._session = MagicMock()

windows_payload = {
"windows": [{
"app_name": "Demo", "pid": 9, "window_id": 1,
"is_on_screen": True, "title": "Demo", "z_index": 0,
}],
}
png_b64 = (
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42m"
"NkYAAAAAYAAjCB0C8AAAAASUVORK5CYII="
)

def fake_call_tool(name, args):
if name == "list_windows":
return {"data": "", "images": [], "image_mime_types": [],
"structuredContent": windows_payload, "isError": False}
if name == "get_window_state":
assert args["capture_mode"] == "vision"
return {"data": "", "images": [png_b64],
"image_mime_types": ["image/png"],
"structuredContent": None, "isError": False}
if name == "screenshot":
raise AssertionError("vision capture must not call removed screenshot tool")
return {"data": "", "images": [], "image_mime_types": [],
"structuredContent": None, "isError": False}

backend._session.call_tool.side_effect = fake_call_tool
cap = backend.capture(mode="vision")

tool_names = [call.args[0] for call in backend._session.call_tool.call_args_list]
assert tool_names == ["list_windows", "get_window_state"]
assert cap.png_b64 == png_b64
assert cap.image_mime_type == "image/png"
assert cap.width == 1
assert cap.height == 1


class TestCapabilityDiscovery:
"""Surface 4 (NousResearch/hermes-agent#47072): the wrapper learns
Expand Down
11 changes: 7 additions & 4 deletions tools/computer_use/cua_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,13 +1003,16 @@ def capture(self, mode: str = "som", app: Optional[str] = None) -> CaptureResult
window_title = ""

if mode == "vision":
# screenshot tool: just the PNG, no AX walk.
# Newer cua-driver releases no longer expose a standalone
# `screenshot` MCP tool. Request a screenshot-only capture via
# get_window_state instead; this keeps vision mode working while
# avoiding the AX walk used by som/ax captures.
sc_out = self._session.call_tool(
"screenshot",
"get_window_state",
{
"pid": self._active_pid,
"window_id": self._active_window_id,
"format": "jpeg",
"quality": 85,
"capture_mode": "vision",
"session": self._session_id,
},
)
Expand Down
Loading