dsh-windows-parallel-mcp 0.4.1 → 0.5.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 CHANGED
@@ -8,8 +8,14 @@ Dates are the registry `time` values for each version, not git commit dates —
8
8
  when someone typed, a publish time records when a version became installable, and only the second
9
9
  one is a promise to anyone installing it.
10
10
 
11
+ ## 0.5.0 — 2026-11-23
12
+
13
+ > 0.5.0 macht den „Rahmen“ für Aufrufer lesbar und nimmt die Koordinatenrechnung aus der Hand des Modells: drei Lese-Aktionen (`snapshot` als nummerierte Elementtabelle, `screenshot` mit der Zuordnung als Daten, `preview` mit dem Element unter einem Punkt als Text), `label`-Adressierung über die RuntimeId auf das Element zurückgeführt, `space:"image"` vom Motor umgerechnet, und ein vierzehnter Ablehnungscode `stale_ref`. Die geplante Invariante „jedes Element-Rect liegt in screenRect“ wurde durch Messung widerlegt (Überstände von 3/18/287/2720px; ein Rect ist eine absolute Bildschirmkoordinate und hängt gar nicht vom Rahmen ab) — ersetzt durch gezähltes Ausschließen nicht überlappender Elemente, einen Kreuzvergleich des Rahmens mit dem vom Baum gemeldeten Fenster-Rect (frameCheck/frameInset) und ein Struktur-Gate für die einzige Rahmenquelle. Gates 17→19, zwei unabhängige Oracle-Suiten. Details im englischen Eintrag.Zwei weitere Korrekturen: `uia_tree_empty` wird nicht mehr für Fenster gemeldet, die eine Tür haben, deren Tür aber durch `elementName` unterdrückt wurde (WinForms antwortet jetzt `unreachable`), und die Cursor-Drift-Assertion, die das Gate sporadisch rot färbte, schließt die Bewegung des Besitzers über `GetLastInputInfo` aus (SKIP mit age/Fenster bei Eingabe; der exakte Read-back des Motors bleibt eine harte Assertion).
14
+
11
15
  ## 0.4.1 — 2026-11-23
12
16
 
17
+ > Published 2026-11-23T11:07:25.234Z (registry `time` for 0.4.1, read from the packument, not from a commit date).
18
+
13
19
  > 0.4.1 ist ein Dokumentations- und Gate-Release ohne Laufzeitänderung (`lib/`, `src/engine/` byteweise unverändert). Behebt die README-Kopfzeile, die weiterhin 0.2.0 verkündete, und ergänzt den völlig fehlenden Abschnitt zu `types/index.d.ts`. Drei neue Gates: die Release-Zeile gegen `package.json` geprüft, byteweise Identität des englischen Texts in den neun Übersetzungen, und ein Consumer-Test, der über den Paketnamen auflöst (der alte nutzte nur einen relativen Pfad, sodass das Entfernen der `types`-Bedingung alles grün ließ). Siehe englischen Eintrag.
14
20
 
15
21
  ## 0.4.0 — 2026-11-23
package/CHANGELOG.es.md CHANGED
@@ -8,8 +8,14 @@ Dates are the registry `time` values for each version, not git commit dates —
8
8
  when someone typed, a publish time records when a version became installable, and only the second
9
9
  one is a promise to anyone installing it.
10
10
 
11
+ ## 0.5.0 — 2026-11-23
12
+
13
+ > 0.5.0 hace legible el «marco» para quien llama y saca el cálculo de coordenadas de manos del modelo: tres acciones de solo lectura (`snapshot` como tabla numerada de elementos, `screenshot` que devuelve la tabla de correspondencia, `preview` que informa en texto el elemento bajo un punto), direccionamiento por `label` resuelto al elemento por su RuntimeId, `space:"image"` convertido por el motor, y un decimocuarto código de rechazo `stale_ref`. El invariante previsto «todo rect de elemento está contenido en screenRect» quedó refutado por la medición (desbordes de 3/18/287/2720px, y un rect es una coordenada absoluta de pantalla, independiente del marco): se sustituye por exclusión contada de elementos fuera de la captura, comprobación cruzada del marco con el rect que declara el árbol (frameCheck/frameInset) y una puerta estructural de fuente única. Puertas 17→19, dos suites con oráculo independiente. Detalle en la entrada inglesa.Dos correcciones más: `uia_tree_empty` ya no se informa para ventanas que sí tienen una puerta pero la suprimieron con `elementName` (WinForms responde ahora `unreachable`), y la aserción de deriva del cursor que ponía la puerta en rojo de forma intermitente ahora excluye el movimiento del dueño mediante `GetLastInputInfo` (SKIP con age/ventana si hubo entrada; el read-back exacto del motor sigue siendo una aserción estricta).
14
+
11
15
  ## 0.4.1 — 2026-11-23
12
16
 
17
+ > Published 2026-11-23T11:07:25.234Z (registry `time` for 0.4.1, read from the packument, not from a commit date).
18
+
13
19
  > 0.4.1 es una publicación solo de documentación y puertas: sin cambios en tiempo de ejecución (`lib/`, `src/engine/` intactos byte a byte). Corrige el encabezado del README que seguía anunciando 0.2.0 y añade la sección sobre `types/index.d.ts`, que faltaba por completo. Tres puertas nuevas: la línea de versión comparada con `package.json`, la identidad byte a byte del cuerpo inglés en las nueve traducciones, y una prueba de consumidor que resuelve por nombre de paquete (la anterior solo usaba una ruta relativa, así que quitar la condición `types` dejaba todo en verde). Véase la entrada en inglés.
14
20
 
15
21
  ## 0.4.0 — 2026-11-23
package/CHANGELOG.fr.md CHANGED
@@ -8,8 +8,14 @@ Dates are the registry `time` values for each version, not git commit dates —
8
8
  when someone typed, a publish time records when a version became installable, and only the second
9
9
  one is a promise to anyone installing it.
10
10
 
