open-agents-ai 0.2.0 → 0.2.1
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 +47 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5496,6 +5496,52 @@ function ask(rl, question) {
|
|
|
5496
5496
|
rl.question(question, (answer) => resolve11(answer.trim()));
|
|
5497
5497
|
});
|
|
5498
5498
|
}
|
|
5499
|
+
function pullModelWithAutoUpdate(tag) {
|
|
5500
|
+
try {
|
|
5501
|
+
execSync(`ollama pull ${tag}`, {
|
|
5502
|
+
stdio: "inherit",
|
|
5503
|
+
timeout: 36e5
|
|
5504
|
+
// 1 hour max
|
|
5505
|
+
});
|
|
5506
|
+
} catch (err) {
|
|
5507
|
+
const errMsg = err instanceof Error ? err.message : String(err);
|
|
5508
|
+
const stderr = err?.stderr?.toString?.() ?? errMsg;
|
|
5509
|
+
const combined = errMsg + "\n" + stderr;
|
|
5510
|
+
if (combined.includes("412") || combined.includes("newer version") || combined.includes("requires a newer version")) {
|
|
5511
|
+
process.stdout.write(`
|
|
5512
|
+
${c2.yellow("\u26A0")} Ollama needs to be updated for this model.
|
|
5513
|
+
`);
|
|
5514
|
+
process.stdout.write(` ${c2.cyan("\u25CF")} Updating Ollama via official install script...
|
|
5515
|
+
|
|
5516
|
+
`);
|
|
5517
|
+
try {
|
|
5518
|
+
execSync("curl -fsSL https://ollama.com/install.sh | sh", {
|
|
5519
|
+
stdio: "inherit",
|
|
5520
|
+
timeout: 3e5
|
|
5521
|
+
// 5 min max for install
|
|
5522
|
+
});
|
|
5523
|
+
process.stdout.write(`
|
|
5524
|
+
${c2.green("\u2714")} Ollama updated successfully.
|
|
5525
|
+
`);
|
|
5526
|
+
process.stdout.write(` ${c2.cyan("\u25CF")} Retrying pull of ${c2.bold(tag)}...
|
|
5527
|
+
|
|
5528
|
+
`);
|
|
5529
|
+
execSync(`ollama pull ${tag}`, {
|
|
5530
|
+
stdio: "inherit",
|
|
5531
|
+
timeout: 36e5
|
|
5532
|
+
});
|
|
5533
|
+
} catch (updateErr) {
|
|
5534
|
+
const updateMsg = updateErr instanceof Error ? updateErr.message : String(updateErr);
|
|
5535
|
+
throw new Error(`Failed to update Ollama and retry pull: ${updateMsg}
|
|
5536
|
+
Try manually:
|
|
5537
|
+
curl -fsSL https://ollama.com/install.sh | sh
|
|
5538
|
+
ollama pull ${tag}`);
|
|
5539
|
+
}
|
|
5540
|
+
} else {
|
|
5541
|
+
throw err;
|
|
5542
|
+
}
|
|
5543
|
+
}
|
|
5544
|
+
}
|
|
5499
5545
|
async function runSetupWizard(config) {
|
|
5500
5546
|
const rl = readline.createInterface({
|
|
5501
5547
|
input: process.stdin,
|
|
@@ -5630,11 +5676,7 @@ async function doSetup(config, rl) {
|
|
|
5630
5676
|
${c2.cyan("\u25CF")} Pulling ${c2.bold(selectedVariant.tag)}... (this may take a while)
|
|
5631
5677
|
`);
|
|
5632
5678
|
try {
|
|
5633
|
-
|
|
5634
|
-
stdio: "inherit",
|
|
5635
|
-
timeout: 36e5
|
|
5636
|
-
// 1 hour max
|
|
5637
|
-
});
|
|
5679
|
+
pullModelWithAutoUpdate(selectedVariant.tag);
|
|
5638
5680
|
process.stdout.write(`
|
|
5639
5681
|
${c2.green("\u2714")} Model ${c2.bold(selectedVariant.tag)} pulled successfully.
|
|
5640
5682
|
|
package/package.json
CHANGED