Repository navigation
feat: add find_text, on-screen OCR with Windows.Media.Ocr (#117) - #145
Merged
Merged
Conversation
Reads text from the screen or an image/video frame with Windows' built-in OCR, returning lines and query matches with bounding boxes, and with redact: true, padded rectangles ready for redact_region. Two upscaled passes are merged because the engine drops ALL_CAPS_UNDERSCORE words at normal sizes, and plain queries tolerate its usual misreads. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Closes #117.
What
New tool
find_text{ target | input, timestamp, query, regex, redact, returnImage, exactTitle }.target, or a frame of an image/videoinput.Windows.Media.Ocrthrough WinRT from Windows PowerShell 5.1 (AsTaskreflection to await). Paths travel base64-encoded (no quoting), and every pass runs in one PowerShell process (~1 s per call).text,lines(each with a bounding box, capped at 300), and with aquery:matchesboxed around the words they span plus the image inline with matches outlined.redact: trueadds padded, clampedredactRegionsforredact_region.What testing turned up
OPENAI_API_KEY=sk-proj-…vanished entirely at 1×, 2×, and 3× on 18 px text (so didAPI_KEY=abc), whileghp_…andtoken: sk-…were fine. Binarizing, inverting, and padding didn't help; 4× did. So recognition merges a 2× and a 4× pass (de-duplicating overlapping lines, keeping the longer reading), capped at the engine's 10,000 px limit._as-andIasl, so plain queries match through a normalization (-/_/space,l/I/1/|,O/0).OPENAI_API_KEYmatches the misreadOPENAI-APl-KEY. Regex queries match the raw text.End to end (through the server)
Find
regex: "sk-|ghp_"on a video frame → 2 matches +redactRegions→redact_region→ re-runfind_text→ 0 matches, non-secret lines still readable. This loop is in the live harness too.Tests
ocr.test.ts, 10): pass parsing and de-scaling, PowerShell's single-object quirk, language-missing hint, pass merging, normalization, plain/phrase/repeated/regex matching with word boxes, redaction padding and clamping, scale capping.The threat model in the README now points to
find_textas an aid for finding secrets, and is explicit that OCR is best-effort. Version 0.19.0; README (30 tools), Pages,mcp-tools.json, CHANGELOG.🤖 Generated with Claude Code