wb-browser-runtime 0.5.0 → 0.5.1
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 +15 -0
- package/bin/wb-browser-runtime.js +23 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,6 +29,21 @@ Verb arguments support `{{ env.NAME }}` substitution at dispatch time, so any
|
|
|
29
29
|
secrets your runbook needs (e.g. `HACKERNEWS_PASSWORD`) get pulled from the
|
|
30
30
|
sidecar process env without ever appearing on stdout.
|
|
31
31
|
|
|
32
|
+
## Optional: anti-detection
|
|
33
|
+
|
|
34
|
+
Targets behind Cloudflare / Kasada / DataDome (e.g. Airbase) will reject the
|
|
35
|
+
default Browserbase session fingerprint and serve a non-interactive challenge
|
|
36
|
+
page. Flip either flag on for the affected runs.
|
|
37
|
+
|
|
38
|
+
| Env var | Default | Purpose |
|
|
39
|
+
|------------------------------------|---------|--------------------------------------------------|
|
|
40
|
+
| `BROWSERBASE_ADVANCED_STEALTH` | *(off)* | Send `browserSettings.advancedStealth: true`. Browserbase Scale-plan-gated — API errors on lower plans. |
|
|
41
|
+
| `BROWSERBASE_PROXIES` | *(off)* | Send `proxies: true`. Routes through Browserbase residential proxy pool. Incurs extra per-session cost. |
|
|
42
|
+
|
|
43
|
+
Set `=1` (or `=true`) to enable. `proxies: true` alone clears most Cloudflare
|
|
44
|
+
challenges; add `advancedStealth: true` on top when the target still blocks.
|
|
45
|
+
The sidecar logs the resolved config at session create.
|
|
46
|
+
|
|
32
47
|
## Optional: session recording (rrweb + CDP screencast)
|
|
33
48
|
|
|
34
49
|
Each browser session can be recorded two ways and uploaded to a consumer
|
|
@@ -168,15 +168,35 @@ async function bbCreateSession() {
|
|
|
168
168
|
"BROWSERBASE_API_KEY and BROWSERBASE_PROJECT_ID must be set",
|
|
169
169
|
);
|
|
170
170
|
}
|
|
171
|
+
|
|
172
|
+
// Both flags opt-in per session. advancedStealth is Scale-plan-gated on
|
|
173
|
+
// Browserbase's side; proxies adds residential-IP cost. Default off so a
|
|
174
|
+
// misconfigured plan doesn't break unrelated runs (HN, Google Sheets, etc.);
|
|
175
|
+
// flip per vendor when the target sits behind Cloudflare / similar bot
|
|
176
|
+
// detection (e.g., Airbase).
|
|
177
|
+
const envBool = (v) => v === "1" || (typeof v === "string" && v.toLowerCase() === "true");
|
|
178
|
+
const advancedStealth = envBool(process.env.BROWSERBASE_ADVANCED_STEALTH);
|
|
179
|
+
const proxies = envBool(process.env.BROWSERBASE_PROXIES);
|
|
180
|
+
|
|
181
|
+
// keepAlive:false — slice lifetime is tied to wb process; on shutdown
|
|
182
|
+
// we explicitly REQUEST_RELEASE so quota isn't burned by orphans.
|
|
183
|
+
const body = { projectId, keepAlive: false };
|
|
184
|
+
if (advancedStealth) {
|
|
185
|
+
body.browserSettings = { advancedStealth: true };
|
|
186
|
+
}
|
|
187
|
+
if (proxies) {
|
|
188
|
+
body.proxies = true;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
log(`[bb] session create advancedStealth=${advancedStealth} proxies=${proxies}`);
|
|
192
|
+
|
|
171
193
|
const res = await fetch(`${BB_BASE}/v1/sessions`, {
|
|
172
194
|
method: "POST",
|
|
173
195
|
headers: {
|
|
174
196
|
"X-BB-API-Key": apiKey,
|
|
175
197
|
"Content-Type": "application/json",
|
|
176
198
|
},
|
|
177
|
-
|
|
178
|
-
// we explicitly REQUEST_RELEASE so quota isn't burned by orphans.
|
|
179
|
-
body: JSON.stringify({ projectId, keepAlive: false }),
|
|
199
|
+
body: JSON.stringify(body),
|
|
180
200
|
});
|
|
181
201
|
if (!res.ok) {
|
|
182
202
|
throw new Error(
|
package/package.json
CHANGED