@deepseek-harness-tui/dsh-tui 0.20.1 → 0.20.2

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.
Files changed (116) hide show
  1. package/README.md +14 -3
  2. package/guide/dsh-tui-guide/configuration.en.md +26 -12
  3. package/guide/dsh-tui-guide/configuration.md +18 -9
  4. package/guide/dsh-tui-guide/getting-started.en.md +17 -9
  5. package/guide/dsh-tui-guide/getting-started.md +11 -7
  6. package/guide/dsh-tui-guide/interaction.en.md +1 -0
  7. package/guide/dsh-tui-guide/interaction.md +1 -0
  8. package/guide/dsh-tui-guide/themes.en.md +1 -1
  9. package/guide/dsh-tui-guide/themes.md +1 -1
  10. package/guide/dsh-tui-guide/user-guide.en.md +8 -2
  11. package/guide/dsh-tui-guide/user-guide.md +8 -2
  12. package/lib/settings.json +19 -3
  13. package/lib/types/adapter/ports/channel-settings.d.ts +6 -0
  14. package/lib/types/adapter/ports/channel-settings.d.ts.map +1 -1
  15. package/lib/types/adapter/ports/channel-view.d.ts +28 -2
  16. package/lib/types/adapter/ports/channel-view.d.ts.map +1 -1
  17. package/lib/types/backends/claude/session/lifecycle.d.ts.map +1 -1
  18. package/lib/types/backends/claude/session/lifecycle.js +11 -9
  19. package/lib/types/backends/claude/side-query.d.ts +2 -0
  20. package/lib/types/backends/claude/side-query.d.ts.map +1 -1
  21. package/lib/types/backends/claude/side-query.js +30 -13
  22. package/lib/types/components/messages/AssistantToolUseMessage.d.ts +1 -1
  23. package/lib/types/components/messages/AssistantToolUseMessage.d.ts.map +1 -1
  24. package/lib/types/components/messages/AssistantToolUseMessage.js +228 -27
  25. package/lib/types/components/messages/presentCardBackground.d.ts +28 -0
  26. package/lib/types/components/messages/presentCardBackground.d.ts.map +1 -0
  27. package/lib/types/components/messages/presentCardBackground.js +23 -0
  28. package/lib/types/dsh-adapter/backend/translate.d.ts.map +1 -1
  29. package/lib/types/dsh-adapter/backend/translate.js +28 -1
  30. package/lib/types/dsh-adapter/channel/core/compose.d.ts.map +1 -1
  31. package/lib/types/dsh-adapter/channel/core/files.d.ts.map +1 -1
  32. package/lib/types/dsh-adapter/channel/file-actions.d.ts +1 -1
  33. package/lib/types/dsh-adapter/channel/file-actions.d.ts.map +1 -1
  34. package/lib/types/dsh-adapter/channel/file-actions.js +11 -4
  35. package/lib/types/dsh-adapter/channel/settings-host.d.ts.map +1 -1
  36. package/lib/types/dsh-adapter/channel/settings-host.js +78 -12
  37. package/lib/types/dsh-adapter/channel/state.d.ts +4 -3
  38. package/lib/types/dsh-adapter/channel/state.d.ts.map +1 -1
  39. package/lib/types/dsh-adapter/channel/state.js +4 -3
  40. package/lib/types/dsh-adapter/channel/types.d.ts +1 -1
  41. package/lib/types/dsh-adapter/channel/types.d.ts.map +1 -1
  42. package/lib/types/dsh-adapter/channel.d.ts +1 -1
  43. package/lib/types/dsh-adapter/channel.d.ts.map +1 -1
  44. package/lib/types/dsh-adapter/contract.d.ts +18 -7
  45. package/lib/types/dsh-adapter/contract.d.ts.map +1 -1
  46. package/lib/types/dsh-adapter/contract.js +20 -7
  47. package/lib/types/dsh-adapter/host-contract.d.ts +1 -1
  48. package/lib/types/dsh-adapter/host-contract.js +1 -1
  49. package/lib/types/dsh-adapter/host-entry.js +4 -2
  50. package/lib/types/dsh-adapter/host-service-diagnostics.d.ts +61 -0
  51. package/lib/types/dsh-adapter/host-service-diagnostics.d.ts.map +1 -0
  52. package/lib/types/dsh-adapter/host-service-diagnostics.js +103 -0
  53. package/lib/types/dsh-adapter/index.d.ts +5 -0
  54. package/lib/types/dsh-adapter/index.d.ts.map +1 -1
  55. package/lib/types/dsh-adapter/index.js +1 -0
  56. package/lib/types/dsh-adapter/plugin.d.ts.map +1 -1
  57. package/lib/types/dsh-adapter/plugin.js +39 -2
  58. package/lib/types/dsh-adapter/present-tool.d.ts +20 -0
  59. package/lib/types/dsh-adapter/present-tool.d.ts.map +1 -0
  60. package/lib/types/dsh-adapter/present-tool.js +96 -0
  61. package/lib/types/i18n.d.ts +15 -0
  62. package/lib/types/i18n.d.ts.map +1 -1
  63. package/lib/types/i18n.js +6 -0
  64. package/lib/types/ink/components/ScrollBox.d.ts.map +1 -1
  65. package/lib/types/ink/components/ScrollBox.js +13 -0
  66. package/lib/types/ink/dom.d.ts +3 -0
  67. package/lib/types/ink/dom.d.ts.map +1 -1
  68. package/lib/types/ink/ink.d.ts.map +1 -1
  69. package/lib/types/ink/ink.js +30 -34
  70. package/lib/types/ink/render-node-to-output.d.ts +3 -0
  71. package/lib/types/ink/render-node-to-output.d.ts.map +1 -1
  72. package/lib/types/ink/render-node-to-output.js +54 -40
  73. package/lib/types/ink/selection.d.ts +38 -28
  74. package/lib/types/ink/selection.d.ts.map +1 -1
  75. package/lib/types/ink/selection.js +201 -130
  76. package/lib/types/kernelPrefs.d.ts +5 -2
  77. package/lib/types/kernelPrefs.d.ts.map +1 -1
  78. package/lib/types/kernelPrefs.js +5 -2
  79. package/lib/types/settings/definitions.d.ts +12 -0
  80. package/lib/types/settings/definitions.d.ts.map +1 -1
  81. package/lib/types/settings/definitions.js +10 -2
  82. package/lib/types/theme.d.ts +4 -0
  83. package/lib/types/theme.d.ts.map +1 -1
  84. package/lib/types/theme.js +20 -2
  85. package/lib/types/tuiDisplayPrefs.d.ts +3 -0
  86. package/lib/types/tuiDisplayPrefs.d.ts.map +1 -1
  87. package/lib/types/tuiDisplayPrefs.js +10 -0
  88. package/lib/types/update.d.ts +74 -5
  89. package/lib/types/update.d.ts.map +1 -1
  90. package/lib/types/update.js +297 -46
  91. package/lib/types/updateHost.d.ts.map +1 -1
  92. package/lib/types/updateHost.js +16 -5
  93. package/lib/types/usageStats.d.ts +6 -0
  94. package/lib/types/usageStats.d.ts.map +1 -1
  95. package/lib/types/usageStats.js +8 -0
  96. package/lib/types/utils/colorMix.d.ts +19 -0
  97. package/lib/types/utils/colorMix.d.ts.map +1 -0
  98. package/lib/types/utils/colorMix.js +51 -0
  99. package/lib/types/utils/commandLine.d.ts +8 -0
  100. package/lib/types/utils/commandLine.d.ts.map +1 -0
  101. package/lib/types/utils/commandLine.js +37 -0
  102. package/lib/types/utils/desktopEntry.d.ts +32 -0
  103. package/lib/types/utils/desktopEntry.d.ts.map +1 -0
  104. package/lib/types/utils/desktopEntry.js +302 -0
  105. package/lib/types/utils/externalEditor.d.ts +2 -5
  106. package/lib/types/utils/externalEditor.d.ts.map +1 -1
  107. package/lib/types/utils/externalEditor.js +4 -36
  108. package/lib/types/utils/openExternal.d.ts +9 -0
  109. package/lib/types/utils/openExternal.d.ts.map +1 -1
  110. package/lib/types/utils/openExternal.js +87 -3
  111. package/lib/types/utils/terminalLaunch.d.ts +16 -0
  112. package/lib/types/utils/terminalLaunch.d.ts.map +1 -0
  113. package/lib/types/utils/terminalLaunch.js +121 -0
  114. package/package.json +112 -111
  115. package/tui-profile/feed/README.md +1 -1
  116. package/tui-profile/feed/first-party.json +1 -1
