Skip to content

Commit 9890f56

Browse files
committed
fix(mobile): match desktop agent speed icons
1 parent 6868dff commit 9890f56

3 files changed

Lines changed: 72 additions & 20 deletions

File tree

‎apps/mobile/src/features/threads/SubagentRow.tsx‎

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import { resolveSubagentMetadata } from "@t3tools/client-runtime/state/subagent-
44
import type { EnvironmentId, OrchestrationV2Subagent } from "@t3tools/contracts";
55
import type { ReactNode } from "react";
66
import { View } from "react-native";
7+
import Svg, { Path } from "react-native-svg";
8+
import { withUniwind } from "uniwind";
79

810
import { AppText as Text } from "../../components/ui/AppText";
911
import { SymbolView } from "../../components/ui/AppSymbol";
@@ -14,6 +16,8 @@ import { subagentCardDetail } from "./subagent-card-presentation";
1416
import { SUBAGENT_TONE_TEXT_CLASS, SubagentStatusDot } from "./SubagentStatusDot";
1517
import { resolveSubagentRowPresentation, resolveSubagentTraits } from "./threadAgentsPresentation";
1618

19+
const ThemedSvg = withUniwind(Svg);
20+
1721
type SubagentRowSubagent = Pick<
1822
OrchestrationV2Subagent,
1923
| "threadId"
@@ -106,7 +110,7 @@ function SubagentMetadata(props: {
106110
parent ? scopeProjectRef(environmentId, parent.projectId) : null,
107111
);
108112
const childProject = useProject(child ? scopeProjectRef(environmentId, child.projectId) : null);
109-
const { traits, providerInstanceId } = resolveSubagentTraits({
113+
const { traits, speedIcon, providerInstanceId } = resolveSubagentTraits({
110114
subagent,
111115
provider: sourceProvider,
112116
childThread: child,
@@ -125,17 +129,56 @@ function SubagentMetadata(props: {
125129
parentProject,
126130
childProject,
127131
});
132+
const modelText = `${provider ? `${resolveProviderInstanceDisplayName(provider)} · ` : ""}${modelLabel}`;
128133
return (
129134
<View className="min-w-0 flex-row items-center gap-1.5">
130135
<ProviderIcon
131136
provider={provider?.driver ?? subagent.driver}
132137
iconUrl={provider?.iconUrl}
133138
size={12}
134139
/>
135-
<Text className="min-w-0 shrink text-xs text-foreground-muted" numberOfLines={1}>
136-
{provider ? `${resolveProviderInstanceDisplayName(provider)} · ` : ""}
137-
{modelLabel}
138-
{traits ? ` · ${traits}` : ""}
140+
<Text
141+
className="min-w-0 shrink text-xs text-foreground-muted"
142+
numberOfLines={1}
143+
accessibilityLabel={[
144+
modelText,
145+
speedIcon ? `${speedIcon === "ultrafast" ? "Ultrafast" : "Fast"} mode on` : null,
146+
traits,
147+
]
148+
.filter(Boolean)
149+
.join(" · ")}
150+
>
151+
{modelText}
152+
{traits || speedIcon ? " · " : ""}
153+
{speedIcon ? (
154+
<ThemedSvg
155+
width={12}
156+
height={12}
157+
viewBox="0 0 24 24"
158+
colorClassName="accent-foreground-muted"
159+
fill="currentColor"
160+
opacity={0.8}
161+
accessibilityElementsHidden
162+
importantForAccessibility="no"
163+
>
164+
{speedIcon === "ultrafast" ? (
165+
<>
166+
<Path d="m17 2-10 12h7l-1 8 10-12h-7l1-8Z" opacity={0.4} />
167+
<Path d="m11 2-10 12h7l-1 8 10-12h-7l1-8Z" />
168+
</>
169+
) : (
170+
<Path
171+
d="M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z"
172+
stroke="currentColor"
173+
strokeWidth={2}
174+
strokeLinecap="round"
175+
strokeLinejoin="round"
176+
/>
177+
)}
178+
</ThemedSvg>
179+
) : null}
180+
{speedIcon && traits ? " " : ""}
181+
{traits}
139182
</Text>
140183
{workspace.map(({ label, value }) => (
141184
// Preserve the label against flattening without making it a separate accessibility stop.

‎apps/mobile/src/features/threads/threadAgentsPresentation.test.ts‎

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,11 @@ describe("subagent traits", () => {
106106
).toBe("");
107107
});
108108
it("shows the agent's saved effort and speed, including model display names", () => {
109-
expect(resolveSubagentTraits({ subagent, provider }).traits).toBe("High · Fast");
109+
expect(resolveSubagentTraits({ subagent, provider })).toEqual({
110+
traits: "High",
111+
speedIcon: "fast",
112+
providerInstanceId: instanceId,
113+
});
110114
});
111115

112116
it("uses an app-owned child's selection when the agent has no saved selection", () => {
@@ -116,7 +120,7 @@ describe("subagent traits", () => {
116120
provider,
117121
childThread: { providerInstanceId: instanceId, modelSelection: selection },
118122
}).traits,
119-
).toBe("High · Fast");
123+
).toBe("High");
120124
});
121125

122126
it("does not use a provider-managed child's selection", () => {
@@ -157,7 +161,7 @@ describe("subagent traits", () => {
157161
modelSelection: { ...selection, options: [{ id: "reasoningEffort", value: "low" }] },
158162
},
159163
}).traits,
160-
).toBe("High · Fast");
164+
).toBe("High");
161165
});
162166

163167
it("shows Claude effort and boolean fast mode", () => {
@@ -194,23 +198,23 @@ describe("subagent traits", () => {
194198
],
195199
},
196200
}).traits,
197-
).toBe("Max · Fast");
201+
).toBe("Max");
198202
});
199203

