@sciagent/cli 1.0.52 → 1.0.53

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
@@ -8,6 +8,7 @@
8
8
  const { spawn } = require('child_process');
9
9
  const path = require('path');
10
10
  const fs = require('fs');
11
+ const os = require('os');
11
12
 
12
13
  // 平台和架构映射
13
14
  const PLATFORM_MAP = {
@@ -47,6 +48,15 @@ function getBinaryPath() {
47
48
  // 尝试从node_modules中查找
48
49
  const binName = platform === 'win32' ? 'sciagent.exe' : 'sciagent';
49
50
 
51
+ // 方法0: 从 ~/.sciagent/bin/ 或 %LOCALAPPDATA%\sciagent\bin 查找(postinstall下载位置)
52
+ const homeBinDir = platform === 'win32'
53
+ ? path.join(process.env.LOCALAPPDATA || os.homedir(), 'sciagent', 'bin')
54
+ : path.join(os.homedir(), '.sciagent', 'bin');
55
+ const homeBinPath = path.join(homeBinDir, binName);
56
+ if (fs.existsSync(homeBinPath)) {
57
+ return homeBinPath;
58
+ }
59
+
50
60
  // 方法1: 从optionalDependencies安装的包中查找
51
61
  try {
52
62
  const packagePath = require.resolve(`${packageName}/bin/${binName}`);
@@ -69,12 +79,12 @@ function getBinaryPath() {
69
79
 
70
80
  // 未找到二进制文件
71
81
  console.error(`Error: Could not find SciAgent binary for ${platform}-${arch}`);
72
- console.error(`Tried to find package: ${packageName}`);
73
- console.error('');
74
- console.error('Please install the platform-specific package:');
75
- console.error(` npm install ${packageName}`);
82
+ console.error(`Tried locations:`);
83
+ console.error(` ${homeBinPath}`);
84
+ console.error(` ${packageName}/bin/${binName} (npm package)`);
85
+ console.error(` ${localPath} (dev mode)`);
76
86
  console.error('');
77
- console.error('Or install all platform packages:');
87
+ console.error('Please reinstall:');
78
88
  console.error(' npm install -g @sciagent/cli');
79
89
  process.exit(1);
80
90
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sciagent/cli",
3
- "version": "1.0.52",
3
+ "version": "1.0.53",
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.51",
18
+ "@sciagent/cli-linux-x64": "1.0.53",
19
19
  "@sciagent/cli-linux-arm64": "1.0.39",
20
20
  "@sciagent/cli-darwin-x64": "1.0.39",
21
21
  "@sciagent/cli-darwin-arm64": "1.0.39",
22
- "@sciagent/cli-win32-x64": "1.0.52",
22
+ "@sciagent/cli-win32-x64": "1.0.53",
23
23
  "@sciagent/cli-win32-arm64": "1.0.39"
24
24
  },
25
25
  "keywords": [
@@ -27,7 +27,7 @@ const ARCH_MAP = {
27
27
  };
28
28
 
29
29
  // 当前版本号 - 每次发布时同步更新
30
- const CURRENT_VERSION = '1.0.52';
30
+ const CURRENT_VERSION = '1.0.53';
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'];
@@ -83,6 +83,19 @@ function checkBinaryInstalled(platform, arch) {
83
83
  const packageName = `@sciagent/cli-${platform}-${arch}`;
84
84
  const binName = platform === 'win32' ? 'sciagent.exe' : 'sciagent';
85
85
 
86
+ // 检查 ~/.sciagent/bin/ 或 %LOCALAPPDATA%\sciagent\bin(postinstall下载位置)
87
+ const homeBinDir = platform === 'win32'
88
+ ? path.join(process.env.LOCALAPPDATA || os.homedir(), 'sciagent', 'bin')
89
+ : path.join(os.homedir(), '.sciagent', 'bin');
90
+ const homeBinPath = path.join(homeBinDir, binName);
91
+ if (fs.existsSync(homeBinPath)) {
92
+ const stats = fs.statSync(homeBinPath);
93
+ if (stats.size > 10 * 1024 * 1024) {
94
+ return { installed: true, path: homeBinPath };
95
+ }
96
+ }
97
+
98
+ // 检查 npm 包路径
86
99
  try {
87
100
  const packagePath = require.resolve(`${packageName}/bin/${binName}`);
88
101
  return { installed: true, path: packagePath };