@sciagent/cli 1.3.52 → 1.3.54

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 CHANGED
@@ -25,7 +25,7 @@ const https = require('https');
25
25
  const http = require('http');
26
26
 
27
27
  // 当前版本号 - 与 postinstall.js 和 package.json 保持同步
28
- const CURRENT_VERSION = '1.3.52';
28
+ const CURRENT_VERSION = '1.3.54';
29
29
 
30
30
  // Releases 下载源配置(优先级从高到低)
31
31
  // JihuLab 通用包仓库(国内 CDN,速度快)作为主源
@@ -251,13 +251,17 @@ function backgroundDownloadUpdate(platform, arch, latestVersion) {
251
251
  `$out = "${tempPath}"`,
252
252
  ];
253
253
 
254
+ // Use WebClient for large files - much faster than Invoke-WebRequest
254
255
  if (source.auth === 'jihulab') {
255
256
  // JihuLab 需要 Basic Auth
256
257
  const b64 = Buffer.from(`${JIHULAB_DEPLOY_TOKEN_USER}:${JIHULAB_DEPLOY_TOKEN}`).toString('base64');
257
258
  scriptLines.push(`$headers = @{ "Authorization" = "Basic ${b64}" }`);
258
- scriptLines.push('Invoke-WebRequest -Uri $uri -OutFile $out -UseBasicParsing -Headers $headers');
259
+ scriptLines.push('$wc = New-Object System.Net.WebClient');
260
+ scriptLines.push('$wc.Headers.Add("Authorization", $headers["Authorization"])');
261
+ scriptLines.push('$wc.DownloadFile($uri, $out)');
259
262
  } else {
260
- scriptLines.push('Invoke-WebRequest -Uri $uri -OutFile $out -UseBasicParsing');
263
+ scriptLines.push('$wc = New-Object System.Net.WebClient');
264
+ scriptLines.push('$wc.DownloadFile($uri, $out)');
261
265
  }
262
266
  scriptLines.push(`if (Test-Path $out) { $s = (Get-Item $out).Length; Write-Host "Downloaded: $s bytes" } else { exit 1 }`);
263
267
 
@@ -626,9 +630,13 @@ function downloadBinaryToTemp(platform, arch, version) {
626
630
  if (source.auth === 'jihulab') {
627
631
  const b64 = Buffer.from(`${JIHULAB_DEPLOY_TOKEN_USER}:${JIHULAB_DEPLOY_TOKEN}`).toString('base64');
628
632
  scriptLines.push(`$headers = @{ "Authorization" = "Basic ${b64}" }`);
629
- scriptLines.push('Invoke-WebRequest -Uri $uri -OutFile $out -UseBasicParsing -Headers $headers');
633
+ // Use WebClient for large files - much faster than Invoke-WebRequest
634
+ scriptLines.push('$wc = New-Object System.Net.WebClient');
635
+ scriptLines.push('$wc.Headers.Add("Authorization", $headers["Authorization"])');
636
+ scriptLines.push('$wc.DownloadFile($uri, $out)');
630
637
  } else {
631
- scriptLines.push('Invoke-WebRequest -Uri $uri -OutFile $out -UseBasicParsing');
638
+ scriptLines.push('$wc = New-Object System.Net.WebClient');
639
+ scriptLines.push('$wc.DownloadFile($uri, $out)');
632
640
  }
633
641
  scriptLines.push('if (Test-Path $out) { $s = (Get-Item $out).Length; Write-Host " Downloaded: $s bytes" } else { Write-Error "File not created"; exit 1 }');
634
642
 
@@ -730,9 +738,13 @@ function downloadBinary(platform, arch, version) {
730
738
  if (source.auth === 'jihulab') {
731
739
  const b64 = Buffer.from(`${JIHULAB_DEPLOY_TOKEN_USER}:${JIHULAB_DEPLOY_TOKEN}`).toString('base64');
732
740
  scriptLines.push(`$headers = @{ "Authorization" = "Basic ${b64}" }`);
733
- scriptLines.push('Invoke-WebRequest -Uri $uri -OutFile $out -UseBasicParsing -Headers $headers');
741
+ // Use WebClient for large files - much faster than Invoke-WebRequest
742
+ scriptLines.push('$wc = New-Object System.Net.WebClient');
743
+ scriptLines.push('$wc.Headers.Add("Authorization", $headers["Authorization"])');
744
+ scriptLines.push('$wc.DownloadFile($uri, $out)');
734
745
  } else {
735
- scriptLines.push('Invoke-WebRequest -Uri $uri -OutFile $out -UseBasicParsing');
746
+ scriptLines.push('$wc = New-Object System.Net.WebClient');
747
+ scriptLines.push('$wc.DownloadFile($uri, $out)');
736
748
  }
737
749
  scriptLines.push('if (Test-Path $out) { $s = (Get-Item $out).Length; Write-Host " Downloaded: $s bytes" } else { Write-Error "File not created"; exit 1 }');
738
750
 
@@ -840,9 +852,13 @@ function downloadBinary(platform, arch, version) {
840
852
  if (source.auth === 'jihulab') {
841
853
  const b64 = Buffer.from(`${JIHULAB_DEPLOY_TOKEN_USER}:${JIHULAB_DEPLOY_TOKEN}`).toString('base64');
842
854
  scriptLines.push(`$headers = @{ "Authorization" = "Basic ${b64}" }`);
843
- scriptLines.push('Invoke-WebRequest -Uri $uri -OutFile $out -UseBasicParsing -Headers $headers');
855
+ // Use WebClient for large files - much faster than Invoke-WebRequest
856
+ scriptLines.push('$wc = New-Object System.Net.WebClient');
857
+ scriptLines.push('$wc.Headers.Add("Authorization", $headers["Authorization"])');
858
+ scriptLines.push('$wc.DownloadFile($uri, $out)');
844
859
  } else {
845
- scriptLines.push('Invoke-WebRequest -Uri $uri -OutFile $out -UseBasicParsing');
860
+ scriptLines.push('$wc = New-Object System.Net.WebClient');
861
+ scriptLines.push('$wc.DownloadFile($uri, $out)');
846
862
  }
847
863
  scriptLines.push('if (Test-Path $out) { $s = (Get-Item $out).Length; Write-Host " Downloaded: $s bytes" } else { Write-Error "File not created"; exit 1 }');
848
864
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sciagent/cli",
3
- "version": "1.3.52",
3
+ "version": "1.3.54",
4
4
  "description": "SciAgent CLI - AI Research Assistant",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -27,7 +27,7 @@ const ARCH_MAP = {
27
27
  };
28
28
 
29
29
  // 当前版本号 - 每次发布时同步更新
30
- const CURRENT_VERSION = '1.3.52';
30
+ const CURRENT_VERSION = '1.3.54';
31
31
 
32
32
  // GitHub Releases 回退版本列表(当当前版本的 release 不存在时尝试)
33
33
  const GITHUB_FALLBACK_VERSIONS = ['1.1.3', '1.0.50', '1.0.48', '1.0.46', '1.0.40', '1.0.38', '1.0.36'];