|
| 1 | +================================================== |
| 2 | +New Features (2026-06-19) — Set-of-Marks Overlay |
| 3 | +================================================== |
| 4 | + |
| 5 | +Modern GUI agents ground far more reliably when shown a screenshot with |
| 6 | +**numbered boxes** over the interactable elements plus an ``id -> bbox`` |
| 7 | +legend ("Set-of-Marks" prompting): the model picks a *number* instead of |
| 8 | +guessing pixel coordinates. This turns AutoControl's existing element |
| 9 | +sources into that two-stage "mark then pick a number" loop and resolves the |
| 10 | +chosen number back to a click. Pure standard library + Pillow (already a |
| 11 | +dependency); wired through the full stack. |
| 12 | + |
| 13 | +.. contents:: |
| 14 | + :local: |
| 15 | + :depth: 2 |
| 16 | + |
| 17 | + |
| 18 | +Numbering and the legend |
| 19 | +======================= |
| 20 | + |
| 21 | +:: |
| 22 | + |
| 23 | + from je_auto_control import mark_elements, render_marks, resolve_mark |
| 24 | + |
| 25 | + marks = mark_elements(elements) # [{id, bbox, center, role, text}, ...] |
| 26 | + legend = [(m["id"], m["text"]) for m in marks] |
| 27 | + annotated_png = render_marks(screenshot_png_bytes, marks) |
| 28 | + chosen = resolve_mark(marks, 3) # the element the model picked |
| 29 | + |
| 30 | +``mark_elements`` assigns ``1..N`` to every element with a valid bounds and |
| 31 | +records its centre; ``render_marks`` draws numbered red boxes on a PNG; |
| 32 | +``resolve_mark`` maps a number back to its mark. These are pure and |
| 33 | +unit-testable with synthetic elements. |
| 34 | + |
| 35 | + |
| 36 | +Live "mark then click" loop |
| 37 | +========================== |
| 38 | + |
| 39 | +:: |
| 40 | + |
| 41 | + from je_auto_control import mark_screen, mark_click |
| 42 | + |
| 43 | + result = mark_screen(render_path="marked.png") # numbers the live a11y tree |
| 44 | + # ... feed result["marks"] + marked.png to a VLM, get back a number ... |
| 45 | + mark_click(3) # click mark #3 |
| 46 | + |
| 47 | +``mark_screen`` numbers the live accessibility elements (and optionally |
| 48 | +saves a numbered-box overlay screenshot), caching the marks; ``mark_click`` |
| 49 | +resolves a number from that cache and clicks the element's centre. Exposed |
| 50 | +as ``AC_mark_screen`` / ``AC_mark_click`` (and ``ac_mark_screen`` / |
| 51 | +``ac_mark_click``). |
0 commit comments