pi-chrome 0.15.32 → 0.15.33

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/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  All notable user-facing changes to `pi-chrome`.
4
4
 
5
+ ## 0.15.33 — 2026-05-31
6
+
7
+ - **Background is now the default.** `chrome_*` tools run silently without focusing Chrome unless you opt in. Pass `background: false` per call, or run `/chrome background off`, to bring Chrome forward and watch. Tool/param descriptions and docs updated to match.
8
+
5
9
  ## 0.15.32 — 2026-05-31
6
10
 
7
11
  - **Session tab-group naming tweak.** Per-session groups are now titled `Pi Session: <name-or-id>` (added a colon separator).
package/README.md CHANGED
@@ -176,15 +176,15 @@ This protects your signed-in Chrome profile from accidental agent use. The loopb
176
176
 
177
177
  ### Run in background / watch modes
178
178
 
179
- 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.
179
+ By default, every `chrome_*` call runs in the **background** — Chrome won't pop up or steal focus. Switch to foreground when you want to **watch the agent work** (demos, debugging, first-time confidence).
180
180
 
181
181
  ```text
182
182
  /chrome background # toggle for the whole session
183
- /chrome background on # run in background
183
+ /chrome background on # run in background (default)
184
184
  /chrome background off # bring Chrome forward so you can watch
185
185
  ```
186
186
 
187
- Per-call `background: true` wins over the session setting.
187
+ Per-call `background: false` wins over the session setting (and `background: true` forces background).
188
188
 
189
189
  ### Diagnostics
190
190
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "Pi Chrome Connector",
4
- "version": "0.15.32",
4
+ "version": "0.15.33",
5
5
  "description": "Lets Pi control tabs in Chrome via a local connector at 127.0.0.1.",
