@plurnk/plurnk-schemes-http 1.4.0 → 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 +10 -40
- package/README.md +28 -24
- package/SPEC.md +246 -220
- 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/Guard.d.ts.map +1 -1
- package/dist/Guard.js +2 -3
- 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 +206 -229
- 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 +58 -24
- package/dist/WebFetcher.d.ts.map +1 -1
- package/dist/WebFetcher.js +485 -108
- package/dist/WebFetcher.js.map +1 -1
- package/dist/Ws.d.ts +2 -2
- package/dist/Ws.d.ts.map +1 -1
- package/dist/Ws.js +18 -20
- package/dist/Ws.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +1 -1
- package/docs/http.md +68 -55
- package/docs/wss.md +1 -1
- package/package.json +3 -5
- package/dist/Browser.d.ts +0 -75
- package/dist/Browser.d.ts.map +0 -1
- package/dist/Browser.js +0 -295
- package/dist/Browser.js.map +0 -1
package/.env.defaults
CHANGED
|
@@ -9,35 +9,15 @@
|
|
|
9
9
|
# must not set them. Standalone (no daemon), the required numerics fail hard
|
|
10
10
|
# when unset, naming the var.
|
|
11
11
|
#
|
|
12
|
-
# ── Required (
|
|
13
|
-
#
|
|
12
|
+
# ── Required (acquisition path) ─────────────────────────────────────────────
|
|
13
|
+
# HTTP request timeout in ms.
|
|
14
14
|
PLURNK_SCHEMES_HTTP_FETCH_TIMEOUT=30000
|
|
15
|
-
# Salvage threshold in body-text chars: a networkidle timeout whose DOM already
|
|
16
|
-
# holds at least this much innerText is the chatty-page case (long-poll, ad
|
|
17
|
-
# refresh) — the render is kept; below it the timeout propagates.
|
|
18
|
-
PLURNK_SCHEMES_HTTP_SALVAGE_MIN_BODY_CHARS=200
|
|
19
|
-
# Warm-chromium idle teardown in ms: the browser process closes after this long
|
|
20
|
-
# with no render activity, and relaunches on the next render.
|
|
21
|
-
PLURNK_SCHEMES_HTTP_IDLE_TIMEOUT=900000
|
|
22
15
|
|
|
23
16
|
# ── Defaults (floor-set; override to change) ────────────────────────────────
|
|
24
|
-
#
|
|
25
|
-
|
|
26
|
-
#
|
|
27
|
-
|
|
28
|
-
PLURNK_SCHEMES_HTTP_PLAYWRIGHT_METHOD=launch
|
|
29
|
-
# Browser launch/connection timeout in ms.
|
|
30
|
-
PLURNK_SCHEMES_HTTP_PLAYWRIGHT_TIMEOUT=30000
|
|
31
|
-
# Headless launch. Set 0 for a visible operator-managed browser session.
|
|
32
|
-
PLURNK_SCHEMES_HTTP_PLAYWRIGHT_HEADLESS=1
|
|
33
|
-
# Playwright's Chromium sandbox launch option. Playwright defaults this off;
|
|
34
|
-
# set 1 only where the host/container supports Chromium user namespaces.
|
|
35
|
-
PLURNK_SCHEMES_HTTP_PLAYWRIGHT_CHROMIUM_SANDBOX=0
|
|
36
|
-
# Mobile device emulation on the render path (Pixel-5-class viewport + UA):
|
|
37
|
-
# responsive sites serve a lighter, less-chrome layout — a better generation
|
|
38
|
-
# hint. "0" renders desktop (escape hatch for sites that serve degraded or
|
|
39
|
-
# blocked mobile content). Required read: unset crashes at render, naming the var.
|
|
40
|
-
PLURNK_SCHEMES_HTTP_MOBILE=1
|
|
17
|
+
# Tavily Extract extraction depth ("basic" or "advanced").
|
|
18
|
+
PLURNK_SCHEMES_HTTP_TAVILY_DEPTH=basic
|
|
19
|
+
# Tavily Extract request timeout in ms.
|
|
20
|
+
PLURNK_SCHEMES_HTTP_TAVILY_TIMEOUT_MS=30000
|
|
41
21
|
# Per-URL freshness TTL in ms: a re-read of a URL fetched within this window
|
|
42
22
|
# serves the stored copy with ZERO round-trips (no conditional GET). This makes
|
|
43
23
|
# a just-materialized web entry immediately readable like any other entry.
|
|
@@ -50,22 +30,12 @@ PLURNK_SCHEMES_HTTP_REDIRECTS=5
|
|
|
50
30
|
# Maximum buffered characters in one incomplete SSE line/event. Exceeding this
|
|
51
31
|
# bound terminates the remote stream instead of allowing unbounded memory growth.
|
|
52
32
|
PLURNK_SCHEMES_HTTP_SSE_MAX_BUFFER_CHARS=1048576
|
|
53
|
-
# Maximum characters retained from a caught fetch,
|
|
33
|
+
# Maximum characters retained from a caught fetch, extract, or transport
|
|
54
34
|
# diagnostic in a model-facing Problem detail. Complete errors remain in daemon
|
|
55
35
|
# diagnostics.
|
|
56
36
|
PLURNK_SCHEMES_HTTP_ERROR_DETAIL_LIMIT=512
|
|
57
37
|
|
|
58
38
|
# ── Optional modes (absence IS the mode — never floor-set) ──────────────────
|
|
59
|
-
#
|
|
60
|
-
#
|
|
61
|
-
#
|
|
62
|
-
# chrome-canary, msedge, msedge-beta, msedge-dev, or msedge-canary.
|
|
63
|
-
# PLURNK_SCHEMES_HTTP_PLAYWRIGHT_CHANNEL=chrome
|
|
64
|
-
# Optional exact browser executable for launch. Mutually exclusive with CHANNEL.
|
|
65
|
-
# PLURNK_SCHEMES_HTTP_PLAYWRIGHT_EXECUTABLE_PATH=/usr/bin/chromium
|
|
66
|
-
# Chromium JS heap cap in MB (--max-old-space-size). Unset → chromium default.
|
|
67
|
-
# PLURNK_SCHEMES_HTTP_CHROMIUM_HEAP_MB=2048
|
|
68
|
-
|
|
69
|
-
# Native Playwright browser-location controls remain authoritative. This example
|
|
70
|
-
# is intentionally unset; the package never supplies its own path.
|
|
71
|
-
# PLAYWRIGHT_BROWSERS_PATH=/var/cache/ms-playwright
|
|
39
|
+
# Optional Tavily API key for HTML-to-Markdown extraction. When omitted/unset,
|
|
40
|
+
# the installed HTML mimetype projection is used as the local floor.
|
|
41
|
+
# TAVILY_API_KEY=
|
package/README.md
CHANGED
|
@@ -20,16 +20,16 @@ authored against the DB-free
|
|
|
20
20
|
| `SEND[410](http(s)://…)` | Delete the local stored response entry |
|
|
21
21
|
|
|
22
22
|
A path-pattern FIND surveys already-materialized web entries; it does not crawl
|
|
23
|
-
or discover the remote web. Exact
|
|
24
|
-
|
|
23
|
+
or discover the remote web. Exact matcher FIND shares the standard flat
|
|
24
|
+
location, weighting, pagination, and status contract.
|
|
25
25
|
|
|
26
26
|
## HTTP channels
|
|
27
27
|
|
|
28
|
-
| Channel | Content
|
|
29
|
-
| -------- |
|
|
30
|
-
| `body` | Text, derived Unicode, typed binary marker, SSE data, or
|
|
31
|
-
| `header` |
|
|
32
|
-
| `html` |
|
|
28
|
+
| Channel | Content |
|
|
29
|
+
| -------- | -------------------------------------------------------------------------- |
|
|
30
|
+
| `body` | Text, derived Unicode, typed binary marker, SSE data, or HTML-page Markdown |
|
|
31
|
+
| `header` | Origin, acquisition, materializer, projection, provider, and usage evidence |
|
|
32
|
+
| `html` | Original server-source HTML when the origin supplies it |
|
|
33
33
|
|
|
34
34
|
A fragmentless operation publishes only `body`; auxiliary channels remain
|
|
35
35
|
durable and can be addressed explicitly. Remote HTTP status is stored in
|
|
@@ -42,17 +42,25 @@ projection ceiling returns `413`.
|
|
|
42
42
|
|
|
43
43
|
## Design
|
|
44
44
|
|
|
45
|
-
- WebFetcher checks automatic byte targets and redirects; direct HTTP
|
|
46
|
-
|
|
47
|
-
-
|
|
48
|
-
|
|
45
|
+
- WebFetcher checks automatic byte targets and redirects; direct HTTP and
|
|
46
|
+
WebSocket retain their explicit-target authority.
|
|
47
|
+
- Generic GETs negotiate origin Markdown first. When the origin returns HTML,
|
|
48
|
+
configured Tavily produces `body`; otherwise the installed HTML reader is the
|
|
49
|
+
local route. Recoverable Tavily failures use that same reader as a `203`
|
|
50
|
+
recovery floor. Hard provider failures do not silently change producers.
|
|
51
|
+
- `body`, `header`, and `html` settle independently. The selected channel
|
|
52
|
+
determines operation success, so raw server source and evidence remain usable
|
|
53
|
+
when body production fails, and a provider body can survive origin transport
|
|
54
|
+
failure without fabricating HTML.
|
|
49
55
|
- GET representations carry method, acquisition-time, and single-variant cache
|
|
50
|
-
metadata;
|
|
51
|
-
|
|
52
|
-
change prevents
|
|
56
|
+
metadata; HTML adds materializer-route evidence, and local derivation adds
|
|
57
|
+
projection identity. Request metadata, `Vary`, `no-store`, expired freshness,
|
|
58
|
+
or a materializer/reader change prevents reuse; operator TTL is a separate
|
|
59
|
+
ceiling. Stale page composites are fully reacquired rather than restored by
|
|
60
|
+
an origin `304`.
|
|
53
61
|
- HTTP(S) and WS(S) entry identity retains protocol, authority, path, ordered
|
|
54
62
|
query, and explicit empty query; a fragment selects a channel.
|
|
55
|
-
- Handler-owned
|
|
63
|
+
- Handler-owned socket state follows the shared readiness, drain,
|
|
56
64
|
and aggregate-shutdown lifecycle.
|
|
57
65
|
- All storage and streaming work uses `SchemeCtx` capabilities rather than a
|
|
58
66
|
raw database handle.
|
|
@@ -70,19 +78,15 @@ npm i @plurnk/plurnk-schemes-http
|
|
|
70
78
|
plurnk start
|
|
71
79
|
```
|
|
72
80
|
|
|
73
|
-
The Playwright client is included. Provision a compatible local browser
|
|
74
|
-
separately, select an external Playwright/CDP endpoint, or disable rendering.
|
|
75
81
|
The shipped `.env.defaults` is the canonical operator configuration registry.
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
```
|
|
82
|
+
To enable Tavily Extract for generic public HTML materialization, set
|
|
83
|
+
`TAVILY_API_KEY` in `.env`. Depth and client timeout are controlled by
|
|
84
|
+
`PLURNK_SCHEMES_HTTP_TAVILY_DEPTH` and
|
|
85
|
+
`PLURNK_SCHEMES_HTTP_TAVILY_TIMEOUT_MS`. Without Tavily,
|
|
86
|
+
`@plurnk/plurnk-mimetypes-text-html` supplies the local body.
|
|
82
87
|
|
|
83
88
|
## Verify
|
|
84
89
|
|
|
85
90
|
```sh
|
|
86
91
|
npm test
|
|
87
|
-
npm run test:intg
|
|
88
92
|
```
|