dsh-union-search 0.11.3 → 0.11.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/lib/index.js +33 -2
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -269,6 +269,19 @@ async function fetchLatestVersion(signal) {
|
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
+
// 升级后的实装版本核实(上游 #163 教训):pnpm exit 0 ≠ 装到了 latest——pnpm 11 默认
|
|
273
|
+
// minimumReleaseAge 会把未过冷却期的新版静默拦回旧版。读 profile 里的 package.json 为准
|
|
274
|
+
// (Windows 下可能带 BOM,先剥);读不到/损坏返回 null 交由调用方判为未知。
|
|
275
|
+
function verifyInstalledVersion(profileDir) {
|
|
276
|
+
try {
|
|
277
|
+
const raw = fs.readFileSync(path.join(profileDir, "node_modules", "dsh-union-search", "package.json"), "utf8");
|
|
278
|
+
const parsed = JSON.parse(raw.replace(/^\uFEFF/, ""));
|
|
279
|
+
return typeof parsed.version === "string" && parsed.version ? parsed.version : null;
|
|
280
|
+
} catch {
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
272
285
|
// 简单的 semver 比较(仅处理 x.y.z 主/次/补丁,忽略预发布标签);a>b 返回 1, a<b 返回 -1, 相等返回 0
|
|
273
286
|
function compareVersions(a, b) {
|
|
274
287
|
const na = String(a).split(".").map((n) => parseInt(n, 10) || 0);
|
|
@@ -3688,12 +3701,29 @@ function makeBridgeRoutes(settings, search, testEngine, runEngineTests, getCrede
|
|
|
3688
3701
|
});
|
|
3689
3702
|
});
|
|
3690
3703
|
const latest = await fetchLatestVersion();
|
|
3704
|
+
// 不信 pnpm 的 exit code,以实装版本为准(上游 #163):读不到→upgrade-unknown;
|
|
3705
|
+
// 与 latest 不一致→upgrade-stale(pnpm minimumReleaseAge 静默装回旧版等场景)。
|
|
3706
|
+
const installed = verifyInstalledVersion(mode.profileDir);
|
|
3707
|
+
if (installed === null) {
|
|
3708
|
+
return {
|
|
3709
|
+
ok: false,
|
|
3710
|
+
code: "upgrade-unknown",
|
|
3711
|
+
message: "pnpm reported success but the installed version is unreadable - verify the profile's node_modules manually",
|
|
3712
|
+
};
|
|
3713
|
+
}
|
|
3714
|
+
if (latest !== null && installed !== latest) {
|
|
3715
|
+
return {
|
|
3716
|
+
ok: false,
|
|
3717
|
+
code: "upgrade-stale",
|
|
3718
|
+
message: `requested v${latest} but installed v${installed} - pnpm may hold the update back (minimumReleaseAge cooldown / registry read lag); retry later or install the exact version`,
|
|
3719
|
+
};
|
|
3720
|
+
}
|
|
3691
3721
|
return {
|
|
3692
3722
|
ok: true,
|
|
3693
3723
|
value: {
|
|
3694
3724
|
updated: true,
|
|
3695
|
-
latest:
|
|
3696
|
-
message: `upgraded to
|
|
3725
|
+
latest: installed,
|
|
3726
|
+
message: `upgraded to v${installed} - restart dsh to apply`,
|
|
3697
3727
|
output: String(result).trim().slice(0, 200),
|
|
3698
3728
|
},
|
|
3699
3729
|
};
|
|
@@ -6117,4 +6147,5 @@ export {
|
|
|
6117
6147
|
looksRelevant,
|
|
6118
6148
|
guardRelevance,
|
|
6119
6149
|
queryOverlapTokens,
|
|
6150
|
+
verifyInstalledVersion,
|
|
6120
6151
|
};
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-union-search",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.4",
|
|
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",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"test": "node --test test/md.test.mjs test/egress.test.mjs test/relevance.test.mjs test/credentials.test.mjs test/tool-face.test.mjs test/notes-channel.test.mjs"
|
|
8
|
+
"test": "node --test test/md.test.mjs test/egress.test.mjs test/relevance.test.mjs test/upgrade.test.mjs test/credentials.test.mjs test/tool-face.test.mjs test/notes-channel.test.mjs"
|
|
9
9
|
},
|
|
10
10
|
"exports": {
|
|
11
11
|
".": "./lib/index.js",
|