dsh-windows-parallel-mcp 0.5.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 +13 -1
- package/CHANGELOG.es.md +13 -1
- package/CHANGELOG.fr.md +13 -1
- package/CHANGELOG.it.md +13 -1
- package/CHANGELOG.ja.md +12 -0
- package/CHANGELOG.ko.md +12 -0
- package/CHANGELOG.md +181 -3
- package/CHANGELOG.pt.md +13 -1
- package/CHANGELOG.ru.md +13 -1
- package/CHANGELOG.zh.md +12 -0
- package/README.de.md +218 -7
- package/README.es.md +218 -7
- package/README.fr.md +218 -7
- package/README.it.md +218 -7
- package/README.ja.md +218 -7
- package/README.ko.md +218 -7
- package/README.md +218 -7
- package/README.pt.md +218 -7
- package/README.ru.md +218 -7
- package/README.zh.md +218 -7
- 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 +76 -3
- package/lib/index.js +333 -18
- package/lib/policy.js +127 -0
- package/package.json +2 -2
- package/src/engine/decide.ps1 +120 -3
- package/src/engine/engine.ps1 +407 -5
- package/src/engine/win.ps1 +496 -6
- package/src/engine/worker.ps1 +57 -0
- package/src/schema/tools.json +156 -13
- package/types/index.d.ts +63 -4
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,13 +102,14 @@
|
|
|
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",
|
|
101
|
-
"
|
|
111
|
+
"requiresTier": "quiet",
|
|
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",
|
|
104
115
|
"properties": {
|
|
@@ -108,6 +119,7 @@
|
|
|
108
119
|
"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
120
|
"snapId": { "type": "string", "description": "The snapId the label came from; a superseded snapId is refused with stale_ref." },
|
|
110
121
|
"replace": { "type": "boolean", "default": false, "description": "Replace the existing value instead of appending to it." },
|
|
122
|
+
"caretPosition": { "type": "string", "enum": ["idle", "start", "end"], "default": "idle", "description": "Message door only: where the caret should be before the characters are sent. 'idle' touches nothing (the caret is wherever the control left it, which for a never-focused field is position 0 -- measured). 'start' is EM_SETSEL(0,0); 'end' is EM_SETSEL(len,len) with len read from the control, because EM_SETSEL(-1,-1) is documented as document-end and measured as no-op on WinForms EDIT. On a value containing newlines the numeric end can land inside the buffer, so the result reports the requested and the applied pair and the readback judges. The UIA value channel replaces the whole value and has no caret to move: it answers caretIgnored=value-pattern instead of pretending." },
|
|
111
123
|
"settleMs": { "type": "integer", "minimum": 0, "maximum": 2000, "default": 350, "description": "How long to let the app commit its state before the effect is judged." },
|
|
112
124
|
"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." },
|
|
113
125
|
"takeoverMaxMs": { "type": "integer", "minimum": 500, "maximum": 60000, "default": 10000, "description": "Takeover only: how long the action may hold the cursor/focus." },
|
|
@@ -116,12 +128,14 @@
|
|
|
116
128
|
"required": ["hwnd", "text"],
|
|
117
129
|
"additionalProperties": false
|
|
118
130
|
},
|
|
119
|
-
"
|
|
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.",
|
|
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"]
|
|
120
133
|
},
|
|
121
134
|
{
|
|
122
135
|
"name": "wpm_focus",
|
|
123
136
|
"action": "focus",
|
|
124
137
|
"engine": "Invoke-WpmAction -Action focus",
|
|
138
|
+
"requiresTier": "quiet",
|
|
125
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.",
|
|
126
140
|
"inputSchema": {
|
|
127
141
|
"type": "object",
|
|
@@ -137,12 +151,13 @@
|
|
|
137
151
|
"required": ["hwnd", "elementName"],
|
|
138
152
|
"additionalProperties": false
|
|
139
153
|
},
|
|
140
|
-
"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"]
|
|
141
155
|
},
|
|
142
156
|
{
|
|
143
157
|
"name": "wpm_status",
|
|
144
158
|
"action": "status",
|
|
145
159
|
"engine": "Get-WpmStatus",
|
|
160
|
+
"requiresTier": "readonly",
|
|
146
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.",
|
|
147
162
|
"inputSchema": {
|
|
148
163
|
"type": "object",
|
|
@@ -151,12 +166,13 @@
|
|
|
151
166
|
"additionalProperties": false
|
|
152
167
|
},
|
|
153
168
|
"refusals": [],
|
|
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."
|
|
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."
|
|
155
170
|
},
|
|
156
171
|
{
|
|
157
172
|
"name": "wpm_snapshot",
|
|
158
173
|
"action": "snapshot",
|
|
159
174
|
"engine": "Invoke-WpmAction -Action snapshot",
|
|
175
|
+
"requiresTier": "readonly",
|
|
160
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.",
|
|
161
177
|
"inputSchema": {
|
|
162
178
|
"type": "object",
|
|
@@ -170,12 +186,13 @@
|
|
|
170
186
|
"required": ["hwnd"],
|
|
171
187
|
"additionalProperties": false
|
|
172
188
|
},
|
|
173
|
-
"refusals": ["no_hwnd", "paused", "uia_probe_failed", "stale_ref"]
|
|
189
|
+
"refusals": ["no_hwnd", "paused", "uia_probe_failed", "stale_ref", "policy_denied"]
|
|
174
190
|
},
|
|
175
191
|
{
|
|
176
192
|
"name": "wpm_screenshot",
|
|
177
193
|
"action": "screenshot",
|
|
178
194
|
"engine": "Invoke-WpmAction -Action screenshot",
|
|
195
|
+
"requiresTier": "readonly",
|
|
179
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.",
|
|
180
197
|
"inputSchema": {
|
|
181
198
|
"type": "object",
|
|
@@ -187,12 +204,13 @@
|
|
|
187
204
|
"required": [],
|
|
188
205
|
"additionalProperties": false
|
|
189
206
|
},
|
|
190
|
-
"refusals": ["no_hwnd", "paused"]
|
|
207
|
+
"refusals": ["no_hwnd", "paused", "policy_denied"]
|
|
191
208
|
},
|
|
192
209
|
{
|
|
193
210
|
"name": "wpm_preview",
|
|
194
211
|
"action": "preview",
|
|
195
212
|
"engine": "Invoke-WpmAction -Action preview",
|
|
213
|
+
"requiresTier": "readonly",
|
|
196
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.",
|
|
197
215
|
"inputSchema": {
|
|
198
216
|
"type": "object",
|
|
@@ -204,7 +222,66 @@
|
|
|
204
222
|
"required": ["hwnd", "x", "y"],
|
|
205
223
|
"additionalProperties": false
|
|
206
224
|
},
|
|
207
|
-
"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"]
|
|
208
285
|
}
|
|
209
286
|
],
|
|
210
287
|
"refusalCases": [
|
|
@@ -368,6 +445,72 @@
|
|
|
368
445
|
"args": { "hwnd": "$liveHwnd", "elementName": "x" },
|
|
369
446
|
"expect": "restore_failed",
|
|
370
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."
|
|
371
514
|
}
|
|
372
515
|
]
|
|
373
516
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,15 +1,43 @@
|
|
|
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';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* WHO REPORTED THE SUCCESS. The first three name a messenger, not a degree of confidence (see the
|
|
21
|
+
* `effect` block in lib/index.js). `readback-verified` is the fourth and the only one that is about the
|
|
22
|
+
* application rather than about the call: the value was read back after the settle window and equals
|
|
23
|
+
* what the control's own measurements predicted. A masked field never reaches it (readback=unavailable)
|
|
24
|
+
* and a reformatted value never reaches it (readbackMismatch=true) -- the engine does not upgrade on
|
|
25
|
+
* "the call came back".
|
|
26
|
+
*/
|
|
27
|
+
export type WpmEffect =
|
|
28
|
+
| 'unverified' | 'reported-by-send' | 'reported-by-pattern' | 'readback-verified';
|
|
29
|
+
|
|
30
|
+
/** Where the caret sits before the message door types. `idle` touches nothing. */
|
|
31
|
+
export type WpmCaretPosition = 'idle' | 'start' | 'end';
|
|
7
32
|
|
|
8
33
|
export type RefusalCode =
|
|
9
34
|
| 'no_hwnd' | 'paused' | 'elevated_target' | 'unreachable'
|
|
10
35
|
| 'uia_tree_empty' | 'uia_probe_failed' | 'terminal_no_door' | 'needs_facts'
|
|
11
36
|
| 'takeover_unavailable' | 'keyinject_unavailable' | 'action_failed'
|
|
12
|
-
| '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';
|
|
13
41
|
|
|
14
42
|
export type KeyInputMode = 'none' | 'inject';
|
|
15
43
|
|
|
@@ -19,6 +47,15 @@ export type WpmPointSpace = 'screen' | 'image';
|
|
|
19
47
|
/** Frame source of a captured screenRect. `dwm` is the DWM extended frame; `win32` is the fallback. */
|
|
20
48
|
export type WpmFrameSource = 'dwm' | 'win32';
|
|
21
49
|
|
|
50
|
+
/**
|
|
51
|
+
* WHICH CAPTURE PATH produced a screenshot. `bitblt` is the cheap GDI path (measured 16-21ms against
|
|
52
|
+
* 22-33ms for the other); `gdiplus` is `Graphics.CopyFromScreen`, either the explicit choice or the
|
|
53
|
+
* fallback after BitBlt was refused. The two are measured equivalent on a still scene, but they are not
|
|
54
|
+
* the same call and the field is never omitted -- a path that changed silently is the failure mode this
|
|
55
|
+
* repo has already been caught by once with `frame`.
|
|
56
|
+
*/
|
|
57
|
+
export type WpmCaptureBackend = 'bitblt' | 'gdiplus';
|
|
58
|
+
|
|
22
59
|
export interface WpmWindow {
|
|
23
60
|
hwnd: string; title: string; class: string; pid: number;
|
|
24
61
|
rect: { left: number; top: number; right: number; bottom: number };
|
|
@@ -44,6 +81,7 @@ export interface WpmShot {
|
|
|
44
81
|
scale: number;
|
|
45
82
|
identity: boolean;
|
|
46
83
|
frame: WpmFrameSource;
|
|
84
|
+
captureBackend?: WpmCaptureBackend;
|
|
47
85
|
dpiAware: boolean;
|
|
48
86
|
}
|
|
49
87
|
|
|
@@ -55,6 +93,7 @@ export interface WpmArgs {
|
|
|
55
93
|
text?: string;
|
|
56
94
|
elementName?: string;
|
|
57
95
|
replace?: boolean;
|
|
96
|
+
caretPosition?: WpmCaretPosition;
|
|
58
97
|
settleMs?: number;
|
|
59
98
|
takeover?: boolean;
|
|
60
99
|
takeoverMaxMs?: number;
|
|
@@ -70,6 +109,17 @@ export interface WpmArgs {
|
|
|
70
109
|
intent?: string;
|
|
71
110
|
fullScreen?: boolean;
|
|
72
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;
|
|
73
123
|
}
|
|
74
124
|
|
|
75
125
|
export interface WpmResult {
|
|
@@ -77,7 +127,7 @@ export interface WpmResult {
|
|
|
77
127
|
refusal?: RefusalCode;
|
|
78
128
|
channel?: string;
|
|
79
129
|
tier?: string;
|
|
80
|
-
effect?:
|
|
130
|
+
effect?: WpmEffect;
|
|
81
131
|
proof?: 'pass' | 'fail' | 'inconclusive';
|
|
82
132
|
focusTaken?: boolean;
|
|
83
133
|
takeover?: 'on' | 'off';
|
|
@@ -102,9 +152,18 @@ export interface WpmResult {
|
|
|
102
152
|
scale?: number;
|
|
103
153
|
identity?: boolean;
|
|
104
154
|
frame?: WpmFrameSource;
|
|
155
|
+
captureBackend?: WpmCaptureBackend;
|
|
156
|
+
captureNote?: string;
|
|
105
157
|
dpiAware?: boolean;
|
|
106
158
|
// ---- preview ----
|
|
107
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;
|
|
108
167
|
[key: string]: unknown;
|
|
109
168
|
}
|
|
110
169
|
|