200204
it.each([
201-
["ultra", "Ultrafast"],
202-
["default", "Normal"],
203-
["removed", ""],
204-
])("shows only known saved speed values: %s", (value, label) => {
205+
["ultra", "ultrafast"],
206+
["default", null],
207+
["removed", null],
208+
])("shows only known saved speed icons: %s", (value, icon) => {
205209
expect(
206210
resolveSubagentTraits({
207211
subagent: {
208212
...subagent,
209213
modelSelection: { ...selection, options: [{ id: "serviceTier", value }] },
210214
},
211215
provider,
212-
}).traits,
213-
).toBe(label);
216+
}).speedIcon,
217+
).toBe(icon);
214218
});
215219

216220
it("uses a validated app-owned child's provider for cross-provider workflow traits", () => {
@@ -252,11 +256,13 @@ describe("subagent traits", () => {
252256
childThread: { providerInstanceId: childInstanceId, modelSelection: childSelection },
253257
};
254258
expect(resolveSubagentTraits(input)).toEqual({
255-
traits: "Max · Fast",
259+
traits: "Max",
260+
speedIcon: "fast",
256261
providerInstanceId: childInstanceId,
257262
});
258263
expect(resolveSubagentTraits({ ...input, subagent })).toEqual({
259-
traits: "High · Fast",
264+
traits: "High",
265+
speedIcon: "fast",
260266
providerInstanceId: instanceId,
261267
});
262268
expect(
@@ -278,7 +284,7 @@ describe("subagent traits", () => {
278284
).toBe("");
279285
expect(
280286
resolveSubagentTraits({ ...input, subagent: { ...input.subagent, model: "another-model" } }),
281-
).toEqual({ traits: "", providerInstanceId: instanceId });
287+
).toEqual({ traits: "", speedIcon: null, providerInstanceId: instanceId });
282288
expect(
283289
resolveSubagentTraits({
284290
subagent: { ...subagent, modelSelection: undefined },

‎apps/mobile/src/features/threads/threadAgentsPresentation.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export function resolveSubagentTraits(input: {
7979
selectedModel !== modelSlug ||
8080
selection.instanceId !== (childProvider?.instanceId ?? subagent.providerInstanceId)
8181
)
82-
return { traits: "", providerInstanceId: subagent.providerInstanceId };
82+
return { traits: "", speedIcon: null, providerInstanceId: subagent.providerInstanceId };
8383

8484
const effort = formatModelSelectionEffort({ ...selection, model: modelSlug }, provider?.models);
8585
const descriptors =
@@ -116,8 +116,11 @@ export function resolveSubagentTraits(input: {
116116
ultrathinkPromptControlled: false,
117117
}).label
118118
: null;
119+
const speedIcon =
120+
speedLabel === "Fast" ? "fast" : speedLabel === "Ultrafast" ? "ultrafast" : null;
119121
return {
120-
traits: [effort, speedLabel].filter(Boolean).join(" · "),
122+
traits: effort ?? "",
123+
speedIcon,
121124
providerInstanceId: childProvider?.instanceId ?? subagent.providerInstanceId,
122125
};
123126
}

0 commit comments

Comments
 (0)