dsh-windows-parallel-mcp 0.4.1 → 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 +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 +202 -0
- package/CHANGELOG.pt.md +12 -0
- package/CHANGELOG.ru.md +12 -0
- package/CHANGELOG.zh.md +12 -0
- package/README.de.md +167 -11
- package/README.es.md +167 -11
- package/README.fr.md +167 -11
- package/README.it.md +167 -11
- package/README.ja.md +167 -11
- package/README.ko.md +167 -11
- package/README.md +167 -11
- package/README.pt.md +167 -11
- package/README.ru.md +167 -11
- package/README.zh.md +167 -11
- package/docs/refusals.md +7 -4
- package/dsh.plugin.json +3 -3
- package/lib/config.js +14 -0
- package/lib/host-tools.js +76 -3
- package/lib/index.js +295 -18
- package/package.json +6 -3
- package/src/engine/engine.ps1 +375 -6
- package/src/engine/win.ps1 +814 -3
- package/src/engine/worker.ps1 +40 -1
- package/src/schema/tools.json +118 -10
- package/types/index.d.ts +91 -4
package/src/engine/worker.ps1
CHANGED
|
@@ -129,6 +129,10 @@ while ($true) {
|
|
|
129
129
|
$r = Invoke-WpmAction -Hwnd ([string](Get-Arg $req 'hwnd' '')) -Action click `
|
|
130
130
|
-X ([int](Get-Arg $req 'x' -1)) -Y ([int](Get-Arg $req 'y' -1)) `
|
|
131
131
|
-SettleMs ([int](Get-Arg $req 'settleMs' 350)) `
|
|
132
|
+
-Space ([string](Get-Arg $req 'space' 'screen')) `
|
|
133
|
+
-ShotId ([string](Get-Arg $req 'shotId' '')) `
|
|
134
|
+
-Label ([int](Get-Arg $req 'label' 0)) `
|
|
135
|
+
-SnapId ([string](Get-Arg $req 'snapId' '')) `
|
|
132
136
|
-Takeover:([bool](Get-Arg $req 'takeover' $false)) `
|
|
133
137
|
-TakeoverMaxMs ([int](Get-Arg $req 'takeoverMaxMs' 10000)) `
|
|
134
138
|
-KeyInject:([bool](([string](Get-Arg $req 'keyInput' 'none')) -eq 'inject')) `
|
|
@@ -137,8 +141,15 @@ while ($true) {
|
|
|
137
141
|
Write-Response $id @{ id = $id; ok = $true; result = $r }
|
|
138
142
|
}
|
|
139
143
|
'type' {
|
|
144
|
+
# caretPosition is forwarded as given: the engine's ValidateSet is the single place that decides
|
|
145
|
+
# what values exist, and coercing an unknown value to 'idle' here would launder a caller bug into
|
|
146
|
+
# a silent behaviour change -- the write would go through at the wrong caret and look like a
|
|
147
|
+
# successful default. A bad value must fail loudly, at the one layer that owns the vocabulary.
|
|
140
148
|
$r = Invoke-WpmAction -Hwnd ([string](Get-Arg $req 'hwnd' '')) -Action type `
|
|
141
149
|
-Text ([string](Get-Arg $req 'text' '')) -ElementName ([string](Get-Arg $req 'elementName' '')) `
|
|
150
|
+
-Label ([int](Get-Arg $req 'label' 0)) `
|
|
151
|
+
-SnapId ([string](Get-Arg $req 'snapId' '')) `
|
|
152
|
+
-CaretPosition ([string](Get-Arg $req 'caretPosition' 'idle')) `
|
|
142
153
|
-Replace:([bool](Get-Arg $req 'replace' $false)) -SettleMs ([int](Get-Arg $req 'settleMs' 350)) `
|
|
143
154
|
-Takeover:([bool](Get-Arg $req 'takeover' $false)) `
|
|
144
155
|
-TakeoverMaxMs ([int](Get-Arg $req 'takeoverMaxMs' 10000)) `
|
|
@@ -149,11 +160,39 @@ while ($true) {
|
|
|
149
160
|
}
|
|
150
161
|
'focus' {
|
|
151
162
|
$r = Invoke-WpmAction -Hwnd ([string](Get-Arg $req 'hwnd' '')) -Action focus `
|
|
152
|
-
-ElementName ([string](Get-Arg $req 'elementName' ''))
|
|
163
|
+
-ElementName ([string](Get-Arg $req 'elementName' '')) `
|
|
164
|
+
-Label ([int](Get-Arg $req 'label' 0)) `
|
|
165
|
+
-SnapId ([string](Get-Arg $req 'snapId' '')) `
|
|
166
|
+
-SettleMs ([int](Get-Arg $req 'settleMs' 350)) `
|
|
153
167
|
-Takeover:([bool](Get-Arg $req 'takeover' $false)) `
|
|
154
168
|
-TakeoverMaxMs ([int](Get-Arg $req 'takeoverMaxMs' 10000))
|
|
155
169
|
Write-Response $id @{ id = $id; ok = $true; result = $r }
|
|
156
170
|
}
|
|
171
|
+
'snapshot' {
|
|
172
|
+
# Read path (0.5.0). The cap comes from the host settings (snapshotMaxElements), which sends it
|
|
173
|
+
# as maxElements; interactableOnly defaults ON because the whole point of the frame is to be
|
|
174
|
+
# small enough for a decision, not to be an exhaustive dump.
|
|
175
|
+
$r = Invoke-WpmAction -Hwnd ([string](Get-Arg $req 'hwnd' '')) -Action snapshot `
|
|
176
|
+
-MaxElements ([int](Get-Arg $req 'maxElements' 300)) `
|
|
177
|
+
-InteractableOnly ([bool](Get-Arg $req 'interactableOnly' $true)) `
|
|
178
|
+
-SinceSnapId ([string](Get-Arg $req 'sinceSnapId' '')) `
|
|
179
|
+
-Intent ([string](Get-Arg $req 'intent' ''))
|
|
180
|
+
Write-Response $id @{ id = $id; ok = $true; result = $r }
|
|
181
|
+
}
|
|
182
|
+
'screenshot' {
|
|
183
|
+
$r = Invoke-WpmAction -Hwnd ([string](Get-Arg $req 'hwnd' '')) -Action screenshot `
|
|
184
|
+
-FullScreen ([bool](Get-Arg $req 'fullScreen' $false)) `
|
|
185
|
+
-MaxWidth ([int](Get-Arg $req 'maxWidth' 0)) `
|
|
186
|
+
-ShotsKeep ([int](Get-Arg $req 'shotsKeep' 10))
|
|
187
|
+
Write-Response $id @{ id = $id; ok = $true; result = $r }
|
|
188
|
+
}
|
|
189
|
+
'preview' {
|
|
190
|
+
# Silent by construction: the marker is a click-through request and nothing is serialised into
|
|
191
|
+
# any input queue. No proof window is produced -- there is no action to prove.
|
|
192
|
+
$r = Invoke-WpmAction -Hwnd ([string](Get-Arg $req 'hwnd' '')) -Action preview `
|
|
193
|
+
-X ([int](Get-Arg $req 'x' -1)) -Y ([int](Get-Arg $req 'y' -1))
|
|
194
|
+
Write-Response $id @{ id = $id; ok = $true; result = $r }
|
|
195
|
+
}
|
|
157
196
|
'hud' {
|
|
158
197
|
# Product surface for tests and for the owner: start/stop the HUD on its own, so its window
|
|
159
198
|
# properties can be measured without an action in flight (test/hud-test.ps1).
|
package/src/schema/tools.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": "0.1.0",
|
|
3
|
-
"status": "form decided 2026-11-19: A = DSH native plugin (no MCP). The
|
|
3
|
+
"status": "form decided 2026-11-19: A = DSH native plugin (no MCP). The eight named tools below stay the canonical ACTION surface; the host projection (see hostProjection) exposes them as one tool with an action discriminator, which is this host's convention for a multi-action capability.",
|
|
4
4
|
"hostProjection": {
|
|
5
5
|
"form": "A",
|
|
6
6
|
"decided": "2026-11-19",
|
|
7
|
-
"why": "root cause: five resident tool schemas describing one engine is a standing per-turn token cost with no added capability; the host's own shell/terminal tools are one-tool-with-action. The action surface here is unchanged -- same
|
|
7
|
+
"why": "root cause: five resident tool schemas describing one engine is a standing per-turn token cost with no added capability; the host's own shell/terminal tools are one-tool-with-action. The action surface here is unchanged -- same actions, same arguments, same refusal codes (0.5.0 added three read-only actions to the SAME one tool, so the token argument still holds).",
|
|
8
8
|
"package": "dsh-windows-parallel-mcp",
|
|
9
9
|
"tool": "wpm",
|
|
10
10
|
"discriminator": "action",
|
|
@@ -14,7 +14,10 @@
|
|
|
14
14
|
"wpm_click": "click",
|
|
15
15
|
"wpm_type": "type",
|
|
16
16
|
"wpm_focus": "focus",
|
|
17
|
-
"wpm_status": "status"
|
|
17
|
+
"wpm_status": "status",
|
|
18
|
+
"wpm_snapshot": "snapshot",
|
|
19
|
+
"wpm_screenshot": "screenshot",
|
|
20
|
+
"wpm_preview": "preview"
|
|
18
21
|
},
|
|
19
22
|
"extraWorkerActions": [
|
|
20
23
|
{ "action": "ping", "exposed": false, "why": "protocol/encoding self-test; not part of the tool surface" },
|
|
@@ -22,10 +25,11 @@
|
|
|
22
25
|
]
|
|
23
26
|
},
|
|
24
27
|
"notes": [
|
|
25
|
-
"The
|
|
28
|
+
"The eight tool names are fixed here so both delivery forms expose the same action surface.",
|
|
26
29
|
"src/engine/engine.ps1 is the only implementation; this file is the contract, not a second implementation.",
|
|
27
30
|
"docs/refusals.md is the human-readable form of `refusals`; scripts/check-refusals.mjs keeps them equal.",
|
|
28
|
-
"The `refusalCases` array is executable: test/refusals-test.ps1 iterates it and binds the placeholders, so a documented refusal path cannot rot into fiction."
|
|
31
|
+
"The `refusalCases` array is executable: test/refusals-test.ps1 iterates it and binds the placeholders, so a documented refusal path cannot rot into fiction.",
|
|
32
|
+
"0.5.0 adds snapshot/screenshot/preview. They are READ paths: `snapshot` walks the accessibility tree and hands the model numbered `label`s, `screenshot` captures the window rect and returns the coordinate mapping as data, `preview` draws the marker at a point and reports the element UNDER it as text. No new input primitive, no automatic fallback chain -- the model decides."
|
|
29
33
|
],
|
|
30
34
|
"stance": {
|
|
31
35
|
"inputQueue": "quiet and bounded-flash tiers write nothing to the OS input queue. The takeover tier (opt-in, takeoverAllowed) may send KEYBOARD input (SendInput + KEYEVENTF_UNICODE) only when keyInput='inject' was requested; mouse injection is structurally impossible (MOUSEEVENTF_* is banned repo-wide and the gate enforces it)",
|
|
@@ -47,6 +51,7 @@
|
|
|
47
51
|
{ "code": "takeover_unavailable", "layer": "decision", "summary": "takeover was requested but cannot run safely: the takeoverAllowed gate is off or the HUD is not up. The request is refused rather than silently downgraded" },
|
|
48
52
|
{ "code": "keyinject_unavailable", "layer": "decision", "summary": "keyboard injection was requested outside the takeover tier, with the keyInjectAllowed gate off, or with the target not in the foreground (SendInput writes to the foreground, so a blind injection would type into another application)" },
|
|
49
53
|
{ "code": "action_failed", "layer": "runtime", "summary": "the chosen channel threw while acting", "uncoveredReason": "needs a target whose channel reliably throws; not constructed this round (docs/refusals.md, gap 2)" },
|
|
54
|
+
{ "code": "stale_ref", "layer": "runtime", "summary": "the call names a previous generation of engine output that no longer exists: a shotId that was cleaned up, a label whose snapId was superseded, or space:'image' without any shotId. Read paths are cheap; re-take the snapshot/screenshot and act on the new ids instead of substituting coordinates" },
|
|
50
55
|
{ "code": "restore_failed", "layer": "runtime", "summary": "the OS refused to return the foreground after a flash", "uncoveredReason": "needs a real elevated window; task_52 (docs/refusals.md, gap 2)" },
|
|
51
56
|
{ "code": "takeover_aborted", "layer": "runtime", "summary": "the owner or the host interrupted a takeover (HUD button, abort chord, host cancellation). Not a fault: the result still carries cursorRestored and injectedChars so the reader knows exactly how far it got", "uncoveredReason": "fires from a real interruption inside a live takeover action; test/takeover-test.ps1 covers the three interruption paths at the engine level (volatile flag, latch file, and the send-time abort probe), and the schema case is declared uncovered because the refusal vocabulary gate needs an executable decision-mode instance and this is a runtime outcome" }
|
|
52
57
|
],
|
|
@@ -69,13 +74,17 @@
|
|
|
69
74
|
"name": "wpm_click",
|
|
70
75
|
"action": "click",
|
|
71
76
|
"engine": "Invoke-WpmAction -Action click",
|
|
72
|
-
"description": "Click at a screen coordinate inside the named window
|
|
77
|
+
"description": "Click at a screen coordinate inside the named window, or at the element named by a snapshot `label`. Chooses the cheapest available door: a classic child window receives the click as a window message (quiet tier, measured 0/6 foreground changes), otherwise a UIA pattern is used and the foreground is reversed once afterwards (bounded-flash tier, measured net return 15..95 ms). The cursor does not move in either tier. With `space:\"image\"` the coordinates are IMAGE pixels from a `screenshot` and the engine converts them back to screen pixels -- the caller never multiplies a scale factor.",
|
|
73
78
|
"inputSchema": {
|
|
74
79
|
"type": "object",
|
|
75
80
|
"properties": {
|
|
76
81
|
"hwnd": { "type": "string", "description": "Target top-level window handle, as returned by wpm_windows." },
|
|
77
|
-
"x": { "type": "integer", "description": "Screen X coordinate. Must resolve to a child window of the target, otherwise the action is refused instead of being sent somewhere else." },
|
|
78
|
-
"y": { "type": "integer", "description": "Screen Y coordinate." },
|
|
82
|
+
"x": { "type": "integer", "description": "Screen X coordinate (or image X with space:'image'). Must resolve to a child window of the target, otherwise the action is refused instead of being sent somewhere else." },
|
|
83
|
+
"y": { "type": "integer", "description": "Screen Y coordinate (or image Y with space:'image')." },
|
|
84
|
+
"space": { "type": "string", "enum": ["screen", "image"], "default": "screen", "description": "Coordinate space of x/y. 'screen' (default) is physical screen pixels. 'image' means image pixels from the screenshot named by shotId; the engine converts them and still applies the point-ownership assertion, so a conversion bug cannot send the click to another window." },
|
|
85
|
+
"shotId": { "type": "string", "description": "The shotId returned by wpm_screenshot. Required when space:'image' (a pre-worker refusal otherwise); an id that was already cleaned up is refused with stale_ref rather than reinterpreted." },
|
|
86
|
+
"label": { "type": "integer", "minimum": 1, "description": "Element number from wpm_snapshot. Act on that element through its UIA pattern instead of guessing from the point. x/y are still required and must fall inside the labelled element's rect, so 'the point is the contract' stays true." },
|
|
87
|
+
"snapId": { "type": "string", "description": "The snapId the label came from. A label whose snapId has been superseded is refused with stale_ref -- element numbers are only meaningful for the frame they were printed in." },
|
|
79
88
|
"settleMs": { "type": "integer", "minimum": 0, "maximum": 2000, "default": 350, "description": "How long to let the app commit its state before the effect is judged." },
|
|
80
89
|
"takeover": { "type": "boolean", "default": false, "description": "Take the takeover tier: the real cursor moves to the action point and is always restored, the focus is held until the action ends, and a three-phase HUD is mandatory. Requires the takeoverAllowed setting or the call is refused with takeover_unavailable." },
|
|
81
90
|
"takeoverMaxMs": { "type": "integer", "minimum": 500, "maximum": 60000, "default": 10000, "description": "Takeover only: how long the action may hold the cursor/focus." }
|
|
@@ -83,20 +92,23 @@
|
|
|
83
92
|
"required": ["hwnd", "x", "y"],
|
|
84
93
|
"additionalProperties": false
|
|
85
94
|
},
|
|
86
|
-
"refusals": ["no_hwnd", "paused", "elevated_target", "unreachable", "uia_tree_empty", "uia_probe_failed", "terminal_no_door", "action_failed", "restore_failed", "takeover_unavailable", "keyinject_unavailable", "takeover_aborted"]
|
|
95
|
+
"refusals": ["no_hwnd", "paused", "elevated_target", "unreachable", "uia_tree_empty", "uia_probe_failed", "terminal_no_door", "stale_ref", "action_failed", "restore_failed", "takeover_unavailable", "keyinject_unavailable", "takeover_aborted"]
|
|
87
96
|
},
|
|
88
97
|
{
|
|
89
98
|
"name": "wpm_type",
|
|
90
99
|
"action": "type",
|
|
91
100
|
"engine": "Invoke-WpmAction -Action type",
|
|
92
|
-
"description": "Write text into the named window: either the first editable classic child (quiet tier) or a UIA element named by the caller (bounded-flash tier). No keystrokes are synthesized; the text is delivered through the window message or the pattern itself.",
|
|
101
|
+
"description": "Write text into the named window: either the first editable classic child (quiet tier) or a UIA element named by the caller (bounded-flash tier). No keystrokes are synthesized; the text is delivered through the window message or the pattern itself. WHAT HAPPENS AFTER THE WRITE IS READ BACK: the engine reads the control's value again (WM_GETTEXT on the message door, ValuePattern/LegacyIAccessible Current.Value on UIA) and only reports effect=readback-verified when the value it read equals the value predicted from what the control itself reported. A field that does not expose its text yields readback=unavailable and no upgrade; a value that came back different yields readbackMismatch=true while the effect stays what the write earned -- the application may legitimately reformat input, so a mismatch is data, not a refusal.",
|
|
93
102
|
"inputSchema": {
|
|
94
103
|
"type": "object",
|
|
95
104
|
"properties": {
|
|
96
105
|
"hwnd": { "type": "string", "description": "Target top-level window handle." },
|
|
97
106
|
"text": { "type": "string", "description": "Text to write. Empty string is refused: it cannot be distinguished from a channel that silently did nothing." },
|
|
98
107
|
"elementName": { "type": "string", "description": "Optional UIA Name or AutomationId of the control to write into. Naming an element forces the UIA tier, because a message tier cannot address 'the control called X'." },
|
|
108
|
+
"label": { "type": "integer", "minimum": 1, "description": "Element number from wpm_snapshot: write into that element through its UIA pattern. A faster, unambiguous alternative to elementName on a tree you have already read." },
|
|
109
|
+
"snapId": { "type": "string", "description": "The snapId the label came from; a superseded snapId is refused with stale_ref." },
|
|
99
110
|
"replace": { "type": "boolean", "default": false, "description": "Replace the existing value instead of appending to it." },
|
|
111
|
+
"caretPosition": { "type": "string", "enum": ["idle", "start", "end"], "default": "idle", "description": "Message door only: where the caret should be before the characters are sent. 'idle' touches nothing (the caret is wherever the control left it, which for a never-focused field is position 0 -- measured). 'start' is EM_SETSEL(0,0); 'end' is EM_SETSEL(len,len) with len read from the control, because EM_SETSEL(-1,-1) is documented as document-end and measured as no-op on WinForms EDIT. On a value containing newlines the numeric end can land inside the buffer, so the result reports the requested and the applied pair and the readback judges. The UIA value channel replaces the whole value and has no caret to move: it answers caretIgnored=value-pattern instead of pretending." },
|
|
100
112
|
"settleMs": { "type": "integer", "minimum": 0, "maximum": 2000, "default": 350, "description": "How long to let the app commit its state before the effect is judged." },
|
|
101
113
|
"takeover": { "type": "boolean", "default": false, "description": "Take the takeover tier: the HUD is shown, the focus is held until the action ends, and (with keyInput) text may be typed into the foreground target." },
|
|
102
114
|
"takeoverMaxMs": { "type": "integer", "minimum": 500, "maximum": 60000, "default": 10000, "description": "Takeover only: how long the action may hold the cursor/focus." },
|
|
@@ -105,6 +117,7 @@
|
|
|
105
117
|
"required": ["hwnd", "text"],
|
|
106
118
|
"additionalProperties": false
|
|
107
119
|
},
|
|
120
|
+
"notes_0_6_0": "0.6.0 adds readback + caretPosition and changes nothing in this refusals list: disabled targets, focus movement and a mismatching readback are reported in detail/effect, not as new codes -- they are states of the target, not errors in the call.",
|
|
108
121
|
"refusals": ["no_hwnd", "paused", "elevated_target", "unreachable", "uia_tree_empty", "uia_probe_failed", "terminal_no_door", "action_failed", "restore_failed", "takeover_unavailable", "keyinject_unavailable", "takeover_aborted"]
|
|
109
122
|
},
|
|
110
123
|
{
|
|
@@ -117,6 +130,8 @@
|
|
|
117
130
|
"properties": {
|
|
118
131
|
"hwnd": { "type": "string", "description": "Target top-level window handle." },
|
|
119
132
|
"elementName": { "type": "string", "description": "UIA Name or AutomationId of the control that should hold focus." },
|
|
133
|
+
"label": { "type": "integer", "minimum": 1, "description": "Element number from wpm_snapshot: focus that element. A faster, unambiguous alternative to elementName on a tree you have already read." },
|
|
134
|
+
"snapId": { "type": "string", "description": "The snapId the label came from; a superseded snapId is refused with stale_ref." },
|
|
120
135
|
"settleMs": { "type": "integer", "minimum": 0, "maximum": 2000, "default": 350, "description": "How long to let the app commit its state before the effect is judged." },
|
|
121
136
|
"takeover": { "type": "boolean", "default": false, "description": "Take the takeover tier: the HUD is shown and the focus is held until the action ends, then restored. Requires the takeoverAllowed setting." },
|
|
122
137
|
"takeoverMaxMs": { "type": "integer", "minimum": 500, "maximum": 60000, "default": 10000, "description": "Takeover only: how long the action may hold the cursor/focus." }
|
|
@@ -139,6 +154,59 @@
|
|
|
139
154
|
},
|
|
140
155
|
"refusals": [],
|
|
141
156
|
"noRefusalReason": "pure query: it reads the focus table and returns it. There is no target to refuse, and inventing a refusal code for this tool would create a branch that can never be exercised."
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"name": "wpm_snapshot",
|
|
160
|
+
"action": "snapshot",
|
|
161
|
+
"engine": "Invoke-WpmAction -Action snapshot",
|
|
162
|
+
"description": "Read the target's accessibility tree as a NUMBERED element table: one line per element with a continuous `label`, its control type, name, automation id, screen rect (physical pixels) and the UIA patterns it exposes. This is the frame the model reasons on and the label it answers with -- pass `label`+`snapId` to click/type/focus instead of guessing coordinates. The labels are resolved back to the ELEMENT (by UIA RuntimeId, measured stable across queries), so an action taken by label still uses the silent UIA pattern path and never degrades into a coordinate click. Read-only: no input, no focus change, no proof window. '0 element(s)' is a real answer (measured on windows that disable UI Automation) and is reported as such, not as a failure.",
|
|
163
|
+
"inputSchema": {
|
|
164
|
+
"type": "object",
|
|
165
|
+
"properties": {
|
|
166
|
+
"hwnd": { "type": "string", "description": "Target top-level window handle from wpm_windows." },
|
|
167
|
+
"maxElements": { "type": "integer", "minimum": 1, "maximum": 5000, "default": 300, "description": "Hard cap on returned elements; the text then says 'truncated at N of M' and `truncated` is true. Measured trees: 71 visible elements for an 816-node Electron window, so the default is deliberately loose." },
|
|
168
|
+
"interactableOnly": { "type": "boolean", "default": true, "description": "Return only elements that expose a usable UIA pattern (the zero-cost first pass at a giant tree). Set false to see the whole visible tree, chrome included." },
|
|
169
|
+
"sinceSnapId": { "type": "string", "description": "Report an incremental diff against this earlier snapId instead of re-describing every element: added / removed / changed, keyed by UIA RuntimeId. An unchanged tree produces an empty delta, which is the point -- repeating an unchanged table is the main token cost of a multi-step flow." },
|
|
170
|
+
"intent": { "type": "string", "description": "What this frame is FOR (e.g. 'close the settings dialog'). It travels with the frame so a clean deciding subagent gets the goal and the numbered table together and answers with one label." }
|
|
171
|
+
},
|
|
172
|
+
"required": ["hwnd"],
|
|
173
|
+
"additionalProperties": false
|
|
174
|
+
},
|
|
175
|
+
"refusals": ["no_hwnd", "paused", "uia_probe_failed", "stale_ref"]
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"name": "wpm_screenshot",
|
|
179
|
+
"action": "screenshot",
|
|
180
|
+
"engine": "Invoke-WpmAction -Action screenshot",
|
|
181
|
+
"description": "Capture the target's screen rectangle to a PNG on disk and return the COORDINATE MAPPING as data: screenRect, imageSize, scale, identity, frame and dpiAware. The image is not returned inline (a plugin cannot mint an inline image block without the host's attachment service); write it to disk and read it with the host's image reader. The point of this action is not the picture -- it is that the caller never has to multiply a scale factor itself: hand the image coordinates straight back to click with space:'image' and the engine does the conversion, then still asserts that the point belongs to the target.",
|
|
182
|
+
"inputSchema": {
|
|
183
|
+
"type": "object",
|
|
184
|
+
"properties": {
|
|
185
|
+
"hwnd": { "type": "string", "description": "Target top-level window handle from wpm_windows. Required unless fullScreen is true." },
|
|
186
|
+
"fullScreen": { "type": "boolean", "default": false, "description": "Capture the whole virtual screen instead of one window. Off by default on purpose: silently capturing the owner's entire desktop is exactly the kind of quiet overreach this product refuses elsewhere." },
|
|
187
|
+
"maxWidth": { "type": "integer", "minimum": 0, "maximum": 7680, "default": 0, "description": "Downscale the saved image to at most this width. 0 (default) means scale=1 and identity=true -- no silent resampling, because a resized image is a CHANGED coordinate system and this action exists to make coordinates honest." }
|
|
188
|
+
},
|
|
189
|
+
"required": [],
|
|
190
|
+
"additionalProperties": false
|
|
191
|
+
},
|
|
192
|
+
"refusals": ["no_hwnd", "paused"]
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"name": "wpm_preview",
|
|
196
|
+
"action": "preview",
|
|
197
|
+
"engine": "Invoke-WpmAction -Action preview",
|
|
198
|
+
"description": "Show the owner where a click WOULD land, without clicking: draw the AI marker at the point (when the overlay is up) and report, as text, which element sits under it (name, control type, automation id, rect). This turns an irreversible click into a reviewable one, and it makes confirmation independent of vision -- the answer is what the OS says is at that point, not a guess from a picture. Silent by construction: it writes no input queue entry, takes no focus, and produces no proof window. Use it before a destructive click, or as the confirmation step after reading a snapshot.",
|
|
199
|
+
"inputSchema": {
|
|
200
|
+
"type": "object",
|
|
201
|
+
"properties": {
|
|
202
|
+
"hwnd": { "type": "string", "description": "Target top-level window handle from wpm_windows." },
|
|
203
|
+
"x": { "type": "integer", "description": "Screen X coordinate to preview. Must belong to the target window, otherwise the call is refused instead of reporting an element from another application." },
|
|
204
|
+
"y": { "type": "integer", "description": "Screen Y coordinate to preview." }
|
|
205
|
+
},
|
|
206
|
+
"required": ["hwnd", "x", "y"],
|
|
207
|
+
"additionalProperties": false
|
|
208
|
+
},
|
|
209
|
+
"refusals": ["no_hwnd", "paused", "unreachable"]
|
|
142
210
|
}
|
|
143
211
|
],
|
|
144
212
|
"refusalCases": [
|
|
@@ -150,6 +218,46 @@
|
|
|
150
218
|
"expect": "no_hwnd",
|
|
151
219
|
"note": "A handle that does not identify a live window. Measured, no window is touched."
|
|
152
220
|
},
|
|
221
|
+
{
|
|
222
|
+
"id": "click-stale-shot",
|
|
223
|
+
"mode": "engine",
|
|
224
|
+
"tool": "wpm_click",
|
|
225
|
+
"args": { "hwnd": "$liveHwnd", "x": 100, "y": 100, "space": "image", "shotId": "wpm-shot-0000-nonexistent" },
|
|
226
|
+
"expect": "stale_ref",
|
|
227
|
+
"note": "space:'image' names a shotId the engine never issued. The engine refuses instead of reinterpreting the image pixels as screen pixels -- substituting the raw numbers would click somewhere plausibly wrong, which is the failure class this code exists for. Measured: the call never reaches the door probe."
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
"id": "preview-outside-target",
|
|
231
|
+
"mode": "engine",
|
|
232
|
+
"tool": "wpm_preview",
|
|
233
|
+
"args": { "hwnd": "$winformsHwnd", "x": 2, "y": 2 },
|
|
234
|
+
"expect": "unreachable",
|
|
235
|
+
"note": "The refusal-test target is placed at 60,60, so (2,2) is outside it. A preview point that belongs to another window must be refused, not answered with that window's element: reporting 'you would click the desktop' and drawing the marker there would make the preview the one place this product guesses about a point it was not given. This is also the executable instance of `unreachable` (the two named-element-miss cases cannot run on this host: the WinForms positive control currently surfaces its controls as bare Panes through the legacy MSAA bridge, see findings.md)."
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"id": "snapshot-dead-hwnd",
|
|
239
|
+
"mode": "engine",
|
|
240
|
+
"tool": "wpm_snapshot",
|
|
241
|
+
"args": { "hwnd": "$deadHwnd" },
|
|
242
|
+
"expect": "no_hwnd",
|
|
243
|
+
"note": "A snapshot needs a live window: there is no tree to number. Same handle as the click case, and zero elements/patterns are touched."
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"id": "screenshot-dead-hwnd",
|
|
247
|
+
"mode": "engine",
|
|
248
|
+
"tool": "wpm_screenshot",
|
|
249
|
+
"args": { "hwnd": "$deadHwnd" },
|
|
250
|
+
"expect": "no_hwnd",
|
|
251
|
+
"note": "Same reason as snapshot. fullScreen:true is the only path that does not need a window, and this case does not pass it."
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"id": "preview-dead-hwnd",
|
|
255
|
+
"mode": "engine",
|
|
256
|
+
"tool": "wpm_preview",
|
|
257
|
+
"args": { "hwnd": "$deadHwnd", "x": 100, "y": 100 },
|
|
258
|
+
"expect": "no_hwnd",
|
|
259
|
+
"note": "A preview point that belongs to no named window has nothing to report and nothing to draw, so it refuses rather than looking up whatever application happens to own that pixel."
|
|
260
|
+
},
|
|
153
261
|
{
|
|
154
262
|
"id": "click-while-paused",
|
|
155
263
|
"mode": "engine",
|
package/types/index.d.ts
CHANGED
|
@@ -1,21 +1,76 @@
|
|
|
1
1
|
// Type declarations for dsh-windows-parallel-mcp (public API surface).
|
|
2
|
-
// Mirrors lib/index.js + lib/host-tools.js + src/schema/tools.json (v0.
|
|
2
|
+
// Mirrors lib/index.js + lib/host-tools.js + src/schema/tools.json (v0.6.0).
|
|
3
3
|
|
|
4
|
-
export type WpmAction =
|
|
4
|
+
export type WpmAction =
|
|
5
|
+
| 'windows' | 'click' | 'type' | 'focus' | 'status'
|
|
6
|
+
| 'snapshot' | 'screenshot' | 'preview';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* WHO REPORTED THE SUCCESS. The first three name a messenger, not a degree of confidence (see the
|
|
10
|
+
* `effect` block in lib/index.js). `readback-verified` is the fourth and the only one that is about the
|
|
11
|
+
* application rather than about the call: the value was read back after the settle window and equals
|
|
12
|
+
* what the control's own measurements predicted. A masked field never reaches it (readback=unavailable)
|
|
13
|
+
* and a reformatted value never reaches it (readbackMismatch=true) -- the engine does not upgrade on
|
|
14
|
+
* "the call came back".
|
|
15
|
+
*/
|
|
16
|
+
export type WpmEffect =
|
|
17
|
+
| 'unverified' | 'reported-by-send' | 'reported-by-pattern' | 'readback-verified';
|
|
18
|
+
|
|
19
|
+
/** Where the caret sits before the message door types. `idle` touches nothing. */
|
|
20
|
+
export type WpmCaretPosition = 'idle' | 'start' | 'end';
|
|
5
21
|
|
|
6
22
|
export type RefusalCode =
|
|
7
23
|
| 'no_hwnd' | 'paused' | 'elevated_target' | 'unreachable'
|
|
8
24
|
| 'uia_tree_empty' | 'uia_probe_failed' | 'terminal_no_door' | 'needs_facts'
|
|
9
25
|
| 'takeover_unavailable' | 'keyinject_unavailable' | 'action_failed'
|
|
10
|
-
| 'restore_failed' | 'takeover_aborted';
|
|
26
|
+
| 'restore_failed' | 'takeover_aborted' | 'stale_ref';
|
|
11
27
|
|
|
12
28
|
export type KeyInputMode = 'none' | 'inject';
|
|
13
29
|
|
|
30
|
+
/** Coordinate space of a click's x/y. `image` means image pixels from a `screenshot`. */
|
|
31
|
+
export type WpmPointSpace = 'screen' | 'image';
|
|
32
|
+
|
|
33
|
+
/** Frame source of a captured screenRect. `dwm` is the DWM extended frame; `win32` is the fallback. */
|
|
34
|
+
export type WpmFrameSource = 'dwm' | 'win32';
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* WHICH CAPTURE PATH produced a screenshot. `bitblt` is the cheap GDI path (measured 16-21ms against
|
|
38
|
+
* 22-33ms for the other); `gdiplus` is `Graphics.CopyFromScreen`, either the explicit choice or the
|
|
39
|
+
* fallback after BitBlt was refused. The two are measured equivalent on a still scene, but they are not
|
|
40
|
+
* the same call and the field is never omitted -- a path that changed silently is the failure mode this
|
|
41
|
+
* repo has already been caught by once with `frame`.
|
|
42
|
+
*/
|
|
43
|
+
export type WpmCaptureBackend = 'bitblt' | 'gdiplus';
|
|
44
|
+
|
|
14
45
|
export interface WpmWindow {
|
|
15
46
|
hwnd: string; title: string; class: string; pid: number;
|
|
16
47
|
rect: { left: number; top: number; right: number; bottom: number };
|
|
17
48
|
}
|
|
18
49
|
|
|
50
|
+
/** One numbered element in a `snapshot` frame. */
|
|
51
|
+
export interface WpmSnapshotElement {
|
|
52
|
+
label: number;
|
|
53
|
+
controlType: string;
|
|
54
|
+
name: string;
|
|
55
|
+
automationId: string;
|
|
56
|
+
rect: { left: number; top: number; right: number; bottom: number };
|
|
57
|
+
patterns: string[];
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** One delivered screenshot, with the mapping that makes its pixels addressable. */
|
|
61
|
+
export interface WpmShot {
|
|
62
|
+
file: string;
|
|
63
|
+
shotId: string;
|
|
64
|
+
screenRect: { left: number; top: number; right: number; bottom: number };
|
|
65
|
+
imageSize: { width: number; height: number };
|
|
66
|
+
/** image pixels per screen pixel; 1 when identity. screen = rect + round(image / scale). */
|
|
67
|
+
scale: number;
|
|
68
|
+
identity: boolean;
|
|
69
|
+
frame: WpmFrameSource;
|
|
70
|
+
captureBackend?: WpmCaptureBackend;
|
|
71
|
+
dpiAware: boolean;
|
|
72
|
+
}
|
|
73
|
+
|
|
19
74
|
export interface WpmArgs {
|
|
20
75
|
action: WpmAction;
|
|
21
76
|
hwnd?: string;
|
|
@@ -24,10 +79,22 @@ export interface WpmArgs {
|
|
|
24
79
|
text?: string;
|
|
25
80
|
elementName?: string;
|
|
26
81
|
replace?: boolean;
|
|
82
|
+
caretPosition?: WpmCaretPosition;
|
|
27
83
|
settleMs?: number;
|
|
28
84
|
takeover?: boolean;
|
|
29
85
|
takeoverMaxMs?: number;
|
|
30
86
|
keyInput?: KeyInputMode;
|
|
87
|
+
// ---- 0.5.0: snapshot / screenshot / preview / label addressing ----
|
|
88
|
+
space?: WpmPointSpace;
|
|
89
|
+
shotId?: string;
|
|
90
|
+
label?: number;
|
|
91
|
+
snapId?: string;
|
|
92
|
+
maxElements?: number;
|
|
93
|
+
interactableOnly?: boolean;
|
|
94
|
+
sinceSnapId?: string;
|
|
95
|
+
intent?: string;
|
|
96
|
+
fullScreen?: boolean;
|
|
97
|
+
maxWidth?: number;
|
|
31
98
|
}
|
|
32
99
|
|
|
33
100
|
export interface WpmResult {
|
|
@@ -35,7 +102,7 @@ export interface WpmResult {
|
|
|
35
102
|
refusal?: RefusalCode;
|
|
36
103
|
channel?: string;
|
|
37
104
|
tier?: string;
|
|
38
|
-
effect?:
|
|
105
|
+
effect?: WpmEffect;
|
|
39
106
|
proof?: 'pass' | 'fail' | 'inconclusive';
|
|
40
107
|
focusTaken?: boolean;
|
|
41
108
|
takeover?: 'on' | 'off';
|
|
@@ -45,6 +112,26 @@ export interface WpmResult {
|
|
|
45
112
|
abortChord?: string;
|
|
46
113
|
keysInjected?: boolean;
|
|
47
114
|
injectedChars?: number;
|
|
115
|
+
// ---- snapshot ----
|
|
116
|
+
snapId?: string;
|
|
117
|
+
elements?: WpmSnapshotElement[];
|
|
118
|
+
count?: number;
|
|
119
|
+
truncated?: boolean;
|
|
120
|
+
frameCheck?: 'pass' | 'fail';
|
|
121
|
+
intent?: string;
|
|
122
|
+
// ---- screenshot ----
|
|
123
|
+
shotId?: string;
|
|
124
|
+
file?: string;
|
|
125
|
+
screenRect?: { left: number; top: number; right: number; bottom: number };
|
|
126
|
+
imageSize?: { width: number; height: number };
|
|
127
|
+
scale?: number;
|
|
128
|
+
identity?: boolean;
|
|
129
|
+
frame?: WpmFrameSource;
|
|
130
|
+
captureBackend?: WpmCaptureBackend;
|
|
131
|
+
captureNote?: string;
|
|
132
|
+
dpiAware?: boolean;
|
|
133
|
+
// ---- preview ----
|
|
134
|
+
preview?: { x: number; y: number; name: string; controlType: string; automationId: string };
|
|
48
135
|
[key: string]: unknown;
|
|
49
136
|
}
|
|
50
137
|
|