TypeScript
feat(mobile): update tool summaries and chat transitions (#8793)
Julius Marmingef15680bd3c08
diff --git a/apps/mobile/src/features/threads/ThreadComposer.tsx b/apps/mobile/src/features/threads/ThreadComposer.tsxindex 2339994e9f5..c81b2456dbf 100644--- a/apps/mobile/src/features/threads/ThreadComposer.tsx+++ b/apps/mobile/src/features/threads/ThreadComposer.tsx@@ -9,7 +9,16 @@ import type {} from "@t3tools/contracts";import { StackActions, useFocusEffect, useNavigation } from "@react-navigation/native";import type { ReactNode } from "react";-import { memo, useCallback, useEffect, useMemo, useRef, useState, type RefObject } from "react";+import {+ memo,+ useCallback,+ useEffect,+ useLayoutEffect,+ useMemo,+ useRef,+ useState,+ type RefObject,+} from "react";import { ActivityIndicator, Image, Platform, Pressable, View, type ViewStyle } from "react-native";import ImageViewing from "react-native-image-viewing";import Animated, {@@ -18,6 +27,9 @@ import Animated, {FadeOut,FadeOutDown,LinearTransition,+ useAnimatedStyle,+ useSharedValue,+ withTiming,} from "react-native-reanimated";import { useUniwindTheme } from "../../lib/useUniwindTheme";import { armAgentAwarenessLiveActivityForLocalWork } from "../agent-awareness/remoteRegistration";@@ -31,7 +43,6 @@ import {ComposerInlineControl,ComposerToolbarButton,ComposerToolbarRow,- ComposerToolbarScroller,} from "../../components/ComposerToolbar";import { ControlPill } from "../../components/ControlPill";import { ProviderIcon } from "../../components/ProviderIcon";@@ -104,14 +115,17 @@ export interface ThreadComposerProps {* iOS 26+ devices and keeps the existing opaque fallback elsewhere.* Exported so NewTaskDraftScreen can render the same composer chrome.*/-// One timing for every piece of the expanded↔compact morph so the surface,-// toolbar, and siblings move together instead of popping between layouts.+// The bottom-anchored dock position and clipped surface height use the same+// transition so the card grows upward without exposing its final-size content.// Android gets NO layout transition: the composer rides the keyboard via// KeyboardStickyView (frame-synced to the IME), and a time-based morph// running alongside that translate reads as jitter. Snapping the layout and// letting the keyboard-synced slide be the only motion looks native there.-const COMPOSER_LAYOUT_TRANSITION =- Platform.OS === "android" ? undefined : LinearTransition.duration(220);+export const COMPOSER_TRANSITION_DURATION_MS = 220;+export const COMPOSER_LAYOUT_TRANSITION =+ Platform.OS === "android"+ ? undefined+ : LinearTransition.duration(COMPOSER_TRANSITION_DURATION_MS);export function ComposerSurface(props: {readonly children: ReactNode;@@ -119,29 +133,53 @@ export function ComposerSurface(props: {/** Existing thread composers morph between pill and card layouts. */readonly animateLayout?: boolean;}) {- // A box shadow follows the rounded surface even when the glass is transparent.- // Keep it outside the clipped content so the shadow can extend past the edge.+ const targetBorderRadius =+ typeof props.style.borderRadius === "number" ? props.style.borderRadius : 0;+ const animatedBorderRadius = useSharedValue(targetBorderRadius);+ const shouldAnimate = props.animateLayout !== false && Platform.OS !== "android";+ useLayoutEffect(() => {+ animatedBorderRadius.value = shouldAnimate+ ? withTiming(targetBorderRadius, {+ duration: COMPOSER_TRANSITION_DURATION_MS,+ })+ : targetBorderRadius;+ }, [animatedBorderRadius, shouldAnimate, targetBorderRadius]);+ const animatedShapeStyle = useAnimatedStyle(() => ({+ borderRadius: animatedBorderRadius.value,+ }));++ // Clipping here keeps the expanded toolbar inside the glass while the+ // bottom-anchored host owns the geometry transition.return (<Animated.ViewclassName="shadow-[0_6px_28px] shadow-adaptive-black-a15-a35"layout={props.animateLayout === false ? undefined : COMPOSER_LAYOUT_TRANSITION}- style={{- borderRadius: props.style.borderRadius,- // Android versions before 9 do not support outset box shadows.- elevation: Platform.OS === "android" && Platform.Version < 28 ? 10 : undefined,- }}+ style={[+ animatedShapeStyle,+ {+ overflow: "hidden",+ // Android versions before 9 do not support outset box shadows.+ elevation: Platform.OS === "android" && Platform.Version < 28 ? 10 : undefined,+ },+ ]}><GlassSurfacechrome="none"fallbackClassName="border border-border bg-card-translucent"glassEffectStyle="regular"// The composer is a passive material containing interactive controls.- // Expo GlassView defaults to non-interactive and both layouts share it.+ // Keep native glass out of the interactive content's layout path.+ pointerEvents="none"tintColor="transparent"- style={props.style}+ style={{+ position: "absolute",+ inset: 0,+ borderRadius: targetBorderRadius,+ }}>- {props.children}+ {null}</GlassSurface>+ <View style={props.style}>{props.children}</View></Animated.View>);}@@ -254,9 +292,8 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposerconst isExpanded = isFocused || settingsSheetPresentation.isActive;const canSend = hasContent;- // Notify the parent from the derived value, not focus events: the parent- // sizes the feed inset from this, and blur-during-sheet would otherwise- // report collapsed while the composer still renders expanded.+ // Keep the parent's feed inset synchronized while the settings sheet keeps+ // the composer expanded between editor focus events.useEffect(() => {onExpandedChange?.(isExpanded);}, [isExpanded, onExpandedChange]);@@ -279,13 +316,17 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposerconst onEditorFocusChange = props.onEditorFocusChange;const handleFocus = useCallback(() => {setIsFocused(true);+ onExpandedChange?.(true);onEditorFocusChange?.(true);- }, [onEditorFocusChange]);+ }, [onEditorFocusChange, onExpandedChange]);const handleBlur = useCallback(() => {setIsFocused(false);+ if (!settingsSheetPresentation.isActive) {+ onExpandedChange?.(false);+ }onEditorFocusChange?.(false);- }, [onEditorFocusChange]);+ }, [onEditorFocusChange, onExpandedChange, settingsSheetPresentation.isActive]);const showStopAction =props.selectedThread.session?.status === "running" ||props.selectedThread.session?.status === "starting";@@ -445,7 +486,6 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposerreturn (<Animated.ViewclassName="px-4"- layout={COMPOSER_LAYOUT_TRANSITION}style={{paddingTop: isExpanded ? 8 : 6,paddingBottom: (props.bottomInset ?? 0) + (isExpanded ? 8 : 6),@@ -460,7 +500,6 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer/><Animated.ViewclassName="relative w-full self-center"- layout={COMPOSER_LAYOUT_TRANSITION}style={{ maxWidth: props.contentMaxWidth }}>{composerMenu.trigger && composerMenu.items.length > 0 ? (@@ -493,12 +532,11 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposerpaddingTop: 14,}: {- borderRadius: 999,+ // Keep the numeric radius close to the expanded card so the+ // shape morph stays bounded while rendering as a capsule.+ borderRadius: 27,overflow: "hidden" as const,- flexDirection: "row" as const,- alignItems: "center" as const,- paddingLeft: 18,- paddingRight: 5,+ paddingHorizontal: 14,paddingVertical: 5,}}@@ -518,95 +556,124 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposer</Animated.View>) : null}- <View className={isExpanded ? undefined : "min-w-0 flex-1"}>- <ComposerEditor- ref={inputRef}- multiline- value={props.draftMessage}- skills={selectedProviderStatus?.skills ?? []}- selection={composerMenu.selection}- onChangeText={props.onChangeDraftMessage}- onSelectionChange={composerMenu.onSelectionChange}- onPasteImages={(uris) => void props.onNativePasteImages(uris)}- placeholder={props.placeholder}- onFocus={handleFocus}- onBlur={handleBlur}- onSubmit={handleSend}- scrollEnabled={isExpanded}- // Android: collapsed single line centers natively (gravity) in- // a pill-height box matching the send button; iOS keeps insets.- singleLineCentered={!isExpanded}- contentInsetVertical={isExpanded || Platform.OS === "android" ? 0 : 6}- style={- isExpanded- ? {- minHeight: 72,- maxHeight: 160,- paddingHorizontal: 4,- paddingVertical: 4,- }- : {- height: 36,- }- }- textStyle={{- ...bodyText,- color: foregroundColor,- }}- />- </View>- {!isExpanded && props.draftAttachments.length > 0 ? (- <View className="flex-row gap-1 pl-1">- {props.draftAttachments.slice(0, 3).map((image) => (- <Pressable key={image.id} onPress={() => onPressImage(image.previewUri)}>- <Image- source={{ uri: image.previewUri }}- className="size-[30px] rounded-lg bg-subtle"- resizeMode="cover"- />- </Pressable>- ))}- {props.draftAttachments.length > 3 ? (- <View className="size-[30px] items-center justify-center rounded-lg bg-subtle-strong">- <Text className="text-foreground-muted text-2xs font-t3-bold">- +{props.draftAttachments.length - 3}- </Text>- </View>- ) : null}+ <View className={isExpanded ? undefined : "flex-row items-center"}>+ <View className={isExpanded ? undefined : "min-w-0 flex-1"}>+ <ComposerEditor+ ref={inputRef}+ multiline+ value={props.draftMessage}+ skills={selectedProviderStatus?.skills ?? []}+ selection={composerMenu.selection}+ onChangeText={props.onChangeDraftMessage}+ onSelectionChange={composerMenu.onSelectionChange}+ onPasteImages={(uris) => void props.onNativePasteImages(uris)}+ placeholder={props.placeholder}+ onFocus={handleFocus}+ onBlur={handleBlur}+ onSubmit={handleSend}+ scrollEnabled={isExpanded}+ // Android: collapsed single line centers natively (gravity) in+ // a pill-height box matching the send button; iOS keeps insets.+ singleLineCentered={!isExpanded}+ contentInsetVertical={isExpanded || Platform.OS === "android" ? 0 : 6}+ style={+ isExpanded+ ? {+ minHeight: 72,+ maxHeight: 160,+ paddingHorizontal: 4,+ paddingVertical: 4,+ }+ : {+ height: 36,+ paddingHorizontal: 4,+ }+ }+ textStyle={{+ ...bodyText,+ color: foregroundColor,+ }}+ /></View>- ) : null}- {!isExpanded ? (- <Animated.View entering={FadeIn.duration(180)} exiting={FadeOut.duration(100)}>- {showStopAction ? (- <ControlPill icon="stop.fill" variant="danger" onPress={props.onStopThread} />- ) : (- <ControlPill- icon="arrow.up"- variant="primary"- disabled={!canSend}- onPress={handleSend}- />- )}- </Animated.View>- ) : null}- {isExpanded ? (+ {!isExpanded && props.draftAttachments.length > 0 ? (+ <View className="flex-row gap-1 pl-1">+ {props.draftAttachments.slice(0, 3).map((image) => (+ <Pressable key={image.id} onPress={() => onPressImage(image.previewUri)}>+ <Image+ source={{ uri: image.previewUri }}+ className="size-[30px] rounded-lg bg-subtle"+ resizeMode="cover"+ />+ </Pressable>+ ))}+ {props.draftAttachments.length > 3 ? (+ <View className="size-[30px] items-center justify-center rounded-lg bg-subtle-strong">+ <Text className="text-foreground-muted text-2xs font-t3-bold">+ +{props.draftAttachments.length - 3}+ </Text>+ </View>+ ) : null}+ </View>+ ) : null}+ {!isExpanded ? (+ <Animated.View entering={FadeIn.duration(180)} exiting={FadeOut.duration(100)}>+ {showStopAction ? (+ <ControlPill icon="stop.fill" variant="danger" onPress={props.onStopThread} />+ ) : (+ <ControlPill+ icon="arrow.up"+ variant="primary"+ disabled={!canSend}+ onPress={handleSend}+ />+ )}+ </Animated.View>+ ) : null}+ </View>+ <View+ accessibilityElementsHidden={!isExpanded}+ collapsable={false}+ importantForAccessibility={isExpanded ? "auto" : "no-hide-descendants"}+ pointerEvents={isExpanded ? "auto" : "none"}+ style={+ isExpanded+ ? undefined+ : {+ height: 0,+ opacity: 0,+ overflow: "hidden",+ }+ }+ ><ComposerToolbarRow paddingBottom={0} paddingHorizontal={0} paddingTop={4}>- <ComposerToolbarScroller contentPaddingRight={8}>+ <View className="min-w-0 flex-1 flex-row items-center gap-2"><ComposerToolbarButtonaccessibilityLabel="Add attachment"icon="plus"onPress={() => void props.onPickDraftImages()}showChevron={false}/>- <ComposerInlineControl- accessibilityLabel="Model and reasoning settings"- emphasized- iconNode={- <ProviderIcon provider={currentModelOption?.providerDriver} size={16} />- }- label={currentModelOption?.label ?? currentModelSelection.model}- maxWidth={152}- onPress={openSettings}+ <View className="min-w-0 flex-1" style={{ maxWidth: 152 }}>+ <ComposerInlineControl+ accessibilityLabel="Model and reasoning settings"+ emphasized+ iconNode={+ <ProviderIcon provider={currentModelOption?.providerDriver} size={16} />+ }+ label={currentModelOption?.label ?? currentModelSelection.model}+ maxWidth={152}+ onPress={openSettings}+ />+ </View>+ </View>+ <View className="shrink-0 flex-row items-center gap-2">+ <ComposerToolbarButton+ accessibilityLabel={sendLabel}+ icon="arrow.up"+ variant="primary"+ disabled={!canSend}+ onPress={handleSend}+ showChevron={false}/>{showStopAction ? (<ComposerToolbarButton@@ -617,17 +684,9 @@ export const ThreadComposer = memo(function ThreadComposer(props: ThreadComposershowChevron={false}/>) : null}- </ComposerToolbarScroller>- <ComposerToolbarButton- accessibilityLabel={sendLabel}- icon="arrow.up"- variant="primary"- disabled={!canSend}- onPress={handleSend}- showChevron={false}- />+ </View></ComposerToolbarRow>- ) : null}+ </View></ComposerSurface>{/* Queue count */}diff --git a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx b/apps/mobile/src/features/threads/ThreadDetailScreen.tsxindex 2c686019972..7888cd5321c 100644--- a/apps/mobile/src/features/threads/ThreadDetailScreen.tsx+++ b/apps/mobile/src/features/threads/ThreadDetailScreen.tsx@@ -27,7 +27,6 @@ import {useRef,useState,} from "react";-import { isLiquidGlassSupported, LiquidGlassView } from "@callstack/liquid-glass";import {AppState,Keyboard,@@ -45,13 +44,13 @@ import Animated, {Easing,FadeInDown,FadeOut,+ ReduceMotion,useAnimatedReaction,useSharedValue,withTiming,} from "react-native-reanimated";import { useSafeAreaInsets } from "react-native-safe-area-context";-import { ControlPill } from "../../components/ControlPill";import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";import type { ComposerEditorHandle } from "../../components/ComposerEditor";import type { StatusTone } from "../../components/StatusPill";@@ -67,6 +66,10 @@ import type {} from "../../lib/threadActivity";import { PendingApprovalCard } from "./PendingApprovalCard";import { PendingUserInputCard } from "./PendingUserInputCard";+import {+ FLOATING_WORKING_CONTROL_COVERAGE,+ FloatingWorkingControl,+} from "./floating-working-control";import {derivePendingUserInputMaxHeight,ESTIMATED_KEYBOARD_HEIGHT,@@ -75,6 +78,8 @@ import {import {COMPOSER_COLLAPSED_CHROME,COMPOSER_EXPANDED_CHROME,+ COMPOSER_LAYOUT_TRANSITION,+ COMPOSER_TRANSITION_DURATION_MS,ThreadComposer,} from "./ThreadComposer";import { ThreadFeed } from "./ThreadFeed";@@ -290,6 +295,14 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Threadreturn null;}})();+ const showWorkingControl =+ props.activeWorkStartedAt !== null &&+ contentPresentationKind === "ready" &&+ threadSyncPhase === null &&+ props.connectionStateLabel === "connected" &&+ props.activePendingApproval === null &&+ props.activePendingUserInput === null;+ const floatingWorkingStartedAt = showWorkingControl ? props.activeWorkStartedAt : null;const selectedThreadFeed = props.selectedThreadFeed;const composerChrome = composerExpanded ? COMPOSER_EXPANDED_CHROME : COMPOSER_COLLAPSED_CHROME;const composerOverlapHeight = composerChrome + composerBottomInset;@@ -343,6 +356,7 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: ThreadcomposerOverlayRef,Math.max(0, estimatedOverlayHeight - nativeInsetOvercount),-nativeInsetOvercount,+ Platform.OS === "ios" ? COMPOSER_TRANSITION_DURATION_MS : 0,);// The expanded questionnaire is an absolute overlay on iOS, so it never// changes the measured overlay height (that constancy is what keeps the@@ -356,6 +370,15 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Threadconst userInputCardProgress = useSharedValue(1);const userInputInsetProgress = useSharedValue(1);const userInputCardCoverage = useSharedValue(0);+ const floatingControlCoverage = useSharedValue(+ showWorkingControl ? FLOATING_WORKING_CONTROL_COVERAGE : 0,+ );+ useEffect(() => {+ floatingControlCoverage.value = withTiming(+ showWorkingControl ? FLOATING_WORKING_CONTROL_COVERAGE : 0,+ { duration: 180, reduceMotion: ReduceMotion.System },+ );+ }, [floatingControlCoverage, showWorkingControl]);// Android renders the expanded card in-flow (it cannot hit-test the iOS// overlay outside the bar's bounds), so its measured overlay height already// includes the card — the coverage extra is iOS-only.@@ -366,6 +389,7 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: ThreaduseAnimatedReaction(() =>contentInsetEndAdjustment.value ++ floatingControlCoverage.value +(userInputCoverageApplies ? userInputInsetProgress.value * userInputCardCoverage.value : 0),(value) => {combinedContentInsetEndAdjustment.value = value;@@ -375,20 +399,24 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Threadconst { freeze, scrollMessageToEnd } = useKeyboardScrollToEnd({ listRef });const endFollowEnabledRef = useRef(true);endFollowEnabledRef.current = endFollowEnabled;- const userInputRepinTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);+ const overlayRepinTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);+ const previousWorkingControlStateRef = useRef({+ threadKey: selectedThreadKey,+ visible: false,+ });// The list's own corrections for these inset changes drift on short// content (and the error compounds across toggles), so deterministically// re-pin the end once a toggle settles: a no-op when the resting position// is already right, corrective when it is not. Follow state is re-checked// inside the callback — the user may grab the list during the settle// window, and yanking them back would override a live gesture.- const scheduleUserInputRepin = useCallback(+ const scheduleOverlayRepin = useCallback((delayMs: number) => {- if (userInputRepinTimerRef.current !== null) {- clearTimeout(userInputRepinTimerRef.current);+ if (overlayRepinTimerRef.current !== null) {+ clearTimeout(overlayRepinTimerRef.current);}- userInputRepinTimerRef.current = setTimeout(() => {- userInputRepinTimerRef.current = null;+ overlayRepinTimerRef.current = setTimeout(() => {+ overlayRepinTimerRef.current = null;if (!endFollowEnabledRef.current) {return;}@@ -401,12 +429,29 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread);useEffect(() => () => {- if (userInputRepinTimerRef.current !== null) {- clearTimeout(userInputRepinTimerRef.current);+ if (overlayRepinTimerRef.current !== null) {+ clearTimeout(overlayRepinTimerRef.current);}},[],);+ useEffect(() => {+ const previous = previousWorkingControlStateRef.current;+ const threadChanged = previous.threadKey !== selectedThreadKey;+ const visibilityChanged = previous.visible !== showWorkingControl;+ previousWorkingControlStateRef.current = {+ threadKey: selectedThreadKey,+ visible: showWorkingControl,+ };+ if ((!threadChanged && !visibilityChanged) || (threadChanged && !showWorkingControl)) {+ return;+ }+ // LegendList applies the larger inset but does not re-anchor short+ // followed conversations when this floating coverage changes after the+ // initial load. Re-pin after the finite inset transition; the callback+ // checks follow state again so a user who scrolled up stays put.+ scheduleOverlayRepin(230);+ }, [scheduleOverlayRepin, selectedThreadKey, showWorkingControl]);const handleToggleUserInputCollapsed = useCallback(() => {if (activeUserInputRequestId === null) {return;@@ -416,7 +461,7 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: ThreaduserInputCardProgress.value = withTiming(1, USER_INPUT_TOGGLE_TIMING);userInputInsetProgress.value = withTiming(1, USER_INPUT_TOGGLE_TIMING);setCollapsedUserInputRequestId(null);- scheduleUserInputRepin(USER_INPUT_TOGGLE_DURATION_MS + 50);+ scheduleOverlayRepin(USER_INPUT_TOGGLE_DURATION_MS + 50);} else {// Collapsing hides the custom-answer inputs; release the keyboard with// them instead of leaving it up over a dead responder.@@ -427,11 +472,11 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread// anchor.userInputInsetProgress.value = 0;setCollapsedUserInputRequestId(activeUserInputRequestId);- scheduleUserInputRepin(60);+ scheduleOverlayRepin(60);}}, [activeUserInputRequestId,- scheduleUserInputRepin,+ scheduleOverlayRepin,userInputCardProgress,userInputCollapsed,userInputInsetProgress,@@ -622,7 +667,9 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: ThreadsubmittedMessageId={submittedMessageId}contentInsetEndAdjustment={combinedContentInsetEndAdjustment}contentTopInset={0}- contentBottomInset={estimatedOverlayHeight}+ contentBottomInset={+ estimatedOverlayHeight + (showWorkingControl ? FLOATING_WORKING_CONTROL_COVERAGE : 0)+ }contentMaxWidth={contentMaxWidth}layoutVariant={layoutVariant}usesAutomaticContentInsets={props.usesAutomaticContentInsets}@@ -639,137 +686,110 @@ export const ThreadDetailScreen = memo(function ThreadDetailScreen(props: Thread{/* Floating composer — sticks to keyboard via KeyboardStickyView */}{showContent ? (<KeyboardStickyView- // The animated keyboard height can remain stale after a dismissed- // IME on both platforms. Visibility is the authoritative closed- // state, so disable the translation rather than stranding the pill.- enabled={isKeyboardVisible && !keyboardStateSuspect}- style={{ position: "absolute", bottom: 0, left: 0, right: 0 }}+ // iOS emits a native animated height target on both will-show and+ // will-hide, so stay subscribed for the full transition. Android+ // retains its background/resume stale-state quarantine.+ enabled={Platform.OS === "ios" || (isKeyboardVisible && !keyboardStateSuspect)}+ pointerEvents="box-none"+ style={{ position: "absolute", bottom: 0, left: 0, right: 0, top: 0 }}offset={{ closed: 0, opened: 0 }}>- {/* No paddingTop here: the overlay's measured height becomes the- list's bottom inset, so any padding above the pill/composer- pushes the resting content floor up by the same amount. */}- <View ref={composerOverlayRef} onLayout={onComposerLayout} className="w-full">- {showScrollToEndButton ? (- <Animated.View- pointerEvents="box-none"- className="absolute -top-11 left-0 right-0 z-20 items-center"- entering={FadeInDown.duration(160)}- exiting={FadeOut.duration(100)}- >- {isLiquidGlassSupported ? (- <LiquidGlassView- colorScheme={isDarkMode ? "dark" : "light"}- effect="regular"- interactive- // Interactive glass can render larger than the requested- // box (minimum touch size), so center the pill instead of- // relying on it filling the glass exactly.- style={{- alignItems: "center",- borderRadius: 18,- height: 36,- justifyContent: "center",- overflow: "hidden",- width: 36,- }}+ {/* The fixed sticky host gives this bottom-anchored child a stable+ coordinate space. Its top and height can then animate together+ instead of the auto-sized host jumping to Yoga's destination. */}+ <Animated.View+ layout={COMPOSER_LAYOUT_TRANSITION}+ pointerEvents="box-none"+ style={{ position: "absolute", bottom: 0, left: 0, right: 0 }}+ >+ {/* No paddingTop here: the overlay's measured height becomes the+ list's bottom inset, so any padding above the pill/composer+ pushes the resting content floor up by the same amount. */}+ <View ref={composerOverlayRef} onLayout={onComposerLayout} className="w-full">+ <FloatingWorkingControl+ colorScheme={isDarkMode ? "dark" : "light"}+ startedAt={floatingWorkingStartedAt}+ showScrollToEnd={showScrollToEndButton}+ onScrollToEnd={handleScrollToEnd}+ />+ <View className="w-full self-center" style={{ maxWidth: contentMaxWidth }}>+ {props.activePendingApproval || props.activePendingUserInput ? (+ <Animated.View+ className="shrink-0 gap-3 px-4 pb-3"+ // The questionnaire replaces the composer, so it must pad+ // the home indicator the composer normally covers.+ style={+ activeUserInputRequestId !== null+ ? { paddingBottom: composerBottomInset }+ : undefined+ }+ entering={FadeInDown.duration(220)}+ exiting={FadeOut.duration(140)}>- <ControlPill- accessibilityLabel="Scroll to end"- activateOnPressIn- className="h-9 w-9 bg-transparent"- icon={{ ios: "chevron.down", android: "keyboard_arrow_down" }}- onPress={handleScrollToEnd}- />- </LiquidGlassView>- ) : (- <ControlPill- accessibilityLabel="Scroll to end"- activateOnPressIn- className="h-9 w-9 border border-border bg-card shadow-md shadow-black/10"- icon={{ ios: "chevron.down", android: "keyboard_arrow_down" }}- onPress={handleScrollToEnd}- />- )}- </Animated.View>- ) : null}- <View className="w-full self-center" style={{ maxWidth: contentMaxWidth }}>- {props.activePendingApproval || props.activePendingUserInput ? (- <Animated.View- className="shrink-0 gap-3 px-4 pb-3"- // The questionnaire replaces the composer, so it must pad- // the home indicator the composer normally covers.- style={- activeUserInputRequestId !== null- ? { paddingBottom: composerBottomInset }- : undefined- }- entering={FadeInDown.duration(220)}- exiting={FadeOut.duration(140)}- >- {props.activePendingApproval ? (- <PendingApprovalCard- approval={props.activePendingApproval}- respondingApprovalId={props.respondingApprovalId}- onRespond={props.onRespondToApproval}- />- ) : null}- {props.activePendingUserInput ? (- <PendingUserInputCard- pendingUserInput={props.activePendingUserInput}- maxHeight={pendingUserInputMaxHeight}- collapsed={userInputCollapsed}- onToggleCollapsed={handleToggleUserInputCollapsed}- onStopThread={props.onStopThread}- cardProgress={userInputCardProgress}- cardCoverage={userInputCardCoverage}- onInputFocusChange={handleOwnedInputFocusChange}- drafts={props.activePendingUserInputDrafts}- answers={props.activePendingUserInputAnswers}- respondingUserInputId={props.respondingUserInputId}- onSelectOption={props.onSelectUserInputOption}- onChangeCustomAnswer={props.onChangeUserInputCustomAnswer}- onSubmit={props.onSubmitUserInput}- />- ) : null}- </Animated.View>- ) : null}- </View>-- {/* Hidden (not unmounted) while a user-input request owns the+ {props.activePendingApproval ? (+ <PendingApprovalCard+ approval={props.activePendingApproval}+ respondingApprovalId={props.respondingApprovalId}+ onRespond={props.onRespondToApproval}+ />+ ) : null}+ {props.activePendingUserInput ? (+ <PendingUserInputCard+ pendingUserInput={props.activePendingUserInput}+ maxHeight={pendingUserInputMaxHeight}+ collapsed={userInputCollapsed}+ onToggleCollapsed={handleToggleUserInputCollapsed}+ onStopThread={props.onStopThread}+ cardProgress={userInputCardProgress}+ cardCoverage={userInputCardCoverage}+ onInputFocusChange={handleOwnedInputFocusChange}+ drafts={props.activePendingUserInputDrafts}+ answers={props.activePendingUserInputAnswers}+ respondingUserInputId={props.respondingUserInputId}+ onSelectOption={props.onSelectUserInputOption}+ onChangeCustomAnswer={props.onChangeUserInputCustomAnswer}+ onSubmit={props.onSubmitUserInput}+ />+ ) : null}+ </Animated.View>+ ) : null}+ </View>++ {/* Hidden (not unmounted) while a user-input request owns thecomposer slot, so composer drafts and editor state survive. */}- <View style={activeUserInputRequestId !== null ? { display: "none" } : undefined}>- <ThreadComposer- editorRef={composerEditorRef}- draftMessage={props.draftMessage}- draftAttachments={props.draftAttachments}- placeholder="Ask the repo agent, or run a command…"- contentMaxWidth={contentMaxWidth}- connectionState={props.connectionStateLabel}- connectionError={props.connectionError}- environmentLabel={props.environmentLabel}- threadSyncPhase={threadSyncPhase}- selectedThread={props.selectedThread}- serverConfig={props.serverConfig}- queueCount={props.selectedThreadQueueCount}- environmentId={props.environmentId}- projectCwd={props.projectWorkspaceRoot}- bottomInset={composerBottomInset}- onChangeDraftMessage={props.onChangeDraftMessage}- onPickDraftImages={props.onPickDraftImages}- onNativePasteImages={props.onNativePasteImages}- onRemoveDraftImage={props.onRemoveDraftImage}- onStopThread={props.onStopThread}- onSendMessage={handleSendMessage}- onReconnectEnvironment={props.onReconnectEnvironment}- onUpdateModelSelection={props.onUpdateThreadModelSelection}- onUpdateRuntimeMode={props.onUpdateThreadRuntimeMode}- onUpdateInteractionMode={props.onUpdateThreadInteractionMode}- onExpandedChange={setComposerExpanded}- onEditorFocusChange={handleOwnedInputFocusChange}- />+ <View style={activeUserInputRequestId !== null ? { display: "none" } : undefined}>+ <ThreadComposer+ editorRef={composerEditorRef}+ draftMessage={props.draftMessage}+ draftAttachments={props.draftAttachments}+ placeholder="Ask the repo agent, or run a command…"+ contentMaxWidth={contentMaxWidth}+ connectionState={props.connectionStateLabel}+ connectionError={props.connectionError}+ environmentLabel={props.environmentLabel}+ threadSyncPhase={threadSyncPhase}+ selectedThread={props.selectedThread}+ serverConfig={props.serverConfig}+ queueCount={props.selectedThreadQueueCount}+ environmentId={props.environmentId}+ projectCwd={props.projectWorkspaceRoot}+ bottomInset={composerBottomInset}+ onChangeDraftMessage={props.onChangeDraftMessage}+ onPickDraftImages={props.onPickDraftImages}+ onNativePasteImages={props.onNativePasteImages}+ onRemoveDraftImage={props.onRemoveDraftImage}+ onStopThread={props.onStopThread}+ onSendMessage={handleSendMessage}+ onReconnectEnvironment={props.onReconnectEnvironment}+ onUpdateModelSelection={props.onUpdateThreadModelSelection}+ onUpdateRuntimeMode={props.onUpdateThreadRuntimeMode}+ onUpdateInteractionMode={props.onUpdateThreadInteractionMode}+ onExpandedChange={setComposerExpanded}+ onEditorFocusChange={handleOwnedInputFocusChange}+ />+ </View></View>- </View>+ </Animated.View></KeyboardStickyView>) : null}</View>diff --git a/apps/mobile/src/features/threads/ThreadFeed.tsx b/apps/mobile/src/features/threads/ThreadFeed.tsxindex 23bee49455e..ec41cb9b5e2 100644--- a/apps/mobile/src/features/threads/ThreadFeed.tsx+++ b/apps/mobile/src/features/threads/ThreadFeed.tsx@@ -4,7 +4,6 @@ import { type LegendListRef } from "@legendapp/list/react-native";import type { EnvironmentId, MessageId, ThreadId, TurnId } from "@t3tools/contracts";import { classifyMarkdownImageSource } from "@t3tools/client-runtime/markdown-images";import { CHAT_LIST_ANCHOR_OFFSET, resolveChatListAnchoredEndSpace } from "@t3tools/shared/chatList";-import { formatElapsed } from "@t3tools/shared/orchestrationTiming";import { SymbolView } from "../../components/AppSymbol";import { HeaderHeightContext } from "@react-navigation/elements";import { useNavigation } from "@react-navigation/native";@@ -45,7 +44,13 @@ import {import { TouchableOpacity } from "react-native-gesture-handler";import ImageViewing from "react-native-image-viewing";import { useSafeAreaInsets } from "react-native-safe-area-context";-import Animated, { FadeIn, FadeInUp, type SharedValue } from "react-native-reanimated";+import Animated, {+ FadeIn,+ FadeInUp,+ FadeOut,+ LinearTransition,+ type SharedValue,+} from "react-native-reanimated";import { useUniwindTheme } from "../../lib/useUniwindTheme";import { IOS_NAV_BAR_HEIGHT } from "../../lib/layoutMetrics";import { useFontFamily } from "../../lib/useFontFamily";@@ -84,9 +89,7 @@ import {import {resolveMarkdownFontSizes,resolveNativeMarkdownTypography,- scaledTypographyLineHeight,} from "../../lib/appearancePreferences";-import { MOBILE_TYPOGRAPHY } from "../../lib/typography";import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";import { useAppearanceCodeSurface } from "../settings/appearance/useAppearanceCodeSurface";import { markdownFileIconSource } from "@t3tools/mobile-markdown-text/file-icons";@@ -105,6 +108,7 @@ import {collapsedWorkLogHeight,ThreadWorkGroupToggle,ThreadWorkLog,+ THREAD_DISCLOSURE_TRANSITION_MS,WORK_GROUP_TOGGLE_HEIGHT,} from "./thread-work-log";import { useMarkdownCodeHighlight } from "./markdownCodeHighlightState";@@ -134,9 +138,10 @@ function formatMessageTime(input: string): string {// so its height is a constant; a drifted value costs one correction on// measure, not a persistent offset.const TURN_FOLD_HEIGHT = 56; // min-h-11 (44) + mb-3 (12)-// The working row has no min-height clamp — its height follows the scaled-// text-xs line height (see workingRowHeight in ThreadFeed).-const WORKING_ROW_VERTICAL_EXTRAS = 24; // py-1 (8) + mb-4 (16)+const THREAD_FEED_LAYOUT_TRANSITION = LinearTransition.duration(THREAD_DISCLOSURE_TRANSITION_MS);+const THREAD_FEED_DISCLOSURE_ENTER_TRANSITION = FadeIn.duration(140);+const THREAD_FEED_DISCLOSURE_EXIT_TRANSITION = FadeOut.duration(120);+const EMPTY_DISCLOSURE_ENTRY_IDS: ReadonlySet<string> = new Set();// Entering animations must only play for rows born just now — LegendList// remounts rows when they scroll back into view, and replaying an entrance for@@ -985,10 +990,6 @@ function renderFeedEntry(const entry = info.item;const { markdownStyles, iconSubtleColor, userBubbleColor } = props;- if (entry.type === "working") {- return <WorkingTimelineRow startedAt={entry.createdAt} />;- }-if (entry.type === "turn-fold") {return (<Pressable@@ -1017,7 +1018,10 @@ function renderFeedEntry(expanded={entry.expanded}hiddenCount={entry.hiddenCount}iconSubtleColor={iconSubtleColor}- onlyToolActivities={entry.onlyToolActivities}+ summary={entry.summary}+ summaryKind={entry.summaryKind}+ hasFailure={entry.hasFailure}+ shimmer={entry.shimmer}onToggle={() => props.onToggleWorkGroup(entry.groupId)}/>);@@ -1180,32 +1184,6 @@ function renderFeedEntry();}-const WorkingTimelineRow = memo(function WorkingTimelineRow(props: { readonly startedAt: string }) {- const [nowMs, setNowMs] = useState(() => Date.now());-- useEffect(() => {- const intervalId = setInterval(() => {- setNowMs(Date.now());- }, 1_000);- return () => clearInterval(intervalId);- }, [props.startedAt]);-- const durationLabel = formatElapsed(props.startedAt, new Date(nowMs).toISOString()) ?? "0s";-- return (- <View className="mb-4 flex-row items-center gap-2 px-1.5 py-1">- <View className="flex-row items-center gap-1">- <View className="h-1 w-1 rounded-full bg-adaptive-neutral-400-500" />- <View className="h-1 w-1 rounded-full bg-adaptive-neutral-400-a80-500-a80" />- <View className="h-1 w-1 rounded-full bg-adaptive-neutral-400-a60-500-a60" />- </View>- <Text className="font-t3-medium text-xs tabular-nums text-adaptive-neutral-600-400">- Working for {durationLabel}- </Text>- </View>- );-});-function UserMessageContent(props: {readonly text: string;readonly markdownStyles: MarkdownStyleSet;@@ -1479,14 +1457,14 @@ function ThreadFeedPlaceholder(props: {export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {const navigation = useNavigation();const copyFeedbackTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);- const foldSettleFrameRef = useRef<number | null>(null);- const foldSettleSecondFrameRef = useRef<number | null>(null);+ const disclosureSettleFrameRef = useRef<number | null>(null);+ const disclosureSettleSecondFrameRef = useRef<number | null>(null);const disclosureAnchorKeyRef = useRef<string | null>(null);+ const previousPresentedFeedRef = useRef<ReadonlyArray<ThreadFeedEntry> | null>(null);const headerMaterialVisibleRef = useRef(false);const previousLatestTurnRef = useRef(props.latestTurn);const userScrollSettleTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);const { width: windowWidth } = useWindowDimensions();- const { appearance } = useAppearancePreferences();const [viewportWidth, setViewportWidth] = useState(() =>props.layoutVariant === "split" ? 0 : windowWidth,);@@ -1791,14 +1769,37 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {props.latestTurn,],);+ const disclosureEnteringEntryIds = useMemo(() => {+ const anchorKey = disclosureAnchorKeyRef.current;+ const previousPresentedFeed = previousPresentedFeedRef.current;+ if (!disclosureToggleSettling || anchorKey === null || previousPresentedFeed === null) {+ return EMPTY_DISCLOSURE_ENTRY_IDS;+ }++ const previousIds = new Set(previousPresentedFeed.map((entry) => entry.id));+ const anchorIndex = presentedFeed.findIndex((entry) => entry.id === anchorKey);+ const enteringIds = new Set<string>();+ if (anchorIndex < 0) {+ return enteringIds;+ }+ for (let index = anchorIndex + 1; index < presentedFeed.length; index += 1) {+ const entryId = presentedFeed[index]!.id;+ if (previousIds.has(entryId)) {+ break;+ }+ enteringIds.add(entryId);+ }+ return enteringIds;+ }, [disclosureToggleSettling, presentedFeed]);++ useLayoutEffect(() => {+ previousPresentedFeedRef.current = presentedFeed;+ }, [presentedFeed]);- // The empty↔filled key below remounts the list, which resets its imperative- // content-inset override — and useKeyboardChatComposerInset (mounted above- // the remount boundary) deduplicates by height, so it never re-reports the- // composer inset to the fresh instance. Re-report the measured overlay height- // (composer plus any pending approval / user-input card) so the remounted- // list's scroll math gets the true value; on Android the declarative- // contentInset floor below covers the window before this effect lands.+ // The empty↔filled key below remounts the list and resets its imperative+ // content-inset override. Seed the fresh instance synchronously with the+ // current overlay height before the scroll integration's next reaction;+ // on Android the declarative contentInset floor covers this same window.const listMountKey = `${feedThreadKey}:${props.feed.length === 0 ? "empty" : "filled"}`;useLayoutEffect(() => {const bottom = props.contentInsetEndAdjustment.value;@@ -1863,34 +1864,52 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {if (copyFeedbackTimeoutRef.current) {clearTimeout(copyFeedbackTimeoutRef.current);}- if (foldSettleFrameRef.current !== null) {- cancelAnimationFrame(foldSettleFrameRef.current);+ if (disclosureSettleFrameRef.current !== null) {+ cancelAnimationFrame(disclosureSettleFrameRef.current);}- if (foldSettleSecondFrameRef.current !== null) {- cancelAnimationFrame(foldSettleSecondFrameRef.current);+ if (disclosureSettleSecondFrameRef.current !== null) {+ cancelAnimationFrame(disclosureSettleSecondFrameRef.current);}};}, []);- const suspendEndScrollMaintenanceForDisclosure = useCallback((anchorKey: string | null) => {- disclosureAnchorKeyRef.current = anchorKey;- setDisclosureToggleSettling(true);- if (foldSettleFrameRef.current !== null) {- cancelAnimationFrame(foldSettleFrameRef.current);+ const settleDisclosureAfterLayout = useCallback(() => {+ if (disclosureSettleFrameRef.current !== null) {+ cancelAnimationFrame(disclosureSettleFrameRef.current);}- if (foldSettleSecondFrameRef.current !== null) {- cancelAnimationFrame(foldSettleSecondFrameRef.current);+ if (disclosureSettleSecondFrameRef.current !== null) {+ cancelAnimationFrame(disclosureSettleSecondFrameRef.current);}- foldSettleFrameRef.current = requestAnimationFrame(() => {- foldSettleSecondFrameRef.current = requestAnimationFrame(() => {+ disclosureSettleFrameRef.current = requestAnimationFrame(() => {+ disclosureSettleSecondFrameRef.current = requestAnimationFrame(() => {disclosureAnchorKeyRef.current = null;setDisclosureToggleSettling(false);- foldSettleFrameRef.current = null;- foldSettleSecondFrameRef.current = null;+ disclosureSettleFrameRef.current = null;+ disclosureSettleSecondFrameRef.current = null;});});}, []);+ const suspendEndScrollMaintenanceForDisclosure = useCallback((anchorKey: string | null) => {+ disclosureAnchorKeyRef.current = anchorKey;+ setDisclosureToggleSettling(true);+ }, []);++ // Start the quiet-frame countdown after React has committed the disclosure.+ // Every measured item-size change restarts it, so end maintenance cannot+ // wake between the data mutation and LegendList's final layout correction.+ useLayoutEffect(() => {+ if (disclosureAnchorKeyRef.current !== null) {+ settleDisclosureAfterLayout();+ }+ }, [expandedTurnIds, expandedWorkGroups, expandedWorkRows, settleDisclosureAfterLayout]);++ const handleItemSizeChanged = useCallback(() => {+ if (disclosureAnchorKeyRef.current !== null) {+ settleDisclosureAfterLayout();+ }+ }, [settleDisclosureAfterLayout]);+const shouldRestoreVisibleContentPosition = useCallback((entry: ThreadFeedEntry) => {const disclosureAnchorKey = disclosureAnchorKeyRef.current;return disclosureAnchorKey === null || entry.id === disclosureAnchorKey;@@ -1975,11 +1994,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {// scrolling up through unmeasured content corrects each row's height as it// mounts — the feed visibly jumps. Fixed sizes make the small chrome rows// exact; message rows stay undefined and use LegendList's per-type running- // average once one of their type has been measured. Text-driven heights- // follow the configurable base font size via scaledTypographyLineHeight.- const workingRowHeight =- WORKING_ROW_VERTICAL_EXTRAS +- scaledTypographyLineHeight(MOBILE_TYPOGRAPHY.label, appearance.baseFontSize);+ // average once one of their type has been measured.const getFixedItemSize = useCallback((entry: ThreadFeedEntry) => {switch (entry.type) {@@ -1987,46 +2002,56 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {return TURN_FOLD_HEIGHT;case "work-toggle":return WORK_GROUP_TOGGLE_HEIGHT;- case "working":- return workingRowHeight;case "activity-group":// Expanded rows append a variable detail block — fall back to// measurement for those groups.return entry.activities.some((activity) => expandedWorkRows[activity.id])? undefined- : collapsedWorkLogHeight(entry.activities, appearance.baseFontSize);+ : collapsedWorkLogHeight(entry.activities);default:return undefined;}},- [expandedWorkRows, workingRowHeight, appearance.baseFontSize],+ [expandedWorkRows],);const renderItem = useCallback(- (info: { item: ThreadFeedEntry; index: number }) =>- renderFeedEntry(info, {- environmentId: props.environmentId,- copiedRowId,- expandedWorkRows,- terminalAssistantMessageIds,- unsettledTurnId,- onCopyWorkRow,- onToggleWorkGroup,- onToggleWorkRow,- onToggleTurnFold,- onPressImage,- onMarkdownLinkPress,- renderMarkdownImage,- iconSubtleColor,- userBubbleColor,- markdownStyles,- reviewCommentColors,- reviewCommentBubbleWidth,- userBubbleMaxWidth,- skills: props.skills,- }),+ (info: { item: ThreadFeedEntry; index: number }) => (+ <Animated.View+ key={info.item.id}+ entering={+ disclosureEnteringEntryIds.has(info.item.id)+ ? THREAD_FEED_DISCLOSURE_ENTER_TRANSITION+ : undefined+ }+ exiting={THREAD_FEED_DISCLOSURE_EXIT_TRANSITION}+ >+ {renderFeedEntry(info, {+ environmentId: props.environmentId,+ copiedRowId,+ expandedWorkRows,+ terminalAssistantMessageIds,+ unsettledTurnId,+ onCopyWorkRow,+ onToggleWorkGroup,+ onToggleWorkRow,+ onToggleTurnFold,+ onPressImage,+ onMarkdownLinkPress,+ renderMarkdownImage,+ iconSubtleColor,+ userBubbleColor,+ markdownStyles,+ reviewCommentColors,+ reviewCommentBubbleWidth,+ userBubbleMaxWidth,+ skills: props.skills,+ })}+ </Animated.View>+ ),[copiedRowId,+ disclosureEnteringEntryIds,expandedWorkRows,terminalAssistantMessageIds,unsettledTurnId,@@ -2093,7 +2118,7 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {}: { scrollIndicatorInsets: { top: topContentInset, bottom: 0 } })}{...(anchoredEndSpace ? { anchoredEndSpace } : {})}- // Patched LegendList prop (patches/@[email protected]):+ // Patched LegendList prop (patches/@[email protected]):// lets its scroll math clamp programmatic scrolls to -headerInset// instead of 0, so initialScrollAtEnd/maintainScrollAtEnd on short// content rest below the transparent header rather than at frame top.@@ -2148,6 +2173,8 @@ export const ThreadFeed = memo(function ThreadFeed(props: ThreadFeedProps) {entry.type === "message" ? `message:${entry.message.role}` : entry.type}getFixedItemSize={getFixedItemSize}+ itemLayoutAnimation={THREAD_FEED_LAYOUT_TRANSITION}+ onItemSizeChanged={handleItemSizeChanged}// Measure rows well before they scroll into view so estimate→actual// corrections land offscreen instead of under the user's finger.drawDistance={500}diff --git a/apps/mobile/src/features/threads/floating-working-control.tsx b/apps/mobile/src/features/threads/floating-working-control.tsxnew file mode 100644index 00000000000..1883947c048--- /dev/null+++ b/apps/mobile/src/features/threads/floating-working-control.tsx@@ -0,0 +1,205 @@+import {+ isLiquidGlassSupported,+ LiquidGlassContainerView,+ LiquidGlassView,+} from "@callstack/liquid-glass";+import { useEffect, useState } from "react";+import { Text as SystemText, View } from "react-native";+import Animated, {+ Easing,+ FadeIn,+ FadeOut,+ ReduceMotion,+ useAnimatedStyle,+ useSharedValue,+ withTiming,+} from "react-native-reanimated";+import { withUniwind } from "uniwind";++import { AppText as Text } from "../../components/AppText";+import { ControlPill } from "../../components/ControlPill";++const CONTROL_HEIGHT = 44;+const CONTROL_COMPOSER_GAP = 8;+const GLASS_MERGE_SPACING = 12;+const CONTROL_ENTERING = FadeIn.duration(180).reduceMotion(ReduceMotion.System);+const CONTROL_EXITING = FadeOut.duration(120).reduceMotion(ReduceMotion.System);+const CONTROL_TIMING = {+ duration: 240,+ easing: Easing.out(Easing.cubic),+ reduceMotion: ReduceMotion.System,+} as const;+const CONTROL_SEPARATION = (16 + CONTROL_HEIGHT) / 2;++const UniwindLiquidGlassView = withUniwind(LiquidGlassView);+const UniwindLiquidGlassContainerView = withUniwind(LiquidGlassContainerView);+const AnimatedLiquidGlassView = Animated.createAnimatedComponent(UniwindLiquidGlassView);++export const FLOATING_WORKING_CONTROL_COVERAGE = CONTROL_HEIGHT + CONTROL_COMPOSER_GAP;++export function FloatingWorkingControl(props: {+ readonly colorScheme: "light" | "dark";+ readonly startedAt: string | null;+ readonly showScrollToEnd: boolean;+ readonly onScrollToEnd: () => void;+}) {+ const separationProgress = useSharedValue(props.showScrollToEnd ? 1 : 0);++ useEffect(() => {+ separationProgress.value = withTiming(props.showScrollToEnd ? 1 : 0, CONTROL_TIMING);+ }, [props.showScrollToEnd, separationProgress]);++ const timerStyle = useAnimatedStyle(() => ({+ transform: [{ translateX: CONTROL_SEPARATION * (1 - separationProgress.value) }],+ }));+ const arrowTransformStyle = useAnimatedStyle(() => ({+ transform: [{ translateX: -CONTROL_SEPARATION * (1 - separationProgress.value) }],+ }));+ const arrowContentStyle = useAnimatedStyle(() => ({+ opacity: separationProgress.value,+ }));++ if (props.startedAt === null && !props.showScrollToEnd) {+ return null;+ }++ return (+ <Animated.View+ pointerEvents="box-none"+ className="absolute left-0 right-0 z-20 items-center"+ style={{ top: -FLOATING_WORKING_CONTROL_COVERAGE }}+ entering={isLiquidGlassSupported ? undefined : CONTROL_ENTERING}+ exiting={isLiquidGlassSupported ? undefined : CONTROL_EXITING}+ >+ {props.startedAt !== null && isLiquidGlassSupported ? (+ <UniwindLiquidGlassContainerView+ spacing={GLASS_MERGE_SPACING}+ pointerEvents="box-none"+ className="flex-row items-center gap-4"+ >+ <AnimatedLiquidGlassView+ colorScheme={props.colorScheme}+ effect="regular"+ pointerEvents="none"+ className="h-11 justify-center overflow-hidden rounded-full"+ style={timerStyle}+ >+ <WorkingDuration startedAt={props.startedAt} />+ </AnimatedLiquidGlassView>++ <AnimatedLiquidGlassView+ colorScheme={props.colorScheme}+ effect="regular"+ interactive+ pointerEvents={props.showScrollToEnd ? "auto" : "none"}+ accessibilityElementsHidden={!props.showScrollToEnd}+ importantForAccessibility={props.showScrollToEnd ? "auto" : "no-hide-descendants"}+ className="h-11 w-11 items-center justify-center overflow-hidden rounded-full"+ style={arrowTransformStyle}+ >+ <Animated.View style={arrowContentStyle}>+ <ScrollToEndButton disabled={!props.showScrollToEnd} onPress={props.onScrollToEnd} />+ </Animated.View>+ </AnimatedLiquidGlassView>+ </UniwindLiquidGlassContainerView>+ ) : props.startedAt !== null ? (+ <View pointerEvents="box-none" className="flex-row items-center gap-4">+ <Animated.View+ pointerEvents="none"+ className="h-11 justify-center rounded-full border border-border bg-card shadow-md shadow-black/10"+ style={timerStyle}+ >+ <WorkingDuration startedAt={props.startedAt} />+ </Animated.View>++ <Animated.View+ pointerEvents={props.showScrollToEnd ? "auto" : "none"}+ accessibilityElementsHidden={!props.showScrollToEnd}+ importantForAccessibility={props.showScrollToEnd ? "auto" : "no-hide-descendants"}+ style={[arrowTransformStyle, arrowContentStyle]}+ >+ <ControlPill+ accessibilityLabel="Scroll to end"+ activateOnPressIn+ className="h-11 w-11 border border-border bg-card shadow-md shadow-black/10"+ disabled={!props.showScrollToEnd}+ icon={{ ios: "chevron.down", android: "keyboard_arrow_down" }}+ onPress={props.onScrollToEnd}+ />+ </Animated.View>+ </View>+ ) : isLiquidGlassSupported ? (+ <UniwindLiquidGlassView+ colorScheme={props.colorScheme}+ effect="regular"+ interactive+ className="h-11 w-11 items-center justify-center overflow-hidden rounded-full"+ >+ <ScrollToEndButton onPress={props.onScrollToEnd} />+ </UniwindLiquidGlassView>+ ) : (+ <ControlPill+ accessibilityLabel="Scroll to end"+ activateOnPressIn+ className="h-11 w-11 border border-border bg-card shadow-md shadow-black/10"+ icon={{ ios: "chevron.down", android: "keyboard_arrow_down" }}+ onPress={props.onScrollToEnd}+ />+ )}+ </Animated.View>+ );+}++function WorkingDuration(props: { readonly startedAt: string }) {+ const [nowMs, setNowMs] = useState(() => Date.now());++ useEffect(() => {+ setNowMs(Date.now());+ const intervalId = setInterval(() => setNowMs(Date.now()), 1_000);+ return () => clearInterval(intervalId);+ }, [props.startedAt]);++ const duration = formatWorkingDuration(props.startedAt, nowMs);+ const label = `Working for ${duration}`;++ return (+ <View accessible accessibilityLabel={label} className="h-11 flex-row items-center px-4">+ <Text className="font-t3-medium text-xs text-foreground">Working for </Text>+ <SystemText+ className="text-xs text-foreground"+ style={{ fontVariant: ["tabular-nums"], fontWeight: "500" }}+ >+ {duration}+ </SystemText>+ </View>+ );+}++function formatWorkingDuration(startedAt: string, nowMs: number): string {+ const startedAtMs = Date.parse(startedAt);+ if (!Number.isFinite(startedAtMs) || nowMs <= startedAtMs) {+ return "0s";+ }++ const totalSeconds = Math.floor((nowMs - startedAtMs) / 1_000);+ if (totalSeconds < 60) {+ return `${totalSeconds}s`;+ }++ const minutes = Math.floor(totalSeconds / 60);+ const seconds = String(totalSeconds % 60).padStart(2, "0");+ return `${minutes}m ${seconds}s`;+}++function ScrollToEndButton(props: { readonly disabled?: boolean; readonly onPress: () => void }) {+ return (+ <ControlPill+ accessibilityLabel="Scroll to end"+ activateOnPressIn+ className="h-11 w-11 bg-transparent"+ disabled={props.disabled}+ icon={{ ios: "chevron.down", android: "keyboard_arrow_down" }}+ onPress={props.onPress}+ />+ );+}diff --git a/apps/mobile/src/features/threads/thread-work-log.tsx b/apps/mobile/src/features/threads/thread-work-log.tsxindex 192d82f92cb..a316d9daee7 100644--- a/apps/mobile/src/features/threads/thread-work-log.tsx+++ b/apps/mobile/src/features/threads/thread-work-log.tsx@@ -1,30 +1,201 @@import * as Haptics from "expo-haptics";import { type AppSymbolName, SymbolView } from "../../components/AppSymbol";-import { LayoutAnimation, Pressable, ScrollView, View } from "react-native";+import { MaskedView } from "@expo/ui/community/masked-view";+import { useIsFocused } from "@react-navigation/native";+import { useEffect, useId, useState, type ComponentProps } from "react";+import {+ AccessibilityInfo,+ AppState,+ type ColorValue,+ Pressable,+ ScrollView,+ View,+} from "react-native";+import Svg, { Defs, LinearGradient, Rect, Stop } from "react-native-svg";import { AppText as Text } from "../../components/AppText";-import { scaledTypographyLineHeight } from "../../lib/appearancePreferences";import { cn } from "../../lib/cn";import type { ThreadFeedActivity } from "../../lib/threadActivity";-import { MOBILE_TYPOGRAPHY } from "../../lib/typography";-import Animated, { FadeIn } from "react-native-reanimated";+import type { ToolGroupSummaryKind } from "@t3tools/client-runtime/work-log/presentation";+import Animated, {+ cancelAnimation,+ Easing,+ FadeIn,+ FadeOut,+ LinearTransition,+ ReduceMotion,+ useAnimatedStyle,+ useSharedValue,+ withDelay,+ withRepeat,+ withSequence,+ withTiming,+} from "react-native-reanimated";-const WORK_LOG_LAYOUT_ANIMATION = {- duration: 180,- create: {- type: LayoutAnimation.Types.easeInEaseOut,- property: LayoutAnimation.Properties.opacity,- },- update: { type: LayoutAnimation.Types.easeInEaseOut },- delete: {- type: LayoutAnimation.Types.easeInEaseOut,- property: LayoutAnimation.Properties.opacity,- },-} as const;+const SHIMMER_WIDTH = 72;+const SHIMMER_SWEEP_MS = 1_350;+const SHIMMER_PAUSE_MS = 1_450;+const SHIMMER_ICON_AND_GAP_WIDTH = 30;+export const THREAD_DISCLOSURE_TRANSITION_MS = 180;+const WORK_LOG_LAYOUT_TRANSITION = LinearTransition.duration(THREAD_DISCLOSURE_TRANSITION_MS);+const WORK_LOG_DETAIL_ENTER_TRANSITION = FadeIn.duration(140);+const WORK_LOG_DETAIL_EXIT_TRANSITION = FadeOut.duration(120);-function triggerDisclosureFeedback() {- LayoutAnimation.configureNext(WORK_LOG_LAYOUT_ANIMATION);- void Haptics.selectionAsync();+function ShimmerWorkContent(props: {+ readonly highlighted: boolean;+ readonly icon: AppSymbolName;+ readonly iconSubtleColor: ColorValue;+ readonly label: string;+ readonly onTextLayout?: ComponentProps<typeof Text>["onTextLayout"];+ readonly showIcon: boolean;+}) {+ return (+ <View className="flex-row items-center gap-1.5">+ <View className="h-6 w-6 shrink-0 items-center justify-center">+ {props.showIcon ? (+ <SymbolView+ name={props.icon}+ size={14}+ weight="medium"+ {...(props.highlighted+ ? { tintColorClassName: "accent-foreground" as const }+ : { tintColor: props.iconSubtleColor })}+ type="monochrome"+ />+ ) : null}+ </View>+ <Text+ className={cn(+ "min-w-0 shrink text-sm",+ props.highlighted ? "text-foreground" : "text-foreground-muted",+ )}+ numberOfLines={1}+ onTextLayout={props.onTextLayout}+ >+ {props.label}+ </Text>+ </View>+ );+}++function ShimmeringWorkContent(props: {+ readonly icon: AppSymbolName;+ readonly iconSubtleColor: ColorValue;+ readonly label: string;+ readonly showIcon: boolean;+}) {+ const [availableWidth, setAvailableWidth] = useState(0);+ const [textWidth, setTextWidth] = useState(0);+ const [appIsActive, setAppIsActive] = useState(AppState.currentState === "active");+ const [reducedMotion, setReducedMotion] = useState(true);+ const screenIsFocused = useIsFocused();+ const progress = useSharedValue(0);+ const gradientId = `work-shimmer-${useId().replaceAll(":", "")}`;+ const contentWidth = Math.min(availableWidth, SHIMMER_ICON_AND_GAP_WIDTH + Math.ceil(textWidth));++ useEffect(() => {+ const subscription = AppState.addEventListener("change", (state) => {+ setAppIsActive(state === "active");+ });+ return () => subscription.remove();+ }, []);++ useEffect(() => {+ void AccessibilityInfo.isReduceMotionEnabled().then(setReducedMotion);+ const subscription = AccessibilityInfo.addEventListener(+ "reduceMotionChanged",+ setReducedMotion,+ );+ return () => subscription.remove();+ }, []);++ useEffect(() => {+ cancelAnimation(progress);+ progress.value = 0;+ if (contentWidth <= 0 || reducedMotion || !appIsActive || !screenIsFocused) return;++ progress.value = withRepeat(+ withSequence(+ withTiming(1, {+ duration: SHIMMER_SWEEP_MS,+ easing: Easing.linear,+ reduceMotion: ReduceMotion.Never,+ }),+ withDelay(+ SHIMMER_PAUSE_MS,+ withTiming(0, { duration: 0, reduceMotion: ReduceMotion.Never }),+ ),+ ),+ -1,+ false,+ undefined,+ ReduceMotion.Never,+ );+ return () => cancelAnimation(progress);+ }, [appIsActive, contentWidth, progress, reducedMotion, screenIsFocused]);++ const sweepStyle = useAnimatedStyle(() => ({+ transform: [{ translateX: -SHIMMER_WIDTH + progress.value * (contentWidth + SHIMMER_WIDTH) }],+ }));+ const counterSweepStyle = useAnimatedStyle(() => ({+ transform: [{ translateX: SHIMMER_WIDTH - progress.value * (contentWidth + SHIMMER_WIDTH) }],+ }));++ return (+ <View+ className="min-w-0 flex-1"+ onLayout={(event) => setAvailableWidth(event.nativeEvent.layout.width)}+ >+ <ShimmerWorkContent+ highlighted={false}+ icon={props.icon}+ iconSubtleColor={props.iconSubtleColor}+ label={props.label}+ showIcon={props.showIcon}+ onTextLayout={(event) => setTextWidth(event.nativeEvent.lines[0]?.width ?? 0)}+ />+ {!reducedMotion && appIsActive && screenIsFocused && contentWidth > 0 ? (+ <Animated.View+ className="absolute inset-y-0 left-0 overflow-hidden"+ pointerEvents="none"+ accessible={false}+ accessibilityElementsHidden+ importantForAccessibility="no-hide-descendants"+ style={[{ width: SHIMMER_WIDTH }, sweepStyle]}+ >+ <MaskedView+ className="absolute inset-0"+ maskElement={+ <Svg width="100%" height="100%">+ <Defs>+ <LinearGradient id={gradientId} x1="0%" x2="100%" y1="0%" y2="0%">+ <Stop offset="0" stopColor="white" stopOpacity={0} />+ <Stop offset="0.15" stopColor="white" stopOpacity={0.12} />+ <Stop offset="0.35" stopColor="white" stopOpacity={0.55} />+ <Stop offset="0.5" stopColor="white" stopOpacity={1} />+ <Stop offset="0.65" stopColor="white" stopOpacity={0.55} />+ <Stop offset="0.85" stopColor="white" stopOpacity={0.12} />+ <Stop offset="1" stopColor="white" stopOpacity={0} />+ </LinearGradient>+ </Defs>+ <Rect width="100%" height="100%" fill={`url(#${gradientId})`} />+ </Svg>+ }+ >+ <Animated.View style={[{ width: availableWidth }, counterSweepStyle]}>+ <ShimmerWorkContent+ highlighted+ icon={props.icon}+ iconSubtleColor={props.iconSubtleColor}+ label={props.label}+ showIcon={props.showIcon}+ />+ </Animated.View>+ </MaskedView>+ </Animated.View>+ ) : null}+ </View>+ );}function stripShellWrapper(value: string): string {@@ -79,44 +250,23 @@ function isFreshRow(createdAt: string): boolean {return Number.isFinite(timestamp) && Date.now() - timestamp < FRESH_ROW_WINDOW_MS;}-// Tool-like activities with a neutral status carry no signal worth a row.-export function visibleWorkLogActivities(- activities: ReadonlyArray<ThreadFeedActivity>,-): ReadonlyArray<ThreadFeedActivity> {- return activities.filter((activity) => !(activity.toolLike && activity.status === "neutral"));-}-// Pre-measurement heights for the feed's getFixedItemSize. Collapsed work-log// rows are single-line (numberOfLines={1}) inside a min-height that stays-// taller than the text at every supported base font size (text-xs reaches-// 23px at the 22pt maximum, under the 32px min-h-8), so row height is-// deterministic. The "work log" label has no such clamp — its height follows-// the scaled text-2xs line height. Values mirror the classNames below — keep-// them in sync; a mismatch only costs a one-time correction on measure.+// taller than text-sm at every supported base font size, so row height is+// deterministic. Values mirror the classNames below. A mismatch only costs a+// one-time correction on measure.const WORK_ROW_HEIGHT = 32; // min-h-8const WORK_ROW_GAP = 1; // gap-px-const WORK_LOG_HEADER_PADDING = 2; // pb-0.5 under the "work log" labelconst WORK_LOG_BOTTOM_MARGIN = 4; // mb-1export const WORK_GROUP_TOGGLE_HEIGHT = 36; // min-h-8 (32) + mb-1 (4)-export function collapsedWorkLogHeight(- activities: ReadonlyArray<ThreadFeedActivity>,- baseFontSize: number,-): number {- const rows = visibleWorkLogActivities(activities);+export function collapsedWorkLogHeight(activities: ReadonlyArray<ThreadFeedActivity>): number {+ const rows = activities;if (rows.length === 0) {return 0;}- const onlyToolRows = rows.every((row) => row.toolLike);- const headerHeight =- scaledTypographyLineHeight(MOBILE_TYPOGRAPHY.caption, baseFontSize) + WORK_LOG_HEADER_PADDING;- return (- WORK_LOG_BOTTOM_MARGIN +- (onlyToolRows ? 0 : headerHeight) +- rows.length * WORK_ROW_HEIGHT +- (rows.length - 1) * WORK_ROW_GAP- );+ return WORK_LOG_BOTTOM_MARGIN + rows.length * WORK_ROW_HEIGHT + (rows.length - 1) * WORK_ROW_GAP;}export function ThreadWorkLog(props: {@@ -127,7 +277,7 @@ export function ThreadWorkLog(props: {readonly onCopyRow: (rowId: string, value: string) => void;readonly onToggleRow: (rowId: string) => void;}) {- const rows = visibleWorkLogActivities(props.activities).map((activity) => ({+ const rows = props.activities.map((activity) => ({...activity,detail: compactActivityDetail(activity.detail),}));@@ -136,32 +286,28 @@ export function ThreadWorkLog(props: {return null;}- const onlyToolRows = rows.every((row) => row.toolLike);-return (<View className="-mx-1 mb-1 px-1 py-0">- {!onlyToolRows ? (- <Text className="px-0.5 pb-0.5 font-t3-medium text-2xs text-foreground-muted opacity-60">- work log- </Text>- ) : null}-<View className="gap-px">{rows.map((row) => {const expanded = props.expandedRows[row.id] ?? false;const canExpand = row.canExpand;const fullDetail = expanded ? row.getFullDetail() : null;- const displayText = row.detail ? `${row.summary} ${row.detail}` : row.summary;+ const displayText = row.detail ?? row.summary;const iconIsDestructive = row.icon === "alert" || row.icon === "warning";+ const failed = row.status === "failure";+ const showIcon = !row.groupedToolDetail || iconIsDestructive || failed;return (<Animated.Viewkey={row.id}+ layout={WORK_LOG_LAYOUT_TRANSITION}+ className="overflow-hidden"{...(isFreshRow(row.createdAt) ? { entering: FadeIn.duration(200) } : {})}><PressableaccessibilityRole={canExpand ? "button" : undefined}- accessibilityLabel={displayText}+ accessibilityLabel={failed ? `${displayText}, tool call failed` : displayText}accessibilityHint={canExpand? "Double tap to show full details. Long press to copy."@@ -171,7 +317,7 @@ export function ThreadWorkLog(props: {hitSlop={4}onPress={() => {if (canExpand) {- triggerDisclosureFeedback();+ void Haptics.selectionAsync();props.onToggleRow(row.id);}}}@@ -179,29 +325,41 @@ export function ThreadWorkLog(props: {className="rounded-md px-0.5 py-0 active:bg-subtle"><View className="min-h-8 flex-row items-center gap-1.5">- <View className="h-[18px] w-5 shrink-0 items-center justify-center">- <SymbolView- name={workRowSymbolName(row.icon)}- size={13}- weight="medium"- tintColor={iconIsDestructive ? "#e11d48" : props.iconSubtleColor}- type="monochrome"+ {row.live ? (+ <ShimmeringWorkContent+ icon={workRowSymbolName(row.icon)}+ iconSubtleColor={props.iconSubtleColor}+ label={displayText}+ showIcon={showIcon}/>- </View>-- <Text className="min-w-0 flex-1 text-xs text-foreground" numberOfLines={1}>- <Text- className={cn(- "font-t3-medium text-foreground",- iconIsDestructive && "text-adaptive-rose-600-400",- )}- >- {row.summary}- </Text>- {row.detail ? (- <Text className="text-foreground-muted opacity-60"> {row.detail}</Text>- ) : null}- </Text>+ ) : (+ <>+ <View className="h-6 w-6 shrink-0 items-center justify-center">+ {showIcon ? (+ <SymbolView+ name={+ failed+ ? { ios: "xmark", android: "close" }+ : workRowSymbolName(row.icon)+ }+ size={14}+ weight="medium"+ tintColor={iconIsDestructive ? "#e11d48" : props.iconSubtleColor}+ type="monochrome"+ />+ ) : null}+ </View>+ <Text+ className={cn(+ "min-w-0 flex-1 text-sm text-foreground-muted",+ iconIsDestructive && "font-t3-medium text-adaptive-rose-600-400",+ )}+ numberOfLines={1}+ >+ {displayText}+ </Text>+ </>+ )}<View className="shrink-0 flex-row items-center gap-px">{props.copiedRowId === row.id ? (@@ -223,28 +381,17 @@ export function ThreadWorkLog(props: {/>) : null}</View>- <View className="h-4 w-4 items-center justify-center">- {row.status ? (- <SymbolView- name={- row.status === "failure"- ? { ios: "xmark", android: "close" }- : row.status === "success"- ? { ios: "checkmark", android: "check" }- : { ios: "minus", android: "remove" }- }- size={11}- tintColor={props.iconSubtleColor}- type="monochrome"- />- ) : null}- </View></View></View></Pressable>{fullDetail ? (- <View className="ml-7 border-l border-adaptive-neutral-300-a60-white-a12 pb-1 pl-3 pt-0.5">+ <Animated.View+ entering={WORK_LOG_DETAIL_ENTER_TRANSITION}+ exiting={WORK_LOG_DETAIL_EXIT_TRANSITION}+ layout={WORK_LOG_LAYOUT_TRANSITION}+ className="ml-7 border-l border-adaptive-neutral-300-a60-white-a12 pb-1 pl-3 pt-0.5"+ ><ScrollViewnestedScrollEnableddirectionalLockEnabled@@ -259,7 +406,7 @@ export function ThreadWorkLog(props: {{fullDetail}</Text></ScrollView>- </View>+ </Animated.View>) : null}</Animated.View>);@@ -273,27 +420,24 @@ export function ThreadWorkGroupToggle(props: {readonly expanded: boolean;readonly hiddenCount: number;readonly iconSubtleColor: import("react-native").ColorValue;- readonly onlyToolActivities: boolean;+ readonly summary: string;+ readonly summaryKind: ToolGroupSummaryKind;+ readonly hasFailure: boolean;+ readonly shimmer: boolean;readonly onToggle: () => void;}) {- const noun = props.onlyToolActivities- ? props.hiddenCount === 1- ? "tool call"- : "tool calls"- : props.hiddenCount === 1- ? "log entry"- : "log entries";- const collapsedLabel = `Show ${props.hiddenCount} previous ${noun}`;- const expandedLabel = props.onlyToolActivities- ? "Show fewer tool calls"- : "Show fewer log entries";+ const accessibilityLabel = props.hasFailure+ ? `${props.summary}, tool call failed`+ : props.summary;+ const icon = toolGroupSummarySymbolName(props.summaryKind);return (<View className="-mx-1 mb-1 px-1 py-0"><PressableaccessibilityRole="button"accessibilityState={{ expanded: props.expanded }}- accessibilityLabel={props.expanded ? expandedLabel : collapsedLabel}+ accessibilityLabel={accessibilityLabel}+ accessibilityHint={`Double tap to ${props.expanded ? "hide" : "show"} ${props.hiddenCount} tool ${props.hiddenCount === 1 ? "call" : "calls"}.`}hitSlop={4}onPress={() => {void Haptics.selectionAsync();@@ -301,22 +445,64 @@ export function ThreadWorkGroupToggle(props: {}}className="min-h-8 flex-row items-center gap-1.5 rounded-md px-0.5 py-0 active:bg-subtle">- <View className="h-[18px] w-5 items-center justify-center">- <SymbolView- name={- props.expanded- ? { ios: "chevron.up", android: "keyboard_arrow_up" }- : { ios: "chevron.down", android: "keyboard_arrow_down" }- }- size={12}- tintColor={props.iconSubtleColor}- type="monochrome"+ {props.shimmer ? (+ <ShimmeringWorkContent+ icon={icon}+ iconSubtleColor={props.iconSubtleColor}+ label={props.summary}+ showIcon/>- </View>- <Text className="font-t3-medium text-xs text-foreground opacity-80">- {props.expanded ? expandedLabel : `+${props.hiddenCount} previous ${noun}`}- </Text>+ ) : (+ <>+ <View className="h-6 w-6 items-center justify-center">+ <SymbolView+ name={icon}+ size={14}+ tintColor={props.iconSubtleColor}+ type="monochrome"+ />+ </View>+ <Text className="min-w-0 flex-1 text-sm text-foreground-muted" numberOfLines={1}>+ {props.summary}+ </Text>+ </>+ )}+ <SymbolView+ name={+ props.expanded+ ? { ios: "chevron.up", android: "keyboard_arrow_up" }+ : { ios: "chevron.down", android: "keyboard_arrow_down" }+ }+ size={11}+ tintColor={props.iconSubtleColor}+ type="monochrome"+ /></Pressable></View>);}++function toolGroupSummarySymbolName(kind: ToolGroupSummaryKind): AppSymbolName {+ switch (kind) {+ case "read":+ return { ios: "eye", android: "visibility" };+ case "edit":+ return { ios: "square.and.pencil", android: "edit" };+ case "command":+ return { ios: "terminal", android: "terminal" };+ case "search":+ return { ios: "globe", android: "public" };+ case "code-search":+ return "magnifyingglass";+ case "other":+ return { ios: "wrench", android: "build" };+ case "agent-tool":+ return { ios: "sparkles", android: "auto_awesome" };+ case "tone-tool":+ return { ios: "bolt", android: "bolt" };+ case "dynamic-tool":+ case "update":+ case "mixed":+ return { ios: "hammer", android: "construction" };+ }+}diff --git a/apps/mobile/src/lib/threadActivity.test.ts b/apps/mobile/src/lib/threadActivity.test.tsindex 19194ea3a57..73080b3dfcc 100644--- a/apps/mobile/src/lib/threadActivity.test.ts+++ b/apps/mobile/src/lib/threadActivity.test.ts@@ -411,8 +411,8 @@ describe("buildThreadFeed", () => {expect(group.activities).toHaveLength(1);expect(group.activities[0]).toMatchObject({- id: "tool-completed",- createdAt: "2026-04-01T00:00:02.000Z",+ id: "tool-updated",+ createdAt: "2026-04-01T00:00:01.000Z",turnId: "turn-1",summary: "Run tests",detail: "bun run test",@@ -592,7 +592,7 @@ describe("buildThreadFeed", () => {expect(expanded.map((entry) => entry.id)).toEqual(["assistant-first","turn-fold:turn-1",- "tool-completed",+ "work-toggle:work-group:tool-completed","assistant-final",]);});@@ -745,6 +745,20 @@ describe("buildThreadFeed", () => {assistantMessageId: null,},activities: [+ makeActivity({+ id: EventId.make("tool-succeeded"),+ kind: "tool.completed",+ tone: "tool",+ summary: "Run command",+ createdAt: "2026-04-01T00:00:04.000Z",+ turnId,+ payload: {+ title: "Run command",+ itemType: "command_execution",+ detail: "done",+ status: "completed",+ },+ }),makeActivity({id: EventId.make("tool-failed"),kind: "tool.completed",@@ -763,25 +777,26 @@ describe("buildThreadFeed", () => {});const feed = buildThreadFeed(thread);- expect(deriveThreadFeedPresentation(feed, thread.latestTurn, new Set())).toEqual(feed);- expect(feed[0]).toMatchObject({- type: "activity-group",- activities: [{ status: "failure" }],- });- });-- it("appends active work as a normal timeline row", () => {- const startedAt = "2026-04-01T00:00:01.000Z";- const presented = deriveThreadFeedPresentation([], null, new Set(), new Set(), startedAt);-- expect(presented).toEqual([+ expect(deriveThreadFeedPresentation(feed, thread.latestTurn, new Set())).toMatchObject([{- type: "working",- id: "working-indicator-row",- createdAt: startedAt,+ type: "work-toggle",+ summary: "Ran 2 commands",+ hiddenCount: 2,+ hasFailure: true,},]);- expect(deriveThreadFeedPresentation(presented, null, new Set())).toEqual([]);+ expect(feed[0]).toMatchObject({+ type: "activity-group",+ activities: [{ status: "success" }, { status: "failure" }],+ });+ expect(+ deriveThreadFeedPresentation(+ feed,+ thread.latestTurn,+ new Set(),+ new Set(["work-group:tool-succeeded"]),+ ).map((entry) => entry.id),+ ).toEqual(["work-toggle:work-group:tool-succeeded", "tool-succeeded", "tool-failed"]);});it("models work-log overflow as list rows", () => {@@ -801,6 +816,14 @@ describe("buildThreadFeed", () => {icon: "command",toolLike: true,status,+ workEntry: {+ id,+ createdAt,+ turnId: null,+ label: `Tool ${id}`,+ command: `command ${id}`,+ tone: "tool",+ },});const feed: ThreadFeedEntry[] = [{@@ -818,26 +841,216 @@ describe("buildThreadFeed", () => {];const collapsed = deriveThreadFeedPresentation(feed, null, new Set());- expect(collapsed.map((entry) => entry.id)).toEqual(["activity-3", "work-toggle:work-group-1"]);- expect(collapsed[1]).toMatchObject({+ expect(collapsed.map((entry) => entry.id)).toEqual(["work-toggle:work-group:activity-1"]);+ expect(collapsed[0]).toMatchObject({type: "work-toggle",- groupId: "work-group-1",- hiddenCount: 2,+ groupId: "work-group:activity-1",+ hiddenCount: 3,expanded: false,+ summary: "Ran 3 commands",});- const expanded = deriveThreadFeedPresentation(feed, null, new Set(), new Set(["work-group-1"]));+ const expanded = deriveThreadFeedPresentation(+ feed,+ null,+ new Set(),+ new Set(["work-group:activity-1"]),+ );expect(expanded.map((entry) => entry.id)).toEqual([+ "work-toggle:work-group:activity-1","activity-1","activity-2","activity-3",- "work-toggle:work-group-1",]);- expect(expanded.at(-1)).toMatchObject({+ expect(expanded[0]).toMatchObject({type: "work-toggle",expanded: true,});});++ it("keeps live state on the active uninterrupted tool run", () => {+ const turnId = TurnId.make("turn-live-tools");+ const activity = (+ id: string,+ status: ThreadFeedActivity["status"],+ lifecycleStatus: ThreadFeedActivity["lifecycleStatus"],+ tone: "tool" | "error" = "tool",+ command?: string,+ ): ThreadFeedActivity => ({+ id,+ createdAt: `2026-04-01T00:00:0${id.at(-1)}.000Z`,+ turnId,+ summary: `Tool ${id}`,+ detail: null,+ canExpand: false,+ getFullDetail: () => null,+ getCopyText: () => id,+ icon: "command",+ toolLike: true,+ status,+ lifecycleStatus,+ workEntry: {+ id,+ createdAt: `2026-04-01T00:00:0${id.at(-1)}.000Z`,+ turnId,+ label: `Tool ${id}`,+ tone,+ toolLifecycleStatus: lifecycleStatus,+ ...(command ? { command, itemType: "command_execution" as const } : {}),+ },+ });+ const feed: ThreadFeedEntry[] = [+ {+ type: "activity-group",+ id: "activity-1",+ createdAt: "2026-04-01T00:00:01.000Z",+ turnId,+ activities: [+ activity("activity-1", "success", "completed"),+ activity("activity-2", "failure", "failed", "error"),+ activity("activity-3", "success", "completed", "tool", "sudo -u root pnpm test"),+ ],+ },+ ];+ const latestTurn = {+ turnId,+ state: "running" as const,+ requestedAt: "2026-04-01T00:00:00.000Z",+ startedAt: "2026-04-01T00:00:00.000Z",+ completedAt: null,+ assistantMessageId: null,+ };++ const rows = deriveThreadFeedPresentation(+ feed,+ latestTurn,+ new Set(),+ new Set(),+ latestTurn.startedAt,+ );+ expect(rows.slice(0, 3).map((entry) => [entry.id, entry.type])).toEqual([+ ["work-toggle:work-group:activity-1", "work-toggle"],+ ["activity-2", "activity-group"],+ ["work-live:work-group:activity-3", "work-toggle"],+ ]);+ expect(rows.slice(0, 3).map((entry) => entry.type === "work-toggle" && entry.live)).toEqual([+ false,+ false,+ true,+ ]);+ expect(rows[2]).toMatchObject({+ summary: "Running pnpm",+ summaryKind: "command",+ live: true,+ shimmer: false,+ });+ });++ it("does not revive cached in-progress tools after work stops", () => {+ const turnId = TurnId.make("turn-stale-tool");+ const feed: ThreadFeedEntry[] = [+ {+ type: "activity-group",+ id: "stale-tool",+ createdAt: "2026-04-01T00:00:01.000Z",+ turnId,+ activities: [+ {+ id: "stale-tool",+ createdAt: "2026-04-01T00:00:01.000Z",+ turnId,+ summary: "Running tests",+ detail: null,+ canExpand: false,+ getFullDetail: () => null,+ getCopyText: () => "",+ icon: "command",+ toolLike: true,+ status: "neutral",+ lifecycleStatus: "inProgress",+ workEntry: {+ id: "stale-tool",+ createdAt: "2026-04-01T00:00:01.000Z",+ turnId,+ label: "Running tests",+ tone: "tool",+ toolLifecycleStatus: "inProgress",+ },+ },+ ],+ },+ ];+ const latestTurn = {+ turnId,+ state: "running" as const,+ requestedAt: "2026-04-01T00:00:00.000Z",+ startedAt: "2026-04-01T00:00:00.000Z",+ completedAt: null,+ assistantMessageId: null,+ };++ expect(deriveThreadFeedPresentation(feed, latestTurn, new Set())).toEqual([]);+ expect(+ deriveThreadFeedPresentation(feed, latestTurn, new Set(), new Set(), latestTurn.startedAt),+ ).toMatchObject([{ type: "work-toggle", live: true, shimmer: true }]);+ });++ it("collapses interleaved tool lifecycles by call identity", () => {+ const turnId = TurnId.make("turn-parallel-tools");+ const toolActivity = (+ id: string,+ toolCallId: string,+ kind: "tool.updated" | "tool.completed",+ status: "inProgress" | "completed",+ detail: string,+ nestedId = false,+ ) =>+ makeActivity({+ id: EventId.make(id),+ kind,+ tone: "tool",+ summary: `Run ${toolCallId} command`,+ createdAt: `2026-04-01T00:00:0${id.at(-1)}.000Z`,+ turnId,+ payload: {+ ...(nestedId ? { data: { toolCallId } } : { toolCallId }),+ itemType: "command_execution",+ status,+ detail,+ },+ });+ const thread = makeThread({+ id: ThreadId.make("thread-parallel-tools"),+ projectId: ProjectId.make("project-1"),+ title: "Parallel tools",+ activities: [+ toolActivity("call-a-1", "call-a", "tool.updated", "inProgress", "starting"),+ toolActivity("call-b-2", "call-b", "tool.updated", "inProgress", "starting", true),+ toolActivity("call-a-3", "call-a", "tool.completed", "completed", "first output"),+ toolActivity("call-b-4", "call-b", "tool.completed", "completed", "second output", true),+ ],+ });++ const feed = buildThreadFeed(thread);+ const activityGroup = feed.find((entry) => entry.type === "activity-group");+ expect(activityGroup).toMatchObject({+ type: "activity-group",+ activities: [+ { id: "call-a-1", lifecycleStatus: "completed", detail: "first output" },+ { id: "call-b-2", lifecycleStatus: "completed", detail: "second output" },+ ],+ });+ expect(+ deriveThreadFeedPresentation(feed, null, new Set([turnId])).find(+ (entry) => entry.type === "work-toggle",+ ),+ ).toMatchObject({+ type: "work-toggle",+ hiddenCount: 2,+ summary: "Ran 2 commands",+ live: false,+ });+ });});describe("quiet timeline: nested agents", () => {@@ -873,5 +1086,8 @@ describe("quiet timeline: nested agents", () => {);expect(ids).toContain("nested-done");expect(ids).not.toContain("shell-done");+ expect(deriveThreadFeedPresentation(feed, null, new Set())).toMatchObject([+ { type: "activity-group", id: "nested-done" },+ ]);});});diff --git a/apps/mobile/src/lib/threadActivity.ts b/apps/mobile/src/lib/threadActivity.tsindex 6dd8230307a..f30081dd35b 100644--- a/apps/mobile/src/lib/threadActivity.ts+++ b/apps/mobile/src/lib/threadActivity.ts@@ -13,6 +13,14 @@ import type {UserInputQuestion,} from "@t3tools/contracts";import { formatDuration } from "@t3tools/shared/orchestrationTiming";+import {+ normalizeCompactToolLabel,+ omitSupersededLifecycleMarkers,+ summarizeToolGroup,+ toolGroupSummaryKind,+ type ToolGroupSummaryKind,+} from "@t3tools/client-runtime/work-log/presentation";+import { commandProgramName } from "@t3tools/client-runtime/work-log/command-label";import * as Arr from "effect/Array";import * as Order from "effect/Order";@@ -65,13 +73,15 @@ export interface ThreadFeedActivity {| "zap";readonly toolLike: boolean;readonly status: "success" | "failure" | "neutral" | null;+ readonly lifecycleStatus?: WorkLogToolLifecycleStatus;+ readonly workEntry: WorkLogEntry;+ readonly groupedToolDetail?: boolean;+ readonly live?: boolean;}-const MAX_VISIBLE_WORK_LOG_ENTRIES = 1;-type WorkLogToolLifecycleStatus = "inProgress" | "completed" | "failed" | "declined" | "stopped";-interface WorkLogEntry {+export interface WorkLogEntry {id: string;createdAt: string;turnId: TurnId | null;@@ -85,11 +95,14 @@ interface WorkLogEntry {itemType?: ToolLifecycleItemType;requestKind?: PendingApproval["requestKind"];toolLifecycleStatus?: WorkLogToolLifecycleStatus;+ sourceActivityKind?: OrchestrationThreadActivity["kind"];+ toolCallId?: string;+ agentSpawn?: boolean;toolData?: unknown;}interface DerivedWorkLogEntry extends WorkLogEntry {- activityKind: OrchestrationThreadActivity["kind"];+ sourceActivityKind: OrchestrationThreadActivity["kind"];collapseKey?: string;/** Grouping key for subagent lifecycle rows (one row per agent). */taskId?: string;@@ -112,11 +125,6 @@ type RawThreadFeedEntry =export type ThreadFeedEntry =| Extract<RawThreadFeedEntry, { type: "message" }>- | {- readonly type: "working";- readonly id: string;- readonly createdAt: string;- }| {readonly type: "activity-group";readonly id: string;@@ -132,7 +140,11 @@ export type ThreadFeedEntry =readonly groupId: string;readonly hiddenCount: number;readonly expanded: boolean;- readonly onlyToolActivities: boolean;+ readonly summary: string;+ readonly summaryKind: ToolGroupSummaryKind;+ readonly hasFailure: boolean;+ readonly live: boolean;+ readonly shimmer: boolean;}| {readonly type: "turn-fold";@@ -412,8 +424,16 @@ function toDerivedWorkLogEntry(activity: OrchestrationThreadActivity): DerivedWo: activity.tone === "approval"? "info": activity.tone,- activityKind: activity.kind,+ sourceActivityKind: activity.kind,};+ const toolCallId =+ asTrimmedString(payload?.toolCallId) ?? asTrimmedString(asRecord(payload?.data)?.toolCallId);+ if (toolCallId) {+ entry.toolCallId = toolCallId;+ }+ if (isTaskActivity && payload?.agentKind === "agent") {+ entry.agentSpawn = true;+ }const itemType = extractWorkLogItemType(payload);const requestKind = extractWorkLogRequestKind(payload);if (@@ -472,12 +492,13 @@ function collapseDerivedWorkLogEntries(// Subagent rows collapse by identity, not adjacency (quiet-timeline// guarantee; mirrors web's session-logic).const taskRowIndex = new Map<string, number>();+ const toolLifecycleRowIndex = new Map<string, number>();for (const entry of entries) {const isTaskRow =entry.taskId !== undefined &&- (entry.activityKind === "task.progress" ||- entry.activityKind === "task.completed" ||- entry.activityKind === "task.updated");+ (entry.sourceActivityKind === "task.progress" ||+ entry.sourceActivityKind === "task.completed" ||+ entry.sourceActivityKind === "task.updated");if (isTaskRow && entry.taskId !== undefined) {const existingIndex = taskRowIndex.get(entry.taskId);if (existingIndex !== undefined) {@@ -488,30 +509,78 @@ function collapseDerivedWorkLogEntries(collapsed.push(entry);continue;}+ const lifecycleKey = toolLifecycleCollapseMapKey(entry);+ if (lifecycleKey !== undefined) {+ const matchingIndex = toolLifecycleRowIndex.get(lifecycleKey);+ const matchingEntry = matchingIndex === undefined ? undefined : collapsed[matchingIndex];+ if (+ matchingIndex !== undefined &&+ matchingEntry &&+ shouldCollapseToolLifecycleEntries(matchingEntry, entry)+ ) {+ collapsed[matchingIndex] = mergeDerivedWorkLogEntries(matchingEntry, entry);+ continue;+ }+ toolLifecycleRowIndex.delete(lifecycleKey);+ }const previous = collapsed.at(-1);if (previous && shouldCollapseToolLifecycleEntries(previous, entry)) {- collapsed[collapsed.length - 1] = mergeDerivedWorkLogEntries(previous, entry);+ const previousIndex = collapsed.length - 1;+ const previousKey = toolLifecycleCollapseMapKey(previous);+ if (previousKey !== undefined) toolLifecycleRowIndex.delete(previousKey);+ const merged = mergeDerivedWorkLogEntries(previous, entry);+ collapsed[previousIndex] = merged;+ const mergedKey = toolLifecycleCollapseMapKey(merged);+ if (mergedKey !== undefined) toolLifecycleRowIndex.set(mergedKey, previousIndex);continue;}collapsed.push(entry);+ if (lifecycleKey !== undefined) {+ toolLifecycleRowIndex.set(lifecycleKey, collapsed.length - 1);+ }}return collapsed;}+function toolLifecycleCollapseMapKey(entry: DerivedWorkLogEntry): string | undefined {+ if (+ entry.sourceActivityKind !== "tool.updated" &&+ entry.sourceActivityKind !== "tool.completed"+ ) {+ return undefined;+ }+ return entry.toolCallId ? `tool:${entry.turnId ?? "no-turn"}:${entry.toolCallId}` : undefined;+}+function shouldCollapseToolLifecycleEntries(previous: DerivedWorkLogEntry,next: DerivedWorkLogEntry,): boolean {- if (previous.activityKind !== "tool.updated" && previous.activityKind !== "tool.completed") {+ if (+ previous.sourceActivityKind !== "tool.updated" &&+ previous.sourceActivityKind !== "tool.completed"+ ) {return false;}- if (next.activityKind !== "tool.updated" && next.activityKind !== "tool.completed") {+ if (next.sourceActivityKind !== "tool.updated" && next.sourceActivityKind !== "tool.completed") {return false;}- if (previous.activityKind === "tool.completed") {+ if (previous.turnId !== next.turnId) {return false;}- return previous.collapseKey !== undefined && previous.collapseKey === next.collapseKey;+ if (previous.sourceActivityKind === "tool.completed") {+ return false;+ }+ if (previous.collapseKey !== undefined && previous.collapseKey === next.collapseKey) {+ return true;+ }+ return (+ previous.toolCallId !== undefined &&+ next.toolCallId === undefined &&+ previous.itemType === next.itemType &&+ normalizeCompactToolLabel(previous.toolTitle ?? previous.label) ===+ normalizeCompactToolLabel(next.toolTitle ?? next.label)+ );}function mergeDerivedWorkLogEntries(@@ -527,10 +596,13 @@ function mergeDerivedWorkLogEntries(const requestKind = next.requestKind ?? previous.requestKind;const collapseKey = next.collapseKey ?? previous.collapseKey;const toolLifecycleStatus = next.toolLifecycleStatus ?? previous.toolLifecycleStatus;+ const toolCallId = next.toolCallId ?? previous.toolCallId;const toolData = next.toolData ?? previous.toolData;return {...previous,...next,+ id: previous.id,+ createdAt: previous.createdAt,...(detail ? { detail } : {}),...(command ? { command } : {}),...(rawCommand ? { rawCommand } : {}),@@ -540,6 +612,7 @@ function mergeDerivedWorkLogEntries(...(requestKind ? { requestKind } : {}),...(collapseKey ? { collapseKey } : {}),...(toolLifecycleStatus ? { toolLifecycleStatus } : {}),+ ...(toolCallId ? { toolCallId } : {}),...(toolData !== undefined ? { toolData } : {}),};}@@ -556,9 +629,15 @@ function mergeChangedFiles(}function deriveToolLifecycleCollapseKey(entry: DerivedWorkLogEntry): string | undefined {- if (entry.activityKind !== "tool.updated" && entry.activityKind !== "tool.completed") {+ if (+ entry.sourceActivityKind !== "tool.updated" &&+ entry.sourceActivityKind !== "tool.completed"+ ) {return undefined;}+ if (entry.toolCallId) {+ return `tool:${entry.turnId ?? "no-turn"}:${entry.toolCallId}`;+ }const normalizedLabel = normalizeCompactToolLabel(entry.toolTitle ?? entry.label);const detail = entry.detail?.trim() ?? "";const itemType = entry.itemType ?? "";@@ -568,10 +647,6 @@ function deriveToolLifecycleCollapseKey(entry: DerivedWorkLogEntry): string | unreturn [itemType, normalizedLabel, detail].join("\u001f");}-function normalizeCompactToolLabel(value: string): string {- return value.replace(/\s+(?:complete|completed)\s*$/i, "").trim();-}-function workLogEntryIsToolLike(entry: WorkLogEntry): boolean {if (entry.tone === "tool" || entry.tone === "thinking" || entry.tone === "error") {return true;@@ -648,12 +723,12 @@ function workEntryStatus(entry: WorkLogEntry): ThreadFeedActivity["status"] {function workEntryIcon(entry: DerivedWorkLogEntry): ThreadFeedActivity["icon"] {if (- entry.activityKind === "user-input.requested" ||- entry.activityKind === "user-input.resolved"+ entry.sourceActivityKind === "user-input.requested" ||+ entry.sourceActivityKind === "user-input.resolved") {return "message";}- if (entry.activityKind === "runtime.warning") return "warning";+ if (entry.sourceActivityKind === "runtime.warning") return "warning";if (entry.requestKind === "command") return "command";if (entry.requestKind === "file-read") return "eye";if (entry.requestKind === "file-change") return "edit";@@ -1287,10 +1362,14 @@ export function deriveThreadFeedPresentation(activeWorkStartedAt: string | null = null,): ThreadFeedEntry[] {const sourceFeed = feed.filter(- (entry) =>- entry.type !== "turn-fold" && entry.type !== "work-toggle" && entry.type !== "working",+ (entry) => entry.type !== "turn-fold" && entry.type !== "work-toggle",+ );+ const activeTailGroup = sourceFeed.findLast(+ (entry) => entry.type !== "message" || !isEmptyMessage(entry),);const foldsByAnchorId = deriveThreadFeedTurnFolds(sourceFeed, latestTurn);+ const unsettledTurnId = deriveUnsettledTurnId(latestTurn);+ const isWorking = activeWorkStartedAt !== null;const collapsedEntryIds = new Set<string>();for (const fold of foldsByAnchorId.values()) {if (!expandedTurnIds.has(fold.turnId)) {@@ -1302,6 +1381,13 @@ export function deriveThreadFeedPresentation(const result: ThreadFeedEntry[] = [];for (const entry of sourceFeed) {+ const isActiveTailGroup =+ isWorking &&+ unsettledTurnId !== null &&+ entry.type === "activity-group" &&+ activeTailGroup?.type === "activity-group" &&+ activeTailGroup.id === entry.id &&+ entry.turnId === unsettledTurnId;const fold = foldsByAnchorId.get(entry.id);if (fold) {result.push({@@ -1314,49 +1400,65 @@ export function deriveThreadFeedPresentation(});}if (!collapsedEntryIds.has(entry.id)) {- appendPresentedFeedEntry(result, entry, expandedWorkGroupIds);+ appendPresentedFeedEntry(+ result,+ entry,+ expandedWorkGroupIds,+ unsettledTurnId,+ isWorking,+ isActiveTailGroup,+ );}}- if (activeWorkStartedAt !== null) {- result.push({- type: "working",- id: "working-indicator-row",- createdAt: activeWorkStartedAt,- });- }return result;}function appendPresentedFeedEntry(result: ThreadFeedEntry[],- entry: Exclude<ThreadFeedEntry, { readonly type: "turn-fold" | "work-toggle" | "working" }>,+ entry: Exclude<ThreadFeedEntry, { readonly type: "turn-fold" | "work-toggle" }>,expandedWorkGroupIds: ReadonlySet<string>,+ unsettledTurnId: TurnId | null,+ isWorking: boolean,+ activeTail: boolean,): void {if (entry.type !== "activity-group") {result.push(entry);return;}- const activities = entry.activities.filter(- (activity) => !(activity.toolLike && activity.status === "neutral"),+ const activities = omitSupersededLifecycleMarkers(+ entry.activities.filter(+ (activity) =>+ !(activity.toolLike && activity.status === "neutral") ||+ (isWorking &&+ activity.lifecycleStatus === "inProgress" &&+ activity.turnId === unsettledTurnId),+ ),+ (activity) => activity.workEntry,);if (activities.length === 0) {return;}- if (activities.length <= MAX_VISIBLE_WORK_LOG_ENTRIES) {- result.push({- ...entry,- activities,- });- return;- }-- const groupId = entry.id;- const expanded = expandedWorkGroupIds.has(groupId);- const hiddenCount = activities.length - MAX_VISIBLE_WORK_LOG_ENTRIES;- const visibleActivities = expanded ? activities : activities.slice(-MAX_VISIBLE_WORK_LOG_ENTRIES);-- for (const activity of visibleActivities) {+ let groupableRun: ThreadFeedActivity[] = [];+ const flushGroupableRun = (isTrailingRun: boolean) => {+ if (groupableRun.length === 0) return;+ appendToolGroupRows(+ result,+ entry,+ groupableRun,+ expandedWorkGroupIds,+ unsettledTurnId,+ isWorking,+ activeTail && isTrailingRun,+ );+ groupableRun = [];+ };+ for (const activity of activities) {+ if (activity.workEntry.tone !== "error" && activity.workEntry.agentSpawn !== true) {+ groupableRun.push(activity);+ continue;+ }+ flushGroupableRun(false);result.push({type: "activity-group",id: activity.id,@@ -1365,16 +1467,87 @@ function appendPresentedFeedEntry(activities: [activity],});}+ flushGroupableRun(true);+}++function appendToolGroupRows(+ result: ThreadFeedEntry[],+ sourceGroup: Extract<ThreadFeedEntry, { readonly type: "activity-group" }>,+ activities: ReadonlyArray<ThreadFeedActivity>,+ expandedWorkGroupIds: ReadonlySet<string>,+ unsettledTurnId: TurnId | null,+ isWorking: boolean,+ activeTail: boolean,+): void {+ const firstEntry = activities[0]!.workEntry;+ const identity = firstEntry.toolCallId+ ? `tool:${firstEntry.turnId ?? "no-turn"}:${firstEntry.toolCallId}`+ : activities[0]!.id;+ const groupId = `work-group:${identity}`;+ const expanded = expandedWorkGroupIds.has(groupId);+ const latestInProgressActivity = activities.findLast(+ (activity) =>+ isWorking && activity.lifecycleStatus === "inProgress" && activity.turnId === unsettledTurnId,+ );+ const live = activeTail || latestInProgressActivity !== undefined;+ const latestActivity = activeTail+ ? activities.at(-1)!+ : (latestInProgressActivity ?? activities.at(-1)!);+ const summary = live+ ? liveToolActivitySummary(latestActivity)+ : activities.length === 1 && !activities[0]!.toolLike+ ? activities[0]!.workEntry.label+ : summarizeToolGroup(activities.map((activity) => activity.workEntry));result.push({type: "work-toggle",- id: `work-toggle:${groupId}`,- createdAt: entry.createdAt,- turnId: entry.turnId,+ id: `${live ? "work-live" : "work-toggle"}:${groupId}`,+ createdAt: sourceGroup.createdAt,+ turnId: sourceGroup.turnId,groupId,- hiddenCount,+ hiddenCount: activities.length,expanded,- onlyToolActivities: activities.every((activity) => activity.toolLike),+ summary,+ summaryKind: toolGroupSummaryKind(+ (live ? [latestActivity] : activities).map((activity) => activity.workEntry),+ ),+ hasFailure: activities.findLast((activity) => activity.toolLike)?.status === "failure",+ live,+ shimmer:+ isWorking &&+ latestActivity.lifecycleStatus === "inProgress" &&+ latestActivity.turnId === unsettledTurnId,});+ if (!expanded) {+ return;+ }+ for (const activity of activities) {+ result.push({+ type: "activity-group",+ id: activity.id,+ createdAt: activity.createdAt,+ turnId: activity.turnId,+ activities: [+ {+ ...activity,+ groupedToolDetail: true,+ live:+ isWorking &&+ activity.id === latestActivity.id &&+ activity.lifecycleStatus === "inProgress" &&+ activity.turnId === unsettledTurnId,+ },+ ],+ });+ }+}++function liveToolActivitySummary(activity: ThreadFeedActivity): string {+ const command = activity.workEntry.command?.trim();+ if (command) {+ const program = commandProgramName(command);+ return program ? `Running ${program}` : "Running command";+ }+ return activity.detail ?? activity.summary;}/**@@ -1609,6 +1782,8 @@ export function buildThreadFeed(icon: workEntryIcon(entry),toolLike: workLogEntryIsToolLike(entry),status: workEntryStatus(entry),+ ...(entry.toolLifecycleStatus ? { lifecycleStatus: entry.toolLifecycleStatus } : {}),+ workEntry: entry,},};}),diff --git a/apps/web/src/components/chat/MessagesTimeline.tsx b/apps/web/src/components/chat/MessagesTimeline.tsxindex dc0c03709e6..0b9acdf3347 100644--- a/apps/web/src/components/chat/MessagesTimeline.tsx+++ b/apps/web/src/components/chat/MessagesTimeline.tsx@@ -7,6 +7,7 @@ import {type TurnId,} from "@t3tools/contracts";import { parseScopedThreadKey } from "@t3tools/client-runtime/environment";+import { commandProgramName } from "@t3tools/client-runtime/work-log/command-label";import type { AgentPanelModel } from "@t3tools/client-runtime/state/subagentRuntime";import {emptyAgentPanelModel,@@ -2289,176 +2290,6 @@ function workEntryRawCommand(return rawCommand === workEntry.command.trim() ? null : rawCommand;}-type CommandWrapper = "env" | "sudo";--const COMMAND_WRAPPER_OPTIONS_WITH_VALUE: Record<CommandWrapper, ReadonlySet<string>> = {- env: new Set(["-C", "--chdir", "-S", "--split-string", "-u", "--unset"]),- sudo: new Set(["-C", "--close-from", "-D", "--chdir", "-g", "--group", "-u", "--user"]),-};--const COMMAND_WRAPPER_FLAGS: Record<CommandWrapper, ReadonlySet<string>> = {- env: new Set(["-0", "--null", "-i", "--ignore-environment", "--debug", "-v"]),- sudo: new Set(["-A", "--askpass", "-b", "--background", "-E", "-H", "-i", "-n", "-S"]),-};--function tokenizeShellCommand(command: string): string[] | null {- const input = command.trim();- const tokens: string[] = [];- let current = "";- let quote: '"' | "'" | null = null;- let escaping = false;- let substitutionDepth = 0;- let tokenStarted = false;-- for (let index = 0; index < input.length; index += 1) {- const character = input[index]!;- if (escaping) {- current += character;- escaping = false;- tokenStarted = true;- continue;- }- if (character === "\\" && quote !== "'") {- const nextCharacter = input[index + 1];- const isWindowsDrivePath = quote === null && /^[A-Za-z]:/.test(current);- if (- (quote === '"' || isWindowsDrivePath) &&- nextCharacter !== undefined &&- nextCharacter !== '"' &&- nextCharacter !== "\\" &&- nextCharacter !== "$" &&- nextCharacter !== "`" &&- nextCharacter !== "\n"- ) {- current += character;- tokenStarted = true;- continue;- }- escaping = true;- tokenStarted = true;- continue;- }- if (quote !== null) {- if (character === quote) {- quote = null;- } else {- current += character;- }- tokenStarted = true;- continue;- }- if (character === "$" && input[index + 1] === "(") {- current += "$(";- substitutionDepth += 1;- tokenStarted = true;- index += 1;- continue;- }- if (character === ")" && substitutionDepth > 0) {- current += character;- substitutionDepth -= 1;- tokenStarted = true;- continue;- }- if (character === '"' || character === "'") {- quote = character;- tokenStarted = true;- continue;- }- if (/\s/u.test(character)) {- if (substitutionDepth > 0) {- current += character;- tokenStarted = true;- continue;- }- if (tokenStarted) {- tokens.push(current);- current = "";- tokenStarted = false;- }- continue;- }- current += character;- tokenStarted = true;- }-- if (quote !== null || escaping || substitutionDepth > 0) return null;- if (tokenStarted) tokens.push(current);- return tokens;-}--function commandProgramName(command: string, depth = 0): string | null {- if (depth >= 8) return null;- const tokens = tokenizeShellCommand(command);- if (tokens === null) return null;- let index = 0;- let wrapper: CommandWrapper | null = null;-- while (index < tokens.length) {- const token = tokens[index];- if (!token) return null;- if (/^[A-Za-z_][A-Za-z0-9_]*=/.test(token)) {- index += 1;- continue;- }- const tokenProgram = token.split(/[\\/]/).at(-1);- if (tokenProgram === "env" || tokenProgram === "sudo") {- wrapper = tokenProgram;- index += 1;- continue;- }- if (wrapper !== null && token === "--") {- wrapper = null;- index += 1;- continue;- }- if (wrapper !== null && token.startsWith("-")) {- if (wrapper === "env" && (token === "-S" || token === "--split-string")) {- const splitCommand = tokens[index + 1];- return splitCommand ? commandProgramName(splitCommand, depth + 1) : null;- }- if (wrapper === "env" && token.startsWith("--split-string=")) {- return commandProgramName(token.slice("--split-string=".length), depth + 1);- }- if (COMMAND_WRAPPER_OPTIONS_WITH_VALUE[wrapper].has(token)) {- if (tokens[index + 1] === undefined) return null;- index += 2;- continue;- }- if (COMMAND_WRAPPER_FLAGS[wrapper].has(token)) {- index += 1;- continue;- }- const equalsIndex = token.indexOf("=");- if (token.startsWith("--") && equalsIndex > 2) {- if (!COMMAND_WRAPPER_OPTIONS_WITH_VALUE[wrapper].has(token.slice(0, equalsIndex))) {- return null;- }- index += 1;- continue;- }- if (/^-[A-Za-z].+/.test(token) && !token.startsWith("--")) {- let consumesNextToken = false;- for (const [optionIndex, option] of token.slice(1).split("").entries()) {- const shortOption = `-${option}`;- if (COMMAND_WRAPPER_OPTIONS_WITH_VALUE[wrapper].has(shortOption)) {- consumesNextToken = optionIndex === token.length - 2;- break;- }- if (!COMMAND_WRAPPER_FLAGS[wrapper].has(shortOption)) return null;- }- if (consumesNextToken && tokens[index + 1] === undefined) return null;- index += consumesNextToken ? 2 : 1;- continue;- }- return null;- }- return token.split(/[\\/]/).at(-1) || null;- }-- return null;-}-function liveWorkEntryLabel(workEntry: TimelineWorkEntry,workspaceRoot: string | undefined,diff --git a/packages/client-runtime/package.json b/packages/client-runtime/package.jsonindex b14bb8738e2..865a9e4f26e 100644--- a/packages/client-runtime/package.json+++ b/packages/client-runtime/package.json@@ -158,6 +158,14 @@"./state/vcs": {"types": "./src/state/vcs.ts","default": "./src/state/vcs.ts"+ },+ "./work-log/presentation": {+ "types": "./src/work-log/presentation.ts",+ "default": "./src/work-log/presentation.ts"+ },+ "./work-log/command-label": {+ "types": "./src/work-log/commandLabel.ts",+ "default": "./src/work-log/commandLabel.ts"}},"scripts": {diff --git a/packages/client-runtime/src/work-log/commandLabel.ts b/packages/client-runtime/src/work-log/commandLabel.tsnew file mode 100644index 00000000000..b0858725a3f--- /dev/null+++ b/packages/client-runtime/src/work-log/commandLabel.ts@@ -0,0 +1,169 @@+type CommandWrapper = "env" | "sudo";++const COMMAND_WRAPPER_OPTIONS_WITH_VALUE: Record<CommandWrapper, ReadonlySet<string>> = {+ env: new Set(["-C", "--chdir", "-S", "--split-string", "-u", "--unset"]),+ sudo: new Set(["-C", "--close-from", "-D", "--chdir", "-g", "--group", "-u", "--user"]),+};++const COMMAND_WRAPPER_FLAGS: Record<CommandWrapper, ReadonlySet<string>> = {+ env: new Set(["-0", "--null", "-i", "--ignore-environment", "--debug", "-v"]),+ sudo: new Set(["-A", "--askpass", "-b", "--background", "-E", "-H", "-i", "-n", "-S"]),+};++function tokenizeShellCommand(command: string): string[] | null {+ const input = command.trim();+ const tokens: string[] = [];+ let current = "";+ let quote: '"' | "'" | null = null;+ let escaping = false;+ let substitutionDepth = 0;+ let tokenStarted = false;++ for (let index = 0; index < input.length; index += 1) {+ const character = input[index]!;+ if (escaping) {+ current += character;+ escaping = false;+ tokenStarted = true;+ continue;+ }+ if (character === "\\" && quote !== "'") {+ const nextCharacter = input[index + 1];+ const isWindowsDrivePath = quote === null && /^[A-Za-z]:/.test(current);+ if (+ (quote === '"' || isWindowsDrivePath) &&+ nextCharacter !== undefined &&+ nextCharacter !== '"' &&+ nextCharacter !== "\\" &&+ nextCharacter !== "$" &&+ nextCharacter !== "`" &&+ nextCharacter !== "\n"+ ) {+ current += character;+ tokenStarted = true;+ continue;+ }+ escaping = true;+ tokenStarted = true;+ continue;+ }+ if (quote !== null) {+ if (character === quote) {+ quote = null;+ } else {+ current += character;+ }+ tokenStarted = true;+ continue;+ }+ if (character === "$" && input[index + 1] === "(") {+ current += "$(";+ substitutionDepth += 1;+ tokenStarted = true;+ index += 1;+ continue;+ }+ if (character === ")" && substitutionDepth > 0) {+ current += character;+ substitutionDepth -= 1;+ tokenStarted = true;+ continue;+ }+ if (character === '"' || character === "'") {+ quote = character;+ tokenStarted = true;+ continue;+ }+ if (/\s/u.test(character)) {+ if (substitutionDepth > 0) {+ current += character;+ tokenStarted = true;+ continue;+ }+ if (tokenStarted) {+ tokens.push(current);+ current = "";+ tokenStarted = false;+ }+ continue;+ }+ current += character;+ tokenStarted = true;+ }++ if (quote !== null || escaping || substitutionDepth > 0) return null;+ if (tokenStarted) tokens.push(current);+ return tokens;+}++export function commandProgramName(command: string, depth = 0): string | null {+ if (depth >= 8) return null;+ const tokens = tokenizeShellCommand(command);+ if (tokens === null) return null;+ let index = 0;+ let wrapper: CommandWrapper | null = null;++ while (index < tokens.length) {+ const token = tokens[index];+ if (!token) return null;+ if (/^[A-Za-z_][A-Za-z0-9_]*=/.test(token)) {+ index += 1;+ continue;+ }+ const tokenProgram = token.split(/[\\/]/).at(-1);+ if (tokenProgram === "env" || tokenProgram === "sudo") {+ wrapper = tokenProgram;+ index += 1;+ continue;+ }+ if (wrapper !== null && token === "--") {+ wrapper = null;+ index += 1;+ continue;+ }+ if (wrapper !== null && token.startsWith("-")) {+ if (wrapper === "env" && (token === "-S" || token === "--split-string")) {+ const splitCommand = tokens[index + 1];+ return splitCommand ? commandProgramName(splitCommand, depth + 1) : null;+ }+ if (wrapper === "env" && token.startsWith("--split-string=")) {+ return commandProgramName(token.slice("--split-string=".length), depth + 1);+ }+ if (COMMAND_WRAPPER_OPTIONS_WITH_VALUE[wrapper].has(token)) {+ if (tokens[index + 1] === undefined) return null;+ index += 2;+ continue;+ }+ if (COMMAND_WRAPPER_FLAGS[wrapper].has(token)) {+ index += 1;+ continue;+ }+ const equalsIndex = token.indexOf("=");+ if (token.startsWith("--") && equalsIndex > 2) {+ if (!COMMAND_WRAPPER_OPTIONS_WITH_VALUE[wrapper].has(token.slice(0, equalsIndex))) {+ return null;+ }+ index += 1;+ continue;+ }+ if (/^-[A-Za-z].+/.test(token) && !token.startsWith("--")) {+ let consumesNextToken = false;+ for (const [optionIndex, option] of token.slice(1).split("").entries()) {+ const shortOption = `-${option}`;+ if (COMMAND_WRAPPER_OPTIONS_WITH_VALUE[wrapper].has(shortOption)) {+ consumesNextToken = optionIndex === token.length - 2;+ break;+ }+ if (!COMMAND_WRAPPER_FLAGS[wrapper].has(shortOption)) return null;+ }+ if (consumesNextToken && tokens[index + 1] === undefined) return null;+ index += consumesNextToken ? 2 : 1;+ continue;+ }+ return null;+ }+ return token.split(/[\\/]/).at(-1) || null;+ }++ return null;+}diff --git a/packages/client-runtime/src/work-log/presentation.ts b/packages/client-runtime/src/work-log/presentation.tsnew file mode 100644index 00000000000..61ee4770e60--- /dev/null+++ b/packages/client-runtime/src/work-log/presentation.ts@@ -0,0 +1,188 @@+import { isToolLifecycleItemType, type ToolLifecycleItemType } from "@t3tools/contracts";++export interface WorkLogPresentationEntry {+ readonly label: string;+ readonly toolTitle?: string;+ readonly tone: "thinking" | "tool" | "info" | "error";+ readonly command?: string;+ readonly changedFiles?: ReadonlyArray<string>;+ readonly itemType?: ToolLifecycleItemType;+ readonly requestKind?: string;+ readonly turnId?: string | null;+ readonly toolCallId?: string;+ readonly toolLifecycleStatus?: string;+ readonly sourceActivityKind?: string;+ readonly taskId?: string;+}++export type ToolGroupAction =+ | "read"+ | "edit"+ | "command"+ | "code-search"+ | "search"+ | "other"+ | "update";++export type ToolGroupSummaryKind =+ | ToolGroupAction+ | "dynamic-tool"+ | "agent-tool"+ | "tone-tool"+ | "mixed";++export function normalizeCompactToolLabel(value: string): string {+ return value.replace(/\s+(?:complete|completed)\s*$/i, "").trim();+}++function workLogEntryIsToolLike(entry: WorkLogPresentationEntry): boolean {+ if (entry.tone === "tool" || entry.tone === "thinking" || entry.tone === "error") return true;+ if (entry.command !== undefined && entry.command.trim().length > 0) return true;+ if (entry.requestKind !== undefined) return true;+ return entry.itemType !== undefined && isToolLifecycleItemType(entry.itemType);+}++export function workLogEntryIsLocalCodeSearch(entry: WorkLogPresentationEntry): boolean {+ return (+ entry.itemType === "web_search" &&+ /\bgrep\b/i.test(normalizeCompactToolLabel(entry.toolTitle ?? entry.label))+ );+}++export function toolGroupAction(entry: WorkLogPresentationEntry): ToolGroupAction {+ if (+ entry.requestKind === "file-read" ||+ entry.itemType === "image_view" ||+ (entry.itemType === "dynamic_tool_call" && entry.toolTitle === "Read File")+ ) {+ return "read";+ }+ if (+ entry.requestKind === "file-change" ||+ entry.itemType === "file_change" ||+ (entry.changedFiles?.length ?? 0) > 0+ ) {+ return "edit";+ }+ if (entry.requestKind === "command" || entry.itemType === "command_execution" || entry.command) {+ return "command";+ }+ if (workLogEntryIsLocalCodeSearch(entry)) return "code-search";+ if (entry.itemType === "web_search") return "search";+ return workLogEntryIsToolLike(entry) ? "other" : "update";+}++function toolGroupActionCount(+ action: ToolGroupAction,+ entries: ReadonlyArray<WorkLogPresentationEntry>,+): number {+ if (action !== "edit") return entries.length;++ const changedFiles = new Set<string>();+ let editsWithoutFileDetails = 0;+ for (const entry of entries) {+ if (!entry.changedFiles || entry.changedFiles.length === 0) {+ editsWithoutFileDetails += 1;+ continue;+ }+ for (const file of entry.changedFiles) changedFiles.add(file);+ }+ return changedFiles.size + editsWithoutFileDetails;+}++function toolGroupActionLabel(action: ToolGroupAction, count: number): string {+ switch (action) {+ case "read":+ return `Read ${count} ${count === 1 ? "file" : "files"}`;+ case "edit":+ return `Changed ${count} ${count === 1 ? "file" : "files"}`;+ case "command":+ return `Ran ${count} ${count === 1 ? "command" : "commands"}`;+ case "search":+ return `Searched the web ${count} ${count === 1 ? "time" : "times"}`;+ case "code-search":+ return `Searched code ${count} ${count === 1 ? "time" : "times"}`;+ case "other":+ return `Used ${count} ${count === 1 ? "tool" : "tools"}`;+ case "update":+ return `Received ${count} ${count === 1 ? "update" : "updates"}`;+ }+}++export function summarizeToolGroup(entries: ReadonlyArray<WorkLogPresentationEntry>): string {+ const summaryEntries = omitSupersededLifecycleMarkers(entries, (entry) => entry);+ const groupedEntries = new Map<ToolGroupAction, WorkLogPresentationEntry[]>();+ for (const entry of summaryEntries) {+ const action = toolGroupAction(entry);+ const group = groupedEntries.get(action);+ if (group) group.push(entry);+ else groupedEntries.set(action, [entry]);+ }+ const labels = [...groupedEntries].map(([action, actionEntries]) =>+ toolGroupActionLabel(action, toolGroupActionCount(action, actionEntries)),+ );+ const sentenceLabels = labels.map((label, index) =>+ index === 0 ? label : label.charAt(0).toLowerCase() + label.slice(1),+ );+ if (sentenceLabels.length < 2) return sentenceLabels[0] ?? "";+ if (sentenceLabels.length === 2) return sentenceLabels.join(" and ");+ return `${sentenceLabels.slice(0, -1).join(", ")}, and ${sentenceLabels.at(-1)}`;+}++export function omitSupersededLifecycleMarkers<T>(+ entries: readonly T[],+ workEntryFor: (entry: T) => WorkLogPresentationEntry,+): T[] {+ const laterTerminalIdentities = new Set<string>();+ const reversedEntries: T[] = [];++ for (let index = entries.length - 1; index >= 0; index -= 1) {+ const entry = entries[index]!;+ const workEntry = workEntryFor(entry);+ const normalizedLabel = normalizeCompactToolLabel(workEntry.toolTitle ?? workEntry.label);+ const identity = [+ workEntry.turnId ?? "no-turn",+ workEntry.itemType ?? "",+ normalizedLabel,+ ].join("\u001f");+ const activityKind = workEntry.sourceActivityKind;+ const isStatuslessIdlessMarker =+ workEntry.toolCallId === undefined &&+ workEntry.toolLifecycleStatus === undefined &&+ (activityKind === "tool.started" || activityKind === "tool.updated");+ if (isStatuslessIdlessMarker && laterTerminalIdentities.has(identity)) continue;++ reversedEntries.push(entry);+ if (+ activityKind === "tool.completed" ||+ (workEntry.toolLifecycleStatus !== undefined &&+ workEntry.toolLifecycleStatus !== "inProgress")+ ) {+ laterTerminalIdentities.add(identity);+ }+ }++ return reversedEntries.toReversed();+}++export function toolGroupSummaryKind(+ entries: ReadonlyArray<WorkLogPresentationEntry>,+): ToolGroupSummaryKind {+ const actions = new Set(entries.map(toolGroupAction));+ if (actions.size !== 1) return "mixed";++ const action = actions.values().next().value!;+ if (action !== "other") return action;++ const fallbackKinds = new Set(+ entries.map((entry): ToolGroupSummaryKind => {+ if (entry.itemType === "mcp_tool_call") return "other";+ if (entry.itemType === "dynamic_tool_call") return "dynamic-tool";+ if (entry.itemType === "collab_agent_tool_call" || entry.taskId) return "agent-tool";+ if (entry.tone === "thinking") return "agent-tool";+ if (entry.tone === "tool") return "tone-tool";+ return "other";+ }),+ );+ return fallbackKinds.size === 1 ? fallbackKinds.values().next().value! : "mixed";+}diff --git a/patches/@[email protected] b/patches/@[email protected]index 5b45f8592a1..c3b5ee5b0e3 100644--- a/patches/@[email protected]+++ b/patches/@[email protected]@@ -1,5 +1,5 @@diff --git a/keyboard.d.ts b/keyboard.d.ts-index 367945cdfa8a8c260b7a127657a75c016c9ab46f..95263268a47d3f1f57bbc5d528bcc77674f9121f 100644+index 367945cdfa8a8c260b7a127657a75c016c9ab46f..0ac7bf8b8e9c386058b2374199e58fe8c92d39b3 100644--- a/keyboard.d.ts+++ b/keyboard.d.ts@@ -279,7 +279,7 @@ type KeyboardChatComposerInsetListRef = {@@ -7,7 +7,7 @@ index 367945cdfa8a8c260b7a127657a75c016c9ab46f..95263268a47d3f1f57bbc5d528bcc776current: Pick<View, "measure"> | null;};-declare function useKeyboardChatComposerInset(listRef: KeyboardChatComposerInsetListRef, composerRef: KeyboardChatComposerRef, initialHeight?: number): {-+declare function useKeyboardChatComposerInset(listRef: KeyboardChatComposerInsetListRef, composerRef: KeyboardChatComposerRef, initialHeight?: number, heightAdjustment?: number): {++declare function useKeyboardChatComposerInset(listRef: KeyboardChatComposerInsetListRef, composerRef: KeyboardChatComposerRef, initialHeight?: number, heightAdjustment?: number, animationDuration?: number): {contentInsetEndAdjustment: SharedValue<number>;onComposerLayout: (event: LayoutChangeEvent) => void;};@@ -23,15 +23,15 @@ index 367945cdfa8a8c260b7a127657a75c016c9ab46f..95263268a47d3f1f57bbc5d528bcc776} & React.RefAttributes<LegendListRef>) => React.ReactElement | null;diff --git a/keyboard.js b/keyboard.js-index 6645bcbb1f77c36c432035eaf8b2d6d924fc8bda..74c1f568c485d0f907a0d3ea4ad600ccb8d3be62 100644+index 6645bcbb1f77c36c432035eaf8b2d6d924fc8bda..321c4c305129dd3ce3f06127c47d51720a73fb83 100644--- a/keyboard.js+++ b/keyboard.js-@@ -33,19 +33,19 @@ if (typeof __DEV__ !== "undefined" && __DEV__ && !reactNativeKeyboardController.+@@ -33,19 +33,22 @@ if (typeof __DEV__ !== "undefined" && __DEV__ && !reactNativeKeyboardController."[legend-list] KeyboardAwareLegendList requires a recent react-native-keyboard-controller with KeyboardChatScrollView. Please upgrade react-native-keyboard-controller to at least 1.21.7.");}-function useKeyboardChatComposerInset(listRef, composerRef, initialHeight = 0) {-+function useKeyboardChatComposerInset(listRef, composerRef, initialHeight = 0, heightAdjustment = 0) {++function useKeyboardChatComposerInset(listRef, composerRef, initialHeight = 0, heightAdjustment = 0, animationDuration = 0) {const contentInsetEndAdjustment = reactNativeReanimated.useSharedValue(initialHeight);const lastHeightRef = React.useRef(void 0);const reportHeight = React.useCallback(@@ -40,17 +40,21 @@ index 6645bcbb1f77c36c432035eaf8b2d6d924fc8bda..74c1f568c485d0f907a0d3ea4ad600cc+ const height = Math.max(0, rawHeight + heightAdjustment);var _a;if (Number.isFinite(height) && height !== lastHeightRef.current) {++ const shouldAnimate = lastHeightRef.current !== void 0 && animationDuration > 0;lastHeightRef.current = height;- contentInsetEndAdjustment.value = height;+- contentInsetEndAdjustment.value = height;- (_a = listRef.current) == null ? void 0 : _a.reportContentInset({ bottom: height });++ contentInsetEndAdjustment.value = shouldAnimate ? reactNativeReanimated.withTiming(height, {++ duration: animationDuration++ }) : height;}},- [contentInsetEndAdjustment, listRef]-+ [contentInsetEndAdjustment, heightAdjustment, listRef]++ [animationDuration, contentInsetEndAdjustment, heightAdjustment, listRef]);React.useLayoutEffect(() => {var _a;-@@ -84,9 +84,11 @@ function useKeyboardScrollToEnd({ freeze: freezeProp, listRef }) {+@@ -84,9 +87,11 @@ function useKeyboardScrollToEnd({ freeze: freezeProp, listRef }) {}var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2(props, forwardedRef) {const {@@ -62,7 +66,15 @@ index 6645bcbb1f77c36c432035eaf8b2d6d924fc8bda..74c1f568c485d0f907a0d3ea4ad600ccfreeze,keyboardLiftBehavior,keyboardOffset,-@@ -108,11 +110,15 @@ var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2(+@@ -94,6 +99,7 @@ var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2(+ } = props;+ const refLegendList = React.useRef(null);+ const combinedRef = useCombinedRef(forwardedRef, refLegendList);++ const adjustedStartInsetCompensation = props.contentInsetStartAdjustment;+ const blankSpace = reactNativeReanimated.useSharedValue(0);+ React.useEffect(() => {+ if (!anchoredEndSpace) {+@@ -108,11 +114,15 @@ var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2(...anchoredEndSpace,onSizeChanged: (size) => {var _a;@@ -80,23 +92,25 @@ index 6645bcbb1f77c36c432035eaf8b2d6d924fc8bda..74c1f568c485d0f907a0d3ea4ad600ccconst onContentInsetChange = React.useCallback((insets) => {var _a;(_a = refLegendList.current) == null ? void 0 : _a.reportContentInset(insets);-@@ -123,6 +129,7 @@ var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2(+@@ -123,6 +133,8 @@ var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2(reactNativeKeyboardController.KeyboardChatScrollView,{...scrollProps,+ adjustedInsetCompensation,++ adjustedStartInsetCompensation,applyWorkaroundForContentInsetHitTestBug,blankSpace,extraContentPadding: contentInsetEndAdjustment,-@@ -134,6 +141,7 @@ var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2(+@@ -134,6 +146,8 @@ var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2();},[+ adjustedInsetCompensation,++ adjustedStartInsetCompensation,applyWorkaroundForContentInsetHitTestBug,blankSpace,contentInsetEndAdjustment,-@@ -149,6 +157,7 @@ var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2(+@@ -149,6 +163,7 @@ var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2({anchoredEndSpace: anchoredEndSpaceWithBlankSpace,anchoredEndSpaceOwnerInternal: "scroll",@@ -105,15 +119,24 @@ index 6645bcbb1f77c36c432035eaf8b2d6d924fc8bda..74c1f568c485d0f907a0d3ea4ad600ccrenderScrollComponent: memoList,...restdiff --git a/keyboard.mjs b/keyboard.mjs-index 87b38b9607c2eba6b407c2acfd520633bdb0e7c2..62206d657d5616893985fd2c228e57af7eba744b 100644+index 87b38b9607c2eba6b407c2acfd520633bdb0e7c2..111eb242ba9d9ade1cb912550f7df85cf4f361ee 100644--- a/keyboard.mjs+++ b/keyboard.mjs-@@ -12,19 +12,19 @@ if (typeof __DEV__ !== "undefined" && __DEV__ && !KeyboardChatScrollView) {+@@ -1,7 +1,7 @@+ import * as React from 'react';+ import { useRef, useEffect, useMemo, useCallback, useLayoutEffect } from 'react';+ import { KeyboardChatScrollView, KeyboardController } from 'react-native-keyboard-controller';+-import { useSharedValue } from 'react-native-reanimated';++import { useSharedValue, withTiming } from 'react-native-reanimated';+ import { internal } from '@legendapp/list/react-native';+ import { AnimatedLegendList } from '@legendapp/list/reanimated';++@@ -12,19 +12,22 @@ if (typeof __DEV__ !== "undefined" && __DEV__ && !KeyboardChatScrollView) {"[legend-list] KeyboardAwareLegendList requires a recent react-native-keyboard-controller with KeyboardChatScrollView. Please upgrade react-native-keyboard-controller to at least 1.21.7.");}-function useKeyboardChatComposerInset(listRef, composerRef, initialHeight = 0) {-+function useKeyboardChatComposerInset(listRef, composerRef, initialHeight = 0, heightAdjustment = 0) {++function useKeyboardChatComposerInset(listRef, composerRef, initialHeight = 0, heightAdjustment = 0, animationDuration = 0) {const contentInsetEndAdjustment = useSharedValue(initialHeight);const lastHeightRef = useRef(void 0);const reportHeight = useCallback(@@ -122,17 +145,21 @@ index 87b38b9607c2eba6b407c2acfd520633bdb0e7c2..62206d657d5616893985fd2c228e57af+ const height = Math.max(0, rawHeight + heightAdjustment);var _a;if (Number.isFinite(height) && height !== lastHeightRef.current) {++ const shouldAnimate = lastHeightRef.current !== void 0 && animationDuration > 0;lastHeightRef.current = height;- contentInsetEndAdjustment.value = height;+- contentInsetEndAdjustment.value = height;- (_a = listRef.current) == null ? void 0 : _a.reportContentInset({ bottom: height });++ contentInsetEndAdjustment.value = shouldAnimate ? withTiming(height, {++ duration: animationDuration++ }) : height;}},- [contentInsetEndAdjustment, listRef]-+ [contentInsetEndAdjustment, heightAdjustment, listRef]++ [animationDuration, contentInsetEndAdjustment, heightAdjustment, listRef]);useLayoutEffect(() => {var _a;-@@ -63,9 +63,11 @@ function useKeyboardScrollToEnd({ freeze: freezeProp, listRef }) {+@@ -63,9 +66,11 @@ function useKeyboardScrollToEnd({ freeze: freezeProp, listRef }) {}var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2(props, forwardedRef) {const {@@ -144,7 +171,15 @@ index 87b38b9607c2eba6b407c2acfd520633bdb0e7c2..62206d657d5616893985fd2c228e57affreeze,keyboardLiftBehavior,keyboardOffset,-@@ -87,11 +89,15 @@ var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2(+@@ -73,6 +78,7 @@ var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2(+ } = props;+ const refLegendList = useRef(null);+ const combinedRef = useCombinedRef(forwardedRef, refLegendList);++ const adjustedStartInsetCompensation = props.contentInsetStartAdjustment;+ const blankSpace = useSharedValue(0);+ useEffect(() => {+ if (!anchoredEndSpace) {+@@ -87,11 +93,15 @@ var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2(...anchoredEndSpace,onSizeChanged: (size) => {var _a;@@ -162,23 +197,25 @@ index 87b38b9607c2eba6b407c2acfd520633bdb0e7c2..62206d657d5616893985fd2c228e57afconst onContentInsetChange = useCallback((insets) => {var _a;(_a = refLegendList.current) == null ? void 0 : _a.reportContentInset(insets);-@@ -102,6 +108,7 @@ var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2(+@@ -102,6 +112,8 @@ var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2(KeyboardChatScrollView,{...scrollProps,+ adjustedInsetCompensation,++ adjustedStartInsetCompensation,applyWorkaroundForContentInsetHitTestBug,blankSpace,extraContentPadding: contentInsetEndAdjustment,-@@ -113,6 +120,7 @@ var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2(+@@ -113,6 +125,8 @@ var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2();},[+ adjustedInsetCompensation,++ adjustedStartInsetCompensation,applyWorkaroundForContentInsetHitTestBug,blankSpace,contentInsetEndAdjustment,-@@ -128,6 +136,7 @@ var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2(+@@ -128,6 +142,7 @@ var KeyboardAwareLegendList = typedForwardRef(function KeyboardAwareLegendList2({anchoredEndSpace: anchoredEndSpaceWithBlankSpace,anchoredEndSpaceOwnerInternal: "scroll",@@ -204,7 +241,7 @@ index ce1fe00001c9e5aee6c6ea8bb2d4757d4586d002..3ccf6f16067152dfcb0c143371e2ec6a* Number of columns to render items in.* @default 1diff --git a/react-native.js b/react-native.js-index b3c5a306b293f797a8b338adfca3060c0f6db22b..4227ed22da8865b7493f47f199f4d8f4a5493efb 100644+index b3c5a306b293f797a8b338adfca3060c0f6db22b..eb51ff0c375d7e5bd3473fca83995c7c3ffe83af 100644--- a/react-native.js+++ b/react-native.js@@ -954,7 +954,7 @@ function setInitialRenderState(ctx, {@@ -216,7 +253,27 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..4227ed22da8865b7493f47f199f4d8f4if (isReadyToRender && !peek$(ctx, "readyToRender")) {set$(ctx, "readyToRender", true);setAdaptiveRender(ctx, "normal", "ready");-@@ -1304,18 +1304,23 @@ function calculateOffsetWithOffsetPosition(ctx, offsetParam, params) {+@@ -1090,7 +1090,7 @@ function getRawContentLength(ctx) {+ function getAlignItemsAtEndPadding(ctx) {+ const { state } = ctx;+ const shouldPad = !!state.props.alignItemsAtEndPaddingEnabled && !state.props.horizontal && state.props.data.length > 0 && state.scrollLength > 0;+- return shouldPad ? Math.max(0, state.scrollLength - getRawContentLength(ctx) - getContentInsetEnd(ctx)) : 0;++ return shouldPad ? Math.max(0, state.scrollLength - getContentInsetStartAdjustment(ctx) - getRawContentLength(ctx) - getContentInsetEnd(ctx)) : 0;+ }+ function updateContentMetricsState(ctx) {+ const previousPadding = peek$(ctx, "alignItemsAtEndPadding") || 0;+@@ -1115,6 +1115,10 @@ function addTotalSize(ctx, key, add, notifyTotalSize = true) {+ totalSize += add;+ }+ if (prevTotalSize !== totalSize) {++ const now = Date.now();++ const isContinuingContentSizeAnimation = state.contentSizeAnimationActiveEpoch !== void 0;++ state.contentSizeAnimationEpoch = (state.contentSizeAnimationEpoch || 0) + 1;++ state.contentSizeAnimationEligible = !!state.props.sizeComponentInternal && state.didContainersLayout && (isContinuingContentSizeAnimation || !state.props.maintainScrollAtEnd && !state.isUserDragging && !state.isMomentumScrolling && now - (state.lastMVCPAdjustTime || 0) >= 300);+ if (!IsNewArchitecture && state.initialScroll && totalSize < prevTotalSize) {+ state.pendingTotalSize = totalSize;+ } else {+@@ -1304,18 +1308,23 @@ function calculateOffsetWithOffsetPosition(ctx, offsetParam, params) {}// src/core/clampScrollOffset.ts@@ -242,7 +299,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..4227ed22da8865b7493f47f199f4d8f4return clampedOffset;}-@@ -1451,10 +1456,10 @@ function checkFinishedScrollFrame(ctx) {+@@ -1451,10 +1460,10 @@ function checkFinishedScrollFrame(ctx) {finishScrollTo(ctx);}}@@ -255,7 +312,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..4227ed22da8865b7493f47f199f4d8f4x: ctx.state.props.horizontal ? offset : 0,y: ctx.state.props.horizontal ? 0 : offset});-@@ -1503,7 +1508,10 @@ function checkFinishedScrollFallback(ctx) {+@@ -1503,7 +1512,10 @@ function checkFinishedScrollFallback(ctx) {);scheduleFallbackCheck(SILENT_INITIAL_SCROLL_RETRY_DELAY_MS);} else if (shouldRetryUnalignedEndScroll) {@@ -267,7 +324,17 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..4227ed22da8865b7493f47f199f4d8f4scheduleFallbackCheck(100);} else if (shouldFinishZeroTarget || shouldFinishAfterObservedScroll || canFinishInitialScrollWithoutNativeProgress || canFinishAfterSilentNativeDispatch || numChecks > maxChecks) {finishScrollTo(ctx);-@@ -1566,9 +1574,18 @@ function doMaintainScrollAtEnd(ctx) {+@@ -1560,15 +1572,28 @@ function doMaintainScrollAtEnd(ctx) {+ } = state;+ const isWithinMaintainScrollAtEndThreshold = peek$(ctx, "isWithinMaintainScrollAtEndThreshold");+ const shouldMaintainScrollAtEnd = !!(isWithinMaintainScrollAtEndThreshold && maintainScrollAtEnd && didContainersLayout);++ if (state.contentSizeAnimationActiveEpoch !== void 0) {++ state.pendingMaintainScrollAtEnd = false;++ return false;++ }+ if (pendingNativeMVCPAdjust) {+ state.pendingMaintainScrollAtEnd = shouldMaintainScrollAtEnd;+ return false;}if (shouldMaintainScrollAtEnd) {state.pendingMaintainScrollAtEnd = false;@@ -287,7 +354,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..4227ed22da8865b7493f47f199f4d8f4}if (!state.maintainingScrollAtEnd) {const pendingState = maintainScrollAtEnd.animated ? "pending-animated" : "pending-instant";-@@ -1591,9 +1608,18 @@ function doMaintainScrollAtEnd(ctx) {+@@ -1591,9 +1616,18 @@ function doMaintainScrollAtEnd(ctx) {y: 0});} else {@@ -309,7 +376,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..4227ed22da8865b7493f47f199f4d8f4}setTimeout(() => {-@@ -1624,6 +1650,10 @@ function doMaintainScrollAtEnd(ctx) {+@@ -1624,6 +1658,10 @@ function doMaintainScrollAtEnd(ctx) {function requestAdjust(ctx, positionDiff, dataChanged) {const state = ctx.state;if (Math.abs(positionDiff) > 0.1) {@@ -320,7 +387,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..4227ed22da8865b7493f47f199f4d8f4const needsScrollWorkaround = Platform.OS === "android" && !IsNewArchitecture && dataChanged && state.scroll <= positionDiff;const doit = () => {if (needsScrollWorkaround) {-@@ -1728,7 +1758,9 @@ function getPredictedNativeClamp(state, unresolvedAmount, totalSize) {+@@ -1728,7 +1766,9 @@ function getPredictedNativeClamp(state, unresolvedAmount, totalSize) {if (Math.abs(unresolvedAmount) <= MVCP_POSITION_EPSILON) {return 0;}@@ -331,7 +398,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..4227ed22da8865b7493f47f199f4d8f4const clampDelta = maxScroll - state.scroll;if (unresolvedAmount < 0) {return Math.max(unresolvedAmount, Math.min(0, clampDelta));-@@ -1790,7 +1822,7 @@ function resolvePendingNativeMVCPAdjust(ctx, newScroll) {+@@ -1790,7 +1830,7 @@ function resolvePendingNativeMVCPAdjust(ctx, newScroll) {settlePendingNativeMVCPAdjust(ctx, remainingAfterManual, nativeDelta);return true;}@@ -340,7 +407,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..4227ed22da8865b7493f47f199f4d8f4const distanceToClamp = Math.abs(newScroll - expectedNativeClampScroll);const isAtExpectedNativeClamp = distanceToClamp <= NATIVE_END_CLAMP_EPSILON;if (isAtExpectedNativeClamp) {-@@ -1923,7 +1955,7 @@ function prepareMVCP(ctx, dataChanged) {+@@ -1923,7 +1963,7 @@ function prepareMVCP(ctx, dataChanged) {if (diff > 0) {diff = Math.max(0, totalSize - state.scroll - state.scrollLength);} else {@@ -349,7 +416,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..4227ed22da8865b7493f47f199f4d8f4state.scroll = maxScroll;state.scrollPending = maxScroll;diff = 0;-@@ -2320,8 +2352,121 @@ function scrollToIndex(ctx, {+@@ -2320,8 +2360,121 @@ function scrollToIndex(ctx, {}// src/core/initialScroll.ts@@ -471,7 +538,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..4227ed22da8865b7493f47f199f4d8f4const requestedIndex = target.index;const index = requestedIndex !== void 0 ? clampScrollIndex(requestedIndex, ctx.state.props.data.length) : void 0;const itemSize = getItemSizeAtIndex(ctx, index);-@@ -2747,7 +2892,9 @@ function clearFinishedBootstrapInitialScrollTargetIfMovedAway(ctx) {+@@ -2747,7 +2900,9 @@ function clearFinishedBootstrapInitialScrollTargetIfMovedAway(ctx) {return;}if (didFinishedInitialScrollMoveAwayFromTarget(ctx, initialScroll)) {@@ -482,7 +549,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..4227ed22da8865b7493f47f199f4d8f4if (!shouldKeepEndTargetAlive) {if (shouldPreserveInitialScrollForFooterLayout(initialScroll)) {clearPendingInitialScrollFooterLayout(ctx, {-@@ -4672,7 +4819,8 @@ function maybeUpdateAnchoredEndSpace(ctx) {+@@ -4672,7 +4827,8 @@ function maybeUpdateAnchoredEndSpace(ctx) {contentBelowAnchor = Math.max(0, contentBelowAnchor - ctx.scrollAxisGap);contentBelowAnchor += (ctx.values.get("footerSize") || 0) + getStylePaddingEnd(state.props);isReady = !hasUnknownTailSize;@@ -492,7 +559,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..4227ed22da8865b7493f47f199f4d8f4} else if (anchorIndex >= 0) {isReady = false;}-@@ -4692,6 +4840,12 @@ function maybeUpdateAnchoredEndSpace(ctx) {+@@ -4692,6 +4848,12 @@ function maybeUpdateAnchoredEndSpace(ctx) {updateScroll(ctx, state.scroll, true, { markHasScrolled: false });}(_b = anchoredEndSpace == null ? void 0 : anchoredEndSpace.onReady) == null ? void 0 : _b.call(anchoredEndSpace, { anchorIndex: nextAnchorIndex, anchorKey: nextAnchorKey, size: nextSize });@@ -505,7 +572,84 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..4227ed22da8865b7493f47f199f4d8f4}return nextSize;}-@@ -7075,6 +7229,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -5715,6 +5877,7 @@ var ContainersLayer = typedMemo(function ContainersLayer2({+ horizontal+ }) {+ const ctx = useStateContext();++ const SizeComponent = ctx.state.props.sizeComponentInternal;+ const columnWrapperStyle = ctx.columnWrapperStyle;+ const animSize = useValue$("totalSize");+ const [readyToRender, numColumns, otherAxisSize = 0] = useArr$(["readyToRender", "numColumns", "otherAxisSize"]);+@@ -5725,6 +5888,13 @@ var ContainersLayer = typedMemo(function ContainersLayer2({+ opacity: isVisible ? 1 : 0,+ width: animSize+ } : { height: animSize, minWidth: otherAxisSize, opacity: isVisible ? 1 : 0 };++ if (SizeComponent) {++ if (horizontal) {++ delete style.width;++ } else {++ delete style.height;++ }++ }+ if (columnWrapperStyle) {+ const { columnGap, rowGap, gap } = columnWrapperStyle;+ const gapX = columnGap || gap || 0;+@@ -5745,7 +5915,8 @@ var ContainersLayer = typedMemo(function ContainersLayer2({+ }+ }+ }+- return /* @__PURE__ */ React2__namespace.createElement(ReactNative.Animated.View, { pointerEvents: isVisible ? void 0 : "none", style }, /* @__PURE__ */ React2__namespace.createElement(ContainerLayoutCoordinator, null, children));++ const content = /* @__PURE__ */ React2__namespace.createElement(ContainerLayoutCoordinator, null, children);++ return SizeComponent ? /* @__PURE__ */ React2__namespace.createElement(SizeComponent, { horizontal, pointerEvents: isVisible ? void 0 : "none", signalName: "totalSize", style }, content) : /* @__PURE__ */ React2__namespace.createElement(ReactNative.Animated.View, { pointerEvents: isVisible ? void 0 : "none", style }, content);+ });+ var Containers = typedMemo(function Containers2({+ freshDataTransitionEpoch,+@@ -5896,7 +6067,12 @@ var StyleSheet = ReactNative.StyleSheet;++ // src/components/ListComponent.tsx+ var AlignItemsAtEndSpacer = typedMemo(function AlignItemsAtEndSpacer2({ horizontal }) {++ const ctx = useStateContext();+ const [alignItemsAtEndPadding = 0] = useArr$(["alignItemsAtEndPadding"]);++ const SizeComponent = ctx.state.props.sizeComponentInternal;++ if (SizeComponent) {++ return /* @__PURE__ */ React2__namespace.createElement(SizeComponent, { horizontal, signalName: "alignItemsAtEndPadding", style: { flexShrink: 0 } });++ }+ if (alignItemsAtEndPadding <= 0) {+ return null;+ }+@@ -5929,8 +6105,12 @@ var ListComponent = typedMemo(function ListComponent2({+ refScrollView,+ renderScrollComponent,+ onLayoutFooter,++ onInternalMomentumScrollBegin,+ onInternalScrollBeginDrag,++ onInternalScrollEndDrag,+ onInternalScrollEnd,++ onMomentumScrollBegin,++ onScrollEndDrag,+ scrollAdjustHandler,+ snapToIndices,+ stickyHeaderConfig,+@@ -6001,7 +6181,17 @@ var ListComponent = typedMemo(function ListComponent2({+ SnapOrScroll,+ {+ ...rest,+- ...Platform.OS === "web" ? ScrollComponent === ListComponentScrollView ? { onInternalScrollEnd, useWindowScroll } : {} : { onScrollBeginDrag: onInternalScrollBeginDrag },++ ...Platform.OS === "web" ? ScrollComponent === ListComponentScrollView ? { onInternalScrollEnd, useWindowScroll } : {} : {++ onMomentumScrollBegin: (event) => {++ onInternalMomentumScrollBegin == null ? void 0 : onInternalMomentumScrollBegin(event);++ onMomentumScrollBegin == null ? void 0 : onMomentumScrollBegin(event);++ },++ onScrollBeginDrag: onInternalScrollBeginDrag,++ onScrollEndDrag: (event) => {++ onInternalScrollEndDrag == null ? void 0 : onInternalScrollEndDrag(event);++ onScrollEndDrag == null ? void 0 : onScrollEndDrag(event);++ }++ },+ contentContainerStyle: [+ horizontal ? { height: "100%" } : {},+ contentContainerStyle,+@@ -7075,6 +7265,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardeddataVersion,drawDistance = 250,contentInsetEndAdjustment,@@ -513,7 +657,20 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..4227ed22da8865b7493f47f199f4d8f4estimatedItemSize = 100,estimatedListSize,extraData,-@@ -7200,7 +7356,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7132,10 +7323,12 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+ const animatedPropsInternal = props.animatedPropsInternal;+ const anchoredEndSpaceOwner = (_a3 = props.anchoredEndSpaceOwnerInternal) != null ? _a3 : "list";+ const positionComponentInternal = props.positionComponentInternal;++ const sizeComponentInternal = props.sizeComponentInternal;+ const stickyPositionComponentInternal = props.stickyPositionComponentInternal;+ const {+ anchoredEndSpaceOwnerInternal: _anchoredEndSpaceOwnerInternal,+ positionComponentInternal: _positionComponentInternal,++ sizeComponentInternal: _sizeComponentInternal,+ stickyPositionComponentInternal: _stickyPositionComponentInternal,+ ...restProps+ } = rest;+@@ -7200,7 +7393,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedconst combinedRef = useCombinedRef(refScroller, refScrollView);const keyExtractor = keyExtractorProp != null ? keyExtractorProp : ((_item, index) => index.toString());const stickyHeaderIndices = stickyHeaderIndicesProp;@@ -522,7 +679,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..4227ed22da8865b7493f47f199f4d8f4const previousContentInsetEndAdjustmentRef = React2.useRef(contentInsetEndAdjustmentResolved);const alwaysRenderIndices = React2.useMemo(() => {const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor, anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex);-@@ -7341,6 +7497,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7341,6 +7534,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedcontentContainerAlignItems: contentContainerStyle.alignItems,contentInset,contentInsetEndAdjustment: contentInsetEndAdjustmentResolved,@@ -530,7 +687,15 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..4227ed22da8865b7493f47f199f4d8f4data: dataProp,dataKey,dataVersion,-@@ -7423,6 +7580,13 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7372,6 +7566,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+ renderItem,+ rtl,+ snapToIndices,++ sizeComponentInternal,+ stickyHeaderIndicesArr: stickyHeaderIndices != null ? stickyHeaderIndices : [],+ stickyHeaderIndicesSet: React2.useMemo(() => new Set(stickyHeaderIndices != null ? stickyHeaderIndices : []), [stickyHeaderIndices == null ? void 0 : stickyHeaderIndices.join(",")]),+ stickyPositionComponentInternal,+@@ -7423,6 +7618,13 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedreturn void 0;}const resolvedOffset = (_a4 = initialScroll.contentOffset) != null ? _a4 : resolveInitialScrollOffset(ctx, initialScroll);@@ -544,15 +709,43 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..4227ed22da8865b7493f47f199f4d8f4return usesBootstrapInitialScroll && ((_b2 = state.initialScrollSession) == null ? void 0 : _b2.kind) === "bootstrap" && Platform.OS === "web" ? void 0 : resolvedOffset;}, [usesBootstrapInitialScroll]);React2.useLayoutEffect(() => {-@@ -7651,6 +7815,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7547,6 +7749,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+ [+ dataKey,+ dataVersion,++ contentInsetStartAdjustment,+ memoizedLastItemKeys.join(","),+ numColumnsProp,+ nextScrollAxisGap,+@@ -7643,6 +7846,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+ () => ({+ getRenderedItem: (key) => getRenderedItem(ctx, key),+ onMomentumScrollEnd: (event) => {++ state.isMomentumScrolling = false;+ checkFinishedScrollFallback(ctx);+ if (state.props.onMomentumScrollEnd) {+ state.props.onMomentumScrollEnd(event);+@@ -7651,6 +7855,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedonScroll: (event) => onScroll(ctx, event),onScrollBeginDrag: (event) => {var _a4, _b2;+ ctx.state.didUserDrag = true;++ ctx.state.isUserDragging = true;prepareReachedEdgeForNextUserScroll(ctx);(_b2 = (_a4 = state.props).onScrollBeginDrag) == null ? void 0 : _b2.call(_a4, event);},-@@ -7681,6 +7846,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7676,11 +7882,18 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+ ListFooterComponent,+ ListFooterComponentStyle,+ ListHeaderComponent,++ onInternalMomentumScrollBegin: () => {++ ctx.state.isMomentumScrolling = true;++ },+ onInternalScrollBeginDrag: fns.onScrollBeginDrag,++ onInternalScrollEndDrag: () => {++ ctx.state.isUserDragging = false;++ },+ onInternalScrollEnd: fns.onScrollEnd,onLayout,onLayoutFooter,onMomentumScrollEnd: fns.onMomentumScrollEnd,@@ -561,7 +754,7 @@ index b3c5a306b293f797a8b338adfca3060c0f6db22b..4227ed22da8865b7493f47f199f4d8f4recycleItems,refreshControl: refreshControlElement ? stylePaddingTopState > 0 ? React2__namespace.cloneElement(refreshControlElement, {diff --git a/react-native.mjs b/react-native.mjs-index 40e87cda8c9bc79a889e5542f29af429a24b24d4..2d556eecb0bafe2f54084c809f82144c7a5dce7f 100644+index 40e87cda8c9bc79a889e5542f29af429a24b24d4..700515b52c27a4ccd5343176121e7318d57e29dc 100644--- a/react-native.mjs+++ b/react-native.mjs@@ -933,7 +933,7 @@ function setInitialRenderState(ctx, {@@ -573,7 +766,27 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..2d556eecb0bafe2f54084c809f82144cif (isReadyToRender && !peek$(ctx, "readyToRender")) {set$(ctx, "readyToRender", true);setAdaptiveRender(ctx, "normal", "ready");-@@ -1283,18 +1283,23 @@ function calculateOffsetWithOffsetPosition(ctx, offsetParam, params) {+@@ -1069,7 +1069,7 @@ function getRawContentLength(ctx) {+ function getAlignItemsAtEndPadding(ctx) {+ const { state } = ctx;+ const shouldPad = !!state.props.alignItemsAtEndPaddingEnabled && !state.props.horizontal && state.props.data.length > 0 && state.scrollLength > 0;+- return shouldPad ? Math.max(0, state.scrollLength - getRawContentLength(ctx) - getContentInsetEnd(ctx)) : 0;++ return shouldPad ? Math.max(0, state.scrollLength - getContentInsetStartAdjustment(ctx) - getRawContentLength(ctx) - getContentInsetEnd(ctx)) : 0;+ }+ function updateContentMetricsState(ctx) {+ const previousPadding = peek$(ctx, "alignItemsAtEndPadding") || 0;+@@ -1094,6 +1094,10 @@ function addTotalSize(ctx, key, add, notifyTotalSize = true) {+ totalSize += add;+ }+ if (prevTotalSize !== totalSize) {++ const now = Date.now();++ const isContinuingContentSizeAnimation = state.contentSizeAnimationActiveEpoch !== void 0;++ state.contentSizeAnimationEpoch = (state.contentSizeAnimationEpoch || 0) + 1;++ state.contentSizeAnimationEligible = !!state.props.sizeComponentInternal && state.didContainersLayout && (isContinuingContentSizeAnimation || !state.props.maintainScrollAtEnd && !state.isUserDragging && !state.isMomentumScrolling && now - (state.lastMVCPAdjustTime || 0) >= 300);+ if (!IsNewArchitecture && state.initialScroll && totalSize < prevTotalSize) {+ state.pendingTotalSize = totalSize;+ } else {+@@ -1283,18 +1287,23 @@ function calculateOffsetWithOffsetPosition(ctx, offsetParam, params) {}// src/core/clampScrollOffset.ts@@ -599,7 +812,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..2d556eecb0bafe2f54084c809f82144creturn clampedOffset;}-@@ -1430,10 +1435,10 @@ function checkFinishedScrollFrame(ctx) {+@@ -1430,10 +1439,10 @@ function checkFinishedScrollFrame(ctx) {finishScrollTo(ctx);}}@@ -612,7 +825,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..2d556eecb0bafe2f54084c809f82144cx: ctx.state.props.horizontal ? offset : 0,y: ctx.state.props.horizontal ? 0 : offset});-@@ -1482,7 +1487,10 @@ function checkFinishedScrollFallback(ctx) {+@@ -1482,7 +1491,10 @@ function checkFinishedScrollFallback(ctx) {);scheduleFallbackCheck(SILENT_INITIAL_SCROLL_RETRY_DELAY_MS);} else if (shouldRetryUnalignedEndScroll) {@@ -624,7 +837,17 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..2d556eecb0bafe2f54084c809f82144cscheduleFallbackCheck(100);} else if (shouldFinishZeroTarget || shouldFinishAfterObservedScroll || canFinishInitialScrollWithoutNativeProgress || canFinishAfterSilentNativeDispatch || numChecks > maxChecks) {finishScrollTo(ctx);-@@ -1545,9 +1553,18 @@ function doMaintainScrollAtEnd(ctx) {+@@ -1539,15 +1551,28 @@ function doMaintainScrollAtEnd(ctx) {+ } = state;+ const isWithinMaintainScrollAtEndThreshold = peek$(ctx, "isWithinMaintainScrollAtEndThreshold");+ const shouldMaintainScrollAtEnd = !!(isWithinMaintainScrollAtEndThreshold && maintainScrollAtEnd && didContainersLayout);++ if (state.contentSizeAnimationActiveEpoch !== void 0) {++ state.pendingMaintainScrollAtEnd = false;++ return false;++ }+ if (pendingNativeMVCPAdjust) {+ state.pendingMaintainScrollAtEnd = shouldMaintainScrollAtEnd;+ return false;}if (shouldMaintainScrollAtEnd) {state.pendingMaintainScrollAtEnd = false;@@ -644,7 +867,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..2d556eecb0bafe2f54084c809f82144c}if (!state.maintainingScrollAtEnd) {const pendingState = maintainScrollAtEnd.animated ? "pending-animated" : "pending-instant";-@@ -1570,9 +1587,18 @@ function doMaintainScrollAtEnd(ctx) {+@@ -1570,9 +1595,18 @@ function doMaintainScrollAtEnd(ctx) {y: 0});} else {@@ -666,7 +889,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..2d556eecb0bafe2f54084c809f82144c}setTimeout(() => {-@@ -1603,6 +1629,10 @@ function doMaintainScrollAtEnd(ctx) {+@@ -1603,6 +1637,10 @@ function doMaintainScrollAtEnd(ctx) {function requestAdjust(ctx, positionDiff, dataChanged) {const state = ctx.state;if (Math.abs(positionDiff) > 0.1) {@@ -677,7 +900,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..2d556eecb0bafe2f54084c809f82144cconst needsScrollWorkaround = Platform.OS === "android" && !IsNewArchitecture && dataChanged && state.scroll <= positionDiff;const doit = () => {if (needsScrollWorkaround) {-@@ -1707,7 +1737,9 @@ function getPredictedNativeClamp(state, unresolvedAmount, totalSize) {+@@ -1707,7 +1745,9 @@ function getPredictedNativeClamp(state, unresolvedAmount, totalSize) {if (Math.abs(unresolvedAmount) <= MVCP_POSITION_EPSILON) {return 0;}@@ -688,7 +911,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..2d556eecb0bafe2f54084c809f82144cconst clampDelta = maxScroll - state.scroll;if (unresolvedAmount < 0) {return Math.max(unresolvedAmount, Math.min(0, clampDelta));-@@ -1769,7 +1801,7 @@ function resolvePendingNativeMVCPAdjust(ctx, newScroll) {+@@ -1769,7 +1809,7 @@ function resolvePendingNativeMVCPAdjust(ctx, newScroll) {settlePendingNativeMVCPAdjust(ctx, remainingAfterManual, nativeDelta);return true;}@@ -697,7 +920,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..2d556eecb0bafe2f54084c809f82144cconst distanceToClamp = Math.abs(newScroll - expectedNativeClampScroll);const isAtExpectedNativeClamp = distanceToClamp <= NATIVE_END_CLAMP_EPSILON;if (isAtExpectedNativeClamp) {-@@ -1902,7 +1934,7 @@ function prepareMVCP(ctx, dataChanged) {+@@ -1902,7 +1942,7 @@ function prepareMVCP(ctx, dataChanged) {if (diff > 0) {diff = Math.max(0, totalSize - state.scroll - state.scrollLength);} else {@@ -706,7 +929,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..2d556eecb0bafe2f54084c809f82144cstate.scroll = maxScroll;state.scrollPending = maxScroll;diff = 0;-@@ -2299,8 +2331,121 @@ function scrollToIndex(ctx, {+@@ -2299,8 +2339,121 @@ function scrollToIndex(ctx, {}// src/core/initialScroll.ts@@ -828,7 +1051,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..2d556eecb0bafe2f54084c809f82144cconst requestedIndex = target.index;const index = requestedIndex !== void 0 ? clampScrollIndex(requestedIndex, ctx.state.props.data.length) : void 0;const itemSize = getItemSizeAtIndex(ctx, index);-@@ -2726,7 +2871,9 @@ function clearFinishedBootstrapInitialScrollTargetIfMovedAway(ctx) {+@@ -2726,7 +2879,9 @@ function clearFinishedBootstrapInitialScrollTargetIfMovedAway(ctx) {return;}if (didFinishedInitialScrollMoveAwayFromTarget(ctx, initialScroll)) {@@ -839,7 +1062,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..2d556eecb0bafe2f54084c809f82144cif (!shouldKeepEndTargetAlive) {if (shouldPreserveInitialScrollForFooterLayout(initialScroll)) {clearPendingInitialScrollFooterLayout(ctx, {-@@ -4651,7 +4798,8 @@ function maybeUpdateAnchoredEndSpace(ctx) {+@@ -4651,7 +4806,8 @@ function maybeUpdateAnchoredEndSpace(ctx) {contentBelowAnchor = Math.max(0, contentBelowAnchor - ctx.scrollAxisGap);contentBelowAnchor += (ctx.values.get("footerSize") || 0) + getStylePaddingEnd(state.props);isReady = !hasUnknownTailSize;@@ -849,7 +1072,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..2d556eecb0bafe2f54084c809f82144c} else if (anchorIndex >= 0) {isReady = false;}-@@ -4671,6 +4819,12 @@ function maybeUpdateAnchoredEndSpace(ctx) {+@@ -4671,6 +4827,12 @@ function maybeUpdateAnchoredEndSpace(ctx) {updateScroll(ctx, state.scroll, true, { markHasScrolled: false });}(_b = anchoredEndSpace == null ? void 0 : anchoredEndSpace.onReady) == null ? void 0 : _b.call(anchoredEndSpace, { anchorIndex: nextAnchorIndex, anchorKey: nextAnchorKey, size: nextSize });@@ -862,7 +1085,84 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..2d556eecb0bafe2f54084c809f82144c}return nextSize;}-@@ -7054,6 +7208,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -5694,6 +5856,7 @@ var ContainersLayer = typedMemo(function ContainersLayer2({+ horizontal+ }) {+ const ctx = useStateContext();++ const SizeComponent = ctx.state.props.sizeComponentInternal;+ const columnWrapperStyle = ctx.columnWrapperStyle;+ const animSize = useValue$("totalSize");+ const [readyToRender, numColumns, otherAxisSize = 0] = useArr$(["readyToRender", "numColumns", "otherAxisSize"]);+@@ -5704,6 +5867,13 @@ var ContainersLayer = typedMemo(function ContainersLayer2({+ opacity: isVisible ? 1 : 0,+ width: animSize+ } : { height: animSize, minWidth: otherAxisSize, opacity: isVisible ? 1 : 0 };++ if (SizeComponent) {++ if (horizontal) {++ delete style.width;++ } else {++ delete style.height;++ }++ }+ if (columnWrapperStyle) {+ const { columnGap, rowGap, gap } = columnWrapperStyle;+ const gapX = columnGap || gap || 0;+@@ -5724,7 +5894,8 @@ var ContainersLayer = typedMemo(function ContainersLayer2({+ }+ }+ }+- return /* @__PURE__ */ React2.createElement(Animated.View, { pointerEvents: isVisible ? void 0 : "none", style }, /* @__PURE__ */ React2.createElement(ContainerLayoutCoordinator, null, children));++ const content = /* @__PURE__ */ React2.createElement(ContainerLayoutCoordinator, null, children);++ return SizeComponent ? /* @__PURE__ */ React2.createElement(SizeComponent, { horizontal, pointerEvents: isVisible ? void 0 : "none", signalName: "totalSize", style }, content) : /* @__PURE__ */ React2.createElement(Animated.View, { pointerEvents: isVisible ? void 0 : "none", style }, content);+ });+ var Containers = typedMemo(function Containers2({+ freshDataTransitionEpoch,+@@ -5875,7 +6046,12 @@ var StyleSheet = StyleSheet$1;++ // src/components/ListComponent.tsx+ var AlignItemsAtEndSpacer = typedMemo(function AlignItemsAtEndSpacer2({ horizontal }) {++ const ctx = useStateContext();+ const [alignItemsAtEndPadding = 0] = useArr$(["alignItemsAtEndPadding"]);++ const SizeComponent = ctx.state.props.sizeComponentInternal;++ if (SizeComponent) {++ return /* @__PURE__ */ React2.createElement(SizeComponent, { horizontal, signalName: "alignItemsAtEndPadding", style: { flexShrink: 0 } });++ }+ if (alignItemsAtEndPadding <= 0) {+ return null;+ }+@@ -5908,8 +6084,12 @@ var ListComponent = typedMemo(function ListComponent2({+ refScrollView,+ renderScrollComponent,+ onLayoutFooter,++ onInternalMomentumScrollBegin,+ onInternalScrollBeginDrag,++ onInternalScrollEndDrag,+ onInternalScrollEnd,++ onMomentumScrollBegin,++ onScrollEndDrag,+ scrollAdjustHandler,+ snapToIndices,+ stickyHeaderConfig,+@@ -5980,7 +6160,17 @@ var ListComponent = typedMemo(function ListComponent2({+ SnapOrScroll,+ {+ ...rest,+- ...Platform.OS === "web" ? ScrollComponent === ListComponentScrollView ? { onInternalScrollEnd, useWindowScroll } : {} : { onScrollBeginDrag: onInternalScrollBeginDrag },++ ...Platform.OS === "web" ? ScrollComponent === ListComponentScrollView ? { onInternalScrollEnd, useWindowScroll } : {} : {++ onMomentumScrollBegin: (event) => {++ onInternalMomentumScrollBegin == null ? void 0 : onInternalMomentumScrollBegin(event);++ onMomentumScrollBegin == null ? void 0 : onMomentumScrollBegin(event);++ },++ onScrollBeginDrag: onInternalScrollBeginDrag,++ onScrollEndDrag: (event) => {++ onInternalScrollEndDrag == null ? void 0 : onInternalScrollEndDrag(event);++ onScrollEndDrag == null ? void 0 : onScrollEndDrag(event);++ }++ },+ contentContainerStyle: [+ horizontal ? { height: "100%" } : {},+ contentContainerStyle,+@@ -7054,6 +7244,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardeddataVersion,drawDistance = 250,contentInsetEndAdjustment,@@ -870,7 +1170,20 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..2d556eecb0bafe2f54084c809f82144cestimatedItemSize = 100,estimatedListSize,extraData,-@@ -7179,7 +7334,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7111,10 +7302,12 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+ const animatedPropsInternal = props.animatedPropsInternal;+ const anchoredEndSpaceOwner = (_a3 = props.anchoredEndSpaceOwnerInternal) != null ? _a3 : "list";+ const positionComponentInternal = props.positionComponentInternal;++ const sizeComponentInternal = props.sizeComponentInternal;+ const stickyPositionComponentInternal = props.stickyPositionComponentInternal;+ const {+ anchoredEndSpaceOwnerInternal: _anchoredEndSpaceOwnerInternal,+ positionComponentInternal: _positionComponentInternal,++ sizeComponentInternal: _sizeComponentInternal,+ stickyPositionComponentInternal: _stickyPositionComponentInternal,+ ...restProps+ } = rest;+@@ -7179,7 +7372,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedconst combinedRef = useCombinedRef(refScroller, refScrollView);const keyExtractor = keyExtractorProp != null ? keyExtractorProp : ((_item, index) => index.toString());const stickyHeaderIndices = stickyHeaderIndicesProp;@@ -879,7 +1192,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..2d556eecb0bafe2f54084c809f82144cconst previousContentInsetEndAdjustmentRef = useRef(contentInsetEndAdjustmentResolved);const alwaysRenderIndices = useMemo(() => {const indices = getAlwaysRenderIndices(alwaysRender, dataProp, keyExtractor, anchoredEndSpace == null ? void 0 : anchoredEndSpace.anchorIndex);-@@ -7320,6 +7475,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7320,6 +7513,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedcontentContainerAlignItems: contentContainerStyle.alignItems,contentInset,contentInsetEndAdjustment: contentInsetEndAdjustmentResolved,@@ -887,7 +1200,15 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..2d556eecb0bafe2f54084c809f82144cdata: dataProp,dataKey,dataVersion,-@@ -7402,6 +7558,13 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7351,6 +7545,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+ renderItem,+ rtl,+ snapToIndices,++ sizeComponentInternal,+ stickyHeaderIndicesArr: stickyHeaderIndices != null ? stickyHeaderIndices : [],+ stickyHeaderIndicesSet: useMemo(() => new Set(stickyHeaderIndices != null ? stickyHeaderIndices : []), [stickyHeaderIndices == null ? void 0 : stickyHeaderIndices.join(",")]),+ stickyPositionComponentInternal,+@@ -7402,6 +7597,13 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedreturn void 0;}const resolvedOffset = (_a4 = initialScroll.contentOffset) != null ? _a4 : resolveInitialScrollOffset(ctx, initialScroll);@@ -901,15 +1222,43 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..2d556eecb0bafe2f54084c809f82144creturn usesBootstrapInitialScroll && ((_b2 = state.initialScrollSession) == null ? void 0 : _b2.kind) === "bootstrap" && Platform.OS === "web" ? void 0 : resolvedOffset;}, [usesBootstrapInitialScroll]);useLayoutEffect(() => {-@@ -7630,6 +7793,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7526,6 +7728,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+ [+ dataKey,+ dataVersion,++ contentInsetStartAdjustment,+ memoizedLastItemKeys.join(","),+ numColumnsProp,+ nextScrollAxisGap,+@@ -7622,6 +7825,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+ () => ({+ getRenderedItem: (key) => getRenderedItem(ctx, key),+ onMomentumScrollEnd: (event) => {++ state.isMomentumScrolling = false;+ checkFinishedScrollFallback(ctx);+ if (state.props.onMomentumScrollEnd) {+ state.props.onMomentumScrollEnd(event);+@@ -7630,6 +7834,8 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwardedonScroll: (event) => onScroll(ctx, event),onScrollBeginDrag: (event) => {var _a4, _b2;+ ctx.state.didUserDrag = true;++ ctx.state.isUserDragging = true;prepareReachedEdgeForNextUserScroll(ctx);(_b2 = (_a4 = state.props).onScrollBeginDrag) == null ? void 0 : _b2.call(_a4, event);},-@@ -7660,6 +7824,7 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+@@ -7655,11 +7861,18 @@ var LegendListInner = typedForwardRef(function LegendListInner2(props, forwarded+ ListFooterComponent,+ ListFooterComponentStyle,+ ListHeaderComponent,++ onInternalMomentumScrollBegin: () => {++ ctx.state.isMomentumScrolling = true;++ },+ onInternalScrollBeginDrag: fns.onScrollBeginDrag,++ onInternalScrollEndDrag: () => {++ ctx.state.isUserDragging = false;++ },+ onInternalScrollEnd: fns.onScrollEnd,onLayout,onLayoutFooter,onMomentumScrollEnd: fns.onMomentumScrollEnd,@@ -918,7 +1267,7 @@ index 40e87cda8c9bc79a889e5542f29af429a24b24d4..2d556eecb0bafe2f54084c809f82144crecycleItems,refreshControl: refreshControlElement ? stylePaddingTopState > 0 ? React2.cloneElement(refreshControlElement, {diff --git a/react.js b/react.js-index 914d2dafaafa001c9ab6791a0a0581659295e333..06466096ceb96ef8773f7f7e202a19c9b774d49b 100644+index 914d2dafaafa001c9ab6791a0a0581659295e333..a2df18d450eebe451fda42bab47d1658458edbb1 100644--- a/react.js+++ b/react.js@@ -4702,7 +4702,8 @@ function maybeUpdateAnchoredEndSpace(ctx) {@@ -931,8 +1280,7 @@ index 914d2dafaafa001c9ab6791a0a0581659295e333..06466096ceb96ef8773f7f7e202a19c9} else if (anchorIndex >= 0) {isReady = false;}-@@ -4721,7 +4722,13 @@ function maybeUpdateAnchoredEndSpace(ctx) {- updateContentMetricsState(ctx);+@@ -4722,6 +4723,12 @@ function maybeUpdateAnchoredEndSpace(ctx) {updateScroll(ctx, state.scroll, true, { markHasScrolled: false });}(_b = anchoredEndSpace == null ? void 0 : anchoredEndSpace.onReady) == null ? void 0 : _b.call(anchoredEndSpace, { anchorIndex: nextAnchorIndex, anchorKey: nextAnchorKey, size: nextSize });@@ -945,7 +1293,7 @@ index 914d2dafaafa001c9ab6791a0a0581659295e333..06466096ceb96ef8773f7f7e202a19c9}return nextSize;}-@@ -6448,8 +6455,8 @@ function ScrollAdjust() {+@@ -6446,8 +6453,8 @@ function ScrollAdjust() {window.getComputedStyle(contentNode)[axis.paddingEndProp]);const temporaryPaddingEnd = `${(currentPaddingEnd || 0) + pad}px`;@@ -956,7 +1304,7 @@ index 914d2dafaafa001c9ab6791a0a0581659295e333..06466096ceb96ef8773f7f7e202a19c9scrollBy();if (resetPaddingRafRef.current !== void 0) {diff --git a/react.mjs b/react.mjs-index 95465f2ab89ce41a10553f58af83618f7310e83c..4b5f06c60f1e8bbd9035a49980d9e86820262da4 100644+index 95465f2ab89ce41a10553f58af83618f7310e83c..25cf046f2c3141ddce5a0b6e28c354b865331b4f 100644--- a/react.mjs+++ b/react.mjs@@ -4681,7 +4681,8 @@ function maybeUpdateAnchoredEndSpace(ctx) {@@ -969,8 +1317,7 @@ index 95465f2ab89ce41a10553f58af83618f7310e83c..4b5f06c60f1e8bbd9035a49980d9e868} else if (anchorIndex >= 0) {isReady = false;}-@@ -4700,7 +4701,13 @@ function maybeUpdateAnchoredEndSpace(ctx) {- updateContentMetricsState(ctx);+@@ -4701,6 +4702,12 @@ function maybeUpdateAnchoredEndSpace(ctx) {updateScroll(ctx, state.scroll, true, { markHasScrolled: false });}(_b = anchoredEndSpace == null ? void 0 : anchoredEndSpace.onReady) == null ? void 0 : _b.call(anchoredEndSpace, { anchorIndex: nextAnchorIndex, anchorKey: nextAnchorKey, size: nextSize });@@ -983,7 +1330,7 @@ index 95465f2ab89ce41a10553f58af83618f7310e83c..4b5f06c60f1e8bbd9035a49980d9e868}return nextSize;}-@@ -6427,8 +6434,8 @@ function ScrollAdjust() {+@@ -6425,8 +6432,8 @@ function ScrollAdjust() {window.getComputedStyle(contentNode)[axis.paddingEndProp]);const temporaryPaddingEnd = `${(currentPaddingEnd || 0) + pad}px`;@@ -1011,19 +1358,22 @@ index e5043320700b12f34f4c0babbc341f85ca8135c1..2ce63830a28636b21937a0741fd0e613* Number of columns to render items in.* @default 1diff --git a/reanimated.js b/reanimated.js-index f1265fad74189591b5aae86cf2e3a31f9c0fdb02..16dcef04a6591d500c724635df272274123bad2d 100644+index f1265fad74189591b5aae86cf2e3a31f9c0fdb02..59e218cb79f56c34995fb86c5de5a71ff8ce9f4d 100644--- a/reanimated.js+++ b/reanimated.js-@@ -116,7 +116,7 @@ var ReanimatedPositionView = typedMemo(function ReanimatedPositionViewComponent(+@@ -115,8 +115,10 @@ var ReanimatedPositionView = typedMemo(function ReanimatedPositionViewComponent(+ const { id, horizontal, style, refView, children, recycleItems, layoutTransition, ...rest } = props;const [positionValue = POSITION_OUT_OF_VIEW] = useArr$([`containerPosition${id}`]);const prevItemKeyRef = React__namespace.useRef(void 0);++ const previousPositionRef = React__namespace.useRef(positionValue);++ const lastContentSizeEpochRef = React__namespace.useRef(ctx.state.contentSizeAnimationEpoch || 0);let shouldSkipTransitionForRecycleReuse = false;- if (recycleItems && layoutTransition) {+ if (layoutTransition) {const itemKeySignal = `containerItemKey${id}`;const itemKey = peek$(ctx, itemKeySignal);shouldSkipTransitionForRecycleReuse = itemKey !== void 0 && prevItemKeyRef.current !== void 0 && prevItemKeyRef.current !== itemKey;-@@ -130,10 +130,20 @@ var ReanimatedPositionView = typedMemo(function ReanimatedPositionViewComponent(+@@ -130,10 +132,29 @@ var ReanimatedPositionView = typedMemo(function ReanimatedPositionViewComponent(() => [style, horizontal ? { left: positionValue } : { top: positionValue }],[horizontal, positionValue, style]);@@ -1035,30 +1385,168 @@ index f1265fad74189591b5aae86cf2e3a31f9c0fdb02..16dcef04a6591d500c724635df272274+ // transition exists to smooth at-rest shifts (streaming text, work-log+ // folds), so gate it to at-rest moments.+ const now = Date.now();-+ const isMVCPReposition = now - (ctx.state.lastMVCPAdjustTime || 0) < 300 ||-+ now - (ctx.state.lastNativeScrollTime || 0) < 300;++ const contentSizeEpoch = ctx.state.contentSizeAnimationEpoch || 0;++ const didPositionChange = positionValue !== previousPositionRef.current;++ const isRawSizeReposition = didPositionChange && contentSizeEpoch !== lastContentSizeEpochRef.current && ctx.state.contentSizeAnimationEligible && !!layoutTransition && typeof layoutTransition.getAnimationAndConfig === "function";++ React__namespace.useLayoutEffect(() => {++ if (didPositionChange) {++ previousPositionRef.current = positionValue;++ lastContentSizeEpochRef.current = contentSizeEpoch;++ }++ }, [contentSizeEpoch, didPositionChange, positionValue]);++ const isRecentNativeReposition = now - (ctx.state.lastNativeScrollTime || 0) < 300;++ const shouldSkipLayoutTransition = now - (ctx.state.lastMVCPAdjustTime || 0) < 300 || ctx.state.isUserDragging || ctx.state.isMomentumScrolling || isRecentNativeReposition && !isRawSizeReposition;return /* @__PURE__ */ React__namespace.createElement(Reanimated__default.default.View,{- layout: shouldSkipTransitionForRecycleReuse ? void 0 : layoutTransition,-+ layout: shouldSkipTransitionForRecycleReuse || isMVCPReposition ? void 0 : layoutTransition,++ layout: shouldSkipTransitionForRecycleReuse || shouldSkipLayoutTransition ? void 0 : layoutTransition,ref: refView,style: viewStyle,...rest+@@ -141,6 +162,96 @@ var ReanimatedPositionView = typedMemo(function ReanimatedPositionViewComponent(+ children+ );+ });++var ReanimatedSizeView = typedMemo(function ReanimatedSizeViewComponent(props) {++ const ctx = useStateContext();++ const { horizontal, signalName, style, children, ...rest } = props;++ const [logicalSize = 0] = useArr$(signalName === "totalSize" ? [signalName] : [signalName, "totalSize"]);++ const baseSize = Reanimated.useSharedValue(logicalSize);++ const animatedDelta = Reanimated.useSharedValue(0);++ const previousLogicalSizeRef = React__namespace.useRef(logicalSize);++ const previousEpochRef = React__namespace.useRef(ctx.state.contentSizeAnimationEpoch || 0);++ const animationRunRef = React__namespace.useRef(0);++ const isAnimatingRef = React__namespace.useRef(false);++ const [isAnimating, setIsAnimating] = React__namespace.useState(false);++ const transition = props.layoutTransition;++ const canAnimate = !!transition && typeof transition.getAnimationAndConfig === "function";++ const renderEpoch = ctx.state.contentSizeAnimationEpoch || 0;++ const startsEligibleAnimation = canAnimate && logicalSize !== previousLogicalSizeRef.current && renderEpoch !== previousEpochRef.current && ctx.state.contentSizeAnimationEligible;++ const useAnimatedAxis = isAnimating || startsEligibleAnimation;++ const animatedStyle = Reanimated.useAnimatedStyle(() => {++ const size = Math.max(0, baseSize.value + animatedDelta.value);++ return horizontal ? { width: size } : { height: size };++ }, [horizontal]);++ const completeAnimation = React__namespace.useCallback((run, epoch) => {++ if (animationRunRef.current !== run) {++ return;++ }++ isAnimatingRef.current = false;++ setIsAnimating(false);++ const state = ctx.state;++ if (state.contentSizeAnimationActiveEpoch !== epoch) {++ return;++ }++ state.contentSizeAnimationActiveSignals.delete(signalName);++ if (state.contentSizeAnimationActiveSignals.size === 0) {++ state.contentSizeAnimationActiveEpoch = void 0;++ state.contentSizeAnimationEligible = false;++ }++ }, [ctx.state, signalName]);++ React__namespace.useLayoutEffect(() => {++ const state = ctx.state;++ const epoch = state.contentSizeAnimationEpoch || 0;++ const previousLogicalSize = previousLogicalSizeRef.current;++ const delta = logicalSize - previousLogicalSize;++ const isNewEpoch = epoch !== previousEpochRef.current;++ const isNewEligibleEpoch = canAnimate && isNewEpoch && state.contentSizeAnimationEligible;++ previousLogicalSizeRef.current = logicalSize;++ previousEpochRef.current = epoch;++ if (!delta) {++ return;++ }++ if (!isNewEligibleEpoch) {++ baseSize.value = logicalSize;++ if (signalName === "totalSize" && isNewEpoch && state.contentSizeAnimationEligible && !canAnimate) {++ state.contentSizeAnimationEligible = false;++ }++ return;++ }++ const [animation, config] = transition.getAnimationAndConfig();++ const delayFunction = typeof transition.getDelayFunction === "function" ? transition.getDelayFunction() : (_, value) => value;++ const delay = typeof transition.getDelay === "function" ? transition.getDelay() : 0;++ if (typeof animation !== "function" || typeof delayFunction !== "function") {++ baseSize.value = logicalSize;++ if (signalName === "totalSize") {++ state.contentSizeAnimationEligible = false;++ }++ return;++ }++ if (state.contentSizeAnimationActiveEpoch !== epoch) {++ state.contentSizeAnimationActiveEpoch = epoch;++ state.contentSizeAnimationActiveSignals = /* @__PURE__ */ new Set();++ }++ state.contentSizeAnimationActiveSignals.add(signalName);++ const wasAnimating = isAnimatingRef.current;++ isAnimatingRef.current = true;++ setIsAnimating(true);++ const run = ++animationRunRef.current;++ Reanimated.runOnUI((absoluteSize, previousSize, continuesAnimation, animationRun, animationEpoch) => {++ "worklet";++ const currentVisualSize = continuesAnimation ? baseSize.value + animatedDelta.value : previousSize;++ baseSize.value = absoluteSize;++ animatedDelta.value = currentVisualSize - absoluteSize;++ animatedDelta.value = delayFunction(delay, animation(0, config, (finished) => {++ "worklet";++ if (finished) {++ Reanimated.runOnJS(completeAnimation)(animationRun, animationEpoch);++ }++ }));++ })(logicalSize, previousLogicalSize, wasAnimating, run, epoch);++ }, [baseSize, animatedDelta, canAnimate, completeAnimation, ctx.state, logicalSize, renderEpoch, signalName, transition]);++ const sizeStyle = useAnimatedAxis ? animatedStyle : horizontal ? { width: logicalSize } : { height: logicalSize };++ return /* @__PURE__ */ React__namespace.createElement(Reanimated__default.default.View, { ...rest, style: [style, sizeStyle] }, children);++});+ function setSharedValueValue(sharedValue, value) {+ if (!sharedValue) {+ return;+@@ -245,10 +356,19 @@ var LegendListForwardedRef = typedMemo(+ );+ };+ }, [hasItemLayoutAnimation, recycleItems]);++ const sizeComponentInternal = React__namespace.useMemo(() => {++ if (!hasItemLayoutAnimation) {++ return void 0;++ }++ return function SizeComponent(sizeProps) {++ return /* @__PURE__ */ React__namespace.createElement(ReanimatedSizeView, { ...sizeProps, layoutTransition: itemLayoutAnimationRef.current });++ };++ }, [hasItemLayoutAnimation]);+ const legendListProps = {+ ...rest,+ positionComponentInternal,+ recycleItems,++ sizeComponentInternal,+ ...{+ renderScrollComponent: renderReanimatedScrollComponent,+ ...IsNewArchitecture ? { stickyPositionComponentInternal } : {}diff --git a/reanimated.mjs b/reanimated.mjs-index 29a00d5dc084fd408a0e0a0a4d64e856d0ed1525..9c25ec5dd79fb137c073adc24643ad8a2996bf56 100644+index 29a00d5dc084fd408a0e0a0a4d64e856d0ed1525..bd3c680eb4abeca786d538ebf7b23a5725398942 100644--- a/reanimated.mjs+++ b/reanimated.mjs-@@ -92,7 +92,7 @@ var ReanimatedPositionView = typedMemo(function ReanimatedPositionViewComponent(+@@ -1,7 +1,7 @@+ import * as React from 'react';+ import { useCallback } from 'react';+ import { View } from 'react-native';+-import Reanimated, { useAnimatedRef, useAnimatedStyle, useSharedValue, useScrollViewOffset } from 'react-native-reanimated';++import Reanimated, { runOnJS, runOnUI, useAnimatedRef, useAnimatedStyle, useSharedValue, useScrollViewOffset } from 'react-native-reanimated';+ import { internal, LegendList } from '@legendapp/list/react-native';++ // src/integrations/reanimated.tsx+@@ -91,8 +91,10 @@ var ReanimatedPositionView = typedMemo(function ReanimatedPositionViewComponent(+ const { id, horizontal, style, refView, children, recycleItems, layoutTransition, ...rest } = props;const [positionValue = POSITION_OUT_OF_VIEW] = useArr$([`containerPosition${id}`]);const prevItemKeyRef = React.useRef(void 0);++ const previousPositionRef = React.useRef(positionValue);++ const lastContentSizeEpochRef = React.useRef(ctx.state.contentSizeAnimationEpoch || 0);let shouldSkipTransitionForRecycleReuse = false;- if (recycleItems && layoutTransition) {+ if (layoutTransition) {const itemKeySignal = `containerItemKey${id}`;const itemKey = peek$(ctx, itemKeySignal);shouldSkipTransitionForRecycleReuse = itemKey !== void 0 && prevItemKeyRef.current !== void 0 && prevItemKeyRef.current !== itemKey;-@@ -106,10 +106,20 @@ var ReanimatedPositionView = typedMemo(function ReanimatedPositionViewComponent(+@@ -106,10 +108,29 @@ var ReanimatedPositionView = typedMemo(function ReanimatedPositionViewComponent(() => [style, horizontal ? { left: positionValue } : { top: positionValue }],[horizontal, positionValue, style]);@@ -1070,13 +1558,139 @@ index 29a00d5dc084fd408a0e0a0a4d64e856d0ed1525..9c25ec5dd79fb137c073adc24643ad8a+ // transition exists to smooth at-rest shifts (streaming text, work-log+ // folds), so gate it to at-rest moments.+ const now = Date.now();-+ const isMVCPReposition = now - (ctx.state.lastMVCPAdjustTime || 0) < 300 ||-+ now - (ctx.state.lastNativeScrollTime || 0) < 300;++ const contentSizeEpoch = ctx.state.contentSizeAnimationEpoch || 0;++ const didPositionChange = positionValue !== previousPositionRef.current;++ const isRawSizeReposition = didPositionChange && contentSizeEpoch !== lastContentSizeEpochRef.current && ctx.state.contentSizeAnimationEligible && !!layoutTransition && typeof layoutTransition.getAnimationAndConfig === "function";++ React.useLayoutEffect(() => {++ if (didPositionChange) {++ previousPositionRef.current = positionValue;++ lastContentSizeEpochRef.current = contentSizeEpoch;++ }++ }, [contentSizeEpoch, didPositionChange, positionValue]);++ const isRecentNativeReposition = now - (ctx.state.lastNativeScrollTime || 0) < 300;++ const shouldSkipLayoutTransition = now - (ctx.state.lastMVCPAdjustTime || 0) < 300 || ctx.state.isUserDragging || ctx.state.isMomentumScrolling || isRecentNativeReposition && !isRawSizeReposition;return /* @__PURE__ */ React.createElement(Reanimated.View,{- layout: shouldSkipTransitionForRecycleReuse ? void 0 : layoutTransition,-+ layout: shouldSkipTransitionForRecycleReuse || isMVCPReposition ? void 0 : layoutTransition,++ layout: shouldSkipTransitionForRecycleReuse || shouldSkipLayoutTransition ? void 0 : layoutTransition,ref: refView,style: viewStyle,...rest+@@ -117,6 +138,96 @@ var ReanimatedPositionView = typedMemo(function ReanimatedPositionViewComponent(+ children+ );+ });++var ReanimatedSizeView = typedMemo(function ReanimatedSizeViewComponent(props) {++ const ctx = useStateContext();++ const { horizontal, signalName, style, children, ...rest } = props;++ const [logicalSize = 0] = useArr$(signalName === "totalSize" ? [signalName] : [signalName, "totalSize"]);++ const baseSize = useSharedValue(logicalSize);++ const animatedDelta = useSharedValue(0);++ const previousLogicalSizeRef = React.useRef(logicalSize);++ const previousEpochRef = React.useRef(ctx.state.contentSizeAnimationEpoch || 0);++ const animationRunRef = React.useRef(0);++ const isAnimatingRef = React.useRef(false);++ const [isAnimating, setIsAnimating] = React.useState(false);++ const transition = props.layoutTransition;++ const canAnimate = !!transition && typeof transition.getAnimationAndConfig === "function";++ const renderEpoch = ctx.state.contentSizeAnimationEpoch || 0;++ const startsEligibleAnimation = canAnimate && logicalSize !== previousLogicalSizeRef.current && renderEpoch !== previousEpochRef.current && ctx.state.contentSizeAnimationEligible;++ const useAnimatedAxis = isAnimating || startsEligibleAnimation;++ const animatedStyle = useAnimatedStyle(() => {++ const size = Math.max(0, baseSize.value + animatedDelta.value);++ return horizontal ? { width: size } : { height: size };++ }, [horizontal]);++ const completeAnimation = useCallback((run, epoch) => {++ if (animationRunRef.current !== run) {++ return;++ }++ isAnimatingRef.current = false;++ setIsAnimating(false);++ const state = ctx.state;++ if (state.contentSizeAnimationActiveEpoch !== epoch) {++ return;++ }++ state.contentSizeAnimationActiveSignals.delete(signalName);++ if (state.contentSizeAnimationActiveSignals.size === 0) {++ state.contentSizeAnimationActiveEpoch = void 0;++ state.contentSizeAnimationEligible = false;++ }++ }, [ctx.state, signalName]);++ React.useLayoutEffect(() => {++ const state = ctx.state;++ const epoch = state.contentSizeAnimationEpoch || 0;++ const previousLogicalSize = previousLogicalSizeRef.current;++ const delta = logicalSize - previousLogicalSize;++ const isNewEpoch = epoch !== previousEpochRef.current;++ const isNewEligibleEpoch = canAnimate && isNewEpoch && state.contentSizeAnimationEligible;++ previousLogicalSizeRef.current = logicalSize;++ previousEpochRef.current = epoch;++ if (!delta) {++ return;++ }++ if (!isNewEligibleEpoch) {++ baseSize.value = logicalSize;++ if (signalName === "totalSize" && isNewEpoch && state.contentSizeAnimationEligible && !canAnimate) {++ state.contentSizeAnimationEligible = false;++ }++ return;++ }++ const [animation, config] = transition.getAnimationAndConfig();++ const delayFunction = typeof transition.getDelayFunction === "function" ? transition.getDelayFunction() : (_, value) => value;++ const delay = typeof transition.getDelay === "function" ? transition.getDelay() : 0;++ if (typeof animation !== "function" || typeof delayFunction !== "function") {++ baseSize.value = logicalSize;++ if (signalName === "totalSize") {++ state.contentSizeAnimationEligible = false;++ }++ return;++ }++ if (state.contentSizeAnimationActiveEpoch !== epoch) {++ state.contentSizeAnimationActiveEpoch = epoch;++ state.contentSizeAnimationActiveSignals = /* @__PURE__ */ new Set();++ }++ state.contentSizeAnimationActiveSignals.add(signalName);++ const wasAnimating = isAnimatingRef.current;++ isAnimatingRef.current = true;++ setIsAnimating(true);++ const run = ++animationRunRef.current;++ runOnUI((absoluteSize, previousSize, continuesAnimation, animationRun, animationEpoch) => {++ "worklet";++ const currentVisualSize = continuesAnimation ? baseSize.value + animatedDelta.value : previousSize;++ baseSize.value = absoluteSize;++ animatedDelta.value = currentVisualSize - absoluteSize;++ animatedDelta.value = delayFunction(delay, animation(0, config, (finished) => {++ "worklet";++ if (finished) {++ runOnJS(completeAnimation)(animationRun, animationEpoch);++ }++ }));++ })(logicalSize, previousLogicalSize, wasAnimating, run, epoch);++ }, [baseSize, animatedDelta, canAnimate, completeAnimation, ctx.state, logicalSize, renderEpoch, signalName, transition]);++ const sizeStyle = useAnimatedAxis ? animatedStyle : horizontal ? { width: logicalSize } : { height: logicalSize };++ return /* @__PURE__ */ React.createElement(Reanimated.View, { ...rest, style: [style, sizeStyle] }, children);++});+ function setSharedValueValue(sharedValue, value) {+ if (!sharedValue) {+ return;+@@ -221,10 +332,19 @@ var LegendListForwardedRef = typedMemo(+ );+ };+ }, [hasItemLayoutAnimation, recycleItems]);++ const sizeComponentInternal = React.useMemo(() => {++ if (!hasItemLayoutAnimation) {++ return void 0;++ }++ return function SizeComponent(sizeProps) {++ return /* @__PURE__ */ React.createElement(ReanimatedSizeView, { ...sizeProps, layoutTransition: itemLayoutAnimationRef.current });++ };++ }, [hasItemLayoutAnimation]);+ const legendListProps = {+ ...rest,+ positionComponentInternal,+ recycleItems,++ sizeComponentInternal,+ ...{+ renderScrollComponent: renderReanimatedScrollComponent,+ ...IsNewArchitecture ? { stickyPositionComponentInternal } : {}diff --git a/patches/[email protected] b/patches/[email protected]index 3dee935cda3..f2e510a940b 100644--- a/patches/[email protected]+++ b/patches/[email protected]@@ -1,12 +1,13 @@diff --git a/lib/commonjs/components/KeyboardChatScrollView/index.js b/lib/commonjs/components/KeyboardChatScrollView/index.js-index db8cfb1d289f91563f13c4dd842c783c99facc32..940e1dd80c6c9dfc42eab916445be414372ce52e 100644+index db8cfb1d289f91563f13c4dd842c783c99facc32..64c7e38ad8d9e866b15a53e561509e6b0ad33cb9 100644--- a/lib/commonjs/components/KeyboardChatScrollView/index.js+++ b/lib/commonjs/components/KeyboardChatScrollView/index.js-@@ -26,9 +26,11 @@ const KeyboardChatScrollView = /*#__PURE__*/(0, _react.forwardRef)(({+@@ -26,9 +26,12 @@ const KeyboardChatScrollView = /*#__PURE__*/(0, _react.forwardRef)(({offset = 0,extraContentPadding = ZERO_CONTENT_PADDING,blankSpace = ZERO_BLANK_SPACE,+ adjustedInsetCompensation = 0,++ adjustedStartInsetCompensation = 0,applyWorkaroundForContentInsetHitTestBug = false,onLayout: onLayoutProp,onContentSizeChange: onContentSizeChangeProp,@@ -14,13 +15,14 @@ index db8cfb1d289f91563f13c4dd842c783c99facc32..940e1dd80c6c9dfc42eab916445be414onEndVisible,...rest}, ref) => {-@@ -50,13 +52,15 @@ const KeyboardChatScrollView = /*#__PURE__*/(0, _react.forwardRef)(({+@@ -50,13 +53,17 @@ const KeyboardChatScrollView = /*#__PURE__*/(0, _react.forwardRef)(({freeze: freezeSV,offset,blankSpace,- extraContentPadding+ extraContentPadding,-+ adjustedInsetCompensation++ adjustedInsetCompensation,++ adjustedStartInsetCompensation});(0, _useExtraContentPadding.useExtraContentPadding)({scrollViewRef,@@ -28,17 +30,23 @@ index db8cfb1d289f91563f13c4dd842c783c99facc32..940e1dd80c6c9dfc42eab916445be414keyboardPadding: padding,blankSpace,+ adjustedInsetCompensation,++ adjustedStartInsetCompensation,scroll,layout,size,-@@ -82,10 +86,21 @@ const KeyboardChatScrollView = /*#__PURE__*/(0, _react.forwardRef)(({+@@ -82,10 +89,26 @@ const KeyboardChatScrollView = /*#__PURE__*/(0, _react.forwardRef)(({// a bug for you, please open an issue.const totalPadding = (0, _reactNativeReanimated.useDerivedValue)(() => Math.min(layout.value.height, Math.max(blankSpace.value, padding.value + extraContentPadding.value)));++ // iOS applies the destination contentInset and contentOffset together at++ // keyboard-animation start. Keep that native target behavior, but report++ // the presentation height so virtualized-list layout follows the keyboard.++ const reportedPadding = (0, _reactNativeReanimated.useDerivedValue)(() => _reactNative.Platform.OS === "ios" ? Math.min(layout.value.height, Math.max(blankSpace.value, currentHeight.value + extraContentPadding.value)) : totalPadding.value);+++ // Mirror the effective bottom padding (keyboard + composer + blank floor)+ // to the consumer - a virtualized list needs it in its own scroll math or+ // its end/maintain targets point at the under-the-keyboard resting offset.-+ (0, _reactNativeReanimated.useAnimatedReaction)(() => totalPadding.value, (current, previous) => {++ (0, _reactNativeReanimated.useAnimatedReaction)(() => reportedPadding.value, (current, previous) => {+ if (onContentInsetChange && current !== previous) {+ (0, _reactNativeReanimated.runOnJS)(onContentInsetChange)({+ bottom: current@@ -54,21 +62,57 @@ index db8cfb1d289f91563f13c4dd842c783c99facc32..940e1dd80c6c9dfc42eab916445be414const onLayout = (0, _react.useCallback)(e => {onLayoutInternal(e);onLayoutProp === null || onLayoutProp === void 0 || onLayoutProp(e);+diff --git a/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js b/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js+index 4d33b3fe426070cf312fc493ce902b2c24d853ea..e619708b95865afd8b43dd8f0a6523fcf67b1f53 100644+--- a/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js++++ b/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/helpers.js+@@ -206,7 +206,7 @@ const clampedScrollTarget = (offsetBeforeScroll, keyboardHeight, contentHeight,+ * ```+ */+ exports.clampedScrollTarget = clampedScrollTarget;+-const computeIOSContentOffset = (relativeScroll, keyboardHeight, contentHeight, layoutHeight, inverted, totalPaddingForMaxScroll) => {++const computeIOSContentOffset = (relativeScroll, keyboardHeight, contentHeight, layoutHeight, inverted, totalPaddingForMaxScroll, startInsetCompensation = 0) => {+ "worklet";++ const paddingForMax = totalPaddingForMaxScroll !== undefined ? totalPaddingForMaxScroll : keyboardHeight;+@@ -214,8 +214,9 @@ const computeIOSContentOffset = (relativeScroll, keyboardHeight, contentHeight,+ const maxScroll = Math.max(contentHeight - layoutHeight, 0);+ return Math.max(Math.min(relativeScroll - keyboardHeight, maxScroll), -paddingForMax);+ }+- const maxScroll = Math.max(contentHeight - layoutHeight + paddingForMax, 0);+- return Math.min(Math.max(keyboardHeight + relativeScroll, 0), maxScroll);++ const minScroll = -startInsetCompensation;++ const maxScroll = Math.max(contentHeight - layoutHeight + paddingForMax, minScroll);++ return Math.min(Math.max(keyboardHeight + relativeScroll, minScroll), maxScroll);+ };+ exports.computeIOSContentOffset = computeIOSContentOffset;+ //# sourceMappingURL=helpers.js.mapdiff --git a/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js b/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js-index 2073da84b8b2be291aa3181700c2b18a75d0fc56..f43f2efdc4f0eda0460720839544dc6e7f4a54e0 100644+index 2073da84b8b2be291aa3181700c2b18a75d0fc56..7ae9bb220ce3cc23c788a79677afdc7d9547a27c 100644--- a/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js+++ b/lib/commonjs/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js-@@ -32,7 +32,8 @@ function useChatKeyboard(scrollViewRef, options) {+@@ -32,7 +32,9 @@ function useChatKeyboard(scrollViewRef, options) {freeze,offset,blankSpace,- extraContentPadding+ extraContentPadding,-+ adjustedInsetCompensation++ adjustedInsetCompensation,++ adjustedStartInsetCompensation} = options;const padding = (0, _reactNativeReanimated.useSharedValue)(0);const currentHeight = (0, _reactNativeReanimated.useSharedValue)(0);-@@ -66,7 +67,7 @@ function useChatKeyboard(scrollViewRef, options) {+@@ -58,6 +60,9 @@ function useChatKeyboard(scrollViewRef, options) {+ targetKeyboardHeight.value = e.height;+ }+ const effective = (0, _helpers.getEffectiveHeight)(e.height, targetKeyboardHeight.value, offset);++ if (e.duration === 0) {++ currentHeight.value = effective;++ }+ const atEnd = (0, _helpers.isScrollAtEnd)(scroll.value, layout.value.height, size.value.height, inverted);++ // Scale minimum padding absorption by how much of it is visible.+@@ -66,7 +71,7 @@ function useChatKeyboard(scrollViewRef, options) {const visiblePadding = visibleFraction * blankSpace.value;const minimumPaddingAbsorbed = Math.max(0, visiblePadding - extraContentPadding.value);const scrollEffective = (0, _helpers.getScrollEffective)(effective, minimumPaddingAbsorbed);@@ -77,28 +121,81 @@ index 2073da84b8b2be291aa3181700c2b18a75d0fc56..f43f2efdc4f0eda0460720839544dc6e// persistent mode: when keyboard shrinks, clamp to valid rangeif (keyboardLiftBehavior === "persistent" && effective < padding.value) {-@@ -134,7 +135,7 @@ function useChatKeyboard(scrollViewRef, options) {+@@ -76,8 +81,8 @@ function useChatKeyboard(scrollViewRef, options) {+ const maxScroll = Math.max(size.value.height - layout.value.height, 0);+ contentOffsetY.value = Math.max(-actualTotalPadding, Math.min(scroll.value, maxScroll));+ } else {+- const maxScroll = Math.max(size.value.height - layout.value.height + actualTotalPadding, 0);+- contentOffsetY.value = Math.max(0, Math.min(scroll.value, maxScroll));++ const maxScroll = Math.max(size.value.height - layout.value.height + actualTotalPadding, -adjustedStartInsetCompensation);++ contentOffsetY.value = Math.max(-adjustedStartInsetCompensation, Math.min(scroll.value, maxScroll));+ }+ return;+ }+@@ -91,8 +96,8 @@ function useChatKeyboard(scrollViewRef, options) {+ const maxScroll = Math.max(size.value.height - layout.value.height, 0);+ contentOffsetY.value = Math.max(-actualTotalPadding, Math.min(scroll.value, maxScroll));+ } else {+- const maxScroll = Math.max(size.value.height - layout.value.height + actualTotalPadding, 0);+- contentOffsetY.value = Math.max(0, Math.min(scroll.value, maxScroll));++ const maxScroll = Math.max(size.value.height - layout.value.height + actualTotalPadding, -adjustedStartInsetCompensation);++ contentOffsetY.value = Math.max(-adjustedStartInsetCompensation, Math.min(scroll.value, maxScroll));+ }+ return;+ }+@@ -118,12 +123,23 @@ function useChatKeyboard(scrollViewRef, options) {+ contentOffsetY.value = scroll.value;+ return;+ }+- contentOffsetY.value = (0, _helpers.computeIOSContentOffset)(relativeScroll, scrollEffective, size.value.height, layout.value.height, inverted, actualTotalPadding);++ contentOffsetY.value = (0, _helpers.computeIOSContentOffset)(relativeScroll, scrollEffective, size.value.height, layout.value.height, inverted, actualTotalPadding, adjustedStartInsetCompensation);++ },++ onMove: e => {++ "worklet";++++ if (freeze.value) {++ return;++ }++ currentHeight.value = (0, _helpers.getEffectiveHeight)(e.height, targetKeyboardHeight.value, offset);+ },+- onMove: () => {++ onInteractive: e => {+ "worklet";++- // iOS doesn't need per-frame updates (contentOffset handles it)++ if (freeze.value) {++ return;++ }++ currentHeight.value = (0, _helpers.getEffectiveHeight)(e.height, targetKeyboardHeight.value, offset);+ },+ onEnd: e => {+ "worklet";+@@ -132,9 +148,10 @@ function useChatKeyboard(scrollViewRef, options) {+ return;+ }const effective = (0, _helpers.getEffectiveHeight)(e.height, targetKeyboardHeight.value, offset);++ currentHeight.value = effective;padding.value = effective;}- }, [inverted, keyboardLiftBehavior, offset, extraContentPadding]);-+ }, [inverted, keyboardLiftBehavior, offset, extraContentPadding, adjustedInsetCompensation]);++ }, [inverted, keyboardLiftBehavior, offset, extraContentPadding, adjustedInsetCompensation, adjustedStartInsetCompensation]);return {padding,currentHeight,diff --git a/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js b/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js-index 0d50bdfeb7bbc5c14a31ed344f8a690e4fd340b3..22ca193257ab0068f732c088b09145dabf39a05e 100644+index 0d50bdfeb7bbc5c14a31ed344f8a690e4fd340b3..e0b73653fd1dd23f0f2e2c85835a3d107e3f666d 100644--- a/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js+++ b/lib/commonjs/components/KeyboardChatScrollView/useExtraContentPadding/index.js-@@ -29,6 +29,7 @@ function useExtraContentPadding(options) {+@@ -29,6 +29,8 @@ function useExtraContentPadding(options) {extraContentPadding,keyboardPadding,blankSpace,+ adjustedInsetCompensation,++ adjustedStartInsetCompensation,scroll,layout,size,-@@ -68,8 +69,8 @@ function useExtraContentPadding(options) {+@@ -68,8 +70,8 @@ function useExtraContentPadding(options) {}// Compute effective delta considering blankSpace floor@@ -109,33 +206,41 @@ index 0d50bdfeb7bbc5c14a31ed344f8a690e4fd340b3..22ca193257ab0068f732c088b09145daconst effectiveDelta = currentTotal - previousTotal;if (effectiveDelta === 0) {// blankSpace absorbed the change-@@ -92,6 +93,6 @@ function useExtraContentPadding(options) {- const target = Math.min(scroll.value + effectiveDelta, maxScroll);+@@ -88,10 +90,11 @@ function useExtraContentPadding(options) {+ const target = Math.max(scroll.value - effectiveDelta, -currentTotal);+ scrollToTarget(target);+ } else {+- const maxScroll = Math.max(size.value.height - layout.value.height + currentTotal, 0);+- const target = Math.min(scroll.value + effectiveDelta, maxScroll);++ const minScroll = -adjustedStartInsetCompensation;++ const maxScroll = Math.max(size.value.height - layout.value.height + currentTotal, minScroll);++ const target = Math.max(minScroll, Math.min(scroll.value + effectiveDelta, maxScroll));scrollToTarget(target);}- }, [inverted, keyboardLiftBehavior]);-+ }, [inverted, keyboardLiftBehavior, adjustedInsetCompensation]);++ }, [inverted, keyboardLiftBehavior, adjustedInsetCompensation, adjustedStartInsetCompensation]);}//# sourceMappingURL=index.js.map-\ No newline at end of filediff --git a/lib/module/components/KeyboardChatScrollView/index.js b/lib/module/components/KeyboardChatScrollView/index.js-index 612dd8bd9bd6cc3e30a5acac937ea3383eb1b630..ac79433fdf0b36f89525b9840447a116da63d58c 100644+index 612dd8bd9bd6cc3e30a5acac937ea3383eb1b630..76b858a6590ad0592cc663864ea822db55eaeceb 100644--- a/lib/module/components/KeyboardChatScrollView/index.js+++ b/lib/module/components/KeyboardChatScrollView/index.js@@ -1,7 +1,7 @@function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }import React, { forwardRef, useCallback, useMemo } from "react";- import { StyleSheet } from "react-native";+-import { StyleSheet } from "react-native";-import { makeMutable, useAnimatedRef, useAnimatedStyle, useDerivedValue } from "react-native-reanimated";++import { Platform, StyleSheet } from "react-native";+import { makeMutable, runOnJS, useAnimatedReaction, useAnimatedRef, useAnimatedStyle, useDerivedValue } from "react-native-reanimated";import Reanimated from "react-native-reanimated";import useCombinedRef from "../hooks/useCombinedRef";import ScrollViewWithBottomPadding from "../ScrollViewWithBottomPadding";-@@ -19,9 +19,11 @@ const KeyboardChatScrollView = /*#__PURE__*/forwardRef(({+@@ -19,9 +19,12 @@ const KeyboardChatScrollView = /*#__PURE__*/forwardRef(({offset = 0,extraContentPadding = ZERO_CONTENT_PADDING,blankSpace = ZERO_BLANK_SPACE,+ adjustedInsetCompensation = 0,++ adjustedStartInsetCompensation = 0,applyWorkaroundForContentInsetHitTestBug = false,onLayout: onLayoutProp,onContentSizeChange: onContentSizeChangeProp,@@ -143,13 +248,14 @@ index 612dd8bd9bd6cc3e30a5acac937ea3383eb1b630..ac79433fdf0b36f89525b9840447a116onEndVisible,...rest}, ref) => {-@@ -43,13 +45,15 @@ const KeyboardChatScrollView = /*#__PURE__*/forwardRef(({+@@ -43,13 +46,17 @@ const KeyboardChatScrollView = /*#__PURE__*/forwardRef(({freeze: freezeSV,offset,blankSpace,- extraContentPadding+ extraContentPadding,-+ adjustedInsetCompensation++ adjustedInsetCompensation,++ adjustedStartInsetCompensation});useExtraContentPadding({scrollViewRef,@@ -157,17 +263,23 @@ index 612dd8bd9bd6cc3e30a5acac937ea3383eb1b630..ac79433fdf0b36f89525b9840447a116keyboardPadding: padding,blankSpace,+ adjustedInsetCompensation,++ adjustedStartInsetCompensation,scroll,layout,size,-@@ -75,10 +79,21 @@ const KeyboardChatScrollView = /*#__PURE__*/forwardRef(({+@@ -75,10 +82,26 @@ const KeyboardChatScrollView = /*#__PURE__*/forwardRef(({// a bug for you, please open an issue.const totalPadding = useDerivedValue(() => Math.min(layout.value.height, Math.max(blankSpace.value, padding.value + extraContentPadding.value)));++ // iOS applies the destination contentInset and contentOffset together at++ // keyboard-animation start. Keep that native target behavior, but report++ // the presentation height so virtualized-list layout follows the keyboard.++ const reportedPadding = useDerivedValue(() => Platform.OS === "ios" ? Math.min(layout.value.height, Math.max(blankSpace.value, currentHeight.value + extraContentPadding.value)) : totalPadding.value);+++ // Mirror the effective bottom padding (keyboard + composer + blank floor)+ // to the consumer - a virtualized list needs it in its own scroll math or+ // its end/maintain targets point at the under-the-keyboard resting offset.-+ useAnimatedReaction(() => totalPadding.value, (current, previous) => {++ useAnimatedReaction(() => reportedPadding.value, (current, previous) => {+ if (onContentInsetChange && current !== previous) {+ runOnJS(onContentInsetChange)({+ bottom: current@@ -183,21 +295,56 @@ index 612dd8bd9bd6cc3e30a5acac937ea3383eb1b630..ac79433fdf0b36f89525b9840447a116const onLayout = useCallback(e => {onLayoutInternal(e);onLayoutProp === null || onLayoutProp === void 0 || onLayoutProp(e);+diff --git a/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js b/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js+index 295e2219b560519b8d033968b5105d1da3e77315..ff7ee3fe0d880c2287a7b70d5ecf952e99357adf 100644+--- a/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js++++ b/lib/module/components/KeyboardChatScrollView/useChatKeyboard/helpers.js+@@ -193,7 +193,7 @@ export const clampedScrollTarget = (offsetBeforeScroll, keyboardHeight, contentH+ * computeIOSContentOffset(100, 300, 1000, 800, false); // 400+ * ```+ */+-export const computeIOSContentOffset = (relativeScroll, keyboardHeight, contentHeight, layoutHeight, inverted, totalPaddingForMaxScroll) => {++export const computeIOSContentOffset = (relativeScroll, keyboardHeight, contentHeight, layoutHeight, inverted, totalPaddingForMaxScroll, startInsetCompensation = 0) => {+ "worklet";++ const paddingForMax = totalPaddingForMaxScroll !== undefined ? totalPaddingForMaxScroll : keyboardHeight;+@@ -201,7 +201,8 @@ export const computeIOSContentOffset = (relativeScroll, keyboardHeight, contentH+ const maxScroll = Math.max(contentHeight - layoutHeight, 0);+ return Math.max(Math.min(relativeScroll - keyboardHeight, maxScroll), -paddingForMax);+ }+- const maxScroll = Math.max(contentHeight - layoutHeight + paddingForMax, 0);+- return Math.min(Math.max(keyboardHeight + relativeScroll, 0), maxScroll);++ const minScroll = -startInsetCompensation;++ const maxScroll = Math.max(contentHeight - layoutHeight + paddingForMax, minScroll);++ return Math.min(Math.max(keyboardHeight + relativeScroll, minScroll), maxScroll);+ };+ //# sourceMappingURL=helpers.js.mapdiff --git a/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js b/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js-index 52943c3a7d6a68fe2094dc1d112c07e6b9d890e4..c8685c18a53ad078c24fc3e3b6572669b2b63397 100644+index 52943c3a7d6a68fe2094dc1d112c07e6b9d890e4..cc4bfae859191aeb848179028b7217098cba2340 100644--- a/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js+++ b/lib/module/components/KeyboardChatScrollView/useChatKeyboard/index.ios.js-@@ -25,7 +25,8 @@ function useChatKeyboard(scrollViewRef, options) {+@@ -25,7 +25,9 @@ function useChatKeyboard(scrollViewRef, options) {freeze,offset,blankSpace,- extraContentPadding+ extraContentPadding,-+ adjustedInsetCompensation++ adjustedInsetCompensation,++ adjustedStartInsetCompensation} = options;const padding = useSharedValue(0);const currentHeight = useSharedValue(0);-@@ -59,7 +60,7 @@ function useChatKeyboard(scrollViewRef, options) {+@@ -51,6 +53,9 @@ function useChatKeyboard(scrollViewRef, options) {+ targetKeyboardHeight.value = e.height;+ }+ const effective = getEffectiveHeight(e.height, targetKeyboardHeight.value, offset);++ if (e.duration === 0) {++ currentHeight.value = effective;++ }+ const atEnd = isScrollAtEnd(scroll.value, layout.value.height, size.value.height, inverted);++ // Scale minimum padding absorption by how much of it is visible.+@@ -59,7 +64,7 @@ function useChatKeyboard(scrollViewRef, options) {const visiblePadding = visibleFraction * blankSpace.value;const minimumPaddingAbsorbed = Math.max(0, visiblePadding - extraContentPadding.value);const scrollEffective = getScrollEffective(effective, minimumPaddingAbsorbed);@@ -206,28 +353,81 @@ index 52943c3a7d6a68fe2094dc1d112c07e6b9d890e4..c8685c18a53ad078c24fc3e3b6572669// persistent mode: when keyboard shrinks, clamp to valid rangeif (keyboardLiftBehavior === "persistent" && effective < padding.value) {-@@ -127,7 +128,7 @@ function useChatKeyboard(scrollViewRef, options) {+@@ -69,8 +74,8 @@ function useChatKeyboard(scrollViewRef, options) {+ const maxScroll = Math.max(size.value.height - layout.value.height, 0);+ contentOffsetY.value = Math.max(-actualTotalPadding, Math.min(scroll.value, maxScroll));+ } else {+- const maxScroll = Math.max(size.value.height - layout.value.height + actualTotalPadding, 0);+- contentOffsetY.value = Math.max(0, Math.min(scroll.value, maxScroll));++ const maxScroll = Math.max(size.value.height - layout.value.height + actualTotalPadding, -adjustedStartInsetCompensation);++ contentOffsetY.value = Math.max(-adjustedStartInsetCompensation, Math.min(scroll.value, maxScroll));+ }+ return;+ }+@@ -84,8 +89,8 @@ function useChatKeyboard(scrollViewRef, options) {+ const maxScroll = Math.max(size.value.height - layout.value.height, 0);+ contentOffsetY.value = Math.max(-actualTotalPadding, Math.min(scroll.value, maxScroll));+ } else {+- const maxScroll = Math.max(size.value.height - layout.value.height + actualTotalPadding, 0);+- contentOffsetY.value = Math.max(0, Math.min(scroll.value, maxScroll));++ const maxScroll = Math.max(size.value.height - layout.value.height + actualTotalPadding, -adjustedStartInsetCompensation);++ contentOffsetY.value = Math.max(-adjustedStartInsetCompensation, Math.min(scroll.value, maxScroll));+ }+ return;+ }+@@ -111,12 +116,23 @@ function useChatKeyboard(scrollViewRef, options) {+ contentOffsetY.value = scroll.value;+ return;+ }+- contentOffsetY.value = computeIOSContentOffset(relativeScroll, scrollEffective, size.value.height, layout.value.height, inverted, actualTotalPadding);++ contentOffsetY.value = computeIOSContentOffset(relativeScroll, scrollEffective, size.value.height, layout.value.height, inverted, actualTotalPadding, adjustedStartInsetCompensation);++ },++ onMove: e => {++ "worklet";++++ if (freeze.value) {++ return;++ }++ currentHeight.value = getEffectiveHeight(e.height, targetKeyboardHeight.value, offset);+ },+- onMove: () => {++ onInteractive: e => {+ "worklet";++- // iOS doesn't need per-frame updates (contentOffset handles it)++ if (freeze.value) {++ return;++ }++ currentHeight.value = getEffectiveHeight(e.height, targetKeyboardHeight.value, offset);+ },+ onEnd: e => {+ "worklet";+@@ -125,9 +141,10 @@ function useChatKeyboard(scrollViewRef, options) {+ return;+ }const effective = getEffectiveHeight(e.height, targetKeyboardHeight.value, offset);++ currentHeight.value = effective;padding.value = effective;}- }, [inverted, keyboardLiftBehavior, offset, extraContentPadding]);-+ }, [inverted, keyboardLiftBehavior, offset, extraContentPadding, adjustedInsetCompensation]);++ }, [inverted, keyboardLiftBehavior, offset, extraContentPadding, adjustedInsetCompensation, adjustedStartInsetCompensation]);return {padding,currentHeight,diff --git a/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js b/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js-index 1afa50987a8d2a5fe3f36b20945efe804d48a873..e2966d89d4329a7dc1233ff060cab6f365f745d6 100644+index 1afa50987a8d2a5fe3f36b20945efe804d48a873..7b05d0721c50e118cf78c07913b580a31293db77 100644--- a/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js+++ b/lib/module/components/KeyboardChatScrollView/useExtraContentPadding/index.js-@@ -23,6 +23,7 @@ function useExtraContentPadding(options) {+@@ -23,6 +23,8 @@ function useExtraContentPadding(options) {extraContentPadding,keyboardPadding,blankSpace,+ adjustedInsetCompensation,++ adjustedStartInsetCompensation,scroll,layout,size,-@@ -62,8 +63,8 @@ function useExtraContentPadding(options) {+@@ -62,8 +64,8 @@ function useExtraContentPadding(options) {}// Compute effective delta considering blankSpace floor@@ -238,61 +438,85 @@ index 1afa50987a8d2a5fe3f36b20945efe804d48a873..e2966d89d4329a7dc1233ff060cab6f3const effectiveDelta = currentTotal - previousTotal;if (effectiveDelta === 0) {// blankSpace absorbed the change-@@ -86,7 +87,7 @@ function useExtraContentPadding(options) {- const target = Math.min(scroll.value + effectiveDelta, maxScroll);+@@ -82,11 +84,12 @@ function useExtraContentPadding(options) {+ const target = Math.max(scroll.value - effectiveDelta, -currentTotal);+ scrollToTarget(target);+ } else {+- const maxScroll = Math.max(size.value.height - layout.value.height + currentTotal, 0);+- const target = Math.min(scroll.value + effectiveDelta, maxScroll);++ const minScroll = -adjustedStartInsetCompensation;++ const maxScroll = Math.max(size.value.height - layout.value.height + currentTotal, minScroll);++ const target = Math.max(minScroll, Math.min(scroll.value + effectiveDelta, maxScroll));scrollToTarget(target);}- }, [inverted, keyboardLiftBehavior]);-+ }, [inverted, keyboardLiftBehavior, adjustedInsetCompensation]);++ }, [inverted, keyboardLiftBehavior, adjustedInsetCompensation, adjustedStartInsetCompensation]);}export { useExtraContentPadding };//# sourceMappingURL=index.js.map-\ No newline at end of filediff --git a/lib/typescript/components/KeyboardChatScrollView/types.d.ts b/lib/typescript/components/KeyboardChatScrollView/types.d.ts-index a036b431f03efb9d5379527c17db6fce62bfee09..6ca6fdf60fc9fae1e28a86cf24e21beed99b3a76 100644+index a036b431f03efb9d5379527c17db6fce62bfee09..5e56bf7edec9161698a745e8e6292bfccd68d3db 100644--- a/lib/typescript/components/KeyboardChatScrollView/types.d.ts+++ b/lib/typescript/components/KeyboardChatScrollView/types.d.ts-@@ -86,6 +86,8 @@ export type KeyboardChatScrollViewProps = {+@@ -86,6 +86,10 @@ export type KeyboardChatScrollViewProps = {* Default is `undefined` (equivalent to `0` — no minimum floor).*/blankSpace?: SharedValue<number>;+ /** Extra bottom inset UIKit adds beyond the raw contentInset (safe area). Offset math only. */+ adjustedInsetCompensation?: number;++ /** Leading inset UIKit adds outside raw contentInset. Offset math only. */++ adjustedStartInsetCompensation?: number;/*** Fires whenever the effective content inset changes — the static `contentInset`* prop combined with the dynamic keyboard-driven padding.+diff --git a/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/helpers.d.ts b/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/helpers.d.ts+index 2b51cc4737b4a05b5396da31e67e54177f43c498..3acec1fbddee6227915590a6c8d449757cb4d7b2 100644+--- a/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/helpers.d.ts++++ b/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/helpers.d.ts+@@ -129,4 +129,4 @@ export declare const clampedScrollTarget: (offsetBeforeScroll: number, keyboardH+ * computeIOSContentOffset(100, 300, 1000, 800, false); // 400+ * ```+ */+-export declare const computeIOSContentOffset: (relativeScroll: number, keyboardHeight: number, contentHeight: number, layoutHeight: number, inverted: boolean, totalPaddingForMaxScroll?: number) => number;++export declare const computeIOSContentOffset: (relativeScroll: number, keyboardHeight: number, contentHeight: number, layoutHeight: number, inverted: boolean, totalPaddingForMaxScroll?: number, startInsetCompensation?: number) => number;diff --git a/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/types.d.ts b/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/types.d.ts-index aff9b5a8dbc2464546396437eaf6c5ae955b9f29..67edbe1a1eac27b5a571611979753ebf3134bc8b 100644+index aff9b5a8dbc2464546396437eaf6c5ae955b9f29..fdd83953271123be6caefaa786c469f0d92cce2b 100644--- a/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/types.d.ts+++ b/lib/typescript/components/KeyboardChatScrollView/useChatKeyboard/types.d.ts-@@ -9,6 +9,8 @@ type UseChatKeyboardOptions = {+@@ -9,6 +9,10 @@ type UseChatKeyboardOptions = {blankSpace: SharedValue<number>;/** Extra content padding shared value — needed on iOS to correctly clamp contentOffset. */extraContentPadding: SharedValue<number>;+ /** Safe-area extra beyond raw contentInset. Offset math only. */+ adjustedInsetCompensation: number;++ /** Leading inset UIKit adds beyond the raw contentInset. Offset math only. */++ adjustedStartInsetCompensation: number;};type UseChatKeyboardReturn = {/** Extra scrollable space (= keyboard height). Used as contentInset on iOS, contentInsetBottom/contentInsetTop on Android. */diff --git a/lib/typescript/components/KeyboardChatScrollView/useExtraContentPadding/index.d.ts b/lib/typescript/components/KeyboardChatScrollView/useExtraContentPadding/index.d.ts-index ec73f70544a062fbecfc1d8be92d839d3e0bea6f..6fe16cd0b1200a2f4d4d8eeb9b555747186dbfe0 100644+index ec73f70544a062fbecfc1d8be92d839d3e0bea6f..45b387446587fd3e611fa02a01534bb5d9fa6bbd 100644--- a/lib/typescript/components/KeyboardChatScrollView/useExtraContentPadding/index.d.ts+++ b/lib/typescript/components/KeyboardChatScrollView/useExtraContentPadding/index.d.ts-@@ -8,6 +8,8 @@ type UseExtraContentPaddingOptions = {+@@ -8,6 +8,10 @@ type UseExtraContentPaddingOptions = {keyboardPadding: SharedValue<number>;/** Minimum inset floor — used to absorb keyboard and extraContentPadding changes. */blankSpace: SharedValue<number>;+ /** Safe-area extra beyond raw contentInset. Offset math only. */+ adjustedInsetCompensation: number;++ /** Leading inset UIKit adds beyond raw contentInset. Offset math only. */++ adjustedStartInsetCompensation: number;/** Current vertical scroll offset. */scroll: SharedValue<number>;/** Visible viewport dimensions. */diff --git a/src/components/KeyboardChatScrollView/index.tsx b/src/components/KeyboardChatScrollView/index.tsx-index 03f5f74e9aaaabc75db1c01643a655ee4fdfa5f2..d657002ebbce53c47e3a713c0921c35dca6056f3 100644+index 03f5f74e9aaaabc75db1c01643a655ee4fdfa5f2..277a1ecada428ffbae517d6edc720d029c8ecc10 100644--- a/src/components/KeyboardChatScrollView/index.tsx+++ b/src/components/KeyboardChatScrollView/index.tsx-@@ -2,6 +2,8 @@ import React, { forwardRef, useCallback, useMemo } from "react";- import { StyleSheet } from "react-native";+@@ -1,7 +1,9 @@+ import React, { forwardRef, useCallback, useMemo } from "react";+-import { StyleSheet } from "react-native";++import { Platform, StyleSheet } from "react-native";import {makeMutable,+ runOnJS,@@ -300,11 +524,12 @@ index 03f5f74e9aaaabc75db1c01643a655ee4fdfa5f2..d657002ebbce53c47e3a713c0921c35duseAnimatedRef,useAnimatedStyle,useDerivedValue,-@@ -35,9 +37,11 @@ const KeyboardChatScrollView = forwardRef<+@@ -35,9 +37,12 @@ const KeyboardChatScrollView = forwardRef<offset = 0,extraContentPadding = ZERO_CONTENT_PADDING,blankSpace = ZERO_BLANK_SPACE,+ adjustedInsetCompensation = 0,++ adjustedStartInsetCompensation = 0,applyWorkaroundForContentInsetHitTestBug = false,onLayout: onLayoutProp,onContentSizeChange: onContentSizeChangeProp,@@ -312,23 +537,25 @@ index 03f5f74e9aaaabc75db1c01643a655ee4fdfa5f2..d657002ebbce53c47e3a713c0921c35donEndVisible,...rest},-@@ -64,6 +68,7 @@ const KeyboardChatScrollView = forwardRef<+@@ -64,6 +69,8 @@ const KeyboardChatScrollView = forwardRef<offset,blankSpace,extraContentPadding,+ adjustedInsetCompensation,++ adjustedStartInsetCompensation,});useExtraContentPadding({-@@ -71,6 +76,7 @@ const KeyboardChatScrollView = forwardRef<+@@ -71,6 +78,8 @@ const KeyboardChatScrollView = forwardRef<extraContentPadding,keyboardPadding: padding,blankSpace,+ adjustedInsetCompensation,++ adjustedStartInsetCompensation,scroll,layout,size,-@@ -102,13 +108,25 @@ const KeyboardChatScrollView = forwardRef<+@@ -102,13 +111,40 @@ const KeyboardChatScrollView = forwardRef<),);@@ -337,19 +564,34 @@ index 03f5f74e9aaaabc75db1c01643a655ee4fdfa5f2..d657002ebbce53c47e3a713c0921c35d- // scrollIndicatorInsets adjustment at the application layer.- const indicatorPadding = useDerivedValue(- () => padding.value + extraContentPadding.value,++ // iOS applies the destination contentInset and contentOffset together at++ // keyboard-animation start. Keep that native target behavior, but report++ // the presentation height so virtualized-list layout follows the keyboard.++ const reportedPadding = useDerivedValue(() =>++ Platform.OS === "ios"++ ? Math.min(++ layout.value.height,++ Math.max(++ blankSpace.value,++ currentHeight.value + extraContentPadding.value,++ ),++ )++ : totalPadding.value,+ );++ // Mirror the effective bottom padding (keyboard + composer + blank floor)+ // to the consumer — a virtualized list needs it in its own scroll math or+ // its end/maintain targets point at the under-the-keyboard resting offset.+ useAnimatedReaction(-+ () => totalPadding.value,++ () => reportedPadding.value,+ (current, previous) => {+ if (onContentInsetChange && current !== previous) {+ runOnJS(onContentInsetChange)({ bottom: current });+ }+ },+ [onContentInsetChange],- );-++ );+++ // Scroll indicator inset = keyboard only (excludes extraContentPadding and+ // blankSpace): with a floating composer the indicator track should run the+ // full height of the scroll view, behind the composer, like iOS Messages.@@ -360,10 +602,10 @@ index 03f5f74e9aaaabc75db1c01643a655ee4fdfa5f2..d657002ebbce53c47e3a713c0921c35d(e: LayoutChangeEvent) => {onLayoutInternal(e);diff --git a/src/components/KeyboardChatScrollView/types.ts b/src/components/KeyboardChatScrollView/types.ts-index dd222b57bc7a71729524670bad3812f30920bd73..40249a4357991b7a9c69b87214db2ceb6ff4ba7d 100644+index dd222b57bc7a71729524670bad3812f30920bd73..7be71b5460eb143ddf460ce5c87b843c66bfb2cd 100644--- a/src/components/KeyboardChatScrollView/types.ts+++ b/src/components/KeyboardChatScrollView/types.ts-@@ -90,6 +90,15 @@ export type KeyboardChatScrollViewProps = {+@@ -90,6 +90,17 @@ export type KeyboardChatScrollViewProps = {* Default is `undefined` (equivalent to `0` — no minimum floor).*/blankSpace?: SharedValue<number>;@@ -376,22 +618,65 @@ index dd222b57bc7a71729524670bad3812f30920bd73..40249a4357991b7a9c69b87214db2ceb+ * Default is `0`.+ */+ adjustedInsetCompensation?: number;++ /** Leading inset UIKit adds outside raw contentInset. Offset math only. */++ adjustedStartInsetCompensation?: number;/*** Fires whenever the effective content inset changes — the static `contentInset`* prop combined with the dynamic keyboard-driven padding.+diff --git a/src/components/KeyboardChatScrollView/useChatKeyboard/helpers.ts b/src/components/KeyboardChatScrollView/useChatKeyboard/helpers.ts+index 37eacd10857cd70c51b3468c4b466e4959d0a415..3d77ab27c614f44b64da8270823942cb670b097b 100644+--- a/src/components/KeyboardChatScrollView/useChatKeyboard/helpers.ts++++ b/src/components/KeyboardChatScrollView/useChatKeyboard/helpers.ts+@@ -245,6 +245,7 @@ export const computeIOSContentOffset = (+ layoutHeight: number,+ inverted: boolean,+ totalPaddingForMaxScroll?: number,++ startInsetCompensation: number = 0,+ ): number => {+ "worklet";++@@ -262,7 +263,14 @@ export const computeIOSContentOffset = (+ );+ }++- const maxScroll = Math.max(contentHeight - layoutHeight + paddingForMax, 0);++ const minScroll = -startInsetCompensation;++ const maxScroll = Math.max(++ contentHeight - layoutHeight + paddingForMax,++ minScroll,++ );++- return Math.min(Math.max(keyboardHeight + relativeScroll, 0), maxScroll);++ return Math.min(++ Math.max(keyboardHeight + relativeScroll, minScroll),++ maxScroll,++ );+ };diff --git a/src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts b/src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts-index 560df54bae1a8c41a2e9ac0e2a8d2fd9b843968a..a0cb412692cf47fee372a01132e6a670b59bcd66 100644+index 560df54bae1a8c41a2e9ac0e2a8d2fd9b843968a..c375a8c4cc889c2fc2c0c1034788c605633192ed 100644--- a/src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts+++ b/src/components/KeyboardChatScrollView/useChatKeyboard/index.ios.ts-@@ -43,6 +43,7 @@ function useChatKeyboard(+@@ -43,6 +43,8 @@ function useChatKeyboard(offset,blankSpace,extraContentPadding,+ adjustedInsetCompensation,++ adjustedStartInsetCompensation,} = options;const padding = useSharedValue(0);-@@ -104,10 +105,12 @@ function useChatKeyboard(+@@ -79,6 +81,10 @@ function useChatKeyboard(+ offset,+ );+++ if (e.duration === 0) {++ currentHeight.value = effective;++ }+++ const atEnd = isScrollAtEnd(+ scroll.value,+ layout.value.height,+@@ -104,10 +110,12 @@ function useChatKeyboard(effective,minimumPaddingAbsorbed,);@@ -408,50 +693,131 @@ index 560df54bae1a8c41a2e9ac0e2a8d2fd9b843968a..a0cb412692cf47fee372a01132e6a670// persistent mode: when keyboard shrinks, clamp to valid rangeif (-@@ -242,7 +245,7 @@ function useChatKeyboard(+@@ -130,11 +138,11 @@ function useChatKeyboard(+ } else {+ const maxScroll = Math.max(+ size.value.height - layout.value.height + actualTotalPadding,+- 0,++ -adjustedStartInsetCompensation,+ );++ contentOffsetY.value = Math.max(+- 0,++ -adjustedStartInsetCompensation,+ Math.min(scroll.value, maxScroll),+ );+ }+@@ -165,11 +173,11 @@ function useChatKeyboard(+ } else {+ const maxScroll = Math.max(+ size.value.height - layout.value.height + actualTotalPadding,+- 0,++ -adjustedStartInsetCompensation,+ );++ contentOffsetY.value = Math.max(+- 0,++ -adjustedStartInsetCompensation,+ Math.min(scroll.value, maxScroll),+ );+ }+@@ -219,12 +227,34 @@ function useChatKeyboard(+ layout.value.height,+ inverted,+ actualTotalPadding,++ adjustedStartInsetCompensation,+ );+ },+- onMove: () => {++ onMove: (e) => {+ "worklet";++- // iOS doesn't need per-frame updates (contentOffset handles it)++ if (freeze.value) {++ return;++ }++++ currentHeight.value = getEffectiveHeight(++ e.height,++ targetKeyboardHeight.value,++ offset,++ );++ },++ onInteractive: (e) => {++ "worklet";++++ if (freeze.value) {++ return;++ }++++ currentHeight.value = getEffectiveHeight(++ e.height,++ targetKeyboardHeight.value,++ offset,++ );+ },+ onEnd: (e) => {+ "worklet";+@@ -239,10 +269,18 @@ function useChatKeyboard(+ offset,+ );+++ currentHeight.value = effective;padding.value = effective;},},- [inverted, keyboardLiftBehavior, offset, extraContentPadding],-+ [inverted, keyboardLiftBehavior, offset, extraContentPadding, adjustedInsetCompensation],++ [++ inverted,++ keyboardLiftBehavior,++ offset,++ extraContentPadding,++ adjustedInsetCompensation,++ adjustedStartInsetCompensation,++ ],);return {diff --git a/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts b/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts-index 02abf5cd9490900826678175462b234e07e30e92..3f261fa8f1913a79fa1de2004bbac20415a89acc 100644+index 02abf5cd9490900826678175462b234e07e30e92..4ee0ddd65e0b105568ab43b73997af4be8adae00 100644--- a/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts+++ b/src/components/KeyboardChatScrollView/useChatKeyboard/types.ts-@@ -11,6 +11,8 @@ type UseChatKeyboardOptions = {+@@ -11,6 +11,10 @@ type UseChatKeyboardOptions = {blankSpace: SharedValue<number>;/** Extra content padding shared value — needed on iOS to correctly clamp contentOffset. */extraContentPadding: SharedValue<number>;+ /** Extra bottom inset UIKit adds beyond the raw contentInset (safe area). Offset math only. */+ adjustedInsetCompensation: number;++ /** Leading inset UIKit adds beyond the raw contentInset. Offset math only. */++ adjustedStartInsetCompensation: number;};type UseChatKeyboardReturn = {diff --git a/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts b/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts-index 833acbe78f1b1245251ddd3431d6546decdd0ade..49d679446b03199217faa16a503d8d15e83a29b9 100644+index 833acbe78f1b1245251ddd3431d6546decdd0ade..8f7c10cb6ab392f10df4ca43549b89c25844f0b8 100644--- a/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts+++ b/src/components/KeyboardChatScrollView/useExtraContentPadding/index.ts-@@ -16,6 +16,8 @@ type UseExtraContentPaddingOptions = {+@@ -16,6 +16,10 @@ type UseExtraContentPaddingOptions = {keyboardPadding: SharedValue<number>;/** Minimum inset floor — used to absorb keyboard and extraContentPadding changes. */blankSpace: SharedValue<number>;+ /** Extra bottom inset UIKit adds beyond the raw contentInset (safe area). Offset math only. */+ adjustedInsetCompensation: number;++ /** Leading inset UIKit adds beyond raw contentInset. Offset math only. */++ adjustedStartInsetCompensation: number;/** Current vertical scroll offset. */scroll: SharedValue<number>;/** Visible viewport dimensions. */-@@ -49,6 +51,7 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {+@@ -49,6 +53,8 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {extraContentPadding,keyboardPadding,blankSpace,+ adjustedInsetCompensation,++ adjustedStartInsetCompensation,scroll,layout,size,-@@ -97,14 +100,12 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {+@@ -97,14 +103,12 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {}// Compute effective delta considering blankSpace floor@@ -472,12 +838,32 @@ index 833acbe78f1b1245251ddd3431d6546decdd0ade..49d679446b03199217faa16a503d8d15const effectiveDelta = currentTotal - previousTotal;if (effectiveDelta === 0) {-@@ -146,7 +147,7 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {+@@ -137,16 +141,25 @@ function useExtraContentPadding(options: UseExtraContentPaddingOptions): void {++ scrollToTarget(target);+ } else {++ const minScroll = -adjustedStartInsetCompensation;+ const maxScroll = Math.max(+ size.value.height - layout.value.height + currentTotal,+- 0,++ minScroll,++ );++ const target = Math.max(++ minScroll,++ Math.min(scroll.value + effectiveDelta, maxScroll),+ );+- const target = Math.min(scroll.value + effectiveDelta, maxScroll);+scrollToTarget(target);}},- [inverted, keyboardLiftBehavior],-+ [inverted, keyboardLiftBehavior, adjustedInsetCompensation],++ [++ inverted,++ keyboardLiftBehavior,++ adjustedInsetCompensation,++ adjustedStartInsetCompensation,++ ],);}diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex cdcca6f13e1..522a701f509 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -86,13 +86,13 @@ patchedDependencies:'@effect/[email protected]': a16b1e870d8c29e4a98b17cc4c638a4ff471753d8ca3487f78a22b759caf951b'@expo/[email protected]': 96f1a75347e6ea02dc4b7034ace815d8ee39e18b8166ebfb573d9e58328f0dc2'@ff-labs/[email protected]': ab9ff544009e1891cfe3930105862d3699007f38922a79f3c98d90018deca368- '@legendapp/[email protected]': 064530db83875fa671559a81ae42dc159726dc2dd6ec4c982da44ff7c7a74706+ '@legendapp/[email protected]': f786e0ada19a32703f71a7230a819697ebff2527873dfb9997c8455947e0060b'@pierre/[email protected]': 7ef7cb0cbabb17c15cdb137554068b36f15f6f5265e73fb51452aa3380db91aa'@react-native-menu/[email protected]': f63d256bf6a97a873b5e628eb595bd6ef0075ddd5bdd890fc920f7a6024290dd'@react-navigation/[email protected]': e667c3cef8c78bb9ff4882ee5bd23a432247b843060a9499eb5f07e9e2295552[email protected]: af36b7948b6f9c56623074662b51dade5699880c1a7c71245de73e13c3185fb6[email protected]: 808eb26f9e57cf4945efd3985af4d9c764da6f91f4c9764433cc868602bbf4d3- [email protected]: 20be72c84d74253acdcfefbc6defe36dc396944f1a44cab2bdd0e3cd572ae008+ [email protected]: 6e4339347bc5bb3c9ea67d85ff5c814058b211c5750f247aba59d07869a2e787[email protected]: 825622aae63a8fb5b904f3c77908a0e216261d727ea171709f2c0b6088422675[email protected]: 149bef30a66351ea9b26b42f87b78c539cb52b880f2387bb323ec80dcac84006[email protected]: 329a77525509623d763b738152dbd00ab392cdcdd9fb6ed2b4a20e086e437196@@ -228,7 +228,7 @@ importers:version: 57.0.14(@babel/[email protected])(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected])([email protected]([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])'@legendapp/list':specifier: 'catalog:'- version: 3.3.5(patch_hash=064530db83875fa671559a81ae42dc159726dc2dd6ec4c982da44ff7c7a74706)([email protected]([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])+ version: 3.3.5(patch_hash=f786e0ada19a32703f71a7230a819697ebff2527873dfb9997c8455947e0060b)([email protected]([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])'@noble/curves':specifier: 'catalog:'version: 1.9.1@@ -402,7 +402,7 @@ importers:version: 0.2.2([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])react-native-keyboard-controller:specifier: 1.21.13- version: 1.21.13(patch_hash=20be72c84d74253acdcfefbc6defe36dc396944f1a44cab2bdd0e3cd572ae008)([email protected]([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])+ version: 1.21.13(patch_hash=6e4339347bc5bb3c9ea67d85ff5c814058b211c5750f247aba59d07869a2e787)([email protected]([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])react-native-nitro-markdown:specifier: ^0.5.0version: 0.5.8([email protected](patch_hash=825622aae63a8fb5b904f3c77908a0e216261d727ea171709f2c0b6088422675)([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected]))([email protected]([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])@@ -560,7 +560,7 @@ importers:version: 0.9.0'@legendapp/list':specifier: 'catalog:'- version: 3.3.5(patch_hash=064530db83875fa671559a81ae42dc159726dc2dd6ec4c982da44ff7c7a74706)([email protected]([email protected]))([email protected])+ version: 3.3.5(patch_hash=f786e0ada19a32703f71a7230a819697ebff2527873dfb9997c8455947e0060b)([email protected]([email protected]))([email protected])'@lexical/react':specifier: ^0.41.0@@ -12828,7 +12828,7 @@ snapshots:dependencies:jsbi: 4.3.2- '@legendapp/[email protected](patch_hash=064530db83875fa671559a81ae42dc159726dc2dd6ec4c982da44ff7c7a74706)([email protected]([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])':+ '@legendapp/[email protected](patch_hash=f786e0ada19a32703f71a7230a819697ebff2527873dfb9997c8455947e0060b)([email protected]([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected])':dependencies:react: 19.2.3use-sync-external-store: 1.6.0([email protected])@@ -12836,7 +12836,7 @@ snapshots:react-dom: 19.2.3([email protected])react-native: 0.86.3(@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected])- '@legendapp/[email protected](patch_hash=064530db83875fa671559a81ae42dc159726dc2dd6ec4c982da44ff7c7a74706)([email protected]([email protected]))([email protected])':+ '@legendapp/[email protected](patch_hash=f786e0ada19a32703f71a7230a819697ebff2527873dfb9997c8455947e0060b)([email protected]([email protected]))([email protected])':dependencies:react: 19.2.6use-sync-external-store: 1.6.0([email protected])@@ -19356,7 +19356,7 @@ snapshots:react: 19.2.3react-native: 0.86.3(@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected])- [email protected](patch_hash=20be72c84d74253acdcfefbc6defe36dc396944f1a44cab2bdd0e3cd572ae008)([email protected]([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected]):+ [email protected](patch_hash=6e4339347bc5bb3c9ea67d85ff5c814058b211c5750f247aba59d07869a2e787)([email protected]([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected]))([email protected](@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected]))([email protected]):dependencies:react: 19.2.3react-native: 0.86.3(@babel/[email protected])(@react-native/[email protected](@babel/[email protected])([email protected])([email protected]))(@types/[email protected])([email protected])([email protected])([email protected])