@jayyuen66/dsh-scrapling 0.1.13 → 0.1.15

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
@@ -5,132 +5,18 @@ window.__ModuleLoader__.load({
5
5
  "use strict";
6
6
  var module = { exports: {} };
7
7
  var exports = module.exports;
8
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react"),t=require("zod");function n(e,t=30){return e.length<=t?{hint:e}:{detail:e}}function r(t){return(0,e.createElement)(`div`,{className:`dsu-form`},t.children)}function i(t){return(0,e.createElement)(`section`,{className:`dsu-section`},(0,e.createElement)(`h2`,{className:`dsu-sectionTitle`},t.title),t.hint===void 0?null:(0,e.createElement)(`p`,{className:`dsu-sectionHint`},t.hint),t.children)}function a(t){if(t.items.length===0)return null;let n=t.items.map((t,n)=>(0,e.createElement)(`span`,{key:n},n===0?t:`· ${t}`));return(0,e.createElement)(`div`,{className:`dsu-statusbar`},...n)}function o(){return`happyDOM`in globalThis?!1:typeof CSS<`u`&&typeof CSS.supports==`function`&&CSS.supports(`position-area: block-end`)}function s(e,t){let n=Math.abs(t.left-e.left)<=2,r=Math.abs(t.right-e.right)<=2;if(!n&&!r)return!0;let i=t.top>=e.bottom-2,a=t.bottom<=e.top+2;return!i&&!a}function c(t){let n=(0,e.useId)(),r=`--dsu-tip-${n.replaceAll(/[^a-zA-Z0-9]/gu,``)}`,[i,a]=(0,e.useState)(!1),c=(0,e.useRef)(!1),l=(0,e.useRef)(!1),u=(0,e.useRef)(!1),d=(0,e.useRef)(null),f=(0,e.useRef)(null),p=(0,e.useRef)(null),m=(0,e.useRef)(null),h=(0,e.useCallback)(()=>{m.current!==null&&(clearTimeout(m.current),m.current=null)},[]),g=(0,e.useCallback)(()=>{let e=f.current,t=p.current;
9
- /* v8 ignore next 3 -- place 只在 open 的 layout effect 与挂载期监听器里调用;refs 为空只可能是卸载竞态 */
10
- if(e===null||t===null)return;let n=o()&&t.style.positionArea!==`none`,r=e.getBoundingClientRect();if(n&&!s(r,t.getBoundingClientRect()))return;n&&(t.style.positionArea=`none`),t.style.marginTop=`0px`;let i=t.offsetWidth,a=t.offsetHeight,{left:c}=r,l=r.bottom+8;l+a>window.innerHeight-8&&(l=r.top-a-8),c+i>window.innerWidth-8&&(c=window.innerWidth-i-8);let u=Math.max(8,window.innerWidth-i-8),d=Math.max(8,window.innerHeight-a-8);t.style.left=`${Math.min(Math.max(8,c),u)}px`,t.style.top=`${Math.min(Math.max(8,l),d)}px`},[]),_=(0,e.useCallback)(()=>{h(),u.current=!1,a(!1)},[h]),v=(0,e.useCallback)(()=>{h(),a(!0)},[h]),y=(0,e.useCallback)(()=>{h(),c.current||l.current||u.current||(m.current=setTimeout(()=>{
11
- /* v8 ignore next 3 -- 任何重新进入/钉住都会 cancelHide;这次复查只防未来的异步路径 */
12
- m.current=null,c.current||l.current||u.current||a(!1)},120))},[h]),b=(0,e.useCallback)(e=>{u.current=e},[]);(0,e.useLayoutEffect)(()=>{if(!i)return()=>{};g();let e=e=>{let{target:t}=e;t instanceof Node&&p.current?.contains(t)===!0||(u.current?g():_())},t=()=>{g()},n=e=>{let t=e.target;d.current?.contains(t)!==!0&&_()};return document.addEventListener(`pointerdown`,n,!0),window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,t),()=>{document.removeEventListener(`pointerdown`,n,!0),window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,t)}},[i,t.detail,g,_]),(0,e.useEffect)(()=>{if(!i)return()=>{};let e=e=>{e.key===`Escape`&&_()};return document.addEventListener(`keydown`,e),()=>{document.removeEventListener(`keydown`,e)}},[i,_]),(0,e.useEffect)(()=>h,[h]);let x=(0,e.createElement)(`button`,{ref:f,type:`button`,className:`dsu-helpBtn`,style:{anchorName:r},"aria-label":`${t.label} 说明`,"aria-expanded":i,"aria-controls":n,onClick:()=>{u.current?_():(b(!0),v())}},(0,e.createElement)(`svg`,{width:12,height:12,viewBox:`0 0 14 14`,"aria-hidden":!0},(0,e.createElement)(`circle`,{cx:7,cy:7,r:6,fill:`none`,stroke:`currentColor`,strokeWidth:1.2}),(0,e.createElement)(`path`,{d:`M7 6.2v4`,stroke:`currentColor`,strokeWidth:1.3,strokeLinecap:`round`}),(0,e.createElement)(`circle`,{cx:7,cy:4.3,r:.8,fill:`currentColor`}))),S=(0,e.createElement)(`div`,{ref:p,id:n,role:`tooltip`,className:`dsu-tip`,style:{positionAnchor:r,positionTryFallbacks:`flip-block, flip-inline`},hidden:!i},t.detail),C=t.showLabel===!1?null:(0,e.createElement)(`span`,{className:`dsu-label${t.compact===!0?` dsu-labelMono`:``}`},t.label);return(0,e.createElement)(`span`,{ref:d,className:`dsu-help`,onMouseEnter:()=>{c.current=!0,v()},onMouseLeave:()=>{c.current=!1,y()},onFocus:()=>{l.current=!0,v()},onBlur:e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||(l.current=!1,y())}},C,x,S)}function l(t){let n=`dsu-label${t.compact===!0?` dsu-labelMono`:``}`,r=t.controlId===void 0?(0,e.createElement)(`span`,{className:n},t.label):(0,e.createElement)(`label`,{className:n,htmlFor:t.controlId},t.label);return(0,e.createElement)(`div`,{className:`dsu-labelRow`},r,t.detail===void 0?null:(0,e.createElement)(c,{label:t.label,detail:t.detail,showLabel:!1}))}function u(t){let n=t.controlId===void 0?void 0:`${t.controlId}-hint`;return(0,e.createElement)(`div`,{className:`dsu-field${t.wide===!0?` dsu-fieldWide`:``}`},(0,e.createElement)(`div`,{className:`dsu-fieldMeta`},(0,e.createElement)(l,{label:t.label,detail:t.detail,compact:t.compact,controlId:t.controlId}),t.hint===void 0?null:(0,e.createElement)(`p`,{className:`dsu-hint`,id:n},t.hint)),(0,e.createElement)(`div`,{className:`dsu-control`},t.children))}function d(t){let n=(0,e.useId)(),r=t.hint===void 0?void 0:`${n}-hint`;return(0,e.createElement)(u,{...t,controlId:n},(0,e.createElement)(`button`,{type:`button`,role:`switch`,id:n,className:`dsu-switch`,"aria-checked":t.checked,"aria-describedby":r,"data-field":t.field,disabled:t.disabled===!0,onClick:()=>{t.onChange(!t.checked)}},(0,e.createElement)(`span`,{className:`dsu-knob`})))}function f(t){let[n,r]=(0,e.useState)(t.value),[i,a]=(0,e.useState)(!1),o=(0,e.useId)(),s=t.hint===void 0?void 0:`${o}-hint`;(0,e.useEffect)(()=>{i||r(t.value)},[t.value,i]);let c={id:o,className:`dsu-input${t.multiline===!0?` dsu-textarea`:``}${t.monospace===!0?` dsu-mono`:``}`,value:n,placeholder:t.placeholder,"aria-describedby":s,"data-field":t.field,disabled:t.disabled===!0,onFocus:()=>{a(!0)},onBlur:()=>{a(!1)},onChange:e=>{r(e.target.value),t.onChange(e.target.value)}};return(0,e.createElement)(u,{...t,controlId:o},t.multiline===!0?(0,e.createElement)(`textarea`,c):(0,e.createElement)(`input`,c))}function p(t){let[n,r]=(0,e.useState)(!1),[i,a]=(0,e.useState)(0),c=(0,e.useRef)(null),l=(0,e.useRef)(null),d=(0,e.useId)(),f=(0,e.useId)(),p=`--dsu-${f.replaceAll(/[^a-zA-Z0-9]/gu,``)}`,m=t.hint===void 0?void 0:`${f}-hint`,{disabled:h,value:g,options:_,onChange:v}=t,y=(0,e.useMemo)(()=>_.map((e,t)=>({option:e,index:t})).filter(e=>e.option.disabled!==!0),[_]),b=_.find(e=>e.value===g)?.label??g,x=_[i],S=x!==void 0&&x.disabled!==!0,C=(0,e.useCallback)(()=>{let e=c.current,t=l.current;
13
- /* v8 ignore next 3 -- place 只在 open 的 layout effect 里调用;refs 为空只可能是卸载竞态 */
14
- if(e===null||t===null)return;let n=e.getBoundingClientRect(),r=Math.min(n.width,window.innerWidth-16);t.style.width=`${r}px`;let i=o()&&t.style.positionArea!==`none`;if(i&&!s(n,t.getBoundingClientRect()))return;i&&(t.style.positionArea=`none`),t.style.marginTop=`0px`;let{left:a}=n;a+r>window.innerWidth-8&&(a=window.innerWidth-r-8);let u=t.offsetHeight,d=n.bottom+6;d+u>window.innerHeight-8&&(d=n.top-u-6);let f=Math.max(8,window.innerWidth-r-8),p=Math.max(8,window.innerHeight-u-8);t.style.left=`${Math.min(Math.max(8,a),f)}px`,t.style.top=`${Math.min(Math.max(8,d),p)}px`},[]),w=(0,e.useCallback)(()=>{r(!1)},[]),T=(0,e.useCallback)(()=>{if(h===!0)return;let e=y.find(e=>e.option.value===g)??y.at(0);e!==void 0&&(a(e.index),r(!0))},[h,g,y]),E=(0,e.useCallback)(e=>{
15
- /* v8 ignore next 3 -- 浮层只能经由 openMenu 打开;组件禁用时打不开 */
16
- if(h===!0)return;let t=_[e];
17
- /* v8 ignore next 3 -- disabled 选项在浏览器里不派发 click;越界下标由调用方保证 */
18
- t!==void 0&&t.disabled!==!0&&(v(t.value),w(),c.current?.focus())},[h,_,v,w]),D=(0,e.useCallback)(e=>{let t=y.findIndex(e=>e.index===i);
19
- /* v8 ignore next 5 -- open 时归一 effect 已保证 enabled 非空且 active 落在可用项上 */
20
- if(t===-1||y.length===0)return;let n=(t+e+y.length)%y.length,r=y[n];
21
- /* v8 ignore next 3 -- next 由取模保证在界内 */
22
- r!==void 0&&a(r.index)},[i,y]);(0,e.useLayoutEffect)(()=>{if(!n)return()=>{};C();let e=e=>{let t=e.target;l.current?.contains(t)!==!0&&c.current?.contains(t)!==!0&&w()},t=e=>{let{target:t}=e;t instanceof Node&&l.current?.contains(t)===!0||w()},r=()=>{C()};return document.addEventListener(`pointerdown`,e,!0),window.addEventListener(`scroll`,t,!0),window.addEventListener(`resize`,r),()=>{document.removeEventListener(`pointerdown`,e,!0),window.removeEventListener(`scroll`,t,!0),window.removeEventListener(`resize`,r)}},[n,t.options,C,w]),(0,e.useEffect)(()=>{if(!n)return;if(h===!0||y.length===0){w();return}if(y.some(e=>e.index===i))return;let e=y.find(e=>e.option.value===g)??y.at(0);
23
- /* v8 ignore next 3 -- enabled 非空在上一分支已保证 */
24
- e!==void 0&&a(e.index)},[n,h,g,_,i,w,y]),(0,e.useLayoutEffect)(()=>{if(!n)return;let e=l.current;
25
- /* v8 ignore next 2 -- 同上,menu 在 open 的 commit 之后必然已挂上 */
26
- if(e===null)return;let t=e.querySelector(`[data-active="true"]`);
27
- /* v8 ignore next 2 -- active 已由归一 effect 保证落在可用项上 */
28
- t!==null&&(t.offsetTop<e.scrollTop?e.scrollTop=t.offsetTop:t.offsetTop+t.offsetHeight>e.scrollTop+e.clientHeight&&(e.scrollTop=t.offsetTop+t.offsetHeight-e.clientHeight))},[n,i,_]);let O=e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(e.preventDefault(),!n){T();return}D(e.key===`ArrowDown`?1:-1)}else if(e.key===`Home`||e.key===`End`){if(e.preventDefault(),n||T(),y.length===0)return;let t=e.key===`Home`?y.at(0):y.at(-1);
29
- /* v8 ignore next 3 -- enabled 为空已在上一条返回 */
30
- if(t===void 0)return;a(t.index)}else if(e.key===`Enter`||e.key===` `){if(e.preventDefault(),!n){T();return}E(i)}else(e.key===`Tab`||e.key===`Escape`)&&w()},k=[],A;for(let[n,r]of _.entries())r.group!==A&&(r.group!==void 0&&k.push((0,e.createElement)(`div`,{key:`group-${n}-${r.group}`,className:`dsu-optionGroup`,role:`presentation`},r.group)),A=r.group),k.push((0,e.createElement)(`button`,{key:`option-${r.value}`,type:`button`,role:`option`,id:`${d}-${n}`,className:`dsu-option`,tabIndex:-1,"aria-selected":r.value===t.value,"data-active":n===i,disabled:r.disabled===!0,onMouseDown:e=>{e.preventDefault()},onClick:()=>{E(n)},onMouseEnter:()=>{
31
- /* v8 ignore next -- happy-dom 对 disabled 元素不派发 mouse 事件;浏览器实现各有差异,保留禁用检查 */
32
- r.disabled!==!0&&a(n)}},(0,e.createElement)(`span`,null,r.label),(0,e.createElement)(`svg`,{className:`dsu-check`,width:14,height:14,viewBox:`0 0 14 14`,"aria-hidden":!0},(0,e.createElement)(`path`,{d:`M2.5 7.5l3 3 6-7`,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`}))));return(0,e.createElement)(u,{...t,controlId:f},(0,e.createElement)(`div`,{className:`dsu-selectWrap`,onBlur:e=>{let t=e.relatedTarget;t instanceof Node&&e.currentTarget.contains(t)||w()}},(0,e.createElement)(`button`,{ref:c,type:`button`,id:f,style:{anchorName:p},className:`dsu-select dsu-input`,role:`combobox`,"aria-haspopup":`listbox`,"aria-expanded":n,"aria-controls":`${d}-list`,"aria-activedescendant":n&&S?`${d}-${i}`:void 0,"aria-describedby":m,"data-field":t.field,disabled:h===!0||_.length===0,onClick:()=>{n?w():T()},onKeyDown:O},(0,e.createElement)(`span`,{className:`dsu-selectValue`},b),(0,e.createElement)(`svg`,{className:`dsu-chevron`,width:14,height:14,viewBox:`0 0 14 14`,"aria-hidden":!0},(0,e.createElement)(`path`,{d:`M3 5l4 4 4-4`,fill:`none`,stroke:`currentColor`,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`}))),(0,e.createElement)(`div`,{ref:l,id:`${d}-list`,role:`listbox`,className:`dsu-menu`,style:{positionAnchor:p,positionTryFallbacks:`flip-block, flip-inline`},"aria-label":t.label,hidden:!n},...k)))}function m(t){let n=!t.writable||t.busy||!t.dirty,r;return r=t.error===null?t.writable?t.dirty?t.dirtyLabel:t.cleanLabel:t.readOnlyLabel:t.error,(0,e.createElement)(`div`,{className:`dsu-savebar`,"data-dirty":t.dirty},(0,e.createElement)(`button`,{type:`button`,className:`dsu-btn dsu-btnPrimary`,"data-field":`save`,disabled:n,onClick:t.onSave},t.busy?t.savingLabel:t.saveLabel),(0,e.createElement)(`button`,{type:`button`,className:`dsu-btn`,"data-field":`discard`,disabled:n,onClick:t.onDiscard},t.revertLabel),(0,e.createElement)(`span`,{role:`status`,className:t.error===null?`dsu-status`:`dsu-status dsu-statusError`},r))}const h=e=>e.length>0&&!(e in Object.prototype);function g(e,t,n){n===void 0?e[t]=void 0:Object.defineProperty(e,t,n)}function _(e,t,n){if(!h(t))throw Error(`claimApply 的 flag 不得为空、也不得命中 Object.prototype 的成员(__proto__ 一类会让占位静默失灵或遮蔽全局成员):${t}`);let r=globalThis,i=Object.hasOwn(r,t)?r[t]:void 0;if(i===!0||typeof i==`symbol`)return!1;let a=Object.getOwnPropertyDescriptor(r,t),o=Symbol(t);r[t]=o;try{e.effect(()=>()=>{r[t]===o&&g(r,t,a)},n)}catch(e){throw r[t]===o&&g(r,t,a),e}return!0}function v(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const y=[{id:`runtime`,title:{zh:`运行环境`,en:`Runtime`},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:`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:`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:`searchBackend`,kind:`enum`,options:[`auto`,`tavily`,`bing`,`brave`,`serper`,`duckduckgo`,`searxng`],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}]}],b=y.flatMap(e=>e.fields);b.map(e=>e.key);const x=`dshScrapling`,S={zh:{navLabel:`scrapling 抓取`,save:`保存`,saving:`保存中…`,undo:`撤销`,reveal:`显示`,conceal:`隐藏`,statusLoading:`正在读取设置…`,statusReadonly:`这个连接以只读方式运行,设置改不了。`,statusClean:`没有未保存的改动`,statusChanged:`已改动 {count} 项,未保存`,statusInvalid:`有 {count} 项填得不合法,改好后才能保存`,rejected:`保存被宿主拒绝了,设置未改动。常见原因:这一条目的配置被部署 patch 或命令行 overlay 压制(此时写下的值会在下次启动被覆盖回,宿主因此拒绝),或值没有通过 schema 校验。`,stale:`设置已经被别处改过,请重新打开这张卡再保存`,failed:`保存失败:{reason}`,runtimeTitle:`运行环境`,runtimeHint:`能力包装在数据目录的 runtime/ 下;安装是后台作业,关掉这张卡也会继续。`,runtimeUnavailable:`宿主没有提供远程读面;请在终端运行:`,runtimeJobsMissing:`这个 profile 没有作业后端;请在终端运行:`,runtimeInstall:`安装`,runtimeRepair:`修复`,runtimeCancel:`取消`,runtimePython:`解释器`,runtimeDataDir:`数据目录`,runtimeJobRunning:`正在安装 {pack}…`,runtimeJobEnded:`安装结束:{status}`,runtimeError:`安装失败:{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.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}`,runtimeTitle:`Runtime`,runtimeHint:`Capability packs live under runtime/ in the data directory; installs run as background jobs and keep going when this page closes.`,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`,runtimeJobRunning:`Installing {pack}…`,runtimeJobEnded:`Install finished: {status}`,runtimeError:`Install 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.adaptive-redis":`Adaptive storage (Redis)`,"runtime.pack.mcp":`MCP (unverified)`}},C={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":`已截断`},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`}};function w(){let e={zh:{...S.zh,...C.zh},en:{...S.en,...C.en}};for(let t of y){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 T=[`core`,`browser`,`search`,`media`,`adaptive-redis`,`mcp`];new Set(T);const E=[`ready`,`missing`,`corrupt`,`installing`,`blocked`],D=[`running`,`stopping`,`completed`,`killed`,`failed`],O=[400,404,409,500,503];function k(e){return`runtime.state.${e}`}function A(e){return`runtime.pack.${e}`}const ee={status:`loading`,writable:!1};function te(){return ee}function ne(){return()=>void 0}function j(e){return typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):``}function re(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 j(a);let o=t?.[e.key];return o===void 0?String(e.fallback):j(o)}const ie=t.z.enum([`true`,`false`]),ae=t.z.string().regex(/^[1-9]\d*$/u).transform(Number);function oe(e,n){let r=t.z.url().safeParse(n);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 se(e,n){if(e.kind===`boolean`){let e=ie.safeParse(n);return e.success?{kind:`value`,value:e.data===`true`}:{kind:`invalid`}}let r=n.trim();if(r===``)return{kind:`clear`};if(e.kind===`number`){let e=ae.safeParse(r);return e.success?{kind:`value`,value:e.data}:{kind:`invalid`}}if(e.kind===`enum`){let n=t.z.string().refine(t=>(e.options??[]).includes(t),{error:`取值不在字段选项内`}).safeParse(r);return n.success?{kind:`value`,value:n.data}:{kind:`invalid`}}return e.format===`url`?oe(e,r):{kind:`value`,value:r}}function ce(e){return b.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 M=`dsu-btn`,N=`dsu-hint`;function le(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 ue(){let e=Reflect.get(globalThis,`document`);return le(e)?e:void 0}function P(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 de(e){return P(e,`dsh-scrapling-settings-css`,`
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:`Runtime`},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:`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:`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:`searchBackend`,kind:`enum`,options:[`auto`,`tavily`,`bing`,`brave`,`serper`,`duckduckgo`,`searxng`],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}`,runtimeTitle:`运行环境`,runtimeHint:`能力包装在数据目录的 runtime/ 下;安装是后台作业,关掉这张卡也会继续。`,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}`,runtimeError:`安装失败:{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.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}`,runtimeTitle:`Runtime`,runtimeHint:`Capability packs live under runtime/ in the data directory; installs run as background jobs and keep going when this page closes.`,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}`,runtimeError:`Install 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.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":`已截断`},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`}};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`,`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`;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 D(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 ie(e){let n=(0,t.ensureCardUiCss)(e),r=D(e,`dsh-scrapling-settings-css`,`
33
9
  .dss-secret{display:flex;gap:8px;align-items:center;width:100%}
