myagent-ai 1.15.61 → 1.15.63

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/package.json +1 -1
  2. package/start.js +25 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myagent-ai",
3
- "version": "1.15.61",
3
+ "version": "1.15.63",
4
4
  "description": "本地桌面端执行型AI助手 - Open Interpreter 风格 | Local Desktop Execution-Oriented AI Assistant",
5
5
  "main": "main.py",
6
6
  "bin": {
package/start.js CHANGED
@@ -164,21 +164,28 @@ function ensureVenv() {
164
164
 
165
165
  /**
166
166
  * pip install 单个包,支持多镜像源重试
167
- * @returns {boolean} 是否安装成功
167
+ * @returns {{ok: boolean, err: string}}
168
168
  */
169
169
  function pipInstall(venvPython, pkgSpec, quiet) {
170
+ let lastErr = "";
170
171
  for (const getMirror of MIRRORS) {
171
172
  try {
172
- const args = ["-m", "pip", "install", "--disable-pip-version-check", ...getMirror()];
173
+ const mirrorArgs = getMirror();
174
+ const args = ["-m", "pip", "install", "--disable-pip-version-check"];
175
+ if (mirrorArgs.length) args.push(...mirrorArgs);
173
176
  if (quiet) args.push("-q");
174
177
  args.push(pkgSpec);
175
178
  execFileSync(venvPython, args, {
176
179
  encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 180000,
177
180
  });
178
- return true;
179
- } catch (_) {}
181
+ return { ok: true, err: "" };
182
+ } catch (e) {
183
+ // 保留最后 5 行 stderr 作为错误信息
184
+ const raw = (e.stderr || "");
185
+ lastErr = raw.trim().split("\n").slice(-5).join("\n").trim() || e.message || "unknown error";
186
+ }
180
187
  }
181
- return false;
188
+ return { ok: false, err: lastErr };
182
189
  }
183
190
 
184
191
  /**
@@ -215,10 +222,17 @@ function installAllDeps(venvPython, pkgDir) {
215
222
  if (mirrorArgs.length) console.log(" 使用国内镜像源 (清华)");
216
223
 
217
224
  // 升级 pip
218
- pipInstall(venvPython, "--upgrade pip", true);
225
+ try {
226
+ execFileSync(venvPython, ["-m", "pip", "install", "--upgrade", "pip", "-q", "--disable-pip-version-check"], {
227
+ encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 120000,
228
+ });
229
+ } catch (_) {}
219
230
 
220
231
  // Linux: 预装 evdev-binary (pynput 的依赖,避免编译 evdev)
221
- if (!IS_WIN) pipInstall(venvPython, "evdev-binary", true);
232
+ if (!IS_WIN) {
233
+ const r = pipInstall(venvPython, "evdev-binary", true);
234
+ if (!r.ok) console.log(" \x1b[33m⚠ evdev-binary 安装失败(鼠标控制功能不可用)\x1b[0m");
235
+ }
222
236
 
223
237
  // 第一轮: 批量安装 requirements.txt
224
238
  if (fs.existsSync(reqFile)) {
@@ -254,11 +268,13 @@ function installAllDeps(venvPython, pkgDir) {
254
268
  const isCore = CORE_DEPS.includes(baseName);
255
269
  process.stdout.write(` [${idx}/${total}] ${pkg} ... `);
256
270
 
257
- if (pipInstall(venvPython, pkg, true)) {
271
+ const result = pipInstall(venvPython, pkg, true);
272
+ if (result.ok) {
258
273
  console.log("\x1b[32m✓\x1b[0m");
259
274
  } else {
260
275
  if (isCore) {
261
- console.log("\x1b[31m✗ 核心依赖\x1b[0m");
276
+ console.log("\x1b[31m✗\x1b[0m");
277
+ console.log("\x1b[31m " + result.err.split("\n").join("\n ") + "\x1b[0m");
262
278
  failedCore.push(pkg);
263
279
  } else {
264
280
  console.log("\x1b[33m✗ 跳过\x1b[0m");