@huanlin/dsh-plugin-merge-tool-calls 0.2.2 → 0.3.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/client.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","names":["DEFAULT_MERGE_CONFIG: MergeToolCallsConfig","dicts: Record<string, Record<MergeToolCallsKey, string>>","ALL_TOOL_NAMES: readonly string[]","VARIANT_TITLES: Record<ToolVariant, string>","TOOL_VARIANTS: Record<string, ToolVariant>","TOOL_TITLES: Record<string, string>","parts: string[]","parsed: unknown","SUMMARY_KEYS: Record<ToolVariant, readonly string[]>","FILE_PATH_VARIANTS: ReadonlySet<ToolVariant>","state: RowState","out: DiffHunk[]","diffs","blocks: ToolCallBlock[]","VARIANT_ICONS: Record<ToolVariant, ReactNode>","IconSearchOutline16","IconBrowseOutline16","IconApiOutline14","IconEditOutline16","IconCodeOutline16","IconSparkle16","VARIANT_COUNT_KEY: Record<ToolVariant, 'countFiles' | 'countQueries' | 'countCommands' | 'countPrograms' | 'countCalls'>","StateDot","TerminalBlock","DiffBlock","ReadBlock","SearchBlock","WebBlock","RowCard","DisclosureRow","ChildRow","cfg: MergeToolCallsConfig","dispose: (() => void) | undefined"],"sources":["../src/types.ts","../src/client/dictionaries.ts","../src/client/locales.ts","../src/client/tool-names.ts","../src/client/card-model.ts","../src/client/merge-run.ts","../src/client/rows.tsx","../src/client/styles.ts","../src/client/index.ts"],"sourcesContent":["/** Shared config surface of the merge-tool-calls plugin (host + client halves). */\n\n/** How consecutive same-tool calls are grouped into one merged card. */\nexport type MergeGroupMode = 'adjacent' | 'step'\n\n/** Plugin configuration; defaults live in the Schemastery schema and cordis.patch.yml. */\nexport interface MergeToolCallsConfig {\n /**\n * Wire tool names whose consecutive calls merge. Empty = every built-in\n * generic-family tool (read/grep/glob/edit/write/bash/pwsh/web_search/\n * web_fetch/run_code/cordis_package_inspect/cordis_runtime_inspect); a\n * non-empty list is an explicit whitelist (any wire name works).\n */\n readonly tools: readonly string[]\n /** `adjacent`: any consecutive run in the chat flow; `step`: only within one agent step. */\n readonly groupBy: MergeGroupMode\n /** Max calls per merged group; the run is truncated and the excess starts a new group. */\n readonly maxGroupSize: number\n}\n\n/** Runtime defaults applied when a half receives no config (defensive only). */\nexport const DEFAULT_MERGE_CONFIG: MergeToolCallsConfig = {\n tools: [],\n groupBy: 'adjacent',\n maxGroupSize: 8,\n}\n","/**\n * The 19 better-locale override languages for the merged tool-call row copy,\n * keyed by language id. Each dictionary carries the same key set as `en`/`zh`\n * in `./locales.ts` (enforced by the `Record<MergeToolCallsKey, string>`\n * annotation); values keep `{placeholder}` interpolation (e.g. `{n}` in\n * `mergedCount`), matching the better-locale store's `LocaleDict` contract.\n *\n * The apply function registers these into `ctx.betterLocale` (the override\n * store) under `NS`, so when the user selects an override language through\n * dsh-plugin-better-locale (and DSH is on 'en', whose slot the override\n * borrows), the row copy renders in the override language.\n */\nimport type { MergeToolCallsKey } from './locales.ts'\n\n/** All override-language dictionaries for the `NS` namespace. */\nexport const dicts: Record<string, Record<MergeToolCallsKey, string>> = {\n ja: {\n running: '実行中',\n failed: '失敗',\n stopped: '中断',\n expand: '展開',\n collapse: '折りたたむ',\n more: '+{n}',\n showLess: '残りを閉じる',\n mergedCount: '{n} 回の呼び出しを統合',\n countFiles: '{n} 個のファイル',\n countQueries: '{n} 回の検索',\n countCommands: '{n} 個のコマンド',\n countPrograms: '{n} 個のプログラム',\n countCalls: '{n} 回の呼び出し',\n 'terminal.signal': 'シグナル {signal}',\n 'terminal.exitCode': '終了コード {code}',\n 'terminal.running': '実行中',\n 'terminal.failed': '失敗',\n 'terminal.done': '完了',\n 'terminal.copy': 'コピー',\n 'terminal.copied': 'コピーしました',\n 'terminal.noOutput': '出力なし',\n 'terminal.collapseAria': '出力を折りたたむ',\n 'terminal.collapse': '折りたたむ',\n 'terminal.expandAria': '残り {n} 行の出力を展開',\n 'terminal.expandRest': '… 残り {n} 行',\n },\n de: {\n running: 'Läuft',\n failed: 'Fehlgeschlagen',\n stopped: 'Unterbrochen',\n expand: 'Erweitern',\n collapse: 'Einklappen',\n more: '+{n}',\n showLess: 'Weniger anzeigen',\n mergedCount: '{n} Aufrufe zusammengeführt',\n countFiles: '{n} Dateien',\n countQueries: '{n} Suchanfragen',\n countCommands: '{n} Befehle',\n countPrograms: '{n} Programme',\n countCalls: '{n} Aufrufe',\n 'terminal.signal': 'Signal {signal}',\n 'terminal.exitCode': 'Exit-Code {code}',\n 'terminal.running': 'Läuft',\n 'terminal.failed': 'Fehlgeschlagen',\n 'terminal.done': 'Abgeschlossen',\n 'terminal.copy': 'Kopieren',\n 'terminal.copied': 'Kopiert',\n 'terminal.noOutput': 'Keine Ausgabe',\n 'terminal.collapseAria': 'Ausgabe einklappen',\n 'terminal.collapse': 'Einklappen',\n 'terminal.expandAria': 'Die restlichen {n} Ausgabezeilen ausklappen',\n 'terminal.expandRest': '… {n} weitere Zeilen',\n },\n fr: {\n running: 'En cours',\n failed: 'Échec',\n stopped: 'Interrompu',\n expand: 'Développer',\n collapse: 'Réduire',\n more: '+{n}',\n showLess: 'Afficher moins',\n mergedCount: '{n} appels fusionnés',\n countFiles: '{n} fichiers',\n countQueries: '{n} recherches',\n countCommands: '{n} commandes',\n countPrograms: '{n} programmes',\n countCalls: '{n} appels',\n 'terminal.signal': 'Signal {signal}',\n 'terminal.exitCode': 'Code de sortie {code}',\n 'terminal.running': 'En cours',\n 'terminal.failed': 'Échec',\n 'terminal.done': 'Terminé',\n 'terminal.copy': 'Copier',\n 'terminal.copied': 'Copié',\n 'terminal.noOutput': 'Aucune sortie',\n 'terminal.collapseAria': 'Réduire la sortie',\n 'terminal.collapse': 'Réduire',\n 'terminal.expandAria': 'Déployer les {n} lignes de sortie restantes',\n 'terminal.expandRest': '… {n} lignes restantes',\n },\n pt: {\n running: 'Executando',\n failed: 'Falhou',\n stopped: 'Interrompido',\n expand: 'Expandir',\n collapse: 'Recolher',\n more: '+{n}',\n showLess: 'Mostrar menos',\n mergedCount: '{n} chamadas mescladas',\n countFiles: '{n} arquivos',\n countQueries: '{n} pesquisas',\n countCommands: '{n} comandos',\n countPrograms: '{n} programas',\n countCalls: '{n} chamadas',\n 'terminal.signal': 'sinal {signal}',\n 'terminal.exitCode': 'código de saída {code}',\n 'terminal.running': 'Executando',\n 'terminal.failed': 'Falhou',\n 'terminal.done': 'Concluído',\n 'terminal.copy': 'Copiar',\n 'terminal.copied': 'Copiado',\n 'terminal.noOutput': 'Sem saída',\n 'terminal.collapseAria': 'Recolher saída',\n 'terminal.collapse': 'Recolher',\n 'terminal.expandAria': 'Expandir as {n} linhas de saída restantes',\n 'terminal.expandRest': '… mais {n} linhas',\n },\n ko: {\n running: '실행 중',\n failed: '실패',\n stopped: '중단됨',\n expand: '펼치기',\n collapse: '접기',\n more: '+{n}',\n showLess: '더 적게 표시',\n mergedCount: '{n}번 호출 병합됨',\n countFiles: '파일 {n}개',\n countQueries: '검색 {n}회',\n countCommands: '명령 {n}개',\n countPrograms: '프로그램 {n}개',\n countCalls: '호출 {n}회',\n 'terminal.signal': '신호 {signal}',\n 'terminal.exitCode': '종료 코드 {code}',\n 'terminal.running': '실행 중',\n 'terminal.failed': '실패',\n 'terminal.done': '완료',\n 'terminal.copy': '복사',\n 'terminal.copied': '복사됨',\n 'terminal.noOutput': '출력 없음',\n 'terminal.collapseAria': '출력 접기',\n 'terminal.collapse': '접기',\n 'terminal.expandAria': '나머지 {n}줄 출력 펼치기',\n 'terminal.expandRest': '… 나머지 {n}줄',\n },\n ar: {\n running: 'قيد التشغيل',\n failed: 'فشل',\n stopped: 'متوقف',\n expand: 'توسيع',\n collapse: 'طي',\n more: '+{n}',\n showLess: 'إظهار أقل',\n mergedCount: 'تم دمج {n} استدعاء',\n countFiles: '{n} ملف',\n countQueries: '{n} بحث',\n countCommands: '{n} أمر',\n countPrograms: '{n} برنامج',\n countCalls: '{n} استدعاء',\n 'terminal.signal': 'إشارة {signal}',\n 'terminal.exitCode': 'رمز الخروج {code}',\n 'terminal.running': 'قيد التشغيل',\n 'terminal.failed': 'فشل',\n 'terminal.done': 'اكتمل',\n 'terminal.copy': 'نسخ',\n 'terminal.copied': 'تم النسخ',\n 'terminal.noOutput': 'لا يوجد إخراج',\n 'terminal.collapseAria': 'طي الإخراج',\n 'terminal.collapse': 'طي',\n 'terminal.expandAria': 'توسيع {n} أسطر إخراج المتبقية',\n 'terminal.expandRest': '… و{n} أسطر أخرى',\n },\n hi: {\n running: 'चल रहा',\n failed: 'विफल',\n stopped: 'रोका गया',\n expand: 'विस्तार करें',\n collapse: 'संक्षिप्त करें',\n more: '+{n}',\n showLess: 'कम दिखाएं',\n mergedCount: '{n} कॉल मर्ज किए गए',\n countFiles: '{n} फ़ाइलें',\n countQueries: '{n} खोज',\n countCommands: '{n} कमांड',\n countPrograms: '{n} प्रोग्राम',\n countCalls: '{n} कॉल',\n 'terminal.signal': 'सिग्नल {signal}',\n 'terminal.exitCode': 'एग्ज़िट कोड {code}',\n 'terminal.running': 'चल रहा',\n 'terminal.failed': 'विफल',\n 'terminal.done': 'पूर्ण',\n 'terminal.copy': 'कॉपी',\n 'terminal.copied': 'कॉपी हो गया',\n 'terminal.noOutput': 'कोई आउटपुट नहीं',\n 'terminal.collapseAria': 'आउटपुट संक्षिप्त करें',\n 'terminal.collapse': 'संक्षिप्त करें',\n 'terminal.expandAria': 'शेष {n} आउटपुट पंक्तियाँ विस्तृत करें',\n 'terminal.expandRest': '… {n} और पंक्तियाँ',\n },\n id: {\n running: 'Berjalan',\n failed: 'Gagal',\n stopped: 'Dihentikan',\n expand: 'Bentangkan',\n collapse: 'Lipat',\n more: '+{n}',\n showLess: 'Tampilkan lebih sedikit',\n mergedCount: '{n} panggilan digabungkan',\n countFiles: '{n} file',\n countQueries: '{n} pencarian',\n countCommands: '{n} perintah',\n countPrograms: '{n} program',\n countCalls: '{n} panggilan',\n 'terminal.signal': 'sinyal {signal}',\n 'terminal.exitCode': 'kode keluar {code}',\n 'terminal.running': 'Berjalan',\n 'terminal.failed': 'Gagal',\n 'terminal.done': 'Selesai',\n 'terminal.copy': 'Salin',\n 'terminal.copied': 'Tersalin',\n 'terminal.noOutput': 'Tidak ada keluaran',\n 'terminal.collapseAria': 'Lipat keluaran',\n 'terminal.collapse': 'Lipat',\n 'terminal.expandAria': 'Bentangkan {n} baris keluaran tersisa',\n 'terminal.expandRest': '… {n} baris lagi',\n },\n tr: {\n running: 'Çalışıyor',\n failed: 'Başarısız',\n stopped: 'Durduruldu',\n expand: 'Genişlet',\n collapse: 'Daralt',\n more: '+{n}',\n showLess: 'Daha az göster',\n mergedCount: '{n} çağrı birleştirildi',\n countFiles: '{n} dosya',\n countQueries: '{n} arama',\n countCommands: '{n} komut',\n countPrograms: '{n} program',\n countCalls: '{n} çağrı',\n 'terminal.signal': 'sinyal {signal}',\n 'terminal.exitCode': 'çıkış kodu {code}',\n 'terminal.running': 'Çalışıyor',\n 'terminal.failed': 'Başarısız',\n 'terminal.done': 'Tamamlandı',\n 'terminal.copy': 'Kopyala',\n 'terminal.copied': 'Kopyalandı',\n 'terminal.noOutput': 'Çıkış yok',\n 'terminal.collapseAria': 'Çıkışı daralt',\n 'terminal.collapse': 'Daralt',\n 'terminal.expandAria': 'Kalan {n} çıkış satırını genişlet',\n 'terminal.expandRest': '… {n} satır daha',\n },\n vi: {\n running: 'Đang chạy',\n failed: 'Thất bại',\n stopped: 'Đã dừng',\n expand: 'Mở rộng',\n collapse: 'Thu gọn',\n more: '+{n}',\n showLess: 'Hiển thị ít hơn',\n mergedCount: 'Đã gộp {n} lệnh gọi',\n countFiles: '{n} tệp',\n countQueries: '{n} lượt tìm kiếm',\n countCommands: '{n} lệnh',\n countPrograms: '{n} chương trình',\n countCalls: '{n} lượt gọi',\n 'terminal.signal': 'tín hiệu {signal}',\n 'terminal.exitCode': 'mã thoát {code}',\n 'terminal.running': 'Đang chạy',\n 'terminal.failed': 'Thất bại',\n 'terminal.done': 'Đã xong',\n 'terminal.copy': 'Sao chép',\n 'terminal.copied': 'Đã sao chép',\n 'terminal.noOutput': 'Không có đầu ra',\n 'terminal.collapseAria': 'Thu gọn đầu ra',\n 'terminal.collapse': 'Thu gọn',\n 'terminal.expandAria': 'Mở rộng {n} dòng đầu ra còn lại',\n 'terminal.expandRest': '… còn {n} dòng',\n },\n th: {\n running: 'กำลังทำงาน',\n failed: 'ล้มเหลว',\n stopped: 'ถูกขัดจังหวะ',\n expand: 'ขยาย',\n collapse: 'ย่อ',\n more: '+{n}',\n showLess: 'แสดงน้อยลง',\n mergedCount: 'รวม {n} การเรียก',\n countFiles: '{n} ไฟล์',\n countQueries: '{n} การค้นหา',\n countCommands: '{n} คำสั่ง',\n countPrograms: '{n} โปรแกรม',\n countCalls: '{n} การเรียก',\n 'terminal.signal': 'สัญญาณ {signal}',\n 'terminal.exitCode': 'รหัสออก {code}',\n 'terminal.running': 'กำลังทำงาน',\n 'terminal.failed': 'ล้มเหลว',\n 'terminal.done': 'เสร็จสิ้น',\n 'terminal.copy': 'คัดลอก',\n 'terminal.copied': 'คัดลอกแล้ว',\n 'terminal.noOutput': 'ไม่มีเอาต์พุต',\n 'terminal.collapseAria': 'ย่อเอาต์พุต',\n 'terminal.collapse': 'ย่อ',\n 'terminal.expandAria': 'ขยายเอาต์พุตอีก {n} บรรทัด',\n 'terminal.expandRest': '… อีก {n} บรรทัด',\n },\n ru: {\n running: 'Выполняется',\n failed: 'Сбой',\n stopped: 'Прервано',\n expand: 'Развернуть',\n collapse: 'Свернуть',\n more: '+{n}',\n showLess: 'Показать меньше',\n mergedCount: 'Объединено вызовов: {n}',\n countFiles: '{n} файлов',\n countQueries: '{n} поисков',\n countCommands: '{n} команд',\n countPrograms: '{n} программ',\n countCalls: '{n} вызовов',\n 'terminal.signal': 'сигнал {signal}',\n 'terminal.exitCode': 'код выхода {code}',\n 'terminal.running': 'Выполняется',\n 'terminal.failed': 'Сбой',\n 'terminal.done': 'Завершено',\n 'terminal.copy': 'Копировать',\n 'terminal.copied': 'Скопировано',\n 'terminal.noOutput': 'Нет вывода',\n 'terminal.collapseAria': 'Свернуть вывод',\n 'terminal.collapse': 'Свернуть',\n 'terminal.expandAria': 'Показать оставшиеся {n} строк вывода',\n 'terminal.expandRest': '… ещё {n} строк',\n },\n it: {\n running: 'In esecuzione',\n failed: 'Non riuscito',\n stopped: 'Interrotto',\n expand: 'Espandi',\n collapse: 'Comprimi',\n more: '+{n}',\n showLess: 'Mostra meno',\n mergedCount: '{n} chiamate unite',\n countFiles: '{n} file',\n countQueries: '{n} ricerche',\n countCommands: '{n} comandi',\n countPrograms: '{n} programmi',\n countCalls: '{n} chiamate',\n 'terminal.signal': 'segnale {signal}',\n 'terminal.exitCode': 'codice di uscita {code}',\n 'terminal.running': 'In esecuzione',\n 'terminal.failed': 'Non riuscito',\n 'terminal.done': 'Completato',\n 'terminal.copy': 'Copia',\n 'terminal.copied': 'Copiato',\n 'terminal.noOutput': 'Nessun output',\n 'terminal.collapseAria': 'Comprimi output',\n 'terminal.collapse': 'Comprimi',\n 'terminal.expandAria': 'Espandi le restanti {n} righe di output',\n 'terminal.expandRest': '… altre {n} righe',\n },\n nl: {\n running: 'Actief',\n failed: 'Mislukt',\n stopped: 'Onderbroken',\n expand: 'Uitklappen',\n collapse: 'Inklappen',\n more: '+{n}',\n showLess: 'Minder tonen',\n mergedCount: '{n} aanroepen samengevoegd',\n countFiles: '{n} bestanden',\n countQueries: '{n} zoekopdrachten',\n countCommands: '{n} opdrachten',\n countPrograms: '{n} programma\\'s',\n countCalls: '{n} aanroepen',\n 'terminal.signal': 'signaal {signal}',\n 'terminal.exitCode': 'exit-code {code}',\n 'terminal.running': 'Actief',\n 'terminal.failed': 'Mislukt',\n 'terminal.done': 'Voltooid',\n 'terminal.copy': 'Kopiëren',\n 'terminal.copied': 'Gekopieerd',\n 'terminal.noOutput': 'Geen uitvoer',\n 'terminal.collapseAria': 'Uitvoer inklappen',\n 'terminal.collapse': 'Inklappen',\n 'terminal.expandAria': 'De overige {n} uitvoerregels uitklappen',\n 'terminal.expandRest': '… nog {n} regels',\n },\n sv: {\n running: 'Kör',\n failed: 'Misslyckades',\n stopped: 'Avbruten',\n expand: 'Expandera',\n collapse: 'Komprimera',\n more: '+{n}',\n showLess: 'Visa mindre',\n mergedCount: '{n} anrop sammanslagna',\n countFiles: '{n} filer',\n countQueries: '{n} sökningar',\n countCommands: '{n} kommandon',\n countPrograms: '{n} program',\n countCalls: '{n} anrop',\n 'terminal.signal': 'signal {signal}',\n 'terminal.exitCode': 'slutkod {code}',\n 'terminal.running': 'Kör',\n 'terminal.failed': 'Misslyckades',\n 'terminal.done': 'Klar',\n 'terminal.copy': 'Kopiera',\n 'terminal.copied': 'Kopierades',\n 'terminal.noOutput': 'Ingen utdata',\n 'terminal.collapseAria': 'Komprimera utdata',\n 'terminal.collapse': 'Komprimera',\n 'terminal.expandAria': 'Expandera de återstående {n} utdataraderna',\n 'terminal.expandRest': '… {n} fler rader',\n },\n pl: {\n running: 'Działa',\n failed: 'Nie powiodło się',\n stopped: 'Przerwano',\n expand: 'Rozwiń',\n collapse: 'Zwiń',\n more: '+{n}',\n showLess: 'Pokaż mniej',\n mergedCount: 'Połączono {n} wywołań',\n countFiles: '{n} plików',\n countQueries: '{n} wyszukań',\n countCommands: '{n} poleceń',\n countPrograms: '{n} programów',\n countCalls: '{n} wywołań',\n 'terminal.signal': 'sygnał {signal}',\n 'terminal.exitCode': 'kod wyjścia {code}',\n 'terminal.running': 'Działa',\n 'terminal.failed': 'Nie powiodło się',\n 'terminal.done': 'Ukończono',\n 'terminal.copy': 'Kopiuj',\n 'terminal.copied': 'Skopiowano',\n 'terminal.noOutput': 'Brak wyjścia',\n 'terminal.collapseAria': 'Zwiń wyjście',\n 'terminal.collapse': 'Zwiń',\n 'terminal.expandAria': 'Rozwiń pozostałe {n} wierszy wyjścia',\n 'terminal.expandRest': '…jeszcze {n} wierszy',\n },\n 'zh-HK': {\n running: '執行中',\n failed: '失敗',\n stopped: '已中斷',\n expand: '展開',\n collapse: '收起',\n more: '+{n}',\n showLess: '收起其餘',\n mergedCount: '已合併 {n} 次呼叫',\n countFiles: '{n} 個檔案',\n countQueries: '{n} 次搜尋',\n countCommands: '{n} 條命令',\n countPrograms: '{n} 段程式碼',\n countCalls: '{n} 次呼叫',\n 'terminal.signal': '訊號 {signal}',\n 'terminal.exitCode': '退出碼 {code}',\n 'terminal.running': '執行中',\n 'terminal.failed': '失敗',\n 'terminal.done': '已完成',\n 'terminal.copy': '複製',\n 'terminal.copied': '已複製',\n 'terminal.noOutput': '無輸出',\n 'terminal.collapseAria': '收起輸出',\n 'terminal.collapse': '收起',\n 'terminal.expandAria': '展開其餘 {n} 行輸出',\n 'terminal.expandRest': '… 其餘 {n} 行',\n },\n 'zh-TW': {\n running: '執行中',\n failed: '失敗',\n stopped: '已中斷',\n expand: '展開',\n collapse: '收起',\n more: '+{n}',\n showLess: '收起其餘',\n mergedCount: '已合併 {n} 次呼叫',\n countFiles: '{n} 個檔案',\n countQueries: '{n} 次搜尋',\n countCommands: '{n} 條命令',\n countPrograms: '{n} 段程式碼',\n countCalls: '{n} 次呼叫',\n 'terminal.signal': '訊號 {signal}',\n 'terminal.exitCode': '退出碼 {code}',\n 'terminal.running': '執行中',\n 'terminal.failed': '失敗',\n 'terminal.done': '已完成',\n 'terminal.copy': '複製',\n 'terminal.copied': '已複製',\n 'terminal.noOutput': '無輸出',\n 'terminal.collapseAria': '收起輸出',\n 'terminal.collapse': '收起',\n 'terminal.expandAria': '展開其餘 {n} 行輸出',\n 'terminal.expandRest': '… 其餘 {n} 行',\n },\n 'zh-MO': {\n running: '執行中',\n failed: '失敗',\n stopped: '已中斷',\n expand: '展開',\n collapse: '收起',\n more: '+{n}',\n showLess: '收起其餘',\n mergedCount: '已合併 {n} 次呼叫',\n countFiles: '{n} 個檔案',\n countQueries: '{n} 次搜尋',\n countCommands: '{n} 條命令',\n countPrograms: '{n} 段程式碼',\n countCalls: '{n} 次呼叫',\n 'terminal.signal': '訊號 {signal}',\n 'terminal.exitCode': '退出碼 {code}',\n 'terminal.running': '執行中',\n 'terminal.failed': '失敗',\n 'terminal.done': '已完成',\n 'terminal.copy': '複製',\n 'terminal.copied': '已複製',\n 'terminal.noOutput': '無輸出',\n 'terminal.collapseAria': '收起輸出',\n 'terminal.collapse': '收起',\n 'terminal.expandAria': '展開其餘 {n} 行輸出',\n 'terminal.expandRest': '… 其餘 {n} 行',\n },\n}","/** Product copy for the merged tool-call rows. */\nexport const zh = {\n running: '进行中',\n failed: '失败',\n stopped: '已中断',\n expand: '展开',\n collapse: '折叠',\n more: '+{n}',\n showLess: '收起其余',\n mergedCount: '已合并 {n} 次调用',\n countFiles: '{n} 个文件',\n countQueries: '{n} 次搜索',\n countCommands: '{n} 条命令',\n countPrograms: '{n} 段代码',\n countCalls: '{n} 次调用',\n 'terminal.signal': '信号 {signal}',\n 'terminal.exitCode': '退出码 {code}',\n 'terminal.running': '运行中',\n 'terminal.failed': '失败',\n 'terminal.done': '已完成',\n 'terminal.copy': '复制',\n 'terminal.copied': '已复制',\n 'terminal.noOutput': '无输出',\n 'terminal.collapseAria': '收起输出',\n 'terminal.collapse': '折叠',\n 'terminal.expandAria': '展开其余 {n} 行输出',\n 'terminal.expandRest': '… 其余 {n} 行',\n} satisfies Record<string, string>\n\nexport type MergeToolCallsKey = keyof typeof zh\n\nexport const en = {\n running: 'Running',\n failed: 'Failed',\n stopped: 'Interrupted',\n expand: 'Expand',\n collapse: 'Collapse',\n more: '+{n}',\n showLess: 'Show fewer',\n mergedCount: '{n} calls merged',\n countFiles: '{n} Files',\n countQueries: '{n} Queries',\n countCommands: '{n} Commands',\n countPrograms: '{n} Programs',\n countCalls: '{n} Calls',\n 'terminal.signal': 'signal {signal}',\n 'terminal.exitCode': 'exit code {code}',\n 'terminal.running': 'Running',\n 'terminal.failed': 'Failed',\n 'terminal.done': 'Done',\n 'terminal.copy': 'Copy',\n 'terminal.copied': 'Copied',\n 'terminal.noOutput': 'No output',\n 'terminal.collapseAria': 'Collapse output',\n 'terminal.collapse': 'Collapse',\n 'terminal.expandAria': 'Expand the remaining {n} output lines',\n 'terminal.expandRest': '… {n} more lines',\n} satisfies Record<MergeToolCallsKey, string>\n\nexport const NS = 'merge-tool-calls'\n","/**\n * The built-in tool universe this plugin shadows by default, plus the\n * variant-classification vocabulary mirroring ui-tool's tool-call model.\n *\n * The keyed `tool.call.toolview` slot dispatches on the exact wire tool name,\n * so a shadowed registration is needed per name (there is no wildcard). This\n * list names every shipped tool whose row belongs to the generic ToolRow\n * family — a variant title/icon plus read/search/diff/terminal/web card or\n * IN/OUT text — which the merged row reproduces faithfully.\n *\n * Deliberately excluded: tools with custom row cards this plugin does not\n * replicate (`skill`, `cordis_define`, and the live `cordis_run` /\n * `cordis_stop` / `cordis_undefine` rows), and `todo_write` /\n * `ask_user_question` whose summary formatting is tool-specific. They keep\n * their built-in rows unless the user names them in the `tools` config\n * explicitly.\n * @module\n */\n\n/** Wire tool names merged by default (empty `tools` config = this list). */\nexport const ALL_TOOL_NAMES: readonly string[] = [\n // File tools (read/search/diff cards).\n 'read', 'grep', 'glob', 'edit', 'write',\n // Shell tools (terminal card).\n 'bash', 'pwsh',\n // Web tools (web card).\n 'web_search', 'web_fetch',\n // Code tool (generic IN/OUT with the program body).\n 'run_code',\n // Cordis inspection verbs (generic read-variant rows).\n 'cordis_package_inspect', 'cordis_runtime_inspect',\n]\n\n/** Tool-row visual variant, mirroring ui-tool's ToolRowVariant. */\nexport type ToolVariant = 'search' | 'read' | 'bash' | 'write' | 'edit' | 'code' | 'others'\n\n/** Figma row titles per variant (design literals, not translatable copy). */\nexport const VARIANT_TITLES: Record<ToolVariant, string> = {\n search: 'Search', read: 'Read', bash: 'Bash',\n write: 'Write', edit: 'Edit', code: 'Code', others: 'Tool call',\n}\n\n/**\n * Known tool name -> row variant (mirrors ui-tool's classification table,\n * minus the run-control verbs: their rows are custom and not shadowed).\n */\nconst TOOL_VARIANTS: Record<string, ToolVariant> = {\n bash: 'bash',\n pwsh: 'bash',\n read: 'read',\n web_fetch: 'read',\n web_search: 'search',\n grep: 'search',\n glob: 'search',\n write: 'write',\n edit: 'edit',\n run_code: 'code',\n cordis_package_inspect: 'read',\n cordis_runtime_inspect: 'read',\n}\n\n/** Tool-owned titles refining a generic row variant (mirrors ui-tool). */\nexport const TOOL_TITLES: Record<string, string> = {\n cordis_package_inspect: 'Inspect',\n cordis_runtime_inspect: 'Inspect',\n pwsh: 'Pwsh',\n}\n\n/** Classify a tool name into its row variant (mirrors ui-tool). */\nexport function classifyTool(toolName: string): ToolVariant {\n return TOOL_VARIANTS[toolName] ?? 'others'\n}\n\n/** The variant title a row shows, honoring tool-owned refinements. */\nexport function variantTitle(toolName: string): string {\n return TOOL_TITLES[toolName] ?? VARIANT_TITLES[classifyTool(toolName)]\n}\n","/**\n * Pure card/row derivation from a frozen call slice, mirroring ui-tool's\n * tool-call/read-card/search-card/diff-card/terminal-card/web-card models at\n * the plugin boundary (those models are ui-tool internals and cannot be\n * imported cross-package). Same wire contract, same defensive treatment of\n * untrusted result views. A merged row renders the same surface the built-in\n * row would: a variant title/icon plus a card primitive or IN/OUT text.\n * @module\n */\nimport {\n resolveWorkspacePath,\n type ToolCallBlock, type ToolResultNode,\n} from '@deepseek-ai/dsh-client-runtime/client'\nimport type {\n DiffBlockProps, DiffHunk, ReadBlockProps, SearchBlockProps, SearchFileGroup,\n TerminalBlockProps, WebBlockProps,\n} from '@deepseek-ai/dsh-client-ui-primitives'\nimport { classifyTool, VARIANT_TITLES, TOOL_TITLES, type ToolVariant } from './tool-names.ts'\n\n/** Row state semantic, mirroring ui-tool's ToolRowState. */\nexport type RowState = 'running' | 'ok' | 'error' | 'stopped'\n\nexport type { ToolVariant } from './tool-names.ts'\n\n/** Read-card props the ReadBlock primitive draws (per-render maxLines owned by the caller). */\nexport type ReadCardModel = Pick<ReadBlockProps, 'label' | 'lines' | 'totalLines' | 'lang'>\n\n/**\n * Distributive `Omit`: a plain `Omit<A | B, K>` keeps only the keys common to\n * both members, dropping the discriminated `files`/`paths` fields. Distributing\n * over the naked type parameter preserves each shape.\n */\ntype DistributiveOmit<T, K extends keyof T> = T extends unknown ? Omit<T, K> : never\n\n/** Search-card props plus the capped-result recovery locator (mirrors ui-tool). */\nexport interface SearchCardModel {\n readonly card: DistributiveOmit<SearchBlockProps, 'maxLines' | 'className'>\n /** The result view's replacement title, which outranks the args summary. */\n readonly title: string | undefined\n readonly recovery: string | undefined\n}\n\n/** Diff-card props (mirrors ui-tool; maxLines/className belong to the render site). */\nexport interface DiffCardModel {\n readonly card: Pick<DiffBlockProps, 'diffs'>\n}\n\n/** Terminal-card props (mirrors ui-tool; maxLines/className/labels belong to the render site). */\nexport interface TerminalCardModel {\n readonly card: Pick<TerminalBlockProps, 'command' | 'cwd' | 'output' | 'exitCode' | 'signal' | 'running'>\n /** The call view's model-authored description shown above the card. */\n readonly description: string | undefined\n}\n\n/** True when a settled terminal card reports a failing exit (mirrors ui-tool). */\nexport function terminalFailed(model: TerminalCardModel): boolean {\n const { exitCode, signal, running } = model.card\n return running !== true && ((exitCode !== undefined && exitCode !== 0) || signal !== undefined)\n}\n\n/** Everything a merged row needs, derived once from the frozen slice. */\nexport interface CallRowModel {\n readonly state: RowState\n readonly variant: ToolVariant\n /** Row title: variant title, or the tool-owned title when it refines one. */\n readonly title: string\n /** Args/result-derived one-line summary (path for file tools, query for searches, …). */\n readonly summary: string\n /** Expanded-body input text (pretty args); null = no input section. */\n readonly body: string | null\n /** Flattened result text; null while running or when the result carries no text. */\n readonly output: string | null\n /** First result line on an error row (the collapsed summary's error text). */\n readonly errorSummary: string | null\n /** Openable workspace path from args; absent for non-file tools and errors. */\n readonly filePath: string | undefined\n /** Whether the row has anything to expand (a card, args body, or output). */\n readonly expandable: boolean\n /** Expanded-body content cards, mutually exclusive, or null when absent. */\n readonly terminal: TerminalCardModel | null\n readonly diff: DiffCardModel | null\n readonly read: ReadCardModel | null\n readonly search: SearchCardModel | null\n readonly web: WebBlockProps | null\n}\n\n/**\n * Flatten a settled result's content blocks to display text.\n * @param node - settled result node.\n * @returns joined text (may be empty).\n */\nexport function resultText(node: ToolResultNode): string {\n const parts: string[] = []\n for (const block of node.content) {\n if (block.type === 'text') parts.push(block.text)\n else parts.push(JSON.stringify(block))\n }\n if (parts.length === 0 && node.error !== undefined) parts.push(`${node.error.name}: ${node.error.code}`)\n return parts.join('\\n')\n}\n\nfunction firstLine(text: string): string {\n const nl = text.indexOf('\\n')\n return nl === -1 ? text : text.slice(0, nl)\n}\n\n/** Strip the workspace root from a workspace-rooted absolute path (display only). */\nexport function relativizeToCwd(text: string, cwd: string | undefined): string {\n if (cwd === undefined || cwd === '') return text\n const root = cwd.replace(/[/\\\\]+$/, '')\n if (text.startsWith(`${root}/`) || text.startsWith(`${root}\\\\`)) return text.slice(root.length + 1)\n return text\n}\n\nfunction parseArgs(argsRaw: string): Record<string, unknown> | undefined {\n try {\n const parsed: unknown = JSON.parse(argsRaw)\n return typeof parsed === 'object' && parsed !== null ? parsed as Record<string, unknown> : undefined\n } catch {\n return undefined\n }\n}\n\nfunction pickString(args: Record<string, unknown>, keys: readonly string[]): string | undefined {\n for (const key of keys) {\n const value = args[key]\n if (typeof value === 'string' && value !== '') return value\n }\n return undefined\n}\n\n/** Summary key preference per row variant (args-derived, mirrors ui-tool). */\nconst SUMMARY_KEYS: Record<ToolVariant, readonly string[]> = {\n bash: ['description', 'command'],\n read: ['path', 'file_path', 'url'],\n search: ['query', 'pattern', 'url'],\n write: ['path', 'file_path'],\n edit: ['path', 'file_path'],\n code: ['description'],\n others: [],\n}\n\nfunction deriveSummary(variant: ToolVariant, argsRaw: string): string {\n const parsed = parseArgs(argsRaw)\n if (parsed === undefined) return firstLine(argsRaw)\n const picked = pickString(parsed, SUMMARY_KEYS[variant])\n if (picked !== undefined) return firstLine(picked)\n for (const value of Object.values(parsed)) {\n if (typeof value === 'string' && value !== '') return firstLine(value)\n }\n return firstLine(argsRaw)\n}\n\n/** Path keys only — never `url` (web_fetch lands on the read variant). */\nconst FILE_PATH_KEYS = ['path', 'file_path'] as const\n\n/** File-tool variants whose summary may be an openable workspace path. */\nconst FILE_PATH_VARIANTS: ReadonlySet<ToolVariant> = new Set(['read', 'write', 'edit'])\n\nfunction deriveFilePath(variant: ToolVariant, argsRaw: string): string | undefined {\n if (!FILE_PATH_VARIANTS.has(variant)) return undefined\n const parsed = parseArgs(argsRaw)\n if (parsed === undefined) return undefined\n return pickString(parsed, FILE_PATH_KEYS)?.split('\\n')[0]\n}\n\nfunction deriveBody(variant: ToolVariant, argsRaw: string): string | null {\n if (argsRaw === '') return null\n const parsed = parseArgs(argsRaw)\n if (parsed === undefined) return argsRaw\n // The code row's expanded body IS the program, not the args JSON envelope.\n if (variant === 'code') {\n const code = parsed.code\n if (typeof code === 'string' && code !== '') return code\n }\n return JSON.stringify(parsed, null, 2)\n}\n\n/** Derive the row model for one call of a grouped tool. */\nexport function callRowModel(\n toolName: string,\n block: ToolCallBlock,\n cwd: string | undefined,\n): CallRowModel {\n const done = 'kind' in block\n const argsRaw = (done ? block.call?.argsRaw : block.argsRaw) ?? ''\n const state: RowState = !done ? 'running'\n : block.error?.code === 'interrupted' ? 'stopped'\n : block.isError ? 'error' : 'ok'\n const variant = classifyTool(toolName)\n const terminal = terminalCardOf(block, cwd)\n const read = readCardOf(block, cwd)\n const diff = diffCardOf(block)\n const search = searchCardOf(block)\n const web = webCardOf(block)\n const base = argsRaw === '' ? block.callId : relativizeToCwd(deriveSummary(variant, argsRaw), cwd)\n const toolTitle = TOOL_TITLES[toolName]\n // Others keeps the static \"Tool call\" title; the real tool name rides the\n // summary slot unless the tool owns a specific title (mirrors ui-tool).\n const argsSummary = variant === 'others' && toolName !== '' && toolTitle === undefined\n ? `${toolName} · ${base}`\n : base\n const filePath = deriveFilePath(variant, argsRaw)\n const output = done ? (resultText(block) || null) : null\n const errorSummary = state === 'error' && output !== null ? firstLine(output) : null\n // A card's own summary outranks the args summary: the terminal presenter's\n // description is the contract's above-card text, and a search result view's\n // replacement title names the query the tool itself chose (mirrors ui-tool).\n const summary = terminal?.description ?? search?.title ?? argsSummary\n // Single-file tools never expose an args body — the path link is the only\n // args interaction (mirrors ui-tool's singleFile rule).\n const body = filePath !== undefined ? null : deriveBody(variant, argsRaw)\n // A failing exit status is the terminal card's own error signal: the call\n // settles isError:false, and the red state dot is its only collapsed signal.\n const finalState = state === 'ok' && terminal !== null && terminalFailed(terminal)\n ? 'error'\n : state\n const expandable = terminal !== null || diff !== null || read !== null\n || search !== null || web !== null || body !== null || output !== null\n return {\n state: finalState,\n variant,\n title: toolTitle ?? VARIANT_TITLES[variant],\n summary,\n body,\n output,\n errorSummary,\n filePath,\n expandable,\n terminal,\n diff,\n read,\n search,\n web,\n }\n}\n\n/** Read-card derivation, or null when this call is not a read card (mirrors ui-tool). */\nfunction readCardOf(block: ToolCallBlock, cwd: string | undefined): ReadCardModel | null {\n if (!('kind' in block)) return null\n const result = block.resultView?.card === 'read' ? block.resultView : null\n if (result === null) return null\n if (!Array.isArray(result.lines)) return null\n const lines = result.lines\n .filter(line => typeof line === 'object' && line !== null\n && typeof (line as { number?: unknown }).number === 'number'\n && typeof (line as { text?: unknown }).text === 'string')\n .map(line => ({ number: (line as { number: number }).number, text: (line as { text: string }).text }))\n return {\n label: result.title ?? relativizeToCwd(result.path, cwd),\n lines,\n totalLines: typeof result.totalLines === 'number' ? result.totalLines : lines.length,\n lang: typeof result.lang === 'string' ? result.lang : undefined,\n }\n}\n\nfunction isValidFiles(files: unknown): files is SearchFileGroup[] {\n return Array.isArray(files) && files.every(file =>\n typeof file === 'object' && file !== null\n && typeof (file as { path?: unknown }).path === 'string'\n && Array.isArray((file as { matches?: unknown }).matches)\n && (file as { matches: unknown[] }).matches.every(match =>\n typeof match === 'object' && match !== null\n && typeof (match as { lineNumber?: unknown }).lineNumber === 'number'\n && typeof (match as { line?: unknown }).line === 'string'))\n}\n\nfunction flattenContent(content: readonly { type: string; text?: string }[]): string | undefined {\n const text = content\n .filter((block): block is { type: 'text'; text: string } => block.type === 'text' && typeof block.text === 'string')\n .map(block => block.text)\n .join('\\n')\n return text === '' ? undefined : text\n}\n\n/** Search-card derivation, or null when this call is not a search card (mirrors ui-tool). */\nfunction searchCardOf(block: ToolCallBlock): SearchCardModel | null {\n if (!('kind' in block)) return null\n const result = block.resultView?.card === 'search' ? block.resultView : null\n if (result === null) return null\n const common = { truncated: result.truncated, total: result.total }\n const recovery = result.truncated ? flattenContent(block.content) : undefined\n if (result.shape === 'matches') {\n if (!isValidFiles(result.files)) return null\n return { title: result.title, recovery, card: { kind: 'matches', files: result.files, ...common } }\n }\n if (result.shape !== 'paths') return null\n if (!Array.isArray(result.paths) || !result.paths.every(path => typeof path === 'string')) return null\n return { title: result.title, recovery, card: { kind: 'paths', paths: result.paths, ...common } }\n}\n\n/** Narrow a wire `card:'diff'` view's `diffs` to well-formed hunks (mirrors ui-tool). */\nfunction narrowDiffs(diffs: unknown): DiffHunk[] | null {\n if (!Array.isArray(diffs) || diffs.length === 0) return null\n const out: DiffHunk[] = []\n for (const hunk of diffs) {\n if (typeof hunk !== 'object' || hunk === null) return null\n const { path, oldText, newText } = hunk as Record<string, unknown>\n if (typeof path !== 'string') return null\n if (oldText !== null && typeof oldText !== 'string') return null\n if (typeof newText !== 'string') return null\n out.push({ path, oldText, newText })\n }\n return out\n}\n\n/** Diff-card derivation, or null when this call is not a diff card (mirrors ui-tool). */\nfunction diffCardOf(block: ToolCallBlock): DiffCardModel | null {\n if (!('kind' in block)) {\n const call = block.callView?.card === 'diff' ? block.callView : null\n const diffs = call === null ? null : narrowDiffs(call.diffs)\n return diffs === null ? null : { card: { diffs } }\n }\n const result = block.resultView?.card === 'diff' ? block.resultView : null\n const diffs = result === null ? null : narrowDiffs(result.diffs)\n return diffs === null ? null : { card: { diffs } }\n}\n\n/**\n * Resolve a terminal view's working directory the way the render-intent\n * contract assigns it: an absolute path is used as-is, a relative one joins\n * under the session workspace, and an omitted one IS the session workspace.\n * @param viewCwd - the cwd the terminal call view carries, if any.\n * @param sessionCwd - the session workspace root, if the caller knows it.\n * @returns the working directory for the prompt label, or undefined.\n */\nfunction resolveTerminalCwd(viewCwd: string | undefined, sessionCwd: string | undefined): string | undefined {\n if (viewCwd === undefined || viewCwd === '') return sessionCwd\n if (sessionCwd === undefined || sessionCwd === '') return viewCwd\n return resolveWorkspacePath(sessionCwd, viewCwd)\n}\n\n/** Terminal-card derivation, or null when this call is not a terminal card (mirrors ui-tool). */\nfunction terminalCardOf(block: ToolCallBlock, sessionCwd: string | undefined): TerminalCardModel | null {\n const call = block.callView?.card === 'terminal' ? block.callView : null\n if (!('kind' in block)) {\n return call === null ? null : {\n description: call.description,\n card: {\n command: call.title,\n cwd: resolveTerminalCwd(call.cwd, sessionCwd),\n output: undefined,\n exitCode: undefined,\n signal: undefined,\n running: true,\n },\n }\n }\n const result = block.resultView?.card === 'terminal' ? block.resultView : null\n if (result === null) return null\n return {\n description: call?.description,\n card: {\n command: result.title ?? call?.title ?? '',\n cwd: call === null ? undefined : resolveTerminalCwd(call.cwd, sessionCwd),\n output: result.output,\n exitCode: result.exitCode,\n signal: result.signal,\n running: false,\n },\n }\n}\n\n/** Web-card derivation, or null when this call is not a web card (mirrors ui-tool). */\nfunction webCardOf(block: ToolCallBlock): WebBlockProps | null {\n if (!('kind' in block)) return null\n const result = block.resultView\n if (result?.card !== 'web') return null\n if (result.kind === 'search') {\n return {\n kind: 'search',\n answer: result.answer,\n sources: result.sources.map(source => ({\n url: source.url,\n title: source.title,\n snippet: source.snippet,\n publishedAt: source.publishedAt,\n })),\n truncated: result.truncated,\n }\n }\n if (result.kind === 'fetch') {\n return {\n kind: 'fetch',\n url: result.url,\n statusCode: result.statusCode,\n truncated: result.truncated,\n }\n }\n return null\n}\n","/**\n * Pure detection of a consecutive run of grouped tool calls in the chat flow,\n * and the per-seat merged-group partition over it.\n *\n * A pure function of the chat snapshot (order + node store), so the merged\n * display is deterministic under replay: the web layer recomputes it per frame.\n * @module\n */\nimport type { ChatConversationViewNode, ChatNodeStore, ToolCallBlock } from '@deepseek-ai/dsh-client-runtime/client'\nimport { conversationContextKey } from '@deepseek-ai/dsh-client-runtime/client'\nimport type { MergeGroupMode } from '../types.ts'\nimport { classifyTool } from './tool-names.ts'\n\n/** Tool-call node kind registered by ui-conversation's built-in tool definition. */\nconst TOOL_CALL_KIND = 'tool-call'\n\n/** Extract a root call block from any chat node, when it is a tool-call node. */\nfunction toolRootOf(node: ChatConversationViewNode): ToolCallBlock | null {\n if (node.kind !== TOOL_CALL_KIND) return null\n const root = (node.data as { root?: unknown }).root\n return typeof root === 'object' && root !== null ? root as ToolCallBlock : null\n}\n\n/** The wire tool name of a call in either lifecycle form (mirrors ui-tool). */\nexport function callNameOf(block: ToolCallBlock): string {\n return 'kind' in block ? (block.call?.name ?? '') : block.name\n}\n\n/** Whether the call's wire name is one of the grouped tools (empty = all). */\nexport function isGroupedTool(name: string, tools: readonly string[]): boolean {\n return tools.length === 0 || tools.includes(name)\n}\n\n/** Step identity of a node's location; undefined when the node is not step-bound. */\nfunction stepIdOf(node: ChatConversationViewNode): string | undefined {\n const location = node.location\n return location.kind === 'step' ? `${location.turn.turn}:${location.step.step}` : undefined\n}\n\n/** One merged group: the group's first call plus its consecutive continuations. */\nexport interface ReadRun {\n /** Whether this seat is the group's rendering head (the only seat that shows the card). */\n readonly isFirst: boolean\n /** The group's root blocks in flow order (first + continuations). */\n readonly blocks: readonly ToolCallBlock[]\n}\n\n/**\n * Compute the merged group this call belongs to.\n *\n * 1. Locates this call's node in the chat order; null when it is not a chat\n * tool-call node (e.g. a read dispatched as a subcall).\n * 2. Walks backward/forward to the maximal consecutive run containing it. A\n * call continues the run when it is a grouped tool AND same-tool-same-run:\n * the identical wire name, or a sibling of the same known variant family\n * (grep+glob, bash+pwsh, read+web_fetch…). Unknown names (variant\n * `others`) only merge with themselves, so unrelated tools never share a\n * card (`adjacent`: any consecutive run; `step`: same agent step as this\n * call).\n * 3. Partitions the run into `maxGroupSize`-sized groups; this call is the\n * group's first only when it heads one of those partitions. Truncation\n * therefore never orphans a call: the excess starts its own group.\n *\n * @param order - chat node key order.\n * @param nodes - chat node store.\n * @param myCallId - the call id of the seat asking about itself.\n * @param tools - grouped wire tool names; empty means every tool.\n * @param groupBy - grouping mode.\n * @param maxGroupSize - per-group cap.\n * @returns the group partition, or null when the call is not a chat tool-call node.\n */\nexport function readRun(\n order: readonly string[],\n nodes: ChatNodeStore,\n myCallId: string,\n tools: readonly string[],\n groupBy: MergeGroupMode,\n maxGroupSize: number,\n): ReadRun | null {\n const myKey = conversationContextKey(TOOL_CALL_KIND, myCallId)\n const myIndex = order.indexOf(myKey)\n if (myIndex < 0) return null\n const myRoot = rootAtNode(order, nodes, myIndex)\n if (myRoot === null) return null\n const myName = callNameOf(myRoot)\n const myVariant = classifyTool(myName)\n const size = Math.max(1, maxGroupSize)\n\n const rootAt = (index: number): ToolCallBlock | null => rootAtNode(order, nodes, index)\n const myStep = groupBy === 'step' ? stepIdOfNodeAt(order, nodes, myIndex) : undefined\n const inGroup = (index: number): boolean => {\n const root = rootAt(index)\n if (root === null || !isGroupedTool(callNameOf(root), tools)) return false\n const name = callNameOf(root)\n // Same-name calls always continue the run; known families merge siblings\n // (grep+glob, bash+pwsh); unknown names merge only with themselves.\n if (name !== myName) {\n if (myVariant === 'others' || classifyTool(name) !== myVariant) return false\n }\n if (groupBy !== 'step') return true\n return myStep !== undefined && stepIdOfNodeAt(order, nodes, index) === myStep\n }\n\n let start = myIndex\n while (start > 0 && inGroup(start - 1)) start--\n let end = myIndex\n while (end < order.length - 1 && inGroup(end + 1)) end++\n\n const groupStart = start + Math.floor((myIndex - start) / size) * size\n const groupEnd = Math.min(groupStart + size, end + 1)\n\n const blocks: ToolCallBlock[] = []\n for (let index = groupStart; index < groupEnd; index++) {\n const root = rootAt(index)\n if (root !== null) blocks.push(root)\n }\n return { isFirst: myIndex === groupStart, blocks }\n}\n\nfunction rootAtNode(order: readonly string[], nodes: ChatNodeStore, index: number): ToolCallBlock | null {\n const key = order[index]\n const node = key === undefined ? undefined : nodes.get(key)\n return node === undefined ? null : toolRootOf(node)\n}\n\nfunction stepIdOfNodeAt(order: readonly string[], nodes: ChatNodeStore, index: number): string | undefined {\n const key = order[index]\n const node = key === undefined ? undefined : nodes.get(key)\n return node === undefined ? undefined : stepIdOf(node)\n}\n","/**\n * Merged tool-call row — the shadowed `tool.call.toolview` registrant.\n *\n * For the first call of a consecutive run of grouped tools, renders the run as\n * one card (the first call's full row) plus one compact child row per\n * continuation call. For a continuation call, renders nothing: the seat stays\n * empty and the injected stylesheet collapses it out of the flow. When the\n * call is not a chat tool-call node at all (e.g. dispatched as a subcall),\n * falls back to a plain single row so the call never disappears.\n *\n * The row surface mirrors the built-in generic ToolRow: a variant title/icon\n * plus the settled card (read/search/diff/terminal/web) or IN/OUT text.\n *\n * Everything here is a pure function of the chat snapshot + the frozen call\n * slices (replay-deterministic); expand state is component-local view state.\n * @module\n */\nimport { memo, useLayoutEffect, useRef, useState, type CSSProperties, type KeyboardEvent, type MouseEvent, type ReactNode } from 'react'\nimport {\n DiffBlock, DisclosureRow, IconApiOutline14, IconBrowseOutline16, IconCodeOutline16,\n IconEditOutline16, IconSearchOutline16, IconSparkle16, ReadBlock, SearchBlock, StateDot,\n TerminalBlock, WebBlock, type TerminalBlockLabels,\n} from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { ToolCallBlock } from '@deepseek-ai/dsh-client-runtime/client'\nimport type { ToolCallViewProps } from '@deepseek-ai/dsh-client-ui-tool/client'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { MergeToolCallsConfig } from '../types.ts'\nimport { callRowModel, type CallRowModel, type RowState, type ToolVariant } from './card-model.ts'\nimport { readRun } from './merge-run.ts'\n\n/** Chat rows show a capped card; the details panel stays the full-height surface. */\nconst CHAT_READ_MAX_LINES = 8\nconst CHAT_SEARCH_MAX_LINES = 8\nconst CHAT_DIFF_MAX_LINES = 8\n\n/** Locale seat and inject face of the merged row registration. */\nexport type MergedToolRowProps = ToolCallViewProps\n & PropsLocale<'merge-tool-calls'>\n & { readonly cfg: MergeToolCallsConfig }\n\n/** Variant leading icons (figma table); all glyphs render at 14 inside the 16px leading box. */\nconst VARIANT_ICONS: Record<ToolVariant, ReactNode> = {\n search: <IconSearchOutline16 size={14} />,\n read: <IconBrowseOutline16 size={14} />,\n bash: <IconApiOutline14 size={14} />,\n write: <IconEditOutline16 size={14} />,\n edit: <IconEditOutline16 size={14} />,\n code: <IconCodeOutline16 size={14} />,\n others: <IconSparkle16 size={14} />,\n}\n\n/**\n * Per-variant locale key for the merged-count summary (`{n} Files`, `{n}\n * Commands`, …). Replaces the first call's file path on the main row when the\n * run merges more than one call, so the main row reads `Read · 5 Files` and\n * the file paths move to the collapsed child rows.\n */\nconst VARIANT_COUNT_KEY: Record<ToolVariant, 'countFiles' | 'countQueries' | 'countCommands' | 'countPrograms' | 'countCalls'> = {\n read: 'countFiles',\n write: 'countFiles',\n edit: 'countFiles',\n search: 'countQueries',\n bash: 'countCommands',\n code: 'countPrograms',\n others: 'countCalls',\n}\n\n/** Leading-slot state substitution, mirroring the shipped row. */\nfunction leadingFor(state: RowState, icon: ReactNode): ReactNode {\n switch (state) {\n case 'error': return <StateDot state=\"error\" />\n case 'stopped': return <StateDot state=\"warning\" />\n default: return icon\n }\n}\n\n/** Visually hidden run-state label (the StateDot and sweep are colour-only). */\nfunction stateStatus(state: RowState, t: MergedToolRowProps['t']): string | null {\n switch (state) {\n case 'running': return t('running')\n case 'error': return t('failed')\n case 'stopped': return t('stopped')\n default: return null\n }\n}\n\n/** TerminalBlock display copy from the plugin's own dictionary. */\nfunction terminalLabels(t: MergedToolRowProps['t']): TerminalBlockLabels {\n return {\n signal: signal => t('terminal.signal', { signal }),\n exitCode: code => t('terminal.exitCode', { code }),\n running: t('terminal.running'),\n failed: t('terminal.failed'),\n done: t('terminal.done'),\n copy: t('terminal.copy'),\n copied: t('terminal.copied'),\n noOutput: t('terminal.noOutput'),\n collapseAria: t('terminal.collapseAria'),\n collapse: t('terminal.collapse'),\n expandAria: hidden => t('terminal.expandAria', { n: hidden }),\n expand: hidden => t('terminal.expandRest', { n: hidden }),\n }\n}\n\n/** One call's expanded-body card, mirroring the built-in ToolRow body. */\nfunction CardBody({ model, t }: { model: CallRowModel; t: MergedToolRowProps['t'] }) {\n if (model.terminal !== null) {\n return <TerminalBlock {...model.terminal.card} maxLines={Infinity} labels={terminalLabels(t)} />\n }\n if (model.diff !== null) {\n return <DiffBlock {...model.diff.card} maxLines={CHAT_DIFF_MAX_LINES} />\n }\n if (model.read !== null) {\n return <ReadBlock {...model.read} maxLines={CHAT_READ_MAX_LINES} />\n }\n if (model.search !== null) {\n return (\n <>\n <SearchBlock {...model.search.card} maxLines={CHAT_SEARCH_MAX_LINES} />\n {model.search.recovery !== undefined && (\n <div className=\"mtc-recovery\">{model.search.recovery}</div>\n )}\n </>\n )\n }\n if (model.web !== null) {\n return <WebBlock {...model.web} />\n }\n const hasBody = model.body !== null\n const hasOutput = model.output !== null\n if (!hasBody && !hasOutput) return null\n return (\n <div className=\"mtc-io-card\">\n {hasBody && (\n <div className=\"mtc-io-section\">\n <span className=\"mtc-io-label\">IN</span>\n <span className=\"mtc-io-text\">{model.body}</span>\n </div>\n )}\n {hasBody && hasOutput && <span className=\"mtc-io-divider\" aria-hidden />}\n {hasOutput && (\n <div className=\"mtc-io-section\">\n <span className=\"mtc-io-label\">OUT</span>\n <span className=\"mtc-io-text\" data-error={model.state === 'error' || undefined}>{model.output}</span>\n </div>\n )}\n </div>\n )\n}\n\n/**\n * The run's main card: the first call's chrome (variant title/icon + state)\n * plus, for a single call, its expandable content card. For a merged run the\n * main row's collapsed summary is the count (`Read · 5 Files`) and the\n * expanded body is the child-rows block (passed in as `children`); the first\n * call is rendered as the first child row so every file path lands on a child\n * row, never on the main row.\n */\nexport const RowCard = memo(function RowCard({\n toolName, block, cwd, openFile, inspect, t, mergedCount, children,\n}: {\n toolName: string\n block: ToolCallBlock\n cwd: string | undefined\n openFile: (path: string) => void\n inspect: (() => void) | undefined\n t: MergedToolRowProps['t']\n /** Continuation-call count; 0 means a single-call row (no child rows). */\n mergedCount: number\n /** Child rows for the merged run (all calls, including the first). */\n children?: ReactNode\n}) {\n const model = callRowModel(toolName, block, cwd)\n const [expanded, setExpanded] = useState(false)\n const hasChildren = mergedCount > 0\n const expandable = model.expandable || hasChildren\n const open = expanded && expandable\n const status = stateStatus(model.state, t)\n const failureLine = model.state === 'error' ? model.errorSummary ?? null : null\n // Merged runs trade the first file path + `+n` suffix for a count summary,\n // so the main row reads `Read · 5 Files`; the file paths live on the child\n // rows. An error on the first call still surfaces its error text instead.\n const summaryText = hasChildren && failureLine === null\n ? t(VARIANT_COUNT_KEY[model.variant], { n: String(mergedCount + 1) })\n : failureLine ?? model.summary\n // The open-file link only applies to single-call rows (the merged summary is\n // a count, not a path).\n const fileLink = !hasChildren && model.filePath !== undefined && openFile !== undefined && failureLine === null\n const openFileClick = (event: MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation()\n if (model.filePath !== undefined) openFile(model.filePath)\n }\n return (\n <div className=\"mtc-row\" data-state={model.state} data-variant={model.variant} data-merged={hasChildren || undefined}>\n {status !== null && <span className=\"mtc-visually-hidden\">{status}</span>}\n <DisclosureRow\n rowClassName=\"mtc-title-row\"\n titleClassName=\"mtc-title\"\n leadingClassName=\"mtc-leading\"\n chevronClassName=\"mtc-chevron\"\n icon={leadingFor(model.state, VARIANT_ICONS[model.variant])}\n title={model.title}\n open={open}\n expandable={expandable}\n expandOnRowClick\n keepContentWhenOpen\n onToggle={() => { setExpanded(value => !value) }}\n collapsedContent={summaryText !== '' && (\n <>\n <span className=\"mtc-sep\" aria-hidden />\n {fileLink ? (\n <button type=\"button\" className=\"mtc-summary-link\" onClick={openFileClick}>{summaryText}</button>\n ) : (\n <span className=\"mtc-summary\">{summaryText}</span>\n )}\n </>\n )}\n >\n {/* Single-call mode: the first call's expandable content card lives in\n the disclosure body. Merged mode renders nothing here — the child\n rows block is a sibling below, animated via its own collapse grid. */}\n {!hasChildren && (\n <div className=\"mtc-card-body\">\n <CardBody model={model} t={t} />\n {inspect !== undefined && (\n <button type=\"button\" className=\"mtc-inspect\" onClick={inspect}>Inspect</button>\n )}\n </div>\n )}\n </DisclosureRow>\n {hasChildren && (\n // The animated children block. Lives outside DisclosureRow so the\n // grid-template-rows transition can keep the rows in the DOM while\n // collapsing (DisclosureRow would unmount them instantly). The\n // --mtc-sep-left custom property is set by the parent on .mtc-root.\n <div className=\"mtc-children-collapse\" data-open={open || undefined}>\n <div className=\"mtc-children\">\n {children}\n </div>\n </div>\n )}\n {hasChildren && open && inspect !== undefined && (\n <button type=\"button\" className=\"mtc-inspect\" onClick={inspect}>Inspect</button>\n )}\n </div>\n )\n})\n\n/**\n * One compact continuation row: the main row's tail structure ([sep dot][path]).\n * An expandable call toggles the inline content card on click (mirroring the\n * main row's whole-row disclosure); a read/write/edit-family path additionally\n * renders as an open-file link (the sidebar preview) that stops propagation,\n * exactly like the main row's summary link.\n */\nexport const ChildRow = memo(function ChildRow({\n toolName, block, cwd, openFile, t,\n}: {\n toolName: string\n block: ToolCallBlock\n cwd: string | undefined\n openFile: (path: string) => void\n t: MergedToolRowProps['t']\n}) {\n const model = callRowModel(toolName, block, cwd)\n const [open, setOpen] = useState(false)\n const stateLabel = stateStatus(model.state, t)\n const expandable = model.expandable\n const toggle = (): void => { setOpen(value => !value) }\n const openFileClick = (event: MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation()\n if (model.filePath !== undefined) openFile(model.filePath)\n }\n const onRowKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n toggle()\n }\n }\n return (\n <div className=\"mtc-child\">\n <div\n className=\"mtc-child-row\"\n data-open={expandable && open || undefined}\n data-static={expandable ? undefined : true}\n role={expandable ? 'button' : undefined}\n tabIndex={expandable ? 0 : undefined}\n aria-expanded={expandable ? open : undefined}\n onClick={expandable ? toggle : undefined}\n onKeyDown={expandable ? onRowKeyDown : undefined}\n >\n <span className=\"mtc-sep\" aria-hidden />\n {model.filePath !== undefined ? (\n <button type=\"button\" className=\"mtc-child-path-link\" onClick={openFileClick}>{model.summary}</button>\n ) : (\n <span className=\"mtc-child-path\">{model.summary}</span>\n )}\n {stateLabel !== null && (\n <span className=\"mtc-child-state\" data-error={model.state === 'error' || undefined}>{stateLabel}</span>\n )}\n </div>\n {expandable && open && (\n <div className=\"mtc-child-body\">\n <CardBody model={model} t={t} />\n </div>\n )}\n </div>\n )\n})\n\n/**\n * The shadowed toolview: renders the merged run card for the run's first call,\n * nothing for continuation calls, and a plain single row when this call is not\n * a chat tool-call node.\n *\n * Child-row alignment is measured at runtime, not hardcoded: the main row's\n * separator dot sits after a variable-width title (\"Read\"/\"Search\"/\"Bash\"/…),\n * so its column depends on the rendered font. A layout effect measures the\n * dot's offset from the card root (once, plus on reflow via ResizeObserver)\n * and indents the children so their dots and paths land on the main row's\n * columns — no font/title constants to keep in sync.\n */\nexport function MergedToolRow({ callId, toolName, block, cwd, openFile, inspect, t, cfg, useSession }: MergedToolRowProps) {\n const run = useSession(snapshot => readRun(\n snapshot.chat.order,\n snapshot.chat.nodes,\n callId,\n cfg.tools,\n cfg.groupBy,\n cfg.maxGroupSize,\n ))\n const rootRef = useRef<HTMLDivElement>(null)\n /** Main separator dot's left offset from the card root; null before first measure. */\n const [sepLeft, setSepLeft] = useState<number | null>(null)\n\n useLayoutEffect(() => {\n const root = rootRef.current\n if (root === null) return\n const sep = root.querySelector<HTMLElement>('.mtc-row .mtc-sep')\n if (sep === null) return\n const measure = (): void => {\n setSepLeft(Math.round(sep.getBoundingClientRect().left - root.getBoundingClientRect().left))\n }\n measure()\n // Font swaps, locale switches, and column resizes move the dot; keep the\n // alignment current without re-running the effect.\n const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(measure)\n observer?.observe(root)\n return () => { observer?.disconnect() }\n }, [run === null ? null : run.blocks[0]?.callId ?? null])\n\n if (run === null) {\n // Not a chat tool-call node (subcall dispatch): never blank the call.\n return (\n <RowCard\n toolName={toolName}\n block={block}\n cwd={cwd}\n openFile={openFile}\n inspect={inspect}\n t={t}\n mergedCount={0}\n />\n )\n }\n if (!run.isFirst) return null\n const hasChildren = run.blocks.length > 1\n return (\n <div\n className=\"mtc-root\"\n data-tool={toolName}\n ref={rootRef}\n // The measured dot column lands the children's sep dot on the main row's\n // summary column. Set on the root so it cascades into RowCard's\n // .mtc-children block.\n style={sepLeft === null ? undefined : { ['--mtc-sep-left']: `${sepLeft}px` } as CSSProperties}\n >\n <RowCard\n toolName={toolName}\n block={run.blocks[0] ?? block}\n cwd={cwd}\n openFile={openFile}\n inspect={inspect}\n t={t}\n mergedCount={run.blocks.length - 1}\n >\n {/* Every call (including the first) renders as a child row, so the\n main row's summary stays a count (`Read · 5 Files`) and every file\n path lands on its own child row. */}\n {hasChildren && run.blocks.map(child => (\n <ChildRow key={child.callId} toolName={toolName} block={child} cwd={cwd} openFile={openFile} t={t} />\n ))}\n </RowCard>\n </div>\n )\n}\n","/**\n * One scoped stylesheet injected for the lifetime of the client activation.\n *\n * Two jobs:\n * 1. The empty-seat collapse rule: the shadowed toolview renders `null` for\n * every non-first call of a merged run. The built-in `ToolCallTree` still\n * wraps that null in its `.callRow` div, and the renderer wraps every\n * toolview in an empty `<div data-slot=\"tool.call.toolview\">` (display:\n * contents), so the seat's `.flowItem` is never `:empty` itself and the\n * built-in `.flowItem:empty { display:none }` rule does not fire. This\n * rule extends the same intent (\"a renderer may decline its row\") to a\n * tool seat whose toolview rendered nothing.\n * 2. The plugin's own `.mtc-*` chrome for the merged card and its child rows.\n *\n * All colors come from the shared `--dsw-*` tokens (never literals).\n */\nexport const CSS = `\n/* A tool-call seat whose toolview declined to render (merged-run continuation\n calls) must not consume the flow column's gap. The empty toolview slot\n wrapper is the decline signal; the callRow around it always exists. */\n[data-chat-flow-kind=\"tool-call\"]:has([data-slot=\"tool.call.toolview\"]:empty) { display: none; }\n\n.mtc-root { display: flex; flex-direction: column; min-width: 0; }\n.mtc-row { display: flex; flex-direction: column; min-width: 0; }\n.mtc-row[data-state='running'] .mtc-title-row { position: relative; overflow: hidden; }\n.mtc-row[data-state='running'] .mtc-title-row::after {\n content: '';\n position: absolute;\n top: 0; bottom: 0; left: 0;\n width: 300px;\n background: linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--dsw-alias-bg-base) 60%, transparent) 55%, transparent 100%);\n animation: dsh-mtc-sweep 2.6s ease-out infinite;\n pointer-events: none;\n}\n@keyframes dsh-mtc-sweep {\n 0% { left: -300px; }\n 90%, 100% { left: 100%; }\n}\n\n.mtc-title { font-weight: 400; }\n.mtc-sep { flex: none; width: 2px; height: 2px; border-radius: 1px; margin: 0 8px; background: var(--dsw-alias-label-caption); }\n.mtc-summary {\n flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;\n font-size: 14px; line-height: 24px; color: var(--dsw-alias-label-tertiary);\n}\n.mtc-summary-link {\n flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;\n margin: 0; padding: 0; border: none; background: none; font: inherit; text-align: left;\n font-size: 14px; line-height: 24px; color: var(--dsw-alias-label-secondary);\n text-decoration: underline; text-decoration-color: var(--dsw-alias-label-quaternary);\n text-underline-offset: 3px; cursor: pointer;\n}\n.mtc-summary-link:hover { color: var(--dsw-alias-label-primary); text-decoration-color: currentColor; }\n.mtc-summary-error { color: var(--dsw-alias-state-error-primary); }\n.mtc-summary-suffix { flex: none; margin-left: 4px; white-space: nowrap; font-size: 14px; line-height: 24px; color: var(--dsw-alias-label-tertiary); }\n\n.mtc-card-body { margin: 4px 0 4px 4px; min-width: 0; }\n.mtc-recovery { margin: 4px 0 4px 4px; white-space: pre-wrap; overflow-wrap: anywhere; font: var(--dsw-font-xs-13); color: var(--dsw-alias-label-tertiary); }\n/* IN/OUT text card for calls without a card primitive (mirrors ToolRow). */\n.mtc-io-card {\n display: flex; flex-direction: column; min-width: 0;\n border: 1px solid var(--dsw-alias-border-l2); border-radius: 12px;\n background: var(--dsw-alias-bg-base);\n}\n.mtc-io-section { display: flex; gap: 10px; padding: 8px 12px; min-width: 0; }\n.mtc-io-label {\n flex: none; font-size: 11px; line-height: 16px; font-weight: 600;\n color: var(--dsw-alias-label-tertiary);\n}\n.mtc-io-text {\n flex: 1 1 auto; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere;\n font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary);\n}\n.mtc-io-text[data-error] { color: var(--dsw-alias-state-error-primary); }\n.mtc-io-divider { height: 1px; background: var(--dsw-alias-border-l2); }\n.mtc-inspect {\n display: inline-flex; align-self: flex-start; align-items: center; gap: 4px;\n margin: 4px 0 2px 4px; padding: 2px 8px;\n border: 1px solid var(--dsw-alias-border-l2); border-radius: 999px;\n background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-secondary);\n font-size: 11px; line-height: 16px; cursor: pointer;\n opacity: 0; transition: opacity 100ms ease;\n}\n.mtc-root:hover .mtc-inspect, .mtc-inspect:focus-visible { opacity: 1; }\n.mtc-inspect:hover { background: var(--dsw-alias-interactive-bg-hover-solid); color: var(--dsw-alias-label-primary); }\n\n/* Compact child rows: each is the main row's tail structure — [sep dot][path].\n The dot/path column is set at runtime by the component (it measures the\n main row's sep offset and sets the --mtc-sep-left custom property on the\n root); this is only the pre-measure fallback.\n\n The .mtc-children-collapse wrapper animates the block's height with a\n grid-template-rows 0fr↔1fr transition (children stay in the DOM while\n collapsing, so the slide is smooth instead of popping out). The vertical\n margin lives on the wrapper (not .mtc-children) so it doesn't leak past the\n 0fr row when collapsed.\n\n The sep-left indent lives on .mtc-child-row (not .mtc-children) so the\n expanded .mtc-child-body can align back to the root's left edge via a plain\n 4px margin. When the indent was on .mtc-children + a negative-margin\n pull-back on .mtc-child-body, the body's left portion was clipped by\n .mtc-children's overflow:hidden (which is required for the grid collapse\n animation). */\n.mtc-children-collapse {\n display: grid;\n grid-template-rows: 0fr;\n margin: 0;\n transition: grid-template-rows 200ms ease-out, margin 200ms ease-out;\n}\n.mtc-children-collapse[data-open] {\n grid-template-rows: 1fr;\n margin: 2px 0;\n}\n.mtc-children {\n display: flex; flex-direction: column; gap: 1px;\n margin: 0;\n min-width: 0; min-height: 0; overflow: hidden;\n opacity: 0;\n transition: opacity 150ms ease-out;\n}\n.mtc-children-collapse[data-open] .mtc-children {\n opacity: 1;\n transition: opacity 150ms ease-out 50ms;\n}\n.mtc-child { display: flex; flex-direction: column; min-width: 0; }\n.mtc-child-row {\n display: flex; align-items: center; gap: 0; min-width: 0; height: 20px;\n margin: 0 0 0 var(--mtc-sep-left, 61px); padding: 0; border: 0; border-radius: 4px; background: none;\n font: inherit; text-align: left; color: var(--dsw-alias-label-secondary); cursor: pointer;\n}\n.mtc-child-row:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }\n.mtc-child-row[data-static] { cursor: default; }\n.mtc-child-row[data-static]:hover { background: none; color: var(--dsw-alias-label-secondary); }\n.mtc-child-row .mtc-sep { margin: 0 8px 0 0; }\n.mtc-child-path {\n flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;\n font-size: 14px; line-height: 20px;\n}\n/* Read-family child paths are open-file links (sidebar preview), same affordance\n as the main row's summary link. */\n.mtc-child-path-link {\n flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;\n margin: 0; padding: 0; border: none; background: none; font: inherit; text-align: left;\n font-size: 14px; line-height: 20px; color: var(--dsw-alias-label-secondary);\n text-decoration: underline; text-decoration-color: var(--dsw-alias-label-quaternary);\n text-underline-offset: 3px; cursor: pointer;\n}\n.mtc-child-path-link:hover { color: var(--dsw-alias-label-primary); text-decoration-color: currentColor; }\n.mtc-child-state { flex: none; font-size: 11px; line-height: 16px; color: var(--dsw-alias-label-tertiary); }\n.mtc-child-state[data-error] { color: var(--dsw-alias-state-error-primary); }\n/* The expanded child card aligns to the main card body's column (root + 4px).\n No negative-margin pull-back is needed because .mtc-children no longer\n carries the sep-left indent — only .mtc-child-row does. */\n.mtc-child-body { margin: 2px 0 2px 4px; min-width: 0; }\n\n.mtc-visually-hidden {\n position: absolute; width: 1px; height: 1px; overflow: hidden;\n clip: rect(0 0 0 0); white-space: nowrap;\n}\n`\n\n/** Install the stylesheet and return its disposer. */\nexport function installStyles(): () => void {\n const style = document.createElement('style')\n style.setAttribute('data-merge-tool-calls-style', '')\n style.textContent = CSS\n document.head.appendChild(style)\n return () => { style.remove() }\n}\n","/**\n * merge-tool-calls — browser half.\n *\n * Shadows the shipped `tool.call.toolview` entries for every grouped tool at\n * priority -1 (the keyed slot's shadowing rule: lowest priority renders). An\n * empty `tools` config means every built-in generic-family tool\n * (see {@link ALL_TOOL_NAMES}); a non-empty list is an explicit whitelist.\n * The shadowed component merges consecutive calls of one tool in the chat flow\n * into a single card with compact child rows.\n *\n * @module @dsh-external/dsh-plugin-merge-tool-calls/client\n */\n\nimport type { ClientContext } from '@deepseek-ai/dsh-client-runtime/client'\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-tool/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-slots'\nimport { DEFAULT_MERGE_CONFIG, type MergeToolCallsConfig } from '../types.ts'\nimport { dicts } from './dictionaries.ts'\nimport { en, NS, zh, type MergeToolCallsKey } from './locales.ts'\nimport { MergedToolRow } from './rows.tsx'\nimport { installStyles } from './styles.ts'\nimport { ALL_TOOL_NAMES } from './tool-names.ts'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** Copy for the merged tool-call rows. */\n 'merge-tool-calls': MergeToolCallsKey\n }\n}\n\n/** Required services: the slot registry (toolview shadowing) and locale. */\nexport const inject = ['slots', 'locale']\n\n/** Structural view of better-locale's override store (optional; no runtime dep). */\ninterface BetterLocaleOverrideStore {\n register(ns: string, dicts: Record<string, Record<string, string>>): () => void\n}\n\n/**\n * Register one shadowed toolview per grouped tool.\n * @param ctx - client root context.\n * @param config - row config; defaults apply when the loader passes none.\n */\nexport function apply(ctx: ClientContext, config: Partial<MergeToolCallsConfig> = {}): void {\n const cfg: MergeToolCallsConfig = { ...DEFAULT_MERGE_CONFIG, ...config }\n ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'merge-tool-calls: dictionaries')\n ctx.effect(installStyles, 'merge-tool-calls: styles')\n\n // Optional third-language overrides: register the 19-language dicts into\n // `ctx.betterLocale` (published by dsh-plugin-better-locale) so a selected\n // override language (with DSH on 'en') replaces the row copy. The service\n // is optional — no better-locale, no dicts.\n // Activation-order-safe: re-check ctx.get('betterLocale') on every locale\n // revision bump (better-locale bumps on activation + override switch).\n ctx.effect(() => {\n let dispose: (() => void) | undefined\n const sync = (): void => {\n dispose?.()\n dispose = undefined\n const store = ctx.get('betterLocale') as BetterLocaleOverrideStore | undefined\n if (store !== undefined) {\n dispose = store.register(NS, dicts)\n }\n }\n sync()\n const unsubscribe = ctx.locale.subscribe(sync)\n return () => {\n unsubscribe()\n dispose?.()\n }\n }, 'merge-tool-calls: better-locale override dicts')\n\n const toolNames = cfg.tools.length === 0 ? ALL_TOOL_NAMES : [...new Set(cfg.tools)]\n for (const tool of toolNames) {\n ctx.slots.inject('tool.call.toolview', () => ctx.slots.register({\n name: 'tool.call.toolview',\n key: tool,\n priority: -1,\n locale: NS,\n inject: () => ({ cfg }),\n }, MergedToolRow))\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAaA,uBAA6C;CACxD,OAAO,EAAE;CACT,SAAS;CACT,cAAc;CACf;;;;;ACVD,MAAaC,QAA2D;CACtE,IAAI;EACF,SAAS;EACT,QAAQ;EACR,SAAS;EACT,QAAQ;EACR,UAAU;EACV,MAAM;EACN,UAAU;EACV,aAA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EAAE,EAAQ;CAC1F,MAAMC,MAA4B;EAAE,GAAG;EAAsB,GAAG;EAAQ;AACxE,KAAI,aAAa,IAAI,OAAO,SAAS,IAAI;EAAE;EAAI;EAAI,CAAC,EAAE,iCAAiC;AACvF,KAAI,OAAO,eAAe,2BAA2B;AAQrD,KAAI,aAAa;EACf,IAAIC;EACJ,MAAM,aAAmB;AACvB,cAAW;AACX,aAAU;GACV,MAAM,QAAQ,IAAI,IAAI,eAAe;AACrC,OAAI,UAAU,OACZ,WAAU,MAAM,SAAS,IAAI,MAAM;;AAGvC,QAAM;EACN,MAAM,cAAc,IAAI,OAAO,UAAU,KAAK;AAC9C,eAAa;AACX,gBAAa;AACb,cAAW;;IAEZ,iDAAiD;CAEpD,MAAM,YAAY,IAAI,MAAM,WAAW,IAAI,iBAAiB,CAAC,GAAG,IAAI,IAAI,IAAI,MAAM,CAAC;AACnF,MAAK,MAAM,QAAQ,UACjB,KAAI,MAAM,OAAO,4BAA4B,IAAI,MAAM,SAAS;EAC9D,MAAM;EACN,KAAK;EACL,UAAU;EACV,QAAQ;EACR,eAAe,EAAE,KAAK;EACvB,EAAE,cAAc,CAAC"}
1
+ {"version":3,"file":"client.js","names":["DEFAULT_MERGE_CONFIG: MergeToolCallsConfig","dicts: Record<string, Partial<Record<MergeToolCallsKey, string>>>","ALL_TOOL_NAMES: readonly string[]","VARIANT_TITLES: Record<ToolVariant, string>","TOOL_VARIANTS: Record<string, ToolVariant>","TOOL_TITLES: Record<string, string>","value: unknown","parts: string[]","parsed: unknown","SUMMARY_KEYS: Record<ToolVariant, readonly string[]>","FILE_PATH_VARIANTS: ReadonlySet<ToolVariant>","state: RowState","narrowed: { number: number; text: string }[]","path","out: DiffHunk[]","oldText","newText","kept: string[]","sources: WebSource[]","blocks: ToolCallBlock[]","VARIANT_ICONS: Record<ToolVariant, ReactNode>","IconSearchOutline16","IconBrowseOutline16","IconApiOutline14","IconEditOutline16","IconCodeOutline16","IconSparkle16","VARIANT_COUNT_KEY: Record<ToolVariant, 'countFiles' | 'countQueries' | 'countCommands' | 'countPrograms' | 'countCalls'>","StateDot","TerminalBlock","DiffBlock","ReadBlock","SearchBlock","WebBlock","RowCard","DisclosureRow","ChildRow","cfg: MergeToolCallsConfig","dispose: (() => void) | undefined"],"sources":["../src/types.ts","../src/client/dictionaries.ts","../src/client/locales.ts","../src/client/tool-names.ts","../src/client/card-model.ts","../src/client/merge-run.ts","../src/client/rows.tsx","../src/client/styles.ts","../src/client/index.ts"],"sourcesContent":["/** Shared config surface of the merge-tool-calls plugin (host + client halves). */\n\n/** How consecutive same-tool calls are grouped into one merged card. */\nexport type MergeGroupMode = 'adjacent' | 'step'\n\n/** Plugin configuration; defaults live in the Schemastery schema and cordis.patch.yml. */\nexport interface MergeToolCallsConfig {\n /**\n * Wire tool names whose consecutive calls merge. Empty = every built-in\n * generic-family tool (read/grep/glob/edit/write/bash/pwsh/web_search/\n * web_fetch/run_code/cordis_package_inspect/cordis_runtime_inspect); a\n * non-empty list is an explicit whitelist (any wire name works).\n */\n readonly tools: readonly string[]\n /** `adjacent`: any consecutive run in the chat flow; `step`: only within one agent step. */\n readonly groupBy: MergeGroupMode\n /** Max calls per merged group; the run is truncated and the excess starts a new group. */\n readonly maxGroupSize: number\n}\n\n/** Runtime defaults applied when a half receives no config (defensive only). */\nexport const DEFAULT_MERGE_CONFIG: MergeToolCallsConfig = {\n tools: [],\n groupBy: 'adjacent',\n maxGroupSize: 8,\n}\n","/**\n * The 19 better-locale override languages for the merged tool-call row copy,\n * keyed by language id. Values keep `{placeholder}` interpolation (e.g. `{n}`\n * in `mergedCount`), matching the better-locale store's `LocaleDict`\n * contract.\n *\n * Each dictionary is PARTIAL: languages carry the keys they translate, and a\n * missing key falls through the locale lookup chain to the base `en`/`zh`\n * dictionary registered by the plugin. Dictionaries written before the\n * v0.1.2-alpha.1 adaptation predate the read/search/diff/web card-label keys\n * (`read.*` / `search.*` / `diff.*` / `web.*` / `markdown.*` / `copy` /\n * `copied`); those render in English under an override language until a\n * translation lands here.\n *\n * The apply function registers these into `ctx.betterLocale` (the override\n * store) under `NS`, so when the user selects an override language through\n * dsh-plugin-better-locale (and DSH is on 'en', whose slot the override\n * borrows), the row copy renders in the override language.\n */\nimport type { MergeToolCallsKey } from './locales.ts'\n\n/** All override-language dictionaries for the `NS` namespace. */\nexport const dicts: Record<string, Partial<Record<MergeToolCallsKey, string>>> = {\n ja: {\n running: '実行中',\n failed: '失敗',\n stopped: '中断',\n expand: '展開',\n collapse: '折りたたむ',\n more: '+{n}',\n showLess: '残りを閉じる',\n mergedCount: '{n} 回の呼び出しを統合',\n countFiles: '{n} 個のファイル',\n countQueries: '{n} 回の検索',\n countCommands: '{n} 個のコマンド',\n countPrograms: '{n} 個のプログラム',\n countCalls: '{n} 回の呼び出し',\n 'terminal.signal': 'シグナル {signal}',\n 'terminal.exitCode': '終了コード {code}',\n 'terminal.running': '実行中',\n 'terminal.failed': '失敗',\n 'terminal.done': '完了',\n 'terminal.copy': 'コピー',\n 'terminal.copied': 'コピーしました',\n 'terminal.noOutput': '出力なし',\n 'terminal.collapseAria': '出力を折りたたむ',\n 'terminal.collapse': '折りたたむ',\n 'terminal.expandAria': '残り {n} 行の出力を展開',\n 'terminal.expandRest': '… 残り {n} 行',\n },\n de: {\n running: 'Läuft',\n failed: 'Fehlgeschlagen',\n stopped: 'Unterbrochen',\n expand: 'Erweitern',\n collapse: 'Einklappen',\n more: '+{n}',\n showLess: 'Weniger anzeigen',\n mergedCount: '{n} Aufrufe zusammengeführt',\n countFiles: '{n} Dateien',\n countQueries: '{n} Suchanfragen',\n countCommands: '{n} Befehle',\n countPrograms: '{n} Programme',\n countCalls: '{n} Aufrufe',\n 'terminal.signal': 'Signal {signal}',\n 'terminal.exitCode': 'Exit-Code {code}',\n 'terminal.running': 'Läuft',\n 'terminal.failed': 'Fehlgeschlagen',\n 'terminal.done': 'Abgeschlossen',\n 'terminal.copy': 'Kopieren',\n 'terminal.copied': 'Kopiert',\n 'terminal.noOutput': 'Keine Ausgabe',\n 'terminal.collapseAria': 'Ausgabe einklappen',\n 'terminal.collapse': 'Einklappen',\n 'terminal.expandAria': 'Die restlichen {n} Ausgabezeilen ausklappen',\n 'terminal.expandRest': '… {n} weitere Zeilen',\n },\n fr: {\n running: 'En cours',\n failed: 'Échec',\n stopped: 'Interrompu',\n expand: 'Développer',\n collapse: 'Réduire',\n more: '+{n}',\n showLess: 'Afficher moins',\n mergedCount: '{n} appels fusionnés',\n countFiles: '{n} fichiers',\n countQueries: '{n} recherches',\n countCommands: '{n} commandes',\n countPrograms: '{n} programmes',\n countCalls: '{n} appels',\n 'terminal.signal': 'Signal {signal}',\n 'terminal.exitCode': 'Code de sortie {code}',\n 'terminal.running': 'En cours',\n 'terminal.failed': 'Échec',\n 'terminal.done': 'Terminé',\n 'terminal.copy': 'Copier',\n 'terminal.copied': 'Copié',\n 'terminal.noOutput': 'Aucune sortie',\n 'terminal.collapseAria': 'Réduire la sortie',\n 'terminal.collapse': 'Réduire',\n 'terminal.expandAria': 'Déployer les {n} lignes de sortie restantes',\n 'terminal.expandRest': '… {n} lignes restantes',\n },\n pt: {\n running: 'Executando',\n failed: 'Falhou',\n stopped: 'Interrompido',\n expand: 'Expandir',\n collapse: 'Recolher',\n more: '+{n}',\n showLess: 'Mostrar menos',\n mergedCount: '{n} chamadas mescladas',\n countFiles: '{n} arquivos',\n countQueries: '{n} pesquisas',\n countCommands: '{n} comandos',\n countPrograms: '{n} programas',\n countCalls: '{n} chamadas',\n 'terminal.signal': 'sinal {signal}',\n 'terminal.exitCode': 'código de saída {code}',\n 'terminal.running': 'Executando',\n 'terminal.failed': 'Falhou',\n 'terminal.done': 'Concluído',\n 'terminal.copy': 'Copiar',\n 'terminal.copied': 'Copiado',\n 'terminal.noOutput': 'Sem saída',\n 'terminal.collapseAria': 'Recolher saída',\n 'terminal.collapse': 'Recolher',\n 'terminal.expandAria': 'Expandir as {n} linhas de saída restantes',\n 'terminal.expandRest': '… mais {n} linhas',\n },\n ko: {\n running: '실행 중',\n failed: '실패',\n stopped: '중단됨',\n expand: '펼치기',\n collapse: '접기',\n more: '+{n}',\n showLess: '더 적게 표시',\n mergedCount: '{n}번 호출 병합됨',\n countFiles: '파일 {n}개',\n countQueries: '검색 {n}회',\n countCommands: '명령 {n}개',\n countPrograms: '프로그램 {n}개',\n countCalls: '호출 {n}회',\n 'terminal.signal': '신호 {signal}',\n 'terminal.exitCode': '종료 코드 {code}',\n 'terminal.running': '실행 중',\n 'terminal.failed': '실패',\n 'terminal.done': '완료',\n 'terminal.copy': '복사',\n 'terminal.copied': '복사됨',\n 'terminal.noOutput': '출력 없음',\n 'terminal.collapseAria': '출력 접기',\n 'terminal.collapse': '접기',\n 'terminal.expandAria': '나머지 {n}줄 출력 펼치기',\n 'terminal.expandRest': '… 나머지 {n}줄',\n },\n ar: {\n running: 'قيد التشغيل',\n failed: 'فشل',\n stopped: 'متوقف',\n expand: 'توسيع',\n collapse: 'طي',\n more: '+{n}',\n showLess: 'إظهار أقل',\n mergedCount: 'تم دمج {n} استدعاء',\n countFiles: '{n} ملف',\n countQueries: '{n} بحث',\n countCommands: '{n} أمر',\n countPrograms: '{n} برنامج',\n countCalls: '{n} استدعاء',\n 'terminal.signal': 'إشارة {signal}',\n 'terminal.exitCode': 'رمز الخروج {code}',\n 'terminal.running': 'قيد التشغيل',\n 'terminal.failed': 'فشل',\n 'terminal.done': 'اكتمل',\n 'terminal.copy': 'نسخ',\n 'terminal.copied': 'تم النسخ',\n 'terminal.noOutput': 'لا يوجد إخراج',\n 'terminal.collapseAria': 'طي الإخراج',\n 'terminal.collapse': 'طي',\n 'terminal.expandAria': 'توسيع {n} أسطر إخراج المتبقية',\n 'terminal.expandRest': '… و{n} أسطر أخرى',\n },\n hi: {\n running: 'चल रहा',\n failed: 'विफल',\n stopped: 'रोका गया',\n expand: 'विस्तार करें',\n collapse: 'संक्षिप्त करें',\n more: '+{n}',\n showLess: 'कम दिखाएं',\n mergedCount: '{n} कॉल मर्ज किए गए',\n countFiles: '{n} फ़ाइलें',\n countQueries: '{n} खोज',\n countCommands: '{n} कमांड',\n countPrograms: '{n} प्रोग्राम',\n countCalls: '{n} कॉल',\n 'terminal.signal': 'सिग्नल {signal}',\n 'terminal.exitCode': 'एग्ज़िट कोड {code}',\n 'terminal.running': 'चल रहा',\n 'terminal.failed': 'विफल',\n 'terminal.done': 'पूर्ण',\n 'terminal.copy': 'कॉपी',\n 'terminal.copied': 'कॉपी हो गया',\n 'terminal.noOutput': 'कोई आउटपुट नहीं',\n 'terminal.collapseAria': 'आउटपुट संक्षिप्त करें',\n 'terminal.collapse': 'संक्षिप्त करें',\n 'terminal.expandAria': 'शेष {n} आउटपुट पंक्तियाँ विस्तृत करें',\n 'terminal.expandRest': '… {n} और पंक्तियाँ',\n },\n id: {\n running: 'Berjalan',\n failed: 'Gagal',\n stopped: 'Dihentikan',\n expand: 'Bentangkan',\n collapse: 'Lipat',\n more: '+{n}',\n showLess: 'Tampilkan lebih sedikit',\n mergedCount: '{n} panggilan digabungkan',\n countFiles: '{n} file',\n countQueries: '{n} pencarian',\n countCommands: '{n} perintah',\n countPrograms: '{n} program',\n countCalls: '{n} panggilan',\n 'terminal.signal': 'sinyal {signal}',\n 'terminal.exitCode': 'kode keluar {code}',\n 'terminal.running': 'Berjalan',\n 'terminal.failed': 'Gagal',\n 'terminal.done': 'Selesai',\n 'terminal.copy': 'Salin',\n 'terminal.copied': 'Tersalin',\n 'terminal.noOutput': 'Tidak ada keluaran',\n 'terminal.collapseAria': 'Lipat keluaran',\n 'terminal.collapse': 'Lipat',\n 'terminal.expandAria': 'Bentangkan {n} baris keluaran tersisa',\n 'terminal.expandRest': '… {n} baris lagi',\n },\n tr: {\n running: 'Çalışıyor',\n failed: 'Başarısız',\n stopped: 'Durduruldu',\n expand: 'Genişlet',\n collapse: 'Daralt',\n more: '+{n}',\n showLess: 'Daha az göster',\n mergedCount: '{n} çağrı birleştirildi',\n countFiles: '{n} dosya',\n countQueries: '{n} arama',\n countCommands: '{n} komut',\n countPrograms: '{n} program',\n countCalls: '{n} çağrı',\n 'terminal.signal': 'sinyal {signal}',\n 'terminal.exitCode': 'çıkış kodu {code}',\n 'terminal.running': 'Çalışıyor',\n 'terminal.failed': 'Başarısız',\n 'terminal.done': 'Tamamlandı',\n 'terminal.copy': 'Kopyala',\n 'terminal.copied': 'Kopyalandı',\n 'terminal.noOutput': 'Çıkış yok',\n 'terminal.collapseAria': 'Çıkışı daralt',\n 'terminal.collapse': 'Daralt',\n 'terminal.expandAria': 'Kalan {n} çıkış satırını genişlet',\n 'terminal.expandRest': '… {n} satır daha',\n },\n vi: {\n running: 'Đang chạy',\n failed: 'Thất bại',\n stopped: 'Đã dừng',\n expand: 'Mở rộng',\n collapse: 'Thu gọn',\n more: '+{n}',\n showLess: 'Hiển thị ít hơn',\n mergedCount: 'Đã gộp {n} lệnh gọi',\n countFiles: '{n} tệp',\n countQueries: '{n} lượt tìm kiếm',\n countCommands: '{n} lệnh',\n countPrograms: '{n} chương trình',\n countCalls: '{n} lượt gọi',\n 'terminal.signal': 'tín hiệu {signal}',\n 'terminal.exitCode': 'mã thoát {code}',\n 'terminal.running': 'Đang chạy',\n 'terminal.failed': 'Thất bại',\n 'terminal.done': 'Đã xong',\n 'terminal.copy': 'Sao chép',\n 'terminal.copied': 'Đã sao chép',\n 'terminal.noOutput': 'Không có đầu ra',\n 'terminal.collapseAria': 'Thu gọn đầu ra',\n 'terminal.collapse': 'Thu gọn',\n 'terminal.expandAria': 'Mở rộng {n} dòng đầu ra còn lại',\n 'terminal.expandRest': '… còn {n} dòng',\n },\n th: {\n running: 'กำลังทำงาน',\n failed: 'ล้มเหลว',\n stopped: 'ถูกขัดจังหวะ',\n expand: 'ขยาย',\n collapse: 'ย่อ',\n more: '+{n}',\n showLess: 'แสดงน้อยลง',\n mergedCount: 'รวม {n} การเรียก',\n countFiles: '{n} ไฟล์',\n countQueries: '{n} การค้นหา',\n countCommands: '{n} คำสั่ง',\n countPrograms: '{n} โปรแกรม',\n countCalls: '{n} การเรียก',\n 'terminal.signal': 'สัญญาณ {signal}',\n 'terminal.exitCode': 'รหัสออก {code}',\n 'terminal.running': 'กำลังทำงาน',\n 'terminal.failed': 'ล้มเหลว',\n 'terminal.done': 'เสร็จสิ้น',\n 'terminal.copy': 'คัดลอก',\n 'terminal.copied': 'คัดลอกแล้ว',\n 'terminal.noOutput': 'ไม่มีเอาต์พุต',\n 'terminal.collapseAria': 'ย่อเอาต์พุต',\n 'terminal.collapse': 'ย่อ',\n 'terminal.expandAria': 'ขยายเอาต์พุตอีก {n} บรรทัด',\n 'terminal.expandRest': '… อีก {n} บรรทัด',\n },\n ru: {\n running: 'Выполняется',\n failed: 'Сбой',\n stopped: 'Прервано',\n expand: 'Развернуть',\n collapse: 'Свернуть',\n more: '+{n}',\n showLess: 'Показать меньше',\n mergedCount: 'Объединено вызовов: {n}',\n countFiles: '{n} файлов',\n countQueries: '{n} поисков',\n countCommands: '{n} команд',\n countPrograms: '{n} программ',\n countCalls: '{n} вызовов',\n 'terminal.signal': 'сигнал {signal}',\n 'terminal.exitCode': 'код выхода {code}',\n 'terminal.running': 'Выполняется',\n 'terminal.failed': 'Сбой',\n 'terminal.done': 'Завершено',\n 'terminal.copy': 'Копировать',\n 'terminal.copied': 'Скопировано',\n 'terminal.noOutput': 'Нет вывода',\n 'terminal.collapseAria': 'Свернуть вывод',\n 'terminal.collapse': 'Свернуть',\n 'terminal.expandAria': 'Показать оставшиеся {n} строк вывода',\n 'terminal.expandRest': '… ещё {n} строк',\n },\n it: {\n running: 'In esecuzione',\n failed: 'Non riuscito',\n stopped: 'Interrotto',\n expand: 'Espandi',\n collapse: 'Comprimi',\n more: '+{n}',\n showLess: 'Mostra meno',\n mergedCount: '{n} chiamate unite',\n countFiles: '{n} file',\n countQueries: '{n} ricerche',\n countCommands: '{n} comandi',\n countPrograms: '{n} programmi',\n countCalls: '{n} chiamate',\n 'terminal.signal': 'segnale {signal}',\n 'terminal.exitCode': 'codice di uscita {code}',\n 'terminal.running': 'In esecuzione',\n 'terminal.failed': 'Non riuscito',\n 'terminal.done': 'Completato',\n 'terminal.copy': 'Copia',\n 'terminal.copied': 'Copiato',\n 'terminal.noOutput': 'Nessun output',\n 'terminal.collapseAria': 'Comprimi output',\n 'terminal.collapse': 'Comprimi',\n 'terminal.expandAria': 'Espandi le restanti {n} righe di output',\n 'terminal.expandRest': '… altre {n} righe',\n },\n nl: {\n running: 'Actief',\n failed: 'Mislukt',\n stopped: 'Onderbroken',\n expand: 'Uitklappen',\n collapse: 'Inklappen',\n more: '+{n}',\n showLess: 'Minder tonen',\n mergedCount: '{n} aanroepen samengevoegd',\n countFiles: '{n} bestanden',\n countQueries: '{n} zoekopdrachten',\n countCommands: '{n} opdrachten',\n countPrograms: '{n} programma\\'s',\n countCalls: '{n} aanroepen',\n 'terminal.signal': 'signaal {signal}',\n 'terminal.exitCode': 'exit-code {code}',\n 'terminal.running': 'Actief',\n 'terminal.failed': 'Mislukt',\n 'terminal.done': 'Voltooid',\n 'terminal.copy': 'Kopiëren',\n 'terminal.copied': 'Gekopieerd',\n 'terminal.noOutput': 'Geen uitvoer',\n 'terminal.collapseAria': 'Uitvoer inklappen',\n 'terminal.collapse': 'Inklappen',\n 'terminal.expandAria': 'De overige {n} uitvoerregels uitklappen',\n 'terminal.expandRest': '… nog {n} regels',\n },\n sv: {\n running: 'Kör',\n failed: 'Misslyckades',\n stopped: 'Avbruten',\n expand: 'Expandera',\n collapse: 'Komprimera',\n more: '+{n}',\n showLess: 'Visa mindre',\n mergedCount: '{n} anrop sammanslagna',\n countFiles: '{n} filer',\n countQueries: '{n} sökningar',\n countCommands: '{n} kommandon',\n countPrograms: '{n} program',\n countCalls: '{n} anrop',\n 'terminal.signal': 'signal {signal}',\n 'terminal.exitCode': 'slutkod {code}',\n 'terminal.running': 'Kör',\n 'terminal.failed': 'Misslyckades',\n 'terminal.done': 'Klar',\n 'terminal.copy': 'Kopiera',\n 'terminal.copied': 'Kopierades',\n 'terminal.noOutput': 'Ingen utdata',\n 'terminal.collapseAria': 'Komprimera utdata',\n 'terminal.collapse': 'Komprimera',\n 'terminal.expandAria': 'Expandera de återstående {n} utdataraderna',\n 'terminal.expandRest': '… {n} fler rader',\n },\n pl: {\n running: 'Działa',\n failed: 'Nie powiodło się',\n stopped: 'Przerwano',\n expand: 'Rozwiń',\n collapse: 'Zwiń',\n more: '+{n}',\n showLess: 'Pokaż mniej',\n mergedCount: 'Połączono {n} wywołań',\n countFiles: '{n} plików',\n countQueries: '{n} wyszukań',\n countCommands: '{n} poleceń',\n countPrograms: '{n} programów',\n countCalls: '{n} wywołań',\n 'terminal.signal': 'sygnał {signal}',\n 'terminal.exitCode': 'kod wyjścia {code}',\n 'terminal.running': 'Działa',\n 'terminal.failed': 'Nie powiodło się',\n 'terminal.done': 'Ukończono',\n 'terminal.copy': 'Kopiuj',\n 'terminal.copied': 'Skopiowano',\n 'terminal.noOutput': 'Brak wyjścia',\n 'terminal.collapseAria': 'Zwiń wyjście',\n 'terminal.collapse': 'Zwiń',\n 'terminal.expandAria': 'Rozwiń pozostałe {n} wierszy wyjścia',\n 'terminal.expandRest': '…jeszcze {n} wierszy',\n },\n 'zh-HK': {\n running: '執行中',\n failed: '失敗',\n stopped: '已中斷',\n expand: '展開',\n collapse: '收起',\n more: '+{n}',\n showLess: '收起其餘',\n mergedCount: '已合併 {n} 次呼叫',\n countFiles: '{n} 個檔案',\n countQueries: '{n} 次搜尋',\n countCommands: '{n} 條命令',\n countPrograms: '{n} 段程式碼',\n countCalls: '{n} 次呼叫',\n 'terminal.signal': '訊號 {signal}',\n 'terminal.exitCode': '退出碼 {code}',\n 'terminal.running': '執行中',\n 'terminal.failed': '失敗',\n 'terminal.done': '已完成',\n 'terminal.copy': '複製',\n 'terminal.copied': '已複製',\n 'terminal.noOutput': '無輸出',\n 'terminal.collapseAria': '收起輸出',\n 'terminal.collapse': '收起',\n 'terminal.expandAria': '展開其餘 {n} 行輸出',\n 'terminal.expandRest': '… 其餘 {n} 行',\n },\n 'zh-TW': {\n running: '執行中',\n failed: '失敗',\n stopped: '已中斷',\n expand: '展開',\n collapse: '收起',\n more: '+{n}',\n showLess: '收起其餘',\n mergedCount: '已合併 {n} 次呼叫',\n countFiles: '{n} 個檔案',\n countQueries: '{n} 次搜尋',\n countCommands: '{n} 條命令',\n countPrograms: '{n} 段程式碼',\n countCalls: '{n} 次呼叫',\n 'terminal.signal': '訊號 {signal}',\n 'terminal.exitCode': '退出碼 {code}',\n 'terminal.running': '執行中',\n 'terminal.failed': '失敗',\n 'terminal.done': '已完成',\n 'terminal.copy': '複製',\n 'terminal.copied': '已複製',\n 'terminal.noOutput': '無輸出',\n 'terminal.collapseAria': '收起輸出',\n 'terminal.collapse': '收起',\n 'terminal.expandAria': '展開其餘 {n} 行輸出',\n 'terminal.expandRest': '… 其餘 {n} 行',\n },\n 'zh-MO': {\n running: '執行中',\n failed: '失敗',\n stopped: '已中斷',\n expand: '展開',\n collapse: '收起',\n more: '+{n}',\n showLess: '收起其餘',\n mergedCount: '已合併 {n} 次呼叫',\n countFiles: '{n} 個檔案',\n countQueries: '{n} 次搜尋',\n countCommands: '{n} 條命令',\n countPrograms: '{n} 段程式碼',\n countCalls: '{n} 次呼叫',\n 'terminal.signal': '訊號 {signal}',\n 'terminal.exitCode': '退出碼 {code}',\n 'terminal.running': '執行中',\n 'terminal.failed': '失敗',\n 'terminal.done': '已完成',\n 'terminal.copy': '複製',\n 'terminal.copied': '已複製',\n 'terminal.noOutput': '無輸出',\n 'terminal.collapseAria': '收起輸出',\n 'terminal.collapse': '收起',\n 'terminal.expandAria': '展開其餘 {n} 行輸出',\n 'terminal.expandRest': '… 其餘 {n} 行',\n },\n}","/** Product copy for the merged tool-call rows. */\nexport const zh = {\n running: '进行中',\n failed: '失败',\n stopped: '已中断',\n expand: '展开',\n collapse: '折叠',\n more: '+{n}',\n showLess: '收起其余',\n mergedCount: '已合并 {n} 次调用',\n countFiles: '{n} 个文件',\n countQueries: '{n} 次搜索',\n countCommands: '{n} 条命令',\n countPrograms: '{n} 段代码',\n countCalls: '{n} 次调用',\n copy: '复制',\n copied: '已复制',\n 'terminal.signal': '信号 {signal}',\n 'terminal.exitCode': '退出码 {code}',\n 'terminal.running': '运行中',\n 'terminal.failed': '失败',\n 'terminal.done': '已完成',\n 'terminal.copy': '复制',\n 'terminal.copied': '已复制',\n 'terminal.noOutput': '无输出',\n 'terminal.collapseAria': '收起输出',\n 'terminal.collapse': '折叠',\n 'terminal.expandAria': '展开其余 {n} 行输出',\n 'terminal.expandRest': '… 其余 {n} 行',\n 'read.window': '显示 {shown} / {total} 行',\n 'read.collapseAria': '收起内容',\n 'read.expandAria': '展开其余 {count} 行',\n 'read.expandRest': '… 其余 {count} 行',\n 'search.paths': '{shown} 个路径',\n 'search.paths.truncated': '显示 {shown} / 共 {total} 个路径',\n 'search.matches': '{shown} 处匹配 · {files} 个文件',\n 'search.matches.truncated': '显示 {shown} / 共 {total} 处匹配 · {files} 个文件',\n 'search.noResults': '无结果',\n 'search.collapseAria': '收起结果',\n 'search.expandAria': '展开其余 {count} 行结果',\n 'search.expandRest': '… 其余 {count} 行',\n 'diff.collapseAria': '收起差异',\n 'diff.expandAria': '展开其余 {count} 行差异',\n 'diff.expandRest': '… 其余 {count} 行',\n 'diff.files': '{count} 个文件',\n 'web.noResults': '未找到结果',\n 'web.sourcesTruncated': '来源列表已截断',\n 'web.http': 'HTTP',\n 'web.contentTruncated': '内容已截断',\n 'markdown.footnotes': '脚注',\n} satisfies Record<string, string>\n\nexport type MergeToolCallsKey = keyof typeof zh\n\nexport const en = {\n running: 'Running',\n failed: 'Failed',\n stopped: 'Interrupted',\n expand: 'Expand',\n collapse: 'Collapse',\n more: '+{n}',\n showLess: 'Show fewer',\n mergedCount: '{n} calls merged',\n countFiles: '{n} Files',\n countQueries: '{n} Queries',\n countCommands: '{n} Commands',\n countPrograms: '{n} Programs',\n countCalls: '{n} Calls',\n copy: 'Copy',\n copied: 'Copied',\n 'terminal.signal': 'signal {signal}',\n 'terminal.exitCode': 'exit code {code}',\n 'terminal.running': 'Running',\n 'terminal.failed': 'Failed',\n 'terminal.done': 'Done',\n 'terminal.copy': 'Copy',\n 'terminal.copied': 'Copied',\n 'terminal.noOutput': 'No output',\n 'terminal.collapseAria': 'Collapse output',\n 'terminal.collapse': 'Collapse',\n 'terminal.expandAria': 'Expand the remaining {n} output lines',\n 'terminal.expandRest': '… {n} more lines',\n 'read.window': 'Showing {shown} of {total} lines',\n 'read.collapseAria': 'Collapse content',\n 'read.expandAria': 'Expand {count} more lines',\n 'read.expandRest': '… {count} more lines',\n 'search.paths': '{shown} paths',\n 'search.paths.truncated': 'Showing {shown} of {total} paths',\n 'search.matches': '{shown} matches · {files} files',\n 'search.matches.truncated': 'Showing {shown} of {total} matches · {files} files',\n 'search.noResults': 'No results',\n 'search.collapseAria': 'Collapse results',\n 'search.expandAria': 'Expand {count} more result lines',\n 'search.expandRest': '… {count} more lines',\n 'diff.collapseAria': 'Collapse diff',\n 'diff.expandAria': 'Expand {count} more diff lines',\n 'diff.expandRest': '… {count} more lines',\n 'diff.files': '{count} files',\n 'web.noResults': 'No results found',\n 'web.sourcesTruncated': 'Source list truncated',\n 'web.http': 'HTTP',\n 'web.contentTruncated': 'Content truncated',\n 'markdown.footnotes': 'Footnotes',\n} satisfies Record<MergeToolCallsKey, string>\n\nexport const NS = 'merge-tool-calls'\n","/**\n * The built-in tool universe this plugin shadows by default, plus the\n * variant-classification vocabulary mirroring ui-tool's tool-call model.\n *\n * The keyed `tool.call.toolview` slot dispatches on the exact wire tool name,\n * so a shadowed registration is needed per name (there is no wildcard). This\n * list names every shipped tool whose row belongs to the generic ToolRow\n * family — a variant title/icon plus read/search/diff/terminal/web card or\n * IN/OUT text — which the merged row reproduces faithfully.\n *\n * Deliberately excluded: tools with custom row cards this plugin does not\n * replicate (`skill`, `cordis_define`, and the live `cordis_run` /\n * `cordis_stop` / `cordis_undefine` rows), and `todo_write` /\n * `ask_user_question` whose summary formatting is tool-specific. They keep\n * their built-in rows unless the user names them in the `tools` config\n * explicitly.\n * @module\n */\n\n/** Wire tool names merged by default (empty `tools` config = this list). */\nexport const ALL_TOOL_NAMES: readonly string[] = [\n // File tools (read/search/diff cards).\n 'read', 'grep', 'glob', 'edit', 'write',\n // Shell tools (terminal card).\n 'bash', 'pwsh',\n // Web tools (web card).\n 'web_search', 'web_fetch',\n // Code tool (generic IN/OUT with the program body).\n 'run_code',\n // Cordis inspection verbs (generic read-variant rows).\n 'cordis_package_inspect', 'cordis_runtime_inspect',\n]\n\n/** Tool-row visual variant, mirroring ui-tool's ToolRowVariant. */\nexport type ToolVariant = 'search' | 'read' | 'bash' | 'write' | 'edit' | 'code' | 'others'\n\n/** Figma row titles per variant (design literals, not translatable copy). */\nexport const VARIANT_TITLES: Record<ToolVariant, string> = {\n search: 'Search', read: 'Read', bash: 'Bash',\n write: 'Write', edit: 'Edit', code: 'Code', others: 'Tool call',\n}\n\n/**\n * Known tool name -> row variant (mirrors ui-tool's classification table,\n * minus the run-control verbs: their rows are custom and not shadowed).\n */\nconst TOOL_VARIANTS: Record<string, ToolVariant> = {\n bash: 'bash',\n pwsh: 'bash',\n read: 'read',\n web_fetch: 'read',\n web_search: 'search',\n grep: 'search',\n glob: 'search',\n write: 'write',\n edit: 'edit',\n run_code: 'code',\n cordis_package_inspect: 'read',\n cordis_runtime_inspect: 'read',\n}\n\n/** Tool-owned titles refining a generic row variant (mirrors ui-tool). */\nexport const TOOL_TITLES: Record<string, string> = {\n cordis_package_inspect: 'Inspect',\n cordis_runtime_inspect: 'Inspect',\n pwsh: 'Pwsh',\n}\n\n/** Classify a tool name into its row variant (mirrors ui-tool). */\nexport function classifyTool(toolName: string): ToolVariant {\n return TOOL_VARIANTS[toolName] ?? 'others'\n}\n\n/** The variant title a row shows, honoring tool-owned refinements. */\nexport function variantTitle(toolName: string): string {\n return TOOL_TITLES[toolName] ?? VARIANT_TITLES[classifyTool(toolName)]\n}\n","/**\n * Pure card/row derivation from a frozen call slice, mirroring ui-tool's\n * meta-based card models (read/search/diff/terminal/web) at the plugin\n * boundary (those models are ui-tool internals and cannot be imported\n * cross-package). Same wire contract, same defensive treatment of untrusted\n * result metadata: cards derive from the call arguments plus the persisted\n * result `meta` and single text block. A merged row renders the same surface\n * the built-in row would: a variant title/icon plus a card primitive or IN/OUT\n * text. The localized label props each primitive now requires are supplied by\n * the render site (`rows.tsx`), not here.\n * @module\n */\nimport type {\n ToolCallBlock, ToolResultNode,\n} from '@deepseek-ai/dsh-client-ui-chat/client'\nimport type {\n DiffBlockProps, DiffHunk, ReadBlockProps, SearchBlockProps, SearchFileGroup,\n TerminalBlockProps, WebBlockProps,\n} from '@deepseek-ai/dsh-client-ui-primitives'\nimport { classifyTool, VARIANT_TITLES, TOOL_TITLES, type ToolVariant } from './tool-names.ts'\n\n/** Row state semantic, mirroring ui-tool's ToolRowState. */\nexport type RowState = 'running' | 'ok' | 'error' | 'stopped'\n\nexport type { ToolVariant } from './tool-names.ts'\n\n/** Read-card props the ReadBlock primitive draws (per-render maxLines owned by the caller). */\nexport type ReadCardModel = Pick<ReadBlockProps, 'label' | 'lines' | 'totalLines' | 'lang'>\n\ntype DistributiveOmit<T, K extends keyof T> = T extends unknown ? Omit<T, K> : never\n\n/** Search-card props (the primitive's own union minus the render site's fields). */\ntype SearchCardModelProps = DistributiveOmit<SearchBlockProps, 'labels' | 'maxLines' | 'className'>\n\n/** Search-card props plus the capped-result recovery locator (mirrors ui-tool). */\nexport interface SearchCardModel {\n readonly card: SearchCardModelProps\n readonly recovery: string | undefined\n}\n\n/** Diff-card props (mirrors ui-tool; maxLines/labels/className belong to the render site). */\nexport interface DiffCardModel {\n readonly card: Pick<DiffBlockProps, 'diffs'>\n}\n\n/** Terminal-card props (mirrors ui-tool; maxLines/labels/className belong to the render site). */\nexport interface TerminalCardModel {\n readonly card: Pick<TerminalBlockProps, 'command' | 'cwd' | 'output' | 'exitCode' | 'signal' | 'running'>\n /** The call's model-authored description shown above the card. */\n readonly description: string | undefined\n}\n\n/** Web-card props (the primitive's own union minus the render site's fields). */\nexport type WebCardModel = DistributiveOmit<WebBlockProps, 'labels' | 'className'>\n\n/** A parsed, object-shaped call arguments bag (mirrors ui-tool's ParsedToolCall). */\ninterface ParsedArgs {\n readonly name: string\n readonly args: Record<string, unknown>\n}\n\n/**\n * Parse the call head paired with one immutable Tool block.\n * @param block - running or settled Tool block.\n * @returns the Tool name and object arguments, or null when unavailable.\n */\nfunction parsedArgsOf(block: ToolCallBlock): ParsedArgs | null {\n const call = 'kind' in block ? block.call : block\n if (call === null) return null\n let value: unknown\n try {\n value = JSON.parse(call.argsRaw)\n } catch {\n return null\n }\n if (typeof value !== 'object' || value === null || Array.isArray(value)) return null\n return { name: call.name, args: value as Record<string, unknown> }\n}\n\n/**\n * Read the exact single text block consumed by first-party card derivations.\n * @param block - settled Tool result.\n * @returns its text, or undefined for any other content layout.\n */\nfunction singleResultText(block: ToolResultNode): string | undefined {\n if (block.content.length !== 1) return undefined\n const only = block.content[0]\n return only?.type === 'text' ? only.text : undefined\n}\n\n/** True when a settled terminal card reports a failing exit (mirrors ui-tool). */\nexport function terminalFailed(model: TerminalCardModel): boolean {\n const { exitCode, signal, running } = model.card\n return running !== true && ((exitCode !== undefined && exitCode !== 0) || signal !== undefined)\n}\n\n/** Everything a merged row needs, derived once from the frozen slice. */\nexport interface CallRowModel {\n readonly state: RowState\n readonly variant: ToolVariant\n /** Row title: variant title, or the tool-owned title when it refines one. */\n readonly title: string\n /** Args/result-derived one-line summary (path for file tools, query for searches, …). */\n readonly summary: string\n /** Expanded-body input text (pretty args); null = no input section. */\n readonly body: string | null\n /** Flattened result text; null while running or when the result carries no text. */\n readonly output: string | null\n /** First result line on an error row (the collapsed summary's error text). */\n readonly errorSummary: string | null\n /** Openable workspace path from args; absent for non-file tools and errors. */\n readonly filePath: string | undefined\n /** Whether the row has anything to expand (a card, args body, or output). */\n readonly expandable: boolean\n /** Expanded-body content cards, mutually exclusive, or null when absent. */\n readonly terminal: TerminalCardModel | null\n readonly diff: DiffCardModel | null\n readonly read: ReadCardModel | null\n readonly search: SearchCardModel | null\n readonly web: WebCardModel | null\n}\n\n/**\n * Flatten a settled result's content blocks to display text.\n * @param node - settled result node.\n * @returns joined text (may be empty).\n */\nexport function resultText(node: ToolResultNode): string {\n const parts: string[] = []\n for (const block of node.content) {\n if (block.type === 'text') parts.push(block.text)\n else parts.push(JSON.stringify(block, null, 2))\n }\n if (parts.length === 0 && node.error !== undefined) parts.push(`${node.error.name}: ${node.error.code}`)\n return parts.join('\\n')\n}\n\nfunction firstLine(text: string): string {\n const nl = text.indexOf('\\n')\n return nl === -1 ? text : text.slice(0, nl)\n}\n\n/** Strip the workspace root from a workspace-rooted absolute path (display only). */\nexport function relativizeToCwd(text: string, cwd: string | undefined): string {\n if (cwd === undefined || cwd === '') return text\n const root = cwd.replace(/[/\\\\]+$/, '')\n if (text.startsWith(`${root}/`) || text.startsWith(`${root}\\\\`)) return text.slice(root.length + 1)\n return text\n}\n\n/**\n * Resolve a Workspace-relative path into the Host-facing spelling (local\n * mirror of `@deepseek-ai/dsh-util-workspace-path`'s `resolveWorkspacePath`:\n * that static utility package is not a dynamic client bundle row, so the\n * browser half carries this one-function copy).\n * @param cwd - Session Workspace root, when known.\n * @param path - Absolute or Workspace-relative path.\n * @returns an absolute path when a Workspace root is available, otherwise the original path.\n */\nfunction resolveWorkspacePath(cwd: string | undefined, path: string): string {\n if (path.startsWith('/') || /^[A-Za-z]:[/\\\\]/.test(path) || path.startsWith('\\\\\\\\')) return path\n if (cwd === undefined || cwd === '') return path\n const base = cwd.replace(/[/\\\\]+$/, '')\n const relative = path.replace(/^[/\\\\]+/, '')\n return `${base}/${relative}`\n}\n\n/**\n * Abbreviate a POSIX home directory for display (local mirror of\n * `@deepseek-ai/dsh-util-workspace-path`'s `abbreviateHomePath`).\n * @param path - Absolute or already-short display path.\n * @param home - Host account home; absent skips abbreviation.\n * @returns `~` or `~/…` for the POSIX home and its descendants, otherwise `path`.\n */\nfunction abbreviateHomePath(path: string, home: string | undefined): string {\n if (home === undefined || home === '') return path\n if (/^[A-Za-z]:[/\\\\]/.test(path) || path.startsWith('\\\\\\\\')\n || /^[A-Za-z]:[/\\\\]/.test(home) || home.startsWith('\\\\\\\\')) return path\n const root = home.replace(/\\/+$/, '')\n if (root === '' || root === '/') return path\n if (path.replace(/\\/+$/, '') === root) return '~'\n if (path.startsWith(`${root}/`)) return `~${path.slice(root.length)}`\n return path\n}\n\nfunction parseArgs(argsRaw: string): Record<string, unknown> | undefined {\n try {\n const parsed: unknown = JSON.parse(argsRaw)\n return typeof parsed === 'object' && parsed !== null ? parsed as Record<string, unknown> : undefined\n } catch {\n return undefined\n }\n}\n\nfunction pickString(args: Record<string, unknown>, keys: readonly string[]): string | undefined {\n for (const key of keys) {\n const value = args[key]\n if (typeof value === 'string' && value !== '') return value\n }\n return undefined\n}\n\n/** Summary key preference per row variant (args-derived, mirrors ui-tool). */\nconst SUMMARY_KEYS: Record<ToolVariant, readonly string[]> = {\n bash: ['description', 'command'],\n read: ['path', 'file_path', 'url'],\n search: ['query', 'pattern', 'url'],\n write: ['path', 'file_path'],\n edit: ['path', 'file_path'],\n code: ['description'],\n others: [],\n}\n\nfunction deriveSummary(variant: ToolVariant, argsRaw: string): string {\n const parsed = parseArgs(argsRaw)\n if (parsed === undefined) return firstLine(argsRaw)\n // web_search takes a `queries` array: the summary joins the queries.\n if (variant === 'search' && Array.isArray(parsed.queries)) {\n const queries = parsed.queries.filter((query): query is string => typeof query === 'string' && query !== '')\n if (queries.length > 0) return queries.map(firstLine).join(', ')\n }\n const picked = pickString(parsed, SUMMARY_KEYS[variant])\n if (picked !== undefined) return firstLine(picked)\n for (const value of Object.values(parsed)) {\n if (typeof value === 'string' && value !== '') return firstLine(value)\n }\n return firstLine(argsRaw)\n}\n\n/** Path keys only — never `url` (web_fetch lands on the read variant). */\nconst FILE_PATH_KEYS = ['path', 'file_path'] as const\n\n/** File-tool variants whose summary may be an openable workspace path. */\nconst FILE_PATH_VARIANTS: ReadonlySet<ToolVariant> = new Set(['read', 'write', 'edit'])\n\nfunction deriveFilePath(variant: ToolVariant, argsRaw: string): string | undefined {\n if (!FILE_PATH_VARIANTS.has(variant)) return undefined\n const parsed = parseArgs(argsRaw)\n if (parsed === undefined) return undefined\n return pickString(parsed, FILE_PATH_KEYS)?.split('\\n')[0]\n}\n\nfunction deriveBody(variant: ToolVariant, argsRaw: string): string | null {\n if (argsRaw === '') return null\n const parsed = parseArgs(argsRaw)\n if (parsed === undefined) return argsRaw\n // The code row's expanded body IS the program, not the args JSON envelope.\n if (variant === 'code') {\n const code = parsed.code\n if (typeof code === 'string' && code !== '') return code\n }\n return JSON.stringify(parsed, null, 2)\n}\n\n/** Derive the row model for one call of a grouped tool. */\nexport function callRowModel(\n toolName: string,\n block: ToolCallBlock,\n cwd: string | undefined,\n home: string | undefined,\n): CallRowModel {\n const done = 'kind' in block\n const argsRaw = (done ? block.call?.argsRaw : block.argsRaw) ?? ''\n const state: RowState = !done ? 'running'\n : block.error?.code === 'interrupted' ? 'stopped'\n : block.isError ? 'error' : 'ok'\n const variant = classifyTool(toolName)\n const terminal = terminalCardOf(block, cwd)\n const read = readCardOf(block, cwd, home)\n const diff = diffCardOf(block)\n const search = searchCardOf(block)\n const web = webCardOf(block)\n const base = argsRaw === ''\n ? block.callId\n : abbreviateHomePath(relativizeToCwd(deriveSummary(variant, argsRaw), cwd), home)\n const toolTitle = TOOL_TITLES[toolName]\n // Others keeps the static \"Tool call\" title; the real tool name rides the\n // summary slot unless the tool owns a specific title (mirrors ui-tool).\n const argsSummary = variant === 'others' && toolName !== '' && toolTitle === undefined\n ? `${toolName} · ${base}`\n : base\n const filePath = deriveFilePath(variant, argsRaw)\n const output = done ? (resultText(block) || null) : null\n const errorSummary = state === 'error' && output !== null ? firstLine(output) : null\n // A terminal card's model-authored description is the contract's above-card\n // text (mirrors ui-tool); the old result-view replacement title is gone.\n const summary = terminal?.description ?? argsSummary\n // Single-file tools never expose an args body — the path link is the only\n // args interaction (mirrors ui-tool's singleFile rule).\n const body = filePath !== undefined ? null : deriveBody(variant, argsRaw)\n // A failing exit status is the terminal card's own error signal: the call\n // settles isError:false, and the red state dot is its only collapsed signal.\n const finalState = state === 'ok' && terminal !== null && terminalFailed(terminal)\n ? 'error'\n : state\n const expandable = terminal !== null || diff !== null || read !== null\n || search !== null || web !== null || body !== null || output !== null\n return {\n state: finalState,\n variant,\n title: toolTitle ?? VARIANT_TITLES[variant],\n summary,\n body,\n output,\n errorSummary,\n filePath,\n expandable,\n terminal,\n diff,\n read,\n search,\n web,\n }\n}\n\n/** Read-card derivation, or null when this call is not a read card (mirrors ui-tool). */\nfunction readCardOf(block: ToolCallBlock, cwd: string | undefined, home: string | undefined): ReadCardModel | null {\n if (block.parentCallId !== undefined || !('kind' in block) || block.isError) return null\n const parsed = parsedArgsOf(block)\n if (parsed?.name !== 'read') return null\n const { file_path: path, offset, limit } = parsed.args\n if (typeof path !== 'string' || path.trim() === '') return null\n if (offset !== undefined && (typeof offset !== 'number' || !Number.isInteger(offset) || offset < 1)) return null\n if (limit !== undefined && (typeof limit !== 'number' || !Number.isInteger(limit) || limit < 1)) return null\n const meta = readMeta(block.meta)\n if (meta === null) return null\n const text = singleResultText(block)\n if (text === undefined) return null\n const body = /^<path>[^\\n]*<\\/path>\\n<type>file<\\/type>\\n<content>\\n([\\s\\S]*)\\n<\\/content>$/u.exec(text)?.[1]\n if (body === undefined) return null\n return {\n label: abbreviateHomePath(relativizeToCwd(meta.path, cwd), home),\n lines: meta.lines,\n totalLines: meta.totalLines,\n lang: meta.lang,\n }\n}\n\ninterface ReadMeta {\n path: string\n lines: { number: number; text: string }[]\n totalLines: number\n lang?: string\n}\n\nfunction readMeta(meta: unknown): ReadMeta | null {\n if (typeof meta !== 'object' || meta === null || Array.isArray(meta)) return null\n const { path, offset, lines, totalLines, lang } = meta as Record<string, unknown>\n if (typeof path !== 'string' || typeof offset !== 'number' || !Number.isInteger(offset) || offset < 1) return null\n if (typeof totalLines !== 'number' || !Number.isInteger(totalLines) || totalLines < 0 || !Array.isArray(lines)) return null\n if (lang !== undefined && typeof lang !== 'string') return null\n const narrowed: { number: number; text: string }[] = []\n let previous = offset - 1\n for (const line of lines) {\n if (typeof line !== 'object' || line === null || Array.isArray(line)) return null\n const { number, text } = line as Record<string, unknown>\n if (typeof number !== 'number' || !Number.isInteger(number) || number < 1 || number <= previous) return null\n if (number > totalLines || typeof text !== 'string') return null\n previous = number\n narrowed.push({ number, text })\n }\n return {\n path,\n lines: narrowed,\n totalLines,\n ...(lang === undefined ? {} : { lang }),\n }\n}\n\nfunction isValidFiles(files: unknown): files is SearchFileGroup[] {\n return Array.isArray(files) && files.every(file =>\n typeof file === 'object' && file !== null\n && typeof (file as { path?: unknown }).path === 'string'\n && Array.isArray((file as { matches?: unknown }).matches)\n && (file as { matches: unknown[] }).matches.every(match =>\n typeof match === 'object' && match !== null\n && typeof (match as { lineNumber?: unknown }).lineNumber === 'number'\n && typeof (match as { line?: unknown }).line === 'string'))\n}\n\nfunction flattenContent(content: readonly { type: string; text?: string }[]): string | undefined {\n const text = content\n .filter((block): block is { type: 'text'; text: string } => block.type === 'text' && typeof block.text === 'string')\n .map(block => block.text)\n .join('\\n')\n return text === '' ? undefined : text\n}\n\n/** Search-card derivation, or null when this call is not a search card (mirrors ui-tool). */\nfunction searchCardOf(block: ToolCallBlock): SearchCardModel | null {\n if (block.parentCallId !== undefined || !('kind' in block) || block.isError) return null\n const parsed = parsedArgsOf(block)\n if (parsed === null || (parsed.name !== 'grep' && parsed.name !== 'glob')) return null\n const { pattern, path } = parsed.args\n if (typeof pattern !== 'string') return null\n if (parsed.name === 'grep' && pattern === '') return null\n if (parsed.name === 'glob' && pattern.trim() === '') return null\n if (path !== undefined && (typeof path !== 'string' || path.trim() === '')) return null\n if (parsed.name === 'grep') {\n const include = parsed.args.include\n if (include !== undefined && typeof include !== 'string') return null\n }\n if (typeof block.meta !== 'object' || block.meta === null || Array.isArray(block.meta)) return null\n const meta = block.meta as Record<string, unknown>\n if (typeof meta.truncated !== 'boolean') return null\n if (typeof meta.total !== 'number' || !Number.isInteger(meta.total) || meta.total < 0) return null\n const common = { truncated: meta.truncated, total: meta.total }\n const recovery = meta.truncated ? flattenContent(block.content) : undefined\n if (meta.shape === 'matches') {\n if (!isValidFiles(meta.files)) return null\n return { recovery, card: { kind: 'matches', files: meta.files, ...common } }\n }\n if (meta.shape !== 'paths') return null\n if (!Array.isArray(meta.paths) || !meta.paths.every(path => typeof path === 'string')) return null\n return { recovery, card: { kind: 'paths', paths: meta.paths, ...common } }\n}\n\n/** Narrow a result metadata `diffs` to well-formed hunks (mirrors ui-tool). */\nfunction narrowDiffs(diffs: unknown): DiffHunk[] | null {\n if (!Array.isArray(diffs) || diffs.length === 0) return null\n const out: DiffHunk[] = []\n for (const hunk of diffs) {\n if (typeof hunk !== 'object' || hunk === null) return null\n const { path, oldText, newText } = hunk as Record<string, unknown>\n if (typeof path !== 'string') return null\n if (oldText !== null && typeof oldText !== 'string') return null\n if (typeof newText !== 'string') return null\n out.push({ path, oldText, newText })\n }\n return out\n}\n\ntype IntendedDiff = { tool: 'write' | 'edit' | 'str_replace_editor'; diff: DiffHunk }\n\nfunction intendedDiff(block: ToolCallBlock): IntendedDiff | null {\n const parsed = parsedArgsOf(block)\n if (parsed === null) return null\n if (parsed.name === 'str_replace_editor') {\n const { command, path, file_text: fileText, old_str: oldText, new_str: newText } = parsed.args\n if (typeof path !== 'string' || path.trim() === '') return null\n if (command === 'create') {\n if (fileText !== undefined && typeof fileText !== 'string') return null\n return { tool: 'str_replace_editor', diff: { path, oldText: null, newText: fileText ?? '' } }\n }\n if (command === 'str_replace') {\n if (oldText !== undefined && typeof oldText !== 'string') return null\n if (newText !== undefined && typeof newText !== 'string') return null\n return { tool: 'str_replace_editor', diff: { path, oldText: oldText ?? null, newText: newText ?? '' } }\n }\n return null\n }\n const { file_path: path } = parsed.args\n if (typeof path !== 'string' || path.trim() === '') return null\n if (parsed.name === 'write') {\n const { content } = parsed.args\n return typeof content === 'string'\n ? { tool: 'write', diff: { path, oldText: null, newText: content } }\n : null\n }\n if (parsed.name !== 'edit') return null\n const { old_string: oldText, new_string: newText, replace_all: replaceAll } = parsed.args\n if (typeof oldText !== 'string' || typeof newText !== 'string') return null\n if (replaceAll !== undefined && typeof replaceAll !== 'boolean') return null\n return { tool: 'edit', diff: { path, oldText: oldText || null, newText } }\n}\n\nfunction appliedDiffs(meta: unknown): DiffHunk[] | 'empty' | null {\n if (typeof meta !== 'object' || meta === null || Array.isArray(meta)) return null\n const diffs = (meta as Record<string, unknown>).diffs\n if (!Array.isArray(diffs)) return null\n if (diffs.length === 0) return 'empty'\n return narrowDiffs(diffs)\n}\n\n/** Diff-card derivation, or null when this call is not a diff card (mirrors ui-tool). */\nfunction diffCardOf(block: ToolCallBlock): DiffCardModel | null {\n if (block.parentCallId !== undefined) return null\n const intended = intendedDiff(block)\n if (intended === null) return null\n if (!('kind' in block)) return { card: { diffs: [intended.diff] } }\n if (intended.tool === 'str_replace_editor') return null\n if (block.isError) return null\n const applied = appliedDiffs(block.meta)\n if (applied === null || applied === 'empty') {\n return intended.tool === 'write' ? { card: { diffs: [intended.diff] } } : null\n }\n return { card: { diffs: applied } }\n}\n\ninterface ShellCall {\n command: string\n description: string | undefined\n workdir: string | undefined\n persistent: boolean\n background: boolean\n}\n\nfunction shellCallOf(name: string, args: Record<string, unknown>): ShellCall | null {\n if (name !== 'bash' && name !== 'pwsh') return null\n const { command, description, timeoutMs, workdir, run_in_background: background } = args\n if (typeof command !== 'string' || command.trim() === '') return null\n if (timeoutMs !== undefined && (typeof timeoutMs !== 'number' || !Number.isFinite(timeoutMs) || timeoutMs <= 0)) return null\n if (workdir !== undefined && typeof workdir !== 'string') return null\n if (background !== undefined && typeof background !== 'boolean') return null\n if (description === undefined) {\n // Persistent shell providers omit `description`; their settled results\n // carry no single process exit status, so they fall back to IN/OUT.\n return { command, description: undefined, workdir: undefined, persistent: true, background: false }\n }\n if (typeof description !== 'string' || description.trim() === '') return null\n return { command, description, workdir, persistent: false, background: background === true }\n}\n\n/**\n * Parse the result text's trailing exit-status marker (mirrors the shell\n * renderer's literal contract without importing that Host-only package).\n * @param text - rendered shell result text.\n * @returns output with a trailing exit-code or signal marker extracted.\n */\nfunction parseExitStatus(text: string): { output: string; exitCode?: number; signal?: string } {\n const signal = /\\n\\[killed by signal: ([^\\]\\n]+)\\]$/.exec(text)\n if (signal?.[1] !== undefined) return { output: text.slice(0, signal.index), signal: signal[1] }\n const exit = /\\n\\[exit code: (\\d+)\\]$/.exec(text)\n if (exit?.[1] !== undefined) return { output: text.slice(0, exit.index), exitCode: Number(exit[1]) }\n return { output: text, exitCode: 0 }\n}\n\n/**\n * Collapse `.` and `..` segments so the prompt label names the directory the\n * command actually ran in (local mirror of ui-tool's terminal normalization).\n * @param path - a joined or absolute path, possibly carrying `.`/`..` segments.\n * @returns the same path with those segments resolved.\n */\nfunction normalizeSegments(path: string): string {\n if (!/(?:^|[/\\\\])\\.\\.?(?:[/\\\\]|$)/.test(path)) return path\n const backslashed = path.includes('\\\\') && !path.includes('/')\n const separator = backslashed ? '\\\\' : '/'\n const rooted = /^[/\\\\]/.test(path)\n const drive = /^[A-Za-z]:/.exec(path)?.[0] ?? ''\n const body = collapse(path.slice(drive.length), rooted || drive !== '', separator)\n const leading = rooted ? separator : ''\n return drive === '' ? `${leading}${body}` : `${drive}${rooted ? leading : separator}${body}`\n}\n\nfunction collapse(body: string, rooted: boolean, separator = '/'): string {\n const kept: string[] = []\n for (const segment of body.split(/[/\\\\]/)) {\n if (segment === '' || segment === '.') continue\n if (segment === '..') {\n if (kept.length > 0 && kept[kept.length - 1] !== '..') kept.pop()\n else if (!rooted) kept.push(segment)\n continue\n }\n kept.push(segment)\n }\n return kept.join(separator)\n}\n\n/**\n * Resolve a shell call's workdir for display: an absolute path is used as-is,\n * a relative one joins under the session workspace, and an omitted one IS the\n * session workspace.\n * @param workdir - the raw call's workdir, if any.\n * @param sessionCwd - the session workspace root, if the caller knows it.\n * @returns the working directory for the prompt label, or undefined.\n */\nfunction resolveTerminalCwd(workdir: string | undefined, sessionCwd: string | undefined): string | undefined {\n if (workdir === undefined || workdir === '') return sessionCwd\n if (sessionCwd === undefined || sessionCwd === '') return normalizeSegments(workdir)\n return normalizeSegments(resolveWorkspacePath(sessionCwd, workdir))\n}\n\n/** Terminal-card derivation, or null when this call is not a terminal card (mirrors ui-tool). */\nfunction terminalCardOf(block: ToolCallBlock, sessionCwd: string | undefined): TerminalCardModel | null {\n if (block.parentCallId !== undefined) return null\n const parsed = parsedArgsOf(block)\n if (parsed === null) return null\n if (parsed.name !== 'bash' && parsed.name !== 'pwsh') return null\n const call = shellCallOf(parsed.name, parsed.args)\n if (call === null || call.background) return null\n const cwd = resolveTerminalCwd(call.workdir, sessionCwd)\n if (!('kind' in block)) {\n return {\n description: call.description,\n card: {\n command: call.command,\n cwd,\n output: undefined,\n exitCode: undefined,\n signal: undefined,\n running: true,\n },\n }\n }\n if (block.isError || call.persistent) return null\n const output = singleResultText(block)\n if (output === undefined) return null\n const status = parseExitStatus(output)\n return {\n description: call.description,\n card: {\n command: call.command,\n cwd,\n output: status.output,\n exitCode: status.exitCode,\n signal: status.signal,\n running: false,\n },\n }\n}\n\n/** Web-card derivation, or null when this call is not a web card (mirrors ui-tool). */\nfunction webCardOf(block: ToolCallBlock): WebCardModel | null {\n if (block.parentCallId !== undefined || !('kind' in block) || block.isError) return null\n const parsed = parsedArgsOf(block)\n if (parsed === null) return null\n if (parsed.name === 'web_search') {\n const { queries } = parsed.args\n if (!Array.isArray(queries) || queries.length === 0) return null\n if (!queries.every(query => typeof query === 'string' && query.trim() !== '')) return null\n } else if (parsed.name === 'web_fetch') {\n const { url } = parsed.args\n if (typeof url !== 'string' || url.trim() === '') return null\n } else {\n return null\n }\n if (typeof block.meta !== 'object' || block.meta === null || Array.isArray(block.meta)) return null\n const meta = block.meta as Record<string, unknown>\n if (typeof meta.truncated !== 'boolean') return null\n if (parsed.name === 'web_search') {\n const sources = webSources(meta.sources)\n if (sources === null || (meta.answer !== undefined && typeof meta.answer !== 'string')) return null\n return {\n kind: 'search',\n answer: meta.answer,\n sources,\n truncated: meta.truncated,\n }\n }\n if (typeof meta.url !== 'string') return null\n if (typeof meta.statusCode !== 'number' || !Number.isInteger(meta.statusCode)) return null\n return {\n kind: 'fetch',\n url: meta.url,\n statusCode: meta.statusCode,\n truncated: meta.truncated,\n }\n}\n\ninterface WebSource {\n url: string\n title?: string\n snippet?: string\n publishedAt?: string\n}\n\nfunction webSources(value: unknown): WebSource[] | null {\n if (!Array.isArray(value)) return null\n const sources: WebSource[] = []\n for (const source of value) {\n if (typeof source !== 'object' || source === null) return null\n const { url, title, snippet, publishedAt } = source as Record<string, unknown>\n if (typeof url !== 'string') return null\n if (title !== undefined && typeof title !== 'string') return null\n if (snippet !== undefined && typeof snippet !== 'string') return null\n if (publishedAt !== undefined && typeof publishedAt !== 'string') return null\n sources.push({\n url,\n ...(title === undefined ? {} : { title }),\n ...(snippet === undefined ? {} : { snippet }),\n ...(publishedAt === undefined ? {} : { publishedAt }),\n })\n }\n return sources\n}\n","/**\n * Pure detection of a consecutive run of grouped tool calls in the chat flow,\n * and the per-seat merged-group partition over it.\n *\n * A pure function of the chat snapshot (order + node store), so the merged\n * display is deterministic under replay: the web layer recomputes it per frame.\n * @module\n */\nimport type { ChatConversationViewNode, ChatNodeStore, ToolCallBlock } from '@deepseek-ai/dsh-client-ui-chat/client'\nimport type { MergeGroupMode } from '../types.ts'\nimport { classifyTool } from './tool-names.ts'\n\n/** Tool-call node kind registered by ui-chat's built-in tool definition. */\nconst TOOL_CALL_KIND = 'tool-call'\n\n/** Extract a root call block from any chat node, when it is a tool-call node. */\nfunction toolRootOf(node: ChatConversationViewNode): ToolCallBlock | null {\n if (node.kind !== TOOL_CALL_KIND) return null\n const root = (node.data as { root?: unknown }).root\n return typeof root === 'object' && root !== null ? root as ToolCallBlock : null\n}\n\n/** The wire tool name of a call in either lifecycle form (mirrors ui-tool). */\nexport function callNameOf(block: ToolCallBlock): string {\n return 'kind' in block ? (block.call?.name ?? '') : block.name\n}\n\n/** Whether the call's wire name is one of the grouped tools (empty = all). */\nexport function isGroupedTool(name: string, tools: readonly string[]): boolean {\n return tools.length === 0 || tools.includes(name)\n}\n\n/** Step identity of a node's location; undefined when the node is not step-bound. */\nfunction stepIdOf(node: ChatConversationViewNode): string | undefined {\n const location = node.location\n return location.kind === 'step' ? `${location.turn.turn}:${location.step.step}` : undefined\n}\n\n/** One merged group: the group's first call plus its consecutive continuations. */\nexport interface ReadRun {\n /** Whether this seat is the group's rendering head (the only seat that shows the card). */\n readonly isFirst: boolean\n /** The group's root blocks in flow order (first + continuations). */\n readonly blocks: readonly ToolCallBlock[]\n}\n\n/**\n * Compute the merged group this call belongs to.\n *\n * 1. Locates this call's node in the chat order; null when it is not a chat\n * tool-call node (e.g. a read dispatched as a subcall). The node key\n * format stays a ui-conversation internal, so the seat finds itself by\n * scanning the store for the tool-call node owning its call id instead of\n * recomputing the key.\n * 2. Walks backward/forward to the maximal consecutive run containing it. A\n * call continues the run when it is a grouped tool AND same-tool-same-run:\n * the identical wire name, or a sibling of the same known variant family\n * (grep+glob, bash+pwsh, read+web_fetch…). Unknown names (variant\n * `others`) only merge with themselves, so unrelated tools never share a\n * card (`adjacent`: any consecutive run; `step`: same agent step as this\n * call).\n * 3. Partitions the run into `maxGroupSize`-sized groups; this call is the\n * group's first only when it heads one of those partitions. Truncation\n * therefore never orphans a call: the excess starts its own group.\n *\n * @param order - chat node key order.\n * @param nodes - chat node store.\n * @param myCallId - the call id of the seat asking about itself.\n * @param tools - grouped wire tool names; empty means every tool.\n * @param groupBy - grouping mode.\n * @param maxGroupSize - per-group cap.\n * @returns the group partition, or null when the call is not a chat tool-call node.\n */\nexport function readRun(\n order: readonly string[],\n nodes: ChatNodeStore,\n myCallId: string,\n tools: readonly string[],\n groupBy: MergeGroupMode,\n maxGroupSize: number,\n): ReadRun | null {\n const myIndex = myIndexOf(order, nodes, myCallId)\n if (myIndex < 0) return null\n const myRoot = rootAtNode(order, nodes, myIndex)\n if (myRoot === null) return null\n const myName = callNameOf(myRoot)\n const myVariant = classifyTool(myName)\n const size = Math.max(1, maxGroupSize)\n\n const rootAt = (index: number): ToolCallBlock | null => rootAtNode(order, nodes, index)\n const myStep = groupBy === 'step' ? stepIdOfNodeAt(order, nodes, myIndex) : undefined\n const inGroup = (index: number): boolean => {\n const root = rootAt(index)\n if (root === null || !isGroupedTool(callNameOf(root), tools)) return false\n const name = callNameOf(root)\n // Same-name calls always continue the run; known families merge siblings\n // (grep+glob, bash+pwsh); unknown names merge only with themselves.\n if (name !== myName) {\n if (myVariant === 'others' || classifyTool(name) !== myVariant) return false\n }\n if (groupBy !== 'step') return true\n return myStep !== undefined && stepIdOfNodeAt(order, nodes, index) === myStep\n }\n\n let start = myIndex\n while (start > 0 && inGroup(start - 1)) start--\n let end = myIndex\n while (end < order.length - 1 && inGroup(end + 1)) end++\n\n const groupStart = start + Math.floor((myIndex - start) / size) * size\n const groupEnd = Math.min(groupStart + size, end + 1)\n\n const blocks: ToolCallBlock[] = []\n for (let index = groupStart; index < groupEnd; index++) {\n const root = rootAt(index)\n if (root !== null) blocks.push(root)\n }\n return { isFirst: myIndex === groupStart, blocks }\n}\n\n/** Index in the chat order of the tool-call node owning `callId`; -1 when absent. */\nfunction myIndexOf(order: readonly string[], nodes: ChatNodeStore, callId: string): number {\n for (let index = 0; index < order.length; index++) {\n const key = order[index]\n if (key === undefined) continue\n const node = nodes.get(key)\n if (node?.kind !== TOOL_CALL_KIND) continue\n const root = toolRootOf(node)\n if (root?.callId === callId) return index\n }\n return -1\n}\n\nfunction rootAtNode(order: readonly string[], nodes: ChatNodeStore, index: number): ToolCallBlock | null {\n const key = order[index]\n const node = key === undefined ? undefined : nodes.get(key)\n return node === undefined ? null : toolRootOf(node)\n}\n\nfunction stepIdOfNodeAt(order: readonly string[], nodes: ChatNodeStore, index: number): string | undefined {\n const key = order[index]\n const node = key === undefined ? undefined : nodes.get(key)\n return node === undefined ? undefined : stepIdOf(node)\n}\n","/**\n * Merged tool-call row — the shadowed `tool.call.toolview` registrant.\n *\n * For the first call of a consecutive run of grouped tools, renders the run as\n * one card (the first call's full row) plus one compact child row per\n * continuation call. For a continuation call, renders nothing: the seat stays\n * empty and the injected stylesheet collapses it out of the flow. When the\n * call is not a chat tool-call node at all (e.g. dispatched as a subcall),\n * falls back to a plain single row so the call never disappears.\n *\n * The row surface mirrors the built-in generic ToolRow: a variant title/icon\n * plus the settled card (read/search/diff/terminal/web) or IN/OUT text. The\n * card primitives' localized label props are built here from the plugin's own\n * dictionary (the primitives are cordis-free and require complete labels).\n *\n * Everything here is a pure function of the chat snapshot + the frozen call\n * slices (replay-deterministic); expand state is component-local view state.\n * @module\n */\nimport { memo, useLayoutEffect, useRef, useState, type CSSProperties, type KeyboardEvent, type MouseEvent, type ReactNode } from 'react'\nimport {\n DiffBlock, DisclosureRow, IconApiOutline14, IconBrowseOutline16, IconCodeOutline16,\n IconEditOutline16, IconSearchOutline16, IconSparkle16, ReadBlock, SearchBlock, StateDot,\n TerminalBlock, WebBlock, type DiffBlockLabels, type ReadBlockLabels, type SearchBlockLabels,\n type TerminalBlockLabels, type WebBlockLabels,\n} from '@deepseek-ai/dsh-client-ui-primitives'\nimport type { ToolCallBlock } from '@deepseek-ai/dsh-client-ui-chat/client'\nimport type { ToolCallViewProps } from '@deepseek-ai/dsh-client-ui-tool/client'\nimport type { PropsLocale } from '@deepseek-ai/dsh-client-ui-slots'\nimport type { MergeToolCallsConfig } from '../types.ts'\nimport { callRowModel, type CallRowModel, type RowState, type ToolVariant } from './card-model.ts'\nimport { readRun } from './merge-run.ts'\n\n/** Chat rows show a capped card; the details panel stays the full-height surface. */\nconst CHAT_READ_MAX_LINES = 8\nconst CHAT_SEARCH_MAX_LINES = 8\nconst CHAT_DIFF_MAX_LINES = 8\n\n/** Locale seat and inject face of the merged row registration. */\nexport type MergedToolRowProps = ToolCallViewProps\n & PropsLocale<'merge-tool-calls'>\n & { readonly cfg: MergeToolCallsConfig }\n\n/** Variant leading icons (figma table); all glyphs render at 14 inside the 16px leading box. */\nconst VARIANT_ICONS: Record<ToolVariant, ReactNode> = {\n search: <IconSearchOutline16 size={14} />,\n read: <IconBrowseOutline16 size={14} />,\n bash: <IconApiOutline14 size={14} />,\n write: <IconEditOutline16 size={14} />,\n edit: <IconEditOutline16 size={14} />,\n code: <IconCodeOutline16 size={14} />,\n others: <IconSparkle16 size={14} />,\n}\n\n/**\n * Per-variant locale key for the merged-count summary (`{n} Files`, `{n}\n * Commands`, …). Replaces the first call's file path on the main row when the\n * run merges more than one call, so the main row reads `Read · 5 Files` and\n * the file paths move to the collapsed child rows.\n */\nconst VARIANT_COUNT_KEY: Record<ToolVariant, 'countFiles' | 'countQueries' | 'countCommands' | 'countPrograms' | 'countCalls'> = {\n read: 'countFiles',\n write: 'countFiles',\n edit: 'countFiles',\n search: 'countQueries',\n bash: 'countCommands',\n code: 'countPrograms',\n others: 'countCalls',\n}\n\n/** Leading-slot state substitution, mirroring the shipped row. */\nfunction leadingFor(state: RowState, icon: ReactNode): ReactNode {\n switch (state) {\n case 'error': return <StateDot state=\"error\" />\n case 'stopped': return <StateDot state=\"warning\" />\n default: return icon\n }\n}\n\n/** Visually hidden run-state label (the StateDot and sweep are colour-only). */\nfunction stateStatus(state: RowState, t: MergedToolRowProps['t']): string | null {\n switch (state) {\n case 'running': return t('running')\n case 'error': return t('failed')\n case 'stopped': return t('stopped')\n default: return null\n }\n}\n\n/** TerminalBlock display copy from the plugin's own dictionary. */\nfunction terminalLabels(t: MergedToolRowProps['t']): TerminalBlockLabels {\n return {\n signal: signal => t('terminal.signal', { signal }),\n exitCode: code => t('terminal.exitCode', { code }),\n running: t('terminal.running'),\n failed: t('terminal.failed'),\n done: t('terminal.done'),\n copy: t('terminal.copy'),\n copied: t('terminal.copied'),\n noOutput: t('terminal.noOutput'),\n collapseAria: t('terminal.collapseAria'),\n collapse: t('terminal.collapse'),\n expandAria: hidden => t('terminal.expandAria', { n: hidden }),\n expand: hidden => t('terminal.expandRest', { n: hidden }),\n }\n}\n\n/** ReadBlock display copy from the plugin's own dictionary. */\nfunction readLabels(t: MergedToolRowProps['t']): ReadBlockLabels {\n return {\n window: (shown, total) => t('read.window', { shown, total }),\n copy: t('copy'),\n copied: t('copied'),\n collapseAria: t('read.collapseAria'),\n expandAria: count => t('read.expandAria', { count }),\n collapse: t('collapse'),\n expand: count => t('read.expandRest', { count }),\n }\n}\n\n/** SearchBlock display copy from the plugin's own dictionary. */\nfunction searchLabels(t: MergedToolRowProps['t']): SearchBlockLabels {\n return {\n pathsSummary: (shown, total, truncated) => t(\n truncated ? 'search.paths.truncated' : 'search.paths',\n { shown, total },\n ),\n matchesSummary: (shown, total, files, truncated) => t(\n truncated ? 'search.matches.truncated' : 'search.matches',\n { shown, total, files },\n ),\n copy: t('copy'),\n copied: t('copied'),\n noResults: t('search.noResults'),\n collapseAria: t('search.collapseAria'),\n expandAria: count => t('search.expandAria', { count }),\n collapse: t('collapse'),\n expand: count => t('search.expandRest', { count }),\n }\n}\n\n/** DiffBlock display copy from the plugin's own dictionary. */\nfunction diffLabels(t: MergedToolRowProps['t']): DiffBlockLabels {\n return {\n copy: t('copy'),\n copied: t('copied'),\n collapseAria: t('diff.collapseAria'),\n expandAria: count => t('diff.expandAria', { count }),\n collapse: t('collapse'),\n expand: count => t('diff.expandRest', { count }),\n files: count => t('diff.files', { count }),\n }\n}\n\n/** WebBlock display copy from the plugin's own dictionary. */\nfunction webLabels(t: MergedToolRowProps['t']): WebBlockLabels {\n return {\n noResults: t('web.noResults'),\n sourcesTruncated: t('web.sourcesTruncated'),\n http: t('web.http'),\n contentTruncated: t('web.contentTruncated'),\n markdown: {\n code: { copyLabel: t('copy'), copiedLabel: t('copied') },\n footnotes: t('markdown.footnotes'),\n },\n }\n}\n\n/** One call's expanded-body card, mirroring the built-in ToolRow body. */\nfunction CardBody({ model, home, t }: { model: CallRowModel; home: string | undefined; t: MergedToolRowProps['t'] }) {\n if (model.terminal !== null) {\n return <TerminalBlock {...model.terminal.card} home={home} maxLines={Infinity} labels={terminalLabels(t)} />\n }\n if (model.diff !== null) {\n return <DiffBlock {...model.diff.card} labels={diffLabels(t)} maxLines={CHAT_DIFF_MAX_LINES} />\n }\n if (model.read !== null) {\n return <ReadBlock {...model.read} labels={readLabels(t)} maxLines={CHAT_READ_MAX_LINES} />\n }\n if (model.search !== null) {\n return (\n <>\n <SearchBlock {...model.search.card} labels={searchLabels(t)} maxLines={CHAT_SEARCH_MAX_LINES} />\n {model.search.recovery !== undefined && (\n <div className=\"mtc-recovery\">{model.search.recovery}</div>\n )}\n </>\n )\n }\n if (model.web !== null) {\n return <WebBlock {...model.web} labels={webLabels(t)} />\n }\n const hasBody = model.body !== null\n const hasOutput = model.output !== null\n if (!hasBody && !hasOutput) return null\n return (\n <div className=\"mtc-io-card\">\n {hasBody && (\n <div className=\"mtc-io-section\">\n <span className=\"mtc-io-label\">IN</span>\n <span className=\"mtc-io-text\">{model.body}</span>\n </div>\n )}\n {hasBody && hasOutput && <span className=\"mtc-io-divider\" aria-hidden />}\n {hasOutput && (\n <div className=\"mtc-io-section\">\n <span className=\"mtc-io-label\">OUT</span>\n <span className=\"mtc-io-text\" data-error={model.state === 'error' || undefined}>{model.output}</span>\n </div>\n )}\n </div>\n )\n}\n\n/**\n * The run's main card: the first call's chrome (variant title/icon + state)\n * plus, for a single call, its expandable content card. For a merged run the\n * main row's collapsed summary is the count (`Read · 5 Files`) and the\n * expanded body is the child-rows block (passed in as `children`); the first\n * call is rendered as the first child row so every file path lands on a child\n * row, never on the main row.\n */\nexport const RowCard = memo(function RowCard({\n toolName, block, cwd, home, openFile, inspect, t, mergedCount, children,\n}: {\n toolName: string\n block: ToolCallBlock\n cwd: string | undefined\n home: string | undefined\n openFile: (path: string) => void\n inspect: (() => void) | undefined\n t: MergedToolRowProps['t']\n /** Continuation-call count; 0 means a single-call row (no child rows). */\n mergedCount: number\n /** Child rows for the merged run (all calls, including the first). */\n children?: ReactNode\n}) {\n const model = callRowModel(toolName, block, cwd, home)\n const [expanded, setExpanded] = useState(false)\n const hasChildren = mergedCount > 0\n const expandable = model.expandable || hasChildren\n const open = expanded && expandable\n const status = stateStatus(model.state, t)\n const failureLine = model.state === 'error' ? model.errorSummary ?? null : null\n // Merged runs trade the first file path + `+n` suffix for a count summary,\n // so the main row reads `Read · 5 Files`; the file paths live on the child\n // rows. An error on the first call still surfaces its error text instead.\n const summaryText = hasChildren && failureLine === null\n ? t(VARIANT_COUNT_KEY[model.variant], { n: String(mergedCount + 1) })\n : failureLine ?? model.summary\n // The open-file link only applies to single-call rows (the merged summary is\n // a count, not a path).\n const fileLink = !hasChildren && model.filePath !== undefined && openFile !== undefined && failureLine === null\n const openFileClick = (event: MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation()\n if (model.filePath !== undefined) openFile(model.filePath)\n }\n return (\n <div className=\"mtc-row\" data-state={model.state} data-variant={model.variant} data-merged={hasChildren || undefined}>\n {status !== null && <span className=\"mtc-visually-hidden\">{status}</span>}\n <DisclosureRow\n rowClassName=\"mtc-title-row\"\n titleClassName=\"mtc-title\"\n leadingClassName=\"mtc-leading\"\n chevronClassName=\"mtc-chevron\"\n icon={leadingFor(model.state, VARIANT_ICONS[model.variant])}\n title={model.title}\n open={open}\n expandable={expandable}\n expandOnRowClick\n keepContentWhenOpen\n onToggle={() => { setExpanded(value => !value) }}\n collapsedContent={summaryText !== '' && (\n <>\n <span className=\"mtc-sep\" aria-hidden />\n {fileLink ? (\n <button type=\"button\" className=\"mtc-summary-link\" onClick={openFileClick}>{summaryText}</button>\n ) : (\n <span className=\"mtc-summary\">{summaryText}</span>\n )}\n </>\n )}\n >\n {/* Single-call mode: the first call's expandable content card lives in\n the disclosure body. Merged mode renders nothing here — the child\n rows block is a sibling below, animated via its own collapse grid. */}\n {!hasChildren && (\n <div className=\"mtc-card-body\">\n <CardBody model={model} home={home} t={t} />\n {inspect !== undefined && (\n <button type=\"button\" className=\"mtc-inspect\" onClick={inspect}>Inspect</button>\n )}\n </div>\n )}\n </DisclosureRow>\n {hasChildren && (\n // The animated children block. Lives outside DisclosureRow so the\n // grid-template-rows transition can keep the rows in the DOM while\n // collapsing (DisclosureRow would unmount them instantly). The\n // --mtc-sep-left custom property is set by the parent on .mtc-root.\n <div className=\"mtc-children-collapse\" data-open={open || undefined}>\n <div className=\"mtc-children\">\n {children}\n </div>\n </div>\n )}\n {hasChildren && open && inspect !== undefined && (\n <button type=\"button\" className=\"mtc-inspect\" onClick={inspect}>Inspect</button>\n )}\n </div>\n )\n})\n\n/**\n * One compact continuation row: the main row's tail structure ([sep dot][path]).\n * An expandable call toggles the inline content card on click (mirroring the\n * main row's whole-row disclosure); a read/write/edit-family path additionally\n * renders as an open-file link (the sidebar preview) that stops propagation,\n * exactly like the main row's summary link.\n */\nexport const ChildRow = memo(function ChildRow({\n toolName, block, cwd, home, openFile, t,\n}: {\n toolName: string\n block: ToolCallBlock\n cwd: string | undefined\n home: string | undefined\n openFile: (path: string) => void\n t: MergedToolRowProps['t']\n}) {\n const model = callRowModel(toolName, block, cwd, home)\n const [open, setOpen] = useState(false)\n const stateLabel = stateStatus(model.state, t)\n const expandable = model.expandable\n const toggle = (): void => { setOpen(value => !value) }\n const openFileClick = (event: MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation()\n if (model.filePath !== undefined) openFile(model.filePath)\n }\n const onRowKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n toggle()\n }\n }\n return (\n <div className=\"mtc-child\">\n <div\n className=\"mtc-child-row\"\n data-open={expandable && open || undefined}\n data-static={expandable ? undefined : true}\n role={expandable ? 'button' : undefined}\n tabIndex={expandable ? 0 : undefined}\n aria-expanded={expandable ? open : undefined}\n onClick={expandable ? toggle : undefined}\n onKeyDown={expandable ? onRowKeyDown : undefined}\n >\n <span className=\"mtc-sep\" aria-hidden />\n {model.filePath !== undefined ? (\n <button type=\"button\" className=\"mtc-child-path-link\" onClick={openFileClick}>{model.summary}</button>\n ) : (\n <span className=\"mtc-child-path\">{model.summary}</span>\n )}\n {stateLabel !== null && (\n <span className=\"mtc-child-state\" data-error={model.state === 'error' || undefined}>{stateLabel}</span>\n )}\n </div>\n {expandable && open && (\n <div className=\"mtc-child-body\">\n <CardBody model={model} home={home} t={t} />\n </div>\n )}\n </div>\n )\n})\n\n/**\n * The shadowed toolview: renders the merged run card for the run's first call,\n * nothing for continuation calls, and a plain single row when this call is not\n * a chat tool-call node.\n *\n * Child-row alignment is measured at runtime, not hardcoded: the main row's\n * separator dot sits after a variable-width title (\"Read\"/\"Search\"/\"Bash\"/…),\n * so its column depends on the rendered font. A layout effect measures the\n * dot's offset from the card root (once, plus on reflow via ResizeObserver)\n * and indents the children so their dots and paths land on the main row's\n * columns — no font/title constants to keep in sync.\n */\nexport function MergedToolRow({ callId, toolName, block, cwd, home, openFile, inspect, t, cfg, useChat }: MergedToolRowProps) {\n const run = useChat(snapshot => readRun(\n snapshot.order,\n snapshot.nodes,\n callId,\n cfg.tools,\n cfg.groupBy,\n cfg.maxGroupSize,\n ))\n const rootRef = useRef<HTMLDivElement>(null)\n /** Main separator dot's left offset from the card root; null before first measure. */\n const [sepLeft, setSepLeft] = useState<number | null>(null)\n\n useLayoutEffect(() => {\n const root = rootRef.current\n if (root === null) return\n const sep = root.querySelector<HTMLElement>('.mtc-row .mtc-sep')\n if (sep === null) return\n const measure = (): void => {\n setSepLeft(Math.round(sep.getBoundingClientRect().left - root.getBoundingClientRect().left))\n }\n measure()\n // Font swaps, locale switches, and column resizes move the dot; keep the\n // alignment current without re-running the effect.\n const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(measure)\n observer?.observe(root)\n return () => { observer?.disconnect() }\n }, [run === null ? null : run.blocks[0]?.callId ?? null])\n\n if (run === null) {\n // Not a chat tool-call node (subcall dispatch): never blank the call.\n return (\n <RowCard\n toolName={toolName}\n block={block}\n cwd={cwd}\n home={home}\n openFile={openFile}\n inspect={inspect}\n t={t}\n mergedCount={0}\n />\n )\n }\n if (!run.isFirst) return null\n const hasChildren = run.blocks.length > 1\n return (\n <div\n className=\"mtc-root\"\n data-tool={toolName}\n ref={rootRef}\n // The measured dot column lands the children's sep dot on the main row's\n // summary column. Set on the root so it cascades into RowCard's\n // .mtc-children block.\n style={sepLeft === null ? undefined : { ['--mtc-sep-left']: `${sepLeft}px` } as CSSProperties}\n >\n <RowCard\n toolName={toolName}\n block={run.blocks[0] ?? block}\n cwd={cwd}\n home={home}\n openFile={openFile}\n inspect={inspect}\n t={t}\n mergedCount={run.blocks.length - 1}\n >\n {/* Every call (including the first) renders as a child row, so the\n main row's summary stays a count (`Read · 5 Files`) and every file\n path lands on its own child row. */}\n {hasChildren && run.blocks.map(child => (\n <ChildRow key={child.callId} toolName={toolName} block={child} cwd={cwd} home={home} openFile={openFile} t={t} />\n ))}\n </RowCard>\n </div>\n )\n}\n","/**\n * One scoped stylesheet injected for the lifetime of the client activation.\n *\n * Two jobs:\n * 1. The empty-seat collapse rule: the shadowed toolview renders `null` for\n * every non-first call of a merged run. The built-in `ToolCallTree` still\n * wraps that null in its `.callRow` div, and the renderer wraps every\n * toolview in an empty `<div data-slot=\"tool.call.toolview\">` (display:\n * contents), so the seat's `.flowItem` is never `:empty` itself and the\n * built-in `.flowItem:empty { display:none }` rule does not fire. This\n * rule extends the same intent (\"a renderer may decline its row\") to a\n * tool seat whose toolview rendered nothing.\n * 2. The plugin's own `.mtc-*` chrome for the merged card and its child rows.\n *\n * All colors come from the shared `--dsw-*` tokens (never literals).\n */\nexport const CSS = `\n/* A tool-call seat whose toolview declined to render (merged-run continuation\n calls) must not consume the flow column's gap. The empty toolview slot\n wrapper is the decline signal; the callRow around it always exists. */\n[data-chat-flow-kind=\"tool-call\"]:has([data-slot=\"tool.call.toolview\"]:empty) { display: none; }\n\n.mtc-root { display: flex; flex-direction: column; min-width: 0; }\n.mtc-row { display: flex; flex-direction: column; min-width: 0; }\n.mtc-row[data-state='running'] .mtc-title-row { position: relative; overflow: hidden; }\n.mtc-row[data-state='running'] .mtc-title-row::after {\n content: '';\n position: absolute;\n top: 0; bottom: 0; left: 0;\n width: 300px;\n background: linear-gradient(90deg, transparent 0%, color-mix(in srgb, var(--dsw-alias-bg-base) 60%, transparent) 55%, transparent 100%);\n animation: dsh-mtc-sweep 2.6s ease-out infinite;\n pointer-events: none;\n}\n@keyframes dsh-mtc-sweep {\n 0% { left: -300px; }\n 90%, 100% { left: 100%; }\n}\n\n.mtc-title { font-weight: 400; }\n.mtc-sep { flex: none; width: 2px; height: 2px; border-radius: 1px; margin: 0 8px; background: var(--dsw-alias-label-caption); }\n.mtc-summary {\n flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;\n font-size: 14px; line-height: 24px; color: var(--dsw-alias-label-tertiary);\n}\n.mtc-summary-link {\n flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;\n margin: 0; padding: 0; border: none; background: none; font: inherit; text-align: left;\n font-size: 14px; line-height: 24px; color: var(--dsw-alias-label-secondary);\n text-decoration: underline; text-decoration-color: var(--dsw-alias-label-quaternary);\n text-underline-offset: 3px; cursor: pointer;\n}\n.mtc-summary-link:hover { color: var(--dsw-alias-label-primary); text-decoration-color: currentColor; }\n.mtc-summary-error { color: var(--dsw-alias-state-error-primary); }\n.mtc-summary-suffix { flex: none; margin-left: 4px; white-space: nowrap; font-size: 14px; line-height: 24px; color: var(--dsw-alias-label-tertiary); }\n\n.mtc-card-body { margin: 4px 0 4px 4px; min-width: 0; }\n.mtc-recovery { margin: 4px 0 4px 4px; white-space: pre-wrap; overflow-wrap: anywhere; font: var(--dsw-font-xs-13); color: var(--dsw-alias-label-tertiary); }\n/* IN/OUT text card for calls without a card primitive (mirrors ToolRow). */\n.mtc-io-card {\n display: flex; flex-direction: column; min-width: 0;\n border: 1px solid var(--dsw-alias-border-l2); border-radius: 12px;\n background: var(--dsw-alias-bg-base);\n}\n.mtc-io-section { display: flex; gap: 10px; padding: 8px 12px; min-width: 0; }\n.mtc-io-label {\n flex: none; font-size: 11px; line-height: 16px; font-weight: 600;\n color: var(--dsw-alias-label-tertiary);\n}\n.mtc-io-text {\n flex: 1 1 auto; min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere;\n font-size: 13px; line-height: 20px; color: var(--dsw-alias-label-secondary);\n}\n.mtc-io-text[data-error] { color: var(--dsw-alias-state-error-primary); }\n.mtc-io-divider { height: 1px; background: var(--dsw-alias-border-l2); }\n.mtc-inspect {\n display: inline-flex; align-self: flex-start; align-items: center; gap: 4px;\n margin: 4px 0 2px 4px; padding: 2px 8px;\n border: 1px solid var(--dsw-alias-border-l2); border-radius: 999px;\n background: var(--dsw-alias-bg-base); color: var(--dsw-alias-label-secondary);\n font-size: 11px; line-height: 16px; cursor: pointer;\n opacity: 0; transition: opacity 100ms ease;\n}\n.mtc-root:hover .mtc-inspect, .mtc-inspect:focus-visible { opacity: 1; }\n.mtc-inspect:hover { background: var(--dsw-alias-interactive-bg-hover-solid); color: var(--dsw-alias-label-primary); }\n\n/* Compact child rows: each is the main row's tail structure — [sep dot][path].\n The dot/path column is set at runtime by the component (it measures the\n main row's sep offset and sets the --mtc-sep-left custom property on the\n root); this is only the pre-measure fallback.\n\n The .mtc-children-collapse wrapper animates the block's height with a\n grid-template-rows 0fr↔1fr transition (children stay in the DOM while\n collapsing, so the slide is smooth instead of popping out). The vertical\n margin lives on the wrapper (not .mtc-children) so it doesn't leak past the\n 0fr row when collapsed.\n\n The sep-left indent lives on .mtc-child-row (not .mtc-children) so the\n expanded .mtc-child-body can align back to the root's left edge via a plain\n 4px margin. When the indent was on .mtc-children + a negative-margin\n pull-back on .mtc-child-body, the body's left portion was clipped by\n .mtc-children's overflow:hidden (which is required for the grid collapse\n animation). */\n.mtc-children-collapse {\n display: grid;\n grid-template-rows: 0fr;\n margin: 0;\n transition: grid-template-rows 200ms ease-out, margin 200ms ease-out;\n}\n.mtc-children-collapse[data-open] {\n grid-template-rows: 1fr;\n margin: 2px 0;\n}\n.mtc-children {\n display: flex; flex-direction: column; gap: 1px;\n margin: 0;\n min-width: 0; min-height: 0; overflow: hidden;\n opacity: 0;\n transition: opacity 150ms ease-out;\n}\n.mtc-children-collapse[data-open] .mtc-children {\n opacity: 1;\n transition: opacity 150ms ease-out 50ms;\n}\n.mtc-child { display: flex; flex-direction: column; min-width: 0; }\n.mtc-child-row {\n display: flex; align-items: center; gap: 0; min-width: 0; height: 20px;\n margin: 0 0 0 var(--mtc-sep-left, 61px); padding: 0; border: 0; border-radius: 4px; background: none;\n font: inherit; text-align: left; color: var(--dsw-alias-label-secondary); cursor: pointer;\n}\n.mtc-child-row:hover { background: var(--dsw-alias-interactive-bg-hover); color: var(--dsw-alias-label-primary); }\n.mtc-child-row[data-static] { cursor: default; }\n.mtc-child-row[data-static]:hover { background: none; color: var(--dsw-alias-label-secondary); }\n.mtc-child-row .mtc-sep { margin: 0 8px 0 0; }\n.mtc-child-path {\n flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;\n font-size: 14px; line-height: 20px;\n}\n/* Read-family child paths are open-file links (sidebar preview), same affordance\n as the main row's summary link. */\n.mtc-child-path-link {\n flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;\n margin: 0; padding: 0; border: none; background: none; font: inherit; text-align: left;\n font-size: 14px; line-height: 20px; color: var(--dsw-alias-label-secondary);\n text-decoration: underline; text-decoration-color: var(--dsw-alias-label-quaternary);\n text-underline-offset: 3px; cursor: pointer;\n}\n.mtc-child-path-link:hover { color: var(--dsw-alias-label-primary); text-decoration-color: currentColor; }\n.mtc-child-state { flex: none; font-size: 11px; line-height: 16px; color: var(--dsw-alias-label-tertiary); }\n.mtc-child-state[data-error] { color: var(--dsw-alias-state-error-primary); }\n/* The expanded child card aligns to the main card body's column (root + 4px).\n No negative-margin pull-back is needed because .mtc-children no longer\n carries the sep-left indent — only .mtc-child-row does. */\n.mtc-child-body { margin: 2px 0 2px 4px; min-width: 0; }\n\n.mtc-visually-hidden {\n position: absolute; width: 1px; height: 1px; overflow: hidden;\n clip: rect(0 0 0 0); white-space: nowrap;\n}\n`\n\n/** Install the stylesheet and return its disposer. */\nexport function installStyles(): () => void {\n const style = document.createElement('style')\n style.setAttribute('data-merge-tool-calls-style', '')\n style.textContent = CSS\n document.head.appendChild(style)\n return () => { style.remove() }\n}\n","/**\n * merge-tool-calls — browser half.\n *\n * Shadows the shipped `tool.call.toolview` entries for every grouped tool at\n * priority -1 (the keyed slot's shadowing rule: lowest priority renders). An\n * empty `tools` config means every built-in generic-family tool\n * (see {@link ALL_TOOL_NAMES}); a non-empty list is an explicit whitelist.\n * The shadowed component merges consecutive calls of one tool in the chat flow\n * into a single card with compact child rows.\n *\n * @module @dsh-external/dsh-plugin-merge-tool-calls/client\n */\n\nimport type { Context as ClientContext } from '@deepseek-ai/cordis'\n// Type-only: pulls the locale plugin's Context merge (ctx.locale).\nimport type {} from '@deepseek-ai/dsh-client-locale/client'\n// Type-only: pulls the ui-renderer's Context merge (ctx.slots, the SlotRegistry\n// the apply body registers through).\nimport type {} from '@deepseek-ai/dsh-client-ui-renderer/client'\n// Type-only: pulls the `tool.call.toolview` SlotMap entry so this plugin's\n// `slots.inject` matches the slot declaration. Cross-plugin collaboration\n// goes through the service, never a value import (client bundle purity gate).\nimport type {} from '@deepseek-ai/dsh-client-ui-tool/client'\nimport type {} from '@deepseek-ai/dsh-client-ui-slots'\nimport { DEFAULT_MERGE_CONFIG, type MergeToolCallsConfig } from '../types.ts'\nimport { dicts } from './dictionaries.ts'\nimport { en, NS, zh, type MergeToolCallsKey } from './locales.ts'\nimport { MergedToolRow } from './rows.tsx'\nimport { installStyles } from './styles.ts'\nimport { ALL_TOOL_NAMES } from './tool-names.ts'\n\ndeclare module '@deepseek-ai/dsh-client-ui-slots' {\n interface LocaleNamespaceMap {\n /** Copy for the merged tool-call rows. */\n 'merge-tool-calls': MergeToolCallsKey\n }\n}\n\n/** Required services: the slot registry (toolview shadowing) and locale. */\nexport const inject = ['slots', 'locale']\n\n/** Structural view of better-locale's override store (optional; no runtime dep).\n * Per-language dictionaries are partial: missing keys fall through to the\n * plugin's own registered zh/en dictionaries. */\ninterface BetterLocaleOverrideStore {\n register(ns: string, dicts: Record<string, Partial<Record<string, string>>>): () => void\n}\n\n/**\n * Register one shadowed toolview per grouped tool.\n * @param ctx - client root context.\n * @param config - row config; defaults apply when the loader passes none.\n */\nexport function apply(ctx: ClientContext, config: Partial<MergeToolCallsConfig> = {}): void {\n const cfg: MergeToolCallsConfig = { ...DEFAULT_MERGE_CONFIG, ...config }\n ctx.effect(() => ctx.locale.register(NS, { zh, en }), 'merge-tool-calls: dictionaries')\n ctx.effect(installStyles, 'merge-tool-calls: styles')\n\n // Optional third-language overrides: register the 19-language dicts into\n // `ctx.betterLocale` (published by dsh-plugin-better-locale) so a selected\n // override language (with DSH on 'en') replaces the row copy. The service\n // is optional — no better-locale, no dicts.\n // Activation-order-safe: re-check ctx.get('betterLocale') on every locale\n // revision bump (better-locale bumps on activation + override switch).\n ctx.effect(() => {\n let dispose: (() => void) | undefined\n const sync = (): void => {\n dispose?.()\n dispose = undefined\n const store = ctx.get('betterLocale') as BetterLocaleOverrideStore | undefined\n if (store !== undefined) {\n dispose = store.register(NS, dicts)\n }\n }\n sync()\n const unsubscribe = ctx.locale.subscribe(sync)\n return () => {\n unsubscribe()\n dispose?.()\n }\n }, 'merge-tool-calls: better-locale override dicts')\n\n const toolNames = cfg.tools.length === 0 ? ALL_TOOL_NAMES : [...new Set(cfg.tools)]\n for (const tool of toolNames) {\n ctx.slots.inject('tool.call.toolview', () => ctx.slots.register({\n name: 'tool.call.toolview',\n key: tool,\n priority: -1,\n locale: NS,\n inject: () => ({ cfg }),\n }, Merged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