@240xu/dsh-websearch 2.13.3 → 2.13.4

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
@@ -269,7 +269,7 @@ tests/
269
269
  node --test tests/
270
270
  ```
271
271
 
272
- 当前 235/235 pass(`node --test tests/*.test.js`;`tests/up-health.test.mjs` 单独跑)。
272
+ 当前 236/236 pass(`node --test tests/*.test.js`;`tests/up-health.test.mjs` 单独跑)。
273
273
 
274
274
  ### Test-only dependencies
275
275
 
@@ -68,12 +68,25 @@ export const parallelBackend = {
68
68
  throw new WebError(`parallel returned an MCP error: ${message}`, "WEB_PROVIDER_ERROR");
69
69
  }
70
70
 
71
- const sources = parseParallelResult(result, request.maxResults ?? 8);
71
+ const sources = parseParallelResult(result, parallelParseLimit(request));
72
72
  hooks.recordOutcome?.({ status: "ok", count: sources.length });
73
73
  return { sources, content: undefined, truncated: false };
74
74
  },
75
75
  };
76
76
 
77
+ /**
78
+ * A planned call merges several facets into one response. Cap the local parse
79
+ * by the facet count so facet 2/3 tails are not sliced before the provider's
80
+ * cross-backend merge; the normal (single-query) path keeps maxResults.
81
+ * @param {object} request
82
+ * @returns {number}
83
+ */
84
+ export function parallelParseLimit(request) {
85
+ const maxResults = Math.max(1, Number(request?.maxResults) || 8);
86
+ const facets = Array.isArray(request?.searchPlan?.queries) ? request.searchPlan.queries.length : 1;
87
+ return Math.min(300, maxResults * Math.max(1, facets));
88
+ }
89
+
77
90
  export function parseParallelResult(result, maxResults) {
78
91
  const text = result?.content?.[0]?.text;
79
92
  if (typeof text !== "string" || text.length === 0) return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@240xu/dsh-websearch",
3
- "version": "2.13.3",
3
+ "version": "2.13.4",
4
4
  "description": "Unified web search provider for DeepSeek Harness (ctx.web): 13 backends — Exa + Parallel + DDG + SearXNG (keyless), DeepSeek + Anthropic + OpenAI + Brave + Tavily + Serper + Mojeek (key-gated via Settings credentials), Firecrawl + TinyFish (metered keyless, opt-in). Registers provider id \"unified\" for zero-config web_search. 统一网页搜索聚合:13 后端并发扇出、去重合并。See CHANGELOG.md for version history.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",