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
Hard window ownership keyed on caller identity: every window-mutating verb naming an explicit sessionId is refused with session_owned_by_another_thread when that session belongs to a different AI thread (the old gate compared only the optional args.owner field and covered just navigate and close, so undeclared callers could take over other threads' windows, the kicad-vs-nb incident John caught); takeover:true is logged with both thread names and reassigns ownership. Ownership is now user-visible too: the ai-thread title tag defaults on so taskbar hover and Alt-Tab name the owner, and the jump-list header carries the owning thread
4 files changed
+58−8
adom-bridge-puppeteer-manifest.json+4−4@@ -1,10 +1,10 @@ { "manifest_version": 1, "name": "puppeteer",- "version": "2.0.17",- "url": "https://wiki.adom.inc/download/adom/pup-bridge/2.0.17/adom-bridge-puppeteer-v2.0.17.zip",- "sha256": "83af2a53eace1adc6bc8b198a7daf1bc37471408a2d5f60175af417ebcc2aa41",- "size": 643632,+ "version": "2.0.19",+ "url": "https://wiki.adom.inc/download/adom/pup-bridge/2.0.19/adom-bridge-puppeteer-v2.0.19.zip",+ "sha256": "527b75452b4882dbcb535499937d305e99493ead35117f6e54199c1736076a2b",+ "size": 644821, "verbPrefixes": [ "browser_", "desktop_recorder_",
src/BRIDGE_VERSION+1−1@@ -1 +1 @@-2.0.17+2.0.19
src/bridge.json+1−1@@ -2,7 +2,7 @@ "manifest_version": 1, "name": "puppeteer", "displayName": "Puppeteer (Chrome for Testing + Native)",- "version": "2.0.17",+ "version": "2.0.19", "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+52−2@@ -3065,7 +3065,11 @@ function pupSettings() { // default. titleTag = the "(ai-thread: X)" resolution suffix (pup resolves transiently while the // window is off-screen when this is off, so titles stay clean and window-finding still works); // titlePrefix = the "<thread> · " cosmetic prefix at the start.- D.titleTag = 'off'; D.titlePrefix = 'off';+ // v2.0.19 (John: "is there a better way to convey which pup window is owned by which+ // ai-thread?"): titleTag default ON — the "(ai-thread: X)" title suffix is what the taskbar+ // hover and Alt-Tab show, so ownership is readable without opening the window. (It also makes+ // title-based hwnd resolution deterministic.) titlePrefix stays off.+ D.titleTag = 'on'; D.titlePrefix = 'off'; if (_pupSettings.autoLogin === 'off' && !chosen.autoLogin) _pupSettings.autoLogin = 'on'; // v1.9.260 (John: "2s feels too fast cuz i can't read"): readable default. A stored 2000 was the // old default, not a choice made in the dialog (it shipped hours ago) - migrate it up once.@@ -3125,7 +3129,13 @@ function pupDisplayName(sessionId) { try { const cat = sessionId ? pupCategory(sessionId) : null; const mode = cat && CAT_MODE_SHORT[cat];- return mode ? `${PUP_DISPLAY_NAME} · ${mode}` : PUP_DISPLAY_NAME;+ let name = mode ? `${PUP_DISPLAY_NAME} · ${mode}` : PUP_DISPLAY_NAME;+ // v2.0.19 (John): the jump-list header + pin name carry the OWNING AI THREAD, so a right-click+ // on any pup taskbar button answers "whose window is this" even with the title tag off.+ const s = sessionId && sessions.get(sessionId);+ const own = s && (s.owner || s._ownerThread);+ if (own) name += ` · ${String(own).replace(/^ai[- ]/i, '').slice(0, 28)}`;+ return name; } catch (e) { return PUP_DISPLAY_NAME; } } let _identitySupported = null; // null = unprobed@@ -10490,6 +10500,46 @@ const server = http.createServer(async (req, res) => { // call-time URL lint works on every render verb, including ones that don't echo the url back. try { res._lintUrl = args && args.url; res._callerContainer = _callerContainer; } catch (e) {} + // v2.0.19 (John: "the kicad thread just took over a pup window owned by the nb thread...+ // force it to only work with its own pup window"): HARD OWNERSHIP, keyed on the CALLER+ // IDENTITY ab already forces on every verb. The old advisory gate compared only the OPTIONAL+ // args.owner field ("anonymous callers pass"), and gated just navigate/close — so any thread+ // that simply didn't declare an owner could drive, retab, or close another thread's window.+ // Now: every window-mutating verb that names an explicit sessionId is REFUSED when that+ // session belongs to a different AI thread, unless takeover:true — which is allowed only for+ // when the user explicitly asked, is logged loudly with both thread names, and reassigns+ // ownership so the trail stays honest. Read verbs (screenshot, list, status, errors) stay+ // open so threads can observe each other's windows without disturbing them. Runs BEFORE the+ // ownership-record block so a refused caller never pollutes lastDrivenBy attribution.+ {+ const OWNER_GATED = MUTATING_VERBS.has(command)+ || ['pup_close_tab', 'pup_close_window', 'pup_close', 'pup_configure', 'pup_focus_window',+ 'pup_raise_os_window', 'pup_lower_os_window', 'pup_alert_window', 'pup_wiki_set_view',+ 'pup_record_start', 'pup_record_stop'].includes(command);+ if (OWNER_GATED && args && args.sessionId && _callerThread) {+ const _gs = sessions.get(args.sessionId);+ const _owner = _gs && (_gs.owner || _gs._ownerThread);+ if (_gs && _owner && _owner !== _callerThread) {+ if (args.takeover) {+ console.log(`[takeover] "${args.sessionId}": thread "${_callerThread}" TOOK OVER from "${_owner}" via ${command} (takeover:true — sanctioned only when the user asked)`);+ _gs._takenOverFrom = _owner; _gs._takenOverAt = Date.now();+ _gs.owner = _callerThread; _gs._ownerThread = _callerThread;+ } else {+ console.log(`[own] REFUSED ${command} on "${args.sessionId}" — owner "${_owner}", caller "${_callerThread}"`);+ let _curUrl = null; try { _curUrl = _gs.page?.url() || null; } catch (e) {}+ sendJSON(res, {+ success: false,+ errorCode: 'session_owned_by_another_thread',+ error: `Session "${args.sessionId}" belongs to AI thread "${_owner}" — your thread ("${_callerThread}") cannot ${command} it.`,+ sessionId: args.sessionId, owner: _owner, requestedBy: _callerThread, currentUrl: _curUrl,+ _hint: `STOP — this window is owned by "${_owner}"; driving it would break that thread's work in front of the user. Open your OWN window instead: pup_open_window WITHOUT a sessionId gives your thread its own window (keyed on your --ai-thread name), or pass a unique task-prefixed sessionId. Only pass takeover:true if the USER explicitly told you to take this window over — every takeover is logged with both thread names.`,+ }, 409);+ return;+ }+ }+ }+ }+ // Record ownership on the session this verb targets: the FIRST thread to touch a session owns // it (that is the window's identity for the user); every later call refreshes lastDrivenBy so a // handoff is still visible rather than silently rewriting the owner.