Skip to content

Commit 5d6e419

Browse files
authored
fix: show computer-use action titles and align app icons (#18865)
1 parent e2e95a3 commit 5d6e419

18 files changed

Lines changed: 542 additions & 129 deletions
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import type { ColorValue } from "react-native";
2+
import Svg, { Circle, Path } from "react-native-svg";
3+
import { withUniwind } from "uniwind";
4+
5+
const ThemedSvg = withUniwind(Svg);
6+
7+
/** Matches the window-and-pointer icon used by the web work log. */
8+
export function BrowserAppIcon(props: {
9+
readonly size: number;
10+
readonly color?: ColorValue;
11+
readonly colorClassName?: string;
12+
}) {
13+
return (
14+
<ThemedSvg
15+
width={props.size}
16+
height={props.size}
17+
viewBox="0 0 24 24"
18+
fill="none"
19+
stroke="currentColor"
20+
strokeWidth={1.9}
21+
strokeLinecap="round"
22+
strokeLinejoin="round"
23+
color={props.color}
24+
colorClassName={props.colorClassName}
25+
accessible={false}
26+
>
27+
<Path d="M8.5 19H7.2C4.4 19 3 17.5 3 14.6V7.4C3 4.5 4.5 3 7.4 3h8.2C18.5 3 20 4.5 20 7.4v2.4" />
28+
<Circle cx={7.4} cy={7.2} r={0.75} fill="currentColor" stroke="none" />
29+
<Path d="M11.2 7.2h4.3" />
30+
<Path d="m12.4 11.4 7.5 2.6-3.4 1.6-1.5 3.6z" fill="currentColor" stroke="none" />
31+
</ThemedSvg>
32+
);
33+
}

‎apps/mobile/src/features/threads/thread-work-log.tsx‎

Lines changed: 82 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,12 @@ import { scopeThreadRef } from "@t3tools/client-runtime/environment";
5353
import { environmentThreadDetails, threadEnvironment } from "../../state/threads";
5454
import { useAtomCommand } from "../../state/use-atom-command";
5555
import { toolActivityFaviconUrl } from "@t3tools/shared/favicon";
56+
import { isJavaScriptReplTool } from "@t3tools/shared/toolActivity";
57+
import { useMarkdownCodeHighlight } from "./markdownCodeHighlightState";
5658

5759
import { AppText as Text } from "../../components/AppText";
5860
import { T3Wordmark } from "../../components/T3Wordmark";
61+
import { BrowserAppIcon } from "../../components/BrowserAppIcon";
5962
import { cn } from "../../lib/cn";
6063
import { THREAD_WORK_ROW_MIN_HEIGHT, type deriveThreadWorkLogSizing } from "../../lib/layout";
6164
import {
@@ -111,7 +114,13 @@ export const THREAD_DISCLOSURE_TRANSITION_MS = 180;
111114
const WORK_LOG_LAYOUT_TRANSITION = LinearTransition.duration(THREAD_DISCLOSURE_TRANSITION_MS);
112115
const WORK_LOG_DETAIL_ENTER_TRANSITION = FadeIn.duration(140);
113116
const WORK_LOG_DETAIL_EXIT_TRANSITION = FadeOut.duration(120);
114-
type WorkContentIcon = AppSymbolName | "browser" | "device" | "t3-code" | "pull-request";
117+
type WorkContentIcon =
118+
| AppSymbolName
119+
| "browser"
120+
| "computer"
121+
| "device"
122+
| "t3-code"
123+
| "pull-request";
115124

116125
function WorkLogIcon(props: {
117126
readonly icon: WorkContentIcon;
@@ -125,6 +134,14 @@ function WorkLogIcon(props: {
125134
<T3Wordmark height={10} {...(colorClassName ? { colorClassName } : { color: props.color })} />
126135
);
127136
}
137+
if (props.icon === "computer") {
138+
return (
139+
<BrowserAppIcon
140+
size={14}
141+
{...(colorClassName ? { colorClassName } : { color: props.color })}
142+
/>
143+
);
144+
}
128145
return (
129146
<SymbolView
130147
name={
@@ -372,7 +389,7 @@ export function ShimmeringWorkContent(props: {
372389
);
373390
}
374391

375-
function workRowSymbolName(icon: ThreadFeedActivity["icon"]): AppSymbolName {
392+
function workRowSymbolName(icon: ThreadFeedActivity["icon"]): WorkContentIcon {
376393
switch (icon) {
377394
case "agent":
378395
return { ios: "sparkles", android: "auto_awesome" };
@@ -385,7 +402,9 @@ function workRowSymbolName(icon: ThreadFeedActivity["icon"]): AppSymbolName {
385402
case "command":
386403
return { ios: "terminal", android: "terminal" };
387404
case "computer":
388-
return { ios: "desktopcomputer", android: "desktop_windows" };
405+
return "computer";
406+
case "code":
407+
return "chevron.left.forwardslash.chevron.right";
389408
case "edit":
390409
return { ios: "square.and.pencil", android: "edit" };
391410
case "eye":
@@ -832,6 +851,38 @@ function WorkspacePreparationRetryButton(props: {
832851
);
833852
}
834853

854+
function ReplCodeText({
855+
code,
856+
theme,
857+
}: {
858+
readonly code: string;
859+
readonly theme: "light" | "dark";
860+
}) {
861+
const lines = useMarkdownCodeHighlight({ code, language: "typescript", theme, enabled: true });
862+
let offset = 0;
863+
const highlighted = lines?.flatMap((line, lineIndex) => {
864+
const separator = lineIndex > 0 ? "\n" : "";
865+
offset += separator.length;
866+
return [
867+
separator,
868+
...line.map((token) => {
869+
const start = offset;
870+
offset += token.content.length;
871+
return (
872+
<Text key={start} style={token.color ? { color: token.color } : undefined}>
873+
{token.content}
874+
</Text>
875+
);
876+
}),
877+
];
878+
});
879+
return (
880+
<Text selectable className="font-mono text-2xs leading-normal text-foreground">
881+
{highlighted ?? code}
882+
</Text>
883+
);
884+
}
885+
835886
const ThreadWorkLogRow = memo(function ThreadWorkLogRow(
836887
props: Omit<
837888
ThreadWorkLogProps,
@@ -1177,19 +1228,36 @@ const ThreadWorkLogRow = memo(function ThreadWorkLogRow(
11771228
) : call ? (
11781229
[
11791230
call.command,
1180-
...(call.args ?? []).map(([key, value]) => `${key} ${value}`),
1231+
...(call.args ?? []).map(([key, value]) =>
1232+
key === "code" &&
1233+
shownItem.type === "dynamic_tool" &&
1234+
isJavaScriptReplTool(shownItem.toolName) ? (
1235+
<View key={key}>
1236+
<Text className="font-mono text-2xs leading-normal text-foreground-muted">
1237+
{key}
1238+
</Text>
1239+
<ReplCodeText code={value} theme={props.themeAppearance} />
1240+
</View>
1241+
) : (
1242+
`${key} ${value}`
1243+
),
1244+
),
11811245
call.argsText,
11821246
]
1183-
.filter((line): line is string => Boolean(line))
1184-
.map((line, index) => (
1185-
<Text
1186-
key={`${index}:${line}`}
1187-
selectable
1188-
className="font-mono text-2xs leading-normal text-foreground"
1189-
>
1190-
{line}
1191-
</Text>
1192-
))
1247+
.filter((line) => Boolean(line))
1248+
.map((line, index) =>
1249+
typeof line === "string" ? (
1250+
<Text
1251+
key={`${index}:${line}`}
1252+
selectable
1253+
className="font-mono text-2xs leading-normal text-foreground"
1254+
>
1255+
{line}
1256+
</Text>
1257+
) : (
1258+
line
1259+
),
1260+
)
11931261
) : fullDetail ? (
11941262
<Text selectable className="font-mono text-2xs leading-normal text-foreground-muted">
11951263
{fullDetail}

‎apps/mobile/src/lib/threadActivity.test.ts‎

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,16 +1450,54 @@ describe("buildThreadFeed", () => {
14501450
expect(activity?.getCopyText().split("\n")[0]).toBe("Read a T3 thread");
14511451
});
14521452

1453-
it("uses the CUA action title in the mobile feed", () => {
1453+
it.each(["cua_repl.js", "node_repl.js", "js"])(
1454+
"uses the %s action title in the mobile feed",
1455+
(toolName) => {
1456+
const item: OrchestrationV2TurnItem = {
1457+
...base("cua", "2026-09-23T20:20:00.000Z", 1),
1458+
type: "dynamic_tool",
1459+
toolName,
1460+
input: {
1461+
code: "await game.getAXStateAndScreenshot();",
1462+
title: "Inspect Saga music screen",
1463+
},
1464+
};
1465+
const feed = buildThreadFeed([projected(item, 0)]);
1466+
const activity = feed[0]?.type === "activity-group" ? feed[0].activities[0] : null;
1467+
expect(activity?.summary).toBe("Inspect Saga music screen");
1468+
},
1469+
);
1470+
1471+
it.each([
1472+
[
1473+
"failed",
1474+
"await sky.type_text({app:'T3 Code (Nightly)',text:'debug(ga.run)'});",
1475+
"Restrict the breakpoint to Git actions",
1476+
"computer",
1477+
],
1478+
[
1479+
"completed",
1480+
"await fetch('http://127.0.0.1/json/list');",
1481+
"Discover the live Electron debugging endpoint",
1482+
"code",
1483+
],
1484+
] as const)("recovers the retained js title and %s call icon", (status, code, title, icon) => {
14541485
const item: OrchestrationV2TurnItem = {
1455-
...base("cua", "2026-09-23T20:20:00.000Z", 1),
1486+
...base("retained-js", "2026-09-23T20:20:00.000Z", 1),
14561487
type: "dynamic_tool",
1457-
toolName: "cua_repl.js",
1458-
input: { code: "await game.getAXStateAndScreenshot();", title: "Inspect Saga music screen" },
1488+
status,
1489+
title: "js",
1490+
toolName: "node_repl.js",
1491+
toolSource: { key: "mcp:node_repl", name: "node repl", kind: "integration" },
1492+
input: { code, title },
14591493
};
14601494
const feed = buildThreadFeed([projected(item, 0)]);
14611495
const activity = feed[0]?.type === "activity-group" ? feed[0].activities[0] : null;
1462-
expect(activity?.summary).toBe("Inspect Saga music screen");
1496+
expect(activity?.summary).toBe(title);
1497+
expect(activity?.icon).toBe(icon);
1498+
expect(activity?.workEntry.toolSource?.kind).toBe(
1499+
icon === "computer" ? "computer" : "integration",
1500+
);
14631501
});
14641502

14651503
it("uses canonical T3 orchestration summaries in compact work groups", () => {

‎apps/mobile/src/lib/threadActivity.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import {
5757
classifyToolActivity,
5858
collectToolFilePaths,
5959
dynamicToolTitle,
60+
isJavaScriptReplTool,
6061
formatReadToolLabel,
6162
formatSearchToolLabel,
6263
} from "@t3tools/shared/toolActivity";
@@ -97,6 +98,7 @@ export interface ThreadFeedActivity {
9798
| "alert"
9899
| "browser"
99100
| "computer"
101+
| "code"
100102
| "check"
101103
| "command"
102104
| "edit"
@@ -556,7 +558,7 @@ function itemIcon(item: OrchestrationV2TurnItem): ThreadFeedActivity["icon"] {
556558
case "assistant_message":
557559
return "message";
558560
case "dynamic_tool":
559-
return "wrench";
561+
return isJavaScriptReplTool(item.toolName) ? "code" : "wrench";
560562
case "subagent":
561563
return "hammer";
562564
case "run_interrupt_request":
@@ -598,8 +600,9 @@ function itemSummary(
598600
if (item.type === "system_notice") return item.message;
599601
if (item.type === "compaction") return contextCompactionLabel(item);
600602
const title =
601-
(item.type === "dynamic_tool" ? dynamicToolTitle(item.toolName, item.input) : undefined) ??
602-
item.title?.trim();
603+
(item.type === "dynamic_tool"
604+
? dynamicToolTitle(item.toolName, item.input, item.title)
605+
: undefined) ?? item.title?.trim();
603606
if (item.type === "subagent") return formatSubagentDisplayTitle(title || "Subagent");
604607
if (title) return toolPresentation?.displayName ?? capitalizePhrase(title);
605608
switch (item.type) {

‎apps/server/src/orchestration-v2/Adapters/CodexAdapterV2.test.ts‎

Lines changed: 69 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -827,36 +827,82 @@ describe("CodexAdapterV2 process spawning", () => {
827827
});
828828

829829
describe("CodexAdapterV2 dynamic tool projection", () => {
830-
it.effect("uses the CUA call title while leaving other MCP titles as tool arguments", () =>
830+
it.effect("keeps a failed Sky MCP call in Computer Use when its error has no metadata", () =>
831831
Effect.gen(function* () {
832-
const call = {
833-
type: "mcpToolCall" as const,
834-
id: "inspect",
835-
server: "cua_repl",
832+
const projection = yield* CodexAdapterV2.projectCodexDynamicToolItem({
833+
type: "mcpToolCall",
834+
id: "failed-sky-js",
835+
server: "node_repl",
836836
tool: "js",
837-
status: "completed" as const,
837+
status: "failed",
838838
arguments: {
839-
code: "await game.getAXStateAndScreenshot();",
840-
title: "Inspect Saga music screen",
839+
title: "Restrict the breakpoint to Git actions",
840+
code: "await sky.type_text({app:'T3 Code (Nightly)',text:'debug(ga.run)'});",
841841
},
842-
result: { content: [] },
843-
};
844-
assert.equal(
845-
(yield* CodexAdapterV2.projectCodexDynamicToolItem(call)).title,
846-
"Inspect Saga music screen",
847-
);
848-
assert.equal(
849-
(yield* CodexAdapterV2.projectCodexDynamicToolItem({ ...call, arguments: { title: " " } }))
850-
.title,
851-
"js",
852-
);
853-
assert.equal(
854-
(yield* CodexAdapterV2.projectCodexDynamicToolItem({ ...call, server: "github" })).title,
855-
"js",
856-
);
842+
result: { content: [{ type: "text", text: "Illegal Unicode escape sequence" }] },
843+
});
844+
assert.equal(projection.title, "Restrict the breakpoint to Git actions");
845+
assert.equal(projection.toolSurface, "computer");
846+
assert.deepEqual(projection.toolSource, {
847+
key: "computer-use",
848+
name: "Computer Use",
849+
kind: "computer",
850+
});
857851
}).pipe(Effect.provide(NodeServices.layer)),
858852
);
859853

854+
it.effect.each(["inProgress", "completed", "failed"] as const)(
855+
"preserves a bare js action's title and computer surface when %s without result metadata",
856+
(status) =>
857+
Effect.gen(function* () {
858+
const projection = yield* CodexAdapterV2.projectCodexDynamicToolItem({
859+
type: "dynamicToolCall",
860+
id: "bare-js",
861+
tool: "js",
862+
status,
863+
arguments: { code: "await sky.get_app_state(app);", title: "Read the desktop window" },
864+
contentItems: [],
865+
success: status !== "failed",
866+
});
867+
assert.equal(projection.title, "Read the desktop window");
868+
assert.equal(projection.toolSurface, "computer");
869+
}).pipe(Effect.provide(NodeServices.layer)),
870+
);
871+
872+
it.effect.each(["cua_repl", "node_repl"])(
873+
"uses the %s call title while leaving other MCP titles as tool arguments",
874+
(server) =>
875+
Effect.gen(function* () {
876+
const call = {
877+
type: "mcpToolCall" as const,
878+
id: "inspect",
879+
server,
880+
tool: "js",
881+
status: "completed" as const,
882+
arguments: {
883+
code: "await game.getAXStateAndScreenshot();",
884+
title: "Inspect Saga music screen",
885+
},
886+
result: { content: [] },
887+
};
888+
assert.equal(
889+
(yield* CodexAdapterV2.projectCodexDynamicToolItem(call)).title,
890+
"Inspect Saga music screen",
891+
);
892+
assert.equal(
893+
(yield* CodexAdapterV2.projectCodexDynamicToolItem({
894+
...call,
895+
arguments: { title: " " },
896+
})).title,
897+
server === "cua_repl" ? "Computer use" : "Run JavaScript",
898+
);
899+
assert.equal(
900+
(yield* CodexAdapterV2.projectCodexDynamicToolItem({ ...call, server: "github" })).title,
901+
"js",
902+
);
903+
}).pipe(Effect.provide(NodeServices.layer)),
904+
);
905+
860906
it.effect.each(["inProgress", "completed", "failed"] as const)(
861907
"presents ordinary MCP calls when %s",
862908
(status) =>

0 commit comments

Comments
 (0)