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
v1.8.24: fix background-by-default focus steal (capture user's foreground window before launch, restore it + push pup to back the instant the window appears via CDP-port owner resolution); finite 4-blink taskbar pulse instead of blink-forever
4 files changed
+115−18
adom-bridge-puppeteer-manifest.json+6−6@@ -1,10 +1,10 @@ { "manifest_version": 1, "name": "puppeteer",- "version": "1.8.23",- "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.8.23/adom-bridge-puppeteer-v1.8.23.zip",- "sha256": "055f4a2ac0f745ac497589f5e8621b97797c02b622c609e6951e156652a8ee72",- "size": 152521,+ "version": "1.8.24",+ "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.8.24/adom-bridge-puppeteer-v1.8.24.zip",+ "sha256": "938f873ad4b69df106022862653587745e47e007b35dd996234addd865061cd0",+ "size": 154366, "verbPrefixes": [ "browser_", "desktop_recorder_",@@ -12,5 +12,5 @@ ], "healthEndpoint": "/status", "statusVerb": "browser_readiness",- "released_at": "2026-07-10T12:39:23Z"-}+ "released_at": "2026-07-13T11:48:20Z"+}
src/BRIDGE_VERSION+1−1@@ -1 +1 @@-1.8.23+1.8.24
src/bridge.json+6−6@@ -2,8 +2,8 @@ "manifest_version": 1, "name": "puppeteer", "displayName": "Puppeteer (Chrome for Testing + Native)",- "version": "1.8.23",- "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.",+ "version": "1.8.24",+ "description": "Drives a browser ALREADY on the machine — installed Chrome, else Microsoft Edge (every Windows PC ships with Edge) — 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 → Edge → 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, …). 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 — 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 — a separate bridge, not pup's job.", "homepage": "https://wiki.adom.inc/adom/adom-desktop", "author": "Adom Inc.", "license": "MIT",@@ -74,13 +74,13 @@ "updateManifestUrl": "https://wiki.adom.inc/api/v1/pages/adom-desktop-puppeteer-bridge/files/adom-bridge-puppeteer-manifest.json", "dependencies": { "node": ">=20",- "browser": "Chromium-family \u2014 installed Chrome or Edge (every Windows box ships Edge); if neither exists, Chrome for Testing is auto-fetched as a last resort. No hard Chrome requirement."+ "browser": "Chromium-family — installed Chrome or Edge (every Windows box ships Edge); if neither exists, Chrome for Testing is auto-fetched as a last resort. No hard Chrome requirement." }, "runtime": { "kind": "node", "version": ">=20", "preferred": "22",- "_note": "AD-managed shared-runtime declaration (see PROPOSAL-shared-runtimes.md). Bridges DECLARE their runtime; AD provisions a portable interpreter from its shared adom-runtimes cache and spawns by absolute path \u2014 no UAC, no PATH reliance. Additive: older AD ignores this and uses `dependencies` / bare `node` on PATH."+ "_note": "AD-managed shared-runtime declaration (see PROPOSAL-shared-runtimes.md). Bridges DECLARE their runtime; AD provisions a portable interpreter from its shared adom-runtimes cache and spawns by absolute path — no UAC, no PATH reliance. Additive: older AD ignores this and uses `dependencies` / bare `node` on PATH." }, "category": "Browser Automation", "tags": [@@ -96,11 +96,11 @@ }, "macos": { "supported": false,- "reason": "macOS port pending \u2014 puppeteer-core is cross-platform but the bridge's spawn config uses Windows-only killImageName 'node.exe' and Chrome for Testing path resolution hasn't been tested."+ "reason": "macOS port pending — puppeteer-core is cross-platform but the bridge's spawn config uses Windows-only killImageName 'node.exe' and Chrome for Testing path resolution hasn't been tested." }, "linux": { "supported": false,- "reason": "Linux port pending \u2014 same killImageName + Chrome resolution issues as macOS."+ "reason": "Linux port pending — same killImageName + Chrome resolution issues as macOS." } }, "prewarm": {
src/server.js+102−5@@ -1486,11 +1486,86 @@ function osSendWindowToBack(profileName) { } catch (e) { console.error(`[bg] send-to-back failed for "${profileName}": ${e.message}`); return false; } } +// v1.8.24: capture the user's CURRENT foreground window BEFORE we launch a pup+// browser (which grabs foreground). We hand focus back to it right after, so+// opening a pup window NEVER steals focus. Returns a decimal HWND string or null.+function osGetForegroundWindow() {+ if (process.platform !== 'win32') return null;+ try {+ const scriptPath = path.join(require('os').tmpdir(), `_adom_fg_${process.pid}_${Date.now()}.ps1`);+ const ps = [+ 'Add-Type @"',+ 'using System; using System.Runtime.InteropServices;',+ 'public class WinFgGet { [DllImport("user32.dll")] public static extern IntPtr GetForegroundWindow(); }',+ '"@',+ 'Write-Output ([int64][WinFgGet]::GetForegroundWindow())',+ ].join('\r\n');+ fs.writeFileSync(scriptPath, ps);+ const out = execSync(`powershell.exe -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}"`, { encoding: 'utf8', timeout: 4000 }).trim();+ return out && out !== '0' ? out : null;+ } catch (e) { return null; }+}++// v1.8.24: THE real "background by default" enforcement. osSendWindowToBack only+// lowers z-order — but a freshly-launched --start-maximized browser KEEPS foreground+// focus, so the window still sits on top of the user's work. This pushes the pup+// window (the given pid + its chrome/msedge children) to the BOTTOM without+// activating AND, if pup currently holds the foreground, hands focus straight back+// to `restoreHwnd` (the window the user was in). Called the instant the window+// appears (not after navigation), so there's no visible foreground pop.+// Takes a raw pid so it can run DURING launch, before the session is in `browsers`.+// cdpPort (optional) is the browser's CDP debug port: the process LISTENING on it is+// unambiguously the real browser with the window, which is more reliable than the+// spawned pid (Edge/Chrome relaunch to a different pid that isn't a child of it).+function osBackgroundWindowByPid(pid, restoreHwnd, cdpPort) {+ if (process.platform !== 'win32' || (!pid && !cdpPort)) return;+ try {+ const restore = (restoreHwnd && /^\d+$/.test(String(restoreHwnd))) ? String(restoreHwnd) : '0';+ const port = Number(cdpPort) || 0;+ const scriptPath = path.join(require('os').tmpdir(), `_adom_bgpid_${pid || port}.ps1`);+ const ps = [+ 'Add-Type @"',+ 'using System; using System.Runtime.InteropServices;',+ 'public class WinBgP {',+ ' [DllImport("user32.dll")] public static extern bool SetWindowPos(IntPtr h, IntPtr a, int x, int y, int cx, int cy, uint f);',+ ' [DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr h);',+ ' [DllImport("user32.dll")] public static extern IntPtr GetForegroundWindow();',+ '}',+ '"@',+ `$targetPid = ${Number(pid) || 0}`,+ `$cdpPort = ${port}`,+ `$restore = [IntPtr]${restore}`,+ '$BOTTOM = [IntPtr]1', // HWND_BOTTOM+ '$F = 0x1 -bor 0x2 -bor 0x10', // SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE+ 'function Back($h){ if($h -ne [IntPtr]::Zero){ [WinBgP]::SetWindowPos($h,$BOTTOM,0,0,0,0,$F) | Out-Null } }',+ '$handles = New-Object System.Collections.ArrayList',+ '$pids = New-Object System.Collections.ArrayList',+ 'if ($targetPid -ne 0) { [void]$pids.Add($targetPid) }',+ // The process LISTENING on the CDP port is the real browser — most reliable anchor.+ 'if ($cdpPort -ne 0) { try { $own = Get-NetTCPConnection -LocalPort $cdpPort -State Listen -ErrorAction SilentlyContinue | Select-Object -First 1 -ExpandProperty OwningProcess; if ($own) { [void]$pids.Add([int]$own) } } catch {} }',+ // For each anchor pid, take its own window + any chrome/msedge child windows.+ 'foreach ($tp in $pids) {',+ ' $p = Get-Process -Id $tp -ErrorAction SilentlyContinue',+ ' if ($p -and $p.MainWindowHandle -ne 0) { [void]$handles.Add($p.MainWindowHandle) }',+ ' Get-CimInstance Win32_Process -Filter "ParentProcessId=$tp" -ErrorAction SilentlyContinue | Where-Object { $_.Name -in @("chrome.exe","msedge.exe") } | ForEach-Object { $cp = Get-Process -Id $_.ProcessId -ErrorAction SilentlyContinue; if ($cp -and $cp.MainWindowHandle -ne 0) { [void]$handles.Add($cp.MainWindowHandle) } }',+ '}',+ '$fg = [WinBgP]::GetForegroundWindow()',+ '$pupHadFg = $false',+ 'foreach($h in $handles){ if($h -eq $fg){ $pupHadFg = $true }; Back $h }',+ // Hand focus back to the user's window ONLY if a pup window currently holds it.+ 'if ($restore -ne [IntPtr]::Zero -and $pupHadFg) { [WinBgP]::SetForegroundWindow($restore) | Out-Null }',+ 'Write-Output "ok"',+ ].join('\r\n');+ fs.writeFileSync(scriptPath, ps);+ execSync(`powershell.exe -NoProfile -ExecutionPolicy Bypass -File "${scriptPath}"`, { timeout: 6000, stdio: 'ignore' });+ } catch (e) { console.error(`[bg-restore] pid ${pid} port ${cdpPort}: ${e.message}`); }+}+ // v1.8.23: REAL taskbar flash (FlashWindowEx) for a session's window — the orange // nudge that tells the user "the agent touched this window" WITHOUT stealing focus.-// FLASHW_TRAY|FLASHW_TIMERNOFG flashes until the window is focused, then auto-clears-// (Windows does the clear-on-focus for us). Skips if the window is already foreground.-// Fire-and-forget (async exec) so it never adds latency to the driving verb.+// v1.8.24: a FINITE 4-blink pulse then stop (see Flash() below) — NOT a blink-forever+// nag. Skips if the window is already foreground. Fire-and-forget (async exec) so it+// never adds latency to the driving verb. function osFlashWindow(profileName) { if (process.platform !== 'win32') return; const be = browsers.get(profileName);@@ -1507,7 +1582,10 @@ function osFlashWindow(profileName) { ' [DllImport("user32.dll")] public static extern bool FlashWindowEx(ref FLASHWINFO pwfi);', ' [DllImport("user32.dll")] public static extern IntPtr GetForegroundWindow();', ' public static void Flash(IntPtr h){ if(h==IntPtr.Zero) return; if(GetForegroundWindow()==h) return;',- ' FLASHWINFO fi=new FLASHWINFO(); fi.cbSize=(uint)Marshal.SizeOf(fi); fi.hwnd=h; fi.dwFlags=0x2|0xC; fi.uCount=0; fi.dwTimeout=0; FlashWindowEx(ref fi); }',+ // v1.8.24: FINITE pulse — FLASHW_TRAY (taskbar button only), 4 blinks, then STOP.+ // NOT FLASHW_TIMERNOFG (which blinks forever until focused — an annoying nag). A short+ // orange pulse is a glance-and-forget "this window was updated" nudge, not a demand.+ ' FLASHWINFO fi=new FLASHWINFO(); fi.cbSize=(uint)Marshal.SizeOf(fi); fi.hwnd=h; fi.dwFlags=0x2; fi.uCount=4; fi.dwTimeout=0; FlashWindowEx(ref fi); }', '}', '"@', `$targetPid = ${pid}`,@@ -1778,6 +1856,10 @@ async function getOrLaunchBrowser(profileName, { freshProfile = false, strictPer `--user-data-dir=${userDataDir}`, ]; console.log(`Chrome launch attempt ${attemptNum} for profile "${profileName}" on CDP port ${debugPort}`);+ // v1.8.24: remember the user's foreground window RIGHT BEFORE we launch, so we+ // can hand focus straight back once pup's window appears (background-by-default+ // must never steal focus, and --start-maximized grabs it on launch).+ const priorForeground = (!foreground) ? osGetForegroundWindow() : null; const child = spawn(chromePath, chromeArgs, { detached: true, stdio: 'ignore',@@ -1835,6 +1917,17 @@ async function getOrLaunchBrowser(profileName, { freshProfile = false, strictPer b._detachedPid = child.pid; b._cdpPort = debugPort; console.log(`Launched detached Chrome (PID ${child.pid}) on CDP port ${debugPort} for profile "${profileName}"`);+ // v1.8.24: ENFORCE background-by-default the instant the window exists — push it+ // behind the user's windows AND hand focus back to whatever they were in, so the+ // --start-maximized launch never steals focus. Retry a few times because Chrome/Edge+ // 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') {+ osBackgroundWindowByPid(child.pid, priorForeground, debugPort);+ for (const delay of [250, 700, 1500]) {+ setTimeout(() => { try { osBackgroundWindowByPid(child.pid, priorForeground, debugPort); } catch (e) {} }, delay);+ }+ } return b; }; @@ -1940,7 +2033,7 @@ async function getOrLaunchBrowser(profileName, { freshProfile = false, strictPer // Launch a session as a tab in a Chrome browser // profile: which Chrome profile to use (defaults to sessionId) // If another session already uses that profile, this creates a NEW TAB in the same Chrome-async function launchSession(sessionId, url, { freshProfile = false, profile, strictPermissions = false, downloadPath = null, nativeSite = false, owner = null, takeover = false } = {}) {+async function launchSession(sessionId, url, { freshProfile = false, profile, strictPermissions = false, downloadPath = null, nativeSite = false, owner = null, takeover = false, foreground = false } = {}) { const profileName = profile || sessionId; // If session already exists and page is still alive, just navigate@@ -2834,6 +2927,10 @@ const server = http.createServer(async (req, res) => { nativeSite: !!args.nativeSite, owner: (typeof args.owner === 'string' && args.owner.trim()) ? args.owner.trim() : null, takeover: !!args.takeover,+ // v1.8.24: background-by-default is enforced DURING launch (focus handed+ // back to the user's window the instant pup's window appears) unless the+ // caller explicitly wants it foreground.+ foreground: !!(args.foreground || args.raise || args.show), }); } catch (e) { if (e && e.code === 'session_owned_by_another_thread') {