@sciagent/cli 1.1.61 → 1.1.62

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.
Files changed (2) hide show
  1. package/bin/sciagent.js +11 -13
  2. package/package.json +1 -1
package/bin/sciagent.js CHANGED
@@ -168,14 +168,14 @@ function applyPendingUpdate(installDir) {
168
168
  }
169
169
 
170
170
  /**
171
- * 从 Release Server 查询最新版本号
171
+ * 从 JihuLab Package Registry 查询最新版本号
172
172
  * 返回: 版本字符串 或 null
173
173
  */
174
174
  function fetchLatestVersion() {
175
175
  return new Promise((resolve) => {
176
- // 使用自建服务器 /api/releases/list 获取所有版本,取最新的
177
- const url = `${SELF_HOSTED_BASE}/api/releases/list${SELF_HOSTED_QUERY}`;
178
-
176
+ // 使用 JihuLab Package Registry API 查询版本
177
+ const url = `https://jihulab.com/api/v4/projects/${JIHULAB_PROJECT_ID}/packages?per_page=100&order_by=version&sort=desc`;
178
+
179
179
  const protocol = url.startsWith('https') ? https : http;
180
180
  const request = protocol.get(url, {
181
181
  headers: { 'User-Agent': 'sciagent-cli/1.0' },
@@ -185,15 +185,13 @@ function fetchLatestVersion() {
185
185
  response.on('data', (chunk) => { data += chunk; });
186
186
  response.on('end', () => {
187
187
  try {
188
- const result = JSON.parse(data);
189
- const releases = result.releases || {};
190
- // 找到所有版本中的最新版本
188
+ const packages = JSON.parse(data);
191
189
  let latestVersion = null;
192
- for (const key of Object.keys(releases)) {
193
- const versions = releases[key];
194
- if (Array.isArray(versions) && versions.length > 0 && versions[0].version) {
195
- if (!latestVersion || compareVersions(versions[0].version, latestVersion) > 0) {
196
- latestVersion = versions[0].version;
190
+ for (const pkg of packages) {
191
+ if (pkg.package_type === 'generic' && pkg.name === 'sciagent') {
192
+ const ver = pkg.version;
193
+ if (ver && (!latestVersion || compareVersions(ver, latestVersion) > 0)) {
194
+ latestVersion = ver;
197
195
  }
198
196
  }
199
197
  }
@@ -203,7 +201,7 @@ function fetchLatestVersion() {
203
201
  }
204
202
  });
205
203
  });
206
-
204
+
207
205
  request.on('error', () => resolve(null));
208
206
  request.on('timeout', () => { request.destroy(); resolve(null); });
209
207
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sciagent/cli",
3
- "version": "1.1.61",
3
+ "version": "1.1.62",
4
4
  "description": "SciAgent CLI - AI Research Assistant",
5
5
  "main": "index.js",
6
6
  "files": [