← Commit history

Clean window titles by default + two title toggles + Pup capitalization (John: 'i dont like seeing the title mangled anymore, but i might want to turn that feature back on'; 'you seem to put stuff at the end of the title sometimes too so make that a settings toggle as well'; 'ok to call it Pup with a capital p'). TWO title decorations are now OFF by default, each a settings toggle at the bottom of the dialog: titleTag (the '(ai-thread: X)' suffix at the END) and titlePrefix (the '<thread> - ' cosmetic prefix at the START, which also carried the wiki logged-in glyph). CRITICAL: window resolution still works with clean titles - when titleTag is off, resolveSessionHwndByBounds resolves TRANSIENTLY (adds the tag, finds the hwnd, strips it; the window is parked off-screen during most resolves so the flash is invisible, and window.name remains the durable identity). The injector strips the tag on new navs when off; the reconciler brings EXISTING windows clean within ~8s (strips the suffix, and safely removes ONLY pup's own known decor prefix - never a page's real ' - ' title - disconnecting the decor observer so it cannot re-add). Dashboard brand + title now read 'Pup'.

John Lauer ·9d2d0c3be7 ·3mo ago ·parent e1af72b
4 files changed +69−12
adom-bridge-puppeteer-manifest.json+4−4
@@ -1,10 +1,10 @@ {   "manifest_version": 1,   "name": "puppeteer",-  "version": "1.9.285",-  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.285/adom-bridge-puppeteer-v1.9.285.zip",-  "sha256": "b9492d3ca585a7f18b9c8f72508ec2a9b89ebd6f6d448827879b034e7cc95b2f",-  "size": 715880,+  "version": "1.9.286",+  "url": "https://wiki.adom.inc/download/adom/adom-desktop-puppeteer-bridge/1.9.286/adom-bridge-puppeteer-v1.9.286.zip",+  "sha256": "18a2667eebcde94dbe1fb1316cacf2b7d69c8f42d0c6fa52070e0f80a637c528",+  "size": 717362,   "verbPrefixes": [     "browser_",     "desktop_recorder_",
src/BRIDGE_VERSION+1−1
@@ -1 +1 @@-1.9.285+1.9.286
src/bridge.json+1−1
@@ -2,7 +2,7 @@   "manifest_version": 1,   "name": "puppeteer",   "displayName": "Puppeteer (Chrome for Testing + Native)",-  "version": "1.9.285",+  "version": "1.9.286",   "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+63−6
@@ -511,7 +511,7 @@ function attachTab(session, sessionId, page, { makeActive = true, opener = 'user   // enforcer at document-start on EVERY navigation (before page scripts), so the   // suffix reappears the instant the page sets its title — closing that gap.   try {-    page.evaluateOnNewDocument((sid, minimal, label) => {+    page.evaluateOnNewDocument((sid, minimal, label, tagOn) => {       // v1.9.185: carry minimal-touch into the page so the title observer below can skip installing       // itself (see the note at `observe`). Read at document-start, before any page script runs.       try { if (minimal) window.__pupMinimalTouch = true; } catch (e) {}@@ -548,6 +548,7 @@ function attachTab(session, sessionId, page, { makeActive = true, opener = 'user       const ensure = () => {         try {           const cur = String(document.title || '');+          if (!tagOn) { const clean = cur.replace(RE_MINE, ''); if (clean !== cur) document.title = clean; return; }  // OFF: keep title clean           const n = (cur.match(RE_MINE) || []).length;           if (n === 1) return;                                   // already exactly one — leave it alone           if (n === 0) { document.title = cur + BASE; return; }  // none — add ours@@ -569,7 +570,7 @@ function attachTab(session, sessionId, page, { makeActive = true, opener = 'user       };       ensure();       if (!observe()) document.addEventListener('DOMContentLoaded', () => { observe(); ensure(); });-    }, sessionId, minimalTouch(), TITLE_LABEL).catch(() => {});+    }, sessionId, minimalTouch(), TITLE_LABEL, pupSettings().titleTag === 'on').catch(() => {});   } catch (e) {}   // v1.9.284 (John: "a small floating in-window chip that indicates what ai-thread owns this tab,   // what profile ... it can't get in the way though"). A tiny corner pill showing owner-thread and@@ -2771,6 +2772,11 @@ function pupSettings() {   D.jlViewTasks = 'on'; D.jlCloseAll = 'on';   D.notMineCaption = 'on';   // v1.9.282 (John): the 'NOT foregrounded by Adom' caption, default on   D.ownerChip = 'on';        // v1.9.284 (John): the floating owner-thread/profile chip, default on+  // v1.9.286 (John: "i dont like seeing the title mangled anymore"): BOTH title decorations OFF by+  // 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';   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.@@ -3748,7 +3754,7 @@ async function brandSweep(reason) {       const tab = sess.tabs && sess.tabs[0];       if (!tab || !tab.page) continue;       // re-assert the title suffix so AD's resolver can find the window even after title churn-      try {+      if (pupSettings().titleTag === 'on') try {         await tab.page.evaluate((sfx, sid2) => {           try {             const esc = sid2.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');@@ -3935,6 +3941,7 @@ function _titleDecorFn(state) { } // Set/refresh the decoration. Pass null for a slot you are not changing. async function setTitleDecor(page, { threadTag = null, wikiLabel = null } = {}) {+  if (pupSettings().titlePrefix !== 'on') return;   // v1.9.286 (John): the "<thread> · " prefix is opt-in   const st = { threadTag, wikiLabel };   try { await page.evaluateOnNewDocument(_titleDecorFn, st); } catch (e) {}   try { await page.evaluate(_titleDecorFn, st); } catch (e) {}@@ -4793,9 +4800,21 @@ async function resolveSessionHwndByBounds(session, sessionId) {     // exact where it exists - resolve by title FIRST; geometry stays as the fallback for windows     // that cannot carry the tag (PDF viewer).     try {+      // v1.9.286: with titleTag OFF the visible title has no tag, so TRANSIENTLY add it, resolve,+      // then strip it. The window is parked off-screen during most resolves, so the tag flash is+      // usually invisible; either way it lasts only the ~1s of the find. window.name stays the+      // durable identity. When titleTag is ON, the tag is already persistent — no transient dance.+      const _transient = pupSettings().titleTag !== 'on';+      const _atab = (session.tabs || []).find(t => t.tabId === session.activeTabId) || (session.tabs || [])[0];+      if (_transient && _atab && _atab.page) {+        try { await _atab.page.evaluate((sfx) => { try { if (String(document.title).indexOf(sfx) === -1) document.title = String(document.title || '') + sfx + ')'; } catch (e) {} }, ` (${TITLE_LABEL}: ${sessionId}`); } catch (e) {}+      }       const fw = adPayload(await chrome.adCommand('desktop_find_window', { titleContains: `(${TITLE_LABEL}: ${sessionId}` }, { timeoutMs: 5000, caller: sessionCaller(session) }));       const b = fw && (fw.best || (fw.data && fw.data.best));-      if (b && b.hwnd) { session._hwnd = Number(b.hwnd); console.log(`[hwnd] "${sessionId}" resolved by TITLE tag -> ${b.hwnd}`); return Number(b.hwnd); }+      if (_transient && _atab && _atab.page) {+        try { const esc = sessionId.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); await _atab.page.evaluate((re) => { try { document.title = String(document.title || '').replace(new RegExp(re, 'g'), ''); } catch (e) {} }, `\\s*\\((?:session|ai-thread): ${esc}(?:[^)]*)\\)`); } catch (e) {}+      }+      if (b && b.hwnd) { session._hwnd = Number(b.hwnd); console.log(`[hwnd] "${sessionId}" resolved by ${_transient ? 'TRANSIENT tag' : 'TITLE tag'} -> ${b.hwnd}`); return Number(b.hwnd); }     } catch (e) {}     const page = (session.tabs || [])[0] && (session.tabs || [])[0].page;     if (!page) return null;@@ -5029,6 +5048,41 @@ async function reconcileModel(reason) {     // and idempotent (one querySelector per page), pointer-events:none so it never blocks anything.     try {       const chipOn = pupSettings().ownerChip === 'on';+      const _tagOn = pupSettings().titleTag === 'on';+      const _prefixOn = pupSettings().titlePrefix === 'on';+      // v1.9.286: bring EXISTING windows to the current title settings (new navs are handled by the+      // injector/setTitleDecor gates). Strips the (ai-thread: X) suffix when titleTag is off, and+      // safely removes ONLY pup's own known decor prefix when titlePrefix is off (never a page's+      // real " · " title), disconnecting the decor observer so it cannot re-add it.+      if (!_tagOn || !_prefixOn) {+        for (const [sid, s2] of [...sessions]) {+          for (const t of (s2.tabs || [])) {+            if (!t || !t.page) continue;+            try {+              const esc = sid.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');+              await t.page.evaluate((tagOn, prefixOn, escSid) => {+                try {+                  if (!tagOn) { const re = new RegExp('\\s*\\((?:session|ai-thread): ' + escSid + '(?:[^)]*)\\)', 'g'); const c = String(document.title || '').replace(re, ''); if (c !== document.title) document.title = c; }+                  if (!prefixOn) {+                    try { if (window.__pupDecorObs) { window.__pupDecorObs.disconnect(); window.__pupDecorObs = null; } } catch (e) {}+                    const tag = window.__pupThreadTag;+                    let out = String(document.title || '');+                    const pull = () => {+                      if (tag && out.indexOf(tag + ' \u00b7 ') === 0) { out = out.slice(tag.length + 3); return true; }+                      const m = out.match(/^(?:\u25CF Logged in|\u25CB Public|\uD83D\uDD13 Logged in|\uD83D\uDCD6 Public) \u00b7 /);+                      if (m) { out = out.slice(m[0].length); return true; }+                      return false;+                    };+                    for (let i = 0; i < 4 && pull(); i++) {}+                    window.__pupThreadTag = null; window.__pupWikiLabel = null;+                    if (out !== document.title) document.title = out;+                  }+                } catch (e) {}+              }, _tagOn, _prefixOn, esc);+            } catch (e) {}+          }+        }+      }       for (const [sid, s] of [...sessions]) {         for (const t of (s.tabs || [])) {           if (!t || !t.page) continue;@@ -8506,7 +8560,7 @@ async function dashboardSnapshot() { // is served by the bridge itself and must work on a machine with no network. Adom dark theme. const DASHBOARD_HTML = `<!doctype html><html lang="en"><head> <meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">-<title>pup live windows</title>+<title>Pup live windows</title> <link rel="icon" type="image/svg+xml" href="/dashboard/icon.svg?v=${BRIDGE_VERSION}"> <style> @import url('https://adom.inc/fonts/fonts.css');@@ -8634,7 +8688,7 @@ footer{color:#5c6c7a;font-size:11px;padding:8px 18px 22px} <header>   <div class="brand" id="brand">     <svg class="bicon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="8" width="13" height="12" rx="2"/><rect x="10" y="4" width="11" height="8" rx="2" opacity=".45"/><path d="M5 15h2l1.4-3 2 5 1.6-2h2"/></svg>-    <span class="bname">pup</span><span class="bsub">&middot; live windows</span>+    <span class="bname">Pup</span><span class="bsub">&middot; live windows</span>   </div>   <div class="pop" id="pop">     <div>version <b id="cV">?</b></div>@@ -8848,6 +8902,8 @@ const SETTINGS_DEF=[  {k:'sleepRecovery',l:'Sleep and crash recovery',d:'After the laptop wakes or Chrome dies, automatically bring every pup window back at its last page, signed in. Never restarts a live Chrome.'},  {k:'autoLogin',l:'Auto-fill saved logins',d:'Fill (never submit) a matching saved login when a login page loads in a pup window.'},  {k:'reportIssues',l:'Issue-report hints',d:'Let pup invite AIs to file a wiki issue when they hit something broken.'},+ {k:'titleTag',l:'Session tag in the window title',d:'Append "(ai-thread: <name>)" to each window title so pup (and you) can tell windows apart from the title bar. Off by default because it can look like the page mangled its own title; pup still resolves windows without it (transiently, while off-screen).'},+ {k:'titlePrefix',l:'Thread name prefixed to the title',d:'Prepend the owning thread (and wiki logged-in/out state) to the start of each window title. Off by default.'},  {k:'ownerChip',l:'Floating owner chip in each window',d:'Show a tiny non-interactive chip in the bottom-left of each pup window naming the AI thread that owns it and its profile. It cannot be clicked through to (pointer-events off) and lives in an isolated layer so it never affects the page. Turn off if you do not want any overlay in your windows.'},  {k:'notMineCaption',l:'"Not foregrounded by Adom" caption',d:'Low importance. When a window comes to the front on its own (JavaScript, a focus change, Chrome, or your own click), briefly caption that Adom did NOT do it. Default on so you can see it; turn off once you trust that pup keeps windows in the background.'},  {k:'minimalTouch',l:'Minimal-touch mode',d:'The safety mode from the Chrome crash hunt. ON means pup keeps its hands off your windows: it only opens them and drives the pages inside, and skips the extra Windows machinery (identity stamps, window sweeps, shell churn) that was suspected of freezing Chrome. The toggles above are the real per-feature controls now and they win over this switch. Rule of thumb: leave this ON; if pup ever gets crashy, make sure it is ON and turn features back on one at a time to find the culprit.'},@@ -9053,6 +9109,7 @@ const server = http.createServer(async (req, res) => {             aumidIconStyle: ['standard', 'category'],             jlViewTasks: ['on', 'off'], jlCloseAll: ['on', 'off'],             notMineCaption: ['on', 'off'], ownerChip: ['on', 'off'],+            titleTag: ['on', 'off'], titlePrefix: ['on', 'off'],           };           const key = String(a.key || ''); let val = a.value;           if (key === 'fgCaptionMs') {