dsh-neotui 0.0.27 → 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 +0 -33
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) {
|
|
@@ -1120,7 +1110,6 @@ export class ChatView extends Widget {
|
|
|
1120
1110
|
timing = " 已完成";
|
|
1121
1111
|
}
|
|
1122
1112
|
const thinkMeta = `${stepTag}(${b.text?.length ?? 0} 字)${timing}`;
|
|
1123
|
-
const blkLines0 = lines.length;
|
|
1124
1113
|
lines.push([{ t: "💭 思考" + (b.streaming ? "…" : "") + thinkMeta + (open ? " [t 折叠]" : " [t 展开]"), fg: K.FAINT }]);
|
|
1125
1114
|
mark(realIdx, bi);
|
|
1126
1115
|
if (open) {
|
|
@@ -1133,13 +1122,6 @@ export class ChatView extends Widget {
|
|
|
1133
1122
|
mark(realIdx, bi);
|
|
1134
1123
|
}
|
|
1135
1124
|
}
|
|
1136
|
-
// fixed-height fold: pad the recorded height with ghost rows so
|
|
1137
|
-
// nothing below the block moves
|
|
1138
|
-
if (!open) {
|
|
1139
|
-
const h = this.blockHeights.get(key) ?? 0;
|
|
1140
|
-
const filler = Math.max(0, h - (lines.length - blkLines0));
|
|
1141
|
-
for (let fi = 0; fi < filler; fi++) { lines.push([{ t: "" }]); mark(realIdx, bi); }
|
|
1142
|
-
}
|
|
1143
1125
|
sep();
|
|
1144
1126
|
} else if (b.kind === "tool") {
|
|
1145
1127
|
const key = `${realIdx}:${bi}`;
|
|
@@ -1154,7 +1136,6 @@ export class ChatView extends Widget {
|
|
|
1154
1136
|
const glyph = orphan ? "✗" : running ? "⏳" : exitCode !== undefined && exitCode !== 0 ? "✗" : "✓";
|
|
1155
1137
|
const card = b.view ? renderToolCard(b.view, w, open) : [];
|
|
1156
1138
|
beginCard(status);
|
|
1157
|
-
const blkLines0 = lines.length;
|
|
1158
1139
|
let timing = "";
|
|
1159
1140
|
if (running) {
|
|
1160
1141
|
timing = ` 已经过 ${fmtDuration(Date.now() - (b.startedAt ?? Date.now()))}`;
|
|
@@ -1178,11 +1159,6 @@ export class ChatView extends Widget {
|
|
|
1178
1159
|
lines.push([{ t: " " + truncate(summary, w - 6), fg: K.FAINT }]);
|
|
1179
1160
|
mark(realIdx, bi);
|
|
1180
1161
|
}
|
|
1181
|
-
// fixed-height fold: pad the recorded height with ghost rows so
|
|
1182
|
-
// nothing below the block moves
|
|
1183
|
-
const h = this.blockHeights.get(key) ?? 0;
|
|
1184
|
-
const filler = Math.max(0, h - (lines.length - blkLines0));
|
|
1185
|
-
for (let fi = 0; fi < filler; fi++) { lines.push([{ t: "" }]); mark(realIdx, bi); }
|
|
1186
1162
|
}
|
|
1187
1163
|
if (open) {
|
|
1188
1164
|
for (const ln of card) { lines.push(ln); mark(realIdx, bi); }
|
|
@@ -1205,7 +1181,6 @@ export class ChatView extends Widget {
|
|
|
1205
1181
|
sep();
|
|
1206
1182
|
} else {
|
|
1207
1183
|
beginCard("CARD");
|
|
1208
|
-
const blkLines0 = lines.length;
|
|
1209
1184
|
// Text blocks collapse per-block like tool/reasoning blocks:
|
|
1210
1185
|
// collapsed shows a 3-line preview + trailer, expanded the whole
|
|
1211
1186
|
// text. Clicking (or the right-click 展开/折叠) toggles it.
|
|
@@ -1229,13 +1204,6 @@ export class ChatView extends Widget {
|
|
|
1229
1204
|
lines.push([{ t: ` …共 ${text.length} 字(点击展开)`, fg: K.FAINT }]);
|
|
1230
1205
|
mark(realIdx, bi);
|
|
1231
1206
|
}
|
|
1232
|
-
// fixed-height fold: pad the recorded height with ghost rows so
|
|
1233
|
-
// nothing below the block moves
|
|
1234
|
-
if (!open) {
|
|
1235
|
-
const h = this.blockHeights.get(key) ?? 0;
|
|
1236
|
-
const filler = Math.max(0, h - (lines.length - blkLines0));
|
|
1237
|
-
for (let fi = 0; fi < filler; fi++) { lines.push([{ t: "" }]); mark(realIdx, bi); }
|
|
1238
|
-
}
|
|
1239
1207
|
sep();
|
|
1240
1208
|
}
|
|
1241
1209
|
}
|
|
@@ -2299,7 +2267,6 @@ export class App {
|
|
|
2299
2267
|
this.chat.cache.clear();
|
|
2300
2268
|
this.chat.nodes = [];
|
|
2301
2269
|
this.chat.collapsedBlocks.clear();
|
|
2302
|
-
this.chat.blockHeights.clear();
|
|
2303
2270
|
this.chat.expanded.clear();
|
|
2304
2271
|
this.chat.expandedTools.clear();
|
|
2305
2272
|
this.chat.queueRebuild();
|