dsh-windows-parallel-mcp 0.5.0 → 0.6.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.de.md +7 -1
- package/CHANGELOG.es.md +7 -1
- package/CHANGELOG.fr.md +7 -1
- package/CHANGELOG.it.md +7 -1
- package/CHANGELOG.ja.md +6 -0
- package/CHANGELOG.ko.md +6 -0
- package/CHANGELOG.md +82 -3
- package/CHANGELOG.pt.md +7 -1
- package/CHANGELOG.ru.md +7 -1
- package/CHANGELOG.zh.md +6 -0
- package/README.de.md +94 -5
- package/README.es.md +94 -5
- package/README.fr.md +94 -5
- package/README.it.md +94 -5
- package/README.ja.md +94 -5
- package/README.ko.md +94 -5
- package/README.md +94 -5
- package/README.pt.md +94 -5
- package/README.ru.md +94 -5
- package/README.zh.md +94 -5
- package/dsh.plugin.json +2 -2
- package/lib/host-tools.js +15 -0
- package/lib/index.js +25 -6
- package/package.json +2 -2
- package/src/engine/engine.ps1 +159 -4
- package/src/engine/win.ps1 +230 -6
- package/src/engine/worker.ps1 +5 -0
- package/src/schema/tools.json +3 -1
- package/types/index.d.ts +29 -2
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# dsh-windows-parallel-mcp
|
|
2
2
|
|
|
3
3
|
**English** · [中文](README.zh.md) · [日本語](README.ja.md) · [한국어](README.ko.md) · [Français](README.fr.md) · [Deutsch](README.de.md) · [Italiano](README.it.md) · [Español](README.es.md) · [Português](README.pt.md) · [Русский](README.ru.md)
|
|
4
|
-
> **Current release: 0.
|
|
4
|
+
> **Current release: 0.6.0** — this document describes the contract as of that version. What
|
|
5
5
|
> changed in it, and in every version before it, is in [CHANGELOG.md](CHANGELOG.md), newest first.
|
|
6
6
|
|
|
7
7
|
A DSH plugin that lets an agent drive **its own** Windows windows — quietly by default, and visibly
|
|
@@ -90,7 +90,7 @@ Image coordinates are never multiplied by the caller:
|
|
|
90
90
|
|
|
91
91
|
```jsonc
|
|
92
92
|
{"action":"screenshot","hwnd":"1310720"}
|
|
93
|
-
// -> screenRect=0,0,1920,1032 imageSize=1920x1032 scale=1 identity=true frame=dwm
|
|
93
|
+
// -> screenRect=0,0,1920,1032 imageSize=1920x1032 scale=1 identity=true frame=dwm captureBackend=bitblt
|
|
94
94
|
{"action":"click","hwnd":"1310720","space":"image","shotId":"shot-…","x":350,"y":250}
|
|
95
95
|
// the ENGINE converts, then still asserts the point belongs to the target window
|
|
96
96
|
```
|
|
@@ -120,6 +120,23 @@ point at would be a trap), the frame is cross-checked against the window rect th
|
|
|
120
120
|
(`frameCheck=pass|fail|unknown`), and a structural gate pins the single-source rule by mutating a copy
|
|
121
121
|
of the engine and requiring the corresponding red.
|
|
122
122
|
|
|
123
|
+
### Which capture path painted the picture
|
|
124
|
+
|
|
125
|
+
`captureBackend` names the producer: `bitblt` is a direct GDI `BitBlt` off the screen DC, `gdiplus` is
|
|
126
|
+
`Graphics.CopyFromScreen` — either the fallback after BitBlt was refused, or nothing else. The cheap
|
|
127
|
+
path replaced the old one on measured grounds (16–21 ms against 22–33 ms for a 1920×1080 grab), and the
|
|
128
|
+
encoder was deliberately left alone: the PNG encode is the bottleneck (37–39 ms), so JPEG (6 ms, and it
|
|
129
|
+
smears text), WIC (158 ms) and 24bpp (7 % smaller) were each measured and each rejected.
|
|
130
|
+
|
|
131
|
+
Equivalence was established on a **static** scene, not by file hash — two captures of a live desktop
|
|
132
|
+
happen at different instants, so their bytes cannot match, and that difference says nothing about the
|
|
133
|
+
paths: identical size, both non-blank, **0 maximum per-channel difference over 17 388 sampled points**,
|
|
134
|
+
byte-identical PNGs (8940 = 8940), with the comparator's self-check (two reads of one HBITMAP) also at
|
|
135
|
+
0. The one difference is reported rather than assumed away: `FromHbitmap` yields `Format32bppRgb` where
|
|
136
|
+
`CopyFromScreen` yields `Format32bppArgb`. A gate keeps both halves honest — the fallback reachable and
|
|
137
|
+
`captureBackend` produced, forwarded and printed (`scripts/check-shot-backend.mjs`, seven mutations each
|
|
138
|
+
seen red).
|
|
139
|
+
|
|
123
140
|
### Deciding outside the main context
|
|
124
141
|
|
|
125
142
|
The expensive habit this replaces is re-reading a 70-row table on every step. Hand the frame to a
|
|
@@ -154,7 +171,7 @@ reported rather than accused — but `cursorRestored=false` (borrowed and not re
|
|
|
154
171
|
`proof=fail`.
|
|
155
172
|
|
|
156
173
|
**And it says who reported the success.** Every action result carries `effect=` in the text and
|
|
157
|
-
`effect` in the structured output. The
|
|
174
|
+
`effect` in the structured output. The four values are not degrees of confidence in the
|
|
158
175
|
application — they name the speaker:
|
|
159
176
|
|
|
160
177
|
| `effect` | who is speaking | it proves | it does **not** prove |
|
|
@@ -162,6 +179,7 @@ application — they name the speaker:
|
|
|
162
179
|
| `unverified` | nobody | nothing | anything |
|
|
163
180
|
| `reported-by-send` | the window-message channel | the message was **delivered** | that the target app processed it |
|
|
164
181
|
| `reported-by-pattern` | the UI Automation pattern call | the call **returned** without throwing | that the interface actually changed |
|
|
182
|
+
| `readback-verified` | the control itself, read back | the value now in the field **equals the value predicted from the field's own measurements** | that the app is *happy* — only that its value is what we said |
|
|
165
183
|
|
|
166
184
|
Since 0.1.3 the effect also enters the judgment, which closes the one honest gap 0.1.2 still had:
|
|
167
185
|
a still desktop could outvote a total no-op. A call whose channel reported nothing is capped at
|
|
@@ -171,6 +189,49 @@ disturb you; it never proves we accomplished anything. A single `reported-by-*`
|
|
|
171
189
|
the caveat spelled out in the reason field (`未独立验证` — nobody observed the app), because turning
|
|
172
190
|
weak-but-real evidence into a red would train its readers to ignore the verdict.
|
|
173
191
|
|
|
192
|
+
### The fourth value has to be earned (0.6.0)
|
|
193
|
+
|
|
194
|
+
`readback-verified` is granted only by the engine, and only when a **prediction** matches a **read**.
|
|
195
|
+
The prediction is computed from measurements the control itself reported — the value it held before,
|
|
196
|
+
its own `WM_GETTEXTLENGTH`, its own `EM_GETSEL` answer for where a typed character lands — and the read
|
|
197
|
+
happens *after* the settle window, so an app that commits its text asynchronously is not judged against
|
|
198
|
+
a half-written buffer:
|
|
199
|
+
|
|
200
|
+
```jsonc
|
|
201
|
+
{"action":"type","hwnd":"…","text":"XY","caretPosition":"start"}
|
|
202
|
+
// -> type ok channel=message tier=quiet effect=readback-verified
|
|
203
|
+
// detail=msg=char|2 child=… caret=start asked=0 applied=0,0 readback=XYabc readbackLen=5 focusMoved=false
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
Three things it refuses to do, each measured rather than assumed:
|
|
207
|
+
|
|
208
|
+
* **it does not upgrade what it cannot read.** A masked field (`ES_PASSWORD`) returns an empty string
|
|
209
|
+
while `WM_GETTEXTLENGTH` still reports the real length. That is "the control hides its text", not
|
|
210
|
+
"the field is empty": the result says `readback=unavailable`, the effect keeps whatever the write
|
|
211
|
+
earned, and no value is printed anywhere.
|
|
212
|
+
* **a mismatch is data, not a failure.** A read-only WinForms edit silently refuses `WM_CHAR` — every
|
|
213
|
+
character is accepted by the API and the value never moves — while honouring `WM_SETTEXT`. On the
|
|
214
|
+
refusal the result is still `ok:true` with `readbackMismatch=true` and no upgrade; on the write that
|
|
215
|
+
lands it is `readback-verified`. No refusal code changed for this batch, on purpose: "the application
|
|
216
|
+
formatted my input" is not an error in the call. `test/readback-truth.mjs` asserts both arms against
|
|
217
|
+
the value the *application* wrote about itself, from inside its own process — a readback test that
|
|
218
|
+
compared our write to our read would be grading homework in our own class, and this repo has already
|
|
219
|
+
been caught doing exactly that.
|
|
220
|
+
* **the naive guess is not the model.** Text is not appended: it lands at the caret, and a field that
|
|
221
|
+
never held focus has its caret at 0 (so `abc` + `XY` is `XYabc`). That is why `caretPosition` exists
|
|
222
|
+
and why the result prints `asked=` and `applied=` separately — `EM_SETSEL(-1,-1)` is documented as
|
|
223
|
+
"document end" and measured as a no-op on WinForms EDIT, so `end` is `EM_SETSEL(len,len)` with `len`
|
|
224
|
+
read from the control. On a buffer containing newlines that numeric end can land inside the text
|
|
225
|
+
(`asked=6 applied=4,4`), which is reported instead of hidden; `idle` touches nothing at all. The UIA
|
|
226
|
+
`value` channel replaces the whole value and has no caret to move, so it answers
|
|
227
|
+
`caretIgnored=value-pattern` rather than pretending to honour it.
|
|
228
|
+
|
|
229
|
+
Two more facts ride in the same `detail`, both warnings and neither a refusal: `focusMoved=true` when
|
|
230
|
+
the foreground or the focused control differs between the two measurements taken around the send, and
|
|
231
|
+
`disabled=true` for a target window that is greyed out — Windows keeps answering our messages while
|
|
232
|
+
throwing the input away, so a disabled target loses the right to an `effect` claim
|
|
233
|
+
(`effect=unverified`) without becoming an error.
|
|
234
|
+
|
|
174
235
|
## The takeover tier (opt-in)
|
|
175
236
|
|
|
176
237
|
Off by default (`takeoverAllowed=false`, `keyInjectAllowed=false`), because moving someone's pointer
|
|
@@ -249,8 +310,9 @@ degradation.
|
|
|
249
310
|
## Typed surface
|
|
250
311
|
|
|
251
312
|
`types/index.d.ts` is written by hand, not emitted from an implementation. It covers the whole
|
|
252
|
-
contract: the eight actions, every argument including the takeover fields
|
|
253
|
-
|
|
313
|
+
contract: the eight actions, every argument including the takeover fields, the image-space / label
|
|
314
|
+
surface and 0.6.0's `caretPosition`, all fourteen refusal codes as a closed union, and `effect` as its
|
|
315
|
+
own four-value union (`WpmEffect`) beside `WpmCaptureBackend` and `WpmFrameSource`.
|
|
254
316
|
|
|
255
317
|
Its wiring is measured in both resolution modes a consumer can use, rather than assumed from the
|
|
256
318
|
presence of a file:
|
|
@@ -346,6 +408,33 @@ unmeasured end-to-end and is stated as such in [docs/refusals.md](docs/refusals.
|
|
|
346
408
|
`WindowFromPoint` no longer returning the HUD, and `HTCLIENT` on the button. That is what
|
|
347
409
|
`hud.ps1` ships.
|
|
348
410
|
|
|
411
|
+
### 0.6.0's measurements (all re-runnable, probe scripts under `.tmp/` in the repository)
|
|
412
|
+
|
|
413
|
+
- **The read-back exists and is truthful** — three window classes (`Edit`,
|
|
414
|
+
`WindowsForms10.EDIT.app.*`, `WindowsForms10.RichEdit20W.app.*`) all return the written value through
|
|
415
|
+
`WM_GETTEXT` cross-process, and in four cases the value equals what the *application* reported about
|
|
416
|
+
itself from inside its own process (168–241 ms to observe, on the app's 400 ms timer).
|
|
417
|
+
- **A password field reports a length but no text** — `ES_PASSWORD`: `WM_GETTEXT` returns the empty
|
|
418
|
+
string while `WM_GETTEXTLENGTH` returns the real length. Hence `readback=unavailable`, never "empty".
|
|
419
|
+
- **`EM_SETSEL(-1,-1)` does not mean "the end" on WinForms EDIT** — the selection stayed `0,0` and the
|
|
420
|
+
typed character went to the front; `EM_SETSEL(len,len)` gave `abcY`. On a buffer holding `CRLF` the
|
|
421
|
+
numeric end landed at `4,4` for a reported length of `6` — measured, therefore reported as
|
|
422
|
+
`asked=`/`applied=` rather than papered over. A plain Win32 `EDIT` that never held focus accepts every
|
|
423
|
+
`WM_CHAR` and changes nothing, even with `ES_NOHIDESEL`: the case the old `reported-by-send` was
|
|
424
|
+
laundering, and the reason this batch exists.
|
|
425
|
+
- **A read-only edit refuses `WM_CHAR` and honours `WM_SETTEXT`** — the falsification arm of
|
|
426
|
+
`test/readback-truth.mjs`, chosen over two candidates that measurement eliminated (a bare `LF` is
|
|
427
|
+
preserved verbatim, so it agrees; WinForms enforces `MaxLength` in its own `WM_CHAR` handler, so a
|
|
428
|
+
programmatic `WM_SETTEXT` bypasses it, as does `EM_SETLIMITTEXT` set from outside).
|
|
429
|
+
- **BitBlt halves the capture and leaves the bottleneck where it is** — 16–21 ms against 22–33 ms for a
|
|
430
|
+
1920×1080 grab, PNG encode 37–39 ms in both paths, capture+encode 12–16 ms on a 642×432 window. JPEG
|
|
431
|
+
(6 ms) and WIC (158 ms) measured and rejected, 24bpp measured at 7 % of the size and rejected.
|
|
432
|
+
- **`replace:true` threw on every target until 0.6.0** — the `WM_SETTEXT` binding was declared as
|
|
433
|
+
`SendMessageStrW`, an export `user32.dll` does not have: the call raised
|
|
434
|
+
`EntryPointNotFoundException` on first use and surfaced as `action_failed`. No test in the repository
|
|
435
|
+
exercised `replace:true` through the message door, which is why the fix ships with an arm that does
|
|
436
|
+
(`test/readback-truth.mjs` A1). Found by running the import instead of trusting its name.
|
|
437
|
+
|
|
349
438
|
## Verifying the copy you actually installed
|
|
350
439
|
|
|
351
440
|
Every test above imports the repository checkout, so a package that installs to the wrong place or ships
|
package/README.pt.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
> Um plugin DSH que permite a um agente controlar **as suas próprias** janelas Windows — silencioso por padrão, visível sob demanda. Quando uma janela aceita mensagens do Windows, o foco nunca é roubado. Quando apenas a Automação de UI a alcança, o foco sofre um único lampejo limitado, revertido automaticamente. Quando você solicita explicitamente o modo takeover, o cursor move-se para o ponto de ação e é sempre restaurado, com um HUD que oferece três formas de interrupção. Em todos os outros casos, recusa com um código e um motivo.
|
|
6
6
|
|
|
7
7
|
> **English canonical text follows.** The localized summary above is the orientation; the text below is the authoritative specification (structure, commands and numbers are identical across all 10 languages).
|
|
8
|
-
> **Current release: 0.
|
|
8
|
+
> **Current release: 0.6.0** — this document describes the contract as of that version. What
|
|
9
9
|
> changed in it, and in every version before it, is in [CHANGELOG.md](CHANGELOG.md), newest first.
|
|
10
10
|
|
|
11
11
|
A DSH plugin that lets an agent drive **its own** Windows windows — quietly by default, and visibly
|
|
@@ -94,7 +94,7 @@ Image coordinates are never multiplied by the caller:
|
|
|
94
94
|
|
|
95
95
|
```jsonc
|
|
96
96
|
{"action":"screenshot","hwnd":"1310720"}
|
|
97
|
-
// -> screenRect=0,0,1920,1032 imageSize=1920x1032 scale=1 identity=true frame=dwm
|
|
97
|
+
// -> screenRect=0,0,1920,1032 imageSize=1920x1032 scale=1 identity=true frame=dwm captureBackend=bitblt
|
|
98
98
|
{"action":"click","hwnd":"1310720","space":"image","shotId":"shot-…","x":350,"y":250}
|
|
99
99
|
// the ENGINE converts, then still asserts the point belongs to the target window
|
|
100
100
|
```
|
|
@@ -124,6 +124,23 @@ point at would be a trap), the frame is cross-checked against the window rect th
|
|
|
124
124
|
(`frameCheck=pass|fail|unknown`), and a structural gate pins the single-source rule by mutating a copy
|
|
125
125
|
of the engine and requiring the corresponding red.
|
|
126
126
|
|
|
127
|
+
### Which capture path painted the picture
|
|
128
|
+
|
|
129
|
+
`captureBackend` names the producer: `bitblt` is a direct GDI `BitBlt` off the screen DC, `gdiplus` is
|
|
130
|
+
`Graphics.CopyFromScreen` — either the fallback after BitBlt was refused, or nothing else. The cheap
|
|
131
|
+
path replaced the old one on measured grounds (16–21 ms against 22–33 ms for a 1920×1080 grab), and the
|
|
132
|
+
encoder was deliberately left alone: the PNG encode is the bottleneck (37–39 ms), so JPEG (6 ms, and it
|
|
133
|
+
smears text), WIC (158 ms) and 24bpp (7 % smaller) were each measured and each rejected.
|
|
134
|
+
|
|
135
|
+
Equivalence was established on a **static** scene, not by file hash — two captures of a live desktop
|
|
136
|
+
happen at different instants, so their bytes cannot match, and that difference says nothing about the
|
|
137
|
+
paths: identical size, both non-blank, **0 maximum per-channel difference over 17 388 sampled points**,
|
|
138
|
+
byte-identical PNGs (8940 = 8940), with the comparator's self-check (two reads of one HBITMAP) also at
|
|
139
|
+
0. The one difference is reported rather than assumed away: `FromHbitmap` yields `Format32bppRgb` where
|
|
140
|
+
`CopyFromScreen` yields `Format32bppArgb`. A gate keeps both halves honest — the fallback reachable and
|
|
141
|
+
`captureBackend` produced, forwarded and printed (`scripts/check-shot-backend.mjs`, seven mutations each
|
|
142
|
+
seen red).
|
|
143
|
+
|
|
127
144
|
### Deciding outside the main context
|
|
128
145
|
|
|
129
146
|
The expensive habit this replaces is re-reading a 70-row table on every step. Hand the frame to a
|
|
@@ -158,7 +175,7 @@ reported rather than accused — but `cursorRestored=false` (borrowed and not re
|
|
|
158
175
|
`proof=fail`.
|
|
159
176
|
|
|
160
177
|
**And it says who reported the success.** Every action result carries `effect=` in the text and
|
|
161
|
-
`effect` in the structured output. The
|
|
178
|
+
`effect` in the structured output. The four values are not degrees of confidence in the
|
|
162
179
|
application — they name the speaker:
|
|
163
180
|
|
|
164
181
|
| `effect` | who is speaking | it proves | it does **not** prove |
|
|
@@ -166,6 +183,7 @@ application — they name the speaker:
|
|
|
166
183
|
| `unverified` | nobody | nothing | anything |
|
|
167
184
|
| `reported-by-send` | the window-message channel | the message was **delivered** | that the target app processed it |
|
|
168
185
|
| `reported-by-pattern` | the UI Automation pattern call | the call **returned** without throwing | that the interface actually changed |
|
|
186
|
+
| `readback-verified` | the control itself, read back | the value now in the field **equals the value predicted from the field's own measurements** | that the app is *happy* — only that its value is what we said |
|
|
169
187
|
|
|
170
188
|
Since 0.1.3 the effect also enters the judgment, which closes the one honest gap 0.1.2 still had:
|
|
171
189
|
a still desktop could outvote a total no-op. A call whose channel reported nothing is capped at
|
|
@@ -175,6 +193,49 @@ disturb you; it never proves we accomplished anything. A single `reported-by-*`
|
|
|
175
193
|
the caveat spelled out in the reason field (`未独立验证` — nobody observed the app), because turning
|
|
176
194
|
weak-but-real evidence into a red would train its readers to ignore the verdict.
|
|
177
195
|
|
|
196
|
+
### The fourth value has to be earned (0.6.0)
|
|
197
|
+
|
|
198
|
+
`readback-verified` is granted only by the engine, and only when a **prediction** matches a **read**.
|
|
199
|
+
The prediction is computed from measurements the control itself reported — the value it held before,
|
|
200
|
+
its own `WM_GETTEXTLENGTH`, its own `EM_GETSEL` answer for where a typed character lands — and the read
|
|
201
|
+
happens *after* the settle window, so an app that commits its text asynchronously is not judged against
|
|
202
|
+
a half-written buffer:
|
|
203
|
+
|
|
204
|
+
```jsonc
|
|
205
|
+
{"action":"type","hwnd":"…","text":"XY","caretPosition":"start"}
|
|
206
|
+
// -> type ok channel=message tier=quiet effect=readback-verified
|
|
207
|
+
// detail=msg=char|2 child=… caret=start asked=0 applied=0,0 readback=XYabc readbackLen=5 focusMoved=false
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Three things it refuses to do, each measured rather than assumed:
|
|
211
|
+
|
|
212
|
+
* **it does not upgrade what it cannot read.** A masked field (`ES_PASSWORD`) returns an empty string
|
|
213
|
+
while `WM_GETTEXTLENGTH` still reports the real length. That is "the control hides its text", not
|
|
214
|
+
"the field is empty": the result says `readback=unavailable`, the effect keeps whatever the write
|
|
215
|
+
earned, and no value is printed anywhere.
|
|
216
|
+
* **a mismatch is data, not a failure.** A read-only WinForms edit silently refuses `WM_CHAR` — every
|
|
217
|
+
character is accepted by the API and the value never moves — while honouring `WM_SETTEXT`. On the
|
|
218
|
+
refusal the result is still `ok:true` with `readbackMismatch=true` and no upgrade; on the write that
|
|
219
|
+
lands it is `readback-verified`. No refusal code changed for this batch, on purpose: "the application
|
|
220
|
+
formatted my input" is not an error in the call. `test/readback-truth.mjs` asserts both arms against
|
|
221
|
+
the value the *application* wrote about itself, from inside its own process — a readback test that
|
|
222
|
+
compared our write to our read would be grading homework in our own class, and this repo has already
|
|
223
|
+
been caught doing exactly that.
|
|
224
|
+
* **the naive guess is not the model.** Text is not appended: it lands at the caret, and a field that
|
|
225
|
+
never held focus has its caret at 0 (so `abc` + `XY` is `XYabc`). That is why `caretPosition` exists
|
|
226
|
+
and why the result prints `asked=` and `applied=` separately — `EM_SETSEL(-1,-1)` is documented as
|
|
227
|
+
"document end" and measured as a no-op on WinForms EDIT, so `end` is `EM_SETSEL(len,len)` with `len`
|
|
228
|
+
read from the control. On a buffer containing newlines that numeric end can land inside the text
|
|
229
|
+
(`asked=6 applied=4,4`), which is reported instead of hidden; `idle` touches nothing at all. The UIA
|
|
230
|
+
`value` channel replaces the whole value and has no caret to move, so it answers
|
|
231
|
+
`caretIgnored=value-pattern` rather than pretending to honour it.
|
|
232
|
+
|
|
233
|
+
Two more facts ride in the same `detail`, both warnings and neither a refusal: `focusMoved=true` when
|
|
234
|
+
the foreground or the focused control differs between the two measurements taken around the send, and
|
|
235
|
+
`disabled=true` for a target window that is greyed out — Windows keeps answering our messages while
|
|
236
|
+
throwing the input away, so a disabled target loses the right to an `effect` claim
|
|
237
|
+
(`effect=unverified`) without becoming an error.
|
|
238
|
+
|
|
178
239
|
## The takeover tier (opt-in)
|
|
179
240
|
|
|
180
241
|
Off by default (`takeoverAllowed=false`, `keyInjectAllowed=false`), because moving someone's pointer
|
|
@@ -253,8 +314,9 @@ degradation.
|
|
|
253
314
|
## Typed surface
|
|
254
315
|
|
|
255
316
|
`types/index.d.ts` is written by hand, not emitted from an implementation. It covers the whole
|
|
256
|
-
contract: the eight actions, every argument including the takeover fields
|
|
257
|
-
|
|
317
|
+
contract: the eight actions, every argument including the takeover fields, the image-space / label
|
|
318
|
+
surface and 0.6.0's `caretPosition`, all fourteen refusal codes as a closed union, and `effect` as its
|
|
319
|
+
own four-value union (`WpmEffect`) beside `WpmCaptureBackend` and `WpmFrameSource`.
|
|
258
320
|
|
|
259
321
|
Its wiring is measured in both resolution modes a consumer can use, rather than assumed from the
|
|
260
322
|
presence of a file:
|
|
@@ -350,6 +412,33 @@ unmeasured end-to-end and is stated as such in [docs/refusals.md](docs/refusals.
|
|
|
350
412
|
`WindowFromPoint` no longer returning the HUD, and `HTCLIENT` on the button. That is what
|
|
351
413
|
`hud.ps1` ships.
|
|
352
414
|
|
|
415
|
+
### 0.6.0's measurements (all re-runnable, probe scripts under `.tmp/` in the repository)
|
|
416
|
+
|
|
417
|
+
- **The read-back exists and is truthful** — three window classes (`Edit`,
|
|
418
|
+
`WindowsForms10.EDIT.app.*`, `WindowsForms10.RichEdit20W.app.*`) all return the written value through
|
|
419
|
+
`WM_GETTEXT` cross-process, and in four cases the value equals what the *application* reported about
|
|
420
|
+
itself from inside its own process (168–241 ms to observe, on the app's 400 ms timer).
|
|
421
|
+
- **A password field reports a length but no text** — `ES_PASSWORD`: `WM_GETTEXT` returns the empty
|
|
422
|
+
string while `WM_GETTEXTLENGTH` returns the real length. Hence `readback=unavailable`, never "empty".
|
|
423
|
+
- **`EM_SETSEL(-1,-1)` does not mean "the end" on WinForms EDIT** — the selection stayed `0,0` and the
|
|
424
|
+
typed character went to the front; `EM_SETSEL(len,len)` gave `abcY`. On a buffer holding `CRLF` the
|
|
425
|
+
numeric end landed at `4,4` for a reported length of `6` — measured, therefore reported as
|
|
426
|
+
`asked=`/`applied=` rather than papered over. A plain Win32 `EDIT` that never held focus accepts every
|
|
427
|
+
`WM_CHAR` and changes nothing, even with `ES_NOHIDESEL`: the case the old `reported-by-send` was
|
|
428
|
+
laundering, and the reason this batch exists.
|
|
429
|
+
- **A read-only edit refuses `WM_CHAR` and honours `WM_SETTEXT`** — the falsification arm of
|
|
430
|
+
`test/readback-truth.mjs`, chosen over two candidates that measurement eliminated (a bare `LF` is
|
|
431
|
+
preserved verbatim, so it agrees; WinForms enforces `MaxLength` in its own `WM_CHAR` handler, so a
|
|
432
|
+
programmatic `WM_SETTEXT` bypasses it, as does `EM_SETLIMITTEXT` set from outside).
|
|
433
|
+
- **BitBlt halves the capture and leaves the bottleneck where it is** — 16–21 ms against 22–33 ms for a
|
|
434
|
+
1920×1080 grab, PNG encode 37–39 ms in both paths, capture+encode 12–16 ms on a 642×432 window. JPEG
|
|
435
|
+
(6 ms) and WIC (158 ms) measured and rejected, 24bpp measured at 7 % of the size and rejected.
|
|
436
|
+
- **`replace:true` threw on every target until 0.6.0** — the `WM_SETTEXT` binding was declared as
|
|
437
|
+
`SendMessageStrW`, an export `user32.dll` does not have: the call raised
|
|
438
|
+
`EntryPointNotFoundException` on first use and surfaced as `action_failed`. No test in the repository
|
|
439
|
+
exercised `replace:true` through the message door, which is why the fix ships with an arm that does
|
|
440
|
+
(`test/readback-truth.mjs` A1). Found by running the import instead of trusting its name.
|
|
441
|
+
|
|
353
442
|
## Verifying the copy you actually installed
|
|
354
443
|
|
|
355
444
|
Every test above imports the repository checkout, so a package that installs to the wrong place or ships
|
package/README.ru.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
> Плагин DSH, позволяющий агенту управлять **своими** окнами Windows — по умолчанию тихо, по запросу видимо. Когда окно принимает сообщения Windows, фокус никогда не перехватывается. Когда доступен только UI Automation, фокус претерпевает одну ограниченную вспышку и автоматически возвращается. При явном запросе режима takeover курсор перемещается в точку действия и всегда восстанавливается, а HUD предлагает три способа прерывания. Во всех остальных случаях действие отклоняется с кодом и причиной.
|
|
6
6
|
|
|
7
7
|
> **English canonical text follows.** The localized summary above is the orientation; the text below is the authoritative specification (structure, commands and numbers are identical across all 10 languages).
|
|
8
|
-
> **Current release: 0.
|
|
8
|
+
> **Current release: 0.6.0** — this document describes the contract as of that version. What
|
|
9
9
|
> changed in it, and in every version before it, is in [CHANGELOG.md](CHANGELOG.md), newest first.
|
|
10
10
|
|
|
11
11
|
A DSH plugin that lets an agent drive **its own** Windows windows — quietly by default, and visibly
|
|
@@ -94,7 +94,7 @@ Image coordinates are never multiplied by the caller:
|
|
|
94
94
|
|
|
95
95
|
```jsonc
|
|
96
96
|
{"action":"screenshot","hwnd":"1310720"}
|
|
97
|
-
// -> screenRect=0,0,1920,1032 imageSize=1920x1032 scale=1 identity=true frame=dwm
|
|
97
|
+
// -> screenRect=0,0,1920,1032 imageSize=1920x1032 scale=1 identity=true frame=dwm captureBackend=bitblt
|
|
98
98
|
{"action":"click","hwnd":"1310720","space":"image","shotId":"shot-…","x":350,"y":250}
|
|
99
99
|
// the ENGINE converts, then still asserts the point belongs to the target window
|
|
100
100
|
```
|
|
@@ -124,6 +124,23 @@ point at would be a trap), the frame is cross-checked against the window rect th
|
|
|
124
124
|
(`frameCheck=pass|fail|unknown`), and a structural gate pins the single-source rule by mutating a copy
|
|
125
125
|
of the engine and requiring the corresponding red.
|
|
126
126
|
|
|
127
|
+
### Which capture path painted the picture
|
|
128
|
+
|
|
129
|
+
`captureBackend` names the producer: `bitblt` is a direct GDI `BitBlt` off the screen DC, `gdiplus` is
|
|
130
|
+
`Graphics.CopyFromScreen` — either the fallback after BitBlt was refused, or nothing else. The cheap
|
|
131
|
+
path replaced the old one on measured grounds (16–21 ms against 22–33 ms for a 1920×1080 grab), and the
|
|
132
|
+
encoder was deliberately left alone: the PNG encode is the bottleneck (37–39 ms), so JPEG (6 ms, and it
|
|
133
|
+
smears text), WIC (158 ms) and 24bpp (7 % smaller) were each measured and each rejected.
|
|
134
|
+
|
|
135
|
+
Equivalence was established on a **static** scene, not by file hash — two captures of a live desktop
|
|
136
|
+
happen at different instants, so their bytes cannot match, and that difference says nothing about the
|
|
137
|
+
paths: identical size, both non-blank, **0 maximum per-channel difference over 17 388 sampled points**,
|
|
138
|
+
byte-identical PNGs (8940 = 8940), with the comparator's self-check (two reads of one HBITMAP) also at
|
|
139
|
+
0. The one difference is reported rather than assumed away: `FromHbitmap` yields `Format32bppRgb` where
|
|
140
|
+
`CopyFromScreen` yields `Format32bppArgb`. A gate keeps both halves honest — the fallback reachable and
|
|
141
|
+
`captureBackend` produced, forwarded and printed (`scripts/check-shot-backend.mjs`, seven mutations each
|
|
142
|
+
seen red).
|
|
143
|
+
|
|
127
144
|
### Deciding outside the main context
|
|
128
145
|
|
|
129
146
|
The expensive habit this replaces is re-reading a 70-row table on every step. Hand the frame to a
|
|
@@ -158,7 +175,7 @@ reported rather than accused — but `cursorRestored=false` (borrowed and not re
|
|
|
158
175
|
`proof=fail`.
|
|
159
176
|
|
|
160
177
|
**And it says who reported the success.** Every action result carries `effect=` in the text and
|
|
161
|
-
`effect` in the structured output. The
|
|
178
|
+
`effect` in the structured output. The four values are not degrees of confidence in the
|
|
162
179
|
application — they name the speaker:
|
|
163
180
|
|
|
164
181
|
| `effect` | who is speaking | it proves | it does **not** prove |
|
|
@@ -166,6 +183,7 @@ application — they name the speaker:
|
|
|
166
183
|
| `unverified` | nobody | nothing | anything |
|
|
167
184
|
| `reported-by-send` | the window-message channel | the message was **delivered** | that the target app processed it |
|
|
168
185
|
| `reported-by-pattern` | the UI Automation pattern call | the call **returned** without throwing | that the interface actually changed |
|
|
186
|
+
| `readback-verified` | the control itself, read back | the value now in the field **equals the value predicted from the field's own measurements** | that the app is *happy* — only that its value is what we said |
|
|
169
187
|
|
|
170
188
|
Since 0.1.3 the effect also enters the judgment, which closes the one honest gap 0.1.2 still had:
|
|
171
189
|
a still desktop could outvote a total no-op. A call whose channel reported nothing is capped at
|
|
@@ -175,6 +193,49 @@ disturb you; it never proves we accomplished anything. A single `reported-by-*`
|
|
|
175
193
|
the caveat spelled out in the reason field (`未独立验证` — nobody observed the app), because turning
|
|
176
194
|
weak-but-real evidence into a red would train its readers to ignore the verdict.
|
|
177
195
|
|
|
196
|
+
### The fourth value has to be earned (0.6.0)
|
|
197
|
+
|
|
198
|
+
`readback-verified` is granted only by the engine, and only when a **prediction** matches a **read**.
|
|
199
|
+
The prediction is computed from measurements the control itself reported — the value it held before,
|
|
200
|
+
its own `WM_GETTEXTLENGTH`, its own `EM_GETSEL` answer for where a typed character lands — and the read
|
|
201
|
+
happens *after* the settle window, so an app that commits its text asynchronously is not judged against
|
|
202
|
+
a half-written buffer:
|
|
203
|
+
|
|
204
|
+
```jsonc
|
|
205
|
+
{"action":"type","hwnd":"…","text":"XY","caretPosition":"start"}
|
|
206
|
+
// -> type ok channel=message tier=quiet effect=readback-verified
|
|
207
|
+
// detail=msg=char|2 child=… caret=start asked=0 applied=0,0 readback=XYabc readbackLen=5 focusMoved=false
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Three things it refuses to do, each measured rather than assumed:
|
|
211
|
+
|
|
212
|
+
* **it does not upgrade what it cannot read.** A masked field (`ES_PASSWORD`) returns an empty string
|
|
213
|
+
while `WM_GETTEXTLENGTH` still reports the real length. That is "the control hides its text", not
|
|
214
|
+
"the field is empty": the result says `readback=unavailable`, the effect keeps whatever the write
|
|
215
|
+
earned, and no value is printed anywhere.
|
|
216
|
+
* **a mismatch is data, not a failure.** A read-only WinForms edit silently refuses `WM_CHAR` — every
|
|
217
|
+
character is accepted by the API and the value never moves — while honouring `WM_SETTEXT`. On the
|
|
218
|
+
refusal the result is still `ok:true` with `readbackMismatch=true` and no upgrade; on the write that
|
|
219
|
+
lands it is `readback-verified`. No refusal code changed for this batch, on purpose: "the application
|
|
220
|
+
formatted my input" is not an error in the call. `test/readback-truth.mjs` asserts both arms against
|
|
221
|
+
the value the *application* wrote about itself, from inside its own process — a readback test that
|
|
222
|
+
compared our write to our read would be grading homework in our own class, and this repo has already
|
|
223
|
+
been caught doing exactly that.
|
|
224
|
+
* **the naive guess is not the model.** Text is not appended: it lands at the caret, and a field that
|
|
225
|
+
never held focus has its caret at 0 (so `abc` + `XY` is `XYabc`). That is why `caretPosition` exists
|
|
226
|
+
and why the result prints `asked=` and `applied=` separately — `EM_SETSEL(-1,-1)` is documented as
|
|
227
|
+
"document end" and measured as a no-op on WinForms EDIT, so `end` is `EM_SETSEL(len,len)` with `len`
|
|
228
|
+
read from the control. On a buffer containing newlines that numeric end can land inside the text
|
|
229
|
+
(`asked=6 applied=4,4`), which is reported instead of hidden; `idle` touches nothing at all. The UIA
|
|
230
|
+
`value` channel replaces the whole value and has no caret to move, so it answers
|
|
231
|
+
`caretIgnored=value-pattern` rather than pretending to honour it.
|
|
232
|
+
|
|
233
|
+
Two more facts ride in the same `detail`, both warnings and neither a refusal: `focusMoved=true` when
|
|
234
|
+
the foreground or the focused control differs between the two measurements taken around the send, and
|
|
235
|
+
`disabled=true` for a target window that is greyed out — Windows keeps answering our messages while
|
|
236
|
+
throwing the input away, so a disabled target loses the right to an `effect` claim
|
|
237
|
+
(`effect=unverified`) without becoming an error.
|
|
238
|
+
|
|
178
239
|
## The takeover tier (opt-in)
|
|
179
240
|
|
|
180
241
|
Off by default (`takeoverAllowed=false`, `keyInjectAllowed=false`), because moving someone's pointer
|
|
@@ -253,8 +314,9 @@ degradation.
|
|
|
253
314
|
## Typed surface
|
|
254
315
|
|
|
255
316
|
`types/index.d.ts` is written by hand, not emitted from an implementation. It covers the whole
|
|
256
|
-
contract: the eight actions, every argument including the takeover fields
|
|
257
|
-
|
|
317
|
+
contract: the eight actions, every argument including the takeover fields, the image-space / label
|
|
318
|
+
surface and 0.6.0's `caretPosition`, all fourteen refusal codes as a closed union, and `effect` as its
|
|
319
|
+
own four-value union (`WpmEffect`) beside `WpmCaptureBackend` and `WpmFrameSource`.
|
|
258
320
|
|
|
259
321
|
Its wiring is measured in both resolution modes a consumer can use, rather than assumed from the
|
|
260
322
|
presence of a file:
|
|
@@ -350,6 +412,33 @@ unmeasured end-to-end and is stated as such in [docs/refusals.md](docs/refusals.
|
|
|
350
412
|
`WindowFromPoint` no longer returning the HUD, and `HTCLIENT` on the button. That is what
|
|
351
413
|
`hud.ps1` ships.
|
|
352
414
|
|
|
415
|
+
### 0.6.0's measurements (all re-runnable, probe scripts under `.tmp/` in the repository)
|
|
416
|
+
|
|
417
|
+
- **The read-back exists and is truthful** — three window classes (`Edit`,
|
|
418
|
+
`WindowsForms10.EDIT.app.*`, `WindowsForms10.RichEdit20W.app.*`) all return the written value through
|
|
419
|
+
`WM_GETTEXT` cross-process, and in four cases the value equals what the *application* reported about
|
|
420
|
+
itself from inside its own process (168–241 ms to observe, on the app's 400 ms timer).
|
|
421
|
+
- **A password field reports a length but no text** — `ES_PASSWORD`: `WM_GETTEXT` returns the empty
|
|
422
|
+
string while `WM_GETTEXTLENGTH` returns the real length. Hence `readback=unavailable`, never "empty".
|
|
423
|
+
- **`EM_SETSEL(-1,-1)` does not mean "the end" on WinForms EDIT** — the selection stayed `0,0` and the
|
|
424
|
+
typed character went to the front; `EM_SETSEL(len,len)` gave `abcY`. On a buffer holding `CRLF` the
|
|
425
|
+
numeric end landed at `4,4` for a reported length of `6` — measured, therefore reported as
|
|
426
|
+
`asked=`/`applied=` rather than papered over. A plain Win32 `EDIT` that never held focus accepts every
|
|
427
|
+
`WM_CHAR` and changes nothing, even with `ES_NOHIDESEL`: the case the old `reported-by-send` was
|
|
428
|
+
laundering, and the reason this batch exists.
|
|
429
|
+
- **A read-only edit refuses `WM_CHAR` and honours `WM_SETTEXT`** — the falsification arm of
|
|
430
|
+
`test/readback-truth.mjs`, chosen over two candidates that measurement eliminated (a bare `LF` is
|
|
431
|
+
preserved verbatim, so it agrees; WinForms enforces `MaxLength` in its own `WM_CHAR` handler, so a
|
|
432
|
+
programmatic `WM_SETTEXT` bypasses it, as does `EM_SETLIMITTEXT` set from outside).
|
|
433
|
+
- **BitBlt halves the capture and leaves the bottleneck where it is** — 16–21 ms against 22–33 ms for a
|
|
434
|
+
1920×1080 grab, PNG encode 37–39 ms in both paths, capture+encode 12–16 ms on a 642×432 window. JPEG
|
|
435
|
+
(6 ms) and WIC (158 ms) measured and rejected, 24bpp measured at 7 % of the size and rejected.
|
|
436
|
+
- **`replace:true` threw on every target until 0.6.0** — the `WM_SETTEXT` binding was declared as
|
|
437
|
+
`SendMessageStrW`, an export `user32.dll` does not have: the call raised
|
|
438
|
+
`EntryPointNotFoundException` on first use and surfaced as `action_failed`. No test in the repository
|
|
439
|
+
exercised `replace:true` through the message door, which is why the fix ships with an arm that does
|
|
440
|
+
(`test/readback-truth.mjs` A1). Found by running the import instead of trusting its name.
|
|
441
|
+
|
|
353
442
|
## Verifying the copy you actually installed
|
|
354
443
|
|
|
355
444
|
Every test above imports the repository checkout, so a package that installs to the wrong place or ships
|
package/README.zh.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
> 一个让代理驱动**自己**的 Windows 窗口的 DSH 插件——默认静默,按需可见。窗口接受窗口消息时完全不夺焦点;只有 UI Automation 可达时,焦点仅发生一次有界闪烁并自动还原;显式请求接管档时,光标移动到目标点并始终还原,HUD 提供三种中断方式。其他情况一律拒绝,并给出代码与原因。
|
|
6
6
|
|
|
7
7
|
> **English canonical text follows.** The localized summary above is the orientation; the text below is the authoritative specification (structure, commands and numbers are identical across all 10 languages).
|
|
8
|
-
> **Current release: 0.
|
|
8
|
+
> **Current release: 0.6.0** — this document describes the contract as of that version. What
|
|
9
9
|
> changed in it, and in every version before it, is in [CHANGELOG.md](CHANGELOG.md), newest first.
|
|
10
10
|
|
|
11
11
|
A DSH plugin that lets an agent drive **its own** Windows windows — quietly by default, and visibly
|
|
@@ -94,7 +94,7 @@ Image coordinates are never multiplied by the caller:
|
|
|
94
94
|
|
|
95
95
|
```jsonc
|
|
96
96
|
{"action":"screenshot","hwnd":"1310720"}
|
|
97
|
-
// -> screenRect=0,0,1920,1032 imageSize=1920x1032 scale=1 identity=true frame=dwm
|
|
97
|
+
// -> screenRect=0,0,1920,1032 imageSize=1920x1032 scale=1 identity=true frame=dwm captureBackend=bitblt
|
|
98
98
|
{"action":"click","hwnd":"1310720","space":"image","shotId":"shot-…","x":350,"y":250}
|
|
99
99
|
// the ENGINE converts, then still asserts the point belongs to the target window
|
|
100
100
|
```
|
|
@@ -124,6 +124,23 @@ point at would be a trap), the frame is cross-checked against the window rect th
|
|
|
124
124
|
(`frameCheck=pass|fail|unknown`), and a structural gate pins the single-source rule by mutating a copy
|
|
125
125
|
of the engine and requiring the corresponding red.
|
|
126
126
|
|
|
127
|
+
### Which capture path painted the picture
|
|
128
|
+
|
|
129
|
+
`captureBackend` names the producer: `bitblt` is a direct GDI `BitBlt` off the screen DC, `gdiplus` is
|
|
130
|
+
`Graphics.CopyFromScreen` — either the fallback after BitBlt was refused, or nothing else. The cheap
|
|
131
|
+
path replaced the old one on measured grounds (16–21 ms against 22–33 ms for a 1920×1080 grab), and the
|
|
132
|
+
encoder was deliberately left alone: the PNG encode is the bottleneck (37–39 ms), so JPEG (6 ms, and it
|
|
133
|
+
smears text), WIC (158 ms) and 24bpp (7 % smaller) were each measured and each rejected.
|
|
134
|
+
|
|
135
|
+
Equivalence was established on a **static** scene, not by file hash — two captures of a live desktop
|
|
136
|
+
happen at different instants, so their bytes cannot match, and that difference says nothing about the
|
|
137
|
+
paths: identical size, both non-blank, **0 maximum per-channel difference over 17 388 sampled points**,
|
|
138
|
+
byte-identical PNGs (8940 = 8940), with the comparator's self-check (two reads of one HBITMAP) also at
|
|
139
|
+
0. The one difference is reported rather than assumed away: `FromHbitmap` yields `Format32bppRgb` where
|
|
140
|
+
`CopyFromScreen` yields `Format32bppArgb`. A gate keeps both halves honest — the fallback reachable and
|
|
141
|
+
`captureBackend` produced, forwarded and printed (`scripts/check-shot-backend.mjs`, seven mutations each
|
|
142
|
+
seen red).
|
|
143
|
+
|
|
127
144
|
### Deciding outside the main context
|
|
128
145
|
|
|
129
146
|
The expensive habit this replaces is re-reading a 70-row table on every step. Hand the frame to a
|
|
@@ -158,7 +175,7 @@ reported rather than accused — but `cursorRestored=false` (borrowed and not re
|
|
|
158
175
|
`proof=fail`.
|
|
159
176
|
|
|
160
177
|
**And it says who reported the success.** Every action result carries `effect=` in the text and
|
|
161
|
-
`effect` in the structured output. The
|
|
178
|
+
`effect` in the structured output. The four values are not degrees of confidence in the
|
|
162
179
|
application — they name the speaker:
|
|
163
180
|
|
|
164
181
|
| `effect` | who is speaking | it proves | it does **not** prove |
|
|
@@ -166,6 +183,7 @@ application — they name the speaker:
|
|
|
166
183
|
| `unverified` | nobody | nothing | anything |
|
|
167
184
|
| `reported-by-send` | the window-message channel | the message was **delivered** | that the target app processed it |
|
|
168
185
|
| `reported-by-pattern` | the UI Automation pattern call | the call **returned** without throwing | that the interface actually changed |
|
|
186
|
+
| `readback-verified` | the control itself, read back | the value now in the field **equals the value predicted from the field's own measurements** | that the app is *happy* — only that its value is what we said |
|
|
169
187
|
|
|
170
188
|
Since 0.1.3 the effect also enters the judgment, which closes the one honest gap 0.1.2 still had:
|
|
171
189
|
a still desktop could outvote a total no-op. A call whose channel reported nothing is capped at
|
|
@@ -175,6 +193,49 @@ disturb you; it never proves we accomplished anything. A single `reported-by-*`
|
|
|
175
193
|
the caveat spelled out in the reason field (`未独立验证` — nobody observed the app), because turning
|
|
176
194
|
weak-but-real evidence into a red would train its readers to ignore the verdict.
|
|
177
195
|
|
|
196
|
+
### The fourth value has to be earned (0.6.0)
|
|
197
|
+
|
|
198
|
+
`readback-verified` is granted only by the engine, and only when a **prediction** matches a **read**.
|
|
199
|
+
The prediction is computed from measurements the control itself reported — the value it held before,
|
|
200
|
+
its own `WM_GETTEXTLENGTH`, its own `EM_GETSEL` answer for where a typed character lands — and the read
|
|
201
|
+
happens *after* the settle window, so an app that commits its text asynchronously is not judged against
|
|
202
|
+
a half-written buffer:
|
|
203
|
+
|
|
204
|
+
```jsonc
|
|
205
|
+
{"action":"type","hwnd":"…","text":"XY","caretPosition":"start"}
|
|
206
|
+
// -> type ok channel=message tier=quiet effect=readback-verified
|
|
207
|
+
// detail=msg=char|2 child=… caret=start asked=0 applied=0,0 readback=XYabc readbackLen=5 focusMoved=false
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Three things it refuses to do, each measured rather than assumed:
|
|
211
|
+
|
|
212
|
+
* **it does not upgrade what it cannot read.** A masked field (`ES_PASSWORD`) returns an empty string
|
|
213
|
+
while `WM_GETTEXTLENGTH` still reports the real length. That is "the control hides its text", not
|
|
214
|
+
"the field is empty": the result says `readback=unavailable`, the effect keeps whatever the write
|
|
215
|
+
earned, and no value is printed anywhere.
|
|
216
|
+
* **a mismatch is data, not a failure.** A read-only WinForms edit silently refuses `WM_CHAR` — every
|
|
217
|
+
character is accepted by the API and the value never moves — while honouring `WM_SETTEXT`. On the
|
|
218
|
+
refusal the result is still `ok:true` with `readbackMismatch=true` and no upgrade; on the write that
|
|
219
|
+
lands it is `readback-verified`. No refusal code changed for this batch, on purpose: "the application
|
|
220
|
+
formatted my input" is not an error in the call. `test/readback-truth.mjs` asserts both arms against
|
|
221
|
+
the value the *application* wrote about itself, from inside its own process — a readback test that
|
|
222
|
+
compared our write to our read would be grading homework in our own class, and this repo has already
|
|
223
|
+
been caught doing exactly that.
|
|
224
|
+
* **the naive guess is not the model.** Text is not appended: it lands at the caret, and a field that
|
|
225
|
+
never held focus has its caret at 0 (so `abc` + `XY` is `XYabc`). That is why `caretPosition` exists
|
|
226
|
+
and why the result prints `asked=` and `applied=` separately — `EM_SETSEL(-1,-1)` is documented as
|
|
227
|
+
"document end" and measured as a no-op on WinForms EDIT, so `end` is `EM_SETSEL(len,len)` with `len`
|
|
228
|
+
read from the control. On a buffer containing newlines that numeric end can land inside the text
|
|
229
|
+
(`asked=6 applied=4,4`), which is reported instead of hidden; `idle` touches nothing at all. The UIA
|
|
230
|
+
`value` channel replaces the whole value and has no caret to move, so it answers
|
|
231
|
+
`caretIgnored=value-pattern` rather than pretending to honour it.
|
|
232
|
+
|
|
233
|
+
Two more facts ride in the same `detail`, both warnings and neither a refusal: `focusMoved=true` when
|
|
234
|
+
the foreground or the focused control differs between the two measurements taken around the send, and
|
|
235
|
+
`disabled=true` for a target window that is greyed out — Windows keeps answering our messages while
|
|
236
|
+
throwing the input away, so a disabled target loses the right to an `effect` claim
|
|
237
|
+
(`effect=unverified`) without becoming an error.
|
|
238
|
+
|
|
178
239
|
## The takeover tier (opt-in)
|
|
179
240
|
|
|
180
241
|
Off by default (`takeoverAllowed=false`, `keyInjectAllowed=false`), because moving someone's pointer
|
|
@@ -253,8 +314,9 @@ degradation.
|
|
|
253
314
|
## Typed surface
|
|
254
315
|
|
|
255
316
|
`types/index.d.ts` is written by hand, not emitted from an implementation. It covers the whole
|
|
256
|
-
contract: the eight actions, every argument including the takeover fields
|
|
257
|
-
|
|
317
|
+
contract: the eight actions, every argument including the takeover fields, the image-space / label
|
|
318
|
+
surface and 0.6.0's `caretPosition`, all fourteen refusal codes as a closed union, and `effect` as its
|
|
319
|
+
own four-value union (`WpmEffect`) beside `WpmCaptureBackend` and `WpmFrameSource`.
|
|
258
320
|
|
|
259
321
|
Its wiring is measured in both resolution modes a consumer can use, rather than assumed from the
|
|
260
322
|
presence of a file:
|
|
@@ -350,6 +412,33 @@ unmeasured end-to-end and is stated as such in [docs/refusals.md](docs/refusals.
|
|
|
350
412
|
`WindowFromPoint` no longer returning the HUD, and `HTCLIENT` on the button. That is what
|
|
351
413
|
`hud.ps1` ships.
|
|
352
414
|
|
|
415
|
+
### 0.6.0's measurements (all re-runnable, probe scripts under `.tmp/` in the repository)
|
|
416
|
+
|
|
417
|
+
- **The read-back exists and is truthful** — three window classes (`Edit`,
|
|
418
|
+
`WindowsForms10.EDIT.app.*`, `WindowsForms10.RichEdit20W.app.*`) all return the written value through
|
|
419
|
+
`WM_GETTEXT` cross-process, and in four cases the value equals what the *application* reported about
|
|
420
|
+
itself from inside its own process (168–241 ms to observe, on the app's 400 ms timer).
|
|
421
|
+
- **A password field reports a length but no text** — `ES_PASSWORD`: `WM_GETTEXT` returns the empty
|
|
422
|
+
string while `WM_GETTEXTLENGTH` returns the real length. Hence `readback=unavailable`, never "empty".
|
|
423
|
+
- **`EM_SETSEL(-1,-1)` does not mean "the end" on WinForms EDIT** — the selection stayed `0,0` and the
|
|
424
|
+
typed character went to the front; `EM_SETSEL(len,len)` gave `abcY`. On a buffer holding `CRLF` the
|
|
425
|
+
numeric end landed at `4,4` for a reported length of `6` — measured, therefore reported as
|
|
426
|
+
`asked=`/`applied=` rather than papered over. A plain Win32 `EDIT` that never held focus accepts every
|
|
427
|
+
`WM_CHAR` and changes nothing, even with `ES_NOHIDESEL`: the case the old `reported-by-send` was
|
|
428
|
+
laundering, and the reason this batch exists.
|
|
429
|
+
- **A read-only edit refuses `WM_CHAR` and honours `WM_SETTEXT`** — the falsification arm of
|
|
430
|
+
`test/readback-truth.mjs`, chosen over two candidates that measurement eliminated (a bare `LF` is
|
|
431
|
+
preserved verbatim, so it agrees; WinForms enforces `MaxLength` in its own `WM_CHAR` handler, so a
|
|
432
|
+
programmatic `WM_SETTEXT` bypasses it, as does `EM_SETLIMITTEXT` set from outside).
|
|
433
|
+
- **BitBlt halves the capture and leaves the bottleneck where it is** — 16–21 ms against 22–33 ms for a
|
|
434
|
+
1920×1080 grab, PNG encode 37–39 ms in both paths, capture+encode 12–16 ms on a 642×432 window. JPEG
|
|
435
|
+
(6 ms) and WIC (158 ms) measured and rejected, 24bpp measured at 7 % of the size and rejected.
|
|
436
|
+
- **`replace:true` threw on every target until 0.6.0** — the `WM_SETTEXT` binding was declared as
|
|
437
|
+
`SendMessageStrW`, an export `user32.dll` does not have: the call raised
|
|
438
|
+
`EntryPointNotFoundException` on first use and surfaced as `action_failed`. No test in the repository
|
|
439
|
+
exercised `replace:true` through the message door, which is why the fix ships with an arm that does
|
|
440
|
+
(`test/readback-truth.mjs` A1). Found by running the import instead of trusting its name.
|
|
441
|
+
|
|
353
442
|
## Verifying the copy you actually installed
|
|
354
443
|
|
|
355
444
|
Every test above imports the repository checkout, so a package that installs to the wrong place or ships
|
package/dsh.plugin.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"id": "dsh-external/dsh-windows-parallel-mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
|
-
"description": "One tool, eight actions: drive a Windows window quietly by default, and read the target as a numbered element frame. Prefers window messages (zero foreground change); falls back to UI Automation with a bounded, self-reversing focus flash (measured net return 15-95 ms); offers an opt-in takeover tier (takeoverAllowed) where the cursor moves to the action point and is always restored, with a mandatory three-phase HUD and three interruption paths;
|
|
5
|
+
"description": "One tool, eight actions: drive a Windows window quietly by default, and read the target as a numbered element frame. Prefers window messages (zero foreground change); falls back to UI Automation with a bounded, self-reversing focus flash (measured net return 15-95 ms); offers an opt-in takeover tier (takeoverAllowed) where the cursor moves to the action point and is always restored, with a mandatory three-phase HUD and three interruption paths; adds snapshot/screenshot/preview, where labels address the UIA element itself and image coordinates are converted by the engine; and since 0.6.0 reads a write back -- effect=readback-verified only when the field's own value matches a prediction built from the control's measurements -- with caretPosition, disabled/focus reporting, and a BitBlt capture path named in every screenshot as captureBackend.",
|
|
6
6
|
"engines": {
|
|
7
7
|
"dsh": ">=0.1.7-0 <0.3.0-0"
|
|
8
8
|
},
|