Repository navigation
feat: read window text, inspect one subtree, and recognize text in captures - #55
Merged
Merged
Conversation
…ptures desktop_read returns up to 96 KB of a window's Accessibility text, or one inspected element's subtree, in tree order with truncation reasons. It takes no snapshot and sends no input. desktop_inspect takes an optional scope (snapshot and element) that reads the window with a 4,000-element budget and lists only that subtree; IDs belong to the new snapshot. desktop_inspect and desktop_screen take ocr to add Apple Vision text lines with normalized top-left boxes. peekaboo-element-depth.patch, last in the stack, records each element's depth so a client recovers subtrees from the pre-order element list.
iamnbutler
force-pushed
the
feat/read-more
branch
from
October 17, 2026 03:10
7576d1d to
ab1fe57
Compare
This was referenced Oct 17, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lets an agent read much more of a window: its full text, one deep subtree's elements, and text in windows that only have pixels.
Tools
desktop_read(new, read-only) returns the Accessibility text of one exact window, up to 96 KB.truncatedandtruncationname what cut the text short:text_limitor the traversal'sax_truncated_depth|count|children|deadlineorax_incomplete_read.scope(snapshot+elementfrom an earlier accessibilitydesktop_inspectof the same window) reads only that element's subtree, such as anAXWebArea.read_errorwith guidance that points canvases, games and remote desktops to pixels inspection with OCR.desktop_inspectscope: lists only one element's subtree, in tree order, each element withattributes.depth.scope, inspection behaves as it does today: budget 15/200/100, same ordering.ocr: trueondesktop_inspect(either mode) anddesktop_screenrunsVNRecognizeTextRequestat the accurate level, with language correction, in the client on the PNG it just captured.recognized_text.lineslists text, confidence andboxas top-left-normalized fractions of the screenshot. A box's center is a valid pointerpointfor that inspection's snapshot.desktop_screenaddsboundsin global desktop points.recognized_text.errorand never fails the observation.Bridge
desktopObservationwith a largerAXTraversalBudgetandsaveSnapshot: falsealready gives a fresh, exact-window, read-only detached traversal, sodesktop_readuses only operations that are already allowed. No runtime allowlist changes were needed.inspectAccessibilityTreewas not used, because with web focus it is a mutation. Peekaboo's ownaccessibilityAndOCRwas not used either, because pixel snapshots require detectionnone.DetectedElementis flat and has no hierarchy, andelements.allis grouped by type.peekaboo-element-depth.patch(last in the stack, afterpeekaboo-element-action.patch) adds a one-linedepthattribute inDetachedAXObservationWorker. Element IDs are already pre-order (elem_N), so depth recovers each subtree. Traversal, budgets, IDs and authority are unchanged. It is documented innative/patches/README.md.Verified
npm run build:js && npm run checkpasses.node dist/build.js --out build --scratch native/.buildpasses. I also reset the scratch Peekaboo checkout to the pinned revision and rebuilt, so the full stack, including the new patch, applies cleanly.ocr.swift, compiled standalone with a test harness, not committed):boundsmapping is correct.error.text.swift, standalone harness):inspect … accessibility ocr,… scope <snap> <elem>,read <pid> <win> [<snap> <elem>],screen <path> [display] ocr).read_error. Recognized text is carried through for inspect and screen.DetachedAXObservationWorker.process, which needs live AX, and the existing worker tests cover only static helpers.Pending: screen locked
The Mac stayed locked for the whole session, so nothing ran live. With a signed dev build (
open -n --env DESKTOP_TOOLS_STATE=/tmp/readdev "<built app>", thenDESKTOP_TOOLS_STATE=/tmp/readdev node dist/mcp.js):desktop_readreturns the whole article text in order, including below the fold, andtruncatedis false or namestext_limit. Note the time taken.desktop_inspect, thendesktop_readwithscopeon theAXWebAreaelement. Check that the result has no toolbar or tab text.desktop_inspectwithscopeon the web area. It should list links deep in the page withattributes.depth. Thendesktop_clickone listed link by ID with the new snapshot, and check that it navigates.desktop_readlists the rows. A scoped inspect of the list or outline shows rows past the first 200 elements.desktop_readtext is complete.desktop_inspectmode: "pixels", ocr: truereturns lines. Adesktop_clickat a line's box center hits that text.desktop_screenocr: true: lineboundsmatch the windows' positions on screen.desktop_readreturns theAXTextAreavalue once, not duplicated.ax_truncated_deadlineinstead of failing.Caveats
truncationordetection_metadata.docs/tools.mdnow says 39 tools, counting the tools merged since; main still documented 35.