Skip to content

Commit 1e7e0ac

Browse files
committed
Merge remote-tracking branch 'github/main' into feat/markdown-preview-find
2 parents c8289e7 + 05adc16 commit 1e7e0ac

5 files changed

Lines changed: 110 additions & 7 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ const ComposerPendingUserInputCard = memo(function ComposerPendingUserInputCard(
285285
<>
286286
<span className="pointer-events-none flex h-5 shrink-0 items-center">
287287
{activeQuestion.multiSelect ? (
288-
<CheckboxMark checked={isSelected} />
288+
<CheckboxMark checked={isSelected} variant="contrast" />
289289
) : (
290290
<OptionRadio checked={isSelected} />
291291
)}
@@ -340,7 +340,7 @@ function OptionRadio({ checked }: { checked: boolean }) {
340340
<span
341341
aria-hidden
342342
className={cn(
343-
"relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-full border border-input bg-background not-dark:bg-clip-padding sm:size-4 dark:bg-input/32",
343+
"relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-full border border-foreground/55 bg-background not-dark:bg-clip-padding sm:size-4 dark:bg-input/32",
344344
checked ? "shadow-none" : "shadow-xs/5",
345345
)}
346346
>

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

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,74 @@ describe("resolveAssistantMessageCopyState", () => {
5555
});
5656

5757
describe("deriveMessagesTimelineRows", () => {
58+
it.each([
59+
["html-render", "reply-run", true],
60+
["mcp-app", "reply-run", true],
61+
["html-render", "other-run", false],
62+
["html-render", null, false],
63+
[null, null, false],
64+
] as const)("suppresses the empty fallback for %s in %s: %s", (kind, renderRun, expected) => {
65+
const at = "2026-11-06T00:00:00Z";
66+
const runId = RunId.make("reply-run");
67+
const renderBase = {
68+
id: "render",
69+
createdAt: at,
70+
runId: renderRun ? RunId.make(renderRun) : null,
71+
};
72+
const embedded: TimelineEntry[] =
73+
kind === "html-render"
74+
? [
75+
{
76+
...renderBase,
77+
kind,
78+
htmlRender: { attachmentId: "preview", title: "Preview", height: 420 },
79+
},
80+
]
81+
: kind === "mcp-app"
82+
? [
83+
{
84+
...renderBase,
85+
kind,
86+
sourceThreadId: ThreadId.make("thread"),
87+
itemId: TurnItemId.make("app"),
88+
revision: "1",
89+
mcpApp: {
90+
attachmentId: "app",
91+
server: "weather",
92+
tool: "weather",
93+
resourceUri: "ui://weather",
94+
},
95+
},
96+
]
97+
: [];
98+
const rows = deriveMessagesTimelineRows({
99+
timelineEntries: [
100+
...embedded,
101+
{
102+
kind: "message",
103+
id: "reply",
104+
createdAt: at,
105+
message: {
106+
id: MessageId.make("reply"),
107+
role: "assistant",
108+
runId,
109+
text: "",
110+
streaming: false,
111+
createdAt: at,
112+
updatedAt: at,
113+
},
114+
},
115+
],
116+
latestRun: null,
117+
isWorking: false,
118+
activeTurnStartedAt: null,
119+
turnDiffSummaries: [],
120+
supportsConversationRollback: false,
121+
});
122+
const reply = rows.find((row) => row.kind === "message" && row.id === "reply");
123+
expect(reply).toMatchObject({ suppressEmptyResponse: expected });
124+
});
125+
58126
it.each(["alone", "before tool", "before commentary and tool"])(
59127
"keeps an unfinished task update static %s",
60128
(placement) => {

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,7 @@ type MessagesTimelineRowContent =
594594
message: ChatMessage;
595595
projectedItem?: OrchestrationV2ProjectedTurnItem;
596596
showAssistantMeta: boolean;
597+
suppressEmptyResponse?: boolean;
597598
showAssistantCopyButton: boolean;
598599
assistantCopyStreaming: boolean;
599600
assistantTurnDiffSummary?: TurnDiffSummary | undefined;
@@ -1520,6 +1521,12 @@ export function deriveMessagesTimelineRows(input: {
15201521
revealedMessageId?: MessageId | null;
15211522
}): MessagesTimelineRow[] {
15221523
const timelineEntries = timelineRowEntries(input);
1524+
const embeddedResultRunIds = new Set<RunId>();
1525+
for (const entry of timelineEntries) {
1526+
if ((entry.kind === "html-render" || entry.kind === "mcp-app") && entry.runId !== null) {
1527+
embeddedResultRunIds.add(entry.runId);
1528+
}
1529+
}
15231530
const isPendingApproval = (entry: WorkLogEntry) => {
15241531
const item = entry.projectedItem?.item;
15251532
return (
@@ -2164,6 +2171,10 @@ export function deriveMessagesTimelineRows(input: {
21642171
? {}
21652172
: { projectedItem: timelineEntry.projectedItem }),
21662173
showAssistantMeta,
2174+
suppressEmptyResponse:
2175+
timelineEntry.message.role === "assistant" &&
2176+
timelineEntry.message.runId != null &&
2177+
embeddedResultRunIds.has(timelineEntry.message.runId),
21672178
showAssistantCopyButton: showAssistantMeta,
21682179
assistantCopyStreaming: timelineEntry.message.streaming || assistantResponseStillInProgress,
21692180
assistantTurnDiffSummary:
@@ -2633,6 +2644,7 @@ function isRowUnchanged(a: MessagesTimelineRow, b: MessagesTimelineRow): boolean
26332644
a.message === bm.message &&
26342645
a.projectedItem === bm.projectedItem &&
26352646
a.showAssistantMeta === bm.showAssistantMeta &&
2647+
a.suppressEmptyResponse === bm.suppressEmptyResponse &&
26362648
a.showAssistantCopyButton === bm.showAssistantCopyButton &&
26372649
a.assistantCopyStreaming === bm.assistantCopyStreaming &&
26382650
a.assistantTurnDiffSummary === bm.assistantTurnDiffSummary &&

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ export function AssistantTimelineRow({ row }: { row: Extract<TimelineRow, { kind
3232
row.projectedItem?.item.id,
3333
);
3434
const text = liveText ?? row.message.text;
35-
const messageText = text || (row.message.streaming ? "" : "(empty response)");
35+
const messageText =
36+
text || (row.message.streaming || row.suppressEmptyResponse ? "" : "(empty response)");
3637

3738
return (
3839
<>

‎apps/web/src/components/ui/checkbox.tsx‎

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,21 @@ const rootClassName =
88
const indicatorClassName =
99
"-inset-px absolute flex items-center justify-center rounded-[.25rem] text-primary-foreground data-unchecked:hidden data-checked:bg-primary data-indeterminate:text-foreground in-[[data-slot=checkbox]:focus-visible]:inset-shadow-[0_0_0_3px_var(--background)] in-[[data-slot=checkbox]:focus-visible]:outline-2 in-[[data-slot=checkbox]:focus-visible]:outline-solid in-[[data-slot=checkbox]:focus-visible]:-outline-offset-2 in-[[data-slot=checkbox]:focus-visible]:outline-inherit";
1010

11-
function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
11+
const variantClassNames = {
12+
default: "",
13+
contrast: "border-foreground/55",
14+
};
15+
16+
type CheckboxVariant = keyof typeof variantClassNames;
17+
18+
function Checkbox({
19+
className,
20+
variant = "default",
21+
...props
22+
}: CheckboxPrimitive.Root.Props & { variant?: CheckboxVariant }) {
1223
return (
1324
<CheckboxPrimitive.Root
14-
className={cn(rootClassName, className)}
25+
className={cn(rootClassName, variantClassNames[variant], className)}
1526
data-slot="checkbox"
1627
{...props}
1728
>
@@ -60,10 +71,21 @@ function Checkbox({ className, ...props }: CheckboxPrimitive.Root.Props) {
6071
}
6172

6273
// Checkbox's look without its hidden input, for a row that is itself the button.
63-
function CheckboxMark({ checked }: { checked: boolean }) {
74+
function CheckboxMark({
75+
checked,
76+
variant = "default",
77+
}: {
78+
checked: boolean;
79+
variant?: CheckboxVariant;
80+
}) {
6481
const state = checked ? { "data-checked": "" } : { "data-unchecked": "" };
6582
return (
66-
<span aria-hidden className={rootClassName} data-slot="checkbox" {...state}>
83+
<span
84+
aria-hidden
85+
className={cn(rootClassName, variantClassNames[variant])}
86+
data-slot="checkbox"
87+
{...state}
88+
>
6789
<span className={indicatorClassName} data-slot="checkbox-indicator" {...state}>
6890
<svg
6991
className="size-3.5 text-current sm:size-3"

0 commit comments

Comments
 (0)