open-agents-ai 0.35.1 → 0.35.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 +36 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -18543,31 +18543,47 @@ async function handleUpdate(subcommand, ctx) {
|
|
|
18543
18543
|
}
|
|
18544
18544
|
} catch {
|
|
18545
18545
|
}
|
|
18546
|
-
|
|
18547
|
-
|
|
18546
|
+
const BRAILLE_CYCLE = ["\u2800", "\u2840", "\u28C0", "\u28C4", "\u28E4", "\u28E6", "\u28F6", "\u28F7", "\u28FF", "\u28F7", "\u28F6", "\u28E6", "\u28E4", "\u28C4", "\u28C0", "\u2840"];
|
|
18547
|
+
function startInlineSpinner(prefix) {
|
|
18548
|
+
let frame = 0;
|
|
18549
|
+
const timer = setInterval(() => {
|
|
18550
|
+
const braille = BRAILLE_CYCLE[frame % BRAILLE_CYCLE.length];
|
|
18551
|
+
process.stdout.write(`\r ${c2.cyan("\u25CF")} ${prefix} ${c2.cyan(braille)}`);
|
|
18552
|
+
frame++;
|
|
18553
|
+
}, 80);
|
|
18554
|
+
process.stdout.write(` ${c2.cyan("\u25CF")} ${prefix} ${c2.cyan(BRAILLE_CYCLE[0])}`);
|
|
18555
|
+
return {
|
|
18556
|
+
stop(completionText) {
|
|
18557
|
+
clearInterval(timer);
|
|
18558
|
+
process.stdout.write(`\r ${c2.green("\u2714")} ${completionText}${" ".repeat(20)}
|
|
18548
18559
|
`);
|
|
18560
|
+
}
|
|
18561
|
+
};
|
|
18562
|
+
}
|
|
18563
|
+
process.stdout.write("\n");
|
|
18564
|
+
const checkSpinner = startInlineSpinner(`Checking for updates ${c2.dim(`(current: v${currentVersion})`)}`);
|
|
18549
18565
|
const info = await checkForUpdate(currentVersion, true);
|
|
18550
18566
|
if (!info) {
|
|
18551
|
-
|
|
18552
|
-
|
|
18553
|
-
`);
|
|
18567
|
+
checkSpinner.stop(`You're on the latest version (v${currentVersion}).`);
|
|
18568
|
+
process.stdout.write("\n");
|
|
18554
18569
|
return;
|
|
18555
18570
|
}
|
|
18556
|
-
|
|
18557
|
-
|
|
18558
|
-
|
|
18559
|
-
|
|
18560
|
-
`);
|
|
18561
|
-
|
|
18562
|
-
|
|
18563
|
-
|
|
18564
|
-
|
|
18565
|
-
|
|
18571
|
+
checkSpinner.stop(`Update available: v${info.currentVersion} \u2192 v${c2.bold(c2.green(info.latestVersion))}`);
|
|
18572
|
+
const installSpinner = startInlineSpinner("Installing update");
|
|
18573
|
+
const { exec } = await import("node:child_process");
|
|
18574
|
+
const installOk = await new Promise((resolve23) => {
|
|
18575
|
+
const child = exec(`npm cache clean --force open-agents-ai 2>/dev/null; npm install -g open-agents-ai@latest --force`, { timeout: 18e4 }, (err) => resolve23(!err));
|
|
18576
|
+
child.stdout?.resume();
|
|
18577
|
+
child.stderr?.resume();
|
|
18578
|
+
});
|
|
18579
|
+
if (!installOk) {
|
|
18580
|
+
installSpinner.stop("Update install failed.");
|
|
18581
|
+
renderWarning("Try manually: npm i -g open-agents-ai");
|
|
18566
18582
|
return;
|
|
18567
18583
|
}
|
|
18568
|
-
|
|
18569
|
-
|
|
18570
|
-
|
|
18584
|
+
installSpinner.stop(`Update installed (v${info.latestVersion}).`);
|
|
18585
|
+
const reloadSpinner = startInlineSpinner("Loading");
|
|
18586
|
+
await new Promise((r) => setTimeout(r, 400));
|
|
18571
18587
|
ctx.contextSave?.();
|
|
18572
18588
|
const hadActiveTask = ctx.savePendingTaskState?.() ?? false;
|
|
18573
18589
|
const resumeFlag = hadActiveTask ? "1" : "update-only";
|
|
@@ -18580,7 +18596,8 @@ async function handleUpdate(subcommand, ctx) {
|
|
|
18580
18596
|
env: { ...process.env, __OA_RESUMED: resumeFlag }
|
|
18581
18597
|
});
|
|
18582
18598
|
} catch {
|
|
18583
|
-
|
|
18599
|
+
reloadSpinner.stop("Reload failed.");
|
|
18600
|
+
renderWarning("Restart oa manually to use the new version.");
|
|
18584
18601
|
}
|
|
18585
18602
|
}
|
|
18586
18603
|
async function switchModel(query, ctx, local = false) {
|
package/package.json
CHANGED