dsh-windows-parallel-mcp 0.1.2 → 0.1.3

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.md CHANGED
@@ -4,7 +4,49 @@ Dates are the registry `time` values for each version, not git commit dates —
4
4
  when someone typed, a publish time records when a version became installable, and only the second
5
5
  one is a promise to anyone installing it.
6
6
 
7
- ## 0.1.2 — 2026-11-21
7
+ ## 0.1.3 — 2026-11-21
8
+
9
+ (Registry time `2026-11-21T…Z` UTC; same convention as below — the publish time is the promise.)
10
+
11
+ 0.1.2 shipped a proof that answered "did we disturb you". It never answered "did the thing happen" —
12
+ the engine computed `effect` on every action call and the Node half dropped it on the floor, so
13
+ `proof=pass` could mean *"clicked, and the app ignored it"*. This release closes that link, and then
14
+ closes the hole the missing link was hiding.
15
+
16
+ **Added**
17
+ - `effect=` in every action result's text and `effect` in the structured output, with three values
18
+ that name the SPEAKER rather than the confidence: `unverified` (nobody), `reported-by-send` (the
19
+ message was delivered), `reported-by-pattern` (the UIA call returned). README carries the table;
20
+ the code comment above the branch pins the same three lines. A refusal reports no effect at all —
21
+ no action ran, so nobody can have spoken.
22
+ - `lib/proof-window.mjs` gains an effect dimension: `evaluateProof(samples, { effect, actions })`.
23
+ A call whose channel reported nothing is capped at `inconclusive`; a batch caller whose every
24
+ attempt failed gets `fail` regardless of displacement. Both are opt-in — omitting `effect` leaves
25
+ every pre-0.1.3 caller's behaviour untouched, which is why the 32 pre-existing arms did not move.
26
+
27
+ **Corrected**
28
+ - The gate could read a total no-op as a green light: zero cursor displacement, zero foreground
29
+ switches, nothing accomplished => `pass`. The old plan named the case ("50 failed calls, zero
30
+ displacement, FAIL") and never landed it. It is landed now, with the arms that fail in the
31
+ direction that matters: `unverified` + a still desktop is not a pass, and 50 failed attempts is a
32
+ `fail` whose reason says 动作未生效.
33
+ - Word boundaries: `reported-by-send` says the message was DELIVERED. It does not say the application
34
+ processed it, and `reported-by-pattern` does not say the interface changed. Single `reported-by-*`
35
+ evidence still passes (it is real, just not independent) and the reason says so out loud: 未独立验证.
36
+
37
+ **Verified**
38
+ - `node test/proof-window-test.mjs` — 40 arms, 0 failed (32 carried over unchanged, 8 new).
39
+ - `node test/plugin-test.mjs` — 54 arms, 0 failed, including a real `no_hwnd` refusal carrying no
40
+ effect and the three legal values round-tripping through the shipped projection.
41
+ - `node scripts/check.mjs` — 12 gates green, including the marker end-to-end gate, which on this
42
+ machine's real desktop printed
43
+ `proof=pass [cursor=pass fg=pass focus=pass] :: effect=reported-by-send: a channel reported the call
44
+ returned -- 未独立验证`.
45
+
46
+ ## 0.1.2 — 2026-11-20
47
+
48
+ (Registry time `2026-11-20T17:15:15Z` UTC = `2026-11-21 01:15` Beijing; the date follows the same
49
+ UTC convention as the entries below, because the header's rule is "the publish time is the promise".)
8
50
 
9
51
  The proof chain became real: what started as "the README says the cursor never moves" ended as a
10
52
  per-call measurement, a build-time guarantee, and — recorded honestly — three judgment designs that
package/README.md CHANGED
@@ -1,10 +1,11 @@
1
1
  # dsh-windows-parallel-mcp
2
2
 
3
- > **0.1.2 — every real click now carries its own disturbance proof.** The name was reserved earlier
4
- > under a weaker claim (see [CHANGELOG.md](CHANGELOG.md)); the claim below is the measured one.
5
- > 0.1.1 is 0.1.0's behaviour with a corrected packaging chain; 0.1.2 adds the runtime proof chain —
6
- > `wpm click` returns a `proof=` verdict and `proofDimensions`, measured against the desktop around
7
- > your own call.
3
+ > **0.1.3 — the proof now says who reported the success, not just that you were undisturbed.** The
4
+ > name was reserved earlier under a weaker claim (see [CHANGELOG.md](CHANGELOG.md)); the claim below
5
+ > is the measured one. 0.1.1 is 0.1.0's behaviour with a corrected packaging chain; 0.1.2 added the
6
+ > runtime proof chain (`proof=` verdict and `proofDimensions`, measured against the desktop around
7
+ > your own call); 0.1.3 adds the second half — `effect=` — and lets it enter the judgment, so a call
8
+ > that accomplished nothing can no longer read as `proof=pass`.
8
9
 
9
10
  A DSH plugin that lets an agent drive **its own** Windows windows without moving your cursor. Where
10
11
  a window accepts a window message, you never lose focus at all. Where it only exposes UI Automation,
@@ -30,7 +31,9 @@ One tool, five actions:
30
31
  The engine picks the cheapest available door per call:
31
32
 
32
33
  - **quiet tier** — a classic child window receives the click/text as a window message. Measured:
33
- 0 foreground changes in 6 of 6 rounds, effect verified by the app's own state, cursor moved 0 px.
34
+ 0 foreground changes in 6 of 6 rounds, cursor moved 0 px. (Those 6 rounds also read the target
35
+ app's own state to confirm the click landed — that was a *separate* experiment, not the `effect=`
36
+ field, which says only who reported the call returned; see the table below.)
34
37
  - **bounded-flash tier** — only UI Automation can reach the control, which raises the target. The
35
38
  engine records the focus table *before* acting, reverses it **once** afterwards, and never pulls
36
39
  focus from a window you chose. Measured net return **15–95 ms** from three independent
@@ -62,7 +65,7 @@ next step — see [docs/refusals.md](docs/refusals.md).
62
65
  verdict plus a `proofDimensions` field (cursor / foreground / focus). Around your call the engine
63
66
  samples cursor position, foreground window, keyboard focus and last-physical-input age — in a short
64
67
  pre-action control window (when, by construction, nothing was running) and inside the settle wait it
65
- already pays. The judgment is one pure function (`lib/proof-window.mjs`, unit-tested against 32
68
+ already pays. The judgment is one pure function (`lib/proof-window.mjs`, unit-tested against 40
66
69
  synthetic windows whose answers are known by construction). What it honestly can and cannot say:
67
70
  a switch of foreground on a quiet tier fails — the control shows the desktop was not doing it, so it
68
71
  is the action's to explain; a cursor jump is *reported*, never accused, because with nothing running
@@ -72,6 +75,24 @@ gate asserts no shipped file contains `SetCursorPos`/`SendInput`/`mouse_event`/`
72
75
  regression that adds cursor control fails at build time with certainty instead of being hunted at
73
76
  runtime among ambient motion.
74
77
 
78
+ **And it says who reported the success.** Every action result carries `effect=` in the text and
79
+ `effect` in the structured output. The three values are not degrees of confidence in the
80
+ application — they name the speaker:
81
+
82
+ | `effect` | who is speaking | it proves | it does **not** prove |
83
+ |---|---|---|---|
84
+ | `unverified` | nobody | nothing | anything |
85
+ | `reported-by-send` | the window-message channel | the message was **delivered** | that the target app processed it |
86
+ | `reported-by-pattern` | the UI Automation pattern call | the call **returned** without throwing | that the interface actually changed |
87
+
88
+ Since 0.1.3 the effect also enters the judgment, which closes the one honest gap 0.1.2 still had:
89
+ a still desktop could outvote a total no-op. A call whose channel reported nothing is capped at
90
+ `inconclusive` — never `pass`. A batch caller that passes its per-attempt results (`actions`) gets
91
+ `fail` when **no** attempt took effect, however few pixels moved. Displacement proves we did not
92
+ disturb you; it never proves we accomplished anything. A single `reported-by-*` stays a `pass` with
93
+ the caveat spelled out in the reason field (`未独立验证` — nobody observed the app), because turning
94
+ weak-but-real evidence into a red would train its readers to ignore the verdict.
95
+
75
96
  ## What it does not do
76
97
 
77
98
  - **No synthetic input.** There is no `physical` option: it is absent from the schema, not disabled
package/lib/index.js CHANGED
@@ -352,10 +352,19 @@ function format(action, r) {
352
352
  return result(action, false, code, `${code}${reason}`);
353
353
  }
354
354
 
355
+ // WHO REPORTED THE SUCCESS. The engine sets `effect` when a channel call RETURNS without throwing;
356
+ // this file never upgrades it, and the three values are not degrees of confidence in the app -- they
357
+ // name who is speaking (README's table states the same three lines, keep them in step):
358
+ // unverified no channel reported success at all;
359
+ // reported-by-send the window message was DELIVERED -- nothing here proves the target app
360
+ // processed it;
361
+ // reported-by-pattern the UIA pattern call RETURNED -- nothing here proves the interface changed.
362
+ // Read as "who says it worked", never as "the application's state is confirmed".
355
363
  const bits = [
356
364
  `${action} ok`,
357
365
  `channel=${r.channel || '?'}`,
358
366
  `tier=${r.tier || '?'}`,
367
+ `effect=${r.effect || 'unverified'}`,
359
368
  `focusTaken=${r.focusTaken === 'true' || r.focusTaken === true}`,
360
369
  ];
361
370
  // THE PROOF. The engine sampled cursor/foreground/focus/last-input-age in TWO windows: a short
@@ -376,13 +385,22 @@ function format(action, r) {
376
385
  const proof = evaluateProof(r.proofSamples || [], {
377
386
  control: r.proofControl || [],
378
387
  declaredFlash: r.tier === 'bounded-flash',
388
+ // The effect travels into the judgment, not just into the text. Without this, "nothing worked"
389
+ // still reads as proof=pass whenever the desktop happened to stay still (R2 in the plan). One call
390
+ // is one action, so `actions` is left to batch callers; a channel that reported NOTHING here caps
391
+ // the verdict at inconclusive rather than inventing a red on a single quiet call.
392
+ effect: r.effect || 'unverified',
379
393
  });
380
394
  bits.push(`proof=${proof.verdict}(${proof.reason})`);
381
395
  if (r.restoreOutcome) bits.push(`restore=${r.restoreOutcome}`);
382
396
  if (r.flashMs !== undefined) bits.push(`flashMs=${r.flashMs}`);
383
397
  if (r.latencyMs !== undefined) bits.push(`latencyMs=${r.latencyMs}`);
384
398
  if (r.detail) bits.push(`detail=${r.detail}`);
385
- return result(action, true, '', bits.join(' '), { proof: proof.verdict, proofDimensions: proof.dimensions });
399
+ return result(action, true, '', bits.join(' '), {
400
+ proof: proof.verdict,
401
+ proofDimensions: proof.dimensions,
402
+ effect: r.effect || 'unverified',
403
+ });
386
404
  }
387
405
 
388
406
  function truncate(s, n) {
@@ -390,4 +408,6 @@ function truncate(s, n) {
390
408
  }
391
409
 
392
410
  // Exported for tests: the projection from the five contract actions to this one tool.
393
- export const _internals = { PARAMETERS, ACTIONS, TOOL_NAME, clampSettle, CONFIG_DEFAULTS };
411
+ // `formatResult` is here so the effect dimension can be asserted on the SHIPPED projection, with
412
+ // hand-authored engine results, without a desktop that has to cooperate.
413
+ export const _internals = { PARAMETERS, ACTIONS, TOOL_NAME, clampSettle, CONFIG_DEFAULTS, formatResult: format };
@@ -63,10 +63,16 @@ export function isHumanGap(b, a, humanGapFactor = 0.6) {
63
63
  /**
64
64
  * Evaluate one proof window. Pure.
65
65
  * @param {Array} samples the ACTION window
66
- * @param {{minSamples?:number, humanGapFactor?:number, control?:Array}} [opts]
66
+ * @param {{minSamples?:number, humanGapFactor?:number, control?:Array, declaredFlash?:boolean,
67
+ * effect?:string, actions?:Array}} [opts]
67
68
  * control = the pre-action window (sampled while nothing was done). It cannot excuse motion in the
68
69
  * action window -- the structural rule already handles that -- but it decides whether the
69
70
  * foreground/focus dimensions are evaluable at all.
71
+ * effect = the engine's own word on who reported success ('unverified' | 'reported-by-send' |
72
+ * 'reported-by-pattern'). Omitted => no effect dimension, so every pre-existing caller keeps its
73
+ * old behaviour byte for byte.
74
+ * actions = optional per-attempt results ({ ok, effect }); when EVERY attempt failed to take
75
+ * effect the verdict is fail regardless of how still the desktop stayed.
70
76
  */
71
77
  export function evaluateProof(samples, opts = {}) {
72
78
  const minSamples = opts.minSamples ?? 3;
@@ -137,7 +143,11 @@ export function evaluateProof(samples, opts = {}) {
137
143
  if (c.attribution) control = c.attribution;
138
144
  }
139
145
 
140
- const v = verdictFor(attribution, control, r.length, { declaredFlash: opts.declaredFlash === true });
146
+ const v = verdictFor(attribution, control, r.length, {
147
+ declaredFlash: opts.declaredFlash === true,
148
+ effect: opts.effect,
149
+ actions: opts.actions,
150
+ });
141
151
  return {
142
152
  samples: r.length,
143
153
  windowMs: r[r.length - 1].ts - r[0].ts,
@@ -176,8 +186,46 @@ export function evaluateProof(samples, opts = {}) {
176
186
  * owns it, surfacing restore_failed separately). Reported,
177
187
  * not failed.
178
188
  * unreadable instrument on most gaps => inconclusive (silence is not innocence)
189
+ * effect : absent => the dimension does not exist (every pre-0.1.3 caller unchanged)
190
+ * reported-by-send => pass, and the reason says 未独立验证: a channel reported that
191
+ * reported-by-pattern the call RETURNED; nobody observed the application react
192
+ * unverified / unknown => inconclusive (no channel reported anything, so a still
193
+ * cursor cannot be read as "the action landed")
194
+ * actions : every attempt failed => fail (动作未生效), however still the desktop stayed. This is
195
+ * the case the pre-0.1.3 gate could read as a green light: 50 failed calls, zero
196
+ * displacement. Displacement proves we did not disturb; it never proves we accomplished.
179
197
  * Overall = worst dimension: fail > inconclusive > pass.
180
198
  */
199
+ function judgeEffect(effect, actions) {
200
+ const list = Array.isArray(actions) ? actions.filter(Boolean) : [];
201
+ const reported = (a) => a.ok !== false
202
+ && (a.effect === 'reported-by-send' || a.effect === 'reported-by-pattern');
203
+
204
+ // Every attempt failed to take effect => fail, whatever the samples say. A displacement-free window
205
+ // is the ABSENCE of disturbance, not the PRESENCE of accomplishment; letting it outvote a total
206
+ // no-op is exactly the self-deception this dimension exists to stop.
207
+ if (list.length > 0 && !list.some(reported)) {
208
+ return {
209
+ dim: 'fail',
210
+ note: `动作未生效 (none of ${list.length} action attempt(s) took effect: no channel ever reported success, so the clean window below proves only that we did nothing loudly)`,
211
+ };
212
+ }
213
+ // No effect supplied at all => no dimension. This keeps the module's old contract for every caller
214
+ // that predates it (the 32 pre-existing arms must not move).
215
+ if (effect === undefined || effect === null || effect === '') return null;
216
+ if (effect === 'reported-by-send' || effect === 'reported-by-pattern') {
217
+ return {
218
+ dim: 'pass',
219
+ note: `effect=${effect}: a channel reported the call returned -- 未独立验证 (not independently verified: the application's own handling was never observed)`,
220
+ };
221
+ }
222
+ // 'unverified', and anything this module does not know, cannot be laundered into a pass.
223
+ return {
224
+ dim: 'inconclusive',
225
+ note: `effect='${effect}': no channel reported success, so the clean window below cannot be read as the action having landed`,
226
+ };
227
+ }
228
+
181
229
  export function verdictFor(attribution, control, sampleCount, opts = {}) {
182
230
  const a = attribution || {};
183
231
  const unreadableCap = opts.unreadableCap ?? Math.max(1, Math.floor((sampleCount - 1) * 0.3));
@@ -215,6 +263,9 @@ export function verdictFor(attribution, control, sampleCount, opts = {}) {
215
263
  if (dims.focus === 'fail') parts.push(`${aFc} unexplained focus change(s) with a clean control`);
216
264
  if (dims.focus === 'inconclusive') parts.push(`${aFc} focus change(s) mirroring the desktop's own behaviour during the control`);
217
265
 
266
+ const eff = judgeEffect(opts.effect, opts.actions);
267
+ if (eff) { dims.effect = eff.dim; parts.push(eff.note); }
268
+
218
269
  const values = Object.values(dims);
219
270
  // 'declared' is informational, never the worst value: it cannot drag the verdict down on its own.
220
271
  const verdict = values.includes('fail') ? 'fail' : values.includes('inconclusive') ? 'inconclusive' : 'pass';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-windows-parallel-mcp",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "tag": "latest"