dsh-windows-parallel-mcp 0.4.1 → 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 +6 -0
- package/CHANGELOG.es.md +6 -0
- package/CHANGELOG.fr.md +6 -0
- package/CHANGELOG.it.md +6 -0
- package/CHANGELOG.ja.md +6 -0
- package/CHANGELOG.ko.md +6 -0
- package/CHANGELOG.md +123 -0
- package/CHANGELOG.pt.md +6 -0
- package/CHANGELOG.ru.md +6 -0
- package/CHANGELOG.zh.md +6 -0
- package/README.de.md +77 -10
- package/README.es.md +77 -10
- package/README.fr.md +77 -10
- package/README.it.md +77 -10
- package/README.ja.md +77 -10
- package/README.ko.md +77 -10
- package/README.md +77 -10
- package/README.pt.md +77 -10
- package/README.ru.md +77 -10
- package/README.zh.md +77 -10
- 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/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,7 +92,7 @@
|
|
|
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",
|
|
@@ -96,6 +105,8 @@
|
|
|
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." },
|
|
100
111
|
"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
112
|
"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." },
|
|
@@ -117,6 +128,8 @@
|
|
|
117
128
|
"properties": {
|
|
118
129
|
"hwnd": { "type": "string", "description": "Target top-level window handle." },
|
|
119
130
|
"elementName": { "type": "string", "description": "UIA Name or AutomationId of the control that should hold focus." },
|
|
131
|
+
"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." },
|
|
132
|
+
"snapId": { "type": "string", "description": "The snapId the label came from; a superseded snapId is refused with stale_ref." },
|
|
120
133
|
"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
134
|
"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
135
|
"takeoverMaxMs": { "type": "integer", "minimum": 500, "maximum": 60000, "default": 10000, "description": "Takeover only: how long the action may hold the cursor/focus." }
|
|
@@ -139,6 +152,59 @@
|
|
|
139
152
|
},
|
|
140
153
|
"refusals": [],
|
|
141
154
|
"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."
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"name": "wpm_snapshot",
|
|
158
|
+
"action": "snapshot",
|
|
159
|
+
"engine": "Invoke-WpmAction -Action snapshot",
|
|
160
|
+
"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.",
|
|
161
|
+
"inputSchema": {
|
|
162
|
+
"type": "object",
|
|
163
|
+
"properties": {
|
|
164
|
+
"hwnd": { "type": "string", "description": "Target top-level window handle from wpm_windows." },
|
|
165
|
+
"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." },
|
|
166
|
+
"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." },
|
|
167
|
+
"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." },
|
|
168
|
+
"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." }
|
|
169
|
+
},
|
|
170
|
+
"required": ["hwnd"],
|
|
171
|
+
"additionalProperties": false
|
|
172
|
+
},
|
|
173
|
+
"refusals": ["no_hwnd", "paused", "uia_probe_failed", "stale_ref"]
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
"name": "wpm_screenshot",
|
|
177
|
+
"action": "screenshot",
|
|
178
|
+
"engine": "Invoke-WpmAction -Action screenshot",
|
|
179
|
+
"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.",
|
|
180
|
+
"inputSchema": {
|
|
181
|
+
"type": "object",
|
|
182
|
+
"properties": {
|
|
183
|
+
"hwnd": { "type": "string", "description": "Target top-level window handle from wpm_windows. Required unless fullScreen is true." },
|
|
184
|
+
"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." },
|
|
185
|
+
"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." }
|
|
186
|
+
},
|
|
187
|
+
"required": [],
|
|
188
|
+
"additionalProperties": false
|
|
189
|
+
},
|
|
190
|
+
"refusals": ["no_hwnd", "paused"]
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"name": "wpm_preview",
|
|
194
|
+
"action": "preview",
|
|
195
|
+
"engine": "Invoke-WpmAction -Action preview",
|
|
196
|
+
"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.",
|
|
197
|
+
"inputSchema": {
|
|
198
|
+
"type": "object",
|
|
199
|
+
"properties": {
|
|
200
|
+
"hwnd": { "type": "string", "description": "Target top-level window handle from wpm_windows." },
|
|
201
|
+
"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." },
|
|
202
|
+
"y": { "type": "integer", "description": "Screen Y coordinate to preview." }
|
|
203
|
+
},
|
|
204
|
+
"required": ["hwnd", "x", "y"],
|
|
205
|
+
"additionalProperties": false
|
|
206
|
+
},
|
|
207
|
+
"refusals": ["no_hwnd", "paused", "unreachable"]
|
|
142
208
|
}
|
|
143
209
|
],
|
|
144
210
|
"refusalCases": [
|
|
@@ -150,6 +216,46 @@
|
|
|
150
216
|
"expect": "no_hwnd",
|
|
151
217
|
"note": "A handle that does not identify a live window. Measured, no window is touched."
|
|
152
218
|
},
|
|
219
|
+
{
|
|
220
|
+
"id": "click-stale-shot",
|
|
221
|
+
"mode": "engine",
|
|
222
|
+
"tool": "wpm_click",
|
|
223
|
+
"args": { "hwnd": "$liveHwnd", "x": 100, "y": 100, "space": "image", "shotId": "wpm-shot-0000-nonexistent" },
|
|
224
|
+
"expect": "stale_ref",
|
|
225
|
+
"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."
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"id": "preview-outside-target",
|
|
229
|
+
"mode": "engine",
|
|
230
|
+
"tool": "wpm_preview",
|
|
231
|
+
"args": { "hwnd": "$winformsHwnd", "x": 2, "y": 2 },
|
|
232
|
+
"expect": "unreachable",
|
|
233
|
+
"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)."
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"id": "snapshot-dead-hwnd",
|
|
237
|
+
"mode": "engine",
|
|
238
|
+
"tool": "wpm_snapshot",
|
|
239
|
+
"args": { "hwnd": "$deadHwnd" },
|
|
240
|
+
"expect": "no_hwnd",
|
|
241
|
+
"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."
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
"id": "screenshot-dead-hwnd",
|
|
245
|
+
"mode": "engine",
|
|
246
|
+
"tool": "wpm_screenshot",
|
|
247
|
+
"args": { "hwnd": "$deadHwnd" },
|
|
248
|
+
"expect": "no_hwnd",
|
|
249
|
+
"note": "Same reason as snapshot. fullScreen:true is the only path that does not need a window, and this case does not pass it."
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"id": "preview-dead-hwnd",
|
|
253
|
+
"mode": "engine",
|
|
254
|
+
"tool": "wpm_preview",
|
|
255
|
+
"args": { "hwnd": "$deadHwnd", "x": 100, "y": 100 },
|
|
256
|
+
"expect": "no_hwnd",
|
|
257
|
+
"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."
|
|
258
|
+
},
|
|
153
259
|
{
|
|
154
260
|
"id": "click-while-paused",
|
|
155
261
|
"mode": "engine",
|
package/types/index.d.ts
CHANGED
|
@@ -1,21 +1,52 @@
|
|
|
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.5.0).
|
|
3
3
|
|
|
4
|
-
export type WpmAction =
|
|
4
|
+
export type WpmAction =
|
|
5
|
+
| 'windows' | 'click' | 'type' | 'focus' | 'status'
|
|
6
|
+
| 'snapshot' | 'screenshot' | 'preview';
|
|
5
7
|
|
|
6
8
|
export type RefusalCode =
|
|
7
9
|
| 'no_hwnd' | 'paused' | 'elevated_target' | 'unreachable'
|
|
8
10
|
| 'uia_tree_empty' | 'uia_probe_failed' | 'terminal_no_door' | 'needs_facts'
|
|
9
11
|
| 'takeover_unavailable' | 'keyinject_unavailable' | 'action_failed'
|
|
10
|
-
| 'restore_failed' | 'takeover_aborted';
|
|
12
|
+
| 'restore_failed' | 'takeover_aborted' | 'stale_ref';
|
|
11
13
|
|
|
12
14
|
export type KeyInputMode = 'none' | 'inject';
|
|
13
15
|
|
|
16
|
+
/** Coordinate space of a click's x/y. `image` means image pixels from a `screenshot`. */
|
|
17
|
+
export type WpmPointSpace = 'screen' | 'image';
|
|
18
|
+
|
|
19
|
+
/** Frame source of a captured screenRect. `dwm` is the DWM extended frame; `win32` is the fallback. */
|
|
20
|
+
export type WpmFrameSource = 'dwm' | 'win32';
|
|
21
|
+
|
|
14
22
|
export interface WpmWindow {
|
|
15
23
|
hwnd: string; title: string; class: string; pid: number;
|
|
16
24
|
rect: { left: number; top: number; right: number; bottom: number };
|
|
17
25
|
}
|
|
18
26
|
|
|
27
|
+
/** One numbered element in a `snapshot` frame. */
|
|
28
|
+
export interface WpmSnapshotElement {
|
|
29
|
+
label: number;
|
|
30
|
+
controlType: string;
|
|
31
|
+
name: string;
|
|
32
|
+
automationId: string;
|
|
33
|
+
rect: { left: number; top: number; right: number; bottom: number };
|
|
34
|
+
patterns: string[];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** One delivered screenshot, with the mapping that makes its pixels addressable. */
|
|
38
|
+
export interface WpmShot {
|
|
39
|
+
file: string;
|
|
40
|
+
shotId: string;
|
|
41
|
+
screenRect: { left: number; top: number; right: number; bottom: number };
|
|
42
|
+
imageSize: { width: number; height: number };
|
|
43
|
+
/** image pixels per screen pixel; 1 when identity. screen = rect + round(image / scale). */
|
|
44
|
+
scale: number;
|
|
45
|
+
identity: boolean;
|
|
46
|
+
frame: WpmFrameSource;
|
|
47
|
+
dpiAware: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
19
50
|
export interface WpmArgs {
|
|
20
51
|
action: WpmAction;
|
|
21
52
|
hwnd?: string;
|
|
@@ -28,6 +59,17 @@ export interface WpmArgs {
|
|
|
28
59
|
takeover?: boolean;
|
|
29
60
|
takeoverMaxMs?: number;
|
|
30
61
|
keyInput?: KeyInputMode;
|
|
62
|
+
// ---- 0.5.0: snapshot / screenshot / preview / label addressing ----
|
|
63
|
+
space?: WpmPointSpace;
|
|
64
|
+
shotId?: string;
|
|
65
|
+
label?: number;
|
|
66
|
+
snapId?: string;
|
|
67
|
+
maxElements?: number;
|
|
68
|
+
interactableOnly?: boolean;
|
|
69
|
+
sinceSnapId?: string;
|
|
70
|
+
intent?: string;
|
|
71
|
+
fullScreen?: boolean;
|
|
72
|
+
maxWidth?: number;
|
|
31
73
|
}
|
|
32
74
|
|
|
33
75
|
export interface WpmResult {
|
|
@@ -45,6 +87,24 @@ export interface WpmResult {
|
|
|
45
87
|
abortChord?: string;
|
|
46
88
|
keysInjected?: boolean;
|
|
47
89
|
injectedChars?: number;
|
|
90
|
+
// ---- snapshot ----
|
|
91
|
+
snapId?: string;
|
|
92
|
+
elements?: WpmSnapshotElement[];
|
|
93
|
+
count?: number;
|
|
94
|
+
truncated?: boolean;
|
|
95
|
+
frameCheck?: 'pass' | 'fail';
|
|
96
|
+
intent?: string;
|
|
97
|
+
// ---- screenshot ----
|
|
98
|
+
shotId?: string;
|
|
99
|
+
file?: string;
|
|
100
|
+
screenRect?: { left: number; top: number; right: number; bottom: number };
|
|
101
|
+
imageSize?: { width: number; height: number };
|
|
102
|
+
scale?: number;
|
|
103
|
+
identity?: boolean;
|
|
104
|
+
frame?: WpmFrameSource;
|
|
105
|
+
dpiAware?: boolean;
|
|
106
|
+
// ---- preview ----
|
|
107
|
+
preview?: { x: number; y: number; name: string; controlType: string; automationId: string };
|
|
48
108
|
[key: string]: unknown;
|
|
49
109
|
}
|
|
50
110
|
|