11
+ ## 0.5.0 — 2026-11-23
12
+
13
+ > 0.5.0 rend le « cadre » lisible par l'appelant et retire le calcul des coordonnées des mains du modèle : trois actions en lecture seule (`snapshot` en table d'éléments numérotée, `screenshot` qui renvoie la table de correspondance, `preview` qui rapporte en texte l'élément sous un point), l'adressage par `label` résolu vers l'élément via son RuntimeId, `space:"image"` converti par le moteur, et un quatorzième code de refus `stale_ref`. L'invariant prévu « chaque rect d'élément est contenu dans screenRect » a été réfuté par la mesure (dépassements de 3/18/287/2720px, et un rect est une coordonnée écran absolue, indépendante du cadre) : remplacé par l'exclusion comptée des éléments hors capture, un contrôle croisé du cadre avec le rect que l'arbre déclare (frameCheck/frameInset), et un garde-fou structurel de source unique. Portes 17→19 ; deux suites d'oracle indépendantes ajoutées. Voir l'entrée anglaise pour le détail.Deux corrections supplémentaires : `uia_tree_empty` n'est plus rapporté pour une fenêtre qui a bien une porte mais dont la porte a été supprimée par `elementName` (WinForms répond désormais `unreachable`), et l'assertion de dérive du curseur qui rendait la porte rouge par intermittence exclut maintenant l'action du propriétaire via `GetLastInputInfo` (SKIP avec age/fenêtre si une saisie est arrivée ; le read-back exact du moteur reste une assertion stricte).
14
+
11
15
  ## 0.4.1 — 2026-11-23
12
16
 
17
+ > Published 2026-11-23T11:07:25.234Z (registry `time` for 0.4.1, read from the packument, not from a commit date).
18
+
13
19
  > 0.4.1 ne touche qu'à la documentation et aux garde-fous : aucun changement d'exécution (`lib/`, `src/engine/` inchangés à l'octet). Corrige l'en-tête du README qui annonçait encore 0.2.0 et ajoute la section `types/index.d.ts` qui manquait totalement. Trois garde-fous ajoutés : la ligne de version comparée à `package.json`, l'identité octet pour octet du corps anglais des neuf traductions, et un test consommateur qui résout par nom de paquet (l'ancien n'utilisait qu'un chemin relatif, si bien que supprimer la condition `types` laissait tout au vert). Voir l'entrée anglaise.
14
20
 
15
21
  ## 0.4.0 — 2026-11-23
package/CHANGELOG.it.md CHANGED
@@ -8,8 +8,14 @@ Dates are the registry `time` values for each version, not git commit dates —
8
8
  when someone typed, a publish time records when a version became installable, and only the second
9
9
  one is a promise to anyone installing it.
10
10
 
11
+ ## 0.5.0 — 2026-11-23
12
+
13
+ > 0.5.0 rende il «frame» leggibile dal chiamante e toglie il calcolo delle coordinate dalle mani del modello: tre azioni di sola lettura (`snapshot` come tabella numerata di elementi, `screenshot` che restituisce la mappatura, `preview` che riporta in testo l'elemento sotto un punto), indirizzamento `label` risolto sull'elemento tramite RuntimeId, `space:"image"` convertito dal motore, e un quattordicesimo codice di rifiuto `stale_ref`. L'invariante previsto «ogni rect di elemento è contenuto in screenRect» è stato smentito dalla misura (sconfinamenti di 3/18/287/2720px; un rect è una coordinata schermo assoluta, indipendente dal frame): sostituito dall'esclusione conteggiata degli elementi fuori cattura, da un controllo incrociato tra frame e rect dichiarato dall'albero (frameCheck/frameInset) e da un gate strutturale della fonte unica. Gate 17→19, due suite oracle indipendenti. Dettagli nella voce inglese.Due ulteriori correzioni: `uia_tree_empty` non viene più riportato per finestre che hanno una porta ma l'hanno soppressa con `elementName` (WinForms ora risponde `unreachable`), e l'asserzione di deriva del cursore che rendeva il gate rosso a intermittenza ora esclude il movimento del proprietario via `GetLastInputInfo` (SKIP con age/finestra se arriva un input; il read-back esatto del motore resta un'asserzione rigida).
14
+
11
15
  ## 0.4.1 — 2026-11-23
12
16
 
17
+ > Published 2026-11-23T11:07:25.234Z (registry `time` for 0.4.1, read from the packument, not from a commit date).
18
+
13
19
  > 0.4.1 è un rilascio di sola documentazione e gate, senza modifiche a runtime (`lib/`, `src/engine/` invariati byte per byte). Corregge l'intestazione del README che annunciava ancora 0.2.0 e aggiunge la sezione su `types/index.d.ts`, prima del tutto assente. Tre nuovi gate: la riga di versione confrontata con `package.json`, l'identità byte per byte del corpo inglese nelle nove traduzioni, e un test consumer che risolve per nome del pacchetto (il precedente usava solo un percorso relativo, quindi rimuovere la condizione `types` lasciava tutto verde). Vedi la voce inglese.
14
20
 
15
21
  ## 0.4.0 — 2026-11-23
package/CHANGELOG.ja.md CHANGED
@@ -8,8 +8,14 @@ Dates are the registry `time` values for each version, not git commit dates —
8
8
  when someone typed, a publish time records when a version became installable, and only the second
9
9
  one is a promise to anyone installing it.
10
10
 
11
+ ## 0.5.0 — 2026-11-23
12
+
13
+ > 0.5.0 は「フレーム」を呼び出し側が読めるものにし、座標計算をモデルの手から取り上げるリリース。読み取り専用の 3 アクション(`snapshot` の番号付き要素表、`screenshot` は対応表ごと返す、`preview` は点の下の要素をテキストで報告)、`label` を RuntimeId で要素に戻す仕組み、`space:"image"` のエンジン側換算、14 番目の拒否コード `stale_ref` を追加。計画にあった「要素 rect は screenRect に含まれる」不変条件は実測で否定された(3/18/287/2720px のはみ出し、かつ rect は絶対スクリーン座標でフレーム非依存)ため、はみ出し要素の除外+計数、フレームとツリー自己申告矩形の相互検査、単一フレーム源の構造ゲートに置き換えた。ゲートは 17→19。詳細は英語の正式項目を参照。さらに 2 件修正:`uia_tree_empty` が「本来ドアがあるのに elementName で抑制されただけ」の窓に誤って出なくなり(WinForms は `unreachable` を返す)、ゲートを稀に赤くしていたカーソル移動量の判定は `GetLastInputInfo` で操作者の入力を除外(入力があれば age/window を添えて SKIP、エンジン自身の read-back は厳格なまま)した。
14
+
11
15
  ## 0.4.1 — 2026-11-23
12
16
 
