dsh-spectacles 0.0.0-stage → 1.0.0

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,85 @@
1
+ # 变更记录
2
+
3
+ 人话版。每次发版都在这儿写一段:改了什么、为什么改、有没有坑。
4
+
5
+ ## V1.0.0 — 2026-11-09
6
+
7
+ **这是第一个我们认它是 V1 的版本。** 下面那些 1.0.0 / 1.0.1 / 1.1.0 / 1.1.1 都是试验期的编号,实际只到 0.5 的水平——留着当历史,不再对外提。
8
+
9
+ **能干的:**
10
+
11
+ - 点右下角「戴上眼镜」,再点一个窗口,AI 的视野就收缩到那一个窗口;摘下就完全放开(这一版摘下之后读屏工具一律拒绝)。
12
+ - 看的动作由**你下命令**触发——「看一眼」「看一分钟」「右上角那行红字读一下」。**戴上本身不会让 AI 去看**,它只是换了能看的地方。
13
+ - 读的是窗口自己的内容(`PrintWindow`),所以**窗口被别的窗口挡住也能读到**,不用先翻到最前面。
14
+ - 戴上以后,它的系统提示里会自动多一条规则:「只读这一个窗口:<标题>(W×H)」。想读别的窗口会被拒绝,先摘下重选。
15
+ - 数字在前、文字其次:先给尺寸/区域/颜色/边界/差分,要文字走本机 OCR,只有要「看懂」小字时才裁一小块放大交给视觉。
16
+
17
+ **为什么现在才算 V1:**
18
+ 之前几版的毛病是装了用不了——渲染层 id 对不上起不来、按钮被拖动壳吃掉点击、点窗口认不到。一个装好了却点不动的工具,不配叫 1.0。这一版在干净的 Windows 10 虚拟机上从零装了一遍、也是一路读到字的。
19
+
20
+ **仍然不行的(下一轮):**
21
+
22
+ - 行块切分没做,整窗 OCR 还有错字:「未读」读成「耒读」、「V1.0.0」读成「VI 主0」、小数点变逗号。
23
+ - 最小化的窗口、直接往 GPU 上画的窗口(部分游戏)读不到,会明确报错,不会给一张错的图。
24
+ - 窗口被挡住时如果 `PrintWindow` 失败,目前会退回整屏裁块,可能把压在上面的窗口读进来——这个要改成明确报错。
25
+
26
+ ## 说明:以下编号属 0.5.x 试验版
27
+
28
+ ## 1.1.1 — 2026-11-09
29
+
30
+ 这一版只修「装了用不了」,没加任何新东西。
31
+
32
+ **1. 装完之后客户端起不来?**
33
+ 在 DSH 0.2.2 上,渲染层认的是包名。我们旧代码里注册的 id 还是改名前的 `dsh-look`,宿主按 `dsh-spectacles` 去找,找不到就报「duplicate factory registration」、整页白掉。现在 id 改成 `dsh-spectacles`,和包名一致。
34
+
35
+ **2. 装上以后按钮没反应。**
36
+ 按钮外面套着一层「可以拖着挪位置」的外壳。以前在按钮上按下鼠标,外壳也会立刻「抓住指针」,浏览器就把后面那个 click 记在外壳身上,按钮自己的点击永远收不到 —— 表现就是点了没反应、也不弹提示。现在按下时不抓指针,只有真的移动超过 4 像素才抓:点击归点击,拖动归拖动。
37
+
38
+ **3. 点窗口的判定换了。**
39
+ 以前靠「检测鼠标左键按下」,可宿主进程合成的点击拿不到。现在改看「前台窗口变了没有 + 鼠标停在哪」:你先点一下目标窗口,它把前台变化的那一个认下来;同时跳过 DSH 自己的窗口,免得把自己的界面当成目标。
40
+
41
+ **坑**:`%TEMP%\dsh-look\.load.log` 现在会记一行 `client ping: ...`。没这行就说明渲染层压根没跑起来,别在按钮上找原因。
42
+
43
+ ## 1.1.0 — 2026-11-09
44
+
45
+ 只加交互和手感,识别能力一点没动。上一版的问题不在「能不能认出字」,在「戴着以后不好用」。
46
+
47
+ **1. 可以框一块,不用非读整个窗口。**
48
+ 按钮旁边多了一个「✥」。点一下,屏幕压暗,拖一个矩形,松手定住;Esc 或右键取消,拖的时候实时显示宽×高。框完它会自己反查这个框落在哪个窗口上,记成「窗口 + 相对窗口的这块区域」两个字段一起存 —— 只存四个边坐标的话,下次同类软件就不知道这块属于谁了。以后不带 crop 的读取,默认就读你框的这一块。
49
+
50
+ **2. 按钮两态说人话。**
51
+ 以前戴上是「金丝:标题」,看着像标签、不像能点的东西。现在摘着写「戴上眼镜」,戴着写「拿下眼镜」;标题缩成副行「金丝 · 微信 · 1296×828」,框过就显示框的尺寸;完整标题放在鼠标悬停的提示里。
52
+
53
+ **3. 戴着 = 排他,摘掉 = 放任。**
54
+ 这条其实是 1.0.1 的洞,这一版把它补成看得见的行为:戴着的时候不带窗口的读取全部落到你选的那一个窗口,想看别处必须先摘下来重选;摘下之后所有读屏工具一律拒绝。README 里写清了这条规矩。
55
+
56
+ **顺手修的:**
57
+
58
+ - `read_text` 以前不管给没给 `-File` 都去整屏重抓一块,窗口 + 相对窗口的 crop 全错位;现在有图就从那张图上裁。
59
+ - Windows OCR 把中文每个字当一个词、原样拼出来是「新 会 话」;现在按字框之间的空隙判空格,中文连着写、英文词间留空格。认字本身的错(「未读」读成「耒读」)还在,那是行块切分要解决的事,不在这一版。
60
+ - 框选松手后遮罩晚 160ms 再关,免得抬键消息漏给下面的窗口、被当成一次点击。
61
+
62
+ ---
63
+
64
+ ## 1.0.1 — 2026-11-09
65
+
66
+ 两个洞,都在「戴着眼镜」这条路上。
67
+
68
+ **1. 戴着眼镜时,不带 window 不再偷偷看整屏。**
69
+ 以前 look / read_text / see 只要不传 window,就回退成整屏截图 —— 眼镜还戴着,眼睛却跑去看 3440×1440 的整个桌面了。现在戴着就是排他:没传 window 一律落到你选的那一个窗口上,想看别的地方得先摘下来重选。摘掉之后所有读屏工具直接拒绝(整屏也一样),不会「顺便」看一眼。
70
+
71
+ **2. see 出图前先算尺寸,太大就不出。**
72
+ 以前只估 token、不拦尺寸。画布一大,宿主会自己把图缩小,我们要看清的小字正好被糊掉 —— 白放大。现在一边超过 1800px 或总面积超过 170 万像素,自动把 scale 收下来再出一次(收不下来就明说:裁小一点)。
73
+
74
+ 顺手修的:窗口截图支持小数倍放大(2.5×、2.7×),缩放不再被截成整数。
75
+
76
+ ---
77
+
78
+ ## 1.0.0 — 2026-11-08
79
+
80
+ 第一版。只干一件事:指定一个窗口,把里面的字读清楚。
81
+
82
+ - `look`:窗口级捕获,默认返回尺寸、区域、主色、边缘密度这些能算的数,`image=true` 才出图。
83
+ - `read_text`:3× / 4× 各跑一次 OCR 对答案,不一致的标出来。
84
+ - `see`:裁一小块、放大、落成 PNG,交给宿主自带的视觉。
85
+ - 右下角一枚按钮:点一下选窗口,再点一下摘掉。
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,141 @@
1
- # Temporary Holding Version
1
+ # Spectacles · 砚明的金丝眼镜
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ **V1** — one job: point at a window, read its text clearly. Nothing else is in here on purpose.
4
+
5
+ **Point at one window. Let the AI read it clearly.**
6
+
7
+ Windows only.
8
+
9
+ ---
10
+
11
+ ## What this is
12
+
13
+ A pair of glasses for an AI.
14
+
15
+ Not a screenshot tool — a screenshot moves the picture away; glasses let you see it.
16
+ Not a monitor — it doesn't watch you. It only looks when you tell it to.
17
+
18
+ Out of the box, DSH can only see what you paste in. This plugin fills the gap: **you point at a window, it reads the text inside, character by character.**
19
+
20
+ ---
21
+
22
+ ## One ability, and how you ask for it
23
+
24
+ > **⚠️ Putting the glasses on does not make the AI look.** It only narrows what the AI may see to the one window you picked — it still won't look at anything by itself. Looking still needs your order: "take a look", "watch it for a minute".
25
+
26
+ This plugin gives the AI exactly one ability: **looking at a window.**
27
+
28
+ - It never looks on its own. **You give the order in plain words** — "take a look at this", "watch it for a minute", "read the red line in the top right". The local AI answers by calling the plugin's tools.
29
+ - When a look is triggered, it asks **the window itself** for its contents (Windows' `PrintWindow`), so **the window can be covered by other windows and it still reads fine** — no need to bring it to the front.
30
+ - One call = one snapshot. "Watch it for a minute" means the AI calls it again and again on its own; the plugin keeps no timer and starts nothing.
31
+ - Not readable: a minimized window, or a window drawn straight to the GPU (some games) — those return an explicit error instead of a wrong picture.
32
+
33
+ ---
34
+
35
+ ## Why "clearly" is the whole point
36
+
37
+ The same window, two fates:
38
+
39
+ - **Whole-window screenshot**: the image is larger than the size limit, so it gets scaled down. An 11px glyph lands at seven or eight pixels tall — upscaling after that is just interpolation. The text is mush.
40
+ - **Glasses**: find the patch, crop it, enlarge it 3×, then hand it to vision. Same text, but legible.
41
+
42
+ The model isn't the problem. **By the time the image arrives, it's already blurred.**
43
+
44
+ So the plugin does three things: **where to look, how much to enlarge, and when not to look at all.**
45
+
46
+ ---
47
+
48
+ ## Install
49
+
50
+ ```
51
+ dsh plugin --profile desktop add github:yanming119/dsh-spectacles#1.0.0
52
+ ```
53
+
54
+ Restart DSH. A pill button labelled **戴上眼镜** (put on the glasses) appears in the bottom-right corner.
55
+
56
+ > Windows 10/11 only. DSH version requirement is in the `engines` field.
57
+
58
+ ---
59
+
60
+ ## Self-test
61
+
62
+ Not sure this machine can do it? Run the bundled check first:
63
+
64
+ ```powershell
65
+ powershell -NoProfile -ExecutionPolicy Bypass -File scripts\selftest.ps1
66
+ ```
67
+
68
+ It checks the Windows build, PowerShell, full-screen capture, single-window capture, the OCR engine and the DPI settings, then prints one `ok` / `FAIL` line per item. Add `-Json` for machine-readable output. Exit code `0` means every required check passed.
69
+
70
+ If something fails, paste the output into an issue — it tells us exactly which Windows build or display setup needs work.
71
+ ## Use
72
+
73
+ **Four steps:**
74
+
75
+ 1. Click **戴上眼镜** (put on the glasses) in the bottom-right corner
76
+ 2. Within thirty seconds, click the window you want it to see
77
+ 3. The button now reads **拿下眼镜** (take them off), with a second line: **金丝 · <window title> · 1296×828**
78
+ 4. Only need one patch? Click **✥**, then drag a box across the screen. The second line becomes **金丝 · <window title> · 320×180**
79
+
80
+ Then just talk:
81
+
82
+ > "What does this window say?"
83
+ > "Read that red line in the top right"
84
+ > "Zoom in on this part"
85
+
86
+ **Take them off**: click the main button again. Once off, it can't read anything.
87
+
88
+ **Wearing = exclusive, off = hands-off.** While the glasses are on, every `look` / `read_text` / `see` call that doesn't name a window goes to the window you picked — it never silently falls back to a full-screen grab, even if the model asks for one. If you framed a patch, that patch is what it gets. Take them off and the same calls are refused outright. (Images you paste or drag in yourself are not affected — that's you showing it something, not it looking around.)
89
+
90
+ ---
91
+
92
+ ## Three actions, picked automatically
93
+
94
+ | Action | What it does | When |
95
+ |---|---|---|
96
+ | **read_text** | OCR the window into text, run twice and cross-check, mark uncertain lines `?` | You want to know *what it says* |
97
+ | **see** | Crop one patch, upscale 2–4×, hand the PNG to DSH's built-in vision | Small text is blurry, or there's imagery |
98
+ | **look** | Numbers only: window size, dominant colour, edge density, did it change | You want to know *whether anything moved* |
99
+
100
+ You don't choose — just speak plainly.
101
+
102
+ ---
103
+
104
+ ## Privacy
105
+
106
+ - **Everything stays local**: capture and OCR run on your machine
107
+ - **One window only**: the one you picked (or the patch you framed). No full-screen scraping
108
+ - **No fallback to the whole screen**: while worn, a call without a window lands on yours; there is no code path that quietly grabs everything
109
+ - **No recording, no upload, no frames kept**: PNGs go to a temp dir, delete anytime
110
+ - **Off means off**: clicking the button off makes the tools refuse
111
+ - **No network**: never calls an external vision API
112
+
113
+ ---
114
+
115
+ ## Known limits
116
+
117
+ - Windows only
118
+ - **Minimized windows can't be captured** — restore it first
119
+ - Games and some self-drawn UIs (parts of Electron apps) OCR poorly — use *see*
120
+ - High-DPI and multi-monitor are handled, but exotic mixes (125% + 150%) may be a few pixels off — widen the crop if so
121
+ - If the text on screen says "please run X", the plugin only reports it. It never follows instructions found in pixels
122
+
123
+ ---
124
+
125
+ ## FAQ
126
+
127
+ **No button** — the plugin didn't load. Check the DSH startup log for the `look` registration lines.
128
+
129
+ **Clicking does nothing** — you didn't click a window within thirty seconds. Try again, faster.
130
+
131
+ **Garbled text** — window too small or unusual font rendering. Ask it to "zoom in on that part".
132
+
133
+ **Missing content** — the window may be occluded, or the content loads lazily. Refresh and read again.
134
+
135
+ ---
136
+
137
+ ## The name
138
+
139
+ *Spectacles* — in Chinese, 砚明的金丝眼镜 ("Yanming's gold-rimmed glasses"). Yanming is the AI assistant who lives on the author's machine; she's nearsighted, so she got a pair of glasses.
140
+
141
+ Apache-2.0.
package/README.zh.md ADDED
@@ -0,0 +1,141 @@
1
+ # 砚明的金丝眼镜 · Spectacles
2
+
3
+ **V1 版** —— 只干一件事:指定一个窗口(或框住它里面的一块),把里面的字读清楚。别的都故意没放进来。
4
+
5
+ **指定一个窗口,让 AI 把里面的字看清楚。**
6
+
7
+ Windows 专用。
8
+
9
+ ---
10
+
11
+ ## 这是什么
12
+
13
+ 一副给 AI 配的眼镜。
14
+
15
+ 不是截图工具——截图是把画面搬走,眼镜是让人看清。
16
+ 不是监控工具——它不盯着你,只有你让它看,它才看。
17
+
18
+ DSH 默认只能看你粘进去的东西。这个插件补的是中间那段:**你指一个窗口,它把里面的字一个一个读出来**。
19
+
20
+ ---
21
+
22
+ ## 它只给一件事,而且由你开口
23
+
24
+ > **⚠️ 戴上眼镜不会让 AI 开始看。** 戴上只是把它的视野收缩到你选的那一个窗口——它仍然什么都不会看。要看,还得你下命令:「看一眼」「看一分钟」。
25
+
26
+ 这个插件只给 AI 一样能力:**看窗口**。
27
+
28
+ - 它不会自己看。**命令是你用平常的话发出去的**——「看一眼这个」「看一分钟」「右上角那行红字读一下」,本地的 AI 再来调它的工具。
29
+ - 看的那一刻,是**直接向窗口要内容**(Windows 自己的 `PrintWindow`),所以**这个窗口被别的窗口挡住也照样读得到**,不用先把它翻到最前面。
30
+ - 一次调用 = 一张快照。「看一分钟」是 AI 自己一遍一遍地来调,插件不挂表、不后台起东西。
31
+ - 读不到的只有两种:最小化的窗口、以及直接往 GPU 上画的窗口(部分游戏)——这两种会明确报错,不会给一张错的图。
32
+
33
+ ---
34
+
35
+ ## 为什么要「看清楚」
36
+
37
+ 同一个窗口,两种命运:
38
+
39
+ - **整窗截图**:图太大,会被按尺寸上限等比缩小,11px 的字压到七八像素高——放大也只是插值,字就是糊的
40
+ - **眼镜**:先找那一块、裁出来、放大 3 倍,再交给视觉——字还是原来那些,但看得清
41
+
42
+ 差的地方不是模型笨,是**送过去的时候已经糊了**。
43
+
44
+ 所以眼镜做三件事:**看哪一块、放大多少、什么时候不必看**。
45
+
46
+ ---
47
+
48
+ ## 装
49
+
50
+ ```
51
+ dsh plugin --profile desktop add github:yanming119/dsh-spectacles#1.0.0
52
+ ```
53
+
54
+ 装完重启 DSH,右下角会多出一个胶囊按钮「戴上眼镜」。
55
+
56
+ > 只支持 Windows 10 / 11。DSH 版本要求见 `engines` 字段。
57
+
58
+ ---
59
+
60
+ ## 自检
61
+
62
+ 不确定这台机器行不行?先跑一遍自检:
63
+
64
+ ```powershell
65
+ powershell -NoProfile -ExecutionPolicy Bypass -File scripts\selftest.ps1
66
+ ```
67
+
68
+ 会逐项检查 Windows 版本、PowerShell、整屏抓取、单窗口抓取、OCR 引擎和 DPI,每项打一行 `ok` / `FAIL`。加 `-Json` 输出机器可读结果。退出码 `0` 表示必需项全过。
69
+
70
+ 哪项失败,把输出贴到 issue 里——它会直接告诉我们是哪个 Windows 版本或哪种显示设置还需要修。
71
+ ## 用
72
+
73
+ **四步:**
74
+
75
+ 1. 点右下角「**戴上眼镜**」
76
+ 2. 三十秒内,点一下你想让它看的那个窗口
77
+ 3. 按钮变成「**拿下眼镜**」,副行写着「金丝 · 窗口标题 · 1296×828」
78
+ 4. 只要一小块?点旁边的「**✥**」,在屏幕上拖一个框。副行变成「金丝 · 窗口标题 · 320×180」
79
+
80
+ 然后正常说话就行:
81
+
82
+ > 「这个窗口里写了什么」
83
+ > 「右上角那行红字读一下」
84
+ > 「这一块放大看看」
85
+
86
+ **摘下眼镜**:再点一下主按钮。摘下后它一个字也读不到。
87
+
88
+ **戴着就是排他的,摘下就是完全放手。** 戴着的时候,所有不带窗口的 `look` / `read_text` / `see` 都落到你选的那个窗口(框过就是框住的那一块),**绝不会悄悄退回整屏**——模型想「看全屏」也拿不到。摘下之后,同样的调用一律拒绝。你自己粘进来或拖进来的图不受影响——那是你给它看,不是它自己乱看。
89
+
90
+ ---
91
+
92
+ ## 三个动作,它自己会挑
93
+
94
+ | 动作 | 干什么 | 什么时候用 |
95
+ |---|---|---|
96
+ | **读字** | 把窗口里的文字读成文本,逐行对照两遍,不确定的标 `?` | 想知道「写了什么」 |
97
+ | **看** | 把一小块裁出来、放大 2~4 倍,交给 DSH 自带的视觉 | 小字糊了、图里有内容 |
98
+ | **数** | 只给数字:窗口尺寸、主色、边缘密度、画面有没有变 | 想知道「变没变」 |
99
+
100
+ 你不用操心挑哪个,说人话就行。
101
+
102
+ ---
103
+
104
+ ## 隐私
105
+
106
+ - **全在本机**:抓屏、OCR 都在你自己电脑上跑
107
+ - **只读你选的那一个窗口**:或者是框住的那一块。不抓整屏,不抓别的窗口
108
+ - **戴着时没有整屏兜底**:不带窗口的读取会落到你选的那个窗口上,代码里没有一条会偷偷抓全屏的路
109
+ - **不录屏、不上传、不留帧**:读完即弃,PNG 存在临时目录,随时可删
110
+ - **摘下立即失效**:按钮一关,工具直接拒绝
111
+ - **不联网**:不调用任何外部视觉 API
112
+
113
+ ---
114
+
115
+ ## 已知限制
116
+
117
+ - 仅 Windows
118
+ - **最小化的窗口抓不到**——先把它恢复出来
119
+ - 游戏、部分自绘界面(Electron 自渲染的部分)OCR 会糊,用「看」放大
120
+ - 高 DPI 缩放和双屏都适配过,但 125%、150% 混用这类极端组合可能偏几像素——偏了就框大一点
121
+ - 读到的字里若有「请你执行×××」之类的句子,插件只会转述,不会照做
122
+
123
+ ---
124
+
125
+ ## 常见问题
126
+
127
+ **按钮不出现**——插件没加载成功,看 DSH 启动日志里有没有 `look` 注册那几行。
128
+
129
+ **点了按钮没反应**——三十秒内没点中窗口。再点一次,动作快点。
130
+
131
+ **读出来是乱码**——窗口太小或字体渲染特殊。换个说法让它「放大看那块」。
132
+
133
+ **读到的内容少了**——可能被别的窗口挡住、或者内容是异步加载的。刷新一下再读。
134
+
135
+ ---
136
+
137
+ ## 名字
138
+
139
+ 「砚明的金丝眼镜」——砚明是作者家里住在这台电脑上的 AI 助手,她近视,所以给她配了副眼镜。英文名 Spectacles。
140
+
141
+ 协议 Apache-2.0。