fix: update logline prefix to use timestamp (#23966)

This change replaces the line number display in agent logs with formatted timestamps. The `AgentLogLine` component now shows timestamps in `HH:mm:ss.SSS` format using dayjs instead of sequential line numbers. The component no longer requires `number` and `maxLineNumber` props, and the associated styling for line number formatting has been removed.

This is a global change.. but I don't think its one that will do much damage.
This commit is contained in:
Jake Howell
2026-04-07 04:43:35 +10:00
committed by GitHub
parent 8bb48ffdda
commit df8f695e84
2 changed files with 5 additions and 24 deletions
@@ -1,5 +1,5 @@
import type { Interpolation, Theme } from "@emotion/react";
import AnsiToHTML from "ansi-to-html";
import dayjs from "dayjs";
import { type FC, type ReactNode, useMemo } from "react";
import { type Line, LogLine, LogLinePrefix } from "#/components/Logs/LogLine";
// Approximate height of a log line. Used to control virtualized list height.
@@ -9,34 +9,26 @@ const convert = new AnsiToHTML();
interface AgentLogLineProps {
line: Line;
number: number;
style: React.CSSProperties;
sourceIcon: ReactNode;
maxLineNumber: number;
}
export const AgentLogLine: FC<AgentLogLineProps> = ({
line,
number,
maxLineNumber,
sourceIcon,
style,
}) => {
const output = useMemo(() => {
return convert.toHtml(line.output.split(/\r/g).pop() as string);
}, [line.output]);
const timestamp = useMemo(() => {
return dayjs(line.time).format("HH:mm:ss.SSS");
}, [line.time]);
return (
<LogLine className="pl-4" level={line.level} style={style}>
{sourceIcon}
<LogLinePrefix
css={styles.number}
style={{
minWidth: `${maxLineNumber.toString().length - 1}em`,
}}
>
{number}
</LogLinePrefix>
<LogLinePrefix>{timestamp}</LogLinePrefix>
<span
// biome-ignore lint/security/noDangerouslySetInnerHtml: Output contains HTML to represent ANSI-code formatting
dangerouslySetInnerHTML={{
@@ -46,12 +38,3 @@ export const AgentLogLine: FC<AgentLogLineProps> = ({
</LogLine>
);
};
const styles = {
number: (theme) => ({
width: 32,
textAlign: "right",
flexShrink: 0,
color: theme.palette.text.disabled,
}),
} satisfies Record<string, Interpolation<Theme>>;
@@ -124,8 +124,6 @@ export const AgentLogs: React.FC<AgentLogsProps> = ({
return (
<AgentLogLine
line={log}
number={index + 1}
maxLineNumber={logs.length}
style={style}
sourceIcon={
<Tooltip>