Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
fix(mobile): 底部活动提示保留位置,发送后不再跳动
Dash900593bcc6b3
diff --git a/apps/mobile/app/sessions/[sessionId].tsx b/apps/mobile/app/sessions/[sessionId].tsxindex 54239ce63d..94262141c5 100644--- a/apps/mobile/app/sessions/[sessionId].tsx+++ b/apps/mobile/app/sessions/[sessionId].tsx@@ -10571,32 +10571,39 @@ function SessionScreenContent() {例外:新建任务慢发送时这一行要说明卡在哪一步,不能被同步占位藏掉。判据必须带 messageCount:syncingWhileEmpty 只要 loading 就为真,而收口后还会再来几轮 load(实测日志),只看它会让已有消息的会话反复熄灭活动条。 */}- {!companionChat && (showComposerActivity || pendingRecoveryStatus) && (creationSlowPhase !== null || !(syncingWhileEmpty && !hasRenderedMessages)) ? (+ {/* 保留活动行的位置:提示出现、切换与结束不改变消息列表底部留白。 */}+ {!companionChat ? (<View+ pointerEvents="box-none"style={[styles.composerActivityFrame,- { paddingHorizontal: composerTouchLayout.composerPaddingHorizontal },+ {+ paddingHorizontal: composerTouchLayout.composerPaddingHorizontal,+ minHeight: 44,+ },]}>- <ComposerActivityStatus- availableRegion={composerRegion}- key={JSON.stringify([auth.accountGeneration, deviceId, sessionId])}- sessionKey={JSON.stringify([auth.accountGeneration, deviceId, sessionId])}- reconnectAttempt={remoteSessionRunStatus.reconnectAttempt}- pendingRecovery={pendingRecoveryStatus}- sideTaskRunning={remoteSessionRunStatus.sideTaskRunning}- startedAt={composerActivityStartedAtMs}- rateStartedAt={remoteSessionRunStatus.startedAt}- streaming={isSessionStreaming}- tokenUsage={composerActivityTokenUsage}- outputTokens={remoteSessionRunStatus.outputTokens}- generationDurationMs={remoteSessionRunStatus.generationDurationMs}- generationReliable={remoteSessionRunStatus.generationReliable}- tokenSpeed={remoteSessionRunStatus.tokenSpeed}- generationActive={remoteSessionRunStatus.generationActive}- visible={showComposerActivity}- slowSendPhase={creationSlowPhase}- />+ {(showComposerActivity || pendingRecoveryStatus) && (creationSlowPhase !== null || !(syncingWhileEmpty && !hasRenderedMessages)) ? (+ <ComposerActivityStatus+ availableRegion={composerRegion}+ key={JSON.stringify([auth.accountGeneration, deviceId, sessionId])}+ sessionKey={JSON.stringify([auth.accountGeneration, deviceId, sessionId])}+ reconnectAttempt={remoteSessionRunStatus.reconnectAttempt}+ pendingRecovery={pendingRecoveryStatus}+ sideTaskRunning={remoteSessionRunStatus.sideTaskRunning}+ startedAt={composerActivityStartedAtMs}+ rateStartedAt={remoteSessionRunStatus.startedAt}+ streaming={isSessionStreaming}+ tokenUsage={composerActivityTokenUsage}+ outputTokens={remoteSessionRunStatus.outputTokens}+ generationDurationMs={remoteSessionRunStatus.generationDurationMs}+ generationReliable={remoteSessionRunStatus.generationReliable}+ tokenSpeed={remoteSessionRunStatus.tokenSpeed}+ generationActive={remoteSessionRunStatus.generationActive}+ visible={showComposerActivity}+ slowSendPhase={creationSlowPhase}+ />+ ) : null}</View>) : null}{/* Desktop BotWorkingStatus: a teammate's paced public status stays above the composer,diff --git a/apps/mobile/src/__tests__/SlowSendNotice.test.tsx b/apps/mobile/src/__tests__/SlowSendNotice.test.tsxindex 8ab19147e4..28226adbea 100644--- a/apps/mobile/src/__tests__/SlowSendNotice.test.tsx+++ b/apps/mobile/src/__tests__/SlowSendNotice.test.tsx@@ -7,7 +7,9 @@ import { i18n } from '@/i18n';vi.mock('react-native', async () => {const { createElement } = await import('react');- return { View: ({ children }: { children?: ReactNode }) => createElement('div', null, children) };+ return {+ View: ({ children }: { children?: ReactNode }) => createElement('div', null, children),+ };});// The pill itself is the task page's "思考中" pill; here only its label matters.vi.mock('@/session/ComposerActivityPill', async () => {@@ -38,17 +40,21 @@ afterEach(() => {});describe('SlowSendNotice', () => {- it('adds no text or layout for fast sends, including after completion', async () => {+ it('keeps an empty status slot for fast sends, including after completion', async () => {act(() => root.render(<SlowSendNotice startedAt={0} phase="uploading" />));await act(async () => { await vi.advanceTimersByTimeAsync(7_999); });- expect(host.childElementCount).toBe(0);+ expect(host.childElementCount).toBe(1);+ expect(host.textContent).toBe('');act(() => root.render(<SlowSendNotice startedAt={null} phase="uploading" />));await act(async () => { await vi.advanceTimersByTimeAsync(8_000); });- expect(host.childElementCount).toBe(0);+ expect(host.childElementCount).toBe(1);+ expect(host.textContent).toBe('');expect(vi.getTimerCount()).toBe(0);});it('shows the current phase after eight seconds without resetting on phase changes', async () => {+ act(() => root.render(<SlowSendNotice startedAt={null} phase="uploading" />));+ const slot = host.firstElementChild;act(() => root.render(<SlowSendNotice startedAt={0} phase="uploading" />));await act(async () => { await vi.advanceTimersByTimeAsync(7_000); });act(() => root.render(<SlowSendNotice startedAt={0} phase="connecting" />));@@ -58,8 +64,10 @@ describe('SlowSendNotice', () => {expect(host.querySelector('[data-pill="activity"]')?.textContent).toBe('正在连接电脑…');act(() => root.render(<SlowSendNotice startedAt={0} phase="sending" />));expect(host.textContent).toBe('正在发送消息…');+ expect(host.firstElementChild).toBe(slot);act(() => root.render(<SlowSendNotice startedAt={8_000} phase="uploading" />));- expect(host.childElementCount).toBe(0);+ expect(host.childElementCount).toBe(1);+ expect(host.textContent).toBe('');});it('preserves elapsed time when the destination page mounts after handoff', async () => {diff --git a/apps/mobile/src/session/SlowSendNotice.tsx b/apps/mobile/src/session/SlowSendNotice.tsxindex 68e753f14c..beda8622c9 100644--- a/apps/mobile/src/session/SlowSendNotice.tsx+++ b/apps/mobile/src/session/SlowSendNotice.tsx@@ -20,16 +20,16 @@ export function useSlowSendVisible(startedAt: number | null): boolean {}/**- * New-task page only: before handoff there is no activity row yet, so a slow send shows the same- * pill the task page uses for "思考中", and the task page continues it in place. Fast sends add nothing.+ * Keep the status row in place before handoff too. A slow send only changes its contents,+ * so the form stays still; fast sends show no status text.*/export function SlowSendNotice({ startedAt, phase }: { startedAt: number | null; phase: SlowSendPhase }) {const { t } = useTranslation();const styles = useThemedStyles(makeComposerActivityPillStyles);- if (!useSlowSendVisible(startedAt)) return null;+ const visible = useSlowSendVisible(startedAt);return (<View pointerEvents="none" style={styles.composerActivityStatus} testID="session.slowSendNotice">- <ComposerActivityPill label={t(`session.new.slowSend.${phase}`)} live />+ {visible ? <ComposerActivityPill label={t(`session.new.slowSend.${phase}`)} live /> : null}</View>);}diff --git a/docs/dev-rules/mobile-development.md b/docs/dev-rules/mobile-development.mdindex a087237bb0..dd2a114aa4 100644--- a/docs/dev-rules/mobile-development.md+++ b/docs/dev-rules/mobile-development.md@@ -100,6 +100,8 @@ iOS 的系统选图器在确认后立即把选中项交给现有附件队列。- 非本机发起的任务来源未确认时不挂载远端任务内容,但必须显示读取状态和返回入口;读取失败、空记录或超时允许手动重读当前任务,不重置共享设备连接。账号或设备切换后忽略旧读取结果。+- 新建页与普通任务页始终保留底部活动提示行的位置(沿用活动行的 44pt 最小高度),+ 慢发送、思考中和运行结束只改变行内内容,不因提示出现或消失改变消息列表与输入区的位置。- 本地新建任务立即显示乐观消息与输入框,不因远端来源尚未返回而显示整页等待卡。仅创建失败时自动带回草稿与附件并返回编辑,不提供重试、返回编辑等选择菜单;已建成任务的首条消息发送失败仍在原任务内恢复,不退回新建页。失败原因带到编辑页。