@nite07/dsh-search 0.1.4 → 0.1.11
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 +23 -6
- package/README.zh.md +20 -6
- package/dist/client.js +108 -41
- package/dist/index.js +154 -2748
- package/dist/index.js.map +4 -4
- package/docs/BACKENDS.md +49 -1
- package/docs/VERIFICATION.md +38 -5
- package/locale/en.json +24 -6
- package/locale/zh.json +24 -6
- package/package.json +28 -11
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
English | [中文](README.zh.md)
|
|
4
4
|
|
|
5
|
-
Multi-backend web search for DeepSeek Harness:
|
|
5
|
+
Multi-backend web search for DeepSeek Harness: 24 search providers you turn on one by one, each with an explicit access mode and a visible cost tier.
|
|
6
6
|
|
|
7
7
|
## Install
|
|
8
8
|
|
|
@@ -21,7 +21,7 @@ Then make it the search source: open **Settings → Web search**. If the page sa
|
|
|
21
21
|
2. In the **Backends** tab, pick the providers you want, choose the access mode for each, and check the cost line before enabling.
|
|
22
22
|
3. Press **Save settings**. Every backend starts disabled, so nothing is called until you save.
|
|
23
23
|
|
|
24
|
-
The **Test & diagnostics** tab runs one explicit search against a saved backend and shows the exact request outcome.
|
|
24
|
+
The **Test & diagnostics** tab runs one explicit search against a saved backend and shows the exact request outcome. A browser-backed backend (currently Xiaohongshu) also needs the shared browser set up first — see below.
|
|
25
25
|
|
|
26
26
|
## Backends and cost
|
|
27
27
|
|
|
@@ -30,8 +30,8 @@ The list is grouped by the cheapest path a backend offers, so anything with a fr
|
|
|
30
30
|
| Group | Backends | Notes |
|
|
31
31
|
| --- | --- | --- |
|
|
32
32
|
| **Free path available** | Keenable, AnySearch, Exa, Parallel, You.com, DuckDuckGo, Reddit | No signup, no key, works immediately |
|
|
33
|
-
| **Own account** | X | Your own X browser cookies: no fee, but it breaks when X changes its
|
|
34
|
-
| **Self-hosted** | SearXNG, open-websearch | You run the service and set your own limits |
|
|
33
|
+
| **Own account** | X | Your own X browser cookies: no fee, but it breaks when X changes the operations its page embeds |
|
|
34
|
+
| **Self-hosted** | SearXNG, open-websearch, Xiaohongshu | You run the service and set your own limits; Xiaohongshu reads through a browser container you host |
|
|
35
35
|
| **Free allowance** | Linkup, Tavily, Brave, Zhihu (web and site), Baidu, Doubao | Sign up for a key, free within the quota |
|
|
36
36
|
| **Trial credits** | Serpex | One-off trial credits, then paid |
|
|
37
37
|
| **Paid** | Mojeek, Anthropic, OpenAI, DeepSeek, Tencent WSA | Billed per use; check the price before enabling |
|
|
@@ -39,21 +39,38 @@ The list is grouped by the cheapest path a backend offers, so anything with a fr
|
|
|
39
39
|
- Every backend is **disabled by default**; nothing is enabled automatically.
|
|
40
40
|
- Per-backend quotas, prices, sources and the date they were checked: [docs/BACKENDS.md](docs/BACKENDS.md).
|
|
41
41
|
|
|
42
|
+
## Browser-backed backends
|
|
43
|
+
|
|
44
|
+
Xiaohongshu answers only its own page runtime, so it has no callable HTTP endpoint. That backend drives a browser you host instead of a vendor API: nothing is billed per call and no public quota applies, and the cost is the machine that runs the browser.
|
|
45
|
+
|
|
46
|
+
One browser serves every backend in browser mode:
|
|
47
|
+
|
|
48
|
+
1. Start the browser container from the `image/` directory of [`@nite07/search-core`](https://git.nite07.com/nite/search/src/branch/main/packages/core/image). It prints the endpoint and a bearer token at startup.
|
|
49
|
+
2. Open its noVNC page (`http://<host>:6080/vnc.html`) and sign in to Xiaohongshu in the window that is already open. That window is the session; the container writes it to disk every minute.
|
|
50
|
+
3. In **Settings → Web search → Backends**, fill the **Shared browser** block — endpoint (`ws://<host>:3000/ws`), session file (optional), read timeout, per-site concurrent reads (1–8, default 2) — and paste the printed token as the **endpoint token**.
|
|
51
|
+
|
|
52
|
+
The token guards the browser endpoint, not a site account, so it is stored once for the browser rather than per backend. The shared endpoint wins over a backend's own; a backend's endpoint is a fallback used only while the shared one is empty. The session file must be the one the container writes — otherwise every read starts signed out. Nothing in this plugin can sign in: login stays with whoever owns that browser. The per-site concurrent-read setting bounds how many reads run on one site at once; it is not the global parallel-backend count on the behaviour tab, and a 429 answer lowers it to 1 for the rest of that browser session.
|
|
53
|
+
|
|
42
54
|
## Tools
|
|
43
55
|
|
|
44
56
|
- `web_search` — the backend fan-out described above.
|
|
45
57
|
- `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
58
|
- `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.
|
|
59
|
+
- `xiaohongshu_note` — read one Xiaohongshu note: text, author, engagement counts, tags, its pictures, 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 plus a shared browser endpoint, and reports a disabled backend, a missing endpoint or a missing note token instead of an empty note.
|
|
47
60
|
- `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.
|
|
48
|
-
- `search_manage` — inspect or change this plugin's settings from the agent side.
|
|
61
|
+
- `search_manage` — inspect or change this plugin's settings from the agent side, including the shared browser token (`scope: browser`) instead of a backend credential.
|
|
49
62
|
|
|
50
63
|
## Development
|
|
51
64
|
|
|
65
|
+
Run from the monorepo root (the root lockfile owns all workspace dependencies):
|
|
66
|
+
|
|
52
67
|
```sh
|
|
53
|
-
npm
|
|
68
|
+
npm ci --ignore-scripts
|
|
54
69
|
npm run check
|
|
55
70
|
```
|
|
56
71
|
|
|
72
|
+
See the [workspace guide](../../README.md) for build order, SDK development dependencies and packaging.
|
|
73
|
+
|
|
57
74
|
Design notes: [docs/PLAN.md](docs/PLAN.md). Verification status: [docs/VERIFICATION.md](docs/VERIFICATION.md).
|
|
58
75
|
|
|
59
76
|
## License
|
package/README.zh.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md) | 中文
|
|
4
4
|
|
|
5
|
-
给 DeepSeek Harness 用的多后端网页搜索:
|
|
5
|
+
给 DeepSeek Harness 用的多后端网页搜索:24 家搜索服务,逐个开关,每个都明确选定接入模式、标明费用档。
|
|
6
6
|
|
|
7
7
|
## 安装
|
|
8
8
|
|
|
@@ -21,7 +21,7 @@ dsh --profile web # 或者用你自己的方式重启 dsh web
|
|
|
21
21
|
2. 在「搜索后端」页签里挑后端,逐家选择接入模式(匿名、Key、OAuth、会话等),先看费用说明再启用
|
|
22
22
|
3. 点「保存设置」。所有后端默认关闭,不保存就一个请求都不会发出
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
想先验一下某家通不通,用「试搜与诊断」页签:它会明确发一次搜索,并把结果和失败原因原样显示出来。走浏览器的后端(目前是小红书)还得先把共享浏览器配好,见下一节。
|
|
25
25
|
|
|
26
26
|
## 后端与费用
|
|
27
27
|
|
|
@@ -30,8 +30,8 @@ dsh --profile web # 或者用你自己的方式重启 dsh web
|
|
|
30
30
|
| 分组 | 有哪些 | 说明 |
|
|
31
31
|
| --- | --- | --- |
|
|
32
32
|
| **有完全免费的用法** | Keenable、AnySearch、Exa、Parallel、You.com、DuckDuckGo、Reddit | 不用注册、不用 Key,开箱可用 |
|
|
33
|
-
| **自带账号** | X | 用你自己 X 网页端的 cookie,不花钱,但 X
|
|
34
|
-
| **自托管** | SearXNG、open-websearch |
|
|
33
|
+
| **自带账号** | X | 用你自己 X 网页端的 cookie,不花钱,但 X 改动页面里内嵌的接口时会失效 |
|
|
34
|
+
| **自托管** | SearXNG、open-websearch、小红书(Xiaohongshu) | 自己跑服务,额度由你自己定;小红书走的是你自己托管的浏览器 |
|
|
35
35
|
| **免费额度** | Linkup、Tavily、Brave、知乎(网页/站内)、百度、豆包 | 注册拿 Key,额度内免费 |
|
|
36
36
|
| **试用额度** | Serpex | 一次性试用额度,用完转付费 |
|
|
37
37
|
| **付费** | Mojeek、Anthropic、OpenAI、DeepSeek、腾讯 WSA | 按量收费,开之前先看单价 |
|
|
@@ -39,18 +39,32 @@ dsh --profile web # 或者用你自己的方式重启 dsh web
|
|
|
39
39
|
- 默认**全部关闭**,一个都不会自动启用
|
|
40
40
|
- 各家的具体额度、单价、来源链接和核实日期见 [docs/BACKENDS.md](docs/BACKENDS.md)
|
|
41
41
|
|
|
42
|
+
## 走浏览器的后端
|
|
43
|
+
|
|
44
|
+
小红书只认自己的页面运行时,没有能直接调的 HTTP 接口,所以这个后端用的是你自己托管的浏览器,而不是厂商 API:不按次计费,也没有公开额度,成本就是那台跑浏览器的机器。
|
|
45
|
+
|
|
46
|
+
browser 模式的后端共用一个浏览器:
|
|
47
|
+
|
|
48
|
+
1. 用 [`@nite07/search-core`](https://git.nite07.com/nite/search/src/branch/main/packages/core/image) 里 `image/` 目录的镜像起一个容器,启动日志会打印端点和令牌
|
|
49
|
+
2. 打开它的 noVNC 页面(`http://<host>:6080/vnc.html`),在那扇已经开着的窗口里登录小红书。这扇窗口就是登录态,容器每分钟把它写进磁盘
|
|
50
|
+
3. 打开 **设置 → 网页搜索 → 搜索后端**,填「共享浏览器」那一段:端点(`ws://<host>:3000/ws`)、会话文件(可留空)、读取超时、同站点并发读取数(1–8,默认 2);再把启动日志里的令牌填进「端点令牌」
|
|
51
|
+
|
|
52
|
+
令牌保护的是浏览器端点,不是网站账号,所以它按浏览器存一份,不按后端存。共享端点优先于后端自己的端点,后端里那个只在共享端点留空时兜底。会话文件要和容器写的是同一个文件,否则每次读回来都是未登录。插件本身没法登录,登录永远留在那个浏览器的主人手里。同站点并发读取数限制的是同一个站点上同时跑几个浏览器读取,和「搜索行为」里的全局并行数量不是一回事;遇到 429 限流后,本次浏览器会话会保守降到 1。
|
|
53
|
+
|
|
42
54
|
## 工具
|
|
43
55
|
|
|
44
56
|
- `web_search` — 上面说的多后端搜索。
|
|
45
57
|
- `web_search_plus` — 按本次调用指定搜索策略:(可在设置里关闭:关闭后不注册该工具)`mode`(单后端/并行)、`backends`(从已启用里挑子集)、`allBackends` + `exclude`(全用但排掉几家,比列 id 省字符)、`compact`(只回标题和链接,丢掉摘要,省结果 token;可在设置里设为默认)、`maxResults`。只影响这一次调用,不改配置;没启用的后端会被明确告知而不是被悄悄忽略,实际用了哪些也会回显。
|
|
46
58
|
- `x_thread` — 读一条 X 推文及其回复,让搜索到的讨论可以被引用;需要 X 后端处于会话模式,深度、回复条数和字符预算都有上限。
|
|
59
|
+
- `xiaohongshu_note` — 读一篇小红书笔记:正文、作者、赞藏评转、标签、配图,需要的话再读一层评论。吃分享链接(里面带着读取要用的 token)或本次会话里搜到的笔记 id;需要小红书后端处于 browser 模式且共享浏览器端点已配置,后端没开、端点没配、缺 token 都会直说,不会回一篇空笔记。
|
|
47
60
|
- `reddit_thread` — 读某个 Reddit 帖子的完整评论树,让模型能引用真实讨论而不是猜;按深度、评论条数和字符预算截断。
|
|
48
|
-
- `search_manage` — 从 agent
|
|
61
|
+
- `search_manage` — 从 agent 侧查看或修改本插件自己的设置,包括共享浏览器令牌(`scope: browser`)而不只是某个后端的凭证。
|
|
49
62
|
|
|
50
63
|
## 开发
|
|
51
64
|
|
|
52
65
|
```sh
|
|
53
|
-
|
|
66
|
+
# 在 monorepo 根目录运行,统一使用根锁文件
|
|
67
|
+
npm ci --ignore-scripts
|
|
54
68
|
npm run check
|
|
55
69
|
```
|
|
56
70
|
|
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: "
|
|
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,34 @@ 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
|
-
|
|
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
|
+
"field.browser.maxConcurrentReads": "Per-site concurrent reads",
|
|
270
|
+
"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.",
|
|
271
|
+
"help.browser.statePath": "Optional. Where the browser container writes the signed-in session; empty uses the search core default.",
|
|
272
|
+
"help.browser.timeoutMs": "How long one browser read may take.",
|
|
273
|
+
"help.browser.maxConcurrentReads": "How many browser reads may run at once on one site. This differs from \u201CParallel concurrency\u201D under \u201CSearch behavior\u201D: that setting bounds search requests across providers, while this bounds reads on the one shared browser page. A 429 rate-limit answer lowers it to 1 for the rest of that browser session; it is a local safety bound, not a site quota.",
|
|
274
|
+
sharedBrowser: "Shared browser",
|
|
275
|
+
sharedBrowserHint: "This block describes the browser container you host: its endpoint, its endpoint token, the session file, the read timeout and the per-site read cap. Every backend in browser mode shares it.",
|
|
276
|
+
browserTokenTitle: "Endpoint token",
|
|
277
|
+
browserTokenValue: "New endpoint token",
|
|
278
|
+
saveToken: "Save token",
|
|
279
|
+
browserTokenHelp: "Used to connect to the browser service. Sign in to Xiaohongshu through VNC.",
|
|
280
|
+
browserInheritedEndpoint: "This backend inherits the shared endpoint: {{endpoint}}",
|
|
281
|
+
browserInheritedEndpointMissing: "This backend has no endpoint to connect to: the shared browser settings are empty and it names none of its own.",
|
|
282
|
+
browserOwnEndpoint: "The shared browser endpoint is empty, so this backend uses its own endpoint: {{endpoint}}.",
|
|
283
|
+
browserInheritedHint: "The endpoint and the token both come from the shared browser settings, so they are changed in one place.",
|
|
284
|
+
browserOverride: "Give this backend its own endpoint (fallback only)",
|
|
285
|
+
browserOverrideHint: "Applies only while the shared browser settings are empty. Use it to point one backend at a different browser container."
|
|
268
286
|
};
|
|
269
287
|
|
|
270
288
|
// locale/zh.json
|
|
@@ -331,7 +349,7 @@ var NiteSearchClient = (() => {
|
|
|
331
349
|
credentialTitle: "\u51ED\u8BC1\u5B58\u50A8",
|
|
332
350
|
credentialConfigured: "\u5DF2\u914D\u7F6E\u51ED\u8BC1",
|
|
333
351
|
credentialMissing: "\u672A\u914D\u7F6E\u51ED\u8BC1",
|
|
334
|
-
credentialHelp: "\u51ED\u8BC1\
|
|
352
|
+
credentialHelp: "\u51ED\u8BC1\u4FDD\u5B58\u540E\u4E0D\u4F1A\u56DE\u663E\u3002",
|
|
335
353
|
credentialValue: "\u65B0\u7684\u51ED\u8BC1\u503C",
|
|
336
354
|
replaceCredential: "\u66FF\u6362\u51ED\u8BC1",
|
|
337
355
|
deleteCredential: "\u5220\u9664\u51ED\u8BC1",
|
|
@@ -457,8 +475,6 @@ var NiteSearchClient = (() => {
|
|
|
457
475
|
"help.backend.mode": "\u56FA\u5B9A\u4F7F\u7528\u533F\u540D\u6216\u5BC6\u94A5\u6A21\u5F0F\uFF0C\u4E0D\u81EA\u52A8\u5207\u6362\u3002",
|
|
458
476
|
"field.backend.endpoint": "\u7AEF\u70B9 URL",
|
|
459
477
|
"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
478
|
"field.backend.timeoutMs": "\u8BF7\u6C42\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09",
|
|
463
479
|
"help.backend.timeoutMs": "\u6BCF\u6B21\u540E\u7AEF\u8BF7\u6C42\u7684\u65F6\u95F4\u4E0A\u9650\u3002",
|
|
464
480
|
"field.backend.rateLimitPerMinute": "\u6BCF\u5206\u949F\u5C1D\u8BD5\u4E0A\u9650",
|
|
@@ -493,17 +509,37 @@ var NiteSearchClient = (() => {
|
|
|
493
509
|
"choice.session": "\u6D4F\u89C8\u5668\u4F1A\u8BDD Cookie",
|
|
494
510
|
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
511
|
credentialPending: "\u5F53\u524D\u64CD\u4F5C\u8FD8\u6CA1\u7ED3\u675F\uFF0C\u7A0D\u7B49\u3002",
|
|
496
|
-
|
|
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",
|
|
512
|
+
credentialReadOnly: "\u8BE5\u51ED\u8BC1\u7531\u5176\u4ED6\u6765\u6E90\u63D0\u4F9B\uFF0C\u65E0\u6CD5\u5728\u6B64\u4FEE\u6539\u3002",
|
|
498
513
|
credentialPlainKey: "\u76F4\u63A5\u586B\u5BC6\u94A5\u5B57\u7B26\u4E32\u3002",
|
|
499
514
|
credentialShapeLabel: "\u51ED\u8BC1\u683C\u5F0F",
|
|
500
515
|
"field.tools.webSearchPlus": "\u5141\u8BB8\u4F7F\u7528 web_search_plus",
|
|
501
516
|
"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
517
|
"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"
|
|
518
|
+
"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",
|
|
519
|
+
"choice.browser": "\u6D4F\u89C8\u5668",
|
|
520
|
+
"field.browser.endpoint": "\u5171\u4EAB\u6D4F\u89C8\u5668\u7AEF\u70B9",
|
|
521
|
+
"field.browser.statePath": "\u5171\u4EAB\u4F1A\u8BDD\u6587\u4EF6",
|
|
522
|
+
"field.browser.timeoutMs": "\u6D4F\u89C8\u5668\u8BFB\u53D6\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09",
|
|
523
|
+
"field.browser.maxConcurrentReads": "\u540C\u7AD9\u70B9\u5E76\u53D1\u8BFB\u53D6\u6570",
|
|
524
|
+
"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",
|
|
525
|
+
"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",
|
|
526
|
+
"help.browser.timeoutMs": "\u4E00\u6B21\u6D4F\u89C8\u5668\u8BFB\u53D6\u6700\u591A\u7B49\u591A\u4E45\u3002",
|
|
527
|
+
"help.browser.maxConcurrentReads": "\u540C\u4E00\u4E2A\u7AD9\u70B9\u4E0A\u6700\u591A\u540C\u65F6\u8DD1\u51E0\u4E2A\u6D4F\u89C8\u5668\u8BFB\u53D6\u3002\u5B83\u4E0E\u201C\u641C\u7D22\u884C\u4E3A\u201D\u4E2D\u7684\u201C\u5E76\u884C\u6570\u91CF\u201D\u4F5C\u7528\u4E0D\u540C\uFF1A\u540E\u8005\u9650\u5236\u7684\u662F\u540C\u65F6\u8BF7\u6C42\u591A\u5C11\u4E2A\u641C\u7D22\u540E\u7AEF\uFF0C\u8FD9\u91CC\u9650\u5236\u7684\u662F\u5171\u4EAB\u6D4F\u89C8\u5668\u9875\u9762\u4E0A\u7684\u8BFB\u53D6\u3002\u9047\u5230 429 \u9650\u6D41\u540E\uFF0C\u672C\u6B21\u6D4F\u89C8\u5668\u4F1A\u8BDD\u4F1A\u4FDD\u5B88\u964D\u5230 1\uFF1B\u8FD9\u662F\u672C\u5730\u5B89\u5168\u4E0A\u9650\uFF0C\u4E0D\u4EE3\u8868\u7F51\u7AD9\u989D\u5EA6\u3002",
|
|
528
|
+
sharedBrowser: "\u5171\u4EAB\u6D4F\u89C8\u5668",
|
|
529
|
+
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\u3001\u8BFB\u53D6\u8D85\u65F6\u4E0E\u540C\u7AD9\u70B9\u5E76\u53D1\u8BFB\u53D6\u6570\u3002\u6240\u6709\u5904\u4E8E\u6D4F\u89C8\u5668\u6A21\u5F0F\u7684\u540E\u7AEF\u90FD\u5171\u7528\u8FD9\u4E00\u4EFD\u914D\u7F6E\u3002",
|
|
530
|
+
browserTokenTitle: "\u7AEF\u70B9\u4EE4\u724C",
|
|
531
|
+
browserTokenValue: "\u65B0\u7684\u7AEF\u70B9\u4EE4\u724C",
|
|
532
|
+
saveToken: "\u4FDD\u5B58\u4EE4\u724C",
|
|
533
|
+
browserTokenHelp: "\u7528\u4E8E\u8FDE\u63A5\u6D4F\u89C8\u5668\u670D\u52A1\u3002\u5C0F\u7EA2\u4E66\u8D26\u53F7\u8BF7\u5728 VNC \u4E2D\u767B\u5F55\u3002",
|
|
534
|
+
browserInheritedEndpoint: "\u8BE5\u540E\u7AEF\u7EE7\u627F\u5171\u4EAB\u7AEF\u70B9\uFF1A{{endpoint}}",
|
|
535
|
+
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",
|
|
536
|
+
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",
|
|
537
|
+
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",
|
|
538
|
+
browserOverride: "\u4E3A\u8BE5\u540E\u7AEF\u5355\u72EC\u6307\u5B9A\u7AEF\u70B9\uFF08\u4EC5\u4F5C\u515C\u5E95\uFF09",
|
|
539
|
+
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
540
|
};
|
|
505
541
|
|
|
506
|
-
// ../
|
|
542
|
+
// ../core/dist/catalog.js
|
|
507
543
|
var text = (en, zh) => ({ en, zh });
|
|
508
544
|
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
545
|
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 +567,20 @@ var NiteSearchClient = (() => {
|
|
|
531
567
|
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
568
|
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
569
|
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"]),
|
|
570
|
+
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 core default (~/.config/dsh-search/browser/state.json), which has to be the file the browser container writes.", "\u767B\u5F55\u6001\u4ECE\u54EA\u4E2A\u6587\u4EF6\u8BFB\u53D6\u3002\u7559\u7A7A\u5219\u7528\u6838\u5FC3\u9ED8\u8BA4\u4F4D\u7F6E\uFF08~/.config/dsh-search/browser/state.json\uFF09\uFF0C\u5B83\u5FC5\u987B\u548C\u6D4F\u89C8\u5668\u5BB9\u5668\u5199\u51FA\u7684\u6587\u4EF6\u662F\u540C\u4E00\u4E2A\u3002"), default: "" }], [], "documented", "live"),
|
|
534
571
|
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
572
|
];
|
|
536
573
|
|
|
537
|
-
// ../
|
|
574
|
+
// ../core/dist/locale-map.js
|
|
538
575
|
var LANGUAGES = ["", "en", "zh-Hans", "zh-Hant", "ja", "ko", "fr", "de", "es", "pt", "ru", "it", "ar", "nl", "pl", "tr", "vi", "th", "id"];
|
|
539
576
|
var REGIONS = ["", "US", "GB", "CN", "HK", "TW", "JP", "KR", "SG", "IN", "AU", "CA", "DE", "FR", "ES", "IT", "NL", "BR", "MX", "RU", "TR", "SA"];
|
|
540
577
|
|
|
541
|
-
// ../
|
|
578
|
+
// ../core/dist/browser-limits.js
|
|
579
|
+
var DEFAULT_MAX_CONCURRENT_READS = 2;
|
|
580
|
+
var MIN_MAX_CONCURRENT_READS = 1;
|
|
581
|
+
var MAX_CONCURRENT_READS = 8;
|
|
582
|
+
|
|
583
|
+
// ../core/dist/config.js
|
|
542
584
|
function defaultConfig() {
|
|
543
585
|
return {
|
|
544
586
|
mode: "parallel",
|
|
@@ -554,12 +596,13 @@ var NiteSearchClient = (() => {
|
|
|
554
596
|
excludeDomains: [],
|
|
555
597
|
dedup: "url",
|
|
556
598
|
fusion: "rrf",
|
|
599
|
+
browser: { endpoint: "", statePath: "", timeoutMs: 6e4, maxConcurrentReads: DEFAULT_MAX_CONCURRENT_READS },
|
|
557
600
|
retry: { enabled: true, statuses: [408, 429, 500, 502, 503, 504], maxRetries: 2, initialDelayMs: 500, maxDelayMs: 5e3, networkErrors: false, timeouts: false },
|
|
558
601
|
cache: { enabled: true, ttlSeconds: 900, maxEntries: 100 },
|
|
559
602
|
breaker: { enabled: false, threshold: 3, cooldownMs: 6e4 },
|
|
560
603
|
diagnostics: { enabled: true, maxEntries: 50 },
|
|
561
604
|
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,
|
|
605
|
+
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
606
|
};
|
|
564
607
|
}
|
|
565
608
|
function validateConfig(value) {
|
|
@@ -630,27 +673,34 @@ var NiteSearchClient = (() => {
|
|
|
630
673
|
num(c.breaker.threshold, 1, 100, "breaker.threshold");
|
|
631
674
|
num(c.breaker.cooldownMs, 1e3, 36e5, "breaker.cooldownMs");
|
|
632
675
|
num(c.diagnostics.maxEntries, 1, 500, "diagnostics.maxEntries");
|
|
676
|
+
const checkEndpoint = (endpoint, path) => {
|
|
677
|
+
try {
|
|
678
|
+
const url = new URL(endpoint);
|
|
679
|
+
if (url.username || url.password || url.hash || url.search)
|
|
680
|
+
throw 0;
|
|
681
|
+
const schemes = url.protocol === "ws:" || url.protocol === "wss:" ? ["ws:", "wss:"] : ["http:", "https:"];
|
|
682
|
+
if (!schemes.includes(url.protocol))
|
|
683
|
+
throw 0;
|
|
684
|
+
} catch {
|
|
685
|
+
fail(path, "Use an HTTP(S) or WS(S) endpoint without credentials, query, or fragment.");
|
|
686
|
+
}
|
|
687
|
+
};
|
|
688
|
+
const sharedBrowser = c.browser.endpoint;
|
|
689
|
+
if (sharedBrowser)
|
|
690
|
+
checkEndpoint(sharedBrowser, "browser.endpoint");
|
|
691
|
+
if (!(c.browser.timeoutMs >= 1e3 && c.browser.timeoutMs <= 12e4))
|
|
692
|
+
fail("browser.timeoutMs", "Expected 1000 to 120000 milliseconds.");
|
|
693
|
+
num(c.browser.maxConcurrentReads, MIN_MAX_CONCURRENT_READS, MAX_CONCURRENT_READS, "browser.maxConcurrentReads");
|
|
633
694
|
for (const d of catalog) {
|
|
634
695
|
const b = c.backends[d.id];
|
|
635
696
|
const p = `backends.${d.id}`;
|
|
636
697
|
choice(b.mode, d.modes.map((m) => m.mode), `${p}.mode`);
|
|
637
698
|
if (b.enabled && d.status === "unverified")
|
|
638
699
|
fail(`${p}.enabled`, "Backend protocol is not verified.");
|
|
639
|
-
if (b.endpoint)
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.hash || url.search)
|
|
643
|
-
throw 0;
|
|
644
|
-
const local = url.hostname === "localhost" || url.hostname === "127.0.0.1" || url.hostname === "[::1]";
|
|
645
|
-
if (url.protocol === "http:" && !local)
|
|
646
|
-
throw 0;
|
|
647
|
-
} catch {
|
|
648
|
-
fail(`${p}.endpoint`, "Use an HTTPS endpoint without credentials, query, or fragment; HTTP is allowed only on loopback.");
|
|
649
|
-
}
|
|
650
|
-
} else if (b.enabled)
|
|
700
|
+
if (b.endpoint)
|
|
701
|
+
checkEndpoint(b.endpoint, `${p}.endpoint`);
|
|
702
|
+
else if (b.enabled && !(b.mode === "browser" && sharedBrowser))
|
|
651
703
|
fail(`${p}.endpoint`, "An endpoint is required.");
|
|
652
|
-
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(b.credentialRef))
|
|
653
|
-
fail(`${p}.credentialRef`, "Expected an environment-style credential reference.");
|
|
654
704
|
num(b.timeoutMs, 1e3, 12e4, `${p}.timeoutMs`);
|
|
655
705
|
num(b.rateLimitPerMinute, 0, 1e5, `${p}.rateLimitPerMinute`);
|
|
656
706
|
num(b.dailyAttemptLimit, 0, 1e6, `${p}.dailyAttemptLimit`);
|
|
@@ -688,7 +738,7 @@ var NiteSearchClient = (() => {
|
|
|
688
738
|
var API = "/api/nite-search";
|
|
689
739
|
var clone = (value) => JSON.parse(JSON.stringify(value));
|
|
690
740
|
var same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
691
|
-
var ranges = { maxResults: [1, 50], concurrency: [1, 20], overallTimeoutMs: [1e3, 18e4], "retry.maxRetries": [0, 5], "retry.initialDelayMs": [0, 6e4], "retry.maxDelayMs": [0, 12e4], "cache.ttlSeconds": [1, 86400], "cache.maxEntries": [1, 1e3], "breaker.threshold": [1, 100], "breaker.cooldownMs": [1e3, 36e5], "diagnostics.maxEntries": [1, 500], "backend.timeoutMs": [1e3, 12e4], "backend.rateLimitPerMinute": [0, 1e5], "backend.dailyAttemptLimit": [0, 1e6] };
|
|
741
|
+
var ranges = { maxResults: [1, 50], concurrency: [1, 20], overallTimeoutMs: [1e3, 18e4], "retry.maxRetries": [0, 5], "retry.initialDelayMs": [0, 6e4], "retry.maxDelayMs": [0, 12e4], "cache.ttlSeconds": [1, 86400], "cache.maxEntries": [1, 1e3], "breaker.threshold": [1, 100], "breaker.cooldownMs": [1e3, 36e5], "diagnostics.maxEntries": [1, 500], "backend.timeoutMs": [1e3, 12e4], "backend.rateLimitPerMinute": [0, 1e5], "backend.dailyAttemptLimit": [0, 1e6], "browser.maxConcurrentReads": [MIN_MAX_CONCURRENT_READS, MAX_CONCURRENT_READS] };
|
|
692
742
|
var RETRY_STATUSES = [408, 429, 500, 502, 503, 504];
|
|
693
743
|
var fieldId = (path) => `nite-search-${path.replace(/[^a-z0-9-]/gi, "-")}`;
|
|
694
744
|
function get(value, path) {
|
|
@@ -818,7 +868,7 @@ var NiteSearchClient = (() => {
|
|
|
818
868
|
return;
|
|
819
869
|
}
|
|
820
870
|
const reliability = path.startsWith("retry.") || path.startsWith("breaker.") || path.startsWith("cache.") || path === "diagnostics.enabled" || path === "diagnostics.maxEntries";
|
|
821
|
-
setTab(path.startsWith("backends.") ? "backends" : reliability ? "reliability" : "behavior");
|
|
871
|
+
setTab(path.startsWith("backends.") || path.startsWith("browser.") ? "backends" : reliability ? "reliability" : "behavior");
|
|
822
872
|
setPendingFocus(path);
|
|
823
873
|
}
|
|
824
874
|
React.useEffect(() => {
|
|
@@ -917,12 +967,11 @@ var NiteSearchClient = (() => {
|
|
|
917
967
|
}
|
|
918
968
|
async function credential(id, remove) {
|
|
919
969
|
if (!snapshot) return;
|
|
920
|
-
const reference = draft.backends[id]?.credentialRef;
|
|
921
970
|
setPending(`credential-${id}`);
|
|
922
971
|
setFailed(false);
|
|
923
972
|
setNotice("working");
|
|
924
973
|
try {
|
|
925
|
-
await request("credential", { backendId: id,
|
|
974
|
+
await request("credential", { backendId: id, ...remove ? { remove: true } : { value: secrets[id] } });
|
|
926
975
|
setSecrets((previous) => ({ ...previous, [id]: "" }));
|
|
927
976
|
await refresh();
|
|
928
977
|
setNotice("credentialSaved");
|
|
@@ -934,6 +983,24 @@ var NiteSearchClient = (() => {
|
|
|
934
983
|
setPending("");
|
|
935
984
|
}
|
|
936
985
|
}
|
|
986
|
+
async function browserCredential(remove) {
|
|
987
|
+
if (!snapshot) return;
|
|
988
|
+
setPending("credential-browser");
|
|
989
|
+
setFailed(false);
|
|
990
|
+
setNotice("working");
|
|
991
|
+
try {
|
|
992
|
+
await request("credential", { scope: "browser", ...remove ? { remove: true } : { value: secrets.browser } });
|
|
993
|
+
setSecrets((previous) => ({ ...previous, browser: "" }));
|
|
994
|
+
await refresh();
|
|
995
|
+
setNotice("credentialSaved");
|
|
996
|
+
} catch {
|
|
997
|
+
setSecrets((previous) => ({ ...previous, browser: "" }));
|
|
998
|
+
setFailed(true);
|
|
999
|
+
setNotice("credentialFailed");
|
|
1000
|
+
} finally {
|
|
1001
|
+
setPending("");
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
937
1004
|
function importConfig() {
|
|
938
1005
|
try {
|
|
939
1006
|
const parsed = JSON.parse(importText);
|
|
@@ -990,10 +1057,7 @@ var NiteSearchClient = (() => {
|
|
|
990
1057
|
const TABS = ["behavior", "reliability", "diagnostics", "backends"];
|
|
991
1058
|
const credentialDisabledReason = (id) => {
|
|
992
1059
|
if (pending) return t("credentialPending");
|
|
993
|
-
|
|
994
|
-
if (!reference) return t("credentialRefRequired");
|
|
995
|
-
const savedReference = snapshot?.config.backends[id]?.credentialRef;
|
|
996
|
-
if (reference === savedReference && snapshot?.credentials[id] && !snapshot.credentials[id].writable) return t("credentialReadOnly");
|
|
1060
|
+
if (snapshot?.credentials[id] && !snapshot.credentials[id].writable) return t("credentialReadOnly");
|
|
997
1061
|
return "";
|
|
998
1062
|
};
|
|
999
1063
|
const credentialDisabled = (id) => credentialDisabledReason(id) !== "";
|
|
@@ -1031,7 +1095,9 @@ var NiteSearchClient = (() => {
|
|
|
1031
1095
|
setDraft(clone(snapshot.defaults));
|
|
1032
1096
|
setIssues([]);
|
|
1033
1097
|
setNotice("defaultsRestored");
|
|
1034
|
-
}), 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-
|
|
1098
|
+
}), 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.maxConcurrentReads"], { "browser.timeoutMs": { type: "number" }, "browser.maxConcurrentReads": { 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", () => {
|
|
1099
|
+
void browserCredential(true);
|
|
1100
|
+
}))), /* @__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) => {
|
|
1035
1101
|
const backend2 = draft.backends[def.id];
|
|
1036
1102
|
if (!backend2) return null;
|
|
1037
1103
|
const mode2 = def.modes.find((item) => item.mode === backend2.mode);
|
|
@@ -1039,7 +1105,8 @@ var NiteSearchClient = (() => {
|
|
|
1039
1105
|
const credentialState = snapshot.credentials[def.id];
|
|
1040
1106
|
const locked = def.status !== "documented";
|
|
1041
1107
|
const anonymous = backend2.mode === "anonymous";
|
|
1042
|
-
|
|
1108
|
+
const readsThroughBrowser = backend2.mode === "browser";
|
|
1109
|
+
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", () => {
|
|
1043
1110
|
void credential(def.id, true);
|
|
1044
1111
|
})), /* @__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")))));
|
|
1045
1112
|
}), !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", () => {
|