@plurnk/plurnk-schemes-http 1.3.12 → 1.5.0
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/.env.defaults +18 -46
- package/README.md +74 -23
- package/SPEC.md +487 -124
- package/dist/Config.d.ts +3 -0
- package/dist/Config.d.ts.map +1 -0
- package/dist/Config.js +18 -0
- package/dist/Config.js.map +1 -0
- package/dist/ContentType.d.ts +2 -0
- package/dist/ContentType.d.ts.map +1 -0
- package/dist/ContentType.js +15 -0
- package/dist/ContentType.js.map +1 -0
- package/dist/ErrorDetail.d.ts +6 -0
- package/dist/ErrorDetail.d.ts.map +1 -0
- package/dist/ErrorDetail.js +19 -0
- package/dist/ErrorDetail.js.map +1 -0
- package/dist/Guard.d.ts +1 -1
- package/dist/Guard.d.ts.map +1 -1
- package/dist/Guard.js +95 -55
- package/dist/Guard.js.map +1 -1
- package/dist/Http.d.ts +3 -16
- package/dist/Http.d.ts.map +1 -1
- package/dist/Http.js +817 -331
- package/dist/Http.js.map +1 -1
- package/dist/TavilyExtract.d.ts +35 -0
- package/dist/TavilyExtract.d.ts.map +1 -0
- package/dist/TavilyExtract.js +204 -0
- package/dist/TavilyExtract.js.map +1 -0
- package/dist/WebFetcher.d.ts +88 -18
- package/dist/WebFetcher.d.ts.map +1 -1
- package/dist/WebFetcher.js +588 -70
- package/dist/WebFetcher.js.map +1 -1
- package/dist/Ws.d.ts +7 -3
- package/dist/Ws.d.ts.map +1 -1
- package/dist/Ws.js +432 -96
- package/dist/Ws.js.map +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -10
- package/dist/index.js.map +1 -1
- package/docs/http.md +108 -53
- package/docs/wss.md +39 -43
- package/package.json +14 -13
- package/dist/Browser.d.ts +0 -84
- package/dist/Browser.d.ts.map +0 -1
- package/dist/Browser.js +0 -273
- package/dist/Browser.js.map +0 -1
- package/scripts/install-browser.mjs +0 -19
package/dist/Browser.js
DELETED
|
@@ -1,273 +0,0 @@
|
|
|
1
|
-
// Browser — the headless-Chromium render foundation (SPEC §render-lifecycle),
|
|
2
|
-
// ported from rummy.web's WebFetcher (@possumtech/rummy.web, MIT, same author). A
|
|
3
|
-
// STANDALONE foundation, not Http-private: the render scheme drives it now,
|
|
4
|
-
// and a future plurnk browser-troubleshooting MCP sits on the same warm pool.
|
|
5
|
-
//
|
|
6
|
-
// Scope here is render-ONLY: navigate, let JS run + hydration settle, serialize
|
|
7
|
-
// the final DOM. It returns the true rendered page; it never cleans, strips,
|
|
8
|
-
// or extracts — projection (markdown/symbols/deepXml) is the mimetype layer's
|
|
9
|
-
// job, off the faithful body we hand over.
|
|
10
|
-
//
|
|
11
|
-
// Driver is Playwright, lazy-imported so only the render path pays for it (the
|
|
12
|
-
// raw-byte fetch path stays Node-builtin-only). The engine is reached through
|
|
13
|
-
// a minimal structural seam (`ChromiumEngine`) so it can be injected — fakes
|
|
14
|
-
// in unit tests, and a remote CDP endpoint (Lightpanda/browserless/shared
|
|
15
|
-
// chromium) swapped in via env with zero code change.
|
|
16
|
-
// Mobile device emulation (a Pixel-5-class profile). Responsive sites serve a
|
|
17
|
-
// lighter, less-chrome layout to a mobile viewport/UA — a general generation
|
|
18
|
-
// hint, not a per-host rewrite (schemes-http#4). Default ON; set
|
|
19
|
-
// PLURNK_SCHEMES_HTTP_MOBILE=0 to render as desktop (escape hatch for the tail
|
|
20
|
-
// of sites that serve degraded/blocked mobile content). NOTE: Wikipedia gates
|
|
21
|
-
// mobile on the domain, not the UA, so this is a no-op there — by design; its
|
|
22
|
-
// desktop page already extracts clean.
|
|
23
|
-
// The ONE browser identity both acquisition paths present (render context AND
|
|
24
|
-
// the byte-path fetch) — ordinary Chrome traffic, never an automated-client or
|
|
25
|
-
// plurnk fingerprint. Model-supplied {User-Agent: …} target blocks override it.
|
|
26
|
-
export const BROWSER_UA = "Mozilla/5.0 (Linux; Android 13; Pixel 5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Mobile Safari/537.36";
|
|
27
|
-
const MOBILE_CONTEXT = Object.freeze({
|
|
28
|
-
userAgent: BROWSER_UA,
|
|
29
|
-
viewport: { width: 393, height: 851 },
|
|
30
|
-
deviceScaleFactor: 2.75,
|
|
31
|
-
isMobile: true,
|
|
32
|
-
hasTouch: true,
|
|
33
|
-
});
|
|
34
|
-
// Floor-set knob (schemes#31): the assembled .env.defaults floor guarantees it,
|
|
35
|
-
// so an unset value is a config crash, not a silent default. "0" = desktop.
|
|
36
|
-
const mobileEmulation = () => {
|
|
37
|
-
const raw = process.env.PLURNK_SCHEMES_HTTP_MOBILE;
|
|
38
|
-
if (raw === undefined)
|
|
39
|
-
throw new Error("Browser: required env PLURNK_SCHEMES_HTTP_MOBILE is unset — see .env.defaults");
|
|
40
|
-
return raw === "0" ? undefined : MOBILE_CONTEXT;
|
|
41
|
-
};
|
|
42
|
-
// Required numeric knob — `.env.defaults` is the canonical list (schemes#31:
|
|
43
|
-
// the file IS the docs and the daemon floor-sets it at boot; no in-code
|
|
44
|
-
// default hides a magic number). An
|
|
45
|
-
// unset or non-numeric value fails hard at first use, naming the var. All
|
|
46
|
-
// three numerics are render-path-only, so a byte-fetch-only deployment never
|
|
47
|
-
// pays them — but a rendering one must configure them.
|
|
48
|
-
export const requireNumEnv = (key) => {
|
|
49
|
-
const raw = process.env[key];
|
|
50
|
-
if (raw === undefined)
|
|
51
|
-
throw new Error(`Browser: required env ${key} is unset — see .env.defaults`);
|
|
52
|
-
const n = Number(raw);
|
|
53
|
-
if (Number.isNaN(n))
|
|
54
|
-
throw new Error(`Browser: ${key}=${raw} is not a number`);
|
|
55
|
-
return n;
|
|
56
|
-
};
|
|
57
|
-
// Default factory: lazy-import the real chromium. The cast bridges Playwright's
|
|
58
|
-
// full type to our structural view at the single trusted library boundary.
|
|
59
|
-
const defaultFactory = async () => {
|
|
60
|
-
process.env.PLAYWRIGHT_BROWSERS_PATH ??= "0";
|
|
61
|
-
return (await import("playwright")).chromium;
|
|
62
|
-
};
|
|
63
|
-
const requireBoolEnv = (key) => {
|
|
64
|
-
const raw = process.env[key];
|
|
65
|
-
if (raw !== "0" && raw !== "1")
|
|
66
|
-
throw new Error(`Browser: required env ${key} must be 0 or 1 — see .env.defaults`);
|
|
67
|
-
return raw === "1";
|
|
68
|
-
};
|
|
69
|
-
const browserConfig = () => {
|
|
70
|
-
const raw = process.env.PLURNK_SCHEMES_HTTP_PLAYWRIGHT_METHOD;
|
|
71
|
-
if (raw === undefined)
|
|
72
|
-
throw new Error("Browser: required env PLURNK_SCHEMES_HTTP_PLAYWRIGHT_METHOD is unset — see .env.defaults");
|
|
73
|
-
if (!["launch", "connect", "connectOverCDP", "disabled"].includes(raw)) {
|
|
74
|
-
throw new Error(`Browser: PLURNK_SCHEMES_HTTP_PLAYWRIGHT_METHOD=${raw} must be launch, connect, connectOverCDP, or disabled`);
|
|
75
|
-
}
|
|
76
|
-
const method = raw;
|
|
77
|
-
const endpoint = process.env.PLURNK_SCHEMES_HTTP_PLAYWRIGHT_ENDPOINT;
|
|
78
|
-
const channel = process.env.PLURNK_SCHEMES_HTTP_PLAYWRIGHT_CHANNEL;
|
|
79
|
-
const executablePath = process.env.PLURNK_SCHEMES_HTTP_PLAYWRIGHT_EXECUTABLE_PATH;
|
|
80
|
-
if ((method === "connect" || method === "connectOverCDP") && !endpoint) {
|
|
81
|
-
throw new Error(`Browser: ${method} requires PLURNK_SCHEMES_HTTP_PLAYWRIGHT_ENDPOINT`);
|
|
82
|
-
}
|
|
83
|
-
if (method !== "connect" && method !== "connectOverCDP" && endpoint) {
|
|
84
|
-
throw new Error(`Browser: PLURNK_SCHEMES_HTTP_PLAYWRIGHT_ENDPOINT is incompatible with ${method}`);
|
|
85
|
-
}
|
|
86
|
-
if (method !== "launch" && (channel || executablePath)) {
|
|
87
|
-
throw new Error(`Browser: Playwright channel and executable path are incompatible with ${method}`);
|
|
88
|
-
}
|
|
89
|
-
if (channel && executablePath) {
|
|
90
|
-
throw new Error("Browser: PLURNK_SCHEMES_HTTP_PLAYWRIGHT_CHANNEL and PLURNK_SCHEMES_HTTP_PLAYWRIGHT_EXECUTABLE_PATH are mutually exclusive");
|
|
91
|
-
}
|
|
92
|
-
if (method === "disabled")
|
|
93
|
-
return { method };
|
|
94
|
-
const timeout = requireNumEnv("PLURNK_SCHEMES_HTTP_PLAYWRIGHT_TIMEOUT");
|
|
95
|
-
if (method === "connect" || method === "connectOverCDP") {
|
|
96
|
-
return { method, endpoint: endpoint, options: { timeout } };
|
|
97
|
-
}
|
|
98
|
-
const args = [];
|
|
99
|
-
const heapMb = process.env.PLURNK_SCHEMES_HTTP_CHROMIUM_HEAP_MB;
|
|
100
|
-
if (heapMb)
|
|
101
|
-
args.push(`--js-flags=--max-old-space-size=${heapMb}`);
|
|
102
|
-
return {
|
|
103
|
-
method,
|
|
104
|
-
options: {
|
|
105
|
-
headless: requireBoolEnv("PLURNK_SCHEMES_HTTP_PLAYWRIGHT_HEADLESS"),
|
|
106
|
-
chromiumSandbox: requireBoolEnv("PLURNK_SCHEMES_HTTP_PLAYWRIGHT_CHROMIUM_SANDBOX"),
|
|
107
|
-
timeout,
|
|
108
|
-
args,
|
|
109
|
-
...(channel ? { channel } : {}),
|
|
110
|
-
...(executablePath ? { executablePath } : {}),
|
|
111
|
-
},
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
export default class Browser {
|
|
115
|
-
#factory;
|
|
116
|
-
#browser = null;
|
|
117
|
-
#launching = null;
|
|
118
|
-
// One BrowserContext per worker — cookies / cache / storage scoped to the worker
|
|
119
|
-
// that opened it, no cross-worker bleed. Closed by closeContext() on run end
|
|
120
|
-
// or abort. The browser process stays warm across all of them.
|
|
121
|
-
#contexts = new Map();
|
|
122
|
-
#idleTimer = null;
|
|
123
|
-
// Inject a factory in tests; production lazy-imports playwright.
|
|
124
|
-
constructor(factory = defaultFactory) {
|
|
125
|
-
this.#factory = factory;
|
|
126
|
-
}
|
|
127
|
-
async ready() {
|
|
128
|
-
const { method } = browserConfig();
|
|
129
|
-
if (method !== "disabled")
|
|
130
|
-
await this.#getBrowser();
|
|
131
|
-
return method;
|
|
132
|
-
}
|
|
133
|
-
// Render a URL to its final serialized DOM. Opens a page in the worker's
|
|
134
|
-
// context, navigates with the settle+salvage strategy, serializes, closes
|
|
135
|
-
// the page. Throws on navigation failure (the caller maps it to a status).
|
|
136
|
-
async render(url, { workerId, signal, headers, guard, timeout = requireNumEnv("PLURNK_SCHEMES_HTTP_FETCH_TIMEOUT") }) {
|
|
137
|
-
const context = await this.#getContext(workerId);
|
|
138
|
-
const page = await context.newPage();
|
|
139
|
-
// SSRF interception (WebFetcher, #454): re-guard every navigation AND
|
|
140
|
-
// subresource — a rendered public page must not reach private space.
|
|
141
|
-
// Aborted requests surface as a nav/subresource failure, which the
|
|
142
|
-
// caller reads as dead. Only wired when a guard is supplied (the general
|
|
143
|
-
// READ render path passes none — unchanged).
|
|
144
|
-
if (guard)
|
|
145
|
-
await page.route("**", async (r) => { (await guard(r.request().url())) ? await r.continue() : await r.abort(); });
|
|
146
|
-
// Request headers (auth/accept) apply to the navigation too, so an authed
|
|
147
|
-
// HTML page renders authenticated. Ordered pairs collapse to a record here
|
|
148
|
-
// — Playwright's per-page header API is single-valued (dup names not a
|
|
149
|
-
// render concern; the byte-path fetch preserves them).
|
|
150
|
-
if (headers && headers.length > 0)
|
|
151
|
-
await page.setExtraHTTPHeaders(Object.fromEntries(headers));
|
|
152
|
-
// Abort cascades by closing the page — an in-flight goto rejects with
|
|
153
|
-
// "Target closed", surfacing promptly instead of blocking on timeout.
|
|
154
|
-
const onAbort = () => { page.close().catch(() => { }); };
|
|
155
|
-
signal?.addEventListener("abort", onAbort, { once: true });
|
|
156
|
-
// Already aborted before the page opened: the listener won't fire
|
|
157
|
-
// retroactively, so close now — the navigation must not proceed.
|
|
158
|
-
if (signal?.aborted)
|
|
159
|
-
onAbort();
|
|
160
|
-
try {
|
|
161
|
-
const response = await this.#safeGoto(page, url, timeout);
|
|
162
|
-
const html = await page.content();
|
|
163
|
-
return {
|
|
164
|
-
status: response?.status() ?? 200,
|
|
165
|
-
statusText: response?.statusText() ?? "",
|
|
166
|
-
headers: response ? Object.entries(response.headers()) : [],
|
|
167
|
-
html,
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
finally {
|
|
171
|
-
signal?.removeEventListener("abort", onAbort);
|
|
172
|
-
await page.close().catch(() => { });
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
// page.goto with the salvage path. networkidle timing out while the DOM has
|
|
176
|
-
// already rendered substantive body text is the chatty-page case: the
|
|
177
|
-
// content is there even though the network never settled. readyState is
|
|
178
|
-
// unreliable (a never-ending stream stays `loading` forever); the load-
|
|
179
|
-
// bearing signal is the body's innerText length — below the salvage
|
|
180
|
-
// threshold we discard (too little to be sure the DOM rendered the article
|
|
181
|
-
// rather than a skeleton). Returns the Response on normal completion, null
|
|
182
|
-
// on salvage, and re-throws every other error.
|
|
183
|
-
async #safeGoto(page, url, timeout) {
|
|
184
|
-
try {
|
|
185
|
-
return await page.goto(url, { waitUntil: "networkidle", timeout });
|
|
186
|
-
}
|
|
187
|
-
catch (err) {
|
|
188
|
-
if (!(err instanceof Error) || err.name !== "TimeoutError")
|
|
189
|
-
throw err;
|
|
190
|
-
const bodyLen = await page
|
|
191
|
-
.evaluate(() => document?.body?.innerText?.length ?? 0)
|
|
192
|
-
.catch(() => 0);
|
|
193
|
-
if (bodyLen < requireNumEnv("PLURNK_SCHEMES_HTTP_SALVAGE_MIN_BODY_CHARS"))
|
|
194
|
-
throw err;
|
|
195
|
-
return null;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
// Get-or-launch the warm chromium under the one explicitly selected mode.
|
|
199
|
-
// Single browser across all workers;
|
|
200
|
-
// per-worker isolation is at the context layer. Relaunches if chromium dies
|
|
201
|
-
// (OOM/segfault/WS teardown) leaves the handle stale.
|
|
202
|
-
async #getBrowser() {
|
|
203
|
-
this.#touchIdle();
|
|
204
|
-
if (this.#browser)
|
|
205
|
-
return this.#browser;
|
|
206
|
-
this.#launching ??= (async () => {
|
|
207
|
-
const config = browserConfig();
|
|
208
|
-
if (config.method === "disabled")
|
|
209
|
-
throw new Error("Browser: HTML rendering is disabled by PLURNK_SCHEMES_HTTP_PLAYWRIGHT_METHOD=disabled");
|
|
210
|
-
const chromium = await this.#factory();
|
|
211
|
-
if (config.method === "connect")
|
|
212
|
-
return chromium.connect(config.endpoint, config.options);
|
|
213
|
-
if (config.method === "connectOverCDP")
|
|
214
|
-
return chromium.connectOverCDP(config.endpoint, config.options);
|
|
215
|
-
return chromium.launch(config.options);
|
|
216
|
-
})();
|
|
217
|
-
const browser = await this.#launching;
|
|
218
|
-
this.#launching = null;
|
|
219
|
-
browser.on("disconnected", () => {
|
|
220
|
-
if (this.#browser === browser) {
|
|
221
|
-
this.#browser = null;
|
|
222
|
-
this.#contexts.clear();
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
this.#browser = browser;
|
|
226
|
-
return browser;
|
|
227
|
-
}
|
|
228
|
-
// Get-or-create the worker's BrowserContext. Mobile-emulated by default (a
|
|
229
|
-
// lighter responsive layout is the better generation hint); desktop when
|
|
230
|
-
// PLURNK_SCHEMES_HTTP_MOBILE=0.
|
|
231
|
-
async #getContext(workerId) {
|
|
232
|
-
this.#touchIdle();
|
|
233
|
-
const existing = this.#contexts.get(workerId);
|
|
234
|
-
if (existing)
|
|
235
|
-
return existing;
|
|
236
|
-
const browser = await this.#getBrowser();
|
|
237
|
-
const context = await browser.newContext(mobileEmulation());
|
|
238
|
-
this.#contexts.set(workerId, context);
|
|
239
|
-
return context;
|
|
240
|
-
}
|
|
241
|
-
// Drop the worker's context (run end or abort). Closing it cascades to any
|
|
242
|
-
// in-flight page in that context. Fire-and-forget.
|
|
243
|
-
closeContext(workerId) {
|
|
244
|
-
const context = this.#contexts.get(workerId);
|
|
245
|
-
if (!context)
|
|
246
|
-
return;
|
|
247
|
-
this.#contexts.delete(workerId);
|
|
248
|
-
context.close().catch(() => { });
|
|
249
|
-
}
|
|
250
|
-
#touchIdle() {
|
|
251
|
-
if (this.#idleTimer)
|
|
252
|
-
clearTimeout(this.#idleTimer);
|
|
253
|
-
this.#idleTimer = setTimeout(() => { this.close().catch(() => { }); }, requireNumEnv("PLURNK_SCHEMES_HTTP_IDLE_TIMEOUT"));
|
|
254
|
-
this.#idleTimer.unref?.();
|
|
255
|
-
}
|
|
256
|
-
// Tear everything down: per-worker contexts then the browser. In CDP mode
|
|
257
|
-
// close() disconnects the local handle without shutting the remote down.
|
|
258
|
-
async close() {
|
|
259
|
-
if (this.#idleTimer) {
|
|
260
|
-
clearTimeout(this.#idleTimer);
|
|
261
|
-
this.#idleTimer = null;
|
|
262
|
-
}
|
|
263
|
-
const contexts = [...this.#contexts.values()];
|
|
264
|
-
this.#contexts.clear();
|
|
265
|
-
await Promise.allSettled(contexts.map((c) => c.close()));
|
|
266
|
-
if (this.#browser) {
|
|
267
|
-
await this.#browser.close().catch(() => { });
|
|
268
|
-
this.#browser = null;
|
|
269
|
-
}
|
|
270
|
-
this.#launching = null;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
//# sourceMappingURL=Browser.js.map
|
package/dist/Browser.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Browser.js","sourceRoot":"","sources":["../src/Browser.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,kFAAkF;AAClF,4EAA4E;AAC5E,8EAA8E;AAC9E,EAAE;AACF,gFAAgF;AAChF,6EAA6E;AAC7E,8EAA8E;AAC9E,2CAA2C;AAC3C,EAAE;AACF,+EAA+E;AAC/E,8EAA8E;AAC9E,6EAA6E;AAC7E,0EAA0E;AAC1E,sDAAsD;AAuEtD,8EAA8E;AAC9E,6EAA6E;AAC7E,iEAAiE;AACjE,+EAA+E;AAC/E,8EAA8E;AAC9E,8EAA8E;AAC9E,uCAAuC;AACvC,8EAA8E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I,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAAC,CAAC;QACzF,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;IAC3B,CAAC;CACJ"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from "node:child_process";
|
|
2
|
-
import { dirname, resolve } from "node:path";
|
|
3
|
-
import { fileURLToPath } from "node:url";
|
|
4
|
-
|
|
5
|
-
const skipped = /^(1|true|yes)$/i.test(process.env.PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD ?? "");
|
|
6
|
-
if (skipped) {
|
|
7
|
-
console.info("plurnk-schemes-http: browser download skipped by PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD");
|
|
8
|
-
process.exit(0);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const playwrightEntry = fileURLToPath(import.meta.resolve("playwright"));
|
|
12
|
-
const cli = resolve(dirname(playwrightEntry), "cli.js");
|
|
13
|
-
const env = {
|
|
14
|
-
...process.env,
|
|
15
|
-
PLAYWRIGHT_BROWSERS_PATH: process.env.PLAYWRIGHT_BROWSERS_PATH ?? "0",
|
|
16
|
-
};
|
|
17
|
-
const result = spawnSync(process.execPath, [cli, "install", "chromium"], { stdio: "inherit", env });
|
|
18
|
-
if (result.error) throw result.error;
|
|
19
|
-
process.exit(result.status ?? 1);
|