← Commit history

Make pup insist the AI LOOKS at what it just rendered (John's ask). The common failure: an AI generates or edits an app, opens it in pup, sees ok:true, and reports success to the user without ever screenshotting the result — but ok:true only means the NAVIGATION worked, it says nothing about whether the page painted, whether CSS loaded, or whether a stack trace is filling the viewport. browser_open_window / browser_open_tab / browser_navigate / browser_reload now return a _verifyRender instruction with the exact browser_screenshot command, a concrete checklist of what to look for (blank page, unstyled HTML, error overlay, missing images, broken layout, Cannot GET, wrong build), and the ralph-test loop: fix, reload, screenshot AGAIN until the render is genuinely correct. Wording escalates when the URL looks like the caller's own work in progress (localhost, a LAN IP, file://, .adom.cloud, .local — classifier unit-tested 7/7), which is exactly the case John described. Success responses only; never overwrites a handler that already spoke about verification.

John Lauer ·49513d4bb6 ·3mo ago ·parent 237229a
4 files changed +51−6
adom-bridge-puppeteer-manifest.json+4−4
@@ -1,10 +1,10 @@ {   "manifest_version": 1,   "name": "puppeteer",-  "version": "1.9.98",-  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.98/adom-bridge-puppeteer-v1.9.98.zip",-  "sha256": "398779e5131d2896cdbcaa77bbb49187a06d4a454f0b8dcbc1c76342bd98fbf1",-  "size": 370751,+  "version": "1.9.99",+  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.99/adom-bridge-puppeteer-v1.9.99.zip",+  "sha256": "474d6c139d2b6f8b7a89f03050b5e87cf992d7e4704a34b6a59f8665a91f9ff0",+  "size": 372000,   "verbPrefixes": [     "browser_",     "desktop_recorder_",
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-1.9.98+1.9.99
src/bridge.json+1−1
@@ -2,7 +2,7 @@   "manifest_version": 1,   "name": "puppeteer",   "displayName": "Puppeteer (Chrome for Testing + Native)",-  "version": "1.9.98",+  "version": "1.9.99",   "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+45
@@ -5661,6 +5661,40 @@ const VERB_META = { //   • Occasionally after that (every Nth call) — a quiet reminder on a long-running session. // Opt out with pup settings {reportIssues:"off"} for a user who doesn't want it. const PUP_ISSUES_REF = 'adom/adom-desktop-puppeteer-bridge';+// ─── "You just put something on screen — LOOK at it" (v1.9.99, John's ask) ──────────────────────+// The common failure: an AI generates or edits an app, opens it in pup, sees ok:true, and reports+// success to the user WITHOUT ever looking at the render. ok:true means the NAVIGATION worked. It+// says nothing about whether the page painted, whether the CSS loaded, or whether a stack trace is+// filling the viewport. pup is the one component that knows a window was just pointed at content,+// so it is the right place to insist on verification — in the response the AI actually reads.+const RENDER_VERBS = new Set(['browser_open_window', 'browser_open_tab', 'browser_navigate', 'browser_reload']);+// A URL that is almost certainly the caller's OWN work-in-progress (a dev server, a local file, an+// Adom-hosted app) earns the strongest wording — that is exactly the case John described.+function looksLikeOwnContent(u) {+  try {+    if (!u) return false;+    if (/^file:/i.test(u)) return true;+    const h = new URL(u).hostname;+    return /^(localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\])$/i.test(h)+        || /\.local$/i.test(h)+        || /\.adom\.cloud$/i.test(h)+        || /^(\d{1,3}\.){3}\d{1,3}$/.test(h);+  } catch (e) { return false; }+}+function renderVerifyHint(sessionId, url) {+  const sid = sessionId || '<sessionId>';+  const own = looksLikeOwnContent(url);+  const lead = own+    ? 'THIS LOOKS LIKE CONTENT YOU JUST BUILT OR EDITED — SCREENSHOT IT AND LOOK BEFORE YOU CLAIM IT WORKS.'+    : 'VERIFY WHAT YOU JUST PUT ON SCREEN — do not assume it rendered.';+  return `${lead} ok:true means the NAVIGATION succeeded; it says NOTHING about whether the page actually painted. `+    + `Take a screenshot and READ the image: \`adom-desktop browser_screenshot {"sessionId":"${sid}"}\` — it returns a real PNG path you can open. `+    + `Look for: a blank or white page, an unstyled flash of plain HTML (CSS never loaded), a stack trace or framework error overlay, `+    + `missing images, a broken or overlapping layout, content cut off past the fold, a dev-server "Cannot GET /" page, or the wrong build entirely. `+    + `If it is wrong: fix the source, \`browser_reload\`, and screenshot AGAIN — ralph-test that loop until the render is genuinely correct, `+    + `rather than reporting success after one open. If the viewport is too small to judge, browser_set_viewport first; `+    + `for a long page use browser_screenshot {fullPage:true}. Showing the user a screenshot of their own working app is also the fastest way to prove it works.`;+} let _bugInviteCalls = 0; let _bugInviteFirstDone = false; const BUG_INVITE_EVERY = 40;@@ -5740,6 +5774,17 @@ function sendJSON(res, obj, status = 200) {         const inner = JSON.parse(obj.output);         if (inner && typeof inner === 'object' && !Array.isArray(inner)) {           let touched = false;+          // v1.9.99: on a verb that just pointed a window at content, insist the caller LOOK at it.+          // Only on success (a failure has its own errorCode + hint to act on first), and never+          // overwriting a handler that already said something about verification.+          try {+            const _v = res && res._adomCommand;+            const _ok = inner.ok !== false && obj.success !== false && !obj.errorCode;+            if (_v && RENDER_VERBS.has(_v) && _ok && inner._verifyRender === undefined) {+              inner._verifyRender = renderVerifyHint(inner.sessionId || (obj && obj.sessionId), inner.url || (obj && obj.url));+              touched = true;+            }+          } catch (e) {}           for (const k of ['_reportIssues', '_hint', '_next', 'related', 'pitfalls']) {             if (obj[k] !== undefined && inner[k] === undefined) { inner[k] = obj[k]; touched = true; }           }