← Commit history

v2.0.308: No more enum_windows deltas (John): the birth capture is ONE desktop_wait_for_window on the unique birth title instead of up to 14 enum polls; hwndOwnerPid uses the shared cached snapshot instead of a raw enum per validation; the SetProp lookup enumerates and reads the property inside one PowerShell with zero ab calls. Steady-state sweeps keep the long-TTL shared snapshot.

John Lauer ·6a712b36b5 ·2mo ago ·parent 64193d6
4 files changed +42−25
adom-bridge-puppeteer-manifest.json+5−5
@@ -1,10 +1,10 @@ {   "manifest_version": 1,   "name": "puppeteer",-  "version": "2.0.307",-  "url": "https://wiki.adom.inc/download/adom/pup-bridge/2.0.307/adom-bridge-puppeteer-v2.0.307.zip",-  "sha256": "72165e7a0cd4feff0a402e4ba45fc68d09a801c20a8de4f77f11689458e8fdfa",-  "size": 1431049,+  "version": "2.0.308",+  "url": "https://wiki.adom.inc/download/adom/pup-bridge/2.0.308/adom-bridge-puppeteer-v2.0.308.zip",+  "sha256": "4277124992830b6444ff111745b67ec596f34e136ba06e4c3a5949700d9228da",+  "size": 1431506,   "verbPrefixes": [     "browser_",     "desktop_recorder_",@@ -12,5 +12,5 @@   ],   "healthEndpoint": "/status",   "statusVerb": "browser_readiness",-  "released_at": "2026-08-23T14:40:29.442412Z"+  "released_at": "2026-08-23T14:55:39.071158Z" }
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-2.0.307\ No newline at end of file+2.0.308\ 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": "2.0.307",+  "version": "2.0.308",   "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. pup_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. pup_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. macOS (v1.9.74+): full parity with mac-native mechanics \u2014 background-by-default is the app-level hide (windows stay drivable/screenshottable while hidden), raise/lower map to unhide+activate/hide, pup_alert_window posts a native toast whose click focuses the window, pup_use {browser:'chrome',install:true} installs Chrome from the official dmg, and taskbar identity/badging remains Windows-only.",   "homepage": "https://wiki.adom.inc/adom/adom-bridge",   "author": "Adom Inc.",
src/server.js+35−18
@@ -534,16 +534,27 @@ Write-Output ok`; async function resolveHwndBySessionProp(sessionId) {   if (process.platform !== 'win32' || !sessionId) return null;   const sid = _sanSid(sessionId);-  let rows = [];-  try { rows = await enumChromeWidgetWindows({ fresh: true }); } catch (e) {}-  const hwnds = rows.map(r => Number(r.h)).filter(h => h && Number.isFinite(h));-  if (!hwnds.length) return null;+  // v2.0.308: the candidate list used to come from a FRESH ab enum (more enum spam). The property is+  // the identity, so enumerate locally and read it in the same script: one PowerShell, zero ab calls.   const ps = `Add-Type @"-using System;using System.Runtime.InteropServices;-public class PupGP { [DllImport("user32.dll",CharSet=CharSet.Unicode)] public static extern IntPtr GetProp(IntPtr h,string s); }+using System;using System.Runtime.InteropServices;using System.Text;+public class PupGP {+  public delegate bool EnumProc(IntPtr h, IntPtr l);+  [DllImport("user32.dll")] public static extern bool EnumWindows(EnumProc cb, IntPtr l);+  [DllImport("user32.dll",CharSet=CharSet.Unicode)] public static extern IntPtr GetProp(IntPtr h,string s);+  [DllImport("user32.dll",CharSet=CharSet.Unicode)] public static extern int GetClassName(IntPtr h, StringBuilder s, int n);+  public static long Find(string prop) {+    long found = 0;+    EnumWindows((h, l) => {+      var sb = new StringBuilder(64); GetClassName(h, sb, 64);+      if (sb.ToString() == "Chrome_WidgetWin_1" && GetProp(h, prop) != IntPtr.Zero) { found = h.ToInt64(); return false; }+      return true;+    }, IntPtr.Zero);+    return found;+  }+} "@-$hwnds = @(${hwnds.join(',')})-foreach ($h in $hwnds) { $v = [PupGP]::GetProp([IntPtr]$h, "${PUP_WIN_PROP}=${sid}"); if ($v.ToInt64() -ne 0) { Write-Output $h; break } }`;+Write-Output ([PupGP]::Find("${PUP_WIN_PROP}=${sid}"))`;   const out = await _runPsEncoded(ps, 6000);   const h = Number(String(out || '').trim().split(/\r?\n/)[0] || '0');   return h && Number.isFinite(h) && h !== 0 ? h : null;@@ -7953,10 +7964,13 @@ async function hwndOwnerPid(hwnd) {   // Chrome browser frame. desktop_enum_windows enumerates top-level windows filtered by class, so a   // child/utility HWND simply is not in the result — same rejection, zero PowerShell.   if (process.platform !== 'win32' || !hwnd) return null;+  // v2.0.308: this ran a RAW ab enum on every validation (every verb that touches an hwnd). Use the+  // shared cached snapshot; a handle missing from it (a window younger than the cache) gets ONE+  // fresh look, which is also coalesced across concurrent callers.   try {-    const d = abPayload(await chrome.abCommand('desktop_enum_windows', { className: 'Chrome_WidgetWin_1', includeOffscreen: true }, { timeoutMs: 6000 }));-    const row = ((d && d.windows) || []).find(w => Number(w.hwnd) === Number(hwnd));-    if (!row || row.visible === false) return null;+    let row = (await enumChromeWidgetWindows()).find(r => Number(r.h) === Number(hwnd));+    if (!row) row = (await enumChromeWidgetWindows({ fresh: true })).find(r => Number(r.h) === Number(hwnd));+    if (!row) return null;     const pid = Number(row.pid);     return Number.isFinite(pid) && pid > 0 ? { pid, title: String(row.title || '') } : null;   } catch (e) { return null; }@@ -10637,13 +10651,16 @@ async function createPageInNewWindow(browser, profileName) {         // caller's navigation overwrites the title right after, by which point the hwnd is captured.         const _birthTitle = `PUPBIRTH-${_birthSeq}-${Math.floor(Date.now() % 1000000)}`;         try { await fresh.evaluate((t) => { document.title = t; }, _birthTitle); } catch (e) {}-        for (let i = 0; i < 14 && !capturedHwnd; i++) {-          const rows = await enumChromeWidgetWindows({ fresh: true });-          const mine = rows.filter(r => (!_bpid || Number(r.pid) === _bpid) && !hwndOwnedByOtherSession(r.h, null) && String(r.title || '').includes(_birthTitle));-          if (mine.length === 1) { capturedHwnd = mine[0].h; break; }-          if (mine.length > 1) { console.log(`[hwnd] birth: ${mine.length} windows carry the unique birth title "${_birthTitle}" — impossible; not guessing`); break; }-          await new Promise(r => setTimeout(r, 150));-        }+        // v2.0.308 (John: "why are you spamming desktop_enum_windows again? now that you do the+        // SetProp technique you would never have to look at hwnd deltas"): he is right. The title+        // capture used to POLL ab's enum up to 14 times per birth (the 1/s enum spam in his log).+        // ONE server-side wait on the unique title now: ab blocks until a Chrome_WidgetWin_1 window+        // whose title contains the token exists and hands back its hwnd. No enumeration, no deltas.+        try {+          const _w = abPayload(await chrome.abCommand('desktop_wait_for_window', { titleContains: _birthTitle, classContains: 'Chrome_WidgetWin_1', timeoutMs: 2500 }, { timeoutMs: 4000 }));+          const _h = _w && _w.window && Number(_w.window.hwnd);+          if (_h && !hwndOwnedByOtherSession(_h, null)) capturedHwnd = _h;+        } catch (e) {}         if (!capturedHwnd) console.log(`[hwnd] birth on "${profileName}": no window matched the unique birth title "${_birthTitle}" yet — resolver will settle it`);       }     });