open-agents-ai 0.138.57 → 0.138.58

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/dist/index.js +33 -18
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -40238,8 +40238,16 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
40238
40238
  if (torchCheck === "cpu") {
40239
40239
  renderWarning("GPU detected but PyTorch is CPU-only. Reinstalling with CUDA support in background...");
40240
40240
  try {
40241
- await this.asyncShell(`${JSON.stringify(venvPy)} -m pip install --quiet --force-reinstall torch torchaudio --index-url https://download.pytorch.org/whl/cu124`, 6e5);
40242
- renderInfo("PyTorch reinstalled with CUDA GPU support.");
40241
+ const detectScript = join50(__dirname, "../../../../scripts/detect-torch.py");
40242
+ let pipArgs = `torch torchaudio --index-url https://download.pytorch.org/whl/cu124`;
40243
+ try {
40244
+ const args = await this.asyncShell(`python3 ${JSON.stringify(detectScript)} --pip-args`, 1e4);
40245
+ if (args.trim())
40246
+ pipArgs = args.trim();
40247
+ } catch {
40248
+ }
40249
+ await this.asyncShell(`${JSON.stringify(venvPy)} -m pip install --quiet --force-reinstall ${pipArgs}`, 6e5);
40250
+ renderInfo("PyTorch reinstalled with GPU support.");
40243
40251
  } catch {
40244
40252
  }
40245
40253
  }
@@ -40262,32 +40270,39 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
40262
40270
  throw new Error(`Failed to create venv: ${err instanceof Error ? err.message : String(err)}`);
40263
40271
  }
40264
40272
  }
40265
- let hasCuda = false;
40266
- try {
40267
- await this.asyncShell("nvidia-smi", 5e3);
40268
- hasCuda = true;
40269
- } catch {
40270
- }
40271
- if (hasCuda) {
40272
- renderInfo(" Installing PyTorch (CUDA GPU)...");
40273
+ {
40274
+ const detectScript = join50(__dirname, "../../../../scripts/detect-torch.py");
40275
+ let pipArgsStr = "torch torchaudio";
40276
+ let torchDesc = "unknown platform";
40273
40277
  try {
40274
- await this.asyncShell(`${JSON.stringify(venvPy)} -m pip install --quiet torch torchaudio --index-url https://download.pytorch.org/whl/cu124`, 6e5);
40278
+ const detectResult = await this.asyncShell(`${py} ${JSON.stringify(detectScript)} --json`, 15e3);
40279
+ const spec = JSON.parse(detectResult.trim());
40280
+ pipArgsStr = spec.pip_args_str || "torch torchaudio";
40281
+ torchDesc = spec.description || `${spec.platform} ${spec.arch} ${spec.accelerator}`;
40275
40282
  } catch {
40276
40283
  try {
40277
- await this.asyncShell(`${JSON.stringify(venvPy)} -m pip install --quiet torch torchaudio`, 6e5);
40278
- } catch (err2) {
40279
- throw new Error(`Failed to install PyTorch (CUDA): ${err2 instanceof Error ? err2.message : String(err2)}`);
40284
+ await this.asyncShell("nvidia-smi", 5e3);
40285
+ pipArgsStr = "torch torchaudio --index-url https://download.pytorch.org/whl/cu124";
40286
+ torchDesc = "CUDA (fallback)";
40287
+ } catch {
40288
+ const arch = process.arch;
40289
+ if (arch === "arm64" || arch === "arm") {
40290
+ pipArgsStr = "torch torchaudio";
40291
+ torchDesc = "ARM CPU (generic PyPI)";
40292
+ } else {
40293
+ pipArgsStr = "torch torchaudio --index-url https://download.pytorch.org/whl/cpu";
40294
+ torchDesc = "x86_64 CPU";
40295
+ }
40280
40296
  }
40281
40297
  }
40282
- } else {
40283
- renderInfo(" Installing PyTorch (CPU \u2014 no NVIDIA GPU detected)...");
40298
+ renderInfo(` Installing PyTorch (${torchDesc})...`);
40284
40299
  try {
40285
- await this.asyncShell(`${JSON.stringify(venvPy)} -m pip install --quiet torch torchaudio --index-url https://download.pytorch.org/whl/cpu`, 6e5);
40300
+ await this.asyncShell(`${JSON.stringify(venvPy)} -m pip install --quiet ${pipArgsStr}`, 6e5);
40286
40301
  } catch {
40287
40302
  try {
40288
40303
  await this.asyncShell(`${JSON.stringify(venvPy)} -m pip install --quiet torch torchaudio`, 6e5);
40289
40304
  } catch (err2) {
40290
- throw new Error(`Failed to install PyTorch: ${err2 instanceof Error ? err2.message : String(err2)}`);
40305
+ throw new Error(`Failed to install PyTorch (${torchDesc}): ${err2 instanceof Error ? err2.message : String(err2)}`);
40291
40306
  }
40292
40307
  }
40293
40308
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.138.57",
3
+ "version": "0.138.58",
4
4
  "description": "AI coding agent powered by open-source models (Ollama/vLLM) — interactive TUI with agentic tool-calling loop",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",