← Commit history
dev_reload self-completing 2-pass + deploy-recipe skill doc (ext 0.0.4, pkg 0.3.1)
4 files changed
+45−9
extension/manifest.json+1−1@@ -2,7 +2,7 @@ "manifest_version": 3, "name": "Adom for Chrome & Edge", "short_name": "Adom",- "version": "0.0.3",+ "version": "0.0.4", "description": "Drive your real, logged-in Chrome/Edge from the Adom ecosystem — the native-browser counterpart to pup.", "minimum_chrome_version": "116", "background": {
extension/src/sw.js+21−3@@ -130,9 +130,14 @@ async function dispatch(verb, args) { return { ok: false, error: 'dev_reload throttled', _hint: `last reload ${Math.round((now - _lastReload) / 1000)}s ago; min interval ${MIN_INTERVAL / 1000}s. If you truly need it now, reload from chrome://extensions.` }; }- await chrome.storage.local.set({ _lastReload: now });+ // 2-pass reload: chrome.runtime.reload() does a SOFT reload first (serves cached extension+ // resources, so a single call kept the OLD code on disk-change), and only a 2nd reload re-reads+ // files. Arm a one-shot flag so the SW completes the HARD pass itself on restart — a single+ // dev_reload then reliably picks up on-disk changes. Completion logic is in the init at EOF.+ await chrome.storage.local.set({ _lastReload: now, _devReload2: now }); setTimeout(() => chrome.runtime.reload(), 150); // reply first, then reload- return { ok: true, reloading: true };+ return { ok: true, reloading: true,+ _hint: 'Reloading in 2 self-completing passes (soft now → hard on restart) to load your on-disk changes; reconnects in ~6-10s. Poll nbrowser_status until version reflects the edit.' }; } // --- windows / sessions ----------------------------------------------@@ -262,4 +267,17 @@ chrome.alarms.onAlarm.addListener((a) => { try { port.postMessage({ keepalive: true }); } catch (e) { port = null; setStatus(false); scheduleConnect(); } }); -connect();+// dev_reload 2-pass completion (see nbrowser_dev_reload). chrome.runtime.reload() runs a SOFT reload+// first; arming _devReload2 makes the SW do ONE more HARD reload here on restart so a single dev_reload+// reliably re-reads disk. Guards: cleared BEFORE reloading (no loop), and a >15s-old flag is treated as+// stale and dropped (a normal SW wake never triggers a stray reload). Otherwise connect as usual.+(async () => {+ try {+ const { _devReload2 = 0 } = await chrome.storage.local.get('_devReload2');+ if (_devReload2) {+ await chrome.storage.local.remove('_devReload2');+ if (Date.now() - _devReload2 < 15000) { chrome.runtime.reload(); return; } // hard pass, then stop+ }+ } catch { /* fall through to a normal connect */ }+ connect();+})();
package.json+1−1@@ -1,6 +1,6 @@ { "slug": "adom-browser-extension",- "version": "0.3.0",+ "version": "0.3.1", "type": "app", "title": "Adom Browser Extension (Chrome + Edge)", "description": "Drive your real, logged-in Chrome/Edge from the Adom ecosystem \u2014 the nbrowser_* native-browser bridge (counterpart to pup). Multi-profile driving, a read-only credential-library query over the browser's own saved logins (Chrome + Edge), and hands-free vendor login automation, so chip CAD / datasheets download past every login wall in your real signed-in session.",
skills/driving-the-extension/SKILL.md+22−4@@ -42,7 +42,7 @@ Adom-managed machines the `--silent-debugger-extension-api` launch flag removes read/navigate, prefer native verbs and the bar never shows. ## Verb surface-- **meta:** `status`, `ping`, `help` (full inline reference), `dev_reload` (throttled ≤1/10min)+- **meta:** `status`, `ping`, `help` (full inline reference), `dev_reload` (self-completing 2-pass; throttled 1/90s) - **windows/sessions:** `open_window`, `close_window`, `switch_window`, `list_windows` (returns `bounds`+`state`), `window_state`/`fullscreen` (maximize·fullscreen·normal·minimize, or `left/top/width/height` to move+resize — native, no bar; F11-via-key does NOT work), `rescan`@@ -189,9 +189,10 @@ wall. This is what changes the EE workflow. - **`nbrowser_eval` runs in the PAGE world** — `chrome.*` is NOT available there (only DOM/window). - **`fetch_url` is the authed shortcut** — real cookies; grabs a file behind a login without clicking. - **Run `nbrowser_help`** anytime — the bridge self-documents every verb + the flash/taskbar playbook.-- **Driving AD itself:** use the 1.8.151+ first-class verbs (`run_script` with base64 `scriptB64`,- `read_file`/`write_file`, `process_list`, `net_stats`, `registry_*`) instead of hand-quoting- `shell_execute` — they sidestep the JSON→cmd→PowerShell nested-quote trap.+- **Driving AD itself:** prefer the first-class file verbs (`read_file`/`write_file`/`list_dir`/+ `delete_file`, `process_list`, `net_stats`, `registry_*`) over `shell_execute` — cleaner, no quoting.+ (AD 1.8.165 fixed `shell_execute`'s quote-mangling, so quoted Windows paths with spaces now work too —+ the old `ADOMDE~1` 8.3-short-name workaround is no longer needed.) ## RECONNECT (the one operational gotcha) Each bridge restart (deploying new bridge code) or AD restart drops the extension; the native host then@@ -200,6 +201,23 @@ re-dials and reconnects (currently 30–60s — being fixed AD-side with a stabl fix — wait, then retry. If it persists, check `process_list` for **stray bridge instances** (kill all but one) and that `bridge_list` runtimePort matches the live bridge's port. +## Deploying a code change to the laptop+The `extension/` and `bridge/` here are **source** — they run from the *laptop*, so an edit takes effect+only after you push it there and reload:++- **Extension** (`src/*.js`, `manifest.json`) loads unpacked from+ `C:\Users\john\adom-browser-extension\extension`:+ 1. `write_file` each changed file there (real quoted Windows paths work as of AD 1.8.165).+ 2. `nbrowser_dev_reload` — **self-completing 2-pass**: it does a soft reload, then arms a one-shot flag+ so the SW does a second *hard* reload on restart that re-reads disk. A single call now reliably picks+ up your changes (older builds needed two manual calls because the soft reload served cached files).+ Throttled 1/90s.+ 3. Verify: `nbrowser_status` → `version` should reflect your `manifest.json` bump (bump it so you can tell).+- **Bridge** (`server.js`, `bridge.json`) runs from `…\bridges-cache\native-browser\` — the **single**+ runtime (`bridge_list` shows each bridge's `entrypoint`/`source`). `write_file` the changes there, then+ restart it; if it's a wiki-managed (`source:cache`) install, keep `BRIDGE_VERSION`/`.bridge-version` in+ sync with the deployed code so a future re-stream stays a no-op.+ ## Install / publish Extension is loaded unpacked into the user's profile (Chrome 137+ removed `--load-extension`, so it's a one-time `chrome://extensions → Developer mode → Load unpacked`; production = Chrome Web Store