@jayyuen66/dsh-scrapling 0.1.17 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client.js CHANGED
@@ -1,16 +1,16 @@
1
- // GENERATED by build-client.ts — edit src/client-entry.ts, then run `node build-client.ts`.
1
+ // GENERATED by build-client.mjs — edit src/client-entry.ts, then run `node build-client.mjs`.
2
2
  window.__ModuleLoader__.load({
3
3
  id: "@jayyuen66/dsh-scrapling",
4
4
  factory: (require) => {
5
- "use strict";
6
- var module = { exports: {} };
7
- var exports = module.exports;
8
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react"),t=require("@jayyuen66/dsh-plugin-shared/client"),n=require("zod");const r=[{id:`runtime`,title:{zh:`解释器与目录`,en:`Interpreter & data`},note:{zh:`Python 与数据目录。装完 scrapling 之后这里一般不用动。`,en:`Python and the data directory. Usually untouched once scrapling is installed.`},fields:[{key:`pythonBin`,kind:`text`,label:{zh:`Python 解释器`,en:`Python interpreter`},hint:{zh:`留空:按「托管 runtime(macOS arm64,装过才用)→ 仓内 _env/.venv(装了才用)→ PATH 上的 python3(Windows 上是 python)」依次探测,卡面上的「运行环境」会显示命中的是哪一档;装了 pyenv/conda 时填绝对路径。`,en:`Empty: probed in order — managed runtime (macOS arm64, only once installed), the repo's _env/.venv when it exists, then python3 from PATH (python on Windows); the Runtime row shows which one won. Give an absolute path under pyenv/conda.`},fallback:``},{key:`failFastOnMissingPython`,kind:`boolean`,label:{zh:`Python 缺失时拒绝加载`,en:`Fail fast without Python`},hint:{zh:`开:Python 起不来就不注册任何工具并报错。关:只警告,工具全部消失。`,en:`On: register nothing and error out. Off: warn and register nothing.`},fallback:!0},{key:`dataDir`,kind:`text`,label:{zh:`数据目录`,en:`Data directory`},hint:{zh:`留空用 ~/.dsh-scrapling;选择器自愈的指纹库落在这里,需要可写。`,en:`Leave empty for ~/.dsh-scrapling; the adaptive selector store lives here and must be writable.`},fallback:``}]},{id:`tools`,title:{zh:`工具开关`,en:`Tools`},note:{zh:`关掉的工具不会注册给模型,也不会在会话提示里占位置。`,en:`A disabled tool is never registered with the model and leaves the system prompt too.`},fields:[{key:`fetchEnabled`,kind:`boolean`,label:{zh:`scrapling_fetch`,en:`scrapling_fetch`},hint:{zh:`curl_cffi 静态抓取。`,en:`Static fetching over curl_cffi.`},fallback:!0},{key:`extractEnabled`,kind:`boolean`,label:{zh:`scrapling_extract`,en:`scrapling_extract`},hint:{zh:`对给定 HTML 做选择器抽取,不发请求。`,en:`Extract from given HTML without any request.`},fallback:!0},{key:`locateEnabled`,kind:`boolean`,label:{zh:`scrapling_locate`,en:`scrapling_locate`},hint:{zh:`按文本、正则或相似元素定位,返回可复用的选择器。`,en:`Locate by text, regex, or similar elements and return reusable selectors.`},fallback:!0},{key:`linksEnabled`,kind:`boolean`,label:{zh:`scrapling_links`,en:`scrapling_links`},hint:{zh:`列出页面链接与下一页候选。`,en:`List page links and next-page candidates.`},fallback:!0},{key:`renderEnabled`,kind:`boolean`,label:{zh:`scrapling_render`,en:`scrapling_render`},hint:{zh:`Playwright 渲染,能读 SPA。`,en:`Playwright rendering; reads SPAs.`},fallback:!0},{key:`captureXhrEnabled`,kind:`boolean`,label:{zh:`scrapling_capture_xhr`,en:`scrapling_capture_xhr`},hint:{zh:`只回传 XHR 的 URL/状态/字节数;站点数据在接口里时用它找那个接口。`,en:`Returns XHR url/status/bytes only — use it to locate the JSON endpoint.`},fallback:!0},{key:`networkEnabled`,kind:`boolean`,label:{zh:`scrapling_session_network`,en:`scrapling_session_network`},hint:{zh:`读已开会话攒下的网络历史;会话需先用 recordNetwork 打开记录。`,en:`Read a session's recorded network history; the session must have recordNetwork on.`},fallback:!0},{key:`sessionEnabled`,kind:`boolean`,label:{zh:`scrapling_session_*`,en:`scrapling_session_*`},hint:{zh:`跨请求复用 cookie 与浏览器实例,只管 open / fetch / list / close 这一组;network 与 state_* 各自有独立开关。`,en:`Reuse cookies and the browser across requests; covers open / fetch / list / close only. The network and state_* groups have their own switches.`},fallback:!0},{key:`sessionStateEnabled`,kind:`boolean`,label:{zh:`scrapling_session_state_*`,en:`scrapling_session_state_*`},hint:{zh:`存/取浏览器登录态;需部署侧配好 sessionStateDir。`,en:`Save/load browser login state; needs a deployment-side sessionStateDir.`},fallback:!0},{key:`crawlEnabled`,kind:`boolean`,label:{zh:`scrapling_crawl`,en:`scrapling_crawl`},hint:{zh:`后台 Spider 作业,只守起始域;需 profile 带作业后端。`,en:`Background spider jobs confined to the start domain; needs a jobs backend.`},fallback:!0},{key:`answerEnabled`,kind:`boolean`,label:{zh:`scrapling_answer`,en:`scrapling_answer`},hint:{zh:`抓完页面交给模型问答。`,en:`Answer a question over a fetched page.`},fallback:!0},{key:`sessionReadEnabled`,kind:`boolean`,label:{zh:`scrapling_session_read`,en:`scrapling_session_read`},hint:{zh:`读浏览器会话当前页,不再发请求。`,en:`Read the current page of a browser session without another request.`},fallback:!0},{key:`sessionActionsEnabled`,kind:`boolean`,label:{zh:`scrapling_session_act`,en:`scrapling_session_act`},hint:{zh:`结构化浏览器动作;还要部署侧打开 allowBrowserActions。`,en:`Structured browser actions; the deployment must also set allowBrowserActions.`},fallback:!0},{key:`downloadEnabled`,kind:`boolean`,label:{zh:`scrapling_download`,en:`scrapling_download`},hint:{zh:`下载文件到插件目录;还要部署侧打开 allowFileDownloads。`,en:`Download files into the plugin directory; the deployment must also set allowFileDownloads.`},fallback:!0},{key:`documentsEnabled`,kind:`boolean`,label:{zh:`scrapling_read_document`,en:`scrapling_read_document`},hint:{zh:`读取 PDF 文本与页数;需要可选 documents 能力包(pypdf)。`,en:`Read PDF text and page counts; requires the optional documents pack (pypdf).`},fallback:!0},{key:`screenshotEnabled`,kind:`boolean`,label:{zh:`scrapling_screenshot`,en:`scrapling_screenshot`},hint:{zh:`页面截图;没有 attachment 服务时不注册。`,en:`Page screenshots; not registered when no attachment service is mounted.`},fallback:!0}]},{id:`output`,title:{zh:`抽取与输出`,en:`Extraction & output`},note:{zh:`这几个数字直接决定模型每轮看到多少 token。`,en:`These numbers are the per-call token bill the model pays.`},fields:[{key:`extractionType`,kind:`enum`,label:{zh:`默认抽取形态`,en:`Default extraction`},hint:{zh:`markdown 最省 token;html 保留标签;text 只留文字。`,en:`markdown is cheapest; html keeps tags; text keeps words only.`},fallback:`markdown`,options:[`markdown`,`html`,`text`]},{key:`mainContentOnly`,kind:`boolean`,label:{zh:`只保留正文`,en:`Main content only`},hint:{zh:`去掉导航、页脚、侧栏。开:更短更干净;关:要连同导航、按钮这类页面控件一起抓时用。`,en:`Drop nav/footer/sidebar. On for shorter output; off when you need page chrome.`},fallback:!0},{key:`fetchMaxOutputChars`,kind:`number`,label:{zh:`静态抓取正文上限`,en:`fetch output cap`},hint:{zh:`预算按 UTF-8 字节计,超出部分截断并标注;同一数值也作为 sidecar 的字符上限,最终取更紧的一档。`,en:`UTF-8 bytes; the payload is clipped and flagged. The same value also caps sidecar characters, so the tighter limit wins.`},fallback:2e5},{key:`extractMaxOutputChars`,kind:`number`,label:{zh:`抽取结果上限`,en:`extract output cap`},hint:{zh:`预算按 UTF-8 字节计;同一数值也作为 sidecar 的字符上限。`,en:`UTF-8 bytes; the same value also caps sidecar characters.`},fallback:2e5},{key:`renderMaxOutputChars`,kind:`number`,label:{zh:`渲染结果上限`,en:`render output cap`},hint:{zh:`预算按 UTF-8 字节计;会话类工具共用这一档,同一数值也作为 sidecar 的字符上限。`,en:`UTF-8 bytes; the session tools share this budget, and the same value also caps sidecar characters.`},fallback:2e5},{key:`documentMaxOutputChars`,kind:`number`,label:{zh:`PDF 正文字符上限`,en:`PDF text cap`},hint:{zh:`scrapling_read_document 的输出上限;模型只能用更小的值。`,en:`Output cap for scrapling_read_document; the model may only lower it.`},fallback:2e5},{key:`xhrMaxOutputChars`,kind:`number`,label:{zh:`XHR 快照上限`,en:`XHR snapshot cap`},hint:{zh:`预算按 UTF-8 字节计;同一数值也作为 sidecar 的字符上限。`,en:`UTF-8 bytes; the same value also caps sidecar characters.`},fallback:12e4},{key:`crawlMaxItems`,kind:`number`,label:{zh:`爬虫默认页数上限`,en:`Crawl page cap`},hint:{zh:`爬虫工具每次调用的默认上限,模型可按次调小。`,en:`Default per-call page cap; the model may lower it per call.`},fallback:1e3},{key:`stripInlineImages`,kind:`boolean`,label:{zh:`剥掉内嵌 base64 图片`,en:`Strip inline base64 images`},hint:{zh:`默认开。内嵌 data: URI 图片对模型是纯 token 噪音——模型从 base64 里读不出任何图形信息,只留 alt 文本;代码围栏内的原样保留。没有内联图的页面不受影响。要从 base64 里取配色或指纹这类原始数据时才关掉。`,en:`On by default. Inline data: URI images are pure token noise - the model cannot read a shape out of base64, so only the alt text is kept; ones inside code fences are left alone. Pages without inline images are unaffected. Turn it off to read the raw base64 (colours, fingerprints).`},fallback:!0}]},{id:`browser`,title:{zh:`浏览器行为`,en:`Browser behaviour`},note:{zh:`影响所有走浏览器的路径:渲染、XHR 快照与会话类工具。会话里「无头运行」与「拦广告」在开场时定死,中途改不了;其余几档每次抓取各自生效。`,en:`Affects every browser path: render, XHR capture and the session tools. Inside a session, Headless and Block ads are fixed at open; the rest apply per fetch.`},fields:[{key:`headless`,kind:`boolean`,label:{zh:`无头运行`,en:`Headless`},hint:{zh:`关掉会弹出浏览器窗口,反检测站点上成功率更高。`,en:`Off shows a window and beats more anti-bot checks.`},fallback:!0},{key:`networkIdle`,kind:`boolean`,label:{zh:`等网络静默`,en:`Wait for network idle`},hint:{zh:`等到没有在途请求再返回。更准,但慢;埋了长连接的站点可能一直等不到。`,en:`Wait until no requests are in flight. Slower, and pages with long-lived sockets never settle.`},fallback:!1},{key:`blockAds`,kind:`boolean`,label:{zh:`拦截广告与追踪`,en:`Block ads and trackers`},hint:{zh:`约 3500 个已知广告域。省流量,偶尔误伤。`,en:`~3,500 known ad domains. Saves bandwidth, occasionally over-blocks.`},fallback:!0},{key:`pierceShadow`,kind:`boolean`,label:{zh:`穿透 Shadow DOM`,en:`Pierce Shadow DOM`},hint:{zh:`把 open shadow root 里的内容并进正文,默认关;页面把正文封进 shadow DOM 时才打开。`,en:`Merge open shadow root content into the body; off by default. On when a page hides its content in shadow DOM.`},fallback:!1},{key:`waitSelectorState`,kind:`enum`,label:{zh:`等待选择器的状态`,en:`Wait selector state`},hint:{zh:`配 waitSelector 用;attached 最宽松。`,en:`Used with waitSelector; attached is the loosest.`},fallback:`attached`,options:[`attached`,`detached`,`hidden`,`visible`]}]},{id:`timeouts`,title:{zh:`超时与回收`,en:`Timeouts & teardown`},note:{zh:`抓取慢若不在这几项里,先看页面上要等的东西。`,en:`If a fetch is slow for a reason other than these, look at what the page waits for.`},fields:[{key:`fetchTimeoutMs`,kind:`number`,label:{zh:`单次抓取超时(毫秒)`,en:`Per-fetch timeout (ms)`},hint:{zh:`是工具调用与 sidecar 那一帧的超时预算,也当作浏览器页面的等待预算发下去。静态路径每次请求的秒数上限另有其数:部署配置里的 requestTimeoutSeconds(默认 120,这张卡上没有这一项),模型也能按次用 timeoutSeconds 调小。`,en:`The budget for the tool call and for one sidecar frame, and the wait budget sent for browser pages. Static requests have their own cap: requestTimeoutSeconds in the deployment config (120 by default; not a field on this card), which the model can also lower per call with timeoutSeconds.`},fallback:12e4},{key:`sidecarHandshakeTimeoutMs`,kind:`number`,label:{zh:`sidecar 握手超时(毫秒)`,en:`Handshake timeout (ms)`},hint:{zh:`冷启动要拉起一个 Python 进程并导入 Scrapling。`,en:`Cold start spawns a Python process and imports Scrapling.`},fallback:3e4},{key:`sidecarGraceMs`,kind:`number`,label:{zh:`退出宽限(毫秒)`,en:`Shutdown grace (ms)`},hint:{zh:`插件卸载后等 Python 收尾的时间。`,en:`How long Python gets to finish after the plugin unloads.`},fallback:5e3}]},{id:`network`,title:{zh:`网络与安全`,en:`Network & safety`},note:{zh:`通常什么都不用填:TUN 模式的代理由系统接管,环境里的 HTTPS_PROXY 与 macOS / Windows 的「系统代理」都会被自动接上。`,en:`Usually nothing to fill: a TUN-mode proxy is taken from the system, and both HTTPS_PROXY in the environment and the macOS / Windows system proxy are picked up automatically.`},fields:[{key:`proxyUrl`,kind:`text`,format:`url`,schemes:[`http:`,`https:`,`socks5:`,`socks5h:`],secret:!0,label:{zh:`代理地址`,en:`Proxy URL`},hint:{zh:`如 http://127.0.0.1:7890 或 socks5://127.0.0.1:7890,可带 user:pass@。留空=依次跟随环境变量与系统代理设置;填了就压过那两者。值按密码遮罩显示,点「显示」可查看。`,en:`e.g. http://127.0.0.1:7890 or socks5://127.0.0.1:7890, user:pass@ allowed. Empty follows the environment and then the OS proxy settings; setting it outranks both. Masked like a password; press Show to reveal it.`},fallback:``},{key:`proxyBypass`,kind:`text`,label:{zh:`代理绕过清单`,en:`Proxy bypass`},hint:{zh:`逗号分隔的主机名,命中即直连;内网站点要填。整台机器直连填 *。浏览器会话不逐条生效(它的代理在开场时定死)。`,en:`Comma-separated hostnames that connect directly; list your internal sites. Use * for the whole machine. Not applied per URL inside a browser session (its proxy is fixed at open).`},fallback:``},{key:`syntheticDnsRanges`,kind:`text`,label:{zh:`合成 DNS 段(兜底)`,en:`Synthetic DNS ranges (fallback)`},hint:{zh:`平时留空:fake-ip 型代理由系统自动认出,这里只用于识别失灵时。列进来的段等于放弃对它们的 SSRF 防护。`,en:`Leave empty: fake-ip resolvers are detected automatically. Only for detection failures. Listed ranges give up SSRF protection.`},fallback:``},{key:`allowedHosts`,kind:`text`,label:{zh:`额外放行的内网主机`,en:`Extra allowed hosts`},hint:{zh:`逗号分隔。指到内网等于主动放弃对那些目标的 SSRF 防护,只在真要抓自建站点时填。`,en:`Comma-separated. Pointing these at internal hosts gives up SSRF protection for them — only for self-hosted targets.`},fallback:``},{key:`nat64Prefixes`,kind:`text`,label:{zh:`额外 NAT64 前缀`,en:`Extra NAT64 prefixes`},hint:{zh:`用运营商自建 NAT64 的网络才需要,形如 2001:4860:4860::/96。`,en:`Only for carrier-grade NAT64 networks, e.g. 2001:4860:4860::/96.`},fallback:``},{key:`provideWebFetch`,kind:`boolean`,label:{zh:`接管内置 web_fetch`,en:`Provide the built-in web_fetch`},hint:{zh:`默认开;部署配置里仍要写 fetchProvider: "scrapling",否则 base bundle 那条 fetchProvider: http 仍然赢。`,en:`On by default; the deployment config still needs fetchProvider: "scrapling", otherwise the base bundle's fetchProvider: http wins.`},fallback:!0},{key:`provideWebSearch`,kind:`boolean`,label:{zh:`接管内置 web_search`,en:`Provide the built-in web_search`},hint:{zh:`默认开;部署配置里仍要写 searchProvider: "scrapling",否则不会接管。`,en:`On by default; the deployment config still needs searchProvider: "scrapling", otherwise it does not take over.`},fallback:!0},{key:`webFetchStrategy`,kind:`enum`,options:[`static`,`auto`,`browser`],label:{zh:`网页正文抓取策略`,en:`Web content fetch strategy`},hint:{zh:`auto:先静态抓取,正文少于 200 字符时再尝试浏览器渲染;static 只静态抓取;browser 直接渲染。没有浏览器时 auto 保持静态抓取。`,en:`auto: fetch statically first and render only when the body is under 200 characters; static never renders; browser renders directly. Without a browser, auto stays static.`},fallback:`auto`},{key:`searchMaxOutputBytes`,kind:`number`,label:{zh:`搜索正文总预算(字节)`,en:`Search total body budget (bytes)`},hint:{zh:`一次搜索中所有正文小节的 UTF-8 字节总上限;默认 24000。调大更完整,也直接增加模型上下文与 token 成本。`,en:`UTF-8 byte cap across all body sections in one search; defaults to 24000. Larger values keep more text but increase model context and token cost.`},fallback:24e3},{key:`searchBackend`,kind:`enum`,options:[`auto`,`tavily`,`bing`,`brave`,`serper`,`duckduckgo`,`searxng`,`deepseek`],label:{zh:`搜索发现后端`,en:`Search discovery backend`},hint:{zh:`auto 有 Tavily key 走 Tavily、配了 SearXNG 走 SearXNG;两者都没有时,只有打开「允许公共搜索回退」才走公共 Bing —— auto 不会挑 DuckDuckGo,那档只能显式选。只有 Tavily 与 Bing 打过真实端点;其余四条按文档形状实现,真实 key 未验。`,en:`auto uses Tavily when a key is set and SearXNG when an instance is configured; with neither, only "Allow public search fallback" routes to public Bing — auto never picks DuckDuckGo, that backend has to be selected explicitly. Only Tavily and Bing have been run against the real endpoints; the other four follow their documented shapes and are unverified with real keys.`},fallback:`auto`},{key:`searchPublicFallback`,kind:`boolean`,label:{zh:`允许公共搜索回退`,en:`Allow public search fallback`},hint:{zh:`默认关。打开后 auto 后端在没配 key、也没配 SearXNG 时会回落到公共 Bing —— 查询词会发给公共引擎。`,en:`Off by default. When enabled, the auto backend falls back to public Bing if no API key or SearXNG is configured — queries are then sent to a public engine.`},fallback:!1},{key:`tavilyApiKey`,kind:`text`,secret:!0,label:{zh:`Tavily API key`,en:`Tavily API key`},hint:{zh:`Tavily 后端必填;没配时 search 报 SEARCH_AUTH,不会静默换后端。`,en:`Required by the Tavily backend; without it search reports SEARCH_AUTH instead of silently switching backends.`},fallback:``},{key:`braveApiKey`,kind:`text`,secret:!0,label:{zh:`Brave Search API key`,en:`Brave Search API key`},hint:{zh:`Brave 后端必填;没配时 search 报 SEARCH_AUTH。`,en:`Required by the Brave backend; without it search reports SEARCH_AUTH.`},fallback:``},{key:`serperApiKey`,kind:`text`,secret:!0,label:{zh:`Serper API key`,en:`Serper API key`},hint:{zh:`Serper 后端必填;没配时 search 报 SEARCH_AUTH。`,en:`Required by the Serper backend; without it search reports SEARCH_AUTH.`},fallback:``},{key:`searxngEndpoint`,kind:`text`,format:`url`,schemes:[`http:`,`https:`],secret:!0,label:{zh:`SearXNG 实例地址`,en:`SearXNG instance URL`},hint:{zh:`SearXNG 后端必填,例如 https://searx.example.com;会拼上 /search?format=json。留空表示这条后端不可用。值按密码遮罩显示,点「显示」可查看。`,en:`Required by the SearXNG backend, e.g. https://searx.example.com; /search?format=json is appended. Empty means the backend is unusable. Masked like a password; press Show to reveal it.`},fallback:``}]},{id:`answer`,title:{zh:`页面问答`,en:`Page Q&A`},note:{zh:`provider 与 model 留空跟随当前会话用的模型,不额外烧一份额度;token 上限留空用默认值。`,en:`provider and model blank follow the session's own model, costing no extra quota; the token cap falls back to its default.`},fields:[{key:`answerProvider`,kind:`text`,label:{zh:`回答用 provider`,en:`Answer provider`},hint:{zh:`留空跟随会话模型。`,en:`Blank follows the session model.`},fallback:``},{key:`answerModel`,kind:`text`,label:{zh:`回答用模型 id`,en:`Answer model id`},hint:{zh:`与 provider 一起生效。`,en:`Takes effect together with the provider.`},fallback:``},{key:`answerMaxTokens`,kind:`number`,label:{zh:`单次回答 token 上限`,en:`Answer token cap`},hint:{zh:`一次回答的输出预算。`,en:`Output budget per answer.`},fallback:2e3}]}],i=r.flatMap(e=>e.fields);i.map(e=>e.key);const a=`dshScrapling`,o={zh:{navLabel:`scrapling 抓取`,save:`保存`,saving:`保存中…`,undo:`撤销`,reveal:`显示`,conceal:`隐藏`,statusLoading:`正在读取设置…`,statusReadonly:`这个连接以只读方式运行,设置改不了。`,statusClean:`没有未保存的改动`,statusChanged:`已改动 {count} 项,未保存`,statusInvalid:`有 {count} 项填得不合法,改好后才能保存`,rejected:`保存被宿主拒绝了,设置未改动。常见原因:这一条目的配置被部署 patch 或命令行 overlay 压制(此时写下的值会在下次启动被覆盖回,宿主因此拒绝),或值没有通过 schema 校验。`,stale:`设置已经被别处改过,请重新打开这张卡再保存`,failed:`保存失败:{reason}`,panelPacks:`就绪能力包`,panelPython:`解释器`,runtimeTitle:`运行环境`,runtimeHint:`能力包装在数据目录的 runtime/ 下;安装是后台作业,关掉这张卡也会继续。`,runtimeCommandLabel:`终端命令`,copy:`复制`,copied:`已复制`,runtimeUnavailable:`宿主没有提供远程读面;请在终端运行:`,runtimeJobsMissing:`这个 profile 没有作业后端;请在终端运行:`,runtimeInstall:`安装`,runtimeRepair:`修复`,runtimeCancel:`取消`,runtimePython:`解释器`,runtimeDataDir:`数据目录`,"runtime.via.configured":`部署配置指定`,"runtime.via.managed-venv":`托管环境(已装依赖)`,"runtime.via.managed":`托管 Python(未装依赖)`,"runtime.via.repo":`仓内 venv`,"runtime.via.path":`PATH 上的 python3`,runtimeJobRunning:`正在安装 {pack}…`,runtimeJobEnded:`安装结束:{status}`,"runtime.job.completed":`已完成`,"runtime.job.killed":`已取消`,"runtime.job.failed":`失败`,"runtime.job.stopping":`停止中`,"runtime.job.running":`进行中`,runtimeError:`安装失败:{reason}`,runtimeReadFailed:`状态读取失败:{reason}`,"runtime.state.ready":`就绪`,"runtime.state.missing":`未安装`,"runtime.state.corrupt":`文件缺失`,"runtime.state.installing":`安装中`,"runtime.state.blocked":`暂不提供`,"runtime.pack.core":`核心(Python + Scrapling)`,"runtime.pack.browser":`完整 Chromium`,"runtime.pack.search":`搜索发现`,"runtime.pack.media":`截图与下载`,"runtime.pack.documents":`PDF 阅读(pypdf)`,"runtime.pack.adaptive-redis":`自适应存储(Redis)`,"runtime.pack.mcp":`MCP(未验证)`},en:{navLabel:`scrapling fetch`,save:`Save`,saving:`Saving…`,undo:`Undo`,reveal:`Show`,conceal:`Hide`,statusLoading:`Reading settings…`,statusReadonly:`This connection runs read-only; settings cannot be changed here.`,statusClean:`No unsaved changes`,statusChanged:`{count} change(s) not saved yet`,statusInvalid:`{count} field(s) are not valid; fix them to save`,rejected:`The host refused the save; nothing changed. Common causes: this entry's config is overridden by a deployment patch or command-line overlay (the host refuses because anything written here would be reverted on the next boot), or the value failed schema validation.`,stale:`Settings changed elsewhere; reopen this page before saving`,failed:`Save failed: {reason}`,panelPacks:`Ready packs`,panelPython:`Interpreter`,runtimeTitle:`Runtime`,runtimeHint:`Capability packs live under runtime/ in the data directory; installs run as background jobs and keep going when this page closes.`,runtimeCommandLabel:`Terminal command`,copy:`Copy`,copied:`Copied`,runtimeUnavailable:`The host offers no remote surface; run this in a terminal:`,runtimeJobsMissing:`This profile has no jobs backend; run this in a terminal:`,runtimeInstall:`Install`,runtimeRepair:`Repair`,runtimeCancel:`Cancel`,runtimePython:`Interpreter`,runtimeDataDir:`Data directory`,"runtime.via.configured":`Selected by deployment config`,"runtime.via.managed-venv":`Managed venv (dependencies installed)`,"runtime.via.managed":`Managed Python (dependencies missing)`,"runtime.via.repo":`Repository venv`,"runtime.via.path":`python3 from PATH`,runtimeJobRunning:`Installing {pack}…`,runtimeJobEnded:`Install finished: {status}`,"runtime.job.completed":`Completed`,"runtime.job.killed":`Cancelled`,"runtime.job.failed":`Failed`,"runtime.job.stopping":`Stopping`,"runtime.job.running":`Running`,runtimeError:`Install failed: {reason}`,runtimeReadFailed:`Status read failed: {reason}`,"runtime.state.ready":`Ready`,"runtime.state.missing":`Not installed`,"runtime.state.corrupt":`Files missing`,"runtime.state.installing":`Installing`,"runtime.state.blocked":`Unavailable`,"runtime.pack.core":`Core (Python + Scrapling)`,"runtime.pack.browser":`Full Chromium`,"runtime.pack.search":`Search discovery`,"runtime.pack.media":`Screenshots & downloads`,"runtime.pack.documents":`PDF reading (pypdf)`,"runtime.pack.adaptive-redis":`Adaptive storage (Redis)`,"runtime.pack.mcp":`MCP (unverified)`}},s={zh:{"row.url":`URL`,"row.http":`HTTP`,"row.body":`正文`,"row.matched":`匹配`,"row.sessionCount":`会话数`,"row.session":`会话`,"row.name":`名称`,"row.type":`类型`,"row.start":`起始`,"row.pageCap":`上限`,"row.job":`作业`,"row.inspect":`在轨迹里查看`,"row.truncated":`已截断`,"row.notTruncated":`否`},en:{"row.url":`URL`,"row.http":`HTTP`,"row.body":`Body`,"row.matched":`Matched`,"row.sessionCount":`Sessions`,"row.session":`Session`,"row.name":`Name`,"row.type":`Type`,"row.start":`Start`,"row.pageCap":`Page cap`,"row.job":`Job`,"row.inspect":`Inspect this call`,"row.truncated":`Truncated`,"row.notTruncated":`No`}};function c(){let e={zh:{...o.zh,...s.zh},en:{...o.en,...s.en}};for(let t of r){e.zh[`group.${t.id}.title`]=t.title.zh,e.zh[`group.${t.id}.note`]=t.note.zh,e.en[`group.${t.id}.title`]=t.title.en,e.en[`group.${t.id}.note`]=t.note.en;for(let n of t.fields)e.zh[`field.${n.key}.label`]=n.label.zh,e.zh[`field.${n.key}.hint`]=n.hint.zh,e.en[`field.${n.key}.label`]=n.label.en,e.en[`field.${n.key}.hint`]=n.hint.en}return e}const l=[`core`,`browser`,`search`,`media`,`documents`,`adaptive-redis`,`mcp`];new Set(l);const u=[`ready`,`missing`,`corrupt`,`installing`,`blocked`],d=[`running`,`stopping`,`completed`,`killed`,`failed`],f=[`configured`,`managed-venv`,`managed`,`repo`,`path`],p=[400,404,409,500,503];function m(e){return`runtime.state.${e}`}function h(e){return`runtime.pack.${e}`}function g(e){return`runtime.via.${e}`}const _={status:`loading`,writable:!1};function v(){return _}function y(){return()=>void 0}function b(e){return typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):``}function x(e,t,n,r={}){let i=r[e.key];if(i!==void 0)return i;let a=n[e.key];if(a!==void 0)return b(a);let o=t?.[e.key];return o===void 0?String(e.fallback):b(o)}const S=n.z.enum([`true`,`false`]),C=n.z.string().regex(/^[1-9]\d*$/u).transform(Number);function w(e,t){let r=n.z.url().safeParse(t);if(!r.success)return{kind:`invalid`};let i=e.schemes;return i!==void 0&&!i.includes(new URL(r.data).protocol)?{kind:`invalid`}:{kind:`value`,value:r.data}}function ee(e,t){if(e.kind===`boolean`){let e=S.safeParse(t);return e.success?{kind:`value`,value:e.data===`true`}:{kind:`invalid`}}let r=t.trim();if(r===``)return{kind:`clear`};if(e.kind===`number`){let e=C.safeParse(r);return e.success?{kind:`value`,value:e.data}:{kind:`invalid`}}if(e.kind===`enum`){let t=n.z.string().refine(t=>(e.options??[]).includes(t),{error:`取值不在字段选项内`}).safeParse(r);return t.success?{kind:`value`,value:t.data}:{kind:`invalid`}}return e.format===`url`?w(e,r):{kind:`value`,value:r}}function te(e){return i.filter(t=>Object.hasOwn(e,t.key)).filter(t=>e[t.key]!==void 0).map(t=>{let n=e[t.key];return n===null||n===t.fallback?{op:`unset`,path:[t.key]}:{op:`set`,path:[t.key],value:n}})}const T=`dsu-btn`,E=`dsu-hint`,D=`dsh-scrapling setup --feature <pack> --apply`,ne={completed:`runtime.job.completed`,killed:`runtime.job.killed`,failed:`runtime.job.failed`,stopping:`runtime.job.stopping`,running:`runtime.job.running`};function re(e){if(typeof e!=`object`||!e)return!1;let t=Reflect.get(e,`head`);return typeof Reflect.get(e,`querySelector`)==`function`&&typeof Reflect.get(e,`createElement`)==`function`&&typeof t==`object`&&!!t&&typeof Reflect.get(t,`append`)==`function`}function ie(){let e=Reflect.get(globalThis,`document`);return re(e)?e:void 0}function ae(e,t,n){if(e.querySelector(`#${t}`)!=null)return()=>void 0;let r=e.createElement(`style`);return r.id=t,r.textContent=n,e.head.append(r),()=>{r.remove()}}function oe(e){return(0,t.ensureCardUiCss)(e)}function se(n){let{field:r,t:i,shown:a,invalidText:o,disabled:s,revealToken:c,onChange:l}=n,u=i(`field.${r.key}.label`),d=(0,t.splitHint)(i(`field.${r.key}.hint`)),f={label:u,...d,field:r.key,disabled:s,...o===void 0?{}:{invalidText:o}},p=`scrapling-${r.key}`;if(r.kind===`boolean`)return(0,e.createElement)(t.ToggleField,{...f,checked:a===`true`,onChange:e=>{l(String(e))}});if(r.kind===`enum`)return(0,e.createElement)(t.SelectField,{...f,value:a,options:(r.options??[]).map(e=>({value:e,label:e})),onChange:l});if(r.secret===!0)return(0,e.createElement)(t.SecretField,{...f,value:a,revealToken:c,onChange:l});if(r.kind===`number`){let n=[d.detail===void 0?void 0:`${p}-hint`,o===void 0?void 0:`${p}-err`].filter(e=>e!==void 0).join(` `);return(0,e.createElement)(t.Field,{...f,controlId:p},(0,e.createElement)(`input`,{id:p,type:`text`,inputMode:`numeric`,className:`dsu-input`,value:a,disabled:s,"data-field":r.key,"aria-describedby":n.length===0?void 0:n,"aria-invalid":o!==void 0||void 0,"aria-errormessage":o===void 0?void 0:`${p}-err`,onChange:e=>{l(e.target.value)}}))}return(0,e.createElement)(t.TextField,{...f,value:a,onChange:l})}function ce(n){let{group:r,t:i,shown:a,invalidText:o,disabled:s,revealToken:c,onChange:l}=n,u=r.fields.filter(e=>e.kind===`boolean`),d=r.fields.map(t=>(0,e.createElement)(se,{key:t.key,field:t,t:i,shown:a(t),invalidText:o(t),disabled:s,revealToken:c,onChange:e=>{l(t,e)}})),f=u.length>=2&&u.length===r.fields.length?(0,e.createElement)(t.ToggleGrid,null,r.fields.map(n=>{let r=o(n);return(0,e.createElement)(t.ToggleCell,{key:n.key,label:i(`field.${n.key}.label`),...(0,t.splitHint)(i(`field.${n.key}.hint`)),field:n.key,disabled:s,checked:a(n)===`true`,...r===void 0?{}:{invalidText:r},onChange:e=>{l(n,String(e))}})})):d;return(0,e.createElement)(t.Section,{title:i(`group.${r.id}.title`),hint:i(`group.${r.id}.note`)},f)}function le(e,t,n){let r=n?.[e.key],i=r===void 0?String(e.fallback):b(r);return b(t)===i}const O={values:{},baseRevision:void 0,invalid:[],invalidText:{}};function ue(e,t){let n={...e.values};for(let e of t){let[t]=e.path;Reflect.deleteProperty(n,t)}return Object.keys(n).length===0?O:{...e,values:n,baseRevision:void 0}}function de(n){let{t:r,saving:i,editable:a,changed:o,invalid:s,onSave:c,onUndo:l}=n;return(0,e.createElement)(t.SaveBar,{dirty:o>0,blocked:s>0,busy:i,writable:a,error:s>0?r(`statusInvalid`,{count:s}):null,saveLabel:r(`save`),savingLabel:r(`saving`),revertLabel:r(`undo`),dirtyLabel:r(`statusChanged`,{count:o}),cleanLabel:r(`statusClean`),readOnlyLabel:r(`statusReadonly`),onSave:c,onDiscard:l})}function fe(t){let[n,r]=(0,e.useState)(null),[i,a]=(0,e.useState)(``),[o,s]=(0,e.useState)(``),[c,l]=(0,e.useState)(``),u=(0,e.useRef)(0),d=(0,e.useCallback)(async()=>{if(t===void 0)return;u.current+=1;let e=u.current;try{let n=await t.status();if(e!==u.current)return;r(n),l(``)}catch(t){if(e!==u.current)return;l(String(t))}},[t]),f=n?.job?.status===`running`||n?.job?.status===`stopping`;return(0,e.useEffect)(()=>{t!==void 0&&d()},[t,d]),(0,e.useEffect)(()=>{let e;return t!==void 0&&f&&(e=setInterval(()=>{d()},2e3)),()=>{e!==void 0&&clearInterval(e)}},[t,f,d]),{snapshot:n,busy:i,failure:o,readFailure:c,act:(0,e.useCallback)((e,n)=>{t!==void 0&&(a(e),s(``),(async()=>{try{let r=n===`repair`?await t.repair(e):await t.install(e);r.ok?await d():s(r.error)}catch(e){s(String(e))}finally{a(``)}})())},[t,d]),cancel:(0,e.useCallback)(()=>{let e=n?.job;t!==void 0&&e!=null&&(a(`cancel`),s(``),(async()=>{try{let n=await t.cancel(e.id);n.ok?await d():s(n.error)}catch(e){s(String(e))}finally{a(``)}})())},[t,d,n])}}const pe={ready:`ok`,missing:`mute`,corrupt:`err`,installing:`warn`,blocked:`mute`};function me(e){return e===null?`mute`:pe[e]}const he={configured:`ok`,"managed-venv":`ok`,managed:`warn`,repo:`ok`,path:`ok`};function ge(e){return he[e]}const _e={running:`warn`,stopping:`warn`,completed:`ok`,killed:`mute`,failed:`err`};function ve(e){return _e[e]}function k(n,r,i){return(0,e.createElement)(`div`,{className:`dsu-inlineRow`,"data-field":i},(0,e.createElement)(t.StatusDot,{tone:n}),r)}function ye(t,n){let r=t(g(n.python.via)),i=`${t(`runtimePython`)}: ${n.python.path} (${r})`,a=`${t(`runtimeDataDir`)}: ${n.dataDir}`;return k(ge(n.python.via),(0,e.createElement)(`p`,{className:E},i,(0,e.createElement)(`br`),a),`runtime-python`)}function be(t,n,r){let i=t(h(n.pack)),a=t(ne[n.status]),o=r?t(`runtimeJobRunning`,{pack:i}):t(`runtimeJobEnded`,{status:a});return k(ve(n.status),(0,e.createElement)(`p`,{className:E},o),`runtime-job`)}function xe(t){let{pack:n,state:r,t:i,disabled:a,running:o,activePack:s,onAct:c,onCancel:l}=t,u=i(r===null?`statusLoading`:m(r)),d=i(h(n)),f=k(me(r),(0,e.createElement)(`p`,{className:E},u),`runtime-pack-${n}`),p=a||o||r===null||r===`blocked`||r===`installing`,g=[(0,e.createElement)(`button`,{type:`button`,className:T,key:`install`,"aria-label":`${d} · ${i(`runtimeInstall`)}`,disabled:p||r===`ready`,onClick:()=>{c(n,`install`)}},i(`runtimeInstall`)),(0,e.createElement)(`button`,{type:`button`,className:T,key:`repair`,"aria-label":`${d} · ${i(`runtimeRepair`)}`,disabled:p||r===`missing`,onClick:()=>{c(n,`repair`)}},i(`runtimeRepair`))];return o&&s===n&&g.push((0,e.createElement)(`button`,{type:`button`,className:T,key:`cancel`,"aria-label":`${d} · ${i(`runtimeCancel`)}`,disabled:a,onClick:l},i(`runtimeCancel`))),(0,e.createElement)(`div`,{className:`dsu-field dsu-fieldRow`,key:n},(0,e.createElement)(`div`,{className:`dsu-fieldMeta`},(0,e.createElement)(`div`,{className:`dsu-label`},d),f),(0,e.createElement)(`div`,{className:`dsu-control`},(0,e.createElement)(`div`,{className:`dsu-actions`},...g)))}function Se(n){let{reader:r,t:i,snapshot:a,busy:o,failure:s,readFailure:c,onAct:u,onCancel:d}=n,f=(0,e.createElement)(t.LogPanel,{label:i(`runtimeCommandLabel`),copyText:D,copyLabel:i(`copy`),copiedLabel:i(`copied`)},D),p=c===``?null:(0,e.createElement)(`div`,{role:`alert`,"aria-live":`assertive`},(0,e.createElement)(t.Callout,{tone:`err`,field:`runtime-read-failure`},i(`runtimeReadFailed`,{reason:c}))),m=s===``?null:(0,e.createElement)(`div`,{role:`alert`,"aria-live":`assertive`},(0,e.createElement)(t.Callout,{tone:`err`,field:`runtime-failure`},i(`runtimeError`,{reason:s})));if(r===void 0)return(0,e.createElement)(t.Section,{title:i(`runtimeTitle`),hint:i(`runtimeHint`)},(0,e.createElement)(`p`,{className:E},i(`runtimeUnavailable`)),f);let h=a?.jobsReady??!1,g=a?.job??null,_=g!==null&&(g.status===`running`||g.status===`stopping`),v=a===null?null:ye(i,a),y=g===null?null:be(i,g,_),b=g===null||g.output===``?null:(0,e.createElement)(t.LogPanel,{semanticLines:!0},g.output),x=o!==``||!h||a===null,S=l.map(e=>xe({pack:e,state:a===null?null:a.packs[e]??`missing`,t:i,disabled:x,running:_,activePack:g?.pack??null,onAct:u,onCancel:d})),C=i(`runtimeJobsMissing`),w=a!==null&&!h?(0,e.createElement)(`div`,null,k(`warn`,(0,e.createElement)(`p`,{className:E},C),`runtime-jobs`),f):null;return(0,e.createElement)(t.Section,{title:i(`runtimeTitle`),hint:i(`runtimeHint`)},v,p,m,y,b,(0,e.createElement)(`div`,{className:`dsu-stack`},...S),w)}async function Ce(e){let{form:t,draft:n,ops:r,state:i,t:a,setDraft:o,setFailure:s,setSaving:c}=e;c(!0),s(``);try{await t.mutate(r,n.baseRevision)?o(e=>ue(e,r)):s(n.baseRevision!==void 0&&n.baseRevision!==i.revision?a(`stale`):a(`rejected`))}catch(e){s(a(`failed`,{reason:String(e)}))}finally{c(!1)}}function A(n){let{form:i,t:a}=n,[o,s]=(0,e.useState)(O),[c,l]=(0,e.useState)(``),[u,d]=(0,e.useState)(!1),[f,p]=(0,e.useState)(0),m=(0,e.useSyncExternalStore)(i===void 0?y:i.subscribe,i===void 0?v:i.getSnapshot),h=fe(n.runtime);if(n.view!==`page`||i===void 0)return(0,e.createElement)(t.CardForm,null);let g=m.writable&&m.status===`ready`,_=te(o.values),b=async()=>{o.invalid.length>0||_.length===0||await Ce({form:i,draft:o,ops:_,state:m,t:a,setDraft:s,setFailure:l,setSaving:d})},S=(e,t)=>{l(``);let n=ee(e,t);s(r=>{let i={...r.values},a={...r.invalidText},o=r.invalid.filter(t=>t!==e.key),s=r.baseRevision??m.revision;if(n.kind===`invalid`)return Reflect.deleteProperty(i,e.key),a[e.key]=t,{values:i,baseRevision:s,invalid:[...o,e.key],invalidText:a};Reflect.deleteProperty(a,e.key);let c=n.kind===`clear`?null:n.value;return le(e,c,m.value)?Reflect.deleteProperty(i,e.key):i[e.key]=c,Object.keys(i).length===0&&o.length===0?O:{values:i,baseRevision:s,invalid:o,invalidText:a}})},C=r.map(t=>(0,e.createElement)(ce,{key:t.id,group:t,t:a,shown:e=>x(e,m.value,o.values,o.invalidText),invalidText:e=>o.invalidText[e.key],disabled:!g||u,revealToken:f,onChange:S})),w=de({t:a,saving:u,editable:g,changed:_.length,invalid:o.invalid.length,onSave:()=>{b()},onUndo:()=>{s(O),p(e=>e+1),l(``)}}),T=c===``?null:(0,e.createElement)(`div`,{role:`alert`,"aria-live":`assertive`},(0,e.createElement)(t.Callout,{tone:`err`,field:`save-error`},c));return(0,e.createElement)(t.CardForm,null,T,...C,Se({reader:n.runtime,t:a,snapshot:h.snapshot,busy:h.busy,failure:h.failure,readFailure:h.readFailure,onAct:h.act,onCancel:h.cancel}),w)}function we(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const Te=e=>we(e)&&typeof e.$mount==`function`,j=`@jayyuen66/dsh-scrapling`;function M(e,t){return e[t]}const N=`scraplingRuntime`,P=`remote.${N}`;function F(e,t){let r=e.safeParse(t);if(!r.success)throw TypeError(n.z.prettifyError(r.error));return r.data}const I=`runtime request requires a known pack`,Ee=n.z.object({pack:n.z.enum(l,{error:I})},{error:I}),L=`runtime cancel requires a jobId`,De=n.z.object({jobId:n.z.string({error:L}).trim().min(1,{error:L})},{error:L}),R={mode:`strict`,typeSymbol:`${j}#runtime-pack-request`,create:()=>({parse(e){return F(Ee,e)}})},Oe={mode:`strict`,typeSymbol:`${j}#runtime-cancel-request`,create:()=>({parse(e){return F(De,e)}})},ke=n.z.enum(u),Ae=n.z.enum(d),z=n.z.enum(l),je=n.z.object({id:n.z.string(),pack:z,status:Ae,output:n.z.string()}),Me=n.z.object({ok:n.z.literal(!0),packs:n.z.partialRecord(z,ke),python:n.z.object({path:n.z.string(),via:n.z.enum(f),version:n.z.string()}),dataDir:n.z.string(),jobsReady:n.z.boolean(),job:je.nullable()}),Ne=n.z.literal(p),B=n.z.discriminatedUnion(`ok`,[n.z.object({ok:n.z.literal(!0),jobId:n.z.string()}),n.z.object({ok:n.z.literal(!1),error:n.z.string(),status:Ne})]);function V(e,t){return{id:`${j}#${N}/${e}`,service:N,namespace:N,method:e,invocation:{kind:`direct`},parameters:t,result:{mode:`src-json`}}}function Pe(e){return[{name:`request`,wire:`request`,source:`json`,codec:e}]}function H(e,t){return V(e,Pe(t))}const Fe=[V(`status`,[]),H(`installPack`,R),H(`repairPack`,R),H(`cancelJob`,Oe)];function Ie(e){return(0,t.isRecord)(e)?typeof M(e,`status`)==`function`&&typeof M(e,`installPack`)==`function`&&typeof M(e,`repairPack`)==`function`&&typeof M(e,`cancelJob`)==`function`:!1}function Le(e){return(0,t.isRecord)(e)&&typeof M(e,`ok`)==`boolean`}function Re(e){if(!(0,t.isRecord)(e))return typeof e;let n=Object.keys(e);return n.length===0?`{}`:`{ ${n.join(`, `)} }`}function ze(e){let n=e.error,r=(0,t.isRecord)(n)?M(n,`code`):void 0,i=(0,t.isRecord)(n)?M(n,`message`):void 0;return{code:typeof r==`string`&&r!==``?r:`REMOTE_BAD_ENVELOPE`,message:typeof i==`string`?i:``}}async function U(e,t){let n=await e;if(!Le(n))throw TypeError(`runtime remote returned a malformed envelope: ${Re(n)}`);if(n.ok)return F(t,n.value);let r=ze(n);throw Error(`${r.code}: ${r.message}`)}function Be(e){let t,n=async()=>{let n=e.get?.(`remote`);if(!Te(n))throw Error(`运行环境读面不可用:宿主网关没有提供 remote 服务`);try{t??=n.$mount({package:j,descriptors:Fe}),await t}catch(e){throw t=void 0,e}let r=e.get?.(P,!1);if(!Ie(r))throw t=void 0,Error(`${P} 未提供:宿主网关没有挂上这枚命名空间`);return r};return{async status(){return U((await n()).status(),Me)},async install(e){return U((await n()).installPack({pack:e}),B)},async repair(e){return U((await n()).repairPack({pack:e}),B)},async cancel(e){return U((await n()).cancelJob({jobId:e}),B)}}}function Ve(e){return typeof e.get==`function`?Be(e):void 0}const W=`data:image/png;base64,${(/* @__PURE__ */ `iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAQAAAD41aSMAAATrElEQVR42u1dC3hVxbWGEN4PUUR8hFsvChbSFnsVBUWltiBy.BVtqbHn12vKS9KIEfCGvUKFUxSBCwAflYQVtBIVWRUQarw9oEVRKg6AUhFCEgMLlYSCB83ed5ORk55y9Z9bM3mefvU/2mk8k.5Ow5M+vfs2atNWutqYM6QUtmC1gQAKDYMvALzMab+Bs2YDkm0M8BAK618zAUb+MUqimEtbguAMCN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QSr66T3IWJXpKJqPw7KW6tka7K5t/e232UF7nrAC6La/J6pVcGM71Ocw241MzGlJnTN8vjcrFiV7nY3ftHt6p175KY2YdtFQ0UKWaZ5ZV/o81jQ1le3PRXcmaqc1UfbWWQUJkJ8dtyby7I6Q0YBvYITS2PGqE+SiUIySyEbsdWiJPd0FKsGZki5nSyGjK79l4SrBwAcF0YJN4NF6z8wslTdr0+UD8vaLJJ1imHIN93JGr1prf9HaoxEYceG39cGioWFKZ9olu8IvD7R9/589RR5EYSHmdBs8j7Y6/Nn613oj22yuufydf3Kw+q9Q2Pvc4rFF+CUevlqdOp6melE+15aKR4a6J18kPnh7nqYLUTHetglofCBAAAAAIAABAAAIAAAAAEAAAgAAAAAcBo8zgT1XPHurF5F/w5AaQTe9KWIJwTQDWY/KHa0FFGAEwqkibP3kzdn7Gr7exPkwZfM8PfznUOAJvZod33jBIm/1/97292PKWHwT/VH6lMAWB3FsQA0OvTzt5veobaptr9+hAAvCh3+xTq8f2//xlT93ZtZQCA/XNA9nJM3qkbUc9U24y/L3ZoFpyvwndsFpxxnevUNfbnXOc6dIXxOdvRnTuvf5yz1VACwK5Cy5cZ0IxjHYAAAAAEAAAAABMAAAAIAABAAAAA2l//ANBt5HCfcxVrAAAAAElFTkSuQmCC`,K=`row.session`,q=`dsh-scrapling`,J=[`scrapling_fetch`,`scrapling_extract`,`scrapling_locate`,`scrapling_links`,`scrapling_render`,`scrapling_capture_xhr`,`scrapling_answer`,`scrapling_session_open`,`scrapling_session_fetch`,`scrapling_session_network`,`scrapling_session_state_save`,`scrapling_session_state_load`,`scrapling_session_list`,`scrapling_session_close`,`scrapling_crawl`,`scrapling_session_read`,`scrapling_session_act`,`scrapling_download`,`scrapling_read_document`,`scrapling_screenshot`];function Y(e){return typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):``}function He(...e){for(let t of e){let e=Y(t);if(e!==``)return e}return``}function Ue(e,t,n){let r=Y(t.selector);return{tool:e,title:r===``?e:`${e} ${r}`,fields:[{labelKey:`row.matched`,value:Y(n.count)}]}}function We(e,t,n){let r=[],i=Y(t.baseUrl);return i!==``&&r.push({labelKey:`row.url`,value:i}),r.push({labelKey:`row.matched`,value:Y(n.count)}),{tool:e,title:e,fields:r}}function Ge(e,t){let n=[{labelKey:K,value:Y(t.sessionId)}],r=Y(t.name);return r!==``&&n.push({labelKey:`row.name`,value:r}),{tool:e,title:e,fields:n}}function Ke(e,t,n,r){return{tool:e,title:e,fields:[{labelKey:`row.start`,value:t},{labelKey:`row.pageCap`,value:Y(n.maxPages)},{labelKey:`row.job`,value:Y(r.jobId)}]}}function qe(e,t,n){let r=[];t!==``&&r.push({labelKey:`row.url`,value:t});let i=n.statusCode;return typeof i==`number`&&r.push({labelKey:`row.http`,value:String(i)}),typeof n.truncated==`boolean`&&r.push({labelKey:`row.body`,value:``,valueKey:n.truncated?`row.truncated`:`row.notTruncated`}),{tool:e,title:e,fields:r}}function X(e){return e>=500?`err`:e>=400?`warn`:`ok`}function Z(e,n){if(e!==`result`||!(0,t.isRecord)(n))return`mute`;let r=typeof n.statusCode==`number`?n.statusCode:void 0;return r!==void 0&&r>=500?`err`:n.truncated===!0?`warn`:r===void 0?`mute`:X(r)}function Q(e,n,r){let i=(0,t.isRecord)(n)?n:{},a=(0,t.isRecord)(r)?r:{},o=He(a.url,i.url);return e===`scrapling_extract`||e===`scrapling_locate`?Ue(e,i,a):e===`scrapling_links`?We(e,i,a):e===`scrapling_session_list`?{tool:e,title:e,fields:[{labelKey:`row.sessionCount`,value:Y(a.count)}]}:e===`scrapling_session_open`?{tool:e,title:e,fields:[{labelKey:`row.type`,value:Y(i.sessionType)},{labelKey:K,value:Y(a.sessionId)}]}:e===`scrapling_session_close`?{tool:e,title:e,fields:[{labelKey:K,value:Y(i.sessionId)}]}:e===`scrapling_session_network`||e===`scrapling_session_state_save`||e===`scrapling_session_state_load`?Ge(e,i):e===`scrapling_crawl`?Ke(e,o,i,a):qe(e,o,a)}const Je=[`url`,`baseUrl`,`selector`,`sessionType`,`sessionId`,`name`,`maxPages`];function Ye(e){if(e===void 0)return{};let t={};for(let n of Je){let r=e.text(n),i=r===void 0||r.length===0?e.value(n):r;i!==void 0&&(t[n]=i)}return t}function $(e){return e.phase===`result`?e.block.meta:void 0}const Xe=`
5
+ 'use strict';
6
+ const module = { exports: {} };
7
+ let exports = module.exports;
8
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react"),t=require("@jayyuen66/dsh-plugin-shared/client"),n=require("zod");const r=[{id:`runtime`,title:{zh:`解释器与目录`,en:`Interpreter & data`},note:{zh:`Python 与数据目录。装完 scrapling 之后这里一般不用动。`,en:`Python and the data directory. Usually untouched once scrapling is installed.`},fields:[{key:`pythonBin`,kind:`text`,label:{zh:`Python 解释器`,en:`Python interpreter`},hint:{zh:`留空:按「托管 runtime(macOS arm64,装过才用)→ 仓内 _env/.venv(装了才用)→ PATH 上的 python3(Windows 上是 python)」依次探测,卡面上的「运行环境」会显示命中的是哪一档;装了 pyenv/conda 时填绝对路径。`,en:`Empty: probed in order — managed runtime (macOS arm64, only once installed), the repo's _env/.venv when it exists, then python3 from PATH (python on Windows); the Runtime row shows which one won. Give an absolute path under pyenv/conda.`},fallback:``},{key:`failFastOnMissingPython`,kind:`boolean`,label:{zh:`Python 缺失时拒绝加载`,en:`Fail fast without Python`},hint:{zh:`开:Python 起不来就不注册任何工具并报错。关:只警告,工具全部消失。`,en:`On: register nothing and error out. Off: warn and register nothing.`},fallback:!0},{key:`dataDir`,kind:`text`,label:{zh:`数据目录`,en:`Data directory`},hint:{zh:`留空用 ~/.dsh-scrapling;选择器自愈的指纹库落在这里,需要可写。`,en:`Leave empty for ~/.dsh-scrapling; the adaptive selector store lives here and must be writable.`},fallback:``}]},{id:`tools`,title:{zh:`工具开关`,en:`Tools`},note:{zh:`关掉的工具不会注册给模型,也不会在会话提示里占位置。`,en:`A disabled tool is never registered with the model and leaves the system prompt too.`},fields:[{key:`fetchEnabled`,kind:`boolean`,label:{zh:`scrapling_fetch`,en:`scrapling_fetch`},hint:{zh:`curl_cffi 静态抓取。`,en:`Static fetching over curl_cffi.`},fallback:!0},{key:`extractEnabled`,kind:`boolean`,label:{zh:`scrapling_extract`,en:`scrapling_extract`},hint:{zh:`对给定 HTML 做选择器抽取,不发请求。`,en:`Extract from given HTML without any request.`},fallback:!0},{key:`locateEnabled`,kind:`boolean`,label:{zh:`scrapling_locate`,en:`scrapling_locate`},hint:{zh:`按文本、正则或相似元素定位,返回可复用的选择器。`,en:`Locate by text, regex, or similar elements and return reusable selectors.`},fallback:!0},{key:`linksEnabled`,kind:`boolean`,label:{zh:`scrapling_links`,en:`scrapling_links`},hint:{zh:`列出页面链接与下一页候选。`,en:`List page links and next-page candidates.`},fallback:!0},{key:`renderEnabled`,kind:`boolean`,label:{zh:`scrapling_render`,en:`scrapling_render`},hint:{zh:`Playwright 渲染,能读 SPA。`,en:`Playwright rendering; reads SPAs.`},fallback:!0},{key:`captureXhrEnabled`,kind:`boolean`,label:{zh:`scrapling_capture_xhr`,en:`scrapling_capture_xhr`},hint:{zh:`只回传 XHR 的 URL/状态/字节数;站点数据在接口里时用它找那个接口。`,en:`Returns XHR url/status/bytes only — use it to locate the JSON endpoint.`},fallback:!0},{key:`networkEnabled`,kind:`boolean`,label:{zh:`scrapling_session_network`,en:`scrapling_session_network`},hint:{zh:`读已开会话攒下的网络历史;会话需先用 recordNetwork 打开记录。`,en:`Read a session's recorded network history; the session must have recordNetwork on.`},fallback:!0},{key:`sessionEnabled`,kind:`boolean`,label:{zh:`scrapling_session_*`,en:`scrapling_session_*`},hint:{zh:`跨请求复用 cookie 与浏览器实例,只管 open / fetch / list / close 这一组;network 与 state_* 各自有独立开关。`,en:`Reuse cookies and the browser across requests; covers open / fetch / list / close only. The network and state_* groups have their own switches.`},fallback:!0},{key:`sessionStateEnabled`,kind:`boolean`,label:{zh:`scrapling_session_state_*`,en:`scrapling_session_state_*`},hint:{zh:`存/取浏览器登录态;需部署侧配好 sessionStateDir。`,en:`Save/load browser login state; needs a deployment-side sessionStateDir.`},fallback:!0},{key:`crawlEnabled`,kind:`boolean`,label:{zh:`scrapling_crawl`,en:`scrapling_crawl`},hint:{zh:`后台 Spider 作业,只守起始域;需 profile 带作业后端。`,en:`Background spider jobs confined to the start domain; needs a jobs backend.`},fallback:!0},{key:`answerEnabled`,kind:`boolean`,label:{zh:`scrapling_answer`,en:`scrapling_answer`},hint:{zh:`抓完页面交给模型问答。`,en:`Answer a question over a fetched page.`},fallback:!0},{key:`sessionReadEnabled`,kind:`boolean`,label:{zh:`scrapling_session_read`,en:`scrapling_session_read`},hint:{zh:`读浏览器会话当前页,不再发请求。`,en:`Read the current page of a browser session without another request.`},fallback:!0},{key:`sessionActionsEnabled`,kind:`boolean`,label:{zh:`scrapling_session_act`,en:`scrapling_session_act`},hint:{zh:`结构化浏览器动作;还要部署侧打开 allowBrowserActions。`,en:`Structured browser actions; the deployment must also set allowBrowserActions.`},fallback:!0},{key:`downloadEnabled`,kind:`boolean`,label:{zh:`scrapling_download`,en:`scrapling_download`},hint:{zh:`下载文件到插件目录;还要部署侧打开 allowFileDownloads。`,en:`Download files into the plugin directory; the deployment must also set allowFileDownloads.`},fallback:!0},{key:`documentsEnabled`,kind:`boolean`,label:{zh:`scrapling_read_document`,en:`scrapling_read_document`},hint:{zh:`读取 PDF 文本与页数;需要可选 documents 能力包(pypdf)。`,en:`Read PDF text and page counts; requires the optional documents pack (pypdf).`},fallback:!0},{key:`screenshotEnabled`,kind:`boolean`,label:{zh:`scrapling_screenshot`,en:`scrapling_screenshot`},hint:{zh:`页面截图;没有 attachment 服务时不注册。`,en:`Page screenshots; not registered when no attachment service is mounted.`},fallback:!0}]},{id:`output`,title:{zh:`抽取与输出`,en:`Extraction & output`},note:{zh:`这几个数字直接决定模型每轮看到多少 token。`,en:`These numbers are the per-call token bill the model pays.`},fields:[{key:`extractionType`,kind:`enum`,label:{zh:`默认抽取形态`,en:`Default extraction`},hint:{zh:`markdown 最省 token;html 保留标签;text 只留文字。`,en:`markdown is cheapest; html keeps tags; text keeps words only.`},fallback:`markdown`,options:[`markdown`,`html`,`text`]},{key:`mainContentOnly`,kind:`boolean`,label:{zh:`只保留正文`,en:`Main content only`},hint:{zh:`去掉导航、页脚、侧栏。开:更短更干净;关:要连同导航、按钮这类页面控件一起抓时用。`,en:`Drop nav/footer/sidebar. On for shorter output; off when you need page chrome.`},fallback:!0},{key:`fetchMaxOutputChars`,kind:`number`,label:{zh:`静态抓取正文上限`,en:`fetch output cap`},hint:{zh:`预算按 UTF-8 字节计,超出部分截断并标注;同一数值也作为 sidecar 的字符上限,最终取更紧的一档。`,en:`UTF-8 bytes; the payload is clipped and flagged. The same value also caps sidecar characters, so the tighter limit wins.`},fallback:2e5},{key:`extractMaxOutputChars`,kind:`number`,label:{zh:`抽取结果上限`,en:`extract output cap`},hint:{zh:`预算按 UTF-8 字节计;同一数值也作为 sidecar 的字符上限。`,en:`UTF-8 bytes; the same value also caps sidecar characters.`},fallback:2e5},{key:`renderMaxOutputChars`,kind:`number`,label:{zh:`渲染结果上限`,en:`render output cap`},hint:{zh:`预算按 UTF-8 字节计;会话类工具共用这一档,同一数值也作为 sidecar 的字符上限。`,en:`UTF-8 bytes; the session tools share this budget, and the same value also caps sidecar characters.`},fallback:2e5},{key:`documentMaxOutputChars`,kind:`number`,label:{zh:`PDF 正文字符上限`,en:`PDF text cap`},hint:{zh:`scrapling_read_document 的输出上限;模型只能用更小的值。`,en:`Output cap for scrapling_read_document; the model may only lower it.`},fallback:2e5},{key:`xhrMaxOutputChars`,kind:`number`,label:{zh:`XHR 快照上限`,en:`XHR snapshot cap`},hint:{zh:`预算按 UTF-8 字节计;同一数值也作为 sidecar 的字符上限。`,en:`UTF-8 bytes; the same value also caps sidecar characters.`},fallback:12e4},{key:`crawlMaxItems`,kind:`number`,label:{zh:`爬虫默认页数上限`,en:`Crawl page cap`},hint:{zh:`爬虫工具每次调用的默认上限,模型可按次调小。`,en:`Default per-call page cap; the model may lower it per call.`},fallback:1e3},{key:`stripInlineImages`,kind:`boolean`,label:{zh:`剥掉内嵌 base64 图片`,en:`Strip inline base64 images`},hint:{zh:`默认开。内嵌 data: URI 图片对模型是纯 token 噪音——模型从 base64 里读不出任何图形信息,只留 alt 文本;代码围栏内的原样保留。没有内联图的页面不受影响。要从 base64 里取配色或指纹这类原始数据时才关掉。`,en:`On by default. Inline data: URI images are pure token noise - the model cannot read a shape out of base64, so only the alt text is kept; ones inside code fences are left alone. Pages without inline images are unaffected. Turn it off to read the raw base64 (colours, fingerprints).`},fallback:!0}]},{id:`browser`,title:{zh:`浏览器行为`,en:`Browser behaviour`},note:{zh:`影响所有走浏览器的路径:渲染、XHR 快照与会话类工具。会话里「无头运行」与「拦广告」在开场时定死,中途改不了;其余几档每次抓取各自生效。`,en:`Affects every browser path: render, XHR capture and the session tools. Inside a session, Headless and Block ads are fixed at open; the rest apply per fetch.`},fields:[{key:`headless`,kind:`boolean`,label:{zh:`无头运行`,en:`Headless`},hint:{zh:`关掉会弹出浏览器窗口,反检测站点上成功率更高。`,en:`Off shows a window and beats more anti-bot checks.`},fallback:!0},{key:`networkIdle`,kind:`boolean`,label:{zh:`等网络静默`,en:`Wait for network idle`},hint:{zh:`等到没有在途请求再返回。更准,但慢;埋了长连接的站点可能一直等不到。`,en:`Wait until no requests are in flight. Slower, and pages with long-lived sockets never settle.`},fallback:!1},{key:`blockAds`,kind:`boolean`,label:{zh:`拦截广告与追踪`,en:`Block ads and trackers`},hint:{zh:`约 3500 个已知广告域。省流量,偶尔误伤。`,en:`~3,500 known ad domains. Saves bandwidth, occasionally over-blocks.`},fallback:!0},{key:`pierceShadow`,kind:`boolean`,label:{zh:`穿透 Shadow DOM`,en:`Pierce Shadow DOM`},hint:{zh:`把 open shadow root 里的内容并进正文,默认关;页面把正文封进 shadow DOM 时才打开。`,en:`Merge open shadow root content into the body; off by default. On when a page hides its content in shadow DOM.`},fallback:!1},{key:`waitSelectorState`,kind:`enum`,label:{zh:`等待选择器的状态`,en:`Wait selector state`},hint:{zh:`配 waitSelector 用;attached 最宽松。`,en:`Used with waitSelector; attached is the loosest.`},fallback:`attached`,options:[`attached`,`detached`,`hidden`,`visible`]}]},{id:`timeouts`,title:{zh:`超时与回收`,en:`Timeouts & teardown`},note:{zh:`抓取慢若不在这几项里,先看页面上要等的东西。`,en:`If a fetch is slow for a reason other than these, look at what the page waits for.`},fields:[{key:`fetchTimeoutMs`,kind:`number`,label:{zh:`单次抓取超时(毫秒)`,en:`Per-fetch timeout (ms)`},hint:{zh:`是工具调用与 sidecar 那一帧的超时预算,也当作浏览器页面的等待预算发下去。静态路径每次请求的秒数上限另有其数:部署配置里的 requestTimeoutSeconds(默认 120,这张卡上没有这一项),模型也能按次用 timeoutSeconds 调小。`,en:`The budget for the tool call and for one sidecar frame, and the wait budget sent for browser pages. Static requests have their own cap: requestTimeoutSeconds in the deployment config (120 by default; not a field on this card), which the model can also lower per call with timeoutSeconds.`},fallback:12e4},{key:`sidecarHandshakeTimeoutMs`,kind:`number`,label:{zh:`sidecar 握手超时(毫秒)`,en:`Handshake timeout (ms)`},hint:{zh:`冷启动要拉起一个 Python 进程并导入 Scrapling。`,en:`Cold start spawns a Python process and imports Scrapling.`},fallback:3e4},{key:`sidecarGraceMs`,kind:`number`,label:{zh:`退出宽限(毫秒)`,en:`Shutdown grace (ms)`},hint:{zh:`插件卸载后等 Python 收尾的时间。`,en:`How long Python gets to finish after the plugin unloads.`},fallback:5e3}]},{id:`network`,title:{zh:`网络与安全`,en:`Network & safety`},note:{zh:`通常什么都不用填:TUN 模式的代理由系统接管,环境里的 HTTPS_PROXY 与 macOS / Windows 的「系统代理」都会被自动接上。`,en:`Usually nothing to fill: a TUN-mode proxy is taken from the system, and both HTTPS_PROXY in the environment and the macOS / Windows system proxy are picked up automatically.`},fields:[{key:`proxyUrl`,kind:`text`,format:`url`,schemes:[`http:`,`https:`,`socks5:`,`socks5h:`],secret:!0,label:{zh:`代理地址`,en:`Proxy URL`},hint:{zh:`如 http://127.0.0.1:7890 或 socks5://127.0.0.1:7890,可带 user:pass@。留空=依次跟随环境变量与系统代理设置;填了就压过那两者。值按密码遮罩显示,点「显示」可查看。`,en:`e.g. http://127.0.0.1:7890 or socks5://127.0.0.1:7890, user:pass@ allowed. Empty follows the environment and then the OS proxy settings; setting it outranks both. Masked like a password; press Show to reveal it.`},fallback:``},{key:`proxyBypass`,kind:`text`,label:{zh:`代理绕过清单`,en:`Proxy bypass`},hint:{zh:`逗号分隔的主机名,命中即直连;内网站点要填。整台机器直连填 *。浏览器会话不逐条生效(它的代理在开场时定死)。`,en:`Comma-separated hostnames that connect directly; list your internal sites. Use * for the whole machine. Not applied per URL inside a browser session (its proxy is fixed at open).`},fallback:``},{key:`syntheticDnsRanges`,kind:`text`,label:{zh:`合成 DNS 段(兜底)`,en:`Synthetic DNS ranges (fallback)`},hint:{zh:`平时留空:fake-ip 型代理由系统自动认出,这里只用于识别失灵时。列进来的段等于放弃对它们的 SSRF 防护。`,en:`Leave empty: fake-ip resolvers are detected automatically. Only for detection failures. Listed ranges give up SSRF protection.`},fallback:``},{key:`allowedHosts`,kind:`text`,label:{zh:`额外放行的内网主机`,en:`Extra allowed hosts`},hint:{zh:`逗号分隔。指到内网等于主动放弃对那些目标的 SSRF 防护,只在真要抓自建站点时填。`,en:`Comma-separated. Pointing these at internal hosts gives up SSRF protection for them — only for self-hosted targets.`},fallback:``},{key:`nat64Prefixes`,kind:`text`,label:{zh:`额外 NAT64 前缀`,en:`Extra NAT64 prefixes`},hint:{zh:`用运营商自建 NAT64 的网络才需要,形如 2001:4860:4860::/96。`,en:`Only for carrier-grade NAT64 networks, e.g. 2001:4860:4860::/96.`},fallback:``},{key:`provideWebFetch`,kind:`boolean`,label:{zh:`接管内置 web_fetch`,en:`Provide the built-in web_fetch`},hint:{zh:`默认开;部署配置里仍要写 fetchProvider: "scrapling",否则 base bundle 那条 fetchProvider: http 仍然赢。`,en:`On by default; the deployment config still needs fetchProvider: "scrapling", otherwise the base bundle's fetchProvider: http wins.`},fallback:!0},{key:`provideWebSearch`,kind:`boolean`,label:{zh:`接管内置 web_search`,en:`Provide the built-in web_search`},hint:{zh:`默认开;部署配置里仍要写 searchProvider: "scrapling",否则不会接管。`,en:`On by default; the deployment config still needs searchProvider: "scrapling", otherwise it does not take over.`},fallback:!0},{key:`webFetchStrategy`,kind:`enum`,options:[`static`,`auto`,`browser`],label:{zh:`网页正文抓取策略`,en:`Web content fetch strategy`},hint:{zh:`auto:先静态抓取,正文少于 200 字符时再尝试浏览器渲染;static 只静态抓取;browser 直接渲染。没有浏览器时 auto 保持静态抓取。`,en:`auto: fetch statically first and render only when the body is under 200 characters; static never renders; browser renders directly. Without a browser, auto stays static.`},fallback:`auto`},{key:`searchMaxOutputBytes`,kind:`number`,label:{zh:`搜索正文总预算(字节)`,en:`Search total body budget (bytes)`},hint:{zh:`一次搜索中所有正文小节的 UTF-8 字节总上限;默认 24000。调大更完整,也直接增加模型上下文与 token 成本。`,en:`UTF-8 byte cap across all body sections in one search; defaults to 24000. Larger values keep more text but increase model context and token cost.`},fallback:24e3},{key:`searchBackend`,kind:`enum`,options:[`auto`,`tavily`,`bing`,`brave`,`serper`,`duckduckgo`,`searxng`,`deepseek`],label:{zh:`搜索发现后端`,en:`Search discovery backend`},hint:{zh:`auto 有 Tavily key 走 Tavily、配了 SearXNG 走 SearXNG;两者都没有时,只有打开「允许公共搜索回退」才走公共 Bing —— auto 不会挑 DuckDuckGo,那档只能显式选。只有 Tavily 与 Bing 打过真实端点;Brave、Serper、DuckDuckGo、SearXNG、DeepSeek 按文档形状实现,未在真实端点验证。`,en:`auto uses Tavily when a key is set and SearXNG when an instance is configured; with neither, only "Allow public search fallback" routes to public Bing — auto never picks DuckDuckGo, that backend has to be selected explicitly. Only Tavily and Bing have been run against the real endpoints; Brave, Serper, DuckDuckGo, SearXNG and DeepSeek follow their documented shapes and are unverified against real endpoints.`},fallback:`auto`},{key:`searchPublicFallback`,kind:`boolean`,label:{zh:`允许公共搜索回退`,en:`Allow public search fallback`},hint:{zh:`默认关。打开后 auto 后端在没配 key、也没配 SearXNG 时会回落到公共 Bing —— 查询词会发给公共引擎。`,en:`Off by default. When enabled, the auto backend falls back to public Bing if no API key or SearXNG is configured — queries are then sent to a public engine.`},fallback:!1},{key:`tavilyApiKey`,kind:`text`,secret:!0,label:{zh:`Tavily API key`,en:`Tavily API key`},hint:{zh:`Tavily 后端必填;没配时 search 报 SEARCH_AUTH,不会静默换后端。`,en:`Required by the Tavily backend; without it search reports SEARCH_AUTH instead of silently switching backends.`},fallback:``},{key:`braveApiKey`,kind:`text`,secret:!0,label:{zh:`Brave Search API key`,en:`Brave Search API key`},hint:{zh:`Brave 后端必填;没配时 search 报 SEARCH_AUTH。`,en:`Required by the Brave backend; without it search reports SEARCH_AUTH.`},fallback:``},{key:`serperApiKey`,kind:`text`,secret:!0,label:{zh:`Serper API key`,en:`Serper API key`},hint:{zh:`Serper 后端必填;没配时 search 报 SEARCH_AUTH。`,en:`Required by the Serper backend; without it search reports SEARCH_AUTH.`},fallback:``},{key:`searxngEndpoint`,kind:`text`,format:`url`,schemes:[`http:`,`https:`],secret:!0,label:{zh:`SearXNG 实例地址`,en:`SearXNG instance URL`},hint:{zh:`SearXNG 后端必填,例如 https://searx.example.com;会拼上 /search?format=json。留空表示这条后端不可用。值按密码遮罩显示,点「显示」可查看。`,en:`Required by the SearXNG backend, e.g. https://searx.example.com; /search?format=json is appended. Empty means the backend is unusable. Masked like a password; press Show to reveal it.`},fallback:``}]},{id:`answer`,title:{zh:`页面问答`,en:`Page Q&A`},note:{zh:`provider 与 model 留空跟随当前会话用的模型,不额外烧一份额度;token 上限留空用默认值。`,en:`provider and model blank follow the session's own model, costing no extra quota; the token cap falls back to its default.`},fields:[{key:`answerProvider`,kind:`text`,label:{zh:`回答用 provider`,en:`Answer provider`},hint:{zh:`留空跟随会话模型。`,en:`Blank follows the session model.`},fallback:``},{key:`answerModel`,kind:`text`,label:{zh:`回答用模型 id`,en:`Answer model id`},hint:{zh:`与 provider 一起生效。`,en:`Takes effect together with the provider.`},fallback:``},{key:`answerMaxTokens`,kind:`number`,label:{zh:`单次回答 token 上限`,en:`Answer token cap`},hint:{zh:`一次回答的输出预算。`,en:`Output budget per answer.`},fallback:2e3}]}],i=r.flatMap(e=>e.fields);i.map(e=>e.key);const a=`dshScrapling`,o={zh:{navLabel:`scrapling 抓取`,save:`保存`,saving:`保存中…`,undo:`撤销`,reveal:`显示`,conceal:`隐藏`,statusLoading:`正在读取设置…`,statusReadonly:`这个连接以只读方式运行,设置改不了。`,statusClean:`没有未保存的改动`,statusChanged:`已改动 {count} 项,未保存`,statusInvalid:`有 {count} 项填得不合法,改好后才能保存`,rejected:`保存被宿主拒绝了,设置未改动。常见原因:这一条目的配置被部署 patch 或命令行 overlay 压制(此时写下的值会在下次启动被覆盖回,宿主因此拒绝),或值没有通过 schema 校验。`,stale:`设置已经被别处改过,请重新打开这张卡再保存`,failed:`保存失败:{reason}`,panelPacks:`就绪能力包`,panelPython:`解释器`,runtimeTitle:`运行环境`,runtimeHint:`能力包装在数据目录的 runtime/ 下;安装是后台作业,关掉这张卡也会继续。`,runtimeCommandLabel:`终端命令`,copy:`复制`,copied:`已复制`,runtimeUnavailable:`宿主没有提供远程读面;请在终端运行:`,runtimeJobsMissing:`这个 profile 没有作业后端;请在终端运行:`,runtimeInstall:`安装`,runtimeRepair:`修复`,runtimeCancel:`取消`,runtimePython:`解释器`,runtimeDataDir:`数据目录`,"runtime.via.configured":`部署配置指定`,"runtime.via.managed-venv":`托管环境(已装依赖)`,"runtime.via.managed":`托管 Python(未装依赖)`,"runtime.via.repo":`仓内 venv`,"runtime.via.path":`PATH 上的 python3`,runtimeJobRunning:`正在安装 {pack}…`,runtimeJobEnded:`安装结束:{status}`,"runtime.job.completed":`已完成`,"runtime.job.killed":`已取消`,"runtime.job.failed":`失败`,"runtime.job.stopping":`停止中`,"runtime.job.running":`进行中`,runtimeError:`安装失败:{reason}`,runtimeReadFailed:`状态读取失败:{reason}`,"runtime.state.ready":`就绪`,"runtime.state.missing":`未安装`,"runtime.state.corrupt":`文件缺失`,"runtime.state.installing":`安装中`,"runtime.state.blocked":`暂不提供`,"runtime.pack.core":`核心(Python + Scrapling)`,"runtime.pack.browser":`完整 Chromium`,"runtime.pack.search":`搜索发现`,"runtime.pack.media":`截图与下载`,"runtime.pack.documents":`PDF 阅读(pypdf)`,"runtime.pack.adaptive-redis":`自适应存储(Redis)`,"runtime.pack.mcp":`MCP(未验证)`},en:{navLabel:`scrapling fetch`,save:`Save`,saving:`Saving…`,undo:`Undo`,reveal:`Show`,conceal:`Hide`,statusLoading:`Reading settings…`,statusReadonly:`This connection runs read-only; settings cannot be changed here.`,statusClean:`No unsaved changes`,statusChanged:`{count} change(s) not saved yet`,statusInvalid:`{count} field(s) are not valid; fix them to save`,rejected:`The host refused the save; nothing changed. Common causes: this entry's config is overridden by a deployment patch or command-line overlay (the host refuses because anything written here would be reverted on the next boot), or the value failed schema validation.`,stale:`Settings changed elsewhere; reopen this page before saving`,failed:`Save failed: {reason}`,panelPacks:`Ready packs`,panelPython:`Interpreter`,runtimeTitle:`Runtime`,runtimeHint:`Capability packs live under runtime/ in the data directory; installs run as background jobs and keep going when this page closes.`,runtimeCommandLabel:`Terminal command`,copy:`Copy`,copied:`Copied`,runtimeUnavailable:`The host offers no remote surface; run this in a terminal:`,runtimeJobsMissing:`This profile has no jobs backend; run this in a terminal:`,runtimeInstall:`Install`,runtimeRepair:`Repair`,runtimeCancel:`Cancel`,runtimePython:`Interpreter`,runtimeDataDir:`Data directory`,"runtime.via.configured":`Selected by deployment config`,"runtime.via.managed-venv":`Managed venv (dependencies installed)`,"runtime.via.managed":`Managed Python (dependencies missing)`,"runtime.via.repo":`Repository venv`,"runtime.via.path":`python3 from PATH`,runtimeJobRunning:`Installing {pack}…`,runtimeJobEnded:`Install finished: {status}`,"runtime.job.completed":`Completed`,"runtime.job.killed":`Cancelled`,"runtime.job.failed":`Failed`,"runtime.job.stopping":`Stopping`,"runtime.job.running":`Running`,runtimeError:`Install failed: {reason}`,runtimeReadFailed:`Status read failed: {reason}`,"runtime.state.ready":`Ready`,"runtime.state.missing":`Not installed`,"runtime.state.corrupt":`Files missing`,"runtime.state.installing":`Installing`,"runtime.state.blocked":`Unavailable`,"runtime.pack.core":`Core (Python + Scrapling)`,"runtime.pack.browser":`Full Chromium`,"runtime.pack.search":`Search discovery`,"runtime.pack.media":`Screenshots & downloads`,"runtime.pack.documents":`PDF reading (pypdf)`,"runtime.pack.adaptive-redis":`Adaptive storage (Redis)`,"runtime.pack.mcp":`MCP (unverified)`}},s={zh:{"row.url":`URL`,"row.http":`HTTP`,"row.body":`正文`,"row.matched":`匹配`,"row.sessionCount":`会话数`,"row.session":`会话`,"row.name":`名称`,"row.type":`类型`,"row.start":`起始`,"row.pageCap":`上限`,"row.job":`作业`,"row.inspect":`在轨迹里查看`,"row.truncated":`已截断`,"row.notTruncated":`否`},en:{"row.url":`URL`,"row.http":`HTTP`,"row.body":`Body`,"row.matched":`Matched`,"row.sessionCount":`Sessions`,"row.session":`Session`,"row.name":`Name`,"row.type":`Type`,"row.start":`Start`,"row.pageCap":`Page cap`,"row.job":`Job`,"row.inspect":`Inspect this call`,"row.truncated":`Truncated`,"row.notTruncated":`No`}};function c(){let e={zh:{...o.zh,...s.zh},en:{...o.en,...s.en}};for(let t of r){e.zh[`group.${t.id}.title`]=t.title.zh,e.zh[`group.${t.id}.note`]=t.note.zh,e.en[`group.${t.id}.title`]=t.title.en,e.en[`group.${t.id}.note`]=t.note.en;for(let n of t.fields)e.zh[`field.${n.key}.label`]=n.label.zh,e.zh[`field.${n.key}.hint`]=n.hint.zh,e.en[`field.${n.key}.label`]=n.label.en,e.en[`field.${n.key}.hint`]=n.hint.en}return e}const l=[`core`,`browser`,`search`,`media`,`documents`,`adaptive-redis`,`mcp`];new Set(l);const u=[`ready`,`missing`,`corrupt`,`installing`,`blocked`],d=[`running`,`stopping`,`completed`,`killed`,`failed`],f=[`configured`,`managed-venv`,`managed`,`repo`,`path`],p=[400,404,409,500,503];function m(e){return`runtime.state.${e}`}function h(e){return`runtime.pack.${e}`}function g(e){return`runtime.via.${e}`}const _={status:`loading`,writable:!1};function v(){return _}function y(){return()=>void 0}function b(e,n,r,i={}){let a=i[e.key];if(a!==void 0)return a;let o=r[e.key];if(o!==void 0)return(0,t.asDisplayText)(o);let s=n?.[e.key];return s===void 0?String(e.fallback):(0,t.asDisplayText)(s)}const x=n.z.enum([`true`,`false`]),S=n.z.string().regex(/^[1-9]\d*$/u).transform(Number);function C(e,t){let r=n.z.url().safeParse(t);if(!r.success)return{kind:`invalid`};let i=e.schemes;return i!==void 0&&!i.includes(new URL(r.data).protocol)?{kind:`invalid`}:{kind:`value`,value:r.data}}function w(e,t){if(e.kind===`boolean`){let e=x.safeParse(t);return e.success?{kind:`value`,value:e.data===`true`}:{kind:`invalid`}}let r=t.trim();if(r===``)return{kind:`clear`};if(e.kind===`number`){let e=S.safeParse(r);return e.success?{kind:`value`,value:e.data}:{kind:`invalid`}}if(e.kind===`enum`){let t=n.z.string().refine(t=>(e.options??[]).includes(t),{error:`取值不在字段选项内`}).safeParse(r);return t.success?{kind:`value`,value:t.data}:{kind:`invalid`}}return e.format===`url`?C(e,r):{kind:`value`,value:r}}function ee(e){return i.filter(t=>Object.hasOwn(e,t.key)).filter(t=>e[t.key]!==void 0).map(t=>{let n=e[t.key];return n===null||n===t.fallback?{op:`unset`,path:[t.key]}:{op:`set`,path:[t.key],value:n}})}const T=`dsu-btn`,E=`dsu-hint`,D=`dsh-scrapling setup --feature <pack> --apply`,te={completed:`runtime.job.completed`,killed:`runtime.job.killed`,failed:`runtime.job.failed`,stopping:`runtime.job.stopping`,running:`runtime.job.running`};function ne(e){if(typeof e!=`object`||!e)return!1;let t=Reflect.get(e,`head`);return typeof Reflect.get(e,`querySelector`)==`function`&&typeof Reflect.get(e,`createElement`)==`function`&&typeof t==`object`&&!!t&&typeof Reflect.get(t,`append`)==`function`}function re(){let e=Reflect.get(globalThis,`document`);return ne(e)?e:void 0}function ie(e,t,n){if(e.querySelector(`#${t}`)!=null)return()=>void 0;let r=e.createElement(`style`);return r.id=t,r.textContent=n,e.head.append(r),()=>{r.remove()}}function ae(e){return(0,t.ensureCardUiCss)(e)}function oe(n){let{field:r,t:i,shown:a,invalidText:o,disabled:s,revealToken:c,onChange:l}=n,u=i(`field.${r.key}.label`),d=(0,t.splitHint)(i(`field.${r.key}.hint`)),f={label:u,...d,field:r.key,disabled:s,...o===void 0?{}:{invalidText:o}},p=`scrapling-${r.key}`;if(r.kind===`boolean`)return(0,e.createElement)(t.ToggleField,{...f,checked:a===`true`,onChange:e=>{l(String(e))}});if(r.kind===`enum`)return(0,e.createElement)(t.SelectField,{...f,value:a,options:(r.options??[]).map(e=>({value:e,label:e})),onChange:l});if(r.secret===!0)return(0,e.createElement)(t.SecretField,{...f,value:a,revealToken:c,onChange:l});if(r.kind===`number`){let n=[d.detail===void 0?void 0:`${p}-hint`,o===void 0?void 0:`${p}-err`].filter(e=>e!==void 0).join(` `);return(0,e.createElement)(t.Field,{...f,controlId:p},(0,e.createElement)(`input`,{id:p,type:`text`,inputMode:`numeric`,className:`dsu-input`,value:a,disabled:s,"data-field":r.key,"aria-describedby":n.length===0?void 0:n,"aria-invalid":o!==void 0||void 0,"aria-errormessage":o===void 0?void 0:`${p}-err`,onChange:e=>{l(e.target.value)}}))}return(0,e.createElement)(t.TextField,{...f,value:a,onChange:l})}function se(n){let{group:r,t:i,shown:a,invalidText:o,disabled:s,revealToken:c,onChange:l}=n,u=r.fields.filter(e=>e.kind===`boolean`),d=r.fields.map(t=>(0,e.createElement)(oe,{key:t.key,field:t,t:i,shown:a(t),invalidText:o(t),disabled:s,revealToken:c,onChange:e=>{l(t,e)}})),f=u.length>=2&&u.length===r.fields.length?(0,e.createElement)(t.ToggleGrid,null,r.fields.map(n=>{let r=o(n);return(0,e.createElement)(t.ToggleCell,{key:n.key,label:i(`field.${n.key}.label`),...(0,t.splitHint)(i(`field.${n.key}.hint`)),field:n.key,disabled:s,checked:a(n)===`true`,...r===void 0?{}:{invalidText:r},onChange:e=>{l(n,String(e))}})})):d;return(0,e.createElement)(t.Section,{title:i(`group.${r.id}.title`),hint:i(`group.${r.id}.note`)},f)}function ce(e,n,r){let i=r?.[e.key],a=i===void 0?String(e.fallback):(0,t.asDisplayText)(i);return(0,t.asDisplayText)(n)===a}const O={values:{},baseRevision:void 0,invalid:[],invalidText:{}};function le(e,t){let n={...e.values};for(let e of t){let[t]=e.path;Reflect.deleteProperty(n,t)}return Object.keys(n).length===0?O:{...e,values:n,baseRevision:void 0}}function ue(n){let{t:r,saving:i,editable:a,changed:o,invalid:s,onSave:c,onUndo:l}=n;return(0,e.createElement)(t.SaveBar,{dirty:o>0,blocked:s>0,busy:i,writable:a,error:s>0?r(`statusInvalid`,{count:s}):null,saveLabel:r(`save`),savingLabel:r(`saving`),revertLabel:r(`undo`),dirtyLabel:r(`statusChanged`,{count:o}),cleanLabel:r(`statusClean`),readOnlyLabel:r(`statusReadonly`),onSave:c,onDiscard:l})}function de(t){let[n,r]=(0,e.useState)(null),[i,a]=(0,e.useState)(``),[o,s]=(0,e.useState)(``),[c,l]=(0,e.useState)(``),u=(0,e.useRef)(0),d=(0,e.useCallback)(async()=>{if(t===void 0)return;u.current+=1;let e=u.current;try{let n=await t.status();if(e!==u.current)return;r(n),l(``)}catch(t){if(e!==u.current)return;l(String(t))}},[t]),f=n?.job?.status===`running`||n?.job?.status===`stopping`;return(0,e.useEffect)(()=>{t!==void 0&&d()},[t,d]),(0,e.useEffect)(()=>{let e;return t!==void 0&&f&&(e=setInterval(()=>{d()},2e3)),()=>{e!==void 0&&clearInterval(e)}},[t,f,d]),{snapshot:n,busy:i,failure:o,readFailure:c,act:(0,e.useCallback)((e,n)=>{t!==void 0&&(a(e),s(``),(async()=>{try{let r=n===`repair`?await t.repair(e):await t.install(e);r.ok?await d():s(r.error)}catch(e){s(String(e))}finally{a(``)}})())},[t,d]),cancel:(0,e.useCallback)(()=>{let e=n?.job;t!==void 0&&e!=null&&(a(`cancel`),s(``),(async()=>{try{let n=await t.cancel(e.id);n.ok?await d():s(n.error)}catch(e){s(String(e))}finally{a(``)}})())},[t,d,n])}}const fe={ready:`ok`,missing:`mute`,corrupt:`err`,installing:`warn`,blocked:`mute`};function pe(e){return e===null?`mute`:fe[e]}const me={configured:`ok`,"managed-venv":`ok`,managed:`warn`,repo:`ok`,path:`ok`};function he(e){return me[e]}const ge={running:`warn`,stopping:`warn`,completed:`ok`,killed:`mute`,failed:`err`};function _e(e){return ge[e]}function k(n,r,i){return(0,e.createElement)(`div`,{className:`dsu-inlineRow`,"data-field":i},(0,e.createElement)(t.StatusDot,{tone:n}),r)}function ve(t,n){let r=t(g(n.python.via)),i=`${t(`runtimePython`)}: ${n.python.path} (${r})`,a=`${t(`runtimeDataDir`)}: ${n.dataDir}`;return k(he(n.python.via),(0,e.createElement)(`p`,{className:E},i,(0,e.createElement)(`br`),a),`runtime-python`)}function ye(t,n,r){let i=t(h(n.pack)),a=t(te[n.status]),o=r?t(`runtimeJobRunning`,{pack:i}):t(`runtimeJobEnded`,{status:a});return k(_e(n.status),(0,e.createElement)(`p`,{className:E},o),`runtime-job`)}function be(t){let{pack:n,state:r,t:i,disabled:a,running:o,activePack:s,onAct:c,onCancel:l}=t,u=i(r===null?`statusLoading`:m(r)),d=i(h(n)),f=k(pe(r),(0,e.createElement)(`p`,{className:E},u),`runtime-pack-${n}`),p=a||o||r===null||r===`blocked`||r===`installing`,g=[(0,e.createElement)(`button`,{type:`button`,className:T,key:`install`,"aria-label":`${d} · ${i(`runtimeInstall`)}`,disabled:p||r===`ready`,onClick:()=>{c(n,`install`)}},i(`runtimeInstall`)),(0,e.createElement)(`button`,{type:`button`,className:T,key:`repair`,"aria-label":`${d} · ${i(`runtimeRepair`)}`,disabled:p||r===`missing`,onClick:()=>{c(n,`repair`)}},i(`runtimeRepair`))];return o&&s===n&&g.push((0,e.createElement)(`button`,{type:`button`,className:T,key:`cancel`,"aria-label":`${d} · ${i(`runtimeCancel`)}`,disabled:a,onClick:l},i(`runtimeCancel`))),(0,e.createElement)(`div`,{className:`dsu-field dsu-fieldRow`,key:n},(0,e.createElement)(`div`,{className:`dsu-fieldMeta`},(0,e.createElement)(`div`,{className:`dsu-label`},d),f),(0,e.createElement)(`div`,{className:`dsu-control`},(0,e.createElement)(`div`,{className:`dsu-actions`},...g)))}function xe(n){let{reader:r,t:i,snapshot:a,busy:o,failure:s,readFailure:c,onAct:u,onCancel:d}=n,f=(0,e.createElement)(t.LogPanel,{label:i(`runtimeCommandLabel`),copyText:D,copyLabel:i(`copy`),copiedLabel:i(`copied`)},D),p=c===``?null:(0,e.createElement)(`div`,{role:`alert`,"aria-live":`assertive`},(0,e.createElement)(t.Callout,{tone:`err`,field:`runtime-read-failure`},i(`runtimeReadFailed`,{reason:c}))),m=s===``?null:(0,e.createElement)(`div`,{role:`alert`,"aria-live":`assertive`},(0,e.createElement)(t.Callout,{tone:`err`,field:`runtime-failure`},i(`runtimeError`,{reason:s})));if(r===void 0)return(0,e.createElement)(t.Section,{title:i(`runtimeTitle`),hint:i(`runtimeHint`)},(0,e.createElement)(`p`,{className:E},i(`runtimeUnavailable`)),f);let h=a?.jobsReady??!1,g=a?.job??null,_=g!==null&&(g.status===`running`||g.status===`stopping`),v=a===null?null:ve(i,a),y=g===null?null:ye(i,g,_),b=g===null||g.output===``?null:(0,e.createElement)(t.LogPanel,{semanticLines:!0},g.output),x=o!==``||!h||a===null,S=l.map(e=>be({pack:e,state:a===null?null:a.packs[e]??`missing`,t:i,disabled:x,running:_,activePack:g?.pack??null,onAct:u,onCancel:d})),C=i(`runtimeJobsMissing`),w=a!==null&&!h?(0,e.createElement)(`div`,null,k(`warn`,(0,e.createElement)(`p`,{className:E},C),`runtime-jobs`),f):null;return(0,e.createElement)(t.Section,{title:i(`runtimeTitle`),hint:i(`runtimeHint`)},v,p,m,y,b,(0,e.createElement)(`div`,{className:`dsu-stack`},...S),w)}async function Se(e){let{form:t,draft:n,ops:r,state:i,t:a,setDraft:o,setFailure:s,setSaving:c}=e;c(!0),s(``);try{await t.mutate(r,n.baseRevision)?o(e=>le(e,r)):s(n.baseRevision!==void 0&&n.baseRevision!==i.revision?a(`stale`):a(`rejected`))}catch(e){s(a(`failed`,{reason:String(e)}))}finally{c(!1)}}function A(n){let{form:i,t:a}=n,[o,s]=(0,e.useState)(O),[c,l]=(0,e.useState)(``),[u,d]=(0,e.useState)(!1),[f,p]=(0,e.useState)(0),m=(0,e.useSyncExternalStore)(i===void 0?y:i.subscribe,i===void 0?v:i.getSnapshot),h=de(n.runtime);if(n.view!==`page`||i===void 0)return(0,e.createElement)(t.CardForm,null);let g=m.writable&&m.status===`ready`,_=ee(o.values),x=async()=>{o.invalid.length>0||_.length===0||await Se({form:i,draft:o,ops:_,state:m,t:a,setDraft:s,setFailure:l,setSaving:d})},S=(e,t)=>{l(``);let n=w(e,t);s(r=>{let i={...r.values},a={...r.invalidText},o=r.invalid.filter(t=>t!==e.key),s=r.baseRevision??m.revision;if(n.kind===`invalid`)return Reflect.deleteProperty(i,e.key),a[e.key]=t,{values:i,baseRevision:s,invalid:[...o,e.key],invalidText:a};Reflect.deleteProperty(a,e.key);let c=n.kind===`clear`?null:n.value;return ce(e,c,m.value)?Reflect.deleteProperty(i,e.key):i[e.key]=c,Object.keys(i).length===0&&o.length===0?O:{values:i,baseRevision:s,invalid:o,invalidText:a}})},C=r.map(t=>(0,e.createElement)(se,{key:t.id,group:t,t:a,shown:e=>b(e,m.value,o.values,o.invalidText),invalidText:e=>o.invalidText[e.key],disabled:!g||u,revealToken:f,onChange:S})),T=ue({t:a,saving:u,editable:g,changed:_.length,invalid:o.invalid.length,onSave:()=>{x()},onUndo:()=>{s(O),p(e=>e+1),l(``)}}),E=c===``?null:(0,e.createElement)(`div`,{role:`alert`,"aria-live":`assertive`},(0,e.createElement)(t.Callout,{tone:`err`,field:`save-error`},c));return(0,e.createElement)(t.CardForm,null,E,...C,xe({reader:n.runtime,t:a,snapshot:h.snapshot,busy:h.busy,failure:h.failure,readFailure:h.readFailure,onAct:h.act,onCancel:h.cancel}),T)}const j=`@jayyuen66/dsh-scrapling`;function M(e,t){return e[t]}const N=`scraplingRuntime`,P=`remote.${N}`,F=`runtime request requires a known pack`,Ce=n.z.object({pack:n.z.enum(l,{error:F})},{error:F}),I=`runtime cancel requires a jobId`,we=n.z.object({jobId:n.z.string({error:I}).trim().min(1,{error:I})},{error:I}),L={mode:`strict`,typeSymbol:`${j}#runtime-pack-request`,create:()=>({parse(e){return(0,t.parseOrThrow)(Ce,e,n.z.prettifyError)}})},Te={mode:`strict`,typeSymbol:`${j}#runtime-cancel-request`,create:()=>({parse(e){return(0,t.parseOrThrow)(we,e,n.z.prettifyError)}})},Ee=n.z.enum(u),De=n.z.enum(d),R=n.z.enum(l),Oe=n.z.object({id:n.z.string(),pack:R,status:De,output:n.z.string()}),ke=n.z.object({ok:n.z.literal(!0),packs:n.z.partialRecord(R,Ee),python:n.z.object({path:n.z.string(),via:n.z.enum(f),version:n.z.string()}),dataDir:n.z.string(),jobsReady:n.z.boolean(),job:Oe.nullable()}),Ae=n.z.literal(p),z=n.z.discriminatedUnion(`ok`,[n.z.object({ok:n.z.literal(!0),jobId:n.z.string()}),n.z.object({ok:n.z.literal(!1),error:n.z.string(),status:Ae})]);function B(e,t){return{id:`${j}#${N}/${e}`,service:N,namespace:N,method:e,invocation:{kind:`direct`},parameters:t,result:{mode:`src-json`}}}function je(e){return[{name:`request`,wire:`request`,source:`json`,codec:e}]}function V(e,t){return B(e,je(t))}const H=[B(`status`,[]),V(`installPack`,L),V(`repairPack`,L),V(`cancelJob`,Te)];function Me(e){return(0,t.isRecord)(e)?typeof M(e,`status`)==`function`&&typeof M(e,`installPack`)==`function`&&typeof M(e,`repairPack`)==`function`&&typeof M(e,`cancelJob`)==`function`:!1}function Ne(e){return(0,t.isRecord)(e)&&typeof M(e,`ok`)==`boolean`}function Pe(e){if(!(0,t.isRecord)(e))return typeof e;let n=Object.keys(e);return n.length===0?`{}`:`{ ${n.join(`, `)} }`}function Fe(e){let n=e.error,r=(0,t.isRecord)(n)?M(n,`code`):void 0,i=(0,t.isRecord)(n)?M(n,`message`):void 0;return{code:typeof r==`string`&&r!==``?r:`REMOTE_BAD_ENVELOPE`,message:typeof i==`string`?i:``}}async function U(e,r){let i=await e;if(!Ne(i))throw TypeError(`runtime remote returned a malformed envelope: ${Pe(i)}`);if(i.ok)return(0,t.parseOrThrow)(r,i.value,n.z.prettifyError);let a=Fe(i);throw Error(`${a.code}: ${a.message}`)}function Ie(e){let n,r=async()=>{let r=(0,t.remoteMounterOf)(e,!0);if(r===void 0)throw Error(`运行环境读面不可用:宿主网关没有提供 remote 服务`);try{n??=r.$mount({package:j,descriptors:H}),await n}catch(e){throw n=void 0,e}let i=e.get?.(P,!1);if(!Me(i))throw n=void 0,Error(`${P} 未提供:宿主网关没有挂上这枚命名空间`);return i};return{async status(){return U((await r()).status(),ke)},async install(e){return U((await r()).installPack({pack:e}),z)},async repair(e){return U((await r()).repairPack({pack:e}),z)},async cancel(e){return U((await r()).cancelJob({jobId:e}),z)}}}function Le(e){return typeof e.get==`function`?Ie(e):void 0}const W=`data:image/png;base64,${`iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAQAAAD41aSMAAATrElEQVR42u1dC3hVxbWGEN4PUUR8hFsvChbSFnsVBUWltiBy.BVtqbHn12vKS9KIEfCGvUKFUxSBCwAflYQVtBIVWRUQarw9oEVRKg6AUhFCEgMLlYSCB83ed5ORk55y9Z9bM3mefvU/2mk8k.5Ow5M+vfs2atNWutqYM6QUtmC1gQAKDYMvALzMab+Bs2YDkm0M8BAK618zAUb+MUqimEtbguAMCNdj7GoxhmtB8/CgBIPPvn.4jSs6FmkBwAksvXDbohoNZoGACSudcHHENMM1A0ASFQbgqMS9r+Jc4M9IFGtnfTtLyW1NNCCEtRa4XXIaCzqBQAkptUnxbNU.wv7DaB0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WQUJkJ8dtyby7I6Q0YBvYITS2PGqE+SiUIySyEbsdWiJPd0FKsGZki5nSyGjK79l4SrBwAcF0YJN4NF6z8wslTdr0+UD8vaLJJ1imHIN93JGr1prf9HaoxEYceG39cGioWFKZ9olu8IvD7R9/589RR5EYSHmdBs8j7Y6/Nn613oj22yuufydf3Kw+q9Q2Pvc4rFF+CUevlqdOp6melE+15aKR4a6J18kPnh7nqYLUTHetglofCBAAAAAIAABAAAIAAAAAEAAAgAAAAAcBo8zgT1XPHurF5F/w5AaQTe9KWIJwTQDWY/KHa0FFGAEwqkibP3kzdn7Gr7exPkwZfM8PfznUOAJvZod33jBIm/1/97292PKWHwT/VH6lMAWB3FsQA0OvTzt5veobaptr9+hAAvCh3+xTq8f2//xlT93ZtZQCA/XNA9nJM3qkbUc9U24y/L3ZoFpyvwndsFpxxnevUNfbnXOc6dIXxOdvRnTuvf5yz1VACwK5Cy5cZ0IxjHYAAAAAEAAAAABMAAAAIAABAAAAA2l//ANBt5HCfcxVrAAAAAElFTkSuQmCC`,K=`row.session`,q=`dsh-scrapling`,J=[`scrapling_fetch`,`scrapling_extract`,`scrapling_locate`,`scrapling_links`,`scrapling_render`,`scrapling_capture_xhr`,`scrapling_answer`,`scrapling_session_open`,`scrapling_session_fetch`,`scrapling_session_network`,`scrapling_session_state_save`,`scrapling_session_state_load`,`scrapling_session_list`,`scrapling_session_close`,`scrapling_crawl`,`scrapling_session_read`,`scrapling_session_act`,`scrapling_download`,`scrapling_read_document`,`scrapling_screenshot`];function Re(...e){for(let n of e){let e=(0,t.asDisplayText)(n);if(e!==``)return e}return``}function ze(e,n,r){let i=(0,t.asDisplayText)(n.selector);return{tool:e,title:i===``?e:`${e} ${i}`,fields:[{labelKey:`row.matched`,value:(0,t.asDisplayText)(r.count)}]}}function Be(e,n,r){let i=[],a=(0,t.asDisplayText)(n.baseUrl);return a!==``&&i.push({labelKey:`row.url`,value:a}),i.push({labelKey:`row.matched`,value:(0,t.asDisplayText)(r.count)}),{tool:e,title:e,fields:i}}function Ve(e,n){let r=[{labelKey:K,value:(0,t.asDisplayText)(n.sessionId)}],i=(0,t.asDisplayText)(n.name);return i!==``&&r.push({labelKey:`row.name`,value:i}),{tool:e,title:e,fields:r}}function He(e,n,r,i){return{tool:e,title:e,fields:[{labelKey:`row.start`,value:n},{labelKey:`row.pageCap`,value:(0,t.asDisplayText)(r.maxPages)},{labelKey:`row.job`,value:(0,t.asDisplayText)(i.jobId)}]}}function Ue(e,t,n){let r=[];t!==``&&r.push({labelKey:`row.url`,value:t});let i=n.statusCode;return typeof i==`number`&&r.push({labelKey:`row.http`,value:String(i)}),typeof n.truncated==`boolean`&&r.push({labelKey:`row.body`,value:``,valueKey:n.truncated?`row.truncated`:`row.notTruncated`}),{tool:e,title:e,fields:r}}function Y(e){return e>=500?`err`:e>=400?`warn`:`ok`}function X(e,n){if(e!==`result`||!(0,t.isRecord)(n))return`mute`;let r=typeof n.statusCode==`number`?n.statusCode:void 0;return r!==void 0&&r>=500?`err`:n.truncated===!0?`warn`:r===void 0?`mute`:Y(r)}function Z(e,n,r){let i=(0,t.isRecord)(n)?n:{},a=(0,t.isRecord)(r)?r:{},o=Re(a.url,i.url);return e===`scrapling_extract`||e===`scrapling_locate`?ze(e,i,a):e===`scrapling_links`?Be(e,i,a):e===`scrapling_session_list`?{tool:e,title:e,fields:[{labelKey:`row.sessionCount`,value:(0,t.asDisplayText)(a.count)}]}:e===`scrapling_session_open`?{tool:e,title:e,fields:[{labelKey:`row.type`,value:(0,t.asDisplayText)(i.sessionType)},{labelKey:K,value:(0,t.asDisplayText)(a.sessionId)}]}:e===`scrapling_session_close`?{tool:e,title:e,fields:[{labelKey:K,value:(0,t.asDisplayText)(i.sessionId)}]}:e===`scrapling_session_network`||e===`scrapling_session_state_save`||e===`scrapling_session_state_load`?Ve(e,i):e===`scrapling_crawl`?He(e,o,i,a):Ue(e,o,a)}const We=[`url`,`baseUrl`,`selector`,`sessionType`,`sessionId`,`name`,`maxPages`];function Q(e){if(e===void 0)return{};let t={};for(let n of We){let r=e.text(n),i=r===void 0||r.length===0?e.value(n):r;i!==void 0&&(t[n]=i)}return t}function $(e){return e.phase===`result`?e.block.meta:void 0}const Ge=`
9
9
  .dsh-scrapling-page{padding:4px 0 8px}
10
10
  .dsh-scrapling-icon{position:relative;display:inline-block;flex:none}
11
11
  .dsh-scrapling-iconLayer{position:absolute;inset:0;background-color:currentColor;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-image:url(${W});mask-image:url(${W})}
12
12
  .dsh-scrapling-iconAccent{position:absolute;inset:0;background-color:#B3FB2A;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;-webkit-mask-image:url(${G});mask-image:url(${G})}
13
- `;function Ze(n){let{toolName:r,block:i,inspect:a,t:o}=n,s=$(n),c=Q(r,Ye(i.args),s),l=(0,t.isRecord)(s)&&typeof s.statusCode==`number`?s.statusCode:void 0,u=l===void 0?void 0:X(l),d=(0,t.isRecord)(s)&&s.truncated===!0,f=Z(n.phase,s),p=l===void 0?void 0:(0,e.createElement)(t.Badge,{tone:X(l)},String(l)),m=c.fields.map(n=>(0,e.createElement)(t.ToolRowItem,{key:n.labelKey,label:o(n.labelKey),value:n.valueKey===void 0?n.value:o(n.valueKey),...n.labelKey===`row.http`&&u!==void 0?{tone:u}:{},...n.labelKey===`row.body`&&d?{tone:`warn`}:{}})),h=a===void 0?void 0:(0,e.createElement)(`button`,{type:`button`,className:`dsu-btn dsu-btnGhost dsu-btnSm`,onClick:()=>{a()}},o(`row.inspect`));return(0,e.createElement)(t.ToolRow,{name:c.title,phase:n.phase,tone:f,badge:p,foot:h},(0,e.createElement)(t.ToolRowGrid,null,...m))}function Qe(n){let{t:r,runtime:i}=n,[a,o]=(0,e.useState)(null);if((0,e.useEffect)(()=>{let e=!0;return(async()=>{if(i!==void 0)try{let t=await i.status();e&&o(t)}catch{}})(),()=>{e=!1}},[i]),i===void 0||a===null)return null;let s=l.filter(e=>a.packs[e]===`ready`).length,c=a.python.version===`unknown`?r(g(a.python.via)):a.python.version;return(0,e.createElement)(t.KpiGrid,null,(0,e.createElement)(t.KpiTile,{label:r(`panelPacks`),value:`${s}/${l.length}`}),(0,e.createElement)(t.KpiTile,{label:r(`panelPython`),value:c}))}const $e=[`slots`,`configForms`,`locale`];function et(t){let n=t.locale.bind(a),r=[];for(let i of J)r.push(t.slots.register({name:`tool.call.toolview`,key:i,locale:a},t=>(0,e.createElement)(Ze,{...t,t:n})));return()=>{for(let e of r)e()}}function tt(t){let n={width:t.size,height:t.size};return(0,e.createElement)(`span`,{className:`dsh-scrapling-icon`,style:n,"aria-hidden":!0,"data-scrapling-section-icon":t.active?`active`:`idle`},(0,e.createElement)(`span`,{className:`dsh-scrapling-iconLayer`,style:n}),(0,e.createElement)(`span`,{className:`dsh-scrapling-iconAccent`,style:n}))}function nt(t){return(0,e.createElement)(`div`,{className:`dsh-scrapling-page`},(0,e.createElement)(A,{view:`page`,t:t.t,form:t.form,runtime:t.runtime}))}exports.ROW_TOOLS=J,exports.apply=function(n){(0,t.claimApply)(n,`__dshScraplingToolviewApplied`,`dsh-scrapling toolview`)&&(n.effect(()=>{let e=ie();if(e===void 0)return()=>void 0;let t=oe(e),n=ae(e,`dsh-scrapling-row-css`,Xe);return()=>{t(),n()}},`dsh-scrapling: client styles`),n.effect(()=>{let e=c(),t=[n.locale.register(a,`zh`,e.zh),n.locale.register(a,`en`,e.en)],r;return n.slots.inject(`tool.call.toolview`,()=>{r=et(n)}),()=>{r?.();for(let e of t)e()}},`dsh-scrapling: dictionaries and tool rows`),n.effect(()=>{let t=n.configForms.get(`scrapling`),r=n.locale.bind(a),i={getSnapshot:()=>t.getSnapshot(),subscribe:e=>t.subscribe(e),mutate:(e,n)=>t.mutate(e,n)},o=Ve(n),s=()=>({t:r,form:i,runtime:o}),c;n.slots.inject(`plugins.bundle.config`,()=>{c=n.slots.register({name:`plugins.bundle.config`,key:`@jayyuen66/dsh-scrapling`,locale:a},t=>(0,e.createElement)(A,{...t,...s()}))}),n.slots.inject(`conversation.session.panel.section`,()=>{n.slots.register({name:`conversation.session.panel.section`,id:`scrapling-runtime`,order:140,label:()=>r(`navLabel`),inject:()=>({t:r,runtime:o})},Qe)});let l;n.slots.inject(`settings.section`,()=>{l=n.slots.register({name:`settings.section`,id:q,order:30,label:()=>r(`navLabel`),locale:a,inject:s},nt)});let u;return n.slots.inject(`settings.section.icon`,()=>{u=n.slots.register({name:`settings.section.icon`,id:q,order:30},tt)}),()=>{c?.(),l?.(),u?.()}},`dsh-scrapling: settings card`))},exports.buildRow=Q,exports.inject=$e,exports.readArgs=Ye,exports.resultMetaOf=$,exports.toolRowTone=Z;
13
+ `;function Ke(n){let{toolName:r,block:i,inspect:a,t:o}=n,s=$(n),c=Z(r,Q(i.args),s),l=(0,t.isRecord)(s)&&typeof s.statusCode==`number`?s.statusCode:void 0,u=l===void 0?void 0:Y(l),d=(0,t.isRecord)(s)&&s.truncated===!0,f=X(n.phase,s),p=l===void 0?void 0:(0,e.createElement)(t.Badge,{tone:Y(l)},String(l)),m=c.fields.map(n=>(0,e.createElement)(t.ToolRowItem,{key:n.labelKey,label:o(n.labelKey),value:n.valueKey===void 0?n.value:o(n.valueKey),...n.labelKey===`row.http`&&u!==void 0?{tone:u}:{},...n.labelKey===`row.body`&&d?{tone:`warn`}:{}})),h=a===void 0?void 0:(0,e.createElement)(`button`,{type:`button`,className:`dsu-btn dsu-btnGhost dsu-btnSm`,onClick:()=>{a()}},o(`row.inspect`));return(0,e.createElement)(t.ToolRow,{name:c.title,phase:n.phase,tone:f,badge:p,foot:h},(0,e.createElement)(t.ToolRowGrid,null,...m))}function qe(n){let{t:r,runtime:i}=n,[a,o]=(0,e.useState)(null);if((0,e.useEffect)(()=>{let e=!0;return(async()=>{if(i!==void 0)try{let t=await i.status();e&&o(t)}catch{}})(),()=>{e=!1}},[i]),i===void 0||a===null)return null;let s=l.filter(e=>a.packs[e]===`ready`).length,c=a.python.version===`unknown`?r(g(a.python.via)):a.python.version;return(0,e.createElement)(t.KpiGrid,null,(0,e.createElement)(t.KpiTile,{label:r(`panelPacks`),value:`${s}/${l.length}`}),(0,e.createElement)(t.KpiTile,{label:r(`panelPython`),value:c}))}const Je=[`slots`,`configForms`,`locale`];function Ye(t){let n=t.locale.bind(a),r=[];for(let i of J)r.push(t.slots.register({name:`tool.call.toolview`,key:i,locale:a},t=>(0,e.createElement)(Ke,{...t,t:n})));return()=>{for(let e of r)e()}}function Xe(t){let n={width:t.size,height:t.size};return(0,e.createElement)(`span`,{className:`dsh-scrapling-icon`,style:n,"aria-hidden":!0,"data-scrapling-section-icon":t.active?`active`:`idle`},(0,e.createElement)(`span`,{className:`dsh-scrapling-iconLayer`,style:n}),(0,e.createElement)(`span`,{className:`dsh-scrapling-iconAccent`,style:n}))}function Ze(t){return(0,e.createElement)(`div`,{className:`dsh-scrapling-page`},(0,e.createElement)(A,{view:`page`,t:t.t,form:t.form,runtime:t.runtime}))}exports.ROW_TOOLS=J,exports.apply=function(n){(0,t.claimApply)(n,`__dshScraplingToolviewApplied`,`dsh-scrapling toolview`)&&(n.effect(()=>{let e=re();if(e===void 0)return()=>void 0;let t=ae(e),n=ie(e,`dsh-scrapling-row-css`,Ge);return()=>{t(),n()}},`dsh-scrapling: client styles`),n.effect(()=>{let e=c(),t=[n.locale.register(a,`zh`,e.zh),n.locale.register(a,`en`,e.en)],r;return n.slots.inject(`tool.call.toolview`,()=>{r=Ye(n)}),()=>{r?.();for(let e of t)e()}},`dsh-scrapling: dictionaries and tool rows`),n.effect(()=>{let t=n.configForms.get(`scrapling`),r=n.locale.bind(a),i={getSnapshot:()=>t.getSnapshot(),subscribe:e=>t.subscribe(e),mutate:(e,n)=>t.mutate(e,n)},o=Le(n),s=()=>({t:r,form:i,runtime:o}),c;n.slots.inject(`plugins.bundle.config`,()=>{c=n.slots.register({name:`plugins.bundle.config`,key:`@jayyuen66/dsh-scrapling`,locale:a},t=>(0,e.createElement)(A,{...t,...s()}))}),n.slots.inject(`conversation.session.panel.section`,()=>{n.slots.register({name:`conversation.session.panel.section`,id:`scrapling-runtime`,order:140,label:()=>r(`navLabel`),inject:()=>({t:r,runtime:o})},qe)});let l;n.slots.inject(`settings.section`,()=>{l=n.slots.register({name:`settings.section`,id:q,order:30,label:()=>r(`navLabel`),locale:a,inject:s},Ze)});let u;return n.slots.inject(`settings.section.icon`,()=>{u=n.slots.register({name:`settings.section.icon`,id:q,order:30},Xe)}),()=>{c?.(),l?.(),u?.()}},`dsh-scrapling: settings card`))},exports.buildRow=Z,exports.inject=Je,exports.readArgs=Q,exports.resultMetaOf=$,exports.toolRowTone=X;
14
14
  return module.exports;
15
15
  },
16
16
  });
package/docs/DETAIL.md CHANGED
@@ -1,53 +1,44 @@
1
1
  # Scrapling web scraping
2
2
 
3
- Fetches and extracts web pages — JavaScript rendering, CSS/XPath extraction with self-healing selectors, sessions with login state, a background crawler and page question-answering — all served by one resident Python process.
3
+ Fetches and extracts web pages — JavaScript rendering, CSS/XPath extraction with self-healing selectors, sessions with login state, a background crawler and page question-answering — all served by one resident Python process whose cookies, browser pages and selector fingerprints stay alive across every call.
4
4
 
5
- ## What the card changes
5
+ ![One resident Python sidecar behind the dsh host: the tool surface, SidecarClient, and the Scrapling layers](images/architecture.svg)
6
6
 
7
- Card values grouped by purpose. The ones read on every call take effect on the next tool call: the extraction knobs (`extractionType`, `mainContentOnly`, `stripInlineImages`), the browser knobs (`headless`, `networkIdle`, `blockAds`, `pierceShadow`, `waitSelectorState`), the five output budgets, `crawlMaxItems`, `fetchTimeoutMs`, the answer route (`answerProvider` / `answerModel` / `answerMaxTokens`), the shared content-reading strategy (`webFetchStrategy`), and the search-provider values (`searchBackend`, the per-vendor keys, `searxngEndpoint`, `searchPublicFallback`, `searchMaxOutputBytes`). The values read once when the plugin is assembled need it assembled again — restart the host. That set is: the sixteen tool switches, `provideWebFetch` / `provideWebSearch`, `pythonBin`, `failFastOnMissingPython`, `dataDir`, `sidecarHandshakeTimeoutMs` / `sidecarGraceMs`, and the URL-gate / sidecar-environment values (`proxyUrl`, `proxyBypass`, `allowedHosts`, `nat64Prefixes`, `syntheticDnsRanges`).
7
+ ## How a fetch picks its path
8
8
 
9
- - **Runtime** — `pythonBin` (empty) chooses the interpreter: an explicit path wins, then the managed capability install's **venv** (`dataDir/runtime/venv`, where every wheel lives), then the bare managed CPython under `dataDir/runtime/python/<version>` (an install that stopped halfway), then this package's development venv, then `python3` on PATH (`python` on Windows). The managed leg is only tried on macOS arm64 — the one platform with a verified capability pack — and every other platform goes straight from the explicit path to the venv and PATH legs. The plugin logs which one it picked every time. `failFastOnMissingPython` (on) refuses to load when the sidecar cannot start; an interpreter that starts but lacks Scrapling always degrades to "tools unavailable" and names the path. `dataDir` is where the sidecar's state lives.
10
- - **Tool switches** — sixteen of them (fetch, extract, locate, links, render, capture XHR, network history, session, session state, crawl, answer, session read, session actions, download, documents, screenshot). Turning one off removes that tool from the model's view, and its guidance line disappears from the skill body too; what stays resident in the system prompt is one cross-tool selection summary (naming no specific tool), while the full text is recomputed at composition time against the tools actually registered and registered as the virtual skill `scrapling`.
11
- - **Extraction and output** — `extractionType` (markdown/html/text), `mainContentOnly`, `stripInlineImages` (on) and the per-tool output budgets: `fetchMaxOutputChars`, `extractMaxOutputChars`, `renderMaxOutputChars` and `documentMaxOutputChars` default to 200000, `xhrMaxOutputChars` to 120000. The host trims that number as UTF-8 **bytes**; the same number goes to the sidecar as `maxContentChars`, which clips by **characters** — so the tighter of the two is what you see. `crawlMaxItems` (1000) caps pages, not output size.
12
- - **Browser** — `headless` (on), `networkIdle` (off), `blockAds` (on, about 3500 domains), `pierceShadow` (off), `waitSelectorState`.
13
- - **Timeouts and recycling** — `fetchTimeoutMs` (120000), `sidecarHandshakeTimeoutMs` (30000), `sidecarGraceMs` (5000).
14
- - **Network and safety** — `proxyUrl` (shown masked), `proxyBypass`, `allowedHosts`, `syntheticDnsRanges`, `nat64Prefixes`, plus the search backends (`searchBackend`, per-vendor API keys, `searxngEndpoint`, `deepseekSearchEndpoint`, `searchPublicFallback` off by default). `deepseek` uses optional Host `ctx.deepseekAuth`; its endpoint is deployment-level HTTPS without embedded credentials.
15
- - **Web content fetching** — `webFetchStrategy` defaults to `auto`: read statically first and render only when the body is under 200 characters. `static` never renders; `browser` renders directly. Without a browser, `auto` stays static. Network and protocol failures remain failures instead of triggering rendering.
16
- - **Search quality** — source URLs are canonicalized and deduplicated, provider metadata is preserved, and successful discovery is cached for 300 seconds with a 128-entry bound. Cache keys never contain API-key values or authorization headers. MCP search accepts `offset` (0–100); supported backends use native pagination, while DeepSeek requests up to 50 results and slices locally. `searchMaxOutputBytes` (default 24000) caps the aggregate UTF-8 body bytes and can be raised on the card. The direct DeepSeek branch paces at 5 requests per second per provider instance. Discovery requests share the fetch proxy policy; Bing selects `zh-hans` or `en` from the query language and decodes its redirect URLs.
17
- - **Page question-answering** — `answerProvider`, `answerModel`, `answerMaxTokens` (2000).
9
+ Start static, escalate only when the page demands it:
18
10
 
19
- ## Some card switches need a second switch
11
+ ![Tool selection: static first, render on demand, and six special cases](images/tool-selection.svg)
20
12
 
21
- `provideWebFetch` and `provideWebSearch` on the card are not enough by themselves: the deployment side must also select this plugin as the host's fetch and search provider. The same pairing applies to session actions (`allowBrowserActions`), downloads (`allowFileDownloads`, with `downloadMaxBytes` sizing a single file) and login state (`sessionStateDir` — while it is empty the save/load tools are not registered at all). A card switch alone will look like it does nothing.
13
+ The built-in `web_fetch` / `web_search` can also run through this plugin: the shared reading strategy is `webFetchStrategy` — `static` never renders; `auto` reads statically first and renders only when the body is under 200 characters; `browser` renders directly. Without a browser, `auto` stays static. Network and protocol failures remain failures instead of triggering rendering.
22
14
 
23
- ## Browser sessions, ARIA and drag
15
+ ## What the card covers
24
16
 
25
- - `sessionType=remote` is available only when the sidecar supports `RemoteSession` and deployment config sets `browserCdpUrl` to a ws/wss/http/https endpoint. It connects to an existing Chromium and creates an isolated context without requiring local Chromium; closing the session releases that context and connection. The endpoint is deployment-only and never enters model input.
26
- - `scrapling_session_read` accepts `snapshotType: "text" | "aria"` (default `text`). ARIA uses Patchright's AI-mode accessibility snapshot and supports `cssSelector`, making controls easier to locate than in raw DOM text.
27
- - `scrapling_session_act` accepts `type: "drag"` with either `from`/`to` selectors or `fromX`/`fromY`/`toX`/`toY` coordinates. The two forms cannot be mixed. `allowBrowserActions` and the URL guard still apply.
17
+ Every settings field explains itself on the **scrapling** card — grouped by purpose, each with a one-line "what changes if you edit this", in the host's language. The card is the reference; there is no second list to cross-read. Values read on every call take effect on the next tool call; values read once at assembly need the host assembled again.
18
+
19
+ A few card switches pair with a deployment-side setting before they do anything: `provideWebFetch` / `provideWebSearch` need `fetchProvider` / `searchProvider` pointed at this plugin, session actions and downloads need `allowBrowserActions` / `allowFileDownloads`, and login-state save / load needs `sessionStateDir`.
28
20
 
29
21
  ## Deployment values stay off the card
30
22
 
31
- They change how the plugin is wired, not what a session decides, and each takes effect only on restart. The ones you are most likely to meet:
23
+ They wire the plugin rather than steer a session, are read once at assembly, and changing one means a restart:
32
24
 
33
- - `integrationMode` — `native` registers the tools with the host; `mcp` serves the same tool table over MCP instead; `official-mcp` does neither: on a host exposing `mcpManager` it registers the upstream server dynamically, and otherwise it only carries the upstream server's `dsh-mcp-client` entry. The three are mutually exclusive and are read once at assembly, so switching means restarting.
34
- - `mcpPort` (default 39217) must equal the URL in the profile's MCP-client entry. Neither command reads `mcpPort`, so pass it yourself: `setup --mode mcp --port <mcpPort>` and `doctor --mode mcp --port <mcpPort>`. Without `--port`, setup writes the default 39217 and doctor has no expected port to compare against — a profile left on another port then passes silently.
35
- - `mcpToolLoading` (default `eager`) is passed to dynamic registration and manual entries as `toolLoading`. `on-demand` keeps tool definitions out of each agent's tool list; the prompt catalogs raw names and description first lines, and `mcp__scrapling__load_tools` loads only what the calling agent needs. Loaded tools do not appear in subagents, forks or resumed sessions. Changing it requires a restart; manual entries must also be regenerated with `setup --mode --profile` and reapplied.
36
- - `officialMcpEnabled` (off) needs both this switch and the `setup` `--accept-risk` flag before any entry is generated, because the upstream server exposes actions this plugin's guard does not see.
37
- - `allowWriteMethods` (off) — reading pages is this plugin's job; changing remote state is not, so that is a deployment statement.
38
- - Also here: browser binary path, CDP endpoint, real-Chrome and DNS-over-HTTPS options, Redis URL and adaptive storage, the crawler's runtime/robots/delay/concurrency/strategy/checkpoint settings, and the search endpoints.
25
+ - `integrationMode` — `native` (default) registers the twenty tools with the host; `mcp` serves the same tool table over MCP instead; `official-mcp` registers neither and hooks the upstream `scrapling-mcp` server — dynamically via `mcpManager`, or as a `dsh-mcp-client` entry on CLI/headless hosts. It runs in its own process with its own sessions and **without this plugin's URL guard**.
26
+ - `mcpToolLoading` (default `eager`) reaches both dynamic registration and manual entries as `toolLoading`. `on-demand` keeps tool definitions out of each agent's tool list; the prompt catalogs raw names plus description first lines, and `mcp__scrapling__load_tools` loads only what the calling agent needs. Subagents, forks and resumed sessions start empty; manual entries must also be regenerated with `setup --mode --profile`.
27
+ - `officialMcpEnabled` (off) plus the `setup` `--accept-risk` flag are both required before an official entry is generated, because the upstream server exposes actions this plugin's guard does not see.
28
+ - `allowWriteMethods` (off) — reading pages is this plugin's job; changing remote state is a deployment statement.
29
+ - The rest — browser binary path, CDP endpoint, real-Chrome and DNS-over-HTTPS, Redis and adaptive storage, crawler politeness, search endpoints — is listed in the package README's deployment table.
39
30
 
40
31
  Write them in the `config:` block of this plugin's row in `cordis.patch.yml`.
41
32
 
42
33
  ## What it needs from outside
43
34
 
44
- Python and Scrapling come from one of two places: the `core` capability pack installs a managed CPython 3.14.9 under `dataDir/runtime/python/<version>` and then creates `dataDir/runtime/venv` from it, putting Scrapling 0.5.1 and every other wheel into that venv (the sidecar runs the venv's interpreter, not the bare one), or you point `pythonBin` at an interpreter you built yourself — the plugin never installs into your system interpreter. Capability packs exist only on macOS arm64; on any other platform the pack actions refuse (`INSTALL_PACK_BLOCKED`) and the interpreter really is yours to provide. Chromium comes from `python -m patchright install chromium`. Packs are installed as host jobs in layers — `core`, `browser`, `search`, `media`, `documents`, `adaptive-redis`, `mcp` — and the plugin is usable with only `core`, which is why the tool surface can be partial. The optional `documents` pack adds hash-locked pypdf 7.1.1; without it the sidecar still starts and only `scrapling_read_document` is absent. When the chosen interpreter starts but has no Scrapling, the tool list is empty and the **load-time warning** names the exact `pip install` line (it is not part of the tool guidance text); that is a prerequisite statement, not a packaging defect. Search backends differ: Tavily, Brave and Serper need their own key, SearXNG needs an instance URL, while `bing` and `duckduckgo` are public endpoints that need no credential — and `auto` only reaches a public engine once `searchPublicFallback` is on. `adaptiveStorage: redis` needs a reachable Redis.
35
+ Python and Scrapling come from one of two places: the `core` capability pack installs a managed CPython 3.14.9 and a venv holding Scrapling 0.5.1 and every pinned wheel, or you point `pythonBin` at an interpreter you built yourself — the plugin never installs into your system interpreter. Capability packs exist only on **macOS arm64**; on any other platform every pack reports `blocked` and the interpreter really is yours to provide. Chromium comes from `python -m patchright install chromium`; the `documents` pack adds pinned pypdf for `scrapling_read_document`. Search backends: Tavily, Brave and Serper need their own key, SearXNG needs an instance URL, `bing` and `duckduckgo` are public, and `auto` only reaches a public engine once `searchPublicFallback` is on.
45
36
 
46
- Failures are named, not hidden: `SIDECAR_*`, `INSTALL_*`, `SEARCH_AUTH`, `JOBS_UNAVAILABLE`, `SESSION_STATE_DISABLED`, `MCP_PORT_IN_USE` / `MCP_PORT_MISMATCH` / `MCP_PORT_UNREADABLE` / `MCP_MODE_CONFLICT` / `MCP_CLIENT_MISSING` / `MCP_CLIENT_MANIFEST_BROKEN`, `OFFICIAL_MCP_DISABLED`, `RISK_NOT_ACCEPTED`. An MCP token is read from `DSH_SCRAPLING_MCP_TOKEN` in the host's environment only — never from the profile file, which is plain text.
37
+ Failures are named, not hidden: `SIDECAR_*`, `INSTALL_*`, `SEARCH_AUTH`, `JOBS_UNAVAILABLE`, `SESSION_STATE_DISABLED`, `OFFICIAL_MCP_DISABLED`, `RISK_NOT_ACCEPTED`. An MCP token is read from `DSH_SCRAPLING_MCP_TOKEN` in the host's environment only — never from the profile file, which is plain text.
47
38
 
48
39
  ## Further detail
49
40
 
50
- The sidecar protocol, capability-pack installer internals, offline assets and the security model are in the package README (`README.md` / `README.zh-CN.md`).
41
+ The sidecar protocol, capability-pack installer internals, the proxy resolution order, the security model and the full deployment table are in the package README (`README.md` / `README.zh-CN.md`).
51
42
 
52
43
  ## Feedback
53
44
 
package/docs/DETAIL.zh.md CHANGED
@@ -1,56 +1,47 @@
1
1
  # Scrapling 网页抓取
2
2
 
3
- 抓取与结构化抽取网页——JS 渲染、CSS/XPath 抽取、选择器自愈、带登录态的会话、后台爬虫与页面问答,全部由一个常驻 Python 进程提供。
3
+ 抓取与结构化抽取网页——JS 渲染、CSS/XPath 抽取、选择器自愈、带登录态的会话、后台爬虫与页面问答,全部由一个常驻 Python 进程提供,cookie、浏览器页面池与选择器指纹库跨请求保活。
4
4
 
5
- ## 设置卡上改的是什么
5
+ ![dsh 宿主背后一个常驻 Python sidecar:工具面、SidecarClient 与 Scrapling 各层](images/architecture.zh.svg)
6
6
 
7
- 卡上的取值按用途分组。每次调用现读的那些,改完下一次调用就生效:抽取类(`extractionType`、`mainContentOnly`、`stripInlineImages`)、浏览器类(`headless`、`networkIdle`、`blockAds`、`pierceShadow`、`waitSelectorState`)、五个输出预算、`crawlMaxItems`、`fetchTimeoutMs`、问答路由(`answerProvider` / `answerModel` / `answerMaxTokens`)、两条正文读取路径共用的策略(`webFetchStrategy`),以及搜索侧(`searchBackend`、各家 key、`searxngEndpoint`、`searchPublicFallback`、`searchMaxOutputBytes`)。只在装配时读一次、改完要让插件重新装配(重启宿主即可)的是:十六个工具开关、`provideWebFetch` / `provideWebSearch`、`pythonBin`、`failFastOnMissingPython`、`dataDir`、`sidecarHandshakeTimeoutMs` / `sidecarGraceMs`,以及闸门与 sidecar 进程环境那几项(`proxyUrl`、`proxyBypass`、`allowedHosts`、`nat64Prefixes`、`syntheticDnsRanges`)。
7
+ ## 一次抓取怎么选路径
8
8
 
9
- - **运行环境** — `pythonBin`(留空)决定用哪个解释器:显式路径优先,其次托管能力包装出来的那个 **venv**(`dataDir/runtime/venv`,所有 wheel 都在里面),再次 `dataDir/runtime/python/<版本>` 下的裸托管 CPython(装了一半的机器),然后是本包的开发 venv,最后落回 PATH 上的 `python3`(Windows 上是 `python`)。托管那一档只在 macOS arm64 上尝试——有已验能力包的就这一个平台——其余平台从显式路径直接跳到 venv 与 PATH。每次都会播报选中的是哪一支。`failFastOnMissingPython`(默认开)让 sidecar 起不来时直接拒绝装载;而解释器起得来但没装 Scrapling 时,一律降级成「工具不可用」并在日志里点名路径。`dataDir` 是 sidecar 状态的位置。
10
- - **工具开关** — 十六个(fetch、extract、locate、links、render、capture XHR、会话网络历史、session、登录态、crawl、answer、session read、页面动作、download、documents、screenshot)。关掉一个就是模型看不见它,它那句指引也跟着从 skill 正文里消失;常驻 system prompt 里只留一段跨工具的选型摘要(不点名具体工具),全文按装配时真注册了哪些工具现算后注册成虚拟 skill `scrapling`。
11
- - **抽取与输出** — `extractionType`(markdown/html/text)、`mainContentOnly`、`stripInlineImages`(默认开),以及各工具的输出预算:`fetchMaxOutputChars`、`extractMaxOutputChars`、`renderMaxOutputChars`、`documentMaxOutputChars` 默认 200000,`xhrMaxOutputChars` 默认 120000。宿主侧按 UTF-8 **字节**裁剪,同一个数值交给 sidecar 时叫 `maxContentChars`,那边按**字符**截——两处谁更紧就按谁收。`crawlMaxItems`(1000)管的是页数,不是输出大小。
12
- - **浏览器** — `headless`(默认开)、`networkIdle`(默认关)、`blockAds`(默认开,约 3500 个域名)、`pierceShadow`(默认关)、`waitSelectorState`。
13
- - **超时与回收** — `fetchTimeoutMs`(120000)、`sidecarHandshakeTimeoutMs`(30000)、`sidecarGraceMs`(5000)。
14
- - **网络与安全** — `proxyUrl`(显示时遮蔽)、`proxyBypass`、`allowedHosts`、`syntheticDnsRanges`、`nat64Prefixes`,以及搜索侧的 `searchBackend`、各家 API key、`searxngEndpoint`、`deepseekSearchEndpoint`、`searchPublicFallback`(默认关)。`deepseek` 使用可选 Host `ctx.deepseekAuth`;端点为部署级 HTTPS,禁止内嵌凭据。
15
- - **网页正文读取** — `webFetchStrategy` 默认 `auto`:先静态读取,正文少于 200 字符时才渲染。`static` 从不渲染;`browser` 直接渲染。没有浏览器时 `auto` 保持静态读取。网络错误与协议错误仍按失败返回,不触发渲染。
16
- - **搜索质量** — 来源 URL 归一化并去重,保留后端元数据,成功发现结果缓存 300 秒、最多 128 项。缓存键绝不包含 API key 值或授权头。MCP search 接受 `offset`(0–100):支持者使用原生分页,DeepSeek 一次最多取 50 条后在本地切片。`searchMaxOutputBytes`(默认 24000)限制全部正文小节的 UTF-8 字节总数,可在卡上调大。DeepSeek 直接调用按每个 provider 实例每秒 5 次节流。发现请求与抓取共用代理策略;Bing 按查询语言选择 `zh-hans` 或 `en`,并解包跳板 URL。
17
- - **页面问答** — `answerProvider`、`answerModel`、`answerMaxTokens`(2000)。
9
+ 先静态,页面逼你升级时才升级:
18
10
 
19
- ## 有些卡上开关还要配一道部署侧的开关
11
+ ![工具选型:先静态、按需渲染,外加六种特殊情形](images/tool-selection.zh.svg)
20
12
 
21
- 卡上的 `provideWebFetch` 与 `provideWebSearch` 单独拨过去不够:部署侧还得把本插件选成宿主的 fetch / search 提供方,否则 dsh 自带的那一份仍会接管。页面动作(`allowBrowserActions`)、下载(`allowFileDownloads`,单次大小由 `downloadMaxBytes` 管)与登录态(`sessionStateDir`,留空时存/取那两个工具根本不注册)三档同理。只看卡上会以为开关坏了。
13
+ 内置的 `web_fetch` / `web_search` 也可以经本插件执行:两条路径共用的正文读取策略是 `webFetchStrategy`——`static` 只静态抓取;`auto` 先静态抓取,正文少于 200 字符时才渲染;`browser` 直接渲染。没有浏览器时 `auto` 保持静态抓取。网络错误与协议违例按失败返回,不把它当成渲染理由。
22
14
 
23
- ## 浏览器会话、ARIA 与拖放
15
+ ## 设置卡上有什么
24
16
 
25
- - 只有 sidecar 支持 `RemoteSession` 且部署配置填了 `browserCdpUrl`(ws/wss/http/https 端点)时,`sessionType=remote` 才可用。它连接已有 Chromium 并创建独立 context,不需要本机 Chromium;关闭会话会释放该 context 与连接。端点只从部署配置来,绝不进入模型入参。
26
- - `scrapling_session_read` 接受 `snapshotType: "text" | "aria"`(默认 `text`)。ARIA 使用 Patchright 的 AI 模式无障碍快照,并支持 `cssSelector`,比原始 DOM 文本更容易定位控件。
27
- - `scrapling_session_act` 接受 `type: "drag"`,端点可选 `from`/`to` 选择器,或 `fromX`/`fromY`/`toX`/`toY` 坐标;两种写法不能混用。`allowBrowserActions` 与 URL 守卫仍然生效。
17
+ 每一枚设置项都在 **scrapling** 卡上自带说明——按用途分组,每组一项「改了会怎样」的一句话提示,语言跟随宿主。卡片就是说明本体,没有第二份清单要对读。每次调用现读的取值,改完下一次调用就生效;只在装配时读一次的,改完要让宿主重新装配。
18
+
19
+ 少数卡上开关要先有部署侧的对应表态才起作用:`provideWebFetch` / `provideWebSearch` 要部署配置把 `fetchProvider` / `searchProvider` 指到本插件;会话动作与下载要 `allowBrowserActions` / `allowFileDownloads`;登录态存取要 `sessionStateDir`。
28
20
 
29
21
  ## 部署值留在卡外
30
22
 
31
- 它们改的是本插件怎么接进宿主,不是某次会话该怎么走,而且都要重启才生效。最可能遇到的是这几项:
23
+ 它们决定插件怎么接线,而不是某次会话怎么走;只在装配时读一次,改完要重启:
32
24
 
33
- - `integrationMode` — `native` 把工具注册进宿主;`mcp` 改为把同一份工具表交给 MCP;`official-mcp` 两者都不做:宿主有 `mcpManager` 时动态注册上游 server,没有时只引入上游 server 的 `dsh-mcp-client` 条目。三档互斥,且只在装配时读一次,切换必须重启。
34
- - `mcpPort`(默认 39217)要与 profile 里 MCP 客户端条目的 URL 同值。这两条命令都不读 `mcpPort`,要自己带上:`setup --mode mcp --port <mcpPort>` 与 `doctor --mode mcp --port <mcpPort>`。不带 `--port` 时,setup 按默认的 39217 生成,doctor 也没有期望端口可比——profile 停在别的端口上照样一声不响地过。
35
- - `mcpToolLoading`(默认 `eager`)在动态注册与手工条目里都写成 `toolLoading`。`on-demand` 让工具定义先不进入各 agent 的工具列表;提示词只列原始名称与描述首行,由 `mcp__scrapling__load_tools` 加载调用方 agent 需要的工具。已加载工具不会出现在子 agent、fork 或恢复的会话里。改完必须重启;手工条目还要用 `setup --mode --profile` 重新生成并应用。
36
- - `officialMcpEnabled`(默认关)需要这一档加上 `setup` 的 `--accept-risk` 同一次表态才生成条目,因为上游 server 暴露的动作不归本插件的守卫看。
37
- - `allowWriteMethods`(默认关)——读网页是这插件的本职,改对端状态不是,所以这一档属于部署表态。
38
- - 同一档位的还有:浏览器二进制路径、CDP 端点、真 Chrome 与 DNS-over-HTTPS 选项、Redis 地址与自适应存储、爬虫的运行时/robots/延时/并发/策略/checkpoint、各家搜索端点。
25
+ - `integrationMode`——`native`(默认)把二十个工具注册给宿主;`mcp` 把同一份工具表改经 MCP 提供;`official-mcp` 两样都不做,只接上游的 `scrapling-mcp`——宿主有 `mcpManager` 时动态注册,CLI/headless 宿主则落成一条 `dsh-mcp-client` 条目。它跑在自己的进程里、用自己的会话,**不经本插件的 URL 闸门**。
26
+ - `mcpToolLoading`(默认 `eager`)同时交给动态注册与手工条目作 `toolLoading`。`on-demand` 把工具定义挡在各 agent 的工具列表之外:提示词里只列裸名与描述首行,模型经 `mcp__scrapling__load_tools` 按需加载。子代理、fork 与恢复的会话从空表开始;手工条目还要用 `setup --mode --profile` 重新生成。
27
+ - `officialMcpEnabled`(关)与 `setup` 的 `--accept-risk` 两项表态齐备才会生成官方条目——上游 server 暴露的动作不经本插件的闸门。
28
+ - `allowWriteMethods`(关)——读网页是本插件的本职,改对端状态是部署方的表态。
29
+ - 其余——浏览器二进制路径、CDP 端点、真 Chrome 与 DNS-over-HTTPS、Redis 与 adaptive 存储、爬虫礼仪、搜索端点——列在包内 README 的部署表里。
39
30
 
40
- 这些都写在本插件注册行的 `config:` 块里。
31
+ 写入位置是 `cordis.patch.yml` 里本插件那一行的 `config:` 块。
41
32
 
42
- ## 需要外部提供什么
33
+ ## 外部依赖
43
34
 
44
- Python 与 Scrapling 有两个来源:`core` 能力包先在 `dataDir/runtime/python/<版本>` 下装一份托管的 CPython 3.14.9,再用它建出 `dataDir/runtime/venv`,Scrapling 0.5.1 与其余 wheel 全装进那个 venv(sidecar 跑的是 venv 里的解释器,不是裸的那一支);或者把 `pythonBin` 指向你自己装好的解释器——本插件从不动你的系统解释器。能力包只在 macOS arm64 提供,其他平台上一律拒绝安装(`INSTALL_PACK_BLOCKED`),那时 Python 才真是「由你提供」。Chromium 由 `python -m patchright install chromium` 装。能力包按层作为宿主作业安装——`core`、`browser`、`search`、`media`、`documents`、`adaptive-redis`、`mcp`;只有 `core` 时插件照用,所以工具这一层本来就可以是不完整的。可选的 `documents` 包加入哈希锁定的 pypdf 7.1.1;没装时 sidecar 照常启动,只少 `scrapling_read_document`。选中的解释器起得来但里面没 Scrapling 时工具表为空,可照抄的 `pip install` 命令写在**装载时的告警**里(不在工具提示词段落里)——那是「装之前要做的一件事」,不是产物缺陷。搜索后端分三类:Tavily、Brave、Serper 要各自的 key,SearXNG 要实例地址,而 `bing` 与 `duckduckgo` 是公共端点、不要凭据;`auto` 只有在打开 `searchPublicFallback` 之后才会走公共引擎。`adaptiveStorage: redis` 要连得上的 Redis。
35
+ Python 与 Scrapling 来自两个来源之一:`core` 能力包装好托管 CPython 3.14.9 与一个 venv(Scrapling 0.5.1 与全部钉版 wheel 都在里面),或者你把 `pythonBin` 指到自己装的解释器——插件绝不写你的系统解释器。能力包只在 **macOS arm64** 提供;其他平台上每个包都报 `blocked`,解释器真的要自己给。Chromium 来自 `python -m patchright install chromium`;`documents` 能力包补钉版的 pypdf 给 `scrapling_read_document`。搜索后端:Tavily、Brave、Serper 各要自己的 key,SearXNG 要实例地址,`bing` 与 `duckduckgo` 是公开端点,而 `auto` 只在 `searchPublicFallback` 打开后才会碰公共引擎。
45
36
 
46
- 失败是被点名的,不是被藏起来的:`SIDECAR_*`、`INSTALL_*`、`SEARCH_AUTH`、`JOBS_UNAVAILABLE`、`SESSION_STATE_DISABLED`、`MCP_PORT_IN_USE` / `MCP_PORT_MISMATCH` / `MCP_PORT_UNREADABLE` / `MCP_MODE_CONFLICT` / `MCP_CLIENT_MISSING` / `MCP_CLIENT_MANIFEST_BROKEN`、`OFFICIAL_MCP_DISABLED`、`RISK_NOT_ACCEPTED`。MCP 的 token 只从宿主环境变量 `DSH_SCRAPLING_MCP_TOKEN` 读,绝不写进 profile——那份文件是明文。
37
+ 失败都有名字,不会被藏起来:`SIDECAR_*`、`INSTALL_*`、`SEARCH_AUTH`、`JOBS_UNAVAILABLE`、`SESSION_STATE_DISABLED`、`OFFICIAL_MCP_DISABLED`、`RISK_NOT_ACCEPTED`。MCP token 只从宿主环境变量 `DSH_SCRAPLING_MCP_TOKEN` 读——绝不从 profile 文件读,那是明文。
47
38
 
48
- ## 更完整的说明
39
+ ## 更多细节
49
40
 
50
- sidecar 协议、能力包安装器内部、离线资产与安全模型都写在随包 README(`README.md` / `README.zh-CN.md`)。
41
+ sidecar 协议、能力包安装器内幕、代理解析顺序、安全模型与完整的部署表都在包内 README(`README.md` / `README.zh-CN.md`)。
51
42
 
52
43
  ## 反馈
53
44
 
54
- 欢迎提 issue 和 PR:[https://github.com/JayYuen666/dsh-scrapling/issues](https://github.com/JayYuen666/dsh-scrapling/issues)。
45
+ 欢迎提 issue 与 PR:[https://github.com/JayYuen666/dsh-scrapling/issues](https://github.com/JayYuen666/dsh-scrapling/issues)。
55
46
 
56
- 插件启动失败时,请附上 dsh 宿主版本、profile 安装形态和浏览器控制台原文。`missed the module table` 这一行尤其有用:它能直接说明 shared 客户端供应行有没有被物化。
47
+ 插件起不来时请附上 dsh 宿主版本、profile 安装形态与浏览器控制台那行报错。`missed the module table` 这一句尤其有用:它说明 shared 客户端供应行有没有被物化。