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
Sleep/wake recovery, ungated (John, back after a day with the lid closed to a dashboard full of 'browser lost': 'a laptop going to sleep is quite a common occurrence so you need to make sure after a wake that you are able to get back to the previous state you were in'). ROOT CAUSE - the third victim of the gated-interval disease: the crash/lost-browser recovery loop lived inside the health interval whose first line is 'if (minimalTouch()) return', so in the normal mode NOTHING ever recovered a lost session; his three windows sat dead for a day while the machinery to revive them was one dead gate away. Fix: recovery moved to its OWN ungated 20s interval with sleep detection (a >90s gap between ticks = the machine slept; logged), recovering every _lostBrowser session via recoverOrRelaunchSession - reconnect if that profile's Chrome survived the sleep, else relaunch at the last URL with logins intact from disk, with the existing per-session backoff. The minimal-touch nuance is recorded so nobody re-gates it: minimal-touch forbids killing/restarting a LIVE Chrome behind the user's back; it does not forbid resurrecting DEAD windows - that restoration is exactly what the user wants. Hung-Chrome teardown (which kills) stays gated. The gated-interval disease (three victims: overlay enforcer, user-activity watcher, recovery) is now a named banned practice in dev-skills/pup-bridge-dev: every new loop gets its own interval with an explicit written gate decision.
4 files changed
+55−40
adom-bridge-puppeteer-manifest.json+4−4@@ -1,10 +1,10 @@ { "manifest_version": 1, "name": "puppeteer",- "version": "1.9.255",- "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.255/adom-bridge-puppeteer-v1.9.255.zip",- "sha256": "c45a4ecc84b800ac3857a3faf9f154c83aacfb3e117135dd8d2d6a78bcf65616",- "size": 472066,+ "version": "1.9.256",+ "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.256/adom-bridge-puppeteer-v1.9.256.zip",+ "sha256": "676574afd4e8c17736afbdaf8c465582793e1447265d5115dceab2221e168a29",+ "size": 472416, "verbPrefixes": [ "browser_", "desktop_recorder_",
src/BRIDGE_VERSION+1−1@@ -1 +1 @@-1.9.255+1.9.256
src/bridge.json+1−1@@ -2,7 +2,7 @@ "manifest_version": 1, "name": "puppeteer", "displayName": "Puppeteer (Chrome for Testing + Native)",- "version": "1.9.255",+ "version": "1.9.256", "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+49−34@@ -12444,6 +12444,55 @@ server.listen(PORT, BIND_HOST, async () => { const _healingIds = new Set(); // sessionIds with a relaunch in flight (guards the 15s re-tick) const MAX_HEAL_ATTEMPTS = 2; const HEAL_COOLDOWN_MS = 5 * 60 * 1000;+ // v1.9.256 SLEEP/WAKE + LOST-BROWSER RECOVERY (John, after a day away with the lid closed: "a+ // laptop going to sleep is quite a common occurrence so you need to make sure after a wake that+ // you are able to get back to the previous state you were in, i.e. all your browsers should not+ // be lost anymore"). His dashboard sat on 'browser lost' for a day because the crash-recovery+ // loop lived inside the minimalTouch-gated health interval - the THIRD critical feature silently+ // killed by that one gate (overlay enforcer, user-activity watcher, now recovery). Recovery runs+ // UNGATED here: minimal-touch forbids KILLING or RESTARTING a live Chrome behind the user's back;+ // it does not forbid resurrecting DEAD windows to restore the user's state - that restoration is+ // exactly what the user wants after a sleep. (Hung-Chrome teardown, which DOES kill, stays gated.)+ let _lastRecoveryTick = Date.now();+ setInterval(async () => {+ if (process.platform !== 'win32') return;+ const now = Date.now();+ const gap = now - _lastRecoveryTick;+ _lastRecoveryTick = now;+ if (gap > 90000) console.log(`[wake] system appears to have SLEPT ~${Math.round(gap / 60000)}min (timer gap) — checking every session for lost browsers`);+ for (const [sid, sess] of [...sessions]) {+ if (!sess._lostBrowser || _healingIds.has(sid)) continue;+ const rec = _healRelaunch.get(sid) || { count: 0, last: 0, gaveUp: false };+ if (rec.count >= MAX_HEAL_ATTEMPTS) {+ if (now - rec.last < HEAL_COOLDOWN_MS) {+ if (!rec.gaveUp) {+ rec.gaveUp = true; _healRelaunch.set(sid, rec);+ console.log(`[heal] "${sid}" exceeded ${MAX_HEAL_ATTEMPTS} relaunch attempts — backing off ${Math.round(HEAL_COOLDOWN_MS / 60000)}m`);+ recordCleanup(`pup tried to bring your "${sid}" window back but it kept failing — pup has stopped retrying for now. Reopen it manually when ready; your logins are safe on disk.`);+ }+ continue;+ }+ rec.count = 0; rec.gaveUp = false;+ }+ _healingIds.add(sid);+ rec.count += 1; rec.last = now; _healRelaunch.set(sid, rec);+ console.log(`[heal] "${sid}" browser lost (crash or sleep) — recovering (attempt ${rec.count}/${MAX_HEAL_ATTEMPTS}) at its last URL`);+ try {+ const r = await recoverOrRelaunchSession({ sessionId: sid });+ if (r && r.session) {+ console.log(`[heal] "${sid}" recovered — window is back, signed in, where it left off`);+ recordCleanup(`pup auto-recovered your "${sid}" window (lost to a crash or the machine sleeping) — relaunched in the background, signed in, at where it left off.`);+ } else {+ console.log(`[heal] "${sid}" recovery did not resolve a live session yet — will retry next tick`);+ }+ } catch (e) {+ console.log(`[heal] "${sid}" recovery failed: ${e.message} — will retry next tick`);+ } finally {+ _healingIds.delete(sid);+ }+ }+ }, 20000);+ // v1.9.255 NO-FAULT WATCH (John: "if the window does get foreground by chrome itself or a focus // or some other reason, you do watch it for 20 seconds and put up a caption saying something like // 'it wasn't my fault, the javascript, or focus, or chrome caused the foreground. not me!'").@@ -12528,40 +12577,6 @@ server.listen(PORT, BIND_HOST, async () => { try { await killOrphanChromesForProfile(profileName); } catch (e) {} for (const [, sess] of sessions) { if (sess.profileName === profileName) sess._lostBrowser = true; } }- // (1) CRASH recovery — proactively relaunch every `_lostBrowser` session (from a crash OR from the- // hung-teardown above) so the user's windows come back on their own, signed in, where they left off.- for (const [sid, sess] of [...sessions]) {- if (!sess._lostBrowser || _healingIds.has(sid)) continue;- const rec = _healRelaunch.get(sid) || { count: 0, last: 0, gaveUp: false };- const now = Date.now();- if (rec.count >= MAX_HEAL_ATTEMPTS) {- if (now - rec.last < HEAL_COOLDOWN_MS) {- if (!rec.gaveUp) {- rec.gaveUp = true; _healRelaunch.set(sid, rec);- console.log(`[heal] "${sid}" exceeded ${MAX_HEAL_ATTEMPTS} relaunch attempts — backing off ${Math.round(HEAL_COOLDOWN_MS/60000)}m (the page looks like it destabilizes Chrome)`);- recordCleanup(`pup tried to bring your "${sid}" window back after a Chrome crash but it kept crashing on load — that page may be destabilizing Chrome, so pup has stopped retrying it. Reopen it manually when you're ready; your logins are safe on disk.`);- }- continue;- }- rec.count = 0; rec.gaveUp = false; // cooldown elapsed — allow a fresh round- }- _healingIds.add(sid);- rec.count += 1; rec.last = now; _healRelaunch.set(sid, rec);- console.log(`[heal] "${sid}" lost to a Chrome crash — proactively relaunching (attempt ${rec.count}/${MAX_HEAL_ATTEMPTS}) at its last URL`);- try {- const r = await recoverOrRelaunchSession({ sessionId: sid });- if (r && r.session) {- console.log(`[heal] "${sid}" relaunched OK — window is back signed-in`);- recordCleanup(`pup auto-recovered your "${sid}" window after a Chrome crash — it relaunched in the background, signed in, at where it left off (logins are safe on disk).`);- } else {- console.log(`[heal] "${sid}" relaunch did not resolve a live session yet — will retry next tick`);- }- } catch (e) {- console.log(`[heal] "${sid}" relaunch failed: ${e.message} — will retry next tick`);- } finally {- _healingIds.delete(sid);- }- } // (3) USER-ACTIVITY WATCHER + STUCK-OCCLUSION check (v1.9.180/181). One OS foreground read per // tick. When the foreground IS a pup window: (a) stamp it user-active + foreground (PERSISTED), // so no park/recovery/adoption path ever demotes a window the user chose to bring up — the