feat(web): collapse tool activity into one line #7152
Mergedmaria-rcksmerged 7 commits into
main fromrefs/pull/7152/headmerged by maria-rcks View on GitHubgithub-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:XXL
- apps/web/src/components/chat/MessagesTimeline.logic.ts lines 727 to 730OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -483,0 +710,21 @@710+711+ const anchorEntry = entry;712+ let latestToolEntry = entry;713+ const batchEntryIds = [entry.id];714+ const visibleBatchEntries = [entry.entry];715+ let cursor = index + 1;716+ while (cursor < input.timelineEntries.length) {717+ const nextEntry = input.timelineEntries[cursor];718+ if (719+ !nextEntry ||720+ nextEntry.kind !== "work" ||721+ nextEntry.entry.agentSpawn !== undefined ||722+ !entryBelongsToActiveTurn(nextEntry, cursor)723+ ) {724+ break;725+ }726+ batchEntryIds.push(nextEntry.id);727+ if (isVisibleActiveToolEntry(nextEntry.entry)) {728+ latestToolEntry = nextEntry;729+ visibleBatchEntries.push(nextEntry.entry);730+ }
- apps/web/src/components/chat/MessagesTimeline.logic.ts line 824Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -503,3 +783,21 @@503783 continue;504784 }505785786+ if (activeWorkEntryIds.has(timelineEntry.id)) {787+ const activeWorkRow = activeWorkRowsByAnchorId.get(timelineEntry.id);788+ if (activeWorkRow) {789+ nextRows.push(activeWorkRow);790+ if (activeWorkRow.expanded) {791+ for (const [entryIndex, workEntry] of activeWorkRow.groupedEntries.entries()) {792+ nextRows.push({793+ kind: "work",794+ id: workEntry.id,795+ createdAt: workEntry.createdAt,796+ groupedEntries: [workEntry],797+ isExpandedToolGroupEntry: true,798+ isLastExpandedToolGroupEntry: entryIndex === activeWorkRow.groupedEntries.length - 1,799+ });800+ }801+ }802+ }803+ continue;apps/web/src/session-logic.ts line 1145OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1011,8 +1085,20 @@1085+ if (1086+ previous.activityKind !== "tool.started" &&1087+ previous.activityKind !== "tool.updated" &&1088+ previous.activityKind !== "tool.completed"1089+ ) {10111090 return false;10121091 }1013- if (next.activityKind !== "tool.updated" && next.activityKind !== "tool.completed") {1092+ if (1093+ next.activityKind !== "tool.started" &&1094+ next.activityKind !== "tool.updated" &&1095+ next.activityKind !== "tool.completed"1096+ ) {10141097 return false;10151098 }10161099 if (previous.activityKind === "tool.completed") {10171100 return false;10181101 }1102+ if (next.activityKind === "tool.started") {1103+ return false;1104+ }apps/web/src/components/chat/MessagesTimeline.logic.ts line 307Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -242,3 +262,19 @@242262 return value.replace(/\s+(?:complete|completed)\s*$/i, "").trim();243263 }244264265+type ToolGroupAction = "read" | "edit" | "command" | "search" | "other";266+267+function toolGroupAction(entry: WorkLogEntry): ToolGroupAction {268+ if (entry.requestKind === "file-read" || entry.itemType === "image_view") return "read";269+ if (270+ entry.requestKind === "file-change" ||271+ entry.itemType === "file_change" ||272+ (entry.changedFiles?.length ?? 0) > 0273+ ) {274+ return "edit";275+ }276+ if (entry.requestKind === "command" || entry.itemType === "command_execution" || entry.command) {277+ return "command";278+ }279+ if (entry.itemType === "web_search") return "search";280+ return "other";
- apps/web/src/components/chat/MessagesTimeline.tsx lines 2410 to 2414OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -2205,9 +2403,12 @@2205- </span>2206- <span className="ml-auto flex shrink-0 items-center gap-2 font-mono text-[.7rem] text-muted-foreground">2207- <span>{status}</span>2208- {totalTokens > 0 ? (2209- <span className="tabular-nums">Σ {formatSubagentTokenCount(totalTokens)}</span>2210- ) : null}2211- <span className="text-info-foreground">{live ? "Open Agents ▸" : "View ▸"}</span>2212- </span>2213- </button>2403+ <div className="-mx-1 rounded-xl border border-border/70 bg-secondary p-1.5 dark:border-transparent dark:bg-input/32">2404+ <div className="flex items-center justify-between gap-2 px-1">2405+ <div className="flex min-w-0 flex-1 items-center gap-1.5 px-1 py-1 text-left text-xs leading-4">2406+ <span aria-hidden className={cn("size-1.5 shrink-0 rounded-full", dotClass)} />2407+ <WorkEntryIconSvg name="bot" className="size-3.5 shrink-0 text-muted-foreground" />2408+ <span className="min-w-0 truncate font-medium text-foreground">{lead}</span>2409+ {workflowName ? (2410+ <span className="hidden min-w-0 truncate text-[11px] text-muted-foreground md:inline">2411+ {workflowName}2412+ </span>2413+ ) : null}2414+ <span className="ml-auto hidden shrink-0 items-center gap-2 text-[11px] text-muted-foreground sm:flex">apps/web/src/components/chat/MessagesTimeline.tsx lines 2524 to 2527OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -2291,14 +2515,13 @@22912515 className={cn(2292- "flex flex-col rounded-md px-0.5 py-0.5 transition-colors",2516+ "flex flex-col rounded-md px-0.5 transition-colors",2517+ isExpandedToolGroupEntry ? "py-0" : "py-0.5",22932518 canExpand &&2294- "cursor-pointer hover:bg-accent/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/70",2519+ "cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/70",22952520 )}22962521 {...rowToggleProps}22972522 >22982523 <div className="flex select-none items-center gap-1.5 transition-[opacity,translate] duration-200">2299- <span className={iconWrapperClass}>2300- <WorkEntryIconSvg2301- name={entryIconName}2302- className="block size-3.5 shrink-0 stroke-[1.8] opacity-80"2303- />2304- </span>2524+ {showEntryIcon ? (2525+ <span2526+ className={iconWrapperClass}2527+ aria-label={showFailedIndicator ? "Tool call failed" : undefined}apps/web/src/components/chat/MessagesTimeline.tsx lines 1407 to 1407OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1370,10 +1392,16 @@13701392 key={workEntry.id}13711393 workEntry={workEntry}13721394 workspaceRoot={workspaceRoot}1395+ isExpandedToolGroupEntry={isExpandedToolGroupEntry}13731396 />13741397 ))}13751398 </div>13761399 </section>13771400 );13781401 });137914021403+function LiveActivityRow({ label, iconName }: { label: string; iconName?: WorkEntryIconName }) {1404+ return (1405+ <div className="relative min-h-6 w-fit max-w-full min-w-0 overflow-hidden rounded-md text-sm leading-relaxed">1406+ <LiveActivityContent label={label} iconName={iconName} />1407+ <div aria-hidden className="live-activity-focus pointer-events-none absolute inset-0">
- apps/web/src/components/chat/MessagesTimeline.tsx line 2180OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -2027,7 +2166,15 @@202721662028-function workEntryRawCommand(2029- workEntry: Pick<TimelineWorkEntry, "command" | "rawCommand">,2030-): string | null {2031- const rawCommand = workEntry.rawCommand?.trim();2032- if (!rawCommand || !workEntry.command) {2033- return null;2167+type CommandWrapper = "env" | "sudo";2168+2169+const COMMAND_WRAPPER_OPTIONS_WITH_VALUE: Record<CommandWrapper, ReadonlySet<string>> = {2170+ env: new Set(["-C", "--chdir", "-S", "--split-string", "-u", "--unset"]),2171+ sudo: new Set(["-C", "--close-from", "-D", "--chdir", "-g", "--group", "-u", "--user"]),2172+};2173+2174+const COMMAND_WRAPPER_FLAGS: Record<CommandWrapper, ReadonlySet<string>> = {2175+ env: new Set(["-0", "--null", "-i", "--ignore-environment", "--debug"]),2176+ sudo: new Set(["-A", "--askpass", "-b", "--background", "-E", "-H", "-i", "-n", "-S"]),2177+};2178+2179+function commandProgramName(command: string): string | null {2180+ const tokens = command.trim().split(/\s+/);
- apps/web/src/components/chat/MessagesTimeline.tsx line 1496Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1379,0 +1441,21 @@1441+ "flex size-6 shrink-0 items-center justify-center",1442+ highlighted ? "text-foreground" : "text-icon-muted",1443+ )}1444+ >1445+ <WorkEntryIconSvg name={iconName} className="block size-4 shrink-0 stroke-[1.8]" />1446+ </span>1447+ ) : null}1448+ <span className="min-w-0 flex-1 truncate">{label}</span>1449+ </div>1450+ );1451+}1452+1453+function LiveWorkEntryTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "work-live" }> }) {1454+ const ctx = use(TimelineRowCtx);1455+1456+ return (1457+ <button1458+ type="button"1459+ className="group/live-work flex min-h-6 w-full max-w-full cursor-pointer items-center rounded-md text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/70"1460+ aria-expanded={row.expanded}1461+ onClick={() => ctx.onToggleWorkGroup(row.groupId, row.id)}
- apps/web/src/components/chat/MessagesTimeline.tsx lines 1306 to 1306OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1280,13 +1301,6 @@12801301 });1281130212821303 function WorkingTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "working" }> }) {1283- const { workingStepLabel } = use(TimelineRowActivityCtx);12841304 return (1285- <div className="py-0.5 pl-1.5">1286- <div className="flex min-w-0 items-center gap-2 pt-1 text-secondary-label text-[11px] tabular-nums">1287- <span className="inline-flex items-center gap-[3px]">1288- <span className="h-1 w-1 rounded-full bg-muted-foreground/30 animate-status-pulse" />1289- <span className="h-1 w-1 rounded-full bg-muted-foreground/30 animate-status-pulse [animation-delay:200ms]" />1290- <span className="h-1 w-1 rounded-full bg-muted-foreground/30 animate-status-pulse [animation-delay:400ms]" />1291- </span>1292- <span className="shrink-0">1305+ <div>1306+ <div className="border-b border-border/60 pb-2 pt-1">apps/web/src/components/chat/ChangedFilesTree.tsx lines 160 to 160OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -164,18 +153,8 @@164- <p className="flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-[11px] text-muted-foreground">165- {scopeSummary.map((scope, index) => (166- <span key={scope.label} className="inline-flex items-center gap-1">167- {index > 0 ? <span aria-hidden="true">·</span> : null}168- <span className="font-mono text-foreground/75">{scope.label}</span>169- <span>170- {scope.fileCount} file{scope.fileCount === 1 ? "" : "s"}171- </span>172- </span>173- ))}174- </p>175- <div className="mt-2 flex flex-wrap items-center gap-1.5">153+ <div className="px-1.5 pb-1 pt-0.5">154+ <div className="flex min-w-0 items-center gap-x-3 overflow-hidden">176155 {previewFiles.map((file) => (177156 <button178157 key={file.path}179158 type="button"180159 title={file.path}181- className="inline-flex max-w-48 items-center gap-1 rounded-md border border-border/70 bg-background/45 px-1.5 py-1 font-mono text-[10px] text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"160+ className="group flex min-h-6 min-w-0 max-w-72 shrink items-center gap-1.5 rounded-md px-1 text-left transition-colors hover:bg-accent/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
- apps/web/src/components/chat/MessagesTimeline.tsx lines 1306 to 1306OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1280,13 +1301,6 @@12801301 });1281130212821303 function WorkingTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "working" }> }) {1283- const { workingStepLabel } = use(TimelineRowActivityCtx);12841304 return (1285- <div className="py-0.5 pl-1.5">1286- <div className="flex min-w-0 items-center gap-2 pt-1 text-secondary-label text-[11px] tabular-nums">1287- <span className="inline-flex items-center gap-[3px]">1288- <span className="h-1 w-1 rounded-full bg-muted-foreground/30 animate-status-pulse" />1289- <span className="h-1 w-1 rounded-full bg-muted-foreground/30 animate-status-pulse [animation-delay:200ms]" />1290- <span className="h-1 w-1 rounded-full bg-muted-foreground/30 animate-status-pulse [animation-delay:400ms]" />1291- </span>1292- <span className="shrink-0">1305+ <div>1306+ <div className="border-b border-border/60 pb-2 pt-1">apps/web/src/components/chat/ChangedFilesTree.tsx lines 160 to 160OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -164,18 +153,8 @@164- <p className="flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-[11px] text-muted-foreground">165- {scopeSummary.map((scope, index) => (166- <span key={scope.label} className="inline-flex items-center gap-1">167- {index > 0 ? <span aria-hidden="true">·</span> : null}168- <span className="font-mono text-foreground/75">{scope.label}</span>169- <span>170- {scope.fileCount} file{scope.fileCount === 1 ? "" : "s"}171- </span>172- </span>173- ))}174- </p>175- <div className="mt-2 flex flex-wrap items-center gap-1.5">153+ <div className="px-1.5 pb-1 pt-0.5">154+ <div className="flex min-w-0 items-center gap-x-3 overflow-hidden">176155 {previewFiles.map((file) => (177156 <button178157 key={file.path}179158 type="button"180159 title={file.path}181- className="inline-flex max-w-48 items-center gap-1 rounded-md border border-border/70 bg-background/45 px-1.5 py-1 font-mono text-[10px] text-muted-foreground transition-colors hover:bg-accent/60 hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"160+ className="group flex min-h-6 min-w-0 max-w-72 shrink items-center gap-1.5 rounded-md px-1 text-left transition-colors hover:bg-accent/45 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
- apps/web/src/components/chat/MessagesTimeline.tsx line 2259Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -2033,0 +2183,21 @@2183+2184+const COMMAND_WRAPPER_FLAGS: Record<CommandWrapper, ReadonlySet<string>> = {2185+ env: new Set(["-0", "--null", "-i", "--ignore-environment", "--debug"]),2186+ sudo: new Set(["-A", "--askpass", "-b", "--background", "-E", "-H", "-i", "-n", "-S"]),2187+};2188+2189+function tokenizeShellCommand(command: string): string[] | null {2190+ const tokens: string[] = [];2191+ let current = "";2192+ let quote: '"' | "'" | null = null;2193+ let escaping = false;2194+ let tokenStarted = false;2195+2196+ for (const character of command.trim()) {2197+ if (escaping) {2198+ current += character;2199+ escaping = false;2200+ tokenStarted = true;2201+ continue;2202+ }2203+ if (character === "\\" && quote !== "'") {
- apps/web/src/components/chat/MessagesTimeline.logic.ts line 835Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -511,3 +816,4 @@511816 if (512817 !nextEntry ||513818 nextEntry.kind !== "work" ||819+ activeWorkEntryIds.has(nextEntry.id) ||apps/web/src/components/chat/MessagesTimeline.logic.ts line 706Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -479,0 +632,21 @@632+ }633+ }634+ }635+636+ let activeTurnHeaderIndex = input.timelineEntries.length;637+ if (input.isWorking) {638+ const latestUserMessageIndex = lastUserMessageIndex(input.timelineEntries);639+ const firstOwnedAfterUser =640+ unsettledTurnId === null641+ ? -1642+ : input.timelineEntries.findIndex(643+ (entry, index) =>644+ index > latestUserMessageIndex && timelineEntryTurnId(entry) === unsettledTurnId,645+ );646+ activeTurnHeaderIndex =647+ firstOwnedAfterUser >= 0 ? firstOwnedAfterUser : latestUserMessageIndex + 1;648+ }649+ const entryBelongsToActiveTurn = (entry: TimelineEntry, index: number) =>650+ input.isWorking &&651+ index >= activeTurnHeaderIndex &&652+ (unsettledTurnId === null || timelineEntryTurnId(entry) === unsettledTurnId);
- apps/web/src/session-logic.ts line 979OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -933,3 +968,12 @@933968 return entry.turnId ? `direct:${entry.turnId}` : `direct:task:${taskId}`;934969 }935970971+function toolLifecycleCollapseMapKey(entry: DerivedWorkLogEntry): string | undefined {972+ if (973+ entry.activityKind !== "tool.started" &&974+ entry.activityKind !== "tool.updated" &&975+ entry.activityKind !== "tool.completed"976+ ) {977+ return undefined;978+ }979+ return entry.toolCallId ? `tool:${entry.toolCallId}` : undefined;
- apps/web/src/session-logic.ts line 1109OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -1011,12 +1090,20 @@10111090 return false;10121091 }1013- if (next.activityKind !== "tool.updated" && next.activityKind !== "tool.completed") {1092+ if (1093+ next.activityKind !== "tool.started" &&1094+ next.activityKind !== "tool.updated" &&1095+ next.activityKind !== "tool.completed"1096+ ) {10141097 return false;10151098 }10161099 if (previous.activityKind === "tool.completed") {10171100 return false;10181101 }1102+ if (next.activityKind === "tool.started") {1103+ return false;1104+ }10191105 if (previous.collapseKey !== undefined && previous.collapseKey === next.collapseKey) {10201106 return true;10211107 }10221108 return (1109+ previous.activityKind !== "tool.started" &&
- apps/web/src/components/chat/MessagesTimeline.tsx line 2361Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -2035,0 +2243,21 @@2243+ let wrapper: CommandWrapper | null = null;2244+2245+ while (index < tokens.length) {2246+ const token = tokens[index];2247+ if (!token) return null;2248+ if (/^[A-Za-z_][A-Za-z0-9_]*=/.test(token)) {2249+ index += 1;2250+ continue;2251+ }2252+ if (token === "env" || token === "sudo") {2253+ wrapper = token;2254+ index += 1;2255+ continue;2256+ }2257+ if (wrapper !== null && token === "--") {2258+ wrapper = null;2259+ index += 1;2260+ continue;2261+ }2262+ if (wrapper !== null && token.startsWith("-")) {2263+ if (COMMAND_WRAPPER_OPTIONS_WITH_VALUE[wrapper].has(token)) {
- apps/web/src/index.css lines 246 to 261OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -241,3 +243,19 @@241243 opacity: 1;242244 }243245 }246+ @keyframes live-activity-focus {247+ 0% {248+ transform: translateX(0);249+ }250+ 100% {251+ transform: translateX(100%);252+ }253+ }254+ @keyframes live-activity-focus-counter {255+ 0% {256+ transform: translateX(0);257+ }258+ 100% {259+ transform: translateX(-100%);260+ }261+ }
- apps/web/src/index.css lines 246 to 261OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -241,3 +243,19 @@241243 opacity: 1;242244 }243245 }246+ @keyframes live-activity-focus {247+ 0% {248+ transform: translateX(0);249+ }250+ 100% {251+ transform: translateX(100%);252+ }253+ }254+ @keyframes live-activity-focus-counter {255+ 0% {256+ transform: translateX(0);257+ }258+ 100% {259+ transform: translateX(-100%);260+ }261+ }
- apps/web/src/index.css lines 142 to 143OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -139,3 +139,5 @@139139 /* Duty-cycled indicator animations: long holds with stepped ramps, so the140140 compositor updates discrete frames instead of every vsync. */141141 --animate-status-pulse: status-pulse 2s infinite;142+ --animate-live-activity-focus: live-activity-focus 2.2s steps(24) infinite;143+ --animate-live-activity-focus-counter: live-activity-focus-counter 2.2s steps(24) infinite;
- apps/web/src/index.css lines 142 to 143OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -139,3 +139,5 @@139139 /* Duty-cycled indicator animations: long holds with stepped ramps, so the140140 compositor updates discrete frames instead of every vsync. */141141 --animate-status-pulse: status-pulse 2s infinite;142+ --animate-live-activity-focus: live-activity-focus 2.2s steps(24) infinite;143+ --animate-live-activity-focus-counter: live-activity-focus-counter 2.2s steps(24) infinite;
- apps/web/src/components/chat/MessagesTimeline.tsx line 1472OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1379,0 +1452,21 @@1452+ >1453+ <WorkEntryIconSvg name={iconName} className="block size-4 shrink-0 stroke-[1.8]" />1454+ </span>1455+ ) : null}1456+ <span className="min-w-0 flex-1 truncate">{label}</span>1457+ </div>1458+ );1459+}1460+1461+function LiveWorkEntryTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "work-live" }> }) {1462+ const ctx = use(TimelineRowCtx);1463+1464+ return (1465+ <button1466+ type="button"1467+ className="group/live-work flex min-h-6 w-full max-w-full cursor-pointer items-center rounded-md text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/70"1468+ aria-expanded={row.expanded}1469+ onClick={() => ctx.onToggleWorkGroup(row.groupId, row.id)}1470+ >1471+ <LiveActivityRow1472+ label={liveWorkEntryLabel(row.entry, ctx.workspaceRoot)}
- apps/web/src/components/chat/MessagesTimeline.tsx lines 2252 to 2255OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -2035,0 +2235,21 @@2235+ if (tokenStarted) tokens.push(current);2236+ return tokens;2237+}2238+2239+function commandProgramName(command: string): string | null {2240+ const tokens = tokenizeShellCommand(command);2241+ if (tokens === null) return null;2242+ let index = 0;2243+ let wrapper: CommandWrapper | null = null;2244+2245+ while (index < tokens.length) {2246+ const token = tokens[index];2247+ if (!token) return null;2248+ if (/^[A-Za-z_][A-Za-z0-9_]*=/.test(token)) {2249+ index += 1;2250+ continue;2251+ }2252+ if (token === "env" || token === "sudo") {2253+ wrapper = token;2254+ index += 1;2255+ continue;
- apps/web/src/components/chat/MessagesTimeline.tsx lines 2593 to 2593OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -2289,6 +2587,7 @@22892587 return (22902588 <div22912589 className={cn(2292- "flex flex-col rounded-md px-0.5 py-0.5 transition-colors",2590+ "flex flex-col rounded-md px-0.5 transition-colors",2591+ isExpandedToolGroupEntry ? "py-0" : "py-0.5",22932592 canExpand &&2294- "cursor-pointer hover:bg-accent/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/70",2593+ "cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/70",apps/web/src/components/chat/ChangedFilesTree.tsx lines 22 to 22OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -19,8 +19,4 @@1919 import { PierreEntryIcon } from "./PierreEntryIcon";2020 import { Button } from "../ui/button";2121 import { Tooltip, TooltipPopup, TooltipTrigger } from "../ui/tooltip";22-import {23- changedFileName,24- selectChangedFilePreview,25- summarizeChangedFileScopes,26-} from "./changedFilesPresentation";22+import { changedFileName, selectChangedFilePreview } from "./changedFilesPresentation";
- apps/web/src/components/chat/MessagesTimeline.logic.ts lines 667 to 667OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -479,0 +647,21 @@647+ firstOwnedAfterUser >= 0 ? firstOwnedAfterUser : latestUserMessageIndex + 1;648+ }649+ const entryBelongsToActiveTurn = (entry: TimelineEntry, index: number) =>650+ input.isWorking &&651+ index >= activeTurnHeaderIndex &&652+ (unsettledTurnId === null || timelineEntryTurnId(entry) === unsettledTurnId);653+ const isVisibleActiveToolEntry = (entry: WorkLogEntry) =>654+ workLogEntryIsToolLike(entry) &&655+ (entry.toolLifecycleStatus === "inProgress" || !workEntryIndicatesToolNeutralStatus(entry));656+ const workEntryCouldBeInProgress = (entry: WorkLogEntry) =>657+ entry.toolLifecycleStatus === undefined || entry.toolLifecycleStatus === "inProgress";658+ const activeEntries = input.isWorking659+ ? input.timelineEntries.filter((entry, index) => entryBelongsToActiveTurn(entry, index))660+ : [];661+ const activeTurnHasVisibleContent =662+ activeEntries.some((entry) => {663+ if (entry.kind === "message") {664+ return entry.message.role === "assistant" && (entry.message.text?.trim().length ?? 0) > 0;665+ }666+ if (entry.kind === "work") {667+ return entry.entry.agentSpawn === undefined && workEntryCouldBeInProgress(entry.entry);apps/web/src/session-logic.ts line 1074OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -996,6 +1055,20 @@1055+ continue;1056+ }1057+ toolLifecycleRowIndex.delete(lifecycleKey);1058+ }1059+ }9961060 const previous = collapsed.at(-1);9971061 if (previous && shouldCollapseToolLifecycleEntries(previous, entry)) {998- collapsed[collapsed.length - 1] = mergeDerivedWorkLogEntries(previous, entry);1062+ const previousIndex = collapsed.length - 1;1063+ const previousKey = toolLifecycleCollapseMapKey(previous);1064+ if (previousKey !== undefined) toolLifecycleRowIndex.delete(previousKey);1065+ const merged = mergeDerivedWorkLogEntries(previous, entry);1066+ collapsed[previousIndex] = merged;1067+ const mergedKey = toolLifecycleCollapseMapKey(merged);1068+ if (mergedKey !== undefined && merged.activityKind !== "tool.completed") {1069+ toolLifecycleRowIndex.set(mergedKey, previousIndex);1070+ }9991071 continue;10001072 }10011073 collapsed.push(entry);1074+ if (lifecycleKey !== undefined && entry.activityKind !== "tool.completed") {apps/web/src/components/chat/ChangedFilesTree.tsx lines 81 to 81OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -89,13 +74,8 @@89- {files.length} changed file{files.length === 1 ? "" : "s"}90- </span>91- {hasNonZeroStat(summaryStat) && (92- <DiffStatLabel93- additions={summaryStat.additions}94- className="text-xs leading-4"95- deletions={summaryStat.deletions}96- layout="inline"97- />98- )}99- </span>100- <span className="ml-1 hidden min-w-0 flex-1 truncate text-[11px] text-muted-foreground group-hover:text-foreground/80 @[24rem]/changed-files:inline">101- {expanded ? "Hide files" : "Show files"}74+ <ChevronRightIcon75+ aria-hidden="true"76+ className={cn(77+ "size-3.5 shrink-0 text-muted-foreground transition-transform",78+ expanded && "rotate-90",79+ )}80+ />81+ <span className="flex shrink-0 items-center gap-1 whitespace-nowrap font-medium text-foreground text-xs leading-4">
- apps/web/src/components/chat/MessagesTimeline.logic.ts line 674OutdatedResolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -480 +654,21 @@654+ workLogEntryIsToolLike(entry) &&655+ (entry.toolLifecycleStatus === "inProgress" || !workEntryIndicatesToolNeutralStatus(entry));656+ const workEntryCouldBeInProgress = (entry: WorkLogEntry) =>657+ entry.toolLifecycleStatus === undefined || entry.toolLifecycleStatus === "inProgress";658+ const activeEntries = input.isWorking659+ ? input.timelineEntries.filter((entry, index) => entryBelongsToActiveTurn(entry, index))660+ : [];661+ const activeTurnHasVisibleContent =662+ activeEntries.some((entry) => {663+ if (entry.kind === "message") {664+ return entry.message.role === "assistant" && (entry.message.text?.trim().length ?? 0) > 0;665+ }666+ if (entry.kind === "work") {667+ return entry.entry.agentSpawn === undefined && workEntryCouldBeInProgress(entry.entry);480668 }669+ if (entry.kind === "turn-plan") return true;670+ return false;671+ }) ||672+ input.timelineEntries673+ .slice(activeTurnHeaderIndex)674+ .some((entry) => entry.kind === "proposed-plan" || entry.kind === "turn-plan");
- apps/web/src/components/chat/MessagesTimeline.tsx lines 2628 to 2628OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -2363,17 +2617,12 @@2363- >2364- <MinusIcon className="block size-3 shrink-0 opacity-70" aria-hidden />2365- </TooltipTrigger>2366- <TooltipPopup>Empty</TooltipPopup>2367- </Tooltip>2368- ) : null}2369- </span>2617+ <span className={cn("min-w-0 flex-1 truncate", headingClass)}>{displayText}</span>2618+ </p>23702619 </div>23712620 </div>23722621 </div>23732622 {expanded && canExpand && expandedBody ? (23742623 <div2375- className="mt-1 ms-7 cursor-default border-s border-border/45 ps-3 pt-0.5"2624+ className="mt-1 ms-[1.875rem] cursor-default pt-0.5"23762625 onClick={stopRowToggle}23772626 onPointerDown={stopRowToggle}23782627 >2379- <pre className={toolCallExpandedBodyClassName}>{expandedBody}</pre>2628+ <pre className={cn(toolCallExpandedBodyClassName, isCommandEntry && "select-all")}>
- apps/web/src/components/chat/MessagesTimeline.logic.ts line 343Resolvedby cursor[bot](GitHub profile, opens in a new tab)@@ -244,0 +294,21 @@294+ continue;295+ }296+ for (const file of entry.changedFiles) changedFiles.add(file);297+ }298+ return changedFiles.size + editsWithoutFileDetails;299+}300+301+function toolGroupActionLabel(action: ToolGroupAction, count: number): string {302+ switch (action) {303+ case "read":304+ return `Read ${count} ${count === 1 ? "file" : "files"}`;305+ case "edit":306+ return `Changed ${count} ${count === 1 ? "file" : "files"}`;307+ case "command":308+ return `Ran ${count} ${count === 1 ? "command" : "commands"}`;309+ case "search":310+ return `Searched the web ${count} ${count === 1 ? "time" : "times"}`;311+ case "other":312+ return `Used ${count} ${count === 1 ? "tool" : "tools"}`;313+ }314+}
- apps/web/src/components/chat/MessagesTimeline.tsx lines 1446 to 1455OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1379,0 +1435,21 @@1435+ label: string;1436+ iconName: WorkEntryIconName | undefined;1437+ highlighted?: boolean;1438+}) {1439+ return (1440+ <div1441+ className={cn(1442+ "flex min-h-6 min-w-0 items-center gap-1.5 px-1 py-0.5",1443+ highlighted ? "text-foreground" : "text-secondary-label",1444+ )}1445+ >1446+ {iconName ? (1447+ <span1448+ className={cn(1449+ "flex size-6 shrink-0 items-center justify-center",1450+ highlighted ? "text-foreground" : "text-icon-muted",1451+ )}1452+ >1453+ <WorkEntryIconSvg name={iconName} className="block size-4 shrink-0 stroke-[1.8]" />1454+ </span>1455+ ) : null}
- apps/web/src/components/chat/MessagesTimeline.tsx lines 1441 to 1453OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1379,0 +1433,21 @@1433+ highlighted = false,1434+}: {1435+ label: string;1436+ iconName: WorkEntryIconName | undefined;1437+ highlighted?: boolean;1438+}) {1439+ return (1440+ <div1441+ className={cn(1442+ "flex min-h-6 min-w-0 items-center gap-1.5 px-1 py-0.5",1443+ highlighted ? "text-foreground" : "text-secondary-label",1444+ )}1445+ >1446+ {iconName ? (1447+ <span1448+ className={cn(1449+ "flex size-6 shrink-0 items-center justify-center",1450+ highlighted ? "text-foreground" : "text-icon-muted",1451+ )}1452+ >1453+ <WorkEntryIconSvg name={iconName} className="block size-4 shrink-0 stroke-[1.8]" />
- apps/web/src/components/chat/MessagesTimeline.tsx lines 2502 to 2502OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -2213,0 +2482,21 @@2482+ <div className="flex items-center justify-between gap-2 px-1">2483+ <div className="flex min-w-0 flex-1 items-center gap-1.5 px-1 py-1 text-left text-xs leading-4">2484+ <span className="sr-only @[32rem]/agent-group:hidden">{status}</span>2485+ <span aria-hidden className={cn("size-1.5 shrink-0 rounded-full", dotClass)} />2486+ <WorkEntryIconSvg name="bot" className="size-3.5 shrink-0 text-muted-foreground" />2487+ <span className="min-w-0 truncate font-medium text-foreground">{lead}</span>2488+ {workflowName ? (2489+ <span className="hidden min-w-0 truncate text-[11px] text-muted-foreground @[40rem]/agent-group:inline">2490+ {workflowName}2491+ </span>2492+ ) : null}2493+ <span className="ml-auto hidden shrink-0 items-center gap-2 text-[11px] text-muted-foreground @[32rem]/agent-group:flex">2494+ <span>{status}</span>2495+ {totalTokens > 0 ? (2496+ <span className="font-mono tabular-nums">2497+ Σ {formatSubagentTokenCount(totalTokens)}2498+ </span>2499+ ) : null}2500+ </span>2501+ </div>2502+ <Buttonapps/web/src/components/chat/MessagesTimeline.tsx lines 1414 to 1414OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1370,10 +1399,16 @@13701399 key={workEntry.id}13711400 workEntry={workEntry}13721401 workspaceRoot={workspaceRoot}1402+ isExpandedToolGroupEntry={isExpandedToolGroupEntry}13731403 />13741404 ))}13751405 </div>13761406 </section>13771407 );13781408 });137914091410+function LiveActivityRow({ label, iconName }: { label: string; iconName?: WorkEntryIconName }) {1411+ return (1412+ <div className="relative min-h-6 w-fit max-w-full min-w-0 overflow-hidden rounded-md text-sm leading-relaxed">1413+ <LiveActivityContent label={label} iconName={iconName} />1414+ <div aria-hidden className="live-activity-focus pointer-events-none absolute inset-y-0">
- apps/web/src/components/chat/MessagesTimeline.logic.ts lines 696 to 699Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -479,5 +636,20 @@479- collapsedEntryIds.add(entryId);636+ for (const folds of foldsByAnchorEntryId.values()) {637+ for (const fold of folds) {638+ if (!input.expandedTurnIds?.has(fold.turnId)) {639+ for (const entryId of fold.hiddenEntryIds) {640+ collapsedEntryIds.add(entryId);641+ }480642 }481643 }482644 }483645646+ let activeTurnHeaderIndex = input.timelineEntries.length;647+ if (input.isWorking) {648+ const latestUserMessageIndex = lastUserMessageIndex(input.timelineEntries);649+ const firstOwnedAfterUser =650+ unsettledTurnId === null651+ ? -1652+ : input.timelineEntries.findIndex(653+ (entry, index) =>654+ index > latestUserMessageIndex && timelineEntryTurnId(entry) === unsettledTurnId,655+ );apps/web/src/components/chat/MessagesTimeline.logic.ts lines 275 to 275OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -242,3 +262,14 @@242262 return value.replace(/\s+(?:complete|completed)\s*$/i, "").trim();243263 }244264265+type ToolGroupAction = "read" | "edit" | "command" | "code-search" | "search" | "other";266+267+export function workLogEntryIsLocalCodeSearch(entry: WorkLogEntry): boolean {268+ return (269+ entry.itemType === "web_search" &&270+ /\bgrep\b/i.test(normalizeCompactToolLabel(entry.toolTitle ?? entry.label))271+ );272+}273+274+function toolGroupAction(entry: WorkLogEntry): ToolGroupAction {275+ if (entry.requestKind === "file-read" || entry.itemType === "image_view") return "read";
- apps/web/src/components/chat/MessagesTimeline.tsx lines 1309 to 1307OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1280,13 +1303,5 @@12801303 });1281130412821305 function WorkingTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "working" }> }) {1283- const { workingStepLabel } = use(TimelineRowActivityCtx);12841306 return (1285- <div className="py-0.5 pl-1.5">1286- <div className="flex min-w-0 items-center gap-2 pt-1 text-secondary-label text-[11px] tabular-nums">1287- <span className="inline-flex items-center gap-[3px]">1288- <span className="h-1 w-1 rounded-full bg-muted-foreground/30 animate-status-pulse" />1289- <span className="h-1 w-1 rounded-full bg-muted-foreground/30 animate-status-pulse [animation-delay:200ms]" />1290- <span className="h-1 w-1 rounded-full bg-muted-foreground/30 animate-status-pulse [animation-delay:400ms]" />1291- </span>1292- <span className="shrink-0">1307+ <div>
- apps/web/src/components/chat/MessagesTimeline.logic.ts lines 747 to 748OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -479,0 +728,21 @@728+ !entryBelongsToActiveTurn(entry, index)729+ ) {730+ continue;731+ }732+ if (!isVisibleActiveToolEntry(entry.entry)) {733+ continue;734+ }735+736+ const anchorEntry = entry;737+ let latestToolEntry = entry;738+ const batchEntryIds = [entry.id];739+ const visibleBatchEntries = [entry.entry];740+ let cursor = index + 1;741+ while (cursor < input.timelineEntries.length) {742+ const nextEntry = input.timelineEntries[cursor];743+ if (744+ !nextEntry ||745+ nextEntry.kind !== "work" ||746+ nextEntry.entry.agentSpawn !== undefined ||747+ !entryBelongsToActiveTurn(nextEntry, cursor)748+ ) {
- apps/web/src/components/chat/MessagesTimeline.logic.ts line 661OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -479 +642,20 @@479- collapsedEntryIds.add(entryId);642+ for (const folds of foldsByAnchorEntryId.values()) {643+ for (const fold of folds) {644+ if (!input.expandedTurnIds?.has(fold.turnId)) {645+ for (const entryId of fold.hiddenEntryIds) {646+ collapsedEntryIds.add(entryId);647+ }648+ }649+ }650+ }651+652+ let activeTurnHeaderIndex = input.timelineEntries.length;653+ if (input.isWorking) {654+ const latestUserMessageIndex = lastUserMessageIndex(input.timelineEntries);655+ const firstOwnedAfterUser =656+ unsettledTurnId === null657+ ? -1658+ : input.timelineEntries.findIndex(659+ (entry, index) =>660+ index > latestUserMessageIndex &&661+ (entry.kind === "proposed-plan" ||
- apps/web/src/components/chat/MessagesTimeline.tsx lines 942 to 947Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -931,4 +931,17 @@931- row.kind === "work-toggle" ||932- row.kind === "turn-plan"933- ? "pb-2"934- : "pb-4",931+ isExpandedToolGroupEntry932+ ? isLastExpandedToolGroupEntry933+ ? "pb-1"934+ : "pb-0"935+ : isExpandedToolGroupHeader936+ ? "pb-0"937+ : row.kind === "turn-fold"938+ ? "pb-1.5"939+ : (row.kind === "message" &&940+ row.message.role === "assistant" &&941+ !row.showAssistantMeta) ||942+ row.kind === "work" ||943+ row.kind === "work-live" ||944+ row.kind === "work-toggle" ||945+ row.kind === "turn-plan"946+ ? "pb-2"947+ : "pb-4",
- apps/web/src/components/chat/MessagesTimeline.tsx lines 1387 to 1387OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1360,4 +1382,6 @@13601382 if (nonEmptyEntries.length === 0) return null;1361138313621384 return (1363- <section className="-mx-1 space-y-0.5 px-1 py-0.5" aria-label={groupLabel}>1385+ <section1386+ className={cn("-mx-1 px-1", isExpandedToolGroupEntry ? "py-0" : "space-y-0.5 py-0.5")}1387+ aria-label={groupLabel}
- apps/web/src/components/chat/MessagesTimeline.tsx lines 1477 to 1479OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1379,0 +1459,21 @@1459+ ) : (1460+ <span aria-hidden className="size-6 shrink-0" />1461+ )}1462+ <span className="min-w-0 flex-1 truncate">{label}</span>1463+ </div>1464+ );1465+}1466+1467+function LiveWorkEntryTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "work-live" }> }) {1468+ const ctx = use(TimelineRowCtx);1469+1470+ return (1471+ <button1472+ type="button"1473+ className="group/live-work flex min-h-6 w-full max-w-full cursor-pointer items-center rounded-md text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring/70"1474+ aria-expanded={row.expanded}1475+ onClick={() => ctx.onToggleWorkGroup(row.groupId, row.id)}1476+ >1477+ <LiveActivityRow1478+ label={liveWorkEntryLabel(row.entry, ctx.workspaceRoot)}1479+ iconName={workEntryIconName(row.entry)}
- apps/web/src/components/chat/MessagesTimeline.tsx lines 1486 to 1483OutdatedResolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1379,0 +1463,21 @@1463+ className={cn(1464+ "flex size-6 shrink-0 items-center justify-center",1465+ failed ? "text-destructive" : highlighted ? "text-foreground" : "text-icon-muted",1466+ )}1467+ role={announceFailure ? "img" : undefined}1468+ aria-label={announceFailure ? "Tool call failed" : undefined}1469+ >1470+ <WorkEntryIconSvg1471+ name={resolvedIconName}1472+ className="block size-4 shrink-0 stroke-[1.8] opacity-70"1473+ />1474+ </span>1475+ ) : (1476+ <span aria-hidden className="size-6 shrink-0" />1477+ )}1478+ <span className="min-w-0 flex-1 truncate">{label}</span>1479+ </div>1480+ );1481+}1482+1483+function LiveWorkEntryTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "work-live" }> }) {
- apps/web/src/components/chat/MessagesTimeline.tsx lines 1471 to 1472Resolvedby macroscopeapp[bot](GitHub profile, opens in a new tab)@@ -1379,0 +1448,21 @@1448+ failed?: boolean;1449+ announceFailure?: boolean;1450+ highlighted?: boolean;1451+}) {1452+ const resolvedIconName = failed ? "x" : iconName;1453+1454+ return (1455+ <div1456+ className={cn(1457+ "flex min-h-6 min-w-0 items-center gap-1.5 px-0.5 py-0.5",1458+ highlighted ? "text-foreground" : "text-secondary-label",1459+ )}1460+ >1461+ {resolvedIconName ? (1462+ <span1463+ className={cn(1464+ "flex size-6 shrink-0 items-center justify-center",1465+ failed ? "text-destructive" : highlighted ? "text-foreground" : "text-icon-muted",1466+ )}1467+ role={announceFailure ? "img" : undefined}1468+ aria-label={announceFailure ? "Tool call failed" : undefined}
Sign in to join this conversation.


Important
Review skipped#
Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID:
c860b58f-a190-4026-a292-558459e13872You can disable this status message by setting the
reviews.review_statustofalsein the CodeRabbit configuration file.Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share