pi-chrome 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -123,6 +123,7 @@ If the Chrome extension you have loaded is older than `pi-chrome` on disk, `/chr
|
|
|
123
123
|
## Compose with
|
|
124
124
|
|
|
125
125
|
- **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`.
|
|
126
|
+
- **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.
|
|
126
127
|
- **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.
|
|
127
128
|
|
|
128
129
|
## Tools
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest_version": 3,
|
|
3
3
|
"name": "Pi Existing Chrome Profile Bridge",
|
|
4
|
-
"version": "0.4.
|
|
4
|
+
"version": "0.4.3",
|
|
5
5
|
"description": "Lets Pi control tabs in this existing Chrome profile via a local bridge at 127.0.0.1.",
|
|
6
6
|
"permissions": ["tabs", "scripting", "storage", "activeTab", "alarms"],
|
|
7
7
|
"host_permissions": ["<all_urls>", "http://127.0.0.1:17318/*"],
|
|
@@ -41,13 +41,17 @@ async function pollLoop() {
|
|
|
41
41
|
polling = true;
|
|
42
42
|
try {
|
|
43
43
|
while (true) {
|
|
44
|
+
// Long-poll /next continuously. The bridge holds the request for up to ~25s when no
|
|
45
|
+
// command is pending and returns {type:"none"}; we immediately re-issue the fetch so
|
|
46
|
+
// commands sent while the SW is otherwise idle still get picked up promptly. The open
|
|
47
|
+
// fetch also keeps the MV3 service worker alive between alarm wake-ups.
|
|
44
48
|
const response = await fetch(`${BRIDGE_URL}/next?name=${encodeURIComponent(CLIENT_NAME)}`, {
|
|
45
49
|
cache: "no-store",
|
|
46
50
|
});
|
|
47
51
|
if (!response.ok) throw new Error(`bridge /next HTTP ${response.status}`);
|
|
48
52
|
const payload = await response.json();
|
|
49
|
-
if (payload.type
|
|
50
|
-
|
|
53
|
+
if (payload.type === "command") await handleCommand(payload.command);
|
|
54
|
+
// Otherwise (type:"none"), loop and re-issue the long-poll.
|
|
51
55
|
}
|
|
52
56
|
} catch (error) {
|
|
53
57
|
await sleep(POLL_ERROR_BACKOFF_MS);
|
|
@@ -46,7 +46,7 @@ type BridgeResult = {
|
|
|
46
46
|
error?: string;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
const PI_CHROME_VERSION = "0.4.
|
|
49
|
+
const PI_CHROME_VERSION = "0.4.3";
|
|
50
50
|
const DEFAULT_HOST = process.env.PI_CHROME_BRIDGE_HOST ?? "127.0.0.1";
|
|
51
51
|
const DEFAULT_PORT = Number(process.env.PI_CHROME_BRIDGE_PORT ?? "17318");
|
|
52
52
|
const DEFAULT_TIMEOUT_MS = 30_000;
|