@howaboua/pi-browser 0.0.15 → 0.0.16

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
@@ -1,5 +1,9 @@
1
1
  # @howaboua/pi-browser
2
2
 
3
+ ## 0.0.16
4
+
5
+ - Shortened browser timeout and tab-creation errors. They say what may have happened and what to check before retrying.
6
+
3
7
  ## 0.0.15
4
8
 
5
9
  - Browser settings clarify which listed host runs locally and where to set the Node.js executable for SSH hosts.
package/README.md CHANGED
@@ -10,7 +10,7 @@ The extension is the TypeScript counterpart of Pi Codex's browser custom tool. I
10
10
  pi install npm:@howaboua/pi-browser
11
11
  ```
12
12
 
13
- Requires Pi 1.0.0 or newer, Node.js 22.19 or newer, and a Chrome-family browser with remote debugging enabled at `chrome://inspect/#remote-debugging`.
13
+ Requires the latest Pi release, Node.js 22.19 or newer, and a Chrome-family browser with remote debugging enabled at `chrome://inspect/#remote-debugging`.
14
14
 
15
15
  Pi Codex 3.0.52 or newer is optional. Without it, Browser remains a normal top-level Pi tool. Do not load Pi Codex's example `browser.toml` custom tool alongside this extension.
16
16
 
