Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
feat(mobile): 支持 Token 速度图表及触摸浮层 (#4878)
Dasheaca17e7a722
diff --git a/apps/desktop/src/renderer/features/cc-agent/lib/runningTokenRateHistory.ts b/apps/desktop/src/renderer/features/cc-agent/lib/runningTokenRateHistory.tsindex 81434368a3..5ef3efa6a1 100644--- a/apps/desktop/src/renderer/features/cc-agent/lib/runningTokenRateHistory.ts+++ b/apps/desktop/src/renderer/features/cc-agent/lib/runningTokenRateHistory.ts@@ -1,147 +1,10 @@-interface RateCounters {- durationMs: number;- outputTokens: number;-}--export interface RateSample extends RateCounters {- /** Cumulative measured generation time across turns, excluding unmeasured gaps. */- durationMs: number;- rate: number;-}--// Millisecond-scale usage batches are not meaningful throughput measurements.-const MIN_SAMPLE_DURATION_MS = 1000;-export const RATE_SAMPLE_FRESH_MS = 60_000;--export interface RateHistory {- startedAt: number | null;- baseline: RateCounters | null;- // Track resets even while the measurement baseline waits for a full window.- lastReport: RateCounters | null;- samples: RateSample[];- peak: number;- latestRate: number | null;- latestSampleAt?: number;-}--export function emptyRateHistory(startedAt: number | null): RateHistory {- return { startedAt, baseline: null, lastReport: null, samples: [], peak: 0, latestRate: null };-}--const MAX_RATE_SAMPLES = 60;--/** Real usage reports are sparse: this is the latest measured interval, not an instantaneous rate. */-export function recordRunningTokenRate(- history: RateHistory,- input: {- startedAt: number | null;- outputTokens: number;- generationDurationMs: number;- generationReliable: boolean;- now?: number;- },-): RateHistory {- const { outputTokens, generationDurationMs, generationReliable } = input;- // Terminal status clears startedAt before the status bar finishes its linger/fade.- // Keep its identity so a final paired usage report can still be recorded.- const startedAt = input.startedAt ?? history.startedAt;- const previous = history.lastReport;- const reset =- history.startedAt !== startedAt ||- (previous !== null &&- (generationDurationMs < previous.durationMs || outputTokens < previous.outputTokens));- // Reset only the measurement baseline; completed intervals remain in the chart.- const current = reset- ? { ...history, startedAt, baseline: null, lastReport: null, latestRate: null }- : history;- if (- !generationReliable ||- startedAt === null ||- !Number.isFinite(outputTokens) ||- !Number.isFinite(generationDurationMs) ||- outputTokens < 0 ||- generationDurationMs < 0- ) {- return current.baseline || current.lastReport || current.latestRate !== null- ? { ...current, baseline: null, lastReport: null, latestRate: null }- : current;- }- if (- previous?.durationMs === generationDurationMs &&- previous.outputTokens === outputTokens &&- !reset- ) {- return current;- }- const baseline = { durationMs: generationDurationMs, outputTokens };- const observed = { ...current, lastReport: baseline };- if (!current.baseline) {- // Opening midway through a turn must not label its cumulative average as a recent sample.- return { ...observed, baseline };- }- const durationDelta = generationDurationMs - current.baseline.durationMs;- const tokenDelta = outputTokens - current.baseline.outputTokens;- // A time-only refresh cannot close a token interval: the matching usage may- // arrive later in a batch. Keep both counters anchored to the last sample.- // An explicitly empty output stream can still measure zero throughput.- if (outputTokens > 0 && outputTokens === previous?.outputTokens) return observed;- if (durationDelta === 0) {- // A corrected count without a matching time cannot produce a rate.- return { ...observed, baseline };- }- // Keep accumulating both counters, including at completion. An unfinished- // window must not replace the last valid rate or inflate the observed peak.- if (durationDelta < MIN_SAMPLE_DURATION_MS) return observed;- const rate = (tokenDelta * 1000) / durationDelta;- if (!Number.isFinite(rate)) return { ...observed, baseline };- const samples = [- ...current.samples.slice(-(MAX_RATE_SAMPLES - 1)),- {- durationMs: (current.samples.at(-1)?.durationMs ?? 0) + durationDelta,- outputTokens,- rate,- },- ];- return {- ...observed,- baseline,- samples,- peak: Math.max(...samples.map((sample) => sample.rate)),- latestRate: rate,- latestSampleAt: input.now ?? Date.now(),- };-}--const MAX_CACHED_SESSIONS = 20;--/**- * 进程内按会话缓存速度历史:切到其他任务再切回同一任务时图表不清零。- * 刻意不落盘(磁盘持久化超出本功能边界),应用重启后自然清零。- */-const rateHistoryBySession = new Map<string, RateHistory>();--export function loadCachedRateHistory(sessionKey: string): RateHistory | null {- const cached = rateHistoryBySession.get(sessionKey);- if (!cached) return null;- // Map 按插入序迭代:读到的会话移到队尾,淘汰从队头取最久未用的。- rateHistoryBySession.delete(sessionKey);- rateHistoryBySession.set(sessionKey, cached);- return cached;-}--export function saveCachedRateHistory(sessionKey: string, history: RateHistory): void {- // 没有采样点就没有可恢复的图表,不必占缓存名额。- if (history.samples.length === 0) return;- rateHistoryBySession.delete(sessionKey);- rateHistoryBySession.set(sessionKey, history);- while (rateHistoryBySession.size > MAX_CACHED_SESSIONS) {- const oldestKey = rateHistoryBySession.keys().next().value;- if (oldestKey === undefined) break;- rateHistoryBySession.delete(oldestKey);- }-}--/** 整体清空;供测试与将来的登出/数据清理流程使用。 */-export function clearRateHistoryCache(): void {- rateHistoryBySession.clear();-}+export {+ clearRateHistoryCache,+ emptyRateHistory,+ loadCachedRateHistory,+ recordRunningTokenRate,+ saveCachedRateHistory,+ RATE_SAMPLE_FRESH_MS,+ type RateHistory,+ type RateSample,+} from '@cindy/maker-shared/usage-format';diff --git a/apps/mobile/app/sessions/[sessionId].tsx b/apps/mobile/app/sessions/[sessionId].tsxindex 473688a859..206f197a77 100644--- a/apps/mobile/app/sessions/[sessionId].tsx+++ b/apps/mobile/app/sessions/[sessionId].tsx@@ -1,10 +1,11 @@+import { RunningTokenRatePopover } from '@/session/RunningTokenRatePopover';import { companionConversationItems } from '@/session/companionConversationPresentation';import { HomeHeaderGlassButton } from '@/session/HomeHeaderGlassButton';import { HomeNewTaskButton } from '@/session/HomeNewTaskButton';import { RecentMessageHistories, MessageHistoryOverlay } from '@/session/RecentMessageHistories';import { rememberRecentTask } from '@/session/recentTasks';import { SystemNavigationBack, useSystemNavigationBack } from '@/platform/chrome/SystemNavigationBack';-import { keyboardControlRegion } from '@/platform/windowGeometry';+import { keyboardControlRegion, type LayoutRect } from '@/platform/windowGeometry';import { useAdaptiveWindow, PaneViewportProvider } from '@/platform/AdaptiveWindowContext';import { useSessionHeaderHeight } from '@/session/useSessionHeaderHeight';import { sessionPaneLayout } from '@/session/sessionPaneLayout';@@ -2655,8 +2656,8 @@ export default function SessionScreen() {const horizontalSystemHeader = Platform.OS === 'ios' && adaptiveWindow.barEdge === 'none'&& !paneLayout.persistent && !shareSelectionActive && !companionChat;const composerRegion = keyboardControlRegion(adaptiveWindow, keyboardState.height);- const detailViewport = useMemo(() => ({ width: paneLayout.detail.width, height: windowDimensions.height }),- [paneLayout.detail.width, windowDimensions.height]);+ const detailViewport = useMemo(() => ({ x: paneLayout.detail.x, y: paneLayout.detail.y, width: paneLayout.detail.width, height: windowDimensions.height }),+ [paneLayout.detail.x, paneLayout.detail.y, paneLayout.detail.width, windowDimensions.height]);const nativeShellLayout = useMemo(() => buildSessionNativeShellLayout({attachmentPickerOpen: false,keyboardHeight: keyboardState.height,@@ -9285,21 +9286,41 @@ export default function SessionScreen() {/>) : null}{!isSharedTaskAccessRevoked && <View+ pointerEvents="box-none"+ testID="session.bottomViewport"+ style={[+ StyleSheet.absoluteFill,+ { zIndex: 10 },+ // Clip the complete touch tree at the usable region, not at the+ // measured composer height. Held cards can extend above the input+ // while neither cards nor oversized inputs can cross a reservation.+ adaptiveWindow.regions.length > 0 && {+ left: Math.max(0, composerRegion.x - paneLayout.detail.x),+ right: Math.max(0, paneLayout.detail.x + paneLayout.detail.width - composerRegion.x - composerRegion.width),+ top: composerRegion.y,+ bottom: windowDimensions.height - composerRegion.y - composerRegion.height,+ overflow: 'hidden',+ },+ ]}+ ><Viewref={bottomOverlayRef}onLayout={handleBottomOverlayLayout}pointerEvents="box-none"style={[styles.sessionBottomLayer,+ // The outer viewport owns reservation clipping; keep the held card+ // attached to its original responder for release/cancel delivery.+ sessionOperationLayout.composerSlot === 'editable' && { overflow: 'visible' },adaptiveWindow.regions.length > 0 && {- left: Math.max(0, composerRegion.x - paneLayout.detail.x),- right: Math.max(0, paneLayout.detail.x + paneLayout.detail.width - composerRegion.x - composerRegion.width),maxHeight: composerRegion.height,},nativeComposerFrameAvailable && sessionOperationLayout.composerSlot === 'editable' && !shareSelectionActive&& styles.sessionBottomFloating,shareSelectionActive && { overflow: 'visible' },- { bottom: Math.max(nativeShellLayout.keyboardBottomInset, adaptiveWindow.regions.length > 0- ? windowDimensions.height - composerRegion.y - composerRegion.height - insets.bottom : 0) },+ // Region already excludes the keyboard. Its boundary clips only+ // the existing safe-area padding, without lifting the input twice.+ { bottom: adaptiveWindow.regions.length > 0+ ? -insets.bottom : nativeShellLayout.keyboardBottomInset },]}testID="session.bottomLayer">@@ -9452,6 +9473,9 @@ export default function SessionScreen() {]}><ComposerActivityStatus+ availableRegion={composerRegion}+ key={JSON.stringify([auth.accountGeneration, deviceId, sessionId])}+ sessionKey={JSON.stringify([auth.accountGeneration, deviceId, sessionId])}reconnectAttempt={remoteSessionRunStatus.reconnectAttempt}sideTaskRunning={remoteSessionRunStatus.sideTaskRunning}startedAt={composerActivityStartedAtMs}@@ -9559,7 +9583,7 @@ export default function SessionScreen() {) : null}</View></View>- }+ </View>}</ComposerKeyboardAvoidingView></PaneViewportProvider>@@ -11201,6 +11225,8 @@ function ComposerRuntimePill({}function ComposerActivityStatus({+ availableRegion,+ sessionKey,reconnectAttempt,sideTaskRunning,startedAt,@@ -11211,6 +11237,8 @@ function ComposerActivityStatus({generationActive,visible,}: {+ availableRegion: LayoutRect;+ sessionKey: string;reconnectAttempt: RemoteSessionRunStatus['reconnectAttempt'];sideTaskRunning: boolean;startedAt: number | null;@@ -11245,15 +11273,46 @@ function ComposerActivityStatus({const tokenCount = formatComposerActivityTokenCount(tokenUsage);const tokenText = t('session.screen.tokenCount', { tokens: tokenCount });const tokenA11yText = t('session.screen.tokenCountFull', { tokens: tokenCount });+ const showElapsedOnly = sideTaskRunning || Boolean(reconnectAttempt);const rateValue = formatComposerActivityRateValue(outputTokens,generationDurationMs,- generationReliable,+ generationReliable && !showElapsedOnly,);const rateText = rateValue? t('session.screen.tokenRate', { rate: rateValue }): null;- const showUsageMeta = Boolean(rateText) || tokenUsage > 0;+ const showUsageMeta = !showElapsedOnly && (Boolean(rateText) || tokenUsage > 0);+ const canShowRateDetails = rateValue !== null;+ const usageMeta = (+ <View style={[styles.composerActivityPill, styles.composerActivityMeta]}>+ <BlurBackdrop intensity={20} overlayColor={colors.surfaceTranslucent} style={styles.composerActivityPillBackdrop} />+ <Text style={styles.composerActivityMetaText}>{elapsedText}</Text>+ {showUsageMeta ? (+ <>+ <Text style={styles.composerActivityMetaText}>·</Text>+ {rateText ? (+ <Text+ accessibilityLabel={rateText}+ style={styles.composerActivityMetaText}+ >+ {rateText}+ </Text>+ ) : (+ <>+ <ArrowDown color={colors.textSecondary} size={iconSize.xs} strokeWidth={iconStroke.regular} />+ <Text+ accessibilityLabel={tokenA11yText}+ style={styles.composerActivityMetaText}+ >+ {tokenText}+ </Text>+ </>+ )}+ </>+ ) : null}+ </View>+ );// 三类进度共用这一个 attempt 字段, 但说法必须分开: 模型容量、请求限流与传输层重连// 的用户含义不同,混用会把用户引向错误的排查方向。const activityText = reconnectAttempt@@ -11268,11 +11327,11 @@ function ComposerActivityStatus({return (<View- pointerEvents="none"+ pointerEvents="box-none"style={styles.composerActivityStatus}testID="session.composerActivityStatus">- <View style={[styles.composerActivityPill, styles.composerActivityPrimary]}>+ <View pointerEvents="none" style={[styles.composerActivityPill, styles.composerActivityPrimary]}><BlurBackdrop intensity={20} overlayColor={colors.surfaceTranslucent} style={styles.composerActivityPillBackdrop} /><Sparkles color={colors.statusAccent} size={iconSize.sm} strokeWidth={iconStroke.regular} /><Text numberOfLines={1} style={styles.composerActivityStatusText}>{activityText}</Text>@@ -11282,33 +11341,19 @@ function ComposerActivityStatus({</Text>) : null}</View>- <View style={[styles.composerActivityPill, styles.composerActivityMeta]}>- <BlurBackdrop intensity={20} overlayColor={colors.surfaceTranslucent} style={styles.composerActivityPillBackdrop} />- <Text style={styles.composerActivityMetaText}>{elapsedText}</Text>- {!sideTaskRunning && showUsageMeta ? (- <>- <Text style={styles.composerActivityMetaText}>·</Text>- {rateText ? (- <Text- accessibilityLabel={rateText}- style={styles.composerActivityMetaText}- >- {rateText}- </Text>- ) : (- <>- <ArrowDown color={colors.textSecondary} size={iconSize.xs} strokeWidth={iconStroke.regular} />- <Text- accessibilityLabel={tokenA11yText}- style={styles.composerActivityMetaText}- >- {tokenText}- </Text>- </>- )}- </>- ) : null}- </View>+ <RunningTokenRatePopover+ key={sessionKey}+ enabled={canShowRateDetails}+ availableRegion={availableRegion}+ sessionKey={sessionKey}+ startedAt={startedAt}+ outputTokens={outputTokens}+ generationDurationMs={generationDurationMs}+ generationReliable={generationReliable && !showElapsedOnly}+ label={showUsageMeta ? `${elapsedText} · ${rateText ?? tokenA11yText}` : elapsedText}+ >+ {usageMeta}+ </RunningTokenRatePopover></View>);}@@ -11747,7 +11792,7 @@ const makeStyles = (colors: ThemeColors) => StyleSheet.create({composerActivityStatus: {alignItems: 'center',flexDirection: 'row',- height: 25,+ minHeight: 44,justifyContent: 'space-between',paddingHorizontal: spacing.xs,},diff --git a/apps/mobile/src/__tests__/runningTokenRatePopover.test.tsx b/apps/mobile/src/__tests__/runningTokenRatePopover.test.tsxnew file mode 100644index 0000000000..7c61d3db72--- /dev/null+++ b/apps/mobile/src/__tests__/runningTokenRatePopover.test.tsx@@ -0,0 +1,399 @@+// @vitest-environment jsdom+import {+ act,+ createElement,+ forwardRef,+ useImperativeHandle,+ useEffect,+ useState,+} from "react";+import { readFileSync } from "node:fs";+import { resolve } from "node:path";+import ts from "typescript";+import { createRoot, type Root } from "react-dom/client";+import { afterEach, beforeEach, expect, it, vi } from "vitest";+import { clearRateHistoryCache, loadCachedRateHistory } from "@cindy/maker-shared/usage-format";+import { RunningTokenRatePopover } from "@/session/RunningTokenRatePopover";+import { keyboardControlRegion, type ReservedRegion } from "@/platform/windowGeometry";++const harness = vi.hoisted(() => ({+ viewport: { x: 0, y: 0, width: 320, height: 800 },+ window: { width: 320, height: 800 },+ anchor: { x: 220, y: 600, width: 80 },+ insets: { top: 24, bottom: 16, left: 0, right: 0 },+ press: {} as Record<string, (...args: any[]) => void>,+ backdrop: {} as Record<string, (...args: any[]) => void>,+ card: {} as Record<string, (...args: any[]) => void>,+}));+vi.mock("react-native", () => {+ const view = ({ children, testID }: any) =>+ createElement("div", { "data-testid": testID }, children);+ return {+ View: forwardRef((props: any, ref) => {+ useImperativeHandle(ref, () => ({+ measureInWindow: (callback: any) =>+ callback(+ harness.anchor.x,+ harness.anchor.y,+ harness.anchor.width,+ 44,+ ),+ }));+ if (props.testID === "session.tokenRate.card") harness.card = props;+ return view(props);+ }),+ Modal: ({ visible, children }: any) =>+ visible ? createElement("div", {}, children) : null,+ useWindowDimensions: () => harness.window,+ ScrollView: view,+ Text: view,+ StyleSheet: { create: (s: unknown) => s },+ Pressable: (props: any) => {+ if (props.testID === "session.tokenRate.backdrop")+ harness.backdrop = props;+ else harness.press = props;+ return view(props);+ },+ };+});+vi.mock("react-native-safe-area-context", () => ({+ useSafeAreaInsets: () => harness.insets,+}));+vi.mock("@/components/AppText", async () => ({+ Text: (await import("react-native")).Text,+}));+vi.mock("react-native-svg", () => ({+ default: ({ children }: any) => createElement("div", {}, children),+ Path: () => null,+ Circle: () => null,+}));+vi.mock("@/platform/AdaptiveWindowContext", () => ({+ usePaneViewport: () => harness.viewport,+}));+vi.mock("@/theme", async () => {+ const { lightColors } = await import("@/theme/tokens");+ return {+ useTheme: () => ({ colors: lightColors }),+ useThemedStyles: (make: any) => make(lightColors),+ };+});+vi.mock("react-i18next", () => ({+ useTranslation: () => ({+ t: (key: string, args?: any) =>+ key.endsWith("tokenRate")+ ? `${args.rate} tok/s`+ : key.endsWith("tokenCount")+ ? `${args.tokens} tok`+ : key,+ }),+}));++let root: Root;+let host: HTMLDivElement;+const base = {+ sessionKey: "account/device/task",+ startedAt: 1,+ outputTokens: 0,+ generationDurationMs: 0,+ generationReliable: true,+ label: "0s",+ children: "trigger",+};+const render = async (props = {}) =>+ act(async () =>+ root.render(createElement(RunningTokenRatePopover, { ...base, ...props })),+ );+const gesture = async (name: string, x = 0, y = 0) =>+ act(async () => harness.press[name]({ nativeEvent: { pageX: x, pageY: y } }));+const card = () => host.querySelector('[data-testid="session.tokenRate.card"]');++// Exercise the actual status component without mounting the entire session route.+const route = ts.createSourceFile(+ "session.tsx",+ readFileSync(resolve(process.cwd(), "app/sessions/[sessionId].tsx"), "utf8"),+ ts.ScriptTarget.Latest,+ true,+ ts.ScriptKind.TSX,+);+const statusSource = route.statements.find(+ (node) =>+ ts.isFunctionDeclaration(node) &&+ node.name?.text === "ComposerActivityStatus",+)!;+const rateSource = route.statements.find(+ (node) => ts.isFunctionDeclaration(node) && node.name?.text === "formatComposerActivityRateValue",+)!;+const compiledStatus = ts.transpileModule(statusSource.getText(route) + "\n" + rateSource.getText(route), {+ compilerOptions: { jsx: ts.JsxEmit.React, target: ts.ScriptTarget.ES2022 },+}).outputText;+const bindings = {+ React: { createElement, Fragment: "div" },+ useEffect,+ useState,+ useThemedStyles: () => ({}),+ makeStyles: () => ({}),+ useTheme: () => ({ colors: {} }),+ useTranslation: () => ({ t: (key: string) => key }),+ View: ({ children }: any) => createElement("div", {}, children),+ Text: ({ children }: any) => createElement("span", {}, children),+ BlurBackdrop: () => null,+ Sparkles: () => null,+ ArrowDown: () => null,+ iconSize: {},+ iconStroke: {},+ RunningTokenRatePopover,+ formatComposerActivityElapsed: () => "1s",+ formatComposerActivityTokenCount: () => "100",+};+const ActivityStatus = new Function(+ ...Object.keys(bindings),+ `${compiledStatus}; return ComposerActivityStatus;`,+)(...Object.values(bindings));++it.each(["onPress", "onLongPress"])("records the first completed interval before enabling %s, without sampling inactive gaps", async (open) => {+ const renderStatus = (props = {}) => act(async () => root.render(createElement(ActivityStatus, {+ ...base, visible: true, tokenUsage: 100, sideTaskRunning: false,+ reconnectAttempt: null, ...props,+ })));+ await renderStatus();+ expect(host.querySelector('[data-testid="session.tokenRate.trigger"]')).toBeNull();+ // The only paired report may arrive at completion, after startedAt clears.+ await renderStatus({ startedAt: null, outputTokens: 100, generationDurationMs: 1000 });+ await gesture("onPressIn");+ await gesture(open);+ expect(card()!.textContent).toContain("100 tok/s");+ expect(loadCachedRateHistory(base.sessionKey)?.samples.map(s => s.rate)).toEqual([100]);+ for (const inactive of [{ sideTaskRunning: true }, { reconnectAttempt: { attempt: 1, maxAttempts: 3 } }, { generationReliable: false }]) {+ await renderStatus({ outputTokens: 500, generationDurationMs: 2000, ...inactive });+ expect(card()).toBeNull();+ await renderStatus({ outputTokens: 600, generationDurationMs: 3000 });+ expect(card()).toBeNull();+ expect(loadCachedRateHistory(base.sessionKey)?.samples.map(s => s.rate)).toEqual([100]);+ }+ await renderStatus({ outputTokens: 650, generationDurationMs: 4000 });+ expect(loadCachedRateHistory(base.sessionKey)?.samples.map(s => s.rate)).toEqual([100, 50]);+ await renderStatus({ sessionKey: "another-task" });+ await renderStatus({ sessionKey: "another-task", outputTokens: 20, generationDurationMs: 1000 });+ expect(loadCachedRateHistory("another-task")?.samples.map(s => s.rate)).toEqual([20]);+});++it.each(["onPress", "onLongPress"])(+ "removes the %s rate panel whenever rate metadata becomes unavailable, then restores a closed trigger",+ async (open) => {+ const renderStatus = (status: Record<string, unknown> = {}) =>+ act(async () =>+ root.render(+ createElement(ActivityStatus, {+ ...base,+ outputTokens: 100,+ generationDurationMs: 2000,+ visible: true,+ tokenUsage: 100,+ sideTaskRunning: false,+ reconnectAttempt: null,+ ...status,+ }),+ ),+ );+ for (const inactive of [+ { sideTaskRunning: true },+ ...[undefined, "overload", "rate-limit"].map((kind) => ({+ reconnectAttempt: { kind, attempt: 1, maxAttempts: 3 },+ })),+ { visible: false },+ { generationReliable: false },+ { outputTokens: 0 },+ { outputTokens: Number.NaN },+ { generationDurationMs: 0 },+ { generationDurationMs: Number.POSITIVE_INFINITY },+ ]) {+ await renderStatus();+ await gesture("onPressIn");+ await gesture(open);+ expect(card()).not.toBeNull();+ await renderStatus(inactive);+ expect(card()).toBeNull();+ expect(+ host.querySelector('[data-testid="session.tokenRate.trigger"]'),+ ).toBeNull();+ if (!("visible" in inactive)) {+ expect(host.textContent).toContain("1s");+ if (!("sideTaskRunning" in inactive) && !("reconnectAttempt" in inactive)) {+ expect(host.textContent).toContain("session.screen.tokenCount");+ }+ }+ await renderStatus({+ outputTokens: 999,+ generationDurationMs: 9000,+ ...inactive,+ });+ expect(card()).toBeNull();+ await renderStatus();+ expect(card()).toBeNull();+ expect(+ host.querySelector('[data-testid="session.tokenRate.trigger"]'),+ ).not.toBeNull();+ }+ },+);+beforeEach(() => {+ Object.assign(globalThis, { IS_REACT_ACT_ENVIRONMENT: true });+ clearRateHistoryCache();+ harness.viewport = { x: 0, y: 0, width: 320, height: 800 };+ harness.window = { width: 320, height: 800 };+ harness.anchor = { x: 220, y: 600, width: 80 };+ harness.insets = { top: 24, bottom: 16, left: 0, right: 0 };+ host = document.createElement("div");+ root = createRoot(host);+});+afterEach(async () => {+ await act(async () => root.unmount());+ vi.useRealTimers();+});++it("toggles on tap, holds only until release, and does not turn the long-press release into a tap", async () => {+ await render();+ expect(card()).toBeNull();+ await gesture("onPressIn");+ await gesture("onPress");+ expect(card()).not.toBeNull();+ await gesture("onPressIn");+ await gesture("onPress");+ expect(card()).toBeNull();+ await gesture("onPressIn");+ await gesture("onLongPress");+ expect(card()).not.toBeNull();+ await gesture("onPressOut");+ await gesture("onPress");+ expect(card()).toBeNull();+ await gesture("onPressIn");+ await gesture("onPress");+ expect(card()).not.toBeNull();+});++it("dismisses on outside tap, but not card taps or swipes", async () => {+ await render();+ await gesture("onPress");+ expect(harness.card.onStartShouldSetResponder()).toBe(true);+ expect(card()).not.toBeNull();+ await act(async () => {+ harness.backdrop.onPressIn({ nativeEvent: { pageX: 20, pageY: 20 } });+ harness.backdrop.onTouchMove({ nativeEvent: { pageX: 20, pageY: 80 } });+ harness.backdrop.onPress();+ });+ expect(card()).not.toBeNull();+ await act(async () => {+ harness.backdrop.onPressIn({ nativeEvent: { pageX: 20, pageY: 20 } });+ harness.backdrop.onPress();+ });+ expect(card()).toBeNull();+ await gesture("onPressIn");+ await gesture("onLongPress");+ expect(+ host.querySelector('[data-testid="session.tokenRate.backdrop"]'),+ ).toBeNull();+ await gesture("onTouchCancel");+ expect(card()).toBeNull();+});++it.each(["x", "y", "width", "height"] as const)(+ "dismisses when pane %s changes inside the same window",+ async (dimension) => {+ harness.viewport = { x: 0, y: 0, width: 240, height: 600 };+ await render();+ await gesture("onPress");+ expect(card()).not.toBeNull();+ await render({ outputTokens: 10 });+ expect(card()).not.toBeNull();+ harness.viewport = {+ ...harness.viewport,+ [dimension]: harness.viewport[dimension] + 40,+ };+ await render({ outputTokens: 10 });+ expect(card()).toBeNull();+ await gesture("onPressIn");+ await gesture("onPress");+ expect(card()).not.toBeNull();+ },+);++it.each(["onPress", "onLongPress"])(+ "keeps %s cards inside safe bounds as anchor and text height vary",+ async (open) => {+ harness.window = { width: 800, height: 360 };+ harness.viewport = { x: 0, y: 0, ...harness.window };+ harness.insets = { top: 24, bottom: 16, left: 44, right: 44 };+ for (const y of [30, 180, 340]) {+ harness.anchor = { x: 780, y, width: 20 };+ await render({ key: String(y) });+ await gesture("onPressIn");+ await gesture(open);+ for (const height of [100, 220, 296]) {+ await act(async () =>+ harness.card.onLayout({ nativeEvent: { layout: { height } } }),+ );+ const style = Object.assign({}, ...(harness.card as any).style);+ const x = style.left + (open === "onLongPress" ? harness.anchor.x : 0);+ const top = style.top + (open === "onLongPress" ? y : 0);+ expect(x).toBeGreaterThanOrEqual(harness.insets.left);+ expect(x + style.width).toBeLessThanOrEqual(800 - harness.insets.right);+ expect(top).toBeGreaterThanOrEqual(harness.insets.top);+ expect(top + height).toBeLessThanOrEqual(360 - harness.insets.bottom);+ expect(style.maxHeight).toBeLessThanOrEqual(+ 360 - harness.insets.top - harness.insets.bottom,+ );+ }+ }+ },+);++it.each(["onPress", "onLongPress"])("keeps %s in the composer's fold/occlusion region and closes on region changes", async (open) => {+ const scenarios: { regions: ReservedRegion[]; keyboard: number }[] = [+ { regions: [{ kind: "division", x: 0, y: 380, width: 800, height: 40 }], keyboard: 0 },+ { regions: [{ kind: "division", x: 0, y: 380, width: 800, height: 40 }], keyboard: 420 },+ { regions: [{ kind: "division", x: 380, y: 0, width: 40, height: 800 }], keyboard: 0 },+ { regions: [{ kind: "occlusion", x: 200, y: 0, width: 400, height: 100 }], keyboard: 0 },+ ];+ harness.window = { width: 800, height: 800 };+ harness.viewport = { x: 0, y: 0, ...harness.window };+ for (const [index, scenario] of scenarios.entries()) {+ const region = keyboardControlRegion({ ...harness.window, insets: harness.insets,+ regularWidth: true, regularHeight: true, barEdge: "none", reservedRegionsSupported: true,+ regions: scenario.regions }, scenario.keyboard);+ harness.anchor = { x: region.x + region.width - 80, y: region.y + 30, width: 80 };+ await render({ key: String(index), availableRegion: region });+ await gesture("onPressIn");+ await gesture(open);+ let style = Object.assign({}, ...(harness.card as any).style);+ const height = style.maxHeight;+ await act(async () => harness.card.onLayout({ nativeEvent: { layout: { height } } }));+ style = Object.assign({}, ...(harness.card as any).style);+ const x = style.left + (open === "onLongPress" ? harness.anchor.x : 0);+ const y = style.top + (open === "onLongPress" ? harness.anchor.y : 0);+ expect(x).toBeGreaterThanOrEqual(region.x);+ expect(y).toBeGreaterThanOrEqual(region.y);+ expect(x + style.width).toBeLessThanOrEqual(region.x + region.width);+ expect(y + height).toBeLessThanOrEqual(region.y + region.height);+ await render({ key: String(index), availableRegion: { ...region, height: region.height - 20 } });+ expect(card()).toBeNull();+ }+});++it("uses paired generation samples, expires recent speed, and isolates a different task", async () => {+ vi.useFakeTimers();+ vi.setSystemTime(1000);+ await render();+ await render({ outputTokens: 100, generationDurationMs: 1000 });+ await render({ outputTokens: 150, generationDurationMs: 2000 });+ await gesture("onPress");+ expect(card()!.textContent).toContain("50");+ expect(card()!.textContent).toContain("75 tok/s");+ expect(card()!.textContent).toContain("100 tok/s");+ await act(async () => vi.advanceTimersByTime(60_000));+ expect(card()!.textContent).toContain("—");+ await render({ key: "other", sessionKey: "account/device/other" });+ expect(card()).toBeNull();+ await gesture("onPressIn");+ await gesture("onPress");+ expect(card()!.textContent).not.toContain("100 tok/s");+});diff --git a/apps/mobile/src/__tests__/sessionBottomViewport.test.ts b/apps/mobile/src/__tests__/sessionBottomViewport.test.tsnew file mode 100644index 0000000000..69b474685a--- /dev/null+++ b/apps/mobile/src/__tests__/sessionBottomViewport.test.ts@@ -0,0 +1,63 @@+import { readFileSync } from 'node:fs';+import { resolve } from 'node:path';+import ts from 'typescript';+import { expect, it } from 'vitest';+import { keyboardControlRegion, type ReservedRegion } from '@/platform/windowGeometry';++const source = ts.createSourceFile('session.tsx', readFileSync(+ resolve(process.cwd(), 'app/sessions/[sessionId].tsx'), 'utf8',+), ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX);+function element(id: string) {+ let result: ts.JsxElement | undefined;+ function visit(node: ts.Node) {+ if (ts.isJsxElement(node) && node.openingElement.attributes.properties.some(prop =>+ ts.isJsxAttribute(prop) && prop.name.getText(source) === 'testID'+ && prop.initializer && ts.isStringLiteral(prop.initializer) && prop.initializer.text === id)) result = node;+ ts.forEachChild(node, visit);+ }+ visit(source);+ if (!result) throw new Error(`Missing ${id}`);+ return result;+}+function style(node: ts.JsxElement, bindings: Record<string, unknown>) {+ const attribute = node.openingElement.attributes.properties.find(prop =>+ ts.isJsxAttribute(prop) && prop.name.getText(source) === 'style') as ts.JsxAttribute;+ const expression = (attribute.initializer as ts.JsxExpression).expression!;+ const value = new Function(...Object.keys(bindings), `return (${expression.getText(source)});`)(...Object.values(bindings));+ return Object.assign({}, ...value.filter(Boolean));+}++it('clips the input and held card at the selected region while measuring only the bottom content', () => {+ const viewport = element('session.bottomViewport');+ const layer = element('session.bottomLayer');+ expect(layer.parent).toBe(viewport);+ expect(layer.openingElement.getText(source)).toContain('ref={bottomOverlayRef}');+ expect(viewport.openingElement.getText(source)).toContain('pointerEvents="box-none"');+ const regions: ReservedRegion[][] = [+ [{ kind: 'division', x: 0, y: 380, width: 800, height: 20 }],+ [{ kind: 'division', x: 390, y: 0, width: 20, height: 800 }],+ [{ kind: 'occlusion', x: 0, y: 650, width: 800, height: 80 }],+ ];+ for (const reserved of regions) for (const keyboardHeight of [0, 450]) {+ const geometry = { width: 800, height: 800, insets: { top: 24, bottom: 16, left: 0, right: 0 },+ regions: reserved, regularWidth: true, regularHeight: true, barEdge: 'none' as const, reservedRegionsSupported: true };+ const region = keyboardControlRegion(geometry, keyboardHeight);+ const bindings = { StyleSheet: { absoluteFill: { position: 'absolute', left: 0, right: 0, top: 0, bottom: 0 } },+ adaptiveWindow: geometry, composerRegion: region, paneLayout: { detail: { x: 0, width: 800 } },+ windowDimensions: geometry, insets: geometry.insets, styles: {}, nativeComposerFrameAvailable: true,+ sessionOperationLayout: { composerSlot: 'editable' }, shareSelectionActive: false,+ nativeShellLayout: { keyboardBottomInset: Math.max(0, keyboardHeight - 16) } };+ const clip = style(viewport, bindings);+ const input = style(layer, bindings);+ expect(clip).toMatchObject({ position: 'absolute', overflow: 'hidden', top: region.y, left: region.x,+ right: 800 - region.x - region.width, bottom: 800 - region.y - region.height });+ // Expanded input/attachments remain under a real native clipping ancestor;+ // the held card can extend above the measured input within that ancestor.+ expect(input.overflow).toBe('visible');+ expect(input.maxHeight).toBe(region.height);+ expect(input.bottom).toBe(-geometry.insets.bottom);+ expect(viewport.getText(source)).toContain('<SessionComposerPalette');+ expect(viewport.getText(source)).toContain('<ComposerActivityStatus');+ expect(viewport.getText(source)).toContain('<SessionComposerInput');+ }+});diff --git a/apps/mobile/src/__tests__/sessionComposerDesktopFirst.test.ts b/apps/mobile/src/__tests__/sessionComposerDesktopFirst.test.tsindex 2d987a11b5..1957226825 100644--- a/apps/mobile/src/__tests__/sessionComposerDesktopFirst.test.ts+++ b/apps/mobile/src/__tests__/sessionComposerDesktopFirst.test.ts@@ -227,9 +227,11 @@ describe('mobile session composer desktop-first surface', () => {expect(source).toContain('outputTokens={remoteSessionRunStatus.outputTokens}');expect(source).toContain('generationDurationMs={remoteSessionRunStatus.generationDurationMs}');expect(source).toContain('ArrowDown');- expect(source).toContain('{!sideTaskRunning && showUsageMeta ? (');+ expect(source).toContain('const showElapsedOnly = sideTaskRunning || Boolean(reconnectAttempt);');+ expect(source).toContain('const canShowRateDetails = rateValue !== null;');+ expect(source).toContain('enabled={canShowRateDetails}');expect(source).toContain('generationActive={remoteSessionRunStatus.generationActive}');- expect(source).toContain('const showUsageMeta = Boolean(rateText) || tokenUsage > 0;');+ expect(source).toContain('const showUsageMeta = !showElapsedOnly && (Boolean(rateText) || tokenUsage > 0);');expect(source).toContain("t('session.screen.tokenCount'");expect(source).toContain("t('session.screen.tokenCountFull'");expect(source).toContain("t('session.screen.tokenRate'");@@ -244,7 +246,8 @@ describe('mobile session composer desktop-first surface', () => {expect(source).toContain('composerActivityMetaText');expect(source).toContain('composerActivityFrame');expect(source).toContain('marginTop: spacing.lg');- expect(source).toContain('height: 25');+ // The formerly passive rate is now a touch target, with a full 44pt status row.+ expect(source).toMatch(/composerActivityStatus: \{[^}]*minHeight: 44/s);expect(source).toContain('composerActivityStatusText');expect(source).toContain('composerActivityProgressText');expect(composerStatusCallIndex).toBeGreaterThan(-1);@@ -380,6 +383,7 @@ describe('mobile session composer desktop-first surface', () => {expect(source).toContain('onLayout={handleBottomOverlayLayout}');expect(source).toContain('bottomOverlayHeight={bottomOverlayHeight}');expect(source).toContain('styles.sessionBottomLayer,');+ expect(source).toContain("sessionOperationLayout.composerSlot === 'editable' && { overflow: 'visible' }");expect(source).toContain('testID="session.bottomLayer"');expect(source).toContain('testID="session.bottomContent"');expect(source).toContain("paddingBottom: sessionOperationLayout.composerSlot === 'pending-interaction'");diff --git a/apps/mobile/src/i18n/locales/en/session.json b/apps/mobile/src/i18n/locales/en/session.jsonindex 47c774a147..ab3bbd7b9f 100644--- a/apps/mobile/src/i18n/locales/en/session.json+++ b/apps/mobile/src/i18n/locales/en/session.json@@ -182,6 +182,13 @@"tokenCount": "{{tokens}} tok","tokenCountFull": "{{tokens}} tokens","tokenRate": "{{rate}} tok/s",+ "currentRate": "Latest speed",+ "averageRate": "Turn average",+ "rateHistory": "Generation speed history",+ "outputTotal": "Output",+ "observedPeak": "Peak",+ "tokenRateUnit": "tok/s",+ "tokenRateDescription": "Latest generation interval. Excludes tools and waits.","networkReconnecting": "Reconnecting…","modelBusyRetrying": "Model service busy — retrying…","rateLimitRetrying": "Request rate limited — retrying…",diff --git a/apps/mobile/src/i18n/locales/ja/session.json b/apps/mobile/src/i18n/locales/ja/session.jsonindex 46285362c4..983af11dbd 100644--- a/apps/mobile/src/i18n/locales/ja/session.json+++ b/apps/mobile/src/i18n/locales/ja/session.json@@ -182,6 +182,13 @@"tokenCount": "{{tokens}} tok","tokenCountFull": "{{tokens}} tokens","tokenRate": "{{rate}} tok/s",+ "currentRate": "直近の速度",+ "averageRate": "このターンの平均",+ "rateHistory": "生成速度の推移",+ "outputTotal": "累計出力",+ "observedPeak": "ピーク",+ "tokenRateUnit": "tok/s",+ "tokenRateDescription": "直近の生成区間の速度。ツール実行と待機は除きます。","networkReconnecting": "再接続中…","modelBusyRetrying": "モデルサービスが混雑、再試行中…","rateLimitRetrying": "リクエストがレート制限されました。再試行中…",diff --git a/apps/mobile/src/i18n/locales/ko/session.json b/apps/mobile/src/i18n/locales/ko/session.jsonindex 8fc1212dd8..4d4c3a9a22 100644--- a/apps/mobile/src/i18n/locales/ko/session.json+++ b/apps/mobile/src/i18n/locales/ko/session.json@@ -178,6 +178,13 @@"tokenCount": "{{tokens}} tok","tokenCountFull": "{{tokens}} tokens","tokenRate": "{{rate}} tok/s",+ "currentRate": "최근 속도",+ "averageRate": "이번 턴 평균",+ "rateHistory": "생성 속도 추이",+ "outputTotal": "누적 출력",+ "observedPeak": "최고",+ "tokenRateUnit": "tok/s",+ "tokenRateDescription": "최근 생성 구간의 속도. 도구 실행과 대기는 제외합니다.","networkReconnecting": "다시 연결하는 중…","modelBusyRetrying": "모델 서비스 혼잡, 다시 시도 중…","rateLimitRetrying": "요청이 속도 제한에 걸렸습니다. 다시 시도 중…",diff --git a/apps/mobile/src/i18n/locales/zh-CN/session.json b/apps/mobile/src/i18n/locales/zh-CN/session.jsonindex 3525e890f4..5955459f02 100644--- a/apps/mobile/src/i18n/locales/zh-CN/session.json+++ b/apps/mobile/src/i18n/locales/zh-CN/session.json@@ -178,6 +178,13 @@"tokenCount": "{{tokens}} tok","tokenCountFull": "{{tokens}} tokens","tokenRate": "{{rate}} tok/s",+ "currentRate": "最近速度",+ "averageRate": "本轮平均",+ "rateHistory": "生成速度历史",+ "outputTotal": "累计输出",+ "observedPeak": "峰值",+ "tokenRateUnit": "tok/s",+ "tokenRateDescription": "最近一段生成速度,不含工具执行与等待。","networkReconnecting": "正在重新连接…","modelBusyRetrying": "模型服务繁忙,正在重试…","rateLimitRetrying": "请求受到限流,正在重试…",diff --git a/apps/mobile/src/i18n/locales/zh-TW/session.json b/apps/mobile/src/i18n/locales/zh-TW/session.jsonindex 160aea7da5..68805b8e3d 100644--- a/apps/mobile/src/i18n/locales/zh-TW/session.json+++ b/apps/mobile/src/i18n/locales/zh-TW/session.json@@ -182,6 +182,13 @@"tokenCount": "{{tokens}} tok","tokenCountFull": "{{tokens}} tokens","tokenRate": "{{rate}} tok/s",+ "currentRate": "最近速度",+ "averageRate": "本輪平均",+ "rateHistory": "生成速度歷史",+ "outputTotal": "累計輸出",+ "observedPeak": "峰值",+ "tokenRateUnit": "tok/s",+ "tokenRateDescription": "最近一段生成速度,不含工具執行與等待。","networkReconnecting": "正在重新連線…","modelBusyRetrying": "模型服務繁忙,正在重試…","rateLimitRetrying": "請求受到限流,正在重試…",diff --git a/apps/mobile/src/platform/AdaptiveWindowContext.ts b/apps/mobile/src/platform/AdaptiveWindowContext.tsindex 66517440c5..c06873b73d 100644--- a/apps/mobile/src/platform/AdaptiveWindowContext.ts+++ b/apps/mobile/src/platform/AdaptiveWindowContext.ts@@ -4,7 +4,7 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';import type { WindowGeometry } from './windowGeometry';export const GeometryContext = createContext<WindowGeometry | null>(null);-const PaneContext = createContext<{ width: number; height: number } | null>(null);+const PaneContext = createContext<{ width: number; height: number; x?: number; y?: number } | null>(null);export const FloatingSheetContext = createContext(false);export function useAdaptiveWindow(): WindowGeometry {@@ -21,5 +21,5 @@ export const PaneViewportProvider = PaneContext.Provider;export function usePaneViewport() {const window = useWindowDimensions();const pane = useContext(PaneContext);- return pane ? { ...window, ...pane } : window;+ return { ...window, ...pane, x: pane?.x ?? 0, y: pane?.y ?? 0 };}diff --git a/apps/mobile/src/session/RunningTokenRatePopover.tsx b/apps/mobile/src/session/RunningTokenRatePopover.tsxnew file mode 100644index 0000000000..2e801a5adb--- /dev/null+++ b/apps/mobile/src/session/RunningTokenRatePopover.tsx@@ -0,0 +1,427 @@+import { useEffect, useRef, useState, type ReactNode } from "react";+import {+ Modal,+ Pressable,+ ScrollView,+ StyleSheet,+ View,+ useWindowDimensions,+} from "react-native";+import { Text } from "@/components/AppText";+import Svg, { Circle, Path } from "react-native-svg";+import { useTranslation } from "react-i18next";+import {+ emptyRateHistory,+ loadCachedRateHistory,+ recordRunningTokenRate,+ saveCachedRateHistory,+ RATE_SAMPLE_FRESH_MS,+} from "@cindy/maker-shared/usage-format";+import { useTheme, useThemedStyles, type ThemeColors } from "@/theme";+import {+ fontWeight,+ iconStroke,+ lineHeight,+ radius,+ spacing,+ typeScale,+} from "@/theme/tokens";+import { usePaneViewport } from "@/platform/AdaptiveWindowContext";+import { useSafeAreaInsets } from "react-native-safe-area-context";+import type { LayoutRect } from "@/platform/windowGeometry";++export function formatTokenRate(rate: number | null): string {+ if (rate === null || !Number.isFinite(rate) || rate < 0) return "—";+ if (rate === 0) return "0";+ return rate < 0.1+ ? "<0.1"+ : rate >= 100+ ? rate.toFixed(0)+ : rate.toFixed(1).replace(/\.0$/, "");+}++/** Key this component by account/device/session so gestures and counters never cross tasks. */+export function RunningTokenRatePopover({+ sessionKey,+ startedAt,+ outputTokens,+ generationDurationMs,+ generationReliable,+ children,+ label,+ availableRegion,+ enabled = true,+}: {+ sessionKey: string;+ startedAt: number | null;+ outputTokens: number;+ generationDurationMs: number;+ generationReliable: boolean;+ children: ReactNode;+ label: string;+ availableRegion?: LayoutRect;+ enabled?: boolean;+}) {+ const styles = useThemedStyles(makeStyles);+ const { colors } = useTheme();+ const { t } = useTranslation();+ const viewport = usePaneViewport();+ const window = useWindowDimensions();+ const insets = useSafeAreaInsets();+ const anchorRef = useRef<View>(null);+ const [anchor, setAnchor] = useState({ x: 0, y: 0, width: 0 });+ const [cardHeight, setCardHeight] = useState(0);+ const measureAnchor = () =>+ anchorRef.current?.measureInWindow((x, y, width) => {+ setAnchor({ x, y, width });+ });+ const outsideTouch = useRef({ x: 0, y: 0, moved: false });+ // The composer owns region selection, including folds, occlusions and keyboard.+ const region = availableRegion ?? {+ x: insets.left,+ y: insets.top,+ width: window.width - insets.left - insets.right,+ height: window.height - insets.top - insets.bottom,+ };+ const cardWidth = Math.max(+ 1,+ Math.min(+ 304,+ viewport.width - spacing.xl * 2,+ region.width - spacing.lg * 2,+ ),+ );+ const maxCardHeight = Math.max(+ 1,+ region.height - spacing.lg * 2,+ );+ const cardLeft = Math.max(+ region.x + spacing.lg,+ Math.min(+ anchor.x + anchor.width - cardWidth,+ region.x + region.width - spacing.lg - cardWidth,+ ),+ );+ const cardTop = Math.max(+ region.y + spacing.lg,+ Math.min(+ anchor.y - cardHeight,+ region.y + region.height - spacing.lg - cardHeight,+ ),+ );+ const [mode, setMode] = useState<"closed" | "pinned" | "held">("closed");+ useEffect(() => {+ if (!enabled) setMode("closed");+ }, [enabled]);+ // A pane can move or resize without changing the native window dimensions.+ useEffect(+ () => setMode("closed"),+ [+ window.width,+ window.height,+ viewport.x,+ viewport.y,+ viewport.width,+ viewport.height,+ region.x,+ region.y,+ region.width,+ region.height,+ ],+ );+ const longPressed = useRef(false);+ const touchStart = useRef<{ x: number; y: number } | null>(null);+ const [history, setHistory] = useState(() => {+ const cached = loadCachedRateHistory(sessionKey);+ return cached+ ? { ...cached, baseline: null, lastReport: null, latestRate: null }+ : emptyRateHistory(null);+ });+ useEffect(() => {+ setHistory((previous) =>+ recordRunningTokenRate(previous, {+ startedAt,+ outputTokens,+ generationDurationMs,+ generationReliable,+ }),+ );+ }, [startedAt, outputTokens, generationDurationMs, generationReliable]);+ useEffect(() => {+ saveCachedRateHistory(sessionKey, history);+ }, [sessionKey, history]);+ const [now, setNow] = useState(Date.now);+ useEffect(() => {+ if (history.latestSampleAt === undefined) return;+ setNow(Date.now());+ const timer = setTimeout(+ () => setNow(Date.now()),+ Math.max(0, history.latestSampleAt + RATE_SAMPLE_FRESH_MS - Date.now()),+ );+ return () => clearTimeout(timer);+ }, [history.latestSampleAt]);+ // Keep observing counters before the first rate is available. Only the+ // interaction surface is conditional; it must not own sampling lifetime.+ if (!enabled) return <View pointerEvents="none">{children}</View>;+ const recent =+ generationReliable &&+ (startedAt === null || startedAt === history.startedAt) &&+ history.latestSampleAt !== undefined &&+ Math.max(now, Date.now()) - history.latestSampleAt < RATE_SAMPLE_FRESH_MS+ ? history.latestRate+ : null;+ const average =+ generationReliable && generationDurationMs > 0 && outputTokens > 0+ ? (outputTokens * 1000) / generationDurationMs+ : null;+ const samples = history.samples;+ const firstTime = samples[0]?.durationMs ?? 0;+ const span = (samples.at(-1)?.durationMs ?? 0) - firstTime;+ const ceiling = Math.max(1, ...samples.map((sample) => sample.rate));+ const points = samples.map((sample) => ({+ x: span > 0 ? 4 + ((sample.durationMs - firstTime) / span) * 108 : 112,+ y: 44 - (sample.rate / ceiling) * 36,+ }));+ const line = points+ .map((point, index) => `${index ? "L" : "M"}${point.x},${point.y}`)+ .join(" ");+ const last = points.at(-1);+ const rateText = (rate: number | null) =>+ rate === null+ ? "—"+ : t("session.screen.tokenRate", { rate: formatTokenRate(rate) });+ const card = (+ <View+ pointerEvents={mode === "held" ? "none" : "auto"}+ onStartShouldSetResponder={() => true}+ onAccessibilityEscape={() => setMode("closed")}+ testID="session.tokenRate.card"+ onLayout={(event) => setCardHeight(event.nativeEvent.layout.height)}+ style={[+ styles.card,+ {+ width: cardWidth,+ maxHeight: maxCardHeight,+ left: cardLeft - (mode === "held" ? anchor.x : 0),+ top: cardTop - (mode === "held" ? anchor.y : 0),+ opacity: cardHeight > 0 ? 1 : 0,+ },+ ]}+ accessibilityLabel={t("session.screen.tokenRateDescription")}+ >+ <ScrollView+ style={{ maxHeight: maxCardHeight - 2 }}+ contentContainerStyle={styles.cardContent}+ >+ <View style={styles.top}>+ <View style={styles.metric}>+ <Text style={styles.label}>{t("session.screen.currentRate")}</Text>+ <Text style={styles.value}>+ {formatTokenRate(recent)}{" "}+ <Text style={styles.label}>+ {t("session.screen.tokenRateUnit")}+ </Text>+ </Text>+ </View>+ <Svg+ width={120}+ height={48}+ viewBox="0 0 120 48"+ accessibilityLabel={t("session.screen.rateHistory")}+ >+ <Path d="M4 44H112" stroke={colors.textPrimary} opacity={0.12} />+ {points.length > 1 && (+ <>+ <Path+ d={`${line} L112,44 L${points[0].x},44 Z`}+ fill={colors.textPrimary}+ opacity={0.08}+ />+ <Path+ d={line}+ fill="none"+ stroke={colors.textPrimary}+ strokeWidth={iconStroke.thin}+ strokeLinejoin="round"+ />+ </>+ )}+ {last && (+ <Circle+ cx={last.x}+ cy={last.y}+ r={2.5}+ fill={colors.textPrimary}+ />+ )}+ </Svg>+ </View>+ <View style={styles.top}>+ {[+ ["averageRate", rateText(average)],+ [+ "outputTotal",+ t("session.screen.tokenCount", {+ tokens:+ outputTokens >= 1000+ ? `${(outputTokens / 1000).toFixed(1)}k`+ : outputTokens,+ }),+ ],+ ["observedPeak", rateText(samples.length ? history.peak : null)],+ ].map(([key, value]) => (+ <View style={styles.metric} key={key}>+ <Text style={styles.label}>{t(`session.screen.${key}`)}</Text>+ <Text style={styles.detail}>{value}</Text>+ </View>+ ))}+ </View>+ </ScrollView>+ </View>+ );+ return (+ <View+ ref={anchorRef}+ collapsable={false}+ style={styles.anchor}+ onLayout={measureAnchor}+ >+ <Pressable+ accessibilityRole="button"+ accessibilityLabel={label}+ accessibilityState={{ expanded: mode !== "closed" }}+ testID="session.tokenRate.trigger"+ style={({ pressed }) => [styles.trigger, pressed && styles.pressed]}+ onPressIn={(event) => {+ measureAnchor();+ longPressed.current = false;+ touchStart.current = {+ x: event.nativeEvent.pageX,+ y: event.nativeEvent.pageY,+ };+ }}+ onLongPress={() => {+ longPressed.current = true;+ setMode("held");+ }}+ onPress={() => {+ if (longPressed.current) return;+ if (mode === "pinned") {+ setMode("closed");+ return;+ }+ measureAnchor();+ setMode("pinned");+ }}+ onPressOut={() =>+ setMode((value) => (value === "held" ? "closed" : value))+ }+ onTouchCancel={() =>+ setMode((value) => (value === "held" ? "closed" : value))+ }+ onTouchMove={(event) => {+ const start = touchStart.current;+ if (+ start &&+ Math.hypot(+ event.nativeEvent.pageX - start.x,+ event.nativeEvent.pageY - start.y,+ ) > 8+ ) {+ longPressed.current = true;+ }+ }}+ >+ {children}+ </Pressable>+ {mode === "held" && card}+ <Modal+ supportedOrientations={[+ "portrait",+ "portrait-upside-down",+ "landscape-left",+ "landscape-right",+ ]}+ visible={mode === "pinned"}+ transparent+ animationType="none"+ statusBarTranslucent+ navigationBarTranslucent+ onRequestClose={() => setMode("closed")}+ >+ <View style={styles.overlay}>+ <Pressable+ testID="session.tokenRate.backdrop"+ style={StyleSheet.absoluteFill}+ accessible={false}+ onPressIn={(event) => {+ outsideTouch.current = {+ x: event.nativeEvent.pageX,+ y: event.nativeEvent.pageY,+ moved: false,+ };+ }}+ onTouchMove={(event) => {+ const start = outsideTouch.current;+ if (+ Math.hypot(+ event.nativeEvent.pageX - start.x,+ event.nativeEvent.pageY - start.y,+ ) > 8+ )+ start.moved = true;+ }}+ onPress={() => {+ if (!outsideTouch.current.moved) setMode("closed");+ }}+ />+ {card}+ </View>+ </Modal>+ </View>+ );+}++const makeStyles = (colors: ThemeColors) =>+ StyleSheet.create({+ overlay: { flex: 1 },+ anchor: { position: "relative", flexShrink: 0 },+ trigger: {+ minHeight: 44,+ minWidth: 44,+ justifyContent: "center",+ borderRadius: radius.pill,+ },+ pressed: { opacity: 0.72 },+ card: {+ position: "absolute",+ backgroundColor: colors.surfaceElevated,+ borderColor: colors.border,+ borderWidth: 1,+ borderRadius: radius.container,+ overflow: "hidden",+ },+ cardContent: {+ padding: spacing.md,+ gap: spacing.md,+ },+ top: { flexDirection: "row", alignItems: "center", gap: spacing.sm },+ metric: { flex: 1, gap: spacing.xs },+ label: {+ color: colors.textSecondary,+ fontSize: typeScale.caption,+ lineHeight: lineHeight.caption,+ },+ value: {+ color: colors.textPrimary,+ fontSize: typeScale.headline,+ fontWeight: fontWeight.medium,+ fontVariant: ["tabular-nums"],+ },+ detail: {+ color: colors.textPrimary,+ fontSize: typeScale.caption,+ fontWeight: fontWeight.medium,+ fontVariant: ["tabular-nums"],+ },+ });diff --git a/docs/design-rules/design-inventory.md b/docs/design-rules/design-inventory.mdindex 73551ae88e..c819a5f5eb 100644--- a/docs/design-rules/design-inventory.md+++ b/docs/design-rules/design-inventory.md@@ -55,7 +55,7 @@| `mobile.auth` | mobile | 登录与添加账号 | app/(auth)/login.tsx / app/add-account.tsx | AccountSwitcherSheet, AdaptiveWindow, AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, FoldTouchpad, HomeEntryProvider, HomeHeaderGlassButton, HomeHeaderGlassButton.ios, IncomingShareBridge, LoginCaptchaWebView, LoginNativeButton, LoginNativeButton.ios, LoginSkinControls, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileOutboxBridge, MobilePrimitives, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RecentMessageHistories, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, ResidentHomeList, SheetModal, SheetSurface, StartupSplashOverlay, SystemNavigationBack, ThemeProvider, _layout, add-account, gestureHandler, login, peerFileTransport, useLocale | apps/mobile/app/(auth)/login.tsx, apps/mobile/app/_layout.tsx, apps/mobile/app/add-account.tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/LoginCaptchaWebView.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/LoginNativeButton.ios.tsx, apps/mobile/src/components/LoginNativeButton.tsx, apps/mobile/src/components/LoginSkinControls.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/AdaptiveWindow.tsx, apps/mobile/src/platform/chrome/NativeChromeBackButton.ios.tsx, apps/mobile/src/platform/chrome/NativeChromeButton.ios.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SystemNavigationBack.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/FoldTouchpad.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/AccountSwitcherSheet.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HomeHeaderGlassButton.ios.tsx, apps/mobile/src/session/HomeHeaderGlassButton.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/MobileOutboxBridge.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 211 | 80 || `mobile.automations` | mobile | 自动化 | app/automations/[deviceId].tsx | AdaptiveWindow, AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, FoldTouchpad, HomeEntryProvider, HomeHeaderGlassButton, HomeHeaderGlassButton.ios, HomeNativeStackHeader, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileOutboxBridge, MobilePrimitives, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RecentMessageHistories, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, ResidentHomeList, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, [deviceId], _layout, gestureHandler, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/automations/[deviceId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/AdaptiveWindow.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativeChromeBackButton.ios.tsx, apps/mobile/src/platform/chrome/NativeChromeButton.ios.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/FoldTouchpad.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HomeHeaderGlassButton.ios.tsx, apps/mobile/src/session/HomeHeaderGlassButton.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/MobileOutboxBridge.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 204 | 74 || `mobile.chat.new` | mobile | 新建任务 | app/sessions/new.tsx | AdaptiveWindow, AndroidUpdateSheet, AnnotationBurnInWebView, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerAttachmentTray, ComposerFrame, ComposerFrame.ios, ComposerKeyboardAvoidingView, ComposerNativeRow, ComposerNativeRow.ios, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, ContextSheetGoalView, ContextSheetGoalView.ios, ContextSheetMediaViews, DeviceLinkContext, FileTypeIcon, FoldTouchpad, HomeEntryProvider, HomeHeaderGlassButton, HomeHeaderGlassButton.ios, HomeNativeStackHeader, ImageLightbox, IncomingShareBridge, MobileAgentMark, MobileAgentSwitcher, MobileChoicePickerList, MobileComposerInputRow, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileModelPickerList, MobileModelPickerList.ios, MobileOutboxBridge, MobilePermissionPickerList, MobilePermissionPickerList.ios, MobilePrimitives, MobileProviderMark, MobileVendorIcon, ModelOptionsSheetView, ModelOptionsSheetView.ios, ModelPickerNativeHeader, ModelPickerNativeHeader.ios, ModelPickerSheet, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePermissionSheet, NativePermissionSheet.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, NewTaskSelectionSheet, NewTaskSelectionSheet.ios, PaperPlaneIcon, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PlanModeChip, PushNotificationsBridge, QuietSyncIndicator, RecentMessageHistories, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, ResidentHomeList, SheetModal, SheetSurface, SimpleStackHeader, SlowSendNotice, StartupSplashOverlay, ThemeProvider, UnifiedModelPickerSheet, UnifiedModelPickerView, UnifiedModelPickerView.ios, VoiceRecordingPill, _layout, gestureHandler, new, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/sessions/new.tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/FileTypeIcon.tsx, apps/mobile/src/components/MobileAgentMark.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/MobileVendorIcon.tsx, apps/mobile/src/components/PaperPlaneIcon.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/AdaptiveWindow.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativeChromeBackButton.ios.tsx, apps/mobile/src/platform/chrome/NativeChromeButton.ios.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/FoldTouchpad.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/AnnotationBurnInWebView.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerAttachmentTray.tsx, apps/mobile/src/session/ComposerFrame.ios.tsx, apps/mobile/src/session/ComposerFrame.tsx, apps/mobile/src/session/ComposerKeyboardAvoidingView.tsx, apps/mobile/src/session/ComposerNativeRow.ios.tsx, apps/mobile/src/session/ComposerNativeRow.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/ContextSheetGoalView.ios.tsx, apps/mobile/src/session/ContextSheetGoalView.tsx, apps/mobile/src/session/ContextSheetMediaViews.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HomeHeaderGlassButton.ios.tsx, apps/mobile/src/session/HomeHeaderGlassButton.tsx, apps/mobile/src/session/ImageLightbox.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/MobileAgentSwitcher.tsx, apps/mobile/src/session/MobileChoicePickerList.tsx, apps/mobile/src/session/MobileComposerInputRow.tsx, apps/mobile/src/session/MobileModelPickerList.ios.tsx, apps/mobile/src/session/MobileModelPickerList.tsx, apps/mobile/src/session/MobileOutboxBridge.tsx, apps/mobile/src/session/MobilePermissionPickerList.ios.tsx, apps/mobile/src/session/MobilePermissionPickerList.tsx, apps/mobile/src/session/MobileProviderMark.tsx, apps/mobile/src/session/ModelOptionsSheetView.ios.tsx, apps/mobile/src/session/ModelOptionsSheetView.tsx, apps/mobile/src/session/ModelPickerNativeHeader.ios.tsx, apps/mobile/src/session/ModelPickerNativeHeader.tsx, apps/mobile/src/session/ModelPickerSheet.tsx, apps/mobile/src/session/NativePermissionSheet.ios.tsx, apps/mobile/src/session/NativePermissionSheet.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/NewTaskSelectionSheet.ios.tsx, apps/mobile/src/session/NewTaskSelectionSheet.tsx, apps/mobile/src/session/PlanModeChip.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/SlowSendNotice.tsx, apps/mobile/src/session/UnifiedModelPickerSheet.tsx, apps/mobile/src/session/UnifiedModelPickerView.ios.tsx, apps/mobile/src/session/UnifiedModelPickerView.tsx, apps/mobile/src/session/VoiceRecordingPill.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 236 | 113 |-| `mobile.chat.session` | mobile | 任务内容与输入 | app/sessions/[sessionId].tsx | AccountSwitcherSheet, AdaptiveWindow, AgentErrorDetails, AndroidUpdateSheet, AnnotationBurnInWebView, AppText, AuthContext, AuthorizationMessageCard, AutomationTimerIcon, BlurBackdrop, CenteredScreen, ChatFileChipMenuSheet, CompanionAutomationNativeView, CompanionAutomationNativeView.ios, CompanionAutomationSheet, CompanionChoice, CompanionCreateNativeView, CompanionCreateNativeView.ios, CompanionHeader, CompanionMessageActions, CompanionMessageCard, CompanionModelChain, CompanionNativeContent.ios, CompanionNavigationDrawer, CompanionPortraitPicker, CompanionProfileArtifacts, CompanionProfileNativeView, CompanionProfileNativeView.ios, CompanionProfileSheet, CompanionSettingsRow, CompanionSettingsRow.ios, CompanionSheet, CompanionSheet.ios, CompanionWorkingStatus, ComposerAttachmentTray, ComposerExpandButton, ComposerExpandButton.ios, ComposerFrame, ComposerFrame.ios, ComposerKeyboardAvoidingView, ComposerNativeInput, ComposerNativeInput.ios, ComposerNativeRow, ComposerNativeRow.ios, ComposerNativeSection, ComposerNativeSection.ios, ComposerRichInput, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, ContextSheetGoalView, ContextSheetGoalView.ios, ContextSheetMediaViews, ConversationSearchFilterSheet, ConversationShareSvg, ConversationShareWebView, DeviceLinkContext, FailedScheduleNotice, FileTypeIcon, FoldTouchpad, HomeChromeDrawer, HomeChromeFrost, HomeEntryProvider, HomeGlassMenuPanel, HomeHeaderGlassButton, HomeHeaderGlassButton.ios, HomeListVisuals, HomeModeSwitch, HomeNativeStackHeader, HomeNewTaskButton, HomeProjectMachineLabel, HomeSearchBar, HomeSurface, ImageLightbox, IncomingShareBridge, InlineQueueSection, InlineQuoteChip, InlineReferenceChip, InteractionPanel, LoginNativeButton, LoginNativeButton.ios, MarkdownBlockContent, MessageActionSheet, MessageRenderer, MobileAgentMark, MobileAgentSwitcher, MobileBoundaryNotice, MobileComposerInputRow, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileModelPickerList, MobileModelPickerList.ios, MobileOutboxBridge, MobilePermissionPickerList, MobilePermissionPickerList.ios, MobilePrimitives, MobileProviderMark, MobileVendorIcon, ModalContentArea, ModelOptionsSheetView, ModelOptionsSheetView.ios, ModelPickerNativeHeader, ModelPickerNativeHeader.ios, ModelPickerSheet, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePermissionSheet, NativePermissionSheet.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, PaperPlaneIcon, PendingSendBubble, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PlanModeChip, PluginInvocationHeader, PromptRecommendation, PushNotificationsBridge, QuietSyncIndicator, QuoteCapsule, RecentMessageHistories, RemoteAccessGuide, RemoteCompanionAvatar, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, RemoteTaskSuggestions, RenameSessionModal, ResidentHomeList, RewindPreviewPanel, SentInlineAtomBody, SessionActionSheet, SessionDetailsNative, SessionDetailsNative.ios, SessionHeaderNativeControls, SessionHeaderNativeControls.ios, SessionListDrawer, SessionMenuSheet, SessionOptionsExpoSheet, SessionResourceCards, SessionSearchNative, SessionSearchNative.ios, SessionTailBanner, SessionUsageSummary, ShareImageNativeButton, ShareImageNativeButton.ios, ShareMessageCheckbox, ShareSelectAllButton, ShareSelectionBar, SharedTaskEndedState, SharedTaskScreen, SheetModal, SheetSurface, SimpleStackHeader, SlowSendNotice, StartupSplashOverlay, StreamingStatusText, SwipeableSessionRow, SwipeableSessionRow.ios, SystemNavigationBack, TaskTags, TaskTagsSheet, TeammateGenerationLabel, TeammateList, TeammatePicker, ThemeProvider, UnifiedModelPickerSheet, UnifiedModelPickerView, UnifiedModelPickerView.ios, VoiceRecordingPill, [sessionId], _layout, gestureHandler, mathWebView, mediaPlayerWebView, mermaidWebView, peerFileTransport, useLocale, useSharedTaskConfirmation | apps/mobile/app/_layout.tsx, apps/mobile/app/sessions/[sessionId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/FileTypeIcon.tsx, apps/mobile/src/components/LoginNativeButton.ios.tsx, apps/mobile/src/components/LoginNativeButton.tsx, apps/mobile/src/components/MobileAgentMark.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/MobileVendorIcon.tsx, apps/mobile/src/components/PaperPlaneIcon.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/RemoteAccessGuide.tsx, apps/mobile/src/components/RemoteCompanionAvatar.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/AdaptiveWindow.tsx, apps/mobile/src/platform/ModalContentArea.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativeChromeBackButton.ios.tsx, apps/mobile/src/platform/chrome/NativeChromeButton.ios.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/chrome/SystemNavigationBack.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/FoldTouchpad.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/AccountSwitcherSheet.tsx, apps/mobile/src/session/AgentErrorDetails.tsx, apps/mobile/src/session/AnnotationBurnInWebView.tsx, apps/mobile/src/session/AuthorizationMessageCard.tsx, apps/mobile/src/session/AutomationTimerIcon.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ChatFileChipMenuSheet.tsx, apps/mobile/src/session/CompanionAutomationNativeView.ios.tsx, apps/mobile/src/session/CompanionAutomationNativeView.tsx, apps/mobile/src/session/CompanionAutomationSheet.tsx, apps/mobile/src/session/CompanionChoice.tsx, apps/mobile/src/session/CompanionCreateNativeView.ios.tsx, apps/mobile/src/session/CompanionCreateNativeView.tsx, apps/mobile/src/session/CompanionHeader.tsx, apps/mobile/src/session/CompanionMessageActions.tsx, apps/mobile/src/session/CompanionMessageCard.tsx, apps/mobile/src/session/CompanionModelChain.tsx, apps/mobile/src/session/CompanionNativeContent.ios.tsx, apps/mobile/src/session/CompanionNavigationDrawer.tsx, apps/mobile/src/session/CompanionPortraitPicker.tsx, apps/mobile/src/session/CompanionProfileArtifacts.tsx, apps/mobile/src/session/CompanionProfileNativeView.ios.tsx, apps/mobile/src/session/CompanionProfileNativeView.tsx, apps/mobile/src/session/CompanionProfileSheet.tsx, apps/mobile/src/session/CompanionSettingsRow.ios.tsx, apps/mobile/src/session/CompanionSettingsRow.tsx, apps/mobile/src/session/CompanionSheet.ios.tsx, apps/mobile/src/session/CompanionSheet.tsx, apps/mobile/src/session/CompanionWorkingStatus.tsx, apps/mobile/src/session/ComposerAttachmentTray.tsx, apps/mobile/src/session/ComposerExpandButton.ios.tsx, apps/mobile/src/session/ComposerExpandButton.tsx, apps/mobile/src/session/ComposerFrame.ios.tsx, apps/mobile/src/session/ComposerFrame.tsx, apps/mobile/src/session/ComposerKeyboardAvoidingView.tsx, apps/mobile/src/session/ComposerNativeInput.ios.tsx, apps/mobile/src/session/ComposerNativeInput.tsx, apps/mobile/src/session/ComposerNativeRow.ios.tsx, apps/mobile/src/session/ComposerNativeRow.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerRichInput.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/ContextSheetGoalView.ios.tsx, apps/mobile/src/session/ContextSheetGoalView.tsx, apps/mobile/src/session/ContextSheetMediaViews.tsx, apps/mobile/src/session/ConversationSearchFilterSheet.tsx, apps/mobile/src/session/ConversationShareSvg.tsx, apps/mobile/src/session/ConversationShareWebView.tsx, apps/mobile/src/session/FailedScheduleNotice.tsx, apps/mobile/src/session/HomeChromeDrawer.tsx, apps/mobile/src/session/HomeChromeFrost.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HomeGlassMenuPanel.tsx, apps/mobile/src/session/HomeHeaderGlassButton.ios.tsx, apps/mobile/src/session/HomeHeaderGlassButton.tsx, apps/mobile/src/session/HomeListVisuals.tsx, apps/mobile/src/session/HomeModeSwitch.tsx, apps/mobile/src/session/HomeNewTaskButton.tsx, apps/mobile/src/session/HomeProjectMachineLabel.tsx, apps/mobile/src/session/HomeSearchBar.tsx, apps/mobile/src/session/HomeSurface.tsx, apps/mobile/src/session/ImageLightbox.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/InlineQueueSection.tsx, apps/mobile/src/session/InlineQuoteChip.tsx, apps/mobile/src/session/InlineReferenceChip.tsx, apps/mobile/src/session/InteractionPanel.tsx, apps/mobile/src/session/MarkdownBlockContent.tsx, apps/mobile/src/session/MessageActionSheet.tsx, apps/mobile/src/session/MessageRenderer.tsx, apps/mobile/src/session/MobileAgentSwitcher.tsx, apps/mobile/src/session/MobileBoundaryNotice.tsx, apps/mobile/src/session/MobileComposerInputRow.tsx, apps/mobile/src/session/MobileModelPickerList.ios.tsx, apps/mobile/src/session/MobileModelPickerList.tsx, apps/mobile/src/session/MobileOutboxBridge.tsx, apps/mobile/src/session/MobilePermissionPickerList.ios.tsx, apps/mobile/src/session/MobilePermissionPickerList.tsx, apps/mobile/src/session/MobileProviderMark.tsx, apps/mobile/src/session/ModelOptionsSheetView.ios.tsx, apps/mobile/src/session/ModelOptionsSheetView.tsx, apps/mobile/src/session/ModelPickerNativeHeader.ios.tsx, apps/mobile/src/session/ModelPickerNativeHeader.tsx, apps/mobile/src/session/ModelPickerSheet.tsx, apps/mobile/src/session/NativePermissionSheet.ios.tsx, apps/mobile/src/session/NativePermissionSheet.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/PendingSendBubble.tsx, apps/mobile/src/session/PlanModeChip.tsx, apps/mobile/src/session/PluginInvocationHeader.tsx, apps/mobile/src/session/PromptRecommendation.tsx, apps/mobile/src/session/QuoteCapsule.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/RemoteTaskSuggestions.tsx, apps/mobile/src/session/RenameSessionModal.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/RewindPreviewPanel.tsx, apps/mobile/src/session/SentInlineAtomBody.tsx, apps/mobile/src/session/SessionActionSheet.tsx, apps/mobile/src/session/SessionDetailsNative.ios.tsx, apps/mobile/src/session/SessionDetailsNative.tsx, apps/mobile/src/session/SessionHeaderNativeControls.ios.tsx, apps/mobile/src/session/SessionHeaderNativeControls.tsx, apps/mobile/src/session/SessionListDrawer.tsx, apps/mobile/src/session/SessionMenuSheet.tsx, apps/mobile/src/session/SessionOptionsExpoSheet.tsx, apps/mobile/src/session/SessionResourceCards.tsx, apps/mobile/src/session/SessionSearchNative.ios.tsx, apps/mobile/src/session/SessionSearchNative.tsx, apps/mobile/src/session/SessionTailBanner.tsx, apps/mobile/src/session/SessionUsageSummary.tsx, apps/mobile/src/session/ShareImageNativeButton.ios.tsx, apps/mobile/src/session/ShareImageNativeButton.tsx, apps/mobile/src/session/ShareMessageCheckbox.tsx, apps/mobile/src/session/ShareSelectAllButton.tsx, apps/mobile/src/session/ShareSelectionBar.tsx, apps/mobile/src/session/SharedTaskEndedState.tsx, apps/mobile/src/session/SharedTaskScreen.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/SlowSendNotice.tsx, apps/mobile/src/session/StreamingStatusText.tsx, apps/mobile/src/session/SwipeableSessionRow.ios.tsx, apps/mobile/src/session/SwipeableSessionRow.tsx, apps/mobile/src/session/TaskTags.tsx, apps/mobile/src/session/TaskTagsSheet.tsx, apps/mobile/src/session/TeammateGenerationLabel.tsx, apps/mobile/src/session/TeammateList.tsx, apps/mobile/src/session/TeammatePicker.tsx, apps/mobile/src/session/UnifiedModelPickerSheet.tsx, apps/mobile/src/session/UnifiedModelPickerView.ios.tsx, apps/mobile/src/session/UnifiedModelPickerView.tsx, apps/mobile/src/session/VoiceRecordingPill.tsx, apps/mobile/src/session/composerRichInputHtml.ts, apps/mobile/src/session/conversationShareWebViewHtml.ts, apps/mobile/src/session/mathWebView.tsx, apps/mobile/src/session/mathWebViewHtml.ts, apps/mobile/src/session/mediaPlayerWebView.tsx, apps/mobile/src/session/mediaPlayerWebViewHtml.ts, apps/mobile/src/session/mermaidWebView.tsx, apps/mobile/src/session/mermaidWebViewHtml.ts, apps/mobile/src/session/selectableMarkdownHtml.ts, apps/mobile/src/session/useSharedTaskConfirmation.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 7 | 237 | 300 |+| `mobile.chat.session` | mobile | 任务内容与输入 | app/sessions/[sessionId].tsx | AccountSwitcherSheet, AdaptiveWindow, AgentErrorDetails, AndroidUpdateSheet, AnnotationBurnInWebView, AppText, AuthContext, AuthorizationMessageCard, AutomationTimerIcon, BlurBackdrop, CenteredScreen, ChatFileChipMenuSheet, CompanionAutomationNativeView, CompanionAutomationNativeView.ios, CompanionAutomationSheet, CompanionChoice, CompanionCreateNativeView, CompanionCreateNativeView.ios, CompanionHeader, CompanionMessageActions, CompanionMessageCard, CompanionModelChain, CompanionNativeContent.ios, CompanionNavigationDrawer, CompanionPortraitPicker, CompanionProfileArtifacts, CompanionProfileNativeView, CompanionProfileNativeView.ios, CompanionProfileSheet, CompanionSettingsRow, CompanionSettingsRow.ios, CompanionSheet, CompanionSheet.ios, CompanionWorkingStatus, ComposerAttachmentTray, ComposerExpandButton, ComposerExpandButton.ios, ComposerFrame, ComposerFrame.ios, ComposerKeyboardAvoidingView, ComposerNativeInput, ComposerNativeInput.ios, ComposerNativeRow, ComposerNativeRow.ios, ComposerNativeSection, ComposerNativeSection.ios, ComposerRichInput, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, ContextSheetGoalView, ContextSheetGoalView.ios, ContextSheetMediaViews, ConversationSearchFilterSheet, ConversationShareSvg, ConversationShareWebView, DeviceLinkContext, FailedScheduleNotice, FileTypeIcon, FoldTouchpad, HomeChromeDrawer, HomeChromeFrost, HomeEntryProvider, HomeGlassMenuPanel, HomeHeaderGlassButton, HomeHeaderGlassButton.ios, HomeListVisuals, HomeModeSwitch, HomeNativeStackHeader, HomeNewTaskButton, HomeProjectMachineLabel, HomeSearchBar, HomeSurface, ImageLightbox, IncomingShareBridge, InlineQueueSection, InlineQuoteChip, InlineReferenceChip, InteractionPanel, LoginNativeButton, LoginNativeButton.ios, MarkdownBlockContent, MessageActionSheet, MessageRenderer, MobileAgentMark, MobileAgentSwitcher, MobileBoundaryNotice, MobileComposerInputRow, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileModelPickerList, MobileModelPickerList.ios, MobileOutboxBridge, MobilePermissionPickerList, MobilePermissionPickerList.ios, MobilePrimitives, MobileProviderMark, MobileVendorIcon, ModalContentArea, ModelOptionsSheetView, ModelOptionsSheetView.ios, ModelPickerNativeHeader, ModelPickerNativeHeader.ios, ModelPickerSheet, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePermissionSheet, NativePermissionSheet.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, PaperPlaneIcon, PendingSendBubble, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PlanModeChip, PluginInvocationHeader, PromptRecommendation, PushNotificationsBridge, QuietSyncIndicator, QuoteCapsule, RecentMessageHistories, RemoteAccessGuide, RemoteCompanionAvatar, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, RemoteTaskSuggestions, RenameSessionModal, ResidentHomeList, RewindPreviewPanel, RunningTokenRatePopover, SentInlineAtomBody, SessionActionSheet, SessionDetailsNative, SessionDetailsNative.ios, SessionHeaderNativeControls, SessionHeaderNativeControls.ios, SessionListDrawer, SessionMenuSheet, SessionOptionsExpoSheet, SessionResourceCards, SessionSearchNative, SessionSearchNative.ios, SessionTailBanner, SessionUsageSummary, ShareImageNativeButton, ShareImageNativeButton.ios, ShareMessageCheckbox, ShareSelectAllButton, ShareSelectionBar, SharedTaskEndedState, SharedTaskScreen, SheetModal, SheetSurface, SimpleStackHeader, SlowSendNotice, StartupSplashOverlay, StreamingStatusText, SwipeableSessionRow, SwipeableSessionRow.ios, SystemNavigationBack, TaskTags, TaskTagsSheet, TeammateGenerationLabel, TeammateList, TeammatePicker, ThemeProvider, UnifiedModelPickerSheet, UnifiedModelPickerView, UnifiedModelPickerView.ios, VoiceRecordingPill, [sessionId], _layout, gestureHandler, mathWebView, mediaPlayerWebView, mermaidWebView, peerFileTransport, useLocale, useSharedTaskConfirmation | apps/mobile/app/_layout.tsx, apps/mobile/app/sessions/[sessionId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/FileTypeIcon.tsx, apps/mobile/src/components/LoginNativeButton.ios.tsx, apps/mobile/src/components/LoginNativeButton.tsx, apps/mobile/src/components/MobileAgentMark.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/MobileVendorIcon.tsx, apps/mobile/src/components/PaperPlaneIcon.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/RemoteAccessGuide.tsx, apps/mobile/src/components/RemoteCompanionAvatar.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/AdaptiveWindow.tsx, apps/mobile/src/platform/ModalContentArea.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativeChromeBackButton.ios.tsx, apps/mobile/src/platform/chrome/NativeChromeButton.ios.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/chrome/SystemNavigationBack.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/FoldTouchpad.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/AccountSwitcherSheet.tsx, apps/mobile/src/session/AgentErrorDetails.tsx, apps/mobile/src/session/AnnotationBurnInWebView.tsx, apps/mobile/src/session/AuthorizationMessageCard.tsx, apps/mobile/src/session/AutomationTimerIcon.tsx, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ChatFileChipMenuSheet.tsx, apps/mobile/src/session/CompanionAutomationNativeView.ios.tsx, apps/mobile/src/session/CompanionAutomationNativeView.tsx, apps/mobile/src/session/CompanionAutomationSheet.tsx, apps/mobile/src/session/CompanionChoice.tsx, apps/mobile/src/session/CompanionCreateNativeView.ios.tsx, apps/mobile/src/session/CompanionCreateNativeView.tsx, apps/mobile/src/session/CompanionHeader.tsx, apps/mobile/src/session/CompanionMessageActions.tsx, apps/mobile/src/session/CompanionMessageCard.tsx, apps/mobile/src/session/CompanionModelChain.tsx, apps/mobile/src/session/CompanionNativeContent.ios.tsx, apps/mobile/src/session/CompanionNavigationDrawer.tsx, apps/mobile/src/session/CompanionPortraitPicker.tsx, apps/mobile/src/session/CompanionProfileArtifacts.tsx, apps/mobile/src/session/CompanionProfileNativeView.ios.tsx, apps/mobile/src/session/CompanionProfileNativeView.tsx, apps/mobile/src/session/CompanionProfileSheet.tsx, apps/mobile/src/session/CompanionSettingsRow.ios.tsx, apps/mobile/src/session/CompanionSettingsRow.tsx, apps/mobile/src/session/CompanionSheet.ios.tsx, apps/mobile/src/session/CompanionSheet.tsx, apps/mobile/src/session/CompanionWorkingStatus.tsx, apps/mobile/src/session/ComposerAttachmentTray.tsx, apps/mobile/src/session/ComposerExpandButton.ios.tsx, apps/mobile/src/session/ComposerExpandButton.tsx, apps/mobile/src/session/ComposerFrame.ios.tsx, apps/mobile/src/session/ComposerFrame.tsx, apps/mobile/src/session/ComposerKeyboardAvoidingView.tsx, apps/mobile/src/session/ComposerNativeInput.ios.tsx, apps/mobile/src/session/ComposerNativeInput.tsx, apps/mobile/src/session/ComposerNativeRow.ios.tsx, apps/mobile/src/session/ComposerNativeRow.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerRichInput.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/ContextSheetGoalView.ios.tsx, apps/mobile/src/session/ContextSheetGoalView.tsx, apps/mobile/src/session/ContextSheetMediaViews.tsx, apps/mobile/src/session/ConversationSearchFilterSheet.tsx, apps/mobile/src/session/ConversationShareSvg.tsx, apps/mobile/src/session/ConversationShareWebView.tsx, apps/mobile/src/session/FailedScheduleNotice.tsx, apps/mobile/src/session/HomeChromeDrawer.tsx, apps/mobile/src/session/HomeChromeFrost.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HomeGlassMenuPanel.tsx, apps/mobile/src/session/HomeHeaderGlassButton.ios.tsx, apps/mobile/src/session/HomeHeaderGlassButton.tsx, apps/mobile/src/session/HomeListVisuals.tsx, apps/mobile/src/session/HomeModeSwitch.tsx, apps/mobile/src/session/HomeNewTaskButton.tsx, apps/mobile/src/session/HomeProjectMachineLabel.tsx, apps/mobile/src/session/HomeSearchBar.tsx, apps/mobile/src/session/HomeSurface.tsx, apps/mobile/src/session/ImageLightbox.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/InlineQueueSection.tsx, apps/mobile/src/session/InlineQuoteChip.tsx, apps/mobile/src/session/InlineReferenceChip.tsx, apps/mobile/src/session/InteractionPanel.tsx, apps/mobile/src/session/MarkdownBlockContent.tsx, apps/mobile/src/session/MessageActionSheet.tsx, apps/mobile/src/session/MessageRenderer.tsx, apps/mobile/src/session/MobileAgentSwitcher.tsx, apps/mobile/src/session/MobileBoundaryNotice.tsx, apps/mobile/src/session/MobileComposerInputRow.tsx, apps/mobile/src/session/MobileModelPickerList.ios.tsx, apps/mobile/src/session/MobileModelPickerList.tsx, apps/mobile/src/session/MobileOutboxBridge.tsx, apps/mobile/src/session/MobilePermissionPickerList.ios.tsx, apps/mobile/src/session/MobilePermissionPickerList.tsx, apps/mobile/src/session/MobileProviderMark.tsx, apps/mobile/src/session/ModelOptionsSheetView.ios.tsx, apps/mobile/src/session/ModelOptionsSheetView.tsx, apps/mobile/src/session/ModelPickerNativeHeader.ios.tsx, apps/mobile/src/session/ModelPickerNativeHeader.tsx, apps/mobile/src/session/ModelPickerSheet.tsx, apps/mobile/src/session/NativePermissionSheet.ios.tsx, apps/mobile/src/session/NativePermissionSheet.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/PendingSendBubble.tsx, apps/mobile/src/session/PlanModeChip.tsx, apps/mobile/src/session/PluginInvocationHeader.tsx, apps/mobile/src/session/PromptRecommendation.tsx, apps/mobile/src/session/QuoteCapsule.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/RemoteTaskSuggestions.tsx, apps/mobile/src/session/RenameSessionModal.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/RewindPreviewPanel.tsx, apps/mobile/src/session/RunningTokenRatePopover.tsx, apps/mobile/src/session/SentInlineAtomBody.tsx, apps/mobile/src/session/SessionActionSheet.tsx, apps/mobile/src/session/SessionDetailsNative.ios.tsx, apps/mobile/src/session/SessionDetailsNative.tsx, apps/mobile/src/session/SessionHeaderNativeControls.ios.tsx, apps/mobile/src/session/SessionHeaderNativeControls.tsx, apps/mobile/src/session/SessionListDrawer.tsx, apps/mobile/src/session/SessionMenuSheet.tsx, apps/mobile/src/session/SessionOptionsExpoSheet.tsx, apps/mobile/src/session/SessionResourceCards.tsx, apps/mobile/src/session/SessionSearchNative.ios.tsx, apps/mobile/src/session/SessionSearchNative.tsx, apps/mobile/src/session/SessionTailBanner.tsx, apps/mobile/src/session/SessionUsageSummary.tsx, apps/mobile/src/session/ShareImageNativeButton.ios.tsx, apps/mobile/src/session/ShareImageNativeButton.tsx, apps/mobile/src/session/ShareMessageCheckbox.tsx, apps/mobile/src/session/ShareSelectAllButton.tsx, apps/mobile/src/session/ShareSelectionBar.tsx, apps/mobile/src/session/SharedTaskEndedState.tsx, apps/mobile/src/session/SharedTaskScreen.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/SlowSendNotice.tsx, apps/mobile/src/session/StreamingStatusText.tsx, apps/mobile/src/session/SwipeableSessionRow.ios.tsx, apps/mobile/src/session/SwipeableSessionRow.tsx, apps/mobile/src/session/TaskTags.tsx, apps/mobile/src/session/TaskTagsSheet.tsx, apps/mobile/src/session/TeammateGenerationLabel.tsx, apps/mobile/src/session/TeammateList.tsx, apps/mobile/src/session/TeammatePicker.tsx, apps/mobile/src/session/UnifiedModelPickerSheet.tsx, apps/mobile/src/session/UnifiedModelPickerView.ios.tsx, apps/mobile/src/session/UnifiedModelPickerView.tsx, apps/mobile/src/session/VoiceRecordingPill.tsx, apps/mobile/src/session/composerRichInputHtml.ts, apps/mobile/src/session/conversationShareWebViewHtml.ts, apps/mobile/src/session/mathWebView.tsx, apps/mobile/src/session/mathWebViewHtml.ts, apps/mobile/src/session/mediaPlayerWebView.tsx, apps/mobile/src/session/mediaPlayerWebViewHtml.ts, apps/mobile/src/session/mermaidWebView.tsx, apps/mobile/src/session/mermaidWebViewHtml.ts, apps/mobile/src/session/selectableMarkdownHtml.ts, apps/mobile/src/session/useSharedTaskConfirmation.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 7 | 237 | 302 || `mobile.chat.sharing` | mobile | 共享任务邀请与成员 | app/shared-session.tsx | AdaptiveWindow, AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, FoldTouchpad, HomeEntryProvider, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileOutboxBridge, MobilePrimitives, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RecentMessageHistories, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, ResidentHomeList, SharedTaskEndedState, SharedTaskScreen, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, _layout, gestureHandler, peerFileTransport, shared-session, useLocale, useSharedTaskConfirmation | apps/mobile/app/_layout.tsx, apps/mobile/app/shared-session.tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/AdaptiveWindow.tsx, apps/mobile/src/platform/chrome/NativeChromeBackButton.ios.tsx, apps/mobile/src/platform/chrome/NativeChromeButton.ios.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/FoldTouchpad.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/MobileOutboxBridge.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/SharedTaskEndedState.tsx, apps/mobile/src/session/SharedTaskScreen.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/session/useSharedTaskConfirmation.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 204 | 61 || `mobile.companions.direct` | mobile | 伙伴私聊回看 | app/companions/direct/[threadId].tsx | AdaptiveWindow, AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceLinkContext, FoldTouchpad, HomeEntryProvider, HomeHeaderGlassButton, HomeHeaderGlassButton.ios, HomeNativeStackHeader, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileOutboxBridge, MobilePrimitives, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RecentMessageHistories, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, ResidentHomeList, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, [threadId], _layout, gestureHandler, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/companions/direct/[threadId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/AdaptiveWindow.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativeChromeBackButton.ios.tsx, apps/mobile/src/platform/chrome/NativeChromeButton.ios.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/FoldTouchpad.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HomeHeaderGlassButton.ios.tsx, apps/mobile/src/session/HomeHeaderGlassButton.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/MobileOutboxBridge.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 204 | 53 || `mobile.device-management` | mobile | 设备管理 | app/devices/manage.tsx / app/devices/manage/[deviceId].tsx | AdaptiveWindow, AndroidUpdateSheet, AppText, AuthContext, BlurBackdrop, CenteredScreen, ComposerNativeSection, ComposerNativeSection.ios, ComposerSheet, ComposerSheet.ios, ConnectionBanner, ConnectionNoticeOverlay, ContextSheet, ContextSheet.ios, DeviceInformationFields, DeviceInformationFields.ios, DeviceLinkContext, DeviceManagementDialogs, DeviceManagementList, DeviceManagementList.ios, FoldTouchpad, HomeEntryProvider, HomeHeaderGlassButton, HomeHeaderGlassButton.ios, HomeNativeStackHeader, IncomingShareBridge, MobileLoginHandoffContext, MobileLoginHandoffStage, MobileOutboxBridge, MobilePrimitives, ModalContentArea, NativeChromeBackButton.ios, NativeChromeButton.ios, NativePullDownMenu, NativeRemoteDesktopView, NativeResidentHistory, NativeSwitch, PermissionGuide, PermissionGuideView, PermissionGuideView.ios, PushNotificationsBridge, QuietSyncIndicator, RecentMessageHistories, RemoteDesktopActionButton, RemoteDesktopActionButton.ios, RemoteDesktopBackButton, RemoteDesktopBackButton.ios, RemoteDesktopChrome, RemoteDesktopChrome.ios, RemoteDesktopClipboardButton, RemoteDesktopControls, RemoteDesktopDisplaySettings, RemoteDesktopHost, RemoteDesktopIcons, RemoteDesktopMouseControls, RemoteDesktopMouseControls.ios, RemoteDesktopNetworkStatus, RemoteDesktopPanelButton, RemoteDesktopPanelButton.ios, RemoteDesktopScreen, RemoteDesktopSecuritySettings, RemoteDesktopWindows, RenameDeviceModal, ResidentHomeList, SheetModal, SheetSurface, SimpleStackHeader, StartupSplashOverlay, ThemeProvider, [deviceId], _layout, gestureHandler, manage, peerFileTransport, useLocale | apps/mobile/app/_layout.tsx, apps/mobile/app/devices/manage.tsx, apps/mobile/app/devices/manage/[deviceId].tsx, apps/mobile/src/auth/AuthContext.tsx, apps/mobile/src/auth/MobileLoginHandoffContext.tsx, apps/mobile/src/components/AppText.tsx, apps/mobile/src/components/CenteredScreen.tsx, apps/mobile/src/components/ConnectionBanner.tsx, apps/mobile/src/components/ConnectionNoticeOverlay.tsx, apps/mobile/src/components/MobileLoginHandoffStage.tsx, apps/mobile/src/components/MobilePrimitives.tsx, apps/mobile/src/components/QuietSyncIndicator.tsx, apps/mobile/src/components/StartupSplashOverlay.tsx, apps/mobile/src/device-link/DeviceInformationFields.ios.tsx, apps/mobile/src/device-link/DeviceInformationFields.tsx, apps/mobile/src/device-link/DeviceLinkContext.tsx, apps/mobile/src/device-link/DeviceManagementDialogs.tsx, apps/mobile/src/device-link/DeviceManagementList.ios.tsx, apps/mobile/src/device-link/DeviceManagementList.tsx, apps/mobile/src/device-link/peerFileTransport.tsx, apps/mobile/src/i18n/useLocale.tsx, apps/mobile/src/notifications/PushNotificationsBridge.tsx, apps/mobile/src/platform/AdaptiveWindow.tsx, apps/mobile/src/platform/ModalContentArea.tsx, apps/mobile/src/platform/chrome/HomeNativeStackHeader.tsx, apps/mobile/src/platform/chrome/NativeChromeBackButton.ios.tsx, apps/mobile/src/platform/chrome/NativeChromeButton.ios.tsx, apps/mobile/src/platform/chrome/NativePullDownMenu.tsx, apps/mobile/src/platform/chrome/NativeSwitch.tsx, apps/mobile/src/platform/chrome/SimpleStackHeader.tsx, apps/mobile/src/platform/gestureHandler.tsx, apps/mobile/src/remote-desktop/FoldTouchpad.tsx, apps/mobile/src/remote-desktop/NativeRemoteDesktopView.tsx, apps/mobile/src/remote-desktop/PermissionGuide.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.ios.tsx, apps/mobile/src/remote-desktop/PermissionGuideView.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopActionButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopBackButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopChrome.tsx, apps/mobile/src/remote-desktop/RemoteDesktopClipboardButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopDisplaySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopHost.tsx, apps/mobile/src/remote-desktop/RemoteDesktopIcons.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopMouseControls.tsx, apps/mobile/src/remote-desktop/RemoteDesktopNetworkStatus.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.ios.tsx, apps/mobile/src/remote-desktop/RemoteDesktopPanelButton.tsx, apps/mobile/src/remote-desktop/RemoteDesktopScreen.tsx, apps/mobile/src/remote-desktop/RemoteDesktopSecuritySettings.tsx, apps/mobile/src/remote-desktop/RemoteDesktopWindows.tsx, apps/mobile/src/remote-desktop/viewerHtml.ts, apps/mobile/src/session/BlurBackdrop.tsx, apps/mobile/src/session/ComposerNativeSection.ios.tsx, apps/mobile/src/session/ComposerNativeSection.tsx, apps/mobile/src/session/ComposerSheet.ios.tsx, apps/mobile/src/session/ComposerSheet.tsx, apps/mobile/src/session/ContextSheet.ios.tsx, apps/mobile/src/session/ContextSheet.tsx, apps/mobile/src/session/HomeEntryProvider.tsx, apps/mobile/src/session/HomeHeaderGlassButton.ios.tsx, apps/mobile/src/session/HomeHeaderGlassButton.tsx, apps/mobile/src/session/IncomingShareBridge.tsx, apps/mobile/src/session/MobileOutboxBridge.tsx, apps/mobile/src/session/NativeResidentHistory.tsx, apps/mobile/src/session/RecentMessageHistories.tsx, apps/mobile/src/session/RenameDeviceModal.tsx, apps/mobile/src/session/ResidentHomeList.tsx, apps/mobile/src/session/SheetModal.tsx, apps/mobile/src/session/SheetSurface.tsx, apps/mobile/src/theme/ThemeProvider.tsx, apps/mobile/src/theme/navigationTheme.ts, apps/mobile/src/theme/tokens.ts, apps/mobile/src/update/AndroidUpdateSheet.tsx | 0 | 204 | 56 |diff --git a/packages/maker-shared/src/runningTokenRateHistory.ts b/packages/maker-shared/src/runningTokenRateHistory.tsnew file mode 100644index 0000000000..c40497e66e--- /dev/null+++ b/packages/maker-shared/src/runningTokenRateHistory.ts@@ -0,0 +1,165 @@+interface RateCounters {+ durationMs: number;+ outputTokens: number;+}++export interface RateSample extends RateCounters {+ /** Cumulative measured generation time across turns, excluding unmeasured gaps. */+ durationMs: number;+ rate: number;+}++// Millisecond-scale usage batches are not meaningful throughput measurements.+const MIN_SAMPLE_DURATION_MS = 1000;+export const RATE_SAMPLE_FRESH_MS = 60_000;++export interface RateHistory {+ startedAt: number | null;+ baseline: RateCounters | null;+ // Track resets even while the measurement baseline waits for a full window.+ lastReport: RateCounters | null;+ samples: RateSample[];+ peak: number;+ latestRate: number | null;+ latestSampleAt?: number;+}++export function emptyRateHistory(startedAt: number | null): RateHistory {+ return {+ startedAt,+ baseline: null,+ lastReport: null,+ samples: [],+ peak: 0,+ latestRate: null,+ };+}++const MAX_RATE_SAMPLES = 60;++/** Real usage reports are sparse: this is the latest measured interval, not an instantaneous rate. */+export function recordRunningTokenRate(+ history: RateHistory,+ input: {+ startedAt: number | null;+ outputTokens: number;+ generationDurationMs: number;+ generationReliable: boolean;+ now?: number;+ },+): RateHistory {+ const { outputTokens, generationDurationMs, generationReliable } = input;+ // Terminal status clears startedAt before the status bar finishes its linger/fade.+ // Keep its identity so a final paired usage report can still be recorded.+ const startedAt = input.startedAt ?? history.startedAt;+ const previous = history.lastReport;+ const reset =+ history.startedAt !== startedAt ||+ (previous !== null &&+ (generationDurationMs < previous.durationMs ||+ outputTokens < previous.outputTokens));+ // Reset only the measurement baseline; completed intervals remain in the chart.+ const current = reset+ ? {+ ...history,+ startedAt,+ baseline: null,+ lastReport: null,+ latestRate: null,+ }+ : history;+ if (+ !generationReliable ||+ startedAt === null ||+ !Number.isFinite(outputTokens) ||+ !Number.isFinite(generationDurationMs) ||+ outputTokens < 0 ||+ generationDurationMs < 0+ ) {+ return current.baseline || current.lastReport || current.latestRate !== null+ ? { ...current, baseline: null, lastReport: null, latestRate: null }+ : current;+ }+ if (+ previous?.durationMs === generationDurationMs &&+ previous.outputTokens === outputTokens &&+ !reset+ ) {+ return current;+ }+ const baseline = { durationMs: generationDurationMs, outputTokens };+ const observed = { ...current, lastReport: baseline };+ if (!current.baseline) {+ // Opening midway through a turn must not label its cumulative average as a recent sample.+ return { ...observed, baseline };+ }+ const durationDelta = generationDurationMs - current.baseline.durationMs;+ const tokenDelta = outputTokens - current.baseline.outputTokens;+ // A time-only refresh cannot close a token interval: the matching usage may+ // arrive later in a batch. Keep both counters anchored to the last sample.+ // An explicitly empty output stream can still measure zero throughput.+ if (outputTokens > 0 && outputTokens === previous?.outputTokens)+ return observed;+ if (durationDelta === 0) {+ // A corrected count without a matching time cannot produce a rate.+ return { ...observed, baseline };+ }+ // Keep accumulating both counters, including at completion. An unfinished+ // window must not replace the last valid rate or inflate the observed peak.+ if (durationDelta < MIN_SAMPLE_DURATION_MS) return observed;+ const rate = (tokenDelta * 1000) / durationDelta;+ if (!Number.isFinite(rate)) return { ...observed, baseline };+ const samples = [+ ...current.samples.slice(-(MAX_RATE_SAMPLES - 1)),+ {+ durationMs: (current.samples.at(-1)?.durationMs ?? 0) + durationDelta,+ outputTokens,+ rate,+ },+ ];+ return {+ ...observed,+ baseline,+ samples,+ peak: Math.max(...samples.map((sample) => sample.rate)),+ latestRate: rate,+ latestSampleAt: input.now ?? Date.now(),+ };+}++const MAX_CACHED_SESSIONS = 20;++/**+ * 进程内按会话缓存速度历史:切到其他任务再切回同一任务时图表不清零。+ * 刻意不落盘(磁盘持久化超出本功能边界),应用重启后自然清零。+ */+const rateHistoryBySession = new Map<string, RateHistory>();++export function loadCachedRateHistory(sessionKey: string): RateHistory | null {+ const cached = rateHistoryBySession.get(sessionKey);+ if (!cached) return null;+ // Map 按插入序迭代:读到的会话移到队尾,淘汰从队头取最久未用的。+ rateHistoryBySession.delete(sessionKey);+ rateHistoryBySession.set(sessionKey, cached);+ return cached;+}++export function saveCachedRateHistory(+ sessionKey: string,+ history: RateHistory,+): void {+ // 没有采样点就没有可恢复的图表,不必占缓存名额。+ if (history.samples.length === 0) return;+ rateHistoryBySession.delete(sessionKey);+ rateHistoryBySession.set(sessionKey, history);+ while (rateHistoryBySession.size > MAX_CACHED_SESSIONS) {+ const oldestKey = rateHistoryBySession.keys().next().value;+ if (oldestKey === undefined) break;+ rateHistoryBySession.delete(oldestKey);+ }+}++/** 整体清空;供测试与将来的登出/数据清理流程使用。 */+export function clearRateHistoryCache(): void {+ rateHistoryBySession.clear();+}diff --git a/packages/maker-shared/src/usageFormat.ts b/packages/maker-shared/src/usageFormat.tsindex c41345ba4f..1200cdd187 100644--- a/packages/maker-shared/src/usageFormat.ts+++ b/packages/maker-shared/src/usageFormat.ts@@ -29,3 +29,5 @@ export function formatCompactTokens(n: number): string {const largest = TOKEN_UNITS[TOKEN_UNITS.length - 1];return `${(n / largest.divisor).toFixed(1)}${largest.suffix}`;}++export * from './runningTokenRateHistory.js';