@@ -1,9 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import React from 'react';
3
- import { extname } from 'node:path';
3
+ import { basename, dirname, extname } from 'node:path';
4
4
  import * as JsDiff from 'diff';
5
5
  import { Box, Text, useTerminalSize } from '../../ui.js';
6
6
  import { stringWidth } from '../../ink/stringWidth.js';
7
+ import { truncateToWidth } from '../../ink/truncateToWidth.js';
7
8
  import { useAnimationFrame } from '../../ink/hooks/use-animation-frame.js';
8
9
  import { ToolUseLoader } from '../ToolUseLoader.js';
9
10
  import { SplitDiffView } from '../SplitDiffView.js';
@@ -12,7 +13,11 @@ import { useTooltip } from '../Tooltip.js';
12
13
  import { formatDuration } from '../../terminal-utils/format.js';
13
14
  import { formatClock } from '../../trajectory/format.js';
14
15
  import { foldLongLines } from '../../utils/fold-long-lines.js';
16
+ import { truncateMiddle } from '../../utils/truncateMiddle.js';
17
+ import { cleanRenderText } from '../../channel/sanitize.js';
15
18
  import { getLang, t, tOr } from '../../i18n.js';
19
+ import { getNerdFontIcons, subscribeNerdFontIcons } from '../../tuiDisplayPrefs.js';
20
+ import { getTheme } from '../../theme.js';
16
21
  import { revealLinesOf, scopeRevealKey, snapReveal } from '../smoothReveal.js';
17
22
  import { useRevealScope } from '../revealScope.js';
18
23
  import { useRevealVersion } from '../../hooks/useRevealVersion.js';
@@ -20,6 +25,9 @@ import { primaryComboString } from '../../utils/keymap.js';
20
25
  import { agentMessageStateColor, agentMessageStateText } from './TranscriptLeaves.js';
21
26
  import { liveOutputMaxLines, liveOutputView } from './liveOutputLines.js';
22
27
  import { isPatchDiff, parseFilePatch, patchHeader } from '../diffPatch.js';