34
10
  .dss-reveal{flex:none;white-space:nowrap}
35
11
  .dss-packs{display:flex;flex-direction:column;gap:8px}
36
12
  .dss-pack{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:4px 12px;align-items:center}
37
13
  .dss-packActions{display:flex;gap:6px;grid-column:2;justify-content:flex-end}
38
- .dss-command{display:block;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-3);padding:6px 8px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;word-break:break-all}
39
- .dss-job{margin:0;max-height:180px;overflow:auto;border:.5px solid var(--dsw-alias-border-l3);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-3);padding:6px 8px;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12px;white-space:pre-wrap}
40
-
41
-
42
- .dsu-form{display:flex;flex-direction:column}
43
- .dsu-section{margin-top:24px;padding-top:24px;border-top:.5px solid var(--dsw-alias-border-l1)}
44
- .dsu-form>.dsu-section:first-child{margin-top:0;padding-top:0;border-top:0}
45
- .dsu-sectionTitle{margin:0;font-size:15px;font-weight:600;line-height:1.4;color:var(--dsw-alias-label-primary)}
46
- .dsu-sectionHint{margin:4px 0 0;font-size:12px;line-height:1.5;color:var(--dsw-alias-label-tertiary)}
47
- .dsu-statusbar{display:flex;flex-wrap:wrap;gap:4px 8px;margin-top:8px;font-size:12px;line-height:1.5;color:var(--dsw-alias-label-tertiary)}
48
- .dsu-field{display:grid;grid-template-columns:minmax(0,1fr) minmax(240px,360px);column-gap:32px;align-items:center;padding:12px 0;border-top:.5px solid var(--dsw-alias-border-l2)}
49
- .dsu-fieldMeta{display:flex;flex-direction:column;gap:4px;min-width:0}
50
- .dsu-labelRow{display:flex;align-items:center;gap:6px;min-width:0}
51
- .dsu-label{font-size:13px;font-weight:500;line-height:1.5;color:var(--dsw-alias-label-primary)}
52
- .dsu-labelMono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px}
53
- .dsu-hint{margin:0;font-size:12px;line-height:1.5;color:var(--dsw-alias-label-tertiary)}
54
- .dsu-control{min-width:0;display:flex;align-items:center;gap:8px}
55
- .dsu-fieldWide{grid-template-columns:minmax(0,1fr);align-items:start}
56
- .dsu-fieldWide .dsu-control{width:100%;max-width:720px;margin-top:2px}
57
- .dsu-help{display:inline-flex;align-items:center;gap:6px;min-width:0}
58
- .dsu-helpBtn{appearance:none;border:0;background:transparent;padding:0;width:16px;height:16px;display:inline-flex;align-items:center;justify-content:center;color:var(--dsw-alias-label-tertiary);cursor:help;border-radius:50%;flex:none}
59
- .dsu-help:hover .dsu-helpBtn,.dsu-helpBtn:focus-visible{color:var(--dsw-alias-label-primary)}
60
- .dsu-helpBtn:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}
61
- .dsu-tip{width:max-content;position:fixed;position-area:block-end span-inline-end;justify-self:start;margin-top:8px;z-index:60;box-sizing:border-box;max-width:min(340px,calc(100vw - 16px));max-height:calc(100vh - 16px);overflow:auto;overflow-wrap:anywhere;padding:10px 12px;border-radius:10px;background:var(--dsw-alias-bg-layer-2);border:.5px solid var(--dsw-alias-border-l3);box-shadow:0 12px 32px rgb(0 0 0 / 45%);font-size:12px;line-height:1.6;font-weight:400;color:var(--dsw-alias-label-secondary)}
62
- .dsu-input{width:100%;height:34px;padding:0 12px;border:.5px solid var(--dsw-alias-border-l4);border-radius:var(--dsw-radius-md);background:var(--dsw-alias-bg-layer-3);color:var(--dsw-alias-label-primary);font:inherit;font-size:13px}
63
- .dsu-input:focus-visible{outline:none;border-color:var(--dsw-alias-state-business-primary)}
64
- .dsu-input[aria-invalid="true"]{border-color:var(--dsw-alias-state-error-primary)}
65
- .dsu-input:disabled{color:var(--dsw-alias-label-tertiary);cursor:not-allowed}
66
- .dsu-input::placeholder{color:var(--dsw-alias-label-tertiary)}
67
- .dsu-textarea{height:auto;min-height:96px;padding:8px 12px;line-height:1.6;resize:vertical}
68
- .dsu-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
69
- .dsu-numberWrap{display:flex;flex-direction:column;gap:4px;width:100%;min-width:0}
70
- .dsu-number{display:flex;align-items:center;gap:8px;min-width:0}
71
- .dsu-number .dsu-input{min-width:0}
72
- .dsu-unit{flex:none;font-size:12px;color:var(--dsw-alias-label-tertiary)}
73
- .dsu-error{margin:0;font-size:12px;line-height:1.5;color:var(--dsw-alias-state-error-primary)}
74
- .dsu-switch{appearance:none;width:36px;height:20px;border-radius:999px;border:0;padding:2px;background:var(--dsw-alias-border-l3);display:flex;align-items:center;cursor:pointer;flex:none;transition:background-color .16s}
75
- .dsu-knob{width:16px;height:16px;border-radius:50%;background:var(--dsw-alias-label-primary);transition:transform .16s,background-color .16s}
76
- .dsu-switch[aria-checked="true"]{background:var(--dsw-alias-label-primary)}
77
- .dsu-switch[aria-checked="true"] .dsu-knob{transform:translateX(16px);background:var(--dsw-alias-label-primary-foreground)}
78
- .dsu-switch:disabled{opacity:.4;cursor:not-allowed}
79
- .dsu-switch:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:2px}
80
- .dsu-selectWrap{position:relative;width:100%;min-width:0}
81
- .dsu-select{display:flex;align-items:center;justify-content:space-between;gap:8px;text-align:left;cursor:pointer}
82
- .dsu-select[aria-expanded="true"]{border-color:var(--dsw-alias-state-business-primary)}
83
- .dsu-selectValue{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
84
- .dsu-chevron{flex:none;color:var(--dsw-alias-label-tertiary);transition:transform .16s}
85
- .dsu-select[aria-expanded="true"] .dsu-chevron{transform:rotate(180deg)}
86
- .dsu-menu{position:fixed;position-area:block-end span-inline-end;justify-self:start;margin-top:6px;z-index:70;padding:4px;background:var(--dsw-alias-bg-layer-2);border:.5px solid var(--dsw-alias-border-l3);border-radius:12px;box-shadow:0 12px 32px rgb(0 0 0 / 50%);max-height:280px;overflow:auto}
87
- .dsu-option{appearance:none;border:0;background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;line-height:1.4;width:100%;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:8px 10px;border-radius:8px;cursor:pointer;text-align:left}
88
- .dsu-option:hover,.dsu-option[data-active="true"]{background:var(--dsw-alias-bg-layer-3)}
89
- .dsu-option:disabled{color:var(--dsw-alias-label-tertiary);cursor:not-allowed}
90
- .dsu-option:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:-2px}
91
- .dsu-optionGroup{padding:6px 10px 2px;font-size:11px;font-weight:600;color:var(--dsw-alias-label-tertiary)}
92
- .dsu-check{opacity:0;flex:none}
93
- .dsu-option[aria-selected="true"] .dsu-check{opacity:1}
94
- .dsu-savebar{display:flex;align-items:center;gap:8px;padding:12px 0;margin-top:24px;border-top:.5px solid var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base)}
95
- .dsu-savebar[data-dirty="true"]{position:sticky;bottom:0;z-index:2;box-shadow:0 -12px 24px rgb(0 0 0 / 35%)}
96
- .dsu-btn{appearance:none;border:.5px solid var(--dsw-alias-border-l2);background:transparent;color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;line-height:1.5;border-radius:var(--dsw-radius-md);padding:5px 14px;cursor:pointer;transition:background-color .12s,border-color .12s,color .12s,filter .12s}
97
- .dsu-btn:hover:not(:disabled){background:var(--dsw-alias-bg-layer-2);border-color:var(--dsw-alias-border-l3)}
98
- .dsu-btn:active:not(:disabled){background:var(--dsw-alias-bg-layer-1)}
99
- .dsu-btn:focus-visible{outline:2px solid var(--dsw-alias-state-business-primary);outline-offset:1px}
100
- .dsu-btn:disabled{opacity:.4;cursor:not-allowed}
101
- .dsu-btnPrimary{background:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-primary);color:var(--dsw-alias-bg-layer-3)}
102
- .dsu-btnPrimary:hover:not(:disabled){background:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-primary);filter:brightness(.9)}
103
- .dsu-btnPrimary:active:not(:disabled){background:var(--dsw-alias-label-primary);border-color:var(--dsw-alias-label-primary);filter:brightness(.84)}
104
- .dsu-btnDanger{color:var(--dsw-alias-state-error-primary)}
105
- .dsu-btnDanger:hover:not(:disabled){color:var(--dsw-alias-state-error-primary);border-color:var(--dsw-alias-state-error-primary);background:var(--dsw-alias-bg-layer-2)}
106
- .dsu-status{margin-left:auto;font-size:12px;color:var(--dsw-alias-label-tertiary)}
107
- .dsu-statusError{color:var(--dsw-alias-state-error-primary)}
108
- .dsu-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(200px,100%),1fr));gap:0 24px}
109
- .dsu-grid>.dsu-field{display:flex;flex-direction:column;align-items:stretch;gap:6px;padding:10px 0;border-top:.5px solid var(--dsw-alias-border-l1)}
110
- .dsu-grid>.dsu-field .dsu-control{width:100%}
111
- @media (max-width:640px){
112
- .dsu-field{grid-template-columns:minmax(0,1fr);align-items:start}
113
- .dsu-control{width:100%;max-width:720px}
114
- .dsu-section{margin-top:20px;padding-top:20px}
115
- }
116
- @media (prefers-reduced-motion:reduce){
117
- .dsu-switch,.dsu-knob,.dsu-chevron,.dsu-btn{transition:none}
118
- }
119
- `)}function fe(e,t){return e.secret===!0&&!t?`password`:`text`}function pe(t){let{field:n,label:r,shown:i,disabled:a,revealed:o,onReveal:s,t:c,onChange:l}=t,u=(0,e.createElement)(`input`,{type:fe(n,o),autoComplete:`off`,spellCheck:!1,className:`dsu-input`,value:i,disabled:a,"data-field":n.key,"aria-label":r,onChange:e=>{l(e.target.value)}}),d=(0,e.createElement)(`button`,{type:`button`,className:`dsu-btn dss-reveal`,disabled:a,"aria-pressed":o,"aria-label":r,onClick:()=>{s()}},c(o?`conceal`:`reveal`));return(0,e.createElement)(`div`,{className:`dss-secret`},u,d)}function me(t){let{field:n,label:r,shown:i,disabled:a,onChange:o}=t;return(0,e.createElement)(`input`,{type:`text`,inputMode:`numeric`,className:`dsu-input`,value:i,disabled:a,"data-field":n.key,"aria-label":r,onChange:e=>{o(e.target.value)}})}function he(t){let{field:r,t:i,shown:a,disabled:o,revealed:s,onReveal:c,onChange:l}=t,m=i(`field.${r.key}.label`),h={label:m,...n(i(`field.${r.key}.hint`)),field:r.key,disabled:o};return r.kind===`boolean`?(0,e.createElement)(d,{...h,checked:a===`true`,onChange:e=>{l(String(e))}}):r.kind===`enum`?(0,e.createElement)(p,{...h,value:a,options:(r.options??[]).map(e=>({value:e,label:e})),onChange:l}):r.secret===!0?(0,e.createElement)(u,h,pe({field:r,label:m,shown:a,disabled:o,revealed:s,onReveal:c,t:i,onChange:l})):r.kind===`number`?(0,e.createElement)(u,h,me({field:r,label:m,shown:a,disabled:o,onChange:l})):(0,e.createElement)(f,{...h,value:a,onChange:l})}function ge(t){let{group:n,t:r,shown:a,disabled:o,revealed:s,onReveal:c,onChange:l}=t;return(0,e.createElement)(i,{title:r(`group.${n.id}.title`),hint:r(`group.${n.id}.note`)},n.fields.map(e=>he({field:e,t:r,shown:a(e),disabled:o,revealed:s(e),onReveal:()=>{c(e)},onChange:t=>{l(e,t)}})))}function _e(e,t,n,r){return t.status===`loading`?e(`statusLoading`):r>0?e(`statusInvalid`,{count:r}):t.status===`unavailable`||!t.writable?e(`statusReadonly`):n===0?e(`statusClean`):e(`statusChanged`,{count:n})}const F={values:{},baseRevision:void 0,invalid:[],invalidText:{}};function ve(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?F:{...e,values:n,baseRevision:void 0}}function ye(t){let{t:n,saving:r,editable:i,changed:a,invalid:o,onSave:s,onUndo:c}=t;return(0,e.createElement)(m,{dirty:a>0&&o===0,busy:r,writable:i,error:o>0?n(`statusInvalid`,{count:o}):null,saveLabel:n(`save`),savingLabel:n(`saving`),revertLabel:n(`undo`),dirtyLabel:n(`statusChanged`,{count:a}),cleanLabel:n(`statusClean`),readOnlyLabel:n(`statusReadonly`),onSave:s,onDiscard:c})}function be(t){let[n,r]=(0,e.useState)(null),[i,a]=(0,e.useState)(``),[o,s]=(0,e.useState)(``),c=(0,e.useRef)(0),l=(0,e.useCallback)(async()=>{if(t===void 0)return;c.current+=1;let e=c.current;try{let n=await t.status();if(e!==c.current)return;r(n),s(``)}catch(t){if(e!==c.current)return;s(String(t))}},[t]),u=n?.job?.status===`running`||n?.job?.status===`stopping`;return(0,e.useEffect)(()=>{t!==void 0&&l()},[t,l]),(0,e.useEffect)(()=>{let e;return t!==void 0&&u&&(e=setInterval(()=>{l()},2e3)),()=>{e!==void 0&&clearInterval(e)}},[t,u,l]),{snapshot:n,busy:i,failure:o,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 l():s(r.error)}catch(e){s(String(e))}finally{a(``)}})())},[t,l]),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 l():s(n.error)}catch(e){s(String(e))}finally{a(``)}})())},[t,l,n])}}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`:k(r)),d=i(A(n)),f=a||o||r===null||r===`blocked`||r===`installing`,p=[(0,e.createElement)(`button`,{type:`button`,className:M,key:`install`,disabled:f||r===`ready`,onClick:()=>{c(n,`install`)}},i(`runtimeInstall`)),(0,e.createElement)(`button`,{type:`button`,className:M,key:`repair`,disabled:f||r===`missing`,onClick:()=>{c(n,`repair`)}},i(`runtimeRepair`))];return o&&s===n&&p.push((0,e.createElement)(`button`,{type:`button`,className:M,key:`cancel`,disabled:a,onClick:l},i(`runtimeCancel`))),(0,e.createElement)(`div`,{className:`dss-pack`,key:n},(0,e.createElement)(`div`,null,(0,e.createElement)(`div`,{className:`dsu-label`},d),(0,e.createElement)(`p`,{className:N},u)),(0,e.createElement)(`div`,{className:`dss-packActions`},...p))}function Se(t){let{reader:n,t:r,snapshot:a,busy:o,failure:s,onAct:c,onCancel:l}=t,u=(0,e.createElement)(`code`,{className:`dss-command`},`dsh-scrapling setup --feature <pack> --apply`),d=s===``?null:(0,e.createElement)(`p`,{className:`${N} dsu-error`,role:`alert`},r(`runtimeError`,{reason:s}));if(n===void 0)return(0,e.createElement)(i,{title:r(`runtimeTitle`),hint:r(`runtimeHint`)},(0,e.createElement)(`p`,{className:N},r(`runtimeUnavailable`)),u);let f=a?.jobsReady??!1,p=a?.job??null,m=p!==null&&(p.status===`running`||p.status===`stopping`),h=a===null?null:(0,e.createElement)(`p`,{className:N},`${r(`runtimePython`)}: ${a.python.path} (${a.python.via})`,(0,e.createElement)(`br`),`${r(`runtimeDataDir`)}: ${a.dataDir}`),g=p===null?``:r(A(p.pack)),_=p===null?null:(0,e.createElement)(`p`,{className:N},m?r(`runtimeJobRunning`,{pack:g}):r(`runtimeJobEnded`,{status:p.status})),v=p===null||p.output===``?null:(0,e.createElement)(`pre`,{className:`dss-job`},p.output),y=o!==``||!f||a===null,b=T.map(e=>xe({pack:e,state:a?.packs[e]??null,t:r,disabled:y,running:m,activePack:p?.pack??null,onAct:c,onCancel:l})),x=a!==null&&!f?(0,e.createElement)(`div`,null,(0,e.createElement)(`p`,{className:N},r(`runtimeJobsMissing`)),u):null;return(0,e.createElement)(i,{title:r(`runtimeTitle`),hint:r(`runtimeHint`)},h,d,_,v,(0,e.createElement)(`div`,{className:`dss-packs`},...b),x)}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=>ve(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 I(t){let{form:n,t:i}=t,[o,s]=(0,e.useState)(F),[c,l]=(0,e.useState)(``),[u,d]=(0,e.useState)(!1),[f,p]=(0,e.useState)([]),m=(0,e.useSyncExternalStore)(n===void 0?ne:n.subscribe,n===void 0?te:n.getSnapshot),h=be(t.runtime);if(t.view!==`page`||n===void 0)return(0,e.createElement)(r,null);let g=m.writable&&m.status===`ready`,_=ce(o.values),v=async()=>{o.invalid.length>0||_.length===0||await Ce({form:n,draft:o,ops:_,state:m,t:i,setDraft:s,setFailure:l,setSaving:d})},b=(e,t)=>{l(``);let n=se(e,t);s(r=>{let i={...r.values},a={...r.invalidText},o=r.invalid.filter(t=>t!==e.key),s=r.baseRevision??m.revision;return n.kind===`invalid`?(Reflect.deleteProperty(i,e.key),a[e.key]=t,{values:i,baseRevision:s,invalid:[...o,e.key],invalidText:a}):(Reflect.deleteProperty(a,e.key),i[e.key]=n.kind===`clear`?null:n.value,{values:i,baseRevision:s,invalid:o,invalidText:a})})},x=y.map(e=>ge({group:e,t:i,shown:e=>re(e,m.value,o.values,o.invalidText),disabled:!g||u,revealed:e=>f.includes(e.key),onReveal:e=>{p(t=>t.includes(e.key)?t.filter(t=>t!==e.key):[...t,e.key])},onChange:b})),S=ye({t:i,saving:u,editable:g,changed:_.length,invalid:o.invalid.length,onSave:()=>{v()},onUndo:()=>{s(F),p([]),l(``)}}),C=(0,e.createElement)(a,{items:[_e(i,m,_.length,o.invalid.length)]}),w=c===``?null:(0,e.createElement)(`p`,{className:`dsu-error`,role:`alert`,"aria-live":`assertive`},c);return(0,e.createElement)(r,null,C,w,...x,Se({reader:t.runtime,t:i,snapshot:h.snapshot,busy:h.busy,failure:h.failure,onAct:h.act,onCancel:h.cancel}),S)}const L=`@jayyuen66/dsh-scrapling`;function R(e,t){return e[t]}const z=`scraplingRuntime`,B=`remote.${z}`;function V(e,n){let r=e.safeParse(n);if(!r.success)throw TypeError(t.z.prettifyError(r.error));return r.data}const H=`runtime request requires a known pack`,we=t.z.object({pack:t.z.enum(T,{error:H})},{error:H}),U=`runtime cancel requires a jobId`,Te=t.z.object({jobId:t.z.string({error:U}).trim().min(1,{error:U})},{error:U}),W={mode:`strict`,typeSymbol:`${L}#runtime-pack-request`,create:()=>({parse(e){return V(we,e)}})},Ee={mode:`strict`,typeSymbol:`${L}#runtime-cancel-request`,create:()=>({parse(e){return V(Te,e)}})},De=t.z.enum(E),Oe=t.z.enum(D),G=t.z.enum(T),ke=t.z.object({id:t.z.string(),pack:G,status:Oe,output:t.z.string()}),Ae=t.z.object({ok:t.z.literal(!0),packs:t.z.partialRecord(G,De),python:t.z.object({path:t.z.string(),via:t.z.string(),version:t.z.string()}),dataDir:t.z.string(),jobsReady:t.z.boolean(),job:ke.nullable()}),je=t.z.literal(O),K=t.z.discriminatedUnion(`ok`,[t.z.object({ok:t.z.literal(!0),jobId:t.z.string()}),t.z.object({ok:t.z.literal(!1),error:t.z.string(),status:je})]);function q(e,t){return{id:`${L}#${z}/${e}`,service:z,namespace:z,method:e,invocation:{kind:`direct`},parameters:t,result:{mode:`src-json`}}}function J(e){return[{name:`request`,wire:`request`,source:`json`,codec:e}]}const Me=[q(`status`,[]),q(`installPack`,J(W)),q(`repairPack`,J(W)),q(`cancelJob`,J(Ee))];function Ne(e){return v(e)&&typeof R(e,`$mount`)==`function`}function Pe(e){return v(e)?typeof R(e,`status`)==`function`&&typeof R(e,`installPack`)==`function`&&typeof R(e,`repairPack`)==`function`&&typeof R(e,`cancelJob`)==`function`:!1}function Fe(e){return v(e)&&typeof R(e,`ok`)==`boolean`}async function Y(e,t){let n=await e;if(!Fe(n))throw TypeError(`runtime remote returned a malformed envelope: ${JSON.stringify(n)}`);if(n.ok)return V(t,n.value);throw Error(`${n.error.code}: ${n.error.message}`)}function Ie(e){let t,n=async()=>{let n=e.get?.(`remote`);if(!Ne(n))throw Error(`运行环境读面不可用:宿主网关没有提供 remote 服务`);try{t??=n.$mount({package:L,descriptors:Me}),await t}catch(e){throw t=void 0,e}let r=e.get?.(B,!1);if(!Pe(r))throw Error(`${B} 未提供:宿主网关没有挂上这枚命名空间`);return r};return{async status(){return Y((await n()).status(),Ae)},async install(e){return Y((await n()).installPack({pack:e}),K)},async repair(e){return Y((await n()).repairPack({pack:e}),K)},async cancel(e){return Y((await n()).cancelJob({jobId:e}),K)}}}function Le(e){return typeof e.get==`function`?Ie(e):void 0}const X=`data:image/png;base64,${(/* @__PURE__ */ `iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAQAAAD41aSMAAATrElEQVR42u1dC3hVxbWGEN4PUUR8hFsvChbSFnsVBUWltiBy.BVtqbHn12vKS9KIEfCGvUKFUxSBCwAflYQVtBIVWRUQarw9oEVRKg6AUhFCEgMLlYSCB83ed5ORk55y9Z9bM3mefvU/2mk8k.5Ow5M+vfs2atNWutqYM6QUtmC1gQAKDYMvALzMab+Bs2YDkm0M8BAK618zAUb+MUqimEtbguAMCNdj7GoxhmtB8/CgBIPPvn.4jSs6FmkBwAksvXDbohoNZoGACSudcHHENMM1A0ASFQbgqMS9r+Jc4M9IFGtnfTtLyW1NNCCEtRa4XXIaCzqBQAkptUnxbNU.wv7DaB0YYolqw1AmFT/DA1dEoto5tLnK6H2/v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GqE+SiUIySyEbsdWiJPd0FKsGZki5nSyGjK79l4SrBwAcF0YJN4NF6z8wslTdr0+UD8vaLJJ1imHIN93JGr1prf9HaoxEYceG39cGioWFKZ9olu8IvD7R9/589RR5EYSHmdBs8j7Y6/Nn613oj22yuufydf3Kw+q9Q2Pvc4rFF+CUevlqdOp6melE+15aKR4a6J18kPnh7nqYLUTHetglofCBAAAAAIAABAAAIAAAAAEAAAgAAAAAcBo8zgT1XPHurF5F/w5AaQTe9KWIJwTQDWY/KHa0FFGAEwqkibP3kzdn7Gr7exPkwZfM8PfznUOAJvZod33jBIm/1/97292PKWHwT/VH6lMAWB3FsQA0OvTzt5veobaptr9+hAAvCh3+xTq8f2//xlT93ZtZQCA/XNA9nJM3qkbUc9U24y/L3ZoFpyvwndsFpxxnevUNfbnXOc6dIXxOdvRnTuvf5yz1VACwK5Cy5cZ0IxjHYAAAAAEAAAAABMAAAAIAABAAAAA2l//ANBt5HCfcxVrAAAAAElFTkSuQmCC`,Q=`row.session`,Re=`dsh-scrapling`,ze=[`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_screenshot`];function $(e){return typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):``}function Be(...e){for(let t of e){let e=$(t);if(e!==``)return e}return``}function Ve(e,t,n){let r=$(t.selector);return{tool:e,title:r===``?e:`${e} ${r}`,fields:[{labelKey:`row.matched`,value:$(n.count)}]}}function He(e,t,n){let r=[],i=$(t.baseUrl);return i!==``&&r.push({labelKey:`row.url`,value:i}),r.push({labelKey:`row.matched`,value:$(n.count)}),{tool:e,title:e,fields:r}}function Ue(e,t,n){let r=v(t)?t:{},i=v(n)?n:{},a=Be(i.url,r.url);if(e===`scrapling_extract`||e===`scrapling_locate`)return Ve(e,r,i);if(e===`scrapling_links`)return He(e,r,i);if(e===`scrapling_session_list`)return{tool:e,title:e,fields:[{labelKey:`row.sessionCount`,value:$(i.count)}]};if(e===`scrapling_session_open`)return{tool:e,title:e,fields:[{labelKey:`row.type`,value:$(r.sessionType)},{labelKey:Q,value:$(i.sessionId)}]};if(e===`scrapling_session_close`)return{tool:e,title:e,fields:[{labelKey:Q,value:$(r.sessionId)}]};if(e===`scrapling_session_network`||e===`scrapling_session_state_save`||e===`scrapling_session_state_load`){let t=[{labelKey:Q,value:$(r.sessionId)}],n=$(r.name);return n!==``&&t.push({labelKey:`row.name`,value:n}),{tool:e,title:e,fields:t}}if(e===`scrapling_crawl`)return{tool:e,title:e,fields:[{labelKey:`row.start`,value:a},{labelKey:`row.pageCap`,value:$(r.maxPages)},{labelKey:`row.job`,value:$(i.jobId)}]};let o=[];a!==``&&o.push({labelKey:`row.url`,value:a});let s=i.statusCode;return typeof s==`number`&&o.push({labelKey:`row.http`,value:String(s)}),i.truncated===!0&&o.push({labelKey:`row.body`,value:``,valueKey:`row.truncated`}),{tool:e,title:e,fields:o}}const We=[`url`,`baseUrl`,`selector`,`sessionType`,`sessionId`,`name`,`maxPages`];function Ge(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 Ke(e){return e.phase===`result`?e.block.meta:void 0}const qe=`
120
- .dsh-scrapling-row{display:flex;flex-direction:column;gap:2px;min-width:0}
121
- .dsh-scrapling-rowTitle{color:var(--dsw-alias-label-primary);font-size:13px;line-height:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
122
- .dsh-scrapling-rowFields{display:flex;flex-wrap:wrap;gap:2px 12px;margin:0;padding:0;list-style:none}
123
- .dsh-scrapling-rowField{display:flex;gap:4px;min-width:0;font-size:12px;line-height:18px}
124
- .dsh-scrapling-rowLabel{color:var(--dsw-alias-label-tertiary);flex:none}
125
- .dsh-scrapling-rowValue{color:var(--dsw-alias-label-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
126
- .dsh-scrapling-rowButton{align-self:flex-start;border:0;background:0 0;padding:0;color:var(--dsw-alias-label-tertiary);font:inherit;font-size:12px;cursor:pointer}
127
- .dsh-scrapling-rowButton:hover{color:var(--dsw-alias-label-primary)}
128
- .dsh-scrapling-rowButton:focus-visible{outline:var(--dsw-focus-ring-width) solid var(--dsw-focus-ring-color,var(--dsw-alias-state-business-primary));outline-offset:1px}
14
+ `);return()=>{r(),n()}}function ae(e,t){return e.secret===!0&&!t?`password`:`text`}function oe(t){let{field:n,label:r,shown:i,disabled:a,revealed:o,onReveal:s,t:c,onChange:l}=t,u=(0,e.createElement)(`input`,{type:ae(n,o),autoComplete:`off`,spellCheck:!1,className:`dsu-input`,value:i,disabled:a,"data-field":n.key,"aria-label":r,onChange:e=>{l(e.target.value)}}),d=(0,e.createElement)(`button`,{type:`button`,className:`dsu-btn dss-reveal`,disabled:a,"aria-pressed":o,"aria-label":r,onClick:()=>{s()}},c(o?`conceal`:`reveal`));return(0,e.createElement)(`div`,{className:`dss-secret`},u,d)}function O(t){let{field:n,label:r,shown:i,disabled:a,onChange:o}=t;return(0,e.createElement)(`input`,{type:`text`,inputMode:`numeric`,className:`dsu-input`,value:i,disabled:a,"data-field":n.key,"aria-label":r,onChange:e=>{o(e.target.value)}})}function se(n){let{field:r,t:i,shown:a,disabled:o,revealed:s,onReveal:c,onChange:l}=n,u=i(`field.${r.key}.label`),d={label:u,...(0,t.splitHint)(i(`field.${r.key}.hint`)),field:r.key,disabled:o};return r.kind===`boolean`?(0,e.createElement)(t.ToggleField,{...d,checked:a===`true`,onChange:e=>{l(String(e))}}):r.kind===`enum`?(0,e.createElement)(t.SelectField,{...d,value:a,options:(r.options??[]).map(e=>({value:e,label:e})),onChange:l}):r.secret===!0?(0,e.createElement)(t.Field,d,oe({field:r,label:u,shown:a,disabled:o,revealed:s,onReveal:c,t:i,onChange:l})):r.kind===`number`?(0,e.createElement)(t.Field,d,O({field:r,label:u,shown:a,disabled:o,onChange:l})):(0,e.createElement)(t.TextField,{...d,value:a,onChange:l})}function ce(n){let{group:r,t:i,shown:a,disabled:o,revealed:s,onReveal:c,onChange:l}=n;return(0,e.createElement)(t.Section,{title:i(`group.${r.id}.title`),hint:i(`group.${r.id}.note`)},r.fields.map(e=>se({field:e,t:i,shown:a(e),disabled:o,revealed:s(e),onReveal:()=>{c(e)},onChange:t=>{l(e,t)}})))}function le(e,t,n,r){return t.status===`loading`?e(`statusLoading`):r>0?e(`statusInvalid`,{count:r}):t.status===`unavailable`||!t.writable?e(`statusReadonly`):n===0?e(`statusClean`):e(`statusChanged`,{count:n})}const k={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?k:{...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&&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=(0,e.useRef)(0),l=(0,e.useCallback)(async()=>{if(t===void 0)return;c.current+=1;let e=c.current;try{let n=await t.status();if(e!==c.current)return;r(n),s(``)}catch(t){if(e!==c.current)return;s(String(t))}},[t]),u=n?.job?.status===`running`||n?.job?.status===`stopping`;return(0,e.useEffect)(()=>{t!==void 0&&l()},[t,l]),(0,e.useEffect)(()=>{let e;return t!==void 0&&u&&(e=setInterval(()=>{l()},2e3)),()=>{e!==void 0&&clearInterval(e)}},[t,u,l]),{snapshot:n,busy:i,failure:o,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 l():s(r.error)}catch(e){s(String(e))}finally{a(``)}})())},[t,l]),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 l():s(n.error)}catch(e){s(String(e))}finally{a(``)}})())},[t,l,n])}}function pe(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=a||o||r===null||r===`blocked`||r===`installing`,p=[(0,e.createElement)(`button`,{type:`button`,className:T,key:`install`,disabled:f||r===`ready`,onClick:()=>{c(n,`install`)}},i(`runtimeInstall`)),(0,e.createElement)(`button`,{type:`button`,className:T,key:`repair`,disabled:f||r===`missing`,onClick:()=>{c(n,`repair`)}},i(`runtimeRepair`))];return o&&s===n&&p.push((0,e.createElement)(`button`,{type:`button`,className:T,key:`cancel`,disabled:a,onClick:l},i(`runtimeCancel`))),(0,e.createElement)(`div`,{className:`dss-pack`,key:n},(0,e.createElement)(`div`,null,(0,e.createElement)(`div`,{className:`dsu-label`},d),(0,e.createElement)(`p`,{className:E},u)),(0,e.createElement)(`div`,{className:`dss-packActions`},...p))}function me(n){let{reader:r,t:i,snapshot:a,busy:o,failure:s,onAct:c,onCancel:u}=n,d=(0,e.createElement)(t.LogPanel,null,`dsh-scrapling setup --feature <pack> --apply`),f=s===``?null:(0,e.createElement)(`p`,{className:`${E} dsu-error`,role:`alert`},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`)),d);let p=a?.jobsReady??!1,m=a?.job??null,_=m!==null&&(m.status===`running`||m.status===`stopping`),v=a===null?null:(0,e.createElement)(`p`,{className:E},`${i(`runtimePython`)}: ${a.python.path} (${i(g(a.python.via))})`,(0,e.createElement)(`br`),`${i(`runtimeDataDir`)}: ${a.dataDir}`),y=m===null?``:i(h(m.pack)),b=m===null?null:(0,e.createElement)(`p`,{className:E},_?i(`runtimeJobRunning`,{pack:y}):i(`runtimeJobEnded`,{status:m.status})),x=m===null||m.output===``?null:(0,e.createElement)(t.LogPanel,null,m.output),S=o!==``||!p||a===null,C=l.map(e=>pe({pack:e,state:a===null?null:a.packs[e]??`missing`,t:i,disabled:S,running:_,activePack:m?.pack??null,onAct:c,onCancel:u})),w=a!==null&&!p?(0,e.createElement)(`div`,null,(0,e.createElement)(`p`,{className:E},i(`runtimeJobsMissing`)),d):null;return(0,e.createElement)(t.Section,{title:i(`runtimeTitle`),hint:i(`runtimeHint`)},v,f,b,x,(0,e.createElement)(`div`,{className:`dss-packs`},...C),w)}async function he(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)(k),[c,l]=(0,e.useState)(``),[u,d]=(0,e.useState)(!1),[f,p]=(0,e.useState)([]),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 he({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;return n.kind===`invalid`?(Reflect.deleteProperty(i,e.key),a[e.key]=t,{values:i,baseRevision:s,invalid:[...o,e.key],invalidText:a}):(Reflect.deleteProperty(a,e.key),i[e.key]=n.kind===`clear`?null:n.value,{values:i,baseRevision:s,invalid:o,invalidText:a})})},C=r.map(e=>ce({group:e,t:a,shown:e=>x(e,m.value,o.values,o.invalidText),disabled:!g||u,revealed:e=>f.includes(e.key),onReveal:e=>{p(t=>t.includes(e.key)?t.filter(t=>t!==e.key):[...t,e.key])},onChange:S})),w=de({t:a,saving:u,editable:g,changed:_.length,invalid:o.invalid.length,onSave:()=>{b()},onUndo:()=>{s(k),p([]),l(``)}}),T=(0,e.createElement)(t.StatusBar,{items:[le(a,m,_.length,o.invalid.length)]}),E=c===``?null:(0,e.createElement)(`p`,{className:`dsu-error`,role:`alert`,"aria-live":`assertive`},c);return(0,e.createElement)(t.CardForm,null,T,E,...C,me({reader:n.runtime,t:a,snapshot:h.snapshot,busy:h.busy,failure:h.failure,onAct:h.act,onCancel:h.cancel}),w)}function ge(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}const _e=e=>ge(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`,ve=n.z.object({pack:n.z.enum(l,{error:I})},{error:I}),L=`runtime cancel requires a jobId`,ye=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(ve,e)}})},be={mode:`strict`,typeSymbol:`${j}#runtime-cancel-request`,create:()=>({parse(e){return F(ye,e)}})},xe=n.z.enum(u),Se=n.z.enum(d),z=n.z.enum(l),Ce=n.z.object({id:n.z.string(),pack:z,status:Se,output:n.z.string()}),we=n.z.object({ok:n.z.literal(!0),packs:n.z.partialRecord(z,xe),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:Ce.nullable()}),Te=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:Te})]);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 Ee(e){return[{name:`request`,wire:`request`,source:`json`,codec:e}]}function H(e,t){return V(e,Ee(t))}const De=[V(`status`,[]),H(`installPack`,R),H(`repairPack`,R),H(`cancelJob`,be)];function Oe(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 ke(e){return(0,t.isRecord)(e)&&typeof M(e,`ok`)==`boolean`}function Ae(e){if(!(0,t.isRecord)(e))return typeof e;let n=Object.keys(e);return n.length===0?`{}`:`{ ${n.join(`, `)} }`}function je(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(!ke(n))throw TypeError(`runtime remote returned a malformed envelope: ${Ae(n)}`);if(n.ok)return F(t,n.value);let r=je(n);throw Error(`${r.code}: ${r.message}`)}function Me(e){let t,n=async()=>{let n=e.get?.(`remote`);if(!_e(n))throw Error(`运行环境读面不可用:宿主网关没有提供 remote 服务`);try{t??=n.$mount({package:j,descriptors:De}),await t}catch(e){throw t=void 0,e}let r=e.get?.(P,!1);if(!Oe(r))throw t=void 0,Error(`${P} 未提供:宿主网关没有挂上这枚命名空间`);return r};return{async status(){return U((await n()).status(),we)},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 Ne(e){return typeof e.get==`function`?Me(e):void 0}const W=`data:image/png;base64,${(/* @__PURE__ */ `iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAQAAAD41aSMAAATrElEQVR42u1dC3hVxbWGEN4PUUR8hFsvChbSFnsVBUWltiBy.BVtqbHn12vKS9KIEfCGvUKFUxSBCwAflYQVtBIVWRUQarw9oEVRKg6AUhFCEgMLlYSCB83ed5ORk55y9Z9bM3mefvU/2mk8k.5Ow5M+vfs2atNWutqYM6QUtmC1gQAKDYMvALzMab+Bs2YDkm0M8BAK618zAUb+MUqimEtbguAMCNdj7GoxhmtB8/CgBIPPvn.4jSs6FmkBwAksvXDbohoNZoGACSudcHHENMM1A0ASFQbgqMS9r+Jc4M9IFGtnfTtLyW1NNCCEtRa4XXIaCzqBQAkptUnxbNU.wv7DaB0YYolqw1AmFT/DA1dEoto5tLnK6H2/v//eBaAR8qXsP4tfBs64RLVuOCgF4DN0CABITKuLBVL2n8GYwB2dqNYeO6QA.7MWVAQCJaemYBzktDg5kRK0FLkBDzWc74HMGAOMDAMxbM9yH7SShgSN4Db00eriXwf5S/NDmKDPRnVpntEyuI8/pDpvjERw3.MGqbhqR+jgHAZ7hce4wXYBReRRH2U9uBNXiS1NkOSEsFANJoMrG0Gd9S3IA5AugFzSOY5phe4wWptim+wHz0RBN/A9CNdJNY.KscDSn38XHDyVU1TtcbXGJNM2V9FBzAH33fXuedkZxdjg+m0vqRJ8TWg5xnsP4X+WiMczeg7hEL00VYgkgpAf0vn2WB2H23x.CYNJB9FVa4QLwKP9pEg08x8AiywnlMfuo0+F/iSjrbTadEa4BHzaiTvd0I+cjFvYaDmZF9m9jGQxZ73mZvkQoATBADTwDwAD.Bd77D9hRC7NZrFmlrYC+DTVakGi9yLmupgum8Q9cwuzljyy2FNg44v9GCYATpJX5AoCWpDtYUzHTHGuDLZEncumn1siilk8C.J5a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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_screenshot`];function Y(e){return typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):``}function Pe(...e){for(let t of e){let e=Y(t);if(e!==``)return e}return``}function Fe(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 Ie(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 X(e,n,r){let i=(0,t.isRecord)(n)?n:{},a=(0,t.isRecord)(r)?r:{},o=Pe(a.url,i.url);if(e===`scrapling_extract`||e===`scrapling_locate`)return Fe(e,i,a);if(e===`scrapling_links`)return Ie(e,i,a);if(e===`scrapling_session_list`)return{tool:e,title:e,fields:[{labelKey:`row.sessionCount`,value:Y(a.count)}]};if(e===`scrapling_session_open`)return{tool:e,title:e,fields:[{labelKey:`row.type`,value:Y(i.sessionType)},{labelKey:K,value:Y(a.sessionId)}]};if(e===`scrapling_session_close`)return{tool:e,title:e,fields:[{labelKey:K,value:Y(i.sessionId)}]};if(e===`scrapling_session_network`||e===`scrapling_session_state_save`||e===`scrapling_session_state_load`){let t=[{labelKey:K,value:Y(i.sessionId)}],n=Y(i.name);return n!==``&&t.push({labelKey:`row.name`,value:n}),{tool:e,title:e,fields:t}}if(e===`scrapling_crawl`)return{tool:e,title:e,fields:[{labelKey:`row.start`,value:o},{labelKey:`row.pageCap`,value:Y(i.maxPages)},{labelKey:`row.job`,value:Y(a.jobId)}]};let s=[];o!==``&&s.push({labelKey:`row.url`,value:o});let c=a.statusCode;return typeof c==`number`&&s.push({labelKey:`row.http`,value:String(c)}),a.truncated===!0&&s.push({labelKey:`row.body`,value:``,valueKey:`row.truncated`}),{tool:e,title:e,fields:s}}const Z=[`url`,`baseUrl`,`selector`,`sessionType`,`sessionId`,`name`,`maxPages`];function Q(e){if(e===void 0)return{};let t={};for(let n of Z){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 Le=`
129
15
  .dsh-scrapling-page{padding:4px 0 8px}
130
16
  .dsh-scrapling-icon{position:relative;display:inline-block;flex:none}
131
- .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(${X});mask-image:url(${X})}
132
- .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(${Z});mask-image:url(${Z})}
133
- `;function Je(t){let{toolName:n,block:r,inspect:i,t:a}=t,o=Ke(t),s=Ue(n,Ge(r.args),o),c=[(0,e.createElement)(`div`,{className:`dsh-scrapling-rowTitle`,key:`title`},s.title)];return s.fields.length>0&&c.push((0,e.createElement)(`ul`,{className:`dsh-scrapling-rowFields`,key:`fields`},s.fields.map(t=>(0,e.createElement)(`li`,{className:`dsh-scrapling-rowField`,key:t.labelKey},(0,e.createElement)(`span`,{className:`dsh-scrapling-rowLabel`},a(t.labelKey)),(0,e.createElement)(`span`,{className:`dsh-scrapling-rowValue`},t.valueKey===void 0?t.value:a(t.valueKey)))))),i!==void 0&&c.push((0,e.createElement)(`button`,{type:`button`,className:`dsh-scrapling-rowButton`,key:`inspect`,onClick:()=>{i()}},a(`row.inspect`))),(0,e.createElement)(`div`,{className:`dsh-scrapling-row`,"data-tool":n},...c)}const Ye=[`slots`,`configForms`,`locale`];function Xe(t){let n=t.locale.bind(x),r=[];for(let i of ze)r.push(t.slots.register({name:`tool.call.toolview`,key:i,locale:x},t=>(0,e.createElement)(Je,{...t,t:n})));return()=>{for(let e of r)e()}}function Ze(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 Qe(t){return(0,e.createElement)(`div`,{className:`dsh-scrapling-page`},(0,e.createElement)(I,{view:`page`,t:t.t,form:t.form,runtime:t.runtime}))}function $e(t){_(t,`__dshScraplingToolviewApplied`,`dsh-scrapling toolview`)&&(t.effect(()=>{let e=ue();if(e===void 0)return()=>void 0;let t=de(e),n=P(e,`dsh-scrapling-row-css`,qe);return()=>{t(),n()}},`dsh-scrapling: client styles`),t.effect(()=>{let e=w(),n=[t.locale.register(x,`zh`,e.zh),t.locale.register(x,`en`,e.en)],r;return t.slots.inject(`tool.call.toolview`,()=>{r=Xe(t)}),()=>{r?.();for(let e of n)e()}},`dsh-scrapling: dictionaries and tool rows`),t.effect(()=>{let n=t.configForms.get(`scrapling`),r=t.locale.bind(x),i={getSnapshot:()=>n.getSnapshot(),subscribe:e=>n.subscribe(e),mutate:(e,t)=>n.mutate(e,t)},a=Le(t),o=()=>({t:r,form:i,runtime:a}),s;t.slots.inject(`plugins.bundle.config`,()=>{s=t.slots.register({name:`plugins.bundle.config`,key:`@jayyuen66/dsh-scrapling`,locale:x},t=>(0,e.createElement)(I,{...t,...o()}))});let c;t.slots.inject(`settings.section`,()=>{c=t.slots.register({name:`settings.section`,id:Re,order:30,label:()=>r(`navLabel`),locale:x,inject:o},Qe)});let l;return t.slots.inject(`settings.section.icon`,()=>{l=t.slots.register({name:`settings.section.icon`,id:Re,order:30},Ze)}),()=>{s?.(),c?.(),l?.()}},`dsh-scrapling: settings card`))}exports.ROW_TOOLS=ze,exports.apply=$e,exports.buildRow=Ue,exports.inject=Ye,exports.readArgs=Ge,exports.resultMetaOf=Ke;
17
+ .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})}
18
+ .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})}
19
+ `;function Re(n){let{toolName:r,block:i,inspect:a,t:o}=n,s=$(n),c=X(r,Q(i.args),s),l=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)})),u=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,foot:u},(0,e.createElement)(t.ToolRowGrid,null,...l))}const ze=[`slots`,`configForms`,`locale`];function Be(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)(Re,{...t,t:n})));return()=>{for(let e of r)e()}}function Ve(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 He(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=ie(e),n=D(e,`dsh-scrapling-row-css`,Le);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=Be(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=Ne(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()}))});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},He)});let u;return n.slots.inject(`settings.section.icon`,()=>{u=n.slots.register({name:`settings.section.icon`,id:q,order:30},Ve)}),()=>{c?.(),l?.(),u?.()}},`dsh-scrapling: settings card`))},exports.buildRow=X,exports.inject=ze,exports.readArgs=Q,exports.resultMetaOf=$;
134
20
  return module.exports;
