GeezerVison is showing github.com — feat(web): rework message metadata, timestamps, and tool work log rows · pingdotgg/t3code@245fb15
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: apps/web/src/components/chat/MessageCopyButton.tsx +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -68,11 +68,11 @@ export const MessageCopyButton = memo(function MessageCopyButton({ | 68 | 68 | type="button" | 69 | 69 | size={size} | 70 | 70 | variant={variant} | 71 | | - className={cn(className)} | | 71 | + className={cn("text-muted-foreground hover:text-foreground", className)} | 72 | 72 | /> | 73 | 73 | } | 74 | 74 | > | 75 | | - {isCopied ? <CheckIcon className="size-3 text-success" /> : <CopyIcon className="size-3" />} | | 75 | + {isCopied ? <CheckIcon className="size-3 text-primary" /> : <CopyIcon className="size-3" />} | 76 | 76 | </TooltipTrigger> | 77 | 77 | <TooltipPopup> | 78 | 78 | <p>Copy to clipboard</p> | |
Collapse file Copy file name to clipboardExpand all lines: apps/web/src/components/chat/MessagesTimeline.browser.tsx +6-6Lines changed: 6 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -114,9 +114,9 @@ describe("MessagesTimeline", () => { | 114 | 114 | entry: { | 115 | 115 | id: "work-1", | 116 | 116 | createdAt: "2026-04-13T12:00:00.000Z", | 117 | | - label: "thinking", | | 117 | + label: "read files", | 118 | 118 | detail: "Inspecting repository state", | 119 | | - tone: "thinking", | | 119 | + tone: "tool", | 120 | 120 | }, | 121 | 121 | }, | 122 | 122 | ]} | @@ -127,7 +127,7 @@ describe("MessagesTimeline", () => { | 127 | 127 | await expect | 128 | 128 | .element(page.getByText("Send a message to start the conversation.")) | 129 | 129 | .not.toBeInTheDocument(); | 130 | | - await expect.element(page.getByText("Thinking - Inspecting repository state")).toBeVisible(); | | 130 | + await expect.element(page.getByText("Inspecting repository state")).toBeVisible(); | 131 | 131 | } finally { | 132 | 132 | await screen.unmount(); | 133 | 133 | } | @@ -161,16 +161,16 @@ describe("MessagesTimeline", () => { | 161 | 161 | entry: { | 162 | 162 | id: "work-1", | 163 | 163 | createdAt: "2026-04-13T12:00:00.000Z", | 164 | | - label: "thinking", | | 164 | + label: "read files", | 165 | 165 | detail: "Inspecting repository state", | 166 | | - tone: "thinking", | | 166 | + tone: "tool", | 167 | 167 | }, | 168 | 168 | }, | 169 | 169 | ]} | 170 | 170 | />, | 171 | 171 | ); | 172 | 172 |
| 173 | | - await expect.element(page.getByText("Thinking - Inspecting repository state")).toBeVisible(); | | 173 | + await expect.element(page.getByText("Inspecting repository state")).toBeVisible(); | 174 | 174 | expect(props.onIsAtEndChange).toHaveBeenCalledWith(true); | 175 | 175 | expect(scrollToEndSpy).toHaveBeenCalledWith({ animated: false }); | 176 | 176 | expect(requestAnimationFrameSpy).toHaveBeenCalled(); | |
Collapse file Copy file name to clipboardExpand all lines: apps/web/src/components/chat/MessagesTimeline.logic.test.ts +137-3Lines changed: 137 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -251,6 +251,7 @@ describe("deriveMessagesTimelineRows", () => { | 251 | 251 | }, | 252 | 252 | ], | 253 | 253 | completionDividerBeforeEntryId: "assistant-final-entry", | | 254 | + completionDividerDuration: null, | 254 | 255 | isWorking: false, | 255 | 256 | activeTurnStartedAt: null, | 256 | 257 | turnDiffSummaryByAssistantMessageId: new Map(), | @@ -301,7 +302,7 @@ describe("deriveMessagesTimelineRows", () => { | 301 | 302 | }, | 302 | 303 | ], | 303 | 304 | completionDividerBeforeEntryId: "assistant-two-entry", | 304 | | - completionSummary: "done", | | 305 | + completionDividerDuration: "5m", | 305 | 306 | isWorking: false, | 306 | 307 | activeTurnInProgress: true, | 307 | 308 | activeTurnId: "turn-2" as never, | @@ -316,9 +317,9 @@ describe("deriveMessagesTimelineRows", () => { | 316 | 317 | ); | 317 | 318 |
| 318 | 319 | expect(assistantRows[0]?.assistantCopyStreaming).toBe(false); | 319 | | - expect(assistantRows[0]?.completionSummary).toBeNull(); | | 320 | + expect(assistantRows[0]?.completionDividerDuration).toBeNull(); | 320 | 321 | expect(assistantRows[1]?.assistantCopyStreaming).toBe(true); | 321 | | - expect(assistantRows[1]?.completionSummary).toBe("done"); | | 322 | + expect(assistantRows[1]?.completionDividerDuration).toBe("5m"); | 322 | 323 | }); | 323 | 324 |
| 324 | 325 | it("projects assistant diff summaries and user revert counts onto the affected rows", () => { | @@ -361,6 +362,7 @@ describe("deriveMessagesTimelineRows", () => { | 361 | 362 | }, | 362 | 363 | ], | 363 | 364 | completionDividerBeforeEntryId: null, | | 365 | + completionDividerDuration: null, | 364 | 366 | isWorking: false, | 365 | 367 | activeTurnStartedAt: null, | 366 | 368 | turnDiffSummaryByAssistantMessageId: new Map([ | @@ -381,6 +383,135 @@ describe("deriveMessagesTimelineRows", () => { | 381 | 383 | expect(userRow?.revertTurnCount).toBe(1); | 382 | 384 | expect(assistantRow?.assistantTurnDiffSummary).toBe(assistantTurnDiffSummary); | 383 | 385 | }); | | 386 | + | | 387 | + it("computes the completion divider duration from the current assistant row", () => { | | 388 | + const rows = deriveMessagesTimelineRows({ | | 389 | + timelineEntries: [ | | 390 | + { | | 391 | + id: "user-entry", | | 392 | + kind: "message", | | 393 | + createdAt: "2026-01-01T00:00:00Z", | | 394 | + message: { | | 395 | + id: "user-1" as never, | | 396 | + role: "user", | | 397 | + text: "Build it", | | 398 | + turnId: null, | | 399 | + createdAt: "2026-01-01T00:00:00Z", | | 400 | + streaming: false, | | 401 | + }, | | 402 | + }, | | 403 | + { | | 404 | + id: "assistant-entry", | | 405 | + kind: "message", | | 406 | + createdAt: "2026-01-01T00:00:05Z", | | 407 | + message: { | | 408 | + id: "assistant-1" as never, | | 409 | + role: "assistant", | | 410 | + text: "Done", | | 411 | + turnId: "turn-1" as never, | | 412 | + createdAt: "2026-01-01T00:00:05Z", | | 413 | + completedAt: "2026-01-01T00:00:22Z", | | 414 | + streaming: false, | | 415 | + }, | | 416 | + }, | | 417 | + ], | | 418 | + completionDividerBeforeEntryId: "assistant-entry", | | 419 | + completionDividerDuration: null, | | 420 | + isWorking: false, | | 421 | + activeTurnStartedAt: null, | | 422 | + turnDiffSummaryByAssistantMessageId: new Map(), | | 423 | + revertTurnCountByUserMessageId: new Map(), | | 424 | + }); | | 425 | + | | 426 | + const assistantRow = rows.find( | | 427 | + (row): row is Extract<(typeof rows)[number], { kind: "message" }> => | | 428 | + row.kind === "message" && row.message.role === "assistant", | | 429 | + ); | | 430 | + | | 431 | + expect(assistantRow?.completionDividerDuration).toBe("22s"); | | 432 | + }); | | 433 | + | | 434 | + it("uses the turn-level completion duration for the completion divider", () => { | | 435 | + const rows = deriveMessagesTimelineRows({ | | 436 | + timelineEntries: [ | | 437 | + { | | 438 | + id: "assistant-entry", | | 439 | + kind: "message", | | 440 | + createdAt: "2026-01-01T00:04:44Z", | | 441 | + message: { | | 442 | + id: "assistant-1" as never, | | 443 | + role: "assistant", | | 444 | + text: "Done", | | 445 | + turnId: "turn-1" as never, | | 446 | + createdAt: "2026-01-01T00:04:44Z", | | 447 | + completedAt: "2026-01-01T00:05:00Z", | | 448 | + streaming: false, | | 449 | + }, | | 450 | + }, | | 451 | + ], | | 452 | + completionDividerBeforeEntryId: "assistant-entry", | | 453 | + completionDividerDuration: "5m", | | 454 | + isWorking: false, | | 455 | + activeTurnStartedAt: null, | | 456 | + turnDiffSummaryByAssistantMessageId: new Map(), | | 457 | + revertTurnCountByUserMessageId: new Map(), | | 458 | + }); | | 459 | + | | 460 | + const assistantRow = rows.find( | | 461 | + (row): row is Extract<(typeof rows)[number], { kind: "message" }> => | | 462 | + row.kind === "message" && row.message.role === "assistant", | | 463 | + ); | | 464 | + | | 465 | + expect(assistantRow?.completionDividerDuration).toBe("5m"); | | 466 | + }); | | 467 | + | | 468 | + it("only shows assistant metadata on the terminal assistant message", () => { | | 469 | + const rows = deriveMessagesTimelineRows({ | | 470 | + timelineEntries: [ | | 471 | + { | | 472 | + id: "assistant-thought-entry", | | 473 | + kind: "message", | | 474 | + createdAt: "2026-01-01T00:00:10Z", | | 475 | + message: { | | 476 | + id: "assistant-thought" as never, | | 477 | + role: "assistant", | | 478 | + text: "Checking first.", | | 479 | + turnId: "turn-1" as never, | | 480 | + createdAt: "2026-01-01T00:00:10Z", | | 481 | + completedAt: "2026-01-01T00:00:11Z", | | 482 | + streaming: false, | | 483 | + }, | | 484 | + }, | | 485 | + { | | 486 | + id: "assistant-final-entry", | | 487 | + kind: "message", | | 488 | + createdAt: "2026-01-01T00:00:20Z", | | 489 | + message: { | | 490 | + id: "assistant-final" as never, | | 491 | + role: "assistant", | | 492 | + text: "Done.", | | 493 | + turnId: "turn-1" as never, | | 494 | + createdAt: "2026-01-01T00:00:20Z", | | 495 | + completedAt: "2026-01-01T00:00:30Z", | | 496 | + streaming: false, | | 497 | + }, | | 498 | + }, | | 499 | + ], | | 500 | + completionDividerBeforeEntryId: null, | | 501 | + completionDividerDuration: null, | | 502 | + isWorking: false, | | 503 | + activeTurnStartedAt: null, | | 504 | + turnDiffSummaryByAssistantMessageId: new Map(), | | 505 | + revertTurnCountByUserMessageId: new Map(), | | 506 | + }); | | 507 | + | | 508 | + const assistantRows = rows.filter( | | 509 | + (row): row is Extract<(typeof rows)[number], { kind: "message" }> => | | 510 | + row.kind === "message" && row.message.role === "assistant", | | 511 | + ); | | 512 | + | | 513 | + expect(assistantRows.map((row) => row.showAssistantMeta)).toEqual([false, true]); | | 514 | + }); | 384 | 515 | }); | 385 | 516 |
| 386 | 517 | describe("computeStableMessagesTimelineRows", () => { | @@ -418,6 +549,7 @@ describe("computeStableMessagesTimelineRows", () => { | 418 | 549 | }, | 419 | 550 | ], | 420 | 551 | completionDividerBeforeEntryId: null, | | 552 | + completionDividerDuration: null, | 421 | 553 | isWorking: false, | 422 | 554 | activeTurnStartedAt: null, | 423 | 555 | turnDiffSummaryByAssistantMessageId: new Map(), | @@ -468,6 +600,7 @@ describe("computeStableMessagesTimelineRows", () => { | 468 | 600 | }, | 469 | 601 | ], | 470 | 602 | completionDividerBeforeEntryId: null, | | 603 | + completionDividerDuration: null, | 471 | 604 | isWorking: false, | 472 | 605 | activeTurnStartedAt: null, | 473 | 606 | turnDiffSummaryByAssistantMessageId: new Map(), | @@ -523,6 +656,7 @@ describe("computeStableMessagesTimelineRows", () => { | 523 | 656 | }, | 524 | 657 | ], | 525 | 658 | completionDividerBeforeEntryId: null, | | 659 | + completionDividerDuration: null, | 526 | 660 | isWorking: false, | 527 | 661 | activeTurnStartedAt: null, | 528 | 662 | turnDiffSummaryByAssistantMessageId: new Map(), | |
Collapse file Copy file name to clipboardExpand all lines: apps/web/src/components/chat/MessagesTimeline.logic.ts +38-11Lines changed: 38 additions & 11 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | import * as Equal from "effect/Equal"; | 2 | | -import { type TimelineEntry, type WorkLogEntry } from "../../session-logic"; | | 2 | +import { formatDuration, type TimelineEntry, type WorkLogEntry } from "../../session-logic"; | 3 | 3 | import { type ChatMessage, type ProposedPlan, type TurnDiffSummary } from "../../types"; | 4 | 4 | import { type MessageId, type TurnId } from "@t3tools/contracts"; | 5 | 5 |
| 6 | | -export const MAX_VISIBLE_WORK_LOG_ENTRIES = 6; | | 6 | +export const MAX_VISIBLE_WORK_LOG_ENTRIES = 1; | | 7 | + | | 8 | +function computeElapsedMs(startIso: string, endIso: string): number | null { | | 9 | + const start = Date.parse(startIso); | | 10 | + const end = Date.parse(endIso); | | 11 | + if (!Number.isFinite(start) || !Number.isFinite(end)) return null; | | 12 | + return Math.max(0, end - start); | | 13 | +} | 7 | 14 |
| 8 | 15 | export interface TimelineDurationMessage { | 9 | 16 | id: string; | @@ -26,7 +33,8 @@ export type MessagesTimelineRow = | 26 | 33 | message: ChatMessage; | 27 | 34 | durationStart: string; | 28 | 35 | showCompletionDivider: boolean; | 29 | | - completionSummary: string | null; | | 36 | + completionDividerDuration?: string | null; | | 37 | + showAssistantMeta: boolean; | 30 | 38 | showAssistantCopyButton: boolean; | 31 | 39 | assistantCopyStreaming: boolean; | 32 | 40 | assistantTurnDiffSummary?: TurnDiffSummary | undefined; | @@ -113,7 +121,7 @@ function deriveTerminalAssistantMessageIds(timelineEntries: ReadonlyArray<Timeli | 113 | 121 | export function deriveMessagesTimelineRows(input: { | 114 | 122 | timelineEntries: ReadonlyArray<TimelineEntry>; | 115 | 123 | completionDividerBeforeEntryId: string | null; | 116 | | - completionSummary?: string | null; | | 124 | + completionDividerDuration: string | null; | 117 | 125 | isWorking: boolean; | 118 | 126 | activeTurnInProgress?: boolean; | 119 | 127 | activeTurnId?: TurnId | null; | @@ -171,19 +179,36 @@ export function deriveMessagesTimelineRows(input: { | 171 | 179 | const showCompletionDivider = | 172 | 180 | timelineEntry.message.role === "assistant" && | 173 | 181 | input.completionDividerBeforeEntryId === timelineEntry.id; | | 182 | + const durationStart = | | 183 | + durationStartByMessageId.get(timelineEntry.message.id) ?? timelineEntry.message.createdAt; | | 184 | + | | 185 | + let completionDividerDuration: string | null = null; | | 186 | + if (showCompletionDivider) { | | 187 | + if (input.completionDividerDuration) { | | 188 | + completionDividerDuration = input.completionDividerDuration; | | 189 | + } else { | | 190 | + const start = durationStart; | | 191 | + const end = timelineEntry.message.completedAt ?? timelineEntry.message.createdAt; | | 192 | + const elapsed = computeElapsedMs(start, end); | | 193 | + if (elapsed !== null) { | | 194 | + completionDividerDuration = formatDuration(elapsed); | | 195 | + } | | 196 | + } | | 197 | + } | | 198 | + | | 199 | + const showAssistantMeta = | | 200 | + timelineEntry.message.role === "assistant" && | | 201 | + terminalAssistantMessageIds.has(timelineEntry.message.id); | 174 | 202 |
| 175 | 203 | nextRows.push({ | 176 | 204 | kind: "message", | 177 | 205 | id: timelineEntry.id, | 178 | 206 | createdAt: timelineEntry.createdAt, | 179 | 207 | message: timelineEntry.message, | 180 | | - durationStart: | 181 | | - durationStartByMessageId.get(timelineEntry.message.id) ?? timelineEntry.message.createdAt, | | 208 | + durationStart, | 182 | 209 | showCompletionDivider, | 183 | | - completionSummary: showCompletionDivider ? (input.completionSummary ?? null) : null, | 184 | | - showAssistantCopyButton: | 185 | | - timelineEntry.message.role === "assistant" && | 186 | | - terminalAssistantMessageIds.has(timelineEntry.message.id), | | 210 | + showAssistantMeta, | | 211 | + showAssistantCopyButton: showAssistantMeta, | 187 | 212 | assistantCopyStreaming: timelineEntry.message.streaming || assistantTurnStillInProgress, | 188 | 213 | assistantTurnDiffSummary: | 189 | 214 | timelineEntry.message.role === "assistant" | @@ -193,6 +218,7 @@ export function deriveMessagesTimelineRows(input: { | 193 | 218 | timelineEntry.message.role === "user" | 194 | 219 | ? input.revertTurnCountByUserMessageId.get(timelineEntry.message.id) | 195 | 220 | : undefined, | | 221 | + completionDividerDuration, | 196 | 222 | }); | 197 | 223 | } | 198 | 224 |
| @@ -247,7 +273,8 @@ function isRowUnchanged(a: MessagesTimelineRow, b: MessagesTimelineRow): boolean | 247 | 273 | a.message === bm.message && | 248 | 274 | a.durationStart === bm.durationStart && | 249 | 275 | a.showCompletionDivider === bm.showCompletionDivider && | 250 | | - a.completionSummary === bm.completionSummary && | | 276 | + a.completionDividerDuration === bm.completionDividerDuration && | | 277 | + a.showAssistantMeta === bm.showAssistantMeta && | 251 | 278 | a.showAssistantCopyButton === bm.showAssistantCopyButton && | 252 | 279 | a.assistantCopyStreaming === bm.assistantCopyStreaming && | 253 | 280 | a.assistantTurnDiffSummary === bm.assistantTurnDiffSummary && | |
Collapse file Copy file name to clipboardExpand all lines: apps/web/src/components/chat/MessagesTimeline.test.tsx +28-1Lines changed: 28 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -228,7 +228,7 @@ describe("MessagesTimeline", () => { | 228 | 228 | ); | 229 | 229 |
| 230 | 230 | expect(markup).toContain("Context compacted"); | 231 | | - expect(markup).toContain("Work log"); | | 231 | + expect(markup).toContain("work log"); | 232 | 232 | }); | 233 | 233 |
| 234 | 234 | it("formats changed file paths from the workspace root", async () => { | @@ -296,4 +296,31 @@ describe("MessagesTimeline", () => { | 296 | 296 | expect(markup).not.toContain("<review_comment"); | 297 | 297 | expect(markup).not.toContain("</review_comment>"); | 298 | 298 | }); | | 299 | + | | 300 | + it("renders a failure marker for failed tool lifecycle entries", async () => { | | 301 | + const { MessagesTimeline } = await import("./MessagesTimeline"); | | 302 | + const markup = renderToStaticMarkup( | | 303 | + <MessagesTimeline | | 304 | + {...buildProps()} | | 305 | + timelineEntries={[ | | 306 | + { | | 307 | + id: "entry-1", | | 308 | + kind: "work", | | 309 | + createdAt: "2026-03-17T19:12:28.000Z", | | 310 | + entry: { | | 311 | + id: "work-1", | | 312 | + createdAt: "2026-03-17T19:12:28.000Z", | | 313 | + label: "Glob", | | 314 | + tone: "tool", | | 315 | + toolLifecycleStatus: "failed", | | 316 | + detail: "No files found", | | 317 | + }, | | 318 | + }, | | 319 | + ]} | | 320 | + />, | | 321 | + ); | | 322 | + | | 323 | + expect(markup).toContain("lucide-x"); | | 324 | + expect(markup).toContain('aria-label="Tool call failed"'); | | 325 | + }); | 299 | 326 | }); |
|