dsh-windows-parallel-mcp 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.de.md +7 -1
- package/CHANGELOG.es.md +7 -1
- package/CHANGELOG.fr.md +7 -1
- package/CHANGELOG.it.md +7 -1
- package/CHANGELOG.ja.md +7 -1
- package/CHANGELOG.ko.md +7 -1
- package/CHANGELOG.md +100 -1
- package/CHANGELOG.pt.md +7 -1
- package/CHANGELOG.ru.md +7 -1
- package/CHANGELOG.zh.md +7 -1
- package/README.de.md +128 -6
- package/README.es.md +128 -6
- package/README.fr.md +128 -6
- package/README.it.md +128 -6
- package/README.ja.md +128 -6
- package/README.ko.md +128 -6
- package/README.md +128 -6
- package/README.pt.md +128 -6
- package/README.ru.md +128 -6
- package/README.zh.md +128 -6
- package/docs/refusals.md +3 -0
- package/dsh.plugin.json +2 -2
- package/lib/audit.js +109 -0
- package/lib/config.js +55 -2
- package/lib/host-tools.js +61 -3
- package/lib/index.js +308 -12
- package/lib/policy.js +127 -0
- package/package.json +2 -2
- package/src/engine/decide.ps1 +120 -3
- package/src/engine/engine.ps1 +249 -2
- package/src/engine/win.ps1 +266 -0
- package/src/engine/worker.ps1 +52 -0
- package/src/schema/tools.json +153 -12
- package/types/index.d.ts +35 -3
package/src/schema/tools.json
CHANGED
|
@@ -17,7 +17,10 @@
|
|
|
17
17
|
"wpm_status": "status",
|
|
18
18
|
"wpm_snapshot": "snapshot",
|
|
19
19
|
"wpm_screenshot": "screenshot",
|
|
20
|
-
"wpm_preview": "preview"
|
|
20
|
+
"wpm_preview": "preview",
|
|
21
|
+
"wpm_launch": "launch",
|
|
22
|
+
"wpm_clipboard": "clipboard",
|
|
23
|
+
"wpm_window": "window"
|
|
21
24
|
},
|
|
22
25
|
"extraWorkerActions": [
|
|
23
26
|
{ "action": "ping", "exposed": false, "why": "protocol/encoding self-test; not part of the tool surface" },
|
|
@@ -25,11 +28,13 @@
|
|
|
25
28
|
]
|
|
26
29
|
},
|
|
27
30
|
"notes": [
|
|
28
|
-
"The
|
|
31
|
+
"The eleven tool names are fixed here so both delivery forms expose the same action surface.",
|
|
29
32
|
"src/engine/engine.ps1 is the only implementation; this file is the contract, not a second implementation.",
|
|
30
33
|
"docs/refusals.md is the human-readable form of `refusals`; scripts/check-refusals.mjs keeps them equal.",
|
|
31
34
|
"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."
|
|
35
|
+
"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.",
|
|
36
|
+
"0.6.0 adds NO action and NO refusal code. It changes what `type` reports: the value is read back after the settle window and `effect=readback-verified` is granted only on an exact match against a prediction built from the control's own measurements. A masked field is readback=unavailable, a reformatted value is readbackMismatch=true, and both stay successes -- 'the application changed my input' is not an error in the call.",
|
|
37
|
+
"0.7.0 adds launch/clipboard/window and every action now declares `requiresTier` (the LOWEST rung it can ever need). One setting, `policy`, is the ceiling; `requiresTierFor` refines an action whose halves differ (clipboard read is readonly, clipboard write is flash). The rung an undeclared action would get is `takeover`: silence about a capability must not read as permission for it. That table is checked against lib/policy.js by scripts/check-policy-table.mjs, because a policy table kept in two places is the drift this repo has been bitten by three times."
|
|
33
38
|
],
|
|
34
39
|
"stance": {
|
|
35
40
|
"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)",
|
|
@@ -53,13 +58,17 @@
|
|
|
53
58
|
{ "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
59
|
{ "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" },
|
|
55
60
|
{ "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)" },
|
|
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" }
|
|
61
|
+
{ "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" },
|
|
62
|
+
{ "code": "app_launch_denied", "layer": "decision", "summary": "action=launch was refused before any worker request because appLaunchAllowed is off or the target is not on the appLaunchAllow whitelist. The next step is the owner's decision, not a retry: add the EXACT name to the whitelist (no wildcard exists, and an empty list means nothing may launch even with the gate on). Both switches must be set -- a takeover permission is not a launch permission" },
|
|
63
|
+
{ "code": "policy_denied", "layer": "decision", "summary": "the action's declared tier is above what the `policy` setting allows, so it was refused before the worker was reached. The next step is named: raise `policy`, do not retry the same call. A refusal here is the setting doing its job, not a failure of the target" },
|
|
64
|
+
{ "code": "user_active", "layer": "decision", "summary": "the last PHYSICAL input is younger than policyIdleMs and the action needs the takeover tier, so the owner is at the keyboard and was NOT interrupted. Unlike the upstream design this product does not pop a countdown dialog at someone who is typing: a dialog is a second disturbance dressed as consent. The next step is to wait for idle, or to pass forceUserActive:true explicitly (which is recorded in the audit log as forced)" }
|
|
57
65
|
],
|
|
58
66
|
"tools": [
|
|
59
67
|
{
|
|
60
68
|
"name": "wpm_windows",
|
|
61
69
|
"action": "windows",
|
|
62
70
|
"engine": "Get-WpmWindowList",
|
|
71
|
+
"requiresTier": "readonly",
|
|
63
72
|
"description": "List live top-level windows the engine could drive: hwnd, title, window class, owning pid and screen rect. Read-only. Visible, titled, non-minimized windows only, because a list padded with invisible helper windows makes target selection guesswork.",
|
|
64
73
|
"inputSchema": {
|
|
65
74
|
"type": "object",
|
|
@@ -68,12 +77,13 @@
|
|
|
68
77
|
"additionalProperties": false
|
|
69
78
|
},
|
|
70
79
|
"refusals": [],
|
|
71
|
-
"noRefusalReason": "pure enumeration: no target is acted on, so there is nothing to refuse. An empty list means no window matched the filter, and that is reported as an empty list, not as a failure."
|
|
80
|
+
"noRefusalReason": "pure enumeration: no target is acted on, so there is nothing to refuse. An empty list means no window matched the filter, and that is reported as an empty list, not as a failure. It also declares the ladder's FLOOR rung (requiresTier: readonly), which is why policy_denied cannot reach it either: no policy level is below readonly, and an unparseable `policy` value falls back to `balanced` rather than to a level that would refuse reads."
|
|
72
81
|
},
|
|
73
82
|
{
|
|
74
83
|
"name": "wpm_click",
|
|
75
84
|
"action": "click",
|
|
76
85
|
"engine": "Invoke-WpmAction -Action click",
|
|
86
|
+
"requiresTier": "quiet",
|
|
77
87
|
"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.",
|
|
78
88
|
"inputSchema": {
|
|
79
89
|
"type": "object",
|
|
@@ -92,12 +102,13 @@
|
|
|
92
102
|
"required": ["hwnd", "x", "y"],
|
|
93
103
|
"additionalProperties": false
|
|
94
104
|
},
|
|
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"]
|
|
105
|
+
"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", "policy_denied", "user_active"]
|
|
96
106
|
},
|
|
97
107
|
{
|
|
98
108
|
"name": "wpm_type",
|
|
99
109
|
"action": "type",
|
|
100
110
|
"engine": "Invoke-WpmAction -Action type",
|
|
111
|
+
"requiresTier": "quiet",
|
|
101
112
|
"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.",
|
|
102
113
|
"inputSchema": {
|
|
103
114
|
"type": "object",
|
|
@@ -118,12 +129,13 @@
|
|
|
118
129
|
"additionalProperties": false
|
|
119
130
|
},
|
|
120
131
|
"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.",
|
|
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"]
|
|
132
|
+
"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", "policy_denied", "user_active"]
|
|
122
133
|
},
|
|
123
134
|
{
|
|
124
135
|
"name": "wpm_focus",
|
|
125
136
|
"action": "focus",
|
|
126
137
|
"engine": "Invoke-WpmAction -Action focus",
|
|
138
|
+
"requiresTier": "quiet",
|
|
127
139
|
"description": "Move keyboard focus to a named control inside the target, then reverse the foreground change once. This action always needs a UIA element: the message tier cannot set keyboard focus, so a window with no pattern is refused rather than clicked at a guessed coordinate.",
|
|
128
140
|
"inputSchema": {
|
|
129
141
|
"type": "object",
|
|
@@ -139,12 +151,13 @@
|
|
|
139
151
|
"required": ["hwnd", "elementName"],
|
|
140
152
|
"additionalProperties": false
|
|
141
153
|
},
|
|
142
|
-
"refusals": ["no_hwnd", "paused", "elevated_target", "unreachable", "uia_tree_empty", "uia_probe_failed", "terminal_no_door", "action_failed", "restore_failed", "takeover_unavailable", "takeover_aborted"]
|
|
154
|
+
"refusals": ["no_hwnd", "paused", "elevated_target", "unreachable", "uia_tree_empty", "uia_probe_failed", "terminal_no_door", "action_failed", "restore_failed", "takeover_unavailable", "takeover_aborted", "policy_denied", "user_active"]
|
|
143
155
|
},
|
|
144
156
|
{
|
|
145
157
|
"name": "wpm_status",
|
|
146
158
|
"action": "status",
|
|
147
159
|
"engine": "Get-WpmStatus",
|
|
160
|
+
"requiresTier": "readonly",
|
|
148
161
|
"description": "Report the engine's state and the desktop's focus table: paused flag, foreground window and pid, the control that holds keyboard focus, the age of the last human input, and the engine's stated stance. Read-only; useful before acting and after a refusal.",
|
|
149
162
|
"inputSchema": {
|
|
150
163
|
"type": "object",
|
|
@@ -153,12 +166,13 @@
|
|
|
153
166
|
"additionalProperties": false
|
|
154
167
|
},
|
|
155
168
|
"refusals": [],
|
|
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."
|
|
169
|
+
"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. Same floor argument as wpm_windows: readonly is the ladder's bottom rung, so no policy level can refuse it -- and `status` is precisely the call a caller uses to find out WHY something else was refused, so a refusal here would be self-defeating."
|
|
157
170
|
},
|
|
158
171
|
{
|
|
159
172
|
"name": "wpm_snapshot",
|
|
160
173
|
"action": "snapshot",
|
|
161
174
|
"engine": "Invoke-WpmAction -Action snapshot",
|
|
175
|
+
"requiresTier": "readonly",
|
|
162
176
|
"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
177
|
"inputSchema": {
|
|
164
178
|
"type": "object",
|
|
@@ -172,12 +186,13 @@
|
|
|
172
186
|
"required": ["hwnd"],
|
|
173
187
|
"additionalProperties": false
|
|
174
188
|
},
|
|
175
|
-
"refusals": ["no_hwnd", "paused", "uia_probe_failed", "stale_ref"]
|
|
189
|
+
"refusals": ["no_hwnd", "paused", "uia_probe_failed", "stale_ref", "policy_denied"]
|
|
176
190
|
},
|
|
177
191
|
{
|
|
178
192
|
"name": "wpm_screenshot",
|
|
179
193
|
"action": "screenshot",
|
|
180
194
|
"engine": "Invoke-WpmAction -Action screenshot",
|
|
195
|
+
"requiresTier": "readonly",
|
|
181
196
|
"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
197
|
"inputSchema": {
|
|
183
198
|
"type": "object",
|
|
@@ -189,12 +204,13 @@
|
|
|
189
204
|
"required": [],
|
|
190
205
|
"additionalProperties": false
|
|
191
206
|
},
|
|
192
|
-
"refusals": ["no_hwnd", "paused"]
|
|
207
|
+
"refusals": ["no_hwnd", "paused", "policy_denied"]
|
|
193
208
|
},
|
|
194
209
|
{
|
|
195
210
|
"name": "wpm_preview",
|
|
196
211
|
"action": "preview",
|
|
197
212
|
"engine": "Invoke-WpmAction -Action preview",
|
|
213
|
+
"requiresTier": "readonly",
|
|
198
214
|
"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
215
|
"inputSchema": {
|
|
200
216
|
"type": "object",
|
|
@@ -206,7 +222,66 @@
|
|
|
206
222
|
"required": ["hwnd", "x", "y"],
|
|
207
223
|
"additionalProperties": false
|
|
208
224
|
},
|
|
209
|
-
"refusals": ["no_hwnd", "paused", "unreachable"]
|
|
225
|
+
"refusals": ["no_hwnd", "paused", "unreachable", "policy_denied"]
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"name": "wpm_launch",
|
|
229
|
+
"action": "launch",
|
|
230
|
+
"engine": "Invoke-WpmDesktopAction -Action launch",
|
|
231
|
+
"requiresTier": "takeover",
|
|
232
|
+
"description": "Start a program. This is the one action whose consequences outlive the call, so it needs TWO switches and neither implies the other: appLaunchAllowed (the gate) and appLaunchAllow (an exact-name whitelist, empty by default = nothing may launch). A takeover permission is not a launch permission and vice versa. The started process is reported by pid; its window may not exist yet, because Process.Start returns while the app is still loading (measured: MainWindowHandle=0 for 1348 ms on a cold notepad), so waitMs polls for it and a window that has not appeared is reported as ok:true with hwnd=\"\" and detail=window-not-yet rather than as a failed launch. Arguments are passed through as given and written to the audit log, because a whitelist vouches for a program, not for what it is told to do.",
|
|
233
|
+
"inputSchema": {
|
|
234
|
+
"type": "object",
|
|
235
|
+
"properties": {
|
|
236
|
+
"target": { "type": "string", "description": "Program name or absolute exe path. It must appear in appLaunchAllow EXACTLY (case-insensitive, no wildcards, no prefixes): 'notepad' does not authorise 'notepad-helper.exe'." },
|
|
237
|
+
"args": { "type": "string", "description": "One command line for the program. Recorded in the audit log verbatim; the whitelist does not parse it." },
|
|
238
|
+
"waitMs": { "type": "integer", "minimum": 0, "maximum": 30000, "default": 3000, "description": "How long to wait for the process to publish a top-level window. 0 returns immediately with the pid and no hwnd." }
|
|
239
|
+
},
|
|
240
|
+
"required": ["target"],
|
|
241
|
+
"additionalProperties": false
|
|
242
|
+
},
|
|
243
|
+
"refusals": ["paused", "app_launch_denied", "policy_denied", "action_failed"]
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
"name": "wpm_clipboard",
|
|
247
|
+
"action": "clipboard",
|
|
248
|
+
"engine": "Invoke-WpmDesktopAction -Action clipboard",
|
|
249
|
+
"requiresTier": "readonly",
|
|
250
|
+
"requiresTierFor": { "read": "readonly", "write": "flash" },
|
|
251
|
+
"description": "Read or write the system clipboard. A read is a READ (no input, no focus) but it is the most private one in this product: the clipboard may hold a password or a token the owner copied seconds ago. So a text read reports its LENGTH in the result and the audit log never sees the content, values are capped at 64 KB with truncation stated rather than silently cut, and a format that is neither text nor image is refused with the format names it DID find. A write goes through the same STA path that measured 138 ms cold, and an image write accepts a shotId so a screenshot can be pushed into the clipboard without the caller handling pixels. Writing is the louder half and is graded at the flash tier.",
|
|
252
|
+
"inputSchema": {
|
|
253
|
+
"type": "object",
|
|
254
|
+
"properties": {
|
|
255
|
+
"op": { "type": "string", "enum": ["read", "write"], "description": "read: report what the clipboard holds (length, never payload). write: replace it." },
|
|
256
|
+
"format": { "type": "string", "enum": ["text", "image"], "default": "text", "description": "Which clipboard format. image read writes a PNG under %LOCALAPPDATA%\\wpm\\clipboard; image write needs shotId." },
|
|
257
|
+
"text": { "type": "string", "description": "write + format=text: the value. An empty write is refused: it cannot be told apart from a clipboard the owner already cleared." },
|
|
258
|
+
"shotId": { "type": "string", "description": "write + format=image: the screenshot to put on the clipboard. A shotId the retention policy already dropped is refused with stale_ref." }
|
|
259
|
+
},
|
|
260
|
+
"required": ["op"],
|
|
261
|
+
"additionalProperties": false
|
|
262
|
+
},
|
|
263
|
+
"refusals": ["paused", "policy_denied", "action_failed", "stale_ref"]
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"name": "wpm_window",
|
|
267
|
+
"action": "window",
|
|
268
|
+
"engine": "Invoke-WpmDesktopAction -Action window",
|
|
269
|
+
"requiresTier": "flash",
|
|
270
|
+
"description": "Minimize, restore, move, resize or topmost ONE window named by hwnd. Every op is verified by reading the window's OWN state back -- IsIconic, the rect, the WS_EX_TOPMOST bit -- not by the syscall's return value, because a call that answered yes while the window said no is the failure this product has been trained on. move/resize never activate (SWP_NOACTIVATE) and topmost never takes the foreground. There is no 'all windows' op and no wildcards: an action that could address every window on the desktop would not need a target parameter. `topmost` is the promotion of a primitive that shipped as test-support-only (scripts/raise-topmost.ps1); 0.7.0 re-evaluated it and put it behind the flash tier rather than leaving it unreachable, and the finding records the reasoning that changed.",
|
|
271
|
+
"inputSchema": {
|
|
272
|
+
"type": "object",
|
|
273
|
+
"properties": {
|
|
274
|
+
"hwnd": { "type": "string", "description": "The window to act on. Required: without it there is no answer but no_hwnd, because 'the front window' is not a window this plugin may choose." },
|
|
275
|
+
"op": { "type": "string", "enum": ["minimize", "restore", "move", "resize", "topmost"], "description": "Which change to make. The result reports the state that was read back afterwards, with verified=true only when it matches." },
|
|
276
|
+
"x": { "type": "integer", "description": "move: the target left edge in physical screen pixels." },
|
|
277
|
+
"y": { "type": "integer", "description": "move: the target top edge." },
|
|
278
|
+
"width": { "type": "integer", "minimum": 1, "description": "resize: the target width. A window may clamp it; the result says what it became." },
|
|
279
|
+
"height": { "type": "integer", "minimum": 1, "description": "resize: the target height." }
|
|
280
|
+
},
|
|
281
|
+
"required": ["hwnd", "op"],
|
|
282
|
+
"additionalProperties": false
|
|
283
|
+
},
|
|
284
|
+
"refusals": ["paused", "no_hwnd", "policy_denied", "action_failed"]
|
|
210
285
|
}
|
|
211
286
|
],
|
|
212
287
|
"refusalCases": [
|
|
@@ -370,6 +445,72 @@
|
|
|
370
445
|
"args": { "hwnd": "$liveHwnd", "elementName": "x" },
|
|
371
446
|
"expect": "restore_failed",
|
|
372
447
|
"note": "NOT COVERED: needs a real elevated window. task_52."
|
|
448
|
+
},
|
|
449
|
+
{
|
|
450
|
+
"id": "policy-ceiling-readonly",
|
|
451
|
+
"mode": "decision",
|
|
452
|
+
"tool": "wpm_click",
|
|
453
|
+
"facts": { "hwnd": "$liveHwnd", "policy": "readonly", "requiredTier": "quiet" },
|
|
454
|
+
"expect": "policy_denied",
|
|
455
|
+
"note": "Decision-table instance: the ceiling is checked BEFORE any capability, so a target with a perfect message door is still refused when the owner said 'reads only'. The refusal is about the setting, and the reason names which setting."
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
"id": "policy-ceiling-takeover",
|
|
459
|
+
"mode": "decision",
|
|
460
|
+
"tool": "wpm_launch",
|
|
461
|
+
"facts": { "action": "launch", "policy": "balanced", "requiredTier": "takeover", "appLaunchAllowed": true, "appLaunchAllow": ["write-only-probe"], "launchTarget": "write-only-probe" },
|
|
462
|
+
"expect": "policy_denied",
|
|
463
|
+
"note": "The ordering case that proves the two axes are actually two: BOTH launch switches are satisfied here and the call is STILL refused, because `balanced` stops at the flash rung and launch needs takeover. If the launch gate ran first this case would be a silent false positive."
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
"id": "user-active-takeover",
|
|
467
|
+
"mode": "decision",
|
|
468
|
+
"tool": "wpm_click",
|
|
469
|
+
"facts": { "hwnd": "$liveHwnd", "policy": "full", "requiredTier": "takeover", "lastInputAgeMs": 100, "policyIdleMs": 3000 },
|
|
470
|
+
"expect": "user_active",
|
|
471
|
+
"note": "The owner typed something 100 ms ago and this call wants the real cursor. Refused, and NO dialog is opened: the upstream design pops a 10-second countdown even while you are typing, which is a second disturbance presented as consent. Next step is to wait, or to pass forceUserActive:true (recorded in the audit as forced)."
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
"id": "launch-gate-off",
|
|
475
|
+
"mode": "engine",
|
|
476
|
+
"tool": "wpm_launch",
|
|
477
|
+
"args": { "target": "write-only-probe" },
|
|
478
|
+
"gate": { "policy": "full", "launchAllowed": false, "allowList": ["write-only-probe"] },
|
|
479
|
+
"expect": "app_launch_denied",
|
|
480
|
+
"note": "Engine-level: the gate is off, so nothing is started. The ceiling is raised to 'full' HERE because policy is consulted first by design (see policy-ceiling-takeover for the other order); with 'balanced' this case would correctly report policy_denied and would not be testing the launch switch at all. Measured by the absence of a pid in the result and by test/plugin-test.mjs's worker-request counter at the host level -- a launch refusal that still started the process would be the worst bug in this product."
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
"id": "launch-not-whitelisted",
|
|
484
|
+
"mode": "engine",
|
|
485
|
+
"tool": "wpm_launch",
|
|
486
|
+
"args": { "target": "calc" },
|
|
487
|
+
"gate": { "policy": "full", "launchAllowed": true, "allowList": ["write-only-probe", "notepad"] },
|
|
488
|
+
"expect": "app_launch_denied",
|
|
489
|
+
"note": "The gate is ON and the name is not on the list -- the two-switch design in one case. EXACT match, so 'calc' is refused while 'notepad' would pass; 'notepad-helper' would also be refused, which is the prefix rule this contract explicitly does not implement."
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
"id": "window-dead-hwnd",
|
|
493
|
+
"mode": "engine",
|
|
494
|
+
"tool": "wpm_window",
|
|
495
|
+
"args": { "hwnd": "$deadHwnd", "op": "minimize" },
|
|
496
|
+
"expect": "no_hwnd",
|
|
497
|
+
"note": "A window op on a handle that no longer identifies a live window. Refused before ShowWindow, not after: 'the call returned false' would describe a different failure than 'there is no such window'."
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
"id": "clipboard-unknown-op",
|
|
501
|
+
"mode": "engine",
|
|
502
|
+
"tool": "wpm_clipboard",
|
|
503
|
+
"args": { "op": "peek" },
|
|
504
|
+
"expect": "action_failed",
|
|
505
|
+
"note": "An op that is neither read nor write. Reported as action_failed with the requirement in the reason rather than as a new code: this is a malformed call, not a state of the desktop, and the closed vocabulary already says which of the two it was."
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
"id": "clipboard-write-empty",
|
|
509
|
+
"mode": "engine",
|
|
510
|
+
"tool": "wpm_clipboard",
|
|
511
|
+
"args": { "op": "write", "format": "text" },
|
|
512
|
+
"expect": "action_failed",
|
|
513
|
+
"note": "An empty text write is refused with the same reasoning `type` uses for an empty write: it cannot be distinguished from a clipboard the owner already cleared, and an 'ok' here would be a claim about nothing."
|
|
373
514
|
}
|
|
374
515
|
]
|
|
375
516
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,9 +1,20 @@
|
|
|
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.7.0).
|
|
3
3
|
|
|
4
4
|
export type WpmAction =
|
|
5
5
|
| 'windows' | 'click' | 'type' | 'focus' | 'status'
|
|
6
|
-
| 'snapshot' | 'screenshot' | 'preview'
|
|
6
|
+
| 'snapshot' | 'screenshot' | 'preview'
|
|
7
|
+
// 0.7.0: three desktop actions. They are gated by SETTINGS, not by the target's doors -- which is why
|
|
8
|
+
// they take no channel, cost no tier of their own, and produce no proof window.
|
|
9
|
+
| 'launch' | 'clipboard' | 'window';
|
|
10
|
+
|
|
11
|
+
/** clipboard's `op`. */
|
|
12
|
+
export type WpmClipboardOp = 'read' | 'write';
|
|
13
|
+
/** window's `op`. There is no 'all windows' value, and that is the contract, not an omission. */
|
|
14
|
+
export type WpmWindowOp = 'minimize' | 'restore' | 'move' | 'resize' | 'topmost';
|
|
15
|
+
|
|
16
|
+
/** The single authorization ceiling in settings; lib/policy.js holds the ladder it is read against. */
|
|
17
|
+
export type WpmPolicy = 'readonly' | 'quiet' | 'balanced' | 'full';
|
|
7
18
|
|
|
8
19
|
/**
|
|
9
20
|
* WHO REPORTED THE SUCCESS. The first three name a messenger, not a degree of confidence (see the
|
|
@@ -23,7 +34,10 @@ export type RefusalCode =
|
|
|
23
34
|
| 'no_hwnd' | 'paused' | 'elevated_target' | 'unreachable'
|
|
24
35
|
| 'uia_tree_empty' | 'uia_probe_failed' | 'terminal_no_door' | 'needs_facts'
|
|
25
36
|
| 'takeover_unavailable' | 'keyinject_unavailable' | 'action_failed'
|
|
26
|
-
| 'restore_failed' | 'takeover_aborted' | 'stale_ref'
|
|
37
|
+
| 'restore_failed' | 'takeover_aborted' | 'stale_ref'
|
|
38
|
+
// 0.7.0. What separates these three from the fourteen above is the NEXT STEP: each names a SETTING,
|
|
39
|
+
// so retrying the same call is the wrong response and changing the setting is the right one.
|
|
40
|
+
| 'app_launch_denied' | 'policy_denied' | 'user_active';
|
|
27
41
|
|
|
28
42
|
export type KeyInputMode = 'none' | 'inject';
|
|
29
43
|
|
|
@@ -95,6 +109,17 @@ export interface WpmArgs {
|
|
|
95
109
|
intent?: string;
|
|
96
110
|
fullScreen?: boolean;
|
|
97
111
|
maxWidth?: number;
|
|
112
|
+
// ---- 0.7.0: launch / clipboard / window ----
|
|
113
|
+
target?: string;
|
|
114
|
+
args?: string;
|
|
115
|
+
waitMs?: number;
|
|
116
|
+
op?: WpmClipboardOp | WpmWindowOp;
|
|
117
|
+
/** clipboard only: which format to read or write. */
|
|
118
|
+
format?: 'text' | 'image';
|
|
119
|
+
width?: number;
|
|
120
|
+
height?: number;
|
|
121
|
+
/** The caller's explicit override of the idle check; recorded in the audit log as `forced`. */
|
|
122
|
+
forceUserActive?: boolean;
|
|
98
123
|
}
|
|
99
124
|
|
|
100
125
|
export interface WpmResult {
|
|
@@ -132,6 +157,13 @@ export interface WpmResult {
|
|
|
132
157
|
dpiAware?: boolean;
|
|
133
158
|
// ---- preview ----
|
|
134
159
|
preview?: { x: number; y: number; name: string; controlType: string; automationId: string };
|
|
160
|
+
// ---- 0.7.0 desktop results ----
|
|
161
|
+
pid?: number;
|
|
162
|
+
processName?: string;
|
|
163
|
+
waitedMs?: number;
|
|
164
|
+
clipFormat?: 'text' | 'image';
|
|
165
|
+
clipId?: string;
|
|
166
|
+
resultChars?: number;
|
|
135
167
|
[key: string]: unknown;
|
|
136
168
|
}
|
|
137
169
|
|