← Commit history

Agent-activity indicator: taskbar progress bar marks which pup window a thread is currently driving (indeterminate while verbs land, cleared 2.5s after the last one); browser_configure agentActivity on|off

John Lauer ·c55e3d5d4f ·3mo ago ·parent 2f3b067
4 files changed +80−6
adom-bridge-puppeteer-manifest.json+4−4
@@ -1,10 +1,10 @@ {   "manifest_version": 1,   "name": "puppeteer",-  "version": "1.9.56",-  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.56/adom-bridge-puppeteer-v1.9.56.zip",-  "sha256": "4fcfa838b74fe93530b2b4edde478e07e42a5d588bf0a2351b73b4f7fdd0c538",-  "size": 311065,+  "version": "1.9.57",+  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.57/adom-bridge-puppeteer-v1.9.57.zip",+  "sha256": "5a6d242e45211cc114ea8a80d5f17a2bdc1a0d4cbef4b6f9f43a9823da0c6a67",+  "size": 312464,   "verbPrefixes": [     "browser_",     "desktop_recorder_",
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-1.9.56+1.9.57
src/bridge.json+1−1
@@ -2,7 +2,7 @@   "manifest_version": 1,   "name": "puppeteer",   "displayName": "Puppeteer (Chrome for Testing + Native)",-  "version": "1.9.56",+  "version": "1.9.57",   "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.",   "homepage": "https://wiki.adom.inc/adom/adom-desktop",   "author": "Adom Inc.",
src/server.js+74
@@ -2223,6 +2223,57 @@ async function dualBadgeB64(wins, tabs) {   } catch (e) { return null; } } +// v1.9.57 — AGENT-ACTIVITY INDICATOR (taskbar progress bar).+//+// John runs many AI threads at once and asked which pup window an agent is actually driving right+// now. The taskbar PROGRESS bar answers it with zero AD work: ITaskbarList3 progress is already+// exposed by desktop_taskbar, it paints ON the button (so it reads at a glance across the whole+// taskbar), and it is a SEPARATE channel from the overlay icon — the favicon overlay is untouched.+//+// Semantics: 'indeterminate' (marquee) while a thread is issuing verbs at this window, cleared+// ~2.5s after the last one. Deliberately NOT a percentage: an agent's work has no known length, and+// a fake percentage would be a lie. Only transitions are sent to AD (idle->busy once, busy->idle+// once), never one call per verb, so a chatty thread costs 2 AD calls, not 200.+const _busyState = new Map();      // sessionId -> { busy, timer }+const BUSY_IDLE_MS = 2500;+async function setSessionProgress(sessionId, busy) {+  if (process.platform !== 'win32') return;+  try {+    await chrome.adCommand('desktop_taskbar', {+      titleContains: `(session: ${sessionId}`,+      progress: busy ? { state: 'indeterminate' } : { state: 'none' },+    }, { timeoutMs: 4000 });+  } catch (e) {}+}+function markSessionBusy(sessionId) {+  if (process.platform !== 'win32' || !sessionId) return;+  if (pupSettings().agentActivity === 'off') return;      // user opt-out via browser_configure+  if (!sessions.has(sessionId)) return;+  let st = _busyState.get(sessionId);+  if (!st) { st = { busy: false, timer: null }; _busyState.set(sessionId, st); }+  if (!st.busy) {+    st.busy = true;+    console.log(`[activity] "${sessionId}" agent driving — taskbar progress ON`);+    setSessionProgress(sessionId, true).catch(() => {});+  }+  clearTimeout(st.timer);+  st.timer = setTimeout(() => {+    st.busy = false;+    console.log(`[activity] "${sessionId}" idle — taskbar progress OFF`);+    setSessionProgress(sessionId, false).catch(() => {});+  }, BUSY_IDLE_MS);+}+function clearSessionBusy(sessionId) {+  const st = _busyState.get(sessionId);+  if (st) { clearTimeout(st.timer); _busyState.delete(sessionId); }+}+// Verbs that are pure status/polling: they do NOT mean an agent is driving the window, and lighting+// the bar for them would make every window look permanently busy (the audit loops alone poll these).+const PASSIVE_VERBS = new Set([+  'browser_list_windows', 'browser_list_tabs', 'browser_readiness', 'browser_status',+  'browser_describe', 'browser_configure', 'browser_prewarm', 'browser_rescan', 'browser_wait',+]);+ async function updateTabCountBadge(session, sessionId) {   if (process.platform !== 'win32' || _identitySupported !== true) return; // overlay busy with brand badge on old AD   // v1.9.31: a tab verb just ran — cheap moment to notice a drag-out (event-driven, not a scan).@@ -5118,6 +5169,14 @@ const server = http.createServer(async (req, res) => {         }       } +      // v1.9.57: light the taskbar progress bar while a thread is driving THIS window. Broader than+      // MUTATING_VERBS above on purpose — a screenshot or an eval is still an agent working in that+      // window, and that is exactly what the user wants to see. Status/polling verbs are excluded+      // (see PASSIVE_VERBS) or every window would read as permanently busy.+      if (command && command.startsWith('browser_') && !PASSIVE_VERBS.has(command)) {+        try { markSessionBusy(args.sessionId || activeSessionId); } catch (e) {}+      }+       switch (command) {         // v1.0.15: self-describe — AD's "Verbs" tab POSTs {command:'browser_describe'}         // and renders this verbatim: one entry per documented verb with@@ -5503,6 +5562,19 @@ const server = http.createServer(async (req, res) => {             sendJSON(res, { success: false, error: `taskbarGrouping must be one of ${valid.join('|')}`, });             return;           }+          // v1.9.57: agentActivity 'on'|'off' — the taskbar progress bar that marks which window a+          // thread is currently driving. On by default; this is the user's taskbar, so give them the+          // switch rather than assuming everyone wants the motion.+          const aa = args.agentActivity;+          if (aa !== undefined && !['on', 'off'].includes(aa)) {+            sendJSON(res, { success: false, error: `agentActivity must be one of on|off` });+            return;+          }+          if (aa) {+            savePupSettings({ agentActivity: aa });+            console.log(`[configure] agentActivity -> ${aa}`);+            if (aa === 'off') { for (const [sid] of _busyState) { setSessionProgress(sid, false).catch(() => {}); } _busyState.clear(); }+          }           if (g) {             savePupSettings({ taskbarGrouping: g });             console.log(`[configure] taskbarGrouping -> ${g}`);@@ -5591,6 +5663,7 @@ const server = http.createServer(async (req, res) => {           session.activeTabId = null;           sessions.delete(sessionId);           deleteSessionFile(sessionId);+          clearSessionBusy(sessionId);                       // v1.9.57: drop any pending progress timer           unregisterPupAumid(_closingAppId).catch(() => {}); // v1.9.2/#207 cleanup (appId captured pre-delete)            // Decrement refCount; kill browser if no sessions left using this profile@@ -7204,6 +7277,7 @@ const server = http.createServer(async (req, res) => {           // windows leaves NO stale taskbar identity behind (the exact "old icon" class John flagged).           for (const [id, s] of sessions) {             deleteSessionFile(id);+            clearSessionBusy(id);                            // v1.9.57             try { if (s && s._curAppId && s._curAppId !== PUP_APP_ID) unregisterPupAumid(s._curAppId).catch(() => {}); } catch (e) {}           }           sessions.clear();