The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 19:30 UTC
feat: show automation messages as compact timeline rows (#22638)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 21, 2026 at 12:25 UTC
d27c6067a9162150f654e38f455a7a936ef79178
4 files changed
+397
-43
apps/mobile/src/components/ui/AppSymbol.tsx
+2
@@ -9,6 +9,7 @@ import IconAlertCircle from "@tabler/icons-react-native/IconAlertCircle";
9
import IconAlertTriangle from "@tabler/icons-react-native/IconAlertTriangle";
10
import IconApps from "@tabler/icons-react-native/IconApps";
11
import IconArchive from "@tabler/icons-react-native/IconArchive";
12
+import IconCalendarClock from "@tabler/icons-react-native/IconCalendarClock";
13
import IconArrowBackUp from "@tabler/icons-react-native/IconArrowBackUp";
14
import IconArrowDown from "@tabler/icons-react-native/IconArrowDown";
15
import IconArrowForwardUp from "@tabler/icons-react-native/IconArrowForwardUp";
@@ -178,6 +179,7 @@ const ANDROID_ICON_BY_SF_SYMBOL = {
179
"circle.dashed": IconCircleDashed,
180
"circle.inset.filled": IconCircleDot,
181
"circle.dashed.inset.filled": IconCircleDot,
182
+ "calendar.badge.clock": IconCalendarClock,
183
clock: IconClock,
184
timer: IconClock,
185
ticket: IconTicket,
apps/mobile/src/features/threads/ThreadFeed.tsx
+151
-6
@@ -40,6 +40,7 @@ import {
40
type MessageId,
41
type OrchestrationV2ProjectedTurnItem,
42
type RunId,
43
+ type ScheduledTaskId,
44
} from "@t3tools/contracts";
45
import { renderAssistantCitationsAsText } from "@t3tools/shared/assistantCitations";
46
import { encodeComposerContextFragment } from "@t3tools/shared/composerContextClipboard";
@@ -236,6 +237,8 @@ import {
237
} from "@t3tools/client-runtime/workspace-basename-lookup";
238
import { useLiveThreadLinkLabels } from "../../state/entities";
239
import { useThreadSelection } from "../../state/use-thread-selection";
240
+import { useEnvironmentQuery } from "../../state/query";
241
+import { serverEnvironment } from "../../state/server";
242
import { composerDocumentAttachmentRecord } from "../../lib/composerContext";
243
import * as Option from "effect/Option";
244
import { appAtomRegistry } from "../../state/atom-registry";
@@ -983,6 +986,125 @@ function AgentMessageAttribution(props: {
986
);
987
}
988
989
+/** Automation prompts are long, repeated runbooks; a folded bubble keeps them out of the way. */
990
+function ThreadAutomationMessageRow(props: {
991
+ readonly environmentId: EnvironmentId;
992
+ readonly text: string;
993
+ readonly context?: OrchestrationMessageContext;
994
+ readonly scheduledTaskId: ScheduledTaskId | undefined;
995
+ readonly timestampLabel: string;
996
+ readonly expanded: boolean;
997
+ readonly onToggle: () => void;
998
+ readonly bubbleColor: ColorValue;
999
+ readonly bubbleMaxWidth: number | "85%";
1000
+ readonly contentMaxWidth: number;
1001
+ readonly iconSubtleColor: ColorValue;
1002
+ readonly markdownStyles: MarkdownStyleSet;
1003
+ readonly reviewCommentColors: ReviewCommentColors;
1004
+ readonly skills?: ReadonlyArray<SelectableMarkdownSkill>;
1005
+ readonly linkHandlers: MarkdownLinkHandlers;
1006
+ readonly renderImage: MarkdownImageRenderer;
1007
+}) {
1008
+ const navigation = useNavigation();
1009
+ const tasks = useEnvironmentQuery(
1010
+ props.scheduledTaskId
1011
+ ? serverEnvironment.scheduledTasksLive({ environmentId: props.environmentId, input: {} })
1012
+ : null,
1013
+ );
1014
+ const taskTitle = tasks.data?.tasks.find((task) => task.id === props.scheduledTaskId)?.title;
1015
+ const summary = taskTitle ?? props.text.trim().split(/\r?\n/, 1)[0] ?? "";
1016
+
1017
+ return (
1018
+ <View className="mb-5 items-end">
1019
+ <View
1020
+ className="min-w-0 rounded-[20px]"
1021
+ style={{
1022
+ backgroundColor: props.bubbleColor,
1023
+ maxWidth: props.bubbleMaxWidth,
1024
+ ...(props.expanded ? { width: props.bubbleMaxWidth } : null),
1025
+ }}
1026
+ >
1027
+ <Pressable
1028
+ accessibilityRole="button"
1029
+ accessibilityLabel={`Automation: ${summary}`}
1030
+ accessibilityHint={`Double tap to ${props.expanded ? "hide" : "show"} the prompt.`}
1031
+ accessibilityState={{ expanded: props.expanded }}
1032
+ hitSlop={4}
1033
+ className="min-h-10 flex-row items-center gap-1.5 px-3.5 py-2"
1034
+ onPress={() => {
1035
+ void Haptics.selectionAsync();
1036
+ props.onToggle();
1037
+ }}
1038
+ >
1039
+ <SymbolView
1040
+ name="calendar.badge.clock"
1041
+ size={14}
1042
+ weight="medium"
1043
+ tintColorClassName="accent-user-bubble-foreground-muted"
1044
+ type="monochrome"
1045
+ />
1046
+ <Text className="font-t3-medium text-sm text-user-bubble-foreground-muted">
1047
+ Automation
1048
+ </Text>
1049
+ <Text numberOfLines={1} className="min-w-0 shrink text-sm text-user-bubble-foreground">
1050
+ {summary}
1051
+ </Text>
1052
+ <ThreadDisclosureChevron
1053
+ expanded={props.expanded}
1054
+ collapsedDirection="down"
1055
+ size={11}
1056
+ tintColor={props.iconSubtleColor}
1057
+ />
1058
+ </Pressable>
1059
+ {props.expanded ? (
1060
+ <View className="px-3.5 pb-2.5">
1061
+ <MarkdownImageAvailableWidthContext value={props.contentMaxWidth}>
1062
+ <UserMessageContent
1063
+ text={renderAssistantCitationsAsText(props.text)}
1064
+ environmentId={props.environmentId}
1065
+ context={props.context}
1066
+ markdownStyles={props.markdownStyles}
1067
+ reviewCommentColors={props.reviewCommentColors}
1068
+ skills={props.skills}
1069
+ linkHandlers={props.linkHandlers}
1070
+ renderImage={props.renderImage}
1071
+ />
1072
+ </MarkdownImageAvailableWidthContext>
1073
+ </View>
1074
+ ) : null}
1075
+ </View>
1076
+ {props.expanded ? (
1077
+ <View className="mt-1 flex-row items-center justify-end gap-2 pr-0.5">
1078
+ {props.scheduledTaskId ? (
1079
+ <Pressable
1080
+ accessibilityRole="link"
1081
+ hitSlop={6}
1082
+ onPress={() =>
1083
+ navigation.navigate("SettingsSheet", {
1084
+ screen: "SettingsContent",
1085
+ params: { screen: "SettingsScheduledTasks" },
1086
+ })
1087
+ }
1088
+ >
1089
+ <Text className="font-t3-medium text-xs text-foreground-secondary">
1090
+ Open automation
1091
+ </Text>
1092
+ </Pressable>
1093
+ ) : null}
1094
+ <Text className="font-t3-medium text-xs tabular-nums text-foreground-secondary">
1095
+ {props.timestampLabel}
1096
+ </Text>
1097
+ <UserMessageCopyButton
1098
+ text={props.text}
1099
+ onCopy={undefined}
1100
+ tintColor={props.iconSubtleColor}
1101
+ />
1102
+ </View>
1103
+ ) : null}
1104
+ </View>
1105
+ );
1106
+}
1107
+
1108
function renderFeedEntry(
1109
info: { item: PendingThreadFeedEntry; index: number },
1110
props: Pick<
@@ -1200,6 +1322,29 @@ function renderFeedEntry(
1322
/>
1323
);
1324
}
1325
+ if (isUser && presentation.attribution === "automation") {
1326
+ const rowId = `automation:${message.id}`;
1327
+ return (
1328
+ <ThreadAutomationMessageRow
1329
+ environmentId={props.environmentId}
1330
+ text={presentation.text}
1331
+ context={message.context}
1332
+ scheduledTaskId={presentation.scheduledTaskId}
1333
+ timestampLabel={timestampLabel}
1334
+ expanded={props.expandedWorkRows[rowId] ?? false}
1335
+ onToggle={() => props.onToggleWorkRow(rowId, entry.id)}
1336
+ bubbleColor={userBubbleColor}
1337
+ bubbleMaxWidth={props.duoColumns ? "85%" : props.userBubbleMaxWidth}
1338
+ contentMaxWidth={props.userBubbleMaxWidth - USER_BUBBLE_HORIZONTAL_PADDING * 2}
1339
+ iconSubtleColor={iconSubtleColor}
1340
+ markdownStyles={markdownStyles.user}
1341
+ reviewCommentColors={props.reviewCommentColors}
1342
+ skills={props.skills}
1343
+ linkHandlers={props.markdownLinkHandlers}
1344
+ renderImage={props.renderMarkdownImage}
1345
+ />
1346
+ );
1347
+ }
1348
if (isUser) {
1349
const enterAnimated = isFreshTimestamp(message.createdAt);
1350
const intentBadge = resolveUserMessageIntentBadge(message.inputIntent);
@@ -1221,11 +1366,7 @@ function renderFeedEntry(
1366
className="mb-5 items-end"
1367
{...(enterAnimated ? { entering: FadeInUp.duration(220) } : {})}
1368
>
1224
- {presentation.attribution === "automation" ? (
1225
- <Text className="mb-1 pr-1 font-t3-medium text-2xs text-foreground-muted opacity-60">
1226
- Sent by automation
1227
- </Text>
1228
- ) : presentation.attribution === "t3code" ? (
1369
+ {presentation.attribution === "t3code" ? (
1370
<Text className="mb-1 pr-1 font-t3-medium text-2xs text-foreground-muted opacity-60">
1371
Sent by T3 Code
1372
</Text>
@@ -2739,7 +2880,11 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
2880
viewabilityConfig={THREAD_MEDIA_VIEWABILITY_CONFIG}
2881
keyExtractor={(entry) => entry.id}
2882
getItemType={(entry) =>
2742
- entry.type === "message" ? `message:${entry.message.role}` : entry.type
2883
+ entry.type !== "message"
2884
+ ? entry.type
2885
+ : resolveUserMessagePresentation(entry.message).attribution === "automation"
2886
+ ? "message:automation"
2887
+ : `message:${entry.message.role}`
2888
}
2889
getFixedItemSize={getFixedItemSize}
2890
// Virtualized rows must move with their measurements. Native layout
apps/web/src/components/chat/MessagesTimeline.browser.test.tsx
+105
-4
@@ -1,4 +1,4 @@
1
-import { EnvironmentId, MessageId } from "@t3tools/contracts";
1
+import { EnvironmentId, MessageId, RunId, ScheduledTaskId } from "@t3tools/contracts";
2
import type { LegendListRef } from "@legendapp/list/react";
3
import { createRef, type ComponentProps, type ReactElement } from "react";
4
import { describe, expect, it, vi } from "vite-plus/test";
@@ -9,14 +9,18 @@ import { act, render } from "../../../test/render";
9
import { MessagesTimeline } from "./MessagesTimeline";
10
import { remarkThoughtPreview } from "./TimelineWorkEntryRow.logic";
11
import { parseMarkdownWithMath } from "@t3tools/shared/markdownMath";
12
+import { collectThreadFindRanges } from "./threadFindHighlights";
13
13
-const pullRequestQuery = vi.hoisted(() => ({ error: "Pull request not found" }));
14
+const environmentQuery = vi.hoisted(() => ({
15
+ error: "Pull request not found",
16
+ data: null as unknown,
17
+}));
18
vi.mock(import("~/state/query"), async (original) => ({
19
...(await original()),
20
useEnvironmentQuery: (() => ({
17
- data: null,
21
+ data: environmentQuery.data,
22
dataUpdatedAt: 0,
19
- error: pullRequestQuery.error,
23
+ error: environmentQuery.error,
24
failure: null,
25
isPending: false,
26
isSuccess: false,
@@ -117,6 +121,13 @@ async function click(element: HTMLElement) {
121
await act(async () => element.click());
122
}
123
124
+function setup({ scheduledTasks = [] as ReadonlyArray<{ id: string; title: string }> } = {}) {
125
+ environmentQuery.data = { tasks: scheduledTasks };
126
+}
127
+
128
+const TASK_ID = ScheduledTaskId.make("task-1");
129
+const AUTOMATION_PROMPT = "Triage the inbox\n\nLabel every new issue and close duplicates.";
130
+
131
describe("MessagesTimeline messages", () => {
132
it("preserves XML-like tags and comparisons in user messages as text", async () => {
133
const source = [
@@ -164,6 +175,96 @@ describe("MessagesTimeline messages", () => {
175
});
176
});
177
178
+describe("MessagesTimeline automation prompts", () => {
179
+ it("folds an automation prompt into a bubble titled by its task", async () => {
180
+ setup({ scheduledTasks: [{ id: TASK_ID, title: "Nightly triage" }] });
181
+ await using screen = await renderTimeline([
182
+ message(AUTOMATION_PROMPT, { scheduledTaskId: TASK_ID }),
183
+ ]);
184
+ const row = screen.button(/^Automation/);
185
+ expect(row.textContent).toContain("Nightly triage");
186
+ expect(row.getAttribute("aria-expanded")).toBe("false");
187
+ expect(screen.text()).not.toContain("close duplicates");
188
+
189
+ await click(row);
190
+ expect(screen.text()).toContain("Label every new issue and close duplicates.");
191
+ const link = [...screen.container.querySelectorAll("a")].find(
192
+ (anchor) => anchor.textContent === "Open automation",
193
+ );
194
+ expect(link?.getAttribute("href")).toContain(`taskId=${TASK_ID}`);
195
+ expect(screen.buttons(/copy/i)).not.toHaveLength(0);
196
+ });
197
+
198
+ it("falls back to the prompt's first line without a task title", async () => {
199
+ setup();
200
+ await using screen = await renderTimeline([
201
+ message(AUTOMATION_PROMPT, { scheduledTaskId: TASK_ID }),
202
+ ]);
203
+ expect(screen.button(/^Automation/).textContent).toContain("Triage the inbox");
204
+ });
205
+
206
+ it("leaves ordinary user messages as full bubbles", async () => {
207
+ setup();
208
+ await using screen = await renderTimeline([message(AUTOMATION_PROMPT)]);
209
+ expect(screen.buttons(/^Automation/)).toHaveLength(0);
210
+ expect(screen.text()).toContain("Label every new issue and close duplicates.");
211
+ });
212
+
213
+ it("reveals a find match beyond the folded automation prompt's initial viewport", async () => {
214
+ setup();
215
+ const prompt = `${"Inspect the next item.\n\n".repeat(16)}Close duplicates.`;
216
+ await using screen = await renderTimeline([message(prompt, { scheduledTaskId: TASK_ID })], {
217
+ findExpanded: true,
218
+ findQuery: "duplicates",
219
+ activeFindMatch: { entryId: "entry-message-1", runId: null, occurrence: 0 },
220
+ });
221
+ await vi.waitFor(() =>
222
+ expect(screen.button(/^Automation/).getAttribute("aria-expanded")).toBe("true"),
223
+ );
224
+ const { range } = collectThreadFindRanges(screen.container, "duplicates")[0]!;
225
+ const details = screen.container.querySelector("[data-thread-find-text]")!;
226
+ expect(range.getBoundingClientRect().top - details.getBoundingClientRect().top).toBeGreaterThan(
227
+ 384,
228
+ );
229
+ expect(range.getBoundingClientRect().bottom).toBeLessThanOrEqual(
230
+ details.getBoundingClientRect().bottom,
231
+ );
232
+ });
233
+
234
+ it("shows edit-from-here once an automation prompt is expanded", async () => {
235
+ setup();
236
+ const runId = RunId.make("run-1");
237
+ await using screen = await renderTimeline(
238
+ [
239
+ message(
240
+ AUTOMATION_PROMPT,
241
+ { scheduledTaskId: TASK_ID, runId, inputIntent: "turn_start" },
242
+ "user-1",
243
+ ),
244
+ message("Done", { role: "assistant", runId }, "assistant-1"),
245
+ ],
246
+ {
247
+ supportsConversationRollback: true,
248
+ threadStartCheckpointReady: true,
249
+ turnDiffSummaries: [
250
+ {
251
+ runId,
252
+ checkpointTurnCount: 1,
253
+ checkpointRef: "checkpoint-1" as never,
254
+ status: "ready",
255
+ files: [],
256
+ assistantMessageId: MessageId.make("assistant-1"),
257
+ completedAt: CREATED_AT,
258
+ },
259
+ ],
260
+ },
261
+ );
262
+ expect(screen.buttons("Edit from here")).toHaveLength(0);
263
+ await click(screen.button(/^Automation/));
264
+ expect(screen.buttons("Edit from here")).toHaveLength(1);
265
+ });
266
+});
267
+
268
describe("compact reasoning math", () => {
269
it("keeps formulas while flattening compact reasoning previews", () => {
270
const tree = parseMarkdownWithMath("## Reasoning\n\nUse **norm** $|x|$ and \\[x^2\\]");
apps/web/src/components/chat/TimelineUserMessageRow.tsx
+139
-33
@@ -2,6 +2,8 @@ import { findRevealRef } from "./markdownFindContext";
2
import { type MessageId, type ServerProviderSkill, ThreadId } from "@t3tools/contracts";
3
import { resolveUserMessagePresentation } from "@t3tools/client-runtime/user-message";
4
import { Link } from "@tanstack/react-router";
5
+import { useEnvironmentQuery } from "../../state/query";
6
+import { serverEnvironment } from "../../state/server";
7
import { replaceComposerContextReferences } from "@t3tools/shared/composerContextReferences";
8
import { memo, use, useState, type ReactNode } from "react";
9
import {
@@ -15,7 +17,14 @@ import {
17
isVideoAttachment,
18
} from "../../types";
19
import ChatMarkdown from "../ChatMarkdown";
18
-import { DownloadIcon, EyeIcon, Redo2Icon, Undo2Icon } from "lucide-react";
20
+import {
21
+ CalendarClockIcon,
22
+ ChevronDownIcon,
23
+ DownloadIcon,
24
+ EyeIcon,
25
+ Redo2Icon,
26
+ Undo2Icon,
27
+} from "lucide-react";
28
import { Link as LinkIconNode } from "lucide";
29
import { Button, InlineButton } from "../ui/button";
30
import { useAssetUrlRefresh, useAssetUrls, useAssetUrlState } from "../../assets/assetUrls";
@@ -52,7 +61,11 @@ import { cn } from "~/lib/utils";
61
import { formatChatTimestampTooltip, formatDayAwareTimestamp } from "../../timestampFormat";
62
import { WorkflowOpeningBlock } from "./WorkflowOpeningBlock";
63
import { TimelineRowCtx, TimelineRowActivityCtx, type TimelineRow } from "./timelineRowContext";
55
-import { MESSAGE_HEADING_LEVEL, MessageAuthorHeading } from "./TimelineRowParts";
64
+import {
65
+ MESSAGE_HEADING_LEVEL,
66
+ MessageAuthorHeading,
67
+ TimelineRowTimestamp,
68
+} from "./TimelineRowParts";
69
import { UserMessageContextReferenceChip } from "./UserMessageContextChips";
70
import { resolvePreviewAnnotationImage } from "./TimelineUserMessageRow.logic";
71
@@ -108,11 +121,133 @@ export function UserMessageRow({ row }: { row: Extract<TimelineRow, { kind: "mes
121
environmentId={ctx.activeThreadEnvironmentId}
122
onOpenThread={(threadId) => ctx.onOpenThread(ThreadId.make(threadId))}
123
/>
124
+ ) : resolveUserMessagePresentation(row.message).attribution === "automation" ? (
125
+ <AutomationMessageRow row={row} />
126
) : (
127
<UserTimelineRow row={row} />
128
);
129
}
130
131
+/** Automation prompts are long, repeated runbooks; a folded bubble keeps them out of the way. */
132
+function AutomationMessageRow({ row }: { row: Extract<TimelineRow, { kind: "message" }> }) {
133
+ const ctx = use(TimelineRowCtx);
134
+ const [expanded, setExpanded] = useState(false);
135
+ const revealRef = findRevealRef(() => setExpanded(true));
136
+ const { text, scheduledTaskId } = resolveUserMessagePresentation(row.message);
137
+ const tasksQuery = useEnvironmentQuery(
138
+ scheduledTaskId
139
+ ? serverEnvironment.scheduledTasksLive({
140
+ environmentId: ctx.activeThreadEnvironmentId,
141
+ input: {},
142
+ })
143
+ : null,
144
+ );
145
+ const taskTitle = tasksQuery.data?.tasks.find((task) => task.id === scheduledTaskId)?.title;
146
+ const summary = taskTitle ?? text.trim().split(/\r?\n/, 1)[0] ?? "";
147
+
148
+ const revertTurnCount = row.revertTurnCount;
149
+ const promptLink = promptLinkFor(text);
150
+ // Find reads the DOM, so a folded prompt stays mounted but hidden while find is open.
151
+ const bodyMounted = expanded || ctx.findActive;
152
+
153
+ return (
154
+ <div className="group flex flex-col items-end gap-1" data-user-message-attribution="automation">
155
+ {row.message.inputIntent === "steer" ||
156
+ row.message.inputIntent === "promoted_queued_to_steer" ? (
157
+ <UserMessageIntentMarker intent={row.message.inputIntent} />
158
+ ) : null}
159
+ <div
160
+ className={cn(
161
+ "min-w-0 max-w-[80%] rounded-2xl bg-message text-message-foreground",
162
+ expanded && "w-full",
163
+ )}
164
+ >
165
+ <button
166
+ type="button"
167
+ aria-expanded={expanded}
168
+ data-scroll-anchor-ignore
169
+ onClick={() => setExpanded((value) => !value)}
170
+ className="flex w-full min-w-0 items-center gap-1.5 rounded-2xl px-3 py-2 text-left text-sm focus-visible:outline-2 focus-visible:outline-ring"
171
+ >
172
+ <CalendarClockIcon className="size-4 shrink-0 stroke-2 text-muted-foreground" />
173
+ <span className="shrink-0 text-muted-foreground">Automation</span>
174
+ <span className="min-w-0 flex-1 truncate">{summary}</span>
175
+ <ChevronDownIcon
176
+ className={cn(
177
+ "size-3.5 shrink-0 text-muted-foreground transition-transform",
178
+ expanded && "rotate-180",
179
+ )}
180
+ />
181
+ </button>
182
+ {bodyMounted ? (
183
+ // `beforematch` does not bubble, so the reveal listener sits on the hidden fold itself.
184
+ <div
185
+ ref={revealRef}
186
+ hidden={!expanded}
187
+ className={cn("px-3 pb-3", !ctx.findActive && "max-h-96 overflow-auto")}
188
+ data-thread-find-text="true"
189
+ >
190
+ <UserMessageBody text={text} skills={ctx.skills} markdownCwd={ctx.markdownCwd} />
191
+ </div>
192
+ ) : null}
193
+ </div>
194
+ <UserMessageProjectedStatus row={row} />
195
+ {expanded ? (
196
+ <div className="flex w-full max-w-[80%] items-center justify-end pe-1 text-xs tabular-nums opacity-0 transition-opacity duration-200 pointer-coarse:opacity-100 focus-within:opacity-100 group-hover:opacity-100">
197
+ <div className="flex shrink-0 items-center gap-2">
198
+ {scheduledTaskId ? (
199
+ <Link
200
+ to="/settings/scheduled-tasks"
201
+ search={{ environmentId: ctx.activeThreadEnvironmentId, taskId: scheduledTaskId }}
202
+ className="rounded-sm text-xs text-muted-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring"
203
+ >
204
+ Open automation
205
+ </Link>
206
+ ) : null}
207
+ <TimelineRowTimestamp
208
+ createdAt={row.message.createdAt}
209
+ timestampFormat={ctx.timestampFormat}
210
+ alwaysVisible
211
+ />
212
+ <div className="flex items-center gap-0.5">
213
+ {typeof revertTurnCount === "number" && (
214
+ <RevertUserMessageButton turnCount={revertTurnCount} messageId={row.message.id} />
215
+ )}
216
+ <MessageCopyButton text={text} variant="ghost" />
217
+ {promptLink !== null && (
218
+ <MessageCopyButton
219
+ text={promptLink}
220
+ label="Copy prompt link"
221
+ icon={LinkIconNode}
222
+ variant="ghost"
223
+ />
224
+ )}
225
+ </div>
226
+ </div>
227
+ </div>
228
+ ) : null}
229
+ </div>
230
+ );
231
+}
232
+
233
+function UserMessageProjectedStatus({ row }: { row: Extract<TimelineRow, { kind: "message" }> }) {
234
+ const status = row.projectedItem?.item.status;
235
+ if (
236
+ status === undefined ||
237
+ status === "completed" ||
238
+ status === "pending" ||
239
+ status === "waiting"
240
+ )
241
+ return null;
242
+ return (
243
+ <div className="me-1 flex items-center gap-1.5">
244
+ <span className="rounded-full border border-destructive/25 bg-destructive/8 px-1.5 py-0.5 text-3xs font-medium text-destructive">
245
+ {status}
246
+ </span>
247
+ </div>
248
+ );
249
+}
250
+
251
function UserTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "message" }> }) {
252
const ctx = use(TimelineRowCtx);
253
const { onImageExpand, onFileOpen } = ctx;
@@ -245,27 +380,7 @@ function UserTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "message"
380
381
return (
382
<div className="group flex flex-col items-end gap-1">
248
- {userMessage.attribution === "automation" ? (
249
- <p
250
- className="me-1 text-2xs text-muted-foreground/70"
251
- data-user-message-attribution="automation"
252
- >
253
- {userMessage.scheduledTaskId ? (
254
- <Link
255
- to="/settings/scheduled-tasks"
256
- search={{
257
- environmentId: ctx.activeThreadEnvironmentId,
258
- taskId: userMessage.scheduledTaskId,
259
- }}
260
- className="rounded-sm hover:text-muted-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring"
261
- >
262
- Sent by automation
263
- </Link>
264
- ) : (
265
- "Sent by automation"
266
- )}
267
- </p>
268
- ) : userMessage.attribution === "t3code" ? (
383
+ {userMessage.attribution === "t3code" ? (
384
<p
385
className="me-1 text-2xs text-muted-foreground/70"
386
data-user-message-attribution="t3code"
@@ -407,16 +522,7 @@ function UserTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "message"
522
/>
523
</div>
524
</div>
410
- {row.projectedItem &&
411
- row.projectedItem.item.status !== "completed" &&
412
- row.projectedItem.item.status !== "pending" &&
413
- row.projectedItem.item.status !== "waiting" ? (
414
- <div className="me-1 flex items-center gap-1.5">
415
- <span className="rounded-full border border-destructive/25 bg-destructive/8 px-1.5 py-0.5 text-3xs font-medium text-destructive">
416
- {row.projectedItem.item.status}
417
- </span>
418
- </div>
419
- ) : null}
525
+ <UserMessageProjectedStatus row={row} />
526
<div className="flex w-full max-w-[80%] items-center justify-end pe-1 text-xs tabular-nums opacity-0 transition-opacity duration-200 pointer-coarse:opacity-100 focus-within:opacity-100 group-hover:opacity-100">
527
<div className="flex shrink-0 items-center gap-2">
528
<Tooltip>