myagent-ai 1.15.62 → 1.15.64

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 +37 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "myagent-ai",
3
- "version": "1.15.62",
3
+ "version": "1.15.64",
4
4
  "description": "本地桌面端执行型AI助手 - Open Interpreter 风格 | Local Desktop Execution-Oriented AI Assistant",
5
5
  "main": "main.py",
6
6
  "bin": {
package/start.js CHANGED
@@ -171,7 +171,7 @@ function pipInstall(venvPython, pkgSpec, quiet) {
171
171
  for (const getMirror of MIRRORS) {
172
172
  try {
173
173
  const mirrorArgs = getMirror();
174
- const args = ["-m", "pip", "install", "--disable-pip-version-check", "--no-cache-dir"];
174
+ const args = ["-m", "pip", "install", "--disable-pip-version-check", "--prefer-binary"];
175
175
  if (mirrorArgs.length) args.push(...mirrorArgs);
176
176
  if (quiet) args.push("-q");
177
177
  args.push(pkgSpec);
@@ -180,12 +180,42 @@ function pipInstall(venvPython, pkgSpec, quiet) {
180
180
  });
181
181
  return { ok: true, err: "" };
182
182
  } catch (e) {
183
- lastErr = (e.stderr || e.message || "").split("\n").filter(l => l.includes("error") || l.includes("Error")).slice(-1)[0] || e.message;
183
+ const raw = (e.stderr || "");
184
+ lastErr = raw.trim().split("\n").slice(-5).join("\n").trim() || e.message || "unknown error";
184
185
  }
185
186
  }
186
187
  return { ok: false, err: lastErr };
187
188
  }
188
189
 
190
+ /**
191
+ * 尝试安装包(带依赖),如果失败则尝试 --no-deps(裸装)
192
+ * 用于处理 openai→jiter 这类"主包能装但子依赖编译失败"的情况
193
+ */
194
+ function pipInstallWithFallback(venvPython, pkgSpec, quiet) {
195
+ // 正常安装
196
+ const r1 = pipInstall(venvPython, pkgSpec, quiet);
197
+ if (r1.ok) return r1;
198
+
199
+ // 回退: --no-deps 安装主包,跳过编译失败的子依赖
200
+ for (const getMirror of MIRRORS) {
201
+ try {
202
+ const mirrorArgs = getMirror();
203
+ const args = ["-m", "pip", "install", "--disable-pip-version-check", "--prefer-binary", "--no-deps"];
204
+ if (mirrorArgs.length) args.push(...mirrorArgs);
205
+ if (quiet) args.push("-q");
206
+ args.push(pkgSpec);
207
+ execFileSync(venvPython, args, {
208
+ encoding: "utf8", stdio: ["pipe", "pipe", "pipe"], timeout: 180000,
209
+ });
210
+ return { ok: true, err: "(--no-deps)" };
211
+ } catch (e) {
212
+ const raw = (e.stderr || "");
213
+ lastErr = raw.trim().split("\n").slice(-5).join("\n").trim() || e.message || "unknown error";
214
+ }
215
+ }
216
+ return r1;
217
+ }
218
+
189
219
  /**
190
220
  * 从 requirements.txt 解析包列表
191
221
  * @returns {string[]} 如 ["openai>=1.12.0", "aiohttp>=3.9.0", ...]
@@ -266,12 +296,14 @@ function installAllDeps(venvPython, pkgDir) {
266
296
  const isCore = CORE_DEPS.includes(baseName);
267
297
  process.stdout.write(` [${idx}/${total}] ${pkg} ... `);
268
298
 
269
- const result = pipInstall(venvPython, pkg, true);
299
+ const result = isCore ? pipInstallWithFallback(venvPython, pkg, true) : pipInstall(venvPython, pkg, true);
270
300
  if (result.ok) {
271
- console.log("\x1b[32m✓\x1b[0m");
301
+ const note = result.err === "(--no-deps)" ? " \x1b[33m(部分子依赖跳过)\x1b[0m" : "";
302
+ console.log("\x1b[32m✓\x1b[0m" + note);
272
303
  } else {
273
304
  if (isCore) {
274
- console.log(`\x1b[31m✗ ${result.err}\x1b[0m`);
305
+ console.log("\x1b[31m✗\x1b[0m");
306
+ console.log("\x1b[31m " + result.err.split("\n").join("\n ") + "\x1b[0m");
275
307
  failedCore.push(pkg);
276
308
  } else {
277
309
  console.log("\x1b[33m✗ 跳过\x1b[0m");