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
Fix the enum_windows storm Thread Tiles introduced: the name-tile render called browser.newPage(), which opened an OS window that pup's own birth/reclaim machinery then enumerated repeatedly to adopt (and a leaked data: render page became an adoptable ghost). The tile now renders on an OFFSCREEN CANVAS inside an EXISTING session page (the FG font injected via the FontFace API), so NO new window is created and there is nothing to enumerate; the page's own content and title are untouched. Also added data: URLs to the non-adoptable set so an internal render page can never be reclaimed as a ghost window. Tile-gen bumped to t2.
4 files changed
+51−36
adom-bridge-puppeteer-manifest.json+4−4@@ -1,10 +1,10 @@ { "manifest_version": 1, "name": "puppeteer",- "version": "2.0.157",- "url": "https://wiki.adom.inc/download/adom/pup-bridge/2.0.157/adom-bridge-puppeteer-v2.0.157.zip",- "sha256": "3804fd6084059a694d4293a53f8a396b11e2e0ccecd363aab455ec48985a58cd",- "size": 906406,+ "version": "2.0.158",+ "url": "https://wiki.adom.inc/download/adom/pup-bridge/2.0.158/adom-bridge-puppeteer-v2.0.158.zip",+ "sha256": "c3d6fc7f64c7679d06eb0df96925edc764cb7bcf568639016709cebfb818c6e5",+ "size": 907075, "verbPrefixes": [ "browser_", "desktop_recorder_",
src/BRIDGE_VERSION+1−1@@ -1 +1 @@-2.0.157+2.0.158
src/bridge.json+1−1@@ -2,7 +2,7 @@ "manifest_version": 1, "name": "puppeteer", "displayName": "Puppeteer (Chrome for Testing + Native)",- "version": "2.0.157",+ "version": "2.0.158", "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+45−30@@ -1796,7 +1796,8 @@ async function attemptReconnectProfile(profileName) { // it "unowned" twice and minted a ghost adom-you-win**** session for it, whose hwnd (a popup // bubble with no title tag) could never resolve — the thing every sweep then hunted forever. function isNonAdoptableUrl(u) {- return !u || u === 'about:blank' || /^(devtools|chrome|edge|chrome-extension|chrome-untrusted|extension|view-source):/i.test(u);+ // v2.0.158: data: URLs are internal (the thread-tile render page uses one) — never a user window.+ return !u || u === 'about:blank' || /^(devtools|chrome|edge|chrome-extension|chrome-untrusted|extension|view-source|data):/i.test(u); } async function rescanProfile(browser, profileName, { adoptOrphans = false } = {}) { const pages = await browser.pages();@@ -4078,10 +4079,10 @@ async function stampPupIdentity(sessionId, opts) { let _tp = path.join(THREAD_TILE_DIR, `${threadSlug(_tn)}.ico`); let _ok = false; try { _ok = fs.existsSync(_tp) && fs.statSync(_tp).size > 100; } catch (e) {} if (!_ok) {- let be = sess && browsers.get(sess.profileName);- if (!be || !be.browser) { for (const [, e2] of browsers) { if (e2 && e2.browser) { be = e2; break; } } }- console.log(`[thread-tile] stamp render "${sessionId}" thread="${_tn}" browser=${be && be.browser ? 'yes' : 'NO'}`);- if (be && be.browser) { try { const r = await renderThreadTileIco(be.browser, _tn); if (r) _tp = r; } catch (e) { console.log(`[thread-tile] stamp render err: ${e.message}`); } }+ // Render on an EXISTING page (no new window). Prefer this session's own tab; else any live tab.+ let _rp = sess && (sess.tabs || []).map(t => t && t.page).find(Boolean);+ if (!_rp) { outer: for (const [, s2] of sessions) { for (const t2 of (s2.tabs || [])) { if (t2 && t2.page) { _rp = t2.page; break outer; } } } }+ if (_rp) { try { const r = await renderThreadTileIco(_rp, _tn); if (r) _tp = r; } catch (e) { console.log(`[thread-tile] stamp render err: ${e.message}`); } } } try { if (fs.existsSync(_tp)) _stampIcon = _tp; } catch (e) {} _stampName = String(_tn);@@ -4184,13 +4185,11 @@ async function registerPupAumid(appId, sessionId) { try { const s = sessions.get(sessionId); const threadName = s && (s.owner || s._ownerThread);- let be = s && browsers.get(s.profileName);- // v2.0.155: fall back to ANY live browser if this session's profile browser isn't in the map- // yet (the render only needs a Chrome to draw an offscreen tile — any will do).- if (!be || !be.browser) { for (const [, e2] of browsers) { if (e2 && e2.browser) { be = e2; break; } } }- console.log(`[thread-tile] register "${sessionId}" appId=${appId} threadName=${threadName || '(none)'} browser=${be && be.browser ? 'yes' : 'NO'} profile=${s && s.profileName}`);- if (threadName && be && be.browser) {- const tile = await renderThreadTileIco(be.browser, threadName);+ // Render on an existing page (no new window) — this session's tab, else any live tab.+ let _rp = s && (s.tabs || []).map(t => t && t.page).find(Boolean);+ if (!_rp) { outer2: for (const [, s2] of sessions) { for (const t2 of (s2.tabs || [])) { if (t2 && t2.page) { _rp = t2.page; break outer2; } } } }+ if (threadName && _rp) {+ const tile = await renderThreadTileIco(_rp, threadName); if (tile) iconPath = tile; displayName = String(threadName); // the taskbar hover/label reads the thread name too }@@ -4247,7 +4246,7 @@ function writeAumidIcon(appId, iconPath) { // NAME rendered on the teal tile. The name is rendered in the real Adom font (Familjen Grotesk) by // CHROME — the ONE renderer guaranteed to have the woff2 — into a 256px PNG, which sharp downscales // to a multi-size .ico. Rendered once per thread name and cached on disk.-const THREAD_TILE_GEN = 't1';+const THREAD_TILE_GEN = 't2'; const THREAD_TILE_DIR = path.join(os.tmpdir(), 'pup-thread-tiles', THREAD_TILE_GEN); let _fgFontB64 = null; function fgFontB64() {@@ -4304,34 +4303,50 @@ async function pngToIco(png256) { return Buffer.concat([header, dir, ...pngs.map(p => p.b)]); } const _threadTileInflight = new Map(); // name -> Promise (dedupe concurrent renders)-// Render (or return cached) the .ico path for a thread name. `browser` is any live puppeteer Browser-// (we open a throwaway 256x256 background page, screenshot the tile, close it). Cached on disk.-async function renderThreadTileIco(browser, name) {+// Render (or return cached) the .ico path for a thread name. v2.0.158: draw the tile on an OFFSCREEN+// CANVAS inside an EXISTING session page (`page`) — the FG font is injected via the FontFace API — so+// NO new window/tab is created and pup's window machinery has nothing to enumerate/adopt (the old+// browser.newPage() render spawned an OS window that triggered a birth/reclaim enum_windows storm).+// The canvas is never appended to the DOM and the page's own content/title are untouched (invisible,+// non-destructive). Returns a data-URL PNG that the bridge converts to a multi-size .ico.+async function renderThreadTileIco(page, name) { const icoPath = path.join(THREAD_TILE_DIR, `${threadSlug(name)}.ico`); try { if (fs.existsSync(icoPath) && fs.statSync(icoPath).size > 100) return icoPath; } catch (e) {} if (_threadTileInflight.has(name)) return _threadTileInflight.get(name); const job = (async () => {- if (!browser) { console.log(`[thread-tile] "${name}" NO browser passed`); return null; }- let page = null;+ if (!page) { console.log(`[thread-tile] "${name}" NO page passed`); return null; } try { fs.mkdirSync(THREAD_TILE_DIR, { recursive: true });- page = await browser.newPage();- console.log(`[thread-tile] "${name}" page created`);- await page.setViewport({ width: 256, height: 256, deviceScaleFactor: 1 });- await page.goto('data:text/html;base64,' + Buffer.from(threadTileHtml(name)).toString('base64'), { waitUntil: 'domcontentloaded', timeout: 8000 });- console.log(`[thread-tile] "${name}" html loaded`);- try { await page.waitForFunction('window.__tileReady === true', { timeout: 3000 }); } catch (e) {}- try { await page.evaluate(() => document.fonts && document.fonts.ready); } catch (e) {}- await new Promise(r => setTimeout(r, 120)); // let the post-font re-fit settle- const png = await page.screenshot({ clip: { x: 0, y: 0, width: 256, height: 256 }, type: 'png' });- console.log(`[thread-tile] "${name}" screenshot ${png && png.length}B`);+ const dataUrl = await withTimeout(page.evaluate(async (nm, fontB64) => {+ try {+ if (fontB64) { try { const f = new FontFace('FGtile', 'url(data:font/woff2;base64,' + fontB64 + ')'); await f.load(); document.fonts.add(f); } catch (e) {} }+ const box = 256, cv = document.createElement('canvas'); cv.width = box; cv.height = box;+ const ctx = cv.getContext('2d');+ ctx.fillStyle = '#00b8b1'; ctx.fillRect(0, 0, box, box);+ const fit = (text) => {+ const lines = text.split('\n'); let s = box * 0.9;+ for (let i = 0; i < 90; i++) { ctx.font = '700 ' + s + "px FGtile,'Segoe UI',sans-serif"; let w = 0; for (const ln of lines) w = Math.max(w, ctx.measureText(ln).width); if (w <= box * 0.86 && lines.length * s * 0.95 <= box * 0.86) break; s *= 0.95; }+ return s;+ };+ const cands = [nm]; const sp = nm.lastIndexOf(' '), hy = nm.indexOf('-');+ if (sp > 0) cands.push(nm.slice(0, sp) + '\n' + nm.slice(sp + 1)); else if (hy > 0) cands.push(nm.slice(0, hy + 1) + '\n' + nm.slice(hy + 1));+ if (sp < 0 && hy < 0 && nm.length >= 7) { const m = Math.ceil(nm.length / 2); cands.push(nm.slice(0, m) + '\n' + nm.slice(m)); }+ let best = nm, bf = 0; for (const t of cands) { const f = fit(t); if (f > bf) { bf = f; best = t; } }+ ctx.font = '700 ' + bf + "px FGtile,'Segoe UI',sans-serif"; ctx.fillStyle = '#05221f'; ctx.textAlign = 'center'; ctx.textBaseline = 'middle';+ const lines = best.split('\n'), lh = bf * 0.95, total = (lines.length - 1) * lh;+ lines.forEach((ln, i) => ctx.fillText(ln, box / 2, box / 2 - total / 2 + i * lh));+ return cv.toDataURL('image/png');+ } catch (e) { return null; }+ }, name, fgFontB64()), 8000, 'tile.evaluate');+ if (!dataUrl || dataUrl.indexOf('base64,') < 0) { console.log(`[thread-tile] "${name}" canvas render returned nothing`); return null; }+ const png = Buffer.from(dataUrl.split('base64,')[1], 'base64'); const ico = await pngToIco(png); if (!ico) { console.log(`[thread-tile] "${name}" pngToIco returned null (sharp missing?)`); return null; } fs.writeFileSync(icoPath, ico);- console.log(`[thread-tile] rendered tile for "${name}" -> ${icoPath} (${ico.length}B)`);+ console.log(`[thread-tile] rendered tile for "${name}" -> ${icoPath} (${ico.length}B, no window)`); return icoPath; } catch (e) { console.log(`[thread-tile] render failed for "${name}": ${e.message}`); return null; }- finally { try { if (page) await page.close({ runBeforeUnload: false }); } catch (e) {} _threadTileInflight.delete(name); }+ finally { _threadTileInflight.delete(name); } })(); _threadTileInflight.set(name, job); return job;