17
+ > Published 2026-11-23T11:07:25.234Z (registry `time` for 0.4.1, read from the packument, not from a commit date).
18
+
13
19
  > 0.4.1 はドキュメントとゲートのみのリリースで、ランタイム変更はありません(`lib/`、`src/engine/` はバイト単位で未変更)。README 冒頭が 0.2.0 を名乗り続けていた件を修正し、一切言及のなかった `types/index.d.ts` の節を追加。さらに三道のゲートを追加:リリース行と `package.json` の版の照合、9 言語の英本文のバイト一致、パッケージ名で解決する消費者テスト(従来は相対パスのみで、`types` 条件を削っても全緑だった)。詳細は英語版参照。
14
20
 
15
21
  ## 0.4.0 — 2026-11-23
package/CHANGELOG.ko.md CHANGED
@@ -8,8 +8,14 @@ Dates are the registry `time` values for each version, not git commit dates —
8
8
  when someone typed, a publish time records when a version became installable, and only the second
9
9
  one is a promise to anyone installing it.
10
10
 
11
+ ## 0.5.0 — 2026-11-23
12
+
13
+ > 0.5.0은 「프레임」을 호출자가 읽을 수 있게 만들고 좌표 계산을 모델의 손에서 떼어낸 릴리스입니다. 읽기 전용 액션 3종(`snapshot` 번호 요소표, `screenshot`은 매핑까지 반환, `preview`는 지점 아래 요소를 텍스트로 보고), `label`을 RuntimeId로 요소에 되돌리는 방식, `space:"image"`의 엔진 환산, 14번째 거부 코드 `stale_ref`를 추가했습니다. 계획의 「모든 요소 rect는 screenRect 안에 있어야 한다」 불변식은 실측으로 반박되었습니다(3/18/287/2720px 초과, rect는 절대 화면 좌표라 프레임과 무관). 대신 초과 요소 제외·계수, 프레임과 트리 자기신고 사각형의 상호 검사, 단일 프레임 소스 구조 게이트로 바꿨습니다. 게이트 17→19. 자세한 내용은 영어 정본 항목 참조.두 가지 추가 수정: `uia_tree_empty`가 「원래 문이 있는데 elementName 때문에 억제된」 창에 더 이상 잘못 나오지 않고(WinForms는 `unreachable`), 게이트를 간헐적으로 붉히던 커서 이동량 판정은 `GetLastInputInfo`로 사용자의 입력을 제외(입력이 있으면 age/window를 출력하고 SKIP, 엔진 자체 read-back은 여전히 엄격)했다.
14
+
11
15
  ## 0.4.1 — 2026-11-23
12
16
 
17
+ > Published 2026-11-23T11:07:25.234Z (registry `time` for 0.4.1, read from the packument, not from a commit date).
18
+
13
19
  > 0.4.1은 문서와 게이트만의 릴리스이며 런타임 변경은 없습니다(`lib/`, `src/engine/` 바이트 단위 그대로). README 첫머리가 계속 0.2.0을 선언하던 문제를 고치고, 언급조차 없던 `types/index.d.ts` 절을 추가했습니다. 게이트 세 개 추가: 릴리스 줄과 `package.json` 버전 대조, 9개 언어 영문 본문 바이트 일치, 패키지 이름으로 해석하는 소비자 테스트(기존에는 상대 경로만 써서 `types` 조건을 지워도 전부 초록이었습니다). 자세한 내용은 영문 항목 참조.
14
20
 
15
21
  ## 0.4.0 — 2026-11-23
package/CHANGELOG.md CHANGED
@@ -5,8 +5,131 @@ Dates are the registry `time` values for each version, not git commit dates —
5
5
  when someone typed, a publish time records when a version became installable, and only the second
6
6
  one is a promise to anyone installing it.
7
7
 
