From d78081aa58ecaa1c72e847c2d095b5f07c391506 Mon Sep 17 00:00:00 2001 From: Tianren Dong Date: Tue, 12 May 2026 23:53:16 -0400 Subject: Update pi-packs installer and package names --- README.md | 2 +- REBUILD-NOTES.md | 185 ++++++++ .../browser-extension/manifest.json | 4 +- .../browser-extension/service_worker.js | 514 ++++++++++++++++++--- extensions/chrome-profile-bridge/index.ts | 257 ++++++++++- package.json | 2 +- 6 files changed, 869 insertions(+), 95 deletions(-) create mode 100644 REBUILD-NOTES.md diff --git a/README.md b/README.md index 684144d..9b2bade 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ If the Chrome extension you have loaded is older than `pi-chrome` on disk, `/chr ## Compose with - **pi-qq** — ask side questions about what the agent saw in Chrome without polluting the main transcript: `/qq summarize what the active GitHub tab shows`. -- **trifecta-footer** — watch context pressure as the agent scrapes large pages; the footer's red threshold is a clean signal to `/qq` for a recap before context overflows. +- **pi-bar** — watch context pressure as the agent scrapes large pages; the footer's red threshold is a clean signal to `/qq` for a recap before context overflows. - **PR demo skills** (such as `ios-pr-agent` / `ios-demo-record` workflows) — `chrome_screenshot` writes to `.pi/chrome-screenshots/` so you can attach images to PR descriptions or demo bundles. ## Tools diff --git a/REBUILD-NOTES.md b/REBUILD-NOTES.md new file mode 100644 index 0000000..7e49d9f --- /dev/null +++ b/REBUILD-NOTES.md @@ -0,0 +1,185 @@ +# pi-chrome 0.7.0 → 0.8.0 rebuild + +Scoped to Tier 1 (bugs + diagnostics), Tier 2 (surface gaps), Tier 5.1 (version +drift), and Tier 6 (primer) from the design plan. Tier 3 (CDP backend), Tier 4 +(multi-session reliability), and Tier 5.2/5.3 (auto-reload + Web Store) are +deferred. + +## What changed + +### T1.1 — `chrome_evaluate` returning `null` (root cause fixed) + +`page.evaluate` no longer goes through the `executeInTab` helper-source +re-eval pipeline. A dedicated `evaluateInTab` path compiles the expression via +`new Function(...)` directly in MAIN world, with a syntax-error fallback that +re-compiles in statement-mode so multi-statement bodies still work. Special +return values (`undefined`, errors, symbols, bigints, functions) are surfaced +via a tagged envelope so the Node side can return them faithfully. + +Verified live: +- `chrome_evaluate("1+1")` → `2` +- `chrome_evaluate("Promise.resolve(99)")` → `99` +- `chrome_evaluate("(()=>{throw new Error('x')})()")` → throws `Error: x` +- `chrome_evaluate("document.body.innerHTML = '<...>'; return 'ok'")` → `"ok"` + +### T1.2 — Truthful click/type/fill results + +Every action handler now returns `isTrusted: false`, +`defaultPrevented`, `elementVisible`, `occludedBy`, `valueMatches`, and +`pageMutated`. The Node side formats those into the tool result text so the +agent can read failure cause from a single response. + +Verified live: +- `chrome_click(occluded-button)` → `"Clicked el-3 — pageMutated=false; occluded by "` +- `chrome_click(working-button)` → `"Clicked el-1"` (silent on success) + +### T1.3 — `/chrome-doctor` extended + +The command now probes: +- Local bridge mode + URL +- Companion extension version (with mismatch warning vs `PI_CHROME_VERSION`) +- `chrome_evaluate("1+1") === 2` in the active tab +- MAIN-world helper injection via `page.probe`, including `navigator.webdriver` fingerprint +- CDP availability at `127.0.0.1:9222` (informational; not used yet) + +### T1.4 — Misleading params removed/implemented + +- Dropped `chrome_evaluate.returnByValue` (was ignored). +- Implemented `chrome_screenshot.fullPage` via tile stitching (see T2.2). + +### T1.5 — Autoplay-gate heuristic + +`clickPage` checks whether the clicked element's label looks media-related +(`/^(play|start|begin|next|continue|unmute)/`) AND the page has paused +`