Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(mobile): 伙伴页保存失败提示出现时滚回可见,滑动转场仅限 iOS
kirozeng3d2dc0df504e
diff --git a/apps/mobile/docs/mobile-design-guide.md b/apps/mobile/docs/mobile-design-guide.mdindex 35eeea2add..31f5f5fa0f 100644--- a/apps/mobile/docs/mobile-design-guide.md+++ b/apps/mobile/docs/mobile-design-guide.md@@ -221,7 +221,7 @@ function Foo() {### iOS 外壳 vs Cindy 内容-- **任务/伙伴切换**:按左任务、右伙伴的顺序做同一套横向滑动转场,抽屉和标题下拉选择都复用 HomeModePanes;不重建已访问列表,不丢搜索或滚动位置。滑动用不回弹的临界阻尼弹簧(参数见 DESIGN.md §14.4),快速反向切换从当前位置继续;系统减弱动态效果或尚未取得该偏好时直接切换。导航栏和顶部模糊固定不动,模糊由 HomeModePanes 统一绘制一层。+- **任务/伙伴切换**:按左任务、右伙伴的顺序做同一套横向滑动转场,抽屉和标题下拉选择都复用 HomeModePanes;不重建已访问列表,不丢搜索或滚动位置。滑动用不回弹的临界阻尼弹簧(参数见 DESIGN.md §14.4),快速反向切换从当前位置继续;系统减弱动态效果或尚未取得该偏好时直接切换。滑动只用于 iOS;Android 顶栏画在各自页面里,滑动会带着顶栏一起走,因此保持直接切换。导航栏和顶部模糊固定不动,模糊由 HomeModePanes 统一绘制一层。- **首页菜单提示点**:可见圆点直径 6pt,原生工具栏用同尺寸画布的有点/无点模板图,避免空的数字徽章被系统放大。图标位置、按钮外框和点击范围不随提示点出现而变化。- **首页导航共用组件(2026-10-13)**:iOS 任务与伙伴首页都调用 platform/chrome/HomeStackHeader,统一系统导航栏、菜单按钮与居中标题宽度;顶部模糊背景由 HomeModePanes 在滑动层外统一绘制。页面只提供标题内容、菜单动作和右侧工具;仅当前可见首页注册导航栏。伙伴标题允许独立对齐,目前保持居中;任务标题保留长名称避让。伙伴列表、安全区、滚动指示器和下拉刷新只计算一次顶部占位。普通页面、聊天身份栏、面板及 Android 导航暂未纳入这一批,不视为全端迁移完成。diff --git a/apps/mobile/src/__tests__/TeammateList.test.tsx b/apps/mobile/src/__tests__/TeammateList.test.tsxindex 0e57d10ed7..c9df24e928 100644--- a/apps/mobile/src/__tests__/TeammateList.test.tsx+++ b/apps/mobile/src/__tests__/TeammateList.test.tsx@@ -2,7 +2,7 @@import { act, createElement as el } from 'react';import { createRoot, type Root } from 'react-dom/client';import { afterEach, beforeEach, expect, it, vi } from 'vitest';-const h = vi.hoisted(() => ({ awaiting: new Set<string>(), list: {} as any }));+const h = vi.hoisted(() => ({ awaiting: new Set<string>(), list: {} as any, scrollToOffset: vi.fn() }));vi.mock('react-native', () => ({View: ({ children, testID, style }: any) => el('div', { 'data-testid': testID, style: Object.assign({}, ...[style].flat().filter(Boolean)) }, children),Pressable: ({ children, testID, accessibilityLabel, disabled, onPress, style }: any) => el('button', { 'data-testid': testID, 'aria-label': accessibilityLabel, disabled, onClick: onPress,@@ -11,7 +11,7 @@ vi.mock('react-native', () => ({Animated: { View: ({ children, testID }: any) => el('div', { 'data-testid': testID }, children), Value: class { setValue() {} }, timing: () => ({ start() {}, stop() {} }), loop: () => ({ start() {}, stop() {} }), sequence: () => ({}) },Easing: { inOut: () => undefined, ease: undefined },StyleSheet: { create: (v: unknown) => v, hairlineWidth: 1 },- FlatList: (props: any) => { h.list = props; const { ListHeaderComponent, ListEmptyComponent, data, renderItem } = props; return el('div', null, ListHeaderComponent, data.length ? data.map((item: any, index: number) => renderItem({ item, index })) : ListEmptyComponent); },+ FlatList: ({ ref, ...props }: any) => { if (ref) ref.current = { scrollToOffset: h.scrollToOffset }; h.list = props; const { ListHeaderComponent, ListEmptyComponent, data, renderItem } = props; return el('div', null, ListHeaderComponent, data.length ? data.map((item: any, index: number) => renderItem({ item, index })) : ListEmptyComponent); },}));vi.mock('@/device-link/DeviceLinkContext', () => ({ useDeviceLink: () => ({ invoke: async () => ({ blocks: [] }) }) }));vi.mock('@/session/remoteSessionStore', () => ({ remoteSessionStore: {@@ -177,6 +177,8 @@ it('reserves the native home bar once for content, scroll indicator and refresh;expect(h.list.scrollIndicatorInsets).toEqual({ top: 106 });expect(h.list.refreshControl.props.progressViewOffset).toBe(106);expect(node.textContent).toContain('Preference could not be saved');+ // A kept-alive list may be scrolled past the header; the failure must come into view.+ expect(h.scrollToOffset).toHaveBeenCalledWith({ offset: 0, animated: true });await act(async () => root.render(el(TeammateList, { ...props,scrollInsetProps: { contentInsetAdjustmentBehavior: 'automatic', automaticallyAdjustsScrollIndicatorInsets: true },})));diff --git a/apps/mobile/src/__tests__/residentHomeList.test.tsx b/apps/mobile/src/__tests__/residentHomeList.test.tsxindex 7d0d371c37..cdbf050813 100644--- a/apps/mobile/src/__tests__/residentHomeList.test.tsx+++ b/apps/mobile/src/__tests__/residentHomeList.test.tsx@@ -7,7 +7,7 @@ import { homeRowPropsEqual } from '../session/homeRowPropsEqual';import { ResidentHomeList, ResidentHomeListProvider } from '../session/ResidentHomeList';const state = vi.hoisted(() => ({- hydrated: true, reduceMotion: true, progress: null as any, slide: null as any, mode: 'tasks', segments: ['devices'], width: 1000, anchorWidth: 1000, mounts: 0, unmounts: 0,+ platform: 'ios', spring: vi.fn((target: number) => target), hydrated: true, reduceMotion: true, progress: null as any, slide: null as any, mode: 'tasks', segments: ['devices'], width: 1000, anchorWidth: 1000, mounts: 0, unmounts: 0,}));vi.mock('../session/useHomeMode', () => ({ useHomeMode: () => ({ mode: state.mode, hydrated: state.hydrated }) }));vi.mock('expo-router', () => ({ useSegments: () => state.segments }));@@ -24,6 +24,7 @@ vi.mock('react-native', async () => {const React = await import('react');return {StyleSheet: { create: (v: any) => v },+ Platform: { get OS() { return state.platform; } },View: React.forwardRef(({ children, onLayout, ...props }: any, ref) => {React.useImperativeHandle(ref, () => ({measureLayout: (_: any, callback: any) => callback(0, 80, state.anchorWidth, 720),@@ -38,13 +39,13 @@ vi.mock('react-native-reanimated', async () => {return { default: { View: ({ children, pointerEvents }: any) => <div data-host data-pointer={pointerEvents}>{children}</div> },useSharedValue: (value: number) => { const ref = useRef({ value }); state.progress = ref.current; return ref.current; },useAnimatedStyle: (factory: () => any) => { state.slide = factory; return factory(); },- cancelAnimation: () => {}, withSpring: (target: number) => target,+ cancelAnimation: () => {}, withSpring: (target: number) => state.spring(target),};});const roots: ReturnType<typeof createRoot>[] = [];afterEach(() => {act(() => roots.splice(0).forEach(root => root.unmount()));- state.hydrated = true; state.reduceMotion = true; state.mode = 'tasks'; state.segments = ['devices']; state.width = 1000; state.anchorWidth = 1000;+ state.platform = 'ios'; state.spring.mockClear(); state.hydrated = true; state.reduceMotion = true; state.mode = 'tasks'; state.segments = ['devices']; state.width = 1000; state.anchorWidth = 1000;state.mounts = 0; state.unmounts = 0;});const ListProbe = memo(function ListProbe({ onSelect }: { onSelect(): void }) {@@ -125,3 +126,12 @@ it('slides the wide resident list out with its home pane without remounting or istate.progress.value = 1; expect(state.slide().opacity).toBe(0);expect(state.mounts).toBe(1); expect(state.unmounts).toBe(0);});++it('switches Android home modes in place, because each pane draws its own bar', () => {+ state.reduceMotion = false; state.platform = 'android';+ const host = document.createElement('div'); const root = createRoot(host); roots.push(root);+ const render = () => act(() => root.render(<Scene detail={false} homeSelect={() => {}} />));+ render(); state.mode = 'teammates'; render();+ expect(state.spring).not.toHaveBeenCalled();+ expect(state.progress.value).toBe(1);+});diff --git a/apps/mobile/src/session/ResidentHomeList.tsx b/apps/mobile/src/session/ResidentHomeList.tsxindex 4a7aeb3e01..c4152b359f 100644--- a/apps/mobile/src/session/ResidentHomeList.tsx+++ b/apps/mobile/src/session/ResidentHomeList.tsx@@ -1,6 +1,6 @@import { useHomeMode } from './useHomeMode';import { createContext, useCallback, useContext, useId, useLayoutEffect, useMemo, useRef, useState, type ReactNode } from 'react';-import { StyleSheet, View } from 'react-native';+import { Platform, StyleSheet, View } from 'react-native';import Animated, { useAnimatedStyle } from 'react-native-reanimated';import { HomeModeProgressContext, useHomeModeProgress } from './HomeModeTransition';import { useSegments } from 'expo-router';@@ -45,7 +45,8 @@ export function ResidentHomeListProvider({ children }: { children: ReactNode })const { mode, hydrated } = useHomeMode();const homeRoute = segments.length === 0 || segments[0] === 'index'|| (segments[0] === 'devices' && (segments.length === 1 || segments[1] === 'index'));- const progress = useHomeModeProgress(mode, homeRoute, hydrated);+ // Android pages draw their own bar inside each pane, so sliding them would move it; they switch in place.+ const progress = useHomeModeProgress(mode, homeRoute && Platform.OS === 'ios', hydrated);// Keep the outgoing resident list drawn during the slide, but never interactive over the new tab.const visible = enabled && ((mode === 'tasks' && homeRoute)|| (segments[0] === 'sessions' && segments[1] === '[sessionId]'));diff --git a/apps/mobile/src/session/TeammateList.tsx b/apps/mobile/src/session/TeammateList.tsxindex b1c1d5f7b3..737d88eaa2 100644--- a/apps/mobile/src/session/TeammateList.tsx+++ b/apps/mobile/src/session/TeammateList.tsx@@ -92,6 +92,10 @@ export function TeammateList({ items, loading, refreshing, error, isOnline, connconst { colors } = useTheme();const styles = useThemedStyles(makeStyles);const now = useMinuteNow();+ const listRef = useRef<FlatList<ListEntry>>(null);+ // The notice sits in the list header; a kept-alive list may be scrolled past it when it appears.+ const showsNotice = !!notice;+ useEffect(() => { if (showsNotice) listRef.current?.scrollToOffset({ offset: 0, animated: true }); }, [showsNotice]);const [query, setQuery] = useState('');const awaiting = useAwaitingSessions(items);const entries = useMemo<ListEntry[]>(() => {@@ -206,7 +210,7 @@ export function TeammateList({ items, loading, refreshing, error, isOnline, connonPress={() => groups.onSelect(entry.row)} />;};if (embedded) return <View testID="teammates.list">{notice}{header}{entries.length ? entries.map(renderEntry) : empty}</View>;- return <FlatList {...scrollInsetProps} style={styles.list} contentContainerStyle={[styles.content, topInset !== undefined && { paddingTop: topInset }]}+ return <FlatList ref={listRef} {...scrollInsetProps} style={styles.list} contentContainerStyle={[styles.content, topInset !== undefined && { paddingTop: topInset }]}contentInsetAdjustmentBehavior={topInset !== undefined ? 'never' : scrollInsetProps?.contentInsetAdjustmentBehavior}automaticallyAdjustsScrollIndicatorInsets={topInset !== undefined ? false : scrollInsetProps?.automaticallyAdjustsScrollIndicatorInsets}scrollIndicatorInsets={topInset !== undefined ? { top: topInset } : undefined} data={entries} keyExtractor={(entry) => `${entry.kind}:${entry.row.key}`}diff --git a/docs/design-rules/DESIGN.md b/docs/design-rules/DESIGN.mdindex b3369fe23c..5653cadc5e 100644--- a/docs/design-rules/DESIGN.md+++ b/docs/design-rules/DESIGN.md@@ -593,7 +593,7 @@ download happens in the normal startup Splash, not in the row.### Mobile iOS navigation chrome / iPhone Duo-- Home modes are ordered tabs: Tasks on the left, Teammates on the right (owner decision, 2026-10-13). All mode-selection entry points, including drawer tabs and title scope menus, use the same horizontal slide via HomeModePanes / HomeModeTransition. Switching to Teammates moves content left; switching back moves it right. One shared progress owned by `ResidentHomeListProvider` drives the panes and the wide resident task list over the same slide distance; it moves on the critically damped spring registered in §14.4. Retain both visited lists and their positions, retarget interrupted slides from the current position, and snap for reduced/unknown motion preference or initial preference restoration. The resident list follows without remounting; inactive pages cannot intercept touches or accessibility focus. This is a selection transition, not a new horizontal gesture that competes with list controls.+- Home modes are ordered tabs: Tasks on the left, Teammates on the right (owner decision, 2026-10-13); the slide below is iOS-only, Android switches in place because its bar lives inside each pane. All mode-selection entry points, including drawer tabs and title scope menus, use the same horizontal slide via HomeModePanes / HomeModeTransition. Switching to Teammates moves content left; switching back moves it right. One shared progress owned by `ResidentHomeListProvider` drives the panes and the wide resident task list over the same slide distance; it moves on the critically damped spring registered in §14.4. Retain both visited lists and their positions, retarget interrupted slides from the current position, and snap for reduced/unknown motion preference or initial preference restoration. The resident list follows without remounting; inactive pages cannot intercept touches or accessibility focus. This is a selection transition, not a new horizontal gesture that competes with list controls.- Home menu attention is a **6pt visible dot**, not a numeric badge. The normal and attention menu images share a transparent 26pt canvas with the same centered narrow 20pt glyph, so attention never shifts the menu artwork or changes the native hit target. Use semantic template tint in both modes; do not use an empty Stack.Toolbar.Badge (the current header bridge creates a large string badge). Duo uses the same template; the Android teammate fallback uses the same 6pt dot diameter. Numeric counts and connection/list status dots keep their separate roles and sizes.- Task and Teammate home share the iOS navigation container, menu control and centered-title width through HomeStackHeader (2026-10-13). The bar's measured-height blur is drawn once by HomeModePanes outside the sliding panes, because the native bar itself does not slide. Only the active home pane registers native chrome; hidden panes keep their content state. The home menu uses the slightly narrower three-line template in assets/navigation/menu.svg (owner refinement, 2026-10-13); only artwork changes, not button geometry or hit targets. System toolbars own ordinary menu/create/action geometry, with the existing Duo top-left exception shared by both homes. **Title alignment is intentionally page-specific**: task scope titles retain their long-name toolbar avoidance, while the Teammates title stays centered. Shared chrome must not force the teammate title to inherit task alignment. The teammate list reserves the measured native bar height once, including its scroll indicator and refresh position. Android retains its existing fallback in this batch; chat, secondary-page and sheet headers are not claimed migrated.@@ -1092,7 +1092,7 @@ long duration to leak into any other hover or transition.**Mobile list disclosure rhythm (owner request, 2026-09-30).** On mobile, expanding and collapsing list groups (home pinned / shared / project / conversation groups, automation run groups on the home and device pages, the collapsible Settings debug group) and task-row moves from archive, unarchive, pin or unpin (rows leaving stay visible while the rows below close over them, then fade) follow the iOS system list rhythm instead of the Desktop `base` tier (200ms): 225ms quadratic ease-out with no overshoot, reaching about 90% of the travel within 150ms (the owner asked for the first 450ms version to be halved the same day). The group opens from under its header: list cells clip their content while their position and height animate, new rows sit at their final positions and are revealed as the group grows, and the rows below move down in step; new rows do not fade in place. Collapsing reverses this: removed rows stay visible while the group closes over them and fade only near the end. The disclosure chevron switches without animation. The duration lives in mobile's `listDisclosureMotion` token and the shared implementation is `apps/mobile/src/session/listDisclosureTransition.tsx` (Reanimated layout animations, attached only during the transition window; React Native `LayoutAnimation` is a no-op in this app because Reanimated owns the Fabric mounting layer). Reduced motion switches instantly. This exception does not apply to Desktop, sheets, dialogs, or other panels.-**Mobile home mode slide (owner request, 2026-10-13).** Switching the mobile home between Tasks (left) and Teammates (right) — from the drawer or the title menu — slides the content horizontally on a critically damped spring (mass 1, stiffness 320, damping 36, overshoot clamped: about a 0.35s response, no visible bounce) instead of a duration tier. A reversal mid-slide is retargeted from the current position without restarting an ease-in-out, so it responds at once and a short remaining distance settles quickly. The parameters live in `HOME_MODE_SLIDE_SPRING` (`apps/mobile/src/session/HomeModeTransition.ts`). The navigation bar, its title and its blur do not slide. Reduced or not-yet-known motion preference switches instantly. This exception does not apply to any other surface.+**Mobile home mode slide (owner request, 2026-10-13).** Switching the mobile home between Tasks (left) and Teammates (right) — from the drawer or the title menu — slides the content horizontally on a critically damped spring (mass 1, stiffness 320, damping 36, overshoot clamped: about a 0.35s response, no visible bounce) instead of a duration tier. A reversal mid-slide is retargeted from the current position without restarting an ease-in-out, so it responds at once and a short remaining distance settles quickly. The parameters live in `HOME_MODE_SLIDE_SPRING` (`apps/mobile/src/session/HomeModeTransition.ts`). The navigation bar, its title and its blur do not slide. Reduced or not-yet-known motion preference switches instantly. iOS only: Android pages still draw their own bar inside each pane, so Android switches in place until that bar is lifted out of the panes. This exception does not apply to any other surface.**Mobile image viewer edge elasticity (owner request, 2026-10-10).** In the mobile full-screen image viewer (`apps/mobile/src/session/ImageLightbox.tsx`), direct manipulation follows the system Photos physics instead of hard stops: a zoomed one-finger pan may run past the image edge with rubber-band resistance (UIScrollView coefficient 0.55 over the container size), and a pinch may overshoot 1x / the maximum zoom with the same resistance. On release, anything out of bounds returns on a near-critically damped spring (no visible oscillation, about 0.3s); an in-bounds release continues with inertial decay that may briefly overrun the edge and return; a touch catches it in place. Scale and translation settle on the same spring so the point under the fingers stays put. These are physics responses to the hand, not duration-tier transitions, so they use spring/decay parameters rather than motion tokens; the parameters and decisions live in `imageLightboxModel.ts`. A single image at 1x keeps the native horizontal edge bounce. This exception does not apply to any other surface.