dsh-windows-parallel-mcp 0.7.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/README.es.md CHANGED
@@ -5,7 +5,7 @@
5
5
  > Un plugin DSH que permite a un agente controlar **sus propias** ventanas de Windows — silencioso por defecto, visible cuando se pide. Cuando una ventana acepta mensajes de Windows, el foco nunca se pierde. Cuando solo UI Automation puede alcanzarla, el foco sufre un único destello acotado que se revierte automáticamente. Cuando pides explícitamente el modo takeover, el cursor se mueve al punto de acción y siempre se restaura, con un HUD que ofrece tres formas de interrumpir. En cualquier otro caso, rechaza con un código y una razón.
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.7.0** — this document describes the contract as of that version. What
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
@@ -15,6 +15,11 @@ explicitly ask for the takeover tier, the cursor moves to the point and is alway
15
15
  HUD that can stop it three ways. Everywhere else it refuses, with a code and a reason — never with
16
16
  silence: every refusal carries a code from a closed set of seventeen and the next step.
17
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.
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
20
25
  start moving your cursor by itself. Keyboard injection lives inside that tier only, only when asked
@@ -368,6 +373,51 @@ failed`) rather than swallowed: a log that looks complete and is not is worse th
368
373
  is missing lines. This is the only artifact that survives a call, and it is the one thing that can
369
374
  answer "what did the agent do to this machine" after the fact.
370
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
+
371
421
  ## What it does not do
372
422
 
373
423
  - **No mouse injection.** `MOUSEEVENTF_*`, `mouse_event` and `keybd_event` are banned in every
@@ -381,6 +431,10 @@ answer "what did the agent do to this machine" after the fact.
381
431
  - **No OCR / Set-of-Marks / pixel fallback.** Not part of this claim, and already done well elsewhere.
382
432
  - **No watchdog.** The restore is one-shot and happens inline. A watchdog that keeps chasing the
383
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.
384
438
  - **Terminals are still refused** (`terminal_no_door`), and now for a measured reason. The 0.2.0 plan
385
439
  was to drive one by typing into it; two probes say otherwise on this host: 242 `KEYEVENTF_UNICODE`
386
440
  events with the terminal in the foreground and Enter sent produced nothing, and a scan-code arm
@@ -401,6 +455,22 @@ call, not at plugin load.
401
455
  `engines.dsh` is an explicit two-sided range. There is no runtime version probing and no silent
402
456
  degradation.
403
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
+
404
474
  ## Typed surface
405
475
 
406
476
  `types/index.d.ts` is written by hand, not emitted from an implementation. It covers the whole
@@ -561,6 +631,33 @@ unmeasured end-to-end and is stated as such in [docs/refusals.md](docs/refusals.
561
631
  unchanged whitelist file list: adding `launch`/`window` did not open a door to `MOUSEEVENTF_*`,
562
632
  `mouse_event` or `keybd_event`.
563
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
+
564
661
  ## Verifying the copy you actually installed
565
662
 
566
663
  Every test above imports the repository checkout, so a package that installs to the wrong place or ships
@@ -569,6 +666,12 @@ drives the **installed** copy: it lists a real window, runs a takeover click, as
569
666
  `takeover=on cursorRestored=true abortChord=…`, and checks that the HUD is torn down afterwards. Run once
570
667
  against the desktop profile after installing, as the last step of a release.
571
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
+
572
675
  ## License
573
676
 
574
677
  MIT
package/README.fr.md CHANGED
@@ -5,7 +5,7 @@
5
5
  > Un plugin DSH qui laisse un agent piloter **ses propres** fenêtres Windows — discrètement par défaut, visiblement sur demande. Quand une fenêtre accepte un message Windows, le focus n'est jamais volé. Quand seule l'UI Automation peut l'atteindre, le focus connaît un seul flash borné, automatiquement réversible. Quand vous demandez explicitement le mode takeover, le curseur se déplace vers le point d'action et est toujours restauré, avec un HUD offrant trois façons d'interrompre. Partout ailleurs, le plugin refuse avec un code et une raison.
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.7.0** — this document describes the contract as of that version. What
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
@@ -15,6 +15,11 @@ explicitly ask for the takeover tier, the cursor moves to the point and is alway
15
15
  HUD that can stop it three ways. Everywhere else it refuses, with a code and a reason — never with
16
16
  silence: every refusal carries a code from a closed set of seventeen and the next step.
17
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.
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
20
25
  start moving your cursor by itself. Keyboard injection lives inside that tier only, only when asked
@@ -368,6 +373,51 @@ failed`) rather than swallowed: a log that looks complete and is not is worse th
368
373
  is missing lines. This is the only artifact that survives a call, and it is the one thing that can
