@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 +4 -0
- package/README.md +1 -1
- package/dist/remote-worker.js +5 -5
- package/dist/src/browser/help.js +1 -1
- package/dist/src/cdp/client.js +2 -2
- package/dist/src/cdp/tabs.js +2 -2
- package/package.json +9 -9
- package/src/browser/help.ts +1 -1
- package/src/cdp/client.ts +2 -2
- package/src/cdp/tabs.ts +2 -2
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
|
|
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
|
|
package/dist/remote-worker.js
CHANGED
|
@@ -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(
|
|
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(`
|
|
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(`
|
|
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}
|
|
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
|
|
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?",
|
package/dist/src/browser/help.js
CHANGED
|
@@ -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
|
|
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?",
|
package/dist/src/cdp/client.js
CHANGED
|
@@ -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(
|
|
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(`
|
|
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
|
}
|
package/dist/src/cdp/tabs.js
CHANGED
|
@@ -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(`
|
|
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}
|
|
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.
|
|
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.
|
|
49
|
-
"@earendil-works/pi-ai": ">=1.
|
|
50
|
-
"@earendil-works/pi-coding-agent": ">=1.
|
|
51
|
-
"@earendil-works/pi-tui": ">=1.
|
|
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.
|
|
60
|
-
"@earendil-works/pi-ai": "1.6.
|
|
61
|
-
"@earendil-works/pi-coding-agent": "1.6.
|
|
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.
|
|
93
|
+
"@earendil-works/pi-schema": "1.6.1"
|
|
94
94
|
}
|
|
95
95
|
}
|
package/src/browser/help.ts
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
-
`
|
|
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
|
-
`
|
|
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}
|
|
190
|
+
`Opened tab ${created}. Ownership save failed. Tab remains shared: ${errorMessage(error)}`,
|
|
191
191
|
);
|
|
192
192
|
}
|
|
193
193
|
return created;
|