TypeScript
feat(web): a Labs setting hides tool calls so threads read like a chat (#30000)
oliver3d78e915e399
diff --git a/apps/mobile/src/features/settings/ThreadSettingsSections.tsx b/apps/mobile/src/features/settings/ThreadSettingsSections.tsxindex 4952f9a2f20..8aaae71673a 100644--- a/apps/mobile/src/features/settings/ThreadSettingsSections.tsx+++ b/apps/mobile/src/features/settings/ThreadSettingsSections.tsx@@ -21,6 +21,8 @@ import { serverEnvironment } from "../../state/server";import { useAtomCommand } from "../../state/use-atom-command";import { SettingsSection } from "./components/SettingsSection";import { SettingsSwitchRow } from "./components/SettingsSwitchRow";+import { ListChoiceRow } from "../../components/ui/ListChoiceRow";+import type { ToolCallVisibility } from "@t3tools/contracts/settings";import { SettingsScreen } from "./components/SettingsScreen";import { planAutoSettleSettingsSync, type AutoSettleSettings } from "./autoSettleSettingsSync";import { useSettingsEnvironmentFilter } from "./settings-environment-filter";@@ -42,6 +44,7 @@ export function SettingsLabsRouteScreen() {contentContainerClassName="gap-6 px-5 pt-4"contentContainerStyle={{ paddingBottom: Math.max(insets.bottom, 18) + 18 }}>+ <ToolCallVisibilitySection /><BetaSettingsSection /><LegacySettingsSection /></ScrollView>@@ -271,6 +274,46 @@ function BetaSettingsSection() {);}+const TOOL_CALL_VISIBILITY_OPTIONS: ReadonlyArray<{+ readonly value: ToolCallVisibility;+ readonly label: string;+}> = [+ { value: "showAll", label: "Show all" },+ { value: "hideSuccessful", label: "Hide successful" },+ { value: "hideAll", label: "Hide all" },+ { value: "zen", label: "Zen" },+];++function ToolCallVisibilitySection() {+ const savePreferences = useAtomSet(updateMobilePreferencesAtom);+ const preferences = useAtomValue(mobilePreferencesAtom);+ const selected = AsyncResult.isSuccess(preferences)+ ? (preferences.value.toolCallVisibility ?? "showAll")+ : null;++ return (+ <View className="gap-3">+ <SettingsSection title="Beta: Tool calls in chat">+ {TOOL_CALL_VISIBILITY_OPTIONS.map((option, index) => (+ <ListChoiceRow+ key={option.value}+ label={option.label}+ selected={selected === option.value}+ separated={index > 0}+ disabled={selected === null}+ onPress={() => savePreferences({ toolCallVisibility: option.value })}+ />+ ))}+ </SettingsSection>+ <Text className="px-2 text-sm text-foreground-muted">+ 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.+ </Text>+ </View>+ );+}+function LegacySettingsSection() {const savePreferences = useAtomSet(updateMobilePreferencesAtom);const preferences = useAtomValue(mobilePreferencesAtom);diff --git a/apps/mobile/src/features/settings/settings-search.ts b/apps/mobile/src/features/settings/settings-search.tsindex 342b2a1ade4..6c82f6c317d 100644--- a/apps/mobile/src/features/settings/settings-search.ts+++ b/apps/mobile/src/features/settings/settings-search.ts@@ -98,7 +98,19 @@ const SETTINGS_SEARCH_TERMS = {"submodules","start from remote",],- SettingsLabs: ["legacy", "plan mode", "beta", "linked environments", "link machine"],+ SettingsLabs: [+ "legacy",+ "plan mode",+ "beta",+ "linked environments",+ "link machine",+ "tool calls in chat",+ "hide tool calls",+ "commands edits searches",+ "work log",+ "zen",+ "final answers only",+ ],SettingsEnvironmentMaintenance: ["updates", "provider updates", "restart", "manage environments"],SettingsAbout: ["version",diff --git a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx b/apps/mobile/src/features/threads/ThreadDetailScreen.tsxindex f8d2e3b5c76..9a2bfdb9fa8 100644--- a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx+++ b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx@@ -10,6 +10,7 @@ import {import { AsyncResult, Atom } from "effect/reactivity";import * as Dialog from "../../components/ui/Dialog";import { useAtomMount, useAtomValue } from "@effect/atom-react";+import { mobilePreferencesAtom } from "../../state/preferences";import { parseThreadKey, threadKey } from "@t3tools/client-runtime/state/entities";import { createThreadVisitTracker } from "@t3tools/client-runtime/state/thread-visits";import { useChildThreadInputs, useThreadReportedModelSelection } from "../../state/entities";@@ -480,6 +481,10 @@ function ThreadDetailBody(threadId: props.selectedThread.id,});const composerError = useAtomValue(threadComposerErrorsAtom)[selectedThreadKey]?.message ?? null;+ const preferences = useAtomValue(mobilePreferencesAtom);+ const toolCallVisibility = AsyncResult.isSuccess(preferences)+ ? (preferences.value.toolCallVisibility ?? "showAll")+ : "showAll";const queuedCount = useThreadQueuedCount(props.selectedThreadDetailRef);const turnSubagents = useThreadTurnSubagents(props.selectedThreadDetailRef);const agentsSegment = resolveSubagentPillSegment(turnSubagents);@@ -1474,6 +1479,7 @@ function ThreadDetailBody(><WorkspaceMutationIdProvider threadRef={props.selectedThreadDetailRef}><ThreadFeed+ toolCallVisibility={toolCallVisibility}environmentId={props.environmentId}threadId={props.selectedThread.id}detailRef={props.selectedThreadDetailRef}diff --git a/apps/mobile/src/features/threads/ThreadFeed.tsx b/apps/mobile/src/features/threads/ThreadFeed.tsxindex a44a9c8a1f8..d6fdc9e955c 100644--- a/apps/mobile/src/features/threads/ThreadFeed.tsx+++ b/apps/mobile/src/features/threads/ThreadFeed.tsx@@ -59,6 +59,7 @@ import {type ScheduledTaskId,type ScopedThreadRef,} from "@t3tools/contracts";+import type { ToolCallVisibility } from "@t3tools/contracts/settings";import { renderAssistantCitationsAsText } from "@t3tools/shared/assistantCitations";import { encodeComposerContextFragment } from "@t3tools/shared/composerContextClipboard";import { hostedThreadLink, parseThreadLinkHref } from "@t3tools/shared/threadLinks";@@ -339,6 +340,7 @@ export interface ThreadFeedHandle {}export interface ThreadFeedProps {+ readonly toolCallVisibility?: ToolCallVisibility;readonly worktreeSetup?: WorktreeSetupCardProps | null;readonly setupWorkingStartedAt?: string | null;readonly queuedMessages: ReadonlyArray<QueuedThreadMessage>;@@ -1739,7 +1741,13 @@ function renderFeedEntry(}if (entry.type === "thinking") {- return <ThreadThinkingRow rowSizing={props.workRowSizing} iconSubtleColor={iconSubtleColor} />;+ return (+ <ThreadThinkingRow+ rowSizing={props.workRowSizing}+ iconSubtleColor={iconSubtleColor}+ label={entry.label}+ />+ );}if (entry.type === "html-render") {@@ -2565,6 +2573,7 @@ function useThreadFeedPresentation(props: ThreadFeedProps,expandedTurnIds: ReadonlySet<RunId>,expandedWorkGroups: Record<string, boolean>,+ revealedMessageId: MessageId | null,) {const [feedCache] = useState(createThreadFeedCache);return appendPendingThreadMessages(@@ -2580,6 +2589,7 @@ function useThreadFeedPresentation(props.activeWorkStartedAt,props.runlessWorkActive ?? false,feedCache,+ { toolCallVisibility: props.toolCallVisibility ?? "showAll", revealedMessageId },),props.feed,props.queuedMessages,@@ -2735,13 +2745,16 @@ export const ThreadFeed = memo(function ThreadFeed({readonly expandedWorkGroups: Record<string, boolean>;readonly expandedWorkRows: Record<string, boolean>;readonly expandedTurnIds: ReadonlySet<RunId>;+ readonly revealedMessageId: MessageId | null;}>({copiedRowId: null,expandedWorkGroups: {},expandedWorkRows: {},expandedTurnIds: new Set(),+ revealedMessageId: null,});- const { copiedRowId, expandedWorkGroups, expandedWorkRows, expandedTurnIds } = interactionState;+ const { copiedRowId, expandedWorkGroups, expandedWorkRows, expandedTurnIds, revealedMessageId } =+ interactionState;const markdownLinkRequest = useRef<AbortController | null>(null);const onInlinePlaybackStart = () => {markdownLinkRequest.current?.abort();@@ -3301,8 +3314,11 @@ export const ThreadFeed = memo(function ThreadFeed({const [loadedListKey, setLoadedListKey] = useState<string | null>(null);const { jumpToMessageId } = props;const jumpReady = !!jumpToMessageId && loadedListKey === `${feedThreadKey}:filled`;+ if (jumpReady && revealedMessageId !== jumpToMessageId) {+ setInteractionState((current) => ({ ...current, revealedMessageId: jumpToMessageId }));+ }const presentedFeed = appendGuestPendingMessages(- useThreadFeedPresentation(props, expandedTurnIds, expandedWorkGroups),+ useThreadFeedPresentation(props, expandedTurnIds, expandedWorkGroups, revealedMessageId),guestShare,);const jumpRunId =diff --git a/apps/mobile/src/features/threads/thread-work-log.tsx b/apps/mobile/src/features/threads/thread-work-log.tsxindex ae943c81614..4ed6cbef948 100644--- a/apps/mobile/src/features/threads/thread-work-log.tsx+++ b/apps/mobile/src/features/threads/thread-work-log.tsx@@ -1456,11 +1456,13 @@ export function ThreadWorkGroupToggle(props: {export function ThreadThinkingRow(props: {readonly rowSizing: ReturnType<typeof deriveThreadWorkLogSizing>;readonly iconSubtleColor: ColorValue;+ readonly label?: string;}) {+ const label = props.label ?? "Thinking";return (<Viewaccessible- accessibilityLabel="Thinking"+ accessibilityLabel={label}className="-mx-1 min-h-8 flex-row items-center px-1.5 py-0"style={{ minHeight: props.rowSizing.estimatedRowHeight }}>@@ -1468,7 +1470,7 @@ export function ThreadThinkingRow(props: {key={props.rowSizing.textSizeKey}icon="brain"iconSubtleColor={props.iconSubtleColor}- label="Thinking"+ label={label}showIcon/></View>diff --git a/apps/mobile/src/lib/threadActivity.test.ts b/apps/mobile/src/lib/threadActivity.test.tsindex 69ef04feb4f..f5b4d0232a9 100644--- a/apps/mobile/src/lib/threadActivity.test.ts+++ b/apps/mobile/src/lib/threadActivity.test.ts@@ -1257,6 +1257,90 @@ describe("buildThreadFeed", () => {),).toEqual([]);});+ it("hides tool calls or everything but the final answer", () => {+ const at = (second: number) => `2026-06-20T00:00:${String(second).padStart(2, "0")}.000Z`;+ const say = (name: string, second: number, user = false, steer = false) => ({+ ...(user ? userMessage(at(second)) : assistantMessage(at(second))),+ id: TurnItemId.make(name),+ messageId: MessageId.make(name),+ text: name,+ ...(steer ? { inputIntent: "steer" as const } : {}),+ });+ const ran = (name: string, second: number, status: "completed" | "failed") => ({+ ...command(at(second)),+ id: TurnItemId.make(name),+ status,+ });+ const [user, step, passed, failed, final] = [+ say("user", 1, true),+ say("step", 2),+ ran("passed", 3, "completed"),+ ran("failed", 4, "failed"),+ say("final", 5),+ ];+ const running = { runId, status: "running" as const, startedAt: at(1), completedAt: null };+ const rows = (+ items: ReadonlyArray<OrchestrationV2TurnItem>,+ toolCallVisibility: "hideSuccessful" | "hideAll" | "zen",+ latestRun: ThreadFeedLatestRun | null = null,+ ) =>+ deriveThreadFeedPresentation(+ buildThreadFeed(items.map((item, index) => projected(item, index))),+ latestRun,+ new Set([runId]),+ new Set(),+ latestRun ? at(1) : null,+ false,+ undefined,+ { toolCallVisibility, revealedMessageId: null },+ ).map((row) =>+ row.type === "activity-group"+ ? row.activities.map((activity) => activity.projectedItem.item.id).join("+")+ : row.type === "thinking"+ ? `thinking:${row.label ?? ""}`+ : row.type === "run-fold"+ ? "fold"+ : row.id,+ );++ const turn = [user, step, passed, failed, final];+ expect(rows(turn, "hideSuccessful")).toEqual(["user", "fold", "step", "failed", "final"]);+ expect(rows(turn, "hideAll")).toEqual(["user", "fold", "step", "final"]);+ expect(rows(turn, "zen")).toEqual(["user", "final"]);+ const [steer, answer] = [say("steer", 2, true, true), say("answer", 3)];+ expect(rows([user, steer, answer, final], "zen")).toEqual(["user", "steer", "answer", "final"]);+ expect(rows([user, steer, step, passed, final], "zen")).toEqual(["user", "steer", "final"]);+ expect(rows([user, steer, answer, step], "zen", running)).toEqual([+ "user",+ "steer",+ "answer",+ "thinking:step",+ ]);+ expect(rows([user, step, passed], "zen", running)).toEqual(["user", "thinking:step"]);+ expect(rows(turn, "zen", { ...running, turnEnded: true })).toEqual(["user", "final"]);+ const nextRun = { ...running, runId: RunId.make("run-2") };+ const followUp = { ...say("follow-up", 6, true), runId: nextRun.runId };+ expect(rows([...turn, followUp], "zen", nextRun)).toEqual([+ "user",+ "final",+ "follow-up",+ "thinking:",+ ]);+ const wake: OrchestrationV2TurnItem = {+ ...base("wake", at(6), 5),+ runId: nextRun.runId,+ type: "notification",+ source: { kind: "background_task" },+ outcome: "completed",+ summary: "Task finished",+ };+ expect(rows([user, final, wake], "zen", nextRun)).toEqual([+ "user",+ "final",+ "wake",+ "thinking:",+ ]);+ });});describe("retained v2 feed presentation", () => {diff --git a/apps/mobile/src/lib/threadActivity.ts b/apps/mobile/src/lib/threadActivity.tsindex 8cb5ccb0437..3c336b02923 100644--- a/apps/mobile/src/lib/threadActivity.ts+++ b/apps/mobile/src/lib/threadActivity.ts@@ -29,7 +29,9 @@ import {type ToolGroupSummaryKind,type WorkLogPresentationEntry,type WorkLogToolLifecycleStatus,+ workEntryHiddenByToolCallVisibility,} from "@t3tools/client-runtime/work-log/presentation";+import type { ToolCallVisibility } from "@t3tools/contracts/settings";import {resolveT3McpToolDefinition,resolveT3McpToolPresentation,@@ -235,6 +237,7 @@ type ThreadFeedEntryContent =readonly id: string;readonly createdAt: string;readonly runId: RunId | null;+ readonly label?: string;};export interface ThreadFeedLatestRun {@@ -1281,6 +1284,7 @@ interface ThreadFeedPresentationBuild {readonly expandedWorkGroupIds: ReadonlySet<string>;readonly activeWorkStartedAt: string | null;readonly runlessWorkActive: boolean;+ readonly display: ThreadFeedDisplay;readonly rows: ReadonlyArray<ThreadFeedEntry>;/** Feed entry `entry` is a user message whose rows start at `rowsLength`. */readonly restarts: ReadonlyArray<{ readonly entry: number; readonly rowsLength: number }>;@@ -1323,12 +1327,15 @@ function presentationRestart(expandedWorkGroupIds: ReadonlySet<string>,activeWorkStartedAt: string | null,runlessWorkActive: boolean,+ display: ThreadFeedDisplay,): { readonly entry: number; readonly rowsLength: number; readonly index: number } | null {if (previous === null ||!latestRunsEqual(previous.latestRun, latestRun) ||previous.activeWorkStartedAt !== activeWorkStartedAt ||previous.runlessWorkActive !== runlessWorkActive ||+ previous.display.toolCallVisibility !== display.toolCallVisibility ||+ previous.display.revealedMessageId !== display.revealedMessageId ||!setsEqual(previous.expandedRunIds, expandedRunIds) ||!setsEqual(previous.expandedWorkGroupIds, expandedWorkGroupIds)) {@@ -1347,6 +1354,143 @@ function presentationRestart(return { ...restart, index };}+const visibleActivityGroups = new WeakMap<+ ThreadFeedActivityGroup,+ { readonly visibility: ToolCallVisibility; readonly group: ThreadFeedActivityGroup | null }+>();++function zenKeepsActivity(activity: ThreadFeedActivity): boolean {+ const item = activity.projectedItem.item;+ return (+ activity.prominent ||+ activity.workEntry.questionAnswer !== undefined ||+ item.type === "compaction" ||+ item.type === "handoff" ||+ item.type === "notification" ||+ (item.type === "error" && item.status !== "completed")+ );+}++function activityGroupForVisibility(+ entry: ThreadFeedActivityGroup,+ visibility: ToolCallVisibility,+): ThreadFeedActivityGroup | null {+ const cached = visibleActivityGroups.get(entry);+ if (cached?.visibility === visibility) return cached.group;+ const activities = entry.activities.filter((activity) =>+ visibility === "zen"+ ? zenKeepsActivity(activity)+ : !workEntryHiddenByToolCallVisibility(activity.workEntry, visibility),+ );+ const group =+ activities.length === 0+ ? null+ : activities.length === entry.activities.length+ ? entry+ : { ...entry, activities };+ visibleActivityGroups.set(entry, { visibility, group });+ return group;+}++function isSteerMessage(message: ThreadFeedMessage): boolean {+ return (+ message.role === "user" &&+ (message.inputIntent === "steer" || message.inputIntent === "promoted_queued_to_steer")+ );+}++function startsResponse(entry: ThreadFeedEntry): boolean {+ return (+ (entry.type === "message" && entry.message.role === "user" && !isSteerMessage(entry.message)) ||+ (entry.type === "activity-group" &&+ entry.activities.some((activity) => activity.projectedItem.item.type === "notification"))+ );+}++function zenAnswerMessageIds(+ feed: ReadonlyArray<ThreadFeedEntry>,+ start: number,+ answering: boolean,+ answeringRunId: RunId | null,+): ReadonlySet<MessageId> {+ const replies: Array<{ readonly message: ThreadFeedMessage; readonly index: number }> = [];+ const lastReplyByResponse = new Map<string, MessageId>();+ const steerAnswers = new Set<MessageId>();+ let userMessages = 0;+ let awaitingReply = false;+ let candidate: MessageId | null = null;+ let answeringFrom = answering ? start : feed.length;+ for (let index = start; index < feed.length; index += 1) {+ const entry = feed[index]!;+ if (+ entry.type === "activity-group" &&+ entry.activities.every((activity) => activity.workEntry.itemType === "reasoning")+ ) {+ continue;+ }+ const reply =+ entry.type === "message" && entry.message.role === "assistant" ? entry.message : null;+ if (candidate !== null && reply !== null) steerAnswers.add(candidate);+ candidate = null;+ if (answering && startsResponse(entry)) answeringFrom = index + 1;+ if (entry.type === "message" && entry.message.role === "user") {+ userMessages += 1;+ awaitingReply = isSteerMessage(entry.message);+ } else if (reply !== null) {+ replies.push({ message: reply, index });+ lastReplyByResponse.set(reply.runId ?? `runless:${userMessages}`, reply.id);+ if (awaitingReply) {+ candidate = reply.id;+ awaitingReply = false;+ }+ }+ }+ const terminal = new Set(lastReplyByResponse.values());+ return new Set(+ replies+ .filter(+ ({ message, index }) =>+ steerAnswers.has(message.id) ||+ (terminal.has(message.id) &&+ index < answeringFrom &&+ (answeringRunId === null || message.runId !== answeringRunId)),+ )+ .map(({ message }) => message.id),+ );+}++function liveAnswerPreview(feed: ReadonlyArray<ThreadFeedEntry>): string | null {+ for (let index = feed.length - 1; index >= 0; index -= 1) {+ const entry = feed[index]!;+ if (startsResponse(entry)) return null;+ const texts =+ entry.type === "message"+ ? entry.message.role === "assistant"+ ? [entry.message.text]+ : []+ : entry.type === "activity-group"+ ? entry.activities+ .filter((activity) => activity.workEntry.itemType === "reasoning")+ .map((activity) => activity.workEntry.detail ?? "")+ : [];+ for (let textIndex = texts.length - 1; textIndex >= 0; textIndex -= 1) {+ const line = compactWorkEntryText(liveThoughtLine(texts[textIndex]!));+ if (line !== "") return line;+ }+ }+ return null;+}++export interface ThreadFeedDisplay {+ readonly toolCallVisibility: ToolCallVisibility;+ readonly revealedMessageId: MessageId | null;+}++const DEFAULT_THREAD_FEED_DISPLAY: ThreadFeedDisplay = {+ toolCallVisibility: "showAll",+ revealedMessageId: null,+};+export function deriveThreadFeedPresentation(feed: ReadonlyArray<ThreadFeedEntry>,latestRun: ThreadFeedLatestRun | null,@@ -1355,6 +1499,7 @@ export function deriveThreadFeedPresentation(activeWorkStartedAt: string | null = null,runlessWorkActive = false,cache?: ThreadFeedCache,+ display: ThreadFeedDisplay = DEFAULT_THREAD_FEED_DISPLAY,): ThreadFeedEntry[] {const previous = cache?.presentation ?? null;const restart = presentationRestart(@@ -1365,6 +1510,7 @@ export function deriveThreadFeedPresentation(expandedWorkGroupIds,activeWorkStartedAt,runlessWorkActive,+ display,);const start = restart?.entry ?? 0;const result: ThreadFeedEntry[] =@@ -1383,10 +1529,36 @@ export function deriveThreadFeedPresentation(Exclude<ThreadFeedEntry, { readonly type: "run-fold" | "work-toggle" | "thinking" }>> = [];const retainedFeedIndices: number[] = [];+ const { toolCallVisibility, revealedMessageId } = display;+ const isWorking = activeWorkStartedAt !== null && latestRun?.status !== "preparing";+ const activeRunId = unsettledRunId(latestRun);+ const zen = toolCallVisibility === "zen";+ const answering = isWorking && latestRun?.turnEnded !== true;+ const zenAnswerIds = zen+ ? zenAnswerMessageIds(feed, start, answering, answering ? activeRunId : null)+ : null;for (let index = start; index < feed.length; index += 1) {- const entry = feed[index]!;+ let entry = feed[index]!;if (entry.type === "run-fold" || entry.type === "work-toggle" || entry.type === "thinking")continue;+ const runId = feedEntryRunId(entry);+ if (runId !== null) {+ if (!firstEntryByRun.has(runId)) firstEntryByRun.set(runId, index);+ lastEntryByRun.set(runId, index);+ }+ if (entry.type === "activity-group" && toolCallVisibility !== "showAll") {+ const shown = activityGroupForVisibility(entry, toolCallVisibility);+ if (shown === null) continue;+ entry = shown;+ } else if (+ zenAnswerIds !== null &&+ entry.type === "message" &&+ entry.message.role === "assistant" &&+ entry.message.id !== revealedMessageId &&+ !zenAnswerIds.has(entry.message.id)+ ) {+ continue;+ }retainedFeed.push(entry);retainedFeedIndices.push(index);}@@ -1395,7 +1567,6 @@ export function deriveThreadFeedPresentation();const failedRunIds = failedFeedRunIds(sourceFeed, latestRun);const activeTailGroup = sourceFeed.at(-1);- const activeRunId = unsettledRunId(latestRun);// A bare `/compact` turn is the compaction itself: its compaction row stands in for the prompt// and the live activity row. An answered "compact before continuing?" question folds into the// compaction it asked for.@@ -1416,13 +1587,9 @@ export function deriveThreadFeedPresentation(compactionItemRunIds.add(entry.runId);}}- const isWorking = activeWorkStartedAt !== null && latestRun?.status !== "preparing";- const foldsByAnchorId = deriveThreadFeedRunFolds(- sourceFeed,- latestRun,- isWorking && runlessWorkActive,- failedRunIds,- );+ const foldsByAnchorId = zen+ ? new Map<string, ThreadFeedRunFold>()+ : deriveThreadFeedRunFolds(sourceFeed, latestRun, isWorking && runlessWorkActive, failedRunIds);const collapsedEntryIds = new Set<string>();for (const fold of foldsByAnchorId.values()) {if (!expandedRunIds.has(fold.runId)) {@@ -1435,11 +1602,6 @@ export function deriveThreadFeedPresentation(if (isUserMessageEntry(entry)) {restarts.push({ entry: feedIndex, rowsLength: result.length });}- const runId = feedEntryRunId(entry);- if (runId !== null) {- if (!firstEntryByRun.has(runId)) firstEntryByRun.set(runId, feedIndex);- lastEntryByRun.set(runId, feedIndex);- }const isActiveTailGroup =isWorking &&(activeRunId !== null || runlessWorkActive) &&@@ -1531,7 +1693,9 @@ export function deriveThreadFeedPresentation(row.activities[0]?.projectedItem.item.status === "running"),)) {- result.push(thinkingRow(activeWorkStartedAt, activeRunId));+ result.push(+ thinkingRow(activeWorkStartedAt, activeRunId, zen ? liveAnswerPreview(feed) : null),+ );}const checkpointByRunId = new Map<RunId, ThreadCheckpointSummary>();for (const entry of sourceFeed) {@@ -1605,6 +1769,7 @@ export function deriveThreadFeedPresentation(expandedWorkGroupIds,activeWorkStartedAt,runlessWorkActive,+ display,rows: result,restarts: cleanRestarts,firstEntryByRun,@@ -1634,9 +1799,19 @@ function isWorkLogFeedRow(row: ThreadFeedEntry | undefined): boolean {const LIVE_ACTIVITY_ROW_ID = "live-activity-row";-function thinkingRow(createdAt: string, runId: RunId | null) {- if (cachedThinkingRow?.createdAt !== createdAt || cachedThinkingRow.runId !== runId) {- cachedThinkingRow = { type: "thinking", id: LIVE_ACTIVITY_ROW_ID, createdAt, runId };+function thinkingRow(createdAt: string, runId: RunId | null, label: string | null) {+ if (+ cachedThinkingRow?.createdAt !== createdAt ||+ cachedThinkingRow.runId !== runId ||+ (cachedThinkingRow.label ?? null) !== label+ ) {+ cachedThinkingRow = {+ type: "thinking",+ id: LIVE_ACTIVITY_ROW_ID,+ createdAt,+ runId,+ ...(label === null ? {} : { label }),+ };}return cachedThinkingRow;}diff --git a/apps/mobile/src/persistence/mobile-preferences.ts b/apps/mobile/src/persistence/mobile-preferences.tsindex 3760ae10c30..436f3b172cd 100644--- a/apps/mobile/src/persistence/mobile-preferences.ts+++ b/apps/mobile/src/persistence/mobile-preferences.ts@@ -14,6 +14,7 @@ import {type PullRequestMergeMethod,type SidebarProjectGroupingMode,} from "@t3tools/contracts";+import { ToolCallVisibility } from "@t3tools/contracts/settings";import type { AndroidNavigationStyle } from "../lib/androidNavigationStyle";import type { ComposerEnterBehavior } from "../lib/composerEnterBehavior";import type { FollowUpBehavior } from "../lib/followUpBehavior";@@ -116,6 +117,7 @@ export interface Preferences {readonly projectGroupingEnabled?: boolean;readonly projectGroupingMode?: SidebarProjectGroupingMode;readonly planModeEnabled?: boolean;+ readonly toolCallVisibility?: ToolCallVisibility;readonly workingShelfEnabled?: boolean;readonly useLastProjectForNewThreads?: boolean;readonly lastThreadProject?: typeof ThreadProject.Type;@@ -170,6 +172,8 @@ export class MobilePreferencesStore extends Context.Service<}>()("@t3tools/mobile/persistence/mobile-preferences/MobilePreferencesStore") {}+const isToolCallVisibility = Schema.is(ToolCallVisibility);+function sanitizePreferences(parsed: Preferences): Preferences {const preferences: {navigationTabOrder?: readonly string[];@@ -198,6 +202,7 @@ function sanitizePreferences(parsed: Preferences): Preferences {projectGroupingEnabled?: boolean;projectGroupingMode?: SidebarProjectGroupingMode;planModeEnabled?: boolean;+ toolCallVisibility?: ToolCallVisibility;workingShelfEnabled?: boolean;useLastProjectForNewThreads?: boolean;lastThreadProject?: typeof ThreadProject.Type;@@ -324,6 +329,9 @@ function sanitizePreferences(parsed: Preferences): Preferences {if (typeof parsed.planModeEnabled === "boolean") {preferences.planModeEnabled = parsed.planModeEnabled;}+ if (isToolCallVisibility(parsed.toolCallVisibility)) {+ preferences.toolCallVisibility = parsed.toolCallVisibility;+ }if (typeof parsed.workingShelfEnabled === "boolean") {preferences.workingShelfEnabled = parsed.workingShelfEnabled;}diff --git a/apps/web/src/components/chat/MessagesTimeline.logic.test.ts b/apps/web/src/components/chat/MessagesTimeline.logic.test.tsindex 4c7eba620b5..5331f2c2cfd 100644--- a/apps/web/src/components/chat/MessagesTimeline.logic.test.ts+++ b/apps/web/src/components/chat/MessagesTimeline.logic.test.ts@@ -27,6 +27,7 @@ import {computeStableMessagesTimelineRows,deriveMessagesTimelineRows,timelineTurnFoldRunIdsByEntryId,+ liveAnswerPreview,deriveMessagesTimelineRowsWithState,shouldCollapseUserMessage,resolveAssistantMessageCopyState,@@ -2691,6 +2692,129 @@ describe("v2 run and attempt history", () => {expect.objectContaining({ id: "provider-recovered" }),]);});+ it("hides tool calls or everything but the final answer", () => {+ const runId = RunId.make("turn-1");+ const at = (second: number) => `2026-01-01T00:00:${String(second).padStart(2, "0")}Z`;+ const message = (+ id: string,+ role: "user" | "assistant",+ second: number,+ inputIntent?: "steer",+ ): TimelineEntry => ({+ id,+ kind: "message",+ createdAt: at(second),+ message: {+ id: MessageId.make(id),+ role,+ text: id,+ runId: role === "user" ? null : runId,+ createdAt: at(second),+ updatedAt: at(second),+ streaming: false,+ ...(inputIntent ? { inputIntent } : {}),+ },+ });+ const command = (+ id: string,+ status: "completed" | "failed",+ second: number,+ ): TimelineEntry => ({+ id,+ kind: "work",+ createdAt: at(second),+ entry: {+ id,+ createdAt: at(second),+ runId,+ label: "Ran command",+ tone: "tool",+ itemType: "command_execution",+ toolLifecycleStatus: status,+ },+ });+ const [user, step, passed, failed, final] = [+ message("user", "user", 0),+ message("step", "assistant", 5),+ command("passed", "completed", 8),+ command("failed", "failed", 9),+ message("final", "assistant", 20),+ ];+ const running = { runId, status: "running" as const, startedAt: at(0), completedAt: null };+ const ended = { ...running, turnEnded: true };+ const rows = (+ timelineEntries: ReadonlyArray<TimelineEntry>,+ toolCallVisibility: "hideSuccessful" | "hideAll" | "zen",+ latestRun?: typeof ended | typeof running,+ ) =>+ deriveMessagesTimelineRows({+ timelineEntries,+ expandedRunIds: new Set([runId]),+ isWorking: latestRun !== undefined,+ ...(latestRun ? { latestRun } : {}),+ turnDiffSummaries: [],+ supportsConversationRollback: false,+ toolCallVisibility,+ }).map((row) => row.id);++ const turn = [user, step, passed, failed, final];+ expect(rows(turn, "hideSuccessful")).toEqual([+ "user",+ "turn-fold:turn-1",+ "step",+ "failed",+ "final",+ ]);+ expect(rows([user, failed, final], "hideAll")).toEqual(["user", "final"]);+ expect(rows(turn, "zen")).toEqual(["user", "final"]);+ const [steer, answer] = [+ message("steer", "user", 4, "steer"),+ message("answer", "assistant", 7),+ ];+ expect(rows([user, steer, answer, final], "zen")).toEqual(["user", "steer", "answer", "final"]);+ expect(rows([user, steer, step, passed, final], "zen")).toEqual(["user", "steer", "final"]);+ expect(rows([user, steer, answer, step], "zen", running)).toEqual([+ "user",+ "working-indicator-row",+ "steer",+ "answer",+ "live-activity-row",+ ]);+ expect(rows([user, step, passed], "zen", running)).toEqual([+ "user",+ "working-indicator-row",+ "live-activity-row",+ ]);+ expect(liveAnswerPreview([user, step, passed])).toBe("step");+ expect(rows(turn, "zen", ended)).toEqual(["user", "final"]);+ const followUp = message("follow-up", "user", 30);+ expect(rows([...turn, followUp], "zen", ended)).toEqual([+ "user",+ "final",+ "follow-up",+ "working-indicator-row",+ ]);+ const wake: TimelineEntry = {+ id: "wake",+ kind: "work",+ createdAt: at(30),+ entry: {+ id: "wake",+ createdAt: at(30),+ runId: RunId.make("wake"),+ label: "Task finished",+ tone: "info",+ itemType: "notification",+ },+ };+ expect(rows([user, final, wake], "zen", { ...running, runId: RunId.make("wake") })).toEqual([+ "user",+ "final",+ "wake",+ "working-indicator-row",+ "live-activity-row",+ ]);+ });it("collapses only output from a superseded V2 attempt within the active logical run", () => {const runId = "run-steered" as never;const supersededAttemptId = "attempt-1" as never;diff --git a/apps/web/src/components/chat/MessagesTimeline.logic.ts b/apps/web/src/components/chat/MessagesTimeline.logic.tsindex 2fe811db4d1..a74f24859cf 100644--- a/apps/web/src/components/chat/MessagesTimeline.logic.ts+++ b/apps/web/src/components/chat/MessagesTimeline.logic.ts@@ -28,6 +28,8 @@ import {toolGroupSummaryKind,contextCompactionTokenCounts,type ToolGroupSummaryKind,+ liveThoughtLine,+ workEntryHiddenByToolCallVisibility,} from "@t3tools/client-runtime/work-log/presentation";import {deriveRevertTurnCountByUserMessageId,@@ -62,6 +64,7 @@ import {type TurnItemId,} from "@t3tools/contracts";import type { ThreadRunSummary } from "@t3tools/client-runtime/state/shell";+import type { ToolCallVisibility } from "@t3tools/contracts/settings";import { resolveT3McpToolDefinition } from "@t3tools/shared/t3McpToolPresentation";import { compactDynamicToolOutput } from "@t3tools/shared/toolOutput";import { htmlRenderReferencesEqual, type HtmlRenderReference } from "@t3tools/shared/htmlRender";@@ -1361,17 +1364,123 @@ function settleSupersededReasoning(entries: ReadonlyArray<TimelineEntry>) {});}-function timelineRowEntries(entries: ReadonlyArray<TimelineEntry>) {- return withoutSubagentDelegationRows(settleSupersededReasoning(entries));+function workShownAsFinalAnswerOnly(+ entry: TimelineEntry,+ pendingApprovalRequestIds: ReadonlySet<RuntimeRequestId> | undefined,+): boolean {+ if (entry.kind === "event") return entry.projectedItem.item.type !== "subagent";+ if (entry.kind !== "work") return true;+ const work = entry.entry;+ const item = work.projectedItem?.item;+ return (+ (item?.type === "approval_request" &&+ pendingApprovalRequestIds?.has(item.requestId) === true) ||+ work.questionAnswer !== undefined ||+ timelineEntryIsCompaction(entry) ||+ timelineEntryStartsResponse(entry) ||+ work.tone === "error" ||+ work.sourceActivityKind === "runtime.error" ||+ (work.itemType === "error" && work.toolLifecycleStatus !== "completed")+ );+}++function deriveInFlightSteerAnswerIds(entries: ReadonlyArray<TimelineEntry>): ReadonlySet<string> {+ const ids = new Set<string>();+ let awaitingReply = false;+ let candidate: string | null = null;+ for (const entry of entries) {+ if (entry.kind === "work" && entry.entry.itemType === "reasoning") continue;+ const reply = entry.kind === "message" && entry.message.role === "assistant" ? entry : null;+ if (candidate !== null && reply !== null) ids.add(candidate);+ candidate = null;+ if (timelineEntryIsSteer(entry)) {+ awaitingReply = true;+ } else if (entry.kind === "message" && entry.message.role === "user") {+ awaitingReply = false;+ } else if (reply !== null && awaitingReply) {+ candidate = reply.message.id;+ awaitingReply = false;+ }+ }+ return ids;+}++export function liveAnswerPreview(entries: ReadonlyArray<TimelineEntry>): string | null {+ const boundary = lastResponseBoundaryIndex(entries);+ for (let index = entries.length - 1; index > boundary; index -= 1) {+ const entry = entries[index]!;+ const text =+ entry.kind === "message" && entry.message.role === "assistant"+ ? entry.message.text+ : entry.kind === "work" && entry.entry.itemType === "reasoning"+ ? (entry.entry.detail ?? "")+ : "";+ const line = liveThoughtLine(text);+ if (line !== "") return line;+ }+ return null;+}++function timelineRowEntries(+ input: Pick<+ MessagesTimelineRowsInput,+ | "timelineEntries"+ | "toolCallVisibility"+ | "revealedMessageId"+ | "isWorking"+ | "latestRun"+ | "runningRunId"+ | "pendingApprovalRequestIds"+ >,+) {+ const visibility = input.toolCallVisibility ?? "showAll";+ const entries = input.timelineEntries;+ let shown = entries;+ if (visibility === "zen") {+ const answering = input.isWorking && input.latestRun?.turnEnded !== true;+ const answeringRunId = answering+ ? deriveUnsettledRunId(input.latestRun ?? null, input.runningRunId ?? null)+ : null;+ const answeringFrom = answering ? lastResponseBoundaryIndex(entries) + 1 : entries.length;+ const terminalIds = deriveTerminalAssistantMessageIds(entries);+ const steerAnswerIds = deriveInFlightSteerAnswerIds(entries);+ shown = entries.filter((entry, index) => {+ if (entry.kind !== "message") {+ return workShownAsFinalAnswerOnly(entry, input.pendingApprovalRequestIds);+ }+ const { message } = entry;+ return (+ message.role !== "assistant" ||+ message.id === input.revealedMessageId ||+ steerAnswerIds.has(message.id) ||+ (terminalIds.has(message.id) &&+ index < answeringFrom &&+ (answeringRunId === null || message.runId !== answeringRunId))+ );+ });+ } else if (visibility !== "showAll") {+ shown = entries.filter(+ (entry) =>+ entry.kind !== "work" || !workEntryHiddenByToolCallVisibility(entry.entry, visibility),+ );+ }+ return withoutSubagentDelegationRows(settleSupersededReasoning(shown));}function deriveTimelineTurnFolds(input: Pick<MessagesTimelineRowsInput,- "timelineEntries" | "latestRun" | "isWorking" | "runlessWorkActive" | "runningRunId"+ | "timelineEntries"+ | "latestRun"+ | "isWorking"+ | "runlessWorkActive"+ | "runningRunId"+ | "toolCallVisibility"+ | "revealedMessageId">,) {- const timelineEntries = timelineRowEntries(input.timelineEntries);+ if (input.toolCallVisibility === "zen") return new Map<string, TurnFold>();+ const timelineEntries = timelineRowEntries(input);const unsettledRunId = deriveUnsettledRunId(input.latestRun ?? null, input.runningRunId ?? null);const failedRunIds = failedTimelineRunIds(timelineEntries, input.latestRun ?? null);const activeVisualResponseRunIds = deriveActiveVisualResponseRunIds({@@ -1407,8 +1516,10 @@ export function deriveMessagesTimelineRows(input: {threadStartCheckpointReady?: boolean;availableRevertTurnCounts?: ReadonlySet<number> | undefined;worktreeSetup?: WorktreeSetupSnapshot | null;+ toolCallVisibility?: ToolCallVisibility;+ revealedMessageId?: MessageId | null;}): MessagesTimelineRow[] {- const timelineEntries = timelineRowEntries(input.timelineEntries);+ const timelineEntries = timelineRowEntries(input);const isPendingApproval = (entry: WorkLogEntry) => {const item = entry.projectedItem?.item;return (@@ -1425,7 +1536,7 @@ export function deriveMessagesTimelineRows(input: {const unsettledRunId = deriveUnsettledRunId(input.latestRun ?? null, input.runningRunId ?? null);const revertTurnCountByUserMessageId = input.supportsConversationRollback? deriveRevertTurnCountByUserMessageId({- timelineEntries: timelineEntries,+ timelineEntries: input.timelineEntries,checkpoints: input.turnDiffSummaries,threadStartCheckpointReady: input.threadStartCheckpointReady === true,unsettledRunId,@@ -1453,15 +1564,18 @@ export function deriveMessagesTimelineRows(input: {isWorking: input.isWorking,});const runlessWorkActive = input.isWorking && input.runlessWorkActive === true;- const foldsByAnchorEntryId = deriveTurnFolds({- timelineEntries: timelineEntries,- terminalAssistantMessageIds,- latestRun: input.latestRun ?? null,- unfoldedRunIds: new Set([...activeVisualResponseRunIds, ...failedRunIds]),- runlessWorkActive,- liveSubagentEntryIds,- completeSupersededReplyEntryIds: completeSupersededReplyIds,- });+ const foldsByAnchorEntryId =+ input.toolCallVisibility === "zen"+ ? new Map<string, TurnFold>()+ : deriveTurnFolds({+ timelineEntries: timelineEntries,+ terminalAssistantMessageIds,+ latestRun: input.latestRun ?? null,+ unfoldedRunIds: new Set([...activeVisualResponseRunIds, ...failedRunIds]),+ runlessWorkActive,+ liveSubagentEntryIds,+ completeSupersededReplyEntryIds: completeSupersededReplyIds,+ });const timelineEntryById = new Map(timelineEntries.map((entry) => [entry.id, entry]));const collapsedEntryIds = new Set<string>();const collapsedFoldMemberIds = new Set<string>();@@ -1650,8 +1764,14 @@ export function deriveMessagesTimelineRows(input: {const activeCompactionRunId = compactsOnReturn? runningCompactionRunId: (resumeCompactionEntry?.entry.runId ?? null);+ const endedRunId = input.latestRun?.turnEnded === true ? input.latestRun.runId : null;+ const zenAnswerLanded =+ input.toolCallVisibility === "zen" &&+ endedRunId !== null &&+ timelineEntries.findLastIndex((entry) => timelineEntryRunId(entry) === endedRunId) >=+ activeTurnHeaderIndex;const appendWorkingRow = () => {- if (compactionOnlyRunFinished) return;+ if (compactionOnlyRunFinished || zenAnswerLanded) return;if (runningCompactionRunId !== null && activeCompactionRunId === null) return;nextRows.push({kind: "working",@@ -2246,7 +2366,13 @@ interface MessagesTimelineRowsProjection {export function timelineTurnFoldRunIdsByEntryId(input: Pick<MessagesTimelineRowsInput,- "timelineEntries" | "latestRun" | "isWorking" | "runlessWorkActive" | "runningRunId"+ | "timelineEntries"+ | "latestRun"+ | "isWorking"+ | "runlessWorkActive"+ | "runningRunId"+ | "toolCallVisibility"+ | "revealedMessageId">,): ReadonlyMap<string, RunId> {const byEntryId = new Map<string, RunId>();diff --git a/apps/web/src/components/chat/MessagesTimeline.tsx b/apps/web/src/components/chat/MessagesTimeline.tsxindex cea2daa1112..28d3299a7bd 100644--- a/apps/web/src/components/chat/MessagesTimeline.tsx+++ b/apps/web/src/components/chat/MessagesTimeline.tsx@@ -84,6 +84,7 @@ import {resolveTimelineMinimapVisibleRange,resolveTimelineMinimapHitStripWidth,timelineTurnFoldRunIdsByEntryId,+ liveAnswerPreview,type MessagesTimelineRow,type TimelineLatestRun,} from "./MessagesTimeline.logic";@@ -135,6 +136,7 @@ import {import { useThreadFindPositionReader } from "./useThreadFindPositionReader";import { ThreadActivityAnnouncer } from "./ThreadActivityAnnouncer";import { useStableHandoffRuns, useIncrementalTimelineRows, useStableRows } from "./useTimelineRows";+import { useClientSettings } from "../../hooks/useSettings";function timelineListStateFor(identity: string): {readonly identity: string;@@ -572,6 +574,10 @@ const ConversationTimeline = memo(function ConversationTimeline({}}+ const preferredToolCallVisibility = useClientSettings((settings) => settings.toolCallVisibility);+ const toolCallVisibility =+ findActive && preferredToolCallVisibility === "zen" ? "hideAll" : preferredToolCallVisibility;+ const revealedMessageId = citationRequest?.citation.messageId ?? null;// Imported turns and post-steer work fold under synthetic keys, not the entries' run ids.const findFoldRunIds = findActive? timelineTurnFoldRunIdsByEntryId({@@ -580,6 +586,8 @@ const ConversationTimeline = memo(function ConversationTimeline({runningRunId,isWorking,runlessWorkActive,+ toolCallVisibility,+ revealedMessageId,}): null;const activeFindRunId =@@ -621,6 +629,8 @@ const ConversationTimeline = memo(function ConversationTimeline({runningRunId,isWorking,runlessWorkActive,+ toolCallVisibility,+ revealedMessageId,})).get(citedEntry.id);setCitationExpandedFor(citationRequest.key);@@ -679,6 +689,8 @@ const ConversationTimeline = memo(function ConversationTimeline({threadStartCheckpointReady,availableRevertTurnCounts,worktreeSetup,+ toolCallVisibility,+ revealedMessageId,});const rows = useStableRows(rawRows, listIdentityKey);const matchedApprovalRequestIds = new Set<string>();@@ -1072,6 +1084,8 @@ const ConversationTimeline = memo(function ConversationTimeline({awaitingUser: awaitingUser !== null,isPreparingWorktree,latestRunId: latestRun?.runId ?? null,+ liveAnswerPreview:+ isWorking && toolCallVisibility === "zen" ? liveAnswerPreview(timelineEntries) : null,};// Mounted in both the empty and filled timeline so a thread's first turn// starts from a baseline instead of a fresh, silent region.@@ -1177,6 +1191,7 @@ const ConversationTimeline = memo(function ConversationTimeline({runningRunId,isWorking,runlessWorkActive,+ toolCallVisibility,rows,contentInsetEndAdjustment,});diff --git a/apps/web/src/components/chat/TimelineWorkGroupRows.tsx b/apps/web/src/components/chat/TimelineWorkGroupRows.tsxindex a1fccbaf786..5a62cde69c3 100644--- a/apps/web/src/components/chat/TimelineWorkGroupRows.tsx+++ b/apps/web/src/components/chat/TimelineWorkGroupRows.tsx@@ -360,12 +360,17 @@ function CompactingLabel({ createdAt }: { createdAt: string | null }) {export function ThinkingTimelineRow({ row }: { row: Extract<TimelineRow, { kind: "thinking" }> }) {const ctx = use(TimelineRowCtx);- const { isCompacting, isPreparingWorktree } = use(TimelineRowActivityCtx);+ const { isCompacting, isPreparingWorktree, liveAnswerPreview } = use(TimelineRowActivityCtx);if (isPreparingWorktree || isCompacting) return <WorkLogRow label="" />;// A failed group keeps this disclosure while an approval waits, but nothing is thinking then.const live = ctx.pendingApprovals.size === 0;const activity = (- <LiveActivityRow label="Thinking" iconName="brain" active={live} shimmer={live} />+ <LiveActivityRow+ label={liveAnswerPreview ?? "Thinking"}+ iconName="brain"+ active={live}+ shimmer={live}+ />);const { groupId } = row;if (groupId === undefined) return activity;diff --git a/apps/web/src/components/chat/timelineRowContext.ts b/apps/web/src/components/chat/timelineRowContext.tsindex 6334ef53bd0..1a0c3aa014a 100644--- a/apps/web/src/components/chat/timelineRowContext.ts+++ b/apps/web/src/components/chat/timelineRowContext.ts@@ -107,6 +107,7 @@ export interface TimelineRowActivityState {isPreparingWorktree: boolean;latestRunId: RunId | null;backgroundWorktreeSetup: WorktreeSetupSnapshot | null;+ liveAnswerPreview: string | null;}export const TimelineRowCtx = createContext<TimelineRowSharedState>(null!);diff --git a/apps/web/src/components/chat/useThreadFindPositionReader.ts b/apps/web/src/components/chat/useThreadFindPositionReader.tsindex 79445a1afaf..40403877971 100644--- a/apps/web/src/components/chat/useThreadFindPositionReader.ts+++ b/apps/web/src/components/chat/useThreadFindPositionReader.ts@@ -1,5 +1,6 @@import { useLayoutEffect } from "react";import type { RunId } from "@t3tools/contracts";+import type { ToolCallVisibility } from "@t3tools/contracts/settings";import type { TimelineEntry } from "../../session-logic";import {timelineTurnFoldRunIdsByEntryId,@@ -21,6 +22,7 @@ export function useThreadFindPositionReader({runningRunId,isWorking,runlessWorkActive,+ toolCallVisibility,rows,contentInsetEndAdjustment,}: {@@ -33,6 +35,7 @@ export function useThreadFindPositionReader({readonly runningRunId: RunId | null;readonly isWorking: boolean;readonly runlessWorkActive: boolean;+ readonly toolCallVisibility: ToolCallVisibility;readonly rows: MessagesTimelineRow[];readonly contentInsetEndAdjustment: number;}) {@@ -49,6 +52,7 @@ export function useThreadFindPositionReader({runningRunId,isWorking,runlessWorkActive,+ toolCallVisibility,});const entryById = new Map(timelineEntries.map((entry) => [entry.id, entry]));return readThreadFindPosition(@@ -99,5 +103,6 @@ export function useThreadFindPositionReader({runningRunId,timelineEntries,timelineViewportElement,+ toolCallVisibility,]);}diff --git a/apps/web/src/components/settings/LabsSettingsPanel.tsx b/apps/web/src/components/settings/LabsSettingsPanel.tsxindex 36c289b8335..c9c63987cb6 100644--- a/apps/web/src/components/settings/LabsSettingsPanel.tsx+++ b/apps/web/src/components/settings/LabsSettingsPanel.tsx@@ -1,10 +1,13 @@import { useAuth } from "@clerk/react";import { Link } from "@tanstack/react-router";import { managedCapabilityDenial } from "@t3tools/contracts";+import { ToolCallVisibility } from "@t3tools/contracts/settings";+import * as Schema from "effect/Schema";import { hasCloudPublicConfig } from "~/cloud/publicConfig";import { useT3ConnectAuthPrompt } from "../clerk/useT3ConnectAuthPrompt";import { Button } from "../ui/button";+import { Select, SelectItem, SelectPopup, SelectTrigger, SelectValue } from "../ui/select";import { Switch } from "../ui/switch";import { ScopedSwitch } from "./ScopedSwitch";import { SettingsPageContainer, SettingsRow, SettingsSection } from "./settingsLayout";@@ -21,6 +24,7 @@ export function LabsSettingsPanel() {<SettingsSection id="beta" title="Beta"><BoringSidebarRow /><BoringSidebarMultilineRow />+ <ToolCallVisibilityRow />{/* Clerk is only mounted when this build has T3 Connect. */}{hasCloudPublicConfig() ? <GuestLinksRowWithSignIn /> : <GuestLinksRow />}<LinkedEnvironmentsRow />@@ -72,6 +76,46 @@ function BoringSidebarMultilineRow() {);}+const TOOL_CALL_VISIBILITY_LABELS: Record<ToolCallVisibility, string> = {+ showAll: "Show all",+ hideSuccessful: "Hide successful",+ hideAll: "Hide all",+ zen: "Zen",+};++const isToolCallVisibility = Schema.is(ToolCallVisibility);++function ToolCallVisibilityRow() {+ const settings = useScopedSettings();+ const updateSettings = useUpdateScopedSettings();+ return (+ <SettingsRow+ {...searchableSetting("tool-call-visibility")}+ 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."+ control={+ <div className="w-full sm:w-40">+ <Select+ value={settings.toolCallVisibility}+ onValueChange={(value) => {+ if (isToolCallVisibility(value)) updateSettings({ toolCallVisibility: value });+ }}+ >+ <SelectTrigger size="sm" className="w-full min-w-0" aria-label="Tool calls in chat">+ <SelectValue>{TOOL_CALL_VISIBILITY_LABELS[settings.toolCallVisibility]}</SelectValue>+ </SelectTrigger>+ <SelectPopup align="end" alignItemWithTrigger={false}>+ <SelectItem value="showAll">Show all</SelectItem>+ <SelectItem value="hideSuccessful">Hide successful</SelectItem>+ <SelectItem value="hideAll">Hide all</SelectItem>+ <SelectItem value="zen">Zen</SelectItem>+ </SelectPopup>+ </Select>+ </div>+ }+ />+ );+}+/** Signed out of T3 Connect, the row offers to sign in instead of its switch. */function GuestLinksRowWithSignIn() {const { isSignedIn } = useAuth();diff --git a/apps/web/src/components/settings/settingsSearch.ts b/apps/web/src/components/settings/settingsSearch.tsindex f7156f33bb3..4c890c05aa4 100644--- a/apps/web/src/components/settings/settingsSearch.ts+++ b/apps/web/src/components/settings/settingsSearch.ts@@ -468,6 +468,14 @@ export const SETTINGS_SEARCH_ITEMS = [to: "/settings/labs",searchTerms: ["beta boring sidebar folder rows multiline branch pull request details"],},+ {+ id: "tool-call-visibility",+ title: "Tool calls in chat",+ to: "/settings/labs",+ searchTerms: [+ "beta hide tool calls commands edits searches work log activity quiet chat zen final answers only",+ ],+ },{id: "guest-links",title: "Guest links",diff --git a/docs/user/activity-log.md b/docs/user/activity-log.mdindex 0aad505e0fa..221e58e006c 100644--- a/docs/user/activity-log.md+++ b/docs/user/activity-log.md@@ -17,3 +17,14 @@ Failed calls do not count as successful messages or creations. Waiting on a threit finished, and an interrupt or cancellation request does not mean the thread stopped. When tooldetails are unavailable, summaries use a broader description instead of guessing how many threadswere affected.++## Hide tool calls++**Settings → Labs → Tool calls in chat** hides commands, file edits, searches, and MCP tool calls+from the conversation. **Hide successful** shows a call while it runs and keeps+it only if it fails. **Hide all** hides every call and shows **Thinking** while the agent works.+**Zen** also hides the agent's in-between messages, so each turn shows your message+and the agent's last reply, which appears when the turn ends. If you steer while the agent is+answering, the answer it finished before reading your steer stays too. On web and desktop, Find+shows the in-between messages while it is open. Approvals, questions, and errors always show. The+setting applies to this browser or device only.diff --git a/packages/client-runtime/src/work-log/presentation.ts b/packages/client-runtime/src/work-log/presentation.tsindex 9fa515e7939..fd0dca831e0 100644--- a/packages/client-runtime/src/work-log/presentation.ts+++ b/packages/client-runtime/src/work-log/presentation.ts@@ -9,6 +9,7 @@ import {type OrchestrationV2TurnItem,type ThreadId,} from "@t3tools/contracts";+import type { ToolCallVisibility } from "@t3tools/contracts/settings";import {resolveT3McpSummaryAction,resolveT3McpToolDefinition,@@ -318,6 +319,23 @@ export function workEntryDisplayIndicatesToolFailure(entry: WorkLogPresentationE));}+const HIDEABLE_TOOL_CALL_ITEM_TYPES: ReadonlySet<WorkLogPresentationEntry["itemType"]> = new Set([+ "command_execution",+ "file_change",+ "file_search",+ "web_search",+ "dynamic_tool",+]);++export function workEntryHiddenByToolCallVisibility(+ entry: WorkLogPresentationEntry,+ visibility: ToolCallVisibility,+): boolean {+ if (visibility === "showAll" || !HIDEABLE_TOOL_CALL_ITEM_TYPES.has(entry.itemType)) return false;+ if (visibility !== "hideSuccessful") return true;+ return entry.toolLifecycleStatus === "completed" && !workEntryDisplayIndicatesToolFailure(entry);+}+function workLogEntryIsLocalCodeSearch(entry: WorkLogPresentationEntry): boolean {return (entry.itemType === "file_search" ||diff --git a/packages/contracts/src/settings.ts b/packages/contracts/src/settings.tsindex c35193aa6f8..8a4b2558912 100644--- a/packages/contracts/src/settings.ts+++ b/packages/contracts/src/settings.ts@@ -342,6 +342,9 @@ export type ChatWidth = typeof ChatWidth.Type;export const EffortDisplay = Schema.Literals(["label", "bars"]);export type EffortDisplay = typeof EffortDisplay.Type;+export const ToolCallVisibility = Schema.Literals(["showAll", "hideSuccessful", "hideAll", "zen"]);+export type ToolCallVisibility = typeof ToolCallVisibility.Type;+export const ModelFavorite = Schema.Struct({provider: ProviderInstanceId,model: TrimmedNonEmptyString,@@ -499,6 +502,9 @@ export const ClientSettingsSchema = Schema.Struct({boringSidebarMultilineRows: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false)),),+ toolCallVisibility: ToolCallVisibility.pipe(+ Schema.withDecodingDefault(Effect.succeed("showAll" as const)),+ ),// Retired Labs toggle. Still read as the default for the Usage item in threadDetailsItems.threadDetailsUsageEnabled: Schema.Boolean.pipe(Schema.withDecodingDefault(Effect.succeed(false))),// Sparse show/hide overrides for thread details card items. Missing ids use the client's@@ -1877,6 +1883,7 @@ export const ClientSettingsPatch = Schema.Struct({showSkillsInSlashMenu: Schema.optionalKey(Schema.Boolean),boringSidebarEnabled: Schema.optionalKey(Schema.Boolean),boringSidebarMultilineRows: Schema.optionalKey(Schema.Boolean),+ toolCallVisibility: Schema.optionalKey(ToolCallVisibility),threadDetailsUsageEnabled: Schema.optionalKey(Schema.Boolean),threadDetailsItems: Schema.optionalKey(Schema.Record(Schema.String, Schema.Boolean)),legacySidebarEnabled: Schema.optionalKey(Schema.Boolean),