@iola_adm/iola-cli 0.1.56 → 0.1.57
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/package.json +1 -1
- package/src/cli.js +51 -8
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -848,13 +848,16 @@ async function startAgentRawInput() {
|
|
|
848
848
|
}
|
|
849
849
|
output.write(`> ${line}\n`);
|
|
850
850
|
const stopActivity = line.startsWith("/") ? () => {} : startActivityIndicator("работаю");
|
|
851
|
+
const restoreRawInput = line.startsWith("/") ? suspendRawInputForCommand(input) : () => {};
|
|
851
852
|
try {
|
|
852
853
|
const shouldExit = await handleAgentLine(line, state);
|
|
853
854
|
stopActivity();
|
|
854
855
|
flushPendingAgentOutput(state);
|
|
856
|
+
if (!shouldExit) restoreRawInput();
|
|
855
857
|
if (shouldExit) break;
|
|
856
858
|
} catch (error) {
|
|
857
859
|
stopActivity();
|
|
860
|
+
restoreRawInput();
|
|
858
861
|
console.error(error instanceof Error ? error.message : String(error));
|
|
859
862
|
}
|
|
860
863
|
render();
|
|
@@ -1370,6 +1373,17 @@ function startActivityIndicator(label = "работаю") {
|
|
|
1370
1373
|
};
|
|
1371
1374
|
}
|
|
1372
1375
|
|
|
1376
|
+
function suspendRawInputForCommand(stream) {
|
|
1377
|
+
if (!stream.isTTY || !stream.isRaw) return () => {};
|
|
1378
|
+
stream.setRawMode(false);
|
|
1379
|
+
return () => {
|
|
1380
|
+
if (stream.isTTY) {
|
|
1381
|
+
stream.setRawMode(true);
|
|
1382
|
+
stream.resume();
|
|
1383
|
+
}
|
|
1384
|
+
};
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1373
1387
|
function flushPendingAgentOutput(state) {
|
|
1374
1388
|
const text = state.pendingOutput;
|
|
1375
1389
|
state.pendingOutput = "";
|
|
@@ -5886,27 +5900,29 @@ async function setupOllama(args) {
|
|
|
5886
5900
|
const diagnostics = await getLocalDiagnostics();
|
|
5887
5901
|
const recommendation = recommendOllamaModel(diagnostics);
|
|
5888
5902
|
const model = options.model || recommendation.model;
|
|
5903
|
+
const ollamaCommand = await resolveOllamaCommand();
|
|
5889
5904
|
|
|
5890
5905
|
printDiagnostics(diagnostics, { ...recommendation, model });
|
|
5891
5906
|
|
|
5892
|
-
if (!
|
|
5907
|
+
if (!ollamaCommand) {
|
|
5893
5908
|
console.log("");
|
|
5894
|
-
console.log("Ollama не
|
|
5895
|
-
console.log("
|
|
5909
|
+
console.log("Ollama не найден или команда пока недоступна в текущем терминале.");
|
|
5910
|
+
console.log("Если Ollama только что установлена, откройте новый PowerShell или повторите после обновления PATH:");
|
|
5911
|
+
console.log(" iola master");
|
|
5896
5912
|
console.log("");
|
|
5897
5913
|
console.log("Windows:");
|
|
5898
|
-
console.log("
|
|
5914
|
+
console.log(" $env:Path += ';' + \"$env:LOCALAPPDATA\\Programs\\Ollama\"");
|
|
5899
5915
|
console.log("macOS:");
|
|
5900
|
-
console.log(" brew install --cask ollama");
|
|
5916
|
+
console.log(" перезапустите терминал после brew install --cask ollama");
|
|
5901
5917
|
console.log("Linux:");
|
|
5902
|
-
console.log("
|
|
5918
|
+
console.log(" проверьте /usr/local/bin/ollama");
|
|
5903
5919
|
return;
|
|
5904
5920
|
}
|
|
5905
5921
|
|
|
5906
5922
|
const shouldInstall = options.yes || (await confirm(`Установить модель ${model} через "ollama pull ${model}"? [Y/n] `));
|
|
5907
5923
|
|
|
5908
5924
|
if (shouldInstall) {
|
|
5909
|
-
await runCommand(
|
|
5925
|
+
await runCommand(ollamaCommand, ["pull", model], { inherit: true });
|
|
5910
5926
|
}
|
|
5911
5927
|
|
|
5912
5928
|
const config = await loadConfig();
|
|
@@ -7329,14 +7345,38 @@ async function getWindowsGpu() {
|
|
|
7329
7345
|
}
|
|
7330
7346
|
|
|
7331
7347
|
async function getOllamaVersion() {
|
|
7348
|
+
const command = await resolveOllamaCommand();
|
|
7349
|
+
if (!command) return null;
|
|
7332
7350
|
try {
|
|
7333
|
-
const { stdout } = await runCommand(
|
|
7351
|
+
const { stdout } = await runCommand(command, ["--version"]);
|
|
7334
7352
|
return stdout.trim();
|
|
7335
7353
|
} catch {
|
|
7336
7354
|
return null;
|
|
7337
7355
|
}
|
|
7338
7356
|
}
|
|
7339
7357
|
|
|
7358
|
+
async function resolveOllamaCommand() {
|
|
7359
|
+
const candidates = ["ollama"];
|
|
7360
|
+
if (process.platform === "win32") {
|
|
7361
|
+
candidates.push(
|
|
7362
|
+
path.join(os.homedir(), "AppData", "Local", "Programs", "Ollama", "ollama.exe"),
|
|
7363
|
+
path.join(process.env.LOCALAPPDATA || "", "Programs", "Ollama", "ollama.exe"),
|
|
7364
|
+
);
|
|
7365
|
+
} else {
|
|
7366
|
+
candidates.push("/usr/local/bin/ollama", "/opt/homebrew/bin/ollama", "/usr/bin/ollama");
|
|
7367
|
+
}
|
|
7368
|
+
for (const command of [...new Set(candidates.filter(Boolean))]) {
|
|
7369
|
+
try {
|
|
7370
|
+
if (command !== "ollama" && !existsSync(command)) continue;
|
|
7371
|
+
await runCommand(command, ["--version"]);
|
|
7372
|
+
return command;
|
|
7373
|
+
} catch {
|
|
7374
|
+
// Try next candidate.
|
|
7375
|
+
}
|
|
7376
|
+
}
|
|
7377
|
+
return null;
|
|
7378
|
+
}
|
|
7379
|
+
|
|
7340
7380
|
async function getCommandVersion(command, args) {
|
|
7341
7381
|
try {
|
|
7342
7382
|
const { stdout } = await runCommand(command, args);
|
|
@@ -7406,6 +7446,9 @@ async function installOllamaIfMissing() {
|
|
|
7406
7446
|
return;
|
|
7407
7447
|
}
|
|
7408
7448
|
await runCommand("sh", ["-c", "curl -fsSL https://ollama.com/install.sh | sh"], { inherit: true });
|
|
7449
|
+
if (!(await getOllamaVersion())) {
|
|
7450
|
+
console.log("Ollama установлен, но текущий терминал может еще не видеть команду. CLI попробует стандартный путь установки.");
|
|
7451
|
+
}
|
|
7409
7452
|
}
|
|
7410
7453
|
|
|
7411
7454
|
async function installCodexIfMissing() {
|