Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

feat(chat): show message timestamp in bubble toolbar

vastsabebfb188b25b
diff --git a/apps/desktop/src/features/chat/transcript/AssistantTurn.tsx b/apps/desktop/src/features/chat/transcript/AssistantTurn.tsx
index bf1ed0d40..a9231bfa7 100644
--- a/apps/desktop/src/features/chat/transcript/AssistantTurn.tsx
+++ b/apps/desktop/src/features/chat/transcript/AssistantTurn.tsx
@@ -41,6 +41,7 @@ import {
AssistantErrorMessage,
CopyButton,
MessageMeta,
+ MessageTimestamp,
} from "./shared";
import { activityItemsEqual, ActivityGroup } from "./ActivityGroup";
import { GeneratedImages } from "./GeneratedImages";
@@ -422,6 +423,7 @@ export const AssistantTurn = memo(function AssistantTurn({
) : null}
{complete && actionMessage ? (
<div className="message-actions">
+ <MessageTimestamp createdAt={actionMessage.createdAt} />
<CopyButton text={content} label={t("chat.copy")} />
<TooltipButton
className="copy-btn icon"
diff --git a/apps/desktop/src/features/chat/transcript/MessageRow.tsx b/apps/desktop/src/features/chat/transcript/MessageRow.tsx
index d13d51b4f..71eeae060 100644
--- a/apps/desktop/src/features/chat/transcript/MessageRow.tsx
+++ b/apps/desktop/src/features/chat/transcript/MessageRow.tsx
@@ -26,6 +26,7 @@ import {
FileRefChip,
LinkifiedText,
MessageAttachmentImage,
+ MessageTimestamp,
} from "./shared";
import {
useChatTextActions,
@@ -272,6 +273,7 @@ export const MessageRow = memo(function MessageRow({
) : null}
{!editing && (hasAnswer || showRevisionPager) ? (
<div className="message-actions">
+ <MessageTimestamp createdAt={message.createdAt} />
{showRevisionPager ? (
<div className="message-revision-pager" role="group" aria-label={t("chat.revisions")}>
<TooltipButton
diff --git a/apps/desktop/src/features/chat/transcript/shared.tsx b/apps/desktop/src/features/chat/transcript/shared.tsx
index fc92315fe..e3aac5853 100644
--- a/apps/desktop/src/features/chat/transcript/shared.tsx
+++ b/apps/desktop/src/features/chat/transcript/shared.tsx
@@ -70,6 +70,50 @@ export function useMessageRevealRequest(messageId: string) {
: undefined;
}
+
+/**
+ * Format a message timestamp for the toolbar.
+ * Today → HH:mm:ss; other days → YYYY-MM-DD HH:mm:ss.
+ */
+function formatMessageTime(iso: string, locale: string): string {
+ const date = new Date(iso);
+ if (Number.isNaN(date.getTime())) return "";
+ const now = new Date();
+ const isToday =
+ date.getFullYear() === now.getFullYear() &&
+ date.getMonth() === now.getMonth() &&
+ date.getDate() === now.getDate();
+ if (isToday) {
+ return date.toLocaleTimeString(locale, {
+ hour: "2-digit",
+ minute: "2-digit",
+ second: "2-digit",
+ hour12: false,
+ });
+ }
+ return date.toLocaleString(locale, {
+ year: "numeric",
+ month: "2-digit",
+ day: "2-digit",
+ hour: "2-digit",
+ minute: "2-digit",
+ second: "2-digit",
+ hour12: false,
+ });
+}
+
+export function MessageTimestamp({ createdAt }: { createdAt?: string }) {
+ const { i18n } = useTranslation();
+ if (!createdAt) return null;
+ const display = formatMessageTime(createdAt, i18n.language);
+ if (!display) return null;
+ return (
+ <span className="message-timestamp" title={createdAt}>
+ {display}
+ </span>
+ );
+}
+
export function CopyButton({
text,
label,
diff --git a/apps/desktop/src/styles/messages.css b/apps/desktop/src/styles/messages.css
index f63e39c14..c2a9d1c56 100644
--- a/apps/desktop/src/styles/messages.css
+++ b/apps/desktop/src/styles/messages.css
@@ -1006,6 +1006,16 @@
opacity: 1;
}
+.message-timestamp {
+ font-size: var(--text-xs);
+ color: var(--ds-text-muted);
+ line-height: var(--leading-compact);
+ white-space: nowrap;
+ user-select: none;
+ padding: 0 4px;
+ align-self: center;
+}
+
.icon-btn:active:not(:disabled),
.title-nav-btn:active:not(:disabled),
.nav-item:active:not(:disabled),