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
Complete the caller-identity delegation chain on pup's side (AD 1.9.183 contract). AD fixed its half (it no longer drops X-Adom-Caller-* on the bridge's loopback callback), but the bridge half is not automatic and pup was not doing it: every AD verb pup calls back on a thread's behalf now carries X-Adom-Caller-Delegate:'pup' (unconditional — that is what turns a nameless 'via bridge' into '<thread> (via pup)'), and the 10 session-scoped callbacks that resolve a window by its session tag now forward the OWNING thread + container via a new sessionCaller() helper. Per the contract, a bridge must NOT forward a stale identity when acting on its own behalf, so pup's timers, sweeps and health polls deliberately pass no caller and read honestly as pup's own work. All of it stays self-reported and authorizes nothing.
5 files changed
+47−17
adom-bridge-puppeteer-manifest.json+4−4@@ -1,10 +1,10 @@ { "manifest_version": 1, "name": "puppeteer",- "version": "1.9.103",- "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.103/adom-bridge-puppeteer-v1.9.103.zip",- "sha256": "857266cdc9e15637c8d293a368e821d7c08afff4d9b36a29a17ac37962a2771e",- "size": 374488,+ "version": "1.9.104",+ "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.104/adom-bridge-puppeteer-v1.9.104.zip",+ "sha256": "78648acde846b20ae2a7aaad47b23b9ada3da93b65df2caab1ce2464db1715f2",+ "size": 375586, "verbPrefixes": [ "browser_", "desktop_recorder_",
src/BRIDGE_VERSION+1−1@@ -1 +1 @@-1.9.103+1.9.104
src/bridge.json+1−1@@ -2,7 +2,7 @@ "manifest_version": 1, "name": "puppeteer", "displayName": "Puppeteer (Chrome for Testing + Native)",- "version": "1.9.103",+ "version": "1.9.104", "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/chrome.js+19−1@@ -610,8 +610,20 @@ async function _resolveVerifiedAdBase() { // opts.noToken → internal: retry unattributed after a stale-token 403. // Sends the spawn-time ADOM_BRIDGE_TOKEN as X-Adom-Bridge-Token for Activity-Log // attribution (OPTIONAL — a stale token 403s, so we retry once without it).+// v1.9.104 — DELEGATION CHAIN (AD >=1.9.183 caller-identity contract). Every AD verb pup calls back+// is work done ON BEHALF OF an AI thread, and until 1.9.183 AD dropped the caller headers on this+// loopback leg, so the user's Activity Log credited "pup" and lost the thread that asked. AD fixed its+// half; the bridge half is ours and it is NOT automatic:+// • FORWARD the X-Adom-Caller-{Thread,Container,Reason} we were handed (opts.caller), and+// • ADD X-Adom-Caller-Delegate naming OURSELVES — that is what turns the user-visible attribution+// into "chip-fetcher tab 3 (via pup)" instead of a bare "via bridge".+// The delegate is always correct so it is unconditional. The thread is only forwarded when the caller+// actually gave us one: per the contract, explicit args win and a bridge must NOT forward a STALE+// identity when acting on its own behalf (our timers, sweeps and health polls pass no caller, so they+// read honestly as pup's own work). All of it is self-reported and authorizes nothing.+const AD_DELEGATE_NAME = 'pup'; function adCommand(command, args, opts = {}) {- const { target, timeoutMs = 8000, noToken = false } = opts;+ const { target, timeoutMs = 8000, noToken = false, caller = null } = opts; return new Promise(async (resolve) => { let base; // v1.9.75: prefer the VERIFIED-AD base (see _resolveVerifiedAdBase) so an HD-spawned@@ -628,6 +640,12 @@ function adCommand(command, args, opts = {}) { const headers = { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(body) }; const tok = process.env.ADOM_BRIDGE_TOKEN; if (tok && !noToken) headers['X-Adom-Bridge-Token'] = tok;+ headers['X-Adom-Caller-Delegate'] = AD_DELEGATE_NAME; // name ourselves: "<thread> (via pup)"+ try {+ if (caller && caller.thread) headers['X-Adom-Caller-Thread'] = String(caller.thread).slice(0, 120);+ if (caller && caller.container) headers['X-Adom-Caller-Container'] = String(caller.container).slice(0, 120);+ if (caller && caller.reason) headers['X-Adom-Caller-Reason'] = String(caller.reason).slice(0, 300);+ } catch (e) {} const req = http.request( { hostname: u.hostname, port: u.port, path: u.pathname, method: 'POST', headers }, (resp) => {
src/server.js+22−10@@ -2433,7 +2433,7 @@ async function updateWikiJumplist(session, sessionId, opts) { // code — no more "right-click it and tell me what you see". let hwnd = null; try {- const fw = adPayload(await chrome.adCommand('desktop_find_window', { titleContains: `(session: ${sessionId}` }, { timeoutMs: 5000 }));+ const fw = adPayload(await chrome.adCommand('desktop_find_window', { titleContains: `(session: ${sessionId}` }, { timeoutMs: 5000 , caller: sessionCaller(sessions.get(sessionId))})); hwnd = fw && fw.best && fw.best.hwnd; } catch (e) {} try {@@ -2627,6 +2627,18 @@ function buildThumbnailTooltip(session, sessionId) { lines.push(`${browserLabel} · ${tabs} tab${tabs === 1 ? '' : 's'} · session: ${sessionId}`); return lines.join('\n'); }+// v1.9.104 — the caller to attribute a session-scoped AD callback to: the thread that OWNS this+// window (falling back to whoever last drove it). Returned as an adCommand opt so AD can render+// "<thread> (via pup)" on the Activity Log + any approval prompt. Returns null for work that is+// genuinely pup's own (timers, sweeps) — per the contract we must NOT forward a stale identity there.+function sessionCaller(session) {+ try {+ if (!session) return null;+ const thread = session._ownerThread || session._lastThread || null;+ if (!thread) return null;+ return { thread, container: session._ownerContainer || session._lastContainer || null };+ } catch (e) { return null; }+} async function updateThumbnailTooltip(session, sessionId) { if (process.platform !== 'win32' || !session || _thumbTooltipSupported === false) return; const tip = buildThumbnailTooltip(session, sessionId);@@ -2634,7 +2646,7 @@ async function updateThumbnailTooltip(session, sessionId) { try { const r = await chrome.adCommand('desktop_taskbar', { titleContains: `(session: ${sessionId}`, thumbnailTooltip: tip,- }, { timeoutMs: 5000 });+ }, { timeoutMs: 5000, caller: sessionCaller(session) }); const raw = r && (typeof r.output === 'string' ? r.output : JSON.stringify(r.output || '')); if (_isUnknownVerb(r, raw) || /unknown (arg|field)|unexpected (arg|field)/i.test(raw || '')) { _thumbTooltipSupported = false;@@ -3100,7 +3112,7 @@ async function osRaiseSessionWindow(session, sessionId) { // exactly: resolve THIS session's hwnd by its "(session: <id>)" title, then have AD foreground // that specific hwnd. Precise, browser-agnostic, and no PID guessing. try {- const fw = adPayload(await chrome.adCommand('desktop_find_window', { titleContains: `(session: ${sessionId}` }, { timeoutMs: 5000 }));+ const fw = adPayload(await chrome.adCommand('desktop_find_window', { titleContains: `(session: ${sessionId}` }, { timeoutMs: 5000 , caller: sessionCaller(sessions.get(sessionId))})); const hwnd = fw && fw.best && fw.best.hwnd; if (hwnd) { await chrome.adCommand('desktop_bring_to_front', { hwnd }, { timeoutMs: 6000 });@@ -4172,7 +4184,7 @@ async function parkSessionWindowDirect(page, sessionId) { // At launch, foreground is NOT a user signal (post-restart reassignment), so pup always // forces. On AD 1.9.114 the arg is ignored (skip-on-foreground) and the wasForeground // fallback below covers it; that fallback auto-obsoletes as desktops update.- const r = await chrome.adCommand('desktop_set_window_state', { titleContains: `(session: ${sessionId}`, state: 'bottom', force: true }, { timeoutMs: 5000 });+ const r = await chrome.adCommand('desktop_set_window_state', { titleContains: `(session: ${sessionId}`, state: 'bottom', force: true }, { timeoutMs: 5000 , caller: sessionCaller(sessions.get(sessionId))}); if (r && r.success === false) return { ok: false, err: r.error || 'error' }; const raw = r && (typeof r.output === 'string' ? r.output : JSON.stringify(r.output || '')); const o = raw ? JSON.parse(raw) : {};@@ -4194,7 +4206,7 @@ async function parkSessionWindowDirect(page, sessionId) { if (z.wasForeground || /invalid|unknown|must be one of|maximize\|minimize/i.test(lastErr)) { let hwnd = null; try {- const r = await chrome.adCommand('desktop_find_window', { titleContains: `(session: ${sessionId}` }, { timeoutMs: 4000 });+ const r = await chrome.adCommand('desktop_find_window', { titleContains: `(session: ${sessionId}` }, { timeoutMs: 4000 , caller: sessionCaller(sessions.get(sessionId))}); const o = r && (typeof r.output === 'string' ? JSON.parse(r.output) : r.output || r); hwnd = (o && ((o.best && o.best.hwnd) || o.hwnd)) || null; } catch (e) {}@@ -4209,7 +4221,7 @@ async function parkSessionWindowDirect(page, sessionId) { // On-screen full-size WITHOUT activation — AD MoveWindow preserves z-order (we're at bottom). if (!parkHwnd) { try {- const r = await chrome.adCommand('desktop_find_window', { titleContains: `(session: ${sessionId}` }, { timeoutMs: 4000 });+ const r = await chrome.adCommand('desktop_find_window', { titleContains: `(session: ${sessionId}` }, { timeoutMs: 4000 , caller: sessionCaller(sessions.get(sessionId))}); const o = r && (typeof r.output === 'string' ? JSON.parse(r.output) : r.output || r); parkHwnd = (o && ((o.best && o.best.hwnd) || o.hwnd)) || null; } catch (e) {}@@ -4256,7 +4268,7 @@ async function parkSessionWindowDirect(page, sessionId) { async function reassertBottomAfterNav(sessionId) { if (process.platform !== 'win32' || !sessionId) return; try {- await chrome.adCommand('desktop_set_window_state', { titleContains: `(session: ${sessionId}`, state: 'bottom', force: false }, { timeoutMs: 5000 });+ await chrome.adCommand('desktop_set_window_state', { titleContains: `(session: ${sessionId}`, state: 'bottom', force: false }, { timeoutMs: 5000 , caller: sessionCaller(sessions.get(sessionId))}); } catch (e) {} } @@ -6356,7 +6368,7 @@ const server = http.createServer(async (req, res) => { // force:false touches nothing but z, and respects a user-held window. if (!foreground && sized) { try {- await chrome.adCommand('desktop_set_window_state', { titleContains: `(session: ${sessionId}`, state: 'bottom', force: false }, { timeoutMs: 5000 });+ await chrome.adCommand('desktop_set_window_state', { titleContains: `(session: ${sessionId}`, state: 'bottom', force: false }, { timeoutMs: 5000 , caller: sessionCaller(sessions.get(sessionId))}); } catch (e) {} } // v1.8.26: record whether this window is meant to be on screen — gates every@@ -6892,7 +6904,7 @@ const server = http.createServer(async (req, res) => { let _visible = false; for (let i = 0; i < 8 && !_visible; i++) { try {- const fr = await chrome.adCommand('desktop_find_window', { titleContains: `(session: ${sessionId}` }, { timeoutMs: 5000 });+ const fr = await chrome.adCommand('desktop_find_window', { titleContains: `(session: ${sessionId}` }, { timeoutMs: 5000 , caller: sessionCaller(sessions.get(sessionId))}); const fraw = fr && (typeof fr.output === 'string' ? fr.output : JSON.stringify(fr.output || '')); const fo = fraw ? JSON.parse(fraw) : {}; _visible = !!((fo.data || fo).best);@@ -7260,7 +7272,7 @@ const server = http.createServer(async (req, res) => { } if (process.platform === 'win32') { try {- const fw = adPayload(await chrome.adCommand('desktop_find_window', { titleContains: `(session: ${sessionId}` }, { timeoutMs: 5000 }));+ const fw = adPayload(await chrome.adCommand('desktop_find_window', { titleContains: `(session: ${sessionId}` }, { timeoutMs: 5000 , caller: sessionCaller(sessions.get(sessionId))})); const hwnd = fw && fw.best && fw.best.hwnd; if (hwnd) { const psPath = path.join(require('os').tmpdir(), '_adom_focus_hwnd.ps1');