@lazyingart/agintiflow 0.20.16 → 0.20.17
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 +8 -0
- package/src/interactive-cli.js +33 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lazyingart/agintiflow",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.17",
|
|
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",
|
|
@@ -6,6 +6,7 @@ import path from "node:path";
|
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
import {
|
|
8
8
|
buildLaunchHeaderLines,
|
|
9
|
+
formatCommittedUserPromptLines,
|
|
9
10
|
buildPromptLayout,
|
|
10
11
|
buildPromptRenderSequence,
|
|
11
12
|
canonicalSlashPromptBuffer,
|
|
@@ -173,6 +174,12 @@ try {
|
|
|
173
174
|
) {
|
|
174
175
|
throw new Error("terminal prompt layout did not render visual-only input padding safely");
|
|
175
176
|
}
|
|
177
|
+
const committedUserText = formatCommittedUserPromptLines("list files", 90)
|
|
178
|
+
.map((line) => line.replace(/\x1b\[[0-9;?]*[ -/]*[@-~]/g, ""))
|
|
179
|
+
.join("\n");
|
|
180
|
+
if (!committedUserText.includes("user> list files") || committedUserText.includes("cwd")) {
|
|
181
|
+
throw new Error("committed user history should not include the live cwd footer");
|
|
182
|
+
}
|
|
176
183
|
const zhPromptLayout = buildPromptLayout("", 0, 90, 24, { language: "zh-Hans", commandCwd: "/tmp/aginti-project" });
|
|
177
184
|
const zhPromptText = zhPromptLayout.renderedRows.map((line) => line.replace(/\x1b\[[0-9;?]*[ -/]*[@-~]/g, "")).join("\n");
|
|
178
185
|
if (!zhPromptText.includes("输入任务")) {
|
|
@@ -317,6 +324,7 @@ try {
|
|
|
317
324
|
"large-launch-header",
|
|
318
325
|
"prompt-layout",
|
|
319
326
|
"prompt-redraw-fast-path",
|
|
327
|
+
"committed-user-no-cwd-footer",
|
|
320
328
|
"cli-i18n",
|
|
321
329
|
"user-prompt-label",
|
|
322
330
|
"escape-policy",
|
package/src/interactive-cli.js
CHANGED
|
@@ -910,10 +910,30 @@ function renderPromptBuffer(buffer, cursor, previous = { lineCount: 0, cursorRow
|
|
|
910
910
|
};
|
|
911
911
|
}
|
|
912
912
|
|
|
913
|
-
function
|
|
914
|
-
const
|
|
915
|
-
|
|
916
|
-
|
|
913
|
+
export function formatCommittedUserPromptLines(text = "", width = terminalWidth()) {
|
|
914
|
+
const safeText = String(text || "");
|
|
915
|
+
const lineWidth = editorWidth(width);
|
|
916
|
+
const firstPrefix = labelText("user>", { prompt: true });
|
|
917
|
+
const nextPrefix = labelText("...", { prompt: true });
|
|
918
|
+
const rows = [];
|
|
919
|
+
const sourceLines = safeText.split(/\r?\n/);
|
|
920
|
+
|
|
921
|
+
for (const [lineIndex, sourceLine] of sourceLines.entries()) {
|
|
922
|
+
const prefix = lineIndex === 0 ? firstPrefix : nextPrefix;
|
|
923
|
+
const innerWidth = Math.max(lineWidth - prefix.length, 8);
|
|
924
|
+
const wrapped = wrapTextLine(sourceLine, innerWidth);
|
|
925
|
+
const chunks = wrapped.length > 0 ? wrapped : [""];
|
|
926
|
+
for (const [chunkIndex, chunk] of chunks.entries()) {
|
|
927
|
+
const rowPrefix = lineIndex === 0 && chunkIndex === 0 ? firstPrefix : nextPrefix;
|
|
928
|
+
rows.push(panelLine(`${rowPrefix}${chunk}`, ansi.userBg, lineWidth));
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
return rows.length > 0 ? rows : [panelLine(firstPrefix, ansi.userBg, lineWidth)];
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
function printCommittedUserInput(text = "") {
|
|
936
|
+
for (const line of formatCommittedUserPromptLines(text)) outputLine(line);
|
|
917
937
|
}
|
|
918
938
|
|
|
919
939
|
function lineBounds(buffer, cursor) {
|
|
@@ -973,6 +993,12 @@ function readTtyPrompt(options = {}) {
|
|
|
973
993
|
let suggestionAnchor = "";
|
|
974
994
|
let suggestionIndex = 0;
|
|
975
995
|
|
|
996
|
+
const clearPromptPanel = () => {
|
|
997
|
+
if (!rendered.lineCount) return;
|
|
998
|
+
clearRenderedPrompt(rendered);
|
|
999
|
+
rendered = { lineCount: 0, cursorRow: 0, renderedRows: [] };
|
|
1000
|
+
};
|
|
1001
|
+
|
|
976
1002
|
const cleanup = () => {
|
|
977
1003
|
if (redrawHandle) {
|
|
978
1004
|
clearImmediate(redrawHandle);
|
|
@@ -1012,10 +1038,9 @@ function readTtyPrompt(options = {}) {
|
|
|
1012
1038
|
buffer = canonical;
|
|
1013
1039
|
cursor = buffer.length;
|
|
1014
1040
|
}
|
|
1015
|
-
|
|
1016
|
-
moveToPromptBottom(rendered);
|
|
1041
|
+
clearPromptPanel();
|
|
1017
1042
|
cleanup();
|
|
1018
|
-
|
|
1043
|
+
printCommittedUserInput(buffer);
|
|
1019
1044
|
const saved = buffer.trim();
|
|
1020
1045
|
if (saved && promptHistory[promptHistory.length - 1] !== buffer) promptHistory.push(buffer);
|
|
1021
1046
|
resolve(buffer);
|
|
@@ -1078,10 +1103,8 @@ function readTtyPrompt(options = {}) {
|
|
|
1078
1103
|
|
|
1079
1104
|
const handler = (str = "", key = {}) => {
|
|
1080
1105
|
if (key.ctrl && key.name === "c") {
|
|
1081
|
-
|
|
1082
|
-
moveToPromptBottom(rendered);
|
|
1106
|
+
clearPromptPanel();
|
|
1083
1107
|
cleanup();
|
|
1084
|
-
output.write("\n");
|
|
1085
1108
|
reject(createAbortError());
|
|
1086
1109
|
return;
|
|
1087
1110
|
}
|