GreyRaphael/dsh-web-fetch-moli
Project Overview项目介绍
This is a Moli backend plugin for the DeepSeek Harness web_fetch tool. Built on lightweight Rust headless browser Moli, it renders dynamic micro-frontends and SPAs with only ~50-60MB memory, outputs clean LLM-optimized Markdown. Use it for high-concurrency web fetching on resource-constrained servers. Requires Node.js 20 or newer.
这是DeepSeek Harness的web_fetch工具Moli后端插件,基于轻量Rust无头浏览器Moli开发,支持渲染动态微前端、单页应用,仅占用约50-60MB内存,可输出降噪后适合大模型的Markdown。适合资源受限服务器做高并发网页爬取,要求Node.js ≥ 20。
请帮我了解并安装插件:【dsh-web-fetch-moli】【https://github.com/GreyRaphael/dsh-web-fetch-moli】
Send this message to DSH in your current session. CLI install commands may not be accurate across systems — DSH will figure it out for you.把上面这条消息直接发给当前会话里的 DSH,让它帮你了解并安装。安装命令不一定准确,发给 DSH 更稳。
Or use CLI install (for developers)或使用命令行安装(适合开发者)
CLI Install命令行安装
dsh plugin --profile web add dsh-web-fetch-moli
把 GreyRaphael/dsh-web-fetch-moli 加入你的 DSH 配置(web profile)即可启用。
READMEREADME
dsh-web-fetch-moli
A DeepSeek Harness (DSH) plugin providing a Moli backend for the web_fetch tool. Built on Moli (an ultra-lightweight Rust headless browser), it renders dynamic micro-frontends, single-page applications (SPAs), and static sites with ~60MB memory footprint (>90% reduction compared to ~1GB for standard Chromium/Playwright), denoises pages via LinkeDOM + Readability + mdream, and returns clean, LLM-optimized GitHub Flavored Markdown.
Key Highlights
- Ultra-Lightweight Footprint — Consumes only ~50–60 MB RAM per local daemon, allowing high concurrency on resource-constrained servers without memory bloat.
- Enterprise Micro-Frontend & Dynamic SPA Compatibility — Bypasses Content Security Policy (
Page.setBypassCSP) and automatically triggersIntersectionObserversentinels for structure-first geometry, cleanly rendering complex micro-frontend sandboxes (Alibaba Alfa, qiankun, single-spa) where other lightweight engines (Lightpanda, Obscura) fail. - Three Flexible Backends:
local(default): Automatically manages a localmoli servedaemon over CDP, providing full SPA and micro-frontend execution.cdp: Connects to an existing remote Moli or Chromium CDP service over Chrome DevTools Protocol.cli: Directly executes one-shotmoli fetch, zero background daemon, ultra-fast cold start.
- High-Performance Two-Stage Denoise Pipeline — LinkeDOM + Mozilla Readability extracts primary content and eliminates noise (ads, nav bars, footers, forms), followed by mdream (Rust native with pure JS fallback) for high-fidelity, LLM-optimized Markdown conversion. Inline base64 images are elided to compact size placeholders.
- Cloudflare Challenge Resilience — Detects
cf-mitigated: challengeinterstitials and waits in the same page/context for natural clearance without artificial bot behavior.
Performance & Architecture Comparison
| Feature / Metric | Chromium / Playwright | Lightpanda (Zig) | Obscura (Rust) | Moli (Rust) + DSH Plugin |
|---|---|---|---|---|
| Memory Footprint | ~800 MB – 1.2 GB | ~40 MB | ~50 MB | ~50 – 60 MB |
| Micro-Frontend Sandbox | ✅ Full | ❌ Crashes on iframe sandbox (contentWindow.bind) |
❌ Fails on dynamic style-loader |
✅ 100% (CDP + CSP bypass) |
| Infinite Scroll / Sentinels | ✅ Pixel layout loop | ❌ Geometry incomplete | ❌ Geometry incomplete | ✅ Automated Sentinel Hooks |
| Daemonless Mode | ❌ Heavy launch | ❌ | ❌ | ✅ One-shot CLI (moli fetch) |
| Execution Protocol | Heavy CDP | Lightweight CDP | Custom / CDP | Dual: CDP Daemon + CLI |
How it works
web_fetch (tool-web)
└─ ctx.web.fetchProvider = moli
├─ local: resolves moli binary → manages `moli serve` daemon → connectOverCDP
│ └─ setupPageHooks: Page.setBypassCSP + IntersectionObserver sentinel hook
├─ cdp: connectOverCDP(remoteEndpoint)
├─ cli: spawns `moli fetch <url> --dump html` (zero daemon)
├─ page.goto → sentinel triggers → settle (networkidle) → page.content()
├─ denoise: LinkeDOM (DOM) → Readability (article extract) → mdream (Markdown)
└─ Markdown (or raw HTML when denoise is disabled)
Requirements
- DeepSeek Harness (
dsh web), Node.js ≥ 20. - Zero manual setup: the plugin features automatic download on first use. If no
molibinary is detected on your system, it automatically downloads and unpacks the latest release binary matching your OS and architecture (Linux, macOS, Windows x86_64 / arm64) into~/.cache/moli. - Existing installations of Moli v1.1.5+ are automatically detected on
$PATH,~/.local/bin/moli, or via themoliPathsetting.
Manual installation (optional):
curl -sSL https://github.com/lexmount/moli/releases/latest/download/moli-x86_64-unknown-linux-gnu.tar.gz | tar -xz -C ~/.local/bin
chmod +x ~/.local/bin/moli
Installation
# Option 1: Install directly via GitHub repository
dsh plugin --profile web add github:GreyRaphael/dsh-web-fetch-moli
# Option 2: Install via npm package name
dsh plugin --profile web add dsh-web-fetch-moli
After adding, restart dsh web to load the plugin.
Configuration
The settings card (设置 → 插件 → 插件配置 → Moli 网页爬取) configures web-fetch-moli in real time:
| Field | Default | Description |
|---|---|---|
backend |
local |
local (managed Moli CDP daemon), cdp (remote CDP endpoint), or cli (one-shot CLI). |
moliPath |
(auto) | Path to moli binary. Blank = auto-discover on $PATH and standard locations. |
cdpEndpoint |
127.0.0.1:9222 |
Remote CDP endpoint (host:port or URL). |
bypassCsp |
true |
Bypasses Content Security Policy via CDP Page.setBypassCSP, unlocking micro-frontend dynamic script loading. |
autoScrollSentinel |
true |
Programmatically triggers IntersectionObserver load-more sentinels for structure-first geometry. |
shareBrowserContext |
true |
Preserves cookies and localStorage across fetches. Unchecked: fresh isolated context per fetch. |
denoise |
true |
Runs LinkeDOM + Readability + mdream to strip ads, navbars, and footers before LLM-optimized Markdown conversion. |
maxConcurrency |
(auto) | Max concurrent rendering slots (auto: local 20, remote CDP 50, CLI 8). |
challengeWaitMs |
15000 |
Bounded wait (ms) for Cloudflare verification to clear naturally. |
challengeRetries |
1 |
Same-page retry attempts after challenge wait. |
License
MIT
fly233338/dsh-overleaf
chuspeeism/dashi-taskboard
ccch1mneyyy/working-activity
Aisland-SJL/dsh-worktable
zhoushoujianwork/easyeda-agent