open-agents-ai 0.11.1 → 0.11.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 +66 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -302,6 +302,17 @@ function performUpdate() {
|
|
|
302
302
|
return false;
|
|
303
303
|
}
|
|
304
304
|
}
|
|
305
|
+
function performSilentUpdate() {
|
|
306
|
+
try {
|
|
307
|
+
execSync(`npm install -g ${PACKAGE_NAME}@latest`, {
|
|
308
|
+
stdio: "pipe",
|
|
309
|
+
timeout: 12e4
|
|
310
|
+
});
|
|
311
|
+
return true;
|
|
312
|
+
} catch {
|
|
313
|
+
return false;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
305
316
|
function restartProcess() {
|
|
306
317
|
const args = process.argv.slice(1);
|
|
307
318
|
try {
|
|
@@ -9711,6 +9722,10 @@ function startTask(task, config, repoRoot, voice) {
|
|
|
9711
9722
|
}
|
|
9712
9723
|
async function startInteractive(config, repoPath) {
|
|
9713
9724
|
const repoRoot = resolve11(repoPath ?? cwd());
|
|
9725
|
+
const isResumed = !!process.env.__OA_RESUMED;
|
|
9726
|
+
if (isResumed) {
|
|
9727
|
+
delete process.env.__OA_RESUMED;
|
|
9728
|
+
}
|
|
9714
9729
|
initOaDirectory(repoRoot);
|
|
9715
9730
|
const savedSettings = resolveSettings(repoRoot);
|
|
9716
9731
|
if (savedSettings.model)
|
|
@@ -9724,30 +9739,37 @@ async function startInteractive(config, repoPath) {
|
|
|
9724
9739
|
config = { ...config, apiKey: savedSettings.apiKey };
|
|
9725
9740
|
if (savedSettings.verbose !== void 0)
|
|
9726
9741
|
config = { ...config, verbose: savedSettings.verbose };
|
|
9727
|
-
|
|
9728
|
-
|
|
9729
|
-
|
|
9730
|
-
|
|
9731
|
-
|
|
9742
|
+
if (!isResumed) {
|
|
9743
|
+
const needsSetup = isFirstRun() || !await isModelAvailable(config);
|
|
9744
|
+
if (needsSetup && config.backendType === "ollama") {
|
|
9745
|
+
const setupModel = await runSetupWizard(config);
|
|
9746
|
+
if (setupModel === null) {
|
|
9747
|
+
process.exit(0);
|
|
9748
|
+
}
|
|
9749
|
+
config = { ...config, model: setupModel };
|
|
9732
9750
|
}
|
|
9733
|
-
config = { ...config, model: setupModel };
|
|
9734
9751
|
}
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
9741
|
-
|
|
9742
|
-
|
|
9743
|
-
|
|
9752
|
+
if (!isResumed) {
|
|
9753
|
+
try {
|
|
9754
|
+
const healthUrl = config.backendType === "ollama" ? `${config.backendUrl}/api/tags` : `${config.backendUrl}/v1/models`;
|
|
9755
|
+
const resp = await fetch(healthUrl, { signal: AbortSignal.timeout(1e4) });
|
|
9756
|
+
if (!resp.ok)
|
|
9757
|
+
throw new Error(`HTTP ${resp.status}`);
|
|
9758
|
+
} catch {
|
|
9759
|
+
renderError(`Cannot reach ${config.backendType} at ${config.backendUrl}`);
|
|
9760
|
+
if (config.backendType === "ollama") {
|
|
9761
|
+
renderInfo("Start Ollama with: ollama serve");
|
|
9762
|
+
}
|
|
9763
|
+
renderInfo("Use /endpoint to configure a different backend.");
|
|
9764
|
+
process.exit(1);
|
|
9744
9765
|
}
|
|
9745
|
-
renderInfo("Use /endpoint to configure a different backend.");
|
|
9746
|
-
process.exit(1);
|
|
9747
9766
|
}
|
|
9748
9767
|
process.stdout.write("\x1B[2J\x1B[H");
|
|
9749
9768
|
const carousel = new Carousel();
|
|
9750
|
-
|
|
9769
|
+
let carouselLines = 0;
|
|
9770
|
+
if (!isResumed) {
|
|
9771
|
+
carouselLines = carousel.start();
|
|
9772
|
+
}
|
|
9751
9773
|
const version = getVersion();
|
|
9752
9774
|
renderRichHeader({
|
|
9753
9775
|
model: config.model,
|
|
@@ -9755,6 +9777,10 @@ async function startInteractive(config, repoPath) {
|
|
|
9755
9777
|
workspace: repoRoot,
|
|
9756
9778
|
carouselLines
|
|
9757
9779
|
});
|
|
9780
|
+
if (isResumed) {
|
|
9781
|
+
renderInfo(`Auto-updated to v${version} \u2014 session resumed.
|
|
9782
|
+
`);
|
|
9783
|
+
}
|
|
9758
9784
|
const voiceEngine = new VoiceEngine();
|
|
9759
9785
|
if (savedSettings.voice) {
|
|
9760
9786
|
voiceEngine.toggle().catch(() => {
|
|
@@ -9767,7 +9793,7 @@ async function startInteractive(config, repoPath) {
|
|
|
9767
9793
|
let currentConfig = { ...config };
|
|
9768
9794
|
let activeTask = null;
|
|
9769
9795
|
let messageQueue = [];
|
|
9770
|
-
let carouselRetired =
|
|
9796
|
+
let carouselRetired = isResumed;
|
|
9771
9797
|
const idlePrompt = `${c2.bold(c2.blue("> "))}`;
|
|
9772
9798
|
const activePrompt = `${c2.dim(c2.cyan("+ "))}`;
|
|
9773
9799
|
const rl = readline2.createInterface({
|
|
@@ -9909,6 +9935,26 @@ ${c2.dim("Goodbye!")}
|
|
|
9909
9935
|
} finally {
|
|
9910
9936
|
activeTask = null;
|
|
9911
9937
|
}
|
|
9938
|
+
try {
|
|
9939
|
+
const updateInfo = await checkForUpdate(version);
|
|
9940
|
+
if (updateInfo) {
|
|
9941
|
+
renderInfo(`Update available: v${version} \u2192 v${updateInfo.latestVersion}. Installing...`);
|
|
9942
|
+
const ok = performSilentUpdate();
|
|
9943
|
+
if (ok) {
|
|
9944
|
+
renderInfo(`Updated to v${updateInfo.latestVersion}. Reloading...
|
|
9945
|
+
`);
|
|
9946
|
+
process.env.__OA_RESUMED = "1";
|
|
9947
|
+
if (carousel.isRunning)
|
|
9948
|
+
carousel.stop();
|
|
9949
|
+
voiceEngine.dispose();
|
|
9950
|
+
rl.close();
|
|
9951
|
+
restartProcess();
|
|
9952
|
+
} else {
|
|
9953
|
+
renderWarning("Auto-update failed. Use /update to retry manually.");
|
|
9954
|
+
}
|
|
9955
|
+
}
|
|
9956
|
+
} catch {
|
|
9957
|
+
}
|
|
9912
9958
|
showPrompt();
|
|
9913
9959
|
});
|
|
9914
9960
|
rl.on("close", () => {
|
|
@@ -9968,6 +10014,7 @@ var init_interactive = __esm({
|
|
|
9968
10014
|
"use strict";
|
|
9969
10015
|
init_dist5();
|
|
9970
10016
|
init_dist2();
|
|
10017
|
+
init_updater();
|
|
9971
10018
|
init_commands();
|
|
9972
10019
|
init_setup();
|
|
9973
10020
|
init_project_context();
|
package/package.json
CHANGED