@sciagent/cli 1.0.83 → 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 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.83';
16
+ const CURRENT_VERSION = '1.0.84';
17
17
 
18
18
  // 极狐GitLab下载配置
19
19
  const JIHULAB_URL = 'https://jihulab.com';
@@ -116,28 +116,30 @@ function getBinaryPath() {
116
116
  }
117
117
 
118
118
  // 方法1: 从optionalDependencies安装的包中查找
119
- // 注意:npm缓存中的旧包可能包含旧版二进制,需要版本校验
119
+ // ⚠️ 重要:npm包中的二进制可能是旧版本(npm缓存/250MB限制导致无法发布新版)
120
+ // 必须严格校验版本,版本不匹配则跳过并触发下载
120
121
  try {
121
122
  const packagePath = require.resolve(`${packageName}/bin/${binName}`);
122
123
  if (fs.existsSync(packagePath)) {
123
124
  const stats = fs.statSync(packagePath);
124
125
  if (stats.size > 10 * 1024 * 1024) {
125
- // 检查npm包的package.json版本号
126
+ // 严格版本校验:读取npm包的package.json
126
127
  try {
127
128
  const pkgJsonPath = require.resolve(`${packageName}/package.json`);
128
129
  const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
129
130
  const pkgVersion = pkgJson.version;
130
131
  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`);
132
+ if (cmp !== 0) {
133
+ // 版本不匹配(无论高低)→ 跳过,下载正确版本
134
+ console.log(`[INFO] npm package binary version mismatch: ${packageName}@${pkgVersion} != ${CURRENT_VERSION}, will download correct version`);
135
+ // 不return,继续到下载逻辑
134
136
  } else {
135
- // 版本匹配或更高,直接使用
137
+ // 版本精确匹配,使用
136
138
  console.log(`[INFO] Using npm package binary: ${packageName}@${pkgVersion}`);
137
139
  return packagePath;
138
140
  }
139
141
  } catch (e) {
140
- // 无法读取package.json,保守跳过
142
+ // 无法读取package.json,跳过
141
143
  console.log(`[INFO] Cannot read package version from ${packageName}, skipping npm binary`);
142
144
  }
143
145
  } else {
@@ -160,9 +162,9 @@ function getBinaryPath() {
160
162
  return binPath;
161
163
  }
162
164
 
163
- // 未找到二进制文件 - 自动下载
164
- console.log(`⚠️ SciAgent binary not found for ${platform}-${arch}`);
165
- 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...`);
166
168
 
167
169
  const downloaded = downloadBinary(platform, arch, CURRENT_VERSION);
168
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.83",
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.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"
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",
@@ -27,7 +27,7 @@ const ARCH_MAP = {
27
27
  };
28
28
 
29
29
  // 当前版本号 - 每次发布时同步更新
30
- const CURRENT_VERSION = '1.0.83';
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'];