@bolloon/bolloon-agent 0.1.11 → 0.1.12

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.
@@ -56,14 +56,19 @@ function getGlobalBolloonDir() {
56
56
  * 优先使用全局安装的版本(更准确反映实际运行的版本)
57
57
  */
58
58
  function getInstalledVersion(packageName) {
59
+ // 调试:打印 cwd
60
+ console.error(`[DEBUG] getInstalledVersion called, cwd=${process.cwd()}, package=${packageName}`);
59
61
  // 对于 @bolloon/bolloon-agent,始终优先从全局安装位置读取版本
60
62
  // 这样可以准确检测实际安装的版本,而不受 cwd 影响
61
63
  if (packageName === '@bolloon/bolloon-agent') {
62
64
  const globalDir = getGlobalBolloonDir();
65
+ console.error(`[DEBUG] globalDir=${globalDir}`);
63
66
  if (globalDir) {
64
67
  const pkgPath = path.join(globalDir, 'package.json');
68
+ console.error(`[DEBUG] pkgPath=${pkgPath}, exists=${fs.existsSync(pkgPath)}`);
65
69
  try {
66
70
  const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
71
+ console.error(`[DEBUG] pkg.version=${pkg.version}`);
67
72
  return pkg.version || null;
68
73
  }
69
74
  catch (e) {
@@ -72,9 +77,11 @@ function getInstalledVersion(packageName) {
72
77
  }
73
78
  // 回退到本地 package.json
74
79
  const localPkgPath = path.join(process.cwd(), 'package.json');
80
+ console.error(`[DEBUG] localPkgPath=${localPkgPath}, exists=${fs.existsSync(localPkgPath)}`);
75
81
  if (fs.existsSync(localPkgPath)) {
76
82
  try {
77
83
  const pkg = JSON.parse(fs.readFileSync(localPkgPath, 'utf-8'));
84
+ console.error(`[DEBUG] local pkg.version=${pkg.version}`);
78
85
  return pkg.version || null;
79
86
  }
80
87
  catch (e) {
@@ -84,9 +91,11 @@ function getInstalledVersion(packageName) {
84
91
  }
85
92
  // 检查本地 node_modules
86
93
  const packageJsonPath = findPackageJson(packageName);
94
+ console.error(`[DEBUG] findPackageJson=${packageJsonPath}`);
87
95
  if (packageJsonPath) {
88
96
  try {
89
97
  const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
98
+ console.error(`[DEBUG] node_modules pkg.version=${pkg.version}`);
90
99
  return pkg.version || null;
91
100
  }
92
101
  catch (e) {
@@ -155,10 +164,15 @@ async function checkBolloonUpdates() {
155
164
  let latestVersion = '';
156
165
  for (const pkg of packagesToCheck) {
157
166
  const installed = getInstalledVersion(pkg);
167
+ console.error(`[DEBUG] getInstalledVersion(${pkg}) = ${installed}`);
158
168
  if (!installed)
159
169
  continue;
160
- currentVersion = installed;
170
+ // 只记录 @bolloon/bolloon-agent 的版本作为当前版本
171
+ if (pkg === '@bolloon/bolloon-agent') {
172
+ currentVersion = installed;
173
+ }
161
174
  const latest = await getLatestVersion(pkg);
175
+ console.error(`[DEBUG] getLatestVersion(${pkg}) = ${latest}`);
162
176
  if (latest && compareVersions(installed, latest) < 0) {
163
177
  hasUpdate = true;
164
178
  latestVersion = latest;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bolloon/bolloon-agent",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "type": "module",
5
5
  "description": "P2P AI Document Agent - 全局安装后执行 `bolloon` 启动产品",
6
6
  "main": "dist/cli.js",
@@ -47,12 +47,14 @@
47
47
  "@multiformats/multiaddr": "^13.0.3",
48
48
  "@noble/hashes": "^1.3.0",
49
49
  "@rayhanadev/iroh": "^0.1.1",
50
+ "b4a": "^1.8.1",
50
51
  "dotenv": "^17.4.2",
51
52
  "esbuild": "^0.24.0",
52
53
  "express": "^5.2.1",
53
54
  "libp2p": "^3.3.0",
54
55
  "mammoth": "^1.6.0",
55
56
  "pdf-parse": "^1.1.4",
57
+ "platform": "^1.3.6",
56
58
  "react": "^18.3.0",
57
59
  "react-dom": "^18.3.0"
58
60
  },
@@ -47,7 +47,7 @@ function initUserDirs() {
47
47
  const configPath = path.join(bolloonDir, 'config.json');
48
48
  if (!fs.existsSync(configPath)) {
49
49
  const defaultConfig = {
50
- version: '0.1.11',
50
+ version: '0.1.12',
51
51
  initializedAt: new Date().toISOString(),
52
52
  defaults: {
53
53
  port: 54188,
package/src/cli-entry.ts CHANGED
@@ -26,7 +26,7 @@ const GREEN = '\x1b[32m';
26
26
  const MAGENTA = '\x1b[35m';
27
27
 
28
28
  // 版本信息
29
- const VERSION = '0.1.11';
29
+ const VERSION = '0.1.12';
30
30
 
31
31
  function log(msg: string, color: string = RESET) {
32
32
  console.log(`${color}${msg}${RESET}`);
@@ -86,14 +86,20 @@ function getGlobalBolloonDir(): string | null {
86
86
  * 优先使用全局安装的版本(更准确反映实际运行的版本)
87
87
  */
88
88
  function getInstalledVersion(packageName: string): string | null {
89
+ // 调试:打印 cwd
90
+ console.error(`[DEBUG] getInstalledVersion called, cwd=${process.cwd()}, package=${packageName}`);
91
+
89
92
  // 对于 @bolloon/bolloon-agent,始终优先从全局安装位置读取版本
90
93
  // 这样可以准确检测实际安装的版本,而不受 cwd 影响
91
94
  if (packageName === '@bolloon/bolloon-agent') {
92
95
  const globalDir = getGlobalBolloonDir();
96
+ console.error(`[DEBUG] globalDir=${globalDir}`);
93
97
  if (globalDir) {
94
98
  const pkgPath = path.join(globalDir, 'package.json');
99
+ console.error(`[DEBUG] pkgPath=${pkgPath}, exists=${fs.existsSync(pkgPath)}`);
95
100
  try {
96
101
  const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
102
+ console.error(`[DEBUG] pkg.version=${pkg.version}`);
97
103
  return pkg.version || null;
98
104
  } catch (e) {
99
105
  // 忽略
@@ -102,9 +108,11 @@ function getInstalledVersion(packageName: string): string | null {
102
108
 
103
109
  // 回退到本地 package.json
104
110
  const localPkgPath = path.join(process.cwd(), 'package.json');
111
+ console.error(`[DEBUG] localPkgPath=${localPkgPath}, exists=${fs.existsSync(localPkgPath)}`);
105
112
  if (fs.existsSync(localPkgPath)) {
106
113
  try {
107
114
  const pkg = JSON.parse(fs.readFileSync(localPkgPath, 'utf-8'));
115
+ console.error(`[DEBUG] local pkg.version=${pkg.version}`);
108
116
  return pkg.version || null;
109
117
  } catch (e) {
110
118
  // 忽略
@@ -114,9 +122,11 @@ function getInstalledVersion(packageName: string): string | null {
114
122
 
115
123
  // 检查本地 node_modules
116
124
  const packageJsonPath = findPackageJson(packageName);
125
+ console.error(`[DEBUG] findPackageJson=${packageJsonPath}`);
117
126
  if (packageJsonPath) {
118
127
  try {
119
128
  const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf-8'));
129
+ console.error(`[DEBUG] node_modules pkg.version=${pkg.version}`);
120
130
  return pkg.version || null;
121
131
  } catch (e) {
122
132
  // 忽略错误
@@ -188,10 +198,16 @@ async function checkBolloonUpdates(): Promise<PackageInfo | null> {
188
198
 
189
199
  for (const pkg of packagesToCheck) {
190
200
  const installed = getInstalledVersion(pkg);
201
+ console.error(`[DEBUG] getInstalledVersion(${pkg}) = ${installed}`);
191
202
  if (!installed) continue;
192
203
 
193
- currentVersion = installed;
204
+ // 只记录 @bolloon/bolloon-agent 的版本作为当前版本
205
+ if (pkg === '@bolloon/bolloon-agent') {
206
+ currentVersion = installed;
207
+ }
208
+
194
209
  const latest = await getLatestVersion(pkg);
210
+ console.error(`[DEBUG] getLatestVersion(${pkg}) = ${latest}`);
195
211
 
196
212
  if (latest && compareVersions(installed, latest) < 0) {
197
213
  hasUpdate = true;