open-agents-ai 0.68.1 → 0.68.2

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 +89 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -24750,6 +24750,64 @@ function installOllamaWindows() {
24750
24750
  return false;
24751
24751
  }
24752
24752
  }
24753
+ async function ensureOllamaRunning(backendUrl, rl) {
24754
+ const ollamaInstalled = hasCmd("ollama");
24755
+ if (!ollamaInstalled) {
24756
+ if (rl) {
24757
+ process.stdout.write(`
24758
+ ${c2.yellow("\u26A0")} Ollama is not installed on this system.
24759
+ `);
24760
+ const answer = await ask(rl, ` ${c2.bold("Install Ollama now?")} (Y/n) `);
24761
+ if (answer.toLowerCase() === "n") {
24762
+ return false;
24763
+ }
24764
+ } else {
24765
+ process.stdout.write(`
24766
+ ${c2.cyan("\u25CF")} Ollama not found. Installing automatically...
24767
+ `);
24768
+ }
24769
+ const installRl = rl ?? readline.createInterface({ input: process.stdin, output: process.stdout });
24770
+ const installed = await autoInstallOllama(installRl);
24771
+ if (!rl)
24772
+ installRl.close();
24773
+ if (!installed) {
24774
+ process.stdout.write(` ${c2.red("\u2716")} Ollama installation failed.
24775
+
24776
+ `);
24777
+ return false;
24778
+ }
24779
+ }
24780
+ process.stdout.write(` ${c2.cyan("\u25CF")} Starting ollama serve...
24781
+ `);
24782
+ try {
24783
+ const child = spawn12("ollama", ["serve"], { stdio: "ignore", detached: true });
24784
+ child.unref();
24785
+ } catch {
24786
+ process.stdout.write(` ${c2.yellow("\u26A0")} Could not start ollama serve.
24787
+
24788
+ `);
24789
+ return false;
24790
+ }
24791
+ for (let i = 0; i < 5; i++) {
24792
+ await new Promise((resolve28) => setTimeout(resolve28, 2e3));
24793
+ try {
24794
+ const resp = await fetch(`${backendUrl}/api/tags`, {
24795
+ signal: AbortSignal.timeout(3e3)
24796
+ });
24797
+ if (resp.ok) {
24798
+ process.stdout.write(` ${c2.green("\u2714")} Ollama is running.
24799
+
24800
+ `);
24801
+ return true;
24802
+ }
24803
+ } catch {
24804
+ }
24805
+ }
24806
+ process.stdout.write(` ${c2.yellow("\u26A0")} Ollama started but not responding. Try ${c2.bold("ollama serve")} manually.
24807
+
24808
+ `);
24809
+ return false;
24810
+ }
24753
24811
  function pullModelWithAutoUpdate(tag) {
24754
24812
  try {
24755
24813
  execSync20(`ollama pull ${tag}`, {
@@ -26678,11 +26736,30 @@ async function handleEndpoint(arg, ctx, local = false) {
26678
26736
  } catch (err) {
26679
26737
  process.stdout.write(`${c2.yellow("\u26A0")} Could not verify
26680
26738
  `);
26681
- renderWarning(`Endpoint may not be reachable: ${err instanceof Error ? err.message : String(err)}`);
26682
- if (provider.authRequired && !apiKey) {
26683
- renderInfo(`${provider.label} typically requires an API key. Use: /endpoint ${url} --auth <key>`);
26739
+ if (provider.id === "ollama" && ctx.rl) {
26740
+ const running = await ensureOllamaRunning(normalizedUrl, ctx.rl);
26741
+ if (running) {
26742
+ try {
26743
+ const retryResp = await fetch(`${normalizedUrl}${provider.modelsPath}`, {
26744
+ signal: AbortSignal.timeout(5e3)
26745
+ });
26746
+ if (retryResp.ok) {
26747
+ process.stdout.write(` ${c2.green("\u2714")} Connected to Ollama.
26748
+ `);
26749
+ }
26750
+ } catch {
26751
+ }
26752
+ } else {
26753
+ renderWarning(`Endpoint may not be reachable: ${err instanceof Error ? err.message : String(err)}`);
26754
+ renderInfo("Setting endpoint anyway \u2014 it may come online later.");
26755
+ }
26756
+ } else {
26757
+ renderWarning(`Endpoint may not be reachable: ${err instanceof Error ? err.message : String(err)}`);
26758
+ if (provider.authRequired && !apiKey) {
26759
+ renderInfo(`${provider.label} typically requires an API key. Use: /endpoint ${url} --auth <key>`);
26760
+ }
26761
+ renderInfo("Setting endpoint anyway \u2014 it may come online later.");
26684
26762
  }
26685
- renderInfo("Setting endpoint anyway \u2014 it may come online later.");
26686
26763
  }
26687
26764
  ctx.setEndpoint(normalizedUrl, backendType, apiKey);
26688
26765
  const endpointSettings = { backendUrl: normalizedUrl, backendType, ...apiKey ? { apiKey } : {} };
@@ -36616,7 +36693,7 @@ async function startInteractive(config, repoPath) {
36616
36693
  const provider2 = detectProvider(config.backendUrl);
36617
36694
  renderWarning(`Cannot reach ${provider2.label} at ${config.backendUrl}`);
36618
36695
  if (provider2.id === "ollama") {
36619
- renderInfo("Start Ollama with: ollama serve");
36696
+ renderInfo("Use /endpoint http://127.0.0.1:11434 to auto-install & start Ollama.");
36620
36697
  }
36621
36698
  renderInfo("Use /endpoint to configure a different backend. Starting anyway...");
36622
36699
  }
@@ -37004,6 +37081,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
37004
37081
  get config() {
37005
37082
  return currentConfig;
37006
37083
  },
37084
+ rl,
37007
37085
  repoRoot,
37008
37086
  costTracker,
37009
37087
  workEvaluator,
@@ -38434,9 +38512,13 @@ async function runWithTUI(task, config, repoPath) {
38434
38512
  const provider2 = detectProvider(config.backendUrl);
38435
38513
  renderWarning(`Cannot reach ${provider2.label} at ${config.backendUrl}`);
38436
38514
  if (provider2.id === "ollama") {
38437
- renderInfo("Start Ollama with: ollama serve");
38515
+ const running = await ensureOllamaRunning(config.backendUrl);
38516
+ if (!running) {
38517
+ renderInfo("The agent will retry when you submit a task. Use /endpoint to reconfigure.");
38518
+ }
38519
+ } else {
38520
+ renderInfo("The agent will retry when you submit a task. Use /endpoint to reconfigure.");
38438
38521
  }
38439
- renderInfo("The agent will retry when you submit a task. Use /endpoint to reconfigure.");
38440
38522
  }
38441
38523
  renderCompactHeader(config.model);
38442
38524
  renderUserMessage(task);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "open-agents-ai",
3
- "version": "0.68.1",
3
+ "version": "0.68.2",
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",