dsh-windows-parallel-mcp 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.de.md +13 -1
- package/CHANGELOG.es.md +13 -1
- package/CHANGELOG.fr.md +13 -1
- package/CHANGELOG.it.md +13 -1
- package/CHANGELOG.ja.md +13 -1
- package/CHANGELOG.ko.md +13 -1
- package/CHANGELOG.md +201 -1
- package/CHANGELOG.pt.md +13 -1
- package/CHANGELOG.ru.md +13 -1
- package/CHANGELOG.zh.md +13 -1
- package/README.de.md +231 -6
- package/README.es.md +231 -6
- package/README.fr.md +231 -6
- package/README.it.md +231 -6
- package/README.ja.md +231 -6
- package/README.ko.md +231 -6
- package/README.md +231 -6
- package/README.pt.md +231 -6
- package/README.ru.md +231 -6
- package/README.zh.md +231 -6
- package/docs/refusals.md +3 -0
- package/dsh.plugin.json +3 -3
- package/lib/audit.js +109 -0
- package/lib/config.js +55 -2
- package/lib/host-tools.js +61 -3
- package/lib/index.js +308 -12
- package/lib/mcp-server.mjs +350 -0
- package/lib/policy.js +127 -0
- package/package.json +9 -2
- package/server.json +109 -0
- package/src/engine/decide.ps1 +120 -3
- package/src/engine/engine.ps1 +249 -2
- package/src/engine/win.ps1 +266 -0
- package/src/engine/worker.ps1 +52 -0
- package/src/schema/tools.json +171 -13
- package/types/index.d.ts +35 -3
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# dsh-windows-parallel-mcp
|
|
2
2
|
|
|
3
3
|
**English** · [中文](README.zh.md) · [日本語](README.ja.md) · [한국어](README.ko.md) · [Français](README.fr.md) · [Deutsch](README.de.md) · [Italiano](README.it.md) · [Español](README.es.md) · [Português](README.pt.md) · [Русский](README.ru.md)
|
|
4
|
-
> **Current release: 0.
|
|
4
|
+
> **Current release: 0.8.0** — this document describes the contract as of that version. What
|
|
5
5
|
> changed in it, and in every version before it, is in [CHANGELOG.md](CHANGELOG.md), newest first.
|
|
6
6
|
|
|
7
7
|
A DSH plugin that lets an agent drive **its own** Windows windows — quietly by default, and visibly
|
|
@@ -9,7 +9,12 @@ on request. Where a window accepts a window message, you never lose focus at all
|
|
|
9
9
|
exposes UI Automation, you lose focus for one bounded flash that is reversed automatically. Where you
|
|
10
10
|
explicitly ask for the takeover tier, the cursor moves to the point and is always restored, with a
|
|
11
11
|
HUD that can stop it three ways. Everywhere else it refuses, with a code and a reason — never with
|
|
12
|
-
silence: every refusal carries a code from a closed set of
|
|
12
|
+
silence: every refusal carries a code from a closed set of seventeen and the next step.
|
|
13
|
+
|
|
14
|
+
**It ships in two forms over one engine, and 0.8.0 did not replace the first one.** Inside DSH it is a
|
|
15
|
+
plugin (`apply()` on the host half, PowerShell sidecar underneath). Outside it, the same package is an
|
|
16
|
+
MCP server over stdio (`bin: wpm-mcp`), whose tool list is generated from the same contract file — see
|
|
17
|
+
"The second form" below.
|
|
13
18
|
|
|
14
19
|
**The takeover tier defaults off, and that is structural.** The cursor is only ever moved because you
|
|
15
20
|
opened `takeoverAllowed` **and** asked for it on the call (`takeover:true`), so an upgrade cannot
|
|
@@ -27,7 +32,7 @@ bundle with a broad tool surface; this one is a single action tool whose entire
|
|
|
27
32
|
|
|
28
33
|
## What it does
|
|
29
34
|
|
|
30
|
-
One tool,
|
|
35
|
+
One tool, eleven actions:
|
|
31
36
|
|
|
32
37
|
| action | what it returns |
|
|
33
38
|
|---|---|
|
|
@@ -39,6 +44,9 @@ One tool, eight actions:
|
|
|
39
44
|
| `snapshot` | the accessibility tree as a NUMBERED element table: continuous `label`, control type, name, automation id, screen rect, patterns |
|
|
40
45
|
| `screenshot` | the window rect captured to a PNG, plus the coordinate mapping as data (`screenRect`, `imageSize`, `scale`, `identity`, `frame`, `dpiAware`) |
|
|
41
46
|
| `preview` | the marker drawn at a point, and the element under it reported as TEXT — no picture needed |
|
|
47
|
+
| `launch` | start a whitelisted program; reports the pid, and the window only once it really exists |
|
|
48
|
+
| `clipboard` | read or write the system clipboard — a read reports lengths and never the payload |
|
|
49
|
+
| `window` | minimize / restore / move / resize / topmost ONE named window, verified by reading its state back |
|
|
42
50
|
|
|
43
51
|
The engine picks the cheapest available door per call:
|
|
44
52
|
|
|
@@ -274,6 +282,138 @@ click. Success is reported as `effect=reported-by-send`, never as "verified". Un
|
|
|
274
282
|
carries no hardware scancode, which is why a rare scancode-only target would ignore it — documented,
|
|
275
283
|
not a bug.
|
|
276
284
|
|
|
285
|
+
## Desktop actions: launch, clipboard, window (0.7.0)
|
|
286
|
+
|
|
287
|
+
Three capabilities that were missing outright — "you cannot even start a program" was the honest answer
|
|
288
|
+
— and none of them is a door action. They choose no channel, cost no tier, and produce no proof window,
|
|
289
|
+
so they live beside `Invoke-WpmAction` rather than inside it, and the door discipline (point ownership,
|
|
290
|
+
the restore table, the proof window) is not widened by any of them.
|
|
291
|
+
|
|
292
|
+
**`launch` — two switches, neither of which implies the other.** `appLaunchAllowed` opens the
|
|
293
|
+
capability; `appLaunchAllow` lists the exact program names or absolute paths that may run, and an
|
|
294
|
+
**empty list means nothing may launch even with the gate on**. Matching is exact and case-folded: there
|
|
295
|
+
is no wildcard, and `notepad` does not authorise `notepad-helper.exe` — a whitelist that grows by prefix
|
|
296
|
+
is a whitelist that authorises more than it says. A refusal is `app_launch_denied` and is raised before
|
|
297
|
+
any worker request, so a refused launch started nothing (asserted with a request counter in
|
|
298
|
+
`test/plugin-test.mjs` and re-checked inside the engine against the same table). The engine's own
|
|
299
|
+
vocabulary for the window is the interesting part: `Process.Start` returns while the app is still
|
|
300
|
+
loading (measured: `MainWindowHandle=0` for 1348 ms on a cold notepad), so a program that has not
|
|
301
|
+
published a window yet answers `ok:true` with `hwnd=""` and `detail=window-not-yet` — neither a fake
|
|
302
|
+
failure nor a fake readiness. Arguments are passed through as given and written to the audit log,
|
|
303
|
+
because listing a program does not vouch for what it is told to do.
|
|
304
|
+
|
|
305
|
+
**`clipboard` — the most private read in this product.** What is on the clipboard may be a password or
|
|
306
|
+
a token the owner copied seconds ago, so a text read reports its **length**, its result text never
|
|
307
|
+
contains the payload, the audit line records `op`/`format`/`chars`, and values are capped at 64 KB with
|
|
308
|
+
`truncated` stated rather than silently cut. An image write accepts a `shotId`, so a screenshot can go
|
|
309
|
+
straight into the clipboard without the caller handling pixels; the read-back compares the size the
|
|
310
|
+
clipboard reports against the size the shot recorded. A clipboard holding neither is refused with the
|
|
311
|
+
format names it did find — an empty success would be indistinguishable from "the clipboard is empty".
|
|
312
|
+
|
|
313
|
+
**`window` — one named window, five ops, each verified by reading the window back.** `IsIconic`,
|
|
314
|
+
`GetWindowRect`, the `WS_EX_TOPMOST` bit — not `ShowWindow`'s return value, because a syscall's answer
|
|
315
|
+
describes the CALL and this product has been burned repeatedly by reporting that as a state. `move` and
|
|
316
|
+
`resize` pass `SWP_NOACTIVATE`, and the result carries `foregroundTaken=true|false` measured on both
|
|
317
|
+
sides of that specific call: `restore` activates by definition (that is what restoring is), and the
|
|
318
|
+
honest answer is to report it, not to hide it or to refuse the op the caller asked for. There is no
|
|
319
|
+
"all windows" op and no `#32770` discovery: acting on a window nobody named is not a convenience.
|
|
320
|
+
|
|
321
|
+
### One ceiling, eleven actions
|
|
322
|
+
|
|
323
|
+
The old shape of this problem was a boolean per capability, which does not scale past the number of
|
|
324
|
+
settings anyone will actually read. Instead the two axes are independent:
|
|
325
|
+
|
|
326
|
+
```
|
|
327
|
+
the action declares the lowest rung it can ever need (src/schema/tools.json#requiresTier)
|
|
328
|
+
the owner sets one ceiling (settings: policy)
|
|
329
|
+
|
|
330
|
+
readonly < quiet < flash < takeover
|
|
331
|
+
reads message bounded-UIA real cursor / held focus / launch
|
|
332
|
+
door flash
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
| `policy` | permits | refuses |
|
|
336
|
+
|---|---|---|
|
|
337
|
+
| `readonly` | `windows`, `status`, `snapshot`, `screenshot`, `preview`, `clipboard` read | every write |
|
|
338
|
+
| `quiet` | + `click` / `type` / `focus` through the message door | the flash tier, `clipboard` write, `window`, `launch` |
|
|
339
|
+
| `balanced` *(default)* | + the bounded-flash tier, `clipboard` write, `window` ops | `takeover:true`, `keyInput:"inject"`, `launch` |
|
|
340
|
+
| `full` | + the takeover tier and `launch` | nothing extra |
|
|
341
|
+
|
|
342
|
+
Above the ceiling a call is refused with **`policy_denied`** and the reason names both numbers (what the
|
|
343
|
+
action needed, what the policy allows), because the correct next step is a settings change and the wrong
|
|
344
|
+
one is a retry. The gate order is `paused → policy → takeoverAllowed/keyInjectAllowed → launch gate +
|
|
345
|
+
whitelist → idle check → the door table`, and every step in it is tested by making two gates disagree
|
|
346
|
+
about which one spoke (`test/plugin-test.mjs`). Two consequences are worth stating plainly rather than
|
|
347
|
+
leaving to discovery: **`takeover:true` now needs `policy:'full'` as well as `takeoverAllowed`** (0.7.0
|
|
348
|
+
raised the bar for the loudest tier on purpose), and `clipboard`'s halves are graded separately
|
|
349
|
+
(`requiresTierFor`), so a `readonly` owner can still read.
|
|
350
|
+
|
|
351
|
+
**Idle instead of a dialog.** When the last *physical* input is younger than `policyIdleMs` (default
|
|
352
|
+
3000 ms) and the action needs the takeover tier, it is refused with **`user_active`** and nothing is
|
|
353
|
+
clicked — no popup, no countdown. The upstream design asks the owner to consent by interrupting them;
|
|
354
|
+
an interrupt presented as consent is just a second disturbance. The escape hatch is explicit
|
|
355
|
+
(`forceUserActive:true`), it does not bypass any other gate, and the audit line records `forced:true` so
|
|
356
|
+
an interruption caused on purpose stays distinguishable from one caused by accident. An unattended run
|
|
357
|
+
is never blocked by this: with nobody typing, the age grows past the window and the call goes through.
|
|
358
|
+
|
|
359
|
+
### The audit log
|
|
360
|
+
|
|
361
|
+
Every action appends one JSONL line to `%LOCALAPPDATA%\wpm\audit.log` — allow **and** deny, because a
|
|
362
|
+
trail that records only refusals documents the times the guard worked and is silent about the times it
|
|
363
|
+
had nothing to do with. Fields: `ts, action, hwnd, tier, policy, decision, code, userActiveAgeMs,
|
|
364
|
+
effect, latencyMs`, plus `target`/`args` for a launch and `op`/`format`/`chars` for a clipboard call.
|
|
365
|
+
What is deliberately absent is content: no typed text, no clipboard payload — the second copy of a
|
|
366
|
+
secret is the one nobody protects. `auditKeep` (default 2000) bounds the file, pruning oldest-first when
|
|
367
|
+
a write pushes it past budget. An audit that cannot be written is reported (`auditNote=n write(s)
|
|
368
|
+
failed`) rather than swallowed: a log that looks complete and is not is worse than one that admits it
|
|
369
|
+
is missing lines. This is the only artifact that survives a call, and it is the one thing that can
|
|
370
|
+
answer "what did the agent do to this machine" after the fact.
|
|
371
|
+
|
|
372
|
+
## The second form: MCP over stdio (0.8.0)
|
|
373
|
+
|
|
374
|
+
The same plugin is also an MCP server, and it is the same code rather than a re-implementation of it.
|
|
375
|
+
`lib/mcp-server.mjs` registers the tool by calling the very `apply()` the DSH host calls, and forwards
|
|
376
|
+
`tools/call` into the same `toRequest()` / gate order / `format()` path, so the eleven actions, the
|
|
377
|
+
seventeen refusal codes, the policy ceiling and the audit line are identical in both forms. That is why
|
|
378
|
+
the engine files were not touched to add it: a second implementation of a permission is a permission
|
|
379
|
+
that can be reached around by using the other copy.
|
|
380
|
+
|
|
381
|
+
**One tool, not eleven.** `tools/list` exposes `wpm` with an `action` discriminator, generated from
|
|
382
|
+
`src/schema/tools.json` — one `oneOf` branch per action, whose `properties`, `required` and
|
|
383
|
+
`additionalProperties` are that action's declaration copied field for field. Nothing in the server
|
|
384
|
+
spells out an action name, a parameter name or a code, and `scripts/check-mcp-schema.mjs` is the reason
|
|
385
|
+
that stays true: it starts the real server, reads what a client would read, and compares it to the file.
|
|
386
|
+
Its self-test mutates both sides on purpose — four edits to the generator must turn the gate red, and two
|
|
387
|
+
edits to the *contract* (rename a parameter, flip `additionalProperties`) must stay green AND move,
|
|
388
|
+
because an arm that only breaks the generator cannot tell a generated schema from a transcribed one that
|
|
389
|
+
happens to agree today.
|
|
390
|
+
|
|
391
|
+
**Settings come from the environment, never from the call.** `WPM_POLICY`, `WPM_TAKEOVER_ALLOWED`,
|
|
392
|
+
`WPM_APP_LAUNCH_ALLOWED`, `WPM_APP_LAUNCH_ALLOW` and the rest of the `WPM_*` set are read at start-up
|
|
393
|
+
and only if present — the defaults stay in `lib/index.js`, because a second copy of a default is a
|
|
394
|
+
default that drifts. A client that could raise its own ceiling or add itself to the launch whitelist
|
|
395
|
+
would make the authorization model decorative, which is the same reason the DSH form reads settings
|
|
396
|
+
from the profile rather than from the prompt.
|
|
397
|
+
|
|
398
|
+
**A picture is attached as pixels, because a path is not portable.** The DSH form renders the screenshot
|
|
399
|
+
file it wrote; a caller on the other end of a pipe cannot open it, so `tools/call` returns the PNG as
|
|
400
|
+
base64 `image` content alongside the text. The text is never replaced by it — `screenRect`, `scale`,
|
|
401
|
+
`identity`, `frame` and `captureBackend` stay in the first block, and across the DSH bridge, where a
|
|
402
|
+
host that cannot accept image input projects the picture into a text diagnostic, those numbers still
|
|
403
|
+
arrive. `WPM_MCP_NO_IMAGE=1` opts out.
|
|
404
|
+
|
|
405
|
+
**Refusals survive the trip.** A refused call comes back with `isError` and the code as the first token
|
|
406
|
+
of the text, unsoftened. Over the DSH bridge the refusal is re-raised as an error whose message is that
|
|
407
|
+
text, so `policy_denied` still reads as `policy_denied` at the far end — asserted, not assumed, in
|
|
408
|
+
`test/mcp-bridge.mjs`, which drives the SDK and the bridge code the host actually ships.
|
|
409
|
+
|
|
410
|
+
**The transport is the only new attack surface, and it is a pipe.** JSON-RPC 2.0 over stdin/stdout with
|
|
411
|
+
Node built-ins and zero dependencies: one JSON object per line, replies keyed by `id` because the worker
|
|
412
|
+
is asynchronous, notifications answered with nothing, a non-JSON line answered with `-32700` and a null
|
|
413
|
+
`id` without killing the loop, an unknown method answered `-32601` without killing the loop, and stdin
|
|
414
|
+
closing meaning "dispose the sidecar and exit 0". Everything that is not a protocol line goes to stderr
|
|
415
|
+
— `console.log` in the plugin half would otherwise print into the JSON stream and corrupt it.
|
|
416
|
+
|
|
277
417
|
## What it does not do
|
|
278
418
|
|
|
279
419
|
- **No mouse injection.** `MOUSEEVENTF_*`, `mouse_event` and `keybd_event` are banned in every
|
|
@@ -287,6 +427,10 @@ not a bug.
|
|
|
287
427
|
- **No OCR / Set-of-Marks / pixel fallback.** Not part of this claim, and already done well elsewhere.
|
|
288
428
|
- **No watchdog.** The restore is one-shot and happens inline. A watchdog that keeps chasing the
|
|
289
429
|
foreground would fight you.
|
|
430
|
+
- **No HTTP, no SSE, no OAuth, no TLS.** Two forms exist and neither has a network face: in-process for
|
|
431
|
+
DSH, stdio for MCP. "No network surface" is not a hardening claim, it is the absence of one — there is
|
|
432
|
+
nothing to authenticate against, nothing to listen on, and nothing that keeps running when the caller
|
|
433
|
+
goes away.
|
|
290
434
|
- **Terminals are still refused** (`terminal_no_door`), and now for a measured reason. The 0.2.0 plan
|
|
291
435
|
was to drive one by typing into it; two probes say otherwise on this host: 242 `KEYEVENTF_UNICODE`
|
|
292
436
|
events with the terminal in the foreground and Enter sent produced nothing, and a scan-code arm
|
|
@@ -307,12 +451,29 @@ call, not at plugin load.
|
|
|
307
451
|
`engines.dsh` is an explicit two-sided range. There is no runtime version probing and no silent
|
|
308
452
|
degradation.
|
|
309
453
|
|
|
454
|
+
Since 0.8.0 the same package is also an MCP server, and nothing about the install above changes — the
|
|
455
|
+
two forms are parallel entries, not a migration:
|
|
456
|
+
|
|
457
|
+
```bash
|
|
458
|
+
# stdio, configured by the environment of whoever starts it
|
|
459
|
+
WPM_POLICY=balanced npx dsh-windows-parallel-mcp # via bin: wpm-mcp
|
|
460
|
+
# or, from a checkout
|
|
461
|
+
node lib/mcp-server.mjs
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
Point any MCP client at that command; `server.json` (shipped in the tarball) is the MCP Registry
|
|
465
|
+
manifest for it, with the namespace `io.github.drscrewdriver/dsh-windows-parallel-mcp` and the npm
|
|
466
|
+
package as its ownership proof. A DSH profile can bridge it instead of loading the plugin directly
|
|
467
|
+
(`@deepseek-ai/dsh-mcp-client`, stdio transport), which registers the tool as `mcp__<serverName>__wpm`;
|
|
468
|
+
`test/mcp-bridge.mjs` drives that bridge with the host's own client SDK and tool-definition code.
|
|
469
|
+
|
|
310
470
|
## Typed surface
|
|
311
471
|
|
|
312
472
|
`types/index.d.ts` is written by hand, not emitted from an implementation. It covers the whole
|
|
313
|
-
contract: the
|
|
314
|
-
surface
|
|
315
|
-
own four-value union (`WpmEffect`) beside
|
|
473
|
+
contract: the eleven actions, every argument including the takeover fields, the image-space / label
|
|
474
|
+
surface, 0.6.0's `caretPosition` and 0.7.0's `target`/`op`/`format`/`forceUserActive`, all seventeen
|
|
475
|
+
refusal codes as a closed union, and `effect` as its own four-value union (`WpmEffect`) beside
|
|
476
|
+
`WpmCaptureBackend`, `WpmClipboardOp`, `WpmWindowOp`, `WpmPolicy` and `WpmFrameSource`.
|
|
316
477
|
|
|
317
478
|
Its wiring is measured in both resolution modes a consumer can use, rather than assumed from the
|
|
318
479
|
presence of a file:
|
|
@@ -347,6 +508,11 @@ when one is present, and the gate reports a named SKIP rather than a red when on
|
|
|
347
508
|
| `snapshotMaxElements` | `300` | cap on elements per snapshot (1–5000); a tighter cap is a smaller frame for a deciding subagent |
|
|
348
509
|
| `screenshotMaxWidth` | `0` | downscale captures to this width; `0` means no scaling and `scale=1` — a resized image is a different coordinate system, so it is never chosen silently |
|
|
349
510
|
| `shotsKeep` | `10` | how many PNGs stay in `%LOCALAPPDATA%\wpm\shots`; older files are deleted after each capture |
|
|
511
|
+
| `policy` | `balanced` | the ceiling over all eleven actions: `readonly` < `quiet` < `balanced` < `full`. Above it a call is refused with `policy_denied`, whose next step is to raise THIS setting and not to retry. An unrecognizable value falls back to `balanced`, never to `full` |
|
|
512
|
+
| `policyIdleMs` | `3000` | how recently a physical input counts as "the owner is here". A takeover-tier call then refuses with `user_active` and opens no dialog; `0` disables the check |
|
|
513
|
+
| `appLaunchAllowed` | `false` | allow `action=launch` at all. Independent of `takeoverAllowed`: being allowed to move a pointer is not being allowed to start a program |
|
|
514
|
+
| `appLaunchAllow` | `[]` | the launch whitelist — exact names or absolute paths, matched case-insensitively and in full. Empty means nothing may launch even with the gate on; no wildcard, no prefix |
|
|
515
|
+
| `auditKeep` | `2000` | how many lines `%LOCALAPPDATA%\wpm\audit.log` holds before the oldest are pruned |
|
|
350
516
|
|
|
351
517
|
## What measurement established
|
|
352
518
|
|
|
@@ -435,6 +601,59 @@ unmeasured end-to-end and is stated as such in [docs/refusals.md](docs/refusals.
|
|
|
435
601
|
exercised `replace:true` through the message door, which is why the fix ships with an arm that does
|
|
436
602
|
(`test/readback-truth.mjs` A1). Found by running the import instead of trusting its name.
|
|
437
603
|
|
|
604
|
+
### 0.7.0's measurements
|
|
605
|
+
|
|
606
|
+
- **A cold `Process.Start` has no window for over a second** — notepad: pid present,
|
|
607
|
+
`MainWindowHandle=0`, **1348 ms**, and the window only reachable by polling the pid. Hence
|
|
608
|
+
`waitMs`/`window-not-yet` rather than an hwnd claim at return time.
|
|
609
|
+
- **The STA clipboard works in the worker and is not instant** — text write+read identical, first call
|
|
610
|
+
**138 ms**; `SetDataObject`/`GetDataObject` for images (40×20 verified). `Clipboard.Flush()` does NOT
|
|
611
|
+
exist on Windows PowerShell 5.1's runtime (.NET Framework): the first version of this branch threw
|
|
612
|
+
"Clipboard does not contain a method named 'Flush'", which is a method present in the documentation
|
|
613
|
+
people read and absent from the platform the product targets. `SetDataObject($v, $true)` is the
|
|
614
|
+
supported way to make the data outlive the process.
|
|
615
|
+
- **`SW_RESTORE` activates.** Measured around a restore on a real notepad window:
|
|
616
|
+
`foregroundBefore=<other> foregroundAfter=<target>`. Reported as `foregroundTaken=true` on that call
|
|
617
|
+
instead of being attributed to something else; `move`/`resize`/`topmost` measured
|
|
618
|
+
`foregroundTaken=false` with `SWP_NOACTIVATE`.
|
|
619
|
+
- **The whitelist is only a whitelist if it is exact.** `notepad` against `notepad-helper.exe`: a
|
|
620
|
+
prefix or substring rule authorises the second one, so membership is a case-folded full-string test
|
|
621
|
+
and `test/plugin-test.mjs` asserts the refusal for an unlisted name while the gate is on.
|
|
622
|
+
- **The refusal vocabulary is unchanged in shape by `requiresTier`** — a rung comparison is arithmetic
|
|
623
|
+
over one ordered list, so the cost of an action's classification is one number, not one new code per
|
|
624
|
+
action. Three codes were added for the whole batch (`app_launch_denied`, `policy_denied`,
|
|
625
|
+
`user_active`), each naming a setting rather than a symptom.
|
|
626
|
+
- `Check-no-cursor-control` is still green with the same two whitelisted primitive uses and an
|
|
627
|
+
unchanged whitelist file list: adding `launch`/`window` did not open a door to `MOUSEEVENTF_*`,
|
|
628
|
+
`mouse_event` or `keybd_event`.
|
|
629
|
+
|
|
630
|
+
### 0.8.0's measurements
|
|
631
|
+
|
|
632
|
+
- **A hand-written JSON-RPC loop over stdio is enough** (the 0.8.0 prerequisite probe): `initialize`,
|
|
633
|
+
`tools/list` and `tools/call` all answer, an unknown method returns `-32601` and the process survives
|
|
634
|
+
it, a notification produces no reply line, two requests in flight are matchable by id, a non-JSON line
|
|
635
|
+
does not kill the transport, and closing stdin exits 0. Fifteen assertions, zero dependencies —
|
|
636
|
+
`@modelcontextprotocol/sdk` is not needed and is not used.
|
|
637
|
+
- **The host's SDK is the stricter judge than our own harness.** `test/mcp-bridge.mjs` connects
|
|
638
|
+
`@modelcontextprotocol/client` 2.2.0 (the version the DSH install ships) to our server and validates
|
|
639
|
+
the shapes we emit. Its negotiation throws when the server answers with a protocol revision the
|
|
640
|
+
client does not list, which is why `PROTOCOL_VERSIONS` in `lib/mcp-server.mjs` is checked against that
|
|
641
|
+
SDK's constants (latest `2025-11-25`) rather than guessed from a document.
|
|
642
|
+
- **A picture the host cannot display still delivers its numbers.** Across the bridge with no attachment
|
|
643
|
+
store mounted, a `screenshot` call does not throw: the bridge projects the image block into an
|
|
644
|
+
`[image unavailable: …]` text diagnostic and the `screenRect` / `scale` / `identity` / `frame` /
|
|
645
|
+
`captureBackend` line arrives regardless. Attaching pixels by default is safe because of that
|
|
646
|
+
measurement, not in spite of it.
|
|
647
|
+
- **`tools/list` follows the contract file, in both directions.** Renaming `caretPosition` in
|
|
648
|
+
`src/schema/tools.json` changes what the running server reports, and flipping one
|
|
649
|
+
`additionalProperties` changes it too — both are gate arms (`scripts/check-mcp-schema.mjs --self-test`),
|
|
650
|
+
so the claim "generated, not copied" is exercised rather than asserted in prose.
|
|
651
|
+
- **The install artifact is what was tested.** The 0.7.0 release was smoked from the unpacked tarball
|
|
652
|
+
(`npm pack` → unpack → drive the policy ceiling, both launch gates, the clipboard length-not-payload
|
|
653
|
+
rule and the audit rows: 17 assertions) and that run found two things the working tree could not show:
|
|
654
|
+
the `clipboard` headline does not name which op ran, and the launch gate is only observable once the
|
|
655
|
+
ceiling lets the call reach it. Both are recorded rather than papered over.
|
|
656
|
+
|
|
438
657
|
## Verifying the copy you actually installed
|
|
439
658
|
|
|
440
659
|
Every test above imports the repository checkout, so a package that installs to the wrong place or ships
|
|
@@ -443,6 +662,12 @@ drives the **installed** copy: it lists a real window, runs a takeover click, as
|
|
|
443
662
|
`takeover=on cursorRestored=true abortChord=…`, and checks that the HUD is torn down afterwards. Run once
|
|
444
663
|
against the desktop profile after installing, as the last step of a release.
|
|
445
664
|
|
|
665
|
+
The stdio form has the same discipline: unpack the tarball and start `lib/mcp-server.mjs` from the
|
|
666
|
+
unpacked directory (not from the checkout). `scripts/check-mcp-schema.mjs` and `test/mcp-bridge.mjs` both
|
|
667
|
+
spawn the server by path, so pointing them at the unpacked copy is the whole procedure. The 0.7.0 tag
|
|
668
|
+
was pushed after that run; a release that skips it is asserting that the shipped bytes work by
|
|
669
|
+
showing that the source does.
|
|
670
|
+
|
|
446
671
|
## License
|
|
447
672
|
|
|
448
673
|
MIT
|
package/README.pt.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
> Um plugin DSH que permite a um agente controlar **as suas próprias** janelas Windows — silencioso por padrão, visível sob demanda. Quando uma janela aceita mensagens do Windows, o foco nunca é roubado. Quando apenas a Automação de UI a alcança, o foco sofre um único lampejo limitado, revertido automaticamente. Quando você solicita explicitamente o modo takeover, o cursor move-se para o ponto de ação e é sempre restaurado, com um HUD que oferece três formas de interrupção. Em todos os outros casos, recusa com um código e um motivo.
|
|
6
6
|
|
|
7
7
|
> **English canonical text follows.** The localized summary above is the orientation; the text below is the authoritative specification (structure, commands and numbers are identical across all 10 languages).
|
|
8
|
-
> **Current release: 0.
|
|
8
|
+
> **Current release: 0.8.0** — this document describes the contract as of that version. What
|
|
9
9
|
> changed in it, and in every version before it, is in [CHANGELOG.md](CHANGELOG.md), newest first.
|
|
10
10
|
|
|
11
11
|
A DSH plugin that lets an agent drive **its own** Windows windows — quietly by default, and visibly
|
|
@@ -13,7 +13,12 @@ on request. Where a window accepts a window message, you never lose focus at all
|
|
|
13
13
|
exposes UI Automation, you lose focus for one bounded flash that is reversed automatically. Where you
|
|
14
14
|
explicitly ask for the takeover tier, the cursor moves to the point and is always restored, with a
|
|
15
15
|
HUD that can stop it three ways. Everywhere else it refuses, with a code and a reason — never with
|
|
16
|
-
silence: every refusal carries a code from a closed set of
|
|
16
|
+
silence: every refusal carries a code from a closed set of seventeen and the next step.
|
|
17
|
+
|
|
18
|
+
**It ships in two forms over one engine, and 0.8.0 did not replace the first one.** Inside DSH it is a
|
|
19
|
+
plugin (`apply()` on the host half, PowerShell sidecar underneath). Outside it, the same package is an
|
|
20
|
+
MCP server over stdio (`bin: wpm-mcp`), whose tool list is generated from the same contract file — see
|
|
21
|
+
"The second form" below.
|
|
17
22
|
|
|
18
23
|
**The takeover tier defaults off, and that is structural.** The cursor is only ever moved because you
|
|
19
24
|
opened `takeoverAllowed` **and** asked for it on the call (`takeover:true`), so an upgrade cannot
|
|
@@ -31,7 +36,7 @@ bundle with a broad tool surface; this one is a single action tool whose entire
|
|
|
31
36
|
|
|
32
37
|
## What it does
|
|
33
38
|
|
|
34
|
-
One tool,
|
|
39
|
+
One tool, eleven actions:
|
|
35
40
|
|
|
36
41
|
| action | what it returns |
|
|
37
42
|
|---|---|
|
|
@@ -43,6 +48,9 @@ One tool, eight actions:
|
|
|
43
48
|
| `snapshot` | the accessibility tree as a NUMBERED element table: continuous `label`, control type, name, automation id, screen rect, patterns |
|
|
44
49
|
| `screenshot` | the window rect captured to a PNG, plus the coordinate mapping as data (`screenRect`, `imageSize`, `scale`, `identity`, `frame`, `dpiAware`) |
|
|
45
50
|
| `preview` | the marker drawn at a point, and the element under it reported as TEXT — no picture needed |
|
|
51
|
+
| `launch` | start a whitelisted program; reports the pid, and the window only once it really exists |
|
|
52
|
+
| `clipboard` | read or write the system clipboard — a read reports lengths and never the payload |
|
|
53
|
+
| `window` | minimize / restore / move / resize / topmost ONE named window, verified by reading its state back |
|
|
46
54
|
|
|
47
55
|
The engine picks the cheapest available door per call:
|
|
48
56
|
|
|
@@ -278,6 +286,138 @@ click. Success is reported as `effect=reported-by-send`, never as "verified". Un
|
|
|
278
286
|
carries no hardware scancode, which is why a rare scancode-only target would ignore it — documented,
|
|
279
287
|
not a bug.
|
|
280
288
|
|
|
289
|
+
## Desktop actions: launch, clipboard, window (0.7.0)
|
|
290
|
+
|
|
291
|
+
Three capabilities that were missing outright — "you cannot even start a program" was the honest answer
|
|
292
|
+
— and none of them is a door action. They choose no channel, cost no tier, and produce no proof window,
|
|
293
|
+
so they live beside `Invoke-WpmAction` rather than inside it, and the door discipline (point ownership,
|
|
294
|
+
the restore table, the proof window) is not widened by any of them.
|
|
295
|
+
|
|
296
|
+
**`launch` — two switches, neither of which implies the other.** `appLaunchAllowed` opens the
|
|
297
|
+
capability; `appLaunchAllow` lists the exact program names or absolute paths that may run, and an
|
|
298
|
+
**empty list means nothing may launch even with the gate on**. Matching is exact and case-folded: there
|
|
299
|
+
is no wildcard, and `notepad` does not authorise `notepad-helper.exe` — a whitelist that grows by prefix
|
|
300
|
+
is a whitelist that authorises more than it says. A refusal is `app_launch_denied` and is raised before
|
|
301
|
+
any worker request, so a refused launch started nothing (asserted with a request counter in
|
|
302
|
+
`test/plugin-test.mjs` and re-checked inside the engine against the same table). The engine's own
|
|
303
|
+
vocabulary for the window is the interesting part: `Process.Start` returns while the app is still
|
|
304
|
+
loading (measured: `MainWindowHandle=0` for 1348 ms on a cold notepad), so a program that has not
|
|
305
|
+
published a window yet answers `ok:true` with `hwnd=""` and `detail=window-not-yet` — neither a fake
|
|
306
|
+
failure nor a fake readiness. Arguments are passed through as given and written to the audit log,
|
|
307
|
+
because listing a program does not vouch for what it is told to do.
|
|
308
|
+
|
|
309
|
+
**`clipboard` — the most private read in this product.** What is on the clipboard may be a password or
|
|
310
|
+
a token the owner copied seconds ago, so a text read reports its **length**, its result text never
|
|
311
|
+
contains the payload, the audit line records `op`/`format`/`chars`, and values are capped at 64 KB with
|
|
312
|
+
`truncated` stated rather than silently cut. An image write accepts a `shotId`, so a screenshot can go
|
|
313
|
+
straight into the clipboard without the caller handling pixels; the read-back compares the size the
|
|
314
|
+
clipboard reports against the size the shot recorded. A clipboard holding neither is refused with the
|
|
315
|
+
format names it did find — an empty success would be indistinguishable from "the clipboard is empty".
|
|
316
|
+
|
|
317
|
+
**`window` — one named window, five ops, each verified by reading the window back.** `IsIconic`,
|
|
318
|
+
`GetWindowRect`, the `WS_EX_TOPMOST` bit — not `ShowWindow`'s return value, because a syscall's answer
|
|
319
|
+
describes the CALL and this product has been burned repeatedly by reporting that as a state. `move` and
|
|
320
|
+
`resize` pass `SWP_NOACTIVATE`, and the result carries `foregroundTaken=true|false` measured on both
|
|
321
|
+
sides of that specific call: `restore` activates by definition (that is what restoring is), and the
|
|
322
|
+
honest answer is to report it, not to hide it or to refuse the op the caller asked for. There is no
|
|
323
|
+
"all windows" op and no `#32770` discovery: acting on a window nobody named is not a convenience.
|
|
324
|
+
|
|
325
|
+
### One ceiling, eleven actions
|
|
326
|
+
|
|
327
|
+
The old shape of this problem was a boolean per capability, which does not scale past the number of
|
|
328
|
+
settings anyone will actually read. Instead the two axes are independent:
|
|
329
|
+
|
|
330
|
+
```
|
|
331
|
+
the action declares the lowest rung it can ever need (src/schema/tools.json#requiresTier)
|
|
332
|
+
the owner sets one ceiling (settings: policy)
|
|
333
|
+
|
|
334
|
+
readonly < quiet < flash < takeover
|
|
335
|
+
reads message bounded-UIA real cursor / held focus / launch
|
|
336
|
+
door flash
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
| `policy` | permits | refuses |
|
|
340
|
+
|---|---|---|
|
|
341
|
+
| `readonly` | `windows`, `status`, `snapshot`, `screenshot`, `preview`, `clipboard` read | every write |
|
|
342
|
+
| `quiet` | + `click` / `type` / `focus` through the message door | the flash tier, `clipboard` write, `window`, `launch` |
|
|
343
|
+
| `balanced` *(default)* | + the bounded-flash tier, `clipboard` write, `window` ops | `takeover:true`, `keyInput:"inject"`, `launch` |
|
|
344
|
+
| `full` | + the takeover tier and `launch` | nothing extra |
|
|
345
|
+
|
|
346
|
+
Above the ceiling a call is refused with **`policy_denied`** and the reason names both numbers (what the
|
|
347
|
+
action needed, what the policy allows), because the correct next step is a settings change and the wrong
|
|
348
|
+
one is a retry. The gate order is `paused → policy → takeoverAllowed/keyInjectAllowed → launch gate +
|
|
349
|
+
whitelist → idle check → the door table`, and every step in it is tested by making two gates disagree
|
|
350
|
+
about which one spoke (`test/plugin-test.mjs`). Two consequences are worth stating plainly rather than
|
|
351
|
+
leaving to discovery: **`takeover:true` now needs `policy:'full'` as well as `takeoverAllowed`** (0.7.0
|
|
352
|
+
raised the bar for the loudest tier on purpose), and `clipboard`'s halves are graded separately
|
|
353
|
+
(`requiresTierFor`), so a `readonly` owner can still read.
|
|
354
|
+
|
|
355
|
+
**Idle instead of a dialog.** When the last *physical* input is younger than `policyIdleMs` (default
|
|
356
|
+
3000 ms) and the action needs the takeover tier, it is refused with **`user_active`** and nothing is
|
|
357
|
+
clicked — no popup, no countdown. The upstream design asks the owner to consent by interrupting them;
|
|
358
|
+
an interrupt presented as consent is just a second disturbance. The escape hatch is explicit
|
|
359
|
+
(`forceUserActive:true`), it does not bypass any other gate, and the audit line records `forced:true` so
|
|
360
|
+
an interruption caused on purpose stays distinguishable from one caused by accident. An unattended run
|
|
361
|
+
is never blocked by this: with nobody typing, the age grows past the window and the call goes through.
|
|
362
|
+
|
|
363
|
+
### The audit log
|
|
364
|
+
|
|
365
|
+
Every action appends one JSONL line to `%LOCALAPPDATA%\wpm\audit.log` — allow **and** deny, because a
|
|
366
|
+
trail that records only refusals documents the times the guard worked and is silent about the times it
|
|
367
|
+
had nothing to do with. Fields: `ts, action, hwnd, tier, policy, decision, code, userActiveAgeMs,
|
|
368
|
+
effect, latencyMs`, plus `target`/`args` for a launch and `op`/`format`/`chars` for a clipboard call.
|
|
369
|
+
What is deliberately absent is content: no typed text, no clipboard payload — the second copy of a
|
|
370
|
+
secret is the one nobody protects. `auditKeep` (default 2000) bounds the file, pruning oldest-first when
|
|
371
|
+
a write pushes it past budget. An audit that cannot be written is reported (`auditNote=n write(s)
|
|
372
|
+
failed`) rather than swallowed: a log that looks complete and is not is worse than one that admits it
|
|
373
|
+
is missing lines. This is the only artifact that survives a call, and it is the one thing that can
|
|
374
|
+
answer "what did the agent do to this machine" after the fact.
|
|
375
|
+
|
|
376
|
+
## The second form: MCP over stdio (0.8.0)
|
|
377
|
+
|
|
378
|
+
The same plugin is also an MCP server, and it is the same code rather than a re-implementation of it.
|
|
379
|
+
`lib/mcp-server.mjs` registers the tool by calling the very `apply()` the DSH host calls, and forwards
|
|
380
|
+
`tools/call` into the same `toRequest()` / gate order / `format()` path, so the eleven actions, the
|
|
381
|
+
seventeen refusal codes, the policy ceiling and the audit line are identical in both forms. That is why
|
|
382
|
+
the engine files were not touched to add it: a second implementation of a permission is a permission
|
|
383
|
+
that can be reached around by using the other copy.
|
|
384
|
+
|
|
385
|
+
**One tool, not eleven.** `tools/list` exposes `wpm` with an `action` discriminator, generated from
|
|
386
|
+
`src/schema/tools.json` — one `oneOf` branch per action, whose `properties`, `required` and
|
|
387
|
+
`additionalProperties` are that action's declaration copied field for field. Nothing in the server
|
|
388
|
+
spells out an action name, a parameter name or a code, and `scripts/check-mcp-schema.mjs` is the reason
|
|
389
|
+
that stays true: it starts the real server, reads what a client would read, and compares it to the file.
|
|
390
|
+
Its self-test mutates both sides on purpose — four edits to the generator must turn the gate red, and two
|
|
391
|
+
edits to the *contract* (rename a parameter, flip `additionalProperties`) must stay green AND move,
|
|
392
|
+
because an arm that only breaks the generator cannot tell a generated schema from a transcribed one that
|
|
393
|
+
happens to agree today.
|
|
394
|
+
|
|
395
|
+
**Settings come from the environment, never from the call.** `WPM_POLICY`, `WPM_TAKEOVER_ALLOWED`,
|
|
396
|
+
`WPM_APP_LAUNCH_ALLOWED`, `WPM_APP_LAUNCH_ALLOW` and the rest of the `WPM_*` set are read at start-up
|
|
397
|
+
and only if present — the defaults stay in `lib/index.js`, because a second copy of a default is a
|
|
398
|
+
default that drifts. A client that could raise its own ceiling or add itself to the launch whitelist
|
|
399
|
+
would make the authorization model decorative, which is the same reason the DSH form reads settings
|
|
400
|
+
from the profile rather than from the prompt.
|
|
401
|
+
|
|
402
|
+
**A picture is attached as pixels, because a path is not portable.** The DSH form renders the screenshot
|
|
403
|
+
file it wrote; a caller on the other end of a pipe cannot open it, so `tools/call` returns the PNG as
|
|
404
|
+
base64 `image` content alongside the text. The text is never replaced by it — `screenRect`, `scale`,
|
|
405
|
+
`identity`, `frame` and `captureBackend` stay in the first block, and across the DSH bridge, where a
|
|
406
|
+
host that cannot accept image input projects the picture into a text diagnostic, those numbers still
|
|
407
|
+
arrive. `WPM_MCP_NO_IMAGE=1` opts out.
|
|
408
|
+
|
|
409
|
+
**Refusals survive the trip.** A refused call comes back with `isError` and the code as the first token
|
|
410
|
+
of the text, unsoftened. Over the DSH bridge the refusal is re-raised as an error whose message is that
|
|
411
|
+
text, so `policy_denied` still reads as `policy_denied` at the far end — asserted, not assumed, in
|
|
412
|
+
`test/mcp-bridge.mjs`, which drives the SDK and the bridge code the host actually ships.
|
|
413
|
+
|
|
414
|
+
**The transport is the only new attack surface, and it is a pipe.** JSON-RPC 2.0 over stdin/stdout with
|
|
415
|
+
Node built-ins and zero dependencies: one JSON object per line, replies keyed by `id` because the worker
|
|
416
|
+
is asynchronous, notifications answered with nothing, a non-JSON line answered with `-32700` and a null
|
|
417
|
+
`id` without killing the loop, an unknown method answered `-32601` without killing the loop, and stdin
|
|
418
|
+
closing meaning "dispose the sidecar and exit 0". Everything that is not a protocol line goes to stderr
|
|
419
|
+
— `console.log` in the plugin half would otherwise print into the JSON stream and corrupt it.
|
|
420
|
+
|
|
281
421
|
## What it does not do
|
|
282
422
|
|
|
283
423
|
- **No mouse injection.** `MOUSEEVENTF_*`, `mouse_event` and `keybd_event` are banned in every
|
|
@@ -291,6 +431,10 @@ not a bug.
|
|
|
291
431
|
- **No OCR / Set-of-Marks / pixel fallback.** Not part of this claim, and already done well elsewhere.
|
|
292
432
|
- **No watchdog.** The restore is one-shot and happens inline. A watchdog that keeps chasing the
|
|
293
433
|
foreground would fight you.
|
|
434
|
+
- **No HTTP, no SSE, no OAuth, no TLS.** Two forms exist and neither has a network face: in-process for
|
|
435
|
+
DSH, stdio for MCP. "No network surface" is not a hardening claim, it is the absence of one — there is
|
|
436
|
+
nothing to authenticate against, nothing to listen on, and nothing that keeps running when the caller
|
|
437
|
+
goes away.
|
|
294
438
|
- **Terminals are still refused** (`terminal_no_door`), and now for a measured reason. The 0.2.0 plan
|
|
295
439
|
was to drive one by typing into it; two probes say otherwise on this host: 242 `KEYEVENTF_UNICODE`
|
|
296
440
|
events with the terminal in the foreground and Enter sent produced nothing, and a scan-code arm
|
|
@@ -311,12 +455,29 @@ call, not at plugin load.
|
|
|
311
455
|
`engines.dsh` is an explicit two-sided range. There is no runtime version probing and no silent
|
|
312
456
|
degradation.
|
|
313
457
|
|
|
458
|
+
Since 0.8.0 the same package is also an MCP server, and nothing about the install above changes — the
|
|
459
|
+
two forms are parallel entries, not a migration:
|
|
460
|
+
|
|
461
|
+
```bash
|
|
462
|
+
# stdio, configured by the environment of whoever starts it
|
|
463
|
+
WPM_POLICY=balanced npx dsh-windows-parallel-mcp # via bin: wpm-mcp
|
|
464
|
+
# or, from a checkout
|
|
465
|
+
node lib/mcp-server.mjs
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
Point any MCP client at that command; `server.json` (shipped in the tarball) is the MCP Registry
|
|
469
|
+
manifest for it, with the namespace `io.github.drscrewdriver/dsh-windows-parallel-mcp` and the npm
|
|
470
|
+
package as its ownership proof. A DSH profile can bridge it instead of loading the plugin directly
|
|
471
|
+
(`@deepseek-ai/dsh-mcp-client`, stdio transport), which registers the tool as `mcp__<serverName>__wpm`;
|
|
472
|
+
`test/mcp-bridge.mjs` drives that bridge with the host's own client SDK and tool-definition code.
|
|
473
|
+
|
|
314
474
|
## Typed surface
|
|
315
475
|
|
|
316
476
|
`types/index.d.ts` is written by hand, not emitted from an implementation. It covers the whole
|
|
317
|
-
contract: the
|
|
318
|
-
surface
|
|
319
|
-
own four-value union (`WpmEffect`) beside
|
|
477
|
+
contract: the eleven actions, every argument including the takeover fields, the image-space / label
|
|
478
|
+
surface, 0.6.0's `caretPosition` and 0.7.0's `target`/`op`/`format`/`forceUserActive`, all seventeen
|
|
479
|
+
refusal codes as a closed union, and `effect` as its own four-value union (`WpmEffect`) beside
|
|
480
|
+
`WpmCaptureBackend`, `WpmClipboardOp`, `WpmWindowOp`, `WpmPolicy` and `WpmFrameSource`.
|
|
320
481
|
|
|
321
482
|
Its wiring is measured in both resolution modes a consumer can use, rather than assumed from the
|
|
322
483
|
presence of a file:
|
|
@@ -351,6 +512,11 @@ when one is present, and the gate reports a named SKIP rather than a red when on
|
|
|
351
512
|
| `snapshotMaxElements` | `300` | cap on elements per snapshot (1–5000); a tighter cap is a smaller frame for a deciding subagent |
|
|
352
513
|
| `screenshotMaxWidth` | `0` | downscale captures to this width; `0` means no scaling and `scale=1` — a resized image is a different coordinate system, so it is never chosen silently |
|
|
353
514
|
| `shotsKeep` | `10` | how many PNGs stay in `%LOCALAPPDATA%\wpm\shots`; older files are deleted after each capture |
|
|
515
|
+
| `policy` | `balanced` | the ceiling over all eleven actions: `readonly` < `quiet` < `balanced` < `full`. Above it a call is refused with `policy_denied`, whose next step is to raise THIS setting and not to retry. An unrecognizable value falls back to `balanced`, never to `full` |
|
|
516
|
+
| `policyIdleMs` | `3000` | how recently a physical input counts as "the owner is here". A takeover-tier call then refuses with `user_active` and opens no dialog; `0` disables the check |
|
|
517
|
+
| `appLaunchAllowed` | `false` | allow `action=launch` at all. Independent of `takeoverAllowed`: being allowed to move a pointer is not being allowed to start a program |
|
|
518
|
+
| `appLaunchAllow` | `[]` | the launch whitelist — exact names or absolute paths, matched case-insensitively and in full. Empty means nothing may launch even with the gate on; no wildcard, no prefix |
|
|
519
|
+
| `auditKeep` | `2000` | how many lines `%LOCALAPPDATA%\wpm\audit.log` holds before the oldest are pruned |
|
|
354
520
|
|
|
355
521
|
## What measurement established
|
|
356
522
|
|
|
@@ -439,6 +605,59 @@ unmeasured end-to-end and is stated as such in [docs/refusals.md](docs/refusals.
|
|
|
439
605
|
exercised `replace:true` through the message door, which is why the fix ships with an arm that does
|
|
440
606
|
(`test/readback-truth.mjs` A1). Found by running the import instead of trusting its name.
|
|
441
607
|
|
|
608
|
+
### 0.7.0's measurements
|
|
609
|
+
|
|
610
|
+
- **A cold `Process.Start` has no window for over a second** — notepad: pid present,
|
|
611
|
+
`MainWindowHandle=0`, **1348 ms**, and the window only reachable by polling the pid. Hence
|
|
612
|
+
`waitMs`/`window-not-yet` rather than an hwnd claim at return time.
|
|
613
|
+
- **The STA clipboard works in the worker and is not instant** — text write+read identical, first call
|
|
614
|
+
**138 ms**; `SetDataObject`/`GetDataObject` for images (40×20 verified). `Clipboard.Flush()` does NOT
|
|
615
|
+
exist on Windows PowerShell 5.1's runtime (.NET Framework): the first version of this branch threw
|
|
616
|
+
"Clipboard does not contain a method named 'Flush'", which is a method present in the documentation
|
|
617
|
+
people read and absent from the platform the product targets. `SetDataObject($v, $true)` is the
|
|
618
|
+
supported way to make the data outlive the process.
|
|
619
|
+
- **`SW_RESTORE` activates.** Measured around a restore on a real notepad window:
|
|
620
|
+
`foregroundBefore=<other> foregroundAfter=<target>`. Reported as `foregroundTaken=true` on that call
|
|
621
|
+
instead of being attributed to something else; `move`/`resize`/`topmost` measured
|
|
622
|
+
`foregroundTaken=false` with `SWP_NOACTIVATE`.
|
|
623
|
+
- **The whitelist is only a whitelist if it is exact.** `notepad` against `notepad-helper.exe`: a
|
|
624
|
+
prefix or substring rule authorises the second one, so membership is a case-folded full-string test
|
|
625
|
+
and `test/plugin-test.mjs` asserts the refusal for an unlisted name while the gate is on.
|
|
626
|
+
- **The refusal vocabulary is unchanged in shape by `requiresTier`** — a rung comparison is arithmetic
|
|
627
|
+
over one ordered list, so the cost of an action's classification is one number, not one new code per
|
|
628
|
+
action. Three codes were added for the whole batch (`app_launch_denied`, `policy_denied`,
|
|
629
|
+
`user_active`), each naming a setting rather than a symptom.
|
|
630
|
+
- `Check-no-cursor-control` is still green with the same two whitelisted primitive uses and an
|
|
631
|
+
unchanged whitelist file list: adding `launch`/`window` did not open a door to `MOUSEEVENTF_*`,
|
|
632
|
+
`mouse_event` or `keybd_event`.
|
|
633
|
+
|
|
634
|
+
### 0.8.0's measurements
|
|
635
|
+
|
|
636
|
+
- **A hand-written JSON-RPC loop over stdio is enough** (the 0.8.0 prerequisite probe): `initialize`,
|
|
637
|
+
`tools/list` and `tools/call` all answer, an unknown method returns `-32601` and the process survives
|
|
638
|
+
it, a notification produces no reply line, two requests in flight are matchable by id, a non-JSON line
|
|
639
|
+
does not kill the transport, and closing stdin exits 0. Fifteen assertions, zero dependencies —
|
|
640
|
+
`@modelcontextprotocol/sdk` is not needed and is not used.
|
|
641
|
+
- **The host's SDK is the stricter judge than our own harness.** `test/mcp-bridge.mjs` connects
|
|
642
|
+
`@modelcontextprotocol/client` 2.2.0 (the version the DSH install ships) to our server and validates
|
|
643
|
+
the shapes we emit. Its negotiation throws when the server answers with a protocol revision the
|
|
644
|
+
client does not list, which is why `PROTOCOL_VERSIONS` in `lib/mcp-server.mjs` is checked against that
|
|
645
|
+
SDK's constants (latest `2025-11-25`) rather than guessed from a document.
|
|
646
|
+
- **A picture the host cannot display still delivers its numbers.** Across the bridge with no attachment
|
|
647
|
+
store mounted, a `screenshot` call does not throw: the bridge projects the image block into an
|
|
648
|
+
`[image unavailable: …]` text diagnostic and the `screenRect` / `scale` / `identity` / `frame` /
|
|
649
|
+
`captureBackend` line arrives regardless. Attaching pixels by default is safe because of that
|
|
650
|
+
measurement, not in spite of it.
|
|
651
|
+
- **`tools/list` follows the contract file, in both directions.** Renaming `caretPosition` in
|
|
652
|
+
`src/schema/tools.json` changes what the running server reports, and flipping one
|
|
653
|
+
`additionalProperties` changes it too — both are gate arms (`scripts/check-mcp-schema.mjs --self-test`),
|
|
654
|
+
so the claim "generated, not copied" is exercised rather than asserted in prose.
|
|
655
|
+
- **The install artifact is what was tested.** The 0.7.0 release was smoked from the unpacked tarball
|
|
656
|
+
(`npm pack` → unpack → drive the policy ceiling, both launch gates, the clipboard length-not-payload
|
|
657
|
+
rule and the audit rows: 17 assertions) and that run found two things the working tree could not show:
|
|
658
|
+
the `clipboard` headline does not name which op ran, and the launch gate is only observable once the
|
|
659
|
+
ceiling lets the call reach it. Both are recorded rather than papered over.
|
|
660
|
+
|
|
442
661
|
## Verifying the copy you actually installed
|
|
443
662
|
|
|
444
663
|
Every test above imports the repository checkout, so a package that installs to the wrong place or ships
|
|
@@ -447,6 +666,12 @@ drives the **installed** copy: it lists a real window, runs a takeover click, as
|
|
|
447
666
|
`takeover=on cursorRestored=true abortChord=…`, and checks that the HUD is torn down afterwards. Run once
|
|
448
667
|
against the desktop profile after installing, as the last step of a release.
|
|
449
668
|
|
|
669
|
+
The stdio form has the same discipline: unpack the tarball and start `lib/mcp-server.mjs` from the
|
|
670
|
+
unpacked directory (not from the checkout). `scripts/check-mcp-schema.mjs` and `test/mcp-bridge.mjs` both
|
|
671
|
+
spawn the server by path, so pointing them at the unpacked copy is the whole procedure. The 0.7.0 tag
|
|
672
|
+
was pushed after that run; a release that skips it is asserting that the shipped bytes work by
|
|
673
|
+
showing that the source does.
|
|
674
|
+
|
|
450
675
|
## License
|
|
451
676
|
|
|
452
677
|
MIT
|