@@ -841,10 +841,10 @@ function cdpTimeoutAttempts(method) {
841
841
  function timeoutError(method, attempts) {
842
842
  const seconds = CDP_TIMEOUT_MS / 1000;
843
843
  if (attempts > 1) {
844
- return new Error(`Chrome did not answer ${method} after two ${seconds}s attempts. The tab may be unresponsive or suspended.`);
844
+ return new Error(`${method} timed out twice (${seconds}s each). Tab may be unresponsive or suspended.`);
845
845
  }
846
846
  if (method === "Runtime.evaluate") {
847
- return new Error(`Chrome did not answer Runtime.evaluate within ${seconds}s. The expression or awaited promise may still be running; check its effect before retrying.`);
847
+ return new Error(`Runtime.evaluate timed out (${seconds}s). Expression or awaited promise may still be running. Check effects before retrying.`);
848
848
  }
849
849
  return new Error(`Chrome did not answer ${method} within ${seconds}s.`);
850
850
  }
@@ -1342,7 +1342,7 @@ class BrowserTabs {
1342
1342
  try {
1343
1343
  response = asRecord(await this.cdp.send("Target.createTarget", { url, background: true }), "Target.createTarget response");
1344
1344
  } catch (error) {
1345
- throw new Error(`Chrome did not confirm tab creation; a shared tab may exist. Run tabs before retrying: ${errorMessage(error)}`);
1345
+ throw new Error(`Tab may have opened as shared. Run tabs before retrying: ${errorMessage(error)}`);
1346
1346
  }
1347
1347
  if (typeof response["targetId"] !== "string")
1348
1348
  throw new Error("Chrome did not return a new tab target; run tabs before retrying");
@@ -1350,7 +1350,7 @@ class BrowserTabs {
1350
1350
  try {
1351
1351
  await this.remember(created);
1352
1352
  } catch (error) {
1353
- throw new Error(`Opened tab ${created} but could not save ownership; it remains shared: ${errorMessage(error)}`);
1353
+ throw new Error(`Opened tab ${created}. Ownership save failed. Tab remains shared: ${errorMessage(error)}`);
1354
1354
  }
1355
1355
  return created;
1356
1356
  }, signal);
@@ -1821,7 +1821,7 @@ function browserHelp(hosts = []) {
1821
1821
  type: "ref_id text id?; id focuses",
1822
1822
  fill: "ref_id id|selector value; replace/clear text, select option value/label, boolean checks/unchecks",
1823
1823
  press: "ref_id key; focused element, e.g. Enter or Control+a",
1824
- wait: "ref_id selector|text|url_includes timeout_ms?; DOM presence or substring, default 10000ms",
1824
+ wait: "ref_id selector|text|url_includes timeout_ms?; DOM presence or substring",
1825
1825
  screenshot: "ref_id id?|selector?; brings tab to foreground -> file",
1826
1826
  navigate: "ref_id url",
1827
1827
  html: "ref_id id?|selector?",
@@ -21,7 +21,7 @@ export function browserHelp(hosts = []) {
21
21
  type: "ref_id text id?; id focuses",
22
22
  fill: "ref_id id|selector value; replace/clear text, select option value/label, boolean checks/unchecks",
23
23
  press: "ref_id key; focused element, e.g. Enter or Control+a",
24
- wait: "ref_id selector|text|url_includes timeout_ms?; DOM presence or substring, default 10000ms",
24
+ wait: "ref_id selector|text|url_includes timeout_ms?; DOM presence or substring",
25
25
  screenshot: "ref_id id?|selector?; brings tab to foreground -> file",
26
26
  navigate: "ref_id url",
27
27
  html: "ref_id id?|selector?",
@@ -13,10 +13,10 @@ function cdpTimeoutAttempts(method) {
13
13
  function timeoutError(method, attempts) {
14
14
  const seconds = CDP_TIMEOUT_MS / 1_000;
15
15
  if (attempts > 1) {
16
- return new Error(`Chrome did not answer ${method} after two ${seconds}s attempts. The tab may be unresponsive or suspended.`);
16
+ return new Error(`${method} timed out twice (${seconds}s each). Tab may be unresponsive or suspended.`);
17
17
  }
18
18
  if (method === "Runtime.evaluate") {
19
- return new Error(`Chrome did not answer Runtime.evaluate within ${seconds}s. The expression or awaited promise may still be running; check its effect before retrying.`);
19
+ return new Error(`Runtime.evaluate timed out (${seconds}s). Expression or awaited promise may still be running. Check effects before retrying.`);
20
20
  }
21
21
  return new Error(`Chrome did not answer ${method} within ${seconds}s.`);
22
22
  }
@@ -134,7 +134,7 @@ export class BrowserTabs {
134
134
  response = asRecord(await this.cdp.send("Target.createTarget", { url, background: true }), "Target.createTarget response");
135
135
  }
136
136
  catch (error) {
137
- throw new Error(`Chrome did not confirm tab creation; a shared tab may exist. Run tabs before retrying: ${errorMessage(error)}`);
137
+ throw new Error(`Tab may have opened as shared. Run tabs before retrying: ${errorMessage(error)}`);
138
138
  }
139
139
  if (typeof response["targetId"] !== "string")
140
140
  throw new Error("Chrome did not return a new tab target; run tabs before retrying");
@@ -143,7 +143,7 @@ export class BrowserTabs {
143
143
  await this.remember(created);
144
144
  }
145
145
  catch (error) {
146
- throw new Error(`Opened tab ${created} but could not save ownership; it remains shared: ${errorMessage(error)}`);
146
+ throw new Error(`Opened tab ${created}. Ownership save failed. Tab remains shared: ${errorMessage(error)}`);
147
147
  }
148
148
  return created;
149
149
  }, signal);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@howaboua/pi-browser",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "description": "Logged-in browser inspection and control for Pi, Code Mode and Notebook Mode.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -45,10 +45,10 @@
45
45
  "format:check": "oxfmt --check '**/*.{js,cjs,mjs,jsx,ts,cts,mts,tsx,json,jsonc,json5,css}'"
46
46
  },
47
47
  "peerDependencies": {
48
- "@howaboua/pi-codex-conversion": ">=5.1.0",
49
- "@earendil-works/pi-ai": ">=1.0.0",
50
- "@earendil-works/pi-coding-agent": ">=1.5.0",
51
- "@earendil-works/pi-tui": ">=1.0.0"
48
+ "@howaboua/pi-codex-conversion": ">=5.1.1",
49
+ "@earendil-works/pi-ai": ">=1.6.1",
50
+ "@earendil-works/pi-coding-agent": ">=1.6.1",
51
+ "@earendil-works/pi-tui": ">=1.6.1"
52
52
  },
53
53
  "peerDependenciesMeta": {
54
54
  "@howaboua/pi-codex-conversion": {
@@ -56,9 +56,9 @@
56
56
  }
57
57
  },
58
58
  "devDependencies": {
59
- "@howaboua/pi-codex-conversion": "5.1.0",
60
- "@earendil-works/pi-ai": "1.6.0",
61
- "@earendil-works/pi-coding-agent": "1.6.0",
59
+ "@howaboua/pi-codex-conversion": "5.1.1",
60
+ "@earendil-works/pi-ai": "1.6.1",
61
+ "@earendil-works/pi-coding-agent": "1.6.1",
62
62
  "@types/node": "26.6.6",
63
63
  "typescript": "7.0.2",
64
64
  "oxfmt": "0.79.0"
@@ -90,6 +90,6 @@
90
90
  "access": "public"
91
91
  },
92
92
  "dependencies": {
93
- "@earendil-works/pi-schema": "1.6.0"
93
+ "@earendil-works/pi-schema": "1.6.1"
94
94
  }
95
95
  }
