feat(mobile): update tool summaries and chat transitions (#8793)

This commit is contained in:
Julius Marminge authored and GitHub committed 2026-08-30 12:22:45 -07:00
1 parent 2daff8c25a
commit f15680bd3c
14 files changed
+2982 -898

No files matched your search

@@ -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.View
className="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,
},
]}
>
<GlassSurface
chrome="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: ThreadComposer
const 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: ThreadComposer
const 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: ThreadComposer
return (
<Animated.View
className="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.View
className="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: ThreadComposer
paddingTop: 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">
<ComposerToolbarButton
accessibilityLabel="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: ThreadComposer
showChevron={false}
/>
) : null}
</ComposerToolbarScroller>
<ComposerToolbarButton
accessibilityLabel={sendLabel}
icon="arrow.up"
variant="primary"
disabled={!canSend}
onPress={handleSend}
showChevron={false}
/>
</View>
</ComposerToolbarRow>
) : null}
</View>
</ComposerSurface>
{/* Queue count */}
@@ -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: Thread
return 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: Thread
composerOverlayRef,
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: Thread
const 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: Thread
useAnimatedReaction(
() =>
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: Thread
const { 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: Thread
userInputCardProgress.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: Thread
submittedMessageId={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,
}}
>
<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
composer 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}
{/* 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)}
>
{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
composer 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>
</View>
</View>
</Animated.View>
</KeyboardStickyView>
) : null}
</View>
+125 -98
View File
@@ -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;
}
// 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.
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 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 settleDisclosureAfterLayout = useCallback(() => {
if (disclosureSettleFrameRef.current !== null) {
cancelAnimationFrame(disclosureSettleFrameRef.current);
}
if (disclosureSettleSecondFrameRef.current !== null) {
cancelAnimationFrame(disclosureSettleSecondFrameRef.current);
}
disclosureSettleFrameRef.current = requestAnimationFrame(() => {
disclosureSettleSecondFrameRef.current = requestAnimationFrame(() => {
disclosureAnchorKeyRef.current = null;
setDisclosureToggleSettling(false);
disclosureSettleFrameRef.current = null;
disclosureSettleSecondFrameRef.current = null;
});
});
}, []);
const suspendEndScrollMaintenanceForDisclosure = useCallback((anchorKey: string | null) => {
disclosureAnchorKeyRef.current = anchorKey;
setDisclosureToggleSettling(true);
if (foldSettleFrameRef.current !== null) {
cancelAnimationFrame(foldSettleFrameRef.current);
}
if (foldSettleSecondFrameRef.current !== null) {
cancelAnimationFrame(foldSettleSecondFrameRef.current);
}
foldSettleFrameRef.current = requestAnimationFrame(() => {
foldSettleSecondFrameRef.current = requestAnimationFrame(() => {
disclosureAnchorKeyRef.current = null;
setDisclosureToggleSettling(false);
foldSettleFrameRef.current = null;
foldSettleSecondFrameRef.current = null;
});
});
}, []);
// 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/@legendapp__list@3.2.0.patch):
// Patched LegendList prop (patches/@legendapp__list@3.3.5.patch):
// 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}
@@ -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}
/>
);
}
@@ -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-8
const WORK_ROW_GAP = 1; // gap-px
const WORK_LOG_HEADER_PADDING = 2; // pb-0.5 under the "work log" label
const WORK_LOG_BOTTOM_MARGIN = 4; // mb-1
export 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.View
key={row.id}
layout={WORK_LOG_LAYOUT_TRANSITION}
className="overflow-hidden"
{...(isFreshRow(row.createdAt) ? { entering: FadeIn.duration(200) } : {})}
>
<Pressable
accessibilityRole={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"
>
<ScrollView
nestedScrollEnabled
directionalLockEnabled
@@ -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">
<Pressable
accessibilityRole="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" };
}
}
+242 -26
View File
@@ -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" },
]);
});
});
+234 -59
View File
@@ -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 | un
return [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,
},
};
}),
@@ -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,
+8
View File
@@ -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": {
@@ -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;
}
@@ -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";
}
File diff suppressed because it is too large. Load diff
+456 -70
View File
@@ -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..940e1dd80c6c9dfc42eab916445be414
onEndVisible,
...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..940e1dd80c6c9dfc42eab916445be414
keyboardPadding: 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..940e1dd80c6c9dfc42eab916445be414
const 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.map
diff --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 range
if (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..22ca193257ab0068f732c088b09145da
const 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 file
diff --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..ac79433fdf0b36f89525b9840447a116
onEndVisible,
...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..ac79433fdf0b36f89525b9840447a116
keyboardPadding: 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..ac79433fdf0b36f89525b9840447a116
const 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.map
diff --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 range
if (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..e2966d89d4329a7dc1233ff060cab6f3
const 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 file
diff --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..d657002ebbce53c47e3a713c0921c35d
useAnimatedRef,
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..d657002ebbce53c47e3a713c0921c35d
onEndVisible,
...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 range
if (
@@ -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..49d679446b03199217faa16a503d8d15
const 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,
+ ],
);
}
+8 -8
View File
@@ -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.0
version: 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
version: 0.41.0([email protected]([email protected]))([email protected])([email protected])
@@ -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.3
use-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.6
use-sync-external-store: 1.6.0([email protected])
@@ -19356,7 +19356,7 @@ snapshots:
react: 19.2.3
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])
[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.3
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])