dsh-webstack
提供SearXNG搜索与Scrapling网页抓取服务 适合需要为AI提供高质量网络搜索和网页内容提取能力的任务
同名包的其他仓库
安装
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:QuantumKuba/dsh-webstack说明文档
阅读完整 README ↗
Enterprise-Grade Web Search & Retrieval Plugin for DeepSeek Harness (ctx.web)
Overview
dsh-webstack is a high-performance web capability bundle for DeepSeek Harness, integrating SearXNG for metasearch discovery and Scrapling for multi-tier, anti-bot resilient content retrieval.
Engineered specifically for local reasoning models (such as Qwen 2.5/3.8 27B and DeepSeek R1/V3) operating within bounded context windows (32k–90k tokens), dsh-webstack delivers web autonomy without tool bloat, context pollution, or security vulnerabilities.
┌───────────────────────────────────────────────────────────┐
│ DeepSeek Harness Agent │
│ Local LLM (Qwen 3.8 27B / R1) │
└─────────────────────────────┬─────────────────────────────┘
│
Native Schema │ web_search / web_fetch
▼
┌───────────────────────────────────────────────────────────┐
│ Cordis ctx.web Runtime │
└──────────────┬────────────────────────────┬───────────────┘
│ │
Provider: searxng │ Provider: scrapling │
▼ ▼
┌──────────────────────────┐ ┌───────────────────────────────┐
│ SearxngSearchProvider │ │ ScraplingFetchProvider │
│ • Clean JSON Mapping │ │ • Pre-Flight DNS Validation │
│ • Engine Deduplication │ │ • Same-Origin Redirect Lock │
└────────────┬─────────────┘ └───────────────┬───────────────┘
│ │
▼ ▼
┌──────────────────────────┐ ┌───────────────────────────────┐
│ Local SearXNG Instance │ │ Scrapling Multi-Tier Engine │
│ Privacy-preserving meta │ │ T1: curl_cffi Impersonation │
│ aggregation (P95 1.7s) │ │ T2: Headless Playwright/DOM │
└──────────────────────────┘ │ T3: Stealth WAF & Turnstile │
└───────────────┬───────────────┘
│
▼
┌───────────────────────────────┐
│ Markdown Economizer (GFM) │
│ 73.1% token context savings │
└───────────────────────────────┘
Architecture & Production Guarantees
1. Zero Model-Facing Tool Bloat
The model interacts exclusively with the native DeepSeek Harness web_search and web_fetch schema. Advanced scraping parameters, stealth flags, and DNS checks remain entirely encapsulated inside the provider layer.
2. Multi-Tier Retrieval Pipeline (scrapling)
Content fetching automatically scales across three performance tiers based on target complexity:
| Tier | Engine / Technology | Latency (Mean) | Primary Target |
|---|---|---|---|
| Tier 1 (Default) | curl_cffi (Chrome TLS fingerprint) | 531ms | Documentation, GitHub, Wikipedia, blogs, REST endpoints |
| Tier 2 (Dynamic) | Playwright Headless Chrome | 2,088ms | Client-rendered JavaScript SPAs (React, Vue, Next.js) |
| Tier 3 (Stealth) | StealthyFetcher Anti-Bot Engine | 1,669ms | Cloudflare Turnstile, interstitials, anti-bot WAF challenges |
- Turnstile Solver: Automatic detection and click-coordinate humanization for interactive Cloudflare challenges.
- Fingerprint Camouflage: Chromium canvas noise injection, WebRTC IP leakage suppression, genuine WebGL contexts, Google Search referer spoofing, and tracker blocking (~3,500 domains).
3. Kernel-Grade SSRF & Safe-URL Shield
All fetch requests undergo pre-flight DNS address validation prior to connection dispatch:
- Private Subnet Denial: Immediately blocks loopback (
127.0.0.0/8,::1), RFC 1918 subnets, link-local / cloud metadata endpoints (169.254.169.254), and carrier-grade NAT (100.64.0.0/10). - Split-Horizon Protection: Hostnames resolving to mixed public/private addresses are rejected immediately.
- Strict Same-Origin Redirects: Redirects crossing origins or protocols are terminated with
WEB_REDIRECT_BLOCKED. - Zero-DNS Latency Penalty: Security checks complete in ** 📊 For complete per-query distributions, latency variance, and test setups, refer to the Benchmark Report.
Quick Start
1. Install Plugin
# In your DeepSeek Harness workspace:
pnpm add dsh-webstack
# or via npm
npm install dsh-webstack
2. Configure SearXNG & Scrapling
- SearXNG: Deploy via Docker Compose with JSON enabled on
http://127.0.0.1:8080(see SearXNG Setup Guide). - Scrapling: Install into a virtual environment with stealth extras (see Scrapling Setup Guide):
pip install "scrapling[stealth]" && playwright install chromium
3. Mount Cordis Patch Layer
Apply cordis.patch.yml to your DeepSeek Harness profile to connect ctx.web:
- id: web
config:
searchProvider: searxng
fetchProvider: scrapling
- insert:
- id: dsh-webstack
name: dsh-webstack
config:
searxng:
baseURL: http://127.0.0.1:8080
scrapling:
pythonBinary: python3
enableDynamicFallback: true
enableStealthFallback: true
Documentation & Guides
Comprehensive guides and technical documentation are available in the docs/ directory:
| Guide | Description |
|---|---|
| SearXNG Setup Guide | Official Docker Compose deployment, settings.yml tuning, secret key generation, and Valkey caching. |
| Scrapling Environment Setup | Python 3.11+ virtual environment setup, Playwright Chromium installation, and sidecar verification. |
| Configuration Reference | Complete Cordis patch layer, parameter catalog for SearXNG and Scrapling, and context bounds tuning. |
| Programmatic Usage Guide | Standalone Node.js & TypeScript usage of SearxngSearchProvider and ScraplingFetchProvider without Harness. |
| Troubleshooting & FAQ | Solutions for 403 Forbidden, 429 rate limiting, missing Python paths, Playwright binaries, and SSRF blocks. |
| Benchmark Report | Empirical latency distributions, context token reduction stats, and SSRF security test telemetry. |
Verification & Test Suite
The codebase maintains automated test coverage across search normalization, security filters, and live integration:
# Run the complete test suite (35 tests, 10 suites)
pnpm test
# Run focused test suites
pnpm test:security # SSRF validation, private IP blocking, redirect policies
pnpm test:searxng # Query parameter encoding, response normalization
pnpm test:cancellation # Signal cancellation, child process termination
pnpm test:integration # Live HTTP fetch, redirect enforcement, Cordis seam
# Run empirical benchmark suite
pnpm run benchmark
License
MIT © Kuba