@iola_adm/iola-cli 0.1.48 → 0.1.49

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +17 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iola_adm/iola-cli",
3
- "version": "0.1.48",
3
+ "version": "0.1.49",
4
4
  "description": "CLI и AI-агент городского округа Йошкар-Ола.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/adm-iola/iola-cli#readme",
package/src/cli.js CHANGED
@@ -647,7 +647,13 @@ async function ensureAgentAiReady() {
647
647
  if (readiness.anyReady) {
648
648
  const fallback = getFallbackAiProfile(readiness);
649
649
  if (fallback) {
650
- console.log(`Активный AI-профиль ${readiness.activeProfile} (${readiness.activeProvider}) недоступен. Для текстовых запросов будет использован доступный профиль ${fallback.name} (${fallback.provider}).`);
650
+ const shouldSwitch = await confirm(`Активный AI-профиль ${readiness.activeProfile} (${readiness.activeProvider}) недоступен, найден ${fallback.name} (${fallback.provider}). Переключить активный профиль на ${fallback.name}? [Y/n] `);
651
+ if (shouldSwitch) {
652
+ await setActiveAiProfile(fallback.name, fallback);
653
+ console.log(`Активный AI-профиль: ${fallback.name} (${fallback.provider}, ${fallback.model || "-"})`);
654
+ } else {
655
+ console.log(`Для текстовых запросов будет использован доступный профиль ${fallback.name} (${fallback.provider}).`);
656
+ }
651
657
  return readiness;
652
658
  }
653
659
  }
@@ -744,7 +750,7 @@ async function hasUsableCodexAuth() {
744
750
  }
745
751
 
746
752
  async function startAgentReadline() {
747
- const rl = readline.createInterface({ input, output, prompt: "iola> " });
753
+ const rl = readline.createInterface({ input, output, prompt: "> " });
748
754
  const state = {
749
755
  history: [],
750
756
  };
@@ -835,7 +841,7 @@ async function startAgentRawInput() {
835
841
  render();
836
842
  continue;
837
843
  }
838
- output.write(`iola> ${line}\n`);
844
+ output.write(`> ${line}\n`);
839
845
  try {
840
846
  const shouldExit = await handleAgentLine(line, state);
841
847
  if (shouldExit) break;
@@ -1285,7 +1291,7 @@ function currentSlashMatches(state) {
1285
1291
 
1286
1292
  function renderAgentInput(state) {
1287
1293
  clearAgentInputArea(state);
1288
- const prompt = "iola> ";
1294
+ const prompt = "> ";
1289
1295
  const lines = state.buffer.split("\n");
1290
1296
  const inputLines = [`${prompt}${lines[0] || ""}`, ...lines.slice(1).map((line) => ` ${line}`)];
1291
1297
  const cwdLine = colorMuted(` ${process.cwd()}`);
@@ -4384,6 +4390,13 @@ async function useAiProfile(name) {
4384
4390
  throw new Error(`AI-профиль не найден: ${name}`);
4385
4391
  }
4386
4392
 
4393
+ await setActiveAiProfile(name, profile, config);
4394
+
4395
+ console.log(`Активный AI-профиль: ${name} (${profile.provider}, ${profile.model || "-"})`);
4396
+ }
4397
+
4398
+ async function setActiveAiProfile(name, profile, loadedConfig = null) {
4399
+ const config = loadedConfig || await loadConfig();
4387
4400
  await saveConfig({
4388
4401
  ai: {
4389
4402
  ...config.ai,
@@ -4393,8 +4406,6 @@ async function useAiProfile(name) {
4393
4406
  baseUrl: profile.baseUrl || config.ai.baseUrl,
4394
4407
  },
4395
4408
  });
4396
-
4397
- console.log(`Активный AI-профиль: ${name} (${profile.provider}, ${profile.model || "-"})`);
4398
4409
  }
4399
4410
 
4400
4411
  async function deleteAiProfile(name) {