omnisight 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- omnisight-0.1.0/LICENSE +202 -0
- omnisight-0.1.0/PKG-INFO +204 -0
- omnisight-0.1.0/README.md +166 -0
- omnisight-0.1.0/pyproject.toml +64 -0
- omnisight-0.1.0/pyproject.toml.orig +61 -0
- omnisight-0.1.0/src/omnisight/__init__.py +1 -0
- omnisight-0.1.0/src/omnisight/capture.py +355 -0
- omnisight-0.1.0/src/omnisight/inputs.py +299 -0
- omnisight-0.1.0/src/omnisight/ocr.py +138 -0
- omnisight-0.1.0/src/omnisight/py.typed +0 -0
- omnisight-0.1.0/src/omnisight/server.py +432 -0
- omnisight-0.1.0/src/omnisight/uia.py +258 -0
- omnisight-0.1.0/src/omnisight/winutil.py +266 -0
omnisight-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
202
|
+
|
omnisight-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: omnisight
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Computer-use backend (MCP server) that sees and drives any Windows app window: GPU-rendered, covered or in the background.
|
|
5
|
+
Keywords: mcp,computer-use,agents,windows,ui-automation,screen-capture,ocr
|
|
6
|
+
Author: Xiao-Chien Lin
|
|
7
|
+
Author-email: Xiao-Chien Lin <356159129+Alex20090906@users.noreply.github.com>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Win32 (MS Windows)
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: Microsoft :: Windows :: Windows 10
|
|
14
|
+
Classifier: Operating System :: Microsoft :: Windows :: Windows 11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Desktop Environment
|
|
18
|
+
Classifier: Topic :: Software Development :: Testing
|
|
19
|
+
Requires-Dist: comtypes>=1.5.0
|
|
20
|
+
Requires-Dist: mcp[cli]>=2.3.0
|
|
21
|
+
Requires-Dist: mss>=10.2.0
|
|
22
|
+
Requires-Dist: numpy>=2.5.4
|
|
23
|
+
Requires-Dist: pillow>=13.0.0
|
|
24
|
+
Requires-Dist: uiautomation>=2.0.29
|
|
25
|
+
Requires-Dist: windows-capture>=2.0.1
|
|
26
|
+
Requires-Dist: winrt-windows-foundation>=4!10.0.28000.2957
|
|
27
|
+
Requires-Dist: winrt-windows-foundation-collections>=4!10.0.28000.2957
|
|
28
|
+
Requires-Dist: winrt-windows-globalization>=4!10.0.28000.2957
|
|
29
|
+
Requires-Dist: winrt-windows-graphics-imaging>=4!10.0.28000.2957
|
|
30
|
+
Requires-Dist: winrt-windows-media-ocr>=4!10.0.28000.2957
|
|
31
|
+
Requires-Dist: winrt-windows-storage-streams>=4!10.0.28000.2957
|
|
32
|
+
Requires-Dist: rapidocr-onnxruntime>=1.4.4 ; extra == 'ocr'
|
|
33
|
+
Requires-Python: >=3.12
|
|
34
|
+
Project-URL: Homepage, https://github.com/Alex20090906/omnisight
|
|
35
|
+
Project-URL: Issues, https://github.com/Alex20090906/omnisight/issues
|
|
36
|
+
Provides-Extra: ocr
|
|
37
|
+
Description-Content-Type: text/markdown
|
|
38
|
+
|
|
39
|
+
# OmniSight
|
|
40
|
+
|
|
41
|
+
> 繁體中文說明:[README.zh-TW.md](https://github.com/Alex20090906/omnisight/blob/main/README.zh-TW.md)
|
|
42
|
+
|
|
43
|
+
**Computer use for every Windows app window, for any MCP agent: GPU-rendered,
|
|
44
|
+
covered or in the background.**
|
|
45
|
+
|
|
46
|
+
Agents that drive a desktop through screenshots keep hitting the same walls on
|
|
47
|
+
Windows:
|
|
48
|
+
|
|
49
|
+
- GPU-rendered windows (games, emulators, Chromium / Electron, UWP) come back
|
|
50
|
+
**black** from classic GDI capture.
|
|
51
|
+
- A window that is **covered** or in the **background** is not in a full-screen
|
|
52
|
+
screenshot at all.
|
|
53
|
+
- Every step sends a **full-screen image** to a vision model just to find one
|
|
54
|
+
button, which is slow and expensive.
|
|
55
|
+
- Clicks land in the wrong place on scaled and mixed-DPI monitors.
|
|
56
|
+
|
|
57
|
+
OmniSight is an MCP server that fixes these at the source. Claude Code, Codex,
|
|
58
|
+
Cursor, Cline, Claude Desktop and any other MCP client can use it.
|
|
59
|
+
|
|
60
|
+
## How it works
|
|
61
|
+
|
|
62
|
+
1. **Structure first, pixels second.** By default a snapshot returns the UI
|
|
63
|
+
Automation element tree: every element has an id, a position and the actions
|
|
64
|
+
it supports. The whole tree comes back in one cross-process call (a UIA cache
|
|
65
|
+
request), typically in 30–300 ms, and it is text, not an image.
|
|
66
|
+
2. **Act on elements without the mouse.** `click(element="e7")` runs the UIA
|
|
67
|
+
Invoke / Toggle / Select pattern and `type_text(replace=true)` sets the value
|
|
68
|
+
directly. This works on background windows and does not steal focus.
|
|
69
|
+
3. **Capture one window, with backends that fall back automatically.**
|
|
70
|
+
`printwindow` → `wgc` (Windows.Graphics.Capture) → `bitblt` → `screen`.
|
|
71
|
+
A black or single-colour frame counts as a failure and the next backend is
|
|
72
|
+
tried. The backend that worked is remembered per process.
|
|
73
|
+
4. **Image and OCR only when the tree is not enough.** In `auto` mode a
|
|
74
|
+
screenshot and OCR text with positions are added when the tree does not
|
|
75
|
+
describe the content (games, emulators, canvas apps, custom-drawn UIs).
|
|
76
|
+
5. **One coordinate space.** Element positions, OCR boxes and the image all use
|
|
77
|
+
window-relative pixels of the snapshot image, so a position read from any of
|
|
78
|
+
them can go straight into `click`. The process is per-monitor DPI aware.
|
|
79
|
+
|
|
80
|
+
Measured on a Windows 10 machine: a covered emulator window captured in about
|
|
81
|
+
100 ms, a 153-element Discord tree in about 130 ms, and repeat captures of a
|
|
82
|
+
covered Discord window in under 200 ms end to end over MCP.
|
|
83
|
+
|
|
84
|
+
## Tools
|
|
85
|
+
|
|
86
|
+
| Tool | What it does |
|
|
87
|
+
|---|---|
|
|
88
|
+
| `list_windows` | Windows front to back: hwnd, process, title, size, and flags such as minimized, admin, capture-blocked |
|
|
89
|
+
| `snapshot` | `mode` = `tree` / `image` / `ocr` / `auto` / `all` |
|
|
90
|
+
| `click` | Click an element id or an `x,y`; `background=true` posts messages instead of moving the mouse |
|
|
91
|
+
| `type_text` | Type text in any language, or set a control's value directly |
|
|
92
|
+
| `press_key` | Key combinations such as `ctrl+s`; `scancode=true` for games that read hardware scan codes |
|
|
93
|
+
| `scroll` / `drag` | Scroll and drag |
|
|
94
|
+
| `element_action` | invoke / toggle / expand / select / set_value / focus |
|
|
95
|
+
| `find_element` | Find elements by text |
|
|
96
|
+
| `wait_for_change` | Wait until the window's pixels change (loading, animations) |
|
|
97
|
+
| `screenshot_screen` | Whole-screen capture, for cross-window context |
|
|
98
|
+
| `focus_window` | Bring a window to the front |
|
|
99
|
+
|
|
100
|
+
The `window` argument takes an hwnd, or part of the title or process name.
|
|
101
|
+
|
|
102
|
+
## Install
|
|
103
|
+
|
|
104
|
+
Requires Windows 10 1903 or later and [uv](https://docs.astral.sh/uv/).
|
|
105
|
+
Nothing to install up front: `uvx` fetches OmniSight from PyPI the first time
|
|
106
|
+
the agent starts it.
|
|
107
|
+
|
|
108
|
+
The `[ocr]` extra adds RapidOCR (about 70 MB). It is far more accurate than the
|
|
109
|
+
built-in Windows OCR on small UI fonts and mixed Chinese / English text. Without
|
|
110
|
+
it, use `uvx omnisight` and OmniSight falls back to Windows OCR.
|
|
111
|
+
|
|
112
|
+
## Connect an agent
|
|
113
|
+
|
|
114
|
+
**Claude Code**
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
claude mcp add -s user omnisight -- uvx --from "omnisight[ocr]" omnisight
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
**Codex** (`~/.codex/config.toml`)
|
|
121
|
+
|
|
122
|
+
```toml
|
|
123
|
+
[mcp_servers.omnisight]
|
|
124
|
+
command = "uvx"
|
|
125
|
+
args = ["--from", "omnisight[ocr]", "omnisight"]
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
**Cursor, Cline, Claude Desktop and other `mcpServers` JSON configs**
|
|
129
|
+
|
|
130
|
+
```json
|
|
131
|
+
{
|
|
132
|
+
"mcpServers": {
|
|
133
|
+
"omnisight": {
|
|
134
|
+
"command": "uvx",
|
|
135
|
+
"args": ["--from", "omnisight[ocr]", "omnisight"]
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**From source**
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
git clone https://github.com/Alex20090906/omnisight
|
|
145
|
+
cd omnisight
|
|
146
|
+
uv sync --extra ocr
|
|
147
|
+
claude mcp add -s user omnisight -- uv run --directory <path> omnisight
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Environment variables
|
|
151
|
+
|
|
152
|
+
| Variable | Meaning |
|
|
153
|
+
|---|---|
|
|
154
|
+
| `OMNISIGHT_OCR_ENGINE` | `auto` (default: RapidOCR if installed), `rapid` or `windows` |
|
|
155
|
+
| `OMNISIGHT_OCR_LANG` | Language for Windows OCR, such as `zh-Hant-TW` or `en-US` |
|
|
156
|
+
|
|
157
|
+
## What it deliberately does not do
|
|
158
|
+
|
|
159
|
+
- **It does not bypass `SetWindowDisplayAffinity`.** Password managers, banking
|
|
160
|
+
apps and DRM video opt out of capture on purpose. OmniSight says so clearly
|
|
161
|
+
and suggests the element tree, instead of returning a black image the agent
|
|
162
|
+
would retry forever.
|
|
163
|
+
- **It does not evade anti-cheat or anti-bot detection**, and it does not touch
|
|
164
|
+
the UAC secure desktop or the lock screen.
|
|
165
|
+
- **Admin windows:** Windows (UIPI) drops input sent to an elevated window from
|
|
166
|
+
a non-elevated process. OmniSight reports this. To control such a window,
|
|
167
|
+
start the agent from an elevated terminal.
|
|
168
|
+
|
|
169
|
+
## Known limitations
|
|
170
|
+
|
|
171
|
+
- On Windows 10, the WGC backend draws a yellow border around the captured
|
|
172
|
+
window (Windows 11 can turn it off). That is why `printwindow` is tried first
|
|
173
|
+
and WGC is used only when PrintWindow returns a black frame.
|
|
174
|
+
- Minimized windows have no pixels. `snapshot(restore_minimized=true)` restores
|
|
175
|
+
the window without activating it.
|
|
176
|
+
- Background key presses (`background=true`) are reliable for single keys only:
|
|
177
|
+
most apps read the real keyboard state for Ctrl / Alt / Shift.
|
|
178
|
+
- Background clicks work for classic Win32 and WinForms. Chromium and most
|
|
179
|
+
games ignore them; use an element id, or leave `background` off.
|
|
180
|
+
- Chromium and Electron build their accessibility tree only after a client asks
|
|
181
|
+
for it. `snapshot` retries once automatically.
|
|
182
|
+
|
|
183
|
+
## Layout
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
src/omnisight/
|
|
187
|
+
winutil.py window enumeration, DPI awareness, elevation, display affinity
|
|
188
|
+
capture.py capture backend chain, black-frame detection, WGC session pool
|
|
189
|
+
uia.py UI Automation tree (one cache request) and actions
|
|
190
|
+
ocr.py RapidOCR / Windows OCR
|
|
191
|
+
inputs.py SendInput and background message input
|
|
192
|
+
server.py MCP tools
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Development
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
uv sync --extra ocr --group dev
|
|
199
|
+
uv run pytest
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## License
|
|
203
|
+
|
|
204
|
+
[Apache-2.0](https://github.com/Alex20090906/omnisight/blob/main/LICENSE)
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# OmniSight
|
|
2
|
+
|
|
3
|
+
> 繁體中文說明:[README.zh-TW.md](https://github.com/Alex20090906/omnisight/blob/main/README.zh-TW.md)
|
|
4
|
+
|
|
5
|
+
**Computer use for every Windows app window, for any MCP agent: GPU-rendered,
|
|
6
|
+
covered or in the background.**
|
|
7
|
+
|
|
8
|
+
Agents that drive a desktop through screenshots keep hitting the same walls on
|
|
9
|
+
Windows:
|
|
10
|
+
|
|
11
|
+
- GPU-rendered windows (games, emulators, Chromium / Electron, UWP) come back
|
|
12
|
+
**black** from classic GDI capture.
|
|
13
|
+
- A window that is **covered** or in the **background** is not in a full-screen
|
|
14
|
+
screenshot at all.
|
|
15
|
+
- Every step sends a **full-screen image** to a vision model just to find one
|
|
16
|
+
button, which is slow and expensive.
|
|
17
|
+
- Clicks land in the wrong place on scaled and mixed-DPI monitors.
|
|
18
|
+
|
|
19
|
+
OmniSight is an MCP server that fixes these at the source. Claude Code, Codex,
|
|
20
|
+
Cursor, Cline, Claude Desktop and any other MCP client can use it.
|
|
21
|
+
|
|
22
|
+
## How it works
|
|
23
|
+
|
|
24
|
+
1. **Structure first, pixels second.** By default a snapshot returns the UI
|
|
25
|
+
Automation element tree: every element has an id, a position and the actions
|
|
26
|
+
it supports. The whole tree comes back in one cross-process call (a UIA cache
|
|
27
|
+
request), typically in 30–300 ms, and it is text, not an image.
|
|
28
|
+
2. **Act on elements without the mouse.** `click(element="e7")` runs the UIA
|
|
29
|
+
Invoke / Toggle / Select pattern and `type_text(replace=true)` sets the value
|
|
30
|
+
directly. This works on background windows and does not steal focus.
|
|
31
|
+
3. **Capture one window, with backends that fall back automatically.**
|
|
32
|
+
`printwindow` → `wgc` (Windows.Graphics.Capture) → `bitblt` → `screen`.
|
|
33
|
+
A black or single-colour frame counts as a failure and the next backend is
|
|
34
|
+
tried. The backend that worked is remembered per process.
|
|
35
|
+
4. **Image and OCR only when the tree is not enough.** In `auto` mode a
|
|
36
|
+
screenshot and OCR text with positions are added when the tree does not
|
|
37
|
+
describe the content (games, emulators, canvas apps, custom-drawn UIs).
|
|
38
|
+
5. **One coordinate space.** Element positions, OCR boxes and the image all use
|
|
39
|
+
window-relative pixels of the snapshot image, so a position read from any of
|
|
40
|
+
them can go straight into `click`. The process is per-monitor DPI aware.
|
|
41
|
+
|
|
42
|
+
Measured on a Windows 10 machine: a covered emulator window captured in about
|
|
43
|
+
100 ms, a 153-element Discord tree in about 130 ms, and repeat captures of a
|
|
44
|
+
covered Discord window in under 200 ms end to end over MCP.
|
|
45
|
+
|
|
46
|
+
## Tools
|
|
47
|
+
|
|
48
|
+
| Tool | What it does |
|
|
49
|
+
|---|---|
|
|
50
|
+
| `list_windows` | Windows front to back: hwnd, process, title, size, and flags such as minimized, admin, capture-blocked |
|
|
51
|
+
| `snapshot` | `mode` = `tree` / `image` / `ocr` / `auto` / `all` |
|
|
52
|
+
| `click` | Click an element id or an `x,y`; `background=true` posts messages instead of moving the mouse |
|
|
53
|
+
| `type_text` | Type text in any language, or set a control's value directly |
|
|
54
|
+
| `press_key` | Key combinations such as `ctrl+s`; `scancode=true` for games that read hardware scan codes |
|
|
55
|
+
| `scroll` / `drag` | Scroll and drag |
|
|
56
|
+
| `element_action` | invoke / toggle / expand / select / set_value / focus |
|
|
57
|
+
| `find_element` | Find elements by text |
|
|
58
|
+
| `wait_for_change` | Wait until the window's pixels change (loading, animations) |
|
|
59
|
+
| `screenshot_screen` | Whole-screen capture, for cross-window context |
|
|
60
|
+
| `focus_window` | Bring a window to the front |
|
|
61
|
+
|
|
62
|
+
The `window` argument takes an hwnd, or part of the title or process name.
|
|
63
|
+
|
|
64
|
+
## Install
|
|
65
|
+
|
|
66
|
+
Requires Windows 10 1903 or later and [uv](https://docs.astral.sh/uv/).
|
|
67
|
+
Nothing to install up front: `uvx` fetches OmniSight from PyPI the first time
|
|
68
|
+
the agent starts it.
|
|
69
|
+
|
|
70
|
+
The `[ocr]` extra adds RapidOCR (about 70 MB). It is far more accurate than the
|
|
71
|
+
built-in Windows OCR on small UI fonts and mixed Chinese / English text. Without
|
|
72
|
+
it, use `uvx omnisight` and OmniSight falls back to Windows OCR.
|
|
73
|
+
|
|
74
|
+
## Connect an agent
|
|
75
|
+
|
|
76
|
+
**Claude Code**
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
claude mcp add -s user omnisight -- uvx --from "omnisight[ocr]" omnisight
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Codex** (`~/.codex/config.toml`)
|
|
83
|
+
|
|
84
|
+
```toml
|
|
85
|
+
[mcp_servers.omnisight]
|
|
86
|
+
command = "uvx"
|
|
87
|
+
args = ["--from", "omnisight[ocr]", "omnisight"]
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Cursor, Cline, Claude Desktop and other `mcpServers` JSON configs**
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
{
|
|
94
|
+
"mcpServers": {
|
|
95
|
+
"omnisight": {
|
|
96
|
+
"command": "uvx",
|
|
97
|
+
"args": ["--from", "omnisight[ocr]", "omnisight"]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**From source**
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
git clone https://github.com/Alex20090906/omnisight
|
|
107
|
+
cd omnisight
|
|
108
|
+
uv sync --extra ocr
|
|
109
|
+
claude mcp add -s user omnisight -- uv run --directory <path> omnisight
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Environment variables
|
|
113
|
+
|
|
114
|
+
| Variable | Meaning |
|
|
115
|
+
|---|---|
|
|
116
|
+
| `OMNISIGHT_OCR_ENGINE` | `auto` (default: RapidOCR if installed), `rapid` or `windows` |
|
|
117
|
+
| `OMNISIGHT_OCR_LANG` | Language for Windows OCR, such as `zh-Hant-TW` or `en-US` |
|
|
118
|
+
|
|
119
|
+
## What it deliberately does not do
|
|
120
|
+
|
|
121
|
+
- **It does not bypass `SetWindowDisplayAffinity`.** Password managers, banking
|
|
122
|
+
apps and DRM video opt out of capture on purpose. OmniSight says so clearly
|
|
123
|
+
and suggests the element tree, instead of returning a black image the agent
|
|
124
|
+
would retry forever.
|
|
125
|
+
- **It does not evade anti-cheat or anti-bot detection**, and it does not touch
|
|
126
|
+
the UAC secure desktop or the lock screen.
|
|
127
|
+
- **Admin windows:** Windows (UIPI) drops input sent to an elevated window from
|
|
128
|
+
a non-elevated process. OmniSight reports this. To control such a window,
|
|
129
|
+
start the agent from an elevated terminal.
|
|
130
|
+
|
|
131
|
+
## Known limitations
|
|
132
|
+
|
|
133
|
+
- On Windows 10, the WGC backend draws a yellow border around the captured
|
|
134
|
+
window (Windows 11 can turn it off). That is why `printwindow` is tried first
|
|
135
|
+
and WGC is used only when PrintWindow returns a black frame.
|
|
136
|
+
- Minimized windows have no pixels. `snapshot(restore_minimized=true)` restores
|
|
137
|
+
the window without activating it.
|
|
138
|
+
- Background key presses (`background=true`) are reliable for single keys only:
|
|
139
|
+
most apps read the real keyboard state for Ctrl / Alt / Shift.
|
|
140
|
+
- Background clicks work for classic Win32 and WinForms. Chromium and most
|
|
141
|
+
games ignore them; use an element id, or leave `background` off.
|
|
142
|
+
- Chromium and Electron build their accessibility tree only after a client asks
|
|
143
|
+
for it. `snapshot` retries once automatically.
|
|
144
|
+
|
|
145
|
+
## Layout
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
src/omnisight/
|
|
149
|
+
winutil.py window enumeration, DPI awareness, elevation, display affinity
|
|
150
|
+
capture.py capture backend chain, black-frame detection, WGC session pool
|
|
151
|
+
uia.py UI Automation tree (one cache request) and actions
|
|
152
|
+
ocr.py RapidOCR / Windows OCR
|
|
153
|
+
inputs.py SendInput and background message input
|
|
154
|
+
server.py MCP tools
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Development
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
uv sync --extra ocr --group dev
|
|
161
|
+
uv run pytest
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## License
|
|
165
|
+
|
|
166
|
+
[Apache-2.0](https://github.com/Alex20090906/omnisight/blob/main/LICENSE)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "omnisight"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "Computer-use backend (MCP server) that sees and drives any Windows app window: GPU-rendered, covered or in the background."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "Apache-2.0"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
keywords = [
|
|
9
|
+
"mcp",
|
|
10
|
+
"computer-use",
|
|
11
|
+
"agents",
|
|
12
|
+
"windows",
|
|
13
|
+
"ui-automation",
|
|
14
|
+
"screen-capture",
|
|
15
|
+
"ocr",
|
|
16
|
+
]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 3 - Alpha",
|
|
19
|
+
"Environment :: Win32 (MS Windows)",
|
|
20
|
+
"Intended Audience :: Developers",
|
|
21
|
+
"Operating System :: Microsoft :: Windows :: Windows 10",
|
|
22
|
+
"Operating System :: Microsoft :: Windows :: Windows 11",
|
|
23
|
+
"Programming Language :: Python :: 3",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Topic :: Desktop Environment",
|
|
26
|
+
"Topic :: Software Development :: Testing",
|
|
27
|
+
]
|
|
28
|
+
requires-python = ">=3.12"
|
|
29
|
+
dependencies = [
|
|
30
|
+
"comtypes>=1.5.0",
|
|
31
|
+
"mcp[cli]>=2.3.0",
|
|
32
|
+
"mss>=10.2.0",
|
|
33
|
+
"numpy>=2.5.4",
|
|
34
|
+
"pillow>=13.0.0",
|
|
35
|
+
"uiautomation>=2.0.29",
|
|
36
|
+
"windows-capture>=2.0.1",
|
|
37
|
+
"winrt-windows-foundation>=4!10.0.28000.2957",
|
|
38
|
+
"winrt-windows-foundation-collections>=4!10.0.28000.2957",
|
|
39
|
+
"winrt-windows-globalization>=4!10.0.28000.2957",
|
|
40
|
+
"winrt-windows-graphics-imaging>=4!10.0.28000.2957",
|
|
41
|
+
"winrt-windows-media-ocr>=4!10.0.28000.2957",
|
|
42
|
+
"winrt-windows-storage-streams>=4!10.0.28000.2957",
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
[[project.authors]]
|
|
46
|
+
name = "Xiao-Chien Lin"
|
|
47
|
+
email = "356159129+Alex20090906@users.noreply.github.com"
|
|
48
|
+
|
|
49
|
+
[project.urls]
|
|
50
|
+
Homepage = "https://github.com/Alex20090906/omnisight"
|
|
51
|
+
Issues = "https://github.com/Alex20090906/omnisight/issues"
|
|
52
|
+
|
|
53
|
+
[project.scripts]
|
|
54
|
+
omnisight = "omnisight.server:main"
|
|
55
|
+
|
|
56
|
+
[project.optional-dependencies]
|
|
57
|
+
ocr = ["rapidocr-onnxruntime>=1.4.4"]
|
|
58
|
+
|
|
59
|
+
[dependency-groups]
|
|
60
|
+
dev = ["pytest>=9.2.0"]
|
|
61
|
+
|
|
62
|
+
[build-system]
|
|
63
|
+
requires = ["uv_build>=0.11.25,<0.12.0"]
|
|
64
|
+
build-backend = "uv_build"
|