135
21
  },
136
22
  });
package/cordis.patch.yml CHANGED
@@ -16,5 +16,9 @@
16
16
  # `dsh plugin --profile web add/remove @jayyuen66/dsh-scrapling` 维护。
17
17
  # 行按裸包名引用本包(client-modules 只扫描裸包名条目的 dsh.client 声明)。
18
18
  - insert:
19
+ # 固定 id:该供应行必须保持开启;停用后本包设置卡会失去 shared 客户端供应。
20
+ # 多个插件共用同一个 id,宿主会把开关标成“无法唯一定位”并禁用。
21
+ - id: dsh-plugin-shared
22
+ name: "@jayyuen66/dsh-plugin-shared"
19
23
  - id: scrapling
20
24
  name: "@jayyuen66/dsh-scrapling"
package/docs/DETAIL.md CHANGED
@@ -4,9 +4,9 @@ Fetches and extracts web pages — JavaScript rendering, CSS/XPath extraction wi
4
4
 
5
5
  ## What the card changes
6
6
 
7
- Fifty card values grouped by purpose; most are read per call, so a change applies on the next tool call. The values read once when the plugin is assembled need it assembled again — restart the host. That set is: the fifteen tool switches, `provideWebFetch` / `provideWebSearch` together with everything the search provider snapshots alongside them (`searchBackend`, the per-vendor keys, `searxngEndpoint`, `fetchMaxOutputChars`, `fetchTimeoutMs`), plus `pythonBin`, `failFastOnMissingPython` and `dataDir`.
7
+ Fifty 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 four output budgets, `crawlMaxItems`, `fetchTimeoutMs`, the answer route (`answerProvider` / `answerModel` / `answerMaxTokens`), and the search-provider values (`searchBackend`, the per-vendor keys, `searxngEndpoint`, `searchPublicFallback`). The values read once when the plugin is assembled need it assembled again — restart the host. That set is: the fifteen tool switches, `provideWebFetch` / `provideWebSearch`, `pythonBin`, `failFastOnMissingPython`, `dataDir`, `sidecarHandshakeTimeoutMs` / `sidecarGraceMs`, and the URL-gate / sidecar-environment values (`proxyUrl`, `proxyBypass`, `allowedHosts`, `nat64Prefixes`, `syntheticDnsRanges`).
8
8
 
