@sciagent/cli 1.0.82 → 1.0.84
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 +32 -5
- 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.84';
|
|
17
17
|
|
|
18
18
|
// 极狐GitLab下载配置
|
|
19
19
|
const JIHULAB_URL = 'https://jihulab.com';
|
|
@@ -116,9 +116,36 @@ function getBinaryPath() {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
// 方法1: 从optionalDependencies安装的包中查找
|
|
119
|
+
// ⚠️ 重要:npm包中的二进制可能是旧版本(npm缓存/250MB限制导致无法发布新版)
|
|
120
|
+
// 必须严格校验版本,版本不匹配则跳过并触发下载
|
|
119
121
|
try {
|
|
120
122
|
const packagePath = require.resolve(`${packageName}/bin/${binName}`);
|
|
121
|
-
|
|
123
|
+
if (fs.existsSync(packagePath)) {
|
|
124
|
+
const stats = fs.statSync(packagePath);
|
|
125
|
+
if (stats.size > 10 * 1024 * 1024) {
|
|
126
|
+
// 严格版本校验:读取npm包的package.json
|
|
127
|
+
try {
|
|
128
|
+
const pkgJsonPath = require.resolve(`${packageName}/package.json`);
|
|
129
|
+
const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
|
|
130
|
+
const pkgVersion = pkgJson.version;
|
|
131
|
+
const cmp = compareVersions(pkgVersion, CURRENT_VERSION);
|
|
132
|
+
if (cmp !== 0) {
|
|
133
|
+
// 版本不匹配(无论高低)→ 跳过,下载正确版本
|
|
134
|
+
console.log(`[INFO] npm package binary version mismatch: ${packageName}@${pkgVersion} != ${CURRENT_VERSION}, will download correct version`);
|
|
135
|
+
// 不return,继续到下载逻辑
|
|
136
|
+
} else {
|
|
137
|
+
// 版本精确匹配,使用
|
|
138
|
+
console.log(`[INFO] Using npm package binary: ${packageName}@${pkgVersion}`);
|
|
139
|
+
return packagePath;
|
|
140
|
+
}
|
|
141
|
+
} catch (e) {
|
|
142
|
+
// 无法读取package.json,跳过
|
|
143
|
+
console.log(`[INFO] Cannot read package version from ${packageName}, skipping npm binary`);
|
|
144
|
+
}
|
|
145
|
+
} else {
|
|
146
|
+
console.log(`[INFO] npm package binary too small (${(stats.size / 1024).toFixed(0)} KB), likely a stub`);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
122
149
|
} catch (e) {
|
|
123
150
|
// 包未安装,继续尝试其他方法
|
|
124
151
|
}
|
|
@@ -135,9 +162,9 @@ function getBinaryPath() {
|
|
|
135
162
|
return binPath;
|
|
136
163
|
}
|
|
137
164
|
|
|
138
|
-
//
|
|
139
|
-
console.log(`⚠️ SciAgent binary not found for ${platform}-${arch}`);
|
|
140
|
-
console.log(` Attempting to download from JiHuLab...`);
|
|
165
|
+
// 未找到匹配版本的二进制文件 - 自动从极狐GitLab下载
|
|
166
|
+
console.log(`⚠️ SciAgent binary not found or version mismatch for ${platform}-${arch}`);
|
|
167
|
+
console.log(` Attempting to download v${CURRENT_VERSION} from JiHuLab...`);
|
|
141
168
|
|
|
142
169
|
const downloaded = downloadBinary(platform, arch, CURRENT_VERSION);
|
|
143
170
|
if (downloaded && fs.existsSync(downloaded)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sciagent/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.84",
|
|
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.84",
|
|
19
|
+
"@sciagent/cli-linux-arm64": "1.0.84",
|
|
20
|
+
"@sciagent/cli-darwin-x64": "1.0.84",
|
|
21
|
+
"@sciagent/cli-darwin-arm64": "1.0.84",
|
|
22
|
+
"@sciagent/cli-win32-x64": "1.0.84",
|
|
23
|
+
"@sciagent/cli-win32-arm64": "1.0.84"
|
|
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.84';
|
|
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'];
|