@sciagent/cli 1.0.36 → 1.0.39
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/package.json +3 -3
- package/scripts/postinstall.js +28 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sciagent/cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.39",
|
|
4
4
|
"description": "SciAgent CLI - AI Research Assistant",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
"postinstall": "node scripts/postinstall.js"
|
|
16
16
|
},
|
|
17
17
|
"optionalDependencies": {
|
|
18
|
-
"@sciagent/cli-linux-x64": "1.0.
|
|
18
|
+
"@sciagent/cli-linux-x64": "1.0.33",
|
|
19
19
|
"@sciagent/cli-linux-arm64": "1.0.33",
|
|
20
20
|
"@sciagent/cli-darwin-x64": "1.0.33",
|
|
21
21
|
"@sciagent/cli-darwin-arm64": "1.0.33",
|
|
22
|
-
"@sciagent/cli-win32-x64": "1.0.
|
|
22
|
+
"@sciagent/cli-win32-x64": "1.0.39",
|
|
23
23
|
"@sciagent/cli-win32-arm64": "1.0.33"
|
|
24
24
|
},
|
|
25
25
|
"keywords": [
|
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.39';
|
|
31
31
|
|
|
32
32
|
// PyPI 镜像源列表(国内优先)
|
|
33
33
|
const PYPI_MIRRORS = [
|
|
@@ -370,33 +370,38 @@ sys.exit(1)
|
|
|
370
370
|
}
|
|
371
371
|
|
|
372
372
|
function installBinaryPackage(platform, arch) {
|
|
373
|
-
|
|
373
|
+
// 版本回退列表:先尝试当前版本,再尝试已知存在的版本
|
|
374
|
+
const FALLBACK_VERSIONS = [CURRENT_VERSION, '1.0.38', '1.0.36', '1.0.33'];
|
|
374
375
|
|
|
375
|
-
|
|
376
|
-
|
|
376
|
+
let npmCmd = 'npm';
|
|
377
|
+
const isGlobal = process.env.npm_config_global === 'true' ||
|
|
378
|
+
process.env.npm_lifecycle_event === 'postinstall';
|
|
377
379
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
const isGlobal = process.env.npm_config_global === 'true' ||
|
|
383
|
-
process.env.npm_lifecycle_event === 'postinstall';
|
|
380
|
+
for (const version of FALLBACK_VERSIONS) {
|
|
381
|
+
const packageName = `@sciagent/cli-${platform}-${arch}@${version}`;
|
|
382
|
+
console.log(`\n Installing platform binary: ${packageName}`);
|
|
383
|
+
console.log(' This may take a moment...\n');
|
|
384
384
|
|
|
385
|
-
|
|
386
|
-
installArgs = ['install', packageName];
|
|
385
|
+
try {
|
|
386
|
+
let installArgs = ['install', '-g', packageName];
|
|
387
|
+
|
|
388
|
+
if (!isGlobal) {
|
|
389
|
+
installArgs = ['install', packageName];
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
execSync(`${npmCmd} ${installArgs.join(' ')}`, {
|
|
393
|
+
stdio: 'inherit',
|
|
394
|
+
timeout: 300000
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
return true;
|
|
398
|
+
} catch (e) {
|
|
399
|
+
console.log(` ⚠️ ${packageName} not available, trying next version...`);
|
|
387
400
|
}
|
|
388
|
-
|
|
389
|
-
execSync(`${npmCmd} ${installArgs.join(' ')}`, {
|
|
390
|
-
stdio: 'inherit',
|
|
391
|
-
timeout: 300000
|
|
392
|
-
});
|
|
393
|
-
|
|
394
|
-
return true;
|
|
395
|
-
} catch (e) {
|
|
396
|
-
console.error(`\n ❌ Failed to install ${packageName}`);
|
|
397
|
-
console.error(` Error: ${e.message}\n`);
|
|
398
|
-
return false;
|
|
399
401
|
}
|
|
402
|
+
|
|
403
|
+
console.error(`\n ❌ Failed to install platform binary for ${platform}-${arch}`);
|
|
404
|
+
return false;
|
|
400
405
|
}
|
|
401
406
|
|
|
402
407
|
async function main() {
|