9
- - **Runtime** — `pythonBin` (empty) chooses the interpreter: an explicit path wins, then the managed capability install, 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.
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
10
  - **Tool switches** — fifteen of them (fetch, extract, locate, links, render, capture XHR, network history, session, session state, crawl, answer, session read, session actions, download, 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
11
  - **Extraction and output** — `extractionType` (markdown/html/text), `mainContentOnly`, `stripInlineImages` (on) and the per-tool output budgets: `fetchMaxOutputChars`, `extractMaxOutputChars` and `renderMaxOutputChars` 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
12
  - **Browser** — `headless` (on), `networkIdle` (off), `blockAds` (on, about 3500 domains), `pierceShadow` (off), `waitSelectorState`.
@@ -32,10 +32,16 @@ Write them in the `config:` block of this plugin's row in `cordis.patch.yml`.
32
32
 
33
33
  ## What it needs from outside
34
34
 
35
- Python and Scrapling come from one of two places: the `core` capability pack installs a managed CPython 3.14.9 with Scrapling 0.5 under `dataDir`, 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`, `adaptive-redis`, `mcp` — and the plugin is usable with only `core`, which is why the tool surface can be partial. 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 under `dataDir/runtime/python/<version>` and then creates `dataDir/runtime/venv` from it, putting Scrapling 0.5 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`, `adaptive-redis`, `mcp` — and the plugin is usable with only `core`, which is why the tool surface can be partial. 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.
36
36
 
37
- Failures are named, not hidden: `SIDECAR_*`, `INSTALL_*`, `SEARCH_AUTH`, `JOBS_UNAVAILABLE`, `SESSION_STATE_DISABLED`, `MCP_PORT_IN_USE` / `MCP_PORT_MISMATCH` / `MCP_MODE_CONFLICT` / `MCP_CLIENT_MISSING`, `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`, `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.
38
38
 
39
39
  ## Further detail
40
40
 
41
41
  The sidecar protocol, capability-pack installer internals, offline assets and the security model are in the package README (`README.md` / `README.zh-CN.md`).
42
+
43
+ ## Feedback
44
+
45
+ Issues and pull requests are welcome: [https://github.com/JayYuen666/dsh-scrapling/issues](https://github.com/JayYuen666/dsh-scrapling/issues).
46
+
47
+ If a plugin fails to boot, include the dsh host version, the profile install shape, and the browser console line. The `missed the module table` line is especially useful: it tells us whether the shared client row was materialized.
package/docs/DETAIL.zh.md CHANGED
@@ -4,9 +4,9 @@
4
4
 
5
5
  ## 设置卡上改的是什么
6
6
 
7
- 卡上五十个取值按用途分组,多数每次调用现读,改完下一次调用就生效。另有几项只在装配时读一次,改完要让插件重新装配——重启宿主即可。这几项是:十五个工具开关、`provideWebFetch` / `provideWebSearch` 以及与它们一起被检索 provider 快照的 `searchBackend`、各家 key、`searxngEndpoint`、`fetchMaxOutputChars`、`fetchTimeoutMs`,再加上 `pythonBin`、`failFastOnMissingPython` 与 `dataDir`。
7
+ 卡上五十个取值按用途分组。每次调用现读的那些,改完下一次调用就生效:抽取类(`extractionType`、`mainContentOnly`、`stripInlineImages`)、浏览器类(`headless`、`networkIdle`、`blockAds`、`pierceShadow`、`waitSelectorState`)、四个输出预算、`crawlMaxItems`、`fetchTimeoutMs`、问答路由(`answerProvider` / `answerModel` / `answerMaxTokens`),以及搜索侧(`searchBackend`、各家 key、`searxngEndpoint`、`searchPublicFallback`)。只在装配时读一次、改完要让插件重新装配(重启宿主即可)的是:十五个工具开关、`provideWebFetch` / `provideWebSearch`、`pythonBin`、`failFastOnMissingPython`、`dataDir`、`sidecarHandshakeTimeoutMs` / `sidecarGraceMs`,以及闸门与 sidecar 进程环境那几项(`proxyUrl`、`proxyBypass`、`allowedHosts`、`nat64Prefixes`、`syntheticDnsRanges`)。
8
8
 
9
- - **运行环境** — `pythonBin`(留空)决定用哪个解释器:显式路径优先,其次托管的能力包安装,再次本包的开发 venv,最后落回 PATH 上的 `python3`(Windows 上是 `python`)。托管那一档只在 macOS arm64 上尝试——有已验能力包的就这一个平台——其余平台从显式路径直接跳到 venv 与 PATH。每次都会播报选中的是哪一支。`failFastOnMissingPython`(默认开)让 sidecar 起不来时直接拒绝装载;而解释器起得来但没装 Scrapling 时,一律降级成「工具不可用」并在日志里点名路径。`dataDir` 是 sidecar 状态的位置。
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
10
  - **工具开关** — 十五个(fetch、extract、locate、links、render、capture XHR、会话网络历史、session、登录态、crawl、answer、session read、页面动作、download、screenshot)。关掉一个就是模型看不见它,它那句指引也跟着从 skill 正文里消失;常驻 system prompt 里只留一段跨工具的选型摘要(不点名具体工具),全文按装配时真注册了哪些工具现算后注册成虚拟 skill `scrapling`。
11
11
  - **抽取与输出** — `extractionType`(markdown/html/text)、`mainContentOnly`、`stripInlineImages`(默认开),以及各工具的输出预算:`fetchMaxOutputChars`、`extractMaxOutputChars`、`renderMaxOutputChars` 默认 200000,`xhrMaxOutputChars` 默认 120000。宿主侧按 UTF-8 **字节**裁剪,同一个数值交给 sidecar 时叫 `maxContentChars`,那边按**字符**截——两处谁更紧就按谁收。`crawlMaxItems`(1000)管的是页数,不是输出大小。
12
12
  - **浏览器** — `headless`(默认开)、`networkIdle`(默认关)、`blockAds`(默认开,约 3500 个域名)、`pierceShadow`(默认关)、`waitSelectorState`。
@@ -32,10 +32,16 @@
32
32
 
33
33
  ## 需要外部提供什么
34
34
 
35
- Python 与 Scrapling 有两个来源:`core` 能力包会在 `dataDir` 下装一份托管的 CPython 3.14.9 加 Scrapling 0.5;或者把 `pythonBin` 指向你自己装好的解释器——本插件从不动你的系统解释器。能力包只在 macOS arm64 提供,其他平台上一律拒绝安装(`INSTALL_PACK_BLOCKED`),那时 Python 才真是「由你提供」。Chromium 由 `python -m patchright install chromium` 装。能力包按层作为宿主作业安装——`core`、`browser`、`search`、`media`、`adaptive-redis`、`mcp`;只有 `core` 时插件照用,所以工具这一层本来就可以是不完整的。选中的解释器起得来但里面没 Scrapling 时工具表为空,可照抄的 `pip install` 命令写在**装载时的告警**里(不在工具提示词段落里)——那是「装之前要做的一件事」,不是产物缺陷。搜索后端分三类:Tavily、Brave、Serper 要各自的 key,SearXNG 要实例地址,而 `bing` 与 `duckduckgo` 是公共端点、不要凭据;`auto` 只有在打开 `searchPublicFallback` 之后才会走公共引擎。`adaptiveStorage: redis` 要连得上的 Redis。
35
+ Python 与 Scrapling 有两个来源:`core` 能力包先在 `dataDir/runtime/python/<版本>` 下装一份托管的 CPython 3.14.9,再用它建出 `dataDir/runtime/venv`,Scrapling 0.5 与其余 wheel 全装进那个 venv(sidecar 跑的是 venv 里的解释器,不是裸的那一支);或者把 `pythonBin` 指向你自己装好的解释器——本插件从不动你的系统解释器。能力包只在 macOS arm64 提供,其他平台上一律拒绝安装(`INSTALL_PACK_BLOCKED`),那时 Python 才真是「由你提供」。Chromium 由 `python -m patchright install chromium` 装。能力包按层作为宿主作业安装——`core`、`browser`、`search`、`media`、`adaptive-redis`、`mcp`;只有 `core` 时插件照用,所以工具这一层本来就可以是不完整的。选中的解释器起得来但里面没 Scrapling 时工具表为空,可照抄的 `pip install` 命令写在**装载时的告警**里(不在工具提示词段落里)——那是「装之前要做的一件事」,不是产物缺陷。搜索后端分三类:Tavily、Brave、Serper 要各自的 key,SearXNG 要实例地址,而 `bing` 与 `duckduckgo` 是公共端点、不要凭据;`auto` 只有在打开 `searchPublicFallback` 之后才会走公共引擎。`adaptiveStorage: redis` 要连得上的 Redis。
36
36
 
37
- 失败是被点名的,不是被藏起来的:`SIDECAR_*`、`INSTALL_*`、`SEARCH_AUTH`、`JOBS_UNAVAILABLE`、`SESSION_STATE_DISABLED`、`MCP_PORT_IN_USE` / `MCP_PORT_MISMATCH` / `MCP_MODE_CONFLICT` / `MCP_CLIENT_MISSING`、`OFFICIAL_MCP_DISABLED`、`RISK_NOT_ACCEPTED`。MCP 的 token 只从宿主环境变量 `DSH_SCRAPLING_MCP_TOKEN` 读,绝不写进 profile——那份文件是明文。
37
+ 失败是被点名的,不是被藏起来的:`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——那份文件是明文。
38
38
 
39
39
  ## 更完整的说明
40
40
 
41
41
  sidecar 协议、能力包安装器内部、离线资产与安全模型都写在随包 README(`README.md` / `README.zh-CN.md`)。
42
+
43
+ ## 反馈
44
+
45
+ 欢迎提 issue 和 PR:[https://github.com/JayYuen666/dsh-scrapling/issues](https://github.com/JayYuen666/dsh-scrapling/issues)。
46
+
47
+ 插件启动失败时,请附上 dsh 宿主版本、profile 安装形态和浏览器控制台原文。`missed the module table` 这一行尤其有用:它能直接说明 shared 客户端供应行有没有被物化。