dsh-windows-parallel-mcp 0.6.0 → 0.8.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 +13 -1
- package/CHANGELOG.es.md +13 -1
- package/CHANGELOG.fr.md +13 -1
- package/CHANGELOG.it.md +13 -1
- package/CHANGELOG.ja.md +13 -1
- package/CHANGELOG.ko.md +13 -1
- package/CHANGELOG.md +201 -1
- package/CHANGELOG.pt.md +13 -1
- package/CHANGELOG.ru.md +13 -1
- package/CHANGELOG.zh.md +13 -1
- package/README.de.md +231 -6
- package/README.es.md +231 -6
- package/README.fr.md +231 -6
- package/README.it.md +231 -6
- package/README.ja.md +231 -6
- package/README.ko.md +231 -6
- package/README.md +231 -6
- package/README.pt.md +231 -6
- package/README.ru.md +231 -6
- package/README.zh.md +231 -6
- package/docs/refusals.md +3 -0
- package/dsh.plugin.json +3 -3
- 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/mcp-server.mjs +350 -0
- package/lib/policy.js +127 -0
- package/package.json +9 -2
- package/server.json +109 -0
- 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 +171 -13
- package/types/index.d.ts +35 -3
package/src/schema/tools.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": "0.1.0",
|
|
3
|
-
"status": "form decided 2026-11-19: A = DSH native plugin (
|
|
3
|
+
"status": "form decided 2026-11-19: A = DSH native plugin. PARTLY REVERSED 2026-11-23 for 0.8.0: the same engine is ALSO an MCP stdio server (see mcpProjection), because the MCP Registry accepts MCP servers only and DSH can bridge one -- one implementation, two channels. The eleven named tools below stay the canonical ACTION surface, and BOTH delivery forms expose them as one tool with an action discriminator, which is the projection the token argument decided on.",
|
|
4
4
|
"hostProjection": {
|
|
5
5
|
"form": "A",
|
|
6
6
|
"decided": "2026-11-19",
|
|
@@ -17,19 +17,41 @@
|
|
|
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" },
|
|
24
27
|
{ "action": "pause", "exposed": false, "why": "owner control, behind the settings pill rather than the model's reach" }
|
|
25
28
|
]
|
|
26
29
|
},
|
|
30
|
+
"mcpProjection": {
|
|
31
|
+
"form": "stdio MCP server, JSON-RPC 2.0, zero dependencies",
|
|
32
|
+
"decided": "2026-11-23",
|
|
33
|
+
"reversal": "the 2026-11-19 note said 'no MCP'. That was a decision about the DELIVERY CHANNEL, not about the action surface, and it is reversed here on purpose: the Registry only accepts MCP servers, and @deepseek-ai/dsh-mcp-client can bridge one into DSH, so one implementation now reaches two channels instead of one.",
|
|
34
|
+
"why": "the token argument for one-tool-with-discriminator does not weaken over a transport. `tools/call` accepts an arbitrary argument object, so eleven resident schemas would still be a standing cost with no added capability.",
|
|
35
|
+
"package": "dsh-windows-parallel-mcp",
|
|
36
|
+
"bin": "wpm-mcp",
|
|
37
|
+
"entry": "lib/mcp-server.mjs",
|
|
38
|
+
"tool": "wpm",
|
|
39
|
+
"discriminator": "action",
|
|
40
|
+
"schemaSource": "src/schema/tools.json -- tools/list is GENERATED at start-up from the `tools` array below (one oneOf branch per action, its properties/required/additionalProperties copied field for field), never transcribed; scripts/check-mcp-schema.mjs keeps that honest",
|
|
41
|
+
"implementationSource": "lib/index.js#apply -- the same host half the DSH form uses, so toRequest(), the gate order, the refusal vocabulary, the policy ceiling, the audit line and format() are shared code, not a second copy",
|
|
42
|
+
"settingsSource": "process environment (WPM_*), never a call argument: a client that could raise its own `policy` or add itself to `appLaunchAllow` would make the authorization model decorative",
|
|
43
|
+
"imageContent": "a screenshot is attached as base64 image content in tools/call, because a file path is meaningless to a caller that is not on this machine (WPM_MCP_NO_IMAGE=1 opts out)",
|
|
44
|
+
"transportDiscipline": "stdout is the protocol channel and nothing else is written there; a notification gets no reply; a non-JSON line gets -32700 with a null id and the server survives; an unknown method gets -32601 and the server survives; replies are keyed by id because the worker is asynchronous."
|
|
45
|
+
},
|
|
27
46
|
"notes": [
|
|
28
|
-
"
|
|
47
|
+
"0.8.0 adds NO action and NO refusal code. It adds a second transport for the same eleven actions, which is why `mcpProjection` names this file as the schema source: two delivery forms describing one engine is exactly the shape that drifts when one of them is copied.",
|
|
48
|
+
"The eleven tool names are fixed here so both delivery forms expose the same action surface.",
|
|
29
49
|
"src/engine/engine.ps1 is the only implementation; this file is the contract, not a second implementation.",
|
|
30
50
|
"docs/refusals.md is the human-readable form of `refusals`; scripts/check-refusals.mjs keeps them equal.",
|
|
31
51
|
"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."
|
|
52
|
+
"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.",
|
|
53
|
+
"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.",
|
|
54
|
+
"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
55
|
],
|
|
34
56
|
"stance": {
|
|
35
57
|
"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 +75,17 @@
|
|
|
53
75
|
{ "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
76
|
{ "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
77
|
{ "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" }
|
|
78
|
+
{ "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" },
|
|
79
|
+
{ "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" },
|
|
80
|
+
{ "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" },
|
|
81
|
+
{ "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
82
|
],
|
|
58
83
|
"tools": [
|
|
59
84
|
{
|
|
60
85
|
"name": "wpm_windows",
|
|
61
86
|
"action": "windows",
|
|
62
87
|
"engine": "Get-WpmWindowList",
|
|
88
|
+
"requiresTier": "readonly",
|
|
63
89
|
"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
90
|
"inputSchema": {
|
|
65
91
|
"type": "object",
|
|
@@ -68,12 +94,13 @@
|
|
|
68
94
|
"additionalProperties": false
|
|
69
95
|
},
|
|
70
96
|
"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."
|
|
97
|
+
"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
98
|
},
|
|
73
99
|
{
|
|
74
100
|
"name": "wpm_click",
|
|
75
101
|
"action": "click",
|
|
76
102
|
"engine": "Invoke-WpmAction -Action click",
|
|
103
|
+
"requiresTier": "quiet",
|
|
77
104
|
"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
105
|
"inputSchema": {
|
|
79
106
|
"type": "object",
|
|
@@ -92,12 +119,13 @@
|
|
|
92
119
|
"required": ["hwnd", "x", "y"],
|
|
93
120
|
"additionalProperties": false
|
|
94
121
|
},
|
|
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"]
|
|
122
|
+
"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
123
|
},
|
|
97
124
|
{
|
|
98
125
|
"name": "wpm_type",
|
|
99
126
|
"action": "type",
|
|
100
127
|
"engine": "Invoke-WpmAction -Action type",
|
|
128
|
+
"requiresTier": "quiet",
|
|
101
129
|
"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
130
|
"inputSchema": {
|
|
103
131
|
"type": "object",
|
|
@@ -118,12 +146,13 @@
|
|
|
118
146
|
"additionalProperties": false
|
|
119
147
|
},
|
|
120
148
|
"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"]
|
|
149
|
+
"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
150
|
},
|
|
123
151
|
{
|
|
124
152
|
"name": "wpm_focus",
|
|
125
153
|
"action": "focus",
|
|
126
154
|
"engine": "Invoke-WpmAction -Action focus",
|
|
155
|
+
"requiresTier": "quiet",
|
|
127
156
|
"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
157
|
"inputSchema": {
|
|
129
158
|
"type": "object",
|
|
@@ -139,12 +168,13 @@
|
|
|
139
168
|
"required": ["hwnd", "elementName"],
|
|
140
169
|
"additionalProperties": false
|
|
141
170
|
},
|
|
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"]
|
|
171
|
+
"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
172
|
},
|
|
144
173
|
{
|
|
145
174
|
"name": "wpm_status",
|
|
146
175
|
"action": "status",
|
|
147
176
|
"engine": "Get-WpmStatus",
|
|
177
|
+
"requiresTier": "readonly",
|
|
148
178
|
"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
179
|
"inputSchema": {
|
|
150
180
|
"type": "object",
|
|
@@ -153,12 +183,13 @@
|
|
|
153
183
|
"additionalProperties": false
|
|
154
184
|
},
|
|
155
185
|
"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."
|
|
186
|
+
"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
187
|
},
|
|
158
188
|
{
|
|
159
189
|
"name": "wpm_snapshot",
|
|
160
190
|
"action": "snapshot",
|
|
161
191
|
"engine": "Invoke-WpmAction -Action snapshot",
|
|
192
|
+
"requiresTier": "readonly",
|
|
162
193
|
"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
194
|
"inputSchema": {
|
|
164
195
|
"type": "object",
|
|
@@ -172,12 +203,13 @@
|
|
|
172
203
|
"required": ["hwnd"],
|
|
173
204
|
"additionalProperties": false
|
|
174
205
|
},
|
|
175
|
-
"refusals": ["no_hwnd", "paused", "uia_probe_failed", "stale_ref"]
|
|
206
|
+
"refusals": ["no_hwnd", "paused", "uia_probe_failed", "stale_ref", "policy_denied"]
|
|
176
207
|
},
|
|
177
208
|
{
|
|
178
209
|
"name": "wpm_screenshot",
|
|
179
210
|
"action": "screenshot",
|
|
180
211
|
"engine": "Invoke-WpmAction -Action screenshot",
|
|
212
|
+
"requiresTier": "readonly",
|
|
181
213
|
"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
214
|
"inputSchema": {
|
|
183
215
|
"type": "object",
|
|
@@ -189,12 +221,13 @@
|
|
|
189
221
|
"required": [],
|
|
190
222
|
"additionalProperties": false
|
|
191
223
|
},
|
|
192
|
-
"refusals": ["no_hwnd", "paused"]
|
|
224
|
+
"refusals": ["no_hwnd", "paused", "policy_denied"]
|
|
193
225
|
},
|
|
194
226
|
{
|
|
195
227
|
"name": "wpm_preview",
|
|
196
228
|
"action": "preview",
|
|
197
229
|
"engine": "Invoke-WpmAction -Action preview",
|
|
230
|
+
"requiresTier": "readonly",
|
|
198
231
|
"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
232
|
"inputSchema": {
|
|
200
233
|
"type": "object",
|
|
@@ -206,7 +239,66 @@
|
|
|
206
239
|
"required": ["hwnd", "x", "y"],
|
|
207
240
|
"additionalProperties": false
|
|
208
241
|
},
|
|
209
|
-
"refusals": ["no_hwnd", "paused", "unreachable"]
|
|
242
|
+
"refusals": ["no_hwnd", "paused", "unreachable", "policy_denied"]
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"name": "wpm_launch",
|
|
246
|
+
"action": "launch",
|
|
247
|
+
"engine": "Invoke-WpmDesktopAction -Action launch",
|
|
248
|
+
"requiresTier": "takeover",
|
|
249
|
+
"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.",
|
|
250
|
+
"inputSchema": {
|
|
251
|
+
"type": "object",
|
|
252
|
+
"properties": {
|
|
253
|
+
"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'." },
|
|
254
|
+
"args": { "type": "string", "description": "One command line for the program. Recorded in the audit log verbatim; the whitelist does not parse it." },
|
|
255
|
+
"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." }
|
|
256
|
+
},
|
|
257
|
+
"required": ["target"],
|
|
258
|
+
"additionalProperties": false
|
|
259
|
+
},
|
|
260
|
+
"refusals": ["paused", "app_launch_denied", "policy_denied", "action_failed"]
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"name": "wpm_clipboard",
|
|
264
|
+
"action": "clipboard",
|
|
265
|
+
"engine": "Invoke-WpmDesktopAction -Action clipboard",
|
|
266
|
+
"requiresTier": "readonly",
|
|
267
|
+
"requiresTierFor": { "read": "readonly", "write": "flash" },
|
|
268
|
+
"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.",
|
|
269
|
+
"inputSchema": {
|
|
270
|
+
"type": "object",
|
|
271
|
+
"properties": {
|
|
272
|
+
"op": { "type": "string", "enum": ["read", "write"], "description": "read: report what the clipboard holds (length, never payload). write: replace it." },
|
|
273
|
+
"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." },
|
|
274
|
+
"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." },
|
|
275
|
+
"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." }
|
|
276
|
+
},
|
|
277
|
+
"required": ["op"],
|
|
278
|
+
"additionalProperties": false
|
|
279
|
+
},
|
|
280
|
+
"refusals": ["paused", "policy_denied", "action_failed", "stale_ref"]
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
"name": "wpm_window",
|
|
284
|
+
"action": "window",
|
|
285
|
+
"engine": "Invoke-WpmDesktopAction -Action window",
|
|
286
|
+
"requiresTier": "flash",
|
|
287
|
+
"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.",
|
|
288
|
+
"inputSchema": {
|
|
289
|
+
"type": "object",
|
|
290
|
+
"properties": {
|
|
291
|
+
"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." },
|
|
292
|
+
"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." },
|
|
293
|
+
"x": { "type": "integer", "description": "move: the target left edge in physical screen pixels." },
|
|
294
|
+
"y": { "type": "integer", "description": "move: the target top edge." },
|
|
295
|
+
"width": { "type": "integer", "minimum": 1, "description": "resize: the target width. A window may clamp it; the result says what it became." },
|
|
296
|
+
"height": { "type": "integer", "minimum": 1, "description": "resize: the target height." }
|
|
297
|
+
},
|
|
298
|
+
"required": ["hwnd", "op"],
|
|
299
|
+
"additionalProperties": false
|
|
300
|
+
},
|
|
301
|
+
"refusals": ["paused", "no_hwnd", "policy_denied", "action_failed"]
|
|
210
302
|
}
|
|
211
303
|
],
|
|
212
304
|
"refusalCases": [
|
|
@@ -370,6 +462,72 @@
|
|
|
370
462
|
"args": { "hwnd": "$liveHwnd", "elementName": "x" },
|
|
371
463
|
"expect": "restore_failed",
|
|
372
464
|
"note": "NOT COVERED: needs a real elevated window. task_52."
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
"id": "policy-ceiling-readonly",
|
|
468
|
+
"mode": "decision",
|
|
469
|
+
"tool": "wpm_click",
|
|
470
|
+
"facts": { "hwnd": "$liveHwnd", "policy": "readonly", "requiredTier": "quiet" },
|
|
471
|
+
"expect": "policy_denied",
|
|
472
|
+
"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."
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
"id": "policy-ceiling-takeover",
|
|
476
|
+
"mode": "decision",
|
|
477
|
+
"tool": "wpm_launch",
|
|
478
|
+
"facts": { "action": "launch", "policy": "balanced", "requiredTier": "takeover", "appLaunchAllowed": true, "appLaunchAllow": ["write-only-probe"], "launchTarget": "write-only-probe" },
|
|
479
|
+
"expect": "policy_denied",
|
|
480
|
+
"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."
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
"id": "user-active-takeover",
|
|
484
|
+
"mode": "decision",
|
|
485
|
+
"tool": "wpm_click",
|
|
486
|
+
"facts": { "hwnd": "$liveHwnd", "policy": "full", "requiredTier": "takeover", "lastInputAgeMs": 100, "policyIdleMs": 3000 },
|
|
487
|
+
"expect": "user_active",
|
|
488
|
+
"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)."
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
"id": "launch-gate-off",
|
|
492
|
+
"mode": "engine",
|
|
493
|
+
"tool": "wpm_launch",
|
|
494
|
+
"args": { "target": "write-only-probe" },
|
|
495
|
+
"gate": { "policy": "full", "launchAllowed": false, "allowList": ["write-only-probe"] },
|
|
496
|
+
"expect": "app_launch_denied",
|
|
497
|
+
"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."
|
|
498
|
+
},
|
|
499
|
+
{
|
|
500
|
+
"id": "launch-not-whitelisted",
|
|
501
|
+
"mode": "engine",
|
|
502
|
+
"tool": "wpm_launch",
|
|
503
|
+
"args": { "target": "calc" },
|
|
504
|
+
"gate": { "policy": "full", "launchAllowed": true, "allowList": ["write-only-probe", "notepad"] },
|
|
505
|
+
"expect": "app_launch_denied",
|
|
506
|
+
"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."
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
"id": "window-dead-hwnd",
|
|
510
|
+
"mode": "engine",
|
|
511
|
+
"tool": "wpm_window",
|
|
512
|
+
"args": { "hwnd": "$deadHwnd", "op": "minimize" },
|
|
513
|
+
"expect": "no_hwnd",
|
|
514
|
+
"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'."
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
"id": "clipboard-unknown-op",
|
|
518
|
+
"mode": "engine",
|
|
519
|
+
"tool": "wpm_clipboard",
|
|
520
|
+
"args": { "op": "peek" },
|
|
521
|
+
"expect": "action_failed",
|
|
522
|
+
"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."
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
"id": "clipboard-write-empty",
|
|
526
|
+
"mode": "engine",
|
|
527
|
+
"tool": "wpm_clipboard",
|
|
528
|
+
"args": { "op": "write", "format": "text" },
|
|
529
|
+
"expect": "action_failed",
|
|
530
|
+
"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
531
|
}
|
|
374
532
|
]
|
|
375
533
|
}
|
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
|
|