dsh-windows-parallel-mcp 0.8.2 → 0.9.0-rc.2

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.
Files changed (53) hide show
  1. package/CHANGELOG.de.md +444 -419
  2. package/CHANGELOG.es.md +444 -419
  3. package/CHANGELOG.fr.md +444 -419
  4. package/CHANGELOG.it.md +444 -419
  5. package/CHANGELOG.ja.md +444 -419
  6. package/CHANGELOG.ko.md +444 -419
  7. package/CHANGELOG.md +965 -940
  8. package/CHANGELOG.pt.md +444 -419
  9. package/CHANGELOG.ru.md +444 -419
  10. package/CHANGELOG.zh.md +444 -419
  11. package/INSTALL.de.md +126 -126
  12. package/INSTALL.es.md +126 -126
  13. package/INSTALL.fr.md +126 -126
  14. package/INSTALL.it.md +126 -126
  15. package/INSTALL.ja.md +126 -126
  16. package/INSTALL.ko.md +126 -126
  17. package/INSTALL.md +122 -122
  18. package/INSTALL.pt.md +126 -126
  19. package/INSTALL.ru.md +126 -126
  20. package/INSTALL.zh.md +126 -126
  21. package/README.de.md +684 -684
  22. package/README.es.md +684 -684
  23. package/README.fr.md +684 -684
  24. package/README.it.md +684 -684
  25. package/README.ja.md +684 -684
  26. package/README.ko.md +684 -684
  27. package/README.md +680 -680
  28. package/README.pt.md +684 -684
  29. package/README.ru.md +684 -684
  30. package/README.zh.md +684 -684
  31. package/cordis.patch.yml +15 -15
  32. package/docs/refusals.md +90 -90
  33. package/docs/takeover.md +128 -128
  34. package/dsh.plugin.json +18 -18
  35. package/lib/config.js +275 -275
  36. package/lib/engine.js +252 -252
  37. package/lib/host-tools.js +365 -338
  38. package/lib/index.js +1275 -1249
  39. package/lib/peers-schemastery.js +23 -23
  40. package/lib/peers-tools.js +15 -15
  41. package/lib/proof-window.mjs +427 -427
  42. package/package.json +122 -122
  43. package/server.json +110 -110
  44. package/src/engine/decide.ps1 +356 -356
  45. package/src/engine/engine.ps1 +1208 -1208
  46. package/src/engine/hud.ps1 +411 -411
  47. package/src/engine/input-inject.ps1 +176 -176
  48. package/src/engine/overlay.ps1 +389 -389
  49. package/src/engine/takeover.ps1 +144 -144
  50. package/src/engine/win.ps1 +1881 -1881
  51. package/src/engine/worker.ps1 +310 -310
  52. package/src/schema/tools.json +533 -533
  53. package/types/index.d.ts +190 -187
