Skip to content

Commit 2b0abf3

Browse files
Merge remote-tracking branch 'origin/main' into fix/issue-27930
2 parents 26467b4 + 80a2351 commit 2b0abf3

87 files changed

Lines changed: 2650 additions & 436 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/mobile/src/components/ScrollComposeButton.android.tsx‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ import { Box, ExtendedFloatingActionButton, Icon, Text } from "@expo/ui/jetpack-
33
import {
44
defaultMinSize,
55
fillMaxWidth,
6-
graphicsLayer,
76
height,
87
onSizeChanged,
98
size,
109
} from "@expo/ui/jetpack-compose/modifiers";
1110
import { useState } from "react";
12-
import { Pressable, View, type StyleProp, type ViewStyle } from "react-native";
11+
import { I18nManager, Pressable, View, type StyleProp, type ViewStyle } from "react-native";
1312
import { useAndroidControlSizing } from "./ui/useAndroidControlSizing";
1413
import { useAppearancePreferences } from "../features/settings/appearance/AppearancePreferencesProvider";
1514
import { resolveScaledTextRole } from "../lib/appearancePreferences";
@@ -37,7 +36,14 @@ export function ScrollComposeButton(props: {
3736
className={props.className}
3837
style={[props.style, { left: 20, height: fabSize }]}
3938
>
40-
<View pointerEvents="none" importantForAccessibility="no-hide-descendants">
39+
<View
40+
pointerEvents="none"
41+
importantForAccessibility="no-hide-descendants"
42+
style={{
43+
transform: [{ scale }],
44+
transformOrigin: I18nManager.isRTL ? "top left" : "top right",
45+
}}
46+
>
4147
<NativeThemeHost
4248
matchContents={{ vertical: true }}
4349
ignoreSafeAreaKeyboardInsets
@@ -50,12 +56,6 @@ export function ScrollComposeButton(props: {
5056
modifiers={[
5157
defaultMinSize({ minWidth: nativeSize }),
5258
height(nativeSize),
53-
graphicsLayer({
54-
scaleX: scale,
55-
scaleY: scale,
56-
transformOriginX: 1,
57-
transformOriginY: 0,
58-
}),
5959
onSizeChanged(rememberWidth),
6060
]}
6161
>

‎apps/mobile/src/features/connection/ConnectionEnvironmentRow.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,9 @@ export function ConnectionEnvironmentRow(props: {
283283
)}
284284

285285
<Pressable
286+
accessibilityRole="button"
287+
accessibilityLabel="Reconnect environment"
288+
accessibilityState={{ disabled: !enabled }}
286289
className="h-[42px] w-[42px] items-center justify-center rounded-[14px] border border-input-border bg-input active:opacity-70 disabled:opacity-40"
287290
disabled={!enabled}
288291
onPress={() => props.onReconnect(props.environment.environmentId)}
@@ -296,6 +299,8 @@ export function ConnectionEnvironmentRow(props: {
296299
</Pressable>
297300

298301
<Pressable
302+
accessibilityRole="button"
303+
accessibilityLabel="Remove environment"
299304
className="h-[42px] w-[42px] items-center justify-center rounded-[14px] border border-danger-border bg-danger active:opacity-70"
300305
onPress={() => props.onRemove(props.environment.environmentId)}
301306
>

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,9 @@ const NO_RUN_STOP_ATOM = Atom.make<RunStopPresentation | null>(null).pipe(
346346
Atom.withLabel("mobile-thread-run-stop:empty"),
347347
);
348348

349+
// Connection failures survive retries and app suspension.
350+
const RECONNECT_ERROR_DELAY_MS = 5_000;
351+
349352
// Anchors, the submitted message, follow state and pending scrolls belong to
350353
// one thread, so the body remounts when the thread changes.
351354
export function ThreadDetailScreen(props: ThreadDetailScreenProps) {
@@ -527,6 +530,14 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
527530
}
528531
})();
529532
const threadSyncLabel = useDelayedStatus(selectedThreadKey, realThreadSyncLabel);
533+
const connectionRetrying =
534+
props.connectionStateLabel === "connecting" || props.connectionStateLabel === "reconnecting";
535+
const retryError = connectionRetrying ? props.connectionError : null;
536+
const retryConnectionError = useDelayedStatus(
537+
`${props.environmentId}:${retryError !== null}`,
538+
retryError,
539+
RECONNECT_ERROR_DELAY_MS,
540+
);
530541
const interruptThreadTurn = useAtomCommand(threadEnvironment.interruptTurn, {
531542
reportFailure: false,
532543
});
@@ -661,7 +672,7 @@ function ThreadDetailBody(props: ThreadDetailScreenProps) {
661672
);
662673
const floatingStatus = ((): FloatingWorkingStatus | null => {
663674
const connectionStatus = connectionFloatingStatus({
664-
connectionError: props.connectionError,
675+
connectionError: connectionRetrying ? retryConnectionError : props.connectionError,
665676
connectionState: props.connectionStateLabel,
666677
environmentLabel: props.environmentLabel,
667678
onReconnect: props.onReconnectEnvironment,

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

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ import { CopyTextButton } from "./CopyTextButton";
167167
import { getReviewSectionIdForCheckpoint } from "../review/reviewModel";
168168
import { setReviewSelectedSectionId } from "../review/reviewState";
169169
import { Menu } from "../../components/ui/Menu";
170+
import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
170171
import { copyPromptLink } from "../prompt-links/prompt-link-actions";
171172
import { parseReviewCommentMessageSegments } from "../review/reviewCommentSelection";
172173
import {
@@ -420,6 +421,8 @@ function UserMessageCopyButton(props: {
420421
function AssistantForkButton(props: {
421422
readonly environmentId: EnvironmentId;
422423
readonly iconColor: ColorValue;
424+
readonly buttonSize: number;
425+
readonly iconSize: number;
423426
readonly projectedItem: OrchestrationV2ProjectedTurnItem;
424427
readonly sourceTitle: string;
425428
}) {
@@ -476,13 +479,18 @@ function AssistantForkButton(props: {
476479
.finally(() => setBusy(false));
477480
}}
478481
className="h-7 w-7 items-center justify-center disabled:opacity-40"
482+
style={
483+
Platform.OS === "android"
484+
? { width: props.buttonSize, height: props.buttonSize }
485+
: undefined
486+
}
479487
>
480488
{busy ? (
481489
<AppActivityIndicator size="small" />
482490
) : (
483491
<SymbolView
484492
name="arrow.triangle.branch"
485-
size={13}
493+
size={props.iconSize}
486494
tintColor={props.iconColor}
487495
type="monochrome"
488496
/>
@@ -1597,6 +1605,7 @@ function renderFeedEntry(
15971605
readonly renderViewedImage: MarkdownImageRenderer;
15981606
readonly renderReasoning: (text: string) => ReactNode;
15991607
readonly iconSubtleColor: string | import("react-native").ColorValue;
1608+
readonly replyActionSize: { readonly button: number; readonly icon: number };
16001609
readonly screenColor: string;
16011610
readonly userBubbleColor: string | import("react-native").ColorValue;
16021611
readonly markdownStyles: MarkdownStyleSets;
@@ -2195,13 +2204,15 @@ function renderFeedEntry(
21952204
accessibilityLabel="Copy message"
21962205
text={renderedText}
21972206
tintColor={iconSubtleColor}
2198-
buttonSize={28}
2199-
iconSize={13}
2207+
buttonSize={props.replyActionSize.button}
2208+
iconSize={props.replyActionSize.icon}
22002209
/>
22012210
{message.projectedItem ? (
22022211
<AssistantForkButton
22032212
environmentId={props.environmentId}
22042213
iconColor={iconSubtleColor}
2214+
buttonSize={props.replyActionSize.button}
2215+
iconSize={props.replyActionSize.icon}
22052216
projectedItem={message.projectedItem}
22062217
sourceTitle={props.threadTitle}
22072218
/>
@@ -2665,6 +2676,15 @@ export const ThreadFeed = memo(function ThreadFeed({
26652676

26662677
const theme = useUniwindTheme();
26672678
const iconSubtleColor = theme["--color-icon-subtle"];
2679+
const { buttonSize: androidButtonSize, smallIconSize: androidIconSize } =
2680+
useAndroidControlSizing();
2681+
const replyActionSize = useMemo(
2682+
() =>
2683+
Platform.OS === "android"
2684+
? { button: androidButtonSize, icon: androidIconSize }
2685+
: { button: 28, icon: 13 },
2686+
[androidButtonSize, androidIconSize],
2687+
);
26682688
const screenColor = theme["--color-screen"];
26692689
const userBubbleColor = theme["--color-user-bubble"];
26702690
const openSkillInstructions = (path: string) => {
@@ -3520,6 +3540,7 @@ export const ThreadFeed = memo(function ThreadFeed({
35203540
renderViewedImage,
35213541
renderReasoning,
35223542
iconSubtleColor,
3543+
replyActionSize,
35233544
screenColor,
35243545
userBubbleColor,
35253546
markdownStyles,

‎apps/mobile/src/features/threads/thread-list-v2-items.tsx‎

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,8 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
695695
? { ...workingLabel, label: "Goal" }
696696
: workingLabel) ?? (isUnread ? DONE_STATUS_LABEL : undefined);
697697
const recede = shouldRecedeThreadRow({ status, selected });
698+
const isRegeneratingTitle = thread.titleRegeneration != null;
699+
const rowAccessibilityLabel = `${thread.title}${props.hasQueuedMessages ? ", messages queued to send" : ""}${isRegeneratingTitle ? ", regenerating title" : ""}`;
698700
const timeLabel = props.timeLabel;
699701

700702
const visitThread = useAtomCommand(threadEnvironment.visit, { reportFailure: false });
@@ -845,7 +847,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
845847
{ id: "rename", title: "Rename", image: "square.and.pencil" },
846848
...buildThreadTitleRegenerationMenuItems({
847849
supported: props.titleRegenerationSupported,
848-
isRegenerating: thread.titleRegeneration != null,
850+
isRegenerating: isRegeneratingTitle,
849851
}),
850852
...(canTurnIntoProject
851853
? [
@@ -858,12 +860,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
858860
]
859861
: []),
860862
],
861-
[
862-
canTurnIntoProject,
863-
props.titleRegenerationSupported,
864-
thread.runtime,
865-
thread.titleRegeneration,
866-
],
863+
[canTurnIntoProject, props.titleRegenerationSupported, thread.runtime, isRegeneratingTitle],
867864
);
868865
const snoozableCardMenuActions = useMemo<MenuAction[]>(
869866
() => [
@@ -1079,6 +1076,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
10791076
selected
10801077
? selectedThreadRowColors.foregroundClassName
10811078
: rowAppearance.foregroundClassName,
1079+
isRegeneratingTitle && "opacity-55",
10821080
)}
10831081
numberOfLines={2}
10841082
>
@@ -1299,9 +1297,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
12991297
interactionOpacity={rowAppearance.interactionOpacity}
13001298
className={rowAppearance.className}
13011299
accessibilityHint={swipeAccessibilityHint}
1302-
accessibilityLabel={
1303-
props.hasQueuedMessages ? `${thread.title}, messages queued to send` : thread.title
1304-
}
1300+
accessibilityLabel={rowAccessibilityLabel}
13051301
accessibilityRole="button"
13061302
accessibilityState={{ selected }}
13071303
accessibilityActions={rowAccessibilityActions}
@@ -1332,9 +1328,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
13321328
interactionClassName={rowAppearance.interactionClassName}
13331329
interactionOpacity={rowAppearance.interactionOpacity}
13341330
accessibilityHint={swipeAccessibilityHint}
1335-
accessibilityLabel={
1336-
props.hasQueuedMessages ? `${thread.title}, messages queued to send` : thread.title
1337-
}
1331+
accessibilityLabel={rowAccessibilityLabel}
13381332
accessibilityRole="button"
13391333
accessibilityState={{ selected }}
13401334
className={rowAppearance.className}
@@ -1370,6 +1364,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
13701364
selected
13711365
? selectedThreadRowColors.foregroundClassName
13721366
: rowAppearance.mutedForegroundClassName,
1367+
isRegeneratingTitle && "opacity-55",
13731368
)}
13741369
numberOfLines={1}
13751370
>

‎apps/mobile/src/features/threads/thread-work-log.tsx‎

Lines changed: 57 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ import Animated, {
9696
FadeOut,
9797
LinearTransition,
9898
ReduceMotion,
99+
useAnimatedScrollHandler,
99100
useAnimatedStyle,
100101
useSharedValue,
101102
withTiming,
@@ -530,11 +531,13 @@ export function ThreadWorkLog(props: ThreadWorkLogProps) {
530531
props.activities.every((row) => row.projectedItem.item.type === "reasoning")
531532
) {
532533
return (
533-
<ScrollView nestedScrollEnabled className="ml-7 max-h-96 py-1">
534-
{props.activities.map((row) => (
535-
<View key={row.id}>{props.renderReasoning(row.workEntry.detail ?? "")}</View>
536-
))}
537-
</ScrollView>
534+
<WorkLogBlock continues={props.continuesWorkLog}>
535+
<ThreadReasoningGroup
536+
activities={props.activities}
537+
edgeFadeColor={props.edgeFadeColor}
538+
renderReasoning={props.renderReasoning}
539+
/>
540+
</WorkLogBlock>
538541
);
539542
}
540543

@@ -557,6 +560,55 @@ export function ThreadWorkLog(props: ThreadWorkLogProps) {
557560
);
558561
}
559562

563+
function ThreadReasoningGroup(props: {
564+
readonly activities: ReadonlyArray<ThreadFeedActivity>;
565+
readonly edgeFadeColor: string;
566+
readonly renderReasoning: (text: string) => ReactNode;
567+
}) {
568+
const scrollOffset = useSharedValue(0);
569+
const contentHeight = useSharedValue(0);
570+
const viewportHeight = useSharedValue(0);
571+
const onScroll = useAnimatedScrollHandler((event) => {
572+
scrollOffset.set(event.contentOffset.y);
573+
});
574+
const bottomFadeStyle = useAnimatedStyle(() => ({
575+
opacity: Math.min(
576+
1,
577+
Math.max(0, contentHeight.value - viewportHeight.value - scrollOffset.value) /
578+
WORK_GROUP_EDGE_FADE_HEIGHT,
579+
),
580+
}));
581+
582+
return (
583+
<View className="ml-7">
584+
<Animated.ScrollView
585+
nestedScrollEnabled
586+
className="max-h-96"
587+
contentContainerClassName="py-1"
588+
scrollEventThrottle={16}
589+
onScroll={onScroll}
590+
onLayout={(event) => {
591+
viewportHeight.set(event.nativeEvent.layout.height);
592+
}}
593+
onContentSizeChange={(_width, height) => {
594+
contentHeight.set(height);
595+
}}
596+
>
597+
{props.activities.map((row) => (
598+
<View key={row.id}>{props.renderReasoning(row.workEntry.detail ?? "")}</View>
599+
))}
600+
</Animated.ScrollView>
601+
<Animated.View
602+
pointerEvents="none"
603+
className="absolute inset-x-0 bottom-0"
604+
style={[{ height: WORK_GROUP_EDGE_FADE_HEIGHT }, bottomFadeStyle]}
605+
>
606+
<EdgeFade color={props.edgeFadeColor} direction="up" />
607+
</Animated.View>
608+
</View>
609+
);
610+
}
611+
560612
function ThreadWorkGroupList(props: {
561613
readonly activities: ReadonlyArray<ThreadFeedActivity>;
562614
readonly edgeFadeColor: string;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { describe, expect, it } from "vite-plus/test";
2+
3+
import { resolveHighlightLanguage } from "./highlightLanguage";
4+
5+
describe("resolveHighlightLanguage", () => {
6+
it.each([
7+
["src/init.luau", "lua"],
8+
["styles/page.xsl", "xml"],
9+
["styles/page.xslt", "xml"],
10+
])("%s highlights as %s", (path, language) => {
11+
expect(resolveHighlightLanguage({ path })).toBe(language);
12+
});
13+
});

‎apps/mobile/src/lib/highlightLanguage.ts‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
import "@t3tools/client-runtime/assembly-highlighting";
2-
import { getFiletypeFromFileName } from "@pierre/diffs/utils/getFiletypeFromFileName";
2+
import {
3+
getFiletypeFromFileName,
4+
setCustomExtension,
5+
} from "@pierre/diffs/utils/getFiletypeFromFileName";
36

47
import { HIGHLIGHTS_LANGUAGE_IDS } from "./highlights.generated";
58

9+
// Highlights has no lexer for these dialects, so they use their base language's.
10+
setCustomExtension("luau", "lua");
11+
setCustomExtension("xsl", "xml");
12+
setCustomExtension("xslt", "xml");
13+
614
/** The native lexer ID for a @pierre/highlights language name, or 0 (plain text). */
715
export function highlightLanguageId(language: string): number {
816
return Object.hasOwn(HIGHLIGHTS_LANGUAGE_IDS, language) ? HIGHLIGHTS_LANGUAGE_IDS[language]! : 0;

‎apps/mobile/src/lib/useDelayedStatus.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import { useState } from "react";
77

88
import { useDeadlinePassed } from "./clock";
99

10-
export function useDelayedStatus<A>(key: string, value: A | null): A | null {
10+
export function useDelayedStatus<A>(key: string, value: A | null, showDelayMs?: number): A | null {
1111
const [state, setState] = useState(() =>
12-
stepDelayedStatus<A>(null, { key, value, deadlinePassed: false }, Date.now),
12+
stepDelayedStatus<A>(null, { key, value, deadlinePassed: false, showDelayMs }, Date.now),
1313
);
1414
const deadlinePassed = useDeadlinePassed(delayedStatusDeadline(state));
15-
const next = stepDelayedStatus(state, { key, value, deadlinePassed }, Date.now);
15+
const next = stepDelayedStatus(state, { key, value, deadlinePassed, showDelayMs }, Date.now);
1616
if (next !== state) setState(next);
1717
return shownDelayedStatus(next, key);
1818
}

0 commit comments

Comments
 (0)