@nite07/dsh-search 0.1.3 → 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -43,6 +43,8 @@ The list is grouped by the cheapest path a backend offers, so anything with a fr
43
43
 
44
44
  - `web_search` — the backend fan-out described above.
45
45
  - `web_search_plus` — search with a strategy for this call only: (can be switched off in settings, which stops registering it) `mode` (single or parallel), `backends` (a subset of the enabled ones), `allBackends` + `exclude` (everything except a few, cheaper to write than listing ids), `compact` (links and titles only, no snippets, which is the biggest lever on result size; can be made the default in settings) and `maxResults`. Saved configuration is untouched, a backend that is not enabled is reported rather than silently dropped, and the result names the backends that actually ran.
46
+ - `x_thread` — read one X post with its replies, so a discussion a search surfaced can be quoted. Needs the X backend in session mode; a bounded depth, reply count and character budget apply.
47
+ - `xiaohongshu_note` — read one Xiaohongshu note: text, author, engagement counts, tags, and optionally its top-level comments. Takes the share link (which carries the token the read needs) or a note id from an earlier search in the same session. Needs the Xiaohongshu backend in browser mode, and reports a disabled backend or a missing token instead of an empty note.
46
48
  - `reddit_thread` — read one Reddit post with its comment tree, so a model can quote the discussion instead of guessing. Capped by depth, comment count and character budget.
47
49
  - `search_manage` — inspect or change this plugin's settings from the agent side.
48
50
 
package/README.zh.md CHANGED
@@ -43,6 +43,7 @@ dsh --profile web # 或者用你自己的方式重启 dsh web
43
43
 
44
44
  - `web_search` — 上面说的多后端搜索。
45
45
  - `web_search_plus` — 按本次调用指定搜索策略:(可在设置里关闭:关闭后不注册该工具)`mode`(单后端/并行)、`backends`(从已启用里挑子集)、`allBackends` + `exclude`(全用但排掉几家,比列 id 省字符)、`compact`(只回标题和链接,丢掉摘要,省结果 token;可在设置里设为默认)、`maxResults`。只影响这一次调用,不改配置;没启用的后端会被明确告知而不是被悄悄忽略,实际用了哪些也会回显。
46
+ - `x_thread` — 读一条 X 推文及其回复,让搜索到的讨论可以被引用;需要 X 后端处于会话模式,深度、回复条数和字符预算都有上限。
46
47
  - `reddit_thread` — 读某个 Reddit 帖子的完整评论树,让模型能引用真实讨论而不是猜;按深度、评论条数和字符预算截断。
47
48
  - `search_manage` — 从 agent 侧查看或修改本插件自己的设置。
48
49
 
