open-agents-ai 0.184.72 → 0.184.74

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 +104 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -15839,10 +15839,34 @@ var init_vision = __esm({
15839
15839
  const ollamaResult = await this.tryOllamaVision(buffer, filename, action, prompt, length, start);
15840
15840
  if (ollamaResult)
15841
15841
  return ollamaResult;
15842
+ try {
15843
+ const { execSync: execSync34 } = await import("node:child_process");
15844
+ try {
15845
+ execSync34("pip3 install --user moondream 2>/dev/null || pip install --user moondream 2>/dev/null", {
15846
+ timeout: 12e4,
15847
+ stdio: "pipe"
15848
+ });
15849
+ moondreamError = null;
15850
+ moondreamClient = null;
15851
+ const retryClient = await getMoondreamClient().catch(() => null);
15852
+ if (retryClient) {
15853
+ return await this.runMoondream(retryClient, buffer, filename, action, prompt, length, start);
15854
+ }
15855
+ } catch {
15856
+ }
15857
+ try {
15858
+ execSync34("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
15859
+ const retryOllama = await this.tryOllamaVision(buffer, filename, action, prompt, length, start);
15860
+ if (retryOllama)
15861
+ return retryOllama;
15862
+ } catch {
15863
+ }
15864
+ } catch {
15865
+ }
15842
15866
  return {
15843
15867
  success: false,
15844
15868
  output: "",
15845
- error: "No vision backend available.\nTo enable vision, either:\n 1. ollama pull moondream \u2014 uses Ollama (easiest)\n 2. pip install moondream-station \u2014 dedicated server\n 3. Set MOONDREAM_API_KEY for cloud inference",
15869
+ error: "No vision backend available (auto-install attempted but failed).\nManual options:\n 1. ollama pull moondream \u2014 uses Ollama (easiest)\n 2. pip install moondream-station \u2014 dedicated server\n 3. Set MOONDREAM_API_KEY for cloud inference",
15846
15870
  durationMs: performance.now() - start
15847
15871
  };
15848
15872
  } catch (error) {
@@ -15929,12 +15953,28 @@ Coordinates are normalized (0-1). Multiply by image width/height for pixel value
15929
15953
  return null;
15930
15954
  }
15931
15955
  try {
15932
- const res = await fetch(`${ollamaHost}/api/generate`, {
15956
+ let res = await fetch(`${ollamaHost}/api/generate`, {
15933
15957
  method: "POST",
15934
15958
  headers: { "Content-Type": "application/json" },
15935
15959
  body: JSON.stringify({ model, prompt: ollamaPrompt, images: [imageBase64], stream: false }),
15936
15960
  signal: AbortSignal.timeout(6e4)
15937
15961
  });
15962
+ if (!res.ok && model === "moondream") {
15963
+ const errText = await res.text().catch(() => "");
15964
+ if (res.status === 404 || /not found|does not exist/i.test(errText)) {
15965
+ try {
15966
+ const { execSync: execSync34 } = await import("node:child_process");
15967
+ execSync34("ollama pull moondream", { timeout: 3e5, stdio: "pipe" });
15968
+ res = await fetch(`${ollamaHost}/api/generate`, {
15969
+ method: "POST",
15970
+ headers: { "Content-Type": "application/json" },
15971
+ body: JSON.stringify({ model, prompt: ollamaPrompt, images: [imageBase64], stream: false }),
15972
+ signal: AbortSignal.timeout(6e4)
15973
+ });
15974
+ } catch {
15975
+ }
15976
+ }
15977
+ }
15938
15978
  if (!res.ok)
15939
15979
  return null;
15940
15980
  const data = await res.json();
@@ -46168,17 +46208,31 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
46168
46208
  const isMac = process.platform === "darwin";
46169
46209
  try {
46170
46210
  const { spawnSync } = await import("node:child_process");
46211
+ if (process.stdout.isTTY) {
46212
+ process.stdout.write("\x1B[?1002l\x1B[?1003l\x1B[?1006l");
46213
+ }
46171
46214
  if (isMac) {
46172
46215
  renderInfo(" macOS ARM detected \u2014 installing build deps via Homebrew...");
46173
46216
  const brewCheck = spawnSync("which", ["brew"], { stdio: "pipe", timeout: 5e3 });
46174
46217
  if (brewCheck.status === 0) {
46175
- spawnSync("brew", ["install", "llvm", "gcc", "openblas", "libsndfile"], {
46176
- stdio: "inherit",
46218
+ const brewResult = spawnSync("brew", ["install", "llvm", "gcc", "openblas", "libsndfile"], {
46219
+ stdio: "pipe",
46177
46220
  timeout: 3e5
46178
46221
  });
46222
+ if (brewResult.stdout)
46223
+ process.stdout.write(brewResult.stdout);
46224
+ if (brewResult.stderr)
46225
+ process.stderr.write(brewResult.stderr);
46179
46226
  const llvmPrefix = spawnSync("brew", ["--prefix", "llvm"], { stdio: "pipe", timeout: 5e3 });
46180
46227
  if (llvmPrefix.stdout) {
46181
- process.env.LLVM_CONFIG = `${llvmPrefix.stdout.toString().trim()}/bin/llvm-config`;
46228
+ const prefix = llvmPrefix.stdout.toString().trim();
46229
+ process.env.LLVM_CONFIG = `${prefix}/bin/llvm-config`;
46230
+ const openblas = spawnSync("brew", ["--prefix", "openblas"], { stdio: "pipe", timeout: 5e3 });
46231
+ if (openblas.stdout) {
46232
+ const obPrefix = openblas.stdout.toString().trim();
46233
+ process.env.LDFLAGS = `${process.env.LDFLAGS ?? ""} -L${obPrefix}/lib`.trim();
46234
+ process.env.CPPFLAGS = `${process.env.CPPFLAGS ?? ""} -I${obPrefix}/include`.trim();
46235
+ }
46182
46236
  }
46183
46237
  } else {
46184
46238
  renderWarning(" Homebrew not found. Install it: https://brew.sh");
@@ -46189,7 +46243,7 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
46189
46243
  const sudoCheck = spawnSync("sudo", ["-v"], { stdio: "inherit", timeout: 6e4 });
46190
46244
  if (sudoCheck.status === 0) {
46191
46245
  renderInfo(" Installing system build dependencies (this may take a minute)...");
46192
- spawnSync("sudo", [
46246
+ const aptResult = spawnSync("sudo", [
46193
46247
  "apt-get",
46194
46248
  "install",
46195
46249
  "-y",
@@ -46200,11 +46254,18 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
46200
46254
  "gfortran",
46201
46255
  "libopenblas-dev",
46202
46256
  "libsndfile1-dev"
46203
- ], { stdio: "inherit", timeout: 12e4 });
46257
+ ], { stdio: "pipe", timeout: 12e4 });
46258
+ if (aptResult.stdout)
46259
+ process.stdout.write(aptResult.stdout);
46260
+ if (aptResult.stderr)
46261
+ process.stderr.write(aptResult.stderr);
46204
46262
  } else {
46205
46263
  renderWarning(" sudo not available \u2014 skipping system build deps. librosa/lhotse may fail to compile.");
46206
46264
  }
46207
46265
  }
46266
+ if (process.stdout.isTTY) {
46267
+ process.stdout.write("\x1B[?1002h\x1B[?1006h");
46268
+ }
46208
46269
  } catch (err) {
46209
46270
  renderWarning(` Could not install system build deps: ${err instanceof Error ? err.message : String(err)}`);
46210
46271
  }
@@ -46240,8 +46301,10 @@ Error: ${err2 instanceof Error ? err2.message : String(err2)}`);
46240
46301
  // Non-fatal (not hard-imported by LuxTTS):
46241
46302
  { cmd: `${pipCmd} -m pip install --quiet piper-phonemize --find-links https://k2-fsa.github.io/icefall/piper_phonemize.html`, fatal: false, label: "piper-phonemize (optional)" },
46242
46303
  { cmd: `${pipCmd} -m pip install --quiet jieba pypinyin cn2an`, fatal: true, label: "Chinese text processing" },
46243
- // LuxTTS itself:
46244
- { cmd: `${pipCmd} -m pip install --quiet -e ${JSON.stringify(repoDir)}`, fatal: true, label: "LuxTTS (editable install)" }
46304
+ // LuxTTS itself: use --no-deps on ARM because we installed deps individually above.
46305
+ // Without --no-deps, pip tries to resolve zipvoice's full dependency tree which
46306
+ // includes piper-phonemize — and that has no macOS ARM wheel, causing fatal failure.
46307
+ { cmd: `${pipCmd} -m pip install --quiet --no-deps -e ${JSON.stringify(repoDir)}`, fatal: true, label: "LuxTTS (editable install)" }
46245
46308
  ] : [
46246
46309
  // x86_64: all-in-one (fast, all wheels available)
46247
46310
  {
@@ -70084,9 +70147,40 @@ async function main() {
70084
70147
  }
70085
70148
  var scriptPath = process.argv[1] ?? "";
70086
70149
  var isMain = scriptPath.endsWith("index.js") || scriptPath.endsWith("index.ts") || scriptPath.endsWith("open-agents-bin") || scriptPath.includes("open-agents") || scriptPath.includes("/oa");
70150
+ function crashLog(label, err) {
70151
+ const msg = err instanceof Error ? err.stack ?? err.message : String(err);
70152
+ const timestamp = (/* @__PURE__ */ new Date()).toISOString();
70153
+ const logLine = `[${timestamp}] ${label}: ${msg}
70154
+ `;
70155
+ try {
70156
+ const { appendFileSync: appendFileSync5, mkdirSync: mkdirSync30 } = __require("node:fs");
70157
+ const { join: join76 } = __require("node:path");
70158
+ const { homedir: homedir20 } = __require("node:os");
70159
+ const logDir = join76(homedir20(), ".open-agents");
70160
+ mkdirSync30(logDir, { recursive: true });
70161
+ appendFileSync5(join76(logDir, "crash.log"), logLine);
70162
+ } catch {
70163
+ }
70164
+ try {
70165
+ process.stdout.write("\x1B[?1002l\x1B[?1003l\x1B[?1006l\x1B[?25h\x1B[?1049l\x1B[0m\n");
70166
+ process.stderr.write(`\x1B[31m\u2716 ${label}:\x1B[0m ${msg}
70167
+ `);
70168
+ process.stderr.write(`\x1B[2m Crash log: ~/.open-agents/crash.log\x1B[0m
70169
+ `);
70170
+ } catch {
70171
+ }
70172
+ }
70173
+ process.on("uncaughtException", (err) => {
70174
+ crashLog("Uncaught exception", err);
70175
+ process.exit(1);
70176
+ });
70177
+ process.on("unhandledRejection", (reason) => {
70178
+ crashLog("Unhandled rejection", reason);
70179
+ process.exit(1);
70180
+ });
70087
70181
  if (isMain && !process.env.__OPEN_AGENTS_NO_AUTO_RUN) {
70088
70182
  await main().catch((err) => {
70089
- printError(err instanceof Error ? err.message : String(err));
70183
+ crashLog("Fatal error", err);
70090
70184
  process.exit(1);
70091
70185
  });
70092
70186
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.184.72",
3
+ "version": "0.184.74",
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",