nolo-cli 0.5.0 → 0.5.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.
Files changed (2) hide show
  1. package/index.js +52 -11
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -109802,18 +109802,20 @@ function renderHistory(output2, history, inputLines) {
109802
109802
  const visibleStart = history.scrollTop;
109803
109803
  const visibleEnd = Math.min(totalLines, visibleStart + visibleHeight);
109804
109804
  const visibleLines = lines.slice(visibleStart, visibleEnd);
109805
+ let frame = "";
109805
109806
  for (let i = 0; i < visibleHeight; i++) {
109806
109807
  const line = visibleLines[i] ?? "";
109807
109808
  const padded = padOrTruncateToWidth(line, contentWidth);
109808
109809
  const thumb = renderScrollbarRow(i, visibleHeight, totalLines, history.scrollTop);
109809
- output2.write(`\x1B[${i + 1};1H`);
109810
- output2.write("\x1B[2K");
109811
- output2.write(padded);
109812
- output2.write(`\x1B[${columns}G`);
109813
- output2.write(thumb);
109810
+ frame += `\x1B[${i + 1};1H`;
109811
+ frame += "\x1B[2K";
109812
+ frame += padded;
109813
+ frame += `\x1B[${columns}G`;
109814
+ frame += thumb;
109814
109815
  }
109815
109816
  const mainBottom = Math.max(1, rows - inputLines);
109816
- output2.write(`\x1B[${mainBottom};1H`);
109817
+ frame += `\x1B[${mainBottom};1H`;
109818
+ output2.write(frame);
109817
109819
  }
109818
109820
  function createHistoryOutputStream(history, onUpdate) {
109819
109821
  return {
@@ -110633,7 +110635,12 @@ async function startTuiWorkspace(options) {
110633
110635
  activityTimer = setInterval(() => {
110634
110636
  activityFrameIndex += 1;
110635
110637
  if (fixedInput.active && !fixedInput.isPaused()) {
110636
- fixedInput.repaint(buffer);
110638
+ output2.write("\x1B[?2026h\x1B[?25l");
110639
+ try {
110640
+ fixedInput.repaint(buffer);
110641
+ } finally {
110642
+ output2.write("\x1B[?25h\x1B[?2026l");
110643
+ }
110637
110644
  }
110638
110645
  }, 150);
110639
110646
  }
@@ -110652,6 +110659,7 @@ async function startTuiWorkspace(options) {
110652
110659
  pause: () => fixedInput.pause(),
110653
110660
  resumeFromDialog: () => {
110654
110661
  fixedInput.resumeFromDialog();
110662
+ flushPendingRender();
110655
110663
  renderHistoryToOutput();
110656
110664
  fixedInput.repaint(buffer);
110657
110665
  },
@@ -110660,6 +110668,36 @@ async function startTuiWorkspace(options) {
110660
110668
  },
110661
110669
  output: output2
110662
110670
  });
110671
+ let renderScheduled = false;
110672
+ let renderTimer = null;
110673
+ const flushPendingRender = () => {
110674
+ if (renderTimer !== null) {
110675
+ clearTimeout(renderTimer);
110676
+ renderTimer = null;
110677
+ }
110678
+ if (!renderScheduled) return;
110679
+ renderScheduled = false;
110680
+ paintSyncedFrame();
110681
+ };
110682
+ const paintSyncedFrame = () => {
110683
+ if (fixedInput.isPaused()) return;
110684
+ output2.write("\x1B[?2026h\x1B[?25l");
110685
+ try {
110686
+ renderHistory(output2, history, fixedInput.getInputLines());
110687
+ if (fixedInput.active) fixedInput.repaint(buffer);
110688
+ } finally {
110689
+ output2.write("\x1B[?25h\x1B[?2026l");
110690
+ }
110691
+ };
110692
+ const scheduleRender = () => {
110693
+ if (renderScheduled) return;
110694
+ renderScheduled = true;
110695
+ renderTimer = setTimeout(() => {
110696
+ renderScheduled = false;
110697
+ renderTimer = null;
110698
+ paintSyncedFrame();
110699
+ }, 0);
110700
+ };
110663
110701
  const renderHistoryToOutput = () => {
110664
110702
  if (fixedInput.isPaused()) return;
110665
110703
  renderHistory(output2, history, fixedInput.getInputLines());
@@ -110693,6 +110731,7 @@ ${t("copyViewHint")}
110693
110731
  copyViewExitResolver = null;
110694
110732
  output2.write("\x1B[2J\x1B[H");
110695
110733
  fixedInput.resumeFromDialog();
110734
+ flushPendingRender();
110696
110735
  renderHistoryToOutput();
110697
110736
  fixedInput.repaint(buffer);
110698
110737
  }
@@ -110707,10 +110746,7 @@ ${t("copyViewHint")}
110707
110746
  if (fixedInput.active) fixedInput.repaint(buffer);
110708
110747
  startTurn(history, "assistant");
110709
110748
  const agentOutput = isInteractiveInput(input2) ? createHistoryOutputStream(history, () => {
110710
- renderHistoryToOutput();
110711
- if (fixedInput.active && !fixedInput.isPaused()) {
110712
- fixedInput.repaint(buffer);
110713
- }
110749
+ scheduleRender();
110714
110750
  }) : output2;
110715
110751
  const requestUserChoice = isInteractiveInput(input2) && dialogHost ? async (req) => {
110716
110752
  const items = req.choices.map((c) => ({
@@ -110760,6 +110796,7 @@ ${t("copyViewHint")}
110760
110796
  explicitAgentSwitch = false;
110761
110797
  if (isInteractiveInput(input2)) {
110762
110798
  finalizeCurrentTurn(history);
110799
+ flushPendingRender();
110763
110800
  renderHistoryToOutput();
110764
110801
  if (fixedInput.active) fixedInput.repaint(buffer);
110765
110802
  }
@@ -111175,6 +111212,7 @@ ${err.message}` : ""}`
111175
111212
  fixedInput.repaint(buffer, cursorPos2);
111176
111213
  return;
111177
111214
  }
111215
+ flushPendingRender();
111178
111216
  paintFrame(buffer);
111179
111217
  };
111180
111218
  const resizeTarget = output2;
@@ -111186,6 +111224,7 @@ ${err.message}` : ""}`
111186
111224
  input2.off("data", onData);
111187
111225
  onData.destroy();
111188
111226
  output2.write("\x1B[?2004l");
111227
+ output2.write("\x1B[?25h\x1B[?2026l");
111189
111228
  input2.setRawMode?.(false);
111190
111229
  };
111191
111230
  const handleInputToken = async (sequence) => {
@@ -111339,6 +111378,7 @@ ${err.message}` : ""}`
111339
111378
  if (drainEnv.NOLO_CLI_GIT_STATUS !== "0") {
111340
111379
  state4 = { ...state4, gitStatus: detectGitStatus(state4.cwd) };
111341
111380
  }
111381
+ flushPendingRender();
111342
111382
  fixedInput.exitOutputMode(buffer, cursorPos2);
111343
111383
  return;
111344
111384
  }
@@ -111384,6 +111424,7 @@ ${err.message}` : ""}`
111384
111424
  if (refreshEnv.NOLO_CLI_GIT_STATUS !== "0") {
111385
111425
  state4 = { ...state4, gitStatus: detectGitStatus(state4.cwd) };
111386
111426
  }
111427
+ flushPendingRender();
111387
111428
  fixedInput.exitOutputMode(buffer, cursorPos2);
111388
111429
  return;
111389
111430
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nolo-cli",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "type": "module",
5
5
  "description": "Agent-first terminal workspace for Nolo",
6
6
  "bin": {