@iola_adm/iola-cli 0.1.77 → 0.1.78

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 +7 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iola_adm/iola-cli",
3
- "version": "0.1.77",
3
+ "version": "0.1.78",
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
@@ -774,7 +774,7 @@ async function startAgentReadline() {
774
774
  }
775
775
 
776
776
  async function startAgentRawInput() {
777
- const state = { history: [], buffer: "", selected: 0, slashOffset: 0, slashOpen: false, running: false, renderedInputLines: 0, renderedLines: 0, rawMode: true, pendingOutput: "", aiStatus: null };
777
+ const state = { history: [], buffer: "", selected: 0, slashOffset: 0, slashOpen: false, running: false, renderedInputLines: 0, renderedLines: 0, cursorRowsBelow: 0, rawMode: true, pendingOutput: "", aiStatus: null };
778
778
  const wasRaw = input.isRaw;
779
779
  activateRawInput(input);
780
780
 
@@ -1331,7 +1331,8 @@ function renderAgentInput(state) {
1331
1331
  const renderedLines = [...inputLines, "", ...menuLines, cwdLine];
1332
1332
  output.write(renderedLines.join("\n"));
1333
1333
  if (output.isTTY) {
1334
- output.write(`\x1b[${2 + menuLines.length}A`);
1334
+ state.cursorRowsBelow = 2 + menuLines.length;
1335
+ output.write(`\x1b[${state.cursorRowsBelow}A`);
1335
1336
  }
1336
1337
  if (output.isTTY) {
1337
1338
  const cursorColumn = visibleLength(inputLines[inputLines.length - 1]);
@@ -1339,16 +1340,20 @@ function renderAgentInput(state) {
1339
1340
  }
1340
1341
  state.renderedInputLines = inputLines.length;
1341
1342
  state.renderedLines = renderedLines.length;
1343
+ if (!output.isTTY) state.cursorRowsBelow = 0;
1342
1344
  }
1343
1345
 
1344
1346
  function clearAgentInputArea(state = null) {
1345
1347
  if (!output.isTTY) return;
1346
1348
  const renderedLines = Math.max(1, Number(state?.renderedLines || state?.renderedInputLines || 1));
1349
+ const cursorRowsBelow = Math.max(0, Number(state?.cursorRowsBelow || 0));
1350
+ if (cursorRowsBelow > 0) output.write(`\x1b[${cursorRowsBelow}B`);
1347
1351
  if (renderedLines > 1) output.write(`\x1b[${renderedLines - 1}A`);
1348
1352
  output.write("\r\x1b[0J");
1349
1353
  if (state) {
1350
1354
  state.renderedInputLines = 0;
1351
1355
  state.renderedLines = 0;
1356
+ state.cursorRowsBelow = 0;
1352
1357
  }
1353
1358
  }
1354
1359