Skip to content

Commit 6c3d02e

Browse files
GoatXYZclaude
andcommitted
feat(web,mobile): a Transcript view setting opens finished turns and rows
Finished turns fold their work behind "Worked for", tool calls group under a summary, superseded attempts fold away on web, and each row's thinking text and tool output starts closed, so reading what an agent did means opening each one by hand. Settings → Chat → Transcript view picks Normal (today's behavior), Thinking (every turn, tool group, subagent group and superseded attempt starts open) or Verbose (each row's details open too), on web, desktop and mobile. On web and desktop the thread menu offers the same choice. Disclosure state now holds the ids flipped away from the view's default, so manual toggles and the find, citation, interrupt and jump-to-message auto-open paths all go through shared helpers, and anything can still be closed by hand. Changing the view clears the flips, and a thread remembered under another view opens fresh. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 960d576 commit 6c3d02e

31 files changed

Lines changed: 905 additions & 108 deletions

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

Lines changed: 51 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ScreenScrollView as ScrollView } from "../../components/ui/ScreenScrollView";
22
import { useAtomSet, useAtomValue } from "@effect/atom-react";
33
import { AsyncResult } from "effect/reactivity";
4+
import type { TranscriptView } from "@t3tools/contracts";
45
import { Platform, View } from "react-native";
56
import { useSafeAreaInsets } from "react-native-safe-area-context";
67

@@ -28,6 +29,28 @@ const FOLLOW_UP_OPTIONS: ReadonlyArray<{
2829
},
2930
];
3031