8
+ ## 0.5.0 — 2026-11-23
9
+
10
+ > Working date (2026-11-23), not a registry time: at the time this file was written `package.json`
11
+ > was already 0.5.0 and the tarball was built, but publishing needs the owner's sign-off. The
12
+ > registry `time` for 0.5.0 replaces this line when it ships.
13
+
14
+ **The frame becomes something the caller can read, and the coordinate arithmetic leaves the model.**
15
+ Three read actions, one new refusal code, and one planned invariant that measurement destroyed — kept
16
+ in this entry rather than quietly dropped.
17
+
18
+ ### Added — the read paths
19
+
20
+ - **`snapshot`**: one `FindAll(Descendants)` + `IsOffscreen` pass, numbered from 1, each row carrying
21
+ control type, name, automation id, screen rect and the UIA patterns it exposes. Measured: 816
22
+ descendants / 71 visible / 291 ms on an Electron window; 626 / 173 / 45 excluded on a browser page.
23
+ `0 element(s)` is reported as a real state and deliberately does **not** reuse `uia_tree_empty`
24
+ (that code means the application has accessibility switched off, and its next step is a relaunch).
25
+ - **`label` addressing**: `click`/`type`/`focus` accept `label` + `snapId`. The label is resolved back
26
+ to the UIA **element** by runtime id (measured stable across queries, 71/71), so a labelled action
27
+ keeps the silent pattern path instead of degrading into a coordinate click. A labelled `click` still
28
+ requires its point, and the point must fall inside the labelled element.
29
+ - **`screenshot`**: `CopyFromScreen` over the DWM frame, PNG to `%LOCALAPPDATA%\wpm\shots\` (newest
30
+ `shotsKeep` kept, older files deleted), and the mapping returned as DATA — `screenRect`,
31
+ `imageSize`, `scale`, `identity`, `frame`, `dpiAware`. The image itself is not inline: a plugin
32
+ cannot mint an image block without the host's attachment service (measured), so the caller reads
33
+ the file.
34
+ - **`space:"image"`**: `click` accepts image pixels plus a `shotId` and the ENGINE converts them
35
+ (`screen = rect.left + round(imageX / scale)`), then runs the unchanged point-ownership assertion,
36
+ proof window and `effect=` reporting. A shotId that was never issued, or already pruned, is
37
+ `stale_ref` — never reinterpreted as screen pixels.
38
+ - **`preview`**: draws the marker at a point and reports, as TEXT, the element the OS says is under
39
+ it (name / control type / automation id / rect). A preview writes no input-queue entry, takes no
40
+ focus, produces no proof window, and answers with text so confirming a point never depends on a
41
+ picture.
42
+ - **`stale_ref`**, the fourteenth refusal code: a reference to a previous generation of engine output
43
+ (a pruned shotId, a superseded snapId, or `space:"image"` with no shotId, which is refused before
44
+ any worker request). `needs_facts` was not reused: mixing the two would make `check-refusals`'
45
+ case binding a lie.
46
+ - Three settings: `snapshotMaxElements` (300), `screenshotMaxWidth` (0 = unscaled), `shotsKeep` (10).
47
+
48
+ ### Corrected — the invariant measurement refuted
49
+
50
+ The plan proposed a runtime self-check: *every reported element rect must be contained in
51
+ `screenRect`*. Measured on eight live windows, it is false for ordinary trees: Chromium/Electron
52
+ report virtualized content far outside the viewport (overhangs of 3px, 18px, 287px and **2720px**),
53
+ so the rule would refuse whole classes of windows. The deeper reason it cannot work: element rects are
54
+ absolute screen pixels; they do not depend on the frame at all, and `GetWindowRect` is *larger* than
55
+ the DWM frame, so a wrong frame is still "containing" everything.
56
+
57
+ What replaced it, with each part tested for non-vacuity:
58
+
59
+ - elements that do not overlap the capture are **excluded and counted** (`outsideFrame=N`) — a number
60
+ you cannot point at would be a trap;
61
+ - the frame is cross-checked against the window rect the accessibility tree itself reports
62
+ (`frameCheck=pass|fail|unknown`, tolerance 2px; measured insets are exactly `0,0,0,0` for borderless
63
+ windows and `8,8,8,8` for shadowed ones), and `frameInset` prints those numbers as data;
64
+ - `scripts/check-frame-single-source.mjs` pins the property that *can* be enforced: exactly one
65
+ function decides the capture rectangle, both consumers use it, only one `CopyFromScreen` site
66
+ exists, and the snapshot's self-check is wired to a refusal.
67
+
68
+ ### Added — gates and suites
69
+
70
+ - `scripts/check-shots.mjs`: retention cannot overflow, and a file named `.png` must actually be a
71
+ PNG (magic + IHDR + non-zero dimensions). Validates the real shots directory and plants its own
72
+ defects under `--self-test`.
73
+ - `scripts/check-frame-single-source.mjs`: the single-source property above, with four mutations
74
+ proven red under `--self-test`.
75
+ - Full gate count 17 → **19** (the plan said 18; refuting the runtime invariant made a second
76
+ structural gate necessary, because a structural claim with no gate rots).
77
+ - `test/geometry-truth.mjs` (45 assertions) and `test/snapshot-test.mjs` (26 assertions), both driven
78
+ by an app-side oracle plus `test/geometry-oracle.ps1`, an independent DWM/PNG measurement that
79
+ shares no code with `src/engine`.
80
+
81
+ ### Fixed
82
+
83
+ - **`uia_tree_empty` was being reported for windows that plainly have a door.** The diagnosis ran
84
+ whenever the UIA probe found no pattern, including the case where it found no pattern *because the
85
+ caller named an element*: naming one suppresses a WinForms message door (a window message cannot
86
+ address "the control called X"), the scan then finds nothing drivable, and the engine answered
87
+ `uia_tree_empty` — "the application has accessibility switched off; relaunch it with
88
+ `--force-renderer-accessibility`". That advice is wrong about the cause and does not apply to
89
+ WinForms at all: we had measured a real door on that window and shut it ourselves. The diagnosis now
90
+ requires the target to have **no door at all**; a target with a door gets `unreachable` ("nothing
91
+ addressable at that name"), whose next step exists. Non-vacuity was checked in both directions: the
92
+ genuine accessibility-off sample (uTools) still answers `uia_tree_empty` from a click, and the
93
+ WinForms positive control now answers `unreachable`.
94
+ - `test/refusals-test.ps1` could not run three documented decision cases: its facts map never learned
95
+ R3's `takeoverRequested` / `keyInjectRequested` / `keyInjectAllowed` / `hudReady` /
96
+ `foregroundIsTarget`, so they threw `unknown facts field` instead of exercising the code. Found by
97
+ running the suite at HEAD, where it was already red.
98
+ - **The cursor-drift assertions were flake generators, and one of them was hiding in the gate.**
99
+ "Is the pointer back" is graded from two external reads, and the pointer is shared with the owner.
100
+ Measured with a human at the desk: the same assertion produced drift of 11 px, then 213, then 649,
101
+ while re-running with nobody touching the mouse passed every time — the instrument was reading
102
+ somebody else's motion. `signal-test` and `takeover-test` now grade that assertion only when
103
+ `GetLastInputInfo` shows no physical input inside the measured window, and SKIP with the age and the
104
+ window printed otherwise (the same discipline `overlay-test` already used for its desktop-sensitive
105
+ arms). Both halves were verified: with input present it SKIPs and says why; after a 7-second lull it
106
+ PASSes and actually grades. The interference-free half — the engine's own `cursorAfterX/Y` read-back
107
+ must equal `cursorBeforeX/Y` exactly — stays a hard assertion in both suites.
108
+ - `Invoke-WpmAction` no longer makes `-Hwnd` mandatory: PowerShell refuses to bind an empty string to
109
+ a mandatory `[string]`, which turned a legitimate full-screen capture into a binding error. Every
110
+ windowed action still checks liveness and answers `no_hwnd`.
111
+
112
+ ### Notes
113
+
114
+ - Non-vacuity was proven by injection, not asserted: the rect comparison rejects the `GetWindowRect`
115
+ rect and a +10px shift; a generated all-white PNG reads blank; the frame predicate says yes to the
116
+ measured pair and no to a frame that pokes outside it; every structural mutation turns its gate red.
117
+ - Two things this release did **not** fix, stated rather than hidden:
118
+ - This host's `UIAutomationClient` has no `LegacyIAccessiblePattern` type at all (measured:
119
+ `Unable to find type`), so any target that exposes only the MSAA bridge — WinForms among them —
120
+ can never yield a pattern here. The engine already treats a missing pattern type as one missing
121
+ type rather than a dead engine, and the WinForms cases now answer honestly, but the *capability*
122
+ is absent on this machine and the docs do not claim otherwise.
123
+ - `maxElements` truncates in **tree order**, not by relevance. On an Explorer window the first 40
124
+ elements are the status bar, so "the control is not in the frame" can mean merely "the cap was
125
+ low". The next step is printed with the frame (raise `maxElements`, or set
126
+ `interactableOnly:false`); no relevance ranking was invented, because "why is this row ranked
127
+ higher" is a question the tool could not answer with a fact.
128
+
8
129
  ## 0.4.1 — 2026-11-23
9
130
 
131
+ > Published 2026-11-23T11:07:25.234Z (registry `time` for 0.4.1, read from the packument, not from a commit date).
132
+
10
133
  **A documentation release that exists because the front page was wrong.** No runtime change: `lib/`
11
134
  and `src/engine/` are untouched, byte for byte, and the tarball's JavaScript is identical to 0.4.0's.
12
135
 
package/CHANGELOG.pt.md CHANGED
@@ -8,8 +8,14 @@ Dates are the registry `time` values for each version, not git commit dates —
8
8
  when someone typed, a publish time records when a version became installable, and only the second
9
9
  one is a promise to anyone installing it.
10
10
 
11
+ ## 0.5.0 — 2026-11-23
12
+
13
+ > O 0.5.0 torna o «quadro» legível por quem chama e retira a aritmética de coordenadas das mãos do modelo: três ações só de leitura (`snapshot` como tabela numerada de elementos, `screenshot` que devolve o mapeamento, `preview` que reporta em texto o elemento sob um ponto), endereçamento por `label` resolvido ao elemento pelo RuntimeId, `space:"image"` convertido pelo motor, e um décimo quarto código de recusa `stale_ref`. O invariante planeado «cada rect de elemento está contido em screenRect» foi refutado pela medição (excessos de 3/18/287/2720px, e um rect é coordenada absoluta de ecrã, independente do quadro): substituído por exclusão contada de elementos fora da captura, verificação cruzada do quadro com o rect declarado pela árvore (frameCheck/frameInset) e um portão estrutural de fonte única. Portões 17→19, duas suites com oráculo independente. Detalhe na entrada inglesa.Mais duas correções: `uia_tree_empty` já não é reportado para janelas que têm porta mas a suprimiram com `elementName` (o WinForms responde agora `unreachable`), e a asserção de deriva do cursor que deixava o portão vermelho de forma intermitente passou a excluir o movimento do dono via `GetLastInputInfo` (SKIP com age/janela quando há entrada; o read-back exato do motor continua a ser uma asserção estrita).
14
+
11
15
  ## 0.4.1 — 2026-11-23
12
16
 
17
+ > Published 2026-11-23T11:07:25.234Z (registry `time` for 0.4.1, read from the packument, not from a commit date).
18
+
13
19
  > 0.4.1 é uma versão apenas de documentação e portões: sem mudanças em tempo de execução (`lib/`, `src/engine/` intactos byte a byte). Corrige o cabeçalho do README que ainda anunciava 0.2.0 e adiciona a secção sobre `types/index.d.ts`, que faltava por completo. Três portões novos: a linha de versão comparada com `package.json`, a identidade byte a byte do corpo inglês nas nove traduções, e um teste de consumidor que resolve pelo nome do pacote (o anterior usava apenas caminho relativo, pelo que remover a condição `types` deixava tudo verde). Veja a entrada em inglês.
14
20
 
15
21
  ## 0.4.0 — 2026-11-23
package/CHANGELOG.ru.md CHANGED
@@ -8,8 +8,14 @@ Dates are the registry `time` values for each version, not git commit dates —
8
8
  when someone typed, a publish time records when a version became installable, and only the second
9
9
  one is a promise to anyone installing it.
10
10
 
11
+ ## 0.5.0 — 2026-11-23
12
+
13
+ > 0.5.0 делает «рамку» читаемой для вызывающей стороны и убирает расчёт координат из рук модели: три действия только на чтение (`snapshot` как нумерованная таблица элементов, `screenshot` возвращает соответствие координат, `preview` текстом сообщает элемент под точкой), адресация по `label` с возвратом к элементу по RuntimeId, `space:"image"` преобразуется движком, и четырнадцатый код отказа `stale_ref`. Запланированный инвариант «каждый rect элемента лежит внутри screenRect» опровергнут измерением (выходы за границы 3/18/287/2720px; rect — абсолютная экранная координата и от рамки не зависит): заменён на подсчитанное исключение непересекающихся элементов, взаимную проверку рамки с rect, который сообщает само дерево (frameCheck/frameInset), и структурный гейт единственного источника рамки. Гейтов 17→19, добавлены две независимые oracle-серии. Подробности в английской записи.Ещё две правки: `uia_tree_empty` больше не выдаётся для окон, у которых есть дверь, но она подавлена через `elementName` (WinForms теперь честно отвечает `unreachable`), а утверждение о дрейфе курсора, из-за которого гейт изредка краснел, теперь исключает движение владельца через `GetLastInputInfo` (SKIP с age/окном при наличии ввода; точный read-back двигателя остаётся строгим утверждением).
14
+
11
15
  ## 0.4.1 — 2026-11-23
12
16
 
17
+ > Published 2026-11-23T11:07:25.234Z (registry `time` for 0.4.1, read from the packument, not from a commit date).
18
+
13
19
  > 0.4.1 — выпуск только документации и проверок, без изменений в рантайме (`lib/`, `src/engine/` побайтно не изменены). Исправлен заголовок README, который продолжал объявлять 0.2.0, и добавлен полностью отсутствовавший раздел о `types/index.d.ts`. Три новые проверки: строка версии сверяется с `package.json`, побайтное совпадение английского текста в девяти переводах, и потребительский тест, разрешающий пакет по имени (прежний использовал только относительный путь, поэтому удаление условия `types` оставляло всё зелёным). Подробнее — в английской записи.
14
20
 
15
21
  ## 0.4.0 — 2026-11-23
package/CHANGELOG.zh.md CHANGED
@@ -8,8 +8,14 @@ Dates are the registry `time` values for each version, not git commit dates —
8
8
  when someone typed, a publish time records when a version became installable, and only the second
9
9
  one is a promise to anyone installing it.
10
10
 
11
+ ## 0.5.0 — 2026-11-23
12
+
13
+ > 0.5.0 把「帧」变成调用方可读的东西,并把坐标换算从模型手里拿走:新增三个只读动作(`snapshot` 编号元素表、`screenshot` 连映射一起返回、`preview` 用文本报出点位下的元素)、`label` 按 RuntimeId 回指元素、`space:"image"` 由引擎换算,以及第 14 个拒绝码 `stale_ref`。计划中的「元素 rect 必须被 screenRect 包含」被实测推翻(真实窗口出现 3/18/287/2720px 的越界,且 rect 本就是绝对屏幕坐标、与帧无关),改为:越界元素排除并计数、帧与树自报窗口矩形互校(frameCheck/frameInset)、以及「唯一的帧源」结构门禁。全量门禁 17→19,新增 geometry-truth 与 snapshot-test 两套独立 oracle 验收。详情见英文权威条目。另修两处:`uia_tree_empty` 不再对「本来有门、只是被 elementName 抑制」的窗口误报(WinForms 现在诚实回 `unreachable`),以及卡住门禁的偶发红——光标漂移断言改用 `GetLastInputInfo` 排除主人自己动鼠标(有输入则 SKIP 并打印 age/window),引擎自报的精确 read-back 仍是硬断言。
14
+
11
15
  ## 0.4.1 — 2026-11-23
12
16
 
17
+ > Published 2026-11-23T11:07:25.234Z (registry `time` for 0.4.1, read from the packument, not from a commit date).
18
+
13
19
  > 0.4.1 是文档与门禁发布,运行时零改动(`lib/`、`src/engine/` 逐字节未动)。修掉 README 顶部仍宣告 0.2.0 的欠账、补上从未提及的 `types/index.d.ts` 章节,并新增三道门禁:发布行与 `package.json` 版本比对、九份译文的英文正文逐字节一致、以及按包名解析的消费者测试(此前门禁只按相对路径 import,删掉 `exports[""].types` 也能全绿)。详情见英文权威条目。
14
20
 
15
21
  ## 0.4.0 — 2026-11-23
package/README.de.md CHANGED
@@ -5,7 +5,7 @@
5
5
  > Ein DSH-Plugin, mit dem ein Agent **seine eigenen** Windows-Fenster steuert — standardmäßig still, auf Anfrage sichtbar. Wenn ein Fenster Windows-Nachrichten akzeptiert, wird der Fokus nie entzogen. Wenn nur UI Automation es erreicht, gibt es einen einzigen begrenzten Fokus-Blitz, der automatisch rückgängig gemacht wird. Wenn Sie den Takeover-Modus ausdrücklich anfordern, bewegt sich der Cursor zum Aktionspunkt und wird immer wiederhergestellt; ein HUD bietet drei Möglichkeiten zum Abbruch. Überall anders wird mit Code und Grund abgelehnt.
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.4.1** — this document describes the contract as of that version. What
8
+ > **Current release: 0.5.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,7 @@ 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 thirteen and the next step.
16
+ silence: every refusal carries a code from a closed set of fourteen and the next step.
17
17
 
18
18
  **The takeover tier defaults off, and that is structural.** The cursor is only ever moved because you
19
19
  opened `takeoverAllowed` **and** asked for it on the call (`takeover:true`), so an upgrade cannot
@@ -31,15 +31,18 @@ bundle with a broad tool surface; this one is a single action tool whose entire
31
31
 
32
32
  ## What it does
33
33
 
34
- One tool, five actions:
34
+ One tool, eight actions:
35
35
 
36
36
  | action | what it returns |
37
37
  |---|---|
38
38
  | `windows` | live windows that can be driven: hwnd, title, class, pid, rect |
39
39
  | `status` | what currently holds the foreground and the keyboard focus, and whether the engine is paused |
40
- | `click` | click at a screen coordinate inside the named window |
41
- | `type` | write text into the target (a classic edit child, or a named UIA element) |
42
- | `focus` | move keyboard focus to a named control inside the target |
40
+ | `click` | click at a screen coordinate inside the named window, or at a snapshot `label` |
41
+ | `type` | write text into the target (a classic edit child, a named UIA element, or a `label`) |
42
+ | `focus` | move keyboard focus to a named control inside the target, or to a `label` |
43
+ | `snapshot` | the accessibility tree as a NUMBERED element table: continuous `label`, control type, name, automation id, screen rect, patterns |
44
+ | `screenshot` | the window rect captured to a PNG, plus the coordinate mapping as data (`screenRect`, `imageSize`, `scale`, `identity`, `frame`, `dpiAware`) |
45
+ | `preview` | the marker drawn at a point, and the element under it reported as TEXT — no picture needed |
43
46
 
44
47
  The engine picks the cheapest available door per call:
45
48
 
@@ -72,8 +75,69 @@ flag itself is engine-side and refuses actions with `paused`.
72
75
 
73
76
  Refusals are a normal result, not an error: `no_hwnd`, `paused`, `elevated_target`, `unreachable`,
74
77
  `uia_tree_empty`, `uia_probe_failed`, `terminal_no_door`, `needs_facts`, `takeover_unavailable`,
75
- `keyinject_unavailable`, `action_failed`, `restore_failed`, `takeover_aborted`. Each carries a reason
76
- and a next step — see [docs/refusals.md](docs/refusals.md).
78
+ `keyinject_unavailable`, `action_failed`, `restore_failed`, `takeover_aborted`, `stale_ref`. Each
79
+ carries a reason and a next step — see [docs/refusals.md](docs/refusals.md).
80
+
81
+ ## Reading the frame instead of guessing
82
+
83
+ The three read actions exist so the two halves of a click — *where the thing is* and *where the
84
+ picture is* — stop being the caller's arithmetic.
85
+
86
+ `label` is not a coordinate in disguise. It is resolved back to the UIA **element** by its runtime id
87
+ (measured stable across queries, 71 of 71), so `click`/`type`/`focus` with `label` + `snapId` still
88
+ take the silent pattern path. A labelled `click` keeps `x`/`y` required, and the point must fall
89
+ inside the labelled element's rect — the point stays the contract. A label whose `snapId` was
90
+ superseded is refused with `stale_ref`: element numbers only mean something in the frame that printed
91
+ them.
92
+
93
+ Image coordinates are never multiplied by the caller:
94
+
95
+ ```jsonc
96
+ {"action":"screenshot","hwnd":"1310720"}
97
+ // -> screenRect=0,0,1920,1032 imageSize=1920x1032 scale=1 identity=true frame=dwm
98
+ {"action":"click","hwnd":"1310720","space":"image","shotId":"shot-…","x":350,"y":250}
99
+ // the ENGINE converts, then still asserts the point belongs to the target window
100
+ ```
101
+
102
+ The picture is not returned inline — a plugin cannot mint an inline image block without the host's
103
+ attachment service — so the PNG is written to `%LOCALAPPDATA%\wpm\shots\` (newest `shotsKeep` kept)
104
+ and read with the host's image reader. `preview` is the cheaper confirmation: it draws the marker at
105
+ the point and answers, as text, which element the OS says is there. Confirming a point therefore
106
+ never depends on looking at a picture, and a preview writes no input-queue entry, takes no focus and
107
+ produces no proof window.
108
+
109
+ ### The frame rule, and why 8px mattered
110
+
111
+ One rectangle decides everything: `DwmGetWindowAttribute(EXTENDED_FRAME_BOUNDS)`. Measured here,
112
+ `GetWindowRect` is **8px larger on every edge** — the invisible resize shadow — and the accessibility
113
+ tree mixes the two spaces: its root element reports the shadow-inclusive rect while its children
114
+ report the real one, so arithmetic that mixes them is 8px wrong and *looks right*. Labels and the
115
+ captured picture therefore come from the same function. When DWM is unavailable (RDP, Basic theme)
116
+ the fallback to `GetWindowRect` is **reported** as `frame=win32` rather than swallowed, and
117
+ `frameInset` prints the shadow width as data.
118
+
119
+ The plan for this release proposed a runtime invariant — "every element rect is inside `screenRect`" —
120
+ and measurement refuted it: real Chromium/Electron trees report virtualized content far outside the
121
+ viewport (overhangs of 3px, 18px, 287px and 2720px measured here). What replaced it: elements that do
122
+ not overlap the capture are **excluded and counted** (`outsideFrame=…`, because a number you cannot
123
+ point at would be a trap), the frame is cross-checked against the window rect the tree itself reports
124
+ (`frameCheck=pass|fail|unknown`), and a structural gate pins the single-source rule by mutating a copy
125
+ of the engine and requiring the corresponding red.
126
+
127
+ ### Deciding outside the main context
128
+
129
+ The expensive habit this replaces is re-reading a 70-row table on every step. Hand the frame to a
130
+ clean deciding side and take back one number:
131
+
132
+ 1. `snapshot` with `intent:"close the settings dialog"` — the intent travels with the frame, and is
133
+ written to `%LOCALAPPDATA%\wpm\last-snapshot.json`;
134
+ 2. give the numbered table and the intent to a clean subagent;
135
+ 3. it answers with a single `label` — not a selector, not a coordinate;
136
+ 4. click with that `label` + `snapId`.
137
+
138
+ `sinceSnapId` serves the same goal: an unchanged tree answers `no changes since <id>` instead of
139
+ repeating itself, and a delta names only what actually moved (`added` / `removed` / `changed`, keyed
140
+ by runtime id).
77
141
 
78
142
  **Every real click carries its own disturbance proof.** `click` returns a `proof=pass|inconclusive|…`
79
143
  verdict plus a `proofDimensions` field (cursor / foreground / focus). Around your call the engine
@@ -189,8 +253,8 @@ degradation.
189
253
  ## Typed surface
190
254
 
191
255
  `types/index.d.ts` is written by hand, not emitted from an implementation. It covers the whole
192
- contract: the five actions, every argument including the takeover fields, and all thirteen refusal
193
- codes as a closed union.
256
+ contract: the eight actions, every argument including the takeover fields and the image-space /
257
+ label surface, and all fourteen refusal codes as a closed union.
194
258
 
195
259
  Its wiring is measured in both resolution modes a consumer can use, rather than assumed from the
196
260
  presence of a file:
@@ -222,6 +286,9 @@ when one is present, and the gate reports a named SKIP rather than a red when on
222
286
  | `keyInjectAllowed` | `false` | allow `keyInput:"inject"` inside the takeover tier (keyboard only, foreground asserted) |
223
287
  | `takeoverMaxMs` | `10000` | hard ceiling for one takeover action (500–60000); the HUD shows the clock |
224
288
  | `takeoverArmMs` | `800` | length of the arming phase: the window in which you can cancel before anything moves |
289
+ | `snapshotMaxElements` | `300` | cap on elements per snapshot (1–5000); a tighter cap is a smaller frame for a deciding subagent |
290
+ | `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 |
291
+ | `shotsKeep` | `10` | how many PNGs stay in `%LOCALAPPDATA%\wpm\shots`; older files are deleted after each capture |
225
292
 
