← Commit history

1.8.48: revert minimize (broke screenshots), on-screen z-bottom park with EnumWindows handle, deactivate-then-park, short re-park window so clicks are not fought

John Lauer ·f56330fe05 · ·parent 1e035eb
5 files changed +38−21
CHANGELOG.md+14
@@ -1,5 +1,19 @@ # Changelog — Adom Desktop Puppeteer Bridge +## 1.8.48 — 2026-07-14 — Background = on-screen z-bottom (minimize reverted: it broke screenshots)++1.8.47's minimize broke screenshots: a minimized window reports `visibilityState: hidden`, so+`Page.captureScreenshot` hangs (~27s then errors) even with occlusion disabled. Reverted to the+on-screen-occluded park (which keeps rendering → screenshots work), now correct on all the pieces:++- **Real window handle** via `EnumWindows` (1.8.46) — no more phantom-helper-window misses.+- **Deactivate-then-park order** (1.8.46) — hand focus back while off-screen, THEN move on-screen at+  z-bottom, so it never flashes on top (no pop).+- **Short re-park window** (~1.2s: 300/700/1200ms) — just long enough to counter Chrome's startup+  foreground-grab. After that pup NEVER re-parks, so a user click is not fought. Within the window,+  `GetLastInputInfo` distinguishes a real click (→ bring on-screen + latch off further passes) from+  Chrome self-raising (→ re-park).+ ## 1.8.47 — 2026-07-14 — Background = MINIMIZE (no more re-park loop fighting the user's clicks)  The on-screen-z-bottom park needed a re-park retry loop to counter Chrome's startup foreground-grab,
adom-bridge-puppeteer-manifest.json+4−4
@@ -1,10 +1,10 @@ {   "manifest_version": 1,   "name": "puppeteer",-  "version": "1.8.47",-  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.8.47/adom-bridge-puppeteer-v1.8.47.zip",-  "sha256": "fc25ab80bc72cbb34451bb1f599fc832af1b618f40a08aed55fd264660326e0f",-  "size": 165160,+  "version": "1.8.48",+  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.8.48/adom-bridge-puppeteer-v1.8.48.zip",+  "sha256": "adf022bff63313fa7705d66a13b72613c01e75aaedddef1d77be5b5744c2b90d",+  "size": 165316,   "verbPrefixes": [     "browser_",     "desktop_recorder_",
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-1.8.47\ No newline at end of file+1.8.48\ 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.47",+  "version": "1.8.48",   "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+18−15
@@ -2282,24 +2282,27 @@ async function getOrLaunchBrowser(profileName, { freshProfile = false, strictPer       // can re-raise itself during startup (first paint, restore prompts). Resolve the       // window via the CDP-port owner (reliable across launcher→browser pid relaunches).       if (!foreground && process.platform === 'win32') {-        // v1.8.47: MINIMIZE to background (see osMinimizeToBackground). Minimizing hands focus-        // back to the user automatically, and there is NO on-screen re-park loop to fight a-        // click. A few late passes only handle: (a) the window not existing yet at connect, and-        // (b) Chrome re-raising itself during first paint. They RESPECT a user restore — the-        // instant the window is un-minimized by a real click, we latch and STOP touching it.-        b._bgResult = osMinimizeToBackground(child.pid, debugPort);-        console.log(`[bg] initial minimize for "${profileName}": ${b._bgResult}`);+        // v1.8.47b: background = ON-SCREEN at z-bottom (occluded, still renders → screenshots+        // work). Minimize was tried and REJECTED — a minimized window reports visibilityState+        // 'hidden' and Page.captureScreenshot hangs (~27s) even with occlusion disabled. The+        // park deactivates FIRST then moves on-screen behind everything (no pop), using the+        // EnumWindows handle (the real window, not a phantom). The re-park window is SHORT+        // (only ~1.2s, just long enough to counter Chrome's startup foreground-grab) so a user+        // click after that is NEVER fought; within it, GetLastInputInfo distinguishes a real+        // click (→ bring on-screen + latch, stop) from Chrome self-raising (→ re-park).+        b._bgResult = osBackgroundWindowByPid(child.pid, debugPort, priorForeground);+        console.log(`[bg] initial park for "${profileName}": ${b._bgResult}`);         const _bgTimers = [];-        for (const delay of [400, 900, 1600, 2600]) {+        for (const delay of [300, 700, 1200]) {           const t = setTimeout(() => {             try {-              if (b._userForeground) return; // user has it — never re-minimize-              const r = osMinimizeToBackground(child.pid, debugPort, true);+              if (b._userForeground) return; // user has it — never re-park+              const r = osBackgroundWindowByPid(child.pid, debugPort, priorForeground, true);               if (r && r !== 'no-window') b._bgResult = r;               if (r === 'user-foreground') {                 b._userForeground = true;                 for (const tt of _bgTimers) clearTimeout(tt);-                console.log(`[bg] user restored "${profileName}" — respecting it, halting re-minimize`);+                console.log(`[bg] user raised "${profileName}" — respecting it, halting re-park`);               }             } catch (e) {}           }, delay);@@ -3392,7 +3395,7 @@ const server = http.createServer(async (req, res) => {               // v1.8.44: if the user deliberately raised this window to watch it, don't yank it               // back on a resize either — honor the same latch the open-time retries set.               if (be && be.browser && be.browser._userForeground) { /* user is watching — leave it */ }-              else if (be && be.browser) be.browser._bgResult = osMinimizeToBackground(be.browser._detachedPid, be.browser._cdpPort, true);+              else if (be && be.browser) be.browser._bgResult = osBackgroundWindowByPid(be.browser._detachedPid, be.browser._cdpPort, be.browser._priorForeground, true);               else osSendWindowToBack(args.profile);             } catch (e) {}           }@@ -3738,11 +3741,11 @@ const server = http.createServer(async (req, res) => {             return;           }           const session = sessions.get(sessionId);-          // v1.8.47: minimize to background. An explicit lower is a deliberate re-park, so clear-          // the user-foreground latch too (the user/AI asked for it back in the background).+          // v1.8.47b: park on-screen at z-bottom (screenshots keep working). An explicit lower is+          // a deliberate re-park, so clear the user-foreground latch too.           const be = browsers.get(session.profileName);           if (be && be.browser) be.browser._userForeground = false;-          const ok = (be && be.browser) ? (osMinimizeToBackground(be.browser._detachedPid, be.browser._cdpPort) === 'minimized') : osSendWindowToBack(session.profileName);+          const ok = (be && be.browser) ? (osBackgroundWindowByPid(be.browser._detachedPid, be.browser._cdpPort, be.browser._priorForeground) === 'backgrounded') : osSendWindowToBack(session.profileName);           session._foreground = false;           sendJSON(res, { success: true, output: JSON.stringify({ ok: true, sessionId, placement: 'background', applied: ok, _hint: 'Window sent behind the user\'s windows (still drivable/screenshottable). Keep pup in the background unless the user asked to watch.' }) });           return;