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 overlay badges properly — three separate root causes, all mine. (1) WRONG TAB: pup picked the favicon source from its OWN session.activeTabId bookkeeping, which drifts out of sync the moment the user switches tabs (the same drift that made the unstick misfire). John asked for 'the favicon from the chrome tab that's in the foreground' — new resolveVisibleTab() ASKS CHROME (exactly one tab per window reports visibilityState 'visible') and re-syncs the bookkeeping. (2) .ICO NEVER DECODED: sharp cannot read an .ico container, and the compositor only built a favicon layer when the source was NOT .ico — so every site serving favicon.ico rendered as the Adom mark ALONE with no site favicon (John's 3rd taskbar button). New icoLargestPng() parses the ICO directory, takes the largest entry and uses its embedded PNG, and the favicon layer now composites the DECODED bytes instead of re-decoding the raw container. (3) file:// FAVICONS UNFETCHABLE: the bridge fetches favicons over HTTP, but a local-file page's favicon href is itself file://, which Node's fetch cannot retrieve — so local-file windows lost their icon entirely and rendered NO overlay (John's 1st taskbar button, whose tab plainly had a favicon). The bridge runs on the same machine, so it now reads those off disk. Also composites at 48px like the working adom-browser-extension badge builder (compositing at 32 and letting Windows shrink to the ~16px slot turned both images to mush) with the Adom mark at a fixed 3/8 proportion so it is identical on every window.
4 files changed
+98−11
adom-bridge-puppeteer-manifest.json+4−4@@ -1,10 +1,10 @@ { "manifest_version": 1, "name": "puppeteer",- "version": "1.9.202",- "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.202/adom-bridge-puppeteer-v1.9.202.zip",- "sha256": "2b748afa8f4e1e9cb642b982828ddd1f9445fee7392aa1f16f31175a06313ba6",- "size": 434684,+ "version": "1.9.204",+ "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.204/adom-bridge-puppeteer-v1.9.204.zip",+ "sha256": "a05da4a88441e30d1db7ce76d6487273943b59587690fbb9c84bc9c3955e2bc5",+ "size": 436491, "verbPrefixes": [ "browser_", "desktop_recorder_",
src/BRIDGE_VERSION+1−1@@ -1 +1 @@-1.9.202+1.9.204
src/bridge.json+1−1@@ -2,7 +2,7 @@ "manifest_version": 1, "name": "puppeteer", "displayName": "Puppeteer (Chrome for Testing + Native)",- "version": "1.9.202",+ "version": "1.9.204", "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+92−5@@ -3818,6 +3818,21 @@ async function fetchPageFavicon(page) { } continue; }+ // v1.9.204: a file:// page's favicon href is itself file:// — Node's fetch CANNOT fetch that,+ // so every local-file window silently lost its icon and rendered no overlay at all (John's first+ // taskbar button). The bridge runs on the SAME machine as Chrome, so just read it off disk.+ if (/^file:/i.test(href)) {+ try {+ const fp = decodeURIComponent(new URL(href).pathname).replace(/^\/([A-Za-z]:)/, '$1');+ const buf = fs.readFileSync(fp);+ if (buf && buf.length) {+ const ext = (fp.split('.').pop() || '').toLowerCase();+ const mime = ext === 'ico' ? 'image/x-icon' : ext === 'svg' ? 'image/svg+xml' : ext === 'jpg' || ext === 'jpeg' ? 'image/jpeg' : 'image/png';+ return { b64: buf.toString('base64'), mime, href };+ }+ } catch (e) {}+ continue;+ } const r = await fetch(href, { redirect: 'follow', signal: AbortSignal.timeout(4000) }); if (!r || !r.ok) continue; const buf = Buffer.from(await r.arrayBuffer());@@ -3828,6 +3843,58 @@ async function fetchPageFavicon(page) { return null; } const _appOverlayCache = new Map(); // sessionId -> composited b64+// v1.9.204 (John: "the active tab in that first taskbar icon is this you fucktard" — a tab that+// plainly HAS a favicon, while pup reported "no favicon on the active tab"). ROOT CAUSE: pup picked+// the tab from its OWN bookkeeping (session.activeTabId), which drifts out of sync the moment the user+// switches tabs themselves — the same drift that made the unstick misfire. He asked for "the favicon+// from the chrome tab that's in the foreground", so ASK CHROME: in a given window exactly one tab+// reports document.visibilityState === 'visible', and that IS the active tab.+async function resolveVisibleTab(session) {+ const tabs = (session.tabs || []).filter(t => t && t.page && !t._crashed);+ if (!tabs.length) return null;+ if (tabs.length === 1) return tabs[0];+ for (const t of tabs) {+ try {+ const v = await withTimeout(t.page.evaluate('document.visibilityState'), 1200, 'vis');+ if (v === 'visible') return t;+ } catch (e) {}+ }+ return (session.tabs || []).find(t => t.tabId === session.activeTabId) || tabs[0];+}++// v1.9.203 (John: "in the 3rd taskbar icon you only have the little teal adom favicon and not the+// main favicon from the active tab"). ROOT CAUSE: sharp CANNOT decode .ico, and the compositor only+// built the favicon layer when the source was NOT an .ico — so every site serving favicon.ico silently+// lost its favicon and the badge rendered as the Adom mark alone. Most modern .ico files embed a PNG+// per size, so parse the container, take the LARGEST entry, and hand its PNG bytes to sharp.+// ICO layout: 6-byte header (count at offset 4), then 16-byte directory entries+// (w,h,colors,rsv,planes,bpp,bytesLE@8,offsetLE@12).+function icoLargestPng(buf) {+ try {+ if (!buf || buf.length < 22) return null;+ if (buf.readUInt16LE(0) !== 0 || buf.readUInt16LE(2) !== 1) return null; // not an ICO+ const n = buf.readUInt16LE(4);+ if (!n) return null;+ let best = null;+ for (let i = 0; i < n; i++) {+ const e = 6 + i * 16;+ if (e + 16 > buf.length) break;+ const w = buf[e] === 0 ? 256 : buf[e];+ const h = buf[e + 1] === 0 ? 256 : buf[e + 1];+ const size = buf.readUInt32LE(e + 8);+ const off = buf.readUInt32LE(e + 12);+ if (off + size > buf.length || size <= 0) continue;+ const area = w * h;+ if (!best || area > best.area) best = { area, off, size };+ }+ if (!best) return null;+ const data = buf.subarray(best.off, best.off + best.size);+ // PNG-in-ICO (the common modern case) — usable directly.+ if (data.length > 8 && data[0] === 0x89 && data[1] === 0x50 && data[2] === 0x4e && data[3] === 0x47) return data;+ return null; // BMP/DIB-encoded entry — sharp can't read it either; caller falls back+ } catch (e) { return null; }+}+ async function applyAppOverlay(session, sessionId) { // v1.9.191 (John): overlays are the GENTLE branding path and are ALLOWED in minimal-touch. // ITaskbarList3::SetOverlayIcon paints a badge onto the EXISTING taskbar button; it never@@ -3838,8 +3905,12 @@ async function applyAppOverlay(session, sessionId) { try { // v1.9.0: reflect the ACTIVE tab (John: favicons are more useful than counts — show what // the user is looking at). Falls back to session.page.- const activeTab = (session.tabs || []).find(t => t.tabId === session.activeTabId) || (session.tabs || [])[0];+ // v1.9.204: the ACTUALLY-visible tab, per Chrome — not pup's possibly-stale activeTabId.+ const activeTab = (await resolveVisibleTab(session)) || (session.tabs || [])[0]; const activePage = (activeTab && activeTab.page) || session.page;+ if (activeTab && activeTab.tabId && session.activeTabId !== activeTab.tabId) {+ session.activeTabId = activeTab.tabId; // keep bookkeeping honest for everything downstream+ } let src = session._appIconB64 ? { b64: session._appIconB64, mime: session._appIconMime || 'image/png' } : null; if (!src) src = await fetchPageFavicon(activePage); if (!src || !src.b64) {@@ -3883,7 +3954,14 @@ async function applyAppOverlay(session, sessionId) { // .ico can't be decoded by sharp — when we NEED the green plate, fall back to drawing // the plate alone rather than losing the signal entirely. let iconPng = null;- if (!isIco) {+ // v1.9.203: an .ico source now yields a real favicon layer via the extractor above.+ if (isIco) {+ try {+ const inner = icoLargestPng(Buffer.from(src.b64, 'base64'));+ if (inner) iconPng = await sharpMod(inner).resize(48, 48, { fit: 'cover' }).png().toBuffer();+ } catch (e) { iconPng = null; }+ }+ if (!iconPng && !isIco) { try { iconPng = await sharpMod(Buffer.from(src.b64, 'base64')).resize(22, 22, { fit: 'inside' }).png().toBuffer(); } catch (e) { iconPng = null; } } // v1.9.191 (John's design): a TRULY BRANDED badge = the page's own favicon as the main@@ -3900,9 +3978,18 @@ async function applyAppOverlay(session, sessionId) { // exact look it was designed with (no tinted card behind it), and the corner mark carries // the branding. The mark sits on a small dark disc purely so it stays readable over busy // or light favicon artwork at ~16px.- let img = sharpMod({ create: { width: 32, height: 32, channels: 4, background: { r: 0, g: 0, b: 0, alpha: 0 } } });+ // v1.9.203 (John: "these overlay icons are a disaster"): composite at 48px, not 32px — the+ // same size the WORKING adom-browser-extension badge builder uses. The badge renders in a+ // ~16px taskbar slot, so compositing small and letting Windows shrink it turned both images+ // to mush. Build big, downscale once, and size the Adom mark as a fixed PROPORTION (3/8 of+ // the badge) so it is identical on every window instead of varying with each favicon's+ // internal padding.+ const BSZ = 48, MSZ = 18; // 18/48 = 3/8+ let img = sharpMod({ create: { width: BSZ, height: BSZ, channels: 4, background: { r: 0, g: 0, b: 0, alpha: 0 } } }); const layers = [];- if (iconPng) layers.push({ input: await sharpMod(Buffer.from(src.b64, 'base64')).resize(32, 32, { fit: 'inside' }).png().toBuffer(), gravity: 'northwest' });+ // Use the ALREADY-DECODED bytes — re-decoding src.b64 here is what broke .ico (sharp throws+ // on the raw container), silently dropping the favicon and leaving the Adom mark alone.+ if (iconPng) layers.push({ input: await sharpMod(iconPng).resize(BSZ, BSZ, { fit: 'cover' }).png().toBuffer(), gravity: 'northwest' }); try { const markB64 = pupBadgeB64(); if (markB64) {@@ -3910,7 +3997,7 @@ async function applyAppOverlay(session, sessionId) { // don't inset our favicon like i just saw you do"). NO disc, NO container. The Adom // favicon itself occupies the lower-right QUADRANT, whole and flush to both edges // (16x16 at 16,16 on the 32x32 badge), sitting directly on the page's own favicon.- layers.push({ input: await sharpMod(Buffer.from(markB64, 'base64')).resize(16, 16, { fit: 'fill' }).png().toBuffer(), top: 16, left: 16 });+ layers.push({ input: await sharpMod(Buffer.from(markB64, 'base64')).resize(MSZ, MSZ, { fit: 'fill' }).png().toBuffer(), top: BSZ - MSZ, left: BSZ - MSZ }); } } catch (e) { /* no mark available — favicon-only badge still valid */ } if (layers.length) img = img.composite(layers);