369
374
  answer "what did the agent do to this machine" after the fact.
370
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
+
371
421
  ## What it does not do
372
422
 
373
423
  - **No mouse injection.** `MOUSEEVENTF_*`, `mouse_event` and `keybd_event` are banned in every
@@ -381,6 +431,10 @@ answer "what did the agent do to this machine" after the fact.
381
431
  - **No OCR / Set-of-Marks / pixel fallback.** Not part of this claim, and already done well elsewhere.
382
432
  - **No watchdog.** The restore is one-shot and happens inline. A watchdog that keeps chasing the
383
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.
384
438
  - **Terminals are still refused** (`terminal_no_door`), and now for a measured reason. The 0.2.0 plan
385
439
  was to drive one by typing into it; two probes say otherwise on this host: 242 `KEYEVENTF_UNICODE`
386
440
  events with the terminal in the foreground and Enter sent produced nothing, and a scan-code arm
@@ -401,6 +455,22 @@ call, not at plugin load.
401
455
  `engines.dsh` is an explicit two-sided range. There is no runtime version probing and no silent
402
456
  degradation.
403
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
+
404
474
  ## Typed surface
405
475
 
406
476
  `types/index.d.ts` is written by hand, not emitted from an implementation. It covers the whole
@@ -561,6 +631,33 @@ unmeasured end-to-end and is stated as such in [docs/refusals.md](docs/refusals.
561
631
  unchanged whitelist file list: adding `launch`/`window` did not open a door to `MOUSEEVENTF_*`,
562
632
  `mouse_event` or `keybd_event`.
563
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
+
564
661
  ## Verifying the copy you actually installed
565
662
 
566
663
  Every test above imports the repository checkout, so a package that installs to the wrong place or ships
@@ -569,6 +666,12 @@ drives the **installed** copy: it lists a real window, runs a takeover click, as
569
666
  `takeover=on cursorRestored=true abortChord=…`, and checks that the HUD is torn down afterwards. Run once
570
667
  against the desktop profile after installing, as the last step of a release.
571
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
+
572
675
  ## License
573
676
 
574
677
  MIT
package/README.it.md CHANGED
@@ -5,7 +5,7 @@
5
5
  > Un plugin DSH che consente a un agente di pilotare **le proprie** finestre Windows — silenzioso per impostazione predefinita, visibile su richiesta. Quando una finestra accetta un messaggio Windows, il focus non viene mai sottratto. Quando solo UI Automation può raggiungerla, il focus subisce un solo lampo limitato e viene ripristinato automaticamente. Quando richiedi esplicitamente la modalità takeover, il cursore si sposta sul punto di azione e viene sempre ripristinato, con un HUD che offre tre modi per interrompere. In tutti gli altri casi rifiuta con un codice e una ragione.
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.7.0** — this document describes the contract as of that version. What
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
@@ -15,6 +15,11 @@ explicitly ask for the takeover tier, the cursor moves to the point and is alway
15
15
  HUD that can stop it three ways. Everywhere else it refuses, with a code and a reason — never with
16
16
  silence: every refusal carries a code from a closed set of seventeen and the next step.
17
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.
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
20
25
  start moving your cursor by itself. Keyboard injection lives inside that tier only, only when asked
@@ -368,6 +373,51 @@ failed`) rather than swallowed: a log that looks complete and is not is worse th
368
373
  is missing lines. This is the only artifact that survives a call, and it is the one thing that can
369
374
  answer "what did the agent do to this machine" after the fact.
370
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
+
371
421
  ## What it does not do
372
422
 
373
423
  - **No mouse injection.** `MOUSEEVENTF_*`, `mouse_event` and `keybd_event` are banned in every
@@ -381,6 +431,10 @@ answer "what did the agent do to this machine" after the fact.
381
431
  - **No OCR / Set-of-Marks / pixel fallback.** Not part of this claim, and already done well elsewhere.
382
432
  - **No watchdog.** The restore is one-shot and happens inline. A watchdog that keeps chasing the
383
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.
384
438
  - **Terminals are still refused** (`terminal_no_door`), and now for a measured reason. The 0.2.0 plan
385
439
  was to drive one by typing into it; two probes say otherwise on this host: 242 `KEYEVENTF_UNICODE`
386
440
  events with the terminal in the foreground and Enter sent produced nothing, and a scan-code arm
@@ -401,6 +455,22 @@ call, not at plugin load.
401
455
  `engines.dsh` is an explicit two-sided range. There is no runtime version probing and no silent
402
456
  degradation.
403
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
+
404
474
  ## Typed surface
405
475
 
406
476
  `types/index.d.ts` is written by hand, not emitted from an implementation. It covers the whole
@@ -561,6 +631,33 @@ unmeasured end-to-end and is stated as such in [docs/refusals.md](docs/refusals.
561
631
  unchanged whitelist file list: adding `launch`/`window` did not open a door to `MOUSEEVENTF_*`,
562
632
  `mouse_event` or `keybd_event`.
563
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
+
564
661
  ## Verifying the copy you actually installed
565
662
 
566
663
  Every test above imports the repository checkout, so a package that installs to the wrong place or ships
@@ -569,6 +666,12 @@ drives the **installed** copy: it lists a real window, runs a takeover click, as
569
666
  `takeover=on cursorRestored=true abortChord=…`, and checks that the HUD is torn down afterwards. Run once
570
667
  against the desktop profile after installing, as the last step of a release.
571
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
+
572
675
  ## License
573
676
 
574
677
  MIT
package/README.ja.md CHANGED
@@ -5,7 +5,7 @@
5
5
  > エージェントが**自分の** Windows ウィンドウを操作するための DSH プラグインです。既定では静默、要求があれば可視化します。ウィンドウがウィンドウメッセージを受け付ける場合、フォーカスは一切奪われません。UI Automation 経由でしか届かない場合、フォーカスは一度だけ有界なフラッシュで移り自動で戻ります。明示的にテイクオーバーを要求した場合、カーソルは操作点へ移動し常に復元され、HUD が三つの中断手段を提供します。それ以外はコードと理由を添えて拒否します。
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.7.0** — this document describes the contract as of that version. What
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
@@ -15,6 +15,11 @@ explicitly ask for the takeover tier, the cursor moves to the point and is alway
15
15
  HUD that can stop it three ways. Everywhere else it refuses, with a code and a reason — never with
16
16
  silence: every refusal carries a code from a closed set of seventeen and the next step.
17
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.
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
20
25
  start moving your cursor by itself. Keyboard injection lives inside that tier only, only when asked
@@ -368,6 +373,51 @@ failed`) rather than swallowed: a log that looks complete and is not is worse th
368
373
  is missing lines. This is the only artifact that survives a call, and it is the one thing that can
