INNER CODE UNIT · Python
browser_watch
feder-cr/Jobs_Applier_AI_Agent_AIHawk · src/aihawk/mcp/server.py:521
async def browser_watch(browser: Browser = None) -> Image:
"""The whole browser window as a person at the machine sees it: tab strip,
address bar, the page and the pointer, from a live capture kept running on
that page. For watching the work, not for acting on it: the picture
is window pixels, so do not feed its coordinates to browser_click_at; use
browser_take_screenshot for that.
Starts nothing. A browser that is not open has no window, so this answers
the sentence that says so, and the live panes - which call this many times
a second - read that sentence as the idle pane."""
# It REFUSES rather than answering the sentence as text, and only because
# the type says so: this is declared to return an Image, and `Image | str`
# is not a schema pydantic will build - measured, five test modules
# refuse to import. A refusal reaches a client as an error result
# carrying the reason, which every client already handles.
jpeg = await work.acting(lambda session: session.watch_frame(), role=browser)
return Image(data=jpeg, format="jpeg")