32+
const TRANSCRIPT_VIEW_OPTIONS: ReadonlyArray<{
33+
readonly view: TranscriptView;
34+
readonly label: string;
35+
readonly description: string;
36+
}> = [
37+
{
38+
view: "normal",
39+
label: "Normal",
40+
description: "Each finished turn folds its work behind “Worked for”.",
41+
},
42+
{
43+
view: "thinking",
44+
label: "Thinking",
45+
description: "Every turn opens with its tool calls and intermediate messages.",
46+
},
47+
{
48+
view: "verbose",
49+
label: "Verbose",
50+
description: "Every turn opens, and so does each tool call's thinking text and output.",
51+
},
52+
];
53+
3154
export function SettingsFollowUpRouteScreen() {
3255
const insets = useSafeAreaInsets();
3356
const preferencesResult = useAtomValue(mobilePreferencesAtom);
@@ -36,32 +59,50 @@ export function SettingsFollowUpRouteScreen() {
3659
const selectedBehavior = AsyncResult.isSuccess(preferencesResult)
3760
? (preferencesResult.value.followUpBehavior ?? DEFAULT_FOLLOW_UP_BEHAVIOR)
3861
: null;
62+
const selectedTranscriptView = AsyncResult.isSuccess(preferencesResult)
63+
? (preferencesResult.value.transcriptView ?? "normal")
64+
: null;
3965

4066
const content = (
4167
<ScrollView
4268
contentInsetAdjustmentBehavior="automatic"
4369
showsVerticalScrollIndicator={false}
4470
className="flex-1"
45-
contentContainerClassName="gap-3 px-5 pt-4"
71+
contentContainerClassName="gap-6 px-5 pt-4"
4672
contentContainerStyle={{ paddingBottom: Math.max(insets.bottom, 18) + 18 }}
4773
>
48-
<SettingsSection title="While the agent is running">
49-
{FOLLOW_UP_OPTIONS.map((option, index) => (
74+
<View className="gap-3">
75+
<SettingsSection title="While the agent is running">
76+
{FOLLOW_UP_OPTIONS.map((option, index) => (
77+
<SettingsChoiceRow
78+
key={option.behavior}
79+
label={option.label}
80+
description={option.description}
81+
selected={selectedBehavior === option.behavior}
82+
separated={index > 0}
83+
disabled={!preferencesReady}
84+
onPress={() => savePreferences({ followUpBehavior: option.behavior })}
85+
/>
86+
))}
87+
</SettingsSection>
88+
<Text className="px-2 text-sm text-foreground-muted">
89+
Long-press the send button to use the other option for a single message. With a hardware
90+
keyboard, hold Command while sending.
91+
</Text>
92+
</View>
93+
<SettingsSection title="Transcript view">
94+
{TRANSCRIPT_VIEW_OPTIONS.map((option, index) => (
5095
<SettingsChoiceRow
51-
key={option.behavior}
96+
key={option.view}
5297
label={option.label}
5398
description={option.description}
54-
selected={selectedBehavior === option.behavior}
99+
selected={selectedTranscriptView === option.view}
55100
separated={index > 0}
56101
disabled={!preferencesReady}
57-
onPress={() => savePreferences({ followUpBehavior: option.behavior })}
102+
onPress={() => savePreferences({ transcriptView: option.view })}
58103
/>
59104
))}
60105
</SettingsSection>
61-
<Text className="px-2 text-sm text-foreground-muted">
62-
Long-press the send button to use the other option for a single message. With a hardware
63-
keyboard, hold Command while sending.
64-
</Text>
65106
</ScrollView>
66107
);
67108

‎apps/mobile/src/features/settings/settings-search.ts‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,18 @@ const SETTINGS_SEARCH_TERMS = {
5656
"auto-resume",
5757
"thread behavior",
5858
],
59-
SettingsFollowUp: ["follow-ups", "queue", "steer", "while the agent is running"],
59+
SettingsFollowUp: [
60+
"follow-ups",
61+
"queue",
62+
"steer",
63+
"while the agent is running",
64+
"transcript view",
65+
"normal",
66+
"thinking",
67+
"verbose",
68+
"expand all turns",
69+
"worked for",
70+
],
6071
SettingsArchive: ["archive", "archived", "restore", "unarchive"],
6172
SettingsProviderAccounts: [
6273
"provider accounts",

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

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ import {
5353
type RunId,
5454
type ScheduledTaskId,
5555
type ScopedThreadRef,
56+
type TranscriptView,
5657
} from "@t3tools/contracts";
5758
import { renderAssistantCitationsAsText } from "@t3tools/shared/assistantCitations";
5859
import { encodeComposerContextFragment } from "@t3tools/shared/composerContextClipboard";
@@ -82,6 +83,15 @@ import {
8283
markdownImageSourceFragment,
8384
} from "@t3tools/client-runtime/markdown-images";
8485
import { resolveViewedImageAsset } from "@t3tools/client-runtime/work-log/presentation";
86+
import {
87+
disclosureOpen,
88+
transcriptFoldsStartOpen,
89+
transcriptRowsStartOpen,
90+
withDisclosureOpen,
91+
} from "@t3tools/client-runtime/work-log/disclosure";
92+
import { useAtomValue } from "@effect/atom-react";
93+
import { AsyncResult } from "effect/reactivity";
94+
import { mobilePreferencesAtom } from "../../state/preferences";
8595
import {
8696
renderCodexInlineDirectivesAsMarkdown,
8797
splitCodexArtifactTemplateMarkdown,
@@ -1308,6 +1318,8 @@ function renderFeedEntry(
13081318
> & {
13091319
readonly copiedRowId: string | null;
13101320
readonly expandedWorkRows: Record<string, boolean>;
1321+
readonly foldsStartOpen: boolean;
1322+
readonly rowsStartOpen: boolean;
13111323
readonly workRowSizing: ReturnType<typeof deriveThreadWorkLogSizing>;
13121324
readonly workGroupScrollPositions: Map<string, ThreadWorkGroupScrollPosition>;
13131325
readonly terminalAssistantMessageIds: ReadonlySet<string>;
@@ -1876,6 +1888,8 @@ function renderFeedEntry(
18761888
anchorKey={entry.id}
18771889
copiedRowId={props.copiedRowId}
18781890
expandedRows={props.expandedWorkRows}
1891+
foldsStartOpen={props.foldsStartOpen}
1892+
rowsStartOpen={props.rowsStartOpen}
18791893
rowSizing={props.workRowSizing}
18801894
scrollPositions={props.workGroupScrollPositions}
18811895
iconSubtleColor={iconSubtleColor}
@@ -2132,6 +2146,7 @@ function useThreadFeedPresentation(
21322146
props: ThreadFeedProps,
21332147
expandedTurnIds: ReadonlySet<RunId>,
21342148
expandedWorkGroups: Record<string, boolean>,
2149+
transcriptView: TranscriptView,
21352150
) {
21362151
const [feedCache] = useState(createThreadFeedCache);
21372152
return appendPendingThreadMessages(
@@ -2147,6 +2162,7 @@ function useThreadFeedPresentation(
21472162
props.activeWorkStartedAt,
21482163
props.runlessWorkActive ?? false,
21492164
feedCache,
2165+
transcriptView,
21502166
),
21512167
props.feed,
21522168
props.queuedMessages,
@@ -2240,7 +2256,28 @@ export const ThreadFeed = memo(function ThreadFeed({
22402256
expandedWorkRows: {},
22412257
expandedTurnIds: new Set(),
22422258
});
2243-
const { copiedRowId, expandedWorkGroups, expandedWorkRows, expandedTurnIds } = interactionState;
2259+
const { copiedRowId } = interactionState;
2260+
let { expandedWorkGroups, expandedWorkRows, expandedTurnIds } = interactionState;
2261+
const preferences = useAtomValue(mobilePreferencesAtom);
2262+
const transcriptView: TranscriptView = AsyncResult.isSuccess(preferences)
2263+
? (preferences.value.transcriptView ?? "normal")
2264+
: "normal";
2265+
const foldsStartOpen = transcriptFoldsStartOpen(transcriptView);
2266+
const rowsStartOpen = transcriptRowsStartOpen(transcriptView);
2267+
// Switching the view starts every disclosure from the new default.
2268+
const [disclosureView, setDisclosureView] = useState(transcriptView);
2269+
if (disclosureView !== transcriptView) {
2270+
setDisclosureView(transcriptView);
2271+
expandedWorkGroups = {};
2272+
expandedWorkRows = {};
2273+
expandedTurnIds = new Set();
2274+
setInteractionState((current) => ({
2275+
...current,
2276+
expandedWorkGroups,
2277+
expandedWorkRows,
2278+
expandedTurnIds,
2279+
}));
2280+
}
22442281
const markdownLinkRequest = useRef<AbortController | null>(null);
22452282
const onInlinePlaybackStart = () => {
22462283
markdownLinkRequest.current?.abort();
@@ -2790,18 +2827,18 @@ export const ThreadFeed = memo(function ThreadFeed({
27902827
const { jumpToMessageId } = props;
27912828
const jumpReady = !!jumpToMessageId && loadedListKey === `${feedThreadKey}:filled`;
27922829
const presentedFeed = appendGuestPendingMessages(
2793-
useThreadFeedPresentation(props, expandedTurnIds, expandedWorkGroups),
2830+
useThreadFeedPresentation(props, expandedTurnIds, expandedWorkGroups, transcriptView),
27942831
guestShare,
27952832
);
27962833
const jumpRunId =
27972834
jumpReady &&
27982835
!presentedFeed.some((entry) => entry.type === "message" && entry.id === jumpToMessageId)
27992836
? messageFoldRunId(props.feed, jumpToMessageId)
28002837
: null;
2801-
if (jumpRunId && !expandedTurnIds.has(jumpRunId)) {
2838+
if (jumpRunId && !disclosureOpen(expandedTurnIds, jumpRunId, foldsStartOpen)) {
28022839
setInteractionState((current) => ({
28032840
...current,
2804-
expandedTurnIds: new Set(current.expandedTurnIds).add(jumpRunId),
2841+
expandedTurnIds: withDisclosureOpen(current.expandedTurnIds, jumpRunId, foldsStartOpen),
28052842
}));
28062843
}
28072844
const setupAnchorIndex = presentedFeed.findIndex(
@@ -2913,15 +2950,16 @@ export const ThreadFeed = memo(function ThreadFeed({
29132950
}
29142951
return new Set(terminalIdsByTurn.values());
29152952
})();
2916-
// An interrupted run unfolds; a run that is no longer latest folds back.
2953+
// An interrupted run unfolds; a run that is no longer latest folds back
2954+
// unless every fold starts open.
29172955
const [previousLatestRun, setPreviousLatestRun] = useState(props.latestRun);
29182956
if (previousLatestRun !== props.latestRun) {
29192957
setPreviousLatestRun(props.latestRun);
29202958
const latest = props.latestRun;
29212959
const previous = previousLatestRun;
29222960
if (latest && previous) {
29232961
if (latest.runId !== previous.runId) {
2924-
if (expandedTurnIds.has(previous.runId)) {
2962+
if (!foldsStartOpen && expandedTurnIds.has(previous.runId)) {
29252963
setInteractionState((current) => {
29262964
const next = new Set(current.expandedTurnIds);
29272965
next.delete(previous.runId);
@@ -2931,7 +2969,11 @@ export const ThreadFeed = memo(function ThreadFeed({
29312969
} else if (previous.status === "running" && latest.status === "interrupted") {
29322970
setInteractionState((current) => ({
29332971
...current,
2934-
expandedTurnIds: new Set(current.expandedTurnIds).add(latest.runId),
2972+
expandedTurnIds: withDisclosureOpen(
2973+
current.expandedTurnIds,
2974+
latest.runId,
2975+
foldsStartOpen,
2976+
),
29352977
}));
29362978
}
29372979
}
@@ -3034,15 +3076,16 @@ export const ThreadFeed = memo(function ThreadFeed({
30343076
}));
30353077
};
30363078

3037-
// Lone rows share their group's disclosure state so opened details survive a second call joining.
3079+
// Lone rows share their group's disclosure state so opened details survive a second call
3080+
// joining. An expanded transcript already opens that group.
30383081
const onToggleWorkRow = (rowId: string, anchorKey?: string, groupId?: string) => {
30393082
suspendEndScrollMaintenanceForDisclosure(anchorKey ?? null);
30403083
setInteractionState((current) => {
30413084
const expanded = !(current.expandedWorkRows[rowId] ?? false);
30423085
return {
30433086
...current,
30443087
expandedWorkRows: { ...current.expandedWorkRows, [rowId]: expanded },
3045-
...(groupId === undefined
3088+
...(groupId === undefined || foldsStartOpen
30463089
? {}
30473090
: { expandedWorkGroups: { ...current.expandedWorkGroups, [groupId]: expanded } }),
30483091
};
@@ -3099,7 +3142,9 @@ export const ThreadFeed = memo(function ThreadFeed({
30993142
return undefined;
31003143
}
31013144
return entry.activities.some(
3102-
(activity) => activity.prominent || expandedWorkRows[activity.id],
3145+
(activity) =>
3146+
activity.prominent ||
3147+
(activity.canExpand && (expandedWorkRows[activity.id] ?? false) !== rowsStartOpen),
31033148
)
31043149
? undefined
31053150
: collapsedWorkLogHeight(entry.activities, entry.continuesWorkLog);
@@ -3146,6 +3191,8 @@ export const ThreadFeed = memo(function ThreadFeed({
31463191
threadId: props.threadId,
31473192
copiedRowId,
31483193
expandedWorkRows,
3194+
foldsStartOpen,
3195+
rowsStartOpen,
31493196
workRowSizing,
31503197
workGroupScrollPositions,
31513198
terminalAssistantMessageIds,

‎apps/mobile/src/features/threads/thread-subagent-group.tsx‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export function ThreadSubagentGroup(props: {
6767
readonly environmentId: EnvironmentId;
6868
readonly anchorKey: string;
6969
readonly expandedRows: Readonly<Record<string, boolean>>;
70+
readonly foldsStartOpen: boolean;
7071
readonly iconSubtleColor: ColorValue;
7172
readonly onToggleRow: (rowId: string, anchorKey: string) => void;
7273
}) {
@@ -97,7 +98,7 @@ export function ThreadSubagentGroup(props: {
9798
const grouped = agents.length > 1;
9899
const label = `${agents.length} subagents`;
99100
const summary = summarizeSubagentStatuses(agents.map((agent) => agent.status));
100-
const expanded = props.expandedRows[props.anchorKey] ?? false;
101+
const expanded = (props.expandedRows[props.anchorKey] ?? false) !== props.foldsStartOpen;
101102
const serverConfigs = useServerConfigs();
102103
// A task in a linked environment runs a provider instance of that environment.
103104
const providerOf = (item: SubagentItem) =>

0 commit comments

Comments
 (0)