dsh-union-search 0.10.15 → 0.10.16

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.
Files changed (2) hide show
  1. package/lib/index.js +17 -11
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -241,7 +241,7 @@ function routeEngines(query, { timeRange, disabledEngines = [], fallbackOrder =
241
241
  }
242
242
 
243
243
  // 当前插件版本(发布时与 package.json 同步)
244
- const PLUGIN_VERSION = "0.10.10";
244
+ const PLUGIN_VERSION = "0.10.16";
245
245
  // 检查更新的 npm registry 元数据地址(dsh-union-search 是 npmjs 上的公开包,0.10.15 起统一裸名)
246
246
  const NPM_REGISTRY_URL = "https://registry.npmjs.org/dsh-union-search/latest";
247
247
  const PLUGIN_NPM_URL = "https://www.npmjs.com/package/dsh-union-search";
@@ -4847,16 +4847,20 @@ function apply(ctx, config) {
4847
4847
  const signature = JSON.stringify(ops);
4848
4848
  if (signature === lastPinnedSignature) return;
4849
4849
  lastPinnedSignature = signature;
4850
- let pinned = Promise.reject(new Error("settings service unavailable"));
4851
- try {
4852
- const settingsSvc = ctx.get("settings");
4853
- if (settingsSvc && typeof settingsSvc.mutate === "function") {
4854
- pinned = Promise.resolve(settingsSvc.mutate("web", ops));
4855
- }
4856
- } catch {
4857
- // 落到统一 catch
4850
+ // 守卫:settings 可能尚未挂载(apply 期),early-return 避免创建 rejected Promise 哨兵
4851
+ let settingsSvc;
4852
+ try { settingsSvc = ctx.get("settings"); } catch { settingsSvc = null; }
4853
+ if (!settingsSvc || typeof settingsSvc.mutate !== "function") {
4854
+ lastPinnedSignature = "";
4855
+ logger.warn(
4856
+ `union-search: settings service not ready, searchProvider takeover deferred; ` +
4857
+ `will retry on next config change. If web_search reports WEB_PROVIDER_AMBIGUOUS, ` +
4858
+ `add to the profile's cordis.patch.yml:\n` +
4859
+ `- id: web\n config:\n searchProvider: ${provider.id}\n fetchProvider: http`
4860
+ );
4861
+ return;
4858
4862
  }
4859
- pinned
4863
+ Promise.resolve(settingsSvc.mutate("web", ops))
4860
4864
  .then(() => {
4861
4865
  logger.info(`union-search: pinned web entry config ${ops.map((o) => `${o.path.join(".")}=${o.value}`).join(", ")}`);
4862
4866
  })
@@ -4877,7 +4881,9 @@ function apply(ctx, config) {
4877
4881
  : `union-search: taking over from the default provider "${previous}" as "${provider.id}"`
4878
4882
  );
4879
4883
  };
4880
- applySearchTakeover();
4884
+ try { applySearchTakeover(); } catch (e) {
4885
+ logger.warn(`union-search: initial takeover error (non-fatal): ${e?.message ?? e}`);
4886
+ }
4881
4887
 
4882
4888
  // 单引擎测试执行器:设置卡「测试引擎」按钮与全引擎测试(runEngineTests)共用
4883
4889
  const runEngineTest = async (engine, query, timeRange, maxResults = 2) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-union-search",
3
- "version": "0.10.15",
3
+ "version": "0.10.16",
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",