← Commit history

v2.0.366: Emulation is measured, not remembered (project-a5): recovery wiped the override record while Chrome kept the override, so every check keyed off that record passed vacuously. innerWidth versus outerWidth is now the ground truth, recovery re-derives the record, and pup_my_windows finally reports it.

John Lauer ·ff370ddf8b ·1mo ago ·parent ce6caf7
5 files changed +63−12
adom-bridge-puppeteer-manifest.json+5−5
@@ -1,10 +1,10 @@ {   "manifest_version": 1,   "name": "puppeteer",-  "version": "2.0.365",-  "url": "https://wiki.adom.inc/download/adom/pup-bridge/2.0.365/adom-bridge-puppeteer-v2.0.365.zip",-  "sha256": "abc55cea839d6ad0cce98a8898427f0ec92a425b997e7d340d9f8d226bcb92f5",-  "size": 1532144,+  "version": "2.0.366",+  "url": "https://wiki.adom.inc/download/adom/pup-bridge/2.0.366/adom-bridge-puppeteer-v2.0.366.zip",+  "sha256": "0b1800bcf45efbac23a7865b3409f6442b23698fbe468bead8b5a11eaad14ab3",+  "size": 1533384,   "verbPrefixes": [     "browser_",     "desktop_recorder_",@@ -12,5 +12,5 @@   ],   "healthEndpoint": "/status",   "statusVerb": "browser_readiness",-  "released_at": "2026-08-28T10:36:26.089217Z"+  "released_at": "2026-08-28T10:40:30.512960Z" }
package.json+1−1
@@ -1,6 +1,6 @@ {   "slug": "pup-bridge",-  "version": "2.0.365",+  "version": "2.0.366",   "type": "app",   "description": "The pup SKILL PACK \u2014 the AI skills that teach a cloud/container AI how to drive the Adom Desktop Puppeteer (pup) bridge (browser_* verbs): the everyday `pup` skill plus focused sub-skills for windows/sessions/tabs, screenshots+recording, browsers+Chrome install, and driving the Adom wiki. Installs into ~/.claude/skills + ~/.codex/skills. DOCS ONLY \u2014 this is NOT the bridge runtime. The bridge itself (the Node program that drives the browser) runs on the DESKTOP: Adom Desktop bundles it and auto-installs/updates it, and it's published separately on the Releases tab as adom-bridge-puppeteer-v<ver>.zip. The pkg version is kept in lockstep with the Release version so the page's max version row always carries BOTH a pkg tarball (skills) and a runtime zip (bridge) \u2014 a skills-only or runtime-only bump on the top row breaks constraint installs. TL;DR: pkg install = the skills for your AI; the bridge = the Release zip, which Adom Desktop manages for you.",   "keywords": [
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-2.0.365\ No newline at end of file+2.0.366\ No newline at end of file
src/bridge.json+1−1
@@ -2,7 +2,7 @@   "manifest_version": 1,   "name": "puppeteer",   "displayName": "Puppeteer (Chrome for Testing + Native)",-  "version": "2.0.365",+  "version": "2.0.366",   "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+55−4
@@ -2519,6 +2519,23 @@ async function recoverSessions() {         // Re-writing it here is idempotent and costs one in-process SetProp, and it means a machine         // carrying untagged windows heals on its next restart rather than staying unresolvable.         tagWindowSession(Number(sf._hwnd), sessionId).catch(() => {});+        // v2.0.366 (project-a5): RE-DERIVE THE EMULATION. Recovery restored the window but not its+        // emulation record, and Chrome keeps the CDP override because it lives in the browser. The+        // record defaulted to null, so every consumer confidently reported "not emulated" about a+        // window that was. Measure it back rather than guessing: a page whose innerWidth diverges+        // from its outerWidth is emulated, whatever pup happens to remember.+        (async () => {+          try {+            const t0 = (session.tabs || [])[0];+            if (!t0 || !t0.page) return;+            const m = await measureViewport(t0.page);+            if (m && m.emulated) {+              session._emulatedViewport = { width: m.innerWidth, height: m.innerHeight, deviceScaleFactor: m.devicePixelRatio, derived: true };+              session._lastOuterWidth = m.outerWidth;+              console.log(`[recovery] "${sessionId}" is still EMULATED at ${m.innerWidth}x${m.innerHeight} in a ${m.outerWidth}px window — record re-derived (it does not survive recovery on its own)`);+            }+          } catch (e) {}+        })();         // #80: tell this session it went through a restart, and how many tabs came back, so a         // thread that opened three and finds one knows WHY rather than concluding pup ate them.         const _tabsBack = (session.tabs || []).length;@@ -12045,6 +12062,31 @@ function bugReportInvite(isError) { // Resolve the session a response is ABOUT, from the caller's own addressing. pup's documented forms // are zero-id (resolve by ai-thread), {window:"..."} and the legacy {sessionId:"..."}, so all three // have to be honoured or a notice fires only for whichever form the author happened to test.+// GROUND TRUTH FOR EMULATION, measured rather than remembered (project-a5, 2026-08-28).+// pup used to answer "is this window emulated?" from its own record, and a RECOVERED window resets+// that record to null while Chrome keeps the CDP device-metrics override, because the override+// lives in the browser and not in pup. Every consumer then agreed the window was fine: the listings+// reported no override, the warning never fired, and reset's guard compared against nothing and+// passed vacuously with emulated:false while the page was demonstrably still 2200px wide in a+// 1688px window.+// outerWidth is the one number an override cannot fake, so the divergence IS the answer and needs+// no bookkeeping to survive a recovery. A real window's inner is a little smaller than its outer+// (borders, scrollbar); an emulated one is either far smaller or, in the cropping case, LARGER.+const EMULATION_SLACK = 60;+function looksEmulated(innerWidth, outerWidth) {+  if (!innerWidth || !outerWidth) return false;+  if (innerWidth > outerWidth + 2) return true;            // wider than the window: content cropped+  return (outerWidth - innerWidth) > EMULATION_SLACK;      // far narrower: dead space beside it+}+async function measureViewport(page) {+  try {+    const d = await page.evaluate(() => ({+      innerWidth: window.innerWidth, innerHeight: window.innerHeight,+      outerWidth: window.outerWidth, devicePixelRatio: window.devicePixelRatio,+    }));+    return { ...d, emulated: looksEmulated(d.innerWidth, d.outerWidth) };+  } catch (e) { return null; }+} function sessionForResponse(obj, argsIn) {   try {     const a = argsIn || {};@@ -15530,7 +15572,11 @@ const server = http.createServer(async (req, res) => {               try { tiM = await Promise.race([tM.page.title(), new Promise(r => setTimeout(() => r(null), 800))]); } catch (e) {}               tabsM.push({ tabId: tM.tabId, url: uM, title: tiM, active: tM.tabId === sM.activeTabId });             }-            wins.push({ window: sid, profile: sM.profileName, notYou: /^iso-/.test(sM.profileName || ''), lostBrowser: !!sM._lostBrowser, createdMinAgo: sM.createdAt ? Math.round((Date.now() - sM.createdAt) / 60000) : null, lastAgentUpdate: sM._lastAgentUpdate || null, tabs: tabsM });+            // emulatedViewport belongs HERE too (project-a5): pup_my_windows advertises itself as+            // "full state of everything your thread owns" and is the verb an AI reaches for first,+            // but it was the one listing that omitted the override entirely, so the first place you+            // look was the one place it could not tell you.+            wins.push({ window: sid, profile: sM.profileName, notYou: /^iso-/.test(sM.profileName || ''), lostBrowser: !!sM._lostBrowser, createdMinAgo: sM.createdAt ? Math.round((Date.now() - sM.createdAt) / 60000) : null, lastAgentUpdate: sM._lastAgentUpdate || null, emulatedViewport: sM._emulatedViewport || null, tabs: tabsM });           }           sendJSON(res, { success: true, output: JSON.stringify({ ok: true, 'ai-thread': who, windows: wins,             _hint: wins.length ? `These are ${who === _callerThread ? 'your' : `${who}'s`} windows. Target them with NO ids: any pup verb without sessionId resolves to your own thread's window (or address any thread via "ai-thread"). pup_screenshot {} to see it; pup_reload {} to refresh it; tab verbs take tabId.`@@ -17178,15 +17224,20 @@ const server = http.createServer(async (req, res) => {                 innerWidth: window.innerWidth, innerHeight: window.innerHeight,                 outerWidth: window.outerWidth, devicePixelRatio: window.devicePixelRatio,               }));-              // If it still reads as the width we just removed, the clear did NOT take. Say so.-              if (_prev && Math.abs(dims.innerWidth - _prev) <= 2) {+              // Verify by MEASUREMENT. The old check compared against the remembered override+              // width, so on a recovered window (record wiped, override live) there was nothing to+              // compare against and it passed vacuously. innerWidth vs outerWidth cannot be fooled+              // that way, and it also catches the case where the record was never there at all.+              const _stillEmulated = looksEmulated(dims.innerWidth, dims.outerWidth)+                || (_prev && Math.abs(dims.innerWidth - _prev) <= 2);+              if (_stillEmulated) {                 sendJSON(res, { success: false, error: `the viewport override did not clear: the page still reports innerWidth ${dims.innerWidth}, which is the override width`,                   errorCode: 'viewport_reset_failed',                   output: JSON.stringify({ ok: false, sessionId: resolvedId, tabId, emulated: true, ...dims }),                   _hint: `pup could not remove the emulation from this window. Close and reopen it (pup_close_window then pup_open_window) — a fresh window reports the real size. Do NOT trust in-page measurements from this window meanwhile: the page believes it is ${dims.innerWidth}px wide while the OS window is ${dims.outerWidth}px, so the user is seeing it cropped.` });                 return;               }-              sendJSON(res, { success: true, output: JSON.stringify({ ok: true, sessionId: resolvedId, tabId, reset: true, emulated: false, ...dims,+              sendJSON(res, { success: true, output: JSON.stringify({ ok: true, sessionId: resolvedId, tabId, reset: true, emulated: looksEmulated(dims.innerWidth, dims.outerWidth), ...dims,                 _hint: `Viewport override CLEARED — this window tracks the real OS window again (innerWidth now ${dims.innerWidth}, dpr ${dims.devicePixelRatio}). Resizing the window will reflow the page normally.` }) });             } catch (e) { sendJSON(res, { success: false, error: `clearing the viewport override failed: ${e.message}` }); }             return;