@@ -1,533 +1,533 @@
1
- {
2
- "schemaVersion": "0.1.0",
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
- "hostProjection": {
5
- "form": "A",
6
- "decided": "2026-11-19",
7
- "why": "root cause: five resident tool schemas describing one engine is a standing per-turn token cost with no added capability; the host's own shell/terminal tools are one-tool-with-action. The action surface here is unchanged -- same actions, same arguments, same refusal codes (0.5.0 added three read-only actions to the SAME one tool, so the token argument still holds).",
8
- "package": "dsh-windows-parallel-mcp",
9
- "tool": "wpm",
10
- "discriminator": "action",
11
- "source": "lib/host-tools.js#PARAMETERS",
12
- "actions": {
13
- "wpm_windows": "windows",
14
- "wpm_click": "click",
15
- "wpm_type": "type",
16
- "wpm_focus": "focus",
17
- "wpm_status": "status",
18
- "wpm_snapshot": "snapshot",
19
- "wpm_screenshot": "screenshot",
20
- "wpm_preview": "preview",
21
- "wpm_launch": "launch",
22
- "wpm_clipboard": "clipboard",
23
- "wpm_window": "window"
24
- },
25
- "extraWorkerActions": [
26
- { "action": "ping", "exposed": false, "why": "protocol/encoding self-test; not part of the tool surface" },
27
- { "action": "pause", "exposed": false, "why": "owner control, behind the settings pill rather than the model's reach" }
28
- ]
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
- },
46
- "notes": [
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.",
49
- "src/engine/engine.ps1 is the only implementation; this file is the contract, not a second implementation.",
50
- "docs/refusals.md is the human-readable form of `refusals`; scripts/check-refusals.mjs keeps them equal.",
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.",
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."
55
- ],
56
- "stance": {
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)",
58
- "focus": "no forged Alt key, no synthetic activation code. The bounded-flash tier reverses its one flash; the takeover tier holds the focus until the action ends and then restores it through the same table",
59
- "cursor": "the cursor is 0 px in the quiet and bounded-flash tiers (24 measured rounds, scripts/channel-raise-matrix.ps1). The takeover tier moves it to the action point BY REQUEST and always restores it; a restore that fails is reported as cursorRestored=false and turns proof=fail",
60
- "keyboard": "keyboard injection exists only inside the takeover tier, only for targets with no message door and no UIA pattern (terminals, measured), only after asserting GetForegroundWindow() is the target. It does not carry hardware scancodes (KEYEVENTF_UNICODE), so a target that reads scancodes only will ignore it -- documented, not a bug",
61
- "tiers": "quiet (window messages) preferred over bounded-flash (UIA patterns) preferred over takeover (explicit request, HUD mandatory, always restored); the flash tier must reverse itself once and never pulls focus from a window the owner chose",
62
- "hud": "the takeover tier cannot run without the HUD: it is a hard precondition (refuse takeover_unavailable), not a decoration. Three phases (arming/active/done), no-activate, click-through outside its button, and three independent interruption paths"
63
- },
64
- "refusals": [
65
- { "code": "no_hwnd", "layer": "decision", "summary": "no usable target window handle" },
66
- { "code": "paused", "layer": "decision", "summary": "the owner paused input; server-side refusal" },
67
- { "code": "elevated_target", "layer": "decision", "summary": "target runs at a higher integrity level" },
68
- { "code": "unreachable", "layer": "decision", "summary": "no message door and no usable UIA pattern; the tree is alive but offers nothing at the named point or element" },
69
- { "code": "uia_tree_empty", "layer": "decision", "summary": "the accessibility tree holds no content element at all; in every measured instance the cause is the application having UI Automation disabled, which only a launch-time switch changes" },
70
- { "code": "uia_probe_failed", "layer": "decision", "summary": "the accessibility probe threw before it could measure this target; the exception text rides the reason" },
71
- { "code": "terminal_no_door", "layer": "decision", "summary": "terminal text surface has child windows but none of them is writable, and keyboard injection into this host's terminal was measured not to work (findings G3: Unicode and scan-code arms both accepted by SendInput, neither executed). Pick a target with a real door" },
72
- { "code": "needs_facts", "layer": "decision", "summary": "the caller supplied no measured facts for this target" },
73
- { "code": "takeover_unavailable", "layer": "decision", "summary": "takeover was requested but cannot run safely: the takeoverAllowed gate is off or the HUD is not up. The request is refused rather than silently downgraded" },
74
- { "code": "keyinject_unavailable", "layer": "decision", "summary": "keyboard injection was requested outside the takeover tier, with the keyInjectAllowed gate off, or with the target not in the foreground (SendInput writes to the foreground, so a blind injection would type into another application)" },
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)" },
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" },
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)" },
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)" }
82
- ],
83
- "tools": [
84
- {
85
- "name": "wpm_windows",
86
- "action": "windows",
87
- "engine": "Get-WpmWindowList",
88
- "requiresTier": "readonly",
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.",
90
- "inputSchema": {
91
- "type": "object",
92
- "properties": {},
93
- "required": [],
94
- "additionalProperties": false
95
- },
96
- "refusals": [],
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."
98
- },
99
- {
100
- "name": "wpm_click",
101
- "action": "click",
102
- "engine": "Invoke-WpmAction -Action click",
103
- "requiresTier": "quiet",
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.",
105
- "inputSchema": {
106
- "type": "object",
107
- "properties": {
108
- "hwnd": { "type": "string", "description": "Target top-level window handle, as returned by wpm_windows." },
109
- "x": { "type": "integer", "description": "Screen X coordinate (or image X with space:'image'). Must resolve to a child window of the target, otherwise the action is refused instead of being sent somewhere else." },
110
- "y": { "type": "integer", "description": "Screen Y coordinate (or image Y with space:'image')." },
111
- "space": { "type": "string", "enum": ["screen", "image"], "default": "screen", "description": "Coordinate space of x/y. 'screen' (default) is physical screen pixels. 'image' means image pixels from the screenshot named by shotId; the engine converts them and still applies the point-ownership assertion, so a conversion bug cannot send the click to another window." },
112
- "shotId": { "type": "string", "description": "The shotId returned by wpm_screenshot. Required when space:'image' (a pre-worker refusal otherwise); an id that was already cleaned up is refused with stale_ref rather than reinterpreted." },
113
- "label": { "type": "integer", "minimum": 1, "description": "Element number from wpm_snapshot. Act on that element through its UIA pattern instead of guessing from the point. x/y are still required and must fall inside the labelled element's rect, so 'the point is the contract' stays true." },
114
- "snapId": { "type": "string", "description": "The snapId the label came from. A label whose snapId has been superseded is refused with stale_ref -- element numbers are only meaningful for the frame they were printed in." },
115
- "settleMs": { "type": "integer", "minimum": 0, "maximum": 2000, "default": 350, "description": "How long to let the app commit its state before the effect is judged." },
116
- "takeover": { "type": "boolean", "default": false, "description": "Take the takeover tier: the real cursor moves to the action point and is always restored, the focus is held until the action ends, and a three-phase HUD is mandatory. Requires the takeoverAllowed setting or the call is refused with takeover_unavailable." },
117
- "takeoverMaxMs": { "type": "integer", "minimum": 500, "maximum": 60000, "default": 10000, "description": "Takeover only: how long the action may hold the cursor/focus." }
118
- },
119
- "required": ["hwnd", "x", "y"],
120
- "additionalProperties": false
121
- },
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"]
123
- },
124
- {
125
- "name": "wpm_type",
126
- "action": "type",
127
- "engine": "Invoke-WpmAction -Action type",
128
- "requiresTier": "quiet",
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.",
130
- "inputSchema": {
131
- "type": "object",
132
- "properties": {
133
- "hwnd": { "type": "string", "description": "Target top-level window handle." },
134
- "text": { "type": "string", "description": "Text to write. Empty string is refused: it cannot be distinguished from a channel that silently did nothing." },
135
- "elementName": { "type": "string", "description": "Optional UIA Name or AutomationId of the control to write into. Naming an element forces the UIA tier, because a message tier cannot address 'the control called X'." },
136
- "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." },
137
- "snapId": { "type": "string", "description": "The snapId the label came from; a superseded snapId is refused with stale_ref." },
138
- "replace": { "type": "boolean", "default": false, "description": "Replace the existing value instead of appending to it." },
139
- "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." },
140
- "settleMs": { "type": "integer", "minimum": 0, "maximum": 2000, "default": 350, "description": "How long to let the app commit its state before the effect is judged." },
141
- "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." },
142
- "takeoverMaxMs": { "type": "integer", "minimum": 500, "maximum": 60000, "default": 10000, "description": "Takeover only: how long the action may hold the cursor/focus." },
143
- "keyInput": { "type": "string", "enum": ["none", "inject"], "default": "none", "description": "Takeover only: 'inject' types the text with synthetic keyboard input into the foreground target, for windows with no message door and no UIA pattern (terminals). Requires keyInjectAllowed and the target in the foreground; otherwise the call is refused with keyinject_unavailable. The cursor is never moved by this path." }
144
- },
145
- "required": ["hwnd", "text"],
146
- "additionalProperties": false
147
- },
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.",
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"]
150
- },
151
- {
152
- "name": "wpm_focus",
153
- "action": "focus",
154
- "engine": "Invoke-WpmAction -Action focus",
155
- "requiresTier": "quiet",
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.",
157
- "inputSchema": {
158
- "type": "object",
159
- "properties": {
160
- "hwnd": { "type": "string", "description": "Target top-level window handle." },
161
- "elementName": { "type": "string", "description": "UIA Name or AutomationId of the control that should hold focus." },
162
- "label": { "type": "integer", "minimum": 1, "description": "Element number from wpm_snapshot: focus that element. A faster, unambiguous alternative to elementName on a tree you have already read." },
163
- "snapId": { "type": "string", "description": "The snapId the label came from; a superseded snapId is refused with stale_ref." },
164
- "settleMs": { "type": "integer", "minimum": 0, "maximum": 2000, "default": 350, "description": "How long to let the app commit its state before the effect is judged." },
165
- "takeover": { "type": "boolean", "default": false, "description": "Take the takeover tier: the HUD is shown and the focus is held until the action ends, then restored. Requires the takeoverAllowed setting." },
166
- "takeoverMaxMs": { "type": "integer", "minimum": 500, "maximum": 60000, "default": 10000, "description": "Takeover only: how long the action may hold the cursor/focus." }
167
- },
168
- "required": ["hwnd", "elementName"],
169
- "additionalProperties": false
170
- },
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"]
172
- },
173
- {
174
- "name": "wpm_status",
175
- "action": "status",
176
- "engine": "Get-WpmStatus",
177
- "requiresTier": "readonly",
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.",
179
- "inputSchema": {
180
- "type": "object",
181
- "properties": {},
182
- "required": [],
183
- "additionalProperties": false
184
- },
185
- "refusals": [],
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."
187
- },
188
- {
189
- "name": "wpm_snapshot",
190
- "action": "snapshot",
191
- "engine": "Invoke-WpmAction -Action snapshot",
192
- "requiresTier": "readonly",
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.",
194
- "inputSchema": {
195
- "type": "object",
196
- "properties": {
197
- "hwnd": { "type": "string", "description": "Target top-level window handle from wpm_windows." },
198
- "maxElements": { "type": "integer", "minimum": 1, "maximum": 5000, "default": 300, "description": "Hard cap on returned elements; the text then says 'truncated at N of M' and `truncated` is true. Measured trees: 71 visible elements for an 816-node Electron window, so the default is deliberately loose." },
199
- "interactableOnly": { "type": "boolean", "default": true, "description": "Return only elements that expose a usable UIA pattern (the zero-cost first pass at a giant tree). Set false to see the whole visible tree, chrome included." },
200
- "sinceSnapId": { "type": "string", "description": "Report an incremental diff against this earlier snapId instead of re-describing every element: added / removed / changed, keyed by UIA RuntimeId. An unchanged tree produces an empty delta, which is the point -- repeating an unchanged table is the main token cost of a multi-step flow." },
201
- "intent": { "type": "string", "description": "What this frame is FOR (e.g. 'close the settings dialog'). It travels with the frame so a clean deciding subagent gets the goal and the numbered table together and answers with one label." }
202
- },
203
- "required": ["hwnd"],
204
- "additionalProperties": false
205
- },
206
- "refusals": ["no_hwnd", "paused", "uia_probe_failed", "stale_ref", "policy_denied"]
207
- },
208
- {
209
- "name": "wpm_screenshot",
210
- "action": "screenshot",
211
- "engine": "Invoke-WpmAction -Action screenshot",
212
- "requiresTier": "readonly",
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.",
214
- "inputSchema": {
215
- "type": "object",
216
- "properties": {
217
- "hwnd": { "type": "string", "description": "Target top-level window handle from wpm_windows. Required unless fullScreen is true." },
218
- "fullScreen": { "type": "boolean", "default": false, "description": "Capture the whole virtual screen instead of one window. Off by default on purpose: silently capturing the owner's entire desktop is exactly the kind of quiet overreach this product refuses elsewhere." },
219
- "maxWidth": { "type": "integer", "minimum": 0, "maximum": 7680, "default": 0, "description": "Downscale the saved image to at most this width. 0 (default) means scale=1 and identity=true -- no silent resampling, because a resized image is a CHANGED coordinate system and this action exists to make coordinates honest." }
220
- },
221
- "required": [],
222
- "additionalProperties": false
223
- },
224
- "refusals": ["no_hwnd", "paused", "policy_denied"]
225
- },
226
- {
227
- "name": "wpm_preview",
228
- "action": "preview",
229
- "engine": "Invoke-WpmAction -Action preview",
230
- "requiresTier": "readonly",
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.",
232
- "inputSchema": {
233
- "type": "object",
234
- "properties": {
235
- "hwnd": { "type": "string", "description": "Target top-level window handle from wpm_windows." },
236
- "x": { "type": "integer", "description": "Screen X coordinate to preview. Must belong to the target window, otherwise the call is refused instead of reporting an element from another application." },
237
- "y": { "type": "integer", "description": "Screen Y coordinate to preview." }
238
- },
239
- "required": ["hwnd", "x", "y"],
240
- "additionalProperties": false
241
- },
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"]
302
- }
303
- ],
304
- "refusalCases": [
305
- {
306
- "id": "click-dead-hwnd",
307
- "mode": "engine",
308
- "tool": "wpm_click",
309
- "args": { "hwnd": "$deadHwnd", "x": 100, "y": 100 },
310
- "expect": "no_hwnd",
311
- "note": "A handle that does not identify a live window. Measured, no window is touched."
312
- },
313
- {
314
- "id": "click-stale-shot",
315
- "mode": "engine",
316
- "tool": "wpm_click",
317
- "args": { "hwnd": "$liveHwnd", "x": 100, "y": 100, "space": "image", "shotId": "wpm-shot-0000-nonexistent" },
318
- "expect": "stale_ref",
319
- "note": "space:'image' names a shotId the engine never issued. The engine refuses instead of reinterpreting the image pixels as screen pixels -- substituting the raw numbers would click somewhere plausibly wrong, which is the failure class this code exists for. Measured: the call never reaches the door probe."
320
- },
321
- {
322
- "id": "preview-outside-target",
323
- "mode": "engine",
324
- "tool": "wpm_preview",
325
- "args": { "hwnd": "$winformsHwnd", "x": 2, "y": 2 },
326
- "expect": "unreachable",
327
- "note": "The refusal-test target is placed at 60,60, so (2,2) is outside it. A preview point that belongs to another window must be refused, not answered with that window's element: reporting 'you would click the desktop' and drawing the marker there would make the preview the one place this product guesses about a point it was not given. This is also the executable instance of `unreachable` (the two named-element-miss cases cannot run on this host: the WinForms positive control currently surfaces its controls as bare Panes through the legacy MSAA bridge, see findings.md)."
328
- },
329
- {
330
- "id": "snapshot-dead-hwnd",
331
- "mode": "engine",
332
- "tool": "wpm_snapshot",
333
- "args": { "hwnd": "$deadHwnd" },
334
- "expect": "no_hwnd",
335
- "note": "A snapshot needs a live window: there is no tree to number. Same handle as the click case, and zero elements/patterns are touched."
336
- },
337
- {
338
- "id": "screenshot-dead-hwnd",
339
- "mode": "engine",
340
- "tool": "wpm_screenshot",
341
- "args": { "hwnd": "$deadHwnd" },
342
- "expect": "no_hwnd",
343
- "note": "Same reason as snapshot. fullScreen:true is the only path that does not need a window, and this case does not pass it."
344
- },
345
- {
346
- "id": "preview-dead-hwnd",
347
- "mode": "engine",
348
- "tool": "wpm_preview",
349
- "args": { "hwnd": "$deadHwnd", "x": 100, "y": 100 },
350
- "expect": "no_hwnd",
351
- "note": "A preview point that belongs to no named window has nothing to report and nothing to draw, so it refuses rather than looking up whatever application happens to own that pixel."
352
- },
353
- {
354
- "id": "click-while-paused",
355
- "mode": "engine",
356
- "tool": "wpm_click",
357
- "args": { "hwnd": "$liveHwnd", "x": 100, "y": 100 },
358
- "setup": "pause",
359
- "expect": "paused",
360
- "note": "Pause is a server-side refusal checked before any capability, so a paused engine cannot be talked into acting by a target that looks reachable. Note it is wpm_status that stays callable while paused (a query), not the action tools."
361
- },
362
- {
363
- "id": "type-winforms-named-missing",
364
- "mode": "engine",
365
- "tool": "wpm_type",
366
- "args": { "hwnd": "$winformsHwnd", "text": "x", "elementName": "$missingName" },
367
- "expect": "unreachable",
368
- "note": "WinForms has a message door but no UIA pattern. Naming an element suppresses the door (a message cannot address 'the control called X'), so the target is honestly unreachable rather than quietly clicked at a guessed child."
369
- },
370
- {
371
- "id": "focus-winforms",
372
- "mode": "engine",
373
- "tool": "wpm_focus",
374
- "args": { "hwnd": "$winformsHwnd", "elementName": "$missingName" },
375
- "expect": "unreachable",
376
- "note": "Focus requires UIA by definition; a WinForms target with no pattern must be refused, never approximated."
377
- },
378
- {
379
- "id": "elevated-target",
380
- "mode": "decision",
381
- "tool": "wpm_click",
382
- "facts": { "hwnd": "$liveHwnd", "elevatedTarget": true },
383
- "expect": "elevated_target",
384
- "note": "Decision-table instance. The flag is now wired (win.ps1 IsElevatedTarget, token integrity comparison) and measured live on Task Manager by test/integrity-probe.ps1; the engine-level case additionally runs in test/llm-action-battery.mjs whenever a high-integrity window exists at run time."
385
- },
386
- {
387
- "id": "terminal-no-door",
388
- "mode": "decision",
389
- "tool": "wpm_type",
390
- "facts": { "hwnd": "$liveHwnd", "family": "terminal" },
391
- "expect": "terminal_no_door",
392
- "note": "Decision-table instance, and now a conclusion verified by measurement rather than by caution: the takeover + keyInput path was measured NOT to drive this host's terminal (scripts/probe-console-inject.ps1: 242 Unicode events with the terminal in the foreground and Enter sent, nothing executed; scripts/probe-console-scan.ps1: same with layout scan codes). The code stays because its next step is still actionable -- use a target with a door."
393
- },
394
- {
395
- "id": "click-uia-tree-empty",
396
- "mode": "decision",
397
- "tool": "wpm_click",
398
- "facts": { "hwnd": "$liveHwnd", "family": "chromium", "uiaTreeEmpty": true },
399
- "expect": "uia_tree_empty",
400
- "note": "Decision-table instance of the 2026-11-21 census: a Chromium window with renderer accessibility off walks to a tree with ZERO content elements (uTools measured one Chrome Legacy Window shell Pane, 0 interactive elements, identical across three in-place reads). Distinct from unreachable because the fix differs: nothing a re-query can find -- the app must relaunch with a11y on (--force-renderer-accessibility) or a different target must be picked. Real instance: scripts/uia-tree-content.ps1 plus a live engine call against uTools."
401
- },
402
- {
403
- "id": "click-uia-probe-failed",
404
- "mode": "decision",
405
- "tool": "wpm_click",
406
- "facts": { "hwnd": "$liveHwnd", "uiaProbeFailed": true },
407
- "expect": "uia_probe_failed",
408
- "note": "Decision-table instance. The UIA probe threw between the IsWindow check and the tree walk (element destroyed under the probe), so door measurement is impossible and no conclusion about the target is licensed. The engine appends the exception text to the reason as [uia: ...]. Before this code existed a thrown probe and a genuinely pattern-less target shared 'unreachable', and uiaErr arrived here as dead data."
409
- },
410
- {
411
- "id": "needs-facts",
412
- "mode": "decision",
413
- "tool": null,
414
- "facts": null,
415
- "expect": "needs_facts",
416
- "note": "The absence of facts must refuse, not default to the quiet branch. Unreachable through the engine (facts are always measured), so this one guards the table when it is used on its own."
417
- },
418
- {
419
- "id": "takeover-unavailable",
420
- "mode": "decision",
421
- "tool": "wpm_click",
422
- "facts": { "hwnd": "$liveHwnd", "takeoverRequested": true, "hudReady": false },
423
- "expect": "takeover_unavailable",
424
- "note": "Takeover was asked for but the HUD is not up. The HUD is a hard precondition, so the request is refused instead of being served silently by the quiet tier -- the point of the code is that the caller learns the request did not happen."
425
- },
426
- {
427
- "id": "keyinject-unavailable",
428
- "mode": "decision",
429
- "tool": "wpm_type",
430
- "facts": { "hwnd": "$liveHwnd", "takeoverRequested": true, "hudReady": true, "keyInjectRequested": true, "keyInjectAllowed": false },
431
- "expect": "keyinject_unavailable",
432
- "note": "Injection requested with the keyInjectAllowed gate off. Measured fact behind the refusal: SendInput writes to the FOREGROUND window (scripts/probe-sendinput-unicode.ps1 arm B: text landed in the foreground window and not in the window the caller had in mind), so an unauthorised injection is refused rather than attempted."
433
- },
434
- {
435
- "id": "keyinject-not-foreground",
436
- "mode": "decision",
437
- "tool": "wpm_type",
438
- "facts": { "hwnd": "$liveHwnd", "takeoverRequested": true, "hudReady": true, "keyInjectRequested": true, "keyInjectAllowed": true, "foregroundIsTarget": false },
439
- "expect": "keyinject_unavailable",
440
- "note": "Injection requested, gate open, but the target is not the foreground window and could not be raised. The engine refuses: blind injection would type into whatever the owner was using (same measured fact as keyinject-unavailable)."
441
- },
442
- {
443
- "id": "takeover-aborted",
444
- "mode": "none",
445
- "tool": "wpm_click",
446
- "args": { "hwnd": "$liveHwnd", "x": 100, "y": 100 },
447
- "expect": "takeover_aborted",
448
- "note": "NOT covered by an executable schema case: it is a RUNTIME outcome of an interruption (HUD button / abort chord / host cancellation), and constructing one needs a live takeover in progress. test/takeover-test.ps1 covers the three interruption paths at the engine level; the reason is declared in tools.json refusals."
449
- },
450
- {
451
- "id": "action-failed",
452
- "mode": "none",
453
- "tool": "wpm_type",
454
- "args": { "hwnd": "$liveHwnd", "text": "x" },
455
- "expect": "action_failed",
456
- "note": "NOT COVERED: needs a target whose channel reliably throws. Not constructed this round; reported as uncovered rather than claimed."
457
- },
458
- {
459
- "id": "restore-failed",
460
- "mode": "none",
461
- "tool": "wpm_focus",
462
- "args": { "hwnd": "$liveHwnd", "elementName": "x" },
463
- "expect": "restore_failed",
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."
531
- }
532
- ]
533
- }
1
+ {
2
+ "schemaVersion": "0.1.0",
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
+ "hostProjection": {
5
+ "form": "A",
6
+ "decided": "2026-11-19",
7
+ "why": "root cause: five resident tool schemas describing one engine is a standing per-turn token cost with no added capability; the host's own shell/terminal tools are one-tool-with-action. The action surface here is unchanged -- same actions, same arguments, same refusal codes (0.5.0 added three read-only actions to the SAME one tool, so the token argument still holds).",
8
+ "package": "dsh-windows-parallel-mcp",
9
+ "tool": "wpm",
10
+ "discriminator": "action",
11
+ "source": "lib/host-tools.js#PARAMETERS",
12
+ "actions": {
13
+ "wpm_windows": "windows",
14
+ "wpm_click": "click",
15
+ "wpm_type": "type",
16
+ "wpm_focus": "focus",
17
+ "wpm_status": "status",
18
+ "wpm_snapshot": "snapshot",
19
+ "wpm_screenshot": "screenshot",
20
+ "wpm_preview": "preview",
21
+ "wpm_launch": "launch",
22
+ "wpm_clipboard": "clipboard",
23
+ "wpm_window": "window"
24
+ },
25
+ "extraWorkerActions": [
26
+ { "action": "ping", "exposed": false, "why": "protocol/encoding self-test; not part of the tool surface" },
27
+ { "action": "pause", "exposed": false, "why": "owner control, behind the settings pill rather than the model's reach" }
28
+ ]
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
+ },
46
+ "notes": [
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.",
49
+ "src/engine/engine.ps1 is the only implementation; this file is the contract, not a second implementation.",
50
+ "docs/refusals.md is the human-readable form of `refusals`; scripts/check-refusals.mjs keeps them equal.",
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.",
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."
55
+ ],
56
+ "stance": {
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)",
58
+ "focus": "no forged Alt key, no synthetic activation code. The bounded-flash tier reverses its one flash; the takeover tier holds the focus until the action ends and then restores it through the same table",
59
+ "cursor": "the cursor is 0 px in the quiet and bounded-flash tiers (24 measured rounds, scripts/channel-raise-matrix.ps1). The takeover tier moves it to the action point BY REQUEST and always restores it; a restore that fails is reported as cursorRestored=false and turns proof=fail",
60
+ "keyboard": "keyboard injection exists only inside the takeover tier, only for targets with no message door and no UIA pattern (terminals, measured), only after asserting GetForegroundWindow() is the target. It does not carry hardware scancodes (KEYEVENTF_UNICODE), so a target that reads scancodes only will ignore it -- documented, not a bug",
61
+ "tiers": "quiet (window messages) preferred over bounded-flash (UIA patterns) preferred over takeover (explicit request, HUD mandatory, always restored); the flash tier must reverse itself once and never pulls focus from a window the owner chose",
62
+ "hud": "the takeover tier cannot run without the HUD: it is a hard precondition (refuse takeover_unavailable), not a decoration. Three phases (arming/active/done), no-activate, click-through outside its button, and three independent interruption paths"
63
+ },
64
+ "refusals": [
65
+ { "code": "no_hwnd", "layer": "decision", "summary": "no usable target window handle" },
66
+ { "code": "paused", "layer": "decision", "summary": "the owner paused input; server-side refusal" },
67
+ { "code": "elevated_target", "layer": "decision", "summary": "target runs at a higher integrity level" },
68
+ { "code": "unreachable", "layer": "decision", "summary": "no message door and no usable UIA pattern; the tree is alive but offers nothing at the named point or element" },
69
+ { "code": "uia_tree_empty", "layer": "decision", "summary": "the accessibility tree holds no content element at all; in every measured instance the cause is the application having UI Automation disabled, which only a launch-time switch changes" },
70
+ { "code": "uia_probe_failed", "layer": "decision", "summary": "the accessibility probe threw before it could measure this target; the exception text rides the reason" },
71
+ { "code": "terminal_no_door", "layer": "decision", "summary": "terminal text surface has child windows but none of them is writable, and keyboard injection into this host's terminal was measured not to work (findings G3: Unicode and scan-code arms both accepted by SendInput, neither executed). Pick a target with a real door" },
72
+ { "code": "needs_facts", "layer": "decision", "summary": "the caller supplied no measured facts for this target" },
73
+ { "code": "takeover_unavailable", "layer": "decision", "summary": "takeover was requested but cannot run safely: the takeoverAllowed gate is off or the HUD is not up. The request is refused rather than silently downgraded" },
74
+ { "code": "keyinject_unavailable", "layer": "decision", "summary": "keyboard injection was requested outside the takeover tier, with the keyInjectAllowed gate off, or with the target not in the foreground (SendInput writes to the foreground, so a blind injection would type into another application)" },
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)" },
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" },
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)" },
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)" }
82
+ ],
83
+ "tools": [
84
+ {
85
+ "name": "wpm_windows",
86
+ "action": "windows",
87
+ "engine": "Get-WpmWindowList",
88
+ "requiresTier": "readonly",
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.",
90
+ "inputSchema": {
91
+ "type": "object",
92
+ "properties": {},
93
+ "required": [],
94
+ "additionalProperties": false
95
+ },
96
+ "refusals": [],
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."
98
+ },
99
+ {
100
+ "name": "wpm_click",
101
+ "action": "click",
102
+ "engine": "Invoke-WpmAction -Action click",
103
+ "requiresTier": "quiet",
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.",
105
+ "inputSchema": {
106
+ "type": "object",
107
+ "properties": {
108
+ "hwnd": { "type": "string", "description": "Target top-level window handle, as returned by wpm_windows." },
109
+ "x": { "type": "integer", "integer": true, "description": "Screen X coordinate (or image X with space:'image'). Must resolve to a child window of the target, otherwise the action is refused instead of being sent somewhere else." },
110
+ "y": { "type": "integer", "integer": true, "description": "Screen Y coordinate (or image Y with space:'image')." },
111
+ "space": { "type": "string", "enum": ["screen", "image"], "default": "screen", "description": "Coordinate space of x/y. 'screen' (default) is physical screen pixels. 'image' means image pixels from the screenshot named by shotId; the engine converts them and still applies the point-ownership assertion, so a conversion bug cannot send the click to another window." },
112
+ "shotId": { "type": "string", "description": "The shotId returned by wpm_screenshot. Required when space:'image' (a pre-worker refusal otherwise); an id that was already cleaned up is refused with stale_ref rather than reinterpreted." },
113
+ "label": { "type": "integer", "integer": true, "minimum": 1, "description": "Element number from wpm_snapshot. Act on that element through its UIA pattern instead of guessing from the point. x/y are still required and must fall inside the labelled element's rect, so 'the point is the contract' stays true." },
114
+ "snapId": { "type": "string", "description": "The snapId the label came from. A label whose snapId has been superseded is refused with stale_ref -- element numbers are only meaningful for the frame they were printed in." },
115
+ "settleMs": { "type": "integer", "integer": true, "minimum": 0, "maximum": 2000, "default": 350, "description": "How long to let the app commit its state before the effect is judged." },
116
+ "takeover": { "type": "boolean", "default": false, "description": "Take the takeover tier: the real cursor moves to the action point and is always restored, the focus is held until the action ends, and a three-phase HUD is mandatory. Requires the takeoverAllowed setting or the call is refused with takeover_unavailable." },
117
+ "takeoverMaxMs": { "type": "integer", "integer": true, "minimum": 500, "maximum": 60000, "default": 10000, "description": "Takeover only: how long the action may hold the cursor/focus." }
118
+ },
119
+ "required": ["hwnd", "x", "y"],
120
+ "additionalProperties": false
121
+ },
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"]
123
+ },
124
+ {
125
+ "name": "wpm_type",
126
+ "action": "type",
127
+ "engine": "Invoke-WpmAction -Action type",
128
+ "requiresTier": "quiet",
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.",
130
+ "inputSchema": {
131
+ "type": "object",
132
+ "properties": {
133
+ "hwnd": { "type": "string", "description": "Target top-level window handle." },
134
+ "text": { "type": "string", "description": "Text to write. Empty string is refused: it cannot be distinguished from a channel that silently did nothing." },
135
+ "elementName": { "type": "string", "description": "Optional UIA Name or AutomationId of the control to write into. Naming an element forces the UIA tier, because a message tier cannot address 'the control called X'." },
136
+ "label": { "type": "integer", "integer": true, "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." },
137
+ "snapId": { "type": "string", "description": "The snapId the label came from; a superseded snapId is refused with stale_ref." },
138
+ "replace": { "type": "boolean", "default": false, "description": "Replace the existing value instead of appending to it." },
139
+ "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." },
140
+ "settleMs": { "type": "integer", "integer": true, "minimum": 0, "maximum": 2000, "default": 350, "description": "How long to let the app commit its state before the effect is judged." },
141
+ "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." },
142
+ "takeoverMaxMs": { "type": "integer", "integer": true, "minimum": 500, "maximum": 60000, "default": 10000, "description": "Takeover only: how long the action may hold the cursor/focus." },
143
+ "keyInput": { "type": "string", "enum": ["none", "inject"], "default": "none", "description": "Takeover only: 'inject' types the text with synthetic keyboard input into the foreground target, for windows with no message door and no UIA pattern (terminals). Requires keyInjectAllowed and the target in the foreground; otherwise the call is refused with keyinject_unavailable. The cursor is never moved by this path." }
144
+ },
145
+ "required": ["hwnd", "text"],
146
+ "additionalProperties": false
147
+ },
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.",
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"]
150
+ },
151
+ {
152
+ "name": "wpm_focus",
153
+ "action": "focus",
154
+ "engine": "Invoke-WpmAction -Action focus",
155
+ "requiresTier": "quiet",
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.",
157
+ "inputSchema": {
158
+ "type": "object",
159
+ "properties": {
160
+ "hwnd": { "type": "string", "description": "Target top-level window handle." },
161
+ "elementName": { "type": "string", "description": "UIA Name or AutomationId of the control that should hold focus." },
162
+ "label": { "type": "integer", "integer": true, "minimum": 1, "description": "Element number from wpm_snapshot: focus that element. A faster, unambiguous alternative to elementName on a tree you have already read." },
163
+ "snapId": { "type": "string", "description": "The snapId the label came from; a superseded snapId is refused with stale_ref." },
164
+ "settleMs": { "type": "integer", "integer": true, "minimum": 0, "maximum": 2000, "default": 350, "description": "How long to let the app commit its state before the effect is judged." },
165
+ "takeover": { "type": "boolean", "default": false, "description": "Take the takeover tier: the HUD is shown and the focus is held until the action ends, then restored. Requires the takeoverAllowed setting." },
166
+ "takeoverMaxMs": { "type": "integer", "integer": true, "minimum": 500, "maximum": 60000, "default": 10000, "description": "Takeover only: how long the action may hold the cursor/focus." }
167
+ },
168
+ "required": ["hwnd", "elementName"],
169
+ "additionalProperties": false
170
+ },
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"]
172
+ },
173
+ {
174
+ "name": "wpm_status",
175
+ "action": "status",
176
+ "engine": "Get-WpmStatus",
177
+ "requiresTier": "readonly",
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.",
179
+ "inputSchema": {
180
+ "type": "object",
181
+ "properties": {},
182
+ "required": [],
183
+ "additionalProperties": false
184
+ },
185
+ "refusals": [],
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."
187
+ },
188
+ {
189
+ "name": "wpm_snapshot",
190
+ "action": "snapshot",
191
+ "engine": "Invoke-WpmAction -Action snapshot",
192
+ "requiresTier": "readonly",
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.",
194
+ "inputSchema": {
195
+ "type": "object",
196
+ "properties": {
197
+ "hwnd": { "type": "string", "description": "Target top-level window handle from wpm_windows." },
198
+ "maxElements": { "type": "integer", "integer": true, "minimum": 1, "maximum": 5000, "default": 300, "description": "Hard cap on returned elements; the text then says 'truncated at N of M' and `truncated` is true. Measured trees: 71 visible elements for an 816-node Electron window, so the default is deliberately loose." },
199
+ "interactableOnly": { "type": "boolean", "default": true, "description": "Return only elements that expose a usable UIA pattern (the zero-cost first pass at a giant tree). Set false to see the whole visible tree, chrome included." },
200
+ "sinceSnapId": { "type": "string", "description": "Report an incremental diff against this earlier snapId instead of re-describing every element: added / removed / changed, keyed by UIA RuntimeId. An unchanged tree produces an empty delta, which is the point -- repeating an unchanged table is the main token cost of a multi-step flow." },
201
+ "intent": { "type": "string", "description": "What this frame is FOR (e.g. 'close the settings dialog'). It travels with the frame so a clean deciding subagent gets the goal and the numbered table together and answers with one label." }
202
+ },
203
+ "required": ["hwnd"],
204
+ "additionalProperties": false
205
+ },
206
+ "refusals": ["no_hwnd", "paused", "uia_probe_failed", "stale_ref", "policy_denied"]
207
+ },
208
+ {
209
+ "name": "wpm_screenshot",
210
+ "action": "screenshot",
211
+ "engine": "Invoke-WpmAction -Action screenshot",
212
+ "requiresTier": "readonly",
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.",
214
+ "inputSchema": {
215
+ "type": "object",
216
+ "properties": {
217
+ "hwnd": { "type": "string", "description": "Target top-level window handle from wpm_windows. Required unless fullScreen is true." },
218
+ "fullScreen": { "type": "boolean", "default": false, "description": "Capture the whole virtual screen instead of one window. Off by default on purpose: silently capturing the owner's entire desktop is exactly the kind of quiet overreach this product refuses elsewhere." },
219
+ "maxWidth": { "type": "integer", "integer": true, "minimum": 0, "maximum": 7680, "default": 0, "description": "Downscale the saved image to at most this width. 0 (default) means scale=1 and identity=true -- no silent resampling, because a resized image is a CHANGED coordinate system and this action exists to make coordinates honest." }
220
+ },
221
+ "required": [],
222
+ "additionalProperties": false
223
+ },
224
+ "refusals": ["no_hwnd", "paused", "policy_denied"]
225
+ },
226
+ {
227
+ "name": "wpm_preview",
228
+ "action": "preview",
229
+ "engine": "Invoke-WpmAction -Action preview",
230
+ "requiresTier": "readonly",
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.",
232
+ "inputSchema": {
233
+ "type": "object",
234
+ "properties": {
235
+ "hwnd": { "type": "string", "description": "Target top-level window handle from wpm_windows." },
236
+ "x": { "type": "integer", "integer": true, "description": "Screen X coordinate to preview. Must belong to the target window, otherwise the call is refused instead of reporting an element from another application." },
237
+ "y": { "type": "integer", "integer": true, "description": "Screen Y coordinate to preview." }
238
+ },
239
+ "required": ["hwnd", "x", "y"],
240
+ "additionalProperties": false
241
+ },
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", "integer": true, "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", "integer": true, "description": "move: the target left edge in physical screen pixels." },
294
+ "y": { "type": "integer", "integer": true, "description": "move: the target top edge." },
295
+ "width": { "type": "integer", "integer": true, "minimum": 1, "description": "resize: the target width. A window may clamp it; the result says what it became." },
296
+ "height": { "type": "integer", "integer": true, "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"]
302
+ }
303
+ ],
304
+ "refusalCases": [
305
+ {
306
+ "id": "click-dead-hwnd",
307
+ "mode": "engine",
308
+ "tool": "wpm_click",
309
+ "args": { "hwnd": "$deadHwnd", "x": 100, "y": 100 },
310
+ "expect": "no_hwnd",
311
+ "note": "A handle that does not identify a live window. Measured, no window is touched."
312
+ },
313
+ {
314
+ "id": "click-stale-shot",
315
+ "mode": "engine",
316
+ "tool": "wpm_click",
317
+ "args": { "hwnd": "$liveHwnd", "x": 100, "y": 100, "space": "image", "shotId": "wpm-shot-0000-nonexistent" },
318
+ "expect": "stale_ref",
319
+ "note": "space:'image' names a shotId the engine never issued. The engine refuses instead of reinterpreting the image pixels as screen pixels -- substituting the raw numbers would click somewhere plausibly wrong, which is the failure class this code exists for. Measured: the call never reaches the door probe."
320
+ },
321
+ {
322
+ "id": "preview-outside-target",
323
+ "mode": "engine",
324
+ "tool": "wpm_preview",
325
+ "args": { "hwnd": "$winformsHwnd", "x": 2, "y": 2 },
326
+ "expect": "unreachable",
327
+ "note": "The refusal-test target is placed at 60,60, so (2,2) is outside it. A preview point that belongs to another window must be refused, not answered with that window's element: reporting 'you would click the desktop' and drawing the marker there would make the preview the one place this product guesses about a point it was not given. This is also the executable instance of `unreachable` (the two named-element-miss cases cannot run on this host: the WinForms positive control currently surfaces its controls as bare Panes through the legacy MSAA bridge, see findings.md)."
328
+ },
329
+ {
330
+ "id": "snapshot-dead-hwnd",
331
+ "mode": "engine",
332
+ "tool": "wpm_snapshot",
333
+ "args": { "hwnd": "$deadHwnd" },
334
+ "expect": "no_hwnd",
335
+ "note": "A snapshot needs a live window: there is no tree to number. Same handle as the click case, and zero elements/patterns are touched."
336
+ },
337
+ {
338
+ "id": "screenshot-dead-hwnd",
339
+ "mode": "engine",
340
+ "tool": "wpm_screenshot",
341
+ "args": { "hwnd": "$deadHwnd" },
342
+ "expect": "no_hwnd",
343
+ "note": "Same reason as snapshot. fullScreen:true is the only path that does not need a window, and this case does not pass it."
344
+ },
345
+ {
346
+ "id": "preview-dead-hwnd",
347
+ "mode": "engine",
348
+ "tool": "wpm_preview",
349
+ "args": { "hwnd": "$deadHwnd", "x": 100, "y": 100 },
350
+ "expect": "no_hwnd",
351
+ "note": "A preview point that belongs to no named window has nothing to report and nothing to draw, so it refuses rather than looking up whatever application happens to own that pixel."
352
+ },
353
+ {
354
+ "id": "click-while-paused",
355
+ "mode": "engine",
356
+ "tool": "wpm_click",
357
+ "args": { "hwnd": "$liveHwnd", "x": 100, "y": 100 },
358
+ "setup": "pause",
359
+ "expect": "paused",
360
+ "note": "Pause is a server-side refusal checked before any capability, so a paused engine cannot be talked into acting by a target that looks reachable. Note it is wpm_status that stays callable while paused (a query), not the action tools."
361
+ },
362
+ {
363
+ "id": "type-winforms-named-missing",
364
+ "mode": "engine",
365
+ "tool": "wpm_type",
366
+ "args": { "hwnd": "$winformsHwnd", "text": "x", "elementName": "$missingName" },
367
+ "expect": "unreachable",
368
+ "note": "WinForms has a message door but no UIA pattern. Naming an element suppresses the door (a message cannot address 'the control called X'), so the target is honestly unreachable rather than quietly clicked at a guessed child."
369
+ },
370
+ {
371
+ "id": "focus-winforms",
372
+ "mode": "engine",
373
+ "tool": "wpm_focus",
374
+ "args": { "hwnd": "$winformsHwnd", "elementName": "$missingName" },
375
+ "expect": "unreachable",
376
+ "note": "Focus requires UIA by definition; a WinForms target with no pattern must be refused, never approximated."
377
+ },
378
+ {
379
+ "id": "elevated-target",
380
+ "mode": "decision",
381
+ "tool": "wpm_click",
382
+ "facts": { "hwnd": "$liveHwnd", "elevatedTarget": true },
383
+ "expect": "elevated_target",
384
+ "note": "Decision-table instance. The flag is now wired (win.ps1 IsElevatedTarget, token integrity comparison) and measured live on Task Manager by test/integrity-probe.ps1; the engine-level case additionally runs in test/llm-action-battery.mjs whenever a high-integrity window exists at run time."
385
+ },
386
+ {
387
+ "id": "terminal-no-door",
388
+ "mode": "decision",
389
+ "tool": "wpm_type",
390
+ "facts": { "hwnd": "$liveHwnd", "family": "terminal" },
391
+ "expect": "terminal_no_door",
392
+ "note": "Decision-table instance, and now a conclusion verified by measurement rather than by caution: the takeover + keyInput path was measured NOT to drive this host's terminal (scripts/probe-console-inject.ps1: 242 Unicode events with the terminal in the foreground and Enter sent, nothing executed; scripts/probe-console-scan.ps1: same with layout scan codes). The code stays because its next step is still actionable -- use a target with a door."
393
+ },
394
+ {
395
+ "id": "click-uia-tree-empty",
396
+ "mode": "decision",
397
+ "tool": "wpm_click",
398
+ "facts": { "hwnd": "$liveHwnd", "family": "chromium", "uiaTreeEmpty": true },
399
+ "expect": "uia_tree_empty",
400
+ "note": "Decision-table instance of the 2026-11-21 census: a Chromium window with renderer accessibility off walks to a tree with ZERO content elements (uTools measured one Chrome Legacy Window shell Pane, 0 interactive elements, identical across three in-place reads). Distinct from unreachable because the fix differs: nothing a re-query can find -- the app must relaunch with a11y on (--force-renderer-accessibility) or a different target must be picked. Real instance: scripts/uia-tree-content.ps1 plus a live engine call against uTools."
401
+ },
402
+ {
403
+ "id": "click-uia-probe-failed",
404
+ "mode": "decision",
405
+ "tool": "wpm_click",
406
+ "facts": { "hwnd": "$liveHwnd", "uiaProbeFailed": true },
407
+ "expect": "uia_probe_failed",
408
+ "note": "Decision-table instance. The UIA probe threw between the IsWindow check and the tree walk (element destroyed under the probe), so door measurement is impossible and no conclusion about the target is licensed. The engine appends the exception text to the reason as [uia: ...]. Before this code existed a thrown probe and a genuinely pattern-less target shared 'unreachable', and uiaErr arrived here as dead data."
409
+ },
410
+ {
411
+ "id": "needs-facts",
412
+ "mode": "decision",
413
+ "tool": null,
414
+ "facts": null,
415
+ "expect": "needs_facts",
416
+ "note": "The absence of facts must refuse, not default to the quiet branch. Unreachable through the engine (facts are always measured), so this one guards the table when it is used on its own."
417
+ },
418
+ {
419
+ "id": "takeover-unavailable",
420
+ "mode": "decision",
421
+ "tool": "wpm_click",
422
+ "facts": { "hwnd": "$liveHwnd", "takeoverRequested": true, "hudReady": false },
423
+ "expect": "takeover_unavailable",
424
+ "note": "Takeover was asked for but the HUD is not up. The HUD is a hard precondition, so the request is refused instead of being served silently by the quiet tier -- the point of the code is that the caller learns the request did not happen."
425
+ },
426
+ {
427
+ "id": "keyinject-unavailable",
428
+ "mode": "decision",
429
+ "tool": "wpm_type",
430
+ "facts": { "hwnd": "$liveHwnd", "takeoverRequested": true, "hudReady": true, "keyInjectRequested": true, "keyInjectAllowed": false },
431
+ "expect": "keyinject_unavailable",
432
+ "note": "Injection requested with the keyInjectAllowed gate off. Measured fact behind the refusal: SendInput writes to the FOREGROUND window (scripts/probe-sendinput-unicode.ps1 arm B: text landed in the foreground window and not in the window the caller had in mind), so an unauthorised injection is refused rather than attempted."
433
+ },
434
+ {
435
+ "id": "keyinject-not-foreground",
436
+ "mode": "decision",
437
+ "tool": "wpm_type",
438
+ "facts": { "hwnd": "$liveHwnd", "takeoverRequested": true, "hudReady": true, "keyInjectRequested": true, "keyInjectAllowed": true, "foregroundIsTarget": false },
439
+ "expect": "keyinject_unavailable",
440
+ "note": "Injection requested, gate open, but the target is not the foreground window and could not be raised. The engine refuses: blind injection would type into whatever the owner was using (same measured fact as keyinject-unavailable)."
441
+ },
442
+ {
443
+ "id": "takeover-aborted",
444
+ "mode": "none",
445
+ "tool": "wpm_click",
446
+ "args": { "hwnd": "$liveHwnd", "x": 100, "y": 100 },
447
+ "expect": "takeover_aborted",
448
+ "note": "NOT covered by an executable schema case: it is a RUNTIME outcome of an interruption (HUD button / abort chord / host cancellation), and constructing one needs a live takeover in progress. test/takeover-test.ps1 covers the three interruption paths at the engine level; the reason is declared in tools.json refusals."
449
+ },
450
+ {
451
+ "id": "action-failed",
452
+ "mode": "none",
453
+ "tool": "wpm_type",
454
+ "args": { "hwnd": "$liveHwnd", "text": "x" },
455
+ "expect": "action_failed",
456
+ "note": "NOT COVERED: needs a target whose channel reliably throws. Not constructed this round; reported as uncovered rather than claimed."
457
+ },
458
+ {
459
+ "id": "restore-failed",
460
+ "mode": "none",
461
+ "tool": "wpm_focus",
462
+ "args": { "hwnd": "$liveHwnd", "elementName": "x" },
463
+ "expect": "restore_failed",
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."
531
+ }
532
+ ]
533
+ }