Skip to content

Commit 01a9406

Browse files
committed
feat(session-ui,app): collapsible reasoning cards for desktop/web
Add collapsibleReasoning setting (default true) with persisted store, i18n (62 locales) and UI toggles in both settings-general variants. Render reasoning parts as collapsible cards in the style of tool calls (brain icon, 80-char subtitle, TextShimmer only on active block, max-height:320px scrollable body, copy button). Each reasoning part is its own card with open/userInteracted state. - Auto-collapse previous blocks in a chain: isLastPart via data.store.part[message.id].at(-1) — previous collapses immediately when next reasoning part appears, not at end of chain. Shimmer and PacedMarkdown streaming only on active (streaming && isLastPart). - Auto-scroll inside card: scrollRef/innerRef signals, autoFollow flag (pause >40px from bottom, resume at bottom), ResizeObserver + MutationObserver + continuous RAF tick while open && streaming && autoFollow — keeps tail visible during PacedMarkdown pacing and large gaps. - Wire collapsibleReasoning through MessagePartProps -> Part -> message-timeline (settings.general.collapsibleReasoning()). Complements anomalyco#45247 (/thinking toggle). Closes anomalyco#8789, anomalyco#14340, anomalyco#37115, anomalyco#21548, partially anomalyco#28322. Refs anomalyco#7866, anomalyco#33906. Co-authored-by: 4ebuRushka
1 parent 88c6c7a commit 01a9406

129 files changed

