pi-chrome 0.4.4 → 0.5.0
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
|
@@ -13,7 +13,7 @@ Multiple Pi sessions can use Chrome at the same time. The first Pi session start
|
|
|
13
13
|
- **Uses your existing Chrome profile** — works with the Chrome windows/tabs you are already using, including logged-in GitHub, admin dashboards, local apps, and internal tools.
|
|
14
14
|
- **Background by default** — agents can inspect, navigate, click, type, and snapshot without bringing Chrome to the foreground or interrupting whatever you are doing. Toggle for the whole session with `/chrome-foreground`, or pass `foreground: true` on a single tool call.
|
|
15
15
|
- **Full browser automation toolkit for Pi** — list/create/activate/close tabs, snapshot pages with usable CSS selectors, navigate, evaluate JavaScript, click, type, press keys, wait for page state, and capture screenshots.
|
|
16
|
-
- **Built-in setup and agent guidance** — `/chrome-onboard` walks users through installing the companion extension, `/chrome-
|
|
16
|
+
- **Built-in setup and agent guidance** — `/chrome-onboard` walks users through installing the companion extension, `/chrome-doctor` checks connectivity and version drift, screenshots save to disk, and the prompt primer tells agents to inspect with `chrome_snapshot` before acting and avoid destructive actions unless explicitly requested.
|
|
17
17
|
|
|
18
18
|
## Install
|
|
19
19
|
|
|
@@ -53,14 +53,16 @@ Then in Chrome:
|
|
|
53
53
|
4. Return to Pi and run:
|
|
54
54
|
|
|
55
55
|
```text
|
|
56
|
-
/chrome-
|
|
56
|
+
/chrome-doctor
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
Expected
|
|
59
|
+
Expected output:
|
|
60
60
|
|
|
61
61
|
```text
|
|
62
62
|
Performing Chrome bridge health check
|
|
63
|
-
|
|
63
|
+
pi-chrome v<version>
|
|
64
|
+
• Local bridge: mode=server, url=http://127.0.0.1:17318
|
|
65
|
+
✓ Companion Chrome extension responding (ID: <chrome-extension-id>, ext v<version>)
|
|
64
66
|
```
|
|
65
67
|
|
|
66
68
|
## Foreground control
|
|
@@ -115,8 +117,7 @@ Screenshots save under `.pi/chrome-screenshots/` by default, which composes nice
|
|
|
115
117
|
|
|
116
118
|
## Diagnostics
|
|
117
119
|
|
|
118
|
-
- `/chrome-
|
|
119
|
-
- `/chrome-doctor` — deeper diagnosis with one-line fixes for common setup failures (extension not loaded, bridge owner stale after `pi update`, version mismatch between pi-chrome and the loaded Chrome extension).
|
|
120
|
+
- `/chrome-doctor` — single command that checks connectivity and reports the loaded Chrome extension ID + version, plus a one-line fix for common setup failures (extension not loaded, bridge owner stale after `pi update`, version mismatch between pi-chrome and the loaded Chrome extension).
|
|
120
121
|
|
|
121
122
|
If the Chrome extension you have loaded is older than `pi-chrome` on disk, `/chrome-doctor` will tell you to reload it from `chrome://extensions`.
|
|
122
123
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest_version": 3,
|
|
3
3
|
"name": "Pi Existing Chrome Profile Bridge",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
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/*"],
|
|
@@ -46,7 +46,7 @@ type BridgeResult = {
|
|
|
46
46
|
error?: string;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
const PI_CHROME_VERSION = "0.
|
|
49
|
+
const PI_CHROME_VERSION = "0.5.0";
|
|
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;
|
|
@@ -370,31 +370,16 @@ If chrome_* tools time out, ask the user to run /chrome-onboard, then load the b
|
|
|
370
370
|
return { systemPrompt: event.systemPrompt + primer };
|
|
371
371
|
});
|
|
372
372
|
|
|
373
|
-
pi.registerCommand("chrome-status", {
|
|
374
|
-
description: "Run an explicit health check against the existing-profile Chrome companion extension",
|
|
375
|
-
handler: async (_args, ctx) => {
|
|
376
|
-
ctx.ui.notify("Performing Chrome bridge health check", "info");
|
|
377
|
-
try {
|
|
378
|
-
const version = (await bridge.send("tab.version", {}, 35_000)) as { extensionId?: string; extensionVersion?: string };
|
|
379
|
-
const suffix = [version.extensionId ? `ID: ${version.extensionId}` : null, version.extensionVersion ? `ext v${version.extensionVersion}` : null]
|
|
380
|
-
.filter(Boolean)
|
|
381
|
-
.join(", ");
|
|
382
|
-
ctx.ui.notify(suffix ? `Chrome profile bridge connected (${suffix})` : "Chrome profile bridge connected", "info");
|
|
383
|
-
} catch (error) {
|
|
384
|
-
ctx.ui.notify(`Chrome bridge health check failed: ${(error as Error).message}`, "warning");
|
|
385
|
-
}
|
|
386
|
-
},
|
|
387
|
-
});
|
|
388
|
-
|
|
389
373
|
pi.registerCommand("chrome-doctor", {
|
|
390
374
|
description:
|
|
391
|
-
"
|
|
375
|
+
"Check Chrome bridge connectivity and diagnose setup. Reports the local bridge, companion Chrome extension status (ID + version), and a one-line fix for common failures (extension not loaded, stale service worker, version drift).",
|
|
392
376
|
handler: async (_args, ctx) => {
|
|
377
|
+
ctx.ui.notify("Performing Chrome bridge health check", "info");
|
|
393
378
|
const lines: string[] = [`pi-chrome v${PI_CHROME_VERSION}`];
|
|
394
379
|
const status = bridge.status();
|
|
395
380
|
lines.push(`• Local bridge: mode=${status.mode}, url=${status.url}`);
|
|
396
381
|
try {
|
|
397
|
-
const version = (await bridge.send("tab.version", {},
|
|
382
|
+
const version = (await bridge.send("tab.version", {}, 35_000)) as {
|
|
398
383
|
extensionId?: string;
|
|
399
384
|
extensionVersion?: string;
|
|
400
385
|
};
|
|
@@ -463,7 +448,7 @@ If chrome_* tools time out, ask the user to run /chrome-onboard, then load the b
|
|
|
463
448
|
await pi.exec("sh", ["-lc", `printf %s ${JSON.stringify(extensionPath)} | pbcopy`], { cwd: workspaceCwd(ctx), timeout: 5_000 }).catch(() => undefined);
|
|
464
449
|
}
|
|
465
450
|
ctx.ui.notify(
|
|
466
|
-
"Chrome bridge setup opened. The extension path has been copied to your clipboard. After loading it, run /chrome-
|
|
451
|
+
"Chrome bridge setup opened. The extension path has been copied to your clipboard. After loading it, run /chrome-doctor.",
|
|
467
452
|
"info",
|
|
468
453
|
);
|
|
469
454
|
},
|