@ogulcancelik/pi-web-browse 1.0.0 → 1.0.2
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 +1 -1
- package/SKILL.md +2 -2
- package/lib/cdp.js +4 -4
- package/package.json +4 -2
- package/web-browse.js +2 -2
package/README.md
CHANGED
|
@@ -51,7 +51,7 @@ Environment variables (all optional):
|
|
|
51
51
|
| `WEB_BROWSE_BROWSER_BIN` | Browser binary path | Auto-detected |
|
|
52
52
|
| `WEB_BROWSE_USER_AGENT` | User-Agent string | Chrome on Windows |
|
|
53
53
|
| `WEB_BROWSE_DAEMON_PORT` | Daemon HTTP port | 9377 |
|
|
54
|
-
| `WEB_BROWSE_CDP_PORT` | Chrome DevTools port |
|
|
54
|
+
| `WEB_BROWSE_CDP_PORT` | Chrome DevTools port | 9225 |
|
|
55
55
|
| `WEB_BROWSE_DEBUG_DUMP` | Save debug files on failure | off |
|
|
56
56
|
|
|
57
57
|
## Browser Detection
|
package/SKILL.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: web-browse
|
|
2
|
+
name: pi-web-browse
|
|
3
3
|
description: "Search the web and fetch/read pages via a real headless browser (CDP). Use this instead of curl when sites are JS-heavy or bot-protected. Works on Linux, macOS, and Windows."
|
|
4
4
|
---
|
|
5
5
|
|
|
@@ -31,7 +31,7 @@ Environment variables:
|
|
|
31
31
|
| `WEB_BROWSE_BROWSER_BIN` | Path to browser binary (auto-detected if not set) |
|
|
32
32
|
| `WEB_BROWSE_USER_AGENT` | Override User-Agent string |
|
|
33
33
|
| `WEB_BROWSE_DAEMON_PORT` | Daemon port (default: 9377) |
|
|
34
|
-
| `WEB_BROWSE_CDP_PORT` | CDP port (default:
|
|
34
|
+
| `WEB_BROWSE_CDP_PORT` | CDP port (default: 9225) |
|
|
35
35
|
| `WEB_BROWSE_DEBUG_DUMP` | Set to `1` to save screenshots/HTML on failures |
|
|
36
36
|
|
|
37
37
|
You can also pass `--browser-bin <path>` as a CLI argument.
|
package/lib/cdp.js
CHANGED
|
@@ -193,10 +193,10 @@ export async function resolveCdpOptions({ useCdpFlag, cdpStartFlag, cdpPortValue
|
|
|
193
193
|
let effectiveCdpPort = cdpPortValue;
|
|
194
194
|
|
|
195
195
|
if (!effectiveUseCdp && !effectiveCdpStart) {
|
|
196
|
-
const
|
|
197
|
-
if (isLikelyUsableBrowserCdp(
|
|
196
|
+
const cdp9225 = await waitForCdpVersion(9225, 1000);
|
|
197
|
+
if (isLikelyUsableBrowserCdp(cdp9225)) {
|
|
198
198
|
effectiveUseCdp = true;
|
|
199
|
-
effectiveCdpPort =
|
|
199
|
+
effectiveCdpPort = 9225;
|
|
200
200
|
} else {
|
|
201
201
|
const cdp9222 = await waitForCdpVersion(9222, 1000);
|
|
202
202
|
if (isLikelyUsableBrowserCdp(cdp9222)) {
|
|
@@ -205,7 +205,7 @@ export async function resolveCdpOptions({ useCdpFlag, cdpStartFlag, cdpPortValue
|
|
|
205
205
|
} else {
|
|
206
206
|
effectiveUseCdp = true;
|
|
207
207
|
effectiveCdpStart = true;
|
|
208
|
-
effectiveCdpPort =
|
|
208
|
+
effectiveCdpPort = 9225;
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ogulcancelik/pi-web-browse",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Web search and content extraction skill for pi-coding-agent. Search the web and fetch pages via a real headless browser (CDP). Works on Linux, macOS, and Windows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "web-browse.js",
|
|
@@ -40,7 +40,9 @@
|
|
|
40
40
|
"win32"
|
|
41
41
|
],
|
|
42
42
|
"pi": {
|
|
43
|
-
"skills": [
|
|
43
|
+
"skills": [
|
|
44
|
+
"./SKILL.md"
|
|
45
|
+
]
|
|
44
46
|
},
|
|
45
47
|
"files": [
|
|
46
48
|
"web-browse.js",
|
package/web-browse.js
CHANGED
|
@@ -138,7 +138,7 @@ const directUrl = getArg("--url");
|
|
|
138
138
|
const fullContent = hasFlag("--full");
|
|
139
139
|
const cdpStart = hasFlag("--cdp-start");
|
|
140
140
|
const useCdp = hasFlag("--cdp") || cdpStart;
|
|
141
|
-
const cdpPort = parseInt(getArg("--cdp-port") || (cdpStart ? "
|
|
141
|
+
const cdpPort = parseInt(getArg("--cdp-port") || (cdpStart ? "9225" : "9222"), 10);
|
|
142
142
|
const cdpProfile = getArg("--cdp-profile") || join(homedir(), ".config", "web-browse-cdp-profile");
|
|
143
143
|
const browserBinArg = getArg("--browser-bin");
|
|
144
144
|
const stressCount = parseInt(getArg("--stress") || "0", 10);
|
|
@@ -446,7 +446,7 @@ async function fetchUrlsWithCdp(urls, truncate, cdpOptions, cdpProfileValue) {
|
|
|
446
446
|
|
|
447
447
|
async function runDaemon() {
|
|
448
448
|
const preferredCdpPort = parseInt(
|
|
449
|
-
process.env.WEB_BROWSE_CDP_PORT || process.env.LOCAL_SEARCH_CDP_PORT || "
|
|
449
|
+
process.env.WEB_BROWSE_CDP_PORT || process.env.LOCAL_SEARCH_CDP_PORT || "9225",
|
|
450
450
|
10,
|
|
451
451
|
);
|
|
452
452
|
|