@@ -25,7 +25,7 @@ export function browserHelp(
25
25
  type: "ref_id text id?; id focuses",
26
26
  fill: "ref_id id|selector value; replace/clear text, select option value/label, boolean checks/unchecks",
27
27
  press: "ref_id key; focused element, e.g. Enter or Control+a",
28
- wait: "ref_id selector|text|url_includes timeout_ms?; DOM presence or substring, default 10000ms",
28
+ wait: "ref_id selector|text|url_includes timeout_ms?; DOM presence or substring",
29
29
  screenshot: "ref_id id?|selector?; brings tab to foreground -> file",
30
30
  navigate: "ref_id url",
31
31
  html: "ref_id id?|selector?",
package/src/cdp/client.ts CHANGED
@@ -28,12 +28,12 @@ function timeoutError(method: string, attempts: number): Error {
28
28
  const seconds = CDP_TIMEOUT_MS / 1_000;
29
29
  if (attempts > 1) {
30
30
  return new Error(
31
- `Chrome did not answer ${method} after two ${seconds}s attempts. The tab may be unresponsive or suspended.`,
31
+ `${method} timed out twice (${seconds}s each). Tab may be unresponsive or suspended.`,
32
32
  );
33
33
  }
34
34
  if (method === "Runtime.evaluate") {
35
35
  return new Error(
36
- `Chrome did not answer Runtime.evaluate within ${seconds}s. The expression or awaited promise may still be running; check its effect before retrying.`,
36
+ `Runtime.evaluate timed out (${seconds}s). Expression or awaited promise may still be running. Check effects before retrying.`,
37
37
  );
38
38
  }
39
39
  return new Error(`Chrome did not answer ${method} within ${seconds}s.`);
package/src/cdp/tabs.ts CHANGED
@@ -175,7 +175,7 @@ export class BrowserTabs {
175
175
  );
176
176
  } catch (error) {
177
177
  throw new Error(
178
- `Chrome did not confirm tab creation; a shared tab may exist. Run tabs before retrying: ${errorMessage(error)}`,
178
+ `Tab may have opened as shared. Run tabs before retrying: ${errorMessage(error)}`,
179
179
  );
180
180
  }
181
181
  if (typeof response["targetId"] !== "string")
@@ -187,7 +187,7 @@ export class BrowserTabs {
187
187
  await this.remember(created);
188
188
  } catch (error) {
189
189
  throw new Error(
190
- `Opened tab ${created} but could not save ownership; it remains shared: ${errorMessage(error)}`,
190
+ `Opened tab ${created}. Ownership save failed. Tab remains shared: ${errorMessage(error)}`,
191
191
  );
192
192
  }
193
193
  return created;