package/dist/client.js CHANGED
@@ -29,7 +29,7 @@ var NiteSearchClient = (() => {
29
29
  var client_default = ".ns-page{max-width:1120px;margin:0 auto;padding:24px;color:var(--dsw-alias-label-primary);font:inherit;line-height:1.55;overflow-wrap:anywhere}.ns-page *{box-sizing:border-box}.ns-page h2,.ns-page h3,.ns-page h4,.ns-page h5,.ns-page p{margin:0 0 12px}.ns-page h2{font-size:24px;line-height:1.3}.ns-page h3{font-size:17px}.ns-page h4{font-size:15px}.ns-page h5{font-size:14px}.ns-header{display:flex;justify-content:space-between;align-items:flex-start;gap:24px;margin-bottom:16px}.ns-header p,.ns-muted,.ns-page small{color:var(--dsw-alias-label-secondary)}.ns-eyebrow{font-size:12px;font-weight:600;letter-spacing:.08em}.ns-card{margin:16px 0;padding:20px;border:1px solid var(--dsw-alias-border-l1);border-radius:12px;background:var(--dsw-alias-bg-layer-1)}.ns-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px 24px}.ns-field{display:flex;min-width:0;flex-direction:column;gap:6px}.ns-field label,.ns-credential label{font-size:13px;font-weight:600}.ns-field small{font-size:12px;line-height:1.5}.ns-page input:not([type=checkbox]),.ns-page select,.ns-page textarea{width:100%;min-height:40px;padding:8px 10px;border:1px solid var(--dsw-alias-border-l2);border-radius:6px;background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);font:inherit;font-size:13px}.ns-page textarea{resize:vertical}.ns-check{display:grid;grid-template-columns:1fr auto;align-content:start;align-items:center}.ns-check small{grid-column:1/-1}.ns-page input[type=checkbox]{width:18px;height:18px;accent-color:var(--dsw-alias-brand-primary)}.ns-page button{min-height:40px;padding:8px 14px;border:1px solid var(--dsw-alias-border-l2);border-radius:6px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary);font:inherit;font-size:13px;cursor:pointer}.ns-page button:hover:not(:disabled){border-color:var(--dsw-alias-brand-primary)}.ns-page button:disabled,.ns-page input:disabled,.ns-page select:disabled{opacity:.55;cursor:not-allowed}.ns-page :is(button,input,select,textarea,a,summary):focus-visible,.ns-summary:focus{outline:2px solid var(--dsw-alias-brand-primary);outline-offset:3px;scroll-margin-block:100px}.ns-page a{color:var(--dsw-alias-brand-primary);text-underline-offset:3px}.ns-status{display:flex;justify-content:space-between;gap:12px;min-height:44px;padding:10px 14px;background:var(--dsw-alias-bg-layer-2);border:1px solid var(--dsw-alias-border-l1);border-radius:8px;font-size:13px}.ns-summary{margin:16px 0;padding:16px;border:1px solid var(--dsw-alias-state-error-primary);border-radius:8px}.ns-summary h3{margin:0}.ns-summary ul{padding-left:20px}.ns-error{color:var(--dsw-alias-state-error-primary)!important}.ns-success{color:var(--dsw-alias-state-success-primary)}.ns-warning{color:var(--dsw-alias-state-warn-primary)}.ns-backends{margin-top:28px}.ns-tier{margin-top:24px}.ns-tier>h4{color:var(--dsw-alias-label-secondary)}.ns-backend{padding:0}.ns-backend > summary{display:flex;gap:16px;align-items:center;justify-content:space-between;padding:16px 20px;cursor:pointer;list-style:revert;font-weight:600}.ns-backend > summary::before{content:'\u203A';font-size:20px}.ns-backend[open] > summary::before{transform:rotate(90deg)}.ns-backend summary>span:first-of-type{flex:1}.ns-badge{padding:3px 8px;border:1px solid var(--dsw-alias-border-l1);border-radius:5px;font-size:11px;font-weight:500;color:var(--dsw-alias-label-secondary)}.ns-backend-body{padding:0 20px 20px}.ns-quota{padding:12px;background:var(--dsw-alias-bg-layer-2);border-radius:6px;font-size:12px}.ns-credential{margin:20px 0;padding-top:16px;border-top:1px solid var(--dsw-alias-border-l1)}.ns-credential p{font-size:12px;color:var(--dsw-alias-label-secondary)}.ns-credential input{margin:6px 0 12px}.ns-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.ns-table-wrap{overflow:auto;margin-top:16px}.ns-page table{width:100%;border-collapse:collapse;font-size:12px;text-align:left}.ns-page th,.ns-page td{padding:10px;border-bottom:1px solid var(--dsw-alias-border-l1);white-space:nowrap}.ns-page th{color:var(--dsw-alias-label-secondary);font-weight:500}.ns-result pre{max-height:320px;overflow:auto;padding:12px;background:var(--dsw-alias-bg-base);border:1px solid var(--dsw-alias-border-l1);white-space:pre-wrap;font-size:12px}.ns-footer{position:sticky;bottom:0;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:16px;margin-top:24px;border:1px solid var(--dsw-alias-border-l2);border-radius:10px;background:var(--dsw-alias-bg-layer-1);font-size:12px}.ns-page .ns-primary{border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-brand-primary);font-weight:600}.ns-page [aria-invalid=true]{border-color:var(--dsw-alias-state-error-primary)!important}.ns-card>.ns-field{margin-top:16px}@media(max-width:640px){.ns-page{padding:16px 12px}.ns-header{gap:12px}.ns-grid{grid-template-columns:1fr;gap:16px}.ns-card{padding:16px}.ns-backend{padding:0}.ns-backend-body{padding:0 16px 16px}.ns-backend > summary{padding:16px}.ns-footer{position:static;align-items:flex-start;flex-direction:column}.ns-header h2{font-size:21px}}@media(prefers-reduced-motion:reduce){.ns-page *{scroll-behavior:auto!important;transition:none!important}}\n";
30
30
 
31
31
  // src/client.overrides.css
32
- var client_overrides_default = '.ns-backends:focus{outline:none}.ns-backends h3{display:flex;flex-wrap:wrap;gap:8px;align-items:baseline}\n.ns-toolbar{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr);gap:16px;margin:12px 0 4px}\n.ns-backend > summary{display:flex;align-items:center;justify-content:space-between;gap:12px;cursor:pointer;list-style:none;min-height:28px}\n.ns-backend > summary::-webkit-details-marker{display:none}\n.ns-backend > summary::before{content:"\u25B8";color:var(--dsw-alias-label-secondary);font-size:11px}\n.ns-backend[open] > summary::before{content:"\u25BE"}\n.ns-backend-title{flex:1 1 auto;font-weight:600;font-size:14px}\n.ns-chips{display:flex;align-items:center;gap:6px;flex-wrap:wrap;justify-content:flex-end}\n.ns-chip{font-size:11px;line-height:1;padding:4px 7px;border-radius:999px;border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);white-space:nowrap}\n.ns-chip--ok{border-color:var(--dsw-alias-state-success-primary);color:var(--dsw-alias-state-success-primary)}\n.ns-chip--warn{border-color:var(--dsw-alias-state-warn-primary);color:var(--dsw-alias-state-warn-primary)}\n.ns-chip--risk{border-color:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-state-error-primary)}\n.ns-chip.is-on{background:color-mix(in oklab,var(--dsw-alias-brand-primary) 14%,transparent);border-color:currentColor;font-weight:600}\n.ns-chip--off{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-state-idle-primary)}\n.ns-dot{width:8px;height:8px;border-radius:50%;flex:0 0 auto}\n.ns-dot.is-on{background:var(--dsw-alias-state-success-primary)}\n.ns-dot.is-off{background:var(--dsw-alias-state-idle-primary);opacity:.6}\n.ns-badge.is-on{border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-brand-primary)}\n.ns-advanced{margin:12px 0;border-top:1px solid var(--dsw-alias-border-l1);padding-top:10px}\n.ns-advanced summary{cursor:pointer;font-size:13px;font-weight:600;color:var(--dsw-alias-label-secondary);margin-bottom:10px}\n.ns-blockers{margin:16px 0;padding:16px 20px;border:1px solid var(--dsw-alias-state-warn-primary);border-radius:12px;background:var(--dsw-alias-bg-layer-1)}\n.ns-blockers h3{font-size:14px;margin-bottom:8px;color:var(--dsw-alias-state-warn-primary)}\n.ns-blockers ul{margin:0;padding-left:18px}\n.ns-blockers li{margin:4px 0}\n.ns-statuses{display:flex;flex-wrap:wrap;gap:8px 16px}\n.ns-status-choice{display:inline-flex;align-items:center;gap:6px;font-size:13px;padding:6px 4px;cursor:pointer}\n.ns-status-choice input{width:18px;height:18px;accent-color:var(--dsw-alias-brand-primary)}\n.ns-sources{margin:8px 0;padding-left:20px}\n.ns-sources li{margin:10px 0}\n.ns-sources p{margin:2px 0;font-size:12px}\n.ns-failure{margin-top:12px;padding:12px 14px;border:1px solid var(--dsw-alias-state-error-primary);border-radius:8px}\n.ns-failure h5{color:var(--dsw-alias-state-error-primary)}\n.ns-failure dl{display:grid;grid-template-columns:auto minmax(0,1fr);gap:4px 14px;margin:0;font-size:12px}\n.ns-failure dt{color:var(--dsw-alias-label-secondary)}\n.ns-failure dd{margin:0;overflow-wrap:anywhere}\n.ns-confirm{margin:10px 0;padding:12px 14px;border:1px solid var(--dsw-alias-state-error-primary);border-radius:8px;background:var(--dsw-alias-bg-layer-2)}\n.ns-confirm p{margin:0 0 10px;font-size:13px}\n.ns-danger{border-color:var(--dsw-alias-state-error-primary)!important;color:var(--dsw-alias-state-error-primary)}\n.ns-link{background:none;border:none;padding:0;margin-left:6px;min-height:0;font-size:12px;color:var(--dsw-alias-brand-primary);text-decoration:underline;cursor:pointer}\n.ns-link:hover{background:none;border:none}\n.ns-cell-message{max-width:320px;overflow-wrap:anywhere;font-size:12px;color:var(--dsw-alias-label-secondary)}\n.ns-footer{position:sticky;bottom:0;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;margin:16px -4px 0;padding:12px 16px;border:1px solid var(--dsw-alias-border-l1);border-radius:12px;background:var(--dsw-alias-bg-layer-1);box-shadow:0 -2px 12px rgba(0,0,0,.06)}\n.ns-footer>span{font-size:13px;color:var(--dsw-alias-label-secondary)}\n@media (max-width:720px){.ns-toolbar{grid-template-columns:minmax(0,1fr)}.ns-chips{justify-content:flex-start}.ns-footer>span{width:100%}}\n\n.ns-advanced summary{display:inline-flex;align-items:center;gap:6px;width:auto;min-height:32px;padding:0 2px;color:var(--dsw-alias-brand-primary);font-weight:600}\n.ns-advanced summary::marker{font-size:10px}\n.ns-advanced[open] summary{margin-bottom:12px}\n.ns-tabs{display:flex;flex-wrap:wrap;gap:4px;margin:18px 0 14px;padding:4px;border:1px solid var(--dsw-alias-border-l1);border-radius:10px;background:var(--dsw-alias-bg-layer-1)}\n.ns-tab{display:inline-flex;align-items:center;gap:8px;min-height:36px;padding:6px 14px;border:1px solid transparent;border-radius:7px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:13px;cursor:pointer}\n.ns-tab:hover:not(.is-active){background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}\n.ns-tab.is-active{border-color:var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);font-weight:600}\n.ns-tab-count{font-size:11px;font-weight:600;padding:2px 6px;border-radius:999px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary)}\n[role=tabpanel]{outline:none}\n.ns-test-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-top:16px}\n.ns-test-actions small{color:var(--dsw-alias-label-secondary)}\n@media (max-width:720px){.ns-tabs{gap:2px}.ns-tab{padding:6px 10px}}\n.ns-header{margin-bottom:8px}\n\n.ns-backend-body{padding:0 20px 20px}\n.ns-backend-body .ns-muted{font-size:12.5px;line-height:1.6;margin:10px 0}\n.ns-meta{display:flex;flex-wrap:wrap;align-items:baseline;gap:6px;margin:14px 0 0;padding-top:12px;border-top:1px solid var(--dsw-alias-border-l1);font-size:12px;line-height:1.5;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums}\n.ns-meta strong{font-weight:600;color:var(--dsw-alias-label-primary)}\n.ns-blockers--info{border-color:var(--dsw-alias-border-l2)}.ns-blockers--info h3{color:var(--dsw-alias-label-primary)}\n\n.ns-credential-shape code{display:block;padding:8px 10px;border:1px solid var(--dsw-alias-border-l1);border-radius:6px;background:var(--dsw-alias-bg-base);font-size:11px;overflow-wrap:anywhere}\n';
32
+ var client_overrides_default = '.ns-backends:focus{outline:none}.ns-backends h3{display:flex;flex-wrap:wrap;gap:8px;align-items:baseline}\n.ns-toolbar{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1fr);gap:16px;margin:12px 0 4px}\n.ns-backend > summary{display:flex;align-items:center;justify-content:space-between;gap:12px;cursor:pointer;list-style:none;min-height:28px}\n.ns-backend > summary::-webkit-details-marker{display:none}\n.ns-backend > summary::before{content:"\u25B8";color:var(--dsw-alias-label-secondary);font-size:11px}\n.ns-backend[open] > summary::before{content:"\u25BE"}\n.ns-backend-title{flex:1 1 auto;font-weight:600;font-size:14px}\n.ns-chips{display:flex;align-items:center;gap:6px;flex-wrap:wrap;justify-content:flex-end}\n.ns-chip{font-size:11px;line-height:1;padding:4px 7px;border-radius:999px;border:1px solid var(--dsw-alias-border-l1);color:var(--dsw-alias-label-secondary);white-space:nowrap}\n.ns-chip--ok{border-color:var(--dsw-alias-state-success-primary);color:var(--dsw-alias-state-success-primary)}\n.ns-chip--warn{border-color:var(--dsw-alias-state-warn-primary);color:var(--dsw-alias-state-warn-primary)}\n.ns-chip--risk{border-color:var(--dsw-alias-state-error-primary);color:var(--dsw-alias-state-error-primary)}\n.ns-chip.is-on{background:color-mix(in oklab,var(--dsw-alias-brand-primary) 14%,transparent);border-color:currentColor;font-weight:600}\n.ns-chip--off{border-color:var(--dsw-alias-border-l2);color:var(--dsw-alias-state-idle-primary)}\n.ns-dot{width:8px;height:8px;border-radius:50%;flex:0 0 auto}\n.ns-dot.is-on{background:var(--dsw-alias-state-success-primary)}\n.ns-dot.is-off{background:var(--dsw-alias-state-idle-primary);opacity:.6}\n.ns-badge.is-on{border-color:var(--dsw-alias-brand-primary);color:var(--dsw-alias-brand-primary)}\n.ns-advanced{margin:12px 0;border-top:1px solid var(--dsw-alias-border-l1);padding-top:10px}\n.ns-advanced summary{cursor:pointer;font-size:13px;font-weight:600;color:var(--dsw-alias-label-secondary);margin-bottom:10px}\n.ns-blockers{margin:16px 0;padding:16px 20px;border:1px solid var(--dsw-alias-state-warn-primary);border-radius:12px;background:var(--dsw-alias-bg-layer-1)}\n.ns-blockers h3{font-size:14px;margin-bottom:8px;color:var(--dsw-alias-state-warn-primary)}\n.ns-blockers ul{margin:0;padding-left:18px}\n.ns-blockers li{margin:4px 0}\n.ns-statuses{display:flex;flex-wrap:wrap;gap:8px 16px}\n.ns-status-choice{display:inline-flex;align-items:center;gap:6px;font-size:13px;padding:6px 4px;cursor:pointer}\n.ns-status-choice input{width:18px;height:18px;accent-color:var(--dsw-alias-brand-primary)}\n.ns-sources{margin:8px 0;padding-left:20px}\n.ns-sources li{margin:10px 0}\n.ns-sources p{margin:2px 0;font-size:12px}\n.ns-failure{margin-top:12px;padding:12px 14px;border:1px solid var(--dsw-alias-state-error-primary);border-radius:8px}\n.ns-failure h5{color:var(--dsw-alias-state-error-primary)}\n.ns-failure dl{display:grid;grid-template-columns:auto minmax(0,1fr);gap:4px 14px;margin:0;font-size:12px}\n.ns-failure dt{color:var(--dsw-alias-label-secondary)}\n.ns-failure dd{margin:0;overflow-wrap:anywhere}\n.ns-confirm{margin:10px 0;padding:12px 14px;border:1px solid var(--dsw-alias-state-error-primary);border-radius:8px;background:var(--dsw-alias-bg-layer-2)}\n.ns-confirm p{margin:0 0 10px;font-size:13px}\n.ns-danger{border-color:var(--dsw-alias-state-error-primary)!important;color:var(--dsw-alias-state-error-primary)}\n.ns-link{background:none;border:none;padding:0;margin-left:6px;min-height:0;font-size:12px;color:var(--dsw-alias-brand-primary);text-decoration:underline;cursor:pointer}\n.ns-link:hover{background:none;border:none}\n.ns-cell-message{max-width:320px;overflow-wrap:anywhere;font-size:12px;color:var(--dsw-alias-label-secondary)}\n.ns-footer{position:sticky;bottom:0;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:16px;flex-wrap:wrap;margin:16px -4px 0;padding:12px 16px;border:1px solid var(--dsw-alias-border-l1);border-radius:12px;background:var(--dsw-alias-bg-layer-1);box-shadow:0 -2px 12px rgba(0,0,0,.06)}\n.ns-footer>span{font-size:13px;color:var(--dsw-alias-label-secondary)}\n@media (max-width:720px){.ns-toolbar{grid-template-columns:minmax(0,1fr)}.ns-chips{justify-content:flex-start}.ns-footer>span{width:100%}}\n\n.ns-advanced summary{display:inline-flex;align-items:center;gap:6px;width:auto;min-height:32px;padding:0 2px;color:var(--dsw-alias-brand-primary);font-weight:600}\n.ns-advanced summary::marker{font-size:10px}\n.ns-advanced[open] summary{margin-bottom:12px}\n.ns-tabs{display:flex;flex-wrap:wrap;gap:4px;margin:18px 0 14px;padding:4px;border:1px solid var(--dsw-alias-border-l1);border-radius:10px;background:var(--dsw-alias-bg-layer-1)}\n.ns-tab{display:inline-flex;align-items:center;gap:8px;min-height:36px;padding:6px 14px;border:1px solid transparent;border-radius:7px;background:transparent;color:var(--dsw-alias-label-secondary);font:inherit;font-size:13px;cursor:pointer}\n.ns-tab:hover:not(.is-active){background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-primary)}\n.ns-tab.is-active{border-color:var(--dsw-alias-border-l2);background:var(--dsw-alias-bg-base);color:var(--dsw-alias-label-primary);font-weight:600}\n.ns-tab-count{font-size:11px;font-weight:600;padding:2px 6px;border-radius:999px;background:var(--dsw-alias-bg-layer-2);color:var(--dsw-alias-label-secondary)}\n[role=tabpanel]{outline:none}\n.ns-test-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-top:16px}\n.ns-test-actions small{color:var(--dsw-alias-label-secondary)}\n@media (max-width:720px){.ns-tabs{gap:2px}.ns-tab{padding:6px 10px}}\n.ns-header{margin-bottom:8px}\n\n.ns-backend-body{padding:0 20px 20px}\n.ns-backend-body .ns-muted{font-size:12.5px;line-height:1.6;margin:10px 0}\n.ns-meta{display:flex;flex-wrap:wrap;align-items:baseline;gap:6px;margin:14px 0 0;padding-top:12px;border-top:1px solid var(--dsw-alias-border-l1);font-size:12px;line-height:1.5;color:var(--dsw-alias-label-secondary);font-variant-numeric:tabular-nums}\n.ns-meta strong{font-weight:600;color:var(--dsw-alias-label-primary)}\n.ns-blockers--info{border-color:var(--dsw-alias-border-l2)}.ns-blockers--info h3{color:var(--dsw-alias-label-primary)}\n\n.ns-credential-shape code{display:block;padding:8px 10px;border:1px solid var(--dsw-alias-border-l1);border-radius:6px;background:var(--dsw-alias-bg-base);font-size:11px;overflow-wrap:anywhere}\n.ns-inherit{margin:16px 0;padding:14px 16px;border:1px solid var(--dsw-alias-border-l1);border-radius:8px;background:var(--dsw-alias-bg-layer-2)}\n.ns-inherit p{font-size:13px;margin:0 0 8px}\n.ns-inherit p:last-child{margin-bottom:0}\n.ns-inherit .ns-link{margin-left:8px;min-height:0;padding:0;border:0;background:none;color:var(--dsw-alias-brand-primary);text-decoration:underline;font-size:13px}\n.ns-inherit .ns-advanced{margin:8px 0 0;border-top:0;padding-top:0}\n';
33
33
 
34
34
  // locale/en.json
35
35
  var en_default = {
@@ -95,7 +95,7 @@ var NiteSearchClient = (() => {
95
95
  credentialTitle: "Credential storage",
96
96
  credentialConfigured: "Credential configured",
97
97
  credentialMissing: "No credential configured",
98
- credentialHelp: "Secrets are write-only and are never returned to this page. Some references are read-only.",
98
+ credentialHelp: "Saved credentials are never displayed.",
99
99
  credentialValue: "New credential value",
100
100
  replaceCredential: "Replace credential",
101
101
  deleteCredential: "Delete credential",
@@ -221,8 +221,6 @@ var NiteSearchClient = (() => {
221
221
  "help.backend.mode": "Choose a fixed anonymous or key mode. No automatic switching.",
222
222
  "field.backend.endpoint": "Endpoint URL",
223
223
  "help.backend.endpoint": "Use a trusted HTTPS endpoint, or a trusted local self-hosted endpoint. Never put secrets in the URL.",
224
- "field.backend.credentialRef": "Credential reference",
225
- "help.backend.credentialRef": "Reference only, not the secret value. Save this reference before managing its credential.",
226
224
  "field.backend.timeoutMs": "Request timeout (ms)",
227
225
  "help.backend.timeoutMs": "Deadline for each backend request.",
228
226
  "field.backend.rateLimitPerMinute": "Attempts per minute",
@@ -257,14 +255,32 @@ var NiteSearchClient = (() => {
257
255
  "choice.session": "Browser session cookies",
258
256
  colorLegend: "Green: free path, own account or self-hosted. Yellow: free allowance. Red: trial credits or paid. Sorted cheapest first.",
259
257
  credentialPending: "Wait for the current action to finish.",
260
- credentialRefRequired: "Set a credential reference name first.",
261
- credentialReadOnly: "This reference is read-only: another source supplies its value, so the plugin cannot overwrite it. Pick a different reference name, such as DSH_SEARCH_X_SESSION.",
258
+ credentialReadOnly: "This credential is provided by another source and cannot be changed here.",
262
259
  credentialPlainKey: "Paste the key itself.",
263
260
  credentialShapeLabel: "Credential format",
264
261
  "field.tools.webSearchPlus": "Allow web_search_plus",
265
262
  "help.tools.webSearchPlus": "Off hides the tool entirely: the agent then searches only through the configured strategy.",
266
263
  "field.tools.compactByDefault": "Compact results by default",
267
- "help.tools.compactByDefault": "Sources carry only URL, title and date. Saves context when the agent only needs links; a call can still ask for full snippets."
264
+ "help.tools.compactByDefault": "Sources carry only URL, title and date. Saves context when the agent only needs links; a call can still ask for full snippets.",
265
+ "choice.browser": "Browser",
266
+ "field.browser.endpoint": "Shared browser endpoint",
267
+ "field.browser.statePath": "Shared session file",
268
+ "field.browser.timeoutMs": "Browser read timeout (ms)",
269
+ "help.browser.endpoint": "The Playwright endpoint every browser-backed reader shares, for example ws://<host>:3000/ws. When set it wins over a backend's own endpoint; leave it empty to let each backend name its own.",
270
+ "help.browser.statePath": "Optional. Where the browser container writes the signed-in session; empty uses the search core default.",
271
+ "help.browser.timeoutMs": "How long one browser read may take.",
272
+ sharedBrowser: "Shared browser",
273
+ sharedBrowserHint: "This block describes the browser container you host: its endpoint, its endpoint token, the session file and the read timeout. Every backend in browser mode shares it.",
274
+ browserTokenTitle: "Endpoint token",
275
+ browserTokenValue: "New endpoint token",
276
+ saveToken: "Save token",
277
+ browserTokenHelp: "Used to connect to the browser service. Sign in to Xiaohongshu through VNC.",
278
+ browserInheritedEndpoint: "This backend inherits the shared endpoint: {{endpoint}}",
279
+ browserInheritedEndpointMissing: "This backend has no endpoint to connect to: the shared browser settings are empty and it names none of its own.",
280
+ browserOwnEndpoint: "The shared browser endpoint is empty, so this backend uses its own endpoint: {{endpoint}}.",
281
+ browserInheritedHint: "The endpoint and the token both come from the shared browser settings, so they are changed in one place.",
282
+ browserOverride: "Give this backend its own endpoint (fallback only)",
283
+ browserOverrideHint: "Applies only while the shared browser settings are empty. Use it to point one backend at a different browser container."
268
284
  };
269
285
 
270
286
  // locale/zh.json
@@ -331,7 +347,7 @@ var NiteSearchClient = (() => {
331
347
  credentialTitle: "\u51ED\u8BC1\u5B58\u50A8",
332
348
  credentialConfigured: "\u5DF2\u914D\u7F6E\u51ED\u8BC1",
333
349
  credentialMissing: "\u672A\u914D\u7F6E\u51ED\u8BC1",
334
- credentialHelp: "\u51ED\u8BC1\u4EC5\u53EF\u5199\u5165\uFF0C\u4E0D\u4F1A\u56DE\u663E\u3002\u90E8\u5206\u51ED\u8BC1\u5F15\u7528\u53EA\u5141\u8BB8\u8BFB\u53D6\u3002",
350
+ credentialHelp: "\u51ED\u8BC1\u4FDD\u5B58\u540E\u4E0D\u4F1A\u56DE\u663E\u3002",
335
351
  credentialValue: "\u65B0\u7684\u51ED\u8BC1\u503C",
336
352
  replaceCredential: "\u66FF\u6362\u51ED\u8BC1",
337
353
  deleteCredential: "\u5220\u9664\u51ED\u8BC1",
@@ -457,8 +473,6 @@ var NiteSearchClient = (() => {
457
473
  "help.backend.mode": "\u56FA\u5B9A\u4F7F\u7528\u533F\u540D\u6216\u5BC6\u94A5\u6A21\u5F0F\uFF0C\u4E0D\u81EA\u52A8\u5207\u6362\u3002",
458
474
  "field.backend.endpoint": "\u7AEF\u70B9 URL",
459
475
  "help.backend.endpoint": "\u4EC5\u4F7F\u7528\u53EF\u4FE1\u7684 HTTPS \u6216\u672C\u5730\u81EA\u6258\u7BA1\u7AEF\u70B9\uFF0C\u4E0D\u8981\u5728 URL \u4E2D\u586B\u5199\u5BC6\u94A5\u3002",
460
- "field.backend.credentialRef": "\u51ED\u8BC1\u5F15\u7528",
461
- "help.backend.credentialRef": "\u586B\u5199\u5F15\u7528\u800C\u975E\u5BC6\u94A5\u672C\u8EAB\u3002\u8BF7\u5148\u4FDD\u5B58\u5F15\u7528\uFF0C\u518D\u7BA1\u7406\u5BF9\u5E94\u7684\u51ED\u8BC1\u3002",
462
476
  "field.backend.timeoutMs": "\u8BF7\u6C42\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09",
463
477
  "help.backend.timeoutMs": "\u6BCF\u6B21\u540E\u7AEF\u8BF7\u6C42\u7684\u65F6\u95F4\u4E0A\u9650\u3002",
464
478
  "field.backend.rateLimitPerMinute": "\u6BCF\u5206\u949F\u5C1D\u8BD5\u4E0A\u9650",
@@ -493,17 +507,35 @@ var NiteSearchClient = (() => {
493
507
  "choice.session": "\u6D4F\u89C8\u5668\u4F1A\u8BDD Cookie",
494
508
  colorLegend: "\u7EFF\u8272\uFF1D\u514D\u8D39/\u81EA\u5E26\u8D26\u53F7/\u81EA\u6258\u7BA1\uFF0C\u9EC4\u8272\uFF1D\u514D\u8D39\u989D\u5EA6\uFF0C\u7EA2\u8272\uFF1D\u8BD5\u7528\u6216\u4ED8\u8D39\u3002\u7531\u4FBF\u5B9C\u5230\u8D35\u6392\u5E8F\u3002",
495
509
  credentialPending: "\u5F53\u524D\u64CD\u4F5C\u8FD8\u6CA1\u7ED3\u675F\uFF0C\u7A0D\u7B49\u3002",
496
- credentialRefRequired: "\u8BF7\u5148\u586B\u4E00\u4E2A\u51ED\u8BC1\u5F15\u7528\u540D\u3002",
497
- credentialReadOnly: "\u8FD9\u4E2A\u51ED\u8BC1\u5F15\u7528\u662F\u53EA\u8BFB\u7684\uFF1A\u5B83\u7684\u503C\u7531\u5176\u5B83\u6765\u6E90\u63D0\u4F9B\uFF0C\u63D2\u4EF6\u65E0\u6CD5\u8986\u76D6\u3002\u6362\u4E00\u4E2A\u5F15\u7528\u540D\u8BD5\u8BD5\uFF0C\u4F8B\u5982 DSH_SEARCH_X_SESSION\u3002",
510
+ credentialReadOnly: "\u8BE5\u51ED\u8BC1\u7531\u5176\u4ED6\u6765\u6E90\u63D0\u4F9B\uFF0C\u65E0\u6CD5\u5728\u6B64\u4FEE\u6539\u3002",
498
511
  credentialPlainKey: "\u76F4\u63A5\u586B\u5BC6\u94A5\u5B57\u7B26\u4E32\u3002",
499
512
  credentialShapeLabel: "\u51ED\u8BC1\u683C\u5F0F",
500
513
  "field.tools.webSearchPlus": "\u5141\u8BB8\u4F7F\u7528 web_search_plus",
501
514
  "help.tools.webSearchPlus": "\u5173\u95ED\u540E\u8FD9\u4E2A\u5DE5\u5177\u4E0D\u4F1A\u6CE8\u518C\uFF0Cagent \u53EA\u80FD\u7528\u914D\u7F6E\u91CC\u7684\u56FA\u5B9A\u7B56\u7565\u641C\u7D22\u3002",
502
515
  "field.tools.compactByDefault": "\u9ED8\u8BA4\u8FD4\u56DE\u7CBE\u7B80\u7ED3\u679C",
503
- "help.tools.compactByDefault": "\u7ED3\u679C\u53EA\u4FDD\u7559\u94FE\u63A5\u3001\u6807\u9898\u548C\u65E5\u671F\u3002agent \u53EA\u9700\u8981\u94FE\u63A5\u65F6\u80FD\u7701\u4E0B\u5927\u91CF\u4E0A\u4E0B\u6587\uFF1B\u5355\u6B21\u8C03\u7528\u4ECD\u53EF\u8981\u6C42\u5B8C\u6574\u6458\u8981\u3002"
516
+ "help.tools.compactByDefault": "\u7ED3\u679C\u53EA\u4FDD\u7559\u94FE\u63A5\u3001\u6807\u9898\u548C\u65E5\u671F\u3002agent \u53EA\u9700\u8981\u94FE\u63A5\u65F6\u80FD\u7701\u4E0B\u5927\u91CF\u4E0A\u4E0B\u6587\uFF1B\u5355\u6B21\u8C03\u7528\u4ECD\u53EF\u8981\u6C42\u5B8C\u6574\u6458\u8981\u3002",
517
+ "choice.browser": "\u6D4F\u89C8\u5668",
518
+ "field.browser.endpoint": "\u5171\u4EAB\u6D4F\u89C8\u5668\u7AEF\u70B9",
519
+ "field.browser.statePath": "\u5171\u4EAB\u4F1A\u8BDD\u6587\u4EF6",
520
+ "field.browser.timeoutMs": "\u6D4F\u89C8\u5668\u8BFB\u53D6\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09",
521
+ "help.browser.endpoint": "\u6240\u6709\u4F9D\u8D56\u6D4F\u89C8\u5668\u7684\u540E\u7AEF\u5171\u7528\u7684 Playwright \u7AEF\u70B9\uFF0C\u4F8B\u5982 ws://<\u4E3B\u673A>:3000/ws\u3002\u586B\u5199\u540E\u4F18\u5148\u4E8E\u5404\u540E\u7AEF\u81EA\u5DF1\u7684\u7AEF\u70B9\uFF1B\u7559\u7A7A\u5219\u5404\u540E\u7AEF\u5404\u7528\u81EA\u5DF1\u7684\u3002",
522
+ "help.browser.statePath": "\u53EF\u9009\u3002\u6D4F\u89C8\u5668\u5BB9\u5668\u628A\u767B\u5F55\u6001\u5199\u5728\u54EA\u4E2A\u6587\u4EF6\uFF1B\u7559\u7A7A\u5219\u7528\u641C\u7D22\u6838\u5FC3\u7684\u9ED8\u8BA4\u4F4D\u7F6E\u3002",
523
+ "help.browser.timeoutMs": "\u4E00\u6B21\u6D4F\u89C8\u5668\u8BFB\u53D6\u6700\u591A\u7B49\u591A\u4E45\u3002",
524
+ sharedBrowser: "\u5171\u4EAB\u6D4F\u89C8\u5668",
525
+ sharedBrowserHint: "\u8FD9\u91CC\u63CF\u8FF0\u4F60\u81EA\u5DF1\u6258\u7BA1\u7684\u6D4F\u89C8\u5668\u5BB9\u5668\uFF1A\u7AEF\u70B9\u3001\u7AEF\u70B9\u4EE4\u724C\u3001\u767B\u5F55\u6001\u6587\u4EF6\u4E0E\u8BFB\u53D6\u8D85\u65F6\u3002\u6240\u6709\u5904\u4E8E\u6D4F\u89C8\u5668\u6A21\u5F0F\u7684\u540E\u7AEF\u90FD\u5171\u7528\u8FD9\u4E00\u4EFD\u914D\u7F6E\u3002",
526
+ browserTokenTitle: "\u7AEF\u70B9\u4EE4\u724C",
527
+ browserTokenValue: "\u65B0\u7684\u7AEF\u70B9\u4EE4\u724C",
528
+ saveToken: "\u4FDD\u5B58\u4EE4\u724C",
529
+ browserTokenHelp: "\u7528\u4E8E\u8FDE\u63A5\u6D4F\u89C8\u5668\u670D\u52A1\u3002\u5C0F\u7EA2\u4E66\u8D26\u53F7\u8BF7\u5728 VNC \u4E2D\u767B\u5F55\u3002",
530
+ browserInheritedEndpoint: "\u8BE5\u540E\u7AEF\u7EE7\u627F\u5171\u4EAB\u7AEF\u70B9\uFF1A{{endpoint}}",
531
+ browserInheritedEndpointMissing: "\u8BE5\u540E\u7AEF\u6CA1\u6709\u53EF\u8FDE\u63A5\u7684\u7AEF\u70B9\uFF1A\u5171\u4EAB\u6D4F\u89C8\u5668\u914D\u7F6E\u4E3A\u7A7A\uFF0C\u5B83\u81EA\u5DF1\u4E5F\u6CA1\u6709\u586B\u5199\u3002",
532
+ browserOwnEndpoint: "\u5171\u4EAB\u6D4F\u89C8\u5668\u7AEF\u70B9\u5C1A\u672A\u586B\u5199\uFF0C\u8BE5\u540E\u7AEF\u76EE\u524D\u4F7F\u7528\u81EA\u5DF1\u7684\u7AEF\u70B9\uFF1A{{endpoint}}\u3002",
533
+ browserInheritedHint: "\u7AEF\u70B9\u4E0E\u4EE4\u724C\u90FD\u6765\u81EA\u5171\u4EAB\u6D4F\u89C8\u5668\u914D\u7F6E\uFF0C\u9700\u8981\u4FEE\u6539\u65F6\u53EA\u6539\u90A3\u4E00\u5904\u3002",
534
+ browserOverride: "\u4E3A\u8BE5\u540E\u7AEF\u5355\u72EC\u6307\u5B9A\u7AEF\u70B9\uFF08\u4EC5\u4F5C\u515C\u5E95\uFF09",
535
+ browserOverrideHint: "\u53EA\u6709\u5171\u4EAB\u6D4F\u89C8\u5668\u914D\u7F6E\u7559\u7A7A\u65F6\u8FD9\u91CC\u624D\u4F1A\u751F\u6548\uFF0C\u7528\u4E8E\u628A\u5355\u4E2A\u540E\u7AEF\u6307\u5411\u53E6\u4E00\u4E2A\u6D4F\u89C8\u5668\u5BB9\u5668\u3002"
504
536
  };
505
537
 
506
- // src/catalog.ts
538
+ // ../search-core/dist/catalog.js
507
539
  var text = (en, zh) => ({ en, zh });
508
540
  var option = (key, label, zh, value, choices) => ({ key, type: choices ? "select" : typeof value, label: text(label, zh), help: text(`Native ${key} parameter. See the backend documentation.`, `\u539F\u751F ${key} \u53C2\u6570\uFF0C\u8BE6\u89C1\u540E\u7AEF\u6587\u6863\u3002`), default: value, ...choices ? { choices } : {} });
509
541
  var mode = (access, endpoint, tier, en, zh, pricingUrl, shape) => ({ mode: access, endpoint, tier, limits: text(en, zh), pricingUrl, ...shape ? { credentialShape: text(shape.en, shape.zh) } : {} });
@@ -531,14 +563,15 @@ var NiteSearchClient = (() => {
531
563
  backend("serpex", "Serpex", "https://serpex.dev/docs/api/search", [mode("key", "https://api.serpex.dev/api/search", "trial", "200 one-time credits; paid top-ups start around $0.80/1,000. Vendor routes internally; no fixed upstream engine.", "\u4E00\u6B21\u6027 200 credits\uFF1B\u5145\u503C\u7EA6 $0.80/\u5343\u6B21\u8D77\uFF1B\u4F9B\u5E94\u5546\u5185\u90E8\u8DEF\u7531\uFF0C\u4E0D\u80FD\u56FA\u5B9A\u5176\u4E0A\u6E38\u5F15\u64CE\u3002", "https://serpex.dev/docs/getting-started/pricing")]),
532
564
  backend("x", "X (Twitter)", "https://docs.x.com/x-api/posts/search/quickstart/recent-search", [mode("session", "https://x.com/i/api/graphql", "account", "Uses the browser session cookies (auth_token, ct0) of your own X account. No fee, but X changes its request signing and query ids regularly, so this mode can break until the adapter is updated.", "\u4F7F\u7528\u4F60\u81EA\u5DF1 X \u8D26\u53F7\u7684\u7F51\u9875 cookie\uFF08auth_token\u3001ct0\uFF09\u3002\u4E0D\u4EA7\u751F\u8D39\u7528\uFF0C\u4F46 X \u4F1A\u4E0D\u5B9A\u671F\u6539\u52A8\u524D\u7AEF\u7B7E\u540D\u4E0E queryId\uFF0C\u5931\u6548\u540E\u9700\u8981\u7EF4\u62A4\u8005\u66F4\u65B0\u9002\u914D\u5668\u3002", "https://github.com/bestnite/x-mcp", { en: '{"authToken":"...","ct0":"..."}, or paste auth_token=...; ct0=... straight from DevTools', zh: '{"authToken":"...","ct0":"..."}\uFF0C\u4E5F\u53EF\u4EE5\u76F4\u63A5\u7C98\u8D34\u6D4F\u89C8\u5668\u91CC\u7684 auth_token=...; ct0=...' }), mode("key", "https://api.x.com/2/tweets/search/recent", "paid", "Official API with an app-only bearer token as the key. Pay per post read: about $0.005 each, so a 10-result search costs roughly $0.05. Recent search covers the last 7 days; reads are capped by the posts-per-search option.", "\u5B98\u65B9 API\uFF0C\u5BC6\u94A5\u586B app-only bearer token\u3002\u6309\u8BFB\u53D6\u5E16\u6570\u8BA1\u8D39\uFF1A\u7EA6 $0.005/\u6761\uFF0C\u53D6 10 \u6761\u7EA6 $0.05\u3002\u8FD1\u671F\u641C\u7D22\u53EA\u8986\u76D6\u6700\u8FD1 7 \u5929\uFF0C\u8BFB\u53D6\u6761\u6570\u53D7\u300C\u6BCF\u6B21\u641C\u7D22\u5E16\u6570\u300D\u53C2\u6570\u9650\u5236\u3002", "https://docs.x.com/x-api/getting-started/pricing", { en: '{"bearerToken":"<app-only bearer token>"}', zh: '{"bearerToken":"<app-only bearer \u4EE4\u724C>"}' })], [option("postsPerSearch", "Posts read per search", "\u6BCF\u6B21\u641C\u7D22\u8BFB\u53D6\u5E16\u6570", 10)], ["recency"]),
533
565
  backend("reddit", "Reddit", "https://github.com/reddit-archive/reddit/wiki/API", [mode("anonymous", "https://gql-fed.reddit.com/", "free", "No credentials. Uses the Reddit Android app endpoint, because the public REST search and comments endpoints answer 403 to anonymous tokens since 2026-10. No published quota; shared rate limits.", "\u65E0\u9700\u51ED\u8BC1\u3002\u8D70 Reddit \u5B89\u5353\u5BA2\u6237\u7AEF\u7AEF\u70B9\u2014\u2014\u81EA 2026-10 \u8D77\u516C\u5F00 REST \u7684\u641C\u7D22\u4E0E\u8BC4\u8BBA\u5BF9\u533F\u540D token \u4E00\u5F8B\u8FD4\u56DE 403\u3002\u989D\u5EA6\u672A\u516C\u5E03\uFF0C\u5C5E\u5171\u4EAB\u9650\u6D41\u3002", "https://github.com/bestnite/reddit-readonly-mcp"), mode("oauth", "https://oauth.reddit.com/search", "allowance", "Official OAuth API: about 100 queries/minute per client for non-commercial use. client_credentials reads public data; add a username and password for a script grant.", "\u5B98\u65B9 OAuth API\uFF1A\u975E\u5546\u4E1A\u7528\u9014\u7EA6\u6BCF\u5BA2\u6237\u7AEF 100 \u6B21/\u5206\u949F\u3002client_credentials \u5373\u53EF\u8BFB\u516C\u5F00\u6570\u636E\uFF1B\u8865\u7528\u6237\u540D\u5BC6\u7801\u5219\u7528 script \u6388\u6743\u3002", "https://support.reddithelp.com/hc/en-us/articles/16160319875092-Reddit-Data-API-Wiki", { en: '{"clientId":"...","clientSecret":"..."}; add "username" and "password" for a script grant', zh: '{"clientId":"...","clientSecret":"..."}\uFF1B\u9700\u8981\u811A\u672C\u6388\u6743\u5C31\u518D\u52A0 "username" \u4E0E "password"' })], [option("sort", "Sort", "\u6392\u5E8F", "relevance", ["relevance", "hot", "top", "new", "comments"]), option("time", "Time window", "\u65F6\u95F4\u8303\u56F4", "all", ["all", "hour", "day", "week", "month", "year"]), option("subreddit", "Limit to subreddit", "\u9650\u5B9A\u7248\u5757", "")], ["recency"]),
566
+ backend("xiaohongshu", "Xiaohongshu", "https://git.nite07.com/nite/search-core/tree/main/image", [mode("browser", "ws://127.0.0.1:3000/ws", "self-hosted", "Reads run through a browser you host, so nothing is billed per call and no public quota applies. The browser must be signed in to Xiaohongshu; this project ships an image that provides that browser, a VNC login surface and a token-protected endpoint.", "\u8BFB\u53D6\u8D70\u4F60\u81EA\u5DF1\u6258\u7BA1\u7684\u6D4F\u89C8\u5668\uFF0C\u4E0D\u6309\u6B21\u8BA1\u8D39\u3001\u65E0\u516C\u5F00\u989D\u5EA6\u3002\u6D4F\u89C8\u5668\u9700\u8981\u5904\u4E8E\u5C0F\u7EA2\u4E66\u767B\u5F55\u72B6\u6001\uFF1B\u672C\u9879\u76EE\u63D0\u4F9B\u4E00\u4E2A\u955C\u50CF\uFF0C\u5185\u542B\u6D4F\u89C8\u5668\u3001VNC \u767B\u5F55\u754C\u9762\u548C\u5E26\u4EE4\u724C\u7684\u7AEF\u70B9\u3002", "https://git.nite07.com/nite/search-core/tree/main/image", { en: "Bearer token printed by the browser container at startup. Set it once in the shared browser settings; it protects the browser endpoint, not a site account", zh: "\u6D4F\u89C8\u5668\u5BB9\u5668\u542F\u52A8\u65F6\u6253\u5370\u7684 Bearer \u4EE4\u724C\u3002\u5728\u5171\u4EAB\u6D4F\u89C8\u5668\u8BBE\u7F6E\u4E2D\u586B\u5199\u4E00\u6B21\u5373\u53EF\uFF1B\u5B83\u4FDD\u62A4\u6D4F\u89C8\u5668\u7AEF\u70B9\uFF0C\u4E0D\u662F\u7F51\u7AD9\u8D26\u6237\u51ED\u8BC1" })], [option("sort", "Sort", "\u6392\u5E8F", "general", ["general", "time_descending", "popularity_descending"]), { key: "statePath", type: "string", label: text("Session state file", "\u4F1A\u8BDD\u72B6\u6001\u6587\u4EF6"), help: text("Where the signed-in session is read from. Leave empty to use the container volume default (~/.config/dsh-search/xhs/state.json).", "\u767B\u5F55\u6001\u4ECE\u54EA\u4E2A\u6587\u4EF6\u8BFB\u53D6\u3002\u7559\u7A7A\u5219\u7528\u5BB9\u5668\u5377\u7684\u9ED8\u8BA4\u4F4D\u7F6E\uFF08~/.config/dsh-search/xhs/state.json\uFF09\u3002"), default: "" }], [], "documented", "live"),
534
567
  backend("tencent-wsa", "Tencent Cloud WSA", "https://cloud.tencent.com/document/product/1806/121811", [mode("key", "https://wsa.tencentcloudapi.com/", "paid", "\xA514/\xA520/\xA526 per 1,000 by tier. Store a JSON credential {secretId,secretKey}; no free allowance verified.", "\u5206\u6863 \xA514\uFF0F\xA520\uFF0F\xA526 \u6BCF\u5343\u6B21\u3002\u51ED\u8BC1\u586B\u5199 JSON {secretId,secretKey}\uFF1B\u514D\u8D39\u989D\u5EA6\u672A\u6838\u5B9E\u3002", "https://cloud.tencent.com/product/wsa", { en: '{"secretId":"...","secretKey":"..."}', zh: '{"secretId":"...","secretKey":"..."}' })], [{ ...option("Mode", "Search mode", "\u641C\u7D22\u6A21\u5F0F", 0), min: 0, max: 2 }])
535
568
  ];
536
569
 
537
- // src/locale-map.ts
570
+ // ../search-core/dist/locale-map.js
538
571
  var LANGUAGES = ["", "en", "zh-Hans", "zh-Hant", "ja", "ko", "fr", "de", "es", "pt", "ru", "it", "ar", "nl", "pl", "tr", "vi", "th", "id"];
539
572
  var REGIONS = ["", "US", "GB", "CN", "HK", "TW", "JP", "KR", "SG", "IN", "AU", "CA", "DE", "FR", "ES", "IT", "NL", "BR", "MX", "RU", "TR", "SA"];
540
573
 
541
- // src/config.ts
574
+ // ../search-core/dist/config.js
542
575
  function defaultConfig() {
543
576
  return {
544
577
  mode: "parallel",
@@ -554,50 +587,65 @@ var NiteSearchClient = (() => {
554
587
  excludeDomains: [],
555
588
  dedup: "url",
556
589
  fusion: "rrf",
590
+ browser: { endpoint: "", statePath: "", timeoutMs: 6e4 },
557
591
  retry: { enabled: true, statuses: [408, 429, 500, 502, 503, 504], maxRetries: 2, initialDelayMs: 500, maxDelayMs: 5e3, networkErrors: false, timeouts: false },
558
592
  cache: { enabled: true, ttlSeconds: 900, maxEntries: 100 },
559
593
  breaker: { enabled: false, threshold: 3, cooldownMs: 6e4 },
560
594
  diagnostics: { enabled: true, maxEntries: 50 },
561
595
  tools: { webSearchPlus: true, compactByDefault: false },
562
- backends: Object.fromEntries(catalog.map((d) => [d.id, { enabled: false, mode: d.modes[0].mode, endpoint: d.modes[0].endpoint, credentialRef: `DSH_SEARCH_${d.id.replaceAll("-", "_").toUpperCase()}_KEY`, timeoutMs: 15e3, rateLimitPerMinute: 0, dailyAttemptLimit: 0, options: Object.fromEntries(d.options.map((o) => [o.key, o.default])) }]))
596
+ backends: Object.fromEntries(catalog.map((d) => [d.id, { enabled: false, mode: d.modes[0].mode, endpoint: d.modes[0].endpoint, timeoutMs: 15e3, rateLimitPerMinute: 0, dailyAttemptLimit: 0, options: Object.fromEntries(d.options.map((o) => [o.key, o.default])) }]))
563
597
  };
564
598
  }
565
599
  function validateConfig(value) {
566
600
  const issues = [];
567
601
  const fail = (path, message) => issues.push({ path, message });
568
602
  const object = (v) => !!v && typeof v === "object" && !Array.isArray(v);
569
- if (!object(value)) return [{ path: "config", message: "Expected a configuration object." }];
603
+ if (!object(value))
604
+ return [{ path: "config", message: "Expected a configuration object." }];
570
605
  function shape(v, exemplar, path) {
571
606
  if (Array.isArray(exemplar)) {
572
607
  if (!Array.isArray(v)) {
573
608
  fail(path, "Expected an array.");
574
609
  return;
575
610
  }
576
- if (v.length > 200) fail(path, "Too many entries.");
611
+ if (v.length > 200)
612
+ fail(path, "Too many entries.");
577
613
  if (path === "retry.statuses") {
578
- if (v.some((n) => !Number.isInteger(n) || n < 400 || n > 599)) fail(path, "Expected HTTP error status codes (400\u2013599).");
579
- } else if (v.some((x) => typeof x !== "string" || x.length > 253 || !/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/.test(x))) fail(path, "Expected domain names without scheme, path, or wildcards.");
614
+ if (v.some((n) => !Number.isInteger(n) || n < 400 || n > 599))
615
+ fail(path, "Expected HTTP error status codes (400\u2013599).");
616
+ } else if (v.some((x) => typeof x !== "string" || x.length > 253 || !/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/.test(x)))
617
+ fail(path, "Expected domain names without scheme, path, or wildcards.");
580
618
  } else if (object(exemplar)) {
581
619
  if (!object(v)) {
582
620
  fail(path, "Expected an object.");
583
621
  return;
584
622
  }
585
- for (const k of Object.keys(v)) if (!(k in exemplar) && path !== "backends") fail(path ? `${path}.${k}` : k, "Unknown configuration field.");
586
- for (const [k, e] of Object.entries(exemplar)) shape(v[k], e, path ? `${path}.${k}` : k);
587
- } else if (typeof v !== typeof exemplar || typeof v === "number" && !Number.isFinite(v)) fail(path, `Expected ${typeof exemplar}.`);
588
- else if (typeof v === "string" && v.length > 4096) fail(path, "Value is too long.");
623
+ for (const k of Object.keys(v))
624
+ if (!(k in exemplar) && path !== "backends")
625
+ fail(path ? `${path}.${k}` : k, "Unknown configuration field.");
626
+ for (const [k, e] of Object.entries(exemplar))
627
+ shape(v[k], e, path ? `${path}.${k}` : k);
628
+ } else if (typeof v !== typeof exemplar || typeof v === "number" && !Number.isFinite(v))
629
+ fail(path, `Expected ${typeof exemplar}.`);
630
+ else if (typeof v === "string" && v.length > 4096)
631
+ fail(path, "Value is too long.");
589
632
  }
590
633
  shape(value, defaultConfig(), "");
591
- if (issues.length) return issues;
634
+ if (issues.length)
635
+ return issues;
592
636
  const c = value;
593
637
  const choice = (v, allowed, p) => {
594
- if (!allowed.includes(v)) fail(p, "Unsupported selection.");
638
+ if (!allowed.includes(v))
639
+ fail(p, "Unsupported selection.");
595
640
  };
596
641
  const num = (v, min, max, p) => {
597
- if (!Number.isInteger(v) || v < min || v > max) fail(p, `Expected an integer between ${min} and ${max}.`);
642
+ if (!Number.isInteger(v) || v < min || v > max)
643
+ fail(p, `Expected an integer between ${min} and ${max}.`);
598
644
  };
599
- if (c.language && !LANGUAGES.includes(c.language)) fail("language", "Unsupported language code.");
600
- if (c.region && !REGIONS.includes(c.region)) fail("region", "Unsupported region code.");
645
+ if (c.language && !LANGUAGES.includes(c.language))
646
+ fail("language", "Unsupported language code.");
647
+ if (c.region && !REGIONS.includes(c.region))
648
+ fail("region", "Unsupported region code.");
601
649
  choice(c.mode, ["single", "parallel"], "mode");
602
650
  choice(c.singleBackend, catalog.map((x) => x.id), "singleBackend");
603
651
  choice(c.recency, ["any", "day", "week", "month", "year"], "recency");
@@ -609,35 +657,49 @@ var NiteSearchClient = (() => {
609
657
  num(c.retry.maxRetries, 0, 5, "retry.maxRetries");
610
658
  num(c.retry.initialDelayMs, 0, 6e4, "retry.initialDelayMs");
611
659
  num(c.retry.maxDelayMs, 0, 12e4, "retry.maxDelayMs");
612
- if (c.retry.initialDelayMs > c.retry.maxDelayMs) fail("retry.maxDelayMs", "Maximum delay must not be shorter than initial delay.");
660
+ if (c.retry.initialDelayMs > c.retry.maxDelayMs)
661
+ fail("retry.maxDelayMs", "Maximum delay must not be shorter than initial delay.");
613
662
  num(c.cache.ttlSeconds, 1, 86400, "cache.ttlSeconds");
614
663
  num(c.cache.maxEntries, 1, 1e3, "cache.maxEntries");
615
664
  num(c.breaker.threshold, 1, 100, "breaker.threshold");
616
665
  num(c.breaker.cooldownMs, 1e3, 36e5, "breaker.cooldownMs");
617
666
  num(c.diagnostics.maxEntries, 1, 500, "diagnostics.maxEntries");
667
+ const checkEndpoint = (endpoint, path) => {
668
+ try {
669
+ const url = new URL(endpoint);
670
+ if (url.username || url.password || url.hash || url.search)
671
+ throw 0;
672
+ const schemes = url.protocol === "ws:" || url.protocol === "wss:" ? ["ws:", "wss:"] : ["http:", "https:"];
673
+ if (!schemes.includes(url.protocol))
674
+ throw 0;
675
+ } catch {
676
+ fail(path, "Use an HTTP(S) or WS(S) endpoint without credentials, query, or fragment.");
677
+ }
678
+ };
679
+ const sharedBrowser = c.browser.endpoint;
680
+ if (sharedBrowser)
681
+ checkEndpoint(sharedBrowser, "browser.endpoint");
682
+ if (!(c.browser.timeoutMs >= 1e3 && c.browser.timeoutMs <= 12e4))
683
+ fail("browser.timeoutMs", "Expected 1000 to 120000 milliseconds.");
618
684
  for (const d of catalog) {
619
685
  const b = c.backends[d.id];
620
686
  const p = `backends.${d.id}`;
621
687
  choice(b.mode, d.modes.map((m) => m.mode), `${p}.mode`);
622
- if (b.enabled && d.status === "unverified") fail(`${p}.enabled`, "Backend protocol is not verified.");
623
- if (b.endpoint) {
624
- try {
625
- const url = new URL(b.endpoint);
626
- if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.hash || url.search) throw 0;
627
- const local = url.hostname === "localhost" || url.hostname === "127.0.0.1" || url.hostname === "[::1]";
628
- if (url.protocol === "http:" && !local) throw 0;
629
- } catch {
630
- fail(`${p}.endpoint`, "Use an HTTPS endpoint without credentials, query, or fragment; HTTP is allowed only on loopback.");
631
- }
632
- } else if (b.enabled) fail(`${p}.endpoint`, "An endpoint is required.");
633
- if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(b.credentialRef)) fail(`${p}.credentialRef`, "Expected an environment-style credential reference.");
688
+ if (b.enabled && d.status === "unverified")
689
+ fail(`${p}.enabled`, "Backend protocol is not verified.");
690
+ if (b.endpoint)
691
+ checkEndpoint(b.endpoint, `${p}.endpoint`);
692
+ else if (b.enabled && !(b.mode === "browser" && sharedBrowser))
693
+ fail(`${p}.endpoint`, "An endpoint is required.");
634
694
  num(b.timeoutMs, 1e3, 12e4, `${p}.timeoutMs`);
635
695
  num(b.rateLimitPerMinute, 0, 1e5, `${p}.rateLimitPerMinute`);
636
696
  num(b.dailyAttemptLimit, 0, 1e6, `${p}.dailyAttemptLimit`);
637
697
  for (const o of d.options) {
638
698
  const v = b.options[o.key];
639
- if (o.choices && !o.choices.includes(String(v))) fail(`${p}.options.${o.key}`, "Unsupported option.");
640
- if (typeof v === "number") num(v, o.min ?? 1, o.max ?? 1e5, `${p}.options.${o.key}`);
699
+ if (o.choices && !o.choices.includes(String(v)))
700
+ fail(`${p}.options.${o.key}`, "Unsupported option.");
701
+ if (typeof v === "number")
702
+ num(v, o.min ?? 1, o.max ?? 1e5, `${p}.options.${o.key}`);
641
703
  }
642
704
  }
643
705
  return issues;
@@ -796,7 +858,7 @@ var NiteSearchClient = (() => {
796
858
  return;
797
859
  }
798
860
  const reliability = path.startsWith("retry.") || path.startsWith("breaker.") || path.startsWith("cache.") || path === "diagnostics.enabled" || path === "diagnostics.maxEntries";
799
- setTab(path.startsWith("backends.") ? "backends" : reliability ? "reliability" : "behavior");
861
+ setTab(path.startsWith("backends.") || path.startsWith("browser.") ? "backends" : reliability ? "reliability" : "behavior");
800
862
  setPendingFocus(path);
801
863
  }
802
864
  React.useEffect(() => {
@@ -895,12 +957,11 @@ var NiteSearchClient = (() => {
895
957
  }
896
958
  async function credential(id, remove) {
897
959
  if (!snapshot) return;
898
- const reference = draft.backends[id]?.credentialRef;
899
960
  setPending(`credential-${id}`);
900
961
  setFailed(false);
901
962
  setNotice("working");
902
963
  try {
903
- await request("credential", { backendId: id, ref: reference, ...remove ? { remove: true } : { value: secrets[id] } });
964
+ await request("credential", { backendId: id, ...remove ? { remove: true } : { value: secrets[id] } });
904
965
  setSecrets((previous) => ({ ...previous, [id]: "" }));
905
966
  await refresh();
906
967
  setNotice("credentialSaved");
@@ -912,6 +973,24 @@ var NiteSearchClient = (() => {
912
973
  setPending("");
913
974
  }
914
975
  }
976
+ async function browserCredential(remove) {
977
+ if (!snapshot) return;
978
+ setPending("credential-browser");
979
+ setFailed(false);
980
+ setNotice("working");
981
+ try {
982
+ await request("credential", { scope: "browser", ...remove ? { remove: true } : { value: secrets.browser } });
983
+ setSecrets((previous) => ({ ...previous, browser: "" }));
984
+ await refresh();
985
+ setNotice("credentialSaved");
986
+ } catch {
987
+ setSecrets((previous) => ({ ...previous, browser: "" }));
988
+ setFailed(true);
989
+ setNotice("credentialFailed");
990
+ } finally {
991
+ setPending("");
992
+ }
993
+ }
915
994
  function importConfig() {
916
995
  try {
917
996
  const parsed = JSON.parse(importText);
@@ -968,10 +1047,7 @@ var NiteSearchClient = (() => {
968
1047
  const TABS = ["behavior", "reliability", "diagnostics", "backends"];
969
1048
  const credentialDisabledReason = (id) => {
970
1049
  if (pending) return t("credentialPending");
971
- const reference = draft.backends[id]?.credentialRef;
972
- if (!reference) return t("credentialRefRequired");
973
- const savedReference = snapshot?.config.backends[id]?.credentialRef;
974
- if (reference === savedReference && snapshot?.credentials[id] && !snapshot.credentials[id].writable) return t("credentialReadOnly");
1050
+ if (snapshot?.credentials[id] && !snapshot.credentials[id].writable) return t("credentialReadOnly");
975
1051
  return "";
976
1052
  };
977
1053
  const credentialDisabled = (id) => credentialDisabledReason(id) !== "";
@@ -1009,7 +1085,9 @@ var NiteSearchClient = (() => {
1009
1085
  setDraft(clone(snapshot.defaults));
1010
1086
  setIssues([]);
1011
1087
  setNotice("defaultsRestored");
1012
- }), showTransfer && /* @__PURE__ */ React.createElement("div", { className: "ns-field" }, /* @__PURE__ */ React.createElement("label", { htmlFor: "ns-import" }, t("importLabel")), /* @__PURE__ */ React.createElement("textarea", { id: "ns-import", value: importText, disabled: !!pending, onChange: (event) => setImportText(event.target.value), rows: 8 }), /* @__PURE__ */ React.createElement("button", { disabled: !!pending || !importText.trim(), onClick: importConfig }, t("applyImport"))))), tab === "backends" && /* @__PURE__ */ React.createElement("div", { role: "tabpanel", id: "panel-backends", "aria-labelledby": "tab-backends" }, /* @__PURE__ */ React.createElement("section", { className: "ns-backends", id: "sec-backends", tabIndex: -1, "aria-labelledby": "sec-backends-title" }, /* @__PURE__ */ React.createElement("h3", { id: "sec-backends-title" }, t("backends"), " ", /* @__PURE__ */ React.createElement("span", { className: "ns-muted" }, tr("enabledSummary", { enabled: enabledCount, total: definitions.length }))), /* @__PURE__ */ React.createElement("p", { className: "ns-muted" }, t("backendIntro"), " ", t("colorLegend")), /* @__PURE__ */ React.createElement("div", { className: "ns-toolbar" }, /* @__PURE__ */ React.createElement("div", { className: "ns-field" }, /* @__PURE__ */ React.createElement("label", { htmlFor: "ns-backend-search" }, t("searchBackends")), /* @__PURE__ */ React.createElement("input", { id: "ns-backend-search", type: "search", value: backendQuery, onChange: (event) => setBackendQuery(event.target.value), placeholder: t("searchBackendsPlaceholder") })), /* @__PURE__ */ React.createElement("div", { className: "ns-field" }, /* @__PURE__ */ React.createElement("label", { htmlFor: "ns-backend-filter" }, t("filterBackends")), /* @__PURE__ */ React.createElement("select", { id: "ns-backend-filter", value: backendFilter, onChange: (event) => setBackendFilter(event.target.value) }, ["all", "enabled", "configured"].map((value) => /* @__PURE__ */ React.createElement("option", { key: value, value }, t(`filter.${value}`)))))), ranked.filter(matches).map((def) => {
1088
+ }), showTransfer && /* @__PURE__ */ React.createElement("div", { className: "ns-field" }, /* @__PURE__ */ React.createElement("label", { htmlFor: "ns-import" }, t("importLabel")), /* @__PURE__ */ React.createElement("textarea", { id: "ns-import", value: importText, disabled: !!pending, onChange: (event) => setImportText(event.target.value), rows: 8 }), /* @__PURE__ */ React.createElement("button", { disabled: !!pending || !importText.trim(), onClick: importConfig }, t("applyImport"))))), tab === "backends" && /* @__PURE__ */ React.createElement("div", { role: "tabpanel", id: "panel-backends", "aria-labelledby": "tab-backends" }, /* @__PURE__ */ React.createElement("section", { className: "ns-card", "aria-labelledby": "sec-browser" }, /* @__PURE__ */ React.createElement("h3", { id: "sec-browser" }, t("sharedBrowser")), /* @__PURE__ */ React.createElement("p", { className: "ns-muted" }, t("sharedBrowserHint")), /* @__PURE__ */ React.createElement("div", { className: "ns-grid" }, fields(["browser.endpoint", "browser.statePath", "browser.timeoutMs"], { "browser.timeoutMs": { type: "number" } })), !!snapshot && /* @__PURE__ */ React.createElement("div", { className: "ns-credential" }, /* @__PURE__ */ React.createElement("h5", null, t("browserTokenTitle")), /* @__PURE__ */ React.createElement("p", null, t(snapshot.browser.credentialConfigured ? "credentialConfigured" : "credentialMissing"), " \xB7 ", t("browserTokenHelp")), /* @__PURE__ */ React.createElement("label", { htmlFor: "secret-browser" }, t("browserTokenValue")), /* @__PURE__ */ React.createElement("input", { id: "secret-browser", type: "password", autoComplete: "new-password", value: secrets.browser || "", disabled: !!pending || !snapshot.browser.writable, onChange: (event) => setSecrets((previous) => ({ ...previous, browser: event.target.value })) }), /* @__PURE__ */ React.createElement("div", { className: "ns-actions" }, /* @__PURE__ */ React.createElement("button", { disabled: !!pending || !snapshot.browser.writable || !secrets.browser, onClick: () => browserCredential(false) }, t("saveToken")), /* @__PURE__ */ React.createElement("button", { disabled: !!pending || !snapshot.browser.writable || !snapshot.browser.credentialConfigured, onClick: () => setConfirming({ kind: "delete-browser-credential" }) }, t("deleteCredential"))), confirmRow("delete-browser-credential", "deleteCredentialConfirm", () => {
1089
+ void browserCredential(true);
1090
+ }))), /* @__PURE__ */ React.createElement("section", { className: "ns-backends", id: "sec-backends", tabIndex: -1, "aria-labelledby": "sec-backends-title" }, /* @__PURE__ */ React.createElement("h3", { id: "sec-backends-title" }, t("backends"), " ", /* @__PURE__ */ React.createElement("span", { className: "ns-muted" }, tr("enabledSummary", { enabled: enabledCount, total: definitions.length }))), /* @__PURE__ */ React.createElement("p", { className: "ns-muted" }, t("backendIntro"), " ", t("colorLegend")), /* @__PURE__ */ React.createElement("div", { className: "ns-toolbar" }, /* @__PURE__ */ React.createElement("div", { className: "ns-field" }, /* @__PURE__ */ React.createElement("label", { htmlFor: "ns-backend-search" }, t("searchBackends")), /* @__PURE__ */ React.createElement("input", { id: "ns-backend-search", type: "search", value: backendQuery, onChange: (event) => setBackendQuery(event.target.value), placeholder: t("searchBackendsPlaceholder") })), /* @__PURE__ */ React.createElement("div", { className: "ns-field" }, /* @__PURE__ */ React.createElement("label", { htmlFor: "ns-backend-filter" }, t("filterBackends")), /* @__PURE__ */ React.createElement("select", { id: "ns-backend-filter", value: backendFilter, onChange: (event) => setBackendFilter(event.target.value) }, ["all", "enabled", "configured"].map((value) => /* @__PURE__ */ React.createElement("option", { key: value, value }, t(`filter.${value}`)))))), ranked.filter(matches).map((def) => {
1013
1091
  const backend2 = draft.backends[def.id];
1014
1092
  if (!backend2) return null;
1015
1093
  const mode2 = def.modes.find((item) => item.mode === backend2.mode);
@@ -1017,7 +1095,8 @@ var NiteSearchClient = (() => {
1017
1095
  const credentialState = snapshot.credentials[def.id];
1018
1096
  const locked = def.status !== "documented";
1019
1097
  const anonymous = backend2.mode === "anonymous";
1020
- return /* @__PURE__ */ React.createElement("details", { className: "ns-card ns-backend", key: def.id }, /* @__PURE__ */ React.createElement("summary", null, /* @__PURE__ */ React.createElement("span", { className: "ns-backend-title" }, def.title), /* @__PURE__ */ React.createElement("span", { className: "ns-chips" }, def.modes.map((item) => /* @__PURE__ */ React.createElement("span", { key: item.mode, className: `ns-chip ${item.mode === backend2.mode ? "is-on" : ""} ${item.tier === "unverified" ? "ns-chip--off" : tierRisk(item.tier)}`, "aria-current": item.mode === backend2.mode ? "true" : void 0, title: t(`choice.${item.mode}`) }, t(`choice.${item.mode}`), " \xB7 ", t(`tier.${item.tier}`))), locked && /* @__PURE__ */ React.createElement("span", { className: "ns-chip ns-chip--off" }, t("unverified")), /* @__PURE__ */ React.createElement("span", { className: `ns-dot ${credentialState?.configured ? "is-on" : "is-off"}`, "aria-hidden": "true" }), /* @__PURE__ */ React.createElement("span", { className: `ns-badge ${backend2.enabled ? "is-on" : ""}` }, backend2.enabled ? t("enabled") : t("disabled")))), /* @__PURE__ */ React.createElement("div", { className: "ns-backend-body" }, locked && /* @__PURE__ */ React.createElement("p", { className: "ns-warning" }, t("unverifiedHelp")), /* @__PURE__ */ React.createElement("p", { className: "ns-quota" }, mode2?.limits[lang], " ", /* @__PURE__ */ React.createElement("a", { href: mode2?.pricingUrl || def.docs, target: "_blank", rel: "noreferrer" }, t("source")), " \xB7 ", t("verifiedAt"), " ", def.verifiedAt || t("notVerified")), /* @__PURE__ */ React.createElement("div", { className: "ns-grid" }, fields([`${base}.enabled`, `${base}.mode`, `${base}.endpoint`, `${base}.credentialRef`, `${base}.timeoutMs`, `${base}.rateLimitPerMinute`, `${base}.dailyAttemptLimit`], { [`${base}.enabled`]: { type: "checkbox", disabled: locked }, [`${base}.mode`]: { choices: def.modes.map((item) => item.mode), disabled: locked }, [`${base}.timeoutMs`]: { type: "number" }, [`${base}.rateLimitPerMinute`]: { type: "number" }, [`${base}.dailyAttemptLimit`]: { type: "number" } }).filter((node) => !(anonymous && node.key === `${base}.credentialRef`))), anonymous && !locked && /* @__PURE__ */ React.createElement("p", { className: "ns-muted" }, t("anonymousNoCredential")), def.options.length > 0 && /* @__PURE__ */ React.createElement("details", { className: "ns-advanced" }, /* @__PURE__ */ React.createElement("summary", null, t("advancedOptions")), /* @__PURE__ */ React.createElement("div", { className: "ns-grid" }, def.options.map((option2) => field(`${base}.options.${option2.key}`, { type: option2.type === "boolean" ? "checkbox" : option2.type === "number" ? "number" : "text", choices: option2.choices, help: option2.help[lang], customLabel: option2.label[lang], disabled: locked, min: option2.min, max: option2.max })))), !anonymous && !locked && /* @__PURE__ */ React.createElement("div", { className: "ns-credential" }, /* @__PURE__ */ React.createElement("h5", null, t("credentialTitle")), /* @__PURE__ */ React.createElement("p", null, t(credentialState?.configured ? "credentialConfigured" : "credentialMissing"), " \xB7 ", t("credentialHelp")), /* @__PURE__ */ React.createElement("p", { className: "ns-credential-shape", "aria-label": t("credentialShapeLabel") }, /* @__PURE__ */ React.createElement("code", null, mode2?.credentialShape?.[lang] ?? t("credentialPlainKey"))), /* @__PURE__ */ React.createElement("label", { htmlFor: `secret-${def.id}` }, t("credentialValue")), /* @__PURE__ */ React.createElement("input", { id: `secret-${def.id}`, type: "password", autoComplete: "new-password", "aria-describedby": `secret-${def.id}-why`, value: secrets[def.id] || "", disabled: credentialDisabled(def.id), onChange: (event) => setSecrets((previous) => ({ ...previous, [def.id]: event.target.value })) }), credentialDisabledReason(def.id) && /* @__PURE__ */ React.createElement("small", { id: `secret-${def.id}-why`, className: "ns-warning" }, credentialDisabledReason(def.id)), /* @__PURE__ */ React.createElement("div", { className: "ns-actions" }, /* @__PURE__ */ React.createElement("button", { disabled: credentialDisabled(def.id) || !secrets[def.id], onClick: () => credential(def.id, false) }, t("replaceCredential")), /* @__PURE__ */ React.createElement("button", { disabled: credentialDisabled(def.id) || !credentialState?.configured, onClick: () => setConfirming({ kind: `delete-credential-${def.id}`, backendId: def.id }) }, t("deleteCredential"))), confirmRow(`delete-credential-${def.id}`, "deleteCredentialConfirm", () => {
1098
+ const readsThroughBrowser = backend2.mode === "browser";
1099
+ return /* @__PURE__ */ React.createElement("details", { className: "ns-card ns-backend", key: def.id }, /* @__PURE__ */ React.createElement("summary", null, /* @__PURE__ */ React.createElement("span", { className: "ns-backend-title" }, def.title), /* @__PURE__ */ React.createElement("span", { className: "ns-chips" }, def.modes.map((item) => /* @__PURE__ */ React.createElement("span", { key: item.mode, className: `ns-chip ${item.mode === backend2.mode ? "is-on" : ""} ${item.tier === "unverified" ? "ns-chip--off" : tierRisk(item.tier)}`, "aria-current": item.mode === backend2.mode ? "true" : void 0, title: t(`choice.${item.mode}`) }, t(`choice.${item.mode}`), " \xB7 ", t(`tier.${item.tier}`))), locked && /* @__PURE__ */ React.createElement("span", { className: "ns-chip ns-chip--off" }, t("unverified")), /* @__PURE__ */ React.createElement("span", { className: `ns-dot ${credentialState?.configured ? "is-on" : "is-off"}`, "aria-hidden": "true" }), /* @__PURE__ */ React.createElement("span", { className: `ns-badge ${backend2.enabled ? "is-on" : ""}` }, backend2.enabled ? t("enabled") : t("disabled")))), /* @__PURE__ */ React.createElement("div", { className: "ns-backend-body" }, locked && /* @__PURE__ */ React.createElement("p", { className: "ns-warning" }, t("unverifiedHelp")), /* @__PURE__ */ React.createElement("p", { className: "ns-quota" }, mode2?.limits[lang], " ", /* @__PURE__ */ React.createElement("a", { href: mode2?.pricingUrl || def.docs, target: "_blank", rel: "noreferrer" }, t("source")), " \xB7 ", t("verifiedAt"), " ", def.verifiedAt || t("notVerified")), /* @__PURE__ */ React.createElement("div", { className: "ns-grid" }, fields(readsThroughBrowser ? [`${base}.enabled`, `${base}.mode`, `${base}.timeoutMs`, `${base}.rateLimitPerMinute`, `${base}.dailyAttemptLimit`] : [`${base}.enabled`, `${base}.mode`, `${base}.endpoint`, `${base}.timeoutMs`, `${base}.rateLimitPerMinute`, `${base}.dailyAttemptLimit`], { [`${base}.enabled`]: { type: "checkbox", disabled: locked }, [`${base}.mode`]: { choices: def.modes.map((item) => item.mode), disabled: locked }, [`${base}.timeoutMs`]: { type: "number" }, [`${base}.rateLimitPerMinute`]: { type: "number" }, [`${base}.dailyAttemptLimit`]: { type: "number" } })), readsThroughBrowser && /* @__PURE__ */ React.createElement("div", { className: "ns-inherit" }, /* @__PURE__ */ React.createElement("p", null, draft.browser.endpoint ? tr("browserInheritedEndpoint", { endpoint: draft.browser.endpoint }) : backend2.endpoint ? tr("browserOwnEndpoint", { endpoint: backend2.endpoint }) : t("browserInheritedEndpointMissing"), !draft.browser.endpoint && !backend2.endpoint && /* @__PURE__ */ React.createElement("button", { type: "button", className: "ns-link", onClick: () => focusPath("browser.endpoint") }, t("fixIt"))), /* @__PURE__ */ React.createElement("p", { className: "ns-muted" }, t("browserInheritedHint")), /* @__PURE__ */ React.createElement("details", { className: "ns-advanced" }, /* @__PURE__ */ React.createElement("summary", null, t("browserOverride")), /* @__PURE__ */ React.createElement("p", { className: "ns-muted" }, t("browserOverrideHint")), /* @__PURE__ */ React.createElement("div", { className: "ns-grid" }, fields([`${base}.endpoint`])))), anonymous && !locked && /* @__PURE__ */ React.createElement("p", { className: "ns-muted" }, t("anonymousNoCredential")), def.options.length > 0 && /* @__PURE__ */ React.createElement("details", { className: "ns-advanced" }, /* @__PURE__ */ React.createElement("summary", null, t("advancedOptions")), /* @__PURE__ */ React.createElement("div", { className: "ns-grid" }, def.options.map((option2) => field(`${base}.options.${option2.key}`, { type: option2.type === "boolean" ? "checkbox" : option2.type === "number" ? "number" : "text", choices: option2.choices, help: option2.help[lang], customLabel: option2.label[lang], disabled: locked, min: option2.min, max: option2.max })))), !anonymous && !locked && !readsThroughBrowser && /* @__PURE__ */ React.createElement("div", { className: "ns-credential" }, /* @__PURE__ */ React.createElement("h5", null, t("credentialTitle")), /* @__PURE__ */ React.createElement("p", null, t(credentialState?.configured ? "credentialConfigured" : "credentialMissing"), " \xB7 ", t("credentialHelp")), /* @__PURE__ */ React.createElement("p", { className: "ns-credential-shape", "aria-label": t("credentialShapeLabel") }, /* @__PURE__ */ React.createElement("code", null, mode2?.credentialShape?.[lang] ?? t("credentialPlainKey"))), /* @__PURE__ */ React.createElement("label", { htmlFor: `secret-${def.id}` }, t("credentialValue")), /* @__PURE__ */ React.createElement("input", { id: `secret-${def.id}`, type: "password", autoComplete: "new-password", "aria-describedby": `secret-${def.id}-why`, value: secrets[def.id] || "", disabled: credentialDisabled(def.id), onChange: (event) => setSecrets((previous) => ({ ...previous, [def.id]: event.target.value })) }), credentialDisabledReason(def.id) && /* @__PURE__ */ React.createElement("small", { id: `secret-${def.id}-why`, className: "ns-warning" }, credentialDisabledReason(def.id)), /* @__PURE__ */ React.createElement("div", { className: "ns-actions" }, /* @__PURE__ */ React.createElement("button", { disabled: credentialDisabled(def.id) || !secrets[def.id], onClick: () => credential(def.id, false) }, t("replaceCredential")), /* @__PURE__ */ React.createElement("button", { disabled: credentialDisabled(def.id) || !credentialState?.configured, onClick: () => setConfirming({ kind: `delete-credential-${def.id}`, backendId: def.id }) }, t("deleteCredential"))), confirmRow(`delete-credential-${def.id}`, "deleteCredentialConfirm", () => {
1021
1100
  void credential(def.id, true);
1022
1101
  })), /* @__PURE__ */ React.createElement("p", { className: "ns-meta" }, /* @__PURE__ */ React.createElement("span", null, t("attemptsToday"), " ", /* @__PURE__ */ React.createElement("strong", null, snapshot.counters[def.id]?.attempts ?? 0)), /* @__PURE__ */ React.createElement("span", { "aria-hidden": "true" }, "\xB7"), /* @__PURE__ */ React.createElement("span", null, snapshot.counters[def.id]?.day ?? t("noData")))));
1023
1102
  }), !definitions.some(matches) && /* @__PURE__ */ React.createElement("p", { className: "ns-muted" }, t("noMatch")))), /* @__PURE__ */ React.createElement("footer", { className: "ns-footer" }, /* @__PURE__ */ React.createElement("span", { "aria-live": "polite" }, dirty ? tr("unsavedWithErrors", { errors: issues.length }) : t("upToDate")), /* @__PURE__ */ React.createElement("div", { className: "ns-actions" }, /* @__PURE__ */ React.createElement("button", { disabled: !!pending || !dirty, onClick: () => setConfirming({ kind: "discard" }) }, t("discard")), /* @__PURE__ */ React.createElement("button", { className: "ns-primary", disabled: !!pending || !dirty, onClick: save }, t(pending === "save" ? "saving" : "save"))), confirmRow("discard", "discardConfirm", () => {