open-agents-ai 0.68.0 → 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.
- package/dist/index.js +118 -55
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -24662,21 +24662,10 @@ function installOllamaLinux() {
|
|
|
24662
24662
|
return false;
|
|
24663
24663
|
}
|
|
24664
24664
|
}
|
|
24665
|
-
async function installOllamaMac(
|
|
24665
|
+
async function installOllamaMac(_rl) {
|
|
24666
24666
|
if (!hasCmd("brew")) {
|
|
24667
24667
|
process.stdout.write(`
|
|
24668
|
-
${c2.
|
|
24669
|
-
|
|
24670
|
-
`);
|
|
24671
|
-
const installBrew = await ask(rl, ` ${c2.bold("Install Homebrew?")} (Y/n) `);
|
|
24672
|
-
if (installBrew.toLowerCase() === "n") {
|
|
24673
|
-
process.stdout.write(` ${c2.dim("Skipping Homebrew install.")}
|
|
24674
|
-
|
|
24675
|
-
`);
|
|
24676
|
-
return false;
|
|
24677
|
-
}
|
|
24678
|
-
process.stdout.write(`
|
|
24679
|
-
${c2.cyan("\u25CF")} Installing Homebrew...
|
|
24668
|
+
${c2.cyan("\u25CF")} Homebrew not found. Installing automatically (needed for Ollama on macOS)...
|
|
24680
24669
|
|
|
24681
24670
|
`);
|
|
24682
24671
|
try {
|
|
@@ -24761,6 +24750,64 @@ function installOllamaWindows() {
|
|
|
24761
24750
|
return false;
|
|
24762
24751
|
}
|
|
24763
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
|
+
}
|
|
24764
24811
|
function pullModelWithAutoUpdate(tag) {
|
|
24765
24812
|
try {
|
|
24766
24813
|
execSync20(`ollama pull ${tag}`, {
|
|
@@ -24963,13 +25010,34 @@ async function doSetup(config, rl) {
|
|
|
24963
25010
|
`);
|
|
24964
25011
|
const ollamaInstalled = hasCmd("ollama");
|
|
24965
25012
|
if (ollamaInstalled) {
|
|
24966
|
-
process.stdout.write(` ${c2.cyan("\u25CF")} Ollama is installed but not running.
|
|
25013
|
+
process.stdout.write(` ${c2.cyan("\u25CF")} Ollama is installed but not running. Starting automatically...
|
|
25014
|
+
`);
|
|
25015
|
+
try {
|
|
25016
|
+
const child = spawn12("ollama", ["serve"], { stdio: "ignore", detached: true });
|
|
25017
|
+
child.unref();
|
|
25018
|
+
await new Promise((resolve28) => setTimeout(resolve28, 3e3));
|
|
25019
|
+
try {
|
|
25020
|
+
models = await fetchOllamaModels(config.backendUrl);
|
|
25021
|
+
process.stdout.write(` ${c2.green("\u2714")} Ollama is running.
|
|
25022
|
+
|
|
25023
|
+
`);
|
|
25024
|
+
} catch {
|
|
25025
|
+
process.stdout.write(` ${c2.yellow("\u26A0")} Ollama started but not responding yet. It may need a moment.
|
|
24967
25026
|
|
|
24968
25027
|
`);
|
|
24969
|
-
|
|
24970
|
-
|
|
25028
|
+
}
|
|
25029
|
+
} catch {
|
|
25030
|
+
process.stdout.write(` ${c2.yellow("\u26A0")} Could not start Ollama. Try running ${c2.bold("ollama serve")} manually.
|
|
25031
|
+
|
|
25032
|
+
`);
|
|
25033
|
+
}
|
|
25034
|
+
} else {
|
|
25035
|
+
process.stdout.write(` ${c2.cyan("\u25CF")} Ollama not found. Installing automatically...
|
|
25036
|
+
`);
|
|
25037
|
+
const installed = await autoInstallOllama(rl);
|
|
25038
|
+
if (installed) {
|
|
24971
25039
|
process.stdout.write(`
|
|
24972
|
-
${c2.cyan("\u25CF")} Starting ollama serve
|
|
25040
|
+
${c2.cyan("\u25CF")} Starting ollama serve...
|
|
24973
25041
|
`);
|
|
24974
25042
|
try {
|
|
24975
25043
|
const child = spawn12("ollama", ["serve"], { stdio: "ignore", detached: true });
|
|
@@ -24981,45 +25049,16 @@ async function doSetup(config, rl) {
|
|
|
24981
25049
|
|
|
24982
25050
|
`);
|
|
24983
25051
|
} catch {
|
|
24984
|
-
process.stdout.write(` ${c2.yellow("\u26A0")} Ollama
|
|
25052
|
+
process.stdout.write(` ${c2.yellow("\u26A0")} Ollama installed but not responding yet. Try ${c2.bold("ollama serve")} manually.
|
|
24985
25053
|
|
|
24986
25054
|
`);
|
|
24987
25055
|
}
|
|
24988
25056
|
} catch {
|
|
24989
|
-
process.stdout.write(` ${c2.yellow("\u26A0")}
|
|
25057
|
+
process.stdout.write(` ${c2.yellow("\u26A0")} Ollama installed. Start it with: ${c2.bold("ollama serve")}
|
|
24990
25058
|
|
|
24991
25059
|
`);
|
|
24992
25060
|
}
|
|
24993
25061
|
}
|
|
24994
|
-
} else {
|
|
24995
|
-
const installOllama = await ask(rl, ` ${c2.bold("Install Ollama?")} (Y/n) `);
|
|
24996
|
-
if (installOllama.toLowerCase() !== "n") {
|
|
24997
|
-
const installed = await autoInstallOllama(rl);
|
|
24998
|
-
if (installed) {
|
|
24999
|
-
process.stdout.write(`
|
|
25000
|
-
${c2.cyan("\u25CF")} Starting ollama serve...
|
|
25001
|
-
`);
|
|
25002
|
-
try {
|
|
25003
|
-
const child = spawn12("ollama", ["serve"], { stdio: "ignore", detached: true });
|
|
25004
|
-
child.unref();
|
|
25005
|
-
await new Promise((resolve28) => setTimeout(resolve28, 3e3));
|
|
25006
|
-
try {
|
|
25007
|
-
models = await fetchOllamaModels(config.backendUrl);
|
|
25008
|
-
process.stdout.write(` ${c2.green("\u2714")} Ollama is running.
|
|
25009
|
-
|
|
25010
|
-
`);
|
|
25011
|
-
} catch {
|
|
25012
|
-
process.stdout.write(` ${c2.yellow("\u26A0")} Ollama installed but not responding yet. Try ${c2.bold("ollama serve")} manually.
|
|
25013
|
-
|
|
25014
|
-
`);
|
|
25015
|
-
}
|
|
25016
|
-
} catch {
|
|
25017
|
-
process.stdout.write(` ${c2.yellow("\u26A0")} Ollama installed. Start it with: ${c2.bold("ollama serve")}
|
|
25018
|
-
|
|
25019
|
-
`);
|
|
25020
|
-
}
|
|
25021
|
-
}
|
|
25022
|
-
}
|
|
25023
25062
|
if (models.length === 0) {
|
|
25024
25063
|
const useCustom = await ask(rl, ` ${c2.bold("Use a custom inference endpoint instead?")} (y/n) `);
|
|
25025
25064
|
if (useCustom.toLowerCase() === "y" || useCustom.toLowerCase() === "yes") {
|
|
@@ -26697,11 +26736,30 @@ async function handleEndpoint(arg, ctx, local = false) {
|
|
|
26697
26736
|
} catch (err) {
|
|
26698
26737
|
process.stdout.write(`${c2.yellow("\u26A0")} Could not verify
|
|
26699
26738
|
`);
|
|
26700
|
-
|
|
26701
|
-
|
|
26702
|
-
|
|
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.");
|
|
26703
26762
|
}
|
|
26704
|
-
renderInfo("Setting endpoint anyway \u2014 it may come online later.");
|
|
26705
26763
|
}
|
|
26706
26764
|
ctx.setEndpoint(normalizedUrl, backendType, apiKey);
|
|
26707
26765
|
const endpointSettings = { backendUrl: normalizedUrl, backendType, ...apiKey ? { apiKey } : {} };
|
|
@@ -36635,7 +36693,7 @@ async function startInteractive(config, repoPath) {
|
|
|
36635
36693
|
const provider2 = detectProvider(config.backendUrl);
|
|
36636
36694
|
renderWarning(`Cannot reach ${provider2.label} at ${config.backendUrl}`);
|
|
36637
36695
|
if (provider2.id === "ollama") {
|
|
36638
|
-
renderInfo("
|
|
36696
|
+
renderInfo("Use /endpoint http://127.0.0.1:11434 to auto-install & start Ollama.");
|
|
36639
36697
|
}
|
|
36640
36698
|
renderInfo("Use /endpoint to configure a different backend. Starting anyway...");
|
|
36641
36699
|
}
|
|
@@ -37023,6 +37081,7 @@ Rationale: ${proposal.rationale}${provenanceNote}`;
|
|
|
37023
37081
|
get config() {
|
|
37024
37082
|
return currentConfig;
|
|
37025
37083
|
},
|
|
37084
|
+
rl,
|
|
37026
37085
|
repoRoot,
|
|
37027
37086
|
costTracker,
|
|
37028
37087
|
workEvaluator,
|
|
@@ -38453,9 +38512,13 @@ async function runWithTUI(task, config, repoPath) {
|
|
|
38453
38512
|
const provider2 = detectProvider(config.backendUrl);
|
|
38454
38513
|
renderWarning(`Cannot reach ${provider2.label} at ${config.backendUrl}`);
|
|
38455
38514
|
if (provider2.id === "ollama") {
|
|
38456
|
-
|
|
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.");
|
|
38457
38521
|
}
|
|
38458
|
-
renderInfo("The agent will retry when you submit a task. Use /endpoint to reconfigure.");
|
|
38459
38522
|
}
|
|
38460
38523
|
renderCompactHeader(config.model);
|
|
38461
38524
|
renderUserMessage(task);
|
package/package.json
CHANGED