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
1.8.66: placement doctrine — CDP plain bounds only, re-bottom after move, z-order confirmed via list_windows, revert off-screen on unconfirmed
5 files changed
+83−30
CHANGELOG.md+14@@ -1,5 +1,19 @@ # Changelog — Adom Desktop Puppeteer Bridge +## 1.8.66 — 2026-07-15 — PLACEMENT DOCTRINE: verify the z-order, revert if unconfirmed++1.8.65's "fix" was worse: AD desktop_set_window_bounds ALSO raises the window (despite+restore:false), and desktop_list_monitors reports logical px while set_window_bounds takes+physical — five windows on top of the user's work AND undersized. Placement is rebuilt around+distrust:++- Geometry via CDP plain bounds only (left/top/width/height, normal state), sized from the page's+ own screen.availWidth/Height with retries. No CDP maximize (raises), no AD bounds (raises).+- After placement: RE-BOTTOM via AD state:bottom force, then CONFIRM THE Z-ORDER via AD+ desktop_list_windows — pup's window must be strictly below at least one non-pup window and not+ topmost. Retried once; if still unconfirmed, the window is moved BACK OFF-SCREEN and the verdict+ is park-failed. A window that might be covering the user never stays on-screen.+ ## 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
adom-bridge-puppeteer-manifest.json+4−4@@ -1,10 +1,10 @@ { "manifest_version": 1, "name": "puppeteer",- "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,+ "version": "1.8.66",+ "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.8.66/adom-bridge-puppeteer-v1.8.66.zip",+ "sha256": "bceed814761cac4a65ec88b61f047c3ccfb1aa3703b9979d9b8dd7fbe4fe078c",+ "size": 172778, "verbPrefixes": [ "browser_", "desktop_recorder_",
src/BRIDGE_VERSION+1−1@@ -1 +1 @@-1.8.65+1.8.66
src/bridge.json+1−1@@ -2,7 +2,7 @@ "manifest_version": 1, "name": "puppeteer", "displayName": "Puppeteer (Chrome for Testing + Native)",- "version": "1.8.65",+ "version": "1.8.66", "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+63−24@@ -1997,28 +1997,54 @@ async function parkSessionWindowDirect(page, sessionId) { try { cdp = await page.target().createCDPSession(); const { windowId } = await cdp.send('Browser.getWindowForTarget');- // 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) {+ // v1.8.66: PLACEMENT DOCTRINE (three shipped placements raised the window — CDP maximize+ // = SW_MAXIMIZE raises; AD set_window_bounds raises despite restore:false; the on-screen+ // small stage was visible. ALL of it John caught live):+ // 1. Geometry via CDP plain bounds ONLY (left/top/width/height, normal state; CSS px from+ // the page itself). NEVER windowState:'maximized', NEVER AD set_window_bounds.+ // 2. Size is measured, not guessed: screen.availWidth/Height with retries (the one probe+ // failure shipped 1600×900 once — retry beats fallback).+ // 3. TRUST NOTHING: after placement, RE-BOTTOM and VERIFY THE Z-ORDER via AD+ // desktop_list_windows. If pup's window cannot be confirmed below the user's windows,+ // move it back OFF-SCREEN and report park-failed. A window that might be covering the+ // user NEVER stays on-screen.+ const cssScreen = async () => {+ for (let i = 0; i < 4; i++) { 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; }+ const s = await page.evaluate(() => ({ w: screen.availWidth, h: screen.availHeight }));+ if (s && s.w > 400 && s.h > 300) return s; } catch (e) {}+ await new Promise(r2 => setTimeout(r2, 300)); }- 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 });+ return null;+ };+ const placeOnScreen = async () => {+ const s = await cssScreen();+ if (!s) return false;+ await cdp.send('Browser.setWindowBounds', { windowId, bounds: { windowState: 'normal' } });+ await cdp.send('Browser.setWindowBounds', { windowId, bounds: { left: 0, top: 0, width: Math.round(s.w), height: Math.round(s.h) } });+ return true;+ };+ const moveOffScreen = async () => {+ try {+ await cdp.send('Browser.setWindowBounds', { windowId, bounds: { windowState: 'normal' } });+ await cdp.send('Browser.setWindowBounds', { windowId, bounds: { left: -32000, top: -32000, width: 1280, height: 800 } });+ } catch (e) {}+ };+ // Z-order truth: our window's z must be strictly below at least one non-pup window, and it+ // must not be topmost. Returns true only on CONFIRMED not-on-top.+ const zConfirmedBelow = async (targetHwnd) => {+ try {+ const r = await chrome.adCommand('desktop_list_windows', {}, { timeoutMs: 5000 });+ const raw = r && (typeof r.output === 'string' && r.output ? JSON.parse(r.output) : r.output || r);+ const ws = ((raw && (raw.data || raw)).windows) || [];+ if (!ws.length) return false;+ const mine = ws.find(w => Number(w.hwnd) === Number(targetHwnd));+ if (!mine) return false;+ if (Number(mine.z) === 0) return false;+ // at least one NON-pup window above ours+ return ws.some(w => Number(w.z) < Number(mine.z) && !/\(session: /.test(w.title || ''));+ } catch (e) { return false; } }; // hwnd via AD (native) — the title suffix "(session: <id>" is set by the welcome page. // v1.8.59 HARD RULES, learned the expensive way:@@ -2089,14 +2115,28 @@ async function parkSessionWindowDirect(page, sessionId) { } 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.+ // Place on-screen full-size (CDP plain bounds — the only move that doesn't raise), then+ // RE-BOTTOM (trust nothing) and CONFIRM the z-order. Unconfirmable → back off-screen.+ const placed = await placeOnScreen();+ if (!placed) {+ console.log(`[park] "${sessionId}": screen-size probe failed — leaving off-screen, self-heal will retry`);+ return 'park-failed';+ }+ let zOk = false;+ for (let i = 0; i < 2 && !zOk; i++) {+ await adBottom(); // re-assert after the move, every time+ zOk = await zConfirmedBelow(parkHwnd);+ }+ if (!zOk) {+ console.log(`[park] "${sessionId}": Z-ORDER UNCONFIRMED after placement — moving back OFF-SCREEN (never leave a window that might cover the user)`);+ await moveOffScreen();+ return 'park-failed';+ }+ // Verify POSITION too (a stuck-off-screen window must not read as parked). 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 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';@@ -2266,7 +2306,6 @@ 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;