226
293
  ## What measurement established
227
294
 
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.4.1** — this document describes the contract as of that version. What
8
+ > **Current release: 0.5.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,7 @@ 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 thirteen and the next step.
16
+ silence: every refusal carries a code from a closed set of fourteen and the next step.
17
17
 
18
18
  **The takeover tier defaults off, and that is structural.** The cursor is only ever moved because you
19
19
  opened `takeoverAllowed` **and** asked for it on the call (`takeover:true`), so an upgrade cannot
@@ -31,15 +31,18 @@ bundle with a broad tool surface; this one is a single action tool whose entire
31
31
 
32
32
  ## What it does
33
33
 
34
- One tool, five actions:
34
+ One tool, eight actions:
35
35
 
36
36
  | action | what it returns |
37
37
  |---|---|
38
38
  | `windows` | live windows that can be driven: hwnd, title, class, pid, rect |
39
39
  | `status` | what currently holds the foreground and the keyboard focus, and whether the engine is paused |
40
- | `click` | click at a screen coordinate inside the named window |
41
- | `type` | write text into the target (a classic edit child, or a named UIA element) |
42
- | `focus` | move keyboard focus to a named control inside the target |
40
+ | `click` | click at a screen coordinate inside the named window, or at a snapshot `label` |
41
+ | `type` | write text into the target (a classic edit child, a named UIA element, or a `label`) |
42
+ | `focus` | move keyboard focus to a named control inside the target, or to a `label` |
43
+ | `snapshot` | the accessibility tree as a NUMBERED element table: continuous `label`, control type, name, automation id, screen rect, patterns |
44
+ | `screenshot` | the window rect captured to a PNG, plus the coordinate mapping as data (`screenRect`, `imageSize`, `scale`, `identity`, `frame`, `dpiAware`) |
45
+ | `preview` | the marker drawn at a point, and the element under it reported as TEXT — no picture needed |
43
46
 
