fix(mobile): label queued message intent

Distinguish queued and steering user messages in the mobile thread feed, matching the web timeline.

Co-authored-by: codex <[email protected]>
This commit is contained in:
Julius Marmingeandcodex committed 2026-08-15 16:50:19 +02:00
1 parent 18c2458673
commit 808dd3d7e7
3 files changed
+95

No files matched your search

@@ -110,6 +110,7 @@ import { useAtomCommand } from "../../state/use-atom-command";
import { useV2ItemSupport } from "../../state/v2-item-support";
import { resolveWorkspaceRelativeFilePath } from "../files/filePath";
import { waitForThreadShellReady } from "./threadForkNavigation";
import { resolveUserMessageIntentBadge } from "./userMessageIntentBadge";
const WIDE_MARKDOWN_BLOCK_OPTIONS = {
includeOrderedLists: Platform.OS === "android",
@@ -992,6 +993,7 @@ function renderFeedEntry(
if (isUser) {
const enterAnimated = isFreshTimestamp(message.createdAt);
const intentBadge = resolveUserMessageIntentBadge(message.inputIntent);
return (
<View className="mb-5 items-end">
{message.createdBy === "agent" ? (
@@ -1033,6 +1035,30 @@ function renderFeedEntry(
})}
</View>
<View className="mt-1 flex-row items-center justify-end gap-1 pr-0.5">
{intentBadge ? (
<View
accessible
accessibilityRole="text"
accessibilityLabel={intentBadge.accessibilityLabel}
className={cn(
"rounded-full border px-1.5 py-0.5",
intentBadge.tone === "queued"
? "border-amber-500/25 bg-amber-500/10 dark:border-amber-400/25 dark:bg-amber-400/10"
: "border-sky-500/25 bg-sky-500/10 dark:border-sky-400/25 dark:bg-sky-400/10",
)}
>
<Text
className={cn(
"font-t3-medium text-2xs tracking-wide",
intentBadge.tone === "queued"
? "text-amber-700 dark:text-amber-300"
: "text-sky-700 dark:text-sky-300",
)}
>
{intentBadge.label}
</Text>
</View>
) : null}
<Text className="font-t3-medium text-xs tabular-nums text-neutral-600 dark:text-neutral-400">
{timestampLabel}
</Text>
@@ -0,0 +1,34 @@
import { describe, expect, it } from "@effect/vitest";
import { resolveUserMessageIntentBadge } from "./userMessageIntentBadge";
describe("user message intent badge", () => {
it("does not label ordinary turn-start messages", () => {
expect(resolveUserMessageIntentBadge(undefined)).toBeNull();
expect(resolveUserMessageIntentBadge("turn_start")).toBeNull();
});
it("labels messages waiting behind the active turn", () => {
expect(resolveUserMessageIntentBadge("queued_turn")).toEqual({
label: "queued",
accessibilityLabel: "Queued behind the active turn",
tone: "queued",
});
});
it("labels messages that steer the active turn", () => {
expect(resolveUserMessageIntentBadge("steer")).toEqual({
label: "steer",
accessibilityLabel: "Steered the active turn",
tone: "steer",
});
});
it("preserves the queued origin after promotion to steer", () => {
expect(resolveUserMessageIntentBadge("promoted_queued_to_steer")).toEqual({
label: "queued → steer",
accessibilityLabel: "Originally queued, then promoted to steer the active turn",
tone: "steer",
});
});
});
@@ -0,0 +1,35 @@
import type { OrchestrationV2UserMessageInputIntent } from "@t3tools/contracts";
export interface UserMessageIntentBadgePresentation {
readonly label: string;
readonly accessibilityLabel: string;
readonly tone: "queued" | "steer";
}
export function resolveUserMessageIntentBadge(
intent: OrchestrationV2UserMessageInputIntent | undefined,
): UserMessageIntentBadgePresentation | null {
switch (intent) {
case "queued_turn":
return {
label: "queued",
accessibilityLabel: "Queued behind the active turn",
tone: "queued",
};
case "steer":
return {
label: "steer",
accessibilityLabel: "Steered the active turn",
tone: "steer",
};
case "promoted_queued_to_steer":
return {
label: "queued → steer",
accessibilityLabel: "Originally queued, then promoted to steer the active turn",
tone: "steer",
};
case "turn_start":
case undefined:
return null;
}
}