open-agents-ai 0.103.21 → 0.103.22

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 +17 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -29703,7 +29703,7 @@ async function fetchOpenAIModels(baseUrl, apiKey) {
29703
29703
  }
29704
29704
  const resp = await fetch(url, {
29705
29705
  headers,
29706
- signal: AbortSignal.timeout(1e4)
29706
+ signal: AbortSignal.timeout(15e3)
29707
29707
  });
29708
29708
  if (!resp.ok) {
29709
29709
  throw new Error(`Failed to fetch models: HTTP ${resp.status}`);
@@ -29768,25 +29768,33 @@ async function fetchModels(baseUrl, apiKey) {
29768
29768
  }
29769
29769
  const provider = detectProvider(baseUrl);
29770
29770
  if (provider.id === "ollama") {
29771
+ let ollamaErr;
29771
29772
  try {
29772
29773
  return await fetchOllamaModels(baseUrl);
29773
- } catch {
29774
+ } catch (err) {
29775
+ ollamaErr = err instanceof Error ? err : new Error(String(err));
29774
29776
  try {
29775
29777
  return await fetchOpenAIModels(baseUrl, apiKey);
29776
29778
  } catch {
29777
- throw new Error("Cannot reach Ollama at " + baseUrl);
29779
+ throw new Error(`Cannot reach Ollama at ${baseUrl}: ${ollamaErr.message}`);
29778
29780
  }
29779
29781
  }
29780
29782
  }
29781
- try {
29782
- return await fetchOpenAIModels(baseUrl, apiKey);
29783
- } catch {
29783
+ let lastErr;
29784
+ for (let attempt = 0; attempt < 2; attempt++) {
29784
29785
  try {
29785
- return await fetchOllamaModels(baseUrl);
29786
- } catch {
29787
- throw new Error(`Cannot fetch models from ${provider.label} at ${baseUrl}`);
29786
+ return await fetchOpenAIModels(baseUrl, apiKey);
29787
+ } catch (err) {
29788
+ lastErr = err instanceof Error ? err : new Error(String(err));
29789
+ if (attempt === 0)
29790
+ await new Promise((r) => setTimeout(r, 1e3));
29788
29791
  }
29789
29792
  }
29793
+ try {
29794
+ return await fetchOllamaModels(baseUrl);
29795
+ } catch {
29796
+ throw new Error(`Cannot fetch models from ${provider.label} at ${baseUrl}: ${lastErr?.message ?? "unknown error"}`);
29797
+ }
29790
29798
  }
29791
29799
  function findModel(models, query) {
29792
29800
  const exact = models.find((m) => m.name === query);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.103.21",
3
+ "version": "0.103.22",
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",