44
47
  The engine picks the cheapest available door per call:
45
48
 
@@ -72,8 +75,69 @@ flag itself is engine-side and refuses actions with `paused`.
72
75
 
73
76
  Refusals are a normal result, not an error: `no_hwnd`, `paused`, `elevated_target`, `unreachable`,
74
77
  `uia_tree_empty`, `uia_probe_failed`, `terminal_no_door`, `needs_facts`, `takeover_unavailable`,
75
- `keyinject_unavailable`, `action_failed`, `restore_failed`, `takeover_aborted`. Each carries a reason
76
- and a next step — see [docs/refusals.md](docs/refusals.md).
78
+ `keyinject_unavailable`, `action_failed`, `restore_failed`, `takeover_aborted`, `stale_ref`. Each
79
+ carries a reason and a next step — see [docs/refusals.md](docs/refusals.md).
80
+
81
+ ## Reading the frame instead of guessing
82
+
83
+ The three read actions exist so the two halves of a click — *where the thing is* and *where the
84
+ picture is* — stop being the caller's arithmetic.
85
+
86
+ `label` is not a coordinate in disguise. It is resolved back to the UIA **element** by its runtime id
87
+ (measured stable across queries, 71 of 71), so `click`/`type`/`focus` with `label` + `snapId` still
88
+ take the silent pattern path. A labelled `click` keeps `x`/`y` required, and the point must fall
89
+ inside the labelled element's rect — the point stays the contract. A label whose `snapId` was
90
+ superseded is refused with `stale_ref`: element numbers only mean something in the frame that printed
91
+ them.
92
+
93
+ Image coordinates are never multiplied by the caller:
94
+
95
+ ```jsonc
96
+ {"action":"screenshot","hwnd":"1310720"}
97
+ // -> screenRect=0,0,1920,1032 imageSize=1920x1032 scale=1 identity=true frame=dwm
98
+ {"action":"click","hwnd":"1310720","space":"image","shotId":"shot-…","x":350,"y":250}
99
+ // the ENGINE converts, then still asserts the point belongs to the target window
100
+ ```
101
+
102
+ The picture is not returned inline — a plugin cannot mint an inline image block without the host's
103
+ attachment service — so the PNG is written to `%LOCALAPPDATA%\wpm\shots\` (newest `shotsKeep` kept)
104
+ and read with the host's image reader. `preview` is the cheaper confirmation: it draws the marker at
105
+ the point and answers, as text, which element the OS says is there. Confirming a point therefore
106
+ never depends on looking at a picture, and a preview writes no input-queue entry, takes no focus and
107
+ produces no proof window.
108
+
109
+ ### The frame rule, and why 8px mattered
110
+
111
+ One rectangle decides everything: `DwmGetWindowAttribute(EXTENDED_FRAME_BOUNDS)`. Measured here,
112
+ `GetWindowRect` is **8px larger on every edge** — the invisible resize shadow — and the accessibility
113
+ tree mixes the two spaces: its root element reports the shadow-inclusive rect while its children
114
+ report the real one, so arithmetic that mixes them is 8px wrong and *looks right*. Labels and the
115
+ captured picture therefore come from the same function. When DWM is unavailable (RDP, Basic theme)
116
+ the fallback to `GetWindowRect` is **reported** as `frame=win32` rather than swallowed, and
117
+ `frameInset` prints the shadow width as data.
118
+
119
+ The plan for this release proposed a runtime invariant — "every element rect is inside `screenRect`" —
120
+ and measurement refuted it: real Chromium/Electron trees report virtualized content far outside the
121
+ viewport (overhangs of 3px, 18px, 287px and 2720px measured here). What replaced it: elements that do
122
+ not overlap the capture are **excluded and counted** (`outsideFrame=…`, because a number you cannot
123
+ point at would be a trap), the frame is cross-checked against the window rect the tree itself reports
124
+ (`frameCheck=pass|fail|unknown`), and a structural gate pins the single-source rule by mutating a copy
125
+ of the engine and requiring the corresponding red.
126
+
127
+ ### Deciding outside the main context
128
+
129
+ The expensive habit this replaces is re-reading a 70-row table on every step. Hand the frame to a
130
+ clean deciding side and take back one number:
131
+
132
+ 1. `snapshot` with `intent:"close the settings dialog"` — the intent travels with the frame, and is
133
+ written to `%LOCALAPPDATA%\wpm\last-snapshot.json`;
134
+ 2. give the numbered table and the intent to a clean subagent;
135
+ 3. it answers with a single `label` — not a selector, not a coordinate;
136
+ 4. click with that `label` + `snapId`.
137
+
138
+ `sinceSnapId` serves the same goal: an unchanged tree answers `no changes since <id>` instead of
139
+ repeating itself, and a delta names only what actually moved (`added` / `removed` / `changed`, keyed
140
+ by runtime id).
77
141
 
78
142
  **Every real click carries its own disturbance proof.** `click` returns a `proof=pass|inconclusive|…`
79
143
  verdict plus a `proofDimensions` field (cursor / foreground / focus). Around your call the engine
@@ -189,8 +253,8 @@ degradation.
189
253
  ## Typed surface
190
254
 
191
255
  `types/index.d.ts` is written by hand, not emitted from an implementation. It covers the whole
192
- contract: the five actions, every argument including the takeover fields, and all thirteen refusal
193
- codes as a closed union.
256
+ contract: the eight actions, every argument including the takeover fields and the image-space /
257
+ label surface, and all fourteen refusal codes as a closed union.
194
258
 
195
259
  Its wiring is measured in both resolution modes a consumer can use, rather than assumed from the
196
260
  presence of a file:
@@ -222,6 +286,9 @@ when one is present, and the gate reports a named SKIP rather than a red when on
222
286
  | `keyInjectAllowed` | `false` | allow `keyInput:"inject"` inside the takeover tier (keyboard only, foreground asserted) |
223
287
  | `takeoverMaxMs` | `10000` | hard ceiling for one takeover action (500–60000); the HUD shows the clock |
224
288
  | `takeoverArmMs` | `800` | length of the arming phase: the window in which you can cancel before anything moves |
289
+ | `snapshotMaxElements` | `300` | cap on elements per snapshot (1–5000); a tighter cap is a smaller frame for a deciding subagent |
290
+ | `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 |
291
+ | `shotsKeep` | `10` | how many PNGs stay in `%LOCALAPPDATA%\wpm\shots`; older files are deleted after each capture |
225
292
 
226
293
  ## What measurement established
227
294