dsh-windows-parallel-mcp 0.4.0 → 0.5.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 +12 -0
- package/CHANGELOG.es.md +12 -0
- package/CHANGELOG.fr.md +12 -0
- package/CHANGELOG.it.md +12 -0
- package/CHANGELOG.ja.md +12 -0
- package/CHANGELOG.ko.md +12 -0
- package/CHANGELOG.md +161 -0
- package/CHANGELOG.pt.md +12 -0
- package/CHANGELOG.ru.md +12 -0
- package/CHANGELOG.zh.md +12 -0
- package/README.de.md +106 -18
- package/README.es.md +106 -18
- package/README.fr.md +106 -18
- package/README.it.md +106 -18
- package/README.ja.md +106 -18
- package/README.ko.md +106 -18
- package/README.md +106 -18
- package/README.pt.md +106 -18
- package/README.ru.md +106 -18
- package/README.zh.md +106 -18
- package/docs/refusals.md +7 -4
- package/dsh.plugin.json +3 -3
- package/lib/config.js +14 -0
- package/lib/host-tools.js +61 -3
- package/lib/index.js +272 -14
- package/package.json +6 -3
- package/src/engine/engine.ps1 +217 -3
- package/src/engine/win.ps1 +588 -1
- package/src/engine/worker.ps1 +35 -1
- package/src/schema/tools.json +115 -9
- package/types/index.d.ts +63 -3
package/README.ja.md
CHANGED
|
@@ -5,23 +5,21 @@
|
|
|
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
|
-
> **0.
|
|
9
|
-
>
|
|
10
|
-
> with `takeoverAllowed` on and `takeover:true` on the call, the real cursor is moved to the action
|
|
11
|
-
> point (so you can see where the agent points) and always restored, the focus is held for the
|
|
12
|
-
> duration, and a three-phase HUD with a stop button and a global abort key is mandatory. Keyboard
|
|
13
|
-
> injection exists only inside that tier, only when asked (`keyInput:"inject"`), and only for
|
|
14
|
-
> targets with no other door — and, measured, it does **not** work on this host's terminal, so the
|
|
15
|
-
> terminal stays refused rather than becoming a promise. Both gates default off: an upgrade cannot
|
|
16
|
-
> start moving your cursor by itself. 0.1.6 split `unreachable` into `uia_tree_empty` and
|
|
17
|
-
> `uia_probe_failed`; 0.1.5 made a click act on the point it names; 0.1.3 added `effect=` — who
|
|
18
|
-
> reported the success — and let it enter the judgment. Full history: [CHANGELOG.md](CHANGELOG.md).
|
|
8
|
+
> **Current release: 0.5.0** — this document describes the contract as of that version. What
|
|
9
|
+
> changed in it, and in every version before it, is in [CHANGELOG.md](CHANGELOG.md), newest first.
|
|
19
10
|
|
|
20
11
|
A DSH plugin that lets an agent drive **its own** Windows windows — quietly by default, and visibly
|
|
21
12
|
on request. Where a window accepts a window message, you never lose focus at all. Where it only
|
|
22
13
|
exposes UI Automation, you lose focus for one bounded flash that is reversed automatically. Where you
|
|
23
14
|
explicitly ask for the takeover tier, the cursor moves to the point and is always restored, with a
|
|
24
|
-
HUD that can stop it three ways. Everywhere else it refuses, with a code and a reason
|
|
15
|
+
HUD that can stop it three ways. Everywhere else it refuses, with a code and a reason — never with
|
|
16
|
+
silence: every refusal carries a code from a closed set of fourteen and the next step.
|
|
17
|
+
|
|
18
|
+
**The takeover tier defaults off, and that is structural.** The cursor is only ever moved because you
|
|
19
|
+
opened `takeoverAllowed` **and** asked for it on the call (`takeover:true`), so an upgrade cannot
|
|
20
|
+
start moving your cursor by itself. Keyboard injection lives inside that tier only, only when asked
|
|
21
|
+
(`keyInput:"inject"`), and only for targets with no other door — and, measured, it does **not** work
|
|
22
|
+
on this host's terminal, so the terminal stays refused rather than becoming a promise.
|
|
25
23
|
|
|
26
24
|
Source, the measurement scripts behind every number below, and the release history live at
|
|
27
25
|
**<https://github.com/drscrewdriver/dsh-windows-parallel-mcp>** — issues are the right place for
|
|
@@ -33,15 +31,18 @@ bundle with a broad tool surface; this one is a single action tool whose entire
|
|
|
33
31
|
|
|
34
32
|
## What it does
|
|
35
33
|
|
|
36
|
-
One tool,
|
|
34
|
+
One tool, eight actions:
|
|
37
35
|
|
|
38
36
|
| action | what it returns |
|
|
39
37
|
|---|---|
|
|
40
38
|
| `windows` | live windows that can be driven: hwnd, title, class, pid, rect |
|
|
41
39
|
| `status` | what currently holds the foreground and the keyboard focus, and whether the engine is paused |
|
|
42
|
-
| `click` | click at a screen coordinate inside the named window |
|
|
43
|
-
| `type` | write text into the target (a classic edit child,
|
|
44
|
-
| `focus` | move keyboard focus to a named control inside the target |
|
|
40
|
+
| `click` | click at a screen coordinate inside the named window, or at a snapshot `label` |
|
|
41
|
+
| `type` | write text into the target (a classic edit child, a named UIA element, or a `label`) |
|
|
42
|
+
| `focus` | move keyboard focus to a named control inside the target, or to a `label` |
|
|
43
|
+
| `snapshot` | the accessibility tree as a NUMBERED element table: continuous `label`, control type, name, automation id, screen rect, patterns |
|
|
44
|
+
| `screenshot` | the window rect captured to a PNG, plus the coordinate mapping as data (`screenRect`, `imageSize`, `scale`, `identity`, `frame`, `dpiAware`) |
|
|
45
|
+
| `preview` | the marker drawn at a point, and the element under it reported as TEXT — no picture needed |
|
|
45
46
|
|
|
46
47
|
The engine picks the cheapest available door per call:
|
|
47
48
|
|
|
@@ -74,8 +75,69 @@ flag itself is engine-side and refuses actions with `paused`.
|
|
|
74
75
|
|
|
75
76
|
Refusals are a normal result, not an error: `no_hwnd`, `paused`, `elevated_target`, `unreachable`,
|
|
76
77
|
`uia_tree_empty`, `uia_probe_failed`, `terminal_no_door`, `needs_facts`, `takeover_unavailable`,
|
|
77
|
-
`keyinject_unavailable`, `action_failed`, `restore_failed`, `takeover_aborted`. Each
|
|
78
|
-
and a next step — see [docs/refusals.md](docs/refusals.md).
|
|
78
|
+
`keyinject_unavailable`, `action_failed`, `restore_failed`, `takeover_aborted`, `stale_ref`. Each
|
|
79
|
+
carries a reason and a next step — see [docs/refusals.md](docs/refusals.md).
|
|
80
|
+
|
|
81
|
+
## Reading the frame instead of guessing
|
|
82
|
+
|
|
83
|
+
The three read actions exist so the two halves of a click — *where the thing is* and *where the
|
|
84
|
+
picture is* — stop being the caller's arithmetic.
|
|
85
|
+
|
|
86
|
+
`label` is not a coordinate in disguise. It is resolved back to the UIA **element** by its runtime id
|
|
87
|
+
(measured stable across queries, 71 of 71), so `click`/`type`/`focus` with `label` + `snapId` still
|
|
88
|
+
take the silent pattern path. A labelled `click` keeps `x`/`y` required, and the point must fall
|
|
89
|
+
inside the labelled element's rect — the point stays the contract. A label whose `snapId` was
|
|
90
|
+
superseded is refused with `stale_ref`: element numbers only mean something in the frame that printed
|
|
91
|
+
them.
|
|
92
|
+
|
|
93
|
+
Image coordinates are never multiplied by the caller:
|
|
94
|
+
|
|
95
|
+
```jsonc
|
|
96
|
+
{"action":"screenshot","hwnd":"1310720"}
|
|
97
|
+
// -> screenRect=0,0,1920,1032 imageSize=1920x1032 scale=1 identity=true frame=dwm
|
|
98
|
+
{"action":"click","hwnd":"1310720","space":"image","shotId":"shot-…","x":350,"y":250}
|
|
99
|
+
// the ENGINE converts, then still asserts the point belongs to the target window
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
The picture is not returned inline — a plugin cannot mint an inline image block without the host's
|
|
103
|
+
attachment service — so the PNG is written to `%LOCALAPPDATA%\wpm\shots\` (newest `shotsKeep` kept)
|
|
104
|
+
and read with the host's image reader. `preview` is the cheaper confirmation: it draws the marker at
|
|
105
|
+
the point and answers, as text, which element the OS says is there. Confirming a point therefore
|
|
106
|
+
never depends on looking at a picture, and a preview writes no input-queue entry, takes no focus and
|
|
107
|
+
produces no proof window.
|
|
108
|
+
|
|
109
|
+
### The frame rule, and why 8px mattered
|
|
110
|
+
|
|
111
|
+
One rectangle decides everything: `DwmGetWindowAttribute(EXTENDED_FRAME_BOUNDS)`. Measured here,
|
|
112
|
+
`GetWindowRect` is **8px larger on every edge** — the invisible resize shadow — and the accessibility
|
|
113
|
+
tree mixes the two spaces: its root element reports the shadow-inclusive rect while its children
|
|
114
|
+
report the real one, so arithmetic that mixes them is 8px wrong and *looks right*. Labels and the
|
|
115
|
+
captured picture therefore come from the same function. When DWM is unavailable (RDP, Basic theme)
|
|
116
|
+
the fallback to `GetWindowRect` is **reported** as `frame=win32` rather than swallowed, and
|
|
117
|
+
`frameInset` prints the shadow width as data.
|
|
118
|
+
|
|
119
|
+
The plan for this release proposed a runtime invariant — "every element rect is inside `screenRect`" —
|
|
120
|
+
and measurement refuted it: real Chromium/Electron trees report virtualized content far outside the
|
|
121
|
+
viewport (overhangs of 3px, 18px, 287px and 2720px measured here). What replaced it: elements that do
|
|
122
|
+
not overlap the capture are **excluded and counted** (`outsideFrame=…`, because a number you cannot
|
|
123
|
+
point at would be a trap), the frame is cross-checked against the window rect the tree itself reports
|
|
124
|
+
(`frameCheck=pass|fail|unknown`), and a structural gate pins the single-source rule by mutating a copy
|
|
125
|
+
of the engine and requiring the corresponding red.
|
|
126
|
+
|
|
127
|
+
### Deciding outside the main context
|
|
128
|
+
|
|
129
|
+
The expensive habit this replaces is re-reading a 70-row table on every step. Hand the frame to a
|
|
130
|
+
clean deciding side and take back one number:
|
|
131
|
+
|
|
132
|
+
1. `snapshot` with `intent:"close the settings dialog"` — the intent travels with the frame, and is
|
|
133
|
+
written to `%LOCALAPPDATA%\wpm\last-snapshot.json`;
|
|
134
|
+
2. give the numbered table and the intent to a clean subagent;
|
|
135
|
+
3. it answers with a single `label` — not a selector, not a coordinate;
|
|
136
|
+
4. click with that `label` + `snapId`.
|
|
137
|
+
|
|
138
|
+
`sinceSnapId` serves the same goal: an unchanged tree answers `no changes since <id>` instead of
|
|
139
|
+
repeating itself, and a delta names only what actually moved (`added` / `removed` / `changed`, keyed
|
|
140
|
+
by runtime id).
|
|
79
141
|
|
|
80
142
|
**Every real click carries its own disturbance proof.** `click` returns a `proof=pass|inconclusive|…`
|
|
81
143
|
verdict plus a `proofDimensions` field (cursor / foreground / focus). Around your call the engine
|
|
@@ -188,6 +250,29 @@ call, not at plugin load.
|
|
|
188
250
|
`engines.dsh` is an explicit two-sided range. There is no runtime version probing and no silent
|
|
189
251
|
degradation.
|
|
190
252
|
|
|
253
|
+
## Typed surface
|
|
254
|
+
|
|
255
|
+
`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 and the image-space /
|
|
257
|
+
label surface, and all fourteen refusal codes as a closed union.
|
|
258
|
+
|
|
259
|
+
Its wiring is measured in both resolution modes a consumer can use, rather than assumed from the
|
|
260
|
+
presence of a file:
|
|
261
|
+
|
|
262
|
+
- a `nodenext` consumer resolves it through the `types` condition inside `exports`. That condition is
|
|
263
|
+
load-bearing: delete it and the same consumer fails with `TS7016`, because once `exports` exists it
|
|
264
|
+
is the only entry point and the legacy field below is never consulted;
|
|
265
|
+
- a classic resolver falls back to the top-level `types` field. Delete `exports` entirely and the
|
|
266
|
+
consumer still type-checks.
|
|
267
|
+
|
|
268
|
+
Neither field is decoration, so neither is removable on the assumption that the other covers it.
|
|
269
|
+
|
|
270
|
+
The declarations are also checked against the implementation, in the direction that catches drift:
|
|
271
|
+
`lib/` is type-checked under `allowJs + checkJs + strict` **against those same declarations**, so
|
|
272
|
+
renaming a field in one without the other fails a repo gate instead of a user's build. This stays
|
|
273
|
+
inside the package's zero-install-dependency promise — the compiler is borrowed from the workspace
|
|
274
|
+
when one is present, and the gate reports a named SKIP rather than a red when one is not.
|
|
275
|
+
|
|
191
276
|
## Settings
|
|
192
277
|
|
|
193
278
|
| key | default | effect |
|
|
@@ -201,6 +286,9 @@ degradation.
|
|
|
201
286
|
| `keyInjectAllowed` | `false` | allow `keyInput:"inject"` inside the takeover tier (keyboard only, foreground asserted) |
|
|
202
287
|
| `takeoverMaxMs` | `10000` | hard ceiling for one takeover action (500–60000); the HUD shows the clock |
|
|
203
288
|
| `takeoverArmMs` | `800` | length of the arming phase: the window in which you can cancel before anything moves |
|
|
289
|
+
| `snapshotMaxElements` | `300` | cap on elements per snapshot (1–5000); a tighter cap is a smaller frame for a deciding subagent |
|
|
290
|
+
| `screenshotMaxWidth` | `0` | downscale captures to this width; `0` means no scaling and `scale=1` — a resized image is a different coordinate system, so it is never chosen silently |
|
|
291
|
+
| `shotsKeep` | `10` | how many PNGs stay in `%LOCALAPPDATA%\wpm\shots`; older files are deleted after each capture |
|
|
204
292
|
|
|
205
293
|
## What measurement established
|
|
206
294
|
|
package/README.ko.md
CHANGED
|
@@ -5,23 +5,21 @@
|
|
|
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
|
-
> **0.
|
|
9
|
-
>
|
|
10
|
-
> with `takeoverAllowed` on and `takeover:true` on the call, the real cursor is moved to the action
|
|
11
|
-
> point (so you can see where the agent points) and always restored, the focus is held for the
|
|
12
|
-
> duration, and a three-phase HUD with a stop button and a global abort key is mandatory. Keyboard
|
|
13
|
-
> injection exists only inside that tier, only when asked (`keyInput:"inject"`), and only for
|
|
14
|
-
> targets with no other door — and, measured, it does **not** work on this host's terminal, so the
|
|
15
|
-
> terminal stays refused rather than becoming a promise. Both gates default off: an upgrade cannot
|
|
16
|
-
> start moving your cursor by itself. 0.1.6 split `unreachable` into `uia_tree_empty` and
|
|
17
|
-
> `uia_probe_failed`; 0.1.5 made a click act on the point it names; 0.1.3 added `effect=` — who
|
|
18
|
-
> reported the success — and let it enter the judgment. Full history: [CHANGELOG.md](CHANGELOG.md).
|
|
8
|
+
> **Current release: 0.5.0** — this document describes the contract as of that version. What
|
|
9
|
+
> changed in it, and in every version before it, is in [CHANGELOG.md](CHANGELOG.md), newest first.
|
|
19
10
|
|
|
20
11
|
A DSH plugin that lets an agent drive **its own** Windows windows — quietly by default, and visibly
|
|
21
12
|
on request. Where a window accepts a window message, you never lose focus at all. Where it only
|
|
22
13
|
exposes UI Automation, you lose focus for one bounded flash that is reversed automatically. Where you
|
|
23
14
|
explicitly ask for the takeover tier, the cursor moves to the point and is always restored, with a
|
|
24
|
-
HUD that can stop it three ways. Everywhere else it refuses, with a code and a reason
|
|
15
|
+
HUD that can stop it three ways. Everywhere else it refuses, with a code and a reason — never with
|
|
16
|
+
silence: every refusal carries a code from a closed set of fourteen and the next step.
|
|
17
|
+
|
|
18
|
+
**The takeover tier defaults off, and that is structural.** The cursor is only ever moved because you
|
|
19
|
+
opened `takeoverAllowed` **and** asked for it on the call (`takeover:true`), so an upgrade cannot
|
|
20
|
+
start moving your cursor by itself. Keyboard injection lives inside that tier only, only when asked
|
|
21
|
+
(`keyInput:"inject"`), and only for targets with no other door — and, measured, it does **not** work
|
|
22
|
+
on this host's terminal, so the terminal stays refused rather than becoming a promise.
|
|
25
23
|
|
|
26
24
|
Source, the measurement scripts behind every number below, and the release history live at
|
|
27
25
|
**<https://github.com/drscrewdriver/dsh-windows-parallel-mcp>** — issues are the right place for
|
|
@@ -33,15 +31,18 @@ bundle with a broad tool surface; this one is a single action tool whose entire
|
|
|
33
31
|
|
|
34
32
|
## What it does
|
|
35
33
|
|
|
36
|
-
One tool,
|
|
34
|
+
One tool, eight actions:
|
|
37
35
|
|
|
38
36
|
| action | what it returns |
|
|
39
37
|
|---|---|
|
|
40
38
|
| `windows` | live windows that can be driven: hwnd, title, class, pid, rect |
|
|
41
39
|
| `status` | what currently holds the foreground and the keyboard focus, and whether the engine is paused |
|
|
42
|
-
| `click` | click at a screen coordinate inside the named window |
|
|
43
|
-
| `type` | write text into the target (a classic edit child,
|
|
44
|
-
| `focus` | move keyboard focus to a named control inside the target |
|
|
40
|
+
| `click` | click at a screen coordinate inside the named window, or at a snapshot `label` |
|
|
41
|
+
| `type` | write text into the target (a classic edit child, a named UIA element, or a `label`) |
|
|
42
|
+
| `focus` | move keyboard focus to a named control inside the target, or to a `label` |
|
|
43
|
+
| `snapshot` | the accessibility tree as a NUMBERED element table: continuous `label`, control type, name, automation id, screen rect, patterns |
|
|
44
|
+
| `screenshot` | the window rect captured to a PNG, plus the coordinate mapping as data (`screenRect`, `imageSize`, `scale`, `identity`, `frame`, `dpiAware`) |
|
|
45
|
+
| `preview` | the marker drawn at a point, and the element under it reported as TEXT — no picture needed |
|
|
45
46
|
|
|
46
47
|
The engine picks the cheapest available door per call:
|
|
47
48
|
|
|
@@ -74,8 +75,69 @@ flag itself is engine-side and refuses actions with `paused`.
|
|
|
74
75
|
|
|
75
76
|
Refusals are a normal result, not an error: `no_hwnd`, `paused`, `elevated_target`, `unreachable`,
|
|
76
77
|
`uia_tree_empty`, `uia_probe_failed`, `terminal_no_door`, `needs_facts`, `takeover_unavailable`,
|
|
77
|
-
`keyinject_unavailable`, `action_failed`, `restore_failed`, `takeover_aborted`. Each
|
|
78
|
-
and a next step — see [docs/refusals.md](docs/refusals.md).
|
|
78
|
+
`keyinject_unavailable`, `action_failed`, `restore_failed`, `takeover_aborted`, `stale_ref`. Each
|
|
79
|
+
carries a reason and a next step — see [docs/refusals.md](docs/refusals.md).
|
|
80
|
+
|
|
81
|
+
## Reading the frame instead of guessing
|
|
82
|
+
|
|
83
|
+
The three read actions exist so the two halves of a click — *where the thing is* and *where the
|
|
84
|
+
picture is* — stop being the caller's arithmetic.
|
|
85
|
+
|
|
86
|
+
`label` is not a coordinate in disguise. It is resolved back to the UIA **element** by its runtime id
|
|
87
|
+
(measured stable across queries, 71 of 71), so `click`/`type`/`focus` with `label` + `snapId` still
|
|
88
|
+
take the silent pattern path. A labelled `click` keeps `x`/`y` required, and the point must fall
|
|
89
|
+
inside the labelled element's rect — the point stays the contract. A label whose `snapId` was
|
|
90
|
+
superseded is refused with `stale_ref`: element numbers only mean something in the frame that printed
|
|
91
|
+
them.
|
|
92
|
+
|
|
93
|
+
Image coordinates are never multiplied by the caller:
|
|
94
|
+
|
|
95
|
+
```jsonc
|
|
96
|
+
{"action":"screenshot","hwnd":"1310720"}
|
|
97
|
+
// -> screenRect=0,0,1920,1032 imageSize=1920x1032 scale=1 identity=true frame=dwm
|
|
98
|
+
{"action":"click","hwnd":"1310720","space":"image","shotId":"shot-…","x":350,"y":250}
|
|
99
|
+
// the ENGINE converts, then still asserts the point belongs to the target window
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
The picture is not returned inline — a plugin cannot mint an inline image block without the host's
|
|
103
|
+
attachment service — so the PNG is written to `%LOCALAPPDATA%\wpm\shots\` (newest `shotsKeep` kept)
|
|
104
|
+
and read with the host's image reader. `preview` is the cheaper confirmation: it draws the marker at
|
|
105
|
+
the point and answers, as text, which element the OS says is there. Confirming a point therefore
|
|
106
|
+
never depends on looking at a picture, and a preview writes no input-queue entry, takes no focus and
|
|
107
|
+
produces no proof window.
|
|
108
|
+
|
|
109
|
+
### The frame rule, and why 8px mattered
|
|
110
|
+
|
|
111
|
+
One rectangle decides everything: `DwmGetWindowAttribute(EXTENDED_FRAME_BOUNDS)`. Measured here,
|
|
112
|
+
`GetWindowRect` is **8px larger on every edge** — the invisible resize shadow — and the accessibility
|
|
113
|
+
tree mixes the two spaces: its root element reports the shadow-inclusive rect while its children
|
|
114
|
+
report the real one, so arithmetic that mixes them is 8px wrong and *looks right*. Labels and the
|
|
115
|
+
captured picture therefore come from the same function. When DWM is unavailable (RDP, Basic theme)
|
|
116
|
+
the fallback to `GetWindowRect` is **reported** as `frame=win32` rather than swallowed, and
|
|
117
|
+
`frameInset` prints the shadow width as data.
|
|
118
|
+
|
|
119
|
+
The plan for this release proposed a runtime invariant — "every element rect is inside `screenRect`" —
|
|
120
|
+
and measurement refuted it: real Chromium/Electron trees report virtualized content far outside the
|
|
121
|
+
viewport (overhangs of 3px, 18px, 287px and 2720px measured here). What replaced it: elements that do
|
|
122
|
+
not overlap the capture are **excluded and counted** (`outsideFrame=…`, because a number you cannot
|
|
123
|
+
point at would be a trap), the frame is cross-checked against the window rect the tree itself reports
|
|
124
|
+
(`frameCheck=pass|fail|unknown`), and a structural gate pins the single-source rule by mutating a copy
|
|
125
|
+
of the engine and requiring the corresponding red.
|
|
126
|
+
|
|
127
|
+
### Deciding outside the main context
|
|
128
|
+
|
|
129
|
+
The expensive habit this replaces is re-reading a 70-row table on every step. Hand the frame to a
|
|
130
|
+
clean deciding side and take back one number:
|
|
131
|
+
|
|
132
|
+
1. `snapshot` with `intent:"close the settings dialog"` — the intent travels with the frame, and is
|
|
133
|
+
written to `%LOCALAPPDATA%\wpm\last-snapshot.json`;
|
|
134
|
+
2. give the numbered table and the intent to a clean subagent;
|
|
135
|
+
3. it answers with a single `label` — not a selector, not a coordinate;
|
|
136
|
+
4. click with that `label` + `snapId`.
|
|
137
|
+
|
|
138
|
+
`sinceSnapId` serves the same goal: an unchanged tree answers `no changes since <id>` instead of
|
|
139
|
+
repeating itself, and a delta names only what actually moved (`added` / `removed` / `changed`, keyed
|
|
140
|
+
by runtime id).
|
|
79
141
|
|
|
80
142
|
**Every real click carries its own disturbance proof.** `click` returns a `proof=pass|inconclusive|…`
|
|
81
143
|
verdict plus a `proofDimensions` field (cursor / foreground / focus). Around your call the engine
|
|
@@ -188,6 +250,29 @@ call, not at plugin load.
|
|
|
188
250
|
`engines.dsh` is an explicit two-sided range. There is no runtime version probing and no silent
|
|
189
251
|
degradation.
|
|
190
252
|
|
|
253
|
+
## Typed surface
|
|
254
|
+
|
|
255
|
+
`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 and the image-space /
|
|
257
|
+
label surface, and all fourteen refusal codes as a closed union.
|
|
258
|
+
|
|
259
|
+
Its wiring is measured in both resolution modes a consumer can use, rather than assumed from the
|
|
260
|
+
presence of a file:
|
|
261
|
+
|
|
262
|
+
- a `nodenext` consumer resolves it through the `types` condition inside `exports`. That condition is
|
|
263
|
+
load-bearing: delete it and the same consumer fails with `TS7016`, because once `exports` exists it
|
|
264
|
+
is the only entry point and the legacy field below is never consulted;
|
|
265
|
+
- a classic resolver falls back to the top-level `types` field. Delete `exports` entirely and the
|
|
266
|
+
consumer still type-checks.
|
|
267
|
+
|
|
268
|
+
Neither field is decoration, so neither is removable on the assumption that the other covers it.
|
|
269
|
+
|
|
270
|
+
The declarations are also checked against the implementation, in the direction that catches drift:
|
|
271
|
+
`lib/` is type-checked under `allowJs + checkJs + strict` **against those same declarations**, so
|
|
272
|
+
renaming a field in one without the other fails a repo gate instead of a user's build. This stays
|
|
273
|
+
inside the package's zero-install-dependency promise — the compiler is borrowed from the workspace
|
|
274
|
+
when one is present, and the gate reports a named SKIP rather than a red when one is not.
|
|
275
|
+
|
|
191
276
|
## Settings
|
|
192
277
|
|
|
193
278
|
| key | default | effect |
|
|
@@ -201,6 +286,9 @@ degradation.
|
|
|
201
286
|
| `keyInjectAllowed` | `false` | allow `keyInput:"inject"` inside the takeover tier (keyboard only, foreground asserted) |
|
|
202
287
|
| `takeoverMaxMs` | `10000` | hard ceiling for one takeover action (500–60000); the HUD shows the clock |
|
|
203
288
|
| `takeoverArmMs` | `800` | length of the arming phase: the window in which you can cancel before anything moves |
|
|
289
|
+
| `snapshotMaxElements` | `300` | cap on elements per snapshot (1–5000); a tighter cap is a smaller frame for a deciding subagent |
|
|
290
|
+
| `screenshotMaxWidth` | `0` | downscale captures to this width; `0` means no scaling and `scale=1` — a resized image is a different coordinate system, so it is never chosen silently |
|
|
291
|
+
| `shotsKeep` | `10` | how many PNGs stay in `%LOCALAPPDATA%\wpm\shots`; older files are deleted after each capture |
|
|
204
292
|
|
|
205
293
|
## What measurement established
|
|
206
294
|
|
package/README.md
CHANGED
|
@@ -1,23 +1,21 @@
|
|
|
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
|
-
> **0.
|
|
5
|
-
>
|
|
6
|
-
> with `takeoverAllowed` on and `takeover:true` on the call, the real cursor is moved to the action
|
|
7
|
-
> point (so you can see where the agent points) and always restored, the focus is held for the
|
|
8
|
-
> duration, and a three-phase HUD with a stop button and a global abort key is mandatory. Keyboard
|
|
9
|
-
> injection exists only inside that tier, only when asked (`keyInput:"inject"`), and only for
|
|
10
|
-
> targets with no other door — and, measured, it does **not** work on this host's terminal, so the
|
|
11
|
-
> terminal stays refused rather than becoming a promise. Both gates default off: an upgrade cannot
|
|
12
|
-
> start moving your cursor by itself. 0.1.6 split `unreachable` into `uia_tree_empty` and
|
|
13
|
-
> `uia_probe_failed`; 0.1.5 made a click act on the point it names; 0.1.3 added `effect=` — who
|
|
14
|
-
> reported the success — and let it enter the judgment. Full history: [CHANGELOG.md](CHANGELOG.md).
|
|
4
|
+
> **Current release: 0.5.0** — this document describes the contract as of that version. What
|
|
5
|
+
> changed in it, and in every version before it, is in [CHANGELOG.md](CHANGELOG.md), newest first.
|
|
15
6
|
|
|
16
7
|
A DSH plugin that lets an agent drive **its own** Windows windows — quietly by default, and visibly
|
|
17
8
|
on request. Where a window accepts a window message, you never lose focus at all. Where it only
|
|
18
9
|
exposes UI Automation, you lose focus for one bounded flash that is reversed automatically. Where you
|
|
19
10
|
explicitly ask for the takeover tier, the cursor moves to the point and is always restored, with a
|
|
20
|
-
HUD that can stop it three ways. Everywhere else it refuses, with a code and a reason
|
|
11
|
+
HUD that can stop it three ways. Everywhere else it refuses, with a code and a reason — never with
|
|
12
|
+
silence: every refusal carries a code from a closed set of fourteen and the next step.
|
|
13
|
+
|
|
14
|
+
**The takeover tier defaults off, and that is structural.** The cursor is only ever moved because you
|
|
15
|
+
opened `takeoverAllowed` **and** asked for it on the call (`takeover:true`), so an upgrade cannot
|
|
16
|
+
start moving your cursor by itself. Keyboard injection lives inside that tier only, only when asked
|
|
17
|
+
(`keyInput:"inject"`), and only for targets with no other door — and, measured, it does **not** work
|
|
18
|
+
on this host's terminal, so the terminal stays refused rather than becoming a promise.
|
|
21
19
|
|
|
22
20
|
Source, the measurement scripts behind every number below, and the release history live at
|
|
23
21
|
**<https://github.com/drscrewdriver/dsh-windows-parallel-mcp>** — issues are the right place for
|
|
@@ -29,15 +27,18 @@ bundle with a broad tool surface; this one is a single action tool whose entire
|
|
|
29
27
|
|
|
30
28
|
## What it does
|
|
31
29
|
|
|
32
|
-
One tool,
|
|
30
|
+
One tool, eight actions:
|
|
33
31
|
|
|
34
32
|
| action | what it returns |
|
|
35
33
|
|---|---|
|
|
36
34
|
| `windows` | live windows that can be driven: hwnd, title, class, pid, rect |
|
|
37
35
|
| `status` | what currently holds the foreground and the keyboard focus, and whether the engine is paused |
|
|
38
|
-
| `click` | click at a screen coordinate inside the named window |
|
|
39
|
-
| `type` | write text into the target (a classic edit child,
|
|
40
|
-
| `focus` | move keyboard focus to a named control inside the target |
|
|
36
|
+
| `click` | click at a screen coordinate inside the named window, or at a snapshot `label` |
|
|
37
|
+
| `type` | write text into the target (a classic edit child, a named UIA element, or a `label`) |
|
|
38
|
+
| `focus` | move keyboard focus to a named control inside the target, or to a `label` |
|
|
39
|
+
| `snapshot` | the accessibility tree as a NUMBERED element table: continuous `label`, control type, name, automation id, screen rect, patterns |
|
|
40
|
+
| `screenshot` | the window rect captured to a PNG, plus the coordinate mapping as data (`screenRect`, `imageSize`, `scale`, `identity`, `frame`, `dpiAware`) |
|
|
41
|
+
| `preview` | the marker drawn at a point, and the element under it reported as TEXT — no picture needed |
|
|
41
42
|
|
|
42
43
|
The engine picks the cheapest available door per call:
|
|
43
44
|
|
|
@@ -70,8 +71,69 @@ flag itself is engine-side and refuses actions with `paused`.
|
|
|
70
71
|
|
|
71
72
|
Refusals are a normal result, not an error: `no_hwnd`, `paused`, `elevated_target`, `unreachable`,
|
|
72
73
|
`uia_tree_empty`, `uia_probe_failed`, `terminal_no_door`, `needs_facts`, `takeover_unavailable`,
|
|
73
|
-
`keyinject_unavailable`, `action_failed`, `restore_failed`, `takeover_aborted`. Each
|
|
74
|
-
and a next step — see [docs/refusals.md](docs/refusals.md).
|
|
74
|
+
`keyinject_unavailable`, `action_failed`, `restore_failed`, `takeover_aborted`, `stale_ref`. Each
|
|
75
|
+
carries a reason and a next step — see [docs/refusals.md](docs/refusals.md).
|
|
76
|
+
|
|
77
|
+
## Reading the frame instead of guessing
|
|
78
|
+
|
|
79
|
+
The three read actions exist so the two halves of a click — *where the thing is* and *where the
|
|
80
|
+
picture is* — stop being the caller's arithmetic.
|
|
81
|
+
|
|
82
|
+
`label` is not a coordinate in disguise. It is resolved back to the UIA **element** by its runtime id
|
|
83
|
+
(measured stable across queries, 71 of 71), so `click`/`type`/`focus` with `label` + `snapId` still
|
|
84
|
+
take the silent pattern path. A labelled `click` keeps `x`/`y` required, and the point must fall
|
|
85
|
+
inside the labelled element's rect — the point stays the contract. A label whose `snapId` was
|
|
86
|
+
superseded is refused with `stale_ref`: element numbers only mean something in the frame that printed
|
|
87
|
+
them.
|
|
88
|
+
|
|
89
|
+
Image coordinates are never multiplied by the caller:
|
|
90
|
+
|
|
91
|
+
```jsonc
|
|
92
|
+
{"action":"screenshot","hwnd":"1310720"}
|
|
93
|
+
// -> screenRect=0,0,1920,1032 imageSize=1920x1032 scale=1 identity=true frame=dwm
|
|
94
|
+
{"action":"click","hwnd":"1310720","space":"image","shotId":"shot-…","x":350,"y":250}
|
|
95
|
+
// the ENGINE converts, then still asserts the point belongs to the target window
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The picture is not returned inline — a plugin cannot mint an inline image block without the host's
|
|
99
|
+
attachment service — so the PNG is written to `%LOCALAPPDATA%\wpm\shots\` (newest `shotsKeep` kept)
|
|
100
|
+
and read with the host's image reader. `preview` is the cheaper confirmation: it draws the marker at
|
|
101
|
+
the point and answers, as text, which element the OS says is there. Confirming a point therefore
|
|
102
|
+
never depends on looking at a picture, and a preview writes no input-queue entry, takes no focus and
|
|
103
|
+
produces no proof window.
|
|
104
|
+
|
|
105
|
+
### The frame rule, and why 8px mattered
|
|
106
|
+
|
|
107
|
+
One rectangle decides everything: `DwmGetWindowAttribute(EXTENDED_FRAME_BOUNDS)`. Measured here,
|
|
108
|
+
`GetWindowRect` is **8px larger on every edge** — the invisible resize shadow — and the accessibility
|
|
109
|
+
tree mixes the two spaces: its root element reports the shadow-inclusive rect while its children
|
|
110
|
+
report the real one, so arithmetic that mixes them is 8px wrong and *looks right*. Labels and the
|
|
111
|
+
captured picture therefore come from the same function. When DWM is unavailable (RDP, Basic theme)
|
|
112
|
+
the fallback to `GetWindowRect` is **reported** as `frame=win32` rather than swallowed, and
|
|
113
|
+
`frameInset` prints the shadow width as data.
|
|
114
|
+
|
|
115
|
+
The plan for this release proposed a runtime invariant — "every element rect is inside `screenRect`" —
|
|
116
|
+
and measurement refuted it: real Chromium/Electron trees report virtualized content far outside the
|
|
117
|
+
viewport (overhangs of 3px, 18px, 287px and 2720px measured here). What replaced it: elements that do
|
|
118
|
+
not overlap the capture are **excluded and counted** (`outsideFrame=…`, because a number you cannot
|
|
119
|
+
point at would be a trap), the frame is cross-checked against the window rect the tree itself reports
|
|
120
|
+
(`frameCheck=pass|fail|unknown`), and a structural gate pins the single-source rule by mutating a copy
|
|
121
|
+
of the engine and requiring the corresponding red.
|
|
122
|
+
|
|
123
|
+
### Deciding outside the main context
|
|
124
|
+
|
|
125
|
+
The expensive habit this replaces is re-reading a 70-row table on every step. Hand the frame to a
|
|
126
|
+
clean deciding side and take back one number:
|
|
127
|
+
|
|
128
|
+
1. `snapshot` with `intent:"close the settings dialog"` — the intent travels with the frame, and is
|
|
129
|
+
written to `%LOCALAPPDATA%\wpm\last-snapshot.json`;
|
|
130
|
+
2. give the numbered table and the intent to a clean subagent;
|
|
131
|
+
3. it answers with a single `label` — not a selector, not a coordinate;
|
|
132
|
+
4. click with that `label` + `snapId`.
|
|
133
|
+
|
|
134
|
+
`sinceSnapId` serves the same goal: an unchanged tree answers `no changes since <id>` instead of
|
|
135
|
+
repeating itself, and a delta names only what actually moved (`added` / `removed` / `changed`, keyed
|
|
136
|
+
by runtime id).
|
|
75
137
|
|
|
76
138
|
**Every real click carries its own disturbance proof.** `click` returns a `proof=pass|inconclusive|…`
|
|
77
139
|
verdict plus a `proofDimensions` field (cursor / foreground / focus). Around your call the engine
|
|
@@ -184,6 +246,29 @@ call, not at plugin load.
|
|
|
184
246
|
`engines.dsh` is an explicit two-sided range. There is no runtime version probing and no silent
|
|
185
247
|
degradation.
|
|
186
248
|
|
|
249
|
+
## Typed surface
|
|
250
|
+
|
|
251
|
+
`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 and the image-space /
|
|
253
|
+
label surface, and all fourteen refusal codes as a closed union.
|
|
254
|
+
|
|
255
|
+
Its wiring is measured in both resolution modes a consumer can use, rather than assumed from the
|
|
256
|
+
presence of a file:
|
|
257
|
+
|
|
258
|
+
- a `nodenext` consumer resolves it through the `types` condition inside `exports`. That condition is
|
|
259
|
+
load-bearing: delete it and the same consumer fails with `TS7016`, because once `exports` exists it
|
|
260
|
+
is the only entry point and the legacy field below is never consulted;
|
|
261
|
+
- a classic resolver falls back to the top-level `types` field. Delete `exports` entirely and the
|
|
262
|
+
consumer still type-checks.
|
|
263
|
+
|
|
264
|
+
Neither field is decoration, so neither is removable on the assumption that the other covers it.
|
|
265
|
+
|
|
266
|
+
The declarations are also checked against the implementation, in the direction that catches drift:
|
|
267
|
+
`lib/` is type-checked under `allowJs + checkJs + strict` **against those same declarations**, so
|
|
268
|
+
renaming a field in one without the other fails a repo gate instead of a user's build. This stays
|
|
269
|
+
inside the package's zero-install-dependency promise — the compiler is borrowed from the workspace
|
|
270
|
+
when one is present, and the gate reports a named SKIP rather than a red when one is not.
|
|
271
|
+
|
|
187
272
|
## Settings
|
|
188
273
|
|
|
189
274
|
| key | default | effect |
|
|
@@ -197,6 +282,9 @@ degradation.
|
|
|
197
282
|
| `keyInjectAllowed` | `false` | allow `keyInput:"inject"` inside the takeover tier (keyboard only, foreground asserted) |
|
|
198
283
|
| `takeoverMaxMs` | `10000` | hard ceiling for one takeover action (500–60000); the HUD shows the clock |
|
|
199
284
|
| `takeoverArmMs` | `800` | length of the arming phase: the window in which you can cancel before anything moves |
|
|
285
|
+
| `snapshotMaxElements` | `300` | cap on elements per snapshot (1–5000); a tighter cap is a smaller frame for a deciding subagent |
|
|
286
|
+
| `screenshotMaxWidth` | `0` | downscale captures to this width; `0` means no scaling and `scale=1` — a resized image is a different coordinate system, so it is never chosen silently |
|
|
287
|
+
| `shotsKeep` | `10` | how many PNGs stay in `%LOCALAPPDATA%\wpm\shots`; older files are deleted after each capture |
|
|
200
288
|
|
|
201
289
|
## What measurement established
|
|
202
290
|
|