Lines changed: 462 additions & 2 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎packages/app/src/components/settings-general.tsx‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,18 @@ export const SettingsGeneral: Component = () => {
359359
</div>
360360
</SettingsRow>
361361

362+
<SettingsRow
363+
title={language.t("settings.general.row.collapsibleReasoning.title")}
364+
description={language.t("settings.general.row.collapsibleReasoning.description")}
365+
>
366+
<div data-action="settings-feed-collapsible-reasoning">
367+
<Switch
368+
checked={settings.general.collapsibleReasoning()}
369+
onChange={(checked) => settings.general.setCollapsibleReasoning(checked)}
370+
/>
371+
</div>
372+
</SettingsRow>
373+
362374
<SettingsRow
363375
title={language.t("settings.general.row.shellToolPartsExpanded.title")}
364376
description={language.t("settings.general.row.shellToolPartsExpanded.description")}

‎packages/app/src/components/settings-v2/general.tsx‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,18 @@ export const SettingsGeneralV2: Component<{
345345
</div>
346346
</SettingsRowV2>
347347

348+
<SettingsRowV2
349+
title={language.t("settings.general.row.collapsibleReasoning.title")}
350+
description={language.t("settings.general.row.collapsibleReasoning.description")}
351+
>
352+
<div data-action="settings-feed-collapsible-reasoning">
353+
<Switch
354+
checked={settings.general.collapsibleReasoning()}
355+
onChange={(checked) => settings.general.setCollapsibleReasoning(checked)}
356+
/>
357+
</div>
358+
</SettingsRowV2>
359+
348360
<SettingsRowV2
349361
title={language.t("settings.general.row.shellToolPartsExpanded.title")}
350362
description={language.t("settings.general.row.shellToolPartsExpanded.description")}

‎packages/app/src/context/settings.tsx‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export interface Settings {
3030
showStatus: boolean
3131
showTerminal: boolean
3232
showReasoningSummaries: boolean
33+
collapsibleReasoning: boolean
3334
shellToolPartsExpanded: boolean
3435
editToolPartsExpanded: boolean
3536
showCustomAgents: boolean
@@ -191,6 +192,7 @@ const defaultSettings: Settings = {
191192
showStatus: false,
192193
showTerminal: false,
193194
showReasoningSummaries: false,
195+
collapsibleReasoning: true,
194196
shellToolPartsExpanded: false,
195197
editToolPartsExpanded: false,
196198
showCustomAgents: false,
@@ -403,6 +405,13 @@ export const { use: useSettings, provider: SettingsProvider } = createSimpleCont
403405
setShowReasoningSummaries(value: boolean) {
404406
setStore("general", "showReasoningSummaries", value)
405407
},
408+
collapsibleReasoning: withFallback(
409+
() => store.general?.collapsibleReasoning,
410+
defaultSettings.general.collapsibleReasoning,
411+
),
412+
setCollapsibleReasoning(value: boolean) {
413+
setStore("general", "collapsibleReasoning", value)
414+
},
406415
shellToolPartsExpanded: withFallback(
407416
() => store.general?.shellToolPartsExpanded,
408417
defaultSettings.general.shellToolPartsExpanded,

‎packages/app/src/i18n/am.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -942,6 +942,8 @@ export const dict = {
942942
"settings.general.row.showCustomAgents.description": "በአቀናባሪው ውስጥ ባሉ ወኪሎች መካከል ይቀያይሩ። ሲደበቅ፣ ለግንባታ ወኪል ነባሪዎች ይሆናሉ።",
943943
"settings.general.row.reasoningSummaries.title": "የምክንያት ማጠቃለያዎችን አሳይ",
944944
"settings.general.row.reasoningSummaries.description": "የሞዴል ማመዛዘኛ ማጠቃለያዎችን በጊዜ መስመር አሳይ",
945+
"settings.general.row.collapsibleReasoning.title": "Collapsible reasoning",
946+
"settings.general.row.collapsibleReasoning.description": "Display reasoning as collapsible cards in the timeline",
945947
"settings.general.row.shellToolPartsExpanded.title": "የሼል መሣሪያ ክፍሎችን ዘርጋ",
946948
"settings.general.row.shellToolPartsExpanded.description": "የሼል መሣሪያ ክፍሎችን በጊዜ መስመር በነባሪነት ያሳዩ",
947949
"settings.general.row.editToolPartsExpanded.title": "የመሳሪያ ክፍሎችን ዘርጋ",

‎packages/app/src/i18n/ar.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,8 @@ export const dict = {
883883
"التبديل بين الوكلاء في محرر الرسائل. عند إخفائه، يُستخدم وكيل Build افتراضيًا.",
884884
"settings.general.row.reasoningSummaries.title": "إظهار ملخصات الاستدلال",
885885
"settings.general.row.reasoningSummaries.description": "عرض ملخصات استدلال النموذج في الشريط الزمني",
886+
"settings.general.row.collapsibleReasoning.title": "Collapsible reasoning",
887+
"settings.general.row.collapsibleReasoning.description": "Display reasoning as collapsible cards in the timeline",
886888
"settings.general.row.shellToolPartsExpanded.title": "توسيع أجزاء أداة shell",
887889
"settings.general.row.shellToolPartsExpanded.description":
888890
"إظهار أجزاء أداة shell موسعة بشكل افتراضي في الشريط الزمني",

‎packages/app/src/i18n/az.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,8 @@ export const dict = {
975975
"Mesaj sahəsində agentlər arasında keçid edin. Gizlədildikdə Build agenti seçilir.",
976976
"settings.general.row.reasoningSummaries.title": "Düşünmə xülasələrini göstər",
977977
"settings.general.row.reasoningSummaries.description": "Zaman xəttində modelin düşünmə xülasələrini göstər",
978+
"settings.general.row.collapsibleReasoning.title": "Collapsible reasoning",
979+
"settings.general.row.collapsibleReasoning.description": "Display reasoning as collapsible cards in the timeline",
978980
"settings.general.row.shellToolPartsExpanded.title": "Shell alət hissələrini genişlət",
979981
"settings.general.row.shellToolPartsExpanded.description":
980982
"Zaman xəttində shell alət hissələrini standart olaraq genişlədilmiş göstər",

‎packages/app/src/i18n/bg.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -973,6 +973,8 @@ export const dict = {
973973
"settings.general.row.reasoningSummaries.title": "Показване на обобщения на разсъжденията",
974974
"settings.general.row.reasoningSummaries.description":
975975
"Показване на обобщения на разсъжденията на модела във времевата линия",
976+
"settings.general.row.collapsibleReasoning.title": "Collapsible reasoning",
977+
"settings.general.row.collapsibleReasoning.description": "Display reasoning as collapsible cards in the timeline",
976978
"settings.general.row.shellToolPartsExpanded.title": "Разгънете shell части на инструмента",
977979
"settings.general.row.shellToolPartsExpanded.description":
978980
"Показване на shell части от инструмента, разширени по подразбиране във времевата линия",

‎packages/app/src/i18n/bn.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -961,6 +961,8 @@ export const dict: Record<string, string> = {
961961
"কম্পোজারে এজেন্টদের মধ্যে স্যুইচ করুন। লুকানো হলে, বিল্ড এজেন্টে ডিফল্ট।",
962962
"settings.general.row.reasoningSummaries.title": "যুক্তির সারাংশ দেখান",
963963
"settings.general.row.reasoningSummaries.description": "টাইমলাইনে মডেল যুক্তির সারাংশ প্রদর্শন করুন",
964+
"settings.general.row.collapsibleReasoning.title": "Collapsible reasoning",
965+
"settings.general.row.collapsibleReasoning.description": "Display reasoning as collapsible cards in the timeline",
964966
"settings.general.row.shellToolPartsExpanded.title": "শেল টুল অংশ প্রসারিত",
965967
"settings.general.row.shellToolPartsExpanded.description": "টাইমলাইনে ডিফল্টরূপে প্রসারিত শেল টুল অংশগুলি দেখান",
966968
"settings.general.row.editToolPartsExpanded.title": "সম্পাদনা টুল অংশ প্রসারিত করুন",

‎packages/app/src/i18n/br.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -888,6 +888,8 @@ export const dict = {
888888
"Alternar entre agentes na área de composição. Quando oculto, usa o agente Build como padrão.",
889889
"settings.general.row.reasoningSummaries.title": "Mostrar resumos de raciocínio",
890890
"settings.general.row.reasoningSummaries.description": "Exibir resumos de raciocínio do modelo na linha do tempo",
891+
"settings.general.row.collapsibleReasoning.title": "Collapsible reasoning",
892+
"settings.general.row.collapsibleReasoning.description": "Display reasoning as collapsible cards in the timeline",
891893
"settings.general.row.shellToolPartsExpanded.title": "Expandir partes da ferramenta shell",
892894
"settings.general.row.shellToolPartsExpanded.description":
893895
"Mostrar partes da ferramenta shell expandidas por padrão na linha do tempo",

‎packages/app/src/i18n/bs.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,8 @@ export const dict = {
951951
"settings.general.row.showCustomAgents.description": "Prikaži izbor agenta u uređivaču poruke",
952952
"settings.general.row.reasoningSummaries.title": "Prikaži sažetke rasuđivanja",
953953
"settings.general.row.reasoningSummaries.description": "Prikaži sažetke rasuđivanja modela na vremenskoj traci",
954+
"settings.general.row.collapsibleReasoning.title": "Collapsible reasoning",
955+
"settings.general.row.collapsibleReasoning.description": "Display reasoning as collapsible cards in the timeline",
954956

955957
"settings.general.row.shellToolPartsExpanded.title": "Proširi dijelove shell alata",
956958
"settings.general.row.shellToolPartsExpanded.description":

0 commit comments

Comments
 (0)