Skip to content

Commit dbe6252

Browse files
committed
fix(web): address workspace refresh review feedback
1 parent a3508da commit dbe6252

17 files changed

Lines changed: 267 additions & 72 deletions

‎apps/web/src/components/Sidebar.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,7 @@ function SnoozePopoverButton(props: {
373373
size="icon-micro"
374374
variant="ghost-muted"
375375
aria-label="Snooze thread"
376+
title="Snooze thread"
376377
onClick={(event) => event.stopPropagation()}
377378
onDoubleClick={(event) => event.stopPropagation()}
378379
/>

‎apps/web/src/components/ThreadTerminalDrawer.tsx‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ const MIN_DRAWER_HEIGHT = 180;
7878
const MAX_DRAWER_HEIGHT_RATIO = 0.75;
7979
const MULTI_CLICK_SELECTION_ACTION_DELAY_MS = 260;
8080
const TERMINAL_SIDEBAR_DEFAULT_WIDTH = 144;
81-
const TERMINAL_SIDEBAR_MIN_WIDTH = 96;
81+
const TERMINAL_SIDEBAR_MIN_WIDTH = 144;
8282
const TERMINAL_SIDEBAR_MAX_WIDTH = 320;
8383
const TERMINAL_SIDEBAR_WIDTH_STORAGE_KEY = "t3code:terminal-sidebar-width";
8484

@@ -1185,6 +1185,12 @@ export default function ThreadTerminalDrawer({
11851185
setRenamingTerminalId(null);
11861186
}, []);
11871187

1188+
useEffect(() => {
1189+
cancelTerminalRenameRef.current = false;
1190+
setRenamingTerminalId(null);
1191+
setTerminalRenameDraft("");
1192+
}, [threadRef.environmentId, threadRef.threadId]);
1193+
11881194
useEffect(() => {
11891195
onHeightChangeRef.current = onHeightChange;
11901196
}, [onHeightChange]);
@@ -1575,6 +1581,7 @@ export default function ThreadTerminalDrawer({
15751581
}}
15761582
onKeyDown={(event) => {
15771583
event.stopPropagation();
1584+
if (event.nativeEvent.isComposing) return;
15781585
if (event.key === "Enter") {
15791586
event.preventDefault();
15801587
finishTerminalRename();

‎apps/web/src/components/chat/ChangedFilesTree.test.tsx‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ describe("ChangedFilesCard", () => {
2525
expect(markup).toContain("whitespace-nowrap");
2626
expect(markup).toContain('class="flex min-w-0 items-center gap-1.5 rounded-md px-1 py-1');
2727
expect(markup).toContain('class="flex shrink-0 items-center gap-1 whitespace-nowrap');
28-
expect(markup).toContain('class="hidden sm:inline">Open diff</span>');
29-
expect(markup).not.toContain("@[24rem]/changed-files:inline");
28+
expect(markup).toContain('class="hidden @[24rem]/changed-files:inline">Open diff</span>');
3029
expect(markup).toContain('class="flex shrink-0 items-center gap-1.5"');
3130
expect(markup).toContain("!size-[22px]");
3231
expect(markup).toContain("size-3");

‎apps/web/src/components/chat/ChangedFilesTree.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export const ChangedFilesCard = memo(function ChangedFilesCard(props: {
5151

5252
return (
5353
<div
54-
className="mt-4 rounded-xl border border-border/70 bg-secondary p-1.5 dark:border-transparent dark:bg-input/32"
54+
className="@container/changed-files mt-4 rounded-xl border border-border/70 bg-secondary p-1.5 dark:border-transparent dark:bg-input/32"
5555
data-changed-files-state={
5656
expanded ? "expanded" : compactPreviewVisible ? "preview" : "collapsed"
5757
}
@@ -134,7 +134,7 @@ export const ChangedFilesCard = memo(function ChangedFilesCard(props: {
134134
}
135135
>
136136
<FileDiffIcon className="size-3" />
137-
<span className="hidden sm:inline">Open diff</span>
137+
<span className="hidden @[24rem]/changed-files:inline">Open diff</span>
138138
</TooltipTrigger>
139139
<TooltipPopup side="top">Open the full diff</TooltipPopup>
140140
</Tooltip>

‎apps/web/src/components/chat/MessagesTimeline.logic.test.ts‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,7 @@ describe("deriveMessagesTimelineRows", () => {
849849
turnId: "turn-1" as never,
850850
label: "Ran command",
851851
tone: "tool" as const,
852+
toolLifecycleStatus: "inProgress" as const,
852853
},
853854
},
854855
],
@@ -970,6 +971,29 @@ describe("deriveMessagesTimelineRows", () => {
970971
"work-2",
971972
"work-3",
972973
]);
974+
975+
const rowsWithLaterPlan = deriveMessagesTimelineRows({
976+
...baseInput,
977+
timelineEntries: [
978+
...timelineEntries,
979+
{
980+
id: "plan:thread-1:turn:turn-1",
981+
kind: "proposed-plan" as const,
982+
createdAt: "2026-01-01T00:00:03Z",
983+
proposedPlan: {
984+
id: "plan:thread-1:turn:turn-1",
985+
turnId: "turn-1" as never,
986+
planMarkdown: "# Next steps",
987+
implementedAt: null,
988+
implementationThreadId: null,
989+
createdAt: "2026-01-01T00:00:03Z",
990+
updatedAt: "2026-01-01T00:00:03Z",
991+
},
992+
},
993+
],
994+
});
995+
expect(rowsWithLaterPlan.some((row) => row.kind === "work-live")).toBe(false);
996+
expect(rowsWithLaterPlan.some((row) => row.kind === "proposed-plan")).toBe(true);
973997
});
974998

975999
it("does not fold the session's running turn when latestTurn regresses", () => {

‎apps/web/src/components/chat/MessagesTimeline.logic.ts‎

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,9 @@ export function deriveMessagesTimelineRows(input: {
638638
input.isWorking &&
639639
index >= activeTurnHeaderIndex &&
640640
(unsettledTurnId === null || timelineEntryTurnId(entry) === unsettledTurnId);
641+
const isVisibleActiveToolEntry = (entry: WorkLogEntry) =>
642+
workLogEntryIsToolLike(entry) &&
643+
(entry.toolLifecycleStatus === "inProgress" || !workEntryIndicatesToolNeutralStatus(entry));
641644
const activeEntries = input.isWorking
642645
? input.timelineEntries.filter((entry, index) => entryBelongsToActiveTurn(entry, index))
643646
: [];
@@ -647,9 +650,7 @@ export function deriveMessagesTimelineRows(input: {
647650
return entry.message.role === "assistant" && (entry.message.text?.trim().length ?? 0) > 0;
648651
}
649652
if (entry.kind === "work") {
650-
return (
651-
entry.entry.agentSpawn === undefined && !workEntryIndicatesToolNeutralStatus(entry.entry)
652-
);
653+
return entry.entry.agentSpawn === undefined && isVisibleActiveToolEntry(entry.entry);
653654
}
654655
if (entry.kind === "turn-plan") return true;
655656
return false;
@@ -669,13 +670,13 @@ export function deriveMessagesTimelineRows(input: {
669670
if (!entry) continue;
670671
const isVisibleTurnContent =
671672
(entry.kind === "message" && entry.message.role === "user") ||
673+
entry.kind === "proposed-plan" ||
672674
(entryBelongsToActiveTurn(entry, index) &&
673675
((entry.kind === "message" && entry.message.role === "assistant") ||
674676
entry.kind === "turn-plan" ||
675677
(entry.kind === "work" &&
676678
entry.entry.agentSpawn === undefined &&
677-
!workEntryIndicatesToolNeutralStatus(entry.entry) &&
678-
workLogEntryIsToolLike(entry.entry))));
679+
isVisibleActiveToolEntry(entry.entry))));
679680
hasLaterTurnContent[index] = isVisibleTurnContent || hasLaterTurnContent[index + 1] === true;
680681
}
681682

@@ -689,7 +690,7 @@ export function deriveMessagesTimelineRows(input: {
689690
) {
690691
continue;
691692
}
692-
if (workEntryIndicatesToolNeutralStatus(entry.entry) || !workLogEntryIsToolLike(entry.entry)) {
693+
if (!isVisibleActiveToolEntry(entry.entry)) {
693694
continue;
694695
}
695696

@@ -709,13 +710,8 @@ export function deriveMessagesTimelineRows(input: {
709710
break;
710711
}
711712
batchEntryIds.push(nextEntry.id);
712-
if (
713-
!workEntryIndicatesToolNeutralStatus(nextEntry.entry) &&
714-
workLogEntryIsToolLike(nextEntry.entry)
715-
) {
713+
if (isVisibleActiveToolEntry(nextEntry.entry)) {
716714
latestToolEntry = nextEntry;
717-
}
718-
if (!workEntryIndicatesToolNeutralStatus(nextEntry.entry)) {
719715
visibleBatchEntries.push(nextEntry.entry);
720716
}
721717
cursor += 1;

‎apps/web/src/components/chat/MessagesTimeline.test.tsx‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,17 +580,18 @@ describe("MessagesTimeline", () => {
580580
turnId,
581581
toolCallId: "call-live-tool",
582582
label: "Running tests",
583-
command: "vp test run",
583+
command: "env -C /tmp sudo -u postgres psql",
584584
tone: "tool",
585+
toolLifecycleStatus: "inProgress",
585586
},
586587
},
587588
]}
588589
/>,
589590
);
590591

591-
expect(markup).toContain('aria-label="Expand current tool calls"');
592+
expect(markup).not.toContain('aria-label="Expand current tool calls"');
592593
expect(markup).toContain('aria-expanded="false"');
593-
expect(markup).toContain("Running vp");
594+
expect(markup).toContain("Running psql");
594595
expect(markup).not.toContain("lucide-chevron-right");
595596
expect(markup).not.toContain("hover:bg-accent/20");
596597
});

‎apps/web/src/components/chat/MessagesTimeline.tsx‎

Lines changed: 47 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,6 @@ function LiveWorkEntryTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "
14561456
<button
14571457
type="button"
14581458
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"
1459-
aria-label={row.expanded ? "Collapse current tool calls" : "Expand current tool calls"}
14601459
aria-expanded={row.expanded}
14611460
onClick={() => ctx.onToggleWorkGroup(row.groupId, row.id)}
14621461
>
@@ -2160,19 +2159,56 @@ function workEntryPreview(
21602159
: `${displayPath} +${workEntry.changedFiles!.length - 1} more`;
21612160
}
21622161

2163-
const LIVE_COMMAND_PREVIEW_LIMIT = 80;
2162+
type CommandWrapper = "env" | "sudo";
2163+
2164+
const COMMAND_WRAPPER_OPTIONS_WITH_VALUE: Record<CommandWrapper, ReadonlySet<string>> = {
2165+
env: new Set(["-C", "--chdir", "-S", "--split-string", "-u", "--unset"]),
2166+
sudo: new Set(["-C", "--close-from", "-D", "--chdir", "-g", "--group", "-u", "--user"]),
2167+
};
2168+
2169+
const COMMAND_WRAPPER_FLAGS: Record<CommandWrapper, ReadonlySet<string>> = {
2170+
env: new Set(["-0", "--null", "-i", "--ignore-environment", "--debug"]),
2171+
sudo: new Set(["-A", "--askpass", "-b", "--background", "-E", "-H", "-n", "-S"]),
2172+
};
21642173

21652174
function commandProgramName(command: string): string | null {
21662175
const tokens = command.trim().split(/\s+/);
21672176
let index = 0;
2177+
let wrapper: CommandWrapper | null = null;
21682178

21692179
while (index < tokens.length) {
21702180
const token = tokens[index]?.replace(/^["']|["']$/g, "");
21712181
if (!token) return null;
2172-
if (/^[A-Za-z_][A-Za-z0-9_]*=/.test(token) || token === "env" || token === "sudo") {
2182+
if (/^[A-Za-z_][A-Za-z0-9_]*=/.test(token)) {
2183+
index += 1;
2184+
continue;
2185+
}
2186+
if (token === "env" || token === "sudo") {
2187+
wrapper = token;
21732188
index += 1;
21742189
continue;
21752190
}
2191+
if (wrapper !== null && token === "--") {
2192+
wrapper = null;
2193+
index += 1;
2194+
continue;
2195+
}
2196+
if (wrapper !== null && token.startsWith("-")) {
2197+
if (COMMAND_WRAPPER_OPTIONS_WITH_VALUE[wrapper].has(token)) {
2198+
if (tokens[index + 1] === undefined) return null;
2199+
index += 2;
2200+
continue;
2201+
}
2202+
if (
2203+
COMMAND_WRAPPER_FLAGS[wrapper].has(token) ||
2204+
/^--[^=]+=/.test(token) ||
2205+
(/^-[A-Za-z].+/.test(token) && !token.startsWith("--"))
2206+
) {
2207+
index += 1;
2208+
continue;
2209+
}
2210+
return null;
2211+
}
21762212
return token.split(/[\\/]/).at(-1) || null;
21772213
}
21782214

@@ -2187,9 +2223,7 @@ function liveWorkEntryLabel(
21872223
if (command) {
21882224
const program = commandProgramName(command);
21892225
if (program) return `Running ${program}`;
2190-
if (command.length > LIVE_COMMAND_PREVIEW_LIMIT || command.includes("\n")) {
2191-
return "Running command";
2192-
}
2226+
return "Running command";
21932227
}
21942228

21952229
return workEntryPreview(workEntry, workspaceRoot) ?? toolWorkEntryHeading(workEntry);
@@ -2200,14 +2234,16 @@ function buildToolCallExpandedBody(
22002234
workspaceRoot: string | undefined,
22012235
): string | null {
22022236
const command = workEntry.rawCommand?.trim() || workEntry.command?.trim();
2203-
if (command) return command;
2204-
22052237
const blocks: string[] = [];
2238+
if (command) {
2239+
blocks.push(command);
2240+
}
22062241
if (workEntry.itemType === "mcp_tool_call" && workEntry.toolData !== undefined) {
22072242
blocks.push(`MCP call\n${JSON.stringify(workEntry.toolData, null, 2)}`);
22082243
}
2209-
if (workEntry.detail?.trim()) {
2210-
blocks.push(workEntry.detail.trim());
2244+
const detail = workEntry.detail?.trim();
2245+
if (detail && detail !== command) {
2246+
blocks.push(detail);
22112247
}
22122248
const changedFiles = workEntry.changedFiles ?? [];
22132249
if (changedFiles.length > 0) {
@@ -2439,6 +2475,7 @@ const PlainWorkEntryRow = memo(function PlainWorkEntryRow(props: {
24392475
role: "button" as const,
24402476
tabIndex: 0 as const,
24412477
"aria-label": displayText,
2478+
"aria-expanded": expanded,
24422479
onClick: () => setExpanded((v) => !v),
24432480
onKeyDown: (e: KeyboardEvent<HTMLDivElement>) => {
24442481
if (e.key === "Enter" || e.key === " ") {

‎apps/web/src/components/chat/PanelLayoutControls.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export const PanelLayoutControls = memo(function PanelLayoutControls({
8080
>
8181
<PanelRightIcon
8282
className={cn(
83-
"size-3.5",
83+
"size-4",
8484
!rightPanelAvailable && "text-muted-foreground opacity-100",
8585
)}
8686
/>

‎apps/web/src/components/usage/UsagePage.tsx‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import {
3434
WorkspacePageHeaderEdgeControl,
3535
} from "../WorkspacePageContainer";
3636
import { UsageProviderChart, type UsageChartMetric } from "./UsageProviderChart";
37-
import { PROVIDER_COLOR, PROVIDER_LABEL, PROVIDER_MARK, PROVIDER_ORDER } from "./usageProviders";
37+
import { PROVIDER_LABEL, PROVIDER_MARK, PROVIDER_ORDER } from "./usageProviders";
3838

3939
const WINDOW_OPTIONS = [
4040
{ days: 1, label: "Past 24h" },
@@ -99,7 +99,7 @@ export function UsagePage() {
9999
? `${formatDateTimeShort(window.sinceTime, window.timeZone)} to ${formatDateTimeShort(window.untilTime, window.timeZone)}`
100100
: `${formatDayShort(window.sinceDay)} to ${formatDayShort(window.untilDay)}`;
101101
const topbarContent = (
102-
<div className="flex w-full min-w-0 items-center gap-3">
102+
<div className="flex w-full min-w-0 flex-wrap items-center gap-x-3 gap-y-2">
103103
<WorkspaceBreadcrumb ariaLabel="Usage breadcrumb" className="min-w-0">
104104
<WorkspaceBreadcrumbItem current>
105105
<h1>Usage</h1>
@@ -109,7 +109,7 @@ export function UsagePage() {
109109
<span className="truncate">{windowLabel}</span>
110110
</WorkspaceBreadcrumbItem>
111111
</WorkspaceBreadcrumb>
112-
<div className="ms-auto flex shrink-0 items-center gap-3">
112+
<div className="ms-auto flex min-w-0 basis-full flex-wrap items-center justify-end gap-2 sm:basis-auto">
113113
<SegmentedTabList aria-label="Usage metric">
114114
{(["cost", "tokens"] as const).map((option) => (
115115
<SegmentedTab
@@ -144,7 +144,9 @@ export function UsagePage() {
144144
return (
145145
<SidebarInset className="h-dvh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground isolate">
146146
<div className="flex min-h-0 min-w-0 flex-1 flex-col bg-background text-foreground">
147-
<WorkspacePageHeader electron={isElectron}>{topbarContent}</WorkspacePageHeader>
147+
<WorkspacePageHeader electron={isElectron} className="h-auto py-2">
148+
{topbarContent}
149+
</WorkspacePageHeader>
148150

149151
<ScrollArea className="min-h-0 flex-1">
150152
<WorkspacePageContainer width="wide">
@@ -196,10 +198,7 @@ export function UsagePage() {
196198
</span>
197199
</span>
198200
</span>
199-
<span
200-
className="shrink-0 text-sm font-medium tabular-nums"
201-
style={{ color: PROVIDER_COLOR[provider] }}
202-
>
201+
<span className="shrink-0 text-sm font-medium text-foreground tabular-nums">
203202
{metric === "cost"
204203
? formatUsd(totals?.costUsd ?? 0)
205204
: formatTokens(totals?.totalTokens ?? 0)}

0 commit comments

Comments
 (0)