6
6
  "permissions": [
7
7
  "tabs",
@@ -549,7 +549,7 @@ export default function (pi: ExtensionAPI): void {
549
549
  globalState[PI_CHROME_GLOBAL_KEY] = { version: PI_CHROME_VERSION, root: currentRoot, token: instanceToken };
550
550
 
551
551
  const bridge = new ChromeProfileBridge(DEFAULT_HOST, DEFAULT_PORT);
552
- let backgroundDefault = false;
552
+ let backgroundDefault = true;
553
553
  let chromeAuthorizedUntil: number | "indefinite" | undefined;
554
554
  let chromeToolsRegistered = false;
555
555
  let authExpiryTimer: NodeJS.Timeout | undefined;
@@ -635,7 +635,7 @@ export default function (pi: ExtensionAPI): void {
635
635
  return bridge.send(action, params, timeoutMs, signal);
636
636
  };
637
637
 
638
- // Translate the public `background` parameter (default false = visible/foreground) into the
638
+ // Translate the public `background` parameter (default on = silent/background) into the
639
639
  // service worker's wire-level `foreground` flag, accepting legacy `foreground` as a fallback.
640
640
  const withBackground = <T extends Record<string, unknown>>(params: T): T => {
641
641
  const typed = params as { background?: boolean; foreground?: boolean };
@@ -682,7 +682,7 @@ Usage rules:
682
682
  3. \`includeSnapshot=true\` on click/type/fill/key to verify in one round trip.
683
683
  4. 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.
684
684
  5. \`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).
685
- 6. By default chrome_* tools focus Chrome so the user can watch; pass \`background=true\` or run /chrome background on for session-wide background execution.
685
+ 6. By default chrome_* tools run in the background without focusing Chrome; pass \`background=false\` or run /chrome background off when the user wants to watch Chrome work.
686
686
  7. 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.
687
687
  8. Run /chrome doctor when in doubt about connectivity or capabilities.
688
688
  </chrome-profile-bridge>`;
@@ -953,8 +953,8 @@ Usage rules:
953
953
  ];
954
954
  } else if (path[0] === "background" && path.length === 1) {
955
955
  candidates = [
956
- { fullValue: "background on", label: "on", description: "Run in background. Chrome stays in the background. Your editor keeps focus." },
957
- { fullValue: "background off", label: "off", description: "Bring Chrome to the front so you can watch (default)." },
956
+ { fullValue: "background on", label: "on", description: "Run in background. Chrome stays in the background. Your editor keeps focus. (default)" },
957
+ { fullValue: "background off", label: "off", description: "Bring Chrome to the front so you can watch." },
958
958
  { fullValue: "background toggle", label: "toggle", description: "Flip whichever way it's currently set." },
959
959
  { fullValue: "background status", label: "status", description: "Show the current setting." },
960
960
  ];
@@ -1073,7 +1073,7 @@ Usage rules:
1073
1073
  name: "chrome_snapshot",
1074
1074
  label: "Chrome Snapshot",
1075
1075
  description:
1076
- "Inspect a page in the user's existing Chrome profile: title, URL, visible body text, viewport, and clickable/focusable elements with stable uids plus CSS selectors. Brings Chrome to the foreground by default so the user can watch; pass background=true to inspect silently.",
1076
+ "Inspect a page in the user's existing Chrome profile: title, URL, visible body text, viewport, and clickable/focusable elements with stable uids plus CSS selectors. Runs in the background by default; pass background=false to bring Chrome to the foreground so the user can watch.",
1077
1077
  promptSnippet: "Inspect the current Chrome page and get CSS selectors for browser automation.",
1078
1078
  parameters: Type.Object({
1079
1079
  targetId: Type.Optional(Type.String()),
@@ -1084,7 +1084,7 @@ Usage rules:
1084
1084
  roleFilter: Type.Optional(Type.String({ description: "Only return elements matching this ARIA role or tag name (case-insensitive). e.g. 'button', 'link', 'textbox'." })),
1085
1085
  nearUid: Type.Optional(Type.String({ description: "Sort elements by proximity to this snapshot uid. Useful for finding controls near a known anchor." })),
1086
1086
  background: Type.Optional(
1087
- Type.Boolean({ description: "If true, run silently in the background without focusing Chrome. Default false (Chrome focuses + tab activates so the user can watch)." }),
1087
+ Type.Boolean({ description: "If true (the default), run silently in the background without focusing Chrome; pass false so Chrome focuses + the tab activates and the user can watch." }),
1088
1088
  ),
1089
1089
  host: Type.Optional(Type.String()),
1090
1090
  port: Type.Optional(Type.Number()),
@@ -1104,7 +1104,7 @@ Usage rules:
1104
1104
  name: "chrome_navigate",
1105
1105
  label: "Chrome Navigate",
1106
1106
  description:
1107
- "Navigate an existing Chrome tab to a URL via the companion extension. By default focuses Chrome and activates the tab so the user can watch; pass background=true to navigate silently. Optionally waits for load completion.",
1107
+ "Navigate an existing Chrome tab to a URL via the companion extension. Runs in the background by default; pass background=false to focus Chrome and activate the tab so the user can watch. Optionally waits for load completion.",
1108
1108
  promptSnippet: "Navigate a Chrome tab in the user's existing profile.",
1109
1109
  parameters: Type.Object({
1110
1110
  url: Type.String(),
@@ -1115,7 +1115,7 @@ Usage rules:
1115
1115
  timeoutMs: Type.Optional(Type.Number({ default: 15_000 })),
1116
1116
  initScript: Type.Optional(Type.String({ description: "Optional JavaScript source to run in MAIN world at document_start of the next navigation. Useful for seeding localStorage, stubbing Date.now(), or defining navigator.webdriver=undefined. Requires the companion extension's webNavigation permission." })),
1117
1117
  background: Type.Optional(
1118
- Type.Boolean({ description: "If true, navigate silently without focusing Chrome. Default false." }),
1118
+ Type.Boolean({ description: "If true, navigate silently without focusing Chrome. Defaults to on (the session background setting); pass false to focus Chrome so the user can watch." }),
1119
1119
  ),
1120
1120
  host: Type.Optional(Type.String()),
1121
1121
  port: Type.Optional(Type.Number()),
@@ -1130,7 +1130,7 @@ Usage rules:
1130
1130
  name: "chrome_evaluate",
1131
1131
  label: "Chrome Evaluate",
1132
1132
  description:
1133
- "Evaluate JavaScript in an existing Chrome tab through the companion extension. Runs in the page context and returns JSON-serializable values when possible. By default focuses Chrome and activates the tab; pass background=true to evaluate silently.",
1133
+ "Evaluate JavaScript in an existing Chrome tab through the companion extension. Runs in the page context and returns JSON-serializable values when possible. Runs in the background by default; pass background=false to focus Chrome and activate the tab.",
1134
1134
  promptSnippet: "Evaluate JavaScript in the active Chrome tab through the companion extension.",
1135
1135
  parameters: Type.Object({
1136
1136
  expression: Type.String(),
@@ -1139,7 +1139,7 @@ Usage rules:
1139
1139
  urlIncludes: Type.Optional(Type.String()),
1140
1140
  titleIncludes: Type.Optional(Type.String()),
1141
1141
  background: Type.Optional(
1142
- Type.Boolean({ description: "If true, evaluate silently without focusing Chrome. Default false." }),
1142
+ Type.Boolean({ description: "If true, evaluate silently without focusing Chrome. Defaults to on (the session background setting); pass false to focus Chrome so the user can watch." }),
1143
1143
  ),
1144
1144
  host: Type.Optional(Type.String()),
1145
1145
  port: Type.Optional(Type.Number()),
@@ -1172,7 +1172,7 @@ Usage rules:
1172
1172
  urlIncludes: Type.Optional(Type.String()),
1173
1173
  titleIncludes: Type.Optional(Type.String()),
1174
1174
  background: Type.Optional(
1175
- Type.Boolean({ description: "If true, click silently without focusing Chrome. Default false." }),
1175
+ Type.Boolean({ description: "If true, click silently without focusing Chrome. Defaults to on (the session background setting); pass false to focus Chrome so the user can watch." }),
1176
1176
  ),
1177
1177
  host: Type.Optional(Type.String()),
1178
1178
  port: Type.Optional(Type.Number()),
@@ -1204,7 +1204,7 @@ Usage rules:
1204
1204
  urlIncludes: Type.Optional(Type.String()),
1205
1205
  titleIncludes: Type.Optional(Type.String()),
1206
1206
  background: Type.Optional(
1207
- Type.Boolean({ description: "If true, type silently without focusing Chrome. Default false." }),
1207
+ Type.Boolean({ description: "If true, type silently without focusing Chrome. Defaults to on (the session background setting); pass false to focus Chrome so the user can watch." }),
1208
1208
  ),
1209
1209
  host: Type.Optional(Type.String()),
1210
1210
  port: Type.Optional(Type.Number()),
@@ -1236,7 +1236,7 @@ Usage rules:
1236
1236
  urlIncludes: Type.Optional(Type.String()),
1237
1237
  titleIncludes: Type.Optional(Type.String()),
1238
1238
  background: Type.Optional(
1239
- Type.Boolean({ description: "If true, fill silently without focusing Chrome. Default false." }),
1239
+ Type.Boolean({ description: "If true, fill silently without focusing Chrome. Defaults to on (the session background setting); pass false to focus Chrome so the user can watch." }),
1240
1240
  ),
1241
1241
  host: Type.Optional(Type.String()),
1242
1242
  port: Type.Optional(Type.Number()),
@@ -1255,7 +1255,7 @@ Usage rules:
1255
1255
  name: "chrome_key",
1256
1256
  label: "Chrome Key",
1257
1257
  description:
1258
- "Send a keyboard key to an existing Chrome tab (Enter, Escape, Tab, Backspace, Delete, ArrowUp/Down/Left/Right, or one character). By default focuses Chrome and activates the tab so the user can watch; pass background=true to send the key silently. Pass includeSnapshot=true to verify after the keypress.",
1258
+ "Send a keyboard key to an existing Chrome tab (Enter, Escape, Tab, Backspace, Delete, ArrowUp/Down/Left/Right, or one character). Runs in the background by default; pass background=false to focus Chrome and activate the tab so the user can watch. Pass includeSnapshot=true to verify after the keypress.",
1259
1259
  promptSnippet: "Press keys in Chrome through the companion extension.",
1260
1260
  parameters: Type.Object({
1261
1261
  key: Type.String(),
@@ -1271,7 +1271,7 @@ Usage rules:
1271
1271
  urlIncludes: Type.Optional(Type.String()),
1272
1272
  titleIncludes: Type.Optional(Type.String()),
1273
1273
  background: Type.Optional(
1274
- Type.Boolean({ description: "If true, send the key silently without focusing Chrome. Default false." }),
1274
+ Type.Boolean({ description: "If true, send the key silently without focusing Chrome. Defaults to on (the session background setting); pass false to focus Chrome so the user can watch." }),
1275
1275
  ),
1276
1276
  host: Type.Optional(Type.String()),
1277
1277
  port: Type.Optional(Type.Number()),
@@ -1318,7 +1318,7 @@ Usage rules:
1318
1318
  targetId: Type.Optional(Type.String()),
1319
1319
  urlIncludes: Type.Optional(Type.String()),
1320
1320
  titleIncludes: Type.Optional(Type.String()),
1321
- background: Type.Optional(Type.Boolean({ description: "If true, run silently without focusing Chrome. Default false." })),
1321
+ background: Type.Optional(Type.Boolean({ description: "If true, run silently without focusing Chrome. Defaults to on (the session background setting); pass false to focus Chrome so the user can watch." })),
1322
1322
  host: Type.Optional(Type.String()),
1323
1323
  port: Type.Optional(Type.Number()),
1324
1324
  }),
@@ -1340,7 +1340,7 @@ Usage rules:
1340
1340
  targetId: Type.Optional(Type.String()),
1341
1341
  urlIncludes: Type.Optional(Type.String()),
1342
1342
  titleIncludes: Type.Optional(Type.String()),
1343
- background: Type.Optional(Type.Boolean({ description: "If true, run silently without focusing Chrome. Default false." })),
1343
+ background: Type.Optional(Type.Boolean({ description: "If true, run silently without focusing Chrome. Defaults to on (the session background setting); pass false to focus Chrome so the user can watch." })),
1344
1344
  host: Type.Optional(Type.String()),
1345
1345
  port: Type.Optional(Type.Number()),
1346
1346
  }),
@@ -1360,7 +1360,7 @@ Usage rules:
1360
1360
  targetId: Type.Optional(Type.String()),
1361
1361
  urlIncludes: Type.Optional(Type.String()),
1362
1362
  titleIncludes: Type.Optional(Type.String()),
1363
- background: Type.Optional(Type.Boolean({ description: "If true, run silently without focusing Chrome. Default false." })),
1363
+ background: Type.Optional(Type.Boolean({ description: "If true, run silently without focusing Chrome. Defaults to on (the session background setting); pass false to focus Chrome so the user can watch." })),
1364
1364
  host: Type.Optional(Type.String()),
1365
1365
  port: Type.Optional(Type.Number()),
1366
1366
  }),
@@ -1374,7 +1374,7 @@ Usage rules:
1374
1374
  name: "chrome_screenshot",
1375
1375
  label: "Chrome Screenshot",
1376
1376
  description:
1377
- "Capture a screenshot of an existing Chrome tab via the companion extension and save it to disk. Chrome's extension screenshot API requires the target tab to be the active tab in its window. By default Chrome is focused and the tab activates so the user can watch; pass background=true to capture silently (the tab is briefly activated within its window for the capture, then the previous active tab is restored).",
1377
+ "Capture a screenshot of an existing Chrome tab via the companion extension and save it to disk. Chrome's extension screenshot API requires the target tab to be the active tab in its window. Runs in the background by default (the tab is briefly activated within its window for the capture, then the previous active tab is restored); pass background=false to focus Chrome so the user can watch.",
1378
1378
  promptSnippet: "Capture Chrome screenshots and save them under .pi/chrome-screenshots by default.",
1379
1379
  parameters: Type.Object({
1380
1380
  path: Type.Optional(Type.String({ description: "Output path. Defaults to .pi/chrome-screenshots/<timestamp>.<format>." })),
@@ -1385,7 +1385,7 @@ Usage rules:
1385
1385
  urlIncludes: Type.Optional(Type.String()),
1386
1386
  titleIncludes: Type.Optional(Type.String()),
1387
1387
  background: Type.Optional(
1388
- Type.Boolean({ description: "If true, capture silently without focusing the Chrome window (the target tab is briefly activated within its window for the capture, then restored). Default false." }),
1388
+ Type.Boolean({ description: "If true (the default), capture silently without focusing the Chrome window (the target tab is briefly activated within its window for the capture, then restored); pass false to focus Chrome." }),
1389
1389
  ),
1390
1390
  host: Type.Optional(Type.String()),
1391
1391
  port: Type.Optional(Type.Number()),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-chrome",
3
- "version": "0.15.32",
3
+ "version": "0.15.33",
4
4
  "scripts": {
5
5
  "test": "node test-suite/unit/csp-eval.test.mjs",
6
6
  "version": "node scripts/sync-manifest-version.js",