@devries-cameron20 / t3code-1 / commits / 35cc7724c5
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(mobile): compaction notice becomes a chip in the composer (#36872)

Julius Marminge committed Nov 14, 2026 at 10:47 UTC 35cc7724c5d7c9535ca9410693ab6764a0e4ef20
2 files changed +42 -27
apps/mobile/src/features/threads/ThreadComposer.tsx
+39 -1
@@ -80,7 +80,12 @@ import { VideoPreviewModal, type VideoPreviewSource } from "../../components/ui/
80 import { GlassSurface } from "../../components/ui/GlassSurface";
81 import { ComposerEditor, type ComposerEditorHandle } from "../../components/ComposerEditor";
82 import { fileRoutePathSegments } from "../files/filePath";
83 -import { ComposerActionButton, ComposerToolbarRow } from "../../components/ComposerToolbar";
83 +import {
84 + ComposerActionButton,
85 + ComposerInlineControl,
86 + ComposerToolbarRow,
87 +} from "../../components/ComposerToolbar";
88 +import { formatTokens } from "@t3tools/shared/usageFormat";
89 import { ComposerModelControl } from "../../components/ComposerModelControl";
90 import {
91 composerStripAttachments,
@@ -219,6 +224,12 @@ export interface ThreadComposerProps {
224 readonly selectedThread: EnvironmentThreadShell;
225 readonly reportedModelSelection?: ModelSelection | null;
226 readonly hasCompactableConversation: boolean;
227 + /** Set while the next send compacts the thread first. */
228 + readonly compactBeforeSend?: {
229 + readonly tokens: number;
230 + readonly keepFullHistory: boolean;
231 + readonly toggleKeepFullHistory: () => void;
232 + } | null;
233 /** Arms a fresh session for the next message; absent where `/clear` is unavailable. */
234 readonly onFreshSession?: () => void;
235 readonly offersSideChat?: boolean;
@@ -819,6 +830,32 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
830 </View>
831 );
832
833 + const compactBeforeSend =
834 + props.compactBeforeSend && !showResumeAction && queuedEdit === null
835 + ? props.compactBeforeSend
836 + : null;
837 + const compactTokens = compactBeforeSend ? formatTokens(compactBeforeSend.tokens) : null;
838 + const compactControl =
839 + compactBeforeSend && compactTokens !== null ? (
840 + <ComposerInlineControl
841 + size={usesLargeControls ? "large" : "regular"}
842 + icon="arrow.down.right.and.arrow.up.left"
843 + label={compactTokens}
844 + selected={!compactBeforeSend.keepFullHistory}
845 + showChevron={false}
846 + disabled={!props.canOperateThread}
847 + accessibilityLabel={
848 + compactBeforeSend.keepFullHistory
849 + ? `Next send keeps all ${compactTokens} tokens of history`
850 + : `Next send compacts ${compactTokens} tokens of history first`
851 + }
852 + accessibilityHint={
853 + compactBeforeSend.keepFullHistory ? "Compacts first" : "Keeps the full history"
854 + }
855 + onPress={compactBeforeSend.toggleKeepFullHistory}
856 + />
857 + ) : null;
858 +
859 return (
860 <Animated.View
861 onLayout={(event) => props.onHeightChange?.(event.nativeEvent.layout.height)}
@@ -1099,6 +1136,7 @@ export const ThreadComposer = function ThreadComposer(props: ThreadComposerProps
1136 compactEditor.isExpanded ? { flex: 1, justifyContent: "flex-end" } : undefined
1137 }
1138 >
1139 + {compactControl}
1140 {modelControl}
1141 <ComposerDictationStartAction
1142 size={usesLargeControls ? "large" : "regular"}
apps/mobile/src/features/threads/ThreadDetailScreen.tsx
+3 -26
@@ -181,8 +181,6 @@ import { PendingApprovalCard } from "./PendingApprovalCard";
181 import { ComposerErrorNotice } from "./ComposerErrorNotice";
182 import { ManagedRuntimeModeNotice } from "./ManagedRuntimeModeNotice";
183 import { FreshSessionNotice } from "./FreshSessionNotice";
184 -import { Notice } from "../../components/ui/Notice";
185 -import { formatTokens } from "@t3tools/shared/usageFormat";
184 import { ComposerFeedback } from "./ComposerFeedback";
185 import { ComposerUsageLimits } from "./ComposerUsageLimits";
186 import { PendingUserInputCard } from "./PendingUserInputCard";
@@ -202,6 +200,7 @@ import {
200 COMPOSER_COLLAPSED_CHROME,
201 THREAD_COMPOSER_BOTTOM_GUTTER,
202 ThreadComposer,
203 + type ThreadComposerProps,
204 } from "./ThreadComposer";
205 import { ComposerPopoverHost } from "./ComposerPopoverHost";
206 import { ThreadFeed, type ThreadFeedHistoryControls } from "./ThreadFeed";
@@ -252,11 +251,7 @@ export interface ThreadDetailScreenProps {
251 readonly extensionStatuses?: NonNullable<OrchestrationV2ProviderSession["extensionStatuses"]>;
252 readonly isCompacting: boolean;
253 /** Set while the next send compacts the thread first. */
255 - readonly compactBeforeSend?: {
256 - readonly tokens: number;
257 - readonly keepFullHistory: boolean;
258 - readonly toggleKeepFullHistory: () => void;
259 - } | null;
254 + readonly compactBeforeSend?: ThreadComposerProps["compactBeforeSend"];
255 readonly creationState:
256 | {
257 readonly kind: "preparing";
@@ -1706,25 +1701,6 @@ function ThreadDetailBody(
1701 {freshSessionAvailable ? (
1702 <FreshSessionNotice threadKey={selectedThreadKey} />
1703 ) : null}
1709 - {props.compactBeforeSend ? (
1710 - <View className="px-4 pb-3">
1711 - <Notice
1712 - message={
1713 - props.compactBeforeSend.keepFullHistory
1714 - ? `Your next message keeps all ${formatTokens(props.compactBeforeSend.tokens)} tokens of history.`
1715 - : `Your next message compacts ${formatTokens(props.compactBeforeSend.tokens)} tokens of history first.`
1716 - }
1717 - icon="arrow.down.right.and.arrow.up.left"
1718 - floating
1719 - onDismiss={props.compactBeforeSend.toggleKeepFullHistory}
1720 - dismissLabel={
1721 - props.compactBeforeSend.keepFullHistory
1722 - ? "Compact first"
1723 - : "Keep the full history"
1724 - }
1725 - />
1726 - </View>
1727 - ) : null}
1704 {props.canOperateThread ? (
1705 <ManagedRuntimeModeNotice
1706 threadKey={selectedThreadKey}
@@ -1894,6 +1870,7 @@ function ThreadDetailBody(
1870 connectionState={props.connectionStateLabel}
1871 environmentLabel={props.environmentLabel}
1872 selectedThread={props.selectedThread}
1873 + compactBeforeSend={props.compactBeforeSend ?? null}
1874 hasCompactableConversation={
1875 hasCompactableConversation && !props.isCompacting
1876 }