open-agents-ai 0.187.175 → 0.187.176
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 +124 -14
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -290333,6 +290333,91 @@ function ensureCurl() {
|
|
|
290333
290333
|
`);
|
|
290334
290334
|
return false;
|
|
290335
290335
|
}
|
|
290336
|
+
function ensureZstd() {
|
|
290337
|
+
if (hasCmd("zstd")) return true;
|
|
290338
|
+
if (process.platform === "darwin") {
|
|
290339
|
+
if (!hasCmd("brew")) return false;
|
|
290340
|
+
try {
|
|
290341
|
+
execSync48("brew install zstd", { stdio: "inherit", timeout: 12e4 });
|
|
290342
|
+
return hasCmd("zstd");
|
|
290343
|
+
} catch {
|
|
290344
|
+
return false;
|
|
290345
|
+
}
|
|
290346
|
+
}
|
|
290347
|
+
if (process.platform !== "linux") return false;
|
|
290348
|
+
let installCmd = "";
|
|
290349
|
+
if (hasCmd("apt-get")) installCmd = "apt-get install -y zstd";
|
|
290350
|
+
else if (hasCmd("dnf")) installCmd = "dnf install -y zstd";
|
|
290351
|
+
else if (hasCmd("yum")) installCmd = "yum install -y zstd";
|
|
290352
|
+
else if (hasCmd("pacman")) installCmd = "pacman -S --noconfirm zstd";
|
|
290353
|
+
else if (hasCmd("zypper")) installCmd = "zypper install -y zstd";
|
|
290354
|
+
else if (hasCmd("apk")) installCmd = "apk add --no-cache zstd";
|
|
290355
|
+
if (!installCmd) {
|
|
290356
|
+
process.stdout.write(`
|
|
290357
|
+
${c3.yellow("\u26A0")} Could not detect package manager to install zstd.
|
|
290358
|
+
`);
|
|
290359
|
+
return false;
|
|
290360
|
+
}
|
|
290361
|
+
process.stdout.write(`
|
|
290362
|
+
${c3.cyan("\u25CF")} Installing zstd (required by ollama install.sh)...
|
|
290363
|
+
`);
|
|
290364
|
+
const candidates = [
|
|
290365
|
+
`pkexec sh -c "${installCmd}"`,
|
|
290366
|
+
`sudo ${installCmd}`,
|
|
290367
|
+
installCmd
|
|
290368
|
+
// bare (works if already root)
|
|
290369
|
+
];
|
|
290370
|
+
for (const cmd of candidates) {
|
|
290371
|
+
try {
|
|
290372
|
+
execSync48(cmd, { stdio: "inherit", timeout: 18e4 });
|
|
290373
|
+
if (hasCmd("zstd")) {
|
|
290374
|
+
process.stdout.write(` ${c3.green("\u2714")} zstd installed.
|
|
290375
|
+
`);
|
|
290376
|
+
return true;
|
|
290377
|
+
}
|
|
290378
|
+
} catch {
|
|
290379
|
+
}
|
|
290380
|
+
}
|
|
290381
|
+
process.stdout.write(` ${c3.red("\u2716")} Failed to install zstd. Please install manually and retry.
|
|
290382
|
+
`);
|
|
290383
|
+
return false;
|
|
290384
|
+
}
|
|
290385
|
+
function runOllamaInstallScript() {
|
|
290386
|
+
const zstdReady = ensureZstd();
|
|
290387
|
+
if (!zstdReady) {
|
|
290388
|
+
process.stdout.write(` ${c3.yellow("\u26A0")} Proceeding without zstd \u2014 install may fail if the script requires it.
|
|
290389
|
+
`);
|
|
290390
|
+
}
|
|
290391
|
+
const cmd = "curl -fsSL https://ollama.com/install.sh | sh";
|
|
290392
|
+
const runOnce = () => {
|
|
290393
|
+
execSync48(cmd, {
|
|
290394
|
+
stdio: ["inherit", "inherit", "pipe"],
|
|
290395
|
+
timeout: 3e5
|
|
290396
|
+
});
|
|
290397
|
+
};
|
|
290398
|
+
try {
|
|
290399
|
+
runOnce();
|
|
290400
|
+
} catch (err) {
|
|
290401
|
+
const stderrBuf = err?.stderr;
|
|
290402
|
+
const stderr = typeof stderrBuf === "string" ? stderrBuf : stderrBuf?.toString?.() ?? "";
|
|
290403
|
+
const message2 = err instanceof Error ? err.message : String(err);
|
|
290404
|
+
if (stderr) process.stderr.write(stderr);
|
|
290405
|
+
const combined = stderr + "\n" + message2;
|
|
290406
|
+
if (combined.includes("requires zstd") || combined.includes("install zstd")) {
|
|
290407
|
+
process.stdout.write(`
|
|
290408
|
+
${c3.yellow("\u26A0")} Ollama install script requires zstd. Attempting to install it...
|
|
290409
|
+
`);
|
|
290410
|
+
if (ensureZstd()) {
|
|
290411
|
+
runOnce();
|
|
290412
|
+
return;
|
|
290413
|
+
}
|
|
290414
|
+
throw new Error(
|
|
290415
|
+
"Ollama install failed: zstd is required but could not be installed automatically. Please install zstd manually and retry."
|
|
290416
|
+
);
|
|
290417
|
+
}
|
|
290418
|
+
throw err;
|
|
290419
|
+
}
|
|
290420
|
+
}
|
|
290336
290421
|
async function autoInstallOllama(rl) {
|
|
290337
290422
|
const plat = platform3();
|
|
290338
290423
|
if (plat !== "win32" && !ensureCurl()) {
|
|
@@ -290358,10 +290443,7 @@ function installOllamaLinux() {
|
|
|
290358
290443
|
|
|
290359
290444
|
`);
|
|
290360
290445
|
try {
|
|
290361
|
-
|
|
290362
|
-
stdio: "inherit",
|
|
290363
|
-
timeout: 3e5
|
|
290364
|
-
});
|
|
290446
|
+
runOllamaInstallScript();
|
|
290365
290447
|
if (hasCmd("ollama")) {
|
|
290366
290448
|
process.stdout.write(`
|
|
290367
290449
|
${c3.green("\u2714")} Ollama installed successfully.
|
|
@@ -290575,12 +290657,12 @@ function updateOllama() {
|
|
|
290575
290657
|
return false;
|
|
290576
290658
|
}
|
|
290577
290659
|
try {
|
|
290578
|
-
|
|
290579
|
-
stdio: "inherit",
|
|
290580
|
-
timeout: 3e5
|
|
290581
|
-
});
|
|
290660
|
+
runOllamaInstallScript();
|
|
290582
290661
|
return true;
|
|
290583
|
-
} catch {
|
|
290662
|
+
} catch (err) {
|
|
290663
|
+
process.stdout.write(`
|
|
290664
|
+
${c3.red("\u2716")} Ollama update failed: ${err instanceof Error ? err.message : String(err)}
|
|
290665
|
+
`);
|
|
290584
290666
|
return false;
|
|
290585
290667
|
}
|
|
290586
290668
|
}
|
|
@@ -290606,11 +290688,7 @@ function pullModelWithAutoUpdate(tag) {
|
|
|
290606
290688
|
|
|
290607
290689
|
`);
|
|
290608
290690
|
try {
|
|
290609
|
-
|
|
290610
|
-
stdio: "inherit",
|
|
290611
|
-
timeout: 3e5
|
|
290612
|
-
// 5 min max for install
|
|
290613
|
-
});
|
|
290691
|
+
runOllamaInstallScript();
|
|
290614
290692
|
process.stdout.write(`
|
|
290615
290693
|
${c3.green("\u2714")} Ollama updated successfully.
|
|
290616
290694
|
`);
|
|
@@ -301753,6 +301831,38 @@ async function handleUpdate(subcommand, ctx3) {
|
|
|
301753
301831
|
renderInfo("Update mode: manual \u2014 updates only install when you run /update.");
|
|
301754
301832
|
return;
|
|
301755
301833
|
}
|
|
301834
|
+
if (subcommand === "ollama") {
|
|
301835
|
+
const { checkOllamaUpdate: checkOU, updateOllama: doUpdateOllama } = await Promise.resolve().then(() => (init_setup(), setup_exports));
|
|
301836
|
+
let ollamaInfo = null;
|
|
301837
|
+
try {
|
|
301838
|
+
ollamaInfo = await checkOU();
|
|
301839
|
+
} catch {
|
|
301840
|
+
}
|
|
301841
|
+
if (ollamaInfo && !ollamaInfo.needsUpdate) {
|
|
301842
|
+
renderInfo(`Ollama is up to date (${ollamaInfo.current}).`);
|
|
301843
|
+
return;
|
|
301844
|
+
}
|
|
301845
|
+
if (ollamaInfo) {
|
|
301846
|
+
renderInfo(`Updating Ollama: ${ollamaInfo.current} \u2192 ${ollamaInfo.latest}...`);
|
|
301847
|
+
} else {
|
|
301848
|
+
renderInfo("Updating Ollama to the latest version...");
|
|
301849
|
+
}
|
|
301850
|
+
try {
|
|
301851
|
+
if (doUpdateOllama()) {
|
|
301852
|
+
renderInfo("Ollama updated successfully.");
|
|
301853
|
+
try {
|
|
301854
|
+
const { execSync: es } = await import("node:child_process");
|
|
301855
|
+
es("sudo systemctl restart ollama 2>/dev/null || true", { timeout: 1e4, stdio: "pipe" });
|
|
301856
|
+
} catch {
|
|
301857
|
+
}
|
|
301858
|
+
} else {
|
|
301859
|
+
renderError("Ollama update failed. Try manually: curl -fsSL https://ollama.com/install.sh | sh");
|
|
301860
|
+
}
|
|
301861
|
+
} catch (e2) {
|
|
301862
|
+
renderError(`Ollama update error: ${e2 instanceof Error ? e2.message : String(e2)}`);
|
|
301863
|
+
}
|
|
301864
|
+
return;
|
|
301865
|
+
}
|
|
301756
301866
|
let currentVersion = "0.0.0";
|
|
301757
301867
|
try {
|
|
301758
301868
|
const { createRequire: createRequire7 } = await import("node:module");
|
package/package.json
CHANGED