-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Expand file tree
/
Copy pathMessagesTimeline.logic.ts
More file actions
679 lines (615 loc) · 21.4 KB
/
Copy pathMessagesTimeline.logic.ts
File metadata and controls
679 lines (615 loc) · 21.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
import * as Equal from "effect/Equal";
import {
formatDuration,
workEntryIndicatesToolNeutralStatus,
workLogEntryIsToolLike,
type TimelineEntry,
type WorkLogEntry,
} from "../../session-logic";
import { type ChatMessage, type ProposedPlan, type TurnDiffSummary } from "../../types";
import { type MessageId, type OrchestrationLatestTurn, type TurnId } from "@t3tools/contracts";
import { formatWorkspaceRelativePath } from "../../filePathDisplay";
export const MAX_VISIBLE_WORK_LOG_ENTRIES = 1;
export const TIMELINE_MINIMAP_ITEM_SPACING = 8;
export const TIMELINE_MINIMAP_MIN_ITEMS = 2;
export const TIMELINE_MINIMAP_MAX_HEIGHT_CSS = "calc(100vh - 18rem)";
export const TIMELINE_CONTENT_MAX_WIDTH = 768;
export const TIMELINE_MINIMAP_PERSISTENT_GUTTER = 48;
export interface TimelineEndState {
readonly isAtEnd?: boolean;
readonly isNearEnd?: boolean;
}
export function resolveTimelineIsAtEnd(state: TimelineEndState | undefined): boolean | undefined {
return state?.isNearEnd ?? state?.isAtEnd;
}
export function resolveTimelineMinimapHeightStyle(itemCount: number): string {
const naturalHeight = Math.max(1, (itemCount - 1) * TIMELINE_MINIMAP_ITEM_SPACING);
return `min(${naturalHeight}px, ${TIMELINE_MINIMAP_MAX_HEIGHT_CSS})`;
}
export function resolveTimelineMinimapTopPercent(index: number, itemCount: number): number {
if (itemCount <= 1) {
return 0;
}
return (Math.max(0, Math.min(index, itemCount - 1)) / (itemCount - 1)) * 100;
}
export function resolveTimelineMinimapIndexFromPointer(input: {
readonly itemCount: number;
readonly railTop: number;
readonly railHeight: number;
readonly pointerY: number;
}): number | null {
if (input.itemCount <= 0 || input.railHeight <= 0) {
return null;
}
if (input.itemCount === 1) {
return 0;
}
const progress = Math.max(0, Math.min(1, (input.pointerY - input.railTop) / input.railHeight));
return Math.max(0, Math.min(input.itemCount - 1, Math.round(progress * (input.itemCount - 1))));
}
export function resolveTimelineMinimapHasPersistentGutter(viewportWidth: number): boolean {
if (!Number.isFinite(viewportWidth) || viewportWidth <= 0) {
return false;
}
const contentWidth = Math.min(viewportWidth, TIMELINE_CONTENT_MAX_WIDTH);
const sideGutter = Math.max(0, (viewportWidth - contentWidth) / 2);
return sideGutter >= TIMELINE_MINIMAP_PERSISTENT_GUTTER;
}
function computeElapsedMs(startIso: string, endIso: string): number | null {
const start = Date.parse(startIso);
const end = Date.parse(endIso);
if (!Number.isFinite(start) || !Number.isFinite(end)) return null;
return Math.max(0, end - start);
}
function maxIsoTimestamp(a: string | null, b: string | null): string | null {
if (a === null) return b;
if (b === null) return a;
const aMs = Date.parse(a);
const bMs = Date.parse(b);
if (!Number.isFinite(aMs)) return b;
if (!Number.isFinite(bMs)) return a;
return bMs > aMs ? b : a;
}
export interface TimelineDurationMessage {
id: string;
role: "user" | "assistant" | "system";
createdAt: string;
updatedAt: string;
streaming: boolean;
}
export type TimelineLatestTurn = Pick<
OrchestrationLatestTurn,
"turnId" | "state" | "startedAt" | "completedAt"
>;
export type MessagesTimelineRow =
| {
kind: "work";
id: string;
createdAt: string;
groupedEntries: WorkLogEntry[];
}
| {
kind: "work-toggle";
id: string;
createdAt: string;
groupId: string;
hiddenCount: number;
expanded: boolean;
onlyToolEntries: boolean;
}
| {
kind: "turn-fold";
id: string;
createdAt: string;
turnId: TurnId;
label: string;
expanded: boolean;
}
| {
kind: "message";
id: string;
createdAt: string;
message: ChatMessage;
durationStart: string;
showAssistantMeta: boolean;
showAssistantCopyButton: boolean;
assistantCopyStreaming: boolean;
assistantTurnDiffSummary?: TurnDiffSummary | undefined;
revertTurnCount?: number | undefined;
}
| {
kind: "proposed-plan";
id: string;
createdAt: string;
proposedPlan: ProposedPlan;
}
| { kind: "working"; id: string; createdAt: string | null };
export interface StableMessagesTimelineRowsState {
byId: Map<string, MessagesTimelineRow>;
result: MessagesTimelineRow[];
}
export function computeMessageDurationStart(
messages: ReadonlyArray<TimelineDurationMessage>,
): Map<string, string> {
const result = new Map<string, string>();
let lastBoundary: string | null = null;
for (const message of messages) {
if (message.role === "user") {
lastBoundary = message.createdAt;
}
result.set(message.id, lastBoundary ?? message.createdAt);
if (message.role === "assistant" && !message.streaming) {
lastBoundary = message.updatedAt;
}
}
return result;
}
export function normalizeCompactToolLabel(value: string): string {
return value.replace(/\s+(?:complete|completed)\s*$/i, "").trim();
}
function capitalizePhrase(value: string): string {
const trimmed = value.trim();
if (trimmed.length === 0) {
return value;
}
return `${trimmed.charAt(0).toUpperCase()}${trimmed.slice(1)}`;
}
export function deriveToolWorkEntryHeading(workEntry: WorkLogEntry): string {
if (!workEntry.toolTitle) {
return capitalizePhrase(normalizeCompactToolLabel(workEntry.label));
}
return capitalizePhrase(normalizeCompactToolLabel(workEntry.toolTitle));
}
export function deriveWorkEntryPreview(
workEntry: Pick<WorkLogEntry, "detail" | "command" | "changedFiles" | "itemType" | "requestKind">,
workspaceRoot: string | undefined,
): string | null {
const changedFilesPreview = deriveChangedFilesPreview(workEntry, workspaceRoot);
if (workEntry.itemType === "file_change" || workEntry.requestKind === "file-change") {
return changedFilesPreview ?? workEntry.command ?? workEntry.detail ?? null;
}
if (workEntry.command) return workEntry.command;
if (workEntry.detail) return workEntry.detail;
return changedFilesPreview;
}
export interface DerivedWorkEntryDisplay {
heading: string;
preview: string | null;
displayText: string;
}
export function deriveWorkEntryDisplay(
workEntry: WorkLogEntry,
workspaceRoot: string | undefined,
): DerivedWorkEntryDisplay {
const heading = deriveToolWorkEntryHeading(workEntry);
const rawPreview = deriveWorkEntryPreview(workEntry, workspaceRoot);
const preview =
rawPreview &&
normalizeCompactToolLabel(rawPreview).toLowerCase() ===
normalizeCompactToolLabel(heading).toLowerCase()
? null
: rawPreview;
return {
heading,
preview,
displayText: preview ? `${heading} - ${preview}` : heading,
};
}
function deriveChangedFilesPreview(
workEntry: Pick<WorkLogEntry, "changedFiles">,
workspaceRoot: string | undefined,
): string | null {
if ((workEntry.changedFiles?.length ?? 0) === 0) return null;
const [firstPath] = workEntry.changedFiles ?? [];
if (!firstPath) return null;
const displayPath = formatWorkspaceRelativePath(firstPath, workspaceRoot);
return workEntry.changedFiles!.length === 1
? displayPath
: `${displayPath} +${workEntry.changedFiles!.length - 1} more`;
}
export function shouldToggleWorkEntryRowFromKeyDown({
key,
targetIsCurrentTarget,
}: {
key: string;
targetIsCurrentTarget: boolean;
}): boolean {
return targetIsCurrentTarget && (key === "Enter" || key === " ");
}
export function resolveAssistantMessageCopyState({
text,
showCopyButton,
streaming,
}: {
text: string | null;
showCopyButton: boolean;
streaming: boolean;
}) {
const hasText = text !== null && text.trim().length > 0;
return {
text: hasText ? text : null,
visible: showCopyButton && hasText && !streaming,
};
}
function deriveTerminalAssistantMessageIds(timelineEntries: ReadonlyArray<TimelineEntry>) {
const lastAssistantMessageIdByResponseKey = new Map<string, string>();
let nullTurnResponseIndex = 0;
for (const timelineEntry of timelineEntries) {
if (timelineEntry.kind !== "message") {
continue;
}
const { message } = timelineEntry;
if (message.role === "user") {
nullTurnResponseIndex += 1;
continue;
}
if (message.role !== "assistant") {
continue;
}
const responseKey = message.turnId
? `turn:${message.turnId}`
: `unkeyed:${nullTurnResponseIndex}`;
lastAssistantMessageIdByResponseKey.set(responseKey, message.id);
}
return new Set(lastAssistantMessageIdByResponseKey.values());
}
interface TurnFold {
turnId: TurnId;
anchorEntryId: string;
createdAt: string;
hiddenEntryIds: ReadonlySet<string>;
label: string;
}
/**
* The session's running turn is authoritative when latestTurn briefly lags or
* regresses behind it. Otherwise, the latest turn counts as unsettled while it
* is still running (or has not recorded a completion). This is deliberately
* keyed on turn lifecycle rather than transient working state: right after the
* user sends a message, the previous turn is still the "active" one until the
* server creates the new turn, and folding must not flicker through that window.
*/
function deriveUnsettledTurnId(
latestTurn: TimelineLatestTurn | null,
runningTurnId: TurnId | null,
): TurnId | null {
if (runningTurnId !== null) {
return runningTurnId;
}
if (!latestTurn) {
return null;
}
const isSettled = latestTurn.completedAt !== null && latestTurn.state !== "running";
return isSettled ? null : latestTurn.turnId;
}
/**
* Settled turns fold their commentary and tool activity behind a
* "Worked for ..." row anchored at the turn's first foldable entry; the
* terminal assistant message stays visible below the fold.
*/
function deriveTurnFolds(input: {
timelineEntries: ReadonlyArray<TimelineEntry>;
terminalAssistantMessageIds: ReadonlySet<string>;
latestTurn: TimelineLatestTurn | null;
unsettledTurnId: TurnId | null;
}): ReadonlyMap<string, TurnFold> {
interface TurnGroup {
entries: Array<TimelineEntry>;
terminalEntry: Extract<TimelineEntry, { kind: "message" }> | null;
hasStreamingMessage: boolean;
/**
* The user message that kicked the turn off. Entry timestamps alone
* undercount the duration (the first entry appears only once the
* provider starts producing output), and a turn cut short by a steer may
* hold a single instantaneous commentary message.
*/
startBoundary: string | null;
}
const groupsByTurnId = new Map<TurnId, TurnGroup>();
let pendingUserBoundary: string | null = null;
for (const entry of input.timelineEntries) {
if (entry.kind === "message" && entry.message.role === "user") {
pendingUserBoundary = entry.message.createdAt;
continue;
}
const turnId =
entry.kind === "message" && entry.message.role === "assistant"
? (entry.message.turnId ?? null)
: entry.kind === "work"
? (entry.entry.turnId ?? null)
: null;
if (!turnId) {
continue;
}
let group = groupsByTurnId.get(turnId);
if (!group) {
group = {
entries: [],
terminalEntry: null,
hasStreamingMessage: false,
// Each user boundary starts at most one turn; a second turn after the
// same user message (e.g. a steer-superseded continuation) falls back
// to its own first entry.
startBoundary: pendingUserBoundary,
};
pendingUserBoundary = null;
groupsByTurnId.set(turnId, group);
}
group.entries.push(entry);
if (entry.kind === "message") {
if (input.terminalAssistantMessageIds.has(entry.message.id)) {
group.terminalEntry = entry;
}
if (entry.message.streaming) {
group.hasStreamingMessage = true;
}
}
}
const foldsByAnchorEntryId = new Map<string, TurnFold>();
for (const [turnId, group] of groupsByTurnId) {
if (turnId === input.unsettledTurnId) {
continue;
}
if (group.hasStreamingMessage) {
continue;
}
const hiddenEntryIds = new Set<string>();
for (const entry of group.entries) {
if (entry.id !== group.terminalEntry?.id) {
hiddenEntryIds.add(entry.id);
}
}
if (hiddenEntryIds.size === 0) {
continue;
}
const firstEntry = group.entries[0];
const lastEntry = group.entries.at(-1);
if (!firstEntry || !lastEntry) {
continue;
}
const isLatestInterruptedTurn =
input.latestTurn?.turnId === turnId && input.latestTurn.state === "interrupted";
// A turn cut short by a steer leaves trailing work entries behind its
// terminal message — take whichever ended last.
const lastEntryEnd =
lastEntry.kind === "message" ? lastEntry.message.updatedAt : lastEntry.createdAt;
const elapsedMs =
input.latestTurn?.turnId === turnId &&
input.latestTurn.startedAt &&
input.latestTurn.completedAt
? computeElapsedMs(input.latestTurn.startedAt, input.latestTurn.completedAt)
: computeElapsedMs(
group.startBoundary ?? firstEntry.createdAt,
maxIsoTimestamp(group.terminalEntry?.message.updatedAt ?? null, lastEntryEnd) ??
lastEntryEnd,
);
const duration = elapsedMs !== null ? formatDuration(elapsedMs) : null;
const label = isLatestInterruptedTurn
? duration
? `You stopped after ${duration}`
: "You stopped this response"
: duration
? `Worked for ${duration}`
: "Worked";
foldsByAnchorEntryId.set(firstEntry.id, {
turnId,
anchorEntryId: firstEntry.id,
createdAt: firstEntry.createdAt,
hiddenEntryIds,
label,
});
}
return foldsByAnchorEntryId;
}
export function deriveMessagesTimelineRows(input: {
timelineEntries: ReadonlyArray<TimelineEntry>;
latestTurn?: TimelineLatestTurn | null;
runningTurnId?: TurnId | null;
expandedTurnIds?: ReadonlySet<TurnId>;
expandedWorkGroupIds?: ReadonlySet<string>;
isWorking: boolean;
activeTurnStartedAt: string | null;
turnDiffSummaryByAssistantMessageId: ReadonlyMap<MessageId, TurnDiffSummary>;
revertTurnCountByUserMessageId: ReadonlyMap<MessageId, number>;
}): MessagesTimelineRow[] {
const nextRows: MessagesTimelineRow[] = [];
const durationStartByMessageId = computeMessageDurationStart(
input.timelineEntries.flatMap((entry) => (entry.kind === "message" ? [entry.message] : [])),
);
const terminalAssistantMessageIds = deriveTerminalAssistantMessageIds(input.timelineEntries);
const unsettledTurnId = deriveUnsettledTurnId(
input.latestTurn ?? null,
input.runningTurnId ?? null,
);
const foldsByAnchorEntryId = deriveTurnFolds({
timelineEntries: input.timelineEntries,
terminalAssistantMessageIds,
latestTurn: input.latestTurn ?? null,
unsettledTurnId,
});
const collapsedEntryIds = new Set<string>();
for (const fold of foldsByAnchorEntryId.values()) {
if (!input.expandedTurnIds?.has(fold.turnId)) {
for (const entryId of fold.hiddenEntryIds) {
collapsedEntryIds.add(entryId);
}
}
}
for (let index = 0; index < input.timelineEntries.length; index += 1) {
const timelineEntry = input.timelineEntries[index];
if (!timelineEntry) {
continue;
}
const turnFold = foldsByAnchorEntryId.get(timelineEntry.id);
if (turnFold) {
nextRows.push({
kind: "turn-fold",
id: `turn-fold:${turnFold.turnId}`,
createdAt: turnFold.createdAt,
turnId: turnFold.turnId,
label: turnFold.label,
expanded: input.expandedTurnIds?.has(turnFold.turnId) ?? false,
});
}
if (collapsedEntryIds.has(timelineEntry.id)) {
continue;
}
if (timelineEntry.kind === "work") {
const groupedEntries = [timelineEntry.entry];
let cursor = index + 1;
while (cursor < input.timelineEntries.length) {
const nextEntry = input.timelineEntries[cursor];
if (
!nextEntry ||
nextEntry.kind !== "work" ||
collapsedEntryIds.has(nextEntry.id) ||
foldsByAnchorEntryId.has(nextEntry.id)
) {
break;
}
groupedEntries.push(nextEntry.entry);
cursor += 1;
}
const visibleGroupedEntries = groupedEntries.filter(
(entry) => !workEntryIndicatesToolNeutralStatus(entry),
);
if (visibleGroupedEntries.length > 0) {
if (visibleGroupedEntries.length <= MAX_VISIBLE_WORK_LOG_ENTRIES) {
nextRows.push({
kind: "work",
id: timelineEntry.id,
createdAt: timelineEntry.createdAt,
groupedEntries: visibleGroupedEntries,
});
} else {
const groupId = `work-group:${timelineEntry.id}`;
const expanded = input.expandedWorkGroupIds?.has(groupId) ?? false;
const hiddenEntries = visibleGroupedEntries.slice(0, -MAX_VISIBLE_WORK_LOG_ENTRIES);
const visibleEntries = visibleGroupedEntries.slice(-MAX_VISIBLE_WORK_LOG_ENTRIES);
const renderedEntries = expanded ? [...hiddenEntries, ...visibleEntries] : visibleEntries;
for (const workEntry of renderedEntries) {
nextRows.push({
kind: "work",
id: workEntry.id,
createdAt: workEntry.createdAt,
groupedEntries: [workEntry],
});
}
nextRows.push({
kind: "work-toggle",
id: `work-toggle:${timelineEntry.id}`,
createdAt: timelineEntry.createdAt,
groupId,
hiddenCount: hiddenEntries.length,
expanded,
onlyToolEntries: visibleGroupedEntries.every((entry) => workLogEntryIsToolLike(entry)),
});
}
}
index = cursor - 1;
continue;
}
if (timelineEntry.kind === "proposed-plan") {
nextRows.push({
kind: "proposed-plan",
id: timelineEntry.id,
createdAt: timelineEntry.createdAt,
proposedPlan: timelineEntry.proposedPlan,
});
continue;
}
const assistantTurnStillInProgress =
timelineEntry.message.role === "assistant" &&
unsettledTurnId !== null &&
timelineEntry.message.turnId === unsettledTurnId;
const durationStart =
durationStartByMessageId.get(timelineEntry.message.id) ?? timelineEntry.message.createdAt;
// While the turn is still running, the latest assistant message is only
// provisionally terminal — withhold the metadata row until the turn
// settles so commentary doesn't flash timestamps mid-work.
const showAssistantMeta =
timelineEntry.message.role === "assistant" &&
terminalAssistantMessageIds.has(timelineEntry.message.id) &&
!assistantTurnStillInProgress;
nextRows.push({
kind: "message",
id: timelineEntry.id,
createdAt: timelineEntry.createdAt,
message: timelineEntry.message,
durationStart,
showAssistantMeta,
showAssistantCopyButton: showAssistantMeta,
assistantCopyStreaming: timelineEntry.message.streaming || assistantTurnStillInProgress,
assistantTurnDiffSummary:
timelineEntry.message.role === "assistant"
? input.turnDiffSummaryByAssistantMessageId.get(timelineEntry.message.id)
: undefined,
revertTurnCount:
timelineEntry.message.role === "user"
? input.revertTurnCountByUserMessageId.get(timelineEntry.message.id)
: undefined,
});
}
if (input.isWorking) {
nextRows.push({
kind: "working",
id: "working-indicator-row",
createdAt: input.activeTurnStartedAt,
});
}
return nextRows;
}
export function computeStableMessagesTimelineRows(
rows: MessagesTimelineRow[],
previous: StableMessagesTimelineRowsState,
): StableMessagesTimelineRowsState {
const next = new Map<string, MessagesTimelineRow>();
let anyChanged = rows.length !== previous.byId.size;
const result = rows.map((row, index) => {
const prevRow = previous.byId.get(row.id);
const nextRow = prevRow && isRowUnchanged(prevRow, row) ? prevRow : row;
next.set(row.id, nextRow);
if (!anyChanged && previous.result[index] !== nextRow) {
anyChanged = true;
}
return nextRow;
});
return anyChanged ? { byId: next, result } : previous;
}
/** Shallow field comparison per row variant — avoids deep equality cost. */
function isRowUnchanged(a: MessagesTimelineRow, b: MessagesTimelineRow): boolean {
if (a.kind !== b.kind || a.id !== b.id) return false;
switch (a.kind) {
case "working":
return a.createdAt === (b as typeof a).createdAt;
case "turn-fold": {
const bf = b as typeof a;
return a.createdAt === bf.createdAt && a.label === bf.label && a.expanded === bf.expanded;
}
case "proposed-plan":
return a.proposedPlan === (b as typeof a).proposedPlan;
case "work":
return Equal.equals(a.groupedEntries, (b as typeof a).groupedEntries);
case "work-toggle": {
const bw = b as typeof a;
return (
a.createdAt === bw.createdAt &&
a.groupId === bw.groupId &&
a.hiddenCount === bw.hiddenCount &&
a.expanded === bw.expanded &&
a.onlyToolEntries === bw.onlyToolEntries
);
}
case "message": {
const bm = b as typeof a;
return (
a.message === bm.message &&
a.durationStart === bm.durationStart &&
a.showAssistantMeta === bm.showAssistantMeta &&
a.showAssistantCopyButton === bm.showAssistantCopyButton &&
a.assistantCopyStreaming === bm.assistantCopyStreaming &&
a.assistantTurnDiffSummary === bm.assistantTurnDiffSummary &&
a.revertTurnCount === bm.revertTurnCount
);
}
}
}