@jayyuen66/dsh-scrapling 0.1.0 → 0.1.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 CHANGED
@@ -1,354 +1,220 @@
1
- # @jayyuen66/dsh-scrapling
2
-
3
- English · [中文](./README.zh-CN.md)
4
-
5
- [Scrapling](https://github.com/D4Vinci/Scrapling) web scraping for
6
- [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh),
7
- exposed as agent tools backed by a long-lived Python process.
8
-
9
- ## Why this plugin exists
10
-
11
- dsh ships `web_fetch` and `web_search`. `web_fetch` is deliberately honest and minimal:
12
- a plain HTTP(S) GET with no JavaScript execution, an honest `User-Agent`
13
- (`deepseek-harness/0.2.0-rc.2`, explicitly *"never a browser disguise"*), and a
14
- turndown-based HTML-to-markdown conversion. That is a good default, but it means a
15
- single-page application yields only its loading shell, and there is no way to ask for
16
- "just the product table".
17
-
18
- Measured on a page whose content exists only after JavaScript runs:
1
+ <p align="center">
2
+ <img src="https://cdn.jsdelivr.net/gh/JayYuen666/dsh-scrapling@main/icon.svg" width="96" height="96" alt="dsh-scrapling logo" />
3
+ </p>
4
+
5
+ <h1 align="center">dsh-scrapling</h1>
6
+
7
+ <p align="center"><em>Scrapling web scraping for dsh: JavaScript rendering, structured extraction and a background crawler, behind one resident Python sidecar.</em></p>
8
+
9
+ <p align="center">
10
+ <a href="https://www.npmjs.com/package/@jayyuen66/dsh-scrapling"><img src="https://img.shields.io/npm/v/@jayyuen66/dsh-scrapling?style=flat-square&logo=npm&logoColor=white" alt="npm version" /></a>
11
+ <a href="https://www.npmjs.com/package/@jayyuen66/dsh-scrapling"><img src="https://img.shields.io/npm/dm/@jayyuen66/dsh-scrapling?style=flat-square" alt="npm downloads" /></a>
12
+ <a href="https://github.com/JayYuen666/dsh-scrapling/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/JayYuen666/dsh-scrapling/ci.yml?branch=main&style=flat-square&label=ci" alt="ci" /></a>
13
+ <img src="https://img.shields.io/badge/license-MIT-4c1?style=flat-square" alt="MIT" />
14
+ <img src="https://img.shields.io/badge/node-%3E%3D22.12-4c1?style=flat-square&logo=nodedotjs&logoColor=white" alt="node" />
15
+ <img src="https://img.shields.io/badge/dsh-%5E0.2.1--rc.3-658EFF?style=flat-square" alt="dsh" />
16
+ <a href="https://github.com/deepseek-ai/deepseek-harness"><img src="https://img.shields.io/badge/powered_by_dsh-4D6BFE?style=flat-square&logo=deepseek&logoColor=white" alt="powered by dsh" /></a>
17
+ </p>
18
+
19
+ <p align="center">
20
+ <img src="https://skillicons.dev/icons?i=typescript,python,react,nodejs,vitest,githubactions" alt="tech stack" />
21
+ </p>
22
+
23
+ <p align="center">
24
+ <a href="https://github.com/JayYuen666"><img src="https://img.shields.io/badge/GitHub-JayYuen666-181717?style=flat-square&logo=github&logoColor=white" alt="GitHub" /></a>
25
+ <a href="mailto:cqwkkj@gmail.com"><img src="https://img.shields.io/badge/Email-cqwkkj@gmail.com-EA4335?style=flat-square&logo=gmail&logoColor=white" alt="Email" /></a>
26
+ <a href="https://twitter.com/JayYuen666"><img src="https://img.shields.io/badge/Twitter-X%2FJayYuen666-000000?style=flat-square&logo=x&logoColor=white" alt="Twitter/X" /></a>
27
+ <a href="./README.zh-CN.md"><img src="https://img.shields.io/badge/lang-简体中文-658EFF?style=flat-square" alt="简体中文" /></a>
28
+ </p>
29
+
30
+ **A web-scraping extension for [dsh](https://github.com/deepseek-ai/deepseek-harness): [Scrapling](https://github.com/D4Vinci/Scrapling) as agent tools — JavaScript rendering, CSS/XPath extraction with self-healing selectors, sessions with login state, a background crawler and page Q&A. You supply the interpreter and the browser engine; everything runs in one resident Python process.**
31
+
32
+ ## <img src="https://api.iconify.design/lucide/file-text.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Contents
33
+
34
+ - [What it does](#what-it-does)
35
+ - [Install](#install)
36
+ - [Verify it is live](#verify-it-is-live)
37
+ - [What it does not provide](#what-it-does-not-provide)
38
+ - [Enabling it in dsh](#enabling-it-in-dsh)
39
+ - [The tools](#the-tools)
40
+ - [Replacing the built-in fetch and search](#replacing-the-builtin-fetch-and-search)
41
+ - [Settings](#settings)
42
+ - [Proxies](#proxies)
43
+ - [Security](#security)
44
+ - [Data and privacy](#data-and-privacy)
45
+ - [Known boundaries](#known-boundaries)
46
+ - [FAQ](#faq)
47
+ - [Development](#development)
48
+ - [License](#license)
49
+
50
+ ## <img src="https://api.iconify.design/lucide/shield.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> What it does
51
+
52
+ dsh ships `web_fetch` and `web_search`. The built-in `web_fetch` is deliberately honest and minimal: a plain HTTP(S) GET with no JavaScript execution and an honest User-Agent. That is a good default — and it means a single-page application yields only its loading shell, and there is no way to ask for "just the product table". Measured on a page whose content exists only after JavaScript runs:
19
53
 
20
54
  | Pipeline | Text obtained |
21
55
  |---|---|
22
56
  | raw HTML to text (no JS) | `SPA Shell / LOADING_PLACEHOLDER` |
23
57
  | `Fetcher` (curl_cffi, still no JS) | `SPA Shell / LOADING_PLACEHOLDER` |
24
- | `DynamicFetcher` (Playwright) | full rendered DOM, Markdown table, structured rows |
58
+ | browser render (patchright) | full rendered DOM, Markdown table, structured rows |
25
59
 
26
- This plugin adds exactly three things dsh's built-in tools cannot do:
60
+ This package adds what the built-ins structurally cannot do:
27
61
 
28
- 1. **Browser rendering** - JavaScript execution via patchright.
29
- 2. **Structured extraction** - CSS/XPath selection returning data, not a wall of Markdown.
30
- 3. **Self-healing selectors** - Scrapling's `adaptive` mode relocates an element after
31
- the site's markup changes. Verified working: a selector that returns `None` after a
32
- class rename returns the relocated element when `adaptive=True`.
62
+ - **Browser rendering** — JavaScript execution via patchright.
63
+ - **Structured extraction** — CSS/XPath selection returning data, not a wall of Markdown.
64
+ - **Self-healing selectors** — Scrapling's `adaptive` mode relocates an element after the site's markup changes; a selector that returns `None` after a class rename returns the relocated element with `adaptive` on.
33
65
 
34
- ## Status
66
+ Everything runs against **one long-lived Python process**. That is not an optimisation: Scrapling's session classes keep cookies, the browser engines keep a page pool, and `adaptive` keeps a SQLite fingerprint database — a process per call would throw all of that away. Tools are registered **conditionally**: the plugin probes what the environment can actually do at startup and registers only what will work, so the model never burns a turn on a tool that was guaranteed to fail. Every tool renders its result row through the official tool-call view slot. `scrapling_answer` is the only tool that spends **another model call** — see [The tools](#the-tools).
35
67
 
36
- All thirteen tools (the session family counts as seven) are implemented, registered and
37
- exercised by the test suite. Tools
38
- are registered **conditionally**: the plugin probes what the environment can actually
39
- do at startup and only registers tools that will work, so the model never burns a
40
- turn on a tool that was guaranteed to fail.
68
+ ## <img src="https://api.iconify.design/lucide/package.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Install
41
69
 
42
- | Tool | Backend | Needs a browser | Concurrency |
43
- |---|---|---|---|
44
- | `scrapling_fetch` | `Fetcher` (curl_cffi) | no | safe; a write verb is serialised once `allowWriteMethods` is on (parallel writes are duplicate submissions) |
45
- | `scrapling_extract` | `Selector` + CSS/XPath + `adaptive` | no | safe |
46
- | `scrapling_render` | `StealthySession` (patchright) | yes | serialised; the anti-detection switches (`solveCloudflare` / `hideCanvas` / `blockWebrtc`) live here |
47
- | `scrapling_capture_xhr` | `capture_xhr` (session-level recording) | yes | serialised |
48
- | `scrapling_session_open` / `scrapling_session_fetch` / `scrapling_session_network` / `scrapling_session_state_save` / `scrapling_session_state_load` / `scrapling_session_list` / `scrapling_session_close` | Scrapling session classes | depends | serialised |
49
- | `scrapling_crawl` | Scrapling Spider framework | no | serialised, runs as a job |
50
- | `scrapling_answer` | any of the above, plus `ctx.llm` | no (yes with `render:true`) | serialised |
51
-
52
- `scrapling_answer` is the only tool that spends **another model call**: it fetches the page
53
- first, then hands the text plus your question to a model and returns the conclusion instead
54
- of the whole page. By default it follows **the model the current session is already using**
55
- (read from the session's live request header, so a mid-session model switch is picked up),
56
- which means the plugin does not burn a separate quota; you can pin `answerProvider` /
57
- `answerModel` on the settings card to route page-reading to a different model.
58
-
59
- Page text is **untrusted input** — a page can say "ignore your previous instructions". The
60
- answer prompt frames the text explicitly as data and forbids acting on it, but that defence
61
- is prompt-level: it lowers the risk, it does not remove it.
62
-
63
- Everything runs against **one long-lived Python process**. That is not an
64
- optimisation — Scrapling's session classes keep cookies, the browser engines keep a
65
- page pool, and `adaptive` keeps a SQLite fingerprint database. A process per call
66
- would throw all of that away.
67
-
68
- `scrapling_crawl` returns a **job id immediately** rather than blocking: a crawl takes
69
- minutes, a tool call has a timeout. Watch it with `job_list`, read it with
70
- `job_output`, stop it with `job_kill`. A crawl also has a wall-clock ceiling
71
- (`crawlMaxRuntimeSeconds`) and never leaves the start domain. Politeness is the
72
- deployment's call, stated in the open: it is configured through the deployment knobs
73
- (`crawlRespectRobots`, `crawlDownloadDelayMs`, `crawlConcurrentRequests`,
74
- `crawlAutothrottle`, `crawlStrategy`, `crawlCheckpointDir`), and **their defaults keep
75
- Scrapling's spider defaults** — robots.txt is **not** obeyed, per-domain delay is 0,
76
- and up to 4 requests run in parallel. The crawl is confined to the start domain, so it
77
- never fans out across unrelated sites; a target that needs gentler behaviour is a
78
- deployment decision, not a per-call one.
79
-
80
- ## Requirements
81
-
82
- - **Python 3.14+** with Scrapling installed, reachable via `PATH` (or set `pythonBin`).
83
- - **Browser engines are entirely the user's responsibility.** The plugin does not
84
- download anything. Without a browser it simply does not register the
85
- browser-dependent tools, so the model never wastes a turn calling them.
70
+ ```sh
71
+ dsh plugin --profile web add @jayyuen66/dsh-scrapling
72
+ ```
73
+
74
+ Remove with `dsh plugin --profile web remove @jayyuen66/dsh-scrapling`. The package is on the public npm registry, so installation needs no credentials and no scoped-registry line.
75
+
76
+ - **Requires Node.js `>= 22.12`.** This is an ESM-only package; that Node floor is what makes `require()` of an ESM entry work at all, which is why `engines.node` is declared.
77
+ - **Requires host `dsh` at the `0.2.1-rc.3` line.** The requirement the host actually reads is `engines.dsh` (`^0.2.1-rc.3`), and it decides alone; a host on a later line is refused and needs the explicit risk grant `dsh plugin --profile <p> allow-version <pkg>@<ver> --dsh-version <exact> --accept-risk`.
78
+ - **Requires Python 3.14+ with Scrapling installed** — in the repository's `_env/.venv`, or reachable from `PATH`, or named by `pythonBin`. In an installed package the `_env/.venv` leg does not exist, so the interpreter is the `python3` on your `PATH`; whichever one is chosen is logged at load time, and a missing Scrapling reports an error carrying the install line to copy.
86
79
 
87
80
  ```sh
88
81
  pip install "scrapling[rag]>=0.5,<0.6"
89
82
  python -m patchright install chromium
90
83
  ```
91
84
 
92
- > **Why `rag` and not `fetchers`?** `rag` is `fetchers` plus `markdownify`, and the
93
- > default `extractionType` is `markdown` — with plain `fetchers` the Markdown conversion
94
- > raises `ModuleNotFoundError` on the first fetch. The Python side then tells you exactly
95
- > which package is missing.
96
-
97
- > **Version range**: this plugin is developed and verified against Scrapling **0.5**
98
- > and depends on its `Convertor._strip_noise_tags` / `_sanitize_for_ai`, `Selector`,
99
- > `Spider` and `SessionManager` interfaces. None of those are stable API surface, so the
100
- > upper bound is pinned below `0.6`; outside the range the guards still run, but the
101
- > anti-injection cleaning and the crawl path may not behave as documented.
102
-
103
- > **What 0.5 breaks, and how this plugin follows it:**
104
- > - **The browser backend is patchright only.** 0.5 removed the plain Playwright backend
105
- > (`DynamicFetcher` / `DynamicSession`), so browser scraping is one code path. The old
106
- > standalone `scrapling_stealth_fetch` is therefore **gone**: its anti-detection
107
- > arguments now live on `scrapling_render`.
108
- > - **`capture_xhr` became session-level recording.** A capture now records into a
109
- > session, so this plugin adds `scrapling_session_network` to read what an open session
110
- > has accumulated; `scrapling_capture_xhr` itself opens a throwaway session for one page.
111
- > - **`extra_flags` is additive now, not replacing.** Upstream made `config.extra_flags`
112
- > *stack on top of* the built-in anti-detection flags instead of replacing them, so the
113
- > old "passing `extra_flags` silently wipes the whole stealth stack" invariant no longer
114
- > holds. This plugin sends **no** `extra_flags` at all, and WebRTC leak protection is
115
- > carried by the `block_webrtc` switch itself.
116
-
117
- ## Install
85
+ - **Why `rag` and not `fetchers`:** `rag` is `fetchers` plus `markdownify`, and the default `extractionType` is `markdown` — with plain `fetchers` the first fetch raises `ModuleNotFoundError` at the Markdown conversion.
86
+ - **Version range:** developed and verified against Scrapling **0.5**, through interfaces that are not stable API surface (`Selector`, `Spider`, `SessionManager`, and the converter's noise-stripping helpers). The upper bound is pinned below `0.6`; outside the range the guards still run, but the anti-injection cleaning and the crawl path may not behave as documented. In 0.5 the browser backend is patchright only (the old standalone stealth fetch is gone; its anti-detection arguments live on `scrapling_render`), `capture_xhr` became session-level recording (hence `scrapling_session_network`), and `extra_flags` became additive — this package sends none, and WebRTC leak protection is carried by the `blockWebrtc` switch.
87
+ - **Browser engines are entirely your responsibility.** The plugin downloads nothing. Without a browser it simply does not register the browser-dependent tools, so the model never wastes a turn calling them.
88
+ - **No `@deepseek-ai/*` under `dependencies`, by contract** (`test/publish-manifest.test.ts` enforces it). Consumer profiles install with `nodeLinker: hoisted` and `autoInstallPeers: false`, so a host package there becomes a real second copy whose module-level state splits from the running host's — every native tool call then throws while build and tests stay green. The host packages the artifact imports for value are required peers and stay externalized; the gate imports the built artifact and asserts that no host package body is inlined.
89
+ - **The artifact is ESM-only and never committed** — `prepack` rebuilds it, so what ships is always what the current source produces.
118
90
 
119
- ```sh
120
- dsh plugin --profile web add @jayyuen66/dsh-scrapling
121
- ```
91
+ ### <img src="https://api.iconify.design/lucide/arrow-down-to-line.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Shared version floor
92
+
93
+ If your profile pins `@jayyuen66/dsh-plugin-shared` with a pnpm `overrides` entry, that pin must be at least the version this package declares. A lower pin installs a copy without the names the sources use, and the host then reports `N entries did not activate` together with `does not provide an export named ...` at boot - the package installs fine and never loads, and no per-repository CI run can see it.
94
+
95
+ ## <img src="https://api.iconify.design/lucide/circle-check.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Verify it is live
96
+
97
+ 1. **The layer is mounted.** `dsh --profile web --dump-config` shows this package's layer line.
98
+ - That command is the only accepted "it is in the layer stack" signal, and it is **not read-only** — it rewrites the profile's root assembly file. Read layer lines from stdout **and** check stderr separately: an unmatched patch target appears only on stderr, so the exit code alone proves nothing. Accept both `# == <layer>` and `# == <layer>, patched by <path>`.
99
+ 2. **The startup log names the interpreter and the plan.** One line prints the probed capabilities and how many of the tools registered; the chosen interpreter path is logged at load. An interpreter that starts but lacks Scrapling is named in the log together with the pip line to copy.
100
+ 3. **The settings card renders.** The plugin detail page carries the **scrapling** card with every user-editable field grouped by purpose; toggling a value enables Save, and the write returns 200.
101
+ 4. **A tool round-trip.** Ask the model to fetch a JavaScript-heavy page: the result row renders in the chat through the official tool-call view. On a machine without a browser the render / capture_xhr tools are absent from the model's tool list and their prompt guidance is gone too — that absence is the conditional registration working, not a failure.
102
+
103
+ ## <img src="https://api.iconify.design/lucide/circle-slash.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> What it does not provide
122
104
 
123
- The plugin is also installable from the Web UI via **Sidebar -> Plugins -> Add plugin**.
105
+ - **It is not a search engine.** Scrapling only sets a Google referer header for its `google_search` option; discovery needs a deployment-level `searchEndpoint` (see [Settings](#settings)). Without one the search provider stays unavailable and the built-in `web_search` keeps its behaviour.
106
+ - **It downloads nothing.** The Python interpreter and the browser engine are supplied by you; missing pieces remove the matching tools instead of being fetched.
107
+ - **It opens no HTTP route of its own.** The settings card is a host config form; there is no `/api` surface from this package.
108
+ - **It adds no CLI subcommand.**
124
109
 
125
- ## Replacing the built-in `web_fetch` and `web_search`
110
+ ## <img src="https://api.iconify.design/lucide/plug.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Enabling it in dsh
126
111
 
127
- The plugin registers itself as a **fetch provider** and a **search provider** on
128
- `ctx.web`, so the built-in `web_fetch` / `web_search` tools actually run on Scrapling
129
- instead of dsh's plain-HTTP implementation. The model still calls `web_fetch` /
130
- `web_search` — that is what "replacing the built-in one" means here.
112
+ - `dsh.bundle.patch` points at `cordis.patch.yml`, whose single registration line is `- id: scrapling` with the **bare package name** — the host scans `dsh.client` on bare package-name entries only.
113
+ - The client half registers two surfaces: the settings card (on the `plugins.bundle.config` slot, keyed by the bundle package name — the host dispatches `entryKey: pkg.name`, so the card renders on this package's detail page) and one result row per tool on `tool.call.toolview`, drawn with the official tool-call view props.
114
+ - The settings namespace is the entry id `scrapling`; precedence is settings-card value > registration-line `config:` > schema default. Setting a field back to its default saves a **clear-override**, not a write of the same value, so a later default change still reaches you.
115
+ - Gate policy and the sidecar environment are snapshotted once when the plugin is applied — **settings changes take effect on the next start**.
116
+ - Disabling a tool also removes its system-prompt guidance: the guidance is re-read at each prompt assembly against the tools that scope can actually see, so a machine without a browser loses the render / capture_xhr lines and a sidecar that never came up loses all of them. The section is placed next to the built-in `web_fetch` guidance.
117
+ - `scrapling_crawl` registers its own job kind, so `job_list` labels its jobs as crawls rather than shell jobs.
131
118
 
132
- > **Tool names cannot be swapped; only the backend can.** `ToolRuntime.register` ends at
133
- > `NamedEntries.insert`, which **throws** on a duplicate name
134
- > (`tool "X" is already registered`). Registering a same-named tool is therefore closed off;
135
- > the `ctx.web` provider seam is the supported replacement channel.
119
+ ## <img src="https://api.iconify.design/lucide/globe.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> The tools
136
120
 
137
- **`provideWebFetch` and `provideWebSearch` are on by default**, so the plugin registers
138
- both providers whenever the sidecar is up. That still does **not** take over the built-in
139
- tools on its own: the deployment config has to name the provider.
121
+ Thirteen tools, each behind one settings switch, all exercised by the test suite:
140
122
 
141
- 1. `provideWebFetch` / `provideWebSearch` stay at their default (`true`);
123
+ | Tool | Backend | Needs a browser | Concurrency |
124
+ |---|---|---|---|
125
+ | `scrapling_fetch` | `Fetcher` (curl_cffi) | no | concurrent; write verbs are serialised once `allowWriteMethods` is on |
126
+ | `scrapling_extract` | `Selector` + CSS/XPath + `adaptive` | no | concurrent |
127
+ | `scrapling_render` | `StealthySession` (patchright) | yes | serialised; the anti-detection switches (`solveCloudflare` / `hideCanvas` / `blockWebrtc`) live here |
128
+ | `scrapling_capture_xhr` | one throwaway session, page-level recording | yes | serialised |
129
+ | `scrapling_session_open` / `scrapling_session_fetch` / `scrapling_session_network` / `scrapling_session_state_save` / `scrapling_session_state_load` / `scrapling_session_list` / `scrapling_session_close` | Scrapling session classes | browser sessions only | serialised |
130
+ | `scrapling_crawl` | Scrapling Spider framework, runs as a job | no | serialised |
131
+ | `scrapling_answer` | any fetch path plus `ctx.llm` | with `render: true` | serialised |
132
+
133
+ - **Quotas.** At most 8 open sessions (3 of them browser sessions, each a real Chromium process), 2 crawls in flight, per-page bodies clipped by `*MaxOutputChars`, 8 MB per protocol frame, 16 queued frames. A ceiling answers with a specific code (`SESSION_LIMIT` / `CRAWL_BUSY` / `BAD_FRAME`) the model can back off from.
134
+ - **`scrapling_crawl` returns a job id immediately** — a crawl takes minutes and a tool call has a timeout. Watch it with `job_list`, read it with `job_output`, stop it with `job_kill`; the tool needs a jobs registry that can attach a controller, and a profile without one simply does not register it (single-page fetching is unaffected). The crawl has a wall-clock ceiling (`crawlMaxRuntimeSeconds`) and never leaves the start domain. Politeness defaults follow Scrapling's spider defaults — robots.txt is **not** obeyed, per-domain delay is 0, up to 4 requests run in parallel — and is a deployment decision, not a per-call one (see [Settings](#settings)).
135
+ - **`scrapling_answer` fetches the page first, then hands the text plus your question to a model** and returns the conclusion instead of the whole page. It follows the model the current session is already using by default (read from the session's live request header, so a mid-session model switch is picked up), which burns no separate quota; pin `answerProvider` / `answerModel` to route page-reading elsewhere. Page text is **untrusted input** — the prompt frames it explicitly as data, but that defence is prompt-level: it lowers the risk, it does not remove it.
136
+
137
+ ### Render or static
138
+
139
+ `scrapling_render` is much slower and heavier than `scrapling_fetch`, so start static. Two criteria:
140
+
141
+ - **If the rendered result is shorter than the static fetch, go back to static.** Plenty of sites ship readable text from the server and then have their own script empty those containers and swap in canvas / Lottie animation — for those pages rendering can only lose content, and no wait setting brings it back. That is site behaviour, not a plugin defect.
142
+ - **`waitSelector` waits for an element to appear, not for content to settle.** The element can be removed after it matched, so "the selector matched" does not mean the content is in the result.
143
+
144
+ One thing that is not a criterion but worth knowing: axis ticks inside SVG **cannot be fetched at all** — the Markdown conversion emits no `<svg>` / `<text>` nodes, so chart numbers are out of reach whichever tool you use. For actual values, go through `scrapling_capture_xhr` to locate the JSON endpoint.
145
+
146
+ ## <img src="https://api.iconify.design/lucide/arrow-right-left.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Replacing the built-in fetch and search
147
+
148
+ The plugin registers itself as a **fetch provider** and a **search provider** on `ctx.web`, so the built-in `web_fetch` / `web_search` tools actually run on Scrapling instead of dsh's plain-HTTP implementation. The model still calls `web_fetch` / `web_search` — tool names cannot be swapped (same-name registration throws), the provider seam is the supported channel. Both providers are registered by default (`provideWebFetch` / `provideWebSearch`), but that alone displaces nothing:
149
+
150
+ 1. leave `provideWebFetch` / `provideWebSearch` at their default (`true`);
142
151
  2. set `fetchProvider` / `searchProvider` to `"scrapling"` in the **deployment** config.
143
152
 
144
- > **Why step 2 is still required.** The base bundle sets `fetchProvider: http`, and an id
145
- > that is configured **wins** over auto-selection — so merely having the provider
146
- > registered does not displace anything. (And if two providers are usable with no id
147
- > named, `ctx.web` yields `WEB_PROVIDER_AMBIGUOUS` and the tool becomes unavailable
148
- > outright.)
149
-
150
- Two consequences of pointing that deployment line at this plugin:
151
-
152
- - **If the sidecar cannot start, the built-in `web_fetch` reports
153
- `WEB_PROVIDER_CONFIGURED_UNAVAILABLE`** rather than quietly falling back to HTTP — the
154
- configured provider is not available, and the tool says so.
155
- - **If you later remove the plugin but leave the line in** the deployment config, the
156
- built-in tools report `WEB_PROVIDER_CONFIGURED_MISSING` — the named provider is no
157
- longer registered. Go back and remove `fetchProvider` / `searchProvider` too.
158
-
159
- When `searchEndpoint` is empty the search provider's `available()` is `false` — a second
160
- guard: `provideWebSearch` being on cannot displace the built-in `web_search` until an
161
- endpoint is configured.
162
-
163
- ### Search + render in one call
164
-
165
- Scrapling is **not** a search engine (its `google_search` option only sets a Google referer
166
- header), so `web_search` is split in two:
167
-
168
- - **Discovery** → a configurable search backend (deployment-level `searchEndpoint`),
169
- expected to be SearXNG-compatible JSON: GET `<endpoint>?q=<query>&format=json` returning
170
- `{"results": [{"url", "title", "content"}]}`. Any backend producing that shape works.
171
- - **Reading** → this plugin's sidecar. The first `searchRenderTopN` results (3 by default)
172
- are actually fetched and, when a browser is available, rendered through patchright. The
173
- body lands in `content`, the URLs in `sources`.
174
-
175
- One `web_search` call therefore yields both "which pages are relevant" and "what those
176
- pages actually say" — the latter being exactly the SPA content `web_fetch` structurally
177
- cannot read. Returned URLs are re-checked one by one by this plugin's URL gate; the parsing
178
- layer deliberately does not duplicate that policy. A page that fails to read is skipped
179
- alone — search results routinely contain dead links.
180
-
181
- One consequence to know: `dsh-web`'s `WebFetchBody` is a **closed** union with only
182
- `html | text`, no `markdown`; adding a kind is a cross-package change a plugin cannot make.
183
- So the fetch provider reports Scrapling's Markdown as `text`, which the built-in renderer
184
- displays normally. Use `scrapling_fetch` directly when you need `html` or a CSS selector.
185
-
186
- ## Configuration
187
-
188
- Settings live on the **scrapling** card in the plugin detail page (Settings → Plugins →
189
- expand this bundle). Every field marked user-editable in [`host.ts`](./host.ts) appears
190
- there, grouped by what it is for and with a one-line "what changes if you edit this";
191
- deployment-level fields are only settable through the `config:` block in
192
- [`cordis.patch.yml`](./cordis.patch.yml). Setting a field back to its default saves a
193
- **clear-override**, not a write of the same value - so when the default changes later,
194
- that field follows along.
195
-
196
- Notable switches:
197
-
198
- - `pythonBin` - interpreter name or absolute path; empty means `python3` on `PATH`.
199
- - `fetchEnabled` / `extractEnabled` / `renderEnabled` / `captureXhrEnabled` /
200
- `networkEnabled` / `sessionEnabled` / `sessionStateEnabled` / `crawlEnabled` /
201
- `answerEnabled` - on by default.
202
- `scrapling_crawl` needs a profile that ships a jobs backend; without one it fails
203
- loudly (`JOBS_UNAVAILABLE`) rather than silently doing nothing. `sessionStateEnabled`
204
- controls the `scrapling_session_state_save` / `scrapling_session_state_load` pair, and
205
- those need a deployment-side `sessionStateDir` to be usable.
206
- - `pierceShadow` - **off** by default: it merges the contents of open shadow roots into
207
- the body. A page that hides its text in shadow DOM is invisible to a plain HTML read,
208
- so this is the switch for those; the model can also override it per call on the
209
- browser tools.
210
- - `extractionType` - `markdown` (default), `html` or `text`. All three paths run the
211
- same anti-injection cleaning; `html` additionally strips event-handler attributes
212
- (`on*`, `srcdoc`, `formaction`) and `meta refresh`, so the result is **not**
213
- byte-for-byte raw HTML.
214
- - `*MaxOutputChars` - per-tool output caps. The host-side cap only governs what reaches
215
- the model context; the sidecar clips first by `maxContentChars` (characters) and the
216
- host then trims to a byte budget. `crawlMaxItems` is the deployment-side
217
- ceiling over the model-supplied `maxPages`; an out-of-range `maxPages` (0, negative,
218
- NaN) is passed through unchanged so the sidecar reports the parameter error rather
219
- than this plugin silently clamping it into a legal-looking value.
220
- `crawlMaxRuntimeSeconds` is the crawl's wall-clock ceiling: the page cap says nothing
221
- about a site that takes a minute per page, and a crawl is a background thread nobody
222
- is watching. On expiry the spider winds down through its own stop channel instead of
223
- running until the site runs out.
224
- - `stripInlineImages` - **on** by default: inline `data:` URI images are dropped from
225
- the body and only their alt text is kept. Such an image is pure token noise - a
226
- base64 SVG costs characters in the context while the model cannot read a shape out
227
- of it. Pages with no inline images come back **byte-identical**; where there are some, the
228
- saving depends entirely on how many - a site either inlines none or inlines a whole wall of
229
- logos, and little in between. So turning this on is free for pages without inline images, and
230
- the whole benefit lands when it matches.
231
- `data:` URIs inside code fences are left untouched - there they are almost always
232
- sample code a tutorial is teaching, and stripping would be editing the document.
233
- Turn this off only when the raw base64 *is* the data (colours, fingerprints).
234
- Stripping happens **before** the cap: the other way round is pointless, since those
235
- tens of kilobytes have already eaten the `maxContentChars` budget.
236
- - `answerProvider` / `answerModel` / `answerMaxTokens` - the model `scrapling_answer`
237
- routes to and the per-call token ceiling. Provider and model left empty mean "follow
238
- the model the current session is already using"; `answerMaxTokens` caps the reply.
239
- - `mainContentOnly` / `headless` / `networkIdle` / `waitSelectorState` / `dataDir` -
240
- extraction scope, browser mode, the selector state a page must reach before it is read,
241
- and the sidecar working directory. Each is documented at its declaration in
242
- [`host.ts`](./host.ts).
243
- - `sidecarHandshakeTimeoutMs` / `fetchTimeoutMs` / `sidecarGraceMs` - the budget for the
244
- sidecar handshake, the per-call cooperative timeout (declared as the tools' `timeoutMs`), and
245
- how long the client waits for the process to exit after that timeout before forcing it down.
246
- The three are on the settings card. `scrapling_crawl` is the exception: it runs as a job and
247
- passes no timeout, because a crawl is measured in minutes and a fixed budget would tear the
248
- process down on every success.
249
- - `failFastOnMissingPython` - `true` (default) refuses to load when the interpreter is
250
- unusable, because every tool needs the sidecar and a silent degrade leaves the model
251
- discovering "all tools are missing" several turns later. `false` degrades to "all
252
- tools unavailable" with a warning.
253
- - `blockAds` - on by default. It stacks **on top of** the SSRF guard rather than
254
- competing with it: the guard is registered last (so Playwright runs it first) and
255
- yields with `route.fallback()`, leaving Scrapling's own interception handler reachable.
256
- - `allowedHosts` - extra host names that skip the public-address check. The same setting
257
- feeds both layers, so an explicitly allowed intranet target is not rejected by the
258
- host-side policy before the Python side ever sees it. Pointing it at an intranet
259
- address means giving up SSRF protection for those targets on purpose.
260
- - `syntheticDnsRanges` - manual fallback for synthetic DNS: a comma-separated CIDR list
261
- of your proxy's fake-IP pool. Detection is the main path and should handle it; this is
262
- for the case where the resolver mixes synthetic and real answers. Invalid entries are
263
- dropped rather than refusing to load - this is a fallback, and a broken one degrades to
264
- "stay strict", not to a crash.
265
- - `proxyUrl` - where fetches go out, e.g. `http://127.0.0.1:7890` or
266
- `socks5://127.0.0.1:7890`, optionally with `user:pass@`. **Empty means follow the
267
- environment.** It is a deployment-level capability and never enters a tool schema. The
268
- resolution order is spelled out under [Proxies](#proxies).
269
- - `proxyBypass` - host names that should connect directly, mirroring `NO_PROXY`.
270
-
271
- **Deployment-grade knobs** (not on the settings card; set them in the `config:` block of
272
- `cordis.patch.yml`): `requestTimeoutSeconds`, `maxUrlLength`, `browserExecutablePath`,
273
- `browserCdpUrl`, `browserInitScript`, `browserRealChrome`, `browserDnsOverHttps`,
274
- `recordRequests`, `maxRecordedRequests`, `sessionStateDir`, `crawlMaxRuntimeSeconds`,
275
- `crawlRespectRobots`, `crawlDownloadDelayMs`, `crawlConcurrentRequests`,
276
- `crawlAutothrottle`, `crawlStrategy`, `crawlCheckpointDir`, `searchEndpoint`,
277
- `searchRenderTopN`, `allowWriteMethods` (default `false`). The browser pair
278
- (`browserExecutablePath`, `browserCdpUrl`) and `browserInitScript` are strong
279
- capabilities - they hand Chromium a file to execute and the browser to a debugger
280
- endpoint - so they come only from deployment config and are unreachable from model input.
281
- `allowWriteMethods` is off by default for the same kind of reason: it decides whether the
282
- model may change state on a remote host. The crawler knobs and `sessionStateDir` are
283
- deployment decisions too - see
284
- [Sessions, network history and crawler etiquette](#sessions-network-history-and-crawler-etiquette).
285
-
286
- > **Settings changes need a dsh restart.** The gate policy and the sidecar environment are
287
- > snapshotted once when the plugin is applied; edits on the settings card take effect on the
288
- > next start.
289
-
290
- Disabling a tool also removes its system-prompt guidance, so the model is never told
291
- about a capability that is not registered. The guidance is re-read at each prompt
292
- assembly against the tools that scope can actually see, so a machine without a browser
293
- loses the render / capture_xhr lines, and a sidecar that never came up loses all of them -
294
- advice to call a missing tool costs a round trip and a confusing `UNKNOWN_TOOL`.
295
-
296
- ## Sessions, network history and crawler etiquette
297
-
298
- Scrapling 0.5 exposes a few capabilities that this plugin surfaces as tools, each with a
299
- deployment knob beside it. The tools are on the settings card; the knobs are
300
- deployment-only (the `config:` block of `cordis.patch.yml`).
301
-
302
- - **Network history.** An open session can record the XHR/fetch requests it makes.
303
- `recordRequests` is the deployment default, and the model can turn recording on for one
304
- session with `recordNetwork` on `scrapling_session_open`. Read it back with
305
- `scrapling_session_network` (`urlPattern` / `includeBody` / `networkLimit` /
306
- `maxBodyChars`); `maxRecordedRequests` caps how many entries a session keeps. A session
307
- that is not recording reports an error rather than an empty list.
308
- - **Shadow DOM.** `pierceShadow` merges open shadow roots into the body (off by default);
309
- the model can also override it per call on the browser tools.
310
- - **Login state.** `sessionStateDir` points at a directory for Playwright-compatible
311
- login-state files. `scrapling_session_state_save` / `scrapling_session_state_load` write
312
- and read them; the model can only pass a **plain file name** (no path), so the directory
313
- stays a deployment decision. Empty means the pair is disabled.
314
- - **Crawler etiquette and order.** `crawlRespectRobots` (off by default) makes the spider
315
- obey robots.txt; with it on, a domain whose robots.txt cannot be fetched is **blocked**
316
- rather than assumed permitted. `crawlDownloadDelayMs` (`0`) sets the gap between
317
- requests, `crawlConcurrentRequests` (`4`) the parallelism, `crawlAutothrottle` (off) lets
318
- the spider slow itself down, and `crawlStrategy` (`bfs` / `dfs`) picks breadth- or
319
- depth-first.
320
- - **Crawl checkpoints.** `crawlCheckpointDir` (empty) lets a crawl persist its queue, so a
321
- restarted crawl resumes instead of going back to the start URL.
322
- - **Browser extras.** `browserInitScript` injects a JS file into every page (a strong
323
- capability), `browserRealChrome` uses the locally-installed Google Chrome instead of the
324
- bundled Chromium, and `browserDnsOverHttps` routes the browser's DNS over HTTPS (useful
325
- with a proxy to avoid DNS leaks).
326
-
327
- ## Proxies
328
-
329
- Where a fetch goes out, resolved in this order - **first hit wins**:
153
+ A configured id wins over auto-selection, which is why step 2 is required — and with two usable providers and no id named, `ctx.web` answers `WEB_PROVIDER_AMBIGUOUS` and the tool becomes unavailable outright. Two consequences of pointing that line at this plugin:
154
+
155
+ - **If the sidecar cannot start, the built-in `web_fetch` reports `WEB_PROVIDER_CONFIGURED_UNAVAILABLE`** rather than quietly falling back to plain HTTP.
156
+ - **If you later remove the plugin but leave the line in**, the built-in tools report `WEB_PROVIDER_CONFIGURED_MISSING` — go back and remove `fetchProvider` / `searchProvider` too.
157
+ - **The fetch provider really applies the output budget**: a body over `fetchMaxOutputChars` is cut to a head/tail window and flagged `truncated`, not passed through with a flag. Failures keep the sidecar code prefix (`URL_BLOCKED`, `SIDECAR_TIMEOUT`, `SIDECAR_UNAVAILABLE`), so a policy refusal is distinguishable from a crash or a timeout.
158
+
159
+ Search is split in two, because Scrapling is not a search engine: **discovery** goes to a deployment-level `searchEndpoint`, expected to be SearXNG-compatible JSON (`GET <endpoint>?q=<query>&format=json` returning `{"results": [{"url", "title", "content"}]}` — any backend producing that shape works); **reading** is this plugin's — the first `searchRenderTopN` results are actually fetched and, with a browser, rendered, so one `web_search` call returns both which pages matter and what they say. Every returned URL goes through the same gate as a fetch; a page that fails to read is skipped alone, because search results routinely contain dead links.
160
+
161
+ One consequence to know: `dsh-web`'s fetch body is a **closed** union of `html | text` with no `markdown` kind, and adding one is a cross-package change a plugin cannot make. The fetch provider therefore reports Scrapling's Markdown as `text`, which the built-in renderer displays normally. Use `scrapling_fetch` directly when you need `html` or a CSS selector.
162
+
163
+ ## <img src="https://api.iconify.design/lucide/sliders-horizontal.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Settings
164
+
165
+ Settings live on the **scrapling** card in the plugin detail page, grouped by purpose, each field with a one-line "what changes if you edit this". The card's language follows the host locale. Values marked below live on the card; the deployment table after them is only settable through the `config:` block of `cordis.patch.yml`.
166
+
167
+ | Field | Type | Default | Purpose |
168
+ | --- | --- | --- | --- |
169
+ | `pythonBin` | string | `""` | Interpreter name or absolute path. Empty = the repository `_env/.venv` when executable, otherwise `python3` on `PATH` |
170
+ | `failFastOnMissingPython` | boolean | `true` | Refuses to load when the sidecar process cannot start (wrong path, protocol mismatch, handshake timeout). An interpreter that starts but lacks Scrapling always degrades to "tools unavailable" with the path named in the log, whatever this switch says |
171
+ | `fetchEnabled` / `extractEnabled` / `renderEnabled` / `captureXhrEnabled` / `networkEnabled` / `sessionEnabled` / `sessionStateEnabled` / `crawlEnabled` / `answerEnabled` | boolean | `true` | One kill switch per tool or tool pair. `sessionStateEnabled` gates the state save / load pair, which also needs a deployment-side `sessionStateDir` |
172
+ | `extractionType` | enum | `markdown` | `markdown` / `html` / `text`; all three run the same anti-injection cleaning, and `html` additionally strips event-handler attributes, so it is not byte-for-byte raw HTML |
173
+ | `mainContentOnly` | boolean | `true` | Extraction scope |
174
+ | `*MaxOutputChars` | natural | fetch / extract / render `200000`, xhr `120000` | Per-tool output caps. The sidecar clips by characters, the host then trims to a byte budget |
175
+ | `crawlMaxItems` | natural | `1000` | Ceiling over the model-supplied `maxPages`. An out-of-range `maxPages` is passed through so the sidecar reports the parameter error rather than this plugin silently clamping it |
176
+ | `stripInlineImages` | boolean | `true` | Drops inline `data:` URI images from the body, keeping only alt text — pure token noise for the model. Code fences are left untouched; pages without inline images come back byte-identical. Stripping happens before the cap. Turn off only when the raw base64 **is** the data (colours, fingerprints) |
177
+ | `headless` / `networkIdle` | boolean | `true` / `false` | Browser mode and whether a page must reach network idle before it is read |
178
+ | `blockAds` | boolean | `true` | Stacks **on top of** the SSRF guard rather than competing with it: the guard is registered last (so the engine runs it first) and yields with `route.fallback()` |
179
+ | `pierceShadow` | boolean | `false` | Merges open shadow roots into the body — the switch for pages that hide their text in shadow DOM. The model can also override it per call on the browser tools |
180
+ | `waitSelectorState` | enum | `attached` | The state a `waitSelector` element must reach (`attached` / `detached` / `hidden` / `visible`) |
181
+ | `sidecarHandshakeTimeoutMs` / `fetchTimeoutMs` / `sidecarGraceMs` | natural | `30000` / `120000` / `5000` | Handshake budget, per-call cooperative timeout (declared on the tools' `timeoutMs`), and how long the client waits for the process to exit before forcing it down. `scrapling_crawl` passes no timeout — a crawl is measured in minutes |
182
+ | `dataDir` | string | `""` | Sidecar working directory (the `adaptive` fingerprint database lands here); empty = `~/.dsh-scrapling`. If it cannot be created, `failFastOnMissingPython` decides whether the plugin refuses to load or degrades to no tools |
183
+ | `provideWebFetch` / `provideWebSearch` | boolean | `true` | Whether the `ctx.web` providers are registered at all — see [Replacing the built-in fetch and search](#replacing-the-builtin-fetch-and-search) |
184
+ | `answerProvider` / `answerModel` / `answerMaxTokens` | string / natural | `""` / `""` / `2000` | The model `scrapling_answer` routes to and the per-reply token cap. Provider and model left empty mean "follow the model the current session is already using" |
185
+ | `allowedHosts` | string | `""` | Extra host names that skip the public-address check (comma-separated). Pointing it at an intranet address means giving up SSRF protection for those targets on purpose |
186
+ | `syntheticDnsRanges` | string | `""` | Manual fallback for synthetic DNS: a comma-separated CIDR list of your proxy's fake-IP pool, for resolvers that mix synthetic and real answers. Invalid entries are dropped — a broken fallback degrades to "stay strict", not to a crash |
187
+ | `proxyUrl` | string | `""` | Where fetches go out (`http://…` / `socks5://…`, optionally `user:pass@`). Empty = follow the environment; see [Proxies](#proxies). Masked on the card, never enters a tool schema |
188
+ | `proxyBypass` | string | `""` | Host names that connect directly, mirroring `NO_PROXY`; `*` means the whole machine goes direct |
189
+ | `nat64Prefixes` | string | `""` | Extra NAT64 prefixes (comma-separated CIDRs) for operator-specific networks; a declared prefix applies to every IPv6 address |
190
+
191
+ **Deployment-only knobs** (not on the card; set them in the `config:` block of `cordis.patch.yml`):
192
+
193
+ | Field | Default | Purpose |
194
+ | --- | --- | --- |
195
+ | `requestTimeoutSeconds` / `maxUrlLength` | `120` / `2048` | Python-side per-request ceiling; URL length cap aligned with the built-in fetch |
196
+ | `allowWriteMethods` | `false` | Whether the model may change state on a remote host at all — see [Security](#security) |
197
+ | `browserExecutablePath` / `browserCdpUrl` / `browserInitScript` | `""` | Strong capabilities: they hand Chromium a file to execute and the browser to a debugger endpoint, or inject a JS file into every page. Deployment config only, unreachable from model input |
198
+ | `browserRealChrome` / `browserDnsOverHttps` | `false` | Use the locally installed Google Chrome; route the browser's DNS over HTTPS (useful with a proxy to avoid DNS leaks) |
199
+ | `recordRequests` / `maxRecordedRequests` | `false` / `100` | Whether browser sessions record network history by default (the model can turn it on per session with `recordNetwork`), and how many entries a session keeps |
200
+ | `sessionStateDir` | `""` | Directory for Playwright-compatible login-state files. The model can only pass a **plain file name**, so the directory stays a deployment decision; empty disables the state save / load pair |
201
+ | `crawlMaxRuntimeSeconds` | `1800` | Wall-clock ceiling of one crawl — the page cap says nothing about a site that takes a minute per page |
202
+ | `crawlRespectRobots` | `false` | Obey robots.txt; with it on, a domain whose robots.txt cannot be fetched is **blocked** rather than assumed permitted |
203
+ | `crawlDownloadDelayMs` / `crawlConcurrentRequests` / `crawlAutothrottle` / `crawlStrategy` | `0` / `4` / `false` / `bfs` | Gap between requests, parallelism, adaptive throttling, breadth- or depth-first order |
204
+ | `crawlCheckpointDir` | `""` | Persist the crawl queue so a restarted crawl resumes instead of going back to the start URL |
205
+ | `searchEndpoint` / `searchRenderTopN` | `""` / `3` | The SearXNG-compatible discovery backend, and how many of its results are actually fetched and rendered (`0` = link list only) |
206
+
207
+ ## <img src="https://api.iconify.design/lucide/network.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Proxies
208
+
209
+ Where a fetch goes out, resolved in this order — **first hit wins**:
330
210
 
331
211
  1. `proxyBypass` or the environment's `NO_PROXY` matches this host -> direct.
332
212
  2. `proxyUrl` on the settings card is non-empty -> use it.
333
- 3. `http_proxy` / `https_proxy` / `all_proxy` in the environment (upper case works too) ->
334
- use the matching slot.
335
- 4. The operating system's proxy settings (`scutil --proxy` on macOS, Internet Settings on
336
- Windows) -> use them.
213
+ 3. `http_proxy` / `https_proxy` / `all_proxy` in the environment (upper case works too) -> use the matching slot.
214
+ 4. The operating system's proxy settings (`scutil --proxy` on macOS, Internet Settings on Windows) -> use them.
337
215
  5. Neither -> direct.
338
216
 
339
- Each rung exists because leaving it out loses a class of users. The settings card is
340
- explicit intent; environment variables cover CI, ssh sessions and `docker exec`, where a
341
- proxy is only ever `export`ed in the shell; the OS settings are what proxy clients default
342
- to on macOS and Windows - flip "system proxy" on in Clash Verge or Surge and every browser
343
- on the machine is proxied, while curl_cffi has no idea system settings exist.
344
-
345
- An explicit `proxyUrl` makes the last two rungs irrelevant: an explicit setting should
346
- outrank an implicit source, otherwise "I set 7890 and it still goes through 1080" has
347
- nowhere to be debugged from. The bypass list cuts across everything above it - a hit
348
- connects directly no matter where the proxy came from.
349
-
350
- What that looks like in practice - **with or without a proxy, the tools just work, with no
351
- setting to fill in**:
217
+ What that looks like in practice — **with or without a proxy, the tools just work, with no setting to fill in**:
352
218
 
353
219
  | Your setup | Static fetching | Render / XHR |
354
220
  | --- | --- | --- |
@@ -359,238 +225,77 @@ setting to fill in**:
359
225
  | Intranet targets / internal Git | exclude with `proxyBypass` | exclude with `proxyBypass` |
360
226
  | PAC (auto-config script) | not followed; stderr says to set `proxyUrl` | followed natively by the browser |
361
227
 
362
- PAC is the one shape that still needs a hand-filled setting: evaluating it means
363
- downloading a script and running JavaScript, and the dialects differ per platform, so this
364
- plugin does not guess. When it sees one it says so on stderr instead of quietly connecting
365
- directly.
366
-
367
228
  Details worth knowing:
368
229
 
369
- - **A proxy and synthetic DNS are two different problems.** A fake-IP proxy resolves
370
- **every** domain into `198.18.0.0/15` (TUN clients often land in `100.64.0.0/10`);
371
- neither is a public unicast range, so the gate rejects every URL and turning a proxy on
372
- makes the plugin stop working. The plugin **detects** that class of resolver on its
373
- own: it resolves three control names unrelated to any target - `example.com`,
374
- `www.iana.org`, `www.wikipedia.org` - and if all of them land in one non-public pool
375
- while staying distinct, it treats the resolver as fake-IP and relaxes to the **whole of
376
- the known synthetic pools** - 198.18.0.0/15 (the clash / mihomo default) and
377
- 100.64.0.0/10 (some TUN clients). Private, loopback and link-local ranges are in neither
378
- pool, so `http://192.168.1.10/`, `http://127.0.0.1/` and `http://169.254.169.254/` stay
379
- blocked on a proxied machine.
380
-
381
- The control names only **trigger** that verdict; they never size the pool. That was learned
382
- the hard way: the three answers are hashed by name, so their spread is chance. Measured on a
383
- real machine they were .126/.134/.135 - a spread of 10, which sliced out 198.18.0.112..127.
384
- `www.iana.org` and `www.wikipedia.org` then failed their own gate, and `github.com` (.38)
385
- and `opencode.ai` (.61) were refused outright. Three samples carry no size information.
386
-
387
- `syntheticDnsRanges` is the manual fallback when detection fails (a self-built pool outside
388
- the two ranges above). When detection does not fire, the gate **stays strict**; an IP literal
389
- written into the URL is still judged strictly.
390
- - **Through a proxy, a host name this machine cannot resolve is no longer rejected.** The
391
- request never leaves this machine's network namespace, the proxy resolves the name, and
392
- a local resolver coming up empty says nothing - while on a network with DNS filtered by
393
- region, those are exactly the sites that need a proxy to be reachable at all. IP
394
- literals, private answers the local resolver *can* produce, and single-label host names
395
- (`intranet`, `router`) stay rejected.
396
- - **WebRTC leaks are closed when proxied.** Chromium's WebRTC can send UDP around an
397
- HTTP/SOCKS proxy, so one STUN call in a page is enough to learn the visitor's real exit
398
- address. In 0.5 that protection is carried by the `block_webrtc` switch itself: this
399
- plugin turns it on whenever a proxy is in play, and sends **no** `extra_flags` along the
400
- way. (Before 0.5 it needed a pair of Chromium launch flags, because `config.extra_flags`
401
- then **replaced** the anti-detection flags upstream computed; upstream made it additive,
402
- so that workaround is gone with the old browser backend.)
403
- - **Network history is session-level.** Recording is a construction-time setting
404
- (`recordRequests` deployment default, or `recordNetwork` per `scrapling_session_open`),
405
- and `scrapling_session_network` reads whatever the session accumulated across fetches.
406
- `scrapling_capture_xhr`, by contrast, opens a throwaway session for one page and returns
407
- the requests that page made.
408
- - **`headers` and `retries` on `scrapling_session_fetch` are static-session only, and a
409
- browser session says so.** Upstream reads neither for Playwright/patchright sessions
410
- (request headers there are `extraHeaders`, retries is a construction-time setting) and
411
- does not complain when they are passed, so `session_fetch` refuses them with `BAD_ARGS`
412
- naming the knob to use instead - a silent no-op is the failure mode this plugin is trying
413
- to eliminate.
414
- - **A browser session picks its proxy once, at `session_open`**, and the whole session
415
- shares it. The bypass list therefore does not apply per URL inside a browser session:
416
- Playwright's proxy lives on the BrowserContext, and switching it means a new context,
417
- which throws away the session's cookies and login state - precisely the reason a
418
- session exists. Static sessions have no such limit and decide per request.
419
- - **Write verbs are off by default, and the gates do not cover them anyway.**
420
- `allowWriteMethods` (deployment-level, `cordis.patch.yml` only - not on the settings card)
421
- decides whether `scrapling_fetch` even shows `method` (POST/PUT/DELETE) and `body` to the
422
- model. Off - the default - those two parameters are not in the tool's surface at all, and
423
- the sidecar independently refuses a non-GET with `WRITE_DISABLED`, so a hand-built frame
424
- cannot write either. The two halves do not rely on each other. Turn it on only where the
425
- task really is to submit data: prompt-injected page text can ask for a POST, and the SSRF
426
- gate, the proxy decision and `follow_redirects="safe"` bound *where* a request goes, not
427
- *what it does once there*. `headers` and `cookies` stay available either way - a credentialed
428
- GET against a host you allow-listed is the normal case - but note that anything handed to
429
- them lands in the model context by design. `fetchEnabled` remains the coarse kill switch.
430
- - **Browser identity knobs live on the tools that can actually apply them.** `useragent` /
431
- `locale` / `timezoneId` / `headless` are model-visible on the one-shot browser tools and on
432
- `scrapling_session_open` - those take effect at session construction, because passing them
433
- on a per-request session call is silently dropped upstream.
434
- - **Credentials never reach a log or the capability frame.** The capability report echoes
435
- `scheme://host:port` only, and its `source` field names which rung answered
436
- (`settings` / `environment` / `system` / `none`) - that column is the first thing to look
437
- at when someone reports that fetching does not work.
438
- - **A malformed proxy address does not stop the plugin from loading.** A scheme outside
439
- `http` / `https` / `socks4` / `socks5` / `socks5h` is logged to stderr and treated as
440
- "not configured", rather than thrown out as a load failure.
441
-
442
- ## Render or static: how to choose
443
-
444
- `scrapling_render` is much slower and heavier than `scrapling_fetch`, so start static.
445
- Two criteria:
446
-
447
- **If the result is shorter than the static fetch, go back to static.** Plenty of sites
448
- ship readable text from the server (for search engines and no-JS users) and then have their
449
- own script empty those containers and swap in canvas / Lottie animation - for those pages
450
- rendering can only lose content, and `networkIdle`, `waitSelector`, `mainContentOnly` and
451
- `headless` all fail to bring it back: in the rendered DOM those containers are simply empty.
452
- That is site behaviour, not a plugin defect.
453
-
454
- **`waitSelector` waits for an element to appear, not for content to settle.** The element
455
- can be removed after it matched, so "the selector matched" does not mean that content is
456
- in the result.
457
-
458
- One thing that is not a criterion but worth knowing: axis ticks inside SVG **cannot be
459
- fetched at all**. After Chromium renders, the markdown conversion emits no `<svg>` or
460
- `<text>` nodes, so "the numbers on the chart" are out of reach whichever tool you use - the
461
- copy on an example card is server-rendered and was already there statically, it is not a
462
- rendering product. For actual values, go through `scrapling_capture_xhr` to locate the
463
- JSON endpoint.
464
-
465
- ## Security notes
466
-
467
- - **SSRF.** Scrapling itself has no SSRF protection. This plugin adds a URL policy on
468
- the host side (scheme allowlist, credential rejection, length cap, rejection of an
469
- authority containing a backslash or control characters, DNS resolution with a
470
- whole-answer-set public-address check, and IPv4-mapped / NAT64 addresses reclassified
471
- by their embedded IPv4) and enforces it again on the Python side. **What is judged is
472
- what gets sent**: the gate decides on the WHATWG-normalised form and the sidecar forwards
473
- that same normalised string, otherwise "judged A, connected to B" becomes a bypass in
474
- its own right. The browser-side guard is registered by the plugin's own code and covers
475
- navigation, subresources, XHR and WebSocket handshakes.
476
-
477
- Known gaps, all stated in the open:
478
- - **Connection pinning** (an undici-level technique) is unavailable for a non-Node
479
- transport, leaving a TOCTOU window between validation and connect. Static fetches are
480
- covered by curl_cffi's `follow_redirects="safe"`; browser fetches by a route handler
481
- on the Python side.
482
- - **NAT64 prefixes are not discovered dynamically.** dsh's built-in probes the active
483
- prefix via the `ipv4only.arpa` sentinel; this plugin covers the two standardized
484
- prefixes (`64:ff9b::/96`, `64:ff9b:1::/48`). Declare any operator-specific prefix via
485
- the `nat64Prefixes` setting, otherwise a private IPv4 hidden inside IPv6 is judged as
486
- an ordinary public IPv6. Conversely, a declared prefix applies to **every** IPv6
487
- address, not only the ones inside the RFC 6052 segment.
488
- - **No port allowlist** (any port allowed by default), matching dsh's own built-in
489
- fetch provider.
490
- - **`scrapling_crawl` re-checks addresses itself, but the start-URL gate is still the
491
- first line.** The start URL goes through `guard.url_allowed` (the same implementation
492
- the browser path uses, so both layers agree), the crawl session sets
493
- `follow_redirects="safe"` so curl_cffi refuses to follow a jump into a private range,
494
- and each page is re-checked **twice** before it enters the result set: once against
495
- the guard (the final URL may still have landed somewhere private) and once against the
496
- start domain - Scrapling's `allow_domains` is a string comparison that covers links
497
- found in the page and not redirect targets, so an off-site jump on a public host has to
498
- be caught here.
499
- - **WebSocket coverage depends on the Playwright version.** The guard intercepts
500
- handshakes via `route_web_socket`. Older builds lack that method, WebSocket is then
501
- outside the guard, and the plugin says so in the log and in the capability report
502
- rather than degrading silently.
503
- - **Browser binary path and CDP endpoint are deployment-grade capabilities.** They come
504
- only from deployment config and are unreachable from model input; pointing at them
505
- hands over "run this file" and "attach the browser to this debugger".
506
-
507
- The host-side policy is enforced by `SidecarClient.call`, so it covers every tool and
508
- the `web_fetch` provider alike; a rejection throws `URL_BLOCKED` before the request is
509
- written to the pipe. The `web_search` provider runs the same gate over the URLs it is
510
- about to hand back: a hit the gate rejects never becomes a citeable source, so the model
511
- is never offered an address the next fetch would refuse.
512
- - **Browser engines ignore proxy environment variables.** patchright does not read
513
- `HTTP_PROXY` / `HTTPS_PROXY`, so `scrapling_render` and `scrapling_capture_xhr`
514
- connect **directly** even when the rest of the system is
515
- routed through a proxy — a browser-bound request leaves the tunnel. curl_cffi (behind
516
- `scrapling_fetch` and the crawler) *does* honour those variables, so the two halves
517
- behave differently on a proxy-bound network. This is stated rather than papered over:
518
- routing the browser through a proxy means handing the plugin a deployment-grade
519
- capability, and shipping that without a way to check it against a live proxy would be
520
- worse than saying so. `allowSyntheticDns` above only fixes the *gate*; it does not
521
- change where traffic goes.
522
- - **There are quotas; the resident resources are not unbounded.** At most 8 concurrent
523
- sessions (of which at most 3 may be browser sessions — the `stealth` session type, each a
524
- real Chromium process), at
525
- most 2 crawls in flight, per-page bodies clipped at `maxContentChars`, 8 MB per protocol
526
- frame, and 16 frames of pending queue. Hitting a ceiling yields a specific error code
527
- (`SESSION_LIMIT` / `CRAWL_BUSY` / `BAD_FRAME`) the model can back off from, rather than
528
- exhausting the machine.
529
- - **No code execution from the model.** `page_action`, `page_setup`, `selector_config`,
530
- `proxy`, `executablePath` and `cdpUrl` are never exposed in any tool schema. The
531
- browser-side network guard is
532
- installed by plugin code, never by model input.
533
- - **Prompt-injection scrubbing** runs unconditionally on returned content; there is no
534
- model-facing switch to turn it off.
535
-
536
- ## Development
230
+ - **The resolved proxy is handed to the browser engine explicitly.** Chromium does not read `HTTP_PROXY` / `ALL_PROXY`, so a proxy that is only exported in a shell would cover static fetches but not the browser — this package closes that gap by passing the resolved proxy on every browser fetch. A **browser session** still picks its proxy once, at `scrapling_session_open`: switching it means a new browser context, which throws away the session's cookies and login state — precisely the reason a session exists. Static sessions decide per request.
231
+ - **PAC is the one shape that needs a hand-filled `proxyUrl`.** Evaluating a PAC script means downloading it and running JavaScript, and the dialects differ per platform, so this package does not guess; static fetching says so on stderr, and the browser follows PAC natively through its own system settings.
232
+ - **A proxy and synthetic DNS are two different problems.** A fake-IP proxy resolves **every** domain into `198.18.0.0/15` (TUN clients often `100.64.0.0/10`); neither is public unicast, so the gate would reject every URL — turning a proxy on would stop the plugin from working. The gate detects that class of resolver on its own (three control names unrelated to any target, all landing in one non-public pool while staying distinct) and then relaxes to the **whole** of the known pools. The control names only trigger the verdict, never size the pool — three hashed answers carry no size information. Private, loopback and link-local ranges are in neither pool, so intranet and metadata addresses stay blocked on a proxied machine. `syntheticDnsRanges` is the manual fallback for a self-built pool outside the two ranges; when detection does not fire, the gate **stays strict**.
233
+ - **Through a proxy, a host name this machine cannot resolve is no longer rejected.** The proxy resolves it, and on a network with DNS filtered by region those are exactly the sites that need a proxy. IP literals, private answers the local resolver *can* produce, and single-label host names (`intranet`, `router`) stay rejected.
234
+ - **WebRTC leaks are closed whenever a proxy is in play.** Chromium's WebRTC can send UDP around an HTTP/SOCKS proxy, and one STUN call in a page is enough to learn the visitor's real exit address; `blockWebrtc` is forced on with a proxy, no model input involved.
235
+ - **Credentials never reach a log or the capability frame.** The report echoes `scheme://host:port` only, with a `source` field (`settings` / `environment` / `system` / `none`) — the first column to read when someone reports that fetching does not work. A malformed proxy address is logged to stderr and treated as "not configured" rather than failing the load.
236
+
237
+ ## <img src="https://api.iconify.design/lucide/shield-alert.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Security
238
+
239
+ - **SSRF.** Scrapling itself has no SSRF protection. This package adds a URL policy on the host side — scheme allowlist, rejection of URLs with embedded credentials, length cap, rejection of an authority containing a backslash or control characters, DNS resolution with a whole-answer-set public-address check, IPv4-mapped and NAT64 addresses reclassified by their embedded IPv4 — and enforces it again on the Python side. **What is judged is what gets sent**: the gate decides on the WHATWG-normalised form and the sidecar forwards that same string, otherwise "judged A, connected to B" would be a bypass in its own right. The host-side policy is enforced in one place (`SidecarClient.call`), so it covers every tool and the `web_fetch` provider alike, with a rejection throwing `URL_BLOCKED` before the request reaches the pipe; the `web_search` provider runs the same gate over the URLs it is about to return, so a hit the gate rejects never becomes a citeable source. The browser-side guard covers navigation, subresources, XHR and WebSocket handshakes.
240
+ - Known gaps, stated in the open:
241
+ - **Connection pinning** (an undici-level technique) is unavailable for a non-Node transport, leaving a TOCTOU window between validation and connect. Static fetches are covered by curl_cffi's `follow_redirects="safe"`; browser fetches by a route handler on the Python side.
242
+ - **NAT64 prefixes are not discovered dynamically.** The two standardized prefixes are covered; operator-specific ones must be declared via `nat64Prefixes`, otherwise a private IPv4 hidden inside IPv6 is judged as an ordinary public IPv6.
243
+ - **No port allowlist** (any port allowed by default), matching dsh's own built-in fetch provider.
244
+ - **The crawl re-checks every page twice** before it enters the result set — once against the guard (the final URL may still have landed somewhere private) and once against the start domain, because Scrapling's `allow_domains` is a string comparison over links found in the page, not redirect targets. The crawl session uses `follow_redirects="safe"` so curl_cffi refuses a jump into a private range.
245
+ - **WebSocket coverage depends on the Playwright version.** The guard intercepts handshakes via `route_web_socket`; older builds lack that method, WebSocket is then outside the guard, and the plugin says so in the log and the capability report rather than degrading silently.
246
+ - **No code execution from model input.** `page_action`, `page_setup`, `selector_config`, `proxy`, `executablePath` and `cdpUrl` never appear in any tool schema, and the browser-side network guard is installed by plugin code. The strong browser capabilities and `allowWriteMethods` come only from deployment config.
247
+ - **Write verbs are off by default.** With `allowWriteMethods` off, `method` and `body` are absent from `scrapling_fetch`'s parameter surface, and the sidecar independently refuses a non-GET with `WRITE_DISABLED` — two halves that do not rely on each other. The gate, the proxy decision and `follow_redirects="safe"` bound **where** a request goes, not **what it does once there**; prompt-injected page text can ask for a POST, so turn it on only where the task really is to submit data. `headers` and `cookies` stay available either way — anything handed to them lands in the model context by design.
248
+ - **Prompt-injection scrubbing runs unconditionally** on all three extraction paths; there is no model-facing switch to turn it off.
249
+
250
+ ## <img src="https://api.iconify.design/lucide/lock.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Data and privacy
251
+
252
+ | Aspect | Content |
253
+ | --- | --- |
254
+ | On disk | The sidecar working directory (`dataDir`, default `~/.dsh-scrapling`) holds Scrapling's `adaptive` fingerprint database; login-state files are written under `sessionStateDir` when it is configured. Settings values live in the host settings document. Nothing else is written |
255
+ | Network | Fetches go to the URLs the model supplies, through the configured proxy if any. Search queries go to the deployment-level `searchEndpoint`. `scrapling_answer` sends the fetched page text and the question through the host `llm` service — that content leaves the machine when the routed model is remote |
256
+ | Logs | The chosen interpreter, the probed capabilities, and the proxy summary (`scheme://host:port` plus which rung answered — never credentials) |
257
+ | In memory | Sessions, cookies and recorded network history live in the sidecar process and disappear with it |
258
+ | Telemetry | None |
259
+
260
+ ## <img src="https://api.iconify.design/lucide/triangle-alert.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Known boundaries
261
+
262
+ Registered honestly, one entry per class.
263
+
264
+ - **Rendering can only lose content on pages that ship readable text and then swap it out.** Sites that serve text for search engines and no-JS users, then empty those containers into canvas / Lottie animation, come back emptier after rendering — see [Render or static](#render-or-static).
265
+ - **Axis ticks inside SVG are unreachable in every tool**: the Markdown conversion emits no `<svg>` / `<text>` nodes. For chart values, locate the JSON endpoint with `scrapling_capture_xhr`.
266
+ - **A browser session's proxy is fixed at `session_open`**, and `proxyBypass` does not apply per URL inside it (a context switch would discard the cookies and login state that are the point of a session). Static sessions decide per request.
267
+ - **`headers` and `retries` on `scrapling_session_fetch` belong to static sessions.** Upstream silently drops both for browser sessions, so this package refuses them with `BAD_ARGS` naming the knob to use instead — a silent no-op is the failure mode it exists to eliminate.
268
+ - **Browser identity knobs only live on the tools that can apply them.** `useragent` / `locale` / `timezoneId` / `headless` are model-visible on the one-shot browser tools and on `scrapling_session_open` — they take effect at session construction, and passing them per request is silently dropped upstream.
269
+ - **Network history is session-level.** Recording is a construction-time setting (`recordRequests` deployment default, or `recordNetwork` per `scrapling_session_open`); a session that is not recording answers an error, not an empty list.
270
+
271
+ ## <img src="https://api.iconify.design/lucide/circle-help.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> FAQ
272
+
273
+ | Question | Answer |
274
+ | --- | --- |
275
+ | The model says the render / capture_xhr tools do not exist | No browser engine on this machine — the plugin registers only what works. Run `python -m patchright install chromium` and restart. If **every** tool is missing, the sidecar did not start: the startup log names the chosen interpreter, and a missing Scrapling carries the pip line to copy |
276
+ | After enabling a proxy, every fetch is blocked | A fake-IP proxy resolves every domain into a non-public range; the gate auto-detects that class and relaxes to the known pools. A self-built pool outside them goes into `syntheticDnsRanges`. Private and loopback addresses stay blocked on purpose |
277
+ | `web_fetch` reports `WEB_PROVIDER_CONFIGURED_UNAVAILABLE` / `_MISSING` | The deployment line points at this plugin: either the sidecar is down (interpreter or Scrapling — see the startup log), or the plugin was removed and the `fetchProvider` / `searchProvider` line is still there. Remove the line too |
278
+ | The model cannot POST a form | `allowWriteMethods` is off by default and deployment-only — it decides whether the model may change state on a remote host |
279
+ | `web_search` returns nothing | Scrapling is not a search engine. Point the deployment-level `searchEndpoint` at a SearXNG-compatible JSON backend |
280
+ | The numbers on a chart are missing | SVG tick labels do not survive the Markdown conversion in any tool. Use `scrapling_capture_xhr` to find the JSON endpoint behind the chart |
281
+
282
+ ## <img src="https://api.iconify.design/lucide/wrench.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> Development
537
283
 
538
284
  ```sh
539
- pnpm install # install dependencies
540
- pnpm run check # typecheck + lint + build + test + format check, TS *and* Python
541
- pnpm run build # bundles host.ts / src/client-entry.ts into host.js / client.js
542
- pnpm run test:py # end-to-end check of the Python sidecar (needs _env/.venv)
285
+ pnpm install
286
+ pnpm run check # typecheck → lint → client build → host build → tests → format, then the Python chain
287
+ pnpm run test:py # end-to-end check of the Python sidecar
543
288
  ```
544
289
 
545
- **The Python half is gated too.** The four `.py` files ship with this package
546
- (`package.json`'s `files` lists them one by one) and run on the user's machine, so they
547
- get the same treatment as `host.ts`: `pnpm run check` runs `ruff check` and
548
- `ruff format --check` over `py/`, and fails hard when the tools are missing rather than
549
- skipping quietly. Install them into whichever interpreter `python3` resolves to:
290
+ - **The Python half is gated like the TypeScript half.** `check` ends with `check:py`: an interpreter report, a face count (the shipped `.py` files and the test directory must both be there — a missing test directory makes "clean" and "untested" indistinguishable), ruff check, ruff format, mypy, the sidecar end-to-end, bandit (medium and above), and a coverage floor measured **only over the modules that ship**. Dev tools: `pip install -r py/requirements-dev.txt` into the interpreter `test:py` uses.
291
+ - **The Python 3.14 floor is one fact in four places:** both READMEs, the ruff and mypy targets, and a runtime gate in `py/bridge.py` that exits before any Scrapling import with a clean stdout — stdout is protocol frames, so an old interpreter shows the exit code and a stderr line instead of garbage.
292
+ - **mypy runs non-strict on purpose.** Playwright's `page` / `route` / `websocket` objects have no shape until runtime, and a strict profile would buy a pile of `ignore` comments that exist only to silence it.
293
+ - Sources are TypeScript. `host.js` and `client.js` are **build artifacts** and deliberately `.js`: Node refuses to strip types for packages inside `node_modules`, which is exactly where dsh loads the plugin from. The artifact is ESM-only; `require()` will not get you the plugin, and that is deliberate.
294
+ - Gates that pin the published shape: `test/publish-manifest.test.ts` (entry targets covered by `files`, no source file as an entry point, `dsh-*` pins exact and uniform, no host package body inlined, no dates or bad bytes in comments or documents) and `test/readme-parity.test.ts` (the two READMEs name every tool and every settings-card knob, and their section structures match).
295
+ - Publishing runs through [`.github/workflows/publish.yml`](./.github/workflows/publish.yml) (manual, OIDC trusted publishing plus `--provenance`).
550
296
 
551
- ```sh
552
- pip install -r py/requirements-dev.txt
553
- ```
554
-
555
- Two more commands measure rather than gate:
297
+ ## <img src="https://api.iconify.design/lucide/scale.svg?color=%23658EFF&height=22" height="22" width="22" align="absmiddle" alt="" /> License
556
298
 
557
- ```sh
558
- pnpm run typecheck:py # mypy over py/ (currently clean; why it stays advisory is below)
559
- pnpm run cov:py # coverage for the four shipped modules + the test script
560
- ```
299
+ MIT. Source at [github.com/JayYuen666/dsh-scrapling](https://github.com/JayYuen666/dsh-scrapling). Issues go to that repository's tracker.
561
300
 
562
- Run both with an interpreter that has Scrapling installed (the same one `test:py` uses).
563
- That is not decoration: mypy's findings depend on it. From an interpreter without
564
- Scrapling every Scrapling type degrades to `Any` and the check reports nothing at all.
565
-
566
- `mypy` stays advisory because this side is duck-typed on purpose — Playwright's `page`,
567
- `route` and `websocket` have no shape until runtime — and a strict profile would buy a
568
- pile of `ignore` comments that exist only to silence it. `cov:py` is advisory because its
569
- honest number needs the subprocess wired in: `bridge.py` and the `adapters` methods live
570
- in the sidecar child, so `test_bridge.py` spawns that child under `coverage run` when
571
- `DSH_PY_COVERAGE=1`. Without it the report reads `adapters.py` 20% while none of its fetch
572
- paths have been counted at all — a number that measures nothing. Current shape:
573
- `adapters` 65%, `bridge` 37%, `crawl` 89%, `guard` 85%.
574
-
575
- Sources are all TypeScript. `host.js` and `client.js` are **build artifacts** and are
576
- deliberately `.js`: Node refuses to strip types for packages inside `node_modules`,
577
- which is exactly where dsh loads the plugin from.
578
-
579
- The artifact is **ESM-only**: `require()` will not get you the plugin. That is deliberate
580
- (the host loads it by package name), not a defect.
581
-
582
- At build time every package declared in `dependencies`, `peerDependencies` **or**
583
- `devDependencies` is externalised. The ones the host provides at runtime (cordis,
584
- dsh-tools, dsh-subprocess, dsh-jobs) must not be inlined: the bundle would otherwise
585
- carry its own private copy, splitting module-level state, and for packages that resolve
586
- their own `package.json` relative to `import.meta.url` it would fail to load outright with
587
- `MODULE_NOT_FOUND`. `test/publish-manifest.test.ts` imports the built artifact and asserts
588
- that no host package body is inlined, so both halves stay pinned.
589
-
590
- Publishing runs through [`.github/workflows/publish.yml`](./.github/workflows/publish.yml)
591
- (manual, OIDC trusted publishing plus `--provenance`).
592
-
593
- ## License
594
-
595
- MIT — see [`LICENSE`](./LICENSE). Where this package stops and third-party code begins:
596
- [`THIRD_PARTY_NOTICES.md`](./THIRD_PARTY_NOTICES.md).
301
+ This package ships no third-party source code — Scrapling and the browser engines are runtime dependencies, and the only third-party content in the package is the icon (Tabler Icons). [`THIRD_PARTY_NOTICES.md`](./THIRD_PARTY_NOTICES.md) records that boundary.