all repos — sz-chrome-remote-extension @ ea567819d835d4704d9fb38cd114e0e5b231759e

pi-chrome, patched to drive a signed-in browser on another host through a broker, with an MCP server

0.17.3: daemon self-heal on missing-daemon fetch failure

In 0.17.x the daemon is a separate process that can idle-shut-down
(10 min idle) or be killed externally while Pi sessions are running.
Without self-heal, the next /chrome onboard or chrome_* call surfaces
'fetch failed' instead of recovering.

bridge.admin() now catches the failed fetch, re-runs ensureDaemonRunning
(probe -> spawn if missing), and retries once.

bridge.sendViaOwner() pre-probes /status and spawns the daemon if missing
before issuing the signed /command.

Net effect: a missing daemon transparently respawns instead of bubbling
fetch failed up to the user.
Tianren Dong tianrendong.dtr@gmail.com
Sat, 16 May 2026 13:03:51 -0400
commit

ea567819d835d4704d9fb38cd114e0e5b231759e

parent

fcae5b188baa1bdfed48208d7cfc2b711af4aae3

M CHANGELOG.md → CHANGELOG.md

@@ -2,6 +2,17 @@ # Changelog

All notable user-facing changes to `pi-chrome`. +## 0.17.3 — 2026-05-16 + +### Daemon self-heal + +0.17.x makes the Pi process a client of a separately-spawned daemon. If the daemon idle-shuts-down (after 10 min of inactivity) or is killed externally while a Pi session is running, the next chrome_* tool call or `/chrome onboard` would surface `fetch failed` instead of recovering. + +- **`bridge.admin()`** catches the failed fetch, re-runs `ensureDaemonRunning()` (which probes, kills incompatible, or spawns fresh), then retries the request once. +- **`bridge.sendViaOwner()`** pre-probes `/status`; if no daemon is reachable, it spawns one before issuing the signed `/command`. + +Net effect: a missing daemon transparently respawns on the next Pi-side request instead of bubbling `fetch failed` up to the user. + ## 0.17.2 — 2026-05-16 ### Fixes for the daemon model surfaced during 0.17.0/0.17.1 testing
M extensions/chrome-profile-bridge/browser-extension/manifest.json → extensions/chrome-profile-bridge/browser-extension/manifest.json

@@ -1,7 +1,7 @@

{ "manifest_version": 3, "name": "Pi Chrome Connector", - "version": "0.17.2", + "version": "0.17.3", "description": "Lets Pi control tabs in Chrome via a local connector at 127.0.0.1.", "permissions": [ "tabs",
M extensions/chrome-profile-bridge/index.ts → extensions/chrome-profile-bridge/index.ts

@@ -923,7 +923,17 @@ if (this.auth.paired) {

const sig = this.auth.signPeerRequest("POST", "/admin", payload); if (sig) headers[AUTH_HEADER] = sig; } - const response = await fetch(`${this.url}/admin`, { method: "POST", headers, body: payload }); + const doFetch = () => fetch(`${this.url}/admin`, { method: "POST", headers, body: payload }); + let response: Response; + try { response = await doFetch(); } + catch (error) { + // Daemon isn't reachable. Self-heal by re-running the spawn path, then retry once. + // Covers the common case where the daemon idle-shut-down since the Pi session started + // (or was killed manually) but the Pi-side bridge still thinks mode === "client". + console.warn(`pi-chrome: /admin fetch failed (${(error as Error).message}); re-spawning daemon and retrying`); + await this.ensureDaemonRunning(); + response = await doFetch(); + } const respText = await response.text(); // Verify owner sig when present (paired state). For pre-pair calls, no sig to verify. if (this.auth.paired) {

@@ -1011,6 +1021,13 @@ });

} private async sendViaOwner(action: string, params: Record<string, unknown>, timeoutMs: number, signal?: AbortSignal): Promise<unknown> { + // Self-heal: re-spawn the daemon if it's gone. Cheap when daemon is up (a no-op since + // the version probe inside ensureDaemonRunning returns compatible immediately). + try { + const probed = probeBridgeStatus(this.host, this.port); + if (!probed) await this.ensureDaemonRunning(); + } catch { /* fall through to the fetch — will surface a clearer error if anything is + actually broken. */ } if (!this.auth.paired) { throw new Error("Chrome bridge not paired with this Pi config. Run /chrome pair in the Pi session that owns the bridge first."); }
M package.json → package.json

@@ -1,6 +1,6 @@

{ "name": "pi-chrome", - "version": "0.17.2", + "version": "0.17.3", "scripts": { "version": "node scripts/sync-manifest-version.js", "prepublishOnly": "node scripts/sync-manifest-version.js"