← Commit history

1.8.65: placement via AD set_window_bounds restore:false, CDP maximize banned (raises z-order and covered the user's work)

John Lauer ·a7fe95866e · ·parent d48cd1d
5 files changed +59−29
CHANGELOG.md+14
@@ -1,5 +1,19 @@ # Changelog — Adom Desktop Puppeteer Bridge +## 1.8.65 — 2026-07-15 — NEVER use CDP maximize: it RAISES the window (the covering-windows breach)++John caught five "backgrounded" windows stacked at z-1..3 directly under his editor — covering his+work. Root cause, latent since 1.8.55: CDP `Browser.setWindowBounds {windowState:'maximized'}` is+ShowWindow(SW_MAXIMIZE) in Chromium, which RAISES the window to the top of the z-order (no focus+steal, so every focus-based check passed while the windows sat on top). The earlier+"small-then-grow" sighting was the same raise making the staging visible.++- Placement is now AD `desktop_set_window_bounds {restore:false}` (MoveWindow only: no activation,+  NO z-order change) sized to the primary monitor from AD `desktop_list_monitors` (cached 10 min).+  The window ends visually full-screen, still at the z-bottom where force-bottom put it.+- The park threads the hwnd from the bottoming step into placement (no re-lookup in the common path).+- Dev-skill dead-end added: never use CDP windowState:'maximized' for background placement.+ ## 1.8.64 — 2026-07-15 — Background windows appear already-maximized (no more small-then-grow)  John: "why when you open a new window is it smaller than my screen and then i see it grow larger?"
adom-bridge-puppeteer-manifest.json+4−4
@@ -1,10 +1,10 @@ {   "manifest_version": 1,   "name": "puppeteer",-  "version": "1.8.64",-  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.8.64/adom-bridge-puppeteer-v1.8.64.zip",-  "sha256": "5af017f009cb7bd3a07cc56fb32e0f16fa179553678a7a18757c96096101dc60",-  "size": 172108,+  "version": "1.8.65",+  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.8.65/adom-bridge-puppeteer-v1.8.65.zip",+  "sha256": "b6f0a5ebd01f7d2d61aa268560f4303cb1c1b5e6f237bfbfee5c8b3e9f0d414a",+  "size": 172405,   "verbPrefixes": [     "browser_",     "desktop_recorder_",
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-1.8.64\ No newline at end of file+1.8.65\ No newline at end of file
src/bridge.json+1−1
@@ -2,7 +2,7 @@   "manifest_version": 1,   "name": "puppeteer",   "displayName": "Puppeteer (Chrome for Testing + Native)",-  "version": "1.8.64",+  "version": "1.8.65",   "description": "Drives a browser ALREADY on the machine \u2014 installed Chrome, else Microsoft Edge (every Windows PC ships with Edge) \u2014 launched with a FRESH isolated profile, so the common case has NO ~150 MB Chrome-for-Testing download and it never touches the user's real tabs/logins. Binds its local server to LOOPBACK (127.0.0.1) only, so no Windows Firewall 'allow Node through the firewall' prompt ever pops. Chrome for Testing is fetched only as a LAST RESORT if the machine has no Chromium browser at all. SPAWN-VERIFIED fallback: pup tries each detected browser (Chrome \u2192 Edge \u2192 CfT) and actually launches it, falling through to the next if one won't start (and handling browsers like Edge that relaunch onto another PID), so a corrupt/partial install never hard-fails an open. The browser that launches is cached as the default (persisted across restarts) so it isn't re-probed each time. On spawn the bridge SELF-WARMS: detects browsers + disk, and only if the box has no Chrome/Edge and no cached CfT does it background-fetch CfT so the first open is instant. browser_use pins a specific browser (chrome | edge | cft | auto); {browser:'chrome',install:true} downloads & installs REAL Google Chrome (user-scoped, no admin) on an Edge-only box. browser_readiness (READ-ONLY) reports which browser will be used + the full candidate list + the default + free disk. Every failure returns a specific errorCode + _hint (chrome_install_no_disk, chrome_download_network, chrome_install_permission, chrome_stable_not_detected, \u2026). Launches with FULL browser permissions by default for full debug (strictPermissions:true opts out). Headful automation: open/close windows+tabs, navigate, screenshot, eval JS, record. pup is a GENERIC, non-profile browser only \u2014 every session is a fresh isolated Chrome/Edge process, never the user's real signed-in browser; profile defaults to sessionId. To drive the user's REAL Chrome/Edge (their profile, cookies, SSO), use the Adom browser EXTENSION's nbrowser_* verbs \u2014 a separate bridge, not pup's job.",   "homepage": "https://wiki.adom.inc/adom/adom-desktop",   "author": "Adom Inc.",
src/server.js+39−23
@@ -1997,21 +1997,28 @@ async function parkSessionWindowDirect(page, sessionId) {   try {     cdp = await page.target().createCDPSession();     const { windowId } = await cdp.send('Browser.getWindowForTarget');-    // Full-size via the OS's own maximize (CDP windowState) — no pixel math, no screen-size-    // probe that can fail mid-navigation (a failed probe shipped 1600×900 windows once).-    // v1.8.64: stage the window JUST past the LEFT EDGE of the primary monitor before-    // maximizing — fully invisible but ADJACENT, so the OS targets the primary monitor.-    // Two rejected alternatives (both tested):-    //   - maximize from deep off-screen (-32000): garbage bounds (landed at -21333, 159×27);-    //   - stage ON-screen small then maximize: the window is only z-bottom, not hidden, so-    //     the user sees a small window appear and then GROW (John: "why isn't it just the-    //     size of my screen from the get-go?").-    // Neither call activates the window, so z-order is preserved — it first becomes visible-    // already maximized.-    const placeOnScreen = async () => {-      await cdp.send('Browser.setWindowBounds', { windowId, bounds: { windowState: 'normal' } });-      await cdp.send('Browser.setWindowBounds', { windowId, bounds: { left: -1310, top: 100, width: 1280, height: 800 } });-      await cdp.send('Browser.setWindowBounds', { windowId, bounds: { windowState: 'maximized' } });+    // v1.8.65: full-size placement via AD `desktop_set_window_bounds` (background drive,+    // physical px, restore:false → MoveWindow only: no activation, NO Z-ORDER CHANGE), sized+    // to the primary monitor from AD `desktop_list_monitors` (native, cached 10 min).+    // DO NOT use CDP `windowState:'maximized'` — Chromium implements it as ShowWindow(+    // SW_MAXIMIZE), which RAISES the window to the top of the z-order (no focus steal, but it+    // COVERS the user's work — John caught five windows stacked right under his editor, and+    // the "small-then-grow" he saw earlier was the same raise making the staging visible).+    // The window ends up in normal state sized to the monitor = visually full-screen, still+    // at the z-bottom where the force-bottom put it.+    const placeOnScreen = async (targetHwnd) => {+      let wa = _primaryMonitorCache && (Date.now() - _primaryMonitorCache.ts < 600000) ? _primaryMonitorCache : null;+      if (!wa) {+        try {+          const r = await chrome.adCommand('desktop_list_monitors', {}, { timeoutMs: 4000 });+          const raw = r && (typeof r.output === 'string' && r.output ? JSON.parse(r.output) : r.output || r);+          const mons = (raw && (raw.monitors || (raw.data && raw.data.monitors))) || [];+          const prim = mons.find(m => m.primary) || mons[0];+          if (prim && prim.width) { wa = { ts: Date.now(), x: prim.x || 0, y: prim.y || 0, w: prim.width, h: prim.height }; _primaryMonitorCache = wa; }+        } catch (e) {}+      }+      const b = wa || { x: 0, y: 0, w: 1600, h: 900 };+      await chrome.adCommand('desktop_set_window_bounds', { hwnd: targetHwnd, x: b.x, y: b.y, w: b.w, h: b.h, restore: false }, { timeoutMs: 5000 });     };     // hwnd via AD (native) — the title suffix "(session: <id>" is set by the welcome page.     // v1.8.59 HARD RULES, learned the expensive way:@@ -2044,13 +2051,13 @@ async function parkSessionWindowDirect(page, sessionId) {         const raw = r && (typeof r.output === 'string' ? r.output : JSON.stringify(r.output || ''));         const o = raw ? JSON.parse(raw) : {};         const data = o.data || o;-        return { ok: !!data.sentToBack, wasForeground: !!data.wasForeground, err: data.sentToBack ? null : 'not sent to back' };+        return { ok: !!data.sentToBack, wasForeground: !!data.wasForeground, hwnd: data.hwnd || null, err: data.sentToBack ? null : 'not sent to back' };       } catch (e) { return { ok: false, err: e.message }; }     };-    let bottomed = false, lastErr = 'error';+    let bottomed = false, lastErr = 'error', parkHwnd = null;     for (let attempt = 0; attempt < 8; attempt++) {       const z = await adBottom();-      if (z.ok) { bottomed = true; break; }+      if (z.ok) { bottomed = true; parkHwnd = z.hwnd; break; }       lastErr = z.err || 'error';       // Two cases need the legacy PS path (BOTH auto-obsolete as desktops update to AD ≥1.9.115,       // whose force:true is honored above — delete this block once the fleet is there):@@ -2065,7 +2072,7 @@ async function parkSessionWindowDirect(page, sessionId) {           const o = r && (typeof r.output === 'string' ? JSON.parse(r.output) : r.output || r);           hwnd = (o && ((o.best && o.best.hwnd) || o.hwnd)) || null;         } catch (e) {}-        if (hwnd && osBottomUnlessForeground(hwnd, true) === 'bottomed') { bottomed = true; break; }+        if (hwnd && osBottomUnlessForeground(hwnd, true) === 'bottomed') { bottomed = true; parkHwnd = hwnd; break; }       }       await new Promise(r2 => setTimeout(r2, 300));     }@@ -2073,15 +2080,23 @@ async function parkSessionWindowDirect(page, sessionId) {       console.log(`[park] "${sessionId}": z-bottom NOT confirmed (${lastErr}) — leaving off-screen (no pop), self-heal will retry`);       return 'park-failed';     }-    // On-screen full-size WITHOUT activation — CDP move preserves z-order (we're at bottom).-    await placeOnScreen();+    // On-screen full-size WITHOUT activation — AD MoveWindow preserves z-order (we're at bottom).+    if (!parkHwnd) {+      try {+        const r = await chrome.adCommand('desktop_find_window', { titleContains: `(session: ${sessionId}` }, { timeoutMs: 4000 });+        const o = r && (typeof r.output === 'string' ? JSON.parse(r.output) : r.output || r);+        parkHwnd = (o && ((o.best && o.best.hwnd) || o.hwnd)) || null;+      } catch (e) {}+    }+    if (!parkHwnd) { console.log(`[park] "${sessionId}": no hwnd for placement — leaving off-screen, self-heal will retry`); return 'park-failed'; }+    await placeOnScreen(parkHwnd);     // Verify POSITION, not just focus.     let verified = false;     try {       const gb = await cdp.send('Browser.getWindowBounds', { windowId });       const b = gb && gb.bounds;-      // v1.8.64: threshold -1000 (was -5000) so a window stuck at the -1310 edge-adjacent-      // staging spot (failed maximize) reads as NOT verified instead of passing.+      // v1.8.64: threshold -1000 (was -5000) so a stuck-off-screen window reads as NOT+      // verified instead of passing.       verified = !!(b && b.left > -1000 && b.top > -1000);     } catch (e) {}     return verified ? 'backgrounded' : 'park-failed';@@ -2251,6 +2266,7 @@ const MUTATING_VERBS = new Set(['browser_open_window', 'browser_open_tab', 'brow // Debounced auto-flash: one flash per window per ~5s burst of verbs, re-armed after // quiet. {silent:true} on the verb OR session._flashSilent (session default) suppresses. const _flashState = new Map(); // sessionId -> last flash ts+let _primaryMonitorCache = null; // v1.8.65: {ts,x,y,w,h} from desktop_list_monitors (10-min TTL) function scheduleAutoFlash(session, opts) {   opts = opts || {};   if (process.platform !== 'win32' || !session || !session._sessionId) return;