dsh-neotui 0.0.26 → 0.0.28
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/src/views.js +3 -37
package/package.json
CHANGED
package/src/views.js
CHANGED
|
@@ -565,8 +565,6 @@ export class ChatView extends Widget {
|
|
|
565
565
|
this.expanded = new Set(); // node indexes (user-message full text)
|
|
566
566
|
this.expandedTools = new Set();
|
|
567
567
|
this.collapsedBlocks = new Set(); // per-block COLLAPSE (default expanded): `${realIdx}:${bi}`
|
|
568
|
-
this.blockHeights = new Map(); // collapsed block → its rendered height when collapsed
|
|
569
|
-
// (fixed-height fold: the space below stays put)
|
|
570
568
|
this.thinkMode = "expanded"; // think blocks: expanded by default (t toggles)
|
|
571
569
|
this.bashMode = "expanded"; // tool blocks: expanded | collapsed (b toggles)
|
|
572
570
|
this.todosVisible = true; // todo block above the input (Shift+T toggles)
|
|
@@ -959,12 +957,6 @@ export class ChatView extends Widget {
|
|
|
959
957
|
const b = node.blocks[info.blockIdx];
|
|
960
958
|
if (b && (b.kind === "tool" || b.kind === "reasoning" || b.kind === "other" || b.kind === "text")) {
|
|
961
959
|
const key = `${info.nodeIdx}:${info.blockIdx}`;
|
|
962
|
-
// fixed-height fold: remember how tall the block is right now so the
|
|
963
|
-
// collapsed form can pad the SAME height (nothing below moves)
|
|
964
|
-
let firstM = -1, lastM = -1;
|
|
965
|
-
for (let i = 0; i < this.lineMap.length; i++) {
|
|
966
|
-
if (match(this.lineMap[i])) { if (firstM < 0) firstM = i; lastM = i; }
|
|
967
|
-
}
|
|
968
960
|
if (b.kind === "reasoning") {
|
|
969
961
|
// clean two-state override: expand ⇄ collapse (never a no-op click)
|
|
970
962
|
const open = this.expanded.has(key) || (!this.collapsedBlocks.has(key) && this.thinkMode === "expanded");
|
|
@@ -976,8 +968,6 @@ export class ChatView extends Widget {
|
|
|
976
968
|
if (this.collapsedBlocks.has(key)) this.collapsedBlocks.delete(key);
|
|
977
969
|
else this.collapsedBlocks.add(key);
|
|
978
970
|
}
|
|
979
|
-
if (collapsing && firstM >= 0) this.blockHeights.set(key, lastM - firstM + 1);
|
|
980
|
-
else if (!collapsing) this.blockHeights.delete(key);
|
|
981
971
|
this.#rebuild();
|
|
982
972
|
reanchor(); nudge();
|
|
983
973
|
if (process.env.DSH_TUI_DEBUG_CLICK) {
|
|
@@ -1094,10 +1084,9 @@ export class ChatView extends Widget {
|
|
|
1094
1084
|
}
|
|
1095
1085
|
case "assistant": {
|
|
1096
1086
|
const blocks = node.blocks ?? [];
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
}
|
|
1087
|
+
// No separate "◌ 生成中…" marker line: it vanished at finalization,
|
|
1088
|
+
// snapping the pinned view by 1 line. Streaming state is already
|
|
1089
|
+
// visible via the block "…" suffixes and the live timers.
|
|
1101
1090
|
if (blocks.length === 0) { lines.push([{ t: " …", fg: K.FAINT }]); mark(realIdx); break; }
|
|
1102
1091
|
for (let bi = 0; bi < blocks.length; bi++) {
|
|
1103
1092
|
const b = blocks[bi];
|
|
@@ -1121,7 +1110,6 @@ export class ChatView extends Widget {
|
|
|
1121
1110
|
timing = " 已完成";
|
|
1122
1111
|
}
|
|
1123
1112
|
const thinkMeta = `${stepTag}(${b.text?.length ?? 0} 字)${timing}`;
|
|
1124
|
-
const blkLines0 = lines.length;
|
|
1125
1113
|
lines.push([{ t: "💭 思考" + (b.streaming ? "…" : "") + thinkMeta + (open ? " [t 折叠]" : " [t 展开]"), fg: K.FAINT }]);
|
|
1126
1114
|
mark(realIdx, bi);
|
|
1127
1115
|
if (open) {
|
|
@@ -1134,13 +1122,6 @@ export class ChatView extends Widget {
|
|
|
1134
1122
|
mark(realIdx, bi);
|
|
1135
1123
|
}
|
|
1136
1124
|
}
|
|
1137
|
-
// fixed-height fold: pad the recorded height with ghost rows so
|
|
1138
|
-
// nothing below the block moves
|
|
1139
|
-
if (!open) {
|
|
1140
|
-
const h = this.blockHeights.get(key) ?? 0;
|
|
1141
|
-
const filler = Math.max(0, h - (lines.length - blkLines0));
|
|
1142
|
-
for (let fi = 0; fi < filler; fi++) { lines.push([{ t: "" }]); mark(realIdx, bi); }
|
|
1143
|
-
}
|
|
1144
1125
|
sep();
|
|
1145
1126
|
} else if (b.kind === "tool") {
|
|
1146
1127
|
const key = `${realIdx}:${bi}`;
|
|
@@ -1155,7 +1136,6 @@ export class ChatView extends Widget {
|
|
|
1155
1136
|
const glyph = orphan ? "✗" : running ? "⏳" : exitCode !== undefined && exitCode !== 0 ? "✗" : "✓";
|
|
1156
1137
|
const card = b.view ? renderToolCard(b.view, w, open) : [];
|
|
1157
1138
|
beginCard(status);
|
|
1158
|
-
const blkLines0 = lines.length;
|
|
1159
1139
|
let timing = "";
|
|
1160
1140
|
if (running) {
|
|
1161
1141
|
timing = ` 已经过 ${fmtDuration(Date.now() - (b.startedAt ?? Date.now()))}`;
|
|
@@ -1179,11 +1159,6 @@ export class ChatView extends Widget {
|
|
|
1179
1159
|
lines.push([{ t: " " + truncate(summary, w - 6), fg: K.FAINT }]);
|
|
1180
1160
|
mark(realIdx, bi);
|
|
1181
1161
|
}
|
|
1182
|
-
// fixed-height fold: pad the recorded height with ghost rows so
|
|
1183
|
-
// nothing below the block moves
|
|
1184
|
-
const h = this.blockHeights.get(key) ?? 0;
|
|
1185
|
-
const filler = Math.max(0, h - (lines.length - blkLines0));
|
|
1186
|
-
for (let fi = 0; fi < filler; fi++) { lines.push([{ t: "" }]); mark(realIdx, bi); }
|
|
1187
1162
|
}
|
|
1188
1163
|
if (open) {
|
|
1189
1164
|
for (const ln of card) { lines.push(ln); mark(realIdx, bi); }
|
|
@@ -1206,7 +1181,6 @@ export class ChatView extends Widget {
|
|
|
1206
1181
|
sep();
|
|
1207
1182
|
} else {
|
|
1208
1183
|
beginCard("CARD");
|
|
1209
|
-
const blkLines0 = lines.length;
|
|
1210
1184
|
// Text blocks collapse per-block like tool/reasoning blocks:
|
|
1211
1185
|
// collapsed shows a 3-line preview + trailer, expanded the whole
|
|
1212
1186
|
// text. Clicking (or the right-click 展开/折叠) toggles it.
|
|
@@ -1230,13 +1204,6 @@ export class ChatView extends Widget {
|
|
|
1230
1204
|
lines.push([{ t: ` …共 ${text.length} 字(点击展开)`, fg: K.FAINT }]);
|
|
1231
1205
|
mark(realIdx, bi);
|
|
1232
1206
|
}
|
|
1233
|
-
// fixed-height fold: pad the recorded height with ghost rows so
|
|
1234
|
-
// nothing below the block moves
|
|
1235
|
-
if (!open) {
|
|
1236
|
-
const h = this.blockHeights.get(key) ?? 0;
|
|
1237
|
-
const filler = Math.max(0, h - (lines.length - blkLines0));
|
|
1238
|
-
for (let fi = 0; fi < filler; fi++) { lines.push([{ t: "" }]); mark(realIdx, bi); }
|
|
1239
|
-
}
|
|
1240
1207
|
sep();
|
|
1241
1208
|
}
|
|
1242
1209
|
}
|
|
@@ -2300,7 +2267,6 @@ export class App {
|
|
|
2300
2267
|
this.chat.cache.clear();
|
|
2301
2268
|
this.chat.nodes = [];
|
|
2302
2269
|
this.chat.collapsedBlocks.clear();
|
|
2303
|
-
this.chat.blockHeights.clear();
|
|
2304
2270
|
this.chat.expanded.clear();
|
|
2305
2271
|
this.chat.expandedTools.clear();
|
|
2306
2272
|
this.chat.queueRebuild();
|