@sciagent/cli 1.0.82 → 1.0.83
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/bin/sciagent.js +27 -2
- package/package.json +7 -7
- package/scripts/postinstall.js +1 -1
package/bin/sciagent.js
CHANGED
|
@@ -13,7 +13,7 @@ const https = require('https');
|
|
|
13
13
|
const http = require('http');
|
|
14
14
|
|
|
15
15
|
// 当前版本号 - 与 postinstall.js 和 package.json 保持同步
|
|
16
|
-
const CURRENT_VERSION = '1.0.
|
|
16
|
+
const CURRENT_VERSION = '1.0.83';
|
|
17
17
|
|
|
18
18
|
// 极狐GitLab下载配置
|
|
19
19
|
const JIHULAB_URL = 'https://jihulab.com';
|
|
@@ -116,9 +116,34 @@ function getBinaryPath() {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
// 方法1: 从optionalDependencies安装的包中查找
|
|
119
|
+
// 注意:npm缓存中的旧包可能包含旧版二进制,需要版本校验
|
|
119
120
|
try {
|
|
120
121
|
const packagePath = require.resolve(`${packageName}/bin/${binName}`);
|
|
121
|
-
|
|
122
|
+
if (fs.existsSync(packagePath)) {
|
|
123
|
+
const stats = fs.statSync(packagePath);
|
|
124
|
+
if (stats.size > 10 * 1024 * 1024) {
|
|
125
|
+
// 检查npm包的package.json版本号
|
|
126
|
+
try {
|
|
127
|
+
const pkgJsonPath = require.resolve(`${packageName}/package.json`);
|
|
128
|
+
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
|
|
129
|
+
const pkgVersion = pkgJson.version;
|
|
130
|
+
const cmp = compareVersions(pkgVersion, CURRENT_VERSION);
|
|
131
|
+
if (cmp < 0) {
|
|
132
|
+
// npm包版本低于当前版本 → 跳过,下载新版
|
|
133
|
+
console.log(`[INFO] npm package binary outdated: ${packageName}@${pkgVersion} < ${CURRENT_VERSION}, will download new version`);
|
|
134
|
+
} else {
|
|
135
|
+
// 版本匹配或更高,直接使用
|
|
136
|
+
console.log(`[INFO] Using npm package binary: ${packageName}@${pkgVersion}`);
|
|
137
|
+
return packagePath;
|
|
138
|
+
}
|
|
139
|
+
} catch (e) {
|
|
140
|
+
// 无法读取package.json,保守跳过
|
|
141
|
+
console.log(`[INFO] Cannot read package version from ${packageName}, skipping npm binary`);
|
|
142
|
+
}
|
|
143
|
+
} else {
|
|
144
|
+
console.log(`[INFO] npm package binary too small (${(stats.size / 1024).toFixed(0)} KB), likely a stub`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
122
147
|
} catch (e) {
|
|
123
148
|
// 包未安装,继续尝试其他方法
|
|
124
149
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sciagent/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.83",
|
|
4
4
|
"description": "SciAgent CLI - AI Research Assistant",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
"postinstall": "node scripts/postinstall.js"
|
|
16
16
|
},
|
|
17
17
|
"optionalDependencies": {
|
|
18
|
-
"@sciagent/cli-linux-x64": "1.0.
|
|
19
|
-
"@sciagent/cli-linux-arm64": "1.0.
|
|
20
|
-
"@sciagent/cli-darwin-x64": "1.0.
|
|
21
|
-
"@sciagent/cli-darwin-arm64": "1.0.
|
|
22
|
-
"@sciagent/cli-win32-x64": "1.0.
|
|
23
|
-
"@sciagent/cli-win32-arm64": "1.0.
|
|
18
|
+
"@sciagent/cli-linux-x64": "1.0.83",
|
|
19
|
+
"@sciagent/cli-linux-arm64": "1.0.83",
|
|
20
|
+
"@sciagent/cli-darwin-x64": "1.0.83",
|
|
21
|
+
"@sciagent/cli-darwin-arm64": "1.0.83",
|
|
22
|
+
"@sciagent/cli-win32-x64": "1.0.83",
|
|
23
|
+
"@sciagent/cli-win32-arm64": "1.0.83"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|
|
26
26
|
"ai",
|
package/scripts/postinstall.js
CHANGED
|
@@ -27,7 +27,7 @@ const ARCH_MAP = {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
// 当前版本号 - 每次发布时同步更新
|
|
30
|
-
const CURRENT_VERSION = '1.0.
|
|
30
|
+
const CURRENT_VERSION = '1.0.83';
|
|
31
31
|
|
|
32
32
|
// GitHub Releases 回退版本列表(当当前版本的 release 不存在时尝试)
|
|
33
33
|
const GITHUB_FALLBACK_VERSIONS = ['1.0.50', '1.0.48', '1.0.46', '1.0.40', '1.0.38', '1.0.36'];
|