Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

feat(transcript): include timestamps in copied events (#5873)

Multica Evea767c5b36182
diff --git a/packages/views/common/task-transcript/agent-transcript-dialog.test.tsx b/packages/views/common/task-transcript/agent-transcript-dialog.test.tsx
index 0440486c63..5fdae3c5ec 100644
--- a/packages/views/common/task-transcript/agent-transcript-dialog.test.tsx
+++ b/packages/views/common/task-transcript/agent-transcript-dialog.test.tsx
@@ -10,6 +10,8 @@ import { renderWithI18n } from "../../test/i18n";
import { AgentTranscriptDialog } from "./agent-transcript-dialog";
import type { TimelineItem } from "./build-timeline";
+const copyTextMock = vi.hoisted(() => vi.fn().mockResolvedValue(true));
+
vi.mock("@multica/core/api", () => ({
api: {
getAgent: vi.fn().mockResolvedValue(null),
@@ -17,6 +19,10 @@ vi.mock("@multica/core/api", () => ({
},
}));
+vi.mock("@multica/ui/lib/clipboard", () => ({
+ copyText: copyTextMock,
+}));
+
vi.mock("../actor-avatar", () => ({
ActorAvatar: () => <span data-testid="actor-avatar" />,
}));
@@ -196,6 +202,7 @@ function renderDialog(
beforeEach(() => {
cleanup();
+ copyTextMock.mockClear();
vi.mocked(api.listRuntimes).mockResolvedValue([]);
useTranscriptViewStore.setState({
sortDirection: "chronological",
@@ -292,4 +299,52 @@ describe("AgentTranscriptDialog", () => {
expect(screen.getByText(/Agent hidden detail/)).toBeInTheDocument();
expect(screen.getByText(/"command": "pnpm test"/)).toBeInTheDocument();
});
+
+ it("copies RFC 3339 timestamps before event labels", () => {
+ renderDialog([
+ {
+ seq: 1,
+ type: "text",
+ content: "Agent summary\nAgent hidden detail",
+ created_at: "2026-06-08T08:00:00+08:00",
+ },
+ {
+ seq: 2,
+ type: "thinking",
+ content: "Thinking summary",
+ created_at: "2026-06-08T08:00:05.123Z",
+ },
+ ]);
+
+ fireEvent.click(screen.getByRole("button", { name: "Copy all" }));
+
+ expect(copyTextMock).toHaveBeenCalledWith(
+ [
+ "[2026-06-08T00:00:00.000Z] [Agent] Agent summary",
+ "[2026-06-08T08:00:05.123Z] [Thinking] Thinking summary",
+ ].join("\n"),
+ );
+ });
+
+ it("keeps older events without a valid timestamp copyable", () => {
+ renderDialog([
+ {
+ seq: 1,
+ type: "text",
+ content: "Missing timestamp",
+ },
+ {
+ seq: 2,
+ type: "error",
+ content: "Invalid timestamp",
+ created_at: "not-a-date",
+ },
+ ]);
+
+ fireEvent.click(screen.getByRole("button", { name: "Copy all" }));
+
+ expect(copyTextMock).toHaveBeenCalledWith(
+ ["[Agent] Missing timestamp", "[Error] Invalid timestamp"].join("\n"),
+ );
+ });
});
diff --git a/packages/views/common/task-transcript/agent-transcript-dialog.tsx b/packages/views/common/task-transcript/agent-transcript-dialog.tsx
index ec99f2bb89..da0709eb41 100644
--- a/packages/views/common/task-transcript/agent-transcript-dialog.tsx
+++ b/packages/views/common/task-transcript/agent-transcript-dialog.tsx
@@ -186,6 +186,14 @@ function formatElapsedMs(ms: number): string {
return `${minutes}m ${secs}s`;
}
+function formatEventForClipboard(item: TimelineItem): string {
+ const label = getEventLabel(item);
+ const summary = getEventSummary(item);
+ const date = item.created_at ? new Date(item.created_at) : null;
+ const timestamp = date && !Number.isNaN(date.getTime()) ? `[${date.toISOString()}] ` : "";
+ return `${timestamp}[${label}] ${summary}`;
+}
+
// ─── Main dialog ────────────────────────────────────────────────────────────
export function AgentTranscriptDialog({
@@ -362,11 +370,7 @@ export function AgentTranscriptDialog({
const handleCopyAll = useCallback(() => {
const text = displayItems
- .map((item) => {
- const label = getEventLabel(item);
- const summary = getEventSummary(item);
- return `[${label}] ${summary}`;
- })
+ .map(formatEventForClipboard)
.join("\n");
void copyText(text).then((ok) => {
if (!ok) return;