28
+ import { useTheme } from '../design-system/ThemeProvider.js';
29
+ import { isMinimalUiMode } from '../../minimalUiMode.js';
30
+ import { presentCardSurface } from './presentCardBackground.js';
23
31
  /** Tool display names localize through the `tool-name-*` dictionary family
24
32
  * (i18n.ts): DSH emits lowercase tool ids (`bash`), display names resolve
25
33
  * per language — proper nouns (Bash, PowerShell) stay identical in zh.
@@ -36,6 +44,7 @@ const TOOL_NAME_KEYS = {
36
44
  write: 'tool-name-write',
37
45
  edit: 'tool-name-edit',
38
46
  todo_write: 'tool-name-todo_write',
47
+ present: 'tool-name-present',
39
48
  subagent: 'tool-name-subagent',
40
49
  web_search: 'tool-name-web_search',
41
50
  };
@@ -357,9 +366,182 @@ function contentLines(content) {
357
366
  return [];
358
367
  return text.split('\n').map(plain);
359
368
  }
369
+ /** Extension → presentation family; everything unlisted is `other`. */
370
+ const PRESENT_EXT_FAMILY = {
371
+ pdf: 'doc', doc: 'doc', docx: 'doc', md: 'doc', txt: 'doc', rtf: 'doc', odt: 'doc', pages: 'doc',
372
+ csv: 'data', tsv: 'data', xls: 'data', xlsx: 'data', json: 'data', jsonl: 'data', yaml: 'data', yml: 'data', sql: 'data', parquet: 'data',
373
+ ppt: 'deck', pptx: 'deck', key: 'deck', odp: 'deck',
374
+ png: 'media', jpg: 'media', jpeg: 'media', gif: 'media', webp: 'media', svg: 'media', mp4: 'media', mov: 'media', mp3: 'media', wav: 'media',
375
+ zip: 'archive', tar: 'archive', gz: 'archive', tgz: 'archive', rar: 'archive', '7z': 'archive',
376
+ ts: 'code', tsx: 'code', js: 'code', jsx: 'code', py: 'code', go: 'code', rs: 'code', c: 'code', cpp: 'code', h: 'code', sh: 'code', java: 'code', rb: 'code', php: 'code', html: 'code', css: 'code',
377
+ };
378
+ /** Extension-specific badges, all exactly four cells; family badges pad the rest. */
379
+ const PRESENT_EXT_CHIP = {
380
+ pdf: 'PDF', md: 'MD', csv: 'CSV', json: 'JSON', jsonl: 'JSON', yaml: 'YAML', yml: 'YAML',
381
+ docx: 'DOC', xls: 'XLS', xlsx: 'XLS', pptx: 'PPT', jpeg: 'JPG', jpg: 'JPG', webp: 'WEBP', html: 'HTML', cpp: 'CPP', tsx: 'TSX', jsx: 'JSX',
382
+ ts: 'TS', js: 'JS', py: 'PY', go: 'GO', rs: 'RS', sh: 'SH', c: 'C', h: 'H', txt: 'TXT', mp4: 'MP4', mov: 'MOV', mp3: 'MP3', wav: 'WAV',
383
+ };
384
+ const PRESENT_FAMILY_CHIP = {
385
+ doc: 'DOC', data: 'DAT', deck: 'PPT', media: 'IMG', code: 'COD', archive: 'ZIP', other: 'FIL',
386
+ };
387
+ /** Type colours reuse the existing theme families: no new colour ramp. */
388
+ const PRESENT_FAMILY_COLOR = {
389
+ doc: 'ide', data: 'success', deck: 'toolNameMutate', media: 'merged', code: 'toolNameExec', archive: 'warning', other: 'subtle',
390
+ };
391
+ /** Nerd Font (Font Awesome) glyphs, one cell each; the opt-in setting picks these. */
392
+ const PRESENT_FAMILY_ICON = {
393
+ doc: '\uf15c', data: '\uf1c3', deck: '\uf1c4', media: '\uf1c5', code: '\uf121', archive: '\uf1c6', other: '\uf15b',
394
+ };
395
+ const PRESENT_EXT_ICON = {
396
+ pdf: '\uf1c1', md: '\uf48a', doc: '\uf1c2', docx: '\uf1c2', xls: '\uf1c3', xlsx: '\uf1c3', csv: '\uf1c3', ppt: '\uf1c4', pptx: '\uf1c4',
397
+ };
398
+ const PRESENT_BAR = '\u258d';
399
+ /** Bar + four-cell badge/one-cell icon + padding: the name always starts here. */
400
+ const PRESENT_LEAD_WIDTH = 6;
401
+ /** Separator between a file's directory and its description. */
402
+ const PRESENT_DETAIL_SEPARATOR = ' \u00b7 ';
403
+ /** Preview work is bounded in code units too: zero-width text spends no cells. */
404
+ const PRESENT_PREVIEW_CODE_UNITS = 1024;
405
+ const PRESENT_PREVIEW_CELLS = 512;
406
+ /** Expanded fields may wrap, but arbitrary logged/model text stays bounded. */
407
+ const PRESENT_EXPANDED_CODE_UNITS = 32_768;
408
+ function presentText(value, expanded = false) {
409
+ const limit = expanded ? PRESENT_EXPANDED_CODE_UNITS : PRESENT_PREVIEW_CODE_UNITS;
410
+ let bounded = value.slice(0, limit);
411
+ if (bounded.length < value.length && /[\uD800-\uDBFF]$/u.test(bounded))
412
+ bounded = bounded.slice(0, -1);
413
+ // No cell truncation when expanded: cleanRenderText then measures once,
414
+ // without its per-prefix clipping loop. Preview inputs are small before
415
+ // either that loop or the card's middle truncation can inspect them.
416
+ const text = cleanRenderText(bounded, expanded ? Infinity : PRESENT_PREVIEW_CELLS);
417
+ return bounded.length < value.length && !text.endsWith('…') ? `${text}…` : text;
418
+ }
419
+ function presentChip(ext, family) {
420
+ const chip = Object.hasOwn(PRESENT_EXT_CHIP, ext) ? PRESENT_EXT_CHIP[ext] : PRESENT_FAMILY_CHIP[family];
421
+ return chip.padEnd(4, ' ');
422
+ }
423
+ /** Binary units, one decimal below 10 (2.4 MB) and none above (12 MB). */
424
+ function presentSizeText(size) {
425
+ if (size < 1024)
426
+ return `${size} B`;
427
+ const units = ['KB', 'MB', 'GB', 'TB'];
428
+ let value = size / 1024;
429
+ let unit = 0;
430
+ while (value >= 1024 && unit < units.length - 1) {
431
+ value /= 1024;
432
+ unit += 1;
433
+ }
434
+ return `${value.toFixed(value >= 10 ? 0 : 1).replace(/\.0$/u, '')} ${units[unit]}`;
435
+ }
436
+ /** Locale-aware short timestamp: time today, "yesterday", else month/day. */
437
+ function presentTimeText(mtimeMs) {
438
+ const locale = getLang() === 'zh' ? 'zh-CN' : 'en-US';
439
+ const then = new Date(mtimeMs);
440
+ const now = new Date();
441
+ if (then.toDateString() === now.toDateString()) {
442
+ return new Intl.DateTimeFormat(locale, { hour: '2-digit', minute: '2-digit', hour12: false }).format(then);
443
+ }
444
+ const yesterday = new Date(now);
445
+ yesterday.setDate(now.getDate() - 1);
446
+ if (then.toDateString() === yesterday.toDateString()) {
447
+ return new Intl.RelativeTimeFormat(locale, { numeric: 'auto' }).format(-1, 'day');
448
+ }
449
+ return new Intl.DateTimeFormat(locale, { month: 'short', day: 'numeric' }).format(then);
450
+ }
451
+ /** A file's directory (with trailing slash) and sanitized description. */
452
+ function presentDetail(file) {
453
+ const directory = presentText(dirname(file.path));
454
+ const description = presentText(file.description ?? '');
455
+ const dir = directory === '.' || directory === ''
456
+ ? ''
457
+ : directory.endsWith('/') || directory.endsWith('\\')
458
+ ? directory
459
+ : `${directory}/`;
460
+ return {
461
+ dir,
462
+ description: description === '' ? undefined : description,
463
+ };
464
+ }
465
+ /** Total declared size, only when every file reported one. */
466
+ function presentedTotalSize(files) {
467
+ if (files.length === 0 || files.some(file => file.size === undefined))
468
+ return undefined;
469
+ return files.reduce((sum, file) => sum + (file.size ?? 0), 0);
470
+ }
471
+ /**
472
+ * The delivery card: one bold, clickable row per file (type badge/icon +
473
+ * basename + right-aligned size/time). A single collapsed deliverable adds a
474
+ * directory/description preview. Expanded cards show the resolved path and
475
+ * description without the preview's cell limit, wrapping within the card.
476
+ */
477
+ function presentedFileLines(files, columns, icons, expanded) {
478
+ const rowBudget = Math.max(24, columns - 6);
479
+ const lines = [];
480
+ for (const file of files) {
481
+ const displayName = presentText(basename(file.path));
482
+ const ext = extname(displayName).slice(1).toLowerCase();
483
+ const family = Object.hasOwn(PRESENT_EXT_FAMILY, ext) ? PRESENT_EXT_FAMILY[ext] : 'other';
484
+ const token = icons
485
+ ? (Object.hasOwn(PRESENT_EXT_ICON, ext) ? PRESENT_EXT_ICON[ext] : PRESENT_FAMILY_ICON[family])
486
+ : presentChip(ext, family);
487
+ const lead = icons ? `${PRESENT_BAR}${token} ` : `${PRESENT_BAR}${token} `;
488
+ const metaParts = [];
489
+ if (file.size !== undefined)
490
+ metaParts.push(presentSizeText(file.size));
491
+ if (file.mtimeMs !== undefined)
492
+ metaParts.push(presentTimeText(file.mtimeMs));
493
+ // Drop the timestamp first, then the size, before squeezing the name.
494
+ while (metaParts.length > 0
495
+ && rowBudget - PRESENT_LEAD_WIDTH - stringWidth(metaParts.join(' \u00b7 ')) - 2 < 12) {
496
+ metaParts.pop();
497
+ }
498
+ const meta = metaParts.join(' \u00b7 ');
499
+ const nameBudget = Math.max(12, rowBudget - PRESENT_LEAD_WIDTH - (meta === '' ? 0 : stringWidth(meta) + 2));
500
+ const shownName = truncateMiddle(displayName, nameBudget);
501
+ const gap = meta === '' ? 0 : Math.max(2, rowBudget - PRESENT_LEAD_WIDTH - stringWidth(shownName) - stringWidth(meta));
502
+ lines.push({
503
+ text: meta === '' ? shownName : `${shownName}${' '.repeat(gap)}`,
504
+ tone: 'plain',
505
+ bold: true,
506
+ target: file.target ?? file.path,
507
+ lead: { text: lead, color: PRESENT_FAMILY_COLOR[family] },
508
+ ...(meta === '' ? {} : { suffix: meta }),
509
+ });
510
+ if (expanded) {
511
+ const target = file.target ?? file.path;
512
+ // Keep the wrapping path separate from the summary's size/time column.
513
+ lines.push({ text: presentText(target, true), tone: 'path', target });
514
+ const description = presentText(file.description ?? '', true);
515
+ if (description !== '')
516
+ lines.push({ text: `${' '.repeat(PRESENT_LEAD_WIDTH)}${description}`, tone: 'dim' });
517
+ continue;
518
+ }
519
+ if (files.length !== 1)
520
+ continue;
521
+ const { dir, description } = presentDetail(file);
522
+ if (dir === '' && description === undefined)
523
+ continue;
524
+ const detailBudget = rowBudget - PRESENT_LEAD_WIDTH;
525
+ const dirShown = dir === '' ? '' : truncateMiddle(dir, Math.max(8, Math.floor(detailBudget * 0.55)));
526
+ const descRoom = detailBudget - stringWidth(dirShown) - (dirShown === '' ? 0 : stringWidth(PRESENT_DETAIL_SEPARATOR));
527
+ const desc = description !== undefined && descRoom >= 6
528
+ ? (stringWidth(description) > descRoom ? `${truncateToWidth(description, descRoom - 1)}\u2026` : description)
529
+ : undefined;
530
+ const detail = dirShown === ''
531
+ ? desc ?? ''
532
+ : `${dirShown}${desc === undefined ? '' : `${PRESENT_DETAIL_SEPARATOR}${desc}`}`;
533
+ if (detail !== '')
534
+ lines.push({ text: `${' '.repeat(PRESENT_LEAD_WIDTH)}${detail}`, tone: 'dim' });
535
+ }
536
+ return lines;
537
+ }
538
+ /** Presenter-supplied title; the `files` card owns its localized count title. */
539
+ function viewTitle(view) {
540
+ return view === undefined || view.card === 'files' ? undefined : view.title;
541
+ }
360
542
  /** Per-card body lines; unknown/absent shapes yield [] so the caller falls
361
543
  * back to the raw result text. */
