@devries-cameron20 / t3code Mirror · read-only / commits / 3d78e915e3
Fork 0

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, 03:15 UTC

feat(web): a Labs setting hides tool calls so threads read like a chat (#30000)

Co-authored-by: maria-rcks <maria@kuuro.net>

oliver committed Nov 5, 2026 at 19:47 UTC 3d78e915e3998eed664469486527b596af8f2f3e
19 files changed +753 -43
apps/mobile/src/features/settings/ThreadSettingsSections.tsx
+43
@@ -21,6 +21,8 @@ import { serverEnvironment } from "../../state/server";
21 import { useAtomCommand } from "../../state/use-atom-command";
22 import { SettingsSection } from "./components/SettingsSection";
23 import { SettingsSwitchRow } from "./components/SettingsSwitchRow";
24 +import { ListChoiceRow } from "../../components/ui/ListChoiceRow";
25 +import type { ToolCallVisibility } from "@t3tools/contracts/settings";
26 import { SettingsScreen } from "./components/SettingsScreen";
27 import { planAutoSettleSettingsSync, type AutoSettleSettings } from "./autoSettleSettingsSync";
28 import { useSettingsEnvironmentFilter } from "./settings-environment-filter";
@@ -42,6 +44,7 @@ export function SettingsLabsRouteScreen() {
44 contentContainerClassName="gap-6 px-5 pt-4"
45 contentContainerStyle={{ paddingBottom: Math.max(insets.bottom, 18) + 18 }}
46 >
47 + <ToolCallVisibilitySection />
48 <BetaSettingsSection />
49 <LegacySettingsSection />
50 </ScrollView>
@@ -271,6 +274,46 @@ function BetaSettingsSection() {
274 );
275 }
276
277 +const TOOL_CALL_VISIBILITY_OPTIONS: ReadonlyArray<{
278 + readonly value: ToolCallVisibility;
279 + readonly label: string;
280 +}> = [
281 + { value: "showAll", label: "Show all" },
282 + { value: "hideSuccessful", label: "Hide successful" },
283 + { value: "hideAll", label: "Hide all" },
284 + { value: "zen", label: "Zen" },
285 +];
286 +
287 +function ToolCallVisibilitySection() {
288 + const savePreferences = useAtomSet(updateMobilePreferencesAtom);
289 + const preferences = useAtomValue(mobilePreferencesAtom);
290 + const selected = AsyncResult.isSuccess(preferences)
291 + ? (preferences.value.toolCallVisibility ?? "showAll")
292 + : null;
293 +
294 + return (
295 + <View className="gap-3">
296 + <SettingsSection title="Beta: Tool calls in chat">
297 + {TOOL_CALL_VISIBILITY_OPTIONS.map((option, index) => (
298 + <ListChoiceRow
299 + key={option.value}
300 + label={option.label}
301 + selected={selected === option.value}
302 + separated={index > 0}
303 + disabled={selected === null}
304 + onPress={() => savePreferences({ toolCallVisibility: option.value })}
305 + />
306 + ))}
307 + </SettingsSection>
308 + <Text className="px-2 text-sm text-foreground-muted">
309 + Hide the commands, edits, and searches agents run, so a thread reads like a conversation.
310 + Hide successful keeps calls that fail. Zen also hides the agent&apos;s in-between messages
311 + and shows only final answers. Approvals, questions, and errors always show.
312 + </Text>
313 + </View>
314 + );
315 +}
316 +
317 function LegacySettingsSection() {
318 const savePreferences = useAtomSet(updateMobilePreferencesAtom);
319 const preferences = useAtomValue(mobilePreferencesAtom);
apps/mobile/src/features/settings/settings-search.ts
+13 -1
@@ -98,7 +98,19 @@ const SETTINGS_SEARCH_TERMS = {
98 "submodules",
99 "start from remote",
100 ],
101 - SettingsLabs: ["legacy", "plan mode", "beta", "linked environments", "link machine"],
101 + SettingsLabs: [
102 + "legacy",
103 + "plan mode",
104 + "beta",
105 + "linked environments",
106 + "link machine",
107 + "tool calls in chat",
108 + "hide tool calls",
109 + "commands edits searches",
110 + "work log",
111 + "zen",
112 + "final answers only",
113 + ],
114 SettingsEnvironmentMaintenance: ["updates", "provider updates", "restart", "manage environments"],
115 SettingsAbout: [
116 "version",
apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+6
@@ -10,6 +10,7 @@ import {
10 import { AsyncResult, Atom } from "effect/reactivity";
11 import * as Dialog from "../../components/ui/Dialog";
12 import { useAtomMount, useAtomValue } from "@effect/atom-react";
13 +import { mobilePreferencesAtom } from "../../state/preferences";
14 import { parseThreadKey, threadKey } from "@t3tools/client-runtime/state/entities";
15 import { createThreadVisitTracker } from "@t3tools/client-runtime/state/thread-visits";
16 import { useChildThreadInputs, useThreadReportedModelSelection } from "../../state/entities";
@@ -480,6 +481,10 @@ function ThreadDetailBody(
481 threadId: props.selectedThread.id,
482 });
483 const composerError = useAtomValue(threadComposerErrorsAtom)[selectedThreadKey]?.message ?? null;
484 + const preferences = useAtomValue(mobilePreferencesAtom);
485 + const toolCallVisibility = AsyncResult.isSuccess(preferences)
486 + ? (preferences.value.toolCallVisibility ?? "showAll")
487 + : "showAll";
488 const queuedCount = useThreadQueuedCount(props.selectedThreadDetailRef);
489 const turnSubagents = useThreadTurnSubagents(props.selectedThreadDetailRef);
490 const agentsSegment = resolveSubagentPillSegment(turnSubagents);
@@ -1474,6 +1479,7 @@ function ThreadDetailBody(
1479 >
1480 <WorkspaceMutationIdProvider threadRef={props.selectedThreadDetailRef}>
1481 <ThreadFeed
1482 + toolCallVisibility={toolCallVisibility}
1483 environmentId={props.environmentId}
1484 threadId={props.selectedThread.id}
1485 detailRef={props.selectedThreadDetailRef}
apps/mobile/src/features/threads/ThreadFeed.tsx
+19 -3
@@ -59,6 +59,7 @@ import {
59 type ScheduledTaskId,
60 type ScopedThreadRef,
61 } from "@t3tools/contracts";
62 +import type { ToolCallVisibility } from "@t3tools/contracts/settings";
63 import { renderAssistantCitationsAsText } from "@t3tools/shared/assistantCitations";
64 import { encodeComposerContextFragment } from "@t3tools/shared/composerContextClipboard";
65 import { hostedThreadLink, parseThreadLinkHref } from "@t3tools/shared/threadLinks";
@@ -339,6 +340,7 @@ export interface ThreadFeedHandle {
340 }
341
342 export interface ThreadFeedProps {
343 + readonly toolCallVisibility?: ToolCallVisibility;
344 readonly worktreeSetup?: WorktreeSetupCardProps | null;
345 readonly setupWorkingStartedAt?: string | null;
346 readonly queuedMessages: ReadonlyArray<QueuedThreadMessage>;
@@ -1739,7 +1741,13 @@ function renderFeedEntry(
1741 }
1742
1743 if (entry.type === "thinking") {
1742 - return <ThreadThinkingRow rowSizing={props.workRowSizing} iconSubtleColor={iconSubtleColor} />;
1744 + return (
1745 + <ThreadThinkingRow
1746 + rowSizing={props.workRowSizing}
1747 + iconSubtleColor={iconSubtleColor}
1748 + label={entry.label}
1749 + />
1750 + );
1751 }
1752
1753 if (entry.type === "html-render") {
@@ -2565,6 +2573,7 @@ function useThreadFeedPresentation(
2573 props: ThreadFeedProps,
2574 expandedTurnIds: ReadonlySet<RunId>,
2575 expandedWorkGroups: Record<string, boolean>,
2576 + revealedMessageId: MessageId | null,
2577 ) {
2578 const [feedCache] = useState(createThreadFeedCache);
2579 return appendPendingThreadMessages(
@@ -2580,6 +2589,7 @@ function useThreadFeedPresentation(
2589 props.activeWorkStartedAt,
2590 props.runlessWorkActive ?? false,
2591 feedCache,
2592 + { toolCallVisibility: props.toolCallVisibility ?? "showAll", revealedMessageId },
2593 ),
2594 props.feed,
2595 props.queuedMessages,
@@ -2735,13 +2745,16 @@ export const ThreadFeed = memo(function ThreadFeed({
2745 readonly expandedWorkGroups: Record<string, boolean>;
2746 readonly expandedWorkRows: Record<string, boolean>;
2747 readonly expandedTurnIds: ReadonlySet<RunId>;
2748 + readonly revealedMessageId: MessageId | null;
2749 }>({
2750 copiedRowId: null,
2751 expandedWorkGroups: {},
2752 expandedWorkRows: {},
2753 expandedTurnIds: new Set(),
2754 + revealedMessageId: null,
2755 });
2744 - const { copiedRowId, expandedWorkGroups, expandedWorkRows, expandedTurnIds } = interactionState;
2756 + const { copiedRowId, expandedWorkGroups, expandedWorkRows, expandedTurnIds, revealedMessageId } =
2757 + interactionState;
2758 const markdownLinkRequest = useRef<AbortController | null>(null);
2759 const onInlinePlaybackStart = () => {
2760 markdownLinkRequest.current?.abort();
@@ -3301,8 +3314,11 @@ export const ThreadFeed = memo(function ThreadFeed({
3314 const [loadedListKey, setLoadedListKey] = useState<string | null>(null);
3315 const { jumpToMessageId } = props;
3316 const jumpReady = !!jumpToMessageId && loadedListKey === `${feedThreadKey}:filled`;
3317 + if (jumpReady && revealedMessageId !== jumpToMessageId) {
3318 + setInteractionState((current) => ({ ...current, revealedMessageId: jumpToMessageId }));
3319 + }
3320 const presentedFeed = appendGuestPendingMessages(
3305 - useThreadFeedPresentation(props, expandedTurnIds, expandedWorkGroups),
3321 + useThreadFeedPresentation(props, expandedTurnIds, expandedWorkGroups, revealedMessageId),
3322 guestShare,
3323 );
3324 const jumpRunId =
apps/mobile/src/features/threads/thread-work-log.tsx
+4 -2
@@ -1456,11 +1456,13 @@ export function ThreadWorkGroupToggle(props: {
1456 export function ThreadThinkingRow(props: {
1457 readonly rowSizing: ReturnType<typeof deriveThreadWorkLogSizing>;
1458 readonly iconSubtleColor: ColorValue;
1459 + readonly label?: string;
1460 }) {
1461 + const label = props.label ?? "Thinking";
1462 return (
1463 <View
1464 accessible
1463 - accessibilityLabel="Thinking"
1465 + accessibilityLabel={label}
1466 className="-mx-1 min-h-8 flex-row items-center px-1.5 py-0"
1467 style={{ minHeight: props.rowSizing.estimatedRowHeight }}
1468 >
@@ -1468,7 +1470,7 @@ export function ThreadThinkingRow(props: {
1470 key={props.rowSizing.textSizeKey}
1471 icon="brain"
1472 iconSubtleColor={props.iconSubtleColor}
1471 - label="Thinking"
1473 + label={label}
1474 showIcon
1475 />
1476 </View>
apps/mobile/src/lib/threadActivity.test.ts
+84
@@ -1257,6 +1257,90 @@ describe("buildThreadFeed", () => {
1257 ),
1258 ).toEqual([]);
1259 });
1260 + it("hides tool calls or everything but the final answer", () => {
1261 + const at = (second: number) => `2026-06-20T00:00:${String(second).padStart(2, "0")}.000Z`;
1262 + const say = (name: string, second: number, user = false, steer = false) => ({
1263 + ...(user ? userMessage(at(second)) : assistantMessage(at(second))),
1264 + id: TurnItemId.make(name),
1265 + messageId: MessageId.make(name),
1266 + text: name,
1267 + ...(steer ? { inputIntent: "steer" as const } : {}),
1268 + });
1269 + const ran = (name: string, second: number, status: "completed" | "failed") => ({
1270 + ...command(at(second)),
1271 + id: TurnItemId.make(name),
1272 + status,
1273 + });
1274 + const [user, step, passed, failed, final] = [
1275 + say("user", 1, true),
1276 + say("step", 2),
1277 + ran("passed", 3, "completed"),
1278 + ran("failed", 4, "failed"),
1279 + say("final", 5),
1280 + ];
1281 + const running = { runId, status: "running" as const, startedAt: at(1), completedAt: null };
1282 + const rows = (
1283 + items: ReadonlyArray<OrchestrationV2TurnItem>,
1284 + toolCallVisibility: "hideSuccessful" | "hideAll" | "zen",
1285 + latestRun: ThreadFeedLatestRun | null = null,
1286 + ) =>
1287 + deriveThreadFeedPresentation(
1288 + buildThreadFeed(items.map((item, index) => projected(item, index))),
1289 + latestRun,
1290 + new Set([runId]),
1291 + new Set(),
1292 + latestRun ? at(1) : null,
1293 + false,
1294 + undefined,
1295 + { toolCallVisibility, revealedMessageId: null },
1296 + ).map((row) =>
1297 + row.type === "activity-group"
1298 + ? row.activities.map((activity) => activity.projectedItem.item.id).join("+")
1299 + : row.type === "thinking"
1300 + ? `thinking:${row.label ?? ""}`
1301 + : row.type === "run-fold"
1302 + ? "fold"
1303 + : row.id,
1304 + );
1305 +
1306 + const turn = [user, step, passed, failed, final];
1307 + expect(rows(turn, "hideSuccessful")).toEqual(["user", "fold", "step", "failed", "final"]);
1308 + expect(rows(turn, "hideAll")).toEqual(["user", "fold", "step", "final"]);
1309 + expect(rows(turn, "zen")).toEqual(["user", "final"]);
1310 + const [steer, answer] = [say("steer", 2, true, true), say("answer", 3)];
1311 + expect(rows([user, steer, answer, final], "zen")).toEqual(["user", "steer", "answer", "final"]);
1312 + expect(rows([user, steer, step, passed, final], "zen")).toEqual(["user", "steer", "final"]);
1313 + expect(rows([user, steer, answer, step], "zen", running)).toEqual([
1314 + "user",
1315 + "steer",
1316 + "answer",
1317 + "thinking:step",
1318 + ]);
1319 + expect(rows([user, step, passed], "zen", running)).toEqual(["user", "thinking:step"]);
1320 + expect(rows(turn, "zen", { ...running, turnEnded: true })).toEqual(["user", "final"]);
1321 + const nextRun = { ...running, runId: RunId.make("run-2") };
1322 + const followUp = { ...say("follow-up", 6, true), runId: nextRun.runId };
1323 + expect(rows([...turn, followUp], "zen", nextRun)).toEqual([
1324 + "user",
1325 + "final",
1326 + "follow-up",
1327 + "thinking:",
1328 + ]);
1329 + const wake: OrchestrationV2TurnItem = {
1330 + ...base("wake", at(6), 5),
1331 + runId: nextRun.runId,
1332 + type: "notification",
1333 + source: { kind: "background_task" },
1334 + outcome: "completed",
1335 + summary: "Task finished",
1336 + };
1337 + expect(rows([user, final, wake], "zen", nextRun)).toEqual([
1338 + "user",
1339 + "final",
1340 + "wake",
1341 + "thinking:",
1342 + ]);
1343 + });
1344 });
1345
1346 describe("retained v2 feed presentation", () => {
apps/mobile/src/lib/threadActivity.ts
+193 -18
@@ -29,7 +29,9 @@ import {
29 type ToolGroupSummaryKind,
30 type WorkLogPresentationEntry,
31 type WorkLogToolLifecycleStatus,
32 + workEntryHiddenByToolCallVisibility,
33 } from "@t3tools/client-runtime/work-log/presentation";
34 +import type { ToolCallVisibility } from "@t3tools/contracts/settings";
35 import {
36 resolveT3McpToolDefinition,
37 resolveT3McpToolPresentation,
@@ -235,6 +237,7 @@ type ThreadFeedEntryContent =
237 readonly id: string;
238 readonly createdAt: string;
239 readonly runId: RunId | null;
240 + readonly label?: string;
241 };
242
243 export interface ThreadFeedLatestRun {
@@ -1281,6 +1284,7 @@ interface ThreadFeedPresentationBuild {
1284 readonly expandedWorkGroupIds: ReadonlySet<string>;
1285 readonly activeWorkStartedAt: string | null;
1286 readonly runlessWorkActive: boolean;
1287 + readonly display: ThreadFeedDisplay;
1288 readonly rows: ReadonlyArray<ThreadFeedEntry>;
1289 /** Feed entry `entry` is a user message whose rows start at `rowsLength`. */
1290 readonly restarts: ReadonlyArray<{ readonly entry: number; readonly rowsLength: number }>;
@@ -1323,12 +1327,15 @@ function presentationRestart(
1327 expandedWorkGroupIds: ReadonlySet<string>,
1328 activeWorkStartedAt: string | null,
1329 runlessWorkActive: boolean,
1330 + display: ThreadFeedDisplay,
1331 ): { readonly entry: number; readonly rowsLength: number; readonly index: number } | null {
1332 if (
1333 previous === null ||
1334 !latestRunsEqual(previous.latestRun, latestRun) ||
1335 previous.activeWorkStartedAt !== activeWorkStartedAt ||
1336 previous.runlessWorkActive !== runlessWorkActive ||
1337 + previous.display.toolCallVisibility !== display.toolCallVisibility ||
1338 + previous.display.revealedMessageId !== display.revealedMessageId ||
1339 !setsEqual(previous.expandedRunIds, expandedRunIds) ||
1340 !setsEqual(previous.expandedWorkGroupIds, expandedWorkGroupIds)
1341 ) {
@@ -1347,6 +1354,143 @@ function presentationRestart(
1354 return { ...restart, index };
1355 }
1356
1357 +const visibleActivityGroups = new WeakMap<
1358 + ThreadFeedActivityGroup,
1359 + { readonly visibility: ToolCallVisibility; readonly group: ThreadFeedActivityGroup | null }
1360 +>();
1361 +
1362 +function zenKeepsActivity(activity: ThreadFeedActivity): boolean {
1363 + const item = activity.projectedItem.item;
1364 + return (
1365 + activity.prominent ||
1366 + activity.workEntry.questionAnswer !== undefined ||
1367 + item.type === "compaction" ||
1368 + item.type === "handoff" ||
1369 + item.type === "notification" ||
1370 + (item.type === "error" && item.status !== "completed")
1371 + );
1372 +}
1373 +
1374 +function activityGroupForVisibility(
1375 + entry: ThreadFeedActivityGroup,
1376 + visibility: ToolCallVisibility,
1377 +): ThreadFeedActivityGroup | null {
1378 + const cached = visibleActivityGroups.get(entry);
1379 + if (cached?.visibility === visibility) return cached.group;
1380 + const activities = entry.activities.filter((activity) =>
1381 + visibility === "zen"
1382 + ? zenKeepsActivity(activity)
1383 + : !workEntryHiddenByToolCallVisibility(activity.workEntry, visibility),
1384 + );
1385 + const group =
1386 + activities.length === 0
1387 + ? null
1388 + : activities.length === entry.activities.length
1389 + ? entry
1390 + : { ...entry, activities };
1391 + visibleActivityGroups.set(entry, { visibility, group });
1392 + return group;
1393 +}
1394 +
1395 +function isSteerMessage(message: ThreadFeedMessage): boolean {
1396 + return (
1397 + message.role === "user" &&
1398 + (message.inputIntent === "steer" || message.inputIntent === "promoted_queued_to_steer")
1399 + );
1400 +}
1401 +
1402 +function startsResponse(entry: ThreadFeedEntry): boolean {
1403 + return (
1404 + (entry.type === "message" && entry.message.role === "user" && !isSteerMessage(entry.message)) ||
1405 + (entry.type === "activity-group" &&
1406 + entry.activities.some((activity) => activity.projectedItem.item.type === "notification"))
1407 + );
1408 +}
1409 +
1410 +function zenAnswerMessageIds(
1411 + feed: ReadonlyArray<ThreadFeedEntry>,
1412 + start: number,
1413 + answering: boolean,
1414 + answeringRunId: RunId | null,
1415 +): ReadonlySet<MessageId> {
1416 + const replies: Array<{ readonly message: ThreadFeedMessage; readonly index: number }> = [];
1417 + const lastReplyByResponse = new Map<string, MessageId>();
1418 + const steerAnswers = new Set<MessageId>();
1419 + let userMessages = 0;
1420 + let awaitingReply = false;
1421 + let candidate: MessageId | null = null;
1422 + let answeringFrom = answering ? start : feed.length;
1423 + for (let index = start; index < feed.length; index += 1) {
1424 + const entry = feed[index]!;
1425 + if (
1426 + entry.type === "activity-group" &&
1427 + entry.activities.every((activity) => activity.workEntry.itemType === "reasoning")
1428 + ) {
1429 + continue;
1430 + }
1431 + const reply =
1432 + entry.type === "message" && entry.message.role === "assistant" ? entry.message : null;
1433 + if (candidate !== null && reply !== null) steerAnswers.add(candidate);
1434 + candidate = null;
1435 + if (answering && startsResponse(entry)) answeringFrom = index + 1;
1436 + if (entry.type === "message" && entry.message.role === "user") {
1437 + userMessages += 1;
1438 + awaitingReply = isSteerMessage(entry.message);
1439 + } else if (reply !== null) {
1440 + replies.push({ message: reply, index });
1441 + lastReplyByResponse.set(reply.runId ?? `runless:${userMessages}`, reply.id);
1442 + if (awaitingReply) {
1443 + candidate = reply.id;
1444 + awaitingReply = false;
1445 + }
1446 + }
1447 + }
1448 + const terminal = new Set(lastReplyByResponse.values());
1449 + return new Set(
1450 + replies
1451 + .filter(
1452 + ({ message, index }) =>
1453 + steerAnswers.has(message.id) ||
1454 + (terminal.has(message.id) &&
1455 + index < answeringFrom &&
1456 + (answeringRunId === null || message.runId !== answeringRunId)),
1457 + )
1458 + .map(({ message }) => message.id),
1459 + );
1460 +}
1461 +
1462 +function liveAnswerPreview(feed: ReadonlyArray<ThreadFeedEntry>): string | null {
1463 + for (let index = feed.length - 1; index >= 0; index -= 1) {
1464 + const entry = feed[index]!;
1465 + if (startsResponse(entry)) return null;
1466 + const texts =
1467 + entry.type === "message"
1468 + ? entry.message.role === "assistant"
1469 + ? [entry.message.text]
1470 + : []
1471 + : entry.type === "activity-group"
1472 + ? entry.activities
1473 + .filter((activity) => activity.workEntry.itemType === "reasoning")
1474 + .map((activity) => activity.workEntry.detail ?? "")
1475 + : [];
1476 + for (let textIndex = texts.length - 1; textIndex >= 0; textIndex -= 1) {
1477 + const line = compactWorkEntryText(liveThoughtLine(texts[textIndex]!));
1478 + if (line !== "") return line;
1479 + }
1480 + }
1481 + return null;
1482 +}
1483 +
1484 +export interface ThreadFeedDisplay {
1485 + readonly toolCallVisibility: ToolCallVisibility;
1486 + readonly revealedMessageId: MessageId | null;
1487 +}
1488 +
1489 +const DEFAULT_THREAD_FEED_DISPLAY: ThreadFeedDisplay = {
1490 + toolCallVisibility: "showAll",
1491 + revealedMessageId: null,
1492 +};
1493 +
1494 export function deriveThreadFeedPresentation(
1495 feed: ReadonlyArray<ThreadFeedEntry>,
1496 latestRun: ThreadFeedLatestRun | null,
@@ -1355,6 +1499,7 @@ export function deriveThreadFeedPresentation(
1499 activeWorkStartedAt: string | null = null,
1500 runlessWorkActive = false,
1501 cache?: ThreadFeedCache,
1502 + display: ThreadFeedDisplay = DEFAULT_THREAD_FEED_DISPLAY,
1503 ): ThreadFeedEntry[] {
1504 const previous = cache?.presentation ?? null;
1505 const restart = presentationRestart(
@@ -1365,6 +1510,7 @@ export function deriveThreadFeedPresentation(
1510 expandedWorkGroupIds,
1511 activeWorkStartedAt,
1512 runlessWorkActive,
1513 + display,
1514 );
1515 const start = restart?.entry ?? 0;
1516 const result: ThreadFeedEntry[] =
@@ -1383,10 +1529,36 @@ export function deriveThreadFeedPresentation(
1529 Exclude<ThreadFeedEntry, { readonly type: "run-fold" | "work-toggle" | "thinking" }>
1530 > = [];
1531 const retainedFeedIndices: number[] = [];
1532 + const { toolCallVisibility, revealedMessageId } = display;
1533 + const isWorking = activeWorkStartedAt !== null && latestRun?.status !== "preparing";
1534 + const activeRunId = unsettledRunId(latestRun);
1535 + const zen = toolCallVisibility === "zen";
1536 + const answering = isWorking && latestRun?.turnEnded !== true;
1537 + const zenAnswerIds = zen
1538 + ? zenAnswerMessageIds(feed, start, answering, answering ? activeRunId : null)
1539 + : null;
1540 for (let index = start; index < feed.length; index += 1) {
1387 - const entry = feed[index]!;
1541 + let entry = feed[index]!;
1542 if (entry.type === "run-fold" || entry.type === "work-toggle" || entry.type === "thinking")
1543 continue;
1544 + const runId = feedEntryRunId(entry);
1545 + if (runId !== null) {
1546 + if (!firstEntryByRun.has(runId)) firstEntryByRun.set(runId, index);
1547 + lastEntryByRun.set(runId, index);
1548 + }
1549 + if (entry.type === "activity-group" && toolCallVisibility !== "showAll") {
1550 + const shown = activityGroupForVisibility(entry, toolCallVisibility);
1551 + if (shown === null) continue;
1552 + entry = shown;
1553 + } else if (
1554 + zenAnswerIds !== null &&
1555 + entry.type === "message" &&
1556 + entry.message.role === "assistant" &&
1557 + entry.message.id !== revealedMessageId &&
1558 + !zenAnswerIds.has(entry.message.id)
1559 + ) {
1560 + continue;
1561 + }
1562 retainedFeed.push(entry);
1563 retainedFeedIndices.push(index);
1564 }
@@ -1395,7 +1567,6 @@ export function deriveThreadFeedPresentation(
1567 );
1568 const failedRunIds = failedFeedRunIds(sourceFeed, latestRun);
1569 const activeTailGroup = sourceFeed.at(-1);
1398 - const activeRunId = unsettledRunId(latestRun);
1570 // A bare `/compact` turn is the compaction itself: its compaction row stands in for the prompt
1571 // and the live activity row. An answered "compact before continuing?" question folds into the
1572 // compaction it asked for.
@@ -1416,13 +1587,9 @@ export function deriveThreadFeedPresentation(
1587 compactionItemRunIds.add(entry.runId);
1588 }
1589 }
1419 - const isWorking = activeWorkStartedAt !== null && latestRun?.status !== "preparing";
1420 - const foldsByAnchorId = deriveThreadFeedRunFolds(
1421 - sourceFeed,
1422 - latestRun,
1423 - isWorking && runlessWorkActive,
1424 - failedRunIds,
1425 - );
1590 + const foldsByAnchorId = zen
1591 + ? new Map<string, ThreadFeedRunFold>()
1592 + : deriveThreadFeedRunFolds(sourceFeed, latestRun, isWorking && runlessWorkActive, failedRunIds);
1593 const collapsedEntryIds = new Set<string>();
1594 for (const fold of foldsByAnchorId.values()) {
1595 if (!expandedRunIds.has(fold.runId)) {
@@ -1435,11 +1602,6 @@ export function deriveThreadFeedPresentation(
1602 if (isUserMessageEntry(entry)) {
1603 restarts.push({ entry: feedIndex, rowsLength: result.length });
1604 }
1438 - const runId = feedEntryRunId(entry);
1439 - if (runId !== null) {
1440 - if (!firstEntryByRun.has(runId)) firstEntryByRun.set(runId, feedIndex);
1441 - lastEntryByRun.set(runId, feedIndex);
1442 - }
1605 const isActiveTailGroup =
1606 isWorking &&
1607 (activeRunId !== null || runlessWorkActive) &&
@@ -1531,7 +1693,9 @@ export function deriveThreadFeedPresentation(
1693 row.activities[0]?.projectedItem.item.status === "running"),
1694 )
1695 ) {
1534 - result.push(thinkingRow(activeWorkStartedAt, activeRunId));
1696 + result.push(
1697 + thinkingRow(activeWorkStartedAt, activeRunId, zen ? liveAnswerPreview(feed) : null),
1698 + );
1699 }
1700 const checkpointByRunId = new Map<RunId, ThreadCheckpointSummary>();
1701 for (const entry of sourceFeed) {
@@ -1605,6 +1769,7 @@ export function deriveThreadFeedPresentation(
1769 expandedWorkGroupIds,
1770 activeWorkStartedAt,
1771 runlessWorkActive,
1772 + display,
1773 rows: result,
1774 restarts: cleanRestarts,
1775 firstEntryByRun,
@@ -1634,9 +1799,19 @@ function isWorkLogFeedRow(row: ThreadFeedEntry | undefined): boolean {
1799
1800 const LIVE_ACTIVITY_ROW_ID = "live-activity-row";
1801
1637 -function thinkingRow(createdAt: string, runId: RunId | null) {
1638 - if (cachedThinkingRow?.createdAt !== createdAt || cachedThinkingRow.runId !== runId) {
1639 - cachedThinkingRow = { type: "thinking", id: LIVE_ACTIVITY_ROW_ID, createdAt, runId };
1802 +function thinkingRow(createdAt: string, runId: RunId | null, label: string | null) {
1803 + if (
1804 + cachedThinkingRow?.createdAt !== createdAt ||
1805 + cachedThinkingRow.runId !== runId ||
1806 + (cachedThinkingRow.label ?? null) !== label
1807 + ) {
1808 + cachedThinkingRow = {
1809 + type: "thinking",
1810 + id: LIVE_ACTIVITY_ROW_ID,
1811 + createdAt,
1812 + runId,
1813 + ...(label === null ? {} : { label }),
1814 + };
1815 }
1816 return cachedThinkingRow;
1817 }
apps/mobile/src/persistence/mobile-preferences.ts
+8
@@ -14,6 +14,7 @@ import {
14 type PullRequestMergeMethod,
15 type SidebarProjectGroupingMode,
16 } from "@t3tools/contracts";
17 +import { ToolCallVisibility } from "@t3tools/contracts/settings";
18 import type { AndroidNavigationStyle } from "../lib/androidNavigationStyle";
19 import type { ComposerEnterBehavior } from "../lib/composerEnterBehavior";
20 import type { FollowUpBehavior } from "../lib/followUpBehavior";
@@ -116,6 +117,7 @@ export interface Preferences {
117 readonly projectGroupingEnabled?: boolean;
118 readonly projectGroupingMode?: SidebarProjectGroupingMode;
119 readonly planModeEnabled?: boolean;
120 + readonly toolCallVisibility?: ToolCallVisibility;
121 readonly workingShelfEnabled?: boolean;
122 readonly useLastProjectForNewThreads?: boolean;
123 readonly lastThreadProject?: typeof ThreadProject.Type;
@@ -170,6 +172,8 @@ export class MobilePreferencesStore extends Context.Service<
172 }
173 >()("@t3tools/mobile/persistence/mobile-preferences/MobilePreferencesStore") {}
174
175 +const isToolCallVisibility = Schema.is(ToolCallVisibility);
176 +
177 function sanitizePreferences(parsed: Preferences): Preferences {
178 const preferences: {
179 navigationTabOrder?: readonly string[];
@@ -198,6 +202,7 @@ function sanitizePreferences(parsed: Preferences): Preferences {
202 projectGroupingEnabled?: boolean;
203 projectGroupingMode?: SidebarProjectGroupingMode;
204 planModeEnabled?: boolean;
205 + toolCallVisibility?: ToolCallVisibility;
206 workingShelfEnabled?: boolean;
207 useLastProjectForNewThreads?: boolean;
208 lastThreadProject?: typeof ThreadProject.Type;
@@ -324,6 +329,9 @@ function sanitizePreferences(parsed: Preferences): Preferences {
329 if (typeof parsed.planModeEnabled === "boolean") {
330 preferences.planModeEnabled = parsed.planModeEnabled;
331 }
332 + if (isToolCallVisibility(parsed.toolCallVisibility)) {
333 + preferences.toolCallVisibility = parsed.toolCallVisibility;
334 + }
335 if (typeof parsed.workingShelfEnabled === "boolean") {
336 preferences.workingShelfEnabled = parsed.workingShelfEnabled;
337 }
apps/web/src/components/chat/MessagesTimeline.logic.test.ts
+124
@@ -27,6 +27,7 @@ import {
27 computeStableMessagesTimelineRows,
28 deriveMessagesTimelineRows,
29 timelineTurnFoldRunIdsByEntryId,
30 + liveAnswerPreview,
31 deriveMessagesTimelineRowsWithState,
32 shouldCollapseUserMessage,
33 resolveAssistantMessageCopyState,
@@ -2691,6 +2692,129 @@ describe("v2 run and attempt history", () => {
2692 expect.objectContaining({ id: "provider-recovered" }),
2693 ]);
2694 });
2695 + it("hides tool calls or everything but the final answer", () => {
2696 + const runId = RunId.make("turn-1");
2697 + const at = (second: number) => `2026-01-01T00:00:${String(second).padStart(2, "0")}Z`;
2698 + const message = (
2699 + id: string,
2700 + role: "user" | "assistant",
2701 + second: number,
2702 + inputIntent?: "steer",
2703 + ): TimelineEntry => ({
2704 + id,
2705 + kind: "message",
2706 + createdAt: at(second),
2707 + message: {
2708 + id: MessageId.make(id),
2709 + role,
2710 + text: id,
2711 + runId: role === "user" ? null : runId,
2712 + createdAt: at(second),
2713 + updatedAt: at(second),
2714 + streaming: false,
2715 + ...(inputIntent ? { inputIntent } : {}),
2716 + },
2717 + });
2718 + const command = (
2719 + id: string,
2720 + status: "completed" | "failed",
2721 + second: number,
2722 + ): TimelineEntry => ({
2723 + id,
2724 + kind: "work",
2725 + createdAt: at(second),
2726 + entry: {
2727 + id,
2728 + createdAt: at(second),
2729 + runId,
2730 + label: "Ran command",
2731 + tone: "tool",
2732 + itemType: "command_execution",
2733 + toolLifecycleStatus: status,
2734 + },
2735 + });
2736 + const [user, step, passed, failed, final] = [
2737 + message("user", "user", 0),
2738 + message("step", "assistant", 5),
2739 + command("passed", "completed", 8),
2740 + command("failed", "failed", 9),
2741 + message("final", "assistant", 20),
2742 + ];
2743 + const running = { runId, status: "running" as const, startedAt: at(0), completedAt: null };
2744 + const ended = { ...running, turnEnded: true };
2745 + const rows = (
2746 + timelineEntries: ReadonlyArray<TimelineEntry>,
2747 + toolCallVisibility: "hideSuccessful" | "hideAll" | "zen",
2748 + latestRun?: typeof ended | typeof running,
2749 + ) =>
2750 + deriveMessagesTimelineRows({
2751 + timelineEntries,
2752 + expandedRunIds: new Set([runId]),
2753 + isWorking: latestRun !== undefined,
2754 + ...(latestRun ? { latestRun } : {}),
2755 + turnDiffSummaries: [],
2756 + supportsConversationRollback: false,
2757 + toolCallVisibility,
2758 + }).map((row) => row.id);
2759 +
2760 + const turn = [user, step, passed, failed, final];
2761 + expect(rows(turn, "hideSuccessful")).toEqual([
2762 + "user",
2763 + "turn-fold:turn-1",
2764 + "step",
2765 + "failed",
2766 + "final",
2767 + ]);
2768 + expect(rows([user, failed, final], "hideAll")).toEqual(["user", "final"]);
2769 + expect(rows(turn, "zen")).toEqual(["user", "final"]);
2770 + const [steer, answer] = [
2771 + message("steer", "user", 4, "steer"),
2772 + message("answer", "assistant", 7),
2773 + ];
2774 + expect(rows([user, steer, answer, final], "zen")).toEqual(["user", "steer", "answer", "final"]);
2775 + expect(rows([user, steer, step, passed, final], "zen")).toEqual(["user", "steer", "final"]);
2776 + expect(rows([user, steer, answer, step], "zen", running)).toEqual([
2777 + "user",
2778 + "working-indicator-row",
2779 + "steer",
2780 + "answer",
2781 + "live-activity-row",
2782 + ]);
2783 + expect(rows([user, step, passed], "zen", running)).toEqual([
2784 + "user",
2785 + "working-indicator-row",
2786 + "live-activity-row",
2787 + ]);
2788 + expect(liveAnswerPreview([user, step, passed])).toBe("step");
2789 + expect(rows(turn, "zen", ended)).toEqual(["user", "final"]);
2790 + const followUp = message("follow-up", "user", 30);
2791 + expect(rows([...turn, followUp], "zen", ended)).toEqual([
2792 + "user",
2793 + "final",
2794 + "follow-up",
2795 + "working-indicator-row",
2796 + ]);
2797 + const wake: TimelineEntry = {
2798 + id: "wake",
2799 + kind: "work",
2800 + createdAt: at(30),
2801 + entry: {
2802 + id: "wake",
2803 + createdAt: at(30),
2804 + runId: RunId.make("wake"),
2805 + label: "Task finished",
2806 + tone: "info",
2807 + itemType: "notification",
2808 + },
2809 + };
2810 + expect(rows([user, final, wake], "zen", { ...running, runId: RunId.make("wake") })).toEqual([
2811 + "user",
2812 + "final",
2813 + "wake",
2814 + "working-indicator-row",
2815 + "live-activity-row",
2816 + ]);
2817 + });
2818 it("collapses only output from a superseded V2 attempt within the active logical run", () => {
2819 const runId = "run-steered" as never;
2820 const supersededAttemptId = "attempt-1" as never;
apps/web/src/components/chat/MessagesTimeline.logic.ts
+143 -17
@@ -28,6 +28,8 @@ import {
28 toolGroupSummaryKind,
29 contextCompactionTokenCounts,
30 type ToolGroupSummaryKind,
31 + liveThoughtLine,
32 + workEntryHiddenByToolCallVisibility,
33 } from "@t3tools/client-runtime/work-log/presentation";
34 import {
35 deriveRevertTurnCountByUserMessageId,
@@ -62,6 +64,7 @@ import {
64 type TurnItemId,
65 } from "@t3tools/contracts";
66 import type { ThreadRunSummary } from "@t3tools/client-runtime/state/shell";
67 +import type { ToolCallVisibility } from "@t3tools/contracts/settings";
68 import { resolveT3McpToolDefinition } from "@t3tools/shared/t3McpToolPresentation";
69 import { compactDynamicToolOutput } from "@t3tools/shared/toolOutput";
70 import { htmlRenderReferencesEqual, type HtmlRenderReference } from "@t3tools/shared/htmlRender";
@@ -1361,17 +1364,123 @@ function settleSupersededReasoning(entries: ReadonlyArray<TimelineEntry>) {
1364 });
1365 }
1366
1364 -function timelineRowEntries(entries: ReadonlyArray<TimelineEntry>) {
1365 - return withoutSubagentDelegationRows(settleSupersededReasoning(entries));
1367 +function workShownAsFinalAnswerOnly(
1368 + entry: TimelineEntry,
1369 + pendingApprovalRequestIds: ReadonlySet<RuntimeRequestId> | undefined,
1370 +): boolean {
1371 + if (entry.kind === "event") return entry.projectedItem.item.type !== "subagent";
1372 + if (entry.kind !== "work") return true;
1373 + const work = entry.entry;
1374 + const item = work.projectedItem?.item;
1375 + return (
1376 + (item?.type === "approval_request" &&
1377 + pendingApprovalRequestIds?.has(item.requestId) === true) ||
1378 + work.questionAnswer !== undefined ||
1379 + timelineEntryIsCompaction(entry) ||
1380 + timelineEntryStartsResponse(entry) ||
1381 + work.tone === "error" ||
1382 + work.sourceActivityKind === "runtime.error" ||
1383 + (work.itemType === "error" && work.toolLifecycleStatus !== "completed")
1384 + );
1385 +}
1386 +
1387 +function deriveInFlightSteerAnswerIds(entries: ReadonlyArray<TimelineEntry>): ReadonlySet<string> {
1388 + const ids = new Set<string>();
1389 + let awaitingReply = false;
1390 + let candidate: string | null = null;
1391 + for (const entry of entries) {
1392 + if (entry.kind === "work" && entry.entry.itemType === "reasoning") continue;
1393 + const reply = entry.kind === "message" && entry.message.role === "assistant" ? entry : null;
1394 + if (candidate !== null && reply !== null) ids.add(candidate);
1395 + candidate = null;
1396 + if (timelineEntryIsSteer(entry)) {
1397 + awaitingReply = true;
1398 + } else if (entry.kind === "message" && entry.message.role === "user") {
1399 + awaitingReply = false;
1400 + } else if (reply !== null && awaitingReply) {
1401 + candidate = reply.message.id;
1402 + awaitingReply = false;
1403 + }
1404 + }
1405 + return ids;
1406 +}
1407 +
1408 +export function liveAnswerPreview(entries: ReadonlyArray<TimelineEntry>): string | null {
1409 + const boundary = lastResponseBoundaryIndex(entries);
1410 + for (let index = entries.length - 1; index > boundary; index -= 1) {
1411 + const entry = entries[index]!;
1412 + const text =
1413 + entry.kind === "message" && entry.message.role === "assistant"
1414 + ? entry.message.text
1415 + : entry.kind === "work" && entry.entry.itemType === "reasoning"
1416 + ? (entry.entry.detail ?? "")
1417 + : "";
1418 + const line = liveThoughtLine(text);
1419 + if (line !== "") return line;
1420 + }
1421 + return null;
1422 +}
1423 +
1424 +function timelineRowEntries(
1425 + input: Pick<
1426 + MessagesTimelineRowsInput,
1427 + | "timelineEntries"
1428 + | "toolCallVisibility"
1429 + | "revealedMessageId"
1430 + | "isWorking"
1431 + | "latestRun"
1432 + | "runningRunId"
1433 + | "pendingApprovalRequestIds"
1434 + >,
1435 +) {
1436 + const visibility = input.toolCallVisibility ?? "showAll";
1437 + const entries = input.timelineEntries;
1438 + let shown = entries;
1439 + if (visibility === "zen") {
1440 + const answering = input.isWorking && input.latestRun?.turnEnded !== true;
1441 + const answeringRunId = answering
1442 + ? deriveUnsettledRunId(input.latestRun ?? null, input.runningRunId ?? null)
1443 + : null;
1444 + const answeringFrom = answering ? lastResponseBoundaryIndex(entries) + 1 : entries.length;
1445 + const terminalIds = deriveTerminalAssistantMessageIds(entries);
1446 + const steerAnswerIds = deriveInFlightSteerAnswerIds(entries);
1447 + shown = entries.filter((entry, index) => {
1448 + if (entry.kind !== "message") {
1449 + return workShownAsFinalAnswerOnly(entry, input.pendingApprovalRequestIds);
1450 + }
1451 + const { message } = entry;
1452 + return (
1453 + message.role !== "assistant" ||
1454 + message.id === input.revealedMessageId ||
1455 + steerAnswerIds.has(message.id) ||
1456 + (terminalIds.has(message.id) &&
1457 + index < answeringFrom &&
1458 + (answeringRunId === null || message.runId !== answeringRunId))
1459 + );
1460 + });
1461 + } else if (visibility !== "showAll") {
1462 + shown = entries.filter(
1463 + (entry) =>
1464 + entry.kind !== "work" || !workEntryHiddenByToolCallVisibility(entry.entry, visibility),
1465 + );
1466 + }
1467 + return withoutSubagentDelegationRows(settleSupersededReasoning(shown));
1468 }
1469
1470 function deriveTimelineTurnFolds(
1471 input: Pick<
1472 MessagesTimelineRowsInput,
1371 - "timelineEntries" | "latestRun" | "isWorking" | "runlessWorkActive" | "runningRunId"
1473 + | "timelineEntries"
1474 + | "latestRun"
1475 + | "isWorking"
1476 + | "runlessWorkActive"
1477 + | "runningRunId"
1478 + | "toolCallVisibility"
1479 + | "revealedMessageId"
1480 >,
1481 ) {
1374 - const timelineEntries = timelineRowEntries(input.timelineEntries);
1482 + if (input.toolCallVisibility === "zen") return new Map<string, TurnFold>();
1483 + const timelineEntries = timelineRowEntries(input);
1484 const unsettledRunId = deriveUnsettledRunId(input.latestRun ?? null, input.runningRunId ?? null);
1485 const failedRunIds = failedTimelineRunIds(timelineEntries, input.latestRun ?? null);
1486 const activeVisualResponseRunIds = deriveActiveVisualResponseRunIds({
@@ -1407,8 +1516,10 @@ export function deriveMessagesTimelineRows(input: {
1516 threadStartCheckpointReady?: boolean;
1517 availableRevertTurnCounts?: ReadonlySet<number> | undefined;
1518 worktreeSetup?: WorktreeSetupSnapshot | null;
1519 + toolCallVisibility?: ToolCallVisibility;
1520 + revealedMessageId?: MessageId | null;
1521 }): MessagesTimelineRow[] {
1411 - const timelineEntries = timelineRowEntries(input.timelineEntries);
1522 + const timelineEntries = timelineRowEntries(input);
1523 const isPendingApproval = (entry: WorkLogEntry) => {
1524 const item = entry.projectedItem?.item;
1525 return (
@@ -1425,7 +1536,7 @@ export function deriveMessagesTimelineRows(input: {
1536 const unsettledRunId = deriveUnsettledRunId(input.latestRun ?? null, input.runningRunId ?? null);
1537 const revertTurnCountByUserMessageId = input.supportsConversationRollback
1538 ? deriveRevertTurnCountByUserMessageId({
1428 - timelineEntries: timelineEntries,
1539 + timelineEntries: input.timelineEntries,
1540 checkpoints: input.turnDiffSummaries,
1541 threadStartCheckpointReady: input.threadStartCheckpointReady === true,
1542 unsettledRunId,
@@ -1453,15 +1564,18 @@ export function deriveMessagesTimelineRows(input: {
1564 isWorking: input.isWorking,
1565 });
1566 const runlessWorkActive = input.isWorking && input.runlessWorkActive === true;
1456 - const foldsByAnchorEntryId = deriveTurnFolds({
1457 - timelineEntries: timelineEntries,
1458 - terminalAssistantMessageIds,
1459 - latestRun: input.latestRun ?? null,
1460 - unfoldedRunIds: new Set([...activeVisualResponseRunIds, ...failedRunIds]),
1461 - runlessWorkActive,
1462 - liveSubagentEntryIds,
1463 - completeSupersededReplyEntryIds: completeSupersededReplyIds,
1464 - });
1567 + const foldsByAnchorEntryId =
1568 + input.toolCallVisibility === "zen"
1569 + ? new Map<string, TurnFold>()
1570 + : deriveTurnFolds({
1571 + timelineEntries: timelineEntries,
1572 + terminalAssistantMessageIds,
1573 + latestRun: input.latestRun ?? null,
1574 + unfoldedRunIds: new Set([...activeVisualResponseRunIds, ...failedRunIds]),
1575 + runlessWorkActive,
1576 + liveSubagentEntryIds,
1577 + completeSupersededReplyEntryIds: completeSupersededReplyIds,
1578 + });
1579 const timelineEntryById = new Map(timelineEntries.map((entry) => [entry.id, entry]));
1580 const collapsedEntryIds = new Set<string>();
1581 const collapsedFoldMemberIds = new Set<string>();
@@ -1650,8 +1764,14 @@ export function deriveMessagesTimelineRows(input: {
1764 const activeCompactionRunId = compactsOnReturn
1765 ? runningCompactionRunId
1766 : (resumeCompactionEntry?.entry.runId ?? null);
1767 + const endedRunId = input.latestRun?.turnEnded === true ? input.latestRun.runId : null;
1768 + const zenAnswerLanded =
1769 + input.toolCallVisibility === "zen" &&
1770 + endedRunId !== null &&
1771 + timelineEntries.findLastIndex((entry) => timelineEntryRunId(entry) === endedRunId) >=
1772 + activeTurnHeaderIndex;
1773 const appendWorkingRow = () => {
1654 - if (compactionOnlyRunFinished) return;
1774 + if (compactionOnlyRunFinished || zenAnswerLanded) return;
1775 if (runningCompactionRunId !== null && activeCompactionRunId === null) return;
1776 nextRows.push({
1777 kind: "working",
@@ -2246,7 +2366,13 @@ interface MessagesTimelineRowsProjection {
2366 export function timelineTurnFoldRunIdsByEntryId(
2367 input: Pick<
2368 MessagesTimelineRowsInput,
2249 - "timelineEntries" | "latestRun" | "isWorking" | "runlessWorkActive" | "runningRunId"
2369 + | "timelineEntries"
2370 + | "latestRun"
2371 + | "isWorking"
2372 + | "runlessWorkActive"
2373 + | "runningRunId"
2374 + | "toolCallVisibility"
2375 + | "revealedMessageId"
2376 >,
2377 ): ReadonlyMap<string, RunId> {
2378 const byEntryId = new Map<string, RunId>();
apps/web/src/components/chat/MessagesTimeline.tsx
+15
@@ -84,6 +84,7 @@ import {
84 resolveTimelineMinimapVisibleRange,
85 resolveTimelineMinimapHitStripWidth,
86 timelineTurnFoldRunIdsByEntryId,
87 + liveAnswerPreview,
88 type MessagesTimelineRow,
89 type TimelineLatestRun,
90 } from "./MessagesTimeline.logic";
@@ -135,6 +136,7 @@ import {
136 import { useThreadFindPositionReader } from "./useThreadFindPositionReader";
137 import { ThreadActivityAnnouncer } from "./ThreadActivityAnnouncer";
138 import { useStableHandoffRuns, useIncrementalTimelineRows, useStableRows } from "./useTimelineRows";
139 +import { useClientSettings } from "../../hooks/useSettings";
140
141 function timelineListStateFor(identity: string): {
142 readonly identity: string;
@@ -572,6 +574,10 @@ const ConversationTimeline = memo(function ConversationTimeline({
574 }
575 }
576
577 + const preferredToolCallVisibility = useClientSettings((settings) => settings.toolCallVisibility);
578 + const toolCallVisibility =
579 + findActive && preferredToolCallVisibility === "zen" ? "hideAll" : preferredToolCallVisibility;
580 + const revealedMessageId = citationRequest?.citation.messageId ?? null;
581 // Imported turns and post-steer work fold under synthetic keys, not the entries' run ids.
582 const findFoldRunIds = findActive
583 ? timelineTurnFoldRunIdsByEntryId({
@@ -580,6 +586,8 @@ const ConversationTimeline = memo(function ConversationTimeline({
586 runningRunId,
587 isWorking,
588 runlessWorkActive,
589 + toolCallVisibility,
590 + revealedMessageId,
591 })
592 : null;
593 const activeFindRunId =
@@ -621,6 +629,8 @@ const ConversationTimeline = memo(function ConversationTimeline({
629 runningRunId,
630 isWorking,
631 runlessWorkActive,
632 + toolCallVisibility,
633 + revealedMessageId,
634 })
635 ).get(citedEntry.id);
636 setCitationExpandedFor(citationRequest.key);
@@ -679,6 +689,8 @@ const ConversationTimeline = memo(function ConversationTimeline({
689 threadStartCheckpointReady,
690 availableRevertTurnCounts,
691 worktreeSetup,
692 + toolCallVisibility,
693 + revealedMessageId,
694 });
695 const rows = useStableRows(rawRows, listIdentityKey);
696 const matchedApprovalRequestIds = new Set<string>();
@@ -1072,6 +1084,8 @@ const ConversationTimeline = memo(function ConversationTimeline({
1084 awaitingUser: awaitingUser !== null,
1085 isPreparingWorktree,
1086 latestRunId: latestRun?.runId ?? null,
1087 + liveAnswerPreview:
1088 + isWorking && toolCallVisibility === "zen" ? liveAnswerPreview(timelineEntries) : null,
1089 };
1090 // Mounted in both the empty and filled timeline so a thread's first turn
1091 // starts from a baseline instead of a fresh, silent region.
@@ -1177,6 +1191,7 @@ const ConversationTimeline = memo(function ConversationTimeline({
1191 runningRunId,
1192 isWorking,
1193 runlessWorkActive,
1194 + toolCallVisibility,
1195 rows,
1196 contentInsetEndAdjustment,
1197 });
apps/web/src/components/chat/TimelineWorkGroupRows.tsx
+7 -2
@@ -360,12 +360,17 @@ function CompactingLabel({ createdAt }: { createdAt: string | null }) {
360
361 export function ThinkingTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "thinking" }> }) {
362 const ctx = use(TimelineRowCtx);
363 - const { isCompacting, isPreparingWorktree } = use(TimelineRowActivityCtx);
363 + const { isCompacting, isPreparingWorktree, liveAnswerPreview } = use(TimelineRowActivityCtx);
364 if (isPreparingWorktree || isCompacting) return <WorkLogRow label="" />;
365 // A failed group keeps this disclosure while an approval waits, but nothing is thinking then.
366 const live = ctx.pendingApprovals.size === 0;
367 const activity = (
368 - <LiveActivityRow label="Thinking" iconName="brain" active={live} shimmer={live} />
368 + <LiveActivityRow
369 + label={liveAnswerPreview ?? "Thinking"}
370 + iconName="brain"
371 + active={live}
372 + shimmer={live}
373 + />
374 );
375 const { groupId } = row;
376 if (groupId === undefined) return activity;
apps/web/src/components/chat/timelineRowContext.ts
+1
@@ -107,6 +107,7 @@ export interface TimelineRowActivityState {
107 isPreparingWorktree: boolean;
108 latestRunId: RunId | null;
109 backgroundWorktreeSetup: WorktreeSetupSnapshot | null;
110 + liveAnswerPreview: string | null;
111 }
112
113 export const TimelineRowCtx = createContext<TimelineRowSharedState>(null!);
apps/web/src/components/chat/useThreadFindPositionReader.ts
+5
@@ -1,5 +1,6 @@
1 import { useLayoutEffect } from "react";
2 import type { RunId } from "@t3tools/contracts";
3 +import type { ToolCallVisibility } from "@t3tools/contracts/settings";
4 import type { TimelineEntry } from "../../session-logic";
5 import {
6 timelineTurnFoldRunIdsByEntryId,
@@ -21,6 +22,7 @@ export function useThreadFindPositionReader({
22 runningRunId,
23 isWorking,
24 runlessWorkActive,
25 + toolCallVisibility,
26 rows,
27 contentInsetEndAdjustment,
28 }: {
@@ -33,6 +35,7 @@ export function useThreadFindPositionReader({
35 readonly runningRunId: RunId | null;
36 readonly isWorking: boolean;
37 readonly runlessWorkActive: boolean;
38 + readonly toolCallVisibility: ToolCallVisibility;
39 readonly rows: MessagesTimelineRow[];
40 readonly contentInsetEndAdjustment: number;
41 }) {
@@ -49,6 +52,7 @@ export function useThreadFindPositionReader({
52 runningRunId,
53 isWorking,
54 runlessWorkActive,
55 + toolCallVisibility,
56 });
57 const entryById = new Map(timelineEntries.map((entry) => [entry.id, entry]));
58 return readThreadFindPosition(
@@ -99,5 +103,6 @@ export function useThreadFindPositionReader({
103 runningRunId,
104 timelineEntries,
105 timelineViewportElement,
106 + toolCallVisibility,
107 ]);
108 }
apps/web/src/components/settings/LabsSettingsPanel.tsx
+44
@@ -1,10 +1,13 @@
1 import { useAuth } from "@clerk/react";
2 import { Link } from "@tanstack/react-router";
3 import { managedCapabilityDenial } from "@t3tools/contracts";
4 +import { ToolCallVisibility } from "@t3tools/contracts/settings";
5 +import * as Schema from "effect/Schema";
6
7 import { hasCloudPublicConfig } from "~/cloud/publicConfig";
8 import { useT3ConnectAuthPrompt } from "../clerk/useT3ConnectAuthPrompt";
9 import { Button } from "../ui/button";
10 +import { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from "../ui/select";
11 import { Switch } from "../ui/switch";
12 import { ScopedSwitch } from "./ScopedSwitch";
13 import { SettingsPageContainer, SettingsRow, SettingsSection } from "./settingsLayout";
@@ -21,6 +24,7 @@ export function LabsSettingsPanel() {
24 <SettingsSection id="beta" title="Beta">
25 <BoringSidebarRow />
26 <BoringSidebarMultilineRow />
27 + <ToolCallVisibilityRow />
28 {/* Clerk is only mounted when this build has T3 Connect. */}
29 {hasCloudPublicConfig() ? <GuestLinksRowWithSignIn /> : <GuestLinksRow />}
30 <LinkedEnvironmentsRow />
@@ -72,6 +76,46 @@ function BoringSidebarMultilineRow() {
76 );
77 }
78
79 +const TOOL_CALL_VISIBILITY_LABELS: Record<ToolCallVisibility, string> = {
80 + showAll: "Show all",
81 + hideSuccessful: "Hide successful",
82 + hideAll: "Hide all",
83 + zen: "Zen",
84 +};
85 +
86 +const isToolCallVisibility = Schema.is(ToolCallVisibility);
87 +
88 +function ToolCallVisibilityRow() {
89 + const settings = useScopedSettings();
90 + const updateSettings = useUpdateScopedSettings();
91 + return (
92 + <SettingsRow
93 + {...searchableSetting("tool-call-visibility")}
94 + description="Hide the commands, edits, and searches agents run, so a thread reads like a conversation. Hide successful keeps calls that fail. Zen also hides the agent's in-between messages and shows only final answers. Approvals, questions, and errors always show."
95 + control={
96 + <div className="w-full sm:w-40">
97 + <Select
98 + value={settings.toolCallVisibility}
99 + onValueChange={(value) => {
100 + if (isToolCallVisibility(value)) updateSettings({ toolCallVisibility: value });
101 + }}
102 + >
103 + <SelectTrigger size="sm" className="w-full min-w-0" aria-label="Tool calls in chat">
104 + <SelectValue>{TOOL_CALL_VISIBILITY_LABELS[settings.toolCallVisibility]}</SelectValue>
105 + </SelectTrigger>
106 + <SelectPopup align="end" alignItemWithTrigger={false}>
107 + <SelectItem value="showAll">Show all</SelectItem>
108 + <SelectItem value="hideSuccessful">Hide successful</SelectItem>
109 + <SelectItem value="hideAll">Hide all</SelectItem>
110 + <SelectItem value="zen">Zen</SelectItem>
111 + </SelectPopup>
112 + </Select>
113 + </div>
114 + }
115 + />
116 + );
117 +}
118 +
119 /** Signed out of T3 Connect, the row offers to sign in instead of its switch. */
120 function GuestLinksRowWithSignIn() {
121 const { isSignedIn } = useAuth();
apps/web/src/components/settings/settingsSearch.ts
+8
@@ -468,6 +468,14 @@ export const SETTINGS_SEARCH_ITEMS = [
468 to: "/settings/labs",
469 searchTerms: ["beta boring sidebar folder rows multiline branch pull request details"],
470 },
471 + {
472 + id: "tool-call-visibility",
473 + title: "Tool calls in chat",
474 + to: "/settings/labs",
475 + searchTerms: [
476 + "beta hide tool calls commands edits searches work log activity quiet chat zen final answers only",
477 + ],
478 + },
479 {
480 id: "guest-links",
481 title: "Guest links",
docs/user/activity-log.md
+11
@@ -17,3 +17,14 @@ Failed calls do not count as successful messages or creations. Waiting on a thre
17 it finished, and an interrupt or cancellation request does not mean the thread stopped. When tool
18 details are unavailable, summaries use a broader description instead of guessing how many threads
19 were affected.
20 +
21 +## Hide tool calls
22 +
23 +**Settings → Labs → Tool calls in chat** hides commands, file edits, searches, and MCP tool calls
24 +from the conversation. **Hide successful** shows a call while it runs and keeps
25 +it only if it fails. **Hide all** hides every call and shows **Thinking** while the agent works.
26 +**Zen** also hides the agent's in-between messages, so each turn shows your message
27 +and the agent's last reply, which appears when the turn ends. If you steer while the agent is
28 +answering, the answer it finished before reading your steer stays too. On web and desktop, Find
29 +shows the in-between messages while it is open. Approvals, questions, and errors always show. The
30 +setting applies to this browser or device only.
packages/client-runtime/src/work-log/presentation.ts
+18
@@ -9,6 +9,7 @@ import {
9 type OrchestrationV2TurnItem,
10 type ThreadId,
11 } from "@t3tools/contracts";
12 +import type { ToolCallVisibility } from "@t3tools/contracts/settings";
13 import {
14 resolveT3McpSummaryAction,
15 resolveT3McpToolDefinition,
@@ -318,6 +319,23 @@ export function workEntryDisplayIndicatesToolFailure(entry: WorkLogPresentationE
319 ));
320 }
321
322 +const HIDEABLE_TOOL_CALL_ITEM_TYPES: ReadonlySet<WorkLogPresentationEntry["itemType"]> = new Set([
323 + "command_execution",
324 + "file_change",
325 + "file_search",
326 + "web_search",
327 + "dynamic_tool",
328 +]);
329 +
330 +export function workEntryHiddenByToolCallVisibility(
331 + entry: WorkLogPresentationEntry,
332 + visibility: ToolCallVisibility,
333 +): boolean {
334 + if (visibility === "showAll" || !HIDEABLE_TOOL_CALL_ITEM_TYPES.has(entry.itemType)) return false;
335 + if (visibility !== "hideSuccessful") return true;
336 + return entry.toolLifecycleStatus === "completed" && !workEntryDisplayIndicatesToolFailure(entry);
337 +}
338 +
339 function workLogEntryIsLocalCodeSearch(entry: WorkLogPresentationEntry): boolean {
340 return (
341 entry.itemType === "file_search" ||
packages/contracts/src/settings.ts
+7
@@ -342,6 +342,9 @@ export type ChatWidth = typeof ChatWidth.Type;
342 export const EffortDisplay = Schema.Literals(["label", "bars"]);
343 export type EffortDisplay = typeof EffortDisplay.Type;
344
345 +export const ToolCallVisibility = Schema.Literals(["showAll", "hideSuccessful", "hideAll", "zen"]);
346 +export type ToolCallVisibility = typeof ToolCallVisibility.Type;
347 +
348 export const ModelFavorite = Schema.Struct({
349 provider: ProviderInstanceId,
350 model: TrimmedNonEmptyString,
@@ -499,6 +502,9 @@ export const ClientSettingsSchema = Schema.Struct({
502 boringSidebarMultilineRows: Schema.Boolean.pipe(
503 Schema.withDecodingDefault(Effect.succeed(false)),
504 ),
505 + toolCallVisibility: ToolCallVisibility.pipe(
506 + Schema.withDecodingDefault(Effect.succeed("showAll" as const)),
507 + ),
508 // Retired Labs toggle. Still read as the default for the Usage item in threadDetailsItems.
509 threadDetailsUsageEnabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),
510 // Sparse show/hide overrides for thread details card items. Missing ids use the client's
@@ -1877,6 +1883,7 @@ export const ClientSettingsPatch = Schema.Struct({
1883 showSkillsInSlashMenu: Schema.optionalKey(Schema.Boolean),
1884 boringSidebarEnabled: Schema.optionalKey(Schema.Boolean),
1885 boringSidebarMultilineRows: Schema.optionalKey(Schema.Boolean),
1886 + toolCallVisibility: Schema.optionalKey(ToolCallVisibility),
1887 threadDetailsUsageEnabled: Schema.optionalKey(Schema.Boolean),
1888 threadDetailsItems: Schema.optionalKey(Schema.Record(Schema.String, Schema.Boolean)),
1889 legacySidebarEnabled: Schema.optionalKey(Schema.Boolean),