app
Pup - the AI's own browser
Public Made by Adomby adom
pup gives your AI a real browser on your desktop that it drives completely, in the background, signed in as you: windows that never jump in front of your work, one shared profile that learns your logins, and every window labeled on the taskbar with its AI thread's name.
← Commit history
STUCK-OCCLUSION auto-unstick (root-caused live on John's Slides window): after a browser-process hang, Chrome's occlusion state for a window can come back corrupted — the window is FRONTMOST yet the page reports visibilityState hidden, so Chrome withholds every frame; the user sees DWM's last composited frame (looks perfect in screenshots) but wheel/typing repaint nothing, i.e. 'pup is frozen' on a healthy page. Raise and even minimize/restore do not recompute it; only a real activation does. New unstickIfHiddenWhileFront detects the impossible state (OS-foreground window + page-hidden), fixes it via CDP Page.setWebLifecycleState active then a real forced activation (AttachThreadInput ALT-nudge + SetForegroundWindow), reports via the cleanup queue, 30s per-session cooldown. Wired into the 15s health sweep and 2s after every granted raise.
4 files changed
+103−6
adom-bridge-puppeteer-manifest.json+4−4@@ -1,10 +1,10 @@ { "manifest_version": 1, "name": "puppeteer",- "version": "1.9.179",- "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.179/adom-bridge-puppeteer-v1.9.179.zip",- "sha256": "5e1a1c12ad4c9606546013942e15721ac0e63039135196dd76bdf1f5027f9dac",- "size": 415077,+ "version": "1.9.180",+ "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.180/adom-bridge-puppeteer-v1.9.180.zip",+ "sha256": "75758452dd7e61f1eea7b34e4a8ac9806eaf633d48db6e52e1eb714cdb6e94bc",+ "size": 416877, "verbPrefixes": [ "browser_", "desktop_recorder_",
src/BRIDGE_VERSION+1−1@@ -1 +1 @@-1.9.179+1.9.180
src/bridge.json+1−1@@ -2,7 +2,7 @@ "manifest_version": 1, "name": "puppeteer", "displayName": "Puppeteer (Chrome for Testing + Native)",- "version": "1.9.179",+ "version": "1.9.180", "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. 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, browser_alert_window posts a native toast whose click focuses the window, browser_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-desktop", "author": "Adom Inc.",
src/server.js+97@@ -2240,6 +2240,84 @@ function osGetForegroundWindow() { } catch (e) { return null; } } +// v1.9.180 — STUCK-OCCLUSION UNSTICK. Root-caused live on John's Slides window (2026-07-29): after a+// browser-process hang, Chrome's native occlusion state for a window can come back CORRUPTED — the+// window is frontmost on screen, yet the page reports document.visibilityState 'hidden', so Chrome+// withholds every frame. The user sees DWM's last composited frame (looks perfect in screenshots) but+// scrolling/typing repaints NOTHING — "pup is frozen" while the page is healthy. Programmatic raise+// (SWP_NOACTIVATE) and even minimize/restore do NOT recompute it; a REAL activation does. So: when a+// pup window IS the OS-foreground window but its page claims hidden, that state is impossible-if-+// healthy — unstick it (CDP lifecycle 'active' first, then a real forced activation) and tell the user.+async function pageSetLifecycleActive(page) {+ let cdp = null;+ try {+ cdp = await withTimeout(page.target().createCDPSession(), 3000, 'cdp-lifecycle');+ await withTimeout(cdp.send('Page.setWebLifecycleState', { state: 'active' }), 3000, 'lifecycle');+ return true;+ } catch (e) { return false; }+ finally { try { if (cdp) await cdp.detach(); } catch (e) {} }+}++// Force a REAL activation of a window (AttachThreadInput + ALT-nudge + SetForegroundWindow) — the+// user-input-equivalent activation that actually recomputes Chrome's occlusion, unlike a plain raise.+function forceActivateHwnd(hwnd) {+ if (process.platform !== 'win32' || !hwnd) return false;+ try {+ const scriptPath = path.join(require('os').tmpdir(), `_adom_act_${process.pid}.ps1`);+ const ps = [+ 'Add-Type @"',+ 'using System; using System.Runtime.InteropServices;',+ 'public class WinAct {',+ ' [DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr h);',+ ' [DllImport("user32.dll")] public static extern bool BringWindowToTop(IntPtr h);',+ ' [DllImport("user32.dll")] public static extern void keybd_event(byte k, byte s, uint f, UIntPtr x);',+ '}',+ '"@',+ // The ALT-nudge: a real (harmless) modifier keypress releases Windows' foreground lock so+ // SetForegroundWindow performs a TRUE activation instead of a taskbar flash.+ '[WinAct]::keybd_event(0xA4,0,0,[UIntPtr]::Zero); [WinAct]::keybd_event(0xA4,0,2,[UIntPtr]::Zero)',+ `$h=[IntPtr]${Number(hwnd)}`,+ '[void][WinAct]::BringWindowToTop($h); [void][WinAct]::SetForegroundWindow($h)',+ ].join('\r\n');+ fs.writeFileSync(scriptPath, ps);+ runPsHidden(scriptPath, { timeout: 4000 });+ return true;+ } catch (e) { return false; }+}++const _unstickLast = new Map(); // sessionId -> ts of last unstick attempt (don't nag every tick)+async function unstickIfHiddenWhileFront(sessionId, session, fgHwnd) {+ if (process.platform !== 'win32' || !session) return false;+ const tab = (session.tabs || []).find(t => t.tabId === session.activeTabId) || (session.tabs || [])[0];+ if (!tab || !tab.page || tab._crashed) return false;+ let vis = null;+ try { vis = await withTimeout(tab.page.evaluate('document.visibilityState'), 1500, 'vis-probe'); } catch (e) { return false; }+ if (vis !== 'hidden') return false;+ // hidden is NORMAL for a background window — only frontmost-yet-hidden is the broken state.+ const hwnd = await sessionHwnd(sessionId);+ if (!hwnd || String(fgHwnd) !== String(hwnd)) return false;+ const last = _unstickLast.get(sessionId) || 0;+ if (Date.now() - last < 30000) return false;+ _unstickLast.set(sessionId, Date.now());+ console.log(`[unstick] "${sessionId}" is the FOREGROUND window but its page reports hidden — stuck occlusion; unsticking`);+ await pageSetLifecycleActive(tab.page);+ await new Promise(r => setTimeout(r, 700));+ try { vis = await withTimeout(tab.page.evaluate('document.visibilityState'), 1500, 'vis-probe'); } catch (e) {}+ if (vis === 'hidden') {+ forceActivateHwnd(hwnd);+ await new Promise(r => setTimeout(r, 900));+ try { vis = await withTimeout(tab.page.evaluate('document.visibilityState'), 1500, 'vis-probe'); } catch (e) {}+ }+ const fixed = vis !== 'hidden';+ if (fixed) {+ recordCleanup(`pup detected your "${sessionId}" window was front-and-center but Chrome had stopped painting it (stuck occlusion after a hang) — pup unstuck it automatically; scrolling and rendering work again.`);+ } else {+ recordCleanup(`pup detected your "${sessionId}" window is frontmost but Chrome is refusing to paint it (stuck occlusion). One real click anywhere on that window fixes it — pup's automatic nudges did not clear it this time.`);+ }+ console.log(`[unstick] "${sessionId}" ${fixed ? 'UNSTUCK — page visible again' : 'still hidden after nudges (needs one real user click)'}`);+ return fixed;+}+ // v1.8.40: badge each pup window's TASKBAR BUTTON with the white Adom leaves, so users can // tell a pup-driven window from their own browser. Done via AD-core desktop_taskbar (custom // PNG overlay, AD ≥1.9.106) — AD paints it cross-process natively; pup just hands over the@@ -8387,6 +8465,16 @@ const server = http.createServer(async (req, res) => { console.error(`SetForegroundWindow failed for session "${sessionId}":`, e.message); } }+ // v1.9.180: a raise can land on a stuck-occlusion window (frontmost yet page-hidden →+ // frame-frozen in front of the user). Check shortly after the reveal and unstick at once+ // rather than waiting for the 15s sweep.+ setTimeout(async () => {+ try {+ const s = sessions.get(sessionId);+ const fg = osGetForegroundWindow();+ if (s && fg) await unstickIfHiddenWhileFront(sessionId, s, fg);+ } catch (e) {}+ }, 2000); sendJSON(res, { success: true, output: JSON.stringify({ ok: true, sessionId, focused: true }) }); } catch (e) { sendJSON(res, { success: false, error: `Focus failed: ${e.message}` });@@ -10319,6 +10407,15 @@ server.listen(PORT, BIND_HOST, async () => { _healingIds.delete(sid); } }+ // (3) STUCK-OCCLUSION check (v1.9.180) — a pup window that IS the OS-foreground window while its+ // page claims hidden is frame-frozen in front of the user's eyes; unstick it. One cheap OS read+ // per tick, and the per-session probe is timeout-bounded.+ try {+ if (sessions.size > 0) {+ const fg = osGetForegroundWindow();+ if (fg) { for (const [sid, sess] of [...sessions]) { try { await unstickIfHiddenWhileFront(sid, sess, fg); } catch (e) {} } }+ }+ } catch (e) {} }, 15000); // v1.9.166: taskbar-progress reconciler — clear any bar that is lit but shouldn't be. setInterval(async () => {