369
374
  answer "what did the agent do to this machine" after the fact.
370
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
+
371
421
  ## What it does not do
372
422
 
373
423
  - **No mouse injection.** `MOUSEEVENTF_*`, `mouse_event` and `keybd_event` are banned in every
@@ -381,6 +431,10 @@ answer "what did the agent do to this machine" after the fact.
381
431
  - **No OCR / Set-of-Marks / pixel fallback.** Not part of this claim, and already done well elsewhere.
382
432
  - **No watchdog.** The restore is one-shot and happens inline. A watchdog that keeps chasing the
383
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.
384
438
  - **Terminals are still refused** (`terminal_no_door`), and now for a measured reason. The 0.2.0 plan
385
439
  was to drive one by typing into it; two probes say otherwise on this host: 242 `KEYEVENTF_UNICODE`
386
440
  events with the terminal in the foreground and Enter sent produced nothing, and a scan-code arm
@@ -401,6 +455,22 @@ call, not at plugin load.
401
455
  `engines.dsh` is an explicit two-sided range. There is no runtime version probing and no silent
402
456
  degradation.
403
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
+
404
474
  ## Typed surface
405
475
 
406
476
  `types/index.d.ts` is written by hand, not emitted from an implementation. It covers the whole
@@ -561,6 +631,33 @@ unmeasured end-to-end and is stated as such in [docs/refusals.md](docs/refusals.
561
631
  unchanged whitelist file list: adding `launch`/`window` did not open a door to `MOUSEEVENTF_*`,
562
632
  `mouse_event` or `keybd_event`.
563
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
+
564
661
  ## Verifying the copy you actually installed
565
662
 
566
663
  Every test above imports the repository checkout, so a package that installs to the wrong place or ships
@@ -569,6 +666,12 @@ drives the **installed** copy: it lists a real window, runs a takeover click, as
569
666
  `takeover=on cursorRestored=true abortChord=…`, and checks that the HUD is torn down afterwards. Run once
570
667
  against the desktop profile after installing, as the last step of a release.
571
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
+
572
675
  ## License
573
676
 
574
677
  MIT