pi-chrome 0.15.3 → 0.15.4
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
|
@@ -134,7 +134,7 @@ You: [files the ticket with the folder attached]
|
|
|
134
134
|
| Uses your real signed-in Chrome | ✅ extension in your profile | ❌ throwaway profile | ⚠️ requires `--remote-debug` | ❌ throwaway profile |
|
|
135
135
|
| Re-login required | **Never** | Every run | Sometimes | Every run |
|
|
136
136
|
| **Multiple agents drive the same Chrome at once** | ✅ shared bridge | ❌ port collisions | ❌ | ❌ |
|
|
137
|
-
| Watch agent work, live | ✅ default;
|
|
137
|
+
| Watch agent work, live | ✅ default; run in background optional | ❌ headless or new window | ⚠️ debugger banner always | ❌ new window |
|
|
138
138
|
| Real browser input | ✅ always for input tools | ✅ | ✅ | ✅ |
|
|
139
139
|
| Network/console capture | ✅ built-in | ✅ | ✅ | ⚠️ via extensions |
|
|
140
140
|
| **Honest result envelopes¹** | ✅ | ⚠️ | ❌ | ❌ |
|
|
@@ -185,23 +185,23 @@ Each tool is documented inline in Pi — agents see the parameters and gotchas (
|
|
|
185
185
|
|
|
186
186
|
`pi-chrome` drives interactive controls through Chrome's real input layer: clicks, typing, fill, keys, hover, drag, scroll, and touch. Under the hood it uses `chrome.debugger` / CDP, so input satisfies normal user-activation gates. Chrome may show the *"Pi Chrome Connector started debugging this browser"* banner while attached.
|
|
187
187
|
|
|
188
|
-
###
|
|
188
|
+
### Run in background / watch modes
|
|
189
189
|
|
|
190
190
|
By default, every `chrome_*` call focuses Chrome and activates the target tab so you can **watch the agent work** — invaluable for demos, debugging, and first-time confidence.
|
|
191
191
|
|
|
192
192
|
```text
|
|
193
|
-
/chrome
|
|
194
|
-
/chrome
|
|
195
|
-
/chrome
|
|
193
|
+
/chrome background # toggle for the whole session
|
|
194
|
+
/chrome background on # run in background
|
|
195
|
+
/chrome background off # bring Chrome forward so you can watch
|
|
196
196
|
```
|
|
197
197
|
|
|
198
|
-
Per-call `background: true` wins over the session
|
|
198
|
+
Per-call `background: true` wins over the session setting.
|
|
199
199
|
|
|
200
200
|
### Diagnostics
|
|
201
201
|
|
|
202
202
|
- `/chrome doctor` — single command: connectivity, extension version, bridge owner, version drift, MAIN-world helper injection, `chrome_evaluate("1+1") === 2`, fingerprint flags.
|
|
203
203
|
- `/chrome onboard` — guided first-time setup.
|
|
204
|
-
- `/chrome
|
|
204
|
+
- `/chrome background status` — current watch/background setting.
|
|
205
205
|
|
|
206
206
|
If the loaded Chrome extension is older than `pi-chrome` on disk, `/chrome doctor` tells you to reload it from `chrome://extensions`.
|
|
207
207
|
|
|
@@ -446,7 +446,7 @@ Usage rules:
|
|
|
446
446
|
2. \`includeSnapshot=true\` on click/type/fill to verify in one round trip.
|
|
447
447
|
3. If \`chrome_evaluate\` returns null when you expected a value, the expression evaluated to null/undefined in the page; surface the value via \`JSON.stringify\` to confirm.
|
|
448
448
|
4. \`chrome_navigate\` supports an optional \`initScript\` that runs at document_start in MAIN world for the next navigation (good for seeding localStorage or stubbing Date.now).
|
|
449
|
-
5. By default chrome_* tools focus Chrome so the user can watch; pass \`background=true\` or run /chrome
|
|
449
|
+
5. By default chrome_* tools focus Chrome so the user can watch; pass \`background=true\` or run /chrome background on for session-wide background execution.
|
|
450
450
|
6. If you hit a native file-picker or privileged browser prompt gate, tell the user; generic clicks/typing/CSP gates are handled by Chrome input.
|
|
451
451
|
7. Run /chrome doctor when in doubt about connectivity or capabilities.
|
|
452
452
|
</chrome-profile-bridge>`;
|
|
@@ -517,9 +517,9 @@ Usage rules:
|
|
|
517
517
|
ctx.ui.notify(lines.join("\n"), "info");
|
|
518
518
|
};
|
|
519
519
|
|
|
520
|
-
//
|
|
521
|
-
const
|
|
522
|
-
on: "pi-chrome
|
|
520
|
+
// Run-in-background (Chrome focus) handler. No args = toggle. Explicit on/off/status.
|
|
521
|
+
const BACKGROUND_DESC: Record<string, string> = {
|
|
522
|
+
on: "pi-chrome runs in the background; Chrome won't pop up or steal focus.",
|
|
523
523
|
off: "Chrome pops to the front and switches tabs so you can watch what pi-chrome is doing.",
|
|
524
524
|
};
|
|
525
525
|
|
|
@@ -528,7 +528,7 @@ Usage rules:
|
|
|
528
528
|
const currentLabel = backgroundDefault ? "on" : "off";
|
|
529
529
|
|
|
530
530
|
if (arg === "status") {
|
|
531
|
-
ctx.ui.notify(`
|
|
531
|
+
ctx.ui.notify(`Run in background is ${currentLabel}. ${BACKGROUND_DESC[currentLabel]}`, "info");
|
|
532
532
|
return;
|
|
533
533
|
}
|
|
534
534
|
|
|
@@ -536,12 +536,12 @@ Usage rules:
|
|
|
536
536
|
else if (arg === "off" || arg === "false" || arg === "0") backgroundDefault = false;
|
|
537
537
|
else if (arg === "toggle" || arg === "") backgroundDefault = !backgroundDefault;
|
|
538
538
|
else {
|
|
539
|
-
ctx.ui.notify(`Unknown
|
|
539
|
+
ctx.ui.notify(`Unknown background setting '${arg}'. Pick one of: on | off | toggle | status.`, "warning");
|
|
540
540
|
return;
|
|
541
541
|
}
|
|
542
542
|
|
|
543
543
|
const nextLabel = backgroundDefault ? "on" : "off";
|
|
544
|
-
ctx.ui.notify(`
|
|
544
|
+
ctx.ui.notify(`Run in background → ${nextLabel}. ${BACKGROUND_DESC[nextLabel]}`, "info");
|
|
545
545
|
};
|
|
546
546
|
|
|
547
547
|
const onboardHandler = async (ctx: ExtensionContext) => {
|
|
@@ -579,7 +579,7 @@ Usage rules:
|
|
|
579
579
|
} catch {
|
|
580
580
|
parts.push(`✗ Chrome not responding`);
|
|
581
581
|
}
|
|
582
|
-
parts.push(`
|
|
582
|
+
parts.push(`background: ${backgroundDefault ? "on" : "off"}`);
|
|
583
583
|
return parts.join(" · ");
|
|
584
584
|
};
|
|
585
585
|
|
|
@@ -591,14 +591,14 @@ Usage rules:
|
|
|
591
591
|
// the last value also saves; Esc / 'q' closes. The description below changes with the
|
|
592
592
|
// current value so users always see what the active setting means.
|
|
593
593
|
const openSettingsDialog = async (ctx: ExtensionContext): Promise<void> => {
|
|
594
|
-
const
|
|
595
|
-
id: "
|
|
596
|
-
label: "
|
|
594
|
+
const backgroundItem: SettingItem = {
|
|
595
|
+
id: "background",
|
|
596
|
+
label: "Run in background",
|
|
597
597
|
currentValue: backgroundDefault ? "on" : "off",
|
|
598
598
|
values: ["on", "off"],
|
|
599
|
-
description:
|
|
599
|
+
description: BACKGROUND_DESC[backgroundDefault ? "on" : "off"] ?? "",
|
|
600
600
|
};
|
|
601
|
-
const items: SettingItem[] = [
|
|
601
|
+
const items: SettingItem[] = [backgroundItem];
|
|
602
602
|
|
|
603
603
|
await ctx.ui.custom<void>((_tui, theme, _kb, done) => {
|
|
604
604
|
const container = new Container();
|
|
@@ -611,10 +611,10 @@ Usage rules:
|
|
|
611
611
|
Math.min(items.length + 2, 8),
|
|
612
612
|
getSettingsListTheme(),
|
|
613
613
|
(id, newValue) => {
|
|
614
|
-
if (id === "
|
|
614
|
+
if (id === "background") {
|
|
615
615
|
backgroundDefault = newValue === "on";
|
|
616
|
-
|
|
617
|
-
|
|
616
|
+
backgroundItem.currentValue = newValue;
|
|
617
|
+
backgroundItem.description = BACKGROUND_DESC[newValue] ?? "";
|
|
618
618
|
list.invalidate();
|
|
619
619
|
}
|
|
620
620
|
},
|
|
@@ -632,7 +632,7 @@ Usage rules:
|
|
|
632
632
|
|
|
633
633
|
pi.registerCommand("chrome", {
|
|
634
634
|
description:
|
|
635
|
-
"All pi-chrome controls in one place.\n /chrome status — one-line snapshot of connection +
|
|
635
|
+
"All pi-chrome controls in one place.\n /chrome status — one-line snapshot of connection + background setting.\n /chrome doctor — full health check.\n /chrome onboard — install the Chrome companion extension.\n /chrome background [on|off|status|toggle] — whether pi-chrome runs without focusing Chrome.\nRun with no arguments for an interactive picker that shows current state.",
|
|
636
636
|
getArgumentCompletions: (prefix) => {
|
|
637
637
|
const raw = prefix;
|
|
638
638
|
const trimmedRight = raw.replace(/\s+$/, "");
|
|
@@ -649,17 +649,17 @@ Usage rules:
|
|
|
649
649
|
let candidates: Item[] = [];
|
|
650
650
|
if (path.length === 0) {
|
|
651
651
|
candidates = [
|
|
652
|
-
{ fullValue: "status", label: "status", description: "One-line summary: connection +
|
|
652
|
+
{ fullValue: "status", label: "status", description: "One-line summary: connection + background setting." },
|
|
653
653
|
{ fullValue: "doctor", label: "doctor", description: "Full health check. Tells you if Chrome is connected and what's wrong if it isn't." },
|
|
654
654
|
{ fullValue: "onboard", label: "onboard", description: "Install the Chrome companion extension (first-time setup)." },
|
|
655
|
-
{ fullValue: "
|
|
655
|
+
{ fullValue: "background", label: "background", description: "Run pi-chrome in the background without focusing Chrome?" },
|
|
656
656
|
];
|
|
657
|
-
} else if (path[0] === "
|
|
657
|
+
} else if (path[0] === "background" && path.length === 1) {
|
|
658
658
|
candidates = [
|
|
659
|
-
{ fullValue: "
|
|
660
|
-
{ fullValue: "
|
|
661
|
-
{ fullValue: "
|
|
662
|
-
{ fullValue: "
|
|
659
|
+
{ fullValue: "background on", label: "on", description: "Run in background. Chrome stays in the background. Your editor keeps focus." },
|
|
660
|
+
{ fullValue: "background off", label: "off", description: "Bring Chrome to the front so you can watch (default)." },
|
|
661
|
+
{ fullValue: "background toggle", label: "toggle", description: "Flip whichever way it's currently set." },
|
|
662
|
+
{ fullValue: "background status", label: "status", description: "Show the current setting." },
|
|
663
663
|
];
|
|
664
664
|
}
|
|
665
665
|
if (candidates.length === 0) return null;
|
|
@@ -679,18 +679,17 @@ Usage rules:
|
|
|
679
679
|
case "status": return statusHandler(ctx);
|
|
680
680
|
case "doctor": return doctorHandler(ctx);
|
|
681
681
|
case "onboard": return onboardHandler(ctx);
|
|
682
|
-
case "
|
|
683
|
-
case "background": // legacy alias
|
|
682
|
+
case "background":
|
|
684
683
|
return backgroundHandler(ctx, subArgs);
|
|
685
684
|
case "settings": {
|
|
686
685
|
// Legacy nested form: /chrome settings background ...
|
|
687
686
|
const [setting, ...settingArgs] = rest;
|
|
688
687
|
if (setting === "background") return backgroundHandler(ctx, settingArgs.join(" "));
|
|
689
|
-
ctx.ui.notify(`'/chrome settings' was removed. Use /chrome
|
|
688
|
+
ctx.ui.notify(`'/chrome settings' was removed. Use /chrome background directly.`, "warning");
|
|
690
689
|
return;
|
|
691
690
|
}
|
|
692
691
|
default:
|
|
693
|
-
ctx.ui.notify(`Unknown subcommand '${head}'. Try: /chrome status | doctor | onboard |
|
|
692
|
+
ctx.ui.notify(`Unknown subcommand '${head}'. Try: /chrome status | doctor | onboard | background.`, "warning");
|
|
694
693
|
}
|
|
695
694
|
},
|
|
696
695
|
});
|