dsh-union-search 0.10.23 → 0.10.24
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 +14 -1
- package/lib/index.js +68 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -837,4 +837,17 @@ MIT
|
|
|
837
837
|
| georgeatparallel | 1 | Parallel MCP 响应体读取上限与 SSE 结果解析(PR #78) |
|
|
838
838
|
| lingdianshiren | 1 | SearXNG bearer token 鉴权 |
|
|
839
839
|
|
|
840
|
-
感谢以上全部作者。上游完整提交历史仍可在 [DDDMUC/dsh-free-search](https://github.com/DDDMUC/dsh-free-search) 查阅。
|
|
840
|
+
感谢以上全部作者。上游完整提交历史仍可在 [DDDMUC/dsh-free-search](https://github.com/DDDMUC/dsh-free-search) 查阅。
|
|
841
|
+
|
|
842
|
+
## TUI 终端面(dsh-tui)
|
|
843
|
+
|
|
844
|
+
dsh-tui 不加载插件的 client 半边(面板/卡片/设置页),也调不到插件自有 RPC;工具调用只显示一行摘要。人可读、人可操作的面只剩宿主斜杠命令。输出约定:单行 ≤100 字符、总行 ≤40、无 ANSI、两空格对齐;写操作默认 dry、加 `--yes` 才执行;`--json` 输出单行 JSON。
|
|
845
|
+
|
|
846
|
+
| 命令 | 作用 |
|
|
847
|
+
|---|---|
|
|
848
|
+
| `/ws engines` | 28 个引擎的 on/off 汇总(读 live config) |
|
|
849
|
+
| `/ws priority` | 回退优先级候选列表 |
|
|
850
|
+
| `/ws off <engine>` | 禁用某引擎(默认 dry,`--yes` 写设置节) |
|
|
851
|
+
| `/ws on <engine>` | 重新启用(默认 dry,`--yes`) |
|
|
852
|
+
|
|
853
|
+
命令由插件自己在宿主侧注册(`ctx.inject(['commands'], …)`):命令服务缺席的老宿主线上不激活、不报错。
|
package/lib/index.js
CHANGED
|
@@ -4266,6 +4266,74 @@ function apply(ctx, config) {
|
|
|
4266
4266
|
// compat-legacy:老宿主线(≤0.1.5)由 installSection 的 setSource 换绑配置源,
|
|
4267
4267
|
// rc.1+ 则恒为 loader 传入的 volatile config——所以 current 必须可变。
|
|
4268
4268
|
let current = () => resolveConfig(config);
|
|
4269
|
+
|
|
4270
|
+
// ── dsh-tui 终端面:`/ws` ───────────────────────────────────────
|
|
4271
|
+
// TUI 不加载设置卡/引擎面板 → 引擎开关与回退优先级在终端里不可见。
|
|
4272
|
+
// 命令层只读(改开关仍在设置页),节名/字段都从 live config 读。
|
|
4273
|
+
try {
|
|
4274
|
+
ctx.inject?.(['commands'], (scope) => {
|
|
4275
|
+
const registry = scope?.commands
|
|
4276
|
+
if (!registry || typeof registry.register !== 'function') return
|
|
4277
|
+
registry.register({
|
|
4278
|
+
name: 'ws',
|
|
4279
|
+
description: 'union web search console: engines on/off summary, fallback priority (read-only)',
|
|
4280
|
+
input: { hint: '[engines|priority] [--json]' },
|
|
4281
|
+
handler: (invocation) => {
|
|
4282
|
+
const tokens = String(invocation?.rawInput ?? '').trim().split(/\s+/).filter(Boolean)
|
|
4283
|
+
const sub = String(tokens[0] ?? 'engines').toLowerCase()
|
|
4284
|
+
const wantsJson = tokens.includes('--json')
|
|
4285
|
+
const yes = tokens.includes('--yes')
|
|
4286
|
+
const cfgNow = current() ?? {}
|
|
4287
|
+
const disabled = new Set(Array.isArray(cfgNow.disabledEngines) ? cfgNow.disabledEngines : [])
|
|
4288
|
+
if (sub === 'on' || sub === 'off') {
|
|
4289
|
+
const engine = String(tokens[1] ?? '').toLowerCase()
|
|
4290
|
+
if (!ALL_ENGINES.includes(engine)) {
|
|
4291
|
+
return { kind: 'error', text: `ws ${sub}: 未知引擎 "${engine}"\n next: /ws engines` }
|
|
4292
|
+
}
|
|
4293
|
+
const next = new Set(disabled)
|
|
4294
|
+
if (sub === 'on') next.delete(engine)
|
|
4295
|
+
else next.add(engine)
|
|
4296
|
+
const list = [...next].sort()
|
|
4297
|
+
if (!yes) {
|
|
4298
|
+
return { kind: 'success', text: `ws ${sub} ${engine} — dry run\n disabledEngines 将变为 [${list.join(',')}]\n 确认后加 --yes 执行(写入本插件的设置节)` }
|
|
4299
|
+
}
|
|
4300
|
+
const svc = ctx.get('settings')
|
|
4301
|
+
if (!svc || typeof svc.update !== 'function') {
|
|
4302
|
+
return { kind: 'error', text: 'ws: 宿主不提供 settings.update(老线请用设置页)' }
|
|
4303
|
+
}
|
|
4304
|
+
let descriptors = []
|
|
4305
|
+
try { descriptors = svc.describe?.() ?? [] } catch { descriptors = [] }
|
|
4306
|
+
const list2 = Array.isArray(descriptors) ? descriptors : (descriptors?.namespaces ?? [])
|
|
4307
|
+
const hit = list2.find((entry) => entry && entry.ns === UNION_SEARCH_NS)
|
|
4308
|
+
if (!hit) {
|
|
4309
|
+
return { kind: 'error', text: `ws: 设置节 ${UNION_SEARCH_NS} 不在 profile 文档里\n next 先在 Desktop 里打开一次本插件设置` }
|
|
4310
|
+
}
|
|
4311
|
+
return svc.update(UNION_SEARCH_NS, { disabledEngines: list }, hit.revision)
|
|
4312
|
+
.then(() => ({ kind: 'success', text: `ws ${sub} ${engine} — 已写入,disabledEngines=[${list.join(',')}]` }))
|
|
4313
|
+
.catch((error) => ({ kind: 'error', text: `ws ${sub}: 写入失败:${String(error?.message ?? error)}` }))
|
|
4314
|
+
}
|
|
4315
|
+
if (sub === 'priority') {
|
|
4316
|
+
const list = Array.isArray(cfgNow.fallbackPriority) ? cfgNow.fallbackPriority : []
|
|
4317
|
+
if (wantsJson) return { kind: 'success', text: JSON.stringify({ ok: true, cmd: 'ws', data: { priority: list } }) }
|
|
4318
|
+
const lines = [`ws priority — ${list.length} 个候选`]
|
|
4319
|
+
for (const [index, engine] of list.slice(0, 20).entries()) lines.push(` ${index + 1}. ${engine}`)
|
|
4320
|
+
if (list.length === 0) lines.push(' 未设置回退优先级(走引擎默认顺序)')
|
|
4321
|
+
return { kind: 'success', text: lines.join('\n') }
|
|
4322
|
+
}
|
|
4323
|
+
if (sub !== 'engines') {
|
|
4324
|
+
return { kind: 'error', text: `ws: unknown subcommand "${sub}"\n next: /ws engines` }
|
|
4325
|
+
}
|
|
4326
|
+
const enabled = ALL_ENGINES.length - disabled.size
|
|
4327
|
+
if (wantsJson) {
|
|
4328
|
+
return { kind: 'success', text: JSON.stringify({ ok: true, cmd: 'ws', data: { enabled, total: ALL_ENGINES.length, disabled: [...disabled] } }) }
|
|
4329
|
+
}
|
|
4330
|
+
const lines = [`ws engines — ${enabled}/${ALL_ENGINES.length} 开`]
|
|
4331
|
+
for (const engine of ALL_ENGINES) lines.push(` ${disabled.has(engine) ? 'off' : 'on '} ${engine}`)
|
|
4332
|
+
return { kind: 'success', text: lines.slice(0, 40).join('\n') }
|
|
4333
|
+
},
|
|
4334
|
+
})
|
|
4335
|
+
})
|
|
4336
|
+
} catch { /* 老宿主无 commands 服务:静默降级 */ }
|
|
4269
4337
|
const logger = ctx.logger;
|
|
4270
4338
|
// credentials 服务可能晚于本插件挂载(跨 bundle 顺序),运行期动态获取而不是 apply 时缓存
|
|
4271
4339
|
const getCredentials = () => ctx.get("credentials");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-union-search",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.24",
|
|
4
4
|
"description": "Union web search for DeepSeek Harness (renamed from dsh-free-search): free keyless engines + many professional paid search APIs — 28 engines (Bing/DuckDuckGo/AnySearch/SearXNG multi-instance union/Exa/Tavily/Keenable/Firecrawl/Parallel keyless; Zhihu global/site via MCP and Perplexity/SerpBase/Serply/DeepSeek official/You.com/Baidu/Kimi/Aliyun/Doubao/Zhipu/Bocha/Metaso with key; OpenAI/Gemini/Claude/Grok model built-in search, explicit-only) + auto smart routing + global engine enable/disable & fallback priority + multi mode (parallel top-3 merge) + multi_search cross-source tool + failure-aware fallback + block system built-in search toggle + experimental free advance_fetch (no API key, no billing; host-twin GitHub-Flavored Markdown conversion + CSS selector/fields structured extraction) + time filtering + platform search + web_fetch, with web settings UI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|