@agi-fans/dsh-tui 0.23.0 → 0.24.0
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/lib/CHANGELOG.md +40 -1
- package/lib/commands/diff.js +58 -33
- package/lib/commands/diff.js.map +1 -1
- package/lib/commands/export.js +3 -1
- package/lib/commands/export.js.map +1 -1
- package/lib/commands/files.js +10 -2
- package/lib/commands/files.js.map +1 -1
- package/lib/commands/model.js +15 -8
- package/lib/commands/model.js.map +1 -1
- package/lib/commands/session.js +6 -1
- package/lib/commands/session.js.map +1 -1
- package/lib/definition.d.ts +10 -0
- package/lib/locale/zh.d.ts +26 -6
- package/lib/locale/zh.js +26 -6
- package/lib/locale/zh.js.map +1 -1
- package/lib/runtime/account-settings.d.ts +1 -0
- package/lib/runtime/account-settings.js +2 -2
- package/lib/runtime/account-settings.js.map +1 -1
- package/lib/runtime/model-settings.d.ts +2 -0
- package/lib/runtime/model-settings.js +2 -2
- package/lib/runtime/model-settings.js.map +1 -1
- package/lib/runtime/plugin-settings.d.ts +1 -0
- package/lib/runtime/plugin-settings.js +6 -6
- package/lib/runtime/plugin-settings.js.map +1 -1
- package/lib/runtime/provider-local.d.ts +3 -0
- package/lib/runtime/provider-local.js +110 -22
- package/lib/runtime/provider-local.js.map +1 -1
- package/lib/runtime/settings-preferences.js +1 -1
- package/lib/runtime/settings-preferences.js.map +1 -1
- package/lib/session/feature-toggles.js +2 -2
- package/lib/session/feature-toggles.js.map +1 -1
- package/lib/session/session-controller.d.ts +2 -8
- package/lib/session/session-controller.js +57 -32
- package/lib/session/session-controller.js.map +1 -1
- package/lib/session/session-library.d.ts +3 -1
- package/lib/session/session-library.js +15 -0
- package/lib/session/session-library.js.map +1 -1
- package/lib/session/tui-settings.d.ts +2 -0
- package/lib/session/tui-settings.js +1 -0
- package/lib/session/tui-settings.js.map +1 -1
- package/lib/views/autocomplete.d.ts +3 -6
- package/lib/views/autocomplete.js +10 -8
- package/lib/views/autocomplete.js.map +1 -1
- package/lib/views/document-reader.js +4 -1
- package/lib/views/document-reader.js.map +1 -1
- package/lib/views/settings-list.d.ts +5 -0
- package/lib/views/settings-list.js +46 -10
- package/lib/views/settings-list.js.map +1 -1
- package/lib/views/transcript-render.d.ts +2 -0
- package/lib/views/transcript-render.js +31 -19
- package/lib/views/transcript-render.js.map +1 -1
- package/package.json +1 -1
|
@@ -626,20 +626,27 @@ function processNoticeLine(block, theme, width, indent) {
|
|
|
626
626
|
* re-laying every call the run already made.
|
|
627
627
|
*/
|
|
628
628
|
const groupMemberCache = new WeakMap();
|
|
629
|
+
/** Collapsed process rows share spacing before and after an assistant reply. */
|
|
630
|
+
function compactProcessRow(index, context, thoughtOnly = false) {
|
|
631
|
+
const block = context.blocks[index];
|
|
632
|
+
const { options } = context;
|
|
633
|
+
if (block?.kind === 'notice')
|
|
634
|
+
return block.process !== undefined && block.framed !== true;
|
|
635
|
+
if (block?.kind === 'tool') {
|
|
636
|
+
return options.toolsExpanded !== true && !options.expandedTools?.has(block.callId) && !context.matches.has(index);
|
|
637
|
+
}
|
|
638
|
+
return block?.kind === 'assistant' && block.interrupted !== true && (thoughtOnly || block.text === '')
|
|
639
|
+
&& options.hideThinking !== false && !context.openedThoughts.has(reasoningKey(block)) && !context.matches.has(index);
|
|
640
|
+
}
|
|
629
641
|
/** Flat chronological content, shared by live and opened turns. */
|
|
630
642
|
function processGroupBody(group, context) {
|
|
631
643
|
const lines = [];
|
|
632
644
|
const offsets = new Map();
|
|
633
645
|
const spans = [];
|
|
634
646
|
for (const index of groupMembers(group)) {
|
|
635
|
-
const
|
|
636
|
-
const rows = groupMemberLines(index, context,
|
|
637
|
-
|
|
638
|
-
const opened = (item, at) => item?.kind === 'tool'
|
|
639
|
-
? context.options.toolsExpanded === true || context.options.expandedTools?.has(item.callId) === true || context.matches.has(at)
|
|
640
|
-
: item?.kind === 'assistant' && item.reasoning !== '' && (context.options.hideThinking === false || context.openedThoughts.has(reasoningKey(item)));
|
|
641
|
-
const reply = block.kind === 'assistant' && block.text !== '' && index !== group.answer;
|
|
642
|
-
if (rows.length > 0 && lines.length > 0 && (opened(block, index) || opened(previous, index - 1) || reply || previous?.kind === 'assistant' && previous.text !== ''))
|
|
647
|
+
const thoughtOnly = index === group.answer && group.tookThought;
|
|
648
|
+
const rows = groupMemberLines(index, context, thoughtOnly);
|
|
649
|
+
if (rows.length > 0 && lines.length > 0 && (!compactProcessRow(index, context, thoughtOnly) || !compactProcessRow(index - 1, context)))
|
|
643
650
|
lines.push('');
|
|
644
651
|
offsets.set(index, lines.length);
|
|
645
652
|
if (context.blocks[index]?.kind === 'tool')
|
|
@@ -797,7 +804,7 @@ const renderedBlockCache = new WeakMap();
|
|
|
797
804
|
export function renderedBlocks(state, options) {
|
|
798
805
|
const theme = createTheme(options.colors === true, options.colorDepth ?? 'truecolor', options.themeName ?? 'dark', options.terminal, options.language, options.compactLinks);
|
|
799
806
|
const key = [options.width, options.colors, options.colorDepth, options.themeName,
|
|
800
|
-
options.language, options.compactLinks, JSON.stringify(options.terminal), options.mathMode, options.mermaidMode].join('\0');
|
|
807
|
+
options.language, options.compactLinks, JSON.stringify(options.terminal), options.mathMode, options.mermaidMode, options.showFileChanges !== false].join('\0');
|
|
801
808
|
const cached = renderedBlockCache.get(state.blocks)?.get(key);
|
|
802
809
|
if (cached !== undefined)
|
|
803
810
|
return cached;
|
|
@@ -805,7 +812,7 @@ export function renderedBlocks(state, options) {
|
|
|
805
812
|
block: index,
|
|
806
813
|
// The source text is the fallback for a block kind the painter does not lay
|
|
807
814
|
// out as rows of its own; matching something is better than matching nothing.
|
|
808
|
-
lines: renderedRows(block, theme, options).map(stripAnsi),
|
|
815
|
+
lines: block.kind === 'workspace' && options.showFileChanges === false ? [] : renderedRows(block, theme, options).map(stripAnsi),
|
|
809
816
|
}));
|
|
810
817
|
const byKey = new Map(renderedBlockCache.get(state.blocks) ?? []);
|
|
811
818
|
byKey.set(key, blocks);
|
|
@@ -1143,6 +1150,7 @@ function renderTranscriptBody(state, options, theme, spinnerFrame) {
|
|
|
1143
1150
|
const rawTools = [...(options.rawTools ?? [])].sort().join('\0');
|
|
1144
1151
|
const expandedReasoning = [...(options.expandedReasoning ?? [])].sort().join('\0');
|
|
1145
1152
|
const hideThinking = options.hideThinking !== false;
|
|
1153
|
+
const showFileChanges = options.showFileChanges !== false;
|
|
1146
1154
|
const openedGroups = [...(options.openedGroups ?? [])].sort().join('\0');
|
|
1147
1155
|
// A command output the reader opened paints different rows, so the body cache
|
|
1148
1156
|
// has to see it; without this the frame is reused and the key looks dead.
|
|
@@ -1181,6 +1189,7 @@ function renderTranscriptBody(state, options, theme, spinnerFrame) {
|
|
|
1181
1189
|
&& cached.rawTools === rawTools
|
|
1182
1190
|
&& cached.expandedReasoning === expandedReasoning
|
|
1183
1191
|
&& cached.hideThinking === hideThinking
|
|
1192
|
+
&& cached.showFileChanges === showFileChanges
|
|
1184
1193
|
&& cached.openedGroups === openedGroups
|
|
1185
1194
|
&& cached.expandedOutputs === expandedOutputs
|
|
1186
1195
|
&& cached.toolDetailsKey === options.toolDetailsKey
|
|
@@ -1293,6 +1302,8 @@ function renderTranscriptBody(state, options, theme, spinnerFrame) {
|
|
|
1293
1302
|
// global tool switch above, so it reports the same kind of mark.
|
|
1294
1303
|
if (hideThinking)
|
|
1295
1304
|
foldMarks.push({ key: 'thinking', row: 0 });
|
|
1305
|
+
if (!showFileChanges)
|
|
1306
|
+
foldMarks.push({ key: 'hide-file-changes', row: 0 });
|
|
1296
1307
|
let liveFrom;
|
|
1297
1308
|
const context = {
|
|
1298
1309
|
blocks: state.blocks, theme, themeName, depth, width: options.width,
|
|
@@ -1300,11 +1311,6 @@ function renderTranscriptBody(state, options, theme, spinnerFrame) {
|
|
|
1300
1311
|
openedThoughts,
|
|
1301
1312
|
spinnerFrame,
|
|
1302
1313
|
};
|
|
1303
|
-
const compactProcessRow = (block) => {
|
|
1304
|
-
if (block?.kind === 'notice')
|
|
1305
|
-
return block.process !== undefined && block.framed !== true;
|
|
1306
|
-
return block?.kind === 'tool' && !toolsExpanded && !options.expandedTools?.has(block.callId);
|
|
1307
|
-
};
|
|
1308
1314
|
// Only a turn's last run is summarized by how long the turn took; an earlier
|
|
1309
1315
|
// run in the same turn did not take all of it.
|
|
1310
1316
|
const elapsedOf = (index) => {
|
|
@@ -1316,6 +1322,11 @@ function renderTranscriptBody(state, options, theme, spinnerFrame) {
|
|
|
1316
1322
|
};
|
|
1317
1323
|
for (let index = 0; index < state.blocks.length; index += 1) {
|
|
1318
1324
|
const block = state.blocks[index];
|
|
1325
|
+
if (block.kind === 'workspace' && !showFileChanges) {
|
|
1326
|
+
blockStarts[index] = lines.length;
|
|
1327
|
+
blockDrawStarts[index] = lines.length;
|
|
1328
|
+
continue;
|
|
1329
|
+
}
|
|
1319
1330
|
const groupIndex = groupOf[index] ?? -1;
|
|
1320
1331
|
if (groupIndex >= 0) {
|
|
1321
1332
|
// A run is painted whole by its first block: the header, then its rows
|
|
@@ -1429,12 +1440,12 @@ function renderTranscriptBody(state, options, theme, spinnerFrame) {
|
|
|
1429
1440
|
const failed = (trailing?.kind === 'notice' && trailing.level === 'error')
|
|
1430
1441
|
|| (trailing?.kind === 'tool' && trailing.status === 'error');
|
|
1431
1442
|
if (group.live || opened || failed) {
|
|
1432
|
-
if (lines.length > 0 && !(trailing?.kind === 'notice' && state.blocks[at - 1]?.kind === 'notice'))
|
|
1433
|
-
lines.push('');
|
|
1434
|
-
offsets.set(at, lines.length - bodyRow);
|
|
1435
1443
|
const rows = !group.live && !opened && trailing?.kind === 'tool'
|
|
1436
1444
|
? toolRowLine(trailing, theme, options.width, spinnerFrame)
|
|
1437
1445
|
: groupMemberLines(at, context);
|
|
1446
|
+
if (rows.length > 0 && lines.length > 0 && (!compactProcessRow(at, context) || !compactProcessRow(at - 1, context)))
|
|
1447
|
+
lines.push('');
|
|
1448
|
+
offsets.set(at, lines.length - bodyRow);
|
|
1438
1449
|
disclosureAt(at, lines.length);
|
|
1439
1450
|
regionsAt(at, lines.length, rows.length);
|
|
1440
1451
|
for (const line of rows)
|
|
@@ -1479,7 +1490,7 @@ function renderTranscriptBody(state, options, theme, spinnerFrame) {
|
|
|
1479
1490
|
if (previousCommand !== undefined && currentCommand !== undefined && previousCommand !== currentCommand) {
|
|
1480
1491
|
lines.push('', renderCommandSeparator(theme, options.width), '');
|
|
1481
1492
|
}
|
|
1482
|
-
else if (!compactProcessRow(
|
|
1493
|
+
else if (!compactProcessRow(index, context) || !compactProcessRow(index - 1, context)) {
|
|
1483
1494
|
lines.push('');
|
|
1484
1495
|
}
|
|
1485
1496
|
}
|
|
@@ -1542,6 +1553,7 @@ function renderTranscriptBody(state, options, theme, spinnerFrame) {
|
|
|
1542
1553
|
rawTools,
|
|
1543
1554
|
expandedReasoning,
|
|
1544
1555
|
hideThinking,
|
|
1556
|
+
showFileChanges,
|
|
1545
1557
|
openedGroups,
|
|
1546
1558
|
expandedOutputs,
|
|
1547
1559
|
searchKey,
|