362
- function viewLines(view) {
544
+ function viewLines(view, columns, icons, expanded) {
363
545
  switch (view.card) {
364
546
  case 'diff':
365
547
  return diffLines(view.diffs);
@@ -376,6 +558,10 @@ function viewLines(view) {
376
558
  return contentLines('content' in view ? view.content : undefined);
377
559
  case 'generic':
378
560
  return contentLines('content' in view ? view.content : undefined);
561
+ case 'files':
562
+ // One deliverable shows its directory/description without expanding;
563
+ // several stay one row each until the card is expanded.
564
+ return presentedFileLines(view.files, columns, icons, expanded);
379
565
  case 'search': {
380
566
  if (view.shape === 'paths') {
381
567
  const lines = view.paths.map(plain);
@@ -633,9 +819,18 @@ export function AssistantToolUseMessage({ tool, marginTopOnTurn, verbose, isSele
633
819
  // The settled view carries the applied diff / actual output; while running,
634
820
  // the call view already shows the pending change.
635
821
  const view = tool.resultView ?? tool.callView;
822
+ const [themeName] = useTheme();
823
+ const theme = getTheme(themeName);
824
+ // Deliverables keep their own face even when ordinary tool backgrounds are
825
+ // off; the minimal UI drops it with the other decorative colours.
826
+ const presentSurface = view?.card === 'files' && !isMinimalUiMode()
827
+ ? presentCardSurface(toolBackground, theme)
828
+ : undefined;
636
829
  const name = displayName(tool.name, view?.displayKey ?? tool.callView?.displayKey);
637
830
  const minWidth = stringWidth(name) + 2;
638
831
  const filePath = filePathFromTool(tool, view);
832
+ const nerdFontIcons = React.useSyncExternalStore(subscribeNerdFontIcons, getNerdFontIcons);
833
+ const presentedSize = view?.card === 'files' ? presentedTotalSize(view.files) : undefined;
639
834
  const syntaxLanguage = view?.card === 'read' || view?.card === 'generic' || view === undefined
640
835
  ? languageFromPath(filePath)
641
836
  : undefined;
@@ -645,7 +840,9 @@ export function AssistantToolUseMessage({ tool, marginTopOnTurn, verbose, isSele
645
840
  // raw args parens stay out of the header.
646
841
  const headerTitle = sendMessage !== undefined
647
842
  ? `${displayName(tool.name)} → ${sendMessage.target}${sendMessage.resuming ? ` · ${t('send-message-card-resuming')}` : ''}`
648
- : tool.resultView?.title ?? tool.callView?.title;
843
+ : view?.card === 'files'
844
+ ? `${name}(${t('tool-present-files', { count: view.files.length })}${presentedSize === undefined ? '' : ` · ${presentSizeText(presentedSize)}`})`
845
+ : viewTitle(tool.resultView) ?? viewTitle(tool.callView);
649
846
  const headerIsTerminal = view?.card === 'terminal';
650
847
  // Fold the terminal header: multi-line command script (setting-gated) plus
651
848
  // the always-on long-line clip, both off once the card is verbose/expanded
@@ -708,7 +905,7 @@ export function AssistantToolUseMessage({ tool, marginTopOnTurn, verbose, isSele
708
905
  // every reveal step, and the unified diff layout re-diffs its old/new texts
709
906
  // into git hunks — a Claude card carries the whole file. `lang` joins the
710
907
  // deps for the localized rows (patch stats, search totals).
711
- const viewBody = React.useMemo(() => (useSplitDiff || view === undefined ? undefined : viewLines(view)), [useSplitDiff, view, lang]);
908
+ const viewBody = React.useMemo(() => (useSplitDiff || view === undefined ? undefined : viewLines(view, columns, nerdFontIcons, verbose)), [useSplitDiff, view, lang, columns, nerdFontIcons, verbose]);
712
909
  let body = [];
713
910
  if (sendMessage !== undefined) {
714
911
  // 正文 = message 文本预览(长文走既有的三行折叠),summary 作副行;
@@ -790,7 +987,7 @@ export function AssistantToolUseMessage({ tool, marginTopOnTurn, verbose, isSele
790
987
  const disclosure = verbose
791
988
  ? sourceFolded
792
989
  ? [dim(t('tool-card-source-truncated'))]
793
- : tool.resultFull === undefined && tool.resultView !== undefined && !isRunning
990
+ : tool.resultFull === undefined && tool.resultView !== undefined && !isRunning && view?.card !== 'files'
794
991
  ? [dim(t('tool-card-full-unavailable'))]
795
992
  : []
796
993
  : [];
@@ -834,11 +1031,15 @@ export function AssistantToolUseMessage({ tool, marginTopOnTurn, verbose, isSele
834
1031
  // while the row is expanded — growing the body must not make the card lose
835
1032
  // the surface the user chose. Selection is the exception: it owns the row.
836
1033
  const cardToolBackground = isSelected ? 'none' : toolBackground;
837
- const ordinaryBackground = cardToolBackground === 'subtle'
838
- ? 'toolCardBackgroundDim'
839
- : cardToolBackground === 'strong'
840
- ? 'toolCardBackground'
841
- : undefined;
1034
+ // ThemedBox resolves raw `rgb(...)`/`ansi:` strings at render time; the
1035
+ // branded Color type is the boundary it expects.
1036
+ const ordinaryBackground = presentSurface !== undefined
1037
+ ? presentSurface.background
1038
+ : cardToolBackground === 'subtle'
1039
+ ? 'toolCardBackgroundDim'
1040
+ : cardToolBackground === 'strong'
1041
+ ? 'toolCardBackground'
1042
+ : undefined;
842
1043
  // Nested split-diff context panes must yield to whatever paints the card:
843
1044
  // `none` keeps them transparent so the selection highlight, or the root
844
1045
  // card's configured face while expanded, shows through instead of stacking
@@ -860,26 +1061,26 @@ export function AssistantToolUseMessage({ tool, marginTopOnTurn, verbose, isSele
860
1061
  return (_jsx(Box, { ref: viewportRef, flexDirection: "row", justifyContent: "space-between", marginTop: marginTopOnTurn ? 1 : 0, width: "100%", onClick: onClick,
861
1062
  // Only selection paints a highlight; the configured treatment applies
862
1063
  // to an ordinary card. Diff line tints stay - they are content, not chrome.
863
- backgroundColor: isSelected ? 'messageActionsBackground' : hoverTint ? 'toolCardBackground' : ordinaryBackground, onMouseEnter: interactive ? () => setHovered(true) : undefined, onMouseLeave: interactive ? () => setHovered(false) : undefined, children: _jsxs(Box, { flexDirection: "column", flexGrow: 1, children: [_jsxs(Box, { flexDirection: "row", flexWrap: "nowrap", minWidth: minWidth, children: [_jsx(ToolUseLoader, { shouldAnimate: isRunning, isUnresolved: isRunning, isError: isError, toolName: tool.name }), _jsx(HeaderTitle, { name: name, title: headerTitle, isTerminal: headerIsTerminal, folded: foldedHeader, displayArgs: displayArgs, argsLanguage: argsLanguage, nameColor: toolNameColor(tool.name, view?.category ?? tool.callView?.category), filePath: filePath, onOpenFile: onOpenFile, metaTooltip: () => toolCardMetaTooltip(tool, isRunning, isError), headerTextBudget: headerTextBudget }), !isRunning && (_jsx(Box, { flexWrap: "nowrap", children: _jsx(Text, { dimColor: !hovered, children: elapsedText }) })), hovered && (_jsx(Box, { flexShrink: 0, children: _jsx(Text, { dimColor: true, children: isExpanded ? '▴' : '▾' }) }))] }), useSplitDiff && view?.card === 'diff' ? (_jsxs(Box, { flexDirection: "row", children: [_jsx(Box, { width: 3, flexShrink: 0, children: _jsx(Text, { dimColor: true, children: GUTTER_FIRST }) }), _jsx(SplitDiffView, { diffs: view.diffs, width: columns - 4, maxRows: DIFF_BODY_MAX_LINES, verbose: verbose, toolBackground: ordinaryToolBackground, reveal: revealable ? { key: `${revealKey}:split` } : undefined })] })) : (shownLines.map((line, index) => (_jsxs(Box, { flexDirection: "row", children: [_jsx(Box, { width: 3, flexShrink: 0, children: _jsx(Text, { color: line.tone === 'add'
1064
+ backgroundColor: isSelected ? 'messageActionsBackground' : hoverTint ? presentSurface?.hover ?? 'toolCardBackground' : ordinaryBackground, onMouseEnter: interactive ? () => setHovered(true) : undefined, onMouseLeave: interactive ? () => setHovered(false) : undefined, children: _jsxs(Box, { flexDirection: "column", flexGrow: 1, children: [_jsxs(Box, { flexDirection: "row", flexWrap: "nowrap", minWidth: minWidth, children: [_jsx(ToolUseLoader, { shouldAnimate: isRunning, isUnresolved: isRunning, isError: isError, toolName: tool.name }), _jsx(HeaderTitle, { name: name, title: headerTitle, isTerminal: headerIsTerminal, folded: foldedHeader, displayArgs: displayArgs, argsLanguage: argsLanguage, nameColor: toolNameColor(tool.name, view?.category ?? tool.callView?.category), filePath: filePath, onOpenFile: onOpenFile, metaTooltip: () => toolCardMetaTooltip(tool, isRunning, isError), headerTextBudget: headerTextBudget }), !isRunning && (_jsx(Box, { flexWrap: "nowrap", children: _jsx(Text, { dimColor: !hovered, children: elapsedText }) })), hovered && (_jsx(Box, { flexShrink: 0, children: _jsx(Text, { dimColor: true, children: isExpanded ? '▴' : '▾' }) }))] }), useSplitDiff && view?.card === 'diff' ? (_jsxs(Box, { flexDirection: "row", children: [_jsx(Box, { width: 3, flexShrink: 0, children: _jsx(Text, { dimColor: true, children: GUTTER_FIRST }) }), _jsx(SplitDiffView, { diffs: view.diffs, width: columns - 4, maxRows: DIFF_BODY_MAX_LINES, verbose: verbose, toolBackground: ordinaryToolBackground, reveal: revealable ? { key: `${revealKey}:split` } : undefined })] })) : (shownLines.map((line, index) => (_jsxs(Box, { flexDirection: "row", children: [_jsx(Box, { width: 3, flexShrink: 0, children: _jsx(Text, { color: line.tone === 'add'
864
1065
  ? 'diffAddedWord'
865
1066
  : line.tone === 'del'
866
1067
  ? 'diffRemovedWord'
867
1068
  : line.tone === 'path'
868
1069
  ? 'ide'
869
- : undefined, dimColor: line.tone !== 'add' && line.tone !== 'del' && line.tone !== 'path', children: index === 0 ? GUTTER_FIRST : GUTTER_REST }) }), _jsx(Box, { flexGrow: 1, children: line.tone === 'path' && onOpenFile !== undefined ? (_jsxs(Box, { onClick: (event) => {
870
- // Stop propagation so the row's fold toggle does not
871
- // fire when clicking the path.
872
- event.stopImmediatePropagation();
873
- onOpenFile(line.target ?? line.text);
874
- }, children: [_jsx(Text, { color: "ide", underline: true, children: line.text }), line.suffix !== undefined && _jsx(Text, { dimColor: true, children: line.suffix })] })) : (_jsxs(Text, { color: line.tone === 'add'
875
- ? 'diffAddedWord'
876
- : line.tone === 'del'
877
- ? 'diffRemovedWord'
878
- : line.tone === 'error'
879
- ? 'error'
880
- : line.tone === 'hint'
881
- ? 'subtle'
882
- : line.tone === 'path'
883
- ? 'ide'
884
- : undefined, dimColor: (line.tone === 'dim' && !(line.revealOnHover === true && hovered)) || line.tone === 'live', wrap: line.tone === 'live' ? 'truncate-end' : 'wrap', children: [line.tone === 'plain' && syntaxLanguage !== undefined ? (_jsx(SyntaxText, { text: line.text, sourceText: bodySource, lineIndex: index, language: syntaxLanguage })) : (line.text === '' ? ' ' : line.text), line.suffix !== undefined && _jsx(Text, { dimColor: true, children: line.suffix })] })) })] }, index)))), sendMessage !== undefined && sendMessageState !== undefined && (_jsxs(Box, { flexDirection: "row", children: [_jsx(Box, { width: 3, flexShrink: 0, children: _jsx(Text, { dimColor: true, children: GUTTER_REST }) }), _jsx(Text, { color: agentMessageStateColor(sendMessageState), children: agentMessageStateText(sendMessageState) }), sendMessageResumed !== undefined && (_jsx(Text, { dimColor: true, children: ` · ${t('send-message-card-resumed', { id: sendMessageResumed })}` })), sendMessageState === 'unknown' && (_jsx(Text, { dimColor: true, italic: true, children: ` · ${t('agent-message-no-delivery-fact')}` }))] })), useSplitDiff && disclosure.length > 0 && disclosure.map((line, index) => (_jsxs(Box, { flexDirection: "row", children: [_jsx(Box, { width: 3, flexShrink: 0, children: _jsx(Text, { dimColor: true, children: GUTTER_REST }) }), _jsx(Text, { dimColor: true, children: line.text })] }, `disclosure-${index}`))), useSplitDiff && footnote !== undefined && (_jsxs(Box, { flexDirection: "row", children: [_jsx(Box, { width: 3, flexShrink: 0, children: _jsx(Text, { dimColor: true, children: GUTTER_REST }) }), _jsx(Text, { color: "subtle", children: footnote })] }))] }) }));
1070
+ : undefined, dimColor: line.tone !== 'add' && line.tone !== 'del' && line.tone !== 'path', children: index === 0 ? GUTTER_FIRST : GUTTER_REST }) }), _jsxs(Box, { flexGrow: 1, children: [line.lead !== undefined && (_jsx(Text, { color: line.lead.color, bold: line.lead.bold, children: line.lead.text })), (line.tone === 'path' || line.target !== undefined) && onOpenFile !== undefined ? (_jsxs(Box, { onClick: (event) => {
1071
+ // Stop propagation so the row's fold toggle does not
1072
+ // fire when clicking the path.
1073
+ event.stopImmediatePropagation();
1074
+ onOpenFile(line.target ?? line.text);
1075
+ }, children: [_jsx(Text, { color: line.tone === 'path' ? 'ide' : line.color, underline: line.tone === 'path', bold: line.bold, children: line.text }), line.suffix !== undefined && _jsx(Text, { dimColor: true, children: line.suffix })] })) : (_jsxs(Text, { bold: line.bold, color: line.color ?? (line.tone === 'add'
1076
+ ? 'diffAddedWord'
1077
+ : line.tone === 'del'
1078
+ ? 'diffRemovedWord'
1079
+ : line.tone === 'error'
1080
+ ? 'error'
1081
+ : line.tone === 'hint'
1082
+ ? 'subtle'
1083
+ : line.tone === 'path'
1084
+ ? 'ide'
1085
+ : undefined), dimColor: (line.tone === 'dim' && !(line.revealOnHover === true && hovered)) || line.tone === 'live', wrap: line.tone === 'live' ? 'truncate-end' : 'wrap', children: [line.tone === 'plain' && syntaxLanguage !== undefined ? (_jsx(SyntaxText, { text: line.text, sourceText: bodySource, lineIndex: index, language: syntaxLanguage })) : (line.text === '' ? ' ' : line.text), line.suffix !== undefined && _jsx(Text, { dimColor: true, children: line.suffix })] }))] })] }, index)))), sendMessage !== undefined && sendMessageState !== undefined && (_jsxs(Box, { flexDirection: "row", children: [_jsx(Box, { width: 3, flexShrink: 0, children: _jsx(Text, { dimColor: true, children: GUTTER_REST }) }), _jsx(Text, { color: agentMessageStateColor(sendMessageState), children: agentMessageStateText(sendMessageState) }), sendMessageResumed !== undefined && (_jsx(Text, { dimColor: true, children: ` · ${t('send-message-card-resumed', { id: sendMessageResumed })}` })), sendMessageState === 'unknown' && (_jsx(Text, { dimColor: true, italic: true, children: ` · ${t('agent-message-no-delivery-fact')}` }))] })), useSplitDiff && disclosure.length > 0 && disclosure.map((line, index) => (_jsxs(Box, { flexDirection: "row", children: [_jsx(Box, { width: 3, flexShrink: 0, children: _jsx(Text, { dimColor: true, children: GUTTER_REST }) }), _jsx(Text, { dimColor: true, children: line.text })] }, `disclosure-${index}`))), useSplitDiff && footnote !== undefined && (_jsxs(Box, { flexDirection: "row", children: [_jsx(Box, { width: 3, flexShrink: 0, children: _jsx(Text, { dimColor: true, children: GUTTER_REST }) }), _jsx(Text, { color: "subtle", children: footnote })] }))] }) }));
885
1086
  }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * The `present` delivery card's own surface. Deliverables are results, so they
3
+ * keep a face even when the user turned tool-card backgrounds off:
4
+ *
5
+ * - `none` — the palette's warm delivery token (a blend would turn brown on
6
+ * a blue-grey base, so this is a token, not a mix);
7
+ * - `subtle` / `strong` — the palette's delivery tint over its dim/strong
8
+ * card surface. Dark palettes use a deep violet at 20/26% so the face gets
9
+ * more purple without getting lighter; light palettes keep the soft
10
+ * lavender at 18/24%.
11
+ *
12
+ * Hover lifts the same hue toward white instead of switching to
13
+ * `toolCardBackground`, which would make the tint vanish under the pointer.
14
+ */
15
+ import type { ToolBackground } from '../../adapter/ports/channel-display.js';
16
+ import type { Theme } from '../../theme.js';
17
+ /** Resting and hover faces for one card. */
18
+ export interface PresentCardSurface {
19
+ readonly background: string;
20
+ readonly hover: string;
21
+ }
22
+ /**
23
+ * Resolve the delivery face for the user's tool-background setting.
24
+ * @param mode - The global `toolBackground` choice.
25
+ * @param theme - Active palette.
26
+ */
27
+ export declare function presentCardSurface(mode: ToolBackground, theme: Theme): PresentCardSurface;
28
+ //# sourceMappingURL=presentCardBackground.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presentCardBackground.d.ts","sourceRoot":"","sources":["../../../../src/components/messages/presentCardBackground.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAA;AAC5E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAU3C,4CAA4C;AAC5C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,KAAK,GAAG,kBAAkB,CAczF"}
@@ -0,0 +1,23 @@
1
+ import { colorLuma, lightenColor, mixColor } from '../../utils/colorMix.js';
2
+ /** Tint strengths: dark palettes need a heavier, deeper violet. */
3
+ const DARK_SUBTLE_AMOUNT = 0.20;
4
+ const DARK_STRONG_AMOUNT = 0.26;
5
+ const LIGHT_SUBTLE_AMOUNT = 0.18;
6
+ const LIGHT_STRONG_AMOUNT = 0.24;
7
+ const HOVER_LIFT = 0.06;
8
+ /**
9
+ * Resolve the delivery face for the user's tool-background setting.
10
+ * @param mode - The global `toolBackground` choice.
11
+ * @param theme - Active palette.
12
+ */
13
+ export function presentCardSurface(mode, theme) {
14
+ // Light text means a dark palette; an ANSI text colour that cannot be
15
+ // parsed also falls back to the dark recipe.
16
+ const darkPalette = (colorLuma(theme.text) ?? 255) >= 140;
17
+ const background = mode === 'none'
18
+ ? theme.presentCardWarm
19
+ : mixColor(mode === 'subtle' ? theme.toolCardBackgroundDim : theme.toolCardBackground, theme.presentCardTint, darkPalette
20
+ ? (mode === 'subtle' ? DARK_SUBTLE_AMOUNT : DARK_STRONG_AMOUNT)
21
+ : (mode === 'subtle' ? LIGHT_SUBTLE_AMOUNT : LIGHT_STRONG_AMOUNT));
22
+ return { background, hover: lightenColor(background, HOVER_LIFT) };
23
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"translate.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/backend/translate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAElE,OAAO,KA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,KAAK,EAAE,YAAY,EAAqC,MAAM,0BAA0B,CAAA;AAC/F,OAAO,EAAa,KAAK,UAAU,EAAqB,KAAK,cAAc,EAA0D,MAAM,uBAAuB,CAAA;AAElK,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAI3D,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAA;AAU1F,MAAM,WAAW,iBAAiB;IAChC;;0DAEsD;IACtD,KAAK,IAAI,iBAAiB,GAAG,SAAS,CAAA;IACtC;4EACwE;IACxE,KAAK,IAAI,OAAO,CAAA;IAChB;+DAC2D;IAC3D,WAAW,IAAI,OAAO,CAAA;CACvB;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAE5D;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAmEtD;AAyHD,2EAA2E;AAC3E,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,iBAAiB;4BAgM1B,YAAY,KAAG,SAAS,UAAU,EAAE;4BAmKpC,oBAAoB,KAAG,SAAS,UAAU,EAAE;8BAmB1C,SAAS,YAAY,EAAE,KAAG,SAAS,UAAU,EAAE;iBAY9D,IAAI;4BAxVS,MAAM,WAAW,MAAM,KAAG,YAAY,GAAG,SAAS;8BAgBhD,MAAM,WAAW,MAAM,QAAQ,YAAY,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,KAAG,cAAc,GAAG,SAAS;EAiVjI;AAED,MAAM,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAA"}
@@ -4,6 +4,7 @@ import { BACKGROUND_START_ACK, isSubagentToolName, parseJobOutputId, todoPanelIt
4
4
  import { harnessToolResultView, prepareReplayEvents, toolErrorText } from '../channel/transcript.js';
5
5
  import { CompactionPreviews } from '../compat/compaction-previews.js';
6
6
  import { isCompactionCheckpointSource, toolResultPayload } from '../compat/messages.js';
7
+ import { presentToolView } from '../present-tool.js';
7
8
  import { transcriptImagesOf } from '../transcript-images.js';
8
9
  import { isTeamToolName, TEAM_SPAWN_TOOL, teamMessageOf, teamToolCallView, teamToolResultView } from '../team-tools.js';
9
10
  import { refineSessionSearchTitle } from '../session-tools.js';
@@ -154,6 +155,29 @@ const deltaOf = (chunk) => {
154
155
  return OTHER_DELTA;
155
156
  }
156
157
  };
158
+ /** The tool executor's working directory from a settled result's private meta. */
159
+ function resultCwd(meta) {
160
+ if (meta === null || typeof meta !== 'object' || Array.isArray(meta))
161
+ return undefined;
162
+ const cwd = meta.cwd;
163
+ return typeof cwd === 'string' && cwd !== '' ? cwd : undefined;
164
+ }
165
+ /**
166
+ * Absolute paths from a settled `present` result. The tool renders one
167
+ * `Presented <path>` line per declared file (in call order), with the path it
168
+ * resolved against the session working directory. The result content is the
169
+ * durable source; `meta.cwd` is not emitted by the upstream tool.
170
+ */
171
+ function presentedPathsOf(message) {
172
+ const lines = toolResultPayload(message).content
173
+ .map(item => item.type === 'text' ? item.text ?? '' : '')
174
+ .join('\n')
175
+ .split('\n')
176
+ .filter(line => line !== '');
177
+ if (lines.length === 0 || !lines.every(line => line.startsWith('Presented ')))
178
+ return undefined;
179
+ return lines.map(line => line.slice('Presented '.length));
180
+ }
157
181
  /** Create one translator; it serves exactly one session's event stream. */
158
182
  export function createDshTranslator(deps) {
159
183
  /** Frame revisions are monotone within one attached Agent lifecycle; a
@@ -206,7 +230,7 @@ export function createDshTranslator(deps) {
206
230
  try {
207
231
  const tool = deps.tools()?.get(name, deps.scope());
208
232
  if (tool?.presentCall === undefined)
209
- return teamToolCallView(name, rawArgs);
233
+ return presentToolView(name, rawArgs) ?? teamToolCallView(name, rawArgs);
210
234
  // The session-search calls carry a static sentence the card header would
211
235
  // repeat verbatim; put the query back in the header (session-tools.ts),
212
236
  // and the branch in a create_worktree header (worktree-tool.ts).
@@ -230,6 +254,9 @@ export function createDshTranslator(deps) {
230
254
  return local;
231
255
  const tool = deps.tools()?.get(name, deps.scope());
232
256
  if (tool?.presentResult === undefined) {
257
+ const presented = presentToolView(name, rawArgs, resultCwd(data.meta), name === 'present' ? presentedPathsOf(data.message) : undefined);
258
+ if (presented !== undefined)
259
+ return presented;
233
260
  // Only the team and worktree tools read the text: skip joining every
234
261
  // other result.
235
262
  if (!isTeamToolName(name) && name !== WORKTREE_TOOL)
@@ -1 +1 @@
1
- {"version":3,"file":"compose.d.ts","sourceRoot":"","sources":["../../../../../src/dsh-adapter/channel/core/compose.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gDAAgD,CAAA;AAGvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAW7D,OAAO,EAA4D,KAAK,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAQ9H,OAAO,EAAsB,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAG/E,OAAO,EAAwB,KAAK,YAAY,EAAE,MAAM,aAAa,CAAA;AAIrE,OAAO,EAA8C,KAAK,oBAAoB,EAAuB,MAAM,aAAa,CAAA;AACxH,OAAO,KAAK,EAAE,YAAY,EAA0B,MAAM,aAAa,CAAA;AAEvE,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAA;AAC5E,OAAO,EAA0C,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAC3F,OAAO,EAAqE,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAA;AAO5G,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,EAAkE,KAAK,gBAAgB,EAAE,KAAK,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAYrJ;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;+EAC2E;IAC3E,eAAe,CAAC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IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,WAAW,CAAC,CAAA;IACtD,KAAK,EAAE,MAAM,YAAY,CAAA;IACzB,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,WAAW,GAAG,cAAc,CAAC,CAAA;IAClD,sEAAsE;IACtE,aAAa,IAAI,OAAO,CAAA;IACxB,gEAAgE;IAChE,UAAU,CAAC,IAAI,SAAS,MAAM,EAAE,GAAG,SAAS,CAAA;CAC7C;sBAIwB,SAAS,GAAG,SAAS;;cA7ChC,CAAA;YAAmB,CAAC;;;IA0D9B,qEAAqE;gCACzC,iBAAiB,GAAG,YAAY,CAAC,oBAAoB,CAAC;EAYrF"}
@@ -1,6 +1,6 @@
1
1
  import type { FileCandidate } from '../../utils/fileSuggestions.js';
2
2
  import type { MentionFs } from './types.js';
3
- /** Workspace file queries and their per-cwd scan cache. */
3
+ /** Workspace file queries and their short-lived, per-cwd scan cache. */
4
4
  export declare function createFileActions(deps: {
5
5
  owner: {
6
6
  current(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"file-actions.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/file-actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAGnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,2DAA2D;AAC3D,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,KAAK,EAAE;QAAE,OAAO,IAAI,OAAO,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;KAAE,CAAA;IAC3D,OAAO,IAAI,OAAO,CAAA;IAClB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAA;IAClC,GAAG,IAAI,MAAM,CAAA;IACb,EAAE,IAAI,SAAS,GAAG,SAAS,CAAA;CAC5B;gCAQU,MAAM,YACH;QAAE,MAAM,CAAC,EAAE,WAAW,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAChD,OAAO,CAAC,SAAS,aAAa,EAAE,CAAC;qBA2BR,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC;EAQvD"}
1
+ {"version":3,"file":"file-actions.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/file-actions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAGnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAE3C,wEAAwE;AACxE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE;IACtC,KAAK,EAAE;QAAE,OAAO,IAAI,OAAO,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;KAAE,CAAA;IAC3D,OAAO,IAAI,OAAO,CAAA;IAClB,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAA;IAClC,GAAG,IAAI,MAAM,CAAA;IACb,EAAE,IAAI,SAAS,GAAG,SAAS,CAAA;CAC5B;gCAQU,MAAM,YACH;QAAE,MAAM,CAAC,EAAE,WAAW,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,KAChD,OAAO,CAAC,SAAS,aAAa,EAAE,CAAC;qBAiCR,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC;EAQvD"}
@@ -1,6 +1,6 @@
1
1
  import { isPathLikeQuery, rankFileCandidates } from '../../utils/fileSuggestions.js';
2
2
  import { listFilesDeepCandidates, listPathCandidates } from './paths.js';
3
- /** Workspace file queries and their per-cwd scan cache. */
3
+ /** Workspace file queries and their short-lived, per-cwd scan cache. */
4
4
  export function createFileActions(deps) {
5
5
  let cache = { cwd: '' };
6
6
  const isCurrent = (capture, cwd) => deps.owner.current() && deps.current(capture) && deps.cwd() === cwd;
@@ -16,7 +16,8 @@ export function createFileActions(deps) {
16
16
  const result = await listPathCandidates(fs, cwd, query, signal, options?.topK ?? 50);
17
17
  return isCurrent(capture, cwd) && !signal.aborted ? result : [];
18
18
  }
19
- if (cache.cwd !== cwd)
19
+ const age = cache.completedAt === undefined ? 0 : Date.now() - cache.completedAt;
20
+ if (cache.cwd !== cwd || age < 0 || age >= 2000)
20
21
  cache = { cwd };
21
22
  const scan = cache;
22
23
  // The scan belongs to this Channel/CWD cache entry, not to its first
@@ -26,8 +27,14 @@ export function createFileActions(deps) {
26
27
  // Do not retain a cancelled/empty observation; a later request may have
27
28
  // a live owner or find files that appeared after this scan. An older
28
29
  // CWD scan must not clear a newer entry after it settles.
29
- if (candidates.length === 0 && cache === scan)
30
- scan.load = undefined;
30
+ if (cache === scan) {
31
+ if (candidates.length === 0)
32
+ scan.load = undefined;
33
+ // Expiry is checked only by a later query, never a background timer.
34
+ // Start it after completion so slow scans still coalesce waiters.
35
+ else
36
+ scan.completedAt = Date.now();
37
+ }
31
38
  return candidates;
32
39
  });
33
40
  const candidates = await scan.load;
@@ -1 +1 @@
1
- {"version":3,"file":"settings-host.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/settings-host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAGtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAIvD,OAAO,KAAK,EAAE,qBAAqB,EAAqE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAkC3K,mFAAmF;AACnF,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,qBAAqB,EAAE,GAAG,kBAAkB,EAAE,CA8O1H;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,aAAa,EAAE,YAAY,GAAE,MAAM,IAAsB,GAAG,IAAI,CAAC,YAAY,EAAE,cAAc,GAAG,eAAe,GAAG,uBAAuB,GAAG,aAAa,CAAC,CA4VlM"}
1
+ {"version":3,"file":"settings-host.d.ts","sourceRoot":"","sources":["../../../../src/dsh-adapter/channel/settings-host.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAGtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAIvD,OAAO,KAAK,EAAE,qBAAqB,EAAqE,kBAAkB,EAAE,MAAM,yCAAyC,CAAA;AAkC3K,mFAAmF;AACnF,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,qBAAqB,EAAE,GAAG,kBAAkB,EAAE,CA8S1H;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,aAAa,EAAE,YAAY,GAAE,MAAM,IAAsB,GAAG,IAAI,CAAC,YAAY,EAAE,cAAc,GAAG,eAAe,GAAG,uBAAuB,GAAG,aAAa,CAAC,CA8VlM"}