@lazyingart/agintiflow 0.20.6 → 0.20.7
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/scripts/smoke-cli-chat.js +12 -0
- package/src/interactive-cli.js +45 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lazyingart/agintiflow",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AgInTiFlow is a web-first coding agent and CLI with DeepSeek routing, sandboxed tools, model providers, canvas artifacts, and optional wrappers.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -7,6 +7,7 @@ import { fileURLToPath } from "node:url";
|
|
|
7
7
|
import {
|
|
8
8
|
buildLaunchHeaderLines,
|
|
9
9
|
buildPromptLayout,
|
|
10
|
+
buildPromptRenderSequence,
|
|
10
11
|
canonicalSlashPromptBuffer,
|
|
11
12
|
classifyEscapeAction,
|
|
12
13
|
formatWorkspaceChange,
|
|
@@ -131,6 +132,16 @@ try {
|
|
|
131
132
|
if (promptLayout.cursorRow < 0 || promptLayout.cursorColumn < 0) {
|
|
132
133
|
throw new Error("terminal prompt layout returned an invalid cursor location");
|
|
133
134
|
}
|
|
135
|
+
const promptCursorMoveBefore = buildPromptLayout("smooth typing", 13, 90, 24, { commandCwd: "/tmp/aginti-project" });
|
|
136
|
+
const promptCursorMoveAfter = buildPromptLayout("smooth typing", 4, 90, 24, { commandCwd: "/tmp/aginti-project" });
|
|
137
|
+
const cursorOnlySequence = buildPromptRenderSequence(promptCursorMoveAfter, {
|
|
138
|
+
lineCount: promptCursorMoveBefore.renderedRows.length,
|
|
139
|
+
cursorRow: promptCursorMoveBefore.cursorRow,
|
|
140
|
+
renderedRows: promptCursorMoveBefore.renderedRows,
|
|
141
|
+
});
|
|
142
|
+
if (cursorOnlySequence.includes("\x1b[2K") || cursorOnlySequence.includes("\x1b[?25l")) {
|
|
143
|
+
throw new Error("cursor-only prompt moves should not clear/redraw the input panel");
|
|
144
|
+
}
|
|
134
145
|
const paddedPromptLayout = buildPromptLayout("hello", 5, 80, 24, { commandCwd: "/tmp/aginti-project" });
|
|
135
146
|
const paddedRows = paddedPromptLayout.renderedRows.map((line) => line.replace(/\x1b\[[0-9;?]*[ -/]*[@-~]/g, ""));
|
|
136
147
|
if (
|
|
@@ -271,6 +282,7 @@ try {
|
|
|
271
282
|
"workspace-patch-event-render",
|
|
272
283
|
"large-launch-header",
|
|
273
284
|
"prompt-layout",
|
|
285
|
+
"prompt-redraw-fast-path",
|
|
274
286
|
"user-prompt-label",
|
|
275
287
|
"escape-policy",
|
|
276
288
|
"live-input-status-layout",
|
package/src/interactive-cli.js
CHANGED
|
@@ -832,24 +832,58 @@ function cursorLocation(layout, cursor) {
|
|
|
832
832
|
|
|
833
833
|
function clearRenderedPrompt(previous) {
|
|
834
834
|
if (!previous.lineCount) return;
|
|
835
|
+
let sequence = ansi.cursorHide;
|
|
835
836
|
const below = previous.lineCount - 1 - previous.cursorRow;
|
|
836
|
-
if (below > 0)
|
|
837
|
-
|
|
837
|
+
if (below > 0) sequence += `\x1b[${below}B`;
|
|
838
|
+
sequence += `\r${ansi.clearLine}`;
|
|
838
839
|
for (let index = 1; index < previous.lineCount; index += 1) {
|
|
839
|
-
|
|
840
|
+
sequence += `\x1b[1A\r${ansi.clearLine}`;
|
|
841
|
+
}
|
|
842
|
+
sequence += ansi.cursorShow;
|
|
843
|
+
output.write(sequence);
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
function renderedRowsEqual(left = [], right = []) {
|
|
847
|
+
if (left.length !== right.length) return false;
|
|
848
|
+
return left.every((line, index) => line === right[index]);
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
export function buildPromptRenderSequence(layout, previous = { lineCount: 0, cursorRow: 0, renderedRows: [] }) {
|
|
852
|
+
const previousRows = Array.isArray(previous.renderedRows) ? previous.renderedRows : [];
|
|
853
|
+
const previousLineCount = Number(previous.lineCount) || 0;
|
|
854
|
+
const previousCursorRow = Number(previous.cursorRow) || 0;
|
|
855
|
+
const nextRows = layout.renderedRows || [];
|
|
856
|
+
|
|
857
|
+
if (previousLineCount > 0 && renderedRowsEqual(previousRows, nextRows)) {
|
|
858
|
+
const rowDelta = layout.cursorRow - previousCursorRow;
|
|
859
|
+
return `${rowDelta > 0 ? `\x1b[${rowDelta}B` : rowDelta < 0 ? `\x1b[${Math.abs(rowDelta)}A` : ""}\r\x1b[${
|
|
860
|
+
layout.cursorColumn + 1
|
|
861
|
+
}G`;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
let sequence = ansi.cursorHide;
|
|
865
|
+
if (previousLineCount > 0) {
|
|
866
|
+
const below = Math.max(previousLineCount - 1 - previousCursorRow, 0);
|
|
867
|
+
if (below > 0) sequence += `\x1b[${below}B`;
|
|
868
|
+
sequence += "\r";
|
|
869
|
+
if (previousLineCount > 1) sequence += `\x1b[${previousLineCount - 1}A`;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
const lineCount = Math.max(previousLineCount, nextRows.length);
|
|
873
|
+
for (let index = 0; index < lineCount; index += 1) {
|
|
874
|
+
sequence += `\r${ansi.clearLine}${nextRows[index] || ""}`;
|
|
875
|
+
if (index < lineCount - 1) sequence += "\n";
|
|
840
876
|
}
|
|
877
|
+
|
|
878
|
+
const cursorUp = Math.max(lineCount - 1 - layout.cursorRow, 0);
|
|
879
|
+
if (cursorUp > 0) sequence += `\x1b[${cursorUp}A`;
|
|
880
|
+
sequence += `\r\x1b[${layout.cursorColumn + 1}G${ansi.cursorShow}`;
|
|
881
|
+
return sequence;
|
|
841
882
|
}
|
|
842
883
|
|
|
843
884
|
function renderPromptBuffer(buffer, cursor, previous = { lineCount: 0, cursorRow: 0, renderedRows: [] }, options = {}) {
|
|
844
885
|
const layout = buildPromptLayout(buffer, cursor, terminalWidth(), terminalHeight(), options);
|
|
845
|
-
output.write(
|
|
846
|
-
clearRenderedPrompt(previous);
|
|
847
|
-
output.write(layout.renderedRows.join("\n"));
|
|
848
|
-
|
|
849
|
-
const below = layout.renderedRows.length - 1 - layout.cursorRow;
|
|
850
|
-
if (below > 0) output.write(`\x1b[${below}A`);
|
|
851
|
-
output.write(`\r\x1b[${layout.cursorColumn + 1}G`);
|
|
852
|
-
output.write(ansi.cursorShow);
|
|
886
|
+
output.write(buildPromptRenderSequence(layout, previous));
|
|
853
887
|
return {
|
|
854
888
|
lineCount: layout.renderedRows.length,
|
|
855
889
|
cursorRow: layout.cursorRow,
|