dsh-klbq 0.2.0 → 0.2.1
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 +1 -1
- package/lib/qqbot.js +12 -5
- package/package.json +1 -1
package/README.md
CHANGED
package/lib/qqbot.js
CHANGED
|
@@ -40,7 +40,7 @@ function existsAsPackage(dir) {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
function probeFileSystem() {
|
|
43
|
-
// 1) 从插件自身目录逐级向上找 node_modules
|
|
43
|
+
// 1) 从插件自身目录逐级向上找 node_modules(npm 安装时的常规情况)
|
|
44
44
|
let dir = HERE;
|
|
45
45
|
for (let i = 0; i < 6; i += 1) {
|
|
46
46
|
if (existsAsPackage(path.join(dir, 'node_modules'))) return true;
|
|
@@ -49,12 +49,19 @@ function probeFileSystem() {
|
|
|
49
49
|
dir = parent;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
// 2) 扫 DSH profile
|
|
52
|
+
// 2) 扫 DSH profile:要求「同一个 profile 里既有本插件、又有 qqbot」。
|
|
53
|
+
//
|
|
54
|
+
// 只判断有没有 qqbot 会误判——用户可能在别的 profile 装了它,而当前
|
|
55
|
+
// profile 根本没跑 QQ 通道,那样会白白往 system prompt 里塞 150 token。
|
|
56
|
+
// 本插件以 link: 装时会出现在 profile 的 node_modules 里(软链),
|
|
57
|
+
// 所以「同目录两者都在」是可靠的判据。
|
|
53
58
|
try {
|
|
54
|
-
const
|
|
55
|
-
const profilesDir = path.join(dshHome, 'profiles');
|
|
59
|
+
const profilesDir = path.join(os.homedir(), '.dsh', 'profiles');
|
|
56
60
|
for (const profile of fs.readdirSync(profilesDir).slice(0, 20)) {
|
|
57
|
-
|
|
61
|
+
const modules = path.join(profilesDir, profile, 'node_modules');
|
|
62
|
+
if (!existsAsPackage(modules)) continue;
|
|
63
|
+
const hasSelf = fs.existsSync(path.join(modules, 'dsh-klbq'));
|
|
64
|
+
if (hasSelf) return true;
|
|
58
65
|
}
|
|
59
66
|
} catch { /* 没有 .dsh 目录就用别的手段 */ }
|
|
60
67
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-klbq",
|
|
3
|
-
"version":
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "閸椻剝濯鸿ぐ闂寸瑴閿涘湯trinova閿涘鍨紒鈺傜叀鐠囶澁绱伴幐澶嬫█缁夐绮?dakanu.com 閸欐牗鏆熼獮鑸佃閺屾捇鏆遍崶鎾呯礄閹烘帊缍呭▓鍏哥秴/閹槒顫?濡€崇础/鐟欐帟澹?閺堚偓鏉╂垵顕仦鈧敍澶涚礉娴f粈璐?DSH 瀹搞儱鍙?klbq_query 閺嗘挳婀剁紒?agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|