Skip to content

Commit 3f82f76

Browse files
committed
feat(settings): configure ignored command prefixes
1 parent 3ff5b3c commit 3f82f76

21 files changed

Lines changed: 627 additions & 42 deletions

‎apps/mobile/src/features/settings/SettingsThreadsRouteScreen.tsx‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { mobilePreferencesAtom, updateMobilePreferencesAtom } from "../../state/
1515
import { serverEnvironment } from "../../state/server";
1616
import { useAtomCommand } from "../../state/use-atom-command";
1717
import { SettingsSection } from "./components/SettingsSection";
18+
import { IgnoredCommandPrefixesSettings } from "./components/IgnoredCommandPrefixesSettings";
1819
import { SettingsProjectOverridesSection } from "./components/SettingsProjectOverridesSection";
1920
import { SettingsSwitchRow } from "./components/SettingsSwitchRow";
2021
import { SettingsScreen } from "./components/SettingsScreen";
@@ -47,6 +48,7 @@ export function SettingsThreadsRouteScreen() {
4748
contentContainerStyle={{ paddingBottom: Math.max(insets.bottom, 18) + 18 }}
4849
>
4950
<AutoSettleSettingsRows />
51+
<IgnoredCommandPrefixesSettings />
5052
<BetaSettingsSection />
5153
<LegacySettingsSection />
5254
</ScrollView>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import { useAtomSet, useAtomValue } from "@effect/atom-react";
2+
import { parseIgnoredCommandPrefixes } from "@t3tools/client-runtime/work-log/command-label";
3+
import { useRef } from "react";
4+
import { Pressable, View } from "react-native";
5+
6+
import { AppText as Text, AppTextInput } from "../../../components/ui/AppText";
7+
import {
8+
ignoredCommandPrefixesAtom,
9+
updateMobilePreferencesAtom,
10+
} from "../../../state/preferences";
11+
import { SettingsSection } from "./SettingsSection";
12+
13+
export function IgnoredCommandPrefixesSettings() {
14+
const prefixes = useAtomValue(ignoredCommandPrefixesAtom);
15+
const savePreferences = useAtomSet(updateMobilePreferencesAtom);
16+
const edited = useRef(false);
17+
const value = prefixes.join("\n");
18+
19+
return (
20+
<SettingsSection
21+
title="Top-level commands to ignore"
22+
trailing={
23+
prefixes.length > 0 ? (
24+
<Pressable
25+
accessibilityRole="button"
26+
accessibilityLabel="Reset top-level commands to ignore"
27+
onPress={() => {
28+
edited.current = false;
29+
savePreferences({ ignoredCommandPrefixes: [] });
30+
}}
31+
>
32+
<Text className="text-sm text-accent">Reset</Text>
33+
</Pressable>
34+
) : null
35+
}
36+
>
37+
<View className="gap-2 px-4 py-3">
38+
<Text className="text-sm text-foreground-muted">
39+
Hide command prefixes in activity labels and previews. Enter one per line. Full command
40+
details stay available. This applies on this device.
41+
</Text>
42+
<AppTextInput
43+
key={value}
44+
accessibilityLabel="Top-level commands to ignore"
45+
defaultValue={value}
46+
placeholder="No commands ignored"
47+
multiline
48+
autoCapitalize="none"
49+
autoCorrect={false}
50+
className="min-h-24 rounded-xl px-3 py-2 text-base text-foreground"
51+
onChangeText={() => {
52+
edited.current = true;
53+
}}
54+
onEndEditing={(event) => {
55+
const next = parseIgnoredCommandPrefixes(event.nativeEvent.text);
56+
if (edited.current && next.join("\n") !== value) {
57+
savePreferences({ ignoredCommandPrefixes: next });
58+
}
59+
edited.current = false;
60+
}}
61+
/>
62+
</View>
63+
</SettingsSection>
64+
);
65+
}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { useAtomValue } from "@effect/atom-react";
2+
import { ignoredCommandPrefixesAtom } from "../../state/preferences";
13
import * as Dialog from "../../components/ui/Dialog";
24
import { useOpenPullRequest } from "../../native/useOpenPullRequest";
35
import { ThreadMarkdownVideo, ThreadMediaVisibleContext } from "./ThreadMarkdownVideo";
@@ -1674,6 +1676,7 @@ function ThreadFeedPlaceholder(props: {
16741676

16751677
export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
16761678
const workflowOpening = useWorkflowOpening(props.environmentId, props.threadId);
1679+
const ignoredCommandPrefixes = useAtomValue(ignoredCommandPrefixesAtom);
16771680
const deviceType = useDeviceType();
16781681
const duoColumns = useNativeWorkspaceColumnsSupported() && isDuoDevice(deviceType);
16791682
const openPullRequest = useOpenPullRequest();
@@ -2162,12 +2165,14 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {
21622165
),
21632166
props.activeWorkStartedAt,
21642167
props.runlessWorkActive ?? false,
2168+
ignoredCommandPrefixes,
21652169
),
21662170
props.feed,
21672171
props.queuedMessages,
21682172
),
21692173
[
21702174
props.queuedMessages,
2175+
ignoredCommandPrefixes,
21712176
expandedTurnIds,
21722177
expandedWorkGroups,
21732178
props.activeWorkStartedAt,

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { ignoredCommandPrefixesAtom } from "../../state/preferences";
12
import { SubagentStatusDot } from "./SubagentStatusDot";
23
import { ThreadSubagentGroup } from "./thread-subagent-group";
34
import {
@@ -893,6 +894,7 @@ const ThreadWorkLogRow = memo(function ThreadWorkLogRow(
893894
},
894895
) {
895896
const { row, expanded } = props;
897+
const ignoredCommandPrefixes = useAtomValue(ignoredCommandPrefixesAtom);
896898
const navigation = useNavigation();
897899
// Command rows stream their output, including the final output, from the server.
898900
const streamsOutput =
@@ -1030,12 +1032,12 @@ const ThreadWorkLogRow = memo(function ThreadWorkLogRow(
10301032
</Text>
10311033
);
10321034
const toolPresentation = resolveWorkEntryToolPresentation(row.workEntry);
1033-
const previewText = workEntryRowLabel(row.workEntry);
1035+
const previewText = workEntryRowLabel(row.workEntry, false, ignoredCommandPrefixes);
10341036
const answerPreview = row.workEntry.questionAnswer
10351037
? getQuestionAnswerPreview(row.workEntry.questionAnswer)
10361038
: null;
10371039
const accessiblePreview = [previewText, answerPreview].filter(Boolean).join(": ");
1038-
const displayText = workEntryRowLabel(row.workEntry, expanded);
1040+
const displayText = workEntryRowLabel(row.workEntry, expanded, ignoredCommandPrefixes);
10391041
const isSystemNotice = row.projectedItem.item.type === "system_notice";
10401042
const isUsageLimit =
10411043
row.projectedItem.item.type === "error" &&

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

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1282,6 +1282,50 @@ describe("buildThreadFeed", () => {
12821282
expect(presented.some((entry) => entry.type === "thinking")).toBe(false);
12831283
});
12841284

1285+
it("refreshes cached command summaries when ignored prefixes change", () => {
1286+
const { exitCode: _exitCode, ...completedCommand } = command();
1287+
const runningCommand: OrchestrationV2TurnItem = {
1288+
...completedCommand,
1289+
input: "rtk proxy git status",
1290+
runId: null,
1291+
status: "running",
1292+
completedAt: null,
1293+
output: "",
1294+
};
1295+
const feed = buildThreadFeed([projected(runningCommand, 0)]);
1296+
const present = (prefixes: ReadonlyArray<string>) =>
1297+
deriveThreadFeedPresentation(
1298+
feed,
1299+
null,
1300+
new Set(),
1301+
new Set(),
1302+
"2026-06-20T00:00:01.000Z",
1303+
true,
1304+
prefixes,
1305+
);
1306+
const prefixes = ["rtk", "rtk proxy"];
1307+
expect(present([]).find((row) => row.type === "work-toggle")).toMatchObject({
1308+
summary: "Running rtk",
1309+
});
1310+
expect(present(prefixes).find((row) => row.type === "work-toggle")).toMatchObject({
1311+
summary: "Running git",
1312+
});
1313+
expect(present(prefixes).find((row) => row.type === "work-toggle")).toBe(
1314+
present(prefixes).find((row) => row.type === "work-toggle"),
1315+
);
1316+
expect(present([]).find((row) => row.type === "work-toggle")).toMatchObject({
1317+
summary: "Running rtk",
1318+
});
1319+
expect(runningCommand.input).toBe("rtk proxy git status");
1320+
1321+
for (const group of feed) {
1322+
if (group.type !== "activity-group") continue;
1323+
const entry = group.activities[0]!.workEntry;
1324+
expect(workEntryRowLabel(entry, false, prefixes)).toBe("git status");
1325+
expect(workEntryRowLabel(entry, true, prefixes)).toBe("rtk proxy git status");
1326+
}
1327+
});
1328+
12851329
it("keeps a runless tail folded while a normal thread waits for its sent run", () => {
12861330
const startedAt = "2026-06-20T00:00:05.000Z";
12871331
const feed = buildThreadFeed([

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

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ import type {
5252
ScheduledTaskId,
5353
TurnItemId,
5454
} from "@t3tools/contracts";
55-
import { RunId, ThreadId } from "@t3tools/contracts";
55+
import { DEFAULT_CLIENT_SETTINGS, RunId, ThreadId } from "@t3tools/contracts";
5656
import {
5757
classifyToolActivity,
5858
collectToolFilePaths,
@@ -253,12 +253,19 @@ function compactWorkEntryText(value: string): string {
253253
return value.replace(/\s+/gu, " ").trim();
254254
}
255255

256-
export function workEntryRowLabel(entry: WorkLogPresentationEntry, expanded = false): string {
256+
export function workEntryRowLabel(
257+
entry: WorkLogPresentationEntry,
258+
expanded = false,
259+
ignoredCommandPrefixes: ReadonlyArray<string> = [],
260+
): string {
257261
if (expanded && entry.itemType === "reasoning")
258262
return entry.toolLifecycleStatus === "inProgress" ? "Thinking" : "Thought";
259263
const presentation = resolveWorkEntryToolPresentation(entry);
260264
if (presentation) return presentation.displayName;
261-
if (entry.command?.trim()) return compactWorkEntryText(commandDisplayText(entry.command));
265+
if (entry.command?.trim())
266+
return compactWorkEntryText(
267+
commandDisplayText(entry.command, expanded ? [] : ignoredCommandPrefixes),
268+
);
262269
const action = toolGroupAction(entry);
263270
const isToolRead = action === "read" && entry.itemType === "dynamic_tool";
264271
if (action === "code-search" || action === "search") {
@@ -318,6 +325,7 @@ const presentedActivityGroupsCache = new WeakMap<
318325
readonly activeRunId: RunId | null;
319326
readonly isWorking: boolean;
320327
readonly activeTail: boolean;
328+
readonly ignoredCommandPrefixes: ReadonlyArray<string>;
321329
readonly rows: ReadonlyArray<ThreadFeedEntry>;
322330
}
323331
>();
@@ -854,15 +862,23 @@ function toFeedActivity(
854862
};
855863
}
856864

857-
function singleToolCallLabel(activity: ThreadFeedActivity, expanded: boolean): string {
865+
function singleToolCallLabel(
866+
activity: ThreadFeedActivity,
867+
expanded: boolean,
868+
ignoredCommandPrefixes: ReadonlyArray<string>,
869+
): string {
858870
if (activity.workEntry.itemType === "reasoning")
859871
return expanded
860872
? "Thought"
861873
: compactWorkEntryText(activity.workEntry.detail ?? "") || "Thought";
862874
const presentation = resolveWorkEntryToolPresentation(activity.workEntry, "completed");
863875
if (presentation) return presentation.displayName;
864876
const command = activity.workEntry.command?.trim();
865-
return command || activity.summary;
877+
return command
878+
? ignoredCommandPrefixes.length > 0
879+
? commandDisplayText(command, ignoredCommandPrefixes)
880+
: command
881+
: activity.summary;
866882
}
867883

868884
function isEmptyMessage(entry: RawThreadFeedEntry): boolean {
@@ -1238,6 +1254,7 @@ export function deriveThreadFeedPresentation(
12381254
expandedWorkGroupIds: ReadonlySet<string> = new Set(),
12391255
activeWorkStartedAt: string | null = null,
12401256
runlessWorkActive = false,
1257+
ignoredCommandPrefixes: ReadonlyArray<string> = DEFAULT_CLIENT_SETTINGS.ignoredCommandPrefixes,
12411258
): ThreadFeedEntry[] {
12421259
const retainedFeed = feed.filter(
12431260
(entry) =>
@@ -1324,6 +1341,7 @@ export function deriveThreadFeedPresentation(
13241341
activeRunId,
13251342
isWorking,
13261343
isActiveTailGroup,
1344+
ignoredCommandPrefixes,
13271345
);
13281346
}
13291347
}
@@ -1387,6 +1405,7 @@ function appendPresentedFeedEntry(
13871405
activeRunId: RunId | null,
13881406
isWorking: boolean,
13891407
activeTail: boolean,
1408+
ignoredCommandPrefixes: ReadonlyArray<string>,
13901409
): void {
13911410
if (entry.type !== "activity-group") {
13921411
result.push(entry);
@@ -1408,13 +1427,22 @@ function appendPresentedFeedEntry(
14081427
cached.activeRunId !== activeRunId ||
14091428
cached.isWorking !== isWorking ||
14101429
cached.activeTail !== activeTail ||
1430+
cached.ignoredCommandPrefixes !== ignoredCommandPrefixes ||
14111431
cached.rows.some(
14121432
(row) => row.type === "work-toggle" && expandedWorkGroupIds.has(row.groupId) !== row.expanded,
14131433
)
14141434
) {
14151435
const rows: ThreadFeedEntry[] = [];
1416-
appendActivityGroupRows(rows, entry, expandedWorkGroupIds, activeRunId, isWorking, activeTail);
1417-
cached = { activeRunId, isWorking, activeTail, rows };
1436+
appendActivityGroupRows(
1437+
rows,
1438+
entry,
1439+
expandedWorkGroupIds,
1440+
activeRunId,
1441+
isWorking,
1442+
activeTail,
1443+
ignoredCommandPrefixes,
1444+
);
1445+
cached = { activeRunId, isWorking, activeTail, ignoredCommandPrefixes, rows };
14181446
presentedActivityGroupsCache.set(entry, cached);
14191447
}
14201448
for (const row of cached.rows) {
@@ -1429,6 +1457,7 @@ function appendActivityGroupRows(
14291457
activeRunId: RunId | null,
14301458
isWorking: boolean,
14311459
activeTail: boolean,
1460+
ignoredCommandPrefixes: ReadonlyArray<string>,
14321461
): void {
14331462
const groupAnchorIdByActivityId = new Map<string, string>();
14341463
let groupAnchorId: string | null = null;
@@ -1462,6 +1491,7 @@ function appendActivityGroupRows(
14621491
activeRunId,
14631492
isWorking,
14641493
activeTail && isTrailingRun,
1494+
ignoredCommandPrefixes,
14651495
);
14661496
groupableRun = [];
14671497
};
@@ -1493,6 +1523,7 @@ function appendToolGroupRows(
14931523
activeRunId: RunId | null,
14941524
isWorking: boolean,
14951525
activeTail: boolean,
1526+
ignoredCommandPrefixes: ReadonlyArray<string>,
14961527
): void {
14971528
const expanded = expandedWorkGroupIds.has(groupId);
14981529
const latestActiveActivity = activities.findLast(
@@ -1519,11 +1550,11 @@ function appendToolGroupRows(
15191550
? latestActivity.lifecycleStatus === "inProgress"
15201551
? "Thinking"
15211552
: "Thought"
1522-
: liveToolActivitySummary(latestActivity, live)
1553+
: liveToolActivitySummary(latestActivity, live, ignoredCommandPrefixes)
15231554
: singleActivity !== null &&
15241555
singleActivity.toolLike &&
15251556
toolGroupAction(singleActivity.workEntry) !== "edit"
1526-
? singleToolCallLabel(singleActivity, expanded)
1557+
? singleToolCallLabel(singleActivity, expanded, ignoredCommandPrefixes)
15271558
: singleActivity !== null && !singleActivity.toolLike
15281559
? singleActivity.workEntry.label
15291560
: groupSummary.summary;
@@ -1598,7 +1629,11 @@ function appendToolGroupRows(
15981629
});
15991630
}
16001631

1601-
function liveToolActivitySummary(activity: ThreadFeedActivity, presentTense: boolean): string {
1632+
function liveToolActivitySummary(
1633+
activity: ThreadFeedActivity,
1634+
presentTense: boolean,
1635+
ignoredCommandPrefixes: ReadonlyArray<string>,
1636+
): string {
16021637
const status = liveActivityToolStatus(activity.lifecycleStatus, presentTense);
16031638
if (activity.workEntry.itemType === "reasoning") {
16041639
return (
@@ -1613,7 +1648,7 @@ function liveToolActivitySummary(activity: ThreadFeedActivity, presentTense: boo
16131648
if (presentation) return presentation.displayName;
16141649
const command = activity.workEntry.command?.trim();
16151650
if (command) {
1616-
const program = commandProgramName(command);
1651+
const program = commandProgramName(command, ignoredCommandPrefixes);
16171652
const verb =
16181653
status === "inProgress"
16191654
? "Running"

0 commit comments

Comments
 (0)