feat: add Windows UI Automation support and adb-mcp#16
feat: add Windows UI Automation support and adb-mcp#163338682145 wants to merge 2 commits intoEinsia:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces comprehensive support for Windows 11, enabling cross-platform capture via Windows UI Automation polling alongside the existing macOS event-driven system. Key additions include a new Windows-specific capture provider, a PowerShell installation script, and platform-aware path and process management. Documentation and configuration have been updated to reflect these changes, and file operations now consistently specify UTF-8 encoding. Feedback focuses on improving the robustness of JSON parsing by using read_bytes() instead of read_text() to prevent potential UnicodeDecodeError exceptions.
| """Rewrite a capture JSON without its ``screenshot`` field. Returns True if stripped.""" | ||
| try: | ||
| raw = path.read_text() | ||
| raw = path.read_text(encoding="utf-8") |
There was a problem hiding this comment.
When parsing JSON files, it is recommended to use read_bytes() instead of read_text(). This allows the json library to handle encoding detection automatically and prevents potential UnicodeDecodeError exceptions, which are a type of ValueError and might not be caught by OSError handlers.
| raw = path.read_text(encoding="utf-8") | |
| raw = path.read_bytes() |
References
- When parsing JSON files, use
read_bytes()and pass the result tojson.loads()to let the JSON library handle encoding detection and prevent unhandledUnicodeDecodeErrorexceptions.
| return {} | ||
| try: | ||
| data = json.loads(path.read_text()) | ||
| data = json.loads(path.read_text(encoding="utf-8")) |
There was a problem hiding this comment.
When parsing JSON files, it is recommended to use read_bytes() instead of read_text(). This allows the json library to handle encoding detection automatically and prevents potential UnicodeDecodeError exceptions, which are a type of ValueError and may not be caught by OSError handlers.
| data = json.loads(path.read_text(encoding="utf-8")) | |
| data = json.loads(path.read_bytes()) |
References
- When parsing JSON files, use
read_bytes()and pass the result tojson.loads()to let the JSON library handle encoding detection and prevent unhandledUnicodeDecodeErrorexceptions.
| return {} | ||
| try: | ||
| data = json.loads(path.read_text()) | ||
| data = json.loads(path.read_text(encoding="utf-8")) |
There was a problem hiding this comment.
When parsing JSON files, it is recommended to use read_bytes() instead of read_text(). This allows the json library to handle encoding detection automatically and prevents potential UnicodeDecodeError exceptions, which are a type of ValueError and may not be caught by OSError handlers.
| data = json.loads(path.read_text(encoding="utf-8")) | |
| data = json.loads(path.read_bytes()) |
References
- When parsing JSON files, use
read_bytes()and pass the result tojson.loads()to let the JSON library handle encoding detection and prevent unhandledUnicodeDecodeErrorexceptions.
| for p in files: | ||
| try: | ||
| data = json.loads(p.read_text()) | ||
| data = json.loads(p.read_text(encoding="utf-8")) |
There was a problem hiding this comment.
When parsing JSON files, it is recommended to use read_bytes() instead of read_text(). This allows the json library to handle encoding detection automatically and prevents potential UnicodeDecodeError exceptions, which are not caught by the current OSError handler.
| data = json.loads(p.read_text(encoding="utf-8")) | |
| data = json.loads(p.read_bytes()) |
References
- When parsing JSON files, use
read_bytes()and pass the result tojson.loads()to let the JSON library handle encoding detection and prevent unhandledUnicodeDecodeErrorexceptions.
| def _load_capture(path: Path) -> dict[str, Any] | None: | ||
| try: | ||
| return json.loads(path.read_text()) | ||
| return json.loads(path.read_text(encoding="utf-8")) |
There was a problem hiding this comment.
When parsing JSON files, it is recommended to use read_bytes() instead of read_text(). This allows the json library to handle encoding detection automatically and prevents potential UnicodeDecodeError exceptions, which are a type of ValueError and may not be caught by OSError handlers.
| return json.loads(path.read_text(encoding="utf-8")) | |
| return json.loads(path.read_bytes()) |
References
- When parsing JSON files, use
read_bytes()and pass the result tojson.loads()to let the JSON library handle encoding detection and prevent unhandledUnicodeDecodeErrorexceptions.
|
Please feel free to contact us with any questions. |
Summary
This PR adds Windows support to OpenChronicle by replacing only the OS
capture layer and keeping the existing memory pipeline intact.
What changed
with the existing capture buffer format.
start,status, andstop.%LOCALAPPDATA%\OpenChronicle.install.ps1for Windows 11 install and startup.os.replaceretry for Windowsfile writes.
Verification
uv run pytest --basetemp pytest-temp-pruv run ruff check src/openchronicle/capture/windows_uia.py tests/ test_windows_support.pypython -m compileall srcResults:
105 passed, 1 skippedNotes
ruff checkstill has 7 pre-existing lint issues in unrelated testfiles.
Title: Add Android ADB Control MCP server with OpenChronicle memory logging
Summary:
app launch, and logcat tools.
APIs.
Validation: